添加上一次任务的答案
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
parent
d72f3e89a2
commit
d9fc5e3646
|
@ -609,6 +609,8 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
|
|||
{
|
||||
public string Answer { get; set; }
|
||||
|
||||
public string LastTaskAnswer { get; set; }
|
||||
|
||||
public bool IsFirstChangeTask { get; set; } = false;
|
||||
public List<CrterionDictionaryGroup> CrterionDictionaryGroup { get; set; }
|
||||
|
||||
|
|
|
@ -874,10 +874,33 @@ namespace IRaCIS.Application.Services
|
|||
|
||||
var answers = new List<ReadingTaskQuestionAnswer>();
|
||||
|
||||
var lastTaskAnswer = new List<ReadingTaskQuestionAnswer>();
|
||||
|
||||
if (visitTaskId != null)
|
||||
{
|
||||
answers = await _readingTaskQuestionAnswerRepository.Where(x => x.VisitTaskId == visitTaskId).ToListAsync();
|
||||
|
||||
var taskInfo = await _visitTaskRepository.Where(x => x.Id == visitTaskId).FirstNotNullAsync();
|
||||
|
||||
var laskTaskId = await _visitTaskRepository.Where(x =>
|
||||
(x.SubjectId == taskInfo.SubjectId && x.TaskState == TaskState.Effect
|
||||
&& x.IsAnalysisCreate == taskInfo.IsAnalysisCreate
|
||||
&& x.DoctorUserId == taskInfo.DoctorUserId
|
||||
&& x.IsSelfAnalysis == taskInfo.IsSelfAnalysis
|
||||
&& x.VisitTaskNum < taskInfo.VisitTaskNum
|
||||
&& x.ArmEnum == taskInfo.ArmEnum
|
||||
&& x.TrialReadingCriterionId == taskInfo.TrialReadingCriterionId
|
||||
&& x.ReadingCategory == ReadingCategory.Visit) || x.Id == taskInfo.BeforeConvertedTaskId
|
||||
).OrderByDescending(x => x.VisitTaskNum).Select(x => x.Id).FirstOrDefaultAsync();
|
||||
if (criterionIdInfo.IsReadingTaskViewInOrder != ReadingOrder.InOrder)
|
||||
{
|
||||
// 无序的话 不要查
|
||||
laskTaskId = Guid.NewGuid();
|
||||
}
|
||||
|
||||
lastTaskAnswer = await _readingTaskQuestionAnswerRepository.Where(x => x.VisitTaskId == laskTaskId).ToListAsync();
|
||||
|
||||
|
||||
var taskinfo = await _visitTaskRepository.Where(x => x.Id == visitTaskId).ProjectTo<VisitTaskDto>(_mapper.ConfigurationProvider).FirstNotNullAsync();
|
||||
|
||||
if (taskinfo.VisitTaskNum == 0)
|
||||
|
@ -922,24 +945,28 @@ namespace IRaCIS.Application.Services
|
|||
|
||||
foreach (var item in result)
|
||||
{
|
||||
GetDicomReadingAnswer(item, questions, answers);
|
||||
GetDicomReadingAnswer(item, questions, answers, lastTaskAnswer);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
private void GetDicomReadingAnswer(DicomReadingQuestionAnswer item, List<DicomReadingQuestionAnswer> questions, List<ReadingTaskQuestionAnswer> answers)
|
||||
private void GetDicomReadingAnswer(DicomReadingQuestionAnswer item, List<DicomReadingQuestionAnswer> questions, List<ReadingTaskQuestionAnswer> answers, List<ReadingTaskQuestionAnswer> lastTaskAnswers)
|
||||
{
|
||||
var answer = answers.Where(x => x.ReadingQuestionTrialId == item.Id).Select(x => x.Answer).FirstIsNullReturnEmpty();
|
||||
item.Answer = answer.IsNullOrEmpty() ? item.DefaultValue : answer;
|
||||
|
||||
|
||||
var lastTaskAnswer = lastTaskAnswers.Where(x => x.ReadingQuestionTrialId == item.Id).Select(x => x.Answer).FirstIsNullReturnEmpty();
|
||||
item.LastTaskAnswer = lastTaskAnswer.IsNullOrEmpty() ? item.DefaultValue : lastTaskAnswer;
|
||||
|
||||
|
||||
item.Childrens = questions.Where(x => x.ParentId == item.Id || (x.GroupId == item.Id && x.ParentId == null)).ToList();
|
||||
if (item.Childrens != null && item.Childrens.Count > 0)
|
||||
{
|
||||
foreach (var question in item.Childrens)
|
||||
{
|
||||
GetDicomReadingAnswer(question, questions, answers);
|
||||
GetDicomReadingAnswer(question, questions, answers, lastTaskAnswers);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue