The challenge is to build a api to post and get activities, to post cards and get cards with some additional information
- I recommend to use:
- Create a Spring Starter Project on Spring Boot Tool suite 4 and clone all the structures to theirs respective locations.
- Run SpringBootApiApplication.java as a Spring Boot App
- Open Postman to run the endpoints bellow
- Get all activity (GET) : http://localhost:8080/activities
- Example Database returns:
[
{
"activityid":10,
"activityTitle":"Berçario",
"activitysubtitle":"Organizar Prontuario",
"sla":10,
"cards":[
{
"visitId":15,
"checklist":{
"check 4":false,
"check 2":true,
"check 3":true,
"check 1":true
},
"documents":{
"document 1":true,
"document 2":false,
"document 3":true,
"document 4":false
},
"pendencies":{
"pendency 1":false,
"pendency 2":false,
"pendency 3":false,
"pendency 4":false
},
"createdIn":"2020-11-05"
}
]
},
{
"activityid":11,
"activityTitle":"Auditoria",
"activitysubtitle":"Limpar Conta",
"sla":20,
"cards":[
{
"visitId":14,
"checklist":{
"check 4":true,
"check 2":true,
"check 3":true,
"check 1":true
},
"documents":{
"document 1":true,
"document 2":true,
"document 3":true,
"document 4":true
},
"pendencies":{
"pendency 1":false,
"pendency 2":true,
"pendency 3":true,
"pendency 4":false
},
"createdIn":"2020-11-05"
}
]
},
{
"activityid":12,
"activityTitle":"Centro Cirurgico",
"activitysubtitle":"organizar Prontuario",
"sla":2,
"cards":[
{
"visitId":13,
"checklist":{
"check 4":false,
"check 2":false,
"check 3":false,
"check 1":false
},
"documents":{
"document 1":false,
"document 2":false,
"document 3":false,
"document 4":false
},
"pendencies":{
"pendency 1":true,
"pendency 2":true,
"pendency 3":true,
"pendency 4":true
},
"createdIn":"2020-11-05"
},
{
"visitId":17,
"checklist":{
},
"documents":{
},
"pendencies":{
},
"createdIn":"2020-11-05"
}
]
}
]- Create Activity (POST): http://localhost:8080/activities/createactivity({activityTitle},{activitySubtitle},{sla})
- Example: http://localhost:8080/activities/createactivity(Atividade1,subtitulo_da_atividade,15)
- Example Database returns after get:
{
"activityid":16,
"activityTitle":"Atividade1",
"activitysubtitle":"subtitulo_da_atividade",
"sla":15,
"cards":[
]
}- Get all cards (GET) : http://localhost:8080/cards
- Example Database returns:
{
"_embedded":{
"Cards":[
{
"checklist":{
"check 4":false,
"check 2":false,
"check 3":false,
"check 1":false
},
"documents":{
"document 1":false,
"document 2":false,
"document 3":false,
"document 4":false
},
"pendencies":{
"pendency 1":true,
"pendency 2":true,
"pendency 3":true,
"pendency 4":true
},
"createdIn":"2020-11-05",
"_links":{
"self":{
"href":"http://localhost:8080/cards/13"
},
"card":{
"href":"http://localhost:8080/cards/13"
},
"activity":{
"href":"http://localhost:8080/cards/13/activity"
},
"patient":{
"href":"http://localhost:8080/cards/13/patient"
},
"healthinsurance":{
"href":"http://localhost:8080/cards/13/healthinsurance"
},
"bill":{
"href":"http://localhost:8080/cards/13/bill"
}
}
},
{
"checklist":{
"check 4":true,
"check 2":true,
"check 3":true,
"check 1":true
},
"documents":{
"document 1":true,
"document 2":true,
"document 3":true,
"document 4":true
},
"pendencies":{
"pendency 1":false,
"pendency 2":true,
"pendency 3":true,
"pendency 4":false
},
"createdIn":"2020-11-05",
"_links":{
"self":{
"href":"http://localhost:8080/cards/14"
},
"card":{
"href":"http://localhost:8080/cards/14"
},
"activity":{
"href":"http://localhost:8080/cards/14/activity"
},
"patient":{
"href":"http://localhost:8080/cards/14/patient"
},
"healthinsurance":{
"href":"http://localhost:8080/cards/14/healthinsurance"
},
"bill":{
"href":"http://localhost:8080/cards/14/bill"
}
}
},
{
"checklist":{
"check 4":false,
"check 2":true,
"check 3":true,
"check 1":true
},
"documents":{
"document 1":true,
"document 2":false,
"document 3":true,
"document 4":false
},
"pendencies":{
"pendency 1":false,
"pendency 2":false,
"pendency 3":false,
"pendency 4":false
},
"createdIn":"2020-11-05",
"_links":{
"self":{
"href":"http://localhost:8080/cards/15"
},
"card":{
"href":"http://localhost:8080/cards/15"
},
"activity":{
"href":"http://localhost:8080/cards/15/activity"
},
"patient":{
"href":"http://localhost:8080/cards/15/patient"
},
"healthinsurance":{
"href":"http://localhost:8080/cards/15/healthinsurance"
},
"bill":{
"href":"http://localhost:8080/cards/15/bill"
}
}
}
]
},
"_links":{
"self":{
"href":"http://localhost:8080/cards"
},
"profile":{
"href":"http://localhost:8080/profile/cards"
}
},
"page":{
"size":20,
"totalElements":3,
"totalPages":1,
"number":0
}
}- Get especific Cards (GET) : http://localhost:8080/cards/searchcards({activityid},{q},{qvalue},{filter},{page},{perpage})
- Example: http://localhost:8080/cards/searchcards(11,patientName,Patient1,TO_RECEIVE,2,1)
- Example returns:
[
{
"card 15":{
"daysSinceCreated":0,
"slaStatus":"OK",
"patientid":1,
"patientname":"Patient1",
"healthInsuranceid":4,
"healthInsuranceName":"Unimed",
"visitId":15,
"billid":9,
"billtype":"Hospitalar",
"totalAmount":50000.0,
"numberOfPendencies":4,
"numberOfOpenPendencies":4,
"numberOfDocuments":4,
"numberOfNotReceivedDocuments":2,
"numberOfChecklistItem":4,
"numberOfDoneChecklistItem":3
}
},
{
"totalCardsOk":1
},
{
"totalCardsWarning":0
},
{
"totalCardsDelayed":0
},
{
"Cards per page":1,
"Page":2
}
]- Create Card (POST): http://localhost:8080/cards/createcard({patientId},{healthinsuranceid},{billtype},{billtotalamount},{activityid})
- Example: http://localhost:8080/cards/createcard(3,5,Ambulatorial,999.50,12)
- GET card by visit id after POST example returns:
[
{
"card 18":{
"daysSinceCreated":0,
"slaStatus":"OK",
"patientid":3,
"patientname":"PatientThree",
"healthInsuranceid":5,
"healthInsuranceName":"porto seguro",
"visitId":18,
"billid":17,
"billtype":"Ambulatorial",
"totalAmount":999.5,
"numberOfPendencies":0,
"numberOfOpenPendencies":0,
"numberOfDocuments":0,
"numberOfNotReceivedDocuments":0,
"numberOfChecklistItem":0,
"numberOfDoneChecklistItem":0
}
},
{
"totalCardsOk":1
},
{
"totalCardsWarning":0
},
{
"totalCardsDelayed":0
},
{
"Cards per page":10,
"Page":1
}
]-
Add Check item to Card (POST) : http://localhost:8080/cards/addcheckitem({cardid},{description},{done})
-
Add document to Card (Post): http://localhost:8080/cards/adddocument({cardid},{description},{received})
-
Add pendency to Card (POST): http://localhost:8080/cards/addpendency({cardid},{description},{done})
-
Get all Bills (GET): http://localhost:8080/bills
-
Get all Patients (GET): http://localhost:8080/patients
-
Get all Health Insurances (GET): http://localhost:8080/healthinsurances