001 package org.vmdb.hl7;
002
003 import java.util.*;
004
005 /**
006 * <p><Title:> PATIENT_VISIT 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 <b>PATIENT_VISIT</b>
028 PV1
029 ORDER_OBSERVATION
030 [ORC]
031 OBR
032 OBSERVATION
033 OBX
034 </pre>
035 * @author Michael K. Martin
036 * @version 1.0
037 */
038
039 public class PATIENT_VISITLoop extends HL7Loop {
040 private String sNm = "PATIENT_VISIT";
041 private String sRl = "PV1[PV2]";
042
043 public PATIENT_VISITLoop() {
044 super();
045 setName( sNm );
046 setRule( sRl );
047 }
048
049 /**
050 * Get a reference to the PV1 Segemnt contained within this loop. If it does
051 * not yet exist, create it in the correct location.
052 * @return PV1Segment Reference to existing or new segment.
053 */
054 public PV1Segment getPV1() {
055 PV1Segment pv1 = (PV1Segment)findSegment( "PV1" );
056 if( pv1 == null ) {
057 pv1 = new PV1Segment();
058 pv1.initialize();
059 if( vSegments == null ) vSegments = new Vector();
060 // Goes at the beginning
061 vSegments.add(0,pv1);
062 }
063 return pv1;
064 }
065
066 }// End class PATIENT_VISITLoop