代码修改
parent
9d876b44cf
commit
87992a36e1
|
@ -452,50 +452,50 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
|||
|
||||
List<ReadingCalculateData> calculateList = new List<ReadingCalculateData>()
|
||||
{
|
||||
//靶病灶径线之和(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
|
|||
/// 获取靶病灶评估
|
||||
/// </summary>
|
||||
/// <param name="inDto"></param>
|
||||
/// <remarks>
|
||||
/// 靶病灶疗效评估算法-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
|
||||
///
|
||||
/// }
|
||||
///}
|
||||
///}
|
||||
/// </remarks>
|
||||
/// <returns></returns>
|
||||
public async Task<string> 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<decimal>(),
|
||||
|
||||
//淋巴结非靶病灶状态全部为消失
|
||||
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();
|
||||
}
|
||||
|
|
|
@ -1088,7 +1088,12 @@ namespace IRaCIS.Core.Domain.Share
|
|||
/// <summary>
|
||||
/// 消失
|
||||
/// </summary>
|
||||
Loss = 3
|
||||
Loss = 3,
|
||||
|
||||
/// <summary>
|
||||
/// 疾病进展
|
||||
/// </summary>
|
||||
DiseaseProgression = 4
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
Loading…
Reference in New Issue