Browse Source

新增介休收费接口

刘韬 3 years ago
parent
commit
3ca99059f6

+ 4 - 4
PacsOnline_Wechat_Patient/src/main/java/com/zskk/controller/WeixinMsgController.java

@@ -39,7 +39,7 @@ public class WeixinMsgController extends MsgControllerAdapter {
 //					"演示系统将于2021年4月2-5日升级,如有疑问请联系客户经理,感谢您的支持");
 //
 			CustomServiceApi.sendText(inTextMsg.getFromUserName(),
-					"【声明】为保证客户数据隐私安全,数字影像示例涉及检查信息、用户信息、医疗机构信息等均已经过数据脱敏处理。\n通过以下途径了解更多或联系我们:\n官方网站:<a href=\"http://www.pacsonline.cn\">点击进入</a>\n咨询热线:010-53932350\n电子邮箱:company@pacsonline.cn\n您即将收到数字影像示例,请点击下方消息查看,谢谢您的使用!");
+					"【声明】为保证客户数据隐私安全,数字影像示例涉及检查信息、用户信息、医疗机构信息等均已经过数据脱敏处理。\n通过以下途径了解更多或联系我们:\n官方网站:<a href=\"http://www.pacsonline.cn\">点击进入</a>\n咨询热线:暂未开通\n电子邮箱:company@pacsonline.cn\n您即将收到数字影像示例,请点击下方消息查看,谢谢您的使用!");
 
 			String toUrlString = String.format(
 					"https://wechatclient3.pacsonline.cn/#/reportInfo/report?openid=%s&exam_id=%s&study_id=%s", "test",
@@ -68,7 +68,7 @@ public class WeixinMsgController extends MsgControllerAdapter {
 			renderNull();
 		} else {
 			OutTextMsg outMsgs = new OutTextMsg(inTextMsg);
-			outMsgs.setContent("欢迎关注!\n使用微信\"扫一扫\",扫描报告上的二维码,即可查看数字影像和报告\n如有疑问请拨打010-53932350");
+			outMsgs.setContent("欢迎关注!\n使用微信\"扫一扫\",扫描报告上的二维码,即可查看数字影像和报告");
 			render(outMsgs);
 		}
 	}
@@ -181,7 +181,7 @@ public class WeixinMsgController extends MsgControllerAdapter {
 					findUser.update();
 				}
 				CustomServiceApi.sendText(inQrCodeEvent.getFromUserName(),
-						"【声明】为保证客户数据隐私安全,数字影像示例涉及检查信息、用户信息、医疗机构信息等均已经过数据脱敏处理。\n通过以下途径了解更多或联系我们:\n官方网站:<a href=\"http://www.pacsonline.cn\">点击进入</a>\n咨询热线:010-53932350\n电子邮箱:company@pacsonline.cn\n您即将收到数字影像示例,请点击下方消息查看,谢谢您的使用!");
+						"【声明】为保证客户数据隐私安全,数字影像示例涉及检查信息、用户信息、医疗机构信息等均已经过数据脱敏处理。\n通过以下途径了解更多或联系我们:\n官方网站:<a href=\"http://www.pacsonline.cn\">点击进入</a>\n咨询热线:暂未开通\n电子邮箱:company@pacsonline.cn\n您即将收到数字影像示例,请点击下方消息查看,谢谢您的使用!");
 
 				String toUrlString = String.format(
 						"https://wechatclient3.pacsonline.cn/#/reportInfo/report?openid=%s&exam_id=%s&study_id=%s",
@@ -265,7 +265,7 @@ public class WeixinMsgController extends MsgControllerAdapter {
 //					rid);
 			if (arr[1].equals("DEMOCT")) {
 				CustomServiceApi.sendText(inQrCodeEvent.getFromUserName(),
-						"【声明】为保证客户数据隐私安全,数字影像示例涉及检查信息、用户信息、医疗机构信息等均已经过数据脱敏处理。\n通过以下途径了解更多或联系我们:\n官方网站:<a href=\"http://www.pacsonline.cn\">点击进入</a>\n咨询热线:010-53932350\n电子邮箱:company@pacsonline.cn\n您即将收到数字影像示例,请点击下方消息查看,谢谢您的使用!");
+						"【声明】为保证客户数据隐私安全,数字影像示例涉及检查信息、用户信息、医疗机构信息等均已经过数据脱敏处理。\n通过以下途径了解更多或联系我们:\n官方网站:<a href=\"http://www.pacsonline.cn\">点击进入</a>\n咨询热线:暂未开通\n电子邮箱:company@pacsonline.cn\n您即将收到数字影像示例,请点击下方消息查看,谢谢您的使用!");
 
 				String toUrlString = String.format(
 						"https://wechatclient3.pacsonline.cn/#/reportInfo/report?openid=%s&exam_id=%s&study_id=%s",

+ 95 - 1
PacsOnline_Wechat_Patient/src/main/java/com/zskk/controller/WeixinPayController.java

@@ -24,12 +24,17 @@ public class WeixinPayController extends Controller {
     private static String partner = "1503643261";
     private static String paternerKey = "9759a66938e8411ad5889e2b5b394d94";
     private static String notify_url = "https://wechat.pacsonline.cn/wx_patient/pay/pay_notify";
+    private static String partner_jx = "1615037878";
+    private static String paternerKey_jx = "9759a66938e8411ad5889e2b5b394d94";
+
+
 
     /**
      * 公众号支付js-sdk
      */
     public void index() {
-		String out_trade_no = this.getPara("out_trade_no");
+		String institution_id = this.getPara("institution_id");
+		if (institution_id == null || !institution_id.equals("03060002")) {String out_trade_no = this.getPara("out_trade_no");
 		if (out_trade_no == null) {
 			renderText("need out_trade_no");
 		}
@@ -115,6 +120,95 @@ public class WeixinPayController extends Controller {
         System.out.println(jsonStr);
 //        renderJson("{\"code\":0}");
         renderText(jsonStr);
+		}else if (institution_id.equals("03060002")) {
+			String out_trade_no = this.getPara("out_trade_no");
+			if (out_trade_no == null) {
+				renderText("need out_trade_no");
+			}
+//			String appId = this.getPara("appId");
+//			if (appId == null) {
+//				renderText("need appId");
+//			}
+			String openid = this.getPara("openid");
+			if (openid == null) {
+				renderText("need openid");
+			}
+			String body = this.getPara("body");
+			if (body == null) {
+				renderText("need body");
+			}
+			String total_fee = this.getPara("total_fee");
+			if (total_fee == null) {
+				renderText("need total_fee");
+			}
+			String notify_url = this.getPara("notify_url");
+			if (notify_url == null) {
+				renderText("need notify_url");
+			}
+	        
+			ApiConfigKit.setThreadLocalAppId(appid);
+
+	        // 统一下单文档地址:https://pay.weixin.qq.com/wiki/doc/api/jsapi.php?chapter=9_1
+
+	        Map<String, String> params = new HashMap<String, String>();
+	        params.put("appid", appid);
+	        params.put("mch_id", partner_jx);
+	        params.put("body", body);
+	        params.put("out_trade_no", out_trade_no);
+	        params.put("total_fee", total_fee);
+
+	        String ip = IpKit.getRealIp(getRequest());
+	        if (StrKit.isBlank(ip)) {
+	            ip = "127.0.0.1";
+	        }
+	        if (ip.contains(",")) {
+	            ip = ip.split(",")[0];
+	        }
+
+	        params.put("spbill_create_ip", ip);
+	        params.put("trade_type", TradeType.JSAPI.name());
+	        params.put("nonce_str", System.currentTimeMillis() / 1000 + "");
+	        params.put("notify_url", notify_url);
+	        params.put("openid", openid);
+
+	        String sign = PaymentKit.createSign(params, paternerKey_jx);
+	        params.put("sign", sign);
+	        String xmlResult = PaymentApi.pushOrder(params);
+
+	        System.out.println(xmlResult);
+
+	        Map<String, String> result = PaymentKit.xmlToMap(xmlResult);
+
+	        String return_code = result.get("return_code");
+	        String return_msg = result.get("return_msg");
+	        if (StrKit.isBlank(return_code) || !"SUCCESS".equals(return_code)) {
+	            renderText(xmlResult);
+	            return;
+	        }
+	        String result_code = result.get("result_code");
+	        if (StrKit.isBlank(result_code) || !"SUCCESS".equals(result_code)) {
+	            renderText(xmlResult);
+	            return;
+	        }
+	        // 以下字段在return_code 和result_code都为SUCCESS的时候有返回
+	        String prepay_id = result.get("prepay_id");
+
+	        Map<String, String> packageParams = new HashMap<String, String>();
+	        packageParams.put("appId", appid);
+	        packageParams.put("timeStamp", System.currentTimeMillis() / 1000 + "");
+	        packageParams.put("nonceStr", System.currentTimeMillis() + "");
+	        packageParams.put("package", "prepay_id=" + prepay_id);
+	        packageParams.put("signType", "MD5");
+	        String packageSign = PaymentKit.createSign(packageParams, paternerKey_jx);
+	        packageParams.put("paySign", packageSign);
+
+	        String jsonStr = JsonUtils.toJson(packageParams);
+	        setAttr("json", jsonStr);
+	        System.out.println(jsonStr);
+//	        renderJson("{\"code\":0}");
+	        renderText(jsonStr);
+		}
+		
     }
 
     /**