An API that will take control over the healthcare institution registration as well as the exams ingest.
\main\resources\application.properties
file or with the DATASOURCE_HOST
, DATASOURCE_SCHEMA
, DATASOURCE_USERNAME
and DATASOURCE_PASSWORD
environment variables). mvn spring-boot:run
The API description and try-out methods can be viewed in the following URL:
/swagger-ui.html
An API that will take control over the healthcare institution registration.
Creates a single Healthcare Institution. The token returned needs to be used as Beared Authentication Header for exams API.
URL
/healthcareinstitutions/
Method:
POST
Data Params
Required:
Name=[alphanumeric]
CNPJ=[alphanumeric]
Success Response:
{ "Name": "lucasbernardo.org", "CNPJ": "16191374000171", "token": "XXXXXX.XXXXXXXXXXXXX" }
Error Response:
{ "cnpj": "Duplicate entry '16191374000171' for key 'CNPJ'" }
OR
{ "cnpj": "CNPJ is mandatory." }
OR
{ "cnpj": "Invalid CNPJ." }
Sample Call:
$.ajax({
url: '/exams/',
method: 'POST',
timeout: 0,
dataType: 'json',
data: JSON.stringify({ Name: 'lucasbernardo.org', CNPJ: '16.191.374/0001-71' })
}).done(function (response) {
console.log(response);
});
An API that will take control over the exam ingest. The Beared Authentication Header is required and can be obtain creating a healthcare institution.
Creates a single Exam. This resource charges 1 pixeon.
URL
/exams/
Method:
POST
Data Params
Required:
PatientName=[alphanumeric]
PatientAge=[integer]
PatientAge=[enum(M or F)]
PhysicianName=[alphanumeric]
PhysicianCRM=[alphanumeric]
ProcedureName=[alphanumeric]
Success Response:
{
"id": 6,
"healthcareInstitution": {
"Name": "lucasbernardo.org",
"CNPJ": "16191374000171"
},
"PatientName": "John Doe",
"PatientAge": 55,
"PatientGender": "M",
"PhysicianName": "Taylor Joe",
"PhysicianCRM": "45465223",
"ProcedureName": "MRI"
}
Error Response:
{ "error": "token \"XXXXXX.XXXXXXXXXXXXX\" not found." }
OR
{ "error": "The resource is secured and no token was informed." }
OR
{ "patientName": "PatientName is mandatory." }
OR
{ "patientGender": "PatientGender must be \"M\" or \"F\"." }
OR
{ "patientAge": "PatientAge should be a positive integer." }
OR
{ "HealthcareInstitution": "Out of budget." }
Sample Call:
$.ajax({
url: '/exams/',
method: 'POST',
timeout: 0,
dataType: 'json',
"headers": {
"Content-Type": "application/json",
"Authorization": "Bearer XXXXXX.XXXXXXXXXXXXX"
},
data: JSON.stringify({
PatientName: 'John Doe',
PatientAge: 55,
PatientGender: 'M',
PhysicianName: 'Taylor Joe',
PhysicianCRM: '45465223',
ProcedureName: 'MRI'
})
}).done(function (response) {
console.log(response);
});
Update data of an existent Exam.
URL
/exams/:id/
Method:
PUT
URL Params
Required:
id=[integer]
Data Params
Required:
PatientName=[alphanumeric]
PatientAge=[integer]
PatientAge=[enum(M or F)]
PhysicianName=[alphanumeric]
PhysicianCRM=[alphanumeric]
ProcedureName=[alphanumeric]
Success Response:
{
"id": 6,
"healthcareInstitution": {
"id": 1,
"Name": "lucasbernardo.org",
"CNPJ": "16191374000171"
},
"PatientName": "John Doe",
"PatientAge": 55,
"PatientGender": "M",
"PhysicianName": "Taylor Joe",
"PhysicianCRM": "45465223",
"ProcedureName": "MRI"
}
Error Response:
{ "error": "token \"XXXXXX.XXXXXXXXXXXXX\" not found." }
OR
{ "error": "The resource is secured and no token was informed." }
OR
{ "Exam": "id \"2\" not found." }
OR
{ "patientName": "PatientName is mandatory." }
OR
{ "patientGender": "PatientGender must be \"M\" or \"F\"." }
OR
{ "patientAge": "PatientAge should be a positive integer." }
Sample Call:
$.ajax({
url: '/exams/6',
method: 'PUT',
timeout: 0,
dataType: 'json',
"headers": {
"Content-Type": "application/json",
"Authorization": "Bearer XXXXXX.XXXXXXXXXXXXX"
},
data: JSON.stringify({
PatientName: 'John Doe',
PatientAge: 55,
PatientGender: 'M',
PhysicianName: 'Taylor Joe',
PhysicianCRM: '45465223',
ProcedureName: 'MRI'
})
}).done(function (response) {
console.log(response);
});
Delete an existent Exam.
URL
/exams/:id/
Method:
DELETE
URL Params
Required:
id=[integer]
Success Response:
{ "deleted": true }
Error Response:
{ "error": "token \"XXXXXX.XXXXXXXXXXXXX\" not found." }
OR
{ "error": "The resource is secured and no token was informed." }
OR
{ "Exam": "id \"2\" not found." }
Sample Call:
$.ajax({
url: '/exams/6',
method: 'DELETE',
timeout: 0,
"headers": {
"Authorization": "Bearer XXXXXX.XXXXXXXXXXXXX"
}
}).done(function (response) {
console.log(response);
});
Retrieve a previously created Exam. Charges 1 pixeon in the first call of every exam.
URL
/exams/:id/
Method:
GET
URL Params
Required:
id=[integer]
Success Response:
{
"id": 6,
"healthcareInstitution": {
"id": 1,
"Name": "lucasbernardo.org",
"CNPJ": "16191374000171"
},
"PatientName": "John Doe",
"PatientAge": 55,
"PatientGender": "M",
"PhysicianName": "Taylor Joe",
"PhysicianCRM": "45465223",
"ProcedureName": "MRI"
}
Error Response:
{ "error": "token \"XXXXXX.XXXXXXXXXXXXX\" not found." }
OR
{ "error": "The resource is secured and no token was informed." }
OR
{ "Exam": "id \"2\" not found." }
OR
{ "HealthcareInstitution": "Out of budget." }
Sample Call:
$.ajax({
url: '/exams/6',
method: 'GET',
"headers": {
"Authorization": "Bearer XXXXXX.XXXXXXXXXXXXX"
},
timeout: 0
}).done(function (response) {
console.log(response);
});