Commit Graph
16 Commits
Author SHA1 Message Date
Lizandro GuarnizoandClaude Sonnet 4.6 ae90eaf71c config: increase scheduler ventana from 10 to 60 minutes
Doctors can order exams up to ~45 min after the patient is registered
at reception. With 10 min window the exam sync missed those cases.
60 min ensures late-ordered exams are always captured and pushed to
WhatsApp Lab via upsert.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-07-28 09:44:26 -05:00
Lizandro GuarnizoandClaude Sonnet 4.6 59ee62591c chore: bajar intervalo scheduler a 20 segundos
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-07-23 12:00:09 -05:00
Lizandro GuarnizoandClaude Sonnet 4.6 cffeae7e94 fix: parallelize WA sync and surface scheduler errors in historial
- whatsapp_sync: send patients concurrently (asyncio.gather + semaphore=10) instead of sequentially — eliminates long waits with many patients
- envios_erp: auto-refresh historial every 60s when scheduler tab is active
- main: wrap scheduler job to catch exceptions and log them to sync_wa_log so failures are visible in historial

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-07-23 11:34:30 -05:00
Lizandro GuarnizoandClaude Sonnet 4.6 a880b7fb81 feat: filter exams by time window in SQL (last N minutes), default 10min
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-07-21 15:59:11 -05:00
Lizandro GuarnizoandClaude Sonnet 4.6 83c8b2aa0b fix: format scheduler times in Colombia UTC-5 server-side
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-07-17 15:31:40 -05:00
Lizandro GuarnizoandClaude Sonnet 4.6 12f5f1388d fix: correct column names in scheduler status query (total, errores)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-07-17 15:26:34 -05:00
Lizandro GuarnizoandClaude Sonnet 4.6 467a24baa4 feat: scheduler live status — endpoint + UI polling every 15s
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-07-17 15:21:32 -05:00
Lizandro GuarnizoandClaude Sonnet 4.6 8e27225326 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>
2026-07-16 21:13:48 -05:00
Lizandro GuarnizoandClaude Sonnet 4.6 6b84ecfd90 feat: módulo de facturas venta (Ventas/Crear) para contrato 040
- generar_factura_venta en json_generator.py con mapeo completo del JSON
- Queries default tipo 'ventas' (por fecha y por número) filtradas a contrato 040
- Ruta /ventas con preview, send-one y send masivo
- Template ventas.html con tabla, resumen y modal JSON
- Link en navegación lateral

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-07-11 11:16:42 -05:00
Lizandro GuarnizoandClaude Sonnet 4.6 0f3a760de4 feat(contratos): tabla de contratos con tipo_usuario por contrato
Agrega tabla `contratos` en SQLite sembrada con los 17 contratos del
laboratorio. `generar_rda_paciente` consulta el mapa contrato→tipoUsuario
como primera prioridad antes de derivar de TIPOUSU/TIPOUSUSISPRO.
Incluye CRUD en /contratos con UI en sidebar.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-07-09 15:00:21 -05:00
Lizandro GuarnizoandClaude Sonnet 4.6 e7c6bc794a feat(pacientes): sync de pacientes Firebird → WhatsApp Lab
- Nuevo servicio whatsapp_sync.py: mapeo de campos RIPS→lab_pacientes
  y cliente HTTP para /api/lab/ingest_paciente.php
- Nueva ruta /pacientes con sync masiva por rango de fechas o todos
- Hook en /terceros/send y /automation/run: sync silencioso a WhatsApp
  después de cada envío a TNS
- Config: campos whatsapp_url y whatsapp_api_key + botón probar conexión

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-07-09 10:49:00 -05:00
Lizandro GuarnizoandClaude Sonnet 4.6 8732db9c1f fix: use Firebird PREFIJO as codigoPrefijo; add debug endpoint to find CUPs field
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-07-01 12:07:43 -05:00
Lizandro GuarnizoandClaude Sonnet 4.6 c64a68ec6f Add test-rda page, fix prefijo/remisionante/especialidad for TNS RDA sends
- New /test-rda route: list Firebird candidates with valid contract/factura,
  send individual RDA with auto tercero creation and full result display
- json_generator: use prefijo_tns_default config instead of Firebird PREFIJO,
  add profesionalRemisionante from DOCIDMEDICO or remisionante_default config
- All queries: add DOCIDMEDICO column from MEDICO JOIN
- automation/transaccion: add remisionante_default and prefijo_tns_default params
- config: add remisionante_default (00) and prefijo_tns_default (00) keys
- automation SQL: filter NUM_FACTURA > 0 to skip unbilled records
- config.html: add UI fields for new config keys

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-26 18:57:54 -05:00
Lizandro Guarnizo 408ea50d21 hola 2026-06-18 12:25:44 -05:00
Lizandro Guarnizo 5fb3e32d2f Session sin expiracion, mostrar IP de red 2026-06-17 18:10:06 -05:00
Lizandro Guarnizo 8ae3b44bc9 Initial commit: RIPS Manager web system 2026-06-17 13:22:39 -05:00