} else { if ($mode == 'update') { $id = $_POST["id"]; $result = sqlQuery("SELECT encounter, sensitivity FROM form_encounter WHERE id = '{$id}'"); if ($result['sensitivity'] && !acl_check('sensitivities', $result['sensitivity'])) { die("You are not authorized to see this encounter."); } $encounter = $result['encounter']; // See view.php to allow or disallow updates of the encounter date. $datepart = acl_check('encounters', 'date_a') ? "date = '{$date}', " : ""; sqlStatement("UPDATE form_encounter SET " . $datepart . "onset_date = '{$onset_date}', " . "reason = '{$reason}', " . "facility = '{$facility}', " . "pc_catid = '{$pc_catid}', " . "facility_id = '{$facility_id}', " . "billing_facility = '{$billing_facility}', " . "sensitivity = '{$sensitivity}', " . "referral_source = '{$referral_source}' " . "WHERE id = '{$id}'"); } else { die("Unknown mode '{$mode}'"); } } setencounter($encounter); // Update the list of issues associated with this encounter. sqlStatement("DELETE FROM issue_encounter WHERE " . "pid = '{$pid}' AND encounter = '{$encounter}'"); if (is_array($_POST['issues'])) { foreach ($_POST['issues'] as $issue) { $query = "INSERT INTO issue_encounter ( " . "pid, list_id, encounter " . ") VALUES ( " . "'{$pid}', '{$issue}', '{$encounter}'" . ")"; sqlStatement($query); } } // Custom for Chelsea FC. // if ($mode == 'new' && $GLOBALS['default_new_encounter_form'] == 'football_injury_audit') { // If there are any "football injury" issues (medical problems without // "illness" in the title) linked to this encounter, but no encounter linked // to such an issue has the injury form in it, then present that form. $lres = sqlStatement("SELECT list_id " . "FROM issue_encounter, lists WHERE " . "issue_encounter.pid = '{$pid}' AND " . "issue_encounter.encounter = '{$encounter}' AND " . "lists.id = issue_encounter.list_id AND " . "lists.type = 'medical_problem' AND " . "lists.title NOT LIKE '%Illness%'");
// include_once "{$srcdir}/pid.inc"; if ($_GET["set_pid"] && $_GET["set_pid"] != $_SESSION["pid"]) { setpid($_GET["set_pid"]); } else { if ($_GET["pid"] && $_GET["pid"] != $_SESSION["pid"]) { setpid($_GET["pid"]); } } include_once "{$srcdir}/encounter.inc"; //only set the global encounter variable if it has been explicityly passed //thru the url, ie. from the history interface - otherwise, assume //that the page refresh is a local interface update that is not meant //to update the encounter variable if (isset($_GET["set_encounter"])) { setencounter($_GET["set_encounter"]); ?> <HTML> <head> <?php html_header_show(); ?> <TITLE> <?php xl('Patient Encounters', 'e'); ?> </TITLE> </HEAD> <frameset rows="60%,40%" cols="*"> <frameset rows="*" cols="*,200"> <frame src="forms.php" name="Forms" scrolling="auto">