Skip to content
Partner Developer Portal

Definition

The Episodemanagement Organisationcarepathway model links organisations with recorded care pathways. Each association holds organisation and care-pathway identifiers, a default flag and source organisation information, retaining the pathway association and the default setting recorded against it within the organisation’s configuration.

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

episodemanagement.organisationcarepathway with episodemanagement.carepathway and dbo.organisation details

Section titled “episodemanagement.organisationcarepathway with episodemanagement.carepathway and dbo.organisation details”

Return records alongside descriptive values from the related tables.

SELECT
m."_primary_key",
m."carepathwayid",
p1."pathwayname" AS "carepathway_pathwayname",
m."organisationid",
p2."organisationdisplayname" AS "organisationdisplayname"
FROM episodemanagement.organisationcarepathway AS m
LEFT JOIN episodemanagement.carepathway AS p1
ON p1."carepathwayid" = m."carepathwayid"
AND p1."organisation" = m."organisation"
LEFT JOIN dbo.organisation AS p2
ON p2."organisationid" = m."organisationid"
AND p2."organisation" = m."organisation";

Row count by episodemanagement.carepathway pathwayname

Section titled “Row count by episodemanagement.carepathway pathwayname”

Count episodemanagement.organisationcarepathway records for each episodemanagement.carepathway value, joined on carepathwayid.

SELECT
p."pathwayname" AS "carepathway_pathwayname",
COUNT(*) AS row_count
FROM episodemanagement.organisationcarepathway AS m
INNER JOIN episodemanagement.carepathway AS p
ON p."carepathwayid" = m."carepathwayid"
AND p."organisation" = m."organisation"
GROUP BY p."pathwayname"
ORDER BY row_count DESC;

Row count by dbo.organisation organisationdisplayname

Section titled “Row count by dbo.organisation organisationdisplayname”

Count episodemanagement.organisationcarepathway records for each dbo.organisation value, joined on organisationid.

SELECT
p."organisationdisplayname" AS "organisationdisplayname",
COUNT(*) AS row_count
FROM episodemanagement.organisationcarepathway AS m
INNER JOIN dbo.organisation AS p
ON p."organisationid" = m."organisationid"
AND p."organisation" = m."organisation"
GROUP BY p."organisationdisplayname"
ORDER BY row_count DESC;