feat: add 5 minutes to fechaHoraEgreso in RDA
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
235e20e38d
commit
b88d727623
@@ -1,6 +1,6 @@
|
|||||||
import re as _re
|
import re as _re
|
||||||
from collections import defaultdict
|
from collections import defaultdict
|
||||||
from datetime import datetime, date
|
from datetime import datetime, date, timedelta
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
# v1.4.0
|
# v1.4.0
|
||||||
|
|
||||||
@@ -169,11 +169,16 @@ def generar_rda_paciente(rows: list, default_profesional: str = "", default_espe
|
|||||||
"fechaHoraRealizacion": fecha_real or recepcion_dt,
|
"fechaHoraRealizacion": fecha_real or recepcion_dt,
|
||||||
})
|
})
|
||||||
|
|
||||||
# Egreso = fechaHoraRealizacion del último examen en el detalle
|
# Egreso = fechaHoraRealizacion del último examen + 5 minutos
|
||||||
egreso = max(
|
_egreso_raw = max(
|
||||||
(d["fechaHoraRealizacion"] for d in detalle_pedido if d["fechaHoraRealizacion"]),
|
(d["fechaHoraRealizacion"] for d in detalle_pedido if d["fechaHoraRealizacion"]),
|
||||||
default=recepcion_dt,
|
default=recepcion_dt,
|
||||||
)
|
)
|
||||||
|
try:
|
||||||
|
_egreso_dt = datetime.strptime(_egreso_raw, "%d/%m/%Y %H:%M:%S") + timedelta(minutes=5)
|
||||||
|
egreso = _egreso_dt.strftime("%d/%m/%Y %H:%M:%S")
|
||||||
|
except Exception:
|
||||||
|
egreso = _egreso_raw
|
||||||
|
|
||||||
nit_empresa = str(h.get("NIT_EMPRESA") or "").strip()
|
nit_empresa = str(h.get("NIT_EMPRESA") or "").strip()
|
||||||
cod_contrato_raw = str(h.get("CODCONTRATO") or "").strip()
|
cod_contrato_raw = str(h.get("CODCONTRATO") or "").strip()
|
||||||
|
|||||||
Reference in New Issue
Block a user