|
|
@ -1242,18 +1242,26 @@ public class WlyyLoginEndpoint extends AbstractEndpoint {
|
|
|
return new ResponseEntity<>(oauth2Envelop, headers, HttpStatus.OK);
|
|
|
}else {
|
|
|
if ("1".equalsIgnoreCase(isDoctor)){
|
|
|
String res = ykyyService.getResetCode("4",username);
|
|
|
String resltCode ="";
|
|
|
String captcha = "";
|
|
|
if (!StringUtils.isEmpty(res)){
|
|
|
JSONObject jsonObject = JSONObject.parseObject(res);
|
|
|
if ("10000".equalsIgnoreCase(jsonObject.getString("code"))){
|
|
|
captcha = jsonObject.getString("value");
|
|
|
resltCode = jsonObject.getString("code");
|
|
|
msg = "发送成功";
|
|
|
}
|
|
|
//发送短信获取验证码
|
|
|
String captcha = wlyyRedisVerifyCodeService.getCodeNumber();
|
|
|
// String res = ykyyService.getResetCode("4",username);
|
|
|
// String resltCode ="";
|
|
|
// String captcha = "";
|
|
|
// if (!StringUtils.isEmpty(res)){
|
|
|
// JSONObject jsonObject = JSONObject.parseObject(res);
|
|
|
// if ("10000".equalsIgnoreCase(jsonObject.getString("code"))){
|
|
|
// captcha = jsonObject.getString("value");
|
|
|
// resltCode = jsonObject.getString("code");
|
|
|
// msg = "发送成功";
|
|
|
// }
|
|
|
// }
|
|
|
ResultMsg result= null;
|
|
|
if("1".equals(type)){
|
|
|
result = ykyyINSMSService.ykyySendSMS(username,"您好,您的手机登录短信验证码是:"+captcha+",5分钟内有效。");
|
|
|
}else if("2".equals(type)) {
|
|
|
result = ykyyINSMSService.ykyySendSMS(username, "您好,您正在进行找回密码操作,您的短信验证码是:" + captcha + ",请勿将验证码告诉他人,5分钟内有效。");
|
|
|
}
|
|
|
if ("10000".equalsIgnoreCase(resltCode)) {
|
|
|
if (result.isSuccess()) {
|
|
|
|
|
|
Captcha _captcha = new Captcha();
|
|
|
_captcha.setCode(captcha);
|
|
|
@ -2780,17 +2788,26 @@ public class WlyyLoginEndpoint extends AbstractEndpoint {
|
|
|
@RequestMapping(value = "/oauth/findDoctorPw", method = RequestMethod.POST)
|
|
|
public Envelop findDoctorPw(String mobile,String client_id,String captcha,String pw) throws Exception{
|
|
|
if("xm_ykyy_wx".equalsIgnoreCase(wechatId)){
|
|
|
String response = ykyyService.ResetPwd(mobile,pw,captcha);
|
|
|
if (org.apache.commons.lang3.StringUtils.isNoneBlank(response)){
|
|
|
JSONObject object = JSONObject.parseObject(response);
|
|
|
if (object.getString("code").equalsIgnoreCase("10000")){
|
|
|
return ObjEnvelop.getSuccess("修改成功!");
|
|
|
WlyyHospitalSysDictDO wlyyHospitalSysDictDO = wlyyhospitalSysdictDao.findDictById("isNeedSMS");
|
|
|
if (wlyyHospitalSysDictDO!=null&&!StringUtils.isEmpty(wlyyHospitalSysDictDO.getDictValue())){
|
|
|
if (captcha.equalsIgnoreCase(wlyyHospitalSysDictDO.getDictValue())){
|
|
|
|
|
|
}else {
|
|
|
return ObjEnvelop.getError("修改失败!");
|
|
|
return ObjEnvelop.getError("验证码错误!");
|
|
|
}
|
|
|
}else {
|
|
|
return ObjEnvelop.getError("修改失败!");
|
|
|
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("手机号未注册!");
|
|
|
}else if ("xm_zsyy_wx".equalsIgnoreCase(wechatId)){
|
|
|
WlyyHospitalSysDictDO wlyyHospitalSysDictDO = wlyyhospitalSysdictDao.findDictById("isNeedSMS");
|
|
|
if (wlyyHospitalSysDictDO!=null&&!StringUtils.isEmpty(wlyyHospitalSysDictDO.getDictValue())){
|
|
|
@ -3398,32 +3415,33 @@ public class WlyyLoginEndpoint extends AbstractEndpoint {
|
|
|
BasePatientDO basePatientDO = new BasePatientDO();
|
|
|
if (basePatientDOS==null||basePatientDOS.size()==0){
|
|
|
basePatientDO.setDel("1");
|
|
|
basePatientDO.setName(infoData.getString("userName"));
|
|
|
basePatientDO.setName(infoData.getString("nickName"));
|
|
|
basePatientDO.setCreateTime(new Date());
|
|
|
basePatientDO.setUpdateTime(new Date());
|
|
|
basePatientDO.setYktId(infoData.getString("mainAccountId"));
|
|
|
basePatientDO.setUserId(infoData.getString("mainAccountId"));
|
|
|
basePatientDO.setIdcard(infoData.getString("idNo"));
|
|
|
String salt = UUID.randomUUID().toString().substring(0,5);
|
|
|
String idcard = infoData.getString("idNo");
|
|
|
Integer age = IdCardUtil.getAgeForIdcard(idcard);
|
|
|
String sex = IdCardUtil.getSexForIdcard_new(idcard);
|
|
|
Integer sexx = null;
|
|
|
if (org.apache.commons.lang3.StringUtils.isNoneBlank(sex)){
|
|
|
sexx = Integer.parseInt(sex);
|
|
|
if(org.apache.commons.lang3.StringUtils.isNoneBlank(idcard)){
|
|
|
String pw = idcard.substring(idcard.length()-6,idcard.length());
|
|
|
basePatientDO.setPassword(MD5.md5Hex(pw + "{" + salt + "}"));
|
|
|
Integer age = IdCardUtil.getAgeForIdcard(idcard);
|
|
|
String sex = IdCardUtil.getSexForIdcard_new(idcard);
|
|
|
Integer sexx = null;
|
|
|
if (org.apache.commons.lang3.StringUtils.isNoneBlank(sex)){
|
|
|
sexx = Integer.parseInt(sex);
|
|
|
}
|
|
|
basePatientDO.setAge(age);
|
|
|
basePatientDO.setSex(sexx);
|
|
|
}
|
|
|
basePatientDO.setIdcard(infoData.getString("idNo"));
|
|
|
String birthDay = infoData.getString("birthday");
|
|
|
Date birthday = null;
|
|
|
if (org.apache.commons.lang3.StringUtils.isNoneBlank(birthDay)){
|
|
|
birthday = DateUtil.strToDate(birthDay+" 00:00:00");;
|
|
|
}
|
|
|
basePatientDO.setAge(age);
|
|
|
basePatientDO.setBirthday(birthday);
|
|
|
basePatientDO.setSex(sexx);
|
|
|
basePatientDO.setMobile(mobile1);
|
|
|
String salt = UUID.randomUUID().toString().substring(0,5);
|
|
|
String pw = idcard.substring(idcard.length()-6,idcard.length());
|
|
|
basePatientDO.setIdcard(idcard);
|
|
|
basePatientDO.setPassword(MD5.md5Hex(pw + "{" + salt + "}"));
|
|
|
basePatientDO.setSalt(salt);
|
|
|
basePatientDO.setLocked(0);
|
|
|
basePatientDO.setEnabled(1);
|
|
|
@ -3431,6 +3449,7 @@ public class WlyyLoginEndpoint extends AbstractEndpoint {
|
|
|
basePatientDO.setAppletsOpenId(infoData.getString("openid"));
|
|
|
basePatientDO.setVerifyCode(accessToken);
|
|
|
basePatientDO = basePatientDao.save(basePatientDO);
|
|
|
oauthYlzConfigService.deleteMember(basePatientDO.getId());
|
|
|
JSONArray familyList = infoData.getJSONArray("patientAccountList");
|
|
|
if (familyList!=null&&familyList.size()!=0){
|
|
|
for (int i=0;i<familyList.size();i++){
|
|
|
@ -3453,7 +3472,7 @@ public class WlyyLoginEndpoint extends AbstractEndpoint {
|
|
|
|
|
|
Integer sexx1 = null;
|
|
|
if (org.apache.commons.lang3.StringUtils.isNoneBlank(sex1)){
|
|
|
sexx1 = Integer.parseInt(sex);
|
|
|
sexx1 = Integer.parseInt(sex1);
|
|
|
}
|
|
|
String birthDay1 = IdCardUtil.getBirthdayForIdcardStr(idcard1);
|
|
|
Date birthday1 = null;
|
|
|
@ -3527,8 +3546,10 @@ public class WlyyLoginEndpoint extends AbstractEndpoint {
|
|
|
}else {
|
|
|
basePatientDO = basePatientDOS.get(0);
|
|
|
basePatientDO.setVerifyCode(accessToken);
|
|
|
basePatientDO.setName(infoData.getString("nickName"));
|
|
|
basePatientDO.setAppletsOpenId(infoData.getString("openid"));
|
|
|
basePatientDao.save(basePatientDO);
|
|
|
oauthYlzConfigService.deleteMember(basePatientDO.getId());
|
|
|
JSONArray familyList = infoData.getJSONArray("patientAccountList");
|
|
|
if (familyList!=null&&familyList.size()!=0){
|
|
|
for (int i=0;i<familyList.size();i++){
|
|
|
@ -4322,84 +4343,85 @@ public class WlyyLoginEndpoint extends AbstractEndpoint {
|
|
|
KeyPair keyPair = (KeyPair) httpSession.getAttribute("privateKey");
|
|
|
String password = com.yihu.jw.security.utils.RSAUtils.decryptBase64(parameters.get("password"), keyPair);
|
|
|
logger.info("password:"+password);
|
|
|
String response = ykyyService.DoctorLogin(parameters.get("username"),password);
|
|
|
if (!StringUtils.isEmpty(response)){
|
|
|
JSONObject object = JSONObject.parseObject(response);
|
|
|
logger.info("眼科通登陆返回参数:"+object);
|
|
|
if (!object.getString("code").equalsIgnoreCase("10000")){
|
|
|
WlyyUserSimple userSimple = new WlyyUserSimple();
|
|
|
return getFailedResponse(object.getString("message"),-1,userSimple);
|
|
|
}else {
|
|
|
JSONObject jsonObject = object.getJSONObject("value");
|
|
|
if (jsonObject!=null) {
|
|
|
String idCard = jsonObject.getString("idCard");
|
|
|
String verifyCode = jsonObject.getString("verifyCode");
|
|
|
String yktDoctorId= jsonObject.getString("id");
|
|
|
BaseDoctorDO doctorDOs = doctorDao.findByIdcard(idCard);
|
|
|
if (doctorDOs!=null){
|
|
|
doctorDOs.setVerifyCode(verifyCode);
|
|
|
doctorDOs.setYktDoctorId(yktDoctorId);
|
|
|
/*doctorDOs.setYktCode();*/
|
|
|
doctorDao.save(doctorDOs);
|
|
|
}else {
|
|
|
WlyyUserSimple userSimple = new WlyyUserSimple();
|
|
|
return getFailedResponse("您的账号未认证,请联系互联网医院工作人员,联系电话0592-2108763。",-1,userSimple);
|
|
|
}
|
|
|
if (idCard==null||idCard==""){
|
|
|
logger.info("身份证为空");
|
|
|
}else {
|
|
|
ykyyService.updateYkyyDoctor(idCard,verifyCode,yktDoctorId);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
parameters.remove("password");
|
|
|
// String response = ykyyService.DoctorLogin(parameters.get("username"),password);
|
|
|
// if (!StringUtils.isEmpty(response)){
|
|
|
// JSONObject object = JSONObject.parseObject(response);
|
|
|
// logger.info("眼科通登陆返回参数:"+object);
|
|
|
// if (!object.getString("code").equalsIgnoreCase("10000")){
|
|
|
// WlyyUserSimple userSimple = new WlyyUserSimple();
|
|
|
// return getFailedResponse(object.getString("message"),-1,userSimple);
|
|
|
// }else {
|
|
|
// JSONObject jsonObject = object.getJSONObject("value");
|
|
|
// if (jsonObject!=null) {
|
|
|
// String idCard = jsonObject.getString("idCard");
|
|
|
// String verifyCode = jsonObject.getString("verifyCode");
|
|
|
// String yktDoctorId= jsonObject.getString("id");
|
|
|
// BaseDoctorDO doctorDOs = doctorDao.findByIdcard(idCard);
|
|
|
// if (doctorDOs!=null){
|
|
|
// doctorDOs.setVerifyCode(verifyCode);
|
|
|
// doctorDOs.setYktDoctorId(yktDoctorId);
|
|
|
// /*doctorDOs.setYktCode();*/
|
|
|
// doctorDao.save(doctorDOs);
|
|
|
// }else {
|
|
|
// WlyyUserSimple userSimple = new WlyyUserSimple();
|
|
|
// return getFailedResponse("您的账号未认证,请联系互联网医院工作人员,联系电话0592-2108763。",-1,userSimple);
|
|
|
// }
|
|
|
// if (idCard==null||idCard==""){
|
|
|
// logger.info("身份证为空");
|
|
|
// }else {
|
|
|
// ykyyService.updateYkyyDoctor(idCard,verifyCode,yktDoctorId);
|
|
|
// }
|
|
|
// }
|
|
|
// }
|
|
|
// }
|
|
|
// parameters.remove("password");
|
|
|
parameters.put("password",password);
|
|
|
} else if (parameters.get("mobile") != null) {
|
|
|
KeyPair keyPair = (KeyPair) httpSession.getAttribute("privateKey");
|
|
|
String mobile = com.yihu.jw.security.utils.RSAUtils.decryptBase64(parameters.get("mobile"), keyPair);
|
|
|
logger.info("mobile:"+mobile);
|
|
|
String password = null;
|
|
|
String res = ykyyService.getDoctorPhone(mobile);
|
|
|
if (res!=null&&res!=""){
|
|
|
JSONObject object = JSONObject.parseObject(res);
|
|
|
if (object.getString("code").equalsIgnoreCase("200")){
|
|
|
password = object.getString("data");
|
|
|
}else {
|
|
|
WlyyUserSimple userSimple = new WlyyUserSimple();
|
|
|
return getFailedResponse(object.getString("msg"),-1,userSimple);
|
|
|
}
|
|
|
}
|
|
|
String response = ykyyService.DoctorLogin(parameters.get("username"),password);
|
|
|
if (!StringUtils.isEmpty(response)){
|
|
|
JSONObject object = JSONObject.parseObject(response);
|
|
|
logger.info("眼科通登陆返回参数:"+object);
|
|
|
if (!object.getString("code").equalsIgnoreCase("10000")){
|
|
|
WlyyUserSimple userSimple = new WlyyUserSimple();
|
|
|
return getFailedResponse(object.getString("message"),-1,userSimple);
|
|
|
}else {
|
|
|
JSONObject jsonObject = object.getJSONObject("value");
|
|
|
if (jsonObject!=null) {
|
|
|
String idCard = jsonObject.getString("idCard");
|
|
|
String verifyCode = jsonObject.getString("verifyCode");
|
|
|
String yktDoctorId= jsonObject.getString("id");
|
|
|
BaseDoctorDO doctorDOs = doctorDao.findByIdcard(idCard);
|
|
|
if (doctorDOs!=null){
|
|
|
doctorDOs.setVerifyCode(verifyCode);
|
|
|
doctorDOs.setYktDoctorId(yktDoctorId);
|
|
|
/*doctorDOs.setYktCode();*/
|
|
|
doctorDao.save(doctorDOs);
|
|
|
}else {
|
|
|
WlyyUserSimple userSimple = new WlyyUserSimple();
|
|
|
return getFailedResponse("您的账号未认证,请联系互联网医院工作人员,联系电话0592-2108763。",-1,userSimple);
|
|
|
}
|
|
|
if (idCard==null||idCard==""){
|
|
|
logger.info("身份证为空");
|
|
|
}else {
|
|
|
ykyyService.updateYkyyDoctor(idCard,verifyCode,yktDoctorId);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
// String password = null;
|
|
|
// String res = ykyyService.getDoctorPhone(mobile);
|
|
|
// if (res!=null&&res!=""){
|
|
|
// JSONObject object = JSONObject.parseObject(res);
|
|
|
// if (object.getString("code").equalsIgnoreCase("200")){
|
|
|
// password = object.getString("data");
|
|
|
// }else {
|
|
|
// WlyyUserSimple userSimple = new WlyyUserSimple();
|
|
|
// return getFailedResponse(object.getString("msg"),-1,userSimple);
|
|
|
// }
|
|
|
// }
|
|
|
// String response = ykyyService.DoctorLogin(parameters.get("username"),password);
|
|
|
// if (!StringUtils.isEmpty(response)){
|
|
|
// JSONObject object = JSONObject.parseObject(response);
|
|
|
// logger.info("眼科通登陆返回参数:"+object);
|
|
|
// if (!object.getString("code").equalsIgnoreCase("10000")){
|
|
|
// WlyyUserSimple userSimple = new WlyyUserSimple();
|
|
|
// return getFailedResponse(object.getString("message"),-1,userSimple);
|
|
|
// }else {
|
|
|
// JSONObject jsonObject = object.getJSONObject("value");
|
|
|
// if (jsonObject!=null) {
|
|
|
// String idCard = jsonObject.getString("idCard");
|
|
|
// String verifyCode = jsonObject.getString("verifyCode");
|
|
|
// String yktDoctorId= jsonObject.getString("id");
|
|
|
// BaseDoctorDO doctorDOs = doctorDao.findByIdcard(idCard);
|
|
|
// if (doctorDOs!=null){
|
|
|
// doctorDOs.setVerifyCode(verifyCode);
|
|
|
// doctorDOs.setYktDoctorId(yktDoctorId);
|
|
|
// /*doctorDOs.setYktCode();*/
|
|
|
// doctorDao.save(doctorDOs);
|
|
|
// }else {
|
|
|
// WlyyUserSimple userSimple = new WlyyUserSimple();
|
|
|
// return getFailedResponse("您的账号未认证,请联系互联网医院工作人员,联系电话0592-2108763。",-1,userSimple);
|
|
|
// }
|
|
|
// if (idCard==null||idCard==""){
|
|
|
// logger.info("身份证为空");
|
|
|
// }else {
|
|
|
// ykyyService.updateYkyyDoctor(idCard,verifyCode,yktDoctorId);
|
|
|
// }
|
|
|
// }
|
|
|
// }
|
|
|
// }
|
|
|
parameters.remove("password");
|
|
|
}else {
|
|
|
//第三方同步账号模式登录
|