001 /*
002 * This class is an auto-generated source file for a HAPI
003 * HL7 v2.x standard structure class.
004 *
005 * For more information, visit: http://hl7api.sourceforge.net/
006 */
007
008 package ca.uhn.hl7v2.model.v24.group;
009
010 import ca.uhn.hl7v2.model.v24.segment.*;
011
012 import ca.uhn.log.HapiLogFactory;
013 import ca.uhn.hl7v2.HL7Exception;
014 import ca.uhn.hl7v2.parser.ModelClassFactory;
015 import ca.uhn.hl7v2.parser.DefaultModelClassFactory;
016 import ca.uhn.hl7v2.model.AbstractMessage;
017 import ca.uhn.hl7v2.model.Group;
018 import ca.uhn.hl7v2.model.AbstractGroup;
019 import ca.uhn.hl7v2.model.GenericSegment;
020
021 /**
022 * <p>Represents a OMG_O19_PATIENT group structure (a Group object).
023 * A Group is an ordered collection of message segments that can repeat together or be optionally in/excluded together.
024 * This Group contains the following elements:
025 * </p>
026 * <ul>
027 * <li>1: PID (Patient identification) <b> </b></li>
028 * <li>2: PD1 (patient additional demographic) <b>optional </b></li>
029 * <li>3: NTE (Notes and Comments) <b>optional repeating</b></li>
030 * <li>4: OMG_O19_PATIENT_VISIT (a Group object) <b>optional </b></li>
031 * <li>5: OMG_O19_INSURANCE (a Group object) <b>optional repeating</b></li>
032 * <li>6: GT1 (Guarantor) <b>optional </b></li>
033 * <li>7: AL1 (Patient allergy information) <b>optional repeating</b></li>
034 * </ul>
035 */
036 public class OMG_O19_PATIENT extends AbstractGroup {
037
038 /**
039 * Creates a new OMG_O19_PATIENT group
040 */
041 public OMG_O19_PATIENT(Group parent, ModelClassFactory factory) {
042 super(parent, factory);
043 init(factory);
044 }
045
046 private void init(ModelClassFactory factory) {
047 try {
048 this.add(PID.class, true, false);
049 this.add(PD1.class, false, false);
050 this.add(NTE.class, false, true);
051 this.add(OMG_O19_PATIENT_VISIT.class, false, false);
052 this.add(OMG_O19_INSURANCE.class, false, true);
053 this.add(GT1.class, false, false);
054 this.add(AL1.class, false, true);
055 } catch(HL7Exception e) {
056 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error creating OMG_O19_PATIENT - this is probably a bug in the source code generator.", e);
057 }
058 }
059
060 /**
061 * Returns "2.4"
062 */
063 public String getVersion() {
064 return "2.4";
065 }
066
067
068
069 /**
070 * Returns
071 * PID (Patient identification) - creates it if necessary
072 */
073 public PID getPID() {
074 PID ret = null;
075 try {
076 ret = (PID)this.get("PID");
077 } catch(HL7Exception e) {
078 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
079 throw new RuntimeException(e);
080 }
081 return ret;
082 }
083
084
085
086
087 /**
088 * Returns
089 * PD1 (patient additional demographic) - creates it if necessary
090 */
091 public PD1 getPD1() {
092 PD1 ret = null;
093 try {
094 ret = (PD1)this.get("PD1");
095 } catch(HL7Exception e) {
096 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
097 throw new RuntimeException(e);
098 }
099 return ret;
100 }
101
102
103
104
105 /**
106 * Returns
107 * the first repetition of
108 * NTE (Notes and Comments) - creates it if necessary
109 */
110 public NTE getNTE() {
111 NTE ret = null;
112 try {
113 ret = (NTE)this.get("NTE");
114 } catch(HL7Exception e) {
115 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
116 throw new RuntimeException(e);
117 }
118 return ret;
119 }
120
121
122 /**
123 * Returns a specific repetition of
124 * NTE (Notes and Comments) - creates it if necessary
125 *
126 * @param rep The repetition index (0-indexed, i.e. the first repetition is at index 0)
127 * @throws HL7Exception if the repetition requested is more than one
128 * greater than the number of existing repetitions.
129 */
130 public NTE getNTE(int rep) {
131 NTE ret = null;
132 try {
133 ret = (NTE)this.get("NTE", rep);
134 } catch(HL7Exception e) {
135 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
136 throw new RuntimeException(e);
137 }
138 return ret;
139 }
140
141 /**
142 * Returns the number of existing repetitions of NTE
143 */
144 public int getNTEReps() {
145 int reps = -1;
146 try {
147 reps = this.getAll("NTE").length;
148 } catch (HL7Exception e) {
149 String message = "Unexpected error accessing data - this is probably a bug in the source code generator.";
150 HapiLogFactory.getHapiLog(this.getClass()).error(message, e);
151 throw new RuntimeException(message);
152 }
153 return reps;
154 }
155
156 /**
157 * Inserts a specific repetition of NTE (Notes and Comments)
158 * @see AbstractGroup#insertRepetition(Structure, int)
159 */
160 public void insertNTE(NTE structure, int rep) throws HL7Exception {
161 super.insertRepetition("NTE", structure, rep);
162 }
163
164
165 /**
166 * Inserts a specific repetition of NTE (Notes and Comments)
167 * @see AbstractGroup#insertRepetition(Structure, int)
168 */
169 public NTE insertNTE(int rep) throws HL7Exception {
170 return (NTE)super.insertRepetition("NTE", rep);
171 }
172
173
174 /**
175 * Removes a specific repetition of NTE (Notes and Comments)
176 * @see AbstractGroup#removeRepetition(String, int)
177 */
178 public NTE removeNTE(int rep) throws HL7Exception {
179 return (NTE)super.removeRepetition("NTE", rep);
180 }
181
182
183
184 /**
185 * Returns
186 * PATIENT_VISIT (a Group object) - creates it if necessary
187 */
188 public OMG_O19_PATIENT_VISIT getPATIENT_VISIT() {
189 OMG_O19_PATIENT_VISIT ret = null;
190 try {
191 ret = (OMG_O19_PATIENT_VISIT)this.get("PATIENT_VISIT");
192 } catch(HL7Exception e) {
193 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
194 throw new RuntimeException(e);
195 }
196 return ret;
197 }
198
199
200
201
202 /**
203 * Returns
204 * the first repetition of
205 * INSURANCE (a Group object) - creates it if necessary
206 */
207 public OMG_O19_INSURANCE getINSURANCE() {
208 OMG_O19_INSURANCE ret = null;
209 try {
210 ret = (OMG_O19_INSURANCE)this.get("INSURANCE");
211 } catch(HL7Exception e) {
212 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
213 throw new RuntimeException(e);
214 }
215 return ret;
216 }
217
218
219 /**
220 * Returns a specific repetition of
221 * INSURANCE (a Group object) - creates it if necessary
222 *
223 * @param rep The repetition index (0-indexed, i.e. the first repetition is at index 0)
224 * @throws HL7Exception if the repetition requested is more than one
225 * greater than the number of existing repetitions.
226 */
227 public OMG_O19_INSURANCE getINSURANCE(int rep) {
228 OMG_O19_INSURANCE ret = null;
229 try {
230 ret = (OMG_O19_INSURANCE)this.get("INSURANCE", rep);
231 } catch(HL7Exception e) {
232 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
233 throw new RuntimeException(e);
234 }
235 return ret;
236 }
237
238 /**
239 * Returns the number of existing repetitions of INSURANCE
240 */
241 public int getINSURANCEReps() {
242 int reps = -1;
243 try {
244 reps = this.getAll("INSURANCE").length;
245 } catch (HL7Exception e) {
246 String message = "Unexpected error accessing data - this is probably a bug in the source code generator.";
247 HapiLogFactory.getHapiLog(this.getClass()).error(message, e);
248 throw new RuntimeException(message);
249 }
250 return reps;
251 }
252
253 /**
254 * Inserts a specific repetition of INSURANCE (a Group object)
255 * @see AbstractGroup#insertRepetition(Structure, int)
256 */
257 public void insertINSURANCE(OMG_O19_INSURANCE structure, int rep) throws HL7Exception {
258 super.insertRepetition("INSURANCE", structure, rep);
259 }
260
261
262 /**
263 * Inserts a specific repetition of INSURANCE (a Group object)
264 * @see AbstractGroup#insertRepetition(Structure, int)
265 */
266 public OMG_O19_INSURANCE insertINSURANCE(int rep) throws HL7Exception {
267 return (OMG_O19_INSURANCE)super.insertRepetition("INSURANCE", rep);
268 }
269
270
271 /**
272 * Removes a specific repetition of INSURANCE (a Group object)
273 * @see AbstractGroup#removeRepetition(String, int)
274 */
275 public OMG_O19_INSURANCE removeINSURANCE(int rep) throws HL7Exception {
276 return (OMG_O19_INSURANCE)super.removeRepetition("INSURANCE", rep);
277 }
278
279
280
281 /**
282 * Returns
283 * GT1 (Guarantor) - creates it if necessary
284 */
285 public GT1 getGT1() {
286 GT1 ret = null;
287 try {
288 ret = (GT1)this.get("GT1");
289 } catch(HL7Exception e) {
290 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
291 throw new RuntimeException(e);
292 }
293 return ret;
294 }
295
296
297
298
299 /**
300 * Returns
301 * the first repetition of
302 * AL1 (Patient allergy information) - creates it if necessary
303 */
304 public AL1 getAL1() {
305 AL1 ret = null;
306 try {
307 ret = (AL1)this.get("AL1");
308 } catch(HL7Exception e) {
309 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
310 throw new RuntimeException(e);
311 }
312 return ret;
313 }
314
315
316 /**
317 * Returns a specific repetition of
318 * AL1 (Patient allergy information) - creates it if necessary
319 *
320 * @param rep The repetition index (0-indexed, i.e. the first repetition is at index 0)
321 * @throws HL7Exception if the repetition requested is more than one
322 * greater than the number of existing repetitions.
323 */
324 public AL1 getAL1(int rep) {
325 AL1 ret = null;
326 try {
327 ret = (AL1)this.get("AL1", rep);
328 } catch(HL7Exception e) {
329 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
330 throw new RuntimeException(e);
331 }
332 return ret;
333 }
334
335 /**
336 * Returns the number of existing repetitions of AL1
337 */
338 public int getAL1Reps() {
339 int reps = -1;
340 try {
341 reps = this.getAll("AL1").length;
342 } catch (HL7Exception e) {
343 String message = "Unexpected error accessing data - this is probably a bug in the source code generator.";
344 HapiLogFactory.getHapiLog(this.getClass()).error(message, e);
345 throw new RuntimeException(message);
346 }
347 return reps;
348 }
349
350 /**
351 * Inserts a specific repetition of AL1 (Patient allergy information)
352 * @see AbstractGroup#insertRepetition(Structure, int)
353 */
354 public void insertAL1(AL1 structure, int rep) throws HL7Exception {
355 super.insertRepetition("AL1", structure, rep);
356 }
357
358
359 /**
360 * Inserts a specific repetition of AL1 (Patient allergy information)
361 * @see AbstractGroup#insertRepetition(Structure, int)
362 */
363 public AL1 insertAL1(int rep) throws HL7Exception {
364 return (AL1)super.insertRepetition("AL1", rep);
365 }
366
367
368 /**
369 * Removes a specific repetition of AL1 (Patient allergy information)
370 * @see AbstractGroup#removeRepetition(String, int)
371 */
372 public AL1 removeAL1(int rep) throws HL7Exception {
373 return (AL1)super.removeRepetition("AL1", rep);
374 }
375
376
377
378 }
379