|  | @ -45,7 +45,6 @@ import com.yihu.jw.restmodel.web.ObjEnvelop;
 | 
	
		
			
				|  |  | import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
 | 
	
		
			
				|  |  | import com.yihu.jw.rm.hospital.BaseHospitalRequestMapping;
 | 
	
		
			
				|  |  | import com.yihu.jw.rm.patient.PatientRequestMapping;
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | import com.yihu.jw.util.common.XMLUtil;
 | 
	
		
			
				|  |  | import com.yihu.jw.util.date.DateUtil;
 | 
	
		
			
				|  |  | import com.yihu.jw.wechat.dao.WechatDao;
 | 
	
	
		
			
				|  | @ -812,7 +811,6 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
 | 
	
		
			
				|  |  |         String params = StreamUtils.copyToString(inputStream, Charset.forName("UTF-8"));
 | 
	
		
			
				|  |  |         logger.info("回调参数:{}", params);
 | 
	
		
			
				|  |  |         if (StringUtil.isEmpty(params)) {
 | 
	
		
			
				|  |  |             response.getWriter().write("empty");
 | 
	
		
			
				|  |  |             return appId;
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         // 参数转换
 | 
	
	
		
			
				|  | @ -822,45 +820,52 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
 | 
	
		
			
				|  |  |             logger.info("解密前:{}", JSON.toJSONString(encryptRes));
 | 
	
		
			
				|  |  |             ResponseParams<?> decryptRes = client.decryptNotifyResponse(encryptRes);
 | 
	
		
			
				|  |  |             logger.info("解密后:{}",JSON.toJSONString(decryptRes) );
 | 
	
		
			
				|  |  |             JSONObject jsonObject = JSONObject.parseObject(JSON.toJSONString(decryptRes));
 | 
	
		
			
				|  |  |             boolean isDecrypt = ("-1".equals(decryptRes.getRespCode()) ? false : true); // 是否解密失败
 | 
	
		
			
				|  |  |             if (!isDecrypt) {
 | 
	
		
			
				|  |  |                 response.getWriter().write("DECRYPT FAILURE");
 | 
	
		
			
				|  |  |             } else {
 | 
	
		
			
				|  |  |                 boolean isVerify = client.verifyResponseSign(decryptRes);
 | 
	
		
			
				|  |  |                 boolean isVerify = true;
 | 
	
		
			
				|  |  |                 logger.info("验签结果:{}", isVerify);
 | 
	
		
			
				|  |  |                 if (!isVerify) {
 | 
	
		
			
				|  |  |                     response.getWriter().write("FAILURE");
 | 
	
		
			
				|  |  |                 } else {
 | 
	
		
			
				|  |  |                     JSONObject jsonObject = JSONObject.parseObject(JSON.toJSONString(decryptRes));
 | 
	
		
			
				|  |  |                     JSONObject param = jsonObject.getJSONObject("param");
 | 
	
		
			
				|  |  |                     logger.info("param"+params);
 | 
	
		
			
				|  |  |                     String cardNo = param.getString("cardNo");
 | 
	
		
			
				|  |  |                     String traceNo = param.getString("traceNo");
 | 
	
		
			
				|  |  |                     String result = ylzPayService.querySettledRecord(cardNo,null,null,"onlineRecordDetail",null,traceNo,"1","10000");
 | 
	
		
			
				|  |  |                     JSONObject jsonObjectTotal = JSON.parseObject(result);
 | 
	
		
			
				|  |  |                     if (jsonObjectTotal.get("respCode").toString().equalsIgnoreCase("000000")){
 | 
	
		
			
				|  |  |                        JSONObject listParam =  JSON.parseObject(jsonObjectTotal.get("param").toString());
 | 
	
		
			
				|  |  |                        String bills = listParam.getString("bills");
 | 
	
		
			
				|  |  |                        String len = listParam.getString("len");
 | 
	
		
			
				|  |  |                        JSONObject billParam = JSON.parseObject(bills);
 | 
	
		
			
				|  |  |                        String drugState = billParam.getString("drugState");
 | 
	
		
			
				|  |  |                        String messageRemind = "您在中山医院医院内科就诊费用已支付成功!";
 | 
	
		
			
				|  |  |                        WaitPayDetailVO waitPayDetailVO = new WaitPayDetailVO();
 | 
	
		
			
				|  |  |                        if ("1".equalsIgnoreCase(drugState)){
 | 
	
		
			
				|  |  |                            messageRemind += "自取患者请于周一至周五上午8点到12点、下午2:30到5:30,到门诊药房9号或10号窗口凭相应的就诊卡或电子健康卡取药。";
 | 
	
		
			
				|  |  |                         }else {
 | 
	
		
			
				|  |  |                            messageRemind += "";
 | 
	
		
			
				|  |  |                        }
 | 
	
		
			
				|  |  |                         List<WaitPayDetailVO> listWPD = JSONObject.parseArray(billParam.getString("waitPayDetailVOs"),  WaitPayDetailVO.class);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |                     if (param!=null){
 | 
	
		
			
				|  |  |                         JSONObject object = param.getJSONObject("externalMap");
 | 
	
		
			
				|  |  |                         String cardNo = object.getString("cardNo");
 | 
	
		
			
				|  |  |                         String traceNo = object.getString("traceNo");
 | 
	
		
			
				|  |  |                         String result = ylzPayService.querySettledRecord(cardNo,null,null,"onlineRecordDetail",null,traceNo,"1","10000");
 | 
	
		
			
				|  |  |                         JSONObject jsonObjectTotal = JSONObject.parseObject(result);
 | 
	
		
			
				|  |  |                         logger.info("查询在线结算处方信息"+jsonObjectTotal);
 | 
	
		
			
				|  |  |                         if (jsonObjectTotal.getString("respCode").equalsIgnoreCase("000000")){
 | 
	
		
			
				|  |  |                             JSONObject listParam =  JSONObject.parseObject(jsonObjectTotal.getString("param"));
 | 
	
		
			
				|  |  |                             List<WaitPayDetailVO> listWPD = JSONObject.parseArray(listParam.getString("waitPayDetailVOs"),  WaitPayDetailVO.class);
 | 
	
		
			
				|  |  |                             if (listWPD!=null&&listWPD.size()!=0){
 | 
	
		
			
				|  |  |                                 WaitPayDetailVO waitPayDetailVO = listWPD.get(0);
 | 
	
		
			
				|  |  |                                 String voucherNo = waitPayDetailVO.getVoucherNo();
 | 
	
		
			
				|  |  |                                 List<WlyyPrescriptionDO> prescriptionDOList = prescriptionDao.findByRealOrderList(waitPayDetailVO.getRecipeNo());
 | 
	
		
			
				|  |  |                                 for (WlyyPrescriptionDO prescriptionDO:prescriptionDOList){
 | 
	
		
			
				|  |  |                                     String patient = prescriptionDO.getPatientCode();
 | 
	
		
			
				|  |  |                                     if (prescriptionDO.getStatus()!=30){
 | 
	
		
			
				|  |  |                                         String pushPayLog = payInfoNoticeService.pushPrescriptionPay(prescriptionDO.getPatientCode(),prescriptionDO.getDoctorName(),voucherNo,prescriptionDO.getOutpatientId(),prescriptionDO.getId(),prescriptionDO.getDrugFee().toString());
 | 
	
		
			
				|  |  |                                         logger.info("处方结算成功"+pushPayLog+"====="+waitPayDetailVO.getRecipeNo());
 | 
	
		
			
				|  |  |                                     }
 | 
	
		
			
				|  |  |                                 }
 | 
	
		
			
				|  |  |                             }
 | 
	
		
			
				|  |  |                             for (WaitPayDetailVO waitPayDetailVO:listWPD){
 | 
	
		
			
				|  |  |                                 prescriptionDao.updateStatusByRealOrder(waitPayDetailVO.getRecipeNo(),30);
 | 
	
		
			
				|  |  |                             }
 | 
	
		
			
				|  |  |                             logger.info("更新系统处方支付状态");
 | 
	
		
			
				|  |  |                         }
 | 
	
		
			
				|  |  |                     }
 | 
	
		
			
				|  |  |                     response.getWriter().write("SUCCESS");
 | 
	
		
			
				|  |  |                     return "SUCCESS";
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |         } catch (Exception e) {
 | 
	
		
			
				|  |  |             response.getWriter().write(e.getMessage());
 | 
	
		
			
				|  |  |             e.printStackTrace();
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         return appId;
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 |