修复bug

Uat_Study
hang 2022-07-26 15:53:02 +08:00
parent 2f403394f0
commit c352be0eaf
4 changed files with 103 additions and 96 deletions

View File

@ -218,6 +218,13 @@
<returns></returns>
<exception cref="T:IRaCIS.Core.Infrastructure.BusinessValidationFailedException"></exception>
</member>
<member name="M:IRaCIS.Core.Application.Service.Allocation.VisitTaskService.AssignSubjectTaskToDoctor(IRaCIS.Core.Application.ViewModel.AssignSubjectTaskToDoctorCommand)">
<summary>
任务 手动分配 重新分配 确认 取消分配
</summary>分配
<param name="assignSubjectTaskToDoctorCommand"></param>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.Application.Service.Allocation.VisitTaskService.GetSubjectAssignList(IRaCIS.Core.Application.ViewModel.SubjectAssignQuery)">
<summary>
获取手动分配 未分配的Subject列表(IsHaveAssigned 传递false)
@ -251,13 +258,6 @@
<param name="autoSubjectAssignCommand"></param>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.Application.Service.Allocation.VisitTaskService.AssignSubjectTaskToDoctor(IRaCIS.Core.Application.ViewModel.AssignSubjectTaskToDoctorCommand)">
<summary>
任务 手动分配 重新分配 确认 取消分配
</summary>分配
<param name="assignSubjectTaskToDoctorCommand"></param>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.Application.Service.Allocation.VisitTaskService.GetVisitTaskList(IRaCIS.Core.Application.ViewModel.VisitTaskQuery,IRaCIS.Core.Application.Service.IVisitTaskHelpeService)">
<summary>
访视任务

View File

@ -129,7 +129,7 @@ namespace IRaCIS.Core.Application.ViewModel
public Guid? Id { get; set; }
public Guid TrialId { get; set; }
//public Guid EnrollId { get; set; }
public Guid EnrollId { get; set; }
[NotDefault]
public Guid DoctorUserId { get; set; }
@ -147,7 +147,6 @@ namespace IRaCIS.Core.Application.ViewModel
public ReadingMethod ReadingType { get; set; }
public Guid? DoctorUserId { get; set; }
public string UserCode { get; set; }

View File

@ -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();
}

View File

@ -173,6 +173,91 @@ namespace IRaCIS.Core.Application.Service.Allocation
/// <summary>
/// 任务 手动分配 重新分配 确认 取消分配
/// </summary>分配
/// <param name="assignSubjectTaskToDoctorCommand"></param>
/// <returns></returns>
[HttpPost]
[UnitOfWork]
public async Task<IResponseOutput> AssignSubjectTaskToDoctor(AssignSubjectTaskToDoctorCommand assignSubjectTaskToDoctorCommand)
{
var visitTask = await _visitTaskRepository.FirstOrDefaultAsync(t => t.Id == assignSubjectTaskToDoctorCommand.Id);
if (assignSubjectTaskToDoctorCommand.TaskOptType == TaskOptType.Assign || assignSubjectTaskToDoctorCommand.TaskOptType == TaskOptType.ReAssign)
{
//手动分配验证规则
if (visitTask.SourceSubjectVisitId != null)
{
if (await _visitTaskRepository.AnyAsync(t => t.SourceSubjectVisitId == visitTask.SourceSubjectVisitId && t.TaskAllocationState == TaskAllocationState.Allocated && t.DoctorUserId == assignSubjectTaskToDoctorCommand.DoctorUserId && t.Id != visitTask.Id))
{
return ResponseOutput.NotOk("其中一个任务已分配给该医生,不允许分配");
}
}
else if (visitTask.SouceReadModuleId != null)
{
if (await _visitTaskRepository.AnyAsync(t => t.SouceReadModuleId == visitTask.SouceReadModuleId && t.TaskAllocationState == TaskAllocationState.Allocated && t.DoctorUserId == assignSubjectTaskToDoctorCommand.DoctorUserId && t.Id != visitTask.Id))
{
return ResponseOutput.NotOk("其中一个任务已分配给该医生,不允许分配");
}
}
else
{
throw new BusinessValidationFailedException("出现脏数据 任务来源字段没有值");
}
//PM 回退了 但是还没生成任务 当前任务编号前有访视进行了回退就不允许分配
if (await _subjectVisitRepository.AnyAsync(t => t.SubjectId == visitTask.SubjectId && t.IsPMBackOrReReading && t.VisitNum <= visitTask.VisitTaskNum))
{
return ResponseOutput.NotOk("该受试者有访视进入了退回流程,还未经过一致性核查通过,不允许分配");
}
visitTask.AllocateTime = DateTime.Now;
visitTask.DoctorUserId = assignSubjectTaskToDoctorCommand.DoctorUserId;
visitTask.TaskAllocationState = TaskAllocationState.Allocated;
await _subjectVisitRepository.BatchUpdateNoTrackingAsync(t => t.Id == visitTask.SourceSubjectVisitId, u => new SubjectVisit() { ReadingStatus = ReadingStatusEnum.ImageReading });
await _readModuleRepository.BatchUpdateNoTrackingAsync(t => t.Id == visitTask.SouceReadModuleId, u => new ReadModule() { ReadingStatus = ReadingStatusEnum.ImageReading });
}
else if (assignSubjectTaskToDoctorCommand.TaskOptType == TaskOptType.ReAssign)
{
//验证 是不是两个任务都给了同一个医生
//是否删除配置规则表里的 Subject 医生绑定关系 重新添加绑定关系
//是否其该Subject 其他访视 绑定的医生 也同时变更?
}
else if (assignSubjectTaskToDoctorCommand.TaskOptType == TaskOptType.Confirm)
{
visitTask.TaskAllocationState = TaskAllocationState.Allocated;
}
else if (assignSubjectTaskToDoctorCommand.TaskOptType == TaskOptType.CancelAssign)
{
visitTask.AllocateTime = null;
visitTask.DoctorUserId = null;
visitTask.TaskAllocationState = TaskAllocationState.NotAllocate;
await _subjectVisitRepository.BatchUpdateNoTrackingAsync(t => t.Id == visitTask.SourceSubjectVisitId, u => new SubjectVisit() { ReadingStatus = ReadingStatusEnum.TaskAllocate });
await _readModuleRepository.BatchUpdateNoTrackingAsync(t => t.Id == visitTask.SouceReadModuleId, u => new ReadModule() { ReadingStatus = ReadingStatusEnum.TaskAllocate });
}
await _visitTaskRepository.SaveChangesAsync();
return ResponseOutput.Ok();
}
/// <summary>
/// 获取手动分配 未分配的Subject列表(IsHaveAssigned 传递false)
/// </summary>
@ -637,89 +722,6 @@ namespace IRaCIS.Core.Application.Service.Allocation
/// <summary>
/// 任务 手动分配 重新分配 确认 取消分配
/// </summary>分配
/// <param name="assignSubjectTaskToDoctorCommand"></param>
/// <returns></returns>
[HttpPost]
[UnitOfWork]
public async Task<IResponseOutput> AssignSubjectTaskToDoctor(AssignSubjectTaskToDoctorCommand assignSubjectTaskToDoctorCommand)
{
var visitTask = await _visitTaskRepository.FirstOrDefaultAsync(t => t.Id == assignSubjectTaskToDoctorCommand.Id);
if (assignSubjectTaskToDoctorCommand.TaskOptType == TaskOptType.Assign || assignSubjectTaskToDoctorCommand.TaskOptType == TaskOptType.ReAssign)
{
//手动分配验证规则
if (visitTask.SourceSubjectVisitId != null)
{
if (await _visitTaskRepository.AnyAsync(t => t.SourceSubjectVisitId == visitTask.SourceSubjectVisitId && t.TaskAllocationState == TaskAllocationState.Allocated && t.DoctorUserId == assignSubjectTaskToDoctorCommand.DoctorUserId && t.Id != visitTask.Id))
{
return ResponseOutput.NotOk("其中一个任务已分配给该医生,不允许分配");
}
}
else if (visitTask.SouceReadModuleId != null)
{
if (await _visitTaskRepository.AnyAsync(t => t.SouceReadModuleId == visitTask.SouceReadModuleId && t.TaskAllocationState == TaskAllocationState.Allocated && t.DoctorUserId == assignSubjectTaskToDoctorCommand.DoctorUserId && t.Id != visitTask.Id))
{
return ResponseOutput.NotOk("其中一个任务已分配给该医生,不允许分配");
}
}
else
{
throw new BusinessValidationFailedException("出现脏数据 任务来源字段没有值");
}
//PM 回退了 但是还没生成任务 当前任务编号前有访视进行了回退就不允许分配
if (await _subjectVisitRepository.AnyAsync(t => t.SubjectId == visitTask.SubjectId && t.IsPMBackOrReReading && t.VisitNum <= visitTask.VisitTaskNum))
{
return ResponseOutput.NotOk("该受试者有访视进入了退回流程,还未经过一致性核查通过,不允许分配");
}
visitTask.AllocateTime = DateTime.Now;
visitTask.DoctorUserId = assignSubjectTaskToDoctorCommand.DoctorUserId;
visitTask.TaskAllocationState = TaskAllocationState.Allocated;
await _subjectVisitRepository.BatchUpdateNoTrackingAsync(t => t.Id == visitTask.SourceSubjectVisitId, u => new SubjectVisit() { ReadingStatus = ReadingStatusEnum.ImageReading });
await _readModuleRepository.BatchUpdateNoTrackingAsync(t => t.Id == visitTask.SouceReadModuleId, u => new ReadModule() { ReadingStatus = ReadingStatusEnum.ImageReading });
}
else if (assignSubjectTaskToDoctorCommand.TaskOptType == TaskOptType.ReAssign)
{
//验证 是不是两个任务都给了同一个医生
//是否删除配置规则表里的 Subject 医生绑定关系 重新添加绑定关系
//是否其该Subject 其他访视 绑定的医生 也同时变更?
}
else if (assignSubjectTaskToDoctorCommand.TaskOptType == TaskOptType.Confirm)
{
visitTask.TaskAllocationState = TaskAllocationState.Allocated;
}
else if (assignSubjectTaskToDoctorCommand.TaskOptType == TaskOptType.CancelAssign)
{
visitTask.AllocateTime = null;
visitTask.DoctorUserId = null;
visitTask.TaskAllocationState = TaskAllocationState.NotAllocate;
await _subjectVisitRepository.BatchUpdateNoTrackingAsync(t => t.Id == visitTask.SourceSubjectVisitId, u => new SubjectVisit() { ReadingStatus = ReadingStatusEnum.TaskAllocate });
await _readModuleRepository.BatchUpdateNoTrackingAsync(t => t.Id == visitTask.SouceReadModuleId, u => new ReadModule() { ReadingStatus = ReadingStatusEnum.TaskAllocate });
}
await _visitTaskRepository.SaveChangesAsync();
return ResponseOutput.Ok();
}
/// <summary>