Skip to content

Commit

Permalink
This DAP form is being donated by Dr. Andy Gauler PhD, MS, LMHC (open…
Browse files Browse the repository at this point in the history
  • Loading branch information
juggernautsei committed May 9, 2021
1 parent 72174c7 commit 08d2f34
Show file tree
Hide file tree
Showing 9 changed files with 436 additions and 0 deletions.
72 changes: 72 additions & 0 deletions contrib/forms/dap/C_FormDAP.class.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
<?php

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

require_once($GLOBALS['fileroot'] . "/library/classes/Controller.class.php");
require_once($GLOBALS['fileroot'] . "/library/forms.inc");
require_once("FormDAP.class.php");

use OpenEMR\Common\Csrf\CsrfUtils;

class C_FormDAP extends Controller
{

var $template_dir;

function __construct($template_mod = "general")
{
parent::__construct();
$this->template_mod = $template_mod;
$this->template_dir = dirname(__FILE__) . "/templates/";
$this->assign("FORM_ACTION", $GLOBALS['web_root']);
$this->assign("DONT_SAVE_LINK", $GLOBALS['form_exit_url']);
$this->assign("STYLE", $GLOBALS['style']);
$this->assign("CSRF_TOKEN_FORM", CsrfUtils::collectCsrfToken());
}

function default_action()
{
$form = new FormDAP();
$this->assign("data", $form);
return $this->fetch($this->template_dir . $this->template_mod . "_new.html");
}

function view_action($form_id)
{
if (is_numeric($form_id)) {
$form = new FormDAP($form_id);
} else {
$form = new FormDAP();
}

$this->assign("data", $form);

return $this->fetch($this->template_dir . $this->template_mod . "_new.html");
}

function default_action_process()
{
if ($_POST['process'] != "true") {
return;
}

$this->form = new FormDAP($_POST['id']);
parent::populate_object($this->form);

$this->form->persist();
if ($GLOBALS['encounter'] == "") {
$GLOBALS['encounter'] = date("Ymd");
}
if (empty($_POST['id'])) {
addForm($GLOBALS['encounter'], "DAP", $this->form->id, "dap", $GLOBALS['pid'], $_SESSION['userauthorized']);
$_POST['process'] = "";
}
return;
}
}
166 changes: 166 additions & 0 deletions contrib/forms/dap/FormDAP.class.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,166 @@
<?php

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

use OpenEMR\Common\ORDataObject\ORDataObject;

define("EVENT_VEHICLE", 1);
define("EVENT_WORK_RELATED", 2);
define("EVENT_SLIP_FALL", 3);
define("EVENT_OTHER", 4);

/**
* class FormHpTjePrimary
*
*/
class FormDAP extends ORDataObject
{
/**
*
* @access public
*/

/**
*
* static
*/
var $id;
var $date;
var $pid;
var $user;
var $groupname;
var $authorized;
var $activity;
var $data;
var $assessment;
var $plan;

/**
* Constructor sets all Form attributes to their default value
*/

function __construct($id = "", $_prefix = "")
{
if (is_numeric($id)) {
$this->id = $id;
} else {
$id = "";
$this->date = date("Y-m-d H:i:s");
}

$this->_table = "form_dap";
$this->activity = 1;
$this->pid = $GLOBALS['pid'];
if ($id != "") {
$this->populate();
}
}
function populate()
{
parent::populate();
}

function toString($html = false)
{
$string .= "\n"
. "ID: " . $this->id . "\n";

if ($html) {
return nl2br($string);
} else {
return $string;
}
}
function set_id($id)
{
if (!empty($id) && is_numeric($id)) {
$this->id = $id;
}
}
function get_id()
{
return $this->id;
}
function set_pid($pid)
{
if (!empty($pid) && is_numeric($pid)) {
$this->pid = $pid;
}
}
function get_pid()
{
return $this->pid;
}
function set_activity($tf)
{
if (!empty($tf) && is_numeric($tf)) {
$this->activity = $tf;
}
}
function get_activity()
{
return $this->activity;
}

function get_date()
{
return $this->date;
}
function set_date($dt)
{
if (!empty($dt)) {
$this->date = $dt;
}
}
function get_user()
{
return $this->user;
}
function set_user($u)
{
if (!empty($u)) {
$this->user = $u;
}
}
function get_data()
{
return $this->data;
}
function set_data($data)
{
if (!empty($data)) {
$this->data = $data;
}
}
function get_assessment()
{
return $this->assessment;
}
function set_assessment($data)
{
if (!empty($data)) {
$this->assessment = $data;
}
}
function get_plan()
{
return $this->plan;
}
function set_plan($data)
{
if (!empty($data)) {
$this->plan = $data;
}
}

function persist()
{
parent::persist();
}
}
1 change: 1 addition & 0 deletions contrib/forms/dap/info.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
DAP
17 changes: 17 additions & 0 deletions contrib/forms/dap/new.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?php

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

require_once("../../globals.php");
require_once("$srcdir/api.inc");

require("C_FormDAP.class.php");

$c = new C_FormDAP();
echo $c->default_action();
38 changes: 38 additions & 0 deletions contrib/forms/dap/report.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?php

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

require_once(dirname(__FILE__) . '/../../globals.php');
require_once($GLOBALS["srcdir"] . "/api.inc");

function dap_report($pid, $encounter, $cols, $id)
{
$cols = 1; // force always 1 column
$count = 0;
$data = formFetch("form_dap", $id);
if ($data) {
print "<table><tr>";
foreach ($data as $key => $value) {
if ($key == "id" || $key == "pid" || $key == "user" || $key == "groupname" || $key == "authorized" || $key == "activity" || $key == "date" || $value == "" || $value == "0000-00-00 00:00:00") {
continue;
}
if ($value == "on") {
$value = "yes";
}
$key = ucwords(str_replace("_", " ", $key));
print "<td><span class=bold>" . xlt($key) . ": </span><span class=text>" . text($value) . "</span></td>";
$count++;
if ($count == $cols) {
$count = 0;
print "</tr><tr>\n";
}
}
}
print "</tr></table>";
}
23 changes: 23 additions & 0 deletions contrib/forms/dap/save.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php

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

require_once("../../globals.php");
require_once("$srcdir/api.inc");

use OpenEMR\Common\Csrf\CsrfUtils;

if (!CsrfUtils::verifyCsrfToken($_POST["csrf_token_form"])) {
CsrfUtils::csrfNotVerified();
}

require("C_FormDAP.class.php");
$c = new C_FormDAP();
echo $c->default_action_process($_POST);
@formJump();
13 changes: 13 additions & 0 deletions contrib/forms/dap/table.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
CREATE TABLE IF NOT EXISTS `form_dap` (
`id` bigint(20) NOT NULL auto_increment,
`date` datetime default NULL,
`pid` bigint(20) default 0,
`user` varchar(255) default NULL,
`groupname` varchar(255) default NULL,
`authorized` tinyint(4) default 0,
`activity` tinyint(4) default 0,
`data` text,
`assessment` text,
`plan` text,
PRIMARY KEY (id)
) ENGINE=InnoDB;
Loading

0 comments on commit 08d2f34

Please sign in to comment.