修复bug

This commit is contained in:
2022-07-26 15:53:02 +08:00
parent 2f403394f0
commit c352be0eaf
4 changed files with 103 additions and 96 deletions
@@ -42,7 +42,7 @@ namespace IRaCIS.Core.Application.Service
/// </summary>
/// <param name="trialId"></param>
/// <returns></returns>
public async Task<List<TaskAllocationRuleDTO> > GetDoctorPlanAllocationRuleList(Guid trialId)
public async Task<List<TaskAllocationRuleDTO>> GetDoctorPlanAllocationRuleList(Guid trialId)
{
var list = await _taskAllocationRuleRepository.Where(t => t.TrialId == trialId).ProjectTo<TaskAllocationRuleDTO>(_mapper.ConfigurationProvider).ToListAsync();
@@ -62,6 +62,12 @@ namespace IRaCIS.Core.Application.Service
VerifyMsg = "已有该医生配置,不允许继续增加"
};
//冗余 存
var enrollId = _repository.Where<Enroll>(t => t.TrialId == addOrEditTaskAllocationRule.TrialId && t.DoctorUserId == addOrEditTaskAllocationRule.DoctorUserId).Select(t => t.Id).FirstOrDefault();
addOrEditTaskAllocationRule.EnrollId = enrollId;
var entity = await _taskAllocationRuleRepository.InsertOrUpdateAsync(addOrEditTaskAllocationRule, true, verifyExp1);
return ResponseOutput.Ok(entity.Id.ToString());
@@ -72,7 +78,7 @@ namespace IRaCIS.Core.Application.Service
[HttpDelete("{taskAllocationRuleId:guid}")]
public async Task<IResponseOutput> DeleteTaskAllocationRule(Guid taskAllocationRuleId)
{
if (await _taskAllocationRuleRepository.Where(t => t.Id == taskAllocationRuleId).AnyAsync(t => t.DoctorUser.VisitTaskList.Any()))
if (await _taskAllocationRuleRepository.Where(t => t.Id == taskAllocationRuleId).AnyAsync(t => t.DoctorUser.VisitTaskList.Where(u=>u.TrialId==t.TrialId).Any()))
{
return ResponseOutput.NotOk("已分配任务给该医生,不允许删除");
}
@@ -141,7 +147,7 @@ namespace IRaCIS.Core.Application.Service
[HttpPost]
public async Task<List<TrialDoctorUserSelectView>> GetDoctorSelectList(DoctorSelectQuery selectQuery, [FromServices] IRepository<Enroll> _enrollRepository)
{
var query = from allocationRule in _taskAllocationRuleRepository.Where(t => t.TrialId == selectQuery.TrialId && t.IsEnable)
var query = from allocationRule in _taskAllocationRuleRepository.Where(t => t.TrialId == selectQuery.TrialId && t.IsEnable)
join user in _userRepository.AsQueryable() on allocationRule.DoctorUserId equals user.Id
select new TrialDoctorUserSelectView()
{
@@ -154,7 +160,7 @@ namespace IRaCIS.Core.Application.Service
UserTypeEnum = user.UserTypeRole.UserTypeEnum
};
return await query.ToListAsync();
return await query.ToListAsync();
}