View Javadoc
1   /*
2    * This class is an auto-generated source file for a HAPI
3    * HL7 v2.x standard structure class.
4    *
5    * For more information, visit: http://hl7api.sourceforge.net/
6    * 
7    * The contents of this file are subject to the Mozilla Public License Version 1.1 
8    * (the "License"); you may not use this file except in compliance with the License. 
9    * You may obtain a copy of the License at http://www.mozilla.org/MPL/ 
10   * Software distributed under the License is distributed on an "AS IS" basis, 
11   * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the 
12   * specific language governing rights and limitations under the License. 
13   * 
14   * The Original Code is "[file_name]".  Description: 
15   * "[one_line_description]" 
16   * 
17   * The Initial Developer of the Original Code is University Health Network. Copyright (C) 
18   * 2012.  All Rights Reserved. 
19   * 
20   * Contributor(s): ______________________________________. 
21   * 
22   * Alternatively, the contents of this file may be used under the terms of the 
23   * GNU General Public License (the  "GPL"), in which case the provisions of the GPL are 
24   * applicable instead of those above.  If you wish to allow use of your version of this 
25   * file only under the terms of the GPL and not to allow others to use your version 
26   * of this file under the MPL, indicate your decision by deleting  the provisions above 
27   * and replace  them with the notice and other provisions required by the GPL License.  
28   * If you do not delete the provisions above, a recipient may use your version of 
29   * this file under either the MPL or the GPL. 
30   * 
31   */
32  
33  
34  package ca.uhn.hl7v2.model.v22.segment;
35  
36  // import ca.uhn.hl7v2.model.v22.group.*;
37  import ca.uhn.hl7v2.model.v22.datatype.*;
38  import ca.uhn.hl7v2.HL7Exception;
39  import ca.uhn.hl7v2.parser.ModelClassFactory;
40  import ca.uhn.hl7v2.parser.DefaultModelClassFactory;
41  import ca.uhn.hl7v2.model.AbstractMessage;
42  import ca.uhn.hl7v2.model.Group;
43  import ca.uhn.hl7v2.model.Type;
44  import ca.uhn.hl7v2.model.AbstractSegment;
45  import ca.uhn.hl7v2.model.Varies;
46  
47  
48  /**
49   *<p>Represents an HL7 PV2 message segment (PATIENT VISIT - additional information). 
50   * This segment has the following fields:</p>
51   * <ul>
52       * <li>PV2-1: Prior Pending Location (CM_INTERNAL_LOCATION) <b>optional </b>
53       * <li>PV2-2: Accommodation Code (CE) <b>optional </b>
54       * <li>PV2-3: Admit Reason (CE) <b>optional </b>
55       * <li>PV2-4: Transfer Reason (CE) <b>optional </b>
56       * <li>PV2-5: Patient Valuables (ST) <b>optional repeating</b>
57       * <li>PV2-6: Patient Valuables Location (ST) <b>optional </b>
58       * <li>PV2-7: Visit User Code (ID) <b>optional </b>
59       * <li>PV2-8: Expected Admit Date (DT) <b>optional </b>
60       * <li>PV2-9: Expected Discharge Date (DT) <b>optional </b>
61   * </ul>
62   */
63  @SuppressWarnings("unused")
64  public class PV2 extends AbstractSegment {
65  
66      /** 
67       * Creates a new PV2 segment
68       */
69      public PV2(Group parent, ModelClassFactory factory) {
70         super(parent, factory);
71         init(factory);
72      }
73  
74      private void init(ModelClassFactory factory) {
75         try {
76                                    this.add(CM_INTERNAL_LOCATION.class, false, 1, 12, new Object[]{ getMessage() }, "Prior Pending Location");
77                                    this.add(CE.class, false, 1, 60, new Object[]{ getMessage() }, "Accommodation Code");
78                                    this.add(CE.class, false, 1, 60, new Object[]{ getMessage() }, "Admit Reason");
79                                    this.add(CE.class, false, 1, 60, new Object[]{ getMessage() }, "Transfer Reason");
80                                    this.add(ST.class, false, 0, 25, new Object[]{ getMessage() }, "Patient Valuables");
81                                    this.add(ST.class, false, 1, 25, new Object[]{ getMessage() }, "Patient Valuables Location");
82                                                this.add(ID.class, false, 1, 2, new Object[]{ getMessage(), new Integer(130) }, "Visit User Code");
83                                    this.add(DT.class, false, 1, 8, new Object[]{ getMessage() }, "Expected Admit Date");
84                                    this.add(DT.class, false, 1, 8, new Object[]{ getMessage() }, "Expected Discharge Date");
85         } catch(HL7Exception e) {
86            log.error("Unexpected error creating PV2 - this is probably a bug in the source code generator.", e);
87         }
88      }
89  
90  
91  
92      /**
93       * Returns
94       * PV2-1: "Prior Pending Location" - creates it if necessary
95       */
96      public CM_INTERNAL_LOCATION getPriorPendingLocation() { 
97  		CM_INTERNAL_LOCATION retVal = this.getTypedField(1, 0);
98  		return retVal;
99      }
100     
101     /**
102      * Returns
103      * PV2-1: "Prior Pending Location" - creates it if necessary
104      */
105     public CM_INTERNAL_LOCATION getPv21_PriorPendingLocation() { 
106 		CM_INTERNAL_LOCATION retVal = this.getTypedField(1, 0);
107 		return retVal;
108     }
109 
110 
111 
112     /**
113      * Returns
114      * PV2-2: "Accommodation Code" - creates it if necessary
115      */
116     public CE getAccommodationCode() { 
117 		CE retVal = this.getTypedField(2, 0);
118 		return retVal;
119     }
120     
121     /**
122      * Returns
123      * PV2-2: "Accommodation Code" - creates it if necessary
124      */
125     public CE getPv22_AccommodationCode() { 
126 		CE retVal = this.getTypedField(2, 0);
127 		return retVal;
128     }
129 
130 
131 
132     /**
133      * Returns
134      * PV2-3: "Admit Reason" - creates it if necessary
135      */
136     public CE getAdmitReason() { 
137 		CE retVal = this.getTypedField(3, 0);
138 		return retVal;
139     }
140     
141     /**
142      * Returns
143      * PV2-3: "Admit Reason" - creates it if necessary
144      */
145     public CE getPv23_AdmitReason() { 
146 		CE retVal = this.getTypedField(3, 0);
147 		return retVal;
148     }
149 
150 
151 
152     /**
153      * Returns
154      * PV2-4: "Transfer Reason" - creates it if necessary
155      */
156     public CE getTransferReason() { 
157 		CE retVal = this.getTypedField(4, 0);
158 		return retVal;
159     }
160     
161     /**
162      * Returns
163      * PV2-4: "Transfer Reason" - creates it if necessary
164      */
165     public CE getPv24_TransferReason() { 
166 		CE retVal = this.getTypedField(4, 0);
167 		return retVal;
168     }
169 
170 
171     /**
172      * Returns all repetitions of Patient Valuables (PV2-5).
173      */
174     public ST[] getPatientValuables() {
175     	ST[] retVal = this.getTypedField(5, new ST[0]);
176     	return retVal;
177     }
178 
179 
180     /**
181      * Returns all repetitions of Patient Valuables (PV2-5).
182      */
183     public ST[] getPv25_PatientValuables() {
184     	ST[] retVal = this.getTypedField(5, new ST[0]);
185     	return retVal;
186     }
187 
188 
189     /**
190      * Returns a count of the current number of repetitions of Patient Valuables (PV2-5).
191      * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
192      * it will return zero.
193      */
194     public int getPatientValuablesReps() {
195     	return this.getReps(5);
196     }
197 
198 
199     /**
200      * Returns a specific repetition of
201      * PV2-5: "Patient Valuables" - creates it if necessary
202      *
203      * @param rep The repetition index (0-indexed)
204      */
205     public ST getPatientValuables(int rep) { 
206 		ST retVal = this.getTypedField(5, rep);
207 		return retVal;
208     }
209 
210     /**
211      * Returns a specific repetition of
212      * PV2-5: "Patient Valuables" - creates it if necessary
213      *
214      * @param rep The repetition index (0-indexed)
215      */
216     public ST getPv25_PatientValuables(int rep) { 
217 		ST retVal = this.getTypedField(5, rep);
218 		return retVal;
219     }
220 
221     /**
222      * Returns a count of the current number of repetitions of Patient Valuables (PV2-5).
223      * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
224      * it will return zero.
225      */
226     public int getPv25_PatientValuablesReps() {
227     	return this.getReps(5);
228     }
229 
230 
231     /**
232      * Inserts a repetition of
233      * PV2-5: "Patient Valuables" at a specific index
234      *
235      * @param rep The repetition index (0-indexed)
236      * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
237      */
238     public ST insertPatientValuables(int rep) throws HL7Exception { 
239         return (ST) super.insertRepetition(5, rep);
240     }
241 
242 
243     /**
244      * Inserts a repetition of
245      * PV2-5: "Patient Valuables" at a specific index
246      *
247      * @param rep The repetition index (0-indexed)
248      * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
249      */
250     public ST insertPv25_PatientValuables(int rep) throws HL7Exception { 
251         return (ST) super.insertRepetition(5, rep);
252     }
253 
254 
255     /**
256      * Removes a repetition of
257      * PV2-5: "Patient Valuables" at a specific index
258      *
259      * @param rep The repetition index (0-indexed)
260      * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
261      */
262     public ST removePatientValuables(int rep) throws HL7Exception { 
263         return (ST) super.removeRepetition(5, rep);
264     }
265 
266 
267     /**
268      * Removes a repetition of
269      * PV2-5: "Patient Valuables" at a specific index
270      *
271      * @param rep The repetition index (0-indexed)
272      * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
273      */
274     public ST removePv25_PatientValuables(int rep) throws HL7Exception { 
275         return (ST) super.removeRepetition(5, rep);
276     }
277 
278 
279 
280 
281     /**
282      * Returns
283      * PV2-6: "Patient Valuables Location" - creates it if necessary
284      */
285     public ST getPatientValuablesLocation() { 
286 		ST retVal = this.getTypedField(6, 0);
287 		return retVal;
288     }
289     
290     /**
291      * Returns
292      * PV2-6: "Patient Valuables Location" - creates it if necessary
293      */
294     public ST getPv26_PatientValuablesLocation() { 
295 		ST retVal = this.getTypedField(6, 0);
296 		return retVal;
297     }
298 
299 
300 
301     /**
302      * Returns
303      * PV2-7: "Visit User Code" - creates it if necessary
304      */
305     public ID getVisitUserCode() { 
306 		ID retVal = this.getTypedField(7, 0);
307 		return retVal;
308     }
309     
310     /**
311      * Returns
312      * PV2-7: "Visit User Code" - creates it if necessary
313      */
314     public ID getPv27_VisitUserCode() { 
315 		ID retVal = this.getTypedField(7, 0);
316 		return retVal;
317     }
318 
319 
320 
321     /**
322      * Returns
323      * PV2-8: "Expected Admit Date" - creates it if necessary
324      */
325     public DT getExpectedAdmitDate() { 
326 		DT retVal = this.getTypedField(8, 0);
327 		return retVal;
328     }
329     
330     /**
331      * Returns
332      * PV2-8: "Expected Admit Date" - creates it if necessary
333      */
334     public DT getPv28_ExpectedAdmitDate() { 
335 		DT retVal = this.getTypedField(8, 0);
336 		return retVal;
337     }
338 
339 
340 
341     /**
342      * Returns
343      * PV2-9: "Expected Discharge Date" - creates it if necessary
344      */
345     public DT getExpectedDischargeDate() { 
346 		DT retVal = this.getTypedField(9, 0);
347 		return retVal;
348     }
349     
350     /**
351      * Returns
352      * PV2-9: "Expected Discharge Date" - creates it if necessary
353      */
354     public DT getPv29_ExpectedDischargeDate() { 
355 		DT retVal = this.getTypedField(9, 0);
356 		return retVal;
357     }
358 
359 
360 
361 
362 
363     /** {@inheritDoc} */   
364     protected Type createNewTypeWithoutReflection(int field) {
365        switch (field) {
366           case 0: return new CM_INTERNAL_LOCATION(getMessage());
367           case 1: return new CE(getMessage());
368           case 2: return new CE(getMessage());
369           case 3: return new CE(getMessage());
370           case 4: return new ST(getMessage());
371           case 5: return new ST(getMessage());
372           case 6: return new ID(getMessage(), new Integer( 130 ));
373           case 7: return new DT(getMessage());
374           case 8: return new DT(getMessage());
375           default: return null;
376        }
377    }
378 
379 
380 }
381