DESKTOP-G961P6V\Zhh 2 years ago
parent
commit
ce27aa9673
  1. 4
      src/Shentun.Peis.Application/DataMigrations/BaseDataHandleAppService.cs
  2. 14
      src/Shentun.Peis.Domain/Patients/PatientManager.cs

4
src/Shentun.Peis.Application/DataMigrations/BaseDataHandleAppService.cs

@ -2337,7 +2337,7 @@ namespace Shentun.Peis.DataMigrations
DisplayName = row["name"].ToString(), DisplayName = row["name"].ToString(),
Email = row["email"].ToString(), Email = row["email"].ToString(),
IdNo = row["id_card_no"].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, MedicalCenterId = defaultMedicalCenterId,
MobileTelephone = row["mobile_telephone"].ToString(), MobileTelephone = row["mobile_telephone"].ToString(),
NationId = nationId, NationId = nationId,
@ -2484,7 +2484,7 @@ namespace Shentun.Peis.DataMigrations
var data = new PatientRegister(patientRegisterId) var data = new PatientRegister(patientRegisterId)
{ {
BirthDate = string.IsNullOrEmpty(row["birth_date"].ToString()) ? null : Convert.ToDateTime(row["birth_date"].ToString()), 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, MedicalCenterId = defaultMedicalCenterId,
SexId = ConvertSex(row["sex_id"].ToString()), SexId = ConvertSex(row["sex_id"].ToString()),
Age = string.IsNullOrWhiteSpace(row["age"].ToString()) ? null : Convert.ToInt16(row["age"].ToString()), Age = string.IsNullOrWhiteSpace(row["age"].ToString()) ? null : Convert.ToInt16(row["age"].ToString()),

14
src/Shentun.Peis.Domain/Patients/PatientManager.cs

@ -54,7 +54,7 @@ namespace Shentun.Peis.Patients
Patient entity Patient entity
) )
{ {
await Verify(entity);
Verify(entity);
if (!string.IsNullOrWhiteSpace(entity.NationId)) if (!string.IsNullOrWhiteSpace(entity.NationId))
{ {
@ -67,7 +67,7 @@ namespace Shentun.Peis.Patients
if (!string.IsNullOrWhiteSpace(entity.IdNo)) 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) if (existPatient != null)
{ {
throw new UserFriendlyException("该身份证号已经在人员信息中注册"); throw new UserFriendlyException("该身份证号已经在人员信息中注册");
@ -118,7 +118,7 @@ namespace Shentun.Peis.Patients
{ {
throw new UserFriendlyException("更新人员信息时源实体不能等于目标实体"); throw new UserFriendlyException("更新人员信息时源实体不能等于目标实体");
} }
await Verify(sourceEntity);
Verify(sourceEntity);
if (!string.IsNullOrWhiteSpace(sourceEntity.NationId) && sourceEntity.NationId != targetEntity.NationId) 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) 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) if (existPatient != null)
{ {
throw new UserFriendlyException("该身份证号已经在人员信息中注册"); throw new UserFriendlyException("该身份证号已经在人员信息中注册");
@ -204,7 +204,7 @@ namespace Shentun.Peis.Patients
/// <returns></returns> /// <returns></returns>
public async Task<Patient> CreateAsync(Guid OrganizationUnitId, Patient entity) public async Task<Patient> CreateAsync(Guid OrganizationUnitId, Patient entity)
{ {
await Verify(entity);
Verify(entity);
if (!string.IsNullOrWhiteSpace(entity.NationId)) if (!string.IsNullOrWhiteSpace(entity.NationId))
{ {
@ -216,7 +216,7 @@ namespace Shentun.Peis.Patients
} }
if (!string.IsNullOrWhiteSpace(entity.IdNo)) 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) if (existPatient != null)
{ {
throw new UserFriendlyException("该身份证号已经在人员信息中注册"); throw new UserFriendlyException("该身份证号已经在人员信息中注册");
@ -345,7 +345,7 @@ namespace Shentun.Peis.Patients
else return true; else return true;
} }
private async Task Verify(Patient entity)
private void Verify(Patient entity)
{ {
DataHelper.CheckEntityIsNull(entity); DataHelper.CheckEntityIsNull(entity);
if (!string.IsNullOrEmpty(entity.DisplayName)) if (!string.IsNullOrEmpty(entity.DisplayName))

Loading…
Cancel
Save