diff --git a/src/Shentun.Peis.Application.Contracts/PhoneFollowUps/GetAsbitemOrItemCriticalByPatientRegisterIdDto.cs b/src/Shentun.Peis.Application.Contracts/PhoneFollowUps/GetAsbitemOrItemCriticalByPatientRegisterIdDto.cs new file mode 100644 index 0000000..4a09a22 --- /dev/null +++ b/src/Shentun.Peis.Application.Contracts/PhoneFollowUps/GetAsbitemOrItemCriticalByPatientRegisterIdDto.cs @@ -0,0 +1,118 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations.Schema; +using System.ComponentModel.DataAnnotations; +using System.Text; + +namespace Shentun.Peis.PhoneFollowUps +{ + public class GetAsbitemOrItemCriticalByPatientRegisterIdDto + { + /// + /// 组合项目名称 + /// + public string AsbitemName { get; set; } + + /// + /// 小结 多个拼合成内容 + /// + public string SummaryDetail { get; set; } + + + /// + /// 危急值范围 + /// + public string CriticalRangeValue { get; set; } + + /// + /// 危急值标志 + /// + public char? IsCriticalValue { get; set; } + + /// + /// 危急值处理内容 + /// + public string CriticalValueContent { get; set; } + + + /// + /// 危急值是否审核 Y-N + /// + public char? IsCriticalValueAudit { get; set; } + + + /// + /// 该项目要否要复查 Y-N + /// + public char? IsReview { get; set; } + + + /// + /// 随访标志 Y-N + /// + public char? IsFollowUp { get; set; } + + + /// + /// 项目明细数据 + /// + public List ItemDetails { get; set; } + + } + + public class GetAsbitemOrItemCriticalByPatientRegisterIdItemDetail + { + /// + /// 项目名称 + /// + public string ItemName { get; set; } + + /// + /// 项目结果 + /// + public string ItemResult { get; set; } + + /// + /// 单位 + /// + public string Unit { get; set; } + + /// + /// 参考范围 + /// + public string ReferenceRangeValue { get; set; } + + /// + /// 危急值范围 + /// + public string CriticalRangeValue { get; set; } + + /// + /// 危急值标志 + /// + public char? IsCriticalValue { get; set; } + + /// + /// 危急值处理内容 + /// + public string CriticalValueContent { get; set; } + + + /// + /// 危急值是否审核 Y-N + /// + public char? IsCriticalValueAudit { get; set; } + + + /// + /// 该项目要否要复查 Y-N + /// + public char? IsReview { get; set; } + + + /// + /// 随访标志 Y-N + /// + public char? IsFollowUp { get; set; } + } +} diff --git a/src/Shentun.Peis.Application/OccupationalDiseaseReports/OccupationalDiseaseReportAppService.cs b/src/Shentun.Peis.Application/OccupationalDiseaseReports/OccupationalDiseaseReportAppService.cs index f6508a0..f8a6400 100644 --- a/src/Shentun.Peis.Application/OccupationalDiseaseReports/OccupationalDiseaseReportAppService.cs +++ b/src/Shentun.Peis.Application/OccupationalDiseaseReports/OccupationalDiseaseReportAppService.cs @@ -362,7 +362,7 @@ namespace Shentun.Peis.OccupationalDiseaseReports #endregion - var ddd = query.ToQueryString(); + //var ddd = query.ToQueryString(); //var noCheckPatientRegisterList = query.ToList(); //var sumCount = noCheckPatientRegisterList.GroupBy(g => g.patientRegister).Count(); //总人数 diff --git a/src/Shentun.Peis.Application/PhoneFollowUps/PhoneFollowUpAppService.cs b/src/Shentun.Peis.Application/PhoneFollowUps/PhoneFollowUpAppService.cs index 96110a1..37c804f 100644 --- a/src/Shentun.Peis.Application/PhoneFollowUps/PhoneFollowUpAppService.cs +++ b/src/Shentun.Peis.Application/PhoneFollowUps/PhoneFollowUpAppService.cs @@ -6,6 +6,7 @@ using Shentun.Peis.CriticalFollowValues; using Shentun.Peis.CustomerOrgs; using Shentun.Peis.Enums; using Shentun.Peis.Models; +using Shentun.Peis.PatientRegisters; using SqlSugar; using System; using System.Collections.Generic; @@ -37,6 +38,7 @@ namespace Shentun.Peis.PhoneFollowUps private readonly IRepository _itemRepository; private readonly IRepository _patientRepository; private readonly CustomerOrgManager _customerOrgManager; + private readonly IRepository _registerCheckSummaryRepository; public PhoneFollowUpAppService( IRepository phoneFollowUpRepository, @@ -49,7 +51,8 @@ namespace Shentun.Peis.PhoneFollowUps IRepository asbitemRepository, IRepository itemRepository, IRepository patientRepository, - CustomerOrgManager customerOrgManager) + CustomerOrgManager customerOrgManager, + IRepository registerCheckSummaryRepository) { _phoneFollowUpRepository = phoneFollowUpRepository; _cacheService = cacheService; @@ -62,6 +65,7 @@ namespace Shentun.Peis.PhoneFollowUps _itemRepository = itemRepository; _patientRepository = patientRepository; _customerOrgManager = customerOrgManager; + _registerCheckSummaryRepository = registerCheckSummaryRepository; } @@ -354,6 +358,76 @@ namespace Shentun.Peis.PhoneFollowUps //return entListDto; } + + /// + /// 获取项目危急值内容 + /// + /// + [HttpPost("api/app/PhoneFollowUp/GetAsbitemOrItemCriticalByPatientRegisterId")] + public async Task> GetAsbitemOrItemCriticalByPatientRegisterIdAsync(PatientRegisterIdInputDto input) + { + var query = from patientRegister in await _patientRegisterRepository.GetQueryableAsync() + 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 registerCheckSummary in await _registerCheckSummaryRepository.GetQueryableAsync() on registerCheck.Id equals registerCheckSummary.RegisterCheckId into registerCheckSummaryTemp + from registerCheckSummaryHaveEmpty in registerCheckSummaryTemp.DefaultIfEmpty() + select new + { + patientRegister, + registerCheck, + asbitem, + registerCheckItem, + item, + registerCheckSummaryHaveEmpty + }; + + if (input.PatientRegisterId == Guid.Empty) + { + throw new UserFriendlyException("人员ID格式不正确"); + } + + query = query.Where(m => m.patientRegister.Id == input.PatientRegisterId); + + + + + var registerCheckGroup = query.ToList().GroupBy(g => g.registerCheck); + + var entListDto = registerCheckGroup.Select(s => new GetAsbitemOrItemCriticalByPatientRegisterIdDto + { + AsbitemName = string.Join(",", s.Select(ss => ss.asbitem.DisplayName).Distinct()), + CriticalRangeValue = s.Key.CriticalRangeValue, + CriticalValueContent = s.Key.CriticalValueContent, + IsCriticalValue = s.Key.IsCriticalValue, + IsCriticalValueAudit = s.Key.IsCriticalValueAudit, + IsFollowUp = s.Key.IsFollowUp, + IsReview = s.Key.IsReview, + SummaryDetail = string.Join("
", s.Where(m => m.registerCheckSummaryHaveEmpty != null).Select(ss => ss.registerCheckSummaryHaveEmpty.Summary).Distinct()), + ItemDetails = s.GroupBy(g => g.registerCheckItem).ToList() + .Select(ss => new GetAsbitemOrItemCriticalByPatientRegisterIdItemDetail + { + CriticalRangeValue = ss.Key.CriticalRangeValue, + CriticalValueContent = ss.Key.CriticalValueContent, + IsCriticalValue = ss.Key.IsCriticalValue, + IsCriticalValueAudit = ss.Key.IsCriticalValueAudit, + IsFollowUp = ss.Key.IsFollowUp, + IsReview = ss.Key.IsReview, + ItemName = ss.FirstOrDefault().item.DisplayName, + ItemResult = ss.Key.Result, + ReferenceRangeValue = ss.Key.ReferenceRangeValue, + Unit = ss.Key.Unit + }).ToList() + }).ToList(); + + return entListDto; + + + } + + /// /// 自动生成电话随访记录 ///