This commit is contained in:
he
2022-09-08 17:45:33 +08:00
parent abca2d730c
commit 946b5ab961
4 changed files with 223 additions and 97 deletions
@@ -6,7 +6,7 @@
using System;
using IRaCIS.Core.Domain.Share;
using System.Collections.Generic;
namespace IRaCIS.Core.Application.ViewModel
namespace IRaCIS.Core.Application.Service.Reading.Dto
{
public class CalculateTaskInDto
@@ -16,6 +16,75 @@ namespace IRaCIS.Core.Application.ViewModel
public bool IsChangeOtherTask { get; set; }
}
public class TargetLesionCalculateDto
{
/// <summary>
/// 非淋巴结靶病灶长径之和 decimal
/// </summary>
public decimal SumOfDiameter { get; set; }
/// <summary>
/// 所有淋巴结靶病灶的短径小于10mm
/// </summary>
public bool DiameterLessThan10 { get; set; }
/// <summary>
/// SOD 百分比与基线期SOD相比减小≥30%
/// </summary>
public bool SODPercentBigger30 { get; set; }
/// <summary>
/// SOD 百分比 与基线期SOD相比减小<30%
/// </summary>
public bool SODPercentLess30 { get; set; }
/// <summary>
/// SOD 百分比 整体访视期间最低点SOD相比增加
/// </summary>
public bool LowPercentLess20 { get; set; }
/// <summary>
/// SOD 百分比 比整体访视期间最低点SOD增加≥20%
/// </summary>
public bool LowPercentBigger20 { get; set; }
/// <summary>
/// SOD 变化值 比整体访视期间最低点SOD绝对增加值<5 mm
/// </summary>
public bool LowChangeLess5 { get; set; }
/// <summary>
/// 比整体访视期间最低点SOD绝对增加值≥5 mm
/// </summary>
public bool LowChangeBigger5 { get; set; }
/// <summary>
/// 被评估为NE的单个靶病灶 是否存在状态为不可评估的靶病灶
/// </summary>
public bool ExixtsNETargetLesion { get; set; }
/// <summary>
/// 上次访视点整体肿瘤评估
/// </summary>
public string LastTargetLesionEvaluate { get; set; }
/// <summary>
/// 当前访视点非淋巴结病灶长径>0
/// </summary>
public bool CurrentMajoreBigger0 { get; set; }
/// <summary>
/// 至少一个淋巴结靶病灶短径≥10 mm
/// </summary>
public bool CurrenShortBigger10 { get; set; }
/// <summary>
/// 该淋巴结靶病灶短径绝对增加值≥5 mm
/// </summary>
public bool IsAddFive { get; set; }
}
/// <summary>
/// 阅片计算Dto
/// </summary>
@@ -889,6 +889,13 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
}
public class VerifyVisitTaskDto
{
public QuestionType QuestionType { get; set; }
public Func<ReadingCalculateDto, Task<string>> Fun { get; set; }
}
public class VerifyVisitTaskQuestionsOutDto
{
public bool IsVerified { get; set; }
@@ -90,41 +90,26 @@ namespace IRaCIS.Core.Application.Service
ErrorMessage=string.Empty,
};
foreach (var item in data.QuestionInfo.Where(x => x.QuestionType != null))
List<VerifyVisitTaskDto> types = new List<VerifyVisitTaskDto>() {
new VerifyVisitTaskDto (){ QuestionType=QuestionType.TargetLesion,Fun=this.GetTargetLesionEvaluate },
new VerifyVisitTaskDto (){ QuestionType=QuestionType.NoTargetLesion,Fun=this.GetNoTargetLesionEvaluate },
new VerifyVisitTaskDto (){ QuestionType=QuestionType.NewLesions,Fun=this.GetNewLesionEvaluate }
};
foreach (var type in types)
{
switch (item.QuestionType)
{
case QuestionType.TargetLesion:
var targetLesionAnswer = await GetTargetLesionEvaluate(data);
if (item.Answer != targetLesionAnswer)
{
result.IsVerified = false;
var msg = $"问题【{item.QuesionName}】的答案为【{item.Answer}】但是计算答案为【{targetLesionAnswer}】";
result.ErrorMessage += result.ErrorMessage == string.Empty ? msg : "," + msg;
}
break;
case QuestionType.NoTargetLesion:
var noTargetLesionAnswer = await GetNoTargetLesionEvaluate(data);
if (item.Answer != noTargetLesionAnswer)
{
result.IsVerified = false;
var msg = $"问题【{item.QuesionName}】的答案为【{item.Answer}】但是计算答案为【{noTargetLesionAnswer}】";
result.ErrorMessage += result.ErrorMessage == string.Empty ? msg : "," + msg;
}
break;
case QuestionType.NewLesions:
var newTargetLesionAnswer = await GetNewLesionEvaluate(data);
if (item.Answer != newTargetLesionAnswer)
{
result.IsVerified = false;
var msg = $"问题【{item.QuesionName}】的答案为【{item.Answer}】但是计算答案为【{newTargetLesionAnswer}】";
result.ErrorMessage += result.ErrorMessage == string.Empty ? msg : "," + msg;
}
break;
}
}
var question=data.QuestionInfo.Where(x => x.QuestionType == type.QuestionType).FirstOrDefault();
if (question != null)
{
var calculateAnswer = await type.Fun(data);
if (question.Answer != calculateAnswer)
{
result.IsVerified = false;
var msg = $"问题【{question.QuesionName}】的答案为【{question.Answer}】但是计算答案为【{calculateAnswer}】";
result.ErrorMessage += result.ErrorMessage == string.Empty ? msg : "," + msg;
}
}
}
return result;
}
@@ -798,18 +783,18 @@ namespace IRaCIS.Core.Application.Service
public async Task<string> GetTargetLesionEvaluate(ReadingCalculateDto inDto)
{
var tableQuestion = inDto.QuestionInfo.Where(x => x.LesionType == LesionType.TargetLesion).SelectMany(x => x.TableRowInfoList).ToList();
dynamic resultData = new
TargetLesionCalculateDto resultData = new TargetLesionCalculateDto()
{
//非淋巴结靶病灶长径之和
//非淋巴结靶病灶长径之和 decimal
SumOfDiameter = inDto.QuestionInfo.Where(x => x.QuestionType == QuestionType.SumOfDiameter).Sum(x => x.Answer.IsNullOrEmptyReturn0()),
//所有淋巴结靶病灶的短径小于10mm
//所有淋巴结靶病灶的短径小于10mm bool
DiameterLessThan10 = true,
// SOD 百分比与基线期SOD相比减小≥30%
// SOD 百分比与基线期SOD相比减小≥30% bool
SODPercentBigger30 = inDto.QuestionInfo.Where(x => x.QuestionType == QuestionType.SODPercent).Sum(x => x.Answer.IsNullOrEmptyReturn0()) >= (decimal)0.3,
// SOD 百分比 与基线期SOD相比减小<30%
// SOD 百分比 与基线期SOD相比减小<30% bool
SODPercentLess30 = inDto.QuestionInfo.Where(x => x.QuestionType == QuestionType.SODPercent).Sum(x => x.Answer.IsNullOrEmptyReturn0()) < (decimal)0.3,
// SOD 百分比 整体访视期间最低点SOD相比增加<20%
@@ -872,7 +857,7 @@ namespace IRaCIS.Core.Application.Service
string result = string.Empty;
if (resultData.calculateData == 0 && resultData.DiameterLessThan10 && !resultData.ExixtsNETargetLesion)
if (resultData.SumOfDiameter == 0 && resultData.DiameterLessThan10 && !resultData.ExixtsNETargetLesion)
{
result = "CR";
}