Skip to content
Partner Developer Portal

Definition

The Episodemanagement Rttstatuscodes model holds RTT status-code information, including MKB code values and a recorded clock-impact value. It also stores status-code identifiers and active and initial flags, together with source organisation information describing the context of the code entry.

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

episodemanagement.referralepisode count per episodemanagement.rttstatuscodes

Section titled “episodemanagement.referralepisode count per episodemanagement.rttstatuscodes”

Count related episodemanagement.referralepisode records for each episodemanagement.rttstatuscodes record, joined on rttperiodstatuscodeid.

:::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."statuscodeid",
m."impactonclock",
COUNT(c."rttperiodstatuscodeid") AS referralepisode_count
FROM episodemanagement.rttstatuscodes AS m
LEFT JOIN episodemanagement.referralepisode AS c
ON m."statuscodeid" = c."rttperiodstatuscodeid"
AND m."organisation" = c."organisation"
GROUP BY m."statuscodeid", m."impactonclock"
ORDER BY referralepisode_count DESC;

episodemanagement.referralepisode records with episodemanagement.rttstatuscodes details

Section titled “episodemanagement.referralepisode records with episodemanagement.rttstatuscodes details”

List episodemanagement.referralepisode records with the episodemanagement.rttstatuscodes values they reference through rttperiodstatuscodeid.

:::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."closuredate",
m."statuscodeid",
m."impactonclock" AS "rttstatuscodes_impactonclock"
FROM episodemanagement.referralepisode AS c
INNER JOIN episodemanagement.rttstatuscodes AS m
ON m."statuscodeid" = c."rttperiodstatuscodeid"
AND m."organisation" = c."organisation";

episodemanagement.rttperiod count per episodemanagement.rttstatuscodes

Section titled “episodemanagement.rttperiod count per episodemanagement.rttstatuscodes”

Count related episodemanagement.rttperiod records for each episodemanagement.rttstatuscodes record, joined on rttstartcodeid.

:::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."statuscodeid",
m."impactonclock",
COUNT(c."rttstartcodeid") AS rttperiod_count
FROM episodemanagement.rttstatuscodes AS m
LEFT JOIN episodemanagement.rttperiod AS c
ON m."statuscodeid" = c."rttstartcodeid"
AND m."organisation" = c."organisation"
GROUP BY m."statuscodeid", m."impactonclock"
ORDER BY rttperiod_count DESC;