From 2bf01fbf0c70effd181dbb35e4e638895ace39b9 Mon Sep 17 00:00:00 2001 From: he <109787524@qq.com> Date: Mon, 18 Mar 2024 14:12:13 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8A=A5=E5=91=8A=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../IRECIST1Point1CalculateService.cs | 28 +++++++++++++------ .../RECIST1Point1CalculateService.cs | 28 +++++++++++++------ .../RECIST1Point1_BMCalculateService.cs | 28 +++++++++++++------ .../SelfDefineCalculateService.cs | 28 +++++++++++++------ 4 files changed, 76 insertions(+), 36 deletions(-) diff --git a/IRaCIS.Core.Application/Service/ReadingCalculate/IRECIST1Point1CalculateService.cs b/IRaCIS.Core.Application/Service/ReadingCalculate/IRECIST1Point1CalculateService.cs index ac67e20f5..5798ee111 100644 --- a/IRaCIS.Core.Application/Service/ReadingCalculate/IRECIST1Point1CalculateService.cs +++ b/IRaCIS.Core.Application/Service/ReadingCalculate/IRECIST1Point1CalculateService.cs @@ -26,7 +26,8 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate private readonly IRepository _readingTableAnswerRowInfoRepository; private readonly IRepository _readingQuestionTrialRepository; private readonly IRepository _organInfoRepository; - private readonly IRepository _subjectVisitRepository; + private readonly IRepository _readingGlobalTaskInfoRepository; + private readonly IRepository _subjectVisitRepository; private readonly IRepository _tumorAssessmentRepository; private readonly IGeneralCalculateService _generalCalculateService; private readonly IRepository _readingTaskQuestionAnswerRepository; @@ -42,7 +43,8 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate IRepository readingTableAnswerRowInfoRepository, IRepository readingQuestionTrialRepository, IRepository organInfoRepository, - IRepository subjectVisitRepository, + IRepository readingGlobalTaskInfoRepository, + IRepository subjectVisitRepository, IRepository tumorAssessmentRepository, IGeneralCalculateService generalCalculateService, ILogger logger, @@ -56,7 +58,8 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate this._readingTableAnswerRowInfoRepository = readingTableAnswerRowInfoRepository; this._readingQuestionTrialRepository = readingQuestionTrialRepository; this._organInfoRepository = organInfoRepository; - this._subjectVisitRepository = subjectVisitRepository; + this._readingGlobalTaskInfoRepository = readingGlobalTaskInfoRepository; + this._subjectVisitRepository = subjectVisitRepository; this._tumorAssessmentRepository = tumorAssessmentRepository; this._generalCalculateService = generalCalculateService; this._readingTaskQuestionAnswerRepository = readingTaskQuestionAnswerRepository; @@ -174,8 +177,14 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate var answers = await _readingTaskQuestionAnswerRepository.Where(x => visitTaskIds.Contains(x.VisitTaskId)).ToListAsync(); var tableAnswers = await _readingTableQuestionAnswerRepository.Where(x => visitTaskIds.Contains(x.VisitTaskId)).ToListAsync(); - - var alltableAnsweRowInfos = await _readingTableAnswerRowInfoRepository.Where(x => visitTaskIds.Contains(x.VisitTaskId)).ToListAsync(); + var globalanswerList = await _readingGlobalTaskInfoRepository.Where(x => visitTaskIds.Contains(x.TaskId) && x.GlobalVisitTask.TaskState == TaskState.Effect && x.Answer != string.Empty).Select(x => new + { + x.TaskId, + x.GlobalVisitTask.VisitTaskNum, + x.QuestionId, + x.Answer + }).ToListAsync(); + var alltableAnsweRowInfos = await _readingTableAnswerRowInfoRepository.Where(x => visitTaskIds.Contains(x.VisitTaskId)).ToListAsync(); var organIds = alltableAnsweRowInfos.Where(x => x.OrganInfoId != null).Select(x => x.OrganInfoId).Distinct().ToList(); var organInfos = await _organInfoRepository.Where(x => organIds.Contains(x.Id)).ToListAsync(); @@ -241,14 +250,15 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate foreach (var task in taskInfoList) { + var globalAnswer = globalanswerList.Where(x => x.TaskId == task.VisitTaskId && x.QuestionId == question.QuestionId).OrderByDescending(x => x.VisitTaskNum).FirstOrDefault(); - var answer = answers.Where(x => x.VisitTaskId == task.VisitTaskId && x.ReadingQuestionTrialId == question.QuestionId).FirstOrDefault(); + var answer = answers.Where(x => x.VisitTaskId == task.VisitTaskId && x.ReadingQuestionTrialId == question.QuestionId).FirstOrDefault(); question.Answer.Add(new TaskQuestionAnswer() { Answer = answer==null?string.Empty:answer.Answer, - IsGlobalChange = answer == null ? false : answer.IsGlobalChange, - GlobalChangeAnswer = answer == null ? string.Empty : answer.GlobalChangeAnswer, - TaskName = task.TaskName, + IsGlobalChange = globalAnswer == null ? false : true, + GlobalChangeAnswer = globalAnswer == null ? string.Empty : globalAnswer.Answer, + TaskName = task.TaskName, VisitTaskId = task.VisitTaskId, }); diff --git a/IRaCIS.Core.Application/Service/ReadingCalculate/RECIST1Point1CalculateService.cs b/IRaCIS.Core.Application/Service/ReadingCalculate/RECIST1Point1CalculateService.cs index 60250e071..289356dd4 100644 --- a/IRaCIS.Core.Application/Service/ReadingCalculate/RECIST1Point1CalculateService.cs +++ b/IRaCIS.Core.Application/Service/ReadingCalculate/RECIST1Point1CalculateService.cs @@ -23,7 +23,8 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate private readonly IRepository _readingTableQuestionTrialRepository; private readonly IRepository _readingTableAnswerRowInfoRepository; private readonly IRepository _readingQuestionTrialRepository; - private readonly IRepository _organInfoRepository; + private readonly IRepository _readingGlobalTaskInfoRepository; + private readonly IRepository _organInfoRepository; private readonly IRepository _subjectVisitRepository; private readonly IRepository _tumorAssessmentRepository; private readonly IGeneralCalculateService _generalCalculateService; @@ -36,7 +37,8 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate IRepository readingTableQuestionTrialRepository, IRepository readingTableAnswerRowInfoRepository, IRepository readingQuestionTrialRepository, - IRepository organInfoRepository, + IRepository readingGlobalTaskInfoRepository, + IRepository organInfoRepository, IRepository subjectVisitRepository, IRepository tumorAssessmentRepository, IGeneralCalculateService generalCalculateService, @@ -49,7 +51,8 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate this._readingTableQuestionTrialRepository = readingTableQuestionTrialRepository; this._readingTableAnswerRowInfoRepository = readingTableAnswerRowInfoRepository; this._readingQuestionTrialRepository = readingQuestionTrialRepository; - this._organInfoRepository = organInfoRepository; + this._readingGlobalTaskInfoRepository = readingGlobalTaskInfoRepository; + this._organInfoRepository = organInfoRepository; this._subjectVisitRepository = subjectVisitRepository; this._tumorAssessmentRepository = tumorAssessmentRepository; this._generalCalculateService = generalCalculateService; @@ -128,8 +131,14 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate }).ToList(); var answers = await _readingTaskQuestionAnswerRepository.Where(x => visitTaskIds.Contains(x.VisitTaskId)).ToListAsync(); var tableAnswers = await _readingTableQuestionAnswerRepository.Where(x => visitTaskIds.Contains(x.VisitTaskId)).ToListAsync(); - - var alltableAnsweRowInfos = await _readingTableAnswerRowInfoRepository.Where(x => visitTaskIds.Contains(x.VisitTaskId)).ToListAsync(); + var globalanswerList = await _readingGlobalTaskInfoRepository.Where(x => visitTaskIds.Contains(x.TaskId) && x.GlobalVisitTask.TaskState == TaskState.Effect && x.Answer != string.Empty).Select(x => new + { + x.TaskId, + x.GlobalVisitTask.VisitTaskNum, + x.QuestionId, + x.Answer + }).ToListAsync(); + var alltableAnsweRowInfos = await _readingTableAnswerRowInfoRepository.Where(x => visitTaskIds.Contains(x.VisitTaskId)).ToListAsync(); var organIds = alltableAnsweRowInfos.Where(x => x.OrganInfoId != null).Select(x => x.OrganInfoId).Distinct().ToList(); var organInfos = await _organInfoRepository.Where(x => organIds.Contains(x.Id)).ToListAsync(); @@ -195,14 +204,15 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate foreach (var task in taskInfoList) { + var globalAnswer = globalanswerList.Where(x => x.TaskId == task.VisitTaskId && x.QuestionId == question.QuestionId).OrderByDescending(x => x.VisitTaskNum).FirstOrDefault(); - var answer = answers.Where(x => x.VisitTaskId == task.VisitTaskId && x.ReadingQuestionTrialId == question.QuestionId).FirstOrDefault(); + var answer = answers.Where(x => x.VisitTaskId == task.VisitTaskId && x.ReadingQuestionTrialId == question.QuestionId).FirstOrDefault(); question.Answer.Add(new TaskQuestionAnswer() { Answer = answer==null?string.Empty:answer.Answer, - IsGlobalChange = answer == null ? false : answer.IsGlobalChange, - GlobalChangeAnswer = answer == null ? string.Empty : answer.GlobalChangeAnswer, - TaskName = task.TaskName, + IsGlobalChange = globalAnswer == null ? false : true, + GlobalChangeAnswer = globalAnswer == null ? string.Empty : globalAnswer.Answer, + TaskName = task.TaskName, VisitTaskId = task.VisitTaskId, }); diff --git a/IRaCIS.Core.Application/Service/ReadingCalculate/RECIST1Point1_BMCalculateService.cs b/IRaCIS.Core.Application/Service/ReadingCalculate/RECIST1Point1_BMCalculateService.cs index 6ab26ada7..d19fb0e0b 100644 --- a/IRaCIS.Core.Application/Service/ReadingCalculate/RECIST1Point1_BMCalculateService.cs +++ b/IRaCIS.Core.Application/Service/ReadingCalculate/RECIST1Point1_BMCalculateService.cs @@ -24,7 +24,8 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate private readonly IRepository _readingTableAnswerRowInfoRepository; private readonly IRepository _readingQuestionTrialRepository; private readonly IRepository _organInfoRepository; - private readonly IRepository _subjectVisitRepository; + private readonly IRepository _readingGlobalTaskInfoRepository; + private readonly IRepository _subjectVisitRepository; private readonly IRepository _tumorAssessment_RECIST1Point1BM; private readonly IGeneralCalculateService _generalCalculateService; private readonly IRepository _readingTaskQuestionAnswerRepository; @@ -37,7 +38,8 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate IRepository readingTableAnswerRowInfoRepository, IRepository readingQuestionTrialRepository, IRepository organInfoRepository, - IRepository subjectVisitRepository, + IRepository readingGlobalTaskInfoRepository, + IRepository subjectVisitRepository, IRepository tumorAssessment_RECIST1Point1BM, IGeneralCalculateService generalCalculateService, IRepository readingTaskQuestionAnswerRepository @@ -50,7 +52,8 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate this._readingTableAnswerRowInfoRepository = readingTableAnswerRowInfoRepository; this._readingQuestionTrialRepository = readingQuestionTrialRepository; this._organInfoRepository = organInfoRepository; - this._subjectVisitRepository = subjectVisitRepository; + this._readingGlobalTaskInfoRepository = readingGlobalTaskInfoRepository; + this._subjectVisitRepository = subjectVisitRepository; this._tumorAssessment_RECIST1Point1BM = tumorAssessment_RECIST1Point1BM; this._generalCalculateService = generalCalculateService; this._readingTaskQuestionAnswerRepository = readingTaskQuestionAnswerRepository; @@ -124,8 +127,14 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate var answers = await _readingTaskQuestionAnswerRepository.Where(x => visitTaskIds.Contains(x.VisitTaskId)).ToListAsync(); var tableAnswers = await _readingTableQuestionAnswerRepository.Where(x => visitTaskIds.Contains(x.VisitTaskId)).ToListAsync(); - - var alltableAnsweRowInfos = await _readingTableAnswerRowInfoRepository.Where(x => visitTaskIds.Contains(x.VisitTaskId)).ToListAsync(); + var globalanswerList = await _readingGlobalTaskInfoRepository.Where(x => visitTaskIds.Contains(x.TaskId) && x.GlobalVisitTask.TaskState == TaskState.Effect && x.Answer != string.Empty).Select(x => new + { + x.TaskId, + x.GlobalVisitTask.VisitTaskNum, + x.QuestionId, + x.Answer + }).ToListAsync(); + var alltableAnsweRowInfos = await _readingTableAnswerRowInfoRepository.Where(x => visitTaskIds.Contains(x.VisitTaskId)).ToListAsync(); var organIds = alltableAnsweRowInfos.Where(x => x.OrganInfoId != null).Select(x => x.OrganInfoId).Distinct().ToList(); var organInfos = await _organInfoRepository.Where(x => organIds.Contains(x.Id)).ToListAsync(); @@ -191,14 +200,15 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate foreach (var task in taskInfoList) { + var globalAnswer = globalanswerList.Where(x => x.TaskId == task.VisitTaskId && x.QuestionId == question.QuestionId).OrderByDescending(x => x.VisitTaskNum).FirstOrDefault(); - var answer = answers.Where(x => x.VisitTaskId == task.VisitTaskId && x.ReadingQuestionTrialId == question.QuestionId).FirstOrDefault(); + var answer = answers.Where(x => x.VisitTaskId == task.VisitTaskId && x.ReadingQuestionTrialId == question.QuestionId).FirstOrDefault(); question.Answer.Add(new TaskQuestionAnswer() { Answer = answer==null?string.Empty:answer.Answer, - IsGlobalChange = answer == null ? false : answer.IsGlobalChange, - GlobalChangeAnswer = answer == null ? string.Empty : answer.GlobalChangeAnswer, - TaskName = task.TaskName, + IsGlobalChange = globalAnswer == null ? false : true, + GlobalChangeAnswer = globalAnswer == null ? string.Empty : globalAnswer.Answer, + TaskName = task.TaskName, VisitTaskId = task.VisitTaskId, }); diff --git a/IRaCIS.Core.Application/Service/ReadingCalculate/SelfDefineCalculateService.cs b/IRaCIS.Core.Application/Service/ReadingCalculate/SelfDefineCalculateService.cs index e4458bebd..379ea6e6b 100644 --- a/IRaCIS.Core.Application/Service/ReadingCalculate/SelfDefineCalculateService.cs +++ b/IRaCIS.Core.Application/Service/ReadingCalculate/SelfDefineCalculateService.cs @@ -21,7 +21,8 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate private readonly IRepository _readingQuestionCriterionTrialRepository; private readonly IRepository _readingTableQuestionTrialRepository; private readonly IRepository _readingTableAnswerRowInfoRepository; - private readonly IRepository _readingQuestionTrialRepository; + private readonly IRepository _readingGlobalTaskInfoRepository; + private readonly IRepository _readingQuestionTrialRepository; private readonly IRepository _subjectVisitRepository; private readonly IRepository _organInfoRepository; private readonly IRepository _dicomStudyRepository; @@ -36,7 +37,8 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate IRepository readingQuestionCriterionTrialRepository, IRepository readingTableQuestionTrialRepository, IRepository readingTableAnswerRowInfoRepository, - IRepository readingQuestionTrialRepository, + IRepository readingGlobalTaskInfoRepository, + IRepository readingQuestionTrialRepository, IRepository subjectVisitRepository, IRepository organInfoRepository, IRepository dicomStudyRepository, @@ -51,7 +53,8 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate this._readingQuestionCriterionTrialRepository = readingQuestionCriterionTrialRepository; this._readingTableQuestionTrialRepository = readingTableQuestionTrialRepository; this._readingTableAnswerRowInfoRepository = readingTableAnswerRowInfoRepository; - this._readingQuestionTrialRepository = readingQuestionTrialRepository; + this._readingGlobalTaskInfoRepository = readingGlobalTaskInfoRepository; + this._readingQuestionTrialRepository = readingQuestionTrialRepository; this._subjectVisitRepository = subjectVisitRepository; this._organInfoRepository = organInfoRepository; this._dicomStudyRepository = dicomStudyRepository; @@ -129,8 +132,14 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate var answers = await _readingTaskQuestionAnswerRepository.Where(x => visitTaskIds.Contains(x.VisitTaskId)).ToListAsync(); var tableAnswers = await _readingTableQuestionAnswerRepository.Where(x => visitTaskIds.Contains(x.VisitTaskId)).ToListAsync(); - - var alltableAnsweRowInfos = await _readingTableAnswerRowInfoRepository.Where(x => visitTaskIds.Contains(x.VisitTaskId)).ToListAsync(); + var globalanswerList = await _readingGlobalTaskInfoRepository.Where(x => visitTaskIds.Contains(x.TaskId) && x.GlobalVisitTask.TaskState == TaskState.Effect && x.Answer != string.Empty).Select(x => new + { + x.TaskId, + x.GlobalVisitTask.VisitTaskNum, + x.QuestionId, + x.Answer + }).ToListAsync(); + var alltableAnsweRowInfos = await _readingTableAnswerRowInfoRepository.Where(x => visitTaskIds.Contains(x.VisitTaskId)).ToListAsync(); var organIds = alltableAnsweRowInfos.Where(x => x.OrganInfoId != null).Select(x => x.OrganInfoId).Distinct().ToList(); var organInfos = await _organInfoRepository.Where(x => organIds.Contains(x.Id)).ToListAsync(); @@ -202,14 +211,15 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate foreach (var task in taskInfoList) { + var globalAnswer = globalanswerList.Where(x => x.TaskId == task.VisitTaskId && x.QuestionId == question.QuestionId).OrderByDescending(x => x.VisitTaskNum).FirstOrDefault(); - var answer = answers.Where(x => x.VisitTaskId == task.VisitTaskId && x.ReadingQuestionTrialId == question.QuestionId).FirstOrDefault(); + var answer = answers.Where(x => x.VisitTaskId == task.VisitTaskId && x.ReadingQuestionTrialId == question.QuestionId).FirstOrDefault(); question.Answer.Add(new TaskQuestionAnswer() { Answer = answer == null ? string.Empty : answer.Answer, - IsGlobalChange = answer == null ? false : answer.IsGlobalChange, - GlobalChangeAnswer = answer == null ? string.Empty : answer.GlobalChangeAnswer, - TaskName = task.TaskName, + IsGlobalChange = globalAnswer == null ? false : true, + GlobalChangeAnswer = globalAnswer == null ? string.Empty : globalAnswer.Answer, + TaskName = task.TaskName, VisitTaskId = task.VisitTaskId, });