Uat_Study
hang 2022-07-22 15:42:34 +08:00
parent 712ed21783
commit bf703be85c
2 changed files with 31 additions and 0 deletions

View File

@ -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; }

View File

@ -135,5 +135,27 @@ namespace IRaCIS.Core.Application.Service
}
[HttpPost]
public async Task<List<TrialDoctorUserSelectView>> GetDoctorSelectList(DoctorSelectQuery selectQuery, [FromServices] IRepository<Enroll> _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();
}
}
}