Browse Source

登记时档案身份证重复错误

bjmzak
wxd 2 years ago
parent
commit
ceb73bb305
  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(),
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()),

14
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
/// <returns></returns>
public async Task<Patient> 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))

Loading…
Cancel
Save