diff --git a/IRaCIS.Core.Application/Service/Allocation/DTO/VisitTaskViewModel.cs b/IRaCIS.Core.Application/Service/Allocation/DTO/VisitTaskViewModel.cs index cde65e4fb..bb234a51e 100644 --- a/IRaCIS.Core.Application/Service/Allocation/DTO/VisitTaskViewModel.cs +++ b/IRaCIS.Core.Application/Service/Allocation/DTO/VisitTaskViewModel.cs @@ -353,6 +353,9 @@ namespace IRaCIS.Core.Application.ViewModel [NotDefault] public Guid TrialId { get; set; } + [NotDefault] + public Guid TrialReadingCriterionId { get; set; } + public List SubjectIdList { get; set; } public List DoctorArmList { get; set; } @@ -395,6 +398,7 @@ namespace IRaCIS.Core.Application.ViewModel public class SubjectUserView { + public Guid TrialReadingCriterionId { get; set; } public Guid Id { get; set; } public DateTime? AssignTime { get; set; } @@ -420,6 +424,9 @@ namespace IRaCIS.Core.Application.ViewModel { public Guid Id { get; set; } public Guid TrialId { get; set; } + + [NotDefault] + public Guid TrialReadingCriterionId { get; set; } public Guid SubjectId { get; set; } public Guid DoctorUserId { get; set; } public Arm ArmEnum { get; set; } diff --git a/IRaCIS.Core.Application/Service/Allocation/VisitTaskService.cs b/IRaCIS.Core.Application/Service/Allocation/VisitTaskService.cs index 2c367b916..a73e6d9d0 100644 --- a/IRaCIS.Core.Application/Service/Allocation/VisitTaskService.cs +++ b/IRaCIS.Core.Application/Service/Allocation/VisitTaskService.cs @@ -98,13 +98,13 @@ namespace IRaCIS.Core.Application.Service.Allocation { foreach (var doctorArm in command.DoctorArmList) { - if (!await _subjectUserRepository.AnyAsync(t => t.SubjectId == subjectId && t.DoctorUserId == doctorArm.DoctorUserId && t.ArmEnum == doctorArm.ArmEnum && t.IsConfirmed && t.OrignalSubjectUserId == null)) + if (!await _subjectUserRepository.Where(t=>t.TrialReadingCriterionId==command.TrialReadingCriterionId).AnyAsync(t => t.SubjectId == subjectId && t.DoctorUserId == doctorArm.DoctorUserId && t.ArmEnum == doctorArm.ArmEnum && t.IsConfirmed && t.OrignalSubjectUserId == null)) { - await _subjectUserRepository.AddAsync(new SubjectUser() { TrialId = command.TrialId, ArmEnum = doctorArm.ArmEnum, DoctorUserId = doctorArm.DoctorUserId, SubjectId = subjectId, AssignTime = DateTime.Now }); + await _subjectUserRepository.AddAsync(new SubjectUser() { TrialId = command.TrialId, TrialReadingCriterionId=command.TrialReadingCriterionId, ArmEnum = doctorArm.ArmEnum, DoctorUserId = doctorArm.DoctorUserId, SubjectId = subjectId, AssignTime = DateTime.Now }); - Expression> updateWhere = t => t.SubjectId == subjectId && t.ArmEnum == doctorArm.ArmEnum && t.TrialId == command.TrialId && t.TaskAllocationState == TaskAllocationState.NotAllocate && t.TaskState == TaskState.Effect && t.IsAnalysisCreate == false; + Expression> updateWhere = t => t.TrialReadingCriterionId==command.TrialReadingCriterionId && t.SubjectId == subjectId && t.ArmEnum == doctorArm.ArmEnum && t.TrialId == command.TrialId && t.TaskAllocationState == TaskAllocationState.NotAllocate && t.TaskState == TaskState.Effect && t.IsAnalysisCreate == false; if (inOrder) { @@ -189,14 +189,14 @@ namespace IRaCIS.Core.Application.Service.Allocation { foreach (var command in cancelCommand.CancelList.Where(t => t.IsCancelAssign)) { - if (await _visitTaskRepository.AnyAsync(t => t.SubjectId == command.SubjectId && t.DoctorUserId == command.DoctorUserId && t.ArmEnum == command.ArmEnum && t.ReadingTaskState != ReadingTaskState.WaitReading)) + if (await _visitTaskRepository.AnyAsync(t => t.TrialReadingCriterionId==command.TrialReadingCriterionId && t.SubjectId == command.SubjectId && t.DoctorUserId == command.DoctorUserId && t.ArmEnum == command.ArmEnum && t.ReadingTaskState != ReadingTaskState.WaitReading)) { - throw new BusinessValidationFailedException("当前医生已开始做该Subject的任务,不允许取消分配"); + throw new BusinessValidationFailedException("当前医生已开始做该Subject 该标准的任务,不允许取消分配"); } await _subjectUserRepository.DeleteFromQueryAsync(t => t.Id == command.Id); - await _visitTaskRepository.UpdatePartialFromQueryAsync(t => t.SubjectId == command.SubjectId && t.DoctorUserId == command.DoctorUserId && t.ArmEnum == command.ArmEnum && t.ReadingTaskState == ReadingTaskState.WaitReading && t.TaskState == TaskState.Effect && t.IsAnalysisCreate == false, u => new VisitTask() + await _visitTaskRepository.UpdatePartialFromQueryAsync(t => t.TrialReadingCriterionId==command.TrialReadingCriterionId && t.SubjectId == command.SubjectId && t.DoctorUserId == command.DoctorUserId && t.ArmEnum == command.ArmEnum && t.ReadingTaskState == ReadingTaskState.WaitReading && t.TaskState == TaskState.Effect && t.IsAnalysisCreate == false, u => new VisitTask() { AllocateTime = null, DoctorUserId = null, diff --git a/IRaCIS.Core.Domain/Allocation/SubjectUser.cs b/IRaCIS.Core.Domain/Allocation/SubjectUser.cs index 68078857b..3ce77427c 100644 --- a/IRaCIS.Core.Domain/Allocation/SubjectUser.cs +++ b/IRaCIS.Core.Domain/Allocation/SubjectUser.cs @@ -21,9 +21,13 @@ namespace IRaCIS.Core.Domain.Models public Trial Trial { get; set; } public Guid TrialId { get; set; } + + public Guid TrialReadingCriterionId { get; set; } + + /// - /// CreateUserId - /// + /// CreateUserId + /// [Required] public Guid CreateUserId { get; set; }