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 running

This commit is contained in:
he
2025-01-22 09:25:51 +08:00
6 changed files with 181 additions and 60 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>()
};
@@ -2343,14 +2343,31 @@ namespace IRaCIS.Core.Application.Service.Common
TableName = "",
QuestionName = _userInfo.IsEn_Us ? t.QuestionEnName : t.QuestionName,
CDISCCode = t.CDISCCode,
TranslateDicName = t.DictionaryCode
TranslateDicName = t.DictionaryCode,
GroupName = _userInfo.IsEn_Us ? t.GroupInfo.GroupEnName : t.GroupInfo.GroupName
}).ToList();
#region
//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}";
// }
// }
//}
#endregion
if (inQuery.ReadingExportType != ExportResult.CDISC)
{
//最终EXCEL 列
var configCoumNameList = new List<string>();
var configCoumNameList = new List<DynamicColumnConfig.ColumItem>();
//最终翻译字典
var translateDicNameList = new List<string>();
@@ -2367,18 +2384,23 @@ namespace IRaCIS.Core.Application.Service.Common
TranslateDicName = t.DictionaryCode
}).ToList();
#region
var fistLeveLNameList = new List<string>();
var fistLeveLNameList = new List<DynamicColumnConfig.ColumItem>();
//肿瘤评估,非CDISC 导出
if (criterion.CriterionGroup == CriterionGroup.Tumor)
{
#region
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();
@@ -2386,36 +2408,32 @@ 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();
}
#endregion
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>() { };
#region
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)
@@ -2423,8 +2441,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" : "病灶类型" });
}
}
@@ -2432,13 +2450,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();
@@ -2554,19 +2572,31 @@ namespace IRaCIS.Core.Application.Service.Common
#endregion
#endregion
}
//非肿瘤的 问题名称是 表格名称_表格子问题名
else
//非肿瘤评估,非CDISC 导出
{
//外层问题处理
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();
#region _表格子问题名
var isMutiTable = trialConfigTableQuestionList.Select(t => t.TableName).Distinct().Count() > 1;
//多表格问题
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();
}
@@ -2574,7 +2604,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();
}
@@ -2582,7 +2612,7 @@ namespace IRaCIS.Core.Application.Service.Common
#region
#region
//最终的病灶列表 要把裁判的也要加进去,需要处理裁判标记
@@ -2604,7 +2634,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 });
@@ -2639,10 +2669,10 @@ namespace IRaCIS.Core.Application.Service.Common
#endregion
#endregion
}
#endregion
dynamicColumnConfig = new DynamicColumnConfig()
{
@@ -2652,9 +2682,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
};
@@ -2664,11 +2696,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();
@@ -2683,9 +2715,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
};
@@ -2703,7 +2736,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();
@@ -2737,7 +2770,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
@@ -1176,6 +1176,8 @@ namespace IRaCIS.Core.Application.Contracts
public string QuestionName { get; set; }
public string TranslateDicName { get; set; }
public string CDISCCode { get; set; }
public string GroupName { get; set; }
}
@@ -1193,6 +1195,10 @@ namespace IRaCIS.Core.Application.Contracts
public string TranslateDicName { get; set; }
public string CDISCCode { get; set; }
//外层问题会重复,所以需要分组名
public string Group { get; set; }
}
public class CommonEvaluationExport
{
@@ -32,9 +32,9 @@ namespace IRaCIS.Core.Application.Service
.ForMember(d => d.SubmitUserName, u => u.MapFrom(s => s.SubmitUser.FullName))
.ForMember(d => d.ClinicalInformationTransmissionEnum, u => u.MapFrom(s => s.Trial.ClinicalInformationTransmissionEnum))
.ForMember(d => d.IsHaveClinicalData, u => u.MapFrom(t => t.IsBaseLine ? t.PreviousHistoryList.Any() || t.PreviousOtherList.Any()
.ForMember(d => d.IsHaveClinicalData, u => u.MapFrom(t => t.IsBaseLine ? t.PreviousHistoryList.Any() || t.PreviousOtherList.Any() || t.PreviousSurgeryList.Any()
|| t.ReadingClinicalDataList.Any(x => x.ClinicalDataTrialSet.UploadRole == Domain.Share.UploadRole.CRC && x.ReadingClinicalDataPDFList.Count > 0)
|| t.PreviousSurgeryList.Any() : false))
: false))
.ForMember(d => d.DicomStudyCount, u => u.MapFrom(t => t.StudyList.Count()))
.ForMember(d => d.NoneDicomStudyCount, u => u.MapFrom(t => t.NoneDicomStudyList.Count(t => t.NoneDicomFileList.Any())));