From 95a203881ef2964b350f4cb5c5bd7db349e9fde8 Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Tue, 14 Jan 2025 15:50:12 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E4=BF=AE=E6=94=B91.1=20=E5=AF=BC=E8=A1=A8?= =?UTF-8?q?=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Service/Common/ExcelExportService.cs | 34 ++----------------- .../Service/QC/DTO/QCListViewModel.cs | 2 -- .../Service/QC/_MapConfig.cs | 4 +-- 3 files changed, 5 insertions(+), 35 deletions(-) diff --git a/IRaCIS.Core.Application/Service/Common/ExcelExportService.cs b/IRaCIS.Core.Application/Service/Common/ExcelExportService.cs index 829942b42..719825cdd 100644 --- a/IRaCIS.Core.Application/Service/Common/ExcelExportService.cs +++ b/IRaCIS.Core.Application/Service/Common/ExcelExportService.cs @@ -2290,32 +2290,7 @@ namespace IRaCIS.Core.Application.Service.Common isEn_Us = _userInfo.IsEn_Us }).ToListAsync(); - //动态列,以不同的病灶配置的问题取并集 - var lessionAnserList = taskList.Where(t => t.LesionList.Count() > 0).FirstOrDefault()?.LesionList.FirstOrDefault()?.LessionAnswerList ?? new List(); - var dynamicExtraAddTitleList = new List(); - - if (lessionAnserList.Count() > 0) - { - var lessionInfo = lessionAnserList.First(); - - if (criterion.CriterionType == CriterionType.RECIST1Point1 || criterion.CriterionType == CriterionType.RECIST1Pointt1_MB - || criterion.CriterionType == CriterionType.IRECIST1Point1 || criterion.CriterionType == CriterionType.Lugano2014 || criterion.CriterionType == CriterionType.Lugano2014WithoutPET) - { - dynamicExtraAddTitleList.Add(new DymamicQuestionInfo() { QuestionName = _userInfo.IsEn_Us ? "Lesion ID" : "病灶编号" }); - dynamicExtraAddTitleList.Add(new DymamicQuestionInfo() { QuestionName = _userInfo.IsEn_Us ? "Lesion Type" : "病灶类型" }); - } - else if (criterion.CriterionType == CriterionType.PCWG3) - { - dynamicExtraAddTitleList.Add(new DymamicQuestionInfo() { QuestionName = _userInfo.IsEn_Us ? "Lesion Type" : "病灶类型" }); - } - - } - - //通过问题标识取并集 - - var dynamicLessionTitleList = lessionAnserList.Select(t => new DymamicQuestionInfo { QuestionMark = t.QuestionMark, QuestionName = t.QuestionName, TranslateDicName = t.TranslateDicName }).Distinct(); - var dynamicTitleList = dynamicExtraAddTitleList.Union(dynamicLessionTitleList).ToList(); //最终的病灶列表 要把裁判的也要加进去,需要处理裁判标记 list = new List(); @@ -2327,7 +2302,6 @@ namespace IRaCIS.Core.Application.Service.Common { foreach (var lession in item.LesionList.OrderBy(t => t.LessionType).ThenBy(t => t.LessionCode)) { - var firstLessionAnser = lession.LessionAnswerList.FirstOrDefault() ?? new CommonLessionQuestionAnswerInfo(); var addLessionInfoList = new List(); @@ -2335,19 +2309,17 @@ namespace IRaCIS.Core.Application.Service.Common || criterion.CriterionType == CriterionType.IRECIST1Point1 || criterion.CriterionType == CriterionType.Lugano2014 || criterion.CriterionType == CriterionType.Lugano2014WithoutPET) { //病灶编号 和病灶类型没有配置,但是需要有的 - addLessionInfoList.Add(new CommonQuesionInfo() { QuestionName = _userInfo.IsEn_Us ? "Lesion ID" : "病灶编号", QuestionValue = firstLessionAnser.LessionCode }); - addLessionInfoList.Add(new CommonQuesionInfo() { QuestionName = _userInfo.IsEn_Us ? "Lesion Type" : "病灶类型", QuestionValue = firstLessionAnser.LessionType, TranslateDicName = "LesionType" }); + addLessionInfoList.Add(new CommonQuesionInfo() { QuestionName = _userInfo.IsEn_Us ? "Lesion ID" : "病灶编号", QuestionValue = lession.LessionCode }); + addLessionInfoList.Add(new CommonQuesionInfo() { QuestionName = _userInfo.IsEn_Us ? "Lesion Type" : "病灶类型", QuestionValue = lession.LessionType, TranslateDicName = "LesionType" }); } else if (criterion.CriterionType == CriterionType.PCWG3) { - addLessionInfoList.Add(new CommonQuesionInfo() { QuestionName = _userInfo.IsEn_Us ? "Lesion Type" : "病灶类型", QuestionValue = firstLessionAnser.LessionType, TranslateDicName = "LesionType" }); + addLessionInfoList.Add(new CommonQuesionInfo() { QuestionName = _userInfo.IsEn_Us ? "Lesion Type" : "病灶类型", QuestionValue = lession.LessionType, TranslateDicName = "LesionType" }); } - var dynamicPartialLessionInfoList = lession.LessionAnswerList.Select(t => new CommonQuesionInfo() { QuestionName = t.QuestionName, QuestionValue = t.QuestionValue, TranslateDicName = t.TranslateDicName }); - //有三部分组成 外层问题+ 没有配置病灶编号和类型+ 动态的表格问题 var dynamicLessionInfoList = addLessionInfoList.Union(dynamicPartialLessionInfoList).Union(item.QuestionAnswerList).ToList(); diff --git a/IRaCIS.Core.Application/Service/QC/DTO/QCListViewModel.cs b/IRaCIS.Core.Application/Service/QC/DTO/QCListViewModel.cs index 068134e74..aed760237 100644 --- a/IRaCIS.Core.Application/Service/QC/DTO/QCListViewModel.cs +++ b/IRaCIS.Core.Application/Service/QC/DTO/QCListViewModel.cs @@ -1270,9 +1270,7 @@ namespace IRaCIS.Core.Application.Contracts public class CommonLessionQuestionAnswerInfo { #region 肿瘤评估标准的时候需要 - public string LessionCode { get; set; } - public string LessionType { get; set; } public QuestionMark? QuestionMark { get; set; } #endregion diff --git a/IRaCIS.Core.Application/Service/QC/_MapConfig.cs b/IRaCIS.Core.Application/Service/QC/_MapConfig.cs index a7710e2d3..7834ca95d 100644 --- a/IRaCIS.Core.Application/Service/QC/_MapConfig.cs +++ b/IRaCIS.Core.Application/Service/QC/_MapConfig.cs @@ -294,8 +294,8 @@ namespace IRaCIS.Core.Application.Service .ForMember(o => o.LessionAnswerList, t => t.MapFrom(u => u.LesionAnswerList.Where(c => c.ReadingTableQuestionTrial.ExportResultStr.Contains(((int)readingExportType).ToString())))); CreateMap() - .ForMember(o => o.LessionCode, t => t.MapFrom(u => u.Lesion.RowMark)) - .ForMember(o => o.LessionType, t => t.MapFrom(u => (int?)u.ReadingQuestionTrial.LesionType)) + //.ForMember(o => o.LessionCode, t => t.MapFrom(u => u.Lesion.RowMark)) + //.ForMember(o => o.LessionType, t => t.MapFrom(u => (int?)u.ReadingQuestionTrial.LesionType)) .ForMember(o => o.QuestionMark, t => t.MapFrom(u => u.ReadingTableQuestionTrial.QuestionMark)) .ForMember(o => o.QuestionName, t => t.MapFrom(u => isEn_Us ? u.ReadingTableQuestionTrial.QuestionEnName : u.ReadingTableQuestionTrial.QuestionName)) .ForMember(o => o.QuestionValue, t => t.MapFrom(u => u.Answer)) From cf9d42dc490cd1ef79edd27f59a749dfefd01220 Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Wed, 15 Jan 2025 10:15:36 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=BF=BB=E8=AF=91?= =?UTF-8?q?=E5=AD=97=E5=85=B8=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../IRaCIS.Core.Application.xml | 2 +- .../Service/Common/ExcelExportService.cs | 60 +++++++++++++++---- .../Service/QC/DTO/QCListViewModel.cs | 7 ++- .../Service/QC/_MapConfig.cs | 3 + 4 files changed, 59 insertions(+), 13 deletions(-) diff --git a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml index 5f61c0c84..d412a314d 100644 --- a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml +++ b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml @@ -919,7 +919,7 @@ - + 阅片结果表、阅片结果明细,评估病灶明细表, 裁判明细表导出,条件通过 ReadingExportType ( 1,2,3,4)区分 diff --git a/IRaCIS.Core.Application/Service/Common/ExcelExportService.cs b/IRaCIS.Core.Application/Service/Common/ExcelExportService.cs index 719825cdd..b4f414753 100644 --- a/IRaCIS.Core.Application/Service/Common/ExcelExportService.cs +++ b/IRaCIS.Core.Application/Service/Common/ExcelExportService.cs @@ -2167,8 +2167,12 @@ namespace IRaCIS.Core.Application.Service.Common public async Task GetCommonEvaluationList_Export(VisitTaskQuery inQuery, [FromServices] IRepository _commonDocumentRepository, [FromServices] IDictionaryService _dictionaryService, + [FromServices] IRepository _trialReadingQuestionRepository, + [FromServices] IRepository _trialReadingTableQuestionRepository, [FromServices] IRepository _trialRepository) { + var trialId = inQuery.TrialId; + var trialReadingCriterionId = inQuery.TrialReadingCriterionId; //每次查询必须是单标准的 var criterion = await _readingQuestionCriterionTrialRepository.Where(t => t.Id == inQuery.TrialReadingCriterionId).Select(t => new { t.CriterionType, t.CriterionGroup, t.IsGlobalReading, t.IsArbitrationReading, t.CriterionName, t.ArbitrationRule }).FirstNotNullAsync(); @@ -2433,8 +2437,8 @@ namespace IRaCIS.Core.Application.Service.Common //处理裁判标记 list = DealJudgeMark(criterion.ArbitrationRule, criterion.IsGlobalReading, list); - //合并之前获取翻译的字典名,否则有的没法翻译 - var translateDicNameList = list.SelectMany(t => t.QuestionAnswerList).Where(t => t.TranslateDicName.IsNotNullOrEmpty()).Select(t => t.TranslateDicName).Distinct().ToList(); + ////合并之前获取翻译的字典名,否则有的没法翻译 + //var translateDicNameList = list.SelectMany(t => t.QuestionAnswerList).Where(t => t.TranslateDicName.IsNotNullOrEmpty()).Select(t => t.TranslateDicName).Distinct().ToList(); if (inQuery.ReadingExportType != ExportResult.CDISC) @@ -2520,13 +2524,43 @@ namespace IRaCIS.Core.Application.Service.Common exportInfo.List = ExportExcelConverterDate.ConvertToClientTimeInObject(list.Where(t => t.ReadingCategory != ReadingCategory.Global).ToList(), _userInfo.TimeZoneId); exportInfo.CurrentTime = ExportExcelConverterDate.DateTimeInternationalToString(DateTime.Now, _userInfo.TimeZoneId); + + #region 问题名称字典 列名 + var dynamicColumnConfig = new DynamicColumnConfig(); + //查询配置的问题名称,不是从答案表中连接取问题名称,因为目前有些保存,有些问题,虽然配置了,但是没填,导致导表有些配置的列没出来 + var trialConfigQuestionList = _trialReadingQuestionRepository.Where(t => t.TrialId == trialId && t.ReadingQuestionCriterionTrialId == trialReadingCriterionId).Where(t => t.ExportResultStr.Contains(((int)inQuery.ReadingExportType).ToString())).OrderBy(t => t.ShowOrder).Select(t => new + { + QuestionId = t.Id, + QuestionName = _userInfo.IsEn_Us ? t.QuestionEnName : t.QuestionName, + t.CDISCCode, + TranslateDicName = t.DictionaryCode + }).ToList(); + var trialConfigTableQuestionList = _trialReadingTableQuestionRepository.Where(t => t.TrialId == trialId).Where(t => t.ExportResultStr.Contains(((int)inQuery.ReadingExportType).ToString())).OrderBy(t => t.ShowOrder).Select(t => new + { + QuestionId = t.Id, + QuestionName = _userInfo.IsEn_Us ? t.QuestionEnName : t.QuestionName, + t.CDISCCode, + TranslateDicName = t.DictionaryCode + }).ToList(); + + + var totalCoumNameList = trialConfigQuestionList.Union(trialConfigTableQuestionList).ToList(); + + var columNameList = totalCoumNameList.Select(t => t.QuestionName).ToList(); + + var translateDicList = totalCoumNameList.Where(t => t.TranslateDicName.IsNotNullOrEmpty()).Select(t => t.TranslateDicName).Distinct().ToList(); + + + #endregion + + if (inQuery.ReadingExportType != ExportResult.CDISC) { - //合并之后获取最后的列名 - var columNameList = list.SelectMany(t => t.QuestionAnswerList).Where(t => t.QuestionName.IsNotNullOrEmpty()).Select(t => t.QuestionName).Distinct().ToList(); + //之前从问题答案取 合并之后获取最后的列名 + //var columNameList = list.SelectMany(t => t.QuestionAnswerList).Where(t => t.QuestionName.IsNotNullOrEmpty()).Select(t => t.QuestionName).Distinct().ToList(); dynamicColumnConfig = new DynamicColumnConfig() { @@ -2538,8 +2572,8 @@ namespace IRaCIS.Core.Application.Service.Common DynamicItemTitleName = "QuestionName", DynamicListName = "QuestionAnswerList", RemoveColunmIndexList = removeColumnIndexList, - ColumnNameList = columNameList ?? new List(), - TranslateDicNameList = translateDicNameList ?? new List() + ColumnNameList = columNameList, + TranslateDicNameList = translateDicList }; var (memoryStream, fileName) = await ExcelExportHelper.DataExport_NpoiTestAsync(export_Template, exportInfo, _commonDocumentRepository, _hostEnvironment, _dictionaryService, typeof(CommonEvaluationExport), criterion.CriterionType, dynamicColumnConfig); @@ -2553,10 +2587,14 @@ namespace IRaCIS.Core.Application.Service.Common else { - var nameList = list.SelectMany(t => t.QuestionAnswerList).Where(t => t.QuestionName.IsNotNullOrEmpty() && t.CDISCCode.IsNotNullOrEmpty()).Select(t => new { t.QuestionName, t.CDISCCode }).Distinct().ToList(); + var cdiscCodeList = totalCoumNameList.Select(t => t.CDISCCode).ToList(); - var columNameList = nameList.Select(t => t.QuestionName).Distinct().ToList(); - var cdiscCodeList = nameList.Select(t => t.CDISCCode).Distinct().ToList(); + #region 之前从问题答案取 + + //var nameList = list.SelectMany(t => t.QuestionAnswerList).Where(t => t.QuestionName.IsNotNullOrEmpty() && t.CDISCCode.IsNotNullOrEmpty()).Select(t => new { t.QuestionName, t.CDISCCode }).Distinct().ToList(); + //var columNameList = nameList.Select(t => t.QuestionName).Distinct().ToList(); + //var cdiscCodeList = nameList.Select(t => t.CDISCCode).Distinct().ToList(); + #endregion dynamicColumnConfig = new DynamicColumnConfig() { @@ -2568,9 +2606,9 @@ namespace IRaCIS.Core.Application.Service.Common DynamicItemTitleName = "QuestionName", DynamicListName = "QuestionAnswerList", RemoveColunmIndexList = removeColumnIndexList, - ColumnNameList = columNameList ?? new List(), + ColumnNameList = columNameList, CDISCList = cdiscCodeList, - TranslateDicNameList = translateDicNameList ?? new List() + TranslateDicNameList = translateDicList }; var (memoryStream, fileName) = await ExcelExportHelper.CDISC_DataExport_Async(export_Template, exportInfo, _commonDocumentRepository, _hostEnvironment, _dictionaryService, typeof(CommonEvaluationExport), criterion.CriterionType, dynamicColumnConfig); diff --git a/IRaCIS.Core.Application/Service/QC/DTO/QCListViewModel.cs b/IRaCIS.Core.Application/Service/QC/DTO/QCListViewModel.cs index aed760237..bc7d8363b 100644 --- a/IRaCIS.Core.Application/Service/QC/DTO/QCListViewModel.cs +++ b/IRaCIS.Core.Application/Service/QC/DTO/QCListViewModel.cs @@ -1171,8 +1171,11 @@ namespace IRaCIS.Core.Application.Contracts public class CommonQuesionInfo { - + //问题标识,肿瘤评估用于区分是什么问题 public QuestionType? QuestionType { get; set; } + + + public Guid QuestionId { get; set; } public string QuestionName { get; set; } public string QuestionValue { get; set; } @@ -1289,6 +1292,8 @@ namespace IRaCIS.Core.Application.Contracts #endregion + public Guid TableQuesionId { get; set; } + public string QuestionName { get; set; } public string QuestionValue { get; set; } diff --git a/IRaCIS.Core.Application/Service/QC/_MapConfig.cs b/IRaCIS.Core.Application/Service/QC/_MapConfig.cs index 7834ca95d..55fc960cb 100644 --- a/IRaCIS.Core.Application/Service/QC/_MapConfig.cs +++ b/IRaCIS.Core.Application/Service/QC/_MapConfig.cs @@ -242,6 +242,7 @@ namespace IRaCIS.Core.Application.Service QuestionType = c.ReadingQuestionTrial.QuestionType, QuestionName = isEn_Us ? c.ReadingQuestionTrial.QuestionEnName : c.ReadingQuestionTrial.QuestionName, QuestionValue = c.IsGlobalChange ? c.GlobalChangeAnswer : c.Answer, + QuestionId = c.ReadingQuestionTrial.Id, TranslateDicName = c.ReadingQuestionTrial.DictionaryCode, CDISCCode = c.ReadingQuestionTrial.CDISCCode }))) @@ -277,6 +278,7 @@ namespace IRaCIS.Core.Application.Service .Select(c => new CommonQuesionInfo() { QuestionType = c.ReadingQuestionTrial.QuestionType, + QuestionId = c.ReadingQuestionTrial.Id, QuestionName = isEn_Us ? c.ReadingQuestionTrial.QuestionEnName : c.ReadingQuestionTrial.QuestionName, QuestionValue = c.IsGlobalChange ? c.GlobalChangeAnswer : c.Answer, TranslateDicName = c.ReadingQuestionTrial.DictionaryCode, @@ -297,6 +299,7 @@ namespace IRaCIS.Core.Application.Service //.ForMember(o => o.LessionCode, t => t.MapFrom(u => u.Lesion.RowMark)) //.ForMember(o => o.LessionType, t => t.MapFrom(u => (int?)u.ReadingQuestionTrial.LesionType)) .ForMember(o => o.QuestionMark, t => t.MapFrom(u => u.ReadingTableQuestionTrial.QuestionMark)) + .ForMember(o => o.TableQuesionId, t => t.MapFrom(u => u.ReadingTableQuestionTrial.Id)) .ForMember(o => o.QuestionName, t => t.MapFrom(u => isEn_Us ? u.ReadingTableQuestionTrial.QuestionEnName : u.ReadingTableQuestionTrial.QuestionName)) .ForMember(o => o.QuestionValue, t => t.MapFrom(u => u.Answer)) .ForMember(o => o.CDISCCode, t => t.MapFrom(u => u.ReadingTableQuestionTrial.CDISCCode))