feat(turnero): opción solo entrega de muestras con prioridad y badge naranja en cola
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
76dda4722a
commit
34004b4d98
@@ -50,21 +50,20 @@ if ($sesionCerrada) {
|
||||
// ── Cola según área ───────────────────────────────────────────
|
||||
if ($area === 'recepcion') {
|
||||
// Recepción: todos los turnos en espera/en_recepcion
|
||||
$inEstados = "'espera', 'en_recepcion'";
|
||||
$filtroLugar = '';
|
||||
$bindsCola = [$sesionId];
|
||||
|
||||
$inEstados = "'espera', 'en_recepcion'";
|
||||
$stmt = $pdo->prepare(
|
||||
"SELECT t.id, t.codigo, t.numero, t.estado, t.paciente_nombre,
|
||||
t.recepcion_desk_id, t.creado_at, t.llamado_recepcion_at, t.llamado_lugar_at,
|
||||
p.codigo AS prioridad_codigo, p.nombre AS prioridad_nombre,
|
||||
p.color AS prioridad_color, p.orden_peso
|
||||
p.color AS prioridad_color, p.orden_peso,
|
||||
COALESCE(s.solo_muestras, 0) AS solo_muestras
|
||||
FROM turnero_turnos t
|
||||
JOIN turnero_prioridades p ON p.id = t.prioridad_id
|
||||
LEFT JOIN turnero_solicitudes s ON s.turno_id = t.id
|
||||
WHERE t.sesion_id = ? AND t.estado IN ($inEstados)
|
||||
ORDER BY p.orden_peso ASC, t.creado_at ASC"
|
||||
);
|
||||
$stmt->execute($bindsCola);
|
||||
$stmt->execute([$sesionId]);
|
||||
} else {
|
||||
// Lugar: cola = en_espera_lugar del grupo + en_servicio en ESTA estación
|
||||
$grupoIds = lugarIdsDeGrupo($lugarId);
|
||||
@@ -73,13 +72,15 @@ if ($area === 'recepcion') {
|
||||
$cols = "t.id, t.codigo, t.numero, t.estado, t.paciente_nombre,
|
||||
t.recepcion_desk_id, t.creado_at, t.llamado_recepcion_at, t.llamado_lugar_at,
|
||||
p.codigo AS prioridad_codigo, p.nombre AS prioridad_nombre,
|
||||
p.color AS prioridad_color, p.orden_peso";
|
||||
p.color AS prioridad_color, p.orden_peso,
|
||||
COALESCE(s.solo_muestras, 0) AS solo_muestras";
|
||||
|
||||
$stmt = $pdo->prepare(
|
||||
"SELECT * FROM (
|
||||
(SELECT $cols
|
||||
FROM turnero_turnos t
|
||||
JOIN turnero_prioridades p ON p.id = t.prioridad_id
|
||||
LEFT JOIN turnero_solicitudes s ON s.turno_id = t.id
|
||||
WHERE t.sesion_id = ?
|
||||
AND t.estado = 'en_espera_lugar'
|
||||
AND t.lugar_destino_id IN ($inLugares))
|
||||
@@ -87,11 +88,12 @@ if ($area === 'recepcion') {
|
||||
(SELECT $cols
|
||||
FROM turnero_turnos t
|
||||
JOIN turnero_prioridades p ON p.id = t.prioridad_id
|
||||
LEFT JOIN turnero_solicitudes s ON s.turno_id = t.id
|
||||
WHERE t.sesion_id = ?
|
||||
AND t.estado = 'en_servicio'
|
||||
AND t.lugar_destino_id = ?)
|
||||
) AS cola_union
|
||||
ORDER BY orden_peso ASC, creado_at ASC"
|
||||
ORDER BY solo_muestras DESC, orden_peso ASC, creado_at ASC"
|
||||
);
|
||||
$stmt->execute([$sesionId, $sesionId, $lugarId]);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user