# Advanced search - Site

| **API URL**     | {{url}}/spice-service/patient/advance-search/site |
| --------------- | ------------------------------------------------- |
| **Method**      | POST                                              |
| **Description** | Patient advance search - Site level               |

#### **Input:** <a href="#advancedsearch-site-input" id="advancedsearch-site-input"></a>

| **Field Name**        | **Type** | **Mandatory** | **Example**                                                                                                                                     |
| --------------------- | -------- | ------------- | ----------------------------------------------------------------------------------------------------------------------------------------------- |
| Authorization(Header) | String   | Yes           | Bearer eyJlbmMiOiJBMTI4R0NNIiwiYWxnIjoiUlNBLU9BRVAtMjU2In0.MCm0mJDfpfjlr10Uok79-kTF7fv9Tn7cI5m2WsRDGUd9VS7iRmfbszjuc1-w5D-PYt9CdVxRMGBQlzYauhnI |

#### **Input:** <a href="#advancedsearch-site-input-.1" id="advancedsearch-site-input-.1"></a>

| **Field Name** | **Type** | **Mandatory** | **Example** |
| -------------- | -------- | ------------- | ----------- |
| First Name     | String   | No            | David       |

#### **Sample Input:** <a href="#advancedsearch-site-sampleinput" id="advancedsearch-site-sampleinput"></a>

{\
"firstName": "David",\
"limit": 15,\
"patientFilter": {\
"screeningReferral": true\
},\
"patientSort": {\
"isRedRisk": true\
},\
"skip": 0,\
"tenantId": 4\
}

#### **Output:** <a href="#advancedsearch-site-output" id="advancedsearch-site-output"></a>

| **Field Name**   | **Type**  | **Comments**            |
| ---------------- | --------- | ----------------------- |
| `id`             | String    | Patient track Id        |
| `nationalId`     | Bigint    | National Id             |
| `programId`      | Bigint    | Patient program Id      |
| `firstName`      | String    | Patient first name      |
| `lastName`       | String    | Patient last name       |
| `gender`         | String    | Patient gender          |
| `age`            | Bigint    | Patient age             |
| `patientStatus`  | String    | Patient status          |
| `enrollmentAt`   | Timestamp | Patient enrolled date   |
| `patientId`      | Bigint    | Patient Id              |
| `screeningLogId` | Bigint    | Screening log Id        |
| `initialReview`  | Boolean   | Initial review status   |
| `redRiskPatient` | Boolean   | Red risk patient status |

#### **Sample Output:** <a href="#advancedsearch-site-sampleoutput" id="advancedsearch-site-sampleoutput"></a>

```
{
  "message": "Patient List fetched Successfully.",
  "entity": null,
  "status": true,
  "entityList": [
    {
      "id": 1,
      "nationalId": "DAVIAXXX2327",
      "programId": 2,
      "firstName": "David",
      "lastName": "ANBU",
      "gender": "Female",
      "age": 26,
      "patientStatus": "ENROLLED",
      "enrollmentAt": "2023-05-24T13:52:12+05:30",
      "patientId": 2,
      "screeningLogId": 1,
      "createdAt": "2023-05-23T19:11:29+05:30",
      "initialReview": true,
      "redRiskPatient": true
    },
    {
      "id": 19,
      "nationalId": "DAVIXXXA2327",
      "programId": 17,
      "firstName": "David",
      "lastName": "DIYA",
      "gender": "Female",
      "age": 25,
      "patientStatus": "ENROLLED",
      "enrollmentAt": "2023-05-25T18:35:34+05:30",
      "patientId": 16,
      "screeningLogId": 12,
      "createdAt": "2023-05-25T18:24:51+05:30",
      "initialReview": true,
      "redRiskPatient": false
    },
    {
      "id": 3,
      "nationalId": "DAVIVARXXX27",
      "programId": 4,
      "firstName": David,
      "lastName": "VARUN",
      "gender": "Female",
      "age": 10,
      "patientStatus": "ENROLLED",
      "enrollmentAt": "2023-05-24T14:09:17+05:30",
      "patientId": 4,
      "screeningLogId": 3,
      "createdAt": "2023-05-24T12:02:25+05:30",
      "initialReview": false,
      "redRiskPatient": false
    }
  ],
  "responseCode": 200,
  "totalCount": 3
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://spice.docs.medtroniclabs.org/spice-docs/versions/spice-1.0/engineering/api-documentation/spice-services/advanced-search-site.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
