From 07dd78f4054f3ae38595d32dffb1443b2341df97 Mon Sep 17 00:00:00 2001 From: "DESKTOP-G961P6V\\Zhh" <839860190@qq.com> Date: Thu, 2 May 2024 19:28:30 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E6=80=BB=E6=A3=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../SumSummaryReportDetailResultDto.cs | 3 ++ .../SumSummaryReportAppService.cs | 37 +++++++++++-------- .../SumSummaryReportAppServiceTest.cs | 4 +- 3 files changed, 27 insertions(+), 17 deletions(-) diff --git a/src/Shentun.Peis.Application.Contracts/SumSummaryReports/SumSummaryReportDetailResultDto.cs b/src/Shentun.Peis.Application.Contracts/SumSummaryReports/SumSummaryReportDetailResultDto.cs index b8c0dd0..1297177 100644 --- a/src/Shentun.Peis.Application.Contracts/SumSummaryReports/SumSummaryReportDetailResultDto.cs +++ b/src/Shentun.Peis.Application.Contracts/SumSummaryReports/SumSummaryReportDetailResultDto.cs @@ -55,6 +55,9 @@ namespace Shentun.Peis.SumSummaryReports /// 检查小结列表 /// public List Summarys { get; set; } + + public int ItemTypeDisplayOrder { get; set; } + public int AsbitemDisplayOrder { get; set; } } /// diff --git a/src/Shentun.Peis.Application/SumSummaryReports/SumSummaryReportAppService.cs b/src/Shentun.Peis.Application/SumSummaryReports/SumSummaryReportAppService.cs index 871c22b..80bac1c 100644 --- a/src/Shentun.Peis.Application/SumSummaryReports/SumSummaryReportAppService.cs +++ b/src/Shentun.Peis.Application/SumSummaryReports/SumSummaryReportAppService.cs @@ -76,7 +76,7 @@ namespace Shentun.Peis.SumSummaryReports /// /// 人员登记ID /// - [HttpGet("api/app/SumSummaryReport/GetDetailResults")] + [HttpPost("api/app/SumSummaryReport/GetDetailResults")] public async Task> GetDetailResultsAsync(PatientRegisterIdInputDto input) { List msg = new List(); @@ -113,7 +113,7 @@ namespace Shentun.Peis.SumSummaryReports item, itemType - }).ToList(); + }).AsNoTracking().ToList(); if (!list.Any()) { @@ -160,7 +160,7 @@ namespace Shentun.Peis.SumSummaryReports var parentItemType = itemTypes.Where(o => o.Id == listItem.itemType.ParentId).FirstOrDefault(); if (parentItemType != null) { - listItem.asbitem.DisplayOrder = listItem.asbitem.ItemType.DisplayOrder * 1000 + listItem.asbitem.DisplayOrder; + listItem.asbitem.DisplayOrder = listItem.itemType.DisplayOrder * 1000 + listItem.asbitem.DisplayOrder; listItem.itemType.DisplayName = parentItemType.DisplayName; listItem.itemType.DisplayOrder = parentItemType.DisplayOrder; @@ -175,11 +175,14 @@ namespace Shentun.Peis.SumSummaryReports var listItem = list.Where(o => o.registerCheck.Id == registerCheckId).First(); var detailedResultsList_Asbitem = new SumSummaryReportDetailResultWithAsbitem() { + ItemTypeName = listItem.itemType.DisplayName, AsbitemName = string.Join(",", list.Where(o => o.registerCheck.Id == registerCheckId) .OrderBy(o => o.itemType.DisplayOrder).OrderBy(o => o.asbitem.DisplayOrder) .Select(o => o.asbitem.DisplayName).Distinct().ToList()), - CheckDate = (DateTime)listItem.registerCheck.CheckDate, + ItemTypeDisplayOrder = listItem.itemType.DisplayOrder, + AsbitemDisplayOrder = listItem.asbitem.DisplayOrder, + CheckDate = ((DateTime)listItem.registerCheck.CheckDate).Date, CheckDoctorName = EntityHelper.GetCheckDoctorName(listItem.registerCheck.CheckDoctorId, userlist), Items = list.Where(o => o.registerCheck.Id == registerCheckId) .OrderBy(o => o.itemType.DisplayOrder).OrderBy(o => o.asbitem.DisplayOrder).OrderBy(o => o.item.DisplayOrder) @@ -194,11 +197,11 @@ namespace Shentun.Peis.SumSummaryReports ResultStatusId = o.registerCheckItem.ResultStatusId, ResultStatusName = (resultStatus.Where(x => x.Id == o.registerCheckItem.ResultStatusId).FirstOrDefault() == null) ? "" : resultStatus.Where(x => x.Id == o.registerCheckItem.ResultStatusId).FirstOrDefault().ReportPrompt, ReportFontColor = (resultStatus.Where(x => x.Id == o.registerCheckItem.ResultStatusId).FirstOrDefault() == null) ? 0 : resultStatus.Where(x => x.Id == o.registerCheckItem.ResultStatusId).FirstOrDefault().ReportFontColor, - ReportBackgroundColor = (resultStatus.Where(x => x.Id == o.registerCheckItem.ResultStatusId).FirstOrDefault() == null) ? 16579836 : resultStatus.Where(x => x.Id == o.registerCheckItem.ResultStatusId).FirstOrDefault().ReportBackgroundColor, + ReportBackgroundColor = (resultStatus.Where(x => x.Id == o.registerCheckItem.ResultStatusId).FirstOrDefault() == null) ? 16777215 : resultStatus.Where(x => x.Id == o.registerCheckItem.ResultStatusId).FirstOrDefault().ReportBackgroundColor, }).Distinct().ToList(), Summarys = list.Where(o => o.registerCheck.Id == registerCheckId) .OrderBy(o=>o.registerCheckSummary.DisplayOrder) - .GroupBy(o=>o.registerCheckSummary) + .GroupBy(o=>o.registerCheckSummary.Summary) .Select(o=> new SumSummaryReportDetailResultWithSummary(){ Summary = o.FirstOrDefault().registerCheckSummary.Summary }) .ToList(), @@ -207,22 +210,24 @@ namespace Shentun.Peis.SumSummaryReports detailedResultsList_Asbitem.Summarys = detailedResultsList_Asbitem.Summarys.Distinct().ToList(); foreach (var registerCheckItem in detailedResultsList_Asbitem.Items) { - var historyRegisterCheckItems = histroyList.Select(o => new { o.registerCheckItem }) - .Where(o => o.registerCheckItem.ItemId == registerCheckItem.ItemId).Distinct().ToList(); + var historyRegisterCheckItems = histroyList.GroupBy(o=>o.registerCheckItem) + .Select(o => o.First().registerCheckItem ) + .Where(o => o.ItemId == registerCheckItem.ItemId) + .Distinct().ToList(); for (var i = 0; i < historyRegisterCheckItems.Count; i++) { if(i== 0) { - registerCheckItem.PreviousItemResult = historyRegisterCheckItems[i].registerCheckItem.Result; - registerCheckItem.PreviousReportFontColor = (resultStatus.Where(x => x.Id == historyRegisterCheckItems[i].registerCheckItem.ResultStatusId).FirstOrDefault() == null) ? 0 : resultStatus.Where(x => x.Id == historyRegisterCheckItems[i].registerCheckItem.ResultStatusId).FirstOrDefault().ReportFontColor; - registerCheckItem.PreviousReportBackgroundColor = (resultStatus.Where(x => x.Id == historyRegisterCheckItems[i].registerCheckItem.ResultStatusId).FirstOrDefault() == null) ? 0 : resultStatus.Where(x => x.Id == historyRegisterCheckItems[i].registerCheckItem.ResultStatusId).FirstOrDefault().ReportBackgroundColor; + registerCheckItem.PreviousItemResult = historyRegisterCheckItems[i].Result; + registerCheckItem.PreviousReportFontColor = (resultStatus.Where(x => x.Id == historyRegisterCheckItems[i].ResultStatusId).FirstOrDefault() == null) ? 0 : resultStatus.Where(x => x.Id == historyRegisterCheckItems[i].ResultStatusId).FirstOrDefault().ReportFontColor; + registerCheckItem.PreviousReportBackgroundColor = (resultStatus.Where(x => x.Id == historyRegisterCheckItems[i].ResultStatusId).FirstOrDefault() == null) ? 16777215 : resultStatus.Where(x => x.Id == historyRegisterCheckItems[i].ResultStatusId).FirstOrDefault().ReportBackgroundColor; } else if(i== 1) { - registerCheckItem.PreviousTwoItemResult = historyRegisterCheckItems[i].registerCheckItem.Result; - registerCheckItem.PreviousTwoReportFontColor = (resultStatus.Where(x => x.Id == historyRegisterCheckItems[i].registerCheckItem.ResultStatusId).FirstOrDefault() == null) ? 0 : resultStatus.Where(x => x.Id == historyRegisterCheckItems[i].registerCheckItem.ResultStatusId).FirstOrDefault().ReportFontColor; - registerCheckItem.PreviousTwoReportBackgroundColor = (resultStatus.Where(x => x.Id == historyRegisterCheckItems[i].registerCheckItem.ResultStatusId).FirstOrDefault() == null) ? 0 : resultStatus.Where(x => x.Id == historyRegisterCheckItems[i].registerCheckItem.ResultStatusId).FirstOrDefault().ReportBackgroundColor; + registerCheckItem.PreviousTwoItemResult = historyRegisterCheckItems[i].Result; + registerCheckItem.PreviousTwoReportFontColor = (resultStatus.Where(x => x.Id == historyRegisterCheckItems[i].ResultStatusId).FirstOrDefault() == null) ? 0 : resultStatus.Where(x => x.Id == historyRegisterCheckItems[i].ResultStatusId).FirstOrDefault().ReportFontColor; + registerCheckItem.PreviousTwoReportBackgroundColor = (resultStatus.Where(x => x.Id == historyRegisterCheckItems[i].ResultStatusId).FirstOrDefault() == null) ? 16777215 : resultStatus.Where(x => x.Id == historyRegisterCheckItems[i].ResultStatusId).FirstOrDefault().ReportBackgroundColor; } } } @@ -232,7 +237,9 @@ namespace Shentun.Peis.SumSummaryReports } - var grouplist = detailedResultsList_Asbitems.GroupBy(g => g.ItemTypeName); + var grouplist = detailedResultsList_Asbitems.OrderBy(o=>o.ItemTypeDisplayOrder) + .OrderBy(o=>o.AsbitemDisplayOrder) + .GroupBy(g => g.ItemTypeName); foreach (var g in grouplist) { diff --git a/test/Shentun.Peis.Application.Tests/SumSummaryReportAppServiceTest.cs b/test/Shentun.Peis.Application.Tests/SumSummaryReportAppServiceTest.cs index a87ce7c..e980d32 100644 --- a/test/Shentun.Peis.Application.Tests/SumSummaryReportAppServiceTest.cs +++ b/test/Shentun.Peis.Application.Tests/SumSummaryReportAppServiceTest.cs @@ -36,12 +36,12 @@ namespace Shentun.Peis var entity = new PatientRegisterIdInputDto() { - PatientRegisterId = new Guid("3a121795-7f84-9c04-844e-c2338a4241d1"), + PatientRegisterId = new Guid("3a1216d1-4bd1-5f3b-6a40-903589b570b8"), }; var newEntity = await _appService.GetDetailResultsAsync(entity); - //await unitOfWork.CompleteAsync(); + await unitOfWork.CompleteAsync(); } } } From aacff08ee708746d094139f589353b1c2949c265 Mon Sep 17 00:00:00 2001 From: "DESKTOP-G961P6V\\Zhh" <839860190@qq.com> Date: Thu, 2 May 2024 19:37:06 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E6=80=BB=E6=A3=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../SumSummaryReports/SumSummaryReportDetailResultDto.cs | 1 + .../SumSummaryReports/SumSummaryReportAppService.cs | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Shentun.Peis.Application.Contracts/SumSummaryReports/SumSummaryReportDetailResultDto.cs b/src/Shentun.Peis.Application.Contracts/SumSummaryReports/SumSummaryReportDetailResultDto.cs index 1297177..495cdf5 100644 --- a/src/Shentun.Peis.Application.Contracts/SumSummaryReports/SumSummaryReportDetailResultDto.cs +++ b/src/Shentun.Peis.Application.Contracts/SumSummaryReports/SumSummaryReportDetailResultDto.cs @@ -6,6 +6,7 @@ namespace Shentun.Peis.SumSummaryReports { public class SumSummaryReportDetailResultDto { + public int ItemTypeDisplayOrder { get; set; } /// /// 项目类别名称 /// diff --git a/src/Shentun.Peis.Application/SumSummaryReports/SumSummaryReportAppService.cs b/src/Shentun.Peis.Application/SumSummaryReports/SumSummaryReportAppService.cs index 80bac1c..d6f8040 100644 --- a/src/Shentun.Peis.Application/SumSummaryReports/SumSummaryReportAppService.cs +++ b/src/Shentun.Peis.Application/SumSummaryReports/SumSummaryReportAppService.cs @@ -246,13 +246,14 @@ namespace Shentun.Peis.SumSummaryReports var glist = g.ToList(); var resultlist = new SumSummaryReportDetailResultDto { + ItemTypeDisplayOrder = glist.FirstOrDefault().ItemTypeDisplayOrder, ItemTypeName = glist.FirstOrDefault().ItemTypeName, Asbitems = glist }; msg.Add(resultlist); } - + msg = msg.OrderBy(o => o.ItemTypeDisplayOrder).ToList(); return msg; }