feat: módulos de envío TNS/ERP Lab + sync de médico, empresa y valor total
- Hub /envios/tns con 5 sub-tabs (Terceros, Transacción RIPS, Facturas Venta, Prueba RDA, Automatización) via iframe lazy - Hub /envios/erp con sub-tabs Pacientes y Sync Automático (historial scheduler) - Modo embed (?embed=1) en base.html para cargar páginas sin sidebar/header dentro de iframes - Sidebar simplificado: 6 ítems individuales reemplazados por módulos TNS y ERP Lab - Scheduler y endpoint /pacientes/examenes ahora incluyen médico ordenante (DOCIDMEDICO), empresa/EPS (NIT_EMPRESA) y valor total (VALORTOTAL) desde Firebird Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
31c0b71c90
commit
8e27225326
@@ -106,10 +106,13 @@ async def sync_paciente(
|
||||
api_key: str,
|
||||
client: Optional[httpx.AsyncClient] = None,
|
||||
modo: str = "upsert",
|
||||
examenes: Optional[list] = None,
|
||||
) -> dict:
|
||||
"""Envía un paciente al endpoint de WhatsApp. Retorna {ok, action, message}."""
|
||||
payload = mapear_paciente(row)
|
||||
payload["modo"] = modo
|
||||
if examenes:
|
||||
payload["examenes"] = examenes
|
||||
headers = {
|
||||
"Content-Type": "application/json",
|
||||
"X-Lab-Key": api_key,
|
||||
@@ -139,13 +142,16 @@ async def sync_paciente(
|
||||
}
|
||||
|
||||
|
||||
async def sync_todos(rows: list, url: str, api_key: str, timeout: int = 30, modo: str = "upsert") -> dict:
|
||||
async def sync_todos(rows: list, url: str, api_key: str, timeout: int = 30, modo: str = "upsert",
|
||||
examenes_map: Optional[dict] = None) -> dict:
|
||||
"""Envía una lista de filas de pacientes. Retorna resumen {total, created, skipped, updated, errores}."""
|
||||
resultado = {"total": len(rows), "created": 0, "skipped": 0, "updated": 0, "errores": 0, "detalle": []}
|
||||
|
||||
async with httpx.AsyncClient(timeout=timeout) as client:
|
||||
for row in rows:
|
||||
r = await sync_paciente(row, url, api_key, client, modo)
|
||||
doc = str(row.get("DOCIDENT") or "").strip()
|
||||
examenes = examenes_map.get(doc) if examenes_map else None
|
||||
r = await sync_paciente(row, url, api_key, client, modo, examenes)
|
||||
if r["ok"]:
|
||||
action = r["action"]
|
||||
if action == "created":
|
||||
|
||||
Reference in New Issue
Block a user