Phone eForm tag to always show a phone number

Share this

In OSCAR, the eForm tag for ‘phone’ will by default only display the phone number from the patient’s HOME phone field in their demographic record. But nowadays it is common for patients to not have a home phone, so their cell phone/best to reach number is entered into the ‘phone2’ or ‘cell’ fields.

‘phone2’ is sometimes referred to as WORK phone, but most clinics don’t store an actual work phone for the patient, and since the OSCAR API does not give online booking apps access to the ‘cell’ field, integrated online booking systems will store the patient’s cell phone in the ‘phone2’ field. So the clinic becomes accustomed to using ‘phone2’ as an alias for ‘cell’.

All eForms that have a field for patient’s phone number (99% of eForms probably do!), and you can be almost certain that this phone number field pulls from the ‘phone’ eForm tag, which is the home phone. That means if the patient doesn’t have a home phone, the phone number field on the eForm will be blank. So if the eForm is a requisition for a test or a referral (where the patient’s phone number is normally a requirement), the referral will be rejected due to missing phone number and the patient will be contacting the office asking for the clinic to resend the referral with their phone number.

There is a handy way to fix the issue of the ‘phone’ field showing blank even if the patient has a phone2 or cell phone set.

In OSCAR, all the eForm “database tags” (or “oscarDB tags”/”eForm tags”) are little pieces of code that tell the eForm what value from the OSCAR database to insert into that field. The tag for phone field will look like “oscarDB=phone” in an eForm’s code.

The solution to always displaying the patient’s phone number (even if it’s not in the phone field) without modifying all your eForms is to have your OSP (OSCAR service provider) modify the “apconfig.xml” file to change the way the phone oscarDB tag behaves.

The apconfig.xml file is a file on the OSCAR server which stores all the eForm tags and tells OSCAR what to lookup from the database when an eForm tag is referenced. This file is only editable by your OSP.

Without getting too deep into the programming technicalities of how all of this works, all you need to know is that you should send an email to your OSP asking them to replace the current “phone” tag in apconfig.xml with the following code:

<databaseap>
  <ap-name>phone</ap-name>
    <ap-sql>
        SELECT
        CASE
            WHEN TRIM(d.phone) != '' THEN d.phone
            WHEN TRIM(COALESCE(de.value, '')) != '' THEN de.value
            WHEN TRIM(d.phone2) != '' THEN d.phone2
        ELSE ''
        END AS phone
        FROM demographic d
        LEFT JOIN demographicExt de ON d.demographic_no = de.demographic_no AND de.key_val = 'demo_cell'
        WHERE d.demographic_no=${demographic}
    </ap-sql>
    <ap-output>${phone}</ap-output>
</databaseap>

This change will result in the patient’s phone number always showing up in eForms even if it’s not stored in the home phone field. For example, if the patient only has a cell phone number which is stored in the ‘cell’ field, then the eForm tag for ‘phone’ will show that number instead of a blank.

As you can imagine, a change like this can save many headaches since there will be less rejections for incomplete referrals/requisitions, and you don’t have to modify any of your eForms for this improvement to take effect; since all the eForms pull from this master list of eForm tags in apconfig.xml, once the OSP changes that tag then the eForms see no difference except that they are being given a value to insert into the phone field that isn’t blank.

Alternatively, if you don’t want to modify the current phone tag (if you want to keep the phone tag to only show the home phone) but you want a new eForm tag that will allow you to always pull a phone number, you can have your OSP add the following code to apconfig.xml which will add a tag for ‘phone_best’ which will always pull a phone number. The ‘phone’ tag would remain unaffected if you choose this method of using a separate ‘phone_best’ tag.

This adds a database tag called phone_best which always shows one of the patient’s phone other numbers (phone2/cell) if home phone is blank:

<databaseap>
  <ap-name>phone_best</ap-name>
    <ap-sql>
        SELECT
        CASE
            WHEN TRIM(d.phone) != '' THEN d.phone
            WHEN TRIM(COALESCE(de.value, '')) != '' THEN de.value
            WHEN TRIM(d.phone2) != '' THEN d.phone2
        ELSE ''
        END AS phone
        FROM demographic d
        LEFT JOIN demographicExt de ON d.demographic_no = de.demographic_no AND de.key_val = 'demo_cell'
        WHERE d.demographic_no=${demographic}
    </ap-sql>
    <ap-output>${phone}</ap-output>
</databaseap>