Parcourir la source

中山处方上传加特殊病种

wangzhinan il y a 1 mois
Parent
commit
90f704f913

+ 34 - 0
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/patient/PatientNoLoginEndPoint.java

@ -265,6 +265,40 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
    @Autowired
    private HttpClientUtil httpClientUtil;
    /**
     * 获取微信小程序openid
     *
     * @param code
     * @return
     */
    @RequestMapping(value = "/getXOpenidByCode", method = {RequestMethod.POST, RequestMethod.GET})
    public Envelop getXOpenidByCode(String code){
        try {
            //通过redis获取openid, 获取不到,则调用微信接口去取
            String key = wxId+":code";
            String openid = redisTemplate.opsForValue().get(key);
            if(!org.apache.commons.lang3.StringUtils.isEmpty(openid)){
                return success(PatientRequestMapping.Wechat.api_success,openid);
            }
            org.json.JSONObject json = wechatInfoService.getXOpenidByCode(code, wxId);
            if(json.has("openid")){
                openid = json.getString("openid");
                JSONObject res = new JSONObject();
                res.put("openid",openid);
                res.put("unionid",json.getString("unionid"));
                res.put("session_key",json.getString("session_key"));
                redisTemplate.opsForValue().set(key,openid);
                redisTemplate.expire(key,10, TimeUnit.SECONDS);
                return success(PatientRequestMapping.Wechat.api_success,res);
            }else {
                return Envelop.getError("获取失败");
            }
        } catch (Exception e){
            return  failedException2(e);
        }
    }
    @GetMapping(value = "findHospitalByZJ")
    @ApiOperation(value = "查找有专家问诊排班的医院", notes = "查找有专家问诊排班的医院")
    public MixEnvelop findHospitalByZJ(@ApiParam(name = "iswork", value = "是否过滤排班,1是")