-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
526 lines (471 loc) · 25.9 KB
/
index.html
File metadata and controls
526 lines (471 loc) · 25.9 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
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
<!DOCTYPE html>
<html lang="zh-TW">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<title>RectalGuard Intelligence</title>
<script src="https://cdn.tailwindcss.com"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
<style>
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+TC:wght@300;400;500;700&display=swap');
body {
font-family: 'Noto Sans TC', sans-serif;
background-color: #f3f4f6;
height: 100vh;
overflow: hidden;
}
.app-container {
max-width: 480px;
margin: 0 auto;
background-color: #ffffff;
height: 100%;
display: flex;
flex-direction: column;
position: relative;
box-shadow: 0 0 20px rgba(0,0,0,0.1);
}
.content-area {
flex: 1;
overflow-y: auto;
padding: 1.5rem;
padding-bottom: 80px; /* Space for bottom nav */
}
.btn-primary {
background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
color: white;
transition: all 0.2s;
}
.btn-primary:active {
transform: scale(0.98);
}
.card {
background: white;
border-radius: 1rem;
box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
border: 1px solid #e5e7eb;
transition: all 0.3s ease;
}
.card:active {
border-color: #3b82f6;
}
.risk-gauge {
transition: width 1s ease-in-out;
}
/* Hide scrollbar for clean look */
.content-area::-webkit-scrollbar {
width: 6px;
}
.content-area::-webkit-scrollbar-thumb {
background-color: #e5e7eb;
border-radius: 3px;
}
.nav-item.active {
color: #2563eb;
}
.fade-in {
animation: fadeIn 0.3s ease-in-out;
}
@keyframes fadeIn {
from { opacity: 0; transform: translateY(10px); }
to { opacity: 1; transform: translateY(0); }
}
</style>
</head>
<body>
<div class="app-container">
<!-- Top Header -->
<div class="bg-white px-6 py-4 border-b border-gray-100 flex justify-between items-center z-10">
<div class="flex items-center gap-2">
<div class="w-8 h-8 bg-blue-600 rounded-lg flex items-center justify-center text-white">
<i class="fa-solid fa-shield-virus"></i>
</div>
<h1 class="font-bold text-lg text-gray-800">RectalGuard</h1>
</div>
<div class="w-8 h-8 rounded-full bg-gray-100 flex items-center justify-center text-gray-500 cursor-pointer hover:bg-gray-200 relative" onclick="toggleUserMenu()">
<i class="fa-solid fa-user-doctor"></i>
<div class="absolute top-0 right-0 w-2.5 h-2.5 bg-green-500 rounded-full border-2 border-white"></div>
</div>
</div>
<!-- Main Content Area -->
<div id="main-content" class="content-area">
<!-- Dynamic Content Injected Here -->
</div>
<!-- Bottom Navigation -->
<div class="absolute bottom-0 w-full bg-white border-t border-gray-100 px-6 py-3 flex justify-between items-center z-20">
<button onclick="renderView('dashboard')" class="nav-item active flex flex-col items-center gap-1 text-gray-400 hover:text-blue-600 transition-colors w-1/3">
<i class="fa-solid fa-house text-xl"></i>
<span class="text-xs font-medium">首頁</span>
</button>
<button onclick="renderView('assessment')" class="nav-item flex flex-col items-center gap-1 text-gray-400 hover:text-blue-600 transition-colors w-1/3">
<i class="fa-solid fa-calculator text-xl"></i>
<span class="text-xs font-medium">風險評估</span>
</button>
<button onclick="renderView('survivorship')" class="nav-item flex flex-col items-center gap-1 text-gray-400 hover:text-blue-600 transition-colors w-1/3">
<i class="fa-solid fa-notes-medical text-xl"></i>
<span class="text-xs font-medium">追蹤照護</span>
</button>
</div>
<!-- Toast Notification -->
<div id="toast" class="absolute top-20 left-1/2 transform -translate-x-1/2 bg-gray-800 text-white px-4 py-2 rounded-full text-sm shadow-lg opacity-0 transition-opacity pointer-events-none z-50">
Notification
</div>
</div>
<script>
// State Management
let currentView = 'dashboard';
let patientData = {
riskScore: null,
riskLevel: null // 'Low', 'Medium', 'High'
};
// Navigation Logic
function renderView(viewName) {
const content = document.getElementById('main-content');
const navItems = document.querySelectorAll('.nav-item');
// Update Nav State
navItems.forEach((item, index) => {
if (viewName === 'dashboard' && index === 0) item.classList.add('active', 'text-blue-600');
else if (viewName === 'assessment' && index === 1) item.classList.add('active', 'text-blue-600');
else if (viewName === 'survivorship' && index === 2) item.classList.add('active', 'text-blue-600');
else item.classList.remove('active', 'text-blue-600');
});
content.innerHTML = '';
currentView = viewName;
if (viewName === 'dashboard') content.innerHTML = getDashboardHTML();
else if (viewName === 'assessment') content.innerHTML = getAssessmentHTML();
else if (viewName === 'survivorship') content.innerHTML = getSurvivorshipHTML();
else if (viewName === 'result') content.innerHTML = getResultHTML();
}
// --- VIEW: Dashboard ---
function getDashboardHTML() {
return `
<div class="fade-in space-y-6">
<div class="bg-gradient-to-r from-blue-600 to-blue-400 rounded-2xl p-5 text-white shadow-lg shadow-blue-200">
<h2 class="text-xl font-bold mb-1">早安, 王醫師</h2>
<p class="text-blue-100 text-sm mb-4">今日已有 3 位病患完成評估</p>
<div class="flex gap-3">
<div class="bg-white/20 backdrop-blur-sm rounded-lg p-2 flex-1 text-center">
<div class="text-2xl font-bold">12</div>
<div class="text-xs opacity-80">待評估</div>
</div>
<div class="bg-white/20 backdrop-blur-sm rounded-lg p-2 flex-1 text-center">
<div class="text-2xl font-bold">2</div>
<div class="text-xs opacity-80">高風險警示</div>
</div>
</div>
</div>
<div>
<h3 class="font-bold text-gray-800 mb-3 text-lg">功能模組</h3>
<div class="grid grid-cols-2 gap-4">
<div onclick="renderView('assessment')" class="card p-4 cursor-pointer hover:bg-blue-50 group">
<div class="w-10 h-10 bg-purple-100 rounded-full flex items-center justify-center text-purple-600 mb-3 group-hover:scale-110 transition-transform">
<i class="fa-solid fa-dna"></i>
</div>
<h4 class="font-bold text-gray-700 mb-1">治療前評估</h4>
<p class="text-xs text-gray-500">Concept 4: 結合基因與臨床數據預測風險</p>
</div>
<div onclick="renderView('survivorship')" class="card p-4 cursor-pointer hover:bg-green-50 group">
<div class="w-10 h-10 bg-green-100 rounded-full flex items-center justify-center text-green-600 mb-3 group-hover:scale-110 transition-transform">
<i class="fa-solid fa-heart-pulse"></i>
</div>
<h4 class="font-bold text-gray-700 mb-1">存活照護</h4>
<p class="text-xs text-gray-500">Concept 3: ePRO 症狀追蹤與衛教</p>
</div>
</div>
</div>
<div class="bg-white rounded-xl p-4 border border-gray-100 shadow-sm">
<div class="flex justify-between items-center mb-3">
<h3 class="font-bold text-gray-800">最新研究數據 (Population Study)</h3>
<i class="fa-solid fa-chart-simple text-gray-400"></i>
</div>
<p class="text-xs text-gray-500 mb-3 leading-relaxed">
基於回溯性族群分析,結合 ATM 基因變異與劑量參數(DVH)的模型,預測準確率提升了 15%。
</p>
<div class="h-2 bg-gray-100 rounded-full overflow-hidden">
<div class="h-full bg-blue-500 w-3/4"></div>
</div>
</div>
</div>
`;
}
// --- VIEW: Assessment (Concept 4) ---
function getAssessmentHTML() {
return `
<div class="fade-in">
<div class="flex items-center gap-3 mb-6">
<button onclick="renderView('dashboard')" class="text-gray-400 hover:text-gray-600">
<i class="fa-solid fa-arrow-left"></i>
</button>
<h2 class="text-xl font-bold text-gray-800">風險評估 (Pre-RT)</h2>
</div>
<form id="assessmentForm" onsubmit="calculateRisk(event)" class="space-y-5">
<!-- Clinical Factors -->
<div class="card p-4">
<div class="flex items-center gap-2 mb-3 text-blue-700 font-semibold">
<i class="fa-solid fa-user-tag"></i> 臨床特徵
</div>
<div class="space-y-3">
<div>
<label class="text-sm text-gray-600 block mb-1">年齡</label>
<input type="number" id="age" class="w-full bg-gray-50 border border-gray-200 rounded-lg px-3 py-2 focus:outline-none focus:border-blue-500" placeholder="例如: 72" required>
</div>
<div class="flex flex-col gap-2">
<label class="flex items-center gap-2 p-2 border rounded-lg cursor-pointer hover:bg-gray-50">
<input type="checkbox" id="anticoagulant" class="w-4 h-4 text-blue-600">
<span class="text-sm text-gray-700">正在使用抗凝血劑</span>
</label>
<label class="flex items-center gap-2 p-2 border rounded-lg cursor-pointer hover:bg-gray-50">
<input type="checkbox" id="diabetes" class="w-4 h-4 text-blue-600">
<span class="text-sm text-gray-700">糖尿病病史</span>
</label>
<label class="flex items-center gap-2 p-2 border rounded-lg cursor-pointer hover:bg-gray-50">
<input type="checkbox" id="ibd" class="w-4 h-4 text-blue-600">
<span class="text-sm text-gray-700">發炎性腸道疾病 (IBD)</span>
</label>
</div>
</div>
</div>
<!-- Dosimetric Factors -->
<div class="card p-4">
<div class="flex items-center justify-between mb-3">
<div class="flex items-center gap-2 text-purple-700 font-semibold">
<i class="fa-solid fa-bullseye"></i> 劑量學參數
</div>
<span class="text-xs bg-purple-100 text-purple-600 px-2 py-1 rounded">自 TPS 匯入</span>
</div>
<div class="grid grid-cols-2 gap-3">
<div>
<label class="text-xs text-gray-500 block mb-1">直腸 V50 (%)</label>
<input type="number" id="v50" class="w-full bg-gray-50 border border-gray-200 rounded-lg px-3 py-2" placeholder="50Gy體積">
</div>
<div>
<label class="text-xs text-gray-500 block mb-1">直腸 V70 (%)</label>
<input type="number" id="v70" class="w-full bg-gray-50 border border-gray-200 rounded-lg px-3 py-2" placeholder="70Gy體積">
</div>
</div>
</div>
<!-- Genetic Factors (Concept 4) -->
<div class="card p-4 border-dashed border-2 border-gray-300 bg-gray-50">
<div class="flex items-center justify-between mb-2">
<div class="flex items-center gap-2 text-gray-600 font-semibold">
<i class="fa-solid fa-dna"></i> 基因檢測 (研究用)
</div>
<i class="fa-solid fa-flask text-gray-400"></i>
</div>
<p class="text-xs text-gray-500 mb-3">輻射敏感性基因 (ATM, NBN, LIG4) 標記</p>
<label class="flex items-center justify-between p-2 bg-white border rounded-lg cursor-pointer">
<span class="text-sm text-gray-700">檢測到基因突變</span>
<input type="checkbox" id="genetic" class="toggle checkbox text-blue-600">
</label>
</div>
<button type="submit" class="btn-primary w-full py-3 rounded-xl shadow-lg shadow-blue-200 font-bold text-lg flex items-center justify-center gap-2">
開始計算風險 <i class="fa-solid fa-calculator"></i>
</button>
</form>
</div>
`;
}
// --- LOGIC: Calculate Risk ---
function calculateRisk(e) {
e.preventDefault();
// Simulate Algorithm Logic (Logistic Regression Simulation)
let score = 0;
const age = document.getElementById('age').value;
const anticoag = document.getElementById('anticoagulant').checked;
const diabetes = document.getElementById('diabetes').checked;
const ibd = document.getElementById('ibd').checked;
const v50 = document.getElementById('v50').value;
const genetic = document.getElementById('genetic').checked;
if (age > 70) score += 1;
if (anticoag) score += 2;
if (diabetes) score += 1;
if (ibd) score += 3; // High risk factor
if (v50 > 50) score += 2;
if (genetic) score += 2; // Concept 4 weight
// Tier Logic
if (score <= 2) patientData.riskLevel = 'Low';
else if (score <= 5) patientData.riskLevel = 'Medium';
else patientData.riskLevel = 'High';
patientData.riskScore = score;
// Simulate Loading
const btn = document.querySelector('.btn-primary');
btn.innerHTML = '<i class="fa-solid fa-spinner fa-spin"></i> 計算中...';
setTimeout(() => {
renderView('result');
}, 800);
}
// --- VIEW: Result (Concept 3 - Decision Support) ---
function getResultHTML() {
let colorClass, icon, recommendations;
if (patientData.riskLevel === 'Low') {
colorClass = 'bg-green-500';
textClass = 'text-green-600';
bgClass = 'bg-green-50';
icon = 'fa-circle-check';
recommendations = `
<li class="flex items-start gap-2"><i class="fa-solid fa-check mt-1 text-green-500"></i> <span>維持標準 IMRT/VMAT 治療計畫。</span></li>
<li class="flex items-start gap-2"><i class="fa-solid fa-check mt-1 text-green-500"></i> <span>常規每週 ePRO 追蹤。</span></li>
`;
} else if (patientData.riskLevel === 'Medium') {
colorClass = 'bg-yellow-500';
textClass = 'text-yellow-600';
bgClass = 'bg-yellow-50';
icon = 'fa-circle-exclamation';
recommendations = `
<li class="flex items-start gap-2"><i class="fa-solid fa-triangle-exclamation mt-1 text-yellow-500"></i> <span>考慮收緊直腸 V50 < 45% 的限制。</span></li>
<li class="flex items-start gap-2"><i class="fa-solid fa-triangle-exclamation mt-1 text-yellow-500"></i> <span>建議使用直腸球囊 (Rectal Balloon) 固定。</span></li>
`;
} else {
colorClass = 'bg-red-500';
textClass = 'text-red-600';
bgClass = 'bg-red-50';
icon = 'fa-radiation';
recommendations = `
<li class="flex items-start gap-2"><i class="fa-solid fa-circle-xmark mt-1 text-red-500"></i> <span><strong>強烈建議:</strong> 使用 SpaceOAR 水凝膠隔離。</span></li>
<li class="flex items-start gap-2"><i class="fa-solid fa-circle-xmark mt-1 text-red-500"></i> <span>考慮調整分次治療 (Fractionation) 方案。</span></li>
<li class="flex items-start gap-2"><i class="fa-solid fa-circle-xmark mt-1 text-red-500"></i> <span>啟動早期抗發炎藥物預防。</span></li>
`;
}
return `
<div class="fade-in">
<div class="flex items-center gap-3 mb-6">
<button onclick="renderView('assessment')" class="text-gray-400 hover:text-gray-600">
<i class="fa-solid fa-arrow-left"></i>
</button>
<h2 class="text-xl font-bold text-gray-800">分析結果</h2>
</div>
<div class="bg-white rounded-2xl shadow-lg border border-gray-100 overflow-hidden mb-6">
<div class="${colorClass} p-6 text-center text-white">
<i class="fa-solid ${icon} text-5xl mb-3"></i>
<h3 class="text-2xl font-bold mb-1">${patientData.riskLevel} Risk</h3>
<p class="opacity-90">放射性直腸炎風險等級</p>
</div>
<div class="p-5">
<div class="flex justify-between items-center mb-4 text-sm text-gray-500">
<span>風險評分</span>
<span class="font-bold text-gray-800 text-lg">${patientData.riskScore} / 10</span>
</div>
<div class="h-3 bg-gray-100 rounded-full overflow-hidden">
<div class="h-full ${colorClass}" style="width: ${(patientData.riskScore/10)*100}%"></div>
</div>
</div>
</div>
<div class="card p-5 mb-6 border-l-4 ${patientData.riskLevel === 'High' ? 'border-red-500' : (patientData.riskLevel === 'Medium' ? 'border-yellow-500' : 'border-green-500')}">
<h4 class="font-bold text-gray-800 mb-3 flex items-center gap-2">
<i class="fa-solid fa-user-md ${textClass}"></i> 臨床決策建議
</h4>
<ul class="space-y-3 text-sm text-gray-600">
${recommendations}
</ul>
</div>
<button onclick="showToast('PDF 報告已傳送至 EMR 系統')" class="w-full py-3 rounded-xl border border-gray-300 text-gray-600 font-semibold hover:bg-gray-50 flex items-center justify-center gap-2">
<i class="fa-solid fa-file-pdf text-red-500"></i> 推送報告至 EMR
</button>
</div>
`;
}
// --- VIEW: Survivorship (ePRO) ---
function getSurvivorshipHTML() {
return `
<div class="fade-in">
<div class="flex items-center gap-3 mb-6">
<button onclick="renderView('dashboard')" class="text-gray-400 hover:text-gray-600">
<i class="fa-solid fa-arrow-left"></i>
</button>
<h2 class="text-xl font-bold text-gray-800">治療後追蹤 (ePRO)</h2>
</div>
<!-- Symptom Tracker -->
<div class="card p-5 mb-6">
<h3 class="font-bold text-gray-800 mb-4">今日症狀回報</h3>
<div class="space-y-5">
<div>
<label class="block text-sm font-medium text-gray-700 mb-2">是否有直腸出血?</label>
<div class="grid grid-cols-3 gap-2">
<button onclick="selectOption(this, 'bleeding')" class="epro-btn border rounded-lg p-2 text-sm hover:bg-gray-50 text-gray-600">無</button>
<button onclick="selectOption(this, 'bleeding')" class="epro-btn border rounded-lg p-2 text-sm hover:bg-gray-50 text-gray-600">輕微(衛生紙)</button>
<button onclick="selectOption(this, 'bleeding')" class="epro-btn border rounded-lg p-2 text-sm hover:bg-gray-50 text-gray-600">嚴重(滴血)</button>
</div>
</div>
<div>
<label class="block text-sm font-medium text-gray-700 mb-2">疼痛指數 (0-10)</label>
<input type="range" min="0" max="10" value="0" class="w-full h-2 bg-gray-200 rounded-lg appearance-none cursor-pointer accent-blue-600" oninput="document.getElementById('painVal').innerText = this.value">
<div class="flex justify-between text-xs text-gray-400 mt-1">
<span>無痛</span>
<span id="painVal" class="text-blue-600 font-bold text-lg">0</span>
<span>最痛</span>
</div>
</div>
<button onclick="submitEPRO()" class="btn-primary w-full py-3 rounded-xl font-bold shadow-md">
提交回報
</button>
</div>
</div>
<!-- Self Care Tips -->
<div class="bg-teal-50 rounded-xl p-5 border border-teal-100">
<h3 class="font-bold text-teal-800 mb-3 flex items-center gap-2">
<i class="fa-solid fa-leaf"></i> 自我照護小撇步
</h3>
<div class="space-y-3">
<div class="flex gap-3 bg-white p-3 rounded-lg shadow-sm">
<div class="w-10 h-10 bg-orange-100 rounded-full flex-shrink-0 flex items-center justify-center text-orange-500">
<i class="fa-solid fa-bowl-rice"></i>
</div>
<div>
<h4 class="font-bold text-sm text-gray-800">低渣飲食</h4>
<p class="text-xs text-gray-500">減少纖維攝取,避免刺激腸道黏膜。</p>
</div>
</div>
<div class="flex gap-3 bg-white p-3 rounded-lg shadow-sm">
<div class="w-10 h-10 bg-blue-100 rounded-full flex-shrink-0 flex items-center justify-center text-blue-500">
<i class="fa-solid fa-capsules"></i>
</div>
<div>
<h4 class="font-bold text-sm text-gray-800">益生菌補充</h4>
<p class="text-xs text-gray-500">幫助修復腸道菌叢 (Concept 2)。</p>
</div>
</div>
</div>
</div>
</div>
`;
}
// Helper functions for UI
function selectOption(btn, group) {
// Simple visual toggle for prototype
const parent = btn.parentElement;
Array.from(parent.children).forEach(c => {
c.classList.remove('bg-blue-600', 'text-white', 'border-blue-600');
c.classList.add('border-gray-200', 'text-gray-600');
});
btn.classList.remove('border-gray-200', 'text-gray-600');
btn.classList.add('bg-blue-600', 'text-white', 'border-blue-600');
}
function submitEPRO() {
const btn = event.target;
btn.innerHTML = '<i class="fa-solid fa-check"></i> 已提交';
btn.classList.add('bg-green-600');
showToast('資料已同步至醫療團隊');
// Simulate alerts based on Concept 3 (High risk -> tighter follow-up)
setTimeout(() => {
if(confirm("模擬情境:系統偵測到您連續兩次疼痛指數上升。\n\n建議:提早安排大腸直腸科轉診?")) {
showToast("已發送轉診需求");
}
}, 1000);
}
function showToast(message) {
const toast = document.getElementById('toast');
toast.innerText = message;
toast.classList.remove('opacity-0', 'translate-y-4');
toast.classList.add('opacity-100', 'translate-y-0');
setTimeout(() => {
toast.classList.remove('opacity-100', 'translate-y-0');
toast.classList.add('opacity-0', 'translate-y-4');
}, 3000);
}
function toggleUserMenu() {
showToast("使用者設定 / 登出 (Prototype)");
}
// Initial Render
renderView('dashboard');
</script>
</body>
</html>