Browse Source

总检

bjmzak
DESKTOP-G961P6V\Zhh 2 years ago
parent
commit
07dd78f405
  1. 3
      src/Shentun.Peis.Application.Contracts/SumSummaryReports/SumSummaryReportDetailResultDto.cs
  2. 37
      src/Shentun.Peis.Application/SumSummaryReports/SumSummaryReportAppService.cs
  3. 4
      test/Shentun.Peis.Application.Tests/SumSummaryReportAppServiceTest.cs

3
src/Shentun.Peis.Application.Contracts/SumSummaryReports/SumSummaryReportDetailResultDto.cs

@ -55,6 +55,9 @@ namespace Shentun.Peis.SumSummaryReports
/// 检查小结列表
/// </summary>
public List<SumSummaryReportDetailResultWithSummary> Summarys { get; set; }
public int ItemTypeDisplayOrder { get; set; }
public int AsbitemDisplayOrder { get; set; }
}
/// <summary>

37
src/Shentun.Peis.Application/SumSummaryReports/SumSummaryReportAppService.cs

@ -76,7 +76,7 @@ namespace Shentun.Peis.SumSummaryReports
/// </summary>
/// <param name="input">人员登记ID</param>
/// <returns></returns>
[HttpGet("api/app/SumSummaryReport/GetDetailResults")]
[HttpPost("api/app/SumSummaryReport/GetDetailResults")]
public async Task<List<SumSummaryReportDetailResultDto>> GetDetailResultsAsync(PatientRegisterIdInputDto input)
{
List<SumSummaryReportDetailResultDto> msg = new List<SumSummaryReportDetailResultDto>();
@ -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<SumSummaryReportDetailResultWithSummary>(),
@ -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)
{

4
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();
}
}
}

Loading…
Cancel
Save