001    package org.vmdb.hl7;
002    
003    /**
004     * <p><Title:> Person Location (PL) Element. </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 method names follow the convention established by other Element type
009     * classes.  Names follow the HL7 documentation.</p>
010     * <p>See the HL7 documentation for an explanation of each component.</p>
011     * @author Michael K. Martin
012     * @version 1.0
013     */
014    
015    /*
016    <point of care (IS)> ^ <room (IS)> ^ <bed (IS)> ^ <facility (HD)> ^ < location
017    status (IS )> ^ <person location type (IS)> ^ <building (IS )> ^ <floor (IS)> ^ <location
018    description (ST)>
019    */
020    
021    public class PLElement extends HL7Element {
022       private String sNm = "PL";
023       private String sRl = "[IS][IS][IS][HD][IS][IS][IS][IS][ST]";
024    
025       /**
026        * Construct a Person Location Element using the default name and type constants.
027        * @param iLevel One of the constants for specifying level as FIELD, COMPONENT, or
028        * SUBCOMPONENT.  Default FIELD.
029        */
030       public PLElement( int iLevel ) {
031          super( iLevel );
032          setName( sNm );
033          setRule( sRl );
034          setType( "PL" );
035       }
036    
037       /**
038        * Construct a Person Location Element using the default name and type constants
039        * at the default level FIELD.
040        */
041       public PLElement() {
042          super( FIELD );
043          setName( sNm );
044          setRule( sRl );
045          setType( "PL" );
046       }
047    
048       public void setPointOfCare( String sPointOfCare ) {
049          HL7Element e = new SimpleElement( iLevel + 1 );
050          e.setType( "IS" );
051          e.setName( "PL.1" );
052          e.setValue( sPointOfCare );
053          try {
054             setComponent( e, 1 );
055          } catch( MalformedFieldException mfe ) {
056             mfe.printStackTrace();
057          }
058       }
059    
060       public String getPointOfCare() {
061          HL7Element e = getComponent( 1 );
062          if( e != null )
063             return e.toString();
064          else
065             return "";
066       }
067    
068       public void setRoom( String sRoom ) {
069          HL7Element e = new SimpleElement( iLevel + 1 );
070          e.setType( "IS" );
071          e.setName( "PL.2" );
072          e.setValue( sRoom );
073          try {
074             setComponent( e, 2 );
075          } catch( MalformedFieldException mfe ) {
076             mfe.printStackTrace();
077          }
078       }
079    
080       public String getRoom() {
081          HL7Element e = getComponent( 2 );
082          if( e != null )
083             return e.toString();
084          else
085             return "";
086       }
087    
088       public void setBed( String sBed ) {
089          HL7Element e = new SimpleElement( iLevel + 1 );
090          e.setType( "IS" );
091          e.setName( "PL.3" );
092          e.setValue( sBed );
093          try {
094             setComponent( e, 3 );
095          } catch( MalformedFieldException mfe ) {
096             mfe.printStackTrace();
097          }
098       }
099    
100       public String getBed() {
101          HL7Element e = getComponent( 3 );
102          if( e != null )
103             return e.toString();
104          else
105             return "";
106       }
107    
108       public void setFacility( String sNamespaceId,
109                                String sUniversalId,
110                                String sIdType ) {
111          HDElement e = new HDElement( iLevel + 1 );
112          e.setNamespaceId( sNamespaceId );
113          e.setUniversalId( sUniversalId );
114          e.setUniversalIdType( sIdType );
115          e.setName( "PL.4" );
116          try {
117             setComponent( e, 4 );
118          } catch( MalformedFieldException mfe ) {
119             mfe.printStackTrace();
120          }
121       }
122    
123       public void setFacility( HDElement hdE ) {
124          hdE.setName( "PL.4" );
125          try {
126             setComponent( hdE, 4 );
127          } catch( MalformedFieldException mfe ) {
128             mfe.printStackTrace();
129          }
130       }
131    
132       public HDElement getFacility() {
133          return (HDElement)getComponent( 4 );
134       }
135    
136       public void setLocationStatus( String sLocationStatus ) {
137          HL7Element e = new SimpleElement( iLevel + 1 );
138          e.setType( "IS" );
139          e.setName( "PL.5" );
140          e.setValue( sLocationStatus );
141          try {
142             setComponent( e, 5 );
143          } catch( MalformedFieldException mfe ) {
144             mfe.printStackTrace();
145          }
146       }
147    
148       public String getLocationStatus() {
149          HL7Element e = getComponent( 5 );
150          if( e != null )
151             return e.toString();
152          else
153             return "";
154       }
155    
156       public void setPersonLocationType( String sPersonLocationType ) {
157          HL7Element e = new SimpleElement( iLevel + 1 );
158          e.setType( "IS" );
159          e.setName( "PL.6" );
160          e.setValue( sPersonLocationType );
161          try {
162             setComponent( e, 6 );
163          } catch( MalformedFieldException mfe ) {
164             mfe.printStackTrace();
165          }
166       }
167    
168       public String getPersonLocationType() {
169          HL7Element e = getComponent( 6 );
170          if( e != null )
171             return e.toString();
172          else
173             return "";
174       }
175    
176       public void setBuilding( String sBuilding ) {
177          HL7Element e = new SimpleElement( iLevel + 1 );
178          e.setType( "IS" );
179          e.setName( "PL.7" );
180          e.setValue( sBuilding );
181          try {
182             setComponent( e, 7 );
183          } catch( MalformedFieldException mfe ) {
184             mfe.printStackTrace();
185          }
186       }
187    
188       public String getBuilding() {
189          HL7Element e = getComponent( 7 );
190          if( e != null )
191             return e.toString();
192          else
193             return "";
194       }
195    
196       public void setFloor( String sFloor ) {
197          HL7Element e = new SimpleElement( iLevel + 1 );
198          e.setType( "IS" );
199          e.setName( "PL.8" );
200          e.setValue( sFloor );
201          try {
202             setComponent( e, 8 );
203          } catch( MalformedFieldException mfe ) {
204             mfe.printStackTrace();
205          }
206       }
207    
208       public String getFloor() {
209          HL7Element e = getComponent( 8 );
210          if( e != null )
211             return e.toString();
212          else
213             return "";
214       }
215    
216       public void setLocationDescription( String sLocationDescription ) {
217          HL7Element e = new SimpleElement( iLevel + 1 );
218          e.setType( "IS" );
219          e.setName( "PL.9" );
220          e.setValue( sLocationDescription );
221          try {
222             setComponent( e, 9 );
223          } catch( MalformedFieldException mfe ) {
224             mfe.printStackTrace();
225          }
226       }
227    
228       public String getLocationDescription() {
229          HL7Element e = getComponent( 9 );
230          if( e != null )
231             return e.toString();
232          else
233             return "";
234       }
235    
236    } // End class PLElement
237