create_turno: priority F skips recepcion, goes direct to toma de muestras

When a patient selects 'Muestra pendiente' (prioridad F) at the kiosk,
the turn is immediately set to en_espera_lugar pointing to the first
active muestras location. Recepcion never sees it; toma de muestras
picks it up from its queue with no consent forms required.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Lizandro Guarnizo
2026-07-21 17:53:48 -05:00
co-authored by Claude Sonnet 4.6
parent 17c9e1a1f2
commit b1264da979
+22 -1
View File
@@ -120,11 +120,32 @@ try {
$turnoId = (int) $pdo->lastInsertId();
$pdo->commit();
// ── Prioridad F: saltar recepción, ir directo a toma de muestras ──
$esSoloMuestra = ($prioCodigo === 'F');
if ($esSoloMuestra) {
try {
$stmtLugar = $pdo->prepare(
"SELECT id FROM turnero_lugares WHERE tipo = 'muestras' AND activo = 1 ORDER BY sort_order ASC LIMIT 1"
);
$stmtLugar->execute();
$lugarMuestras = $stmtLugar->fetchColumn();
if ($lugarMuestras) {
$pdo->prepare(
"UPDATE turnero_turnos
SET estado = 'en_espera_lugar',
lugar_destino_id = ?,
fin_recepcion_at = NOW()
WHERE id = ?"
)->execute([(int)$lugarMuestras, $turnoId]);
notificarSSE($sesionId);
}
} catch (\Throwable $_) {}
}
notificarSSE($sesionId);
// ── Crear registro de consentimiento (siempre, con o sin teléfono) ──
$enlaceConsentimiento = null;
$esSoloMuestra = ($prioCodigo === 'F');
if (!$esSoloMuestra) {
try {
$stmtForms = $pdo->prepare(