Преглед изворни кода

Merge remote-tracking branch 'upstream/dev-1.1.4' into dev-1.1.4

hsh пре 2 година
родитељ
комит
558169293d

+ 4 - 1
src/main/java/cn/hnthyy/thmz/common/Constants.java

@@ -153,7 +153,10 @@ public class Constants {
      * 本院记账付款方式名称
      */
     public static final String BYJZ_NAME = "本院记账";
-
+    /**
+     * 银行卡缴费
+     */
+    public static final String YLK = "3";
     /**
      * 自助微信缴费
      */

+ 5 - 5
src/main/java/cn/hnthyy/thmz/mapper/his/mz/MzReceiptSerialMapper.java

@@ -86,11 +86,11 @@ public interface MzReceiptSerialMapper {
                     "obsolete_id,obsolete_date,obsolete_dcount_date,obsolete_dcount_no) VALUES ",
             "<foreach collection='mzReceiptSerials' item='item' index='index' separator=','>",
             " (#{item.patientId,jdbcType=CHAR},#{item.times,jdbcType=INTEGER},#{item.receiptNo,jdbcType=SMALLINT},#{item.serialNo,jdbcType=INTEGER},#{item.operatorId,jdbcType=CHAR}," +
-                    "#{item.charge1,jdbcType=DOUBLE},#{item.charge2,jdbcType=DOUBLE},#{item.charge3,jdbcType=DOUBLE},#{item.charge4,jdbcType=DOUBLE},#{item.charge5,jdbcType=DOUBLE}," +
-                    "#{item.charge6,jdbcType=DOUBLE},#{item.charge7,jdbcType=DOUBLE},#{item.charge8,jdbcType=DOUBLE},#{item.charge9,jdbcType=DOUBLE},#{item.charge10,jdbcType=DOUBLE}," +
-                    "#{item.charge11,jdbcType=DOUBLE},#{item.charge12,jdbcType=DOUBLE},#{item.charge13,jdbcType=DOUBLE},#{item.charge14,jdbcType=DOUBLE},#{item.charge15,jdbcType=DOUBLE}," +
-                    "#{item.charge16,jdbcType=DOUBLE},#{item.charge17,jdbcType=DOUBLE},#{item.charge18,jdbcType=DOUBLE},#{item.charge19,jdbcType=DOUBLE},#{item.charge20,jdbcType=DOUBLE}," +
-                    "#{item.payMark,jdbcType=CHAR},#{item.totalCharge,jdbcType=DOUBLE},#{item.chargeDate,jdbcType=TIMESTAMP},#{item.receiptBill,jdbcType=CHAR},#{item.receiptSn,jdbcType=INTEGER}," +
+                    "cast(#{item.charge1,jdbcType=DECIMAL} as decimal(14,2)),cast(#{item.charge2,jdbcType=DECIMAL} as decimal(14,2)),cast(#{item.charge3,jdbcType=DECIMAL} as decimal(14,2)),cast(#{item.charge4,jdbcType=DECIMAL} as decimal(14,2)),cast(#{item.charge5,jdbcType=DECIMAL} as decimal(14,2))," +
+                    "cast(#{item.charge6,jdbcType=DECIMAL} as decimal(14,2)),cast(#{item.charge7,jdbcType=DECIMAL} as decimal(14,2)),cast(#{item.charge8,jdbcType=DECIMAL} as decimal(14,2)),cast(#{item.charge9,jdbcType=DECIMAL} as decimal(14,2)),cast(#{item.charge10,jdbcType=DECIMAL} as decimal(14,2))," +
+                    "cast(#{item.charge11,jdbcType=DECIMAL} as decimal(14,2)),cast(#{item.charge12,jdbcType=DECIMAL} as decimal(14,2)),cast(#{item.charge13,jdbcType=DECIMAL} as decimal(14,2)),cast(#{item.charge14,jdbcType=DECIMAL} as decimal(14,2)),cast(#{item.charge15,jdbcType=DECIMAL} as decimal(14,2))," +
+                    "cast(#{item.charge16,jdbcType=DECIMAL} as decimal(14,2)),cast(#{item.charge17,jdbcType=DECIMAL} as decimal(14,2)),cast(#{item.charge18,jdbcType=DECIMAL} as decimal(14,2)),cast(#{item.charge19,jdbcType=DECIMAL} as decimal(14,2)),cast(#{item.charge20,jdbcType=DECIMAL} as decimal(14,2))," +
+                    "#{item.payMark,jdbcType=CHAR},cast(#{item.totalCharge,jdbcType=DECIMAL} as decimal(14,2)),#{item.chargeDate,jdbcType=TIMESTAMP},#{item.receiptBill,jdbcType=CHAR},#{item.receiptSn,jdbcType=INTEGER}," +
                     "#{item.dcountDate,jdbcType=TIMESTAMP},#{item.windowsNo,jdbcType=CHAR},#{item.dcountNo,jdbcType=INTEGER},#{item.serialYb,jdbcType=INTEGER},#{item.fpFlag,jdbcType=CHAR}," +
                     "#{item.responceType,jdbcType=CHAR},#{item.chequeType,jdbcType=CHAR},#{item.chequeNo,jdbcType=VARCHAR},#{item.tfFlag,jdbcType=CHAR},#{item.deptNo,jdbcType=VARCHAR}," +
                     "#{item.chargeDcountDate,jdbcType=TIMESTAMP},#{item.chargeDcountNo,jdbcType=INTEGER},#{item.payId,jdbcType=CHAR},#{item.obsoleteId,jdbcType=VARCHAR}," +

+ 146 - 0
src/main/java/cn/hnthyy/thmz/service/impl/thmz/TransactionServiceImpl.java

@@ -0,0 +1,146 @@
+package cn.hnthyy.thmz.service.impl.thmz;
+
+import cn.hnthyy.thmz.Utils.HttpUtil;
+import cn.hnthyy.thmz.common.Constants;
+import cn.hnthyy.thmz.entity.MzException;
+import cn.hnthyy.thmz.service.thmz.TransactionService;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
+import org.json.JSONObject;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Service;
+
+import java.util.HashMap;
+import java.util.Map;
+
+@Slf4j
+@Service
+public class TransactionServiceImpl implements TransactionService {
+    @Value("${misPossUrl}")
+    private String misPossUrl;
+
+    @Override
+    public JSONObject sign(String routerCode) {
+        log.info("调用智能POS签到接口,路由识别码={}", routerCode);
+        String realUrl = misPossUrl + "sign";
+        Map<String, Object> map = new HashMap<>();
+        //Map 对象存入
+        map.put("routerCode", routerCode);
+        //Map 转成  JSONObject 字符串
+        JSONObject jsonObj = new JSONObject(map);
+        try {
+            String result = HttpUtil.sendHttpPost(realUrl, jsonObj.toString(), 120000);
+            if (StringUtils.isBlank(result)) {
+                return null;
+            }
+            return new JSONObject(result);
+        } catch (Exception e) {
+            log.info("调用智能POS签到接口,路由识别码={}", routerCode);
+            e.printStackTrace();
+            return null;
+        }
+    }
+
+    @Override
+    public JSONObject balance(String routerCode) {
+        log.info("调用智能POS查余接口,路由识别码={}", routerCode);
+        String realUrl = misPossUrl + "balance";
+        Map<String, Object> map = new HashMap<>();
+        //Map 对象存入
+        map.put("routerCode", routerCode);
+        //Map 转成  JSONObject 字符串
+        JSONObject jsonObj = new JSONObject(map);
+        try {
+            String result = HttpUtil.sendHttpPost(realUrl, jsonObj.toString(), 120000);
+            if (StringUtils.isBlank(result)) {
+                return null;
+            }
+            return new JSONObject(result);
+        } catch (Exception e) {
+            log.info("调用智能POS查余接口,路由识别码={}", routerCode);
+            e.printStackTrace();
+            return null;
+        }
+    }
+
+    @Override
+    public JSONObject consume(String routerCode, double amt, String lsOrderNo, String inputRemarkInfo, String chequeType) throws MzException {
+        String realUrl;
+        String type;
+        Map<String, Object> map = new HashMap<>();
+        if(Constants.YLK.equals(chequeType)){
+            type= "消费";
+            realUrl = misPossUrl + "consume";
+        }else if(Constants.WX.equals(chequeType) || Constants.ZFB.equals(chequeType)){
+            type= "聚合支付";
+            realUrl = misPossUrl + "onlinePayment";
+            map.put("qrCodeParam", "");
+        }else {
+            throw new MzException("当前支付方式无法发起智能银行收款!");
+        }
+        log.info("调用智能POS{}接口,路由识别码={}", type, routerCode);
+        //Map 对象存入
+        map.put("routerCode", routerCode);
+        map.put("amt", amt);
+        map.put("isNeedPrintReceipt", false);
+        map.put("counterNo", "");
+        map.put("orderNo", "");
+        map.put("orderNo", "");
+        map.put("lsOrderNo", lsOrderNo);
+        map.put("inputRemarkInfo", inputRemarkInfo==null?"":inputRemarkInfo);
+        map.put("remarkSize", 0);
+        //Map 转成  JSONObject 字符串
+        JSONObject jsonObj = new JSONObject(map);
+        try {
+            String result = HttpUtil.sendHttpPost(realUrl, jsonObj.toString(), 120000);
+            if (StringUtils.isBlank(result)) {
+                return null;
+            }
+            return new JSONObject(result);
+        } catch (Exception e) {
+            log.info("调用智能POS{}接口,路由识别码={}",type, routerCode);
+            e.printStackTrace();
+            return null;
+        }
+    }
+
+    @Override
+    public JSONObject refund(String routerCode, double amt, String lsOrderNo, String inputRemarkInfo, String chequeType, String orgRefNo, String transDate) throws MzException {
+        String realUrl;
+        String type;
+        Map<String, Object> map = new HashMap<>();
+        if(Constants.YLK.equals(chequeType)){
+            type= "退货";
+            realUrl = misPossUrl + "refund";
+            map.put("orgRefNo", orgRefNo);
+            map.put("transDate", transDate);
+        }else if(Constants.WX.equals(chequeType) || Constants.ZFB.equals(chequeType)){
+            type= "聚合支付退款";
+            realUrl = misPossUrl + "onlineRefund";
+            map.put("qrCodeParam", "");
+        }else {
+            throw new MzException("当前支付方式无法发起智能银行退款!");
+        }
+        log.info("调用智能POS{}接口,路由识别码={}", type, routerCode);
+        //Map 对象存入
+        map.put("routerCode", routerCode);
+        map.put("amt", amt);
+        map.put("isNeedPrintReceipt", false);
+        map.put("lsOrderNo", lsOrderNo);
+        map.put("inputRemarkInfo", inputRemarkInfo==null?"":inputRemarkInfo);
+        map.put("remarkSize", 0);
+        //Map 转成  JSONObject 字符串
+        JSONObject jsonObj = new JSONObject(map);
+        try {
+            String result = HttpUtil.sendHttpPost(realUrl, jsonObj.toString(), 120000);
+            if (StringUtils.isBlank(result)) {
+                return null;
+            }
+            return new JSONObject(result);
+        } catch (Exception e) {
+            log.info("调用智能POS{}接口,路由识别码={}",type, routerCode);
+            e.printStackTrace();
+            return null;
+        }
+    }
+}

+ 50 - 0
src/main/java/cn/hnthyy/thmz/service/thmz/TransactionService.java

@@ -0,0 +1,50 @@
+package cn.hnthyy.thmz.service.thmz;
+
+import cn.hnthyy.thmz.entity.MzException;
+import org.json.JSONObject;
+
+
+/**
+ * 智能银行接口
+ */
+public interface TransactionService {
+    /**
+     * 签到
+     * @param routerCode 路由识别码,用于区分哪台智能POS机,需要预先维护
+     * @return String resCode 返回码,00成功,其它失败 String resMsg 交易处理结果信息
+     */
+    JSONObject sign(String routerCode);
+
+    /**
+     * 查余
+     * @param routerCode 路由识别码,用于区分哪台智能POS机,需要预先维护
+     * @return String resCode 返回码,00成功,其它失败 String resMsg 交易处理结果信息
+     */
+    JSONObject balance(String routerCode);
+
+    /**
+     * 消费
+     * @param routerCode 路由识别码,用于区分哪台智能POS机,需要预先维护
+     * @param amt 交易金额
+     * @param lsOrderNo 唯一订单号(第三方订单号)
+     * @param inputRemarkInfo 第三方传入的需要打印的备注信息
+     * @param chequeType 前台选择的支付方式
+     * @return String resCode 返回码,00成功,其它失败 String resMsg 交易处理结果信息
+     */
+    JSONObject consume(String routerCode,double amt,String lsOrderNo,String inputRemarkInfo,String chequeType) throws MzException;
+
+    /**
+     * 退货
+     * @param routerCode 路由识别码,用于区分哪台智能POS机,需要预先维护
+     * @param amt 交易金额
+     * @param lsOrderNo 唯一订单号(第三方订单号)
+     * @param inputRemarkInfo 第三方传入的需要打印的备注信息
+     * @param chequeType 前台选择的支付方式
+     * @param orgRefNo 原主机参考号 微信和支付宝退费的时候传null
+     * @param transDate 交易日期(MMDD) 微信和支付宝退费的时候传null
+     * @return String resCode 返回码,00成功,其它失败 String resMsg 交易处理结果信息
+     */
+    JSONObject refund(String routerCode,double amt,String lsOrderNo,String inputRemarkInfo, String chequeType, String orgRefNo, String transDate) throws MzException;
+
+
+}

+ 3 - 0
src/main/resources/application-dev.yml

@@ -162,3 +162,6 @@ webSocketServiceUrl: "http://172.16.30.22:9000/api/v1/sendMessage"
 
 #合理用药分析接口
 rationalUseOfMedicineUrl: "http://172.16.32.121:8016/Audit.ashx"
+
+#智能银行接口地址
+misPossUrl:  "http://172.16.32.201:8080/ccbmis/transaction/"

+ 4 - 1
src/main/resources/application-prod.yml

@@ -159,4 +159,7 @@ webSocketPrescriptionHost: "ws://172.16.32.161:9000/"
 webSocketServiceUrl: "http://172.16.32.161:9000/api/v1/sendMessage"
 
 #合理用药分析接口
-rationalUseOfMedicineUrl: "http://172.16.32.121:8016/Audit.ashx"
+rationalUseOfMedicineUrl: "http://172.16.32.121:8016/Audit.ashx"
+
+#智能银行接口地址
+misPossUrl: "http://172.16.32.201:8080/ccbmis/transaction/"

+ 1 - 1
src/main/resources/templates/mz/clinic.html

@@ -448,7 +448,7 @@
                     </div>
                     <!--<div class="item form-group">-->
                     <!--<label class="my_label"></label>-->
-                    <!--<div class="form-group has-feedback" style="float: right;width: calc(100% - 65px);">-->
+                    <!--<div class="form-group has-feedback" style="float: right;width:calc (100% - 65px);">-->
                     <!--<input type="text" class="form-control has-feedback-left" id="healthCheckUp" style="display: block">-->
                     <!--</div>-->
                     <!--</div>-->