From 0424ff22c67215afe49bcf26aff3a89f64b82e61 Mon Sep 17 00:00:00 2001 From: Celeste Date: Wed, 27 Mar 2024 12:48:05 -0300 Subject: [PATCH] fix(AM): se modifica la distancia para sacar turnos por mobile (#1881) --- modules/rup/internacion/internacion.routes.ts | 2 +- .../plan-indicaciones.routes.ts | 33 +++++++++++++++++++ 2 files changed, 34 insertions(+), 1 deletion(-) diff --git a/modules/rup/internacion/internacion.routes.ts b/modules/rup/internacion/internacion.routes.ts index 08509ddf84..16ac18cb2c 100644 --- a/modules/rup/internacion/internacion.routes.ts +++ b/modules/rup/internacion/internacion.routes.ts @@ -26,7 +26,7 @@ router.get('/prestaciones', async (req, res, next) => { }); router.get('/:capa/:idInternacion/historial', capaMiddleware, async (req: Request, res: Response, next) => { - const organizacionId = Auth.getOrganization(req); + const organizacionId = (req.query.organizacionID) ? req.query.organizacionID : Auth.getOrganization(req); const capa = req.params.capa; const idInternacion = req.params.idInternacion; const desde = req.query.desde; diff --git a/modules/rup/internacion/plan-indicaciones/plan-indicaciones.routes.ts b/modules/rup/internacion/plan-indicaciones/plan-indicaciones.routes.ts index 45abcdd08f..2c816fe4ea 100644 --- a/modules/rup/internacion/plan-indicaciones/plan-indicaciones.routes.ts +++ b/modules/rup/internacion/plan-indicaciones/plan-indicaciones.routes.ts @@ -14,11 +14,23 @@ class PlanIndicacionesController extends ResourceBase { field: 'organizacion.id', fn: MongoQuery.matchString }, + paciente: (value) => { + return { + $or: [ + { 'paciente.documento': MongoQuery.partialString(value) }, + { 'paciente.nombre': MongoQuery.partialString(value) }, + { 'paciente.apellido': MongoQuery.partialString(value) }, + { 'paciente.alias': MongoQuery.partialString(value) }, + { 'paciente.numeroIdentificacion': MongoQuery.partialString(value) } + ] + }; + }, fechaInicio: MongoQuery.matchDate, fechaBaja: MongoQuery.matchDate, internacion: MongoQuery.equalMatch.withField('idInternacion'), prestacion: MongoQuery.equalMatch.withField('idPrestacion'), registro: MongoQuery.equalMatch.withField('idRegistro'), + fechaRango: MongoQuery.matchDate.withField('fechaInicio'), rangoFechas: (fecha: Date) => { return { $or: [ @@ -33,6 +45,27 @@ class PlanIndicacionesController extends ResourceBase { return { $ne: value }; } }, + delDia: () => { + return { + $and: [ + { 'estadoActual.createdAt': { $gte: moment().startOf('day').toDate() } }, + { 'estadoActual.fecha': { $gte: moment().startOf('day').toDate() } } + ] + }; + }, + aceptadas: () => { + return { + $or: [ + { 'estadoActual.tipo': 'bypass' }, + { + $and: [ + { 'estadoActual.tipo': 'active' }, + { 'estadoActual.verificacion.estado': 'aceptada' } + ] + } + ] + }; + } }; eventBus = EventCore; }