Most likely you will create a very basic ORM message

ORM_O01 orm = new ORM_O01();
orm.initQuickstart("ORM", "O01", "P");

generate a Terser from it

Terser t = new Terser(orm);

and then traverse your mapping table which maps attributes of your
model to Terser paths

// this is pseudo code
for(Mapping m : getMappings(...)) {
   t.set(m.getTerserSpec(), m.getValueFromModel());  // both
parameters are Strings
}

Missing groups/segments/repetitions in the message will be
automatically added as soon you populate a field.
Make sure to read the Terser javadoc about how primitive fields are addressed!

cheers
Christian

2012/12/12  <[email protected]>:
> I am building an application which of course has a model. I want to
> construct as HL7 message from this model. I have a mapping table in my
> database, used to identify each field I am interested in using from my
> model, which maps to a HL7 entity. I am generating requests for tests to
> several (hundreds of) labs and each lab is going to be different. So I will
> go to my mapping table and load the mappings from my model into the unique
> HL7 layout for that lab.
>
> I will create a HL7 MSH segment and then from that use the
> addNonstandardSegment method. Can this method also add standard normal
> segments and such. Am I thinking correctly, is there a better way..
>
> Reading an HL7 message and mapping into my model is fairly easy, use Terser
> and one of the segment iterators and .. not too bad.. are there any tricks
> in HAPI that I should know about to Generate an HL7 message given what I
> have described..
>
> using code like this is not going to work to well..
>
> ORM_O01 orm =
>
> new ORM_O01();
>
> MSH mshSegment = orm.getMSH();
>
> mshSegment.getFieldSeparator().setValue(
>
> "|");
>
> mshSegment.getEncodingCharacters().setValue(
>
> "^~\\&");
>
> mshSegment.getVersionID().setValue(
>
> "2.3");
>
> mshSegment.getDateTimeOfMessage().getTimeOfAnEvent().setValue(
>
> "200701011539");
>
> mshSegment.getSendingApplication().getNamespaceID().setValue(
>
> "TestSendingSystem");
>
> mshSegment.getSequenceNumber().setValue(
>
> "123");
>
> mshSegment.getMessageType().getMessageType().setValue(
>
> "ORM");
>
> mshSegment.getMessageType().getTriggerEvent().setValue(
>
> "O01");
>
> // Populate the PID Segment
>
> Date now =
>
> new Date();
>
> ORM_O01_PATIENT patient = orm.getPATIENT();
>
> patient.getPID().getPatientIDInternalID(0).getCx1_ID().setValue(
>
> "PatId123");
> etc
> etc
> etc
>
>
> ------------------------------------------------------------------------------
> LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
> Remotely access PCs and mobile devices and provide instant support
> Improve your efficiency, and focus on delivering more value-add services
> Discover what IT Professionals Know. Rescue delivers
> http://p.sf.net/sfu/logmein_12329d2d
> _______________________________________________
> Hl7api-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/hl7api-devel
>

------------------------------------------------------------------------------
LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
Remotely access PCs and mobile devices and provide instant support
Improve your efficiency, and focus on delivering more value-add services
Discover what IT Professionals Know. Rescue delivers
http://p.sf.net/sfu/logmein_12329d2d
_______________________________________________
Hl7api-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/hl7api-devel

Reply via email to