forked from Anthonyk3801/Elderly-Care-Management-System
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfamilyMemberHome.php
More file actions
185 lines (166 loc) · 7.3 KB
/
familyMemberHome.php
File metadata and controls
185 lines (166 loc) · 7.3 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
176
177
178
179
180
181
182
183
184
185
<?php
session_start();
/*if(!isset($_SESSION['level'])) header('location:home.php');
if(isset($_SESSION['level'])){
if($_SESSION['level'] != 6) header('location:extras/transfer.php');
};
if($_GET['error'] == 2) echo "You are not authorized for that page";
*/
include 'db_connection.php';
$caregiver = "";
$doctor = "";
if(isset($_POST['search'])) {
$sql = "SELECT * FROM PatientChecklist WHERE date='$_POST[date]' AND patientID=$_POST[patientID];";
$result = $conn->query($sql);
$cnt = mysqli_num_rows($result);
if ( 0===$cnt ) {
echo "<p style='color:red;'>Wrong PatientID or Family Code</p>";
}else {
$checklist = $result->fetch_assoc();
$sql = "SELECT * FROM Patient WHERE patientID=$_POST[patientID]";
$result = $conn->query($sql);
$patient = $result->fetch_assoc();
$group = $patient['groupID'];
$sql = "SELECT * FROM Roster WHERE date='$_POST[date]'";
$result = $conn->query($sql);
$roster = $result->fetch_assoc();
if($group == 1) $careID = $roster['careGiver1'];
if($group == 2) $careID = $roster['careGiver2'];
if($group == 3) $careID = $roster['careGiver3'];
if($group == 4) $careID = $roster['careGiver4'];
$doctorID = $roster['doctorID'];
$sql = "SELECT * FROM Employee WHERE employeeID = $doctorID";
$result = $conn->query($sql);
$employee = $result->fetch_assoc();
$doctor = $employee['fName'] . " " . $employee['lName'];
$sql = "SELECT * FROM Employee WHERE employeeID = $careID";
$result = $conn->query($sql);
$employee2 = $result->fetch_assoc();
$caregiver = $employee2['fName'] . " " . $employee2['lName'];
$sql = "SELECT * FROM DoctorAppointments WHERE patientID = $_POST[patientID] AND date = '$_POST[date]'";
$result = $conn->query($sql);
$appoint = $result->fetch_assoc();
}
}
?>
<?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';
?>
<!-- <link rel="stylesheet" href="CSS/patientStyles.css"> -->
<head>
<link rel="stylesheet" href="CSS/familyMemberHome.css">
</head>
<h1 class="text-center pb-5">Family Member’s Home</h1>
<hr>
<div class="m-5 p-5 text-dark text-center p-5">
<form action="familyMemberHome.php" method="post">
<label for="familyCode">Family Code: </label>
<input class="text-center" type="number" name="familyCode" id="familyCode" max=999 required value=<?php echo (isset($_POST['search'])) ? $_POST['familyCode']:"";?>>
<label for="patientID">Patient ID: </label>
<input class="text-center" type="number" name="patientID" id="patientID" max=99999 required value=<?php echo (isset($_POST['search'])) ? $_POST['patientID']:"";?>>
<label for="date">Date: </label>
<input class="text-end" type="date" name="date" id="date" required value=<?php if(isset($_POST['search'])) echo $_POST['date'];?>>
<button class="btn btn-sm btn-info text-light mt-0 mb-1" type="submit" name="search" id="search" value="SEARCH">Search</button>
<button class="btn btn-sm btn-secondary text-light mt-0 mb-1" type="reset">Cancel</button>
</form>
</div>
<div class="m-5 p-5 text-dark text-center">
<table>
<tr>
<th class="p-3">Patient Name</th>
<th class="p-3">Doctor Name</th>
<th class="p-3">Caregiver Name</th>
<th class="p-3">Doctor Appointment</th>
<th class="p-3">Breakfast</th>
<th class="p-3">Morning Med</th>
<th class="p-3">Lunch</th>
<th class="p-3">Lunch Med</th>
<th class="p-3">Dinner</th>
<th class="p-3">Night Med</th>
</tr>
<?php
if(isset($_POST['search'])){
echo "<tr>";
echo "<td> " . $patient['fName'] . " " . $patient['lName'] . " </td>";
echo "<td> $doctor </td>";
echo "<td> $caregiver </td>";
if(isset($appoint['time'])){
echo "<td> Appointment Time: " . $appoint['time'] . " </td>";
}else{
echo "<td> No Appointment </td>";
}
if($checklist['breakfast'] == 0){
echo "<td class='center'> X </td>";
}elseif($checklist['breakfast'] == 1){
echo "<td class='center'> ✔ </td>";
}
if($checklist['morningMedCheck'] == 0){
echo "<td class='center'> X </td>";
}elseif($checklist['morningMedCheck'] == 1){
echo "<td class='center'> ✔ </td>";
}
if($checklist['lunch'] == 0){
echo "<td class='center'> X </td>";
}elseif($checklist['lunch'] == 1){
echo "<td class='center'> ✔ </td>";
}
if($checklist['lunchMedCheck'] == 0){
echo "<td class='center'> X </td>";
}elseif($checklist['lunchMedCheck'] == 1){
echo "<td class='center'> ✔ </td>";
}
if($checklist['dinner'] == 0){
echo "<td class='center'> X </td>";
}elseif($checklist['dinner'] == 1){
echo "<td class='center'> ✔ </td>";
}
if($checklist['nightMedCheck'] == 0){
echo "<td class='center'> X </td>";
}elseif($checklist['nightMedCheck'] == 1){
echo "<td class='center'> ✔ </td>";
}
};
?>
</table>
</div>
<?php // TEMPLATES
include 'templates/end-main-content.html';
include 'templates/footer.html';
?>