3
  1. たとえば、セグメントの名前で特定のセグメント hl7 を取得したいのですが、Pipeparser クラスを使用していますが、構造名 ( MSH,PID,OBX,...) で各セグメントを取得する方法がまだわかりません。

  2. 時々、DG1、PV1、または OBX のようなセグメントが繰り返されます (添付の行を参照) Pentaho ケトルの各行セグメントからデータ ファイルを取得するにはどうすればよいですか (ケトルで Java コードを使用する必要がありますか?そのような解決策がある場合は、助けてください)。

OBX|1|TX|PTH_SITE1^Site A|1|left||||||F|||||||
OBX|2|TX|PTH_SPEC1^Specimen A||C-FNA^Fine Needle Aspiration||||||F|||||||

また

DG1|1|I10C|G30.0|Alzheimer's disease with early onset|20160406|W|||||||||
DG1|2|I10C|E87.70|Fluid overload, unspecified|20160406|W|||||||||
4

1 に答える 1

1

HL7 形式のメッセージを適切かつ正確に解析するには、HL7 パーサーを使用する必要があります。

HAPI の助けを借りて、メッセージをストリームとして解析することができます

// Open an InputStream to read from the file
        File file = new File("hl7_messages.txt");
        InputStream is = new FileInputStream(file);

        // It's generally a good idea to buffer file IO
        is = new BufferedInputStream(is);

        // The following class is a HAPI utility that will iterate over
        // the messages which appear over an InputStream
        Hl7InputStreamMessageIterator iter = new Hl7InputStreamMessageIterator(is);

        while (iter.hasNext()) {

            Message next = iter.next();

            // Do something with the message

        }

または、文字列として読み取ることができます

File file = new File("hl7_messages.txt");
        is = new FileInputStream(file);
        is = new BufferedInputStream(is);
        Hl7InputStreamMessageStringIterator iter2 = new Hl7InputStreamMessageStringIterator(is); 

        while (iter2.hasNext()) {

            String next = iter2.next();

            // Do something with the message

        }

これが正しい方向に役立つことを願っています。

于 2016-04-28T10:01:20.563 に答える