diff --git a/IRaCIS.Core.Application/Service/Allocation/VisitTaskHelpeService.cs b/IRaCIS.Core.Application/Service/Allocation/VisitTaskHelpeService.cs index 60d3e0088..f16161c9c 100644 --- a/IRaCIS.Core.Application/Service/Allocation/VisitTaskHelpeService.cs +++ b/IRaCIS.Core.Application/Service/Allocation/VisitTaskHelpeService.cs @@ -200,9 +200,6 @@ namespace IRaCIS.Core.Application.Service #endregion - - - var followBackVisitTask = await _visitTaskRepository.Where(t => t.TrialId == trialId && t.SubjectId == subjectVisit.SubjectId && t.VisitTaskNum > subjectVisit.VisitNum && t.ReadingCategory == ReadingCategory.Visit && t.SourceSubjectVisit.CheckState != CheckStateEnum.CVPassed).OrderBy(t => t.VisitTaskNum).FirstOrDefaultAsync(); //存在退回访视1 又退回基线 这种情况 生成任务 考虑基线先一致性核查通过,但是访视1还未通过时 生成任务 diff --git a/IRaCIS.Core.Application/Service/Allocation/VisitTaskService.cs b/IRaCIS.Core.Application/Service/Allocation/VisitTaskService.cs index d2ca8d2a0..25372eacf 100644 --- a/IRaCIS.Core.Application/Service/Allocation/VisitTaskService.cs +++ b/IRaCIS.Core.Application/Service/Allocation/VisitTaskService.cs @@ -357,9 +357,9 @@ namespace IRaCIS.Core.Application.Service var visitGroupQuery = _visitTaskRepository.Where(x => x.TrialId == trialId && x.DoctorUserId == _userInfo.Id) - .Where(x=>!x.Subject.IsDeleted).Where(x => x.Subject.SubjectDoctorList.Where(y=>y.TrialId==iRUnReadSubjectQuery.TrialId&&y.DoctorUserId==_userInfo.Id).Count()>0) + .Where(x => !x.Subject.IsDeleted).Where(x => x.Subject.SubjectDoctorList.Where(y => y.TrialId == iRUnReadSubjectQuery.TrialId && y.DoctorUserId == _userInfo.Id).Count() > 0) - .Where(t => t.ReadingTaskState != ReadingTaskState.HaveSigned&&t.TaskState== TaskState.Effect) + .Where(t => t.ReadingTaskState != ReadingTaskState.HaveSigned && t.TaskState == TaskState.Effect) .GroupBy(x => new { x.SubjectId, x.Subject.Code, x.BlindSubjectCode }); var visitTaskQuery = visitGroupQuery.Select(x => new IRUnReadSubjectView() @@ -382,8 +382,8 @@ namespace IRaCIS.Core.Application.Service CurrentPageData = currentPageData, }; - /// 封装的方法有问题 - //var result = await visitQuery.ToPagedListAsync(iRUnReadSubjectQuery.PageIndex, iRUnReadSubjectQuery.PageSize, String.IsNullOrEmpty(iRUnReadSubjectQuery.SortField) ? nameof(IRUnReadSubjectView.SubjectId) : iRUnReadSubjectQuery.SortField, iRUnReadSubjectQuery.Asc); + // 封装的方法有问题 + //var result = await visitQuery.ToPagedListAsync(iRUnReadSubjectQuery.PageIndex, iRUnReadSubjectQuery.PageSize, String.IsNullOrEmpty(iRUnReadSubjectQuery.SortField) ? nameof(IRUnReadSubjectView.SubjectId) : iRUnReadSubjectQuery.SortField, iRUnReadSubjectQuery.Asc); return (result, new { RandomReadInfo = new IRUnReadOutDto(), @@ -393,7 +393,7 @@ namespace IRaCIS.Core.Application.Service else { - var taskQuery = _visitTaskRepository.Where(x => x.TrialId == iRUnReadSubjectQuery.TrialId && x.DoctorUserId == _userInfo.Id&&x.TaskState == TaskState.Effect) + var taskQuery = _visitTaskRepository.Where(x => x.TrialId == iRUnReadSubjectQuery.TrialId && x.DoctorUserId == _userInfo.Id && x.TaskState == TaskState.Effect) .Where(x => !x.Subject.IsDeleted).Where(x => x.Subject.SubjectDoctorList.Where(y => y.TrialId == iRUnReadSubjectQuery.TrialId && y.DoctorUserId == _userInfo.Id).Count() > 0); IRUnReadOutDto iRUnReadOut = new IRUnReadOutDto() @@ -740,7 +740,6 @@ namespace IRaCIS.Core.Application.Service #region 完全按照Subject 遍历去分 - //仅仅分配未应用的 而且 没有分配医生的 foreach (var subject in subjectList.Where(t => t.IsApplyed == false && !t.DoctorUserList.Any())) { @@ -1000,16 +999,9 @@ namespace IRaCIS.Core.Application.Service throw new BusinessValidationFailedException("PM 仅仅允许对访视类型的任务申请重阅"); } - - if (_userInfo.UserTypeEnumInt == (int)UserTypeEnum.IndependentReviewer && !trialConfig.IsReadingTaskViewInOrder && (task.ReadingCategory != ReadingCategory.Visit && task.ReadingCategory != ReadingCategory.Global)) + if (task.ReadingTaskState != ReadingTaskState.HaveSigned || task.TaskState != TaskState.Effect) { - throw new BusinessValidationFailedException("无序阅片,仅仅允许IR 申请 全局和访视类型类别的任务进行重阅"); - } - - - if (task.ReadingTaskState != ReadingTaskState.HaveSigned) - { - throw new BusinessValidationFailedException("未阅片完成,不允许申请重阅"); + throw new BusinessValidationFailedException("未阅片完成,或者未生效的任务不允许申请重阅"); } if (task.ReReadingApplyState == ReReadingApplyState.HaveApplyed || task.ReReadingApplyState == ReReadingApplyState.Agree) @@ -1017,6 +1009,12 @@ namespace IRaCIS.Core.Application.Service throw new BusinessValidationFailedException("重阅已申请,或者重阅已同意状态下不允许申请重阅"); } + + if (_userInfo.UserTypeEnumInt == (int)UserTypeEnum.IndependentReviewer && !trialConfig.IsReadingTaskViewInOrder && (task.ReadingCategory != ReadingCategory.Visit && task.ReadingCategory != ReadingCategory.Global)) + { + throw new BusinessValidationFailedException("无序阅片,仅仅允许IR 申请 全局和访视类型类别的任务进行重阅"); + } + if (task.ReadingCategory == ReadingCategory.Judge && task.TaskState == TaskState.HaveReturned) { throw new BusinessValidationFailedException("访视重阅导致裁判任务重置的,不能申请重阅"); @@ -1026,6 +1024,14 @@ namespace IRaCIS.Core.Application.Service && t.ReadingTaskState == ReadingTaskState.HaveSigned && t.DoctorUserId == task.DoctorUserId && t.IsAnalysisCreate == false && t.VisitTaskNum > task.VisitTaskNum; + //当前访视之前 已有任务申请 + if (trialConfig.IsReadingTaskViewInOrder && await _visitTaskRepository.AnyAsync(t => t.TrialId == task.TrialId && t.SubjectId == task.SubjectId && t.TaskState == TaskState.Effect && t.ReadingCategory==ReadingCategory.Visit + && t.ReadingTaskState == ReadingTaskState.HaveSigned && t.VisitTaskNum< task.VisitTaskNum &&( t.ReReadingApplyState == ReReadingApplyState.HaveApplyed) )) + { + return ResponseOutput.NotOk("当前为有序阅片,之前有访视已申请重阅,还未处理,当前访视不允许申请"); + } + + if (task.ReadingCategory == ReadingCategory.Judge && await _visitTaskRepository.AnyAsync(filterExpression.And(t => t.ReadingCategory == ReadingCategory.Global))) { throw new BusinessValidationFailedException("只允许申请该受试者阅片人最后一次完成全局任务重阅"); @@ -1431,7 +1437,7 @@ namespace IRaCIS.Core.Application.Service var task = (await _visitTaskRepository.Where(t => t.Id == taskId).FirstOrDefaultAsync()).IfNullThrowException(); - if (task.TaskState != TaskState.Effect || task.ReadingCategory != ReadingCategory.Visit || task.ReadingTaskState == ReadingTaskState.HaveSigned || task.TaskAllocationState==TaskAllocationState.NotAllocate) + if (task.TaskState != TaskState.Effect || task.ReadingCategory != ReadingCategory.Visit || task.ReadingTaskState == ReadingTaskState.HaveSigned || task.TaskAllocationState == TaskAllocationState.NotAllocate) { return ResponseOutput.NotOk("仅仅允许针对已分配、生效、未完成的访视任务进行退回操作,请刷新页面数据"); } @@ -1817,7 +1823,7 @@ namespace IRaCIS.Core.Application.Service throw new BusinessValidationFailedException("仅允许PM 同意 IR 申请的任务"); } } - else if(_userInfo.UserTypeEnumInt == (int)UserTypeEnum.SPM || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.CPM) + else if (_userInfo.UserTypeEnumInt == (int)UserTypeEnum.SPM || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.CPM) { //PM 影响所有阅片人 仅仅针对访视 SPM CPM 掉用 if (await _visitTaskReReadingRepository.AnyAsync(t => t.Id == applyId && t.CreateUser.UserTypeEnum == UserTypeEnum.ProjectManager) && filterObj.IsAnalysisCreate == false && filterObj.ReadingCategory == ReadingCategory.Visit) @@ -1901,7 +1907,7 @@ namespace IRaCIS.Core.Application.Service } - var list = await _visitTaskRepository.Where(filterExpression).ProjectTo(_mapper.ConfigurationProvider).ToListAsync(); + var list = await _visitTaskRepository.Where(filterExpression).OrderBy(t=>t.VisitTaskNum).ProjectTo(_mapper.ConfigurationProvider).ToListAsync(); return list;