Update components/ReportView.tsx
Browse files- components/ReportView.tsx +174 -100
components/ReportView.tsx
CHANGED
|
@@ -1,111 +1,185 @@
|
|
| 1 |
import React from 'react';
|
| 2 |
import { PatientProfile, ClinicalVitals, RiskAnalysisResult, ChatMessage, Medication } from '../types';
|
| 3 |
-
import { FileText, User, Activity, Pill, MessageSquare, ShieldCheck, Zap, Server } from 'lucide-react';
|
| 4 |
|
| 5 |
interface ReportViewProps {
|
| 6 |
-
profile: PatientProfile;
|
| 7 |
-
vitals: ClinicalVitals;
|
| 8 |
-
riskResult: RiskAnalysisResult | null;
|
| 9 |
-
chatHistory: ChatMessage[];
|
| 10 |
-
chatSummary: string;
|
| 11 |
-
medications: Medication[];
|
| 12 |
}
|
| 13 |
|
| 14 |
const ReportView: React.FC<ReportViewProps> = ({
|
| 15 |
-
profile,
|
| 16 |
-
vitals,
|
| 17 |
-
riskResult,
|
| 18 |
-
chatHistory,
|
| 19 |
-
chatSummary,
|
| 20 |
-
medications
|
| 21 |
}) => {
|
| 22 |
-
return (
|
| 23 |
-
<div className="space-y-6 mt-12 pt-8 border-t border-white/10">
|
| 24 |
-
<h2 className="text-2xl font-bold text-white flex items-center gap-2">
|
| 25 |
-
<FileText className="text-neon-green" />
|
| 26 |
-
</h2>
|
| 27 |
-
|
| 28 |
-
<
|
| 29 |
-
|
| 30 |
-
<
|
| 31 |
-
|
| 32 |
-
<
|
| 33 |
-
|
| 34 |
-
<div className="
|
| 35 |
-
<div className="bg-black/20 p-3 rounded-lg border border-white/5"><span className="text-gray-500 text-xs
|
| 36 |
-
<div className="bg-black/20 p-3 rounded-lg border border-white/5"><span className="text-gray-500 text-xs
|
| 37 |
-
</div>
|
| 38 |
-
</
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
<
|
| 44 |
-
<
|
| 45 |
-
<
|
| 46 |
-
|
| 47 |
-
<div className="
|
| 48 |
-
<div
|
| 49 |
-
</
|
| 50 |
-
|
| 51 |
-
|
| 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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 109 |
};
|
| 110 |
|
| 111 |
export default ReportView;
|
|
|
|
| 1 |
import React from 'react';
|
| 2 |
import { PatientProfile, ClinicalVitals, RiskAnalysisResult, ChatMessage, Medication } from '../types';
|
| 3 |
+
import { FileText, User, Activity, Pill, MessageSquare, ShieldCheck, Zap, Server, Clipboard } from 'lucide-react';
|
| 4 |
|
| 5 |
interface ReportViewProps {
|
| 6 |
+
profile: PatientProfile;
|
| 7 |
+
vitals: ClinicalVitals;
|
| 8 |
+
riskResult: RiskAnalysisResult | null;
|
| 9 |
+
chatHistory: ChatMessage[];
|
| 10 |
+
chatSummary: string;
|
| 11 |
+
medications: Medication[];
|
| 12 |
}
|
| 13 |
|
| 14 |
const ReportView: React.FC<ReportViewProps> = ({
|
| 15 |
+
profile,
|
| 16 |
+
vitals,
|
| 17 |
+
riskResult,
|
| 18 |
+
chatHistory,
|
| 19 |
+
chatSummary,
|
| 20 |
+
medications
|
| 21 |
}) => {
|
| 22 |
+
return (
|
| 23 |
+
<div className="space-y-6 mt-12 pt-8 border-t border-white/10">
|
| 24 |
+
<h2 className="text-2xl font-bold text-white flex items-center gap-2">
|
| 25 |
+
<FileText className="text-neon-green" /> Full Clinical Report
|
| 26 |
+
</h2>
|
| 27 |
+
|
| 28 |
+
<div className="glass-panel p-6 rounded-2xl space-y-8">
|
| 29 |
+
{/* 1. Demographics (Compact) */}
|
| 30 |
+
<section>
|
| 31 |
+
<h3 className="text-sm font-mono font-bold text-gray-400 uppercase mb-4 border-b border-white/5 pb-2 flex items-center gap-2">
|
| 32 |
+
<User size={16} /> Patient Demographics
|
| 33 |
+
</h3>
|
| 34 |
+
<div className="grid grid-cols-2 md:grid-cols-4 gap-4 text-sm">
|
| 35 |
+
<div className="bg-black/20 p-3 rounded-lg border border-white/5"><span className="text-gray-500 block text-xs uppercase tracking-wide">Name</span><span className="text-white font-bold">{profile.name}</span></div>
|
| 36 |
+
<div className="bg-black/20 p-3 rounded-lg border border-white/5"><span className="text-gray-500 block text-xs uppercase tracking-wide">Age</span><span className="text-white font-bold">{profile.age}</span></div>
|
| 37 |
+
<div className="bg-black/20 p-3 rounded-lg border border-white/5"><span className="text-gray-500 block text-xs uppercase tracking-wide">Gender</span><span className="text-white font-bold">{profile.gender}</span></div>
|
| 38 |
+
<div className="bg-black/20 p-3 rounded-lg border border-white/5"><span className="text-gray-500 block text-xs uppercase tracking-wide">Blood Group</span><span className="text-white font-bold">{profile.bloodGroup}</span></div>
|
| 39 |
+
</div>
|
| 40 |
+
</section>
|
| 41 |
+
|
| 42 |
+
{/* 2. Condition & History (Full Width - Moved here per request) */}
|
| 43 |
+
<section className="bg-white/5 p-4 rounded-xl border border-white/5">
|
| 44 |
+
<h3 className="text-sm font-mono font-bold text-gray-400 uppercase mb-3 flex items-center gap-2">
|
| 45 |
+
<Clipboard size={16} /> Clinical Background
|
| 46 |
+
</h3>
|
| 47 |
+
<div className="space-y-4">
|
| 48 |
+
<div>
|
| 49 |
+
<span className="text-xs text-neon-blue font-bold uppercase tracking-wide block mb-1">Primary Condition</span>
|
| 50 |
+
<p className="text-white text-sm bg-black/20 p-3 rounded-lg border border-white/5">{profile.condition}</p>
|
| 51 |
+
</div>
|
| 52 |
+
<div>
|
| 53 |
+
<span className="text-xs text-gray-500 font-bold uppercase tracking-wide block mb-1">Detailed History</span>
|
| 54 |
+
<p className="text-gray-300 text-sm bg-black/20 p-3 rounded-lg border border-white/5 leading-relaxed">
|
| 55 |
+
{profile.history || 'No detailed history recorded.'}
|
| 56 |
+
</p>
|
| 57 |
+
</div>
|
| 58 |
+
</div>
|
| 59 |
+
</section>
|
| 60 |
+
|
| 61 |
+
{/* 3. Vitals & Risk */}
|
| 62 |
+
<section>
|
| 63 |
+
<h3 className="text-sm font-mono font-bold text-gray-400 uppercase mb-4 border-b border-white/5 pb-2 flex items-center gap-2 justify-between">
|
| 64 |
+
<div className="flex items-center gap-2"><Activity size={16} /> Vitals & Risk Analysis</div>
|
| 65 |
+
{riskResult?.source && (
|
| 66 |
+
<span className="text-[10px] font-mono font-medium text-gray-500 flex items-center gap-1 bg-white/5 px-2 py-0.5 rounded">
|
| 67 |
+
{riskResult.source.includes('Gemini') ? <Zap size={10}/> : <Server size={10}/>}
|
| 68 |
+
{riskResult.source}
|
| 69 |
+
</span>
|
| 70 |
+
)}
|
| 71 |
+
</h3>
|
| 72 |
+
<div className="grid grid-cols-1 md:grid-cols-4 gap-4 mb-4">
|
| 73 |
+
<div className="bg-white/5 p-3 rounded-lg text-center border border-white/5">
|
| 74 |
+
<span className="text-gray-500 text-xs block">Systolic BP</span>
|
| 75 |
+
<span className="font-mono font-bold text-neon-green text-lg">{vitals.systolicBp}</span>
|
| 76 |
+
</div>
|
| 77 |
+
<div className="bg-white/5 p-3 rounded-lg text-center border border-white/5">
|
| 78 |
+
<span className="text-gray-500 text-xs block">Glucose</span>
|
| 79 |
+
<span className="font-mono font-bold text-neon-yellow text-lg">{vitals.glucose}</span>
|
| 80 |
+
</div>
|
| 81 |
+
<div className="bg-white/5 p-3 rounded-lg text-center border border-white/5">
|
| 82 |
+
<span className="text-gray-500 text-xs block">SpO2</span>
|
| 83 |
+
<span className={`font-mono font-bold text-lg ${vitals.spo2 < 95 ? 'text-neon-red' : 'text-cyan-400'}`}>{vitals.spo2}%</span>
|
| 84 |
+
</div>
|
| 85 |
+
<div className="bg-white/5 p-3 rounded-lg text-center border border-white/5">
|
| 86 |
+
<span className="text-gray-500 text-xs block">Risk Score</span>
|
| 87 |
+
<span className="font-mono font-bold text-neon-red text-lg">{riskResult?.numericScore ?? 'N/A'}</span>
|
| 88 |
+
</div>
|
| 89 |
+
</div>
|
| 90 |
+
{riskResult ? (
|
| 91 |
+
<div className="space-y-4">
|
| 92 |
+
<div className="text-sm text-gray-300 bg-black/20 p-4 rounded-lg border border-white/5">
|
| 93 |
+
<p><strong className="text-neon-blue font-mono text-xs uppercase block mb-1">Summary</strong> {riskResult.summary}</p>
|
| 94 |
+
<div className="grid grid-cols-1 md:grid-cols-2 gap-4 mt-3">
|
| 95 |
+
<div>
|
| 96 |
+
<strong className="text-neon-green font-mono text-xs uppercase block mb-1">Recommended Actions</strong>
|
| 97 |
+
<ul className="list-disc list-inside text-gray-400">
|
| 98 |
+
{riskResult.actionItems.map((item, idx) => <li key={idx}>{item}</li>)}
|
| 99 |
+
</ul>
|
| 100 |
+
</div>
|
| 101 |
+
</div>
|
| 102 |
+
</div>
|
| 103 |
+
|
| 104 |
+
{/* Medical Coding Pipeline Table */}
|
| 105 |
+
<div className="bg-black/20 rounded-lg border border-white/5 overflow-hidden">
|
| 106 |
+
<div className="px-4 py-2 bg-purple-500/10 border-b border-white/5 flex items-center gap-2 text-purple-300 font-bold text-xs uppercase tracking-wide">
|
| 107 |
+
<ShieldCheck size={14} /> Insurance & Coding Pipeline
|
| 108 |
+
</div>
|
| 109 |
+
<table className="w-full text-xs text-left">
|
| 110 |
+
<thead className="text-gray-500 border-b border-white/5">
|
| 111 |
+
<tr>
|
| 112 |
+
<th className="px-4 py-2">Diagnosis Type</th>
|
| 113 |
+
<th className="px-4 py-2">ICD-10 Code</th>
|
| 114 |
+
<th className="px-4 py-2">Description</th>
|
| 115 |
+
</tr>
|
| 116 |
+
</thead>
|
| 117 |
+
<tbody className="divide-y divide-white/5 text-gray-300">
|
| 118 |
+
{riskResult.codingPipeline?.map((code, idx) => (
|
| 119 |
+
<tr key={idx} className="hover:bg-white/5">
|
| 120 |
+
<td className="px-4 py-2 text-gray-400">{code.type}</td>
|
| 121 |
+
<td className="px-4 py-2 font-mono text-purple-400 font-bold">{code.code}</td>
|
| 122 |
+
<td className="px-4 py-2">{code.description}</td>
|
| 123 |
+
</tr>
|
| 124 |
+
))}
|
| 125 |
+
{(!riskResult.codingPipeline || riskResult.codingPipeline.length === 0) && (
|
| 126 |
+
<tr>
|
| 127 |
+
<td colSpan={3} className="px-4 py-2 italic text-gray-500">Pipeline empty. Run analysis to generate.</td>
|
| 128 |
+
</tr>
|
| 129 |
+
)}
|
| 130 |
+
</tbody>
|
| 131 |
+
</table>
|
| 132 |
+
{riskResult.insuranceNote && (
|
| 133 |
+
<div className="px-4 py-2 border-t border-white/5 bg-white/5">
|
| 134 |
+
<p className="text-[10px] text-gray-500 uppercase font-bold">Medical Necessity Note</p>
|
| 135 |
+
<p className="text-xs text-gray-300 italic">{riskResult.insuranceNote}</p>
|
| 136 |
+
</div>
|
| 137 |
+
)}
|
| 138 |
+
</div>
|
| 139 |
+
</div>
|
| 140 |
+
) : (
|
| 141 |
+
<p className="text-gray-500 text-sm italic">Analysis not yet performed.</p>
|
| 142 |
+
)}
|
| 143 |
+
</section>
|
| 144 |
+
|
| 145 |
+
{/* Meds */}
|
| 146 |
+
<section>
|
| 147 |
+
<h3 className="text-sm font-mono font-bold text-gray-400 uppercase mb-4 border-b border-white/5 pb-2 flex items-center gap-2">
|
| 148 |
+
<Pill size={16} /> Medication Schedule
|
| 149 |
+
</h3>
|
| 150 |
+
<ul className="grid grid-cols-1 md:grid-cols-2 gap-2">
|
| 151 |
+
{medications.length > 0 ? medications.map(med => (
|
| 152 |
+
<li key={med.id} className="flex justify-between items-center text-sm bg-white/5 p-3 rounded-lg border border-white/5">
|
| 153 |
+
<div>
|
| 154 |
+
<span className="font-bold text-white block">{med.name}</span>
|
| 155 |
+
<span className="text-xs text-gray-500">{med.dosage} • {med.time}</span>
|
| 156 |
+
</div>
|
| 157 |
+
<span className={`px-2 py-1 rounded text-xs font-bold ${med.taken ? "bg-green-500/20 text-green-400" : "bg-yellow-500/20 text-yellow-400"}`}>
|
| 158 |
+
{med.taken ? 'Taken' : 'Pending'}
|
| 159 |
+
</span>
|
| 160 |
+
</li>
|
| 161 |
+
)) : <li className="text-gray-500 text-sm italic">No medications recorded.</li>}
|
| 162 |
+
</ul>
|
| 163 |
+
</section>
|
| 164 |
+
|
| 165 |
+
{/* Chat Summary */}
|
| 166 |
+
<section>
|
| 167 |
+
<h3 className="text-sm font-mono font-bold text-gray-400 uppercase mb-4 border-b border-white/5 pb-2 flex items-center gap-2">
|
| 168 |
+
<MessageSquare size={16} /> Consultation Brief
|
| 169 |
+
</h3>
|
| 170 |
+
{chatSummary ? (
|
| 171 |
+
<div className="bg-black/20 p-4 rounded-lg border border-white/5">
|
| 172 |
+
<p className="text-sm text-gray-300 whitespace-pre-wrap leading-relaxed">
|
| 173 |
+
{chatSummary}
|
| 174 |
+
</p>
|
| 175 |
+
</div>
|
| 176 |
+
) : (
|
| 177 |
+
<p className="text-gray-500 text-sm italic">No consultation summary available.</p>
|
| 178 |
+
)}
|
| 179 |
+
</section>
|
| 180 |
+
</div>
|
| 181 |
+
</div>
|
| 182 |
+
);
|
| 183 |
};
|
| 184 |
|
| 185 |
export default ReportView;
|