Browse Source

随访

master
wxd 1 year ago
parent
commit
bc0cb754d3
  1. 31
      src/Shentun.ColumnReferencePlugIns/Sms/DeleteThirdPartySmsTaskByThirdIdWithPlanSendTimeInputDto.cs
  2. 41
      src/Shentun.Peis.Application.Contracts/PhoneFollowUps/AutoCreatePhoneFollowUpDto.cs
  3. 24
      src/Shentun.Peis.Application.Contracts/PhoneFollowUps/CreatePhoneFollowUpDto.cs
  4. 83
      src/Shentun.Peis.Application.Contracts/PhoneFollowUps/GetPatientRegisterCriticalListInputDto.cs
  5. 97
      src/Shentun.Peis.Application.Contracts/PhoneFollowUps/PhoneFollowUpWithCriticalItemDto.cs
  6. 2
      src/Shentun.Peis.Application.Contracts/SmsSends/AutoCreateSmsSendDto.cs
  7. 18
      src/Shentun.Peis.Application/DiagnosisFunctions/DiagnosisFunctionAppService.cs
  8. 12
      src/Shentun.Peis.Application/PeisApplicationAutoMapperProfile.cs
  9. 152
      src/Shentun.Peis.Application/PhoneFollowUps/PhoneFollowUpAppService.cs
  10. 16
      src/Shentun.Peis.Application/RegisterCheckItems/RegisterCheckItemAppService.cs
  11. 15
      src/Shentun.Peis.Application/RegisterChecks/RegisterCheckAppService.cs
  12. 73
      src/Shentun.Peis.Application/SmsSends/SmsSendAppService.cs
  13. 4
      src/Shentun.Peis.DbMigrator/appsettings.json

31
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
{
/// <summary>
/// 第三方ID 人员登记ID
/// </summary>
public string ThirdId { get; set; }
/// <summary>
/// 短信内容
/// </summary>
public string Content { get; set; }
/// <summary>
/// 手机号
/// </summary>
public string MobileTelephone { get; set; }
/// <summary>
/// 计划时间
/// </summary>
public List<string> PlanSendTimes { get; set; }
}
}

41
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
{
/// <summary>
/// 0-corn表达式 1-按天 2-按周 3-按月 4-按年
/// </summary>
public char FollowUpMode { get; set; } = '0';
/// <summary>
/// FollowUpMode为0时 为corn表达式 其他模式为具体数字
/// </summary>
public string ModeValue { get; set; }
/// <summary>
/// 截止时间 采用corn表达式时需要截止日期
/// </summary>
public string EndDate { get; set; }
/// <summary>
/// 随访主表ID
/// </summary>
public Guid FollowUpId { get; set; }
/// <summary>
/// 随访内容
/// </summary>
public string FollowUpContent { get; set; }
/// <summary>
/// 回复内容
/// </summary>
public string ReplyContent { get; set; }
}
}

24
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
{
/// <summary>
/// 0-corn表达式 1-按天 2-按周 3-按月 4-按年
/// </summary>
public char FollowUpMode { get; set; } = '0';
/// <summary>
/// FollowUpMode为0时 为corn表达式 其他模式为具体数字
/// </summary>
public string ModeValue { get; set; }
/// <summary>
/// 截止时间 采用corn表达式时需要截止日期
/// </summary>
public string EndDate { get; set; }
/// <summary>
/// 随访主表ID
/// </summary>
@ -36,6 +19,11 @@ namespace Shentun.Peis.PhoneFollowUps
/// <summary>
/// 回复内容
/// </summary>
public string? ReplyContent { get; set; }
public string ReplyContent { get; set; }
/// <summary>
/// 随访日期 yyyy-MM-dd
/// </summary>
public string PlanFollowDate { get; set; }
}
}

83
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
{
/// <summary>
/// 单位id
/// </summary>
public Guid? CustomerOrgId { get; set; }
public Guid? CustomerOrgRegisterId { get; set; }
/// <summary>
/// 单位分组
/// </summary>
public List<Guid> CustomerOrgGroupIds { get; set; } = new List<Guid>();
/// <summary>
/// 姓名
/// </summary>
public string? PatientName { get; set; }
/// <summary>
/// 性别
/// </summary>
public char? SexId { get; set; }
/// <summary>
/// 档案号
/// </summary>
public string? PatientNo { get; set; }
/// <summary>
/// 条码号
/// </summary>
public string? PatientRegisterNo { get; set; }
/// <summary>
/// 身份证号
/// </summary>
public string? IdNo { get; set; }
/// <summary>
/// 开始日期
/// </summary>
public string? StartDate { get; set; }
/// <summary>
/// 结束日期
/// </summary>
public string? EndDate { get; set; }
/// <summary>
/// 日期类型(1、登记日期 2、体检日期 ) 默认登记日期
/// </summary>
public char DateType { get; set; } = '1';
/// <summary>
/// 完成状态 改成多选集合
/// </summary>
public List<char> CompleteFlags { get; set; } = new List<char>();
/// <summary>
/// 体检类别id集合
/// </summary>
public List<Guid?> MedicalTypeIds { get; set; } = new List<Guid?>();
/// <summary>
/// 手机号(支持手机跟座机)
/// </summary>
public string? Phone { get; set; }
public int MaxResultCount { get; set; } = 50;
public int SkipCount { get; set; } = 0;
}
}

97
src/Shentun.Peis.Application.Contracts/PhoneFollowUps/PhoneFollowUpWithCriticalItemDto.cs

@ -6,6 +6,11 @@ namespace Shentun.Peis.PhoneFollowUps
{
public class PhoneFollowUpWithCriticalItemDto
{
/// <summary>
/// 随访主表ID
/// </summary>
public Guid FollowUpId { get; set; }
/// <summary>
/// 姓名
/// </summary>
@ -22,12 +27,100 @@ namespace Shentun.Peis.PhoneFollowUps
public string PatientRegisterNo { get; set; }
/// <summary>
/// 组合异常集合
/// 体检次数
/// </summary>
public short MedicalTimes { get; set; }
public string SexName { get; set; }
/// <summary>
/// 出生日期
/// </summary>
public string? BirthDate { get; set; }
/// <summary>
/// 年龄
/// </summary>
public short? Age { get; set; }
/// <summary>
/// 工卡号
/// </summary>
public string? JobCardNo { get; set; }
/// <summary>
/// 体检卡号
/// </summary>
public string? MedicalCardNo { get; set; }
public string MaritalStatusName { get; set; }
public string MedicalTypeName { get; set; }
public string PersonnelTypeName { get; set; }
/// <summary>
/// 职务
/// </summary>
public string? JobPost { get; set; }
/// <summary>
/// 职称
/// </summary>
public string? JobTitle { get; set; }
/// <summary>
/// 是否上传到WEB
/// </summary>
public char? IsUpload { get; set; }
/// <summary>
/// 完成标志
/// </summary>
public char? CompleteFlag { get; set; }
/// <summary>
/// 体检开始标志
/// </summary>
public char? IsMedicalStart { get; set; }
/// <summary>
/// 体检开始日期
/// </summary>
public string? MedicalStartDate { get; set; }
/// <summary>
/// 档案号
/// </summary>
public string PatientNo { get; set; }
public string? NationName { get; set; }
/// <summary>
/// 电话
/// </summary>
public string? Telephone { get; set; }
/// <summary>
/// 手机号
/// </summary>
public string? MobileTelephone { get; set; }
/// <summary>
/// 单位名称
/// </summary>
public string CustomerOrgName { get; set; }
/// <summary>
/// 父级单位名称
/// </summary>
public string CustomerOrgParentName { get; set; }
/// <summary>
/// 组合项目异常集合
/// </summary>
public List<PhoneFollowUpWithCriticalItemAbnormalAsbitemDto> AbnormalAsbitemDetail { get; set; }
/// <summary>
/// 异常集合
/// 项目异常集合
/// </summary>
public List<PhoneFollowUpWithCriticalItemAbnormalItemDto> AbnormalItemDetail { get; set; }

2
src/Shentun.Peis.Application.Contracts/SmsSends/CreateSmsSendDto.cs → 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
{
/// <summary>
/// 0-corn表达式 1-按天 2-按周 3-按月 4-按年

18
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';

12
src/Shentun.Peis.Application/PeisApplicationAutoMapperProfile.cs

@ -523,7 +523,7 @@ public class PeisApplicationAutoMapperProfile : Profile
CreateMap<UpdateOcCheckTypeDto, OcCheckType>();
CreateMap<PatientOccupationalDiseaseInputDto, PatientOccupationalDisease>()
// .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<PatientPoisonInputDto, PatientPoison>();
CreateMap<PatientOccupationalHistoryInputDto, PatientOccupationalHistory>()
@ -548,8 +548,8 @@ public class PeisApplicationAutoMapperProfile : Profile
CreateMap<CreateSuspectedOccupationalDiseaseDto, SuspectedOccupationalDisease>();
CreateMap<UpdateSuspectedOccupationalDiseaseDto, SuspectedOccupationalDisease>();
//Ö°Òµ²¡±¨¸æ
CreateMap<MedicalReportDto, OccupationalDiseaseMedicalReportDto>();
@ -595,11 +595,11 @@ public class PeisApplicationAutoMapperProfile : Profile
CreateMap<CreateCriticalFollowValueDto, CriticalFollowValue>();
CreateMap<UpdateCriticalFollowValueDto, CriticalFollowValue>();
CreateMap<PhoneFollowUp, PhoneFollowUpDto>();
CreateMap<PhoneFollowUp, PhoneFollowUpDto>().ForMember(d => d.PlanFollowDate, opt => opt.MapFrom(src => DataHelper.ConversionDateToString(src.PlanFollowDate)));
CreateMap<UpdatePhoneFollowUpDto, PhoneFollowUp>();
CreateMap<SmsSend, SmsSendDto>();
CreateMap<SmsSend, SmsSendDto>().ForMember(d => d.PlanSendDate, opt => opt.MapFrom(src => DataHelper.ConversionDateToString(src.PlanSendDate)));
//É豸
CreateMap<Device, DeviceDto>();
@ -611,6 +611,6 @@ public class PeisApplicationAutoMapperProfile : Profile
CreateMap<ThirdMedicalCenter, ThirdMedicalCenterDto>();
CreateMap<CreateThirdMedicalCenterDto, ThirdMedicalCenter>();
CreateMap<UpdateThirdMedicalCenterDto, ThirdMedicalCenter>();
}
}

152
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<Asbitem, Guid> _asbitemRepository;
private readonly IRepository<Item, Guid> _itemRepository;
private readonly IRepository<Patient, Guid> _patientRepository;
private readonly CustomerOrgManager _customerOrgManager;
public PhoneFollowUpAppService(
IRepository<PhoneFollowUp, Guid> phoneFollowUpRepository,
@ -46,7 +48,8 @@ namespace Shentun.Peis.PhoneFollowUps
IRepository<RegisterCheckAsbitem, Guid> registerCheckAsbitemRepository,
IRepository<Asbitem, Guid> asbitemRepository,
IRepository<Item, Guid> itemRepository,
IRepository<Patient, Guid> patientRepository)
IRepository<Patient, Guid> 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
/// </summary>
/// <returns></returns>
[HttpPost("api/app/PhoneFollowUp/GetPatientRegisterCriticalList")]
public async Task<List<PhoneFollowUpWithCriticalItemDto>> GetPatientRegisterCriticalListAsync()
public async Task<List<PhoneFollowUpWithCriticalItemDto>> 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
}
/// <summary>
/// 创建电话随访记录
/// 自动生成电话随访记录
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[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
}
}
/// <summary>
/// 新增电话随访记录
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[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);
}
/// <summary>
/// 修改电话随访记录
/// </summary>
@ -412,7 +551,6 @@ namespace Shentun.Peis.PhoneFollowUps
/// <param name="input"></param>
/// <returns></returns>
[HttpPost("api/app/PhoneFollowUp/Delete")]
[RemoteService(false)]
public async Task DeleteAsync(PhoneFollowUpIdInputDto input)
{
await _phoneFollowUpRepository.DeleteAsync(input.PhoneFollowUpId);

16
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);

15
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);

73
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
/// <summary>
/// 创建短信随访记录
/// 自动生成短信随访记录
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[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
/// <param name="input"></param>
/// <returns></returns>
[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<string> { DataHelper.ConversionDateToString(smsSendEnt.smsSend.PlanSendDate) });
//删除短信记录
await _smsSendRepository.DeleteAsync(input.SmsSendId);
}
}
@ -352,7 +371,7 @@ namespace Shentun.Peis.SmsSends
/// <param name="Content"></param>
/// <returns></returns>
[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
}
/// <summary>
/// 删除指定危急值短信任务
/// </summary>
/// <param name="patientRegister"></param>
/// <param name="content"></param>
/// <param name="mobileTelephone"></param>
/// <param name="planSendTimes"></param>
/// <returns></returns>
[RemoteService(false)]
public async Task DeleteCriticalSmsByThirdIdWithPlanSendTimeAsync(PatientRegister patientRegister, string content, string mobileTelephone, List<string> 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<DeleteThirdPartySmsTaskByThirdIdWithPlanSendTimeInputDto, Task>(removeApiAddress, inputDto);
}
}
}
}
}
}

4
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;"
},

Loading…
Cancel
Save