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 * The contents of this file are subject to the Mozilla Public License Version 1.1 008 * (the "License"); you may not use this file except in compliance with the License. 009 * You may obtain a copy of the License at http://www.mozilla.org/MPL/ 010 * Software distributed under the License is distributed on an "AS IS" basis, 011 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the 012 * specific language governing rights and limitations under the License. 013 * 014 * The Original Code is "[file_name]". Description: 015 * "[one_line_description]" 016 * 017 * The Initial Developer of the Original Code is University Health Network. Copyright (C) 018 * 2012. All Rights Reserved. 019 * 020 * Contributor(s): ______________________________________. 021 * 022 * Alternatively, the contents of this file may be used under the terms of the 023 * GNU General Public License (the "GPL"), in which case the provisions of the GPL are 024 * applicable instead of those above. If you wish to allow use of your version of this 025 * file only under the terms of the GPL and not to allow others to use your version 026 * of this file under the MPL, indicate your decision by deleting the provisions above 027 * and replace them with the notice and other provisions required by the GPL License. 028 * If you do not delete the provisions above, a recipient may use your version of 029 * this file under either the MPL or the GPL. 030 * 031 */ 032 033 034package ca.uhn.hl7v2.model.v231.segment; 035 036// import ca.uhn.hl7v2.model.v231.group.*; 037import ca.uhn.hl7v2.model.v231.datatype.*; 038import ca.uhn.hl7v2.HL7Exception; 039import ca.uhn.hl7v2.parser.ModelClassFactory; 040import ca.uhn.hl7v2.parser.DefaultModelClassFactory; 041import ca.uhn.hl7v2.model.AbstractMessage; 042import ca.uhn.hl7v2.model.Group; 043import ca.uhn.hl7v2.model.Type; 044import ca.uhn.hl7v2.model.AbstractSegment; 045import ca.uhn.hl7v2.model.Varies; 046 047/** 048 *<p>Represents an HL7 OM3 message segment (OM3 - categorical test/observation segment). 049 * This segment has the following fields:</p> 050 * <ul> 051 * <li>OM3-1: Sequence Number - Test/Observation Master File (NM) <b>optional </b> 052 * <li>OM3-2: Preferred Coding System (CE) <b>optional </b> 053 * <li>OM3-3: Valid Coded “Answers” (CE) <b>optional </b> 054 * <li>OM3-4: Normal Text/Codes for Categorical Observations (CE) <b>optional repeating</b> 055 * <li>OM3-5: Abnormal Text/Codes for Categorical Observations (CE) <b>optional </b> 056 * <li>OM3-6: Critical Text Codes for Categorical Observations (CE) <b>optional </b> 057 * <li>OM3-7: Value Type (ID) <b>optional </b> 058 * </ul> 059 */ 060@SuppressWarnings("unused") 061public class OM3 extends AbstractSegment { 062 063 /** 064 * Creates a new OM3 segment 065 */ 066 public OM3(Group parent, ModelClassFactory factory) { 067 super(parent, factory); 068 init(factory); 069 } 070 071 private void init(ModelClassFactory factory) { 072 try { 073 this.add(NM.class, false, 1, 4, new Object[]{ getMessage() }, "Sequence Number - Test/Observation Master File"); 074 this.add(CE.class, false, 1, 60, new Object[]{ getMessage() }, "Preferred Coding System"); 075 this.add(CE.class, false, 1, 60, new Object[]{ getMessage() }, "Valid Coded “Answers”"); 076 this.add(CE.class, false, 0, 200, new Object[]{ getMessage() }, "Normal Text/Codes for Categorical Observations"); 077 this.add(CE.class, false, 1, 200, new Object[]{ getMessage() }, "Abnormal Text/Codes for Categorical Observations"); 078 this.add(CE.class, false, 1, 200, new Object[]{ getMessage() }, "Critical Text Codes for Categorical Observations"); 079 this.add(ID.class, false, 1, 3, new Object[]{ getMessage(), new Integer(125) }, "Value Type"); 080 } catch(HL7Exception e) { 081 log.error("Unexpected error creating OM3 - this is probably a bug in the source code generator.", e); 082 } 083 } 084 085 086 087 /** 088 * Returns 089 * OM3-1: "Sequence Number - Test/Observation Master File" - creates it if necessary 090 */ 091 public NM getSequenceNumberTestObservationMasterFile() { 092 NM retVal = this.getTypedField(1, 0); 093 return retVal; 094 } 095 096 /** 097 * Returns 098 * OM3-1: "Sequence Number - Test/Observation Master File" - creates it if necessary 099 */ 100 public NM getOm31_SequenceNumberTestObservationMasterFile() { 101 NM retVal = this.getTypedField(1, 0); 102 return retVal; 103 } 104 105 106 107 /** 108 * Returns 109 * OM3-2: "Preferred Coding System" - creates it if necessary 110 */ 111 public CE getPreferredCodingSystem() { 112 CE retVal = this.getTypedField(2, 0); 113 return retVal; 114 } 115 116 /** 117 * Returns 118 * OM3-2: "Preferred Coding System" - creates it if necessary 119 */ 120 public CE getOm32_PreferredCodingSystem() { 121 CE retVal = this.getTypedField(2, 0); 122 return retVal; 123 } 124 125 126 127 /** 128 * Returns 129 * OM3-3: "Valid Coded “Answers”" - creates it if necessary 130 */ 131 public CE getValidCodedAnswers() { 132 CE retVal = this.getTypedField(3, 0); 133 return retVal; 134 } 135 136 /** 137 * Returns 138 * OM3-3: "Valid Coded “Answers”" - creates it if necessary 139 */ 140 public CE getOm33_ValidCodedAnswers() { 141 CE retVal = this.getTypedField(3, 0); 142 return retVal; 143 } 144 145 146 /** 147 * Returns all repetitions of Normal Text/Codes for Categorical Observations (OM3-4). 148 */ 149 public CE[] getNormalTextCodesForCategoricalObservations() { 150 CE[] retVal = this.getTypedField(4, new CE[0]); 151 return retVal; 152 } 153 154 155 /** 156 * Returns all repetitions of Normal Text/Codes for Categorical Observations (OM3-4). 157 */ 158 public CE[] getOm34_NormalTextCodesForCategoricalObservations() { 159 CE[] retVal = this.getTypedField(4, new CE[0]); 160 return retVal; 161 } 162 163 164 /** 165 * Returns a count of the current number of repetitions of Normal Text/Codes for Categorical Observations (OM3-4). 166 * This method does not create a repetition, so if no repetitions have currently been defined or accessed, 167 * it will return zero. 168 */ 169 public int getNormalTextCodesForCategoricalObservationsReps() { 170 return this.getReps(4); 171 } 172 173 174 /** 175 * Returns a specific repetition of 176 * OM3-4: "Normal Text/Codes for Categorical Observations" - creates it if necessary 177 * 178 * @param rep The repetition index (0-indexed) 179 */ 180 public CE getNormalTextCodesForCategoricalObservations(int rep) { 181 CE retVal = this.getTypedField(4, rep); 182 return retVal; 183 } 184 185 /** 186 * Returns a specific repetition of 187 * OM3-4: "Normal Text/Codes for Categorical Observations" - creates it if necessary 188 * 189 * @param rep The repetition index (0-indexed) 190 */ 191 public CE getOm34_NormalTextCodesForCategoricalObservations(int rep) { 192 CE retVal = this.getTypedField(4, rep); 193 return retVal; 194 } 195 196 /** 197 * Returns a count of the current number of repetitions of Normal Text/Codes for Categorical Observations (OM3-4). 198 * This method does not create a repetition, so if no repetitions have currently been defined or accessed, 199 * it will return zero. 200 */ 201 public int getOm34_NormalTextCodesForCategoricalObservationsReps() { 202 return this.getReps(4); 203 } 204 205 206 /** 207 * Inserts a repetition of 208 * OM3-4: "Normal Text/Codes for Categorical Observations" at a specific index 209 * 210 * @param rep The repetition index (0-indexed) 211 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) 212 */ 213 public CE insertNormalTextCodesForCategoricalObservations(int rep) throws HL7Exception { 214 return (CE) super.insertRepetition(4, rep); 215 } 216 217 218 /** 219 * Inserts a repetition of 220 * OM3-4: "Normal Text/Codes for Categorical Observations" at a specific index 221 * 222 * @param rep The repetition index (0-indexed) 223 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) 224 */ 225 public CE insertOm34_NormalTextCodesForCategoricalObservations(int rep) throws HL7Exception { 226 return (CE) super.insertRepetition(4, rep); 227 } 228 229 230 /** 231 * Removes a repetition of 232 * OM3-4: "Normal Text/Codes for Categorical Observations" at a specific index 233 * 234 * @param rep The repetition index (0-indexed) 235 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) 236 */ 237 public CE removeNormalTextCodesForCategoricalObservations(int rep) throws HL7Exception { 238 return (CE) super.removeRepetition(4, rep); 239 } 240 241 242 /** 243 * Removes a repetition of 244 * OM3-4: "Normal Text/Codes for Categorical Observations" at a specific index 245 * 246 * @param rep The repetition index (0-indexed) 247 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) 248 */ 249 public CE removeOm34_NormalTextCodesForCategoricalObservations(int rep) throws HL7Exception { 250 return (CE) super.removeRepetition(4, rep); 251 } 252 253 254 255 256 /** 257 * Returns 258 * OM3-5: "Abnormal Text/Codes for Categorical Observations" - creates it if necessary 259 */ 260 public CE getAbnormalTextCodesForCategoricalObservations() { 261 CE retVal = this.getTypedField(5, 0); 262 return retVal; 263 } 264 265 /** 266 * Returns 267 * OM3-5: "Abnormal Text/Codes for Categorical Observations" - creates it if necessary 268 */ 269 public CE getOm35_AbnormalTextCodesForCategoricalObservations() { 270 CE retVal = this.getTypedField(5, 0); 271 return retVal; 272 } 273 274 275 276 /** 277 * Returns 278 * OM3-6: "Critical Text Codes for Categorical Observations" - creates it if necessary 279 */ 280 public CE getCriticalTextCodesForCategoricalObservations() { 281 CE retVal = this.getTypedField(6, 0); 282 return retVal; 283 } 284 285 /** 286 * Returns 287 * OM3-6: "Critical Text Codes for Categorical Observations" - creates it if necessary 288 */ 289 public CE getOm36_CriticalTextCodesForCategoricalObservations() { 290 CE retVal = this.getTypedField(6, 0); 291 return retVal; 292 } 293 294 295 296 /** 297 * Returns 298 * OM3-7: "Value Type" - creates it if necessary 299 */ 300 public ID getValueType() { 301 ID retVal = this.getTypedField(7, 0); 302 return retVal; 303 } 304 305 /** 306 * Returns 307 * OM3-7: "Value Type" - creates it if necessary 308 */ 309 public ID getOm37_ValueType() { 310 ID retVal = this.getTypedField(7, 0); 311 return retVal; 312 } 313 314 315 316 317 318 /** {@inheritDoc} */ 319 protected Type createNewTypeWithoutReflection(int field) { 320 switch (field) { 321 case 0: return new NM(getMessage()); 322 case 1: return new CE(getMessage()); 323 case 2: return new CE(getMessage()); 324 case 3: return new CE(getMessage()); 325 case 4: return new CE(getMessage()); 326 case 5: return new CE(getMessage()); 327 case 6: return new ID(getMessage(), new Integer( 125 )); 328 default: return null; 329 } 330 } 331 332 333} 334