Definition
Information
Section titled “Information”The Bedmanagement Sourceofadmission model holds named admission-source definitions. Each entry records an admission-source identifier, its name and source organisation information.
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.bedpatient count per bedmanagement.sourceofadmission
Section titled “bedmanagement.bedpatient count per bedmanagement.sourceofadmission”Count related bedmanagement.bedpatient records for each bedmanagement.sourceofadmission record, joined on sourceofadmissionid.
SELECT m."sourceofadmissionid", m."sourceofadmissionname", COUNT(c."sourceofadmissionid") AS bedpatient_countFROM bedmanagement.sourceofadmission AS mLEFT JOIN bedmanagement.bedpatient AS c ON m."sourceofadmissionid" = c."sourceofadmissionid" AND m."organisation" = c."organisation"GROUP BY m."sourceofadmissionid", m."sourceofadmissionname"ORDER BY bedpatient_count DESC;bedmanagement.bedpatient records with bedmanagement.sourceofadmission details
Section titled “bedmanagement.bedpatient records with bedmanagement.sourceofadmission details”List bedmanagement.bedpatient records with the bedmanagement.sourceofadmission values they reference through sourceofadmissionid.
SELECT c."_primary_key", c."admissiondate", m."sourceofadmissionid", m."sourceofadmissionname" AS "sourceofadmissionname"FROM bedmanagement.bedpatient AS cINNER JOIN bedmanagement.sourceofadmission AS m ON m."sourceofadmissionid" = c."sourceofadmissionid" AND m."organisation" = c."organisation";bedmanagement.bedpatienthistory count per bedmanagement.sourceofadmission
Section titled “bedmanagement.bedpatienthistory count per bedmanagement.sourceofadmission”Count related bedmanagement.bedpatienthistory records for each bedmanagement.sourceofadmission record, joined on sourceofadmissionid.
SELECT m."sourceofadmissionid", m."sourceofadmissionname", COUNT(c."sourceofadmissionid") AS bedpatienthistory_countFROM bedmanagement.sourceofadmission AS mLEFT JOIN bedmanagement.bedpatienthistory AS c ON m."sourceofadmissionid" = c."sourceofadmissionid" AND m."organisation" = c."organisation"GROUP BY m."sourceofadmissionid", m."sourceofadmissionname"ORDER BY bedpatienthistory_count DESC;