|
@ -57,8 +57,8 @@ public class WlyyUserDetailsService extends JdbcDaoSupport implements UserDetail
|
|
|
private static final String DEFAULT_PATIENT_INSERT_STATEMENT =
|
|
|
"INSERT into base_patient (id,photo,idcard,password,salt,name,birthday,sex,mobile," +
|
|
|
"province_code,province_name,city_code,city_name,town_code,town_name,street_code,street_name,address," +
|
|
|
"del,locked,enabled,login_failure_count,login_date,card_type) " +
|
|
|
" values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
|
|
|
"del,locked,enabled,login_failure_count,login_date,card_type,alipay_id) " +
|
|
|
" values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
|
|
|
|
|
|
private static final String PATIENT_INSERT_WEHCAT = "insert into base_patient_wechat (id,wechat_id,patient_id,openid,create_time) values(?,?,?,?,?)";
|
|
|
|
|
@ -144,7 +144,7 @@ public class WlyyUserDetailsService extends JdbcDaoSupport implements UserDetail
|
|
|
* 用户登录判读接口
|
|
|
* 判断loginType查找用户信息
|
|
|
* 用户类型 1或默认为user,2:医生登录,3:患者登录,4:i健康系统-患者登录(i健康患者可以不注册直接登录互联网系统,首次使用,根据i健康居民code去i健康查询居民信息,然后保存到base.base_patient)
|
|
|
*
|
|
|
* 用户类型 5 中山医院支付宝-患者登录(可以不注册直接登录)
|
|
|
* @param username
|
|
|
* @return
|
|
|
*/
|
|
@ -229,7 +229,9 @@ public class WlyyUserDetailsService extends JdbcDaoSupport implements UserDetail
|
|
|
0,
|
|
|
1,
|
|
|
0,
|
|
|
new Date()
|
|
|
new Date(),
|
|
|
null,
|
|
|
null
|
|
|
}
|
|
|
);
|
|
|
}catch (Exception e){
|
|
@ -331,7 +333,8 @@ public class WlyyUserDetailsService extends JdbcDaoSupport implements UserDetail
|
|
|
1,
|
|
|
0,
|
|
|
new Date(),
|
|
|
idtype
|
|
|
idtype,
|
|
|
null
|
|
|
}
|
|
|
);
|
|
|
}catch (Exception e){
|
|
@ -379,6 +382,102 @@ public class WlyyUserDetailsService extends JdbcDaoSupport implements UserDetail
|
|
|
familyMemberDao.save(basePatientFamilyMemberDO);
|
|
|
}
|
|
|
}
|
|
|
}else if("5".equals(loginType)){
|
|
|
//中山医院支付宝-患者登录(可以不注册直接登录)
|
|
|
// 姓名,电话,证件类型,证件号和⽀付宝open_id以冒号组合,如:
|
|
|
//张三:13012341234:01:350000200112231234:123456
|
|
|
String data[] = username.split(":");
|
|
|
String name = data[0];
|
|
|
username = data[1];
|
|
|
String idcard = data[3];
|
|
|
users = this.getJdbcTemplate().query(DEFAULT_PATIENT_DETAILS_STATEMENT, new BeanPropertyRowMapper(WlyyUserDetails.class),username,idcard);
|
|
|
if (null == users || users.size() == 0) {
|
|
|
String patientId = UUID.randomUUID().toString();
|
|
|
String salt = randomString(5);
|
|
|
String pw = idcard.substring(idcard.length()-6);
|
|
|
String password = MD5.md5Hex(pw + "{" + salt + "}");
|
|
|
int sex = 0;
|
|
|
try {
|
|
|
sex = Integer.parseInt(IdCardUtil.getSexForIdcard_new(idcard));
|
|
|
this.getJdbcTemplate().update(DEFAULT_PATIENT_INSERT_STATEMENT,
|
|
|
new Object[]{patientId,
|
|
|
null,
|
|
|
idcard,
|
|
|
password,
|
|
|
salt,
|
|
|
name,
|
|
|
IdCardUtil.getBirthdayForIdcard(idcard),
|
|
|
sex,
|
|
|
username,
|
|
|
null,
|
|
|
null,
|
|
|
null,
|
|
|
null,
|
|
|
null,
|
|
|
null,
|
|
|
null,
|
|
|
null,
|
|
|
null,
|
|
|
1,
|
|
|
0,
|
|
|
1,
|
|
|
0,
|
|
|
new Date(),
|
|
|
data[2],
|
|
|
data[4]
|
|
|
}
|
|
|
);
|
|
|
}catch (Exception e){
|
|
|
logger.error("将中山医院支付宝登录数据同步到互联网医院居民表失败:" + e.getMessage());
|
|
|
return users;
|
|
|
}
|
|
|
try {
|
|
|
this.getJdbcTemplate().update(PATIENT_INSERT_WEHCAT,
|
|
|
new Object[]{
|
|
|
UUID.randomUUID().toString(),
|
|
|
getWechatId(),
|
|
|
patientId,
|
|
|
getOpenid(),
|
|
|
new Date()
|
|
|
}
|
|
|
);
|
|
|
}catch (Exception e){
|
|
|
logger.error("将中山医院支付宝登录数据同步到互联网医院居民微信关联表失败:" + e.getMessage());
|
|
|
return users;
|
|
|
}
|
|
|
|
|
|
WlyyUserDetails user = new WlyyUserDetails();
|
|
|
user.setName(name);
|
|
|
user.setPassword(password);
|
|
|
if(sex == 1){
|
|
|
user.setGender(WlyyUserDetails.Gender.male);
|
|
|
}else if(sex == 2){
|
|
|
user.setGender(WlyyUserDetails.Gender.female);
|
|
|
}
|
|
|
user.setId(username);
|
|
|
user.setIdcard(idcard);
|
|
|
user.setMobile(username);
|
|
|
user.setEnabled(true);
|
|
|
user.setLocked(false);
|
|
|
user.setLockedDate(null);
|
|
|
users.add(user);
|
|
|
BasePatientDO patientDO = patientDao.findByIdcardAndDel(idcard,"1");
|
|
|
WlyyPatientFamilyMemberDO basePatientFamilyMemberDO = familyMemberDao.findFamilyMemberByPatientAndRelationCode(patientDO.getId(),"7");
|
|
|
if (basePatientFamilyMemberDO==null){
|
|
|
basePatientFamilyMemberDO = new WlyyPatientFamilyMemberDO();
|
|
|
basePatientFamilyMemberDO.setPatient(patientDO.getId());
|
|
|
basePatientFamilyMemberDO.setFamilyRelation("7");
|
|
|
basePatientFamilyMemberDO.setFamilyRelationName("自己");
|
|
|
basePatientFamilyMemberDO.setCardType("身份证");
|
|
|
basePatientFamilyMemberDO.setCardNo(patientDO.getIdcard());
|
|
|
basePatientFamilyMemberDO.setCreateTime(new Date());
|
|
|
basePatientFamilyMemberDO.setUpdateTime(new Date());
|
|
|
basePatientFamilyMemberDO.setIsAuthorize(1);
|
|
|
basePatientFamilyMemberDO.setIsDel(1);
|
|
|
basePatientFamilyMemberDO.setFamilyMember(patientDO.getId());
|
|
|
familyMemberDao.save(basePatientFamilyMemberDO);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
return users;
|
|
|
}
|
|
@ -533,6 +632,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, getIdcard());
|
|
|
users = this.getJdbcTemplate().query(DEFAULT_PATIENT_DETAILS_IDCARD_STATEMENT, new BeanPropertyRowMapper(WlyyUserSimple.class), getIdcard());
|
|
|
}else if("5".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");
|
|
|
|