-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathPatientPage.html
628 lines (544 loc) · 21.8 KB
/
PatientPage.html
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
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
<!DOCTYPE html>
<html>
<head>
<style>
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
background-color: #f2f2f2;
}
.container {
width: 90%;
max-width: 1200px;
margin: 20px auto;
background-color: #fff;
padding: 20px;
border-radius: 10px;
box-shadow: 0px 2px 5px rgba(0, 0, 0, 0.1);
}
.header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 20px;
}
.header .user-info {
display: flex;
}
.header .user-info img {
width: 80px;
height: 80px;
border-radius: 40%;
margin-right: 10px;
}
.header .user-info h2 {
font-size: 25px;
align-items: center;
margin: 0;
}
.header .user-info p {
margin: 0;
font-size: 14px;
color: #888;
padding-top: 20%;
padding-left: 20%;
}
.header .nav {
display: flex;
list-style: none;
padding: 0;
}
.header .nav li {
margin-left: 20px;
}
.header .nav li a {
text-decoration: none;
color: #333;
}
.section {
margin-bottom: 20px;
border-radius: 10px;
box-shadow: 0px 2px 5px rgba(0, 0, 0, 0.1);
transition: background-color 0.3s ease;
}
.section-header {
padding-top: 0.8%;
font-size: 20px;
font-weight: bold;
margin-bottom: 10px;
}
.section-content {
padding: 15px;
background-color: #f8f8f8;
border-radius: 8px;
}
.section-content p {
margin-bottom: 10px;
}
.table {
width: 100%;
border-collapse: collapse;
margin-bottom: 15px;
}
.table th,
.table td {
padding: 10px;
text-align: left;
border: 1px solid #ddd;
}
.table th {
background-color: #f0f0f0;
}
.results-container {
display: flex;
justify-content: space-between;
gap: 20px;
}
.results-item {
width: 48%;
background-color: #fff;
padding: 20px;
border-radius: 10px;
box-shadow: 0px 2px 5px rgba(0, 0, 0, 0.1);
transition: background-color 0.3s ease;
/* Add transition for smooth hover effect */
}
.results-item:hover {
background-color: #32bc4a;
/* Set hover background color */
}
.results-item h3 {
margin-bottom: 15px;
}
.results-item ul {
list-style: none;
padding: 0;
}
.results-item li {
margin-bottom: 10px;
}
.results-item .status {
display: inline-block;
padding: 5px 10px;
border-radius: 20px;
margin-left: 10px;
font-size: 12px;
font-weight: bold;
text-align: right;
/* Align status text to the right */
}
.status {
display: inline-block;
padding: 5px 10px;
border-radius: 20px;
margin-left: 10px;
font-size: 12px;
font-weight: bold;
text-align: right;
}
.status.bad {
background-color: #f44336;
color: #fff;
}
.status.good {
background-color: #4CAF50;
color: #fff;
}
.status.low {
background-color: #ff9800;
color: #fff;
}
.status.moderate {
background-color: #ffb600;
color: #fff;
}
.status.default {
background-color: #000000;
color: #fff;
}
.appointment-row {
display: flex;
align-items: center;
padding: 10px;
border-radius: 8px;
margin-bottom: 10px;
transition: background-color 0.3s ease;
}
.appointment-row:hover {
background-color: #32bc4a;
}
.patient-info {
width: 30%;
background-color: #fff;
padding: 20px;
border-radius: 10px;
box-shadow: 0px 2px 5px rgba(0, 0, 0, 0.1);
margin-bottom: 20px;
}
.patient-info h3 {
margin-bottom: 15px;
}
.patient-info ul {
list-style: none;
padding: 0;
}
.patient-info li {
margin-bottom: 10px;
display: flex;
align-items: center;
gap: 10px;
}
.patient-info li i {
font-size: 20px;
color: #333;
}
.patient-info li span {
font-weight: bold;
}
.patient-info .status {
display: inline-block;
padding: 5px 10px;
border-radius: 20px;
margin-left: 10px;
font-size: 12px;
font-weight: bold;
text-align: right;
}
</style>
</head>
<body>
<div class="container">
<div class="header">
<div class="user-info">
<img src="Logo.jpg" alt="Profile Picture">
<h2 id="patient-name"></h2>
<p id="patient-id"></p>
</div>
<div class="patient-info">
<ul>
<li>
<i><i class="fas fa-male"></i></i>
<span>Sex:</span>
<span id="patient-sex"></span>
</li>
<li>
<i><i class="fas fa-birthday-cake"></i></i>
<span>Age:</span>
<span id="patient-age"></span>
</li>
<li>
<i><i class="fas fa-tint"></i></i>
<span>Blood Group:</span>
<span id="patient-blood-group"></span>
</li>
<li>
<i><i class="fas fa-hospital"></i></i>
<span> Department:</span>
<span id="patient-department"></span>
</li>
<li>
<i><i class="fas fa-file-medical"></i></i>
<span>Last Lab Report:</span>
<span>2023-06-15</span>
<span class="status normal">Normal</span>
</li>
</ul>
</div>
</div>
<div class="section">
<div class="section-header">Upcoming Appointments</div>
<div class="section-content">
<div class="appointment-row">
<div>2023-06-15</div>
<div>10:00 AM</div>
<div>Dr. Jane Smith</div>
<div>Annual Checkup</div>
</div>
<div class="appointment-row">
<div>2023-07-01</div>
<div>2:30 PM</div>
<div>Dr. John Doe</div>
<div>Follow-up Appointment</div>
</div>
<div class="appointment-row">
<div>2023-08-10</div>
<div>9:00 AM</div>
<div>Dr. Sarah Lee</div>
<div>Routine Dental Cleaning</div>
</div>
</div>
</div>
<div class="results-container" id="result1">
<div class="results-item">
<h3>Recent Lab Results</h3>
<div class="section-content">
<p>View your most recent lab test results.</p>
<ul>
<li>Cholesterol <span id="cholesterol-status" class="status"></span>
<br><span id="cholesterol-value"></span> mg/dL
</li>
<li>Hemoglobin A1C <span id="hemoglobin-status" class="status"></span>
<br><span id="hemoglobin-value"></span>%
</li>
<li>Vitamin D <span id="vitamin-d-status" class="status"></span>
<br><span id="vitamin-d-value"></span> ng/mL
</li>
<li>Thyroid (TSH) <span id="thyroid-status" class="status"></span>
<br><span id="thyroid-value"></span> mIU/L
</li>
</ul>
</div>
</div>
<div class="results-item">
<h3>Health Metrics</h3>
<div class="section-content">
<p>View your latest health measurements.</p>
<ul>
<li>Blood Pressure <span id="blood-pressure-status" class="status"></span>
<br><span id="blood-pressure-value"></span> mmHg
</li>
<li>Weight <span id="weight-status" class="status"></span>
<br><span id="weight-value"></span> lbs
</li>
<li>Body Mass Index (BMI) <span id="bmi-status" class="status"></span>
<br><span id="bmi-value"></span>
</li>
<li>Medication Adherence <span id="medication-status" class="status"></span>
<br><span id="medication-value"></span>%
</li>
</ul>
</div>
</div>
<div class="section">
<div class="section-header" style="margin-top: 15px; gap : 20px;padding: 20px;">Medications</div>
<div class="section-content">
<table class="table">
<tr>
<th>Medication</th>
<th>Dosage</th>
<th>Frequency</th>
<th>Status</th>
</tr>
<tr>
<td>Aspirin</td>
<td>81mg</td>
<td>Daily</td>
<td><span class="status good">Active</span></td>
</tr>
<tr>
<td>Lisinopril</td>
<td>10mg</td>
<td>Twice Daily</td>
<td><span class="status good">Active</span></td>
</tr>
<tr>
<td>Atorvastatin</td>
<td>20mg</td>
<td>Daily</td>
<td><span class="status bad">Inactive</span></td>
</tr>
</table>
</div>
</div>
</div>
<script>
// Function to generate a random name
function getRandomName() {
const names = ["John Doe", "Jane Smith", "Bob Johnson", "Alice Brown"];
return names[Math.floor(Math.random() * names.length)];
}
// Function to generate a random age
function getRandomAge() {
return Math.floor(Math.random() * (80 - 18 + 1) + 18);
}
// Function to generate a random sex
function getRandomSex() {
const sexes = ["Male", "Female"];
return sexes[Math.floor(Math.random() * sexes.length)];
}
// Function to generate a random blood group
function getRandomBloodGroup() {
const bloodGroups = ["A+", "A-", "B+", "B-", "AB+", "AB-", "O+", "O-"];
return bloodGroups[Math.floor(Math.random() * bloodGroups.length)];
}
// Function to generate a random patient ID
function getRandomPatientId() {
return Math.floor(Math.random() * 1000000);
}
// Function to generate a random department
function getRandomDepartment() {
const departments = ["Cardiology", "Neurology", "Orthopedics", "Gastroenterology", "Dermatology", "Oncology"];
return departments[Math.floor(Math.random() * departments.length)];
}
// Generate random patient information
const patient = {
name: getRandomName(),
age: getRandomAge(),
sex: getRandomSex(),
bloodGroup: getRandomBloodGroup(),
id: getRandomPatientId(),
department: getRandomDepartment()
};
// Display patient information on the page
document.getElementById("patient-name").textContent = patient.name;
document.getElementById("patient-id").textContent = `Patient ID: ${patient.id}`;
document.getElementById("patient-sex").textContent = patient.sex;
document.getElementById("patient-age").textContent = patient.age;
document.getElementById("patient-blood-group").textContent = patient.bloodGroup;
document.getElementById("patient-department").textContent = patient.department;
// Function to generate a random cholesterol level
function getRandomCholesterol() {
return Math.floor(Math.random() * (300 - 100 + 1) + 100);
}
// Function to generate a random hemoglobin A1C level
function getRandomHemoglobin() {
return Math.floor(Math.random() * (12 - 4 + 1) + 4);
}
// Function to generate a random vitamin D level
function getRandomVitaminD() {
return Math.floor(Math.random() * (100 - 20 + 1) + 20);
}
// Function to generate a random thyroid (TSH) level
function getRandomThyroid() {
return Math.floor(Math.random() * (10 - 0.1 + 1) + 0.1);
}
// Function to generate a random blood pressure level
function getRandomBloodPressure() {
return Math.floor(Math.random() * (140 - 90 + 1) + 90);
}
// Function to generate a random weight
function getRandomWeight() {
return Math.floor(Math.random() * (200 - 100 + 1) + 100);
}
// Function to generate a random body mass index (BMI)
function getRandomBMI() {
return Math.floor(Math.random() * (40 - 15 + 1) + 15);
}
// Function to generate a random medication adherence percentage
function getRandomMedicationAdherence() {
return Math.floor(Math.random() * (100 - 0 + 1) + 0);
}
// Generate random lab results and health metrics
const labResults = {
cholesterol: getRandomCholesterol(),
hemoglobin: getRandomHemoglobin(),
vitaminD: getRandomVitaminD(),
thyroid: getRandomThyroid()
};
const healthMetrics = {
bloodPressure: getRandomBloodPressure(),
weight: getRandomWeight(),
bmi: getRandomBMI(),
medicationAdherence: getRandomMedicationAdherence()
};
// Display lab results and health metrics on the page
document.getElementById("cholesterol-value").textContent = labResults.cholesterol;
document.getElementById("hemoglobin-value").textContent = labResults.hemoglobin;
document.getElementById("vitamin-d-value").textContent = labResults.vitaminD;
document.getElementById("thyroid-value").textContent = labResults.thyroid;
document.getElementById("blood-pressure-value").textContent = healthMetrics.bloodPressure;
document.getElementById("weight-value").textContent = healthMetrics.weight;
document.getElementById("bmi-value").textContent = healthMetrics.bmi;
document.getElementById("medication-value").textContent = healthMetrics.medicationAdherence;
// Determine the status of each lab result and health metric
const cholesterolStatus = getLabResultStatus(labResults.cholesterol, 200, 240);
const hemoglobinStatus = getLabResultStatus(labResults.hemoglobin, 4, 6);
const vitaminDStatus = getLabResultStatus(labResults.vitaminD, 30, 50);
const thyroidStatus = getLabResultStatus(labResults.thyroid, 0.5, 4.5);
const bloodPressureStatus = getHealthMetricStatus(healthMetrics.bloodPressure, 120, 140);
const weightStatus = getHealthMetricStatus(healthMetrics.weight, 100, 150);
const bmiStatus = getHealthMetricStatus(healthMetrics.bmi, 18.5, 25);
const medicationAdherenceStatus = getHealthMetricStatus(healthMetrics.medicationAdherence, 80, 100);
// Function to determine the status of a lab result
function getLabResultStatus(value, low, high) {
if (value < low) {
return "Low";
} else if (value > high) {
return "High";
} else {
return "Normal";
}
}
// Function to determine the status of a health metric
function getHealthMetricStatus(value, low, high) {
if (value < low) {
return "Bad";
} else if (value > high) {
return "Good";
} else {
return "Normal";
}
}
// Function to determine the status label color
function getStatusLabelColor(status) {
switch (status) {
case "Bad":
case "Severe":
case "Poor":
case "High":
return "#ff1100";
case "Best":
case "Good":
case "Normal":
return "#afff73";
case "Little Bad":
case "Low":
return "#ebff38";
case "Moderate":
return "#ffb600";
default:
return "#000000"; // default color is black
}
}
// Display the status of each lab result and health metric on the page
document.getElementById("cholesterol-status").innerHTML = `<span id="cholesterol-status" style="color: ${getStatusLabelColor(cholesterolStatus)}">${cholesterolStatus}</span>`;
document.getElementById("hemoglobin-status").innerHTML = `<span id="hemoglobin-status" style="color: ${getStatusLabelColor(hemoglobinStatus)}">${hemoglobinStatus}</span>`;
document.getElementById("vitamin-d-status").innerHTML = `<span id="vitamin-d-status" style="color: ${getStatusLabelColor(vitaminDStatus)}">${vitaminDStatus}</span>`;
document.getElementById("thyroid-status").innerHTML = `<span id="thyroid-status" style="color: ${getStatusLabelColor(thyroidStatus)}">${thyroidStatus}</span>`;
document.getElementById("blood-pressure-status").innerHTML = `<span id="blood-pressure-status" style="color: ${getStatusLabelColor(bloodPressureStatus)}">${bloodPressureStatus}</span>`;
document.getElementById("weight-status").innerHTML = `<span id="weight-status" style="color: ${getStatusLabelColor(weightStatus)}">${weightStatus}</span>`;
document.getElementById("bmi-status").innerHTML = `<span id="bmi-status" style="color: ${getStatusLabelColor(bmiStatus)}">${bmiStatus}</span>`;
document.getElementById("medication-status").innerHTML = `<span id="medication-status" style="color: ${getStatusLabelColor(medicationAdherenceStatus)}">${medicationAdherenceStatus}</span>`;
// Function to determine the status of a lab result
function getLabResultStatus(value, low, high) {
if (value < low) {
return "Low";
} else if (value > high) {
return "High";
} else {
return "Normal";
}
}
// Function to determine the status of a health metric
function getHealthMetricStatus(value, low, high) {
if (value < low) {
return "Bad";
} else if (value > high) {
return "Good";
} else {
return "Normal";
}
}
// Add event listeners to the lab result and health metric elements
const labResultElements = document.querySelectorAll(".lab-result");
const healthMetricElements = document.querySelectorAll(".health-metric");
labResultElements.forEach((element) => {
element.addEventListener("click", () => {
const labResultId = element.id;
const labResultValue = document.getElementById(`${labResultId}-value`).textContent;
const labResultStatus = document.getElementById(`${labResultId}-status`).textContent;
alert(`Lab Result: ${labResultId}\nValue: ${labResultValue}\nStatus: ${labResultStatus}`);
});
});
healthMetricElements.forEach((element) => {
element.addEventListener("click", () => {
const healthMetricId = element.id;
const healthMetricValue = document.getElementById(`${healthMetricId}-value`).textContent;
const healthMetricStatus = document.getElementById(`${healthMetricId}-status`).textContent;
alert(`Health Metric: ${healthMetricId}\nValue: ${healthMetricValue}\nStatus: ${healthMetricStatus}`);
});
});
</script>
</body>
</html>