Personal tools
You are here: Home OSCAR EMR version 10.x 2.0 Clinical Functions 2.5 eForms 2.5.3 eForm Magic

2.5.3 eForm Magic

Advanced techniques for making eForms 1. Manual form creation 2. Database pulls - simple, measurements, extended 3. Templates to paste into ...

Instructions for manual form creation 

  1. Use a program like GIMP to convert the pdf original form to an image file or scan the form onto your computer.  Save it as a .GIF or .PNG file about 1500 px wide.  For this example we will use a smoking cessation form smoking cessation
  2. Using a program like GIMP or Paint, go through the image and clean up any shadows or spots created by the scanning.  Delete the top and bottom margins and/or resize the image so that the page fits on one page, if possible.
  3. Create an html document in a program like Notepad.  Start with this basic template
    <html>
    <head>
    
    <!-- CSS Script that removes textarea and textbox borders when printing -->
    <style type="text/css" media="print">
     .DoNotPrint {
    	 display: none;
     }
     .noborder {
    	 border : 0px;
    	 background: transparent;
    	 scrollbar-3dlight-color: transparent;
    	 scrollbar-3dlight-color: transparent;
    	 scrollbar-arrow-color: transparent;
    	 scrollbar-base-color: transparent;
    	 scrollbar-darkshadow-color: transparent;
    	 scrollbar-face-color: transparent;
    	 scrollbar-highlight-color: transparent;
    	 scrollbar-shadow-color: transparent;
    	 scrollbar-track-color: transparent;
    	 background: transparent;
    	 overflow: hidden;
     }
    </style>
    <!-- ---------------------------------- -->
    
    </head>
    
    <body> 
    
    <!-- Use the first format when testing in your browser -->
    <img src="smoking_cessation.png" style="position: absolute; left: 0px; top: 0px; width:750 ">
    
    <!-- Remember to use the second one when saving in Oscar or the image won't be found 
    <img src="${oscar_image_path}smoking_cessation.png" style="position: absolute; left: 0px; top: 0px; width:750 ">
     -->
    
    <!-- ---------------------------------- -->
    
    <form method="POST" action="">
    
    <!-- All textfields/checkboxes/textareas go here.. -->
    <input name="patient_name" id="patient_name" type="text" class="noborder" style="position:absolute; left:137px; top:30px; width:374px; height:20px; font-size:12px;"  oscarDB=patient_name  >
    
    
      
    
    <!-- --------------------------------------------- -->
    
    
    <!-- The submit/print/reset buttons -->
    <div class=DoNotPrint style="position: absolute; top: 1550px; left: 27px;">
      <table>
         <tr>
            <td class="subjectline">
                 Subject: <input type="text" name=subject size="40">&nbsp;
                 <input type="submit" value="Submit" name="B1">
                 <input type="reset" value="Reset" name="B2">
                 <input type=button value=Print onclick="javascript:window.print()">
            </td>
         </tr>
      </table>
    </div>
    <!-- ---------------------------------- -->
    
    </form>
    </body>
    </html>
  4. Change the image source to the .GIF or .PNG file of the scanned form, then preview the page in your internet browser. 
  5. For each new text/check box, copy and paste the desired element's code in the html template directly under where it says <!-- --All textfields/checkboxes/textareas go here...-->, and modify the tag with the correct position, name, box length, etc.  The simple emplate has the patients name (which will fill from the database in Oscar) as a start as almost all forms require the name somewhere.  The other commonly used form elements are as below 
    Text box (one line): 
    <div style="position: absolute; left:90px; top:5px;"> 
    	<input type="text" class="noborder" name="thisfield121" style="width: 289px; font-family: Arial; font-size: 12px;" tabindex="1">
    </div>
    
    Text area (multiple lines):
    <div style="position: absolute; left:90px; top:30px;"> 
    	<textarea class="noborder" name="thisfield122" style="height: 83px; width: 289px; font-family: Arial; font-size: 12px;" tabindex="2"></textarea>
    </div>
    
    Check box:
    <div style="position: absolute; left:90px; top:130px;">
            <input type="checkbox" name="thischeckbox1042">
    </div>
  6. Keep the class attribute the same ("noborder") in order to ensure that none of the borders of the boxes appear in the final printed form.  If you wish for OSCAR to fill in patient information automatically from the patient's e-chart, use the oscarDB tags shown below in the HTML rules.
    NOTE: Make sure all of the HTML rules explained below are met for each tag of your form, or the data in your form may not be saved!
  7. With each new element, preview the page in your internet browser to make sure the length, location, etc. is correct.  If you wish to see what the form will look like when printed, you can click "Print Preview" in your internet browser.
  8. Repeat steps 5-7 until the form is complete.  Test the form by filling out every text field and checking every checkbox, then printing the form.  You may wish to erase unnecessary boxes and lines from the form image in a photo editing program (ex. Paint), now that electronic boxes are now in place.
  9. Before you add your e-form to OSCAR:
    • Change your image source to <IMG SRC="${oscar_image_path}imagename.gif">; this will allow OSCAR to find the form image when pulling up the form. 

Pulling Data from Oscar

a. Standard Database Tags

 The following tags are designed for users to use if they want certain fields to be automatically filled out with information from the patient's chart. The tag should appear in the following style oscarDB=<tag> (note lack of quotation marks). 

patient_name, first_last_name, patient_nameL, patient_nameF, today, label, address, addressline, province, city, postal, doctor, dob, dobc, dobc2, NameAddress, hin, hinc, hinversion, chartno, phone, phone2, clinic_name, clinic_phone, clinic_fax, clinic_label, clinic_addressLine, clinic_addressLineFull, clinic_address, clinic_city, clinic_province, clinic_postal, social_family_history, other_medications_history, medical_history, ongoingconcerns, reminders, age, ageComplex, sex, provider_name, provider_name_first_init, current_user, doctor_work_phone, referral_name, referral_address, referral_phone, referral_fax, allergies_des, recent_rx, druglist_generic, druglist_trade, druglist_line, appt_provider_name, patient_tfnote, resident_tfnotes, appt_mc_number, doctor_ohip_no, current_user_ohip_no

An example follows

<input type="text" name="pname" id="pname" oscarDB=patient_name>

b. Measurements

Measurements can be retrieved from the chart as well.  The format is  oscarDB=m$<measurementName>#<measurementField>.  For most uses you are interested in the "value" measurement Field which will give you the latest measurement of that type (the types configured vary by system, the examples are ones that are common to most if not all Oscar installations)

<input type="text" name="WT" id="WT" oscarDB=m$WT#value>

And comments associated with that measurement

<input type="text" name="EGFR" id="EGFR" oscarDB=m$EGFR#comments>

the date of the Measurement can be pulled by

<input type="text" name="dailySmokes" id="dailySmokes" oscarDB=m$NOSK#dateObserved>
Measurements can be saved from the form to the measurements list by using m$<measurementName>#<measurementField> as the name of the input
WT: <input class="nodisplay" type="text" name="m$WT#value" />
<select name="m$WT#measuringInstruction">
        <option value="in kg">in kg</option>
        <option value="in BMI">in BMI</option>
        </select>
Comments: <textarea class="nodisplay" name="m$WT#comments" rows="3" cols="20"></textarea>

If you want to both read from and write to the measurements database combine the two methods

<input type="text" name="m$BP#dateObserved" oscarDB=m$BP#dateObserved>

The name of each text field and checkbox MUST be unique.  The information WILL NOT SAVE if there are duplicate names.

Make sure you remember to save your form as an .html file.

 

c. extended database tags

These oscarDBs cannot be directly called (i.e. oscarDB=<tag>). Similar to measurements they should be called in special formats so as to include extra parameters.

oscarDB=e$first#{var_name}

Parameter: {var_name} = (name of eform field)
Description:
This ap retrieves the value of field {var_name} from the same eform which is first submitted.
Only value of the same eform (same fid) is retrieved, therefore eforms using this ap must have a field {var_name}.
Deleted eform data (fdid status=0) is excluded.

For example if you want to retrieve the value of the first patient which is stored in the field "name" for whom a copy of the same  eForm is saved you would use:

oscarDB=e$first#name 


oscarDB=e$last#{var_name}

Parameter: {var_name} = (name of eform field)
Description:
This ap retrieves the value of field {var_name} from the same eform which is last submitted
Only value of the same eform (same fid) is retrieved, therefore eforms using this ap must have a field {var_name}.
Deleted eform data (fdid status=0) is excluded.

For example to retrieve the value of field "resident" in the same eform which is last submitted

oscarDB=e$last#resident


oscarDB=e$count#{var_name}

Parameter: {var_name} = (name of eform field)
Description:
This ap counts the total number of non-empty field {var_name} in all the same eforms.
Only value of the same eform (same fid) is retrieved, therefore eforms using this ap must have a field {var_name}.
Deleted eform data (fdid status=0) is excluded.

For example to retrieve the total number of fields "bp" which are filled in all the same eforms

 oscarDB=e$count#bp


var$value={var_value}

Parameter: {var_value} = (value of eform field)
This ap works together with e$count to count the total number of field {var_name} which has the value {var_value} in all the same forms.
It has no effect when put together with e$first or e$last.

If {var_value} contains space, it must be quoted ("...").
{var_value} can be a static value or be dynamic, see *Dynamic var_value* for detail.

For example to count the total number of field "resident" which has the value "Cheng, Ronnie" in all the same eforms

oscarDB=e$count#resident var$value="Cheng, Ronnie"


ref${var_name}

Parameter: {var_name} = (name of eform field)
This ap works together with e$count to count the total number of a certain field in the same forms which contains another non-empty field {var_name}.
It has no effect when put together with e$first or e$last.

For example to count  the total number of field "resident" in all the same eforms which also have the field "observer" filled

oscarDB=e$count#resident ref$observer


ref${var_name}={var_value}

Parameter: {var_name} = (name of eform field)
    {var_value} = (value of eform field)
This ap works together with e$count to count the total number of a certain field in the same forms which contains another  field {var_name} with the value {var_value}.
It has no effect when put together with e$first or e$last.

If {var_value} contains space, it must be quoted ("...").
{var_value} can be a static value or be dynamic, see *Dynamic var_value* for detail.

For example to count the total number of field "resident" in all the same eforms which also have field "observer"="Cheng, Ronnie"

oscarDB=e$count#resident ref$observer="Cheng, Ronnie"


eform$name={eform_name}


Parameter: {eform_name} = (name of another eform)
This ap works together with all e$ to retrieve values from another eform instead of the eform in use.
NOTE: If more than one eforms have the same name, only the first one (smallest fid) is referenced.

For example to count the total number of field "resident" in all the "Teaching Field Note" eforms which also have the field "observer" filled)

oscarDB=e$count#resident ref$observer eform$name="Teaching Field Note"


oscarDB=o${table_name}#{other_id_name}


Parameter: {table_name} = appointment/patient
    {other_id_name} = (name of the alternative id)
Description:
This ap retrieves alternative id from the other_id table.
Other_id table stores alternative id for patient demographics and appointments. Mapping to more tables can be created in the future.
For patient demographics alternative id, this ap references the demographic no of the current eform.
For appointments alternative id, it references the appointment no parameter passed when calling eform from the appointment screen.
NOTE: Appointments alternative id won't work if calling eform from "Search demographic".

For example to retrieve an appointment alternative id named "mc_number"

oscarDB=o$appointment#mc_number

*Dynamic var_value*

var_value can be set to reference a field value in the eform. To use this, simply write a field name and surround it with a pair of brackets {}.
NOTE: The var_value reference is made once when the eform is loaded. Therefore the field being referenced must have an initial value (value=... or oscarDB=...). User input to the referenced field will NOT change the var_value.

Example to count the total number of field "patient" in all the same eforms which has the value of field "patient" in this eform

<input name="patient" type="text" oscarDB=patient_name>
<input name="total_encounter" type="text" oscarDB=e$count#patient var$value={patient}>

 

Summary Template

Summary templates are defined in an eform to write a summary of the eform content into Oscar message, edoc or echart when the eform is submitted.

The template must be placed in comment <!-- ... -->

Special value tags are used to extract field values from eform.

Template format:

<!--
<template>
    <document belong=provider|patient>
        <docdesc>{document description}</docdesc>
        <docowner>{document owner}</docowner>
        <content>{content}</content>
    </document>

    <message>
        <subject>{subject}</subject>
        <sendto>{recipient1,recipient2,...}</sendto>
        <content>{content}</content>
    </message>

    <encounternote>{content}</encounternote>
    <socialhistory>{content}</socialhistory>
    <familyhistory>{content}</familyhistory>
    <medicalhistory>{content}</medicalhistory>
    <ongoingconcerns>{content}</ongoingconcerns>
    <riskfactors>{content}</riskfactors>
    <reminders>{content}</reminders>
    <othermeds>{content}</othermeds>
</template>
-->

Description:

Document template has a "belong=" attribute. If belong=provider, it is written as a provider document. If belong=patient, it is written as a patient document. The default is belong=provider.

The <docowner> entry must be a number. It is a provider_no/demographic_no. The default is the eform form_provider/demographic_no.

Message template <sendto> entry (ie recipient) must be one or more provider_no. There is no default to this entry.


For all the echart templates (<encounternote>, <socialhistory>, etc.), a link to the eform is added to the echart alongside the summary.

 

Value tags:

Value tags can be used anywhere in the summary templates, as long as it suits the format requirements.

Value tags come in 2 types: $t{...} and $te{...}


$t{...}

Put a field name inside the bracket. The field value will be filled-in when eform is submitted.

If the field name does not exist in eform, the tag will be written as it is to the summary.


$te{...}

These are "eform attribute" tags. They can be one of the following:

$te{eform.name|eform.subject|eform.patient|eform.provider|eform.link|eform.html}

In place of $te{eform.html}, the complete html of the eform will be written, with the action statement removed.

In place of $te{eform.link}, a link to the eform will be written and the eform name will be shown.

NOTE: Tag $te{eform.link} does not work in message content. Also, it's not necessary in echart templates because a link will already be in place.


Example:

Eform "TESTING" source html:

 

<html>
<input type="text" name="resident" value="Cheng, Ronnie">
</html>
<!--
<template>
 <encounternote>
This is the eform $te{eform.link}, it belongs to resident $t{resident}.
 </encounternote>
</template>
-->


Summary:


This is the eform TESTING, it belongs to resident Cheng, Ronnie.

(*The word TESTING is a link to the eform)

 

 

Document Actions