From 663884685d74dffec4ca93acec2d543569b91730 Mon Sep 17 00:00:00 2001 From: Lizandro Guarnizo <77708265+lizandrogd@users.noreply.github.com> Date: Tue, 16 Jun 2026 17:52:27 -0500 Subject: [PATCH] up --- modules/turnero/api/get_display_global.php | 18 ++++++------------ modules/turnero/views/display_global.php | 21 ++++++++++----------- 2 files changed, 16 insertions(+), 23 deletions(-) diff --git a/modules/turnero/api/get_display_global.php b/modules/turnero/api/get_display_global.php index 9cbaa34..ca6abc8 100644 --- a/modules/turnero/api/get_display_global.php +++ b/modules/turnero/api/get_display_global.php @@ -35,15 +35,13 @@ foreach ($escritoriosRec as $desk) { t.numero, t.estado, t.paciente_nombre, + t.paciente_id, t.llamado_recepcion_at AS llamado_at, p.codigo AS prioridad_codigo, p.nombre AS prioridad_nombre, - p.color AS prioridad_color, - lp.nombre_completo AS nombre_registrado + p.color AS prioridad_color 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 - LEFT JOIN lab_pacientes lp ON lp.id = ts.paciente_id WHERE t.sesion_id = ? AND t.estado = 'en_recepcion' AND (t.recepcion_desk_id = ? OR t.recepcion_desk_id IS NULL) @@ -69,15 +67,13 @@ if (empty($escritoriosRec)) { t.numero, t.estado, t.paciente_nombre, + t.paciente_id, t.llamado_recepcion_at AS llamado_at, p.codigo AS prioridad_codigo, p.nombre AS prioridad_nombre, - p.color AS prioridad_color, - lp.nombre_completo AS nombre_registrado + p.color AS prioridad_color 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 - LEFT JOIN lab_pacientes lp ON lp.id = ts.paciente_id WHERE t.sesion_id = ? AND t.estado = 'en_recepcion' ORDER BY t.llamado_recepcion_at DESC" @@ -114,15 +110,13 @@ foreach ($lugares as $lugar) { t.numero, t.estado, t.paciente_nombre, + t.paciente_id, t.llamado_lugar_at AS llamado_at, p.codigo AS prioridad_codigo, p.nombre AS prioridad_nombre, - p.color AS prioridad_color, - lp.nombre_completo AS nombre_registrado + p.color AS prioridad_color 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 - LEFT JOIN lab_pacientes lp ON lp.id = ts.paciente_id WHERE t.sesion_id = ? AND t.estado = 'en_servicio' AND t.lugar_destino_id = ? diff --git a/modules/turnero/views/display_global.php b/modules/turnero/views/display_global.php index 7b03b0c..6e2ae67 100644 --- a/modules/turnero/views/display_global.php +++ b/modules/turnero/views/display_global.php @@ -598,15 +598,14 @@ function renderSnapshot(snap) { const key = t.codigo + '|' + t.destino + '|' + (t.llamado_at || ''); currentKeys.add(key); if (!lastSeenKeys.has(key)) { - const c = t.prioridad_color || ''; - // Solo anunciar el nombre si el paciente está registrado en el sistema - const nomVoz = t.nombre_registrado || null; - const nomVisu = t.nombre_registrado || t.paciente_nombre || null; + const c = t.prioridad_color || ''; + // Solo decir el nombre en voz si el paciente está registrado en lab_pacientes + const nomVoz = t.paciente_id ? t.paciente_nombre : null; // En primera carga silenciar todos; el más reciente se anuncia abajo if (!_firstLoad) { queueAnnouncement({ _key: key, codigo: t.codigo, destino: t.destino, paciente: nomVoz, color: c }); } - llamados.unshift({ codigo: t.codigo, destino: t.destino, paciente: nomVisu, color: c }); + llamados.unshift({ codigo: t.codigo, destino: t.destino, paciente: t.paciente_nombre, color: c }); if (llamados.length > 30) llamados.pop(); anuncioNuevo = true; } @@ -615,13 +614,13 @@ function renderSnapshot(snap) { if (_firstLoad) { _firstLoad = false; - // Anunciar solo el turno más reciente al cargar la página const sorted = allTurnos.slice().sort((a, b) => new Date(b.llamado_at || 0) - new Date(a.llamado_at || 0)); if (sorted.length > 0) { - const t = sorted[0]; - const c = t.prioridad_color || ''; - const key = t.codigo + '|' + t.destino + '|' + (t.llamado_at || ''); - queueAnnouncement({ _key: key, codigo: t.codigo, destino: t.destino, paciente: t.nombre_registrado || null, color: c }); + const t = sorted[0]; + const c = t.prioridad_color || ''; + const key = t.codigo + '|' + t.destino + '|' + (t.llamado_at || ''); + const nomVoz = t.paciente_id ? t.paciente_nombre : null; + queueAnnouncement({ _key: key, codigo: t.codigo, destino: t.destino, paciente: nomVoz, color: c }); } } @@ -636,7 +635,7 @@ function renderSnapshot(snap) { const t = sorted[0]; codEl.textContent = t.codigo; lugEl.textContent = t.destino; - pacEl.textContent = t.nombre_registrado || t.paciente_nombre || ''; + pacEl.textContent = t.paciente_nombre || ''; lblEl.textContent = 'Llamado a'; ringEl.classList.add('active'); const c = t.prioridad_color || '';