|
@ -404,11 +404,33 @@ public class AccountService extends BaseJpaService<AccountDO,AccountDao> {
|
|
* @param patient
|
|
* @param patient
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
public MixEnvelop<AccountDO, AccountDO> selectByPatient(String patient){
|
|
|
|
|
|
public MixEnvelop<AccountDO, AccountDO> selectByPatient(String patient,String name,String hospital,String hospitalName,String idcard){
|
|
MixEnvelop<AccountDO,AccountDO> envelop = new MixEnvelop<>();
|
|
MixEnvelop<AccountDO,AccountDO> envelop = new MixEnvelop<>();
|
|
String sql = "select * from wlyy_health_bank_account where status = 1 and patient_id = '"+patient+"'";
|
|
String sql = "select * from wlyy_health_bank_account where status = 1 and patient_id = '"+patient+"'";
|
|
List<AccountDO> accountDOS = jdbcTemplate.query(sql,new BeanPropertyRowMapper(AccountDO.class));
|
|
List<AccountDO> accountDOS = jdbcTemplate.query(sql,new BeanPropertyRowMapper(AccountDO.class));
|
|
envelop.setObj(accountDOS.get(0));
|
|
|
|
|
|
if (accountDOS == null || accountDOS.size()==0){
|
|
|
|
AccountDO accountDO = new AccountDO();
|
|
|
|
accountDO.setTotal(0);
|
|
|
|
accountDO.setId(getCode());
|
|
|
|
accountDO.setPatientId(patient);
|
|
|
|
accountDO.setAccountName(name);
|
|
|
|
accountDO.setHospital(hospital);
|
|
|
|
accountDO.setHospitalName(hospitalName);
|
|
|
|
if(idcard.length()>=4){// 判断是否长度大于等于4
|
|
|
|
String cardNumber=idcard.substring(idcard.length()- 4,idcard.length());//截取两个数字之间的部分
|
|
|
|
int random = (int)((Math.random()*9+1)*100000);
|
|
|
|
accountDO.setCardNumber(cardNumber+Integer.toString(random));
|
|
|
|
}
|
|
|
|
accountDO.setPassword("123456");
|
|
|
|
accountDO.setSaasId("dev");
|
|
|
|
accountDO.setStatus(1);
|
|
|
|
accountDO.setCreateTime(new Date());
|
|
|
|
accountDO.setUpdateTime(new Date());
|
|
|
|
accountDO = accountDao.save(accountDO);
|
|
|
|
envelop.setObj(accountDO);
|
|
|
|
}else {
|
|
|
|
envelop.setObj(accountDOS.get(0));
|
|
|
|
}
|
|
return envelop;
|
|
return envelop;
|
|
}
|
|
}
|
|
}
|
|
}
|