Definition
Information
Section titled “Information”The Bedmanagement Wardpatientassignmenthistory model records historical patient ward assignments, including admission timing, expected departure and status-change timestamps. It also holds assignment status, consultant and nurse identifiers, admission-source details, and discharge location, discharge or rejection reasons and associated notes.
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.wardpatientassignmenthistory with bedmanagement.admission, patientadmin.dischargeorrejectionreason and patientadmin.episode details
Section titled “bedmanagement.wardpatientassignmenthistory with bedmanagement.admission, patientadmin.dischargeorrejectionreason and patientadmin.episode details”Return records alongside descriptive values from the related tables.
SELECT m."wardpatientassignmenthistoryid", m."admissionid", p1."datestamp" AS "admission_datestamp", m."dischargeorrejectionreasonid", p2."reason" AS "dischargeorrejectionreason_reason", m."episodeid", p3."dischargereasonterm" AS "episode_dischargereasonterm"FROM bedmanagement.wardpatientassignmenthistory AS mLEFT JOIN bedmanagement.admission AS p1 ON p1."admissionid" = m."admissionid" AND p1."organisation" = m."organisation"LEFT JOIN patientadmin.dischargeorrejectionreason AS p2 ON p2."dischargeorrejectionreasonid" = m."dischargeorrejectionreasonid" AND p2."organisation" = m."organisation"LEFT JOIN patientadmin.episode AS p3 ON p3."episodeid" = m."episodeid" AND p3."organisation" = m."organisation";Row count by bedmanagement.admission datestamp
Section titled “Row count by bedmanagement.admission datestamp”Count bedmanagement.wardpatientassignmenthistory records for each bedmanagement.admission value, joined on admissionid.
SELECT p."datestamp" AS "admission_datestamp", COUNT(*) AS row_countFROM bedmanagement.wardpatientassignmenthistory AS mINNER JOIN bedmanagement.admission AS p ON p."admissionid" = m."admissionid" AND p."organisation" = m."organisation"GROUP BY p."datestamp"ORDER BY row_count DESC;Row count by patientadmin.dischargeorrejectionreason reason
Section titled “Row count by patientadmin.dischargeorrejectionreason reason”Count bedmanagement.wardpatientassignmenthistory records for each patientadmin.dischargeorrejectionreason value, joined on dischargeorrejectionreasonid.
SELECT p."reason" AS "dischargeorrejectionreason_reason", COUNT(*) AS row_countFROM bedmanagement.wardpatientassignmenthistory AS mINNER JOIN patientadmin.dischargeorrejectionreason AS p ON p."dischargeorrejectionreasonid" = m."dischargeorrejectionreasonid" AND p."organisation" = m."organisation"GROUP BY p."reason"ORDER BY row_count DESC;