# PatientResource

Canonical page: https://docs.ovok.com/java-sdk/reference/patient-resource

```java
public final class PatientResource
```

Reads and writes the signed-in patient's FHIR records. Get it from [`Ovok.patient()`](/java-sdk/reference/ovok#patient).

## Methods [#methods]

### appointments [#appointments]

```java
public PatientResource.AppointmentsResource appointments()
```

Returns the patient's appointments.

**Returns:** the appointments resource

### schedules [#schedules]

```java
public PatientResource.FhirListResource schedules()
```

Returns the `Schedule` resources.

**Returns:** the schedules resource

### slots [#slots]

```java
public PatientResource.FhirListResource slots()
```

Returns the `Slot` resources.

**Returns:** the slots resource

### measurements [#measurements]

```java
public PatientResource.FhirRecordsResource measurements()
```

Returns the patient's `Observation` resources.

**Returns:** the measurements resource

### carePlans [#careplans]

```java
public PatientResource.FhirRecordsResource carePlans()
```

Returns the patient's `CarePlan` resources.

**Returns:** the care plans resource

### questionnaires [#questionnaires]

```java
public PatientResource.FhirRecordsResource questionnaires()
```

Returns the `Questionnaire` resources.

**Returns:** the questionnaires resource

### questionnaireResponses [#questionnaireresponses]

```java
public PatientResource.FhirRecordsResource questionnaireResponses()
```

Returns the patient's `QuestionnaireResponse` resources.

**Returns:** the questionnaire responses resource

### devices [#devices]

```java
public PatientResource.FhirRecordsResource devices()
```

Returns the patient's `Device` resources.

**Returns:** the devices resource

### notifications [#notifications]

```java
public PatientResource.FhirRecordsResource notifications()
```

Returns the patient's `CommunicationRequest` resources.

**Returns:** the notifications resource

### latestObservations [#latestobservations]

```java
public JsonNode latestObservations(
        Map<String, ?> parameters) throws IOException, InterruptedException
```

Reads the latest observations per code (`GET /fhir/Observation/$lastn`).

**Parameters:**

- `parameters`: `$lastn` query parameters

**Returns:** the search bundle

**Throws:**

- `IOException`: if the request cannot be sent or the response cannot be read
- `InterruptedException`: if the thread is interrupted while waiting for the response

```java
public JsonNode latestObservations() throws IOException, InterruptedException
```

Reads the latest observations per code (`GET /fhir/Observation/$lastn`).

**Returns:** the search bundle

**Throws:**

- `IOException`: if the request cannot be sent or the response cannot be read
- `InterruptedException`: if the thread is interrupted while waiting for the response

```java
public JsonNode latestObservations(RequestOptions options) throws IOException, InterruptedException
```

Reads the latest observations per code (`GET /fhir/Observation/$lastn`).

**Parameters:**

- `options`: per-request options, such as the timeout

**Returns:** the search bundle

**Throws:**

- `IOException`: if the request cannot be sent or the response cannot be read
- `InterruptedException`: if the thread is interrupted while waiting for the response

```java
public JsonNode latestObservations(
        Map<String, ?> parameters,
        RequestOptions options) throws IOException, InterruptedException
```

Reads the latest observations per code (`GET /fhir/Observation/$lastn`).

**Parameters:**

- `parameters`: `$lastn` query parameters
- `options`: per-request options, such as the timeout

**Returns:** the search bundle

**Throws:**

- `IOException`: if the request cannot be sent or the response cannot be read
- `InterruptedException`: if the thread is interrupted while waiting for the response

### dashboard [#dashboard]

```java
public JsonNode dashboard(Map<String, ?> parameters) throws IOException, InterruptedException
```

Loads the patient dashboard: profile, latest observations, measurement history and care plans.

**Parameters:**

- `parameters`: optional query maps under `latestObservations`, `measurementHistory` and `carePlans`

**Returns:** an object with `profile`, `latestObservations`, `measurementHistory` and `carePlans`

**Throws:**

- `IOException`: if the request cannot be sent or the response cannot be read
- `InterruptedException`: if the thread is interrupted while waiting for the response

```java
public JsonNode dashboard() throws IOException, InterruptedException
```

Loads the patient dashboard: profile, latest observations, measurement history and care plans.

**Returns:** an object with `profile`, `latestObservations`, `measurementHistory` and `carePlans`

**Throws:**

- `IOException`: if the request cannot be sent or the response cannot be read
- `InterruptedException`: if the thread is interrupted while waiting for the response

```java
public JsonNode dashboard(RequestOptions options) throws IOException, InterruptedException
```

Loads the patient dashboard: profile, latest observations, measurement history and care plans.

**Parameters:**

- `options`: per-request options, such as the timeout

**Returns:** an object with `profile`, `latestObservations`, `measurementHistory` and `carePlans`

**Throws:**

- `IOException`: if the request cannot be sent or the response cannot be read
- `InterruptedException`: if the thread is interrupted while waiting for the response

```java
public JsonNode dashboard(
        Map<String, ?> parameters,
        RequestOptions options) throws IOException, InterruptedException
```

Loads the patient dashboard: profile, latest observations, measurement history and care plans.

**Parameters:**

- `parameters`: optional query maps under `latestObservations`, `measurementHistory` and `carePlans`
- `options`: per-request options, such as the timeout

**Returns:** an object with `profile`, `latestObservations`, `measurementHistory` and `carePlans`

**Throws:**

- `IOException`: if the request cannot be sent or the response cannot be read
- `InterruptedException`: if the thread is interrupted while waiting for the response

## PatientResource.FhirListResource [#patientresourcefhirlistresource]

```java
public static class FhirListResource
```

Searches one FHIR resource type.

### FhirListResource.list [#fhirlistresourcelist]

```java
public List<JsonNode> list(Map<String, ?> parameters) throws IOException, InterruptedException
```

Searches resources of this type and returns the first page.

**Parameters:**

- `parameters`: FHIR search parameters

**Returns:** the matching resources

**Throws:**

- `IOException`: if the request cannot be sent or the response cannot be read
- `InterruptedException`: if the thread is interrupted while waiting for the response

```java
public List<JsonNode> list() throws IOException, InterruptedException
```

Lists resources of this type and returns the first page.

**Returns:** the matching resources

**Throws:**

- `IOException`: if the request cannot be sent or the response cannot be read
- `InterruptedException`: if the thread is interrupted while waiting for the response

```java
public List<JsonNode> list(RequestOptions options) throws IOException, InterruptedException
```

Lists resources of this type and returns the first page.

**Parameters:**

- `options`: per-request options, such as the timeout

**Returns:** the matching resources

**Throws:**

- `IOException`: if the request cannot be sent or the response cannot be read
- `InterruptedException`: if the thread is interrupted while waiting for the response

```java
public List<JsonNode> list(
        Map<String, ?> parameters,
        RequestOptions options) throws IOException, InterruptedException
```

Searches resources of this type and returns the first page.

**Parameters:**

- `parameters`: FHIR search parameters
- `options`: per-request options, such as the timeout

**Returns:** the matching resources

**Throws:**

- `IOException`: if the request cannot be sent or the response cannot be read
- `InterruptedException`: if the thread is interrupted while waiting for the response

## PatientResource.FhirRecordsResource [#patientresourcefhirrecordsresource]

```java
public static class FhirRecordsResource extends PatientResource.FhirListResource
```

Extends [`PatientResource.FhirListResource`](#patientresourcefhirlistresource), and inherits its methods.

Searches and reads one FHIR resource type.

### FhirRecordsResource.retrieve [#fhirrecordsresourceretrieve]

```java
public JsonNode retrieve(String id) throws IOException, InterruptedException
```

Reads one resource by ID.

**Parameters:**

- `id`: the resource ID

**Returns:** the resource

**Throws:**

- `IOException`: if the request cannot be sent or the response cannot be read
- `InterruptedException`: if the thread is interrupted while waiting for the response

```java
public JsonNode retrieve(String id, RequestOptions options) throws IOException, InterruptedException
```

Reads one resource by ID.

**Parameters:**

- `id`: the resource ID
- `options`: per-request options, such as the timeout

**Returns:** the resource

**Throws:**

- `IOException`: if the request cannot be sent or the response cannot be read
- `InterruptedException`: if the thread is interrupted while waiting for the response

## PatientResource.AppointmentsResource [#patientresourceappointmentsresource]

```java
public static final class AppointmentsResource extends PatientResource.FhirRecordsResource
```

Extends [`PatientResource.FhirRecordsResource`](#patientresourcefhirrecordsresource), and inherits its methods.

The patient's FHIR `Appointment` resources.

### AppointmentsResource.create [#appointmentsresourcecreate]

```java
public JsonNode create(JsonNode appointment) throws IOException, InterruptedException
```

Creates an appointment.

**Parameters:**

- `appointment`: the `Appointment` resource

**Returns:** the created resource

**Throws:**

- `IOException`: if the request cannot be sent or the response cannot be read
- `InterruptedException`: if the thread is interrupted while waiting for the response

```java
public JsonNode create(
        JsonNode appointment,
        RequestOptions options) throws IOException, InterruptedException
```

Creates an appointment.

**Parameters:**

- `appointment`: the `Appointment` resource
- `options`: per-request options, such as the timeout

**Returns:** the created resource

**Throws:**

- `IOException`: if the request cannot be sent or the response cannot be read
- `InterruptedException`: if the thread is interrupted while waiting for the response

### AppointmentsResource.update [#appointmentsresourceupdate]

```java
public JsonNode update(
        String id,
        Map<String, ?> appointment) throws IOException, InterruptedException
```

Replaces an appointment.

**Parameters:**

- `id`: the appointment ID
- `appointment`: the appointment fields

**Returns:** the updated resource

**Throws:**

- `IOException`: if the request cannot be sent or the response cannot be read
- `InterruptedException`: if the thread is interrupted while waiting for the response

```java
public JsonNode update(String id, JsonNode appointment) throws IOException, InterruptedException
```

Replaces an appointment.

**Parameters:**

- `id`: the appointment ID
- `appointment`: the `Appointment` resource

**Returns:** the updated resource

**Throws:**

- `IOException`: if the request cannot be sent or the response cannot be read
- `InterruptedException`: if the thread is interrupted while waiting for the response

```java
public JsonNode update(
        String id,
        Map<String, ?> appointment,
        RequestOptions options) throws IOException, InterruptedException
```

Replaces an appointment.

**Parameters:**

- `id`: the appointment ID
- `appointment`: the appointment fields
- `options`: per-request options, such as the timeout

**Returns:** the updated resource

**Throws:**

- `IOException`: if the request cannot be sent or the response cannot be read
- `InterruptedException`: if the thread is interrupted while waiting for the response

```java
public JsonNode update(
        String id,
        JsonNode appointment,
        RequestOptions options) throws IOException, InterruptedException
```

Replaces an appointment.

**Parameters:**

- `id`: the appointment ID
- `appointment`: the `Appointment` resource
- `options`: per-request options, such as the timeout

**Returns:** the updated resource

**Throws:**

- `IOException`: if the request cannot be sent or the response cannot be read
- `InterruptedException`: if the thread is interrupted while waiting for the response
