医生加入项目修改
continuous-integration/drone/push Build is passing Details

Uat_IRC_Net8
hang 2024-12-25 19:30:42 +08:00
parent 5cdc5400dc
commit 2aa0382376
3 changed files with 41 additions and 20 deletions

View File

@ -13092,7 +13092,7 @@
入组流程-CRO确定医生名单 [ Approve] 入组流程-CRO确定医生名单 [ Approve]
</summary> </summary>
</member> </member>
<member name="M:IRaCIS.Core.Application.Service.EnrollService.ConfirmReviewer(IRaCIS.Core.Application.Service.WorkLoad.DTO.ConfirmReviewerCommand,IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.TrialUserRole},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.TaskAllocationRule})"> <member name="M:IRaCIS.Core.Application.Service.EnrollService.ConfirmReviewer(IRaCIS.Core.Application.Service.WorkLoad.DTO.ConfirmReviewerCommand,IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.TrialUserRole},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.TrialIdentityUser},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.TaskAllocationRule})">
<summary> <summary>
入组流程-后台确认医生入组[Confirm] 入组流程-后台确认医生入组[Confirm]
</summary> </summary>

View File

@ -34,7 +34,7 @@ namespace IRaCIS.Core.Application.Service
Task ExternalUserJoinEmail(Guid trialId, Guid userId, string baseUrl, string rootUrl); Task ExternalUserJoinEmail(Guid trialId, Guid userId, string baseUrl, string rootUrl);
Task<Guid> DoctorJoinTrialEmail(Guid trialId, Guid doctorId, string baseUrl, string rootUrl); Task<(Guid identityUserId, Guid userRoleId)> DoctorJoinTrialEmail(Guid trialId, Guid doctorId, string baseUrl, string rootUrl);
Task UserFeedBackMail(Guid feedBackId); Task UserFeedBackMail(Guid feedBackId);
} }
@ -555,7 +555,7 @@ namespace IRaCIS.Core.Application.Service
//医生生成账号加入 或者已存在账号加入到项目中 //医生生成账号加入 或者已存在账号加入到项目中
public async Task<Guid> DoctorJoinTrialEmail(Guid trialId, Guid doctorId, string baseUrl, string rootUrl) public async Task<(Guid identityUserId, Guid userRoleId)> DoctorJoinTrialEmail(Guid trialId, Guid doctorId, string baseUrl, string rootUrl)
{ {
var doctor = await _doctorTypeRepository.FindAsync(doctorId); var doctor = await _doctorTypeRepository.FindAsync(doctorId);
var sysUserInfo = new IdentityUser(); var sysUserInfo = new IdentityUser();
@ -661,7 +661,7 @@ namespace IRaCIS.Core.Application.Service
await SendEmailHelper.SendEmailAsync(messageToSend, _systemEmailConfig, null); await SendEmailHelper.SendEmailAsync(messageToSend, _systemEmailConfig, null);
return sysUserInfo.Id; return (sysUserInfo.Id, sysUserInfo.UserRoleList.First(t => t.UserTypeEnum == UserTypeEnum.IndependentReviewer).Id);
} }

View File

@ -355,6 +355,7 @@ namespace IRaCIS.Core.Application.Service
[UnitOfWork] [UnitOfWork]
public async Task<IResponseOutput> ConfirmReviewer(ConfirmReviewerCommand confirmReviewerCommand, public async Task<IResponseOutput> ConfirmReviewer(ConfirmReviewerCommand confirmReviewerCommand,
[FromServices] IRepository<TrialUserRole> _trialUserRoleRepository, [FromServices] IRepository<TrialUserRole> _trialUserRoleRepository,
[FromServices] IRepository<TrialIdentityUser> _trialIdentityUserRepository,
[FromServices] IRepository<TaskAllocationRule> _taskAllocationRuleRepository) [FromServices] IRepository<TaskAllocationRule> _taskAllocationRuleRepository)
{ {
//var trial = _trialRepository.FirstOrDefault(t => t.Id == trialId); //var trial = _trialRepository.FirstOrDefault(t => t.Id == trialId);
@ -408,18 +409,38 @@ namespace IRaCIS.Core.Application.Service
//当邮件发送没有问题的时候,才修改状态 如果有问题,就当前不做处理 //当邮件发送没有问题的时候,才修改状态 如果有问题,就当前不做处理
try try
{ {
var userId = await _mailVerificationService.DoctorJoinTrialEmail(trialId, intoGroupItem.DoctorId, confirmReviewerCommand.BaseUrl, confirmReviewerCommand.RouteUrl); var (identityUserId, userRoleId) = await _mailVerificationService.DoctorJoinTrialEmail(trialId, intoGroupItem.DoctorId, confirmReviewerCommand.BaseUrl, confirmReviewerCommand.RouteUrl);
if (!await _trialUserRoleRepository.AnyAsync(t => t.TrialId == trialId && t.UserId == userId, true))
var findTrialUser = await _trialIdentityUserRepository.FirstOrDefaultAsync(t => t.IdentityUserId == identityUserId);
//项目中不存在
if (findTrialUser == null)
{ {
await _trialUserRoleRepository.AddAsync(new TrialUserRole() { TrialId = trialId, UserId = userId, JoinTime = DateTime.Now });
await _trialIdentityUserRepository.AddAsync(new TrialIdentityUser()
{
TrialId = trialId,
IdentityUserId = identityUserId,
JoinTime = DateTime.Now,
TrialUserRoleList = new List<TrialUserRole>() { new TrialUserRole() { TrialId = trialId, UserId = userRoleId } }
});
}
else
{
if (!await _trialUserRoleRepository.AnyAsync(t => t.TrialId == trialId && t.UserId == userRoleId, true))
{
await _trialUserRoleRepository.AddAsync(new TrialUserRole() { TrialId = trialId, UserId = userRoleId, TrialUserId = findTrialUser.Id });
}
} }
await _enrollRepository.BatchUpdateNoTrackingAsync(t => t.Id == intoGroupItem.Id, u => new Enroll() { DoctorUserId = userId });
if (!await _taskAllocationRuleRepository.AnyAsync(t => t.TrialId == trialId && t.DoctorUserId == userId && t.EnrollId == intoGroupItem.Id, true))
await _enrollRepository.BatchUpdateNoTrackingAsync(t => t.Id == intoGroupItem.Id, u => new Enroll() { DoctorUserId = userRoleId });
if (!await _taskAllocationRuleRepository.AnyAsync(t => t.TrialId == trialId && t.DoctorUserId == userRoleId && t.EnrollId == intoGroupItem.Id, true))
{ {
await _taskAllocationRuleRepository.AddAsync(new TaskAllocationRule() { TrialId = trialId, DoctorUserId = userId, EnrollId = intoGroupItem.Id }); await _taskAllocationRuleRepository.AddAsync(new TaskAllocationRule() { TrialId = trialId, DoctorUserId = userRoleId, EnrollId = intoGroupItem.Id });
} }