报告修改

This commit is contained in:
he
2024-03-18 14:12:13 +08:00
parent 116eeb753d
commit 2bf01fbf0c
4 changed files with 76 additions and 36 deletions
@@ -21,7 +21,8 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
private readonly IRepository<ReadingQuestionCriterionTrial> _readingQuestionCriterionTrialRepository;
private readonly IRepository<ReadingTableQuestionTrial> _readingTableQuestionTrialRepository;
private readonly IRepository<ReadingTableAnswerRowInfo> _readingTableAnswerRowInfoRepository;
private readonly IRepository<ReadingQuestionTrial> _readingQuestionTrialRepository;
private readonly IRepository<ReadingGlobalTaskInfo> _readingGlobalTaskInfoRepository;
private readonly IRepository<ReadingQuestionTrial> _readingQuestionTrialRepository;
private readonly IRepository<SubjectVisit> _subjectVisitRepository;
private readonly IRepository<OrganInfo> _organInfoRepository;
private readonly IRepository<DicomStudy> _dicomStudyRepository;
@@ -36,7 +37,8 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
IRepository<ReadingQuestionCriterionTrial> readingQuestionCriterionTrialRepository,
IRepository<ReadingTableQuestionTrial> readingTableQuestionTrialRepository,
IRepository<ReadingTableAnswerRowInfo> readingTableAnswerRowInfoRepository,
IRepository<ReadingQuestionTrial> readingQuestionTrialRepository,
IRepository<ReadingGlobalTaskInfo> readingGlobalTaskInfoRepository,
IRepository<ReadingQuestionTrial> readingQuestionTrialRepository,
IRepository<SubjectVisit> subjectVisitRepository,
IRepository<OrganInfo> organInfoRepository,
IRepository<DicomStudy> 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,
});