lighter преди 10 месеца
родител
ревизия
b8e02d90fc

+ 1 - 1
src/main/java/thyyxxk/wxservice_server/controller/MedInsMobilePayController.java

@@ -57,7 +57,6 @@ public class MedInsMobilePayController {
         if (hisOrdInfo.length == 3) {
             request.setPatNo(hisOrdInfo[0]);
             request.setTimes(Integer.parseInt(hisOrdInfo[1]));
-            request.setName(result.getString("user_name"));
             request.setSocialNo(result.getString("user_card_no"));
             request.setInsuplcAdmdvs(result.getString("city_id"));
 
@@ -67,6 +66,7 @@ public class MedInsMobilePayController {
                 return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, insuinfo.getMessage());
             }
         }
+        result.put("openid", params.getString("openid"));
         return ResultVoUtil.success(result);
     }
 

+ 35 - 38
src/main/java/thyyxxk/wxservice_server/controller/api/PowersiMiPayPlugin.java

@@ -11,13 +11,15 @@ import thyyxxk.wxservice_server.config.auth.PassToken;
 import thyyxxk.wxservice_server.config.exception.ExceptionEnum;
 import thyyxxk.wxservice_server.dao.api.PowersiPluginDao;
 import thyyxxk.wxservice_server.entity.ResultVo;
-import thyyxxk.wxservice_server.entity.medinsmobilepay.frompowersiplugin.request.CommonRequest;
+import thyyxxk.wxservice_server.entity.medinsmobilepay.InsuinfoRequest;
 import thyyxxk.wxservice_server.entity.medinsmobilepay.frompowersiplugin.response.BillInfo;
 import thyyxxk.wxservice_server.entity.medinsmobilepay.frompowersiplugin.response.CommonResponse;
 import thyyxxk.wxservice_server.entity.medinsmobilepay.frompowersiplugin.response.Upload6201;
 import thyyxxk.wxservice_server.factory.thmz.ThmzService;
 import thyyxxk.wxservice_server.factory.thmz.model.QueryReceiptRequest;
 import thyyxxk.wxservice_server.service.IdCardAnalyzeService;
+import thyyxxk.wxservice_server.utils.ResultVoUtil;
+import thyyxxk.wxservice_server.utils.TokenUtil;
 
 import java.io.IOException;
 import java.util.ArrayList;
@@ -35,10 +37,17 @@ public class PowersiMiPayPlugin {
     private static final String MZ_API_URL = "http://172.16.30.26:1100/mobilePayApi";
 
     // 移动支付测试环境
-    private final static String chnlId = "1I14E7CSC05E4460C80A0000D6788E13";
-    private final static String sm4key = "1I14E7CSC05F4460C80A000070CF4673";
-    private final static String prvKey = "AOyLayJnHqXC56ENBW2vdfd5aPrncBOA3TK27LkvXHfI";
-    private final static String pubKey = "BBVwpoYbrrguE9NEpi0PDKYqJKS5w7lksW1nLtNmVctgrli+B/sKs83tZQBlV3FTvTSaaHbxNidsBjsdisd0XDE=";
+//    private final static String chnlId = "1I14E7CSC05E4460C80A0000D6788E13";
+//    private final static String sm4key = "1I14E7CSC05F4460C80A000070CF4673";
+//    private final static String prvKey = "AOyLayJnHqXC56ENBW2vdfd5aPrncBOA3TK27LkvXHfI";
+//    private final static String pubKey = "BBVwpoYbrrguE9NEpi0PDKYqJKS5w7lksW1nLtNmVctgrli+B/sKs83tZQBlV3FTvTSaaHbxNidsBjsdisd0XDE=";
+
+    private final static String chnlId = "FBEBNX3X60526RPYJQ7PZ4CRPNZO8NC9";
+    private final static String sm4key = "SN7YCGQA4R1JJELBZNGKEMV3O4P9KF9F";
+    private final static String prvKey = "ATePKWH4x/ooLSoA5A5rxDrCgCbhFzPG/FvdqF2RkEI=";
+    private final static String pubKey = "BLaISfgVDY1OdD22WBSXO1z/PwHialH1lKxeB1SN7ZkCPEutbMCUpIJnl/009sXoXw7ubAHxfpHyn2aSgXAvkHI=";
+
+
     private final DataHandler dataHandler = DataHandler.newInstance(chnlId, sm4key, pubKey, prvKey);
 
     @Autowired
@@ -49,38 +58,20 @@ public class PowersiMiPayPlugin {
         dataHandler.setSkipVerify(true);
     }
 
-    @PassToken
-    @GetMapping("/test1")
-    public String test1() throws Exception {
-        CommonRequest request = new CommonRequest();
-        request.setIdNo("430821199207226813");
-        request.setIdType("01");
-        request.setUserName("丁捷");
-        request.setOrgCodg("H43010500370");
-        String ref = JSONObject.toJSONString(request);
-        String req = dataHandler.buildReqData(ref);
-        log.info("\n********************************** encrypt-req " +
-                "**********************************" +
-                "\n\n{}\n\n" +
-                "*************************************************************************************", req);
-        return req;
-    }
-
-    @PassToken
-    @GetMapping("/test2")
-    public CommonResponse test2(@RequestParam("val") String val) {
-        CommonResponse response = new CommonResponse(val);
-        response.setSuccess(true);
-        return response;
-    }
-
-    @PassToken
-    @PostMapping("/test3")
-    public CommonResponse test3(@RequestBody JSONObject body) throws Exception {
-        JSONObject data = decryptRequest(body);
-        CommonResponse response = new CommonResponse(data.toJSONString());
-        response.setSuccess(true);
-        return response;
+    @PostMapping("/getOpenid")
+    public ResultVo<String> getOpenid(@RequestBody InsuinfoRequest request) throws Exception {
+        String[] hisOrdInfo = request.getHisOrdNum().split("_");
+        if (hisOrdInfo.length == 3) {
+            request.setPatNo(hisOrdInfo[0]);
+            request.setTimes(Integer.parseInt(hisOrdInfo[1]));
+            request.setSocialNo(dao.selectIdNo(hisOrdInfo[0]));
+            ResultVo<String> insuinfo = new RestTemplate().postForObject
+                    (MZ_API_URL+"/queryInsuInfo", request, ResultVo.class);
+            if (insuinfo.getCode() != ExceptionEnum.SUCCESS.getCode()) {
+                return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, insuinfo.getMessage());
+            }
+        }
+        return ResultVoUtil.success(TokenUtil.getInstance().getUserOpenid());
     }
 
     private JSONObject decryptRequest(JSONObject body) throws Exception {
@@ -115,6 +106,7 @@ public class PowersiMiPayPlugin {
         List<String> patNos = dao.selectPatientCount(request.getString("idNo"));
         if (patNos.isEmpty()) {
             JSONObject res = new JSONObject();
+            res.put("code", -1);
             res.put("success", false);
             res.put("message", "没有患者的建档信息。");
             return res;
@@ -143,11 +135,15 @@ public class PowersiMiPayPlugin {
         }
         if (list.isEmpty()) {
             JSONObject res = new JSONObject();
+            res.put("code", -1);
             res.put("success", false);
             res.put("message", "没有患者的待缴费信息。");
             return res;
         }
-        String raw = dataHandler.buildReqData(JSONArray.toJSONString(list));
+        String listRef = JSONArray.toJSONString(list);
+        JSONObject temp = new JSONObject();
+        temp.put("billInfo", JSONArray.parseArray(listRef));
+        String raw = dataHandler.buildReqData(temp);
         JSONObject response = JSONObject.parseObject(raw);
         response.put("code", 0);
         response.put("success", true);
@@ -164,6 +160,7 @@ public class PowersiMiPayPlugin {
         String[] arr = bizId.split("_");
         if (arr.length != 3) {
             JSONObject res = new JSONObject();
+            res.put("code", -1);
             res.put("success", false);
             res.put("message", "bizId[" + bizId + "]不正确!");
             return res;

+ 3 - 0
src/main/java/thyyxxk/wxservice_server/dao/api/PowersiPluginDao.java

@@ -13,4 +13,7 @@ public interface PowersiPluginDao {
     @Select("select top 1 rtrim(code) from zd_unit_code " +
             "where name=#{name} and isnull(del_flag,'0')!='1'")
     String selectDeptId(String name);
+
+    @Select("select max(social_no) from t_wechat_patient_bind where patient_id=#{patNo}")
+    String selectIdNo(String patNo);
 }

+ 1 - 0
src/main/java/thyyxxk/wxservice_server/entity/medinsmobilepay/frompowersiplugin/response/BillInfo.java

@@ -28,6 +28,7 @@ public class BillInfo {
         this.feeTime = hisCharge.get("priceTime").toString();
         this.userName = hisCharge.get("patName").toString();
         String totalAmt = hisCharge.get("totalAmt").toString();
+        totalAmt = totalAmt.split("\\.")[0];
         this.medfeeSumamt = DecimalTool.moneyFenToYuan(Integer.parseInt(totalAmt));
         this.deptName = hisCharge.get("deptName").toString();
     }

+ 3 - 0
src/main/java/thyyxxk/wxservice_server/entity/medinsmobilepay/frompowersiplugin/response/CommonResponse.java

@@ -4,15 +4,18 @@ import lombok.Data;
 
 @Data
 public class CommonResponse {
+    private Integer code;
     private boolean success;
     private String message;
 
     public CommonResponse() {
+        this.code = 0;
         this.success = true;
         this.message = "OK";
     }
 
     public CommonResponse(String message) {
+        this.code = -1;
         this.success = false;
         this.message = message;
     }

+ 6 - 2
src/main/java/thyyxxk/wxservice_server/entity/medinsmobilepay/frompowersiplugin/response/Feedetail.java

@@ -3,10 +3,14 @@ package thyyxxk.wxservice_server.entity.medinsmobilepay.frompowersiplugin.respon
 import lombok.Data;
 
 import java.math.BigDecimal;
-import java.util.Date;
 
 @Data
 public class Feedetail {
+    /**
+     * 医疗目录名称
+     * */
+    private String medListName;
+
     /**
      * 费用明细流水号
      */
@@ -45,7 +49,7 @@ public class Feedetail {
     /**
      * 费用发生时间
      */
-    private Date feeOcurTime;
+    private String feeOcurTime;
 
     /**
      * 医疗目录编码

+ 2 - 3
src/main/java/thyyxxk/wxservice_server/entity/medinsmobilepay/frompowersiplugin/response/Upload6201.java

@@ -3,7 +3,6 @@ package thyyxxk.wxservice_server.entity.medinsmobilepay.frompowersiplugin.respon
 import lombok.Data;
 
 import java.math.BigDecimal;
-import java.util.Date;
 import java.util.List;
 
 @Data
@@ -50,7 +49,7 @@ public class Upload6201 {
     /**
      * 开始时间
      */
-    private Date begntime;
+    private String begntime;
 
     /**
      * 证件号码
@@ -95,7 +94,7 @@ public class Upload6201 {
     /**
      * 科室编码
      */
-    private String deptCode;
+    private String deptId;
 
     /**
      * 科室名称