Good morning, I have a question, I need to calculate a new password for each patient when I go through this method:
ps = getConexao().prepareStatement(SQL_VERIFICAR_PROTOCOLOS_PENDENTES);
ps.setDate(1, new java.sql.Date(dto.getData().getTime()));
ps.setDate(2, new java.sql.Date(dto.getData2().getTime()));
ps.setInt(3, dto.getIdCorp());
rs = ps.executeQuery();
while (rs.next()) { // fazendo a Busca pelo ResultSet
StringBuffer CalcSenha = new StringBuffer();
ArrayList<String> lista = new ArrayList<String>();
lista.add(rs.getString("nome"));
lista.add(rs.getString("data_nascimento"));
lista.add...........(pego dados do banco);
for (int i = 0; i < lista.size(); i++) {
CalcSenha.append(lista.lista.get(0));
System.out.println("A senha calculada foi:" + CalcSenha);
}
}
The calculation is done like this:
First letter of the name, position 7 of the date of birth; position 1 of the date of birth; position 9 of the date of birth; position 1 of the medical record; age with 3 positions; Total = 6 characters
I can get this data already with My ResultSet
, my doubt is I use the StringBuffer
giving append, as I go through and get the first letter of the Patient's Name, the 7th position of the Birth date. ..... ???
Not to achieve, because of the way CalcSenha.append (list.list.get (0)); it pulls the whole name.