File size: 11,169 Bytes
e035287 |
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 |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>EMR System</title>
<script src="https://cdn.tailwindcss.com"></script>
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css" rel="stylesheet">
<style>
.ai-panel {
transition: transform 0.3s ease-in-out;
}
.ai-panel.collapsed {
transform: translateX(100%);
}
</style>
</head>
<body class="bg-gray-100 min-h-screen p-8">
<!-- Main Content -->
<div class="max-w-4xl mx-auto bg-white rounded-lg shadow-lg p-6" id="mainContent">
<h1 class="text-3xl font-bold text-gray-800 mb-6">Electronic Medical Record</h1>
<!-- Patient Info Section -->
<div class="mb-6">
<h2 class="text-xl font-semibold text-gray-700 mb-4">Patient Information</h2>
<div class="grid grid-cols-1 md:grid-cols-2 gap-4">
<div>
<label class="block text-gray-700 mb-2">Patient Name</label>
<input type="text" class="w-full p-2 border rounded focus:outline-none focus:ring-2 focus:ring-blue-400" id="patientName">
</div>
<div>
<label class="block text-gray-700 mb-2">Date of Birth</label>
<input type="date" class="w-full p-2 border rounded focus:outline-none focus:ring-2 focus:ring-blue-400" id="dob">
</div>
</div>
</div>
<!-- Diagnosis Section -->
<div class="mb-6">
<h2 class="text-xl font-semibold text-gray-700 mb-4">Diagnosis</h2>
<textarea class="w-full p-2 border rounded h-32 focus:outline-none focus:ring-2 focus:ring-blue-400" id="diagnosis" placeholder="Enter diagnosis details..." oninput="triggerAIAnalysis(this.value)"></textarea>
</div>
<!-- Prescription Section -->
<div class="mb-6">
<h2 class="text-xl font-semibold text-gray-700 mb-4">Prescription</h2>
<div id="prescriptionList">
<div class="prescription-item grid grid-cols-1 md:grid-cols-4 gap-4 mb-4">
<input type="text" placeholder="Medicine" class="p-2 border rounded focus:outline-none focus:ring-2 focus:ring-blue-400">
<input type="text" placeholder="Dosage" class="p-2 border rounded focus:outline-none focus:ring-2 focus:ring-blue-400">
<input type="text" placeholder="Frequency" class="p-2 border rounded focus:outline-none focus:ring-2 focus:ring-blue-400">
<input type="text" placeholder="Duration" class="p-2 border rounded focus:outline-none focus:ring-2 focus:ring-blue-400">
</div>
</div>
<button onclick="addPrescriptionField()" class="bg-blue-500 text-white px-4 py-2 rounded hover:bg-blue-600">Add Medicine</button>
</div>
<!-- Medical History Section -->
<div class="mb-6">
<h2 class="text-xl font-semibold text-gray-700 mb-4">Medical History</h2>
<textarea class="w-full p-2 border rounded h-32 focus:outline-none focus:ring-2 focus:ring-blue-400" id="medicalHistory" placeholder="Enter medical history..."></textarea>
</div>
<!-- Allergies Section -->
<div class="mb-6">
<h2 class="text-xl font-semibold text-gray-700 mb-4">Allergies</h2>
<textarea class="w-full p-2 border rounded h-24 focus:outline-none focus:ring-2 focus:ring-blue-400" id="allergies" placeholder="Enter known allergies..."></textarea>
</div>
<!-- Further Tests Section -->
<div class="mb-6">
<h2 class="text-xl font-semibold text-gray-700 mb-4">Further Tests Required</h2>
<textarea class="w-full p-2 border rounded h-24 focus:outline-none focus:ring-2 focus:ring-blue-400" id="tests" placeholder="Enter required tests..."></textarea>
</div>
<!-- Submit Button -->
<div class="flex justify-end">
<button onclick="saveRecord()" class="bg-green-500 text-white px-6 py-2 rounded hover:bg-green-600">Save Record</button>
</div>
</div>
<!-- AI Assistant Panel -->
<div class="fixed top-0 right-0 h-full w-80 bg-white shadow-lg ai-panel" id="aiPanel">
<!-- Toggle Button -->
<button onclick="toggleAIPanel()" class="absolute -left-12 top-1/2 transform -translate-y-1/2 bg-blue-500 text-white p-2 rounded-l-lg">
<i class="fas fa-robot"></i>
</button>
<!-- AI Panel Content -->
<div class="h-full flex flex-col">
<!-- Header -->
<div class="p-4 bg-blue-500 text-white">
<h2 class="text-xl font-bold">AI Assistant</h2>
</div>
<!-- Recommendations Area -->
<div class="flex-grow p-4 overflow-y-auto bg-gray-50" id="recommendationsArea">
<div class="mb-4">
<h3 class="font-semibold mb-2">Suggestions</h3>
<div id="aiSuggestions" class="space-y-2">
<!-- AI suggestions will be added here -->
</div>
</div>
</div>
<!-- Chat Interface -->
<div class="border-t">
<!-- Chat Messages -->
<div class="h-48 overflow-y-auto p-4 bg-white" id="chatMessages">
<div class="mb-2">
<div class="bg-blue-100 p-2 rounded-lg inline-block">
<p class="text-sm">Hello! I'm your AI assistant. How can I help you today?</p>
</div>
</div>
</div>
<!-- Chat Input -->
<div class="p-4 border-t">
<div class="flex gap-2">
<input type="text" id="chatInput" placeholder="Ask me anything..."
class="flex-grow p-2 border rounded focus:outline-none focus:ring-2 focus:ring-blue-400"
onkeypress="handleChatKeyPress(event)">
<button onclick="sendMessage()" class="bg-blue-500 text-white px-4 py-2 rounded hover:bg-blue-600">
<i class="fas fa-paper-plane"></i>
</button>
</div>
</div>
</div>
</div>
</div>
<script>
// AI Panel Toggle
function toggleAIPanel() {
const panel = document.getElementById('aiPanel');
panel.classList.toggle('collapsed');
}
// Add Prescription Field
function addPrescriptionField() {
const prescriptionList = document.getElementById('prescriptionList');
const newItem = document.createElement('div');
newItem.className = 'prescription-item grid grid-cols-1 md:grid-cols-4 gap-4 mb-4';
newItem.innerHTML = `
<input type="text" placeholder="Medicine" class="p-2 border rounded focus:outline-none focus:ring-2 focus:ring-blue-400">
<input type="text" placeholder="Dosage" class="p-2 border rounded focus:outline-none focus:ring-2 focus:ring-blue-400">
<input type="text" placeholder="Frequency" class="p-2 border rounded focus:outline-none focus:ring-2 focus:ring-blue-400">
<input type="text" placeholder="Duration" class="p-2 border rounded focus:outline-none focus:ring-2 focus:ring-blue-400">
`;
prescriptionList.appendChild(newItem);
}
// Chat Functions
function handleChatKeyPress(event) {
if (event.key === 'Enter') {
sendMessage();
}
}
function sendMessage() {
const input = document.getElementById('chatInput');
const message = input.value.trim();
if (message) {
addMessageToChat('user', message);
// Simulate AI response
setTimeout(() => {
addMessageToChat('ai', 'I understand you\'re asking about "' + message + '". How can I assist you further?');
}, 1000);
input.value = '';
}
}
function addMessageToChat(sender, message) {
const chatMessages = document.getElementById('chatMessages');
const messageDiv = document.createElement('div');
messageDiv.className = 'mb-2 ' + (sender === 'user' ? 'text-right' : '');
messageDiv.innerHTML = `
<div class="${sender === 'user' ? 'bg-blue-500 text-white' : 'bg-blue-100 text-gray-800'} p-2 rounded-lg inline-block">
<p class="text-sm">${message}</p>
</div>
`;
chatMessages.appendChild(messageDiv);
chatMessages.scrollTop = chatMessages.scrollHeight;
}
// AI Analysis Function
function triggerAIAnalysis(text) {
if (text.length > 10) {
const suggestions = document.getElementById('aiSuggestions');
suggestions.innerHTML = `
<div class="bg-white p-3 rounded shadow-sm">
<div class="flex items-center gap-2">
<i class="fas fa-lightbulb text-yellow-500"></i>
<p class="text-sm">Consider adding more details about symptoms</p>
</div>
</div>
<div class="bg-white p-3 rounded shadow-sm">
<div class="flex items-center gap-2">
<i class="fas fa-clipboard-check text-green-500"></i>
<p class="text-sm">Similar cases suggest running additional tests</p>
</div>
</div>
`;
}
}
// Save Record Function
function saveRecord() {
const formData = {
patientName: document.getElementById('patientName').value,
dob: document.getElementById('dob').value,
diagnosis: document.getElementById('diagnosis').value,
prescriptions: Array.from(document.getElementsByClassName('prescription-item')).map(item => {
const inputs = item.getElementsByTagName('input');
return {
medicine: inputs[0].value,
dosage: inputs[1].value,
frequency: inputs[2].value,
duration: inputs[3].value
};
}),
medicalHistory: document.getElementById('medicalHistory').value,
allergies: document.getElementById('allergies').value,
tests: document.getElementById('tests').value
};
console.log('Medical Record:', formData);
alert('Record saved successfully!');
}
</script>
</body>
</html> |