diff --git a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml index 679fd0af3..5190b6352 100644 --- a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml +++ b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml @@ -1491,6 +1491,8 @@ + + @@ -1499,13 +1501,6 @@ - - - 获取新病灶评估 - - - - 删除病灶获取起始病灶序号 @@ -7421,6 +7416,26 @@ 至少有一个病灶无法评估 + + + IRECIST新病灶Dto + + + + + 上一次任务的新病灶评估为iUPD + + + + + IRECIST整体肿瘤评估 + + + + + 上一次任务的评估为iUPD或者iCPD + + SubjectCriteriaEvaluationView 列表视图模型 diff --git a/IRaCIS.Core.Application/Service/Reading/Dto/ReadingCalculateViewModel.cs b/IRaCIS.Core.Application/Service/Reading/Dto/ReadingCalculateViewModel.cs index 71fb881db..832715bc4 100644 --- a/IRaCIS.Core.Application/Service/Reading/Dto/ReadingCalculateViewModel.cs +++ b/IRaCIS.Core.Application/Service/Reading/Dto/ReadingCalculateViewModel.cs @@ -129,6 +129,8 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto public string TaskBlindName { get; set; } = string.Empty; + public bool IsConvertedTask { get; set; } + public bool IsAnalysisCreate { get; set; } public bool? IsSelfAnalysis { get; set; } @@ -291,6 +293,8 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto public Func> GetStringFun { get; set; } public Func ChangeAllTaskFun { get; set; } + + public bool IsConvertedTask { get; set; } = false; } } diff --git a/IRaCIS.Core.Application/Service/ReadingCalculate/Dto/CriterionCalculateDto.cs b/IRaCIS.Core.Application/Service/ReadingCalculate/Dto/CriterionCalculateDto.cs index a527181a4..ddb33a8a0 100644 --- a/IRaCIS.Core.Application/Service/ReadingCalculate/Dto/CriterionCalculateDto.cs +++ b/IRaCIS.Core.Application/Service/ReadingCalculate/Dto/CriterionCalculateDto.cs @@ -266,4 +266,26 @@ namespace IRaCIS.Core.Application.ViewModel /// public bool ExixtsUnevaluableState { get; set; } } + + /// + /// IRECIST新病灶Dto + /// + public class IRECISTNewLesionAssessmentDto + { + /// + /// 上一次任务的新病灶评估为iUPD + /// + public bool LastTaskNewLesioniUPD { get; set; } + } + + /// + /// IRECIST整体肿瘤评估 + /// + public class IRECISTTargetLesionEvaluateDto + { + /// + /// 上一次任务的评估为iUPD或者iCPD + /// + public bool LastTaskLesioniUPDOriCPD { get; set; } + } } diff --git a/IRaCIS.Core.Application/Service/ReadingCalculate/General/GeneralCalculateService.cs b/IRaCIS.Core.Application/Service/ReadingCalculate/General/GeneralCalculateService.cs index 4644a978a..d9407fc06 100644 --- a/IRaCIS.Core.Application/Service/ReadingCalculate/General/GeneralCalculateService.cs +++ b/IRaCIS.Core.Application/Service/ReadingCalculate/General/GeneralCalculateService.cs @@ -120,7 +120,8 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate ReadingCalculateDto readingData = new ReadingCalculateDto() { SubjectId = visitTask.SubjectId, - TaskBlindName= visitTask.TaskBlindName, + TaskBlindName = visitTask.TaskBlindName, + IsConvertedTask = await _visitTaskRepository.Where(x => x.Id == visitTaskId).Select(x => x.IsConvertedTask).FirstOrDefaultAsync(), VisitTaskId = visitTaskId, SubjectVisitId = visitTask.SourceSubjectVisitId!.Value, QuestionInfo = questionInfos, diff --git a/IRaCIS.Core.Application/Service/ReadingCalculate/IRECIST1Point1CalculateService.cs b/IRaCIS.Core.Application/Service/ReadingCalculate/IRECIST1Point1CalculateService.cs index 1ac0f3661..3d95d93d5 100644 --- a/IRaCIS.Core.Application/Service/ReadingCalculate/IRECIST1Point1CalculateService.cs +++ b/IRaCIS.Core.Application/Service/ReadingCalculate/IRECIST1Point1CalculateService.cs @@ -448,32 +448,57 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate //被评估为NE的单个靶病灶 new ReadingCalculateData (){QuestionType=QuestionType.NETarget,GetStringFun=GetNETarget}, - // 与前一访视SOD相比变化量 + // 与前一访视SOD相比变化量 new ReadingCalculateData (){QuestionType=QuestionType.LastVisitSODChange,GetDecimalNullFun=GetLastTaskSODChange}, //新靶病灶直径之和(iSOD) new ReadingCalculateData (){QuestionType=QuestionType.ISOD,GetDecimalNullFun=GetiSODData}, - // 与前一访视相比iSOD变化量 - new ReadingCalculateData (){QuestionType=QuestionType.LastVisitiSODChange,GetDecimalNullFun=GetISODChange}, + // 与前一访视相比iSOD变化量 + new ReadingCalculateData (){QuestionType=QuestionType.LastVisitiSODChange,GetDecimalNullFun=GetISODChange}, - //靶病灶评估 + // 靶病灶评估 new ReadingCalculateData (){QuestionType=QuestionType.TargetLesion,GetStringFun=GetTargetLesionEvaluate}, + // IRECIST靶病灶评估 + new ReadingCalculateData (){QuestionType=QuestionType.TargetLesion,GetStringFun=GetIRECISTTargetLesionEvaluate,IsConvertedTask=true}, + //非靶病灶评估 new ReadingCalculateData (){QuestionType=QuestionType.NoTargetLesion,GetStringFun=GetNoTargetLesionEvaluate}, - //新病灶评估 - new ReadingCalculateData (){QuestionType=QuestionType.NewLesionEvaluation,GetStringFun=GetNewLesionEvaluate}, + //IRECIST非靶病灶评估 + new ReadingCalculateData (){QuestionType=QuestionType.NoTargetLesion,GetStringFun=GetIRECISTNoTargetLesionEvaluate,IsConvertedTask=true}, + + // IRECIST新靶病灶评估 + new ReadingCalculateData (){QuestionType=QuestionType.NewTargetLesion,GetStringFun=GetNewTargetLesionEvaluate,IsConvertedTask=true}, + + // IRECIST新非靶病灶评估 + new ReadingCalculateData (){QuestionType=QuestionType.NewNoTargetLesion,GetStringFun=GetNewNoTargetLesionEvaluate,IsConvertedTask=true}, + + // IRECIST其它既往新病灶评估 + new ReadingCalculateData (){QuestionType=QuestionType.OtherNewTargetLesion,GetStringFun=GetOtherNewTargetLesionEvaluate,IsConvertedTask=true}, + + // IRECIST触发iRECIST后新病灶评估 + new ReadingCalculateData (){QuestionType=QuestionType.IRECISTNewTargetLesion,GetStringFun=GetNewLesionAfterTriggeringiRECSITAssessment,IsConvertedTask=true}, + + //IRECIST新病灶评估 + new ReadingCalculateData (){QuestionType=QuestionType.NewLesionEvaluation,GetStringFun=GetNewLesionAssessment,IsConvertedTask=true}, //整体肿瘤评估 new ReadingCalculateData (){QuestionType=QuestionType.Tumor,GetStringFun=GetTumor}, + //IRECIST整体肿瘤评估 + new ReadingCalculateData (){QuestionType=QuestionType.Tumor,GetStringFun=GetIRECSITTargetLesionEvaluate,IsConvertedTask=true}, + //是否存在疾病 new ReadingCalculateData (){QuestionType=QuestionType.ExistDisease,GetStringFun=GetIsExistDisease}, }; + // 过滤转化的 + + calculateList = calculateList.Where(x => x.IsConvertedTask == inDto.IsConvertedTask).ToList(); + // 没有靶病灶只计算最后几个 if (inDto.QuestionInfo.Where(x => x.LesionType == LesionType.TargetLesion).Sum(x => x.TableRowInfoList.Count()) == 0) { @@ -2176,6 +2201,407 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate return result.GetEnumInt(); } #endregion + + #region 获取新病灶评估 + + + /// + /// 获取新病灶评估 + /// + /// + /// if(新靶病灶为ND&&新非靶病灶为ND&&其它既往新病灶为ND&&不存在触发iRECIST后新病灶) + /// { + /// 疗效为 ND + /// } + /// else if (新靶病灶为iCPD||新非靶病灶为iCPD) + /// { + /// 疗效为 iCPD + /// } + /// else if (前一访视新病灶评估为iCPD && (新靶病灶有存在病灶 || 新非靶病灶有存在状态病灶 || 其它既往新病灶有存在的病灶 || 触发iRECIST后新病灶有存在病灶)) + /// { + /// 疗效为 iCPD + /// } + /// else if (前一访视新病灶评估为iUPD && 新靶病灶上个访视评估为NE,本次访视评估为iUPD) + /// { + /// 疗效为 iCPD + /// } + /// else if (前一访视新病灶评估为iUPD && 新非靶病灶上个访视评估为NE,本次访视评估为iUPD) + /// { + /// 疗效为 iCPD + /// } + /// else if (前一访视新病灶评估为iUPD && 其它既往新病灶上个访视评估为NE或疑似,本次访视评估为iUPD) + /// { + /// 疗效为 iCPD + /// } + /// else if (前一访视新病灶评估为iUPD && 触发iRECIST后新病灶评估上个访视评估为NE或否或疑似,本次访视评估为是) + /// { + /// 疗效为 iCPD + /// } + /// else if (新靶病灶评估为iUPD || 新非靶病灶评估为iUPD || 其它既往新病灶评估为iUPD || 触发iRECIST后新病灶评估上个访视评估为是) + /// { + /// 疗效为 iUPD + /// } + /// else if (新靶病灶、新非靶病灶、其它既往新病灶任一项评估为NE) + /// { + /// 疗效为 NE + /// } + /// else if (其它既往新病灶或触发iRECIST后新病灶评估为“疑似”) + /// { + /// 疗效为 疑似 + /// } + /// + /// + /// + public async Task GetNewLesionAssessment(ReadingCalculateDto inDto) + { + + NewLesionAssessment? result = null; + var lastVisitTaskId = await GetLastVisitTaskId(inDto); + ReadingCalculateDto lastTaskCalculateDto = await _generalCalculateService.GetReadingCalculateDto(lastVisitTaskId); + IRECISTNewLesionAssessmentDto data = new IRECISTNewLesionAssessmentDto() + { + //上一次任务的新病灶评估为iUPD + LastTaskNewLesioniUPD = lastTaskCalculateDto.QuestionInfo.Any(x => x.QuestionType == QuestionType.NewLesionEvaluation && x.Answer.EqEnum(NewLesionAssessment.iCPD)), + }; + + // if(新靶病灶为ND&&新非靶病灶为ND&&其它既往新病灶为ND&&不存在触发iRECIST后新病灶) + if(inDto.QuestionInfo.Any(x=>x.QuestionType==QuestionType.NewTargetLesion&&x.Answer.EqEnum(NewTargetLesionAssessment.ND)) + && inDto.QuestionInfo.Any(x => x.QuestionType == QuestionType.NewNoTargetLesion && x.Answer.EqEnum(NewNoTargetLesionAssessment.ND)) + && inDto.QuestionInfo.Any(x => x.QuestionType == QuestionType.OtherNewTargetLesion && x.Answer.EqEnum(OtherPreviousNewLesionAssessment.ND)) + && inDto.QuestionInfo.Where(x => x.LesionType == LesionType.TriggeringIRECSIT).SelectMany(x => x.TableRowInfoList).Count()==0) + { + // 疗效为 ND + result = NewLesionAssessment.ND; + } + // else if (新靶病灶为iCPD||新非靶病灶为iCPD) + else if(inDto.QuestionInfo.Any(x => x.QuestionType == QuestionType.NewTargetLesion && x.Answer.EqEnum(NewTargetLesionAssessment.iCPD)) + || inDto.QuestionInfo.Any(x => x.QuestionType == QuestionType.NewNoTargetLesion && x.Answer.EqEnum(NewNoTargetLesionAssessment.iCPD))) + { + // 疗效为 iCPD + result = NewLesionAssessment.iCPD; + } + // else if (前一访视新病灶评估为iCPD && (新靶病灶有存在病灶 || 新非靶病灶有存在状态病灶 || 其它既往新病灶有存在的病灶 || 触发iRECIST后新病灶有存在病灶)) + else if(data.LastTaskNewLesioniUPD&& + (inDto.QuestionInfo.Where(x => x.LesionType == LesionType.NewTargetLesion).SelectMany(x => x.TableRowInfoList).Count() > 0 + || inDto.QuestionInfo.Where(x => x.LesionType == LesionType.NewNonTargetLesion).SelectMany(x => x.TableRowInfoList).Count() > 0 + || inDto.QuestionInfo.Where(x => x.LesionType == LesionType.OtherPreviousNewLesion).SelectMany(x => x.TableRowInfoList).Count() > 0 + || inDto.QuestionInfo.Where(x => x.LesionType == LesionType.TriggeringIRECSIT).SelectMany(x => x.TableRowInfoList).Count() > 0 + ) + ) + { + // 疗效为 iCPD + result = NewLesionAssessment.iCPD; + } + // else if (前一访视新病灶评估为iUPD && 新靶病灶上个访视评估为NE,本次访视评估为iUPD) + else if(data.LastTaskNewLesioniUPD && + lastTaskCalculateDto.QuestionInfo.Any(x => x.QuestionType == QuestionType.NewTargetLesion && x.Answer.EqEnum(NewLesionAssessment.NE)) + && inDto.QuestionInfo.Any(x => x.QuestionType == QuestionType.NewTargetLesion && x.Answer.EqEnum(NewTargetLesionAssessment.iUPD)) + ) + { + // 疗效为 iCPD + result = NewLesionAssessment.iCPD; + } + // else if (前一访视新病灶评估为iUPD && 新非靶病灶上个访视评估为NE,本次访视评估为iUPD) + else if(data.LastTaskNewLesioniUPD + && lastTaskCalculateDto.QuestionInfo.Any(x => x.QuestionType == QuestionType.NewNoTargetLesion && x.Answer.EqEnum(NewNoTargetLesionAssessment.NE)) + && inDto.QuestionInfo.Any(x => x.QuestionType == QuestionType.NewNoTargetLesion && x.Answer.EqEnum(NewNoTargetLesionAssessment.iUPD)) + ) + { + // 疗效为 iCPD + result = NewLesionAssessment.iCPD; + } + // else if (前一访视新病灶评估为iUPD && 其它既往新病灶上个访视评估为NE或疑似,本次访视评估为iUPD) + else if (data.LastTaskNewLesioniUPD + && lastTaskCalculateDto.QuestionInfo.Any(x => x.QuestionType == QuestionType.OtherNewTargetLesion && (x.Answer.EqEnum(OtherPreviousNewLesionAssessment.NE)|| x.Answer.EqEnum(OtherPreviousNewLesionAssessment.Equivocal))) + && inDto.QuestionInfo.Any(x => x.QuestionType == QuestionType.OtherNewTargetLesion && x.Answer.EqEnum(OtherPreviousNewLesionAssessment.iUPD)) + ) + { + // 疗效为 iCPD + result = NewLesionAssessment.iCPD; + } + // else if (前一访视新病灶评估为iUPD && 触发iRECIST后新病灶评估上个访视评估为NE或否或疑似,本次访视评估为是) + else if(data.LastTaskNewLesioniUPD + && lastTaskCalculateDto.QuestionInfo.Any(x => x.QuestionType == QuestionType.IRECISTNewTargetLesion && (x.Answer.EqEnum(NewLesionAfterTriggeringiRECSITAssessment.NE)|| x.Answer.EqEnum(NewLesionAfterTriggeringiRECSITAssessment.No) || x.Answer.EqEnum(NewLesionAfterTriggeringiRECSITAssessment.Equivocal))) + && inDto.QuestionInfo.Any(x => x.QuestionType == QuestionType.IRECISTNewTargetLesion && x.Answer.EqEnum(NewLesionAfterTriggeringiRECSITAssessment.Yes)) + ) + { + // 疗效为 iCPD + result = NewLesionAssessment.iCPD; + } + // else if (新靶病灶评估为iUPD || 新非靶病灶评估为iUPD || 其它既往新病灶评估为iUPD || 触发iRECIST后新病灶评估上个访视评估为是) + else if (inDto.QuestionInfo.Any(x => x.QuestionType == QuestionType.NewTargetLesion && x.Answer.EqEnum(NewTargetLesionAssessment.iUPD)) + || inDto.QuestionInfo.Any(x => x.QuestionType == QuestionType.NewNoTargetLesion && x.Answer.EqEnum(NewNoTargetLesionAssessment.iUPD)) + || inDto.QuestionInfo.Any(x => x.QuestionType == QuestionType.OtherNewTargetLesion && x.Answer.EqEnum(OtherPreviousNewLesionAssessment.iUPD)) + || lastTaskCalculateDto.QuestionInfo.Any(x => x.QuestionType == QuestionType.IRECISTNewTargetLesion && x.Answer.EqEnum(NewLesionAfterTriggeringiRECSITAssessment.Yes)) + ) + { + // 疗效为 iUPD + result = NewLesionAssessment.iUPD; + } + // else if (新靶病灶、新非靶病灶、其它既往新病灶任一项评估为NE) + else if (inDto.QuestionInfo.Any(x => x.QuestionType == QuestionType.NewTargetLesion && x.Answer.EqEnum(NewTargetLesionAssessment.NE)) + || inDto.QuestionInfo.Any(x => x.QuestionType == QuestionType.NewNoTargetLesion && x.Answer.EqEnum(NewNoTargetLesionAssessment.NE)) + || inDto.QuestionInfo.Any(x => x.QuestionType == QuestionType.OtherNewTargetLesion && x.Answer.EqEnum(OtherPreviousNewLesionAssessment.NE)) + ) + { + // 疗效为 NE + result = NewLesionAssessment.NE; + } + // else if (其它既往新病灶或触发iRECIST后新病灶评估为“疑似”) + else if ( + inDto.QuestionInfo.Any(x => x.QuestionType == QuestionType.OtherNewTargetLesion && x.Answer.EqEnum(OtherPreviousNewLesionAssessment.Equivocal)) + || inDto.QuestionInfo.Any(x => x.QuestionType == QuestionType.IRECISTNewTargetLesion && x.Answer.EqEnum(NewLesionAfterTriggeringiRECSITAssessment.Equivocal)) + ) + { + // 疗效为 疑似 + result = NewLesionAssessment.Suspected; + } + + + return result == null ? string.Empty : ((NewLesionAssessment)result).GetEnumInt(); + } + #endregion + + + #region iRECSIT整体肿瘤评估 + + /// + /// + /// + /// + /// if(上一访视评估为iUPD或iCPD&&靶病灶评估、非靶病灶评估或新病灶评估任一项为iCPD) + /// { + /// 疗效为 iCPD + /// } + /// else if (上一访视评估为iUPD或iCPD&&靶病灶评估、非靶病灶评估或新病灶评估任一项从前一访视非iUPD结果评估为当前访视iUPD) + /// { + /// 疗效为 iCPD + /// } + /// else if (靶病灶评估为iUPD || 非靶病灶评估为iUPD || 新病灶评估为iUPD) + /// { + /// 疗效为 iUPD + /// } + /// else if ((靶病灶评估为iCR || 非靶病灶评估为iCR) && 新病灶评估为ND) + /// { + /// 疗效为 iCR + /// } + /// else if (靶病灶评估为iPR && 非靶病灶评估为iCR,iNN,NE或ND && 新病灶评估为ND或疑似或NE) + /// { + /// 疗效为 iPR + /// } + /// else if (靶病灶评估为iPR && 非靶病灶评估为iNN或NE && 新病灶评估为否或疑似或NE) + /// { + /// 疗效为 iPR + /// } + /// else if (靶病灶评估为iPR && 非靶病灶评估为iCR或ND && 新病灶评估为疑似或NE) + /// { + /// 疗效为 iPR + /// } + /// else if (靶病灶评估为ND && 非靶病灶评估为iCR && 新病灶评估为疑似或NE) + /// { + /// 疗效为 iPR + /// } + /// else if (靶病灶评估为iSD && 非靶病灶评估为iCR,iNN,NE或ND && 新病灶评估为ND或疑似或NE) + /// { + /// 疗效为 iSD + /// } + /// else if (靶病灶评估为ND && 非靶病灶评估为iNN && 新病灶评估为ND或疑似或NE) + /// { + /// 疗效为 iNN + /// } + /// else if (靶病灶评估为ND && 非靶病灶评估为ND && 新病灶评估为ND或疑似) + /// { + /// 疗效为 ND + /// } + /// else if (靶病灶评估为NE && 非靶病灶评估为iCR,iNN,NE或ND && 新病灶评估为ND或疑似或NE) + /// { + /// 疗效为 NE + /// } + /// else if (靶病灶评估为ND && 非靶病灶评估为NE && 新病灶评估为否或疑似或NE) + /// { + /// 疗效为 NE + /// } + /// else if (靶病灶评估为ND && 非靶病灶评估为ND && 新病灶评估为NE) + /// { + /// 疗效为 NE + /// } + /// + /// + /// + public async Task GetIRECSITTargetLesionEvaluate(ReadingCalculateDto inDto) + { + + var lastVisitTaskId = await GetLastVisitTaskId(inDto); + ReadingCalculateDto lastTaskCalculateDto = await _generalCalculateService.GetReadingCalculateDto(lastVisitTaskId); + OverallAssessment? result = null; + IRECISTTargetLesionEvaluateDto data = new IRECISTTargetLesionEvaluateDto() + { + LastTaskLesioniUPDOriCPD = lastTaskCalculateDto.QuestionInfo.Any(x => x.QuestionType == QuestionType.Tumor && (x.Answer.EqEnum(OverallAssessment.iCPD) || x.Answer.EqEnum(OverallAssessment.iUPD))), + }; + + // if(上一访视评估为iUPD或iCPD&&靶病灶评估、非靶病灶评估或新病灶评估任一项为iCPD) + if (data.LastTaskLesioniUPDOriCPD + && (inDto.QuestionInfo.Any(x => x.QuestionType == QuestionType.TargetLesion && x.Answer.EqEnum(TargetAssessment.iCPD)) + || inDto.QuestionInfo.Any(x => x.QuestionType == QuestionType.NoTargetLesion && x.Answer.EqEnum(NoTargetAssessment.iCPD)) + || inDto.QuestionInfo.Any(x => x.QuestionType == QuestionType.NewTargetLesion && x.Answer.EqEnum(NewLesionAssessment.iCPD)))) + { + // 疗效为 iCPD + result = OverallAssessment.iCPD; + + } + // else if (上一访视评估为iUPD或iCPD&&靶病灶评估、非靶病灶评估或新病灶评估任一项从前一访视非iUPD结果评估为当前访视iUPD) + if (data.LastTaskLesioniUPDOriCPD + && (lastTaskCalculateDto.QuestionInfo.Any(x => x.QuestionType == QuestionType.TargetLesion && !x.Answer.EqEnum(TargetAssessment.iUPD)) + || lastTaskCalculateDto.QuestionInfo.Any(x => x.QuestionType == QuestionType.NoTargetLesion && !x.Answer.EqEnum(NoTargetAssessment.iUPD)) + || lastTaskCalculateDto.QuestionInfo.Any(x => x.QuestionType == QuestionType.NewTargetLesion && !x.Answer.EqEnum(NewTargetLesionAssessment.iUPD))) + && (inDto.QuestionInfo.Any(x => x.QuestionType == QuestionType.TargetLesion && x.Answer.EqEnum(TargetAssessment.iUPD)) + || inDto.QuestionInfo.Any(x => x.QuestionType == QuestionType.NoTargetLesion && x.Answer.EqEnum(NoTargetAssessment.iUPD)) + || inDto.QuestionInfo.Any(x => x.QuestionType == QuestionType.NewTargetLesion && x.Answer.EqEnum(NewLesionAssessment.iUPD))) + ) + { + // 疗效为 iCPD + result = OverallAssessment.iCPD; + } + // else if (靶病灶评估为iUPD || 非靶病灶评估为iUPD || 新病灶评估为iUPD) + else if (inDto.QuestionInfo.Any(x => x.QuestionType == QuestionType.TargetLesion && x.Answer.EqEnum(TargetAssessment.iUPD)) + || inDto.QuestionInfo.Any(x => x.QuestionType == QuestionType.NoTargetLesion && x.Answer.EqEnum(NoTargetAssessment.iUPD)) + || inDto.QuestionInfo.Any(x => x.QuestionType == QuestionType.NewTargetLesion && x.Answer.EqEnum(NewLesionAssessment.iUPD))) + { + // 疗效为 iUPD + result = OverallAssessment.iUPD; + } + // else if ((靶病灶评估为iCR || 非靶病灶评估为iCR) && 新病灶评估为ND) + else if ( + (inDto.QuestionInfo.Any(x => x.QuestionType == QuestionType.TargetLesion && x.Answer.EqEnum(TargetAssessment.iCR)) + || inDto.QuestionInfo.Any(x => x.QuestionType == QuestionType.NoTargetLesion && x.Answer.EqEnum(NoTargetAssessment.iCR))) + && inDto.QuestionInfo.Any(x => x.QuestionType == QuestionType.NewTargetLesion && x.Answer.EqEnum(NewLesionAssessment.ND)) + ) + { + // 疗效为 iCR + result = OverallAssessment.iCR; + } + // else if (靶病灶评估为iPR && 非靶病灶评估为iCR,iNN,NE或ND && 新病灶评估为ND或疑似或NE) + else if (inDto.QuestionInfo.Any(x => x.QuestionType == QuestionType.TargetLesion && x.Answer.EqEnum(TargetAssessment.iPR)) + && (inDto.QuestionInfo.Any(x => x.QuestionType == QuestionType.NoTargetLesion && x.Answer.EqEnum(NoTargetAssessment.iCR)) + || inDto.QuestionInfo.Any(x => x.QuestionType == QuestionType.NoTargetLesion && x.Answer.EqEnum(NoTargetAssessment.iNN)) + || inDto.QuestionInfo.Any(x => x.QuestionType == QuestionType.NoTargetLesion && x.Answer.EqEnum(NoTargetAssessment.NE)) + || inDto.QuestionInfo.Any(x => x.QuestionType == QuestionType.NoTargetLesion && x.Answer.EqEnum(NoTargetAssessment.ND)) + ) && (inDto.QuestionInfo.Any(x => x.QuestionType == QuestionType.NewTargetLesion && x.Answer.EqEnum(NewLesionAssessment.ND)) + || inDto.QuestionInfo.Any(x => x.QuestionType == QuestionType.NewTargetLesion && x.Answer.EqEnum(NewLesionAssessment.Suspected)) + || inDto.QuestionInfo.Any(x => x.QuestionType == QuestionType.NewTargetLesion && x.Answer.EqEnum(NewLesionAssessment.NE)) + )) + { + // 疗效为 iPR + result = OverallAssessment.iPR; + } + // else if (靶病灶评估为iPR && 非靶病灶评估为iNN或NE && 新病灶评估为否或疑似或NE) + else if (inDto.QuestionInfo.Any(x => x.QuestionType == QuestionType.TargetLesion && x.Answer.EqEnum(TargetAssessment.iPR)) + && (inDto.QuestionInfo.Any(x => x.QuestionType == QuestionType.NoTargetLesion && x.Answer.EqEnum(NoTargetAssessment.iNN)) + || inDto.QuestionInfo.Any(x => x.QuestionType == QuestionType.NoTargetLesion && x.Answer.EqEnum(NoTargetAssessment.NE)) + || inDto.QuestionInfo.Any(x => x.QuestionType == QuestionType.NoTargetLesion && x.Answer.EqEnum(NoTargetAssessment.ND)) + ) && (inDto.QuestionInfo.Any(x => x.QuestionType == QuestionType.NewTargetLesion && x.Answer.EqEnum(NewLesionAssessment.No)) + || inDto.QuestionInfo.Any(x => x.QuestionType == QuestionType.NewTargetLesion && x.Answer.EqEnum(NewLesionAssessment.Suspected)) + || inDto.QuestionInfo.Any(x => x.QuestionType == QuestionType.NewTargetLesion && x.Answer.EqEnum(NewLesionAssessment.NE)) + )) + { + // 疗效为 iPR + result = OverallAssessment.iPR; + } + // else if (靶病灶评估为iPR && 非靶病灶评估为iCR或ND && 新病灶评估为疑似或NE) + else if (inDto.QuestionInfo.Any(x => x.QuestionType == QuestionType.TargetLesion && x.Answer.EqEnum(TargetAssessment.iPR)) + && (inDto.QuestionInfo.Any(x => x.QuestionType == QuestionType.NoTargetLesion && x.Answer.EqEnum(NoTargetAssessment.iCR)) + || inDto.QuestionInfo.Any(x => x.QuestionType == QuestionType.NoTargetLesion && x.Answer.EqEnum(NoTargetAssessment.ND)) + ) && (inDto.QuestionInfo.Any(x => x.QuestionType == QuestionType.NewTargetLesion && x.Answer.EqEnum(NewLesionAssessment.Suspected)) + || inDto.QuestionInfo.Any(x => x.QuestionType == QuestionType.NewTargetLesion && x.Answer.EqEnum(NewLesionAssessment.NE)) + )) + { + // 疗效为 iPR + result = OverallAssessment.iPR; + } + // else if (靶病灶评估为ND && 非靶病灶评估为iCR && 新病灶评估为疑似或NE) + else if (inDto.QuestionInfo.Any(x => x.QuestionType == QuestionType.TargetLesion && x.Answer.EqEnum(TargetAssessment.ND)) + && (inDto.QuestionInfo.Any(x => x.QuestionType == QuestionType.NoTargetLesion && x.Answer.EqEnum(NoTargetAssessment.iCR)) + ) && (inDto.QuestionInfo.Any(x => x.QuestionType == QuestionType.NewTargetLesion && x.Answer.EqEnum(NewLesionAssessment.Suspected)) + || inDto.QuestionInfo.Any(x => x.QuestionType == QuestionType.NewTargetLesion && x.Answer.EqEnum(NewLesionAssessment.NE)) + )) + { + // 疗效为 iPR + result = OverallAssessment.iPR; + } + // else if (靶病灶评估为iSD && 非靶病灶评估为iCR,iNN,NE或ND && 新病灶评估为ND或疑似或NE) + else if (inDto.QuestionInfo.Any(x => x.QuestionType == QuestionType.TargetLesion && x.Answer.EqEnum(TargetAssessment.iSD)) + && (inDto.QuestionInfo.Any(x => x.QuestionType == QuestionType.NoTargetLesion && x.Answer.EqEnum(NoTargetAssessment.iCR)) + || inDto.QuestionInfo.Any(x => x.QuestionType == QuestionType.NoTargetLesion && x.Answer.EqEnum(NoTargetAssessment.iNN)) + || inDto.QuestionInfo.Any(x => x.QuestionType == QuestionType.NoTargetLesion && x.Answer.EqEnum(NoTargetAssessment.NE)) + || inDto.QuestionInfo.Any(x => x.QuestionType == QuestionType.NoTargetLesion && x.Answer.EqEnum(NoTargetAssessment.ND)) + ) && (inDto.QuestionInfo.Any(x => x.QuestionType == QuestionType.NewTargetLesion && x.Answer.EqEnum(NewLesionAssessment.Suspected)) + || inDto.QuestionInfo.Any(x => x.QuestionType == QuestionType.NewTargetLesion && x.Answer.EqEnum(NewLesionAssessment.NE)) + )) + { + // 疗效为 iSD + result = OverallAssessment.iSD; + } + // else if (靶病灶评估为ND && 非靶病灶评估为iNN && 新病灶评估为ND或疑似或NE) + else if (inDto.QuestionInfo.Any(x => x.QuestionType == QuestionType.TargetLesion && x.Answer.EqEnum(TargetAssessment.ND)) + && inDto.QuestionInfo.Any(x => x.QuestionType == QuestionType.NoTargetLesion && x.Answer.EqEnum(NoTargetAssessment.iNN)) + && (inDto.QuestionInfo.Any(x => x.QuestionType == QuestionType.NewTargetLesion && x.Answer.EqEnum(NewLesionAssessment.ND)) + || inDto.QuestionInfo.Any(x => x.QuestionType == QuestionType.NewTargetLesion && x.Answer.EqEnum(NewLesionAssessment.Suspected)) + || inDto.QuestionInfo.Any(x => x.QuestionType == QuestionType.NewTargetLesion && x.Answer.EqEnum(NewLesionAssessment.NE)) + )) + { + // 疗效为 iNN + result = OverallAssessment.iNN; + } + // else if (靶病灶评估为ND && 非靶病灶评估为ND && 新病灶评估为ND或疑似) + else if (inDto.QuestionInfo.Any(x => x.QuestionType == QuestionType.TargetLesion && x.Answer.EqEnum(TargetAssessment.ND)) + && inDto.QuestionInfo.Any(x => x.QuestionType == QuestionType.NoTargetLesion && x.Answer.EqEnum(NoTargetAssessment.ND)) + && (inDto.QuestionInfo.Any(x => x.QuestionType == QuestionType.NewTargetLesion && x.Answer.EqEnum(NewLesionAssessment.ND)) + || inDto.QuestionInfo.Any(x => x.QuestionType == QuestionType.NewTargetLesion && x.Answer.EqEnum(NewLesionAssessment.Suspected)) + )) + { + // 疗效为 ND + result = OverallAssessment.ND; + } + // else if (靶病灶评估为NE && 非靶病灶评估为iCR,iNN,NE或ND && 新病灶评估为ND或疑似或NE) + else if (inDto.QuestionInfo.Any(x => x.QuestionType == QuestionType.TargetLesion && x.Answer.EqEnum(TargetAssessment.NE)) + && (inDto.QuestionInfo.Any(x => x.QuestionType == QuestionType.NoTargetLesion && x.Answer.EqEnum(NoTargetAssessment.iCR)) + || inDto.QuestionInfo.Any(x => x.QuestionType == QuestionType.NoTargetLesion && x.Answer.EqEnum(NoTargetAssessment.iNN)) + || inDto.QuestionInfo.Any(x => x.QuestionType == QuestionType.NoTargetLesion && x.Answer.EqEnum(NoTargetAssessment.NE)) + || inDto.QuestionInfo.Any(x => x.QuestionType == QuestionType.NoTargetLesion && x.Answer.EqEnum(NoTargetAssessment.ND)) + ) && (inDto.QuestionInfo.Any(x => x.QuestionType == QuestionType.NewTargetLesion && x.Answer.EqEnum(NewLesionAssessment.ND)) + || inDto.QuestionInfo.Any(x => x.QuestionType == QuestionType.NewTargetLesion && x.Answer.EqEnum(NewLesionAssessment.Suspected)) + || inDto.QuestionInfo.Any(x => x.QuestionType == QuestionType.NewTargetLesion && x.Answer.EqEnum(NewLesionAssessment.NE)) + )) + { + // 疗效为 NE + result = OverallAssessment.NE; + } + // else if (靶病灶评估为ND && 非靶病灶评估为NE && 新病灶评估为否或疑似或NE) + else if (inDto.QuestionInfo.Any(x => x.QuestionType == QuestionType.TargetLesion && x.Answer.EqEnum(TargetAssessment.ND)) + && (inDto.QuestionInfo.Any(x => x.QuestionType == QuestionType.NoTargetLesion && x.Answer.EqEnum(NoTargetAssessment.NE)) + + ) && (inDto.QuestionInfo.Any(x => x.QuestionType == QuestionType.NewTargetLesion && x.Answer.EqEnum(NewLesionAssessment.No)) + || inDto.QuestionInfo.Any(x => x.QuestionType == QuestionType.NewTargetLesion && x.Answer.EqEnum(NewLesionAssessment.Suspected)) + || inDto.QuestionInfo.Any(x => x.QuestionType == QuestionType.NewTargetLesion && x.Answer.EqEnum(NewLesionAssessment.NE)) + )) + { + // 疗效为 NE + result = OverallAssessment.NE; + } + // else if (靶病灶评估为ND && 非靶病灶评估为ND && 新病灶评估为NE) + else if (inDto.QuestionInfo.Any(x => x.QuestionType == QuestionType.TargetLesion && x.Answer.EqEnum(TargetAssessment.ND)) + && inDto.QuestionInfo.Any(x => x.QuestionType == QuestionType.NoTargetLesion && x.Answer.EqEnum(NoTargetAssessment.ND)) + && inDto.QuestionInfo.Any(x => x.QuestionType == QuestionType.NewTargetLesion && x.Answer.EqEnum(NewLesionAssessment.NE)) + + ) + { + // 疗效为 NE + result = OverallAssessment.NE; + } + + return result == null ? string.Empty : ((OverallAssessment)result).GetEnumInt(); + } + #endregion #endregion @@ -2554,54 +2980,54 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate #endregion - #region 获取新病灶评估 - /// - /// 获取新病灶评估 - /// - /// - /// - public async Task GetNewLesionEvaluate(ReadingCalculateDto inDto) - { + //#region 获取新病灶评估 + ///// + ///// 获取新病灶评估 + ///// + ///// + ///// + //public async Task GetNewLesionEvaluate(ReadingCalculateDto inDto) + //{ - NewLesionAssessment result = NewLesionAssessment.No; - if (inDto.IsBaseLine) - { - return NewLesionAssessment.NA.GetEnumInt(); - } + // NewLesionAssessment result = NewLesionAssessment.No; + // if (inDto.IsBaseLine) + // { + // return NewLesionAssessment.NA.GetEnumInt(); + // } - var tableRows = inDto.QuestionInfo.Where(x => x.LesionType == LesionType.NewLesions).SelectMany(x => x.TableRowInfoList).ToList(); + // var tableRows = inDto.QuestionInfo.Where(x => x.LesionType == LesionType.NewLesions).SelectMany(x => x.TableRowInfoList).ToList(); - var tableQuestions = tableRows.SelectMany(x => x.TableQuestionList).ToList(); + // var tableQuestions = tableRows.SelectMany(x => x.TableQuestionList).ToList(); - // 当前访视存在至少一个明确新病灶 - if (tableQuestions.Any(x => x.QuestionMark == QuestionMark.State && x.Answer.EqEnum(NewLesionState.Exist))) - { - result = NewLesionAssessment.Yes; - } - //只要有任何一个新病灶状态为“无法评估” - else if (tableQuestions.Any(x => x.QuestionMark == QuestionMark.State && x.Answer.EqEnum(NewLesionState.UnableEvaluate))) - { - result = NewLesionAssessment.NE; - } - //当前访视不存在明确新病灶且存在至少一个疑似新病灶 - else if (!tableQuestions.Any(x => x.QuestionMark == QuestionMark.State && x.Answer.EqEnum(NewLesionState.Exist)) && - tableQuestions.Any(x => x.QuestionMark == QuestionMark.State && x.Answer.EqEnum(NewLesionState.Suspected)) - ) - { - result = NewLesionAssessment.Suspected; - } + // // 当前访视存在至少一个明确新病灶 + // if (tableQuestions.Any(x => x.QuestionMark == QuestionMark.State && x.Answer.EqEnum(NewLesionState.Exist))) + // { + // result = NewLesionAssessment.Yes; + // } + // //只要有任何一个新病灶状态为“无法评估” + // else if (tableQuestions.Any(x => x.QuestionMark == QuestionMark.State && x.Answer.EqEnum(NewLesionState.UnableEvaluate))) + // { + // result = NewLesionAssessment.NE; + // } + // //当前访视不存在明确新病灶且存在至少一个疑似新病灶 + // else if (!tableQuestions.Any(x => x.QuestionMark == QuestionMark.State && x.Answer.EqEnum(NewLesionState.Exist)) && + // tableQuestions.Any(x => x.QuestionMark == QuestionMark.State && x.Answer.EqEnum(NewLesionState.Suspected)) + // ) + // { + // result = NewLesionAssessment.Suspected; + // } - else - { - result = NewLesionAssessment.No; - } - return result.GetEnumInt(); + // else + // { + // result = NewLesionAssessment.No; + // } + // return result.GetEnumInt(); - } - #endregion + //} + //#endregion #endregion diff --git a/IRaCIS.Core.Domain.Share/Reading/ReadEnum.cs b/IRaCIS.Core.Domain.Share/Reading/ReadEnum.cs index ff826d146..b965884af 100644 --- a/IRaCIS.Core.Domain.Share/Reading/ReadEnum.cs +++ b/IRaCIS.Core.Domain.Share/Reading/ReadEnum.cs @@ -538,6 +538,8 @@ namespace IRaCIS.Core.Domain.Share NE = 4 } + + /// /// 整体肿瘤评估 /// @@ -660,7 +662,21 @@ namespace IRaCIS.Core.Domain.Share /// No = 3, - + /// + /// iUPD + /// + iUPD = 4, + + /// + /// iCPD + /// + iCPD = 5, + + /// + /// ND + /// + ND = 6 + } /// diff --git a/IRaCIS.Core.Infra.EFCore/Common/ReadingCommon.cs b/IRaCIS.Core.Infra.EFCore/Common/ReadingCommon.cs index 1ea97ae51..47fa3c60d 100644 --- a/IRaCIS.Core.Infra.EFCore/Common/ReadingCommon.cs +++ b/IRaCIS.Core.Infra.EFCore/Common/ReadingCommon.cs @@ -164,7 +164,6 @@ namespace IRaCIS.Core.Infra.EFCore.Common return ((int)(object)value).ToString(); } - /// /// 字符匹配枚举 ///