Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.vmdb.hl7
Class ORUMessage  view ORUMessage download ORUMessage.java

java.lang.Object
  extended byorg.vmdb.hl7.HL7Object
      extended byorg.vmdb.hl7.HL7SegmentContainer
          extended byorg.vmdb.hl7.HL7Message
              extended byorg.vmdb.hl7.ORUMessage

public class ORUMessage
extends HL7Message

Observation Unsolicited (ORU) Message.

Description: HL7 Network Connectivity For VMDB.

Copyright: Copyright (c) 2002-2003.

Company: M&M Informatics.

Message class(es) form the main API for the library. In most cases, there will be simple methods for inserting and extracting values from the message structure as well as for parsing incoming messages or building outgoing messages in either delimited HL7 or the draft XML representation.

The Observation Unsolicited (ORU) message is the approved method for submitting data to the Veterinary Medical Database (VMDB). This class implements a subset of the ORU message that meets all requirements of VMDB and parses and builds standard-compliant ORU messages. Appropriate default values are provided for required fields not used by VMDB. Limitations added by VMDB are supported and taken advantage of in order to keep the API as simple as possible. For routine processing of VMDB submissions, the only methods needed should be those provided in the ORUMessage's public interface and the public methods inherited from HL7Message.

For more complex tasks or for anything I've missed, any standard-compliant ORU message should parse correctly and any of its contents be accessible using lower-level classes. Similarly, using lower-level classes it is possible to build any standard-compliant ORU message which can then be rendered as either delimited or XML version HL7.

The XML representation of HL7 2.x introduces the concepts of groups and lists that, while present in the construction rules of delimited HL7, are not explicitly named or labelled in the messages themselves. The internal representation in this class follows the XML version with explicitly constructed groups and lists which we've combined under the general term (borrowed from X12) of "loop." Going to the lower-level access methods often requires knowing the location of a segment in this loop structure. Perhaps the simplest way to learn this loop structure is to use the library to import a delimited HL7 message of the structure you are working with, and then print it out using the toXML() method. Because all the groups and lists are explicitly named in the XML, the structure hierarchy will be right there.

The internal representation is built up using recursive construction. The message contains segments and loops. Loops can contain segments and other loops. Segments contain fields defined by elements of specific HL7 types. These elements my be simple strings of various types (all represented by SimpleElement currently) or may be built up from components which are themselves elements and so on. Because any given message can contain a potentially infinite number of segments, the data structure is only instantiated as it is needed either from reading in segments during parsing or from setting values that reside in a segment or field not yet instantiated. This is actually implemented in the getSSS() methods on the basis that a program is only getting the segment to do something with it. Similarly, segments are intially instantiated with place holders for all fields up to the last required field. This ensures that all delimiters required for standards compliance are present when the structure is output as HL7. If a value is set for an optional field after the last required field, placeholders up to and including the new field are instantiated. Because XML uses tag labels rather than position to identify fields, these empty fields are not output in the toXML() method.

Note: We use Java Bean like convention of getXXX and setXXX but with a few deviations. First as previously mentioned, getSSS() where SSS is a segment or loop abbreviation has the side affect of constructing the segment or loop if it does not already exist. Also, the set methods frequently take multiple parameters especially when the actual value is a mildly complex element-type such as coded entry (CE). We have added common conventional name patterns. For example addSSS() for segments that repeat and addDiagnosis(), etc., to abstract the process of adding a segment (usually OBX) holding a single data entry such as a finding (addFinding) or diagnosis (addDiagnosis). listXXX() returns an Iterator object over a collection of segments of the type specified by XXX. findEEE( XXX ) methods perform a depth-first search of the object hierarchy looking for XXX.

TODO: Add string length validation to all methods taking String input and add to documentation.

Version:
1.0

Field Summary
private static java.lang.String MESSAGE_TYPE
           
private static java.lang.String MESSAGE_VERSION
           
private  java.lang.String sNm
           
private  java.lang.String sRl
           
 
Fields inherited from class org.vmdb.hl7.HL7Message
 
Fields inherited from class org.vmdb.hl7.HL7SegmentContainer
slData, stState, vSegments
 
Fields inherited from class org.vmdb.hl7.HL7Object
COMP_SEP, ESC_SEP, FIELD_SEP, REP_SEP, sName, sRule, sSeparators, SUB_SEP
 
Constructor Summary
ORUMessage()
          Construct an empty ORU Message with type and version set.
 
Method Summary
 OBXSegment addDiagnosis(CEElement ceDiagnosis)
          Add a Diagnosis as a predefined CE Element.

Often uses one of the set of predefined constants
 OBXSegment addDiagnosis(CEElement ceDiagnosis, boolean bRecheck)
          Add a Diagnosis as a predefined CE Element.

Often uses one of the set of predefined constants
 OBXSegment addDiagnosis(java.lang.String sDiagnosisCode, java.lang.String sDiagnosisText, java.lang.String sCodeSystem)
          Add a Diagnosis as the individual components of the CE Element.
 OBXSegment addDiagnosis(java.lang.String sDiagnosisCode, java.lang.String sDiagnosisText, java.lang.String sCodeSystem, boolean bRecheck)
          Add a Diagnosis as the individual components of the CE Element.
 OBXSegment addFinding(CEElement ceFinding)
          Add a Finding as a predefined CE Element.

Often uses one of the set of predefined constants
 OBXSegment addFinding(java.lang.String sFindingCode, java.lang.String sFindingText, java.lang.String sCodeSystem)
          Add a Finding as the individual components of a CE Element.
 OBXSegment addOBX()
          Add an OBX segment that should be located in this loop.
 OBXSegment addProcedure(CEElement ceProcedure)
          Add a Procedure as a predefined CE Element.

Often uses one of the set of predefined constants
 OBXSegment addProcedure(java.lang.String sProcedureCode, java.lang.String sProcedureText, java.lang.String sCodeSystem)
          Add a Procedure as the individual components of a CE Element.
 java.lang.String getAdmissionType()
          Get the admission type code.
 java.lang.String getAdmitDateTime()
          Get the admit date/time as a string.
 XCNElement getAttendingDoctor()
          Get the attending doctorn ID as a full XCN Element.

Note: This and other "get" methods that return HL7 Element objects return references to the object in place in the message.
 java.lang.String getAttendingDoctorAssigningFacility()
          Get the attending doctor ID assigning facility.

TODO: Check assigner logic and replace with Assigning Authority if necessary.
 java.lang.String getAttendingDoctorId()
          Get the attending doctor ID number.
 CEElement getBreed()
          Get the breed as a predefined CE Element.

Often uses one of the set of predefined constants.
Note: If populated with a constant, subsequent calls to getBreed() will return a reference to the constant (final static object) and cannot be modified through calls to the CEElement's methods.
 java.lang.String getBreedText()
          Get the breed text.
 CEElement getChiefComplaint()
          Get the Chief Complaint as a predefined CE Element.

Often uses one of the set of predefined constants.
 java.lang.String getChiefComplaintText()
          Get the Chief Complaint text.
 java.lang.String getColor()
          Get the animal's color as string.

Stored as OBX with loinc code 29552-7 color nar
 java.lang.String getDateOfBirth()
          Get the date of birth.
 java.lang.String getDischargeDateTime()
          Get the discharge date/time as a string.
 java.lang.String getDisposition()
          Get Discharge Disposition string.
 java.lang.String getEarTagText()
          Get the ear tag text.

Note: This logic assumes only one ear tag per animal.
 java.lang.String getEarTagType()
          Get the ear tag type.

Note: This logic assumes only one ear tag per animal.
 ORU_R01_LST_8Loop getLST_8()
          Get the The LST.8 loop contained in this message.
 java.lang.String getMedicalRecordNumber()
          Get the Medical record number.

Medical record is defined in this logic as the identifier assigned by the sending facility.
 java.lang.String getMessageControlId()
          Get the message control id.
 java.lang.String getMicrochipNumber()
          Get the microchip number.

Note: This logic assumes only one microchip per animal.
 java.lang.String getMicrochipType()
          Get the microchip type.

Note: This logic assumes only one microchip per animal.
 OBRSegment getOBR()
          Get the OBR segment that should be nested somewhere within this loop.
 java.lang.String getObservationDateTime()
          Get the observation date/time as a string.
 ORCSegment getORC()
          Get the ORC segment that should be nested somewhere within this loop.
 ORCSegment getORC(java.lang.String sOrderControl)
          Get the ORC segment that should be nested somewhere within this loop.
 java.lang.String getOrderControl()
          Get Order Contrl string.
 java.lang.String getPatientClass()
          Get the patient class code.
 java.lang.String getPatientName()
          Get the patient's name.
 java.lang.String getPatientZipcode()
          Get the postal code.
 PIDSegment getPID()
          Get the PID segment that should be nested within this message.
 PV1Segment getPV1()
          Get the PV1 segment that should be nested somewhere within this loop.
 java.lang.String getSendingFacilityId()
          Get the Sending facility VMDB Institution Id.
 java.lang.String getSendingFacilityName()
          Get the Sending facility name.
 java.lang.String getSex()
          Get the gender.
 CEElement getSpecies()
          Get the species as a predefined CE Element.

Often uses one of the set of predefined constants.
Note: If setSpecies was called with a constant, subsequent calls to getSpecies() will return a reference to the constant (final static object) and cannot be modified through calls to the CEElement's methods.
 java.lang.String getSpeciesText()
          Get the species text.
 java.lang.String getTattooText()
          Get the tattoo text.

Note: This logic assumes only one tattoo per animal.
 java.lang.String getTattooType()
          Get the tattoo type.

Note: This logic assumes only one tattoo per animal.
 CEElement getUniversalServiceId()
          Get the coded universal service identifier as a preformed CE Element.
 java.lang.String getUniversalServiceIdText()
          Get the universal service identifier text.
 CXElement getVisitNumber()
          Get the Visit Number ID as full CX Element.
 java.lang.String getVisitNumberAssigningFacility()
          Get the Visit Number assigning facility.

TODO: Check assigner logic and replace with Assigning Authority if necessary.
 java.lang.String getVisitNumberId()
          Get the Visit Number ID number.
 java.lang.String getWeight()
          Get the animal's weight.

Stored as OBX with loinc code 8335-2 "Body Weight Estimated" or 3141-9 "Body Weight Measured"
Note: We assume only one weight.
 boolean getWeightMeasured()
          Was the weight we returned with getWeight a measured weight rather than an estimate.
 java.lang.String getWeightUnits()
          Get the weight units.

Note: Thelogic used here must be kept in step with the logic used in getWeight().
 java.util.Iterator listDiagnoses()
          Get the Diagnosis list as an iterator over OBXSegment objects.

Often uses one of the set of predefined constants.
The implementation is going to be very Java-specific because it depends on garbage collection to maintain an instance of a Vector until Iterator is released.
 java.util.Iterator listModifiers(OBXSegment obxRoot)
          Get the Modifier list as iterator over OBXSegment objects.

The implementation is going to be very Java-specific because it depends on garbage collection to maintain an instance of a Vector until Iterator is released.
 java.util.Iterator listProcedures()
          Get the Procedure list as an iterator over OBXSegment objects.

Often uses one of the set of predefined constants.
The implementation is going to be very Java-specific because it depends on garbage collection to maintain an instance of a Vector until Iterator is released.
 java.util.Iterator listRechecks()
          Get the Recheck list as an iterator over OBXSegment objects.

Often uses one of the set of predefined constants.
The implementation is going to be very Java-specific because it depends on garbage collection to maintain an instance of a Vector until Iterator is released.
 OBXSegment modifyObservation(OBXSegment obxRoot, CEElement ceIdentifier, CEElement ceModifier)
          Modify a coded OBXSegment using predefined Coded Entry for identifier and code.

Often uses one of the set of predefined constants.
The same Modifier methods can be used for Complaints, Diagnoses, Procedures, Findings, etc., anything in a coded OBX.
This logic uses the SubId field value.
 void setAdmissiontype(java.lang.String sAdmissionType)
          Set the admission type code (C, K, E, Z, P, or R).

TODO: Add error checking to ensure only valud class code is provided.
 void setAdmitDateTime(java.lang.String sDateTime)
          Set the admit date/time of the message to string formatted date/time.

TODO: Add date format validation logic
 void setAttendingDoctorId(java.lang.String sIdNumber)
          Set the attending doctor ID number using the default assigning facility of the facility sending the report.
 void setAttendingDoctorId(java.lang.String sIdNumber, java.lang.String sAssigningFacility)
          Set the attending doctor.
 void setBreed(CEElement ceBreed)
          Set the breed as a predefined CE Element.

Often uses one of the set of predefined constants.
Note: If populated with a constant, subsequent calls to getBreed() will return a reference to the constant (final static object) and cannot be modified through calls to the CEElement's methods.
 void setBreed(java.lang.String sBreedCode, java.lang.String sBreedText, java.lang.String sCodeSystem)
          Set the breed as the individual components of a CE Element.
 OBXSegment setChiefComplaint(CEElement ceChiefComplaint)
          Set the Chief Complaint as a predefined CE Element.
 OBXSegment setChiefComplaint(java.lang.String sChiefComplaintCode, java.lang.String sChiefComplaintText, java.lang.String sCodeSystem)
          Set the Chief Complaint as the individual components of a CE Element.
 void setColor(java.lang.String sColor)
          Set the animal's color as uncoded text.

Stored as OBX with loinc code 29552-7 color nar
 void setDateOfBirth(java.lang.String sBDate)
          Set the date of birth as ISO format data string YYYYMMDD
 void setDateOfBirth(TSElement tsBDate)
          Set the date of birth as ISO format data string YYYYMMDD
 void setDischargeDateTime(java.lang.String sDateTime)
          Set the discharge date/time of the message to string formatted date/time.

TODO: Add date format validation logic
 void setDisposition(java.lang.String sDisp)
          Set the Discharge Disposition.

TODO: Add code validation logic
 void setEarTag(java.lang.String sEarTagText, java.lang.String sEarTagType)
          Set the ear tag text and type.

Note: This logic assumes only one ear tag per animal.
 void setMedicalRecordNumber(java.lang.String sMRN)
          Set the Medical record number.

Medical record is defined in this logic as the identifier assigned by the sending facility.
 void setMessageControlId(java.lang.String sMessageControlId)
          Set the message control id.
 void setMicrochip(java.lang.String sChipNumber, java.lang.String sChipType)
          Set the microchip number and type.
 void setObservationDateTime(java.lang.String sDateTime)
          Set the observation date/time of the message to string formatted date/time.
 void setOrderControl(java.lang.String sOrderControl)
          Set the Order Control.

TODO: Add code validation logic
 void setPatientClass(java.lang.String sPatClass)
          Set the patient class code (A, I, O, R).

TODO: Add error checking to ensure only valud class code is provided.
 void setPatientName(java.lang.String sName)
          Set the patient's name (normally "Confidential").
 void setPatientZipcode(java.lang.String sZipcode)
          Set the postal code of animal's residence.
 void setSendingFacility(java.lang.String sName, java.lang.String sId)
          Set the Sending facility VMDB Institution Id.
 void setSex(java.lang.String sSex)
          Set the gender.
 void setSpecies(CEElement ceSpecies)
          Set the species as a predefined CE Element.

Often uses one of the set of predefined constants.
Note: If populated with a constant, subsequent calls to getSpecies() will return a reference to the constant (final static object) and cannot be modified through calls to the CEElement's methods.
 void setSpecies(java.lang.String sSpeciesCode, java.lang.String sSpeciesText, java.lang.String sCodeSystem)
          Set the species as the individual components of a CE Element
 void setTattoo(java.lang.String sTattooText, java.lang.String sTattooType)
          Set the tattoo text and type.

Note: This logic assumes only one tattoo per animal.
 void setUniversalServiceId(CEElement ceServiceId)
          Set the coded universal service identifier as a preformed CE Element.

Note: For VMDB submissions this will always be called as
setUniversalServiceId( Loinc.CHART_ABSTRACT );
If we can figure out where to put it, we may make this a default.
 void setUniversalServiceId(java.lang.String sCode, java.lang.String sText, java.lang.String sCodeType)
          Set the coded universal service identifier.

This version takes the fully qualified CEElement components
 void setVisitNumber(java.lang.String sVisitNumber)
          Set the Visit Number.

Normally assigned by the sending facility so this is added as the default Assigning Faciltiy.
 void setVisitNumberAssigningFacility(java.lang.String sAssigningFacility)
          Set the Visit Number ID assigning facility.

Note: setVisitNumber() automatically assigns thisFacility as the assigning facility.
 void setWeight(java.lang.String sWeight, java.lang.String sWeightUnits)
          Set the animal's weight and weight units.

Stored as OBX with loinc code 3141-9 "Body Weight Measured." This is just a convenience method for the common case where weights are normally always measured.
 void setWeight(java.lang.String sWeight, java.lang.String sWeightUnits, boolean bMeasured)
          Set the weight.

Stored as OBX with loinc code 8335-2 "Body Weight Estimated" or 3141-9 "Body Weight Measured"
TODO: Add checking that the string supplied as sWeight parses as a numeric.
TODO: Add checking that the string supplied as sWeightUnits is a valid unit of measure
 void setWeightRange(SNElement snWeightRange, CEElement ceWeightUnits)
          Set the animal's weight range and weight units.

Stored as OBX with loinc code 3141-9 "Body Weight Measured." This is just a convenience method for the common case where weights are normally always measured.
 
Methods inherited from class org.vmdb.hl7.HL7Message
addSegment, getDTD, getMessageName, getMSH, getReceivingFacility, getReceivingFacilityId, getReceivingFacilityName, getSendingFacility, getStyleSheet, printRule, readHL7, setDTD, setMessageName, setReceivingFacility, setReceivingFacility, setSendingFacility, setStyleSheet, toXML, toXML
 
Methods inherited from class org.vmdb.hl7.HL7SegmentContainer
addSegment, findSegment, iterator, listsSegments, messageComplete, pop, processLoop, processSegment, push, readString, setData, setSeparators, toString
 
Methods inherited from class org.vmdb.hl7.HL7Object
getName, getRule, getSeparator, getSeparators, setName, setRule
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

sNm

private java.lang.String sNm

sRl

private java.lang.String sRl

MESSAGE_TYPE

private static final java.lang.String MESSAGE_TYPE
See Also:
Constant Field Values

MESSAGE_VERSION

private static final java.lang.String MESSAGE_VERSION
See Also:
Constant Field Values
Constructor Detail

ORUMessage

public ORUMessage()
Construct an empty ORU Message with type and version set. This object is ready to either build via a series of set and add calls, or to read in an HL7 or XML (future) message.

Method Detail

getLST_8

public ORU_R01_LST_8Loop getLST_8()
Get the The LST.8 loop contained in this message. If it does not exist, take the necessary steps to create it.

Chaining calls to getLST_N() and getGRP_N() allows the retrieval of a loop at any point in the hierarchy with knowledge that if this is the first use of any loop or loops in the hierarchy, they will be created so that the returned reference is a valid part of the message being constructed. The referenced loop can then be used to access a segment via getSSS() or addSSS() depending on the type repeatablility of the segment.


getPID

public PIDSegment getPID()
Get the PID segment that should be nested within this message. If it does not exist, take the necessary steps to create it in the appropriate nested loop structure.

Note: The "get" semantics here only work correctly for segments that exist singly in a message. We break with generic HL7 here in that only under VMDB are we restricted to a single patient per message. If we drop this limitation we will need to create more complex "addPID()" semantics.


getPV1

public PV1Segment getPV1()
Get the PV1 segment that should be nested somewhere within this loop. If it does not exist, take the necessary steps to create it in the appropriate nested loop structure.

Note: The "get" semantics here only work correctly for segments that exist singly in a message. We break with generic HL7 here in that only under VMDB are we restricted to a single patient visit per message. If we drop this limitation we will need to create more complex "addPV1()" semantics.


getOBR

public OBRSegment getOBR()
Get the OBR segment that should be nested somewhere within this loop. If it does not exist, take the necessary steps to create it in the appropriate nested loop structure.

Note: The "get" semantics here only work correctly for segments that exist singly in a message. We break with generic HL7 here in that only under VMDB are we restricted to a single observation request per message. If we drop this limitation we will need to create more complex "addOBR()" semantics.


getORC

public ORCSegment getORC()
Get the ORC segment that should be nested somewhere within this loop. If it does not exist, take the necessary steps to create it in the appropriate nested loop structure.


getORC

public ORCSegment getORC(java.lang.String sOrderControl)
Get the ORC segment that should be nested somewhere within this loop. If it does not exist, take the necessary steps to create it in the appropriate nested loop structure.


addOBX

public OBXSegment addOBX()
Add an OBX segment that should be located in this loop. If the loop does not exist, take the necessary steps to create it.

Note: This should really be linked to a specific OBR, but because VMDB only allows one OBR per message, we are safe like this.


setMessageControlId

public void setMessageControlId(java.lang.String sMessageControlId)
Set the message control id.

Overrides:
setMessageControlId in class HL7Message

getMessageControlId

public java.lang.String getMessageControlId()
Get the message control id.

Overrides:
getMessageControlId in class HL7Message

setSendingFacility

public void setSendingFacility(java.lang.String sName,
                               java.lang.String sId)
Set the Sending facility VMDB Institution Id.

Overrides:
setSendingFacility in class HL7Message

getSendingFacilityId

public java.lang.String getSendingFacilityId()
Get the Sending facility VMDB Institution Id.

Overrides:
getSendingFacilityId in class HL7Message

getSendingFacilityName

public java.lang.String getSendingFacilityName()
Get the Sending facility name.

Overrides:
getSendingFacilityName in class HL7Message

setMedicalRecordNumber

public void setMedicalRecordNumber(java.lang.String sMRN)
Set the Medical record number.

Medical record is defined in this logic as the identifier assigned by the sending facility. To work correctly, the sending facility identifier must be set before actions involving MRN.


getMedicalRecordNumber

public java.lang.String getMedicalRecordNumber()
Get the Medical record number.

Medical record is defined in this logic as the identifier assigned by the sending facility. To work correctly, the sending facility identifier must be set before actions involving MRN.


setSpecies

public void setSpecies(CEElement ceSpecies)
Set the species as a predefined CE Element.

Often uses one of the set of predefined constants.
Note: If populated with a constant, subsequent calls to getSpecies() will return a reference to the constant (final static object) and cannot be modified through calls to the CEElement's methods. But why would you want to?


setSpecies

public void setSpecies(java.lang.String sSpeciesCode,
                       java.lang.String sSpeciesText,
                       java.lang.String sCodeSystem)
Set the species as the individual components of a CE Element


getSpecies

public CEElement getSpecies()
Get the species as a predefined CE Element.

Often uses one of the set of predefined constants.
Note: If setSpecies was called with a constant, subsequent calls to getSpecies() will return a reference to the constant (final static object) and cannot be modified through calls to the CEElement's methods. But why would you want to?


getSpeciesText

public java.lang.String getSpeciesText()
Get the species text.


setBreed

public void setBreed(CEElement ceBreed)
Set the breed as a predefined CE Element.

Often uses one of the set of predefined constants.
Note: If populated with a constant, subsequent calls to getBreed() will return a reference to the constant (final static object) and cannot be modified through calls to the CEElement's methods. But why would you want to?


setBreed

public void setBreed(java.lang.String sBreedCode,
                     java.lang.String sBreedText,
                     java.lang.String sCodeSystem)
Set the breed as the individual components of a CE Element.


getBreed

public CEElement getBreed()
Get the breed as a predefined CE Element.

Often uses one of the set of predefined constants.
Note: If populated with a constant, subsequent calls to getBreed() will return a reference to the constant (final static object) and cannot be modified through calls to the CEElement's methods. But why would you want to?


getBreedText

public java.lang.String getBreedText()
Get the breed text.


setDateOfBirth

public void setDateOfBirth(java.lang.String sBDate)
Set the date of birth as ISO format data string YYYYMMDD


setDateOfBirth

public void setDateOfBirth(TSElement tsBDate)
Set the date of birth as ISO format data string YYYYMMDD


getDateOfBirth

public java.lang.String getDateOfBirth()
Get the date of birth.


setSex

public void setSex(java.lang.String sSex)
Set the gender.


getSex

public java.lang.String getSex()
Get the gender.


setWeight

public void setWeight(java.lang.String sWeight,
                      java.lang.String sWeightUnits,
                      boolean bMeasured)
Set the weight.

Stored as OBX with loinc code 8335-2 "Body Weight Estimated" or 3141-9 "Body Weight Measured"
TODO: Add checking that the string supplied as sWeight parses as a numeric.
TODO: Add checking that the string supplied as sWeightUnits is a valid unit of measure


setWeight

public void setWeight(java.lang.String sWeight,
                      java.lang.String sWeightUnits)
Set the animal's weight and weight units.

Stored as OBX with loinc code 3141-9 "Body Weight Measured." This is just a convenience method for the common case where weights are normally always measured.


setWeightRange

public void setWeightRange(SNElement snWeightRange,
                           CEElement ceWeightUnits)
Set the animal's weight range and weight units.

Stored as OBX with loinc code 3141-9 "Body Weight Measured." This is just a convenience method for the common case where weights are normally always measured.


getWeight

public java.lang.String getWeight()
Get the animal's weight.

Stored as OBX with loinc code 8335-2 "Body Weight Estimated" or 3141-9 "Body Weight Measured"
Note: We assume only one weight. The logic here is to take the first found of measured or the first estimated if no measured found. Equally valid would be to take the latest measurement, etc.


getWeightUnits

public java.lang.String getWeightUnits()
Get the weight units.

Note: Thelogic used here must be kept in step with the logic used in getWeight(). For now that means if there is a measured weight we use it in getWeight and return true hereWe assume only one weight. The logic here is to take the first found of measured or the first estimated if no measured found. Equally valid would be to take the latest measurement, etc.. Sequential calls to getWeight(), getWeightUnits(), and getWeightMeasured() should return information about the same weight observation. This might be un-threadsafe in environments where another thread could be writing a weight OBX while another is reading. In such cases, it would be better to get the OBX and extract the fields manually.
TODO: If demand arises, add a getWeightOBX() method to facilitate thread-safe access.


getWeightMeasured

public boolean getWeightMeasured()
Was the weight we returned with getWeight a measured weight rather than an estimate.

Note: Thelogic used here must be kept in step with the logic used in getWeight(). For now that means if there is a measured weight we use it in getWeight and return true hereWe assume only one weight. The logic here is to take the first found of measured or the first estimated if no measured found. Equally valid would be to take the latest measurement, etc.. Sequential calls to getWeight(), getWeightUnits(), and getWeightMeasured() should return information about the same weight observation. This might be un-thread-safe in environments where one thread could be writing a weight OBX while another is reading. In such cases, it would be better to get the OBX and extract the fields manually.
TODO: If demand arises, add a getWeightOBX() method to facilitate thread-safe access.


setColor

public void setColor(java.lang.String sColor)
Set the animal's color as uncoded text.

Stored as OBX with loinc code 29552-7 color nar


getColor

public java.lang.String getColor()
Get the animal's color as string.

Stored as OBX with loinc code 29552-7 color nar


setMicrochip

public void setMicrochip(java.lang.String sChipNumber,
                         java.lang.String sChipType)
Set the microchip number and type.


getMicrochipNumber

public java.lang.String getMicrochipNumber()
Get the microchip number.

Note: This logic assumes only one microchip per animal. It is possible that an animal would have multiple, ie, one US and one European chip. More than one chip can be set using this program logic as long as the types differ. They they will be stored and transmitted correctly and could be retrieved using lower-level code. However, this code returns only the first chip found.
Note: The same sort of thread-safety issue exists as in the getWeightUnits 55 method.


getMicrochipType

public java.lang.String getMicrochipType()
Get the microchip type.

Note: This logic assumes only one microchip per animal. It is possible that an animal would have multiple, ie, one US and one European chip. More than one chip can be set using this program logic as long as the types differ. They they will be stored and transmitted correctly and could be retrieved using lower-level code. However, this code returns only the first chip found.
Note: The same sort of thread-safety issue exists as in the getWeightUnits 55 method.


setTattoo

public void setTattoo(java.lang.String sTattooText,
                      java.lang.String sTattooType)
Set the tattoo text and type.

Note: This logic assumes only one tattoo per animal. It is possible that an animal would have multiple. More than one tattoo can be set using this program logic as long as they are different types and they will be stored and transmitted correctly. However, this logic returns only the tattoo found.


getTattooText

public java.lang.String getTattooText()
Get the tattoo text.

Note: This logic assumes only one tattoo per animal. This method returns the first found. However, this logic returns only the tattoo found.
Note: The same sort of thread-safety issue exists as in the getWeightUnits 55 method.


getTattooType

public java.lang.String getTattooType()
Get the tattoo type.

Note: This logic assumes only one tattoo per animal. This method returns the first found.
Note: The same sort of thread-safety issue exists as in the getWeightUnits 55 method.


setEarTag

public void setEarTag(java.lang.String sEarTagText,
                      java.lang.String sEarTagType)
Set the ear tag text and type.

Note: This logic assumes only one ear tag per animal. It is possible that an animal would have multiple. More than one ear tag can be set using this program logic as long as they are different types and they will be stored and transmitted correctly. However, this logic returns only the first ear tag found.
More so than the other identifiers, this may be an issue. It is not a big project for the library developer to change to add/list logic but it will add complexity at the application programming layer as it will be up to the application to look through the list Iterator.


getEarTagText

public java.lang.String getEarTagText()
Get the ear tag text.

Note: This logic assumes only one ear tag per animal. It returns only the first ear tag found.
Note: The same sort of thread-safety issue exists as in the getWeightUnits 55 method.


getEarTagType

public java.lang.String getEarTagType()
Get the ear tag type.

Note: This logic assumes only one ear tag per animal. It returns only the first ear tag found.
Note: The same sort of thread-safety issue exists as in the getWeightUnits 55 method.


setPatientZipcode

public void setPatientZipcode(java.lang.String sZipcode)
Set the postal code of animal's residence.


getPatientZipcode

public java.lang.String getPatientZipcode()
Get the postal code.


setPatientName

public void setPatientName(java.lang.String sName)
Set the patient's name (normally "Confidential").


getPatientName

public java.lang.String getPatientName()
Get the patient's name.


setPatientClass

public void setPatientClass(java.lang.String sPatClass)
Set the patient class code (A, I, O, R).

TODO: Add error checking to ensure only valud class code is provided.


getPatientClass

public java.lang.String getPatientClass()
Get the patient class code.


setAdmissiontype

public void setAdmissiontype(java.lang.String sAdmissionType)
Set the admission type code (C, K, E, Z, P, or R).

TODO: Add error checking to ensure only valud class code is provided.


getAdmissionType

public java.lang.String getAdmissionType()
Get the admission type code.


setAttendingDoctorId

public void setAttendingDoctorId(java.lang.String sIdNumber,
                                 java.lang.String sAssigningFacility)
Set the attending doctor.


setAttendingDoctorId

public void setAttendingDoctorId(java.lang.String sIdNumber)
Set the attending doctor ID number using the default assigning facility of the facility sending the report. (As is normal VMDB procedure,)


getAttendingDoctor

public XCNElement getAttendingDoctor()
Get the attending doctorn ID as a full XCN Element.

Note: This and other "get" methods that return HL7 Element objects return references to the object in place in the message. They can thus be used to obtain a reference to a newly added entry. The XCNElement object's "set" methods can then be used to add details not provided with mutator methods at the message level. These additional components will most likely be ignored by VMDB when the message is received, but may be useful in other applications of the same messages, and as standard HL7 content will not cause errors at VMDB.


getAttendingDoctorId

public java.lang.String getAttendingDoctorId()
Get the attending doctor ID number.


getAttendingDoctorAssigningFacility

public java.lang.String getAttendingDoctorAssigningFacility()
Get the attending doctor ID assigning facility.

TODO: Check assigner logic and replace with Assigning Authority if necessary.


setVisitNumber

public void setVisitNumber(java.lang.String sVisitNumber)
Set the Visit Number.

Normally assigned by the sending facility so this is added as the default Assigning Faciltiy.


setVisitNumberAssigningFacility

public void setVisitNumberAssigningFacility(java.lang.String sAssigningFacility)
Set the Visit Number ID assigning facility.

Note: setVisitNumber() automatically assigns thisFacility as the assigning facility. So use only setVisitNumberAssigningFacility() after setting the number to override on those rare occasions when sending for a subsidiary, etc., with a different identifier than the sender.
TODO: Check assigner logic and replace with Assigning Authority if necessary.


getVisitNumber

public CXElement getVisitNumber()
Get the Visit Number ID as full CX Element.


getVisitNumberId

public java.lang.String getVisitNumberId()
Get the Visit Number ID number.


getVisitNumberAssigningFacility

public java.lang.String getVisitNumberAssigningFacility()
Get the Visit Number assigning facility.

TODO: Check assigner logic and replace with Assigning Authority if necessary.


setDisposition

public void setDisposition(java.lang.String sDisp)
Set the Discharge Disposition.

TODO: Add code validation logic


getDisposition

public java.lang.String getDisposition()
Get Discharge Disposition string.


setAdmitDateTime

public void setAdmitDateTime(java.lang.String sDateTime)
Set the admit date/time of the message to string formatted date/time.

TODO: Add date format validation logic


getAdmitDateTime

public java.lang.String getAdmitDateTime()
Get the admit date/time as a string.


setDischargeDateTime

public void setDischargeDateTime(java.lang.String sDateTime)
Set the discharge date/time of the message to string formatted date/time.

TODO: Add date format validation logic


getDischargeDateTime

public java.lang.String getDischargeDateTime()
Get the discharge date/time as a string.


setOrderControl

public void setOrderControl(java.lang.String sOrderControl)
Set the Order Control.

TODO: Add code validation logic


getOrderControl

public java.lang.String getOrderControl()
Get Order Contrl string.


setUniversalServiceId

public void setUniversalServiceId(java.lang.String sCode,
                                  java.lang.String sText,
                                  java.lang.String sCodeType)
Set the coded universal service identifier.

This version takes the fully qualified CEElement components


setUniversalServiceId

public void setUniversalServiceId(CEElement ceServiceId)
Set the coded universal service identifier as a preformed CE Element.

Note: For VMDB submissions this will always be called as
setUniversalServiceId( Loinc.CHART_ABSTRACT );
If we can figure out where to put it, we may make this a default. The problem with that would be confusion when used for other applications.


getUniversalServiceId

public CEElement getUniversalServiceId()
Get the coded universal service identifier as a preformed CE Element.


getUniversalServiceIdText

public java.lang.String getUniversalServiceIdText()
Get the universal service identifier text.


setObservationDateTime

public void setObservationDateTime(java.lang.String sDateTime)
Set the observation date/time of the message to string formatted date/time.


getObservationDateTime

public java.lang.String getObservationDateTime()
Get the observation date/time as a string.


modifyObservation

public OBXSegment modifyObservation(OBXSegment obxRoot,
                                    CEElement ceIdentifier,
                                    CEElement ceModifier)
Modify a coded OBXSegment using predefined Coded Entry for identifier and code.

Often uses one of the set of predefined constants.
The same Modifier methods can be used for Complaints, Diagnoses, Procedures, Findings, etc., anything in a coded OBX.
This logic uses the SubId field value. Each root observation within a GRP_1 loop receives a unique integer SubId. Modifiers of that root receive the root's integer followed by a period and a sequential integer. Modifiers of modifiers similarly add another period and integer.
TODO: Get the correct nomenclature for ceIdentifier and adjust method and documentation accordingly.


listModifiers

public java.util.Iterator listModifiers(OBXSegment obxRoot)
Get the Modifier list as iterator over OBXSegment objects.

The implementation is going to be very Java-specific because it depends on garbage collection to maintain an instance of a Vector until Iterator is released.


setChiefComplaint

public OBXSegment setChiefComplaint(CEElement ceChiefComplaint)
Set the Chief Complaint as a predefined CE Element. Often uses one of the set of predefined constants.


setChiefComplaint

public OBXSegment setChiefComplaint(java.lang.String sChiefComplaintCode,
                                    java.lang.String sChiefComplaintText,
                                    java.lang.String sCodeSystem)
Set the Chief Complaint as the individual components of a CE Element.


getChiefComplaint

public CEElement getChiefComplaint()
Get the Chief Complaint as a predefined CE Element.

Often uses one of the set of predefined constants.


getChiefComplaintText

public java.lang.String getChiefComplaintText()
Get the Chief Complaint text.


addDiagnosis

public OBXSegment addDiagnosis(CEElement ceDiagnosis)
Add a Diagnosis as a predefined CE Element.

Often uses one of the set of predefined constants


addDiagnosis

public OBXSegment addDiagnosis(CEElement ceDiagnosis,
                               boolean bRecheck)
Add a Diagnosis as a predefined CE Element.

Often uses one of the set of predefined constants


addDiagnosis

public OBXSegment addDiagnosis(java.lang.String sDiagnosisCode,
                               java.lang.String sDiagnosisText,
                               java.lang.String sCodeSystem)
Add a Diagnosis as the individual components of the CE Element.


addDiagnosis

public OBXSegment addDiagnosis(java.lang.String sDiagnosisCode,
                               java.lang.String sDiagnosisText,
                               java.lang.String sCodeSystem,
                               boolean bRecheck)
Add a Diagnosis as the individual components of the CE Element.


listDiagnoses

public java.util.Iterator listDiagnoses()
Get the Diagnosis list as an iterator over OBXSegment objects.

Often uses one of the set of predefined constants.
The implementation is going to be very Java-specific because it depends on garbage collection to maintain an instance of a Vector until Iterator is released.


listRechecks

public java.util.Iterator listRechecks()
Get the Recheck list as an iterator over OBXSegment objects.

Often uses one of the set of predefined constants.
The implementation is going to be very Java-specific because it depends on garbage collection to maintain an instance of a Vector until Iterator is released.


addProcedure

public OBXSegment addProcedure(CEElement ceProcedure)
Add a Procedure as a predefined CE Element.

Often uses one of the set of predefined constants


addProcedure

public OBXSegment addProcedure(java.lang.String sProcedureCode,
                               java.lang.String sProcedureText,
                               java.lang.String sCodeSystem)
Add a Procedure as the individual components of a CE Element.


listProcedures

public java.util.Iterator listProcedures()
Get the Procedure list as an iterator over OBXSegment objects.

Often uses one of the set of predefined constants.
The implementation is going to be very Java-specific because it depends on garbage collection to maintain an instance of a Vector until Iterator is released.


addFinding

public OBXSegment addFinding(CEElement ceFinding)
Add a Finding as a predefined CE Element.

Often uses one of the set of predefined constants


addFinding

public OBXSegment addFinding(java.lang.String sFindingCode,
                             java.lang.String sFindingText,
                             java.lang.String sCodeSystem)
Add a Finding as the individual components of a CE Element.