]> Softwares of Agnibho - simpleipd.git/blob - www/printdata.php
Minor
[simpleipd.git] / www / printdata.php
1 <?php
2 require(dirname(__DIR__)."/require.php");
3 $physician=[];
4 $nursing=[];
5 $reports=[];
6 $treatments="<h4>Treatment Received</h4><ol>";
7 $discharge="<h4>Advice on Discharge</h4><ol>";
8 $death="<h4>Medical Cause of Death</h4>";
9 if($_GET["pid"]){
10 $pid=$_GET["pid"];
11 $status=$db->getStatus($pid)->fetchArray()["status"];
12 $info=getInfo($pid);
13 $history=viewData($db->getHistory($pid)->fetchArray()["history"]);
14 $physicianArray=$db->getAllData($pid, "physician");
15 while($c=$physicianArray->fetchArray()){
16 array_push($physician, viewData($c["data"]));
17 }
18 $nursingArray=$db->getAllData($pid, "nursing");
19 while($c=$nursingArray->fetchArray()){
20 array_push($nursing, viewData($c["data"]));
21 }
22 $reportsArray=$db->getAllData($pid, "reports");
23 while($r=$reportsArray->fetchArray()){
24 if(in_array($r["form"], ["report-as-grampos", "report-as-gramneg", "report-as-fungal"])){
25 array_push($reports, viewAntibiogram($r["data"]));
26 }
27 else{
28 array_push($reports, viewData($r["data"]));
29 }
30 }
31 $treatmentArray=$db->getDrugs($pid);
32 while($t=$treatmentArray->fetchArray()){
33 $start="";
34 if(!empty($t["start"])){
35 $start="from ".date("M j, Y", $t["start"]);
36 }
37 $end="";
38 if(!empty($t["end"])){
39 $end="till ".date("M j, Y", $t["end"]);
40 }
41 $addl="";
42 if(!empty($t["addl"])){
43 $addl="(".$t["addl"].")";
44 }
45 $treatments=$treatments."<li>".$t["drug"]." ".$t["dose"]." ".$t["route"]." ".$t["frequency"]." ".$start." ".$end." ".$addl;
46 }
47 $dischargeArray=$db->getAdvice($pid);
48 while($t=$dischargeArray->fetchArray()){
49 $discharge=$discharge."<li>".$t["drug"]." ".$t["dose"]." ".$t["route"]." ".$t["frequency"]." for ".$t["duration"]." ".$t["addl"];
50 }
51 $deathArray=$db->getDeath($pid);
52 while($d=$deathArray->fetchArray()){
53 $death=$death.viewData($d["data"]);
54 }
55 }
56 $treatments=$treatments."</ol>";
57 $discharge=$discharge."</ol>";
58 ?>
59 <!DOCTYPE html>
60 <html>
61 <head>
62 <?php include(CONFIG_LIB."head.php");?>
63 <title>Print Data</title>
64 </head>
65 <body>
66 <div class="container">
67 <h2><?php echo CONFIG_TITLE;?></h2>
68 <h4><?php echo "Patient Record";?></h4>
69 <?php echo $info;?>
70 <?php echo "<p><strong>Status: </strong>".$status."</p>";?>
71 <?php echo $history;?>
72 <?php foreach($physician as $p) echo $p;?>
73 <?php foreach($nursing as $n) echo $n;?>
74 <?php foreach($reports as $r) echo $r;?>
75 <hr>
76 <?php echo $treatments;?>
77 <hr>
78 <?php if($status=="expired"){ echo $death; } else { echo $discharge; }?>
79 <hr>
80 <?php echo "Retrieved on: ".date("M d, Y H:i T", time());?>
81 </div>
82 </body>
83 </html>