Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 4.0
Note

This module will not be the preferred REST web service module.

For a more complete list of web service methods see this module's replacement: Webservices.rest Module

Overview

What This Module Does Do

...

This call would do a Patient Query based on the search string "John Smith". A list of patients matching that search criteria would be returned.

Code Block
xmlxml
title/api/findPatient/John+Smith
xml
<patientList>
  <patient birthdate="1975-01-01" birthdateEstimated="false" gender="M">
    <identifierList>
      <identifier preferred="1" type="OpenMRS Identification Number">100-8</identifier>
      <identifier type="Old Identification Number">asdf</identifier>
      <identifier type="Old Identification Number">100</identifier>
    </identifierList>
    <name>
      <prefix>pre</prefix>
      <givenName>test123</givenName>
      <middleName>middle</middleName>
      <familyName>test</familyName>
      <familyName2>test2</familyName2>
      <degree>deg</degree>
    </name>
    <addressList>
      <address preferred="1">
        <address1>555 Johnson Rd.</address1>
        <address2>Apt. 555</address2>
        <cityVillage>Indianapolis</cityVillage>
        <stateProvince>IN</stateProvince>
        <country>USA</country>
      </address>
      <address preferred="1">
        <address1>asdf</address1>
        <address2></address2>
        <cityVillage></cityVillage>
        <stateProvince></stateProvince>
        <country></country>
      </address>
    </addressList>
  </patient>
</patientList>
java
Code Block
java
title/json/findPatient/John
java
[
  {
    "birthdate": "1975-01-01",
    "birthdateEstimated": "false",
    "gender": "M",
    "identifierList": [
      {
        "preferred": "1",
        "type": "OpenMRS Identification Number",
        "identifier": "100-8"
      },
      {
        "type": "Old Identification Number",
        "identifier": "asdf"
      },
      {
        "type": "Old Identification Number",
        "identifier": "100"
      },
      \
    ],
    "name": {
      "prefix": "pre",
      "givenName": "test123",
      "middleName": "middle",
      "familyName": "test",
      "familyName2": "test2",
      "degree": "deg",

    },
    "addressList": [
      {
        "preferred": "1",
        "address1": "555 Johnson Rd.",
        "address2": "Apt. 555",
        "cityVillage": "Indianapolis",
        "stateProvince": "IN",
        "country": "USA",

      },
      {
        "preferred": "1",
        "address1": "asdf",

      },

    ]
  }
]

...

This call does a Patient Lookup based on the OpenMRS Identifier "OpenMRS Identification Number". In this case, the Patient with the ID Number of "100-3" would be returned.

xml
Code Block
xml
title/api/patient/100-3
xml
<patientList>
  <patient birthdate="1975-01-01" birthdateEstimated="false" gender="M">
    <identifierList>
      <identifier preferred="1" type="OpenMRS Identification Number">100-8</identifier>
      <identifier type="Old Identification Number">asdf</identifier>
      <identifier type="Old Identification Number">100</identifier>
    </identifierList>
    <name>
      <prefix>pre</prefix>
      <givenName>test123</givenName>
      <middleName>middle</middleName>
      <familyName>test</familyName>
      <familyName2>test2</familyName2>
      <degree>deg</degree>
    </name>
    <addressList>
      <address preferred="1">
        <address1>555 Johnson Rd.</address1>
        <address2>Apt. 555</address2>
        <cityVillage>Indianapolis</cityVillage>
        <stateProvince>IN</stateProvince>
        <country>USA</country>
      </address>
      <address preferred="1">
        <address1>asdf</address1>
        <address2/>
        <cityVillage/>
        <stateProvince/>
        <country/>
      </address>
    </addressList>
  </patient>
</patientList>
java
Code Block
java
title/json/patient/100-3
java
[
  {
    "birthdate": "1975-01-01",
    "birthdateEstimated": "false",
    "gender": "M",
    "identifierList": [
      {
        "preferred": "1",
        "type": "OpenMRS Identification Number",
        "identifier": "100-8"
      },
      {
        "type": "Old Identification Number",
        "identifier": "asdf"
      },
      {
        "type": "Old Identification Number",
        "identifier": "100"
      },

    ],
    "name": {
      "prefix": "pre",
      "givenName": "test123",
      "middleName": "middle",
      "familyName": "test",
      "familyName2": "test2",
      "degree": "deg",

    },
    "addressList": [
      {
        "preferred": "1",
        "address1": "555 Johnson Rd.",
        "address2": "Apt. 555",
        "cityVillage": "Indianapolis",
        "stateProvince": "IN",
        "country": "USA",

      },
      {
        "preferred": "1",
        "address1": "asdf",

      },

    ]
  }
]

Example #3: Request for a list of observations for a given patient and concept

xml
Code Block
xml
title/api/obs?pId=100&cId=5090
xml
<?xml version="1.0" encoding="UTF-8"?>
<obsList version="1.0">
  <obs uuid="1b6898bf-bc11-4b79-9f30-8a3c0c4dd10a" patientId="3" obsDatetime="2010-02-15" isObsGrouping="false" isComplex="false">
    <concept id="5090">HEIGHT (CM)</concept>
    <valueNumeric>183.0</valueNumeric>
    <encounter id="1" type="ADULTINITIAL"/>
    <comment>Too tall</comment>
    <location id="1"/>
  </obs>
  <obs uuid="1b6808bf-bc17-4b98-9f30-8a3c0c4dd10t" patientId="3" obsDatetime="2010-02-15" isObsGrouping="false" isComplex="false">
    <concept id="5090">HEIGHT (CM)</concept>
    <valueNumeric>200.0</valueNumeric>
    <encounter id="1" type="ADULTINITIAL"/>
    <comment>Too obese</comment>
    <location id="1"/>
  </obs>
</obsList>
java
Code Block
java
title/json/obs?pId=100&cId=5090
java
[
  {
    "isObsGrouping": false,
    "patientId": 3,
    "concept": {
      "id": 5090,
      "name": "HEIGHT (CM)"
    },
    "location": {
      "id": 1
    },
    "obsDatetime": "2010-02-15",
    "valueNumeric": 183,
    "isComplex": false,
    "encounter": {
      "id": 1,
      "type": "ADULTINITIAL"
    },
    "uuid": "1b6898bf-bc11-4b79-9f30-8a3c0c4dd10a",
    "comment": "Too tall"
  },
  {
    "isObsGrouping": false,
    "patientId": 3,
    "concept": {
      "id": 5090,
      "name": "HEIGHT (CM)"
    },
    "location": {
      "id": 1
    },
    "obsDatetime": "2010-02-15",
    "valueNumeric": 200,
    "isComplex": false,
    "encounter": {
      "id": 1,
      "type": "ADULTINITIAL"
    },
    "uuid": "1b6808bf-bc17-4b98-9f30-8a3c0c4dd10t",
    "comment": "Too obese"
  }
]

...

Example #5: Getting a patient based on the user identifier

xml
Code Block
xml
title/api/user/1
xml
<?xml version="1.0" encoding="UTF-8"?>
<userList version="1.0">
  <user uuid="c6ef8bd8-fd7e-11df-8272-0800271bba91" userId="1" systemId="admin" username="" birthdateEstimated="false" gender="">
    <addressList/>
    <name>
      <givenName>Super</givenName>
      <middleName/>
      <familyName>User</familyName>
    </name>
    <roleList>
      <role>System Developer</role>
      <role>Provider</role>
    </roleList>
  </user>
</userList>
java
Code Block
java
title/json/user/4
java
[
  {
    "addressList": [],
    "userId": "4",
    "systemId": "4-2",
    "username": "ajanthan",
    "gender": "M",
    "uuid": "c6ef8bd8-fd7e-11df-8272-0800271bba91",
    "name": {
      "givenName": "aja",
      "familyName": "bala"
    },
    "roleList": [
      "System Developer",
      "Provider"
    ]
  }
]

...