diff --git a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml
index b936e7141..2b2f0a845 100644
--- a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml
+++ b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml
@@ -1111,6 +1111,15 @@
+
+
+ 添加计算错误日志
+
+
+
+
+
+
获取ReadingCalculateDto
@@ -1463,7 +1472,7 @@
{
疗效为 ND
}
- else if (任一病灶从非“存在”状态改为“存在”状态)
+ else if (存在状态为“明确”的其它既往新病灶)
{
疗效为 iUPD
}
@@ -2303,6 +2312,15 @@
+
+
+ 添加计算错误日志
+
+
+
+
+
+
自动计算 并修改值
@@ -7589,9 +7607,9 @@
所有状态为消失
-
+
- 当任一病灶从非“存在”状态改为“存在”状态
+ 存在明确状态
diff --git a/IRaCIS.Core.Application/Service/ReadingCalculate/Dto/CriterionCalculateDto.cs b/IRaCIS.Core.Application/Service/ReadingCalculate/Dto/CriterionCalculateDto.cs
index c7f2c9b26..8841115eb 100644
--- a/IRaCIS.Core.Application/Service/ReadingCalculate/Dto/CriterionCalculateDto.cs
+++ b/IRaCIS.Core.Application/Service/ReadingCalculate/Dto/CriterionCalculateDto.cs
@@ -220,9 +220,9 @@ namespace IRaCIS.Core.Application.ViewModel
public bool AllVanish { get; set; }
///
- /// 当任一病灶从非“存在”状态改为“存在”状态
+ /// 存在明确状态
///
- public bool LastTaskNoExists { get; set; }
+ public bool ExistsClear { get; set; }
///
/// 至少有一个病灶无法评估
diff --git a/IRaCIS.Core.Application/Service/ReadingCalculate/General/GeneralCalculateService.cs b/IRaCIS.Core.Application/Service/ReadingCalculate/General/GeneralCalculateService.cs
index 258dcf6f1..94f8b0ab5 100644
--- a/IRaCIS.Core.Application/Service/ReadingCalculate/General/GeneralCalculateService.cs
+++ b/IRaCIS.Core.Application/Service/ReadingCalculate/General/GeneralCalculateService.cs
@@ -2,6 +2,7 @@
using IRaCIS.Core.Domain.Share;
using IRaCIS.Core.Infra.EFCore.Common;
using MassTransit;
+using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -16,6 +17,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
private readonly IRepository _readingTableQuestionAnswerRepository;
private readonly IRepository _visitTaskRepository;
private readonly IRepository _readingQuestionCriterionTrialRepository;
+ private readonly ILogger _logger;
private readonly IRepository _readingTableQuestionTrialRepository;
private readonly IRepository _readingTableAnswerRowInfoRepository;
private readonly IRepository _readingQuestionTrialRepository;
@@ -26,7 +28,8 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
public GeneralCalculateService(
IRepository readingTableQuestionAnswerRepository,
IRepository visitTaskRepository,
- IRepository readingQuestionCriterionTrialRepository,
+ IRepository readingQuestionCriterionTrialRepository,
+ ILogger logger,
IRepository readingTableQuestionTrialRepository,
IRepository readingTableAnswerRowInfoRepository,
IRepository readingQuestionTrialRepository,
@@ -38,6 +41,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
this._readingTableQuestionAnswerRepository = readingTableQuestionAnswerRepository;
this._visitTaskRepository = visitTaskRepository;
this._readingQuestionCriterionTrialRepository = readingQuestionCriterionTrialRepository;
+ this._logger = logger;
this._readingTableQuestionTrialRepository = readingTableQuestionTrialRepository;
this._readingTableAnswerRowInfoRepository = readingTableAnswerRowInfoRepository;
this._readingQuestionTrialRepository = readingQuestionTrialRepository;
@@ -46,6 +50,52 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
this._readingTaskQuestionAnswerRepository = readingTaskQuestionAnswerRepository;
}
+ ///
+ /// 添加计算错误日志
+ ///
+ ///
+ ///
+ ///
+ ///
+ public async Task LogRecord(ReadingCalculateDto inDto,string lesionName, LesionType lesionType)
+ {
+ // 这里是记录日志 不需要国际化
+ var criterionInfo =await _readingQuestionCriterionTrialRepository.Where(x => x.Id == inDto.TrialReadingCriterionId).Include(x => x.Trial).FirstNotNullAsync();
+ var taskInfo= await _visitTaskRepository.Where(x=>x.Id==inDto.VisitTaskId).Include(x=>x.Subject).Include(x=>x.DoctorUser).FirstNotNullAsync();
+
+ //错误级别日志:项目、标准、受试者、阅片人、任务。输出其它既往新病灶数据:
+
+ StringBuilder builder = new StringBuilder();
+ builder.AppendLine($"");
+ builder.AppendLine($"【项目】:【{criterionInfo.Trial.TrialCode}】");
+ builder.AppendLine($"【项目Id】:【{criterionInfo.TrialId}】");
+ builder.AppendLine($"【标准】:【{criterionInfo.CriterionName}】");
+ builder.AppendLine($"【标准Id】:【{criterionInfo.Id}】");
+ builder.AppendLine($"【受试者】:【{taskInfo.Subject.ShortName}】");
+ builder.AppendLine($"【受试者Id】:【{taskInfo.Subject.Id}】");
+ builder.AppendLine($"【阅片人】:【{taskInfo.DoctorUser.FirstName}】");
+ builder.AppendLine($"【阅片人Id】:【{taskInfo.DoctorUser.Id}】");
+ builder.AppendLine($"【任务】:【{taskInfo.TaskBlindName}】");
+ builder.AppendLine($"【任务Id】:【{taskInfo.Id}】");
+ builder.AppendLine($"【病灶类型】:【{lesionName}】");
+
+ var lesionInfo = inDto.QuestionInfo.Where(x => x.LesionType == lesionType).FirstOrDefault();
+ if (lesionInfo != null)
+ {
+ lesionInfo.TableRowInfoList.OrderBy(x => x.RowIndex).ForEach(x =>
+ {
+ builder.AppendLine(@$"【病灶编号】:【{x.RowIndex.ToString()}】,
+ 【病灶长径】:【{x.TableQuestionList.Where(y=>y.QuestionMark==QuestionMark.MajorAxis).Select(y=>y.Answer).FirstIsNullReturnEmpty()}】,
+ 【病灶短径】:【{x.TableQuestionList.Where(y => y.QuestionMark == QuestionMark.ShortAxis).Select(y => y.Answer).FirstIsNullReturnEmpty()}】,
+ 【病灶状态】:【{x.TableQuestionList.Where(y => y.QuestionMark == QuestionMark.State).Select(y => y.Answer).FirstIsNullReturnEmpty()}】");
+
+ });
+ }
+
+ _logger.LogError(builder.ToString());
+ }
+
+
///
/// 获取ReadingCalculateDto
///
diff --git a/IRaCIS.Core.Application/Service/ReadingCalculate/IRECIST1Point1CalculateService.cs b/IRaCIS.Core.Application/Service/ReadingCalculate/IRECIST1Point1CalculateService.cs
index 9116e307c..448ba7687 100644
--- a/IRaCIS.Core.Application/Service/ReadingCalculate/IRECIST1Point1CalculateService.cs
+++ b/IRaCIS.Core.Application/Service/ReadingCalculate/IRECIST1Point1CalculateService.cs
@@ -2,13 +2,12 @@
using IRaCIS.Core.Domain.Share;
using Microsoft.AspNetCore.Mvc;
using IRaCIS.Core.Domain.Models;
-using Microsoft.AspNetCore.Mvc;
using IRaCIS.Core.Application.Interfaces;
using IRaCIS.Core.Application.ViewModel;
using Panda.DynamicWebApi.Attributes;
using IRaCIS.Core.Infra.EFCore.Common;
using Microsoft.Extensions.Caching.Memory;
-
+using Microsoft.Extensions.Logging;
using IRaCIS.Core.Infrastructure;
using MassTransit;
using System.Linq;
@@ -30,6 +29,9 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
private readonly IRepository _tumorAssessmentRepository;
private readonly IGeneralCalculateService _generalCalculateService;
private readonly IRepository _readingTaskQuestionAnswerRepository;
+ private readonly ILogger _logger;
+
+
public IRECIST1Point1CalculateService(
IRepository readingTableQuestionAnswerRepository,
@@ -42,6 +44,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
IRepository subjectVisitRepository,
IRepository tumorAssessmentRepository,
IGeneralCalculateService generalCalculateService,
+ ILogger logger,
IRepository readingTaskQuestionAnswerRepository
)
{
@@ -56,6 +59,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
this._tumorAssessmentRepository = tumorAssessmentRepository;
this._generalCalculateService = generalCalculateService;
this._readingTaskQuestionAnswerRepository = readingTaskQuestionAnswerRepository;
+ this._logger = logger;
}
#region 临时对象 单个请求的生命周期 避免重复查询数据库
@@ -392,7 +396,10 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
[HttpPost]
public async Task TestCalculate(Guid visitTaskId, QuestionType type)
{
+ //_logger.LogError("测试计算");
ReadingCalculateDto readingData = await _generalCalculateService.GetReadingCalculateDto(visitTaskId);
+ // await _generalCalculateService.LogRecord(readingData, "其他既往新病灶", LesionType.OtherPreviousNewLesion);
+
await ReadingCalculate(readingData,new List() { type});
}
@@ -2022,6 +2029,10 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
/// {
/// 疗效为 NE
/// }
+ /// else
+ ///{
+ /// //错误级别日志:项目、标准、受试者、阅片人、任务。输出新靶病灶数据:
+ ///}
///
///
///
@@ -2122,6 +2133,12 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
// 疗效为 NE
result = NewTargetLesionAssessment.NE;
}
+ else
+ {
+ //错误级别日志:项目、标准、受试者、阅片人、任务。输出新靶病灶数据:
+ await _generalCalculateService.LogRecord(inDto, "新靶病灶", LesionType.NewTargetLesion);
+
+ }
return result==null?string.Empty: result.Value.GetEnumInt();
}
@@ -2152,6 +2169,10 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
/// {
/// 疗效为 NE
/// }
+ /// else
+ /// {
+ /// //错误级别日志:项目、标准、受试者、阅片人、任务。当前新非靶病灶的病灶数据输出:
+ /// }
///
///
///
@@ -2218,6 +2239,11 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
{
// 疗效为 NE
result = NewNoTargetLesionAssessment.NE;
+ }
+ else
+ {
+ // 错误级别日志:项目、标准、受试者、阅片人、任务。当前新非靶病灶的病灶数据输出:
+ await _generalCalculateService.LogRecord(inDto, "新非靶病灶", LesionType.NewNonTargetLesion);
}
return result.GetEnumInt();
@@ -2233,7 +2259,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
/// {
/// 疗效为 ND
/// }
- /// else if (任一病灶从非“存在”状态改为“存在”状态)
+ /// else if (存在状态为“明确”的其它既往新病灶)
/// {
/// 疗效为 iUPD
/// }
@@ -2245,6 +2271,10 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
/// {
/// 疗效为 疑似
/// }
+ /// else
+ /// {
+ /// //错误级别日志:项目、标准、受试者、阅片人、任务。输出其它既往新病灶数据:
+ /// }
///
///
///
@@ -2254,23 +2284,16 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
var lastVisitTaskId = await GetLastVisitTaskId(inDto);
-
- // 找上一次任务 未被评为显著增大的非靶病灶
- ReadingCalculateDto lastTaskCalculateDto = await _generalCalculateService.GetReadingCalculateDto(lastVisitTaskId);
-
- var lastTaskNoExistIndexs = lastTaskCalculateDto.QuestionInfo.Where(x => x.LesionType == LesionType.OtherPreviousNewLesion).SelectMany(x => x.TableRowInfoList)
- .Where(x => x.TableQuestionList.Any(x => x.QuestionMark == QuestionMark.State && !x.Answer.EqEnum(OtherPreviousNewLesionState.Exists))).Select(x => x.RowIndex).ToList();
-
IRECISTOtherNewTargetLesionDto data = new IRECISTOtherNewTargetLesionDto()
{
- // 不存在其他既往新病灶
+ // 不存在其他既往新病灶记录
NotExistsOtherNewTargetLesion = tableQuestion.Count() == 0,
- // 所有状态为消失
+ // 所有其他既往新病灶状态都为消失
AllVanish = tableQuestion.Count() == tableQuestion.Where(x => x.TableQuestionList.Any(x => x.QuestionMark == QuestionMark.State && x.Answer.EqEnum(OtherPreviousNewLesionState.Loss))).Count(),
- // 当任一病灶从非“存在”状态改为“存在”状态
- LastTaskNoExists = tableQuestion.Where(x => lastTaskNoExistIndexs.Contains(x.RowIndex)).SelectMany(x => x.TableQuestionList).Any(x => x.QuestionMark == QuestionMark.State && x.Answer.EqEnum(OtherPreviousNewLesionState.Exists)),
+ // 存在“明确”状态
+ ExistsClear = tableQuestion.SelectMany(x => x.TableQuestionList).Any(x => x.QuestionMark == QuestionMark.State && x.Answer.EqEnum(OtherPreviousNewLesionState.Exists)),
// 至少有一个病灶无法评估
ExixtsUnevaluableState = tableQuestion.SelectMany(x => x.TableQuestionList).Any(x => x.QuestionMark == QuestionMark.State && x.Answer.EqEnum(OtherPreviousNewLesionState.NotEvaluable)),
@@ -2288,8 +2311,8 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
// 疗效为 ND
result = OtherPreviousNewLesionAssessment.ND;
}
- // else if (任一病灶从非“存在”状态改为“存在”状态)
- else if (data.LastTaskNoExists)
+ // else if (存在状态为“明确”的其它既往新病灶)
+ else if (data.ExistsClear)
{
// 疗效为 iUPD
result = OtherPreviousNewLesionAssessment.iUPD;
@@ -2306,6 +2329,11 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
// 疗效为 疑似
result = OtherPreviousNewLesionAssessment.Equivocal;
}
+ else
+ {
+ //错误级别日志:项目、标准、受试者、阅片人、任务。输出其它既往新病灶数据:
+ await _generalCalculateService.LogRecord(inDto, "其它既往新病灶", LesionType.OtherPreviousNewLesion);
+ }
return result.GetEnumInt();
@@ -2419,6 +2447,10 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
/// {
/// 疗效为 疑似
/// }
+ /// else
+ /// {
+ /// //错误级别日志:项目、标准、受试者、阅片人、任务。输出新病灶数据:
+ /// }
///
///
///
@@ -2533,7 +2565,34 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
// 疗效为 疑似
result = NewLesionAssessment.Suspected;
}
+ else
+ {
+ //错误级别日志:项目、标准、受试者、阅片人、任务。输出新病灶数据:
+ // 这里是记录日志 不需要国际化
+ var criterionInfo = await _readingQuestionCriterionTrialRepository.Where(x => x.Id == inDto.TrialReadingCriterionId).Include(x => x.Trial).FirstNotNullAsync();
+ var taskInfo = await _visitTaskRepository.Where(x => x.Id == inDto.VisitTaskId).Include(x => x.Subject).Include(x => x.DoctorUser).FirstNotNullAsync();
+ StringBuilder builder = new StringBuilder();
+ builder.AppendLine($"");
+ builder.AppendLine($"【项目】:【{criterionInfo.Trial.TrialCode}】");
+ builder.AppendLine($"【项目Id】:【{criterionInfo.TrialId}】");
+ builder.AppendLine($"【标准】:【{criterionInfo.CriterionName}】");
+ builder.AppendLine($"【标准Id】:【{criterionInfo.Id}】");
+ builder.AppendLine($"【受试者】:【{taskInfo.Subject.ShortName}】");
+ builder.AppendLine($"【受试者Id】:【{taskInfo.Subject.Id}】");
+ builder.AppendLine($"【阅片人】:【{taskInfo.DoctorUser.FirstName}】");
+ builder.AppendLine($"【阅片人Id】:【{taskInfo.DoctorUser.Id}】");
+ builder.AppendLine($"【任务】:【{taskInfo.TaskBlindName}】");
+ builder.AppendLine($"【任务Id】:【{taskInfo.Id}】");
+ builder.AppendLine($"【病灶类型】:【新病灶】");
+ builder.AppendLine($"【新靶病灶评估】:【{inDto.QuestionInfo.Where(x => x.QuestionType == QuestionType.NewTargetLesion).Select(x=>x.Answer).FirstIsNullReturnEmpty()}】");
+ builder.AppendLine($"【新非靶病灶评估】:【{inDto.QuestionInfo.Where(x => x.QuestionType == QuestionType.NewNoTargetLesion).Select(x => x.Answer).FirstIsNullReturnEmpty()}】");
+ builder.AppendLine($"【其它既往新病灶评估】:【{inDto.QuestionInfo.Where(x => x.QuestionType == QuestionType.OtherNewTargetLesion).Select(x => x.Answer).FirstIsNullReturnEmpty()}】");
+ builder.AppendLine($"【触发iRECIST后新病灶评估】:【{inDto.QuestionInfo.Where(x => x.QuestionType == QuestionType.IRECISTNewTargetLesion).Select(x => x.Answer).FirstIsNullReturnEmpty()}】");
+ _logger.LogError(builder.ToString());
+ )
+
+ }
return result == null ? string.Empty : ((NewLesionAssessment)result).GetEnumInt();
}
@@ -2671,6 +2730,10 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
/// {
/// 疗效为 NE
/// }
+ /// else
+ /// {
+ /// //错误级别日志:项目、标准、受试者、阅片人、任务。输出靶病灶、非靶病灶、新病灶的评估结果:
+ /// }
///
///
///
@@ -2895,6 +2958,30 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
// 疗效为 NE
result = OverallAssessment.NE;
}
+ else
+ {
+ //错误级别日志:项目、标准、受试者、阅片人、任务。输出靶病灶、非靶病灶、新病灶的评估结果:
+ // 这里是记录日志 不需要国际化
+ var criterionInfo = await _readingQuestionCriterionTrialRepository.Where(x => x.Id == inDto.TrialReadingCriterionId).Include(x => x.Trial).FirstNotNullAsync();
+ var taskInfo = await _visitTaskRepository.Where(x => x.Id == inDto.VisitTaskId).Include(x => x.Subject).Include(x => x.DoctorUser).FirstNotNullAsync();
+ StringBuilder builder = new StringBuilder();
+ builder.AppendLine($"");
+ builder.AppendLine($"【项目】:【{criterionInfo.Trial.TrialCode}】");
+ builder.AppendLine($"【项目Id】:【{criterionInfo.TrialId}】");
+ builder.AppendLine($"【标准】:【{criterionInfo.CriterionName}】");
+ builder.AppendLine($"【标准Id】:【{criterionInfo.Id}】");
+ builder.AppendLine($"【受试者】:【{taskInfo.Subject.ShortName}】");
+ builder.AppendLine($"【受试者Id】:【{taskInfo.Subject.Id}】");
+ builder.AppendLine($"【阅片人】:【{taskInfo.DoctorUser.FirstName}】");
+ builder.AppendLine($"【阅片人Id】:【{taskInfo.DoctorUser.Id}】");
+ builder.AppendLine($"【任务】:【{taskInfo.TaskBlindName}】");
+ builder.AppendLine($"【任务Id】:【{taskInfo.Id}】");
+ builder.AppendLine($"【病灶类型】:【新病灶】");
+ builder.AppendLine($"【靶病灶评估】:【{inDto.QuestionInfo.Where(x => x.QuestionType == QuestionType.TargetLesion).Select(x => x.Answer).FirstIsNullReturnEmpty()}】");
+ builder.AppendLine($"【非靶病灶评估】:【{inDto.QuestionInfo.Where(x => x.QuestionType == QuestionType.NoTargetLesion).Select(x => x.Answer).FirstIsNullReturnEmpty()}】");
+ builder.AppendLine($"【新病灶评估】:【{inDto.QuestionInfo.Where(x => x.QuestionType == QuestionType.NewLesionEvaluation).Select(x => x.Answer).FirstIsNullReturnEmpty()}】");
+ _logger.LogError(builder.ToString());
+ }
return result == null ? string.Empty : ((OverallAssessment)result).GetEnumInt();
}
diff --git a/IRaCIS.Core.Application/Service/ReadingCalculate/Interface/IGeneralCalculateService.cs b/IRaCIS.Core.Application/Service/ReadingCalculate/Interface/IGeneralCalculateService.cs
index 15c06d6d6..a3f1bd3df 100644
--- a/IRaCIS.Core.Application/Service/ReadingCalculate/Interface/IGeneralCalculateService.cs
+++ b/IRaCIS.Core.Application/Service/ReadingCalculate/Interface/IGeneralCalculateService.cs
@@ -1,4 +1,5 @@
using IRaCIS.Core.Application.Service.Reading.Dto;
+using IRaCIS.Core.Domain.Share;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -31,5 +32,14 @@ namespace IRaCIS.Core.Application.Service
///
///
Task AddConvertedTaskFocus(Guid visitTaskId, Guid beforeConvertedTaskId);
+
+ ///
+ /// 添加计算错误日志
+ ///
+ ///
+ ///
+ ///
+ ///
+ Task LogRecord(ReadingCalculateDto inDto, string lesionName, LesionType lesionType);
}
}