手动发送邮件修改
parent
1f82b6cecf
commit
70039bcedf
|
@ -409,6 +409,26 @@ public static class FileStoreHelper
|
||||||
return (serverFilePath, relativePath, fileRealName);
|
return (serverFilePath, relativePath, fileRealName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 获取 入组确认 PD 进展发送邮件Word|PDF 存放路径
|
||||||
|
|
||||||
|
public static (string PhysicalPath, string RelativePath, string FileRealName) GetSubjectEnrollConfirmOrPDEmailPath(IWebHostEnvironment _hostEnvironment, string fileName, Guid trialId, Guid siteId, Guid subjectId)
|
||||||
|
{
|
||||||
|
var rootPath = FileStoreHelper.GetIRaCISRootDataFolder(_hostEnvironment);
|
||||||
|
|
||||||
|
string uploadFolderPath = Path.Combine(rootPath, StaticData.Folder.TrialDataFolder, trialId.ToString(), siteId.ToString(), subjectId.ToString());
|
||||||
|
|
||||||
|
if (!Directory.Exists(uploadFolderPath)) Directory.CreateDirectory(uploadFolderPath);
|
||||||
|
|
||||||
|
var (trustedFileNameForFileStorage, fileRealName) = FileStoreHelper.GetStoreFileName(fileName);
|
||||||
|
|
||||||
|
|
||||||
|
var relativePath = $"/{StaticData.Folder.IRaCISDataFolder}/{StaticData.Folder.TrialDataFolder}/{trialId}/{siteId}/{subjectId}/{trustedFileNameForFileStorage}";
|
||||||
|
|
||||||
|
var serverFilePath = Path.Combine(uploadFolderPath, trustedFileNameForFileStorage);
|
||||||
|
|
||||||
|
return (serverFilePath, relativePath, fileRealName);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public static string GetSubjectVisitDicomFolderPhysicalPath(IWebHostEnvironment _hostEnvironment,Guid trialId, Guid siteId, Guid subjectId, Guid subjectVisitId)
|
public static string GetSubjectVisitDicomFolderPhysicalPath(IWebHostEnvironment _hostEnvironment,Guid trialId, Guid siteId, Guid subjectId, Guid subjectVisitId)
|
||||||
{
|
{
|
||||||
|
|
|
@ -602,14 +602,32 @@
|
||||||
<returns></returns>
|
<returns></returns>
|
||||||
|
|
||||||
</member>
|
</member>
|
||||||
<member name="M:IRaCIS.Core.Application.Service.TrialEmailNoticeConfigService.BaseBusinessScenarioSendEmailAsync(System.Guid)">
|
<member name="M:IRaCIS.Core.Application.Service.TrialEmailNoticeConfigService.BaseBusinessScenarioSendEmailAsync(System.Guid,System.Nullable{System.Boolean},IRaCIS.Core.Domain.Share.Common.EmailStoreSendMode,System.String)">
|
||||||
<summary>
|
<summary>
|
||||||
测试邮件 带附件 填充word --前端不需要用
|
测试邮件 带附件 填充word --前端不需要用
|
||||||
</summary>
|
</summary>
|
||||||
<param name="visitTaskId"></param>
|
<param name="visitTaskId"></param>
|
||||||
|
<param name="isMedicalReviewAndSuggestApplyReReading"></param>
|
||||||
|
<param name="emailStoreMode"></param>
|
||||||
|
<param name="sendFileRelativePath"></param>
|
||||||
<returns></returns>
|
<returns></returns>
|
||||||
<exception cref="T:IRaCIS.Core.Infrastructure.BusinessValidationFailedException"></exception>
|
<exception cref="T:IRaCIS.Core.Infrastructure.BusinessValidationFailedException"></exception>
|
||||||
</member>
|
</member>
|
||||||
|
<member name="M:IRaCIS.Core.Application.Service.TrialEmailNoticeConfigService.ManualGenerateEmailFile(System.Guid)">
|
||||||
|
<summary>
|
||||||
|
手动生成入组确认 或者PD 进展的邮件 如果能发送,会返回文件的路径,否则会给出提示
|
||||||
|
</summary>
|
||||||
|
<param name="visitTaskId"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
|
<member name="M:IRaCIS.Core.Application.Service.TrialEmailNoticeConfigService.ManualSendEmail(System.Guid,System.String)">
|
||||||
|
<summary>
|
||||||
|
手动发送邮件
|
||||||
|
</summary>
|
||||||
|
<param name="visitTaskId"></param>
|
||||||
|
<param name="sendFileRelativePath"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
<member name="M:IRaCIS.Core.Application.Service.TrialEmailNoticeConfigService.GetTrialUserTypeSelectList(System.Guid)">
|
<member name="M:IRaCIS.Core.Application.Service.TrialEmailNoticeConfigService.GetTrialUserTypeSelectList(System.Guid)">
|
||||||
<summary>
|
<summary>
|
||||||
选择人员下拉
|
选择人员下拉
|
||||||
|
|
|
@ -6,23 +6,31 @@
|
||||||
|
|
||||||
using IRaCIS.Core.Application.ViewModel;
|
using IRaCIS.Core.Application.ViewModel;
|
||||||
using IRaCIS.Core.Domain.Share;
|
using IRaCIS.Core.Domain.Share;
|
||||||
|
using IRaCIS.Core.Domain.Share.Common;
|
||||||
|
|
||||||
namespace IRaCIS.Core.Application.Interfaces
|
namespace IRaCIS.Core.Application.Interfaces
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// ITrialEmailNoticeConfigService
|
/// ITrialEmailNoticeConfigService
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public interface ITrialEmailNoticeConfigService
|
public interface ITrialEmailNoticeConfigService
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
Task<List<TrialEmailNoticeConfigView>> GetTrialEmailNoticeConfigList(TrialEmailNoticeConfigQuery inQuery);
|
|
||||||
|
|
||||||
Task<IResponseOutput> AddOrUpdateTrialEmailNoticeConfig(TrialEmailNoticeConfigAddOrEdit addOrEditTrialEmailNoticeConfig);
|
|
||||||
|
|
||||||
Task<IResponseOutput> DeleteTrialEmailNoticeConfig(Guid trialEmailNoticeConfigId);
|
Task<List<TrialEmailNoticeConfigView>> GetTrialEmailNoticeConfigList(TrialEmailNoticeConfigQuery inQuery);
|
||||||
|
|
||||||
Task BaseBusinessScenarioSendEmailAsync( Guid visitTaskId, bool? isMedicalReviewAndSuggestApplyReReading = null);
|
Task<IResponseOutput> AddOrUpdateTrialEmailNoticeConfig(TrialEmailNoticeConfigAddOrEdit addOrEditTrialEmailNoticeConfig);
|
||||||
|
|
||||||
|
Task<IResponseOutput> DeleteTrialEmailNoticeConfig(Guid trialEmailNoticeConfigId);
|
||||||
|
|
||||||
|
Task<string> BaseBusinessScenarioSendEmailAsync(Guid visitTaskId, bool? isMedicalReviewAndSuggestApplyReReading = null, EmailStoreSendMode emailStoreMode = EmailStoreSendMode.StoreLocalSend, string sendFileRelativePath="");
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
public class EmailStoreSendDto
|
||||||
|
{
|
||||||
|
public EmailStoreSendMode EmailStoreSendMode { get; set; } = EmailStoreSendMode.StoreLocalSend;
|
||||||
|
|
||||||
|
public string SendFileRelativePath { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -17,6 +17,8 @@ using IRaCIS.Core.Application.Contracts;
|
||||||
using IRaCIS.Core.Application.Filter;
|
using IRaCIS.Core.Application.Filter;
|
||||||
using MiniSoftware;
|
using MiniSoftware;
|
||||||
using IRaCIS.Core.Application.Service.Reading.Dto;
|
using IRaCIS.Core.Application.Service.Reading.Dto;
|
||||||
|
using IRaCIS.Core.Domain.Share.Common;
|
||||||
|
using System.IO;
|
||||||
|
|
||||||
namespace IRaCIS.Core.Application.Service
|
namespace IRaCIS.Core.Application.Service
|
||||||
{
|
{
|
||||||
|
@ -165,7 +167,7 @@ namespace IRaCIS.Core.Application.Service
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private async Task<bool> DealMedicalReviewTasKGenerateAndIsSendAsync(Guid trialId, bool? isMedicalReviewAndSuggestApplyReReading,string pdAnswer, List<Guid> taskIdList, List<Guid> minUserIdList)
|
private async Task<bool> DealMedicalReviewTasKGenerateAndIsSendAsync(Guid trialId, bool? isMedicalReviewAndSuggestApplyReReading, string pdAnswer, List<Guid> taskIdList, List<Guid> minUserIdList)
|
||||||
{
|
{
|
||||||
|
|
||||||
var isNeedSend = true;
|
var isNeedSend = true;
|
||||||
|
@ -177,7 +179,7 @@ namespace IRaCIS.Core.Application.Service
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
//正常阅片为否的
|
||||||
if (isMedicalReviewAndSuggestApplyReReading == null)
|
if (isMedicalReviewAndSuggestApplyReReading == null)
|
||||||
{
|
{
|
||||||
isNeedSend = false;
|
isNeedSend = false;
|
||||||
|
@ -202,7 +204,7 @@ namespace IRaCIS.Core.Application.Service
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return isNeedSend;
|
return isNeedSend;
|
||||||
|
|
||||||
|
@ -213,9 +215,11 @@ namespace IRaCIS.Core.Application.Service
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="visitTaskId"></param>
|
/// <param name="visitTaskId"></param>
|
||||||
/// <param name="isMedicalReviewAndSuggestApplyReReading"></param>
|
/// <param name="isMedicalReviewAndSuggestApplyReReading"></param>
|
||||||
|
/// <param name="emailStoreMode"></param>
|
||||||
|
/// <param name="sendFileRelativePath"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
/// <exception cref="BusinessValidationFailedException"></exception>
|
/// <exception cref="BusinessValidationFailedException"></exception>
|
||||||
public async Task BaseBusinessScenarioSendEmailAsync(Guid visitTaskId, bool? isMedicalReviewAndSuggestApplyReReading)
|
public async Task<string> BaseBusinessScenarioSendEmailAsync(Guid visitTaskId, bool? isMedicalReviewAndSuggestApplyReReading, EmailStoreSendMode emailStoreMode, string sendFileRelativePath)
|
||||||
{
|
{
|
||||||
|
|
||||||
CommonDocumentBusinessScenario? businessScenarioEnum = null;
|
CommonDocumentBusinessScenario? businessScenarioEnum = null;
|
||||||
|
@ -292,7 +296,7 @@ namespace IRaCIS.Core.Application.Service
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return;
|
return string.Empty;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -317,7 +321,7 @@ namespace IRaCIS.Core.Application.Service
|
||||||
{
|
{
|
||||||
//throw new BusinessValidationFailedException("找不到该项目标准场景下邮件的配置");
|
//throw new BusinessValidationFailedException("找不到该项目标准场景下邮件的配置");
|
||||||
|
|
||||||
return;
|
return string.Empty;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -382,7 +386,6 @@ namespace IRaCIS.Core.Application.Service
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
#region 确保 邮件Html存在
|
#region 确保 邮件Html存在
|
||||||
|
|
||||||
//邮件附件
|
//邮件附件
|
||||||
|
@ -403,6 +406,46 @@ namespace IRaCIS.Core.Application.Service
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
#region 不同场景 Tile 设置
|
||||||
|
|
||||||
|
if (businessScenarioEnum == CommonDocumentBusinessScenario.EnrollConfirmed)
|
||||||
|
{
|
||||||
|
sendEmailConfig.TopicDescription = $"【入组确认报告】关于{taskInfo.ResearchProgramNo}项目{taskInfo.SubjectCode}受试者";
|
||||||
|
|
||||||
|
using (StreamReader SourceReader = System.IO.File.OpenText(pathToFile))
|
||||||
|
{
|
||||||
|
var templateInfo = SourceReader.ReadToEnd();
|
||||||
|
|
||||||
|
|
||||||
|
sendEmailConfig.HtmlBodyStr = string.Format(templateInfo,
|
||||||
|
$" 附件为入组确认报告,请查收 "
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (businessScenarioEnum == CommonDocumentBusinessScenario.PDConfirmed)
|
||||||
|
{
|
||||||
|
sendEmailConfig.TopicDescription = $"【疾病进展确认报告】关于{taskInfo.ResearchProgramNo}项目{taskInfo.SubjectCode}受试者";
|
||||||
|
|
||||||
|
using (StreamReader SourceReader = System.IO.File.OpenText(pathToFile))
|
||||||
|
{
|
||||||
|
var templateInfo = SourceReader.ReadToEnd();
|
||||||
|
|
||||||
|
|
||||||
|
sendEmailConfig.HtmlBodyStr = string.Format(templateInfo,
|
||||||
|
$" 附件为疾病进展确认报告,请查收 "
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
#region 不同标准 不同项目配置 发送邮件的时机 处理具体逻辑
|
||||||
|
|
||||||
var answer = "否";
|
var answer = "否";
|
||||||
var isNeedSend = true;
|
var isNeedSend = true;
|
||||||
var minUserIdList = _trialUserRepository.Where(t => t.User.UserTypeEnum == Domain.Share.UserTypeEnum.MIM && t.TrialId == taskInfo.TrialId).Select(t => t.UserId).ToList();
|
var minUserIdList = _trialUserRepository.Where(t => t.User.UserTypeEnum == Domain.Share.UserTypeEnum.MIM && t.TrialId == taskInfo.TrialId).Select(t => t.UserId).ToList();
|
||||||
|
@ -418,35 +461,23 @@ namespace IRaCIS.Core.Application.Service
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sendEmailConfig.TopicDescription = $"【入组确认报告】关于{taskInfo.ResearchProgramNo}项目{taskInfo.SubjectCode}受试者";
|
|
||||||
|
|
||||||
using (StreamReader SourceReader = System.IO.File.OpenText(pathToFile))
|
if (await _repository.Where<ReadingTableQuestionAnswer>().AnyAsync(x => x.VisitTaskId == visitTaskId && x.Answer == TargetState.Exist.GetEnumInt() &&
|
||||||
|
x.ReadingTableQuestionTrial.QuestionMark == QuestionMark.State && x.ReadingQuestionTrial.LesionType == LesionType.TargetLesion))
|
||||||
{
|
{
|
||||||
var templateInfo = SourceReader.ReadToEnd();
|
|
||||||
|
|
||||||
|
answer = "是";
|
||||||
|
|
||||||
sendEmailConfig.HtmlBodyStr = string.Format(templateInfo,
|
//把另外一个人的任务设置为不加急(如果项目加急是否 subject 加急是否)
|
||||||
$" 附件为入组确认报告,请查收 "
|
var urgent = _repository.Where<SubjectVisit>(t => t.Id == taskInfo.SourceSubjectVisitId).Select(t => new { IsSubjectUrgent = t.Subject.IsUrgent, t.Trial.IsUrgent }).FirstOrDefault();
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
if (urgent?.IsUrgent == false || urgent?.IsSubjectUrgent == false)
|
||||||
if (await _repository.Where<ReadingTableQuestionAnswer>().AnyAsync(x => x.VisitTaskId == visitTaskId && x.Answer == TargetState.Exist.GetEnumInt() &&
|
|
||||||
x.ReadingTableQuestionTrial.QuestionMark == QuestionMark.State && x.ReadingQuestionTrial.LesionType == LesionType.TargetLesion))
|
|
||||||
{
|
{
|
||||||
|
await _visitTaskRepository.BatchUpdateNoTrackingAsync(t => t.SourceSubjectVisitId == taskInfo.SourceSubjectVisitId && t.TaskState == TaskState.Effect && t.IsAnalysisCreate == false &&
|
||||||
answer = "是";
|
t.Id != visitTaskId && t.TrialReadingCriterionId == taskInfo.TrialReadingCriterionId, u => new VisitTask() { IsUrgent = false });
|
||||||
|
|
||||||
//把另外一个人的任务设置为不加急(如果项目加急是否 subject 加急是否)
|
|
||||||
var urgent = _repository.Where<SubjectVisit>(t => t.Id == taskInfo.SourceSubjectVisitId).Select(t => new { IsSubjectUrgent = t.Subject.IsUrgent, t.Trial.IsUrgent }).FirstOrDefault();
|
|
||||||
|
|
||||||
if (urgent?.IsUrgent == false || urgent?.IsSubjectUrgent == false)
|
|
||||||
{
|
|
||||||
await _visitTaskRepository.BatchUpdateNoTrackingAsync(t => t.SourceSubjectVisitId == taskInfo.SourceSubjectVisitId && t.TaskState == TaskState.Effect && t.IsAnalysisCreate == false &&
|
|
||||||
t.Id != visitTaskId && t.TrialReadingCriterionId == taskInfo.TrialReadingCriterionId, u => new VisitTask() { IsUrgent = false });
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
isNeedSend = await DealMedicalReviewTasKGenerateAndIsSendAsync(taskInfo.TrialId, isMedicalReviewAndSuggestApplyReReading, answer, new List<Guid>() { visitTaskId }, minUserIdList);
|
isNeedSend = await DealMedicalReviewTasKGenerateAndIsSendAsync(taskInfo.TrialId, isMedicalReviewAndSuggestApplyReReading, answer, new List<Guid>() { visitTaskId }, minUserIdList);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -455,17 +486,7 @@ namespace IRaCIS.Core.Application.Service
|
||||||
}
|
}
|
||||||
else if (businessScenarioEnum == CommonDocumentBusinessScenario.PDConfirmed)
|
else if (businessScenarioEnum == CommonDocumentBusinessScenario.PDConfirmed)
|
||||||
{
|
{
|
||||||
sendEmailConfig.TopicDescription = $"【疾病进展确认报告】关于{taskInfo.ResearchProgramNo}项目{taskInfo.SubjectCode}受试者";
|
|
||||||
|
|
||||||
using (StreamReader SourceReader = System.IO.File.OpenText(pathToFile))
|
|
||||||
{
|
|
||||||
var templateInfo = SourceReader.ReadToEnd();
|
|
||||||
|
|
||||||
|
|
||||||
sendEmailConfig.HtmlBodyStr = string.Format(templateInfo,
|
|
||||||
$" 附件为疾病进展确认报告,请查收 "
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
//有序
|
//有序
|
||||||
|
|
||||||
|
@ -535,7 +556,7 @@ namespace IRaCIS.Core.Application.Service
|
||||||
|
|
||||||
|
|
||||||
isNeedSend = await DealMedicalReviewTasKGenerateAndIsSendAsync(taskInfo.TrialId, isMedicalReviewAndSuggestApplyReReading, answer, taskList.Select(t => t.Id).ToList(), minUserIdList);
|
isNeedSend = await DealMedicalReviewTasKGenerateAndIsSendAsync(taskInfo.TrialId, isMedicalReviewAndSuggestApplyReReading, answer, taskList.Select(t => t.Id).ToList(), minUserIdList);
|
||||||
|
|
||||||
}
|
}
|
||||||
//双人 产生裁判,并且裁判完成 发
|
//双人 产生裁判,并且裁判完成 发
|
||||||
else if (taskList.Count == 3 && taskList.Count(t => t.ReadingTaskState == ReadingTaskState.HaveSigned) == 3 && taskList.Where(t => t.ReadingCategory == ReadingCategory.Judge).Count() == 1)
|
else if (taskList.Count == 3 && taskList.Count(t => t.ReadingTaskState == ReadingTaskState.HaveSigned) == 3 && taskList.Where(t => t.ReadingCategory == ReadingCategory.Judge).Count() == 1)
|
||||||
|
@ -657,7 +678,7 @@ namespace IRaCIS.Core.Application.Service
|
||||||
|
|
||||||
answer = await TranslatePdStateAsync(visitTaskId, taskInfo.ReadingCategory, taskInfo.CriterionType);
|
answer = await TranslatePdStateAsync(visitTaskId, taskInfo.ReadingCategory, taskInfo.CriterionType);
|
||||||
|
|
||||||
isNeedSend = await DealMedicalReviewTasKGenerateAndIsSendAsync(taskInfo.TrialId, isMedicalReviewAndSuggestApplyReReading, answer, taskList.Select(t => t.Id).ToList(), minUserIdList);
|
isNeedSend = await DealMedicalReviewTasKGenerateAndIsSendAsync(taskInfo.TrialId, isMedicalReviewAndSuggestApplyReReading, answer, taskList.Select(t => t.Id).ToList(), minUserIdList);
|
||||||
}
|
}
|
||||||
else if (taskList.Count == 3 && taskList.Count(t => t.ReadingTaskState == ReadingTaskState.HaveSigned) == 3 && taskList.Where(t => t.ReadingCategory == ReadingCategory.Judge).Count() == 1)
|
else if (taskList.Count == 3 && taskList.Count(t => t.ReadingTaskState == ReadingTaskState.HaveSigned) == 3 && taskList.Where(t => t.ReadingCategory == ReadingCategory.Judge).Count() == 1)
|
||||||
{
|
{
|
||||||
|
@ -699,7 +720,7 @@ namespace IRaCIS.Core.Application.Service
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -707,21 +728,62 @@ namespace IRaCIS.Core.Application.Service
|
||||||
isNeedSend = false;
|
isNeedSend = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
#region MiniWord 组织字典 发送
|
#region MiniWord 组织字典 发送
|
||||||
|
|
||||||
|
|
||||||
|
if (emailStoreMode == EmailStoreSendMode.NotStoreLocalOnlySentEmail)
|
||||||
|
{
|
||||||
|
|
||||||
|
var phyPath = FileStoreHelper.GetPhysicalFilePath(_hostEnvironment, sendFileRelativePath);
|
||||||
|
|
||||||
|
//先预先生成了邮件,发送预先生成的邮件
|
||||||
|
sendEmailConfig.EmailAttachMentConfigList.Add(new EmailAttachMentConfig()
|
||||||
|
{
|
||||||
|
FileName = emailConfig.FileName,
|
||||||
|
|
||||||
|
FileStream = File.OpenRead(phyPath),
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
await SendEmailHelper.SendEmailAsync(sendEmailConfig);
|
||||||
|
}
|
||||||
|
|
||||||
|
var value = new Dictionary<string, object>()
|
||||||
|
{
|
||||||
|
["SponsorName"] = taskInfo.SponsorName,
|
||||||
|
["ResearchProgramNo"] = taskInfo.ResearchProgramNo,
|
||||||
|
["TrialSiteCode"] = taskInfo.TrialSiteCode,
|
||||||
|
["SubjectCode"] = taskInfo.SubjectCode,
|
||||||
|
["VisitName"] = taskInfo.SourceSubjectVisitId != null ? taskInfo.VisitName : taskInfo.ModuleVisitName,
|
||||||
|
["EarliestScanDate"] = taskInfo.SourceSubjectVisitId != null ? taskInfo.VisitEarliestScanDate : taskInfo.ModuleEarliestScanDate,
|
||||||
|
["SignTime"] = taskInfo.SignTime,
|
||||||
|
["Result"] = answer
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
var (serverFilePath, relativePath, fileRealName) = FileStoreHelper.GetSubjectEnrollConfirmOrPDEmailPath(_hostEnvironment, Path.GetFileName(path), taskInfo.TrialId, taskInfo.SiteId, taskInfo.SubjectId);
|
||||||
|
|
||||||
|
if (emailStoreMode == EmailStoreSendMode.StoreLocalSend || emailStoreMode == EmailStoreSendMode.OnlyStoreLocalNotSentEmail)
|
||||||
|
{
|
||||||
|
MiniSoftware.MiniWord.SaveAsByTemplate(serverFilePath, path, value);
|
||||||
|
|
||||||
|
}
|
||||||
|
//手动生成发送的邮件内容,但是并不发送
|
||||||
|
if (emailStoreMode == EmailStoreSendMode.OnlyStoreLocalNotSentEmail)
|
||||||
|
{
|
||||||
|
isNeedSend = false;
|
||||||
|
|
||||||
|
return relativePath;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//正常的即时生成邮件 并发送邮件
|
||||||
if (isNeedSend)
|
if (isNeedSend)
|
||||||
{
|
{
|
||||||
var value = new Dictionary<string, object>()
|
|
||||||
{
|
|
||||||
["SponsorName"] = taskInfo.SponsorName,
|
|
||||||
["ResearchProgramNo"] = taskInfo.ResearchProgramNo,
|
|
||||||
["TrialSiteCode"] = taskInfo.TrialSiteCode,
|
|
||||||
["SubjectCode"] = taskInfo.SubjectCode,
|
|
||||||
["VisitName"] = taskInfo.SourceSubjectVisitId != null ? taskInfo.VisitName : taskInfo.ModuleVisitName,
|
|
||||||
["EarliestScanDate"] = taskInfo.SourceSubjectVisitId != null ? taskInfo.VisitEarliestScanDate : taskInfo.ModuleEarliestScanDate,
|
|
||||||
["SignTime"] = taskInfo.SignTime,
|
|
||||||
["Result"] = answer
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
MemoryStream memoryStream = new MemoryStream();
|
MemoryStream memoryStream = new MemoryStream();
|
||||||
|
|
||||||
|
@ -740,6 +802,15 @@ namespace IRaCIS.Core.Application.Service
|
||||||
await SendEmailHelper.SendEmailAsync(sendEmailConfig);
|
await SendEmailHelper.SendEmailAsync(sendEmailConfig);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return string.Empty;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
@ -747,6 +818,37 @@ namespace IRaCIS.Core.Application.Service
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 手动生成入组确认 或者PD 进展的邮件 如果能发送,会返回文件的路径,否则会给出提示
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="visitTaskId"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public async Task<IResponseOutput> ManualGenerateEmailFile(Guid visitTaskId)
|
||||||
|
{
|
||||||
|
var filePath = await BaseBusinessScenarioSendEmailAsync(visitTaskId, true, EmailStoreSendMode.OnlyStoreLocalNotSentEmail, string.Empty);
|
||||||
|
|
||||||
|
if (string.IsNullOrEmpty(filePath))
|
||||||
|
{
|
||||||
|
return ResponseOutput.NotOk("该任务不符合发送邮件的条件");
|
||||||
|
}
|
||||||
|
|
||||||
|
return ResponseOutput.Ok(filePath);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 手动发送邮件
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="visitTaskId"></param>
|
||||||
|
/// <param name="sendFileRelativePath"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public async Task<IResponseOutput> ManualSendEmail(Guid visitTaskId, string sendFileRelativePath)
|
||||||
|
{
|
||||||
|
var filePath = await BaseBusinessScenarioSendEmailAsync(visitTaskId, true, EmailStoreSendMode.NotStoreLocalOnlySentEmail, sendFileRelativePath);
|
||||||
|
|
||||||
|
return ResponseOutput.Ok();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private async Task<string> TranslatePdStateAsync(Guid visitTaskId, ReadingCategory readingCategory, CriterionType criterionType)
|
private async Task<string> TranslatePdStateAsync(Guid visitTaskId, ReadingCategory readingCategory, CriterionType criterionType)
|
||||||
{
|
{
|
||||||
|
|
|
@ -684,7 +684,7 @@ namespace IRaCIS.Core.Application.Service
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
await _trialEmailNoticeConfigService.BaseBusinessScenarioSendEmailAsync(medicalReviewInfo.VisitTaskId, true&& medicalReviewInfo.IsApplyHeavyReading);
|
await _trialEmailNoticeConfigService.BaseBusinessScenarioSendEmailAsync(medicalReviewInfo.VisitTaskId, true&& medicalReviewInfo.IsApplyHeavyReading);
|
||||||
|
|
||||||
var result = await _taskMedicalReviewRepository.SaveChangesAsync();
|
var result = await _taskMedicalReviewRepository.SaveChangesAsync();
|
||||||
return ResponseOutput.Result(result);
|
return ResponseOutput.Result(result);
|
||||||
|
|
|
@ -0,0 +1,28 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace IRaCIS.Core.Domain.Share.Common
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
public enum EmailStoreSendMode
|
||||||
|
{
|
||||||
|
//不存储本地 发送
|
||||||
|
NotStoreLocalSend = 0,
|
||||||
|
|
||||||
|
//存储本地发送
|
||||||
|
StoreLocalSend = 1,
|
||||||
|
|
||||||
|
//存储本地不发送
|
||||||
|
OnlyStoreLocalNotSentEmail = 2,
|
||||||
|
|
||||||
|
//不存储本地 发送
|
||||||
|
NotStoreLocalOnlySentEmail = 3,
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue