|
@ -91,7 +91,9 @@ public class WeiXinEventProcess {
|
|
|
result = tempStr.replace("<ArticleCount>5</ArticleCount>", "<ArticleCount>4</ArticleCount>");
|
|
|
}
|
|
|
if (message.get("EventKey").equals("jiankangdangan")) {
|
|
|
result = clickEventProcessMenu(message);
|
|
|
result = clickEventProcessMenu(message,"jiankangdangan");
|
|
|
}else if (message.get("EventKey").equals("fuyoubaojian")){
|
|
|
result = clickEventProcessMenu(message,"fuyoubaojian");
|
|
|
}
|
|
|
return result;
|
|
|
}
|
|
@ -194,105 +196,149 @@ public class WeiXinEventProcess {
|
|
|
* 菜单点击消息发送
|
|
|
*
|
|
|
* @param message
|
|
|
* @param key 微信菜单点击事件key值
|
|
|
* @return
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
private String clickEventProcessMenu(Map<String, String> message) throws Exception {
|
|
|
private String clickEventProcessMenu(Map<String, String> message,String key) throws Exception {
|
|
|
String result = "";
|
|
|
// 配置信息
|
|
|
Properties systemConf = SystemConf.getInstance().getSystemProperties();
|
|
|
// 图文信息
|
|
|
List<Map<String, String>> articles = new ArrayList<>();
|
|
|
//就诊记录
|
|
|
Map<String, String> articleVisit = new HashMap<>();
|
|
|
String visit = systemConf.getProperty("patient_visit_url");
|
|
|
// 图文消息图片URL
|
|
|
String visit_pic = systemConf.getProperty("patient_visit_pic");
|
|
|
// URL设置服务器URL、AppId
|
|
|
visit = visit.replace("{server}", wechat_base_url)
|
|
|
.replace("{appId}", appId);
|
|
|
//图片地址
|
|
|
visit_pic = visit_pic.replace("{server}", serverUrl);
|
|
|
|
|
|
articleVisit.put("Url", visit);
|
|
|
articleVisit.put("Title", "就诊记录");
|
|
|
articleVisit.put("Description", "就诊记录");
|
|
|
articleVisit.put("PicUrl", visit_pic);
|
|
|
articles.add(articleVisit);
|
|
|
if("jiankangdangan".equals(key)){
|
|
|
//就诊记录
|
|
|
Map<String, String> articleVisit = new HashMap<>();
|
|
|
String visit = systemConf.getProperty("patient_visit_url");
|
|
|
// 图文消息图片URL
|
|
|
String visit_pic = systemConf.getProperty("patient_visit_pic");
|
|
|
// URL设置服务器URL、AppId
|
|
|
visit = visit.replace("{server}", wechat_base_url)
|
|
|
.replace("{appId}", appId);
|
|
|
//图片地址
|
|
|
visit_pic = visit_pic.replace("{server}", serverUrl);
|
|
|
|
|
|
//#检查检验
|
|
|
Map<String, String> articleInspect = new HashMap<>();
|
|
|
// 图文URL
|
|
|
String inspect = systemConf.getProperty("patient_inspect_url");
|
|
|
// 图文消息图片URL
|
|
|
String inspect_pic = systemConf.getProperty("patient_inspect_pic");
|
|
|
// URL设置服务器URL、AppId
|
|
|
inspect = inspect.replace("{server}", wechat_base_url)
|
|
|
.replace("{appId}", appId);
|
|
|
//图片地址
|
|
|
inspect_pic = inspect_pic.replace("{server}", serverUrl);
|
|
|
articleVisit.put("Url", visit);
|
|
|
articleVisit.put("Title", "就诊记录");
|
|
|
articleVisit.put("Description", "就诊记录");
|
|
|
articleVisit.put("PicUrl", visit_pic);
|
|
|
articles.add(articleVisit);
|
|
|
|
|
|
articleInspect.put("Url", inspect);
|
|
|
articleInspect.put("Title", "检查检验");
|
|
|
articleInspect.put("Description", "检查检验");
|
|
|
articleInspect.put("PicUrl", inspect_pic);
|
|
|
articles.add(articleInspect);
|
|
|
//#检查检验
|
|
|
Map<String, String> articleInspect = new HashMap<>();
|
|
|
// 图文URL
|
|
|
String inspect = systemConf.getProperty("patient_inspect_url");
|
|
|
// 图文消息图片URL
|
|
|
String inspect_pic = systemConf.getProperty("patient_inspect_pic");
|
|
|
// URL设置服务器URL、AppId
|
|
|
inspect = inspect.replace("{server}", wechat_base_url)
|
|
|
.replace("{appId}", appId);
|
|
|
//图片地址
|
|
|
inspect_pic = inspect_pic.replace("{server}", serverUrl);
|
|
|
|
|
|
Map<String, String> articleExamination = new HashMap<>();
|
|
|
// 图文URL
|
|
|
String examination = systemConf.getProperty("patient_examination_url");
|
|
|
// 图文消息图片URL
|
|
|
String examination_pic = systemConf.getProperty("patient_examination_pic");
|
|
|
// URL设置服务器URL、AppId
|
|
|
examination = examination.replace("{server}", wechat_base_url)
|
|
|
.replace("{appId}", appId);
|
|
|
//图片地址
|
|
|
examination_pic = examination_pic.replace("{server}", serverUrl);
|
|
|
articleInspect.put("Url", inspect);
|
|
|
articleInspect.put("Title", "检查检验");
|
|
|
articleInspect.put("Description", "检查检验");
|
|
|
articleInspect.put("PicUrl", inspect_pic);
|
|
|
articles.add(articleInspect);
|
|
|
|
|
|
articleExamination.put("Url", examination);
|
|
|
articleExamination.put("Title", "社区体检");
|
|
|
articleExamination.put("Description", "社区体检");
|
|
|
articleExamination.put("PicUrl", examination_pic);
|
|
|
articles.add(articleExamination);
|
|
|
Map<String, String> articleExamination = new HashMap<>();
|
|
|
// 图文URL
|
|
|
String examination = systemConf.getProperty("patient_examination_url");
|
|
|
// 图文消息图片URL
|
|
|
String examination_pic = systemConf.getProperty("patient_examination_pic");
|
|
|
// URL设置服务器URL、AppId
|
|
|
examination = examination.replace("{server}", wechat_base_url)
|
|
|
.replace("{appId}", appId);
|
|
|
//图片地址
|
|
|
examination_pic = examination_pic.replace("{server}", serverUrl);
|
|
|
|
|
|
// 新增处方记录图文消息
|
|
|
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);
|
|
|
articleExamination.put("Url", examination);
|
|
|
articleExamination.put("Title", "社区体检");
|
|
|
articleExamination.put("Description", "社区体检");
|
|
|
articleExamination.put("PicUrl", examination_pic);
|
|
|
articles.add(articleExamination);
|
|
|
|
|
|
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);
|
|
|
|
|
|
// 新增居民取药码图文消息 by wjj 2017.08.25
|
|
|
Map<String, String> articlePatientQRCode = new HashMap<>();
|
|
|
// 图文URL
|
|
|
String patientQRCode = systemConf.getProperty("patient_QRCode_url");
|
|
|
// 图文消息图片URL
|
|
|
String patientQRCode_pic = systemConf.getProperty("patient_QRCode_pic");
|
|
|
// URL设置服务器URL、AppId
|
|
|
patientQRCode = patientQRCode.replace("{server}", wechat_base_url)
|
|
|
.replace("{appId}", appId);
|
|
|
//图片地址
|
|
|
patientQRCode_pic = patientQRCode_pic.replace("{server}", serverUrl);
|
|
|
articlePrescription.put("Url", prescription);
|
|
|
articlePrescription.put("Title", "处方记录");
|
|
|
articlePrescription.put("Description", "处方记录");
|
|
|
articlePrescription.put("PicUrl", prescription_pic);
|
|
|
articles.add(articlePrescription);
|
|
|
|
|
|
// 新增居民取药码图文消息 by wjj 2017.08.25
|
|
|
Map<String, String> articlePatientQRCode = new HashMap<>();
|
|
|
// 图文URL
|
|
|
String patientQRCode = systemConf.getProperty("patient_QRCode_url");
|
|
|
// 图文消息图片URL
|
|
|
String patientQRCode_pic = systemConf.getProperty("patient_QRCode_pic");
|
|
|
// URL设置服务器URL、AppId
|
|
|
patientQRCode = patientQRCode.replace("{server}", wechat_base_url)
|
|
|
.replace("{appId}", appId);
|
|
|
//图片地址
|
|
|
patientQRCode_pic = patientQRCode_pic.replace("{server}", serverUrl);
|
|
|
|
|
|
articlePatientQRCode.put("Url", patientQRCode);
|
|
|
articlePatientQRCode.put("Title", "我的取药码");
|
|
|
articlePatientQRCode.put("Description", "我的取药码");
|
|
|
articlePatientQRCode.put("PicUrl", patientQRCode_pic);
|
|
|
articles.add(articlePatientQRCode);
|
|
|
articlePatientQRCode.put("Url", patientQRCode);
|
|
|
articlePatientQRCode.put("Title", "我的取药码");
|
|
|
articlePatientQRCode.put("Description", "我的取药码");
|
|
|
articlePatientQRCode.put("PicUrl", patientQRCode_pic);
|
|
|
articles.add(articlePatientQRCode);
|
|
|
|
|
|
// 构建回复消息XML
|
|
|
result = WeiXinMessageReplyUtils.replyNewsMessage(message.get("FromUserName"), message.get("ToUserName"), articles);
|
|
|
}else if ("fuyoubaojian".equals(key)){
|
|
|
// 新增产检计划图文消息
|
|
|
Map<String, String> articlePrenata = new HashMap<>();
|
|
|
// 图文URL
|
|
|
String prenata = systemConf.getProperty("patient_prenata_url");
|
|
|
// 图文消息图片URL
|
|
|
String prenata_pic = systemConf.getProperty("patient_prenata_pic");
|
|
|
// URL设置服务器URL、AppId
|
|
|
prenata = prenata.replace("{server}", wechat_base_url)
|
|
|
.replace("{appId}", appId);
|
|
|
//图片地址
|
|
|
prenata_pic = prenata_pic.replace("{server}", serverUrl);
|
|
|
|
|
|
articlePrenata.put("Url", prenata);
|
|
|
articlePrenata.put("Title", "产检计划");
|
|
|
articlePrenata.put("Description", "产检计划");
|
|
|
articlePrenata.put("PicUrl", prenata_pic);
|
|
|
articles.add(articlePrenata);
|
|
|
|
|
|
// 新增免疫计划图文消息
|
|
|
Map<String, String> articleImmune = new HashMap<>();
|
|
|
// 图文URL
|
|
|
String immune = systemConf.getProperty("patient_immune_url");
|
|
|
// 图文消息图片URL
|
|
|
String immune_pic = systemConf.getProperty("patient_immune_pic");
|
|
|
// URL设置服务器URL、AppId
|
|
|
immune = immune.replace("{server}", wechat_base_url)
|
|
|
.replace("{appId}", appId);
|
|
|
//图片地址
|
|
|
immune_pic = immune_pic.replace("{server}", serverUrl);
|
|
|
|
|
|
articleImmune.put("Url", immune);
|
|
|
articleImmune.put("Title", "免疫计划");
|
|
|
articleImmune.put("Description", "免疫计划");
|
|
|
articleImmune.put("PicUrl", immune_pic);
|
|
|
articles.add(articleImmune);
|
|
|
|
|
|
// 构建回复消息XML
|
|
|
result = WeiXinMessageReplyUtils.replyNewsMessage(message.get("FromUserName"), message.get("ToUserName"), articles);
|
|
|
}
|
|
|
|
|
|
// 构建回复消息XML
|
|
|
result = WeiXinMessageReplyUtils.replyNewsMessage(message.get("FromUserName"), message.get("ToUserName"), articles);
|
|
|
|
|
|
return result;
|
|
|
}
|