Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

This feature allows you to use SQL language to aggregate data. One example is SELECT * WHERE *** CONTAINS 'SACRAMENTO' OR *** CONTAINS 'SAN JOSE,' which returned the following:

...

For a stream of messages with a format similar to the following:

MSH|^~\&|SPC|M||M|20040503223716||ORM^O01|176201653|P|2.2|

PID|1||0000307656^^^M&FEE&&FIE&&FOO&&FUM^MR~0000858462^^^P&FOO&BAR^MR

OBR|1||3844834|2035^NM HEPATOBILIARY DUCT^MRD|||200405030939||

OBX|1|ST|&GDT|1|TEXT1~TEXT2||

OBX|2|ST|&GDT|1|TEXT3~TEXT4||

OBX|3|ST|&GDT|1|TEXT5~TEXT6||


Messages where the first patient identifier is 0000307656

PID-3.1 = '0000307656'

Messages where the 2nd patient identifier is 0000307656

PID-3[2].1 = '0000307656'

Messages where any patient identifier is 00003076566

PID-3[*].1 = '0000307656'

Messages where any Namespace ID (PID-4.2) is FEE

PID-3[*].4.2 = 'FEE'

Messages where any OBX-5, or repeat there of, has the word TEXT

OBX[*]-5[*] CONTAINS 'TEXT'

Messages where the OBR-4 contains exactly 2035^NM HEPATOBILIARY DUCT^MRD

OBR-4 = '2035^NM HEPATOBILIARY DUCT^MRD'

Query Syntax

SELECT [ TOP ( integer ) ] <HL7Path_list> [INTO TABLE_NAME] [where < search_condition >]

...

HL7Path can be any valid path, or *** which means the entire message


SQL Functions

Left(expression,match/count) - Returns the left most character from a string
parameter: expression - must evaluate to a string
parameter: match - characters to match,
or parameter count - number of characters
Example: Left('1234.56','.')='1234'
Example: Left('1234.56', 4)=='1234'

...