添加表格预设
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using IRaCIS.Core.Application.Service.Reading.Dto;
|
||||
using DocumentFormat.OpenXml.EMMA;
|
||||
using IRaCIS.Core.Application.Service.Reading.Dto;
|
||||
using IRaCIS.Core.Application.ViewModel;
|
||||
using IRaCIS.Core.Domain.Share;
|
||||
using IRaCIS.Core.Infra.EFCore.Common;
|
||||
@@ -366,6 +367,8 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
var isReadingTaskViewInOrder = await _readingQuestionCriterionTrialRepository.Where(x => x.Id == taskinfo.TrialReadingCriterionId).Select(x => x.IsReadingTaskViewInOrder).FirstOrDefaultAsync();
|
||||
var baseLineVisitId = await _subjectVisitRepository.Where(x => x.SubjectId == taskinfo.SubjectId && x.IsBaseLine).Select(x => x.Id).FirstOrDefaultAsync();
|
||||
|
||||
List<ReadingTableAnswerRowInfo> addRowList = new List<ReadingTableAnswerRowInfo>();
|
||||
List<ReadingTableQuestionAnswer> addTableQuestionAnswerList = new List<ReadingTableQuestionAnswer>();
|
||||
// 判断当前任务是否是基线
|
||||
if (taskinfo.SourceSubjectVisitId != baseLineVisitId && isReadingTaskViewInOrder == ReadingOrder.InOrder)
|
||||
{
|
||||
@@ -434,13 +437,63 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
|
||||
var addList = _mapper.Map<List<ReadingTableAnswerRowInfo>>(tableRowAnswers);
|
||||
|
||||
await _readingTableAnswerRowInfoRepository.AddRangeAsync(addList);
|
||||
await _readingTableQuestionAnswerRepository.AddRangeAsync(tableAnswers);
|
||||
await _readingTableQuestionAnswerRepository.SaveChangesAsync();
|
||||
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('|'))
|
||||
{
|
||||
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,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
await _readingTableAnswerRowInfoRepository.AddRangeAsync(addRowList);
|
||||
await _readingTableQuestionAnswerRepository.AddRangeAsync(addTableQuestionAnswerList);
|
||||
await _readingTableQuestionAnswerRepository.SaveChangesAsync();
|
||||
return new AddTaskLesionAnswerFromLastTaskOutDto()
|
||||
{
|
||||
|
||||
|
||||
Reference in New Issue
Block a user