修改
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
parent
7a318eae45
commit
276ad83080
|
@ -14159,7 +14159,7 @@
|
||||||
影像重传和阅片人筛选相关邮件发送
|
影像重传和阅片人筛选相关邮件发送
|
||||||
</summary>
|
</summary>
|
||||||
</member>
|
</member>
|
||||||
<member name="M:IRaCIS.Core.Application.MassTransit.Consumer.ImageConsumer.#ctor(IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.UserRole},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.TrialUserRole},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.SubjectVisit},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.Trial},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.Enroll},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.VisitTask},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.ReadModule},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.Dictionary},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.EmailNoticeConfig},Microsoft.Extensions.Options.IOptionsMonitor{IRaCIS.Core.Domain.Share.SystemEmailSendConfig})">
|
<member name="M:IRaCIS.Core.Application.MassTransit.Consumer.ImageConsumer.#ctor(IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.UserRole},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.TrialUserRole},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.SubjectVisit},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.Trial},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.Enroll},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.VisitTask},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.ReadModule},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.EmailNoticeUserType},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.TrialSite},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.Dictionary},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.EmailNoticeConfig},Microsoft.Extensions.Options.IOptionsMonitor{IRaCIS.Core.Domain.Share.SystemEmailSendConfig})">
|
||||||
<summary>
|
<summary>
|
||||||
影像重传和阅片人筛选相关邮件发送
|
影像重传和阅片人筛选相关邮件发送
|
||||||
</summary>
|
</summary>
|
||||||
|
|
|
@ -65,7 +65,7 @@ public class ImageConsumer(
|
||||||
var subjectVisitId = context.Message.SubjectVisitId;
|
var subjectVisitId = context.Message.SubjectVisitId;
|
||||||
var subjectVisit = await _subjectVisitRepository.Where(x => x.Id == subjectVisitId).Include(x => x.Subject).FirstNotNullAsync();
|
var subjectVisit = await _subjectVisitRepository.Where(x => x.Id == subjectVisitId).Include(x => x.Subject).FirstNotNullAsync();
|
||||||
var trialId = subjectVisit.TrialId;
|
var trialId = subjectVisit.TrialId;
|
||||||
|
List<UserTypeEnum> userTypes = null;
|
||||||
// 根据申请角色和状态确定邮件场景
|
// 根据申请角色和状态确定邮件场景
|
||||||
EmailBusinessScenario scenario;
|
EmailBusinessScenario scenario;
|
||||||
if (context.Message.ImageBackState == ImageBackStateEnum.None)
|
if (context.Message.ImageBackState == ImageBackStateEnum.None)
|
||||||
|
@ -87,6 +87,14 @@ public class ImageConsumer(
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
scenario = EmailBusinessScenario.ImageReUpload_PMApprovalRe_Uploading; // 66
|
scenario = EmailBusinessScenario.ImageReUpload_PMApprovalRe_Uploading; // 66
|
||||||
|
if (context.Message.ApplyUserRole == ImageBackApplyEnum.IQCRequestBack)
|
||||||
|
{
|
||||||
|
userTypes = new List<UserTypeEnum>() { UserTypeEnum.IQC };
|
||||||
|
}
|
||||||
|
else if (context.Message.ApplyUserRole == ImageBackApplyEnum.CRCRequestBack)
|
||||||
|
{
|
||||||
|
userTypes = new List<UserTypeEnum>() { UserTypeEnum.ClinicalResearchCoordinator };
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -94,7 +102,7 @@ public class ImageConsumer(
|
||||||
|
|
||||||
if (trialEmailConfig != null)
|
if (trialEmailConfig != null)
|
||||||
{
|
{
|
||||||
await SendImageReuploadEmail(trialEmailConfig, scenario, subjectVisit, trialId);
|
await SendImageReuploadEmail(trialEmailConfig, scenario, subjectVisit, trialId, userTypes, context.Message.ImageBackState);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -216,7 +224,7 @@ public class ImageConsumer(
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 发送影像重传相关邮件的通用方法
|
/// 发送影像重传相关邮件的通用方法
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private async Task SendImageReuploadEmail(EmailNoticeConfig emailNoticeConfig, EmailBusinessScenario scenario, SubjectVisit subjectVisit, Guid trialId)
|
private async Task SendImageReuploadEmail(EmailNoticeConfig emailNoticeConfig, EmailBusinessScenario scenario, SubjectVisit subjectVisit, Guid trialId,List<UserTypeEnum> userTypes=null, ImageBackStateEnum imageBackStateEnum= ImageBackStateEnum.None)
|
||||||
{
|
{
|
||||||
var isEn_US = CultureInfo.CurrentCulture.Name == StaticData.CultureInfo.en_US;
|
var isEn_US = CultureInfo.CurrentCulture.Name == StaticData.CultureInfo.en_US;
|
||||||
|
|
||||||
|
@ -231,21 +239,40 @@ public class ImageConsumer(
|
||||||
List<UserRole> ccUserList = new List<UserRole>();
|
List<UserRole> ccUserList = new List<UserRole>();
|
||||||
|
|
||||||
var emailNoticeUserList = await _emailNoticeUserTypeRepository.Where(x => x.EmailNoticeConfigId == emailNoticeConfig.Id).ToListAsync();
|
var emailNoticeUserList = await _emailNoticeUserTypeRepository.Where(x => x.EmailNoticeConfigId == emailNoticeConfig.Id).ToListAsync();
|
||||||
|
var userTypeEnum= emailNoticeUserList.Select(x => x.UserType).ToList();
|
||||||
|
if (userTypes != null)
|
||||||
|
{
|
||||||
|
userTypeEnum = userTypes;
|
||||||
|
}
|
||||||
var crcUserList =new List<UserRole>(){ };
|
var crcUserList =new List<UserRole>(){ };
|
||||||
if (emailNoticeUserList.Select(x => x.UserType).Contains(UserTypeEnum.ClinicalResearchCoordinator))
|
if (userTypeEnum.Contains(UserTypeEnum.ClinicalResearchCoordinator))
|
||||||
{
|
{
|
||||||
crcUserList=await _trialSiteRepository.Where(x=>x.Id== subjectVisit.TrialSiteId).SelectMany(x=>x.CRCUserList.Select(y => y.UserRole)).ToListAsync();
|
crcUserList=await _trialSiteRepository.Where(x=>x.Id== subjectVisit.TrialSiteId).SelectMany(x=>x.CRCUserList.Select(y => y.UserRole)).ToListAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
var toList = emailNoticeUserList.Where(x => x.EmailUserType == EmailUserType.To&& x.UserType != UserTypeEnum.ClinicalResearchCoordinator).Select(x=>x.UserType).ToList();
|
if (userTypes == null)
|
||||||
|
{
|
||||||
|
var toList = emailNoticeUserList.Where(x => x.EmailUserType == EmailUserType.To && x.UserType != UserTypeEnum.ClinicalResearchCoordinator).Select(x => x.UserType).ToList();
|
||||||
|
|
||||||
toUserList = trialUser.Where(x => toList.Contains(x.UserTypeEnum) ).ToList();
|
toUserList = trialUser.Where(x => toList.Contains(x.UserTypeEnum)).ToList();
|
||||||
|
|
||||||
if (emailNoticeUserList.Any(x => x.EmailUserType == EmailUserType.To && x.UserType == UserTypeEnum.ClinicalResearchCoordinator))
|
if (emailNoticeUserList.Any(x => x.EmailUserType == EmailUserType.To && x.UserType == UserTypeEnum.ClinicalResearchCoordinator))
|
||||||
{
|
{
|
||||||
toUserList.AddRange(crcUserList);
|
toUserList.AddRange(crcUserList);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var toList = userTypes.Where(x => x != UserTypeEnum.ClinicalResearchCoordinator).ToList();
|
||||||
|
|
||||||
|
toUserList = trialUser.Where(x => toList.Contains(x.UserTypeEnum)).ToList();
|
||||||
|
|
||||||
|
if (userTypes.Any(x => x == UserTypeEnum.ClinicalResearchCoordinator))
|
||||||
|
{
|
||||||
|
toUserList.AddRange(crcUserList);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
var ccList = emailNoticeUserList.Where(x => x.EmailUserType == EmailUserType.Copy && x.UserType != UserTypeEnum.ClinicalResearchCoordinator).Select(x => x.UserType).ToList();
|
var ccList = emailNoticeUserList.Where(x => x.EmailUserType == EmailUserType.Copy && x.UserType != UserTypeEnum.ClinicalResearchCoordinator).Select(x => x.UserType).ToList();
|
||||||
|
|
||||||
|
@ -275,30 +302,20 @@ public class ImageConsumer(
|
||||||
messageToSend.Cc.Add(new MailboxAddress(String.Empty, ccUser.EMail));
|
messageToSend.Cc.Add(new MailboxAddress(String.Empty, ccUser.EMail));
|
||||||
}
|
}
|
||||||
|
|
||||||
string isUrgent = string.Empty;
|
|
||||||
|
|
||||||
if (isEn_US)
|
|
||||||
|
var dictionValue = await CommonEmailHelper.TranslationDictionary(new TranslationDictionaryDto()
|
||||||
{
|
{
|
||||||
if (subjectVisit.IsUrgent)
|
|
||||||
|
DictionaryRepository = _dictionaryRepository,
|
||||||
|
IsEn_US = isEn_US,
|
||||||
|
DictionaryList = new List<DictionaryDto>()
|
||||||
{
|
{
|
||||||
isUrgent = "yes";
|
new DictionaryDto (){DictionaryCode= "YesOrNo",EnumValue=subjectVisit.IsUrgent.ToString(), }, //是否加急
|
||||||
}
|
new DictionaryDto (){DictionaryCode= "ImageBackState",EnumValue=imageBackStateEnum.GetEnumInt(), }, //审批结果
|
||||||
else
|
|
||||||
{
|
|
||||||
isUrgent = "no";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (subjectVisit.IsUrgent)
|
|
||||||
{
|
|
||||||
isUrgent = "是";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
isUrgent = "否";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
|
||||||
// 格式化邮件内容
|
// 格式化邮件内容
|
||||||
Func<(string topicStr, string htmlBodyStr), (string topicStr, string htmlBodyStr)> emailConfigFunc = input =>
|
Func<(string topicStr, string htmlBodyStr), (string topicStr, string htmlBodyStr)> emailConfigFunc = input =>
|
||||||
|
@ -311,8 +328,8 @@ public class ImageConsumer(
|
||||||
trialInfo.ExperimentName, // 项目 {1}
|
trialInfo.ExperimentName, // 项目 {1}
|
||||||
subjectCode, // 受试者 {2}
|
subjectCode, // 受试者 {2}
|
||||||
subjectVisit.VisitName, // 访视 {3}
|
subjectVisit.VisitName, // 访视 {3}
|
||||||
isUrgent, // 是否加急 {4}
|
dictionValue[0], // 是否加急 {4}
|
||||||
"", // 预留 {5}
|
dictionValue[1], // 审批结果 {5}
|
||||||
_systemEmailConfig.SiteUrl // 链接 {6}
|
_systemEmailConfig.SiteUrl // 链接 {6}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue