You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
53 lines
1.7 KiB
53 lines
1.7 KiB
using System;
|
|
using System.Collections.Generic;
|
|
using System.IO;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using ShenTun.Ecg.Common;
|
|
namespace ShenTun.Ecg.Pdf
|
|
{
|
|
public class EcgByPdf
|
|
{
|
|
public async Task<Response> ConvertPdfToImg(RequestInterface req)
|
|
{
|
|
Task<Response> task = Task.Factory.StartNew<Response>(() => {
|
|
Response res = new Response() { code = -1 };
|
|
try
|
|
{
|
|
if (string.IsNullOrEmpty(req.FtpPath)) {
|
|
res.message = "取心电图异常:本地FTP未设置,请到客户端参数-心电图中设置";
|
|
return res;
|
|
}
|
|
|
|
if (!Directory.Exists((req.FtpPath)))
|
|
{
|
|
res.message = string.Format("取心电图异常:{0}不存在", req.FtpPath);
|
|
return res;
|
|
}
|
|
|
|
if (string.IsNullOrEmpty(req.BarCode)) {
|
|
res.message = "取心电图异常:检查条形码不能为空";
|
|
return res;
|
|
}
|
|
|
|
string pattern = string.Format("{0}\\*{1}.pdf", req.FtpPath, req.BarCode);
|
|
foreach (var st in FileHelper.GetAllMatchingPaths(pattern))
|
|
{
|
|
|
|
}
|
|
|
|
|
|
}
|
|
catch (Exception ex) {
|
|
res.message = string.Format("获取心电图异常:{0}", ex.Message);
|
|
}
|
|
return res;
|
|
});
|
|
|
|
Response taskResult = await task;
|
|
return taskResult;
|
|
}
|
|
|
|
}
|
|
}
|