Skip to content
Partner Developer Portal

Definition

The Appointment Status model holds appointment status definitions, including descriptions, abbreviations and shortcut values. It also records status identifiers and a cancellation-status identifier, together with source organisation information, retaining descriptive and configuration details for the recorded statuses.

_deleted indicates whether the record has been deleted in the source system.

appointment.slotstatus count per appointment.status

Section titled “appointment.slotstatus count per appointment.status”

Count related appointment.slotstatus records for each appointment.status record, joined on statusid.

SELECT
m."statusid",
m."description",
COUNT(c."statusid") AS slotstatus_count
FROM appointment.status AS m
LEFT JOIN appointment.slotstatus AS c
ON m."statusid" = c."statusid"
AND m."organisation" = c."organisation"
GROUP BY m."statusid", m."description"
ORDER BY slotstatus_count DESC;

appointment.slotstatus records with appointment.status details

Section titled “appointment.slotstatus records with appointment.status details”

List appointment.slotstatus records with the appointment.status values they reference through statusid.

SELECT
c."_primary_key",
c."statusdatetime",
m."statusid",
m."description" AS "status_description"
FROM appointment.slotstatus AS c
INNER JOIN appointment.status AS m
ON m."statusid" = c."statusid"
AND m."organisation" = c."organisation";

appointment.statusprogression count per appointment.status

Section titled “appointment.statusprogression count per appointment.status”

Count related appointment.statusprogression records for each appointment.status record, joined on statusid.

SELECT
m."statusid",
m."description",
COUNT(c."statusid") AS statusprogression_count
FROM appointment.status AS m
LEFT JOIN appointment.statusprogression AS c
ON m."statusid" = c."statusid"
AND m."organisation" = c."organisation"
GROUP BY m."statusid", m."description"
ORDER BY statusprogression_count DESC;