Fix numeroContrato: use EMPRESA.CODCONTRATO from Firebird, sucursal default 00
- Join EMPRESA table in all RDA queries to get CODCONTRATO (TNS contract code) - Use EMPRESA.CODCONTRATO as numeroContrato instead of raw NIT_EMPRESA - Especialidad always uses default_especialidad (ignore Firebird COD_ESPECIALIDAD) - sucursal defaults to '00' (not empty) in config and endpoints - Fix config template label: especialidad default is TNS code not Firebird code Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
f0514641b3
commit
3017c7956e
@@ -127,7 +127,7 @@ def generar_rda_paciente(rows: list, default_profesional: str = "", default_espe
|
||||
"impConsumo": 0,
|
||||
"observacion": "",
|
||||
"profesional": default_profesional or None,
|
||||
"especialidad": (lambda e: e if e not in (".", "-", "0", "00") else default_especialidad or None)(str(row.get("COD_ESPECIALIDAD") or "").strip()),
|
||||
"especialidad": default_especialidad or None,
|
||||
"diagnosticoprincipal": str(h.get("DIAG_PPAL") or "").strip(),
|
||||
"fechaHoraRealizacion": fecha_real or egreso,
|
||||
})
|
||||
@@ -136,6 +136,7 @@ def generar_rda_paciente(rows: list, default_profesional: str = "", default_espe
|
||||
|
||||
nit_empresa = str(h.get("NIT_EMPRESA") or "").strip()
|
||||
es_particular = nit_empresa.upper() in ("PART", "PARTICULAR", "", "0")
|
||||
cod_contrato = str(h.get("CODCONTRATO") or "").strip() or None
|
||||
# Códigos configurados en TNS para este laboratorio (GET /v2/tablas/FormaPago/ObtenerFormasDePago)
|
||||
cod_forma_pago = "CLIP" if es_particular else "INST"
|
||||
|
||||
@@ -163,7 +164,7 @@ def generar_rda_paciente(rows: list, default_profesional: str = "", default_espe
|
||||
"fechaHoraIngreso": ingreso,
|
||||
"fechaHoraEgreso": egreso,
|
||||
"modalidadAtencion": modalidad,
|
||||
"numeroContrato": nit_empresa,
|
||||
"numeroContrato": cod_contrato,
|
||||
"diagnosticoprincipal": str(h.get("DIAG_PPAL") or "").strip(),
|
||||
"tipousuario": tipoususispro,
|
||||
"viaIngreso": via_ingreso,
|
||||
|
||||
Reference in New Issue
Block a user