From 5342d4d47055bf58a40060bdfa6acecf3d437a2d Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Fri, 22 Jul 2022 13:49:32 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=A1=B9=E7=9B=AE=E9=85=8D?= =?UTF-8?q?=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../IRaCIS.Core.Application.xml | 7 +++++++ .../DTO/TaskAllocationRuleViewModel.cs | 9 ++++++++ .../Service/Allocation/VisitTaskService.cs | 21 ++++++++++--------- .../Service/Allocation/_MapConfig.cs | 7 ++++++- .../TrialSiteUser/DTO/TrialConfigDTO.cs | 2 ++ .../TrialSiteUser/TrialConfigService.cs | 8 +++---- IRaCIS.Core.Domain/Allocation/VisitTask.cs | 4 +++- IRaCIS.Core.Domain/Trial/Enroll.cs | 5 ++++- .../Context/IRaCISDBContext.cs | 7 ++++++- 9 files changed, 52 insertions(+), 18 deletions(-) diff --git a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml index 4ba6ea27b..57e907e4a 100644 --- a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml +++ b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml @@ -189,6 +189,13 @@ + + + 阅片人维度 Subject统计表 + + + + 获取手动分配 未分配的Subject列表(IsHaveAssigned 传递false) diff --git a/IRaCIS.Core.Application/Service/Allocation/DTO/TaskAllocationRuleViewModel.cs b/IRaCIS.Core.Application/Service/Allocation/DTO/TaskAllocationRuleViewModel.cs index 74b8f5d47..4c85775c3 100644 --- a/IRaCIS.Core.Application/Service/Allocation/DTO/TaskAllocationRuleViewModel.cs +++ b/IRaCIS.Core.Application/Service/Allocation/DTO/TaskAllocationRuleViewModel.cs @@ -105,6 +105,15 @@ namespace IRaCIS.Core.Application.ViewModel } + public class AssignDoctorStatView : TaskAllocationRuleDTO + { + public int? AssignedSubjectCount { get; set; } + + public int? WaitDealTrialTaskCount { get; set; } + + public int? WaitDealAllTaskCount { get; set; } + } + /// TaskAllocationRuleAddOrEdit 列表查询参数模型 public class TaskAllocationRuleAddOrEdit { diff --git a/IRaCIS.Core.Application/Service/Allocation/VisitTaskService.cs b/IRaCIS.Core.Application/Service/Allocation/VisitTaskService.cs index c4df4c237..37a0686d9 100644 --- a/IRaCIS.Core.Application/Service/Allocation/VisitTaskService.cs +++ b/IRaCIS.Core.Application/Service/Allocation/VisitTaskService.cs @@ -96,16 +96,17 @@ namespace IRaCIS.Core.Application.Service.Allocation return ResponseOutput.Ok(); } - ///// - ///// 阅片人维度 Subject统计表 - ///// - ///// - ///// - //public async Task GetDoctorSubjectStat(Guid trialId ) - //{ - // var query= from enroll in _repository.Where(t=>t.TrialId==trialId) - // join user in _repository.Where() on enroll.DoctorId equals user.DoctorId - //} + /// + /// 阅片人维度 Subject统计表 + /// + /// + /// + public async Task> GetDoctorSubjectStat(Guid trialId) + { + var list = await _taskAllocationRuleRepository.Where(t => t.TrialId == trialId).ProjectTo(_mapper.ConfigurationProvider).ToListAsync(); + + return list; + } diff --git a/IRaCIS.Core.Application/Service/Allocation/_MapConfig.cs b/IRaCIS.Core.Application/Service/Allocation/_MapConfig.cs index 295ab6988..99b63005f 100644 --- a/IRaCIS.Core.Application/Service/Allocation/_MapConfig.cs +++ b/IRaCIS.Core.Application/Service/Allocation/_MapConfig.cs @@ -69,7 +69,12 @@ namespace IRaCIS.Core.Application.Service .ForMember(o => o.DoctorUser, t => t.MapFrom(u => u.Enroll.DoctorUser)) .ForMember(o => o.ReadingCategoryList, t => t.MapFrom(u => u.Enroll.EnrollReadingCategoryList.Select(t=>t.ReadingCategory).ToList())); - + CreateMap().IncludeBase() + .ForMember(o => o.AssignedSubjectCount, t => t.MapFrom(u => u.Enroll.DoctorTrialVisitTaskList.Select(t=>t.SubjectId).Distinct().Count())) + .ForMember(o => o.WaitDealAllTaskCount, t => t.MapFrom(u => u.Enroll.DoctorTrialVisitTaskList.Where(t=>t.ReadingTaskState!=ReadingTaskState.HaveSigned && t.TaskState==TaskState.Effect).Count())) + .ForMember(o => o.WaitDealTrialTaskCount, t => t.MapFrom(u => u.Trial.VisitTaskList.Where(t => t.ReadingTaskState != ReadingTaskState.HaveSigned && t.TaskState == TaskState.Effect).Count())); + + CreateMap() diff --git a/IRaCIS.Core.Application/Service/TrialSiteUser/DTO/TrialConfigDTO.cs b/IRaCIS.Core.Application/Service/TrialSiteUser/DTO/TrialConfigDTO.cs index b4ddf12a5..776ef704a 100644 --- a/IRaCIS.Core.Application/Service/TrialSiteUser/DTO/TrialConfigDTO.cs +++ b/IRaCIS.Core.Application/Service/TrialSiteUser/DTO/TrialConfigDTO.cs @@ -171,7 +171,9 @@ namespace IRaCIS.Core.Application.Contracts public TaskAllocateDefaultState FollowGlobalVisitAutoAssignDefaultState { get; set; } + public bool IsFollowJudgeTaskAutoAssign { get; set; } + public TaskAllocateDefaultState FollowJudgeTaskAutoAssignDefaultState { get; set; } } diff --git a/IRaCIS.Core.Application/Service/TrialSiteUser/TrialConfigService.cs b/IRaCIS.Core.Application/Service/TrialSiteUser/TrialConfigService.cs index 077fc131e..158a41037 100644 --- a/IRaCIS.Core.Application/Service/TrialSiteUser/TrialConfigService.cs +++ b/IRaCIS.Core.Application/Service/TrialSiteUser/TrialConfigService.cs @@ -615,10 +615,10 @@ namespace IRaCIS.Core.Application _mapper.Map(trialConfig, trialInfo); - if (_taskAllocationRuleRepository.Where(t => t.TrialId == trialConfig.TrialId && t.IsEnable && t.IsJudgeDoctor==false).Sum(t => t.PlanReadingRatio) != 100) - { - return ResponseOutput.NotOk("已启用医生比率不为百分之100"); - } + //if (_taskAllocationRuleRepository.Where(t => t.TrialId == trialConfig.TrialId && t.IsEnable && t.IsJudgeDoctor==false).Sum(t => t.PlanReadingRatio) != 100) + //{ + // return ResponseOutput.NotOk("已启用医生比率不为百分之100"); + //} return ResponseOutput.Ok(await _trialRepository.SaveChangesAsync()); } diff --git a/IRaCIS.Core.Domain/Allocation/VisitTask.cs b/IRaCIS.Core.Domain/Allocation/VisitTask.cs index 13c5ff0bc..0a9025fc1 100644 --- a/IRaCIS.Core.Domain/Allocation/VisitTask.cs +++ b/IRaCIS.Core.Domain/Allocation/VisitTask.cs @@ -98,7 +98,9 @@ namespace IRaCIS.Core.Domain.Models public TaskConsistentRule TaskConsistentRule { get; set; } - public TaskAllocationRule DoctorTaskAllocationRule { get; set; } + //public TaskAllocationRule DoctorTaskAllocationRule { get; set; } + + public Enroll Enroll { get; set; } public TaskMedicalReviewRule DoctorTaskMedicalReviewRule { get; set; } diff --git a/IRaCIS.Core.Domain/Trial/Enroll.cs b/IRaCIS.Core.Domain/Trial/Enroll.cs index f462207fc..ea25b09bc 100644 --- a/IRaCIS.Core.Domain/Trial/Enroll.cs +++ b/IRaCIS.Core.Domain/Trial/Enroll.cs @@ -66,7 +66,10 @@ namespace IRaCIS.Core.Domain.Models public User DoctorUser { get; set; } - public TaskAllocationRule TaskAllocationRule { get; set; } + + public List DoctorTrialVisitTaskList { get; set; } = new List(); + + public List EnrollReadingCategoryList { get; set; } diff --git a/IRaCIS.Core.Infra.EFCore/Context/IRaCISDBContext.cs b/IRaCIS.Core.Infra.EFCore/Context/IRaCISDBContext.cs index 8fd2f230e..7f1109c3c 100644 --- a/IRaCIS.Core.Infra.EFCore/Context/IRaCISDBContext.cs +++ b/IRaCIS.Core.Infra.EFCore/Context/IRaCISDBContext.cs @@ -88,7 +88,12 @@ namespace IRaCIS.Core.Infra.EFCore //modelBuilder.HasDbFunction(typeof(DbContext).GetMethod(nameof(GetTableList))); - modelBuilder.Entity().HasMany(t => t.DoctorVisitTaskList).WithOne(t => t.DoctorTaskAllocationRule).HasForeignKey(t => new { t.DoctorUserId, t.TrialId }).HasPrincipalKey(u => new { u.DoctorUserId, u.TrialId }); + + + + modelBuilder.Entity().HasMany(t => t.DoctorTrialVisitTaskList).WithOne(t => t.Enroll).HasForeignKey(t => new { t.DoctorUserId, t.TrialId }).HasPrincipalKey(u => new { u.DoctorUserId, u.TrialId }); + + //modelBuilder.Entity().HasMany(t => t.DoctorVisitTaskList).WithOne(t => t.DoctorTaskAllocationRule).HasForeignKey(t => new { t.DoctorUserId, t.TrialId }).HasPrincipalKey(u => new { u.DoctorUserId, u.TrialId }); modelBuilder.Entity().HasMany(t => t.DoctorVisitTaskList).WithOne(t => t.DoctorTaskMedicalReviewRule).HasForeignKey(t => new { t.DoctorUserId, t.TrialId }).HasPrincipalKey(u => new { u.DoctorUserId, u.TrialId });