]> Softwares of Agnibho - simpleipd.git/blob - www/index.php
16844b2ad6243d7bdf2f325b4fe3bbf69e9e70bf
[simpleipd.git] / www / index.php
1 <?php
2 require(dirname(__DIR__)."/require.php");
3 if(!empty($_POST["req"])){
4 $db->receiveRequisition($_POST["req"]);
5 }
6 $list=$db->getAdmittedPatientList();
7 $showList="";
8 while($arr=$list->fetchArray()){
9 $pid=$arr["pid"];
10 $showList=$showList."<tr><td><a href='view.php?pid=".$pid."'>".$pid."</a></td><td>".$arr["ward"]."-".$arr["bed"]."</td><td>".$arr["name"]."</td><td>".$arr["diagnosis"]."</td></tr>";
11 }
12 $reqs=$db->getRequisitionList();
13 $showReqs="";
14 while($arr=$reqs->fetchArray()){
15 $pid=$arr["pid"];
16 if(!empty($arr["form"])){
17 if($arr["form"]=="report-cs"){
18 $test="<a href='vitek.php?pid=".$pid."&form=".$arr["form"]."&req=".$arr["rowid"]."&sample=".$arr["sample"]."&time=".$arr["time"]."&src=index'>".$arr["test"]."</a>";
19 if(checkAccess("report")=="all"){
20 $toReport="<a class='btn btn-sm btn-primary' href='vitek.php?pid=".$pid."&form=".$arr["form"]."&req=".$arr["rowid"]."&sample=".$arr["sample"]."&time=".$arr["time"]."&src=index'>Add Report</a>";
21 }
22 else{
23 $toReport="";
24 }
25 }
26 else{
27 $test="<a href='report.php?pid=".$pid."&form=".$arr["form"]."&req=".$arr["rowid"]."&sample=".$arr["sample"]."&time=".$arr["time"]."&src=index'>".$arr["test"]."</a>";
28 if(checkAccess("report")=="all"){
29 $toReport="<a class='btn btn-sm btn-primary' href='vitek.php?pid=".$pid."&form=".$arr["form"]."&req=".$arr["rowid"]."&sample=".$arr["sample"]."&time=".$arr["time"]."&src=index'>Add Report</a>";
30 $toReport="<a class='btn btn-sm btn-primary' href='report.php?pid=".$pid."&form=".$arr["form"]."&req=".$arr["rowid"]."&sample=".$arr["sample"]."&time=".$arr["time"]."&src=index'>Add Report</a>";
31 }
32 else{
33 $toReport="";
34 }
35 }
36 }
37 else{
38 $test="<a href='report.php?pid=".$pid."&form=report-other&req=".$arr["rowid"]."&src=index'>".$arr["test"]."</a>";
39 if(checkAccess("report")=="all"){
40 $toReport="<a class='btn btn-sm btn-primary' href='report.php?pid=".$pid."&form=report-other&req=".$arr["rowid"]."&src=index'>Add Report</a>";
41 }
42 else{
43 $toReport="";
44 }
45 }
46 if($arr["status"]=="received"){
47 $received="<span class='badge badge-success'>Sample Received</span>";
48 }
49 elseif(checkAccess("report")=="all"){
50 $received="<button class='btn btn-sm btn-outline-danger confirm' form='sample' name='req' value='".$arr["rowid"]."'>Receive Sample</button>";
51 }
52 else{
53 $received="<span class='badge badge-warning'>Sample Not Received</span>";
54 }
55
56 $showReqs=$showReqs."<tr class='room1' data-room='".$arr["room"]."'><td>".$test."</td><td>".$arr["sample"]."</td><td>".$arr["room"]."</td><td>".date("M j", $arr["time"])."</td><td><a href='view.php?pid=".$pid."' target='_blank'>".$pid." (".$db->getWard($pid)->fetchArray()["ward"]."-".$db->getBed($pid)->fetchArray()["bed"].")</a></td></tr><tr class='room2' data-room='".$arr["room"]."'><td></td><td colspan='2'>".$arr["addl"]."</td><td>".$received."</td><td>".$toReport."</td></tr>";
57 }
58 ?>
59 <!DOCTYPE html>
60 <html>
61 <head>
62 <?php include(CONFIG_LIB."head.php");?>
63 <title>View Info</title>
64 </head>
65 <body>
66 <div class="container">
67 <?php include(CONFIG_LIB."top.php");?>
68 <div class="card">
69 <div class="card-body">
70 <h4 class="card-title">Patient List</h4>
71 <table class="table">
72 <tr><th>Patient ID</th><th>Bed Number</th><th>Name</th><th>Diagnosis</th></tr>
73 <?php echo $showList;?>
74 </table>
75 <a class="btn btn-primary btn-lg" href="admission.php">Add New Patient</a>
76 <a href="archive.php" class="btn btn-outline-secondary float-right">Archive</a>
77 </div>
78 </div>
79 <div class="card">
80 <div class="card-body">
81 <h4 class="card-title">Requisition List</h4>
82 <div id="room-filter"><button class="btn btn-secondary m-2" data-room="all">All</button></div>
83 <form id="sample" method="post"></form>
84 <table class="table table-striped">
85 <tr><th>Test Needed</th><th>Sample</th><th>Place</th><th>Date</th><th>Patient ID</th></tr>
86 <?php echo $showReqs;?>
87 </table>
88 </div>
89 </div>
90 </div>
91 <?php include(CONFIG_LIB."foot.php");?>
92 <script>
93 var roomList=new Set();
94 $(document).ready(function(){
95 $(".room1").each(function(){
96 roomList.add($(this).data("room"));
97 });
98 roomName=roomList.entries();
99 for(const name of roomName){
100 if(name[0]){
101 $("#room-filter").html($("#room-filter").html()+"<button class='btn btn-outline-secondary m-2' data-room='"+name[0]+"'>"+name[0]+"</button>");
102 }
103 }
104 $("#room-filter").on("click", "button", function(){
105 $("#room-filter button").removeClass("btn-secondary");;
106 $("#room-filter button").addClass("btn-outline-secondary");;
107 $(this).removeClass("btn-outline-secondary");
108 $(this).addClass("btn-secondary");
109 room=$(this).data("room");
110 if(room=="all"){
111 $(".room1").show();
112 $(".room2").show();
113 }
114 else{
115 $(".room1").hide();
116 $(".room2").hide();
117 $(".room1").each(function(){
118 if($(this).data("room")==room){
119 $(this).show();
120 }
121 });
122 $(".room2").each(function(){
123 if($(this).data("room")==room){
124 $(this).show();
125 }
126 });
127 }
128 });
129 });
130 </script>
131 </body>
132 </html>