修改导表填充测试
continuous-integration/drone/push Build is passing

This commit is contained in:
hang
2025-01-21 22:23:45 +08:00
parent 31f56a39a5
commit fb478aa5f2
3 changed files with 136 additions and 39 deletions
@@ -2077,7 +2077,7 @@ namespace IRaCIS.Core.Application.Service.Common
DynamicItemTitleName = "QuestionName",
DynamicListName = "QuestionAnswerList",
RemoveColunmIndexList = new List<int>() { },
ColumnNameList = columNameList ?? new List<string>(),
ColumnIdNameList = columNameList.Select(t => new DynamicColumnConfig.ColumItem() { Id = Guid.Empty, Name = t }).ToList(),
TranslateDicNameList = translateDicNameList ?? new List<string>()
};
@@ -2344,14 +2344,30 @@ namespace IRaCIS.Core.Application.Service.Common
QuestionName = _userInfo.IsEn_Us ? t.QuestionEnName : t.QuestionName,
CDISCCode = t.CDISCCode,
TranslateDicName = t.DictionaryCode,
GroupName = _userInfo.IsEn_Us ? t.GroupInfo.GroupEnName:t.GroupInfo.GroupName
GroupName = _userInfo.IsEn_Us ? t.GroupInfo.GroupEnName : t.GroupInfo.GroupName
}).ToList();
//外层问题有重复,针对重复的加上组名
foreach (var item in trialConfigQuestionList.GroupBy(t => t.QuestionName).Where(g => g.Count() > 1))
{
var qName = item.Key;
foreach (var configQuestion in trialConfigQuestionList)
{
if (configQuestion.QuestionName == qName)
{
configQuestion.QuestionName = $"{configQuestion.GroupName}_{configQuestion.QuestionName}";
}
}
}
if (inQuery.ReadingExportType != ExportResult.CDISC)
{
//最终EXCEL 列
var configCoumNameList = new List<string>();
var configCoumNameList = new List<DynamicColumnConfig.ColumItem>();
//最终翻译字典
var translateDicNameList = new List<string>();
@@ -2370,7 +2386,7 @@ namespace IRaCIS.Core.Application.Service.Common
#region
var fistLeveLNameList = new List<string>();
var fistLeveLNameList = new List<DynamicColumnConfig.ColumItem>();
//肿瘤评估,非CDISC 导出
if (criterion.CriterionGroup == CriterionGroup.Tumor)
@@ -2378,8 +2394,11 @@ namespace IRaCIS.Core.Application.Service.Common
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();
fistLeveLNameList = trialConfigQuestionList.Select(t => new DynamicColumnConfig.ColumItem()
{
Id = Guid.Empty,
Name = (t.QuestionType == QuestionType.ExistDisease || t.QuestionType == QuestionType.Tumor) ? (_userInfo.IsEn_Us ? "Overall Response" : "整体肿瘤评估") : t.QuestionName
}).ToList();
@@ -2387,13 +2406,22 @@ namespace IRaCIS.Core.Application.Service.Common
}
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();
fistLeveLNameList = trialConfigQuestionList.Select(t => new DynamicColumnConfig.ColumItem()
{
Id = Guid.Empty,
Name = (t.QuestionType == QuestionType.ExistDisease || t.QuestionType == QuestionType.ImgOncology) ? (_userInfo.IsEn_Us ? "Overall Response" : "整体肿瘤评估") : t.QuestionName
}).ToList();
}
else if (criterion.CriterionType == CriterionType.PCWG3)
{
fistLeveLNameList = trialConfigQuestionList.Select(t => t.QuestionName).ToList();
fistLeveLNameList = trialConfigQuestionList.Select(t => new DynamicColumnConfig.ColumItem()
{
Id = Guid.Empty,
Name = t.QuestionName
}).ToList();
}
var exTralDicNameList = new List<string>() { "LesionType" };
@@ -2403,7 +2431,11 @@ namespace IRaCIS.Core.Application.Service.Common
else
//非肿瘤评估,非CDISC 导出
{
fistLeveLNameList = trialConfigQuestionList.Select(t => t.QuestionName).ToList();
fistLeveLNameList = trialConfigQuestionList.Select(t => new DynamicColumnConfig.ColumItem()
{
Id = t.QuestionId,
Name = t.QuestionName
}).ToList();
translateDicNameList = trialConfigQuestionList.Union(trialConfigTableQuestionList).Where(t => t.TranslateDicName.IsNotNullOrEmpty()).Select(t => t.TranslateDicName).Distinct().ToList();
@@ -2416,7 +2448,7 @@ namespace IRaCIS.Core.Application.Service.Common
//肿瘤 表格问题直接去重、同时添加一些列 外层问题合并一些列
if (criterion.CriterionGroup == CriterionGroup.Tumor)
{
var extralNameList = new List<string>() { };
var extralNameList = new List<DynamicColumnConfig.ColumItem>();
if (criterion.CriterionType == CriterionType.RECIST1Point1 || criterion.CriterionType == CriterionType.RECIST1Pointt1_MB
|| criterion.CriterionType == CriterionType.IRECIST1Point1 || criterion.CriterionType == CriterionType.Lugano2014 || criterion.CriterionType == CriterionType.Lugano2014WithoutPET)
@@ -2424,8 +2456,8 @@ namespace IRaCIS.Core.Application.Service.Common
//if(inQuery.ReadingExportType == ExportResult.DetailedTableOfLesions)
{
extralNameList.Add(_userInfo.IsEn_Us ? "Lesion ID" : "病灶编号");
extralNameList.Add(_userInfo.IsEn_Us ? "Lesion Type" : "病灶类型");
extralNameList.Add(new DynamicColumnConfig.ColumItem() { Id = Guid.Empty, Name = _userInfo.IsEn_Us ? "Lesion ID" : "病灶编号" });
extralNameList.Add(new DynamicColumnConfig.ColumItem() { Id = Guid.Empty, Name = _userInfo.IsEn_Us ? "Lesion Type" : "病灶类型" });
}
}
@@ -2433,13 +2465,13 @@ namespace IRaCIS.Core.Application.Service.Common
{
//if (inQuery.ReadingExportType == ExportResult.DetailedTableOfLesions)
{
extralNameList.Add(_userInfo.IsEn_Us ? "Lesion Type" : "病灶类型");
extralNameList.Add(new DynamicColumnConfig.ColumItem() { Id = Guid.Empty, Name = _userInfo.IsEn_Us ? "Lesion Type" : "病灶类型" });
}
}
//肿瘤评估标准目前是去重
var tableQuestionNameList = trialConfigTableQuestionList.Select(t => t.QuestionName).Distinct().ToList();
//肿瘤评估标准目前是去重 按照问题名称填充 不是Id
var tableQuestionNameList = trialConfigTableQuestionList.Select(t => t.QuestionName).Distinct().Select(t => new DynamicColumnConfig.ColumItem() { Id = Guid.Empty, Name = t }).Distinct().ToList();
//有表格问题 那么就是三部分,否则就是外层问题
configCoumNameList = tableQuestionNameList.Count == 0 ? fistLeveLNameList : fistLeveLNameList.Union(extralNameList).Union(tableQuestionNameList).ToList();
@@ -2565,9 +2597,10 @@ namespace IRaCIS.Core.Application.Service.Common
//多表格问题
if (isMutiTable)
{
var extralNameList = new List<string>() { _userInfo.IsEn_Us ? "Table Name" : "表格名称" };
//多表格,增加的一列,就用Guid.Empty 标识
var extralNameList = new List<DynamicColumnConfig.ColumItem>() { new DynamicColumnConfig.ColumItem() { Id = Guid.Empty, Name = _userInfo.IsEn_Us ? "Table Name" : "表格名称" } };
var tableQuestionNameList = trialConfigTableQuestionList.Select(t => t.TableName + "_" + t.QuestionName).ToList();
var tableQuestionNameList = trialConfigTableQuestionList.Select(t => new DynamicColumnConfig.ColumItem() { Id = t.QuestionId, Name = t.TableName + "_" + t.QuestionName }).ToList();
configCoumNameList = fistLeveLNameList.Union(extralNameList).Union(tableQuestionNameList).ToList();
}
@@ -2575,7 +2608,7 @@ namespace IRaCIS.Core.Application.Service.Common
{
//单表格问题(直接用表格问题名称) 或者没有表格问题
var tableNameList = trialConfigTableQuestionList.Select(t => t.QuestionName).Distinct().ToList();
var tableNameList = trialConfigTableQuestionList.Select(t => new DynamicColumnConfig.ColumItem() { Id = t.QuestionId, Name = t.QuestionName }).ToList();
configCoumNameList = fistLeveLNameList.Union(tableNameList).ToList();
}
@@ -2583,7 +2616,7 @@ namespace IRaCIS.Core.Application.Service.Common
#region
#region
//最终的病灶列表 要把裁判的也要加进去,需要处理裁判标记
@@ -2605,7 +2638,7 @@ namespace IRaCIS.Core.Application.Service.Common
{
var addLessionInfoList = new List<CommonQuesionInfo>();
addLessionInfoList.Add(new CommonQuesionInfo() { QuestionName = _userInfo.IsEn_Us ? "Table Name" : "表格名称", QuestionValue = firstLessionAnser.TableName });
addLessionInfoList.Add(new CommonQuesionInfo() { QuestionId = Guid.Empty, 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 });
@@ -2653,9 +2686,11 @@ namespace IRaCIS.Core.Application.Service.Common
DynamicItemDicName = "TranslateDicName",
DynamicItemValueName = "QuestionValue",
DynamicItemTitleName = "QuestionName",
DynamicItemTitleId = "QuestionId",
DynamicListName = "QuestionAnswerList",
RemoveColunmIndexList = removeColumnIndexList,
ColumnNameList = configCoumNameList,
ColumnIdNameList = configCoumNameList,
CDISCList=new List<string>(),
TranslateDicNameList = translateDicNameList
};
@@ -2665,11 +2700,11 @@ namespace IRaCIS.Core.Application.Service.Common
else
{
//CDISC 导出 只到外层问题级别
//CDISC 导出 只到外层问题级别 使用Id 填充Excel
var totalConfigCoumNameList = trialConfigQuestionList.ToList();
var configCoumNameList = totalConfigCoumNameList.Select(t => t.QuestionName).ToList();
var configCoumNameList = totalConfigCoumNameList.Select(t => new DynamicColumnConfig.ColumItem() { Id = t.QuestionId, Name = t.QuestionName }).ToList();
var translateDicList = totalConfigCoumNameList.Where(t => t.TranslateDicName.IsNotNullOrEmpty()).Select(t => t.TranslateDicName).Distinct().ToList();
@@ -2684,9 +2719,10 @@ namespace IRaCIS.Core.Application.Service.Common
DynamicItemDicName = "TranslateDicName",
DynamicItemValueName = "QuestionValue",
DynamicItemTitleName = "QuestionName",
DynamicItemTitleId = "QuestionId",
DynamicListName = "QuestionAnswerList",
RemoveColunmIndexList = removeColumnIndexList,
ColumnNameList = configCoumNameList,
ColumnIdNameList = configCoumNameList,
CDISCList = cdiscCodeList,
TranslateDicNameList = translateDicList
};
@@ -2704,7 +2740,7 @@ namespace IRaCIS.Core.Application.Service.Common
//R1 R2 两个人的访视都阅片完成了才可以,去除只有一个人阅片完成的访视
//找到只有一个人阅片的受试者 和访视
var exceptVisit = list.Where(t => t.ReadingCategory == ReadingCategory.Visit)
.GroupBy(t => new { t.SubjectCode, t.TaskName}).Where(g => g.Count() == 1).Select(g => new { g.Key.SubjectCode, g.Key.TaskName }).ToList();
.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();
@@ -2738,7 +2774,7 @@ namespace IRaCIS.Core.Application.Service.Common
if (inQuery.ReadingExportType == ExportResult.CDISC)
{
(memoryStream, fileName) = await ExcelExportHelper.CDISC_DataExport_Async(export_Template, exportInfo, _commonDocumentRepository, _hostEnvironment, _dictionaryService, typeof(CommonEvaluationExport), criterion.CriterionType, dynamicColumnConfig);
(memoryStream, fileName) = await ExcelExportHelper.DataExport_NpoiTestAsync(export_Template, exportInfo, _commonDocumentRepository, _hostEnvironment, _dictionaryService, typeof(CommonEvaluationExport), criterion.CriterionType, dynamicColumnConfig);
}
else