From 716e255c8cb30bc84ec41258127a0eccdfeda855 Mon Sep 17 00:00:00 2001
From: "DESKTOP-G961P6V\\Zhh" <839860190@qq.com>
Date: Sat, 15 Jun 2024 18:18:45 +0800
Subject: [PATCH] =?UTF-8?q?=E9=A2=84=E7=BA=A6?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
 .../Persons/CreatePersonDto.cs                | 10 +++++++
 .../Persons/PersonDto.cs                      |  5 +++-
 .../Persons/PersonAppService.cs               | 14 +++++++---
 .../QuestionRegisterAppService.cs             |  2 +-
 src/Shentun.WebPeis.Domain/Models/Person.cs   | 27 ++++++++++++-------
 5 files changed, 43 insertions(+), 15 deletions(-)
diff --git a/src/Shentun.WebPeis.Application.Contracts/Persons/CreatePersonDto.cs b/src/Shentun.WebPeis.Application.Contracts/Persons/CreatePersonDto.cs
index 84d1fcf..c4dcae1 100644
--- a/src/Shentun.WebPeis.Application.Contracts/Persons/CreatePersonDto.cs
+++ b/src/Shentun.WebPeis.Application.Contracts/Persons/CreatePersonDto.cs
@@ -84,6 +84,16 @@ namespace Shentun.WebPeis.Persons
         /// 允许绑定
         /// 
         public char? IsAllowBind { get; set; }
+        /// 
+        /// 身高
+        /// 
+        public decimal? Height { get; set; }
+        /// 
+        /// 体重
+        /// 
+
+        public decimal? Weight { get; set; }
+
         /// 
         /// 微信JsCode
         /// 
diff --git a/src/Shentun.WebPeis.Application.Contracts/Persons/PersonDto.cs b/src/Shentun.WebPeis.Application.Contracts/Persons/PersonDto.cs
index fb50ed0..2415a50 100644
--- a/src/Shentun.WebPeis.Application.Contracts/Persons/PersonDto.cs
+++ b/src/Shentun.WebPeis.Application.Contracts/Persons/PersonDto.cs
@@ -94,6 +94,9 @@ namespace Shentun.WebPeis.Persons
         public char? IsActive { get; set; }
 
         public int DisplayOrder {  get; set; }
-       
+
+        public char IsHaveQuestionRegister {  get; set; }
+
+
     }
 }
diff --git a/src/Shentun.WebPeis.Application/Persons/PersonAppService.cs b/src/Shentun.WebPeis.Application/Persons/PersonAppService.cs
index 78495bc..116ffaa 100644
--- a/src/Shentun.WebPeis.Application/Persons/PersonAppService.cs
+++ b/src/Shentun.WebPeis.Application/Persons/PersonAppService.cs
@@ -46,7 +46,7 @@ namespace Shentun.WebPeis.Persons
     [Authorize]
     public class PersonAppService : ApplicationService
     {
-
+        private readonly IRepository _questionRegisterRepository;
         private readonly IConfiguration _configuration;
         private readonly IRepository _identityUserRepository;
         private readonly IdentityUserManager _userManager;
@@ -72,7 +72,8 @@ namespace Shentun.WebPeis.Persons
              IRepository patientRepository,
              CacheService cacheService,
              IHttpContextAccessor httpContextAccessor,
-             IRepository customerOrgRepository)
+             IRepository customerOrgRepository,
+             IRepository questionRegisterRepository)
         {
             _repository = repository;
             _configuration = configuration;
@@ -87,6 +88,7 @@ namespace Shentun.WebPeis.Persons
             _cacheService = cacheService;
             _httpContextAccessor = httpContextAccessor;
             _customerOrgRepository = customerOrgRepository;
+            _questionRegisterRepository = questionRegisterRepository;
         }
 
         public async Task GetByIdAsync(PersonIdInputDto input)
@@ -356,6 +358,9 @@ namespace Shentun.WebPeis.Persons
             var personList = (from user in await _identityUserRepository.GetQueryableAsync()
                               join person in await _repository.GetQueryableAsync()
                               on user.Id equals person.PersonId
+                              join questionRegister in await _questionRegisterRepository.GetQueryableAsync()
+                              on person.PersonId equals questionRegister.PersonId into emptyQuestionRegister
+                              from haveQuestionRegister in  emptyQuestionRegister.DefaultIfEmpty()
                               where personKinshipIds.Contains(user.Id)
                               orderby user.CreationTime
                               select new PersonDto
@@ -367,10 +372,11 @@ namespace Shentun.WebPeis.Persons
                                   MaritalStatusId = person.MaritalStatusId,
                                   MaritalStatusName = _cacheService.GetMaritalStatusNameAsync(person.MaritalStatusId).Result,
                                   IdNo = person.IdNo,
-                                  MobileTelephone = user.PhoneNumber
+                                  MobileTelephone = user.PhoneNumber,
+                                  IsHaveQuestionRegister = haveQuestionRegister==null? 'N':'Y'
 
 
-                              }).ToList();
+                              }).Distinct().ToList();
             for (var i = 0; i < personList.Count; i++)
             {
                 personList[i].DisplayOrder = i + 1;
diff --git a/src/Shentun.WebPeis.Application/QuestionRegisters/QuestionRegisterAppService.cs b/src/Shentun.WebPeis.Application/QuestionRegisters/QuestionRegisterAppService.cs
index 7879ddd..cfaf6d7 100644
--- a/src/Shentun.WebPeis.Application/QuestionRegisters/QuestionRegisterAppService.cs
+++ b/src/Shentun.WebPeis.Application/QuestionRegisters/QuestionRegisterAppService.cs
@@ -70,7 +70,7 @@ namespace Shentun.WebPeis.QuestionRegisters
                 await _repository.InsertAsync(questionRegisterEntity);
                 questionRegisterDto.QuestionRegisterId = questionRegisterEntity.QuestionRegisterId;
                 await _unitOfWorkManager.Current.SaveChangesAsync();
-                return questionRegisterDto;
+                //return questionRegisterDto;
             }
             questionRegisterDto.QuestionRegisterId = questionRegister.QuestionRegisterId;
             //已登记过
diff --git a/src/Shentun.WebPeis.Domain/Models/Person.cs b/src/Shentun.WebPeis.Domain/Models/Person.cs
index b1fbccf..3ff4d37 100644
--- a/src/Shentun.WebPeis.Domain/Models/Person.cs
+++ b/src/Shentun.WebPeis.Domain/Models/Person.cs
@@ -21,9 +21,6 @@ public partial class Person: AuditedEntity,IHasConcurrencyStamp
     /// 组织单位ID
     /// 
     public Guid MedicalCenterId { get; set; }
-
-   
-
     /// 
     /// 性别
     /// 
@@ -58,10 +55,6 @@ public partial class Person: AuditedEntity,IHasConcurrencyStamp
     /// 邮政编码
     /// 
     public string? PostalCode { get; set; }
-
-    
-
-
     /// 
     /// 地址
     /// 
@@ -74,16 +67,32 @@ public partial class Person: AuditedEntity,IHasConcurrencyStamp
 
     public string? ConcurrencyStamp { get; set; }
 
-
+    /// 
+    /// 微信openid
+    /// 
     public string? WechatOpenId { get; set; }
-
+    /// 
+    /// 证件类别
+    /// 
     public string? IdTypeId { get; set; }
+    /// 
+    /// 国家码
+    /// 
 
     public string? CountryCode { get; set; }
+    /// 
+    /// 允许绑定
+    /// 
 
     public char? IsAllowBind { get; set; }
+    /// 
+    /// 身高
+    /// 
 
     public decimal? Height { get; set; }
+    /// 
+    /// 体重
+    /// 
 
     public decimal? Weight { get; set; }
     public virtual ICollection QuestionRegisters { get; set; } = new List();