Fix particular: numeroContrato siempre "12" y sin numeroAutorizacion

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Lizandro Guarnizo
2026-06-26 20:26:42 -05:00
co-authored by Claude Sonnet 4.6
parent 69372a5673
commit be272296af
+5 -2
View File
@@ -139,7 +139,7 @@ def generar_rda_paciente(rows: list, default_profesional: str = "", default_espe
"fechaHoraRealizacion": fecha_real or egreso,
})
autorizacion = str(h.get("AUTORIZACION") or "").strip() or None
autorizacion = None if es_particular else (str(h.get("AUTORIZACION") or "").strip() or None)
nit_empresa = str(h.get("NIT_EMPRESA") or "").strip()
cod_contrato_raw = str(h.get("CODCONTRATO") or "").strip()
@@ -148,7 +148,10 @@ def generar_rda_paciente(rows: list, default_profesional: str = "", default_espe
nit_empresa.upper() in ("PART", "PARTICULAR", "", "0")
or cod_contrato_raw.lstrip("0") == "12"
)
cod_contrato = cod_contrato_raw or ("12" if es_particular else None)
if es_particular:
cod_contrato = "12" # TNS tiene el contrato como "12", no "012"
else:
cod_contrato = cod_contrato_raw or None
cod_forma_pago = "CLIP" if es_particular else "INST"
# tipousuario: particular siempre "12"; para convenios usar TIPOUSUSISPRO o derivar