修改预设与复制的冲突
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
parent
0b28ef5461
commit
95e0239e42
|
|
@ -5,6 +5,7 @@ using IRaCIS.Core.Domain.Share;
|
||||||
using IRaCIS.Core.Infra.EFCore.Common;
|
using IRaCIS.Core.Infra.EFCore.Common;
|
||||||
using MassTransit;
|
using MassTransit;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using NPOI.Util;
|
||||||
|
|
||||||
namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||||
{
|
{
|
||||||
|
|
@ -369,11 +370,59 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||||
|
|
||||||
List<ReadingTableAnswerRowInfo> addRowList = new List<ReadingTableAnswerRowInfo>();
|
List<ReadingTableAnswerRowInfo> addRowList = new List<ReadingTableAnswerRowInfo>();
|
||||||
List<ReadingTableQuestionAnswer> addTableQuestionAnswerList = new List<ReadingTableQuestionAnswer>();
|
List<ReadingTableQuestionAnswer> addTableQuestionAnswerList = new List<ReadingTableQuestionAnswer>();
|
||||||
// 判断当前任务是否是基线
|
|
||||||
if (taskinfo.SourceSubjectVisitId != baseLineVisitId && isReadingTaskViewInOrder == ReadingOrder.InOrder)
|
if (!(await _readingTableQuestionAnswerRepository.AnyAsync(x => x.VisitTaskId == visitTaskId)))
|
||||||
{
|
{
|
||||||
// 判断当前任务是是否有表格问题答案
|
// 添加 是否预设
|
||||||
if (!(await _readingTableQuestionAnswerRepository.AnyAsync(x => x.VisitTaskId == visitTaskId)))
|
var tableQuestionList = await _readingTableQuestionTrialRepository.Where(x => x.ReadingQuestionTrial.ReadingQuestionCriterionTrialId == taskinfo.TrialReadingCriterionId && x.IsPreinstall).Include(x => x.ReadingQuestionTrial).ToListAsync();
|
||||||
|
// 是否有预设
|
||||||
|
if (tableQuestionList.Count() > 0)
|
||||||
|
{
|
||||||
|
|
||||||
|
foreach (var tableQuestion in tableQuestionList)
|
||||||
|
{
|
||||||
|
var thisTableQuestionList = await _readingTableQuestionTrialRepository.Where(x => x.ReadingQuestionId == tableQuestion.ReadingQuestionId).ToListAsync();
|
||||||
|
|
||||||
|
decimal index = 1;
|
||||||
|
|
||||||
|
foreach (var item in tableQuestion.TypeValue.Split('|'))
|
||||||
|
{
|
||||||
|
var newRowId = NewId.NextGuid();
|
||||||
|
addRowList.Add(new ReadingTableAnswerRowInfo()
|
||||||
|
{
|
||||||
|
Id = newRowId,
|
||||||
|
QuestionId = tableQuestion.ReadingQuestionId,
|
||||||
|
VisitTaskId = taskinfo.Id,
|
||||||
|
TrialId = taskinfo.TrialId,
|
||||||
|
RowIndex = index,
|
||||||
|
IsCurrentTaskAdd = true,
|
||||||
|
BlindName = taskinfo.TaskBlindName,
|
||||||
|
OrderMark = tableQuestion.ReadingQuestionTrial.OrderMark,
|
||||||
|
FristAddTaskId = taskinfo.Id,
|
||||||
|
RowMark = tableQuestion.ReadingQuestionTrial.OrderMark + decimal.Parse(index.ToString()).GetLesionMark()
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
foreach (var thisTableQuestion in thisTableQuestionList)
|
||||||
|
{
|
||||||
|
addTableQuestionAnswerList.Add(new ReadingTableQuestionAnswer()
|
||||||
|
{
|
||||||
|
Answer = thisTableQuestion.Id == tableQuestion.Id ? item : string.Empty,
|
||||||
|
QuestionId = tableQuestion.ReadingQuestionId,
|
||||||
|
TrialId = taskinfo.TrialId,
|
||||||
|
VisitTaskId = taskinfo.Id,
|
||||||
|
RowId = newRowId,
|
||||||
|
RowIndex = index,
|
||||||
|
TableQuestionId = thisTableQuestion.Id,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
index++;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (taskinfo.SourceSubjectVisitId != baseLineVisitId && isReadingTaskViewInOrder == ReadingOrder.InOrder)
|
||||||
{
|
{
|
||||||
|
|
||||||
var LastVisitTaskId = await _visitTaskRepository.Where(x => x.ReadingCategory == ReadingCategory.Visit &&
|
var LastVisitTaskId = await _visitTaskRepository.Where(x => x.ReadingCategory == ReadingCategory.Visit &&
|
||||||
|
|
@ -384,8 +433,6 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||||
x.SubjectId == taskinfo.SubjectId && x.ReadingTaskState == ReadingTaskState.HaveSigned && x.VisitTaskNum < taskinfo.VisitTaskNum && x.TaskState == TaskState.Effect && x.ArmEnum == taskinfo.ArmEnum
|
x.SubjectId == taskinfo.SubjectId && x.ReadingTaskState == ReadingTaskState.HaveSigned && x.VisitTaskNum < taskinfo.VisitTaskNum && x.TaskState == TaskState.Effect && x.ArmEnum == taskinfo.ArmEnum
|
||||||
).OrderByDescending(x => x.VisitTaskNum).Select(x => x.Id).FirstOrDefaultAsync();
|
).OrderByDescending(x => x.VisitTaskNum).Select(x => x.Id).FirstOrDefaultAsync();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
var copyTableAnswers = await _readingTableQuestionAnswerRepository.Where(x => x.VisitTaskId == LastVisitTaskId && x.ReadingQuestionTrial.IsCopyLesions).Select(x => new CopyTableAnswerDto()
|
var copyTableAnswers = await _readingTableQuestionAnswerRepository.Where(x => x.VisitTaskId == LastVisitTaskId && x.ReadingQuestionTrial.IsCopyLesions).Select(x => new CopyTableAnswerDto()
|
||||||
{
|
{
|
||||||
Answer = x.Answer,
|
Answer = x.Answer,
|
||||||
|
|
@ -400,12 +447,14 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||||
|
|
||||||
var tableRowAnswers = await _readingTableAnswerRowInfoRepository.Where(x => x.VisitTaskId == LastVisitTaskId && x.ReadingQuestionTrial.IsCopyLesions).ProjectTo<CopyTableAnswerRowInfo>(_mapper.ConfigurationProvider).ToListAsync();
|
var tableRowAnswers = await _readingTableAnswerRowInfoRepository.Where(x => x.VisitTaskId == LastVisitTaskId && x.ReadingQuestionTrial.IsCopyLesions).ProjectTo<CopyTableAnswerRowInfo>(_mapper.ConfigurationProvider).ToListAsync();
|
||||||
|
|
||||||
|
|
||||||
tableRowAnswers.ForEach(x =>
|
tableRowAnswers.ForEach(x =>
|
||||||
{
|
{
|
||||||
|
|
||||||
|
var rowinfo = addTableQuestionAnswerList.Where(y => y.QuestionId == x.QuestionId && y.RowIndex == x.RowIndex).FirstOrDefault();
|
||||||
|
|
||||||
x.VisitTaskId = visitTaskId;
|
x.VisitTaskId = visitTaskId;
|
||||||
x.IsCurrentTaskAdd = false;
|
x.IsCurrentTaskAdd = false;
|
||||||
x.Id = NewId.NextGuid();
|
x.Id = rowinfo == null ? NewId.NextGuid() : rowinfo.Id;
|
||||||
x.SeriesId = null;
|
x.SeriesId = null;
|
||||||
x.InstanceId = null;
|
x.InstanceId = null;
|
||||||
x.MeasureData = string.Empty;
|
x.MeasureData = string.Empty;
|
||||||
|
|
@ -419,8 +468,6 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
var tableAnswers = copyTableAnswers.Select(x => new ReadingTableQuestionAnswer
|
var tableAnswers = copyTableAnswers.Select(x => new ReadingTableQuestionAnswer
|
||||||
{
|
{
|
||||||
Id = NewId.NextGuid(),
|
Id = NewId.NextGuid(),
|
||||||
|
|
@ -433,61 +480,29 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||||
VisitTaskId = visitTaskId,
|
VisitTaskId = visitTaskId,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
var addList = _mapper.Map<List<ReadingTableAnswerRowInfo>>(tableRowAnswers);
|
var addList = _mapper.Map<List<ReadingTableAnswerRowInfo>>(tableRowAnswers);
|
||||||
|
|
||||||
addRowList.AddRange(addList);
|
addRowList.AddRange(addList);
|
||||||
addTableQuestionAnswerList.AddRange(tableAnswers);
|
addTableQuestionAnswerList.AddRange(tableAnswers);
|
||||||
|
|
||||||
|
|
||||||
}
|
addRowList = addRowList.GroupBy(x => new { x.Id }).Select(x => x.ToList().FirstOrDefault()).ToList();
|
||||||
}
|
addTableQuestionAnswerList = addTableQuestionAnswerList.GroupBy(x =>
|
||||||
|
new
|
||||||
// 添加 是否预设
|
|
||||||
var tableQuestionList = await _readingTableQuestionTrialRepository.Where(x => x.ReadingQuestionTrial.ReadingQuestionCriterionTrialId == taskinfo.TrialReadingCriterionId && x.IsPreinstall).Include(x=>x.ReadingQuestionTrial).ToListAsync();
|
|
||||||
if (tableQuestionList.Count() > 0)
|
|
||||||
{
|
|
||||||
|
|
||||||
foreach (var tableQuestion in tableQuestionList)
|
|
||||||
{
|
|
||||||
var thisTableQuestionList=await _readingTableQuestionTrialRepository.Where(x => x.ReadingQuestionId == tableQuestion.ReadingQuestionId).ToListAsync();
|
|
||||||
|
|
||||||
decimal index = 1;
|
|
||||||
|
|
||||||
foreach (var item in tableQuestion.TypeValue.Split('|'))
|
|
||||||
{
|
{
|
||||||
var newRowId = NewId.NextGuid();
|
x.RowId,
|
||||||
addRowList.Add(new ReadingTableAnswerRowInfo()
|
x.TableQuestionId,
|
||||||
{
|
x.Id
|
||||||
Id = newRowId,
|
}).Select(x => new ReadingTableQuestionAnswer()
|
||||||
QuestionId = tableQuestion.ReadingQuestionId,
|
{
|
||||||
VisitTaskId = taskinfo.Id,
|
Id = NewId.NextGuid(),
|
||||||
TrialId = taskinfo.TrialId,
|
Answer = x.Select(y => y.Answer).Max() ?? string.Empty,
|
||||||
RowIndex = index,
|
QuestionId = x.Select(y => y.QuestionId).Max(),
|
||||||
IsCurrentTaskAdd = true,
|
RowIndex = x.Select(y => y.RowIndex).Max(),
|
||||||
BlindName = taskinfo.TaskBlindName,
|
RowId = x.Key.RowId,
|
||||||
OrderMark = tableQuestion.ReadingQuestionTrial.OrderMark,
|
TableQuestionId = x.Key.TableQuestionId,
|
||||||
FristAddTaskId = taskinfo.Id,
|
TrialId = x.Select(y => y.TrialId).Max(),
|
||||||
RowMark = tableQuestion.ReadingQuestionTrial.OrderMark + decimal.Parse(index.ToString()).GetLesionMark()
|
VisitTaskId = visitTaskId,
|
||||||
|
}).ToList();
|
||||||
});
|
|
||||||
|
|
||||||
foreach (var thisTableQuestion in thisTableQuestionList)
|
|
||||||
{
|
|
||||||
addTableQuestionAnswerList.Add(new ReadingTableQuestionAnswer()
|
|
||||||
{
|
|
||||||
Answer = thisTableQuestion.Id== tableQuestion.Id? item:string.Empty,
|
|
||||||
QuestionId = tableQuestion.ReadingQuestionId,
|
|
||||||
TrialId = taskinfo.TrialId,
|
|
||||||
VisitTaskId = taskinfo.Id,
|
|
||||||
RowId = newRowId,
|
|
||||||
RowIndex = index,
|
|
||||||
TableQuestionId = thisTableQuestion.Id,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
index++;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue