From a701c082d97bebd29e3679c286bf54dbf12e8d90 Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Wed, 23 Oct 2024 17:44:09 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=8A=A8=E6=80=81=E5=AF=BC?= =?UTF-8?q?=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../FileDocProcess/ExcelExportHelper.cs | 5 +- .../IRaCIS.Core.Application.xml | 34 +- .../Allocation/DTO/VisitTaskViewModel.cs | 6 +- .../Service/Common/ExcelExportService.cs | 344 ++++++++---------- .../Service/QC/DTO/QCListViewModel.cs | 91 ++++- .../Service/QC/_MapConfig.cs | 24 +- IRaCIS.Core.Domain.Share/Reading/ReadEnum.cs | 13 +- IRaCIS.Core.Domain/Allocation/VisitTask.cs | 3 - .../_IRaCIS/_Config/_StaticData.cs | 2 + 9 files changed, 278 insertions(+), 244 deletions(-) diff --git a/IRaCIS.Core.Application/Helper/FileDocProcess/ExcelExportHelper.cs b/IRaCIS.Core.Application/Helper/FileDocProcess/ExcelExportHelper.cs index 8f8346527..8c7b68d76 100644 --- a/IRaCIS.Core.Application/Helper/FileDocProcess/ExcelExportHelper.cs +++ b/IRaCIS.Core.Application/Helper/FileDocProcess/ExcelExportHelper.cs @@ -422,6 +422,7 @@ public static class ExcelExportHelper for (int i = originTotalEndIndex; i < originTotalEndIndex + needAddCount; i++) { titelRow.CreateCell(i + 1); + templateRow.CreateCell(i + 1); } //移动Title 和下面的模板标识 @@ -501,8 +502,8 @@ public static class ExcelExportHelper var iteObjDic = itemObj.ToDictionary(); - var itemDicName = iteObjDic[dynamicColumnConfig.DynamicItemDicName].ToString(); - var itemValue = iteObjDic[dynamicColumnConfig.DynamicItemValueName].ToString(); + var itemDicName = iteObjDic[dynamicColumnConfig.DynamicItemDicName]?.ToString(); + var itemValue = iteObjDic[dynamicColumnConfig.DynamicItemValueName]?.ToString(); if (itemDicName.IsNotNullOrEmpty()) { diff --git a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml index acdd3a5e9..ed9083f54 100644 --- a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml +++ b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml @@ -798,27 +798,6 @@ - - - 整体肿瘤评估 (目前仅仅 RECIST1.1 多个标准一个接口 Excel 列是一样的 ) - - - - - - - - - - 肿瘤疗效评估表 ( 目前仅仅 RECIST1.1) - - - - - - - - 评估病灶明细表 (目前仅仅 RECIST1.1 RECIST1.1 PGW3 表都是不同的) @@ -829,9 +808,9 @@ - + - 裁判阅片明细表 + 病灶明细表 @@ -848,7 +827,7 @@ - 通用阅片结果、阅片结果明细,裁判明细表导出,条件通过 ReadingExportType ( 0,1,2)区分 + 阅片结果表、阅片结果明细,评估病灶明细表, 裁判明细表导出,条件通过 ReadingExportType ( 1,2,3,4)区分 @@ -1097,7 +1076,7 @@ 医生文档关联关系维护 - + 医生文档关联关系维护 @@ -14832,6 +14811,11 @@ 组件一致性和原Arm2是否有差异 + + + 最终导出的病灶信息 + + QCChallengeId diff --git a/IRaCIS.Core.Application/Service/Allocation/DTO/VisitTaskViewModel.cs b/IRaCIS.Core.Application/Service/Allocation/DTO/VisitTaskViewModel.cs index 408927caf..cd5714e50 100644 --- a/IRaCIS.Core.Application/Service/Allocation/DTO/VisitTaskViewModel.cs +++ b/IRaCIS.Core.Application/Service/Allocation/DTO/VisitTaskViewModel.cs @@ -464,7 +464,7 @@ namespace IRaCIS.Core.Application.ViewModel public string? RequestReReadingReason { get; set; } - public ReadingExportType ReadingExportType { get; set; } + public ExportResult? ReadingExportType { get; set; } } @@ -476,7 +476,9 @@ namespace IRaCIS.Core.Application.ViewModel ReadingDetailResult=1, - JudgeReadingDetailResult=2 + JudgeReadingDetailResult=2, + + LessionDetail=3 } diff --git a/IRaCIS.Core.Application/Service/Common/ExcelExportService.cs b/IRaCIS.Core.Application/Service/Common/ExcelExportService.cs index d9f580252..e8d3d1f1c 100644 --- a/IRaCIS.Core.Application/Service/Common/ExcelExportService.cs +++ b/IRaCIS.Core.Application/Service/Common/ExcelExportService.cs @@ -11,6 +11,7 @@ using IRaCIS.Core.Infra.EFCore.Common; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Mvc; +using NPOI.POIFS.Properties; using NPOI.XSSF.UserModel; using System.Globalization; using static IRaCIS.Core.Application.Service.ExcelExportHelper; @@ -1610,7 +1611,7 @@ namespace IRaCIS.Core.Application.Service.Common - public List DealJudgeMark(ArbitrationRule arbitrationRule, IEnumerable list) where T : OverallTumorEvaluationExport + public List DealJudgeMark(ArbitrationRule arbitrationRule, IEnumerable list) where T : CommonEvaluationExport { //处理访视任务的裁判标记 var resultExceptJudgeList = list.Where(t => t.ReadingCategory != ReadingCategory.Judge).ToList(); @@ -1705,175 +1706,7 @@ namespace IRaCIS.Core.Application.Service.Common } - - /// - /// 整体肿瘤评估 (目前仅仅 RECIST1.1 多个标准一个接口 Excel 列是一样的 ) - /// - /// - /// - /// - /// - /// - [HttpPost] - public async Task GetOverallTumorEvaluationList_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(); - - if (criterion.CriterionType != CriterionType.RECIST1Point1 - && criterion.CriterionType != CriterionType.PCWG3 - && criterion.CriterionType != CriterionType.RECIST1Pointt1_MB - && criterion.CriterionType != CriterionType.Lugano2014 /*&& criterion.CriterionType != CriterionType.Lugano2014WithoutPET*/ - && criterion.CriterionType != CriterionType.IRECIST1Point1) - { - //---当前标准导出还未支持 - throw new Exception(_localizer["ExcelExport_UnsupportedExport"]); - } - - var list = await _visitTaskRepository.Where(t => t.TrialId == inQuery.TrialId && t.IsAnalysisCreate == false && t.TaskState == TaskState.Effect) - - //访视和全局查询已签名完成的,裁判可以是未签名,未完成的 - .Where(t => (t.ReadingTaskState == ReadingTaskState.HaveSigned && (t.ReadingCategory == ReadingCategory.Visit || t.ReadingCategory == ReadingCategory.Global)) || (t.ReadingCategory == ReadingCategory.Judge)) - //.WhereIf(inQuery.SubjectId != null, t => t.SubjectId == inQuery.SubjectId) - //.WhereIf(inQuery.TaskState != null, t => t.TaskState == inQuery.TaskState) - //.WhereIf(inQuery.IsSelfAnalysis != null, t => t.IsSelfAnalysis == inQuery.IsSelfAnalysis) - - .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!.Value.AddDays(1)) - .ProjectTo(_mapper.ConfigurationProvider, new { criterionType = criterion.CriterionType, arbitrationRule = criterion.ArbitrationRule, trialReadingCriterionId = inQuery.TrialReadingCriterionId }).ToListAsync(); - - list = list.OrderBy(t => t.SubjectCode).ThenBy(t => t.ArmEnum).ThenBy(t => t.VisitTaskNum).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); - - - - return await ExcelExportHelper.DataExportAsync(StaticData.Export.OverallTumorEvaluation_Export, exportInfo, $"{exportInfo.ResearchProgramNo}_{exportInfo.CriterionName}", _commonDocumentRepository, _hostEnvironment, _dictionaryService, typeof(OverallTumorEvaluationExport), criterion.CriterionType); - - } - - /// - /// 肿瘤疗效评估表 ( 目前仅仅 RECIST1.1) - /// - /// - /// - /// - /// - /// - /// - [HttpPost] - public async Task GetEvaluationOfTumorEfficacy_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 }).FirstOrDefaultAsync(); - - var query = _visitTaskRepository.Where(t => t.TrialId == inQuery.TrialId && t.TaskState == TaskState.Effect && t.IsAnalysisCreate == false && t.ReadingTaskState == ReadingTaskState.HaveSigned) - - //.WhereIf(inQuery.SubjectId != null, t => t.SubjectId == inQuery.SubjectId) - //.WhereIf(inQuery.TaskState != null, t => t.TaskState == inQuery.TaskState) - //.WhereIf(inQuery.IsSelfAnalysis != null, t => t.IsSelfAnalysis == inQuery.IsSelfAnalysis) - - .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!.Value.AddDays(1)); - - var exportInfo = (await _trialRepository.Where(t => t.Id == inQuery.TrialId).IgnoreQueryFilters().ProjectTo(_mapper.ConfigurationProvider).FirstOrDefaultAsync()).IfNullThrowException(); - exportInfo.CriterionName = criterion.CriterionName; - - if (criterion.CriterionType == CriterionType.RECIST1Point1 || criterion.CriterionType == CriterionType.RECIST1Pointt1_MB) - { - var list = await query.ProjectTo(_mapper.ConfigurationProvider, new { criterionType = criterion.CriterionType, arbitrationRule = criterion.ArbitrationRule, trialReadingCriterionId = inQuery.TrialReadingCriterionId }).ToListAsync(); - - list = list.OrderBy(t => t.SubjectCode).ThenBy(t => t.ArmEnum).ThenBy(t => t.VisitTaskNum).ToList(); - - //处理裁判标记 - 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); - - - return await ExcelExportHelper.DataExportAsync(StaticData.Export.RECIST1Point1EvaluationOfTumorEfficacy_Export, exportInfo, $"{exportInfo.ResearchProgramNo}_{exportInfo.CriterionName}", _commonDocumentRepository, _hostEnvironment, _dictionaryService, typeof(RECIST1Point1EvaluationOfTumorEfficacyExport), criterion.CriterionType); - } - - else if (criterion.CriterionType == CriterionType.Lugano2014 /*|| criterion.CriterionType == CriterionType.Lugano2014WithoutPET*/) - { - var list = await query.ProjectTo(_mapper.ConfigurationProvider, new { criterionType = criterion.CriterionType, arbitrationRule = criterion.ArbitrationRule, trialReadingCriterionId = inQuery.TrialReadingCriterionId }).ToListAsync(); - - list = list.OrderBy(t => t.SubjectCode).ThenBy(t => t.ArmEnum).ThenBy(t => t.VisitTaskNum).ToList(); - - //处理裁判标记 - 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); - - return await ExcelExportHelper.DataExportAsync(StaticData.Export.Lugano2014EvaluationOfTumorEfficacy_Export, exportInfo, $"{exportInfo.ResearchProgramNo}_{exportInfo.CriterionName}", _commonDocumentRepository, _hostEnvironment, _dictionaryService, typeof(Lugano2014EvaluationOfTumorEfficacyExport), criterion.CriterionType); - - } - else if (criterion.CriterionType == CriterionType.IRECIST1Point1) - { - var list = await query.ProjectTo(_mapper.ConfigurationProvider, new { criterionType = criterion.CriterionType, arbitrationRule = criterion.ArbitrationRule, trialReadingCriterionId = inQuery.TrialReadingCriterionId }).ToListAsync(); - - list = list.OrderBy(t => t.SubjectCode).ThenBy(t => t.ArmEnum).ThenBy(t => t.VisitTaskNum).ToList(); - - //处理裁判标记 - 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); - - return await ExcelExportHelper.DataExportAsync(StaticData.Export.IRECIST1Point1EvaluationOfTumorEfficacy_Export, exportInfo, $"{exportInfo.ResearchProgramNo}_{exportInfo.CriterionName}", _commonDocumentRepository, _hostEnvironment, _dictionaryService, typeof(IRECIST1Point1EvaluationOfTumorEfficacyExport), criterion.CriterionType); - - } - - else - { - //---当前标准导出还未支持 - throw new Exception(_localizer["ExcelExport_UnsupportedExport"]); - } - - - } - - + #region 历史单独导出废弃 /// /// 评估病灶明细表 (目前仅仅 RECIST1.1 RECIST1.1 PGW3 表都是不同的) /// @@ -1944,7 +1777,7 @@ namespace IRaCIS.Core.Application.Service.Common }).ToList(); //处理裁判标记 - list = DealJudgeMark(criterion.ArbitrationRule, list); + //list = DealJudgeMark(criterion.ArbitrationRule, list); exportInfo.List = ExportExcelConverterDate.ConvertToClientTimeInObject(exportList, _userInfo.TimeZoneId); exportInfo.CurrentTime = ExportExcelConverterDate.DateTimeInternationalToString(DateTime.Now, _userInfo.TimeZoneId); @@ -1978,7 +1811,7 @@ namespace IRaCIS.Core.Application.Service.Common }).ToList(); //处理裁判标记 - list = DealJudgeMark(criterion.ArbitrationRule, list); + //list = DealJudgeMark(criterion.ArbitrationRule, list); exportInfo.List = ExportExcelConverterDate.ConvertToClientTimeInObject(exportList, _userInfo.TimeZoneId); ; exportInfo.CurrentTime = ExportExcelConverterDate.DateTimeInternationalToString(DateTime.Now, _userInfo.TimeZoneId); @@ -1996,6 +1829,11 @@ namespace IRaCIS.Core.Application.Service.Common } + #endregion + + + + @@ -2005,7 +1843,7 @@ namespace IRaCIS.Core.Application.Service.Common #region 通用阅片结果导出 /// - /// 裁判阅片明细表 + /// 病灶明细表 /// /// /// @@ -2013,8 +1851,7 @@ namespace IRaCIS.Core.Application.Service.Common /// /// [HttpPost] - [Obsolete] - public async Task GetCommonJudgeEvaluationList_Export(VisitTaskQuery inQuery, + public async Task GetEvaluationLessionList_Export(VisitTaskQuery inQuery, [FromServices] IRepository _commonDocumentRepository, [FromServices] IDictionaryService _dictionaryService, [FromServices] IRepository _trialRepository) @@ -2023,33 +1860,29 @@ namespace IRaCIS.Core.Application.Service.Common 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) - - //访视和全局查询已签名完成的,裁判可以是未签名,未完成的 - .Where(t => (t.ReadingTaskState == ReadingTaskState.HaveSigned && (t.ReadingCategory == ReadingCategory.Visit || t.ReadingCategory == ReadingCategory.Global)) || (t.ReadingCategory == ReadingCategory.Judge)) - //.WhereIf(inQuery.SubjectId != null, t => t.SubjectId == inQuery.SubjectId) - //.WhereIf(inQuery.TaskState != null, t => t.TaskState == inQuery.TaskState) - //.WhereIf(inQuery.IsSelfAnalysis != null, t => t.IsSelfAnalysis == inQuery.IsSelfAnalysis) + 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.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!.Value.AddDays(1)) - .ProjectTo(_mapper.ConfigurationProvider, new { criterionType = criterion.CriterionType, arbitrationRule = criterion.ArbitrationRule, trialReadingCriterionId = inQuery.TrialReadingCriterionId, isEn_Us = _userInfo.IsEn_Us }).ToListAsync(); + .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; @@ -2060,15 +1893,35 @@ 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); - var dynamicColumnConfig = new DynamicColumnConfig() { AutoColumnTitleRowIndex = 2, AutoColumnStartIndex = 6, ColumnNameList = list.FirstOrDefault()?.QuestionAnswerList.Select(t => t.QuestionName).ToList() }; + 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.CommonJudgeReadingDetail_Export, exportInfo, _commonDocumentRepository, _hostEnvironment, _dictionaryService, typeof(CommonEvaluationExport), criterion.CriterionType, dynamicColumnConfig); + + + + + + 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" }; + + + + } /// /// 获取阅片标准可以导出的列表 @@ -2141,7 +1994,7 @@ namespace IRaCIS.Core.Application.Service.Common } /// - /// 通用阅片结果、阅片结果明细,裁判明细表导出,条件通过 ReadingExportType ( 0,1,2)区分 + /// 阅片结果表、阅片结果明细,评估病灶明细表, 裁判明细表导出,条件通过 ReadingExportType ( 1,2,3,4)区分 /// /// /// @@ -2158,7 +2011,7 @@ namespace IRaCIS.Core.Application.Service.Common 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)) + var query = _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) @@ -2175,14 +2028,16 @@ namespace IRaCIS.Core.Application.Service.Common .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(); + .WhereIf(inQuery.EndAllocateDate != null, t => t.AllocateTime < inQuery.EndAllocateDate); - list = list.OrderBy(t => t.SubjectCode).ThenBy(t => t.ArmEnum).ThenBy(t => t.VisitTaskNum).ToList(); + + var list = new List(); + + #region 区分导表类型 var export_Template = StaticData.Export.CommonReading_Export; - if (inQuery.ReadingExportType == ReadingExportType.JudgeReadingDetailResult) + if (inQuery.ReadingExportType == ExportResult.DetailedTableOfAdjudicationResults) { //R1 R2 两个人的访视都阅片完成了才可以,去除只有一个人阅片完成的访视 @@ -2190,12 +2045,103 @@ namespace IRaCIS.Core.Application.Service.Common var exceptVisit = list.GroupBy(t => new { t.SubjectCode, t.TaskName }).Where(g => g.Count() == 1).Select(g => new { g.Key.SubjectCode, g.Key.TaskName }).ToList(); list = list.Where(t => !exceptVisit.Any(ev => ev.SubjectCode == t.SubjectCode && ev.TaskName == t.TaskName)).ToList(); + //裁判明表 export_Template = StaticData.Export.CommonJudgeReadingDetail_Export; } - if (inQuery.ReadingExportType == ReadingExportType.ReadingDetailResult) + else if (inQuery.ReadingExportType == ExportResult.DetailedTableOfAssessmentResults) { + //阅片明细表 export_Template = StaticData.Export.CommonReadingDetail_Export; } + else if (inQuery.ReadingExportType == ExportResult.DetailedTableOfLesions) + { + //病灶明细表 + export_Template = StaticData.Export.ReadingLession_Export; + } + + if (inQuery.ReadingExportType != ExportResult.DetailedTableOfLesions) + { + list = await query.ProjectTo(_mapper.ConfigurationProvider, + new + { + readingExportType = inQuery.ReadingExportType, + criterionType = criterion.CriterionType, + arbitrationRule = criterion.ArbitrationRule, + trialReadingCriterionId = inQuery.TrialReadingCriterionId, + isEn_Us = _userInfo.IsEn_Us + }).ToListAsync(); + } + else + { + var taskList = await query.ProjectTo(_mapper.ConfigurationProvider, + new + { + readingExportType = inQuery.ReadingExportType, + criterionType = criterion.CriterionType, + arbitrationRule = criterion.ArbitrationRule, + trialReadingCriterionId = inQuery.TrialReadingCriterionId, + 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(); + + dynamicExtraAddTitleList.Add(new DymamicQuestionInfo() { QuestionName = _userInfo.IsEn_Us ? "Lesion ID" : "病灶编号" }); + 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(); + + + foreach (var item in taskList) + { + + foreach (var lession in item.LesionList) + { + var firstLessionAnser = lession.LessionAnswerList.FirstOrDefault() ?? new CommonLessionQuestionAnswerInfo(); + + 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" }); + + + 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(); + + var cloneItem = item.Clone(); + cloneItem.QuestionAnswerList = dynamicLessionInfoList; + + list.Add(cloneItem); + } + + + } + + } + + #endregion + + + list = list.OrderBy(t => t.SubjectCode).ThenBy(t => t.ArmEnum).ThenBy(t => t.VisitTaskNum).ToList(); + var exportInfo = (await _trialRepository.Where(t => t.Id == inQuery.TrialId).IgnoreQueryFilters().ProjectTo(_mapper.ConfigurationProvider).FirstOrDefaultAsync()).IfNullThrowException(); exportInfo.CriterionName = criterion.CriterionName; @@ -2206,7 +2152,7 @@ namespace IRaCIS.Core.Application.Service.Common #region 系统标准处理整体肿瘤评估合并 - var translateDicNameList = list.FirstOrDefault()?.QuestionAnswerList.Select(t => t.TranslateDicName).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) @@ -2274,7 +2220,6 @@ 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); @@ -2292,13 +2237,8 @@ namespace IRaCIS.Core.Application.Service.Common }; - - - - var (memoryStream, fileName) = await ExcelExportHelper.DataExport_NpoiTestAsync(export_Template, 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" diff --git a/IRaCIS.Core.Application/Service/QC/DTO/QCListViewModel.cs b/IRaCIS.Core.Application/Service/QC/DTO/QCListViewModel.cs index 13bebe768..1c9a78fe5 100644 --- a/IRaCIS.Core.Application/Service/QC/DTO/QCListViewModel.cs +++ b/IRaCIS.Core.Application/Service/QC/DTO/QCListViewModel.cs @@ -1057,6 +1057,12 @@ namespace IRaCIS.Core.Application.Contracts } + public class DymamicQuestionInfo + { + public QuestionMark? QuestionMark { get; set; } + public string QuestionName { get; set; } + public string TranslateDicName { get; set; } + } public class CommonQuesionInfo @@ -1069,9 +1075,90 @@ namespace IRaCIS.Core.Application.Contracts public string TranslateDicName { get; set; } } - public class CommonEvaluationExport : OverallTumorEvaluationExport + public class CommonEvaluationExport { public List QuestionAnswerList { get; set; } + + public String TrialSiteCode { get; set; } = String.Empty; + public string SubjectCode { get; set; } = String.Empty; + + public Guid Id { get; set; } + + public Guid? DoctorUserId { get; set; } + + public string TaskName { get; set; } + public string TaskBlindName { get; set; } + + public decimal VisitTaskNum { get; set; } + + public bool? IsBaseline { get; set; } + + + [DictionaryTranslateAttribute("ArmEnum")] + public Arm ArmEnum { get; set; } + public string UserName { get; set; } + + public ReadingTaskState ReadingTaskState { get; set; } + + public ReadingCategory ReadingCategory { get; set; } + + //裁判结果选择的访视或者全局任务Id + public Arm? JudgeArmEnum { get; set; } + + //裁判选择标记 + //根据裁判的任务结果 设置访视任务的这个字段 该字段表示 裁判认同该任务的结果 + [DictionaryTranslateAttribute("YesOrNo")] + public bool? IsJudgeSelect { get; set; } + + + //在当前访视触发裁判,或者在截止日期小于等于当前访视的阅片期触发裁判 + [DictionaryTranslateAttribute("YesOrNo")] + public bool IsTrigerJudge { get; set; } + + //(如果是访视点裁判,则仅在所选阅片人对应访视 显示;如果是阅片期裁判,则在所选阅片人 阅片期内的所有访视 显示此原因) + public string JudgeNote { get; set; } = string.Empty; + + public string VisitNote { get; set; } + } + + public class CommonLessionExport : CommonEvaluationExport + { + /// + /// 最终导出的病灶信息 + /// + public List LessionAnswerList { get; set; } + + + [JsonIgnore] + public List LesionList { get; set; } = new List(); + } + + public class CommonLessionInfo + { + //病灶编号 + public string LessionCode { get; set; } + + public string LessionType { get; set; } + + //病灶答案 + public List LessionAnswerList { get; set; } + + } + + public class CommonLessionQuestionAnswerInfo + { + public string LessionCode { get; set; } + + public string LessionType { get; set; } + + + public QuestionMark? QuestionMark { get; set; } + + public string QuestionName { get; set; } + + public string QuestionValue { get; set; } + + public string TranslateDicName { get; set; } } @@ -1146,7 +1233,7 @@ namespace IRaCIS.Core.Application.Contracts //在当前访视触发裁判,或者在截止日期小于等于当前访视的阅片期触发裁判 - [DictionaryTranslateAttribute("YesOrNo")] + [DictionaryTranslateAttribute("YesOrNo")] public bool IsTrigerJudge { get; set; } //(如果是访视点裁判,则仅在所选阅片人对应访视 显示;如果是阅片期裁判,则在所选阅片人 阅片期内的所有访视 显示此原因) diff --git a/IRaCIS.Core.Application/Service/QC/_MapConfig.cs b/IRaCIS.Core.Application/Service/QC/_MapConfig.cs index a92fa377a..203f7dc45 100644 --- a/IRaCIS.Core.Application/Service/QC/_MapConfig.cs +++ b/IRaCIS.Core.Application/Service/QC/_MapConfig.cs @@ -200,7 +200,7 @@ namespace IRaCIS.Core.Application.Service Guid trialReadingCriterionId = Guid.Empty; ArbitrationRule? arbitrationRule = null; CriterionType? criterionType = null; - ReadingExportType? readingExportType = null; + ExportResult readingExportType = ExportResult.None; CreateMap() // .ForMember(o => o.TrialReadingCriterionName, t => t.MapFrom(u => u.TrialReadingCriterion.CriterionName)) @@ -242,10 +242,7 @@ namespace IRaCIS.Core.Application.Service .ForMember(o => o.SubjectCode, t => t.MapFrom(u => u.Subject.Code)) .ForMember(o => o.UserName, t => t.MapFrom(u => u.DoctorUser.UserName)) .ForMember(o => o.QuestionAnswerList, t => t.MapFrom(u => u.ReadingTaskQuestionAnswerList - .Where(c => readingExportType == ReadingExportType.ReadingResult ? - c.ReadingQuestionTrial.ExportResultStr.Contains(((int)ExportResult.TableOfAssessmentResults).ToString()) : - (readingExportType == ReadingExportType.ReadingDetailResult ? c.ReadingQuestionTrial.ExportResultStr.Contains(((int)ExportResult.DetailedTableOfAssessmentResults).ToString()) : - c.ReadingQuestionTrial.ExportResultStr.Contains(((int)ExportResult.DetailedTableOfAdjudicationResults).ToString()))) + .Where(c => c.ReadingQuestionTrial.ExportResultStr.Contains(((int)readingExportType).ToString())) .OrderBy(k => k.ReadingQuestionTrial.ShowOrder) .Select(c => new CommonQuesionInfo() { @@ -256,6 +253,23 @@ namespace IRaCIS.Core.Application.Service }))) ; + CreateMap().IncludeBase() + .ForMember(o => o.LesionList, t => t.MapFrom(u => u.LesionList)); + + CreateMap() + .ForMember(o => o.LessionCode, t => t.MapFrom(u => u.RowMark)) + .ForMember(o => o.LessionType, t => t.MapFrom(u => (int?)u.ReadingQuestionTrial.LesionType)) + .ForMember(o => o.LessionAnswerList, t => t.MapFrom(u => u.LesionAnswerList)); + + 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.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)) + .ForMember(o => o.TranslateDicName, t => t.MapFrom(u => u.ReadingTableQuestionTrial.DictionaryCode)) + ; + CreateMap().IncludeBase() .ForMember(o => o.TargetlesionEvaluationResult, t => t.MapFrom(u => u.ReadingTaskQuestionAnswerList.Where(c => c.ReadingQuestionTrial.QuestionType == QuestionType.TargetLesion).FirstOrDefault()!.Answer)) diff --git a/IRaCIS.Core.Domain.Share/Reading/ReadEnum.cs b/IRaCIS.Core.Domain.Share/Reading/ReadEnum.cs index cdaf1ce05..2a70c97ac 100644 --- a/IRaCIS.Core.Domain.Share/Reading/ReadEnum.cs +++ b/IRaCIS.Core.Domain.Share/Reading/ReadEnum.cs @@ -402,20 +402,27 @@ namespace IRaCIS.Core.Domain.Share /// DetailedTableOfAssessmentResults = 2, + + /// + /// 评估病灶明细表 + /// + DetailedTableOfLesions = 3, + /// /// 裁判阅片明细表 /// - DetailedTableOfAdjudicationResults = 3, + DetailedTableOfAdjudicationResults = 4, + /// /// 自身一致性分析结果表 /// - DetailedTableOfIntraReaderAnalysisResults = 4, + DetailedTableOfIntraReaderAnalysisResults = 5, /// /// 组间一致性分析结果表 /// - DetailedTableOfInterReaderAnalysisResults = 5, + DetailedTableOfInterReaderAnalysisResults = 6, } diff --git a/IRaCIS.Core.Domain/Allocation/VisitTask.cs b/IRaCIS.Core.Domain/Allocation/VisitTask.cs index b0773e59c..b0331aa99 100644 --- a/IRaCIS.Core.Domain/Allocation/VisitTask.cs +++ b/IRaCIS.Core.Domain/Allocation/VisitTask.cs @@ -42,9 +42,6 @@ public class VisitTask : BaseFullAuditEntity [JsonIgnore] public List LesionList { get; set; } = new List(); - [Comment("病灶答案表")] - [JsonIgnore] - public List LesionAnswerList { get; set; } = new List(); [Comment("重阅或者退回影像的记录中间表")] [JsonIgnore] public List TaskInfluenceList { get; set; } = new List(); diff --git a/IRaCIS.Core.Infrastructure/_IRaCIS/_Config/_StaticData.cs b/IRaCIS.Core.Infrastructure/_IRaCIS/_Config/_StaticData.cs index e437bdf91..6b6add65e 100644 --- a/IRaCIS.Core.Infrastructure/_IRaCIS/_Config/_StaticData.cs +++ b/IRaCIS.Core.Infrastructure/_IRaCIS/_Config/_StaticData.cs @@ -272,6 +272,8 @@ public static class StaticData public const string ReadingPeriodJudgeRatio_Export = "ReadingPeriodJudgeRatio_Export"; + public const string ReadingLession_Export = "ReadingLession_Export"; + public const string IVUSTheMeasuredValueOfEachMatchedFragment = "IVUS_TheMeasuredValueOfEachMatchedFragment";