forked from Anthonyk3801/Elderly-Care-Management-System
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdoctorHome.php
More file actions
175 lines (155 loc) · 4.88 KB
/
doctorHome.php
File metadata and controls
175 lines (155 loc) · 4.88 KB
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
<?php
session_start();
/*if(!isset($_SESSION['level'])) header('location:home.php');
if(isset($_SESSION['level'])){
if($_SESSION['level'] != 3) header('location:extras/transfer.php');
};
if($_GET['error'] == 2) echo "You are not authorized for that page";
*/
include 'db_connection.php';
$date = date('Y-m-d');
if(isset($_POST['create'])){
//$doctor = $_POST['doctorID'];
$patient = $_POST['patientID'];
$date = $_POST['date'];
$comment = $_POST['comment'];
$morningMed = $_POST['morningMed'];
$lunchMed = $_POST['lunchMed'];
$nightMed = $_POST['nightMed'];
//$attendance = $_POST['attendance'];
$sql = "UPDATE DoctorAppointments
SET comment = '$_POST[comment]', morningMed = '$_POST[morningMed]', lunchMed = '$_POST[lunchMed]', nightMed = '$_POST[nightMed]', attendance = 1
WHERE patientID = $_POST[patientID] AND date = '$_POST[date]'";
if ($conn->query($sql) === TRUE) {
echo "File Updated";
} else {
echo "Error: " . $sql . "<br>" . $conn->error;
}
};
?>
<?php //TEMPLATES
include 'templates/header.html';
switch($_SESSION['level']) {
case '1':
include 'templates/main-nav-bar.php';
include 'templates/main-grid-content-2columns.html';
include 'templates/admin-side-bar.html';
break;
case '2':
include 'templates/main-nav-bar.php';
include 'templates/main-grid-content-2columns.html';
include 'templates/supervisor-side-bar.html';
break;
case '3':
include 'templates/main-nav-bar.php';
include 'templates/main-grid-content-2columns.html';
include 'templates/doctor-side-bar.html';
break;
case '4':
include 'templates/main-nav-bar.php';
include 'templates/main-grid-content-2columns.html';
include 'templates/caregiver-side-bar.html';
break;
case '5':
include 'templates/main-nav-bar.php';
include 'templates/main-grid-content-2columns.html';
include 'templates/patient-side-bar.html';
break;
case '6':
include 'templates/main-nav-bar.php';
include 'templates/main-grid-content-2columns.html';
include 'templates/familyMember-side-bar.html';
break;
default:
include 'templates/alert-message-before-login.html';
include 'templates/home-nav-bar.html';
include 'templates/main-grid-content-1column.html';
}
include 'templates/main-content.html';
?>
<head>
<link rel="stylesheet" href="CSS/doctorHomeStyle.css">
</head>
<h1 class="text-center">Doctor's Home</h1>
<hr>
<div class="mb-5 mt-5 text-center">
<form action="doctorHome.php" method="POST">
<button class="w-75 btn btn-sm btn-info text-light mt-4" type="submit" value="Old Appointment" name="search">Old Appointment</button>
</form>
<?php
if(isset($_POST['search'])){
$search = $_POST['search'];
$sql = "SELECT *, Patient.fName, Patient.lName
FROM DoctorAppointments
INNER JOIN Patient
WHERE Patient.patientID = DoctorAppointments.patientID AND date < '$date'";
$result = $conn->query($sql);
$res = $result->fetch_assoc();
?>
<table>
<tr>
<th>Patient Name</th>
<th>Date</th>
<th>Comment</th>
<th>Morning Med </th>
<th>Afternoon Med</th>
<th>Night Med</th>
</tr>
<form method="post" action="patientDoctor.php">
<?php
while($res = mysqli_fetch_array($result)) {
echo "<tr>";
echo "<td>".$res['fName']. " " .$res['lName']."</td>";
if(isset($res['date'])){
echo "<td> Appointment Date: " . $res['date'] . " </td>";
}else{
echo "<td> No Appointment </td>";
}
echo "<td>".$res['comment']."</td>";
echo "<td>".$res['morningMed']."</td>";
echo "<td>".$res['lunchMed']."</td>";
echo "<td>".$res['nightMed']."</td>";
}
}
?>
</form>
</table>
<form action="doctorHome.php" method="POST">
<button class="w-75 btn btn-sm btn-info text-light mt-4" type="submit" value="New Appointment" name="submit">New Appointment</button>
</form>
<?php
if(isset($_POST['submit'])){
$submit = $_POST['submit'];
$sql = "SELECT *, Patient.fName, Patient.lName
FROM DoctorAppointments
INNER JOIN Patient
WHERE Patient.patientID = DoctorAppointments.patientID AND date >= '$date'";
$result = $conn->query($sql);
?>
<table>
<th> </th>
<th>Patient Name</th>
<th>Date</th>
</tr>
<form method="post" action="patientDoctor.php">
<?php
while($res = mysqli_fetch_array($result)) {
echo "<tr>";?>
<td>
<button type="submit" id="con" name="con" value="<?php echo $res['patientID']." " .$res['date']; ?>">Continue</button></td>
<?php echo "<td>".$res['fName']. " " .$res['lName']."</td>";
if(isset($res['date'])){
echo "<td> Appointment Date: " . $res['date'] . " </td>";
}else{
echo "<td> No Appointment </td>";
}
}
}
?>
</form>
</table>
</div>
<?php // TEMPLATES
include 'templates/end-main-content.html';
include 'templates/footer.html';
?>