分配规则修改
This commit is contained in:
@@ -25,48 +25,36 @@ namespace IRaCIS.Core.Application.Service
|
||||
|
||||
private readonly IRepository<Trial> _trialRepository;
|
||||
|
||||
|
||||
|
||||
|
||||
public TaskAllocationRuleService(IRepository<TaskAllocationRule> taskAllocationRuleRepository, IRepository<User> userRepository, IRepository<Trial> trialRepository)
|
||||
{
|
||||
_taskAllocationRuleRepository = taskAllocationRuleRepository;
|
||||
_userRepository = userRepository;
|
||||
_trialRepository= trialRepository;
|
||||
_trialRepository = trialRepository;
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public async Task<(List<DoctorVisitTaskStatView>,object)> GetTaskAllocationRuleList(TaskAllocationRuleQuery queryTaskAllocationRule)
|
||||
|
||||
|
||||
|
||||
|
||||
public async Task<List<TaskAllocationRuleDTO> > GetDoctorPlanAllocationRuleList(Guid trialId)
|
||||
{
|
||||
var taskAllocationRuleQueryable = _taskAllocationRuleRepository.Where(t=>t.TrialId== queryTaskAllocationRule.TrialId && t.IsJudgeDoctor == queryTaskAllocationRule.IsJudgeDoctor)
|
||||
.ProjectTo<DoctorVisitTaskStatView>(_mapper.ConfigurationProvider);
|
||||
|
||||
var list = await _taskAllocationRuleRepository.Where(t => t.TrialId == trialId).ProjectTo<TaskAllocationRuleDTO>(_mapper.ConfigurationProvider).ToListAsync();
|
||||
|
||||
var trialTaskConfig= _trialRepository.Where(t=>t.Id==queryTaskAllocationRule.TrialId).ProjectTo<TrialTaskConfigView>(_mapper.ConfigurationProvider, new { isJudgeDoctor = queryTaskAllocationRule.IsJudgeDoctor }).FirstOrDefault();
|
||||
|
||||
return (await taskAllocationRuleQueryable.ToListAsync(), trialTaskConfig);
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取访视任务 应用Subject后 医生比率情况
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<List<DoctorVisitTaskStatView>> GetSubjectApplyDoctorTaskStatList(ApplySubjectCommand assignConfirmCommand)
|
||||
{
|
||||
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();
|
||||
}
|
||||
|
||||
|
||||
|
||||
public async Task<IResponseOutput> AddOrUpdateTaskAllocationRule(TaskAllocationRuleAddOrEdit addOrEditTaskAllocationRule)
|
||||
{
|
||||
var verifyExp1 = new EntityVerifyExp<TaskAllocationRule>()
|
||||
{
|
||||
VerifyExp = t => t.DoctorUserId == addOrEditTaskAllocationRule.DoctorUserId && t.TrialId== addOrEditTaskAllocationRule.TrialId && t.IsJudgeDoctor==addOrEditTaskAllocationRule.IsJudgeDoctor,
|
||||
VerifyExp = t => t.EnrollId == addOrEditTaskAllocationRule.EnrollId && t.TrialId == addOrEditTaskAllocationRule.TrialId,
|
||||
VerifyMsg = "已有该医生配置,不允许继续增加"
|
||||
};
|
||||
|
||||
@@ -77,10 +65,10 @@ namespace IRaCIS.Core.Application.Service
|
||||
}
|
||||
|
||||
|
||||
[HttpDelete("{taskAllocationRuleId:guid}/{isJudgeDoctor:bool}")]
|
||||
public async Task<IResponseOutput> DeleteTaskAllocationRule( Guid taskAllocationRuleId, bool isJudgeDoctor )
|
||||
[HttpDelete("{taskAllocationRuleId:guid}")]
|
||||
public async Task<IResponseOutput> DeleteTaskAllocationRule(Guid taskAllocationRuleId)
|
||||
{
|
||||
if(await _taskAllocationRuleRepository.Where(t => t.Id == taskAllocationRuleId ).AnyAsync(t => t.DoctorVisitTaskList.Where(t=>isJudgeDoctor?t.ArmEnum==Domain.Share.Arm.JudgeArm: t.ArmEnum != Domain.Share.Arm.JudgeArm).Count() > 0))
|
||||
if (await _taskAllocationRuleRepository.Where(t => t.Id == taskAllocationRuleId).AnyAsync(t => t.DoctorVisitTaskList.Any()))
|
||||
{
|
||||
return ResponseOutput.NotOk("已分配任务给该医生,不允许删除");
|
||||
}
|
||||
@@ -91,6 +79,35 @@ namespace IRaCIS.Core.Application.Service
|
||||
return ResponseOutput.Ok();
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取访视任务 应用Subject后 医生比率情况
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<List<DoctorVisitTaskStatView>> GetSubjectApplyDoctorTaskStatList(ApplySubjectCommand assignConfirmCommand)
|
||||
{
|
||||
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();
|
||||
}
|
||||
|
||||
|
||||
|
||||
[HttpPost]
|
||||
public async Task<(List<DoctorVisitTaskStatView>, object)> GetTaskAllocationRuleList(TaskAllocationRuleQuery queryTaskAllocationRule)
|
||||
{
|
||||
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, new { isJudgeDoctor = queryTaskAllocationRule.IsJudgeDoctor }).FirstOrDefault();
|
||||
|
||||
return (await taskAllocationRuleQueryable.ToListAsync(), trialTaskConfig);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取项目下 医生账户信息下拉
|
||||
/// </summary>
|
||||
@@ -98,19 +115,20 @@ namespace IRaCIS.Core.Application.Service
|
||||
/// <param name="_enrollRepository"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("{trialId:guid}")]
|
||||
public async Task<List<TrialDoctorUserSelectView>> GetDoctorUserSelectList(Guid trialId,[FromServices] IRepository<Enroll> _enrollRepository)
|
||||
public async Task<List<TrialDoctorUserSelectView>> GetDoctorUserSelectList(Guid trialId, [FromServices] IRepository<Enroll> _enrollRepository)
|
||||
{
|
||||
var query = from enroll in _enrollRepository.Where(t => t.TrialId == trialId && t.EnrollStatus >= (int)EnrollStatus.ConfirmIntoGroup)
|
||||
join user in _userRepository.AsQueryable() on enroll.DoctorId equals user.DoctorId
|
||||
select new TrialDoctorUserSelectView()
|
||||
{
|
||||
TrialId = enroll.TrialId,
|
||||
ReadingType=enroll.Trial.ReadingType,
|
||||
DoctorUserId= user.Id,
|
||||
FullName=user.FullName,
|
||||
UserCode=user.UserCode,
|
||||
UserName=user.UserName,
|
||||
UserTypeEnum=user.UserTypeRole.UserTypeEnum
|
||||
ReadingType = enroll.Trial.ReadingType,
|
||||
EnrollId =enroll.Id,
|
||||
DoctorUserId = user.Id,
|
||||
FullName = user.FullName,
|
||||
UserCode = user.UserCode,
|
||||
UserName = user.UserName,
|
||||
UserTypeEnum = user.UserTypeRole.UserTypeEnum
|
||||
};
|
||||
|
||||
return query.ToList();
|
||||
|
||||
Reference in New Issue
Block a user