diff --git a/IRaCIS.Core.Application/Service/Reading/Dto/ReadingImageTaskViewModel.cs b/IRaCIS.Core.Application/Service/Reading/Dto/ReadingImageTaskViewModel.cs index 47f08b7f0..5700821ae 100644 --- a/IRaCIS.Core.Application/Service/Reading/Dto/ReadingImageTaskViewModel.cs +++ b/IRaCIS.Core.Application/Service/Reading/Dto/ReadingImageTaskViewModel.cs @@ -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 TableAnswers { get; set; } = new List(); + + public List TableAnsweRowInfos { get; set; } = new List(); + + public bool IsGetallQuestion { get; set; } = false; + + /// + /// 是否获取预览 + /// + public bool IsGetPreview { get; set; } = false; + } public class ReadingTableQuestionAnswerInfo : ReadingTableQuestionAnswer { public int ShowOrder { get; set; } diff --git a/IRaCIS.Core.Application/Service/Reading/Interface/IReadingImageTaskService.cs b/IRaCIS.Core.Application/Service/Reading/Interface/IReadingImageTaskService.cs index eb622957f..f3490a7a7 100644 --- a/IRaCIS.Core.Application/Service/Reading/Interface/IReadingImageTaskService.cs +++ b/IRaCIS.Core.Application/Service/Reading/Interface/IReadingImageTaskService.cs @@ -18,7 +18,7 @@ namespace IRaCIS.Core.Application.Contracts Task> GetReadingQuestion(Guid trialReadingCriterionId, Guid? visitTaskId); - Task GetReadingTableQuestion(Guid trialReadingCriterionId, Guid? taskId, List tableAnswers, List tableAnsweRowInfos,bool isGetallQuestion=false); + Task GetReadingTableQuestion(GetReadingTableQuestionOrAnswerInDto inDto); Task SubmitGlobalReadingInfo(SubmitGlobalReadingInfoInDto inDto); diff --git a/IRaCIS.Core.Application/Service/Reading/ReadingCriterion/ReadingQuestionService.cs b/IRaCIS.Core.Application/Service/Reading/ReadingCriterion/ReadingQuestionService.cs index 761d0e58e..822ca656b 100644 --- a/IRaCIS.Core.Application/Service/Reading/ReadingCriterion/ReadingQuestionService.cs +++ b/IRaCIS.Core.Application/Service/Reading/ReadingCriterion/ReadingQuestionService.cs @@ -99,7 +99,18 @@ namespace IRaCIS.Application.Services { List tableAnswers = new List(); List tableAnsweRowInfos = new List(); - 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); } /// diff --git a/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingImageTaskService.cs b/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingImageTaskService.cs index c3e1e806d..129930c06 100644 --- a/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingImageTaskService.cs +++ b/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingImageTaskService.cs @@ -493,7 +493,18 @@ namespace IRaCIS.Application.Services var tableAnsweRowInfos = await _readingTableAnswerRowInfoRepository.Where(x => x.VisitTaskId == inDto.VisitTaskId).ProjectTo(_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(_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); } /// /// 获取表格问题及答案 只返回表格问题(任务和标准) /// - /// - /// - /// - /// + /// /// [NonDynamicMethod] - public async Task GetReadingTableQuestion(Guid trialReadingCriterionId, Guid? taskId, List tableAnswers, List tableAnsweRowInfos, bool isGetallQuestion = false) + public async Task 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(_mapper.ConfigurationProvider).OrderBy(x => x.ShowOrder).ToListAsync(); + var qusetionList = await _readingQuestionTrialRepository.Where(x => x.ReadingQuestionCriterionTrialId == inDto.TrialReadingCriterionId).ProjectTo(_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();