Definition
Information
Section titled “Information”The Carerecord Testrequest model records patient test requests, including clinical details, request dates, specimen information and urgency. It also holds requesting, entering and sampling user identifiers, fasting and inoculation-risk flags, request-mode information and online-tracker details alongside consultation-section and confidentiality-policy 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.testrequest with carerecord.consultationsection, dbo.organisation and dbo.patient details
Section titled “carerecord.testrequest with carerecord.consultationsection, dbo.organisation and dbo.patient details”Return records alongside descriptive values from the related tables.
SELECT m."testrequestid", m."consultationsectionid", p1."originalheading" AS "consultationsection_originalheading", m."organisationid", p2."organisationdisplayname" AS "organisationdisplayname", m."patientid", p3."displayname" AS "patient_displayname"FROM carerecord.testrequest AS mLEFT JOIN carerecord.consultationsection AS p1 ON p1."consultationsectionid" = m."consultationsectionid" AND p1."organisation" = m."organisation"LEFT JOIN dbo.organisation AS p2 ON p2."organisationid" = m."organisationid" AND p2."organisation" = m."organisation"LEFT JOIN dbo.patient AS p3 ON p3."patientid" = m."patientid" AND p3."organisation" = m."organisation";carerecord.testrequestobservation count per carerecord.testrequest
Section titled “carerecord.testrequestobservation count per carerecord.testrequest”Count related carerecord.testrequestobservation records for each carerecord.testrequest record, joined on testrequestid.
SELECT m."testrequestid", m."specimendisplayterm", COUNT(c."testrequestid") AS testrequestobservation_countFROM carerecord.testrequest AS mLEFT JOIN carerecord.testrequestobservation AS c ON m."testrequestid" = c."testrequestid" AND m."organisation" = c."organisation"GROUP BY m."testrequestid", m."specimendisplayterm"ORDER BY testrequestobservation_count DESC;Row count by carerecord.consultationsection originalheading
Section titled “Row count by carerecord.consultationsection originalheading”Count carerecord.testrequest records for each carerecord.consultationsection value, joined on consultationsectionid.
SELECT p."originalheading" AS "consultationsection_originalheading", COUNT(*) AS row_countFROM carerecord.testrequest AS mINNER JOIN carerecord.consultationsection AS p ON p."consultationsectionid" = m."consultationsectionid" AND p."organisation" = m."organisation"GROUP BY p."originalheading"ORDER BY row_count DESC;