Skip to content
Open
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions src/controllers/snomed.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import { ISnomedConcept } from '../interfaces/supply.interface';
class snomedSupplyController implements BaseController {
public index = async (req: Request, res: Response): Promise<Response> => {
try {
const search = req.query.search;
const term = req.query.search;
const path = process.env.API_SNOMED || process.env.ANDES_ENDPOINT;
const resp = await needle('get', `${path}/core/term/snomed?expression=<763158003:732943007=*,[0..0] 774159003=*, 763032000=*&search=${search}`);
const resp = await needle('get', `${path}/core/term/snomed/medicamentos?term=${term}`);
const supplies: ISnomedConcept[] = resp.body;
return res.status(200).json(supplies);
} catch (e) {
Expand Down
1 change: 1 addition & 0 deletions src/interfaces/supply.interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export interface ISnomedConcept {
export default interface ISupply extends Document {
id: string;
name: string;
brand?: string;
activePrinciple: string;
power: string;
unity: string;
Expand Down
7 changes: 5 additions & 2 deletions src/models/supply.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,13 @@ export const supplySchema = new Schema({
type: String,
required: '{PATH} is required'
},
brand: {
type: String
},
activePrinciple: {
type: String
},
pharmaceutical_form:{
pharmaceutical_form: {
type: String
},
power: {
Expand All @@ -32,7 +35,7 @@ export const supplySchema = new Schema({
fsn: String,
semanticTag: String
}
},{
}, {
timestamps: true
});

Expand Down
4 changes: 2 additions & 2 deletions src/routes/private.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,8 @@ class PrivateRoutes {
// this.router.put(`/supplies/:id`, hasPermissionIn('updateAny','patient'), supplyController.update);
// this.router.delete(`/supplies/:id`, hasPermissionIn('deleteAny','patient'), supplyController.delete);

// SNOMED
this.router.get('/snomed/supplies/', hasPermissionIn('readAny', 'supplies'), snomedSupplyController.index);
// // SNOMED
// this.router.get('/snomed/supplies/', hasPermissionIn('readAny', 'supplies'), snomedSupplyController.index);

// Users
this.router.get('/users/index', hasPermissionIn('readAny', 'user'), usersController.index);
Expand Down