Update: Se suprime la barra inferior | Se muestra mensaje de "pase a consulta" en el propio turno | Se modifica query para mostrar todas las estancias independientemente de su estado

This commit is contained in:
2025-09-05 10:57:17 +02:00
parent f5d1957f2e
commit eaeff5e80f
3 changed files with 54 additions and 22 deletions
+1 -1
View File
@@ -30,7 +30,7 @@ def obtener_turnos(mon_id):
return []
try:
cursor = conn.cursor()
cursor.execute("SELECT CONS_ESTAD.CODIGO_IMPRESION CONSULTA, CONS_ESTAD.ESTADO_ID ESTADO_CONSULTA, TM.CODIGO_TURNO TURNO, TM.ESTADO_ID ESTADO_TURNO FROM CSMK_TURNO_MON TM, (SELECT ROW_NUMBER() OVER (PARTITION BY ESTADO.ESTANCIA_ID ORDER BY CONSULTA_ESTADO_ID DESC) AS RN, ESTADO.ESTADO_ID, ESTANCIA.* FROM CSMK_CONSULTA_ESTADO ESTADO, CSMK_ESTANCIA ESTANCIA WHERE ESTADO.FECHA = TRUNC (SYSDATE) AND ESTADO.ESTANCIA_ID = ESTANCIA.ESTANCIA_ID AND ESTANCIA.MONITOR_ID = :monitor ORDER BY ESTADO.CONSULTA_ESTADO_ID DESC) CONS_ESTAD WHERE CONS_ESTAD.RN = 1 AND TM.ESTANCIA_ID = CONS_ESTAD.ESTANCIA_ID AND TM.MONITOR_ID = CONS_ESTAD.MONITOR_ID AND TM.ESTADO_ID IN (1,2) AND TM.FECHA = TRUNC(SYSDATE) ORDER BY CONSULTA ASC",{'monitor':mon_id})
cursor.execute("SELECT CONS_ESTADO.CODIGO_IMPRESION AS CONSULTA, CONS_ESTADO.ESTADO_ID AS ESTADO_CONSULTA, NVL(CONS_TURNOS.CODIGO_TURNO, NULL) AS TURNO, NVL(CONS_TURNOS.ESTADO_ID, 2) AS ESTADO_TURNO FROM ( SELECT ROW_NUMBER () OVER ( PARTITION BY ESTADO.ESTANCIA_ID ORDER BY ESTADO.CONSULTA_ESTADO_ID DESC ) AS RN, ESTADO.ESTADO_ID, ESTANCIA.* FROM CSMK_CONSULTA_ESTADO ESTADO JOIN CSMK_ESTANCIA ESTANCIA ON ESTADO.ESTANCIA_ID = ESTANCIA.ESTANCIA_ID WHERE ESTADO.FECHA = TRUNC (SYSDATE) AND ESTANCIA.MONITOR_ID = :monitor ) CONS_ESTADO LEFT JOIN ( SELECT t.* FROM ( SELECT TM.*, ROW_NUMBER() OVER ( PARTITION BY TM.ESTANCIA_ID ORDER BY TM.TURNO_MON_ID DESC ) AS RN FROM CSMK_TURNO_MON TM WHERE TM.FECHA = TRUNC (SYSDATE) AND TM.ESTADO_ID IN (1,2) AND TM.MONITOR_ID = :monitor ) t WHERE t.RN = 1 ) CONS_TURNOS ON CONS_ESTADO.ESTANCIA_ID = CONS_TURNOS.ESTANCIA_ID AND CONS_ESTADO.MONITOR_ID = CONS_TURNOS.MONITOR_ID WHERE CONS_ESTADO.RN = 1 ORDER BY CONSULTA ASC",{'monitor':mon_id})
datos = cursor.fetchall()
cursor.close()
conn.close()
+38 -8
View File
@@ -24,7 +24,7 @@ function cargarTabla(endpoint, tablaId) {
const td1 = document.createElement("td");
td1.textContent = fila[0];
td1.className = `border align-middle ${sizeClass}`;
td1.className = `border align-middle ${sizeClass} m`;
td1.style.backgroundColor = window.themeColors.bg1;
tr.appendChild(td1);
@@ -38,11 +38,41 @@ function cargarTabla(endpoint, tablaId) {
td2.className = `border bg-[#a9a9a9] align-middle ${sizeClass}`;
} else if (estadoConsulta == 1) {
td2.textContent = fila[2];
td2.style.backgroundColor = window.themeColors.bg2;
const originalText = fila[2];
const blinkText = `<span class="text-[2.25rem]">PASE A<br>CONSULTA</span>`;
let blink = false;
if (estadoTurno == 1) {
td2.className = `border blink-yellow align-middle ${sizeClass}`;
td2.className = `border align-middle ${sizeClass}`;
td2.innerHTML = originalText;
td2.style.backgroundColor = '#ffff00';
td2.style.color = "#000000";
if (td2.blinkInterval) {
clearInterval(td2.blinkInterval);
}
td2.blinkInterval = setInterval(() => {
blink = !blink;
if (blink) {
td2.innerHTML = blinkText;
td2.style.fontWeight = "bold";
} else {
td2.textContent = originalText;
td2.style.fontWeight = "";
}
}, 1000);
} else {
td2.className = `border align-middle ${sizeClass}`;
td2.style.backgroundColor = window.themeColors.bg2;
td2.textContent = originalText;
if (td2.blinkInterval) {
clearInterval(td2.blinkInterval);
td2.blinkInterval = null;
}
}
} else {
td2.textContent = fila[2];
@@ -77,14 +107,14 @@ function cargarFooter() {
});
}
function actualizarTablas(){
cargarTabla("/api/datos1","turnos1");
if (document.getElementById("turnos2")){
cargarTabla("/api/datos2","turnos2");
function actualizarTablas() {
cargarTabla("/api/datos1", "turnos1");
if (document.getElementById("turnos2")) {
cargarTabla("/api/datos2", "turnos2");
}
}
cargarFooter();
//cargarFooter();
actualizarTablas();
setInterval(actualizarTablas, 20000);
setInterval(cargarFooter, 45000);
//setInterval(cargarFooter, 45000);
+15 -13
View File
@@ -11,6 +11,7 @@
</head>
<body class="flex flex-col min-h-screen">
<header class="flex justify-between items-center bg-white p-10 h-[225px]">
<div id="logo">
<img src="{{ url_for('static', filename='media/'+ theme +'.svg') }}" alt="Logo" height="172" width="380">
@@ -18,26 +19,27 @@
<div id="fecha" class="text-6xl text-[#696969]"></div>
<div id="hora" class="text-8xl font-bold text-[#696969]"></div>
</header>
<div class="flex flex-col md:flex-row gap-4 p-2 h-[783px]">
<div class="flex flex-col md:flex-row gap-4 p-2 h-[855px]">
{% if mode == '2' %}
<div class="md:w-1/2 w-full overflow-hidden h-[767]">
<div class="md:w-1/2 w-full overflow-hidden">
<table class="min-w-full text-center text-white text-3xl table-fixed border-collapse h-full">
<thead>
<tr class="h-[60px]">
<th class="border px-4 py-2 {% if theme == 'imq' %}bg-[#CC0C00] {% else %}bg-[#114b94] {% endif %}">CONSULTA</th>
<th class="border px-4 py-2 {% if theme == 'imq' %}bg-[#e6392d] {% else %}bg-[#0a6eb2] {% endif %}">TURNO</th>
<th class="border px-4 py-2 w-1/2 {% if theme == 'imq' %}bg-[#CC0C00] {% else %}bg-[#114b94] {% endif %}">CONSULTA</th>
<th class="border px-4 py-2 w-1/2 {% if theme == 'imq' %}bg-[#e6392d] {% else %}bg-[#0a6eb2] {% endif %}">TURNO</th>
</tr>
</thead>
<tbody id="turnos1">
</tbody>
</table>
</div>
<div class="md:w-1/2 w-full overflow-hidden h-[767]">
<div class="md:w-1/2 w-full overflow-hidden">
<table class="min-w-full text-center text-white text-3xl table-fixed border-collapse h-full">
<thead>
<tr class="h-[60px]">
<th class="border px-4 py-2 {% if theme == 'imq' %}bg-[#CC0C00] {% else %}bg-[#114b94] {% endif %}">CONSULTA</th>
<th class="border px-4 py-2 {% if theme == 'imq' %}bg-[#e6392d] {% else %}bg-[#0a6eb2] {% endif %}">TURNO</th>
<th class="border px-4 py-2 w-1/2 {% if theme == 'imq' %}bg-[#CC0C00] {% else %}bg-[#114b94] {% endif %}">CONSULTA</th>
<th class="border px-4 py-2 w-1/2 {% if theme == 'imq' %}bg-[#e6392d] {% else %}bg-[#0a6eb2] {% endif %}">TURNO</th>
</tr>
</thead>
<tbody id="turnos2">
@@ -49,12 +51,12 @@
<video src="{{ url_for('static', filename='media/'+ theme +'.mp4') }}" class="w-full shadow-md" autoplay muted loop
preload="metadata"></video>
</div>
<div class="md:w-1/2 w-full overflow-hidden h-[767px]">
<table class="min-w-full text-center text-white text-4xl table-fixed border-collapse h-[767px]">
<div class="md:w-1/2 w-full overflow-hidden">
<table class="min-w-full text-center text-white text-4xl table-fixed border-collapse h-full">
<thead>
<tr class="h-[60px]">
<th class="border px-4 py-2 {% if theme == 'imq' %}bg-[#CC0C00] {% else %}bg-[#114b94] {% endif %}">CONSULTA</th>
<th class="border px-4 py-2 {% if theme == 'imq' %}bg-[#e6392d] {% else %}bg-[#0a6eb2] {% endif %}">TURNO</th>
<th class="border px-4 py-2 w-1/2 {% if theme == 'imq' %}bg-[#CC0C00] {% else %}bg-[#114b94] {% endif %}">CONSULTA</th>
<th class="border px-4 py-2 w-1/2 {% if theme == 'imq' %}bg-[#e6392d] {% else %}bg-[#0a6eb2] {% endif %}">TURNO</th>
</tr>
</thead>
<tbody id="turnos1">
@@ -67,14 +69,14 @@
<div id="scroll-wrapper" class="whitespace-nowrap absolute w-max animate-scroll text-white text-3xl px-4 flex gap-16">
</div>
</footer>-->
<footer class="w-full overflow-hidden h-14 mt-2 flex items-center {% if theme == 'imq' %}bg-[#CC0C00] {% else %}bg-[#008968] {% endif %}">
<!--<footer class="w-full overflow-hidden h-14 mt-2 flex items-center {% if theme == 'imq' %}bg-[#CC0C00] {% else %}bg-[#008968] {% endif %}">
<div class="scroll-wrapper whitespace-nowrap w-max animate-scroll">
<span id="footer-text" class="text-white text-4xl px-4 "></span>
<span class="spacer w-14 inline-block"></span>
<span id="footer-text-duplicate" class="text-white text-4xl px-4"></span>
</div>
<div id="footer-text" class="whitespace-pre text-4xl animate-scroll whitespace-nowrap px-4 text-white"></div>
</footer>
</footer>-->
</body>
</html>
<script>