Uat_Study
he 2023-03-24 17:06:13 +08:00
parent c9f7a2b3f7
commit 44af846e11
2 changed files with 105 additions and 1 deletions

View File

@ -40,6 +40,8 @@ namespace IRaCIS.Core.Application.Service
private readonly IRepository<ReadingTaskQuestionAnswer> _readingTaskQuestionAnswerRepository;
private readonly IRepository<ReadingTableAnswerRowInfo> _readingTableAnswerRowInfoRepository;
private readonly IRepository<ReadingTableQuestionAnswer> _readingTableQuestionAnswerRepository;
private readonly IRepository<ReadingTableQuestionTrial> _readingTableQuestionTrialRepository;
private readonly IRepository<ReadingQuestionTrial> _readingQuestionTrialRepository;
private readonly IMapper _mapper;
private readonly IUserInfo _userInfo;
private readonly IRepository<VisitTaskReReading> _visitTaskReReadingRepository;
@ -58,6 +60,8 @@ namespace IRaCIS.Core.Application.Service
IRepository<ReadingTaskQuestionAnswer> readingTaskQuestionAnswerRepository,
IRepository<ReadingTableAnswerRowInfo> readingTableAnswerRowInfoRepository,
IRepository<ReadingTableQuestionAnswer> readingTableQuestionAnswerRepository,
IRepository<ReadingTableQuestionTrial> readingTableQuestionTrialRepository,
IRepository<ReadingQuestionTrial> readingQuestionTrialRepository,
IRepository<ReadingJudgeInfo> readingJudgeInfoRepository,
IRepository<TaskAllocationRule> taskAllocationRuleRepository, IMapper mapper, IUserInfo userInfo, IRepository<VisitTaskReReading> visitTaskReReadingRepository,
IRepository<ReadingQuestionCriterionTrial> trialReadingCriterionRepository, IRepository<ClinicalDataTrialSet> trialClinicalDataSetRepository, IRepository<ReadingClinicalData> readingClinicalDataRepository,
@ -72,6 +76,8 @@ namespace IRaCIS.Core.Application.Service
this._readingTaskQuestionAnswerRepository = readingTaskQuestionAnswerRepository;
this._readingTableAnswerRowInfoRepository = readingTableAnswerRowInfoRepository;
this._readingTableQuestionAnswerRepository = readingTableQuestionAnswerRepository;
this._readingTableQuestionTrialRepository = readingTableQuestionTrialRepository;
this._readingQuestionTrialRepository = readingQuestionTrialRepository;
_provider = provider;
_subjectVisitRepository = subjectVisitRepository;
this._readingJudgeInfoRepository = readingJudgeInfoRepository;
@ -108,6 +114,9 @@ namespace IRaCIS.Core.Application.Service
/// <returns></returns>
public async Task AddConvertedTask(Guid taskId)
{
var originalTask = await _visitTaskRepository.Where(x => x.Id == taskId).Include(x => x.TrialReadingCriterion).FirstNotNullAsync();
var taskInfo = await _visitTaskRepository.Where(x => x.Id == taskId).IgnoreAutoIncludes().AsNoTracking().FirstNotNullAsync();
taskInfo.ReadingTaskState = ReadingTaskState.Reading;
taskInfo.IsConvertedTask = true;
@ -170,6 +179,71 @@ namespace IRaCIS.Core.Application.Service
x.RowId = tableRowAnswers.Where(y => y.OriginalId == x.RowId).Select(x => x.Id).FirstOrDefault();
});
var addrowInfo = _mapper.Map<List<ReadingTableAnswerRowInfo>>(tableRowAnswers);
switch (originalTask.TrialReadingCriterion.CriterionType)
{
case CriterionType.IRECIST1Point1:
//非靶病灶全部数据复制,不可更改。支持如果状态为:显著增大需要自动改为: 显著增大(iUPD)
var stateQuestionId = await _readingTableQuestionTrialRepository.Where(x => x.TrialCriterionId == originalTask.TrialReadingCriterionId
&& x.ReadingQuestionTrial.LesionType == LesionType.NonTargetLesions && x.QuestionMark == QuestionMark.State).Select(x=>x.Id).FirstOrDefaultAsync();
tableAnswer.ForEach(x =>
{
if (x.TableQuestionId == stateQuestionId && x.Answer.EqEnum(NoTargetState.Increase))
{
x.Answer = NoTargetState.IUPD.GetEnumInt();
}
});
// 新转换为其它既往新病灶: 状态为消失、疑似、无法评估的新病灶自动转换为:其它既往新病灶,且不可以编辑
// 找到新病灶问题
var newLesionQuestion = await _readingQuestionTrialRepository.Where(x => x.ReadingQuestionCriterionTrialId == originalTask.TrialReadingCriterionId && x.LesionType == LesionType.NewLesions).FirstOrDefaultAsync();
// 找到其他既往新病灶
var otherLesionQuestion = await _readingQuestionTrialRepository.Where(x => x.ReadingQuestionCriterionTrialId == originalTask.TrialReadingCriterionId && x.LesionType == LesionType.OtherPreviousNewLesion).FirstOrDefaultAsync();
if (newLesionQuestion != null && otherLesionQuestion != null)
{
// 找到表格问题
var newLesionTableQuestionList = await _readingTableQuestionTrialRepository.Where(x => x.ReadingQuestionId == newLesionQuestion.Id).ToListAsync();
// 找到表格问题
var otherLesionTableQuestionList = await _readingTableQuestionTrialRepository.Where(x => x.ReadingQuestionId == otherLesionQuestion.Id).ToListAsync();
addrowInfo.ForEach(x =>
{
if (x.QuestionId == newLesionQuestion.Id)
{
x.QuestionId = otherLesionQuestion.Id;
x.OrderMark = otherLesionQuestion.OrderMark;
x.RowMark = otherLesionQuestion.OrderMark+x.RowIndex.GetLesionMark();
}
});
tableAnswer.ForEach(x =>
{
if (x.QuestionId == newLesionQuestion.Id)
{
x.QuestionId = otherLesionQuestion.Id;
var newLesionTableQuestion = newLesionTableQuestionList.Where(y => y.Id == x.TableQuestionId).FirstOrDefault();
if (newLesionTableQuestion != null)
{
x.TableQuestionId = otherLesionTableQuestionList.Where(y => y.QuestionMark == newLesionTableQuestion.QuestionMark).Select(x => x.Id).FirstOrDefault();
}
}
});
}
break;
}
await _readingTaskQuestionAnswerRepository.AddRangeAsync(taskAnswer);
await _readingTableAnswerRowInfoRepository.AddRangeAsync(addrowInfo);
await _readingTableQuestionAnswerRepository.AddRangeAsync(tableAnswer);

View File

@ -648,7 +648,17 @@ namespace IRaCIS.Core.Domain.Share
/// <summary>
/// 消失
/// </summary>
Loss = 3
Loss = 3,
/// <summary>
/// 显著增大iUPD
/// </summary>
IUPD = 4,
/// <summary>
/// 进一步增大iCPD
/// </summary>
ICPD = 5
}
@ -906,6 +916,26 @@ namespace IRaCIS.Core.Domain.Share
/// </summary>
BaselineLesions=4,
/// <summary>
/// 新靶病灶
/// </summary>
NewTargetLesion = 5,
/// <summary>
/// 新非靶病灶
/// </summary>
NewNonTargetLesion = 6,
/// <summary>
/// 其它既往新病灶
/// </summary>
OtherPreviousNewLesion = 7,
/// <summary>
/// 触发iRECSIT后的新病灶
/// </summary>
TriggeringIRECSIT = 8
}