diff --git a/IRaCIS.Core.Application/Service/Allocation/TaskAllocationRuleService.cs b/IRaCIS.Core.Application/Service/Allocation/TaskAllocationRuleService.cs index 320e051b..ba9812dc 100644 --- a/IRaCIS.Core.Application/Service/Allocation/TaskAllocationRuleService.cs +++ b/IRaCIS.Core.Application/Service/Allocation/TaskAllocationRuleService.cs @@ -56,18 +56,25 @@ namespace IRaCIS.Core.Application.Service public async Task AddOrUpdateTaskAllocationRule(TaskAllocationRuleAddOrEdit addOrEditTaskAllocationRule) { - var verifyExp1 = new EntityVerifyExp() - { - VerifyExp = t => t.DoctorUserId == addOrEditTaskAllocationRule.DoctorUserId && t.TrialId == addOrEditTaskAllocationRule.TrialId, - VerifyMsg = "已有该医生配置,不允许继续增加" - }; + //冗余 存 var enrollId = _repository.Where(t => t.TrialId == addOrEditTaskAllocationRule.TrialId && t.DoctorUserId == addOrEditTaskAllocationRule.DoctorUserId).Select(t => t.Id).FirstOrDefault(); + if (enrollId == Guid.Empty) + { + return ResponseOutput.NotOk("错误,未在入组表中找到该医生得账号Id"); + } + addOrEditTaskAllocationRule.EnrollId = enrollId; + var verifyExp1 = new EntityVerifyExp() + { + VerifyExp = t => t.DoctorUserId == addOrEditTaskAllocationRule.DoctorUserId && t.TrialId == addOrEditTaskAllocationRule.TrialId, + VerifyMsg = "已有该医生配置,不允许继续增加" + }; + var entity = await _taskAllocationRuleRepository.InsertOrUpdateAsync(addOrEditTaskAllocationRule, true, verifyExp1); return ResponseOutput.Ok(entity.Id.ToString());