Definition
Information
Section titled “Information”The Appointment Slotstatus model records statuses associated with appointment slots and their recorded dates and times. Each entry holds the slot identifier, status identifier and status timestamp together with source organisation information describing the context of the status record.
Soft-Deleted Records
Section titled “Soft-Deleted Records”_deleted indicates whether the record has been deleted in the source system.
Examples
Section titled “Examples”appointment.slotstatus with appointment.slot and appointment.status details
Section titled “appointment.slotstatus with appointment.slot and appointment.status details”Return records alongside descriptive values from the related tables.
SELECT m."_primary_key", m."slotid", p1."patientname" AS "slot_patientname", m."statusid", p2."description" AS "status_description"FROM appointment.slotstatus AS mLEFT JOIN appointment.slot AS p1 ON p1."slotid" = m."slotid" AND p1."organisation" = m."organisation"LEFT JOIN appointment.status AS p2 ON p2."statusid" = m."statusid" AND p2."organisation" = m."organisation";Row count by appointment.slot patientname
Section titled “Row count by appointment.slot patientname”Count appointment.slotstatus records for each appointment.slot value, joined on slotid.
SELECT p."patientname" AS "slot_patientname", COUNT(*) AS row_countFROM appointment.slotstatus AS mINNER JOIN appointment.slot AS p ON p."slotid" = m."slotid" AND p."organisation" = m."organisation"GROUP BY p."patientname"ORDER BY row_count DESC;Row count by appointment.status description
Section titled “Row count by appointment.status description”Count appointment.slotstatus records for each appointment.status value, joined on statusid.
SELECT p."description" AS "status_description", COUNT(*) AS row_countFROM appointment.slotstatus AS mINNER JOIN appointment.status AS p ON p."statusid" = m."statusid" AND p."organisation" = m."organisation"GROUP BY p."description"ORDER BY row_count DESC;