diff --git a/src/Shentun.Peis.Application/PatientRegisters/PatientRegisterAppService.cs b/src/Shentun.Peis.Application/PatientRegisters/PatientRegisterAppService.cs index db91f175..5649719c 100644 --- a/src/Shentun.Peis.Application/PatientRegisters/PatientRegisterAppService.cs +++ b/src/Shentun.Peis.Application/PatientRegisters/PatientRegisterAppService.cs @@ -3476,6 +3476,8 @@ namespace Shentun.Peis.PatientRegisters throw new UserFriendlyException("系统中已有该档案号的不同姓名人员"); } } + + if (patient == null) { patient = await _patientManager.CreateAsync(updatePatientEntity); @@ -3483,7 +3485,60 @@ namespace Shentun.Peis.PatientRegisters } else { - await _patientManager.UpdateAsync(updatePatientEntity, patient); + Patient newUpdatePatientEntity = patient; + #region 有档案时,导入的信息空的情况,使用档案的信息 + + if (!string.IsNullOrWhiteSpace(input.PatientName)) + { + newUpdatePatientEntity.DisplayName = input.PatientName; + } + if (!string.IsNullOrWhiteSpace(input.MaritalStatusName)) + { + newUpdatePatientEntity.MaritalStatusId = await GetMaritalStatusIdByName(input.MaritalStatusName); + } + if (!string.IsNullOrWhiteSpace(input.Address)) + { + newUpdatePatientEntity.Address = input.Address; + } + if (!string.IsNullOrWhiteSpace(input.BirthDate)) + { + newUpdatePatientEntity.BirthDate = GetBirthDateByString(input.BirthDate); + } + if (!string.IsNullOrWhiteSpace(input.BirthPlaceName)) + { + newUpdatePatientEntity.BirthPlaceId = await GetBirthPlaceIdByName(input.BirthPlaceName); + } + if (!string.IsNullOrWhiteSpace(input.Email)) + { + newUpdatePatientEntity.Email = input.Email; + } + if (!string.IsNullOrWhiteSpace(input.IdNo)) + { + newUpdatePatientEntity.IdNo = input.IdNo; + } + if (!string.IsNullOrWhiteSpace(input.MobileTelephone)) + { + newUpdatePatientEntity.MobileTelephone = input.MobileTelephone; + } + if (!string.IsNullOrWhiteSpace(input.NationName)) + { + newUpdatePatientEntity.NationId = await GetNationIdByName(input.NationName); + } + if (!string.IsNullOrWhiteSpace(input.PostalCode)) + { + newUpdatePatientEntity.PostalCode = input.PostalCode; + } + if (!string.IsNullOrWhiteSpace(input.Telephone)) + { + newUpdatePatientEntity.Telephone = input.Telephone; + } + if (!string.IsNullOrWhiteSpace(input.SexName)) + { + newUpdatePatientEntity.SexId = await GetSexIdByName(input.SexName); + } + #endregion + + await _patientManager.UpdateAsync(newUpdatePatientEntity, patient); await _patientRepository.UpdateAsync(patient, true); } Guid? customerOrgId = await GetCustomerOrgIdByName(input.CustomerOrgId, input.DepartmentName, input.IsAutoCreateDepartment);