From 84db35ef947f1a26297698d4909773d5fc0484b2 Mon Sep 17 00:00:00 2001 From: "DESKTOP-G961P6V\\Zhh" <839860190@qq.com> Date: Fri, 7 Jun 2024 16:32:11 +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 --- .../AppointPatientRegisterAppService.cs | 9 +++++++++ .../AppointPatientRegisterManager.cs | 9 +++++++++ 2 files changed, 18 insertions(+) diff --git a/src/Shentun.WebPeis.Application/AppointPatientRegisters/AppointPatientRegisterAppService.cs b/src/Shentun.WebPeis.Application/AppointPatientRegisters/AppointPatientRegisterAppService.cs index ee2d1c8..d9ae17f 100644 --- a/src/Shentun.WebPeis.Application/AppointPatientRegisters/AppointPatientRegisterAppService.cs +++ b/src/Shentun.WebPeis.Application/AppointPatientRegisters/AppointPatientRegisterAppService.cs @@ -449,6 +449,7 @@ namespace Shentun.WebPeis.AppointPatientRegisters [HttpPost("api/app/AppointPatientRegister/GetCustomerOrgAppointPatientRegisterByPersonId")] public async Task GetCustomerOrgAppointPatientRegisterByPersonIdAsync(PersonIdInputDto input) { + var patientRegisterDto = (from user in await _identityUserRepository.GetQueryableAsync() join person in await _personRepository.GetQueryableAsync() on user.Id equals person.PersonId @@ -483,6 +484,14 @@ namespace Shentun.WebPeis.AppointPatientRegisters var customerOrgEntity = await _customerOrgRepository.GetAsync(o => o.CustomerOrgId == patientRegisterDto.CustomerOrgId); customerOrgEntity = await _customerOrgRepository.GetAsync(o => o.PathCode == customerOrgEntity.PathCode.Substring(0, 5)); patientRegisterDto.CustomerOrgName = customerOrgEntity.CustomerOrgName; + + var appointPatientRegisters = await _repository.GetListAsync(o => o.PersonId == input.PersonId && + o.AppointDate >= DateTime.Now.Date && o.CustomerOrgRegisterId == patientRegisterDto.CustomerOrgRegisterId); + if (appointPatientRegisters .Any()) + { + throw new UserFriendlyException("已有今天及之后的团检预约订单,必须先取消订单才能重新预约"); + } + return patientRegisterDto; } diff --git a/src/Shentun.WebPeis.Domain/AppointPatientRegisters/AppointPatientRegisterManager.cs b/src/Shentun.WebPeis.Domain/AppointPatientRegisters/AppointPatientRegisterManager.cs index ff64c9f..37df02c 100644 --- a/src/Shentun.WebPeis.Domain/AppointPatientRegisters/AppointPatientRegisterManager.cs +++ b/src/Shentun.WebPeis.Domain/AppointPatientRegisters/AppointPatientRegisterManager.cs @@ -66,6 +66,7 @@ namespace Shentun.WebPeis.AppointPatientRegisters public async Task CreateAsync(AppointPatientRegister entity) { await Verify(entity); + entity.AppointPatientRegisterId = GuidGenerator.Create(); entity.CompleteFlag = AppointPatientRegisterCompleteFlag.Appoint; entity.IsCharge = 'N'; @@ -235,6 +236,14 @@ namespace Shentun.WebPeis.AppointPatientRegisters appointRegisterAsbitem.IsCharge = 'N'; } + + var appoentPatientRegisters = await _repository.GetListAsync(o => o.PersonId == entity.PersonId && + o.AppointDate >= DateTime.Now.Date); + if(appoentPatientRegisters.Count > 1) + { + throw new UserFriendlyException("已有今天及之后的预约订单,必须先取消订单才能重新预约"); + } + } } }