Browse Source

随访

master
wxd 7 months ago
parent
commit
0c031b5474
  1. 29
      src/Shentun.Peis.Application.Contracts/PhoneFollowUps/PhoneFollowUpWithCriticalItemDto.cs
  2. 388
      src/Shentun.Peis.Application/PhoneFollowUps/PhoneFollowUpAppService.cs

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

@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.ComponentModel.DataAnnotations;
using System.Text;
using Shentun.Peis.SmsSends;
namespace Shentun.Peis.PhoneFollowUps
{
@ -121,20 +122,32 @@ namespace Shentun.Peis.PhoneFollowUps
/// </summary>
public string CustomerOrgParentName { get; set; }
/// <summary>
/// 组合项目异常集合
/// </summary>
public List<PhoneFollowUpWithCriticalItemAbnormalAsbitemDto> AbnormalAsbitemDetail { get; set; }
///// <summary>
///// 组合项目异常集合
///// </summary>
//public List<PhoneFollowUpWithCriticalItemAbnormalAsbitemDto> AbnormalAsbitemDetail { get; set; }
///// <summary>
///// 项目异常集合
///// </summary>
//public List<PhoneFollowUpWithCriticalItemAbnormalItemDto> AbnormalItemDetail { get; set; }
///// <summary>
///// 电话随访记录
///// </summary>
//public List<PhoneFollowUpSimpleDto> PhoneFollowUpDetail { get; set; }
/// <summary>
/// 项目异常集合
/// 电话随访记录
/// </summary>
public List<PhoneFollowUpWithCriticalItemAbnormalItemDto> AbnormalItemDetail { get; set; }
public List<PhoneFollowUpWithPatientRegisterDto> PhoneFollowUpWithPatientRegisterDetail { get; set; } = new List<PhoneFollowUpWithPatientRegisterDto>();
/// <summary>
/// 电话随访记录
/// 短信随访记录
/// </summary>
public List<PhoneFollowUpSimpleDto> PhoneFollowUpDetail { get; set; }
public List<SmsSendDto> SmsSendDetail { get; set; } = new List<SmsSendDto>();
/// <summary>

388
src/Shentun.Peis.Application/PhoneFollowUps/PhoneFollowUpAppService.cs

@ -8,6 +8,7 @@ using Shentun.Peis.CustomerOrgs;
using Shentun.Peis.Enums;
using Shentun.Peis.Models;
using Shentun.Peis.PatientRegisters;
using Shentun.Peis.SmsSends;
using SqlSugar;
using System;
using System.Collections.Generic;
@ -40,6 +41,7 @@ namespace Shentun.Peis.PhoneFollowUps
private readonly IRepository<Patient, Guid> _patientRepository;
private readonly CustomerOrgManager _customerOrgManager;
private readonly IRepository<RegisterCheckSummary, Guid> _registerCheckSummaryRepository;
private readonly IRepository<SmsSend,Guid> _smsSendRepository;
public PhoneFollowUpAppService(
@ -54,8 +56,8 @@ namespace Shentun.Peis.PhoneFollowUps
IRepository<Item, Guid> itemRepository,
IRepository<Patient, Guid> patientRepository,
CustomerOrgManager customerOrgManager,
IRepository<RegisterCheckSummary, Guid> registerCheckSummaryRepository
)
IRepository<RegisterCheckSummary, Guid> registerCheckSummaryRepository,
IRepository<SmsSend, Guid> smsSendRepository)
{
_phoneFollowUpRepository = phoneFollowUpRepository;
_cacheService = cacheService;
@ -69,6 +71,7 @@ namespace Shentun.Peis.PhoneFollowUps
_patientRepository = patientRepository;
_customerOrgManager = customerOrgManager;
_registerCheckSummaryRepository = registerCheckSummaryRepository;
_smsSendRepository = smsSendRepository;
}
@ -150,8 +153,251 @@ namespace Shentun.Peis.PhoneFollowUps
}
///// <summary>
///// 获取所有危急值列表
///// </summary>
///// <returns></returns>
//[HttpPost("api/app/PhoneFollowUp/GetPatientRegisterCriticalList")]
//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
// join patient in await _patientRepository.GetQueryableAsync() on patientRegister.PatientId equals patient.Id
// join registerCheck in await _registerCheckRepository.GetQueryableAsync() on patientRegister.Id equals registerCheck.PatientRegisterId
// join registerCheckAsbitem in await _registerCheckAsbitemRepository.GetQueryableAsync() on registerCheck.Id equals registerCheckAsbitem.RegisterCheckId
// join asbitem in await _asbitemRepository.GetQueryableAsync() on registerCheckAsbitem.AsbitemId equals asbitem.Id
// join registerCheckItem in await _registerCheckItemRepository.GetQueryableAsync() on registerCheck.Id equals registerCheckItem.RegisterCheckId
// join item in await _itemRepository.GetQueryableAsync() on registerCheckItem.ItemId equals item.Id
// join phoneFollowUp in await _phoneFollowUpRepository.GetQueryableAsync() on followUp.Id equals phoneFollowUp.FollowUpId into phoneFollowUpTemp
// from phoneFollowUpEmpty in phoneFollowUpTemp.DefaultIfEmpty()
// select new
// {
// patientRegister,
// registerCheck,
// asbitem,
// registerCheckItem,
// item,
// followUp,
// phoneFollowUpEmpty,
// patient
// };
// #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));
// }
// 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);
// }
// if (input.DiagnosisLevelIds.Any())
// {
// query = query.Where(m => input.DiagnosisLevelIds.Contains(m.registerCheck.DiagnosisLevelId) || input.DiagnosisLevelIds.Contains(m.registerCheckItem.DiagnosisLevelId));
// }
// #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,
// PatientRegisterId = s.FirstOrDefault().patientRegister.Id,
// 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).OrderBy(o => o.Key.PlanFollowDate).Select(ss => new PhoneFollowUpSimpleDto
// {
// FollowUpContent = ss.Key.FollowUpContent,
// IsComplete = ss.Key.IsComplete,
// PlanFollowDate = DataHelper.ConversionDateToString(ss.Key.PlanFollowDate),
// ReplyContent = ss.Key.ReplyContent
// }).ToList(),
// AbnormalAsbitemDetail = s.Where(m => m.registerCheck.IsCriticalValue != null).GroupBy(g => g.registerCheck).Select(ss => new PhoneFollowUpWithCriticalItemAbnormalAsbitemDto
// {
// CriticalValueContent = ss.Key.CriticalValueContent,
// AsbitemName = string.Join(",", ss.Select(sss => sss.asbitem.DisplayName).Distinct()),
// IsCriticalValue = ss.Key.IsCriticalValue == null ? 'N' : ss.Key.IsCriticalValue.Value,
// IsReview = ss.Key.IsReview == null ? 'N' : ss.Key.IsReview.Value
// }).ToList(),
// AbnormalItemDetail = s.Where(m => m.registerCheckItem.IsCriticalValue != null).GroupBy(g => g.registerCheckItem).Select(ss => new PhoneFollowUpWithCriticalItemAbnormalItemDto
// {
// CriticalValueContent = ss.Key.CriticalValueContent,
// 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(),
// CriticalValueContents = string.Join("<br>", s.Where(m => !string.IsNullOrWhiteSpace(m.registerCheck.CriticalValueContent)).Select(ss => ss.registerCheck.CriticalValueContent).Distinct()) + "<br>" + string.Join("<br>", s.Where(m => !string.IsNullOrWhiteSpace(m.registerCheckItem.CriticalValueContent)).Select(ss => ss.registerCheckItem.CriticalValueContent).Distinct()),
// IsPhoneComplete = s.Key.IsPhoneComplete,
// IsSmsComplete = s.Key.IsSmsComplete,
// DiagnosisLevelNames = string.Join("<br>", s.Where(m => m.registerCheck.DiagnosisLevelId != null).Select(ss => _cacheService.GetDiagnosisLevelNameAsync(ss.registerCheck.DiagnosisLevelId).GetAwaiter().GetResult()).Distinct()) + "<br>" + string.Join("<br>", s.Where(m => m.registerCheckItem.DiagnosisLevelId != null).Select(ss => _cacheService.GetDiagnosisLevelNameAsync(ss.registerCheckItem.DiagnosisLevelId).GetAwaiter().GetResult()).Distinct())
// }).ToList();
// foreach (var item in entListDto)
// {
// if (item.CriticalValueContents.StartsWith("<br>"))
// {
// item.CriticalValueContents = item.CriticalValueContents.Substring("<br>".Length);
// }
// }
// return entListDto;
// //var query = from phoneFollowUp in await _phoneFollowUpRepository.GetQueryableAsync()
// // join followUp in await _followUpRepository.GetQueryableAsync() on phoneFollowUp.FollowUpId equals followUp.Id
// // join patientRegister in await _patientRegisterRepository.GetQueryableAsync() on followUp.PatientRegisterId equals patientRegister.Id
// // orderby patientRegister.Id, phoneFollowUp.PlanFollowDate
// // select new
// // {
// // patientName = patientRegister.PatientName,
// // phoneFollowUp
// // };
// //if (input.FollowUpId != null)
// //{
// // query = query.Where(m => m.phoneFollowUp.FollowUpId == input.FollowUpId);
// //}
// //if (!string.IsNullOrWhiteSpace(input.KeyWord))
// //{
// // query = query.Where(m => (!string.IsNullOrWhiteSpace(m.phoneFollowUp.FollowUpContent) && m.phoneFollowUp.FollowUpContent.Contains(input.KeyWord))
// // || (!string.IsNullOrWhiteSpace(m.phoneFollowUp.ReplyContent) && m.phoneFollowUp.ReplyContent.Contains(input.KeyWord))
// // );
// //}
// //if (input.IsComplete != null)
// //{
// // query = query.Where(m => m.phoneFollowUp.IsComplete == input.IsComplete);
// //}
// //if (!string.IsNullOrWhiteSpace(input.StartDate) && !string.IsNullOrWhiteSpace(input.EndDate))
// //{
// // query = query.Where(m => m.phoneFollowUp.PlanFollowDate >= Convert.ToDateTime(input.StartDate)
// // && m.phoneFollowUp.PlanFollowDate <= Convert.ToDateTime(input.EndDate).AddDays(1));
// //}
// //var entListDto = query.ToList().Select(s => new PhoneFollowUpWithPatientRegisterDto
// //{
// // FollowUpId = s.phoneFollowUp.FollowUpId,
// // CreationTime = s.phoneFollowUp.CreationTime,
// // ReplyContent = s.phoneFollowUp.ReplyContent,
// // PlanFollowDate = DataHelper.ConversionDateToString(s.phoneFollowUp.PlanFollowDate),
// // CreatorId = s.phoneFollowUp.CreatorId,
// // FollowUpContent = s.phoneFollowUp.ReplyContent,
// // Id = s.phoneFollowUp.Id,
// // IsComplete = s.phoneFollowUp.IsComplete,
// // LastModificationTime = s.phoneFollowUp.LastModificationTime,
// // LastModifierId = s.phoneFollowUp.LastModifierId,
// // CreatorName = _cacheService.GetSurnameAsync(s.phoneFollowUp.CreatorId).GetAwaiter().GetResult(),
// // LastModifierName = _cacheService.GetSurnameAsync(s.phoneFollowUp.LastModifierId).GetAwaiter().GetResult(),
// // PatientName = s.patientName
// //}).ToList();
// //return entListDto;
//}
/// <summary>
/// 获取所有危急值列表
/// 获取所有危急值列表 增加导出报告用子项目
/// </summary>
/// <returns></returns>
[HttpPost("api/app/PhoneFollowUp/GetPatientRegisterCriticalList")]
@ -167,6 +413,8 @@ namespace Shentun.Peis.PhoneFollowUps
join item in await _itemRepository.GetQueryableAsync() on registerCheckItem.ItemId equals item.Id
join phoneFollowUp in await _phoneFollowUpRepository.GetQueryableAsync() on followUp.Id equals phoneFollowUp.FollowUpId into phoneFollowUpTemp
from phoneFollowUpEmpty in phoneFollowUpTemp.DefaultIfEmpty()
join smsSend in await _smsSendRepository.GetQueryableAsync() on followUp.Id equals smsSend.FollowUpId into smsSendTemp
from smsSendEmpty in smsSendTemp.DefaultIfEmpty()
select new
{
patientRegister,
@ -176,6 +424,7 @@ namespace Shentun.Peis.PhoneFollowUps
item,
followUp,
phoneFollowUpEmpty,
smsSendEmpty,
patient
};
@ -269,62 +518,92 @@ namespace Shentun.Peis.PhoneFollowUps
List<PhoneFollowUpWithCriticalItemDto> entListDto = new List<PhoneFollowUpWithCriticalItemDto>();
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,
PatientRegisterId = s.FirstOrDefault().patientRegister.Id,
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).OrderBy(o => o.Key.PlanFollowDate).Select(ss => new PhoneFollowUpSimpleDto
foreach (var itemGroup in followUpGroup)
{
var firstItem = itemGroup.FirstOrDefault();
var temoDto = new PhoneFollowUpWithCriticalItemDto
{
FollowUpContent = ss.Key.FollowUpContent,
IsComplete = ss.Key.IsComplete,
PlanFollowDate = DataHelper.ConversionDateToString(ss.Key.PlanFollowDate),
ReplyContent = ss.Key.ReplyContent
}).ToList(),
AbnormalAsbitemDetail = s.Where(m => m.registerCheck.IsCriticalValue != null).GroupBy(g => g.registerCheck).Select(ss => new PhoneFollowUpWithCriticalItemAbnormalAsbitemDto
FollowUpId = itemGroup.Key.Id,
PatientName = firstItem.patientRegister.PatientName,
IdNo = firstItem.patient.IdNo,
PatientRegisterNo = firstItem.patientRegister.PatientRegisterNo,
PatientRegisterId = firstItem.patientRegister.Id,
Age = firstItem.patientRegister.Age,
BirthDate = DataHelper.ConversionDateShortToString(firstItem.patientRegister.BirthDate),
CompleteFlag = firstItem.patientRegister.CompleteFlag,
CustomerOrgName = _cacheService.GetCustomerOrgNameAsync(firstItem.patientRegister.CustomerOrgId).GetAwaiter().GetResult(),
CustomerOrgParentName = _cacheService.GetTopCustomerOrgNameAsync(firstItem.patientRegister.CustomerOrgId).GetAwaiter().GetResult(),
IsMedicalStart = firstItem.patientRegister.IsMedicalStart,
IsUpload = firstItem.patientRegister.IsUpload,
JobCardNo = firstItem.patientRegister.JobCardNo,
JobPost = firstItem.patientRegister.JobPost,
JobTitle = firstItem.patientRegister.JobTitle,
MaritalStatusName = _cacheService.GetMaritalStatusNameAsync(firstItem.patientRegister.MaritalStatusId).GetAwaiter().GetResult(),
MedicalCardNo = firstItem.patientRegister.MedicalCardNo,
MedicalStartDate = DataHelper.ConversionDateShortToString(firstItem.patientRegister.MedicalStartDate),
MedicalTimes = firstItem.patientRegister.MedicalTimes,
MedicalTypeName = _cacheService.GetMedicalTypeNameAsync(firstItem.patientRegister.MedicalTypeId).GetAwaiter().GetResult(),
MobileTelephone = firstItem.patient.MobileTelephone,
NationName = _cacheService.GetNationNameAsync(firstItem.patient.NationId).GetAwaiter().GetResult(),
PatientNo = firstItem.patient.PatientNo,
PersonnelTypeName = _cacheService.GetPersonnelTypeNameAsync(firstItem.patientRegister.PersonnelTypeId).GetAwaiter().GetResult(),
SexName = _cacheService.GetSexNameAsync(firstItem.patientRegister.SexId).GetAwaiter().GetResult(),
Telephone = firstItem.patient.Telephone,
CriticalValueContents = string.Join("<br>", itemGroup.Where(m => !string.IsNullOrWhiteSpace(m.registerCheck.CriticalValueContent)).Select(ss => ss.registerCheck.CriticalValueContent).Distinct()) + "<br>" + string.Join("<br>", itemGroup.Where(m => !string.IsNullOrWhiteSpace(m.registerCheckItem.CriticalValueContent)).Select(ss => ss.registerCheckItem.CriticalValueContent).Distinct()),
IsPhoneComplete = itemGroup.Key.IsPhoneComplete,
IsSmsComplete = itemGroup.Key.IsSmsComplete,
DiagnosisLevelNames = string.Join("<br>", itemGroup.Where(m => m.registerCheck.DiagnosisLevelId != null).Select(ss => _cacheService.GetDiagnosisLevelNameAsync(ss.registerCheck.DiagnosisLevelId).GetAwaiter().GetResult()).Distinct()) + "<br>" + string.Join("<br>", itemGroup.Where(m => m.registerCheckItem.DiagnosisLevelId != null).Select(ss => _cacheService.GetDiagnosisLevelNameAsync(ss.registerCheckItem.DiagnosisLevelId).GetAwaiter().GetResult()).Distinct())
};
var phoneFollowUpWithPatientRegisterDetail = itemGroup.Where(m => m.phoneFollowUpEmpty != null).Select(s => new PhoneFollowUpWithPatientRegisterDto
{
CriticalValueContent = ss.Key.CriticalValueContent,
AsbitemName = string.Join(",", ss.Select(sss => sss.asbitem.DisplayName).Distinct()),
IsCriticalValue = ss.Key.IsCriticalValue == null ? 'N' : ss.Key.IsCriticalValue.Value,
IsReview = ss.Key.IsReview == null ? 'N' : ss.Key.IsReview.Value
}).ToList(),
AbnormalItemDetail = s.Where(m => m.registerCheckItem.IsCriticalValue != null).GroupBy(g => g.registerCheckItem).Select(ss => new PhoneFollowUpWithCriticalItemAbnormalItemDto
FollowUpId = s.phoneFollowUpEmpty.FollowUpId,
CreationTime = s.phoneFollowUpEmpty.CreationTime,
ReplyContent = s.phoneFollowUpEmpty.ReplyContent,
PlanFollowDate = DataHelper.ConversionDateToString(s.phoneFollowUpEmpty.PlanFollowDate),
CreatorId = s.phoneFollowUpEmpty.CreatorId,
FollowUpContent = s.phoneFollowUpEmpty.FollowUpContent,
Id = s.phoneFollowUpEmpty.Id,
IsComplete = s.phoneFollowUpEmpty.IsComplete,
LastModificationTime = s.phoneFollowUpEmpty.LastModificationTime,
LastModifierId = s.phoneFollowUpEmpty.LastModifierId,
CreatorName = _cacheService.GetSurnameAsync(s.phoneFollowUpEmpty.CreatorId).GetAwaiter().GetResult(),
LastModifierName = _cacheService.GetSurnameAsync(s.phoneFollowUpEmpty.LastModifierId).GetAwaiter().GetResult(),
PatientName = firstItem.patientRegister.PatientName
}).ToList();
var smsSendDetail = itemGroup.Where(m => m.smsSendEmpty != null).Select(s => new SmsSendDto
{
CriticalValueContent = ss.Key.CriticalValueContent,
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(),
CriticalValueContents = string.Join("<br>", s.Where(m => !string.IsNullOrWhiteSpace(m.registerCheck.CriticalValueContent)).Select(ss => ss.registerCheck.CriticalValueContent).Distinct()) + "<br>" + string.Join("<br>", s.Where(m => !string.IsNullOrWhiteSpace(m.registerCheckItem.CriticalValueContent)).Select(ss => ss.registerCheckItem.CriticalValueContent).Distinct()),
IsPhoneComplete = s.Key.IsPhoneComplete,
IsSmsComplete = s.Key.IsSmsComplete,
DiagnosisLevelNames = string.Join("<br>", s.Where(m => m.registerCheck.DiagnosisLevelId != null).Select(ss => _cacheService.GetDiagnosisLevelNameAsync(ss.registerCheck.DiagnosisLevelId).GetAwaiter().GetResult()).Distinct()) + "<br>" + string.Join("<br>", s.Where(m => m.registerCheckItem.DiagnosisLevelId != null).Select(ss => _cacheService.GetDiagnosisLevelNameAsync(ss.registerCheckItem.DiagnosisLevelId).GetAwaiter().GetResult()).Distinct())
}).ToList();
FollowUpId = s.smsSendEmpty.FollowUpId,
CreationTime = s.smsSendEmpty.CreationTime,
CreatorId = s.smsSendEmpty.CreatorId,
Id = s.smsSendEmpty.Id,
IsComplete = s.smsSendEmpty.IsComplete,
LastModificationTime = s.smsSendEmpty.LastModificationTime,
LastModifierId = s.smsSendEmpty.LastModifierId,
CreatorName = _cacheService.GetSurnameAsync(s.smsSendEmpty.CreatorId).GetAwaiter().GetResult(),
LastModifierName = _cacheService.GetSurnameAsync(s.smsSendEmpty.LastModifierId).GetAwaiter().GetResult(),
PatientName = s.smsSendEmpty.PatientName,
Content = s.smsSendEmpty.Content,
MobileTelephone = s.smsSendEmpty.MobileTelephone,
PlanSendDate = DataHelper.ConversionDateToString(s.smsSendEmpty.PlanSendDate),
PatientId = s.smsSendEmpty.PatientId,
SmsTypeId = s.smsSendEmpty.SmsTypeId
}).ToList();
temoDto.PhoneFollowUpWithPatientRegisterDetail = phoneFollowUpWithPatientRegisterDetail;
temoDto.SmsSendDetail = smsSendDetail;
}
foreach (var item in entListDto)
{
@ -390,6 +669,7 @@ namespace Shentun.Peis.PhoneFollowUps
}
/// <summary>
/// 获取项目危急值内容
/// </summary>

Loading…
Cancel
Save