微信后端代码
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

302 lines
16 KiB

//package com.ynxbd.wx.remove.util;
//
//import com.ynxbd.wx.config.WeChatConfig;
//import weixin.popular.bean.xmlmessage.XMLNewsMessage;
//import weixin.popular.bean.xmlmessage.XMLTextMessage;
//
//import java.io.OutputStream;
//import java.util.ArrayList;
//import java.util.List;
//
//public class MessageUtil {
// public static final String MESSAGE_TEXT = "text";
// public static final String MESSAGE_IMAGE = "image";
// public static final String MESSAGE_VOICE = "voice";
// public static final String MESSAGE_VIDEO = "video";
// public static final String MESSAGE_LINK = "link";
// public static final String MESSAGE_LOCATION = "location";
// public static final String MESSAGE_EVENT = "event";
//
// public static final String EVENT_SUB = "subscribe"; // subscribe
// public static final String EVENT_UNSUB = "unsubscribe";
// public static final String EVENT_CLICK = "CLICK";
// public static final String EVENT_VIEW = "VIEW";
//
////
//// /**
//// * xml转为map
//// * @param request
//// * @return
//// * @throws DocumentException
//// * @throws IOException
//// */
//// public static Map<String, String> xmlToMap(HttpServletRequest request ) throws DigestException, IOException, DocumentException
//// {
//// Map<String,String> map = new HashMap<String, String>();
////
//// SAXReader reader = new SAXReader();
////
//// InputStream ins = request.getInputStream();
//// Document doc = reader.read(ins);
////
//// Element root = doc.getRootElement();
//// List<Element> list = root.elements();
//// for (Element e : list) {
//// map.put(e.getName(), e.getText());
//// }
//// ins.close();
//// return map;
//// }
//
//// public static String textMessageToXml(TextMessage textMessage){
//// XStream xstream = new XStream();
//// xstream.alias("xml", textMessage.getClass());
//// return xstream.toXML(textMessage);
////
//// }
//// public static String initText(String toUserName, String fromUserName, String content){
//// TextMessage text = new TextMessage();
//// text.setFromUserName(toUserName);
//// text.setToUserName(fromUserName);
//// text.setMsgType(MESSAGE_TEXT);
//// text.setCreateTime(new Date().getTime());
//// text.setContent(content);
//// return textMessageToXml(text);
//// }
//
// public static void 缓存(OutputStream outStream, String content, String msgType, String fromUserName, String toUserName, String eventKey, String event) {
// List<XMLNewsMessage.Article> articleList = new ArrayList<>();
// XMLNewsMessage.Article article;
//
// if (content == null) {
// return;
// }
//
// String webUrl = WeChatConfig.getWebUrl();
// if (content.contains("缓") || content.contains("缓存") || content.contains("用不了") || content.contains("页面") || content.contains("404") || content.contains("不") || content.contains("进不去")) {
// article = new XMLNewsMessage.Article();
// article.setTitle("公众号用不了(缓存清理)");
// article.setUrl(webUrl + "wx-cache.html");
// article.setPicurl(webUrl + "src/static/images/message/cache.png");
// articleList.add(article);
// XMLNewsMessage xmlNewsMessage = new XMLNewsMessage(fromUserName, toUserName, articleList);
// xmlNewsMessage.outputStreamWrite(outStream);
// }
// }
//
// public static void 链接(OutputStream outStream, String content, String msgType, String fromUserName, String toUserName, String eventKey, String event) {
// List<XMLNewsMessage.Article> articleList = new ArrayList<>();
// XMLNewsMessage.Article article;
//
// if (content == null) {
// return;
// }
//
// String webUrl = WeChatConfig.getWebUrl();
// if (content.contains("你好") || content.contains("链接") || content.contains("指引") || content.contains("微官网")) {
// article = new XMLNewsMessage.Article();
// article.setTitle("微官网链接");
// article.setUrl(webUrl + "app.html");
// article.setPicurl(webUrl + "src/static/images/message/hospital.png");
// articleList.add(article);
// XMLNewsMessage xmlNewsMessage = new XMLNewsMessage(fromUserName, toUserName, articleList);
// xmlNewsMessage.outputStreamWrite(outStream);
// }
// }
//
//
// public static void 芒市县人民医院(OutputStream outStream, String baseURL, String content, String msgType, String fromUserName, String toUserName, String eventKey, String event) {
// List<XMLNewsMessage.Article> articleList = new ArrayList<>();
// XMLNewsMessage.Article article;
//
// if (msgType != null) {
// if (MessageUtil.MESSAGE_EVENT.equals(msgType)) {
// if (MessageUtil.EVENT_SUB.equals(event)) {
// article = new XMLNewsMessage.Article();
// article.setTitle("微信预约挂号开通喽,大家快快用起来!");
// article.setUrl("https://mp.weixin.qq.com/s/rJF1qBo1-mV5CUdRsi4Z5g");
// article.setPicurl("https://mmbiz.qpic.cn/mmbiz_jpg/RUm4m8SVypy7nVubUuo6KgdlibcduK8l4tWnXrz7VfTO5EYOeDc9hZxR70wTQgX1sYhRR7SeND6426uczdpf1BA/0?wx_fmt=jpeg");
// articleList.add(article);
// XMLNewsMessage xmlNewsMessage = new XMLNewsMessage(fromUserName, toUserName, articleList);
// xmlNewsMessage.outputStreamWrite(outStream);
// }
// }
// }
//
// String respInfo;
//
// if (content != null) {
// if (content.contains("放射") || content.contains("影像") || content.contains("CT") || content.contains("核磁")) {
// respInfo = "放射科:2116611、18869202310(值班)";
//
// } else if (content.contains("B超")) {
// respInfo = "B超室:2121651、18869202311(值班)";
//
// } else if (content.contains("检验") || content.contains("化验") || content.contains("生化") || content.contains("免疫")) {
// respInfo = "检验科:2130240";
//
// } else if (content.contains("口 腔")) {
// respInfo = "口腔科:2139404";
//
// } else if (content.contains("皮肤")) {
// respInfo = "皮肤科:2129260";
//
// } else if (content.contains("急诊")) {
// respInfo = "急诊科:2103068(护士站)";
//
// } else if (content.contains("外三") || content.contains("泌尿")) {
// respInfo = "外三科(泌尿):2113501(护士站)";
//
// } else if (content.contains("麻醉")) {
// respInfo = "麻醉科:18869202309";
//
// } else if (content.contains("妇产") || content.contains("产科") || content.contains("妇科")) {
// respInfo = "妇产科:2113504(护士站)";
//
// } else if (content.contains("感染") || content.contains("传染")) {
// respInfo = "感染科:2116031";
//
// } else if (content.contains("内二")) {
// respInfo = "内二科:2113503(护士站)";
//
// } else if (content.contains("内一")) {
// respInfo = "内一科:2113500(护士站)";
//
// } else if (content.contains("外二") || content.contains("骨科")) {
// respInfo = "外二科(骨 科):2122450(护士站) ";
//
// } else if (content.contains("儿") || content.contains("儿科")) {
// respInfo = "儿科:2122381(护士站)";
//
// } else if (content.contains("康复")) {
// respInfo = "康复科:2116167(护士站)";
//
// } else if (content.contains("体检")) {
// respInfo = "体检科:2917280、18288102873";
//
// } else if (content.contains("120") || content.contains("急救")) {
// respInfo = "120急救中心:2107120";
//
// } else if (content.contains("外一") || content.contains("普外")) {
// respInfo = "外一科(普外):2133720";
//
// } else {
// respInfo = "办公室:2122460\n" +
// "行政值班:18869202307\n" +
// "放射科:2116611、18869202310(值班)\n\n" +
// "B超室:2121651、 18869202311(值班)\n\n" +
// "儿 科:2122381(护士站)\n" +
// "康复科:2116167(护士站)\n" +
// "检验科:2130240\n" +
// "口腔科:2139404\n" +
// "皮肤科:2129260\n" +
// "麻醉科:18869202309\n" +
// "感染科:2116031,\n" +
// "急诊科:2103068(护士站)\n" +
// "妇产科:2113504(护士站)\n" +
// "内二科:2113503(护士站)\n" +
// "内一科:2113500(护士站)\n" +
// "外二科(骨 科):2122450(护士站)\n" +
// "外三科(泌 尿):2113501(护士站)\n\n" +
// "体检科:2917280、18288102873\n" +
// "120急救中心:2107120,\n" +
// "外一科(普外):2133720";
//
// }
// XMLTextMessage msg = new XMLTextMessage(fromUserName, toUserName, respInfo);
// msg.outputStreamWrite(outStream);
// }
// }
//
// public static void 华坪县人民医院(OutputStream outStream, String baseURL, String content, String msgType, String fromUserName, String toUserName, String eventKey, String event) {
// List<XMLNewsMessage.Article> articleList = new ArrayList<>();
// XMLNewsMessage.Article article;
//
// if (content != null) {
// if (content.equals("支付") || content.equals("微信支付") || content.contains("费")) {
// article = new XMLNewsMessage.Article();
// article.setTitle("微信支付");
// article.setPicurl("http://mmbiz.qpic.cn/mmbiz/0jg8QrIOHOydg7liaUzXoa7otFCiavYozxARcpnrxt5ibQ7Y8BewUOtKJPWRUATkaskjvHeeqmicDbovRwZic7BTSng/0?wx_fmt=jpeg");
// article.setDescription("请点这里进入支付页面,支付您的账单,不用再去排队缴费。如需查看检查结果,请输入“检查”。如需查看化验结果,请输入“化验”。");
// article.setUrl(baseURL + "pay-info.html");
// articleList.add(article);
//
// } else if (content.equals("检查") || content.equals("检验") || content.equals("化验")) {
// article = new XMLNewsMessage.Article();
// article.setTitle("查看检查结果");
// article.setPicurl("http://mmbiz.qpic.cn/mmbiz/0jg8QrIOHOydg7liaUzXoa7otFCiavYozxARcpnrxt5ibQ7Y8BewUOtKJPWRUATkaskjvHeeqmicDbovRwZic7BTSng/0?wx_fmt=jpeg");
// article.setDescription("请点这里查看您的检查结果,如要查看化验结果,请输入“化验”或“检验”。如需缴费,请输入“支付”。");
// article.setUrl(WeChatConfig.getBaseURL() + "all-result.html");
// articleList.add(article);
// }
// }
//
// if (msgType != null) {
// if (MessageUtil.MESSAGE_EVENT.equals(msgType)) {
// if (eventKey.equals("MYDDC")) {
// article = new XMLNewsMessage.Article();
// article.setTitle("华坪县人民医院患者满意度调查");
// article.setUrl("http://mp.weixin.qq.com/s/MCswklxDHdmYr3sFP70Xdw");
// article.setPicurl("https://mmbiz.qpic.cn/mmbiz_jpg/0jg8QrIOHOwYlpPRQDFKpbFQsN2ibtZqcS9H9pqX4nOCzdaAHNiciaZubLF9jiayZJBV8ADxAqL6XdbpdqolJuwJIQ/640?wx_fmt=jpeg&tp=webp&wxfrom=5&wx_lazy=1");
// articleList.add(article);
//
// article = new XMLNewsMessage.Article();
// article.setTitle("患者满意度调查");
// article.setUrl("http://mp.weixin.qq.com/s/7l2YsE2Y-XSTWEXN7BJlIQ");
// article.setPicurl("https://mmbiz.qpic.cn/mmbiz_jpg/0jg8QrIOHOzYGDMbzzyKicXD9QlRA5MdmpGgicibSdY0A4kmgV94qibuKylgRXbMgPb4zGNw9BvWqDXiby1XyFCFCaQ/640?wx_fmt=jpeg&tp=webp&wxfrom=5&wx_lazy=1");
// articleList.add(article);
//
// article = new XMLNewsMessage.Article();
// article.setTitle("员工满意度调查");
// article.setUrl("http://mp.weixin.qq.com/s/VyoOCM8FoEZ53ZQC3yX-Yw");
// article.setPicurl("https://mmbiz.qpic.cn/mmbiz_jpg/0jg8QrIOHOzYGDMbzzyKicXD9QlRA5MdmpF19PW1oFibvCDj60twgfGC556fY3wThlAhIYJsHykiaDIU8h3Igh8Dw/640?wx_fmt=jpeg&tp=webp&wxfrom=5&wx_lazy=1");
// articleList.add(article);
//
// if (MessageUtil.EVENT_SUB.equals(event)) {
// article = new XMLNewsMessage.Article();
// article.setTitle("微信支付使用流程!");
// article.setPicurl("http://mmbiz.qpic.cn/mmbiz/0jg8QrIOHOydg7liaUzXoa7otFCiavYozxARcpnrxt5ibQ7Y8BewUOtKJPWRUATkaskjvHeeqmicDbovRwZic7BTSng/0?wx_fmt=jpeg");
// article.setDescription("首先关注微信公众号“华坪县人民医院”,其次打开公众号,点击“微信支付”,首次需进行身份绑定,按要求输入相关内容,获取账单;最多可以绑定除本人外加4个人,在身份绑定页面,点“添加绑定”");
//
// articleList.add(article);
// }
// }
// }
// }
//
// XMLNewsMessage msg = new XMLNewsMessage(fromUserName, toUserName, articleList);
//
// msg.outputStreamWrite(outStream);
// }
//
// public static void 巍山县人民医院(OutputStream outStream, String baseURL, String content, String msgType, String fromUserName, String toUserName, String eventKey, String event) {
// List<XMLNewsMessage.Article> articleList = new ArrayList<>();
// XMLNewsMessage.Article article;
//
// if (msgType != null) {
// if (MessageUtil.MESSAGE_EVENT.equals(msgType)) {
// // 满意度
// if (eventKey.equals("MYDDC")) {
// article = new XMLNewsMessage.Article();
// article.setTitle("巍山县人民医院患者满意度调查");
// article.setUrl("https://mp.weixin.qq.com/s/R-tX9YtRRM9Hpw2rMmw2iQ");
// article.setPicurl("https://mmbiz.qpic.cn/mmbiz_jpg/5kpYU2jcMVicvMfVRATtAKOEjh4A4VvtHmCMKgD9vAfr741FDDEwiccNdj2ZTicBibeeQZfwp6zbaYMI5ubib1TaaeA/640?wx_fmt=jpeg&tp=webp&wxfrom=5&wx_lazy=1");
// articleList.add(article);
//
// }
// // 关注
// if (MessageUtil.EVENT_SUB.equals(event)) {
// article = new XMLNewsMessage.Article();
// article.setTitle("微信预约挂号开通喽,大家快快用起来!");
// article.setUrl("http://mp.weixin.qq.com/s/gl_NitQTP6_ZzoV8pwxOcw");
// article.setPicurl("http://mmbiz.qpic.cn/mmbiz_jpg/5kpYU2jcMVicNybruqia0dn6kBqiakDlrTgDkweiafibyRl9uK6bkKoiaXib0xktJIywqTDzfe9fHcq5x0gggKkurDicpg/0?wx_fmt=jpeg");
// articleList.add(article);
// }
// }
// }
//
// XMLNewsMessage msg = new XMLNewsMessage(fromUserName, toUserName, articleList);
// msg.outputStreamWrite(outStream);
// }
//
//}