Bladeren bron

处方流转测试环境

lighter_217 1 maand geleden
bovenliggende
commit
3518fd4fca

+ 3 - 0
src/main/java/thyyxxk/simzfeeoprnsystm/pojo/digitalreceipt/request/MedicineInquiry.java

@@ -5,11 +5,14 @@ import lombok.Data;
 @Data
 public class MedicineInquiry {
     private String fixmedinsCode = "H32132200561";
+    private String poolareaNo = "321322";
     private String medListCodg;
     private String begntime;
     private String endtime;
     private Integer pageNum;
     private Integer pageSize;
+    // 0国谈药   2门慢用药   3基本药物
+    private String jcFlag;
     private Boolean needSaving;
     private Boolean onlyCurrentPage;
 

+ 44 - 11
src/main/java/thyyxxk/simzfeeoprnsystm/service/DigitalReceiptService.java

@@ -6,6 +6,7 @@ import com.itextpdf.text.Font;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
+import org.springframework.web.client.RestTemplate;
 import thyyxxk.simzfeeoprnsystm.dao.RxDao;
 import thyyxxk.simzfeeoprnsystm.dicts.SiFunction;
 import thyyxxk.simzfeeoprnsystm.pojo.CodeName;
@@ -32,11 +33,20 @@ import java.util.List;
 public class DigitalReceiptService {
     private final ExecService exec;
     private final RxDao rxDao;
+    private final RestTemplate template;
+    // 处方流转正式地址
+    // private final static String cflzUrl = "http://130.150.161.72:8079/cflz";
+    // private final static String ypcxUrl =  "http://130.150.161.72:8079/cflzYpcx";
+
+    // 处方流转测试地址
+    private final static String cflzUrl = "http://130.150.161.72:8079/testCflz";
+    private final static String ypcxUrl =  "http://130.150.161.72:8079/testCflzYpcx";
 
     @Autowired
-    public DigitalReceiptService(ExecService exec, RxDao rxDao) {
+    public DigitalReceiptService(ExecService exec, RxDao rxDao, RestTemplate template) {
         this.exec = exec;
         this.rxDao = rxDao;
+        this.template = template;
     }
 
     public ResultVo<JSONObject> medicineInquiry(MedicineInquiry inquiry) throws Exception {
@@ -54,10 +64,12 @@ public class DigitalReceiptService {
         String dataRef = JSONObject.toJSONString(inquiry);
         JSONObject data = JSONObject.parseObject(dataRef);
         log.info("电子处方药品查询页码:{}", inquiry.getPageNum());
-
         JSONObject input = HseEncAndDecUtil.encryptMsg(data);
-        JSONObject result = exec.executeTrade(input, SiFunction.RX_QUERY_MEDICINE);
-
+        JSONObject result = template.postForObject(ypcxUrl, input, JSONObject.class);
+        log.info("电子处方药品查询结果:{}", result);
+        if (null == result) {
+            return ResultVoUtil.fail(ExceptionEnum.NETWORK_ERROR);
+        }
         Integer code = result.getInteger("code");
         if (null == code || code != 0){
             return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, result.getString("message"));
@@ -124,9 +136,12 @@ public class DigitalReceiptService {
         data.put("diseinfo", JSONArray.parseArray(diseinfoRef));
         log.info("明文:{}", data);
         JSONObject input = HseEncAndDecUtil.encryptMsg(data);
-        JSONObject result = exec.executeTrade(input, SiFunction.RX_PRE_CHECK);
+        JSONObject result = template.postForObject(cflzUrl + "/uploadChk", input, JSONObject.class);
         log.info("电子处方上传预核验:\n参数:{},\n结果:{}", input, result);
 
+        if (null == result) {
+            return ResultVoUtil.fail(ExceptionEnum.NETWORK_ERROR);
+        }
         Integer code = result.getInteger("code");
         if (null == code || code != 0){
             return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, result.getString("message"));
@@ -160,8 +175,11 @@ public class DigitalReceiptService {
         JSONObject data = JSONObject.parseObject(dataRef);
         log.info("明文:{}", data);
         JSONObject input = HseEncAndDecUtil.encryptMsg(data);
-        JSONObject result = exec.executeTrade(input, SiFunction.RX_SIGN);
+        JSONObject result = template.postForObject(cflzUrl + "/rxFixmedinsSign", input, JSONObject.class);
         log.info("电子处方医保电子签名:\n参数:{},\n结果:{}", input, result);
+        if (null == result) {
+            return ResultVoUtil.fail(ExceptionEnum.NETWORK_ERROR);
+        }
         Integer code = result.getInteger("code");
         if (null == code || code != 0){
             return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, result.getString("message"));
@@ -178,8 +196,11 @@ public class DigitalReceiptService {
         JSONObject data = JSONObject.parseObject(dataRef);
         log.info("明文:{}", data);
         JSONObject input = HseEncAndDecUtil.encryptMsg(data);
-        JSONObject result = exec.executeTrade(input, SiFunction.RX_UPLOAD);
+        JSONObject result = template.postForObject(cflzUrl + "/rxFileUpld", input, JSONObject.class);
         log.info("电子处方上传:\n参数:{},\n结果:{}", input, result);
+        if (null == result) {
+            return ResultVoUtil.fail(ExceptionEnum.NETWORK_ERROR);
+        }
         Integer code = result.getInteger("code");
         if (null == code || code != 0){
             return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, result.getString("message"));
@@ -195,8 +216,11 @@ public class DigitalReceiptService {
         JSONObject data = JSONObject.parseObject(dataRef);
         log.info("明文:{}", data);
         JSONObject input = HseEncAndDecUtil.encryptMsg(data);
-        JSONObject result = exec.executeTrade(input, SiFunction.RX_REVOKE);
+        JSONObject result = template.postForObject(cflzUrl + "/rxUndo", input, JSONObject.class);
         log.info("电子处方撤销:\n参数:{},\n结果:{}", input, result);
+        if (null == result) {
+            return ResultVoUtil.fail(ExceptionEnum.NETWORK_ERROR);
+        }
         Integer code = result.getInteger("code");
         if (null == code || code != 0){
             return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, result.getString("message"));
@@ -212,8 +236,11 @@ public class DigitalReceiptService {
         JSONObject data = JSONObject.parseObject(dataRef);
         log.info("明文:{}", data);
         JSONObject input = HseEncAndDecUtil.encryptMsg(data);
-        JSONObject result = exec.executeTrade(input, SiFunction.RX_INFO_QUERY);
+        JSONObject result = template.postForObject(cflzUrl + "/hospRxDetlQuery", input, JSONObject.class);
         log.info("电子处方信息查询:\n参数:{},\n结果:{}", input, result);
+        if (null == result) {
+            return ResultVoUtil.fail(ExceptionEnum.NETWORK_ERROR);
+        }
         Integer code = result.getInteger("code");
         if (null == code || code != 0){
             return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, result.getString("message"));
@@ -226,8 +253,11 @@ public class DigitalReceiptService {
         JSONObject data = JSONObject.parseObject(dataRef);
         log.info("明文:{}", data);
         JSONObject input = HseEncAndDecUtil.encryptMsg(data);
-        JSONObject result = exec.executeTrade(input, SiFunction.RX_AUDITING_QUERY);
+        JSONObject result = template.postForObject(cflzUrl + "/rxChkInfoQuery", input, JSONObject.class);
         log.info("电子处方审核结果查询:\n参数:{},\n结果:{}", input, result);
+        if (null == result) {
+            return ResultVoUtil.fail(ExceptionEnum.NETWORK_ERROR);
+        }
         Integer code = result.getInteger("code");
         if (null == code || code != 0){
             return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, result.getString("message"));
@@ -240,8 +270,11 @@ public class DigitalReceiptService {
         JSONObject data = JSONObject.parseObject(dataRef);
         log.info("明文:{}", data);
         JSONObject input = HseEncAndDecUtil.encryptMsg(data);
-        JSONObject result = exec.executeTrade(input, SiFunction.RX_SETL_QUERY);
+        JSONObject result = template.postForObject(cflzUrl + "/rxSetlInfoQuery", input, JSONObject.class);
         log.info("电子处方取药结果查询:\n参数:{},\n结果:{}", input, result);
+        if (null == result) {
+            return ResultVoUtil.fail(ExceptionEnum.NETWORK_ERROR);
+        }
         Integer code = result.getInteger("code");
         if (null == code || code != 0){
             return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, result.getString("message"));

+ 11 - 6
src/main/java/thyyxxk/simzfeeoprnsystm/utils/rxsign/HseEncAndDecUtil.java

@@ -13,11 +13,17 @@ import com.alibaba.fastjson.JSONObject;
 import thyyxxk.simzfeeoprnsystm.utils.StringUtil;
 
 public class HseEncAndDecUtil {
-    // 电子处方正式环境
-    private final static String chnlId = "2863D5752ED541EAAB5EFAAD6E8738D7";
-    private final static String sm4key = "C5284B71E4444204B07A03AD84F943E3";
-    private final static String prvKey = "Ext2wUfq/reXazwvUjN8n3sKiievMXXwEJ1ng//HxeI=";
-    private final static String pubKey = "BN98Es/bSG2Si2gDtkS/uxNosr6l/aNr9D4Ui2OTU3A4sltrMhO/ThjYlKpBbuqqrXn0M6271sa6pFjcpvSjxyU=";
+    // 处方流转正式环境
+    // private final static String chnlId = "2863D5752ED541EAAB5EFAAD6E8738D7";
+    // private final static String sm4key = "C5284B71E4444204B07A03AD84F943E3";
+    // private final static String prvKey = "Ext2wUfq/reXazwvUjN8n3sKiievMXXwEJ1ng//HxeI=";
+    // private final static String pubKey = "BN98Es/bSG2Si2gDtkS/uxNosr6l/aNr9D4Ui2OTU3A4sltrMhO/ThjYlKpBbuqqrXn0M6271sa6pFjcpvSjxyU=";
+    // 处方流转测试环境
+    private final static String chnlId = "15C51B9552CA4BCBBBEFF60A631C9423";
+    private final static String sm4key = "6BA9305306624D92BEAC4CC4373A95A7";
+    private final static String prvKey = "AO8SML0FYT7FNBVeSUUjnH8hW8jf9g6y45Z5/RAoFHZE";
+    private final static String pubKey = "BIs5GVQZh+oTz0ypNQqe/Oh45bU/6SNoXmN/uBzXtZapoJRZfOJV56D9W56bNxPOkTKH0FYDMnwOdFyG84qShTg=";
+
 
     /**
      * sm2签名
@@ -131,7 +137,6 @@ public class HseEncAndDecUtil {
         jsonObject.put("encType",encType);
         jsonObject.put("data",body);
         jsonObject.put("signType",signType);
-//        jsonObject.put("transType",transType);
         //加密后的报文
         String encData = sm4Encrypt(body.toJSONString());
         //签名