PCWG修改
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
parent
0e93894ed8
commit
541e000183
|
|
@ -5594,11 +5594,26 @@
|
||||||
<param name="inDto"></param>
|
<param name="inDto"></param>
|
||||||
<returns></returns>
|
<returns></returns>
|
||||||
</member>
|
</member>
|
||||||
<member name="M:IRaCIS.Core.Application.Service.ReadingCalculate.PCWG3CalculateService.ChangeLastTaskSiteVisitForTumorEvaluation(IRaCIS.Core.Application.Service.Reading.Dto.ReadingCalculateDto)">
|
<member name="M:IRaCIS.Core.Application.Service.ReadingCalculate.PCWG3CalculateService.GetSiteVisitForTumorEvaluationByDay(IRaCIS.Core.Application.Service.Reading.Dto.ReadingCalculateDto,System.Nullable{System.Int32})">
|
||||||
<summary>
|
<summary>
|
||||||
修改上一次访视结果
|
获取肿瘤评估 逻辑抽离 这里还要返回上一次的结果
|
||||||
</summary>
|
</summary>
|
||||||
<param name="inDto"></param>
|
<param name="inDto"></param>
|
||||||
|
<param name="daysBetween"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
|
<member name="M:IRaCIS.Core.Application.Service.ReadingCalculate.PCWG3CalculateService.FrontGetSiteVisitForTumorEvaluation(IRaCIS.Core.Application.Service.Reading.Dto.FrontGetSiteVisitForTumorEvaluationInDto)">
|
||||||
|
<summary>
|
||||||
|
前端获取访视点肿瘤评估
|
||||||
|
</summary>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
|
<member name="M:IRaCIS.Core.Application.Service.ReadingCalculate.PCWG3CalculateService.ChangeLastTaskSiteVisitForTumorEvaluation(IRaCIS.Core.Application.Service.Reading.Dto.ReadingCalculateDto,System.Nullable{System.Int32})">
|
||||||
|
<summary>
|
||||||
|
修改上一次访视结果 并且计算是不是PD
|
||||||
|
</summary>
|
||||||
|
<param name="inDto"></param>
|
||||||
|
<param name="numOfDaysBetween"></param>
|
||||||
<returns></returns>
|
<returns></returns>
|
||||||
</member>
|
</member>
|
||||||
<member name="M:IRaCIS.Core.Application.Service.ReadingCalculate.PCWG3CalculateService.GetSiteVisitForTumorList(IRaCIS.Core.Application.Service.Reading.Dto.ReadingCalculateDto)">
|
<member name="M:IRaCIS.Core.Application.Service.ReadingCalculate.PCWG3CalculateService.GetSiteVisitForTumorList(IRaCIS.Core.Application.Service.Reading.Dto.ReadingCalculateDto)">
|
||||||
|
|
|
||||||
|
|
@ -308,6 +308,43 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
|
||||||
public string OverallEfficacy { get; set; }
|
public string OverallEfficacy { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class FrontGetSiteVisitForTumorEvaluationInDto
|
||||||
|
{
|
||||||
|
public Guid VisitTaskId { get; set; }
|
||||||
|
public int NumberOfDaysBetween { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class FrontGetSiteVisitForTumorEvaluationOutDto
|
||||||
|
{
|
||||||
|
public List<FrontGetSiteVisitForTumor> ResultList { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class FrontGetSiteVisitForTumor
|
||||||
|
{
|
||||||
|
public Guid VisitTaskId { get; set; }
|
||||||
|
|
||||||
|
public string TumorEvaluationResult { get; set; } = string.Empty;
|
||||||
|
}
|
||||||
|
|
||||||
|
public class PCWGSiteVisitForTumor
|
||||||
|
{
|
||||||
|
public bool IsPD { get; set; }
|
||||||
|
|
||||||
|
public string? LastTaskResult { get; set; }
|
||||||
|
|
||||||
|
public Guid? LastTaskId { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class SiteVisitForTumorEvaluationByDayOutDto
|
||||||
|
{
|
||||||
|
public string Result { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
public string? LastTaskResult { get; set; }
|
||||||
|
|
||||||
|
public Guid? LastTaskId { get; set; }
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 阅片计算Dto
|
/// 阅片计算Dto
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
@ -385,6 +422,7 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Answer { get; set; }
|
public string Answer { get; set; }
|
||||||
|
|
||||||
|
public string? PCWGInterimAnswer { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 问题名称
|
/// 问题名称
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
||||||
|
|
@ -3888,6 +3888,24 @@ namespace IRaCIS.Core.Application.Service
|
||||||
private async Task SubmitTaskChangeState(Guid visitTaskId)
|
private async Task SubmitTaskChangeState(Guid visitTaskId)
|
||||||
{
|
{
|
||||||
await VerifyTaskIsSign(visitTaskId);
|
await VerifyTaskIsSign(visitTaskId);
|
||||||
|
|
||||||
|
var taskInfo=await _visitTaskRepository.Where(x => x.Id == visitTaskId).Include(x=>x.TrialReadingCriterion).FirstNotNullAsync();
|
||||||
|
// 如果是PCGW标准 则把中间答案赋值给正式答案
|
||||||
|
if (taskInfo.TrialReadingCriterion.CriterionType == CriterionType.PCWG3)
|
||||||
|
{
|
||||||
|
var answerList = await _readingTaskQuestionAnswerRepository.Where(x => x.VisitTask.TaskState==TaskState.Effect&& x.VisitTask.SubjectId == taskInfo.SubjectId && x.VisitTask.ArmEnum == taskInfo.ArmEnum && x.PCWGInterimAnswer != null).ToListAsync();
|
||||||
|
|
||||||
|
foreach (var item in answerList)
|
||||||
|
{
|
||||||
|
await _readingTaskQuestionAnswerRepository.BatchUpdateNoTrackingAsync(x=>x.Id==item.Id, x => new ReadingTaskQuestionAnswer()
|
||||||
|
{
|
||||||
|
//这里已经筛选过 不为null了
|
||||||
|
Answer = item.PCWGInterimAnswer,
|
||||||
|
PCWGInterimAnswer = null,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
await _visitTaskRepository.UpdatePartialFromQueryAsync(visitTaskId, x => new VisitTask()
|
await _visitTaskRepository.UpdatePartialFromQueryAsync(visitTaskId, x => new VisitTask()
|
||||||
{
|
{
|
||||||
ReadingTaskState = ReadingTaskState.HaveSigned,
|
ReadingTaskState = ReadingTaskState.HaveSigned,
|
||||||
|
|
|
||||||
|
|
@ -198,7 +198,8 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||||
var questionAnswers = await _readingTaskQuestionAnswerRepository.Where(x => x.VisitTaskId == visitTaskId).Select(x => new
|
var questionAnswers = await _readingTaskQuestionAnswerRepository.Where(x => x.VisitTaskId == visitTaskId).Select(x => new
|
||||||
{
|
{
|
||||||
x.ReadingQuestionTrialId,
|
x.ReadingQuestionTrialId,
|
||||||
x.Answer
|
x.Answer,
|
||||||
|
x.PCWGInterimAnswer,
|
||||||
}).ToListAsync();
|
}).ToListAsync();
|
||||||
|
|
||||||
var tableQuestion = await _readingTableQuestionAnswerRepository.Where(x => x.VisitTaskId == 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()
|
||||||
|
|
@ -217,7 +218,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||||
{
|
{
|
||||||
item.Answer = questionAnswers.Where(y => y.ReadingQuestionTrialId == item.QuestionId).Select(x => x.Answer).FirstOrDefault() ?? string.Empty;
|
item.Answer = questionAnswers.Where(y => y.ReadingQuestionTrialId == item.QuestionId).Select(x => x.Answer).FirstOrDefault() ?? string.Empty;
|
||||||
|
|
||||||
|
item.PCWGInterimAnswer = questionAnswers.Where(y => y.ReadingQuestionTrialId == item.QuestionId).Select(x => x.PCWGInterimAnswer).FirstOrDefault();
|
||||||
var thisItemRowInfo = rowInfoList.Where(x => x.QuestionId == item.QuestionId).ToList();
|
var thisItemRowInfo = rowInfoList.Where(x => x.QuestionId == item.QuestionId).ToList();
|
||||||
|
|
||||||
var thisItemTableQuestions = tableQuestion.Where(x => x.QuestionId == item.QuestionId).ToList();
|
var thisItemTableQuestions = tableQuestion.Where(x => x.QuestionId == item.QuestionId).ToList();
|
||||||
|
|
|
||||||
|
|
@ -110,6 +110,14 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||||
var answers = await _readingTaskQuestionAnswerRepository.Where(x => visitTaskIds.Contains(x.VisitTaskId))
|
var answers = await _readingTaskQuestionAnswerRepository.Where(x => visitTaskIds.Contains(x.VisitTaskId))
|
||||||
.Where(x => x.ReadingQuestionTrialId != questionNewLesions.Id || x.VisitTaskId == visitTaskInfo.Id)
|
.Where(x => x.ReadingQuestionTrialId != questionNewLesions.Id || x.VisitTaskId == visitTaskInfo.Id)
|
||||||
.ToListAsync();
|
.ToListAsync();
|
||||||
|
|
||||||
|
if (visitTaskInfo.ReadingTaskState != ReadingTaskState.HaveSigned)
|
||||||
|
{
|
||||||
|
foreach (var item in answers)
|
||||||
|
{
|
||||||
|
item.Answer = item.PCWGInterimAnswer == null ? item.Answer : item.PCWGInterimAnswer;
|
||||||
|
}
|
||||||
|
}
|
||||||
var tableAnswers = await _readingTableQuestionAnswerRepository.Where(x => visitTaskIds.Contains(x.VisitTaskId))
|
var tableAnswers = await _readingTableQuestionAnswerRepository.Where(x => visitTaskIds.Contains(x.VisitTaskId))
|
||||||
.Where(x => x.QuestionId != questionNewLesions.Id || x.VisitTaskId == visitTaskInfo.Id)
|
.Where(x => x.QuestionId != questionNewLesions.Id || x.VisitTaskId == visitTaskInfo.Id)
|
||||||
.ToListAsync();
|
.ToListAsync();
|
||||||
|
|
@ -500,6 +508,14 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||||
public async Task TestCalculate(Guid visitTaskId, QuestionType type)
|
public async Task TestCalculate(Guid visitTaskId, QuestionType type)
|
||||||
{
|
{
|
||||||
ReadingCalculateDto readingData = await _generalCalculateService.GetReadingCalculateDto(visitTaskId);
|
ReadingCalculateDto readingData = await _generalCalculateService.GetReadingCalculateDto(visitTaskId);
|
||||||
|
// 只获取当前的 不会获取上一次临时修改的结果
|
||||||
|
foreach (var item in readingData.QuestionInfo)
|
||||||
|
{
|
||||||
|
if (item.PCWGInterimAnswer != null)
|
||||||
|
{
|
||||||
|
item.Answer = item.PCWGInterimAnswer;
|
||||||
|
}
|
||||||
|
}
|
||||||
await ReadingCalculate(readingData, new List<QuestionType>() { type });
|
await ReadingCalculate(readingData, new List<QuestionType>() { type });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -512,6 +528,14 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||||
public async Task CalculateTask(CalculateTaskInDto inDto)
|
public async Task CalculateTask(CalculateTaskInDto inDto)
|
||||||
{
|
{
|
||||||
ReadingCalculateDto readingData = await _generalCalculateService.GetReadingCalculateDto(inDto.VisitTaskId);
|
ReadingCalculateDto readingData = await _generalCalculateService.GetReadingCalculateDto(inDto.VisitTaskId);
|
||||||
|
// 只获取当前的 不会获取上一次临时修改的结果
|
||||||
|
foreach (var item in readingData.QuestionInfo)
|
||||||
|
{
|
||||||
|
if (item.PCWGInterimAnswer != null)
|
||||||
|
{
|
||||||
|
item.Answer = item.PCWGInterimAnswer;
|
||||||
|
}
|
||||||
|
}
|
||||||
readingData.IsChangeOtherTask = inDto.IsChangeOtherTask;
|
readingData.IsChangeOtherTask = inDto.IsChangeOtherTask;
|
||||||
await ReadingCalculate(readingData);
|
await ReadingCalculate(readingData);
|
||||||
}
|
}
|
||||||
|
|
@ -831,123 +855,278 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public async Task<string> GetSiteVisitForTumorEvaluation(ReadingCalculateDto inDto)
|
public async Task<string> GetSiteVisitForTumorEvaluation(ReadingCalculateDto inDto)
|
||||||
{
|
{
|
||||||
|
return (await GetSiteVisitForTumorEvaluationByDay(inDto)).Result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取肿瘤评估 逻辑抽离 这里还要返回上一次的结果
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="inDto"></param>
|
||||||
|
/// <param name="daysBetween"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public async Task<SiteVisitForTumorEvaluationByDayOutDto> GetSiteVisitForTumorEvaluationByDay(ReadingCalculateDto inDto, int? daysBetween = null)
|
||||||
|
{
|
||||||
|
SiteVisitForTumorEvaluationByDayOutDto result = new SiteVisitForTumorEvaluationByDayOutDto();
|
||||||
if (inDto.IsBaseLine)
|
if (inDto.IsBaseLine)
|
||||||
{
|
{
|
||||||
return VisitTumorEvaluation.NA.GetEnumInt();
|
result.Result = VisitTumorEvaluation.NA.GetEnumInt();
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
//如果日期未知,不需要计算肿瘤评估结果;
|
//如果日期未知,不需要计算肿瘤评估结果;
|
||||||
if (await GetNumberOfDaysBetween(inDto) == -1)
|
if (await GetNumberOfDaysBetween(inDto) == -1)
|
||||||
{
|
{
|
||||||
return string.Empty;
|
result.Result = string.Empty;
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
var isPD = await ChangeLastTaskSiteVisitForTumorEvaluation(inDto);
|
if (inDto.QuestionInfo.Any(x => x.QuestionType == QuestionType.ImageQualityAssessment && x.Answer == ImageQualityEvaluation.Abnormal.GetEnumInt()))
|
||||||
|
{
|
||||||
|
//影像质量不正常
|
||||||
|
result.Result = VisitTumorEvaluation.NE.GetEnumInt();
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
var pdResult = await ChangeLastTaskSiteVisitForTumorEvaluation(inDto, daysBetween);
|
||||||
|
|
||||||
|
// 这里为什么要这样写 因为要把上一次的也返回前端去 前端要修改
|
||||||
|
result.LastTaskResult = pdResult.LastTaskResult;
|
||||||
|
result.LastTaskId = pdResult.LastTaskId;
|
||||||
|
|
||||||
var newLesionsCount = inDto.QuestionInfo.Where(x => x.QuestionType == QuestionType.NewLesionsCount).Select(x => x.Answer).FirstOrDefault().IsNullOrEmptyReturn0();
|
var newLesionsCount = inDto.QuestionInfo.Where(x => x.QuestionType == QuestionType.NewLesionsCount).Select(x => x.Answer).FirstOrDefault().IsNullOrEmptyReturn0();
|
||||||
var baseLineLesionsCount = inDto.QuestionInfo.Where(x => x.QuestionType == QuestionType.BaseLineLesionsCount).Select(x => x.Answer).FirstOrDefault().IsNullOrEmptyReturn0();
|
var baseLineLesionsCount = inDto.QuestionInfo.Where(x => x.QuestionType == QuestionType.BaseLineLesionsCount).Select(x => x.Answer).FirstOrDefault().IsNullOrEmptyReturn0();
|
||||||
var alwaysNewLesionsCount = inDto.QuestionInfo.Where(x => x.QuestionType == QuestionType.AlwaysNewLesionsCount).Select(x => x.Answer).FirstOrDefault().IsNullOrEmptyReturn0();
|
var alwaysNewLesionsCount = inDto.QuestionInfo.Where(x => x.QuestionType == QuestionType.AlwaysNewLesionsCount).Select(x => x.Answer).FirstOrDefault().IsNullOrEmptyReturn0();
|
||||||
|
|
||||||
if (isPD)
|
if (pdResult.IsPD)
|
||||||
{
|
{
|
||||||
return VisitTumorEvaluation.PD.GetEnumInt();
|
result.Result = VisitTumorEvaluation.PD.GetEnumInt();
|
||||||
}
|
}
|
||||||
else if (newLesionsCount == 0 &&
|
else if (newLesionsCount == 0 &&
|
||||||
baseLineLesionsCount == 0 &&
|
baseLineLesionsCount == 0 &&
|
||||||
alwaysNewLesionsCount == 0)
|
alwaysNewLesionsCount == 0)
|
||||||
{
|
{
|
||||||
return VisitTumorEvaluation.ND.GetEnumInt();
|
result.Result = VisitTumorEvaluation.ND.GetEnumInt();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return VisitTumorEvaluation.NoPD.GetEnumInt();
|
result.Result = VisitTumorEvaluation.NoPD.GetEnumInt();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 修改上一次访视结果
|
/// 前端获取访视点肿瘤评估
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpPost]
|
||||||
|
public async Task<FrontGetSiteVisitForTumorEvaluationOutDto> FrontGetSiteVisitForTumorEvaluation(FrontGetSiteVisitForTumorEvaluationInDto inDto)
|
||||||
|
{
|
||||||
|
ReadingCalculateDto readingData = await _generalCalculateService.GetReadingCalculateDto(inDto.VisitTaskId);
|
||||||
|
// 只获取当前的 不会获取上一次临时修改的结果
|
||||||
|
foreach (var item in readingData.QuestionInfo)
|
||||||
|
{
|
||||||
|
if (item.PCWGInterimAnswer != null)
|
||||||
|
{
|
||||||
|
item.Answer = item.PCWGInterimAnswer;
|
||||||
|
}
|
||||||
|
if (item.QuestionType == QuestionType.DaysBetween)
|
||||||
|
{
|
||||||
|
item.Answer = inDto.NumberOfDaysBetween.ToString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
FrontGetSiteVisitForTumorEvaluationOutDto result = new FrontGetSiteVisitForTumorEvaluationOutDto();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
var tumorEvaluation = await GetSiteVisitForTumorEvaluationByDay(readingData, inDto.NumberOfDaysBetween);
|
||||||
|
|
||||||
|
result.ResultList = new List<FrontGetSiteVisitForTumor>() {
|
||||||
|
new FrontGetSiteVisitForTumor(){
|
||||||
|
VisitTaskId=inDto.VisitTaskId,
|
||||||
|
TumorEvaluationResult=tumorEvaluation.Result,
|
||||||
|
}
|
||||||
|
};
|
||||||
|
if (tumorEvaluation.LastTaskResult != null && tumorEvaluation.LastTaskId != null)
|
||||||
|
{
|
||||||
|
result.ResultList.Add(new FrontGetSiteVisitForTumor()
|
||||||
|
{
|
||||||
|
VisitTaskId = tumorEvaluation.LastTaskId.Value,
|
||||||
|
TumorEvaluationResult = tumorEvaluation.LastTaskResult,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 修改上一次访视结果 并且计算是不是PD
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="inDto"></param>
|
/// <param name="inDto"></param>
|
||||||
|
/// <param name="numOfDaysBetween"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public async Task<bool> ChangeLastTaskSiteVisitForTumorEvaluation(ReadingCalculateDto inDto)
|
public async Task<PCWGSiteVisitForTumor> ChangeLastTaskSiteVisitForTumorEvaluation(ReadingCalculateDto inDto, int? numOfDaysBetween)
|
||||||
{
|
{
|
||||||
|
PCWGSiteVisitForTumor result = new PCWGSiteVisitForTumor()
|
||||||
|
{
|
||||||
|
IsPD = false,
|
||||||
|
};
|
||||||
var taskinfo = await _visitTaskRepository.Where(x => x.Id == inDto.VisitTaskId).FirstNotNullAsync();
|
var taskinfo = await _visitTaskRepository.Where(x => x.Id == inDto.VisitTaskId).FirstNotNullAsync();
|
||||||
var taskList = await GetSiteVisitForTumorList(inDto);
|
var taskList = await GetSiteVisitForTumorList(inDto);
|
||||||
var lastTask = taskList.Where(x => x.VisitTaskNum < taskinfo.VisitTaskNum && x.VisitTaskId != inDto.VisitTaskId).OrderByDescending(x => x.VisitTaskNum).FirstOrDefault();
|
var lastTask = taskList.Where(x => x.VisitTaskNum < taskinfo.VisitTaskNum && x.VisitTaskId != inDto.VisitTaskId).OrderByDescending(x => x.VisitTaskNum).FirstOrDefault();
|
||||||
|
|
||||||
var baseLineTask = taskList.OrderBy(x => x.VisitTaskNum).FirstOrDefault();
|
var baseLineTask = taskList.OrderBy(x => x.VisitTaskNum).FirstOrDefault();
|
||||||
var newLesionsCountQuestionId = inDto.QuestionInfo.Where(x => x.QuestionType == QuestionType.NewLesionsCount).Select(x => x.QuestionId).FirstOrDefault();
|
|
||||||
|
|
||||||
var isPDResult = false;
|
|
||||||
|
|
||||||
|
// 先判断有没有上一个任务
|
||||||
if (lastTask != null)
|
if (lastTask != null)
|
||||||
{
|
{
|
||||||
|
// 查看历史有没有PD
|
||||||
|
var taskIdList = taskList.Select(x => x.VisitTaskId).ToList();
|
||||||
|
|
||||||
#region 1、基线后第一个访视:新病灶计数≥ 2个;2、基线后第二个访视(应满足访视间隔6周以上,否则顺延)新病灶≥ 2个;
|
// pd的任务列表
|
||||||
//1、基线后第一个访视:新病灶计数≥ 2个;2、基线后第二个访视(应满足访视间隔6周以上,否则顺延)新病灶≥ 2个;
|
var pdTaskList = await _readingTaskQuestionAnswerRepository.Where(x => x.VisitTaskId != inDto.VisitTaskId && taskIdList.Contains(x.VisitTaskId) && x.ReadingQuestionTrial.QuestionType == QuestionType.SiteVisitForTumorEvaluation && x.Answer == VisitTumorEvaluation.PD.GetEnumInt()).OrderByDescending(x => x.VisitTask.VisitTaskNum).ToListAsync();
|
||||||
|
|
||||||
|
// 自治疗后第二个访视点以来持续的新骨变数量
|
||||||
|
var thisNewBoneLesionsCount = inDto.QuestionInfo.Where(x => x.QuestionType == QuestionType.NewBoneLesionsCount).Select(x => x.Answer).FirstIsNullReturnEmpty().IsNullOrEmptyReturn0();
|
||||||
|
|
||||||
|
// 当前任务的BL-BTN
|
||||||
|
var thisBTN = inDto.QuestionInfo.Where(x => x.QuestionType == QuestionType.BaseLineLesionsCount).Select(x => x.Answer).FirstIsNullReturnEmpty().IsNullOrEmptyReturn0();
|
||||||
|
|
||||||
|
// 当前访视新病灶数量
|
||||||
|
var thisNewLesionsCount = inDto.QuestionInfo.Where(x => x.QuestionType == QuestionType.NewLesionsCount).Select(x => x.Answer).FirstIsNullReturnEmpty().IsNullOrEmptyReturn0();
|
||||||
|
|
||||||
|
|
||||||
var firstVisit = taskList.FirstOrDefault();
|
// 其他访视的BTN
|
||||||
if (baseLineTask != null && baseLineTask.StudyTime != null)
|
var otherBTNStrList = await _readingTaskQuestionAnswerRepository.Where(x => x.VisitTaskId != inDto.VisitTaskId && taskIdList.Contains(x.VisitTaskId) && x.ReadingQuestionTrial.QuestionType == QuestionType.BaseLineLesionsCount).Select(x => new {
|
||||||
|
x.VisitTask.VisitTaskNum,
|
||||||
|
x.Answer,
|
||||||
|
}).ToListAsync();
|
||||||
|
|
||||||
|
// 最小的BTN 这个时候再转为int 避免查询报错
|
||||||
|
var otherMinBTNCount = otherBTNStrList.Select(x => x.Answer.IsNullOrEmptyReturn0()).Min();
|
||||||
|
|
||||||
|
|
||||||
|
// [(V3 - BTN - Min(V2 - BTN、V1 - BTN、BL - BTN)] 小于当0计算
|
||||||
|
|
||||||
|
var btnValue = thisBTN - otherMinBTNCount;
|
||||||
|
|
||||||
|
if (btnValue < 0)
|
||||||
{
|
{
|
||||||
//基线后第二个访视(应满足访视间隔6周以上,否则顺延)
|
btnValue = 0;
|
||||||
var secondVisit = taskList.Where(x => x.VisitTaskNum >= 2 && x.StudyTime >= baseLineTask.StudyTime.Value.AddDays(42)).FirstOrDefault();
|
}
|
||||||
if (secondVisit != null)
|
|
||||||
|
// 历史有PD
|
||||||
|
if (pdTaskList.Count() > 0)
|
||||||
|
{
|
||||||
|
// 当前访视:自治疗后第二个访视点以来持续的新骨变数量 + [(V3 - BTN - Min(V2 - BTN、V1 - BTN、BL - BTN)] + 新病灶 >= 2
|
||||||
|
|
||||||
|
if (thisNewBoneLesionsCount + btnValue + thisNewLesionsCount >= 2)
|
||||||
{
|
{
|
||||||
|
result.IsPD = true;
|
||||||
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();
|
|
||||||
|
|
||||||
// 判断是否是当前访视 当前访视还未入库
|
|
||||||
if (secondVisit.VisitTaskId == inDto.VisitTaskId)
|
|
||||||
{
|
|
||||||
secondVisitLesionsCount = (inDto.QuestionInfo.Where(x => x.QuestionType == QuestionType.NewLesionsCount).Select(x => x.Answer).FirstOrDefault()).IsNullOrEmptyReturn0();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (firstTaskNewLesionsCount >= 2 && secondVisitLesionsCount >= 2)
|
|
||||||
{
|
|
||||||
isPDResult = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// 间隔天数
|
||||||
|
var daysBetween = numOfDaysBetween != null ? numOfDaysBetween.Value : await GetNumberOfDaysBetween(inDto);
|
||||||
|
|
||||||
|
|
||||||
|
// 上一次访视的新病灶数量
|
||||||
|
var lastNewLesionsCount = (await _readingTaskQuestionAnswerRepository.Where(x => x.VisitTaskId == lastTask.VisitTaskId && x.ReadingQuestionTrial.QuestionType == QuestionType.NewLesionsCount).Select(x => x.Answer).FirstOrDefaultAsync()).IsNullOrEmptyReturn0();
|
||||||
|
|
||||||
if (lastTask.VisitTaskNum >= 2m)
|
// 之前不存在pd 又分为两种情况 在访视2 和 访视2以后
|
||||||
|
if (inDto.VisitTaskNum == 2)
|
||||||
{
|
{
|
||||||
|
var alwaysNewLesionsCount = inDto.QuestionInfo.Where(x => x.QuestionType == QuestionType.AlwaysNewLesionsCount).Select(x => x.Answer).FirstIsNullReturnEmpty().IsNullOrEmptyReturn0();
|
||||||
|
|
||||||
var lastTasknewLesionsCount = (await _readingTaskQuestionAnswerRepository.Where(x => x.VisitTaskId == lastTask.VisitTaskId && x.ReadingQuestionTrialId == newLesionsCountQuestionId).Select(x => x.Answer).FirstOrDefaultAsync()).IsNullOrEmptyReturn0();
|
// V1:新病灶计数>=2; V2:新病灶计数>=2且既往新病灶计数>=2;; V2与V1的间隔 >= 6周
|
||||||
var thisVisitTaskNewLesionsCount = (inDto.QuestionInfo.Where(x => x.QuestionType == QuestionType.NewLesionsCount).Select(x => x.Answer).FirstOrDefault()).IsNullOrEmptyReturn0();
|
if (lastNewLesionsCount >= 2 && thisNewLesionsCount >= 2 && alwaysNewLesionsCount >= 2 && daysBetween >= 42)
|
||||||
|
|
||||||
var thisVisitTask = taskList.LastOrDefault();
|
|
||||||
|
|
||||||
if (thisVisitTask != null && thisVisitTask.StudyTime != null && lastTask.StudyTime != null &&
|
|
||||||
|
|
||||||
|
|
||||||
lastTasknewLesionsCount >= 2 && thisVisitTaskNewLesionsCount >= 2 && lastTask.StudyTime.Value.AddDays(42) <= thisVisitTask.StudyTime)
|
|
||||||
{
|
{
|
||||||
isPDResult = true;
|
|
||||||
|
result.IsPD = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
else if (inDto.VisitTaskNum > 2)
|
||||||
|
{
|
||||||
|
// 上一个访视的BTN
|
||||||
|
var lastBTN = (await _readingTaskQuestionAnswerRepository.Where(x => x.VisitTaskId == lastTask.VisitTaskId && x.ReadingQuestionTrial.QuestionType == QuestionType.BaseLineLesionsCount).Select(x => x.Answer).FirstOrDefaultAsync()).IsNullOrEmptyReturn0();
|
||||||
|
|
||||||
|
// 上上个访视的 最小BTN
|
||||||
|
var lastTwoBTN = otherBTNStrList.Where(x => x.VisitTaskNum < lastTask.VisitTaskNum).Select(x => x.Answer.IsNullOrEmptyReturn0()).Min();
|
||||||
|
|
||||||
|
|
||||||
|
// V2:新病灶计数+[(V2-BTN- Min(V1-BTN、BL-BTN)]>=2;
|
||||||
|
// V3:自治疗后第二个访视点以来持续的新骨变数量 + [(V3 - BTN - Min(V2 - BTN、V1 - BTN、BL - BTN)] + 新病灶 >= 2
|
||||||
|
// V3与V2的间隔 >= 6周
|
||||||
|
|
||||||
|
// 按上面条件写三个if看着清晰点
|
||||||
|
|
||||||
|
var lastBtnSubMin = lastBTN - lastTwoBTN;
|
||||||
|
if (lastBtnSubMin < 0)
|
||||||
|
{
|
||||||
|
lastBtnSubMin = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (lastNewLesionsCount + lastBtnSubMin >= 2)
|
||||||
|
{
|
||||||
|
if (thisNewBoneLesionsCount + btnValue + thisNewLesionsCount >= 2)
|
||||||
|
{
|
||||||
|
if (daysBetween >= 42)
|
||||||
|
{
|
||||||
|
result.IsPD = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (result.IsPD)
|
||||||
|
{
|
||||||
|
// 为 null 说明不是前端传的
|
||||||
|
if (numOfDaysBetween == null)
|
||||||
|
{
|
||||||
|
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
|
||||||
|
{
|
||||||
|
PCWGInterimAnswer = VisitTumorEvaluation.PD.GetEnumInt(),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
result.LastTaskResult = VisitTumorEvaluation.PD.GetEnumInt();
|
||||||
|
result.LastTaskId = lastTask.VisitTaskId;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (lastTask != null)
|
||||||
|
{
|
||||||
|
if (numOfDaysBetween == null)
|
||||||
|
{
|
||||||
|
// 如果不是PD 需要把上一次的PD改为NoPD 这里去掉临时答案就是原始答案
|
||||||
|
await _readingTaskQuestionAnswerRepository.BatchUpdateNoTrackingAsync(x => x.VisitTaskId == lastTask.VisitTaskId && x.ReadingQuestionTrial.QuestionType == QuestionType.SiteVisitForTumorEvaluation, x => new ReadingTaskQuestionAnswer
|
||||||
|
{
|
||||||
|
PCWGInterimAnswer = null,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
var lastTaskResult = await _readingTaskQuestionAnswerRepository.Where(x => x.VisitTaskId == lastTask.VisitTaskId && x.ReadingQuestionTrial.QuestionType == QuestionType.SiteVisitForTumorEvaluation).Select(x => x.Answer).FirstOrDefaultAsync();
|
||||||
|
result.LastTaskResult = lastTaskResult;
|
||||||
|
result.LastTaskId = lastTask.VisitTaskId;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
if (isPDResult)
|
|
||||||
{
|
|
||||||
var visitForTumorEvaluationQuestionId = inDto.QuestionInfo.Where(x => x.QuestionType == QuestionType.SiteVisitForTumorEvaluation).Select(x => x.QuestionId).FirstOrDefault();
|
|
||||||
|
|
||||||
if (lastTask != null)
|
|
||||||
{
|
|
||||||
await _readingTaskQuestionAnswerRepository.BatchUpdateNoTrackingAsync(x => x.VisitTaskId == lastTask.VisitTaskId && x.ReadingQuestionTrialId == visitForTumorEvaluationQuestionId, x => new ReadingTaskQuestionAnswer
|
|
||||||
{
|
|
||||||
Answer = VisitTumorEvaluation.PD.GetEnumInt(),
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
return isPDResult;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
|
||||||
|
|
@ -34,4 +34,9 @@ public class ReadingTaskQuestionAnswer : BaseAddAuditEntity
|
||||||
public string GlobalChangeAnswer { get; set; } = string.Empty;
|
public string GlobalChangeAnswer { get; set; } = string.Empty;
|
||||||
[Comment("全局阅片是否修改")]
|
[Comment("全局阅片是否修改")]
|
||||||
public bool IsGlobalChange { get; set; } = false;
|
public bool IsGlobalChange { get; set; } = false;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// PCWG 临时Answer
|
||||||
|
/// </summary>
|
||||||
|
public string? PCWGInterimAnswer { get; set; }
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3662,6 +3662,7 @@ namespace IRaCIS.Core.Infra.EFCore.Common
|
||||||
{
|
{
|
||||||
//如果问题类型是附件 特殊处理 方便前端解析
|
//如果问题类型是附件 特殊处理 方便前端解析
|
||||||
Answer = Translationunit(u.AnswerType, u.Unit, u.CustomUnit, unitDataList, t.Answer),
|
Answer = Translationunit(u.AnswerType, u.Unit, u.CustomUnit, unitDataList, t.Answer),
|
||||||
|
|
||||||
u.QuestionName,
|
u.QuestionName,
|
||||||
u.QuestionEnName,
|
u.QuestionEnName,
|
||||||
u.DictionaryCode,
|
u.DictionaryCode,
|
||||||
|
|
@ -3735,6 +3736,7 @@ namespace IRaCIS.Core.Infra.EFCore.Common
|
||||||
new
|
new
|
||||||
{
|
{
|
||||||
Answer = Translationunit(u.AnswerType, u.Unit, u.CustomUnit, unitDataList, t.Answer),
|
Answer = Translationunit(u.AnswerType, u.Unit, u.CustomUnit, unitDataList, t.Answer),
|
||||||
|
PCWGInterimAnswer = Translationunit(u.AnswerType, u.Unit, u.CustomUnit, unitDataList, t.PCWGInterimAnswer),
|
||||||
u.DictionaryCode,
|
u.DictionaryCode,
|
||||||
u.QuestionName,
|
u.QuestionName,
|
||||||
u.QuestionEnName,
|
u.QuestionEnName,
|
||||||
|
|
|
||||||
20964
IRaCIS.Core.Infra.EFCore/Migrations/20251029055335_PCWGInterimAnswer.Designer.cs
generated
Normal file
20964
IRaCIS.Core.Infra.EFCore/Migrations/20251029055335_PCWGInterimAnswer.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,29 @@
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace IRaCIS.Core.Infra.EFCore.Migrations
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public partial class PCWGInterimAnswer : Migration
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.AddColumn<string>(
|
||||||
|
name: "PCWGInterimAnswer",
|
||||||
|
table: "ReadingTaskQuestionAnswer",
|
||||||
|
type: "nvarchar(400)",
|
||||||
|
maxLength: 400,
|
||||||
|
nullable: true);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "PCWGInterimAnswer",
|
||||||
|
table: "ReadingTaskQuestionAnswer");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -7730,6 +7730,10 @@ namespace IRaCIS.Core.Infra.EFCore.Migrations
|
||||||
.HasColumnType("bit")
|
.HasColumnType("bit")
|
||||||
.HasComment("全局阅片是否修改");
|
.HasComment("全局阅片是否修改");
|
||||||
|
|
||||||
|
b.Property<string>("PCWGInterimAnswer")
|
||||||
|
.HasMaxLength(400)
|
||||||
|
.HasColumnType("nvarchar(400)");
|
||||||
|
|
||||||
b.Property<Guid>("ReadingQuestionCriterionTrialId")
|
b.Property<Guid>("ReadingQuestionCriterionTrialId")
|
||||||
.HasColumnType("uniqueidentifier")
|
.HasColumnType("uniqueidentifier")
|
||||||
.HasComment("项目问题标准Id");
|
.HasComment("项目问题标准Id");
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue