|  | @ -7,11 +7,14 @@ import com.yihu.jw.entity.base.patient.BasePatientDO;
 | 
	
		
			
				|  |  | import com.yihu.jw.entity.base.wx.BasePatientWechatDo;
 | 
	
		
			
				|  |  | import com.yihu.jw.entity.base.wx.WxTemplateConfigDO;
 | 
	
		
			
				|  |  | import com.yihu.jw.entity.base.wx.WxTemplateDO;
 | 
	
		
			
				|  |  | import com.yihu.jw.hospital.prescription.service.entrance.XzzxEntranceService;
 | 
	
		
			
				|  |  | import com.yihu.jw.oauth.OauthSsoService;
 | 
	
		
			
				|  |  | import com.yihu.jw.patient.dao.BasePatientDao;
 | 
	
		
			
				|  |  | import com.yihu.jw.restmodel.web.Envelop;
 | 
	
		
			
				|  |  | import com.yihu.jw.rm.base.BaseRequestMapping;
 | 
	
		
			
				|  |  | import com.yihu.jw.util.wechat.WeixinMessagePushUtils;
 | 
	
		
			
				|  |  | import com.yihu.jw.util.wechat.wxhttp.HttpUtil;
 | 
	
		
			
				|  |  | import com.yihu.jw.utils.RSAEncrypt;
 | 
	
		
			
				|  |  | import com.yihu.jw.wechat.dao.BasePatientWechatDao;
 | 
	
		
			
				|  |  | import com.yihu.jw.wechat.dao.WxTemplateConfigDao;
 | 
	
		
			
				|  |  | import com.yihu.jw.wechat.dao.WxTemplateDao;
 | 
	
	
		
			
				|  | @ -53,6 +56,12 @@ public class WxTemplateService {
 | 
	
		
			
				|  |  |     @Autowired
 | 
	
		
			
				|  |  |     private BasePatientWechatDao basePatientWechatDao;
 | 
	
		
			
				|  |  |     
 | 
	
		
			
				|  |  |     @Autowired
 | 
	
		
			
				|  |  |     private OauthSsoService oauthSsoService;
 | 
	
		
			
				|  |  |     
 | 
	
		
			
				|  |  |     @Autowired
 | 
	
		
			
				|  |  |     private XzzxEntranceService xzzxEntranceService;
 | 
	
		
			
				|  |  |     
 | 
	
		
			
				|  |  |     
 | 
	
		
			
				|  |  |     /**
 | 
	
		
			
				|  |  |      * 发送微信模版消息-小程序视频
 | 
	
	
		
			
				|  | @ -70,10 +79,30 @@ public class WxTemplateService {
 | 
	
		
			
				|  |  |                 logger.info("该用户"+reciver_name+"没有openid,无法推送模版消息,用户ID:"+reciver_id+"wechatId:"+wechatId);
 | 
	
		
			
				|  |  |             }else{
 | 
	
		
			
				|  |  |                 for (BasePatientWechatDo basePatientWechatDo:ps){
 | 
	
		
			
				|  |  |                     WxTemplateConfigDO config = wxTemplateConfigDao.findByWechatIdAndTemplateNameAndSceneAndStatus(wechatId,"template_consult_notice","spthtx",1);
 | 
	
		
			
				|  |  |                     config.setFirst(config.getFirst().replace("key1",sender_name));
 | 
	
		
			
				|  |  |                     config.setPagepath(config.getPagepath()+""+reciver_id+"&doctorName="+sender_name+"&role=patient&roomID="+session_id+"&template=1v1&debugMode=false&cloudenv=PRO");
 | 
	
		
			
				|  |  |                     weixinMessagePushUtils.putWxMsg(wxAccessTokenService.getWxAccessTokenById(wechatId).getAccessToken(),basePatientWechatDo.getOpenid(),config);
 | 
	
		
			
				|  |  |                     if("xm_xzzx_wx".equals(wechatId)){
 | 
	
		
			
				|  |  |                         String getAuthCode = oauthSsoService.getSsoPublic(wechatId,basePatientDO.getId());
 | 
	
		
			
				|  |  |     
 | 
	
		
			
				|  |  |                         JSONObject jsonObject = new JSONObject();
 | 
	
		
			
				|  |  |                         jsonObject.put("name",basePatientDO.getName());
 | 
	
		
			
				|  |  |                         jsonObject.put("idcard",basePatientDO.getIdcard());
 | 
	
		
			
				|  |  |                         jsonObject.put("mobile",basePatientDO.getMobile());
 | 
	
		
			
				|  |  |                         jsonObject.put("openid",basePatientWechatDo.getOpenid());
 | 
	
		
			
				|  |  |                         String authCode = jsonObject.toJSONString();
 | 
	
		
			
				|  |  |                         String jm = RSAEncrypt.encrypt(authCode,getAuthCode);
 | 
	
		
			
				|  |  |                         String miniprogramUrl = "pages/room/room?patientCode="+reciver_id+"&doctorName="+sender_name+"&role=patient&roomID="+session_id+"&template=1v1&debugMode=false&cloudenv=PRO&authCode="+jm+"&code="+wechatId+"&appid="+basePatientDO.getId();
 | 
	
		
			
				|  |  |                         //心脏中心模版消息推送接口
 | 
	
		
			
				|  |  |                         xzzxEntranceService.sendXCXMes(wechatId,
 | 
	
		
			
				|  |  |                                 basePatientDO.getId(),
 | 
	
		
			
				|  |  |                                 basePatientDO.getIdcard(),
 | 
	
		
			
				|  |  |                                 sender_name+"主任医生已向您发起视频通话邀请,请点击详情进入视频诊室。",
 | 
	
		
			
				|  |  |                                 "点击消息进入视频诊室接听视频通话,开始视频咨询",
 | 
	
		
			
				|  |  |                                 "",miniprogramUrl,"wx53f6bb4ac081d840");
 | 
	
		
			
				|  |  |                     }else{
 | 
	
		
			
				|  |  |                         WxTemplateConfigDO config = wxTemplateConfigDao.findByWechatIdAndTemplateNameAndSceneAndStatus(wechatId,"template_consult_notice","spthtx",1);
 | 
	
		
			
				|  |  |                         config.setFirst(config.getFirst().replace("key1",sender_name));
 | 
	
		
			
				|  |  |                         config.setPagepath(config.getPagepath()+""+reciver_id+"&doctorName="+sender_name+"&role=patient&roomID="+session_id+"&template=1v1&debugMode=false&cloudenv=PRO");
 | 
	
		
			
				|  |  |                         weixinMessagePushUtils.putWxMsg(wxAccessTokenService.getWxAccessTokenById(wechatId).getAccessToken(),basePatientWechatDo.getOpenid(),config);
 | 
	
		
			
				|  |  |                     }
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  | 
 |