修改警告

This commit is contained in:
he
2023-12-05 11:03:00 +08:00
parent a8e0c1691d
commit 8cc9cb8caf
15 changed files with 125 additions and 113 deletions
@@ -471,7 +471,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
/// <param name="inDto"></param>
/// <param name="calculateType"></param>
/// <returns></returns>
public async Task ReadingCalculate(ReadingCalculateDto inDto,List<QuestionType> calculateType=null)
public async Task ReadingCalculate(ReadingCalculateDto inDto,List<QuestionType>? calculateType=null)
{
#region
@@ -688,7 +688,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
else
{
item.Answer = value.ToString();
item.Answer = value==null?"": value.Value.ToString();
}
}
else if (calculate.GetStringFun != null)
@@ -704,7 +704,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
ValueOfType.Percentage
};
if (inDto.DigitPlaces != null && inDto.DigitPlaces != -1)
if (inDto.DigitPlaces != -1)
{
try
{
@@ -2751,55 +2751,55 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
// 逻辑改了 现在转变后全部都是NA;
return NewLesionAssessment.NA.GetEnumInt();
NewLesionAssessment result = NewLesionAssessment.No;
if (inDto.IsBaseLine)
{
return NewLesionAssessment.NA.GetEnumInt();
}
//NewLesionAssessment result = NewLesionAssessment.No;
//if (inDto.IsBaseLine)
//{
// return NewLesionAssessment.NA.GetEnumInt();
//}
var newTargetQuestions = inDto.QuestionInfo.Where(x => x.LesionType == LesionType.NewTargetLesion).SelectMany(x => x.TableRowInfoList).SelectMany(x => x.TableQuestionList).ToList();
//var newTargetQuestions = inDto.QuestionInfo.Where(x => x.LesionType == LesionType.NewTargetLesion).SelectMany(x => x.TableRowInfoList).SelectMany(x => x.TableQuestionList).ToList();
var newNonTargetQuestions = inDto.QuestionInfo.Where(x => x.LesionType == LesionType.NewNonTargetLesion).SelectMany(x => x.TableRowInfoList).SelectMany(x => x.TableQuestionList).ToList();
//var newNonTargetQuestions = inDto.QuestionInfo.Where(x => x.LesionType == LesionType.NewNonTargetLesion).SelectMany(x => x.TableRowInfoList).SelectMany(x => x.TableQuestionList).ToList();
var OtherPreviousNewLesionQuestions = inDto.QuestionInfo.Where(x => x.LesionType == LesionType.OtherPreviousNewLesion).SelectMany(x => x.TableRowInfoList).SelectMany(x => x.TableQuestionList).ToList();
//var OtherPreviousNewLesionQuestions = inDto.QuestionInfo.Where(x => x.LesionType == LesionType.OtherPreviousNewLesion).SelectMany(x => x.TableRowInfoList).SelectMany(x => x.TableQuestionList).ToList();
var triggeringQuestions = inDto.QuestionInfo.Where(x => x.LesionType == LesionType.TriggeringIRECSIT).SelectMany(x => x.TableRowInfoList).SelectMany(x => x.TableQuestionList).ToList();
//var triggeringQuestions = inDto.QuestionInfo.Where(x => x.LesionType == LesionType.TriggeringIRECSIT).SelectMany(x => x.TableRowInfoList).SelectMany(x => x.TableQuestionList).ToList();
// 当前访视存在至少一个明确新病灶
if (newTargetQuestions.Any(x => x.QuestionMark == QuestionMark.State && x.Answer.EqEnum(NewTargetLesionState.Exist))
|| newNonTargetQuestions.Any(x => x.QuestionMark == QuestionMark.State && x.Answer.EqEnum(NewNoTargetLesionState.Exist))
|| OtherPreviousNewLesionQuestions.Any(x => x.QuestionMark == QuestionMark.State && x.Answer.EqEnum(OtherPreviousNewLesionState.Exists))
|| triggeringQuestions.Any(x => x.QuestionMark == QuestionMark.State && x.Answer.EqEnum(NewLesionAfterTriggeringiRECSITState.Exist))
//// 当前访视存在至少一个明确新病灶
//if (newTargetQuestions.Any(x => x.QuestionMark == QuestionMark.State && x.Answer.EqEnum(NewTargetLesionState.Exist))
// || newNonTargetQuestions.Any(x => x.QuestionMark == QuestionMark.State && x.Answer.EqEnum(NewNoTargetLesionState.Exist))
// || OtherPreviousNewLesionQuestions.Any(x => x.QuestionMark == QuestionMark.State && x.Answer.EqEnum(OtherPreviousNewLesionState.Exists))
// || triggeringQuestions.Any(x => x.QuestionMark == QuestionMark.State && x.Answer.EqEnum(NewLesionAfterTriggeringiRECSITState.Exist))
)
{
result = NewLesionAssessment.Yes;
}
//只要有任何一个新病灶状态为“无法评估”
else if (newTargetQuestions.Any(x => x.QuestionMark == QuestionMark.State && x.Answer.EqEnum(NewTargetLesionState.NotEvaluable))
|| newNonTargetQuestions.Any(x => x.QuestionMark == QuestionMark.State && x.Answer.EqEnum(NewNoTargetLesionState.NotEvaluable))
|| OtherPreviousNewLesionQuestions.Any(x => x.QuestionMark == QuestionMark.State && x.Answer.EqEnum(OtherPreviousNewLesionState.NotEvaluable))
|| triggeringQuestions.Any(x => x.QuestionMark == QuestionMark.State && x.Answer.EqEnum(NewLesionAfterTriggeringiRECSITState.NotEvaluable))
// )
//{
// result = NewLesionAssessment.Yes;
//}
////只要有任何一个新病灶状态为“无法评估”
//else if (newTargetQuestions.Any(x => x.QuestionMark == QuestionMark.State && x.Answer.EqEnum(NewTargetLesionState.NotEvaluable))
// || newNonTargetQuestions.Any(x => x.QuestionMark == QuestionMark.State && x.Answer.EqEnum(NewNoTargetLesionState.NotEvaluable))
// || OtherPreviousNewLesionQuestions.Any(x => x.QuestionMark == QuestionMark.State && x.Answer.EqEnum(OtherPreviousNewLesionState.NotEvaluable))
// || triggeringQuestions.Any(x => x.QuestionMark == QuestionMark.State && x.Answer.EqEnum(NewLesionAfterTriggeringiRECSITState.NotEvaluable))
)
{
result = NewLesionAssessment.NE;
}
//当前访视不存在明确新病灶且存在至少一个疑似新病灶
else if ( (!OtherPreviousNewLesionQuestions.Any(x => x.QuestionMark == QuestionMark.State && x.Answer.EqEnum(OtherPreviousNewLesionState.Exists)) && OtherPreviousNewLesionQuestions.Any(x => x.QuestionMark == QuestionMark.State && x.Answer.EqEnum(OtherPreviousNewLesionState.Equivocal)))
|| (!triggeringQuestions.Any(x => x.QuestionMark == QuestionMark.State && x.Answer.EqEnum(NewLesionAfterTriggeringiRECSITState.Exist)) && triggeringQuestions.Any(x => x.QuestionMark == QuestionMark.State && x.Answer.EqEnum(NewLesionAfterTriggeringiRECSITState.Equivocal)))
// )
//{
// result = NewLesionAssessment.NE;
//}
////当前访视不存在明确新病灶且存在至少一个疑似新病灶
//else if ( (!OtherPreviousNewLesionQuestions.Any(x => x.QuestionMark == QuestionMark.State && x.Answer.EqEnum(OtherPreviousNewLesionState.Exists)) && OtherPreviousNewLesionQuestions.Any(x => x.QuestionMark == QuestionMark.State && x.Answer.EqEnum(OtherPreviousNewLesionState.Equivocal)))
// || (!triggeringQuestions.Any(x => x.QuestionMark == QuestionMark.State && x.Answer.EqEnum(NewLesionAfterTriggeringiRECSITState.Exist)) && triggeringQuestions.Any(x => x.QuestionMark == QuestionMark.State && x.Answer.EqEnum(NewLesionAfterTriggeringiRECSITState.Equivocal)))
)
{
result = NewLesionAssessment.Suspected;
}
// )
//{
// result = NewLesionAssessment.Suspected;
//}
else
{
result = NewLesionAssessment.No;
}
return result.GetEnumInt();
//else
//{
// result = NewLesionAssessment.No;
//}
//return result.GetEnumInt();
}
#endregion
@@ -3156,7 +3156,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
catch (Exception)
{
return beforeConvertedAnswer;
return beforeConvertedAnswer==null?string.Empty: beforeConvertedAnswer;
}
@@ -3191,9 +3191,9 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
catch (Exception)
{
return beforeConvertedAnswer;
return beforeConvertedAnswer == null ? string.Empty : beforeConvertedAnswer;
}
}
}
#endregion
@@ -3225,9 +3225,9 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
catch (Exception)
{
return beforeConvertedAnswer;
return beforeConvertedAnswer == null ? string.Empty : beforeConvertedAnswer;
}
}
}
#endregion
#endregion
@@ -123,7 +123,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
var tableAnsweRowInfos = await _readingTableAnswerRowInfoRepository.Where(x => x.VisitTaskId == indto.VisitTaskId).ProjectTo<TableAnsweRowInfo>(_mapper.ConfigurationProvider).ToListAsync();
result.LesionCountList = tableAnsweRowInfos.GroupBy(x => x.LesionType).Select(x => new LesionDto
{
LesionType = x.Key.Value,
LesionType = x.Key,
Count = x.ToList().Count()
}).ToList();
var answers = await _readingTaskQuestionAnswerRepository.Where(x => visitTaskIds.Contains(x.VisitTaskId)).ToListAsync();
@@ -396,7 +396,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
x.VisitTaskId
}).OrderBy(x => x.Answer).Select(x => x.VisitTaskId).FirstOrDefault();
if (lowPddTaskid != null && lowPddTaskid != default(Guid))
if (lowPddTaskid != default(Guid))
{
var lowPPDAnswerList = await _readingTableQuestionAnswerRepository.Where(x =>x.VisitTaskId== lowPddTaskid
@@ -456,7 +456,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
/// <param name="inDto"></param>
/// <param name="calculateType"></param>
/// <returns></returns>
public async Task ReadingCalculate(ReadingCalculateDto inDto, List<QuestionType> calculateType = null)
public async Task ReadingCalculate(ReadingCalculateDto inDto, List<QuestionType>? calculateType = null)
{
#region
@@ -662,7 +662,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
else
{
item.Answer = value.ToString();
item.Answer = value==null?string.Empty: value.ToString();
}
}
else if (calculate.GetStringFun != null)
@@ -678,7 +678,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
ValueOfType.Percentage
};
if (inDto.DigitPlaces != null && inDto.DigitPlaces != -1)
if (inDto.DigitPlaces != -1)
{
try
{
@@ -949,16 +949,16 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
switch (x.QuestionMark)
{
case QuestionMark.LowPPDLDi:
x.Answer = lowPPD.LowPPDLDi.ToString();
x.Answer = lowPPD.LowPPDLDi==null?string.Empty: lowPPD.LowPPDLDi.Value.ToString();
break;
case QuestionMark.LowPPDSDi:
x.Answer = lowPPD.LowPPDSDi.ToString();
x.Answer = lowPPD.LowPPDSDi == null ? string.Empty : lowPPD.LowPPDSDi.Value.ToString();
break;
case QuestionMark.NadirPPD:
x.Answer = lowPPD.NadirPPD.ToString();
x.Answer = lowPPD.NadirPPD == null ? string.Empty : lowPPD.NadirPPD.Value.ToString();
break;
case QuestionMark.LowPPDVisit:
x.Answer = lowPPD.LowPPDVisit.ToString();
x.Answer = lowPPD.LowPPDVisit == null ? string.Empty : lowPPD.LowPPDVisit.ToString();
break;
@@ -2059,7 +2059,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
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;
return answer?? string.Empty;
}
#region FDG-PET总体评估结果
@@ -2077,7 +2077,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
return FDGPETOverallAssessment.NA.GetEnumInt();
}
FDGPETOverallAssessment result = FDGPETOverallAssessment.NA;
//FDGPETOverallAssessment result = FDGPETOverallAssessment.NA;
// PET5PS
var PET5PS = inDto.QuestionInfo.Where(x => x.QuestionType == QuestionType.PET5PS).Select(x => x.Answer).FirstOrDefault();
@@ -2174,7 +2174,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
}
else
{
return inDto.QuestionInfo.Where(x => x.QuestionType == QuestionType.EvidenceFocalFDG).Select(x => x.Answer).FirstOrDefault();
return inDto.QuestionInfo.Where(x => x.QuestionType == QuestionType.EvidenceFocalFDG).Select(x => x.Answer).FirstOrDefault()??string.Empty;
}
}
#endregion
@@ -2218,7 +2218,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
}
else
{
var orderMark = inDto.QuestionInfo.Where(x => x.LesionType == LesionType.TargetLesion).FirstOrDefault().OrderMark;
var orderMark = inDto.QuestionInfo.Where(x => x.LesionType == LesionType.TargetLesion).FirstOrDefault()!.OrderMark;
return orderMark+ maxSuv.RowIndex.GetLesionMark();
}
@@ -61,7 +61,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
this._readingTaskQuestionAnswerRepository = readingTaskQuestionAnswerRepository;
}
private List<SiteVisitForTumor> siteVisitForTumorList = null;
private List<SiteVisitForTumor> siteVisitForTumorList = new List<SiteVisitForTumor>();
#region
@@ -536,7 +536,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
/// <param name="inDto"></param>
/// <param name="calculateType"></param>
/// <returns></returns>
public async Task ReadingCalculate(ReadingCalculateDto inDto, List<QuestionType> calculateType = null)
public async Task ReadingCalculate(ReadingCalculateDto inDto, List<QuestionType>? calculateType = null)
{
#region
@@ -815,7 +815,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
if (lastTask != null)
{
var thisTask = taskList.FirstOrDefault();
if (thisTask.StudyTime != null && lastTask.StudyTime != null)
if (thisTask!=null&& thisTask.StudyTime != null && lastTask.StudyTime != null)
{
return (int)Math.Floor((thisTask.StudyTime.Value - lastTask.StudyTime.Value).TotalDays);
}
@@ -898,14 +898,14 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
var firstVisit = taskList.FirstOrDefault();
if (baseLineTask.StudyTime != null)
if (baseLineTask!=null&&baseLineTask.StudyTime != null)
{
//基线后第二个访视(应满足访视间隔6周以上,否则顺延)
var secondVisit = taskList.Where(x => x.VisitTaskNum >= 2 && x.StudyTime >= baseLineTask.StudyTime.Value.AddDays(42)).FirstOrDefault();
if (secondVisit != null)
{
var firstTaskNewLesionsCount = (await _readingTaskQuestionAnswerRepository.Where(x => x.VisitTaskId == firstVisit.VisitTaskId && x.ReadingQuestionTrialId == newLesionsCountQuestionId).Select(x => x.Answer).FirstOrDefaultAsync()).IsNullOrEmptyReturn0();
var firstTaskNewLesionsCount = (await _readingTaskQuestionAnswerRepository.Where(x => x.VisitTaskId == firstVisit!.VisitTaskId && x.ReadingQuestionTrialId == newLesionsCountQuestionId).Select(x => x.Answer).FirstOrDefaultAsync()).IsNullOrEmptyReturn0();
// 第二访视数量
var secondVisitLesionsCount = (await _readingTaskQuestionAnswerRepository.Where(x => x.VisitTaskId == lastTask.VisitTaskId && x.ReadingQuestionTrialId == newLesionsCountQuestionId).Select(x => x.Answer).FirstOrDefaultAsync()).IsNullOrEmptyReturn0();
@@ -934,7 +934,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
var thisVisitTask = taskList.LastOrDefault();
if (thisVisitTask.StudyTime!=null&&lastTask.StudyTime!=null&&
if (thisVisitTask!=null &&thisVisitTask.StudyTime!=null&&lastTask.StudyTime!=null&&
lastTasknewLesionsCount >= 2 && thisVisitTaskNewLesionsCount >= 2 && lastTask.StudyTime.Value.AddDays(42) <= thisVisitTask.StudyTime)
@@ -949,10 +949,13 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
{
var visitForTumorEvaluationQuestionId = inDto.QuestionInfo.Where(x => x.QuestionType == QuestionType.SiteVisitForTumorEvaluation).Select(x => x.QuestionId).FirstOrDefault();
await _readingTaskQuestionAnswerRepository.BatchUpdateNoTrackingAsync(x => x.VisitTaskId == lastTask.VisitTaskId && x.ReadingQuestionTrialId == visitForTumorEvaluationQuestionId,x=> new ReadingTaskQuestionAnswer
if(lastTask!=null)
{
Answer= VisitTumorEvaluation.PD.GetEnumInt(),
});
await _readingTaskQuestionAnswerRepository.BatchUpdateNoTrackingAsync(x => x.VisitTaskId == lastTask.VisitTaskId && x.ReadingQuestionTrialId == visitForTumorEvaluationQuestionId, x => new ReadingTaskQuestionAnswer
{
Answer = VisitTumorEvaluation.PD.GetEnumInt(),
});
}
}
@@ -111,7 +111,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
var tableAnsweRowInfos = await _readingTableAnswerRowInfoRepository.Where(x => x.VisitTaskId == indto.VisitTaskId).ProjectTo<TableAnsweRowInfo>(_mapper.ConfigurationProvider).ToListAsync();
result.LesionCountList = tableAnsweRowInfos.GroupBy(x => x.LesionType).Select(x => new LesionDto
{
LesionType = x.Key.Value,
LesionType = x.Key!.Value,
Count = x.ToList().Count()
}).ToList();
var answers = await _readingTaskQuestionAnswerRepository.Where(x => visitTaskIds.Contains(x.VisitTaskId)).ToListAsync();
@@ -387,7 +387,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
/// <param name="inDto"></param>
/// <param name="calculateType"></param>
/// <returns></returns>
public async Task ReadingCalculate(ReadingCalculateDto inDto,List<QuestionType> calculateType=null)
public async Task ReadingCalculate(ReadingCalculateDto inDto,List<QuestionType>? calculateType=null)
{
#region
@@ -526,7 +526,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
else
{
item.Answer = value.ToString();
item.Answer = value==null?string.Empty: value.Value.ToString();
}
}
else if (calculate.GetStringFun != null)
@@ -542,7 +542,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
ValueOfType.Percentage
};
if (inDto.DigitPlaces != null && inDto.DigitPlaces != -1)
if (inDto.DigitPlaces != -1)
{
try
{
@@ -383,7 +383,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
/// <param name="inDto"></param>
/// <param name="calculateType"></param>
/// <returns></returns>
public async Task ReadingCalculate(ReadingCalculateDto inDto,List<QuestionType> calculateType=null)
public async Task ReadingCalculate(ReadingCalculateDto inDto,List<QuestionType>? calculateType=null)
{
#region
@@ -522,7 +522,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
else
{
item.Answer = value.ToString();
item.Answer = value==null?string.Empty: value.ToString();
}
}
else if (calculate.GetStringFun != null)
@@ -538,7 +538,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
ValueOfType.Percentage
};
if (inDto.DigitPlaces != null && inDto.DigitPlaces != -1)
if (inDto.DigitPlaces != -1)
{
try
{
@@ -61,7 +61,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
this._readingTaskQuestionAnswerRepository = readingTaskQuestionAnswerRepository;
}
private List<SiteVisitForTumor> siteVisitForTumorList = null;
private List<SiteVisitForTumor> siteVisitForTumorList = new List<SiteVisitForTumor>() ;
#region
@@ -488,7 +488,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
/// <param name="inDto"></param>
/// <param name="calculateType"></param>
/// <returns></returns>
public async Task ReadingCalculate(ReadingCalculateDto inDto, List<QuestionType> calculateType = null)
public async Task ReadingCalculate(ReadingCalculateDto inDto, List<QuestionType>? calculateType = null)
{
//var questionList = await _readingQuestionTrialRepository.Where(x => x.ReadingQuestionCriterionTrialId == inDto.CriterionId && x.CustomCalculateMark != null).ToListAsync();
//var tableQuestionList = await _readingTableQuestionTrialRepository.Where(x => x.TrialCriterionId == inDto.CriterionId && x.CustomCalculateMark != null).ToListAsync();