From 1df18b20520c36801131463b999ca3cc2e504175 Mon Sep 17 00:00:00 2001
From: "DESKTOP-G961P6V\\Zhh" <839860190@qq.com>
Date: Tue, 18 Jun 2024 23:19:22 +0800
Subject: [PATCH 1/3] =?UTF-8?q?=E9=A2=84=E7=BA=A6?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../AppointPatientRegisters/AppointPatientRegisterManager.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/Shentun.WebPeis.Domain/AppointPatientRegisters/AppointPatientRegisterManager.cs b/src/Shentun.WebPeis.Domain/AppointPatientRegisters/AppointPatientRegisterManager.cs
index 48c7043..0eca34d 100644
--- a/src/Shentun.WebPeis.Domain/AppointPatientRegisters/AppointPatientRegisterManager.cs
+++ b/src/Shentun.WebPeis.Domain/AppointPatientRegisters/AppointPatientRegisterManager.cs
@@ -217,7 +217,7 @@ namespace Shentun.WebPeis.AppointPatientRegisters
{
decimal addMoney = 0;
var customerOrgGroupDetail = customerOrgGroupDetails.Where(o => o.AsbitemId == asbitem.AsbitemId).FirstOrDefault();
- if(customerOrgGroupDetail != null)
+ if(customerOrgGroupDetail == null)
{
addMoney += customerOrgGroupDetail.Price;
}
From 94098bdbc502c94629bc152171dcc0ee3bc5277d Mon Sep 17 00:00:00 2001
From: "DESKTOP-G961P6V\\Zhh" <839860190@qq.com>
Date: Tue, 18 Jun 2024 23:25:31 +0800
Subject: [PATCH 2/3] =?UTF-8?q?=E9=A2=84=E7=BA=A6?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../AppointPatientRegisters/AppointPatientRegisterManager.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/Shentun.WebPeis.Domain/AppointPatientRegisters/AppointPatientRegisterManager.cs b/src/Shentun.WebPeis.Domain/AppointPatientRegisters/AppointPatientRegisterManager.cs
index 0eca34d..bfb8ff9 100644
--- a/src/Shentun.WebPeis.Domain/AppointPatientRegisters/AppointPatientRegisterManager.cs
+++ b/src/Shentun.WebPeis.Domain/AppointPatientRegisters/AppointPatientRegisterManager.cs
@@ -219,7 +219,7 @@ namespace Shentun.WebPeis.AppointPatientRegisters
var customerOrgGroupDetail = customerOrgGroupDetails.Where(o => o.AsbitemId == asbitem.AsbitemId).FirstOrDefault();
if(customerOrgGroupDetail == null)
{
- addMoney += customerOrgGroupDetail.Price;
+ addMoney += asbitem.ChargePrice;
}
if(addMoney > 0)
From ad669e43da91e65707eb18852ff7cc197262e14d Mon Sep 17 00:00:00 2001
From: "DESKTOP-G961P6V\\Zhh" <839860190@qq.com>
Date: Wed, 19 Jun 2024 00:38:39 +0800
Subject: [PATCH 3/3] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BA=BA=E5=91=98?=
=?UTF-8?q?=E4=BF=A1=E6=81=AF?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../Persons/PersonDto.cs | 36 +++++-
.../Persons/SmsVerifyCodeInputDto.cs | 4 +
.../Persons/UpdatePersonDto.cs | 111 ++++++++++++++++++
.../Persons/PersonAppService.cs | 96 +++++++++++++--
.../WebPeisApplicationAutoMapperProfile.cs | 2 +
.../AppointPatientRegisterManager.cs | 8 +-
.../Persons/PersonManager.cs | 35 ++++--
.../PersonAppServiceTest.cs | 14 +++
8 files changed, 281 insertions(+), 25 deletions(-)
create mode 100644 src/Shentun.WebPeis.Application.Contracts/Persons/UpdatePersonDto.cs
diff --git a/src/Shentun.WebPeis.Application.Contracts/Persons/PersonDto.cs b/src/Shentun.WebPeis.Application.Contracts/Persons/PersonDto.cs
index ddd69c8..b1e3708 100644
--- a/src/Shentun.WebPeis.Application.Contracts/Persons/PersonDto.cs
+++ b/src/Shentun.WebPeis.Application.Contracts/Persons/PersonDto.cs
@@ -29,12 +29,18 @@ namespace Shentun.WebPeis.Persons
/// 性别
///
public char SexId { get; set; }
+ ///
+ /// 性别名称
+ ///
public string SexName { get; set; }
///
/// 婚姻状况
///
public char MaritalStatusId { get; set; }
+ ///
+ /// 婚姻状况名
+ ///
public string MaritalStatusName { get; set; }
@@ -47,6 +53,9 @@ namespace Shentun.WebPeis.Persons
/// 民族编号
///
public string? NationId { get; set; }
+ ///
+ /// 民族名称
+ ///
public string? NationName { get; set; }
@@ -84,20 +93,45 @@ namespace Shentun.WebPeis.Persons
/// 简码
///
public string SimpleCode { get; set; } = null!;
+ ///
+ /// 身份证件类别ID
+ ///
public string? IdTypeId { get; set; }
public string? CountryCode { get; set; }
+ ///
+ /// 允许绑定
+ ///
public char? IsAllowBind { get; set; }
+ ///
+ /// 启用
+ ///
public char? IsActive { get; set; }
+ ///
+ /// 显示顺序
+ ///
public int DisplayOrder { get; set; }
+ ///
+ /// 有问卷
+ ///
public char IsHaveQuestionRegister { get; set; }
+ ///
+ /// 身高
+ ///
+
+ public decimal? Height { get; set; }
+ ///
+ /// 体重
+ ///
+
+ public decimal? Weight { get; set; }
+
-
}
diff --git a/src/Shentun.WebPeis.Application.Contracts/Persons/SmsVerifyCodeInputDto.cs b/src/Shentun.WebPeis.Application.Contracts/Persons/SmsVerifyCodeInputDto.cs
index fb9e483..36bb0c6 100644
--- a/src/Shentun.WebPeis.Application.Contracts/Persons/SmsVerifyCodeInputDto.cs
+++ b/src/Shentun.WebPeis.Application.Contracts/Persons/SmsVerifyCodeInputDto.cs
@@ -6,6 +6,10 @@ namespace Shentun.WebPeis.Persons
{
public class SmsVerifyCodeInputDto
{
+ ///
+ /// 人员ID
+ ///
+ public Guid? PersonId { get; set; }
///
/// 微信OpenId
///
diff --git a/src/Shentun.WebPeis.Application.Contracts/Persons/UpdatePersonDto.cs b/src/Shentun.WebPeis.Application.Contracts/Persons/UpdatePersonDto.cs
new file mode 100644
index 0000000..0abaa44
--- /dev/null
+++ b/src/Shentun.WebPeis.Application.Contracts/Persons/UpdatePersonDto.cs
@@ -0,0 +1,111 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace Shentun.WebPeis.Persons
+{
+ public class UpdatePersonDto
+ {
+ ///
+ /// 人员ID
+ ///
+ public Guid PersonId { get; set; }
+ ///
+ /// 姓名
+ ///
+ public string PersonName { get; set; } = null!;
+
+ ///
+ /// 性别
+ ///
+ public char SexId { get; set; }
+
+ ///
+ /// 婚姻状况
+ ///
+ public char MaritalStatusId { get; set; }
+
+ ///
+ /// 出生日期
+ ///
+ public DateTime? BirthDate { get; set; }
+
+ ///
+ /// 民族编号
+ ///
+ public string? NationId { get; set; }
+
+ ///
+ /// 出生地
+ ///
+ public Guid? BirthPlaceId { get; set; }
+
+ ///
+ /// 身份证号
+ ///
+ public string? IdNo { get; set; }
+
+ ///
+ /// 邮政编码
+ ///
+ public string? PostalCode { get; set; }
+
+ ///
+ /// email
+ ///
+ public string? Email { get; set; }
+
+ ///
+ /// 手机号
+ ///
+ public string? MobileTelephone { get; set; }
+
+ ///
+ /// 地址
+ ///
+ public string? Address { 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 string SmsVerifyCode { get; set; }
+
+ ///
+ /// 短信校验码键
+ ///
+ public string SmsVerifyCodeKey { get; set; }
+
+ ///
+ /// 会话键
+ ///
+ public string SessionKey { get; set; }
+ ///
+ /// 会话键值
+ ///
+ public string SessionKeyValue { get; set; }
+
+ }
+}
diff --git a/src/Shentun.WebPeis.Application/Persons/PersonAppService.cs b/src/Shentun.WebPeis.Application/Persons/PersonAppService.cs
index 78c43a3..cb9dcb6 100644
--- a/src/Shentun.WebPeis.Application/Persons/PersonAppService.cs
+++ b/src/Shentun.WebPeis.Application/Persons/PersonAppService.cs
@@ -243,7 +243,48 @@ namespace Shentun.WebPeis.Persons
}
+ ///
+ /// 更新
+ ///
+ ///
+ ///
+ ///
+ [HttpPost("api/app/Person/Update")]
+ public async Task UpdateAsync(UpdatePersonDto input)
+ {
+ var entity = ObjectMapper.Map(input);
+
+ if (string.IsNullOrWhiteSpace(input.MobileTelephone))
+ {
+ throw new UserFriendlyException("手机号码不能为空");
+ }
+ if (input.MobileTelephone.Length != 11)
+ {
+ throw new UserFriendlyException("手机号码必须为11位");
+ }
+
+ if (string.IsNullOrWhiteSpace(input.SmsVerifyCodeKey))
+ {
+ throw new UserFriendlyException("短信校验码键不能为空");
+ }
+ if (_cache.Get(input.SmsVerifyCodeKey) != input.SmsVerifyCode)
+ {
+ throw new UserFriendlyException("无效的短信校验码或已过期");
+ }
+ //更新人员信息
+ var person = await _repository.GetAsync(o =>o.PersonId == input.PersonId);
+ await _personManager.UpdateAsync(entity, person);
+ await _repository.UpdateAsync(person);
+ //更新用户信息
+ var user = await _identityUserRepository.GetAsync(person.PersonId);
+ user.Name = input.PersonName;
+ user.SetPhoneNumber(input.MobileTelephone,false);
+ await _identityUserRepository.UpdateAsync(user);
+
+ return ObjectMapper.Map(person);
+
+ }
///
/// 创建亲属
///
@@ -313,6 +354,18 @@ namespace Shentun.WebPeis.Persons
}
+ ///
+ /// 取消人员绑定
+ ///
+ ///
+ ///
+ [HttpPost("api/app/Person/CancelPersonKinship")]
+ public async Task CancelPersonKinshipAsync(PersonIdInputDto input)
+ {
+ var personKinship = await _personKinshipRepository.GetAsync(o => o.ParentPersonId == (Guid)CurrentUser.Id && o.PersonId == input.PersonId);
+ await _personKinshipRepository.DeleteAsync(personKinship);
+
+ }
///
/// 获取体检次数列表
///
@@ -364,14 +417,28 @@ namespace Shentun.WebPeis.Persons
select new PersonDto
{
PersonId = user.Id,
+ PersonNo = person.PersonNo,
+ MedicalCenterId = person.MedicalCenterId,
PersonName = user.Name,
SexId = person.SexId,
SexName = _cacheService.GetSexNameAsync(person.SexId).Result,
MaritalStatusId = person.MaritalStatusId,
MaritalStatusName = _cacheService.GetMaritalStatusNameAsync(person.MaritalStatusId).Result,
+ BirthDate = person.BirthDate,
+ NationId = person.NationId,
+ NationName = _cacheService.GetNationNameAsync(person.NationId).Result,
+ BirthPlaceId = person.BirthPlaceId,
IdNo = person.IdNo,
+ PostalCode = person.PostalCode,
+ Email = user.Email,
MobileTelephone = user.PhoneNumber,
- IsHaveQuestionRegister = haveQuestionRegister == null ? 'N' : 'Y'
+ Address = person.Address,
+ IdTypeId = person.IdTypeId,
+ CountryCode = person.CountryCode,
+ IsAllowBind = person.IsAllowBind,
+ IsHaveQuestionRegister = haveQuestionRegister == null ? 'N' : 'Y',
+ Height = person.Height,
+ Weight = person.Weight
}).Distinct().ToList();
@@ -527,23 +594,26 @@ namespace Shentun.WebPeis.Persons
throw new UserFriendlyException("身份证长度必须为18位");
}
//var sexByIdNo = ConvertExtr.ToSexByIdNo(idNo).ToCharArray();
-
-
- var person = await _repository.FindAsync(o => o.IdNo == input.IdNo);
- if (person != null)
+ if (input.PersonId == null || input.PersonId == default(Guid))
{
- var user = (await _identityUserRepository.GetQueryableAsync()).Where(o => o.Id == person.PersonId &&
- o.PhoneNumber == input.MobileTelephone).FirstOrDefault();
- if (user == null)
+ var person = await _repository.FindAsync(o => o.IdNo == input.IdNo);
+ if (person != null)
{
- throw new UserFriendlyException("该身份证号已注册,但手机号码不一致");
+ var user = (await _identityUserRepository.GetQueryableAsync()).Where(o => o.Id == person.PersonId &&
+ o.PhoneNumber == input.MobileTelephone).FirstOrDefault();
+ if (user == null)
+ {
+ throw new UserFriendlyException("该身份证号已注册,但手机号码不一致");
+ }
+ //if (!string.IsNullOrWhiteSpace(person.WechatOpenId))
+ //{
+ // throw new UserFriendlyException("该微信号已注册");
+ //}
}
- //if (!string.IsNullOrWhiteSpace(person.WechatOpenId))
- //{
- // throw new UserFriendlyException("该微信号已注册");
- //}
}
+
+
var createSmsTaskDto = new CreateSmsTaskDto()
{
PersonId = "0001",
diff --git a/src/Shentun.WebPeis.Application/WebPeisApplicationAutoMapperProfile.cs b/src/Shentun.WebPeis.Application/WebPeisApplicationAutoMapperProfile.cs
index 300c1c2..536f796 100644
--- a/src/Shentun.WebPeis.Application/WebPeisApplicationAutoMapperProfile.cs
+++ b/src/Shentun.WebPeis.Application/WebPeisApplicationAutoMapperProfile.cs
@@ -50,6 +50,8 @@ public class WebPeisApplicationAutoMapperProfile : Profile
CreateMap();
CreateMap();
+ CreateMap();
+
CreateMap();
CreateMap();
diff --git a/src/Shentun.WebPeis.Domain/AppointPatientRegisters/AppointPatientRegisterManager.cs b/src/Shentun.WebPeis.Domain/AppointPatientRegisters/AppointPatientRegisterManager.cs
index bfb8ff9..7f883b8 100644
--- a/src/Shentun.WebPeis.Domain/AppointPatientRegisters/AppointPatientRegisterManager.cs
+++ b/src/Shentun.WebPeis.Domain/AppointPatientRegisters/AppointPatientRegisterManager.cs
@@ -212,10 +212,11 @@ namespace Shentun.WebPeis.AppointPatientRegisters
throw new UserFriendlyException("单位分组项目不能取消");
}
});
-
- foreach(var asbitem in entity.AppointRegisterAsbitems)
+ decimal addMoney = 0;
+ var customerOrgGroup = await _customerOrgGroupRepository.GetAsync(o => o.CustomerOrgGroupId == entity.CustomerOrgGroupId);
+ foreach (var asbitem in entity.AppointRegisterAsbitems)
{
- decimal addMoney = 0;
+
var customerOrgGroupDetail = customerOrgGroupDetails.Where(o => o.AsbitemId == asbitem.AsbitemId).FirstOrDefault();
if(customerOrgGroupDetail == null)
{
@@ -224,7 +225,6 @@ namespace Shentun.WebPeis.AppointPatientRegisters
if(addMoney > 0)
{
- var customerOrgGroup = await _customerOrgGroupRepository.GetAsync(o => o.CustomerOrgGroupId == entity.CustomerOrgGroupId);
if(addMoney > customerOrgGroup.CanAddMoney)
{
throw new UserFriendlyException($"自选的单位支付金额不能超过{customerOrgGroup.CanAddMoney}元");
diff --git a/src/Shentun.WebPeis.Domain/Persons/PersonManager.cs b/src/Shentun.WebPeis.Domain/Persons/PersonManager.cs
index 896c847..51a0799 100644
--- a/src/Shentun.WebPeis.Domain/Persons/PersonManager.cs
+++ b/src/Shentun.WebPeis.Domain/Persons/PersonManager.cs
@@ -1,4 +1,5 @@
using Microsoft.Extensions.Configuration.UserSecrets;
+using NPOI.POIFS.FileSystem;
using Shentun.Utilities;
using Shentun.Utilities.Enums;
using Shentun.WebPeis.Models;
@@ -73,26 +74,26 @@ namespace Shentun.WebPeis.Persons
{
throw new UserFriendlyException("该手机号已经在人员信息中注册");
}
- var wechatPerson = await _repository.FindAsync(o => o.WechatOpenId == entity.WechatOpenId
+ var wechatPerson = await _repository.FindAsync(o => o.WechatOpenId == entity.WechatOpenId
&& !string.IsNullOrWhiteSpace(entity.WechatOpenId));
if (wechatPerson != null)
{
throw new UserFriendlyException("该微信号已经注册");
}
entity.PersonNo = await CreatePersonNoAsync(entity.MedicalCenterId);
- if(string.IsNullOrWhiteSpace(email))
+ if (string.IsNullOrWhiteSpace(email))
{
email = entity.PersonNo + "@qq.com";
}
var user = new IdentityUser(GuidGenerator.Create(), entity.PersonNo, email)
{
Name = name,
-
+
};
-
+
user.SetPhoneNumber(phone, false);
- // await _identityUserManager.CreateAsync(user);
+ // await _identityUserManager.CreateAsync(user);
if (!string.IsNullOrWhiteSpace(entity.IdNo))
@@ -119,7 +120,27 @@ namespace Shentun.WebPeis.Persons
}
+ public async Task UpdateAsync(Person sourceEntity,
+ Person targetEntity
+ )
+ {
+ sourceEntity.MedicalCenterId = targetEntity.MedicalCenterId;
+ await Verify(sourceEntity);
+ targetEntity.SexId = sourceEntity.SexId;
+ targetEntity.MaritalStatusId = sourceEntity.MaritalStatusId;
+ targetEntity.BirthDate = sourceEntity.BirthDate;
+ targetEntity.NationId = sourceEntity.NationId;
+ targetEntity.BirthPlaceId = sourceEntity.BirthPlaceId;
+ targetEntity.IdNo = sourceEntity.IdNo;
+ targetEntity.PostalCode = sourceEntity.PostalCode;
+ targetEntity.Address = sourceEntity.Address;
+ targetEntity.IdTypeId = sourceEntity.IdTypeId;
+ targetEntity.IsAllowBind = sourceEntity.IsAllowBind;
+ targetEntity.Height = sourceEntity.Height;
+ targetEntity.Weight = sourceEntity.Weight;
+
+ }
private async Task Verify(Person entity)
{
Check.NotNull(entity, "entity");
@@ -127,7 +148,7 @@ namespace Shentun.WebPeis.Persons
Check.NotNullOrWhiteSpace(entity.NationId, "民族");
CheckExter.CheckSex(entity.SexId);
CheckExter.CheckMaritalStatus(entity.MaritalStatusId);
- if(string.IsNullOrWhiteSpace(entity.IdTypeId))
+ if (string.IsNullOrWhiteSpace(entity.IdTypeId))
{
entity.IdTypeId = "01";
}
@@ -143,7 +164,7 @@ namespace Shentun.WebPeis.Persons
{
throw new UserFriendlyException("体检中心不能为空");
}
-
+
if (!string.IsNullOrEmpty(entity.IdNo))
{
diff --git a/test/Shentun.WebPeis.Application.Tests/PersonAppServiceTest.cs b/test/Shentun.WebPeis.Application.Tests/PersonAppServiceTest.cs
index 1855538..e50bc66 100644
--- a/test/Shentun.WebPeis.Application.Tests/PersonAppServiceTest.cs
+++ b/test/Shentun.WebPeis.Application.Tests/PersonAppServiceTest.cs
@@ -83,6 +83,20 @@ namespace Shentun.WebPeis
}
}
+ [Fact]
+ public async Task UpdateAsync()
+ {
+ using (var unitOfWork = _unitOfWorkManager.Begin(isTransactional: true))
+ {
+
+ var entity = await _repository.GetAsync(o => o.PersonId == new Guid("3a12d72c-19d9-e8b2-71f6-cf283103e191"));
+
+
+ //var newEntity = await _appService.UpdateAsync(entity);
+ await unitOfWork.CompleteAsync();
+ }
+ }
+
[Fact]
public async Task GetPersonKinshipList()
{