11092025 - UPDATE: Integración de quirofanos
This commit is contained in:
@@ -10,6 +10,8 @@ puerto = os.getenv("PORT")
|
|||||||
modo = os.getenv("MODE", "1")
|
modo = os.getenv("MODE", "1")
|
||||||
monitor1 = os.getenv("MONITOR_ID_1")
|
monitor1 = os.getenv("MONITOR_ID_1")
|
||||||
monitor2 = os.getenv("MONITOR_ID_2")
|
monitor2 = os.getenv("MONITOR_ID_2")
|
||||||
|
es_quirofano_1 = os.getenv("IS_QUIRO_1")
|
||||||
|
es_quirofano_2 = os.getenv("IS_QUIRO_2")
|
||||||
tema = os.getenv("THEME", "csm")
|
tema = os.getenv("THEME", "csm")
|
||||||
tema_styles = {
|
tema_styles = {
|
||||||
"csm": {
|
"csm": {
|
||||||
@@ -24,13 +26,17 @@ tema_styles = {
|
|||||||
|
|
||||||
app = Flask(__name__)
|
app = Flask(__name__)
|
||||||
|
|
||||||
def obtener_turnos(mon_id):
|
def obtener_turnos(mon_id, es_quiro):
|
||||||
conn = get_connection()
|
conn = get_connection()
|
||||||
if not conn:
|
if not conn:
|
||||||
return []
|
return []
|
||||||
try:
|
try:
|
||||||
cursor = conn.cursor()
|
cursor = conn.cursor()
|
||||||
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})
|
if es_quiro == "1":
|
||||||
|
cursor.execute("SELECT QUIROFANOS.CODIGO_INTERNO AS CONSULTA, 1 AS ESTADO_CONSULTA, NVL (TURNOS.CODIGO_TURNO, NULL) AS TURNO, NVL (TURNOS.ESTADO_ID, 2) AS ESTADO_TURNO FROM (SELECT DISTINCT(CSMK_TURNO.CODIGO_PERSONAL), FP.CODIGO_INTERNO FROM CSMK_TURNO, NOVAHIS.FPERSONA FP WHERE ESTANCIA_ID = 639 AND FECHA = TRUNC(SYSDATE) AND CSMK_TURNO.CODIGO_PERSONAL = FP.CODIGO_PERSONAL) QUIROFANOS LEFT JOIN (SELECT t.* FROM (SELECT CT.CODIGO_PERSONAL, CTM.*, ROW_NUMBER () OVER (PARTITION BY CT.CODIGO_PERSONAL ORDER BY CTM.TURNO_MON_ID DESC) AS RN FROM CSMK_TURNO_MON CTM, CSMK_TURNO CT WHERE CTM.FECHA = TRUNC (SYSDATE) AND CTM.ESTADO_ID IN (1, 2) AND CTM.MONITOR_ID = :monitor AND CTM.TURNO_ID = CT.TURNO_ID) t WHERE t.RN = 1) TURNOS ON QUIROFANOS.CODIGO_PERSONAL = TURNOS.CODIGO_PERSONAL ORDER BY QUIROFANOS.CODIGO_INTERNO ASC",{'monitor':mon_id})
|
||||||
|
else:
|
||||||
|
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()
|
datos = cursor.fetchall()
|
||||||
cursor.close()
|
cursor.close()
|
||||||
conn.close()
|
conn.close()
|
||||||
@@ -62,16 +68,16 @@ def obtener_pie(mon_id1, mon_id2):
|
|||||||
@app.route('/')
|
@app.route('/')
|
||||||
def index():
|
def index():
|
||||||
tema_colores = tema_styles.get(tema, tema_styles["csm"])
|
tema_colores = tema_styles.get(tema, tema_styles["csm"])
|
||||||
return render_template("index.html", mode=modo, theme=tema, theme_colors=tema_colores)
|
return render_template("index.html", mode=modo, theme=tema, theme_colors=tema_colores, quiro1=es_quirofano_1, quiro2=es_quirofano_2)
|
||||||
|
|
||||||
@app.route('/api/datos1')
|
@app.route('/api/datos1')
|
||||||
def api_datos1():
|
def api_datos1():
|
||||||
filas = obtener_turnos(monitor1)
|
filas = obtener_turnos(monitor1, es_quirofano_1)
|
||||||
return jsonify(filas)
|
return jsonify(filas)
|
||||||
|
|
||||||
@app.route('/api/datos2')
|
@app.route('/api/datos2')
|
||||||
def api_datos2():
|
def api_datos2():
|
||||||
filas = obtener_turnos(monitor2)
|
filas = obtener_turnos(monitor2, es_quirofano_2)
|
||||||
return jsonify(filas)
|
return jsonify(filas)
|
||||||
|
|
||||||
@app.route('/api/footer')
|
@app.route('/api/footer')
|
||||||
|
|||||||
+3
-1
@@ -9,4 +9,6 @@ DB_SID=REALRAC1
|
|||||||
MODE="1"
|
MODE="1"
|
||||||
THEME="csm"
|
THEME="csm"
|
||||||
MONITOR_ID_1=1
|
MONITOR_ID_1=1
|
||||||
MONITOR_ID_2=2
|
MONITOR_ID_2=2
|
||||||
|
IS_QUIRO_1=0
|
||||||
|
IS_QUIRO_2=1
|
||||||
+44
-18
@@ -3,7 +3,7 @@ const estadoAnterior = {};
|
|||||||
|
|
||||||
let ultimoFooter = "";
|
let ultimoFooter = "";
|
||||||
|
|
||||||
function cargarTabla(endpoint, tablaId) {
|
function cargarTabla(endpoint, tablaId, esQuiro) {
|
||||||
fetch(endpoint)
|
fetch(endpoint)
|
||||||
.then(res => res.json())
|
.then(res => res.json())
|
||||||
.then(filas => {
|
.then(filas => {
|
||||||
@@ -25,7 +25,11 @@ function cargarTabla(endpoint, tablaId) {
|
|||||||
const td1 = document.createElement("td");
|
const td1 = document.createElement("td");
|
||||||
td1.textContent = fila[0];
|
td1.textContent = fila[0];
|
||||||
td1.className = `border align-middle ${sizeClass} m`;
|
td1.className = `border align-middle ${sizeClass} m`;
|
||||||
td1.style.backgroundColor = window.themeColors.bg1;
|
if (esQuiro === "1") {
|
||||||
|
td1.style.backgroundColor = "#008968";
|
||||||
|
} else {
|
||||||
|
td1.style.backgroundColor = window.themeColors.bg1;
|
||||||
|
}
|
||||||
tr.appendChild(td1);
|
tr.appendChild(td1);
|
||||||
|
|
||||||
const td2 = document.createElement("td");
|
const td2 = document.createElement("td");
|
||||||
@@ -38,7 +42,11 @@ function cargarTabla(endpoint, tablaId) {
|
|||||||
td2.className = `border bg-[#a9a9a9] align-middle ${sizeClass}`;
|
td2.className = `border bg-[#a9a9a9] align-middle ${sizeClass}`;
|
||||||
} else if (estadoConsulta == 1) {
|
} else if (estadoConsulta == 1) {
|
||||||
td2.textContent = fila[2];
|
td2.textContent = fila[2];
|
||||||
td2.style.backgroundColor = window.themeColors.bg2;
|
if (esQuiro === "1") {
|
||||||
|
td2.style.backgroundColor = "#00aa7a";
|
||||||
|
} else {
|
||||||
|
td2.style.backgroundColor = window.themeColors.bg2;
|
||||||
|
}
|
||||||
const originalText = fila[2];
|
const originalText = fila[2];
|
||||||
const blinkText = `<span class="text-[2.25rem]">PASE A<br>CONSULTA</span>`;
|
const blinkText = `<span class="text-[2.25rem]">PASE A<br>CONSULTA</span>`;
|
||||||
let blink = false;
|
let blink = false;
|
||||||
@@ -53,20 +61,37 @@ function cargarTabla(endpoint, tablaId) {
|
|||||||
clearInterval(td2.blinkInterval);
|
clearInterval(td2.blinkInterval);
|
||||||
}
|
}
|
||||||
|
|
||||||
td2.blinkInterval = setInterval(() => {
|
if (esQuiro === "1") {
|
||||||
blink = !blink;
|
td2.blinkInterval = setInterval(() => {
|
||||||
if (blink) {
|
blink = !blink;
|
||||||
td2.innerHTML = blinkText;
|
if (blink) {
|
||||||
td2.style.fontWeight = "bold";
|
td2.style.backgroundColor = "#00aa7a";
|
||||||
} else {
|
td2.style.color = "#FFFFFF";
|
||||||
td2.textContent = originalText;
|
} else {
|
||||||
td2.style.fontWeight = "";
|
td2.style.backgroundColor = '#ffff00';
|
||||||
}
|
td2.style.color = "#000000";
|
||||||
}, 1000);
|
}
|
||||||
|
}, 1500);
|
||||||
|
} else {
|
||||||
|
td2.blinkInterval = setInterval(() => {
|
||||||
|
blink = !blink;
|
||||||
|
if (blink) {
|
||||||
|
td2.innerHTML = blinkText;
|
||||||
|
td2.style.fontWeight = "bold";
|
||||||
|
} else {
|
||||||
|
td2.textContent = originalText;
|
||||||
|
td2.style.fontWeight = "";
|
||||||
|
}
|
||||||
|
}, 1500);
|
||||||
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
td2.className = `border align-middle ${sizeClass}`;
|
td2.className = `border align-middle ${sizeClass}`;
|
||||||
td2.style.backgroundColor = window.themeColors.bg2;
|
if (esQuiro === "1") {
|
||||||
|
td2.style.backgroundColor = "#00aa7a";
|
||||||
|
} else {
|
||||||
|
td2.style.backgroundColor = window.themeColors.bg2;
|
||||||
|
}
|
||||||
td2.textContent = originalText;
|
td2.textContent = originalText;
|
||||||
|
|
||||||
if (td2.blinkInterval) {
|
if (td2.blinkInterval) {
|
||||||
@@ -108,10 +133,11 @@ function cargarFooter() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function actualizarTablas() {
|
function actualizarTablas() {
|
||||||
cargarTabla("/api/datos1", "turnos1");
|
cargarTabla("/api/datos1", "turnos1", quiro1);
|
||||||
if (document.getElementById("turnos2")) {
|
cargarTabla("/api/datos2", "turnos2", quiro2);
|
||||||
cargarTabla("/api/datos2", "turnos2");
|
//if (document.getElementById("turnos2")) {
|
||||||
}
|
// cargarTabla("/api/datos2", "turnos2");
|
||||||
|
//}
|
||||||
}
|
}
|
||||||
|
|
||||||
//cargarFooter();
|
//cargarFooter();
|
||||||
|
|||||||
+18
-4
@@ -5,6 +5,10 @@
|
|||||||
<script id="theme-data" type="application/json">
|
<script id="theme-data" type="application/json">
|
||||||
{{ theme_colors | tojson | safe }}
|
{{ theme_colors | tojson | safe }}
|
||||||
</script>
|
</script>
|
||||||
|
<script>
|
||||||
|
const quiro1 = "{{ quiro1 }}";
|
||||||
|
const quiro2 = "{{ quiro2 }}";
|
||||||
|
</script>
|
||||||
<script src="{{ url_for('static', filename='js/utils.js') }}"></script>
|
<script src="{{ url_for('static', filename='js/utils.js') }}"></script>
|
||||||
<script src="{{ url_for('static', filename='js/scripts.js') }}"></script>
|
<script src="{{ url_for('static', filename='js/scripts.js') }}"></script>
|
||||||
<style>:root {--blink-start-color: {{ theme_colors.bg2 }};}</style>
|
<style>:root {--blink-start-color: {{ theme_colors.bg2 }};}</style>
|
||||||
@@ -26,8 +30,13 @@
|
|||||||
<table class="min-w-full text-center text-white text-3xl table-fixed border-collapse h-full">
|
<table class="min-w-full text-center text-white text-3xl table-fixed border-collapse h-full">
|
||||||
<thead>
|
<thead>
|
||||||
<tr class="h-[60px]">
|
<tr class="h-[60px]">
|
||||||
<th class="border px-4 py-2 w-1/2 {% if theme == 'imq' %}bg-[#CC0C00] {% else %}bg-[#114b94] {% endif %}">CONSULTA</th>
|
{% if quiro1 == '1' %}
|
||||||
<th class="border px-4 py-2 w-1/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-[#008968] {% endif %}">QUIRÓFANO</th>
|
||||||
|
<th class="border px-4 py-2 w-1/2 {% if theme == 'imq' %}bg-[#e6392d] {% else %}bg-[#00aa7a] {% endif %}">TURNO</th>
|
||||||
|
{% else %}
|
||||||
|
<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>
|
||||||
|
{% endif %}
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody id="turnos1">
|
<tbody id="turnos1">
|
||||||
@@ -38,8 +47,13 @@
|
|||||||
<table class="min-w-full text-center text-white text-3xl table-fixed border-collapse h-full">
|
<table class="min-w-full text-center text-white text-3xl table-fixed border-collapse h-full">
|
||||||
<thead>
|
<thead>
|
||||||
<tr class="h-[60px]">
|
<tr class="h-[60px]">
|
||||||
<th class="border px-4 py-2 w-1/2 {% if theme == 'imq' %}bg-[#CC0C00] {% else %}bg-[#114b94] {% endif %}">CONSULTA</th>
|
{% if quiro2 == '1' %}
|
||||||
<th class="border px-4 py-2 w-1/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-[#008968] {% endif %}">QUIRÓFANO</th>
|
||||||
|
<th class="border px-4 py-2 w-1/2 {% if theme == 'imq' %}bg-[#e6392d] {% else %}bg-[#00aa7a] {% endif %}">TURNO</th>
|
||||||
|
{% else %}
|
||||||
|
<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>
|
||||||
|
{% endif %}
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody id="turnos2">
|
<tbody id="turnos2">
|
||||||
|
|||||||
Reference in New Issue
Block a user