001    package org.vmdb.hl7;
002    
003    import java.util.*;
004    
005    /**
006     * <p><Title:> OBSERVATION Loop. </p>
007     * <p>Description: HL7 Network Connectivity For VMDB. </p>
008     * <p>Copyright: Copyright (c) 2002-2003. </p>
009     * <p>Company: Veterinary Medical Database (VMDB). </p>
010     * <p>The XML representation of HL7 2.x introduces the concepts of groups and lists
011     * that, while present in the construction rules of delimited HL7, are not explicitly
012     * named or labelled in the messages themselves.  This class follows the XML
013     * version with explicitly constructed groups and lists
014     * which we've combined under the general term (borrowed from X12) of "loop."</p>
015     * <p>Most of the repetion and grouping facilitated by this "loop" logic is not
016     * used in the VMDB version of the ORU message but is maintained to retain full
017     * standard compliance and to allow extending this model without fear of losing
018     * interoperability.</p>
019     * <p>Loop and Segment Nesting:  The outline below shows how the loops and minimum
020     * required segments nest. {OBX} indicates that any number of OBX segments may
021     * appear at this location.</p>
022    <pre>
023    MSH
024    PATIENT_RESULT
025        PATIENT
026          PID
027          PATIENT_VISIT
028            PV1
029        ORDER_OBSERVATION
030         [ORC]
031          OBR
032            <b>OBSERVATION</b>
033              OBX
034    </pre>
035     * @author Michael K. Martin
036     * @version 1.0
037     */
038    
039    public class OBSERVATIONLoop extends HL7Loop {
040       private String sNm = "OBSERVATION";
041       private String sRl = "[OBX]{[NTE]}";
042    
043       public OBSERVATIONLoop() {
044          super();
045          setName( sNm );
046          setRule( sRl );
047       }
048    
049       /**
050        * Get the OBX segment that should be contained within this loop.  If
051        * it does not exist, take the necessary steps to create it in the appropriate
052        * location.
053        * @return OBXSegment object located at the appropriate place in the loop.
054        */
055       public OBXSegment getOBX() {
056          OBXSegment obx = (OBXSegment)findSegment( "OBX" );
057          if( obx == null ) {
058             obx = new OBXSegment();
059             obx.initialize();
060             if( vSegments == null ) vSegments = new Vector();
061             vSegments.add(0,obx);
062          }
063          return obx;
064       }
065    
066    
067    }// End class OBSERVATIONLoop