Login as shr-system-admin to identity server to get a access-token
curl http://localhost:8084/signin -H "X-Auth-Token:local-shr-system-admin_auth_token" -H "client_id:18700" --form "email=local-shr-system-admin@test.com" --form "password=password"
Use the access token to generate Health-IDs for MCI. Replace the ACCESS-TOKEN-FROM-ABOVE-STEP in below request with token from above step.
curl -X POST 'http://localhost:8086/healthIds/generateBlock?start=9800000100&totalHIDs=100' -H 'From: local-shr-system-admin@test.com' -H 'X-Auth-Token: ACCESS-TOKEN-FROM-ABOVE-STEP' -H 'client_id: 18700'
We need to have locations setup to create patients in MCI. A sample locations cql file is available cassandra/mci_locations.cql of HIE-Docker or Infrastructure repository.
docker cp cassandra/mci_locations.cql cassandra-seed:/tmp
docker exec cassandra-seed /bin/bash -c "cqlsh -k mci -f /tmp/mci_locations.cql"
Login to IDP as facility-admin to get a token.
curl http://localhost:8084/signin -H "X-Auth-Token:local-facility-admin_auth_token" -H "client_id:18701" --form "email=local-facility-admin@test.com" --form "password=password"
Use the access token to create patient in MCI. Replace the ACCESS-TOKEN-FROM-ABOVE-STEP in below request with token from above step.
curl -X POST \
http://localhost:8081/api/v1/patients \
-H 'Content-Type: application/json' \
-H 'From: local-facility-admin@test.com' \
-H 'X-Auth-Token: ACCESS-TOKEN-FROM-ABOVE-STEP' \
-H 'client_id: 18701' \
-d '{
"given_name": "Pavan",
"sur_name": "Das",
"nid": "1666321725072",
"date_of_birth": "1992-07-14",
"gender": "M",
"present_address": {
"address_line": "Street 1, Baridhara village",
"division_id": "30",
"district_id": "26",
"upazila_id": "02"
},
"confidential": "No"
}'
If the Patient is created successfully, the server assign a health ID to that patient.
We can find deails patient here: https://sharedhealth.atlassian.net/wiki/spaces/docs/pages/48201741/MCI+Patient+Create+Validations
We can use the same facility-admin token for creating Encounter.
We have to use the following API for creating an Encounter. We have to replace the HEALTH_ID in the following API by the patient health ID.
POST http://localhost:8082/v2/patients/HEALTH_ID/encounters
The above API accept the following payload structure.
<encounter>
<content>
<![CDATA[
]]>
</content>
</encounter>
The FHIR bundle will have to be putted inside the <![CDATA[ ]]> code. We can find the details of FHIR bundle in the following link:
https://sharedhealth.atlassian.net/wiki/spaces/docs/pages/524346/Shared+Health+Record
There is a useful Postman collection available in the following link: [Link]