From 8c573d0572d2f2da9085c29cb1652b26656fb743 Mon Sep 17 00:00:00 2001 From: wxd <123@qq.com> Date: Thu, 7 Nov 2024 18:05:30 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8D=B1=E6=80=A5=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../GetPatientRegisterCriticalListInputDto.cs | 12 +++++++- .../PhoneFollowUpWithCriticalItemDto.cs | 12 ++++++++ .../PhoneFollowUps/PhoneFollowUpAppService.cs | 30 +++++++++++++++++-- .../SmsSends/SmsSendAppService.cs | 14 ++++++++- 4 files changed, 64 insertions(+), 4 deletions(-) diff --git a/src/Shentun.Peis.Application.Contracts/PhoneFollowUps/GetPatientRegisterCriticalListInputDto.cs b/src/Shentun.Peis.Application.Contracts/PhoneFollowUps/GetPatientRegisterCriticalListInputDto.cs index 50be7da..16e337c 100644 --- a/src/Shentun.Peis.Application.Contracts/PhoneFollowUps/GetPatientRegisterCriticalListInputDto.cs +++ b/src/Shentun.Peis.Application.Contracts/PhoneFollowUps/GetPatientRegisterCriticalListInputDto.cs @@ -74,7 +74,17 @@ namespace Shentun.Peis.PhoneFollowUps /// public string? Phone { get; set; } - + + /// + /// 是否短信随访创建完成 + /// + public char? IsSmsComplete { get; set; } + + /// + /// 是否电话随访创建完成 + /// + public char? IsPhoneComplete { get; set; } + public int MaxResultCount { get; set; } = 50; diff --git a/src/Shentun.Peis.Application.Contracts/PhoneFollowUps/PhoneFollowUpWithCriticalItemDto.cs b/src/Shentun.Peis.Application.Contracts/PhoneFollowUps/PhoneFollowUpWithCriticalItemDto.cs index b216dec..fff0ebf 100644 --- a/src/Shentun.Peis.Application.Contracts/PhoneFollowUps/PhoneFollowUpWithCriticalItemDto.cs +++ b/src/Shentun.Peis.Application.Contracts/PhoneFollowUps/PhoneFollowUpWithCriticalItemDto.cs @@ -1,5 +1,7 @@ using System; using System.Collections.Generic; +using System.ComponentModel.DataAnnotations.Schema; +using System.ComponentModel.DataAnnotations; using System.Text; namespace Shentun.Peis.PhoneFollowUps @@ -133,6 +135,16 @@ namespace Shentun.Peis.PhoneFollowUps /// 电话随访记录 /// public List PhoneFollowUpDetail { get; set; } + + /// + /// 是否短信随访创建完成 + /// + public char IsSmsComplete { get; set; } + + /// + /// 是否电话随访创建完成 + /// + public char IsPhoneComplete { get; set; } } public class PhoneFollowUpWithCriticalItemAbnormalItemDto diff --git a/src/Shentun.Peis.Application/PhoneFollowUps/PhoneFollowUpAppService.cs b/src/Shentun.Peis.Application/PhoneFollowUps/PhoneFollowUpAppService.cs index 7dda602..c3fbe57 100644 --- a/src/Shentun.Peis.Application/PhoneFollowUps/PhoneFollowUpAppService.cs +++ b/src/Shentun.Peis.Application/PhoneFollowUps/PhoneFollowUpAppService.cs @@ -246,6 +246,16 @@ namespace Shentun.Peis.PhoneFollowUps query = query.Where(m => m.patientRegister.CustomerOrgGroupId != null && input.CustomerOrgGroupIds.Contains(m.patientRegister.CustomerOrgGroupId.Value)); } + if (input.IsSmsComplete != null) + { + query = query.Where(m => m.followUp.IsSmsComplete == input.IsSmsComplete); + } + + if (input.IsPhoneComplete != null) + { + query = query.Where(m => m.followUp.IsPhoneComplete == input.IsPhoneComplete); + } + #endregion @@ -301,7 +311,9 @@ namespace Shentun.Peis.PhoneFollowUps ItemName = ss.FirstOrDefault().item.DisplayName, IsCriticalValue = ss.Key.IsCriticalValue == null ? 'N' : ss.Key.IsCriticalValue.Value, IsReview = ss.Key.IsReview == null ? 'N' : ss.Key.IsReview.Value - }).ToList() + }).ToList(), + IsPhoneComplete = s.Key.IsPhoneComplete, + IsSmsComplete = s.Key.IsSmsComplete }).ToList(); return entListDto; @@ -587,7 +599,21 @@ namespace Shentun.Peis.PhoneFollowUps [HttpPost("api/app/PhoneFollowUp/Delete")] public async Task DeleteAsync(PhoneFollowUpIdInputDto input) { - await _phoneFollowUpRepository.DeleteAsync(input.PhoneFollowUpId); + var phoneFollowUpEnt = await _phoneFollowUpRepository.FirstOrDefaultAsync(f => f.Id == input.PhoneFollowUpId); + if (phoneFollowUpEnt == null) + { + throw new UserFriendlyException("数据不存在"); + } + await _phoneFollowUpRepository.DeleteAsync(input.PhoneFollowUpId, true); + if ((await _phoneFollowUpRepository.CountAsync(c => c.FollowUpId == phoneFollowUpEnt.FollowUpId)) == 0) + { + var followUpEnt = await _followUpRepository.FirstOrDefaultAsync(f => f.Id == phoneFollowUpEnt.FollowUpId); + if (followUpEnt != null) + { + followUpEnt.IsPhoneComplete = 'N'; + await _followUpRepository.UpdateAsync(followUpEnt); + } + } } diff --git a/src/Shentun.Peis.Application/SmsSends/SmsSendAppService.cs b/src/Shentun.Peis.Application/SmsSends/SmsSendAppService.cs index 742f23b..117c1b4 100644 --- a/src/Shentun.Peis.Application/SmsSends/SmsSendAppService.cs +++ b/src/Shentun.Peis.Application/SmsSends/SmsSendAppService.cs @@ -241,7 +241,19 @@ namespace Shentun.Peis.SmsSends new List { DataHelper.ConversionDateToString(smsSendEnt.smsSend.PlanSendDate) }); //删除短信记录 - await _smsSendRepository.DeleteAsync(input.SmsSendId); + await _smsSendRepository.DeleteAsync(input.SmsSendId, true); + + + + if ((await _smsSendRepository.CountAsync(c => c.FollowUpId == smsSendEnt.smsSend.FollowUpId)) == 0) + { + var followUpEnt = await _followUpRepository.FirstOrDefaultAsync(f => f.Id == smsSendEnt.smsSend.FollowUpId); + if (followUpEnt != null) + { + followUpEnt.IsSmsComplete = 'N'; + await _followUpRepository.UpdateAsync(followUpEnt); + } + } } }