| 
					
					
						
							
						
					
					
				 | 
				@ -76,7 +76,7 @@ namespace Shentun.Peis.SumSummaryReports | 
			
		
		
	
		
			
				 | 
				 | 
				        /// </summary>
 | 
				 | 
				 | 
				        /// </summary>
 | 
			
		
		
	
		
			
				 | 
				 | 
				        /// <param name="input">人员登记ID</param>
 | 
				 | 
				 | 
				        /// <param name="input">人员登记ID</param>
 | 
			
		
		
	
		
			
				 | 
				 | 
				        /// <returns></returns>
 | 
				 | 
				 | 
				        /// <returns></returns>
 | 
			
		
		
	
		
			
				 | 
				 | 
				        [HttpGet("api/app/SumSummaryReport/GetDetailResults")] | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				        [HttpPost("api/app/SumSummaryReport/GetDetailResults")] | 
			
		
		
	
		
			
				 | 
				 | 
				        public async Task<List<SumSummaryReportDetailResultDto>> GetDetailResultsAsync(PatientRegisterIdInputDto input) | 
				 | 
				 | 
				        public async Task<List<SumSummaryReportDetailResultDto>> GetDetailResultsAsync(PatientRegisterIdInputDto input) | 
			
		
		
	
		
			
				 | 
				 | 
				        { | 
				 | 
				 | 
				        { | 
			
		
		
	
		
			
				 | 
				 | 
				            List<SumSummaryReportDetailResultDto> msg = new List<SumSummaryReportDetailResultDto>(); | 
				 | 
				 | 
				            List<SumSummaryReportDetailResultDto> msg = new List<SumSummaryReportDetailResultDto>(); | 
			
		
		
	
	
		
			
				| 
					
						
							
						
					
					
						
							
						
					
					
				 | 
				@ -113,7 +113,7 @@ namespace Shentun.Peis.SumSummaryReports | 
			
		
		
	
		
			
				 | 
				 | 
				                            item, | 
				 | 
				 | 
				                            item, | 
			
		
		
	
		
			
				 | 
				 | 
				                            itemType | 
				 | 
				 | 
				                            itemType | 
			
		
		
	
		
			
				 | 
				 | 
				
 | 
				 | 
				 | 
				
 | 
			
		
		
	
		
			
				 | 
				 | 
				                        }).ToList(); | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                        }).AsNoTracking().ToList(); | 
			
		
		
	
		
			
				 | 
				 | 
				
 | 
				 | 
				 | 
				
 | 
			
		
		
	
		
			
				 | 
				 | 
				            if (!list.Any()) | 
				 | 
				 | 
				            if (!list.Any()) | 
			
		
		
	
		
			
				 | 
				 | 
				            { | 
				 | 
				 | 
				            { | 
			
		
		
	
	
		
			
				| 
					
						
							
						
					
					
						
							
						
					
					
				 | 
				@ -160,7 +160,7 @@ namespace Shentun.Peis.SumSummaryReports | 
			
		
		
	
		
			
				 | 
				 | 
				                var parentItemType = itemTypes.Where(o => o.Id == listItem.itemType.ParentId).FirstOrDefault(); | 
				 | 
				 | 
				                var parentItemType = itemTypes.Where(o => o.Id == listItem.itemType.ParentId).FirstOrDefault(); | 
			
		
		
	
		
			
				 | 
				 | 
				                if (parentItemType != null) | 
				 | 
				 | 
				                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.DisplayName = parentItemType.DisplayName; | 
			
		
		
	
		
			
				 | 
				 | 
				                    listItem.itemType.DisplayOrder = parentItemType.DisplayOrder; | 
				 | 
				 | 
				                    listItem.itemType.DisplayOrder = parentItemType.DisplayOrder; | 
			
		
		
	
		
			
				 | 
				 | 
				
 | 
				 | 
				 | 
				
 | 
			
		
		
	
	
		
			
				| 
					
					
					
						
							
						
					
				 | 
				@ -175,11 +175,14 @@ namespace Shentun.Peis.SumSummaryReports | 
			
		
		
	
		
			
				 | 
				 | 
				                var listItem = list.Where(o => o.registerCheck.Id == registerCheckId).First(); | 
				 | 
				 | 
				                var listItem = list.Where(o => o.registerCheck.Id == registerCheckId).First(); | 
			
		
		
	
		
			
				 | 
				 | 
				                var detailedResultsList_Asbitem = new SumSummaryReportDetailResultWithAsbitem() | 
				 | 
				 | 
				                var detailedResultsList_Asbitem = new SumSummaryReportDetailResultWithAsbitem() | 
			
		
		
	
		
			
				 | 
				 | 
				                { | 
				 | 
				 | 
				                { | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				
 | 
			
		
		
	
		
			
				 | 
				 | 
				                    ItemTypeName = listItem.itemType.DisplayName, | 
				 | 
				 | 
				                    ItemTypeName = listItem.itemType.DisplayName, | 
			
		
		
	
		
			
				 | 
				 | 
				                    AsbitemName = string.Join(",", list.Where(o => o.registerCheck.Id == registerCheckId) | 
				 | 
				 | 
				                    AsbitemName = string.Join(",", list.Where(o => o.registerCheck.Id == registerCheckId) | 
			
		
		
	
		
			
				 | 
				 | 
				                            .OrderBy(o => o.itemType.DisplayOrder).OrderBy(o => o.asbitem.DisplayOrder) | 
				 | 
				 | 
				                            .OrderBy(o => o.itemType.DisplayOrder).OrderBy(o => o.asbitem.DisplayOrder) | 
			
		
		
	
		
			
				 | 
				 | 
				                            .Select(o => o.asbitem.DisplayName).Distinct().ToList()), | 
				 | 
				 | 
				                            .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), | 
				 | 
				 | 
				                    CheckDoctorName = EntityHelper.GetCheckDoctorName(listItem.registerCheck.CheckDoctorId, userlist), | 
			
		
		
	
		
			
				 | 
				 | 
				                    Items = list.Where(o => o.registerCheck.Id == registerCheckId) | 
				 | 
				 | 
				                    Items = list.Where(o => o.registerCheck.Id == registerCheckId) | 
			
		
		
	
		
			
				 | 
				 | 
				                    .OrderBy(o => o.itemType.DisplayOrder).OrderBy(o => o.asbitem.DisplayOrder).OrderBy(o => o.item.DisplayOrder) | 
				 | 
				 | 
				                    .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, | 
				 | 
				 | 
				                        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, | 
				 | 
				 | 
				                        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, | 
				 | 
				 | 
				                        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(), | 
				 | 
				 | 
				                    }).Distinct().ToList(), | 
			
		
		
	
		
			
				 | 
				 | 
				                    Summarys = list.Where(o => o.registerCheck.Id == registerCheckId) | 
				 | 
				 | 
				                    Summarys = list.Where(o => o.registerCheck.Id == registerCheckId) | 
			
		
		
	
		
			
				 | 
				 | 
				                               .OrderBy(o=>o.registerCheckSummary.DisplayOrder) | 
				 | 
				 | 
				                               .OrderBy(o=>o.registerCheckSummary.DisplayOrder) | 
			
		
		
	
		
			
				 | 
				 | 
				                               .GroupBy(o=>o.registerCheckSummary) | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                               .GroupBy(o=>o.registerCheckSummary.Summary) | 
			
		
		
	
		
			
				 | 
				 | 
				                               .Select(o=> new SumSummaryReportDetailResultWithSummary(){ | 
				 | 
				 | 
				                               .Select(o=> new SumSummaryReportDetailResultWithSummary(){ | 
			
		
		
	
		
			
				 | 
				 | 
				                                  Summary = o.FirstOrDefault().registerCheckSummary.Summary }) | 
				 | 
				 | 
				                                  Summary = o.FirstOrDefault().registerCheckSummary.Summary }) | 
			
		
		
	
		
			
				 | 
				 | 
				                                  .ToList<SumSummaryReportDetailResultWithSummary>(),   | 
				 | 
				 | 
				                                  .ToList<SumSummaryReportDetailResultWithSummary>(),   | 
			
		
		
	
	
		
			
				| 
					
					
					
						
							
						
					
				 | 
				@ -207,22 +210,24 @@ namespace Shentun.Peis.SumSummaryReports | 
			
		
		
	
		
			
				 | 
				 | 
				                detailedResultsList_Asbitem.Summarys = detailedResultsList_Asbitem.Summarys.Distinct().ToList(); | 
				 | 
				 | 
				                detailedResultsList_Asbitem.Summarys = detailedResultsList_Asbitem.Summarys.Distinct().ToList(); | 
			
		
		
	
		
			
				 | 
				 | 
				                foreach (var registerCheckItem in detailedResultsList_Asbitem.Items) | 
				 | 
				 | 
				                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++) | 
				 | 
				 | 
				                    for (var i = 0; i < historyRegisterCheckItems.Count; i++) | 
			
		
		
	
		
			
				 | 
				 | 
				                    { | 
				 | 
				 | 
				                    { | 
			
		
		
	
		
			
				 | 
				 | 
				                        if(i== 0) | 
				 | 
				 | 
				                        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) | 
				 | 
				 | 
				                        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) | 
				 | 
				 | 
				            foreach (var g in grouplist) | 
			
		
		
	
		
			
				 | 
				 | 
				            { | 
				 | 
				 | 
				            { | 
			
		
		
	
	
		
			
				| 
					
						
							
						
					
					
					
				 | 
				
  |