Merge branch 'master' of http://192.168.1.2:8033/IRaCIS_Core_Api
commit
bcad91dc18
|
@ -1220,6 +1220,11 @@
|
||||||
首次转变的任务ID
|
首次转变的任务ID
|
||||||
</summary>
|
</summary>
|
||||||
</member>
|
</member>
|
||||||
|
<member name="F:IRaCIS.Core.Application.Service.ReadingCalculate.IRECIST1Point1CalculateService.compareTaskList">
|
||||||
|
<summary>
|
||||||
|
触发任务list
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
<member name="M:IRaCIS.Core.Application.Service.ReadingCalculate.IRECIST1Point1CalculateService.GetDeleteLesionStatrIndex(IRaCIS.Core.Application.Service.Reading.Dto.DeleteReadingRowAnswerInDto)">
|
<member name="M:IRaCIS.Core.Application.Service.ReadingCalculate.IRECIST1Point1CalculateService.GetDeleteLesionStatrIndex(IRaCIS.Core.Application.Service.Reading.Dto.DeleteReadingRowAnswerInDto)">
|
||||||
<summary>
|
<summary>
|
||||||
删除病灶获取起始病灶序号(RECIST1Point1 固定是1)
|
删除病灶获取起始病灶序号(RECIST1Point1 固定是1)
|
||||||
|
@ -1233,7 +1238,7 @@
|
||||||
<param name="indto"></param>
|
<param name="indto"></param>
|
||||||
<returns></returns>
|
<returns></returns>
|
||||||
</member>
|
</member>
|
||||||
<member name="M:IRaCIS.Core.Application.Service.ReadingCalculate.IRECIST1Point1CalculateService.TestCalculate(System.Guid,IRaCIS.Core.Domain.Share.QuestionType)">
|
<member name="M:IRaCIS.Core.Application.Service.ReadingCalculate.IRECIST1Point1CalculateService.TestCalculate(System.Guid,System.Nullable{IRaCIS.Core.Domain.Share.QuestionType})">
|
||||||
<summary>
|
<summary>
|
||||||
测试计算
|
测试计算
|
||||||
</summary>
|
</summary>
|
||||||
|
@ -1458,9 +1463,9 @@
|
||||||
</summary>
|
</summary>
|
||||||
<returns></returns>
|
<returns></returns>
|
||||||
</member>
|
</member>
|
||||||
<member name="M:IRaCIS.Core.Application.Service.ReadingCalculate.IRECIST1Point1CalculateService.GetFirstChangeTaskId(IRaCIS.Core.Application.Service.Reading.Dto.ReadingCalculateDto)">
|
<member name="M:IRaCIS.Core.Application.Service.ReadingCalculate.IRECIST1Point1CalculateService.GetCompareTaskId(IRaCIS.Core.Application.Service.Reading.Dto.ReadingCalculateDto,IRaCIS.Core.Domain.Share.QuestionType)">
|
||||||
<summary>
|
<summary>
|
||||||
获取第一次转变访视任务Id
|
获取比较任务Id 需要之前一次访视为IUPD或者ICPD
|
||||||
</summary>
|
</summary>
|
||||||
<returns></returns>
|
<returns></returns>
|
||||||
</member>
|
</member>
|
||||||
|
@ -7444,6 +7449,16 @@
|
||||||
<member name="T:IRaCIS.Core.Application.ViewModel.SystemNoticeAddOrEdit">
|
<member name="T:IRaCIS.Core.Application.ViewModel.SystemNoticeAddOrEdit">
|
||||||
<summary> SystemNoticeAddOrEdit 列表查询参数模型</summary>
|
<summary> SystemNoticeAddOrEdit 列表查询参数模型</summary>
|
||||||
</member>
|
</member>
|
||||||
|
<member name="P:IRaCIS.Core.Application.ViewModel.TirggerTaskInfo.TargetAssessmentIsIUorIC">
|
||||||
|
<summary>
|
||||||
|
靶病灶是否为IUPD或者ICPD
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:IRaCIS.Core.Application.ViewModel.TirggerTaskInfo.NewTargetLesionAssessmentIsIUorIC">
|
||||||
|
<summary>
|
||||||
|
靶病灶是否为IUPD或者ICPD
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
<member name="P:IRaCIS.Core.Application.ViewModel.VisitStudyTime.SubjectVisitId">
|
<member name="P:IRaCIS.Core.Application.ViewModel.VisitStudyTime.SubjectVisitId">
|
||||||
<summary>
|
<summary>
|
||||||
访视Id
|
访视Id
|
||||||
|
|
|
@ -479,6 +479,9 @@ namespace IRaCIS.Application.Services
|
||||||
// 在修改前 去除这个问题
|
// 在修改前 去除这个问题
|
||||||
x.BeforeQuestionList = x.BeforeQuestionList.Where(x => x.QuestionType != QuestionType.SiteVisitForTumorEvaluation).ToList();
|
x.BeforeQuestionList = x.BeforeQuestionList.Where(x => x.QuestionType != QuestionType.SiteVisitForTumorEvaluation).ToList();
|
||||||
|
|
||||||
|
|
||||||
|
x.AfterQuestionList = x.AfterQuestionList.Where(x => x.QuestionType == QuestionType.SiteVisitForTumorEvaluation|| x.GlobalAnswerType != GlobalAnswerType.Question).ToList();
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
using System;
|
using IRaCIS.Core.Domain.Share;
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
@ -11,6 +12,39 @@ namespace IRaCIS.Core.Application.ViewModel
|
||||||
public Guid VisitTaskId { get; set; }
|
public Guid VisitTaskId { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class ReadingTaskQuestionAnswerDto : ReadingTaskQuestionAnswer
|
||||||
|
{
|
||||||
|
public QuestionType QuestionType { get; set; }
|
||||||
|
}
|
||||||
|
public class TirggerTaskInfo
|
||||||
|
{
|
||||||
|
public Guid VisitTaskId { get; set; }
|
||||||
|
|
||||||
|
public decimal VisitNum { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 靶病灶是否为IUPD或者ICPD
|
||||||
|
/// </summary>
|
||||||
|
public bool TargetAssessmentIsIUorIC { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 靶病灶是否为IUPD或者ICPD
|
||||||
|
/// </summary>
|
||||||
|
public bool NewTargetLesionAssessmentIsIUorIC { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public class TirggerAnswerInfo
|
||||||
|
{
|
||||||
|
public Guid VisitTaskId { get; set; }
|
||||||
|
|
||||||
|
public QuestionType QuestionType { get; set; }
|
||||||
|
|
||||||
|
public string Answer { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public class VisitStudyTime
|
public class VisitStudyTime
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -88,6 +88,11 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||||
/// 首次转变的任务ID
|
/// 首次转变的任务ID
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Guid? firstChangeTaskId;
|
public Guid? firstChangeTaskId;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 触发任务list
|
||||||
|
/// </summary>
|
||||||
|
public List<TirggerTaskInfo>? compareTaskList = null;
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region 删除病灶获取起始病灶序号
|
#region 删除病灶获取起始病灶序号
|
||||||
|
@ -394,14 +399,22 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||||
/// <param name="visitTaskId"></param>
|
/// <param name="visitTaskId"></param>
|
||||||
/// <param name="type"></param>
|
/// <param name="type"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpPost]
|
[HttpGet]
|
||||||
public async Task TestCalculate(Guid visitTaskId, QuestionType type)
|
public async Task TestCalculate(Guid visitTaskId, QuestionType? type)
|
||||||
{
|
{
|
||||||
//_logger.LogError("测试计算");
|
//_logger.LogError("测试计算");
|
||||||
ReadingCalculateDto readingData = await _generalCalculateService.GetReadingCalculateDto(visitTaskId);
|
ReadingCalculateDto readingData = await _generalCalculateService.GetReadingCalculateDto(visitTaskId);
|
||||||
// await _generalCalculateService.LogRecord(readingData, "其他既往新病灶", LesionType.OtherPreviousNewLesion);
|
// await _generalCalculateService.LogRecord(readingData, "其他既往新病灶", LesionType.OtherPreviousNewLesion);
|
||||||
|
if (type == null)
|
||||||
|
{
|
||||||
|
await ReadingCalculate(readingData);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
|
||||||
|
{
|
||||||
|
await ReadingCalculate(readingData, new List<QuestionType>() { type.Value });
|
||||||
|
}
|
||||||
|
|
||||||
await ReadingCalculate(readingData,new List<QuestionType>() { type});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -462,7 +475,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||||
{
|
{
|
||||||
|
|
||||||
#region 计算 这里顺序非常重要 后面计算的值要依赖前面计算的结果
|
#region 计算 这里顺序非常重要 后面计算的值要依赖前面计算的结果
|
||||||
var needAddList = new List<ReadingTaskQuestionAnswer>();
|
var needAddList = new List<ReadingTaskQuestionAnswerDto>();
|
||||||
|
|
||||||
|
|
||||||
List<ReadingCalculateData> calculateList = new List<ReadingCalculateData>()
|
List<ReadingCalculateData> calculateList = new List<ReadingCalculateData>()
|
||||||
|
@ -498,13 +511,13 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||||
new ReadingCalculateData (){QuestionType=QuestionType.NETarget,GetStringFun=GetNETarget},
|
new ReadingCalculateData (){QuestionType=QuestionType.NETarget,GetStringFun=GetNETarget},
|
||||||
|
|
||||||
// 与触发iRECIST访视相比SOD变化量
|
// 与触发iRECIST访视相比SOD变化量
|
||||||
new ReadingCalculateData (){QuestionType=QuestionType.ComparedTriggeringSODChange,GetDecimalNullFun=GetComparedTriggeringSODChange,IsConvertedTask=true},
|
new ReadingCalculateData (){QuestionType=QuestionType.ComparedTriggeringSODChange,GetStringFun=GetComparedTriggeringSODChange,IsConvertedTask=true},
|
||||||
|
|
||||||
// 新靶病灶直径之和(iSOD)
|
// 新靶病灶直径之和(iSOD)
|
||||||
new ReadingCalculateData (){QuestionType=QuestionType.ISOD,GetDecimalNullFun=GetiSODData,IsConvertedTask=true},
|
new ReadingCalculateData (){QuestionType=QuestionType.ISOD,GetDecimalNullFun=GetiSODData,IsConvertedTask=true},
|
||||||
|
|
||||||
// 与触发iRECIST访视相比iSOD变化量
|
// 与触发iRECIST访视相比iSOD变化量
|
||||||
new ReadingCalculateData (){QuestionType=QuestionType.ComparedTriggeringiSODChange,GetDecimalNullFun=GetComparedTriggeringiSODChange,IsConvertedTask=true},
|
new ReadingCalculateData (){QuestionType=QuestionType.ComparedTriggeringiSODChange,GetStringFun=GetComparedTriggeringiSODChange,IsConvertedTask=true},
|
||||||
|
|
||||||
// 靶病灶评估
|
// 靶病灶评估
|
||||||
new ReadingCalculateData (){QuestionType=QuestionType.TargetLesion,GetStringFun=GetTargetLesionEvaluate,IsConvertedTask=false},
|
new ReadingCalculateData (){QuestionType=QuestionType.TargetLesion,GetStringFun=GetTargetLesionEvaluate,IsConvertedTask=false},
|
||||||
|
@ -710,9 +723,10 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
needAddList.Add(new ReadingTaskQuestionAnswer()
|
needAddList.Add(new ReadingTaskQuestionAnswerDto()
|
||||||
{
|
{
|
||||||
Answer = item.Answer,
|
Answer = item.Answer,
|
||||||
|
QuestionType= calculate.QuestionType,
|
||||||
ReadingQuestionTrialId = item.QuestionId,
|
ReadingQuestionTrialId = item.QuestionId,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -732,11 +746,33 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
var questionIds = needAddList.Select(x => x.ReadingQuestionTrialId).ToList();
|
var questionIds = needAddList.Select(x => x.ReadingQuestionTrialId).ToList();
|
||||||
|
|
||||||
await _readingTaskQuestionAnswerRepository.BatchDeleteNoTrackingAsync(x => questionIds.Contains(x.ReadingQuestionTrialId) && x.VisitTaskId == inDto.VisitTaskId);
|
await _readingTaskQuestionAnswerRepository.BatchDeleteNoTrackingAsync(x => questionIds.Contains(x.ReadingQuestionTrialId) && x.VisitTaskId == inDto.VisitTaskId);
|
||||||
|
|
||||||
|
// 这里在某些条件下 要删除 sod变化量 和isod变化量
|
||||||
|
// 靶病灶评估为IUPD或者ICPD
|
||||||
|
|
||||||
|
var targetLesionIsIUorIC = needAddList.Any(x => x.QuestionType == QuestionType.TargetLesion && (x.Answer.EqEnum(TargetAssessment.iUPD) || x.Answer.EqEnum(TargetAssessment.iCPD)));
|
||||||
|
|
||||||
|
// 新靶病灶为IUPD或者ICPD
|
||||||
|
var newTargetLesionIsIUorIC = needAddList.Any(x => x.QuestionType == QuestionType.NewTargetLesion && (x.Answer.EqEnum(NewTargetLesionAssessment.iUPD) || x.Answer.EqEnum(NewTargetLesionAssessment.iCPD)));
|
||||||
|
|
||||||
|
|
||||||
needAddList.ForEach(x =>
|
needAddList.ForEach(x =>
|
||||||
{
|
{
|
||||||
|
|
||||||
|
if (x.QuestionType == QuestionType.ComparedTriggeringSODChange && !targetLesionIsIUorIC)
|
||||||
|
{
|
||||||
|
x.Answer = string.Empty;
|
||||||
|
}
|
||||||
|
else if (x.QuestionType == QuestionType.ComparedTriggeringiSODChange && !newTargetLesionIsIUorIC)
|
||||||
|
{
|
||||||
|
x.Answer = string.Empty;
|
||||||
|
}
|
||||||
|
|
||||||
x.SubjectId = inDto.SubjectId;
|
x.SubjectId = inDto.SubjectId;
|
||||||
x.ReadingQuestionCriterionTrialId = inDto.CriterionId;
|
x.ReadingQuestionCriterionTrialId = inDto.CriterionId;
|
||||||
x.VisitTaskId = inDto.VisitTaskId;
|
x.VisitTaskId = inDto.VisitTaskId;
|
||||||
|
@ -1335,18 +1371,22 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="inDto"></param>
|
/// <param name="inDto"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public async Task<decimal?> GetComparedTriggeringSODChange(ReadingCalculateDto inDto)
|
public async Task<string> GetComparedTriggeringSODChange(ReadingCalculateDto inDto)
|
||||||
{
|
{
|
||||||
var firstChangeTaskId = await this.GetFirstChangeTaskId(inDto);
|
var compareTaskId = await this.GetCompareTaskId(inDto,QuestionType.TargetLesion);
|
||||||
|
if (compareTaskId == null)
|
||||||
|
{
|
||||||
|
return string.Empty;
|
||||||
|
}
|
||||||
var firstChangeSOD = (await _readingTaskQuestionAnswerRepository.Where(x => x.VisitTaskId == firstChangeTaskId && x.ReadingQuestionTrial.QuestionType == QuestionType.SOD).Select(x => x.Answer).FirstOrDefaultAsync()).IsNullOrEmptyReturn0();
|
var firstChangeSOD = (await _readingTaskQuestionAnswerRepository.Where(x => x.VisitTaskId == firstChangeTaskId && x.ReadingQuestionTrial.QuestionType == QuestionType.SOD).Select(x => x.Answer).FirstOrDefaultAsync()).IsNullOrEmptyReturn0();
|
||||||
|
|
||||||
var value = await GetSODData(inDto);
|
var value = await GetSODData(inDto);
|
||||||
|
|
||||||
if (value == null || inDto.IsBaseLine|| !inDto.IsConvertedTask||inDto.BeforeConvertedTaskId!=null)
|
if (value == null || inDto.IsBaseLine|| !inDto.IsConvertedTask||inDto.BeforeConvertedTaskId!=null)
|
||||||
{
|
{
|
||||||
return null;
|
return string.Empty;
|
||||||
}
|
}
|
||||||
return value.NullChange0() - firstChangeSOD;
|
return (value.NullChange0() - firstChangeSOD).ToString();
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
@ -1409,20 +1449,24 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="inDto"></param>
|
/// <param name="inDto"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public async Task<decimal?> GetComparedTriggeringiSODChange(ReadingCalculateDto inDto)
|
public async Task<string> GetComparedTriggeringiSODChange(ReadingCalculateDto inDto)
|
||||||
{
|
{
|
||||||
|
|
||||||
var firstChangeTaskId = await GetFirstChangeTaskId(inDto);
|
var compareTaskId = await this.GetCompareTaskId(inDto, QuestionType.NewTargetLesion);
|
||||||
|
if (compareTaskId == null)
|
||||||
|
{
|
||||||
|
return string.Empty;
|
||||||
|
}
|
||||||
|
|
||||||
var firstChangeiSOD = (await _readingTaskQuestionAnswerRepository.Where(x => x.VisitTaskId == firstChangeTaskId && x.ReadingQuestionTrial.QuestionType == QuestionType.ISOD).Select(x => x.Answer).FirstOrDefaultAsync()).IsNullOrEmptyReturn0();
|
var firstChangeiSOD = (await _readingTaskQuestionAnswerRepository.Where(x => x.VisitTaskId == compareTaskId && x.ReadingQuestionTrial.QuestionType == QuestionType.ISOD).Select(x => x.Answer).FirstOrDefaultAsync()).IsNullOrEmptyReturn0();
|
||||||
|
|
||||||
var value = await GetiSODData(inDto);
|
var value = await GetiSODData(inDto);
|
||||||
|
|
||||||
if (value == null || inDto.IsBaseLine || !inDto.IsConvertedTask || inDto.BeforeConvertedTaskId != null)
|
if (value == null || inDto.IsBaseLine || !inDto.IsConvertedTask || inDto.BeforeConvertedTaskId != null)
|
||||||
{
|
{
|
||||||
return null;
|
return string.Empty;
|
||||||
}
|
}
|
||||||
return value.NullChange0() - firstChangeiSOD;
|
return (value.NullChange0() - firstChangeiSOD).ToString();
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
@ -1666,33 +1710,109 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获取第一次转变访视任务Id
|
/// 获取比较任务Id 需要之前一次访视为IUPD或者ICPD
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
private async Task<Guid> GetFirstChangeTaskId(ReadingCalculateDto inDto)
|
private async Task<Guid?> GetCompareTaskId(ReadingCalculateDto inDto,QuestionType questionType)
|
||||||
{
|
|
||||||
|
|
||||||
if (firstChangeTaskId != null)
|
|
||||||
{
|
|
||||||
return firstChangeTaskId.Value;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
var taskinfo = await _visitTaskRepository.Where(x => x.Id == inDto.VisitTaskId).ProjectTo<VisitTaskDto>(_mapper.ConfigurationProvider).FirstNotNullAsync();
|
var taskinfo = await _visitTaskRepository.Where(x => x.Id == inDto.VisitTaskId).ProjectTo<VisitTaskDto>(_mapper.ConfigurationProvider).FirstNotNullAsync();
|
||||||
var taskId = await _visitTaskRepository.Where(x => x.ReadingCategory == ReadingCategory.Visit &&
|
var lastTaskId = await GetLastVisitTaskId(inDto);
|
||||||
|
|
||||||
|
|
||||||
|
if (compareTaskList == null)
|
||||||
|
{
|
||||||
|
// 先找到第一个转变任务的number 直接找是否为转变任务 查询耗性能
|
||||||
|
var firstChangeVisitTaskNum = await _visitTaskRepository.Where(x => x.ReadingCategory == ReadingCategory.Visit &&
|
||||||
x.TrialReadingCriterionId == taskinfo.TrialReadingCriterionId &&
|
x.TrialReadingCriterionId == taskinfo.TrialReadingCriterionId &&
|
||||||
x.IsAnalysisCreate == taskinfo.IsAnalysisCreate &&
|
x.IsAnalysisCreate == taskinfo.IsAnalysisCreate &&
|
||||||
x.DoctorUserId == taskinfo.DoctorUserId &&
|
x.DoctorUserId == taskinfo.DoctorUserId &&
|
||||||
x.IsSelfAnalysis == taskinfo.IsSelfAnalysis &&
|
x.IsSelfAnalysis == taskinfo.IsSelfAnalysis &&
|
||||||
x.SubjectId == taskinfo.SubjectId && x.ReadingTaskState == ReadingTaskState.HaveSigned && x.ArmEnum == taskinfo.ArmEnum
|
x.SubjectId == taskinfo.SubjectId && x.ReadingTaskState == ReadingTaskState.HaveSigned && x.ArmEnum == taskinfo.ArmEnum
|
||||||
&& x.BeforeConvertedTaskId != null && x.TaskState == TaskState.Effect
|
&& x.BeforeConvertedTaskId != null && x.TaskState == TaskState.Effect
|
||||||
).OrderBy(x => x.VisitTaskNum).Select(x => x.Id).FirstOrDefaultAsync();
|
).OrderBy(x => x.VisitTaskNum).Select(x => x.VisitTaskNum).FirstOrDefaultAsync();
|
||||||
firstChangeTaskId = taskId;
|
|
||||||
return taskId;
|
// 找到转变之后 所有任务
|
||||||
|
compareTaskList = await _visitTaskRepository.Where(x => x.ReadingCategory == ReadingCategory.Visit &&
|
||||||
|
x.TrialReadingCriterionId == taskinfo.TrialReadingCriterionId &&
|
||||||
|
x.IsAnalysisCreate == taskinfo.IsAnalysisCreate &&
|
||||||
|
x.DoctorUserId == taskinfo.DoctorUserId &&
|
||||||
|
x.IsSelfAnalysis == taskinfo.IsSelfAnalysis &&
|
||||||
|
x.SubjectId == taskinfo.SubjectId && x.ReadingTaskState == ReadingTaskState.HaveSigned && x.ArmEnum == taskinfo.ArmEnum &&
|
||||||
|
x.VisitTaskNum >= firstChangeVisitTaskNum && x.VisitTaskNum < taskinfo.VisitTaskNum && x.TaskState == TaskState.Effect
|
||||||
|
).OrderBy(x => x.VisitTaskNum).Select(x => new TirggerTaskInfo()
|
||||||
|
{
|
||||||
|
VisitTaskId = x.Id,
|
||||||
|
VisitNum = x.VisitTaskNum,
|
||||||
|
}).ToListAsync();
|
||||||
|
|
||||||
|
// 获取所有任务Id
|
||||||
|
var visitTaskids = compareTaskList.Select(x => x.VisitTaskId).ToList();
|
||||||
|
|
||||||
|
// 找到所有任务的靶病灶评估和非靶病灶评估
|
||||||
|
var answers = await _readingTaskQuestionAnswerRepository.Where(x => (x.ReadingQuestionTrial.QuestionType == QuestionType.TargetLesion || x.ReadingQuestionTrial.QuestionType == QuestionType.NewTargetLesion) &&
|
||||||
|
visitTaskids.Contains(x.VisitTaskId)
|
||||||
|
).Select(x => new TirggerAnswerInfo()
|
||||||
|
{
|
||||||
|
VisitTaskId = x.VisitTaskId,
|
||||||
|
Answer = x.Answer,
|
||||||
|
QuestionType = x.ReadingQuestionTrial.QuestionType.Value
|
||||||
|
}).ToListAsync();
|
||||||
|
|
||||||
|
compareTaskList.ForEach(x =>
|
||||||
|
{
|
||||||
|
x.TargetAssessmentIsIUorIC = answers.Any(x => questionType == QuestionType.TargetLesion && (x.Answer == TargetAssessment.iUPD.GetEnumInt() || x.Answer == TargetAssessment.iCPD.GetEnumInt()));
|
||||||
|
x.NewTargetLesionAssessmentIsIUorIC = answers.Any(x => questionType == QuestionType.NewTargetLesion && (x.Answer == NewTargetLesionAssessment.iUPD.GetEnumInt() || x.Answer == NewTargetLesionAssessment.iCPD.GetEnumInt()));
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Guid? compareTaskId = null;
|
||||||
|
if(compareTaskList.Count()==0)
|
||||||
|
{
|
||||||
|
return compareTaskId;
|
||||||
}
|
}
|
||||||
|
int index = 0;
|
||||||
|
switch (questionType)
|
||||||
|
{
|
||||||
|
case QuestionType.TargetLesion:
|
||||||
|
index = compareTaskList.FindLastIndex(x => x.TargetAssessmentIsIUorIC);
|
||||||
|
if (index == -1)
|
||||||
|
{
|
||||||
|
return compareTaskList[0].VisitTaskId;
|
||||||
|
}
|
||||||
|
else if (index > 0 && !compareTaskList[index-1].TargetAssessmentIsIUorIC)
|
||||||
|
{
|
||||||
|
return compareTaskList[index-1].VisitTaskId;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return compareTaskList[0].VisitTaskId;
|
||||||
|
}
|
||||||
|
case QuestionType.NewTargetLesion:
|
||||||
|
index = compareTaskList.FindLastIndex(x => x.NewTargetLesionAssessmentIsIUorIC);
|
||||||
|
if (index == -1)
|
||||||
|
{
|
||||||
|
return compareTaskList[0].VisitTaskId;
|
||||||
|
}
|
||||||
|
else if (index > 0 && !compareTaskList[index - 1].NewTargetLesionAssessmentIsIUorIC)
|
||||||
|
{
|
||||||
|
return compareTaskList[index - 1].VisitTaskId;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return compareTaskList[0].VisitTaskId;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return compareTaskId;
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region 计算阅片问题 外层问题
|
#region 计算阅片问题 外层问题
|
||||||
|
@ -1745,7 +1865,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||||
var tableQuestion = inDto.QuestionInfo.Where(x => x.LesionType == LesionType.TargetLesion).SelectMany(x => x.TableRowInfoList).ToList();
|
var tableQuestion = inDto.QuestionInfo.Where(x => x.LesionType == LesionType.TargetLesion).SelectMany(x => x.TableRowInfoList).ToList();
|
||||||
var lastVisitTaskId = await GetLastVisitTaskId(inDto);
|
var lastVisitTaskId = await GetLastVisitTaskId(inDto);
|
||||||
var targetLesionQuestionId = inDto.QuestionInfo.Where(x => x.QuestionType == QuestionType.TargetLesion).Select(x => x.QuestionId).FirstOrDefault();
|
var targetLesionQuestionId = inDto.QuestionInfo.Where(x => x.QuestionType == QuestionType.TargetLesion).Select(x => x.QuestionId).FirstOrDefault();
|
||||||
var firstChangeTaskId = await GetFirstChangeTaskId(inDto);
|
|
||||||
var sodQuestionId = inDto.QuestionInfo.Where(x => x.QuestionType == QuestionType.SOD).Select(x => x.QuestionId).FirstOrDefault();
|
var sodQuestionId = inDto.QuestionInfo.Where(x => x.QuestionType == QuestionType.SOD).Select(x => x.QuestionId).FirstOrDefault();
|
||||||
IRECISTTargetLesionDto resultData = new IRECISTTargetLesionDto()
|
IRECISTTargetLesionDto resultData = new IRECISTTargetLesionDto()
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue