erDiagram
patient ||--o{ consultation : "has"
organisation ||--o{ consultation : "hosts"
location ||--o{ consultation : "occurs_at"
appointment_slot ||--o{ consultation : "scheduled_in"
consultation ||--o{ consultation_section : "contains many"
patient {
varchar patient_id PK
}
consultation {
bigint consultation_id PK
varchar organisation PK
bigint patient_id FK
bigint patient_organisation_id FK
bigint consultation_organisation_id FK
bigint location_id FK
bigint appointment_slot_id FK
bigint entered_by_user_in_role_id FK
bigint authorising_user_in_role_id FK
}
consultation_section {
bigint consultation_section_id PK
varchar organisation PK
bigint consultation_id FK
}
organisation {
varchar organisation PK
}
location {
bigint location_id PK
varchar organisation PK
}
appointment_slot {
bigint appointment_slot_id PK
varchar organisation PK
}