项目问题导出配置
parent
78bc09d71a
commit
23cb3e1278
|
@ -1822,6 +1822,61 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
|
|||
|
||||
}
|
||||
|
||||
public class SetTrialQuestionExportResultInDto
|
||||
{
|
||||
public List<SetTrialQuestionExport> QuestionList = new List<SetTrialQuestionExport>();
|
||||
|
||||
public List<SetTrialQuestionExport> TableQuestionList = new List<SetTrialQuestionExport>();
|
||||
}
|
||||
|
||||
|
||||
public class SetTrialQuestionExport
|
||||
{
|
||||
public Guid QuestionId { get; set; }
|
||||
|
||||
public Guid TableQuestionId { get; set; }
|
||||
|
||||
|
||||
public List<ExportResult> ExportResult { get; set; }
|
||||
}
|
||||
|
||||
public class GetTrialQuestionExportResultInDto
|
||||
{
|
||||
[NotDefault]
|
||||
public Guid TrialReadingCriterionId { get; set; }
|
||||
}
|
||||
|
||||
public class GetTrialQuestionExportResultOutDto
|
||||
{
|
||||
public List<TrialQuestionExport> QuestionList = new List<TrialQuestionExport>();
|
||||
|
||||
public List<TrialQuestionExportDic> DicList = new List<TrialQuestionExportDic>();
|
||||
}
|
||||
|
||||
public class TrialQuestionExport
|
||||
{
|
||||
public Guid QuestionId { get; set; }
|
||||
|
||||
public Guid TableQuestionId { get; set; }
|
||||
|
||||
public string QuestionName { get; set; }
|
||||
|
||||
public List<ExportResult> ExportResult { get; set; }
|
||||
|
||||
public int ShowOrder { get; set; }
|
||||
|
||||
public List<TrialQuestionExport> Children { get; set; } = new List<TrialQuestionExport>();
|
||||
}
|
||||
|
||||
public class TrialQuestionExportDic
|
||||
{
|
||||
public int Code { get; set; }
|
||||
|
||||
public string Value { get; set; }
|
||||
|
||||
public string ValueCN { get; set; }
|
||||
}
|
||||
|
||||
public class GetCustomQuestionPreviewInDto
|
||||
{
|
||||
[NotDefault]
|
||||
|
|
|
@ -48,7 +48,89 @@ namespace IRaCIS.Core.Application.Service
|
|||
// return (await _iReadingImageTaskService.GetReadingQuestion(inDto.TrialReadingCriterionId, null),true);
|
||||
//}
|
||||
|
||||
/// <summary>
|
||||
/// 设置项目问题导出
|
||||
/// </summary>
|
||||
/// <param name="inDto"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<bool> SetTrialQuestionExportResult(SetTrialQuestionExportResultInDto inDto)
|
||||
{
|
||||
foreach (var item in inDto.QuestionList)
|
||||
{
|
||||
|
||||
var ExportResultStr=JsonConvert.SerializeObject(item.ExportResult);
|
||||
await _readingQuestionTrialRepository.UpdatePartialFromQueryAsync(x => x.Id == item.QuestionId, x => new ReadingQuestionTrial()
|
||||
{
|
||||
ExportResultStr = ExportResultStr
|
||||
});
|
||||
}
|
||||
|
||||
foreach (var item in inDto.TableQuestionList)
|
||||
{
|
||||
|
||||
var ExportResultStr = JsonConvert.SerializeObject(item.ExportResult);
|
||||
await _readingTableQuestionTrialRepository.UpdatePartialFromQueryAsync(x => x.Id == item.TableQuestionId, x => new ReadingTableQuestionTrial()
|
||||
{
|
||||
ExportResultStr = ExportResultStr
|
||||
});
|
||||
}
|
||||
|
||||
return await _readingTableQuestionTrialRepository.SaveChangesAsync();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取项目的导出信息
|
||||
/// </summary>
|
||||
/// <param name="inDto"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<GetTrialQuestionExportResultOutDto> GetTrialQuestionExportResult(GetTrialQuestionExportResultInDto inDto)
|
||||
{
|
||||
var questionList = await _readingQuestionTrialRepository.Where(x => x.ReadingQuestionCriterionTrialId == inDto.TrialReadingCriterionId)
|
||||
.OrderBy(x => x.ShowOrder).Select(x => new TrialQuestionExport()
|
||||
{
|
||||
QuestionId = x.Id,
|
||||
QuestionName = _userInfo.IsEn_Us ? x.QuestionEnName : x.QuestionName,
|
||||
ExportResult = x.ExportResult,
|
||||
ShowOrder=x.ShowOrder,
|
||||
|
||||
}).ToListAsync();
|
||||
|
||||
var questionid = questionList.Select(x => x.QuestionId).ToList();
|
||||
|
||||
var tableQuestionList = await _readingTableQuestionTrialRepository.Where(x => questionid.Contains(x.ReadingQuestionId))
|
||||
.OrderBy(x => x.ShowOrder).Select(x => new TrialQuestionExport()
|
||||
{
|
||||
QuestionId = x.ReadingQuestionId,
|
||||
TableQuestionId=x.Id,
|
||||
QuestionName = _userInfo.IsEn_Us ? x.QuestionEnName : x.QuestionName,
|
||||
ExportResult = x.ExportResult,
|
||||
ShowOrder=x.ShowOrder,
|
||||
}).ToListAsync();
|
||||
|
||||
questionList.ForEach(x =>
|
||||
{
|
||||
x.Children = tableQuestionList.Where(y => y.QuestionId == x.QuestionId).OrderBy(y => y.ShowOrder).ToList();
|
||||
});
|
||||
|
||||
var dicList = await _dictionaryRepository.Where(x => x.Parent.Code == "ExportResult")
|
||||
.OrderBy(x => x.ShowOrder)
|
||||
.Select(x => new TrialQuestionExportDic()
|
||||
{
|
||||
|
||||
Code = int.Parse(x.Code),
|
||||
Value = x.Value,
|
||||
|
||||
ValueCN = x.ValueCN
|
||||
}).ToListAsync();
|
||||
|
||||
return new GetTrialQuestionExportResultOutDto()
|
||||
{
|
||||
DicList = dicList,
|
||||
QuestionList = questionList
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue