diff --git a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml index 5e8e3f29a..f31512e09 100644 --- a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml +++ b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml @@ -4202,9 +4202,22 @@ - + - 触发裁判任务 + 添加阅片期任务 + + + + + + 触发裁判任务(新) + + + + + + + 触发裁判任务(老) diff --git a/IRaCIS.Core.Application/Service/Allocation/DTO/VisitTaskViewModel.cs b/IRaCIS.Core.Application/Service/Allocation/DTO/VisitTaskViewModel.cs index 8b6afd434..95aa912fe 100644 --- a/IRaCIS.Core.Application/Service/Allocation/DTO/VisitTaskViewModel.cs +++ b/IRaCIS.Core.Application/Service/Allocation/DTO/VisitTaskViewModel.cs @@ -129,12 +129,12 @@ namespace IRaCIS.Core.Application.ViewModel //public String TrialSiteCode { get; set; } = String.Empty; //public Guid TrialId { get; set; } - public Guid SubjectId { get; set; } + public Guid? SubjectId { get; set; } public string SubjectCode { get; set; } = String.Empty; public bool IsUrgent => UnReadTaskList.Any(t => t.IsUrgent); - public int? UnReadTaskCount { get; set; } + public int UnReadTaskCount { get; set; } public DateTime? SuggesteFinishedTime => UnReadTaskList.Max(t => t.SuggesteFinishedTime); @@ -199,6 +199,7 @@ namespace IRaCIS.Core.Application.ViewModel public Guid TrialId { get; set; } public string SubjectCode { get; set; } + } public class SubjectAssignQuery : PageInput diff --git a/IRaCIS.Core.Application/Service/Allocation/VisitTaskService.cs b/IRaCIS.Core.Application/Service/Allocation/VisitTaskService.cs index 75e84fc23..aedc86a0f 100644 --- a/IRaCIS.Core.Application/Service/Allocation/VisitTaskService.cs +++ b/IRaCIS.Core.Application/Service/Allocation/VisitTaskService.cs @@ -190,14 +190,15 @@ namespace IRaCIS.Core.Application.Service /// - /// IR 待阅片任务列表(Subject 维度统计) + /// IR 待阅片任务列表 /// /// [HttpPost] - public async Task> GetIRUnReadSubjectTaskList(IRUnReadSubjectQuery iRUnReadSubjectQuery) + public async Task<(PageOutput,object)> GetIRUnReadSubjectTaskList(IRUnReadSubjectQuery iRUnReadSubjectQuery) { var trialId = iRUnReadSubjectQuery.TrialId; #region 按照任务的维度统计分组 + //var query = _visitTaskRepository.Where(t => t.TrialId == trialId) // .Where(t => t.DoctorUserId == _userInfo.Id && t.ReadingTaskState != ReadingTaskState.HaveSigned) // .GroupBy(t => new { t.SubjectId, t.Subject.Code }) @@ -213,21 +214,46 @@ namespace IRaCIS.Core.Application.Service #region 按照Subject 维度 + var isReadingTaskViewInOrder = await _trialRepository.Where(x => x.Id == iRUnReadSubjectQuery.TrialId).Select(x => x.IsReadingTaskViewInOrder).FirstOrDefaultAsync(); + if (isReadingTaskViewInOrder) + { + var subjectQuery = _subjectRepository.Where(t => t.TrialId == trialId) + .Where(t => t.SubjectDoctorList.Any(t => t.DoctorUserId == _userInfo.Id)) + .WhereIf(!string.IsNullOrEmpty(iRUnReadSubjectQuery.SubjectCode), t => t.Code.Contains(iRUnReadSubjectQuery.SubjectCode)) + .Select(s => new IRUnReadSubjectView() + { + SubjectId = s.Id, + SubjectCode = s.Code, + UnReadTaskCount = s.SubjectVisitTaskList.Count(t => t.ReadingTaskState != ReadingTaskState.HaveSigned && t.DoctorUserId == _userInfo.Id), + UnReadTaskList = s.SubjectVisitTaskList.Where(t => t.ReadingTaskState != ReadingTaskState.HaveSigned && t.DoctorUserId == _userInfo.Id).Select(u => new IRUnreadTaskView() { Id = u.Id, IsUrgent = u.IsUrgent, SuggesteFinishedTime = u.SuggesteFinishedTime }).ToList(), + }) + .Where(t => t.UnReadTaskCount > 0); - var subjectQuery = _subjectRepository.Where(t => t.TrialId == trialId) - .Where(t => t.SubjectDoctorList.Any(t => t.DoctorUserId == _userInfo.Id)) - .WhereIf(!string.IsNullOrEmpty(iRUnReadSubjectQuery.SubjectCode), t => t.Code.Contains(iRUnReadSubjectQuery.SubjectCode)) - .Select(s => new IRUnReadSubjectView() + + var result= await subjectQuery.ToPagedListAsync(iRUnReadSubjectQuery.PageIndex, iRUnReadSubjectQuery.PageSize, String.IsNullOrEmpty(iRUnReadSubjectQuery.SortField) ? nameof(IRUnReadSubjectView.SubjectId) : iRUnReadSubjectQuery.SortField, iRUnReadSubjectQuery.Asc); + return (result, new { + IsReadingTaskViewInOrder=isReadingTaskViewInOrder, + }); + } + else + { + var taskQuery = _trialRepository.Where(x => x.Id == trialId ) + .Select(s => new IRUnReadSubjectView() + { + SubjectId = null, + SubjectCode = String.Empty, + UnReadTaskCount = s.VisitTaskList.Count(t => t.ReadingTaskState != ReadingTaskState.HaveSigned && t.DoctorUserId == _userInfo.Id), + UnReadTaskList = s.VisitTaskList.Where(t => t.ReadingTaskState != ReadingTaskState.HaveSigned && t.DoctorUserId == _userInfo.Id).Select(u => new IRUnreadTaskView() { Id = u.Id, IsUrgent = u.IsUrgent, SuggesteFinishedTime = u.SuggesteFinishedTime }).ToList(), + }) + .Where(t => t.UnReadTaskCount > 0); + var result =await taskQuery.ToPagedListAsync(iRUnReadSubjectQuery.PageIndex, iRUnReadSubjectQuery.PageSize, String.IsNullOrEmpty(iRUnReadSubjectQuery.SortField) ? nameof(IRUnReadSubjectView.SubjectCode) : iRUnReadSubjectQuery.SortField, iRUnReadSubjectQuery.Asc); + return (result, new { - SubjectId = s.Id, - SubjectCode = s.Code, - UnReadTaskCount = s.SubjectVisitTaskList.Count(t => t.ReadingTaskState != ReadingTaskState.HaveSigned && t.DoctorUserId == _userInfo.Id), - UnReadTaskList = s.SubjectVisitTaskList.Where(t => t.ReadingTaskState != ReadingTaskState.HaveSigned && t.DoctorUserId == _userInfo.Id).Select(u => new IRUnreadTaskView() { Id = u.Id, IsUrgent = u.IsUrgent, SuggesteFinishedTime = u.SuggesteFinishedTime }).ToList(), - }) - .Where(t => t.UnReadTaskCount > 0); + IsReadingTaskViewInOrder = isReadingTaskViewInOrder, + }); - - return await subjectQuery.ToPagedListAsync(iRUnReadSubjectQuery.PageIndex, iRUnReadSubjectQuery.PageSize, String.IsNullOrEmpty(iRUnReadSubjectQuery.SortField) ? nameof(IRUnReadSubjectView.SubjectId) : iRUnReadSubjectQuery.SortField, iRUnReadSubjectQuery.Asc); + } + #endregion diff --git a/IRaCIS.Core.Application/Service/Reading/ReadingImageTaskService.cs b/IRaCIS.Core.Application/Service/Reading/ReadingImageTaskService.cs index 57a822a1f..a871815c1 100644 --- a/IRaCIS.Core.Application/Service/Reading/ReadingImageTaskService.cs +++ b/IRaCIS.Core.Application/Service/Reading/ReadingImageTaskService.cs @@ -26,7 +26,7 @@ namespace IRaCIS.Application.Services [ApiExplorerSettings(GroupName = "Reading")] public class ReadingImageTaskService : BaseService, IReadingImageTaskService { - private readonly IMapper mapper; + private readonly IRepository _noneDicomStudyRepository; private readonly IRepository _visitTaskRepository; private readonly IVisitTaskHelpeService _visitTaskHelpeService; @@ -47,7 +47,7 @@ namespace IRaCIS.Application.Services IRepository readingQuestionTrialRepository ) { - this.mapper = mapper; + base._mapper = mapper; this._noneDicomStudyRepository = noneDicomStudyRepository; this._visitTaskRepository = visitTaskRepository; this._visitTaskHelpeService = visitTaskHelpeService; @@ -99,7 +99,7 @@ namespace IRaCIS.Application.Services } else { - task = await _visitTaskRepository.Where(x => x.TrialId == trialId && x.ReadingTaskState != ReadingTaskState.HaveSigned).Select(x => new GetReadingTaskDto() + task = await _visitTaskRepository.Where(x => x.TrialId == trialId && x.ReadingTaskState != ReadingTaskState.HaveSigned && x.DoctorUserId == _userInfo.Id).Select(x => new GetReadingTaskDto() { VisistTaskId = x.Id, ReadingCategory = x.ReadingCategory,