Skip to content
Partner Developer Portal

Definition

The Referralmanagement Urgency model holds urgency labels in the referral-management domain. Each entry records an identifier and display text, together with organisation information.

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

carerecord.referral count per referralmanagement.urgency

Section titled “carerecord.referral count per referralmanagement.urgency”

Count related carerecord.referral records for each referralmanagement.urgency record, joined on urgency.

:::caution[Unverified join] This join is inferred from matching column names and is not part of the documented relationships. Check the results before relying on it. :::

SELECT
m."id",
m."displaytext",
COUNT(c."urgency") AS referral_count
FROM referralmanagement.urgency AS m
LEFT JOIN carerecord.referral AS c
ON m."id" = c."urgency"
AND m."organisation" = c."organisation"
GROUP BY m."id", m."displaytext"
ORDER BY referral_count DESC;

carerecord.referral records with referralmanagement.urgency details

Section titled “carerecord.referral records with referralmanagement.urgency details”

List carerecord.referral records with the referralmanagement.urgency values they reference through urgency.

:::caution[Unverified join] This join is inferred from matching column names and is not part of the documented relationships. Check the results before relying on it. :::

SELECT
c."_primary_key",
c."datedreferral",
m."id",
m."displaytext" AS "urgency_displaytext"
FROM carerecord.referral AS c
INNER JOIN referralmanagement.urgency AS m
ON m."id" = c."urgency"
AND m."organisation" = c."organisation";

carerecord.report count per referralmanagement.urgency

Section titled “carerecord.report count per referralmanagement.urgency”

Count related carerecord.report records for each referralmanagement.urgency record, joined on urgency.

:::caution[Unverified join] This join is inferred from matching column names and is not part of the documented relationships. Check the results before relying on it. :::

SELECT
m."id",
m."displaytext",
COUNT(c."urgency") AS report_count
FROM referralmanagement.urgency AS m
LEFT JOIN carerecord.report AS c
ON m."id" = c."urgency"
AND m."organisation" = c."organisation"
GROUP BY m."id", m."displaytext"
ORDER BY report_count DESC;