From f5b9ec85db645cac6e2a18869a8471e8cbda21f3 Mon Sep 17 00:00:00 2001 From: AgustinRodriguez-Andes <63318331+agustin1996ra@users.noreply.github.com> Date: Tue, 21 Apr 2026 15:30:51 -0300 Subject: [PATCH] REC-216: Carga de fecha nacimiento si el paciente no lo tiene --- modules/recetas/recetasController.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/modules/recetas/recetasController.ts b/modules/recetas/recetasController.ts index f6f61df783..9c43bab16a 100644 --- a/modules/recetas/recetasController.ts +++ b/modules/recetas/recetasController.ts @@ -558,6 +558,11 @@ export async function create(req) { if (!pacienteAndes) { throw new ParamsIncorrect('Paciente no encontrado'); } else { + const fechaNacimientoReceta = pacienteRecetar.fechaNacimiento ? new Date(pacienteRecetar.fechaNacimiento) : null; + if (!pacienteAndes.fechaNacimiento && fechaNacimientoReceta && !Number.isNaN(fechaNacimientoReceta.getTime())) { + pacienteAndes.fechaNacimiento = fechaNacimientoReceta; + await pacienteAndes.save(); + } pacienteAndes.obraSocial = (!pacienteRecetar.obraSocial) ? null : { origen: pacienteRecetar.obraSocial.otraOS ? 'RECETAR' : 'PUCO',