]>
Softwares of Agnibho - simpleipd.git/blob - www/printdata.php
2 require(dirname(__DIR__
)."/require.php");
6 $treatments="<h4>Treatment Received</h4><ol>";
7 $discharge="<h4>Advice on Discharge</h4><ol>";
8 $death="<h4>Medical Cause of Death</h4>";
11 $status=$db->getStatus($pid)->fetchArray()["status"];
12 $departure=$db->getDeparture($pid)->fetchArray()["departure"];
14 $history=viewData($db->getHistory($pid)->fetchArray()["history"]);
15 $physicianArray=$db->getAllData($pid, "physician");
16 while($c=$physicianArray->fetchArray()){
17 array_push($physician, viewData($c["data"]));
19 $nursingArray=$db->getAllData($pid, "nursing");
20 while($c=$nursingArray->fetchArray()){
21 array_push($nursing, viewData($c["data"]));
23 $reportsArray=$db->getAllData($pid, "reports");
24 while($r=$reportsArray->fetchArray()){
25 if(in_array($r["form"], ["report-as-grampos", "report-as-gramneg", "report-as-fungal"])){
26 array_push($reports, viewAntibiogram($r["data"]));
29 array_push($reports, viewData($r["data"]));
32 $treatmentArray=$db->getDrugs($pid);
33 while($t=$treatmentArray->fetchArray()){
35 if(!empty($t["start"])){
36 $start="from ".date("M j, Y", $t["start"]);
39 if(!empty($t["end"])){
40 $end="till ".date("M j, Y", $t["end"]);
43 if(!empty($t["addl"])){
44 $addl="(".$t["addl"].")";
46 $treatments=$treatments."<li>".$t["drug"]." ".$t["dose"]." ".$t["route"]." ".$t["frequency"]." ".$start." ".$end." ".$addl;
48 $dischargeArray=$db->getDischargeAdvice($pid);
49 while($t=$dischargeArray->fetchArray()){
50 $discharge=$discharge."<li>".$t["drug"]." ".$t["dose"]." ".$t["route"]." ".$t["frequency"]." for ".$t["duration"]." ".$t["addl"];
52 $deathArray=$db->getDeath($pid);
53 while($d=$deathArray->fetchArray()){
54 $death=$death.viewData($d["data"]);
58 foreach(glob("data/attachments/".str_replace("/", "", $pid)."-*") as $attach){
59 if(pathinfo($attach, PATHINFO_EXTENSION
)=="pdf"){
60 $pdfs=$pdfs."<a href='".$attach."' target='_blank'>".pathinfo($attach, PATHINFO_BASENAME
)."</a><br>";
63 preg_match("/-([0-9]+)-/", pathinfo($attach, PATHINFO_FILENAME
), $orig);
64 $imgs=$imgs."<figure><img class='w-100' src='".$attach."'><figcaption>Uploaded on: ".date("M d, Y h:i a", $orig[1])."</figcaption></figure>";
68 $treatments=$treatments."</ol>";
69 $discharge=$discharge."</ol>";
74 <?php
include(CONFIG_LIB
."head.php");?
>
75 <title
>Print Data
</title
>
78 <div
class="container">
79 <h2
><?php
echo CONFIG_TITLE
;?
></h2
>
80 <h4
><?php
echo "Patient Record";?
></h4
>
82 <?php
echo "<p><strong>Status: </strong>".$status."<br>";?
>
83 <?php
if(!empty($departure)) echo "(".date("M d, Y h:i a", $departure).")</p>"; ?
>
84 <?php
echo $history;?
>
85 <?php
foreach($physician as $p) echo $p;?
>
86 <?php
foreach($nursing as $n) echo $n;?
>
87 <?php
foreach($reports as $r) echo $r;?
>
89 <?php
echo $treatments;?
>
91 <?php
if($status=="expired"){ echo $death; } elseif($status=="discharged") { echo $discharge; }?
>
92 <p
class="mt-5"><small
><?php
echo "Data Retrieved on ".date("M d, Y H:i T", time())." from ".CONFIG_URL
;?
></small
></p
>
93 <div style
="page-break-before: always" <?php
if($imgs=="") echo "class='d-none'";?
>>
94 <h2
>Attached Images
</h2
>
98 <div
class="d-print-none <?php if($pdfs=="") echo "d
-none
";?>">
99 <h2
>Open Attached PDFs
</h2
>