首次添加病灶
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
parent
55ea791387
commit
0dae3c000c
|
@ -364,87 +364,93 @@ 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();
|
||||
|
||||
|
||||
var dictionList = await _dictionaryRepository.Where(x => x.Parent.Code == "LiverSegmentation").OrderBy(x => x.ShowOrder).ToListAsync();
|
||||
|
||||
|
||||
var tableQuestion = await _readingQuestionTrialRepository.Where(x => x.ReadingQuestionCriterionTrialId == taskinfo.TrialReadingCriterionId && x.LesionType == LesionType.FatFraction).FirstNotNullAsync();
|
||||
|
||||
var tableQuestionList = await _readingTableQuestionTrialRepository.Where(x => x.ReadingQuestionId == tableQuestion.Id).ToListAsync();
|
||||
var LastVisitTaskId = 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.VisitTaskNum < taskinfo.VisitTaskNum && x.TaskState == TaskState.Effect && x.ArmEnum == taskinfo.ArmEnum
|
||||
).OrderByDescending(x => x.VisitTaskNum).Select(x => x.Id).FirstOrDefaultAsync();
|
||||
|
||||
|
||||
List<TableMarkInfo> marks = await _readingTaskQuestionMarkRepository.Where(x => x.VisitTaskId == LastVisitTaskId && x.RowId != null).ProjectTo<TableMarkInfo>(_mapper.ConfigurationProvider).ToListAsync();
|
||||
|
||||
|
||||
marks.ForEach(x => {
|
||||
|
||||
x.VisitTaskId = visitTaskId;
|
||||
});
|
||||
|
||||
List<ReadingTableAnswerRowInfo> rowlist = new List<ReadingTableAnswerRowInfo>();
|
||||
List<ReadingTableQuestionAnswer> tableAnswerList = new List<ReadingTableQuestionAnswer>();
|
||||
|
||||
decimal num = 1;
|
||||
foreach (var item in dictionList)
|
||||
if (!(await _readingTableQuestionAnswerRepository.AnyAsync(x => x.VisitTaskId == visitTaskId)))
|
||||
{
|
||||
var guid = NewId.NextGuid();
|
||||
|
||||
|
||||
|
||||
var dictionList = await _dictionaryRepository.Where(x => x.Parent.Code == "LiverSegmentation").OrderBy(x => x.ShowOrder).ToListAsync();
|
||||
|
||||
|
||||
var tableQuestion = await _readingQuestionTrialRepository.Where(x => x.ReadingQuestionCriterionTrialId == taskinfo.TrialReadingCriterionId && x.LesionType == LesionType.FatFraction).FirstNotNullAsync();
|
||||
|
||||
var tableQuestionList = await _readingTableQuestionTrialRepository.Where(x => x.ReadingQuestionId == tableQuestion.Id).ToListAsync();
|
||||
var LastVisitTaskId = 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.VisitTaskNum < taskinfo.VisitTaskNum && x.TaskState == TaskState.Effect && x.ArmEnum == taskinfo.ArmEnum
|
||||
).OrderByDescending(x => x.VisitTaskNum).Select(x => x.Id).FirstOrDefaultAsync();
|
||||
|
||||
|
||||
List<TableMarkInfo> marks = await _readingTaskQuestionMarkRepository.Where(x => x.VisitTaskId == LastVisitTaskId && x.RowId != null).ProjectTo<TableMarkInfo>(_mapper.ConfigurationProvider).ToListAsync();
|
||||
|
||||
|
||||
marks.ForEach(x => {
|
||||
x.RowId = x.RowIndex == num ? guid : x.RowId;
|
||||
});
|
||||
rowlist.Add(new ReadingTableAnswerRowInfo()
|
||||
{
|
||||
FristAddTaskId= visitTaskId,
|
||||
FristAddTaskNum= taskinfo.VisitTaskNum,
|
||||
IsCurrentTaskAdd=true,
|
||||
BlindName= taskinfo.TaskBlindName,
|
||||
OrderMark= tableQuestion.OrderMark+ num.GetLesionMark(),
|
||||
VisitTaskId= visitTaskId,
|
||||
TrialId= taskinfo.TrialId,
|
||||
QuestionId= tableQuestion.Id,
|
||||
RowIndex= num,
|
||||
Id= guid,
|
||||
|
||||
x.VisitTaskId = visitTaskId;
|
||||
});
|
||||
|
||||
tableAnswerList.Add(new ReadingTableQuestionAnswer()
|
||||
{
|
||||
QuestionId= tableQuestion.Id,
|
||||
Answer= item.Code,
|
||||
TableQuestionId= tableQuestionList.Where(x=>x.QuestionMark==QuestionMark.liverSegmentation).Select(x=>x.Id).FirstOrDefault(),
|
||||
VisitTaskId= visitTaskId,
|
||||
TrialId= taskinfo.TrialId,
|
||||
RowIndex= num,
|
||||
RowId= guid,
|
||||
});
|
||||
List<ReadingTableAnswerRowInfo> rowlist = new List<ReadingTableAnswerRowInfo>();
|
||||
List<ReadingTableQuestionAnswer> tableAnswerList = new List<ReadingTableQuestionAnswer>();
|
||||
|
||||
foreach (var otherQuestion in tableQuestionList.Where(x => !tableAnswerList.Any(y=>y.RowId== guid&&y.TableQuestionId==x.Id)))
|
||||
decimal num = 1;
|
||||
foreach (var item in dictionList)
|
||||
{
|
||||
var guid = NewId.NextGuid();
|
||||
marks.ForEach(x => {
|
||||
x.RowId = x.RowIndex == num ? guid : x.RowId;
|
||||
});
|
||||
rowlist.Add(new ReadingTableAnswerRowInfo()
|
||||
{
|
||||
FristAddTaskId = visitTaskId,
|
||||
FristAddTaskNum = taskinfo.VisitTaskNum,
|
||||
IsCurrentTaskAdd = true,
|
||||
BlindName = taskinfo.TaskBlindName,
|
||||
OrderMark = tableQuestion.OrderMark + num.GetLesionMark(),
|
||||
VisitTaskId = visitTaskId,
|
||||
TrialId = taskinfo.TrialId,
|
||||
QuestionId = tableQuestion.Id,
|
||||
RowIndex = num,
|
||||
Id = guid,
|
||||
});
|
||||
|
||||
tableAnswerList.Add(new ReadingTableQuestionAnswer()
|
||||
{
|
||||
Answer = otherQuestion.DefaultValue,
|
||||
QuestionId = tableQuestion.Id,
|
||||
Answer = item.Code,
|
||||
TableQuestionId = tableQuestionList.Where(x => x.QuestionMark == QuestionMark.liverSegmentation).Select(x => x.Id).FirstOrDefault(),
|
||||
VisitTaskId = visitTaskId,
|
||||
TrialId = taskinfo.TrialId,
|
||||
VisitTaskId = taskinfo.Id,
|
||||
RowId = guid,
|
||||
RowIndex = num,
|
||||
TableQuestionId = otherQuestion.Id,
|
||||
RowId = guid,
|
||||
});
|
||||
|
||||
foreach (var otherQuestion in tableQuestionList.Where(x => !tableAnswerList.Any(y => y.RowId == guid && y.TableQuestionId == x.Id)))
|
||||
{
|
||||
tableAnswerList.Add(new ReadingTableQuestionAnswer()
|
||||
{
|
||||
Answer = otherQuestion.DefaultValue,
|
||||
QuestionId = tableQuestion.Id,
|
||||
TrialId = taskinfo.TrialId,
|
||||
VisitTaskId = taskinfo.Id,
|
||||
RowId = guid,
|
||||
RowIndex = num,
|
||||
TableQuestionId = otherQuestion.Id,
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
num++;
|
||||
}
|
||||
await _readingTableAnswerRowInfoRepository.AddRangeAsync(rowlist);
|
||||
await _readingTableQuestionAnswerRepository.AddRangeAsync(tableAnswerList);
|
||||
|
||||
|
||||
num++;
|
||||
await _readingTaskQuestionMarkRepository.AddRangeAsync(_mapper.Map<List<ReadingTaskQuestionMark>>(marks));
|
||||
await _readingTableQuestionAnswerRepository.SaveChangesAsync();
|
||||
}
|
||||
await _readingTableAnswerRowInfoRepository.AddRangeAsync(rowlist);
|
||||
await _readingTableQuestionAnswerRepository.AddRangeAsync(tableAnswerList);
|
||||
|
||||
await _readingTaskQuestionMarkRepository.AddRangeAsync(_mapper.Map<List<ReadingTaskQuestionMark>>(marks));
|
||||
await _readingTableQuestionAnswerRepository.SaveChangesAsync();
|
||||
|
||||
|
||||
return new AddTaskLesionAnswerFromLastTaskOutDto()
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue