diff --git a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml index 50a03c6a9..eec5888f1 100644 --- a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml +++ b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml @@ -4010,7 +4010,7 @@ 入组流程-CRO确定医生名单 [ Approve] - + 入组流程-后台确认医生入组[Confirm] diff --git a/IRaCIS.Core.Application/Service/Allocation/DTO/VisitTaskViewModel.cs b/IRaCIS.Core.Application/Service/Allocation/DTO/VisitTaskViewModel.cs index b8d6155f0..2bec0481e 100644 --- a/IRaCIS.Core.Application/Service/Allocation/DTO/VisitTaskViewModel.cs +++ b/IRaCIS.Core.Application/Service/Allocation/DTO/VisitTaskViewModel.cs @@ -123,6 +123,8 @@ namespace IRaCIS.Core.Application.ViewModel public string FullName { get; set; } public string UserTypeShortName { get; set; } + + public DateTime? AssignTime { get; set; } } diff --git a/IRaCIS.Core.Application/Service/Allocation/_MapConfig.cs b/IRaCIS.Core.Application/Service/Allocation/_MapConfig.cs index 79f5264a5..e287ff60c 100644 --- a/IRaCIS.Core.Application/Service/Allocation/_MapConfig.cs +++ b/IRaCIS.Core.Application/Service/Allocation/_MapConfig.cs @@ -33,7 +33,7 @@ namespace IRaCIS.Core.Application.Service .ForMember(o => o.SiteId, t => t.MapFrom(u => u.Subject.SiteId)) .ForMember(o => o.TrialSiteCode, t => t.MapFrom(u => u.Subject.TrialSite.TrialSiteCode)) .ForMember(o => o.SubjectCode, t => t.MapFrom(u => u.Subject.Code)) - .ForMember(o => o.UserCode, t => t.MapFrom(u => u.DoctorUser.UserCode)) + .ForMember(o => o.UserCode, t => t.MapFrom(u => u.DoctorUser.UserCode))zegn .ForMember(o => o.UserName, t => t.MapFrom(u => u.DoctorUser.UserName)) .ForMember(o => o.FullName, t => t.MapFrom(u => u.DoctorUser.FullName)) .ForMember(o => o.UserTypeShortName, t => t.MapFrom(u => u.DoctorUser.UserTypeRole.UserTypeShortName)); @@ -43,9 +43,10 @@ namespace IRaCIS.Core.Application.Service .ForMember(o => o.SubjectId, t => t.MapFrom(u => u.Id)) .ForMember(o => o.TrialSiteCode, t => t.MapFrom(u => u.TrialSite.TrialSiteCode)) .ForMember(o => o.SubjectCode, t => t.MapFrom(u => u.Code)) - .ForMember(o => o.DoctorUserLsit, t => t.MapFrom(u => u.SubjectDoctorList)); + .ForMember(o => o.DoctorUserLsit, t => t.MapFrom(u => u.SubjectDoctorList.OrderByDescending(t=>t.UpdateTime))); CreateMap() + //.ForMember(o => o.AssignTime, t => t.MapFrom(u => u.AssignTime)) .ForMember(o => o.UserCode, t => t.MapFrom(u => u.DoctorUser.UserCode)) .ForMember(o => o.UserName, t => t.MapFrom(u => u.DoctorUser.UserName)) .ForMember(o => o.FullName, t => t.MapFrom(u => u.DoctorUser.FullName)) diff --git a/IRaCIS.Core.Application/Service/Common/MailService.cs b/IRaCIS.Core.Application/Service/Common/MailService.cs index 27aaf636d..1550294a3 100644 --- a/IRaCIS.Core.Application/Service/Common/MailService.cs +++ b/IRaCIS.Core.Application/Service/Common/MailService.cs @@ -27,7 +27,7 @@ namespace IRaCIS.Application.Services Task ExternalUserJoinEmail(Guid trialId, Guid userId, string baseUrl, string rootUrl); - Task DoctorJoinTrialEmail(Guid trialId, Guid doctorId, string baseUrl, string rootUrl); + Task DoctorJoinTrialEmail(Guid trialId, Guid doctorId, string baseUrl, string rootUrl); } @@ -494,7 +494,7 @@ namespace IRaCIS.Application.Services - public async Task DoctorJoinTrialEmail(Guid trialId, Guid doctorId, string baseUrl, string rootUrl) + public async Task DoctorJoinTrialEmail(Guid trialId, Guid doctorId, string baseUrl, string rootUrl) { var doctor = await _doctorTypeRepository.FindAsync(doctorId); User sysUserInfo = null; @@ -586,7 +586,7 @@ namespace IRaCIS.Application.Services await SendEmailHelper.SendEmailAsync(messageToSend, null); - + return sysUserInfo.Id; } diff --git a/IRaCIS.Core.Application/Service/WorkLoad/EnrollService.cs b/IRaCIS.Core.Application/Service/WorkLoad/EnrollService.cs index a8e09b8ec..edef0eaac 100644 --- a/IRaCIS.Core.Application/Service/WorkLoad/EnrollService.cs +++ b/IRaCIS.Core.Application/Service/WorkLoad/EnrollService.cs @@ -22,6 +22,8 @@ namespace IRaCIS.Application.Services private readonly IRepository _workloadRepository; private readonly IMailVerificationService _mailVerificationService; + //private readonly IRepository _trialUserRepository; + public EnrollService(IRepository clinicalTrialProjectRepository, IRepository clinicalProjectDetailRepository, @@ -42,6 +44,7 @@ namespace IRaCIS.Application.Services _workloadRepository = workloadRepository; _mailVerificationService = mailVerificationService; + //_trialUserRepository = trialUserRepository; } @@ -353,7 +356,9 @@ namespace IRaCIS.Application.Services [TypeFilter(typeof(TrialResourceFilter))] [Authorize(Policy = IRaCISPolicy.PM_APM_SPM_CPM)] [UnitOfWork] - public async Task ConfirmReviewer(ConfirmReviewerCommand confirmReviewerCommand) + public async Task ConfirmReviewer(ConfirmReviewerCommand confirmReviewerCommand, + [FromServices] IRepository _trialUserRepository, + [FromServices] IRepository _taskAllocationRuleRepository) { //var trial = _trialRepository.FirstOrDefault(t => t.Id == trialId); //var existItem = _trialRepository.FindSingleOrDefault(u => u.Id == trialId && u.TrialStatus >= (int)TrialEnrollStatus.HasConfirmedDoctorNames); @@ -381,7 +386,16 @@ namespace IRaCIS.Application.Services intoGroupItem.EnrollStatus = (int)EnrollStatus.ConfirmIntoGroup; intoGroupItem.EnrollTime = DateTime.Now; - await _mailVerificationService.DoctorJoinTrialEmail(trialId, intoGroupItem.DoctorId, confirmReviewerCommand.BaseUrl, confirmReviewerCommand.RouteUrl); + var userId= await _mailVerificationService.DoctorJoinTrialEmail(trialId, intoGroupItem.DoctorId, confirmReviewerCommand.BaseUrl, confirmReviewerCommand.RouteUrl); + + if( !await _trialUserRepository.AnyAsync(t=>t.TrialId==trialId && t.UserId== userId, true)) + { + await _trialUserRepository.AddAsync(new TrialUser() { TrialId = trialId, UserId = userId }); + + await _taskAllocationRuleRepository.AddAsync(new TaskAllocationRule() { TrialId = trialId, DoctorUserId = userId }); + } + + await _enrollDetailRepository.AddAsync(new EnrollDetail() { DoctorId = intoGroupItem.DoctorId,