|
|
|
@ -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<PersonnelTypeDto> _personnelTypes; |
|
|
|
private List<CustomerOrgGroupDto> _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<List<string>> ImportAsync(Guid customerOrgRegisterId) |
|
|
|
public override async Task<List<string>> 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<CustomerOrgIdInputDto, List<CustomerOrgDto>>( |
|
|
|
"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<Guid, List<CustomerOrgGroupDto>>( |
|
|
|
"api/app/customer-org-group/in-customer-org-id/" + _importCustomerOrgId.ToString() |
|
|
|
, Guid.Empty, "get"); |
|
|
|
_customerOrgGroupDtos = await CallAppServiceAsync<CustomerOrgRegisterIdInputDto, List<CustomerOrgGroupDto>>( |
|
|
|
"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<CustomerOrgForPlugIns>(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<CustomerOrgIdInputDto, CustomerOrgDto>( |
|
|
|
"api/app/CustomerOrg/GetById", new CustomerOrgIdInputDto() |
|
|
|
{ |
|
|
|
CustomerOrgId = _importCustomerOrgId, |
|
|
|
CustomerOrgId = customerOrgId, |
|
|
|
}); |
|
|
|
//加载单位登记信息
|
|
|
|
_customerOrgRegisterDto = await CallAppServiceAsync<CustomerOrgRegisterIdInputDto, CustomerOrgRegisterDto>( |
|
|
|
"api/app/CustomerOrgRegister/GetById", new CustomerOrgRegisterIdInputDto() |
|
|
|
{ |
|
|
|
CustomerOrgRegisterId = _customerOrgRegisterId, |
|
|
|
CustomerOrgRegisterId = CustomerOrgRegisterId, |
|
|
|
}); |
|
|
|
//加载人员类别列表
|
|
|
|
_personnelTypes = await CallAppServiceAsync<string, List<PersonnelTypeDto>>("api/app/PersonnelType/GetAll", ""); |
|
|
|
@ -726,9 +724,9 @@ namespace Shentun.Peis.PlugIns.Extensions.PatientRegisters.Qztl |
|
|
|
groupName += sexName; |
|
|
|
} |
|
|
|
|
|
|
|
_customerOrgGroupDtos = await CallAppServiceAsync<Guid, List<CustomerOrgGroupDto>>( |
|
|
|
"api/app/customer-org-group/in-customer-org-id/" + _importCustomerOrgId.ToString() |
|
|
|
, Guid.Empty, "get"); |
|
|
|
_customerOrgGroupDtos = await CallAppServiceAsync<CustomerOrgRegisterIdInputDto, List<CustomerOrgGroupDto>>( |
|
|
|
"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<Guid, List<CustomerOrgGroupDto>>( |
|
|
|
"api/app/customerorgregister/getlistincustomerorgid?CustomerOrgId=" + _importCustomerOrgId.ToString() |
|
|
|
, Guid.Empty, "get"); |
|
|
|
_customerOrgGroupDtos = await CallAppServiceAsync<CustomerOrgRegisterIdInputDto, List<CustomerOrgGroupDto>>( |
|
|
|
"api/app/CustomerOrgGroup/GetListByCustomerOrgRegisterId" |
|
|
|
, new CustomerOrgRegisterIdInputDto() { CustomerOrgRegisterId = CustomerOrgRegisterId}); |
|
|
|
customerOrgGroup = _customerOrgGroupDtos.Where(o => o.DisplayName == existGroupName).FirstOrDefault(); |
|
|
|
if (customerOrgGroup == null) |
|
|
|
{ |
|
|
|
|