Search code examples
javahl7hapihapi-fhir

Creating advanced HL7 message with Hapi Fhir


I am trying to teach myself to use the Hapi Fhir api and I'm starting by creating an HL7 message from Java. I have been able to do so by looking at this example from the official documentation page. However, now I would like to add some more information to my message by adding the NK1, PV1 and AL1 segments to the message (now it only contains the MSH and PID). I couldn't find any more complete examples, even looking into github code. How can I tackle this? Thanks in advance


Solution

  • Use HAPI help appropriate to your HL7v2 message version. For example - http://hl7api.sourceforge.net/v25/apidocs/index.html

    Thus:

    public PV1 getPV1()
    

    Returns PV1 (Patient Visit) - creates it if necessary