异步提取

parent 4a871319
......@@ -105,6 +105,11 @@ public void ExtractData(int hospitalId, string mail, sys_hospital hospital)
if (WriteExcel(path, originalPath, sheetList, hospitalConfig, hospitalId, out string filepath))
SendEmail(mail, filepath, $"{hospital.HosName}HIS数据提取成功", $"{hospital.HosName}{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}成功提取。");
}
catch (PerformanceException ex)
{
logger.LogError(ex.ToString());
SendEmail(mail, "", $"{hospital.HosName}HIS数据提取失败", $"{hospital.HosName}提取数据失败,{ex.Message}!");
}
catch (Exception ex)
{
logger.LogError(ex.ToString());
......@@ -123,11 +128,12 @@ private void SendEmail(string mail, string path, string subject, string body)
var message = new EmailMessage
{
To = new List<string> { mail },
Attachments = new List<string> { path },
DisplayName = "溯直健康",
Subject = subject,
Body = body
};
if (!string.IsNullOrEmpty(path))
message.Attachments = new List<string> { path };
emailService.Send(message);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment