-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathnurses_patients.php
256 lines (241 loc) · 8.89 KB
/
nurses_patients.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
<?php
require_once "./connect.php";
require_once "./auth.php";
if($access_level == 1) {
header("Location: ./login.php");
}
header("Cache-Control: no-cache, no-store, must-revalidate"); // HTTP 1.1.
header("Pragma: no-cache"); // HTTP 1.0.
header("Expires: 0");
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, shrink-to-fit=no">
<!-- Cache -->
<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
<meta http-equiv="Pragma" content="no-cache" />
<meta http-equiv="Expires" content="0" />
<!-- Icons-->
<link href="./css/icons/simple-line-icons.css" rel="stylesheet"/>
<link href="./css/icons/font-awesome.min.css" rel="stylesheet"/>
<!-- Styles -->
<link href="./css/style.css" rel="stylesheet"/>
<title>Patients</title>
</head>
<body class="app header-fixed sidebar-fixed">
<header class="app-header navbar">
<button class="navbar-toggler sidebar-toggler d-lg-none mr-auto" type="button" data-toggle="sidebar-show">
<span class="navbar-toggler-icon"></span>
</button>
<a class="navbar-brand" href="./index.php">
<img class="navbar-brand-full" src="img/logo.svg" width="89" height="25" alt="Clinic Logo">
<img class="navbar-brand-minimized" src="img/sygnet.svg" width="30" height="30" alt="Clinic Logo">
</a>
<button class="navbar-toggler sidebar-toggler d-md-down-none" type="button" data-toggle="sidebar-lg-show">
<span class="navbar-toggler-icon"></span>
</button>
<?php if ($access_level == 1) {
// Navbar for doctors
?>
<ul class="nav navbar-nav d-md-down-none">
<li class="nav-item px-3">
<a class="nav-link" href="./doctors_patients.php">Dashboard</a>
</li>
<li class="nav-item px-3">
<a class="nav-link" href="./equipment.php">Equipment</a>
</li>
<li class="nav-item px-3">
<a class="nav-link" href="./available_medications.php">Medications</a>
</li>
<li class="nav-item px-3">
<a class="nav-link" href="./treat.php">Treatments</a>
</li>
<li class="nav-item px-3">
<a class="nav-link" href="./available_doctors.php">Doctors</a>
</li>
</ul>
<?php } else if ($access_level == 2) {
// Navbar for nurses
?>
<ul class="nav navbar-nav d-md-down-none">
<li class="nav-item px-3">
<a class="nav-link" href="./nurses_patients.php">Dashboard</a>
</li>
<li class="nav-item px-3">
<a class="nav-link" href="./nurse_edit_rooms.php">Rooms</a>
</li>
<li class="nav-item px-3">
<a class="nav-link" href="./available_medications.php">Medications</a>
</li>
<li class="nav-item px-3">
<a class="nav-link" href="./add_patient.php">New Patient</a>
</li>
<li class="nav-item px-3">
<a class="nav-link" href="./available_doctors.php">Doctors</a>
</li>
</ul>
<?php } else {
// If for some reason another access level is found
header("Location: ./logout.php");
} ?>
<ul class="nav navbar-nav ml-auto">
<li class="nav-item dropdown">
<a class="nav-link" data-toggle="dropdown" href="#" role="button" aria-haspopup="true" aria-expanded="false">
<img class="img-avatar" src=<?php echo ($gender == 'M') ? "img/avatar_m.png" : "img/avatar_f.png";?> alt="Profile">
</a>
<div class="dropdown-menu dropdown-menu-right">
<div class="dropdown-header text-center">
<strong>Account</strong>
</div>
<a class="dropdown-item disabled" href="#">
<i class="fa fa-user"></i> Welcome <?php echo $name; ?>
</a>
<a class="dropdown-item" href="./logout.php">
<i class="fa fa-lock"></i> Logout</a>
</div>
</li>
</ul>
</header>
<div class="app-body">
<div class="sidebar">
<nav class="sidebar-nav">
<ul class="nav">
<?php if ($access_level == 1) {
// Sidebar for doctors
?>
<li class="nav-item">
<a class="nav-link" href="./doctors_patients.php">
<i class="nav-icon fa fa-procedures"></i> Dashboard
</a>
</li>
<li class="nav-item">
<a class="nav-link" href="./equipment.php">
<i class="nav-icon fa fa-x-ray"></i> Equipment
</a>
</li>
<li class="nav-item">
<a class="nav-link" href="./available_medications.php">
<i class="nav-icon fa fa-briefcase-medical"></i> Medications
</a>
</li>
<li class="nav-item">
<a class="nav-link" href="./treat.php">
<i class="nav-icon fa fa-stethoscope"></i> Treatments
</a>
</li>
<li class="nav-item">
<a class="nav-link" href="./available_doctors.php">
<i class="nav-icon fa fa-user-md"></i> Doctors
</a>
</li>
<?php } else if ($access_level == 2) {
// Sidebar for nurses
?>
<li class="nav-item">
<a class="nav-link" href="./nurses_patients.php">
<i class="nav-icon fa fa-procedures"></i> Dashboard
</a>
</li>
<li class="nav-item">
<a class="nav-link" href="./nurse_edit_rooms.php">
<i class="nav-icon fa fa-hospital"></i> Rooms
</a>
</li>
<li class="nav-item">
<a class="nav-link" href="./available_medications.php">
<i class="nav-icon fa fa-briefcase-medical"></i> Medications
</a>
</li>
<li class="nav-item">
<a class="nav-link" href="./add_patient.php">
<i class="nav-icon fa fa-ambulance"></i> New Patient
</a>
</li>
<li class="nav-item">
<a class="nav-link" href="./available_doctors.php">
<i class="nav-icon fa fa-user-md"></i> Doctors
</a>
</li>
<?php } else {
// If for some reason another access level is found
header("Location: ./logout.php");
} ?>
</ul>
</nav>
</div>
<br>
<main class="main">
<ol class="breadcrumb" style="padding: 0; border: none;">
</ol>
<div class="container-fluid">
<div class="card">
<div class="card-header">My Patients</div>
<div class="card-body">
<table class="table table-responsive-sm table-striped">
<thead>
<tr>
<th>Patient Code</th>
<th>Name</th>
<th>SSN</th>
<th>Gender</th>
<th>Blood Type</th>
<th>Patient Room</th>
<th>Admission Date</th>
<th>Admission Reason</th>
<th>Contact's Name</th>
<th>Contact's Relationship</th>
<th>Contact's Phone</th>
</tr>
</thead>
<tbody>
<?php
try{
$dbconnect = new Connection();
$db = $dbconnect->openConnection();
}catch(PDOException $error){
echo "<p id='connerror'>A connection error has occured.<br>Please contact us.<br>Error code: </p>" . $error->getMessage();
$dbconnect->closeConnection();
}
$query = $db->prepare("SELECT p.patient_code, p.name as pname, p.surname as psurname, p.amka, p.gender, p.blood_type, p.patient_room, p.admission_date, p.admission_reason, ec.name as ecname, ec.surname as ecsurname, ec.relationship as ecrelationship, ec.telephone as ectelephone
FROM responsibles r, patients p
LEFT JOIN emergency_contacts ec
ON ec.cont_patient_code = p.patient_code
WHERE r.room_clinic_id = p.patient_clinic_id AND r.nurse_id = :nID AND r.room_number = p.patient_room AND p.discharge_date IS NULL;");
$query->execute(['nID' => $user_id]);
$result = $query->fetchAll(PDO::FETCH_ASSOC);
foreach ($result as $index=>$row) {
echo "<tr>" .
"<td>" . $row['patient_code'] . "</td>" .
"<td>" . $row['pname'] . " " . $row['psurname'] . "</td>" .
"<td>" . $row['amka'] . "</td>" .
"<td>" . $row['gender'] . "</td>" .
"<td>" . $row['blood_type'] . "</td>" .
"<td>" . $row['patient_room'] . "</td>".
"<td>" . $row['admission_date'] . "</td>".
"<td>" . $row['admission_reason'] . "</td>".
"<td>" . $row['ecname'] . " " . $row['ecsurname'] . "</td>" .
"<td>" . $row['ecrelationship'] . "</td>" .
"<td>" . $row['ectelephone'] . "</td>";
echo "</tr>";
}
?>
</tbody>
</table>
</div>
</div>
</main>
</div>
<footer class="app-footer">
<div>
<a>Databases Team 5</a>
<span>© 2019-2020</span>
</div>
<div class="ml-auto">
<span>Powered by</span>
<a href="https://coreui.io">CoreUI</a>
</div>
</footer>
</body>
</html>