From 839d72f05a593210be1040cd58648480dbf53dc8 Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Tue, 26 Jul 2022 13:04:54 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=85=A5=E7=BB=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Service/Allocation/DTO/TaskAllocationRuleViewModel.cs | 3 ++- .../Service/Allocation/TaskAllocationRuleService.cs | 2 +- IRaCIS.Core.Application/Service/Allocation/_MapConfig.cs | 4 ++-- IRaCIS.Core.Domain/Allocation/TaskAllocationRule.cs | 4 ++++ IRaCIS.Core.Domain/Reading/View/ReadModuleView.cs | 1 - IRaCIS.Core.Domain/Trial/Enroll.cs | 2 +- IRaCIS.Core.Infra.EFCore/Context/IRaCISDBContext.cs | 4 +++- 7 files changed, 13 insertions(+), 7 deletions(-) diff --git a/IRaCIS.Core.Application/Service/Allocation/DTO/TaskAllocationRuleViewModel.cs b/IRaCIS.Core.Application/Service/Allocation/DTO/TaskAllocationRuleViewModel.cs index 66db18b4f..66ceee7ee 100644 --- a/IRaCIS.Core.Application/Service/Allocation/DTO/TaskAllocationRuleViewModel.cs +++ b/IRaCIS.Core.Application/Service/Allocation/DTO/TaskAllocationRuleViewModel.cs @@ -130,8 +130,9 @@ namespace IRaCIS.Core.Application.ViewModel public Guid TrialId { get; set; } public Guid EnrollId { get; set; } - //public Guid DoctorUserId { get; set; } + [NotDefault] + public Guid DoctorUserId { get; set; } public int PlanSubjectCount { get; set; } diff --git a/IRaCIS.Core.Application/Service/Allocation/TaskAllocationRuleService.cs b/IRaCIS.Core.Application/Service/Allocation/TaskAllocationRuleService.cs index fe4856296..702b920a3 100644 --- a/IRaCIS.Core.Application/Service/Allocation/TaskAllocationRuleService.cs +++ b/IRaCIS.Core.Application/Service/Allocation/TaskAllocationRuleService.cs @@ -72,7 +72,7 @@ namespace IRaCIS.Core.Application.Service [HttpDelete("{taskAllocationRuleId:guid}")] public async Task DeleteTaskAllocationRule(Guid taskAllocationRuleId) { - if (await _taskAllocationRuleRepository.Where(t => t.Id == taskAllocationRuleId).AnyAsync(t => t.Enroll.DoctorTrialVisitTaskList.Any())) + if (await _taskAllocationRuleRepository.Where(t => t.Id == taskAllocationRuleId).AnyAsync(t => t.DoctorUser.VisitTaskList.Any())) { return ResponseOutput.NotOk("已分配任务给该医生,不允许删除"); } diff --git a/IRaCIS.Core.Application/Service/Allocation/_MapConfig.cs b/IRaCIS.Core.Application/Service/Allocation/_MapConfig.cs index 7eb8ff08e..fa37d47e8 100644 --- a/IRaCIS.Core.Application/Service/Allocation/_MapConfig.cs +++ b/IRaCIS.Core.Application/Service/Allocation/_MapConfig.cs @@ -70,8 +70,8 @@ namespace IRaCIS.Core.Application.Service .ForMember(o => o.ReadingCategoryList, t => t.MapFrom(u => u.Enroll.EnrollReadingCategoryList.OrderBy(t => t.ReadingCategory).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.WaitDealTrialTaskCount, t => t.MapFrom(u => u.Enroll.DoctorTrialVisitTaskList.Where(t=>t.ReadingTaskState!=ReadingTaskState.HaveSigned && t.TaskState==TaskState.Effect).Count())) + .ForMember(o => o.AssignedSubjectCount, t => t.MapFrom(u => u.DoctorUser.VisitTaskList.Where(t=>t.TrialId==u.TrialId).Select(t=>t.SubjectId).Distinct().Count())) + .ForMember(o => o.WaitDealTrialTaskCount, t => t.MapFrom(u => u.DoctorUser.VisitTaskList.Where(t => t.TrialId == u.TrialId).Where(t=>t.ReadingTaskState!=ReadingTaskState.HaveSigned && t.TaskState==TaskState.Effect).Count())) .ForMember(o => o.WaitDealAllTaskCount, t => t.MapFrom(u => u.DoctorUser.VisitTaskList.Where(t => t.ReadingTaskState != ReadingTaskState.HaveSigned && t.TaskState == TaskState.Effect).Count())); diff --git a/IRaCIS.Core.Domain/Allocation/TaskAllocationRule.cs b/IRaCIS.Core.Domain/Allocation/TaskAllocationRule.cs index 28f682b59..a8e1e3c58 100644 --- a/IRaCIS.Core.Domain/Allocation/TaskAllocationRule.cs +++ b/IRaCIS.Core.Domain/Allocation/TaskAllocationRule.cs @@ -36,6 +36,10 @@ namespace IRaCIS.Core.Domain.Models public Enroll Enroll { get; set; } + + + + //是否是裁判医生 裁判医生单独加入 public bool IsJudgeDoctor { get; set; } public Guid DoctorUserId { get; set; } diff --git a/IRaCIS.Core.Domain/Reading/View/ReadModuleView.cs b/IRaCIS.Core.Domain/Reading/View/ReadModuleView.cs index f2f64da9b..66780ca28 100644 --- a/IRaCIS.Core.Domain/Reading/View/ReadModuleView.cs +++ b/IRaCIS.Core.Domain/Reading/View/ReadModuleView.cs @@ -1,5 +1,4 @@ using IRaCIS.Core.Domain.Share; -using IRaCIS.Core.Domain.Share; using System; using System.Collections.Generic; using System.Linq; diff --git a/IRaCIS.Core.Domain/Trial/Enroll.cs b/IRaCIS.Core.Domain/Trial/Enroll.cs index 611031f58..8a653ce73 100644 --- a/IRaCIS.Core.Domain/Trial/Enroll.cs +++ b/IRaCIS.Core.Domain/Trial/Enroll.cs @@ -67,7 +67,7 @@ namespace IRaCIS.Core.Domain.Models public User DoctorUser { get; set; } - public List DoctorTrialVisitTaskList { get; set; } = new List(); + //public List DoctorTrialVisitTaskList { get; set; } = new List(); diff --git a/IRaCIS.Core.Infra.EFCore/Context/IRaCISDBContext.cs b/IRaCIS.Core.Infra.EFCore/Context/IRaCISDBContext.cs index 8b267cefb..a877d9c4f 100644 --- a/IRaCIS.Core.Infra.EFCore/Context/IRaCISDBContext.cs +++ b/IRaCIS.Core.Infra.EFCore/Context/IRaCISDBContext.cs @@ -92,7 +92,9 @@ namespace IRaCIS.Core.Infra.EFCore modelBuilder.Entity().HasMany(t => t.VisitTaskList).WithOne(t => t.DoctorUser).HasForeignKey(t => t.DoctorUserId); - modelBuilder.Entity().HasOne(t => t.Enroll).WithMany(t => t.DoctorTrialVisitTaskList).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 }).IsRequired(false); + + //modelBuilder.Entity().HasOne(t => t.Enroll).WithMany(t => t.DoctorTrialVisitTaskList).HasForeignKey(t => new { t.DoctorUserId, t.TrialId }).IsRequired(false).HasPrincipalKey(u => new { u.DoctorUserId, u.TrialId }).IsRequired(false); //modelBuilder.Entity().HasMany(t => t.DoctorVisitTaskList).WithOne(t => t.DoctorTaskAllocationRule).HasForeignKey(t => new { t.DoctorUserId, t.TrialId }).HasPrincipalKey(u => new { u.DoctorUserId, u.TrialId });