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("已有今天及之后的预约订单,必须先取消订单才能重新预约"); + } + } } }