public HL7Field(XmlElement fieldElement, HL7Delimeters delim) { delimeters = delim; int iLastPopulatedPos = 0; String sField = ""; XmlNodeList fieldItemList = fieldElement.ChildNodes; if (fieldItemList.Count > 0) { for (int i = 0; i < fieldItemList.Count; i++) { XmlElement fieldItemElement = (XmlElement)fieldItemList[i]; HL7FieldItem fieldItem = new HL7FieldItem(fieldItemElement, delimeters); sField = sField + fieldItem.toString() + Char.ToString(delimeters.getRD()); if (fieldItem.toString().Length > 0) { iLastPopulatedPos = sField.Length - 1; } } sField = sField.Substring(0, iLastPopulatedPos); } deField = new HL7DataElement(sField); }
public HL7SubComponent(XmlElement subComponentElement, HL7Delimeters delim) { string sText = subComponentElement.InnerText; delimeters = delim; deSubComponent = new HL7DataElement(sText); }
public HL7FieldItem(string sFld, HL7Delimeters delim) { deField = new HL7DataElement(sFld); delimeters = delim; if (deField.getLength(delimeters.getRD()) > 1 && !delimeters.toString().Equals(deField.toString(), StringComparison.CurrentCultureIgnoreCase)) { throw new InvalidFieldException(""); } else { return; } }
private void initializeHL7(string sHL7Message) { deMessage = new HL7DataElement(sHL7Message.Trim()); try { HL7Segment messageHeader = getMessageHeader(); HL7Field field = messageHeader.getField(MESSAGE_TYPE_POS); HL7FieldItem fieldItem = field.getFieldItem(1); HL7Component messageType = fieldItem.getComponent(1); string sMessageID = ""; try { HL7Component messageID = fieldItem.getComponent(2); sMessageID = messageID.toString(); } catch (ComponentNotFoundException componentnotfoundexception) { } if (sMessageID.Length > 0) { sMessageType = messageType.toString() + "_" + sMessageID; } else { sMessageType = messageType.toString(); } try { field = messageHeader.getField(MESSAGE_ENCODING_POS); sHL7Encoding = field.toString(); sXMLEncoding = "UTF-8";//characterSet.getXML(sHL7Encoding); } catch (FieldNotFoundException e) { //debug("Character set not found in HL7. Using system defaults."); sHL7Encoding = ""; sXMLEncoding = "UTF-8"; } } catch (ComponentNotFoundException e) { throw new InvalidMessageTypeException(e.Message); } catch (FieldNotFoundException e) { throw new MessageTypeNotFoundException(e.Message); } catch (SegmentNotFoundException e) { throw new MessageHeaderNotFoundException(e.Message); } }
public HL7FieldItem(XmlElement fieldItemElement, HL7Delimeters delim) { delimeters = delim; string sFieldItem = ""; int iLastPopulatedPos = 0; XmlNodeList componentList = fieldItemElement.ChildNodes; if (componentList.Count == 0) { HL7Component component = new HL7Component(fieldItemElement, delimeters); sFieldItem = sFieldItem + component.toString(); } else { if (componentList.Count == 1 && componentList[0].NodeType == XmlNodeType.Text) { HL7Component component = new HL7Component(fieldItemElement, delimeters); sFieldItem = sFieldItem + component.toString(); if (component.toString().Length > 0) { iLastPopulatedPos = sFieldItem.Length; } } else { for (int i = 0; i < componentList.Count; i++) { XmlElement componentElement = (XmlElement)componentList[i]; HL7Component component = new HL7Component(componentElement, delimeters); sFieldItem = sFieldItem + component.toString() + delimeters.getCD(); if (component.toString().Length > 0) { iLastPopulatedPos = sFieldItem.Length - 1; } } } sFieldItem = sFieldItem.Substring(0, iLastPopulatedPos); } deField = new HL7DataElement(sFieldItem); }
public HL7Component(XmlElement componentElement, HL7Delimeters delim) { delimeters = delim; string sComponent = ""; int iLastPopulatedPos = 0; XmlNodeList subComponentList = componentElement.ChildNodes; if (subComponentList.Count == 0) { HL7SubComponent subComponent = new HL7SubComponent(componentElement, delimeters); sComponent = sComponent + subComponent.toString(); } else { if (subComponentList.Count == 1 && componentElement.ChildNodes[0].NodeType == XmlNodeType.Text) { HL7SubComponent subComponent = new HL7SubComponent(componentElement, delimeters); sComponent = sComponent + subComponent.toString(); if (subComponent.toString().Length > 0) { iLastPopulatedPos = sComponent.Length; } } else { for (int i = 0; i < subComponentList.Count; i++) { XmlElement subComponentElement = (XmlElement)subComponentList[i]; HL7SubComponent subComponent = new HL7SubComponent(subComponentElement, delimeters); sComponent = sComponent + subComponent.toString() + char.ToString(delimeters.getSD()); if (subComponent.toString().Length > 0) { iLastPopulatedPos = sComponent.Length - 1; } } } sComponent = sComponent.Substring(0, iLastPopulatedPos); } deComponent = new HL7DataElement(sComponent); }
public HL7Segment(string sSeg, HL7Delimeters delim) { deSegment = new HL7DataElement(sSeg); delimeters = delim; try { sName = deSegment.getString(delimeters.getFD(), 1).Trim(); if (sName.Equals("")) { //throw new InvalidSegmentException("Segment name is empty"); } } catch (UnableToGetStringException e) { throw new InvalidSegmentException(e.Message); } catch (Exception e) { throw new InvalidSegmentException(e.Message); } }
public HL7Segment(XmlElement segmentElement, HL7Delimeters delim) { delimeters = delim; sName = segmentElement.Name; int iLastPopulatedPos = 0; string sSegment = (sName) + char.ToString(delimeters.getFD()); try { XmlNodeList fieldList = segmentElement.ChildNodes; for (int i = 0; i < fieldList.Count; i++) { if (sName.Equals(MESSAGE_HEADER, StringComparison.CurrentCultureIgnoreCase) && i == 0) { continue; } if (sName.Equals(MESSAGE_HEADER, StringComparison.CurrentCultureIgnoreCase) && i == 1) { sSegment = sSegment + (delimeters.toString().Substring(1)) + char.ToString(delimeters.getFD()); continue; } XmlElement fieldElement = (XmlElement)fieldList[i]; HL7Field field = new HL7Field(fieldElement, delimeters); sSegment = sSegment + field.toString() + char.ToString(delimeters.getFD()); if (field.toString().Length > 0) { iLastPopulatedPos = sSegment.Length - 1; } } deSegment = new HL7DataElement(sSegment.Substring(0, iLastPopulatedPos)); } catch (InvalidFieldException e) { throw new InvalidSegmentException(e.Message); } }
public HL7Field(string sFld, HL7Delimeters delim) { deField = new HL7DataElement(sFld); delimeters = delim; }
public HL7Component(string sComp, HL7Delimeters delim) { deComponent = new HL7DataElement(sComp); delimeters = delim; }
public HL7SubComponent(string sSubComp, HL7Delimeters delim) { deSubComponent = new HL7DataElement(sSubComp); delimeters = delim; }