首次添加病灶
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 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 baseLineVisitId = await _subjectVisitRepository.Where(x => x.SubjectId == taskinfo.SubjectId && x.IsBaseLine).Select(x => x.Id).FirstOrDefaultAsync();
|
||||||
|
|
||||||
|
if (!(await _readingTableQuestionAnswerRepository.AnyAsync(x => x.VisitTaskId == visitTaskId)))
|
||||||
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)
|
|
||||||
{
|
{
|
||||||
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 => {
|
marks.ForEach(x => {
|
||||||
x.RowId = x.RowIndex == num ? guid : x.RowId;
|
|
||||||
});
|
x.VisitTaskId = visitTaskId;
|
||||||
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()
|
List<ReadingTableAnswerRowInfo> rowlist = new List<ReadingTableAnswerRowInfo>();
|
||||||
{
|
List<ReadingTableQuestionAnswer> tableAnswerList = new List<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,
|
|
||||||
});
|
|
||||||
|
|
||||||
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()
|
tableAnswerList.Add(new ReadingTableQuestionAnswer()
|
||||||
{
|
{
|
||||||
Answer = otherQuestion.DefaultValue,
|
|
||||||
QuestionId = tableQuestion.Id,
|
QuestionId = tableQuestion.Id,
|
||||||
|
Answer = item.Code,
|
||||||
|
TableQuestionId = tableQuestionList.Where(x => x.QuestionMark == QuestionMark.liverSegmentation).Select(x => x.Id).FirstOrDefault(),
|
||||||
|
VisitTaskId = visitTaskId,
|
||||||
TrialId = taskinfo.TrialId,
|
TrialId = taskinfo.TrialId,
|
||||||
VisitTaskId = taskinfo.Id,
|
|
||||||
RowId = guid,
|
|
||||||
RowIndex = num,
|
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);
|
||||||
|
|
||||||
|
await _readingTaskQuestionMarkRepository.AddRangeAsync(_mapper.Map<List<ReadingTaskQuestionMark>>(marks));
|
||||||
num++;
|
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()
|
return new AddTaskLesionAnswerFromLastTaskOutDto()
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue