Commit 1392bc1d15b8daf1b7e8a749dca88841a3051d03

Authored by shiyang
1 parent 6e70ba2609
Exists in master

查询患者是否关注了公众号

Showing 1 changed file with 27 additions and 0 deletions

talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/PatientController.java View file @ 1392bc1
... ... @@ -14,6 +14,7 @@
14 14 import com.lyms.talkonlineweb.result.BaseResponse;
15 15 import com.lyms.talkonlineweb.result.PatientPcaseResult;
16 16 import com.lyms.talkonlineweb.service.*;
  17 +import com.lyms.talkonlineweb.task.AccessTokenServlet;
17 18 import com.lyms.talkonlineweb.util.*;
18 19 import com.mysql.cj.Query;
19 20 import lombok.extern.log4j.Log4j2;
... ... @@ -1042,6 +1043,32 @@
1042 1043 baseResponse.setErrormsg("保存异常!");
1043 1044 }
1044 1045 baseResponse.setErrorcode(0);
  1046 + baseResponse.setErrormsg("成功");
  1047 + return baseResponse;
  1048 + }
  1049 + /**
  1050 + * 查询患者是否关注了公众号
  1051 + *
  1052 + * @param patient
  1053 + * @return
  1054 + */
  1055 + @GetMapping("getPatientAttentionYn")
  1056 + @TokenRequired
  1057 + public BaseResponse getPatientAttentionYn(String gzopengId) {
  1058 + BaseResponse baseResponse = new BaseResponse();
  1059 + if (StringUtil.isNotEmpty(gzopengId)) {
  1060 + baseResponse.setErrorcode(1);
  1061 + baseResponse.setErrormsg("参数错误");
  1062 + return baseResponse;
  1063 + }
  1064 + if (StringUtil.isNotEmpty(AccessTokenServlet.accessToken)) {
  1065 + baseResponse.setErrorcode(1);
  1066 + baseResponse.setErrormsg("Token错误");
  1067 + return baseResponse;
  1068 + }
  1069 + String result = HttpUtil.getData("https://api.weixin.qq.com/cgi-bin/user/info?access_token="+AccessTokenServlet.accessToken+"&openid="+gzopengId+"&lang=zh_CN");
  1070 + baseResponse.setErrorcode(0);
  1071 + baseResponse.setObject(result);
1045 1072 baseResponse.setErrormsg("成功");
1046 1073 return baseResponse;
1047 1074 }