prepare( 'UPDATE turnero_turnos SET muestra_espera_at = NULL, lugar_destino_id = ?, llamado_lugar_at = NOW(), atendido_lugar_por = ? WHERE id = ? AND muestra_espera_at IS NOT NULL' )->execute([$lugarId, adminId(), $turnoId]); $stmt = $pdo->prepare( 'SELECT t.*, p.codigo AS prioridad_codigo, p.nombre AS prioridad_nombre, p.color AS prioridad_color, COALESCE(ts.solo_muestras, 0) AS solo_muestras FROM turnero_turnos t JOIN turnero_prioridades p ON p.id = t.prioridad_id LEFT JOIN turnero_solicitudes ts ON ts.turno_id = t.id WHERE t.id = ?' ); $stmt->execute([$turnoId]); $turno = $stmt->fetch(PDO::FETCH_ASSOC); if ($turno) notificarSSE((int)$turno['sesion_id']); jsonOk(['turno' => $turno], 'Paciente llamado');