From: Christian O. <chr...@gm...> - 2014-06-04 16:13:25
|
You need to add dependencies on the structure libraries. Please get started with http://hl7api.sourceforge.net/getting_started.html. Christian 2014-06-04 17:35 GMT+02:00 Sara Fatima <sar...@gm...>: > Hi Christian, > > Thank you for the guidelines. I am trying the below code to create HL7 > message. > > ADT_A01 adt = new ADT_A01(); > > MSH mshSegment = adt.getMSH(); > mshSegment.getFieldSeparator().setValue("|"); > mshSegment.getEncodingCharacters().setValue("^~\\&"); > > mshSegment.getDateTimeOfMessage().getTimeOfAnEvent().setValue("200701011539"); > > mshSegment.getSendingApplication().getNamespaceID().setValue("TestSendingSystem"); > mshSegment.getSequenceNumber().setValue("123"); > mshSegment.getMessageType().getMessageType().setValue("ADT"); > mshSegment.getMessageType().getTriggerEvent().setValue("A01"); > mshSegment.getMessageType().getMessageStructure().setValue("ADT > A01"); > > PID pid = adt.getPID(); > pid.getPatientName(0).getFamilyName().getSurname().setValue("Doe"); > pid.getPatientName(0).getGivenName().setValue("John"); > pid.getPatientIdentifierList(0).getID().setValue("123456"); > > Parser parser = new PipeParser(); > String encodedMessage = parser.encode(adt); > System.out.println("Printing ER7 Encoded Message:"); > System.out.println(encodedMessage); > > return encodedMessage; > > But I am facing an error, as > >> An Internal Error has Occurred >> >> *java.lang.NoClassDefFoundError*ca/uhn/hl7v2/model/v24/message/ADT_A01 > > > Is there any jar file which I should add to support ADT? (I am using it in > maven project) > > Thanks & Regards > Sara Fatima > > > > On Wed, Jun 4, 2014 at 8:29 PM, Christian Ohr <chr...@gm...> > wrote: > >> Basically you instantiate an instance of PipeParser (or GenericParser) >> yourself instead of obtaining it from an HapiContext: >> >> ADT_A01 adt = new ADT_A01(); >> >> ... populate message ... >> >> Parser parser = new PipeParser(); >> String encodedMessage = parser.encode(adt); >> System.out.println("Printing ER7 Encoded Message:"); >> System.out.println(encodedMessage); >> >> When you need to parse a HL7 message, you would call parser.parse instead >> of parser.encode, obviously. >> >> BTW. we always try to retain backwards-compatibility on API level as good >> as possible. The code above is still valid in 2.1 and 2.2. >> There have been some internal changes between 2.0 and 2.1 and 2.2 (and >> bugfixes!), but chances are that OpenMRS may work as-is with newer HAPI >> versions, too. >> >> regards >> Christian >> >> >> 2014-06-04 7:17 GMT+02:00 Sara Fatima <sar...@gm...>: >> >>> Hi all, >>> >>> Since few weeks I am trying to work with HAPI. My aim here is to create >>> a HL7 message and send it to an HIE over MLLP (using PAM profile). I need >>> to include this feature in an OpenMRS module. HAPI is already embed in >>> OpenMRS-core, but OpenMRS is supporting HAPI v2.0. >>> >>> I was using this example >>> <http://hl7api.sourceforge.net/xref/ca/uhn/hl7v2/examples/CreateAMessage.html> to >>> create HL7 message. What I understand here is this example is working fine >>> with HAPI v2.1 and not with HAPI v2.0. I see that HapiContext and >>> DefaultHapiContext are working with v2.1 and not with v2.0. So I am looking >>> for a way to create HL7 message using HAPI v2.0. >>> >>> I would be glad if someone could guide me to old documentation, or any >>> examples which can help create HL7 message using v2.0. >>> >>> Thanks & Regards >>> Sara Fatima >>> >>> >>> >>> ------------------------------------------------------------------------------ >>> Learn Graph Databases - Download FREE O'Reilly Book >>> "Graph Databases" is the definitive new guide to graph databases and >>> their >>> applications. Written by three acclaimed leaders in the field, >>> this first edition is now available. Download your free book today! >>> http://p.sf.net/sfu/NeoTech >>> _______________________________________________ >>> Hl7api-devel mailing list >>> Hl7...@li... >>> https://lists.sourceforge.net/lists/listinfo/hl7api-devel >>> >>> >> >> >> ------------------------------------------------------------------------------ >> Learn Graph Databases - Download FREE O'Reilly Book >> "Graph Databases" is the definitive new guide to graph databases and their >> applications. Written by three acclaimed leaders in the field, >> this first edition is now available. Download your free book today! >> http://p.sf.net/sfu/NeoTech >> _______________________________________________ >> Hl7api-devel mailing list >> Hl7...@li... >> https://lists.sourceforge.net/lists/listinfo/hl7api-devel >> >> > |