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 RSP_Z82_VISIT 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: AL1 (Patient allergy information) <b> repeating</b></li>
028 * <li>2: RSP_Z82_PATIENT_VISIT (a Group object) <b>optional </b></li>
029 * </ul>
030 */
031 public class RSP_Z82_VISIT extends AbstractGroup {
032
033 /**
034 * Creates a new RSP_Z82_VISIT group
035 */
036 public RSP_Z82_VISIT(Group parent, ModelClassFactory factory) {
037 super(parent, factory);
038 init(factory);
039 }
040
041 private void init(ModelClassFactory factory) {
042 try {
043 this.add(AL1.class, true, true);
044 this.add(RSP_Z82_PATIENT_VISIT.class, false, false);
045 } catch(HL7Exception e) {
046 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error creating RSP_Z82_VISIT - this is probably a bug in the source code generator.", e);
047 }
048 }
049
050 /**
051 * Returns "2.4"
052 */
053 public String getVersion() {
054 return "2.4";
055 }
056
057
058
059 /**
060 * Returns
061 * the first repetition of
062 * AL1 (Patient allergy information) - creates it if necessary
063 */
064 public AL1 getAL1() {
065 AL1 ret = null;
066 try {
067 ret = (AL1)this.get("AL1");
068 } catch(HL7Exception e) {
069 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
070 throw new RuntimeException(e);
071 }
072 return ret;
073 }
074
075
076 /**
077 * Returns a specific repetition of
078 * AL1 (Patient allergy information) - creates it if necessary
079 *
080 * @param rep The repetition index (0-indexed, i.e. the first repetition is at index 0)
081 * @throws HL7Exception if the repetition requested is more than one
082 * greater than the number of existing repetitions.
083 */
084 public AL1 getAL1(int rep) {
085 AL1 ret = null;
086 try {
087 ret = (AL1)this.get("AL1", rep);
088 } catch(HL7Exception e) {
089 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
090 throw new RuntimeException(e);
091 }
092 return ret;
093 }
094
095 /**
096 * Returns the number of existing repetitions of AL1
097 */
098 public int getAL1Reps() {
099 int reps = -1;
100 try {
101 reps = this.getAll("AL1").length;
102 } catch (HL7Exception e) {
103 String message = "Unexpected error accessing data - this is probably a bug in the source code generator.";
104 HapiLogFactory.getHapiLog(this.getClass()).error(message, e);
105 throw new RuntimeException(message);
106 }
107 return reps;
108 }
109
110 /**
111 * Inserts a specific repetition of AL1 (Patient allergy information)
112 * @see AbstractGroup#insertRepetition(Structure, int)
113 */
114 public void insertAL1(AL1 structure, int rep) throws HL7Exception {
115 super.insertRepetition("AL1", structure, rep);
116 }
117
118
119 /**
120 * Inserts a specific repetition of AL1 (Patient allergy information)
121 * @see AbstractGroup#insertRepetition(Structure, int)
122 */
123 public AL1 insertAL1(int rep) throws HL7Exception {
124 return (AL1)super.insertRepetition("AL1", rep);
125 }
126
127
128 /**
129 * Removes a specific repetition of AL1 (Patient allergy information)
130 * @see AbstractGroup#removeRepetition(String, int)
131 */
132 public AL1 removeAL1(int rep) throws HL7Exception {
133 return (AL1)super.removeRepetition("AL1", rep);
134 }
135
136
137
138 /**
139 * Returns
140 * PATIENT_VISIT (a Group object) - creates it if necessary
141 */
142 public RSP_Z82_PATIENT_VISIT getPATIENT_VISIT() {
143 RSP_Z82_PATIENT_VISIT ret = null;
144 try {
145 ret = (RSP_Z82_PATIENT_VISIT)this.get("PATIENT_VISIT");
146 } catch(HL7Exception e) {
147 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
148 throw new RuntimeException(e);
149 }
150 return ret;
151 }
152
153
154
155
156 }
157