forked from thegarfieldgray/EHCRS-Prototype
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathappointment.php
191 lines (161 loc) · 5.87 KB
/
appointment.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
<?php
define('APP_RAN', 'APP_RAN');
require_once 'core/physician/physician.inc.php';
# user and session validation file
require_once 'session-validation.php';
# Access Contol File
define('PAGE_ACCESS_LEVEL', 2);
require_once 'core/access_control.php';
$error = array();
$resultSet = null;
if($work_id = get_physician_work_place(get_user_id_from_session())){
if(isset($_POST['submit']) && $_POST['submit'] === 'complete') {
#echo 'Remove From List';
if(isset($_POST['id'])) {
log_user_sign(get_user_id_from_session(), 'Change appointment with id '.$_POST['id'].' to complete');
change_appointment_status($_POST['id'], 'complete');
}
}
$resultSet = get_appointment_for_hospital_by_id($work_id);
// var_dump($resultSet->fetch_assoc());
if($resultSet->num_rows === 0) {
$error['error'] = 'No Appointments';
}
#var_dump($resultSet);
} else {
#echo 'error: work place not found';
$error['error'] = 'error: work place not found';
}
include 'header.php';
?>
<div class="container content hei">
<div class="row">
<?php if (array_key_exists('error',$error)) {
echo output_error_by_key('error', $error).'<br>';
} ?>
<h4><b>Emergency Appointments</b> <span style="float: right;">Remaining appointments :<code><b><?php if($resultSet !== null) { echo $resultSet->num_rows; }?></b></code> </span> </h4>
<br>
<div class="panel panel-default">
<div class="panel">
<div class="table-responsive">
<table class="table">
<thead>
<tr>
<th>Firstname</th>
<th>Lastname</th>
<th>Date</th>
<th>Time</th>
<th>Reason</th>
<th>Type</th>
</tr>
</thead>
<tbody>
<?php
if (empty($error) && $resultSet != null) {
$resultSet->data_seek(0);
while ($row = $resultSet->fetch_assoc()):
if ($row['type'] === 'inc_em' || $row['type'] === 'em') { ?>
<form action="<?php $_SERVER['PHP_SELF']?>" method="post">
<tr>
<input type="hidden" name="id" value="<?php echo $row['id']; ?>">
<td><?php echo $row['firstname']; ?></td>
<td><?php echo $row['lastname']; ?></td>
<td><?php echo $row['date']; ?></td>
<td><?php echo $row['time']; ?></td>
<td><?php echo $row['reason']; ?></td>
<td><?php echo $row['type'] === 'inc_em' ? 'Incoming Emergency': 'Emergency'; ?></td>
<th><button type="submit" class="btn btn-link" name="submit" value="complete">complete</button></th>
</tr>
</form>
<?php } endwhile; } ?>
</tbody>
</table>
</div>
</div>
</div>
</div>
<div class="row">
<p><code><b>Dr. session user</b></code> your next patient is : </p>
<div class="panel panel-default">
<div class="panel">
<div class="table-responsive">
<table class="table">
<thead>
<tr>
<th>Firstname</th>
<th>Lastname</th>
<th>Date</th>
<th>Time</th>
<th>Reason</th>
<th>Type</th>
</tr>
</thead>
<tbody>
<?php
if (empty($error)) {
$resultSet->data_seek(0);
while ($row = $resultSet->fetch_assoc()):
if ($row['type'] === 'wait') { ?>
<form action="<?php $_SERVER['PHP_SELF']?>" method="post">
<tr>
<input type="hidden" name="id" value="<?php echo $row['id']; ?>">
<td><?php echo $row['firstname']; ?></td>
<td><?php echo $row['lastname']; ?></td>
<td><?php echo $row['date']; ?></td>
<td><?php echo $row['time']; ?></td>
<td><?php echo $row['reason']; ?></td>
<td><?php echo $row['type'] === 'wait' ? 'In hospital': ''; ?></td>
<th><button type="submit" class="btn btn-link" name="submit" value="complete">complete</button></th>
</tr>
</form>
<?php } endwhile; } ?>
</tbody>
</table>
</div>
</div>
</div>
</div>
<div class="row">
<p><code><b>Dr. session user</b></code> your next appointment is scheduled for : </p>
<div class="panel panel-default">
<div class="panel">
<div class="table-responsive">
<table class="table">
<thead>
<tr>
<th>Firstname</th>
<th>Lastname</th>
<th>Date</th>
<th>Time</th>
<th>Reason</th>
<th>Type</th>
</tr>
</thead>
<tbody>
<?php
if (empty($error)) {
$resultSet->data_seek(0);
while ($row = $resultSet->fetch_assoc()):
if ($row['type'] === 'reg') { ?>
<form action="<?php $_SERVER['PHP_SELF']?>" method="post">
<tr>
<input type="hidden" name="id" value="<?php echo $row['id']; ?>">
<td><?php echo $row['firstname']; ?></td>
<td><?php echo $row['lastname']; ?></td>
<td><?php echo $row['date']; ?></td>
<td><?php echo $row['time']; ?></td>
<td><?php echo $row['reason']; ?></td>
<td><?php echo $row['type'] === 'reg' ? 'Regular': ''; ?></td>
<th><button type="submit" class="btn btn-link" name="submit" value="complete">complete</button></th>
</tr>
</form>
<?php } endwhile; } ?>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
<br><br><br><br>
<?php include 'footer.php' ?>