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
15 changes: 14 additions & 1 deletion modules/rup/routes/prestacion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,20 @@ router.get('/prestaciones/solicitudes', async (req: any, res, next) => {

if (req.query.idPaciente) {
indice = undefined;
match.$and.push({ 'paciente.id': Types.ObjectId(req.query.idPaciente) });
if (String(req.query.agregarVinculados) === 'true') {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

¿Por que al booleano "agregarVinculados" lo transformas en un tipo String?
Por lo que estuve probando el comportamiento es el mismo si se declara string o booleano.

const paciente = await PacienteCtr.findById(req.query.idPaciente);
const idsAndes = [Types.ObjectId(req.query.idPaciente)];
if (paciente && paciente.identificadores) {
paciente.identificadores.forEach((identificador: any) => {
if (identificador.entidad === 'ANDES' && Types.ObjectId.isValid(identificador.valor)) {
idsAndes.push(Types.ObjectId(identificador.valor));
}
});
}
match.$and.push({ 'paciente.id': { $in: idsAndes } });
} else {
match.$and.push({ 'paciente.id': Types.ObjectId(req.query.idPaciente) });
}
}

if (req.query.idProfesional) {
Expand Down
Loading