Patients-in-Line Code Guide

If you're interested in adding real-time updates of the number of patients in line to your website, you'll need to publish one or more of our Patients-in-Line JavaScript code. We've given each script the name that corresponds to the default name of each queue and they are listed in the order that they appear in the Patient Queue, but keep in mind that your facility may have changed the queue names to something else or only use two out of the three queue types listed.

Screen_Shot_2022-03-09_at_5.27.11_PM.png Here's an example of all four of the Patients-in-Line scripts listed on the online check-in hub page of a demo urgent care website. The naming conventions for each queue have been edited to make sense to patients and help them decide which facility has the most capacity to treat them.

 

Follow the steps below to install one or more of these codes on your website.

 

Table of Contents 

Load the jquery library

New Patients in Line JavaScript

Ready for Room JavaScript

In Treatment JavaScript

All Active Patients in Queue JS

Plug in your facilityID and divID

Test & debug the script 

 

 1. Load the jquery library first

This allows the JavaScript to execute properly.

Below is sample script to load jQuery. You can also choose a different version here, but make sure it's a more recent version or it will not work properly. Make sure to place it above the patients-in-line script. 

<script src="https://code.jquery.com/jquery-3.5.1.min.js" integrity="sha256-9/aliU8dGd2tb6OSsuzixeV4y/faTqgFtohetphbbj0=" crossorigin="anonymous"></script>

 

 2a. Add the New-Patients-in-Line JavaScript

If you've installed our first-available-time JS code before, you'll recognize the code below as looking very similar. There are two differences however:

<script type="text/javascript">

$ ( function() {

$.getJSON("https://apps10.erexpress.com/erx-reservationform/api/patients-in-queue/facilityID", function( data )

{
$('#divID').html("<p style='margin-bottom: 0; line-height:10px;'> Patients currently in line: " + data.PatientsInQueue + "</p>");

});

});

</script>

<div id="divID"></div>


 2b. Add the Patients-Ready-for-Room JS

The code below looks nearly identical to the patients-in-line code above, however the main differences are:

<script type="text/javascript">

$ ( function() {

$.getJSON("https://apps10.erexpress.com/erx-reservationform/api/patients-in-queue/rfr/facilityID", function( data )

{
$('#divID').html("<p style='margin-bottom: 0; line-height:10px;'> Patients currently in line: " + data.PatientsInRFRQueue + "</p>");

});

});

</script>

<div id="divID"></div>

 

2c. Add the Patients-in-Treatment JS

The code below looks nearly identical to the patients-in-line code above, however, the main differences are:

<script type="text/javascript">

$ ( function() {

$.getJSON("https://apps10.erexpress.com/erx-reservationform/api/patients-in-queue/intreatment/facilityID", function( data )

{
$('#divID').html("<p style='margin-bottom: 0; line-height:10px;'> Patients currently in line: " + data.PatientsInIntreatmentQueue + "</p>");

});

});

</script>

<div id="divID"></div>

 

2d. Add the All-Active-Patients-in-Queue JS

The code below looks nearly identical to the patients-in-line code above, however, the main differences are:

<script type="text/javascript">

$ ( function() {

$.getJSON("https://apps10.erexpress.com/erx-reservationform/api/patients-in-queue/active/facilityID", function( data )

{
$('#divID').html("<p style='margin-bottom: 0; line-height:10px;'> Patients currently in line: " + data.PatientsInQueue + "</p>");

});

});

</script>

<div id="divID"></div>

 

3. Plug in your facilityID and divID

You will need to do this for each facility that needs the patients in line or patients in treatment displayed.

      • facilityID: We will provide this to you. Please plug this in in place of the highlighted text once you receive the ID(s).
      • divID: Customize by facility. Please plug in a unique name. For example, if the facility is named GetWell Fairfield Urgent Care, you might label this as Fairfield.

4. Test & debug the script 

      • We recommend doing a test implementation using our fictional test clinic, Milford Urgent Care. Its facilityID is 100004.
      • Once you copy the script, run it through a script cleaner since this document has likely added carriage returns, etc. We recommend: https://html-cleaner.com/js/
      • We recommend using jsFiddle (https://jsfiddle.net/) to debug because it lets you first isolate retrieving the wait time without trying to publish it in HTML.
      • New to jsFiddle?  Here's a few tips:
          • Add the jQuery library
          • You can then paste your own facilityID (which ER Express will provide)
          • Once you click run (upper left corner), it will publish the wait time in the console log

You can see a live real-time example with the first available time slot published to the console here: https://jsfiddle.net/spatelerx/t7ow1cja/1/

 

Using Wordpress?

We've found that the text editor in WP will automatically add <p> tags around JavaScript, causing the script not to execute properly. In order to work around this, we have two tips:

  1. Take out any white space in the script. We use a JavaScript minifier to do this: https://javascript-minifier.com/
  2. Use the <pre> tag around the script. We've found that the pre tag seems to override the <p> tag-adding tendency of WP. To remove the look of the pre tag, use <pre style="display: none">, then close with </pre> just after your closing </script> tag. Finally, add your divID (<div id="divID"></div>) on the end. 

 

Have more questions? Submit a request