How to form post request body where resource contained multi reference resources from Java to FHIR api

359 views Asked by At

I have to send request body as org.hl7.fhir.r4.model.CoverageEligibilityRequest which is contained Patient, Practitioner, Organization as below. This API will return Bundle response. I am using Java and Generic client from Hapi Fire library. There is provision to pass search parameter but the here I am having multilevel hierarchy of resource and input is big than usual. Can any one help me to handle this request in FHIR API.

Request Body as below,

{
      "resourceType": "CoverageEligibilityRequest",
      "contained": [
        {
          "resourceType": "Patient",
          "id": "1",
          "name": [
            {
              "family": "abcFamily",
              "given": [
                "abcGiven"
              ]
            }
          ],
          "birthDate": "1962-08-06"
        },
        {
          "resourceType": "Practitioner",
          "id": "2",
          "identifier": [
            {
              "type": {
                "coding": [
                  {
                   "code": "NPI"
                  }
                ]
              },
              "value": "123456789"
            }
          ],
          "name": [
            {
              "family": "pqrFamily",
              "given": [
                "pqrGiven"
              ]
            }
          ]
        },
        {
          "resourceType": "Organization",
          "id": "3",
          "identifier": [
            {
              "value": "12345"
            }
          ],
          "name": ""
        },
        {
          "resourceType": "Coverage",
          "id": "3",
          "status": "active",
          "subscriberId": "",         
          "class": [
            {
              "type": {
                "coding": [
                  {
                    
                    "code": "group"
                    
                  }
                ]
              },
              "value": ""
            }
          ]
        }
      ],
      "extension": [
        {
          "url": "searchOption",
          "valueString": "NameDateOfBirth"
        }
      ],
      "status": "active",
      "purpose": [
        "benefits"
      ],
      "patient": {
        "reference": "#1"
      },
      "provider": {
        "reference": "#2"
      },
      "insurer": {
        "reference": "#3"
      }
    }
0

There are 0 answers