How generate MessageControl ID MSH-10

View: New views
3 Messages — Rating Filter:   Alert me  

How generate MessageControl ID MSH-10

by Piero :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

how I'can generate a unique message contro id (MSH-10) for my HL7 messages from class Java.
Regards

Piero

Re: How generate MessageControl ID MSH-10

by Frédéric Dubru-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Piero a écrit :
> how I'can generate a unique message contro id (MSH-10) for my HL7 messages
> from class Java.
> Regards
>
> Piero
>
>  
Did you have a look at ca.uhn.hl7v2.util.MessageIDGenerator? It is very
simple to use:

            String id;
            try
            {
                id = MessageIDGenerator.getInstance().getNewID();
            }
            catch (IOException ex)
            {
                throw new HL7Exception(ex.getMessage(),
HL7Exception.APPLICATION_INTERNAL_ERROR);
            }
            terser.set("/MSH-10", id);

Fred.


-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
Hl7api-devel mailing list
Hl7api-devel@...
https://lists.sourceforge.net/lists/listinfo/hl7api-devel

Re: How generate MessageControl ID MSH-10

by munikuntla :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

ADT_A01 adt = new ADT_A01();
               
// Populate the MSH Segment
MSH mshSegment = adt.getMSH();
//Set unique ID here
mshSegment.getMessageControlID().setValue(MessageIDGenerator.getInstance().getNewID());
mshSegment.getFieldSeparator().setValue("|");
mshSegment.getEncodingCharacters().setValue("^~\\&");
//Set unique dateTimeOfMessage here
mshSegment.getDateTimeOfMessage().setValue(DateFormat.getDateTimeInstance().format(new Date()));

Regards,
Sai Kumar Munikuntla.

Frédéric Dubru-3 wrote:
Piero a écrit :
> how I'can generate a unique message contro id (MSH-10) for my HL7 messages
> from class Java.
> Regards
>
> Piero
>
>  
Did you have a look at ca.uhn.hl7v2.util.MessageIDGenerator? It is very
simple to use:

            String id;
            try
            {
                id = MessageIDGenerator.getInstance().getNewID();
            }
            catch (IOException ex)
            {
                throw new HL7Exception(ex.getMessage(),
HL7Exception.APPLICATION_INTERNAL_ERROR);
            }
            terser.set("/MSH-10", id);

Fred.


-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
Hl7api-devel mailing list
Hl7api-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/hl7api-devel