From 1bd1779c18fe5a7d6bd42bad815cc78b3db6477b Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Mon, 13 Jun 2022 17:28:03 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8C=BB=E7=94=9F=E5=88=86=E9=85=8DArm?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Service/Allocation/DTO/VisitTaskViewModel.cs | 9 ++++++++- .../Service/Allocation/VisitTaskService.cs | 12 +++++++++--- IRaCIS.Core.Domain/Allocation/SubjectUser.cs | 4 +++- 3 files changed, 20 insertions(+), 5 deletions(-) diff --git a/IRaCIS.Core.Application/Service/Allocation/DTO/VisitTaskViewModel.cs b/IRaCIS.Core.Application/Service/Allocation/DTO/VisitTaskViewModel.cs index d89e64fd7..e6dce518b 100644 --- a/IRaCIS.Core.Application/Service/Allocation/DTO/VisitTaskViewModel.cs +++ b/IRaCIS.Core.Application/Service/Allocation/DTO/VisitTaskViewModel.cs @@ -148,7 +148,14 @@ namespace IRaCIS.Core.Application.ViewModel public List SubjectIdList { get; set; } - public List DoctorUserIdList { get; set; } + public List DoctorUserIdArmList { get; set; } + } + + public class DoctorArm + { + public Guid DoctorUserId { get; set; } + + public int ArmEnum { get; set; } } public class CancelSubjectAssignCommand diff --git a/IRaCIS.Core.Application/Service/Allocation/VisitTaskService.cs b/IRaCIS.Core.Application/Service/Allocation/VisitTaskService.cs index 2151f27e8..cc70f8bde 100644 --- a/IRaCIS.Core.Application/Service/Allocation/VisitTaskService.cs +++ b/IRaCIS.Core.Application/Service/Allocation/VisitTaskService.cs @@ -104,16 +104,22 @@ namespace IRaCIS.Core.Application.Service [HttpPost] public async Task AssignSubjectDoctor(AssginSubjectDoctorCommand assginSubjectDoctorCommand) { + + var doctorUserIdList = assginSubjectDoctorCommand.DoctorUserIdArmList.Select(t => t.DoctorUserId).ToList(); + if (assginSubjectDoctorCommand.IsReAssign) { - await _subjectUserRepository.BatchDeleteNoTrackingAsync(t => assginSubjectDoctorCommand.DoctorUserIdList.Contains(t.DoctorUserId) && assginSubjectDoctorCommand.SubjectIdList.Contains(t.SubjectId)); + await _subjectUserRepository.BatchDeleteNoTrackingAsync(t => doctorUserIdList.Contains(t.DoctorUserId) && assginSubjectDoctorCommand.SubjectIdList.Contains(t.SubjectId)); } foreach (var subjectId in assginSubjectDoctorCommand.SubjectIdList) { - foreach (var doctorUserId in assginSubjectDoctorCommand.DoctorUserIdList) + foreach (var doctorUserId in doctorUserIdList) { - await _subjectUserRepository.AddAsync(new SubjectUser() { TrialId = assginSubjectDoctorCommand.TrialId, SubjectId = subjectId, DoctorUserId = doctorUserId, AssignTime = DateTime.Now }); + + var armEnum = assginSubjectDoctorCommand.DoctorUserIdArmList.Where(t => t.DoctorUserId == doctorUserId).First().ArmEnum; + + await _subjectUserRepository.AddAsync(new SubjectUser() { TrialId = assginSubjectDoctorCommand.TrialId, SubjectId = subjectId, DoctorUserId = doctorUserId, ArmEnum= armEnum, AssignTime = DateTime.Now }); } //await _subjectRepository.BatchUpdateNoTrackingAsync(t => t.Id == subjectId, u => new Subject() { IsAssignDoctorUser = true }); diff --git a/IRaCIS.Core.Domain/Allocation/SubjectUser.cs b/IRaCIS.Core.Domain/Allocation/SubjectUser.cs index ba8f31e81..2e4e0a152 100644 --- a/IRaCIS.Core.Domain/Allocation/SubjectUser.cs +++ b/IRaCIS.Core.Domain/Allocation/SubjectUser.cs @@ -59,7 +59,9 @@ namespace IRaCIS.Core.Domain.Models public User DoctorUser { get; set; } + public int ArmEnum { get; set; } - } + + } }