From: Agnibho Mondal Date: Sat, 22 May 2021 06:36:05 +0000 (+0530) Subject: Print data X-Git-Url: https://code.agnibho.com/repo?a=commitdiff_plain;h=ac664f31e0d9ede324b5920d4584cfb5c1283acc;p=simpleipd.git Print data --- diff --git a/access.json b/access.json index f4b2374..a64b0b6 100644 --- a/access.json +++ b/access.json @@ -152,7 +152,6 @@ "tech": "view", "clerk": "view" }, - "antibiogram": { "admin": "all", "visiting": "all", @@ -161,5 +160,14 @@ "lab": "all", "tech": "view", "clerk": "view" + }, + "printdata": { + "admin": "view", + "visiting": "view", + "resident": "view", + "nursing": "view", + "lab": "view", + "tech": "view", + "clerk": "view" } } diff --git a/config.php.example b/config.php.example index 7361f60..ef401c5 100644 --- a/config.php.example +++ b/config.php.example @@ -1,5 +1,6 @@ execute(); return($result); } + function getDeath($pid){ + global $log; + if(!checkAccess("discharge", "dbGet")) return false; + $stmt=$this->prepare("SELECT data FROM death WHERE pid=:pid;"); + $stmt->bindValue(":pid", $pid); + $result=$stmt->execute(); + return($result); + } function getName($pid){ global $log; if(!checkAccess("info", "dbGet")) return false; diff --git a/lib/functions.php b/lib/functions.php index 7bf171e..b02add6 100644 --- a/lib/functions.php +++ b/lib/functions.php @@ -114,7 +114,7 @@ function viewData($data, $edit=null){ else{ $date=""; } - $view=$view."".$description."".$date.""; + $view=$view."".$description."".$date.""; foreach($data as $field=>$value){ if(!empty($value) && $field!="form" && $field!="date" && $field!="time"){ if(!empty($schema->properties->$field)){ diff --git a/require.php b/require.php index 629b5ca..35cf427 100644 --- a/require.php +++ b/require.php @@ -4,6 +4,7 @@ require("lib/access.php"); require("lib/log.php"); require("lib/db.php"); require("lib/functions.php"); +date_default_timezone_set(CONFIG_TZ); session_start(); $page=basename($_SERVER["PHP_SELF"]); if($page!="login.php"){ diff --git a/www/discharge.php b/www/discharge.php index 580b0d0..2c06977 100644 --- a/www/discharge.php +++ b/www/discharge.php @@ -6,7 +6,7 @@ if(!empty($_GET["pid"])){ $db->deleteAdvice($_POST["delete"]); } elseif(!empty($_POST["drug"])){ - $db->addAdvice($pid, $_POST["drug"], $_POST["dose"], $_POST["route"], $_POST["frequency"], $_POST["duration"], $_POST["extra-note"]); + $db->addAdvice($pid, $_POST["drug"], $_POST["dose"], $_POST["route"], $_POST["frequency"], $_POST["duration"], $_POST["extra_note"]); } $list=$db->getAdvice($pid); $view="
"; diff --git a/www/printdata.php b/www/printdata.php new file mode 100644 index 0000000..078ed75 --- /dev/null +++ b/www/printdata.php @@ -0,0 +1,82 @@ +Treatment Received
    "; +$discharge="

    Advice on Discharge

      "; +$death="

      Medical Cause of Death

      "; +if($_GET["pid"]){ + $pid=$_GET["pid"]; + $status=$db->getStatus($pid)->fetchArray()["status"]; + $info=getInfo($pid); + $history=viewData($db->getHistory($pid)->fetchArray()["history"]); + $physicianArray=$db->getAllData($pid, "physician"); + while($c=$physicianArray->fetchArray()){ + array_push($physician, viewData($c["data"])); + } + $nursingArray=$db->getAllData($pid, "nursing"); + while($c=$nursingArray->fetchArray()){ + array_push($nursing, viewData($c["data"])); + } + $reportsArray=$db->getAllData($pid, "reports"); + while($r=$reportsArray->fetchArray()){ + if(in_array($r["form"], ["report-as-grampos", "report-as-gramneg", "report-as-fungal"])){ + array_push($reports, viewAntibiogram($r["data"])); + } + else{ + array_push($reports, viewData($r["data"])); + } + } + $treatmentArray=$db->getDrugs($pid); + while($t=$treatmentArray->fetchArray()){ + $start=""; + if(!empty($r["start"])){ + $start="from ".date("M j", $t["start"]); + } + $end=""; + if(!empty($r["end"])){ + $end="till ".date("M j", $t["end"]); + } + $addl=""; + if(!empty($r["addl"])){ + $addl="(".$t["addl"].")"; + } + $treatments=$treatments."
    1. ".$t["drug"]." ".$t["dose"]." ".$t["route"]." ".$t["frequency"]." ".$end." ".$addl; + } + $dischargeArray=$db->getAdvice($pid); + while($t=$dischargeArray->fetchArray()){ + $discharge=$discharge."
    2. ".$t["drug"]." ".$t["dose"]." ".$t["route"]." ".$t["frequency"]." for ".$t["duration"]." ".$t["addl"]; + } + $deathArray=$db->getDeath($pid); + while($d=$deathArray->fetchArray()){ + $death=$death.viewData($d["data"]); + } +} +$treatments=$treatments."
    "; +$discharge=$discharge."
"; +?> + + + + + Print Data + + +
+

+ + Status: ".$status."

";?> + + + + +
+ +
+ +
+ +
+ + diff --git a/www/view.php b/www/view.php index 572c62c..6361fc8 100644 --- a/www/view.php +++ b/www/view.php @@ -123,7 +123,7 @@ if(isSet($_GET["pid"])){ - Transfer +

Transfer

@@ -144,6 +144,7 @@ if(isSet($_GET["pid"])){
+

Print Data