Update components/PrintReport.tsx
Browse files- components/PrintReport.tsx +262 -210
components/PrintReport.tsx
CHANGED
|
@@ -1,230 +1,282 @@
|
|
| 1 |
import React from 'react';
|
| 2 |
import { PatientProfile, ClinicalVitals, RiskAnalysisResult, ChatMessage, Medication } from '../types';
|
| 3 |
-
import { Activity, Pill,
|
| 4 |
|
| 5 |
interface PrintReportProps {
|
| 6 |
-
profile: PatientProfile;
|
| 7 |
-
vitals: ClinicalVitals;
|
| 8 |
-
riskResult: RiskAnalysisResult | null;
|
| 9 |
-
chatHistory: ChatMessage[];
|
| 10 |
-
chatSummary: string;
|
| 11 |
-
medications?: Medication[];
|
| 12 |
}
|
| 13 |
|
| 14 |
const PrintReport: React.FC<PrintReportProps> = ({
|
| 15 |
-
profile,
|
| 16 |
-
vitals,
|
| 17 |
-
riskResult,
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
medications = []
|
| 21 |
}) => {
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
<div className="
|
| 27 |
-
|
| 28 |
-
<
|
| 29 |
-
SomAI Health Report
|
| 30 |
-
</h1>
|
| 31 |
-
<p className="text-sm text-gray-600 mt-2">Generated on: {new Date().toLocaleDateString()}</p>
|
| 32 |
-
</div>
|
| 33 |
-
<div className="text-right text-xs pt-1">
|
| 34 |
-
<p className="font-bold text-gray-900">Patient: {profile.name}</p>
|
| 35 |
-
<p className="text-gray-600">{profile.age} | {profile.gender}</p>
|
| 36 |
-
<p className="text-red-700 font-bold mt-1">Primary Condition: {profile.condition}</p>
|
| 37 |
-
</div>
|
| 38 |
-
</header>
|
| 39 |
-
{/* Patient Profile & Vitals Grid */}
|
| 40 |
-
<section className="mb-8 break-inside-avoid">
|
| 41 |
-
<h2 className="flex items-center gap-2 text-sm font-black uppercase tracking-wider text-black border-b border-gray-200 pb-2 mb-4">
|
| 42 |
-
<User size={16} /> Patient Snapshot
|
| 43 |
-
</h2>
|
| 44 |
-
<div className="grid grid-cols-3 gap-6 text-sm">
|
| 45 |
-
<div className="bg-gray-50 p-4 rounded-lg border border-gray-200">
|
| 46 |
-
<h3 className="text-xs font-bold text-gray-500 uppercase mb-2">Demographics</h3>
|
| 47 |
-
<p><span className="font-medium">Blood:</span> {profile.bloodGroup}</p>
|
| 48 |
-
<p><span className="font-medium">Diet:</span> {profile.diet}</p>
|
| 49 |
-
<p><span className="font-medium">Exercise:</span> {profile.exerciseFrequency}</p>
|
| 50 |
-
</div>
|
| 51 |
-
<div className="bg-gray-50 p-4 rounded-lg border border-gray-200">
|
| 52 |
-
<h3 className="text-xs font-bold text-gray-500 uppercase mb-2">Vitals Summary</h3>
|
| 53 |
-
<p><span className="font-medium">Avg BP (Sys):</span> {vitals.systolicBp} mmHg</p>
|
| 54 |
-
<p><span className="font-medium">Glucose:</span> {vitals.glucose} mg/dL</p>
|
| 55 |
-
<p><span className="font-medium">Heart Rate:</span> {vitals.heartRate} bpm</p>
|
| 56 |
-
</div>
|
| 57 |
-
<div className="bg-gray-50 p-4 rounded-lg border border-gray-200">
|
| 58 |
-
<h3 className="text-xs font-bold text-gray-500 uppercase mb-2">Lifestyle Risks</h3>
|
| 59 |
-
<p><span className="font-medium">Smoking:</span> {profile.smokingStatus}</p>
|
| 60 |
-
<p><span className="font-medium">Alcohol:</span> {profile.alcoholConsumption}</p>
|
| 61 |
-
<p><span className="font-medium">Allergies:</span> {profile.allergies || 'None'}</p>
|
| 62 |
-
</div>
|
| 63 |
-
</div>
|
| 64 |
-
</section>
|
| 65 |
-
{/* AI Analysis */}
|
| 66 |
-
<section className="mb-8 break-inside-avoid">
|
| 67 |
-
<h2 className="flex items-center gap-2 text-sm font-black uppercase tracking-wider text-black border-b border-gray-200 pb-2 mb-4">
|
| 68 |
-
<AlertTriangle size={16} /> AI Clinical Analysis
|
| 69 |
-
</h2>
|
| 70 |
-
{riskResult ? (
|
| 71 |
-
<div className="bg-blue-50/50 rounded-xl border border-blue-100 p-6">
|
| 72 |
-
<div className="mb-6">
|
| 73 |
-
<h3 className="text-xs font-bold text-blue-800 uppercase tracking-wide mb-2">Clinical Summary</h3>
|
| 74 |
-
<p className="text-sm text-blue-950 leading-relaxed font-medium">{riskResult.summary}</p>
|
| 75 |
-
</div>
|
| 76 |
-
<div className="grid grid-cols-1 md:grid-cols-2 gap-8">
|
| 77 |
<div>
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
|
|
|
|
| 87 |
</div>
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
|
| 94 |
-
|
| 95 |
-
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 100 |
</thead>
|
| 101 |
<tbody className="divide-y divide-gray-100">
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
|
| 106 |
-
|
| 107 |
-
|
| 108 |
-
|
| 109 |
-
|
| 110 |
-
|
| 111 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 112 |
</tbody>
|
| 113 |
-
|
| 114 |
-
{riskResult.insuranceNote && (
|
| 115 |
-
<div className="p-3 bg-gray-50 border-t border-gray-200">
|
| 116 |
-
<p className="text-[10px] text-gray-400 font-bold uppercase mb-0.5">Insurance Note</p>
|
| 117 |
-
<p className="text-xs text-gray-600 italic">"{riskResult.insuranceNote}"</p>
|
| 118 |
-
</div>
|
| 119 |
-
)}
|
| 120 |
-
</div>
|
| 121 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 122 |
</div>
|
| 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 |
-
<span className="inline-flex items-center gap-1 text-xs font-bold text-gray-500 bg-gray-100 px-2 py-1 rounded-full">
|
| 162 |
-
Pending
|
| 163 |
-
</span>
|
| 164 |
-
)}
|
| 165 |
-
</td>
|
| 166 |
-
</tr>
|
| 167 |
-
)) : (
|
| 168 |
-
<tr>
|
| 169 |
-
<td colSpan={5} className="px-4 py-6 text-center text-gray-500 italic">No medications recorded.</td>
|
| 170 |
-
</tr>
|
| 171 |
-
)}
|
| 172 |
-
</tbody>
|
| 173 |
-
</table>
|
| 174 |
-
{medications.length > 0 && (
|
| 175 |
-
<div className="bg-gray-50 px-4 py-3 border-t border-gray-200 flex justify-end items-center gap-3">
|
| 176 |
-
<span className="text-xs font-bold text-gray-500 uppercase">Current Streak</span>
|
| 177 |
-
<span className="text-lg font-black text-gray-900">{profile.streak} Days</span>
|
| 178 |
</div>
|
| 179 |
-
|
| 180 |
-
|
| 181 |
-
</section>
|
| 182 |
-
{/* Chat Summary */}
|
| 183 |
-
<section className="mb-8 break-inside-avoid">
|
| 184 |
-
<h2 className="flex items-center gap-2 text-sm font-black uppercase tracking-wider text-black border-b border-gray-200 pb-2 mb-4">
|
| 185 |
-
<ClipboardList size={16} /> Consultation Brief
|
| 186 |
-
</h2>
|
| 187 |
-
<div className="bg-yellow-50/50 p-6 rounded-xl border border-yellow-100">
|
| 188 |
-
{chatSummary ? (
|
| 189 |
-
<p className="text-sm text-gray-800 leading-relaxed whitespace-pre-wrap font-medium">{chatSummary}</p>
|
| 190 |
-
) : (
|
| 191 |
-
<p className="text-gray-500 italic text-sm">No session summary available.</p>
|
| 192 |
-
)}
|
| 193 |
-
</div>
|
| 194 |
-
</section>
|
| 195 |
-
{/* Full Transcript */}
|
| 196 |
-
<section>
|
| 197 |
-
<h2 className="flex items-center gap-2 text-sm font-black uppercase tracking-wider text-black border-b border-gray-200 pb-2 mb-4">
|
| 198 |
-
<MessageSquare size={16} /> Conversation Transcript
|
| 199 |
-
</h2>
|
| 200 |
-
<div className="space-y-1">
|
| 201 |
-
{chatHistory.map((m) => (
|
| 202 |
-
<div key={m.id} className="grid grid-cols-12 gap-4 py-2 border-b border-gray-100 break-inside-avoid text-xs">
|
| 203 |
-
<div className="col-span-2 font-bold text-gray-500 uppercase tracking-wider pt-1">
|
| 204 |
-
{m.role === 'user' ? 'Patient' : 'SomAI'}
|
| 205 |
-
</div>
|
| 206 |
-
<div className="col-span-10 text-gray-800 leading-relaxed">
|
| 207 |
-
{m.image && <div className="text-[10px] text-blue-600 mb-1 font-bold">[Image Attachment]</div>}
|
| 208 |
-
{m.text}
|
| 209 |
-
</div>
|
| 210 |
-
</div>
|
| 211 |
-
))}
|
| 212 |
-
{chatHistory.length === 0 && <p className="text-gray-400 italic text-xs">No messages logged.</p>}
|
| 213 |
-
</div>
|
| 214 |
-
</section>
|
| 215 |
-
{/* Footer */}
|
| 216 |
-
<footer className="mt-12 pt-6 border-t-2 border-gray-900 flex justify-between items-center text-[10px] text-gray-500 break-inside-avoid">
|
| 217 |
-
<div className="max-w-[60%]">
|
| 218 |
-
<p className="font-bold text-gray-900 mb-1 uppercase tracking-wider">Disclaimer</p>
|
| 219 |
-
<p>This report is generated by an AI assistant for educational purposes only. It is not a medical device. Always consult a qualified healthcare provider for diagnosis and treatment.</p>
|
| 220 |
-
</div>
|
| 221 |
-
<div className="text-right">
|
| 222 |
-
<p className="font-bold text-gray-900">SomAI</p>
|
| 223 |
-
<p>Powered by Google Gemini</p>
|
| 224 |
</div>
|
| 225 |
-
|
| 226 |
-
</div>
|
| 227 |
-
);
|
| 228 |
};
|
| 229 |
|
| 230 |
export default PrintReport;
|
|
|
|
| 1 |
import React from 'react';
|
| 2 |
import { PatientProfile, ClinicalVitals, RiskAnalysisResult, ChatMessage, Medication } from '../types';
|
| 3 |
+
import { Activity, Pill, CheckCircle, ShieldCheck, Zap, Server } from 'lucide-react';
|
| 4 |
|
| 5 |
interface PrintReportProps {
|
| 6 |
+
profile: PatientProfile;
|
| 7 |
+
vitals: ClinicalVitals;
|
| 8 |
+
riskResult: RiskAnalysisResult | null;
|
| 9 |
+
chatHistory: ChatMessage[];
|
| 10 |
+
chatSummary: string;
|
| 11 |
+
medications?: Medication[];
|
| 12 |
}
|
| 13 |
|
| 14 |
const PrintReport: React.FC<PrintReportProps> = ({
|
| 15 |
+
profile,
|
| 16 |
+
vitals,
|
| 17 |
+
riskResult,
|
| 18 |
+
chatSummary,
|
| 19 |
+
medications = []
|
|
|
|
| 20 |
}) => {
|
| 21 |
+
return (
|
| 22 |
+
<div className="w-full max-w-[210mm] mx-auto bg-white text-black font-sans leading-normal print:p-0">
|
| 23 |
+
|
| 24 |
+
{/* PAGE 1: DEMOGRAPHICS & VITALS */}
|
| 25 |
+
<div className="min-h-[297mm] p-10 relative flex flex-col">
|
| 26 |
+
{/* Header */}
|
| 27 |
+
<header className="flex justify-between items-start mb-12 border-b-4 border-black pb-6">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 28 |
<div>
|
| 29 |
+
<h1 className="text-4xl font-black text-gray-900 tracking-tight flex items-center gap-3">
|
| 30 |
+
<Activity className="text-black" size={32} strokeWidth={2.5} />
|
| 31 |
+
SomAI <span className="text-gray-400 font-light">Report</span>
|
| 32 |
+
</h1>
|
| 33 |
+
<p className="text-gray-500 text-xs mt-1 font-bold tracking-[0.2em] uppercase">Patient Education & Clinical Risk Assessment</p>
|
| 34 |
+
</div>
|
| 35 |
+
<div className="text-right">
|
| 36 |
+
<div className="inline-block bg-black text-white px-3 py-1 text-[10px] font-bold uppercase tracking-widest mb-2">Confidential</div>
|
| 37 |
+
<p className="text-gray-900 font-mono text-sm font-bold">{new Date().toLocaleDateString()}</p>
|
| 38 |
+
<p className="text-gray-400 text-xs font-mono">{new Date().toLocaleTimeString()}</p>
|
| 39 |
</div>
|
| 40 |
+
</header>
|
| 41 |
+
|
| 42 |
+
<div className="grid grid-cols-12 gap-10 flex-1">
|
| 43 |
+
{/* LEFT COL: DEMOGRAPHICS */}
|
| 44 |
+
<div className="col-span-5">
|
| 45 |
+
<h2 className="flex items-center gap-2 text-xs font-black uppercase tracking-widest text-black border-b border-gray-200 pb-2 mb-6">
|
| 46 |
+
<span className="w-4 h-4 rounded-full border border-black flex items-center justify-center text-[8px]">1</span>
|
| 47 |
+
Patient Demographics
|
| 48 |
+
</h2>
|
| 49 |
+
|
| 50 |
+
<div className="bg-gray-50 p-6 rounded-sm border border-gray-100 space-y-6">
|
| 51 |
+
<div>
|
| 52 |
+
<span className="text-gray-400 text-[10px] uppercase font-bold tracking-wider block mb-1">Name</span>
|
| 53 |
+
<span className="text-gray-900 font-bold text-lg leading-tight block">{profile.name}</span>
|
| 54 |
+
</div>
|
| 55 |
+
<div>
|
| 56 |
+
<span className="text-gray-400 text-[10px] uppercase font-bold tracking-wider block mb-1">Age</span>
|
| 57 |
+
<span className="text-gray-900 font-bold text-lg block">{profile.age} years</span>
|
| 58 |
+
</div>
|
| 59 |
+
<div>
|
| 60 |
+
<span className="text-gray-400 text-[10px] uppercase font-bold tracking-wider block mb-1">Condition</span>
|
| 61 |
+
<span className="text-gray-900 font-bold leading-tight block">{profile.condition}</span>
|
| 62 |
+
</div>
|
| 63 |
+
{profile.allergies && profile.allergies !== 'None' && (
|
| 64 |
+
<div>
|
| 65 |
+
<span className="text-gray-400 text-[10px] uppercase font-bold tracking-wider block mb-1">Allergies</span>
|
| 66 |
+
<span className="text-red-600 font-bold block bg-red-50 px-2 py-1 rounded w-fit">{profile.allergies}</span>
|
| 67 |
+
</div>
|
| 68 |
+
)}
|
| 69 |
+
<div className="pt-4 border-t border-gray-200">
|
| 70 |
+
<span className="text-gray-400 text-[10px] uppercase font-bold tracking-wider block mb-2">History</span>
|
| 71 |
+
<p className="text-sm text-gray-600 leading-relaxed text-justify">{profile.history}</p>
|
| 72 |
+
</div>
|
| 73 |
+
</div>
|
| 74 |
+
</div>
|
| 75 |
+
|
| 76 |
+
{/* RIGHT COL: VITALS */}
|
| 77 |
+
<div className="col-span-7">
|
| 78 |
+
<h2 className="flex items-center gap-2 text-xs font-black uppercase tracking-widest text-black border-b border-gray-200 pb-2 mb-6">
|
| 79 |
+
<span className="w-4 h-4 rounded-full border border-black flex items-center justify-center text-[8px]">2</span>
|
| 80 |
+
Clinical Vitals
|
| 81 |
+
</h2>
|
| 82 |
+
|
| 83 |
+
<div className="grid grid-cols-2 gap-4">
|
| 84 |
+
<div className="aspect-square bg-gray-50 rounded-xl border border-gray-100 flex flex-col items-center justify-center text-center p-4">
|
| 85 |
+
<span className="text-[10px] font-bold text-gray-400 uppercase tracking-wider mb-2">Systolic BP</span>
|
| 86 |
+
<span className={`text-4xl font-black ${vitals.systolicBp > 140 ? 'text-red-600' : 'text-gray-900'}`}>{vitals.systolicBp}</span>
|
| 87 |
+
<span className="text-[10px] text-gray-400 mt-1">mmHg</span>
|
| 88 |
+
</div>
|
| 89 |
+
<div className="aspect-square bg-gray-50 rounded-xl border border-gray-100 flex flex-col items-center justify-center text-center p-4">
|
| 90 |
+
<span className="text-[10px] font-bold text-gray-400 uppercase tracking-wider mb-2">Glucose</span>
|
| 91 |
+
<span className={`text-4xl font-black ${vitals.glucose > 180 ? 'text-red-600' : 'text-gray-900'}`}>{vitals.glucose}</span>
|
| 92 |
+
<span className="text-[10px] text-gray-400 mt-1">mg/dL</span>
|
| 93 |
+
</div>
|
| 94 |
+
<div className="aspect-square bg-gray-50 rounded-xl border border-gray-100 flex flex-col items-center justify-center text-center p-4">
|
| 95 |
+
<span className="text-[10px] font-bold text-gray-400 uppercase tracking-wider mb-2">SpO2</span>
|
| 96 |
+
<span className={`text-4xl font-black ${vitals.spo2 < 95 ? 'text-red-600' : 'text-green-600'}`}>{vitals.spo2}%</span>
|
| 97 |
+
<span className="text-[10px] text-gray-400 mt-1">Saturation</span>
|
| 98 |
+
</div>
|
| 99 |
+
<div className="aspect-square bg-gray-50 rounded-xl border border-gray-100 flex flex-col items-center justify-center text-center p-4">
|
| 100 |
+
<span className="text-[10px] font-bold text-gray-400 uppercase tracking-wider mb-2">Risk Score</span>
|
| 101 |
+
<span className={`text-4xl font-black ${riskResult && riskResult.numericScore > 60 ? 'text-red-600' : 'text-green-600'}`}>
|
| 102 |
+
{riskResult ? riskResult.numericScore : '--'}
|
| 103 |
+
</span>
|
| 104 |
+
<span className="text-[10px] text-gray-400 mt-1">/100</span>
|
| 105 |
+
</div>
|
| 106 |
+
</div>
|
| 107 |
+
</div>
|
| 108 |
+
</div>
|
| 109 |
+
</div>
|
| 110 |
+
|
| 111 |
+
{/* PAGE 2: CLINICAL ANALYSIS */}
|
| 112 |
+
<div className="min-h-[297mm] p-10 relative flex flex-col break-before-page">
|
| 113 |
+
<header className="flex justify-between items-center mb-8 border-b border-gray-200 pb-4">
|
| 114 |
+
<h2 className="flex items-center gap-2 text-sm font-black uppercase tracking-widest text-black">
|
| 115 |
+
<span className="w-5 h-5 bg-black text-white flex items-center justify-center text-[10px]">3</span>
|
| 116 |
+
AI Clinical Analysis
|
| 117 |
+
</h2>
|
| 118 |
+
{riskResult?.source && (
|
| 119 |
+
<span className="text-[10px] font-mono uppercase bg-gray-100 px-2 py-1 rounded text-gray-500 font-bold border border-gray-200">
|
| 120 |
+
{riskResult.source.toUpperCase()}
|
| 121 |
+
</span>
|
| 122 |
+
)}
|
| 123 |
+
</header>
|
| 124 |
+
|
| 125 |
+
{riskResult ? (
|
| 126 |
+
<div className="space-y-8">
|
| 127 |
+
{/* Summary */}
|
| 128 |
+
<div>
|
| 129 |
+
<h3 className="text-xs font-bold text-blue-600 uppercase tracking-wide mb-3">Clinical Summary</h3>
|
| 130 |
+
<p className="text-base text-gray-800 leading-relaxed font-medium bg-blue-50/50 p-6 rounded-lg border border-blue-100 text-justify">
|
| 131 |
+
{riskResult.summary}
|
| 132 |
+
</p>
|
| 133 |
+
</div>
|
| 134 |
+
|
| 135 |
+
{/* Action Items */}
|
| 136 |
+
<div>
|
| 137 |
+
<h3 className="text-xs font-bold text-gray-400 uppercase tracking-wide mb-3">Action Items</h3>
|
| 138 |
+
<div className="space-y-3">
|
| 139 |
+
{riskResult.actionItems.map((item, i) => (
|
| 140 |
+
<div key={i} className="flex gap-4 items-start p-3 bg-gray-50 rounded-lg border border-gray-100">
|
| 141 |
+
<CheckCircle size={18} className="text-green-600 mt-0.5 flex-shrink-0" />
|
| 142 |
+
<p className="text-sm text-gray-800 font-medium">{item}</p>
|
| 143 |
+
</div>
|
| 144 |
+
))}
|
| 145 |
+
</div>
|
| 146 |
+
</div>
|
| 147 |
+
|
| 148 |
+
{/* Coding Pipeline */}
|
| 149 |
+
<div>
|
| 150 |
+
<h3 className="text-xs font-bold text-gray-400 uppercase tracking-wide mb-3 flex items-center gap-2"><ShieldCheck size={14}/> Coding Pipeline</h3>
|
| 151 |
+
<div className="border border-gray-200 rounded-lg overflow-hidden">
|
| 152 |
+
<table className="w-full text-sm text-left">
|
| 153 |
+
<thead className="bg-gray-50 text-gray-400 font-medium text-xs">
|
| 154 |
+
<tr>
|
| 155 |
+
<th className="px-4 py-2 w-24">Type</th>
|
| 156 |
+
<th className="px-4 py-2 w-24">Code</th>
|
| 157 |
+
<th className="px-4 py-2">Desc</th>
|
| 158 |
+
</tr>
|
| 159 |
+
</thead>
|
| 160 |
+
<tbody className="divide-y divide-gray-100">
|
| 161 |
+
{riskResult.codingPipeline?.map((code, i) => (
|
| 162 |
+
<tr key={i}>
|
| 163 |
+
<td className="px-4 py-2.5 text-gray-500 text-xs">{code.type}</td>
|
| 164 |
+
<td className="px-4 py-2.5 font-bold font-mono text-blue-600">{code.code}</td>
|
| 165 |
+
<td className="px-4 py-2.5 text-gray-800">{code.description}</td>
|
| 166 |
+
</tr>
|
| 167 |
+
))}
|
| 168 |
+
</tbody>
|
| 169 |
+
</table>
|
| 170 |
+
</div>
|
| 171 |
+
</div>
|
| 172 |
+
|
| 173 |
+
{/* Insurance Note */}
|
| 174 |
+
{riskResult.insuranceNote && (
|
| 175 |
+
<div className="mt-6">
|
| 176 |
+
<span className="text-[10px] font-bold text-gray-400 uppercase block mb-1">Insurance Note</span>
|
| 177 |
+
<p className="text-sm text-gray-500 italic border-l-2 border-gray-300 pl-4 py-1">
|
| 178 |
+
"{riskResult.insuranceNote}"
|
| 179 |
+
</p>
|
| 180 |
+
</div>
|
| 181 |
+
)}
|
| 182 |
+
</div>
|
| 183 |
+
) : (
|
| 184 |
+
<div className="flex items-center justify-center h-64 border-2 border-dashed border-gray-200 rounded-xl">
|
| 185 |
+
<p className="text-gray-400 italic">Analysis data not available.</p>
|
| 186 |
+
</div>
|
| 187 |
+
)}
|
| 188 |
+
</div>
|
| 189 |
+
|
| 190 |
+
{/* PAGE 3: MEDICATION */}
|
| 191 |
+
<div className="min-h-[297mm] p-10 relative flex flex-col break-before-page">
|
| 192 |
+
<header className="flex justify-between items-center mb-8 border-b border-gray-200 pb-4">
|
| 193 |
+
<h2 className="flex items-center gap-2 text-sm font-black uppercase tracking-widest text-black">
|
| 194 |
+
<span className="w-5 h-5 bg-black text-white flex items-center justify-center text-[10px]">4</span>
|
| 195 |
+
Medication Schedule
|
| 196 |
+
</h2>
|
| 197 |
+
</header>
|
| 198 |
+
|
| 199 |
+
<div className="border-t border-b border-gray-200">
|
| 200 |
+
<table className="w-full text-sm text-left">
|
| 201 |
+
<thead className="text-gray-400 font-bold text-[10px] uppercase tracking-wider">
|
| 202 |
+
<tr>
|
| 203 |
+
<th className="py-4">Medication</th>
|
| 204 |
+
<th className="py-4">Dosage</th>
|
| 205 |
+
<th className="py-4">Time</th>
|
| 206 |
+
<th className="py-4">Duration</th>
|
| 207 |
+
<th className="py-4 text-right">Status</th>
|
| 208 |
+
</tr>
|
| 209 |
</thead>
|
| 210 |
<tbody className="divide-y divide-gray-100">
|
| 211 |
+
{medications.length > 0 ? medications.map((med) => (
|
| 212 |
+
<tr key={med.id}>
|
| 213 |
+
<td className="py-4 font-bold text-gray-900">{med.name}</td>
|
| 214 |
+
<td className="py-4 text-gray-600">{med.dosage}</td>
|
| 215 |
+
<td className="py-4 font-mono text-gray-600">{med.time}</td>
|
| 216 |
+
<td className="py-4 text-gray-500 text-xs">{med.startDate ? `${med.startDate} → ${med.endDate || 'Ongoing'}` : 'Ongoing'}</td>
|
| 217 |
+
<td className="py-4 text-right">
|
| 218 |
+
<span className={`inline-flex items-center gap-1 text-[10px] font-bold uppercase tracking-wider px-2 py-1 rounded ${med.taken ? 'bg-green-100 text-green-700' : 'bg-gray-100 text-gray-500'}`}>
|
| 219 |
+
{med.taken ? <CheckCircle size={10}/> : null} {med.taken ? 'Taken' : 'Pending'}
|
| 220 |
+
</span>
|
| 221 |
+
</td>
|
| 222 |
+
</tr>
|
| 223 |
+
)) : (
|
| 224 |
+
<tr><td colSpan={5} className="py-8 text-center text-gray-400 italic">No medications recorded.</td></tr>
|
| 225 |
+
)}
|
| 226 |
</tbody>
|
| 227 |
+
</table>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 228 |
</div>
|
| 229 |
+
|
| 230 |
+
{medications.length > 0 && (
|
| 231 |
+
<div className="mt-4 flex justify-end items-center gap-3">
|
| 232 |
+
<span className="text-xs font-bold text-gray-400 uppercase tracking-wider">Current Streak</span>
|
| 233 |
+
<span className="text-2xl font-black text-gray-900">{profile.streak} <span className="text-sm font-medium text-gray-500">Days</span></span>
|
| 234 |
+
</div>
|
| 235 |
+
)}
|
| 236 |
</div>
|
| 237 |
+
|
| 238 |
+
{/* PAGE 4-5: CONSULTATION BRIEF (Replaces Transcript) */}
|
| 239 |
+
<div className="min-h-[297mm] p-10 relative flex flex-col break-before-page">
|
| 240 |
+
<header className="flex justify-between items-center mb-8 border-b border-gray-200 pb-4">
|
| 241 |
+
<h2 className="flex items-center gap-2 text-sm font-black uppercase tracking-widest text-black">
|
| 242 |
+
<span className="w-5 h-5 bg-black text-white flex items-center justify-center text-[10px]">5</span>
|
| 243 |
+
Consultation Brief
|
| 244 |
+
</h2>
|
| 245 |
+
</header>
|
| 246 |
+
|
| 247 |
+
{chatSummary ? (
|
| 248 |
+
<div className="bg-yellow-50/30 p-8 rounded-xl border border-yellow-100 min-h-[500px]">
|
| 249 |
+
<div className="prose prose-sm max-w-none text-gray-800 leading-relaxed whitespace-pre-wrap font-medium">
|
| 250 |
+
{chatSummary}
|
| 251 |
+
</div>
|
| 252 |
+
</div>
|
| 253 |
+
) : (
|
| 254 |
+
<div className="flex items-center justify-center h-64 border-2 border-dashed border-gray-200 rounded-xl">
|
| 255 |
+
<p className="text-gray-400 italic">Consultation brief not generated.</p>
|
| 256 |
+
</div>
|
| 257 |
+
)}
|
| 258 |
+
|
| 259 |
+
{/* FOOTER - BOTTOM OF FINAL PAGE */}
|
| 260 |
+
<div className="mt-auto pt-12 border-t-4 border-black">
|
| 261 |
+
<div className="flex justify-between items-end">
|
| 262 |
+
<div className="max-w-md">
|
| 263 |
+
<p className="font-black text-gray-900 text-xs uppercase tracking-widest mb-2">Disclaimer</p>
|
| 264 |
+
<p className="text-[10px] text-gray-500 leading-normal text-justify">
|
| 265 |
+
This report is generated by an AI assistant for educational purposes only. It is not a medical device.
|
| 266 |
+
Always consult a qualified healthcare provider for diagnosis and treatment. The information provided
|
| 267 |
+
is based on the inputs provided during the session and may not cover all clinical aspects.
|
| 268 |
+
</p>
|
| 269 |
+
</div>
|
| 270 |
+
<div className="text-right">
|
| 271 |
+
<p className="font-black text-gray-900 text-lg">SomAI</p>
|
| 272 |
+
<p className="text-[10px] font-bold text-gray-400 uppercase tracking-wider">Powered by Google Gemini</p>
|
| 273 |
+
</div>
|
| 274 |
+
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 275 |
</div>
|
| 276 |
+
</div>
|
| 277 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 278 |
</div>
|
| 279 |
+
);
|
|
|
|
|
|
|
| 280 |
};
|
| 281 |
|
| 282 |
export default PrintReport;
|