> ## Documentation Index
> Fetch the complete documentation index at: https://docs.encoreos.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Discharge Documents

> List, search, filter, add, edit, and delete discharge-related documents across the current organization's episodes.

The Discharge Documents page provides a filterable list of all discharge-related documents for the current organization, accessible at `/rh/discharge-documents`.

## Overview

The page queries `rh_discharge_documents` filtered by `organization_id` and `deleted_at IS NULL`, ordered by `created_at` descending. Users can search by `document_name` or `notes` and filter by `document_type`. Creating new documents from this page requires `episodeId` and `dischargePlanId` URL query parameters; otherwise the **Add Document** button is disabled and a helper note is shown.

## Who it's for

No additional permission gate is present on `/rh/discharge-documents` beyond the outer `RH_PERMISSIONS.DASHBOARD_VIEW` (`rh.dashboard.view`) guard.

## Before you start

* Your account must hold `rh.dashboard.view`.
* An organization context must be active.
* To create a new document, you must arrive via an episode-specific discharge plan context that injects `?episodeId=...&dischargePlanId=...` query parameters.

## Steps

<Steps>
  <Step title="Open Discharge Documents">
    Navigate to **Recovery Housing → Discharge Documents** or go directly to `/rh/discharge-documents`. All non-deleted documents for your organization load in the table.
  </Step>

  <Step title="Search and filter">
    Use the search box to filter by document name or notes text. Use the **Document Type** dropdown to narrow to a specific type: Discharge Summary, Referral Letter, Medication List, Aftercare Plan, Release Form, or Other.
  </Step>

  <Step title="Edit an existing document">
    Click the edit action on any row to open `DischargeDocumentDialog` pre-populated with the document's `document_type`, `document_name`, and `notes`. Save to update.
  </Step>

  <Step title="Delete a document">
    Click the delete action on any row. The `useDischargeDocumentMutation` hook performs a soft delete (sets `deleted_at`). The document disappears from the list on the next query.
  </Step>

  <Step title="Add a new document (episode context required)">
    Open this page from within an episode's discharge plan context so that `?episodeId=...&dischargePlanId=...` are present in the URL. The **Add Document** button becomes active. Click it to open `DischargeDocumentDialog` and complete the form.
  </Step>
</Steps>

## Key concepts

| Document type     | Value               | Notes                           |
| ----------------- | ------------------- | ------------------------------- |
| Discharge Summary | `discharge_summary` | —                               |
| Referral Letter   | `referral_letter`   | —                               |
| Medication List   | `medication_list`   | Contains PHI — medication names |
| Aftercare Plan    | `aftercare_plan`    | —                               |
| Release Form      | `release_form`      | —                               |
| Other             | `other`             | Generic type                    |

## Related

<Columns cols={2}>
  <Card title="Recovery Housing" icon="house" href="/rh/references">
    Recovery Housing references and overview.
  </Card>

  <Card title="Governance & parity" icon="scale-balanced" href="/governance/index">
    Documentation coverage and governance.
  </Card>
</Columns>

<Note>
  This page documents shipped product behavior. It is not medical, legal, or
  billing advice. Verify against your organization's policies and applicable
  regulations before using it for clinical, compliance, or billing decisions.
  Protected health information (PHI) shown in the product is governed by your
  tenant's access controls and is never exposed in this documentation.
</Note>

<Accordion title="Documentation sources">
  * src/routes/rh.tsx
  * src/cores/rh/pages/discharge/DischargeDocumentsPage.tsx
  * src/cores/rh/hooks/discharge/useDischargeDocumentMutation.ts
</Accordion>
