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.message;
009
010 import ca.uhn.hl7v2.model.v24.group.*;
011 import ca.uhn.hl7v2.model.v24.segment.*;
012
013 import ca.uhn.log.HapiLogFactory;
014 import ca.uhn.hl7v2.HL7Exception;
015 import ca.uhn.hl7v2.parser.ModelClassFactory;
016 import ca.uhn.hl7v2.parser.DefaultModelClassFactory;
017 import ca.uhn.hl7v2.model.AbstractMessage;
018
019 /**
020 * <p>Represents a ADT_A17 message structure (see chapter 3). This structure contains the
021 * following elements: </p>
022 * <ul>
023 * <li>1: MSH (Message Header) <b> </b></li>
024 * <li>2: EVN (Event Type) <b> </b></li>
025 * <li>3: PID (Patient identification) <b> </b></li>
026 * <li>4: PD1 (patient additional demographic) <b>optional </b></li>
027 * <li>5: PV1 (Patient visit) <b> </b></li>
028 * <li>6: PV2 (Patient visit - additional information) <b>optional </b></li>
029 * <li>7: DB1 (Disability) <b>optional repeating</b></li>
030 * <li>8: OBX (Observation/Result) <b>optional repeating</b></li>
031 * <li>9: PID (Patient identification) <b> </b></li>
032 * <li>10: PD1 (patient additional demographic) <b>optional </b></li>
033 * <li>11: PV1 (Patient visit) <b> </b></li>
034 * <li>12: PV2 (Patient visit - additional information) <b>optional </b></li>
035 * <li>13: DB1 (Disability) <b>optional repeating</b></li>
036 * <li>14: OBX (Observation/Result) <b>optional repeating</b></li>
037 * </ul>
038 */
039 public class ADT_A17 extends AbstractMessage {
040
041 /**
042 * Creates a new ADT_A17 message with DefaultModelClassFactory.
043 */
044 public ADT_A17() {
045 this(new DefaultModelClassFactory());
046 }
047
048 /**
049 * Creates a new ADT_A17 message with custom ModelClassFactory.
050 */
051 public ADT_A17(ModelClassFactory factory) {
052 super(factory);
053 init(factory);
054 }
055
056 private void init(ModelClassFactory factory) {
057 try {
058 this.add(MSH.class, true, false);
059 this.add(EVN.class, true, false);
060 this.add(PID.class, true, false);
061 this.add(PD1.class, false, false);
062 this.add(PV1.class, true, false);
063 this.add(PV2.class, false, false);
064 this.add(DB1.class, false, true);
065 this.add(OBX.class, false, true);
066 this.add(PID.class, true, false);
067 this.add(PD1.class, false, false);
068 this.add(PV1.class, true, false);
069 this.add(PV2.class, false, false);
070 this.add(DB1.class, false, true);
071 this.add(OBX.class, false, true);
072 } catch(HL7Exception e) {
073 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error creating ADT_A17 - this is probably a bug in the source code generator.", e);
074 }
075 }
076
077 /**
078 * Returns "2.4"
079 */
080 public String getVersion() {
081 return "2.4";
082 }
083
084
085
086 /**
087 * Returns
088 * MSH (Message Header) - creates it if necessary
089 */
090 public MSH getMSH() {
091 MSH ret = null;
092 try {
093 ret = (MSH)this.get("MSH");
094 } catch(HL7Exception e) {
095 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
096 throw new RuntimeException(e);
097 }
098 return ret;
099 }
100
101
102
103
104 /**
105 * Returns
106 * EVN (Event Type) - creates it if necessary
107 */
108 public EVN getEVN() {
109 EVN ret = null;
110 try {
111 ret = (EVN)this.get("EVN");
112 } catch(HL7Exception e) {
113 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
114 throw new RuntimeException(e);
115 }
116 return ret;
117 }
118
119
120
121
122 /**
123 * Returns
124 * PID (Patient identification) - creates it if necessary
125 */
126 public PID getPID() {
127 PID ret = null;
128 try {
129 ret = (PID)this.get("PID");
130 } catch(HL7Exception e) {
131 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
132 throw new RuntimeException(e);
133 }
134 return ret;
135 }
136
137
138
139
140 /**
141 * Returns
142 * PD1 (patient additional demographic) - creates it if necessary
143 */
144 public PD1 getPD1() {
145 PD1 ret = null;
146 try {
147 ret = (PD1)this.get("PD1");
148 } catch(HL7Exception e) {
149 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
150 throw new RuntimeException(e);
151 }
152 return ret;
153 }
154
155
156
157
158 /**
159 * Returns
160 * PV1 (Patient visit) - creates it if necessary
161 */
162 public PV1 getPV1() {
163 PV1 ret = null;
164 try {
165 ret = (PV1)this.get("PV1");
166 } catch(HL7Exception e) {
167 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
168 throw new RuntimeException(e);
169 }
170 return ret;
171 }
172
173
174
175
176 /**
177 * Returns
178 * PV2 (Patient visit - additional information) - creates it if necessary
179 */
180 public PV2 getPV2() {
181 PV2 ret = null;
182 try {
183 ret = (PV2)this.get("PV2");
184 } catch(HL7Exception e) {
185 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
186 throw new RuntimeException(e);
187 }
188 return ret;
189 }
190
191
192
193
194 /**
195 * Returns
196 * the first repetition of
197 * DB1 (Disability) - creates it if necessary
198 */
199 public DB1 getDB1() {
200 DB1 ret = null;
201 try {
202 ret = (DB1)this.get("DB1");
203 } catch(HL7Exception e) {
204 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
205 throw new RuntimeException(e);
206 }
207 return ret;
208 }
209
210
211 /**
212 * Returns a specific repetition of
213 * DB1 (Disability) - creates it if necessary
214 *
215 * @param rep The repetition index (0-indexed, i.e. the first repetition is at index 0)
216 * @throws HL7Exception if the repetition requested is more than one
217 * greater than the number of existing repetitions.
218 */
219 public DB1 getDB1(int rep) {
220 DB1 ret = null;
221 try {
222 ret = (DB1)this.get("DB1", rep);
223 } catch(HL7Exception e) {
224 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
225 throw new RuntimeException(e);
226 }
227 return ret;
228 }
229
230 /**
231 * Returns the number of existing repetitions of DB1
232 */
233 public int getDB1Reps() {
234 int reps = -1;
235 try {
236 reps = this.getAll("DB1").length;
237 } catch (HL7Exception e) {
238 String message = "Unexpected error accessing data - this is probably a bug in the source code generator.";
239 HapiLogFactory.getHapiLog(this.getClass()).error(message, e);
240 throw new RuntimeException(message);
241 }
242 return reps;
243 }
244
245 /**
246 * Inserts a specific repetition of DB1 (Disability)
247 * @see AbstractGroup\#insertRepetition(Structure, int)
248 */
249 public void insertDB1(DB1 structure, int rep) throws HL7Exception {
250 super.insertRepetition( "DB1", structure, rep);
251 }
252
253
254 /**
255 * Inserts a specific repetition of DB1 (Disability)
256 * @see AbstractGroup\#insertRepetition(Structure, int)
257 */
258 public DB1 insertDB1(int rep) throws HL7Exception {
259 return (DB1)super.insertRepetition("DB1", rep);
260 }
261
262
263 /**
264 * Removes a specific repetition of DB1 (Disability)
265 * @see AbstractGroup\#removeRepetition(String, int)
266 */
267 public DB1 removeDB1(int rep) throws HL7Exception {
268 return (DB1)super.removeRepetition("DB1", rep);
269 }
270
271
272
273 /**
274 * Returns
275 * the first repetition of
276 * OBX (Observation/Result) - creates it if necessary
277 */
278 public OBX getOBX() {
279 OBX ret = null;
280 try {
281 ret = (OBX)this.get("OBX");
282 } catch(HL7Exception e) {
283 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
284 throw new RuntimeException(e);
285 }
286 return ret;
287 }
288
289
290 /**
291 * Returns a specific repetition of
292 * OBX (Observation/Result) - creates it if necessary
293 *
294 * @param rep The repetition index (0-indexed, i.e. the first repetition is at index 0)
295 * @throws HL7Exception if the repetition requested is more than one
296 * greater than the number of existing repetitions.
297 */
298 public OBX getOBX(int rep) {
299 OBX ret = null;
300 try {
301 ret = (OBX)this.get("OBX", rep);
302 } catch(HL7Exception e) {
303 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
304 throw new RuntimeException(e);
305 }
306 return ret;
307 }
308
309 /**
310 * Returns the number of existing repetitions of OBX
311 */
312 public int getOBXReps() {
313 int reps = -1;
314 try {
315 reps = this.getAll("OBX").length;
316 } catch (HL7Exception e) {
317 String message = "Unexpected error accessing data - this is probably a bug in the source code generator.";
318 HapiLogFactory.getHapiLog(this.getClass()).error(message, e);
319 throw new RuntimeException(message);
320 }
321 return reps;
322 }
323
324 /**
325 * Inserts a specific repetition of OBX (Observation/Result)
326 * @see AbstractGroup\#insertRepetition(Structure, int)
327 */
328 public void insertOBX(OBX structure, int rep) throws HL7Exception {
329 super.insertRepetition( "OBX", structure, rep);
330 }
331
332
333 /**
334 * Inserts a specific repetition of OBX (Observation/Result)
335 * @see AbstractGroup\#insertRepetition(Structure, int)
336 */
337 public OBX insertOBX(int rep) throws HL7Exception {
338 return (OBX)super.insertRepetition("OBX", rep);
339 }
340
341
342 /**
343 * Removes a specific repetition of OBX (Observation/Result)
344 * @see AbstractGroup\#removeRepetition(String, int)
345 */
346 public OBX removeOBX(int rep) throws HL7Exception {
347 return (OBX)super.removeRepetition("OBX", rep);
348 }
349
350
351
352 /**
353 * Returns
354 * PID2 (Patient identification) - creates it if necessary
355 */
356 public PID getPID2() {
357 PID ret = null;
358 try {
359 ret = (PID)this.get("PID2");
360 } catch(HL7Exception e) {
361 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
362 throw new RuntimeException(e);
363 }
364 return ret;
365 }
366
367
368
369
370 /**
371 * Returns
372 * PD12 (patient additional demographic) - creates it if necessary
373 */
374 public PD1 getPD12() {
375 PD1 ret = null;
376 try {
377 ret = (PD1)this.get("PD12");
378 } catch(HL7Exception e) {
379 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
380 throw new RuntimeException(e);
381 }
382 return ret;
383 }
384
385
386
387
388 /**
389 * Returns
390 * PV12 (Patient visit) - creates it if necessary
391 */
392 public PV1 getPV12() {
393 PV1 ret = null;
394 try {
395 ret = (PV1)this.get("PV12");
396 } catch(HL7Exception e) {
397 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
398 throw new RuntimeException(e);
399 }
400 return ret;
401 }
402
403
404
405
406 /**
407 * Returns
408 * PV22 (Patient visit - additional information) - creates it if necessary
409 */
410 public PV2 getPV22() {
411 PV2 ret = null;
412 try {
413 ret = (PV2)this.get("PV22");
414 } catch(HL7Exception e) {
415 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
416 throw new RuntimeException(e);
417 }
418 return ret;
419 }
420
421
422
423
424 /**
425 * Returns
426 * the first repetition of
427 * DB12 (Disability) - creates it if necessary
428 */
429 public DB1 getDB12() {
430 DB1 ret = null;
431 try {
432 ret = (DB1)this.get("DB12");
433 } catch(HL7Exception e) {
434 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
435 throw new RuntimeException(e);
436 }
437 return ret;
438 }
439
440
441 /**
442 * Returns a specific repetition of
443 * DB12 (Disability) - creates it if necessary
444 *
445 * @param rep The repetition index (0-indexed, i.e. the first repetition is at index 0)
446 * @throws HL7Exception if the repetition requested is more than one
447 * greater than the number of existing repetitions.
448 */
449 public DB1 getDB12(int rep) {
450 DB1 ret = null;
451 try {
452 ret = (DB1)this.get("DB12", rep);
453 } catch(HL7Exception e) {
454 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
455 throw new RuntimeException(e);
456 }
457 return ret;
458 }
459
460 /**
461 * Returns the number of existing repetitions of DB12
462 */
463 public int getDB12Reps() {
464 int reps = -1;
465 try {
466 reps = this.getAll("DB12").length;
467 } catch (HL7Exception e) {
468 String message = "Unexpected error accessing data - this is probably a bug in the source code generator.";
469 HapiLogFactory.getHapiLog(this.getClass()).error(message, e);
470 throw new RuntimeException(message);
471 }
472 return reps;
473 }
474
475 /**
476 * Inserts a specific repetition of DB12 (Disability)
477 * @see AbstractGroup\#insertRepetition(Structure, int)
478 */
479 public void insertDB12(DB1 structure, int rep) throws HL7Exception {
480 super.insertRepetition( "DB12", structure, rep);
481 }
482
483
484 /**
485 * Inserts a specific repetition of DB12 (Disability)
486 * @see AbstractGroup\#insertRepetition(Structure, int)
487 */
488 public DB1 insertDB12(int rep) throws HL7Exception {
489 return (DB1)super.insertRepetition("DB12", rep);
490 }
491
492
493 /**
494 * Removes a specific repetition of DB12 (Disability)
495 * @see AbstractGroup\#removeRepetition(String, int)
496 */
497 public DB1 removeDB12(int rep) throws HL7Exception {
498 return (DB1)super.removeRepetition("DB12", rep);
499 }
500
501
502
503 /**
504 * Returns
505 * the first repetition of
506 * OBX2 (Observation/Result) - creates it if necessary
507 */
508 public OBX getOBX2() {
509 OBX ret = null;
510 try {
511 ret = (OBX)this.get("OBX2");
512 } catch(HL7Exception e) {
513 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
514 throw new RuntimeException(e);
515 }
516 return ret;
517 }
518
519
520 /**
521 * Returns a specific repetition of
522 * OBX2 (Observation/Result) - creates it if necessary
523 *
524 * @param rep The repetition index (0-indexed, i.e. the first repetition is at index 0)
525 * @throws HL7Exception if the repetition requested is more than one
526 * greater than the number of existing repetitions.
527 */
528 public OBX getOBX2(int rep) {
529 OBX ret = null;
530 try {
531 ret = (OBX)this.get("OBX2", rep);
532 } catch(HL7Exception e) {
533 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
534 throw new RuntimeException(e);
535 }
536 return ret;
537 }
538
539 /**
540 * Returns the number of existing repetitions of OBX2
541 */
542 public int getOBX2Reps() {
543 int reps = -1;
544 try {
545 reps = this.getAll("OBX2").length;
546 } catch (HL7Exception e) {
547 String message = "Unexpected error accessing data - this is probably a bug in the source code generator.";
548 HapiLogFactory.getHapiLog(this.getClass()).error(message, e);
549 throw new RuntimeException(message);
550 }
551 return reps;
552 }
553
554 /**
555 * Inserts a specific repetition of OBX2 (Observation/Result)
556 * @see AbstractGroup\#insertRepetition(Structure, int)
557 */
558 public void insertOBX2(OBX structure, int rep) throws HL7Exception {
559 super.insertRepetition( "OBX2", structure, rep);
560 }
561
562
563 /**
564 * Inserts a specific repetition of OBX2 (Observation/Result)
565 * @see AbstractGroup\#insertRepetition(Structure, int)
566 */
567 public OBX insertOBX2(int rep) throws HL7Exception {
568 return (OBX)super.insertRepetition("OBX2", rep);
569 }
570
571
572 /**
573 * Removes a specific repetition of OBX2 (Observation/Result)
574 * @see AbstractGroup\#removeRepetition(String, int)
575 */
576 public OBX removeOBX2(int rep) throws HL7Exception {
577 return (OBX)super.removeRepetition("OBX2", rep);
578 }
579
580
581
582 }
583