diff --git a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml index c3a8d1952..219fc52d9 100644 --- a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml +++ b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml @@ -86,6 +86,12 @@ + + + IR 待阅片任务列表(Subject 维度统计) + + + IR 已阅片任务 @@ -93,6 +99,13 @@ + + + 获取IR 重阅影像阅片列表 + + + + 获取手动分配 未分配的Subject列表(IsHaveAssigned 传递false) diff --git a/IRaCIS.Core.Application/Service/Allocation/DTO/VisitTaskViewModel.cs b/IRaCIS.Core.Application/Service/Allocation/DTO/VisitTaskViewModel.cs index fcef0dcd6..2c1937ac0 100644 --- a/IRaCIS.Core.Application/Service/Allocation/DTO/VisitTaskViewModel.cs +++ b/IRaCIS.Core.Application/Service/Allocation/DTO/VisitTaskViewModel.cs @@ -48,9 +48,9 @@ namespace IRaCIS.Core.Application.ViewModel /// VisitTaskView 列表视图模型 - public class VisitTaskView: VisitTaskViewBasic + public class VisitTaskView : VisitTaskViewBasic { - + public string UserCode { get; set; } @@ -69,7 +69,7 @@ namespace IRaCIS.Core.Application.ViewModel } - public class ReadingTaskView: VisitTaskView + public class ReadingTaskView : VisitTaskView { public ReadingTaskState ReadingTaskState { get; set; } @@ -112,11 +112,38 @@ namespace IRaCIS.Core.Application.ViewModel } - public class IRHaveReadView: VisitTaskViewBasic + public class IRHaveReadView : VisitTaskViewBasic { } + public class IRUnReadSubjectView + { + + //public Guid SiteId { get; set; } + //public String TrialSiteCode { get; set; } = String.Empty; + //public Guid TrialId { 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 DateTime? SuggesteFinishedTime => UnReadTaskList.Max(t => t.SuggesteFinishedTime); + + public List UnReadTaskList { get; set; } = new List(); + } + + public class IRUnreadTaskView + { + public Guid Id { get; set; } + + public bool IsUrgent { get; set; } + public DateTime? SuggesteFinishedTime { get; set; } + } + public class HistoryReadingDoctorUser { @@ -260,7 +287,7 @@ namespace IRaCIS.Core.Application.ViewModel { public Guid SubjectId { get; set; } - public List DoctorUserIdList { get; set; }=new List (); + public List DoctorUserIdList { get; set; } = new List(); } public class AutoSubjectAssignCommand diff --git a/IRaCIS.Core.Application/Service/Allocation/VisitTaskService.cs b/IRaCIS.Core.Application/Service/Allocation/VisitTaskService.cs index b3d7b8359..70d188d75 100644 --- a/IRaCIS.Core.Application/Service/Allocation/VisitTaskService.cs +++ b/IRaCIS.Core.Application/Service/Allocation/VisitTaskService.cs @@ -188,6 +188,28 @@ namespace IRaCIS.Core.Application.Service } + /// + /// IR 待阅片任务列表(Subject 维度统计) + /// + /// + [HttpGet("{trialId:guid}")] + public async Task> GetIRUnReadSubjectTaskList(Guid trialId) + { + 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 }) + .Select(g => new IRUnReadSubjectView() + { + SubjectCode = g.Key.Code, + SubjectId = g.Key.SubjectId, + UnReadTaskCount = g.Count(), + UnReadTaskList = g.AsQueryable().Select(c => new IRUnreadTaskView() { Id = c.Id, SuggesteFinishedTime = c.SuggesteFinishedTime, IsUrgent = c.IsUrgent }).ToList() + }); + + return query.ToList(); + } + + /// /// IR 已阅片任务 @@ -224,6 +246,42 @@ namespace IRaCIS.Core.Application.Service + /// + /// 获取IR 重阅影像阅片列表 + /// + /// + /// + [HttpPost] + public async Task> GetIRReReadingTaskList(VisitTaskQuery queryVisitTask) + { + + + var visitTaskQueryable = _visitTaskRepository.Where(t => t.TrialId == queryVisitTask.TrialId) + .Where(t => t.DoctorUserId == _userInfo.Id) + .WhereIf(queryVisitTask.OriginalReReadingId != null, t => t.OriginalReReadingId == queryVisitTask.OriginalReReadingId) + .WhereIf(queryVisitTask.OriginalReReadingId == null, t => t.OriginalReReadingId != null) + + .WhereIf(queryVisitTask.SiteId != null, t => t.Subject.SiteId == queryVisitTask.SiteId) + .WhereIf(queryVisitTask.SubjectId != null, t => t.SubjectId == queryVisitTask.SubjectId) + .WhereIf(queryVisitTask.IsUrgent != null, t => t.IsUrgent == queryVisitTask.IsUrgent) + + .WhereIf(queryVisitTask.ReadingTaskState != null, t => t.ReadingTaskState == queryVisitTask.ReadingTaskState) + .WhereIf(queryVisitTask.TaskState != null, t => t.TaskState == queryVisitTask.TaskState) + .WhereIf(!string.IsNullOrEmpty(queryVisitTask.TaskName), t => t.TaskName.Contains(queryVisitTask.TaskName) || t.TaskBlindName.Contains(queryVisitTask.TaskName)) + .WhereIf(!string.IsNullOrEmpty(queryVisitTask.SubjectCode), t => t.Subject.Code.Contains(queryVisitTask.SubjectCode)) + .WhereIf(queryVisitTask.BeginAllocateDate != null, t => t.AllocateTime > queryVisitTask.BeginAllocateDate) + .WhereIf(queryVisitTask.EndAllocateDate != null, t => t.AllocateTime < queryVisitTask.EndAllocateDate.Value.AddDays(1)) + .ProjectTo(_mapper.ConfigurationProvider); + + var defalutSortArray = new string[] { nameof(VisitTask.IsUrgent) + " desc", nameof(VisitTask.SubjectId) }; + + var pageList = await visitTaskQueryable.ToPagedListAsync(queryVisitTask.PageIndex, queryVisitTask.PageSize, queryVisitTask.SortField, queryVisitTask.Asc, string.IsNullOrWhiteSpace(queryVisitTask.SortField), defalutSortArray); + + return pageList; + } + + + /// /// 获取手动分配 未分配的Subject列表(IsHaveAssigned 传递false) /// @@ -316,12 +374,11 @@ namespace IRaCIS.Core.Application.Service //var trialConfig = (await _trialRepository.Where(t => t.Id == trialId).Select(t => new { TrialId = t.Id, t.ReadingType, t.IsFollowVisitAutoAssign, t.IsFollowGlobalVisitAutoAssign, t.FollowGlobalVisitAutoAssignDefaultState, t.TaskAllocateObjEnum }).FirstOrDefaultAsync()).IfNullThrowException(); - //需要确认的Subject var subjectIdList = assignConfirmCommand.SubjectDoctorUserList.Select(t => t.SubjectId).ToList(); var taskList = _visitTaskRepository.Where(t => t.TrialId == assignConfirmCommand.TrialId && t.DoctorUserId == null, true) - .WhereIf(subjectIdList.Count() > 0 /*&& trialConfig.ReadingType==ReadingMethod.Double*/, t => subjectIdList.Contains(t.SubjectId) && t.Subject.SubjectDoctorList.Any()) + .WhereIf(subjectIdList.Count() > 0 , t => subjectIdList.Contains(t.SubjectId) && t.Subject.SubjectDoctorList.Any()) .ToList();