|
|
|
@ -2465,7 +2465,7 @@ namespace Shentun.Peis.PatientRegisters |
|
|
|
var ocCheckTypeEnt = await _ocCheckTypeRepository.FirstOrDefaultAsync(f => f.DisplayName == input.OcCheckTypeName); |
|
|
|
if (ocCheckTypeEnt == null) |
|
|
|
{ |
|
|
|
throw new UserFriendlyException("职业病检查类别名称不正确"); |
|
|
|
throw new UserFriendlyException($"职业病检查类别{input.OcCheckTypeName}名称不正确"); |
|
|
|
} |
|
|
|
|
|
|
|
ocCheckTypeId = ocCheckTypeEnt.Id; |
|
|
|
@ -2476,10 +2476,13 @@ namespace Shentun.Peis.PatientRegisters |
|
|
|
|
|
|
|
foreach (var poisonItem in input.Poisons) |
|
|
|
{ |
|
|
|
if (string.IsNullOrWhiteSpace(poisonItem)) |
|
|
|
throw new UserFriendlyException($"职业病毒害因素{poisonItem}不能为空"); |
|
|
|
|
|
|
|
var poisonEnt = await _poisonRepository.FirstOrDefaultAsync(f => f.DisplayName == poisonItem); |
|
|
|
if (poisonEnt == null) |
|
|
|
{ |
|
|
|
throw new UserFriendlyException("职业病毒害因素名称不正确"); |
|
|
|
throw new UserFriendlyException($"职业病毒害因素{poisonItem}名称不正确"); |
|
|
|
} |
|
|
|
if (!poisonIds.Contains(poisonEnt.Id)) |
|
|
|
{ |
|
|
|
@ -2598,12 +2601,17 @@ namespace Shentun.Peis.PatientRegisters |
|
|
|
PatientRegister patientRegister = null; |
|
|
|
CreateRegisterCheckAsbitemEntity createRegisterCheckAsbitemEntity = null; |
|
|
|
patientRegister = await _manager.CreateAsync(createPatientRegisterArg); |
|
|
|
if (customerOrgGroupId != null) |
|
|
|
await _patientRegisterManager.SetCustomerOrgGroupId(patientRegister, (Guid)customerOrgGroupId); |
|
|
|
await _repository.InsertAsync(patientRegister, true); |
|
|
|
|
|
|
|
|
|
|
|
List<RegisterCheckAsbitem> registerAsbitems = new List<RegisterCheckAsbitem>(); |
|
|
|
|
|
|
|
//设置分组有关组合项目
|
|
|
|
if (customerOrgGroupId != null) |
|
|
|
{ |
|
|
|
var registerAsbitems = (await _customerOrgGroupDetailRepository.GetQueryableAsync()).Include(x => x.Asbitem) |
|
|
|
registerAsbitems = (await _customerOrgGroupDetailRepository.GetQueryableAsync()).Include(x => x.Asbitem) |
|
|
|
.Where(m => m.CustomerOrgGroupId == customerOrgGroupId) |
|
|
|
.Select(s => new RegisterCheckAsbitem |
|
|
|
{ |
|
|
|
@ -2616,6 +2624,7 @@ namespace Shentun.Peis.PatientRegisters |
|
|
|
StandardPrice = s.Asbitem.Price |
|
|
|
}).ToList(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
#region 职业病业务 检索职业病对应的项目
|
|
|
|
|
|
|
|
@ -2654,13 +2663,16 @@ namespace Shentun.Peis.PatientRegisters |
|
|
|
} |
|
|
|
#endregion
|
|
|
|
|
|
|
|
if (registerAsbitems.Any()) |
|
|
|
{ |
|
|
|
|
|
|
|
createRegisterCheckAsbitemEntity = await _registerAsbitemManager.UpdateManyAsync(patientRegister, registerAsbitems); |
|
|
|
|
|
|
|
if (createRegisterCheckAsbitemEntity != null) |
|
|
|
{ |
|
|
|
await UpdateRegisterChecks(createRegisterCheckAsbitemEntity); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
#region 增加职业病信息
|
|
|
|
|
|
|
|
@ -2673,7 +2685,11 @@ namespace Shentun.Peis.PatientRegisters |
|
|
|
JobType = input.JobType, |
|
|
|
OcCheckTypeId = ocCheckTypeId, |
|
|
|
RiskFactors = string.Join(",", input.Poisons), |
|
|
|
PatientRegisterId = patientRegister.Id |
|
|
|
PatientRegisterId = patientRegister.Id, |
|
|
|
DrinkFlag = '0', |
|
|
|
SmokeFlag = '0', |
|
|
|
FamilyGeneticHistory = "无", |
|
|
|
Other = "无" |
|
|
|
}; |
|
|
|
|
|
|
|
patientOccupationalDiseaseEnt = _patientOccupationalDiseaseManager.CreateAsync(patientOccupationalDiseaseEnt); |
|
|
|
@ -2698,7 +2714,6 @@ namespace Shentun.Peis.PatientRegisters |
|
|
|
await _patientPoisonRepository.InsertManyAsync(patientPoisons); |
|
|
|
} |
|
|
|
#endregion
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
await CurrentUnitOfWork.SaveChangesAsync(); |
|
|
|
|