修改裁判任务分配

This commit is contained in:
2022-06-20 15:54:09 +08:00
parent 522d7eca07
commit 243cbec782
15 changed files with 143 additions and 59 deletions
@@ -36,11 +36,12 @@ namespace IRaCIS.Core.Application.Service
[HttpPost]
public async Task<(List<TaskAllocationRuleView>,object)> GetTaskAllocationRuleList(TaskAllocationRuleQuery queryTaskAllocationRule)
{
var taskAllocationRuleQueryable = _taskAllocationRuleRepository.Where(t=>t.TrialId== queryTaskAllocationRule.TrialId)
var taskAllocationRuleQueryable = _taskAllocationRuleRepository.Where(t=>t.TrialId== queryTaskAllocationRule.TrialId)
.WhereIf(queryTaskAllocationRule.IsJudgeDoctor!=null ,t=>t.IsJudgeDoctor== queryTaskAllocationRule.IsJudgeDoctor)
.ProjectTo<TaskAllocationRuleView>(_mapper.ConfigurationProvider);
var trialTaskConfig= _trialRepository.Where(t=>t.Id==queryTaskAllocationRule.TrialId).ProjectTo<TrialTaskConfig>(_mapper.ConfigurationProvider).FirstOrDefault();
var trialTaskConfig= _trialRepository.Where(t=>t.Id==queryTaskAllocationRule.TrialId).ProjectTo<TrialTaskConfigView>(_mapper.ConfigurationProvider).FirstOrDefault();
return (await taskAllocationRuleQueryable.ToListAsync(), trialTaskConfig);
}
@@ -54,6 +55,7 @@ namespace IRaCIS.Core.Application.Service
public async Task<List<TaskAllocationRuleView>> 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 });
return await taskAllocationRuleQueryable.ToListAsync();
@@ -76,9 +78,14 @@ namespace IRaCIS.Core.Application.Service
}
[HttpDelete("{taskAllocationRuleId:guid}")]
public async Task<IResponseOutput> DeleteTaskAllocationRule(Guid taskAllocationRuleId)
[HttpDelete("{taskAllocationRuleId:guid}/{isJudgeDoctor:bool}")]
public async Task<IResponseOutput> DeleteTaskAllocationRule(Guid taskAllocationRuleId, bool isJudgeDoctor )
{
if(await _taskAllocationRuleRepository.Where(t => t.Id == taskAllocationRuleId && t.IsJudgeDoctor== isJudgeDoctor).AnyAsync(t => t.DoctorVisitTaskList.Count() > 0))
{
return ResponseOutput.NotOk("已分配任务给该医生,不允许删除");
}
var success = await _taskAllocationRuleRepository.DeleteFromQueryAsync(t => t.Id == taskAllocationRuleId, true);