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

1 month ago
  1. using System;
  2. using System.Collections.Generic;
  3. using System.IO;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7. using ShenTun.Ecg.Common;
  8. namespace ShenTun.Ecg.Pdf
  9. {
  10. public class EcgByPdf
  11. {
  12. public async Task<Response> ConvertPdfToImg(RequestInterface req)
  13. {
  14. Task<Response> task = Task.Factory.StartNew<Response>(() => {
  15. Response res = new Response() { code = -1 };
  16. try
  17. {
  18. if (string.IsNullOrEmpty(req.FtpPath)) {
  19. res.message = "取心电图异常:本地FTP未设置,请到客户端参数-心电图中设置";
  20. return res;
  21. }
  22. if (!Directory.Exists((req.FtpPath)))
  23. {
  24. res.message = string.Format("取心电图异常:{0}不存在", req.FtpPath);
  25. return res;
  26. }
  27. if (string.IsNullOrEmpty(req.BarCode)) {
  28. res.message = "取心电图异常:检查条形码不能为空";
  29. return res;
  30. }
  31. string pattern = string.Format("{0}\\*{1}.pdf", req.FtpPath, req.BarCode);
  32. foreach (var st in FileHelper.GetAllMatchingPaths(pattern))
  33. {
  34. }
  35. }
  36. catch (Exception ex) {
  37. res.message = string.Format("获取心电图异常:{0}", ex.Message);
  38. }
  39. return res;
  40. });
  41. Response taskResult = await task;
  42. return taskResult;
  43. }
  44. }
  45. }