医生加入项目修改
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]
</summary>
</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>
入组流程-后台确认医生入组[Confirm]
</summary>

View File

@ -34,7 +34,7 @@ namespace IRaCIS.Core.Application.Service
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);
}
@ -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 sysUserInfo = new IdentityUser();
@ -661,7 +661,7 @@ namespace IRaCIS.Core.Application.Service
await SendEmailHelper.SendEmailAsync(messageToSend, _systemEmailConfig, null);
return sysUserInfo.Id;
return (sysUserInfo.Id, sysUserInfo.UserRoleList.First(t => t.UserTypeEnum == UserTypeEnum.IndependentReviewer).Id);
}

View File

@ -114,7 +114,7 @@ namespace IRaCIS.Core.Application.Service
/// <returns></returns>
[HttpPost("{trialId:guid}")]
[TrialGlobalLimit( "AfterStopCannNotOpt" )]
[TrialGlobalLimit("AfterStopCannNotOpt")]
//[Authorize(Policy = IRaCISPolicy.PM_APM_SPM_CPM_SMM_CMM)]
public async Task<IResponseOutput> SelectReviewers(Guid trialId, Guid[] doctorIdArray)
{
@ -167,7 +167,7 @@ namespace IRaCIS.Core.Application.Service
/// </summary>
[HttpPost("{trialId:guid}/{commitState:int}")]
[TrialGlobalLimit( "AfterStopCannNotOpt" )]
[TrialGlobalLimit("AfterStopCannNotOpt")]
//[Authorize(Policy = IRaCISPolicy.PM_APM_SPM_CPM_SMM_CMM)]
public async Task<IResponseOutput> SubmitReviewer(Guid trialId, Guid[] doctorIdArray, int commitState)
{
@ -176,7 +176,7 @@ namespace IRaCIS.Core.Application.Service
var hasSPMOrCPM = await _trialUserRoleRepository.Where(t => t.TrialId == trialId).AnyAsync(t => t.UserRole.UserTypeEnum == UserTypeEnum.SPM || t.UserRole.UserTypeEnum == UserTypeEnum.CPM);
var isSPMjoin= trial.IsSPMJoinReviewerSelect && hasSPMOrCPM;
var isSPMjoin = trial.IsSPMJoinReviewerSelect && hasSPMOrCPM;
if (trial != null)
{
@ -264,7 +264,7 @@ namespace IRaCIS.Core.Application.Service
/// </summary>
[HttpPost("{trialId:guid}/{auditState:int}")]
[TrialGlobalLimit( "AfterStopCannNotOpt" )]
[TrialGlobalLimit("AfterStopCannNotOpt")]
//[Authorize(Policy = IRaCISPolicy.PM_APM_SPM_CPM_SMM_CMM)]
public async Task<IResponseOutput> ApproveReviewer(Guid trialId, Guid[] doctorIdArray, int auditState)
{
@ -350,11 +350,12 @@ namespace IRaCIS.Core.Application.Service
/// </summary>
[HttpPost]
[TrialGlobalLimit( "AfterStopCannNotOpt" )]
[TrialGlobalLimit("AfterStopCannNotOpt")]
//[Authorize(Policy = IRaCISPolicy.PM_APM_SPM_CPM_SMM_CMM)]
[UnitOfWork]
public async Task<IResponseOutput> ConfirmReviewer(ConfirmReviewerCommand confirmReviewerCommand,
[FromServices] IRepository<TrialUserRole> _trialUserRoleRepository,
[FromServices] IRepository<TrialIdentityUser> _trialIdentityUserRepository,
[FromServices] IRepository<TaskAllocationRule> _taskAllocationRuleRepository)
{
//var trial = _trialRepository.FirstOrDefault(t => t.Id == trialId);
@ -388,7 +389,7 @@ namespace IRaCIS.Core.Application.Service
return ResponseOutput.NotOk(string.Join(',', _localizer["Enroll_EmailFormat"], errorList.Select(c => c.LastName + " / " + c.FirstName)));
}
var readingQuestionCriterionTrial = await _ReadingQuestionCriterionTrialRepository.Where(x => x.TrialId == confirmReviewerCommand.TrialId && x.IsConfirm).ToListAsync();
@ -408,18 +409,38 @@ namespace IRaCIS.Core.Application.Service
//当邮件发送没有问题的时候,才修改状态 如果有问题,就当前不做处理
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 });
}
@ -471,10 +492,10 @@ namespace IRaCIS.Core.Application.Service
PhaseId = trial.PhaseId,
StartTime = DateTime.Now,
IndicationEnum = trial.IndicationEnum,
IndicationTypeId= trial.IndicationTypeId,
IndicationTypeId = trial.IndicationTypeId,
ExperienceDataType = dataType,
TrialId = trial.Id,
OtherCriterion= item.CriterionType.GetEnumInt()=="0"? item.CriterionName:string.Empty,
OtherCriterion = item.CriterionType.GetEnumInt() == "0" ? item.CriterionName : string.Empty,
VisitReadingCount = 0,
ExperienceCriteriaList = new List<TrialExperienceCriteria>() {
@ -514,7 +535,7 @@ namespace IRaCIS.Core.Application.Service
}
@ -534,7 +555,7 @@ namespace IRaCIS.Core.Application.Service
/// <param name="outEnrollTime"></param>
/// <returns></returns>
[HttpPost("{trialId:guid}/{doctorId:guid}/{optType:int}")]
[TrialGlobalLimit( "AfterStopCannNotOpt" )]
[TrialGlobalLimit("AfterStopCannNotOpt")]
//[Authorize(Policy = IRaCISPolicy.PM_APM_SPM_CPM)]
[Obsolete]
public async Task<IResponseOutput> EnrollBackOrOut(Guid trialId, Guid doctorId, int optType, DateTime? outEnrollTime)