代码提交

IRC_NewDev
he 2023-09-05 13:34:34 +08:00
parent 8924b2ca7a
commit 35f5a362e3
2 changed files with 139 additions and 43 deletions

View File

@ -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
/// <summary>
/// 获取SPD
/// </summary>
/// <param name="inDto"></param>
/// <returns></returns>
public async Task<decimal> 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 获取靶病灶评估
/// <summary>
/// 获取靶病灶评估
@ -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<string> 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();

View File

@ -944,6 +944,11 @@ namespace IRaCIS.Core.Domain.Share
iUPD = 7,
iCPD = 8,
/// <summary>
/// PR/SD
/// </summary>
PRSD = 9,
}
/// <summary>
@ -1760,7 +1765,65 @@ namespace IRaCIS.Core.Domain.Share
/// </summary>
NewLesionEvaluation = 30,
/// <summary>
/// 垂直径乘积之和SPD
/// </summary>
SPD = 31,
/// <summary>
/// 与基线相比SPD变化的百分比
/// </summary>
SPDChange = 32,
/// <summary>
/// 与基线相比脾肿大增加的百分比
/// </summary>
SplenoncusChange = 33,
/// <summary>
/// 与最低点相比脾脏垂直径长度的增加值
/// </summary>
SplenoncusAdd = 34,
/// <summary>
/// 与基线相比脾垂直径变化值
/// </summary>
SplenoncusDiameterChange = 35,
/// <summary>
/// 脾肿垂直径最低点访视
/// </summary>
LowestSplenoncusVisit = 36,
/// <summary>
/// 肝脏评估
/// </summary>
LiverAssessment = 37,
/// <summary>
/// 脾脏评估
/// </summary>
SplenicEvaluation = 38,
/// <summary>
/// CT/MRI总体评估
/// </summary>
CTandMRI = 39,
/// <summary>
/// 前次FDG-PET总体评估
/// </summary>
LastFDGPET = 40,
/// <summary>
/// FDG-PET总体评估
/// </summary>
FDGPET = 41,
/// <summary>
/// 影像学整体肿瘤评估
/// </summary>
ImgOncology = 42,
/// <summary>
/// 是否脑转移