From c80dd824ed4d885dd7a531dbe11d152e4df613d1 Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Tue, 26 Jul 2022 13:33:33 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E9=AA=8C=E8=AF=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- IRaCIS.Core.Application/Service/Allocation/_MapConfig.cs | 8 ++++---- .../Service/WorkLoad/DoctorWorkloadService.cs | 8 ++++++++ IRaCIS.Core.Domain/Allocation/TaskMedicalReviewRule.cs | 2 +- IRaCIS.Core.Infra.EFCore/Context/IRaCISDBContext.cs | 5 +---- 4 files changed, 14 insertions(+), 9 deletions(-) diff --git a/IRaCIS.Core.Application/Service/Allocation/_MapConfig.cs b/IRaCIS.Core.Application/Service/Allocation/_MapConfig.cs index fa37d47e8..d6ad88613 100644 --- a/IRaCIS.Core.Application/Service/Allocation/_MapConfig.cs +++ b/IRaCIS.Core.Application/Service/Allocation/_MapConfig.cs @@ -204,16 +204,16 @@ namespace IRaCIS.Core.Application.Service CreateMap() .ForMember(o => o.DoctorUser, t => t.MapFrom(u => u.DoctorUser)) - .ForMember(o => o.ActualVisitTaskList, t => t.MapFrom(u => u.DoctorVisitTaskList.Where(t => t.ReadingCategory == ReadingCategory.Visit && t.IsAnalysisCreate==false && t.TaskState == TaskState.Effect + .ForMember(o => o.ActualVisitTaskList, t => t.MapFrom(u => u.DoctorTrialVisitTaskList.Where(t => t.ReadingCategory == ReadingCategory.Visit && t.IsAnalysisCreate==false && t.TaskState == TaskState.Effect && t.ReadingTaskState == ReadingTaskState.HaveSigned).OrderBy(t => t.SignTime).Select(t => new TaskBasicIdView() { TaskId = t.Id, TrialId = t.TrialId, DoctorUserId = t.DoctorUserId }))) - .ForMember(o => o.ActualJudgeTaskList, t => t.MapFrom(u => u.DoctorVisitTaskList.Where(t => t.ReadingCategory == ReadingCategory.Judge && t.IsAnalysisCreate == false && t.TaskState == TaskState.Effect && + .ForMember(o => o.ActualJudgeTaskList, t => t.MapFrom(u => u.DoctorTrialVisitTaskList.Where(t => t.ReadingCategory == ReadingCategory.Judge && t.IsAnalysisCreate == false && t.TaskState == TaskState.Effect && t.ReadingTaskState == ReadingTaskState.HaveSigned).OrderBy(t => t.SignTime).Select(t => new TaskBasicIdView() { TaskId = t.Id, TrialId = t.TrialId, DoctorUserId = t.DoctorUserId }))) - .ForMember(o => o.ActualGlobalTaskList, t => t.MapFrom(u => u.DoctorVisitTaskList.Where(t => t.ReadingCategory == ReadingCategory.Global && t.IsAnalysisCreate == false && t.TaskState == TaskState.Effect && + .ForMember(o => o.ActualGlobalTaskList, t => t.MapFrom(u => u.DoctorTrialVisitTaskList.Where(t => t.ReadingCategory == ReadingCategory.Global && t.IsAnalysisCreate == false && t.TaskState == TaskState.Effect && t.ReadingTaskState == ReadingTaskState.HaveSigned).OrderBy(t => t.SignTime).Select(t => new TaskBasicIdView() { TaskId = t.Id, TrialId = t.TrialId, DoctorUserId = t.DoctorUserId }))) - .ForMember(o => o.ActualTumorTaskList, t => t.MapFrom(u => u.DoctorVisitTaskList.Where(t => t.ReadingCategory == ReadingCategory.Oncology && t.IsAnalysisCreate == false && t.TaskState == TaskState.Effect && + .ForMember(o => o.ActualTumorTaskList, t => t.MapFrom(u => u.DoctorTrialVisitTaskList.Where(t => t.ReadingCategory == ReadingCategory.Oncology && t.IsAnalysisCreate == false && t.TaskState == TaskState.Effect && t.ReadingTaskState == ReadingTaskState.HaveSigned).OrderBy(t => t.SignTime).Select(t => new TaskBasicIdView() { TaskId = t.Id, TrialId = t.TrialId, DoctorUserId = t.DoctorUserId }))) .ForMember(o => o.GeneratedGlobalTaskList, t => t.MapFrom(u => u.TaskMedicalReviewList.Where(t => t.VisitTask.ReadingCategory == ReadingCategory.Global && t.VisitTask.IsAnalysisCreate == false && t.VisitTask.TaskState == TaskState.Effect && t.VisitTask.ReadingTaskState == ReadingTaskState.HaveSigned).OrderBy(t => t.VisitTask.SignTime).Select(t => new TaskBasicIdView() { TaskId = t.VisitTaskId, TrialId = t.TrialId, DoctorUserId = t.DoctorUserId }))) diff --git a/IRaCIS.Core.Application/Service/WorkLoad/DoctorWorkloadService.cs b/IRaCIS.Core.Application/Service/WorkLoad/DoctorWorkloadService.cs index 930f86adb..3c5ce30e7 100644 --- a/IRaCIS.Core.Application/Service/WorkLoad/DoctorWorkloadService.cs +++ b/IRaCIS.Core.Application/Service/WorkLoad/DoctorWorkloadService.cs @@ -104,6 +104,14 @@ namespace IRaCIS.Application.Services [Authorize(Policy = IRaCISPolicy.PM_APM)] public async Task SetEnrollReadingCategory(SetEnrollReadingCategoryInDto inDto) { + + var enroll = await _enrollRepository.FirstAsync(t => t.Id == inDto.EnrollId); + + if(_repository.Where(t=>t.TrialId==enroll.TrialId && t.DoctorUserId==enroll.DoctorUserId ).Any(t=>t.ReadingTaskState != ReadingTaskState.WaitReading)) + { + return ResponseOutput.NotOk("已经开始读片,不允许修改阅片类型"); + } + await _enrollReadingCategoryRepository.BatchDeleteNoTrackingAsync(x => x.EnrollId == inDto.EnrollId); List enrollReadings = inDto.ReadingCategorys.Select(x => new EnrollReadingCategory() diff --git a/IRaCIS.Core.Domain/Allocation/TaskMedicalReviewRule.cs b/IRaCIS.Core.Domain/Allocation/TaskMedicalReviewRule.cs index 0143b6d64..c161b7f83 100644 --- a/IRaCIS.Core.Domain/Allocation/TaskMedicalReviewRule.cs +++ b/IRaCIS.Core.Domain/Allocation/TaskMedicalReviewRule.cs @@ -44,7 +44,7 @@ namespace IRaCIS.Core.Domain.Models public User DoctorUser { get; set; } - public List DoctorVisitTaskList { get; set; } + public List DoctorTrialVisitTaskList { get; set; } public List TaskMedicalReviewList { get; set; } diff --git a/IRaCIS.Core.Infra.EFCore/Context/IRaCISDBContext.cs b/IRaCIS.Core.Infra.EFCore/Context/IRaCISDBContext.cs index bb9401758..f08105442 100644 --- a/IRaCIS.Core.Infra.EFCore/Context/IRaCISDBContext.cs +++ b/IRaCIS.Core.Infra.EFCore/Context/IRaCISDBContext.cs @@ -93,7 +93,7 @@ namespace IRaCIS.Core.Infra.EFCore modelBuilder.Entity().HasMany(t => t.VisitTaskList).WithOne(t => t.DoctorUser).HasForeignKey(t => t.DoctorUserId).IsRequired(false); - modelBuilder.Entity().HasMany(t => t.DoctorVisitTaskList).WithOne(t => t.DoctorTaskMedicalReviewRule).HasForeignKey(t => new { t.DoctorUserId, t.TrialId }).HasPrincipalKey(u => new { u.DoctorUserId, u.TrialId }); + modelBuilder.Entity().HasMany(t => t.DoctorTrialVisitTaskList).WithOne(t => t.DoctorTaskMedicalReviewRule).HasForeignKey(t => new { t.DoctorUserId, t.TrialId }).HasPrincipalKey(u => new { u.DoctorUserId, u.TrialId }); modelBuilder.Entity().HasMany(t => t.TaskMedicalReviewList).WithOne(t => t.TaskMedicalReviewRule).HasForeignKey(t => new { t.DoctorUserId, t.TrialId }).HasPrincipalKey(u => new { u.DoctorUserId, u.TrialId }); @@ -101,9 +101,6 @@ namespace IRaCIS.Core.Infra.EFCore modelBuilder.Entity().HasMany(t => t.JudgeVisitList).WithOne(t => t.JudgeVisitTask); - //modelBuilder.Entity().HasMany(t => t.VisitTaskList).WithOne(t => t.SourceSubjectVisit).HasForeignKey(t=>t.SourceSubjectVisitId).HasPrincipalKey(t=>t.Id); - - //modelBuilder.Entity().HasMany(t => t.AnalysisVisitTaskList).WithOne().HasForeignKey(t => t.TaskConsistentRuleId).HasPrincipalKey(u => u.SourceSubjectVisitId); modelBuilder.Entity().HasMany(t => t.TaskMedicalReviewList).WithOne(t => t.VisitTask).HasForeignKey(t => t.VisitTaskId);