All Downloads are FREE. Search and download functionalities are using the official Maven repository.

ca.uhn.hl7v2.model.v22.segment.NK1 Maven / Gradle / Ivy

There is a newer version: 2.3
Show newest version
/*
 * This class is an auto-generated source file for a HAPI
 * HL7 v2.x standard structure class.
 *
 * For more information, visit: http://hl7api.sourceforge.net/
 */

package ca.uhn.hl7v2.model.v22.segment;

// import ca.uhn.hl7v2.model.v22.group.*;
import ca.uhn.hl7v2.model.v22.datatype.*;
import ca.uhn.log.HapiLogFactory;
import ca.uhn.hl7v2.HL7Exception;
import ca.uhn.hl7v2.parser.ModelClassFactory;
import ca.uhn.hl7v2.parser.DefaultModelClassFactory;
import ca.uhn.hl7v2.model.AbstractMessage;
import ca.uhn.hl7v2.model.Group;
import ca.uhn.hl7v2.model.Type;
import ca.uhn.hl7v2.model.AbstractSegment;
import ca.uhn.hl7v2.model.Varies;

/**
 *

Represents an HL7 NK1 message segment (NEXT OF KIN). * This segment has the following fields:

*
    *
  • NK1-1: Set ID - Next of Kin (SI) *
  • NK1-2: NK Name (PN) optional *
  • NK1-3: Relationship (CE) optional *
  • NK1-4: Address (AD) optional *
  • NK1-5: Phone Number (TN) optional repeating *
  • NK1-6: Business Phone Number (TN) optional *
  • NK1-7: Contact Role (CE) optional *
  • NK1-8: Start Date (DT) optional *
  • NK1-9: End Date (DT) optional *
  • NK1-10: Next of Kin (ST) optional *
  • NK1-11: Next of kin job code / class (CM_JOB_CODE) optional *
  • NK1-12: Next of Kin Employee Number (ST) optional *
  • NK1-13: Organization Name (ST) optional *
*/ public class NK1 extends AbstractSegment { /** * Creates a new NK1 segment */ public NK1(Group parent, ModelClassFactory factory) { super(parent, factory); init(factory); } private void init(ModelClassFactory factory) { try { this.add(SI.class, true, 1, 4, new Object[]{ getMessage(), new Integer(0) }, "Set ID - Next of Kin"); this.add(PN.class, false, 1, 48, new Object[]{ getMessage(), new Integer(0) }, "NK Name"); this.add(CE.class, false, 1, 60, new Object[]{ getMessage(), new Integer(63) }, "Relationship"); this.add(AD.class, false, 1, 106, new Object[]{ getMessage(), new Integer(0) }, "Address"); this.add(TN.class, false, 3, 40, new Object[]{ getMessage(), new Integer(0) }, "Phone Number"); this.add(TN.class, false, 1, 40, new Object[]{ getMessage(), new Integer(0) }, "Business Phone Number"); this.add(CE.class, false, 1, 60, new Object[]{ getMessage(), new Integer(131) }, "Contact Role"); this.add(DT.class, false, 1, 8, new Object[]{ getMessage(), new Integer(0) }, "Start Date"); this.add(DT.class, false, 1, 8, new Object[]{ getMessage(), new Integer(0) }, "End Date"); this.add(ST.class, false, 1, 60, new Object[]{ getMessage(), new Integer(0) }, "Next of Kin"); this.add(CM_JOB_CODE.class, false, 1, 60, new Object[]{ getMessage(), new Integer(0) }, "Next of kin job code / class"); this.add(ST.class, false, 1, 20, new Object[]{ getMessage(), new Integer(0) }, "Next of Kin Employee Number"); this.add(ST.class, false, 1, 60, new Object[]{ getMessage(), new Integer(0) }, "Organization Name"); } catch(HL7Exception e) { HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error creating NK1 - this is probably a bug in the source code generator.", e); } } /** * Returns * NK1-1: "Set ID - Next of Kin" - creates it if necessary */ public SI getSetIDNextOfKin() { SI ret = null; try { Type t = this.getField(1, 0); ret = (SI)t; } catch (ClassCastException cce) { HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce); throw new RuntimeException(cce); } catch (HL7Exception he) { HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he); throw new RuntimeException(he); } return ret; } /** * Returns * NK1-1: "Set ID - Next of Kin" - creates it if necessary */ public SI getNk11_SetIDNextOfKin() { SI ret = null; try { Type t = this.getField(1, 0); ret = (SI)t; } catch (ClassCastException cce) { HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce); throw new RuntimeException(cce); } catch (HL7Exception he) { HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he); throw new RuntimeException(he); } return ret; } /** * Returns * NK1-2: "NK Name" - creates it if necessary */ public PN getNKName() { PN ret = null; try { Type t = this.getField(2, 0); ret = (PN)t; } catch (ClassCastException cce) { HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce); throw new RuntimeException(cce); } catch (HL7Exception he) { HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he); throw new RuntimeException(he); } return ret; } /** * Returns * NK1-2: "NK Name" - creates it if necessary */ public PN getNk12_NKName() { PN ret = null; try { Type t = this.getField(2, 0); ret = (PN)t; } catch (ClassCastException cce) { HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce); throw new RuntimeException(cce); } catch (HL7Exception he) { HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he); throw new RuntimeException(he); } return ret; } /** * Returns * NK1-3: "Relationship" - creates it if necessary */ public CE getRelationship() { CE ret = null; try { Type t = this.getField(3, 0); ret = (CE)t; } catch (ClassCastException cce) { HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce); throw new RuntimeException(cce); } catch (HL7Exception he) { HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he); throw new RuntimeException(he); } return ret; } /** * Returns * NK1-3: "Relationship" - creates it if necessary */ public CE getNk13_Relationship() { CE ret = null; try { Type t = this.getField(3, 0); ret = (CE)t; } catch (ClassCastException cce) { HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce); throw new RuntimeException(cce); } catch (HL7Exception he) { HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he); throw new RuntimeException(he); } return ret; } /** * Returns * NK1-4: "Address" - creates it if necessary */ public AD getAddress() { AD ret = null; try { Type t = this.getField(4, 0); ret = (AD)t; } catch (ClassCastException cce) { HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce); throw new RuntimeException(cce); } catch (HL7Exception he) { HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he); throw new RuntimeException(he); } return ret; } /** * Returns * NK1-4: "Address" - creates it if necessary */ public AD getNk14_Address() { AD ret = null; try { Type t = this.getField(4, 0); ret = (AD)t; } catch (ClassCastException cce) { HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce); throw new RuntimeException(cce); } catch (HL7Exception he) { HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he); throw new RuntimeException(he); } return ret; } /** * Returns all repetitions of Phone Number (NK1-5). */ public TN[] getPhoneNumber() { TN[] ret = null; try { Type[] t = this.getField(5); ret = new TN[t.length]; for (int i = 0; i < ret.length; i++) { ret[i] = (TN)t[i]; } } catch (ClassCastException cce) { HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce); throw new RuntimeException(cce); } catch (HL7Exception he) { HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he); throw new RuntimeException(he); } return ret; } /** * Returns a count of the current number of repetitions of Phone Number (NK1-5). * This method does not create a repetition, so if no repetitions have currently been defined or accessed, * it will return zero. */ public int getPhoneNumberReps() { TN[] ret = null; try { Type[] t = this.getField(5); return t.length; } catch (ClassCastException cce) { HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce); throw new RuntimeException(cce); } catch (HL7Exception he) { HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he); throw new RuntimeException(he); } } /** * Returns a specific repetition of * NK1-5: "Phone Number" - creates it if necessary * * @param rep The repetition index (0-indexed) */ public TN getPhoneNumber(int rep) { TN ret = null; try { Type t = this.getField(5, rep); ret = (TN)t; } catch (ClassCastException cce) { HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce); throw new RuntimeException(cce); } catch (HL7Exception he) { HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he); throw new RuntimeException(he); } return ret; } /** * Returns a specific repetition of * NK1-5: "Phone Number" - creates it if necessary * * @param rep The repetition index (0-indexed) */ public TN getNk15_PhoneNumber(int rep) { TN ret = null; try { Type t = this.getField(5, rep); ret = (TN)t; } catch (ClassCastException cce) { HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce); throw new RuntimeException(cce); } catch (HL7Exception he) { HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he); throw new RuntimeException(he); } return ret; } /** * Returns a count of the current number of repetitions of Phone Number (NK1-5). * This method does not create a repetition, so if no repetitions have currently been defined or accessed, * it will return zero. */ public int getNk15_PhoneNumberReps() { TN[] ret = null; try { Type[] t = this.getField(5); return t.length; } catch (ClassCastException cce) { HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce); throw new RuntimeException(cce); } catch (HL7Exception he) { HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he); throw new RuntimeException(he); } } /** * Inserts a repetition of * NK1-5: "Phone Number" at a specific index * * @param rep The repetition index (0-indexed) * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) */ public TN insertPhoneNumber(int rep) throws HL7Exception { return (TN) super.insertRepetition(5, rep); } /** * Inserts a repetition of * NK1-5: "Phone Number" at a specific index * * @param rep The repetition index (0-indexed) * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) */ public TN insertNk15_PhoneNumber(int rep) throws HL7Exception { return (TN) super.insertRepetition(5, rep); } /** * Removes a repetition of * NK1-5: "Phone Number" at a specific index * * @param rep The repetition index (0-indexed) * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) */ public TN removePhoneNumber(int rep) throws HL7Exception { return (TN) super.removeRepetition(5, rep); } /** * Removes a repetition of * NK1-5: "Phone Number" at a specific index * * @param rep The repetition index (0-indexed) * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) */ public TN removeNk15_PhoneNumber(int rep) throws HL7Exception { return (TN) super.removeRepetition(5, rep); } /** * Returns * NK1-6: "Business Phone Number" - creates it if necessary */ public TN getBusinessPhoneNumber() { TN ret = null; try { Type t = this.getField(6, 0); ret = (TN)t; } catch (ClassCastException cce) { HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce); throw new RuntimeException(cce); } catch (HL7Exception he) { HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he); throw new RuntimeException(he); } return ret; } /** * Returns * NK1-6: "Business Phone Number" - creates it if necessary */ public TN getNk16_BusinessPhoneNumber() { TN ret = null; try { Type t = this.getField(6, 0); ret = (TN)t; } catch (ClassCastException cce) { HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce); throw new RuntimeException(cce); } catch (HL7Exception he) { HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he); throw new RuntimeException(he); } return ret; } /** * Returns * NK1-7: "Contact Role" - creates it if necessary */ public CE getContactRole() { CE ret = null; try { Type t = this.getField(7, 0); ret = (CE)t; } catch (ClassCastException cce) { HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce); throw new RuntimeException(cce); } catch (HL7Exception he) { HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he); throw new RuntimeException(he); } return ret; } /** * Returns * NK1-7: "Contact Role" - creates it if necessary */ public CE getNk17_ContactRole() { CE ret = null; try { Type t = this.getField(7, 0); ret = (CE)t; } catch (ClassCastException cce) { HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce); throw new RuntimeException(cce); } catch (HL7Exception he) { HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he); throw new RuntimeException(he); } return ret; } /** * Returns * NK1-8: "Start Date" - creates it if necessary */ public DT getStartDate() { DT ret = null; try { Type t = this.getField(8, 0); ret = (DT)t; } catch (ClassCastException cce) { HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce); throw new RuntimeException(cce); } catch (HL7Exception he) { HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he); throw new RuntimeException(he); } return ret; } /** * Returns * NK1-8: "Start Date" - creates it if necessary */ public DT getNk18_StartDate() { DT ret = null; try { Type t = this.getField(8, 0); ret = (DT)t; } catch (ClassCastException cce) { HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce); throw new RuntimeException(cce); } catch (HL7Exception he) { HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he); throw new RuntimeException(he); } return ret; } /** * Returns * NK1-9: "End Date" - creates it if necessary */ public DT getEndDate() { DT ret = null; try { Type t = this.getField(9, 0); ret = (DT)t; } catch (ClassCastException cce) { HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce); throw new RuntimeException(cce); } catch (HL7Exception he) { HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he); throw new RuntimeException(he); } return ret; } /** * Returns * NK1-9: "End Date" - creates it if necessary */ public DT getNk19_EndDate() { DT ret = null; try { Type t = this.getField(9, 0); ret = (DT)t; } catch (ClassCastException cce) { HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce); throw new RuntimeException(cce); } catch (HL7Exception he) { HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he); throw new RuntimeException(he); } return ret; } /** * Returns * NK1-10: "Next of Kin" - creates it if necessary */ public ST getNextOfKin() { ST ret = null; try { Type t = this.getField(10, 0); ret = (ST)t; } catch (ClassCastException cce) { HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce); throw new RuntimeException(cce); } catch (HL7Exception he) { HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he); throw new RuntimeException(he); } return ret; } /** * Returns * NK1-10: "Next of Kin" - creates it if necessary */ public ST getNk110_NextOfKin() { ST ret = null; try { Type t = this.getField(10, 0); ret = (ST)t; } catch (ClassCastException cce) { HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce); throw new RuntimeException(cce); } catch (HL7Exception he) { HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he); throw new RuntimeException(he); } return ret; } /** * Returns * NK1-11: "Next of kin job code / class" - creates it if necessary */ public CM_JOB_CODE getNextOfKinJobCodeClass() { CM_JOB_CODE ret = null; try { Type t = this.getField(11, 0); ret = (CM_JOB_CODE)t; } catch (ClassCastException cce) { HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce); throw new RuntimeException(cce); } catch (HL7Exception he) { HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he); throw new RuntimeException(he); } return ret; } /** * Returns * NK1-11: "Next of kin job code / class" - creates it if necessary */ public CM_JOB_CODE getNk111_NextOfKinJobCodeClass() { CM_JOB_CODE ret = null; try { Type t = this.getField(11, 0); ret = (CM_JOB_CODE)t; } catch (ClassCastException cce) { HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce); throw new RuntimeException(cce); } catch (HL7Exception he) { HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he); throw new RuntimeException(he); } return ret; } /** * Returns * NK1-12: "Next of Kin Employee Number" - creates it if necessary */ public ST getNextOfKinEmployeeNumber() { ST ret = null; try { Type t = this.getField(12, 0); ret = (ST)t; } catch (ClassCastException cce) { HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce); throw new RuntimeException(cce); } catch (HL7Exception he) { HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he); throw new RuntimeException(he); } return ret; } /** * Returns * NK1-12: "Next of Kin Employee Number" - creates it if necessary */ public ST getNk112_NextOfKinEmployeeNumber() { ST ret = null; try { Type t = this.getField(12, 0); ret = (ST)t; } catch (ClassCastException cce) { HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce); throw new RuntimeException(cce); } catch (HL7Exception he) { HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he); throw new RuntimeException(he); } return ret; } /** * Returns * NK1-13: "Organization Name" - creates it if necessary */ public ST getOrganizationName() { ST ret = null; try { Type t = this.getField(13, 0); ret = (ST)t; } catch (ClassCastException cce) { HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce); throw new RuntimeException(cce); } catch (HL7Exception he) { HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he); throw new RuntimeException(he); } return ret; } /** * Returns * NK1-13: "Organization Name" - creates it if necessary */ public ST getNk113_OrganizationName() { ST ret = null; try { Type t = this.getField(13, 0); ret = (ST)t; } catch (ClassCastException cce) { HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", cce); throw new RuntimeException(cce); } catch (HL7Exception he) { HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value. This is a bug.", he); throw new RuntimeException(he); } return ret; } /** {@inheritDoc} */ protected Type createNewTypeWithoutReflection(int field) { switch (field) { case 0: return new SI(getMessage()); case 1: return new PN(getMessage()); case 2: return new CE(getMessage()); case 3: return new AD(getMessage()); case 4: return new TN(getMessage()); case 5: return new TN(getMessage()); case 6: return new CE(getMessage()); case 7: return new DT(getMessage()); case 8: return new DT(getMessage()); case 9: return new ST(getMessage()); case 10: return new CM_JOB_CODE(getMessage()); case 11: return new ST(getMessage()); case 12: return new ST(getMessage()); default: return null; } } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy