Elexis API documentation
Version 2.1.6 as of December 11 2011

ch.elexis.importers
Class HL7

java.lang.Object
  extended by ch.elexis.importers.HL7
Direct Known Subclasses:
HL7, HL7

public class HL7
extends java.lang.Object

This class parses a HL7 file containing lab results. It tries to comply with several possible Substandards of the HL7 and to return always reasonable values for each field.

Author:
Gerry

Nested Class Summary
 class HL7.OBR
           
 class HL7.OBX
           
static class HL7.RECORDTYPE
           
static class HL7.RESULTSTATUS
           
 
Constructor Summary
HL7(java.lang.String labor, java.lang.String kuerzel)
          We can force this hl7 to be attributed to a specific lab (if we know, who the sender should be) by providing a name and a short name.
 
Method Summary
 HL7.OBR firstOBR()
          Find the first OBR record in the file
 java.lang.String getComments()
          Extract all comments (NTE), global and OBX comments
 TimeTool getDate()
           
 java.lang.String getFilename()
           
 Result<Kontakt> getLabor()
          Find the lab issuing this file.
 Result<java.lang.Object> getPatient(boolean createIfNotFound)
          This method tries to find the patient denoted by this HL7-record.
 Result<java.lang.String> getUID()
           
 Result<java.lang.Object> load(java.lang.String filename)
          Load file into memory and break it up to separate lines.
static TimeTool makeTime(java.lang.String datestring)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HL7

public HL7(java.lang.String labor,
           java.lang.String kuerzel)
We can force this hl7 to be attributed to a specific lab (if we know, who the sender should be) by providing a name and a short name. If we pass null, the lab will be taken out of the file (if a sender is provided here)

Parameters:
labor - String
kuerzel - String
Method Detail

load

public Result<java.lang.Object> load(java.lang.String filename)
Load file into memory and break it up to separate lines. All other methods should only be called after load was successful. To comply with some of the many standards around, we accept \n and \r and any combination thereof as field separators

Parameters:
filename - String
Returns:

getFilename

public java.lang.String getFilename()

getPatient

public Result<java.lang.Object> getPatient(boolean createIfNotFound)
This method tries to find the patient denoted by this HL7-record. We try the PID-field PatientID, that is documented as "PlacerID". But unfortunately not all labs use this field. Thus we try secondly the ORC-field "Placer Order Number". If the fields are different, we use the ORC field. The Order number then is interpreted as a checksummed order number (Patient-Number+modulo10+ -HHmm). If we cannot find the Patient using this method, we try to find him/her with the name and birthdate. If we still cannot make an unambiguous identification, we ask the user to tell us, who this lab result belongs to. If the user can't decide we refuse the import. This mess happens, because the labs interpret the hl7 'standard' differently and inconsistently.

Parameters:
createIfNotFound - create the patient record in the database if neccessary
Returns:
the Patient or null if it was not found and createIfNotFound was false, or an error indicating the problem if it could not be created

getUID

public Result<java.lang.String> getUID()

getDate

public TimeTool getDate()
Returns:
Date of the HL7 message

getLabor

public Result<Kontakt> getLabor()
Find the lab issuing this file. If we provided a lab name in the constructor, ths will return that lab.

Returns:
the lab or null if it could not be found

firstOBR

public HL7.OBR firstOBR()
Find the first OBR record in the file

Returns:
an OBR (which might be empty)

getComments

public java.lang.String getComments()
Extract all comments (NTE), global and OBX comments

Returns:
a string containing all comments, separated by newlines

makeTime

public static TimeTool makeTime(java.lang.String datestring)

Elexis API documentation
Version 2.1.6 as of December 11 2011

Copyright 2005-2011 by Gerry Weirich, Elexis