private void init() { data = new Type[2]; data[0] = new DTM(getMessage()); data[1] = new ID(getMessage(), 529); }
/** * Returns Degree of Precision (component 2). This is a convenience method that saves you from * casting and handling an exception. */ public ID getDegreeOfPrecision() { return getTyped(1, ID.class); }
if (dateOfBirth == null || dateOfBirth.getTime() == null || dateOfBirth.getTime().getValue() == null) { throw new HL7Exception("Missing birth date in an NK1 segment"); person.setBirthdate(HL7Util.parseHL7Timestamp(dateOfBirth.getTime().getValue())); ID precisionTemp = dateOfBirth.getDegreeOfPrecision(); if (precisionTemp != null && precisionTemp.getValue() != null) { String precision = precisionTemp.getValue().toUpperCase();
/** * Creates a new TS type */ public TS(Message message) { super(message); init(); }
private Date tsToDate(TS ts) throws HL7Exception { // need to handle timezone String dtm = ts.getTime().getValue(); int year = Integer.parseInt(dtm.substring(0, 4)); int month = (dtm.length() >= 6 ? Integer.parseInt(dtm.substring(4, 6)) - 1 : 0); int day = (dtm.length() >= 8 ? Integer.parseInt(dtm.substring(6, 8)) : 1); int hour = (dtm.length() >= 10 ? Integer.parseInt(dtm.substring(8, 10)) : 0); int min = (dtm.length() >= 12 ? Integer.parseInt(dtm.substring(10, 12)) : 0); int sec = (dtm.length() >= 14 ? Integer.parseInt(dtm.substring(12, 14)) : 0); Calendar cal = Calendar.getInstance(); cal.set(year, month, day, hour, min, sec); return cal.getTime(); }
if (dateOfBirth == null || dateOfBirth.getTime() == null || dateOfBirth.getTime().getValue() == null) { throw new HL7Exception("Missing birth date in the PID segment"); ID precisionTemp = dateOfBirth.getDegreeOfPrecision(); if (precisionTemp != null && precisionTemp.getValue() != null) { String precision = precisionTemp.getValue().toUpperCase();
/** * Creates a new TS type */ public TS(Message message) { super(message); init(); }
private Date tsToDate(TS ts) throws HL7Exception { // need to handle timezone String dtm = ts.getTime().getValue(); int year = Integer.parseInt(dtm.substring(0, 4)); int month = (dtm.length() >= 6 ? Integer.parseInt(dtm.substring(4, 6)) - 1 : 0); int day = (dtm.length() >= 8 ? Integer.parseInt(dtm.substring(6, 8)) : 1); int hour = (dtm.length() >= 10 ? Integer.parseInt(dtm.substring(8, 10)) : 0); int min = (dtm.length() >= 12 ? Integer.parseInt(dtm.substring(10, 12)) : 0); int sec = (dtm.length() >= 14 ? Integer.parseInt(dtm.substring(12, 14)) : 0); Calendar cal = Calendar.getInstance(); cal.set(year, month, day, hour, min, sec); return cal.getTime(); } }
/** * Returns Degree of Precision (component 2). This is a convenience method that saves you from * casting and handling an exception. */ public ID getTs2_DegreeOfPrecision() { return getTyped(1, ID.class); }
private void init() { data = new Type[2]; data[0] = new DTM(getMessage()); data[1] = new ID(getMessage(), 529); }
/** * Return a java date object for the given TS * * @param ts TS to parse * @return date object or null * @throws HL7Exception */ private Date getDatetime(TS ts) throws HL7Exception { Date datetime = null; DTM value = ts.getTime(); if (value.getYear() == 0 || value.getValue() == null) { return null; } try { datetime = getDate(value.getYear(), value.getMonth(), value.getDay(), value.getHour(), value.getMinute(), value .getSecond()); } catch (DataTypeException e) { } return datetime; }
/** {@inheritDoc} */ protected Type createNewTypeWithoutReflection(int field) { switch (field) { case 0: return new TS(getMessage()); default: return null; } }
/** * Returns Time (component 1). This is a convenience method that saves you from * casting and handling an exception. */ public DTM getTs1_Time() { return getTyped(0, DTM.class); }
DTM value = ((TS) obx5).getTime(); if (value != null) { Date valueDate = getDate(value.getYear(), value.getMonth(), value.getDay(), value.getHour(), value
/** {@inheritDoc} */ protected Type createNewTypeWithoutReflection(int field) { switch (field) { case 0: return new TS(getMessage()); default: return null; } }
/** * Returns Time (component 1). This is a convenience method that saves you from * casting and handling an exception. */ public DTM getTime() { return getTyped(0, DTM.class); }
/** {@inheritDoc} */ protected Type createNewTypeWithoutReflection(int field) { switch (field) { case 0: return new ID(getMessage(), new Integer( 3 )); case 1: return new TS(getMessage()); case 2: return new TS(getMessage()); case 3: return new IS(getMessage(), new Integer( 62 )); case 4: return new XCN(getMessage()); case 5: return new TS(getMessage()); case 6: return new HD(getMessage()); default: return null; } }
/** * Returns Degree of Precision (component 2). This is a convenience method that saves you from * casting and handling an exception. */ public ID getDegreeOfPrecision() { return getTyped(1, ID.class); }