Personal tools
You are here: Home / OSCAR Users / EMR and Case Management Resources / eForms / eForms in development/beta testing / Useful Code / Extract date joined from the demographics page for use in eforms
Navigation
 

Extract date joined from the demographics page for use in eforms

This concept was created by Peter HC with modification by David Page. Variations can be used to extract data from almost any page in OSCAR by simply altering the regular expression used to parse the page. Of course this depends on the formatting of the page in OSCAR and thus may need to be updated as versions change ***Warning*** works for version 12 - may not work for later version. This code draws the date joined information from the demographics page. For specialists, if the demographic is made up the day the referral is received, date joined = date referral received. This is useful for governmental demands for information with regard to waiting times to see a specialist (BC surgeons are now required to provide this information). Variations could likely be used to determine how long a patient has been in someone's practice etc. JohnR.

HTML icon GetDateJoinedBasic.html — HTML, 1 kB (1420 bytes)

File contents

<html>
<head>
    <title>***Find Date Joined***</title>

	<script type="text/javascript" src="${oscar_javascript_path}jquery/jquery-1.4.2.js"></script>

<script type="text/javascript" language="javascript">

	  function getDateJoined() {                             
        xmlhttp = new XMLHttpRequest();
        var pathArray = window.location.href;
		var mydemographic=  /demographic_no=(.*?)&appointment/;
		var demoNumber = (mydemographic.exec(pathArray))[1]; 
		 var myURL=  /^(.*?)\/eform/;
		 var URL = (myURL.exec(pathArray))[1]; 
        var newURL = URL+"/demographic/demographiccontrol.jsp?demographic_no="+demoNumber+"&displaymode=edit&dboperation=search_detail";
        xmlhttp.onreadystatechange = function () {
            if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
                var str = xmlhttp.responseText; 
                if (!str) {
                    return;
                }
                var demoArray = /Date Joined:<\/span>\s*<span class="info">([0-9,-]+)<\/span>/g;
                var demo = (demoArray.exec(str))[1]; 
				$('#dateJoined').val(demo);

            }
        }
        xmlhttp.open("GET", newURL, false);
        xmlhttp.send();
    }
	
	</script>

</head>

<body onload='getDateJoined()'> 

	          Date joined:<input type="text" name="dateJoined" maxlength="10" size="10" id="dateJoined" >
</body >
</html>

Document Actions

 

Download button

DOWNLOAD OSCAR FOR TESTING

 

eForms button

DOWNLOAD SHARED E-FORMS


 Customize button

FIND PLUG-INS AND TWEAKS
FOR YOUR OSCAR EMR

 

Subscribe Button

SUBSCRIBE TO DISCUSSION LIST 
(SEE ALL LISTS)

  

Help button

ACCESS THE ONLINE MANUALS
(PAID SUPPORT)