Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Laboratory Service Requests with Their Charge Items - SSMM

> Distinct laboratory service requests mapped to their linked charge items

## Purpose

Lists each laboratory service request together with the charge item linked through the service request external id.

## Parameters

| Parameter | Type | Description | Example |
|-----------|------|-------------|---------|
| *(none)* | - | Query runs as a static report with fixed filters | - |

---

## Query

```sql
SELECT DISTINCT
emr_servicerequest.title AS service_title,
emr_servicerequest.category AS service_category,
Comment thread
sonzsara marked this conversation as resolved.
emr_chargeitem.title AS charge_item_title
FROM emr_servicerequest
JOIN emr_chargeitem
ON emr_chargeitem.service_resource = 'service_request'
Comment thread
sonzsara marked this conversation as resolved.
AND emr_chargeitem.service_resource_id = emr_servicerequest.external_id::text
WHERE emr_servicerequest.status != 'entered_in_error'
AND emr_servicerequest.category = 'laboratory'
ORDER BY emr_servicerequest.category, emr_servicerequest.title;
```

## Notes

- **Lab-only filter:** `emr_servicerequest.category = 'laboratory'` limits the output to laboratory requests.
- Results are sorted by service category and service title.

*Last updated: 2026-08-31*
Loading