diff --git a/src/Shentun.ColumnReferencePlugIns/Sms/DeleteThirdPartySmsTaskByThirdIdWithPlanSendTimeInputDto.cs b/src/Shentun.ColumnReferencePlugIns/Sms/DeleteThirdPartySmsTaskByThirdIdWithPlanSendTimeInputDto.cs
new file mode 100644
index 0000000..a346e80
--- /dev/null
+++ b/src/Shentun.ColumnReferencePlugIns/Sms/DeleteThirdPartySmsTaskByThirdIdWithPlanSendTimeInputDto.cs
@@ -0,0 +1,31 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Shentun.Peis.PlugIns.Sms
+{
+ public class DeleteThirdPartySmsTaskByThirdIdWithPlanSendTimeInputDto
+ {
+ ///
+ /// 第三方ID 人员登记ID
+ ///
+ public string ThirdId { get; set; }
+
+ ///
+ /// 短信内容
+ ///
+ public string Content { get; set; }
+
+ ///
+ /// 手机号
+ ///
+ public string MobileTelephone { get; set; }
+
+ ///
+ /// 计划时间
+ ///
+ public List PlanSendTimes { get; set; }
+ }
+}
diff --git a/src/Shentun.Peis.Application.Contracts/PhoneFollowUps/AutoCreatePhoneFollowUpDto.cs b/src/Shentun.Peis.Application.Contracts/PhoneFollowUps/AutoCreatePhoneFollowUpDto.cs
new file mode 100644
index 0000000..8568b87
--- /dev/null
+++ b/src/Shentun.Peis.Application.Contracts/PhoneFollowUps/AutoCreatePhoneFollowUpDto.cs
@@ -0,0 +1,41 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations.Schema;
+using System.ComponentModel.DataAnnotations;
+using System.Text;
+
+namespace Shentun.Peis.PhoneFollowUps
+{
+ public class AutoCreatePhoneFollowUpDto
+ {
+ ///
+ /// 0-corn表达式 1-按天 2-按周 3-按月 4-按年
+ ///
+ public char FollowUpMode { get; set; } = '0';
+
+ ///
+ /// FollowUpMode为0时 为corn表达式 其他模式为具体数字
+ ///
+ public string ModeValue { get; set; }
+
+ ///
+ /// 截止时间 采用corn表达式时需要截止日期
+ ///
+ public string EndDate { get; set; }
+
+ ///
+ /// 随访主表ID
+ ///
+ public Guid FollowUpId { get; set; }
+
+ ///
+ /// 随访内容
+ ///
+ public string FollowUpContent { get; set; }
+
+ ///
+ /// 回复内容
+ ///
+ public string ReplyContent { get; set; }
+ }
+}
diff --git a/src/Shentun.Peis.Application.Contracts/PhoneFollowUps/CreatePhoneFollowUpDto.cs b/src/Shentun.Peis.Application.Contracts/PhoneFollowUps/CreatePhoneFollowUpDto.cs
index ce22d53..4b3246c 100644
--- a/src/Shentun.Peis.Application.Contracts/PhoneFollowUps/CreatePhoneFollowUpDto.cs
+++ b/src/Shentun.Peis.Application.Contracts/PhoneFollowUps/CreatePhoneFollowUpDto.cs
@@ -1,28 +1,11 @@
using System;
using System.Collections.Generic;
-using System.ComponentModel.DataAnnotations.Schema;
-using System.ComponentModel.DataAnnotations;
using System.Text;
namespace Shentun.Peis.PhoneFollowUps
{
public class CreatePhoneFollowUpDto
{
- ///
- /// 0-corn表达式 1-按天 2-按周 3-按月 4-按年
- ///
- public char FollowUpMode { get; set; } = '0';
-
- ///
- /// FollowUpMode为0时 为corn表达式 其他模式为具体数字
- ///
- public string ModeValue { get; set; }
-
- ///
- /// 截止时间 采用corn表达式时需要截止日期
- ///
- public string EndDate { get; set; }
-
///
/// 随访主表ID
///
@@ -36,6 +19,11 @@ namespace Shentun.Peis.PhoneFollowUps
///
/// 回复内容
///
- public string? ReplyContent { get; set; }
+ public string ReplyContent { get; set; }
+
+ ///
+ /// 随访日期 yyyy-MM-dd
+ ///
+ public string PlanFollowDate { get; set; }
}
}
diff --git a/src/Shentun.Peis.Application.Contracts/PhoneFollowUps/GetPatientRegisterCriticalListInputDto.cs b/src/Shentun.Peis.Application.Contracts/PhoneFollowUps/GetPatientRegisterCriticalListInputDto.cs
new file mode 100644
index 0000000..50be7da
--- /dev/null
+++ b/src/Shentun.Peis.Application.Contracts/PhoneFollowUps/GetPatientRegisterCriticalListInputDto.cs
@@ -0,0 +1,83 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace Shentun.Peis.PhoneFollowUps
+{
+ public class GetPatientRegisterCriticalListInputDto
+ {
+ ///
+ /// 单位id
+ ///
+ public Guid? CustomerOrgId { get; set; }
+
+ public Guid? CustomerOrgRegisterId { get; set; }
+
+ ///
+ /// 单位分组
+ ///
+ public List CustomerOrgGroupIds { get; set; } = new List();
+
+ ///
+ /// 姓名
+ ///
+ public string? PatientName { get; set; }
+
+ ///
+ /// 性别
+ ///
+ public char? SexId { get; set; }
+
+ ///
+ /// 档案号
+ ///
+ public string? PatientNo { get; set; }
+
+ ///
+ /// 条码号
+ ///
+ public string? PatientRegisterNo { get; set; }
+
+ ///
+ /// 身份证号
+ ///
+ public string? IdNo { get; set; }
+
+ ///
+ /// 开始日期
+ ///
+ public string? StartDate { get; set; }
+
+ ///
+ /// 结束日期
+ ///
+ public string? EndDate { get; set; }
+
+ ///
+ /// 日期类型(1、登记日期 2、体检日期 ) 默认登记日期
+ ///
+ public char DateType { get; set; } = '1';
+
+ ///
+ /// 完成状态 改成多选集合
+ ///
+ public List CompleteFlags { get; set; } = new List();
+
+ ///
+ /// 体检类别id集合
+ ///
+ public List MedicalTypeIds { get; set; } = new List();
+
+
+ ///
+ /// 手机号(支持手机跟座机)
+ ///
+ public string? Phone { get; set; }
+
+
+
+ public int MaxResultCount { get; set; } = 50;
+
+ public int SkipCount { get; set; } = 0;
+ }
+}
diff --git a/src/Shentun.Peis.Application.Contracts/PhoneFollowUps/PhoneFollowUpWithCriticalItemDto.cs b/src/Shentun.Peis.Application.Contracts/PhoneFollowUps/PhoneFollowUpWithCriticalItemDto.cs
index bc441a2..9d16571 100644
--- a/src/Shentun.Peis.Application.Contracts/PhoneFollowUps/PhoneFollowUpWithCriticalItemDto.cs
+++ b/src/Shentun.Peis.Application.Contracts/PhoneFollowUps/PhoneFollowUpWithCriticalItemDto.cs
@@ -6,6 +6,11 @@ namespace Shentun.Peis.PhoneFollowUps
{
public class PhoneFollowUpWithCriticalItemDto
{
+ ///
+ /// 随访主表ID
+ ///
+ public Guid FollowUpId { get; set; }
+
///
/// 姓名
///
@@ -22,12 +27,100 @@ namespace Shentun.Peis.PhoneFollowUps
public string PatientRegisterNo { get; set; }
///
- /// 组合异常集合
+ /// 体检次数
+ ///
+ public short MedicalTimes { get; set; }
+
+ public string SexName { get; set; }
+
+ ///
+ /// 出生日期
+ ///
+ public string? BirthDate { get; set; }
+
+ ///
+ /// 年龄
+ ///
+ public short? Age { get; set; }
+ ///
+ /// 工卡号
+ ///
+ public string? JobCardNo { get; set; }
+ ///
+ /// 体检卡号
+ ///
+ public string? MedicalCardNo { get; set; }
+
+ public string MaritalStatusName { get; set; }
+
+ public string MedicalTypeName { get; set; }
+
+ public string PersonnelTypeName { get; set; }
+ ///
+ /// 职务
+ ///
+ public string? JobPost { get; set; }
+ ///
+ /// 职称
+ ///
+ public string? JobTitle { get; set; }
+
+
+ ///
+ /// 是否上传到WEB
+ ///
+ public char? IsUpload { get; set; }
+
+ ///
+ /// 完成标志
+ ///
+ public char? CompleteFlag { get; set; }
+
+ ///
+ /// 体检开始标志
+ ///
+ public char? IsMedicalStart { get; set; }
+ ///
+ /// 体检开始日期
+ ///
+ public string? MedicalStartDate { get; set; }
+
+ ///
+ /// 档案号
+ ///
+ public string PatientNo { get; set; }
+
+
+ public string? NationName { get; set; }
+
+
+ ///
+ /// 电话
+ ///
+ public string? Telephone { get; set; }
+ ///
+ /// 手机号
+ ///
+ public string? MobileTelephone { get; set; }
+
+ ///
+ /// 单位名称
+ ///
+ public string CustomerOrgName { get; set; }
+
+
+ ///
+ /// 父级单位名称
+ ///
+ public string CustomerOrgParentName { get; set; }
+
+ ///
+ /// 组合项目异常集合
///
public List AbnormalAsbitemDetail { get; set; }
///
- /// 异常集合
+ /// 项目异常集合
///
public List AbnormalItemDetail { get; set; }
diff --git a/src/Shentun.Peis.Application.Contracts/SmsSends/CreateSmsSendDto.cs b/src/Shentun.Peis.Application.Contracts/SmsSends/AutoCreateSmsSendDto.cs
similarity index 95%
rename from src/Shentun.Peis.Application.Contracts/SmsSends/CreateSmsSendDto.cs
rename to src/Shentun.Peis.Application.Contracts/SmsSends/AutoCreateSmsSendDto.cs
index f9328e4..902a651 100644
--- a/src/Shentun.Peis.Application.Contracts/SmsSends/CreateSmsSendDto.cs
+++ b/src/Shentun.Peis.Application.Contracts/SmsSends/AutoCreateSmsSendDto.cs
@@ -4,7 +4,7 @@ using System.Text;
namespace Shentun.Peis.SmsSends
{
- public class CreateSmsSendDto
+ public class AutoCreateSmsSendDto
{
///
/// 0-corn表达式 1-按天 2-按周 3-按月 4-按年
diff --git a/src/Shentun.Peis.Application/DiagnosisFunctions/DiagnosisFunctionAppService.cs b/src/Shentun.Peis.Application/DiagnosisFunctions/DiagnosisFunctionAppService.cs
index de57947..eff2b38 100644
--- a/src/Shentun.Peis.Application/DiagnosisFunctions/DiagnosisFunctionAppService.cs
+++ b/src/Shentun.Peis.Application/DiagnosisFunctions/DiagnosisFunctionAppService.cs
@@ -1958,8 +1958,13 @@ namespace Shentun.Peis.DiagnosisFunctions
{
registerCheckItemEnt.CriticalRangeValue = CriticalRangeValue;
registerCheckItemEnt.IsCriticalValue = isCriticalValue;
- registerCheckItemEnt.CriticalValueCreatorId = _currentUser.Id;
- registerCheckItemEnt.CriticalValueCreationTime = DateTime.Now;
+ if (isCriticalValue == 'Y')
+ {
+ registerCheckItemEnt.CriticalValueCreatorId = _currentUser.Id;
+ registerCheckItemEnt.CriticalValueCreationTime = DateTime.Now;
+ }
+ registerCheckItemEnt.FollowUpCreatorId = _currentUser.Id;
+ registerCheckItemEnt.FollowUpCreationTime = DateTime.Now;
registerCheckItemEnt.IsCriticalValueAudit = 'N';
registerCheckItemEnt.IsReview = 'N';
registerCheckItemEnt.IsFollowUp = 'Y';
@@ -1984,8 +1989,13 @@ namespace Shentun.Peis.DiagnosisFunctions
{
registerCheckEnt.CriticalRangeValue = CriticalRangeValue;
registerCheckEnt.IsCriticalValue = isCriticalValue;
- registerCheckEnt.CriticalValueCreatorId = _currentUser.Id;
- registerCheckEnt.CriticalValueCreationTime = DateTime.Now;
+ if (isCriticalValue == 'Y')
+ {
+ registerCheckEnt.CriticalValueCreatorId = _currentUser.Id;
+ registerCheckEnt.CriticalValueCreationTime = DateTime.Now;
+ }
+ registerCheckEnt.FollowUpCreatorId = _currentUser.Id;
+ registerCheckEnt.FollowUpCreationTime = DateTime.Now;
registerCheckEnt.IsCriticalValueAudit = 'N';
registerCheckEnt.IsReview = 'N';
registerCheckEnt.IsFollowUp = 'Y';
diff --git a/src/Shentun.Peis.Application/PeisApplicationAutoMapperProfile.cs b/src/Shentun.Peis.Application/PeisApplicationAutoMapperProfile.cs
index 1bb2ce1..9eee7e4 100644
--- a/src/Shentun.Peis.Application/PeisApplicationAutoMapperProfile.cs
+++ b/src/Shentun.Peis.Application/PeisApplicationAutoMapperProfile.cs
@@ -523,7 +523,7 @@ public class PeisApplicationAutoMapperProfile : Profile
CreateMap();
CreateMap()
- // .ForMember(d => d.DiagnosisDate, opt => opt.MapFrom(src => PageHelper.ConvertDatetimeV(src.DiagnosisDate)))
+ // .ForMember(d => d.DiagnosisDate, opt => opt.MapFrom(src => PageHelper.ConvertDatetimeV(src.DiagnosisDate)))
.ForMember(d => d.LastMenstrualPeriodDate, opt => opt.MapFrom(src => PageHelper.ConvertDatetimeV(src.LastMenstrualPeriodDate)));
CreateMap();
CreateMap()
@@ -548,8 +548,8 @@ public class PeisApplicationAutoMapperProfile : Profile
CreateMap();
CreateMap();
-
-
+
+
//ְҵ
CreateMap();
@@ -595,11 +595,11 @@ public class PeisApplicationAutoMapperProfile : Profile
CreateMap();
CreateMap();
- CreateMap();
+ CreateMap().ForMember(d => d.PlanFollowDate, opt => opt.MapFrom(src => DataHelper.ConversionDateToString(src.PlanFollowDate)));
CreateMap();
- CreateMap();
+ CreateMap().ForMember(d => d.PlanSendDate, opt => opt.MapFrom(src => DataHelper.ConversionDateToString(src.PlanSendDate)));
//豸
CreateMap();
@@ -611,6 +611,6 @@ public class PeisApplicationAutoMapperProfile : Profile
CreateMap();
CreateMap();
CreateMap();
-
+
}
}
diff --git a/src/Shentun.Peis.Application/PhoneFollowUps/PhoneFollowUpAppService.cs b/src/Shentun.Peis.Application/PhoneFollowUps/PhoneFollowUpAppService.cs
index 42d006e..146579a 100644
--- a/src/Shentun.Peis.Application/PhoneFollowUps/PhoneFollowUpAppService.cs
+++ b/src/Shentun.Peis.Application/PhoneFollowUps/PhoneFollowUpAppService.cs
@@ -3,6 +3,7 @@ using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using Shentun.Peis.CriticalFollowValues;
+using Shentun.Peis.CustomerOrgs;
using Shentun.Peis.Enums;
using Shentun.Peis.Models;
using SqlSugar;
@@ -35,6 +36,7 @@ namespace Shentun.Peis.PhoneFollowUps
private readonly IRepository _asbitemRepository;
private readonly IRepository- _itemRepository;
private readonly IRepository _patientRepository;
+ private readonly CustomerOrgManager _customerOrgManager;
public PhoneFollowUpAppService(
IRepository phoneFollowUpRepository,
@@ -46,7 +48,8 @@ namespace Shentun.Peis.PhoneFollowUps
IRepository registerCheckAsbitemRepository,
IRepository asbitemRepository,
IRepository
- itemRepository,
- IRepository patientRepository)
+ IRepository patientRepository,
+ CustomerOrgManager customerOrgManager)
{
_phoneFollowUpRepository = phoneFollowUpRepository;
_cacheService = cacheService;
@@ -58,6 +61,7 @@ namespace Shentun.Peis.PhoneFollowUps
_asbitemRepository = asbitemRepository;
_itemRepository = itemRepository;
_patientRepository = patientRepository;
+ _customerOrgManager = customerOrgManager;
}
@@ -125,7 +129,7 @@ namespace Shentun.Peis.PhoneFollowUps
ReplyContent = s.phoneFollowUp.ReplyContent,
PlanFollowDate = DataHelper.ConversionDateToString(s.phoneFollowUp.PlanFollowDate),
CreatorId = s.phoneFollowUp.CreatorId,
- FollowUpContent = s.phoneFollowUp.ReplyContent,
+ FollowUpContent = s.phoneFollowUp.FollowUpContent,
Id = s.phoneFollowUp.Id,
IsComplete = s.phoneFollowUp.IsComplete,
LastModificationTime = s.phoneFollowUp.LastModificationTime,
@@ -145,7 +149,7 @@ namespace Shentun.Peis.PhoneFollowUps
///
///
[HttpPost("api/app/PhoneFollowUp/GetPatientRegisterCriticalList")]
- public async Task> GetPatientRegisterCriticalListAsync()
+ public async Task> GetPatientRegisterCriticalListAsync(GetPatientRegisterCriticalListInputDto input)
{
var query = from followUp in await _followUpRepository.GetQueryableAsync()
join patientRegister in await _patientRegisterRepository.GetQueryableAsync() on followUp.PatientRegisterId equals patientRegister.Id
@@ -170,13 +174,109 @@ namespace Shentun.Peis.PhoneFollowUps
};
+
+ #region 查询条件
+
+ if (!string.IsNullOrEmpty(input.PatientNo))
+ query = query.Where(m => m.patient.PatientNo == input.PatientNo);
+
+ if (!string.IsNullOrEmpty(input.IdNo))
+ query = query.Where(m => m.patient.IdNo == input.IdNo);
+
+ if (!string.IsNullOrEmpty(input.PatientName))
+ query = query.Where(m => m.patientRegister.PatientName == input.PatientName);
+
+ if (!string.IsNullOrEmpty(input.PatientRegisterNo))
+ query = query.Where(m => m.patientRegister.PatientRegisterNo == input.PatientRegisterNo);
+
+ if (!string.IsNullOrEmpty(input.Phone))
+ query = query.Where(m => m.patient.MobileTelephone == input.Phone || m.patient.Telephone == input.Phone);
+
+ if (input.SexId != null && input.SexId != ForSexFlag.All)
+ query = query.Where(m => m.patientRegister.SexId == input.SexId);
+
+ if (!string.IsNullOrEmpty(input.StartDate) && !string.IsNullOrEmpty(input.EndDate))
+ {
+ if (input.DateType == '1')
+ {
+ query = query.Where(m => m.patientRegister.CreationTime >= Convert.ToDateTime(input.StartDate) &&
+ m.patientRegister.CreationTime < Convert.ToDateTime(input.EndDate).AddDays(1));
+ }
+ else if (input.DateType == '2')
+ {
+ query = query.Where(m => m.patientRegister.MedicalStartDate >= Convert.ToDateTime(input.StartDate) &&
+ m.patientRegister.MedicalStartDate < Convert.ToDateTime(input.EndDate).AddDays(1));
+ }
+ else
+ {
+ query = query.Where(m => (m.patientRegister.CreationTime >= Convert.ToDateTime(input.StartDate) &&
+ m.patientRegister.CreationTime < Convert.ToDateTime(input.EndDate).AddDays(1))
+ || (m.patientRegister.MedicalStartDate >= Convert.ToDateTime(input.StartDate) &&
+ m.patientRegister.MedicalStartDate < Convert.ToDateTime(input.EndDate).AddDays(1))
+ );
+ }
+ }
+ if (input.CompleteFlags.Any())
+ {
+ query = query.Where(m => input.CompleteFlags.Contains(m.patientRegister.CompleteFlag));
+ }
+
+ if (input.MedicalTypeIds.Any())
+ {
+ query = query.Where(m => input.MedicalTypeIds.Contains(m.patientRegister.MedicalTypeId));
+ }
+
+
+ if (input.CustomerOrgId != null)
+ {
+ var CustomerOrgIds = await _customerOrgManager.GetCustomerOrgChildrenId(input.CustomerOrgId.Value);
+ query = query.Where(m => CustomerOrgIds.Contains(m.patientRegister.CustomerOrgId));
+ }
+
+ if (input.CustomerOrgRegisterId != null && input.CustomerOrgRegisterId != Guid.Empty)
+ {
+ query = query.Where(m => m.patientRegister.CustomerOrgRegisterId == input.CustomerOrgRegisterId);
+ }
+
+ if (input.CustomerOrgGroupIds.Any())
+ {
+ query = query.Where(m => m.patientRegister.CustomerOrgGroupId != null && input.CustomerOrgGroupIds.Contains(m.patientRegister.CustomerOrgGroupId.Value));
+ }
+
+ #endregion
+
+
+
+
var followUpGroup = query.ToList().GroupBy(g => g.followUp);
var entListDto = followUpGroup.Select(s => new PhoneFollowUpWithCriticalItemDto
{
+ FollowUpId = s.Key.Id,
PatientName = s.FirstOrDefault().patientRegister.PatientName,
IdNo = s.FirstOrDefault().patient.IdNo,
PatientRegisterNo = s.FirstOrDefault().patientRegister.PatientRegisterNo,
+ Age = s.FirstOrDefault().patientRegister.Age,
+ BirthDate = DataHelper.ConversionDateShortToString(s.FirstOrDefault().patientRegister.BirthDate),
+ CompleteFlag = s.FirstOrDefault().patientRegister.CompleteFlag,
+ CustomerOrgName = _cacheService.GetCustomerOrgNameAsync(s.FirstOrDefault().patientRegister.CustomerOrgId).GetAwaiter().GetResult(),
+ CustomerOrgParentName = _cacheService.GetTopCustomerOrgNameAsync(s.FirstOrDefault().patientRegister.CustomerOrgId).GetAwaiter().GetResult(),
+ IsMedicalStart = s.FirstOrDefault().patientRegister.IsMedicalStart,
+ IsUpload = s.FirstOrDefault().patientRegister.IsUpload,
+ JobCardNo = s.FirstOrDefault().patientRegister.JobCardNo,
+ JobPost = s.FirstOrDefault().patientRegister.JobPost,
+ JobTitle = s.FirstOrDefault().patientRegister.JobTitle,
+ MaritalStatusName = _cacheService.GetMaritalStatusNameAsync(s.FirstOrDefault().patientRegister.MaritalStatusId).GetAwaiter().GetResult(),
+ MedicalCardNo = s.FirstOrDefault().patientRegister.MedicalCardNo,
+ MedicalStartDate = DataHelper.ConversionDateShortToString(s.FirstOrDefault().patientRegister.MedicalStartDate),
+ MedicalTimes = s.FirstOrDefault().patientRegister.MedicalTimes,
+ MedicalTypeName = _cacheService.GetMedicalTypeNameAsync(s.FirstOrDefault().patientRegister.MedicalTypeId).GetAwaiter().GetResult(),
+ MobileTelephone = s.FirstOrDefault().patient.MobileTelephone,
+ NationName = _cacheService.GetNationNameAsync(s.FirstOrDefault().patient.NationId).GetAwaiter().GetResult(),
+ PatientNo = s.FirstOrDefault().patient.PatientNo,
+ PersonnelTypeName = _cacheService.GetPersonnelTypeNameAsync(s.FirstOrDefault().patientRegister.PersonnelTypeId).GetAwaiter().GetResult(),
+ SexName = _cacheService.GetSexNameAsync(s.FirstOrDefault().patientRegister.SexId).GetAwaiter().GetResult(),
+ Telephone = s.FirstOrDefault().patient.Telephone,
PhoneFollowUpDetail = s.Where(m => m.phoneFollowUpEmpty != null).GroupBy(g => g.phoneFollowUpEmpty).Select(ss => new PhoneFollowUpSimpleDto
{
FollowUpContent = ss.Key.FollowUpContent,
@@ -256,12 +356,12 @@ namespace Shentun.Peis.PhoneFollowUps
}
///
- /// 创建电话随访记录
+ /// 自动生成电话随访记录
///
///
///
- [HttpPost("api/app/PhoneFollowUp/Create")]
- public async Task CreateAsync(CreatePhoneFollowUpDto input)
+ [HttpPost("api/app/PhoneFollowUp/AutoCreate")]
+ public async Task AutoCreateAsync(AutoCreatePhoneFollowUpDto input)
{
if (string.IsNullOrWhiteSpace(input.ModeValue))
{
@@ -376,6 +476,45 @@ namespace Shentun.Peis.PhoneFollowUps
}
}
+ ///
+ /// 新增电话随访记录
+ ///
+ ///
+ ///
+ [HttpPost("api/app/PhoneFollowUp/Create")]
+ public async Task CreateAsync(CreatePhoneFollowUpDto input)
+ {
+
+ var followUpEnt = await _followUpRepository.FirstOrDefaultAsync(f => f.Id == input.FollowUpId);
+ if (followUpEnt == null)
+ {
+ throw new UserFriendlyException("随访ID不正确");
+ }
+
+ if (string.IsNullOrWhiteSpace(input.PlanFollowDate))
+ {
+ throw new UserFriendlyException("随访日期不能为空");
+ }
+
+ var phoneFollowUpEntity = new PhoneFollowUp(GuidGenerator.Create())
+ {
+ FollowUpContent = input.FollowUpContent,
+ FollowUpId = input.FollowUpId,
+ ReplyContent = input.ReplyContent,
+ PlanFollowDate = Convert.ToDateTime(input.PlanFollowDate),
+ IsComplete = 'N'
+ };
+
+
+ await _phoneFollowUpRepository.InsertAsync(phoneFollowUpEntity);
+
+ followUpEnt.IsPhoneComplete = 'Y';
+ await _followUpRepository.UpdateAsync(followUpEnt);
+
+
+ }
+
+
///
/// 修改电话随访记录
///
@@ -412,7 +551,6 @@ namespace Shentun.Peis.PhoneFollowUps
///
///
[HttpPost("api/app/PhoneFollowUp/Delete")]
- [RemoteService(false)]
public async Task DeleteAsync(PhoneFollowUpIdInputDto input)
{
await _phoneFollowUpRepository.DeleteAsync(input.PhoneFollowUpId);
diff --git a/src/Shentun.Peis.Application/RegisterCheckItems/RegisterCheckItemAppService.cs b/src/Shentun.Peis.Application/RegisterCheckItems/RegisterCheckItemAppService.cs
index 5f13ba6..0f4b796 100644
--- a/src/Shentun.Peis.Application/RegisterCheckItems/RegisterCheckItemAppService.cs
+++ b/src/Shentun.Peis.Application/RegisterCheckItems/RegisterCheckItemAppService.cs
@@ -399,10 +399,9 @@ namespace Shentun.Peis.RegisterCheckItems
{
registerCheckItemEnt.IsReview = input.IsReview;
}
- if (!string.IsNullOrWhiteSpace(input.CriticalValueContent))
- {
- registerCheckItemEnt.CriticalValueContent = input.CriticalValueContent;
- }
+
+ registerCheckItemEnt.CriticalValueContent = input.CriticalValueContent;
+
if (input.IsFollowUp != null)
{
@@ -410,12 +409,19 @@ namespace Shentun.Peis.RegisterCheckItems
}
- if (registerCheckItemEnt.CriticalValueCreatorId == null)
+
+ if (input.IsCriticalValue == 'Y' && registerCheckItemEnt.CriticalValueCreatorId == null)
{
registerCheckItemEnt.CriticalValueCreatorId = _currentUser.Id;
registerCheckItemEnt.CriticalValueCreationTime = DateTime.Now;
}
+ if (input.IsFollowUp == 'Y' && registerCheckItemEnt.FollowUpCreatorId == null)
+ {
+ registerCheckItemEnt.FollowUpCreatorId = _currentUser.Id;
+ registerCheckItemEnt.FollowUpCreationTime = DateTime.Now;
+ }
+
await _registerCheckItemRepository.UpdateAsync(registerCheckItemEnt);
diff --git a/src/Shentun.Peis.Application/RegisterChecks/RegisterCheckAppService.cs b/src/Shentun.Peis.Application/RegisterChecks/RegisterCheckAppService.cs
index 3e24224..d282910 100644
--- a/src/Shentun.Peis.Application/RegisterChecks/RegisterCheckAppService.cs
+++ b/src/Shentun.Peis.Application/RegisterChecks/RegisterCheckAppService.cs
@@ -695,22 +695,27 @@ namespace Shentun.Peis.RegisterChecks
{
registerCheckEnt.IsReview = input.IsReview;
}
- if (!string.IsNullOrWhiteSpace(input.CriticalValueContent))
- {
- registerCheckEnt.CriticalValueContent = input.CriticalValueContent;
- }
+
+ registerCheckEnt.CriticalValueContent = input.CriticalValueContent;
+
if (input.IsFollowUp != null)
{
registerCheckEnt.IsFollowUp = input.IsFollowUp;
}
- if (registerCheckEnt.CriticalValueCreatorId == null)
+ if (input.IsCriticalValue == 'Y' && registerCheckEnt.CriticalValueCreatorId == null)
{
registerCheckEnt.CriticalValueCreatorId = _currentUser.Id;
registerCheckEnt.CriticalValueCreationTime = DateTime.Now;
}
+ if (input.IsFollowUp == 'Y' && registerCheckEnt.FollowUpCreatorId == null)
+ {
+ registerCheckEnt.FollowUpCreatorId = _currentUser.Id;
+ registerCheckEnt.FollowUpCreationTime = DateTime.Now;
+ }
+
await _registerCheckRepository.UpdateAsync(registerCheckEnt);
diff --git a/src/Shentun.Peis.Application/SmsSends/SmsSendAppService.cs b/src/Shentun.Peis.Application/SmsSends/SmsSendAppService.cs
index 25d6203..d77ff6d 100644
--- a/src/Shentun.Peis.Application/SmsSends/SmsSendAppService.cs
+++ b/src/Shentun.Peis.Application/SmsSends/SmsSendAppService.cs
@@ -2,6 +2,7 @@
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Configuration;
+using NPOI.OpenXmlFormats.Wordprocessing;
using Shentun.Peis.Enums;
using Shentun.Peis.Models;
using Shentun.Peis.PlugIns.Sms;
@@ -130,12 +131,12 @@ namespace Shentun.Peis.SmsSends
///
- /// 创建短信随访记录
+ /// 自动生成短信随访记录
///
///
///
- [HttpPost("api/app/SmsSend/Create")]
- public async Task CreateAsync(CreateSmsSendDto input)
+ [HttpPost("api/app/SmsSend/AutoCreate")]
+ public async Task AutoCreateAsync(AutoCreateSmsSendDto input)
{
if (string.IsNullOrWhiteSpace(input.ModeValue))
{
@@ -285,10 +286,28 @@ namespace Shentun.Peis.SmsSends
///
///
[HttpPost("api/app/SmsSend/Delete")]
- [RemoteService(false)]
public async Task DeleteAsync(SmsSendIdInputDto input)
{
- await _smsSendRepository.DeleteAsync(input.SmsSendId);
+ var smsSendEnt = (from smsSend in await _smsSendRepository.GetQueryableAsync()
+ join followUp in await _followUpRepository.GetQueryableAsync() on smsSend.FollowUpId equals followUp.Id
+ join patientRegister in await _patientRegisterRepository.GetQueryableAsync() on followUp.PatientRegisterId equals patientRegister.Id
+ where smsSend.Id == input.SmsSendId
+ select new
+ {
+ smsSend,
+ patientRegister
+ }).FirstOrDefault();
+ if (smsSendEnt != null)
+ {
+ //删除任务
+ await DeleteCriticalSmsByThirdIdWithPlanSendTimeAsync(smsSendEnt.patientRegister,
+ smsSendEnt.smsSend.Content,
+ smsSendEnt.smsSend.MobileTelephone,
+ new List { DataHelper.ConversionDateToString(smsSendEnt.smsSend.PlanSendDate) });
+
+ //删除短信记录
+ await _smsSendRepository.DeleteAsync(input.SmsSendId);
+ }
}
@@ -352,7 +371,7 @@ namespace Shentun.Peis.SmsSends
///
///
[RemoteService(false)]
- public async Task DeleteCriticalSmsAsync(PatientRegister patientRegister,string Content)
+ public async Task DeleteCriticalSmsAsync(PatientRegister patientRegister, string Content)
{
var smsThirdInterface = await _thirdInterfaceRepository.FirstOrDefaultAsync(o => o.ThirdInterfaceType ==
ThirdInterfaceTypeFlag.CriticalSmsPush);
@@ -385,5 +404,47 @@ namespace Shentun.Peis.SmsSends
}
+ ///
+ /// 删除指定危急值短信任务
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ [RemoteService(false)]
+ public async Task DeleteCriticalSmsByThirdIdWithPlanSendTimeAsync(PatientRegister patientRegister, string content, string mobileTelephone, List planSendTimes)
+ {
+ var smsThirdInterface = await _thirdInterfaceRepository.FirstOrDefaultAsync(o => o.ThirdInterfaceType ==
+ ThirdInterfaceTypeFlag.CriticalSmsPush);
+ if (smsThirdInterface != null && smsThirdInterface.IsActive == 'Y')
+ {
+
+ var parmValue = smsThirdInterface.ParmValue;
+ var configurationBuilder = new ConfigurationBuilder()
+ .AddJsonStream(new MemoryStream(System.Text.Encoding.UTF8.GetBytes(parmValue)));
+ var interfaceConfig = configurationBuilder.Build();
+ var removeApiAddress = interfaceConfig.GetSection("Interface").GetSection("DeleteSpecificTasksApiAddress").Value;
+ var isEnableSms = interfaceConfig.GetSection("Interface").GetSection("IsActive").Value;
+ if (!string.IsNullOrWhiteSpace(isEnableSms)
+ && isEnableSms == "Y")
+ {
+ SmsPlugIns smsPlugIns = new SmsPlugIns(smsThirdInterface.Id);
+ var patientEnt = await _patientRepository.FirstOrDefaultAsync(f => f.Id == patientRegister.PatientId);
+ if (patientEnt != null)
+ {
+ var inputDto = new DeleteThirdPartySmsTaskByThirdIdWithPlanSendTimeInputDto
+ {
+ Content = content,
+ ThirdId = patientRegister.Id.ToString(),
+ MobileTelephone = mobileTelephone,
+ PlanSendTimes = planSendTimes
+ };
+
+ await smsPlugIns.CallSmsAppServiceAsync(removeApiAddress, inputDto);
+ }
+ }
+ }
+ }
}
}
diff --git a/src/Shentun.Peis.DbMigrator/appsettings.json b/src/Shentun.Peis.DbMigrator/appsettings.json
index f671d85..3444c1b 100644
--- a/src/Shentun.Peis.DbMigrator/appsettings.json
+++ b/src/Shentun.Peis.DbMigrator/appsettings.json
@@ -1,7 +1,7 @@
{
"ConnectionStrings": {
- //"Default": "Host=140.143.162.39;Port=5432;Database=ShentunPeis240701;User ID=postgres;Password=shentun123;"
- "Default": "Host=192.168.2.67;Port=5432;Database=ShentunPeis;User ID=postgres;Password=st123;"
+ "Default": "Host=140.143.162.39;Port=5432;Database=ShentunPeis240701;User ID=postgres;Password=shentun123;"
+ //"Default": "Host=192.168.2.67;Port=5432;Database=ShentunPeis;User ID=postgres;Password=st123;"
//"Default": "Host=localhost;Port=5432;Database=ShentunPeis1218;User ID=postgres;Password=wxd123;"
//"Default": "Host=10.1.12.140;Port=5432;Database=ShentunPeis0508;User ID=postgres;Password=st123;"
},