From 66d44392eee55368a73cff2a5e359e7eafcebc85 Mon Sep 17 00:00:00 2001 From: Lizandro Guarnizo <77708265+lizandrogd@users.noreply.github.com> Date: Wed, 22 Jul 2026 23:01:27 -0500 Subject: [PATCH] fix(automation): guardar mensaje_tns en _guardar_envio; eliminar script tmp Co-Authored-By: Claude Sonnet 4.6 --- app/routes/automation.py | 5 +++-- buscar_paciente.py | 22 ---------------------- 2 files changed, 3 insertions(+), 24 deletions(-) delete mode 100644 buscar_paciente.py diff --git a/app/routes/automation.py b/app/routes/automation.py index cd6beec..84ec34b 100644 --- a/app/routes/automation.py +++ b/app/routes/automation.py @@ -797,8 +797,8 @@ def _guardar_envio(user_id, tipo, factura, json_data, respuesta, ok, conn.execute(""" INSERT INTO envios (user_id, tipo, factura, idrecepcion, contrato, cedula, fecha_inicio, fecha_fin, - pacientes_count, servicios_count, status, json_enviado, respuesta_api, created_at) - VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) + pacientes_count, servicios_count, status, json_enviado, respuesta_api, mensaje_tns, created_at) + VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) """, ( user_id, tipo, factura, idrecepcion, contrato, cedula, fecha_inicio, fecha_fin, @@ -806,6 +806,7 @@ def _guardar_envio(user_id, tipo, factura, json_data, respuesta, ok, "success" if ok else "error", json_lib.dumps(json_data, indent=2, ensure_ascii=False)[:10000], respuesta[:1000] if respuesta else "", + respuesta[:300] if respuesta else "", datetime.now().isoformat(), )) conn.commit() diff --git a/buscar_paciente.py b/buscar_paciente.py deleted file mode 100644 index 3940141..0000000 --- a/buscar_paciente.py +++ /dev/null @@ -1,22 +0,0 @@ -import sqlite3 - -conn = sqlite3.connect("rips_manager.db") -conn.row_factory = sqlite3.Row - -rows = conn.execute(""" - SELECT id, tipo, factura, status, mensaje_tns, contrato, created_at - FROM envios - WHERE json_enviado LIKE '%88272630%' - ORDER BY created_at DESC - LIMIT 20 -""").fetchall() - -if not rows: - print("Sin resultados para 88272630") -else: - for r in rows: - print(f"id={r['id']} tipo={r['tipo']} factura={r['factura']} status={r['status']} contrato={r['contrato']} fecha={r['created_at']}") - print(f" msg: {r['mensaje_tns']}") - print() - -conn.close()