File size: 838 Bytes
5f12c93 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | """
M2 Turnos — notificación de resultado de quirófano.
"""
from datetime import datetime, timezone
from app.config import settings
from app.integrations._base import _post
def notify_resultado_quirofano(
turno_id: str,
reserva_id: int,
cama_id: int,
reserva_urgente_id: int,
motivo: str | None = None,
) -> bool:
if settings.mock_external_services:
return True
payload = {
"resultado": "CANCELADA",
"reserva_id": reserva_id,
"cama_id": cama_id,
"motivo_cancelacion": "DESPLAZADA_POR_URGENCIA",
"reserva_urgente_id": reserva_urgente_id,
"motivo": motivo,
"timestamp": datetime.now(timezone.utc).isoformat(),
}
return _post(
f"{settings.m2_turnos_url}/api/v1/turnos/{turno_id}/resultado-quirofano", payload
) is not None
|