From a6dfc2806ff7ba69ade4e0cbb1566511fae68749 Mon Sep 17 00:00:00 2001 From: "DESKTOP-G961P6V\\Zhh" <839860190@qq.com> Date: Tue, 11 Jun 2024 02:56:37 +0800 Subject: [PATCH] =?UTF-8?q?=E9=9D=92=E8=97=8F=E9=93=81=E8=B7=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Qztl/ImportPatientRegisterPlugInsQztl.cs | 50 +++++++++---------- .../ImportPatientRegisterPlugInsHzcyTest.cs | 2 +- .../ImportPatientRegisterPlugInsBase.cs | 31 +++++++++++- .../CustomerOrgGroupAppService.cs | 34 +++++++++++++ 4 files changed, 89 insertions(+), 28 deletions(-) diff --git a/ThirdPlugIns/Shentun.Peis.PlugIns.Gem/PatientRegisters/Qztl/ImportPatientRegisterPlugInsQztl.cs b/ThirdPlugIns/Shentun.Peis.PlugIns.Gem/PatientRegisters/Qztl/ImportPatientRegisterPlugInsQztl.cs index a7e2b998..d4c5430f 100644 --- a/ThirdPlugIns/Shentun.Peis.PlugIns.Gem/PatientRegisters/Qztl/ImportPatientRegisterPlugInsQztl.cs +++ b/ThirdPlugIns/Shentun.Peis.PlugIns.Gem/PatientRegisters/Qztl/ImportPatientRegisterPlugInsQztl.cs @@ -28,7 +28,7 @@ namespace Shentun.Peis.PlugIns.Extensions.PatientRegisters.Qztl { public class ImportPatientRegisterPlugInsQztl : ImportPatientRegisterPlugInsBase { - private Guid _importCustomerOrgId; + private string _hospitalId; private string _aesKEY; private string _year; @@ -36,7 +36,7 @@ namespace Shentun.Peis.PlugIns.Extensions.PatientRegisters.Qztl private CustomerOrgRegisterDto _customerOrgRegisterDto; private List _personnelTypes; private List _customerOrgGroupDtos; - private Guid _customerOrgRegisterId; + private string _answerWebApiUrl; public ImportPatientRegisterPlugInsQztl(Guid thirdInterfaceId) : base(thirdInterfaceId) @@ -49,10 +49,10 @@ namespace Shentun.Peis.PlugIns.Extensions.PatientRegisters.Qztl } - public override async Task> ImportAsync(Guid customerOrgRegisterId) + public override async Task> ImportPatientRegisterByCustomerOrgRegisterIdAsync(Guid customerOrgRegisterId) { - _customerOrgRegisterId = customerOrgRegisterId; - if(_customerOrgRegisterId == Guid.Empty) + CustomerOrgRegisterId = customerOrgRegisterId; + if(CustomerOrgRegisterId == Guid.Empty) { throw new Exception("customerOrgRegisterId参数不能为空"); } @@ -168,7 +168,7 @@ namespace Shentun.Peis.PlugIns.Extensions.PatientRegisters.Qztl } var customerOrgDtos = await CallAppServiceAsync>( "api/app/CustomerOrg/GetChildCustomerOrgsById", - new CustomerOrgIdInputDto() { CustomerOrgId = _importCustomerOrgId }); + new CustomerOrgIdInputDto() { CustomerOrgId = _customerOrgDto.Id }); CustomerOrgDto customerOrgDto = null; if (customerOrgDtos != null && customerOrgDtos.Any()) { @@ -180,7 +180,7 @@ namespace Shentun.Peis.PlugIns.Extensions.PatientRegisters.Qztl "api/app/customerorg/create", new CreateCustomerOrgDto() { MedicalCenterId = _customerOrgDto.MedicalCenterId, - ParentId = _importCustomerOrgId, + ParentId = _customerOrgDto.Id, DisplayName = orgName, ShortName = orgName, IsActive = 'Y', @@ -192,9 +192,9 @@ namespace Shentun.Peis.PlugIns.Extensions.PatientRegisters.Qztl { //复检 //加载单位分组信息 - _customerOrgGroupDtos = await CallAppServiceAsync>( - "api/app/customer-org-group/in-customer-org-id/" + _importCustomerOrgId.ToString() - , Guid.Empty, "get"); + _customerOrgGroupDtos = await CallAppServiceAsync>( + "api/app/CustomerOrgGroup/GetListByCustomerOrgRegisterId" + , new CustomerOrgRegisterIdInputDto() { CustomerOrgRegisterId = CustomerOrgRegisterId}); customerOrgGroupDto = _customerOrgGroupDtos.Where(o => o.DisplayName == "复检").FirstOrDefault(); if (customerOrgGroupDto == null) { @@ -386,7 +386,7 @@ namespace Shentun.Peis.PlugIns.Extensions.PatientRegisters.Qztl public async Task InitAsync() { - if (_customerOrgRegisterId == Guid.Empty) + if (CustomerOrgRegisterId == Guid.Empty) { throw new Exception("customerOrgRegisterId参数不能为空"); } @@ -399,10 +399,7 @@ namespace Shentun.Peis.PlugIns.Extensions.PatientRegisters.Qztl return; } - if (!Guid.TryParse(customerOrgIdStr, out _importCustomerOrgId)) - { - throw new Exception("单位编号不正确"); - } + if (string.IsNullOrWhiteSpace(_hospitalId)) { throw new Exception("HospitalId参数不能为空"); @@ -411,6 +408,7 @@ namespace Shentun.Peis.PlugIns.Extensions.PatientRegisters.Qztl { throw new Exception("_aesKEY参数不能为空"); } + Guid customerOrgId; using (DbConnection conn = new NpgsqlConnection(AppConnctionStr)) { string sql; @@ -424,7 +422,7 @@ namespace Shentun.Peis.PlugIns.Extensions.PatientRegisters.Qztl customer_org_register.id = @CustomerOrgRegisterId "; var customerOrgForPlugInss = (await conn.QueryAsync(sql, - new { CustomerOrgRegisterId = _customerOrgRegisterId })).FirstOrDefault(); + new { CustomerOrgRegisterId = CustomerOrgRegisterId })).FirstOrDefault(); if (customerOrgForPlugInss == null) { @@ -444,19 +442,19 @@ namespace Shentun.Peis.PlugIns.Extensions.PatientRegisters.Qztl } _year = year; - _importCustomerOrgId = customerOrgForPlugInss.CustomerOrgId; + customerOrgId = customerOrgForPlugInss.CustomerOrgId; } //加载单位信息 _customerOrgDto = await CallAppServiceAsync( "api/app/CustomerOrg/GetById", new CustomerOrgIdInputDto() { - CustomerOrgId = _importCustomerOrgId, + CustomerOrgId = customerOrgId, }); //加载单位登记信息 _customerOrgRegisterDto = await CallAppServiceAsync( "api/app/CustomerOrgRegister/GetById", new CustomerOrgRegisterIdInputDto() { - CustomerOrgRegisterId = _customerOrgRegisterId, + CustomerOrgRegisterId = CustomerOrgRegisterId, }); //加载人员类别列表 _personnelTypes = await CallAppServiceAsync>("api/app/PersonnelType/GetAll", ""); @@ -726,9 +724,9 @@ namespace Shentun.Peis.PlugIns.Extensions.PatientRegisters.Qztl groupName += sexName; } - _customerOrgGroupDtos = await CallAppServiceAsync>( - "api/app/customer-org-group/in-customer-org-id/" + _importCustomerOrgId.ToString() - , Guid.Empty, "get"); + _customerOrgGroupDtos = await CallAppServiceAsync>( + "api/app/CustomerOrgGroup/GetListByCustomerOrgRegisterId" + , new CustomerOrgRegisterIdInputDto() { CustomerOrgRegisterId = CustomerOrgRegisterId}); var customerOrgGroup = _customerOrgGroupDtos.Where(o => o.DisplayName == groupName).FirstOrDefault(); if (customerOrgGroup != null) { @@ -741,7 +739,7 @@ namespace Shentun.Peis.PlugIns.Extensions.PatientRegisters.Qztl var createCustomerOrgGroupWithDetailDto = new CreateCustomerOrgGroupWithDetailDto() { IsMaxMedicalTimes = 'Y', - CustomerOrgId = _importCustomerOrgId, + CustomerOrgId = _customerOrgDto.Id, DisplayName = groupName, ForSexId = sexId, AgeLowerLimit = 0, @@ -766,9 +764,9 @@ namespace Shentun.Peis.PlugIns.Extensions.PatientRegisters.Qztl existGroupName = goupNames[i]; } - _customerOrgGroupDtos = await CallAppServiceAsync>( - "api/app/customerorgregister/getlistincustomerorgid?CustomerOrgId=" + _importCustomerOrgId.ToString() - , Guid.Empty, "get"); + _customerOrgGroupDtos = await CallAppServiceAsync>( + "api/app/CustomerOrgGroup/GetListByCustomerOrgRegisterId" + , new CustomerOrgRegisterIdInputDto() { CustomerOrgRegisterId = CustomerOrgRegisterId}); customerOrgGroup = _customerOrgGroupDtos.Where(o => o.DisplayName == existGroupName).FirstOrDefault(); if (customerOrgGroup == null) { diff --git a/ThirdPlugIns/Shentun.Peis.PlugIns.Gem/test/Shentun.Peis.PlugIns.Gem.Test/ImportPatientRegisterPlugInsHzcyTest.cs b/ThirdPlugIns/Shentun.Peis.PlugIns.Gem/test/Shentun.Peis.PlugIns.Gem.Test/ImportPatientRegisterPlugInsHzcyTest.cs index aeda033d..8731d8aa 100644 --- a/ThirdPlugIns/Shentun.Peis.PlugIns.Gem/test/Shentun.Peis.PlugIns.Gem.Test/ImportPatientRegisterPlugInsHzcyTest.cs +++ b/ThirdPlugIns/Shentun.Peis.PlugIns.Gem/test/Shentun.Peis.PlugIns.Gem.Test/ImportPatientRegisterPlugInsHzcyTest.cs @@ -27,7 +27,7 @@ namespace Shentun.Peis.PlugIns.Extensions.Test configParm = File.ReadAllText(filePath); var input = new ImportPatientRegisterPlugInsQztl(new Guid("7f2b453c-e45c-44bf-ba6b-9ef192a3cf88")); - var errorList = await input.ImportAsync(new Guid("3a126b36-b71a-e626-e8be-17d47216f927")); + var errorList = await input.ImportPatientRegisterByCustomerOrgRegisterIdAsync(new Guid("3a126b36-b71a-e626-e8be-17d47216f927")); foreach ( var item in errorList ) { _output.WriteLine(item); diff --git a/src/Shentun.ColumnReferencePlugIns/PatientRegisters/ImportPatientRegisterPlugInsBase.cs b/src/Shentun.ColumnReferencePlugIns/PatientRegisters/ImportPatientRegisterPlugInsBase.cs index 5ce8e8a4..c0dbf090 100644 --- a/src/Shentun.ColumnReferencePlugIns/PatientRegisters/ImportPatientRegisterPlugInsBase.cs +++ b/src/Shentun.ColumnReferencePlugIns/PatientRegisters/ImportPatientRegisterPlugInsBase.cs @@ -8,6 +8,7 @@ namespace Shentun.Peis.PlugIns.PatientRegisters { public class ImportPatientRegisterPlugInsBase : ThirdPlugInsBase { + protected Guid CustomerOrgRegisterId; public ImportPatientRegisterPlugInsBase(Guid thirdInterfaceId) : base(thirdInterfaceId) { @@ -16,9 +17,37 @@ namespace Shentun.Peis.PlugIns.PatientRegisters { } - public virtual async Task> ImportAsync(Guid customerOrgRegisterId) + public virtual async Task> ImportPatientRegisterByCustomerOrgRegisterIdAsync(Guid customerOrgRegisterId) { throw new NotImplementedException(); } + public override Task DoWork() + { + //var loginResult = LoginAsync().Result; + var queryDaysStr = InterfaceConfig.GetSection("Interface").GetSection("Scheduler").GetSection("QueryDays").Value; + var customerOrgRegisterIdStr = InterfaceConfig.GetSection("Interface").GetSection("CustomerOrgRegisterId").Value; + if(!Guid.TryParse(customerOrgRegisterIdStr, out CustomerOrgRegisterId)) + { + return Task.CompletedTask; + } + + if (string.IsNullOrWhiteSpace(queryDaysStr)) + { + queryDaysStr = "1"; + } + if (!int.TryParse(queryDaysStr, out int days)) + { + days = 1; + } + try + { + var result = ImportPatientRegisterByCustomerOrgRegisterIdAsync(CustomerOrgRegisterId).Result; + } + catch (Exception ex) + { + + } + return Task.CompletedTask; + } } } diff --git a/src/Shentun.Peis.Application/CustomerOrgGroups/CustomerOrgGroupAppService.cs b/src/Shentun.Peis.Application/CustomerOrgGroups/CustomerOrgGroupAppService.cs index 8276aee5..f98c2f53 100644 --- a/src/Shentun.Peis.Application/CustomerOrgGroups/CustomerOrgGroupAppService.cs +++ b/src/Shentun.Peis.Application/CustomerOrgGroups/CustomerOrgGroupAppService.cs @@ -408,8 +408,42 @@ namespace Shentun.Peis.CustomerOrgGroups } return new List(); } + /// + /// 获取体检分组列表 按单位登记ID + /// + /// + /// + [HttpPut("api/app/CustomerOrgGroup/GetListByCustomerOrgRegisterId")] + public async Task> GetListByCustomerOrgRegisterIdAsync(CustomerOrgRegisterIdInputDto input) + { + var entlist = await Repository.GetListAsync(m => m.CustomerOrgRegisterId == input.CustomerOrgRegisterId); + var entdto = entlist.Select(s => new CustomerOrgGroupDto + { + CreationTime = s.CreationTime, + CreatorId = s.CreatorId, + DisplayName = s.DisplayName, + DisplayOrder = s.DisplayOrder, + Id = s.Id, + LastModificationTime = s.LastModificationTime, + LastModifierId = s.LastModifierId, + Price = s.Price, + ForSexId = s.ForSexId, + Remark = s.Remark, + MaritalStatusId = s.MaritalStatusId, + JobTitle = s.JobTitle, + JobPost = s.JobPost, + AgeUpperLimit = s.AgeUpperLimit, + AgeLowerLimit = s.AgeLowerLimit, + CreatorName = _cacheService.GetSurnameAsync(s.CreatorId).Result, + LastModifierName = _cacheService.GetSurnameAsync(s.LastModifierId).Result, + CustomerOrgRegisterId = input.CustomerOrgRegisterId + }).ToList(); + + return entdto; + return new List(); + } /// /// 复制上次分组 ///