From 3145da7fe1266e8b4a5a4bbad8023e7704938628 Mon Sep 17 00:00:00 2001 From: "jiramirez_nqn@hotmail.com" Date: Wed, 25 Oct 2023 14:56:31 -0300 Subject: [PATCH] (Feat) IN-575: Plan de indicaciones - motivo de rechazo --- .../plan-indicaciones.routes.ts | 18 ++++++++---------- .../plan-indicaciones.schema.ts | 1 + 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/modules/rup/internacion/plan-indicaciones/plan-indicaciones.routes.ts b/modules/rup/internacion/plan-indicaciones/plan-indicaciones.routes.ts index b22e87d35..6e7826aab 100644 --- a/modules/rup/internacion/plan-indicaciones/plan-indicaciones.routes.ts +++ b/modules/rup/internacion/plan-indicaciones/plan-indicaciones.routes.ts @@ -19,11 +19,13 @@ class PlanIndicacionesController extends ResourceBase { internacion: MongoQuery.equalMatch.withField('idInternacion'), prestacion: MongoQuery.equalMatch.withField('idPrestacion'), registro: MongoQuery.equalMatch.withField('idRegistro'), - rangoFechas:(fecha: Date)=>{ - return { $or:[ - { fechaInicio: { $gte: moment(fecha).startOf('day').toDate() } }, - { fechaInicio: { $lte: moment(fecha).endOf('day').add(1, 'd').toDate() } } - ] }; + rangoFechas: (fecha: Date) => { + return { + $or: [ + { fechaInicio: { $gte: moment(fecha).startOf('day').toDate() } }, + { fechaInicio: { $lte: moment(fecha).endOf('day').add(1, 'd').toDate() } } + ] + }; } }; eventBus = EventCore; @@ -37,11 +39,7 @@ PlanIndicacionesRouter.patch('/plan-indicaciones/:id/estado', asyncHandler(async const indicacion = await PlanIndicacionesCtr.findById(req.params.id); if (indicacion) { const estado = req.body; - if (estado.verificacion) { - indicacion.estados[indicacion.estados.length - 1] = req.body; - } else { - indicacion.estados.push(estado); - } + indicacion.estados.push(estado); Auth.audit(indicacion, req); const indicacionUpdated = await indicacion.save(); EventCore.emitAsync('internacion:plan-indicaciones:update', indicacionUpdated); diff --git a/modules/rup/internacion/plan-indicaciones/plan-indicaciones.schema.ts b/modules/rup/internacion/plan-indicaciones/plan-indicaciones.schema.ts index 0b999bafe..d8b99fe93 100644 --- a/modules/rup/internacion/plan-indicaciones/plan-indicaciones.schema.ts +++ b/modules/rup/internacion/plan-indicaciones/plan-indicaciones.schema.ts @@ -21,6 +21,7 @@ export const PlanIndicacionesEstadoSchema = new Schema({ type: String, enum: ['aceptada', 'rechazada'] }, + key: String, motivoRechazo: String } }, { _id: false });