Uat_Study
he 2022-12-09 14:24:27 +08:00
parent d47d74d6d1
commit 36c06375b2
4 changed files with 82 additions and 28 deletions

View File

@ -422,6 +422,22 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
}
public class GetReadingTableQuestionOrAnswerInDto
{
public Guid TrialReadingCriterionId { get; set; }
public Guid? TaskId { get; set; }
public List<ReadingTableQuestionAnswerInfo> TableAnswers { get; set; } = new List<ReadingTableQuestionAnswerInfo>();
public List<TableAnsweRowInfo> TableAnsweRowInfos { get; set; } = new List<TableAnsweRowInfo>();
public bool IsGetallQuestion { get; set; } = false;
/// <summary>
/// 是否获取预览
/// </summary>
public bool IsGetPreview { get; set; } = false;
}
public class ReadingTableQuestionAnswerInfo : ReadingTableQuestionAnswer
{
public int ShowOrder { get; set; }

View File

@ -18,7 +18,7 @@ namespace IRaCIS.Core.Application.Contracts
Task<List<DicomReadingQuestionAnswer>> GetReadingQuestion(Guid trialReadingCriterionId, Guid? visitTaskId);
Task<GetReadingTableQuestionOutDto> GetReadingTableQuestion(Guid trialReadingCriterionId, Guid? taskId, List<ReadingTableQuestionAnswerInfo> tableAnswers, List<TableAnsweRowInfo> tableAnsweRowInfos,bool isGetallQuestion=false);
Task<GetReadingTableQuestionOutDto> GetReadingTableQuestion(GetReadingTableQuestionOrAnswerInDto inDto);
Task<IResponseOutput> SubmitGlobalReadingInfo(SubmitGlobalReadingInfoInDto inDto);

View File

@ -99,7 +99,18 @@ namespace IRaCIS.Application.Services
{
List<ReadingTableQuestionAnswerInfo> tableAnswers = new List<ReadingTableQuestionAnswerInfo>();
List<TableAnsweRowInfo> tableAnsweRowInfos = new List<TableAnsweRowInfo>();
return (await _iReadingImageTaskService.GetReadingTableQuestion(inDto.TrialReadingCriterionId, null, tableAnswers, tableAnsweRowInfos,true),true);
return (await _iReadingImageTaskService.GetReadingTableQuestion(
new GetReadingTableQuestionOrAnswerInDto()
{
TrialReadingCriterionId = inDto.TrialReadingCriterionId,
TableAnswers = tableAnswers,
TableAnsweRowInfos = tableAnsweRowInfos,
IsGetallQuestion = true,
IsGetPreview=true
}
), true);
}
/// <summary>

View File

@ -493,7 +493,18 @@ namespace IRaCIS.Application.Services
var tableAnsweRowInfos = await _readingTableAnswerRowInfoRepository.Where(x => x.VisitTaskId == inDto.VisitTaskId).ProjectTo<TableAnsweRowInfo>(_mapper.ConfigurationProvider).ToListAsync();
var questionPage = await GetReadingTableQuestion(taskinfo.TrialReadingCriterionId, inDto.VisitTaskId, tableAnswers, tableAnsweRowInfos);
var questionPage = await GetReadingTableQuestion(
new GetReadingTableQuestionOrAnswerInDto() {
TrialReadingCriterionId = taskinfo.TrialReadingCriterionId,
TaskId = inDto.VisitTaskId,
TableAnswers = tableAnswers,
TableAnsweRowInfos = tableAnsweRowInfos
}
);
result.SinglePage = questionPage.SinglePage;
result.MultiPage = questionPage.MultiPage;
@ -527,47 +538,63 @@ namespace IRaCIS.Application.Services
var tableAnsweRowInfos = await _readingTableAnswerRowInfoRepository.Where(x => x.VisitTaskId == inDto.VisitTaskId).ProjectTo<TableAnsweRowInfo>(_mapper.ConfigurationProvider).ToListAsync();
return (await this.GetReadingTableQuestion(taskInfo.TrialReadingCriterionId, taskInfo.Id, tableAnswers, tableAnsweRowInfos, true), true);
return (await this.GetReadingTableQuestion(
new GetReadingTableQuestionOrAnswerInDto()
{
TrialReadingCriterionId = taskInfo.TrialReadingCriterionId,
TaskId = taskInfo.Id,
TableAnswers = tableAnswers,
TableAnsweRowInfos = tableAnsweRowInfos,
IsGetallQuestion = true
}
), true);
}
/// <summary>
/// 获取表格问题及答案 只返回表格问题(任务和标准)
/// </summary>
/// <param name="trialReadingCriterionId"></param>
/// <param name="taskId"></param>
/// <param name="tableAnswers"></param>
/// <param name="tableAnsweRowInfos"></param>
/// <param name="inDto"></param>
/// <returns></returns>
[NonDynamicMethod]
public async Task<GetReadingTableQuestionOutDto> GetReadingTableQuestion(Guid trialReadingCriterionId, Guid? taskId, List<ReadingTableQuestionAnswerInfo> tableAnswers, List<TableAnsweRowInfo> tableAnsweRowInfos, bool isGetallQuestion = false)
public async Task<GetReadingTableQuestionOutDto> GetReadingTableQuestion(GetReadingTableQuestionOrAnswerInDto inDto)
{
var criterionInfo = await _readingQuestionCriterionTrialRepository.Where(x => x.Id == trialReadingCriterionId).FirstNotNullAsync();
var criterionInfo = await _readingQuestionCriterionTrialRepository.Where(x => x.Id == inDto.TrialReadingCriterionId).FirstNotNullAsync();
var qusetionList = await _readingQuestionTrialRepository.Where(x => x.ReadingQuestionCriterionTrialId == trialReadingCriterionId).ProjectTo<TrialReadQuestionData>(_mapper.ConfigurationProvider).OrderBy(x => x.ShowOrder).ToListAsync();
var qusetionList = await _readingQuestionTrialRepository.Where(x => x.ReadingQuestionCriterionTrialId == inDto.TrialReadingCriterionId).ProjectTo<TrialReadQuestionData>(_mapper.ConfigurationProvider).OrderBy(x => x.ShowOrder).ToListAsync();
// 是否获取所有问题
if (isGetallQuestion)
//是否是预览
if (inDto.IsGetPreview == false)
{
if (!criterionInfo.IseCRFShowInDicomReading)
// 是否获取所有问题
if (inDto.IsGetallQuestion)
{
qusetionList = qusetionList.Where(x => x.IsShowInDicom).OrderBy(x => x.ShowOrder).ToList();
if (!criterionInfo.IseCRFShowInDicomReading)
{
qusetionList = qusetionList.Where(x => x.IsShowInDicom).OrderBy(x => x.ShowOrder).ToList();
}
}
else
{
if (!criterionInfo.IseCRFShowInDicomReading)
{
qusetionList = qusetionList.Where(x => x.IsShowInDicom && (x.Type == ReadingQestionType.Table || x.Type == ReadingQestionType.Group)).OrderBy(x => x.ShowOrder).ToList();
}
var usedGurops = qusetionList.Where(x => x.Type == ReadingQestionType.Table).Select(x => x.GroupName).ToList();
qusetionList = qusetionList.Where(x => usedGurops.Contains(x.GroupName)).ToList();
}
}
else
{
if (!criterionInfo.IseCRFShowInDicomReading)
{
qusetionList = qusetionList.Where(x => x.IsShowInDicom && (x.Type == ReadingQestionType.Table || x.Type == ReadingQestionType.Group)).OrderBy(x => x.ShowOrder).ToList();
}
var usedGurops = qusetionList.Where(x => x.Type == ReadingQestionType.Table).Select(x => x.GroupName).ToList();
qusetionList = qusetionList.Where(x => usedGurops.Contains(x.GroupName)).ToList();
}
if (taskId != null)
if (inDto.TaskId != null)
{
var answers = await _readingTaskQuestionAnswerRepository.Where(x => x.VisitTaskId == taskId).ToListAsync();
var answers = await _readingTaskQuestionAnswerRepository.Where(x => x.VisitTaskId == inDto.TaskId).ToListAsync();
qusetionList.ForEach(x =>
{
var answer= answers.Where(y => y.ReadingQuestionTrialId == x.Id).Select(x => x.Answer).FirstOrDefault() ?? string.Empty;
@ -604,7 +631,7 @@ namespace IRaCIS.Application.Services
var pageGroupList = newPageQusetionList.Where(x => x.Type == ReadingQestionType.Group || (x.ParentId == null && x.GroupName.IsNullOrEmpty())).ToList();
pageGroupList.ForEach(x =>
{
this.FindChildQuestion(x, newPageQusetionList, tableQuestionList, tableAnswers, tableAnsweRowInfos);
this.FindChildQuestion(x, newPageQusetionList, tableQuestionList, inDto.TableAnswers, inDto.TableAnsweRowInfos);
});
page.Childrens = pageGroupList.Where(x => !(x.Type == ReadingQestionType.Group && x.Childrens.Count() == 0)).ToList();
@ -621,7 +648,7 @@ namespace IRaCIS.Application.Services
groupList = qusetionList.Where(x => x.Type == ReadingQestionType.Group || (x.ParentId == null && x.GroupName.IsNullOrEmpty())).ToList();
groupList.ForEach(x =>
{
this.FindChildQuestion(x, qusetionList, tableQuestionList, tableAnswers, tableAnsweRowInfos);
this.FindChildQuestion(x, qusetionList, tableQuestionList, inDto.TableAnswers, inDto.TableAnsweRowInfos);
});
groupList = groupList.Where(x => !(x.Type == ReadingQestionType.Group && x.Childrens.Count() == 0)).ToList();