diff --git a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml index 70c7016b3..8d97e6295 100644 --- a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml +++ b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml @@ -57,6 +57,21 @@ 访视读片任务 + + + 获取随访 阅片期 全局 任务列表 + + + + + + + + 获取裁判访视任务列表 + + + + 获取手动分配 未分配的Subject列表(IsHaveAssigned 传递false) diff --git a/IRaCIS.Core.Application/Service/Allocation/DTO/VisitTaskViewModel.cs b/IRaCIS.Core.Application/Service/Allocation/DTO/VisitTaskViewModel.cs index c31136560..1edfbd19e 100644 --- a/IRaCIS.Core.Application/Service/Allocation/DTO/VisitTaskViewModel.cs +++ b/IRaCIS.Core.Application/Service/Allocation/DTO/VisitTaskViewModel.cs @@ -54,6 +54,29 @@ namespace IRaCIS.Core.Application.ViewModel } + public class JudgeVisitTaskView : VisitTaskView + { + + public string? JudgeTaskCode { get; set; } + + + public List HistoryReadingDoctorUserList { get; set; } + + } + + + + public class HistoryReadingDoctorUser + { + public Guid DoctorUserId { get; set; } + + public string UserCode { get; set; } + public string UserName { get; set; } + public string FullName { get; set; } + } + + + public class VisitTaskQuery : PageInput { @@ -114,7 +137,7 @@ namespace IRaCIS.Core.Application.ViewModel public bool IsAssignedDoctorUser { get; set; } - public bool IsAssignDoctorApplyedTask => DoctorUserList.All(t=>t.IsAssignDoctorApplyedTask) && DoctorUserList.Count>0; + public bool IsAssignDoctorApplyedTask => DoctorUserList.All(t => t.IsAssignDoctorApplyedTask) && DoctorUserList.Count > 0; public List DoctorUserIdList => DoctorUserList.Select(t => t.DoctorUserId).ToList(); diff --git a/IRaCIS.Core.Application/Service/Allocation/VisitTaskService.cs b/IRaCIS.Core.Application/Service/Allocation/VisitTaskService.cs index cc70f8bde..fd581401f 100644 --- a/IRaCIS.Core.Application/Service/Allocation/VisitTaskService.cs +++ b/IRaCIS.Core.Application/Service/Allocation/VisitTaskService.cs @@ -42,6 +42,12 @@ namespace IRaCIS.Core.Application.Service _subjectUserRepository = subjectUserRepository; } + /// + /// 获取随访 阅片期 全局 任务列表 + /// + /// + /// + /// [HttpPost] public async Task<(PageOutput, object)> GetVisitTaskList(VisitTaskQuery queryVisitTask, [FromServices] IVisitTaskHelpeService _visitTaskCommonService) { @@ -73,6 +79,40 @@ namespace IRaCIS.Core.Application.Service } + + /// + /// 获取裁判访视任务列表 + /// + /// + /// + [HttpPost] + public async Task/*, object)*/> GetJudgeVisitTaskList(VisitTaskQuery queryVisitTask) + { + + var visitTaskQueryable = _visitTaskRepository.Where(t => t.TrialId == queryVisitTask.TrialId) + .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.DoctorUserId != null, t => t.DoctorUserId == queryVisitTask.DoctorUserId) + .WhereIf(queryVisitTask.ReadingCategory != null, t => t.ReadingCategory == queryVisitTask.ReadingCategory) + .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; + //var trialTaskConfig = _trialRepository.Where(t => t.Id == queryVisitTask.TrialId).ProjectTo(_mapper.ConfigurationProvider).FirstOrDefault(); + + //return (pageList, trialTaskConfig); + } + + /// /// 获取手动分配 未分配的Subject列表(IsHaveAssigned 传递false) /// diff --git a/IRaCIS.Core.Application/Service/Allocation/_MapConfig.cs b/IRaCIS.Core.Application/Service/Allocation/_MapConfig.cs index ddd830118..4e5f1298b 100644 --- a/IRaCIS.Core.Application/Service/Allocation/_MapConfig.cs +++ b/IRaCIS.Core.Application/Service/Allocation/_MapConfig.cs @@ -16,14 +16,14 @@ namespace IRaCIS.Core.Application.Service .ForMember(o => o.UserName, t => t.MapFrom(u => u.DoctorUser.UserName)) .ForMember(o => o.FullName, t => t.MapFrom(u => u.DoctorUser.FullName)) .ForMember(o => o.UserTypeShortName, t => t.MapFrom(u => u.DoctorUser.UserTypeRole.UserTypeShortName)) - .ForMember(o => o.ArmList, t => t.MapFrom(u => u.VisitTaskList.Where(c => c.TrialId == u.TrialId).Select(t => t.ArmEnum).Distinct())) + .ForMember(o => o.ArmList, t => t.MapFrom(u => u.DoctorVisitTaskList.Where(c => c.TrialId == u.TrialId).Select(t => t.ArmEnum).Distinct())) .ForMember(o => o.TotalTaskCount, t => t.MapFrom(u => u.Trial.VisitTaskList.Count())) .ForMember(o => o.SelfTaskCount, t => t.MapFrom(u => u.Trial.VisitTaskList.Count(t => t.DoctorUserId == u.DoctorUserId))) .ForMember(o => o.TotalSubjectCount, t => t.MapFrom(u => u.Trial.SubjectList.Count())) .ForMember(o => o.SelfSubjectCount, t => t.MapFrom(u => u.Trial.SubjectDoctorUserList.Where(t => t.DoctorUserId == u.DoctorUserId).Count())); CreateMap() - .ForMember(o => o.ArmList, t => t.MapFrom(u => u.VisitTaskList.Where(c => c.TrialId == u.TrialId).Select(t => t.ArmEnum).Distinct())) + .ForMember(o => o.ArmList, t => t.MapFrom(u => u.DoctorVisitTaskList.Where(c => c.TrialId == u.TrialId).Select(t => t.ArmEnum).Distinct())) .ForMember(o => o.TotalTaskCount, t => t.MapFrom(u => u.Trial.VisitTaskList.Count())) .ForMember(o => o.SelfTaskCount, t => t.MapFrom(u => u.Trial.VisitTaskList.Count(t => t.DoctorUserId == u.DoctorUserId))); @@ -40,6 +40,23 @@ namespace IRaCIS.Core.Application.Service .ForMember(o => o.FullName, t => t.MapFrom(u => u.DoctorUser.FullName)) .ForMember(o => o.UserTypeShortName, t => t.MapFrom(u => u.DoctorUser.UserTypeRole.UserTypeShortName)); + CreateMap() + .ForMember(o => o.SiteId, t => t.MapFrom(u => u.Subject.SiteId)) + .ForMember(o => o.TrialSiteCode, t => t.MapFrom(u => u.Subject.TrialSite.TrialSiteCode)) + .ForMember(o => o.SubjectCode, t => t.MapFrom(u => u.Subject.Code)) + .ForMember(o => o.UserCode, t => t.MapFrom(u => u.DoctorUser.UserCode)) + .ForMember(o => o.UserName, t => t.MapFrom(u => u.DoctorUser.UserName)) + .ForMember(o => o.FullName, t => t.MapFrom(u => u.DoctorUser.FullName)) + .ForMember(o => o.UserTypeShortName, t => t.MapFrom(u => u.DoctorUser.UserTypeRole.UserTypeShortName)) + .ForMember(o => o.JudgeTaskCode, t => t.MapFrom(u => u.JudgeVisitTask.TaskCode)) + .ForMember(o => o.HistoryReadingDoctorUserList, t => t.MapFrom(u => u.JudgeVisitList.Select(u=>u.DoctorUser))); + + CreateMap() + .ForMember(o => o.UserCode, t => t.MapFrom(u => u.UserCode)) + .ForMember(o => o.UserName, t => t.MapFrom(u => u.UserName)) + .ForMember(o => o.FullName, t => t.MapFrom(u => u.FullName)) + .ForMember(o => o.DoctorUserId, t => t.MapFrom(u => u.Id)); + CreateMap() .ForMember(o => o.SubjectId, t => t.MapFrom(u => u.Id)) @@ -48,7 +65,7 @@ namespace IRaCIS.Core.Application.Service .ForMember(o => o.IsAssignedDoctorUser, t => t.MapFrom(u => u.SubjectDoctorList.Any())) - .ForMember(o => o.DoctorUserList, t => t.MapFrom(u => u.SubjectDoctorList.OrderByDescending(t=>t.UpdateTime))); + .ForMember(o => o.DoctorUserList, t => t.MapFrom(u => u.SubjectDoctorList.OrderByDescending(t=>t.ArmEnum))); CreateMap() //.ForMember(o => o.AssignTime, t => t.MapFrom(u => u.AssignTime)) diff --git a/IRaCIS.Core.Domain.Share/Allocation/AllocationRelation.cs b/IRaCIS.Core.Domain.Share/Allocation/AllocationRelation.cs index c95481100..b743c4b08 100644 --- a/IRaCIS.Core.Domain.Share/Allocation/AllocationRelation.cs +++ b/IRaCIS.Core.Domain.Share/Allocation/AllocationRelation.cs @@ -11,7 +11,9 @@ namespace IRaCIS.Core.Domain.Share ReadingPeriod=2, //全局 - Global=3 + Global=3, + + Judge=4 } public enum TaskState diff --git a/IRaCIS.Core.Domain/Allocation/TaskAllocationRule.cs b/IRaCIS.Core.Domain/Allocation/TaskAllocationRule.cs index c9dcacb63..adb3d2676 100644 --- a/IRaCIS.Core.Domain/Allocation/TaskAllocationRule.cs +++ b/IRaCIS.Core.Domain/Allocation/TaskAllocationRule.cs @@ -73,7 +73,7 @@ namespace IRaCIS.Core.Domain.Models - public List VisitTaskList { get; set; } = new List(); + public List DoctorVisitTaskList { get; set; } = new List(); ///// ///// Arm 组 diff --git a/IRaCIS.Core.Domain/Allocation/VisitTask.cs b/IRaCIS.Core.Domain/Allocation/VisitTask.cs index aea2b9d9c..a1595deb4 100644 --- a/IRaCIS.Core.Domain/Allocation/VisitTask.cs +++ b/IRaCIS.Core.Domain/Allocation/VisitTask.cs @@ -7,6 +7,8 @@ using System; using IRaCIS.Core.Domain.Share; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; +using System.Collections.Generic; + namespace IRaCIS.Core.Domain.Models { /// @@ -115,7 +117,20 @@ namespace IRaCIS.Core.Domain.Models public User DoctorUser { get; set; } - public TaskAllocationRule TaskAllocationRule { get; set; } + public TaskAllocationRule DoctorTaskAllocationRule { get; set; } + + //裁判任务的Id + public Guid? JudgeVisitTaskId { get; set; } + + public VisitTask JudgeVisitTask { get; set; } + + + + //对于裁判项而言,触发裁判的列表 + + public List JudgeVisitList { get; set; } + + } diff --git a/IRaCIS.Core.Infra.EFCore/Context/IRaCISDBContext.cs b/IRaCIS.Core.Infra.EFCore/Context/IRaCISDBContext.cs index 34b230f99..7aec95d82 100644 --- a/IRaCIS.Core.Infra.EFCore/Context/IRaCISDBContext.cs +++ b/IRaCIS.Core.Infra.EFCore/Context/IRaCISDBContext.cs @@ -88,8 +88,9 @@ namespace IRaCIS.Core.Infra.EFCore //modelBuilder.HasDbFunction(typeof(DbContext).GetMethod(nameof(GetTableList))); - modelBuilder.Entity().HasMany(t => t.VisitTaskList).WithOne(t => t.TaskAllocationRule).HasForeignKey(t=>t.DoctorUserId).HasPrincipalKey(u=>u.DoctorUserId); + modelBuilder.Entity().HasMany(t => t.DoctorVisitTaskList).WithOne(t => t.DoctorTaskAllocationRule).HasForeignKey(t=>t.DoctorUserId).HasPrincipalKey(u=>u.DoctorUserId); + modelBuilder.Entity().HasMany(t => t.ChildList).WithOne(t => t.Parent); if (_userInfo.IsEn_Us) {