Uat_Study
he 2023-03-29 09:41:07 +08:00
parent 6e45ac9df8
commit 63a74b81ed
1 changed files with 21 additions and 6 deletions

View File

@ -940,7 +940,7 @@ namespace IRaCIS.Application.Services
List<ReadingTableQuestionAnswer> baseLineTableAnswer = new List<ReadingTableQuestionAnswer>();
List<ReadingTableQuestionAnswer> lastTaskTableAnswer = new List<ReadingTableQuestionAnswer>();
bool isFirstChangeTask = false;
if (inDto.TaskId != null)
@ -956,10 +956,24 @@ namespace IRaCIS.Application.Services
&& x.TaskState == TaskState.Effect
&& x.TrialReadingCriterionId == taskInfo.TrialReadingCriterionId
).Select(x => x.Id).FirstNotNullAsync();
baseLineTableAnswer = await _readingTableQuestionAnswerRepository.Where(x => x.VisitTaskId == baselineTaskId).Include(x => x.ReadingTableQuestionTrial).ToListAsync();
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();
lastTaskTableAnswer= await _readingTableQuestionAnswerRepository.Where(x => x.VisitTaskId == laskTaskId).Include(x => x.ReadingTableQuestionTrial).ToListAsync();
if (taskInfo.IsConvertedTask &&
!(await _visitTaskRepository.AnyAsync(x => x.IsAnalysisCreate == taskInfo.IsAnalysisCreate
&& x.IsSelfAnalysis == taskInfo.IsSelfAnalysis
@ -995,7 +1009,7 @@ namespace IRaCIS.Application.Services
var pageGroupList = newPageQusetionList.Where(x => x.Type == ReadingQestionType.Group).ToList();
pageGroupList.ForEach(x =>
{
this.FindChildQuestion(x, newPageQusetionList, tableQuestionList, inDto.TableAnswers, inDto.TableAnsweRowInfos, inDto.OrganInfos, baseLineTableAnswer, isFirstChangeTask);
this.FindChildQuestion(x, newPageQusetionList, tableQuestionList, inDto.TableAnswers, inDto.TableAnsweRowInfos, inDto.OrganInfos, baseLineTableAnswer, isFirstChangeTask, lastTaskTableAnswer);
});
page.Childrens = pageGroupList.Where(x => !(x.Type == ReadingQestionType.Group && x.Childrens.Count() == 0)).ToList();
@ -1012,7 +1026,7 @@ namespace IRaCIS.Application.Services
groupList = qusetionList.Where(x => x.Type == ReadingQestionType.Group).ToList();
groupList.ForEach(x =>
{
this.FindChildQuestion(x, qusetionList, tableQuestionList, inDto.TableAnswers, inDto.TableAnsweRowInfos, inDto.OrganInfos, baseLineTableAnswer, isFirstChangeTask);
this.FindChildQuestion(x, qusetionList, tableQuestionList, inDto.TableAnswers, inDto.TableAnsweRowInfos, inDto.OrganInfos, baseLineTableAnswer, isFirstChangeTask, lastTaskTableAnswer);
});
groupList = groupList.Where(x => !(x.Type == ReadingQestionType.Group && x.Childrens.Count() == 0)).ToList();
@ -1032,7 +1046,7 @@ namespace IRaCIS.Application.Services
/// <param name="item"></param>
/// <param name="questionlists"></param>
/// <param name="tableQuestionLists"></param>
private async void FindChildQuestion(TrialReadQuestionData item, List<TrialReadQuestionData> questionlists, List<TableQuestionTrial> tableQuestionLists, List<ReadingTableQuestionAnswerInfo> tableAnswers, List<TableAnsweRowInfo> tableAnsweRowInfos, List<OrganInfo> organInfos, List<ReadingTableQuestionAnswer> baseLineTableAnswer,bool isFirstChangeTask)
private async void FindChildQuestion(TrialReadQuestionData item, List<TrialReadQuestionData> questionlists, List<TableQuestionTrial> tableQuestionLists, List<ReadingTableQuestionAnswerInfo> tableAnswers, List<TableAnsweRowInfo> tableAnsweRowInfos, List<OrganInfo> organInfos, List<ReadingTableQuestionAnswer> baseLineTableAnswer,bool isFirstChangeTask, List<ReadingTableQuestionAnswer> lastTaskTableAnswer)
{
item.Childrens = questionlists.Where(x => x.ParentId == item.Id || x.GroupId == item.Id).ToList();
item.TableQuestions = new TrialReadTableQuestion();
@ -1169,6 +1183,7 @@ namespace IRaCIS.Application.Services
answers.Add("IsCurrentTaskAdd", rowInfo == null ? false.ToString() : rowInfo.IsCurrentTaskAdd.ToString());
answers.Add("SplitOrMergeLesionName", rowInfo.SplitName.IsNullOrEmpty() ? rowInfo.MergeName : rowInfo.SplitName);
answers.Add("SplitOrMergeType", rowInfo.SplitOrMergeType == null ? string.Empty : ((int)rowInfo.SplitOrMergeType).ToString());
answers.Add("LastTaskState", lastTaskTableAnswer.Where(n=>n.QuestionId== item.Id&&n.ReadingTableQuestionTrial.QuestionMark==QuestionMark.State&&n.RowIndex==x).Select(n=>n.Answer).FirstOrDefault()??string.Empty);
if (rowInfo.LesionType == LesionType.BaselineLesions)
{
answers.Add("BaseLineLesionNumber", baseLineTableAnswer.Where(n => n.ReadingTableQuestionTrial.QuestionMark == QuestionMark.LesionNumber && n.RowIndex == rowInfo.RowIndex).Select(x => x.Answer).FirstIsNullReturnEmpty());
@ -1182,7 +1197,7 @@ namespace IRaCIS.Application.Services
{
item.Childrens.ForEach(x =>
{
this.FindChildQuestion(x, questionlists, tableQuestionLists, tableAnswers, tableAnsweRowInfos, organInfos, baseLineTableAnswer, isFirstChangeTask);
this.FindChildQuestion(x, questionlists, tableQuestionLists, tableAnswers, tableAnsweRowInfos, organInfos, baseLineTableAnswer, isFirstChangeTask, lastTaskTableAnswer);
});
}
}