feat(bandeja): badges de comentarios y estado en tarjeta de lista

- Indicadores por tipo: Recep. (azul) / Toma (verde) / Gral. (amarillo)
- Label de estado del servicio: En servicio / En espera / Finalizado / etc.
- Query agrega SUM por tipo de comentario sin subquery adicional

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Lizandro Guarnizo
2026-07-27 21:42:55 -05:00
co-authored by Claude Sonnet 4.6
parent 0b39e3f0d0
commit b76c2f11e9
2 changed files with 40 additions and 1 deletions
+5 -1
View File
@@ -96,12 +96,16 @@ $stmt = $pdo->prepare("
t.inicio_lugar_at, t.fin_lugar_at, t.bandeja_visto_at,
ts.numero_orden,
l.nombre AS lugar_nombre,
GROUP_CONCAT(et.codigo ORDER BY et.codigo SEPARATOR ' ') AS examenes_txt
GROUP_CONCAT(DISTINCT et.codigo ORDER BY et.codigo SEPARATOR ' ') AS examenes_txt,
SUM(tc.tipo = 'recepcion') AS com_recepcion,
SUM(tc.tipo = 'muestras') AS com_muestras,
SUM(tc.tipo = 'general') AS com_general
FROM turnero_turnos t
JOIN turnero_solicitudes ts ON ts.turno_id = t.id
JOIN turnero_lugares l ON l.id = t.lugar_destino_id
LEFT JOIN turnero_examen_items tei ON tei.solicitud_id = ts.id
LEFT JOIN exam_tipos et ON et.id = tei.exam_tipo_id
LEFT JOIN turnero_comentarios tc ON tc.turno_id = t.id
WHERE t.sesion_id = ? AND t.inicio_lugar_at IS NOT NULL
GROUP BY t.id
ORDER BY ts.numero_orden ASC