Skip to content

Commit 1f36b31

Browse files
committed
fix(IN-669):Obra Social: no se actualiza el ingreso en capa estadística
1 parent a1b10c4 commit 1f36b31

1 file changed

Lines changed: 25 additions & 7 deletions

File tree

modules/rup/internacion/camas.routes.ts

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -177,14 +177,32 @@ router.patch('/camaEstados/:idCama', Auth.authenticate(), capaMiddleware, asyncH
177177
},
178178
{ arrayFilters: [{ 'elemento.valor.informeIngreso.fechaIngreso': moment(req.body.fechaIngreso).toDate() }] }
179179
);
180+
if (req.body.extras?.edicionFinanciador) {
181+
result = await CamaEstados.update(
182+
{
183+
'estados.idInternacion': Types.ObjectId(req.body.idInternacion)
184+
},
185+
{
186+
$set: {
187+
'estados.$[elemento].paciente.obraSocial': req.body.paciente.obraSocial
188+
}
189+
},
190+
{
191+
arrayFilters: [{ 'elemento.idInternacion': Types.ObjectId(req.body.idInternacion) }],
192+
multi: true
193+
}
194+
);
195+
}
196+
}
197+
if (!req.body.extras?.edicionFinanciador) {
198+
199+
const organizacion = {
200+
_id: Auth.getOrganization(req),
201+
nombre: Auth.getOrganization(req, 'nombre')
202+
};
203+
const data = { ...req.body, organizacion, id: req.params.idCama };
204+
result = await CamasController.patchEstados(data, req);
180205
}
181-
182-
const organizacion = {
183-
_id: Auth.getOrganization(req),
184-
nombre: Auth.getOrganization(req, 'nombre')
185-
};
186-
const data = { ...req.body, organizacion, id: req.params.idCama };
187-
result = await CamasController.patchEstados(data, req);
188206
} catch (err) {
189207
const dataErr = {
190208
ruta: '/camaEstados/:idCama',

0 commit comments

Comments
 (0)