trick9191 7 年之前
父节点
当前提交
0e62e1c1f5

+ 7 - 3
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/weixin/WeiXinCoreService.java

@ -12,6 +12,8 @@ import org.dom4j.Element;
import org.dom4j.io.SAXReader;
import org.json.JSONException;
import org.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -31,6 +33,8 @@ public class WeiXinCoreService extends BaseService {
    @Autowired
    private WeiXinEventProcess weiXinEventProcess;
    private Logger logger= LoggerFactory.getLogger( WeiXinCoreService.class);
    /**
     * 微信推送消息处理
     *
@ -82,7 +86,7 @@ public class WeiXinCoreService extends BaseService {
    private String messageProcess(Map<String, String> message) throws Exception {
        String msgType = message.get("MsgType");
        String result = "";
        logger.info("msgType:"+msgType);
        switch (msgType) {
            case WeiXinMessageUtils.REQ_MESSAGE_TYPE_EVENT:  // 事件消息
                result = weiXinEventProcess.eventProcess(message);
@ -91,9 +95,9 @@ public class WeiXinCoreService extends BaseService {
                String content = message.get("Content");
                if ("续签".equals(content)){
//                      发送续签和签约图文消息
                    System.out.print("content======? "+content);
                    logger.info("content======? "+content);
                    result = weiXinEventProcess.replyKeyword(message);
                    System.out.print("图文结束======? ");
                    logger.info("图文结束======? ");
                }
                break;
            default:

+ 2 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/concern/DoctorConcernController.java

@ -58,6 +58,7 @@ public class DoctorConcernController extends BaseController {
                jsonObject.put("address", patient.getAddress());
                jsonObject.put("age", IdCardUtil.getAgeForIdcard(patient.getIdcard()));
                jsonObject.put("isWX", StringUtils.isEmpty(patient.getOpenid()) ? false : true);
                jsonObject.put("deviceType", 0);//绑定设备
                jsonObject.put("concernCode", patient.getConcernCode());
                jsonObject.put("concernTime", DateUtil.dateToStr(patient.getConcernCreateTime(), "yyyy-MM-dd HH:mm:ss"));
@ -118,6 +119,7 @@ public class DoctorConcernController extends BaseController {
            jsonObject.put("address", patient.getAddress());//患者详细地址
            jsonObject.put("age", IdCardUtil.getAgeForIdcard(patient.getIdcard()));//患者年龄
            jsonObject.put("isWX", StringUtils.isEmpty(patient.getOpenid()) ? false : true);//是否关注微信
            jsonObject.put("deviceType", 0);//绑定设备
            jsonObject.put("concernType", concernDO.getConcernSource());//关注类型
            jsonObject.put("concernTypeName", concernDO.getConcernSourceName());//关注类型

+ 6 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/wx/WechatCoreController.java

@ -7,6 +7,8 @@ import com.yihu.wlyy.web.WeixinBaseController;
import io.swagger.annotations.Api;
import org.apache.commons.lang3.StringUtils;
import org.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.MediaType;
@ -30,6 +32,7 @@ import java.util.Arrays;
@Api(description = "微信")
public class WechatCoreController extends WeixinBaseController {
    private Logger logger= LoggerFactory.getLogger(WeixinBaseController.class);
    @Autowired
    private WeiXinCoreService weiXinCoreService;
    @Value("${wechat.wechat_token}")
@ -83,7 +86,9 @@ public class WechatCoreController extends WeixinBaseController {
            String signature = request.getParameter("signature").toString();
            String timestamp = request.getParameter("timestamp").toString();
            String nonce = request.getParameter("nonce").toString();
            logger.info("signature:"+signature);
            logger.info("timestamp:"+timestamp);
            logger.info("nonce:"+nonce);
            if (validate(signature, timestamp, nonce)) {
                String xmlStr = weiXinCoreService.messageProcess(request, getAccessToken());
                // 判断返回值是xml、json格式(取关是空串)

+ 35 - 35
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/wechat/process/WeiXinEventProcess.java

@ -132,23 +132,23 @@ public class WeiXinEventProcess {
        articles.add(articleConsult);
//        Map<String, String> articleBooking = new HashMap<>();
//        // 图文URL
//        String urlBooking = systemConf.getProperty("patient_booking_url");
//        // 图文消息图片URL
//        String picUrlBooking = systemConf.getProperty("patient_booking_pic_url");
//        // URL设置服务器URL、AppId
//        urlBooking = urlBooking.replace("{server}", wechat_base_url)
//                .replace("{appId}", appId);
//        //图片地址
//        picUrlBooking = picUrlBooking.replace("{server}", serverUrl);
//
//        articleBooking.put("Url", urlBooking);
//        articleBooking.put("Title", "预约挂号功能使用说明");
//        articleBooking.put("Description", "功能使用说明");
//        articleBooking.put("PicUrl", picUrlBooking);
//
//        articles.add(articleBooking);
        Map<String, String> articleBooking = new HashMap<>();
        // 图文URL
        String urlBooking = systemConf.getProperty("patient_booking_url");
        // 图文消息图片URL
        String picUrlBooking = systemConf.getProperty("patient_booking_pic_url");
        // URL设置服务器URL、AppId
        urlBooking = urlBooking.replace("{server}", wechat_base_url)
                .replace("{appId}", appId);
        //图片地址
        picUrlBooking = picUrlBooking.replace("{server}", serverUrl);
        articleBooking.put("Url", urlBooking);
        articleBooking.put("Title", "预约挂号功能使用说明");
        articleBooking.put("Description", "功能使用说明");
        articleBooking.put("PicUrl", picUrlBooking);
        articles.add(articleBooking);
        Map<String, String> articleDevice = new HashMap<>();
        // 图文URL
@ -400,7 +400,7 @@ public class WeiXinEventProcess {
            //设置共有的图文消息
            setUrlItems(articles, systemConf);
            //setWifi(message.get("FromUserName"),articles,systemConf);
            setWifi(message.get("FromUserName"),articles,systemConf);
            // 构建回复消息XML
            result = WeiXinMessageReplyUtils.replyNewsMessage(message.get("FromUserName"), message.get("ToUserName"), articles);
        }else if (StringUtils.isNotEmpty(eventKey) && (("wechat_draw").equals(eventKey)) ||
@ -549,23 +549,23 @@ public class WeiXinEventProcess {
        articles.add(articleConsult);
//        Map<String, String> articleBooking = new HashMap<>();
//        // 图文URL
//        String urlBooking = systemConf.getProperty("patient_booking_url");
//        // 图文消息图片URL
//        String picUrlBooking = systemConf.getProperty("patient_booking_pic_url");
//        // URL设置服务器URL、AppId
//        urlBooking = urlBooking.replace("{server}", wechat_base_url)
//                .replace("{appId}", appId);
//        //图片地址
//        picUrlBooking = picUrlBooking.replace("{server}", serverUrl);
//
//        articleBooking.put("Url", urlBooking);
//        articleBooking.put("Title", "预约挂号功能使用说明");
//        articleBooking.put("Description", "功能使用说明");
//        articleBooking.put("PicUrl", picUrlBooking);
//
//        articles.add(articleBooking);
        Map<String, String> articleBooking = new HashMap<>();
        // 图文URL
        String urlBooking = systemConf.getProperty("patient_booking_url");
        // 图文消息图片URL
        String picUrlBooking = systemConf.getProperty("patient_booking_pic_url");
        // URL设置服务器URL、AppId
        urlBooking = urlBooking.replace("{server}", wechat_base_url)
                .replace("{appId}", appId);
        //图片地址
        picUrlBooking = picUrlBooking.replace("{server}", serverUrl);
        articleBooking.put("Url", urlBooking);
        articleBooking.put("Title", "预约挂号功能使用说明");
        articleBooking.put("Description", "功能使用说明");
        articleBooking.put("PicUrl", picUrlBooking);
        articles.add(articleBooking);
        Map<String, String> articleDevice = new HashMap<>();
        // 图文URL

+ 4 - 49
patient-co/patient-co-wlyy/src/main/resources/wechat/weixin_menu.txt

@ -5,80 +5,35 @@
	  "sub_button":[
		  {
			"type":"view",
			"name":"签约管理",
			"name":"咨询医生",
			"url":"https://open.weixin.qq.com/connect/oauth2/authorize?appid=appId&redirect_uri=server_url%2fwx%2fhtml%2fqygl%2fhtml%2fsigning_management.html&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect"
		  },
		  {
			"type":"view",
			"name":"医生咨询",
			"name":"关注咨询",
			"url":"https://open.weixin.qq.com/connect/oauth2/authorize?appid=appId&redirect_uri=server_url%2fwx%2fhtml%2fyszx%2fhtml%2fdoctor-consultation.html&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect"
		  },
		  {
			"type":"view",
			"name":"医生指导",
			"name":"我的关注",
			"url":"https://open.weixin.qq.com/connect/oauth2/authorize?appid=appId&redirect_uri=server_url%2fwx%2fhtml%2fyszd%2fhtml%2fdoctor-guidance.html&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect"
		  },
		  {
            "type":"view",
            "name":"健教文库",
            "name":"查找医生",
            "url":"https://open.weixin.qq.com/connect/oauth2/authorize?appid=appId&redirect_uri=server_url%2fwx%2fhtml%2fjkjy%2fhtml%2farticle_list.html&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect"
          }
	  ]
   },
   {
	  "name":"健康管理",
	  "sub_button":[
		 {
			  "type":"view",
			  "name":"预约挂号",
			  "url":"https://open.weixin.qq.com/connect/oauth2/authorize?appid=appId&redirect_uri=server_url%2fwx%2fhtml%2fwdyy%2fhtml%2fappointment-register.html&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect"
		 },
		 {
               "type":"view",
               "name":"健康记录",
               "url":"https://open.weixin.qq.com/connect/oauth2/authorize?appid=appId&redirect_uri=server_url%2fwx%2fhtml%2fjkjl%2fhtml%2fhealth-record.html&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect"
         },
		{
			"type":"click",
			"name":"健康档案",
			"key":"jiankangdangan"
		},
         {
            "type":"view",
            "name":"慢病管理",
            "url":"https://open.weixin.qq.com/connect/oauth2/authorize?appid=appId&redirect_uri=server_url%2fwx%2fhtml%2fjbsq%2fhtml%2fslow-disease-manage.html&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect"
                  },
        {
            "type":"click",
            "name":"妇幼保健",
            "key":"fuyoubaojian"
        }
	  ]
   },
   {
	  "name":"我的",
	  "sub_button":[
		{
           "type":"view",
           "name":"电子健康卡",
           "url":"https://open.weixin.qq.com/connect/oauth2/authorize?appid=appId&redirect_uri=server_url%2fwx%2fhtml%2fgrzx%2fhtml%2fmy-health-card.html&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect"
        },
		{
		   "type":"view",
		   "name":"我的资料",
		   "url":"https://open.weixin.qq.com/connect/oauth2/authorize?appid=appId&redirect_uri=server_url%2fwx%2fhtml%2fgrzx%2fhtml%2fmy-detail.html&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect"
		},
        {
           "type":"view",
           "name":"我的家庭",
           "url":"https://open.weixin.qq.com/connect/oauth2/authorize?appid=appId&redirect_uri=server_url%2fwx%2fhtml%2fjtgx%2fhtml%2ffamily.html&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect"
        },
		{
		   "type":"view",
		   "name":"我的设备",
		   "url":"https://open.weixin.qq.com/connect/oauth2/authorize?appid=appId&redirect_uri=server_url%2fwx%2fhtml%2fwdsb%2fhtml%2fmy-equipments.html&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect"
		},
        {
         	"type":"click",
         	"name":"操作说明",