diff --git a/IRaCIS.Core.Application/Service/Allocation/VisitTaskService.cs b/IRaCIS.Core.Application/Service/Allocation/VisitTaskService.cs index 70ecc1b30..09ffc17d9 100644 --- a/IRaCIS.Core.Application/Service/Allocation/VisitTaskService.cs +++ b/IRaCIS.Core.Application/Service/Allocation/VisitTaskService.cs @@ -907,22 +907,10 @@ namespace IRaCIS.Core.Application.Service.Allocation // .Where(t => t.UnReadTaskCount > 0); - var visitGroupQuery = _visitTaskRepository.Where(x => x.TrialId == trialId && x.DoctorUserId == _userInfo.Id) - .Where(x => !x.Subject.IsDeleted) - .Where(t => (t.ReadingTaskState != ReadingTaskState.HaveSigned && t.TaskState == TaskState.Effect)||t.ReReadingApplyState==ReReadingApplyState.HaveApplyed) - .GroupBy(x => new { x.SubjectId, x.Subject.Code, x.BlindSubjectCode }); - - var visitTaskQuery = visitGroupQuery.Select(x => new IRUnReadSubjectView() - { - SubjectId = x.Key.SubjectId, - SubjectCode = x.Key.BlindSubjectCode == string.Empty ? x.Key.Code : x.Key.BlindSubjectCode, - UnReadTaskCount = x.Where(y=>y.ReReadingApplyState!= ReReadingApplyState.HaveApplyed).Count(), - ExixtsReadingApply=x.Any(y=>y.ReReadingApplyState== ReReadingApplyState.HaveApplyed), - UnReadTaskList = x.Where(y => y.ReReadingApplyState != ReReadingApplyState.HaveApplyed).Select(u => new IRUnreadTaskView() { Id = u.Id, IsUrgent = u.IsUrgent, SuggesteFinishedTime = u.SuggesteFinishedTime }).ToList(), - }).Where(x=>x.UnReadTaskCount>0); + var visitTaskQuery = GetOrderReadingIQueryable(trialId); var totalCount = visitGroupQuery.Count(); - var currentPageData = await visitTaskQuery.OrderBy(x => x.SubjectId).Skip((iRUnReadSubjectQuery.PageIndex - 1) * iRUnReadSubjectQuery.PageSize) + var currentPageData = await visitTaskQuery.Skip((iRUnReadSubjectQuery.PageIndex - 1) * iRUnReadSubjectQuery.PageSize) .Take(iRUnReadSubjectQuery.PageSize).ToListAsync(); var result = new PageOutput() @@ -972,7 +960,29 @@ namespace IRaCIS.Core.Application.Service.Allocation } + /// + /// 获取有序阅片IQuery对象 + /// + /// + /// + public IOrderedQueryable? GetOrderReadingIQueryable(Guid trialId) + { + var visitGroupQuery = _visitTaskRepository.Where(x => x.TrialId == trialId && x.DoctorUserId == _userInfo.Id) + .Where(x => !x.Subject.IsDeleted) + .Where(t => (t.ReadingTaskState != ReadingTaskState.HaveSigned && t.TaskState == TaskState.Effect) || t.ReReadingApplyState == ReReadingApplyState.HaveApplyed) + .GroupBy(x => new { x.SubjectId, x.Subject.Code, x.BlindSubjectCode }); + var visitTaskQuery = visitGroupQuery.Select(x => new IRUnReadSubjectView() + { + SubjectId = x.Key.SubjectId, + SubjectCode = x.Key.BlindSubjectCode == string.Empty ? x.Key.Code : x.Key.BlindSubjectCode, + UnReadTaskCount = x.Where(y => y.ReReadingApplyState != ReReadingApplyState.HaveApplyed).Count(), + ExixtsReadingApply = x.Any(y => y.ReReadingApplyState == ReReadingApplyState.HaveApplyed), + UnReadTaskList = x.Where(y => y.ReReadingApplyState != ReReadingApplyState.HaveApplyed).Select(u => new IRUnreadTaskView() { Id = u.Id, IsUrgent = u.IsUrgent, SuggesteFinishedTime = u.SuggesteFinishedTime }).ToList(), + }).Where(x => x.UnReadTaskCount > 0).OrderBy(x => x.SubjectId); + + return visitTaskQuery; + } /// diff --git a/IRaCIS.Core.Application/Service/Reading/ReadingMedicalReviewService.cs b/IRaCIS.Core.Application/Service/Reading/ReadingMedicalReviewService.cs index efb36d17f..f399d810f 100644 --- a/IRaCIS.Core.Application/Service/Reading/ReadingMedicalReviewService.cs +++ b/IRaCIS.Core.Application/Service/Reading/ReadingMedicalReviewService.cs @@ -534,7 +534,7 @@ namespace IRaCIS.Core.Application.Service public async Task> GetIRMedicalFeedbackList(GetIRMedicalFeedbackListInDto inDto) { var taskMedicalReviewquery = _taskMedicalReviewRepository.Where(x => x.TrialId == inDto.TrialId).Include(x => x.VisitTask) - .Where(x => x.VisitTask.DoctorUserId == _userInfo.Id) + .Where(x => x.MedicalManagerUserId == _userInfo.Id) .Where(x=>!x.IsHaveQuestion) .Select(x => new GetIRMedicalFeedbackListOutDto {