|
|
|
@ -20,6 +20,7 @@ using Shentun.Peis.CustomerReports; |
|
|
|
using Shentun.Peis.CustomerOrgGroupDetails; |
|
|
|
using Shentun.Peis.CustomerOrgRegisters; |
|
|
|
using Shentun.Peis.Enums; |
|
|
|
using Shentun.Peis.Patients; |
|
|
|
|
|
|
|
namespace Shentun.Peis.PlugIns.Gem |
|
|
|
{ |
|
|
|
@ -42,7 +43,8 @@ namespace Shentun.Peis.PlugIns.Gem |
|
|
|
{ |
|
|
|
await LoginAsync(); |
|
|
|
await InitAsync(); |
|
|
|
|
|
|
|
for(var i = 0;i<30;i++) |
|
|
|
{ |
|
|
|
var qztlPatientRegisterFromInterface = await CallInterfaceServiceAsync(); |
|
|
|
if (qztlPatientRegisterFromInterface == null || !qztlPatientRegisterFromInterface.plans.Any()) |
|
|
|
{ |
|
|
|
@ -88,7 +90,11 @@ namespace Shentun.Peis.PlugIns.Gem |
|
|
|
workTypeV = "," + workTypeV; |
|
|
|
} |
|
|
|
jobPost = jobPost + workTypeV; |
|
|
|
if (!string.IsNullOrWhiteSpace(jobPost) && jobPost.Length >= 10) |
|
|
|
{ |
|
|
|
jobPost = jobPost.Substring(0, 10);//只能存储10个汉字
|
|
|
|
} |
|
|
|
|
|
|
|
//查找子单位是否存在,如存在获取子单位id,如果不存在这创建子单位
|
|
|
|
var orgName = patient.orgName; |
|
|
|
var pos = orgName.IndexOf("_"); |
|
|
|
@ -110,8 +116,8 @@ namespace Shentun.Peis.PlugIns.Gem |
|
|
|
customerOrgDto = await CallAppServiceAsync<CreateCustomerOrgDto, CustomerOrgDto>( |
|
|
|
"api/app/customerorg/create", new CreateCustomerOrgDto() |
|
|
|
{ |
|
|
|
MedicalCenterId = _importCustomerOrgId, |
|
|
|
ParentId = _customerOrgDto.MedicalCenterId, |
|
|
|
MedicalCenterId = _customerOrgDto.MedicalCenterId , |
|
|
|
ParentId = _importCustomerOrgId, |
|
|
|
DisplayName = orgName, |
|
|
|
ShortName = orgName, |
|
|
|
IsActive = 'Y', |
|
|
|
@ -124,7 +130,7 @@ namespace Shentun.Peis.PlugIns.Gem |
|
|
|
//复检
|
|
|
|
//加载单位分组信息
|
|
|
|
_customerOrgGroupDtos = await CallAppServiceAsync<Guid, List<CustomerOrgGroupDto>>( |
|
|
|
"api/app/customerorgregister/getlistincustomerorgid?CustomerOrgId=" + _importCustomerOrgId.ToString() |
|
|
|
"api/app/customer-org-group/in-customer-org-id/" + _importCustomerOrgId.ToString() |
|
|
|
, Guid.Empty, "get"); |
|
|
|
customerOrgGroupDto = _customerOrgGroupDtos.Where(o => o.DisplayName == "复检").FirstOrDefault(); |
|
|
|
if (customerOrgGroupDto == null) |
|
|
|
@ -169,6 +175,8 @@ namespace Shentun.Peis.PlugIns.Gem |
|
|
|
} |
|
|
|
customerOrgGroupDto = await GetCustomerOrgGroup(groupNames, sexId, maritalStatusId); |
|
|
|
} |
|
|
|
//获取病人ID
|
|
|
|
|
|
|
|
var patientRegister = new CreatePatientRegisterDto() |
|
|
|
{ |
|
|
|
MedicalCenterId = _customerOrgDto.MedicalCenterId, |
|
|
|
@ -177,6 +185,7 @@ namespace Shentun.Peis.PlugIns.Gem |
|
|
|
IsMaxMedicalTimes = 'Y', |
|
|
|
CompleteFlag = '0', |
|
|
|
CustomerOrgId = customerOrgDto.Id, |
|
|
|
CustomerOrgRegisterId = _customerOrgRegisterDto.Id, |
|
|
|
CustomerOrgGroupId = customerOrgGroupDto.Id, |
|
|
|
PatientName = patient.personName, |
|
|
|
SexId = sexId, |
|
|
|
@ -185,7 +194,7 @@ namespace Shentun.Peis.PlugIns.Gem |
|
|
|
MobileTelephone = patient.mobile, |
|
|
|
Planuserid = patient.id.ToString(), |
|
|
|
IdNo = patient.cardId, |
|
|
|
PersonnelTypeId = personnelType.Id, |
|
|
|
//PersonnelTypeId = personnelType.Id,
|
|
|
|
JobTitle = jobTitle, |
|
|
|
Remark = patient.remark, |
|
|
|
JobPost = jobPost, |
|
|
|
@ -199,10 +208,31 @@ namespace Shentun.Peis.PlugIns.Gem |
|
|
|
QztlIsCy = patient.ifCy == 1 ? 'Y' : 'N', |
|
|
|
IsQztlImport = 'Y' |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(patient.cardId)) |
|
|
|
{ |
|
|
|
var patientInfo = await CallAppServiceAsync<IdNoInputDto, PatientDto>( |
|
|
|
"api/app/patient/GetByIdNo", |
|
|
|
new IdNoInputDto() |
|
|
|
{ |
|
|
|
IdNo = patient.cardId |
|
|
|
}); |
|
|
|
if (patientInfo != null) |
|
|
|
{ |
|
|
|
patientRegister.PatientId = patientInfo.Id; |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (medicalTypeDto != null) |
|
|
|
{ |
|
|
|
patientRegister.MedicalTypeId = medicalTypeDto.Id; |
|
|
|
} |
|
|
|
if (personnelType != null) |
|
|
|
{ |
|
|
|
patientRegister.PersonnelTypeId = personnelType.Id; |
|
|
|
} |
|
|
|
if (patient.ifGy == 1) |
|
|
|
{ |
|
|
|
patientRegister.QztlType = '0'; |
|
|
|
@ -232,10 +262,16 @@ namespace Shentun.Peis.PlugIns.Gem |
|
|
|
Amount = asbitem.CustomerOrgGroupDetailAmount |
|
|
|
}); |
|
|
|
} |
|
|
|
await CallAppServiceAsync<CreatePatientRegisterDto, List<PatientRegisterOrNoDto>>( |
|
|
|
await CallAppServiceAsync<CreatePatientRegisterDto, object>( |
|
|
|
"api/PatientRegister/CreatePatientRegister", |
|
|
|
patientRegister); |
|
|
|
|
|
|
|
var succesIds = new List<string>(); |
|
|
|
var deleteIds = new List<string>(); |
|
|
|
succesIds.Add(patientRegister.Planuserid); |
|
|
|
await NoteOk(succesIds, deleteIds); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -309,7 +345,7 @@ namespace Shentun.Peis.PlugIns.Gem |
|
|
|
CustomerOrgId = _importCustomerOrgId, |
|
|
|
}); |
|
|
|
//加载人员类别列表
|
|
|
|
var _personnelTypes = await CallAppServiceAsync<string, List<PersonnelTypeDto>>("api/app/PersonnelType/GetAll", ""); |
|
|
|
_personnelTypes = await CallAppServiceAsync<string, List<PersonnelTypeDto>>("api/app/PersonnelType/GetAll", ""); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -388,7 +424,7 @@ namespace Shentun.Peis.PlugIns.Gem |
|
|
|
case 2: |
|
|
|
return '1'; |
|
|
|
case 3: |
|
|
|
return '3'; |
|
|
|
return '4'; |
|
|
|
default: |
|
|
|
return '9'; |
|
|
|
} |
|
|
|
@ -503,13 +539,13 @@ namespace Shentun.Peis.PlugIns.Gem |
|
|
|
} |
|
|
|
} |
|
|
|
string maritalStatusName; |
|
|
|
if (maritalStatusId == '9' || maritalStatusId == '1') |
|
|
|
if (maritalStatusId == '0') |
|
|
|
{ |
|
|
|
maritalStatusName = "已婚"; |
|
|
|
maritalStatusName = "未婚"; |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
maritalStatusName = "未婚"; |
|
|
|
maritalStatusName = "已婚"; |
|
|
|
} |
|
|
|
if (sexName == "女") |
|
|
|
{ |
|
|
|
@ -521,7 +557,7 @@ namespace Shentun.Peis.PlugIns.Gem |
|
|
|
} |
|
|
|
|
|
|
|
_customerOrgGroupDtos = await CallAppServiceAsync<Guid, List<CustomerOrgGroupDto>>( |
|
|
|
"api/app/customerorgregister/getlistincustomerorgid?CustomerOrgId=" + _importCustomerOrgId.ToString() |
|
|
|
"api/app/customer-org-group/in-customer-org-id/" + _importCustomerOrgId.ToString() |
|
|
|
, Guid.Empty, "get"); |
|
|
|
var customerOrgGroup = _customerOrgGroupDtos.Where(o => o.DisplayName == groupName).FirstOrDefault(); |
|
|
|
if (customerOrgGroup != null) |
|
|
|
@ -601,7 +637,7 @@ namespace Shentun.Peis.PlugIns.Gem |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
if (successIds.Count == 0 || deleteIds.Count == 0) |
|
|
|
if (successIds.Count == 0 && deleteIds.Count == 0) |
|
|
|
{ |
|
|
|
return; |
|
|
|
} |
|
|
|
@ -658,7 +694,10 @@ namespace Shentun.Peis.PlugIns.Gem |
|
|
|
result = await response.Content.ReadAsStringAsync(); |
|
|
|
|
|
|
|
result = result.Replace(":\"[{", ":[{").Replace("}]\"", "}]").Replace("\\", ""); |
|
|
|
|
|
|
|
if (result.IndexOf("更新ok") >= 0 || result.IndexOf("更新OK") >= 0 || result.IndexOf("更新Ok") >= 0) |
|
|
|
{ |
|
|
|
return; |
|
|
|
} |
|
|
|
dynamic? resultDto = JsonConvert.DeserializeObject(result); |
|
|
|
if (resultDto != null) |
|
|
|
{ |
|
|
|
|