|
|
|
@ -108,13 +108,17 @@ public class UrgentMedicalReviewAddedEventConsumer(
|
|
|
|
|
//dictionValue[1], // 阅片人是否同意 {6}
|
|
|
|
|
dictionValue[2], // 审核状态 {6}
|
|
|
|
|
dictionValue[3], // 是否加急 {7}
|
|
|
|
|
|
|
|
|
|
_systemEmailConfig.SiteUrl // 链接 {8}
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
return (topicStr, htmlBodyStr);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
await CommonEmailHelper.GetEmailSubejctAndHtmlInfoAndBuildAsync(_emailNoticeConfigrepository, EmailBusinessScenario.EligibilityVerification_MedicalQC, messageToSend, emailConfigFunc);
|
|
|
|
|
await CommonEmailHelper.GetEmailSubejctAndHtmlInfoAndBuildAsync(_emailNoticeConfigrepository,
|
|
|
|
|
|
|
|
|
|
context.Message.IsPD ? EmailBusinessScenario.PDVerification_MedicalQC : EmailBusinessScenario.EligibilityVerification_MedicalQC,
|
|
|
|
|
|
|
|
|
|
messageToSend, emailConfigFunc);
|
|
|
|
|
|
|
|
|
|
await SendEmailHelper.SendEmailAsync(messageToSend, _systemEmailConfig);
|
|
|
|
|
}
|
|
|
|
@ -125,6 +129,7 @@ public class UrgentIRRepliedMedicalReviewConsumer(
|
|
|
|
|
IRepository<User> _userRepository,
|
|
|
|
|
IRepository<TaskMedicalReview> _taskMedicalReviewRepository,
|
|
|
|
|
IRepository<Trial> _trialRepository,
|
|
|
|
|
IRepository<SubjectVisit> _subjectVisitRepository,
|
|
|
|
|
IRepository<ReadingQuestionCriterionTrial> _readingQuestionCriterionTrialRepository,
|
|
|
|
|
IRepository<VisitTask> _visitTaskRepository,
|
|
|
|
|
IRepository<Dictionary> _dictionaryRepository,
|
|
|
|
@ -137,73 +142,85 @@ public class UrgentIRRepliedMedicalReviewConsumer(
|
|
|
|
|
//IR 回复医学反馈通知MIM
|
|
|
|
|
public async Task Consume(ConsumeContext<UrgentIRRepliedMedicalReview> context)
|
|
|
|
|
{
|
|
|
|
|
//Console.WriteLine("发送【加急的医学反馈任务 通知MIM】邮件!!!");
|
|
|
|
|
//var isEn_US = CultureInfo.CurrentCulture.Name == StaticData.CultureInfo.en_US;
|
|
|
|
|
Console.WriteLine("发送(028,029) 【IR 回复医学反馈通知MIM】邮件!!!");
|
|
|
|
|
var isEn_US = CultureInfo.CurrentCulture.Name == StaticData.CultureInfo.en_US;
|
|
|
|
|
|
|
|
|
|
//var medicalReviewId = context.Message.MedicalReviewId;
|
|
|
|
|
var medicalReviewId = context.Message.MedicalReviewId;
|
|
|
|
|
|
|
|
|
|
//var medicalReview = await _taskMedicalReviewRepository.Where(x => x.Id == medicalReviewId).Include(x => x.VisitTask).Include(x => x.MedicalManagerUser).FirstOrDefaultAsync();
|
|
|
|
|
var medicalReview = await _taskMedicalReviewRepository.Where(x => x.Id == medicalReviewId).Include(x => x.VisitTask).Include(x => x.MedicalManagerUser).FirstOrDefaultAsync();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//if (medicalReview.MedicalManagerUserId == null)
|
|
|
|
|
//{
|
|
|
|
|
// Console.WriteLine("MIMId为空 ID" + medicalReviewId);
|
|
|
|
|
// return;
|
|
|
|
|
//}
|
|
|
|
|
//var criterion = await _readingQuestionCriterionTrialRepository.FirstOrDefaultAsync(x => x.Id == medicalReview.VisitTask.TrialReadingCriterionId);
|
|
|
|
|
//var userinfo = await _userRepository.Where(x => x.Id == medicalReview.MedicalManagerUserId).FirstOrDefaultAsync();
|
|
|
|
|
if (medicalReview.MedicalManagerUserId == null)
|
|
|
|
|
{
|
|
|
|
|
Console.WriteLine("MIMId为空 ID" + medicalReviewId);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
var criterion = await _readingQuestionCriterionTrialRepository.FirstOrDefaultAsync(x => x.Id == medicalReview.VisitTask.TrialReadingCriterionId);
|
|
|
|
|
var userinfo = await _userRepository.Where(x => x.Id == medicalReview.MedicalManagerUserId).FirstOrDefaultAsync();
|
|
|
|
|
|
|
|
|
|
//var taskInfo = await _visitTaskRepository.Where(x => x.Id == medicalReview.VisitTaskId).Include(x => x.SourceSubjectVisit).Include(x => x.ReadModule).Include(x => x.Subject).FirstNotNullAsync();
|
|
|
|
|
var taskInfo = await _visitTaskRepository.Where(x => x.Id == medicalReview.VisitTaskId).Include(x => x.SourceSubjectVisit).Include(x => x.ReadModule).Include(x => x.Subject).FirstNotNullAsync();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//var messageToSend = new MimeMessage();
|
|
|
|
|
////发件地址
|
|
|
|
|
//messageToSend.From.Add(new MailboxAddress(_systemEmailConfig.FromName, _systemEmailConfig.FromEmail));
|
|
|
|
|
//messageToSend.To.Add(new MailboxAddress(String.Empty, userinfo.EMail));
|
|
|
|
|
|
|
|
|
|
//var trialInfo = await _trialRepository.FirstOrDefaultAsync(t => t.Id == medicalReview.TrialId);
|
|
|
|
|
//var companyName = isEn_US ? _systemEmailConfig.CompanyShortName : _systemEmailConfig.CompanyShortNameCN;
|
|
|
|
|
var visitid = taskInfo.SourceSubjectVisit == null ? taskInfo.ReadModule.SubjectVisitId : taskInfo.SourceSubjectVisitId;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//var dictionValue = await CommonEmailHelper.TranslationDictionary(new TranslationDictionaryDto()
|
|
|
|
|
//{
|
|
|
|
|
|
|
|
|
|
// DictionaryRepository = _dictionaryRepository,
|
|
|
|
|
// IsEn_US = isEn_US,
|
|
|
|
|
var subjectVisit = await _subjectVisitRepository.Where(x => x.Id == visitid).FirstOrDefaultAsync();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// DictionaryList = new List<DictionaryDto>()
|
|
|
|
|
// {
|
|
|
|
|
// new DictionaryDto (){DictionaryCode= "ReadingCategory",EnumValue=taskInfo.ReadingCategory.GetEnumInt(), },
|
|
|
|
|
// new DictionaryDto (){DictionaryCode= "MedicalReviewDoctorUserIdea",EnumValue=medicalReview.DoctorUserIdeaEnum.GetEnumInt(), },
|
|
|
|
|
// new DictionaryDto (){DictionaryCode= "MedicalReviewAuditState",EnumValue=medicalReview.AuditState.GetEnumInt(), },
|
|
|
|
|
// new DictionaryDto (){DictionaryCode= "YesOrNo",EnumValue=taskInfo.IsUrgent.ToString(), }
|
|
|
|
|
// }
|
|
|
|
|
//});
|
|
|
|
|
|
|
|
|
|
//Func<(string topicStr, string htmlBodyStr), (string topicStr, string htmlBodyStr)> emailConfigFunc = input =>
|
|
|
|
|
//{
|
|
|
|
|
// var topicStr = string.Format(input.topicStr, companyName, trialInfo.ResearchProgramNo);
|
|
|
|
|
// var htmlBodyStr = string.Format(
|
|
|
|
|
// CommonEmailHelper.ReplaceCompanyName(_systemEmailConfig, input.htmlBodyStr),
|
|
|
|
|
// userinfo.FullName, // 用户名
|
|
|
|
|
// trialInfo.ExperimentName, // 项目
|
|
|
|
|
// criterion.CriterionName, // 阅片标准
|
|
|
|
|
// taskInfo.BlindSubjectCode.IsNullOrEmpty() ? taskInfo.Subject.Code : taskInfo.BlindSubjectCode, // 受试者
|
|
|
|
|
// taskInfo.TaskBlindName, // 访视
|
|
|
|
|
// dictionValue[0], // 任务类型
|
|
|
|
|
// dictionValue[1], // 阅片人是否同意
|
|
|
|
|
// dictionValue[2], // 审核状态
|
|
|
|
|
// dictionValue[3] // 是否加急
|
|
|
|
|
// );
|
|
|
|
|
var messageToSend = new MimeMessage();
|
|
|
|
|
//发件地址
|
|
|
|
|
messageToSend.From.Add(new MailboxAddress(_systemEmailConfig.FromName, _systemEmailConfig.FromEmail));
|
|
|
|
|
messageToSend.To.Add(new MailboxAddress(String.Empty, userinfo.EMail));
|
|
|
|
|
|
|
|
|
|
// return (topicStr, htmlBodyStr);
|
|
|
|
|
//};
|
|
|
|
|
var trialInfo = await _trialRepository.FirstOrDefaultAsync(t => t.Id == medicalReview.TrialId);
|
|
|
|
|
var companyName = isEn_US ? _systemEmailConfig.CompanyShortName : _systemEmailConfig.CompanyShortNameCN;
|
|
|
|
|
|
|
|
|
|
//await CommonEmailHelper.GetEmailSubejctAndHtmlInfoAndBuildAsync(_emailNoticeConfigrepository, EmailBusinessScenario.EligibilityVerification_MedicalQC, messageToSend, emailConfigFunc);
|
|
|
|
|
|
|
|
|
|
//await SendEmailHelper.SendEmailAsync(messageToSend, _systemEmailConfig);
|
|
|
|
|
var dictionValue = await CommonEmailHelper.TranslationDictionary(new TranslationDictionaryDto()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
DictionaryRepository = _dictionaryRepository,
|
|
|
|
|
IsEn_US = isEn_US,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DictionaryList = new List<DictionaryDto>()
|
|
|
|
|
{
|
|
|
|
|
new DictionaryDto (){DictionaryCode= "ReadingCategory",EnumValue=taskInfo.ReadingCategory.GetEnumInt(), },
|
|
|
|
|
new DictionaryDto (){DictionaryCode= "MedicalReviewDoctorUserIdea",EnumValue=medicalReview.DoctorUserIdeaEnum.GetEnumInt(), },
|
|
|
|
|
new DictionaryDto (){DictionaryCode= "MedicalReviewAuditState",EnumValue=medicalReview.AuditState.GetEnumInt(), },
|
|
|
|
|
new DictionaryDto (){DictionaryCode= "YesOrNo",EnumValue=taskInfo.IsUrgent.ToString(), }
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
Func<(string topicStr, string htmlBodyStr), (string topicStr, string htmlBodyStr)> emailConfigFunc = input =>
|
|
|
|
|
{
|
|
|
|
|
var topicStr = string.Format(input.topicStr, companyName, trialInfo.ResearchProgramNo);
|
|
|
|
|
var htmlBodyStr = string.Format(
|
|
|
|
|
CommonEmailHelper.ReplaceCompanyName(_systemEmailConfig, input.htmlBodyStr),
|
|
|
|
|
userinfo.FullName, // 用户名 {0}
|
|
|
|
|
trialInfo.ExperimentName, // 项目 {1}
|
|
|
|
|
criterion.CriterionName, // 阅片标准 {2}
|
|
|
|
|
taskInfo.BlindSubjectCode.IsNullOrEmpty() ? taskInfo.Subject.Code : taskInfo.BlindSubjectCode, // 受试者 {3}
|
|
|
|
|
taskInfo.TaskBlindName, // 访视 {4}
|
|
|
|
|
dictionValue[0], // 任务类型 {5}
|
|
|
|
|
dictionValue[1], // 阅片人是否同意 {6}
|
|
|
|
|
dictionValue[2], // 审核状态 {7}
|
|
|
|
|
dictionValue[3], // 是否加急 {8}
|
|
|
|
|
_systemEmailConfig.SiteUrl // 链接 {9}
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
return (topicStr, htmlBodyStr);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
await CommonEmailHelper.GetEmailSubejctAndHtmlInfoAndBuildAsync(_emailNoticeConfigrepository,
|
|
|
|
|
|
|
|
|
|
context.Message.IsPD ? EmailBusinessScenario.PDVerification_ExpeditedMedicalQCResponse : EmailBusinessScenario.EligibilityVerification_ExpeditedMedicalQCResponse,
|
|
|
|
|
|
|
|
|
|
messageToSend, emailConfigFunc);
|
|
|
|
|
|
|
|
|
|
await SendEmailHelper.SendEmailAsync(messageToSend, _systemEmailConfig);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|