You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
186 lines
7.7 KiB
186 lines
7.7 KiB
<?php |
|
|
|
/** |
|
* Supervisors Dashboard |
|
*/ |
|
require_once("../../globals.php"); |
|
require_once("$srcdir/forms.inc"); |
|
require_once("$srcdir/options.inc.php"); |
|
|
|
use OpenEMR\Common\Csrf\CsrfUtils; |
|
use OpenEMR\Core\Header; |
|
|
|
if (!empty($_POST)) { |
|
if (!CsrfUtils::verifyCsrfToken($_POST["csrf_token_form"])) { |
|
CsrfUtils::csrfNotVerified(); |
|
} |
|
} |
|
|
|
// Get form elements |
|
$form_month = (isset($_POST['form_month'])) ? $_POST['form_month'] : '0'; |
|
$current_month = date('m'); |
|
|
|
if(!empty($_POST)) { |
|
$tableName = "2022_" . $form_month . "_CW_Encounters"; |
|
$firstDayOfMonth = "2022-" . $form_month . "-01"; |
|
$lastDayOfMonth = "2022-" . $form_month . "-" . date('t', strtotime($firstDayOfMonth)); |
|
$provider_id = 4; |
|
|
|
// Get the number for 20% of the month's records |
|
$query = "SELECT * FROM form_encounter WHERE date BETWEEN '" . $firstDayOfMonth . "' AND '" . $lastDayOfMonth . "' AND provider_id = 4"; |
|
$results = sqlStatement($query); |
|
$num_rows = round(sqlNumRows($results) * .2); |
|
|
|
// Create a table of randomly selected records |
|
$query = "CREATE TABLE IF NOT EXISTS " . $tableName . " |
|
SELECT fe.id, fe.encounter, fe.date, fe.pid, fe.provider_id, CONCAT(p.fname, ' ', p.lname) AS patient, p.DOB, b.code AS code, b.justify AS 'icd-10' |
|
FROM form_encounter AS fe |
|
LEFT JOIN patient_data AS p on fe.pid = p.pid |
|
LEFT JOIN billing AS b on fe.encounter = b.encounter |
|
WHERE fe.date BETWEEN '" . $firstDayOfMonth . "' AND '" . $lastDayOfMonth . "' AND |
|
fe.provider_id = " . $provider_id . " AND |
|
(b.code_type IS NULL OR b.code_type = 'CPT4') AND |
|
code LIKE '99%' |
|
ORDER BY RAND() |
|
LIMIT " . $num_rows; |
|
$results = sqlStatement($query); |
|
|
|
// Query database here... |
|
$query = "SELECT * FROM " . $tableName; |
|
$results = sqlStatement($query); |
|
} |
|
|
|
function getMonthName($month_number) { |
|
$month_name = date("F", mktime(0, 0, 0, $month_number, 10)); |
|
return $month_name; |
|
} |
|
|
|
?> |
|
|
|
<html> |
|
<head> |
|
<title><?php echo xlt('Supervisor\'s Dashboard'); ?></title> |
|
|
|
<?php Header::setupHeader(['datetime-picker', 'report-helper']); ?> |
|
|
|
<style> |
|
.container { |
|
margin: 10px 0; |
|
max-width: 100%; |
|
width: 100%; |
|
} |
|
</style> |
|
|
|
<script> |
|
var EncounterIdArray = new Array; |
|
var EncounterDateArray = new Array; |
|
var CalendarCategoryArray = new Array; |
|
var EncounterNoteArray = new Array; |
|
|
|
// Process a click to go to an encounter. |
|
function toencounter(pid, pubpid, pname, enc, datestr, dobstr) { |
|
top.restoreSession(); |
|
encurl = 'patient_file/encounter/encounter_top.php?set_encounter=' + encodeURIComponent(enc) + |
|
'&pid=' + encodeURIComponent(pid); |
|
parent.left_nav.setPatient(pname, pid, pubpid, '', dobstr); |
|
parent.left_nav.setEncounter(datestr, enc, 'enc'); |
|
parent.left_nav.loadFrame('enc2', 'enc', encurl); |
|
} |
|
function showEncounter(encounter, pid, datestr) { |
|
url = 'patient_file/encounter/encounter_top.php?set_encounter=' + encounter + '&pid=' + pid; |
|
parent.left_nav.loadFrame('enc2', 'enc', url); |
|
} |
|
</script> |
|
|
|
</head> |
|
|
|
<body class="body_top"> |
|
<form method='post' id='theform' action='super_dashboard.php'> |
|
<input type="hidden" name="csrf_token_form" value="<?php echo attr(CsrfUtils::collectCsrfToken()); ?>" /> |
|
<div class="container"> |
|
<div class="row"> |
|
<div class="col-md-2"> |
|
<div class="search-info"> |
|
<h2><?php echo xlt('Supervisor Review'); ?></h2> |
|
<p>Select the month that you wish to review and click submit. Each encounter number is a button that will open the encounter details. The SOAP section of each encounter contains the chart notes. The esign button allows you to electronically sign each chart you review. Tip: selecting the padlock on the tab will show this report side-by-side with the encounter.</p> |
|
</div> |
|
</div> |
|
<div class="col-md-10"> |
|
<div class="row"> |
|
<div class="col"> |
|
<div class="form-group"> |
|
<label for="form_month">2022</label> |
|
<select class="form-control" name="form_month" id="form_month"> |
|
<option value="00">Select a month to view</option> |
|
<?php |
|
for($i = 1; $i < $current_month; $i++) { |
|
$month_name = getMonthName($i); |
|
if($form_month == $i) { |
|
echo "<option value='" . $i . "' selected>" . $month_name . "</option>"; |
|
} else { |
|
echo "<option value='" . $i . "'>" . $month_name . "</option>"; |
|
} |
|
} |
|
?> |
|
</select> |
|
</div> |
|
</div> |
|
</div> |
|
<div class="row"> |
|
<div class="col-md-12"> |
|
<a href='#' class='btn btn-secondary btn-save' onclick='$("#theform").submit();'> |
|
<?php echo xlt('Submit'); ?> |
|
</a> |
|
</div> |
|
</div> |
|
</div> |
|
</div> |
|
|
|
</div> |
|
</form> |
|
|
|
<div id="report_results"> |
|
|
|
<table class="table"> |
|
<thead class="thead-light"> |
|
<tr> |
|
<th>Encounter</th> |
|
<th>Service Date</th> |
|
<th>Patient</th> |
|
<th>DOB</th> |
|
<th>Code</th> |
|
<th>ICD-10</th> |
|
</tr> |
|
</thead> |
|
<tbody> |
|
<?php |
|
while ($row = sqlFetchArray($results)) { |
|
echo "<tr>"; |
|
?> |
|
<script> |
|
EncounterIdArray[<?php echo attr($row['pid']); ?>] = new Array; |
|
EncounterDateArray[<?php echo attr($row['pid']); ?>] = new Array; |
|
CalendarCategoryArray[<?php echo attr($row['pid']); ?>] = new Array; |
|
EncounterNoteArray[<?php echo attr($row['pid']); ?>] = new Array; |
|
</script> |
|
<?php |
|
$lhtml = "<a class='btn btn-sm btn-primary' role='button' href='javascript: |
|
showEncounter(".attr_js($row['encounter']).",".attr_js($row['pid']).",".attr_js(oeFormatShortDate($row['date'])).");'>" . $row["encounter"] . "</a>"; |
|
|
|
echo "<td>" . $lhtml . "</td>"; |
|
echo "<td>" . oeFormatShortDate($row["date"]) . "</td>"; |
|
echo "<td>" . $row["patient"] . "</td>"; |
|
echo "<td>" . $row["DOB"] . "</td>"; |
|
echo "<td>" . $row["code"] . "</td>"; |
|
echo "<td>" . $row["icd-10"] . "</td>"; |
|
echo "</tr>"; |
|
} |
|
?> |
|
</tbody> |
|
|
|
</table> |
|
</div><!-- report results --> |
|
|
|
</body> |
|
|
|
</html>
|