diff --git a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml index f7ba62681..748a0ec80 100644 --- a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml +++ b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml @@ -808,16 +808,6 @@ - - - 病灶明细表 - - - - - - - 获取阅片标准可以导出的列表 diff --git a/IRaCIS.Core.Application/Service/Common/ExcelExportService.cs b/IRaCIS.Core.Application/Service/Common/ExcelExportService.cs index d9f17216e..badad766f 100644 --- a/IRaCIS.Core.Application/Service/Common/ExcelExportService.cs +++ b/IRaCIS.Core.Application/Service/Common/ExcelExportService.cs @@ -1845,87 +1845,7 @@ namespace IRaCIS.Core.Application.Service.Common #region 通用阅片结果导出 - /// - /// 病灶明细表 - /// - /// - /// - /// - /// - /// - [HttpPost] - public async Task GetEvaluationLessionList_Export(VisitTaskQuery inQuery, - [FromServices] IRepository _commonDocumentRepository, - [FromServices] IDictionaryService _dictionaryService, - [FromServices] IRepository _trialRepository) - { - //每次查询必须是单标准的 - var criterion = await _readingQuestionCriterionTrialRepository.Where(t => t.Id == inQuery.TrialReadingCriterionId).Select(t => new { t.CriterionType, t.CriterionName, t.ArbitrationRule }).FirstNotNullAsync(); - - var list = await _visitTaskRepository.Where(t => t.TrialId == inQuery.TrialId && t.IsAnalysisCreate == false && (t.TaskState == TaskState.Effect || t.TaskState == TaskState.Freeze)) - - //访视和全局查询已签名完成的,裁判可以是未签名,未完成的 - .Where(t => (t.ReadingTaskState == ReadingTaskState.HaveSigned && (t.ReadingCategory == ReadingCategory.Visit || t.ReadingCategory == ReadingCategory.Global)) || t.ReadingCategory == ReadingCategory.Judge) - .WhereIf(inQuery.TrialReadingCriterionId != null, t => t.TrialReadingCriterionId == inQuery.TrialReadingCriterionId) - .WhereIf(inQuery.TrialSiteId != null, t => t.Subject.TrialSiteId == inQuery.TrialSiteId) - - .WhereIf(inQuery.IsUrgent != null, t => t.IsUrgent == inQuery.IsUrgent) - .WhereIf(inQuery.DoctorUserId != null, t => t.DoctorUserId == inQuery.DoctorUserId) - .WhereIf(inQuery.ReadingCategory != null, t => t.ReadingCategory == inQuery.ReadingCategory) - //.WhereIf(inQuery.ReadingTaskState != null, t => t.ReadingTaskState == inQuery.ReadingTaskState) - .WhereIf(inQuery.TaskAllocationState != null, t => t.TaskAllocationState == inQuery.TaskAllocationState) - .WhereIf(inQuery.ArmEnum != null, t => t.ArmEnum == inQuery.ArmEnum) - .WhereIf(!string.IsNullOrEmpty(inQuery.TrialSiteCode), t => (t.BlindTrialSiteCode.Contains(inQuery.TrialSiteCode!) && t.IsAnalysisCreate) || (t.Subject.TrialSite.TrialSiteCode.Contains(inQuery.TrialSiteCode!) && t.IsAnalysisCreate == false)) - .WhereIf(!string.IsNullOrEmpty(inQuery.TaskName), t => t.TaskName.Contains(inQuery.TaskName) || t.TaskBlindName.Contains(inQuery.TaskName)) - .WhereIf(!string.IsNullOrEmpty(inQuery.SubjectCode), t => t.Subject.Code.Contains(inQuery.SubjectCode)) - .WhereIf(inQuery.BeginAllocateDate != null, t => t.AllocateTime > inQuery.BeginAllocateDate) - .WhereIf(inQuery.EndAllocateDate != null, t => t.AllocateTime < inQuery.EndAllocateDate) - .ProjectTo(_mapper.ConfigurationProvider, new { readingExportType = inQuery.ReadingExportType, criterionType = criterion.CriterionType, arbitrationRule = criterion.ArbitrationRule, trialReadingCriterionId = inQuery.TrialReadingCriterionId, isEn_Us = _userInfo.IsEn_Us }).ToListAsync(); - - list = list.OrderBy(t => t.SubjectCode).ThenBy(t => t.ArmEnum).ThenBy(t => t.VisitTaskNum).ToList(); - - var translateDicNameList = list.FirstOrDefault()?.QuestionAnswerList.Select(t => t.TranslateDicName).ToList(); - - var exportInfo = (await _trialRepository.Where(t => t.Id == inQuery.TrialId).IgnoreQueryFilters().ProjectTo(_mapper.ConfigurationProvider).FirstOrDefaultAsync()).IfNullThrowException(); - exportInfo.CriterionName = criterion.CriterionName; - - //处理裁判标记 - list = DealJudgeMark(criterion.ArbitrationRule, list); - - exportInfo.List = ExportExcelConverterDate.ConvertToClientTimeInObject(list.Where(t => t.ReadingCategory != ReadingCategory.Global).ToList(), _userInfo.TimeZoneId); - exportInfo.CurrentTime = ExportExcelConverterDate.DateTimeInternationalToString(DateTime.Now, _userInfo.TimeZoneId); - - var dynamicColumnConfig = new DynamicColumnConfig() - { - AutoColumnTitleRowIndex = 2, - AutoColumnStartIndex = 6, - TempalteLastColumnIndex = 8, - DynamicItemDicName = "TranslateDicName", - DynamicItemValueName = "QuestionValue", - DynamicListName = "QuestionAnswerList", - RemoveColunmIndexList = new List() { }, - ColumnNameList = list.FirstOrDefault()?.QuestionAnswerList.Select(t => t.QuestionName).ToList() ?? new List(), - TranslateDicNameList = translateDicNameList ?? new List() - }; - - - - - - - var (memoryStream, fileName) = await ExcelExportHelper.DataExport_NpoiTestAsync(StaticData.Export.ReadingLession_Export, exportInfo, _commonDocumentRepository, _hostEnvironment, _dictionaryService, typeof(CommonEvaluationExport), criterion.CriterionType, dynamicColumnConfig); - - - return new FileStreamResult(memoryStream, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet") - { - FileDownloadName = $"{exportInfo.ResearchProgramNo}_{exportInfo.CriterionName}_{fileName}_{DateTime.Now.ToString("yyyyMMddHHmmss")}.xlsx" - }; - - - - - } /// /// 获取阅片标准可以导出的列表 /// @@ -1944,7 +1864,13 @@ namespace IRaCIS.Core.Application.Service.Common list.Add(new ExportDocumentDes() { Code = StaticData.Export.CommonJudgeReadingDetail_Export, ExportCatogory = ExportResult.DetailedTableOfAdjudicationResults }); - list.Add(new ExportDocumentDes() { Code = StaticData.Export.ReadingLession_Export, ExportCatogory = ExportResult.DetailedTableOfLesions }); + if (criterion.CriterionType == CriterionType.RECIST1Point1 || criterion.CriterionType == CriterionType.RECIST1Pointt1_MB + || criterion.CriterionType == CriterionType.IRECIST1Point1 || criterion.CriterionType == CriterionType.Lugano2014 + || criterion.CriterionType == CriterionType.Lugano2014WithoutPET || criterion.CriterionType == CriterionType.PCWG3) + { + list.Add(new ExportDocumentDes() { Code = StaticData.Export.ReadingLession_Export, ExportCatogory = ExportResult.DetailedTableOfLesions }); + } + switch (criterion.ArbitrationRule) { @@ -2089,7 +2015,7 @@ namespace IRaCIS.Core.Application.Service.Common }).ToListAsync(); //动态列,以不同的病灶配置的问题取并集 - var lessionAnserList = taskList.Where(t=>t.LesionList.Count()>0).FirstOrDefault()?.LesionList.FirstOrDefault()?.LessionAnswerList ?? new List(); + var lessionAnserList = taskList.Where(t => t.LesionList.Count() > 0).FirstOrDefault()?.LesionList.FirstOrDefault()?.LessionAnswerList ?? new List(); var dynamicExtraAddTitleList = new List(); @@ -2097,14 +2023,23 @@ namespace IRaCIS.Core.Application.Service.Common { var lessionInfo = lessionAnserList.First(); - dynamicExtraAddTitleList.Add(new DymamicQuestionInfo() { QuestionName = _userInfo.IsEn_Us ? "Lesion ID" : "病灶编号" }); - dynamicExtraAddTitleList.Add(new DymamicQuestionInfo() { QuestionName = _userInfo.IsEn_Us ? "Lesion Type" : "病灶类型" }); + 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(); + var dynamicTitleList = dynamicExtraAddTitleList.Union(dynamicLessionTitleList).ToList(); //最终的病灶列表 list = new List(); @@ -2119,15 +2054,23 @@ namespace IRaCIS.Core.Application.Service.Common var addLessionInfoList = new List(); - //病灶编号 和病灶类型没有配置,但是需要有的 - 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" }); + if (criterion.CriterionType == CriterionType.RECIST1Point1 || criterion.CriterionType == CriterionType.RECIST1Pointt1_MB + || 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" }); + + } + else if (criterion.CriterionType == CriterionType.PCWG3) + { + addLessionInfoList.Add(new CommonQuesionInfo() { QuestionName = _userInfo.IsEn_Us ? "Lesion Type" : "病灶类型", QuestionValue = firstLessionAnser.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(); @@ -2137,7 +2080,7 @@ namespace IRaCIS.Core.Application.Service.Common list.Add(cloneItem); } - + } } @@ -2157,7 +2100,7 @@ namespace IRaCIS.Core.Application.Service.Common #region 系统标准处理整体肿瘤评估合并 - 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(); //针对1.1 整体肿瘤评估 有的两列要合并一列 if (criterion.CriterionType == CriterionType.RECIST1Point1 || criterion.CriterionType == CriterionType.RECIST1Pointt1_MB || criterion.CriterionType == CriterionType.IRECIST1Point1)