医保调用形式修改
This commit is contained in:
parent
789d0d17cb
commit
235306ae33
|
@ -26,7 +26,7 @@ import org.springframework.web.bind.annotation.RestController;
|
||||||
@RequestMapping("/chs/hispay")
|
@RequestMapping("/chs/hispay")
|
||||||
public class HispayController {
|
public class HispayController {
|
||||||
|
|
||||||
private final IHispayService iHispayService;
|
private final IHispayService hispayService;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -38,7 +38,7 @@ public class HispayController {
|
||||||
@PostMapping("findReadCode")
|
@PostMapping("findReadCode")
|
||||||
public Result<?> findReadCode() {
|
public Result<?> findReadCode() {
|
||||||
try {
|
try {
|
||||||
JSONObject res = iHispayService.readCode();
|
JSONObject res = hispayService.readCode();
|
||||||
return Result.ok("成功", res);
|
return Result.ok("成功", res);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
@ -63,7 +63,7 @@ public class HispayController {
|
||||||
throw new RuntimeException("密码不可为空");
|
throw new RuntimeException("密码不可为空");
|
||||||
}
|
}
|
||||||
|
|
||||||
JSONObject res = iHispayService.readCard(password);
|
JSONObject res = hispayService.readCard(password);
|
||||||
return Result.ok("成功", res);
|
return Result.ok("成功", res);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
@ -84,7 +84,7 @@ public class HispayController {
|
||||||
public Result<?> chsCodeAsOutpatientBegin(@RequestBody @Validated OutpatientBeginModel data) {
|
public Result<?> chsCodeAsOutpatientBegin(@RequestBody @Validated OutpatientBeginModel data) {
|
||||||
try {
|
try {
|
||||||
log.info("[HispayController][chsCodeAsOutpatientBegin][门诊缴费-预算-电子医保凭证] 参数:{}", data);
|
log.info("[HispayController][chsCodeAsOutpatientBegin][门诊缴费-预算-电子医保凭证] 参数:{}", data);
|
||||||
ResultData res = iHispayService.chsCodeAsOutpatientBegin(data);
|
ResultData res = hispayService.chsCodeAsOutpatientBegin(data);
|
||||||
return Result.ok("成功", res);
|
return Result.ok("成功", res);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
@ -105,7 +105,7 @@ public class HispayController {
|
||||||
public Result<?> chsCodeAsOutpatientFinal(@RequestBody @Validated OutpatientFinalModel data) {
|
public Result<?> chsCodeAsOutpatientFinal(@RequestBody @Validated OutpatientFinalModel data) {
|
||||||
try {
|
try {
|
||||||
log.info("[HispayController][chsCodeAsOutpatientFinal][门诊缴费-结算-电子医保凭证] 参数:{}", data);
|
log.info("[HispayController][chsCodeAsOutpatientFinal][门诊缴费-结算-电子医保凭证] 参数:{}", data);
|
||||||
ResultData res = iHispayService.chsCodeAsOutpatientFinal(data);
|
ResultData res = hispayService.chsCodeAsOutpatientFinal(data);
|
||||||
return Result.ok("成功", res);
|
return Result.ok("成功", res);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
@ -114,4 +114,5 @@ public class HispayController {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,5 +43,4 @@ public interface IHispayService {
|
||||||
*/
|
*/
|
||||||
ResultData chsCodeAsOutpatientFinal(OutpatientFinalModel data);
|
ResultData chsCodeAsOutpatientFinal(OutpatientFinalModel data);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package com.dpkj.modules.chs.service.impl;
|
package com.dpkj.modules.chs.service.impl;
|
||||||
|
|
||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
|
import cn.hutool.core.lang.Console;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import cn.hutool.core.util.XmlUtil;
|
import cn.hutool.core.util.XmlUtil;
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
|
@ -15,11 +16,12 @@ import com.jacob.activeX.ActiveXComponent;
|
||||||
import com.jacob.com.ComThread;
|
import com.jacob.com.ComThread;
|
||||||
import com.jacob.com.Dispatch;
|
import com.jacob.com.Dispatch;
|
||||||
import com.jacob.com.Variant;
|
import com.jacob.com.Variant;
|
||||||
import lombok.AllArgsConstructor;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.w3c.dom.Document;
|
import org.w3c.dom.Document;
|
||||||
|
|
||||||
|
import javax.annotation.PostConstruct;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
|
||||||
|
@ -30,11 +32,21 @@ import java.util.Map;
|
||||||
*/
|
*/
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@Service
|
@Service
|
||||||
@AllArgsConstructor
|
// @AllArgsConstructor
|
||||||
public class HispayServiceImpl implements IHispayService {
|
public class HispayServiceImpl implements IHispayService {
|
||||||
|
|
||||||
private final HisConfig hisConfig;
|
@Autowired
|
||||||
private final ChsConfig chsConfig;
|
private HisConfig hisConfig;
|
||||||
|
@Autowired
|
||||||
|
private ChsConfig chsConfig;
|
||||||
|
|
||||||
|
// COM对象
|
||||||
|
private Dispatch dispatch;
|
||||||
|
|
||||||
|
@PostConstruct
|
||||||
|
public void postConstruct() {
|
||||||
|
dispatch = instanceActive();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取HIS医保实例
|
* 获取HIS医保实例
|
||||||
|
@ -42,14 +54,13 @@ public class HispayServiceImpl implements IHispayService {
|
||||||
* @return com.jacob.activeX.ActiveXComponent
|
* @return com.jacob.activeX.ActiveXComponent
|
||||||
* @author 萧道子 2025/5/21
|
* @author 萧道子 2025/5/21
|
||||||
*/
|
*/
|
||||||
private ActiveXComponent instanceActive() {
|
private Dispatch instanceActive() {
|
||||||
try {
|
try {
|
||||||
// 初始化
|
// 初始化
|
||||||
ComThread.InitSTA();
|
ComThread.InitSTA();
|
||||||
// 获取COM对象
|
ActiveXComponent activeXComponent = new ActiveXComponent("PayClient.clsPayClient");
|
||||||
ActiveXComponent active = new ActiveXComponent("PayClient.clsPayClient");
|
|
||||||
log.info("[HispayServiceImpl][instanceActive][HIS医保COM库] 加载成功");
|
log.info("[HispayServiceImpl][instanceActive][HIS医保COM库] 加载成功");
|
||||||
return active;
|
return activeXComponent;
|
||||||
} catch (UnsatisfiedLinkError e) {
|
} catch (UnsatisfiedLinkError e) {
|
||||||
log.info("[HispayServiceImpl][instanceActive][HIS医保COM库] 加载失败:{}", e.getMessage());
|
log.info("[HispayServiceImpl][instanceActive][HIS医保COM库] 加载失败:{}", e.getMessage());
|
||||||
throw new RuntimeException("HIS医保COM库加载失败:" + e.getMessage(), e);
|
throw new RuntimeException("HIS医保COM库加载失败:" + e.getMessage(), e);
|
||||||
|
@ -120,7 +131,7 @@ public class HispayServiceImpl implements IHispayService {
|
||||||
@Override
|
@Override
|
||||||
public JSONObject readCode() {
|
public JSONObject readCode() {
|
||||||
// 加载资源
|
// 加载资源
|
||||||
Dispatch dispatch = instanceActive();
|
// Dispatch dispatch = instanceActive();
|
||||||
|
|
||||||
/** 1、组装参数 */
|
/** 1、组装参数 */
|
||||||
JSONObject val = new JSONObject()
|
JSONObject val = new JSONObject()
|
||||||
|
@ -140,7 +151,7 @@ public class HispayServiceImpl implements IHispayService {
|
||||||
log.info("[HispayServiceImpl][readCode][医保读卡-电子凭证] call返回值:{} 结果:{}", call, resStr);
|
log.info("[HispayServiceImpl][readCode][医保读卡-电子凭证] call返回值:{} 结果:{}", call, resStr);
|
||||||
|
|
||||||
// 释放资源
|
// 释放资源
|
||||||
releaseActive();
|
// releaseActive();
|
||||||
|
|
||||||
/** 3、处理读卡结果 */
|
/** 3、处理读卡结果 */
|
||||||
JSONObject result = verifyResult(resStr);
|
JSONObject result = verifyResult(resStr);
|
||||||
|
@ -154,7 +165,7 @@ public class HispayServiceImpl implements IHispayService {
|
||||||
@Override
|
@Override
|
||||||
public JSONObject readCard(String password) {
|
public JSONObject readCard(String password) {
|
||||||
// 加载资源
|
// 加载资源
|
||||||
Dispatch dispatch = instanceActive();
|
// Dispatch dispatch = instanceActive();
|
||||||
|
|
||||||
/** 1、组装参数 */
|
/** 1、组装参数 */
|
||||||
JSONObject val = new JSONObject()
|
JSONObject val = new JSONObject()
|
||||||
|
@ -174,7 +185,7 @@ public class HispayServiceImpl implements IHispayService {
|
||||||
log.info("[HispayServiceImpl][readCard][医保读卡-医保卡] call返回值:{} 结果:{}", call, resStr);
|
log.info("[HispayServiceImpl][readCard][医保读卡-医保卡] call返回值:{} 结果:{}", call, resStr);
|
||||||
|
|
||||||
// 释放资源
|
// 释放资源
|
||||||
releaseActive();
|
// releaseActive();
|
||||||
|
|
||||||
/** 3、处理读卡结果 */
|
/** 3、处理读卡结果 */
|
||||||
JSONObject result = verifyResult(resStr);
|
JSONObject result = verifyResult(resStr);
|
||||||
|
@ -188,7 +199,7 @@ public class HispayServiceImpl implements IHispayService {
|
||||||
|
|
||||||
private ResultData outpatientBudget(OutpatientBeginModel data) {
|
private ResultData outpatientBudget(OutpatientBeginModel data) {
|
||||||
// 加载资源
|
// 加载资源
|
||||||
ActiveXComponent dispatch = instanceActive();
|
// Dispatch dispatch = instanceActive();
|
||||||
|
|
||||||
/** 1、组装参数 */
|
/** 1、组装参数 */
|
||||||
JSONObject val = new JSONObject()
|
JSONObject val = new JSONObject()
|
||||||
|
@ -211,7 +222,7 @@ public class HispayServiceImpl implements IHispayService {
|
||||||
log.info("[HispayServiceImpl][outpatientBudget][门诊缴费-预算] call返回值:{} 结果:{}", call, resStr);
|
log.info("[HispayServiceImpl][outpatientBudget][门诊缴费-预算] call返回值:{} 结果:{}", call, resStr);
|
||||||
|
|
||||||
// 释放资源
|
// 释放资源
|
||||||
releaseActive();
|
// releaseActive();
|
||||||
|
|
||||||
/** 3、处理结果 */
|
/** 3、处理结果 */
|
||||||
JSONObject result = verifyResult(resStr);
|
JSONObject result = verifyResult(resStr);
|
||||||
|
@ -239,7 +250,7 @@ public class HispayServiceImpl implements IHispayService {
|
||||||
@Override
|
@Override
|
||||||
public ResultData chsCodeAsOutpatientFinal(OutpatientFinalModel data) {
|
public ResultData chsCodeAsOutpatientFinal(OutpatientFinalModel data) {
|
||||||
// 加载资源
|
// 加载资源
|
||||||
ActiveXComponent dispatch = instanceActive();
|
// ActiveXComponent dispatch = instanceActive();
|
||||||
|
|
||||||
/** 1、组装参数 */
|
/** 1、组装参数 */
|
||||||
String requestTime = DateUtil.now();
|
String requestTime = DateUtil.now();
|
||||||
|
@ -262,7 +273,7 @@ public class HispayServiceImpl implements IHispayService {
|
||||||
log.info("[HispayServiceImpl][chsCodeAsOutpatientFinal][门诊缴费-结算] call返回值:{} 结果:{}", call, resStr);
|
log.info("[HispayServiceImpl][chsCodeAsOutpatientFinal][门诊缴费-结算] call返回值:{} 结果:{}", call, resStr);
|
||||||
|
|
||||||
// 释放资源
|
// 释放资源
|
||||||
releaseActive();
|
// releaseActive();
|
||||||
|
|
||||||
// TODO BEGIN 萧道子 2025/6/10 : 模拟参数
|
// 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>";
|
// 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>";
|
||||||
|
|
Loading…
Reference in New Issue