-
Notifications
You must be signed in to change notification settings - Fork 0
/
patient_dashboard.php
229 lines (206 loc) · 8.34 KB
/
patient_dashboard.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
<?php
session_start();
require_once 'db_config.php';
// Ensure the user is logged in and has the role of Patient
if (!isset($_SESSION['role']) || $_SESSION['role'] !== 'Patient') {
header('Location: login.html');
exit();
}
$email = $_SESSION['user_email'];
// Create the connection
$conn = new mysqli(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME);
// Check the connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
// Fetch patient information
$stmt = $conn->prepare("SELECT AT, FirstName, LastName FROM xristis WHERE Email = ?");
$stmt->bind_param("s", $email);
$stmt->execute();
$stmt->bind_result($patientAT, $firstName, $lastName);
$stmt->fetch();
$stmt->close();
?>
<!doctype html>
<html class="no-js" lang="zxx">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>Patient Dashboard - Mediplus</title>
<link rel="stylesheet" href="css/bootstrap.min.css">
<link rel="stylesheet" href="css/font-awesome.min.css">
<link rel="stylesheet" href="css/icofont.css">
<link rel="stylesheet" href="css/style.css">
</head>
<body>
<!-- Header Area -->
<header class="header">
<div class="header-inner">
<div class="container">
<div class="inner">
<div class="row">
<div class="col-lg-3 col-md-3 col-12">
<!-- Logo -->
<div class="logo">
<a href="index.html"><img src="img/logo.png" alt="#"></a>
</div>
</div>
<div class="col-lg-7 col-md-9 col-12">
<div class="main-menu">
<nav class="navigation">
</nav>
<div class="nav-separator"></div>
</div>
</div>
<div class="col-lg-2 col-12">
<div class="get-quote">
<a href="logout.php" class="btn">Logout</a>
</div>
</div>
</div>
</div>
</div>
</div>
</header>
<!-- End Header Area -->
<!-- Profile Section -->
<section class="profile section">
<div class="container">
<div class="section-title">
<h2>Προφίλ Ασθενούς</h2>
</div>
<div class="row">
<div class="col-lg-6 col-md-12 col-12">
<div class="profile-info">
<h3>Στοιχεία Προφίλ</h3>
<p><strong>Όνομα:</strong> <?php echo $firstName . " " . $lastName; ?></p>
<p><strong>Email:</strong> <?php echo $email; ?></p>
<a href="edit_profile.php" class="btn primary">Επεξεργασία Προφίλ</a>
</div>
</div>
</div>
</div>
</section>
<!-- Appointments Section -->
<section class="appointments section">
<div class="container">
<div class="section-title">
<h2>Τα Ραντεβού Μου</h2>
</div>
<div class="table-responsive">
<table class="table table-bordered">
<thead>
<tr>
<th>Ημερομηνία</th>
<th>Ώρα</th>
<th>Περιγραφή</th>
<th>Κατάσταση</th>
<th>Ενέργειες</th>
</tr>
</thead>
<tbody>
<?php
// Fetch appointments for the logged-in patient
$stmt = $conn->prepare("
SELECT r.id_appointment, r.a_date, r.a_time, r.a_desc, r.a_state
FROM rantevou r
JOIN books b ON r.id_appointment = b.id_appointment
WHERE b.AT = ?");
$stmt->bind_param("s", $patientAT);
$stmt->execute();
$stmt->store_result();
$stmt->bind_result($id_appointment, $date, $time, $desc, $state);
if ($stmt->num_rows > 0) {
while ($stmt->fetch()) {
echo "<tr>
<td>{$date}</td>
<td>{$time}</td>
<td>{$desc}</td>
<td>{$state}</td>
<td>
<a href='edit_appointment.php?id={$id_appointment}' class='btn'>Επεξεργασία</a> |
<a href='delete_appointment.php?id={$id_appointment}' class='btn btn-danger'>Ακύρωση</a>
</td>
</tr>";
}
} else {
echo "<tr><td colspan='5' class='text-center'>Δεν βρέθηκαν ραντεβού</td></tr>";
}
$stmt->close();
?>
</tbody>
</table>
</div>
<!-- Κουμπί για αναζήτηση ραντεβού -->
<a href="search_appointments_criteria.php" class="btn btn-primary">Αναζήτηση Ραντεβού</a>
<a href="create_appointment.php" class="btn btn-primary">Δημιουργία Νέου Ραντεβού</a>
</div>
</section>
<!-- Medical History Section -->
<section class="history section">
<div class="container">
<div class="section-title">
<h2>Ιατρικό Ιστορικό</h2>
</div>
<div class="row">
<?php
// Fetch medical history for the patient
$stmt_history = $conn->prepare("SELECT id_entry, e_doc, e_healthproblems, e_cure FROM eggrafi WHERE id_entry = ?");
$stmt_history->bind_param("s", $patientAT);
$stmt_history->execute();
$stmt_history->store_result();
$stmt_history->bind_result($id_entry, $doc, $problems, $cure);
if ($stmt_history->num_rows > 0) {
while ($stmt_history->fetch()) {
echo "<div class='col-lg-6 col-md-12'>
<div class='history-entry card mb-4'>
<div class='card-header'>
<h4 class='card-title'>Καταχώρηση Ιστορικού: {$id_entry}</h4>
</div>
<div class='card-body'>
<p><strong>Γιατρός:</strong> {$doc}</p>
<p><strong>Προβλήματα Υγείας:</strong> {$problems}</p>
<p><strong>Θεραπεία:</strong> {$cure}</p>
</div>
<div class='card-footer'>
<button class='btn btn-primary'>Λεπτομέρειες</button>
<button class='btn btn-secondary'>Επεξεργασία</button>
</div>
</div>
</div>";
}
} else {
echo "<div class='col-12'><p>Δεν βρέθηκαν καταχωρήσεις στο ιστορικό.</p></div>";
}
$stmt_history->close();
?>
</div>
</div>
</section>
<!-- Footer Area -->
<footer id="footer" class="footer">
<div class="footer-top">
<div class="container">
<div class="row">
<div class="col-lg-3 col-md-6 col-12">
<div class="single-footer footer-contact">
<h2>Επικοινωνία</h2>
<p>Επικοινωνήστε μαζί μας για οποιαδήποτε απορία ή ζήτηση για ραντεβού.</p>
<p><i class="icofont-phone"></i> +30 210 1234567</p>
</div>
</div>
</div>
</div>
</div>
</footer>
<!-- End Footer -->
<!-- Scripts -->
<script src="js/jquery.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<script src="js/main.js"></script>
</body>
</html>
<?php
$conn->close();
?>