Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
node_crisp
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
web
node_crisp
Commits
b4e6aa4a
Commit
b4e6aa4a
authored
May 31, 2021
by
Gabriel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Agrega endpoints de IS
parent
a30770fc
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
95 additions
and
0 deletions
+95
-0
is.js
endpoints/is.js
+95
-0
No files found.
endpoints/is.js
0 → 100644
View file @
b4e6aa4a
const
config
=
require
(
'config'
);
const
axios
=
require
(
'axios'
);
var
AUTH_TOKEN
=
config
.
get
(
'credenciales.isApiToken'
);
axios
.
defaults
.
baseURL
=
config
.
get
(
'baseUrl'
)
axios
.
defaults
.
headers
.
common
=
{
'Authorization'
:
`Bearer
${
AUTH_TOKEN
}
`
}
function
sortProvinciasById
(
provincias
)
{
let
ids
=
[];
for
(
let
i
=
0
;
i
<
provincias
.
length
;
i
++
)
{
ids
.
push
(
provincias
[
i
].
id_provincia
);
}
ids
.
sort
(
function
(
a
,
b
)
{
return
parseInt
(
a
)
-
parseInt
(
b
)
});
let
sortedProvincias
=
[];
for
(
let
i
=
0
;
i
<
ids
.
length
;
i
++
)
{
sortedProvincias
.
push
(
getProvinciaById
(
provincias
,
ids
[
i
]));
}
return
sortedProvincias
;
}
function
getProvinciaById
(
provincias
,
id
)
{
for
(
let
i
=
0
;
i
<
provincias
.
length
;
i
++
)
{
if
(
provincias
[
i
].
id_provincia
===
id
)
{
return
provincias
[
i
];
}
}
}
module
.
exports
=
{
getProvincias
:
async
function
()
{
return
await
axios
.
get
(
'provincias/atencion'
)
.
then
(
async
function
(
response
)
{
let
provincias
=
response
.
data
;
return
sortProvinciasById
(
provincias
);
})
.
catch
(
function
(
error
)
{
console
.
log
(
error
);
});
},
getMedicosByName
:
async
function
(
nombreMedico
,
idProvincia
)
{
return
await
axios
.
get
(
`/medicos/atencion?id_provincia=
${
idProvincia
}
&nombre=
${
nombreMedico
}
&solo_videoconsultas`
)
.
then
(
async
function
(
response
)
{
return
response
.
data
.
data
;
})
.
catch
(
function
(
error
)
{
console
.
log
(
error
);
});
},
getEspecialidadesMedico
:
async
function
(
idPersonaInstitucional
,
idProvincia
)
{
return
await
axios
.
get
(
`/atenciones?id_provincia=
${
idProvincia
}
&id_persona_institucional=
${
idPersonaInstitucional
}
`
)
.
then
(
async
function
(
response
)
{
return
response
.
data
.
data
;
})
.
catch
(
function
(
error
)
{
console
.
log
(
error
);
});
},
getTurnosDisponibles
:
async
function
(
idAgenda
,
idPersonaInstitucional
,
fecha
)
{
let
year
=
fecha
.
split
(
'/'
)[
2
];
let
month
=
fecha
.
split
(
'/'
)[
1
];
let
day
=
fecha
.
split
(
'/'
)[
0
];
let
fechaUSA
=
year
+
"-"
+
month
+
"-"
+
day
;
console
.
log
(
fechaUSA
);
return
await
axios
.
get
(
`/turnos/turnos_disponibles?id_agenda=
${
idAgenda
}
&id_persona_institucional=
${
idPersonaInstitucional
}
&fecha=
${
fechaUSA
}
`
)
.
then
(
async
function
(
response
)
{
return
response
.
data
.
turnos
;
})
.
catch
(
function
(
error
)
{
console
.
log
(
error
);
});
},
crearTurno
:
async
function
(
tipoDocumento
,
numeroDocumento
,
fechaNacimiento
,
sexo
,
mail
,
telefono
,
idHorario
,
fechaHora
)
{
return
await
axios
.
post
(
'/watson/confirmar_reserva'
,
{
"tipo_documento"
:
tipoDocumento
,
"numero_documento"
:
numeroDocumento
,
"fecha_nacimiento"
:
fechaNacimiento
,
"sexo"
:
sexo
,
"mail"
:
mail
,
"telefono_celular"
:
telefono
,
"id_horario"
:
idHorario
,
"fecha_hora"
:
fechaHora
})
.
then
(
async
function
(
response
)
{
return
response
.
data
;
})
.
catch
(
function
(
error
)
{
console
.
log
(
error
);
});
}
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment