浏览代码

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

# Conflicts:
#	svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/patient/PatientNoLoginEndPoint.java
wangzhinan 4 年之前
父节点
当前提交
c590c15bdf

+ 7 - 1
server/svr-authentication/src/main/java/com/yihu/jw/security/core/userdetails/jdbc/WlyyUserDetailsService.java

@ -154,7 +154,6 @@ public class WlyyUserDetailsService extends JdbcDaoSupport implements UserDetail
    public List<WlyyUserDetails> getWlyyUserDetails(String username) {
        String loginType = getLogintype();
        List<WlyyUserDetails> users = null;
        //1或默认查找user表,为平台管理员账号
        if (StringUtils.isBlank(loginType) || "1".equals(loginType)) {
@ -488,6 +487,9 @@ public class WlyyUserDetailsService extends JdbcDaoSupport implements UserDetail
                        }
                );
            }
        }else if("6".equals(loginType)) {
            //第三方登陆
            users = this.getJdbcTemplate().query(DEFAULT_PATIENT_DETAILS_STATEMENT, new BeanPropertyRowMapper(WlyyUserDetails.class), username, username);
        }
        return users;
    }
@ -646,6 +648,10 @@ public class WlyyUserDetailsService extends JdbcDaoSupport implements UserDetail
            //更新登录时间
            this.getJdbcTemplate().update("update base_patient p set p.login_failure_count = 0, p.login_date = ? where p.mobile = ? or p.idcard = ?", new Date(), username, username);
            users = this.getJdbcTemplate().query(DEFAULT_PATIENT_DETAILS_STATEMENT, new BeanPropertyRowMapper(WlyyUserSimple.class), username,username);
        }else if("6".equals(loginType)) {
            //第三方登陆
            this.getJdbcTemplate().update("update base_patient p set p.login_failure_count = 0, p.login_date = ? where p.mobile = ? or p.idcard = ?", new Date(), username, username);
            users = this.getJdbcTemplate().query(DEFAULT_PATIENT_DETAILS_STATEMENT, new BeanPropertyRowMapper(WlyyUserSimple.class), username,username);
        }
        logger.info("login:登录进入6");

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

@ -25,10 +25,7 @@ import com.yihu.jw.security.oauth2.core.redis.WlyyRedisVerifyCodeService;
import com.yihu.jw.security.oauth2.provider.WlyyTokenGranter;
import com.yihu.jw.security.oauth2.provider.error.WlyyOAuth2ExceptionTranslator;
import com.yihu.jw.security.service.*;
import com.yihu.jw.security.utils.AES;
import com.yihu.jw.security.utils.DateUtil;
import com.yihu.jw.security.utils.IdCardUtil;
import com.yihu.jw.security.utils.SerializeUtil;
import com.yihu.jw.security.utils.*;
import com.yihu.jw.sms.service.YkyyINSMSService;
import com.yihu.jw.sms.service.ZBSmsService;
import com.yihu.jw.sms.service.ZhongShanSMSService;
@ -1185,6 +1182,75 @@ public class WlyyLoginEndpoint extends AbstractEndpoint {
    }
    /**
     * 医联康护授权登录
     * @param authCode
     * @param client_id
     * @return
     */
    @RequestMapping(value = "/oauth/ylkhLogin", method = RequestMethod.POST)
    public ObjEnvelop getYlkhDecrypt(String authCode,String client_id) {
        if (StringUtils.isEmpty(client_id)) {
            throw new InvalidRequestException("client_id is null");
        }
        try {
            logger.info("authCode :"+authCode);
            //固定秘钥解密
            String key = "FEA5049E4CCD16A9";
            String result = AesEncryptUtils.decrypt(authCode,key);
            logger.info("wjwLogin :"+result);
            BasePatientDO patientDO = oauthWjwConfigService.savePatient(result);
            if(patientDO == null){
                return ObjEnvelop.getError("授权登录失败!");
            }
            ClientDetails authenticatedClient = clientDetailsService.loadClientByClientId(client_id);
            Map<String, String> parameters = new HashedMap();
            parameters.put("username",patientDO.getIdcard());
            parameters.put("grant_type", "ihealthCode");
            parameters.put("login_type","4");
            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){
            logger.error(e);
        }
        return ObjEnvelop.getError("登录失败!");
    }
//        /**
//         * 获取易联众授权码
//         * @return

+ 37 - 1
server/svr-authentication/src/main/java/com/yihu/jw/security/service/OauthWjwConfigService.java

@ -3,7 +3,9 @@ package com.yihu.jw.security.service;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.hospital.family.WlyyPatientFamilyMemberDO;
import com.yihu.jw.security.dao.patient.BasePatientDao;
import com.yihu.jw.security.dao.patient.WlyyPatientFamilyMemberDao;
import com.yihu.jw.security.utils.AES;
import com.yihu.jw.security.utils.IdCardUtil;
import com.yihu.utils.security.MD5;
@ -32,6 +34,8 @@ public class OauthWjwConfigService {
    @Autowired
    private BasePatientDao basePatientDao;
    @Autowired
    private WlyyPatientFamilyMemberDao familyMemberDao;
    public BasePatientDO savePatient(String data)throws Exception{
        logger.info("savePatient :"+data);
@ -52,7 +56,24 @@ public class OauthWjwConfigService {
            if(StringUtils.isNotBlank(userIdNo)){
                BasePatientDO basePatientDO = basePatientDao.findByIdcardAndDel(userIdNo,"1");
                logger.info("12312321321===="+userIdNo);
                if(basePatientDO!=null){
                    WlyyPatientFamilyMemberDO basePatientFamilyMemberDO = familyMemberDao.findFamilyMemberByPatientAndRelationCode(basePatientDO.getId(),"7");
                    if (basePatientFamilyMemberDO==null){
                        basePatientFamilyMemberDO = new WlyyPatientFamilyMemberDO();
                        basePatientFamilyMemberDO.setPatient(basePatientDO.getId());
                        basePatientFamilyMemberDO.setFamilyRelation("7");
                        basePatientFamilyMemberDO.setFamilyRelationName("自己");
                        basePatientFamilyMemberDO.setCardType("身份证");
                        basePatientFamilyMemberDO.setCardNo(basePatientDO.getIdcard());
                        basePatientFamilyMemberDO.setCreateTime(new Date());
                        basePatientFamilyMemberDO.setUpdateTime(new Date());
                        basePatientFamilyMemberDO.setIsAuthorize(1);
                        basePatientFamilyMemberDO.setIsDel(1);
                        basePatientFamilyMemberDO.setFamilyMember(basePatientDO.getId());
                        familyMemberDao.save(basePatientFamilyMemberDO);
                    }
                    logger.info("==================");
                    return basePatientDO;
                }
@ -75,7 +96,22 @@ public class OauthWjwConfigService {
                patient.setBirthday(IdCardUtil.getBirthdayForIdcard(userIdNo));
                patient.setSex(Integer.parseInt(IdCardUtil.getSexForIdcard_new(userIdNo)));
                basePatientDao.save(patient);
                patient = basePatientDao.save(patient);
                WlyyPatientFamilyMemberDO basePatientFamilyMemberDO = familyMemberDao.findFamilyMemberByPatientAndRelationCode(patient.getId(),"7");
                if (basePatientFamilyMemberDO==null){
                    basePatientFamilyMemberDO = new WlyyPatientFamilyMemberDO();
                    basePatientFamilyMemberDO.setPatient(patient.getId());
                    basePatientFamilyMemberDO.setFamilyRelation("7");
                    basePatientFamilyMemberDO.setFamilyRelationName("自己");
                    basePatientFamilyMemberDO.setCardType("身份证");
                    basePatientFamilyMemberDO.setCardNo(patient.getIdcard());
                    basePatientFamilyMemberDO.setCreateTime(new Date());
                    basePatientFamilyMemberDO.setUpdateTime(new Date());
                    basePatientFamilyMemberDO.setIsAuthorize(1);
                    basePatientFamilyMemberDO.setIsDel(1);
                    basePatientFamilyMemberDO.setFamilyMember(patient.getId());
                    familyMemberDao.save(basePatientFamilyMemberDO);
                }
                return basePatientDO;

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

@ -5,7 +5,7 @@
            "sub_button":[
                {
                    "type":"miniprogram",
                    "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",
                    "url":"https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxa67b466e6ab64bba&redirect_uri=https%3A%2F%2Fwww.yankehao.com%2Fims-wx%2F%23%2FzsIndex&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect",
                    "appid":"wx5329829ab3d77bc2",
                    "pagepath":"pages/patient/index",
                    "name":"互联网医院"
@ -23,27 +23,27 @@
                {
                    "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%2ffamilyMember%2findex%3ftype%3dnucleicTest&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect"
                    "url":"https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxa67b466e6ab64bba&redirect_uri=https%3a%2f%2fwww.yankehao.com%2fims-wx%2f%23%2fpersonal%2ffamilyMember%2findex%3ftype%3dnucleicTest&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%2Fappointment%2FhospitalList&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect"
                    "url":"https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxa67b466e6ab64bba&redirect_uri=https%3A%2F%2Fwww.yankehao.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"
                    "url":"https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxa67b466e6ab64bba&redirect_uri=https%3A%2F%2Fwww.yankehao.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"
                    "url":"https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxa67b466e6ab64bba&redirect_uri=https%3A%2F%2Fwww.yankehao.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"
                    "url":"https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxa67b466e6ab64bba&redirect_uri=https%3A%2F%2Fwww.yankehao.com%2Fims-wx%2F%23%2FnDocList%3FisFz%3D1&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect"
                }
            ]
        },
@ -53,7 +53,7 @@
                {
                    "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"
                    "url":"https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxa67b466e6ab64bba&redirect_uri=https%3A%2F%2Fwww.yankehao.com%2Fims-wx%2F%23%2Fpersonal%2Findex&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect"
                },
                {
                    "type":"view",
@ -63,12 +63,12 @@
                {
                    "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"
                    "url":"https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxa67b466e6ab64bba&redirect_uri=https%3A%2F%2Fwww.yankehao.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"
                    "url":"https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxa67b466e6ab64bba&redirect_uri=https%3A%2F%2Fwww.yankehao.com%2Fims-wx%2F%23%2FfamilyControl%2Findex&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect"
                }
            ]
        }