| 
					
				 | 
			
			
				@ -4404,7 +4404,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                newConfig.setFirst(config.getFirst().replace("key1", outpatientDO.getConsumerName())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                newConfig.setKeyword1( "处方支付"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                newConfig.setKeyword2(outpatientDO.getHospitalName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                newConfig.setKeyword3( outpatientDO.getDoctorName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                newConfig.setKeyword3(outpatientDO.getDoctorName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                //发起微信消息模板推送 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                newConfig.setUrl(newConfig.getUrl() + "" + outpatientDO.getId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                logger.info("眼科微信消息模板推送 处方支付提醒开始"); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -10711,6 +10711,8 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //同步眼科医院 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            logger.info("开始同步眼科医院"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            ykyyEntranceService.saveKsjc(baseNatAppointmentDO,demoFlag); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //预约成功后发送支付模板消息 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sendYktemplateMessage(baseNatAppointmentDO.getId(),false); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            logger.info("结束同步眼科医院"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            returnMap.put("msg","预约成功"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            returnMap.put("status","200"); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -10729,7 +10731,6 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (!StringUtils.isNoneBlank(baseNatAppointmentDO.getRealOrder())){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            throw new Exception("核酸项目不存在"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        logger.info("模板消息推送标识pushFlag"+pushFlag); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (!StringUtils.isNoneBlank(pushFlag)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String recipeTime = DateUtil.dateToStr(new Date(), "yyyyMMddHHmmss"); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -10798,9 +10799,90 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                logger.info("支付宝模板消息"+reponse); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         return "发送成功!"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public String sendYktemplateMessage(Integer id,boolean isPayed)  { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        BaseNatAppointmentDO baseNatAppointmentDO = baseNatAppointmentDao.findOne(id); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (baseNatAppointmentDO==null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return "核酸项目不存在,发送失败"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<BasePatientWechatDo> ps = new ArrayList<BasePatientWechatDo>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        BasePatientDO patientDO = basePatientDao.findById(baseNatAppointmentDO.getPatientId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String userName = ""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (patientDO != null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            userName = patientDO.getName(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNotEmpty(baseNatAppointmentDO.getPatientId())){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            ps = basePatientWechatDao.findByWechatIdAndPatientId(wechatId, baseNatAppointmentDO.getPatientId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (ps.isEmpty()) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            logger.info("该用户没有openid,无法推送模版消息,用户ID:" + baseNatAppointmentDO.getPatientId() + "wechatId:" + wechatId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Map<String,Object> map = ykyyEntranceService.findYkDoctor(baseNatAppointmentDO.getHospitalFlag()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        WxAccessTokenDO wxAccessTokenDO = wxAccessTokenService.getWxAccessTokenById(wechatId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        for (BasePatientWechatDo one : ps) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            try { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if (isPayed){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    //眼科预约成功后消息提醒 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    WxTemplateConfigDO newConfig = new WxTemplateConfigDO(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    String scene = "hsyycgtx"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    WxTemplateConfigDO config = wxTemplateConfigDao.findByWechatIdAndTemplateNameAndSceneAndStatus(wechatId, "template_hsyycg_notice", scene, 1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    BeanUtils.copyProperties(config, newConfig); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    newConfig.setFirst(config.getFirst().replace("key1",userName)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    newConfig.setKeyword1("核酸检测预约单支付"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    newConfig.setKeyword3(map.get("doctorName")==null?"":map.get("doctorName").toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    newConfig.setKeyword4(userName); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    newConfig.setKeyword5(DateUtil.dateToStrLong(baseNatAppointmentDO.getAppointmentTime())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    newConfig.setRemark(config.getRemark().replace("key1",userName).replace("key2",DateUtil.dateToStrLong(baseNatAppointmentDO.getAppointmentTime()))); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    newConfig.setUrl(newConfig.getUrl()+baseNatAppointmentDO.getId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    logger.info("=======setUrlhsyycgtx========" + newConfig.getUrl()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    logger.info("发送的消息="+ com.alibaba.fastjson.JSONObject.toJSONString(newConfig)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    logger.info("调用眼科微信模板消息接口的入参:AccessToken="+wxAccessTokenDO.getAccessToken()+"---Openid="+one.getOpenid()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    weixinMessagePushUtils.putWxMsg(wxAccessTokenDO.getAccessToken(), one.getOpenid(), newConfig); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    //保存发送模板记录, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    WxPushLogDO wxPushLogDO = new WxPushLogDO(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    wxPushLogDO.setCreateTime(new Date()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    wxPushLogDO.setOpenid(one.getOpenid()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    wxPushLogDO.setReceiver(baseNatAppointmentDO.getPatientId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    wxPushLogDO.setWechatId(wechatId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    wxPushLogDO.setScene(scene); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    wxPushLogDao.save(wxPushLogDO); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                }else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    WxTemplateConfigDO newPayNotice = new WxTemplateConfigDO(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    String scenePayNotice= "hszftx"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    //眼科核酸预约成功后支付提醒 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    WxTemplateConfigDO configPayNotice = wxTemplateConfigDao.findByWechatIdAndTemplateNameAndSceneAndStatus(wechatId, "template_hszf_notice", scenePayNotice, 1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    BeanUtils.copyProperties(configPayNotice, newPayNotice); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    newPayNotice.setFirst(configPayNotice.getFirst().replace("key1",userName)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    newPayNotice.setKeyword1("核酸检测预约单支付"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    newPayNotice.setKeyword3(map.get("doctorName")==null?"":map.get("doctorName").toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    newPayNotice.setRemark(configPayNotice.getRemark()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    newPayNotice.setUrl(configPayNotice.getUrl()+baseNatAppointmentDO.getId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    logger.info("=======setUrlhszftx========" + newPayNotice.getUrl()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    logger.info("发送的消息="+ com.alibaba.fastjson.JSONObject.toJSONString(newPayNotice)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    logger.info("发送核酸预约模板消息成功"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    logger.info("调用眼科微信模板消息支付提醒接口的入参:AccessToken="+wxAccessTokenDO.getAccessToken()+"---Openid="+one.getOpenid()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    weixinMessagePushUtils.putWxMsg(wxAccessTokenDO.getAccessToken(), one.getOpenid(), newPayNotice); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    //保存发送模板记录, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    WxPushLogDO wxPushLogDO = new WxPushLogDO(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    wxPushLogDO.setCreateTime(new Date()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    wxPushLogDO.setOpenid(one.getOpenid()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    wxPushLogDO.setReceiver(baseNatAppointmentDO.getPatientId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    wxPushLogDO.setWechatId(wechatId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    wxPushLogDO.setScene(scenePayNotice); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    wxPushLogDao.save(wxPushLogDO); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    logger.info("发送核酸预约模板消息支付提醒成功"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } catch (Exception e) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                e.printStackTrace(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                logger.info("发送核酸预约模板消息失败,error="+e.getMessage()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return "发送成功!"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public MixEnvelop getNatRecords(String patientId,String id,String payStatus,String appointmentTime, String isSuccess,Integer page ,Integer pageSize){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String sql = "select t.name as \"name\"," + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "t.card_no as \"cardNo\"," + 
			 |