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))