diff --git a/src/Shentun.Peis.Application/DataMigrations/BaseDataHandleAppService.cs b/src/Shentun.Peis.Application/DataMigrations/BaseDataHandleAppService.cs index 0fd974b..03e1818 100644 --- a/src/Shentun.Peis.Application/DataMigrations/BaseDataHandleAppService.cs +++ b/src/Shentun.Peis.Application/DataMigrations/BaseDataHandleAppService.cs @@ -2337,7 +2337,7 @@ namespace Shentun.Peis.DataMigrations DisplayName = row["name"].ToString(), Email = row["email"].ToString(), IdNo = row["id_card_no"].ToString(), - MaritalStatusId = Convert.ToChar(row["marital_status_id"].ToString()), + MaritalStatusId = row["marital_status_id"].ToString() == "2" ? '4' : Convert.ToChar(row["marital_status_id"].ToString()), MedicalCenterId = defaultMedicalCenterId, MobileTelephone = row["mobile_telephone"].ToString(), NationId = nationId, @@ -2484,7 +2484,7 @@ namespace Shentun.Peis.DataMigrations var data = new PatientRegister(patientRegisterId) { BirthDate = string.IsNullOrEmpty(row["birth_date"].ToString()) ? null : Convert.ToDateTime(row["birth_date"].ToString()), - MaritalStatusId = Convert.ToChar(row["marital_status_id"].ToString()), + MaritalStatusId = row["marital_status_id"].ToString() == "2" ? '4' : Convert.ToChar(row["marital_status_id"].ToString()), MedicalCenterId = defaultMedicalCenterId, SexId = ConvertSex(row["sex_id"].ToString()), Age = string.IsNullOrWhiteSpace(row["age"].ToString()) ? null : Convert.ToInt16(row["age"].ToString()), diff --git a/src/Shentun.Peis.Domain/Patients/PatientManager.cs b/src/Shentun.Peis.Domain/Patients/PatientManager.cs index 0d785bb..99e82ff 100644 --- a/src/Shentun.Peis.Domain/Patients/PatientManager.cs +++ b/src/Shentun.Peis.Domain/Patients/PatientManager.cs @@ -54,7 +54,7 @@ namespace Shentun.Peis.Patients Patient entity ) { - await Verify(entity); + Verify(entity); if (!string.IsNullOrWhiteSpace(entity.NationId)) { @@ -67,7 +67,7 @@ namespace Shentun.Peis.Patients if (!string.IsNullOrWhiteSpace(entity.IdNo)) { - var existPatient = await _repository.FindAsync(o => o.IdNo == entity.IdNo); + var existPatient = await _repository.FirstOrDefaultAsync(o => o.IdNo == entity.IdNo); if (existPatient != null) { throw new UserFriendlyException("该身份证号已经在人员信息中注册"); @@ -118,7 +118,7 @@ namespace Shentun.Peis.Patients { throw new UserFriendlyException("更新人员信息时源实体不能等于目标实体"); } - await Verify(sourceEntity); + Verify(sourceEntity); if (!string.IsNullOrWhiteSpace(sourceEntity.NationId) && sourceEntity.NationId != targetEntity.NationId) { @@ -134,7 +134,7 @@ namespace Shentun.Peis.Patients } if (!string.IsNullOrWhiteSpace(sourceEntity.IdNo) && sourceEntity.IdNo != targetEntity.IdNo) { - var existPatient = await _repository.FindAsync(o => o.IdNo == sourceEntity.IdNo); + var existPatient = await _repository.FirstOrDefaultAsync(o => o.IdNo == sourceEntity.IdNo); if (existPatient != null) { throw new UserFriendlyException("该身份证号已经在人员信息中注册"); @@ -203,7 +203,7 @@ namespace Shentun.Peis.Patients /// public async Task CreateAsync(Guid OrganizationUnitId, Patient entity) { - await Verify(entity); + Verify(entity); if (!string.IsNullOrWhiteSpace(entity.NationId)) { @@ -215,7 +215,7 @@ namespace Shentun.Peis.Patients } if (!string.IsNullOrWhiteSpace(entity.IdNo)) { - var existPatient = await _repository.FindAsync(o => o.IdNo == entity.IdNo); + var existPatient = await _repository.FirstOrDefaultAsync(o => o.IdNo == entity.IdNo); if (existPatient != null) { throw new UserFriendlyException("该身份证号已经在人员信息中注册"); @@ -344,7 +344,7 @@ namespace Shentun.Peis.Patients else return true; } - private async Task Verify(Patient entity) + private void Verify(Patient entity) { DataHelper.CheckEntityIsNull(entity); if (!string.IsNullOrEmpty(entity.DisplayName))