From 14b108c74937f9bfcbec3d66023b4d3fc2f6036d Mon Sep 17 00:00:00 2001 From: aldoEMatamala Date: Wed, 4 Feb 2026 15:45:27 -0300 Subject: [PATCH] =?UTF-8?q?fix(IN-669):Obra=20Social:=20no=20se=20actualiz?= =?UTF-8?q?a=20el=20ingreso=20en=20capa=20estad=C3=ADstica?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/rup/internacion/camas.routes.ts | 32 +++++++++++++++++++------ 1 file changed, 25 insertions(+), 7 deletions(-) diff --git a/modules/rup/internacion/camas.routes.ts b/modules/rup/internacion/camas.routes.ts index aa3ea0510..a0e245b69 100644 --- a/modules/rup/internacion/camas.routes.ts +++ b/modules/rup/internacion/camas.routes.ts @@ -177,14 +177,32 @@ router.patch('/camaEstados/:idCama', Auth.authenticate(), capaMiddleware, asyncH }, { arrayFilters: [{ 'elemento.valor.informeIngreso.fechaIngreso': moment(req.body.fechaIngreso).toDate() }] } ); + if (req.body.extras?.edicionFinanciador) { + result = await CamaEstados.update( + { + 'estados.idInternacion': Types.ObjectId(req.body.idInternacion) + }, + { + $set: { + 'estados.$[elemento].paciente.obraSocial': req.body.paciente.obraSocial + } + }, + { + arrayFilters: [{ 'elemento.idInternacion': Types.ObjectId(req.body.idInternacion) }], + multi: true + } + ); + } + } + if (!req.body.extras?.edicionFinanciador) { + + const organizacion = { + _id: Auth.getOrganization(req), + nombre: Auth.getOrganization(req, 'nombre') + }; + const data = { ...req.body, organizacion, id: req.params.idCama }; + result = await CamasController.patchEstados(data, req); } - - const organizacion = { - _id: Auth.getOrganization(req), - nombre: Auth.getOrganization(req, 'nombre') - }; - const data = { ...req.body, organizacion, id: req.params.idCama }; - result = await CamasController.patchEstados(data, req); } catch (err) { const dataErr = { ruta: '/camaEstados/:idCama',