|
|
|
@ -5,6 +5,16 @@ const data_de_nascimento = _req.getString("data_de_nascimento") |
|
|
|
const endereco = _req.getString("endereco") |
|
|
|
const telefone = _req.getString("telefone") |
|
|
|
|
|
|
|
const dbPaciente = _db.form('paciente') |
|
|
|
.where(_db.where('c_p_f').equal(cpf).or('r_g').equal(rg)) |
|
|
|
.first(); |
|
|
|
|
|
|
|
if (dbPaciente) { |
|
|
|
_header.status(409); |
|
|
|
_out.json({ insertedData: 0, error: "esse CPF/RG já está cadastrado no sistema" }); |
|
|
|
_exec.stop(); |
|
|
|
} |
|
|
|
|
|
|
|
const insertedData = _db.insertIfNotExists( |
|
|
|
'paciente', |
|
|
|
_val.map() |
|
|
|
|