LAPTOP-KB9HII50\70708 11 ヶ月 前
コミット
cfc44df500

+ 21 - 68
server/svr-authentication/src/main/java/com/yihu/jw/security/oauth2/provider/endpoint/WlyyLoginEndpoint.java

@ -2296,74 +2296,6 @@ public class WlyyLoginEndpoint extends AbstractEndpoint {
    }
    /*@RequestMapping(value = "/oauth/registerPatientAndLogin", method = RequestMethod.POST)
    public ObjEnvelop registerPatientAndLogin(String name, String mobile, String idcard, String ssc, String pw,String client_id,String login_type,String captcha,String openid,String wxId)throws Exception{
        if (StringUtils.isEmpty(client_id)) {
            throw new InvalidRequestException("client_id is null");
        }
        if (wlyyRedisVerifyCodeService.verification(client_id, mobile, captcha)) {
            //验证码正确
        } else {
            return ObjEnvelop.getError("验证码错误!");
        }
        try {
            Map<String,Object> rs = registerService.registerPatient(name,mobile,idcard,ssc,pw,openid,wxId,captcha);
            String code = rs.get("code").toString();
            if(!"1".equals(code)){
                ObjEnvelop objEnvelop = new ObjEnvelop();
                objEnvelop.setObj(rs);
                objEnvelop.setStatus(-1);
                objEnvelop.setMessage(rs.get("mes")+"");
                return objEnvelop;
            }
            BasePatientDO patientDO = (BasePatientDO)rs.get("patient");
            ClientDetails authenticatedClient = clientDetailsService.loadClientByClientId(client_id);
            Map<String, String> parameters = new HashedMap();
            parameters.put("username",patientDO.getIdcard());
            parameters.put("grant_type", "ihealthCode");
            TokenRequest tokenRequest = oAuth2RequestFactory.createTokenRequest(parameters, authenticatedClient);
            if (authenticatedClient != null) {
                oAuth2RequestValidator.validateScope(tokenRequest, authenticatedClient);
            }
            OAuth2AccessToken token = getTokenGranter().grant(tokenRequest.getGrantType(), tokenRequest);
            if (token == null) {
                throw new UnsupportedGrantTypeException("Unsupported grant type: " + tokenRequest.getGrantType());
            }
            WlyyUserSimple wlyyUserSimple = userDetailsService.authSuccess(parameters.get("username"));
            wlyyUserSimple.setAccessToken(token.getValue());
            wlyyUserSimple.setTokenType(token.getTokenType());
            wlyyUserSimple.setExpiresIn(token.getExpiresIn());
            wlyyUserSimple.setRefreshToken(token.getRefreshToken().getValue());
            wlyyUserSimple.setUser(parameters.get("username"));
            String loginType = parameters.get("login_type");
            BaseLoginLogDO baseLoginLogDO = new BaseLoginLogDO();
            userDetailsService.setRolePhth(loginType, token, wlyyUserSimple.getId(), redisTemplate);
            baseLoginLogDO.setUserId(wlyyUserSimple.getId());
            baseLoginLogDO.setCreateTime(new Date());
            String userAgent = JSONObject.toJSONString(wlyyUserSimple);
            baseLoginLogDO.setUserAgent(userAgent);
            baseLoginLogDO.setLoginType(loginType);
            baseLoginLogService.save(baseLoginLogDO);
            return ObjEnvelop.getSuccess("success",wlyyUserSimple);
        }catch (Exception e){
            e.printStackTrace();
        }
        return ObjEnvelop.getError("登录失败!");
    }*/
    @RequestMapping(value = "/oauth/registerPatientAndLogin", method = RequestMethod.POST)
    public ObjEnvelop registerPatientAndLogin(String name, String mobile, String idcard, String cardType, String ssc, String pw,
                                              String client_id, String login_type, String captcha, String openid, String wxId
@ -2521,6 +2453,27 @@ public class WlyyLoginEndpoint extends AbstractEndpoint {
    public Envelop findPatientPw(String mobile, String client_id, String login_type, String captcha
            , String pw, String key, String idcard, String text) {
        try {
            if ("xm_dsyy_wx".equalsIgnoreCase(wechatId)) {
                WlyyHospitalSysDictDO wlyyHospitalSysDictDO = wlyyhospitalSysdictDao.findDictById("isNeedSMS");
                if (wlyyHospitalSysDictDO != null && !StringUtils.isEmpty(wlyyHospitalSysDictDO.getDictValue())) {
                    if (captcha.equalsIgnoreCase(wlyyHospitalSysDictDO.getDictValue())) {
                    } else {
                        return ObjEnvelop.getError("验证码错误!");
                    }
                } else {
                    if (wlyyRedisVerifyCodeService.verification(client_id, mobile, captcha)) {
                        //验证码正确
                    } else {
                        return ObjEnvelop.getError("验证码错误!");
                    }
                }
                String rs = registerService.updateDoctorPw(mobile, pw, wechatId);
                if ("ok".equals(rs)) {
                    return ObjEnvelop.getSuccess("修改成功!");
                }
                return ObjEnvelop.getError("手机号未注册!");
            }
            if (StringUtils.isEmpty(idcard)) {
                return ObjEnvelop.getError("手机号码不能为空!");
            }

+ 4 - 0
server/svr-authentication/src/main/java/com/yihu/jw/security/service/RegisterService.java

@ -149,6 +149,10 @@ public class RegisterService {
            }
            BasePatientDO patient = new BasePatientDO();
            String salt = UUID.randomUUID().toString().substring(0, 5);
            if(StringUtils.isBlank(pw)){
                //三院注册不需要密码 默认密码aza354q.
                pw = "aza354q.";
            }
            patient.setPassword(MD5.md5Hex(pw + "{" + salt + "}"));
            patient.setSalt(salt);
            patient.setCardType(cardType);

+ 2 - 2
svr/svr-visit-behind/src/main/java/com/yihu/jw/hospital/module/health/service/scheme/DoctorSchemeService.java

@ -2271,7 +2271,7 @@ public class DoctorSchemeService {
                "INNER join wlyy_patient_label l on l.patient=a.id AND l.label_type='2' " +
                "left join wlyy_track_patient t on t.doctor_code='"+doctorId+"' and t.patient_code=a.id AND t.del='1' " +
                "WHERE 1=1\n" +
                "AND a.standard_status>0 " +
                "AND a.standard_status in (1,3) " +
                "and l.label_name='高血压' " +
                "AND b.doctor ='" + doctorId + "'";
        // 高血压
@ -2291,7 +2291,7 @@ public class DoctorSchemeService {
                "INNER join wlyy_patient_label l on l.patient=a.id AND l.label_type='2' " +
                "left join wlyy_track_patient t on t.doctor_code='"+doctorId+"' and t.patient_code=a.id AND t.del='1' " +
                "WHERE 1=1\n" +
                "AND a.standard_status>0 " +
                "AND a.standard_status in (2,3) " +
                "and l.label_name='糖尿病' " +
                "AND b.doctor ='" + doctorId + "'";
        // 糖尿病