123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102 |
- using Common;
- using LisPacsDataUpload.Models.Report;
- using System;
- using System.Collections.Generic;
- using System.Diagnostics;
- using System.Linq;
- using System.Text;
- namespace LisPacsDataUpload.business
- {
- /// <summary>
- /// pdf 工具类
- /// </summary>
- public class PdfUtils
- {
- /// <summary>
- /// 根据lis版本获取请求生成pdf报告的参数 0中联老版lis 1 中联新版lis 2 专业版临生免 3 三方lis
- /// </summary>
- /// <returns></returns>
- public static string getPdfParamByLisVersion(int lisVersion,long yzid)
- {
- Paramater paramter = new Paramater
- {
- ZlSysCode = 2500,
- PdfPath = $"pdf={AppDomain.CurrentDomain.BaseDirectory}PDF\\Report\\LIS{yzid}.pdf"
- };
-
- if (lisVersion==0)
- {
- //老版lis
- /* Select Distinct 'ZLCISBILL' || Trim(To_Char(b.编号, '00000')) || '-2' 报表编号, a.相关id, d.id 标本id
- From 病人医嘱记录 A,检验标本记录 d, 病历文件列表 B, 病历单据应用 C
- Where a.诊疗项目id = c.诊疗项目id And a.病人来源 = c.应用场合 And c.病历文件id = b.Id And a.Id = :id and a.相关id = d.医嘱id*/
- var id = ""; // 标本id
- paramter.Params.Add(new SubParameter { Param = $"标本id={id}" });
- }
- else if (lisVersion == 1)
- {
- // 新版lis
- /* Select distinct 'ZLLISBILL00' || Decode(b.病人来源, 2, c.住院单据, 3, c.体检单据, 4, c.院外单据, c.门诊单据) || '-2' 报表编号, a.Id 标本id
- From 检验报告记录 A, 检验申请组合 B, 检验仪器记录 C
- Where a.Id = b.标本id And a.仪器id = c.Id And b.医嘱id = :id*/
- }
- else if (lisVersion == 2)
- {
- //专业版临生免
- }
- else
- {
- // 三方lis
- }
- return null;
- }
- public bool GeneratePdf()
- {
- // 定义要启动的外部程序的路径
- string exePath = @"C:\Path\To\Your\Program.exe";
- // 定义要传递给外部程序的参数
- string arguments = "strJson value1";
- // 创建一个新的 ProcessStartInfo 对象
- ProcessStartInfo startInfo = new ProcessStartInfo
- {
- FileName = exePath, // 设置要启动的程序路径
- Arguments = arguments, // 设置传递给程序的参数
- RedirectStandardOutput = false, // 是否重定向标准输出(根据需要设置)
- RedirectStandardError = false, // 是否重定向标准错误(根据需要设置)
- UseShellExecute = true, // 是否使用操作系统的 shell 启动进程(通常设置为 true)
- CreateNoWindow = true // 是否创建窗口(如果不需要显示窗口,可以设置为 true)
- };
- try
- {
- // 启动外部程序
- using (Process process = Process.Start(startInfo))
- {
- // 如果需要等待程序结束,可以使用 process.WaitForExit()
- LogHelper.Info("生成lis报告中");
- process.WaitForExit();
- LogHelper.Info("成功生成lis报告");
- // 如果需要读取输出或错误,可以在这里处理
- // string output = process.StandardOutput.ReadToEnd();
- // string error = process.StandardError.ReadToEnd();
- }
- }
- catch (Exception ex)
- {
- // 处理异常,例如文件未找到、路径错误等
- LogHelper.Info("启动外部程序时出错: " + ex.Message);
- }
- return true;
- }
- }
- }
|