Skip to content

Commit

Permalink
ref(in): guarda verificacion de prescripcion (#1738)
Browse files Browse the repository at this point in the history
  • Loading branch information
negro89 committed Aug 25, 2022
1 parent baf1d4f commit eb58494
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,11 @@ PlanIndicacionesRouter.patch('/plan-indicaciones/:id/estado', asyncHandler(async
const indicacion = await PlanIndicacionesCtr.findById(req.params.id);
if (indicacion) {
const estado = req.body;
indicacion.estados.push(estado);
if (estado.verificacion) {
indicacion.estados[indicacion.estados.length - 1] = req.body;
} else {
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 @@ -15,7 +15,14 @@ export const PlanIndicacionesEstadoSchema = new Schema({
enum: ['active', 'on-hold', 'cancelled', 'completed', 'entered-in-error', 'stopped', 'draft', 'unknown', 'edited']
},
fecha: Date,
motivo: String
motivo: String,
verificacion: {
estado: {
type: String,
enum: ['aceptada', 'rechazada']
},
motivoRechazo: String
}
}, { _id: false });

PlanIndicacionesEstadoSchema.plugin(AuditPlugin);
Expand All @@ -31,28 +38,20 @@ export const PlanIndicacionesSchema = new Schema({
required: true
},
profesional: ProfesionalSubSchema,

idPrestacion: SchemaTypes.ObjectId,
idRegistro: SchemaTypes.ObjectId,

concepto: SnomedConcept,
nombre: String,

fechaInicio: Date,
fechaBaja: {
type: Date,
default: null
},

valor: SchemaTypes.Mixed,

estados: [PlanIndicacionesEstadoSchema],
estadoActual: PlanIndicacionesEstadoSchema,

turneable: Boolean,

seccion: SnomedConcept

});

PlanIndicacionesSchema.plugin(AuditPlugin);
Expand Down

0 comments on commit eb58494

Please sign in to comment.