From 87992a36e148a98aaef809bd3ba677486f7ae9d5 Mon Sep 17 00:00:00 2001 From: he <10978375@qq.com> Date: Thu, 31 Aug 2023 15:45:02 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../LuganoCalculateService.cs | 367 +++--------------- IRaCIS.Core.Domain.Share/Reading/ReadEnum.cs | 7 +- 2 files changed, 56 insertions(+), 318 deletions(-) diff --git a/IRaCIS.Core.Application/Service/ReadingCalculate/LuganoCalculateService.cs b/IRaCIS.Core.Application/Service/ReadingCalculate/LuganoCalculateService.cs index d5babeb63..ba1ff2447 100644 --- a/IRaCIS.Core.Application/Service/ReadingCalculate/LuganoCalculateService.cs +++ b/IRaCIS.Core.Application/Service/ReadingCalculate/LuganoCalculateService.cs @@ -452,50 +452,50 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate List calculateList = new List() { - //靶病灶径线之和(SOD) - new ReadingCalculateData (){QuestionType=QuestionType.SOD,GetDecimalNullFun=GetSODData}, + ////靶病灶径线之和(SOD) + //new ReadingCalculateData (){QuestionType=QuestionType.SOD,GetDecimalNullFun=GetSODData}, - //非淋巴结靶病灶长径之和 - new ReadingCalculateData (){QuestionType=QuestionType.SumOfDiameter,GetDecimalNullFun=GetSumOfDiameter}, + ////非淋巴结靶病灶长径之和 + //new ReadingCalculateData (){QuestionType=QuestionType.SumOfDiameter,GetDecimalNullFun=GetSumOfDiameter}, - //与基线SOD相比变化量(mm) - new ReadingCalculateData (){QuestionType=QuestionType.SODChange,GetDecimalNullFun=GetSODChange}, + ////与基线SOD相比变化量(mm) + // new ReadingCalculateData (){QuestionType=QuestionType.SODChange,GetDecimalNullFun=GetSODChange}, - //与基线访视相比SOD变化百分比 - new ReadingCalculateData (){QuestionType=QuestionType.SODPercent,GetDecimalNullFun=GetSODPercent}, + ////与基线访视相比SOD变化百分比 + // new ReadingCalculateData (){QuestionType=QuestionType.SODPercent,GetDecimalNullFun=GetSODPercent}, - //与整个访视期间SOD最低点相比增加的值(mm) //其他任务需要改 - new ReadingCalculateData (){QuestionType=QuestionType.LowestIncrease,GetDecimalNullFun=GetLowestIncrease,/*ChangeAllTaskFun=ChangeAllLowestIncrease*/}, + ////与整个访视期间SOD最低点相比增加的值(mm) //其他任务需要改 + // new ReadingCalculateData (){QuestionType=QuestionType.LowestIncrease,GetDecimalNullFun=GetLowestIncrease,/*ChangeAllTaskFun=ChangeAllLowestIncrease*/}, - //与整个访视期间SOD最低点相比增加的百分比 //其他任务需要改 - new ReadingCalculateData (){QuestionType=QuestionType.LowPercent,GetDecimalNullFun=GetLowPercent,/*ChangeAllTaskFun=ChangeAllLowPercent*/}, + // //与整个访视期间SOD最低点相比增加的百分比 //其他任务需要改 + // new ReadingCalculateData (){QuestionType=QuestionType.LowPercent,GetDecimalNullFun=GetLowPercent,/*ChangeAllTaskFun=ChangeAllLowPercent*/}, - //整个访视期间SOD最低点访视名称 //其他任务需要改 - new ReadingCalculateData (){QuestionType=QuestionType.LowVisit,GetStringFun=GetLowVisit,/*ChangeAllTaskFun=ChangeAllLowVisitName*/}, + ////整个访视期间SOD最低点访视名称 //其他任务需要改 + // new ReadingCalculateData (){QuestionType=QuestionType.LowVisit,GetStringFun=GetLowVisit,/*ChangeAllTaskFun=ChangeAllLowVisitName*/}, - //是否存在非淋巴结靶病灶 - new ReadingCalculateData (){QuestionType=QuestionType.IsLymphTarget,GetStringFun=GetIsLymphTarget}, + // //是否存在非淋巴结靶病灶 + // new ReadingCalculateData (){QuestionType=QuestionType.IsLymphTarget,GetStringFun=GetIsLymphTarget}, - //是否存在淋巴结靶病灶且该病灶比上一访视短径增加5MM以上 - new ReadingCalculateData (){QuestionType=QuestionType.IsAddFive,GetStringFun=GetIsAddFive}, + // //是否存在淋巴结靶病灶且该病灶比上一访视短径增加5MM以上 + // new ReadingCalculateData (){QuestionType=QuestionType.IsAddFive,GetStringFun=GetIsAddFive}, - //被评估为NE的单个靶病灶 - new ReadingCalculateData (){QuestionType=QuestionType.NETarget,GetStringFun=GetNETarget}, + // //被评估为NE的单个靶病灶 + // new ReadingCalculateData (){QuestionType=QuestionType.NETarget,GetStringFun=GetNETarget}, //靶病灶评估 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}, + // //整体肿瘤评估 + // new ReadingCalculateData (){QuestionType=QuestionType.Tumor,GetStringFun=GetTumor}, - //是否存在疾病 - new ReadingCalculateData (){QuestionType=QuestionType.ExistDisease,GetStringFun=GetIsExistDisease}, + // //是否存在疾病 + // new ReadingCalculateData (){QuestionType=QuestionType.ExistDisease,GetStringFun=GetIsExistDisease}, }; @@ -1454,307 +1454,40 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate /// 获取靶病灶评估 /// /// - /// - /// 靶病灶疗效评估算法-20230306确认版本: - ///if(基线没有靶病灶) - ///{ - /// 靶病灶疗效为 ND - ///}else - ///{ - /// 初始化靶病灶疗效为 SD - /// - /// if (与基线期SOD相比减小≥30 %) - /// { - /// 靶病灶疗效为 PR - /// - /// } - /// - ///if (非淋巴结靶病灶长径之和 == 0 并且所有淋巴结靶病灶的短径 < 10且淋巴结非靶病灶全部消失) - /// { - /// 靶病灶疗效为 CR - /// - /// } - /// - ///if (有被评估为NE的单个靶病灶) - /// { - /// 靶病灶疗效为 NE - /// - /// } - /// - ///if (最低点SOD > 0) - ///{ - /// if(比整体访视期间最低点SOD增加≥20 % 且与整个访视期间最低点相比增加的值≥5 mm) - /// { - /// 靶病灶疗效为 PD - /// - /// } - ///} - ///else - ///{ - /// //进入该分支最低点SOD=0 - /// if (当前访视SOD > 0 且与整个访视期间最低点相比增加的值≥5 mm) - /// { - /// 靶病灶疗效为PD - /// - /// } - ///} - /// - ///if(上次访视点评估是CR) - /// { - /// if (当前访视点淋巴结病灶,至少一个淋巴结靶病灶短径≥10 mm 并且该淋巴结靶病灶短径绝对增加值≥5 mm) - /// { - /// 靶病灶疗效为 PD - /// - /// } - /// if (当前访视点非淋巴结病灶至少一个非淋巴结靶病灶的长径>0 mm。) - /// { - /// 靶病灶疗效为 PD - /// - /// } - ///} - ///} - /// /// public async Task GetTargetLesionEvaluate(ReadingCalculateDto inDto) { - var tableQuestion = inDto.QuestionInfo.Where(x => x.LesionType == LesionType.TargetLesion).SelectMany(x => x.TableRowInfoList).ToList(); - if (inDto.IsBaseLine) - { - return TargetAssessment.NA.GetEnumInt(); - } + var rowInfo = inDto.QuestionInfo.Where(x => x.LesionType == LesionType.TargetLesion).SelectMany(x => x.TableRowInfoList).ToList(); + //if (inDto.IsBaseLine) + //{ + // return TargetAssessment.NA.GetEnumInt(); + //} - TargetLesionCalculateDto resultData = new TargetLesionCalculateDto() - { + - - // 是否存在靶病灶 - ExistsTargetLesion = tableQuestion.Count() > 0, - - // 最低SOD - LowSod = (await GetLowSODVisit(inDto)).Select(x => x.SOD).FirstOrDefault(), - - // 当前Sod - PresentSod = (await GetSODData(inDto)) ?? 0, - - //非淋巴结靶病灶长径之和 decimal - SumOfDiameter = inDto.QuestionInfo.Where(x => x.QuestionType == QuestionType.SumOfDiameter).Sum(x => x.Answer.IsNullOrEmptyReturn0()), - - //所有淋巴结靶病灶的短径小于10mm bool - DiameterLessThan10 = true, - - // SOD变化百分比 - SODPercent = inDto.QuestionInfo.Where(x => x.QuestionType == QuestionType.SODPercent).Sum(x => x.Answer.IsNullOrEmptyReturn0()), - - // SOD 百分比与基线期SOD相比减小≥30% bool - SODPercentBigger30 = inDto.QuestionInfo.Where(x => x.QuestionType == QuestionType.SODPercent).Sum(x => x.Answer.IsNullOrEmptyReturn0()) <= -30, - - // SOD 百分比 与基线期SOD相比减小<30% bool - SODPercentLess30 = 0 > inDto.QuestionInfo.Where(x => x.QuestionType == QuestionType.SODPercent).Sum(x => x.Answer.IsNullOrEmptyReturn0()) && - - inDto.QuestionInfo.Where(x => x.QuestionType == QuestionType.SODPercent).Sum(x => x.Answer.IsNullOrEmptyReturn0()) > -30, - - // SOD 百分比 整体访视期间SOD最低点SOD相比增加<20% - LowSODPercentLess20 = inDto.QuestionInfo.Where(x => x.QuestionType == QuestionType.LowPercent).Sum(x => x.Answer.IsNullOrEmptyReturn0()) < 20, - - // SOD 百分比 比整体访视期间SOD最低点SOD增加≥20% - LowSODPercentBigger20 = inDto.QuestionInfo.Where(x => x.QuestionType == QuestionType.LowPercent).Sum(x => x.Answer.IsNullOrEmptyReturn0()) >= 20, - - // SOD 变化值 比整体访视期间SOD最低点SOD绝对增加值<5 mm - LowSODChangeLess5 = inDto.QuestionInfo.Where(x => x.QuestionType == QuestionType.LowestIncrease).Sum(x => x.Answer.IsNullOrEmptyReturn0()) < 5, - - // 比整体访视期间SOD最低点SOD绝对增加值≥5 mm - LowSODChangeBigger5 = inDto.QuestionInfo.Where(x => x.QuestionType == QuestionType.LowestIncrease).Sum(x => x.Answer.IsNullOrEmptyReturn0()) >= 5, - - // 被评估为NE的单个靶病灶 是否存在状态为不可评估的靶病灶 - ExixtsNETargetLesion = tableQuestion.SelectMany(x => x.TableQuestionList).Any(x => x.QuestionMark == QuestionMark.State && x.Answer.EqEnum(TargetState.UnableEvaluate)), - - //// 上次访视点整体肿瘤评估 - LastTargetLesionEvaluate = string.Empty, - - // 当前访视点非淋巴结病灶至少一个非淋巴结靶病灶的长径>0 mm - CurrentMajoreBigger0 = false, - - // 当前访视点淋巴结病灶, 至少一个淋巴结靶病灶短径≥10 mm - CurrenShortBigger10 = false, - - // 靶病灶短径增加值有5mm的Index - AddFiveIndexs = await GetIsAddFiveRowIndexs(inDto), - - // 短径有10mm的Index - ShortBigger10Indexs = new List(), - - //淋巴结非靶病灶状态全部为消失 - NonTargetStateIsLoss = true, - - // 该淋巴结靶病灶短径绝对增加值≥5 mm - IsAddFive = inDto.QuestionInfo.Where(x => x.QuestionType == QuestionType.IsAddFive && x.Answer.EqEnum(YesOrNoOrNa.Yes)).Count() > 0, - }; - - var nonTargetTableQuestion = inDto.QuestionInfo.Where(x => x.LesionType == LesionType.NonTargetLesions).SelectMany(x => x.TableRowInfoList).ToList(); - - foreach (var item in nonTargetTableQuestion) - { - if (item.TableQuestionList.Any(x => x.QuestionMark == QuestionMark.IsLymph && x.Answer.EqEnum(YesOrNoOrNa.Yes))) - { - // 淋巴结非靶病灶状态全部为消失 - resultData.NonTargetStateIsLoss = resultData.NonTargetStateIsLoss&& item.TableQuestionList.Where(x => x.QuestionMark == QuestionMark.State).Select(x => x.Answer).FirstOrDefault()== NoTargetState.Loss.GetEnumInt(); - } - } - - - foreach (var item in tableQuestion) - { - if (item.TableQuestionList.Any(x => x.QuestionMark == QuestionMark.IsLymph && x.Answer.EqEnum(YesOrNoOrNa.Yes))) - { - // 淋巴结的短径 - resultData.DiameterLessThan10 = resultData.DiameterLessThan10&&(item.TableQuestionList.Where(x => x.QuestionMark == QuestionMark.ShortAxis).Select(x => x.Answer).FirstOrDefault()).IsNullOrEmptyReturn0() < 10; - - var shortIsBigger10 = (item.TableQuestionList.Where(x => x.QuestionMark == QuestionMark.ShortAxis).Select(x => x.Answer).FirstOrDefault()).IsNullOrEmptyReturn0() >= 10; - resultData.CurrenShortBigger10= resultData.CurrenShortBigger10|| shortIsBigger10; - - if (shortIsBigger10) - { - resultData.ShortBigger10Indexs.Add(item.RowIndex); - } - - - } - - if (item.TableQuestionList.Any(x => x.QuestionMark == QuestionMark.IsLymph && !x.Answer.EqEnum(YesOrNoOrNa.Yes))) - { - // 当前访视点非淋巴结病灶至少一个非淋巴结靶病灶的长径 - resultData.CurrentMajoreBigger0 = resultData.CurrentMajoreBigger0|| (item.TableQuestionList.Where(x => x.QuestionMark == QuestionMark.MajorAxis).Select(x => x.Answer).FirstOrDefault()).IsNullOrEmptyReturn0() > 0; - } - } - - - var lastVisitTaskId = await GetLastVisitTaskId(inDto); - var questionId = inDto.QuestionInfo.Where(x => x.QuestionType == QuestionType.Tumor).Select(x => x.QuestionId).FirstOrDefault(); - resultData.LastTargetLesionEvaluate = (await _readingTaskQuestionAnswerRepository.Where(x => x.VisitTaskId == lastVisitTaskId && x.ReadingQuestionTrialId == questionId) - .Select(x => x.Answer).FirstOrDefaultAsync()) ?? string.Empty; + var tableQuestions = rowInfo.SelectMany(x => x.TableQuestionList).ToList(); TargetAssessment result = TargetAssessment.SD; - //if(基线没有靶病灶) - if (!resultData.ExistsTargetLesion) + + //基线未选择靶病灶 + if (rowInfo.Count() == 0) { - // 靶病灶疗效为 ND result = TargetAssessment.ND; } - else + // 任一单个病灶进展即可 + else if (tableQuestions.Any(x => x.QuestionMark == QuestionMark.State && x.Answer.EqEnum(TargetState.DiseaseProgression))) { - //初始化靶病灶疗效为 SD - result = TargetAssessment.SD; - - //if (与基线期SOD相比减小≥30 %) - if (resultData.SODPercentBigger30) - { - //靶病灶疗效为 PR - result = TargetAssessment.PR; - } - //if (非淋巴结靶病灶长径之和 == 0 并且所有淋巴结靶病灶的短径 < 10且淋巴结非靶病灶全部消失) - if (resultData.SumOfDiameter == 0 && resultData.DiameterLessThan10 && resultData.NonTargetStateIsLoss) - { - //靶病灶疗效为 CR - result = TargetAssessment.CR; - } - // if (有被评估为NE的单个靶病灶) - if (resultData.ExixtsNETargetLesion) - { - // 靶病灶疗效为 NE - result = TargetAssessment.NE; - } - //if (最低点SOD > 0) - if (resultData.LowSod > 0) - { - // if(比整体访视期间最低点SOD增加≥20 % 且与整个访视期间最低点相比增加的值≥5 mm) - if (resultData.LowSODPercentBigger20 && resultData.LowSODChangeBigger5) - { - // 靶病灶疗效为 PD - result = TargetAssessment.PD; - } - } - else - { - //进入该分支最低点SOD=0 - // if (当前访视SOD > 0 且与整个访视期间最低点相比增加的值≥5 mm) - if (resultData.PresentSod > 0 && resultData.LowSODChangeBigger5) - { - // 靶病灶疗效为PD - result = TargetAssessment.PD; - } - } - //if(上次访视点评估是CR) - if (resultData.LastTargetLesionEvaluate.EqEnum(TargetAssessment.CR)) - { - //if (当前访视点淋巴结病灶,至少一个淋巴结靶病灶短径≥10 mm 并且该淋巴结靶病灶短径绝对增加值≥5 mm) - // 换句话说 就是 短径≥10 的病灶 和 短径增加值≥5的病灶 的交集数量大于0 - if (resultData.ShortBigger10Indexs.Intersect(resultData.AddFiveIndexs).ToList().Count()>0) - { - //靶病灶疗效为 PD - result = TargetAssessment.PD; - } - //if (当前访视点非淋巴结病灶至少一个非淋巴结靶病灶的长径>0 mm。) - if (resultData.CurrentMajoreBigger0) - { - //靶病灶疗效为 PD - result = TargetAssessment.PD; - } - } - - - - #region 之前的逻辑 备注 - //if (resultData.LastTargetLesionEvaluate.EqEnum(TargetAssessment.CR)) - //{ - // if (resultData.ExixtsNETargetLesion) - // { - // result = TargetAssessment.NE; - // } - // if (resultData.CurrenShortBigger10 && resultData.IsAddFive) - // { - // result = TargetAssessment.PD; - // } - // if (resultData.CurrentMajoreBigger0) - // { - // result = TargetAssessment.PD; - // } - //} - - //else - //{ - // if (resultData.LowSod != 0 && resultData.LowPercentBigger20 && resultData.LowChangeBigger5) - // { - // result = TargetAssessment.PD; - // } - // else - // { - // if (resultData.ExixtsNETargetLesion) - // { - // result = TargetAssessment.NE; - // } - // else - // { - // if (resultData.SODPercentBigger30) - // { - // if (resultData.LowPercentLess20 || resultData.LowChangeLess5) - // { - // result = TargetAssessment.PR; - // } - - // if (resultData.SumOfDiameter == 0 && resultData.DiameterLessThan10 && resultData.NonTargetStateIsLoss) - // { - // result = TargetAssessment.CR; - // } - // } - // } - // } - - - //} - #endregion - - + result = TargetAssessment.PD; } + //在排除PD后,有任一靶病灶为NE状态 + else if (tableQuestions.Any(x => x.QuestionMark == QuestionMark.State && x.Answer.EqEnum(TargetState.UnableEvaluate))) + { + result = TargetAssessment.PD; + } + + + + return result.GetEnumInt(); } diff --git a/IRaCIS.Core.Domain.Share/Reading/ReadEnum.cs b/IRaCIS.Core.Domain.Share/Reading/ReadEnum.cs index 0558b4bff..4c6fdcd98 100644 --- a/IRaCIS.Core.Domain.Share/Reading/ReadEnum.cs +++ b/IRaCIS.Core.Domain.Share/Reading/ReadEnum.cs @@ -1088,7 +1088,12 @@ namespace IRaCIS.Core.Domain.Share /// /// 消失 /// - Loss = 3 + Loss = 3, + + /// + /// 疾病进展 + /// + DiseaseProgression = 4 } ///