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_Z88_QUERY_RESPONSE 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: RSP_Z88_ALLERGY (a Group object) <b>optional </b></li>
031 * <li>5: RSP_Z88_COMMON_ORDER (a Group object) <b> repeating</b></li>
032 * </ul>
033 */
034 public class RSP_Z88_QUERY_RESPONSE extends AbstractGroup {
035
036 /**
037 * Creates a new RSP_Z88_QUERY_RESPONSE group
038 */
039 public RSP_Z88_QUERY_RESPONSE(Group parent, ModelClassFactory factory) {
040 super(parent, factory);
041 init(factory);
042 }
043
044 private void init(ModelClassFactory factory) {
045 try {
046 this.add(PID.class, true, false);
047 this.add(PD1.class, false, false);
048 this.add(NTE.class, false, true);
049 this.add(RSP_Z88_ALLERGY.class, false, false);
050 this.add(RSP_Z88_COMMON_ORDER.class, true, true);
051 } catch(HL7Exception e) {
052 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error creating RSP_Z88_QUERY_RESPONSE - this is probably a bug in the source code generator.", e);
053 }
054 }
055
056 /**
057 * Returns "2.4"
058 */
059 public String getVersion() {
060 return "2.4";
061 }
062
063
064
065 /**
066 * Returns
067 * PID (Patient identification) - creates it if necessary
068 */
069 public PID getPID() {
070 PID ret = null;
071 try {
072 ret = (PID)this.get("PID");
073 } catch(HL7Exception e) {
074 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
075 throw new RuntimeException(e);
076 }
077 return ret;
078 }
079
080
081
082
083 /**
084 * Returns
085 * PD1 (patient additional demographic) - creates it if necessary
086 */
087 public PD1 getPD1() {
088 PD1 ret = null;
089 try {
090 ret = (PD1)this.get("PD1");
091 } catch(HL7Exception e) {
092 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
093 throw new RuntimeException(e);
094 }
095 return ret;
096 }
097
098
099
100
101 /**
102 * Returns
103 * the first repetition of
104 * NTE (Notes and Comments) - creates it if necessary
105 */
106 public NTE getNTE() {
107 NTE ret = null;
108 try {
109 ret = (NTE)this.get("NTE");
110 } catch(HL7Exception e) {
111 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
112 throw new RuntimeException(e);
113 }
114 return ret;
115 }
116
117
118 /**
119 * Returns a specific repetition of
120 * NTE (Notes and Comments) - creates it if necessary
121 *
122 * @param rep The repetition index (0-indexed, i.e. the first repetition is at index 0)
123 * @throws HL7Exception if the repetition requested is more than one
124 * greater than the number of existing repetitions.
125 */
126 public NTE getNTE(int rep) {
127 NTE ret = null;
128 try {
129 ret = (NTE)this.get("NTE", rep);
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 * Returns the number of existing repetitions of NTE
139 */
140 public int getNTEReps() {
141 int reps = -1;
142 try {
143 reps = this.getAll("NTE").length;
144 } catch (HL7Exception e) {
145 String message = "Unexpected error accessing data - this is probably a bug in the source code generator.";
146 HapiLogFactory.getHapiLog(this.getClass()).error(message, e);
147 throw new RuntimeException(message);
148 }
149 return reps;
150 }
151
152 /**
153 * Inserts a specific repetition of NTE (Notes and Comments)
154 * @see AbstractGroup#insertRepetition(Structure, int)
155 */
156 public void insertNTE(NTE structure, int rep) throws HL7Exception {
157 super.insertRepetition("NTE", structure, rep);
158 }
159
160
161 /**
162 * Inserts a specific repetition of NTE (Notes and Comments)
163 * @see AbstractGroup#insertRepetition(Structure, int)
164 */
165 public NTE insertNTE(int rep) throws HL7Exception {
166 return (NTE)super.insertRepetition("NTE", rep);
167 }
168
169
170 /**
171 * Removes a specific repetition of NTE (Notes and Comments)
172 * @see AbstractGroup#removeRepetition(String, int)
173 */
174 public NTE removeNTE(int rep) throws HL7Exception {
175 return (NTE)super.removeRepetition("NTE", rep);
176 }
177
178
179
180 /**
181 * Returns
182 * ALLERGY (a Group object) - creates it if necessary
183 */
184 public RSP_Z88_ALLERGY getALLERGY() {
185 RSP_Z88_ALLERGY ret = null;
186 try {
187 ret = (RSP_Z88_ALLERGY)this.get("ALLERGY");
188 } catch(HL7Exception e) {
189 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
190 throw new RuntimeException(e);
191 }
192 return ret;
193 }
194
195
196
197
198 /**
199 * Returns
200 * the first repetition of
201 * COMMON_ORDER (a Group object) - creates it if necessary
202 */
203 public RSP_Z88_COMMON_ORDER getCOMMON_ORDER() {
204 RSP_Z88_COMMON_ORDER ret = null;
205 try {
206 ret = (RSP_Z88_COMMON_ORDER)this.get("COMMON_ORDER");
207 } catch(HL7Exception e) {
208 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
209 throw new RuntimeException(e);
210 }
211 return ret;
212 }
213
214
215 /**
216 * Returns a specific repetition of
217 * COMMON_ORDER (a Group object) - creates it if necessary
218 *
219 * @param rep The repetition index (0-indexed, i.e. the first repetition is at index 0)
220 * @throws HL7Exception if the repetition requested is more than one
221 * greater than the number of existing repetitions.
222 */
223 public RSP_Z88_COMMON_ORDER getCOMMON_ORDER(int rep) {
224 RSP_Z88_COMMON_ORDER ret = null;
225 try {
226 ret = (RSP_Z88_COMMON_ORDER)this.get("COMMON_ORDER", rep);
227 } catch(HL7Exception e) {
228 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
229 throw new RuntimeException(e);
230 }
231 return ret;
232 }
233
234 /**
235 * Returns the number of existing repetitions of COMMON_ORDER
236 */
237 public int getCOMMON_ORDERReps() {
238 int reps = -1;
239 try {
240 reps = this.getAll("COMMON_ORDER").length;
241 } catch (HL7Exception e) {
242 String message = "Unexpected error accessing data - this is probably a bug in the source code generator.";
243 HapiLogFactory.getHapiLog(this.getClass()).error(message, e);
244 throw new RuntimeException(message);
245 }
246 return reps;
247 }
248
249 /**
250 * Inserts a specific repetition of COMMON_ORDER (a Group object)
251 * @see AbstractGroup#insertRepetition(Structure, int)
252 */
253 public void insertCOMMON_ORDER(RSP_Z88_COMMON_ORDER structure, int rep) throws HL7Exception {
254 super.insertRepetition("COMMON_ORDER", structure, rep);
255 }
256
257
258 /**
259 * Inserts a specific repetition of COMMON_ORDER (a Group object)
260 * @see AbstractGroup#insertRepetition(Structure, int)
261 */
262 public RSP_Z88_COMMON_ORDER insertCOMMON_ORDER(int rep) throws HL7Exception {
263 return (RSP_Z88_COMMON_ORDER)super.insertRepetition("COMMON_ORDER", rep);
264 }
265
266
267 /**
268 * Removes a specific repetition of COMMON_ORDER (a Group object)
269 * @see AbstractGroup#removeRepetition(String, int)
270 */
271 public RSP_Z88_COMMON_ORDER removeCOMMON_ORDER(int rep) throws HL7Exception {
272 return (RSP_Z88_COMMON_ORDER)super.removeRepetition("COMMON_ORDER", rep);
273 }
274
275
276
277 }
278