diff --git a/IRaCIS.Core.Application/Service/Allocation/DTO/TaskAllocationRuleViewModel.cs b/IRaCIS.Core.Application/Service/Allocation/DTO/TaskAllocationRuleViewModel.cs index a5d761a1b..791684373 100644 --- a/IRaCIS.Core.Application/Service/Allocation/DTO/TaskAllocationRuleViewModel.cs +++ b/IRaCIS.Core.Application/Service/Allocation/DTO/TaskAllocationRuleViewModel.cs @@ -29,6 +29,10 @@ namespace IRaCIS.Core.Application.ViewModel public int? SelfTaskCount { get; set; } + public int? SelfSubjectCount { get; set; } + + public int? TotalSubjectCount { get; set; } + public List ArmList { get; set; } diff --git a/IRaCIS.Core.Application/Service/Allocation/VisitTaskService.cs b/IRaCIS.Core.Application/Service/Allocation/VisitTaskService.cs index e77dd5e74..d3ac6235a 100644 --- a/IRaCIS.Core.Application/Service/Allocation/VisitTaskService.cs +++ b/IRaCIS.Core.Application/Service/Allocation/VisitTaskService.cs @@ -101,7 +101,7 @@ namespace IRaCIS.Core.Application.Service { foreach (var doctorUserId in assginSubjectDoctorCommand.DoctorUserIdList) { - await _subjectUserRepository.AddAsync(new SubjectUser() { SubjectId = subjectId, DoctorUserId = doctorUserId, AssignTime = DateTime.Now }); + await _subjectUserRepository.AddAsync(new SubjectUser() {TrialId= assginSubjectDoctorCommand.TrialId, SubjectId = subjectId, DoctorUserId = doctorUserId, AssignTime = DateTime.Now }); } await _subjectRepository.BatchUpdateNoTrackingAsync(t => t.Id == subjectId, u => new Subject() { IsAssignDoctorUser = true }); diff --git a/IRaCIS.Core.Application/Service/Allocation/_MapConfig.cs b/IRaCIS.Core.Application/Service/Allocation/_MapConfig.cs index c13b85b22..5d818d45d 100644 --- a/IRaCIS.Core.Application/Service/Allocation/_MapConfig.cs +++ b/IRaCIS.Core.Application/Service/Allocation/_MapConfig.cs @@ -18,7 +18,9 @@ namespace IRaCIS.Core.Application.Service .ForMember(o => o.UserTypeShortName, t => t.MapFrom(u => u.DoctorUser.UserTypeRole.UserTypeShortName)) .ForMember(o => o.ArmList, t => t.MapFrom(u => u.VisitTaskList.Where(c => c.TrialId == u.TrialId).Select(t => t.ArmEnum).Distinct())) .ForMember(o => o.TotalTaskCount, t => t.MapFrom(u => u.Trial.VisitTaskList.Count())) - .ForMember(o => o.SelfTaskCount, t => t.MapFrom(u => u.Trial.VisitTaskList.Count(t => t.DoctorUserId == u.DoctorUserId))); + .ForMember(o => o.SelfTaskCount, t => t.MapFrom(u => u.Trial.VisitTaskList.Count(t => t.DoctorUserId == u.DoctorUserId))) + .ForMember(o => o.TotalSubjectCount, t => t.MapFrom(u => u.Trial.SubjectList.Count())) + /* .ForMember(o => o.SelfSubjectCount, t => t.MapFrom(u => u.Trial.su.Where(t => t.DoctorUserId == u.DoctorUserId).Select(t=>t.SubjectId).Distinct().Count())*/; CreateMap() .ForMember(o => o.ArmList, t => t.MapFrom(u => u.VisitTaskList.Where(c => c.TrialId == u.TrialId).Select(t => t.ArmEnum).Distinct())) diff --git a/IRaCIS.Core.Domain/Allocation/SubjectUser.cs b/IRaCIS.Core.Domain/Allocation/SubjectUser.cs index 3ebf95a7c..ba8f31e81 100644 --- a/IRaCIS.Core.Domain/Allocation/SubjectUser.cs +++ b/IRaCIS.Core.Domain/Allocation/SubjectUser.cs @@ -15,7 +15,10 @@ namespace IRaCIS.Core.Domain.Models [Table("SubjectUser")] public class SubjectUser : Entity, IAuditUpdate, IAuditAdd { - + + public Trial Trial { get; set; } + public Guid TrialId { get; set; } + /// /// CreateUserId ///