|
@ -23,13 +23,14 @@ public class WeiXinEventProcess {
|
|
private String appId;
|
|
private String appId;
|
|
@Value("${server.server_url}")
|
|
@Value("${server.server_url}")
|
|
private String serverUrl;
|
|
private String serverUrl;
|
|
|
|
|
|
/**
|
|
/**
|
|
* 微信推送事件处理
|
|
* 微信推送事件处理
|
|
*
|
|
*
|
|
* @param message
|
|
* @param message
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
public String eventProcess(Map<String, String> message) throws Exception {
|
|
|
|
|
|
public String eventProcess(Map<String, String> message) throws Exception {
|
|
String result = "";
|
|
String result = "";
|
|
String event = message.get("Event");
|
|
String event = message.get("Event");
|
|
|
|
|
|
@ -60,7 +61,7 @@ public class WeiXinEventProcess {
|
|
* @param message
|
|
* @param message
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
public String clickProcess(Map<String, String> message) throws Exception {
|
|
|
|
|
|
public String clickProcess(Map<String, String> message) throws Exception {
|
|
String result = "";
|
|
String result = "";
|
|
if (message.get("EventKey").equals("caozuoshuoming")) {
|
|
if (message.get("EventKey").equals("caozuoshuoming")) {
|
|
|
|
|
|
@ -84,7 +85,7 @@ public class WeiXinEventProcess {
|
|
* @return
|
|
* @return
|
|
* @throws Exception
|
|
* @throws Exception
|
|
*/
|
|
*/
|
|
private String clickEventProcess(Map<String, String> message) throws Exception {
|
|
|
|
|
|
private String clickEventProcess(Map<String, String> message) throws Exception {
|
|
String result = "";
|
|
String result = "";
|
|
// 配置信息
|
|
// 配置信息
|
|
Properties systemConf = SystemConf.getInstance().getSystemProperties();
|
|
Properties systemConf = SystemConf.getInstance().getSystemProperties();
|
|
@ -98,7 +99,7 @@ public class WeiXinEventProcess {
|
|
// 图文消息图片URL
|
|
// 图文消息图片URL
|
|
String picUrlConsult = systemConf.getProperty("patient_operatinginstrutions_pic_url");
|
|
String picUrlConsult = systemConf.getProperty("patient_operatinginstrutions_pic_url");
|
|
// URL设置服务器URL、AppId
|
|
// URL设置服务器URL、AppId
|
|
urlConsult = urlConsult.replace("{server}",wechat_base_url)
|
|
|
|
|
|
urlConsult = urlConsult.replace("{server}", wechat_base_url)
|
|
.replace("{appId}", appId);
|
|
.replace("{appId}", appId);
|
|
//图片地址
|
|
//图片地址
|
|
picUrlConsult = picUrlConsult.replace("{server}", serverUrl);
|
|
picUrlConsult = picUrlConsult.replace("{server}", serverUrl);
|
|
@ -134,7 +135,7 @@ public class WeiXinEventProcess {
|
|
// 图文消息图片URL
|
|
// 图文消息图片URL
|
|
String picUrlDevice = systemConf.getProperty("patient_device_pic_url");
|
|
String picUrlDevice = systemConf.getProperty("patient_device_pic_url");
|
|
// URL设置服务器URL、AppId
|
|
// URL设置服务器URL、AppId
|
|
urlDevice = urlDevice.replace("{server}",wechat_base_url)
|
|
|
|
|
|
urlDevice = urlDevice.replace("{server}", wechat_base_url)
|
|
.replace("{appId}", appId);
|
|
.replace("{appId}", appId);
|
|
//图片地址
|
|
//图片地址
|
|
picUrlDevice = picUrlDevice.replace("{server}", serverUrl);
|
|
picUrlDevice = picUrlDevice.replace("{server}", serverUrl);
|
|
@ -153,7 +154,7 @@ public class WeiXinEventProcess {
|
|
String picUrlFamily = systemConf.getProperty("patient_family_pic_url");
|
|
String picUrlFamily = systemConf.getProperty("patient_family_pic_url");
|
|
// URL设置服务器URL、AppId
|
|
// URL设置服务器URL、AppId
|
|
urlFamily = urlFamily.replace("{server}", wechat_base_url)
|
|
urlFamily = urlFamily.replace("{server}", wechat_base_url)
|
|
.replace("{appId}",appId);
|
|
|
|
|
|
.replace("{appId}", appId);
|
|
//图片地址
|
|
//图片地址
|
|
picUrlFamily = picUrlFamily.replace("{server}", serverUrl);
|
|
picUrlFamily = picUrlFamily.replace("{server}", serverUrl);
|
|
|
|
|
|
@ -178,7 +179,7 @@ public class WeiXinEventProcess {
|
|
* @return
|
|
* @return
|
|
* @throws Exception
|
|
* @throws Exception
|
|
*/
|
|
*/
|
|
private String clickEventProcessMenu(Map<String, String> message) throws Exception {
|
|
|
|
|
|
private String clickEventProcessMenu(Map<String, String> message) throws Exception {
|
|
String result = "";
|
|
String result = "";
|
|
// 配置信息
|
|
// 配置信息
|
|
Properties systemConf = SystemConf.getInstance().getSystemProperties();
|
|
Properties systemConf = SystemConf.getInstance().getSystemProperties();
|
|
@ -208,8 +209,8 @@ public class WeiXinEventProcess {
|
|
// 图文消息图片URL
|
|
// 图文消息图片URL
|
|
String inspect_pic = systemConf.getProperty("patient_inspect_pic");
|
|
String inspect_pic = systemConf.getProperty("patient_inspect_pic");
|
|
// URL设置服务器URL、AppId
|
|
// URL设置服务器URL、AppId
|
|
inspect = inspect.replace("{server}",wechat_base_url)
|
|
|
|
.replace("{appId}",appId);
|
|
|
|
|
|
inspect = inspect.replace("{server}", wechat_base_url)
|
|
|
|
.replace("{appId}", appId);
|
|
//图片地址
|
|
//图片地址
|
|
inspect_pic = inspect_pic.replace("{server}", serverUrl);
|
|
inspect_pic = inspect_pic.replace("{server}", serverUrl);
|
|
|
|
|
|
@ -225,10 +226,10 @@ public class WeiXinEventProcess {
|
|
// 图文消息图片URL
|
|
// 图文消息图片URL
|
|
String examination_pic = systemConf.getProperty("patient_examination_pic");
|
|
String examination_pic = systemConf.getProperty("patient_examination_pic");
|
|
// URL设置服务器URL、AppId
|
|
// URL设置服务器URL、AppId
|
|
examination = examination.replace("{server}",wechat_base_url)
|
|
|
|
|
|
examination = examination.replace("{server}", wechat_base_url)
|
|
.replace("{appId}", appId);
|
|
.replace("{appId}", appId);
|
|
//图片地址
|
|
//图片地址
|
|
examination_pic = examination_pic.replace("{server}",serverUrl);
|
|
|
|
|
|
examination_pic = examination_pic.replace("{server}", serverUrl);
|
|
|
|
|
|
articleExamination.put("Url", examination);
|
|
articleExamination.put("Url", examination);
|
|
articleExamination.put("Title", "社区体检");
|
|
articleExamination.put("Title", "社区体检");
|
|
@ -237,22 +238,22 @@ public class WeiXinEventProcess {
|
|
articles.add(articleExamination);
|
|
articles.add(articleExamination);
|
|
|
|
|
|
// 新增处方记录图文消息
|
|
// 新增处方记录图文消息
|
|
// Map<String, String> articlePrescription = new HashMap<>();
|
|
|
|
// // 图文URL
|
|
|
|
// String prescription = systemConf.getProperty("patient_prescription_url");
|
|
|
|
// // 图文消息图片URL
|
|
|
|
// String prescription_pic = systemConf.getProperty("patient_prescription_pic");
|
|
|
|
// // URL设置服务器URL、AppId
|
|
|
|
// prescription = prescription.replace("{server}",wechat_base_url)
|
|
|
|
// .replace("{appId}",appId);
|
|
|
|
// //图片地址
|
|
|
|
// prescription_pic = prescription_pic.replace("{server}",serverUrl);
|
|
|
|
//
|
|
|
|
// articlePrescription.put("Url", prescription);
|
|
|
|
// articlePrescription.put("Title", "处方记录");
|
|
|
|
// articlePrescription.put("Description", "处方记录");
|
|
|
|
// articlePrescription.put("PicUrl", prescription_pic);
|
|
|
|
// articles.add(articlePrescription);
|
|
|
|
|
|
Map<String, String> articlePrescription = new HashMap<>();
|
|
|
|
// 图文URL
|
|
|
|
String prescription = systemConf.getProperty("patient_prescription_url");
|
|
|
|
// 图文消息图片URL
|
|
|
|
String prescription_pic = systemConf.getProperty("patient_prescription_pic");
|
|
|
|
// URL设置服务器URL、AppId
|
|
|
|
prescription = prescription.replace("{server}", wechat_base_url)
|
|
|
|
.replace("{appId}", appId);
|
|
|
|
//图片地址
|
|
|
|
prescription_pic = prescription_pic.replace("{server}", serverUrl);
|
|
|
|
|
|
|
|
articlePrescription.put("Url", prescription);
|
|
|
|
articlePrescription.put("Title", "处方记录");
|
|
|
|
articlePrescription.put("Description", "处方记录");
|
|
|
|
articlePrescription.put("PicUrl", prescription_pic);
|
|
|
|
articles.add(articlePrescription);
|
|
|
|
|
|
// 构建回复消息XML
|
|
// 构建回复消息XML
|
|
result = WeiXinMessageReplyUtils.replyNewsMessage(message.get("FromUserName"), message.get("ToUserName"), articles);
|
|
result = WeiXinMessageReplyUtils.replyNewsMessage(message.get("FromUserName"), message.get("ToUserName"), articles);
|
|
@ -268,7 +269,7 @@ public class WeiXinEventProcess {
|
|
* @return
|
|
* @return
|
|
* @throws Exception
|
|
* @throws Exception
|
|
*/
|
|
*/
|
|
private String subscribeEventProcess(Map<String, String> message) throws Exception {
|
|
|
|
|
|
private String subscribeEventProcess(Map<String, String> message) throws Exception {
|
|
String result = "";
|
|
String result = "";
|
|
// 配置信息
|
|
// 配置信息
|
|
Properties systemConf = SystemConf.getInstance().getSystemProperties();
|
|
Properties systemConf = SystemConf.getInstance().getSystemProperties();
|
|
@ -307,7 +308,7 @@ public class WeiXinEventProcess {
|
|
*
|
|
*
|
|
* @param articles
|
|
* @param articles
|
|
*/
|
|
*/
|
|
public void setUrlItems(List<Map<String, String>> articles, Properties systemConf) {
|
|
|
|
|
|
public void setUrlItems(List<Map<String, String>> articles, Properties systemConf) {
|
|
Map<String, String> articleConsult = new HashMap<>();
|
|
Map<String, String> articleConsult = new HashMap<>();
|
|
// 图文URL
|
|
// 图文URL
|
|
String urlConsult = systemConf.getProperty("patient_consult_url");
|
|
String urlConsult = systemConf.getProperty("patient_consult_url");
|
|
@ -335,7 +336,7 @@ public class WeiXinEventProcess {
|
|
urlBooking = urlBooking.replace("{server}", wechat_base_url)
|
|
urlBooking = urlBooking.replace("{server}", wechat_base_url)
|
|
.replace("{appId}", appId);
|
|
.replace("{appId}", appId);
|
|
//图片地址
|
|
//图片地址
|
|
picUrlBooking = picUrlBooking.replace("{server}",serverUrl);
|
|
|
|
|
|
picUrlBooking = picUrlBooking.replace("{server}", serverUrl);
|
|
|
|
|
|
articleBooking.put("Url", urlBooking);
|
|
articleBooking.put("Url", urlBooking);
|
|
articleBooking.put("Title", "预约挂号功能使用说明");
|
|
articleBooking.put("Title", "预约挂号功能使用说明");
|
|
@ -369,9 +370,9 @@ public class WeiXinEventProcess {
|
|
String picUrlFamily = systemConf.getProperty("patient_family_pic_url");
|
|
String picUrlFamily = systemConf.getProperty("patient_family_pic_url");
|
|
// URL设置服务器URL、AppId
|
|
// URL设置服务器URL、AppId
|
|
urlFamily = urlFamily.replace("{server}", wechat_base_url)
|
|
urlFamily = urlFamily.replace("{server}", wechat_base_url)
|
|
.replace("{appId}",appId);
|
|
|
|
|
|
.replace("{appId}", appId);
|
|
//图片地址
|
|
//图片地址
|
|
picUrlFamily = picUrlFamily.replace("{server}",serverUrl);
|
|
|
|
|
|
picUrlFamily = picUrlFamily.replace("{server}", serverUrl);
|
|
|
|
|
|
articleFamily.put("Url", urlFamily);
|
|
articleFamily.put("Url", urlFamily);
|
|
articleFamily.put("Title", "我的家庭功能使用说明");
|
|
articleFamily.put("Title", "我的家庭功能使用说明");
|
|
@ -388,7 +389,7 @@ public class WeiXinEventProcess {
|
|
* @return
|
|
* @return
|
|
* @throws Exception
|
|
* @throws Exception
|
|
*/
|
|
*/
|
|
private String scanEventProcess(Map<String, String> message) throws Exception {
|
|
|
|
|
|
private String scanEventProcess(Map<String, String> message) throws Exception {
|
|
String result = "";
|
|
String result = "";
|
|
// 场景值
|
|
// 场景值
|
|
String eventKey = message.get("EventKey");
|
|
String eventKey = message.get("EventKey");
|
|
@ -443,7 +444,7 @@ public class WeiXinEventProcess {
|
|
String[] keys = eventKey.replace("qrscene_hs_", "").replace("hs_", "").split("_");
|
|
String[] keys = eventKey.replace("qrscene_hs_", "").replace("hs_", "").split("_");
|
|
|
|
|
|
// 图文消息URL
|
|
// 图文消息URL
|
|
url = url.replace("{server}",wechat_base_url)
|
|
|
|
|
|
url = url.replace("{server}", wechat_base_url)
|
|
.replace("{appId}", appId)
|
|
.replace("{appId}", appId)
|
|
.replace("{hospital}", keys[0] + ":" + keys[1]);
|
|
.replace("{hospital}", keys[0] + ":" + keys[1]);
|
|
//图片地址
|
|
//图片地址
|
|
@ -478,7 +479,7 @@ public class WeiXinEventProcess {
|
|
|
|
|
|
// 图文消息URL
|
|
// 图文消息URL
|
|
url = url.replace("{server}", wechat_base_url)
|
|
url = url.replace("{server}", wechat_base_url)
|
|
.replace("{appId}",appId)
|
|
|
|
|
|
.replace("{appId}", appId)
|
|
.replace("{town}", keys[0]);
|
|
.replace("{town}", keys[0]);
|
|
//图片地址
|
|
//图片地址
|
|
picUrl = picUrl.replace("{server}", serverUrl);
|
|
picUrl = picUrl.replace("{server}", serverUrl);
|
|
@ -510,7 +511,7 @@ public class WeiXinEventProcess {
|
|
* @param description 图文描述
|
|
* @param description 图文描述
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
public Map getNews(String url, String picUrl, String title, String description) {
|
|
|
|
|
|
public Map getNews(String url, String picUrl, String title, String description) {
|
|
Properties systemConf = SystemConf.getInstance().getSystemProperties();
|
|
Properties systemConf = SystemConf.getInstance().getSystemProperties();
|
|
Map<String, String> news = new HashMap<>();
|
|
Map<String, String> news = new HashMap<>();
|
|
// 图文URL
|
|
// 图文URL
|
|
@ -518,8 +519,8 @@ public class WeiXinEventProcess {
|
|
// 图文消息图片URL
|
|
// 图文消息图片URL
|
|
String pictureUrl = systemConf.getProperty(picUrl);
|
|
String pictureUrl = systemConf.getProperty(picUrl);
|
|
// URL设置服务器URL、AppId
|
|
// URL设置服务器URL、AppId
|
|
targetUrl = targetUrl.replace("{server}",wechat_base_url)
|
|
|
|
.replace("{appId}",appId);
|
|
|
|
|
|
targetUrl = targetUrl.replace("{server}", wechat_base_url)
|
|
|
|
.replace("{appId}", appId);
|
|
//图片地址
|
|
//图片地址
|
|
pictureUrl = pictureUrl.replace("{server}", serverUrl);
|
|
pictureUrl = pictureUrl.replace("{server}", serverUrl);
|
|
System.out.println("url ====> " + targetUrl);
|
|
System.out.println("url ====> " + targetUrl);
|
|
@ -541,7 +542,7 @@ public class WeiXinEventProcess {
|
|
* @param message
|
|
* @param message
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
public String replyKeyword(Map<String, String> message) throws Exception {
|
|
|
|
|
|
public String replyKeyword(Map<String, String> message) throws Exception {
|
|
String result = "";
|
|
String result = "";
|
|
String description = "您的家庭医生签约将于6月30日到期,为了能继续给您提供健康服务,诚邀您续签家庭医生。";
|
|
String description = "您的家庭医生签约将于6月30日到期,为了能继续给您提供健康服务,诚邀您续签家庭医生。";
|
|
String description1 = "为了能给您提供健康服务,诚邀您签签约家庭医生。";
|
|
String description1 = "为了能给您提供健康服务,诚邀您签签约家庭医生。";
|