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>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
3017c7956e
commit
c64a68ec6f
@@ -96,7 +96,8 @@ def agrupar_por_recepcion(rows: list) -> dict:
|
||||
return grupos
|
||||
|
||||
|
||||
def generar_rda_paciente(rows: list, default_profesional: str = "", default_especialidad: str = "") -> dict:
|
||||
def generar_rda_paciente(rows: list, default_profesional: str = "", default_especialidad: str = "",
|
||||
default_remisionante: str = "00", default_prefijo: str = "00") -> dict:
|
||||
if not rows:
|
||||
return {}
|
||||
h = rows[0]
|
||||
@@ -116,6 +117,7 @@ def generar_rda_paciente(rows: list, default_profesional: str = "", default_espe
|
||||
row.get("FECHA_REPORTADO") if str(row.get("FECHA_REPORTADO") or "")[:4] != "1900"
|
||||
else h.get("FECHA_RECEPCION")
|
||||
)
|
||||
cedula_medico = str(row.get("DOCIDMEDICO") or "").strip()
|
||||
detalle_pedido.append({
|
||||
"codigoMaterial": str(row.get("COD_EXAMEN") or "").strip(),
|
||||
"codigoBodega": "00",
|
||||
@@ -128,6 +130,7 @@ def generar_rda_paciente(rows: list, default_profesional: str = "", default_espe
|
||||
"observacion": "",
|
||||
"profesional": default_profesional or None,
|
||||
"especialidad": default_especialidad or None,
|
||||
"profesionalRemisionante": cedula_medico or default_remisionante or None,
|
||||
"diagnosticoprincipal": str(h.get("DIAG_PPAL") or "").strip(),
|
||||
"fechaHoraRealizacion": fecha_real or egreso,
|
||||
})
|
||||
@@ -152,8 +155,8 @@ def generar_rda_paciente(rows: list, default_profesional: str = "", default_espe
|
||||
modalidad = "01" # Intramural (laboratorio en sede fija)
|
||||
|
||||
return {
|
||||
"codigoPrefijo": str(h.get("PREFIJO") or "00").strip(),
|
||||
"numero": str(h.get("NUM_FACTURA") or "").strip(),
|
||||
"codigoPrefijo": default_prefijo or str(h.get("PREFIJO") or "00").strip(),
|
||||
"numero": str(h.get("NUM_FACTURA") or "").strip() if (h.get("NUM_FACTURA") or 0) != 0 else "",
|
||||
"fecha": fecha,
|
||||
"codTercero": str(h.get("COD_PACIENTE") or "").strip(),
|
||||
"codVendedor": "00",
|
||||
|
||||
Reference in New Issue
Block a user