裁判任务分配页面
parent
e2ee5412be
commit
ce988d44d7
|
@ -24,11 +24,12 @@ namespace IRaCIS.Core.Application.ViewModel
|
|||
public DateTime UpdateTime { get; set; }
|
||||
public Guid UpdateUserId { get; set; }
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public class DoctorVisitTaskStatView: TaskAllocationRuleView
|
||||
{
|
||||
//该医生已经应用的 Subject数量
|
||||
public int? SelfApplyedSubjectCount { get; set; }
|
||||
|
||||
|
@ -74,11 +75,6 @@ namespace IRaCIS.Core.Application.ViewModel
|
|||
|
||||
//总任务数
|
||||
public int? TotalTaskCount { get; set; }
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -86,33 +82,13 @@ namespace IRaCIS.Core.Application.ViewModel
|
|||
|
||||
|
||||
|
||||
public class AllocateInfo
|
||||
{
|
||||
public int? TotalTaskCount { get; set; }
|
||||
|
||||
public int? SelfTaskCount { get; set; }
|
||||
|
||||
public int PlanReadingRatio { get; set; }
|
||||
|
||||
public Guid DoctorUserId { get; set; }
|
||||
|
||||
//public List<int> ArmList { get; set; } = new List<int>();
|
||||
|
||||
//public double? TargetCount => TotalTaskCount * PlanReadingRatio * 0.01;
|
||||
|
||||
//public double? Diff => TargetCount - SelfTaskCount;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
///<summary>TaskAllocationRuleQuery 列表查询参数模型</summary>
|
||||
public class TaskAllocationRuleQuery
|
||||
{
|
||||
[NotDefault]
|
||||
public Guid TrialId { get; set; }
|
||||
|
||||
public bool? IsJudgeDoctor { get; set; }
|
||||
public bool IsJudgeDoctor { get; set; }
|
||||
}
|
||||
|
||||
///<summary> TaskAllocationRuleAddOrEdit 列表查询参数模型</summary>
|
||||
|
|
|
@ -312,7 +312,7 @@ namespace IRaCIS.Core.Application.ViewModel
|
|||
{
|
||||
public Guid TrialId { get; set; }
|
||||
|
||||
public bool? IsJudgeDoctor { get; set; }
|
||||
public bool IsJudgeDoctor { get; set; }
|
||||
|
||||
public List<Guid> SubjectIdList { get; set; } = new List<Guid>();
|
||||
}
|
||||
|
@ -322,6 +322,7 @@ namespace IRaCIS.Core.Application.ViewModel
|
|||
{
|
||||
public Guid TrialId { get; set; }
|
||||
|
||||
|
||||
public List<SubjectDoctorCommand> SubjectDoctorUserList { get; set; } = new List<SubjectDoctorCommand>();
|
||||
}
|
||||
|
||||
|
|
|
@ -34,11 +34,10 @@ namespace IRaCIS.Core.Application.Service
|
|||
}
|
||||
|
||||
[HttpPost]
|
||||
public async Task<(List<TaskAllocationRuleView>,object)> GetTaskAllocationRuleList(TaskAllocationRuleQuery queryTaskAllocationRule)
|
||||
public async Task<(List<DoctorVisitTaskStatView>,object)> GetTaskAllocationRuleList(TaskAllocationRuleQuery queryTaskAllocationRule)
|
||||
{
|
||||
var taskAllocationRuleQueryable = _taskAllocationRuleRepository.Where(t=>t.TrialId== queryTaskAllocationRule.TrialId)
|
||||
.WhereIf(queryTaskAllocationRule.IsJudgeDoctor!=null ,t=>t.IsJudgeDoctor== queryTaskAllocationRule.IsJudgeDoctor)
|
||||
.ProjectTo<TaskAllocationRuleView>(_mapper.ConfigurationProvider);
|
||||
var taskAllocationRuleQueryable = _taskAllocationRuleRepository.Where(t=>t.TrialId== queryTaskAllocationRule.TrialId && t.IsJudgeDoctor == queryTaskAllocationRule.IsJudgeDoctor)
|
||||
.ProjectTo<DoctorVisitTaskStatView>(_mapper.ConfigurationProvider);
|
||||
|
||||
|
||||
var trialTaskConfig= _trialRepository.Where(t=>t.Id==queryTaskAllocationRule.TrialId).ProjectTo<TrialTaskConfigView>(_mapper.ConfigurationProvider).FirstOrDefault();
|
||||
|
@ -48,15 +47,14 @@ namespace IRaCIS.Core.Application.Service
|
|||
|
||||
|
||||
/// <summary>
|
||||
/// 获取应用Subject后 医生比率情况
|
||||
/// 获取访视任务 应用Subject后 医生比率情况
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<List<TaskAllocationRuleView>> GetSubjectApplyDoctorTaskStatList(ApplySubjectCommand assignConfirmCommand)
|
||||
public async Task<List<DoctorVisitTaskStatView>> GetSubjectApplyDoctorTaskStatList(ApplySubjectCommand assignConfirmCommand)
|
||||
{
|
||||
var taskAllocationRuleQueryable = _taskAllocationRuleRepository.Where(t => t.TrialId == assignConfirmCommand.TrialId)
|
||||
.WhereIf(assignConfirmCommand.IsJudgeDoctor != null, t => t.IsJudgeDoctor == assignConfirmCommand.IsJudgeDoctor)
|
||||
.ProjectTo<TaskAllocationRuleView>(_mapper.ConfigurationProvider, new { subjectIdList = assignConfirmCommand.SubjectIdList });
|
||||
var taskAllocationRuleQueryable = _taskAllocationRuleRepository.Where(t => t.TrialId == assignConfirmCommand.TrialId && t.IsJudgeDoctor == assignConfirmCommand.IsJudgeDoctor)
|
||||
.ProjectTo<DoctorVisitTaskStatView>(_mapper.ConfigurationProvider, new { subjectIdList = assignConfirmCommand.SubjectIdList , isJudgeDoctor = assignConfirmCommand.IsJudgeDoctor });
|
||||
|
||||
return await taskAllocationRuleQueryable.ToListAsync();
|
||||
}
|
||||
|
|
|
@ -12,43 +12,60 @@ namespace IRaCIS.Core.Application.Service
|
|||
public AllocationConfig()
|
||||
{
|
||||
|
||||
List<Guid> subjectIdList=new List<Guid> ();
|
||||
|
||||
CreateMap<TaskAllocationRule, TaskAllocationRuleView>()
|
||||
.ForMember(o => o.UserCode, t => t.MapFrom(u => u.DoctorUser.UserCode))
|
||||
.ForMember(o => o.UserName, t => t.MapFrom(u => u.DoctorUser.UserName))
|
||||
.ForMember(o => o.FullName, t => t.MapFrom(u => u.DoctorUser.FullName))
|
||||
.ForMember(o => o.UserTypeShortName, t => t.MapFrom(u => u.DoctorUser.UserTypeRole.UserTypeShortName));
|
||||
|
||||
List<Guid> subjectIdList=new List<Guid> ();
|
||||
bool isJudgeDoctor = false;
|
||||
|
||||
|
||||
CreateMap<TaskAllocationRule, DoctorVisitTaskStatView>()
|
||||
.ForMember(o => o.UserCode, t => t.MapFrom(u => u.DoctorUser.UserCode))
|
||||
.ForMember(o => o.UserName, t => t.MapFrom(u => u.DoctorUser.UserName))
|
||||
.ForMember(o => o.FullName, t => t.MapFrom(u => u.DoctorUser.FullName))
|
||||
.ForMember(o => o.UserTypeShortName, t => t.MapFrom(u => u.DoctorUser.UserTypeRole.UserTypeShortName))
|
||||
//.ForMember(o => o.ArmList, t => t.MapFrom(u => u.DoctorVisitTaskList.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.ApplyedTotalTaskCount, t => t.MapFrom(u => u.Trial.VisitTaskList.Count(t => t.DoctorUserId != null)))
|
||||
.ForMember(o => o.SelfUndoTaskCount, t => t.MapFrom(u => u.Trial.VisitTaskList.Count(t => t.DoctorUserId == u.DoctorUserId && t.ReadingTaskState != ReadingTaskState.HaveSigned)))
|
||||
.ForMember(o => o.TotalSubjectCount, t => t.MapFrom(u => u.Trial.SubjectList.Count()))
|
||||
.ForMember(o => o.SelfApplyedTaskCount, t => t.MapFrom(u => u.Trial.VisitTaskList.Count(t => t.DoctorUserId == u.DoctorUserId)))
|
||||
.ForMember(o => o.ApplyedTotalTaskCount, t => t.MapFrom(u => u.Trial.VisitTaskList.Count(t => t.DoctorUserId != null)))
|
||||
|
||||
.ForMember(o => o.SelfApplyedSubjectCount, t => t.MapFrom(u => u.Trial.SubjectDoctorUserList.Where(t => t.DoctorUserId == u.DoctorUserId && t.SubjectArmVisitTaskList.Any(c => c.DoctorUserId != null)).Count()))
|
||||
.ForMember(o => o.SelfSubjectCount, t => t.MapFrom(u => u.Trial.SubjectDoctorUserList.Where(t => t.DoctorUserId == u.DoctorUserId).Count()))
|
||||
|
||||
.ForMember(o => o.ApplyedTotalSubjectCount, t => t.MapFrom(u => u.Trial.SubjectList.Count(c => c.SubjectVisitTaskList.Any(d => d.DoctorUserId != null))))
|
||||
|
||||
|
||||
|
||||
//该医生未应用Subject 数量
|
||||
.ForMember(o => o.WaitApplySelfSubjectCount, t => t.MapFrom(u =>
|
||||
subjectIdList.Count == 0 ? u.Trial.SubjectDoctorUserList.Where(t => t.DoctorUserId == u.DoctorUserId && t.SubjectArmVisitTaskList.Where(t=> isJudgeDoctor? t.ArmEnum==Arm.JudgeArm:t.ArmEnum!= Arm.JudgeArm).Any(c => c.DoctorUserId == null)).Count()
|
||||
: u.Trial.SubjectDoctorUserList.Where(t => t.DoctorUserId == u.DoctorUserId && subjectIdList.Contains(t.SubjectId) && t.SubjectArmVisitTaskList.Where(t => isJudgeDoctor ? t.ArmEnum == Arm.JudgeArm : t.ArmEnum != Arm.JudgeArm).Any(c => c.DoctorUserId == null)).Count()
|
||||
))
|
||||
|
||||
|
||||
.ForMember(o => o.WaitApplyTotalSubjectCount, t => t.MapFrom(u =>
|
||||
subjectIdList.Count == 0 ? u.Trial.SubjectList.Where(t => t.SubjectVisitTaskList.Where(t => isJudgeDoctor ? t.ArmEnum == Arm.JudgeArm : t.ArmEnum != Arm.JudgeArm).Any(c => c.DoctorUserId == null)).Count()
|
||||
: u.Trial.SubjectList.Where(t => subjectIdList.Contains(t.Id) && t.SubjectVisitTaskList.Where(t => isJudgeDoctor ? t.ArmEnum == Arm.JudgeArm : t.ArmEnum != Arm.JudgeArm).Any(c => c.DoctorUserId == null)).Count()
|
||||
))
|
||||
|
||||
.ForMember(o => o.WaitApplySelfTaskCount, t => t.MapFrom(u =>
|
||||
subjectIdList.Count==0? u.Trial.SubjectDoctorUserList.Where(d => d.DoctorUserId == u.DoctorUserId).SelectMany(t => t.SubjectArmVisitTaskList.Where(t => t.DoctorUserId == null)).Count()
|
||||
: u.Trial.SubjectDoctorUserList.Where(d => d.DoctorUserId == u.DoctorUserId && subjectIdList.Contains(d.SubjectId)).SelectMany(t => t.SubjectArmVisitTaskList.Where(t => t.DoctorUserId == null)).Count()
|
||||
subjectIdList.Count==0? u.Trial.SubjectDoctorUserList.Where(d => d.DoctorUserId == u.DoctorUserId).SelectMany(t => t.SubjectArmVisitTaskList.Where(t => isJudgeDoctor ? t.ArmEnum == Arm.JudgeArm : t.ArmEnum != Arm.JudgeArm).Where(t => t.DoctorUserId == null)).Count()
|
||||
: u.Trial.SubjectDoctorUserList.Where(d => d.DoctorUserId == u.DoctorUserId && subjectIdList.Contains(d.SubjectId)).SelectMany(t => t.SubjectArmVisitTaskList.Where(t => isJudgeDoctor ? t.ArmEnum == Arm.JudgeArm : t.ArmEnum != Arm.JudgeArm).Where(t => t.DoctorUserId == null)).Count()
|
||||
))
|
||||
|
||||
.ForMember(o => o.WaitApplyTotalTaskCount, t => t.MapFrom(u =>
|
||||
subjectIdList.Count == 0 ? u.Trial.VisitTaskList.Where(t => t.DoctorUserId == null).Count()
|
||||
: u.Trial.VisitTaskList.Where(t => t.DoctorUserId == null && subjectIdList.Contains(t.SubjectId)).Count() ))
|
||||
subjectIdList.Count == 0 ? u.Trial.VisitTaskList.Where(t => isJudgeDoctor ? t.ArmEnum == Arm.JudgeArm : t.ArmEnum != Arm.JudgeArm).Where(t => t.DoctorUserId == null).Count()
|
||||
: u.Trial.VisitTaskList.Where(t => isJudgeDoctor ? t.ArmEnum == Arm.JudgeArm : t.ArmEnum != Arm.JudgeArm).Where(t => t.DoctorUserId == null && subjectIdList.Contains(t.SubjectId)).Count() ))
|
||||
|
||||
|
||||
|
||||
|
||||
.ForMember(o => o.SelfUndoTaskCount, t => t.MapFrom(u => u.Trial.VisitTaskList.Count(t => t.DoctorUserId == u.DoctorUserId && t.ReadingTaskState != ReadingTaskState.HaveSigned)))
|
||||
.ForMember(o => o.SelfApplyedTaskCount, 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.ApplyedTotalSubjectCount, t => t.MapFrom(u => u.Trial.SubjectList.Count(c => c.SubjectVisitTaskList.Any(d => d.DoctorUserId !=null))))
|
||||
.ForMember(o => o.WaitApplyTotalSubjectCount, t => t.MapFrom(u =>
|
||||
subjectIdList.Count == 0 ? u.Trial.SubjectList.Where(t => t.SubjectVisitTaskList.Any(c => c.DoctorUserId == null)).Count()
|
||||
: u.Trial.SubjectList.Where(t => subjectIdList.Contains(t.Id) && t.SubjectVisitTaskList.Any(c => c.DoctorUserId == null)).Count()
|
||||
))
|
||||
|
||||
.ForMember(o => o.SelfSubjectCount, t => t.MapFrom(u => u.Trial.SubjectDoctorUserList.Where(t => t.DoctorUserId == u.DoctorUserId).Count()))
|
||||
.ForMember(o => o.SelfApplyedSubjectCount, t => t.MapFrom(u => u.Trial.SubjectDoctorUserList.Where(t => t.DoctorUserId == u.DoctorUserId && t.SubjectArmVisitTaskList.Any(c => c.DoctorUserId != null)).Count()))
|
||||
|
||||
.ForMember(o => o.WaitApplySelfSubjectCount, t => t.MapFrom(u =>
|
||||
subjectIdList.Count == 0 ? u.Trial.SubjectDoctorUserList.Where(t => t.DoctorUserId == u.DoctorUserId && t.SubjectArmVisitTaskList.Any(c=>c.DoctorUserId ==null)).Count()
|
||||
: u.Trial.SubjectDoctorUserList.Where(t => t.DoctorUserId == u.DoctorUserId && subjectIdList.Contains(t.SubjectId) && t.SubjectArmVisitTaskList.Any(c => c.DoctorUserId == null)).Count()
|
||||
))
|
||||
|
||||
|
||||
;
|
||||
|
||||
|
||||
|
@ -56,13 +73,6 @@ namespace IRaCIS.Core.Application.Service
|
|||
|
||||
|
||||
|
||||
CreateMap<TaskAllocationRule, AllocateInfo>()
|
||||
//.ForMember(o => o.ArmList, t => t.MapFrom(u => u.DoctorVisitTaskList.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)));
|
||||
|
||||
|
||||
|
||||
|
||||
CreateMap<VisitTask, VisitTaskView>()
|
||||
|
|
Loading…
Reference in New Issue