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',