Parsing an HL7 without a priori messageType knowledge

谁说我不能喝 提交于 2019-12-04 09:52:16
Mike Stonis

parsedMessage.GetStructureName() will give you the message type and trigger event. parser.Encode(parsedMessage) will give you the message back in pipe-delimited format.

The following code shows how to get the message type and also how to get the original message in pipe format.

public static String ParseMessage(String message)
{
    var parser = new NHapi.Base.Parser.PipeParser();
    var parsedMessage = parser.Parse(message);

    //Get the message type and trigger event
    var msgType = parsedMessage.GetStructureName();

    //Get the message in raw, pipe-delimited format
    var pipeDelimitedMessage = parser.Encode(parsedMessage);

    return pipeDelimitedMessage;
}

Some good starter code can be found at the hapi examples site.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!