web stats
PDF Template help for Newbie - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

Reply
 
Thread Tools Display Modes
  #1  
Old 06-28-2010, 02:38 PM
iIntegrate iIntegrate is offline
Mirth Newb
 
Join Date: Jun 2010
Posts: 6
iIntegrate is on a distinguished road
Question PDF Template help for Newbie

My 1st Post to a Mirth Forum.
RN working with EMR / HIE last 7 years. (Nice change.)

Learned Javascript while building 2 hospital interfaces w/ Mirth.
(Awesome Interface Engine!)

Is there a sample template (very simple is fine) for Document Writer->PDF?

I realize it involves HTML. Just need an example, even for one data item (i.e MedicalRecordNumber).

Thanks in advance for any help!
__________________
Rod Sellers
"Psalm 34:3"
Reply With Quote
  #2  
Old 06-28-2010, 04:51 PM
pcolbert pcolbert is offline
OBX.1 Kenobi
 
Join Date: Jun 2010
Posts: 28
pcolbert is on a distinguished road
Smile

Rod, a basic HTML page with substituted channel variables would work. Suppose you had mapped the medical record number in a transformer step, then named that variable medicalRecordNumber, you could use the following HTML in the document writer template:

<table>
<tr>
<td>Medical Record Number:</td>
</tr>
<tr>
<td>${medicalRecordNumber}</td>
</tr>
</table>

This HTML would create a simple one-row, two-column table, with the text "Medical Record Number" in the first column, and the value for the medical record number extracted from the message (assuming you created a transformation using either a Mapper to extract the value and set a channel variable, or a JavaScript using channelMap.put).

Hope that helps!

Phil
Reply With Quote
  #3  
Old 07-02-2010, 02:10 PM
iIntegrate iIntegrate is offline
Mirth Newb
 
Join Date: Jun 2010
Posts: 6
iIntegrate is on a distinguished road
Default Thanks! One more question...

Thanks Phil! Worked Great.

I've tried to add an image, i.e. simulate a Lab's logo at the top of the page.

I use the <img src=".../> html, but it doesn't show up.

Any ideas?

- Rod
__________________
Rod Sellers
"Psalm 34:3"
Reply With Quote
  #4  
Old 07-03-2010, 02:38 PM
albertosaez albertosaez is offline
 
Join Date: Sep 2006
Location: Valladolid, Spain
Posts: 842
albertosaez is an unknown quantity at this point
Default

In the src attribute, try using a absolute reference to the file.
Reply With Quote
  #5  
Old 07-05-2010, 04:35 PM
austinmoody austinmoody is offline
Mirth Newb
 
Join Date: Oct 2007
Location: Johnson City, TN
Posts: 24
austinmoody
Default

As an example, we have a Mirth channel (server is Windows) that creates some PDF letters with data pulled from a database.

There is a logo included on the logo that lives in the C:\graphics\ folder on the server running Mirth. In the template:

<img src="/graphics/c_logo.jpg" />

Makes the image appear.
Reply With Quote
  #6  
Old 07-06-2010, 07:53 AM
iIntegrate iIntegrate is offline
Mirth Newb
 
Join Date: Jun 2010
Posts: 6
iIntegrate is on a distinguished road
Talking Awesome Community Support!

Thanks for the quick and expert assistance. Worked wonderfully.

I also used CSS (1st time) to get the image to center at the top of the PDF. *It's nice to still learn "new" things in one's mid-life.

- Rod
__________________
Rod Sellers
"Psalm 34:3"
Reply With Quote
  #7  
Old 06-27-2013, 01:21 AM
biju16mvk biju16mvk is offline
What's HL7?
 
Join Date: Jun 2013
Posts: 1
biju16mvk is on a distinguished road
Default Loop in pdf template

Any one knows how to loop through OBX segments in a pdf template?. I am using Mirth version 2.2.1. My destination is Document Writer and source is file reader. I am stuck on the middle way as I am not aware of how to loop through an OBX segment in a pdf template.
Reply With Quote
  #8  
Old 06-27-2013, 06:37 AM
narupley's Avatar
narupley narupley is offline
Mirth Employee
 
Join Date: Oct 2010
Posts: 7,124
narupley is on a distinguished road
Default

Quote:
Originally Posted by biju16mvk View Post
Any one knows how to loop through OBX segments in a pdf template?. I am using Mirth version 2.2.1. My destination is Document Writer and source is file reader. I am stuck on the middle way as I am not aware of how to loop through an OBX segment in a pdf template.
You can create some array of things to iterate through in your transformer:

Code:
var observations = [];
for each (obx in msg.OBX)
	observations.push(obx['OBX.5']['OBX.5.1'].toString());
$co('observations',observations);
And then display each element in the Velocity template:

Code:
#foreach($obs in $observations)$obs#end
It can get much more complex than that too. You can pass custom multifaceted objects into the context and do whatever you want with them.
__________________
Step 1: JAVA CACHE...DID YOU CLEAR ...wait, ding dong the witch is dead?

Nicholas Rupley
Work: 949-237-6069
Always include what Mirth Connect version you're working with. Also include (if applicable) the code you're using and full stacktraces for errors (use CODE tags). Posting your entire channel is helpful as well; make sure to scrub any PHI/passwords first.


- How do I foo?
- You just bar.
Reply With Quote
  #9  
Old 06-27-2013, 06:46 AM
kt7277 kt7277 is offline
OBX.2 Kenobi
 
Join Date: Apr 2008
Location: Conway, AR
Posts: 60
kt7277
Smile OBX.5 transformer

Code:
var DocumentText = "";
for each (documentLine in msg['OBX']['OBX.5']['OBX.5.1'])
{
	DocumentText += "<br/>" + documentLine;
}
connectorMap.put('DocumentText', DocumentText);
In your PDF template put:

Code:
	<p><span><BR/>
	${DocumentText}<BR/>
	</span></p>
Reply With Quote
Reply

Tags
document writer, pdf, template

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


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


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