Skip to content
This repository was archived by the owner on Dec 20, 2024. It is now read-only.

Create Update Patient API

jay-lee00 edited this page Sep 8, 2020 · 10 revisions

Steps to Create and Update Patient and Patient Profile

1. Create access token with SnapMD issued credential, which has proper permissions

  • Call Token API to create access token
POST v3/auth/user-sessions

   headers:

X-Api-Key: your_api_key
X-Developer-Id: your_developer_id

   body:

{
  "userTypeId":2,
	"hospitalId":126,
	"email":"{{adminUser}}",
	"password":"{{adminPwd}}",
	"interfaceTypeId": 3,
	"deviceId": "Postman:30336add-c604-4591-8ce2-0f417f656c10"
}

2. Get Codesets and ids for Later Calls

  • Get list of country codes for prefixing mobileNumberWithCountryCode when creating a patient
GET countrycode

   headers:

X-Api-Key:your_api_key
X-Developer-Id:your_developer_id
Authorization:Bearer token_from_token_api
  • Get list of time zones for timezoneId field
 GET v2/timezones 

   headers:

X-Api-Key:your_api_key
X-Developer-Id:your_developer_id
Authorization:Bearer token_from_token_api
  • Get Codes for Fields in Patient Profile
    This step must be executed before calling both patient creation and patient update API
GET v2/codesets?hospitalId=hospital_id&fields=medicalconditions,medications,medicationallergies,eyecolor,haircolor,ethnicity,bloodtype,relationship,heightunit,weightunit

   headers:

X-Api-Key:your_api_key
X-Developer-Id:your_developer_id
Authorization:Bearer token_from_token_api

3. Create a Patient

  • Post basic patient info in order to create a patient record

   mobileNumberWithCountryCode must be prefixed with countryCode

POST v2/admin/patients

   headers:

X-Api-Key:your_api_key
X-Developer-Id:your_developer_id
Authorization:Bearer token_from_token_api

   body:

{
"firstName": "John",
"lastName": "Doe",
"email": "jdoe+001@example.com",
"countryId": 1,
"dob": "01/01/1990",
"address": "1234 main street, Los Angeles, CA 90015",
"mobileNumberWithCountryCode": "+1213-555-1212",
"timeZoneId": 83,
"gender": "M",
"status": 1,
"preventSendingInvitation": true
}

4. Update Patient Profile

  • Call Patient Profile, Update API
PUT patients/profile

   headers:

X-Api-Key:your_api_key 
X-Developer-Id:your_developer_id 
Authorization:Bearer token_from_token_api

   patientId is from previous step
   some fields such as heightUnit and weightUnit are using codes from Step 2
   body:

{
 "emailAddress": "jdoe+001@example.com",
 "patientProfileData": {
  "patientId": 7413,
  "patientName": "John",
  "lastName": "Doe",
  "dob": "1990-1-1",
  "eyeColor": 2199,
  "gender": "M",
  "ethnicity": 2205,
  "hairColor": 2233,
  "homePhone": "",
  "mobilePhone": "+1213-555-1212",
  "address": "1234 main street, Los Angeles, CA 90015",
  "height": "5|2",
  "weight": 90,
  "heightUnit": 3615,
  "weightUnit": 3613,
  "organizationId": null,
  "locationId": null,
  "identifiers": []
 },
 "timeZoneId": 83,
 "patientMedicalHistoryData": {
  "patientId": 7413,
  "medicalCondition1": 2212,
  "takingMedication1": 2225
 }
}

Clone this wiki locally