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

Uat_IRC_Net8
he 2025-01-15 10:57:03 +08:00
commit f4a97b940a
4 changed files with 64 additions and 48 deletions

View File

@ -919,7 +919,7 @@
<param name="trialReadingCriterionId"></param>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.Application.Service.Common.ExcelExportService.GetCommonEvaluationList_Export(IRaCIS.Core.Application.ViewModel.VisitTaskQuery,IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.CommonDocument},IRaCIS.Application.Interfaces.IDictionaryService,IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.Trial})">
<member name="M:IRaCIS.Core.Application.Service.Common.ExcelExportService.GetCommonEvaluationList_Export(IRaCIS.Core.Application.ViewModel.VisitTaskQuery,IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.CommonDocument},IRaCIS.Application.Interfaces.IDictionaryService,IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.ReadingQuestionTrial},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.ReadingTableQuestionTrial},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.Trial})">
<summary>
阅片结果表、阅片结果明细,评估病灶明细表, 裁判明细表导出,条件通过 ReadingExportType 123,4区分
</summary>

View File

@ -2167,8 +2167,12 @@ namespace IRaCIS.Core.Application.Service.Common
public async Task<IActionResult> GetCommonEvaluationList_Export(VisitTaskQuery inQuery,
[FromServices] IRepository<CommonDocument> _commonDocumentRepository,
[FromServices] IDictionaryService _dictionaryService,
[FromServices] IRepository<ReadingQuestionTrial> _trialReadingQuestionRepository,
[FromServices] IRepository<ReadingTableQuestionTrial> _trialReadingTableQuestionRepository,
[FromServices] IRepository<Trial> _trialRepository)
{
var trialId = inQuery.TrialId;
var trialReadingCriterionId = inQuery.TrialReadingCriterionId;
//每次查询必须是单标准的
var criterion = await _readingQuestionCriterionTrialRepository.Where(t => t.Id == inQuery.TrialReadingCriterionId).Select(t => new { t.CriterionType, t.CriterionGroup, t.IsGlobalReading, t.IsArbitrationReading, t.CriterionName, t.ArbitrationRule }).FirstNotNullAsync();
@ -2290,32 +2294,7 @@ 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>();
var dynamicExtraAddTitleList = new List<DymamicQuestionInfo>();
if (lessionAnserList.Count() > 0)
{
var lessionInfo = lessionAnserList.First();
if (criterion.CriterionType == CriterionType.RECIST1Point1 || criterion.CriterionType == CriterionType.RECIST1Pointt1_MB
|| criterion.CriterionType == CriterionType.IRECIST1Point1 || criterion.CriterionType == CriterionType.Lugano2014 || criterion.CriterionType == CriterionType.Lugano2014WithoutPET)
{
dynamicExtraAddTitleList.Add(new DymamicQuestionInfo() { QuestionName = _userInfo.IsEn_Us ? "Lesion ID" : "病灶编号" });
dynamicExtraAddTitleList.Add(new DymamicQuestionInfo() { QuestionName = _userInfo.IsEn_Us ? "Lesion Type" : "病灶类型" });
}
else if (criterion.CriterionType == CriterionType.PCWG3)
{
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<CommonEvaluationExport>();
@ -2327,7 +2306,6 @@ namespace IRaCIS.Core.Application.Service.Common
{
foreach (var lession in item.LesionList.OrderBy(t => t.LessionType).ThenBy(t => t.LessionCode))
{
var firstLessionAnser = lession.LessionAnswerList.FirstOrDefault() ?? new CommonLessionQuestionAnswerInfo();
var addLessionInfoList = new List<CommonQuesionInfo>();
@ -2335,19 +2313,17 @@ namespace IRaCIS.Core.Application.Service.Common
|| criterion.CriterionType == CriterionType.IRECIST1Point1 || criterion.CriterionType == CriterionType.Lugano2014 || criterion.CriterionType == CriterionType.Lugano2014WithoutPET)
{
//病灶编号 和病灶类型没有配置,但是需要有的
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" });
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 = firstLessionAnser.LessionType, TranslateDicName = "LesionType" });
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();
@ -2461,8 +2437,8 @@ namespace IRaCIS.Core.Application.Service.Common
//处理裁判标记
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();
////合并之前获取翻译的字典名,否则有的没法翻译
//var translateDicNameList = list.SelectMany(t => t.QuestionAnswerList).Where(t => t.TranslateDicName.IsNotNullOrEmpty()).Select(t => t.TranslateDicName).Distinct().ToList();
if (inQuery.ReadingExportType != ExportResult.CDISC)
@ -2548,13 +2524,43 @@ 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);
#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
{
QuestionId = t.Id,
QuestionName = _userInfo.IsEn_Us ? t.QuestionEnName : t.QuestionName,
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)
{
//合并之后获取最后的列名
var columNameList = list.SelectMany(t => t.QuestionAnswerList).Where(t => t.QuestionName.IsNotNullOrEmpty()).Select(t => t.QuestionName).Distinct().ToList();
//之前从问题答案取 合并之后获取最后的列名
//var columNameList = list.SelectMany(t => t.QuestionAnswerList).Where(t => t.QuestionName.IsNotNullOrEmpty()).Select(t => t.QuestionName).Distinct().ToList();
dynamicColumnConfig = new DynamicColumnConfig()
{
@ -2566,8 +2572,8 @@ namespace IRaCIS.Core.Application.Service.Common
DynamicItemTitleName = "QuestionName",
DynamicListName = "QuestionAnswerList",
RemoveColunmIndexList = removeColumnIndexList,
ColumnNameList = columNameList ?? new List<string>(),
TranslateDicNameList = translateDicNameList ?? new List<string>()
ColumnNameList = columNameList,
TranslateDicNameList = translateDicList
};
var (memoryStream, fileName) = await ExcelExportHelper.DataExport_NpoiTestAsync(export_Template, exportInfo, _commonDocumentRepository, _hostEnvironment, _dictionaryService, typeof(CommonEvaluationExport), criterion.CriterionType, dynamicColumnConfig);
@ -2581,10 +2587,14 @@ namespace IRaCIS.Core.Application.Service.Common
else
{
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 cdiscCodeList = totalCoumNameList.Select(t => t.CDISCCode).ToList();
var columNameList = nameList.Select(t => t.QuestionName).Distinct().ToList();
var cdiscCodeList = nameList.Select(t => t.CDISCCode).Distinct().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()
{
@ -2596,9 +2606,9 @@ namespace IRaCIS.Core.Application.Service.Common
DynamicItemTitleName = "QuestionName",
DynamicListName = "QuestionAnswerList",
RemoveColunmIndexList = removeColumnIndexList,
ColumnNameList = columNameList ?? new List<string>(),
ColumnNameList = columNameList,
CDISCList = cdiscCodeList,
TranslateDicNameList = translateDicNameList ?? new List<string>()
TranslateDicNameList = translateDicList
};
var (memoryStream, fileName) = await ExcelExportHelper.CDISC_DataExport_Async(export_Template, exportInfo, _commonDocumentRepository, _hostEnvironment, _dictionaryService, typeof(CommonEvaluationExport), criterion.CriterionType, dynamicColumnConfig);

View File

@ -1171,8 +1171,11 @@ namespace IRaCIS.Core.Application.Contracts
public class CommonQuesionInfo
{
//问题标识,肿瘤评估用于区分是什么问题
public QuestionType? QuestionType { get; set; }
public Guid QuestionId { get; set; }
public string QuestionName { get; set; }
public string QuestionValue { get; set; }
@ -1270,9 +1273,7 @@ namespace IRaCIS.Core.Application.Contracts
public class CommonLessionQuestionAnswerInfo
{
#region 肿瘤评估标准的时候需要
public string LessionCode { get; set; }
public string LessionType { get; set; }
public QuestionMark? QuestionMark { get; set; }
#endregion
@ -1291,6 +1292,8 @@ namespace IRaCIS.Core.Application.Contracts
#endregion
public Guid TableQuesionId { get; set; }
public string QuestionName { get; set; }
public string QuestionValue { get; set; }

View File

@ -242,6 +242,7 @@ namespace IRaCIS.Core.Application.Service
QuestionType = c.ReadingQuestionTrial.QuestionType,
QuestionName = isEn_Us ? c.ReadingQuestionTrial.QuestionEnName : c.ReadingQuestionTrial.QuestionName,
QuestionValue = c.IsGlobalChange ? c.GlobalChangeAnswer : c.Answer,
QuestionId = c.ReadingQuestionTrial.Id,
TranslateDicName = c.ReadingQuestionTrial.DictionaryCode,
CDISCCode = c.ReadingQuestionTrial.CDISCCode
})))
@ -277,6 +278,7 @@ namespace IRaCIS.Core.Application.Service
.Select(c => new CommonQuesionInfo()
{
QuestionType = c.ReadingQuestionTrial.QuestionType,
QuestionId = c.ReadingQuestionTrial.Id,
QuestionName = isEn_Us ? c.ReadingQuestionTrial.QuestionEnName : c.ReadingQuestionTrial.QuestionName,
QuestionValue = c.IsGlobalChange ? c.GlobalChangeAnswer : c.Answer,
TranslateDicName = c.ReadingQuestionTrial.DictionaryCode,
@ -294,9 +296,10 @@ namespace IRaCIS.Core.Application.Service
.ForMember(o => o.LessionAnswerList, t => t.MapFrom(u => u.LesionAnswerList.Where(c => c.ReadingTableQuestionTrial.ExportResultStr.Contains(((int)readingExportType).ToString()))));
CreateMap<ReadingTableQuestionAnswer, CommonLessionQuestionAnswerInfo>()
.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.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.TableQuesionId, t => t.MapFrom(u => u.ReadingTableQuestionTrial.Id))
.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))