From bf703be85cd2afb7b4a41051daa6bbfb09eec6bb Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Fri, 22 Jul 2022 15:42:34 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DTO/TaskAllocationRuleViewModel.cs | 9 ++++++++ .../Allocation/TaskAllocationRuleService.cs | 22 +++++++++++++++++++ 2 files changed, 31 insertions(+) diff --git a/IRaCIS.Core.Application/Service/Allocation/DTO/TaskAllocationRuleViewModel.cs b/IRaCIS.Core.Application/Service/Allocation/DTO/TaskAllocationRuleViewModel.cs index 4c85775c3..66db18b4f 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 DoctorSelectQuery + { + [NotDefault] + public Guid TrialId { get; set; } + + public ReadingCategory? ReadingCategory { get; set; } + } + + public class AssignDoctorStatView : TaskAllocationRuleDTO { public int? AssignedSubjectCount { get; set; } diff --git a/IRaCIS.Core.Application/Service/Allocation/TaskAllocationRuleService.cs b/IRaCIS.Core.Application/Service/Allocation/TaskAllocationRuleService.cs index a29c5c110..ae5781a95 100644 --- a/IRaCIS.Core.Application/Service/Allocation/TaskAllocationRuleService.cs +++ b/IRaCIS.Core.Application/Service/Allocation/TaskAllocationRuleService.cs @@ -135,5 +135,27 @@ namespace IRaCIS.Core.Application.Service } + [HttpPost] + public async Task> GetDoctorSelectList(DoctorSelectQuery selectQuery, [FromServices] IRepository _enrollRepository) + { + var query = from enroll in _enrollRepository.Where(t => t.TrialId == selectQuery.TrialId && t.EnrollStatus >= (int)EnrollStatus.ConfirmIntoGroup && t.DoctorUserId !=null) + .WhereIf(selectQuery.ReadingCategory !=null,t=>t.EnrollReadingCategoryList.Any(u=>u.ReadingCategory==selectQuery.ReadingCategory)) + join user in _userRepository.AsQueryable() on enroll.DoctorId equals user.DoctorId + select new TrialDoctorUserSelectView() + { + TrialId = enroll.TrialId, + ReadingType = enroll.Trial.ReadingType, + EnrollId = enroll.Id, + DoctorUserId = user.Id, + FullName = user.FullName, + UserCode = user.UserCode, + UserName = user.UserName, + UserTypeEnum = user.UserTypeRole.UserTypeEnum + }; + + return await query.ToListAsync(); + } + + } }