|
|
|
@@ -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();
|
|
|
|
|
|
|
|
|
@@ -2433,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)
|
|
|
|
@@ -2520,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()
|
|
|
|
|
{
|
|
|
|
@@ -2538,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);
|
|
|
|
@@ -2553,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()
|
|
|
|
|
{
|
|
|
|
@@ -2568,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);
|
|
|
|
|