001    package org.vmdb.hl7;
002    
003    /**
004     * <p><Title:> Order Common (ORC) Segment. </p>
005     * <p>Description: HL7 Network Connectivity For VMDB. </p>
006     * <p>Copyright: Copyright (c) 2002-2003. </p>
007     * <p>Company: Veterinary Medical Database (VMDB). </p>
008     * <p>The Common Order segment (ORC) is used to transmit fields that are common
009     * to all orders (all types of services that are requested). The premise of the
010     * VMDB message is that there is a standing order with all participating
011     * facilties to provide visit summary information to the VMDB.  Thus, changes to
012     * visit information submitted to VMDB is, in fact, a change to the results of
013     * the standing order. While this segment is optional for initial transmission
014     * of visit summary information to the VMDB, it is required for updates and
015     * deletions of previously transmitted messages.</p>
016     * <p>The process defined by VMDB for updating a visit is for the original visit
017     * information to be deleted from the VMDB database and replaced with the
018     * contents of the replacement visit message.  For this to be accomplished,
019     * only the first field of the ORC is necessary.</p>
020     * <p>Use of this process has not yet been implemented in high level code.  See
021     * HL7 Standard Chapter 4 for details.</p>
022     * @author Michael K. Martin
023     * @version 1.0
024     */
025    
026    public class ORCSegment extends HL7Segment {
027       private String sNm = "ORC";
028       private String sRl =
029                   "DT ID[EI][EI][EI][ID][ID][TQ][CM][TS][XCN][XCN][XCN][PL]" +
030                   "[XTN][TS][CE][CE][CE][XCN][CE][XON][XAD][XTN][XAD][CWE]";
031    
032       public ORCSegment() {
033          setName( sNm );
034          setRule( sRl );
035       }
036    
037       public ORCSegment( HL7SegmentContainer msgParent ) {
038          super( msgParent );
039          setName( sNm );
040          setRule( sRl );
041       }
042    
043       /**
044        * Set the order control as new, cancel, replace or replacement.
045        * @param sControl String with NW new, CA cancel, RP replace,
046        *        or RO replacement order.  Note RO should follow RP.
047        *        This breaks my model of searching for the first loop.
048        */
049       public void setOrderControl( String sControl ) {
050          try {
051             setField( sControl, 1 );
052          }
053          catch( ArrayIndexOutOfBoundsException ae ) {
054             ae.printStackTrace();
055          }
056       }
057    
058       /**
059        * Get order control code.
060        * @return String with order control code
061        */
062       public String getOrderControl() {
063          HL7Element e = getField(1);
064          if( e != null )
065             return e.getValue();
066          else
067             return "";
068       }
069    
070    } // End class ORCSegment
071