Skip to content
Partner Developer Portal

Definition

The Bedmanagement Admission model records bed-management admission entries and their recorded admission types. It holds an admission identifier and GUID, an admission-type identifier and a datestamp value, together with source organisation information describing the context of the admission record.

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

bedmanagement.admission with bedmanagement.admissiontype details

Section titled “bedmanagement.admission with bedmanagement.admissiontype details”

Return records alongside descriptive values from the related bedmanagement.admissiontype record.

SELECT
m."admissionid",
m."admissiontypeid",
p1."description" AS "admissiontype_description"
FROM bedmanagement.admission AS m
LEFT JOIN bedmanagement.admissiontype AS p1
ON p1."admissiontypeid" = m."admissiontypeid"
AND p1."organisation" = m."organisation";

bedmanagement.bedpatient count per bedmanagement.admission

Section titled “bedmanagement.bedpatient count per bedmanagement.admission”

Count related bedmanagement.bedpatient records for each bedmanagement.admission record, joined on admissionid.

SELECT
m."admissionid",
m."datestamp",
COUNT(c."admissionid") AS bedpatient_count
FROM bedmanagement.admission AS m
LEFT JOIN bedmanagement.bedpatient AS c
ON m."admissionid" = c."admissionid"
AND m."organisation" = c."organisation"
GROUP BY m."admissionid", m."datestamp"
ORDER BY bedpatient_count DESC;

Row count by bedmanagement.admissiontype description

Section titled “Row count by bedmanagement.admissiontype description”

Count bedmanagement.admission records for each bedmanagement.admissiontype value, joined on admissiontypeid.

SELECT
p."description" AS "admissiontype_description",
COUNT(*) AS row_count
FROM bedmanagement.admission AS m
INNER JOIN bedmanagement.admissiontype AS p
ON p."admissiontypeid" = m."admissiontypeid"
AND p."organisation" = m."organisation"
GROUP BY p."description"
ORDER BY row_count DESC;