临时提交
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
parent
5570c56b1e
commit
68845ae44b
|
@ -13,11 +13,13 @@ using Microsoft.AspNetCore.Authorization;
|
||||||
using Microsoft.AspNetCore.Hosting;
|
using Microsoft.AspNetCore.Hosting;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Microsoft.EntityFrameworkCore.Metadata.Internal;
|
using Microsoft.EntityFrameworkCore.Metadata.Internal;
|
||||||
|
using NPOI.HPSF;
|
||||||
using NPOI.POIFS.Properties;
|
using NPOI.POIFS.Properties;
|
||||||
using NPOI.SS.Formula.Functions;
|
using NPOI.SS.Formula.Functions;
|
||||||
using NPOI.XSSF.UserModel;
|
using NPOI.XSSF.UserModel;
|
||||||
using System.ComponentModel.Design;
|
using System.ComponentModel.Design;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using static IRaCIS.Core.Application.Service.ExcelExportHelper;
|
using static IRaCIS.Core.Application.Service.ExcelExportHelper;
|
||||||
using IDictionaryService = IRaCIS.Application.Interfaces.IDictionaryService;
|
using IDictionaryService = IRaCIS.Application.Interfaces.IDictionaryService;
|
||||||
|
@ -2200,6 +2202,8 @@ namespace IRaCIS.Core.Application.Service.Common
|
||||||
|
|
||||||
var list = new List<CommonEvaluationExport>();
|
var list = new List<CommonEvaluationExport>();
|
||||||
|
|
||||||
|
var taskList = new List<CommonLessionExport>();
|
||||||
|
|
||||||
#region 区分导表类型
|
#region 区分导表类型
|
||||||
|
|
||||||
var removeColumnIndexList = new List<int>() { };
|
var removeColumnIndexList = new List<int>() { };
|
||||||
|
@ -2285,7 +2289,7 @@ namespace IRaCIS.Core.Application.Service.Common
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
|
||||||
var taskList = await query.ProjectTo<CommonLessionExport>(_mapper.ConfigurationProvider,
|
taskList = await query.ProjectTo<CommonLessionExport>(_mapper.ConfigurationProvider,
|
||||||
new
|
new
|
||||||
{
|
{
|
||||||
readingExportType = inQuery.ReadingExportType,
|
readingExportType = inQuery.ReadingExportType,
|
||||||
|
@ -2295,11 +2299,204 @@ namespace IRaCIS.Core.Application.Service.Common
|
||||||
isEn_Us = _userInfo.IsEn_Us
|
isEn_Us = _userInfo.IsEn_Us
|
||||||
}).ToListAsync();
|
}).ToListAsync();
|
||||||
|
|
||||||
|
}
|
||||||
|
// 非肿瘤标准 包括自定义,以及系统非肿瘤 会配置到表格层级 问题名称是 表格名称_表格子问题名
|
||||||
|
else if (
|
||||||
|
criterion.CriterionGroup == CriterionGroup.Nontumorous && inQuery.ReadingExportType != ExportResult.CDISC
|
||||||
|
)
|
||||||
|
{
|
||||||
|
|
||||||
|
// 配置在外层问题 或者表格问题上
|
||||||
|
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 导出 只管到 外层问题层级 和阅片结果表是保持一致
|
||||||
|
else if (inQuery.ReadingExportType == ExportResult.CDISC)
|
||||||
|
{
|
||||||
|
list = await query.ProjectTo<CommonEvaluationExport>(_mapper.ConfigurationProvider,
|
||||||
|
new
|
||||||
|
{
|
||||||
|
readingExportType = inQuery.ReadingExportType,
|
||||||
|
criterionType = criterion.CriterionType,
|
||||||
|
arbitrationRule = criterion.ArbitrationRule,
|
||||||
|
trialReadingCriterionId = inQuery.TrialReadingCriterionId,
|
||||||
|
isEn_Us = _userInfo.IsEn_Us
|
||||||
|
}).ToListAsync();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
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 ExportQuestionBasicInfo()
|
||||||
|
{
|
||||||
|
QuestionId = t.Id,
|
||||||
|
QuestionType = t.QuestionType,
|
||||||
|
TableName = "",
|
||||||
|
QuestionName = _userInfo.IsEn_Us ? t.QuestionEnName : t.QuestionName,
|
||||||
|
CDISCCode = t.CDISCCode,
|
||||||
|
TranslateDicName = t.DictionaryCode
|
||||||
|
}).ToList();
|
||||||
|
|
||||||
|
|
||||||
|
if (inQuery.ReadingExportType != ExportResult.CDISC)
|
||||||
|
{
|
||||||
|
//最终EXCEL 列
|
||||||
|
var configCoumNameList = new List<string>();
|
||||||
|
|
||||||
|
//最终翻译字典
|
||||||
|
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();
|
||||||
|
|
||||||
|
//针对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)
|
||||||
|
{
|
||||||
|
fistLeveLNameList = trialConfigQuestionList.Select(t =>
|
||||||
|
(t.QuestionType == QuestionType.ExistDisease || t.QuestionType == QuestionType.ImgOncology) ? (_userInfo.IsEn_Us ? "Overall Response" : "整体肿瘤评估") : t.QuestionName).Distinct().ToList();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
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)
|
||||||
|
{
|
||||||
|
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 (trialConfigTableQuestionList.Select(t => t.TableName).Distinct().Count() > 1)
|
||||||
|
{
|
||||||
|
//肿瘤 表格问题直接去重、同时添加一些列 外层问题合并一些列
|
||||||
|
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)
|
||||||
|
{
|
||||||
|
|
||||||
|
extralNameList.Add(_userInfo.IsEn_Us ? "Lesion ID" : "病灶编号");
|
||||||
|
extralNameList.Add(_userInfo.IsEn_Us ? "Lesion Type" : "病灶类型");
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
else if (criterion.CriterionType == CriterionType.PCWG3)
|
||||||
|
{
|
||||||
|
extralNameList.Add(_userInfo.IsEn_Us ? "Lesion Type" : "病灶类型");
|
||||||
|
}
|
||||||
|
|
||||||
|
var tableNameList = trialConfigTableQuestionList.Select(t => t.QuestionName).Distinct().ToList();
|
||||||
|
|
||||||
|
configCoumNameList = fistLeveLNameList.Union(extralNameList).Union(tableNameList).ToList();
|
||||||
|
|
||||||
|
|
||||||
|
#region 扩展病灶
|
||||||
|
|
||||||
|
|
||||||
//最终的病灶列表 要把裁判的也要加进去,需要处理裁判标记
|
//最终的病灶列表 要把裁判的也要加进去,需要处理裁判标记
|
||||||
list = new List<CommonEvaluationExport>();
|
|
||||||
|
|
||||||
|
|
||||||
foreach (var item in taskList.OrderBy(t => t.SubjectCode).ThenBy(t => t.ArmEnum).ThenBy(t => t.VisitTaskNum))
|
foreach (var item in taskList.OrderBy(t => t.SubjectCode).ThenBy(t => t.ArmEnum).ThenBy(t => t.VisitTaskNum))
|
||||||
{
|
{
|
||||||
|
@ -2348,34 +2545,22 @@ namespace IRaCIS.Core.Application.Service.Common
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
}
|
}
|
||||||
// 非肿瘤标准 包括自定义,以及系统非肿瘤 会配置到表格层级 问题名称是 表格名称_表格子问题名
|
//非肿瘤的 问题名称是 表格名称_表格子问题名
|
||||||
else if (
|
else
|
||||||
criterion.CriterionGroup == CriterionGroup.Nontumorous && inQuery.ReadingExportType != ExportResult.CDISC
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
|
var extralNameList = new List<string>() { _userInfo.IsEn_Us ? "Table Name" : "表格名称" };
|
||||||
|
|
||||||
// 配置在外层问题 或者表格问题上
|
var tableNameList = trialConfigTableQuestionList.Select(t => t.TableName + "_" + t.QuestionName).ToList();
|
||||||
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();
|
|
||||||
|
|
||||||
//动态列,以不同的病灶配置的问题取并集
|
configCoumNameList = fistLeveLNameList.Union(extralNameList).Union(tableNameList).ToList();
|
||||||
var lessionAnserList = taskList.Where(t => t.LesionList.Count() > 0).FirstOrDefault()?.LesionList.FirstOrDefault()?.LessionAnswerList ?? new List<CommonLessionQuestionAnswerInfo>();
|
|
||||||
|
|
||||||
//通过问题标识取并集
|
#region 扩展病灶
|
||||||
|
|
||||||
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))
|
foreach (var item in taskList.OrderBy(t => t.SubjectCode).ThenBy(t => t.ArmEnum).ThenBy(t => t.VisitTaskNum))
|
||||||
{
|
{
|
||||||
//有病灶,并且至少配置了一个病灶问题
|
//有病灶,并且至少配置了一个病灶问题
|
||||||
|
@ -2402,7 +2587,6 @@ namespace IRaCIS.Core.Application.Service.Common
|
||||||
list.Add(cloneItem);
|
list.Add(cloneItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -2414,231 +2598,8 @@ namespace IRaCIS.Core.Application.Service.Common
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
// CDISC 导出 只管到 外层问题层级 和阅片结果表是保持一致
|
|
||||||
else if (inQuery.ReadingExportType == ExportResult.CDISC)
|
|
||||||
{
|
|
||||||
list = await query.ProjectTo<CommonEvaluationExport>(_mapper.ConfigurationProvider,
|
|
||||||
new
|
|
||||||
{
|
|
||||||
readingExportType = inQuery.ReadingExportType,
|
|
||||||
criterionType = criterion.CriterionType,
|
|
||||||
arbitrationRule = criterion.ArbitrationRule,
|
|
||||||
trialReadingCriterionId = inQuery.TrialReadingCriterionId,
|
|
||||||
isEn_Us = _userInfo.IsEn_Us
|
|
||||||
}).ToListAsync();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
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();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#region 肿瘤评估标准,并且非 CDISC 需要合并列
|
|
||||||
|
|
||||||
if (criterion.CriterionGroup == CriterionGroup.Tumor && 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)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#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 ExportQuestionBasicInfo()
|
|
||||||
{
|
|
||||||
QuestionId = t.Id,
|
|
||||||
QuestionType = t.QuestionType,
|
|
||||||
TableName = "",
|
|
||||||
QuestionName = _userInfo.IsEn_Us ? t.QuestionEnName : t.QuestionName,
|
|
||||||
CDISCCode = t.CDISCCode,
|
|
||||||
TranslateDicName = t.DictionaryCode
|
|
||||||
}).ToList();
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
|
|
||||||
if (inQuery.ReadingExportType != ExportResult.CDISC)
|
|
||||||
{
|
|
||||||
//最终EXCEL 列
|
|
||||||
var configCoumNameList = new List<string>();
|
|
||||||
|
|
||||||
//最终翻译字典
|
|
||||||
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>();
|
|
||||||
|
|
||||||
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
|
|
||||||
{
|
|
||||||
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 (trialConfigTableQuestionList.Select(t => t.TableName).Distinct().Count() > 1)
|
|
||||||
{
|
|
||||||
//肿瘤 表格问题直接去重、同时添加一些列 外层问题合并一些列
|
|
||||||
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)
|
|
||||||
{
|
|
||||||
|
|
||||||
extralNameList.Add(_userInfo.IsEn_Us ? "Lesion ID" : "病灶编号");
|
|
||||||
extralNameList.Add(_userInfo.IsEn_Us ? "Lesion Type" : "病灶类型");
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
else if (criterion.CriterionType == CriterionType.PCWG3)
|
|
||||||
{
|
|
||||||
extralNameList.Add(_userInfo.IsEn_Us ? "Lesion Type" : "病灶类型");
|
|
||||||
}
|
|
||||||
|
|
||||||
var tableNameList = trialConfigTableQuestionList.Select(t => t.QuestionName).Distinct().ToList();
|
|
||||||
|
|
||||||
configCoumNameList = fistLeveLNameList.Union(extralNameList).Union(tableNameList).ToList();
|
|
||||||
|
|
||||||
}
|
|
||||||
//非肿瘤的 问题名称是 表格名称_表格子问题名
|
|
||||||
else
|
|
||||||
{
|
|
||||||
var extralNameList = new List<string>() { _userInfo.IsEn_Us ? "Table Name" : "表格名称" };
|
|
||||||
|
|
||||||
var tableNameList = trialConfigTableQuestionList.Select(t => t.TableName + "_" + t.QuestionName).ToList();
|
|
||||||
|
|
||||||
configCoumNameList = fistLeveLNameList.Union(extralNameList).Union(tableNameList).ToList();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -2652,13 +2613,6 @@ namespace IRaCIS.Core.Application.Service.Common
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//暂时不用,因为肿瘤标准添加了列,同时多表格的,列名会加上表格名,这里还没有最终确认
|
|
||||||
|
|
||||||
//之前从问题答案取 合并之后获取最后的列名
|
|
||||||
//var columNameList = list.SelectMany(t => t.QuestionAnswerList).Where(t => t.QuestionName.IsNotNullOrEmpty()).Select(t => t.QuestionName).Distinct().ToList();
|
|
||||||
|
|
||||||
dynamicColumnConfig = new DynamicColumnConfig()
|
dynamicColumnConfig = new DynamicColumnConfig()
|
||||||
{
|
{
|
||||||
AutoColumnTitleRowIndex = 2,
|
AutoColumnTitleRowIndex = 2,
|
||||||
|
@ -2673,12 +2627,7 @@ namespace IRaCIS.Core.Application.Service.Common
|
||||||
TranslateDicNameList = translateDicNameList
|
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"
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2694,12 +2643,6 @@ namespace IRaCIS.Core.Application.Service.Common
|
||||||
|
|
||||||
var cdiscCodeList = totalConfigCoumNameList.Select(t => t.CDISCCode).ToList();
|
var cdiscCodeList = totalConfigCoumNameList.Select(t => t.CDISCCode).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()
|
dynamicColumnConfig = new DynamicColumnConfig()
|
||||||
{
|
{
|
||||||
|
@ -2716,16 +2659,57 @@ namespace IRaCIS.Core.Application.Service.Common
|
||||||
TranslateDicNameList = translateDicList
|
TranslateDicNameList = translateDicList
|
||||||
};
|
};
|
||||||
|
|
||||||
var (memoryStream, fileName) = await ExcelExportHelper.CDISC_DataExport_Async(export_Template, exportInfo, _commonDocumentRepository, _hostEnvironment, _dictionaryService, typeof(CommonEvaluationExport), criterion.CriterionType, dynamicColumnConfig);
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#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")
|
return new FileStreamResult(memoryStream, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet")
|
||||||
{
|
{
|
||||||
FileDownloadName = $"{exportInfo.ResearchProgramNo}_{exportInfo.CriterionName}_{fileName}_{DateTime.Now.ToString("yyyyMMddHHmmss")}.xlsx"
|
FileDownloadName = $"{exportInfo.ResearchProgramNo}_{exportInfo.CriterionName}_{fileName}_{DateTime.Now.ToString("yyyyMMddHHmmss")}.xlsx"
|
||||||
};
|
};
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue