Hie guys, I've been missing in action for quite some time. Today am back with a problem to do with the creation of an HL7 message in java.
I'm using Eclipse and Java, and I've been researching about sending HL7 messages from my java application but dont seem to be getting the solution.
May you please assist me on how to create an HL7 message in java.
Thank you very much for your assistance.

What seems to be the problem?

PID||0493575^^^2^ID 1|454721||DOE^JOHN^^^^|DOE^JOHN^^^^|19480203|M||B|254 MYSTREET AVE^^MYTOWN^OH^44123^USA||(216)123-4567|||M|NON|400003403~1129086|
PV1||O|168 ~219~C~PMA^^^^^^^^^||||277^ALLEN MYLASTNAME^BONNIE^^^^|||||||||| ||2688684|||||||||||||||||||||||||199912271408||||||002376853

That appears to be the type of message your are looking to send.

Is your issue with generating this? or transmitting?

I'm looking for the java code to create/generate a message such as that you have given me, and transmit it to some other system.
The message should be generated in response to an event such as dispensation of a drug to a patient. How can i go about it?

In short, sounds like you need to:
1) create a GUI to receive input
2) use an adapter to convert input to HL7
3) transmit

For a large project like this, design is key. Figure out what exactly you want to do first; draw it out-- pictures help. Once you figure that out, start working on a UML diagram with classes/methods. Once you have the UML, post it here...lets have a look at it before you start writing code. Proper design now will alleviate headache later.