web stats
mapping help, convert HL7 datetime to SOAP dateTime - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

Reply
 
Thread Tools Display Modes
  #1  
Old 11-03-2006, 08:31 AM
jbartels jbartels is offline
Mirth Guru
 
Join Date: Oct 2006
Posts: 719
jbartels is on a distinguished road
Default mapping help, convert HL7 datetime to SOAP dateTime

I am setting up Mirth to catch scheduling messages and update an ancilliary system with a SOAP call. It gets the HL7 message, picks out what I need and makes the SOAP call just fine. The problem is that I need to covert the HL7 date to the SOAP date format.

HL7 is YYYYMMDDHHMMSS

SOAP is [-]CCYY-MM-DDThh:mm:ss[Z|(+|-)hh:mm]

My current mapping code is:
Code:
var startdate = msg['SCH']['SCH.11']['TQ.4']['TS.1'].toString()
var outdate = '';
//4 year

outdate += startdate.substr(0,3) + '-';
//2 month

outdate += startdate.substr(4,5) + '-';
//2 day

outdate += startdate.substr(6,7) + 'T';
//2 hour

outdate += startdate.substr(8,9) + ':';
//2 minute

outdate += startdate.substr(10,11) + ':';
//2 second

outdate += startdate.substr(12,13);

//[-]CCYY-MM-DDThh:mm:ss[Z|(+|-)hh:mm]
localMap.put('start', outdate);
I know I'm close, but I suspect I'm missing something basic about how Mirth expects the Mapping to be formed and how it actually gets data out of that. I get errors at the server from the javascript parser.
__________________
Jon Bartels

Zen is hiring!!!!
http://consultzen.com/careers/
Talented healthcare IT professionals wanted. Engineers to sales to management.
Good benefits, great working environment, genuinely interesting work.
Reply With Quote
  #2  
Old 11-04-2006, 08:14 PM
mrslatezb mrslatezb is offline
Mirth Newb
 
Join Date: Sep 2006
Posts: 15
mrslatezb
Default Re: mapping help, convert HL7 datetime to SOAP dateTime

The problem most likely is that you are using .substr() like .substring(). With .substring() the parameters are first index and end index (not including end index). With .substr() the parameters are first index and then the end index. It seems to me you may want to try substring().
Reply With Quote
  #3  
Old 11-06-2006, 04:45 AM
jbartels jbartels is offline
Mirth Guru
 
Join Date: Oct 2006
Posts: 719
jbartels is on a distinguished road
Default Re: mapping help, convert HL7 datetime to SOAP dateTime

Thanks, I haven't used much JavaScript.

Is the localMap.put() the correct way to expose the data so that Mirth can map it?
__________________
Jon Bartels

Zen is hiring!!!!
http://consultzen.com/careers/
Talented healthcare IT professionals wanted. Engineers to sales to management.
Good benefits, great working environment, genuinely interesting work.
Reply With Quote
  #4  
Old 11-06-2006, 05:49 AM
jbartels jbartels is offline
Mirth Guru
 
Join Date: Oct 2006
Posts: 719
jbartels is on a distinguished road
Default Re: mapping help, convert HL7 datetime to SOAP dateTime

ooh. It was barfing on the JScript because I forgot a semicolon on line 1.

I would still like to know what the correct use/API of localMap is. If someone could clarify that I'll tidy up the response and toss it into the Wiki.
__________________
Jon Bartels

Zen is hiring!!!!
http://consultzen.com/careers/
Talented healthcare IT professionals wanted. Engineers to sales to management.
Good benefits, great working environment, genuinely interesting work.
Reply With Quote
  #5  
Old 11-06-2006, 10:41 AM
chrisl chrisl is offline
Mirth Employee
 
Join Date: Aug 2006
Posts: 967
chrisl is an unknown quantity at this point
Default Re: mapping help, convert HL7 datetime to SOAP dateTime

Jon -

Your usage of the localMap is correct (.put(key, value) or .get(key)).

As far as date formatting, you can use any JAVA class in your Javascript. This is how we internally format dates

Code:
var rawdate = msg['SCH']['SCH.11']['TQ.4']['TS.1'];

var formatter = java.text.SimpleDateFormat("yyyyMMddhhmm");
var date = formatter.parse(rawdate);

formatter = java.text.SimpleDateFormat("h:mm aaa");
var pretty_time = formatter.format(date);
localMap.put('pretty_time',pretty_time);
The first simpleDateFormat takes a string that defines the incoming format of the date from HL7 and creates a JAVA date object. The next formatter defines the output format we want.

Your method works well though and prevents the overhead of Java classloading.

-Chris
__________________
Chris Lang
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Conversion failed when converting datetime doc4child General Discussion 3 06-02-2019 10:06 PM
Best practises - How do I ... ? - DateTime conversion nshaik Support 2 10-22-2009 05:29 AM
convert to HL7 messages bmahussain Support 2 02-17-2009 03:20 PM
how to convert hl7 message into xml? manish1982 Support 0 03-25-2008 05:43 AM
Can Mirth convert between HL7 v.2X and HL7 v3? revtim Support 3 11-01-2007 12:28 PM


All times are GMT -8. The time now is 10:03 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2019, vBulletin Solutions, Inc.
Mirth Corporation