Definition
Information
Section titled “Information”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.
Soft-Deleted Records
Section titled “Soft-Deleted Records”_deleted indicates whether the record has been deleted in the source system.
Examples
Section titled “Examples”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 mLEFT 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_countFROM bedmanagement.admission AS mLEFT 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_countFROM bedmanagement.admission AS mINNER JOIN bedmanagement.admissiontype AS p ON p."admissiontypeid" = m."admissiontypeid" AND p."organisation" = m."organisation"GROUP BY p."description"ORDER BY row_count DESC;