| 
					
				 | 
			
			
				@ -71,7 +71,6 @@ public class PatientPrescriptionPayService extends BaseService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    //公共配置文件 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    Properties systemConf = SystemConf.getInstance().getSystemProperties(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private static final Logger LOGGER = LoggerFactory.getLogger(OnePayController.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    //    各环境对应配置 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @Value("${server.server_url}") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private String serverUrl; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -266,6 +265,7 @@ public class PatientPrescriptionPayService extends BaseService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String error = ""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String responses = ""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        response.setContentType("text/html;charset=utf-8"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        JSONObject msbody = new JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        try { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //		如:查询显示订单信息 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -297,6 +297,27 @@ public class PatientPrescriptionPayService extends BaseService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            org.json.JSONObject param = new org.json.JSONObject(result); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String requestParam = param.getString("responseContent"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            org.json.JSONObject responseContents = new org.json.JSONObject(requestParam);//医保结构体 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//            构建请求结构体 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            msbody.put("appId",appId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            msbody.put("billNo",billNo); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            msbody.put("cardNo",cardNo); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            msbody.put("channel",channel); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            msbody.put("chargeNo",chargeNo); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            msbody.put("chargeTime",chargeTime); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            msbody.put("idNo",idNo); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            msbody.put("idType",idType); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            msbody.put("insuranceAmount",insuranceAmount); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            msbody.put("outChargeNo",outChargeNo); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            msbody.put("outChargeTime",outChargeTime); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            msbody.put("selfPayAmount",selfPayAmount); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            msbody.put("sign",sign); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            msbody.put("signType",signType); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            msbody.put("timestamp",timestamp); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            msbody.put("totalAmount",totalAmount); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            msbody.put("tradeStatus",tradeStatus); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            msbody.put("userId",userId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            msbody.put("userName",userName); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            msbody.put("responseContent",responseContents); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            PrescriptionPay prescriptionPay = payDao.findByCode(outChargeNo); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (responseContents != null) { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -381,10 +402,10 @@ public class PatientPrescriptionPayService extends BaseService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            response.getWriter().write(e.getMessage()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //                记录log日志到数据库 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        LOGGER.info("api - "+config.getRecipeReturnUrl()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        LOGGER.info("request - "+request.toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        LOGGER.info("responses - "+responses); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        LOGGER.info("error - "+error); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        logger.info("api - "+config.getRecipeReturnUrl()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        logger.info("request - "+request.toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        logger.info("responses - "+responses); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        logger.info("error - "+error); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        ZyPushLog log = new ZyPushLog(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        log.setCreateTime(new Date()); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -392,14 +413,14 @@ public class PatientPrescriptionPayService extends BaseService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        log.setContent("长处方支付页面跳转"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        log.setError(error); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        log.setMethod("POST"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        log.setRequest(request.toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        log.setRequest(msbody.toJSONString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        log.setResponse(responses); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        log.setRetryTimes(0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        log.setStatus(Integer.toString(flag)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        log.setType("3"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        zyPushLogDao.save(log); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //记录支付log日志到数据库  支付 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        logService.saveHttpLog(isSuccess, config.getRecipeReturnUrl(), "长处方支付页面跳转", "POST", null, "", responses, error, logService.onepayType); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        logService.saveHttpLog(isSuccess, config.getRecipeReturnUrl(), "长处方支付页面跳转", "POST", null, msbody.toJSONString(), responses, error, logService.onepayType); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        payLogService.addLog(prescription, PrescriptionLog.PrescriptionLogType.pay.getValue(), flag, 1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return resultMap; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -426,7 +447,7 @@ public class PatientPrescriptionPayService extends BaseService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        HospitalMapping hospital = mappingDao.findByAppId(appId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String appSecret = hospital.getAppSecret(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        LOGGER.info("回调参数:{}", params); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        logger.info("回调参数:{}", params); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtil.isEmpty(params)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            response.getWriter().write("empty"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return null; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -436,20 +457,20 @@ public class PatientPrescriptionPayService extends BaseService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        OnepayDefaultClient client = new OnepayDefaultClient("", appId, appSecret, encryptRes.getSignType(), encryptRes.getEncryptType()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        try { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            LOGGER.info("解密前:{}", JSON.toJSONString(encryptRes)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            logger.info("解密前:{}", JSON.toJSONString(encryptRes)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            ResponseParams<?> decryptRes = client.decryptNotifyResponse(encryptRes); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            LOGGER.info("解密后:{}", JSON.toJSONString(decryptRes)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            logger.info("解密后:{}", JSON.toJSONString(decryptRes)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            boolean isDecrypt = ("-1".equals(decryptRes.getRespCode()) ? false : true); // 是否解密失败 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (!isDecrypt) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                response.getWriter().write("DECRYPT FAILURE"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                boolean isVerify = client.verifyResponseSign(decryptRes); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                LOGGER.info("验签结果:{}", isVerify); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                logger.info("验签结果:{}", isVerify); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if (!isVerify) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    response.getWriter().write("FAILURE"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//					业务逻辑代码 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    LOGGER.debug(" ====================================>     verify is true"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    logger.debug(" ====================================>     verify is true"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    flag = 1; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    isSuccess = true; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    responses = JSON.toJSONString(decryptRes); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -482,7 +503,7 @@ public class PatientPrescriptionPayService extends BaseService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    String idNo = requestParam.getString("idNo");//证件号码 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    String tradeStatus = requestParam.getString("tradeStatus");//交易状态 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    LOGGER.debug(" ====================================>     responseContent"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    logger.debug(" ====================================>     responseContent"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                    org.json.JSONObject responseContents = requestParam.getJSONObject("responseContent");//医保结构体 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    String contents = requestParam.getString("responseContent");//医保结构体 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    JSONObject responseContents = JSONObject.parseObject(contents); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -543,12 +564,12 @@ public class PatientPrescriptionPayService extends BaseService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    prescriptionPay.setHealthBalance(Integer.parseInt(healthBalance));//健康账户余额 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    String prescriptionCode = prescriptionPay.getPrescriptionCode(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    LOGGER.debug(" ====================================> prescriptionDao    findByCode"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    logger.debug(" ====================================> prescriptionDao    findByCode"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    prescription = prescriptionDao.findByCode(prescriptionCode); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    int sendType = prescription.getDispensaryType();//1 自取 2快递配送 3健管师配送 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    PrescriptionExpressage expressage = expressageDao.findByPrescriptionPay(prescriptionCode); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    if ("0".equals(tradeStatus) || "SUCCESS".equals(tradeStatus)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        LOGGER.debug(" ====================================> tradeStatus    00"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        logger.debug(" ====================================> tradeStatus    00"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        prescriptionPay.setTradeStatus("1");//交易状态 成功1 失败0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        prescription.setStatus(PrescriptionLog.PrescriptionLogStatus.pay_success.getValue());//续费状态 30支付成功 21支付失败 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        expressage.setDel(1);//快递信息状态 1可用 0删除 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -591,10 +612,10 @@ public class PatientPrescriptionPayService extends BaseService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            response.getWriter().write(e.getMessage()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //                记录log日志到数据库 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        LOGGER.info("api - "+config.getReceiveRecipeNotify()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        LOGGER.info("request - "+params); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        LOGGER.info("responses - "+responses); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        LOGGER.info("error - "+error); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        logger.info("api - "+config.getReceiveRecipeNotify()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        logger.info("request - "+params); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        logger.info("responses - "+responses); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        logger.info("error - "+error); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        ZyPushLog log = new ZyPushLog(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        log.setCreateTime(new Date()); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -647,8 +668,8 @@ public class PatientPrescriptionPayService extends BaseService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String appId = hos.getAppId(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String appSecret = hos.getAppSecret(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String signAddress = hospital.getAddress(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            LOGGER.info("APPID============> " + appId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            LOGGER.info("APPSECRET============> " + appSecret); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            logger.info("APPID============> " + appId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            logger.info("APPSECRET============> " + appSecret); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            Patient patient = patientDao.findByCode(people); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //微信登录患者信息 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -789,7 +810,7 @@ public class PatientPrescriptionPayService extends BaseService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            " WHERE t.admin_team_code=a.id AND d.code=a.leader_code " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            " AND t.patient=? "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    Map<String, Object> team = jdbcTemplate.queryForMap(sql, people); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    LOGGER.debug("================> get order amount!"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    logger.debug("================> get order amount!"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    String teamCode = team.get("teamCode").toString(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    String leaderCode = team.get("leaderCode").toString(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    String leaderName = team.get("leaderName").toString(); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -841,13 +862,13 @@ public class PatientPrescriptionPayService extends BaseService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//        try { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//             ***************************  测通流程 *************************************** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            LOGGER.info("================================>" + "Before get BindCard"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            logger.info("================================>" + "Before get BindCard"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            BindCard card = onePayService.ownerCard(openid); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String name = card.getAttachName(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String ssc = card.getAttachCardNo(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String idType = card.getAttachIdType(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String idNo = card.getAttachIdNo(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            LOGGER.info("================================>" + "after get BindCard"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            logger.info("================================>" + "after get BindCard"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//            验证续方人与绑卡人是否一致 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (!(payName.equals(name) && paySsc.equals(ssc) && payIdcard.equals(idNo))) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                resultMap.put("status", "-1"); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -872,7 +893,7 @@ public class PatientPrescriptionPayService extends BaseService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            requestParams.setSignType(signType); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            requestParams.setEncryptType(encryptType); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            requestParams.setTransType(config.getRecipeChargeType()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            LOGGER.info("================================>" + "Before params"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            logger.info("================================>" + "Before params"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //业务参数 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            JSONObject params = new JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -889,7 +910,7 @@ public class PatientPrescriptionPayService extends BaseService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            params.put("idType", idType); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            params.put("idNo", idNo); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            params.put("returnUrl", serverUrl + returnUrl);   //长处方页面跳转地址 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String notifyUrl = "patient/prescription/pay/receiveRecipeNotify"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String notifyUrl = "/third/pay/prescription/receiveRecipeNotify"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            params.put("notifyUrl", serverUrl + notifyUrl);//易联众新增服务器异步回调地址 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            params.put("channel", channel);  //微信医保支付 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            params.put("merchName", orgName);  //收款单位名称 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -900,7 +921,7 @@ public class PatientPrescriptionPayService extends BaseService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//            JSONObject jsonParams = prescriptionService.getPayInfo("D21085562", "3277903"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String visitNo = prescription.getVisitNo();//续方挂号号 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String recipeNo = prescription.getRecipeNo();//基位处方code(开方成功后返回) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            LOGGER.debug("======================> getPayInfo " + ssc + visitNo); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            logger.debug("======================> getPayInfo " + ssc + visitNo); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (visitNo == null || ssc == null || recipeNo==null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                resultMap.put("status", "-2"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                return resultMap; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -933,7 +954,7 @@ public class PatientPrescriptionPayService extends BaseService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            map.put("feeType", "06");//长处方结算 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            map.put("settleType", "01"); //诊间医保结算 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            params.put("requestContent", objectMapper.writeValueAsString(map));// 请求结构体 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            LOGGER.info("================================>" + "Before msBody"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            logger.info("================================>" + "Before msBody"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            requestParams.setParam(params); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            msgBody = JSON.toJSONString(requestParams); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -971,10 +992,10 @@ public class PatientPrescriptionPayService extends BaseService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            error = sw.toString(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //保存http日志 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        LOGGER.info("api - "+config.getRecipeChargeType()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        LOGGER.info("request - "+msgBody); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        LOGGER.info("responses - "+response); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        LOGGER.info("error - "+error); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        logger.info("api - "+config.getRecipeChargeType()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        logger.info("request - "+msgBody); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        logger.info("responses - "+response); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        logger.info("error - "+error); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        ZyPushLog log = new ZyPushLog(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        log.setCreateTime(new Date()); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -1047,12 +1068,91 @@ public class PatientPrescriptionPayService extends BaseService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (OnepayDefaultClient.isSuccessful(res)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                //业务处理******************* 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                只返回业务出参 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                result = JSON.toJavaObject(res.getParam(), Charge.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                flag = 1; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                result = JSON.toJSONString(res.getParam()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                 返回医保机构体 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                LOGGER.info("请求成功,返回参数: " + result); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//             新增保存数据 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                JSONObject request = JSON.parseObject(result); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                String tradeStatus = request.getString("tradeStatus");//交易状态 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                String chargeNo = request.getString("chargeNo");//支付平台流水号 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                String chargeTime = request.getString("chargeTime");//支付平台交易成功时间 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                String outChargeNo = request.getString("outChargeNo");//接入应用业务流水号 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                String outChargeTime = request.getString("outChargeTime");//接入应用时间 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				////                String medOrgNo = request.getString("medOrgNo");//医疗机构编号 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				////                String medOrgName = request.getString("medOrgName");//医疗机构名称 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                String billNo = request.getString("billNo");//待结算费用单据号 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                String cardNo = request.getString("cardNo");//医保卡号 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                String totalAmount = request.getString("totalAmount");//交易总金额 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                String insuranceAmount = request.getString("insuranceAmount");//医保支付金额 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                String selfPayAmount = request.getString("selfPayAmount");//自付金额 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                String userId = request.getString("userId");//用户openID 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                String userName = request.getString("userName");//用户名字 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                String idNo = request.getString("idNo");//证件号码 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                String idType = request.getString("idType");//证件类型 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				// 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				////                String appId = request.getString("appId"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				////                String channel = request.getString("channel");//支付方式 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				////                String sign = request.getString("sign"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				////                String signType = request.getString("signType"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				////                String timestamp = request.getString("timestamp"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				// 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                JSONObject responseContents = request.getJSONObject("responseContent");//医保结构体 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                PrescriptionPay prescriptionPay = payDao.findByCode(outChargeNo); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                if (responseContents != null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                    String miSettleNo = responseContents.getString("miSettleNo");//医保收费单据号 (医保签约号) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                    String miRegisterNo = responseContents.getString("miRegisterNo");//医保挂号 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                    String miCollectDate = responseContents.getString("miCollectDate");//收费日期 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                    String miCollectTime = responseContents.getString("miCollectTime");//收费时间 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                    String miCollectorName = responseContents.getString("miCollectorName");//收费人姓名 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                    String miTotalFee = responseContents.getString("miTotalFee");//本次报销总额 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                    String selfPay = responseContents.getString("selfPay");//个人现金支付 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                    String accountPay = responseContents.getString("accountPay");//个人账户支付 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                    String heathPay = responseContents.getString("heathPay");//健康账户支付 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                    String cadresPay = responseContents.getString("cadresPay");//公务员补助 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                    String fundPay = responseContents.getString("fundPay");//基金支付 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                    String healthCarePay = responseContents.getString("healthCarePay");//保健基金支付 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                    String commercePay = responseContents.getString("commercePay");//商业保险支付 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                    String familyPay = responseContents.getString("familyPay");//共济账户支付 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                    String civilPay = responseContents.getString("civilPay");//民政补助金额 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                    String civilZone = responseContents.getString("civilZone");//民政行政区号 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                    String bdrugPay = responseContents.getString("bdrugPay");//乙类支付金额 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                    String unlessAmount = responseContents.getString("unlessAmount");//非医保费用 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                    String exceedAmount = responseContents.getString("exceedAmount");//超封顶线金额 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                    String accountBalance = responseContents.getString("accountBalance");//个人账户余额 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                    String healthBalance = responseContents.getString("healthBalance");//健康账户余额 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				// 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                    prescriptionPay.setBillNo(billNo);//待结算费用单据号 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                    prescriptionPay.setChargeNo(chargeNo);//支付流水号 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                    prescriptionPay.setInsuranceAmount(Integer.parseInt(insuranceAmount));//医保支付金额 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                    prescriptionPay.setSelfPayAmount(Integer.parseInt(selfPayAmount));//自付金额 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                    prescriptionPay.setMiSettleNo(miSettleNo);//医保收费单据号 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                    prescriptionPay.setMiRegisterNo(miRegisterNo);//医保挂号 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                    SimpleDateFormat formatDate = new SimpleDateFormat("yyyyMMdd"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                    prescriptionPay.setMiCollectDate(formatDate.parse(miCollectDate));//收费日期 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                    SimpleDateFormat formatTime = new SimpleDateFormat("HHmm"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                    prescriptionPay.setMiCollectTime(formatTime.parse(miCollectTime));//收费时间 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                    prescriptionPay.setMiCollectorName(miCollectorName);//收费人姓名 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                    prescriptionPay.setMiTotalFee(Integer.parseInt(miTotalFee));//本次报销总额 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                    prescriptionPay.setSelfPay(Integer.parseInt(selfPay));//个人现金支付 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                    prescriptionPay.setAccountPay(Integer.parseInt(accountPay));//个人账户支付 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                    prescriptionPay.setHeathPay(Integer.parseInt(heathPay));//健康账户支付 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                    prescriptionPay.setCadresPay(Integer.parseInt(cadresPay));//公务员补助 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                    prescriptionPay.setFundPay(Integer.parseInt(fundPay));//基金支付 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                    prescriptionPay.setHealthCarePay(Integer.parseInt(healthCarePay));//保健基金支付 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                    prescriptionPay.setCommercePay(Integer.parseInt(commercePay));//商业保险支付 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                    prescriptionPay.setFamilyPay(Integer.parseInt(familyPay));//共济账户支付 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                    prescriptionPay.setCivilPay(Integer.parseInt(civilPay));//民政补助金额 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                    prescriptionPay.setCivilZone(civilZone);//民政行政区号 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                    prescriptionPay.setBdrugPay(Integer.parseInt(bdrugPay));//乙类支付金额 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                    prescriptionPay.setUnlessAmount(Integer.parseInt(unlessAmount));//非医保费用 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                    prescriptionPay.setExceedAmount(Integer.parseInt(exceedAmount));//超封顶线金额 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                    prescriptionPay.setAccountBalance(Integer.parseInt(accountBalance));//个人账户余额 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                    prescriptionPay.setHealthBalance(Integer.parseInt(healthBalance));//健康账户余额 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				// 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                    //        保存数据库更改记录 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                    payDao.save(prescriptionPay); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                logger.info("请求成功,返回参数: " + result); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                isSuccess = false; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                error = "请求失败,返回结果:" + res.getRespCode() + "," + res.getRespMsg(); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -1066,10 +1166,10 @@ public class PatientPrescriptionPayService extends BaseService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //type = 3易联众接口保存http日志 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        LOGGER.info("api - "+config.getChargeQueryType()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        LOGGER.info("request - "+msgBody); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        LOGGER.info("responses - "+response); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        LOGGER.info("error - "+error); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        logger.info("api - "+config.getChargeQueryType()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        logger.info("request - "+msgBody); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        logger.info("responses - "+response); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        logger.info("error - "+error); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        ZyPushLog log = new ZyPushLog(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        log.setCreateTime(new Date()); 
			 |