修改预设与复制的冲突
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 MassTransit;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using NPOI.Util;
|
||||
|
||||
namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
{
|
||||
|
|
@ -369,11 +370,59 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
|||
|
||||
List<ReadingTableAnswerRowInfo> addRowList = new List<ReadingTableAnswerRowInfo>();
|
||||
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 &&
|
||||
|
|
@ -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
|
||||
).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()
|
||||
{
|
||||
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();
|
||||
|
||||
|
||||
tableRowAnswers.ForEach(x =>
|
||||
{
|
||||
|
||||
var rowinfo = addTableQuestionAnswerList.Where(y => y.QuestionId == x.QuestionId && y.RowIndex == x.RowIndex).FirstOrDefault();
|
||||
|
||||
x.VisitTaskId = visitTaskId;
|
||||
x.IsCurrentTaskAdd = false;
|
||||
x.Id = NewId.NextGuid();
|
||||
x.Id = rowinfo == null ? NewId.NextGuid() : rowinfo.Id;
|
||||
x.SeriesId = null;
|
||||
x.InstanceId = null;
|
||||
x.MeasureData = string.Empty;
|
||||
|
|
@ -419,8 +468,6 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
|||
|
||||
});
|
||||
|
||||
|
||||
|
||||
var tableAnswers = copyTableAnswers.Select(x => new ReadingTableQuestionAnswer
|
||||
{
|
||||
Id = NewId.NextGuid(),
|
||||
|
|
@ -433,61 +480,29 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
|||
VisitTaskId = visitTaskId,
|
||||
});
|
||||
|
||||
|
||||
|
||||
var addList = _mapper.Map<List<ReadingTableAnswerRowInfo>>(tableRowAnswers);
|
||||
|
||||
addRowList.AddRange(addList);
|
||||
addTableQuestionAnswerList.AddRange(tableAnswers);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// 添加 是否预设
|
||||
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('|'))
|
||||
addRowList = addRowList.GroupBy(x => new { x.Id }).Select(x => x.ToList().FirstOrDefault()).ToList();
|
||||
addTableQuestionAnswerList = addTableQuestionAnswerList.GroupBy(x =>
|
||||
new
|
||||
{
|
||||
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++;
|
||||
}
|
||||
x.RowId,
|
||||
x.TableQuestionId,
|
||||
x.Id
|
||||
}).Select(x => new ReadingTableQuestionAnswer()
|
||||
{
|
||||
Id = NewId.NextGuid(),
|
||||
Answer = x.Select(y => y.Answer).Max() ?? string.Empty,
|
||||
QuestionId = x.Select(y => y.QuestionId).Max(),
|
||||
RowIndex = x.Select(y => y.RowIndex).Max(),
|
||||
RowId = x.Key.RowId,
|
||||
TableQuestionId = x.Key.TableQuestionId,
|
||||
TrialId = x.Select(y => y.TrialId).Max(),
|
||||
VisitTaskId = visitTaskId,
|
||||
}).ToList();
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue