Definition
Information
Section titled “Information”The Carerecord Testrequestobservation model records observations associated with patient test requests, including test status and its recorded date. It also holds bottle and laboratory display terms, a bottle-code identifier, order-reference text and an inbound-report identifier alongside patient, observation and test-request identifiers.
Soft-Deleted Records
Section titled “Soft-Deleted Records”_deleted indicates whether the record has been deleted in the source system.
Examples
Section titled “Examples”carerecord.testrequestobservation with carerecord.observation, dbo.patient and carerecord.testrequest details
Section titled “carerecord.testrequestobservation with carerecord.observation, dbo.patient and carerecord.testrequest details”Return records alongside descriptive values from the related tables.
SELECT m."_primary_key", m."observationid", p1."associatedtext" AS "observation_associatedtext", m."patientid", p2."displayname" AS "patient_displayname", m."testrequestid", p3."specimendisplayterm" AS "testrequest_specimendisplayterm"FROM carerecord.testrequestobservation AS mLEFT JOIN carerecord.observation AS p1 ON p1."observationid" = m."observationid" AND p1."organisation" = m."organisation"LEFT JOIN dbo.patient AS p2 ON p2."patientid" = m."patientid" AND p2."organisation" = m."organisation"LEFT JOIN carerecord.testrequest AS p3 ON p3."testrequestid" = m."testrequestid" AND p3."organisation" = m."organisation";Row count by carerecord.observation associatedtext
Section titled “Row count by carerecord.observation associatedtext”Count carerecord.testrequestobservation records for each carerecord.observation value, joined on observationid.
SELECT p."associatedtext" AS "observation_associatedtext", COUNT(*) AS row_countFROM carerecord.testrequestobservation AS mINNER JOIN carerecord.observation AS p ON p."observationid" = m."observationid" AND p."organisation" = m."organisation"GROUP BY p."associatedtext"ORDER BY row_count DESC;Row count by dbo.patient displayname
Section titled “Row count by dbo.patient displayname”Count carerecord.testrequestobservation records for each dbo.patient value, joined on patientid.
SELECT p."displayname" AS "patient_displayname", COUNT(*) AS row_countFROM carerecord.testrequestobservation AS mINNER JOIN dbo.patient AS p ON p."patientid" = m."patientid" AND p."organisation" = m."organisation"GROUP BY p."displayname"ORDER BY row_count DESC;