Jelajahi Sumber

Merge branch 'dev' of http://192.168.1.220:10080/Amoy2/wlyy2.0 into dev

# Conflicts:
#	business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/entrance/XzzxEntranceService.java
#	svr/svr-internet-hospital-entrance/src/main/java/com/yihu/jw/entrance/controller/XzzxCotroller.java
wangzhinan 4 tahun lalu
induk
melakukan
cbc41bba77

+ 1 - 0
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/prescription/PrescriptionEndpoint.java

@ -1897,6 +1897,7 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
        } catch (Exception e) {
            return ObjEnvelop.getError(e.getMessage());
        }
    }

+ 78 - 0
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/wechat/WechatMenuController.java

@ -0,0 +1,78 @@
package com.yihu.jw.hospital.endpoint.wechat;
import com.yihu.jw.entity.base.wx.WxAccessTokenDO;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import com.yihu.jw.util.wechat.wxhttp.HttpUtil;
import com.yihu.jw.wechat.service.WxAccessTokenService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStreamReader;
/**
 * Created by chenweida on 2017/8/4.
 */
@RestController
@RequestMapping(value = "/wechat/menu", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
@Api(description = "微信菜单相关管理")
public class WechatMenuController extends EnvelopRestEndpoint {
    private static String wechat_token ="xAeQrX7uOD0OusIZ5JUQzrLPYIQBlqbS" ;
    @Autowired
    private HttpUtil httpUtil;
    @Autowired
    private WxAccessTokenService wxAccessTokenService;
    @Value("${wechat.id}")
    private String wechatId;
    /**
     * 微信菜单创建
     *
     * @return
     */
    @ApiOperation(value = "微信菜单创建")
    @RequestMapping(value = "/menu/create", method = RequestMethod.GET)
    public String createMenuTest() {
        try {
            WxAccessTokenDO wxAccessTokenDO = wxAccessTokenService.getWxAccessTokenById(wechatId);
            String filePath = WechatCoreController.class.getResource("/").getPath() +
                    File.separator + "wechat" + File.separator + "weixin_menu.txt";
            String url = " https://api.weixin.qq.com/cgi-bin/menu/create?access_token=" + wxAccessTokenDO.getAccessToken();
            // 读取微信菜单配置文件
            InputStreamReader reader = new InputStreamReader(new FileInputStream(filePath), "utf-8");
            BufferedReader bufferedReader = new BufferedReader(reader);
            String params = "";
            String readTxt = "";
            // 读取微信菜单
            while ((readTxt = bufferedReader.readLine()) != null) {
                System.out.println(readTxt);
                params += readTxt;
            }
            bufferedReader.close();
            reader.close();
            // 请求微信接口创建菜单
            String jsonStr = httpUtil.sendPost(url, params);
            JSONObject result = new JSONObject(jsonStr);
            if (result != null && result.get("errcode").toString().equals("0") && result.getString("errmsg").equals("ok")) {
                return  "创建成功!";
            } else {
                return "创建失败!";
            }
        } catch (Exception e) {
            return  "创建失败";
        }
    }
}

+ 60 - 0
svr/svr-internet-hospital/src/main/resources/wechat/weixin_menu.txt

@ -0,0 +1,60 @@
{
"button":[
   {
	  "name":"掌上医院",
	  "type":"view",
      "url":"https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxa67b466e6ab64bba&redirect_uri=https%3A%2F%2Fintel.yanketong.com%2Fims-wx%2F%23%2FzsIndex&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=wxa67b466e6ab64bba&redirect_uri=https%3A%2F%2Fintel.yanketong.com%2Fims-wx%2F%23%2Fappointment%2FhospitalList&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect"
         },
		 {
            	"type":"view",
         	    "name":"充值缴费",
         		"url":"https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxa67b466e6ab64bba&redirect_uri=https%3A%2F%2Fintel.yanketong.com%2Fims-wx%2F%23%2FmedicalCard%2Findex&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect"
         },
		 {
                "type":"view",
               	"name":"专家咨询",
               	"url":"https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxa67b466e6ab64bba&redirect_uri=https%3A%2F%2Fintel.yanketong.com%2Fims-wx%2F%23%2FnDocList%3Fzjzx%3D2&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect"
         },
         {
                "type":"view",
                "name":"在线复诊",
                "url":"https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxa67b466e6ab64bba&redirect_uri=https%3A%2F%2Fintel.yanketong.com%2Fims-wx%2F%23%2FnDocList%3FisFz%3D1&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=wxa67b466e6ab64bba&redirect_uri=https%3A%2F%2Fintel.yanketong.com%2Fims-wx%2F%23%2Fpersonal%2Findex&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect"
         },
         {
        		"type":"view",
        		"name":"APP下载",
        		"url":"http://www.yanketong.com/app/yk.htm"
         },
         {
                "type":"view",
                "name":"报告查询",
                "url":"https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxa67b466e6ab64bba&redirect_uri=https%3A%2F%2Fintel.yanketong.com%2Fims-wx%2F%23%2FonlineCheck%2Findex&response_type=code&scope=snsapi_base&state=1#wechat_redirect"
         },
         {
               	"type":"view",
                "name":"家庭成员管理",
                "url":"https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxa67b466e6ab64bba&redirect_uri=https%3A%2F%2Fintel.yanketong.com%2Fims-wx%2F%23%2FfamilyControl%2Findex&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect"
         }
	 ]
  }
]
}