fix: quitar creado_at (columna no existe en turnero_consentimientos)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
ad0eefe31f
commit
f18104dd5d
+21
-17
@@ -78,25 +78,29 @@ echo "\n";
|
||||
// ── 4. Últimos consentimientos creados desde kiosko ───────────
|
||||
echo "4. ÚLTIMOS CONSENTIMIENTOS CREADOS (recientes)\n";
|
||||
echo "─────────────────────────────────────────────────\n";
|
||||
$rows = $pdo->query(
|
||||
"SELECT tc.id, tc.turno_id, tc.estado, tc.enviado_at, tc.creado_at,
|
||||
tt.codigo, tt.paciente_nombre, tt.paciente_cel,
|
||||
f.nombre AS formulario
|
||||
FROM turnero_consentimientos tc
|
||||
JOIN turnero_turnos tt ON tt.id = tc.turno_id
|
||||
JOIN lab_formularios f ON f.id = tc.formulario_id
|
||||
ORDER BY tc.id DESC
|
||||
LIMIT 10"
|
||||
)->fetchAll(PDO::FETCH_ASSOC);
|
||||
try {
|
||||
$rows = $pdo->query(
|
||||
"SELECT tc.id, tc.turno_id, tc.estado, tc.enviado_at,
|
||||
tt.codigo, tt.paciente_nombre, tt.paciente_cel,
|
||||
f.nombre AS formulario
|
||||
FROM turnero_consentimientos tc
|
||||
JOIN turnero_turnos tt ON tt.id = tc.turno_id
|
||||
JOIN lab_formularios f ON f.id = tc.formulario_id
|
||||
ORDER BY tc.id DESC
|
||||
LIMIT 10"
|
||||
)->fetchAll(PDO::FETCH_ASSOC);
|
||||
|
||||
if ($rows) {
|
||||
foreach ($rows as $r) {
|
||||
echo " Turno {$r['codigo']} | {$r['paciente_nombre']} | cel={$r['paciente_cel']}\n";
|
||||
echo " Formulario: {$r['formulario']}\n";
|
||||
echo " Estado: {$r['estado']} | Enviado: " . ($r['enviado_at'] ?? 'NO') . " | Creado: {$r['creado_at']}\n\n";
|
||||
if ($rows) {
|
||||
foreach ($rows as $r) {
|
||||
echo " Turno {$r['codigo']} | {$r['paciente_nombre']} | cel={$r['paciente_cel']}\n";
|
||||
echo " Formulario: {$r['formulario']}\n";
|
||||
echo " Estado: {$r['estado']} | Enviado: " . ($r['enviado_at'] ?? 'NO') . "\n\n";
|
||||
}
|
||||
} else {
|
||||
echo " Sin registros\n";
|
||||
}
|
||||
} else {
|
||||
echo " Sin registros\n";
|
||||
} catch (\Throwable $e) {
|
||||
echo " ❌ Error SQL: " . $e->getMessage() . "\n";
|
||||
}
|
||||
echo "\n";
|
||||
|
||||
|
||||
@@ -129,8 +129,8 @@ try {
|
||||
);
|
||||
$pdo->prepare(
|
||||
"INSERT IGNORE INTO turnero_consentimientos
|
||||
(turno_id, formulario_id, token, estado, creado_at)
|
||||
VALUES (?, ?, ?, 'pendiente', NOW())"
|
||||
(turno_id, formulario_id, token, estado)
|
||||
VALUES (?, ?, ?, 'pendiente')"
|
||||
)->execute([$turnoId, (int)$formRow['formulario_id'], $conToken]);
|
||||
|
||||
$baseUrl = defined('BASE_URL') ? rtrim(BASE_URL, '/') : '';
|
||||
|
||||
Reference in New Issue
Block a user