diff --git a/doc/lib/command.bat b/doc/lib/command.bat
new file mode 100644
index 0000000..2aaf8b3
--- /dev/null
+++ b/doc/lib/command.bat
@@ -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
diff --git a/doc/lib/jacob-1.21-x64.dll b/doc/lib/jacob-1.21-x64.dll
new file mode 100644
index 0000000..c3da072
Binary files /dev/null and b/doc/lib/jacob-1.21-x64.dll differ
diff --git a/doc/lib/jacob-1.21-x86.dll b/doc/lib/jacob-1.21-x86.dll
new file mode 100644
index 0000000..0858364
Binary files /dev/null and b/doc/lib/jacob-1.21-x86.dll differ
diff --git a/doc/lib/jacob-1.21.jar b/doc/lib/jacob-1.21.jar
new file mode 100644
index 0000000..54549aa
Binary files /dev/null and b/doc/lib/jacob-1.21.jar differ
diff --git a/doc/win/yinyitong-dll-stand.bat b/doc/win/yinyitong-dll-stand.bat
new file mode 100644
index 0000000..3b7f810
--- /dev/null
+++ b/doc/win/yinyitong-dll-stand.bat
@@ -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
diff --git a/doc/win/yinyitong-dll-stand.xml b/doc/win/yinyitong-dll-stand.xml
index eec13c0..3d3b55a 100644
--- a/doc/win/yinyitong-dll-stand.xml
+++ b/doc/win/yinyitong-dll-stand.xml
@@ -1,8 +1,25 @@
- yinyitong-dll-stand
- yinyitong-dll-stand
- 银医通-台式机-DLL调用服务
+
+
+
+ dpkj-%NAME%
+
+ %BASE%
+
+ 银医台式机中间服务调用程序
+
+
java
- -jar %BASE%\yinyitong-dll-stand.jar
+
+ -jar %BASE%\%NAME%.jar
+
+
+ %BASE%\logs\winws
+
+
+ 10240
+ yyyyMMdd
+ 00:00:00
+
diff --git a/pom.xml b/pom.xml
index 7c6d1e8..32d2e84 100644
--- a/pom.xml
+++ b/pom.xml
@@ -20,7 +20,7 @@
1.8
5.8.36
- 5.14.0
+ 5.17.0
3.0.2
@@ -48,12 +48,6 @@
test
-
- cn.hutool
- hutool-crypto
- ${hutool.version}
-
-
cn.hutool
hutool-all
@@ -61,16 +55,33 @@
+
net.java.dev.jna
- jna
+ jna-jpms
${jna.version}
-
+
+
+ net.java.dev.jna
+ jna-platform-jpms
+ ${jna.version}
+
+
+
+
+ com.jacob
+ jacob
+ 1.21
diff --git a/src/main/java/com/dpkj/common/config/HisConfig.java b/src/main/java/com/dpkj/common/config/HisConfig.java
new file mode 100644
index 0000000..5937159
--- /dev/null
+++ b/src/main/java/com/dpkj/common/config/HisConfig.java
@@ -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;
+
+}
diff --git a/src/main/java/com/dpkj/common/utils/IDGenerator.java b/src/main/java/com/dpkj/common/utils/IDGenerator.java
new file mode 100644
index 0000000..74003f9
--- /dev/null
+++ b/src/main/java/com/dpkj/common/utils/IDGenerator.java
@@ -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();
+ }
+
+
+}
diff --git a/src/main/java/com/dpkj/modules/chs/controller/HispayController.java b/src/main/java/com/dpkj/modules/chs/controller/HispayController.java
index f93b12b..8bd9b52 100644
--- a/src/main/java/com/dpkj/modules/chs/controller/HispayController.java
+++ b/src/main/java/com/dpkj/modules/chs/controller/HispayController.java
@@ -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);
+ }
+
+
}
diff --git a/src/main/java/com/dpkj/modules/chs/dll/HispayDll.java b/src/main/java/com/dpkj/modules/chs/dll/HispayDll.java
index 1709079..55b3d8d 100644
--- a/src/main/java/com/dpkj/modules/chs/dll/HispayDll.java
+++ b/src/main/java/com/dpkj/modules/chs/dll/HispayDll.java
@@ -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);
-
- }
-
}
diff --git a/src/main/java/com/dpkj/modules/chs/service/IHispayService.java b/src/main/java/com/dpkj/modules/chs/service/IHispayService.java
index 5315557..59e8b23 100644
--- a/src/main/java/com/dpkj/modules/chs/service/IHispayService.java
+++ b/src/main/java/com/dpkj/modules/chs/service/IHispayService.java
@@ -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);
}
diff --git a/src/main/java/com/dpkj/modules/chs/service/impl/HispayServiceImpl.java b/src/main/java/com/dpkj/modules/chs/service/impl/HispayServiceImpl.java
index 6ba4adc..625998f 100644
--- a/src/main/java/com/dpkj/modules/chs/service/impl/HispayServiceImpl.java
+++ b/src/main/java/com/dpkj/modules/chs/service/impl/HispayServiceImpl.java
@@ -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);
+
+ }
}
diff --git a/src/main/resources/logback-spring.xml b/src/main/resources/logback-spring.xml
index afb7e6c..4be9829 100644
--- a/src/main/resources/logback-spring.xml
+++ b/src/main/resources/logback-spring.xml
@@ -1,7 +1,7 @@
-
+
diff --git a/src/main/resources/win32-x86-64/AlipayChs.dll b/src/main/resources/win32-x86-64/AlipayChs.dll
deleted file mode 100644
index 5d0cf23..0000000
Binary files a/src/main/resources/win32-x86-64/AlipayChs.dll and /dev/null differ
diff --git a/src/main/resources/win32-x86-64/HispayChs.dll b/src/main/resources/win32-x86-64/HispayChs.dll
deleted file mode 100644
index d54f886..0000000
Binary files a/src/main/resources/win32-x86-64/HispayChs.dll and /dev/null differ
diff --git a/src/main/resources/win32-x86-64/libeay32.dll b/src/main/resources/win32-x86-64/libeay32.dll
deleted file mode 100644
index db98e5b..0000000
Binary files a/src/main/resources/win32-x86-64/libeay32.dll and /dev/null differ
diff --git a/src/main/resources/win32-x86-64/ssleay32.dll b/src/main/resources/win32-x86-64/ssleay32.dll
deleted file mode 100644
index 965b609..0000000
Binary files a/src/main/resources/win32-x86-64/ssleay32.dll and /dev/null differ
diff --git a/src/main/resources/win32-x86/HispayChs.dll b/src/main/resources/win32-x86/HispayChs.dll
deleted file mode 100644
index d54f886..0000000
Binary files a/src/main/resources/win32-x86/HispayChs.dll and /dev/null differ