Merge branch 'Test_IRC_Net8' of https://gitea.frp.extimaging.com/XCKJ/irc-netcore-api into Test_IRC_Net8
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
commit
2d1e2f53ee
|
@ -12,11 +12,14 @@ using IRaCIS.Core.Infra.EFCore.Migrations;
|
|||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Internal;
|
||||
using NPOI.HPSF;
|
||||
using NPOI.POIFS.Properties;
|
||||
using NPOI.SS.Formula.Functions;
|
||||
using NPOI.XSSF.UserModel;
|
||||
using System.ComponentModel.Design;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using static IRaCIS.Core.Application.Service.ExcelExportHelper;
|
||||
using IDictionaryService = IRaCIS.Application.Interfaces.IDictionaryService;
|
||||
|
@ -2199,6 +2202,8 @@ namespace IRaCIS.Core.Application.Service.Common
|
|||
|
||||
var list = new List<CommonEvaluationExport>();
|
||||
|
||||
var taskList = new List<CommonLessionExport>();
|
||||
|
||||
#region 区分导表类型
|
||||
|
||||
var removeColumnIndexList = new List<int>() { };
|
||||
|
@ -2284,78 +2289,7 @@ namespace IRaCIS.Core.Application.Service.Common
|
|||
)
|
||||
{
|
||||
|
||||
var taskList = await query.ProjectTo<CommonLessionExport>(_mapper.ConfigurationProvider,
|
||||
new
|
||||
{
|
||||
readingExportType = inQuery.ReadingExportType,
|
||||
criterionType = criterion.CriterionType,
|
||||
arbitrationRule = criterion.ArbitrationRule,
|
||||
trialReadingCriterionId = inQuery.TrialReadingCriterionId,
|
||||
isEn_Us = _userInfo.IsEn_Us
|
||||
}).ToListAsync();
|
||||
|
||||
|
||||
|
||||
//最终的病灶列表 要把裁判的也要加进去,需要处理裁判标记
|
||||
list = new List<CommonEvaluationExport>();
|
||||
|
||||
|
||||
foreach (var item in taskList.OrderBy(t => t.SubjectCode).ThenBy(t => t.ArmEnum).ThenBy(t => t.VisitTaskNum))
|
||||
{
|
||||
if (item.LesionList.Count > 0)
|
||||
{
|
||||
foreach (var lession in item.LesionList.OrderBy(t => t.LessionType).ThenBy(t => t.LessionCode))
|
||||
{
|
||||
|
||||
var addLessionInfoList = new List<CommonQuesionInfo>();
|
||||
|
||||
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 = 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 = 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();
|
||||
|
||||
//OCT 多个表格,但是只导出一个表格,有的问题答案就是空的
|
||||
if (dynamicLessionInfoList.Count > 0)
|
||||
{
|
||||
|
||||
var cloneItem = item.Clone();
|
||||
cloneItem.QuestionAnswerList = dynamicLessionInfoList;
|
||||
|
||||
list.Add(cloneItem);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//要把裁判任务加进去 裁判任务上没有病灶
|
||||
|
||||
list.Add(item);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
// 非肿瘤标准 包括自定义,以及系统非肿瘤 会配置到表格层级 问题名称是 表格名称_表格子问题名
|
||||
else if (
|
||||
criterion.CriterionGroup == CriterionGroup.Nontumorous && inQuery.ReadingExportType != ExportResult.CDISC
|
||||
)
|
||||
{
|
||||
|
||||
// 配置在外层问题 或者表格问题上
|
||||
var taskList = await query.ProjectTo<CommonLessionExport>(_mapper.ConfigurationProvider,
|
||||
taskList = await query.ProjectTo<CommonLessionExport>(_mapper.ConfigurationProvider,
|
||||
new
|
||||
{
|
||||
readingExportType = inQuery.ReadingExportType,
|
||||
|
@ -2365,53 +2299,23 @@ 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<CommonLessionQuestionAnswerInfo>();
|
||||
}
|
||||
// 非肿瘤标准 包括自定义,以及系统非肿瘤 会配置到表格层级 问题名称是 表格名称_表格子问题名
|
||||
else if (
|
||||
criterion.CriterionGroup == CriterionGroup.Nontumorous && inQuery.ReadingExportType != ExportResult.CDISC
|
||||
)
|
||||
{
|
||||
|
||||
//通过问题标识取并集
|
||||
|
||||
var dynamicTitleList = lessionAnserList.Select(t => new DymamicQuestionInfo { QuestionMark = t.QuestionMark, QuestionName = t.QuestionName, TranslateDicName = t.TranslateDicName }).Distinct().ToList();
|
||||
|
||||
//最终的病灶列表 要把裁判的也要加进去,需要处理裁判标记
|
||||
list = new List<CommonEvaluationExport>();
|
||||
|
||||
foreach (var item in taskList.OrderBy(t => t.SubjectCode).ThenBy(t => t.ArmEnum).ThenBy(t => t.VisitTaskNum))
|
||||
{
|
||||
//有病灶,并且至少配置了一个病灶问题
|
||||
if (item.LesionList.Count > 0 && item.LesionList.SelectMany(t => t.LessionAnswerList).Any())
|
||||
{
|
||||
foreach (var lession in item.LesionList.OrderBy(t => t.LessionType).ThenBy(t => t.LessionCode))
|
||||
{
|
||||
//病灶配置了问题 才进行导出
|
||||
if (lession.LessionAnswerList.Count > 0)
|
||||
{
|
||||
var firstLessionAnser = lession.LessionAnswerList.FirstOrDefault();
|
||||
var addLessionInfoList = new List<CommonQuesionInfo>();
|
||||
|
||||
addLessionInfoList.Add(new CommonQuesionInfo() { QuestionName = _userInfo.IsEn_Us ? "Table Name" : "表格名称", QuestionValue = firstLessionAnser.TableQuestionName });
|
||||
|
||||
var dynamicPartialLessionInfoList = lession.LessionAnswerList.Select(t => new CommonQuesionInfo() { QuestionName = t.TableQuestionName + "_" + t.QuestionName, QuestionValue = t.QuestionValue, TranslateDicName = t.TranslateDicName, CDISCCode = t.CDISCCode });
|
||||
|
||||
//有三部分组成 外层问题+ 固定列表格名称 + 动态的表格问题
|
||||
var dynamicLessionInfoList = item.QuestionAnswerList.Union(addLessionInfoList).Union(dynamicPartialLessionInfoList).ToList();
|
||||
|
||||
|
||||
var cloneItem = item.Clone();
|
||||
cloneItem.QuestionAnswerList = dynamicLessionInfoList;
|
||||
list.Add(cloneItem);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//要把裁判任务加进去 裁判任务上没有病灶
|
||||
|
||||
list.Add(item);
|
||||
}
|
||||
|
||||
}
|
||||
// 配置在外层问题 或者表格问题上
|
||||
taskList = await query.ProjectTo<CommonLessionExport>(_mapper.ConfigurationProvider,
|
||||
new
|
||||
{
|
||||
readingExportType = inQuery.ReadingExportType,
|
||||
criterionType = criterion.CriterionType,
|
||||
arbitrationRule = criterion.ArbitrationRule,
|
||||
trialReadingCriterionId = inQuery.TrialReadingCriterionId,
|
||||
isEn_Us = _userInfo.IsEn_Us
|
||||
}).ToListAsync();
|
||||
|
||||
}
|
||||
// CDISC 导出 只管到 外层问题层级 和阅片结果表是保持一致
|
||||
|
@ -2432,135 +2336,319 @@ namespace IRaCIS.Core.Application.Service.Common
|
|||
#endregion
|
||||
|
||||
|
||||
list = list.OrderBy(t => t.SubjectCode).ThenBy(t => t.ArmEnum).ThenBy(t => t.VisitTaskNum).ToList();
|
||||
|
||||
//处理裁判标记
|
||||
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();
|
||||
|
||||
|
||||
if (inQuery.ReadingExportType != ExportResult.CDISC)
|
||||
{
|
||||
#region 系统标准处理整体肿瘤评估合并
|
||||
|
||||
//针对1.1 整体肿瘤评估 有的两列要合并一列
|
||||
if (criterion.CriterionType == CriterionType.RECIST1Point1 || criterion.CriterionType == CriterionType.RECIST1Pointt1_MB || criterion.CriterionType == CriterionType.IRECIST1Point1)
|
||||
{
|
||||
foreach (var item in list)
|
||||
{
|
||||
//处理合并表头
|
||||
|
||||
var questionType = item.IsBaseline == true ? QuestionType.ExistDisease : QuestionType.Tumor;
|
||||
|
||||
var findItem = item.QuestionAnswerList.Where(t => t.QuestionType == questionType).FirstOrDefault();
|
||||
|
||||
if (findItem != null)
|
||||
{
|
||||
findItem.QuestionName = _userInfo.IsEn_Us ? "Overall Response" : "整体肿瘤评估";
|
||||
}
|
||||
|
||||
|
||||
if (item.IsBaseline == true)
|
||||
{
|
||||
item.QuestionAnswerList = item.QuestionAnswerList.Where(t => t.QuestionType != QuestionType.Tumor).ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
item.QuestionAnswerList = item.QuestionAnswerList.Where(t => t.QuestionType != QuestionType.ExistDisease).ToList();
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (criterion.CriterionType == CriterionType.Lugano2014 || criterion.CriterionType == CriterionType.Lugano2014WithoutPET)
|
||||
{
|
||||
|
||||
foreach (var item in list)
|
||||
{
|
||||
//处理合并表头
|
||||
|
||||
var questionType = item.IsBaseline == true ? QuestionType.ExistDisease : QuestionType.ImgOncology;
|
||||
|
||||
var findItem = item.QuestionAnswerList.Where(t => t.QuestionType == questionType).FirstOrDefault();
|
||||
|
||||
if (findItem != null)
|
||||
{
|
||||
findItem.QuestionName = _userInfo.IsEn_Us ? "Overall Response" : "整体肿瘤评估";
|
||||
}
|
||||
|
||||
if (item.IsBaseline == true)
|
||||
{
|
||||
item.QuestionAnswerList = item.QuestionAnswerList.Where(t => t.QuestionType != QuestionType.ImgOncology).ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
item.QuestionAnswerList = item.QuestionAnswerList.Where(t => t.QuestionType != QuestionType.ExistDisease).ToList();
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (criterion.CriterionType == CriterionType.PCWG3)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
if (export_Template == StaticData.Export.CommonJudgeReadingDetail_Export)
|
||||
{
|
||||
//裁判产生标记为空的数据过滤掉
|
||||
list = list.Where(t => t.IsTrigerJudge != null).ToList();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
var exportInfo = (await _trialRepository.Where(t => t.Id == inQuery.TrialId).IgnoreQueryFilters().ProjectTo<ExcelExportInfo>(_mapper.ConfigurationProvider).FirstOrDefaultAsync()).IfNullThrowException();
|
||||
exportInfo.CriterionName = criterion.CriterionName;
|
||||
|
||||
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
|
||||
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 ExportQuestionBasicInfo()
|
||||
{
|
||||
QuestionId = t.Id,
|
||||
QuestionType = t.QuestionType,
|
||||
TableName = "",
|
||||
QuestionName = _userInfo.IsEn_Us ? t.QuestionEnName : t.QuestionName,
|
||||
t.CDISCCode,
|
||||
CDISCCode = 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)
|
||||
{
|
||||
//最终EXCEL 列
|
||||
var configCoumNameList = new List<string>();
|
||||
|
||||
//之前从问题答案取 合并之后获取最后的列名
|
||||
//var columNameList = list.SelectMany(t => t.QuestionAnswerList).Where(t => t.QuestionName.IsNotNullOrEmpty()).Select(t => t.QuestionName).Distinct().ToList();
|
||||
//最终翻译字典
|
||||
var translateDicNameList = new List<string>();
|
||||
|
||||
|
||||
//表格全问题名
|
||||
var trialConfigTableQuestionList = _trialReadingTableQuestionRepository.Where(t => t.TrialId == trialId && t.TrialCriterionId == trialReadingCriterionId).Where(t => t.ExportResultStr.Contains(((int)inQuery.ReadingExportType).ToString()))
|
||||
.OrderBy(t => t.ShowOrder).Select(t => new ExportQuestionBasicInfo()
|
||||
{
|
||||
QuestionId = t.Id,
|
||||
TableName = _userInfo.IsEn_Us ? t.ReadingQuestionTrial.QuestionEnName : t.ReadingQuestionTrial.QuestionName,
|
||||
QuestionName = _userInfo.IsEn_Us ? t.QuestionEnName : t.QuestionName,
|
||||
CDISCCode = t.CDISCCode,
|
||||
TranslateDicName = t.DictionaryCode
|
||||
}).ToList();
|
||||
|
||||
#region 外层问题 可能存在合并
|
||||
|
||||
var fistLeveLNameList = new List<string>();
|
||||
|
||||
//肿瘤评估,非CDISC 导出
|
||||
if (criterion.CriterionGroup == CriterionGroup.Tumor)
|
||||
{
|
||||
if (criterion.CriterionType == CriterionType.RECIST1Point1 || criterion.CriterionType == CriterionType.RECIST1Pointt1_MB || criterion.CriterionType == CriterionType.IRECIST1Point1)
|
||||
{
|
||||
|
||||
fistLeveLNameList = trialConfigQuestionList.Select(t =>
|
||||
(t.QuestionType == QuestionType.ExistDisease || t.QuestionType == QuestionType.Tumor) ? (_userInfo.IsEn_Us ? "Overall Response" : "整体肿瘤评估") : t.QuestionName).Distinct().ToList();
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
else if (criterion.CriterionType == CriterionType.Lugano2014 || criterion.CriterionType == CriterionType.Lugano2014WithoutPET)
|
||||
{
|
||||
fistLeveLNameList = trialConfigQuestionList.Select(t =>
|
||||
(t.QuestionType == QuestionType.ExistDisease || t.QuestionType == QuestionType.ImgOncology) ? (_userInfo.IsEn_Us ? "Overall Response" : "整体肿瘤评估") : t.QuestionName).Distinct().ToList();
|
||||
|
||||
}
|
||||
else if (criterion.CriterionType == CriterionType.PCWG3)
|
||||
{
|
||||
fistLeveLNameList = trialConfigQuestionList.Select(t => t.QuestionName).ToList();
|
||||
}
|
||||
|
||||
var exTralDicNameList = new List<string>() { "LesionType" };
|
||||
|
||||
translateDicNameList = trialConfigQuestionList.Union(trialConfigTableQuestionList).Where(t => t.TranslateDicName.IsNotNullOrEmpty()).Select(t => t.TranslateDicName).Union(exTralDicNameList).Distinct().ToList();
|
||||
}
|
||||
else
|
||||
//非肿瘤评估,非CDISC 导出
|
||||
{
|
||||
fistLeveLNameList = trialConfigQuestionList.Select(t => t.QuestionName).ToList();
|
||||
|
||||
translateDicNameList = trialConfigQuestionList.Union(trialConfigTableQuestionList).Where(t => t.TranslateDicName.IsNotNullOrEmpty()).Select(t => t.TranslateDicName).Distinct().ToList();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 表格问题 处理增加列
|
||||
|
||||
//肿瘤 表格问题直接去重、同时添加一些列 外层问题合并一些列
|
||||
if (criterion.CriterionGroup == CriterionGroup.Tumor)
|
||||
{
|
||||
var extralNameList = new List<string>() { };
|
||||
|
||||
if (criterion.CriterionType == CriterionType.RECIST1Point1 || criterion.CriterionType == CriterionType.RECIST1Pointt1_MB
|
||||
|| criterion.CriterionType == CriterionType.IRECIST1Point1 || criterion.CriterionType == CriterionType.Lugano2014 || criterion.CriterionType == CriterionType.Lugano2014WithoutPET)
|
||||
{
|
||||
|
||||
//if(inQuery.ReadingExportType == ExportResult.DetailedTableOfLesions)
|
||||
{
|
||||
extralNameList.Add(_userInfo.IsEn_Us ? "Lesion ID" : "病灶编号");
|
||||
extralNameList.Add(_userInfo.IsEn_Us ? "Lesion Type" : "病灶类型");
|
||||
}
|
||||
|
||||
}
|
||||
else if (criterion.CriterionType == CriterionType.PCWG3)
|
||||
{
|
||||
//if (inQuery.ReadingExportType == ExportResult.DetailedTableOfLesions)
|
||||
{
|
||||
extralNameList.Add(_userInfo.IsEn_Us ? "Lesion Type" : "病灶类型");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
//肿瘤评估标准目前是去重
|
||||
var tableQuestionNameList = trialConfigTableQuestionList.Select(t => t.QuestionName).Distinct().ToList();
|
||||
|
||||
//有表格问题 那么就是三部分,否则就是外层问题
|
||||
configCoumNameList = tableQuestionNameList.Count == 0 ? fistLeveLNameList : fistLeveLNameList.Union(extralNameList).Union(tableQuestionNameList).ToList();
|
||||
|
||||
|
||||
#region 扩展病灶
|
||||
|
||||
|
||||
//最终的病灶列表 要把裁判的也要加进去,需要处理裁判标记
|
||||
|
||||
foreach (var item in taskList.OrderBy(t => t.SubjectCode).ThenBy(t => t.ArmEnum).ThenBy(t => t.VisitTaskNum))
|
||||
{
|
||||
if (item.LesionList.Count > 0)
|
||||
{
|
||||
foreach (var lession in item.LesionList.OrderBy(t => t.LessionType).ThenBy(t => t.LessionCode))
|
||||
{
|
||||
|
||||
var addLessionInfoList = new List<CommonQuesionInfo>();
|
||||
|
||||
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 = 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 = lession.LessionType, TranslateDicName = "LesionType" });
|
||||
}
|
||||
|
||||
var dynamicPartialLessionInfoList = lession.LessionAnswerList.Select(t => new CommonQuesionInfo() { QuestionName = t.QuestionName, QuestionValue = t.QuestionValue, TranslateDicName = t.TranslateDicName });
|
||||
|
||||
//有三部分组成 外层问题+ 没有配置病灶编号和类型+ 动态的表格问题
|
||||
var dynamicLessionInfoList = item.QuestionAnswerList.Union(addLessionInfoList).Union(dynamicPartialLessionInfoList).ToList();
|
||||
|
||||
//OCT 多个表格,但是只导出一个表格,有的问题答案就是空的
|
||||
if (dynamicLessionInfoList.Count > 0)
|
||||
{
|
||||
|
||||
var cloneItem = item.Clone();
|
||||
cloneItem.QuestionAnswerList = dynamicLessionInfoList;
|
||||
|
||||
list.Add(cloneItem);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//要把裁判任务加进去 裁判任务上没有病灶
|
||||
|
||||
list.Add(item);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 不管是list 还是taskList 最终处理的数据都是list 处理好数据后合并
|
||||
if (criterion.CriterionType == CriterionType.RECIST1Point1 || criterion.CriterionType == CriterionType.RECIST1Pointt1_MB || criterion.CriterionType == CriterionType.IRECIST1Point1)
|
||||
{
|
||||
//针对1.1 整体肿瘤评估 有的两列要合并一列
|
||||
foreach (var item in list)
|
||||
{
|
||||
//处理合并表头
|
||||
|
||||
var questionType = item.IsBaseline == true ? QuestionType.ExistDisease : QuestionType.Tumor;
|
||||
|
||||
var findItem = item.QuestionAnswerList.Where(t => t.QuestionType == questionType).FirstOrDefault();
|
||||
|
||||
if (findItem != null)
|
||||
{
|
||||
findItem.QuestionName = _userInfo.IsEn_Us ? "Overall Response" : "整体肿瘤评估";
|
||||
}
|
||||
|
||||
|
||||
if (item.IsBaseline == true)
|
||||
{
|
||||
item.QuestionAnswerList = item.QuestionAnswerList.Where(t => t.QuestionType != QuestionType.Tumor).ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
item.QuestionAnswerList = item.QuestionAnswerList.Where(t => t.QuestionType != QuestionType.ExistDisease).ToList();
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (criterion.CriterionType == CriterionType.Lugano2014 || criterion.CriterionType == CriterionType.Lugano2014WithoutPET)
|
||||
{
|
||||
foreach (var item in list)
|
||||
{
|
||||
//处理合并表头
|
||||
|
||||
var questionType = item.IsBaseline == true ? QuestionType.ExistDisease : QuestionType.ImgOncology;
|
||||
|
||||
var findItem = item.QuestionAnswerList.Where(t => t.QuestionType == questionType).FirstOrDefault();
|
||||
|
||||
if (findItem != null)
|
||||
{
|
||||
findItem.QuestionName = _userInfo.IsEn_Us ? "Overall Response" : "整体肿瘤评估";
|
||||
}
|
||||
|
||||
if (item.IsBaseline == true)
|
||||
{
|
||||
item.QuestionAnswerList = item.QuestionAnswerList.Where(t => t.QuestionType != QuestionType.ImgOncology).ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
item.QuestionAnswerList = item.QuestionAnswerList.Where(t => t.QuestionType != QuestionType.ExistDisease).ToList();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
//非肿瘤的 问题名称是 表格名称_表格子问题名
|
||||
else
|
||||
{
|
||||
|
||||
var isMutiTable = trialConfigTableQuestionList.Select(t => t.TableName).Distinct().Count() > 1;
|
||||
|
||||
//多表格问题
|
||||
if (isMutiTable)
|
||||
{
|
||||
var extralNameList = new List<string>() { _userInfo.IsEn_Us ? "Table Name" : "表格名称" };
|
||||
|
||||
var tableQuestionNameList = trialConfigTableQuestionList.Select(t => t.TableName + "_" + t.QuestionName).ToList();
|
||||
|
||||
configCoumNameList = fistLeveLNameList.Union(extralNameList).Union(tableQuestionNameList).ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
//单表格问题(直接用表格问题名称) 或者没有表格问题
|
||||
|
||||
var tableNameList = trialConfigTableQuestionList.Select(t => t.QuestionName).Distinct().ToList();
|
||||
|
||||
configCoumNameList = fistLeveLNameList.Union(tableNameList).ToList();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
#region 扩展病灶
|
||||
|
||||
|
||||
//最终的病灶列表 要把裁判的也要加进去,需要处理裁判标记
|
||||
foreach (var item in taskList.OrderBy(t => t.SubjectCode).ThenBy(t => t.ArmEnum).ThenBy(t => t.VisitTaskNum))
|
||||
{
|
||||
//有病灶,并且至少配置了一个病灶问题
|
||||
if (item.LesionList.Count > 0 && item.LesionList.SelectMany(t => t.LessionAnswerList).Any())
|
||||
{
|
||||
foreach (var lession in item.LesionList.OrderBy(t => t.LessionType).ThenBy(t => t.LessionCode))
|
||||
{
|
||||
//病灶配置了问题 才进行导出
|
||||
if (lession.LessionAnswerList.Count > 0)
|
||||
{
|
||||
var firstLessionAnser = lession.LessionAnswerList.FirstOrDefault();
|
||||
|
||||
var dynamicLessionInfoList = new List<CommonQuesionInfo>();
|
||||
|
||||
if (isMutiTable)
|
||||
{
|
||||
var addLessionInfoList = new List<CommonQuesionInfo>();
|
||||
|
||||
addLessionInfoList.Add(new CommonQuesionInfo() { QuestionName = _userInfo.IsEn_Us ? "Table Name" : "表格名称", QuestionValue = firstLessionAnser.TableName });
|
||||
|
||||
var dynamicPartialLessionInfoList = lession.LessionAnswerList.Select(t => new CommonQuesionInfo() { QuestionName = t.TableName + "_" + t.QuestionName, QuestionValue = t.QuestionValue, TranslateDicName = t.TranslateDicName, CDISCCode = t.CDISCCode });
|
||||
|
||||
//有三部分组成 外层问题+ 固定列表格名称 + 动态的表格问题
|
||||
dynamicLessionInfoList = item.QuestionAnswerList.Union(addLessionInfoList).Union(dynamicPartialLessionInfoList).ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
var dynamicPartialLessionInfoList = lession.LessionAnswerList.Select(t => new CommonQuesionInfo() { QuestionName = t.QuestionName, QuestionValue = t.QuestionValue, TranslateDicName = t.TranslateDicName, CDISCCode = t.CDISCCode });
|
||||
|
||||
//两部分组成 外层问题+ 动态的表格问题
|
||||
dynamicLessionInfoList = item.QuestionAnswerList.Union(dynamicPartialLessionInfoList).ToList();
|
||||
}
|
||||
|
||||
|
||||
|
||||
var cloneItem = item.Clone();
|
||||
cloneItem.QuestionAnswerList = dynamicLessionInfoList;
|
||||
list.Add(cloneItem);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//要把裁判任务加进去 裁判任务上没有病灶
|
||||
|
||||
list.Add(item);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
dynamicColumnConfig = new DynamicColumnConfig()
|
||||
{
|
||||
|
@ -2572,29 +2660,26 @@ namespace IRaCIS.Core.Application.Service.Common
|
|||
DynamicItemTitleName = "QuestionName",
|
||||
DynamicListName = "QuestionAnswerList",
|
||||
RemoveColunmIndexList = removeColumnIndexList,
|
||||
ColumnNameList = columNameList,
|
||||
TranslateDicNameList = translateDicList
|
||||
ColumnNameList = configCoumNameList,
|
||||
TranslateDicNameList = translateDicNameList
|
||||
};
|
||||
|
||||
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"
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
//CDISC 导出 只到外层问题级别
|
||||
|
||||
var cdiscCodeList = totalCoumNameList.Select(t => t.CDISCCode).ToList();
|
||||
var totalConfigCoumNameList = trialConfigQuestionList.ToList();
|
||||
|
||||
#region 之前从问题答案取
|
||||
var configCoumNameList = totalConfigCoumNameList.Select(t => t.QuestionName).ToList();
|
||||
|
||||
var translateDicList = totalConfigCoumNameList.Where(t => t.TranslateDicName.IsNotNullOrEmpty()).Select(t => t.TranslateDicName).Distinct().ToList();
|
||||
|
||||
var cdiscCodeList = totalConfigCoumNameList.Select(t => t.CDISCCode).ToList();
|
||||
|
||||
//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()
|
||||
{
|
||||
|
@ -2606,21 +2691,62 @@ namespace IRaCIS.Core.Application.Service.Common
|
|||
DynamicItemTitleName = "QuestionName",
|
||||
DynamicListName = "QuestionAnswerList",
|
||||
RemoveColunmIndexList = removeColumnIndexList,
|
||||
ColumnNameList = columNameList,
|
||||
ColumnNameList = configCoumNameList,
|
||||
CDISCList = cdiscCodeList,
|
||||
TranslateDicNameList = translateDicList
|
||||
};
|
||||
|
||||
var (memoryStream, fileName) = await ExcelExportHelper.CDISC_DataExport_Async(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"
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
#region 最终导出参数处理
|
||||
|
||||
list = list.OrderBy(t => t.SubjectCode).ThenBy(t => t.ArmEnum).ThenBy(t => t.VisitTaskNum).ToList();
|
||||
|
||||
//处理裁判标记
|
||||
list = DealJudgeMark(criterion.ArbitrationRule, criterion.IsGlobalReading, list);
|
||||
|
||||
|
||||
if (export_Template == StaticData.Export.CommonJudgeReadingDetail_Export)
|
||||
{
|
||||
//裁判产生标记为空的数据过滤掉
|
||||
list = list.Where(t => t.IsTrigerJudge != null).ToList();
|
||||
}
|
||||
|
||||
|
||||
|
||||
var exportInfo = (await _trialRepository.Where(t => t.Id == inQuery.TrialId).IgnoreQueryFilters().ProjectTo<ExcelExportInfo>(_mapper.ConfigurationProvider).FirstOrDefaultAsync()).IfNullThrowException();
|
||||
exportInfo.CriterionName = criterion.CriterionName;
|
||||
|
||||
exportInfo.CurrentTime = ExportExcelConverterDate.DateTimeInternationalToString(DateTime.Now, _userInfo.TimeZoneId);
|
||||
|
||||
exportInfo.List = ExportExcelConverterDate.ConvertToClientTimeInObject(list.Where(t => t.ReadingCategory != ReadingCategory.Global).ToList(), _userInfo.TimeZoneId);
|
||||
|
||||
|
||||
MemoryStream? memoryStream = null;
|
||||
|
||||
string fileName = "";
|
||||
|
||||
if (inQuery.ReadingExportType == ExportResult.CDISC)
|
||||
{
|
||||
(memoryStream, fileName) = await ExcelExportHelper.CDISC_DataExport_Async(export_Template, exportInfo, _commonDocumentRepository, _hostEnvironment, _dictionaryService, typeof(CommonEvaluationExport), criterion.CriterionType, dynamicColumnConfig);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
(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"
|
||||
};
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -1168,6 +1168,16 @@ namespace IRaCIS.Core.Application.Contracts
|
|||
public string TranslateDicName { get; set; }
|
||||
}
|
||||
|
||||
public class ExportQuestionBasicInfo
|
||||
{
|
||||
public QuestionType? QuestionType { get; set; }
|
||||
public string TableName { get; set; }
|
||||
public Guid QuestionId { get; set; }
|
||||
public string QuestionName { get; set; }
|
||||
public string TranslateDicName { get; set; }
|
||||
public string CDISCCode { get; set; }
|
||||
}
|
||||
|
||||
|
||||
public class CommonQuesionInfo
|
||||
{
|
||||
|
@ -1288,7 +1298,7 @@ namespace IRaCIS.Core.Application.Contracts
|
|||
|
||||
#region 自定义表格名 特殊处理
|
||||
|
||||
public string TableQuestionName { get; set; }
|
||||
public string TableName { get; set; }
|
||||
#endregion
|
||||
|
||||
|
||||
|
|
|
@ -303,7 +303,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
.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))
|
||||
.ForMember(o => o.TableQuestionName, t => t.MapFrom(u => isEn_Us ? u.ReadingQuestionTrial.QuestionEnName : u.ReadingQuestionTrial.QuestionName))
|
||||
.ForMember(o => o.TableName, t => t.MapFrom(u => isEn_Us ? u.ReadingQuestionTrial.QuestionEnName : u.ReadingQuestionTrial.QuestionName))
|
||||
.ForMember(o => o.TranslateDicName, t => t.MapFrom(u => u.ReadingTableQuestionTrial.DictionaryCode))
|
||||
;
|
||||
|
||||
|
|
Loading…
Reference in New Issue