-
Notifications
You must be signed in to change notification settings - Fork 3
/
patient-dash.php
294 lines (255 loc) · 14.8 KB
/
patient-dash.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
<?php
include 'assets/php/config.php';
include 'assets/php/logincheck.php';
if($_SESSION['isDoc']==true){
die("Doctors can't Acess this dashboard. Try acessing via Doctor Dashboard");
}
$pid=$_SESSION['p_id'];
$sql = "SELECT * FROM `patient` WHERE `p_id` =".$pid.";";
$result = mysqli_query($conn, $sql);
$resultCheck = mysqli_num_rows($result);
if($resultCheck>0){
$row = mysqli_fetch_assoc($result);
$name= $row['name'];
$age = $row['age'];
$gender = $row['gender'];
$dob = $row['dob'];
}
$sql2 = "SELECT * FROM `prescription` WHERE `pid` =".$pid." ORDER BY `date` DESC;";
$result2 = mysqli_query($conn, $sql2);
$resultCheck2 = mysqli_num_rows($result2);
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="https://code.jquery.com/jquery-3.4.1.slim.min.js" integrity="sha384-J6qa4849blE2+poT4WnyKhv5vZF5SrPo0iEjwBvKU7imGFAV0wwj1yYfoRSJoZ+n" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js" integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js" integrity="sha384-wfSDF2E50Y2D1uUdj0O3uMBJnjuUD4Ih7YwaYd1iqfktj0Uod8GCExl3Og8ifwB6" crossorigin="anonymous"></script>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous">
<link rel="stylesheet" href="assets/css/dashstyle.css">
<title>Dashboard</title>
<link rel="icon" href="assets/img/title-icon.png">
</head>
<body>
<div class="wrapper">
<!-- Sidebar -->
<nav id="sidebar">
<div class="sidebar-header">
<p class="font-weight-bold text-light govtText" >Doctor X's Clinic</p>
<h3 class="text-center"><?php echo $name ?>'s Dashboard</h3>
</div>
<ul class="list-unstyled components">
<li>
<a href=""><?php echo $name ?>'s Dashboard</a>
</li>
<li class="active">
<a href="logout">Log out</a>
</li>
</ul>
</nav>
<div class="container-fluid p-0 dashboard-content">
<h1 class="bg-primary text-light p-3">
<div id="sidebarCollapse">
<img src="assets/img/menu.svg" alt="">
</div>
<?php echo $name ?></h1>
<div class="row p-3">
<div class="col col-12 col-md-11 col-lg-10 mx-auto mb-3">
<div class="card">
<div class="row">
<div class="col-12 col-lg-4 border-right">
<div class="col-10 mx-auto p-3">
<img src="assets/img/naseem.jpg" alt="" class="dp rounded-circle img-thumbnail">
<h4 class="mx-auto font-weight-bold text-center"><?php echo $name ?></h4>
<p class="name text-dark my-2 mx-auto text-center"><?php echo "P ID : ".$pid ?></p>
</div>
</div>
<div class="col-lg-8 border-left">
<div class="row mt-3">
<div class="col-md-6 col-lg-4 py-3 my-3 mx-auto text-center text-lg-left">
<h5>Gender</h5>
<p><?php echo $gender ?></p>
</div>
<div class="col-md-6 col-lg-4 py-3 my-3 mx-auto text-center text-lg-left">
<h5>DOB</h5>
<p><?php echo $dob ?></p>
</div>
<div class="col-md-6 col-lg-4 py-3 my-3 mx-auto text-center text-lg-left">
<h5>Phone</h5>
<p>2389798237</p>
</div>
<div class="col-md-6 col-lg-4 py-3 my-3 mx-auto text-center text-lg-left">
<h5>Patient ID</h5>
<p><?php echo $pid ?></p>
</div>
<div class="col-md-6 col-lg-4 py-3 my-3 mx-auto text-center text-lg-left">
<h5>Status</h5>
<p>Active</p>
</div>
<div class="col-md-6 col-lg-4 py-3 my-3 mx-auto text-center text-lg-left">
<h5>Age</h5>
<p><?php echo $age ?></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="row p-3">
<div class="col col-12 col-lg-6 col-md-12 mx-auto mt-3 mb-3">
<div class="card">
<h2 class="m-1 p-2 text-center font-weight-bold">Last Precription</h2>
<hr>
<?php
if($resultCheck2>0){
for ($x = 0; $x < $resultCheck2; $x++) {
$row2 = mysqli_fetch_assoc($result2);
if($x==0){
echo "<div class='row rounded bg-light m-2 p-1 shadow'>
<div class='col col-11 col-sm-11 col-md-5 flex'>
<h5 class='p-1 m-2 bg-dark rounded text-white shadow'>{$row2['date']}</h5>
</div>
<div class='col col-12 flex '>
<p class='font-weight-bold text-dark text-break'>
{$row2['prescription']}
</p>
</div>
</div>";
}else{
echo "<div class='row rounded bg-light m-2 p-1 collapse shadow' id='collapsePrescription'>
<div class='col col-11 col-sm-11 col-md-5 flex'>
<h5 class='p-1 m-2 bg-dark rounded text-white shadow'>{$row2['date']}</h5>
</div>
<div class='col col-12 flex '>
<p class='font-weight-bold text-dark text-break'>
{$row2['prescription']}
</p>
</div>
</div>";
}
}
$row2=null;
} else{
echo '<div class="alert alert-secondary m-2" role="alert">
No prescriptions Found
</div>';
}
?>
<div class="row">
<div class="col">
<a class="btn btn-primary m-2 float-right" id="prescriptionButton" data-toggle="collapse" href="#collapsePrescription" role="button" aria-expanded="false" aria-controls="collapseExample">
Show all prescriptions
</a>
</div>
</div>
</div>
</div>
<div class="col col-12 col-lg-6 col-md-12 mx-auto mt-3 mb-3">
<div class="card">
<h2 class="m-1 p-2 text-center font-weight-bold">Last Medical Report</h2>
<hr>
<?php
$result2 = mysqli_query($conn, $sql2);
$resultCheck2 = mysqli_num_rows($result2);
if($resultCheck2>0){
for ($x = 0; $x < $resultCheck2; $x++) {
$row2 = mysqli_fetch_assoc($result2);
if($x==0){
echo "<div class='row rounded bg-light m-2 p-1 shadow'>
<div class='col col-11 col-sm-11 col-md-5 flex'>
<h5 class='p-1 m-2 bg-dark rounded text-white shadow'>{$row2['date']}</h5>
</div>
<div class='col col-12 flex '>
<p class='font-weight-bold text-dark text-break'>
{$row2['report']}
</p>
</div>
</div>";
}else{
echo "<div class='row rounded bg-light m-2 p-1 collapse shadow' id='collapseReport'>
<div class='col col-11 col-sm-11 col-md-5 flex'>
<h5 class='p-1 m-2 bg-dark rounded text-white shadow'>{$row2['date']}</h5>
</div>
<div class='col col-12 flex '>
<p class='font-weight-bold text-dark text-break'>
{$row2['report']}
</p>
</div>
</div>";
}
}
} else{
echo '<div class="alert alert-secondary m-2" role="alert">
No prescriptions Found
</div>';
}
?>
<!-- <div class="row rounded bg-light m-2 p-1 shadow">
<div class="col col-11 col-sm-11 col-md-5 flex">
<h5 class="p-1 m-2 bg-dark rounded text-white shadow">12/03/2020</h5>
</div>
<div class="col col-lg-10 flex ">
<p class="font-weight-bold text-dark text-break">sjnjsnzjn,sahdbasbkdb,sadbkjaszjkdn,slzdnlkasnz,skjjbdcj,sdbckjsd
dskfclksdlknclksndlkc,
sdkclskdzlkfcs,
'dzxckjskjdnvkjsn'
</p>
</div>
</div>
<div class="row rounded bg-light m-2 p-1 collapse shadow" id="collapseReport">
<div class="col col-11 col-sm-11 col-md-5 flex">
<h5 class="p-1 m-2 bg-dark rounded text-white shadow">12/03/2020</h5>
</div>
<div class="col col-lg-10 flex ">
<p class="font-weight-bold text-dark text-break">sjnjsnzjn,sahdbasbkdb,sadbkjaszjkdn,slzdnlkasnz,skjjbdcj,sdbckjsd
dskfclksdlknclksndlkc,
sdkclskdzlkfcs,
'dzxckjskjdnvkjsn'
</p>
</div>
</div> -->
<div class="row">
<div class="col">
<a class="btn btn-primary m-2 float-right" id="reportButton" data-toggle="collapse" href="#collapseReport" role="button" aria-expanded="false" aria-controls="collapseExample">
Show all medical reports
</a>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<script>
$(document).ready(function () {
$('#sidebarCollapse').on('click', function () {
$('#sidebar').toggleClass('active');
});
});
//script to change button text
const button1 = document.getElementById("prescriptionButton");
button1.addEventListener('click', function () {
console.log("Inside");
const prescription = document.getElementById("collapsePrescription");
if (prescription.classList.contains("show")) {
button1.textContent = "Show all prescriptions";
} else {
button1.textContent = "Hide all prescriptions";
}
});
const button2 = document.getElementById("reportButton");
button2.addEventListener('click', function () {
console.log("Inside");
const prescription = document.getElementById("collapseReport");
if (prescription.classList.contains("show")) {
button2.textContent = "Show all medical reports";
} else {
button2.textContent = "Hide all medical reports";
}
});
</script>
</body>
</html>