Skip to content

Commit

Permalink
Request to be an official module - prior authorizations manager (open…
Browse files Browse the repository at this point in the history
…emr#6045)

* A prior authorization module for managing service authorizations
  • Loading branch information
juggernautsei committed Jan 22, 2023
1 parent 8ffe978 commit b3e6c17
Show file tree
Hide file tree
Showing 108 changed files with 8,762 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Authorizations Module of OpenEMR
This module is to help a practice manage the authorizations needed to be paid for a patients visit.
Most practices that need to get authorization need a way to manage those authorizations. This module provides
the tools necessary to see what authorizations the patient have in the system. The module allows this
authorization to be tracked through the life cycle so when expired a new authorization can be obtained.

## Getting Started
If you are installing this module into an already existing practice. The module will grab the authorizations that
have been stored in the system. These authorizations are stored when the Miscellaneous Billing Option form are used.
The module pulls those out and displays them to present a history of the authorizations for that patient. The
system will allow the management of units.

## Contributing
If you would like to help in improving the skeleton library just post an issue on Github or send a pull request.
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"name": "juggernautsei/oe-module-prior-authorizations",
"description": "Prior Authorizations Module",
"type": "openemr-module",
"license": "All rights reserved",
"authors": [
{
"name": "Sherwin",
"email": "[email protected]",
"role": "Developer"
}
],
"keywords": ["openemr", "openemr-module"],
"minimum-stability": "stable",
"autoload": {
"psr-4": {"Juggernaut\\OpenEMR\\Modules\\PriorAuthModule\\": "src/"}
},
"require": {
"openemr/oe-module-installer-plugin": "^0.1.0",
"php": ">=7.1",
"symfony/event-dispatcher": "^4.4.0",
"nyholm/psr7": "^1.4"
},
"conflict": {
"openemr/openemr": "<6.0.0"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?php

/*
* package OpenEMR
* link https://www.open-emr.org
* author Sherwin Gaddis <[email protected]>
* Copyright (c) 2022.
* All Rights Reserved
*/

header("Location: public/index.php");
?>
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
</head>
<body>

</body>
</html>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Advanced Prior Auth
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php

/*
*
* @package OpenEMR
* @link https://www.open-emr.org
*
* @author Sherwin Gaddis <[email protected]>
* @copyright Copyright (c) 2021 Sherwin Gaddis <[email protected]>
* @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3
*
*/

$module_config = 1;

require_once('./welcome.php');
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
<?php

/*
*
* @package OpenEMR
* @link https://www.open-emr.org
*
* @author Sherwin Gaddis <[email protected]>
* @copyright Copyright (c) 2021 Sherwin Gaddis <[email protected]>
* All Rights Reserved
*
*/


use OpenEMR\Common\Acl\AclMain;
use OpenEMR\Menu\MenuEvent;
use OpenEMR\Menu\PatientMenuEvent;
use OpenEMR\Events\PatientDemographics\RenderEvent;
use OpenEMR\Common\Csrf\CsrfUtils;
use Symfony\Component\EventDispatcher\Event;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;

function oe_module_priorauth_add_menu_item(MenuEvent $event)
{
$menu = $event->getMenu();

$menuItem = new stdClass();
$menuItem->requirement = 0;
$menuItem->target = 'mod';
$menuItem->menu_id = 'mod0';
$menuItem->label = xlt("Prior Authorization Report");
$menuItem->url = "/interface/modules/custom_modules/oe-module-prior-authorizations/public/reports/list_report.php";
$menuItem->children = [];
$menuItem->acl_req = ["patients", "docs"];
$menuItem->global_req = [];

foreach ($menu as $item) {
if ($item->menu_id == 'patimg') {
$item->children[] = $menuItem;
break;
}
}

$event->setMenu($menu);

return $event;
}

function oe_module_priorauth_patient_menu_item(PatientMenuEvent $menuEvent)
{
$menu = file_get_contents(__DIR__ . '/public/patient_menu/custom_patient_menu.json');
$menu_parsed = json_decode($menu);
$menuEvent->setMenu($menu_parsed);
return $menuEvent;
}

function renderButtonPostLoad(Event $event)
{
$patient_status = sqlQuery("SELECT `status` FROM `patient_status` WHERE `pid` = ? ORDER BY `statusId` DESC LIMIT 1", [$_SESSION['pid']]);
if (($patient_status['status'] != 'inactive') && (AclMain::aclCheckCore('admin', 'super'))) {
?>
<script>
let navbar = document.querySelector('nav.navbar:first-of-type');
let ele = document.createElement("div");
ele.id = "customepatientnav";
ele.innerHTML = '<button class="btn btn-danger" id="addButton">'<?php echo xlt("Mark Inactive") ?>'</button>';
navbar.appendChild(ele);
</script>
<?php
} else {
?>
<script>
let navbar = document.querySelector('nav.navbar:first-of-type');
let ele = document.createElement("div");
ele.id = "customepatientnav";
ele.innerHTML = '<button class="btn btn-success" id="addButton">'<?php echo xlt("Mark Active") ?>'</button>';
navbar.appendChild(ele);
</script>
<?php
}
?>
<script>
document
.getElementById('addButton')
.addEventListener("click", function (e){
if( ! confirm(<?php echo xlj('Do you really want to do this?') ?>)){
e.preventDefault();
} else {
alert(<?php echo xlj('Ok, lets do this! Click ok to really mark inactive.') ?>));
let libUrl = 'patient_status.php';
let pid = <?php echo js_escape($_SESSION['pid']); ?>;
let csrf = <?php echo js_escape(CsrfUtils::collectCsrfToken()); ?>;
$.ajax({
type: "POST",
url: libUrl,
data: {patientid: pid, csrf_token: csrf},
error: function (qXHR) {
console.log("There was an error");
alert(<?php echo xlj("File Error") ?> +"\n" + id)
},
success: function (result) {
alert(result);
}
});
}
});
</script
<?php
}

/**
* @var EventDispatcherInterface $eventDispatcher
* @var array $module
* @global $eventDispatcher @see ModulesApplication::loadCustomModule
* @global $module @see ModulesApplication::loadCustomModule
*/

$eventDispatcher->addListener(MenuEvent::MENU_UPDATE, 'oe_module_priorauth_add_menu_item');
$eventDispatcher->addListener(PatientMenuEvent::MENU_UPDATE, 'oe_module_priorauth_patient_menu_item');
$eventDispatcher->addListener(RenderEvent::EVENT_RENDER_POST_PAGELOAD, 'renderButtonPostLoad');
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<?php

/*
* package OpenEMR
* link https://www.open-emr.org
* author Sherwin Gaddis <[email protected]>
* Copyright (c) 2022.
* license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3
*/

use OpenEMR\Common\Csrf\CsrfUtils;
use OpenEMR\Common\Acl\AclMain;

require_once dirname(__FILE__, 5) . '/globals.php';

if (!AclMain::aclCheckCore('admin', 'practice')) {
echo xlt('Unauthorized');
die;
}

if (CsrfUtils::verifyCsrfToken($_GET['csrf_token_form'])) {
CsrfUtils::csrfNotVerified();
}
sqlQuery("delete from `module_prior_authorizations` where `id` = ?", [$_GET['id']]);

?>
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title><?php echo xlt('Delete Record') ?></title>
</head>
<body>
<p><?php echo "<br> <br>" . xlt("If you are seeing this message the record was deleted. Click done, pls"); ?></p>
</body>
</html>


Loading

0 comments on commit b3e6c17

Please sign in to comment.