Skip to content

Commit

Permalink
(Feat) IN-575: Plan de indicaciones - motivo de rechazo
Browse files Browse the repository at this point in the history
  • Loading branch information
JuanIRamirez authored and aldoEMatamala committed Jan 17, 2024
1 parent 5243d0d commit 3145da7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,13 @@ class PlanIndicacionesController extends ResourceBase<IPlanIndicacionesDoc> {
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;
Expand All @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export const PlanIndicacionesEstadoSchema = new Schema({
type: String,
enum: ['aceptada', 'rechazada']
},
key: String,
motivoRechazo: String
}
}, { _id: false });
Expand Down

0 comments on commit 3145da7

Please sign in to comment.