Blogs Home
Wednesday, April 18, 2018 12:00 PM

SQL Tip: Finding Lab Test LOINC Code Values

Written by Thomas Harlan, Jim McGrath; Reporting Services Team - iatricSystems

RWS-Blog-HeaderImage-report-writing-services-2018-04.jpg

Like ICD-10 diagnosis and procedure codes, LOINC codes offer a platform-independent way to identify medical laboratory observations. Within MEDITECH’s LAB module, LOINC codes are set up as a “nomenclature” — a code describing another code — or in this case, a LOINC standard code is mapped to each LAB test in the appropriate dictionary.

This allows, for example, a laboratory test result sourced in MEDITECH to go outbound on an HL7 interface and report itself properly in another, non-MEDITECH, system. A vendor may also ask for LOINC codes as part of a scheduled extract of laboratory test data.

Or, it may be useful for internal analysis to group laboratory test results by their LOINC code, particularly if you have multiple facilities in your MEDITECH environment and each @.facility has a different set of LAB dictionaries.

The Codes Themselves…

…are stored in (for Client/Server and 6.x):

RWS-Blog-LOINC-Code-Values-Code1A.jpg

With a parent segment / dictionary of:

RWS-Blog-LOINC-Code-Values-Code2A.jpg

And in MAGIC, in:

RWS-Blog-LOINC-Code-Values-Code3A.jpg

With a parent dictionary/segment in:

RWS-Blog-LOINC-Code-Values-Code4A.jpg

So, if you want to get from the laboratory test and/or results to the codes, you can get at them this way:

RWS-Blog-LOINC-Code-Values-Code5.jpg

And in MAGIC:

RWS-Blog-LOINC-Code-Values-Code6.jpg

Extra Credit

Create a table valued FUNCTION (or a VIEW) to encapsulate this logic so you have a handy, re-usable database object to fetch yourself a LOINC code (or a SNOMED code or… whatever else in the nomenclature map table!) when you need it without having to cut and paste this JOIN structure.

If you need more help…

Our Report Writing team can help you fix reports, create new ones, make old ones run faster, and much more. Simply reach out to your Iatric Systems Account Executive, or our NPR report writing team at reportwriting@iatric.com), or click the button below to contact us and learn how we can help support your team!

RW-HELP-Button-Blue.png