代码修改

IRC_NewDev
he 2023-09-25 13:13:02 +08:00
parent 473dafbb58
commit 5dab6ef30b
3 changed files with 83 additions and 19 deletions

View File

@ -263,6 +263,11 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
/// </summary>
public LesionType? LesionType { get; set; }
/// <summary>
/// 序号标记
/// </summary>
public string OrderMark { get; set; } = string.Empty;
public QuestionType? QuestionType { get; set; }
public List<TableRowInfo> TableRowInfoList = new List<TableRowInfo>();

View File

@ -122,6 +122,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
LesionType = x.LesionType,
QuestionId = x.Id,
QuesionName = x.QuestionName.LanguageName(x.QuestionEnName, _userInfo.IsEn_Us),
OrderMark=x.OrderMark,
QuestionType = x.QuestionType,
ValueType = x.ValueType,
}).ToListAsync();

View File

@ -505,6 +505,13 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
// 影像学整体肿瘤评估
new ReadingCalculateData (){QuestionType=QuestionType.ImgOncology,GetStringFun=GetImgOncology},
//SUVmax
new ReadingCalculateData (){QuestionType=QuestionType.SUVmax,GetDecimalFun=GetSuvMax},
// SUVmax所在病灶
new ReadingCalculateData (){QuestionType=QuestionType.SUVmaxLesion,GetStringFun=GetSuvMaxFocus},
////靶病灶径线之和SOD
//new ReadingCalculateData (){QuestionType=QuestionType.SOD,GetDecimalNullFun=GetSODData},
@ -549,38 +556,38 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
};
// 没有靶病灶只计算最后几个
if (inDto.QuestionInfo.Where(x => x.LesionType == LesionType.TargetLesion).Sum(x => x.TableRowInfoList.Count()) == 0)
{
//if (inDto.QuestionInfo.Where(x => x.LesionType == LesionType.TargetLesion).Sum(x => x.TableRowInfoList.Count()) == 0)
//{
List<QuestionType> questionTypes = new List<QuestionType>()
{
QuestionType.TargetLesion,
QuestionType.NoTargetLesion,
QuestionType.NewLesions,
QuestionType.Tumor,
QuestionType.ExistDisease,
};
// List<QuestionType> questionTypes = new List<QuestionType>()
// {
// QuestionType.TargetLesion,
// QuestionType.NoTargetLesion,
// QuestionType.NewLesions,
// QuestionType.Tumor,
// QuestionType.ExistDisease,
// };
// 没有靶病灶就删除其他几个答案的值
var isNeedDeleteTypes = calculateList.Where(x => !questionTypes.Contains(x.QuestionType)).Select(x => x.QuestionType).ToList();
// // 没有靶病灶就删除其他几个答案的值
// var isNeedDeleteTypes = calculateList.Where(x => !questionTypes.Contains(x.QuestionType)).Select(x => x.QuestionType).ToList();
var isNeedDeleteIds = inDto.QuestionInfo.Where(x => x.QuestionType != null && isNeedDeleteTypes.Contains(x.QuestionType.Value)).Select(x => x.QuestionId).ToList();
// var isNeedDeleteIds = inDto.QuestionInfo.Where(x => x.QuestionType != null && isNeedDeleteTypes.Contains(x.QuestionType.Value)).Select(x => x.QuestionId).ToList();
await _readingTaskQuestionAnswerRepository.BatchUpdateNoTrackingAsync(x => x.VisitTaskId == inDto.VisitTaskId && isNeedDeleteIds.Contains(x.ReadingQuestionTrialId), x => new ReadingTaskQuestionAnswer
{
Answer = string.Empty
});
// await _readingTaskQuestionAnswerRepository.BatchUpdateNoTrackingAsync(x => x.VisitTaskId == inDto.VisitTaskId && isNeedDeleteIds.Contains(x.ReadingQuestionTrialId), x => new ReadingTaskQuestionAnswer
// {
// Answer = string.Empty
// });
calculateList = calculateList.Where(x => questionTypes.Contains(x.QuestionType)).ToList();
// calculateList = calculateList.Where(x => questionTypes.Contains(x.QuestionType)).ToList();
}
//}
if (calculateType != null)
{
@ -1952,6 +1959,57 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
#endregion
#region SuvMax所在病灶
/// <summary>
/// SuvMax所在病灶
/// </summary>
/// <param name="inDto"></param>
/// <returns></returns>
public async Task<string> GetSuvMaxFocus(ReadingCalculateDto inDto)
{
var rowInfo = inDto.QuestionInfo.Where(x => x.LesionType == LesionType.TargetLesion).SelectMany(x => x.TableRowInfoList).ToList();
var tableQuestions = rowInfo.SelectMany(x => x.TableQuestionList).ToList();
var maxSuv = tableQuestions.Where(x => x.QuestionMark == QuestionMark.SUVmax).Select(x =>new {
x.RowIndex,
Answer= x.Answer.IsNullOrEmptyReturn0(),
}).OrderByDescending(x=>x.Answer).FirstOrDefault();
if (maxSuv == null)
{
return string.Empty;
}
else
{
var orderMark = inDto.QuestionInfo.Where(x => x.LesionType == LesionType.TargetLesion).FirstOrDefault().OrderMark;
return orderMark+ maxSuv.RowIndex.GetLesionMark();
}
}
#endregion
#region SuvMax
/// <summary>
/// 最大sum
/// </summary>
/// <param name="inDto"></param>
/// <returns></returns>
public async Task<decimal> GetSuvMax(ReadingCalculateDto inDto)
{
var rowInfo = inDto.QuestionInfo.Where(x => x.LesionType == LesionType.TargetLesion).SelectMany(x => x.TableRowInfoList).ToList();
var tableQuestions = rowInfo.SelectMany(x => x.TableQuestionList).ToList();
var maxSuv = tableQuestions.Where(x => x.QuestionMark == QuestionMark.SUVmax).Select(x => x.Answer.IsNullOrEmptyReturn0()).MaxOrDefault();
return maxSuv;
}
#endregion
#region 影像学整体肿瘤评估
/// <summary>
/// 影像学整体肿瘤评估