医保调用修改

This commit is contained in:
萧道子 2025-06-17 15:59:09 +08:00
parent 235306ae33
commit 547bdb6d08
1 changed files with 4 additions and 29 deletions

View File

@ -1,7 +1,6 @@
package com.dpkj.modules.chs.service.impl;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.lang.Console;
import cn.hutool.core.util.StrUtil;
import cn.hutool.core.util.XmlUtil;
import com.alibaba.fastjson.JSON;
@ -13,7 +12,6 @@ import com.dpkj.modules.chs.service.IHispayService;
import com.dpkj.modules.chs.vo.OutpatientBeginModel;
import com.dpkj.modules.chs.vo.OutpatientFinalModel;
import com.jacob.activeX.ActiveXComponent;
import com.jacob.com.ComThread;
import com.jacob.com.Dispatch;
import com.jacob.com.Variant;
import lombok.extern.slf4j.Slf4j;
@ -41,7 +39,7 @@ public class HispayServiceImpl implements IHispayService {
private ChsConfig chsConfig;
// COM对象
private Dispatch dispatch;
private static ActiveXComponent dispatch;
@PostConstruct
public void postConstruct() {
@ -54,10 +52,10 @@ public class HispayServiceImpl implements IHispayService {
* @return com.jacob.activeX.ActiveXComponent
* @author 萧道子 2025/5/21
*/
private Dispatch instanceActive() {
private static ActiveXComponent instanceActive() {
try {
// 初始化
ComThread.InitSTA();
// ComThread.InitSTA(); //容易导致线程发生阻塞
ActiveXComponent activeXComponent = new ActiveXComponent("PayClient.clsPayClient");
log.info("[HispayServiceImpl][instanceActive][HIS医保COM库] 加载成功");
return activeXComponent;
@ -75,7 +73,7 @@ public class HispayServiceImpl implements IHispayService {
* @author 萧道子 2025/5/21
*/
private void releaseActive() {
ComThread.Release();
// ComThread.Release(); //容易导致线程发生阻塞
}
/**
@ -130,9 +128,6 @@ public class HispayServiceImpl implements IHispayService {
@Override
public JSONObject readCode() {
// 加载资源
// Dispatch dispatch = instanceActive();
/** 1、组装参数 */
JSONObject val = new JSONObject()
.fluentPut("cardtype", "9") // 1.就诊卡2.医保卡5.门诊号6.患者姓名和电话号码8.电子健康码/9.医保电子凭证
@ -150,8 +145,6 @@ public class HispayServiceImpl implements IHispayService {
String resStr = vres.getStringRef();
log.info("[HispayServiceImpl][readCode][医保读卡-电子凭证] call返回值{} 结果:{}", call, resStr);
// 释放资源
// releaseActive();
/** 3、处理读卡结果 */
JSONObject result = verifyResult(resStr);
@ -164,8 +157,6 @@ public class HispayServiceImpl implements IHispayService {
@Override
public JSONObject readCard(String password) {
// 加载资源
// Dispatch dispatch = instanceActive();
/** 1、组装参数 */
JSONObject val = new JSONObject()
@ -184,9 +175,6 @@ public class HispayServiceImpl implements IHispayService {
String resStr = vres.getStringRef();
log.info("[HispayServiceImpl][readCard][医保读卡-医保卡] call返回值{} 结果:{}", call, resStr);
// 释放资源
// releaseActive();
/** 3、处理读卡结果 */
JSONObject result = verifyResult(resStr);
if (!result.containsKey("item")) {
@ -198,8 +186,6 @@ public class HispayServiceImpl implements IHispayService {
private ResultData outpatientBudget(OutpatientBeginModel data) {
// 加载资源
// Dispatch dispatch = instanceActive();
/** 1、组装参数 */
JSONObject val = new JSONObject()
@ -221,8 +207,6 @@ public class HispayServiceImpl implements IHispayService {
String resStr = resVariant.getStringRef();
log.info("[HispayServiceImpl][outpatientBudget][门诊缴费-预算] call返回值{} 结果:{}", call, resStr);
// 释放资源
// releaseActive();
/** 3、处理结果 */
JSONObject result = verifyResult(resStr);
@ -249,8 +233,6 @@ public class HispayServiceImpl implements IHispayService {
@Override
public ResultData chsCodeAsOutpatientFinal(OutpatientFinalModel data) {
// 加载资源
// ActiveXComponent dispatch = instanceActive();
/** 1、组装参数 */
String requestTime = DateUtil.now();
@ -272,13 +254,6 @@ public class HispayServiceImpl implements IHispayService {
String resStr = resVariant.getStringRef();
log.info("[HispayServiceImpl][chsCodeAsOutpatientFinal][门诊缴费-结算] call返回值{} 结果:{}", call, resStr);
// 释放资源
// releaseActive();
// TODO BEGIN 萧道子 2025/6/10 : 模拟参数
// String resStr = "<response><resultCode>0</resultCode><resultMessage/><result><sjh>123456789</sjh><sfrq>2025-06-10 10:23:14</sfrq><bz/><pyckjh/><fyckjh/><yflshjh/><ybcc/></result></response>";
// TODO END 萧道子 2025/6/10 : 模拟参数
/** 3、处理结果 */
JSONObject result = verifyResult(resStr);