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 RQI_I01 message structure (see chapter 11). This structure contains the
021 * following elements: </p>
022 * <ul>
023 * <li>1: MSH (Message Header) <b> </b></li>
024 * <li>2: RQI_I01_PROVIDER (a Group object) <b> repeating</b></li>
025 * <li>3: PID (Patient identification) <b> </b></li>
026 * <li>4: NK1 (Next of kin / associated parties) <b>optional repeating</b></li>
027 * <li>5: RQI_I01_GUARANTOR_INSURANCE (a Group object) <b>optional </b></li>
028 * <li>6: NTE (Notes and Comments) <b>optional repeating</b></li>
029 * </ul>
030 */
031 public class RQI_I01 extends AbstractMessage {
032
033 /**
034 * Creates a new RQI_I01 message with DefaultModelClassFactory.
035 */
036 public RQI_I01() {
037 this(new DefaultModelClassFactory());
038 }
039
040 /**
041 * Creates a new RQI_I01 message with custom ModelClassFactory.
042 */
043 public RQI_I01(ModelClassFactory factory) {
044 super(factory);
045 init(factory);
046 }
047
048 private void init(ModelClassFactory factory) {
049 try {
050 this.add(MSH.class, true, false);
051 this.add(RQI_I01_PROVIDER.class, true, true);
052 this.add(PID.class, true, false);
053 this.add(NK1.class, false, true);
054 this.add(RQI_I01_GUARANTOR_INSURANCE.class, false, false);
055 this.add(NTE.class, false, true);
056 } catch(HL7Exception e) {
057 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error creating RQI_I01 - this is probably a bug in the source code generator.", e);
058 }
059 }
060
061 /**
062 * Returns "2.4"
063 */
064 public String getVersion() {
065 return "2.4";
066 }
067
068
069
070 /**
071 * Returns
072 * MSH (Message Header) - creates it if necessary
073 */
074 public MSH getMSH() {
075 MSH ret = null;
076 try {
077 ret = (MSH)this.get("MSH");
078 } catch(HL7Exception e) {
079 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
080 throw new RuntimeException(e);
081 }
082 return ret;
083 }
084
085
086
087
088 /**
089 * Returns
090 * the first repetition of
091 * PROVIDER (a Group object) - creates it if necessary
092 */
093 public RQI_I01_PROVIDER getPROVIDER() {
094 RQI_I01_PROVIDER ret = null;
095 try {
096 ret = (RQI_I01_PROVIDER)this.get("PROVIDER");
097 } catch(HL7Exception e) {
098 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
099 throw new RuntimeException(e);
100 }
101 return ret;
102 }
103
104
105 /**
106 * Returns a specific repetition of
107 * PROVIDER (a Group object) - creates it if necessary
108 *
109 * @param rep The repetition index (0-indexed, i.e. the first repetition is at index 0)
110 * @throws HL7Exception if the repetition requested is more than one
111 * greater than the number of existing repetitions.
112 */
113 public RQI_I01_PROVIDER getPROVIDER(int rep) {
114 RQI_I01_PROVIDER ret = null;
115 try {
116 ret = (RQI_I01_PROVIDER)this.get("PROVIDER", rep);
117 } catch(HL7Exception e) {
118 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
119 throw new RuntimeException(e);
120 }
121 return ret;
122 }
123
124 /**
125 * Returns the number of existing repetitions of PROVIDER
126 */
127 public int getPROVIDERReps() {
128 int reps = -1;
129 try {
130 reps = this.getAll("PROVIDER").length;
131 } catch (HL7Exception e) {
132 String message = "Unexpected error accessing data - this is probably a bug in the source code generator.";
133 HapiLogFactory.getHapiLog(this.getClass()).error(message, e);
134 throw new RuntimeException(message);
135 }
136 return reps;
137 }
138
139 /**
140 * Inserts a specific repetition of PROVIDER (a Group object)
141 * @see AbstractGroup\#insertRepetition(Structure, int)
142 */
143 public void insertPROVIDER(RQI_I01_PROVIDER structure, int rep) throws HL7Exception {
144 super.insertRepetition( "PROVIDER", structure, rep);
145 }
146
147
148 /**
149 * Inserts a specific repetition of PROVIDER (a Group object)
150 * @see AbstractGroup\#insertRepetition(Structure, int)
151 */
152 public RQI_I01_PROVIDER insertPROVIDER(int rep) throws HL7Exception {
153 return (RQI_I01_PROVIDER)super.insertRepetition("PROVIDER", rep);
154 }
155
156
157 /**
158 * Removes a specific repetition of PROVIDER (a Group object)
159 * @see AbstractGroup\#removeRepetition(String, int)
160 */
161 public RQI_I01_PROVIDER removePROVIDER(int rep) throws HL7Exception {
162 return (RQI_I01_PROVIDER)super.removeRepetition("PROVIDER", rep);
163 }
164
165
166
167 /**
168 * Returns
169 * PID (Patient identification) - creates it if necessary
170 */
171 public PID getPID() {
172 PID ret = null;
173 try {
174 ret = (PID)this.get("PID");
175 } catch(HL7Exception e) {
176 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
177 throw new RuntimeException(e);
178 }
179 return ret;
180 }
181
182
183
184
185 /**
186 * Returns
187 * the first repetition of
188 * NK1 (Next of kin / associated parties) - creates it if necessary
189 */
190 public NK1 getNK1() {
191 NK1 ret = null;
192 try {
193 ret = (NK1)this.get("NK1");
194 } catch(HL7Exception e) {
195 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
196 throw new RuntimeException(e);
197 }
198 return ret;
199 }
200
201
202 /**
203 * Returns a specific repetition of
204 * NK1 (Next of kin / associated parties) - creates it if necessary
205 *
206 * @param rep The repetition index (0-indexed, i.e. the first repetition is at index 0)
207 * @throws HL7Exception if the repetition requested is more than one
208 * greater than the number of existing repetitions.
209 */
210 public NK1 getNK1(int rep) {
211 NK1 ret = null;
212 try {
213 ret = (NK1)this.get("NK1", rep);
214 } catch(HL7Exception e) {
215 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
216 throw new RuntimeException(e);
217 }
218 return ret;
219 }
220
221 /**
222 * Returns the number of existing repetitions of NK1
223 */
224 public int getNK1Reps() {
225 int reps = -1;
226 try {
227 reps = this.getAll("NK1").length;
228 } catch (HL7Exception e) {
229 String message = "Unexpected error accessing data - this is probably a bug in the source code generator.";
230 HapiLogFactory.getHapiLog(this.getClass()).error(message, e);
231 throw new RuntimeException(message);
232 }
233 return reps;
234 }
235
236 /**
237 * Inserts a specific repetition of NK1 (Next of kin / associated parties)
238 * @see AbstractGroup\#insertRepetition(Structure, int)
239 */
240 public void insertNK1(NK1 structure, int rep) throws HL7Exception {
241 super.insertRepetition( "NK1", structure, rep);
242 }
243
244
245 /**
246 * Inserts a specific repetition of NK1 (Next of kin / associated parties)
247 * @see AbstractGroup\#insertRepetition(Structure, int)
248 */
249 public NK1 insertNK1(int rep) throws HL7Exception {
250 return (NK1)super.insertRepetition("NK1", rep);
251 }
252
253
254 /**
255 * Removes a specific repetition of NK1 (Next of kin / associated parties)
256 * @see AbstractGroup\#removeRepetition(String, int)
257 */
258 public NK1 removeNK1(int rep) throws HL7Exception {
259 return (NK1)super.removeRepetition("NK1", rep);
260 }
261
262
263
264 /**
265 * Returns
266 * GUARANTOR_INSURANCE (a Group object) - creates it if necessary
267 */
268 public RQI_I01_GUARANTOR_INSURANCE getGUARANTOR_INSURANCE() {
269 RQI_I01_GUARANTOR_INSURANCE ret = null;
270 try {
271 ret = (RQI_I01_GUARANTOR_INSURANCE)this.get("GUARANTOR_INSURANCE");
272 } catch(HL7Exception e) {
273 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
274 throw new RuntimeException(e);
275 }
276 return ret;
277 }
278
279
280
281
282 /**
283 * Returns
284 * the first repetition of
285 * NTE (Notes and Comments) - creates it if necessary
286 */
287 public NTE getNTE() {
288 NTE ret = null;
289 try {
290 ret = (NTE)this.get("NTE");
291 } catch(HL7Exception e) {
292 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
293 throw new RuntimeException(e);
294 }
295 return ret;
296 }
297
298
299 /**
300 * Returns a specific repetition of
301 * NTE (Notes and Comments) - creates it if necessary
302 *
303 * @param rep The repetition index (0-indexed, i.e. the first repetition is at index 0)
304 * @throws HL7Exception if the repetition requested is more than one
305 * greater than the number of existing repetitions.
306 */
307 public NTE getNTE(int rep) {
308 NTE ret = null;
309 try {
310 ret = (NTE)this.get("NTE", rep);
311 } catch(HL7Exception e) {
312 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
313 throw new RuntimeException(e);
314 }
315 return ret;
316 }
317
318 /**
319 * Returns the number of existing repetitions of NTE
320 */
321 public int getNTEReps() {
322 int reps = -1;
323 try {
324 reps = this.getAll("NTE").length;
325 } catch (HL7Exception e) {
326 String message = "Unexpected error accessing data - this is probably a bug in the source code generator.";
327 HapiLogFactory.getHapiLog(this.getClass()).error(message, e);
328 throw new RuntimeException(message);
329 }
330 return reps;
331 }
332
333 /**
334 * Inserts a specific repetition of NTE (Notes and Comments)
335 * @see AbstractGroup\#insertRepetition(Structure, int)
336 */
337 public void insertNTE(NTE structure, int rep) throws HL7Exception {
338 super.insertRepetition( "NTE", structure, rep);
339 }
340
341
342 /**
343 * Inserts a specific repetition of NTE (Notes and Comments)
344 * @see AbstractGroup\#insertRepetition(Structure, int)
345 */
346 public NTE insertNTE(int rep) throws HL7Exception {
347 return (NTE)super.insertRepetition("NTE", rep);
348 }
349
350
351 /**
352 * Removes a specific repetition of NTE (Notes and Comments)
353 * @see AbstractGroup\#removeRepetition(String, int)
354 */
355 public NTE removeNTE(int rep) throws HL7Exception {
356 return (NTE)super.removeRepetition("NTE", rep);
357 }
358
359
360
361 }
362