diff --git a/IRaCIS.Core.Application/Service/Allocation/TaskConsistentRuleService.cs b/IRaCIS.Core.Application/Service/Allocation/TaskConsistentRuleService.cs index 70a055f8c..90d8e753e 100644 --- a/IRaCIS.Core.Application/Service/Allocation/TaskConsistentRuleService.cs +++ b/IRaCIS.Core.Application/Service/Allocation/TaskConsistentRuleService.cs @@ -77,84 +77,12 @@ namespace IRaCIS.Core.Application.Service { var filterObj = await _taskConsistentRuleRepository.FirstOrDefaultAsync(t => t.Id == inQuery.TaskConsistentRuleId); - - bool isSelfAnalysis = filterObj.CompareDoctorUserId == null; - - IQueryable subjectfilter = null; - - if (isSelfAnalysis == false) - { - //过滤不满足的Subject - - subjectfilter = _subjectUserRepository.Where(t => t.TrialId == filterObj.TrialId).GroupBy(t => t.SubjectId) - .Where(g => g.Any(t => t.DoctorUserId == filterObj.AnalysisDoctorUserId) && !g.Any(t => t.DoctorUserId == filterObj.CompareDoctorUserId)).Select(g => g.Key); - } - - var doctorUserId = isSelfAnalysis ? filterObj.AnalysisDoctorUserId : filterObj.CompareDoctorUserId; - - - #region 以任务为维度 - var group = _visitTaskRepository.Where(t => t.TrialId == filterObj.TrialId && t.IsAnalysisCreate==false) - // 自身一致性分析 - .WhereIf(isSelfAnalysis, t => t.DoctorUserId == filterObj.AnalysisDoctorUserId) - // 组内一致性分析 - .WhereIf(isSelfAnalysis == false && subjectfilter != null, t => t.DoctorUserId == filterObj.AnalysisDoctorUserId && subjectfilter.Contains(t.SubjectId)) - .Where(t => t.ReadingTaskState == ReadingTaskState.HaveSigned && t.TaskState == TaskState.Effect) - .Where(t => t.SignTime!.Value.AddDays(filterObj.IntervalWeeks * 7 + 1) > DateTime.Now) - //重阅产生的访视任务 要把之前的访视任务去除 - .Where(t => t.ReReadingApplyState == ReReadingApplyState.Default || t.ReReadingApplyState == ReReadingApplyState.Reject) - - .WhereIf(filterObj.IsHaveReadingPeriod == false, t => t.ReadingCategory == ReadingCategory.Visit) - .WhereIf(filterObj.IsHaveReadingPeriod == true, t => t.ReadingCategory == ReadingCategory.Visit || t.ReadingCategory == ReadingCategory.Global) - .GroupBy(t => t.SubjectId) - .Where(g => g.Count() >= filterObj.PlanVisitCount); - - var query = group.Select(g => new DoctorConsistentRuleSubjectView() - { - SubjectId = g.Key, - - IsHaveGeneratedTask = g.Any(c => c.Subject.SubjectVisitTaskList.Any(t => t.IsAnalysisCreate && t.DoctorUserId == doctorUserId && t.TaskConsistentRuleId == filterObj.Id)), - - VisitTaskList = g.OrderBy(t => t.VisitTaskNum) - - .Select(c => new VisitTaskSimpleView() - { - Id = c.Id, - ReadingCategory = c.ReadingCategory, - ReadingTaskState = c.ReadingTaskState, - TaskBlindName = c.TaskBlindName, - TaskCode = c.TaskCode, - TaskName = c.TaskName, - TaskState = c.TaskState, - ArmEnum = c.ArmEnum, - SubjectId = c.SubjectId, - TrialId = c.TrialId, - SiteId = c.Subject.SiteId, - SubjectCode = c.Subject.Code, - TrialSiteCode = c.Subject.TrialSite.TrialSiteCode, - - RelationDoctorUserList=c.SameVisitTaskList/*Where(t=>t.ReadingTaskState == ReadingTaskState.HaveSigned && t.TaskState == TaskState.Effect)*/.Select(c=> new UserSimpleInfo() - { - FullName = c.DoctorUser.FullName, - UserCode = c.DoctorUser.UserCode, - UserId = c.DoctorUser.Id, - UserName = c.DoctorUser.UserName - }).ToList(), - - IsHaveGeneratedTask = c.Subject.SubjectVisitTaskList.Any(t => t.IsAnalysisCreate && t.DoctorUserId == doctorUserId && t.TaskConsistentRuleId == filterObj.Id), - - }).ToList(), - - ValidTaskCount = g.Count() - - }); - #endregion - - + var(group, query) = GetIQueryableDoctorConsistentRuleSubjectView(filterObj); var count = group.Count(); query = query.OrderByDescending(t => t.IsHaveGeneratedTask).Skip((inQuery.PageIndex - 1) * inQuery.PageSize); + var items = await query.Take(inQuery.PageSize).ToArrayAsync().ConfigureAwait(false); var pagedList = new PageOutput() @@ -179,6 +107,39 @@ namespace IRaCIS.Core.Application.Service { var filterObj = await _taskConsistentRuleRepository.FirstOrDefaultAsync(t => t.Id == inCommand.TaskConsistentRuleId); + var doctorUserId = filterObj.CompareDoctorUserId == null ? filterObj.AnalysisDoctorUserId : filterObj.CompareDoctorUserId; + + var (group, query) = GetIQueryableDoctorConsistentRuleSubjectView(filterObj, inCommand.SubejctIdList); + + var list = query.OrderByDescending(t=>t.IsHaveGeneratedTask).ToList(); + + foreach (var subject in list) + { + subject.VisitTaskList.Take(filterObj.PlanVisitCount).ForEach(t => { t.DoctorUserId = doctorUserId; t.TaskConsistentRuleId = filterObj.Id; }); + + + await _visitTaskCommonService.AddTaskAsync(new GenerateTaskCommand() + { + TrialId = filterObj.TrialId, + ReadingCategory = ReadingCategory.Consistent, + //产生的过滤掉已经生成的 + GenerataConsistentTaskList = subject.VisitTaskList.Where(t=>t.IsHaveGeneratedTask==false).ToList() + }); + + } + + + return ResponseOutput.Ok(); + + + } + + + + + private (IQueryable>, IQueryable) GetIQueryableDoctorConsistentRuleSubjectView(TaskConsistentRule filterObj, List? subejctIdList=null) + { + bool isSelfAnalysis = filterObj.CompareDoctorUserId == null; IQueryable subjectfilter = default; @@ -195,15 +156,17 @@ namespace IRaCIS.Core.Application.Service - var group = _visitTaskRepository.Where(t => t.TrialId == filterObj.TrialId && inCommand.SubejctIdList.Contains(t.SubjectId) && t.IsAnalysisCreate == false) + var group = _visitTaskRepository.Where(t => t.TrialId == filterObj.TrialId && t.IsAnalysisCreate == false) + + .WhereIf(subejctIdList!=null && subejctIdList?.Count>0, t => subejctIdList.Contains(t.SubjectId)) // 自身一致性分析 .WhereIf(isSelfAnalysis, t => t.DoctorUserId == filterObj.AnalysisDoctorUserId) // 组内一致性分析 .WhereIf(isSelfAnalysis == false && subjectfilter != null, t => t.DoctorUserId == filterObj.AnalysisDoctorUserId && subjectfilter.Contains(t.SubjectId)) .Where(t => t.ReadingTaskState == ReadingTaskState.HaveSigned && t.TaskState == TaskState.Effect) - .Where(t => t.SignTime!.Value.AddDays(filterObj.IntervalWeeks * 7 + 1) > DateTime.Now) + .Where(t => t.SignTime!.Value.AddDays(filterObj.IntervalWeeks * 7 + 1) > DateTime.Now) //重阅产生的访视任务 要把之前的访视任务去除 - .Where(t => t.ReReadingApplyState == ReReadingApplyState.Default || t.ReReadingApplyState == ReReadingApplyState.Reject) + .Where(t => t.ReReadingApplyState == ReReadingApplyState.Default || t.ReReadingApplyState == ReReadingApplyState.Reject) .WhereIf(filterObj.IsHaveReadingPeriod == false, t => t.ReadingCategory == ReadingCategory.Visit) .WhereIf(filterObj.IsHaveReadingPeriod == true, t => t.ReadingCategory == ReadingCategory.Visit || t.ReadingCategory == ReadingCategory.Global) @@ -217,53 +180,43 @@ namespace IRaCIS.Core.Application.Service IsHaveGeneratedTask = g.Any(c => c.Subject.SubjectVisitTaskList.Any(t => t.IsAnalysisCreate && t.DoctorUserId == doctorUserId && t.TaskConsistentRuleId == filterObj.Id)), - VisitTaskList = g.OrderBy(t => t.VisitTaskNum).Select(c => new VisitTaskSimpleView() - { - Id = c.Id, - ReadingCategory = c.ReadingCategory, - TaskBlindName = c.TaskBlindName, - TaskCode = c.TaskCode, - TaskName = c.TaskName, - TaskState = c.TaskState, - ArmEnum = c.ArmEnum, - SubjectId = c.SubjectId, - SiteId = c.Subject.SiteId, - TrialId = c.TrialId, - SubjectCode = c.Subject.Code, - TrialSiteCode = c.Subject.TrialSite.TrialSiteCode, + VisitTaskList = g.OrderBy(t => t.VisitTaskNum) - IsHaveGeneratedTask = c.Subject.SubjectVisitTaskList.Any(t => t.IsAnalysisCreate && t.DoctorUserId == doctorUserId && t.TaskConsistentRuleId == filterObj.Id), + .Select(c => new VisitTaskSimpleView() + { + Id = c.Id, + ReadingCategory = c.ReadingCategory, + ReadingTaskState = c.ReadingTaskState, + TaskBlindName = c.TaskBlindName, + TaskCode = c.TaskCode, + TaskName = c.TaskName, + TaskState = c.TaskState, + ArmEnum = c.ArmEnum, + SubjectId = c.SubjectId, + TrialId = c.TrialId, + SiteId = c.Subject.SiteId, + SubjectCode = c.Subject.Code, + TrialSiteCode = c.Subject.TrialSite.TrialSiteCode, - }).ToList(), + RelationDoctorUserList = c.SameVisitTaskList/*Where(t=>t.ReadingTaskState == ReadingTaskState.HaveSigned && t.TaskState == TaskState.Effect)*/.Select(c => new UserSimpleInfo() + { + FullName = c.DoctorUser.FullName, + UserCode = c.DoctorUser.UserCode, + UserId = c.DoctorUser.Id, + UserName = c.DoctorUser.UserName + }).ToList(), + + IsHaveGeneratedTask = c.Subject.SubjectVisitTaskList.Any(t => t.IsAnalysisCreate && t.DoctorUserId == doctorUserId && t.TaskConsistentRuleId == filterObj.Id), + + }).ToList(), ValidTaskCount = g.Count() }); - var list = query.OrderByDescending(t=>t.IsHaveGeneratedTask).ToList(); - - foreach (var subject in list) - { - subject.VisitTaskList.Take(filterObj.PlanVisitCount).ForEach(t => { t.DoctorUserId = doctorUserId; t.TaskConsistentRuleId = filterObj.Id; }); - - - await _visitTaskCommonService.AddTaskAsync(new GenerateTaskCommand() - { - TrialId = filterObj.TrialId, - ReadingCategory = ReadingCategory.Consistent, - GenerataConsistentTaskList = subject.VisitTaskList.Where(t=>t.IsHaveGeneratedTask==false).ToList() - }); - - } - - - return ResponseOutput.Ok(); - - + return (group, query); } - - /// /// 一致性分配 配置+ 统计已经生成数量统计表 /// diff --git a/IRaCIS.Core.Application/Service/Allocation/VisitTaskService.cs b/IRaCIS.Core.Application/Service/Allocation/VisitTaskService.cs index 57a3f0771..82ec696bd 100644 --- a/IRaCIS.Core.Application/Service/Allocation/VisitTaskService.cs +++ b/IRaCIS.Core.Application/Service/Allocation/VisitTaskService.cs @@ -969,21 +969,6 @@ namespace IRaCIS.Core.Application.Service task.ReReadingApplyState = ReReadingApplyState.HaveApplyed; - ////产生了裁判 - //if (task.JudgeVisitTaskId != null) - //{ - // if (task.ReadingTaskState == ReadingTaskState.WaitReading || task.ReadingTaskState == ReadingTaskState.Reading) - // { - // task.JudgeVisitTask.TaskState = TaskState.Adbandon; - // } - // else - // { - - // task.JudgeVisitTask.TaskState = TaskState.HaveReturned; - - - // } - //} var rootReReadingTaskId = _visitTaskReReadingRepository.Where(t => t.NewReReadingTaskId == task.Id).Select(u => u.RootReReadingTaskId).FirstOrDefault(); @@ -1222,7 +1207,7 @@ namespace IRaCIS.Core.Application.Service } } - + } @@ -1242,79 +1227,72 @@ namespace IRaCIS.Core.Application.Service var trialConfig = (await _trialRepository.Where(t => t.Id == trialId).Select(t => new { TrialId = t.Id, t.IsReadingTaskViewInOrder, t.ReadingType }).FirstOrDefaultAsync()).IfNullThrowException(); - if (_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ProjectManager) + var task = (await _visitTaskRepository.FirstOrDefaultAsync(t => t.Id == taskId)).IfNullThrowException(); + + //申请的任务 肯定是未完成阅片的 并且是访视类型的 + if (_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ProjectManager && task.ReadingCategory == ReadingCategory.Visit && task.ReadingTaskState != ReadingTaskState.HaveSigned) { - var task = (await _visitTaskRepository.FirstOrDefaultAsync(t => t.Id == taskId)).IfNullThrowException(); - //申请的任务 肯定是未完成阅片的 并且是访视类型的 - if (task.ReadingTaskState != ReadingTaskState.HaveSigned && task.ReadingCategory == ReadingCategory.Visit) + #region 有序 无序公用流程 + + // 当前任务标为失效 + task.TaskState = TaskState.Adbandon; + + //执行类似一致性核查回退流程 回退访视到影像上传流程 + await VisitBackAsync(task.SourceSubjectVisitId); + + + //考虑该访视 另外一个阅片人的任务 + var otherReviewerTask = await _visitTaskRepository.FirstOrDefaultAsync(t => t.SourceSubjectVisitId == task.SourceSubjectVisitId && t.Id != task.Id && t.TaskState == TaskState.Effect); + + #endregion + + //有序 + if (trialConfig.IsReadingTaskViewInOrder) { + //本身自己 有序 PM 申请回退流程 - - #region 有序 无序公用流程 - - // 当前任务标为失效 - task.TaskState = TaskState.Adbandon; - - //执行类似一致性核查回退流程 回退访视到影像上传流程 - await VisitBackAsync(task.SourceSubjectVisitId); - - - //考虑该访视 另外一个阅片人的任务 - var otherReviewerTask = await _visitTaskRepository.FirstOrDefaultAsync(t => t.SourceSubjectVisitId == task.SourceSubjectVisitId && t.Id != task.Id && t.TaskState == TaskState.Effect); - - - #endregion - - - //有序 - if (trialConfig.IsReadingTaskViewInOrder) + if (otherReviewerTask.ReadingTaskState == ReadingTaskState.HaveSigned) { - //本身自己 有序 PM 申请回退流程 - - - - - if (otherReviewerTask.ReadingTaskState == ReadingTaskState.HaveSigned) - { - //另外阅片人完成阅片了 就设置为重阅重置 - otherReviewerTask.TaskState = TaskState.HaveReturned; - - - //另外一个阅片人 有序PM 申请重阅流程 - } - else - { - - otherReviewerTask.TaskState = TaskState.Adbandon; - - - //另外一个阅片人 有序 PM 申请回退流程 - - - - } - + //另外阅片人完成阅片了 就设置为重阅重置 + otherReviewerTask.TaskState = TaskState.HaveReturned; + //另外一个阅片人 有序PM 申请重阅流程 } - //无序 无序阅片没有 全局 肿瘤学 else { - if (otherReviewerTask.ReadingTaskState == ReadingTaskState.HaveSigned) - { - //另外阅片人完成阅片了 就设置为重阅重置 - otherReviewerTask.TaskState = TaskState.HaveReturned; - } - else - { - otherReviewerTask.TaskState = TaskState.Adbandon; - } + otherReviewerTask.TaskState = TaskState.Adbandon; + + //另外一个阅片人 有序 PM 申请回退流程 + + } + + + + } + //无序 无序阅片没有 全局 肿瘤学 + else + { + if (otherReviewerTask.ReadingTaskState == ReadingTaskState.HaveSigned) + { + //另外阅片人完成阅片了 就设置为重阅重置 + otherReviewerTask.TaskState = TaskState.HaveReturned; + } + else + { + + otherReviewerTask.TaskState = TaskState.Adbandon; } } + + } + else + { + throw new BusinessValidationFailedException("仅仅未完成的访视类型的任务支持PM退回"); } await _visitTaskRepository.SaveChangesAsync(); @@ -1368,12 +1346,13 @@ namespace IRaCIS.Core.Application.Service /// - /// 重阅影响提示列表 仅仅针对已完成的任务申请 + /// 影响提示列表 重阅仅仅针对已完成的任务申请 退回针对的是未完成的(退回仅仅针对是访视类型的) /// /// + /// /// - [HttpGet("{taskId:guid}")] - public async Task> GetReReadingInfluenceTaskList(Guid taskId) + [HttpGet("{taskId:guid}/{isReReading;bool}")] + public async Task> GetReReadingOrBackInfluenceTaskList(Guid taskId, bool isReReading) { var filterObj = (await _visitTaskRepository.FirstOrDefaultNoTrackingAsync(t => t.Id == taskId)).IfNullThrowException(); var trialId = filterObj.TrialId; @@ -1382,40 +1361,120 @@ namespace IRaCIS.Core.Application.Service Expression> filterExpression = t => t.TrialId == trialId && t.SubjectId == filterObj.SubjectId && t.TaskState == TaskState.Effect; - - //有序 - if (trialConfig.IsReadingTaskViewInOrder) + //重阅影响 + if (isReReading) { - //当前任务及其之后的所有访视任务、全局任务、裁判任务、肿瘤学阅片任务 - if (_userInfo.UserTypeEnumInt == (int)UserTypeEnum.IndependentReviewer) + //有序 + if (trialConfig.IsReadingTaskViewInOrder) { - filterExpression = filterExpression.And(t => t.VisitTaskNum >= filterObj.VisitTaskNum && t.DoctorUserId == filterObj.DoctorUserId); + //当前任务及其之后的所有访视任务、全局任务、裁判任务、肿瘤学阅片任务 + if (_userInfo.UserTypeEnumInt == (int)UserTypeEnum.IndependentReviewer) + { + switch (filterObj.ReadingCategory) + { + case ReadingCategory.Visit: + + //访视影响当前医生 以及当前医生之后的 + filterExpression = filterExpression.And(t => t.VisitTaskNum >= filterObj.VisitTaskNum && t.DoctorUserId == filterObj.DoctorUserId); + + break; + + case ReadingCategory.Global: + //全局的影响所有 不加额外过滤 + break; + + case ReadingCategory.Judge: + + //裁判的仅仅影响自己 + filterExpression = filterExpression.And(t => t.Id == filterObj.Id); + + break; + case ReadingCategory.Oncology: + throw new BusinessValidationFailedException("不支持的任务类型"); + break; + + default: + throw new BusinessValidationFailedException("不支持的任务类型"); + break; + } + + } + + //影响所有阅片人 + if (_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ProjectManager) + { + switch (filterObj.ReadingCategory) + { + case ReadingCategory.Visit: + + //访视影响当前以及当前之后的 + filterExpression = filterExpression.And(t => t.VisitTaskNum >= filterObj.VisitTaskNum); + + break; + + case ReadingCategory.Global: + //全局的影响所有 不加额外过滤 + + break; + case ReadingCategory.Judge: + //裁判的仅仅影响自己 + filterExpression = filterExpression.And(t => t.Id == filterObj.Id); + + break; + case ReadingCategory.Oncology: + + throw new BusinessValidationFailedException("不支持的任务类型"); + break; + + default: + throw new BusinessValidationFailedException("不支持的任务类型"); + break; + } + } + } + //无序 + else + { + //1.当前任务及裁判任务 + //2.影响当前阅片人的任务 + if (_userInfo.UserTypeEnumInt == (int)UserTypeEnum.IndependentReviewer) + { + filterExpression = filterExpression.And(t => t.Id == filterObj.Id || t.Id == filterObj.JudgeVisitTaskId); + } + + // 1.当前任务及裁判任务 + // 2.影响所有阅片人的任务 + if (_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ProjectManager) + { + var judegTaskNum = filterObj.VisitTaskNum + ReadingCommon.TaskNumDic[ReadingCategory.Judge]; + + filterExpression = filterExpression.And(t => t.VisitTaskNum == filterObj.VisitTaskNum || t.VisitTaskNum == judegTaskNum); + } } - //影响所有阅片人 - if (_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ProjectManager) - { - filterExpression = filterExpression.And(t => t.VisitTaskNum >= filterObj.VisitTaskNum); - } } - //无序 + //退回影响 仅仅针对是访视类型的 else { - //1.当前任务及裁判任务 - //2.影响当前阅片人的任务 - if (_userInfo.UserTypeEnumInt == (int)UserTypeEnum.IndependentReviewer) + if (filterObj.ReadingCategory == ReadingCategory.Visit && _userInfo.UserTypeEnumInt == (int)UserTypeEnum.ProjectManager) { - filterExpression = filterExpression.And(t => t.Id == filterObj.Id || t.Id == filterObj.JudgeVisitTaskId); + //有序 + if (trialConfig.IsReadingTaskViewInOrder) + { + + } + //无序 + else + { + //自己和另一个人的当前任务 + filterExpression = filterExpression.And(t => t.VisitTaskNum == filterObj.VisitTaskNum); + } + } + else + { + throw new BusinessValidationFailedException("仅仅访视类型的任务支持PM退回"); } - // 1.当前任务及裁判任务 - // 2.影响所有阅片人的任务 - if (_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ProjectManager) - { - var judegTaskNum = filterObj.VisitTaskNum + ReadingCommon.TaskNumDic[ReadingCategory.Judge]; - - filterExpression = filterExpression.And(t => t.VisitTaskNum == filterObj.VisitTaskNum || t.VisitTaskNum == judegTaskNum); - } } var list = await _visitTaskRepository.Where(filterExpression).ProjectTo(_mapper.ConfigurationProvider).ToListAsync(); diff --git a/IRaCIS.Core.Application/Service/Allocation/_MapConfig.cs b/IRaCIS.Core.Application/Service/Allocation/_MapConfig.cs index 3933eec4c..6be3a6adb 100644 --- a/IRaCIS.Core.Application/Service/Allocation/_MapConfig.cs +++ b/IRaCIS.Core.Application/Service/Allocation/_MapConfig.cs @@ -165,17 +165,24 @@ namespace IRaCIS.Core.Application.Service CreateMap() .ForMember(o => o.DoctorUser, t => t.MapFrom(u => u.DoctorUser)) - .ForMember(o => o.ActualVisitTaskList, t => t.MapFrom(u => u.DoctorVisitTaskList.Where(t => t.ReadingCategory == ReadingCategory.Visit && t.TaskState == TaskState.Effect && t.ReadingTaskState == ReadingTaskState.HaveSigned).OrderBy(t => t.SignTime).Select(t => new TaskBasicIdView() { TaskId = t.Id, TrialId = t.TrialId, DoctorUserId = t.DoctorUserId }))) + .ForMember(o => o.ActualVisitTaskList, t => t.MapFrom(u => u.DoctorVisitTaskList.Where(t => t.ReadingCategory == ReadingCategory.Visit && t.TaskState == TaskState.Effect && t.ReadingTaskState == ReadingTaskState.HaveSigned) + .OrderBy(t => t.SignTime).Select(t => new TaskBasicIdView() { TaskId = t.Id, TrialId = t.TrialId, DoctorUserId = t.DoctorUserId }))) + .ForMember(o => o.ActualJudgeTaskList, t => t.MapFrom(u => u.DoctorVisitTaskList.Where(t => t.ReadingCategory == ReadingCategory.Judge && t.TaskState == TaskState.Effect && t.ReadingTaskState == ReadingTaskState.HaveSigned).OrderBy(t => t.SignTime).Select(t => new TaskBasicIdView() { TaskId = t.Id, TrialId = t.TrialId, DoctorUserId = t.DoctorUserId }))) + .ForMember(o => o.ActualGlobalTaskList, t => t.MapFrom(u => u.DoctorVisitTaskList.Where(t => t.ReadingCategory == ReadingCategory.Global && t.TaskState == TaskState.Effect && t.ReadingTaskState == ReadingTaskState.HaveSigned).OrderBy(t => t.SignTime).Select(t => new TaskBasicIdView() { TaskId = t.Id, TrialId = t.TrialId, DoctorUserId = t.DoctorUserId }))) + .ForMember(o => o.ActualTumorTaskList, t => t.MapFrom(u => u.DoctorVisitTaskList.Where(t => t.ReadingCategory == ReadingCategory.Oncology && t.TaskState == TaskState.Effect && t.ReadingTaskState == ReadingTaskState.HaveSigned).OrderBy(t => t.SignTime).Select(t => new TaskBasicIdView() { TaskId = t.Id, TrialId = t.TrialId, DoctorUserId = t.DoctorUserId }))) .ForMember(o => o.GeneratedGlobalTaskList, t => t.MapFrom(u => u.TaskMedicalReviewList.Where(t => t.VisitTask.ReadingCategory == ReadingCategory.Global && t.VisitTask.TaskState == TaskState.Effect && t.VisitTask.ReadingTaskState == ReadingTaskState.HaveSigned).OrderBy(t => t.VisitTask.SignTime).Select(t => new TaskBasicIdView() { TaskId = t.VisitTaskId, TrialId = t.TrialId, DoctorUserId = t.DoctorUserId }))) + .ForMember(o => o.GeneratedJudgeTaskList, t => t.MapFrom(u => u.TaskMedicalReviewList.Where(t => t.VisitTask.ReadingCategory == ReadingCategory.Judge && t.VisitTask.TaskState == TaskState.Effect && t.VisitTask.ReadingTaskState == ReadingTaskState.HaveSigned).OrderBy(t => t.VisitTask.SignTime).Select(t => new TaskBasicIdView() { TaskId = t.VisitTaskId, TrialId = t.TrialId, DoctorUserId = t.DoctorUserId }))) + .ForMember(o => o.GeneratedTumorTaskList, t => t.MapFrom(u => u.TaskMedicalReviewList.Where(t => t.VisitTask.ReadingCategory == ReadingCategory.Oncology && t.VisitTask.TaskState == TaskState.Effect && t.VisitTask.ReadingTaskState == ReadingTaskState.HaveSigned).OrderBy(t => t.VisitTask.SignTime).Select(t => new TaskBasicIdView() { TaskId = t.VisitTaskId, TrialId = t.TrialId, DoctorUserId = t.DoctorUserId }))) + .ForMember(o => o.GeneratedVisitTaskList, t => t.MapFrom(u => u.TaskMedicalReviewList.Where(t => t.VisitTask.ReadingCategory == ReadingCategory.Visit && t.VisitTask.TaskState == TaskState.Effect && t.VisitTask.ReadingTaskState == ReadingTaskState.HaveSigned).OrderBy(t => t.VisitTask.SignTime).Select(t => new TaskBasicIdView() { TaskId = t.VisitTaskId, TrialId = t.TrialId, DoctorUserId = t.DoctorUserId }))); CreateMap();