From 265d7257515894902f8a09d6b00ea121d298f08a Mon Sep 17 00:00:00 2001 From: wxd <123@qq.com> Date: Mon, 29 Apr 2024 12:43:31 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=9B=E5=BB=BA=E6=A1=A3=E6=A1=88=E5=8F=B7?= =?UTF-8?q?=E3=80=81=E6=9D=A1=E7=A0=81=E5=8F=B7=E3=80=81=E6=A3=80=E6=9F=A5?= =?UTF-8?q?=E5=8D=95=E5=8F=B7=20=20=E4=BF=AE=E6=94=B9=E7=B3=BB=E7=BB=9F?= =?UTF-8?q?=E5=8F=82=E6=95=B0=E9=85=8D=E7=BD=AE=E5=BC=82=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../PatientRegisterManager.cs | 38 +++++++-- .../Patients/PatientManager.cs | 81 +++++++++++-------- .../RegisterChecks/RegisterCheckManager.cs | 55 ++++++++++--- 3 files changed, 121 insertions(+), 53 deletions(-) diff --git a/src/Shentun.Peis.Domain/PatientRegisters/PatientRegisterManager.cs b/src/Shentun.Peis.Domain/PatientRegisters/PatientRegisterManager.cs index cc55521..371c1c3 100644 --- a/src/Shentun.Peis.Domain/PatientRegisters/PatientRegisterManager.cs +++ b/src/Shentun.Peis.Domain/PatientRegisters/PatientRegisterManager.cs @@ -779,8 +779,16 @@ namespace Shentun.Peis.PatientRegisters } if (string.IsNullOrWhiteSpace(patient_register_no_rule_coding)) { - //获取全局配置 - patient_register_no_rule_coding = spv_global.Where(m => m.SysParmId == "patient_register_no_rule_coding").FirstOrDefault().ParmValue; + var patient_register_no_rule_coding_ent = spv_global.Where(m => m.SysParmId == "patient_register_no_rule_coding").FirstOrDefault(); + if (patient_register_no_rule_coding_ent == null) + { + throw new UserFriendlyException("全局系统参数patient_register_no_rule_coding未配置"); + } + else + { + //获取全局配置 + patient_register_no_rule_coding = patient_register_no_rule_coding_ent.ParmValue; + } } if (string.IsNullOrWhiteSpace(patient_register_no_rule_coding)) { @@ -795,8 +803,17 @@ namespace Shentun.Peis.PatientRegisters } if (string.IsNullOrWhiteSpace(patient_register_no_rule_prefix)) { - //获取全局配置 - patient_register_no_rule_prefix = spv_global.Where(m => m.SysParmId == "patient_register_no_rule_prefix").FirstOrDefault().ParmValue; + var patient_register_no_rule_prefix_ent = spv_global.Where(m => m.SysParmId == "patient_register_no_rule_prefix").FirstOrDefault(); + if (patient_register_no_rule_prefix_ent == null) + { + throw new UserFriendlyException("全局系统参数patient_register_no_rule_prefix未配置"); + } + else + { + //获取全局配置 + patient_register_no_rule_prefix = patient_register_no_rule_prefix_ent.ParmValue; + } + } if (!string.IsNullOrEmpty(patient_register_no_rule_prefix)) { @@ -811,8 +828,17 @@ namespace Shentun.Peis.PatientRegisters if (string.IsNullOrWhiteSpace(patient_register_no_rule_tail_len)) { - //获取全局配置 - patient_register_no_rule_tail_len = spv_global.Where(m => m.SysParmId == "patient_register_no_rule_tail_len").FirstOrDefault().ParmValue; + var patient_register_no_rule_tail_len_ent = spv_global.Where(m => m.SysParmId == "patient_register_no_rule_tail_len").FirstOrDefault(); + if (patient_register_no_rule_tail_len_ent == null) + { + throw new UserFriendlyException("全局系统参数patient_register_no_rule_tail_len未配置"); + } + else + { + //获取全局配置 + patient_register_no_rule_tail_len = patient_register_no_rule_tail_len_ent.ParmValue; + } + } if (string.IsNullOrWhiteSpace(patient_register_no_rule_tail_len)) diff --git a/src/Shentun.Peis.Domain/Patients/PatientManager.cs b/src/Shentun.Peis.Domain/Patients/PatientManager.cs index a89b642..8cc086f 100644 --- a/src/Shentun.Peis.Domain/Patients/PatientManager.cs +++ b/src/Shentun.Peis.Domain/Patients/PatientManager.cs @@ -50,7 +50,7 @@ namespace Shentun.Peis.Patients Patient entity ) { - await Verify(entity); + await Verify(entity); if (!string.IsNullOrWhiteSpace(entity.NationId)) { @@ -72,7 +72,7 @@ namespace Shentun.Peis.Patients } //允许指定档案号,主要是导入人员名单时使用 var patientNo = entity.PatientNo; - if(string.IsNullOrWhiteSpace(patientNo)) + if (string.IsNullOrWhiteSpace(patientNo)) { patientNo = await CreatePatientNo(entity.MedicalCenterId); } @@ -94,7 +94,7 @@ namespace Shentun.Peis.Patients PostalCode = entity.PostalCode, SexId = entity.SexId, Telephone = entity.Telephone, - PatientNo = patientNo, + PatientNo = patientNo, SimpleCode = LanguageConverter.GetPYSimpleCode(entity.DisplayName) }; @@ -110,7 +110,7 @@ namespace Shentun.Peis.Patients Patient targetEntity ) { - if(sourceEntity == targetEntity) + if (sourceEntity == targetEntity) { throw new UserFriendlyException("更新人员信息时源实体不能等于目标实体"); } @@ -124,7 +124,7 @@ namespace Shentun.Peis.Patients throw new UserFriendlyException("民族ID不存在"); } } - if(!string.IsNullOrWhiteSpace(sourceEntity.IdNo)) + if (!string.IsNullOrWhiteSpace(sourceEntity.IdNo)) { DataHelper.CheckIdNo(sourceEntity.IdNo); } @@ -137,22 +137,22 @@ namespace Shentun.Peis.Patients } sourceEntity.BirthDate = ConvertExtr.ToBirthDateByIdNo(sourceEntity.IdNo); } - if (targetEntity.DisplayName != sourceEntity.DisplayName && targetEntity.SexId != sourceEntity.SexId) + if (targetEntity.DisplayName != sourceEntity.DisplayName && targetEntity.SexId != sourceEntity.SexId) { throw new UserFriendlyException("人员信息姓名和性别和原来的信息都不一致,禁止修改"); } //targetEntity.MedicalCenterId = sourceEntity.MedicalCenterId; targetEntity.DisplayName = sourceEntity.DisplayName; targetEntity.MaritalStatusId = sourceEntity.MaritalStatusId; - if(!string.IsNullOrWhiteSpace(sourceEntity.Address)) + if (!string.IsNullOrWhiteSpace(sourceEntity.Address)) { targetEntity.Address = sourceEntity.Address; } - if(sourceEntity.BirthDate!=null) + if (sourceEntity.BirthDate != null) { targetEntity.BirthDate = sourceEntity.BirthDate; } - + targetEntity.BirthPlaceId = sourceEntity.BirthPlaceId; if (!string.IsNullOrWhiteSpace(sourceEntity.Email)) { @@ -178,16 +178,16 @@ namespace Shentun.Peis.Patients { targetEntity.PostalCode = sourceEntity.PostalCode; } - if(sourceEntity.SexId != SexFlag.UnKnown) + if (sourceEntity.SexId != SexFlag.UnKnown) { targetEntity.SexId = sourceEntity.SexId; } - - if(targetEntity.DisplayName != sourceEntity.DisplayName) + + if (targetEntity.DisplayName != sourceEntity.DisplayName) { targetEntity.SimpleCode = LanguageConverter.GetPYSimpleCode(targetEntity.DisplayName); } - + } @@ -209,9 +209,9 @@ namespace Shentun.Peis.Patients throw new UserFriendlyException("民族ID不存在"); } } - if(!string.IsNullOrWhiteSpace(entity.IdNo)) + if (!string.IsNullOrWhiteSpace(entity.IdNo)) { - var existPatient = await _repository.FindAsync(o=>o.IdNo == entity.IdNo); + var existPatient = await _repository.FindAsync(o => o.IdNo == entity.IdNo); if (existPatient != null) { throw new UserFriendlyException("该身份证号已经在人员信息中注册"); @@ -219,7 +219,7 @@ namespace Shentun.Peis.Patients entity.BirthDate = ConvertExtr.ToBirthDateByIdNo(entity.IdNo); } - + var ent = new Patient { DisplayName = entity.DisplayName, @@ -263,7 +263,7 @@ namespace Shentun.Peis.Patients { throw new UserFriendlyException($"人员\"{patientEnt.DisplayName}\"已被登记,登记的条码号为(\"{patientRegisterEnt.PatientRegisterNo}\"),不能删除"); } - + await _repository.DeleteAsync(id); } @@ -300,10 +300,18 @@ namespace Shentun.Peis.Patients //获取体检中心配置 patient_id_rule_prefix = spv_tjzx.Where(m => m.SysParmId == "patient_id_rule_prefix").FirstOrDefault().ParmValue; } - if(string.IsNullOrWhiteSpace(patient_id_rule_prefix)) + if (string.IsNullOrWhiteSpace(patient_id_rule_prefix)) { - //获取全局配置 - patient_id_rule_prefix = spv_global.Where(m => m.SysParmId == "patient_id_rule_prefix").FirstOrDefault().ParmValue; + var patient_id_rule_prefix_ent = spv_global.Where(m => m.SysParmId == "patient_id_rule_prefix").FirstOrDefault(); + if (patient_id_rule_prefix_ent == null) + { + throw new UserFriendlyException("全局系统参数patient_id_rule_prefix未配置"); + } + else + { + //获取全局配置 + patient_id_rule_prefix = patient_id_rule_prefix_ent.ParmValue; + } } if (spv_tjzx.Where(m => m.SysParmId == "patient_id_rule_tail_len").Count() > 0) @@ -311,10 +319,18 @@ namespace Shentun.Peis.Patients //获取体检中心配置 patient_id_rule_tail_len = spv_tjzx.Where(m => m.SysParmId == "patient_id_rule_tail_len").FirstOrDefault().ParmValue; } - if(string.IsNullOrWhiteSpace(patient_id_rule_tail_len)) + if (string.IsNullOrWhiteSpace(patient_id_rule_tail_len)) { - //获取全局配置 - patient_id_rule_tail_len = spv_global.Where(m => m.SysParmId == "patient_id_rule_tail_len").FirstOrDefault().ParmValue; + var patient_id_rule_tail_len_ent = spv_global.Where(m => m.SysParmId == "patient_id_rule_tail_len").FirstOrDefault(); + if (patient_id_rule_tail_len_ent == null) + { + throw new UserFriendlyException("全局系统参数patient_id_rule_tail_len未配置"); + } + else + { + //获取全局配置 + patient_id_rule_tail_len = patient_id_rule_tail_len_ent.ParmValue; + } } if (string.IsNullOrWhiteSpace(patient_id_rule_tail_len)) @@ -332,9 +348,6 @@ namespace Shentun.Peis.Patients } - - - string maxnum = "1"; //未补位的档案号 var primarykeyBuilderEnt = await _primarykeyBuilderRepository.FirstOrDefaultAsync(f => f.PrimarykeyBuilderId == "patient_no"); @@ -363,7 +376,7 @@ namespace Shentun.Peis.Patients } - + private bool IsParmNUll(object obj) { if (obj == null) @@ -374,7 +387,7 @@ namespace Shentun.Peis.Patients private async Task Verify(Patient entity) { DataHelper.CheckEntityIsNull(entity); - if(!string.IsNullOrEmpty(entity.DisplayName)) + if (!string.IsNullOrEmpty(entity.DisplayName)) { entity.DisplayName = entity.DisplayName.Trim(); } @@ -382,7 +395,7 @@ namespace Shentun.Peis.Patients if (!string.IsNullOrEmpty(entity.IdNo)) { entity.IdNo = entity.IdNo.Trim(); - if(entity.IdNo.Length != 18) + if (entity.IdNo.Length != 18) { throw new UserFriendlyException("身份证长度必须为18位"); } @@ -398,16 +411,16 @@ namespace Shentun.Peis.Patients throw new UserFriendlyException("身份证号解析出的性别与填入的性别不一致"); } } - + } //DataHelper.CheckStringIsNull(entity.PatientNo, "病人号"); - DataHelper.CheckGuidIsDefaultValue(entity.MedicalCenterId,"组织单位ID"); + DataHelper.CheckGuidIsDefaultValue(entity.MedicalCenterId, "组织单位ID"); DataHelper.CheckStringIsNull(entity.DisplayName, "姓名"); DataHelper.CheckSex(entity.SexId); DataHelper.CheckMaritalStatus(entity.MaritalStatusId); - - - + + + } } } diff --git a/src/Shentun.Peis.Domain/RegisterChecks/RegisterCheckManager.cs b/src/Shentun.Peis.Domain/RegisterChecks/RegisterCheckManager.cs index 33e45ee..adc841e 100644 --- a/src/Shentun.Peis.Domain/RegisterChecks/RegisterCheckManager.cs +++ b/src/Shentun.Peis.Domain/RegisterChecks/RegisterCheckManager.cs @@ -69,10 +69,10 @@ namespace Shentun.Peis.RegisterChecks public async Task UpdateCompleteAsync(Guid RegisterCheckId, char CompleteFlag) { var registerCheckEnt = await _registerCheckRepository.GetAsync(RegisterCheckId); - + //if (registerCheckEnt == null) // throw new UserFriendlyException($"数据有误"); - if(CompleteFlag != RegisterCheckCompleteFlag.UnChecked && CompleteFlag != RegisterCheckCompleteFlag.GiveUpChecked) + if (CompleteFlag != RegisterCheckCompleteFlag.UnChecked && CompleteFlag != RegisterCheckCompleteFlag.GiveUpChecked) { throw new UserFriendlyException("只能删除结果和弃检时使用,禁止调用"); } @@ -81,7 +81,7 @@ namespace Shentun.Peis.RegisterChecks { throw new UserFriendlyException("已总检,不能修改检查状态"); } - if (patientRegister.IsLock == 'Y') + if (patientRegister.IsLock == 'Y') { throw new UserFriendlyException("人员登记信息已加锁,不能修改检查状态"); } @@ -92,7 +92,7 @@ namespace Shentun.Peis.RegisterChecks var count = (await _registerCheckRepository.GetQueryableAsync()).Where(o => o.PatientRegisterId == patientRegister.Id && o.Id != RegisterCheckId && o.CompleteFlag != RegisterCheckCompleteFlag.UnChecked).Count(); - if(count == 0) + if (count == 0) { patientRegister.CompleteFlag = PatientRegisterCompleteFlag.Registration; await _patientRegisterRepository.UpdateAsync(patientRegister); @@ -106,7 +106,7 @@ namespace Shentun.Peis.RegisterChecks { item.Result = ""; } - + await _registerCheckItemRepository.UpdateManyAsync(registerCheckItems); await _registerCheckSummaryManager.CheckAndDeleteAsync(RegisterCheckId); @@ -393,10 +393,20 @@ namespace Shentun.Peis.RegisterChecks //获取体检中心配置 check_request_no_rule_coding = spv_tjzx.Where(m => m.SysParmId == "check_request_no_rule_coding").FirstOrDefault().ParmValue; } - if(string.IsNullOrWhiteSpace(check_request_no_rule_coding)) + if (string.IsNullOrWhiteSpace(check_request_no_rule_coding)) { - //获取全局配置 - check_request_no_rule_coding = spv_global.Where(m => m.SysParmId == "check_request_no_rule_coding").FirstOrDefault().ParmValue; + + var check_request_no_rule_coding_ent = spv_global.Where(m => m.SysParmId == "check_request_no_rule_coding").FirstOrDefault(); + if (check_request_no_rule_coding_ent == null) + { + throw new UserFriendlyException("全局系统参数check_request_no_rule_coding未配置"); + } + else + { + //获取全局配置 + check_request_no_rule_coding = check_request_no_rule_coding_ent.ParmValue; + } + } if (string.IsNullOrWhiteSpace(check_request_no_rule_coding)) @@ -411,10 +421,20 @@ namespace Shentun.Peis.RegisterChecks } if (string.IsNullOrWhiteSpace(check_request_no_rule_tail_len)) { - //获取全局配置 - check_request_no_rule_tail_len = spv_global.Where(m => m.SysParmId == "check_request_no_rule_tail_len").FirstOrDefault().ParmValue; + + var check_request_no_rule_tail_len_ent = spv_global.Where(m => m.SysParmId == "check_request_no_rule_tail_len").FirstOrDefault(); + if (check_request_no_rule_tail_len_ent == null) + { + throw new UserFriendlyException("全局系统参数check_request_no_rule_tail_len未配置"); + } + else + { + //获取全局配置 + check_request_no_rule_tail_len = check_request_no_rule_tail_len_ent.ParmValue; + } + } - + if (spv_tjzx.Where(m => m.SysParmId == "check_request_no_rule_prefix").Count() > 0) { @@ -423,8 +443,17 @@ namespace Shentun.Peis.RegisterChecks } if (string.IsNullOrWhiteSpace(check_request_no_rule_prefix)) { - //获取全局配置 - check_request_no_rule_prefix = spv_global.Where(m => m.SysParmId == "check_request_no_rule_prefix").FirstOrDefault().ParmValue; + var check_request_no_rule_prefix_ent = spv_global.Where(m => m.SysParmId == "check_request_no_rule_prefix").FirstOrDefault(); + if (check_request_no_rule_prefix_ent == null) + { + throw new UserFriendlyException("全局系统参数check_request_no_rule_prefix未配置"); + } + else + { + //获取全局配置 + check_request_no_rule_prefix = check_request_no_rule_prefix_ent.ParmValue; + } + } if (string.IsNullOrWhiteSpace(check_request_no_rule_tail_len))