diff --git a/IRaCIS.Core.Application/Service/ReadingCalculate/LuganoCalculateService.cs b/IRaCIS.Core.Application/Service/ReadingCalculate/LuganoCalculateService.cs index 8e076fe53..f7048717a 100644 --- a/IRaCIS.Core.Application/Service/ReadingCalculate/LuganoCalculateService.cs +++ b/IRaCIS.Core.Application/Service/ReadingCalculate/LuganoCalculateService.cs @@ -454,7 +454,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate { //垂直径乘积之和(SPD) - //new ReadingCalculateData (){QuestionType=QuestionType.sp,GetDecimalNullFun=GetSODData}, + new ReadingCalculateData (){QuestionType=QuestionType.SPD,GetDecimalFun=GetSPD}, ////靶病灶径线之和(SOD) //new ReadingCalculateData (){QuestionType=QuestionType.SOD,GetDecimalNullFun=GetSODData}, @@ -489,11 +489,11 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate //靶病灶评估 new ReadingCalculateData (){QuestionType=QuestionType.TargetLesion,GetStringFun=GetTargetLesionEvaluate}, - ////非靶病灶评估 - // new ReadingCalculateData (){QuestionType=QuestionType.NoTargetLesion,GetStringFun=GetNoTargetLesionEvaluate}, + //非靶病灶评估 + new ReadingCalculateData (){QuestionType=QuestionType.NoTargetLesion,GetStringFun=GetNoTargetLesionEvaluate}, - ////是否存在新病灶 - // new ReadingCalculateData (){QuestionType=QuestionType.NewLesions,GetStringFun=GetNewLesionEvaluate}, + //新病灶评估 + new ReadingCalculateData (){QuestionType=QuestionType.NewLesions,GetStringFun=GetNewLesionEvaluate}, // //整体肿瘤评估 // new ReadingCalculateData (){QuestionType=QuestionType.Tumor,GetStringFun=GetTumor}, @@ -1453,6 +1453,26 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate #region 计算阅片问题 外层问题 + #region 获取SPD + + /// + /// 获取SPD + /// + /// + /// + public async Task GetSPD(ReadingCalculateDto inDto) + { + decimal result = 0; + var rowInfo = inDto.QuestionInfo.Where(x => x.LesionType == LesionType.TargetLesion).SelectMany(x => x.TableRowInfoList).ToList(); + + var tableQuestionList = rowInfo.SelectMany(x => x.TableQuestionList).ToList(); + + result = tableQuestionList.Where(x => x.QuestionMark == QuestionMark.PPD).Sum(x => x.Answer.IsNullOrEmptyReturn0()); + return result; + + } + #endregion + #region 获取靶病灶评估 /// /// 获取靶病灶评估 @@ -1466,9 +1486,6 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate //{ // return TargetAssessment.NA.GetEnumInt(); //} - - - var tableQuestions = rowInfo.SelectMany(x => x.TableQuestionList).ToList(); TargetAssessment result = TargetAssessment.SD; @@ -1486,16 +1503,41 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate // 基线非淋巴结靶病灶不存在,或者当前访视非淋巴结靶病灶全部消失; eqCR = eqCR && item.TableQuestionList.Any(x => x.QuestionMark == QuestionMark.State && x.Answer.EqEnum(TargetState.Loss)); } - spd += (item.TableQuestionList.Where(x => x.QuestionMark == QuestionMark.PPD).Select(x => x.Answer).FirstOrDefault()).IsNullOrEmptyReturn0(); - - if (item.TableQuestionList.Any(x => x.QuestionMark == QuestionMark.IsLymph && x.Answer.EqEnum(YesOrNoOrNa.Yes))) { // 当前访视淋巴结靶病灶的状态全部变为“消失” eqCR = eqCR && item.TableQuestionList.Any(x => x.QuestionMark == QuestionMark.State && x.Answer.EqEnum(TargetState.Loss)); } } + // 1、与基线相比SPD变化的百分比 ≥50%,; + // 并且 当前访视没有任何一个状态为“疾病进展”的靶病灶 + var eqPR = false; + + if (inDto.IsBaseLine) + { + eqPR = false; + } + else + { + // 先找到基线的任务 + var baseLineTaskId = await _visitTaskRepository.Where(x => x.SubjectId == inDto.SubjectId && x.ReadingCategory == ReadingCategory.Visit + && x.TrialReadingCriterionId == inDto.TrialReadingCriterionId && + x.SourceSubjectVisit.IsBaseLine && x.TaskState == TaskState.Effect && + x.IsAnalysisCreate == inDto.IsAnalysisCreate + && x.DoctorUserId == inDto.DoctorUserId + && x.IsSelfAnalysis == inDto.IsSelfAnalysis && x.ArmEnum == inDto.ArmEnum) + .Select(x => x.Id).FirstOrDefaultAsync(); + + var baseLineSPD = (await _readingTaskQuestionAnswerRepository.Where(x => x.VisitTaskId == baseLineTaskId && x.ReadingQuestionTrial.QuestionType == QuestionType.SPD).Select(x => x.Answer).FirstOrDefaultAsync()).IsNullOrEmptyReturn0(); + var presentSPD = inDto.QuestionInfo.Where(x => x.QuestionType == QuestionType.SPD).Select(x => x.Answer).FirstIsNullReturnEmpty().IsNullOrEmptyReturn0(); + + if (baseLineSPD > 0) + { + eqPR = (presentSPD - baseLineSPD) / baseLineSPD > 0.5m && !tableQuestions.Any(x => x.QuestionMark == QuestionMark.State && x.Answer.Equals(TargetState.DiseaseProgression)); + } + } + //基线未选择靶病灶 @@ -1521,9 +1563,9 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate } // 1、与基线相比SPD变化的百分比 ≥50%,; // 并且 当前访视没有任何一个状态为“疾病进展”的靶病灶 - else if (eqCR) + else if (eqPR) { - result = TargetAssessment.CR; + result = TargetAssessment.PR; } @@ -1541,51 +1583,42 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate public async Task GetNoTargetLesionEvaluate(ReadingCalculateDto inDto) { - NoTargetAssessment result = NoTargetAssessment.NN; + NoTargetAssessment result = NoTargetAssessment.PD; - if (inDto.IsBaseLine) - { - return NoTargetAssessment.NA.GetEnumInt(); - } + //if (inDto.IsBaseLine) + //{ + // return NoTargetAssessment.NA.GetEnumInt(); + //} var tableRows = inDto.QuestionInfo.Where(x => x.LesionType == LesionType.NonTargetLesions).SelectMany(x => x.TableRowInfoList).ToList(); var tableQuestions = tableRows.SelectMany(x => x.TableQuestionList).ToList(); - //任意单个病灶 / 病灶组评估为“显著增大” - if (tableQuestions.Any(x => x.QuestionMark == QuestionMark.State && x.Answer.EqEnum(NoTargetState.Increase))) + //基线未选择非靶病灶 + if (tableQuestions.Count() == 0) + { + result = NoTargetAssessment.ND; + } + // 随访至少存在一个状态为“显著增大”的非靶病灶 + else if (tableQuestions.Any(x => x.QuestionMark == QuestionMark.State && x.Answer.EqEnum(NoTargetState.Increase))) { result = NoTargetAssessment.PD; } - // 任意单个病灶/病灶组评估为“无法评估”并且没有“显著增大” - else if (tableQuestions.Any(x => x.QuestionMark == QuestionMark.State && x.Answer.EqEnum(NoTargetState.UnableEvaluate)) && - !tableQuestions.Any(x => x.QuestionMark == QuestionMark.State && x.Answer.EqEnum(NoTargetState.Increase)) - ) + // 1、随访没有任何一个状态为“显著增大”的非靶病灶; + // 2、随访存在至少一个状态为“不可评估”的非靶病灶 + else if (!tableQuestions.Any(x => x.QuestionMark == QuestionMark.State && x.Answer.EqEnum(NoTargetState.Increase)) + && tableQuestions.Any(x => x.QuestionMark == QuestionMark.State && x.Answer.EqEnum(NoTargetState.UnableEvaluate))) { result = NoTargetAssessment.NE; } - // 所有单个病灶/病灶组评估为”存在”或者有些评估为“消失”有些评估为“存在”,且没有“显著增大”和“无法评估”的病灶 - else if (tableQuestions.Any(x => x.QuestionMark == QuestionMark.State && x.Answer.EqEnum(NoTargetState.Exist)) - && !tableQuestions.Any(x => x.QuestionMark == QuestionMark.State && (x.Answer.EqEnum(NoTargetState.Increase) || x.Answer.EqEnum(NoTargetState.UnableEvaluate))) - - ) - { - result = NoTargetAssessment.NN; - } //所有单个病灶/病灶组状态评估状态为“消失” else if (tableQuestions.Count(x => x.QuestionMark == QuestionMark.State && x.Answer.EqEnum(NoTargetState.Loss))== tableQuestions.Count(x=> x.QuestionMark == QuestionMark.State) && tableQuestions.Count(x => x.QuestionMark == QuestionMark.State)>0) { result = NoTargetAssessment.CR; } - - // 基线时没有非靶病灶 - else if (tableQuestions.Count() == 0) - { - result = NoTargetAssessment.ND; - } else { - return string.Empty; + result = NoTargetAssessment.PRSD; } return result.GetEnumInt(); @@ -1604,10 +1637,10 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate { NewLesionAssessment result = NewLesionAssessment.No; - if (inDto.IsBaseLine) - { - return NewLesionAssessment.NA.GetEnumInt(); - } + //if (inDto.IsBaseLine) + //{ + // return NewLesionAssessment.NA.GetEnumInt(); + //} var tableRows = inDto.QuestionInfo.Where(x => x.LesionType == LesionType.NewLesions).SelectMany(x => x.TableRowInfoList).ToList(); diff --git a/IRaCIS.Core.Domain.Share/Reading/ReadEnum.cs b/IRaCIS.Core.Domain.Share/Reading/ReadEnum.cs index 4c6fdcd98..eacb7397f 100644 --- a/IRaCIS.Core.Domain.Share/Reading/ReadEnum.cs +++ b/IRaCIS.Core.Domain.Share/Reading/ReadEnum.cs @@ -944,6 +944,11 @@ namespace IRaCIS.Core.Domain.Share iUPD = 7, iCPD = 8, + /// + /// PR/SD + /// + PRSD = 9, + } /// @@ -1760,7 +1765,65 @@ namespace IRaCIS.Core.Domain.Share /// NewLesionEvaluation = 30, + /// + /// 垂直径乘积之和(SPD) + /// + SPD = 31, + /// + /// 与基线相比SPD变化的百分比 + /// + SPDChange = 32, + + /// + /// 与基线相比脾肿大增加的百分比 + /// + SplenoncusChange = 33, + + /// + /// 与最低点相比脾脏垂直径长度的增加值 + /// + SplenoncusAdd = 34, + + /// + /// 与基线相比脾垂直径变化值 + /// + SplenoncusDiameterChange = 35, + + /// + /// 脾肿垂直径最低点访视 + /// + LowestSplenoncusVisit = 36, + + /// + /// 肝脏评估 + /// + LiverAssessment = 37, + + /// + /// 脾脏评估 + /// + SplenicEvaluation = 38, + + /// + /// CT/MRI总体评估 + /// + CTandMRI = 39, + + /// + /// 前次FDG-PET总体评估 + /// + LastFDGPET = 40, + + /// + /// FDG-PET总体评估 + /// + FDGPET = 41, + + /// + /// 影像学整体肿瘤评估 + /// + ImgOncology = 42, /// /// 是否脑转移