diff --git a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml index 26d1de34f..38873397b 100644 --- a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml +++ b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml @@ -90,6 +90,13 @@ + + + 任务 手动分配 重新分配 确认 取消分配 + + + + 系统模板文档配置表 diff --git a/IRaCIS.Core.Application/Service/Allocation/DTO/VisitTaskViewModel.cs b/IRaCIS.Core.Application/Service/Allocation/DTO/VisitTaskViewModel.cs index e5f8ff98f..a238e02bd 100644 --- a/IRaCIS.Core.Application/Service/Allocation/DTO/VisitTaskViewModel.cs +++ b/IRaCIS.Core.Application/Service/Allocation/DTO/VisitTaskViewModel.cs @@ -109,7 +109,7 @@ namespace IRaCIS.Core.Application.ViewModel public String TrialSiteCode { get; set; } = String.Empty; public string SubjectCode { get; set; } = String.Empty; - + public bool IsAssignDoctorUser { get; set; } @@ -171,6 +171,32 @@ namespace IRaCIS.Core.Application.ViewModel { public Guid TrialId { get; set; } } + + public class AssignSubjectTaskToDoctorCommand + { + public Guid Id { get; set; } + + public Guid TrialId { get; set; } + + public Guid SubjectId { get; set; } + + public Guid DoctorUserId { get; set; } + + public TaskOptType TaskOptType { get; set; } + + } + + public enum TaskOptType + { + Assign = 1, + + ReAssign = 2, + + Confirm = 3, + + CancelConfirm = 4, + } + } diff --git a/IRaCIS.Core.Application/Service/Allocation/VisitTaskService.cs b/IRaCIS.Core.Application/Service/Allocation/VisitTaskService.cs index fcfce3c94..7683f9ffa 100644 --- a/IRaCIS.Core.Application/Service/Allocation/VisitTaskService.cs +++ b/IRaCIS.Core.Application/Service/Allocation/VisitTaskService.cs @@ -316,7 +316,7 @@ namespace IRaCIS.Core.Application.Service await _subjectUserRepository.AddAsync(new SubjectUser() { TrialId = trialId, SubjectId = assignSubjectId, DoctorUserId = doctor.DoctorUserId, AssignTime = DateTime.Now }); - } + } } } @@ -395,5 +395,39 @@ namespace IRaCIS.Core.Application.Service return ResponseOutput.Ok(); } + + + /// + /// 任务 手动分配 重新分配 确认 取消分配 + /// 分配 + /// + /// + [HttpPost] + [UnitOfWork] + public async Task AssignSubjectTaskToDoctor(AssignSubjectTaskToDoctorCommand assignSubjectTaskToDoctorCommand) + { + var visitTask= await _visitTaskRepository.FirstAsync(t => t.Id == assignSubjectTaskToDoctorCommand.Id); + + if (assignSubjectTaskToDoctorCommand.TaskOptType == TaskOptType.Assign || assignSubjectTaskToDoctorCommand.TaskOptType == TaskOptType.ReAssign) + { + visitTask.AllocateTime = DateTime.Now; + visitTask.DoctorUserId = assignSubjectTaskToDoctorCommand.DoctorUserId; + visitTask.TaskState = TaskState.Allocated; + + } + + else if (assignSubjectTaskToDoctorCommand.TaskOptType == TaskOptType.Confirm) + { + visitTask.TaskState = TaskState.Allocated; + } + else if (assignSubjectTaskToDoctorCommand.TaskOptType == TaskOptType.CancelConfirm) + { + visitTask.AllocateTime = null; + visitTask.DoctorUserId = null; + visitTask.TaskState = TaskState.NotAllocate; + } + await _visitTaskRepository.SaveChangesAsync(); + return ResponseOutput.Ok(); + } } }