From 7b4db3b388ca6af5e080659f965d8e6dc28af99a Mon Sep 17 00:00:00 2001 From: he <10978375@qq.com> Date: Mon, 29 Aug 2022 14:46:12 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Reading/Dto/ReadingImageTaskViewModel.cs | 11 ++++++- .../Reading/ReadingImageTaskService.cs | 33 +++++++++++++++++-- .../Service/Reading/_MapConfig.cs | 2 +- .../Reading/ReadingTableQuestionTrial.cs | 8 ++--- 4 files changed, 46 insertions(+), 8 deletions(-) diff --git a/IRaCIS.Core.Application/Service/Reading/Dto/ReadingImageTaskViewModel.cs b/IRaCIS.Core.Application/Service/Reading/Dto/ReadingImageTaskViewModel.cs index caaec3a5c..dab0ab565 100644 --- a/IRaCIS.Core.Application/Service/Reading/Dto/ReadingImageTaskViewModel.cs +++ b/IRaCIS.Core.Application/Service/Reading/Dto/ReadingImageTaskViewModel.cs @@ -39,6 +39,8 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto public int? PageShowOrder { get; set; } + + public List Childrens { get; set; } public TrialReadTableQuestion TableQuestions { get; set; } @@ -53,11 +55,18 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto public class TrialReadTableQuestion { - public List Questions { get; set; } + public List Questions { get; set; } public List> Answers { get; set; } } + + public class TableQuestionTrial:ReadingTableQuestionTrial + { + public List RelationQuestions { get; set; } + } + + public class GetReadingQuestionAndAnswerInDto { diff --git a/IRaCIS.Core.Application/Service/Reading/ReadingImageTaskService.cs b/IRaCIS.Core.Application/Service/Reading/ReadingImageTaskService.cs index fc037ab01..0013d326c 100644 --- a/IRaCIS.Core.Application/Service/Reading/ReadingImageTaskService.cs +++ b/IRaCIS.Core.Application/Service/Reading/ReadingImageTaskService.cs @@ -158,6 +158,7 @@ namespace IRaCIS.Application.Services var qusetionIds = qusetionList.Select(x => x.Id).ToList(); var tableQuestionList = await _readingTableQuestionTrialRepository.Where(x => qusetionIds.Contains(x.ReadingQuestionId)) + .ProjectTo(_mapper.ConfigurationProvider) .OrderBy(x => x.ShowOrder).ToListAsync(); @@ -228,13 +229,41 @@ namespace IRaCIS.Application.Services /// /// /// - private void FindChildQuestion(TrialReadQuestionData item, List questionlists, List tableQuestionLists,List tableAnswers,List tableAnsweRowInfos) + private void FindChildQuestion(TrialReadQuestionData item, List questionlists, List tableQuestionLists,List tableAnswers,List tableAnsweRowInfos) { item.Childrens = questionlists.Where(x => x.ParentId == item.Id || (item.Type == "group" && x.Type != "group" && x.ParentId == null && x.GroupName == item.GroupName)).ToList(); item.TableQuestions = new TrialReadTableQuestion(); item.TableQuestions.Questions = tableQuestionLists.Where(x => x.ReadingQuestionId == item.Id).OrderBy(x=>x.ShowOrder).ToList(); - var thisAnswer = tableAnswers.Where(x => x.QuestionId == item.Id).ToList(); + + item.TableQuestions.Questions.ForEach(x => + { + + x.RelationQuestions = tableQuestionLists.Where(z => (z.DependParentId ?? default(Guid)) == x.Id).Select(x => new GetTrialReadingQuestionOutDto + { + Childrens = new List(), + ShowOrder = x.ShowOrder, + GroupName = string.Empty, + Id = x.Id, + Type = x.Type, + TableQuestionType = x.TableQuestionType, + DependParentId = x.DependParentId, + IsDepend = x.IsDepend, + QuestionMark = x.QuestionMark, + TypeValue = x.TypeValue, + RelevanceId = x.RelevanceId, + RelevanceValue = x.RelevanceValue, + ImageCount = 0, + ParentId = item.Id, + DataTableColumn = x.DataTableColumn, + LesionType = item.LesionType, + QuestionName = x.QuestionName, + RelationQuestions = new List(), + Remark = x.Remark, + + }).ToList(); + }); + var thisAnswer = tableAnswers.Where(x => x.QuestionId == item.Id).ToList(); var orders = thisAnswer.Select(x => x.RowIndex).Distinct().OrderBy(x => x).ToList(); item.TableQuestions.Answers = new List>(); orders.ForEach(x => diff --git a/IRaCIS.Core.Application/Service/Reading/_MapConfig.cs b/IRaCIS.Core.Application/Service/Reading/_MapConfig.cs index 22a12e97e..7695c74da 100644 --- a/IRaCIS.Core.Application/Service/Reading/_MapConfig.cs +++ b/IRaCIS.Core.Application/Service/Reading/_MapConfig.cs @@ -51,7 +51,7 @@ namespace IRaCIS.Core.Application.Service #region 阅片问题 - + CreateMap(); CreateMap() .ForMember(d => d.ShowOrder, u => u.MapFrom(s => s.ReadingQuestionTrial.ShowOrder)); diff --git a/IRaCIS.Core.Domain/Reading/ReadingTableQuestionTrial.cs b/IRaCIS.Core.Domain/Reading/ReadingTableQuestionTrial.cs index 4e2251cbf..27438cb5f 100644 --- a/IRaCIS.Core.Domain/Reading/ReadingTableQuestionTrial.cs +++ b/IRaCIS.Core.Domain/Reading/ReadingTableQuestionTrial.cs @@ -119,11 +119,11 @@ namespace IRaCIS.Core.Domain.Models /// DependParentId /// public Guid? DependParentId { get; set; } - + /// - /// IsDepend - /// - public int IsDepend { get; set; } + /// IsDepend + /// + public IsDepend? IsDepend { get; set; } ///