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(); + } + + } }