|
|
|
@ -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); |
|
|
|
} |
|
|
|
@ -144,11 +144,11 @@ namespace Shentun.Peis.Patients |
|
|
|
//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; |
|
|
|
} |
|
|
|
@ -178,12 +178,12 @@ 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("该身份证号已经在人员信息中注册"); |
|
|
|
@ -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"); |
|
|
|
@ -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位"); |
|
|
|
} |
|
|
|
@ -401,7 +414,7 @@ namespace Shentun.Peis.Patients |
|
|
|
|
|
|
|
} |
|
|
|
//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); |
|
|
|
|