diff --git a/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingGlobalTaskService.cs b/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingGlobalTaskService.cs index 5d4ec511e..122b7115d 100644 --- a/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingGlobalTaskService.cs +++ b/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingGlobalTaskService.cs @@ -181,20 +181,28 @@ namespace IRaCIS.Application.Services }).ToList(); - x.AgreeOrNot = new List() + if (criterionType != CriterionType.PCWG3) { - new GlobalQuestionInfo() - { - Answer = globalReadingQuestion.Where(y => y.TaskId == x.VisitTaskId && y.GlobalAnswerType == GlobalAnswerType.AgreeOrNot).Select(x => x.Answer).FirstOrDefault() ?? string.Empty, - QuestionName = "", - Type = "input", - GlobalAnswerType=GlobalAnswerType.AgreeOrNot, - GlobalReadingShowType= GlobalReadingShowType.AllShow, - } + x.AgreeOrNot = new List() + { + new GlobalQuestionInfo() + { + Answer = globalReadingQuestion.Where(y => y.TaskId == x.VisitTaskId && y.GlobalAnswerType == GlobalAnswerType.AgreeOrNot).Select(x => x.Answer).FirstOrDefault() ?? string.Empty, + QuestionName = "", + Type = "input", + GlobalAnswerType=GlobalAnswerType.AgreeOrNot, + GlobalReadingShowType= GlobalReadingShowType.AllShow, + } + + }; + } + else + { + x.AgreeOrNot = new List() { }; + } + - }; - List questionTypes = new List() { diff --git a/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingImageTaskService.cs b/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingImageTaskService.cs index c588c36e1..ce848e930 100644 --- a/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingImageTaskService.cs +++ b/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingImageTaskService.cs @@ -1205,7 +1205,7 @@ namespace IRaCIS.Application.Services BlindName = rowInfo.BlindName, IsDicomReading = rowInfo.IsDicomReading, IsCurrentTaskAdd = isCurrentTaskAdd, - FristAddTaskNum = rowInfo.FristAddTaskNum, + OrganInfoId=rowInfo.OrganInfoId, PicturePath = rowInfo.PicturePath, NumberOfFrames=rowInfo.NumberOfFrames, diff --git a/IRaCIS.Core.Application/Service/ReadingCalculate/PCWG3CalculateService.cs b/IRaCIS.Core.Application/Service/ReadingCalculate/PCWG3CalculateService.cs index 8c8d5dbe8..2b7ba3695 100644 --- a/IRaCIS.Core.Application/Service/ReadingCalculate/PCWG3CalculateService.cs +++ b/IRaCIS.Core.Application/Service/ReadingCalculate/PCWG3CalculateService.cs @@ -524,7 +524,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate } break; case QuestionType.AlwaysNewLesionsCount: - if (inDto.VisitTaskNum >= 2) + if (inDto.VisitTaskNum >1) { item.Answer = (await calculate.GetIntFun(inDto)).ToString(); } @@ -534,14 +534,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate } break; case QuestionType.NewBoneLesionsCount: - if (inDto.VisitTaskNum >= 3) - { - item.Answer = (await calculate.GetIntFun(inDto)).ToString(); - } - else - { - item.Answer = nameof(YesOrNoOrNa.NA); - } + item.Answer = (await calculate.GetIntFun(inDto)).ToString(); break; case QuestionType.DaysBetween: item.Answer = (await calculate.GetIntFun(inDto)).ToString(); @@ -673,14 +666,28 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate /// public async Task GetNewBoneLesionCount(ReadingCalculateDto inDto) { - if (inDto.VisitTaskNum < 3) + + var taskList = await GetSiteVisitForTumorList(inDto); + + var findindex = taskList.OrderBy(x => x.VisitTaskNum).ToList().FindIndex(x => x.VisitTaskId == inDto.VisitTaskId); + var lastCount = 0; + if (findindex < 2) { - return 0; + return -1; } - var result= inDto.QuestionInfo.Where(x => x.LesionType == LesionType.AlwaysNewLesions).SelectMany(x => x.TableRowInfoList) - .Where(x =>x.FristAddTaskNum>=2&& x.TableQuestionList.Any(y => y.QuestionMark == QuestionMark.State && y.Answer == EvaluationOfState.Exists.GetEnumInt())) + else if (findindex > 2) + { + var lastTask = taskList.Where(x => x.VisitTaskNum < inDto.VisitTaskNum && x.VisitTaskId != inDto.VisitTaskId).OrderByDescending(x => x.VisitTaskNum).FirstOrDefault(); + var cewBoneLesionsCountQuestionId = inDto.QuestionInfo.Where(x => x.QuestionType == QuestionType.NewBoneLesionsCount).Select(x => x.QuestionId).FirstOrDefault(); + lastCount =(int) (await _readingTaskQuestionAnswerRepository.Where(x => x.VisitTaskId == lastTask.VisitTaskId && x.ReadingQuestionTrialId == cewBoneLesionsCountQuestionId).Select(x => x.Answer).FirstOrDefaultAsync()).IsNullOrEmptyReturn0(); + } + + var result= inDto.QuestionInfo.Where(x => x.LesionType == LesionType.NewLesions).SelectMany(x => x.TableRowInfoList) + .Where(x => x.TableQuestionList.Any(y => y.QuestionMark == QuestionMark.State && y.Answer == EvaluationOfState.Exists.GetEnumInt())) .Count(); - return result; + + + return lastCount+ result; } #endregion @@ -737,6 +744,12 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate { return VisitTumorEvaluation.NA.GetEnumInt(); } + + //如果日期未知,不需要计算肿瘤评估结果; + if (await GetNumberOfDaysBetween(inDto) == -1) + { + return string.Empty; + } var isPD= await ChangeLastTaskSiteVisitForTumorEvaluation(inDto); var newLesionsCount = inDto.QuestionInfo.Where(x => x.QuestionType == QuestionType.NewLesionsCount).Select(x => x.Answer).FirstOrDefault().IsNullOrEmptyReturn0(); var baseLineLesionsCount = inDto.QuestionInfo.Where(x => x.QuestionType == QuestionType.BaseLineLesionsCount).Select(x => x.Answer).FirstOrDefault().IsNullOrEmptyReturn0(); @@ -858,6 +871,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate var taskinfo = await _visitTaskRepository.Where(x => x.Id == inDto.VisitTaskId).FirstNotNullAsync(); siteVisitForTumorList = await _visitTaskRepository.Where(x => (x.ReadingCategory == ReadingCategory.Visit && x.TrialReadingCriterionId == taskinfo.TrialReadingCriterionId && + x.DoctorUserId== taskinfo.DoctorUserId&& x.IsAnalysisCreate==inDto.IsAnalysisCreate&& x.SubjectId == taskinfo.SubjectId && x.ReadingTaskState == ReadingTaskState.HaveSigned && x.VisitTaskNum <= taskinfo.VisitTaskNum && x.TaskState == TaskState.Effect && x.ArmEnum == taskinfo.ArmEnum )||x.Id== inDto.VisitTaskId).OrderByDescending(x => x.VisitTaskNum).Select(x => new SiteVisitForTumor()