feat(pacientes): verificar WhatsApp al ingresar teléfono, vincular user_id al guardar

fix(recepcion): mostrar nombre_completo en resultados de búsqueda de paciente

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Lizandro Guarnizo
2026-06-24 08:44:48 -05:00
co-authored by Claude Sonnet 4.6
parent 018d445846
commit af584bcc26
4 changed files with 56 additions and 2 deletions
+9
View File
@@ -51,6 +51,15 @@ try {
}
// ────────────────────────────────────────────────────────────────────────
// Auto-vincular user_id por teléfono si no viene explícito
if (empty($datos['user_id']) && !empty($telVal)) {
$pdo = db();
$stmt = $pdo->prepare("SELECT id FROM users WHERE phone_number = ? LIMIT 1");
$stmt->execute([$telVal]);
$wid = $stmt->fetchColumn();
if ($wid) $datos['user_id'] = (int)$wid;
}
$pac = new Paciente();
$admin = adminId();