修改一版
parent
4e320c5e98
commit
abca2d730c
|
@ -1740,6 +1740,11 @@
|
||||||
裁判结果的备注
|
裁判结果的备注
|
||||||
</summary>
|
</summary>
|
||||||
</member>
|
</member>
|
||||||
|
<member name="P:IRaCIS.Core.Application.Service.Reading.Dto.VerifyVisitTaskQuestionsInDto.VisitTaskId">
|
||||||
|
<summary>
|
||||||
|
任务Id
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
<member name="P:IRaCIS.Core.Application.Service.Reading.Dto.SubmitTableQuestionInDto.VisitTaskId">
|
<member name="P:IRaCIS.Core.Application.Service.Reading.Dto.SubmitTableQuestionInDto.VisitTaskId">
|
||||||
<summary>
|
<summary>
|
||||||
任务Id
|
任务Id
|
||||||
|
@ -3612,6 +3617,20 @@
|
||||||
<param name="inDto"></param>
|
<param name="inDto"></param>
|
||||||
<returns></returns>
|
<returns></returns>
|
||||||
</member>
|
</member>
|
||||||
|
<member name="M:IRaCIS.Core.Application.Service.ReadingCalculateService.VerifyVisitTaskQuestions(IRaCIS.Core.Application.Service.Reading.Dto.VerifyVisitTaskQuestionsInDto)">
|
||||||
|
<summary>
|
||||||
|
验证访视提交
|
||||||
|
</summary>
|
||||||
|
<param name="inDto"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
|
<member name="M:IRaCIS.Core.Application.Service.ReadingCalculateService.GetReadingCalculateDto(System.Guid)">
|
||||||
|
<summary>
|
||||||
|
获取ReadingCalculateDto
|
||||||
|
</summary>
|
||||||
|
<param name="visitTaskId"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
<member name="M:IRaCIS.Core.Application.Service.ReadingCalculateService.ReadingCalculate(IRaCIS.Core.Application.ViewModel.ReadingCalculateDto)">
|
<member name="M:IRaCIS.Core.Application.Service.ReadingCalculateService.ReadingCalculate(IRaCIS.Core.Application.ViewModel.ReadingCalculateDto)">
|
||||||
<summary>
|
<summary>
|
||||||
自动计算
|
自动计算
|
||||||
|
@ -3753,6 +3772,27 @@
|
||||||
</summary>
|
</summary>
|
||||||
<returns></returns>
|
<returns></returns>
|
||||||
</member>
|
</member>
|
||||||
|
<member name="M:IRaCIS.Core.Application.Service.ReadingCalculateService.GetTargetLesionEvaluate(IRaCIS.Core.Application.ViewModel.ReadingCalculateDto)">
|
||||||
|
<summary>
|
||||||
|
获取靶病灶评估
|
||||||
|
</summary>
|
||||||
|
<param name="inDto"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
|
<member name="M:IRaCIS.Core.Application.Service.ReadingCalculateService.GetNoTargetLesionEvaluate(IRaCIS.Core.Application.ViewModel.ReadingCalculateDto)">
|
||||||
|
<summary>
|
||||||
|
获取非靶病灶评估
|
||||||
|
</summary>
|
||||||
|
<param name="inDto"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
|
<member name="M:IRaCIS.Core.Application.Service.ReadingCalculateService.GetNewLesionEvaluate(IRaCIS.Core.Application.ViewModel.ReadingCalculateDto)">
|
||||||
|
<summary>
|
||||||
|
获取新病灶评估
|
||||||
|
</summary>
|
||||||
|
<param name="inDto"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
<member name="T:IRaCIS.Core.Application.Service.ReadingMedicalReviewService">
|
<member name="T:IRaCIS.Core.Application.Service.ReadingMedicalReviewService">
|
||||||
<summary>
|
<summary>
|
||||||
阅片医学审核
|
阅片医学审核
|
||||||
|
@ -4392,6 +4432,11 @@
|
||||||
答案
|
答案
|
||||||
</summary>
|
</summary>
|
||||||
</member>
|
</member>
|
||||||
|
<member name="P:IRaCIS.Core.Application.ViewModel.QuestionInfo.QuesionName">
|
||||||
|
<summary>
|
||||||
|
问题名称
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
<member name="P:IRaCIS.Core.Application.ViewModel.QuestionInfo.LesionType">
|
<member name="P:IRaCIS.Core.Application.ViewModel.QuestionInfo.LesionType">
|
||||||
<summary>
|
<summary>
|
||||||
病灶类型
|
病灶类型
|
||||||
|
@ -7376,6 +7421,13 @@
|
||||||
<param name="inDto"></param>
|
<param name="inDto"></param>
|
||||||
<returns></returns>
|
<returns></returns>
|
||||||
</member>
|
</member>
|
||||||
|
<member name="M:IRaCIS.Application.Services.ReadingImageTaskService.VerifyVisitTaskQuestions(IRaCIS.Core.Application.Service.Reading.Dto.VerifyVisitTaskQuestionsInDto)">
|
||||||
|
<summary>
|
||||||
|
验证访视提交
|
||||||
|
</summary>
|
||||||
|
<param name="inDto"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
<member name="M:IRaCIS.Application.Services.ReadingImageTaskService.SubmitTableQuestion(IRaCIS.Core.Application.Service.Reading.Dto.SubmitTableQuestionInDto)">
|
<member name="M:IRaCIS.Application.Services.ReadingImageTaskService.SubmitTableQuestion(IRaCIS.Core.Application.Service.Reading.Dto.SubmitTableQuestionInDto)">
|
||||||
<summary>
|
<summary>
|
||||||
提交表格问题
|
提交表格问题
|
||||||
|
|
|
@ -52,6 +52,11 @@ namespace IRaCIS.Core.Application.ViewModel
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Answer { get; set; }
|
public string Answer { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 问题名称
|
||||||
|
/// </summary>
|
||||||
|
public string QuesionName { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 病灶类型
|
/// 病灶类型
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -889,6 +889,20 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class VerifyVisitTaskQuestionsOutDto
|
||||||
|
{
|
||||||
|
public bool IsVerified { get; set; }
|
||||||
|
|
||||||
|
public string ErrorMessage { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class VerifyVisitTaskQuestionsInDto
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 任务Id
|
||||||
|
/// </summary>
|
||||||
|
public Guid VisitTaskId { get; set; }
|
||||||
|
}
|
||||||
public class SubmitTableQuestionInDto
|
public class SubmitTableQuestionInDto
|
||||||
{
|
{
|
||||||
public Guid QuestionId { get; set; }
|
public Guid QuestionId { get; set; }
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
// 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。
|
// 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。
|
||||||
//--------------------------------------------------------------------
|
//--------------------------------------------------------------------
|
||||||
|
|
||||||
|
using IRaCIS.Core.Application.Service.Reading.Dto;
|
||||||
using IRaCIS.Core.Application.ViewModel;
|
using IRaCIS.Core.Application.ViewModel;
|
||||||
namespace IRaCIS.Core.Application.Interfaces
|
namespace IRaCIS.Core.Application.Interfaces
|
||||||
{
|
{
|
||||||
|
@ -13,5 +14,8 @@ namespace IRaCIS.Core.Application.Interfaces
|
||||||
public interface IReadingCalculateService
|
public interface IReadingCalculateService
|
||||||
{
|
{
|
||||||
Task CalculateTask(CalculateTaskInDto inDto);
|
Task CalculateTask(CalculateTaskInDto inDto);
|
||||||
|
|
||||||
|
|
||||||
|
Task<VerifyVisitTaskQuestionsOutDto> VerifyVisitTaskQuestions(VerifyVisitTaskQuestionsInDto inDto);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,6 +12,7 @@ using Panda.DynamicWebApi.Attributes;
|
||||||
using IRaCIS.Core.Domain.Share;
|
using IRaCIS.Core.Domain.Share;
|
||||||
using IRaCIS.Core.Infra.EFCore.Common;
|
using IRaCIS.Core.Infra.EFCore.Common;
|
||||||
using Microsoft.Extensions.Caching.Memory;
|
using Microsoft.Extensions.Caching.Memory;
|
||||||
|
using IRaCIS.Core.Application.Service.Reading.Dto;
|
||||||
|
|
||||||
namespace IRaCIS.Core.Application.Service
|
namespace IRaCIS.Core.Application.Service
|
||||||
{
|
{
|
||||||
|
@ -64,27 +65,99 @@ namespace IRaCIS.Core.Application.Service
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
public async Task CalculateTask(CalculateTaskInDto inDto)
|
public async Task CalculateTask(CalculateTaskInDto inDto)
|
||||||
{
|
{
|
||||||
var visitTask = await _visitTaskRepository.Where(x => x.Id == inDto.VisitTaskId).FirstNotNullAsync();
|
ReadingCalculateDto readingData = await GetReadingCalculateDto(inDto.VisitTaskId);
|
||||||
|
readingData.IsChangeOtherTask = inDto.IsChangeOtherTask;
|
||||||
|
await ReadingCalculate(readingData);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 验证访视提交
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="inDto"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public async Task<VerifyVisitTaskQuestionsOutDto> VerifyVisitTaskQuestions(VerifyVisitTaskQuestionsInDto inDto)
|
||||||
|
{
|
||||||
|
await this.CalculateTask(new CalculateTaskInDto()
|
||||||
|
{
|
||||||
|
VisitTaskId = inDto.VisitTaskId,
|
||||||
|
IsChangeOtherTask = true
|
||||||
|
});
|
||||||
|
visitTaskAnswerList = null;
|
||||||
|
ReadingCalculateDto data = await GetReadingCalculateDto(inDto.VisitTaskId);
|
||||||
|
VerifyVisitTaskQuestionsOutDto result = new VerifyVisitTaskQuestionsOutDto() {
|
||||||
|
|
||||||
|
IsVerified=true,
|
||||||
|
ErrorMessage=string.Empty,
|
||||||
|
};
|
||||||
|
|
||||||
|
foreach (var item in data.QuestionInfo.Where(x => x.QuestionType != null))
|
||||||
|
{
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取ReadingCalculateDto
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="visitTaskId"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public async Task<ReadingCalculateDto> GetReadingCalculateDto(Guid visitTaskId)
|
||||||
|
{
|
||||||
|
var visitTask = await _visitTaskRepository.Where(x => x.Id == visitTaskId).FirstNotNullAsync();
|
||||||
var criterionId = await _readingQuestionCriterionTrialRepository.Where(x => x.TrialId == visitTask.TrialId && x.IsConfirm).Select(x => x.Id).FirstOrDefaultAsync();
|
var criterionId = await _readingQuestionCriterionTrialRepository.Where(x => x.TrialId == visitTask.TrialId && x.IsConfirm).Select(x => x.Id).FirstOrDefaultAsync();
|
||||||
List<QuestionInfo> questionInfos = await _readingQuestionTrialRepository.Where(x => x.ReadingQuestionCriterionTrialId == criterionId).Select(x => new QuestionInfo()
|
List<QuestionInfo> questionInfos = await _readingQuestionTrialRepository.Where(x => x.ReadingQuestionCriterionTrialId == criterionId).Select(x => new QuestionInfo()
|
||||||
{
|
{
|
||||||
LesionType = x.LesionType,
|
LesionType = x.LesionType,
|
||||||
QuestionId = x.Id,
|
QuestionId = x.Id,
|
||||||
|
QuesionName=x.QuestionName,
|
||||||
QuestionType = x.QuestionType,
|
QuestionType = x.QuestionType,
|
||||||
}).ToListAsync();
|
}).ToListAsync();
|
||||||
|
|
||||||
var questionAnswers = await _readingTaskQuestionAnswerRepository.Where(x => x.VisitTaskId == inDto.VisitTaskId).Select(x => new
|
var questionAnswers = await _readingTaskQuestionAnswerRepository.Where(x => x.VisitTaskId == visitTaskId).Select(x => new
|
||||||
{
|
{
|
||||||
x.ReadingQuestionTrialId,
|
x.ReadingQuestionTrialId,
|
||||||
x.Answer
|
x.Answer
|
||||||
}).ToListAsync();
|
}).ToListAsync();
|
||||||
|
|
||||||
var tableQuestion = await _readingTableQuestionAnswerRepository.Where(x => x.VisitTaskId == inDto.VisitTaskId).Include(x=>x.ReadingTableQuestionTrial).Select(x => new TableQuestionInfo()
|
var tableQuestion = await _readingTableQuestionAnswerRepository.Where(x => x.VisitTaskId == visitTaskId).Include(x => x.ReadingTableQuestionTrial).Select(x => new TableQuestionInfo()
|
||||||
{
|
{
|
||||||
Answer = x.Answer,
|
Answer = x.Answer,
|
||||||
QuestionMark = x.ReadingTableQuestionTrial.QuestionMark,
|
QuestionMark = x.ReadingTableQuestionTrial.QuestionMark,
|
||||||
TableQuestionId = x.TableQuestionId,
|
TableQuestionId = x.TableQuestionId,
|
||||||
QuestionId = x.QuestionId,
|
QuestionId = x.QuestionId,
|
||||||
|
|
||||||
RowIndex = x.RowIndex,
|
RowIndex = x.RowIndex,
|
||||||
}).ToListAsync();
|
}).ToListAsync();
|
||||||
|
|
||||||
|
@ -105,17 +178,16 @@ namespace IRaCIS.Core.Application.Service
|
||||||
ReadingCalculateDto readingData = new ReadingCalculateDto()
|
ReadingCalculateDto readingData = new ReadingCalculateDto()
|
||||||
{
|
{
|
||||||
SubjectId = visitTask.SubjectId,
|
SubjectId = visitTask.SubjectId,
|
||||||
VisitTaskId = inDto.VisitTaskId,
|
VisitTaskId = visitTaskId,
|
||||||
SubjectVisitId = visitTask.SourceSubjectVisitId.Value,
|
SubjectVisitId = visitTask.SourceSubjectVisitId.Value,
|
||||||
QuestionInfo = questionInfos,
|
QuestionInfo = questionInfos,
|
||||||
CriterionId = criterionId,
|
CriterionId = criterionId,
|
||||||
IsChangeOtherTask=inDto.IsChangeOtherTask,
|
|
||||||
TrialId = visitTask.TrialId,
|
TrialId = visitTask.TrialId,
|
||||||
DoctorUserId = visitTask.DoctorUserId,
|
DoctorUserId = visitTask.DoctorUserId,
|
||||||
};
|
};
|
||||||
//await ReadingCalculate(readingData);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
return readingData;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 自动计算
|
/// 自动计算
|
||||||
|
@ -334,13 +406,13 @@ namespace IRaCIS.Core.Application.Service
|
||||||
if (item.TableQuestionList.Any(x => x.QuestionMark == QuestionMark.IsLymph && (x.Answer == "是"||x.Answer.ToLower()=="true".ToLower())))
|
if (item.TableQuestionList.Any(x => x.QuestionMark == QuestionMark.IsLymph && (x.Answer == "是"||x.Answer.ToLower()=="true".ToLower())))
|
||||||
{
|
{
|
||||||
// 淋巴结的短径
|
// 淋巴结的短径
|
||||||
result += decimal.Parse((item.TableQuestionList.Where(x => x.QuestionMark == QuestionMark.ShortAxis).Select(x => x.Answer).FirstOrDefault()).IsNullOrEmptyReturn0());
|
result += (item.TableQuestionList.Where(x => x.QuestionMark == QuestionMark.ShortAxis).Select(x => x.Answer).FirstOrDefault()).IsNullOrEmptyReturn0();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (item.TableQuestionList.Any(x => x.QuestionMark == QuestionMark.IsLymph && (x.Answer == "是" || x.Answer.ToLower() == "true".ToLower())))
|
if (item.TableQuestionList.Any(x => x.QuestionMark == QuestionMark.IsLymph && (x.Answer == "是" || x.Answer.ToLower() == "true".ToLower())))
|
||||||
{
|
{
|
||||||
// 非淋巴结的长径
|
// 非淋巴结的长径
|
||||||
result += decimal.Parse(item.TableQuestionList.Where(x => x.QuestionMark == QuestionMark.MajorAxis).Select(x => x.Answer).FirstOrDefault().IsNullOrEmptyReturn0());
|
result += item.TableQuestionList.Where(x => x.QuestionMark == QuestionMark.MajorAxis).Select(x => x.Answer).FirstOrDefault().IsNullOrEmptyReturn0();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -368,7 +440,7 @@ namespace IRaCIS.Core.Application.Service
|
||||||
if (item.TableQuestionList.Any(x => x.QuestionMark == QuestionMark.IsLymph && (x.Answer == "是" || x.Answer.ToLower() == "false".ToLower())))
|
if (item.TableQuestionList.Any(x => x.QuestionMark == QuestionMark.IsLymph && (x.Answer == "是" || x.Answer.ToLower() == "false".ToLower())))
|
||||||
{
|
{
|
||||||
// 非淋巴结的长径
|
// 非淋巴结的长径
|
||||||
result += decimal.Parse(item.TableQuestionList.Where(x => x.QuestionMark == QuestionMark.MajorAxis).Select(x => x.Answer).FirstOrDefault().IsNullOrEmptyReturn0());
|
result += item.TableQuestionList.Where(x => x.QuestionMark == QuestionMark.MajorAxis).Select(x => x.Answer).FirstOrDefault().IsNullOrEmptyReturn0();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -514,10 +586,10 @@ namespace IRaCIS.Core.Application.Service
|
||||||
var isExists = false;
|
var isExists = false;
|
||||||
foreach (var item in rowIndexs)
|
foreach (var item in rowIndexs)
|
||||||
{
|
{
|
||||||
var lastValue = decimal.Parse(lastQuestionAsnwer.Where(x => x.RowIndex == item && x.ReadingTableQuestionTrial.QuestionMark == QuestionMark.ShortAxis).Select(x => x.Answer).FirstOrDefault().IsNullOrEmptyReturn0());
|
var lastValue = lastQuestionAsnwer.Where(x => x.RowIndex == item && x.ReadingTableQuestionTrial.QuestionMark == QuestionMark.ShortAxis).Select(x => x.Answer).FirstOrDefault().IsNullOrEmptyReturn0();
|
||||||
|
|
||||||
var thisRowData = thisQuestionAsnwer.Where(x => x.RowIndex == item).SelectMany(x => x.TableQuestionList).ToList();
|
var thisRowData = thisQuestionAsnwer.Where(x => x.RowIndex == item).SelectMany(x => x.TableQuestionList).ToList();
|
||||||
var thisValue = decimal.Parse(thisRowData.Where(x => x.QuestionMark == QuestionMark.ShortAxis).Select(x => x.Answer).FirstOrDefault().IsNullOrEmptyReturn0());
|
var thisValue = thisRowData.Where(x => x.QuestionMark == QuestionMark.ShortAxis).Select(x => x.Answer).FirstOrDefault().IsNullOrEmptyReturn0();
|
||||||
|
|
||||||
if (thisValue - lastValue > 5)
|
if (thisValue - lastValue > 5)
|
||||||
{
|
{
|
||||||
|
@ -664,7 +736,7 @@ namespace IRaCIS.Core.Application.Service
|
||||||
.Select(x => x.Id).FirstOrDefaultAsync();
|
.Select(x => x.Id).FirstOrDefaultAsync();
|
||||||
|
|
||||||
|
|
||||||
var baseLineSOD = decimal.Parse((await _readingTaskQuestionAnswerRepository.Where(x => x.VisitTaskId == baseLineTaskId && x.ReadingQuestionTrial.QuestionType == QuestionType.SOD).Select(x => x.Answer).FirstOrDefaultAsync()).IsNullOrEmptyReturn0());
|
var baseLineSOD =(await _readingTaskQuestionAnswerRepository.Where(x => x.VisitTaskId == baseLineTaskId && x.ReadingQuestionTrial.QuestionType == QuestionType.SOD).Select(x => x.Answer).FirstOrDefaultAsync()).IsNullOrEmptyReturn0();
|
||||||
return baseLineSOD;
|
return baseLineSOD;
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
@ -686,7 +758,7 @@ namespace IRaCIS.Core.Application.Service
|
||||||
VisitTaskId = x.VisitTaskId,
|
VisitTaskId = x.VisitTaskId,
|
||||||
QuestionId = x.ReadingQuestionTrialId,
|
QuestionId = x.ReadingQuestionTrialId,
|
||||||
VisitName = x.VisitTask.SourceSubjectVisit.VisitName,
|
VisitName = x.VisitTask.SourceSubjectVisit.VisitName,
|
||||||
SOD = decimal.Parse(x.Answer.IsNullOrEmptyReturn0()),
|
SOD = x.Answer.IsNullOrEmptyReturn0(),
|
||||||
}).ToListAsync();
|
}).ToListAsync();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -715,5 +787,237 @@ namespace IRaCIS.Core.Application.Service
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region 计算阅片问题 外层问题
|
||||||
|
|
||||||
|
#region 获取靶病灶评估
|
||||||
|
/// <summary>
|
||||||
|
/// 获取靶病灶评估
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="inDto"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
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
|
||||||
|
{
|
||||||
|
//非淋巴结靶病灶长径之和
|
||||||
|
SumOfDiameter = inDto.QuestionInfo.Where(x => x.QuestionType == QuestionType.SumOfDiameter).Sum(x => x.Answer.IsNullOrEmptyReturn0()),
|
||||||
|
|
||||||
|
//所有淋巴结靶病灶的短径小于10mm
|
||||||
|
DiameterLessThan10 = true,
|
||||||
|
|
||||||
|
// SOD 百分比与基线期SOD相比减小≥30%
|
||||||
|
SODPercentBigger30 = inDto.QuestionInfo.Where(x => x.QuestionType == QuestionType.SODPercent).Sum(x => x.Answer.IsNullOrEmptyReturn0()) >= (decimal)0.3,
|
||||||
|
|
||||||
|
// SOD 百分比 与基线期SOD相比减小<30%
|
||||||
|
SODPercentLess30 = inDto.QuestionInfo.Where(x => x.QuestionType == QuestionType.SODPercent).Sum(x => x.Answer.IsNullOrEmptyReturn0()) < (decimal)0.3,
|
||||||
|
|
||||||
|
// SOD 百分比 整体访视期间最低点SOD相比增加<20%
|
||||||
|
LowPercentLess20 = inDto.QuestionInfo.Where(x => x.QuestionType == QuestionType.LowPercent).Sum(x => x.Answer.IsNullOrEmptyReturn0()) < (decimal)0.2,
|
||||||
|
|
||||||
|
// SOD 百分比 比整体访视期间最低点SOD增加≥20%
|
||||||
|
LowPercentBigger20 = inDto.QuestionInfo.Where(x => x.QuestionType == QuestionType.LowPercent).Sum(x => x.Answer.IsNullOrEmptyReturn0()) >= (decimal)0.2,
|
||||||
|
|
||||||
|
// SOD 变化值 比整体访视期间最低点SOD绝对增加值<5 mm
|
||||||
|
LowChangeLess5 = inDto.QuestionInfo.Where(x => x.QuestionType == QuestionType.LowestIncrease).Sum(x => x.Answer.IsNullOrEmptyReturn0()) < 5,
|
||||||
|
|
||||||
|
// 比整体访视期间最低点SOD绝对增加值≥5 mm
|
||||||
|
LowChangeBigger5 = inDto.QuestionInfo.Where(x => x.QuestionType == QuestionType.LowestIncrease).Sum(x => x.Answer.IsNullOrEmptyReturn0()) >= 5,
|
||||||
|
|
||||||
|
// 被评估为NE的单个靶病灶 是否存在状态为不可评估的靶病灶
|
||||||
|
ExixtsNETargetLesion = tableQuestion.SelectMany(x => x.TableQuestionList).Any(x => x.QuestionMark == QuestionMark.State && x.Answer == "不可评估"),
|
||||||
|
|
||||||
|
//// 上次访视点整体肿瘤评估
|
||||||
|
LastTargetLesionEvaluate = string.Empty,
|
||||||
|
|
||||||
|
// 当前访视点非淋巴结病灶长径>0
|
||||||
|
CurrentMajoreBigger0 = true,
|
||||||
|
|
||||||
|
// 至少一个淋巴结靶病灶短径≥10 mm
|
||||||
|
CurrenShortBigger10 = true,
|
||||||
|
|
||||||
|
// 该淋巴结靶病灶短径绝对增加值≥5 mm
|
||||||
|
IsAddFive = inDto.QuestionInfo.Where(x => x.QuestionType == QuestionType.IsAddFive && x.Answer == "是").Count() > 0,
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
foreach (var item in tableQuestion)
|
||||||
|
{
|
||||||
|
if (item.TableQuestionList.Any(x => x.QuestionMark == QuestionMark.IsLymph && (x.Answer == "是" || x.Answer.ToLower() == "true".ToLower())))
|
||||||
|
{
|
||||||
|
// 淋巴结的短径
|
||||||
|
resultData.DiameterLessThan10 = (item.TableQuestionList.Where(x => x.QuestionMark == QuestionMark.ShortAxis).Select(x => x.Answer).FirstOrDefault()).IsNullOrEmptyReturn0() < 10;
|
||||||
|
|
||||||
|
// 至少一个淋巴结靶病灶短径≥10 mm
|
||||||
|
resultData.CurrenShortBigger10 = (item.TableQuestionList.Where(x => x.QuestionMark == QuestionMark.ShortAxis).Select(x => x.Answer).FirstOrDefault()).IsNullOrEmptyReturn0() >= 10;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (item.TableQuestionList.Any(x => x.QuestionMark == QuestionMark.IsLymph && (x.Answer == "否" || x.Answer.ToLower() == "false".ToLower())))
|
||||||
|
{
|
||||||
|
// 当前访视点非淋巴结病灶
|
||||||
|
resultData.CurrentMajoreBigger0 = (item.TableQuestionList.Where(x => x.QuestionMark == QuestionMark.MajorAxis).Select(x => x.Answer).FirstOrDefault()).IsNullOrEmptyReturn0() > 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
var lastVisitTaskId = await GetLastVisitTaskId(inDto);
|
||||||
|
var questionId = inDto.QuestionInfo.Where(x => x.QuestionType == QuestionType.Tumor).Select(x => x.QuestionId).FirstOrDefault();
|
||||||
|
resultData.LastTargetLesionEvaluate=(await _readingTaskQuestionAnswerRepository.Where(x => x.VisitTaskId == lastVisitTaskId && x.ReadingQuestionTrialId == questionId)
|
||||||
|
.Select(x => x.Answer).FirstOrDefaultAsync()) ?? string.Empty;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
string result = string.Empty;
|
||||||
|
if (resultData.calculateData == 0 && resultData.DiameterLessThan10 && !resultData.ExixtsNETargetLesion)
|
||||||
|
{
|
||||||
|
result = "CR";
|
||||||
|
}
|
||||||
|
else if (
|
||||||
|
(resultData.SODPercentBigger30 && resultData.LowPercentLess20 && !resultData.ExixtsNETargetLesion)
|
||||||
|
||
|
||||||
|
(resultData.SODPercentBigger30 && resultData.LowChangeLess5 && !resultData.ExixtsNETargetLesion)
|
||||||
|
)
|
||||||
|
{
|
||||||
|
result = "PR";
|
||||||
|
}
|
||||||
|
else if (
|
||||||
|
(resultData.SODPercentLess30 && resultData.LowPercentLess20 && !resultData.ExixtsNETargetLesion)
|
||||||
|
||
|
||||||
|
(resultData.SODPercentLess30 && resultData.LowChangeLess5 && !resultData.ExixtsNETargetLesion)
|
||||||
|
)
|
||||||
|
{
|
||||||
|
result = "SD";
|
||||||
|
}
|
||||||
|
else if (resultData.LowPercentBigger20 && resultData.LowChangeBigger5)
|
||||||
|
{
|
||||||
|
result = "PD";
|
||||||
|
}
|
||||||
|
else if (
|
||||||
|
(resultData.LowPercentLess20 && resultData.ExixtsNETargetLesion)
|
||||||
|
||
|
||||||
|
(resultData.LowPercentBigger20 && resultData.LowChangeLess5 && resultData.ExixtsNETargetLesion)
|
||||||
|
)
|
||||||
|
{
|
||||||
|
result = "NE";
|
||||||
|
}
|
||||||
|
|
||||||
|
else if (!resultData.ExixtsNETargetLesion)
|
||||||
|
{
|
||||||
|
result = "ND";
|
||||||
|
}
|
||||||
|
|
||||||
|
else if (
|
||||||
|
(resultData.LastTargetLesionEvaluate == "CR" && resultData.CurrenShortBigger10 && resultData.IsAddFive)
|
||||||
|
||
|
||||||
|
(resultData.LastTargetLesionEvaluate == "CR" && resultData.CurrentMajoreBigger0)
|
||||||
|
)
|
||||||
|
{
|
||||||
|
result = "PD";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region 获取非靶病灶评估
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取非靶病灶评估
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="inDto"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public async Task<string> GetNoTargetLesionEvaluate(ReadingCalculateDto inDto)
|
||||||
|
{
|
||||||
|
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 == "显著增大"))
|
||||||
|
{
|
||||||
|
return "PD";
|
||||||
|
}
|
||||||
|
//所有单个病灶/病灶组状态评估状态为“消失”
|
||||||
|
else if (!tableQuestions.Any(x => x.QuestionMark == QuestionMark.State && x.Answer != "消失"))
|
||||||
|
{
|
||||||
|
return "PD";
|
||||||
|
}
|
||||||
|
// 任意单个病灶/病灶组评估为“无法评估”并且没有“显著增大”
|
||||||
|
else if (tableQuestions.Any(x => x.QuestionMark == QuestionMark.State && x.Answer == "无法评估") &&
|
||||||
|
!tableQuestions.Any(x => x.QuestionMark == QuestionMark.State && x.Answer != "显著增大")
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return "NE";
|
||||||
|
}
|
||||||
|
// 基线时没有非靶病灶
|
||||||
|
else if (tableQuestions.Count() == 0)
|
||||||
|
{
|
||||||
|
return "ND";
|
||||||
|
}
|
||||||
|
|
||||||
|
// 所有单个病灶/病灶组评估为”存在”或者有些评估为“消失”有些评估为“存在”,且没有“显著增大”和“无法评估”的病灶
|
||||||
|
|
||||||
|
else if (!tableQuestions.Any(x => x.QuestionMark == QuestionMark.State && x.Answer != "存在")
|
||||||
|
|| (tableQuestions.Any(x => x.QuestionMark == QuestionMark.State && x.Answer == "存在" || x.Answer == "消失") && !tableQuestions.Any(x => x.QuestionMark == QuestionMark.State && (x.Answer != "显著增大" || x.Answer != "无法评估")))
|
||||||
|
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return "NN";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return string.Empty;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region 获取新病灶评估
|
||||||
|
/// <summary>
|
||||||
|
/// 获取新病灶评估
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="inDto"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public async Task<string> GetNewLesionEvaluate(ReadingCalculateDto inDto)
|
||||||
|
{
|
||||||
|
var tableRows = inDto.QuestionInfo.Where(x => x.LesionType == LesionType.NewLesions).SelectMany(x => x.TableRowInfoList).ToList();
|
||||||
|
|
||||||
|
var tableQuestions = tableRows.SelectMany(x => x.TableQuestionList).ToList();
|
||||||
|
|
||||||
|
|
||||||
|
// 当前访视存在至少一个明确新病灶
|
||||||
|
if (tableQuestions.Any(x => x.QuestionMark == QuestionMark.State && x.Answer == "明确"))
|
||||||
|
{
|
||||||
|
return "是";
|
||||||
|
}
|
||||||
|
//当前访视不存在明确新病灶且存在至少一个疑似新病灶
|
||||||
|
else if (!tableQuestions.Any(x => x.QuestionMark == QuestionMark.State && x.Answer != "明确") ||
|
||||||
|
tableQuestions.Any(x => x.QuestionMark == QuestionMark.State && x.Answer == "疑似")
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return "疑似";
|
||||||
|
}
|
||||||
|
|
||||||
|
//只要有任何一个新病灶状态为“无法评估”
|
||||||
|
else if (tableQuestions.Any(x => x.QuestionMark == QuestionMark.State && x.Answer == "无法评估"))
|
||||||
|
{
|
||||||
|
return "NE";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return "否";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1844,6 +1844,17 @@ namespace IRaCIS.Application.Services
|
||||||
|
|
||||||
#region 提交问题
|
#region 提交问题
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 验证访视提交
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="inDto"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpPost]
|
||||||
|
public async Task<VerifyVisitTaskQuestionsOutDto> VerifyVisitTaskQuestions(VerifyVisitTaskQuestionsInDto inDto)
|
||||||
|
{
|
||||||
|
return await _readingCalculateService.VerifyVisitTaskQuestions(inDto);
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 提交表格问题
|
/// 提交表格问题
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -38,16 +38,16 @@ namespace IRaCIS.Core.Infra.EFCore.Common
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static string IsNullOrEmptyReturn0(this string value)
|
public static decimal IsNullOrEmptyReturn0(this string value)
|
||||||
{
|
{
|
||||||
if (value == null || value == string.Empty)
|
if (value == null || value == string.Empty)
|
||||||
{
|
{
|
||||||
return "0";
|
return 0;
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return value;
|
return decimal.Parse(value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue