更新部署方式
This commit is contained in:
parent
d9d73434f6
commit
bdd33043b3
|
@ -0,0 +1,6 @@
|
|||
echo off
|
||||
|
||||
:: 添加jar包到本地仓库
|
||||
cmd /k "mvn install:install-file -Dfile=jacob-1.21.jar -DgroupId=com.jacob -DartifactId=jacob -Dversion=1.21 -Dpackaging=jar"
|
||||
|
||||
pause
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -0,0 +1,20 @@
|
|||
@echo off
|
||||
|
||||
:: 医保程序地址
|
||||
set CHSPATH=D:/Project/CHS
|
||||
:: jar名称
|
||||
set NAME=yinyitong-dll-stand
|
||||
:: 端口号
|
||||
set PROT=5946
|
||||
|
||||
echo 关闭%PROT%端口进程
|
||||
for /f "tokens=1-5" %%i in ('netstat -ano^|findstr ":%PROT%"') do taskkill /pid %%m -t -f
|
||||
|
||||
echo 启动%NAME%
|
||||
|
||||
start javaw -jar %~dp0\%NAME%.jar --server.port=%PROT% -Dfile.encoding=UTF-8 -Djava.library.path=%CHSPATH%
|
||||
|
||||
echo 启动完成
|
||||
|
||||
::exit
|
||||
pause
|
|
@ -1,8 +1,25 @@
|
|||
<service>
|
||||
<id>yinyitong-dll-stand</id>
|
||||
<name>yinyitong-dll-stand</name>
|
||||
<description>银医通-台式机-DLL调用服务</description>
|
||||
<!-- 环境变量 文件名称 -->
|
||||
<env name="NAME" value="yinyitong-dll-stand"/>
|
||||
|
||||
<!-- 服务ID -->
|
||||
<id>dpkj-%NAME%</id>
|
||||
<!-- 服务名称 -->
|
||||
<name>%BASE%</name>
|
||||
<!-- 服务描述 -->
|
||||
<description>银医台式机中间服务调用程序</description>
|
||||
|
||||
<!-- 启动命令 -->
|
||||
<executable>java</executable>
|
||||
<arguments>-jar %BASE%\yinyitong-dll-stand.jar</arguments>
|
||||
<!-- 启动参数 -->
|
||||
<arguments>-jar %BASE%\%NAME%.jar</arguments>
|
||||
|
||||
<!-- 日志-->
|
||||
<logpath>%BASE%\logs\winws</logpath>
|
||||
<!-- 按大小和时间滚动模式 -->
|
||||
<log mode="roll-by-size-time">
|
||||
<sizeThreshold>10240</sizeThreshold>
|
||||
<pattern>yyyyMMdd</pattern>
|
||||
<autoRollAtTime>00:00:00</autoRollAtTime>
|
||||
</log>
|
||||
</service>
|
||||
|
|
29
pom.xml
29
pom.xml
|
@ -20,7 +20,7 @@
|
|||
<properties>
|
||||
<java.version>1.8</java.version>
|
||||
<hutool.version>5.8.36</hutool.version>
|
||||
<jna.version>5.14.0</jna.version>
|
||||
<jna.version>5.17.0</jna.version>
|
||||
<pdfbox.version>3.0.2</pdfbox.version>
|
||||
</properties>
|
||||
|
||||
|
@ -48,12 +48,6 @@
|
|||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>cn.hutool</groupId>
|
||||
<artifactId>hutool-crypto</artifactId>
|
||||
<version>${hutool.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>cn.hutool</groupId>
|
||||
<artifactId>hutool-all</artifactId>
|
||||
|
@ -61,16 +55,33 @@
|
|||
</dependency>
|
||||
|
||||
<!-- 调用DLL -->
|
||||
<!-- <dependency>
|
||||
<groupId>net.java.dev.jna</groupId>
|
||||
<artifactId>jna</artifactId>
|
||||
<version>${jna.version}</version>
|
||||
</dependency>-->
|
||||
<dependency>
|
||||
<groupId>net.java.dev.jna</groupId>
|
||||
<artifactId>jna</artifactId>
|
||||
<artifactId>jna-jpms</artifactId>
|
||||
<version>${jna.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<!--<dependency>
|
||||
<groupId>net.java.dev.jna</groupId>
|
||||
<artifactId>jna-platform</artifactId>
|
||||
<version>${jna.version}</version>
|
||||
</dependency>-->
|
||||
<dependency>
|
||||
<groupId>net.java.dev.jna</groupId>
|
||||
<artifactId>jna-platform-jpms</artifactId>
|
||||
<version>${jna.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- 调用DLL - COM库 -->
|
||||
<dependency>
|
||||
<groupId>com.jacob</groupId>
|
||||
<artifactId>jacob</artifactId>
|
||||
<version>1.21</version>
|
||||
</dependency>
|
||||
|
||||
<!--PDF转换工具-->
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
package com.dpkj.common.config;
|
||||
|
||||
import lombok.Data;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* @Auther: 萧道子
|
||||
* @Date: 2024/4/28 14:55
|
||||
* @Description:
|
||||
*/
|
||||
@Data
|
||||
@Component
|
||||
@ConfigurationProperties(prefix = "dpkj.his")
|
||||
public class HisConfig {
|
||||
|
||||
/**
|
||||
* 调用者ID
|
||||
*/
|
||||
private String operationId;
|
||||
|
||||
}
|
|
@ -0,0 +1,49 @@
|
|||
package com.dpkj.common.utils;
|
||||
|
||||
import cn.hutool.core.lang.Snowflake;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
|
||||
/**
|
||||
* @Auther: 萧道子
|
||||
* @Date: 2025/3/19 20:01
|
||||
* @Description:
|
||||
*/
|
||||
public class IDGenerator {
|
||||
|
||||
private static Snowflake snowflake = IdUtil.getSnowflake(1, 1);
|
||||
|
||||
private static Snowflake snowflake2 = IdUtil.getSnowflake(1, 2);
|
||||
|
||||
/**
|
||||
* 取雪花算法ID
|
||||
*
|
||||
* @return java.lang.String
|
||||
* @author 萧道子 2025/3/19
|
||||
*/
|
||||
public static String getSnowflakeIdToStr() {
|
||||
return snowflake.nextIdStr();
|
||||
}
|
||||
|
||||
/**
|
||||
* 取雪花算法ID
|
||||
*
|
||||
* @return java.lang.String
|
||||
* @author 萧道子 2025/3/19
|
||||
*/
|
||||
public static Long getSnowflakeIdToLong() {
|
||||
return snowflake.nextId();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取 Traceid
|
||||
*
|
||||
* @return java.lang.String
|
||||
* @author 萧道子 2025/4/1
|
||||
*/
|
||||
public static String getTraceid() {
|
||||
return snowflake2.nextIdStr();
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -1,22 +1,17 @@
|
|||
package com.dpkj.modules.chs.controller;
|
||||
|
||||
import cn.hutool.core.date.DatePattern;
|
||||
import cn.hutool.core.date.DateUnit;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.lang.Console;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.dpkj.common.config.ChsConfig;
|
||||
import com.dpkj.common.constant.ChsConst;
|
||||
import com.dpkj.common.vo.Result;
|
||||
import com.dpkj.modules.chs.dll.AlipayDll;
|
||||
import com.dpkj.modules.chs.entity.AlipayEcRequestData;
|
||||
import com.dpkj.modules.chs.service.IAlipayService;
|
||||
import com.dpkj.modules.chs.service.IHispayService;
|
||||
import com.sun.jna.Memory;
|
||||
import com.sun.jna.Pointer;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
|
@ -30,15 +25,13 @@ import org.springframework.web.bind.annotation.RestController;
|
|||
@RequestMapping("/chs/hispay")
|
||||
public class HispayController {
|
||||
|
||||
private final IHispayService hispayService;
|
||||
|
||||
private final ChsConfig charsConfig;
|
||||
private final IHispayService iHispayService;
|
||||
|
||||
|
||||
@GetMapping("test")
|
||||
public Result<?> test() {
|
||||
@RequestMapping("getPatientInfo")
|
||||
public Result<?> getPatientInfo() {
|
||||
try {
|
||||
|
||||
iHispayService.getPatientInfo("2", null);
|
||||
return Result.ok("成功", null);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
|
@ -47,4 +40,14 @@ public class HispayController {
|
|||
}
|
||||
|
||||
|
||||
@RequestMapping("t1")
|
||||
public Result<?> t1(@RequestBody JSONObject map) throws InterruptedException {
|
||||
// Console.log("41 - {}\n", map);
|
||||
// Thread.sleep(100);
|
||||
String format = DateUtil.format(DateUtil.date(), DatePattern.PURE_DATETIME_MS_FORMAT);
|
||||
System.out.println(format);
|
||||
return Result.ok("成功", format);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package com.dpkj.modules.chs.dll;
|
||||
|
||||
import com.jacob.activeX.ActiveXComponent;
|
||||
import com.sun.jna.Library;
|
||||
import com.sun.jna.Native;
|
||||
import com.sun.jna.Pointer;
|
||||
|
@ -15,45 +16,16 @@ public class HispayDll {
|
|||
|
||||
/**
|
||||
* 获取 AlipayDll 实例,同时注册 AlipayDll 控件。
|
||||
*
|
||||
* @return AlipayDll 实例
|
||||
* @throws DllRegistrationException 如果注册控件失败,抛出此异常
|
||||
*/
|
||||
public static Dll instance() throws DllRegistrationException {
|
||||
public static ActiveXComponent instance() {
|
||||
try {
|
||||
return Native.load("HispayChs", Dll.class);
|
||||
ActiveXComponent active = new ActiveXComponent("PayClient.clsPayClient");
|
||||
log.info("[HispayDll][getPrintSDK][HIS医保COM库] 加载成功");
|
||||
return active;
|
||||
} catch (UnsatisfiedLinkError e) {
|
||||
log.info("[HispayDll][getPrintSDK][医保动态库] SDK注册失败:{}", e.getMessage());
|
||||
throw new DllRegistrationException("Failed to load AlipayDll library: ", e);
|
||||
log.error("[HispayDll][getPrintSDK][HIS医保COM库] 加载失败:{}", e.getMessage());
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 定义自定义异常类,用于表示注册控件时发生的错误
|
||||
*/
|
||||
public static class DllRegistrationException extends Exception {
|
||||
public DllRegistrationException(String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
public DllRegistrationException(String message, Throwable cause) {
|
||||
super(message, cause);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 定义接口映射本地库中的函数。
|
||||
*/
|
||||
public interface Dll extends Library {
|
||||
|
||||
/**
|
||||
* 设置打印端口和波特率。
|
||||
*
|
||||
* @return 返回操作结果代码
|
||||
*/
|
||||
String NationEcTrans(String strUrl, String InData, Pointer OutData);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,4 +1,14 @@
|
|||
package com.dpkj.modules.chs.service;
|
||||
|
||||
public interface IHispayService {
|
||||
|
||||
/**
|
||||
* 门诊病人读卡
|
||||
*
|
||||
* @param type : 1.就诊卡,2.医保卡,5.门诊号,6.患者姓名和电话号码,8.电子健康码/卡,9.医保电子凭证
|
||||
* @param content : 医保卡: 密码 医保电子凭证:条码内容
|
||||
* @return void
|
||||
* @author 萧道子 2025/4/28
|
||||
*/
|
||||
void getPatientInfo(String type, String content);
|
||||
}
|
||||
|
|
|
@ -1,12 +1,28 @@
|
|||
package com.dpkj.modules.chs.service.impl;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.lang.Console;
|
||||
import cn.hutool.core.util.CharsetUtil;
|
||||
import cn.hutool.core.util.XmlUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.dpkj.common.config.HisConfig;
|
||||
import com.dpkj.common.utils.IDGenerator;
|
||||
import com.dpkj.modules.chs.dll.HispayDll;
|
||||
import com.dpkj.modules.chs.service.IHispayService;
|
||||
import com.jacob.activeX.ActiveXComponent;
|
||||
import com.jacob.com.Dispatch;
|
||||
import com.jacob.com.Variant;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.w3c.dom.Document;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
/**
|
||||
* @Auther: 萧道子
|
||||
|
@ -17,13 +33,12 @@ import javax.annotation.PostConstruct;
|
|||
@Service
|
||||
public class HispayServiceImpl implements IHispayService {
|
||||
|
||||
private HispayDll.Dll dll = HispayDll.instance();
|
||||
@Autowired
|
||||
private HisConfig hisConfig;
|
||||
|
||||
private static ActiveXComponent dll = HispayDll.instance();
|
||||
|
||||
public HispayServiceImpl() throws HispayDll.DllRegistrationException {
|
||||
}
|
||||
|
||||
@PostConstruct
|
||||
// @PostConstruct
|
||||
public void postConstruct() {
|
||||
log.info("[HispayServiceImpl][postConstruct][医保DLL-HIS] 初始化动态链接库");
|
||||
initPrinter();
|
||||
|
@ -31,8 +46,35 @@ public class HispayServiceImpl implements IHispayService {
|
|||
|
||||
|
||||
private void initPrinter() {
|
||||
Console.log(dll);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void getPatientInfo(String type, String content) {
|
||||
String soleid = IDGenerator.getSnowflakeIdToStr();
|
||||
JSONObject req = new JSONObject() {{
|
||||
put("timestamp", DateUtil.format(DateUtil.date(), "yyyyMMddHHmmss")); // 请求发送时间
|
||||
put("requestid", soleid); // 唯一请求id
|
||||
put("operid", hisConfig.getOperationId()); // 调用者代码
|
||||
put("password", content); // 密码
|
||||
put("params", new JSONObject() {{
|
||||
put("cardtype", type); // 1.就诊卡,2.医保卡,5.门诊号,6.患者姓名和电话号码,8.电子健康码/卡,9.医保电子凭证
|
||||
put("cardno", ""); // 患者就诊卡号
|
||||
put("sfzh", ""); // 身份证号
|
||||
put("hzxm", ""); // 患者姓名
|
||||
put("phone", ""); // 患者电话号码
|
||||
}});
|
||||
}};
|
||||
|
||||
Document document = XmlUtil.mapToXml(req, "request");
|
||||
String reqParams = XmlUtil.toStr(document, "UTF-8", true, true);
|
||||
Console.log("75 - {}\n", reqParams);
|
||||
|
||||
String rest = "";
|
||||
|
||||
Variant call = Dispatch.call(dll.getObject(), "fRun", "BMZXX010", reqParams, rest);
|
||||
|
||||
Console.log("82 - {}\n", call);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<configuration debug="false">
|
||||
<!--定义日志文件的存储地址 -->
|
||||
<property name="LOG_HOME" value="./logs/java"/>
|
||||
<property name="LOG_HOME" value="./logs/server"/>
|
||||
|
||||
<!--<property name="COLOR_PATTERN" value="%black(%contextName-) %red(%d{yyyy-MM-dd HH:mm:ss}) %green([%thread]) %highlight(%-5level) %boldMagenta( %replace(%caller{1}){'\t|Caller.{1}0|\r\n', ''})- %gray(%msg%xEx%n)" />-->
|
||||
<!-- 控制台输出 -->
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue