From ceb73bb30543f67b7f70e1953c12aa5a9565d749 Mon Sep 17 00:00:00 2001
From: wxd <123@qq.com>
Date: Thu, 9 May 2024 10:41:02 +0800
Subject: [PATCH] =?UTF-8?q?=E7=99=BB=E8=AE=B0=E6=97=B6=E6=A1=A3=E6=A1=88?=
 =?UTF-8?q?=E8=BA=AB=E4=BB=BD=E8=AF=81=E9=87=8D=E5=A4=8D=E9=94=99=E8=AF=AF?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
 .../DataMigrations/BaseDataHandleAppService.cs     |  4 ++--
 src/Shentun.Peis.Domain/Patients/PatientManager.cs | 14 +++++++-------
 2 files changed, 9 insertions(+), 9 deletions(-)
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))