-
Notifications
You must be signed in to change notification settings - Fork 1
/
eNEWSObsChart.php
442 lines (397 loc) · 11.5 KB
/
eNEWSObsChart.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
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
<link rel="stylesheet" href="CSS/main.css" type="text/css">
<head>
</head>
<!--
eNEWSObsChart.php - php file which handles the front end (the observation chart) of the
application.
TO DO! - values for some categories should be on the line - some not. look at them.
-->
<?php
// declaration of constants
define("CELL_HEIGHT", 25);
define("NUMBER_OF_CELL_COLUMNS", 12);
// colour constants -- CHANGE NAME TO COLOUR_X etc.
define("BG_RED", "ff9999");
define("BG_ORANGE", "ffbb99");
define("BG_GREEN", "ccffcc");
define("BG_GREY", "bfbfbf");
define("BG_WHITE", "ffffff");
define("BG_BLUE", "ccddff");
define("BG_DARK_BLUE", "3385ff");
?>
<body style="padding-bottom:10px">
<div id="title">
Observation chart for the National Early Warning Score (NEWS)
</div>
<?php echo '<div class="headerContainer" style="height:'.(CELL_HEIGHT*2).'px">';?>
<table>
<?php echo '<td class="keyContainer" bgcolor="'.BG_WHITE.'">';?>
<!-- either table or an image here, whichever is worth the effort for! -->
</td>
<td>
<table>
<td class="headerTitle">
NAME:
</td>
<td>
</td>
</table>
</td>
<td>
<table>
<td class="headerTitle">
D.O.B:
</td>
<td>
</td>
</table>
</td>
<td>
<table>
<td class="headerTitle">
ADMISSION DATE:
</td>
<td>
</td>
</table>
</td>
</td>
</table>
</div>
<?php echo '<div class="category" style="height:'.(CELL_HEIGHT*2).'px;padding-top:0">';?>
<table>
<?php echo '<td class="titleContainer" bgcolor="'.BG_WHITE.'">';?>
<table>
<td class="bigTitle" style="color:ffffff">
<table>
<?php addSmallTitlesLeft(array("DATE","TIME")) ?>
</table>
</td>
</table>
</td>
<td class="cells">
<table>
<?php addCellRows(array(0,0)) ?>
</table>
</td>
<td class="severity">
<table>
<?php addSeverityRows(array(0,0)) ?>
</table>
</td>
<td class="cells">
<table>
<?php addCellRows(array(0,0)) ?>
</table>
</td>
<?php echo '<td class="values" bgcolor="'.BG_WHITE.'">';?>
<table>
<?php addSmallTitlesRight(array("DATE","TIME")) ?>
</table>
</td>
</table>
</div>
<?php
// CATEGORIES
// potentially rework this into an associative array: value -> severity, type deal.
// declare values and severities for the category // RESP. RATE //
$name = "RESP. RATE";
$values = array("≥25","21-24","12-20","9-11","≤8");
$severities = array(3,2,0,1,3);
$height = sizeof($severities)*CELL_HEIGHT;
addCategory($name, $values, $severities, $height);
// declare values and severities for the category // SpO2 //
$name = "Sp0<sub>2</sub>";
$values = array("≥96","94-95","92-93","≤91","%");
$severities = array(0,1,2,3,2);
$height = sizeof($severities)*CELL_HEIGHT;
addCategory($name, $values, $severities, $height);
// declare values and severities for the category // TEMP //
$name = "TEMP";
$values = array("","≥39°","38°","37°","36°","≤35°","");
$severities = array(2,1,0,0,1,3);
$height = sizeof($severities)*CELL_HEIGHT;
addCategory($name, $values, $severities, $height);
// declare values and severities for the category // BLOOD PRESSURE //
$name = "BLOOD PRESSURE";
$values = array("230","220","210","200","190","180","170","160","150","140","130","120","110","100","90","80","70","60","50");
$severities = array(3,0,0,0,0,0,0,0,0,0,0,0,1,2,3,3,3,3,3);
$height = sizeof($severities)*CELL_HEIGHT;
addCategory($name, $values, $severities, $height);
// declare values and severities for the category // HEART RATE //
$name = "HEART RATE";
$values = array(">140","130","120","110","100","90","80","70","60","50","40","30");
$severities = array(3,2,2,1,1,0,0,0,0,1,3,3);
$height = sizeof($severities)*CELL_HEIGHT;
addCategory($name, $values, $severities, $height);
// declare values and severities for the category // CONSCIOUSNESS //
$name = "Level of Consciousness";
$values = array("Alert","V/P/U");
$severities = array(0,3);
$height = sizeof($severities)*CELL_HEIGHT;
addCategory($name, $values, $severities, $height);
?>
<!-- BLOOD SUGAR -->
<?php echo '<div class="category" style="height:'.CELL_HEIGHT.'px">';?>
<table>
<?php echo '<td class="titleContainer" bgcolor="'.BG_BLUE.'">';?>
<table>
<td class="bigTitle">BLOOD SUGAR</td>
</table>
</td>
<td class="cells">
<table>
<?php addCellRows(array(0)) ?>
</table>
</td>
<td class="severity">
<table>
<?php addSeverityRows(array(0)) ?>
</table>
</td>
<td class="cells">
<table>
<?php addCellRows(array(0)) ?>
</table>
</td>
<?php echo '<td class="values" bgcolor="'.BG_BLUE.'">';?>
<table>
<td class="smallTitleRight">Bl'd Sugar</td>
</table>
</td>
</table>
</div>
<?php echo '<div class="category" style="height:'.(CELL_HEIGHT*2).'px">';?>
<table>
<?php echo '<td class="titleContainer" bgcolor="'.BG_DARK_BLUE.'">';?>
<table>
<td class="bigTitle" style="color:ffffff">TOTAL NEW SCORE</td>
</table>
</td>
<td class="cells">
<table>
<?php addCellRows(array(0)) ?>
</table>
</td>
<td class="severity">
<table>
<?php echo '<tr bgcolor="'.BG_DARK_BLUE.'" height="100%"><td class="severitytd"></td></tr>'; ?>
</table>
</td>
<td class="cells">
<table>
<?php addCellRows(array(0)) ?>
</table>
</td>
<?php echo '<td class="values" bgcolor="'.BG_DARK_BLUE.'">';?>
<table>
<td class="smallTitleRight" style="color:ffffff">TOTAL SCORE</td>
</table>
</td>
</table>
</div>
<?php echo '<div class="category" style="height:'.(CELL_HEIGHT*3).'px">';?>
<table>
<?php echo '<td class="titleContainer" bgcolor="'.BG_BLUE.'">';?>
<table>
<?php echo '<td class="verticalTitle" bgcolor="'.BG_DARK_BLUE.'" style="color:'.BG_WHITE.'">';?>
<div class="leftVerticalText">Additional Parameters</div>
</td>
<td class="bigTitle" style="color:ffffff">
<table>
<tr>
<td class="smallTitleLeft" > </td>
</tr>
<tr>
<td class="smallTitleLeft" style="height:34%">Pain Score</td>
</tr>
<tr>
<td class="smallTitleLeft"> </td>
</tr>
</table>
</td>
</table>
</td>
<td class="cells">
<table>
<?php addCellRows(array(0,0,0)) ?>
</table>
</td>
<td class="severity">
<table>
<?php addSeverityRows(array(0,0,0)) ?>
</table>
</td>
<td class="cells">
<table>
<?php addCellRows(array(0,0,0)) ?>
</table>
</td>
<?php echo '<td class="values" bgcolor="'.BG_BLUE.'">';?>
<table>
<tr>
<td class="smallTitleRight"></td>
</tr>
<tr>
<td class="smallTitleRight" style="height:34%">Pain Score</td>
</tr>
<tr>
<td class="smallTitleRight"></td>
</tr>
</table>
</td>
</table>
</div>
<?php echo '<div class="category" style="height:'.(CELL_HEIGHT*4).'px">';?>
<table>
<?php echo '<td class="titleContainer" bgcolor="'.BG_BLUE.'">';?>
<table>
<td class="bigTitle" style="color:ffffff">
<table>
<?php addSmallTitlesLeft(array("Urine Output","Monitoring Frequency","Escalation Plan Y/N n/a","Initials")) ?>
</table>
</td>
</table>
</td>
<td class="cells">
<table>
<?php addCellRows(array(0,0,0,0)) ?>
</table>
</td>
<td class="severity">
<table>
<?php addSeverityRows(array(0,0,0,0)) ?>
</table>
</td>
<td class="cells">
<table>
<?php addCellRows(array(0,0,0,0)) ?>
</table>
</td>
<?php echo '<td class="values" bgcolor="'.BG_BLUE.'">';?>
<table>
<?php addSmallTitlesRight(array("Urine Output","Monitor Freq","Escal Plan","Initials")) ?>
</table>
</td>
</table>
</div>
</body>
<?php
// functions to create the rows of each table automatically.
function addSeverityRows(array $severities) {
$height = 1;
for ($i=0; $i < sizeof($severities); $i++) {
// check if the next severity is the same as the previous one. The last element cant check last+1 - not there
if($i != sizeof($severities)-1 && $severities[$i] == $severities[$i+1]) {
// skip - dont add, make height larger for current severity.
$height++;
}
else {
// add row now, reset height for next severity. Heights based on consecutive same severity, based as percentage.
switch ($severities[$i]) {
case 3:
echo '<tr bgcolor="'.BG_RED.'" height="'.(($height/sizeof($severities))*100).'%"><td class="severitytd">'.$severities[$i].'</td></tr>';
break;
case 2:
echo '<tr bgcolor="'.BG_ORANGE.'" height="'.(($height/sizeof($severities))*100).'%"><td class="severitytd">'.$severities[$i].'</td></tr>';
break;
case 1:
echo '<tr bgcolor="'.BG_GREEN.'" height="'.(($height/sizeof($severities))*100).'%"><td class="severitytd">'.$severities[$i].'</td></tr>';
break;
default:
echo '<tr style="color:'.BG_GREY.'" bgcolor="'.BG_GREY.'" height="'.(($height/sizeof($severities))*100).'%"><td class="severitytd">'.$severities[$i].'</td></tr>';
break;
}
$height = 1;
}
}
}
function addCellRows(array $severities) {
foreach ($severities as $sev) {
switch ($sev) {
case 3: // bg red ff9999
echo '<tr bgcolor="'.BG_RED.'">';
break;
case 2: // bg orange ffbb99
echo '<tr bgcolor="'.BG_ORANGE.'">';
break;
case 1: // bg light green ccffcc
echo '<tr bgcolor="'.BG_GREEN.'">';
break;
default: // bg white ffffff
echo '<tr bgcolor="'.BG_WHITE.'">';
break;
}
for ($i=0; $i < NUMBER_OF_CELL_COLUMNS; $i++) {echo '<td class="cell"></td>';}
echo '</tr>';
}
}
function addLeftValueRows(array $values) {
foreach ($values as $val) {
echo '<tr>';
echo '<td class="valuestdLeft">'.$val.'</td>';
echo '</tr>';
}
}
function addRightValueRows(array $values) {
foreach ($values as $val) {
echo '<tr>';
echo '<td class="valuestdRight">'.$val.'</td>';
echo '</tr>';
}
}
function addSmallTitlesLeft(array $values) {
foreach ($values as $val) {
echo '<tr>';
echo '<td class="smallTitleLeft">'.$val.'</td>';
echo '</tr>';
}
}
function addSmallTitlesRight(array $values) {
foreach ($values as $val) {
echo '<tr>';
echo '<td class="smallTitleRight">'.$val.'</td>';
echo '</tr>';
}
}
function addCategory($name, $values, $severities, $height) {
echo '<div class="category" style="height:'.($height).'px">';
echo '<table>';
echo '<td class="titleContainer">';
echo '<table>';
echo '<tr>';
echo '<td class="title" bgcolor="'.BG_BLUE.'">';
echo $name;
echo '</td>';
echo '<td class="values">';
echo '<table>';
addLeftValueRows($values);
echo '</table>';
echo '</td>';
echo '</tr>';
echo '</table>';
echo '</td>';
echo '<td class="cells">';
echo '<table>';
addCellRows($severities);
echo '</table>';
echo '</td>';
echo '<td class="severity">';
echo '<table>';
addSeverityRows($severities);
echo '</table>';
echo '</td>';
echo '<td class="cells">';
echo '<table>';
addCellRows($severities);
echo '</table>';
echo '</td>';
echo '<td class="values">';
echo '<table>';
addRightValueRows($values);
echo '</table>';
echo '</td>';
echo '</table>';
echo '</div>';
}
?>