diff --git a/src/Shentun.Peis.Application.Contracts/Diagnosises/DiagnosisInSuggestionDto.cs b/src/Shentun.Peis.Application.Contracts/Diagnosises/DiagnosisInSuggestionDto.cs index aaa9627..48b0809 100644 --- a/src/Shentun.Peis.Application.Contracts/Diagnosises/DiagnosisInSuggestionDto.cs +++ b/src/Shentun.Peis.Application.Contracts/Diagnosises/DiagnosisInSuggestionDto.cs @@ -11,6 +11,11 @@ namespace Shentun.Peis.Diagnosises /// 医学解释 /// public List MedicalInterpretations { get; set; } + /// + /// 常见原因 + /// + + public List CommonReasons { get; set; } /// /// 健康指导 diff --git a/src/Shentun.Peis.Application.Contracts/PatientRegisters/PatientRegisterIdInputDto.cs b/src/Shentun.Peis.Application.Contracts/PatientRegisters/PatientRegisterIdInputDto.cs new file mode 100644 index 0000000..c5411ea --- /dev/null +++ b/src/Shentun.Peis.Application.Contracts/PatientRegisters/PatientRegisterIdInputDto.cs @@ -0,0 +1,11 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace Shentun.Peis.PatientRegisters +{ + public class PatientRegisterIdInputDto + { + public Guid PatientRegisterId { get; set; } + } +} diff --git a/src/Shentun.Peis.Application.Contracts/PatientRegisters/PatientRegisterSumInputDto.cs b/src/Shentun.Peis.Application.Contracts/PatientRegisters/PatientRegisterSumInputDto.cs new file mode 100644 index 0000000..1d3ce96 --- /dev/null +++ b/src/Shentun.Peis.Application.Contracts/PatientRegisters/PatientRegisterSumInputDto.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace Shentun.Peis.PatientRegisters +{ + public class PatientRegisterSumInputDto + { + public Guid PatientRegisterId { get; set; } + public string IsGetExistData { get; set; } + } +} diff --git a/src/Shentun.Peis.Application.Contracts/PatientRegisters/UpdatePatientRegisterSummarySuggestionDto.cs b/src/Shentun.Peis.Application.Contracts/PatientRegisters/UpdatePatientRegisterSummarySuggestionDto.cs index bf36858..fbb9f53 100644 --- a/src/Shentun.Peis.Application.Contracts/PatientRegisters/UpdatePatientRegisterSummarySuggestionDto.cs +++ b/src/Shentun.Peis.Application.Contracts/PatientRegisters/UpdatePatientRegisterSummarySuggestionDto.cs @@ -56,6 +56,10 @@ namespace Shentun.Peis.PatientRegisters public List DiagnosisIds { get; set; } public List Details { get; set; } + public List MedicalInterpretations { get; set; } + public List CommonReasons { get; set; } + public List HealthGuidances { get; set; } + } public class UpdateSumSuggestionContentDto diff --git a/src/Shentun.Peis.Application/Diagnosises/DiagnosisAppService.cs b/src/Shentun.Peis.Application/Diagnosises/DiagnosisAppService.cs index ed10c39..20c2c3a 100644 --- a/src/Shentun.Peis.Application/Diagnosises/DiagnosisAppService.cs +++ b/src/Shentun.Peis.Application/Diagnosises/DiagnosisAppService.cs @@ -140,7 +140,8 @@ namespace Shentun.Peis.Diagnosises IsSummaryTemplate = s.FirstOrDefault().a.IsSummaryTemplate, ItemTypeId = s.FirstOrDefault().a.ItemTypeId, SuggestionName = s.FirstOrDefault().a.SuggestionName, - HealthGuidances = s.Where(m => m.ab != null && m.ab.SuggestionType == SuggestionTypeFlag.HealthGuidance).Select(ss => new SuggestionDto + + MedicalInterpretations = s.Where(m => m.ab != null && m.ab.SuggestionType == SuggestionTypeFlag.MedicalInterpretation).Select(ss => new SuggestionDto { CreationTime = ss.ab.CreationTime, CreatorId = ss.ab.CreatorId, @@ -154,7 +155,21 @@ namespace Shentun.Peis.Diagnosises SuggestionContent = ss.ab.SuggestionContent }).OrderBy(o => o.DisplayOrder).ToList(), - MedicalInterpretations = s.Where(m => m.ab != null && m.ab.SuggestionType == SuggestionTypeFlag.MedicalInterpretation).Select(ss => new SuggestionDto + CommonReasons = s.Where(m => m.ab != null && m.ab.SuggestionType == SuggestionTypeFlag.CommonReasons).Select(ss => new SuggestionDto + { + CreationTime = ss.ab.CreationTime, + CreatorId = ss.ab.CreatorId, + CreatorName = s.FirstOrDefault().ae != null ? s.FirstOrDefault().ae.UserName : "", + LastModifierName = s.FirstOrDefault().af != null ? s.FirstOrDefault().af.UserName : "", + DiagnosisId = ss.ab.DiagnosisId, + DisplayOrder = ss.ab.DisplayOrder, + Id = ss.ab.Id, + LastModificationTime = ss.ab.LastModificationTime, + LastModifierId = ss.ab.LastModifierId, + SuggestionContent = ss.ab.SuggestionContent + + }).OrderBy(o => o.DisplayOrder).ToList(), + HealthGuidances = s.Where(m => m.ab != null && m.ab.SuggestionType == SuggestionTypeFlag.HealthGuidance).Select(ss => new SuggestionDto { CreationTime = ss.ab.CreationTime, CreatorId = ss.ab.CreatorId, diff --git a/src/Shentun.Peis.Application/PatientRegisters/PatientRegisterAppService.cs b/src/Shentun.Peis.Application/PatientRegisters/PatientRegisterAppService.cs index 16bf4d6..61bc71e 100644 --- a/src/Shentun.Peis.Application/PatientRegisters/PatientRegisterAppService.cs +++ b/src/Shentun.Peis.Application/PatientRegisters/PatientRegisterAppService.cs @@ -22,6 +22,7 @@ using Shentun.Peis.SumSuggestionContents; using Shentun.Peis.SumSuggestionHeaders; using Shentun.Peis.SumSummaryContents; using Shentun.Peis.SumSummaryHeaders; +using Shentun.Peis.SumSummaryReports; using Shentun.Utilities; using System; using System.Collections.Generic; @@ -289,7 +290,26 @@ namespace Shentun.Peis.PatientRegisters return entdto; } - + /// + /// 获取是否总检过 + /// + /// + /// + [HttpPost("api/app/patientregister/GetHaveSumData")] + public async Task GetHaveSumData(PatientRegisterIdInputDto input) + { + var sumSummaryHeader = await _sumSummaryHeaderRepository.GetListAsync(o => o.PatientRegisterId == input.PatientRegisterId); + if(sumSummaryHeader.Any()) + { + return "Y"; + } + var sumSuggestionHeader = await _sumSuggestionHeaderRepository.GetListAsync(o => o.PatientRegisterId == input.PatientRegisterId); + if (sumSuggestionHeader.Any()) + { + return "Y"; + } + return "N"; + } /// /// 获取列表 人员体检 /// @@ -1546,15 +1566,33 @@ namespace Shentun.Peis.PatientRegisters #region 插入SumSuggestionContent List sumSuggestionContentList = new List(); - foreach (var item2 in item.Details) + foreach (var item2 in item.MedicalInterpretations) + { + SumSuggestionContent sumSuggestionContentEnt = _sumSuggestionContentManager.CreateAsync(sumSuggestionHeaderId: sumSuggestionHeaderEnt_New.Id, + suggestionContent: item2.SuggestionContent, + suggestionType: SuggestionTypeFlag.MedicalInterpretation, + displayOrder: item.MedicalInterpretations.IndexOf(item2) + 1); + + sumSuggestionContentList.Add(sumSuggestionContentEnt); + } + foreach (var item2 in item.CommonReasons) { SumSuggestionContent sumSuggestionContentEnt = _sumSuggestionContentManager.CreateAsync(sumSuggestionHeaderId: sumSuggestionHeaderEnt_New.Id, suggestionContent: item2.SuggestionContent, - displayOrder: item.Details.IndexOf(item2) + 1); + suggestionType: SuggestionTypeFlag.CommonReasons, + displayOrder: item.CommonReasons.IndexOf(item2) + 1); sumSuggestionContentList.Add(sumSuggestionContentEnt); } + foreach (var item2 in item.HealthGuidances) + { + SumSuggestionContent sumSuggestionContentEnt = _sumSuggestionContentManager.CreateAsync(sumSuggestionHeaderId: sumSuggestionHeaderEnt_New.Id, + suggestionContent: item2.SuggestionContent, + suggestionType: SuggestionTypeFlag.HealthGuidance, + displayOrder: item.HealthGuidances.IndexOf(item2) + 1); + sumSuggestionContentList.Add(sumSuggestionContentEnt); + } await _sumSuggestionContentRepository.InsertManyAsync(sumSuggestionContentList); #endregion } diff --git a/src/Shentun.Peis.Application/RegisterChecks/RegisterCheckAppService.cs b/src/Shentun.Peis.Application/RegisterChecks/RegisterCheckAppService.cs index d429492..17d6468 100644 --- a/src/Shentun.Peis.Application/RegisterChecks/RegisterCheckAppService.cs +++ b/src/Shentun.Peis.Application/RegisterChecks/RegisterCheckAppService.cs @@ -121,7 +121,7 @@ namespace Shentun.Peis.RegisterChecks var entlist = (await _registerCheckRepository.GetDbSetAsync()) .Include(x => x.RegisterCheckAsbitems) - .ThenInclude(x => x.Asbitem) + .ThenInclude(x => x.Asbitem).ThenInclude(x=>x.ItemType) .Where(m => m.RegisterCheckAsbitems.Select(s => s.PatientRegisterId).Contains(PatientRegisterId)).ToList(); //排序 entlist = entlist.OrderBy(o=>o.RegisterCheckAsbitems.Max(o=>o.Asbitem.ItemType.DisplayOrder)).ToList() diff --git a/src/Shentun.Peis.Application/SumSuggestionHeaders/SumSuggestionHeaderAppService.cs b/src/Shentun.Peis.Application/SumSuggestionHeaders/SumSuggestionHeaderAppService.cs index e2932c5..1c69deb 100644 --- a/src/Shentun.Peis.Application/SumSuggestionHeaders/SumSuggestionHeaderAppService.cs +++ b/src/Shentun.Peis.Application/SumSuggestionHeaders/SumSuggestionHeaderAppService.cs @@ -3,6 +3,7 @@ using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; using Shentun.Peis.Enums; using Shentun.Peis.Models; +using Shentun.Peis.PatientRegisters; using Shentun.Peis.SumSuggestionContents; using Shentun.Peis.SumSummaryContents; using Shentun.Peis.SumSummaryHeaders; @@ -54,15 +55,19 @@ namespace Shentun.Peis.SumSuggestionHeaders /// /// 获取人员总检诊台建议 (如还未录入,获取医生诊台录入的建议) /// - /// 人员登记ID + /// /// - [HttpGet("api/app/sumsuggestionheader/getsumsuggestionlist")] - public async Task> GetSumSuggestionListAsync(Guid patientRegisterId) + [HttpPost("api/app/sumsuggestionheader/getsumsuggestionlist")] + public async Task> GetSumSuggestionListAsync(PatientRegisterSumInputDto input) { + if (input is null) + { + throw new UserFriendlyException("input参数不能为空"); + } List msg = new List(); - var patientRegister = await _patientRegisterRepository.GetAsync(patientRegisterId); + var patientRegister = await _patientRegisterRepository.GetAsync(input.PatientRegisterId); var query = from sumSuggestionHeader in await _sumSuggestionHeaderRepository.GetQueryableAsync() join sumDiagnosis in await _sumDiagnosisRepository.GetQueryableAsync() on new { sumSuggestionHeader.PatientRegisterId, sumSuggestionHeader.Id } equals new { sumDiagnosis.PatientRegisterId, Id = sumDiagnosis.SumSuggestionHeaderId } into bb @@ -70,7 +75,7 @@ namespace Shentun.Peis.SumSuggestionHeaders join sumSuggestionContent in await _sumSuggestionContentRepository.GetQueryableAsync() on sumSuggestionHeader.Id equals sumSuggestionContent.SumSuggestionHeaderId into cc from sumSuggestionContentHaveEmpty in cc.DefaultIfEmpty() - where (sumSuggestionHeader.PatientRegisterId == patientRegisterId) + where (sumSuggestionHeader.PatientRegisterId == input.PatientRegisterId) orderby sumSuggestionHeader.DisplayOrder ascending, sumSuggestionContentHaveEmpty.DisplayOrder ascending select new { @@ -80,7 +85,7 @@ namespace Shentun.Peis.SumSuggestionHeaders }; - if (patientRegister.CompleteFlag == PatientRegisterCompleteFlag.GeneralInspected) + if (patientRegister.CompleteFlag == PatientRegisterCompleteFlag.GeneralInspected || input.IsGetExistData == "Y") { msg = query.GroupBy(g => g.sumSuggestionHeader.Id).Select(s => new SumSuggestionDto { @@ -116,7 +121,7 @@ namespace Shentun.Peis.SumSuggestionHeaders else { //没有值的情况 - var checklist = await _sumSummaryHeaderManager.GetSumSummarysByDoctorCheck(patientRegisterId); + var checklist = await _sumSummaryHeaderManager.GetSumSummarysByDoctorCheck(input.PatientRegisterId); //获取所有综述 var registerCheckSummaries = new List(); foreach (var registerCheck in checklist) diff --git a/src/Shentun.Peis.Application/SumSummaryHeaders/SumSummaryHeaderAppService.cs b/src/Shentun.Peis.Application/SumSummaryHeaders/SumSummaryHeaderAppService.cs index 3488a9c..17eca63 100644 --- a/src/Shentun.Peis.Application/SumSummaryHeaders/SumSummaryHeaderAppService.cs +++ b/src/Shentun.Peis.Application/SumSummaryHeaders/SumSummaryHeaderAppService.cs @@ -3,6 +3,7 @@ using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; using Shentun.Peis.Enums; using Shentun.Peis.Models; +using Shentun.Peis.PatientRegisters; using Shentun.Peis.SumSummaryContents; using Shentun.Peis.SysParmValues; using System; @@ -54,19 +55,22 @@ namespace Shentun.Peis.SumSummaryHeaders /// /// 获取人员总检诊台小结 (如还未录入,获取医生诊台录入的小结) /// - /// 人员登记ID + /// /// - [HttpGet("api/app/sumsummaryheader/getsumsummarylist")] - public async Task> GetSumSummaryListAsync(Guid patientRegisterId) + [HttpPost("api/app/sumsummaryheader/getsumsummarylist")] + public async Task> GetSumSummaryListAsync(PatientRegisterSumInputDto input) { - + if(input is null) + { + throw new UserFriendlyException("input参数不能为空"); + } List msg = new List(); - var patientRegister = await _patientRegisterRepository.GetAsync(patientRegisterId); + var patientRegister = await _patientRegisterRepository.GetAsync(input.PatientRegisterId); var entlist = (await _sumSummaryHeaderRepository.GetDbSetAsync()) .Include(x => x.SumSummaryContents) - .Where(m => m.PatientRegisterId == patientRegisterId).OrderBy(o => o.DisplayOrder).ToList(); + .Where(m => m.PatientRegisterId == input.PatientRegisterId).OrderBy(o => o.DisplayOrder).ToList(); - if (patientRegister.CompleteFlag == PatientRegisterCompleteFlag.GeneralInspected) + if (patientRegister.CompleteFlag == PatientRegisterCompleteFlag.GeneralInspected || input.IsGetExistData == "Y") { //已总检取综述中的值 msg = entlist.Select(s => new SumSummaryHeaderOrContentDto @@ -87,7 +91,7 @@ namespace Shentun.Peis.SumSummaryHeaders else { //未总检 - var checklist = await _sumSummaryHeaderManager.GetSumSummarysByDoctorCheck(patientRegisterId); + var checklist = await _sumSummaryHeaderManager.GetSumSummarysByDoctorCheck(input.PatientRegisterId); if (checklist.Any() && checklist.Count(c => c.RegisterCheckSummaries.Count > 0) > 0) { @@ -96,7 +100,7 @@ namespace Shentun.Peis.SumSummaryHeaders Id = s.Id, SummaryTitle = string.Join(",", s.RegisterCheckAsbitems.Select(rs => rs.Asbitem.DisplayName).ToList()), SummaryFlag = null, - PatientRegisterId = s.RegisterCheckAsbitems.FirstOrDefault().PatientRegisterId, + PatientRegisterId = input.PatientRegisterId, DisplayOrder = 0, Details = s.RegisterCheckSummaries.OrderBy(o => o.DisplayOrder).Select(sa => new SumSummaryContentDto { @@ -105,6 +109,11 @@ namespace Shentun.Peis.SumSummaryHeaders SumSummaryHeaderId = sa.RegisterCheckId }).OrderBy(o => o.DisplayOrder).ToList() }).OrderBy(o => o.DisplayOrder).ToList(); + if(msg.Count == 1 && string.IsNullOrWhiteSpace(msg[0].SummaryTitle) && msg[0].Details.Count() == 1) + { + //默认综述 + msg[0].SummaryTitle = msg[0].Details[0].SummaryContent; + } } } return msg; diff --git a/src/Shentun.Peis.Domain/SumSuggestionContents/SumSuggestionContentManager.cs b/src/Shentun.Peis.Domain/SumSuggestionContents/SumSuggestionContentManager.cs index d694d9b..9ba1861 100644 --- a/src/Shentun.Peis.Domain/SumSuggestionContents/SumSuggestionContentManager.cs +++ b/src/Shentun.Peis.Domain/SumSuggestionContents/SumSuggestionContentManager.cs @@ -11,12 +11,13 @@ namespace Shentun.Peis.SumSuggestionContents public class SumSuggestionContentManager : DomainService { public SumSuggestionContent CreateAsync(Guid sumSuggestionHeaderId, - string suggestionContent, int displayOrder) + string suggestionContent,char suggestionType, int displayOrder) { var entity = new SumSuggestionContent(GuidGenerator.Create()) { SumSuggestionHeaderId = sumSuggestionHeaderId, SuggestionContent = suggestionContent, + SuggestionType = suggestionType, DisplayOrder = displayOrder }; diff --git a/src/Shentun.Peis.Domain/SumSummaryHeaders/SumSummaryHeaderManager.cs b/src/Shentun.Peis.Domain/SumSummaryHeaders/SumSummaryHeaderManager.cs index e75887e..2101ab3 100644 --- a/src/Shentun.Peis.Domain/SumSummaryHeaders/SumSummaryHeaderManager.cs +++ b/src/Shentun.Peis.Domain/SumSummaryHeaders/SumSummaryHeaderManager.cs @@ -40,9 +40,9 @@ namespace Shentun.Peis.SumSummaryHeaders GetSysParmValueInMedicalCenterId(patientRegister.MedicalCenterId, "summary_check_summay_contain_normal_result"); //默认综述 - var summaryCheckDefaultSummayContent = await _sysParmValueManager. + var summaryCheckDefaultSummayHeader = await _sysParmValueManager. GetSysParmValueInMedicalCenterId(patientRegister.MedicalCenterId, - "summary_check_default_summay_content"); + "summary_check_default_summay_header"); var checklist = (await _registerCheckRepository.GetDbSetAsync()) .Include(x => x.RegisterCheckAsbitems) .ThenInclude(x => x.Asbitem).ThenInclude(x=>x.ItemType) @@ -79,7 +79,7 @@ namespace Shentun.Peis.SumSummaryHeaders { new RegisterCheckSummary() { - Summary = summaryCheckDefaultSummayContent, + Summary = summaryCheckDefaultSummayHeader, } } }); diff --git a/test/Shentun.Peis.Application.Tests/PatientRegisterAppServiceTest.cs b/test/Shentun.Peis.Application.Tests/PatientRegisterAppServiceTest.cs index a7a9c13..5d7bdc2 100644 --- a/test/Shentun.Peis.Application.Tests/PatientRegisterAppServiceTest.cs +++ b/test/Shentun.Peis.Application.Tests/PatientRegisterAppServiceTest.cs @@ -557,18 +557,40 @@ namespace Shentun.Peis new Guid("3a0ecab2-ee3a-4b32-997b-5979a672cf62") }, SuggestionTitle = "ssss", - Details= new List() + MedicalInterpretations= new List() { new UpdateSumSuggestionContentDto() { - SuggestionContent = "ffff" + SuggestionContent = "mmm" }, new UpdateSumSuggestionContentDto() { - SuggestionContent = "gggg" + SuggestionContent = "mmm" } - } - + }, + CommonReasons = new List() + { + new UpdateSumSuggestionContentDto() + { + SuggestionContent = "ccc" + }, + new UpdateSumSuggestionContentDto() + { + SuggestionContent = "ccc" + } + }, + HealthGuidances = new List() + { + new UpdateSumSuggestionContentDto() + { + SuggestionContent = "hhh" + }, + new UpdateSumSuggestionContentDto() + { + SuggestionContent = "hhh" + } + }, + }, new UpdateSumSuggestionDto() { @@ -578,7 +600,29 @@ namespace Shentun.Peis new Guid("3a0ed8e0-6e1a-4b6a-55ec-a2e87ccdf6a9") }, SuggestionTitle = "ttt", - Details= new List() + MedicalInterpretations= new List() + { + new UpdateSumSuggestionContentDto() + { + SuggestionContent = "mmm" + }, + new UpdateSumSuggestionContentDto() + { + SuggestionContent = "mmm" + } + }, + CommonReasons = new List() + { + new UpdateSumSuggestionContentDto() + { + SuggestionContent = "ccc" + }, + new UpdateSumSuggestionContentDto() + { + SuggestionContent = "ccc" + } + }, + HealthGuidances = new List() { new UpdateSumSuggestionContentDto() { @@ -586,9 +630,9 @@ namespace Shentun.Peis }, new UpdateSumSuggestionContentDto() { - SuggestionContent = "kkk" + SuggestionContent = "hhh" } - } + }, } } diff --git a/test/Shentun.Peis.Application.Tests/SumSuggestionHeaderAppServiceTest.cs b/test/Shentun.Peis.Application.Tests/SumSuggestionHeaderAppServiceTest.cs index 0dca32d..9ef68aa 100644 --- a/test/Shentun.Peis.Application.Tests/SumSuggestionHeaderAppServiceTest.cs +++ b/test/Shentun.Peis.Application.Tests/SumSuggestionHeaderAppServiceTest.cs @@ -33,7 +33,8 @@ namespace Shentun.Peis using (var unitOfWork = _unitOfWorkManager.Begin(isTransactional: true)) { - var result = await _appService.GetSumSuggestionListAsync(new Guid("3a11ee70-02cb-c5e6-a087-79ecdd0356b6")); + var result = await _appService.GetSumSuggestionListAsync(new PatientRegisters.PatientRegisterSumInputDto() + { PatientRegisterId = new Guid("3a1051a8-933c-0f59-514f-837b6cf274d9") }); foreach (var item in result) { _output.WriteLine(item.SuggestionTitle); diff --git a/test/Shentun.Peis.Application.Tests/SumSummaryHeaderAppServiceTest.cs b/test/Shentun.Peis.Application.Tests/SumSummaryHeaderAppServiceTest.cs index a9fbb35..0319768 100644 --- a/test/Shentun.Peis.Application.Tests/SumSummaryHeaderAppServiceTest.cs +++ b/test/Shentun.Peis.Application.Tests/SumSummaryHeaderAppServiceTest.cs @@ -33,7 +33,10 @@ namespace Shentun.Peis using (var unitOfWork = _unitOfWorkManager.Begin(isTransactional: true)) { - var result = await _appService.GetSumSummaryListAsync(new Guid("3a11ee70-02cb-c5e6-a087-79ecdd0356b6")); + var result = await _appService.GetSumSummaryListAsync(new PatientRegisters.PatientRegisterSumInputDto() + { + PatientRegisterId = new Guid("3a1051a8-933c-0f59-514f-837b6cf274d9") + }); foreach (var item in result) { _output.WriteLine(item.SummaryTitle);