代码修改
parent
96fc5ae78c
commit
972fc32eeb
|
@ -92,7 +92,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
|||
}
|
||||
return new
|
||||
{
|
||||
BaseLinePET5PS= baseLinePET5PS,
|
||||
BaseLinePET5PS = baseLinePET5PS,
|
||||
|
||||
};
|
||||
}
|
||||
|
@ -169,7 +169,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
|||
var answers = await _readingTaskQuestionAnswerRepository.Where(x => visitTaskIds.Contains(x.VisitTaskId)).ToListAsync();
|
||||
var tableAnswers = await _readingTableQuestionAnswerRepository.Where(x => visitTaskIds.Contains(x.VisitTaskId)).ToListAsync();
|
||||
|
||||
var globalanswerList = await _readingGlobalTaskInfoRepository.Where(x => visitTaskIds.Contains(x.TaskId)&&x.GlobalVisitTask.TaskState== TaskState.Effect&&x.Answer!=string.Empty).Select(x => new
|
||||
var globalanswerList = await _readingGlobalTaskInfoRepository.Where(x => visitTaskIds.Contains(x.TaskId) && x.GlobalVisitTask.TaskState == TaskState.Effect && x.Answer != string.Empty).Select(x => new
|
||||
{
|
||||
x.TaskId,
|
||||
x.GlobalVisitTask.VisitTaskNum,
|
||||
|
@ -411,7 +411,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
|||
|
||||
var maxSuv = await GetSuvMax(readingData);
|
||||
var rowInfo = readingData.QuestionInfo.SelectMany(x => x.TableRowInfoList).ToList();
|
||||
var tableQuestions = rowInfo.SelectMany(x => x.TableQuestionList).Where(x=>x.RowId==inDto.RowId).ToList();
|
||||
var tableQuestions = rowInfo.SelectMany(x => x.TableQuestionList).Where(x => x.RowId == inDto.RowId).ToList();
|
||||
|
||||
var lesionMaxSuv = tableQuestions.Where(x => x.QuestionMark == QuestionMark.SUVmax).Select(x => x.Answer.IsNullOrEmptyReturn0()).MaxOrDefault();
|
||||
|
||||
|
@ -729,7 +729,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
|||
}
|
||||
|
||||
|
||||
calculateList = calculateList.Where(x =>x.ComputationTriggerList.Contains(inDto.ComputationTrigger)).ToList();
|
||||
calculateList = calculateList.Where(x => x.ComputationTriggerList.Contains(inDto.ComputationTrigger)).ToList();
|
||||
var typeNAList = new List<QuestionType>
|
||||
{
|
||||
QuestionType.SODChange,
|
||||
|
@ -916,7 +916,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
|||
|
||||
|
||||
var unableEvaluateRowIds = await _readingTableQuestionAnswerRepository.Where(x => x.VisitTaskId == inDto.VisitTaskId &&
|
||||
(x.Answer == TargetState.UnableEvaluate.GetEnumInt()|| x.Answer == TargetState.Loss.GetEnumInt())
|
||||
(x.Answer == TargetState.UnableEvaluate.GetEnumInt() || x.Answer == TargetState.Loss.GetEnumInt())
|
||||
&& x.ReadingTableQuestionTrial.QuestionMark == QuestionMark.State
|
||||
)
|
||||
.Select(x => x.RowId).Distinct().ToListAsync();
|
||||
|
@ -1108,7 +1108,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
|||
|
||||
// 找到靶病灶问题
|
||||
var targetQuestion = await _readingQuestionTrialRepository.Where(x => x.ReadingQuestionCriterionTrialId == taskInfo.TrialReadingCriterionId && x.LesionType == LesionType.TargetLesion).FirstOrDefaultAsync();
|
||||
if(targetQuestion!=null)
|
||||
if (targetQuestion != null)
|
||||
{
|
||||
// 找到状态问题
|
||||
var stateQuestion = await _readingTableQuestionTrialRepository.Where(x => x.ReadingQuestionId == targetQuestion.Id && x.QuestionMark == QuestionMark.State).FirstOrDefaultAsync();
|
||||
|
@ -1116,14 +1116,14 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
|||
{
|
||||
|
||||
// 找到主病灶的状态
|
||||
var state =await _readingTableQuestionAnswerRepository.Where(x=>x.VisitTaskId==inDto.VisitTaskId&&x.RowIndex== (int)Math.Floor(inDto.RowNumber)&&x.TableQuestionId== stateQuestion.Id).Select(x=>x.Answer).FirstOrDefaultAsync();
|
||||
var state = await _readingTableQuestionAnswerRepository.Where(x => x.VisitTaskId == inDto.VisitTaskId && x.RowIndex == (int)Math.Floor(inDto.RowNumber) && x.TableQuestionId == stateQuestion.Id).Select(x => x.Answer).FirstOrDefaultAsync();
|
||||
|
||||
// 长径
|
||||
var majorAxis = (await _readingTableQuestionAnswerRepository.Where(x =>
|
||||
x.VisitTaskId == inDto.VisitTaskId &&
|
||||
x.RowIndex >= (int)Math.Floor(inDto.RowNumber) && x.RowIndex < ((int)Math.Floor(inDto.RowNumber) + 1) &&
|
||||
x.ReadingTableQuestionTrial.QuestionMark == QuestionMark.MajorAxis &&
|
||||
x.QuestionId== targetQuestion.Id
|
||||
x.QuestionId == targetQuestion.Id
|
||||
).Select(x => x.Answer).ToListAsync()).Select(x => x.IsNullOrEmptyReturn0()).Sum();
|
||||
|
||||
// 短径
|
||||
|
@ -1137,9 +1137,9 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
|||
// 找到ppd问题
|
||||
var ppdQuestion = await _readingTableQuestionTrialRepository.Where(x => x.ReadingQuestionId == targetQuestion.Id && x.QuestionMark == QuestionMark.PPD).FirstOrDefaultAsync();
|
||||
|
||||
if(ppdQuestion!=null)
|
||||
if (ppdQuestion != null)
|
||||
{
|
||||
var ppdAnswerList= await _readingTableQuestionAnswerRepository.Where(x =>
|
||||
var ppdAnswerList = await _readingTableQuestionAnswerRepository.Where(x =>
|
||||
x.VisitTaskId == inDto.VisitTaskId &&
|
||||
x.ReadingTableQuestionTrial.QuestionMark == QuestionMark.PPD &&
|
||||
x.QuestionId == targetQuestion.Id &&
|
||||
|
@ -1178,7 +1178,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
|||
//相比最低点PPD增加百分比 ≥50%
|
||||
// (相比PPD最低点LDi增加值 ≥10 mm
|
||||
// 或者相比PPD最低点SDi增加值Sdi ≥10 mm)
|
||||
if ( majorAxis > 20 &&
|
||||
if (majorAxis > 20 &&
|
||||
(allPPd - lowPPDInfo.NadirPPD) * 100 / lowPPDInfo.NadirPPD >= 50 &&
|
||||
(majorAxis - lowPPDInfo.LowPPDLDi >= 10 ||
|
||||
shortAxis - lowPPDInfo.LowPPDSDi >= 10)
|
||||
|
@ -1266,7 +1266,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
|||
{
|
||||
RowId = answerList.Where(x => x.RowIndex == i).Select(x => x.RowId).FirstOrDefault(),
|
||||
RowIndex = answerList.Where(x => x.RowIndex == i).Select(x => x.RowIndex).FirstOrDefault().ToString(),
|
||||
AllPPD = answerList.Where(x=>x.QuestionMark== QuestionMark.PPD).Where(x => x.RowIndex > i && x.RowIndex < (i + 1)).Sum(x => x.Answer),
|
||||
AllPPD = answerList.Where(x => x.QuestionMark == QuestionMark.PPD).Where(x => x.RowIndex > i && x.RowIndex < (i + 1)).Sum(x => x.Answer),
|
||||
AllLDi = answerList.Where(x => x.QuestionMark == QuestionMark.MajorAxis).Where(x => x.RowIndex > i && x.RowIndex < (i + 1)).Sum(x => x.Answer),
|
||||
AllSDi = answerList.Where(x => x.QuestionMark == QuestionMark.ShortAxis).Where(x => x.RowIndex > i && x.RowIndex < (i + 1)).Sum(x => x.Answer),
|
||||
});
|
||||
|
@ -1324,7 +1324,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
|||
TrialId = x.TrialId
|
||||
}).ToListAsync();
|
||||
|
||||
var tableRowAnswers = await _readingTableAnswerRowInfoRepository.Where(x => x.VisitTaskId == LastVisitTaskId).OrderBy(x=>x.RowIndex).ProjectTo<CopyTableAnswerRowInfo>(_mapper.ConfigurationProvider).ToListAsync();
|
||||
var tableRowAnswers = await _readingTableAnswerRowInfoRepository.Where(x => x.VisitTaskId == LastVisitTaskId).OrderBy(x => x.RowIndex).ProjectTo<CopyTableAnswerRowInfo>(_mapper.ConfigurationProvider).ToListAsync();
|
||||
|
||||
|
||||
tableRowAnswers.ForEach(x =>
|
||||
|
@ -1381,15 +1381,15 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
|||
|
||||
var rowIndexList = copyTableAnswers.Select(x => x.RowIndex).Distinct().ToList();
|
||||
// 找到靶病灶问题Id
|
||||
var questionId=await _readingQuestionTrialRepository.Where(x => x.ReadingQuestionCriterionTrialId == taskinfo.TrialReadingCriterionId && x.LesionType == LesionType.TargetLesion).Select(x => x.Id).FirstNotNullAsync();
|
||||
var questionId = await _readingQuestionTrialRepository.Where(x => x.ReadingQuestionCriterionTrialId == taskinfo.TrialReadingCriterionId && x.LesionType == LesionType.TargetLesion).Select(x => x.Id).FirstNotNullAsync();
|
||||
|
||||
foreach (var item in rowIndexList)
|
||||
{
|
||||
var lowPPD =await this.GetLowPPDInfo(new GetPPDInfoInDto() {
|
||||
var lowPPD = await this.GetLowPPDInfo(new GetPPDInfoInDto() {
|
||||
|
||||
VisitTaskId= visitTaskId,
|
||||
QuestionId= questionId,
|
||||
RowIndex=item
|
||||
VisitTaskId = visitTaskId,
|
||||
QuestionId = questionId,
|
||||
RowIndex = item
|
||||
});
|
||||
|
||||
copyTableAnswers.Where(x => x.RowIndex == item).ForEach(x =>
|
||||
|
@ -1399,7 +1399,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
|||
switch (x.QuestionMark)
|
||||
{
|
||||
case QuestionMark.LowPPDLDi:
|
||||
x.Answer = lowPPD.LowPPDLDi==null?string.Empty: lowPPD.LowPPDLDi.Value.ToString();
|
||||
x.Answer = lowPPD.LowPPDLDi == null ? string.Empty : lowPPD.LowPPDLDi.Value.ToString();
|
||||
break;
|
||||
case QuestionMark.LowPPDSDi:
|
||||
x.Answer = lowPPD.LowPPDSDi == null ? string.Empty : lowPPD.LowPPDSDi.Value.ToString();
|
||||
|
@ -1445,11 +1445,11 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
|||
|
||||
var questionMarkList = await _readingTaskQuestionMarkRepository.Where(x => x.VisitTaskId == LastVisitTaskId).Select(x => new ReadingTaskQuestionMark()
|
||||
{
|
||||
VisitTaskId= visitTaskId,
|
||||
FirstAddTaskId=x.FirstAddTaskId,
|
||||
QuestionId=x.QuestionId,
|
||||
QuestionType=x.QuestionType,
|
||||
OrderMarkName=x.OrderMarkName,
|
||||
VisitTaskId = visitTaskId,
|
||||
FirstAddTaskId = x.FirstAddTaskId,
|
||||
QuestionId = x.QuestionId,
|
||||
QuestionType = x.QuestionType,
|
||||
OrderMarkName = x.OrderMarkName,
|
||||
|
||||
}).ToListAsync();
|
||||
questionMarkList.ForEach(x => {
|
||||
|
@ -2108,7 +2108,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
|||
// 脾底答案
|
||||
var splenicBottomAnswer = inDto.QuestionInfo.Where(x => x.QuestionType == QuestionType.SplenicBottomPosition).Select(x => x.Answer).FirstOrDefault();
|
||||
|
||||
decimal? spleenLength=null;
|
||||
decimal? spleenLength = null;
|
||||
if (splenicTopAnswer != null && splenicBottomAnswer != null)
|
||||
{
|
||||
spleenLength = splenicTopAnswer.IsNullOrEmptyReturn0() - splenicBottomAnswer.IsNullOrEmptyReturn0();
|
||||
|
@ -2142,7 +2142,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
|||
var presentSpd = inDto.QuestionInfo.Where(x => x.QuestionType == QuestionType.SPD).Select(x => x.Answer).FirstOrDefault().IsNullOrEmptyReturn0();
|
||||
if (baseLineSpd != 0)
|
||||
{
|
||||
return ReserveDecimal((presentSpd - baseLineSpd)*100 / baseLineSpd,inDto.DigitPlaces);
|
||||
return ReserveDecimal((presentSpd - baseLineSpd) * 100 / baseLineSpd, inDto.DigitPlaces);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -2169,9 +2169,9 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
|||
var baseLineSpleenLength = await GetBaseLineSpleenLength(inDto);
|
||||
|
||||
var presentSpleenLength = inDto.QuestionInfo.Where(x => x.QuestionType == QuestionType.SpleenLength).Select(x => x.Answer).FirstOrDefault().IsNullOrEmptyReturn0();
|
||||
if (baseLineSpleenLength - 130 > 0&& presentSpleenLength>130)
|
||||
if (baseLineSpleenLength - 130 > 0 && presentSpleenLength > 130)
|
||||
{
|
||||
return ReserveDecimal((presentSpleenLength - 130 - (baseLineSpleenLength - 130))*100 / (baseLineSpleenLength - 130), inDto.DigitPlaces);
|
||||
return ReserveDecimal((presentSpleenLength - 130 - (baseLineSpleenLength - 130)) * 100 / (baseLineSpleenLength - 130), inDto.DigitPlaces);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -2242,7 +2242,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
|||
/// <param name="spleenLength"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<string> GetSplenicState(Guid visitTaskId,decimal spleenLength)
|
||||
public async Task<string> GetSplenicState(Guid visitTaskId, decimal spleenLength)
|
||||
{
|
||||
|
||||
var taskinfo = await _visitTaskRepository.Where(x => x.Id == visitTaskId).FirstNotNullAsync();
|
||||
|
@ -2297,7 +2297,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
|||
//2、与基线相比脾垂直径变化值≥10 mm
|
||||
// 当前垂直径>130 mm
|
||||
//与基线相比脾肿大增加的百分比 > 50%
|
||||
if (baseLineSpleenLength > 130 && differenceValue >= 10 && spleenLength>130 && getPercentage() > 50)
|
||||
if (baseLineSpleenLength > 130 && differenceValue >= 10 && spleenLength > 130 && getPercentage() > 50)
|
||||
{
|
||||
result = SpleenAssessment.Increase;
|
||||
}
|
||||
|
@ -2388,7 +2388,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
|||
var baseLineTaskId = await GetBaseLineTaskId(inDto);
|
||||
|
||||
// 最低垂直经
|
||||
var lowSpleenLength= await this.GetLowSpleenLength(taskinfo);
|
||||
var lowSpleenLength = await this.GetLowSpleenLength(taskinfo);
|
||||
|
||||
// 基线状态
|
||||
var baseLineState = await _readingTaskQuestionAnswerRepository.Where(x => x.VisitTaskId == baseLineTaskId && x.ReadingQuestionTrial.QuestionType == QuestionType.SplenicStatus).Select(x => x.Answer).FirstOrDefaultAsync();
|
||||
|
@ -2413,7 +2413,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
|||
/// <returns></returns>
|
||||
public async Task<string> GetSplenicStatus(ReadingCalculateDto inDto)
|
||||
{
|
||||
var spleenLength= inDto.QuestionInfo.Where(x => x.QuestionType == QuestionType.SpleenLength).Select(x => x.Answer).FirstOrDefault();
|
||||
var spleenLength = inDto.QuestionInfo.Where(x => x.QuestionType == QuestionType.SpleenLength).Select(x => x.Answer).FirstOrDefault();
|
||||
if (spleenLength == string.Empty)
|
||||
{
|
||||
return string.Empty;
|
||||
|
@ -2588,7 +2588,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
|||
}
|
||||
|
||||
// 本访视病灶的 max SUVmax(所有病灶中最大的)> 2 * 肝脏血池SUVmax
|
||||
else if (maxSUVmax >2* LiverSUVmax&& LiverSUVmax != 0m)
|
||||
else if (maxSUVmax > 2 * LiverSUVmax && LiverSUVmax != 0m)
|
||||
{
|
||||
result = PET5PSScore.Five;
|
||||
}
|
||||
|
@ -2598,7 +2598,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
|||
result = PET5PSScore.Four;
|
||||
}
|
||||
//纵隔血池SUVmax<本访视点病灶的max SUVmax(所有病灶中最大的)≤1*肝脏血池SUVmax
|
||||
else if (MediastinumSUVmax < maxSUVmax&& maxSUVmax <= LiverSUVmax&& MediastinumSUVmax != 0)
|
||||
else if (MediastinumSUVmax < maxSUVmax && maxSUVmax <= LiverSUVmax && MediastinumSUVmax != 0)
|
||||
{
|
||||
result = PET5PSScore.Three;
|
||||
}
|
||||
|
@ -2692,7 +2692,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
|||
}
|
||||
|
||||
|
||||
if (inDto.IsBaseLine)
|
||||
if (inDto.IsBaseLine || (await ImageQualityIsUnableFuse(inDto)))
|
||||
{
|
||||
return SUVChangeVSBaseline.NA.GetEnumInt();
|
||||
}
|
||||
|
@ -2758,8 +2758,8 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
|||
var lastTaskId = await GetLastVisitTaskId(inDto);
|
||||
|
||||
|
||||
var answer =await _readingTaskQuestionAnswerRepository.Where(x => x.VisitTaskId == lastTaskId).Include(x => x.ReadingQuestionTrial).Where(x => x.ReadingQuestionTrial.QuestionType == QuestionType.FDGPET).Select(x => x.Answer).FirstOrDefaultAsync();
|
||||
return answer?? string.Empty;
|
||||
var answer = await _readingTaskQuestionAnswerRepository.Where(x => x.VisitTaskId == lastTaskId).Include(x => x.ReadingQuestionTrial).Where(x => x.ReadingQuestionTrial.QuestionType == QuestionType.FDGPET).Select(x => x.Answer).FirstOrDefaultAsync();
|
||||
return answer ?? string.Empty;
|
||||
}
|
||||
|
||||
#region FDG-PET总体评估结果
|
||||
|
@ -2797,7 +2797,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
|||
|
||||
|
||||
|
||||
if (notExistPET)
|
||||
if (notExistPET || (await ImageQualityIsUnableFuse(inDto)))
|
||||
{
|
||||
return FDGPETOverallAssessment.NE.GetEnumInt();
|
||||
}
|
||||
|
@ -2825,7 +2825,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
|||
/// <param name="uptakeChange"> 与基线相比摄取值变化</param>
|
||||
/// <param name="evidenceFocalFDG">骨髓中是否存在局灶性 FDG亲和病灶的证据</param>
|
||||
/// <returns></returns>
|
||||
public string CalculationFDGPETOverallAssessment(string? pET5PS, string uptakeChange,string? evidenceFocalFDG)
|
||||
public string CalculationFDGPETOverallAssessment(string? pET5PS, string uptakeChange, string? evidenceFocalFDG)
|
||||
{
|
||||
List<CalculationDto> data = new List<CalculationDto>() {
|
||||
|
||||
|
@ -2906,7 +2906,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
|||
/// <returns></returns>
|
||||
public async Task<string> GetEvidenceFocalFDG(ReadingCalculateDto inDto)
|
||||
{
|
||||
if (inDto.QuestionInfo.Any(x => x.QuestionType == QuestionType.ExistPET && x.Answer == ReadingYesOrNo.No.GetEnumInt()))
|
||||
if (inDto.QuestionInfo.Any(x => x.QuestionType == QuestionType.ExistPET && x.Answer == ReadingYesOrNo.No.GetEnumInt()) || (await ImageQualityIsUnableFuse(inDto)))
|
||||
{
|
||||
return FDGAffinityFociInBM.NE.GetEnumInt();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue