From 4ac06a689fa119a5c6e36bd039d4c1e7ad9df7f4 Mon Sep 17 00:00:00 2001 From: he <10978375@qq.com> Date: Thu, 27 Oct 2022 14:32:21 +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 --- .../ReadingImageTaskService.cs | 176 +--------------- .../GeneralCalculateService.cs | 32 +++ .../Interface/ICriterionCalculateService.cs | 7 + .../Interface/IGeneralCalculateService.cs | 7 + .../Interface/IReadingCalculateService.cs | 7 + .../ReadingCalculate/PCWG3CalculateService.cs | 199 ++++++++++++++++++ .../RECIST1Point1CalculateService.cs | 167 +++++++++++++++ .../ReadingCalculateService.cs | 19 ++ 8 files changed, 439 insertions(+), 175 deletions(-) diff --git a/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingImageTaskService.cs b/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingImageTaskService.cs index ece999cb1..aec3342b0 100644 --- a/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingImageTaskService.cs +++ b/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingImageTaskService.cs @@ -338,181 +338,7 @@ namespace IRaCIS.Application.Services [HttpPost] public async Task GetReadingReportEvaluation(GetReadingReportEvaluationInDto indto) { - - - GetReadingReportEvaluationOutDto result = new GetReadingReportEvaluationOutDto(); - - result.CalculateResult = await _readingCalculateService.GetReportVerify(new GetReportVerifyInDto() { - VisitTaskId=indto.VisitTaskId - }); - - var visitTaskInfo = await _visitTaskRepository.Where(x => x.Id == indto.VisitTaskId).FirstNotNullAsync(); - - //if (visitTaskInfo.TaskState != TaskState.Effect) - //{ - // throw new BusinessValidationFailedException($"当前任务已失效!"); - //} - result.ReadingTaskState = visitTaskInfo.ReadingTaskState; - var taskInfoList = await _visitTaskRepository - // 失效的只查看自己 - .WhereIf(visitTaskInfo.TaskState != TaskState.Effect,x=>x.Id== indto.VisitTaskId) - .Where(x => (x.SubjectId == visitTaskInfo.SubjectId && x.TaskState == TaskState.Effect - &&x.IsAnalysisCreate==visitTaskInfo.IsAnalysisCreate - &&x.IsSelfAnalysis== visitTaskInfo.IsSelfAnalysis - && x.ArmEnum== visitTaskInfo.ArmEnum - &&x.TrialReadingCriterionId==visitTaskInfo.TrialReadingCriterionId - && x.ReadingCategory == ReadingCategory.Visit && !x.IsAnalysisCreate && x.ReadingTaskState == ReadingTaskState.HaveSigned) || x.Id == indto.VisitTaskId - ).OrderBy(x => x.VisitTaskNum).Select(x => new VisitTaskInfo() - { - BlindName = x.SourceSubjectVisit.BlindName, - IsBaseLine=x.SourceSubjectVisit.IsBaseLine, - VisitTaskId = x.Id, - TaskName = x.TaskName, - VisitTaskNum = x.VisitTaskNum, - IsCurrentTask = x.Id == indto.VisitTaskId, - - }).ToListAsync(); - - result.VisitTaskList = taskInfoList; - - var visitTaskIds = taskInfoList.Select(x => x.VisitTaskId).ToList(); - - var criterionId = visitTaskInfo.TrialReadingCriterionId; - var questionList = await _readingQuestionTrialRepository.Where(x => x.ReadingQuestionCriterionTrialId == criterionId).ToListAsync(); - var tableQuestionList = await _readingTableQuestionTrialRepository.Where(x => x.TrialCriterionId == criterionId).OrderBy(x => x.ShowOrder).ToListAsync(); - var tableAnsweRowInfos = await _readingTableAnswerRowInfoRepository.Where(x => x.VisitTaskId == indto.VisitTaskId).ProjectTo(_mapper.ConfigurationProvider).ToListAsync(); - - var answers = await _readingTaskQuestionAnswerRepository.Where(x => visitTaskIds.Contains(x.VisitTaskId)).ToListAsync(); - var tableAnswers = await _readingTableQuestionAnswerRepository.Where(x => visitTaskIds.Contains(x.VisitTaskId)).ToListAsync(); - - - // 第一级 - - #region 构造问题 - List questions = questionList.Where(x => x.Type == ReadingQestionType.Group).OrderBy(x => x.ShowOrder).Select(x => new ReadingReportDto() - { - QuestionId = x.Id, - GroupName = x.GroupName, - IsShowInDicom = x.IsShowInDicom, - Type = x.Type, - QuestionType=x.QuestionType, - LesionType=x.LesionType, - QuestionGenre =x.QuestionGenre, - DictionaryCode =x.DictionaryCode, - TypeValue = x.TypeValue, - QuestionName = x.QuestionName, - ShowOrder = x.ShowOrder, - ValueType=x.ValueType, - Unit=x.Unit, - - }).ToList(); - - // 分组 - foreach (var item in questions) - { - item.Childrens = questionList.Where(x => x.GroupName == item.GroupName && x.Type != ReadingQestionType.Group).OrderBy(x => x.ShowOrder).Select(x => new ReadingReportDto() - { - GroupName = x.GroupName, - QuestionId = x.Id, - IsShowInDicom = x.IsShowInDicom, - QuestionName = x.QuestionName, - LesionType = x.LesionType, - QuestionGenre = x.QuestionGenre, - DictionaryCode = x.DictionaryCode, - Type = x.Type, - QuestionType=x.QuestionType, - TypeValue = x.TypeValue, - ShowOrder = x.ShowOrder, - OrderMark = x.OrderMark, - ValueType = x.ValueType, - Unit = x.Unit, - - }).ToList(); - - // 问题 - foreach (var question in item.Childrens) - { - - foreach (var task in taskInfoList) - { - - question.Answer.Add(new TaskQuestionAnswer() - { - Answer = answers.Where(x => x.VisitTaskId == task.VisitTaskId && x.ReadingQuestionTrialId == question.QuestionId).Select(x => x.Answer).FirstIsNullReturnEmpty(), - TaskName = task.TaskName, - VisitTaskId = task.VisitTaskId, - }); - } - - // 构造表格行数据 - - - var rowlist = tableAnsweRowInfos.Where(x => x.QuestionId == question.QuestionId).OrderBy(x => x.RowIndex).ToList(); - - - question.Childrens = rowlist.Select(x => new ReadingReportDto() - { - QuestionName = question.OrderMark + x.RowIndex.GetLesionMark(), - SplitOrMergeLesionName = x.MergeName.IsNullOrEmpty() ? x.SplitName : x.MergeName, - SplitOrMergeType = x.SplitOrMergeType, - LesionType = question.LesionType, - IsCanEditPosition =x.IsCanEditPosition, - RowIndex =x.RowIndex, - BlindName=x.BlindName, - }).ToList(); - - - foreach (var row in question.Childrens) - { - // tableQuestion - row.Childrens = tableQuestionList.Where(x => x.ReadingQuestionId == question.QuestionId).Select(x => new ReadingReportDto() - { - QuestionName = x.QuestionName, - QuestionId = x.ReadingQuestionId, - TableQuestionId = x.Id, - Type = x.Type, - LesionType = question.LesionType, - TableQuestionType = x.TableQuestionType, - DictionaryCode = x.DictionaryCode, - QuestionMark = x.QuestionMark, - TypeValue = x.TypeValue, - RowIndex = row.RowIndex, - ShowOrder = x.ShowOrder, - ValueType = x.ValueType, - Unit = x.Unit, - }).ToList(); - - - foreach (var tableQuestion in row.Childrens) - { - foreach (var task in taskInfoList) - { - - tableQuestion.Answer.Add(new TaskQuestionAnswer() - { - Answer = tableAnswers.Where(x => x.VisitTaskId == task.VisitTaskId && x.QuestionId == tableQuestion.QuestionId && x.RowIndex == tableQuestion.RowIndex && x.TableQuestionId == tableQuestion.TableQuestionId).Select(x => x.Answer).FirstIsNullReturnEmpty(), - TaskName = task.TaskName, - VisitTaskId = task.VisitTaskId, - }); - } - } - - - } - - - }; - } - #endregion - - - - result.TaskQuestions = questions; - - - - return result; - + return await _readingCalculateService.GetReadingReportEvaluation(indto); } /// diff --git a/IRaCIS.Core.Application/Service/ReadingCalculate/GeneralCalculateService.cs b/IRaCIS.Core.Application/Service/ReadingCalculate/GeneralCalculateService.cs index 9316eb6fa..526de0813 100644 --- a/IRaCIS.Core.Application/Service/ReadingCalculate/GeneralCalculateService.cs +++ b/IRaCIS.Core.Application/Service/ReadingCalculate/GeneralCalculateService.cs @@ -133,5 +133,37 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate return readingData; } + + /// + /// 获取阅片报告任务List + /// + /// + /// + public async Task> GetReadingReportTaskList(Guid visitTaskId) + { + var visitTaskInfo = await _visitTaskRepository.Where(x => x.Id == visitTaskId).FirstNotNullAsync(); + + var taskInfoList = await _visitTaskRepository + // 失效的只查看自己 + .WhereIf(visitTaskInfo.TaskState != TaskState.Effect, x => x.Id == visitTaskId) + .Where(x => (x.SubjectId == visitTaskInfo.SubjectId && x.TaskState == TaskState.Effect + && x.IsAnalysisCreate == visitTaskInfo.IsAnalysisCreate + && x.IsSelfAnalysis == visitTaskInfo.IsSelfAnalysis + && x.ArmEnum == visitTaskInfo.ArmEnum + && x.TrialReadingCriterionId == visitTaskInfo.TrialReadingCriterionId + && x.ReadingCategory == ReadingCategory.Visit && !x.IsAnalysisCreate && x.ReadingTaskState == ReadingTaskState.HaveSigned) || x.Id == visitTaskId + ).OrderBy(x => x.VisitTaskNum).Select(x => new VisitTaskInfo() + { + BlindName = x.SourceSubjectVisit.BlindName, + IsBaseLine = x.SourceSubjectVisit.IsBaseLine, + VisitTaskId = x.Id, + TaskName = x.TaskName, + VisitTaskNum = x.VisitTaskNum, + IsCurrentTask = x.Id == visitTaskId, + + }).ToListAsync(); + + return taskInfoList; + } } } diff --git a/IRaCIS.Core.Application/Service/ReadingCalculate/Interface/ICriterionCalculateService.cs b/IRaCIS.Core.Application/Service/ReadingCalculate/Interface/ICriterionCalculateService.cs index 45cd57e6d..2f4d57a81 100644 --- a/IRaCIS.Core.Application/Service/ReadingCalculate/Interface/ICriterionCalculateService.cs +++ b/IRaCIS.Core.Application/Service/ReadingCalculate/Interface/ICriterionCalculateService.cs @@ -39,6 +39,13 @@ namespace IRaCIS.Core.Application.Service /// Task GetReportVerify(GetReportVerifyInDto inDto); + /// + /// 获取阅片报告 + /// + /// + /// + Task GetReadingReportEvaluation(GetReadingReportEvaluationInDto indto); + } } diff --git a/IRaCIS.Core.Application/Service/ReadingCalculate/Interface/IGeneralCalculateService.cs b/IRaCIS.Core.Application/Service/ReadingCalculate/Interface/IGeneralCalculateService.cs index 5ee6d1ea9..d287260a8 100644 --- a/IRaCIS.Core.Application/Service/ReadingCalculate/Interface/IGeneralCalculateService.cs +++ b/IRaCIS.Core.Application/Service/ReadingCalculate/Interface/IGeneralCalculateService.cs @@ -16,5 +16,12 @@ namespace IRaCIS.Core.Application.Service /// /// Task GetReadingCalculateDto(Guid visitTaskId); + + /// + /// 获取阅片报告任务List + /// + /// + /// + Task> GetReadingReportTaskList(Guid visitTaskId); } } diff --git a/IRaCIS.Core.Application/Service/ReadingCalculate/Interface/IReadingCalculateService.cs b/IRaCIS.Core.Application/Service/ReadingCalculate/Interface/IReadingCalculateService.cs index fdff8f9f5..238c2d647 100644 --- a/IRaCIS.Core.Application/Service/ReadingCalculate/Interface/IReadingCalculateService.cs +++ b/IRaCIS.Core.Application/Service/ReadingCalculate/Interface/IReadingCalculateService.cs @@ -37,5 +37,12 @@ namespace IRaCIS.Core.Application.Service /// /// Task GetReportVerify(GetReportVerifyInDto inDto); + + /// + /// 获取阅片报告 + /// + /// + /// + Task GetReadingReportEvaluation(GetReadingReportEvaluationInDto indto); } } diff --git a/IRaCIS.Core.Application/Service/ReadingCalculate/PCWG3CalculateService.cs b/IRaCIS.Core.Application/Service/ReadingCalculate/PCWG3CalculateService.cs index 18c728ff1..bbef627d8 100644 --- a/IRaCIS.Core.Application/Service/ReadingCalculate/PCWG3CalculateService.cs +++ b/IRaCIS.Core.Application/Service/ReadingCalculate/PCWG3CalculateService.cs @@ -53,6 +53,205 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate this._readingTaskQuestionAnswerRepository = readingTaskQuestionAnswerRepository; } + + #region 获取阅片报告 + /// + /// 获取阅片报告 + /// + /// + /// + [HttpPost] + public async Task GetReadingReportEvaluation(GetReadingReportEvaluationInDto indto) + { + GetReadingReportEvaluationOutDto result = new GetReadingReportEvaluationOutDto(); + + result.CalculateResult = await this.GetReportVerify(new GetReportVerifyInDto() + { + VisitTaskId = indto.VisitTaskId + }); + + var visitTaskInfo = await _visitTaskRepository.Where(x => x.Id == indto.VisitTaskId).FirstNotNullAsync(); + + + result.ReadingTaskState = visitTaskInfo.ReadingTaskState; + var taskInfoList = await _generalCalculateService.GetReadingReportTaskList(indto.VisitTaskId); + + result.VisitTaskList = taskInfoList; + + var visitTaskIds = taskInfoList.Select(x => x.VisitTaskId).ToList(); + + var criterionId = visitTaskInfo.TrialReadingCriterionId; + var questionList = await _readingQuestionTrialRepository.Where(x => x.ReadingQuestionCriterionTrialId == criterionId) + .Where(x=>x.LesionType!=LesionType.AlwaysNewLesions&&x.LesionType!=LesionType.AlwaysNewLesions) + .ToListAsync(); + var tableQuestionList = await _readingTableQuestionTrialRepository.Where(x => x.TrialCriterionId == criterionId).OrderBy(x => x.ShowOrder).ToListAsync(); + var tableAnsweRowInfos = await _readingTableAnswerRowInfoRepository.Where(x => x.VisitTaskId == indto.VisitTaskId).ProjectTo(_mapper.ConfigurationProvider).ToListAsync(); + var answers = await _readingTaskQuestionAnswerRepository.Where(x => visitTaskIds.Contains(x.VisitTaskId)).ToListAsync(); + var tableAnswers = await _readingTableQuestionAnswerRepository.Where(x => visitTaskIds.Contains(x.VisitTaskId)).ToListAsync(); + + + // 新病灶 + var questionNewLesions = await _readingQuestionTrialRepository.Where(x => x.ReadingQuestionCriterionTrialId == visitTaskInfo.TrialReadingCriterionId && x.LesionType == LesionType.NewLesions).FirstNotNullAsync(); + + // 既往新病灶 + var questionAlwaysLesions = await _readingQuestionTrialRepository.Where(x => x.ReadingQuestionCriterionTrialId == visitTaskInfo.TrialReadingCriterionId && x.LesionType == LesionType.AlwaysNewLesions).FirstNotNullAsync(); + + foreach (var item in tableAnsweRowInfos) + { + if (item.QuestionId == questionAlwaysLesions.Id) + { + item.QuestionId = questionNewLesions.Id; + } + } + + foreach (var item in answers) + { + if (item.ReadingQuestionTrialId == questionAlwaysLesions.Id) + { + item.ReadingQuestionTrialId = questionNewLesions.Id; + } + } + + foreach (var item in tableAnswers) + { + if (item.QuestionId == questionAlwaysLesions.Id) + { + item.QuestionId = questionNewLesions.Id; + } + } + + + // 第一级 分组 + + #region 构造问题 + List questions = questionList.Where(x => x.Type == ReadingQestionType.Group).OrderBy(x => x.ShowOrder).Select(x => new ReadingReportDto() + { + QuestionId = x.Id, + GroupName = x.GroupName, + IsShowInDicom = x.IsShowInDicom, + Type = x.Type, + QuestionType = x.QuestionType, + LesionType = x.LesionType, + QuestionGenre = x.QuestionGenre, + DictionaryCode = x.DictionaryCode, + TypeValue = x.TypeValue, + QuestionName = x.QuestionName, + ShowOrder = x.ShowOrder, + ValueType = x.ValueType, + Unit = x.Unit, + + }).ToList(); + + // 分组 + foreach (var item in questions) + { + // 问题 + item.Childrens = questionList.Where(x => x.GroupName == item.GroupName && x.Type != ReadingQestionType.Group).OrderBy(x => x.ShowOrder).Select(x => new ReadingReportDto() + { + GroupName = x.GroupName, + QuestionId = x.Id, + IsShowInDicom = x.IsShowInDicom, + QuestionName = x.QuestionName, + LesionType = x.LesionType, + QuestionGenre = x.QuestionGenre, + DictionaryCode = x.DictionaryCode, + Type = x.Type, + QuestionType = x.QuestionType, + TypeValue = x.TypeValue, + ShowOrder = x.ShowOrder, + OrderMark = x.OrderMark, + ValueType = x.ValueType, + Unit = x.Unit, + + }).ToList(); + + // 问题 + foreach (var question in item.Childrens) + { + + foreach (var task in taskInfoList) + { + + question.Answer.Add(new TaskQuestionAnswer() + { + Answer = answers.Where(x => x.VisitTaskId == task.VisitTaskId && x.ReadingQuestionTrialId == question.QuestionId).Select(x => x.Answer).FirstIsNullReturnEmpty(), + TaskName = task.TaskName, + VisitTaskId = task.VisitTaskId, + }); + } + + // 构造表格行数据 + + + var rowlist = tableAnsweRowInfos.Where(x => x.QuestionId == question.QuestionId).OrderBy(x => x.RowIndex).ToList(); + + + question.Childrens = rowlist.Select(x => new ReadingReportDto() + { + QuestionName = question.OrderMark + x.RowIndex.GetLesionMark(), + SplitOrMergeLesionName = x.MergeName.IsNullOrEmpty() ? x.SplitName : x.MergeName, + SplitOrMergeType = x.SplitOrMergeType, + LesionType = question.LesionType, + IsCanEditPosition = x.IsCanEditPosition, + RowIndex = x.RowIndex, + BlindName = x.BlindName, + }).ToList(); + + + foreach (var row in question.Childrens) + { + // tableQuestion + row.Childrens = tableQuestionList.Where(x => x.ReadingQuestionId == question.QuestionId).Select(x => new ReadingReportDto() + { + QuestionName = x.QuestionName, + QuestionId = x.ReadingQuestionId, + TableQuestionId = x.Id, + Type = x.Type, + LesionType = question.LesionType, + TableQuestionType = x.TableQuestionType, + DictionaryCode = x.DictionaryCode, + QuestionMark = x.QuestionMark, + TypeValue = x.TypeValue, + RowIndex = row.RowIndex, + ShowOrder = x.ShowOrder, + ValueType = x.ValueType, + Unit = x.Unit, + }).ToList(); + + + foreach (var tableQuestion in row.Childrens) + { + foreach (var task in taskInfoList) + { + + tableQuestion.Answer.Add(new TaskQuestionAnswer() + { + Answer = tableAnswers.Where(x => x.VisitTaskId == task.VisitTaskId && x.QuestionId == tableQuestion.QuestionId && x.RowIndex == tableQuestion.RowIndex && x.TableQuestionId == tableQuestion.TableQuestionId).Select(x => x.Answer).FirstIsNullReturnEmpty(), + TaskName = task.TaskName, + VisitTaskId = task.VisitTaskId, + }); + } + } + + + } + + + }; + } + #endregion + + + + result.TaskQuestions = questions; + + + + return result; + + } + #endregion + /// /// 将上一次的病灶信息添加到这一次 /// diff --git a/IRaCIS.Core.Application/Service/ReadingCalculate/RECIST1Point1CalculateService.cs b/IRaCIS.Core.Application/Service/ReadingCalculate/RECIST1Point1CalculateService.cs index be77bdaf9..54bdc619e 100644 --- a/IRaCIS.Core.Application/Service/ReadingCalculate/RECIST1Point1CalculateService.cs +++ b/IRaCIS.Core.Application/Service/ReadingCalculate/RECIST1Point1CalculateService.cs @@ -64,6 +64,172 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate private decimal? sODData; #endregion + + #region 获取阅片报告 + /// + /// 获取阅片报告 + /// + /// + /// + [HttpPost] + public async Task GetReadingReportEvaluation(GetReadingReportEvaluationInDto indto) + { + GetReadingReportEvaluationOutDto result = new GetReadingReportEvaluationOutDto(); + + result.CalculateResult = await this.GetReportVerify(new GetReportVerifyInDto() + { + VisitTaskId = indto.VisitTaskId + }); + + var visitTaskInfo = await _visitTaskRepository.Where(x => x.Id == indto.VisitTaskId).FirstNotNullAsync(); + + + result.ReadingTaskState = visitTaskInfo.ReadingTaskState; + var taskInfoList = await _generalCalculateService.GetReadingReportTaskList(indto.VisitTaskId); + + result.VisitTaskList = taskInfoList; + + var visitTaskIds = taskInfoList.Select(x => x.VisitTaskId).ToList(); + + var criterionId = visitTaskInfo.TrialReadingCriterionId; + var questionList = await _readingQuestionTrialRepository.Where(x => x.ReadingQuestionCriterionTrialId == criterionId).ToListAsync(); + var tableQuestionList = await _readingTableQuestionTrialRepository.Where(x => x.TrialCriterionId == criterionId).OrderBy(x => x.ShowOrder).ToListAsync(); + var tableAnsweRowInfos = await _readingTableAnswerRowInfoRepository.Where(x => x.VisitTaskId == indto.VisitTaskId).ProjectTo(_mapper.ConfigurationProvider).ToListAsync(); + + var answers = await _readingTaskQuestionAnswerRepository.Where(x => visitTaskIds.Contains(x.VisitTaskId)).ToListAsync(); + var tableAnswers = await _readingTableQuestionAnswerRepository.Where(x => visitTaskIds.Contains(x.VisitTaskId)).ToListAsync(); + + + // 第一级 + + #region 构造问题 + List questions = questionList.Where(x => x.Type == ReadingQestionType.Group).OrderBy(x => x.ShowOrder).Select(x => new ReadingReportDto() + { + QuestionId = x.Id, + GroupName = x.GroupName, + IsShowInDicom = x.IsShowInDicom, + Type = x.Type, + QuestionType = x.QuestionType, + LesionType = x.LesionType, + QuestionGenre = x.QuestionGenre, + DictionaryCode = x.DictionaryCode, + TypeValue = x.TypeValue, + QuestionName = x.QuestionName, + ShowOrder = x.ShowOrder, + ValueType = x.ValueType, + Unit = x.Unit, + + }).ToList(); + + // 分组 + foreach (var item in questions) + { + item.Childrens = questionList.Where(x => x.GroupName == item.GroupName && x.Type != ReadingQestionType.Group).OrderBy(x => x.ShowOrder).Select(x => new ReadingReportDto() + { + GroupName = x.GroupName, + QuestionId = x.Id, + IsShowInDicom = x.IsShowInDicom, + QuestionName = x.QuestionName, + LesionType = x.LesionType, + QuestionGenre = x.QuestionGenre, + DictionaryCode = x.DictionaryCode, + Type = x.Type, + QuestionType = x.QuestionType, + TypeValue = x.TypeValue, + ShowOrder = x.ShowOrder, + OrderMark = x.OrderMark, + ValueType = x.ValueType, + Unit = x.Unit, + + }).ToList(); + + // 问题 + foreach (var question in item.Childrens) + { + + foreach (var task in taskInfoList) + { + + question.Answer.Add(new TaskQuestionAnswer() + { + Answer = answers.Where(x => x.VisitTaskId == task.VisitTaskId && x.ReadingQuestionTrialId == question.QuestionId).Select(x => x.Answer).FirstIsNullReturnEmpty(), + TaskName = task.TaskName, + VisitTaskId = task.VisitTaskId, + }); + } + + // 构造表格行数据 + + + var rowlist = tableAnsweRowInfos.Where(x => x.QuestionId == question.QuestionId).OrderBy(x => x.RowIndex).ToList(); + + + question.Childrens = rowlist.Select(x => new ReadingReportDto() + { + QuestionName = question.OrderMark + x.RowIndex.GetLesionMark(), + SplitOrMergeLesionName = x.MergeName.IsNullOrEmpty() ? x.SplitName : x.MergeName, + SplitOrMergeType = x.SplitOrMergeType, + LesionType = question.LesionType, + IsCanEditPosition = x.IsCanEditPosition, + RowIndex = x.RowIndex, + BlindName = x.BlindName, + }).ToList(); + + + foreach (var row in question.Childrens) + { + // tableQuestion + row.Childrens = tableQuestionList.Where(x => x.ReadingQuestionId == question.QuestionId).Select(x => new ReadingReportDto() + { + QuestionName = x.QuestionName, + QuestionId = x.ReadingQuestionId, + TableQuestionId = x.Id, + Type = x.Type, + LesionType = question.LesionType, + TableQuestionType = x.TableQuestionType, + DictionaryCode = x.DictionaryCode, + QuestionMark = x.QuestionMark, + TypeValue = x.TypeValue, + RowIndex = row.RowIndex, + ShowOrder = x.ShowOrder, + ValueType = x.ValueType, + Unit = x.Unit, + }).ToList(); + + + foreach (var tableQuestion in row.Childrens) + { + foreach (var task in taskInfoList) + { + + tableQuestion.Answer.Add(new TaskQuestionAnswer() + { + Answer = tableAnswers.Where(x => x.VisitTaskId == task.VisitTaskId && x.QuestionId == tableQuestion.QuestionId && x.RowIndex == tableQuestion.RowIndex && x.TableQuestionId == tableQuestion.TableQuestionId).Select(x => x.Answer).FirstIsNullReturnEmpty(), + TaskName = task.TaskName, + VisitTaskId = task.VisitTaskId, + }); + } + } + + + } + + + }; + } + #endregion + + + + result.TaskQuestions = questions; + + + + return result; + + } + #endregion + /// /// 测试计算 /// @@ -78,6 +244,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate } + /// /// 计算任务 /// diff --git a/IRaCIS.Core.Application/Service/ReadingCalculate/ReadingCalculateService.cs b/IRaCIS.Core.Application/Service/ReadingCalculate/ReadingCalculateService.cs index 68fd56683..5cecca94b 100644 --- a/IRaCIS.Core.Application/Service/ReadingCalculate/ReadingCalculateService.cs +++ b/IRaCIS.Core.Application/Service/ReadingCalculate/ReadingCalculateService.cs @@ -152,6 +152,25 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate } } + + /// + /// 获取阅片报告 + /// + /// + /// + public async Task GetReadingReportEvaluation(GetReadingReportEvaluationInDto inDto) + { + var service = await this.GetService(inDto.VisitTaskId); + + if (service != null) + { + return await service.GetReadingReportEvaluation(inDto); + } + else + { + return new GetReadingReportEvaluationOutDto(); + } + } }