Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion core-v2/mpi/paciente/paciente.routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,10 @@ class PacienteResource extends ResourceBase<IPacienteDoc> {
field: 'fechaNacimiento',
fn: (value) => (MongoQuery.matchDate(value))
},
obraSocial: {
field: 'financiador.nombre',
fn: MongoQuery.partialString
},
search: ['documento', 'nombre', 'apellido', 'sexo', 'certificadoRenaper']
};
eventBus = EventCore;
Expand Down Expand Up @@ -120,7 +124,8 @@ export const get = async (req: Request, res: Response) => {
const conditions = { ...req.query };
delete conditions.search;
Object.keys(options).map(opt => delete conditions[opt]);
const pacientes = await multimatch(req.query.search, conditions, options);
const filter = MongoQuery.buildQuery(conditions, PacienteCtr.searchFileds);
const pacientes = await multimatch(req.query.search, filter, options);
return res.json(pacientes);
} else {
if (Object.keys(req.query).length) {
Expand Down
Loading