修改
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
parent
4c1da73c33
commit
72fd347c01
|
|
@ -325,6 +325,36 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
|
||||||
public int NumberOfDaysBetween { 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 SiteVisitForTumorEvaluationByDayOutDto
|
||||||
|
{
|
||||||
|
public string Result{ get; set; }=string.Empty;
|
||||||
|
|
||||||
|
public string? LastTaskResult { get; set; }
|
||||||
|
|
||||||
|
public Guid? LastTaskId { get; set; }
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public class PCWGSiteVisitForTumor
|
||||||
|
{
|
||||||
|
public bool IsPD { get; set; }
|
||||||
|
|
||||||
|
public string? LastTaskResult { get; set; }
|
||||||
|
|
||||||
|
public Guid? LastTaskId { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 阅片计算Dto
|
/// 阅片计算Dto
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
using DocumentFormat.OpenXml.Spreadsheet;
|
using DocumentFormat.OpenXml.Spreadsheet;
|
||||||
|
using DocumentFormat.OpenXml.Vml.Spreadsheet;
|
||||||
using IRaCIS.Application.Contracts;
|
using IRaCIS.Application.Contracts;
|
||||||
using IRaCIS.Core.Application.Contracts;
|
using IRaCIS.Core.Application.Contracts;
|
||||||
using IRaCIS.Core.Application.Helper;
|
using IRaCIS.Core.Application.Helper;
|
||||||
|
|
@ -1111,51 +1112,62 @@ 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);
|
return (await GetSiteVisitForTumorEvaluationByDay(inDto)).Result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获取肿瘤评估 逻辑抽离
|
/// 获取肿瘤评估 逻辑抽离 这里还要返回上一次的结果
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="inDto"></param>
|
/// <param name="inDto"></param>
|
||||||
/// <param name="daysBetween"></param>
|
/// <param name="daysBetween"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public async Task<string> GetSiteVisitForTumorEvaluationByDay(ReadingCalculateDto inDto, int? daysBetween = null)
|
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;
|
||||||
}
|
}
|
||||||
if (inDto.QuestionInfo.Any(x => x.QuestionType == QuestionType.ImageQualityAssessment && x.Answer == ImageQualityEvaluation.Abnormal.GetEnumInt()))
|
if (inDto.QuestionInfo.Any(x => x.QuestionType == QuestionType.ImageQualityAssessment && x.Answer == ImageQualityEvaluation.Abnormal.GetEnumInt()))
|
||||||
{
|
{
|
||||||
//影像质量不正常
|
//影像质量不正常
|
||||||
return VisitTumorEvaluation.NE.GetEnumInt();
|
result.Result = VisitTumorEvaluation.NE.GetEnumInt();
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
var isPD = await ChangeLastTaskSiteVisitForTumorEvaluation(inDto, daysBetween);
|
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>
|
||||||
|
|
@ -1163,7 +1175,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
public async Task<string> FrontGetSiteVisitForTumorEvaluation(FrontGetSiteVisitForTumorEvaluationInDto inDto)
|
public async Task<FrontGetSiteVisitForTumorEvaluationOutDto> FrontGetSiteVisitForTumorEvaluation(FrontGetSiteVisitForTumorEvaluationInDto inDto)
|
||||||
{
|
{
|
||||||
ReadingCalculateDto readingData = await _generalCalculateService.GetReadingCalculateDto(inDto.VisitTaskId);
|
ReadingCalculateDto readingData = await _generalCalculateService.GetReadingCalculateDto(inDto.VisitTaskId);
|
||||||
// 只获取当前的 不会获取上一次临时修改的结果
|
// 只获取当前的 不会获取上一次临时修改的结果
|
||||||
|
|
@ -1174,8 +1186,28 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||||
item.Answer = item.PCWGInterimAnswer;
|
item.Answer = item.PCWGInterimAnswer;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
FrontGetSiteVisitForTumorEvaluationOutDto result = new FrontGetSiteVisitForTumorEvaluationOutDto();
|
||||||
|
|
||||||
return await GetSiteVisitForTumorEvaluationByDay(readingData, inDto.NumberOfDaysBetween);
|
|
||||||
|
|
||||||
|
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1185,15 +1217,17 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||||
/// <param name="inDto"></param>
|
/// <param name="inDto"></param>
|
||||||
/// <param name="numOfDaysBetween"></param>
|
/// <param name="numOfDaysBetween"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public async Task<bool> ChangeLastTaskSiteVisitForTumorEvaluation(ReadingCalculateDto inDto, int? numOfDaysBetween)
|
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 isPDResult = false;
|
|
||||||
|
|
||||||
// 先判断有没有上一个任务
|
// 先判断有没有上一个任务
|
||||||
if (lastTask != null)
|
if (lastTask != null)
|
||||||
|
|
@ -1228,7 +1262,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||||
// 当前访视:自治疗后第二个访视点以来持续的新骨变数量 + [(V3 - BTN - Min(V2 - BTN、V1 - BTN、BL - BTN)] + 新病灶 >= 2
|
// 当前访视:自治疗后第二个访视点以来持续的新骨变数量 + [(V3 - BTN - Min(V2 - BTN、V1 - BTN、BL - BTN)] + 新病灶 >= 2
|
||||||
if (thisNewBoneLesionsCount + thisBTN - othenMinBTNCount + thisNewLesionsCount >= 2)
|
if (thisNewBoneLesionsCount + thisBTN - othenMinBTNCount + thisNewLesionsCount >= 2)
|
||||||
{
|
{
|
||||||
isPDResult = true;
|
result.IsPD = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1248,7 +1282,8 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||||
// V1:新病灶计数>=2; V2:新病灶计数 >= 2; V2与V1的间隔 >= 6周
|
// V1:新病灶计数>=2; V2:新病灶计数 >= 2; V2与V1的间隔 >= 6周
|
||||||
if (lastNewLesionsCount >= 2 && thisNewLesionsCount >= 2 && daysBetween >= 42)
|
if (lastNewLesionsCount >= 2 && thisNewLesionsCount >= 2 && daysBetween >= 42)
|
||||||
{
|
{
|
||||||
isPDResult = true;
|
|
||||||
|
result.IsPD = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -1272,7 +1307,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||||
{
|
{
|
||||||
if (daysBetween >= 42)
|
if (daysBetween >= 42)
|
||||||
{
|
{
|
||||||
isPDResult = true;
|
result.IsPD = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1280,25 +1315,35 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (isPDResult)
|
if (result.IsPD)
|
||||||
{
|
{
|
||||||
var visitForTumorEvaluationQuestionId = inDto.QuestionInfo.Where(x => x.QuestionType == QuestionType.SiteVisitForTumorEvaluation).Select(x => x.QuestionId).FirstOrDefault();
|
// 为 null 说明不是前端传的
|
||||||
await _readingTaskQuestionAnswerRepository.BatchUpdateNoTrackingAsync(x => x.VisitTaskId == lastTask.VisitTaskId && x.ReadingQuestionTrialId == visitForTumorEvaluationQuestionId, x => new ReadingTaskQuestionAnswer
|
if (numOfDaysBetween == null)
|
||||||
{
|
{
|
||||||
PCWGInterimAnswer = VisitTumorEvaluation.PD.GetEnumInt(),
|
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
|
else
|
||||||
{
|
{
|
||||||
if (lastTask != null)
|
if (lastTask != null)
|
||||||
{
|
{
|
||||||
// 如果不是PD 需要把上一次的PD改为NoPD
|
// 如果不是PD 需要把上一次的PD改为NoPD 这里去掉临时答案就是原始答案
|
||||||
await _readingTaskQuestionAnswerRepository.BatchUpdateNoTrackingAsync(x => x.VisitTaskId == lastTask.VisitTaskId&&x.ReadingQuestionTrial.QuestionType== QuestionType.SiteVisitForTumorEvaluation, x => new ReadingTaskQuestionAnswer
|
await _readingTaskQuestionAnswerRepository.BatchUpdateNoTrackingAsync(x => x.VisitTaskId == lastTask.VisitTaskId&&x.ReadingQuestionTrial.QuestionType== QuestionType.SiteVisitForTumorEvaluation, x => new ReadingTaskQuestionAnswer
|
||||||
{
|
{
|
||||||
PCWGInterimAnswer = string.Empty,
|
PCWGInterimAnswer = string.Empty,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
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;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1309,7 +1354,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return isPDResult;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue