diff --git a/IRaCIS.Core.Application/Service/Allocation/VisitTaskService.cs b/IRaCIS.Core.Application/Service/Allocation/VisitTaskService.cs index f8b3f0f7e..27d6e93db 100644 --- a/IRaCIS.Core.Application/Service/Allocation/VisitTaskService.cs +++ b/IRaCIS.Core.Application/Service/Allocation/VisitTaskService.cs @@ -11,6 +11,7 @@ using IRaCIS.Core.Application.ViewModel; using IRaCIS.Core.Domain.Share; using IRaCIS.Core.Infrastructure; using IRaCIS.Core.Application.Contracts; +using IRaCIS.Core.Infra.EFCore.Common; namespace IRaCIS.Core.Application.Service { @@ -1004,7 +1005,7 @@ namespace IRaCIS.Core.Application.Service //产生新的任务 #region 重阅修改医学审核状态 - await _taskMedicalReviewRepository.BatchUpdateNoTrackingAsync(x => x.IsClosedDialog&&applyReReadingCommand.TaskIdList.Contains(x.VisitTaskId), x => new TaskMedicalReview() + await _taskMedicalReviewRepository.BatchUpdateNoTrackingAsync(x => x.IsClosedDialog && applyReReadingCommand.TaskIdList.Contains(x.VisitTaskId), x => new TaskMedicalReview() { IsClosedDialog = true }); @@ -1401,13 +1402,74 @@ namespace IRaCIS.Core.Application.Service [HttpGet("{taskId:guid}")] public async Task> GetReReadingInfluenceTaskList(Guid taskId) { - var filterObj = await _visitTaskRepository.FirstOrDefaultNoTrackingAsync(t => t.Id == taskId); + var filterObj = (await _visitTaskRepository.FirstOrDefaultNoTrackingAsync(t => t.Id == taskId)).IfNullThrowException(); + var trialId = filterObj.TrialId; - var list = await _visitTaskRepository.Where(t => t.TrialId == filterObj.TrialId && t.SubjectId == filterObj.SubjectId && t.VisitTaskNum >= filterObj.VisitTaskNum) - .Where(t => t.TaskState == TaskState.Effect && !t.IsAnalysisCreate) - .ProjectTo(_mapper.ConfigurationProvider).ToListAsync(); + var trialConfig = (await _trialRepository.Where(t => t.Id == trialId).Select(t => new { TrialId = t.Id, t.IsReadingTaskViewInOrder, t.ReadingType }).FirstOrDefaultAsync()).IfNullThrowException(); + + + List list = null; + + //有序 + if (trialConfig.IsReadingTaskViewInOrder) + { + //当前任务及其之后的所有访视任务、全局任务、裁判任务、肿瘤学阅片任务 + if (_userInfo.UserTypeEnumInt == (int)UserTypeEnum.IndependentReviewer) + { + list = await _visitTaskRepository.Where(t => t.TrialId == trialId && t.SubjectId == filterObj.SubjectId) + .Where(t => t.TaskState == TaskState.Effect && !t.IsAnalysisCreate) + //过滤区别 + .Where(t => t.VisitTaskNum >= filterObj.VisitTaskNum && t.DoctorUserId==filterObj.DoctorUserId) + + .ProjectTo(_mapper.ConfigurationProvider).ToListAsync(); + } + + //影响所有阅片人 + if (_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ProjectManager) + { + list = await _visitTaskRepository.Where(t => t.TrialId == trialId && t.SubjectId == filterObj.SubjectId) + .Where(t => t.TaskState == TaskState.Effect && !t.IsAnalysisCreate) + //过滤区别 + .Where(t => t.VisitTaskNum >= filterObj.VisitTaskNum ) + + .ProjectTo(_mapper.ConfigurationProvider).ToListAsync(); + } + } + //无序 + else + { + //1.当前任务及裁判任务 + //2.影响当前阅片人的任务 + if (_userInfo.UserTypeEnumInt == (int)UserTypeEnum.IndependentReviewer) + { + + list = await _visitTaskRepository.Where(t => t.TrialId == trialId && t.SubjectId == filterObj.SubjectId ) + .Where(t => t.TaskState == TaskState.Effect && !t.IsAnalysisCreate) + //过滤区别 + .Where (t=> t.Id==filterObj.Id || t.Id ==filterObj.JudgeVisitTaskId) + + .ProjectTo(_mapper.ConfigurationProvider).ToListAsync(); + + + } + + //1.当前任务及裁判任务 + // 2.影响所有阅片人的任务 + if (_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ProjectManager) + { + var judegTaskNum = filterObj.VisitTaskNum + ReadingCommon.TaskNumDic[ReadingCategory.Judge]; + + list = await _visitTaskRepository.Where(t => t.TrialId == trialId && t.SubjectId == filterObj.SubjectId) + .Where(t => t.TaskState == TaskState.Effect && !t.IsAnalysisCreate) + //过滤区别 + .Where(t => t.VisitTaskNum==filterObj.VisitTaskNum || t.VisitTaskNum== judegTaskNum) + + .ProjectTo(_mapper.ConfigurationProvider).ToListAsync(); + } + } return list; + } diff --git a/IRaCIS.Core.Infra.EFCore/Common/ReadingCommon.cs b/IRaCIS.Core.Infra.EFCore/Common/ReadingCommon.cs index f3daeaa32..0bf518096 100644 --- a/IRaCIS.Core.Infra.EFCore/Common/ReadingCommon.cs +++ b/IRaCIS.Core.Infra.EFCore/Common/ReadingCommon.cs @@ -15,13 +15,13 @@ namespace IRaCIS.Core.Infra.EFCore.Common public static class ReadingCommon { - public static Dictionary TaskNumDic = new Dictionary() + public static Dictionary TaskNumDic = new Dictionary() { - {ReadingCategory.Visit,0 }, - {ReadingCategory.Global,0.03 }, - {ReadingCategory.Judge,0.02 }, - {ReadingCategory.ReReading,0 }, - {ReadingCategory.Oncology,0 }, + {ReadingCategory.Visit, 0 }, + {ReadingCategory.Global,(decimal) 0.03 }, + {ReadingCategory.Judge,(decimal) 0.02 }, + {ReadingCategory.ReReading, 0 }, + {ReadingCategory.Oncology, 0 }, };