修改入组发送邮件逻辑
parent
8f38cef49f
commit
951776ea6b
|
@ -2438,6 +2438,11 @@
|
|||
问题英文分组
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:IRaCIS.Core.Application.Service.Reading.Dto.TaskQuestionAnswer.GlobalChangeAnswer">
|
||||
<summary>
|
||||
全局阅片修改的答案
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:IRaCIS.Core.Application.Service.Reading.Dto.VistTaskTableQuestionRowInfo.OrderMark">
|
||||
<summary>
|
||||
序号标记
|
||||
|
|
|
@ -419,6 +419,9 @@ namespace IRaCIS.Core.Application.Service
|
|||
|
||||
int currentMaxCodeInt = cacheMaxCodeInt > dbMaxCode ? cacheMaxCodeInt : dbMaxCode;
|
||||
|
||||
|
||||
|
||||
|
||||
switch (generateTaskCommand.ReadingCategory)
|
||||
{
|
||||
case GenerateTaskCategory.Visit:
|
||||
|
@ -1010,8 +1013,6 @@ namespace IRaCIS.Core.Application.Service
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
break;
|
||||
|
||||
|
||||
|
@ -1019,8 +1020,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
|
||||
var reReadingVisitTask = generateTaskCommand.ReReadingTask;
|
||||
|
||||
|
||||
|
||||
var subjectVisitUrgent = _subjectVisitRepository.Where(t => t.Id == reReadingVisitTask.SourceSubjectVisitId).Select(t=>t.IsUrgent).FirstOrDefault();
|
||||
|
||||
var newTask = await _visitTaskRepository.AddAsync(new VisitTask()
|
||||
{
|
||||
|
@ -1031,6 +1031,8 @@ namespace IRaCIS.Core.Application.Service
|
|||
TaskName = reReadingVisitTask.TaskName,
|
||||
TaskBlindName = reReadingVisitTask.TaskBlindName,
|
||||
|
||||
IsUrgent = reReadingVisitTask.IsAnalysisCreate?false: subjectVisitUrgent,
|
||||
|
||||
VisitTaskNum = reReadingVisitTask.VisitTaskNum,
|
||||
ReadingCategory = reReadingVisitTask.ReadingCategory,
|
||||
SourceSubjectVisitId = reReadingVisitTask.SourceSubjectVisitId,
|
||||
|
@ -1055,7 +1057,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
// AllocateTime = DateTime.Now,
|
||||
//DoctorUserId = reReadingVisitTask.DoctorUserId,
|
||||
|
||||
});
|
||||
});;
|
||||
|
||||
generateTaskCommand.Action(newTask);
|
||||
|
||||
|
@ -1253,7 +1255,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
{
|
||||
TrialId = trialId,
|
||||
SubjectId = item.SubjectId,
|
||||
IsUrgent = item.IsUrgent,
|
||||
IsUrgent = originalTaskInfo.IsUrgent,
|
||||
VisitTaskNum = item.VisitNum + ReadingCommon.TaskNumDic[ReadingCategory.Global],
|
||||
TaskName = item.ReadingName,
|
||||
ArmEnum = originalTaskInfo.ArmEnum,//特殊
|
||||
|
@ -1299,7 +1301,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
{
|
||||
TrialId = trialId,
|
||||
SubjectId = item.SubjectId,
|
||||
IsUrgent = item.IsUrgent,
|
||||
IsUrgent = originalTaskInfo.IsUrgent,
|
||||
TaskName = item.ReadingName,
|
||||
// 原任务是全局任务 加0.03 就好
|
||||
VisitTaskNum = originalTaskInfo.VisitTaskNum + 0.03m,
|
||||
|
|
|
@ -33,7 +33,7 @@ namespace IRaCIS.Application.Contracts
|
|||
public List<Guid> ReadingTypeIds => DictionaryList.Where(t => t.ParentCode == StaticData.ReadingType).OrderBy(t => t.ShowOrder).Select(t => t.Id).ToList();
|
||||
|
||||
|
||||
|
||||
public string AccountUserName { get; set; }
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -82,6 +82,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
#region 医生基本信息
|
||||
CreateMap<Doctor, SelectionReviewerDTO>();
|
||||
CreateMap<Doctor, DoctorDTO>().IncludeMembers(t => t.Hospital).Include<Doctor, SelectionReviewerDTO>()
|
||||
.ForMember(d => d.AccountUserName, u => u.MapFrom(s => s.EnrollList.Where(t=>t.DoctorUserId!=null).Select(c=>c.DoctorUser.UserName).FirstOrDefault()))
|
||||
.ForMember(d => d.Department, u => u.MapFrom(s => s.Department.Value))
|
||||
.ForMember(d => d.DepartmentCN, u => u.MapFrom(s => s.Department.ValueCN))
|
||||
.ForMember(d => d.Position, u => u.MapFrom(s => s.Position.Value))
|
||||
|
|
|
@ -6,6 +6,7 @@ using Microsoft.AspNetCore.Mvc;
|
|||
using IRaCIS.Core.Application.Service.WorkLoad.DTO;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using IRaCIS.Core.Application.Auth;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace IRaCIS.Application.Services
|
||||
{
|
||||
|
@ -376,38 +377,61 @@ namespace IRaCIS.Application.Services
|
|||
//更新入组表
|
||||
var intoGroupList = await _enrollRepository.Where(t => t.TrialId == trialId,true).ToListAsync();
|
||||
|
||||
//验证邮件
|
||||
var emaiList = await _doctorRepository.Where(t => intoGroupList.Select(t => t.DoctorId).Contains(t.Id))
|
||||
.Select(t => new { t.EMail, t.FirstName, t.LastName }).ToListAsync();
|
||||
|
||||
|
||||
var errorList = emaiList.Where(t => !Regex.IsMatch(t.EMail, @"^[a-zA-Z0-9_-]+@[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+$"))
|
||||
.ToList();
|
||||
|
||||
if (errorList.Count() > 0)
|
||||
{
|
||||
return ResponseOutput.NotOk(string.Join(',', errorList.Select(c => c.LastName+" / "+c.FirstName)) +"邮箱格式存在问题") ;
|
||||
}
|
||||
|
||||
if (confirmReviewerCommand.ConfirmState == 1) //确认入组
|
||||
{
|
||||
foreach (var intoGroupItem in intoGroupList)
|
||||
{
|
||||
if (confirmReviewerCommand.DoctorIdArray.Contains(intoGroupItem.DoctorId))
|
||||
{
|
||||
intoGroupItem.EnrollStatus = EnrollStatus.ConfirmIntoGroup;
|
||||
intoGroupItem.EnrollTime = DateTime.Now;
|
||||
|
||||
var userId = await _mailVerificationService.DoctorJoinTrialEmail(trialId, intoGroupItem.DoctorId, confirmReviewerCommand.BaseUrl, confirmReviewerCommand.RouteUrl);
|
||||
|
||||
if ( !await _trialUserRepository.AnyAsync(t=>t.TrialId==trialId && t.UserId== userId, true))
|
||||
//当邮件发送没有问题的时候,才修改状态 如果有问题,就当前不做处理
|
||||
try
|
||||
{
|
||||
await _trialUserRepository.AddAsync(new TrialUser() { TrialId = trialId, UserId = userId ,JoinTime = DateTime.Now });
|
||||
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, JoinTime = DateTime.Now });
|
||||
}
|
||||
|
||||
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 _taskAllocationRuleRepository.AddAsync(new TaskAllocationRule() { TrialId = trialId, DoctorUserId = userId, EnrollId = intoGroupItem.Id });
|
||||
|
||||
}
|
||||
|
||||
await _enrollDetailRepository.AddAsync(new EnrollDetail()
|
||||
{
|
||||
DoctorId = intoGroupItem.DoctorId,
|
||||
TrialId = trialId,
|
||||
EnrollStatus = EnrollStatus.ConfirmIntoGroup,
|
||||
OptUserType = (int)SystemUserType.AdminUser, //后台用户
|
||||
});
|
||||
|
||||
intoGroupItem.EnrollStatus = EnrollStatus.ConfirmIntoGroup;
|
||||
intoGroupItem.EnrollTime = DateTime.Now;
|
||||
}
|
||||
|
||||
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))
|
||||
catch (Exception )
|
||||
{
|
||||
await _taskAllocationRuleRepository.AddAsync(new TaskAllocationRule() { TrialId = trialId, DoctorUserId = userId, EnrollId = intoGroupItem.Id });
|
||||
intoGroupItem.EnrollStatus = EnrollStatus.ConfirmIntoGroupFailed;
|
||||
|
||||
}
|
||||
|
||||
|
||||
await _enrollDetailRepository.AddAsync(new EnrollDetail()
|
||||
{
|
||||
DoctorId = intoGroupItem.DoctorId,
|
||||
TrialId = trialId,
|
||||
EnrollStatus = EnrollStatus.ConfirmIntoGroup,
|
||||
OptUserType = (int)SystemUserType.AdminUser, //后台用户
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
|
||||
ConfirmIntoGroup = 10, // 确认入组
|
||||
|
||||
//HasUploadAgreement = 11, // 已上传协议
|
||||
ConfirmIntoGroupFailed = 11,
|
||||
|
||||
DoctorTrained = 12, // 参加培训
|
||||
|
||||
|
|
Loading…
Reference in New Issue