发布邮件 添加医生规则表

This commit is contained in:
2022-06-10 14:53:00 +08:00
parent 4c031031f8
commit 6702a37e8f
5 changed files with 25 additions and 8 deletions
@@ -123,6 +123,8 @@ namespace IRaCIS.Core.Application.ViewModel
public string FullName { get; set; }
public string UserTypeShortName { get; set; }
public DateTime? AssignTime { get; set; }
}
@@ -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<SubjectUser, AssignDoctorView>()
//.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))
@@ -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<Guid> 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<Guid> 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;
}
@@ -22,6 +22,8 @@ namespace IRaCIS.Application.Services
private readonly IRepository<Workload> _workloadRepository;
private readonly IMailVerificationService _mailVerificationService;
//private readonly IRepository<TrialUser> _trialUserRepository;
public EnrollService(IRepository<Trial> clinicalTrialProjectRepository,
IRepository<TrialStatusDetail> 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<IResponseOutput> ConfirmReviewer(ConfirmReviewerCommand confirmReviewerCommand)
public async Task<IResponseOutput> ConfirmReviewer(ConfirmReviewerCommand confirmReviewerCommand,
[FromServices] IRepository<TrialUser> _trialUserRepository,
[FromServices] IRepository<TaskAllocationRule> _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,