congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
org.dcm4che3.hl7
Code IndexAdd Tabnine to your IDE (free)

How to use org.dcm4che3.hl7

Best Java code snippets using org.dcm4che3.hl7 (Showing top 20 results out of 315)

origin: dcm4che/dcm4che

public HL7Exception(HL7Segment err) {
  super(err.getField(8, null));
  this.ack = toAck(err);
  this.err = err;
}
origin: dcm4che/dcm4che

public byte[] readMessage() throws IOException {
  byte[] b = mllpIn.readMessage();
  if (b != null)
    log("{} >> {}", b, 0, b.length);
  return b;
}
origin: dcm4che/dcm4che

  public static HL7Message makeACK(HL7Segment msh, HL7Exception e) {
    HL7Message ack = makeACK(msh, e.getAcknowledgmentCode(), e.getErrorMessage());
    HL7Segment err = e.getErrorSegment();
    if (err != null)
      ack.add(err);
    return ack;
  }
}
origin: dcm4che/dcm4che

  public void query(String pid, String[] domains) throws IOException {
    HL7Message qbp = HL7Message.makePixQuery(pid, domains);
    HL7Segment msh = qbp.get(0);
    msh.setSendingApplicationWithFacility(sendingApplication);
    msh.setReceivingApplicationWithFacility(receivingApplication);
    msh.setField(17, charset);
    mllp.writeMessage(qbp.getBytes(charset));
    if (mllp.readMessage() == null)
      throw new IOException("Connection closed by receiver");
  }
}
origin: dcm4che/dcm4che

public static HL7Message parse(byte[] b, int size, String defCharset) {
  ParsePosition pos = new ParsePosition(0);
  HL7Message msg = new HL7Message();
  HL7Segment seg = HL7Segment.parseMSH(b, size, pos);
  char fieldSeparator = seg.getFieldSeparator();
  String encodingCharacters = seg.getEncodingCharacters();
  String charsetName = HL7Charset.toCharsetName(seg.getField(17, defCharset));
  msg.add(seg);
  while ((seg = HL7Segment.parse(
      b, size, pos, fieldSeparator, encodingCharacters, charsetName)) != null)
    msg.add(seg);
  msg.trimToSize();
  return msg;
}
origin: dcm4che/dcm4che

public byte[] getBytes(String defCharset) {
  try {
    return toString().getBytes(HL7Charset.toCharsetName(get(0).getField(17, defCharset)));
  } catch (UnsupportedEncodingException e) {
    throw new RuntimeException(e);
  }
}
origin: dcm4che/dcm4che

public void setSendingApplicationWithFacility(String s) {
  String[] ss = split(s, '|');
  setField(2, ss[0]);
  if (ss.length > 1)
    setField(3, ss[1]);
}
origin: dcm4che/dcm4che

public ERRSegment(char fieldSeparator, String encodingCharacters) {
  super(9, fieldSeparator, encodingCharacters);
  setField(0, "ERR");
  setHL7ErrorCode(ApplicationInternalError);
  setSeverity("E");
}
origin: dcm4che/dcm4che

private void endElement(Delimiter delimiter) throws SAXException {
  Delimiter d = Delimiter.escape;
  do
    if (open.remove(d = d.parent()))
      endElement(d.name());
  while (d != delimiter);
}
origin: dcm4che/dcm4che

private void setDelimiters(String delimiters) {
  Delimiter[] a = Delimiter.values();
  for (int i = 0; i < a.length; i++)
    addAttribute(a[i].attribute(), delimiters.substring(i,i+1));
  this.delimiters = delimiters;
}
origin: dcm4che/dcm4che

public void writeMessage(byte[] b, int off, int len) throws IOException {
  log("{} << {}", b, off, len);
  mllpOut.writeMessage(b, off, len);
}
origin: dcm4che/dcm4che

static HL7Segment parse(byte[] b, int size, ParsePosition pos,
    char fieldSeparator, String encodingCharacters, String charsetName) {
  String s = parse(b, size, pos, charsetName);
  return s != null
      ? new HL7Segment(s, fieldSeparator, encodingCharacters)
      : null;
}
origin: dcm4che/dcm4che

public HL7Segment(String s, char fieldSeparator, String encodingCharacters) {
  this.fieldSeparator = fieldSeparator;
  this.encodingCharacters = encodingCharacters;
  this.fields = split(s, fieldSeparator);
}
origin: dcm4che/dcm4che

public MLLPConnection(Socket sock) throws IOException {
  this.sock = sock;
  mllpIn = new MLLPInputStream(sock.getInputStream());
  mllpOut = new MLLPOutputStream(sock.getOutputStream());
}
origin: dcm4che/dcm4che

  public ERRSegment setUserMessage(String userMessage) {
    setField(8, userMessage);
    return this;
  }
}
origin: dcm4che/dcm4che

  @Override
  public void close() throws IOException {
    mllpConnection.close();
  }
}
origin: org.dcm4che.tool/dcm4che-tool-hl7pix

  public void query(String pid, String[] domains) throws IOException {
    HL7Message qbp = HL7Message.makePixQuery(pid, domains);
    HL7Segment msh = qbp.get(0);
    msh.setSendingApplicationWithFacility(sendingApplication);
    msh.setReceivingApplicationWithFacility(receivingApplication);
    msh.setField(17, charset);
    mllp.writeMessage(qbp.getBytes(charset));
    if (mllp.readMessage() == null)
      throw new IOException("Connection closed by receiver");
  }
}
origin: dcm4che/dcm4che

public HL7Exception(HL7Segment err, Throwable cause) {
  super(err.getField(8, null), cause);
  this.ack = toAck(err);
  this.err = err;
}
origin: dcm4che/dcm4che

public void setReceivingApplicationWithFacility(String s) {
  String[] ss = split(s, '|');
  setField(4, ss[0]);
  if (ss.length > 1)
    setField(5, ss[1]);
}
origin: dcm4che/dcm4che

public ERRSegment setHL7ErrorCode(String hl7ErrorCode) {
  setField(3, hl7ErrorCode);
  return this;
}
org.dcm4che3.hl7

Most used classes

  • HL7Segment
  • HL7Message
  • MLLPConnection
  • ERRSegment
  • HL7Charset
  • HL7Exception,
  • HL7Parser,
  • Delimiter,
  • MLLPInputStream,
  • MLLPOutputStream
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now