Spaces:
Running
Running
Upload 102 files
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- ipdmodule/.gitignore +27 -0
- ipdmodule/app/components/sidebar.tsx +90 -0
- ipdmodule/app/globals.css +94 -0
- ipdmodule/app/layout.tsx +20 -0
- ipdmodule/app/page.tsx +101 -0
- ipdmodule/components.json +21 -0
- ipdmodule/components/activity-logs-tab.tsx +434 -0
- ipdmodule/components/admission-assessment-form.tsx +407 -0
- ipdmodule/components/admission-assessment.tsx +223 -0
- ipdmodule/components/app-header.tsx +84 -0
- ipdmodule/components/app-sidebar.tsx +63 -0
- ipdmodule/components/appointment-page.tsx +277 -0
- ipdmodule/components/appointment-search-controls.tsx +58 -0
- ipdmodule/components/consultant-notes-form.tsx +242 -0
- ipdmodule/components/cross-referral-form.tsx +252 -0
- ipdmodule/components/discharge-summary-form.tsx +1463 -0
- ipdmodule/components/discharge-summary.tsx +276 -0
- ipdmodule/components/form-navigation.tsx +114 -0
- ipdmodule/components/ipd-page.tsx +416 -0
- ipdmodule/components/ipd-patient-details.tsx +414 -0
- ipdmodule/components/ipd-patient-flow.tsx +171 -0
- ipdmodule/components/ipd-patient-list.tsx +215 -0
- ipdmodule/components/ipd-patient-module.tsx +445 -0
- ipdmodule/components/lab-radiology-tab.tsx +646 -0
- ipdmodule/components/opd-consultation-history.tsx +519 -0
- ipdmodule/components/ot-details-form.tsx +464 -0
- ipdmodule/components/ot-details.tsx +204 -0
- ipdmodule/components/ot-notes-form.tsx +266 -0
- ipdmodule/components/progress-notes-form.tsx +217 -0
- ipdmodule/components/progress-notes.tsx +230 -0
- ipdmodule/components/radiology-findings-form.tsx +331 -0
- ipdmodule/components/rich-text-editor.tsx +334 -0
- ipdmodule/components/sidebar.tsx +90 -0
- ipdmodule/components/theme-provider.tsx +11 -0
- ipdmodule/components/ui/accordion.tsx +58 -0
- ipdmodule/components/ui/alert-dialog.tsx +141 -0
- ipdmodule/components/ui/alert.tsx +59 -0
- ipdmodule/components/ui/aspect-ratio.tsx +7 -0
- ipdmodule/components/ui/avatar.tsx +50 -0
- ipdmodule/components/ui/badge.tsx +36 -0
- ipdmodule/components/ui/breadcrumb.tsx +115 -0
- ipdmodule/components/ui/button.tsx +56 -0
- ipdmodule/components/ui/calendar.tsx +66 -0
- ipdmodule/components/ui/card.tsx +79 -0
- ipdmodule/components/ui/carousel.tsx +262 -0
- ipdmodule/components/ui/chart.tsx +365 -0
- ipdmodule/components/ui/checkbox.tsx +30 -0
- ipdmodule/components/ui/collapsible.tsx +11 -0
- ipdmodule/components/ui/command.tsx +153 -0
- ipdmodule/components/ui/context-menu.tsx +200 -0
ipdmodule/.gitignore
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
|
| 2 |
+
|
| 3 |
+
# dependencies
|
| 4 |
+
/node_modules
|
| 5 |
+
|
| 6 |
+
# next.js
|
| 7 |
+
/.next/
|
| 8 |
+
/out/
|
| 9 |
+
|
| 10 |
+
# production
|
| 11 |
+
/build
|
| 12 |
+
|
| 13 |
+
# debug
|
| 14 |
+
npm-debug.log*
|
| 15 |
+
yarn-debug.log*
|
| 16 |
+
yarn-error.log*
|
| 17 |
+
.pnpm-debug.log*
|
| 18 |
+
|
| 19 |
+
# env files
|
| 20 |
+
.env*
|
| 21 |
+
|
| 22 |
+
# vercel
|
| 23 |
+
.vercel
|
| 24 |
+
|
| 25 |
+
# typescript
|
| 26 |
+
*.tsbuildinfo
|
| 27 |
+
next-env.d.ts
|
ipdmodule/app/components/sidebar.tsx
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"use client"
|
| 2 |
+
|
| 3 |
+
import { useState } from "react"
|
| 4 |
+
import { Button } from "@/components/ui/button"
|
| 5 |
+
import { ScrollArea } from "@/components/ui/scroll-area"
|
| 6 |
+
import { Hospital, FileText, Menu, X, Stethoscope, Bed } from "lucide-react"
|
| 7 |
+
|
| 8 |
+
interface SidebarProps {
|
| 9 |
+
activeModule: string
|
| 10 |
+
onModuleSelect: (module: string) => void
|
| 11 |
+
}
|
| 12 |
+
|
| 13 |
+
export function Sidebar({ activeModule, onModuleSelect }: SidebarProps) {
|
| 14 |
+
const [isCollapsed, setIsCollapsed] = useState(false)
|
| 15 |
+
|
| 16 |
+
const modules = [
|
| 17 |
+
{ id: "ipd", label: "IPD", icon: Bed },
|
| 18 |
+
{ id: "opd", label: "OPD", icon: Stethoscope },
|
| 19 |
+
{ id: "emergency", label: "Emergency", icon: Hospital },
|
| 20 |
+
{ id: "pharmacy", label: "Pharmacy", icon: FileText },
|
| 21 |
+
{ id: "lab", label: "Laboratory", icon: FileText },
|
| 22 |
+
{ id: "radiology", label: "Radiology", icon: FileText },
|
| 23 |
+
]
|
| 24 |
+
|
| 25 |
+
return (
|
| 26 |
+
<>
|
| 27 |
+
{/* Mobile overlay */}
|
| 28 |
+
{!isCollapsed && (
|
| 29 |
+
<div className="fixed inset-0 bg-black bg-opacity-50 z-40 md:hidden" onClick={() => setIsCollapsed(true)} />
|
| 30 |
+
)}
|
| 31 |
+
|
| 32 |
+
{/* Sidebar */}
|
| 33 |
+
<div
|
| 34 |
+
className={`
|
| 35 |
+
fixed left-0 top-0 h-full bg-white border-r border-gray-200 z-50 transition-all duration-300
|
| 36 |
+
${isCollapsed ? "-translate-x-full md:translate-x-0 md:w-16" : "w-64"}
|
| 37 |
+
`}
|
| 38 |
+
>
|
| 39 |
+
{/* Header */}
|
| 40 |
+
<div className="flex items-center justify-between p-4 border-b border-gray-200">
|
| 41 |
+
{!isCollapsed && (
|
| 42 |
+
<div className="flex items-center space-x-2">
|
| 43 |
+
<Hospital className="h-8 w-8 text-blue-600" />
|
| 44 |
+
<span className="text-xl font-bold text-gray-800">TatvaCare</span>
|
| 45 |
+
</div>
|
| 46 |
+
)}
|
| 47 |
+
<Button variant="ghost" size="sm" onClick={() => setIsCollapsed(!isCollapsed)} className="md:hidden">
|
| 48 |
+
{isCollapsed ? <Menu className="h-4 w-4" /> : <X className="h-4 w-4" />}
|
| 49 |
+
</Button>
|
| 50 |
+
</div>
|
| 51 |
+
|
| 52 |
+
{/* Navigation */}
|
| 53 |
+
<ScrollArea className="flex-1 p-4">
|
| 54 |
+
<div className="space-y-2">
|
| 55 |
+
{modules.map((module) => {
|
| 56 |
+
const Icon = module.icon
|
| 57 |
+
return (
|
| 58 |
+
<Button
|
| 59 |
+
key={module.id}
|
| 60 |
+
variant={activeModule === module.id ? "default" : "ghost"}
|
| 61 |
+
className={`
|
| 62 |
+
w-full justify-start
|
| 63 |
+
${isCollapsed ? "px-2" : "px-4"}
|
| 64 |
+
`}
|
| 65 |
+
onClick={() => {
|
| 66 |
+
onModuleSelect(module.id)
|
| 67 |
+
if (window.innerWidth < 768) setIsCollapsed(true)
|
| 68 |
+
}}
|
| 69 |
+
>
|
| 70 |
+
<Icon className="h-4 w-4" />
|
| 71 |
+
{!isCollapsed && <span className="ml-2">{module.label}</span>}
|
| 72 |
+
</Button>
|
| 73 |
+
)
|
| 74 |
+
})}
|
| 75 |
+
</div>
|
| 76 |
+
</ScrollArea>
|
| 77 |
+
</div>
|
| 78 |
+
|
| 79 |
+
{/* Mobile menu button */}
|
| 80 |
+
<Button
|
| 81 |
+
variant="outline"
|
| 82 |
+
size="sm"
|
| 83 |
+
className="fixed top-4 left-4 z-40 md:hidden bg-transparent"
|
| 84 |
+
onClick={() => setIsCollapsed(false)}
|
| 85 |
+
>
|
| 86 |
+
<Menu className="h-4 w-4" />
|
| 87 |
+
</Button>
|
| 88 |
+
</>
|
| 89 |
+
)
|
| 90 |
+
}
|
ipdmodule/app/globals.css
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
@tailwind base;
|
| 2 |
+
@tailwind components;
|
| 3 |
+
@tailwind utilities;
|
| 4 |
+
|
| 5 |
+
body {
|
| 6 |
+
font-family: Arial, Helvetica, sans-serif;
|
| 7 |
+
}
|
| 8 |
+
|
| 9 |
+
@layer utilities {
|
| 10 |
+
.text-balance {
|
| 11 |
+
text-wrap: balance;
|
| 12 |
+
}
|
| 13 |
+
}
|
| 14 |
+
|
| 15 |
+
@layer base {
|
| 16 |
+
:root {
|
| 17 |
+
--background: 0 0% 100%;
|
| 18 |
+
--foreground: 0 0% 3.9%;
|
| 19 |
+
--card: 0 0% 100%;
|
| 20 |
+
--card-foreground: 0 0% 3.9%;
|
| 21 |
+
--popover: 0 0% 100%;
|
| 22 |
+
--popover-foreground: 0 0% 3.9%;
|
| 23 |
+
--primary: 0 0% 9%;
|
| 24 |
+
--primary-foreground: 0 0% 98%;
|
| 25 |
+
--secondary: 0 0% 96.1%;
|
| 26 |
+
--secondary-foreground: 0 0% 9%;
|
| 27 |
+
--muted: 0 0% 96.1%;
|
| 28 |
+
--muted-foreground: 0 0% 45.1%;
|
| 29 |
+
--accent: 0 0% 96.1%;
|
| 30 |
+
--accent-foreground: 0 0% 9%;
|
| 31 |
+
--destructive: 0 84.2% 60.2%;
|
| 32 |
+
--destructive-foreground: 0 0% 98%;
|
| 33 |
+
--border: 0 0% 89.8%;
|
| 34 |
+
--input: 0 0% 89.8%;
|
| 35 |
+
--ring: 0 0% 3.9%;
|
| 36 |
+
--chart-1: 12 76% 61%;
|
| 37 |
+
--chart-2: 173 58% 39%;
|
| 38 |
+
--chart-3: 197 37% 24%;
|
| 39 |
+
--chart-4: 43 74% 66%;
|
| 40 |
+
--chart-5: 27 87% 67%;
|
| 41 |
+
--radius: 0.5rem;
|
| 42 |
+
--sidebar-background: 0 0% 98%;
|
| 43 |
+
--sidebar-foreground: 240 5.3% 26.1%;
|
| 44 |
+
--sidebar-primary: 240 5.9% 10%;
|
| 45 |
+
--sidebar-primary-foreground: 0 0% 98%;
|
| 46 |
+
--sidebar-accent: 240 4.8% 95.9%;
|
| 47 |
+
--sidebar-accent-foreground: 240 5.9% 10%;
|
| 48 |
+
--sidebar-border: 220 13% 91%;
|
| 49 |
+
--sidebar-ring: 217.2 91.2% 59.8%;
|
| 50 |
+
}
|
| 51 |
+
.dark {
|
| 52 |
+
--background: 0 0% 3.9%;
|
| 53 |
+
--foreground: 0 0% 98%;
|
| 54 |
+
--card: 0 0% 3.9%;
|
| 55 |
+
--card-foreground: 0 0% 98%;
|
| 56 |
+
--popover: 0 0% 3.9%;
|
| 57 |
+
--popover-foreground: 0 0% 98%;
|
| 58 |
+
--primary: 0 0% 98%;
|
| 59 |
+
--primary-foreground: 0 0% 9%;
|
| 60 |
+
--secondary: 0 0% 14.9%;
|
| 61 |
+
--secondary-foreground: 0 0% 98%;
|
| 62 |
+
--muted: 0 0% 14.9%;
|
| 63 |
+
--muted-foreground: 0 0% 63.9%;
|
| 64 |
+
--accent: 0 0% 14.9%;
|
| 65 |
+
--accent-foreground: 0 0% 98%;
|
| 66 |
+
--destructive: 0 62.8% 30.6%;
|
| 67 |
+
--destructive-foreground: 0 0% 98%;
|
| 68 |
+
--border: 0 0% 14.9%;
|
| 69 |
+
--input: 0 0% 14.9%;
|
| 70 |
+
--ring: 0 0% 83.1%;
|
| 71 |
+
--chart-1: 220 70% 50%;
|
| 72 |
+
--chart-2: 160 60% 45%;
|
| 73 |
+
--chart-3: 30 80% 55%;
|
| 74 |
+
--chart-4: 280 65% 60%;
|
| 75 |
+
--chart-5: 340 75% 55%;
|
| 76 |
+
--sidebar-background: 240 5.9% 10%;
|
| 77 |
+
--sidebar-foreground: 240 4.8% 95.9%;
|
| 78 |
+
--sidebar-primary: 224.3 76.3% 48%;
|
| 79 |
+
--sidebar-primary-foreground: 0 0% 100%;
|
| 80 |
+
--sidebar-accent: 240 3.7% 15.9%;
|
| 81 |
+
--sidebar-accent-foreground: 240 4.8% 95.9%;
|
| 82 |
+
--sidebar-border: 240 3.7% 15.9%;
|
| 83 |
+
--sidebar-ring: 217.2 91.2% 59.8%;
|
| 84 |
+
}
|
| 85 |
+
}
|
| 86 |
+
|
| 87 |
+
@layer base {
|
| 88 |
+
* {
|
| 89 |
+
@apply border-border;
|
| 90 |
+
}
|
| 91 |
+
body {
|
| 92 |
+
@apply bg-background text-foreground;
|
| 93 |
+
}
|
| 94 |
+
}
|
ipdmodule/app/layout.tsx
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import type { Metadata } from 'next'
|
| 2 |
+
import './globals.css'
|
| 3 |
+
|
| 4 |
+
export const metadata: Metadata = {
|
| 5 |
+
title: 'v0 App',
|
| 6 |
+
description: 'Created with v0',
|
| 7 |
+
generator: 'v0.dev',
|
| 8 |
+
}
|
| 9 |
+
|
| 10 |
+
export default function RootLayout({
|
| 11 |
+
children,
|
| 12 |
+
}: Readonly<{
|
| 13 |
+
children: React.ReactNode
|
| 14 |
+
}>) {
|
| 15 |
+
return (
|
| 16 |
+
<html lang="en">
|
| 17 |
+
<body>{children}</body>
|
| 18 |
+
</html>
|
| 19 |
+
)
|
| 20 |
+
}
|
ipdmodule/app/page.tsx
ADDED
|
@@ -0,0 +1,101 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"use client"
|
| 2 |
+
|
| 3 |
+
import { useState } from "react"
|
| 4 |
+
import { AppHeader } from "@/components/app-header"
|
| 5 |
+
import { AppSidebar } from "@/components/app-sidebar"
|
| 6 |
+
import { AppointmentPage } from "@/components/appointment-page"
|
| 7 |
+
import { IPDPage } from "@/components/ipd-page"
|
| 8 |
+
import { IPDPatientModule } from "@/components/ipd-patient-module"
|
| 9 |
+
|
| 10 |
+
interface Patient {
|
| 11 |
+
id: string
|
| 12 |
+
name: string
|
| 13 |
+
patientId: string
|
| 14 |
+
age: number
|
| 15 |
+
gender: string
|
| 16 |
+
ward: string
|
| 17 |
+
room: string
|
| 18 |
+
contact: string
|
| 19 |
+
admittingDoctor: string
|
| 20 |
+
admittedOn: string
|
| 21 |
+
mrn: string
|
| 22 |
+
bed: string
|
| 23 |
+
}
|
| 24 |
+
|
| 25 |
+
export default function HomePage() {
|
| 26 |
+
const [activeView, setActiveView] = useState("appointment")
|
| 27 |
+
const [selectedPatient, setSelectedPatient] = useState<Patient | null>(null)
|
| 28 |
+
const [isTransitioning, setIsTransitioning] = useState(false)
|
| 29 |
+
|
| 30 |
+
const handleNavigation = (item: string) => {
|
| 31 |
+
if (item === activeView) return
|
| 32 |
+
|
| 33 |
+
setIsTransitioning(true)
|
| 34 |
+
setTimeout(() => {
|
| 35 |
+
setActiveView(item)
|
| 36 |
+
setSelectedPatient(null) // Reset patient selection when navigating
|
| 37 |
+
setIsTransitioning(false)
|
| 38 |
+
}, 150)
|
| 39 |
+
}
|
| 40 |
+
|
| 41 |
+
const handlePatientSelect = (patient: Patient) => {
|
| 42 |
+
setIsTransitioning(true)
|
| 43 |
+
setTimeout(() => {
|
| 44 |
+
setSelectedPatient(patient)
|
| 45 |
+
setIsTransitioning(false)
|
| 46 |
+
}, 150)
|
| 47 |
+
}
|
| 48 |
+
|
| 49 |
+
const handleBackToIPD = () => {
|
| 50 |
+
setIsTransitioning(true)
|
| 51 |
+
setTimeout(() => {
|
| 52 |
+
setSelectedPatient(null)
|
| 53 |
+
setIsTransitioning(false)
|
| 54 |
+
}, 150)
|
| 55 |
+
}
|
| 56 |
+
|
| 57 |
+
const handleBackToAppointment = () => {
|
| 58 |
+
setIsTransitioning(true)
|
| 59 |
+
setTimeout(() => {
|
| 60 |
+
setActiveView("appointment")
|
| 61 |
+
setSelectedPatient(null)
|
| 62 |
+
setIsTransitioning(false)
|
| 63 |
+
}, 150)
|
| 64 |
+
}
|
| 65 |
+
|
| 66 |
+
return (
|
| 67 |
+
<div className="bg-[#fafafb] min-h-screen">
|
| 68 |
+
{/* Only show header and sidebar for appointment view */}
|
| 69 |
+
{activeView === "appointment" && (
|
| 70 |
+
<>
|
| 71 |
+
<AppHeader />
|
| 72 |
+
<div className="flex">
|
| 73 |
+
<AppSidebar activeItem={activeView} onItemClick={handleNavigation} />
|
| 74 |
+
<main
|
| 75 |
+
className={`flex-1 transition-all duration-300 ${
|
| 76 |
+
isTransitioning ? "opacity-0 transform translate-x-4" : "opacity-100 transform translate-x-0"
|
| 77 |
+
}`}
|
| 78 |
+
>
|
| 79 |
+
<AppointmentPage />
|
| 80 |
+
</main>
|
| 81 |
+
</div>
|
| 82 |
+
</>
|
| 83 |
+
)}
|
| 84 |
+
|
| 85 |
+
{/* IPD views take full screen */}
|
| 86 |
+
{activeView === "ipd" && (
|
| 87 |
+
<main
|
| 88 |
+
className={`transition-all duration-300 ${
|
| 89 |
+
isTransitioning ? "opacity-0 transform translate-x-4" : "opacity-100 transform translate-x-0"
|
| 90 |
+
}`}
|
| 91 |
+
>
|
| 92 |
+
{selectedPatient ? (
|
| 93 |
+
<IPDPatientModule patient={selectedPatient} onBackClick={handleBackToIPD} />
|
| 94 |
+
) : (
|
| 95 |
+
<IPDPage onPatientSelect={handlePatientSelect} onBackClick={handleBackToAppointment} />
|
| 96 |
+
)}
|
| 97 |
+
</main>
|
| 98 |
+
)}
|
| 99 |
+
</div>
|
| 100 |
+
)
|
| 101 |
+
}
|
ipdmodule/components.json
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"$schema": "https://ui.shadcn.com/schema.json",
|
| 3 |
+
"style": "default",
|
| 4 |
+
"rsc": true,
|
| 5 |
+
"tsx": true,
|
| 6 |
+
"tailwind": {
|
| 7 |
+
"config": "tailwind.config.ts",
|
| 8 |
+
"css": "app/globals.css",
|
| 9 |
+
"baseColor": "neutral",
|
| 10 |
+
"cssVariables": true,
|
| 11 |
+
"prefix": ""
|
| 12 |
+
},
|
| 13 |
+
"aliases": {
|
| 14 |
+
"components": "@/components",
|
| 15 |
+
"utils": "@/lib/utils",
|
| 16 |
+
"ui": "@/components/ui",
|
| 17 |
+
"lib": "@/lib",
|
| 18 |
+
"hooks": "@/hooks"
|
| 19 |
+
},
|
| 20 |
+
"iconLibrary": "lucide"
|
| 21 |
+
}
|
ipdmodule/components/activity-logs-tab.tsx
ADDED
|
@@ -0,0 +1,434 @@
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"use client"
|
| 2 |
+
|
| 3 |
+
import { useState } from "react"
|
| 4 |
+
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"
|
| 5 |
+
import { Badge } from "@/components/ui/badge"
|
| 6 |
+
import { Button } from "@/components/ui/button"
|
| 7 |
+
import { Input } from "@/components/ui/input"
|
| 8 |
+
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select"
|
| 9 |
+
import { Separator } from "@/components/ui/separator"
|
| 10 |
+
import { ScrollArea } from "@/components/ui/scroll-area"
|
| 11 |
+
import { Search, Filter, Clock, User, AlertTriangle, Activity, RefreshCw } from "lucide-react"
|
| 12 |
+
|
| 13 |
+
interface ActivityLogsTabProps {
|
| 14 |
+
patient: any
|
| 15 |
+
}
|
| 16 |
+
|
| 17 |
+
interface ActivityLog {
|
| 18 |
+
id: string
|
| 19 |
+
timestamp: string
|
| 20 |
+
user: string
|
| 21 |
+
role: string
|
| 22 |
+
action: string
|
| 23 |
+
section: string
|
| 24 |
+
field?: string
|
| 25 |
+
oldValue?: string
|
| 26 |
+
newValue?: string
|
| 27 |
+
changeType: "create" | "update" | "delete" | "load" | "view" | "print" | "export"
|
| 28 |
+
priority: "low" | "medium" | "high" | "critical"
|
| 29 |
+
ipAddress: string
|
| 30 |
+
device: string
|
| 31 |
+
description: string
|
| 32 |
+
}
|
| 33 |
+
|
| 34 |
+
export function ActivityLogsTab({ patient }: ActivityLogsTabProps) {
|
| 35 |
+
const [searchTerm, setSearchTerm] = useState("")
|
| 36 |
+
const [filterModule, setFilterModule] = useState("all")
|
| 37 |
+
const [filterChangeType, setFilterChangeType] = useState("all")
|
| 38 |
+
const [filterPriority, setFilterPriority] = useState("all")
|
| 39 |
+
const [filterUser, setFilterUser] = useState("all")
|
| 40 |
+
|
| 41 |
+
// Mock activity logs data
|
| 42 |
+
const [activityLogs, setActivityLogs] = useState<ActivityLog[]>([
|
| 43 |
+
{
|
| 44 |
+
id: "1",
|
| 45 |
+
timestamp: "2024-01-15 14:30:25",
|
| 46 |
+
user: "Dr. Sarah Johnson",
|
| 47 |
+
role: "Consultant",
|
| 48 |
+
action: "Updated Final Diagnosis",
|
| 49 |
+
section: "Discharge Summary",
|
| 50 |
+
field: "Final Diagnosis",
|
| 51 |
+
oldValue: "Acute Appendicitis",
|
| 52 |
+
newValue: "Acute Appendicitis with Peritonitis",
|
| 53 |
+
changeType: "update",
|
| 54 |
+
priority: "high",
|
| 55 |
+
ipAddress: "192.168.1.45",
|
| 56 |
+
device: "Chrome/Windows",
|
| 57 |
+
description: "Modified final diagnosis to include peritonitis complication",
|
| 58 |
+
},
|
| 59 |
+
{
|
| 60 |
+
id: "2",
|
| 61 |
+
timestamp: "2024-01-15 14:25:10",
|
| 62 |
+
user: "Nurse Maria Garcia",
|
| 63 |
+
role: "Staff Nurse",
|
| 64 |
+
action: "Added Progress Note",
|
| 65 |
+
section: "Progress Notes",
|
| 66 |
+
field: "Daily Progress",
|
| 67 |
+
oldValue: "",
|
| 68 |
+
newValue: "Patient stable, pain reduced, ambulating well",
|
| 69 |
+
changeType: "create",
|
| 70 |
+
priority: "medium",
|
| 71 |
+
ipAddress: "192.168.1.67",
|
| 72 |
+
device: "Safari/iPad",
|
| 73 |
+
description: "Added daily progress note for post-operative care",
|
| 74 |
+
},
|
| 75 |
+
{
|
| 76 |
+
id: "3",
|
| 77 |
+
timestamp: "2024-01-15 14:20:45",
|
| 78 |
+
user: "System",
|
| 79 |
+
role: "Auto-populate",
|
| 80 |
+
action: "Loaded OPD History",
|
| 81 |
+
section: "OPD History",
|
| 82 |
+
field: "Previous Consultations",
|
| 83 |
+
oldValue: "",
|
| 84 |
+
newValue: "3 previous consultations loaded",
|
| 85 |
+
changeType: "load",
|
| 86 |
+
priority: "low",
|
| 87 |
+
ipAddress: "127.0.0.1",
|
| 88 |
+
device: "System/Server",
|
| 89 |
+
description: "Automatically loaded patient's OPD consultation history",
|
| 90 |
+
},
|
| 91 |
+
{
|
| 92 |
+
id: "4",
|
| 93 |
+
timestamp: "2024-01-15 14:15:30",
|
| 94 |
+
user: "Dr. Michael Chen",
|
| 95 |
+
role: "Medical Officer",
|
| 96 |
+
action: "Updated OT Details",
|
| 97 |
+
section: "OT Details",
|
| 98 |
+
field: "Procedure Notes",
|
| 99 |
+
oldValue: "Laparoscopic appendectomy completed",
|
| 100 |
+
newValue: "Laparoscopic appendectomy completed. Minimal bleeding. Good hemostasis achieved.",
|
| 101 |
+
changeType: "update",
|
| 102 |
+
priority: "high",
|
| 103 |
+
ipAddress: "192.168.1.23",
|
| 104 |
+
device: "Firefox/Windows",
|
| 105 |
+
description: "Added detailed procedure notes post-surgery",
|
| 106 |
+
},
|
| 107 |
+
{
|
| 108 |
+
id: "5",
|
| 109 |
+
timestamp: "2024-01-15 14:10:15",
|
| 110 |
+
user: "Dr. Sarah Johnson",
|
| 111 |
+
role: "Consultant",
|
| 112 |
+
action: "Viewed Discharge Summary",
|
| 113 |
+
section: "Discharge Summary",
|
| 114 |
+
changeType: "view",
|
| 115 |
+
priority: "low",
|
| 116 |
+
ipAddress: "192.168.1.45",
|
| 117 |
+
device: "Chrome/Windows",
|
| 118 |
+
description: "Accessed discharge summary for review",
|
| 119 |
+
},
|
| 120 |
+
{
|
| 121 |
+
id: "6",
|
| 122 |
+
timestamp: "2024-01-15 14:05:00",
|
| 123 |
+
user: "Admin User",
|
| 124 |
+
role: "Administrator",
|
| 125 |
+
action: "Exported Patient Data",
|
| 126 |
+
section: "All Modules",
|
| 127 |
+
changeType: "export",
|
| 128 |
+
priority: "medium",
|
| 129 |
+
ipAddress: "192.168.1.10",
|
| 130 |
+
device: "Edge/Windows",
|
| 131 |
+
description: "Exported complete patient data for backup",
|
| 132 |
+
},
|
| 133 |
+
{
|
| 134 |
+
id: "7",
|
| 135 |
+
timestamp: "2024-01-15 13:55:20",
|
| 136 |
+
user: "Dr. Sarah Johnson",
|
| 137 |
+
role: "Consultant",
|
| 138 |
+
action: "Critical Alert - Allergy Updated",
|
| 139 |
+
section: "Assessment",
|
| 140 |
+
field: "Allergies",
|
| 141 |
+
oldValue: "NKDA",
|
| 142 |
+
newValue: "Penicillin - Rash",
|
| 143 |
+
changeType: "update",
|
| 144 |
+
priority: "critical",
|
| 145 |
+
ipAddress: "192.168.1.45",
|
| 146 |
+
device: "Chrome/Windows",
|
| 147 |
+
description: "CRITICAL: Patient allergy information updated - immediate medication review required",
|
| 148 |
+
},
|
| 149 |
+
])
|
| 150 |
+
|
| 151 |
+
// Filter logs based on search and filters
|
| 152 |
+
const filteredLogs = activityLogs.filter((log) => {
|
| 153 |
+
const matchesSearch =
|
| 154 |
+
searchTerm === "" ||
|
| 155 |
+
log.action.toLowerCase().includes(searchTerm.toLowerCase()) ||
|
| 156 |
+
log.user.toLowerCase().includes(searchTerm.toLowerCase()) ||
|
| 157 |
+
log.section.toLowerCase().includes(searchTerm.toLowerCase()) ||
|
| 158 |
+
log.description.toLowerCase().includes(searchTerm.toLowerCase())
|
| 159 |
+
|
| 160 |
+
const matchesModule = filterModule === "all" || log.section.toLowerCase().includes(filterModule.toLowerCase())
|
| 161 |
+
const matchesChangeType = filterChangeType === "all" || log.changeType === filterChangeType
|
| 162 |
+
const matchesPriority = filterPriority === "all" || log.priority === filterPriority
|
| 163 |
+
const matchesUser = filterUser === "all" || log.user === filterUser
|
| 164 |
+
|
| 165 |
+
return matchesSearch && matchesModule && matchesChangeType && matchesPriority && matchesUser
|
| 166 |
+
})
|
| 167 |
+
|
| 168 |
+
// Get statistics
|
| 169 |
+
const stats = {
|
| 170 |
+
total: activityLogs.length,
|
| 171 |
+
created: activityLogs.filter((log) => log.changeType === "create").length,
|
| 172 |
+
updated: activityLogs.filter((log) => log.changeType === "update").length,
|
| 173 |
+
loaded: activityLogs.filter((log) => log.changeType === "load").length,
|
| 174 |
+
viewed: activityLogs.filter((log) => log.changeType === "view").length,
|
| 175 |
+
critical: activityLogs.filter((log) => log.priority === "critical").length,
|
| 176 |
+
}
|
| 177 |
+
|
| 178 |
+
const getChangeTypeBadge = (type: string) => {
|
| 179 |
+
const variants = {
|
| 180 |
+
create: "bg-green-100 text-green-800",
|
| 181 |
+
update: "bg-blue-100 text-blue-800",
|
| 182 |
+
delete: "bg-red-100 text-red-800",
|
| 183 |
+
load: "bg-purple-100 text-purple-800",
|
| 184 |
+
view: "bg-gray-100 text-gray-800",
|
| 185 |
+
print: "bg-orange-100 text-orange-800",
|
| 186 |
+
export: "bg-indigo-100 text-indigo-800",
|
| 187 |
+
}
|
| 188 |
+
return variants[type as keyof typeof variants] || "bg-gray-100 text-gray-800"
|
| 189 |
+
}
|
| 190 |
+
|
| 191 |
+
const getPriorityBadge = (priority: string) => {
|
| 192 |
+
const variants = {
|
| 193 |
+
low: "bg-gray-100 text-gray-800",
|
| 194 |
+
medium: "bg-yellow-100 text-yellow-800",
|
| 195 |
+
high: "bg-orange-100 text-orange-800",
|
| 196 |
+
critical: "bg-red-100 text-red-800",
|
| 197 |
+
}
|
| 198 |
+
return variants[priority as keyof typeof variants] || "bg-gray-100 text-gray-800"
|
| 199 |
+
}
|
| 200 |
+
|
| 201 |
+
const clearFilters = () => {
|
| 202 |
+
setSearchTerm("")
|
| 203 |
+
setFilterModule("all")
|
| 204 |
+
setFilterChangeType("all")
|
| 205 |
+
setFilterPriority("all")
|
| 206 |
+
setFilterUser("all")
|
| 207 |
+
}
|
| 208 |
+
|
| 209 |
+
return (
|
| 210 |
+
<div className="space-y-6">
|
| 211 |
+
{/* Header */}
|
| 212 |
+
<div className="flex items-center justify-between">
|
| 213 |
+
<div>
|
| 214 |
+
<h2 className="text-2xl font-bold flex items-center gap-2">
|
| 215 |
+
<Activity className="w-6 h-6" />
|
| 216 |
+
Activity Logs
|
| 217 |
+
</h2>
|
| 218 |
+
<p className="text-gray-600">
|
| 219 |
+
Complete audit trail for {patient.name} (MRN: {patient.mrn})
|
| 220 |
+
</p>
|
| 221 |
+
</div>
|
| 222 |
+
<Button variant="outline" size="sm">
|
| 223 |
+
<RefreshCw className="w-4 h-4 mr-2" />
|
| 224 |
+
Refresh
|
| 225 |
+
</Button>
|
| 226 |
+
</div>
|
| 227 |
+
|
| 228 |
+
{/* Statistics Dashboard */}
|
| 229 |
+
<div className="grid grid-cols-2 md:grid-cols-6 gap-4">
|
| 230 |
+
<Card>
|
| 231 |
+
<CardContent className="p-4 text-center">
|
| 232 |
+
<div className="text-2xl font-bold text-blue-600">{stats.total}</div>
|
| 233 |
+
<div className="text-sm text-gray-600">Total Activities</div>
|
| 234 |
+
</CardContent>
|
| 235 |
+
</Card>
|
| 236 |
+
<Card>
|
| 237 |
+
<CardContent className="p-4 text-center">
|
| 238 |
+
<div className="text-2xl font-bold text-green-600">{stats.created}</div>
|
| 239 |
+
<div className="text-sm text-gray-600">Created</div>
|
| 240 |
+
</CardContent>
|
| 241 |
+
</Card>
|
| 242 |
+
<Card>
|
| 243 |
+
<CardContent className="p-4 text-center">
|
| 244 |
+
<div className="text-2xl font-bold text-blue-600">{stats.updated}</div>
|
| 245 |
+
<div className="text-sm text-gray-600">Updated</div>
|
| 246 |
+
</CardContent>
|
| 247 |
+
</Card>
|
| 248 |
+
<Card>
|
| 249 |
+
<CardContent className="p-4 text-center">
|
| 250 |
+
<div className="text-2xl font-bold text-purple-600">{stats.loaded}</div>
|
| 251 |
+
<div className="text-sm text-gray-600">Auto-loaded</div>
|
| 252 |
+
</CardContent>
|
| 253 |
+
</Card>
|
| 254 |
+
<Card>
|
| 255 |
+
<CardContent className="p-4 text-center">
|
| 256 |
+
<div className="text-2xl font-bold text-gray-600">{stats.viewed}</div>
|
| 257 |
+
<div className="text-sm text-gray-600">Viewed</div>
|
| 258 |
+
</CardContent>
|
| 259 |
+
</Card>
|
| 260 |
+
<Card>
|
| 261 |
+
<CardContent className="p-4 text-center">
|
| 262 |
+
<div className="text-2xl font-bold text-red-600">{stats.critical}</div>
|
| 263 |
+
<div className="text-sm text-gray-600">Critical</div>
|
| 264 |
+
</CardContent>
|
| 265 |
+
</Card>
|
| 266 |
+
</div>
|
| 267 |
+
|
| 268 |
+
{/* Filters */}
|
| 269 |
+
<Card>
|
| 270 |
+
<CardHeader>
|
| 271 |
+
<CardTitle className="flex items-center gap-2">
|
| 272 |
+
<Filter className="w-5 h-5" />
|
| 273 |
+
Filters & Search
|
| 274 |
+
</CardTitle>
|
| 275 |
+
</CardHeader>
|
| 276 |
+
<CardContent className="space-y-4">
|
| 277 |
+
<div className="flex flex-wrap gap-4">
|
| 278 |
+
<div className="flex-1 min-w-[200px]">
|
| 279 |
+
<div className="relative">
|
| 280 |
+
<Search className="absolute left-3 top-1/2 transform -translate-y-1/2 text-gray-400 w-4 h-4" />
|
| 281 |
+
<Input
|
| 282 |
+
placeholder="Search activities, users, or descriptions..."
|
| 283 |
+
value={searchTerm}
|
| 284 |
+
onChange={(e) => setSearchTerm(e.target.value)}
|
| 285 |
+
className="pl-10"
|
| 286 |
+
/>
|
| 287 |
+
</div>
|
| 288 |
+
</div>
|
| 289 |
+
<Select value={filterModule} onValueChange={setFilterModule}>
|
| 290 |
+
<SelectTrigger className="w-[180px]">
|
| 291 |
+
<SelectValue placeholder="Filter by Module" />
|
| 292 |
+
</SelectTrigger>
|
| 293 |
+
<SelectContent>
|
| 294 |
+
<SelectItem value="all">All Modules</SelectItem>
|
| 295 |
+
<SelectItem value="opd">OPD History</SelectItem>
|
| 296 |
+
<SelectItem value="assessment">Assessment</SelectItem>
|
| 297 |
+
<SelectItem value="progress">Progress Notes</SelectItem>
|
| 298 |
+
<SelectItem value="ot">OT Details</SelectItem>
|
| 299 |
+
<SelectItem value="discharge">Discharge Summary</SelectItem>
|
| 300 |
+
</SelectContent>
|
| 301 |
+
</Select>
|
| 302 |
+
<Select value={filterChangeType} onValueChange={setFilterChangeType}>
|
| 303 |
+
<SelectTrigger className="w-[150px]">
|
| 304 |
+
<SelectValue placeholder="Change Type" />
|
| 305 |
+
</SelectTrigger>
|
| 306 |
+
<SelectContent>
|
| 307 |
+
<SelectItem value="all">All Types</SelectItem>
|
| 308 |
+
<SelectItem value="create">Created</SelectItem>
|
| 309 |
+
<SelectItem value="update">Updated</SelectItem>
|
| 310 |
+
<SelectItem value="delete">Deleted</SelectItem>
|
| 311 |
+
<SelectItem value="load">Auto-loaded</SelectItem>
|
| 312 |
+
<SelectItem value="view">Viewed</SelectItem>
|
| 313 |
+
<SelectItem value="print">Printed</SelectItem>
|
| 314 |
+
<SelectItem value="export">Exported</SelectItem>
|
| 315 |
+
</SelectContent>
|
| 316 |
+
</Select>
|
| 317 |
+
<Select value={filterPriority} onValueChange={setFilterPriority}>
|
| 318 |
+
<SelectTrigger className="w-[130px]">
|
| 319 |
+
<SelectValue placeholder="Priority" />
|
| 320 |
+
</SelectTrigger>
|
| 321 |
+
<SelectContent>
|
| 322 |
+
<SelectItem value="all">All Priority</SelectItem>
|
| 323 |
+
<SelectItem value="low">Low</SelectItem>
|
| 324 |
+
<SelectItem value="medium">Medium</SelectItem>
|
| 325 |
+
<SelectItem value="high">High</SelectItem>
|
| 326 |
+
<SelectItem value="critical">Critical</SelectItem>
|
| 327 |
+
</SelectContent>
|
| 328 |
+
</Select>
|
| 329 |
+
<Button variant="outline" onClick={clearFilters}>
|
| 330 |
+
Clear Filters
|
| 331 |
+
</Button>
|
| 332 |
+
</div>
|
| 333 |
+
</CardContent>
|
| 334 |
+
</Card>
|
| 335 |
+
|
| 336 |
+
{/* Activity Timeline */}
|
| 337 |
+
<Card>
|
| 338 |
+
<CardHeader>
|
| 339 |
+
<CardTitle className="flex items-center justify-between">
|
| 340 |
+
<span className="flex items-center gap-2">
|
| 341 |
+
<Clock className="w-5 h-5" />
|
| 342 |
+
Activity Timeline ({filteredLogs.length} entries)
|
| 343 |
+
</span>
|
| 344 |
+
</CardTitle>
|
| 345 |
+
</CardHeader>
|
| 346 |
+
<CardContent>
|
| 347 |
+
<ScrollArea className="h-[600px] pr-4">
|
| 348 |
+
<div className="space-y-4">
|
| 349 |
+
{filteredLogs.map((log, index) => (
|
| 350 |
+
<div key={log.id} className="border rounded-lg p-4 space-y-3">
|
| 351 |
+
{/* Header */}
|
| 352 |
+
<div className="flex items-start justify-between">
|
| 353 |
+
<div className="flex items-center gap-3">
|
| 354 |
+
<div className="flex flex-wrap gap-2">
|
| 355 |
+
<Badge className={getChangeTypeBadge(log.changeType)}>{log.changeType.toUpperCase()}</Badge>
|
| 356 |
+
<Badge className={getPriorityBadge(log.priority)}>{log.priority.toUpperCase()}</Badge>
|
| 357 |
+
<Badge variant="outline">{log.section}</Badge>
|
| 358 |
+
</div>
|
| 359 |
+
</div>
|
| 360 |
+
<div className="text-sm text-gray-500 flex items-center gap-1">
|
| 361 |
+
<Clock className="w-3 h-3" />
|
| 362 |
+
{log.timestamp}
|
| 363 |
+
</div>
|
| 364 |
+
</div>
|
| 365 |
+
|
| 366 |
+
{/* Action Description */}
|
| 367 |
+
<div className="space-y-2">
|
| 368 |
+
<h4 className="font-semibold text-lg">{log.action}</h4>
|
| 369 |
+
<p className="text-gray-600">{log.description}</p>
|
| 370 |
+
</div>
|
| 371 |
+
|
| 372 |
+
{/* User Info */}
|
| 373 |
+
<div className="flex items-center gap-4 text-sm">
|
| 374 |
+
<div className="flex items-center gap-1">
|
| 375 |
+
<User className="w-4 h-4" />
|
| 376 |
+
<span className="font-medium">{log.user}</span>
|
| 377 |
+
<span className="text-gray-500">({log.role})</span>
|
| 378 |
+
</div>
|
| 379 |
+
<div className="text-gray-500">
|
| 380 |
+
{log.device} • {log.ipAddress}
|
| 381 |
+
</div>
|
| 382 |
+
</div>
|
| 383 |
+
|
| 384 |
+
{/* Field Changes */}
|
| 385 |
+
{log.field && (log.oldValue || log.newValue) && (
|
| 386 |
+
<div className="bg-gray-50 rounded p-3 space-y-2">
|
| 387 |
+
<div className="font-medium text-sm">Field: {log.field}</div>
|
| 388 |
+
{log.oldValue && (
|
| 389 |
+
<div className="text-sm">
|
| 390 |
+
<span className="text-red-600 font-medium">Before:</span>
|
| 391 |
+
<span className="ml-2 bg-red-50 px-2 py-1 rounded">
|
| 392 |
+
{log.oldValue.length > 100 ? `${log.oldValue.substring(0, 100)}...` : log.oldValue}
|
| 393 |
+
</span>
|
| 394 |
+
</div>
|
| 395 |
+
)}
|
| 396 |
+
{log.newValue && (
|
| 397 |
+
<div className="text-sm">
|
| 398 |
+
<span className="text-green-600 font-medium">After:</span>
|
| 399 |
+
<span className="ml-2 bg-green-50 px-2 py-1 rounded">
|
| 400 |
+
{log.newValue.length > 100 ? `${log.newValue.substring(0, 100)}...` : log.newValue}
|
| 401 |
+
</span>
|
| 402 |
+
</div>
|
| 403 |
+
)}
|
| 404 |
+
</div>
|
| 405 |
+
)}
|
| 406 |
+
|
| 407 |
+
{/* Critical Alert */}
|
| 408 |
+
{log.priority === "critical" && (
|
| 409 |
+
<div className="bg-red-50 border border-red-200 rounded p-3 flex items-center gap-2">
|
| 410 |
+
<AlertTriangle className="w-5 h-5 text-red-600" />
|
| 411 |
+
<span className="text-red-800 font-medium">Critical Change - Requires Attention</span>
|
| 412 |
+
</div>
|
| 413 |
+
)}
|
| 414 |
+
|
| 415 |
+
{index < filteredLogs.length - 1 && <Separator className="mt-4" />}
|
| 416 |
+
</div>
|
| 417 |
+
))}
|
| 418 |
+
|
| 419 |
+
{filteredLogs.length === 0 && (
|
| 420 |
+
<div className="text-center py-8 text-gray-500">
|
| 421 |
+
<Activity className="w-12 h-12 mx-auto mb-4 opacity-50" />
|
| 422 |
+
<p>No activity logs found matching your filters.</p>
|
| 423 |
+
<Button variant="outline" onClick={clearFilters} className="mt-2">
|
| 424 |
+
Clear Filters
|
| 425 |
+
</Button>
|
| 426 |
+
</div>
|
| 427 |
+
)}
|
| 428 |
+
</div>
|
| 429 |
+
</ScrollArea>
|
| 430 |
+
</CardContent>
|
| 431 |
+
</Card>
|
| 432 |
+
</div>
|
| 433 |
+
)
|
| 434 |
+
}
|
ipdmodule/components/admission-assessment-form.tsx
ADDED
|
@@ -0,0 +1,407 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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} from "@/components/ui/input"
|
| 6 |
+
import { Label } from "@/components/ui/label"
|
| 7 |
+
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select"
|
| 8 |
+
import { Button } from "@/components/ui/button"
|
| 9 |
+
import { RichTextEditor } from "./rich-text-editor"
|
| 10 |
+
import { FormNavigation } from "./form-navigation"
|
| 11 |
+
import { User, Activity, Heart, FileText, Stethoscope, TestTube, ClipboardList, AlertCircle } from "lucide-react"
|
| 12 |
+
|
| 13 |
+
export function AdmissionAssessmentForm() {
|
| 14 |
+
const [activeSection, setActiveSection] = useState("opd-data")
|
| 15 |
+
const [formData, setFormData] = useState({
|
| 16 |
+
opdData: "",
|
| 17 |
+
vitals: "",
|
| 18 |
+
history: "",
|
| 19 |
+
examination: "",
|
| 20 |
+
investigations: "",
|
| 21 |
+
assessment: "",
|
| 22 |
+
plan: "",
|
| 23 |
+
notes: "",
|
| 24 |
+
})
|
| 25 |
+
|
| 26 |
+
const sections = [
|
| 27 |
+
{ id: "opd-data", label: "OPD Data", icon: <User className="w-4 h-4" /> },
|
| 28 |
+
{ id: "vitals", label: "Vitals", icon: <Activity className="w-4 h-4" /> },
|
| 29 |
+
{ id: "history", label: "History", icon: <FileText className="w-4 h-4" /> },
|
| 30 |
+
{ id: "examination", label: "Examination", icon: <Stethoscope className="w-4 h-4" /> },
|
| 31 |
+
{ id: "investigations", label: "Investigations", icon: <TestTube className="w-4 h-4" /> },
|
| 32 |
+
{ id: "assessment", label: "Assessment", icon: <ClipboardList className="w-4 h-4" /> },
|
| 33 |
+
{ id: "plan", label: "Plan", icon: <Heart className="w-4 h-4" /> },
|
| 34 |
+
{ id: "notes", label: "Notes", icon: <AlertCircle className="w-4 h-4" /> },
|
| 35 |
+
]
|
| 36 |
+
|
| 37 |
+
useEffect(() => {
|
| 38 |
+
const handleScroll = () => {
|
| 39 |
+
const sectionElements = sections.map((section) => ({
|
| 40 |
+
id: section.id,
|
| 41 |
+
element: document.getElementById(section.id),
|
| 42 |
+
}))
|
| 43 |
+
|
| 44 |
+
const currentSection = sectionElements.find(({ element }) => {
|
| 45 |
+
if (!element) return false
|
| 46 |
+
const rect = element.getBoundingClientRect()
|
| 47 |
+
return rect.top <= 100 && rect.bottom >= 100
|
| 48 |
+
})
|
| 49 |
+
|
| 50 |
+
if (currentSection) {
|
| 51 |
+
setActiveSection(currentSection.id)
|
| 52 |
+
}
|
| 53 |
+
}
|
| 54 |
+
|
| 55 |
+
window.addEventListener("scroll", handleScroll)
|
| 56 |
+
return () => window.removeEventListener("scroll", handleScroll)
|
| 57 |
+
}, [])
|
| 58 |
+
|
| 59 |
+
const updateFormData = (field: string, value: string) => {
|
| 60 |
+
setFormData((prev) => ({ ...prev, [field]: value }))
|
| 61 |
+
}
|
| 62 |
+
|
| 63 |
+
return (
|
| 64 |
+
<div className="relative">
|
| 65 |
+
<FormNavigation sections={sections} activeSection={activeSection} onSectionChange={setActiveSection} />
|
| 66 |
+
|
| 67 |
+
<div className="max-w-4xl mx-auto space-y-6 pl-0 md:pl-16">
|
| 68 |
+
{/* OPD Data Section */}
|
| 69 |
+
<Card id="opd-data" className="scroll-mt-20">
|
| 70 |
+
<CardHeader className="bg-blue-50 border-b">
|
| 71 |
+
<CardTitle className="flex items-center gap-2 text-blue-800">
|
| 72 |
+
<User className="w-5 h-5" />
|
| 73 |
+
OPD Data
|
| 74 |
+
</CardTitle>
|
| 75 |
+
</CardHeader>
|
| 76 |
+
<CardContent className="p-6 space-y-4">
|
| 77 |
+
<div className="grid grid-cols-1 md:grid-cols-2 gap-4">
|
| 78 |
+
<div>
|
| 79 |
+
<Label htmlFor="patient-name">Patient Name</Label>
|
| 80 |
+
<Input id="patient-name" placeholder="Enter patient name" />
|
| 81 |
+
</div>
|
| 82 |
+
<div>
|
| 83 |
+
<Label htmlFor="age">Age</Label>
|
| 84 |
+
<Input id="age" placeholder="Enter age" />
|
| 85 |
+
</div>
|
| 86 |
+
<div>
|
| 87 |
+
<Label htmlFor="gender">Gender</Label>
|
| 88 |
+
<Select>
|
| 89 |
+
<SelectTrigger>
|
| 90 |
+
<SelectValue placeholder="Select gender" />
|
| 91 |
+
</SelectTrigger>
|
| 92 |
+
<SelectContent>
|
| 93 |
+
<SelectItem value="male">Male</SelectItem>
|
| 94 |
+
<SelectItem value="female">Female</SelectItem>
|
| 95 |
+
<SelectItem value="other">Other</SelectItem>
|
| 96 |
+
</SelectContent>
|
| 97 |
+
</Select>
|
| 98 |
+
</div>
|
| 99 |
+
<div>
|
| 100 |
+
<Label htmlFor="admission-date">Admission Date</Label>
|
| 101 |
+
<Input id="admission-date" type="date" />
|
| 102 |
+
</div>
|
| 103 |
+
</div>
|
| 104 |
+
<div>
|
| 105 |
+
<RichTextEditor
|
| 106 |
+
value={formData.opdData}
|
| 107 |
+
onChange={(value) => updateFormData("opdData", value)}
|
| 108 |
+
placeholder="Enter chief complaints and presenting symptoms..."
|
| 109 |
+
fieldType="chief-complaints"
|
| 110 |
+
label="Chief Complaints"
|
| 111 |
+
showAutofill={true}
|
| 112 |
+
autofillSource="OPD"
|
| 113 |
+
autofillTimestamp="2024-01-15, 10:30 AM"
|
| 114 |
+
/>
|
| 115 |
+
</div>
|
| 116 |
+
</CardContent>
|
| 117 |
+
</Card>
|
| 118 |
+
|
| 119 |
+
{/* Vitals Section */}
|
| 120 |
+
<Card id="vitals" className="scroll-mt-20">
|
| 121 |
+
<CardHeader className="bg-green-50 border-b">
|
| 122 |
+
<CardTitle className="flex items-center gap-2 text-green-800">
|
| 123 |
+
<Activity className="w-5 h-5" />
|
| 124 |
+
Vital Signs
|
| 125 |
+
</CardTitle>
|
| 126 |
+
</CardHeader>
|
| 127 |
+
<CardContent className="p-6 space-y-4">
|
| 128 |
+
<div className="grid grid-cols-2 md:grid-cols-4 gap-4">
|
| 129 |
+
<div>
|
| 130 |
+
<Label htmlFor="bp">Blood Pressure</Label>
|
| 131 |
+
<Input id="bp" placeholder="120/80" />
|
| 132 |
+
</div>
|
| 133 |
+
<div>
|
| 134 |
+
<Label htmlFor="pulse">Pulse Rate</Label>
|
| 135 |
+
<Input id="pulse" placeholder="72 bpm" />
|
| 136 |
+
</div>
|
| 137 |
+
<div>
|
| 138 |
+
<Label htmlFor="temp">Temperature</Label>
|
| 139 |
+
<Input id="temp" placeholder="98.6°F" />
|
| 140 |
+
</div>
|
| 141 |
+
<div>
|
| 142 |
+
<Label htmlFor="resp">Respiratory Rate</Label>
|
| 143 |
+
<Input id="resp" placeholder="16/min" />
|
| 144 |
+
</div>
|
| 145 |
+
</div>
|
| 146 |
+
<div>
|
| 147 |
+
<RichTextEditor
|
| 148 |
+
value={formData.vitals}
|
| 149 |
+
onChange={(value) => updateFormData("vitals", value)}
|
| 150 |
+
placeholder="Additional vital signs observations..."
|
| 151 |
+
fieldType="general"
|
| 152 |
+
label="Vitals Notes"
|
| 153 |
+
showAutofill={true}
|
| 154 |
+
autofillSource="Nursing Station"
|
| 155 |
+
autofillTimestamp="2024-01-15, 11:00 AM"
|
| 156 |
+
/>
|
| 157 |
+
</div>
|
| 158 |
+
</CardContent>
|
| 159 |
+
</Card>
|
| 160 |
+
|
| 161 |
+
{/* History Section */}
|
| 162 |
+
<Card id="history" className="scroll-mt-20">
|
| 163 |
+
<CardHeader className="bg-purple-50 border-b">
|
| 164 |
+
<CardTitle className="flex items-center gap-2 text-purple-800">
|
| 165 |
+
<FileText className="w-5 h-5" />
|
| 166 |
+
Medical History
|
| 167 |
+
</CardTitle>
|
| 168 |
+
</CardHeader>
|
| 169 |
+
<CardContent className="p-6 space-y-4">
|
| 170 |
+
<div>
|
| 171 |
+
<RichTextEditor
|
| 172 |
+
value={formData.history}
|
| 173 |
+
onChange={(value) => updateFormData("history", value)}
|
| 174 |
+
placeholder="Detailed history of present illness..."
|
| 175 |
+
fieldType="chief-complaints"
|
| 176 |
+
label="History of Present Illness"
|
| 177 |
+
rows={6}
|
| 178 |
+
showAutofill={true}
|
| 179 |
+
autofillSource="Previous Records"
|
| 180 |
+
autofillTimestamp="2024-01-10, 2:15 PM"
|
| 181 |
+
/>
|
| 182 |
+
</div>
|
| 183 |
+
<div className="grid grid-cols-1 md:grid-cols-2 gap-4">
|
| 184 |
+
<div>
|
| 185 |
+
<RichTextEditor
|
| 186 |
+
value=""
|
| 187 |
+
onChange={() => {}}
|
| 188 |
+
placeholder="Previous medical conditions, surgeries..."
|
| 189 |
+
fieldType="general"
|
| 190 |
+
label="Past Medical History"
|
| 191 |
+
rows={4}
|
| 192 |
+
/>
|
| 193 |
+
</div>
|
| 194 |
+
<div>
|
| 195 |
+
<RichTextEditor
|
| 196 |
+
value=""
|
| 197 |
+
onChange={() => {}}
|
| 198 |
+
placeholder="Relevant family medical history..."
|
| 199 |
+
fieldType="general"
|
| 200 |
+
label="Family History"
|
| 201 |
+
rows={4}
|
| 202 |
+
/>
|
| 203 |
+
</div>
|
| 204 |
+
</div>
|
| 205 |
+
</CardContent>
|
| 206 |
+
</Card>
|
| 207 |
+
|
| 208 |
+
{/* Physical Examination Section */}
|
| 209 |
+
<Card id="examination" className="scroll-mt-20">
|
| 210 |
+
<CardHeader className="bg-orange-50 border-b">
|
| 211 |
+
<CardTitle className="flex items-center gap-2 text-orange-800">
|
| 212 |
+
<Stethoscope className="w-5 h-5" />
|
| 213 |
+
Physical Examination
|
| 214 |
+
</CardTitle>
|
| 215 |
+
</CardHeader>
|
| 216 |
+
<CardContent className="p-6 space-y-4">
|
| 217 |
+
<div>
|
| 218 |
+
<RichTextEditor
|
| 219 |
+
value={formData.examination}
|
| 220 |
+
onChange={(value) => updateFormData("examination", value)}
|
| 221 |
+
placeholder="General appearance, consciousness level, orientation..."
|
| 222 |
+
fieldType="assessment"
|
| 223 |
+
label="General Examination"
|
| 224 |
+
rows={5}
|
| 225 |
+
/>
|
| 226 |
+
</div>
|
| 227 |
+
<div className="grid grid-cols-1 md:grid-cols-2 gap-4">
|
| 228 |
+
<div>
|
| 229 |
+
<RichTextEditor
|
| 230 |
+
value=""
|
| 231 |
+
onChange={() => {}}
|
| 232 |
+
placeholder="Cardiovascular, respiratory, abdominal, neurological examination..."
|
| 233 |
+
fieldType="assessment"
|
| 234 |
+
label="Systemic Examination"
|
| 235 |
+
rows={6}
|
| 236 |
+
/>
|
| 237 |
+
</div>
|
| 238 |
+
<div>
|
| 239 |
+
<RichTextEditor
|
| 240 |
+
value=""
|
| 241 |
+
onChange={() => {}}
|
| 242 |
+
placeholder="Specific area examination findings..."
|
| 243 |
+
fieldType="assessment"
|
| 244 |
+
label="Local Examination"
|
| 245 |
+
rows={6}
|
| 246 |
+
/>
|
| 247 |
+
</div>
|
| 248 |
+
</div>
|
| 249 |
+
</CardContent>
|
| 250 |
+
</Card>
|
| 251 |
+
|
| 252 |
+
{/* Investigations Section */}
|
| 253 |
+
<Card id="investigations" className="scroll-mt-20">
|
| 254 |
+
<CardHeader className="bg-teal-50 border-b">
|
| 255 |
+
<CardTitle className="flex items-center gap-2 text-teal-800">
|
| 256 |
+
<TestTube className="w-5 h-5" />
|
| 257 |
+
Investigations
|
| 258 |
+
</CardTitle>
|
| 259 |
+
</CardHeader>
|
| 260 |
+
<CardContent className="p-6 space-y-4">
|
| 261 |
+
<div>
|
| 262 |
+
<RichTextEditor
|
| 263 |
+
value={formData.investigations}
|
| 264 |
+
onChange={(value) => updateFormData("investigations", value)}
|
| 265 |
+
placeholder="Blood tests, urine analysis, other lab results..."
|
| 266 |
+
fieldType="general"
|
| 267 |
+
label="Laboratory Results"
|
| 268 |
+
rows={5}
|
| 269 |
+
showAutofill={true}
|
| 270 |
+
autofillSource="Lab System"
|
| 271 |
+
autofillTimestamp="2024-01-15, 9:45 AM"
|
| 272 |
+
/>
|
| 273 |
+
</div>
|
| 274 |
+
<div>
|
| 275 |
+
<RichTextEditor
|
| 276 |
+
value=""
|
| 277 |
+
onChange={() => {}}
|
| 278 |
+
placeholder="X-rays, CT scans, MRI, ultrasound findings..."
|
| 279 |
+
fieldType="general"
|
| 280 |
+
label="Imaging Studies"
|
| 281 |
+
rows={4}
|
| 282 |
+
showAutofill={true}
|
| 283 |
+
autofillSource="Radiology"
|
| 284 |
+
autofillTimestamp="2024-01-15, 8:30 AM"
|
| 285 |
+
/>
|
| 286 |
+
</div>
|
| 287 |
+
</CardContent>
|
| 288 |
+
</Card>
|
| 289 |
+
|
| 290 |
+
{/* Assessment Section */}
|
| 291 |
+
<Card id="assessment" className="scroll-mt-20">
|
| 292 |
+
<CardHeader className="bg-red-50 border-b">
|
| 293 |
+
<CardTitle className="flex items-center gap-2 text-red-800">
|
| 294 |
+
<ClipboardList className="w-5 h-5" />
|
| 295 |
+
Clinical Assessment
|
| 296 |
+
</CardTitle>
|
| 297 |
+
</CardHeader>
|
| 298 |
+
<CardContent className="p-6 space-y-4">
|
| 299 |
+
<div>
|
| 300 |
+
<RichTextEditor
|
| 301 |
+
value={formData.assessment}
|
| 302 |
+
onChange={(value) => updateFormData("assessment", value)}
|
| 303 |
+
placeholder="Primary and differential diagnoses..."
|
| 304 |
+
fieldType="assessment"
|
| 305 |
+
label="Provisional Diagnosis"
|
| 306 |
+
rows={4}
|
| 307 |
+
/>
|
| 308 |
+
</div>
|
| 309 |
+
<div>
|
| 310 |
+
<RichTextEditor
|
| 311 |
+
value=""
|
| 312 |
+
onChange={() => {}}
|
| 313 |
+
placeholder="Overall clinical impression and severity assessment..."
|
| 314 |
+
fieldType="assessment"
|
| 315 |
+
label="Clinical Impression"
|
| 316 |
+
rows={4}
|
| 317 |
+
/>
|
| 318 |
+
</div>
|
| 319 |
+
</CardContent>
|
| 320 |
+
</Card>
|
| 321 |
+
|
| 322 |
+
{/* Treatment Plan Section */}
|
| 323 |
+
<Card id="plan" className="scroll-mt-20">
|
| 324 |
+
<CardHeader className="bg-indigo-50 border-b">
|
| 325 |
+
<CardTitle className="flex items-center gap-2 text-indigo-800">
|
| 326 |
+
<Heart className="w-5 h-5" />
|
| 327 |
+
Treatment Plan
|
| 328 |
+
</CardTitle>
|
| 329 |
+
</CardHeader>
|
| 330 |
+
<CardContent className="p-6 space-y-4">
|
| 331 |
+
<div>
|
| 332 |
+
<RichTextEditor
|
| 333 |
+
value={formData.plan}
|
| 334 |
+
onChange={(value) => updateFormData("plan", value)}
|
| 335 |
+
placeholder="Immediate treatment plan and interventions..."
|
| 336 |
+
fieldType="plan"
|
| 337 |
+
label="Immediate Management"
|
| 338 |
+
rows={5}
|
| 339 |
+
/>
|
| 340 |
+
</div>
|
| 341 |
+
<div className="grid grid-cols-1 md:grid-cols-2 gap-4">
|
| 342 |
+
<div>
|
| 343 |
+
<RichTextEditor
|
| 344 |
+
value=""
|
| 345 |
+
onChange={() => {}}
|
| 346 |
+
placeholder="Prescribed medications with dosages..."
|
| 347 |
+
fieldType="plan"
|
| 348 |
+
label="Medications"
|
| 349 |
+
rows={4}
|
| 350 |
+
/>
|
| 351 |
+
</div>
|
| 352 |
+
<div>
|
| 353 |
+
<RichTextEditor
|
| 354 |
+
value=""
|
| 355 |
+
onChange={() => {}}
|
| 356 |
+
placeholder="Monitoring parameters and frequency..."
|
| 357 |
+
fieldType="plan"
|
| 358 |
+
label="Monitoring Plan"
|
| 359 |
+
rows={4}
|
| 360 |
+
/>
|
| 361 |
+
</div>
|
| 362 |
+
</div>
|
| 363 |
+
</CardContent>
|
| 364 |
+
</Card>
|
| 365 |
+
|
| 366 |
+
{/* Additional Notes Section */}
|
| 367 |
+
<Card id="notes" className="scroll-mt-20">
|
| 368 |
+
<CardHeader className="bg-gray-50 border-b">
|
| 369 |
+
<CardTitle className="flex items-center gap-2 text-gray-800">
|
| 370 |
+
<AlertCircle className="w-5 h-5" />
|
| 371 |
+
Additional Notes
|
| 372 |
+
</CardTitle>
|
| 373 |
+
</CardHeader>
|
| 374 |
+
<CardContent className="p-6 space-y-4">
|
| 375 |
+
<div>
|
| 376 |
+
<RichTextEditor
|
| 377 |
+
value={formData.notes}
|
| 378 |
+
onChange={(value) => updateFormData("notes", value)}
|
| 379 |
+
placeholder="Special instructions, precautions, or additional notes..."
|
| 380 |
+
fieldType="general"
|
| 381 |
+
label="Special Instructions"
|
| 382 |
+
rows={4}
|
| 383 |
+
/>
|
| 384 |
+
</div>
|
| 385 |
+
<div>
|
| 386 |
+
<RichTextEditor
|
| 387 |
+
value=""
|
| 388 |
+
onChange={() => {}}
|
| 389 |
+
placeholder="Criteria for discharge planning..."
|
| 390 |
+
fieldType="plan"
|
| 391 |
+
label="Discharge Criteria"
|
| 392 |
+
rows={3}
|
| 393 |
+
/>
|
| 394 |
+
</div>
|
| 395 |
+
</CardContent>
|
| 396 |
+
</Card>
|
| 397 |
+
|
| 398 |
+
{/* Form Actions */}
|
| 399 |
+
<div className="flex justify-end gap-4 py-6">
|
| 400 |
+
<Button variant="outline">Save Draft</Button>
|
| 401 |
+
<Button variant="outline">Print</Button>
|
| 402 |
+
<Button>Submit Assessment</Button>
|
| 403 |
+
</div>
|
| 404 |
+
</div>
|
| 405 |
+
</div>
|
| 406 |
+
)
|
| 407 |
+
}
|
ipdmodule/components/admission-assessment.tsx
ADDED
|
@@ -0,0 +1,223 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"use client"
|
| 2 |
+
|
| 3 |
+
import { useState } from "react"
|
| 4 |
+
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"
|
| 5 |
+
import { Button } from "@/components/ui/button"
|
| 6 |
+
import { Input } from "@/components/ui/input"
|
| 7 |
+
import { Label } from "@/components/ui/label"
|
| 8 |
+
import { Textarea } from "@/components/ui/textarea"
|
| 9 |
+
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select"
|
| 10 |
+
import { Badge } from "@/components/ui/badge"
|
| 11 |
+
import { ChevronDown, ChevronUp, FileText, User, Activity, RefreshCw } from "lucide-react"
|
| 12 |
+
|
| 13 |
+
export function AdmissionAssessment() {
|
| 14 |
+
const [collapsedSections, setCollapsedSections] = useState<Record<string, boolean>>({})
|
| 15 |
+
|
| 16 |
+
const toggleSection = (sectionId: string) => {
|
| 17 |
+
setCollapsedSections((prev) => ({
|
| 18 |
+
...prev,
|
| 19 |
+
[sectionId]: !prev[sectionId],
|
| 20 |
+
}))
|
| 21 |
+
}
|
| 22 |
+
|
| 23 |
+
const AutofillBadge = ({
|
| 24 |
+
status,
|
| 25 |
+
source,
|
| 26 |
+
timestamp,
|
| 27 |
+
}: {
|
| 28 |
+
status: "available" | "none" | "edited"
|
| 29 |
+
source?: string
|
| 30 |
+
timestamp?: string
|
| 31 |
+
}) => {
|
| 32 |
+
const getStatusConfig = () => {
|
| 33 |
+
switch (status) {
|
| 34 |
+
case "available":
|
| 35 |
+
return { color: "bg-green-100 text-green-800", text: "Autofilled" }
|
| 36 |
+
case "edited":
|
| 37 |
+
return { color: "bg-blue-100 text-blue-800", text: "Manually Edited" }
|
| 38 |
+
default:
|
| 39 |
+
return { color: "bg-gray-100 text-gray-800", text: "No Data" }
|
| 40 |
+
}
|
| 41 |
+
}
|
| 42 |
+
|
| 43 |
+
const config = getStatusConfig()
|
| 44 |
+
|
| 45 |
+
return (
|
| 46 |
+
<div className="flex items-center gap-2 mb-2">
|
| 47 |
+
<Badge className={`${config.color} text-xs`}>{config.text}</Badge>
|
| 48 |
+
{status === "available" && (
|
| 49 |
+
<Button variant="ghost" size="sm" className="h-6 w-6 p-0">
|
| 50 |
+
<RefreshCw className="h-3 w-3" />
|
| 51 |
+
</Button>
|
| 52 |
+
)}
|
| 53 |
+
{(source || timestamp) && (
|
| 54 |
+
<span className="text-xs text-gray-500">
|
| 55 |
+
{source && `Source: ${source}`}
|
| 56 |
+
{timestamp && ` • ${timestamp}`}
|
| 57 |
+
</span>
|
| 58 |
+
)}
|
| 59 |
+
</div>
|
| 60 |
+
)
|
| 61 |
+
}
|
| 62 |
+
|
| 63 |
+
return (
|
| 64 |
+
<div className="w-full space-y-6">
|
| 65 |
+
{/* Patient Information */}
|
| 66 |
+
<Card>
|
| 67 |
+
<CardHeader
|
| 68 |
+
className="cursor-pointer flex flex-row items-center justify-between"
|
| 69 |
+
onClick={() => toggleSection("patient-info")}
|
| 70 |
+
>
|
| 71 |
+
<CardTitle className="flex items-center gap-2">
|
| 72 |
+
<User className="w-5 h-5" />
|
| 73 |
+
Patient Information
|
| 74 |
+
</CardTitle>
|
| 75 |
+
{collapsedSections["patient-info"] ? <ChevronDown className="w-5 h-5" /> : <ChevronUp className="w-5 h-5" />}
|
| 76 |
+
</CardHeader>
|
| 77 |
+
{!collapsedSections["patient-info"] && (
|
| 78 |
+
<CardContent className="space-y-4">
|
| 79 |
+
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4">
|
| 80 |
+
<div>
|
| 81 |
+
<AutofillBadge status="available" source="EMR" timestamp="2 mins ago" />
|
| 82 |
+
<Label htmlFor="patient-name">Patient Name</Label>
|
| 83 |
+
<Input id="patient-name" defaultValue="John Doe" />
|
| 84 |
+
</div>
|
| 85 |
+
<div>
|
| 86 |
+
<AutofillBadge status="available" source="Registration" timestamp="5 mins ago" />
|
| 87 |
+
<Label htmlFor="age">Age</Label>
|
| 88 |
+
<Input id="age" defaultValue="45" />
|
| 89 |
+
</div>
|
| 90 |
+
<div>
|
| 91 |
+
<AutofillBadge status="none" />
|
| 92 |
+
<Label htmlFor="gender">Gender</Label>
|
| 93 |
+
<Select defaultValue="male">
|
| 94 |
+
<SelectTrigger>
|
| 95 |
+
<SelectValue />
|
| 96 |
+
</SelectTrigger>
|
| 97 |
+
<SelectContent>
|
| 98 |
+
<SelectItem value="male">Male</SelectItem>
|
| 99 |
+
<SelectItem value="female">Female</SelectItem>
|
| 100 |
+
<SelectItem value="other">Other</SelectItem>
|
| 101 |
+
</SelectContent>
|
| 102 |
+
</Select>
|
| 103 |
+
</div>
|
| 104 |
+
</div>
|
| 105 |
+
</CardContent>
|
| 106 |
+
)}
|
| 107 |
+
</Card>
|
| 108 |
+
|
| 109 |
+
{/* Basic Information */}
|
| 110 |
+
<Card>
|
| 111 |
+
<CardHeader
|
| 112 |
+
className="cursor-pointer flex flex-row items-center justify-between"
|
| 113 |
+
onClick={() => toggleSection("basic-info")}
|
| 114 |
+
>
|
| 115 |
+
<div className="flex items-center gap-2">
|
| 116 |
+
<FileText className="w-5 h-5" />
|
| 117 |
+
Basic Information
|
| 118 |
+
<Badge className="bg-green-100 text-green-800 text-xs ml-2">Autofilled</Badge>
|
| 119 |
+
</div>
|
| 120 |
+
{collapsedSections["basic-info"] ? <ChevronDown className="w-5 h-5" /> : <ChevronUp className="w-5 h-5" />}
|
| 121 |
+
</CardHeader>
|
| 122 |
+
{!collapsedSections["basic-info"] && (
|
| 123 |
+
<CardContent className="space-y-4">
|
| 124 |
+
<div className="grid grid-cols-1 md:grid-cols-2 gap-4">
|
| 125 |
+
<div>
|
| 126 |
+
<AutofillBadge status="available" source="Previous Visit" timestamp="1 hour ago" />
|
| 127 |
+
<Label htmlFor="admission-date">Admission Date</Label>
|
| 128 |
+
<Input id="admission-date" type="date" defaultValue="2024-01-15" />
|
| 129 |
+
</div>
|
| 130 |
+
<div>
|
| 131 |
+
<AutofillBadge status="edited" />
|
| 132 |
+
<Label htmlFor="admission-time">Admission Time</Label>
|
| 133 |
+
<Input id="admission-time" type="time" defaultValue="14:30" />
|
| 134 |
+
</div>
|
| 135 |
+
<div>
|
| 136 |
+
<AutofillBadge status="available" source="Referral" timestamp="30 mins ago" />
|
| 137 |
+
<Label htmlFor="referring-doctor">Referring Doctor</Label>
|
| 138 |
+
<Input id="referring-doctor" defaultValue="Dr. Smith" />
|
| 139 |
+
</div>
|
| 140 |
+
<div>
|
| 141 |
+
<AutofillBadge status="none" />
|
| 142 |
+
<Label htmlFor="admission-type">Admission Type</Label>
|
| 143 |
+
<Select>
|
| 144 |
+
<SelectTrigger>
|
| 145 |
+
<SelectValue placeholder="Select admission type" />
|
| 146 |
+
</SelectTrigger>
|
| 147 |
+
<SelectContent>
|
| 148 |
+
<SelectItem value="emergency">Emergency</SelectItem>
|
| 149 |
+
<SelectItem value="planned">Planned</SelectItem>
|
| 150 |
+
<SelectItem value="transfer">Transfer</SelectItem>
|
| 151 |
+
</SelectContent>
|
| 152 |
+
</Select>
|
| 153 |
+
</div>
|
| 154 |
+
</div>
|
| 155 |
+
</CardContent>
|
| 156 |
+
)}
|
| 157 |
+
</Card>
|
| 158 |
+
|
| 159 |
+
{/* Clinical Assessment */}
|
| 160 |
+
<Card>
|
| 161 |
+
<CardHeader
|
| 162 |
+
className="cursor-pointer flex flex-row items-center justify-between"
|
| 163 |
+
onClick={() => toggleSection("clinical-assessment")}
|
| 164 |
+
>
|
| 165 |
+
<CardTitle className="flex items-center gap-2">
|
| 166 |
+
<Activity className="w-5 h-5" />
|
| 167 |
+
Clinical Assessment
|
| 168 |
+
</CardTitle>
|
| 169 |
+
{collapsedSections["clinical-assessment"] ? (
|
| 170 |
+
<ChevronDown className="w-5 h-5" />
|
| 171 |
+
) : (
|
| 172 |
+
<ChevronUp className="w-5 h-5" />
|
| 173 |
+
)}
|
| 174 |
+
</CardHeader>
|
| 175 |
+
{!collapsedSections["clinical-assessment"] && (
|
| 176 |
+
<CardContent className="space-y-4">
|
| 177 |
+
<div className="grid grid-cols-1 md:grid-cols-2 gap-4">
|
| 178 |
+
<div>
|
| 179 |
+
<AutofillBadge status="available" source="Vitals Monitor" timestamp="5 mins ago" />
|
| 180 |
+
<Label htmlFor="chief-complaint">Chief Complaint</Label>
|
| 181 |
+
<Textarea id="chief-complaint" placeholder="Enter chief complaint" />
|
| 182 |
+
</div>
|
| 183 |
+
<div>
|
| 184 |
+
<AutofillBadge status="none" />
|
| 185 |
+
<Label htmlFor="history">History of Present Illness</Label>
|
| 186 |
+
<Textarea id="history" placeholder="Enter history" />
|
| 187 |
+
</div>
|
| 188 |
+
<div>
|
| 189 |
+
<AutofillBadge status="edited" />
|
| 190 |
+
<Label htmlFor="vital-signs">Vital Signs</Label>
|
| 191 |
+
<Textarea id="vital-signs" placeholder="Enter vital signs" />
|
| 192 |
+
</div>
|
| 193 |
+
<div>
|
| 194 |
+
<AutofillBadge status="available" source="Lab Results" timestamp="15 mins ago" />
|
| 195 |
+
<Label htmlFor="physical-exam">Physical Examination</Label>
|
| 196 |
+
<Textarea id="physical-exam" placeholder="Enter physical examination findings" />
|
| 197 |
+
</div>
|
| 198 |
+
</div>
|
| 199 |
+
|
| 200 |
+
<div className="grid grid-cols-1 md:grid-cols-2 gap-4">
|
| 201 |
+
<div>
|
| 202 |
+
<AutofillBadge status="none" />
|
| 203 |
+
<Label htmlFor="diagnosis">Provisional Diagnosis</Label>
|
| 204 |
+
<Textarea id="diagnosis" placeholder="Enter provisional diagnosis" />
|
| 205 |
+
</div>
|
| 206 |
+
<div>
|
| 207 |
+
<AutofillBadge status="available" source="Pharmacy" timestamp="10 mins ago" />
|
| 208 |
+
<Label htmlFor="treatment-plan">Treatment Plan</Label>
|
| 209 |
+
<Textarea id="treatment-plan" placeholder="Enter treatment plan" />
|
| 210 |
+
</div>
|
| 211 |
+
</div>
|
| 212 |
+
</CardContent>
|
| 213 |
+
)}
|
| 214 |
+
</Card>
|
| 215 |
+
|
| 216 |
+
{/* Action Buttons */}
|
| 217 |
+
<div className="flex justify-end gap-4">
|
| 218 |
+
<Button variant="outline">Save as Draft</Button>
|
| 219 |
+
<Button className="bg-[#4b4ad5] hover:bg-[#4b4ad5]/90">Complete Assessment</Button>
|
| 220 |
+
</div>
|
| 221 |
+
</div>
|
| 222 |
+
)
|
| 223 |
+
}
|
ipdmodule/components/app-header.tsx
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"use client"
|
| 2 |
+
|
| 3 |
+
import Image from "next/image"
|
| 4 |
+
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select"
|
| 5 |
+
import { Button } from "@/components/ui/button"
|
| 6 |
+
import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar"
|
| 7 |
+
import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger } from "@/components/ui/dropdown-menu"
|
| 8 |
+
import { Settings, Headphones } from "lucide-react"
|
| 9 |
+
|
| 10 |
+
export function AppHeader() {
|
| 11 |
+
return (
|
| 12 |
+
<header className="bg-white border-b border-[#e2e2ea] px-5 py-2.5">
|
| 13 |
+
<div className="flex items-center justify-between w-full">
|
| 14 |
+
{/* Logo */}
|
| 15 |
+
<div className="flex items-center">
|
| 16 |
+
<Image
|
| 17 |
+
src="/images/tatva-practice-logo.png"
|
| 18 |
+
alt="TatvaPractice"
|
| 19 |
+
width={200}
|
| 20 |
+
height={40}
|
| 21 |
+
className="h-8 w-auto object-contain"
|
| 22 |
+
priority
|
| 23 |
+
/>
|
| 24 |
+
</div>
|
| 25 |
+
|
| 26 |
+
{/* Auto-layout group positioned at the end with 12px padding */}
|
| 27 |
+
<div className="flex items-center gap-[30px] p-3">
|
| 28 |
+
{/* Clinic Selector */}
|
| 29 |
+
<Select defaultValue="clinic-1">
|
| 30 |
+
<SelectTrigger className="w-[167px] h-[41px] border-[#e2e2ea] bg-white rounded-[10px]">
|
| 31 |
+
<SelectValue placeholder="Clinic Name" />
|
| 32 |
+
</SelectTrigger>
|
| 33 |
+
<SelectContent>
|
| 34 |
+
<SelectItem value="clinic-1">Clinic Name</SelectItem>
|
| 35 |
+
<SelectItem value="clinic-2">Another Clinic</SelectItem>
|
| 36 |
+
</SelectContent>
|
| 37 |
+
</Select>
|
| 38 |
+
|
| 39 |
+
{/* Tutorial Play Button */}
|
| 40 |
+
<Button variant="ghost" size="icon" className="h-6 w-6 p-0">
|
| 41 |
+
<div className="relative h-6 w-6 bg-white rounded-full border-[1.41176px] border-[#6941c6] shadow-[0px_0px_4.5px_0px_rgba(44,44,44,0.1)]">
|
| 42 |
+
<div className="absolute inset-0 rounded-full overflow-hidden">
|
| 43 |
+
<div className="absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 w-[16.5px] h-[16.5px]">
|
| 44 |
+
<div className="w-full h-full rounded-full bg-gradient-to-br from-[#6941C6] to-[#9747FF] opacity-70 border-[0.705882px] border-[#6941C6] flex items-center justify-center">
|
| 45 |
+
<div className="w-0 h-0 border-l-[3px] border-l-white border-t-[2px] border-t-transparent border-b-[2px] border-b-transparent ml-0.5" />
|
| 46 |
+
</div>
|
| 47 |
+
</div>
|
| 48 |
+
</div>
|
| 49 |
+
</div>
|
| 50 |
+
</Button>
|
| 51 |
+
|
| 52 |
+
{/* Notification Bell */}
|
| 53 |
+
<Button variant="ghost" size="icon" className="p-0 size-8 opacity-100">
|
| 54 |
+
<Headphones className="text-[#454551] size-8" />
|
| 55 |
+
</Button>
|
| 56 |
+
|
| 57 |
+
{/* Settings Icon */}
|
| 58 |
+
<Button variant="ghost" size="icon" className="p-0 size-8">
|
| 59 |
+
<Settings className="h-6 w-6 text-[#454551]" />
|
| 60 |
+
</Button>
|
| 61 |
+
|
| 62 |
+
{/* Profile Avatar */}
|
| 63 |
+
<DropdownMenu>
|
| 64 |
+
<DropdownMenuTrigger asChild>
|
| 65 |
+
<Button variant="ghost" className="relative h-8 w-8 rounded-full p-0">
|
| 66 |
+
<Avatar className="h-8 w-8 border-2 border-[#e2e2ea]">
|
| 67 |
+
<AvatarImage src="/images/doctor-profile.jpg" alt="Dr. Mihir" />
|
| 68 |
+
<AvatarFallback className="bg-gradient-to-br from-[#6941C6] to-[#A461D8] text-white font-semibold text-sm">
|
| 69 |
+
DM
|
| 70 |
+
</AvatarFallback>
|
| 71 |
+
</Avatar>
|
| 72 |
+
</Button>
|
| 73 |
+
</DropdownMenuTrigger>
|
| 74 |
+
<DropdownMenuContent align="end">
|
| 75 |
+
<DropdownMenuItem>Profile</DropdownMenuItem>
|
| 76 |
+
<DropdownMenuItem>Settings</DropdownMenuItem>
|
| 77 |
+
<DropdownMenuItem>Logout</DropdownMenuItem>
|
| 78 |
+
</DropdownMenuContent>
|
| 79 |
+
</DropdownMenu>
|
| 80 |
+
</div>
|
| 81 |
+
</div>
|
| 82 |
+
</header>
|
| 83 |
+
)
|
| 84 |
+
}
|
ipdmodule/components/app-sidebar.tsx
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"use client"
|
| 2 |
+
import { Button } from "@/components/ui/button"
|
| 3 |
+
import { Calendar, Users, MessageCircle, BarChart3, FileText, Bed, Mail, Megaphone } from "lucide-react"
|
| 4 |
+
|
| 5 |
+
interface SidebarProps {
|
| 6 |
+
activeItem: string
|
| 7 |
+
onItemClick: (item: string) => void
|
| 8 |
+
}
|
| 9 |
+
|
| 10 |
+
export function AppSidebar({ activeItem, onItemClick }: SidebarProps) {
|
| 11 |
+
const menuItems = [
|
| 12 |
+
{ id: "appointment", label: "Appointment", icon: Calendar },
|
| 13 |
+
{ id: "patients", label: "All Patients", icon: Users },
|
| 14 |
+
{ id: "ask-tatva", label: "Ask Tatva", icon: MessageCircle },
|
| 15 |
+
{ id: "analytics", label: "Analytics", icon: BarChart3 },
|
| 16 |
+
{ id: "opd-billings", label: "OPD Billings", icon: FileText },
|
| 17 |
+
{ id: "ipd", label: "IPD", icon: Bed },
|
| 18 |
+
{ id: "messages", label: "Messages", icon: Mail },
|
| 19 |
+
{ id: "whats-new", label: "What's new", icon: Megaphone },
|
| 20 |
+
]
|
| 21 |
+
|
| 22 |
+
return (
|
| 23 |
+
<div className="bg-white w-[107px] flex flex-col items-center relative py-[0] h-[1000]">
|
| 24 |
+
{/* Active indicator - Dynamic positioning with precise centering */}
|
| 25 |
+
<div
|
| 26 |
+
className="absolute left-0 w-[3px] h-[45.822px] bg-[#4b4ad5] rounded-r-full transition-all duration-200 ease-in-out"
|
| 27 |
+
style={{
|
| 28 |
+
top: `${30 + menuItems.findIndex((item) => item.id === activeItem) * 64 + 10}px`,
|
| 29 |
+
}}
|
| 30 |
+
/>
|
| 31 |
+
|
| 32 |
+
{/* Logo */}
|
| 33 |
+
|
| 34 |
+
{/* Menu Items */}
|
| 35 |
+
<div className="flex flex-col items-center gap-2 mt-6">
|
| 36 |
+
{menuItems.map((item) => {
|
| 37 |
+
const Icon = item.icon
|
| 38 |
+
const isActive = activeItem === item.id
|
| 39 |
+
|
| 40 |
+
return (
|
| 41 |
+
<Button
|
| 42 |
+
key={item.id}
|
| 43 |
+
variant="ghost"
|
| 44 |
+
className={`flex flex-col items-center gap-[5px] p-2 h-[48px] w-[81px] hover:bg-transparent my-2 ${
|
| 45 |
+
isActive ? "text-[#4b4ad5]" : "text-[#454551]"
|
| 46 |
+
}`}
|
| 47 |
+
onClick={() => onItemClick(item.id)}
|
| 48 |
+
>
|
| 49 |
+
<Icon className={`h-6 w-6 ${isActive ? "text-[#4b4ad5]" : "text-[#a2a2a8]"}`} />
|
| 50 |
+
<span
|
| 51 |
+
className={`font-semibold leading-normal text-center text-xs ${
|
| 52 |
+
isActive ? "text-[#4b4ad5]" : "text-[#454551]"
|
| 53 |
+
}`}
|
| 54 |
+
>
|
| 55 |
+
{item.label}
|
| 56 |
+
</span>
|
| 57 |
+
</Button>
|
| 58 |
+
)
|
| 59 |
+
})}
|
| 60 |
+
</div>
|
| 61 |
+
</div>
|
| 62 |
+
)
|
| 63 |
+
}
|
ipdmodule/components/appointment-page.tsx
ADDED
|
@@ -0,0 +1,277 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"use client"
|
| 2 |
+
|
| 3 |
+
import { useState } from "react"
|
| 4 |
+
import { Button } from "@/components/ui/button"
|
| 5 |
+
import { Clock, CheckCircle, XCircle, MoreHorizontal, Filter, ArrowUpDown } from "lucide-react"
|
| 6 |
+
import { YellowBackgroundPattern } from "./yellow-background-pattern"
|
| 7 |
+
import { AppointmentSearchControls } from "./appointment-search-controls"
|
| 8 |
+
|
| 9 |
+
const appointmentTabs = [
|
| 10 |
+
{ id: "queue", label: "Queue (2)", icon: Clock, count: 2, active: true },
|
| 11 |
+
{ id: "finished", label: "Finished (0)", icon: CheckCircle, count: 0, active: false },
|
| 12 |
+
{ id: "cancelled", label: "Cancelled (0)", icon: XCircle, count: 0, active: false },
|
| 13 |
+
]
|
| 14 |
+
|
| 15 |
+
// Generate dynamic dummy data
|
| 16 |
+
const generatePatients = (count: number) => {
|
| 17 |
+
const firstNames = [
|
| 18 |
+
"Ram",
|
| 19 |
+
"Sri",
|
| 20 |
+
"Priya",
|
| 21 |
+
"Arjun",
|
| 22 |
+
"Kavya",
|
| 23 |
+
"Ravi",
|
| 24 |
+
"Meera",
|
| 25 |
+
"Suresh",
|
| 26 |
+
"Anita",
|
| 27 |
+
"Vikram",
|
| 28 |
+
"Deepa",
|
| 29 |
+
"Rajesh",
|
| 30 |
+
"Lakshmi",
|
| 31 |
+
"Kiran",
|
| 32 |
+
"Pooja",
|
| 33 |
+
"Amit",
|
| 34 |
+
"Sneha",
|
| 35 |
+
"Rohit",
|
| 36 |
+
"Divya",
|
| 37 |
+
"Sanjay",
|
| 38 |
+
]
|
| 39 |
+
|
| 40 |
+
const lastNames = [
|
| 41 |
+
"Sharma",
|
| 42 |
+
"Patel",
|
| 43 |
+
"Kumar",
|
| 44 |
+
"Singh",
|
| 45 |
+
"Reddy",
|
| 46 |
+
"Nair",
|
| 47 |
+
"Gupta",
|
| 48 |
+
"Joshi",
|
| 49 |
+
"Rao",
|
| 50 |
+
"Iyer",
|
| 51 |
+
"Agarwal",
|
| 52 |
+
"Verma",
|
| 53 |
+
"Mishra",
|
| 54 |
+
"Chopra",
|
| 55 |
+
"Malhotra",
|
| 56 |
+
]
|
| 57 |
+
|
| 58 |
+
const genders = ["Male", "Female"]
|
| 59 |
+
const visitTypes = ["New", "Follow-up", "Emergency", "Consultation", "Check-up"]
|
| 60 |
+
const timeSlots = [
|
| 61 |
+
"09:00 am",
|
| 62 |
+
"09:30 am",
|
| 63 |
+
"10:00 am",
|
| 64 |
+
"10:30 am",
|
| 65 |
+
"11:00 am",
|
| 66 |
+
"11:30 am",
|
| 67 |
+
"12:00 pm",
|
| 68 |
+
"02:00 pm",
|
| 69 |
+
"02:30 pm",
|
| 70 |
+
"03:00 pm",
|
| 71 |
+
"03:30 pm",
|
| 72 |
+
"04:00 pm",
|
| 73 |
+
"04:30 pm",
|
| 74 |
+
"05:00 pm",
|
| 75 |
+
]
|
| 76 |
+
|
| 77 |
+
const generatePhoneNumber = () => {
|
| 78 |
+
const prefix = "+91-"
|
| 79 |
+
const number = Math.floor(Math.random() * 9000000000) + 1000000000
|
| 80 |
+
return prefix + number.toString()
|
| 81 |
+
}
|
| 82 |
+
|
| 83 |
+
// Generate dates starting from today and going forward
|
| 84 |
+
const generateDate = (index: number) => {
|
| 85 |
+
const today = new Date()
|
| 86 |
+
const appointmentDate = new Date(today)
|
| 87 |
+
appointmentDate.setDate(today.getDate() + index)
|
| 88 |
+
|
| 89 |
+
const months = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]
|
| 90 |
+
|
| 91 |
+
const day = appointmentDate.getDate()
|
| 92 |
+
const month = months[appointmentDate.getMonth()]
|
| 93 |
+
const year = appointmentDate.getFullYear()
|
| 94 |
+
|
| 95 |
+
const suffix =
|
| 96 |
+
day === 1 || day === 21 || day === 31
|
| 97 |
+
? "st"
|
| 98 |
+
: day === 2 || day === 22
|
| 99 |
+
? "nd"
|
| 100 |
+
: day === 3 || day === 23
|
| 101 |
+
? "rd"
|
| 102 |
+
: "th"
|
| 103 |
+
|
| 104 |
+
return `${day}${suffix} ${month} ${year}`
|
| 105 |
+
}
|
| 106 |
+
|
| 107 |
+
const generateAge = () => Math.floor(Math.random() * 60) + 18
|
| 108 |
+
|
| 109 |
+
// Generate patients with sequential dates (latest first)
|
| 110 |
+
const patients = Array.from({ length: count }, (_, index) => {
|
| 111 |
+
const firstName = firstNames[Math.floor(Math.random() * firstNames.length)]
|
| 112 |
+
const lastName = lastNames[Math.floor(Math.random() * lastNames.length)]
|
| 113 |
+
const gender = genders[Math.floor(Math.random() * genders.length)]
|
| 114 |
+
const age = generateAge()
|
| 115 |
+
|
| 116 |
+
return {
|
| 117 |
+
id: index + 1,
|
| 118 |
+
name: `${firstName} ${lastName}`,
|
| 119 |
+
gender,
|
| 120 |
+
age: `${age}y`,
|
| 121 |
+
contact: generatePhoneNumber(),
|
| 122 |
+
visitType: visitTypes[Math.floor(Math.random() * visitTypes.length)],
|
| 123 |
+
slot: timeSlots[Math.floor(Math.random() * timeSlots.length)],
|
| 124 |
+
date: generateDate(index),
|
| 125 |
+
dateIndex: index, // For sorting purposes
|
| 126 |
+
}
|
| 127 |
+
})
|
| 128 |
+
|
| 129 |
+
// Sort by date (latest appointments first - smallest dateIndex first)
|
| 130 |
+
return patients.sort((a, b) => a.dateIndex - b.dateIndex)
|
| 131 |
+
}
|
| 132 |
+
|
| 133 |
+
const patients = generatePatients(12)
|
| 134 |
+
|
| 135 |
+
export function AppointmentPage() {
|
| 136 |
+
const [activeTab, setActiveTab] = useState("queue")
|
| 137 |
+
|
| 138 |
+
return (
|
| 139 |
+
<div className="min-h-screen w-full relative">
|
| 140 |
+
{/* Yellow Background Pattern */}
|
| 141 |
+
<YellowBackgroundPattern />
|
| 142 |
+
|
| 143 |
+
{/* Main Content */}
|
| 144 |
+
<div className="w-full px-4 sm:px-6 lg:px-8 pt-6 relative z-10 pb-6">
|
| 145 |
+
{/* Welcome Section */}
|
| 146 |
+
<div className="flex flex-col sm:flex-row sm:items-center sm:justify-between w-full gap-4 mb-6">
|
| 147 |
+
<div className="text-[#171725]">
|
| 148 |
+
<h1 className="text-xl sm:text-2xl lg:text-[24px] font-semibold leading-tight sm:leading-[32px]">
|
| 149 |
+
Welcome Dr. Mihir!
|
| 150 |
+
</h1>
|
| 151 |
+
<p className="text-xs sm:text-[12px] font-semibold leading-normal mt-1">Your Appointments</p>
|
| 152 |
+
</div>
|
| 153 |
+
<Button className="bg-[#4b4ad5] hover:bg-[#4b4ad5]/90 text-white h-[41px] px-4 sm:px-6 rounded-[10px] font-semibold text-sm whitespace-nowrap">
|
| 154 |
+
Start Walk-In Consultation
|
| 155 |
+
</Button>
|
| 156 |
+
</div>
|
| 157 |
+
|
| 158 |
+
{/* Appointment Card */}
|
| 159 |
+
<div className="bg-white rounded-2xl sm:rounded-3xl border border-[#e2e2ea] py-4 sm:py-6 shadow-lg">
|
| 160 |
+
<div className="flex flex-col gap-4 sm:gap-6">
|
| 161 |
+
{/* Tabs */}
|
| 162 |
+
<div className="border-b border-[#e2e2ea] overflow-x-auto">
|
| 163 |
+
<div className="flex gap-4 sm:gap-8 px-4 sm:px-8 min-w-max">
|
| 164 |
+
{appointmentTabs.map((tab) => {
|
| 165 |
+
const Icon = tab.icon
|
| 166 |
+
return (
|
| 167 |
+
<div
|
| 168 |
+
key={tab.id}
|
| 169 |
+
className={`flex flex-col items-center gap-4 sm:gap-[21px] pb-4 cursor-pointer whitespace-nowrap sm:pb-[0] ${
|
| 170 |
+
tab.active ? "text-[#4b4ad5]" : "text-[#454551]"
|
| 171 |
+
}`}
|
| 172 |
+
onClick={() => setActiveTab(tab.id)}
|
| 173 |
+
>
|
| 174 |
+
<div className="flex items-center gap-2 sm:gap-[10px]">
|
| 175 |
+
<Icon className="h-4 w-4 sm:h-5 sm:w-5" />
|
| 176 |
+
<span className={`text-sm ${tab.active ? "font-semibold" : "font-medium"}`}>{tab.label}</span>
|
| 177 |
+
</div>
|
| 178 |
+
{tab.active && <div className="w-full h-[3px] bg-[#4b4ad5] rounded-[10px]" />}
|
| 179 |
+
</div>
|
| 180 |
+
)
|
| 181 |
+
})}
|
| 182 |
+
</div>
|
| 183 |
+
</div>
|
| 184 |
+
|
| 185 |
+
{/* Search and Controls */}
|
| 186 |
+
<div className="px-4 sm:px-8">
|
| 187 |
+
<AppointmentSearchControls />
|
| 188 |
+
</div>
|
| 189 |
+
|
| 190 |
+
{/* Patient Table */}
|
| 191 |
+
<div className="px-4 sm:px-8">
|
| 192 |
+
<div className="w-full overflow-x-auto">
|
| 193 |
+
{/* Table Header */}
|
| 194 |
+
<div className="bg-[#f1f1f5] rounded-xl h-[38px] flex items-center mb-0 min-w-[800px] gap-x-12">
|
| 195 |
+
<div className="w-[60px] px-2 sm:px-4 py-5 flex items-center">
|
| 196 |
+
<span className="text-[#454551] text-[12px] font-semibold">#</span>
|
| 197 |
+
</div>
|
| 198 |
+
<div className="w-[200px] sm:w-[270px] px-3 sm:px-[18px] py-[7px] flex items-center">
|
| 199 |
+
<span className="text-[#454551] text-[12px] font-semibold">NAME</span>
|
| 200 |
+
</div>
|
| 201 |
+
<div className="w-[160px] sm:w-[220px] px-3 sm:px-[18px] py-[22px] flex items-center">
|
| 202 |
+
<span className="text-[#454551] text-[12px] font-semibold">CONTACT</span>
|
| 203 |
+
</div>
|
| 204 |
+
<div className="w-[120px] sm:w-[184px] px-3 sm:px-[18px] py-[19px] flex items-center gap-[5px]">
|
| 205 |
+
<span className="text-[#454551] text-[12px] font-semibold">VISIT TYPE</span>
|
| 206 |
+
<Filter className="h-[18px] w-[18px] text-[#454551]" />
|
| 207 |
+
</div>
|
| 208 |
+
<div className="w-[120px] sm:w-[184px] px-3 sm:px-[18px] py-[11px] flex items-center gap-[5px]">
|
| 209 |
+
<span className="text-[#454551] text-[12px] font-semibold">SLOT</span>
|
| 210 |
+
<ArrowUpDown className="h-[18px] w-[18px] text-[#454551]" />
|
| 211 |
+
</div>
|
| 212 |
+
<div className="w-[100px] sm:w-[184px] px-3 sm:px-[18px] py-[11px] flex items-center">
|
| 213 |
+
<span className="text-[#454551] text-[12px] font-semibold">ACTION</span>
|
| 214 |
+
</div>
|
| 215 |
+
<div className="w-[60px] sm:w-[69px]"></div>
|
| 216 |
+
</div>
|
| 217 |
+
|
| 218 |
+
{/* Table Rows */}
|
| 219 |
+
<div className="flex flex-col">
|
| 220 |
+
{patients.map((patient, index) => (
|
| 221 |
+
<div
|
| 222 |
+
key={patient.id}
|
| 223 |
+
className="bg-white min-h-[68px] flex items-center hover:bg-[#fafafb] transition-colors border-0 min-w-[800px] gap-x-12"
|
| 224 |
+
>
|
| 225 |
+
<div className="w-[60px] px-2 sm:px-4 py-5 flex items-center border-0">
|
| 226 |
+
<span className="text-[#454551] text-[14px] font-normal">{index + 1}</span>
|
| 227 |
+
</div>
|
| 228 |
+
<div className="w-[200px] sm:w-[270px] px-3 sm:px-[18px] py-[7px] flex flex-col justify-center border-0">
|
| 229 |
+
<div className="text-[#4b4ad5] text-sm sm:text-[16px] font-medium leading-tight sm:leading-[24px] truncate">
|
| 230 |
+
{patient.name}
|
| 231 |
+
</div>
|
| 232 |
+
<div className="text-[#454551] text-xs sm:text-[14px] font-normal leading-tight sm:leading-[26px]">
|
| 233 |
+
{patient.gender}, {patient.age}
|
| 234 |
+
</div>
|
| 235 |
+
</div>
|
| 236 |
+
<div className="w-[160px] sm:w-[220px] px-3 sm:px-[18px] py-[22px] flex items-center border-0">
|
| 237 |
+
<span className="text-[#454551] text-sm sm:text-[16px] font-medium leading-tight sm:leading-[24px] truncate">
|
| 238 |
+
{patient.contact}
|
| 239 |
+
</span>
|
| 240 |
+
</div>
|
| 241 |
+
<div className="w-[120px] sm:w-[184px] px-3 sm:px-[18px] py-[19px] flex items-center border-0">
|
| 242 |
+
<span className="text-[#454551] text-sm sm:text-[16px] font-medium leading-tight sm:leading-[24px]">
|
| 243 |
+
{patient.visitType}
|
| 244 |
+
</span>
|
| 245 |
+
</div>
|
| 246 |
+
<div className="w-[120px] sm:w-[184px] px-3 sm:px-[18px] py-[11px] flex flex-col justify-center border-0">
|
| 247 |
+
<div className="text-[#454551] text-sm sm:text-[16px] font-medium leading-tight sm:leading-[24px]">
|
| 248 |
+
{patient.slot}
|
| 249 |
+
</div>
|
| 250 |
+
<div className="text-[#454551] text-xs sm:text-[14px] font-normal leading-tight sm:leading-[26px]">
|
| 251 |
+
{patient.date}
|
| 252 |
+
</div>
|
| 253 |
+
</div>
|
| 254 |
+
<div className="w-[100px] sm:w-[184px] px-3 sm:px-[18px] py-[11px] flex items-center border-0">
|
| 255 |
+
<Button
|
| 256 |
+
variant="outline"
|
| 257 |
+
className="bg-white border-[#4b4ad5] text-[#4b4ad5] hover:bg-[#4b4ad5] hover:text-white h-8 sm:h-[40px] px-3 sm:px-[15px] rounded-[10px] font-semibold text-xs sm:text-[14px]"
|
| 258 |
+
>
|
| 259 |
+
Consult
|
| 260 |
+
</Button>
|
| 261 |
+
</div>
|
| 262 |
+
<div className="w-[60px] sm:w-[69px] px-3 sm:px-5 py-[15px] flex items-center justify-center border-0">
|
| 263 |
+
<Button variant="ghost" size="icon" className="h-5 w-5 sm:h-6 sm:w-6">
|
| 264 |
+
<MoreHorizontal className="h-4 w-4 sm:h-6 sm:w-6 text-[#454551]" />
|
| 265 |
+
</Button>
|
| 266 |
+
</div>
|
| 267 |
+
</div>
|
| 268 |
+
))}
|
| 269 |
+
</div>
|
| 270 |
+
</div>
|
| 271 |
+
</div>
|
| 272 |
+
</div>
|
| 273 |
+
</div>
|
| 274 |
+
</div>
|
| 275 |
+
</div>
|
| 276 |
+
)
|
| 277 |
+
}
|
ipdmodule/components/appointment-search-controls.tsx
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"use client"
|
| 2 |
+
|
| 3 |
+
import { Search, Calendar, ChevronRightIcon, ChevronRight } from "lucide-react"
|
| 4 |
+
import { Input } from "@/components/ui/input"
|
| 5 |
+
import { Button } from "@/components/ui/button"
|
| 6 |
+
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select"
|
| 7 |
+
|
| 8 |
+
export function AppointmentSearchControls() {
|
| 9 |
+
return (
|
| 10 |
+
<div className="flex items-center justify-between w-full gap-6">
|
| 11 |
+
{/* Search Input */}
|
| 12 |
+
<div className="relative w-[400px]">
|
| 13 |
+
<Search className="absolute left-[13px] top-1/2 -translate-y-1/2 h-5 w-5 text-[#a2a2a8]" />
|
| 14 |
+
<Input
|
| 15 |
+
placeholder="Search by patient name"
|
| 16 |
+
className="pl-[43px] h-[38px] border-[#e2e2ea] bg-white rounded-[10px] text-[14px]"
|
| 17 |
+
/>
|
| 18 |
+
</div>
|
| 19 |
+
|
| 20 |
+
{/* Date Navigation and Filter */}
|
| 21 |
+
<div className="flex items-center gap-4">
|
| 22 |
+
{/* Date Navigation */}
|
| 23 |
+
<div className="flex items-center">
|
| 24 |
+
<Button
|
| 25 |
+
variant="outline"
|
| 26 |
+
size="icon"
|
| 27 |
+
className="h-[38px] w-[38px] border-[#e2e2ea] bg-white rounded-l-[10px] rounded-r-none border-r-0"
|
| 28 |
+
>
|
| 29 |
+
<ChevronRightIcon className="h-5 w-5 text-[#454551] rotate-180" />
|
| 30 |
+
</Button>
|
| 31 |
+
<div className="flex items-center gap-3 h-[38px] px-3 border-t border-b border-[#e2e2ea] bg-white">
|
| 32 |
+
<Calendar className="h-5 w-5 text-[#454551]" />
|
| 33 |
+
<span className="text-[14px] text-[#454551] font-normal">9-10-2023</span>
|
| 34 |
+
</div>
|
| 35 |
+
<Button
|
| 36 |
+
variant="outline"
|
| 37 |
+
size="icon"
|
| 38 |
+
className="h-[38px] w-[38px] border-[#e2e2ea] bg-white rounded-r-[10px] rounded-l-none border-l-0"
|
| 39 |
+
>
|
| 40 |
+
<ChevronRight className="h-5 w-5 text-[#454551]" />
|
| 41 |
+
</Button>
|
| 42 |
+
</div>
|
| 43 |
+
|
| 44 |
+
{/* Today Filter */}
|
| 45 |
+
<Select defaultValue="today">
|
| 46 |
+
<SelectTrigger className="w-[116px] h-[38px] border-[#e2e2ea] bg-white rounded-[10px]">
|
| 47 |
+
<SelectValue />
|
| 48 |
+
</SelectTrigger>
|
| 49 |
+
<SelectContent>
|
| 50 |
+
<SelectItem value="today">Today</SelectItem>
|
| 51 |
+
<SelectItem value="tomorrow">Tomorrow</SelectItem>
|
| 52 |
+
<SelectItem value="this-week">This Week</SelectItem>
|
| 53 |
+
</SelectContent>
|
| 54 |
+
</Select>
|
| 55 |
+
</div>
|
| 56 |
+
</div>
|
| 57 |
+
)
|
| 58 |
+
}
|
ipdmodule/components/consultant-notes-form.tsx
ADDED
|
@@ -0,0 +1,242 @@
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"use client"
|
| 2 |
+
|
| 3 |
+
import { useState, useEffect } from "react"
|
| 4 |
+
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"
|
| 5 |
+
import { Input } from "@/components/ui/input"
|
| 6 |
+
import { Label } from "@/components/ui/label"
|
| 7 |
+
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select"
|
| 8 |
+
import { Button } from "@/components/ui/button"
|
| 9 |
+
import { RichTextEditor } from "./rich-text-editor"
|
| 10 |
+
import { FormNavigation } from "./form-navigation"
|
| 11 |
+
import { User, Stethoscope, ClipboardList, Calendar } from "lucide-react"
|
| 12 |
+
|
| 13 |
+
export function ConsultantNotesForm() {
|
| 14 |
+
const [activeSection, setActiveSection] = useState("consultation-info")
|
| 15 |
+
const [formData, setFormData] = useState({
|
| 16 |
+
consultationInfo: "",
|
| 17 |
+
clinicalFindings: "",
|
| 18 |
+
recommendations: "",
|
| 19 |
+
followUp: "",
|
| 20 |
+
})
|
| 21 |
+
|
| 22 |
+
const sections = [
|
| 23 |
+
{ id: "consultation-info", label: "Consultation Info", icon: <User className="w-4 h-4" /> },
|
| 24 |
+
{ id: "clinical-findings", label: "Clinical Findings", icon: <Stethoscope className="w-4 h-4" /> },
|
| 25 |
+
{ id: "recommendations", label: "Recommendations", icon: <ClipboardList className="w-4 h-4" /> },
|
| 26 |
+
{ id: "follow-up", label: "Follow-up", icon: <Calendar className="w-4 h-4" /> },
|
| 27 |
+
]
|
| 28 |
+
|
| 29 |
+
useEffect(() => {
|
| 30 |
+
const handleScroll = () => {
|
| 31 |
+
const sectionElements = sections.map((section) => ({
|
| 32 |
+
id: section.id,
|
| 33 |
+
element: document.getElementById(section.id),
|
| 34 |
+
}))
|
| 35 |
+
|
| 36 |
+
const currentSection = sectionElements.find(({ element }) => {
|
| 37 |
+
if (!element) return false
|
| 38 |
+
const rect = element.getBoundingClientRect()
|
| 39 |
+
return rect.top <= 100 && rect.bottom >= 100
|
| 40 |
+
})
|
| 41 |
+
|
| 42 |
+
if (currentSection) {
|
| 43 |
+
setActiveSection(currentSection.id)
|
| 44 |
+
}
|
| 45 |
+
}
|
| 46 |
+
|
| 47 |
+
window.addEventListener("scroll", handleScroll)
|
| 48 |
+
return () => window.removeEventListener("scroll", handleScroll)
|
| 49 |
+
}, [])
|
| 50 |
+
|
| 51 |
+
const updateFormData = (field: string, value: string) => {
|
| 52 |
+
setFormData((prev) => ({ ...prev, [field]: value }))
|
| 53 |
+
}
|
| 54 |
+
|
| 55 |
+
return (
|
| 56 |
+
<div className="relative">
|
| 57 |
+
<FormNavigation sections={sections} activeSection={activeSection} onSectionChange={setActiveSection} />
|
| 58 |
+
|
| 59 |
+
<div className="w-full space-y-6 pl-0 md:pl-16">
|
| 60 |
+
{/* Consultation Info Section */}
|
| 61 |
+
<Card id="consultation-info" className="scroll-mt-20">
|
| 62 |
+
<CardHeader className="bg-blue-50 border-b">
|
| 63 |
+
<CardTitle className="flex items-center gap-2 text-blue-800">
|
| 64 |
+
<User className="w-5 h-5" />
|
| 65 |
+
Consultation Information
|
| 66 |
+
</CardTitle>
|
| 67 |
+
</CardHeader>
|
| 68 |
+
<CardContent className="p-6 space-y-4">
|
| 69 |
+
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4">
|
| 70 |
+
<div>
|
| 71 |
+
<Label htmlFor="consultant-name">Consultant Name</Label>
|
| 72 |
+
<Input id="consultant-name" placeholder="Dr. Name" />
|
| 73 |
+
</div>
|
| 74 |
+
<div>
|
| 75 |
+
<Label htmlFor="specialty">Specialty</Label>
|
| 76 |
+
<Select>
|
| 77 |
+
<SelectTrigger>
|
| 78 |
+
<SelectValue placeholder="Select specialty" />
|
| 79 |
+
</SelectTrigger>
|
| 80 |
+
<SelectContent>
|
| 81 |
+
<SelectItem value="cardiology">Cardiology</SelectItem>
|
| 82 |
+
<SelectItem value="neurology">Neurology</SelectItem>
|
| 83 |
+
<SelectItem value="orthopedics">Orthopedics</SelectItem>
|
| 84 |
+
<SelectItem value="surgery">Surgery</SelectItem>
|
| 85 |
+
<SelectItem value="medicine">Internal Medicine</SelectItem>
|
| 86 |
+
</SelectContent>
|
| 87 |
+
</Select>
|
| 88 |
+
</div>
|
| 89 |
+
<div>
|
| 90 |
+
<Label htmlFor="consultation-date">Consultation Date</Label>
|
| 91 |
+
<Input id="consultation-date" type="date" />
|
| 92 |
+
</div>
|
| 93 |
+
<div>
|
| 94 |
+
<Label htmlFor="consultation-time">Time</Label>
|
| 95 |
+
<Input id="consultation-time" type="time" />
|
| 96 |
+
</div>
|
| 97 |
+
</div>
|
| 98 |
+
<div>
|
| 99 |
+
<Label htmlFor="reason-consultation">Reason for Consultation</Label>
|
| 100 |
+
<RichTextEditor
|
| 101 |
+
value={formData.consultationInfo}
|
| 102 |
+
onChange={(value) => updateFormData("consultationInfo", value)}
|
| 103 |
+
placeholder="Reason for requesting consultation..."
|
| 104 |
+
fieldType="chief-complaints"
|
| 105 |
+
showAutofill={true}
|
| 106 |
+
autofillSource="Referring Doctor"
|
| 107 |
+
autofillTimestamp="2024-01-15, 9:00 AM"
|
| 108 |
+
/>
|
| 109 |
+
</div>
|
| 110 |
+
</CardContent>
|
| 111 |
+
</Card>
|
| 112 |
+
|
| 113 |
+
{/* Clinical Findings Section */}
|
| 114 |
+
<Card id="clinical-findings" className="scroll-mt-20">
|
| 115 |
+
<CardHeader className="bg-green-50 border-b">
|
| 116 |
+
<CardTitle className="flex items-center gap-2 text-green-800">
|
| 117 |
+
<Stethoscope className="w-5 h-5" />
|
| 118 |
+
Clinical Findings
|
| 119 |
+
</CardTitle>
|
| 120 |
+
</CardHeader>
|
| 121 |
+
<CardContent className="p-6 space-y-4">
|
| 122 |
+
<div>
|
| 123 |
+
<Label htmlFor="examination-findings">Examination Findings</Label>
|
| 124 |
+
<RichTextEditor
|
| 125 |
+
value={formData.clinicalFindings}
|
| 126 |
+
onChange={(value) => updateFormData("clinicalFindings", value)}
|
| 127 |
+
placeholder="Detailed examination findings and clinical observations..."
|
| 128 |
+
fieldType="assessment"
|
| 129 |
+
rows={6}
|
| 130 |
+
/>
|
| 131 |
+
</div>
|
| 132 |
+
<div>
|
| 133 |
+
<Label htmlFor="diagnostic-impression">Diagnostic Impression</Label>
|
| 134 |
+
<RichTextEditor
|
| 135 |
+
value=""
|
| 136 |
+
onChange={() => {}}
|
| 137 |
+
placeholder="Clinical diagnosis and differential diagnoses..."
|
| 138 |
+
fieldType="assessment"
|
| 139 |
+
rows={4}
|
| 140 |
+
/>
|
| 141 |
+
</div>
|
| 142 |
+
</CardContent>
|
| 143 |
+
</Card>
|
| 144 |
+
|
| 145 |
+
{/* Recommendations Section */}
|
| 146 |
+
<Card id="recommendations" className="scroll-mt-20">
|
| 147 |
+
<CardHeader className="bg-orange-50 border-b">
|
| 148 |
+
<CardTitle className="flex items-center gap-2 text-orange-800">
|
| 149 |
+
<ClipboardList className="w-5 h-5" />
|
| 150 |
+
Recommendations
|
| 151 |
+
</CardTitle>
|
| 152 |
+
</CardHeader>
|
| 153 |
+
<CardContent className="p-6 space-y-4">
|
| 154 |
+
<div>
|
| 155 |
+
<Label htmlFor="treatment-recommendations">Treatment Recommendations</Label>
|
| 156 |
+
<RichTextEditor
|
| 157 |
+
value={formData.recommendations}
|
| 158 |
+
onChange={(value) => updateFormData("recommendations", value)}
|
| 159 |
+
placeholder="Specific treatment recommendations and management plan..."
|
| 160 |
+
fieldType="plan"
|
| 161 |
+
rows={6}
|
| 162 |
+
/>
|
| 163 |
+
</div>
|
| 164 |
+
<div>
|
| 165 |
+
<Label htmlFor="investigations-recommended">Investigations Recommended</Label>
|
| 166 |
+
<RichTextEditor
|
| 167 |
+
value=""
|
| 168 |
+
onChange={() => {}}
|
| 169 |
+
placeholder="Additional investigations or tests recommended..."
|
| 170 |
+
fieldType="plan"
|
| 171 |
+
rows={4}
|
| 172 |
+
/>
|
| 173 |
+
</div>
|
| 174 |
+
</CardContent>
|
| 175 |
+
</Card>
|
| 176 |
+
|
| 177 |
+
{/* Follow-up Section */}
|
| 178 |
+
<Card id="follow-up" className="scroll-mt-20">
|
| 179 |
+
<CardHeader className="bg-purple-50 border-b">
|
| 180 |
+
<CardTitle className="flex items-center gap-2 text-purple-800">
|
| 181 |
+
<Calendar className="w-5 h-5" />
|
| 182 |
+
Follow-up Plan
|
| 183 |
+
</CardTitle>
|
| 184 |
+
</CardHeader>
|
| 185 |
+
<CardContent className="p-6 space-y-4">
|
| 186 |
+
<div>
|
| 187 |
+
<Label htmlFor="follow-up-plan">Follow-up Instructions</Label>
|
| 188 |
+
<RichTextEditor
|
| 189 |
+
value={formData.followUp}
|
| 190 |
+
onChange={(value) => updateFormData("followUp", value)}
|
| 191 |
+
placeholder="Follow-up schedule and instructions..."
|
| 192 |
+
fieldType="plan"
|
| 193 |
+
rows={4}
|
| 194 |
+
/>
|
| 195 |
+
</div>
|
| 196 |
+
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4">
|
| 197 |
+
<div>
|
| 198 |
+
<Label htmlFor="next-appointment">Next Appointment</Label>
|
| 199 |
+
<Input id="next-appointment" type="date" />
|
| 200 |
+
</div>
|
| 201 |
+
<div>
|
| 202 |
+
<Label htmlFor="urgency">Urgency Level</Label>
|
| 203 |
+
<Select>
|
| 204 |
+
<SelectTrigger>
|
| 205 |
+
<SelectValue placeholder="Select urgency" />
|
| 206 |
+
</SelectTrigger>
|
| 207 |
+
<SelectContent>
|
| 208 |
+
<SelectItem value="routine">Routine</SelectItem>
|
| 209 |
+
<SelectItem value="urgent">Urgent</SelectItem>
|
| 210 |
+
<SelectItem value="emergency">Emergency</SelectItem>
|
| 211 |
+
</SelectContent>
|
| 212 |
+
</Select>
|
| 213 |
+
</div>
|
| 214 |
+
<div>
|
| 215 |
+
<Label htmlFor="follow-up-department">Department</Label>
|
| 216 |
+
<Select>
|
| 217 |
+
<SelectTrigger>
|
| 218 |
+
<SelectValue placeholder="Select department" />
|
| 219 |
+
</SelectTrigger>
|
| 220 |
+
<SelectContent>
|
| 221 |
+
<SelectItem value="cardiology">Cardiology</SelectItem>
|
| 222 |
+
<SelectItem value="neurology">Neurology</SelectItem>
|
| 223 |
+
<SelectItem value="orthopedics">Orthopedics</SelectItem>
|
| 224 |
+
<SelectItem value="surgery">Surgery</SelectItem>
|
| 225 |
+
<SelectItem value="medicine">Internal Medicine</SelectItem>
|
| 226 |
+
</SelectContent>
|
| 227 |
+
</Select>
|
| 228 |
+
</div>
|
| 229 |
+
</div>
|
| 230 |
+
</CardContent>
|
| 231 |
+
</Card>
|
| 232 |
+
|
| 233 |
+
{/* Form Actions */}
|
| 234 |
+
<div className="flex justify-end gap-4 py-6">
|
| 235 |
+
<Button variant="outline">Save Draft</Button>
|
| 236 |
+
<Button variant="outline">Print</Button>
|
| 237 |
+
<Button>Submit Consultation</Button>
|
| 238 |
+
</div>
|
| 239 |
+
</div>
|
| 240 |
+
</div>
|
| 241 |
+
)
|
| 242 |
+
}
|
ipdmodule/components/cross-referral-form.tsx
ADDED
|
@@ -0,0 +1,252 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"use client"
|
| 2 |
+
|
| 3 |
+
import { useState, useEffect } from "react"
|
| 4 |
+
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"
|
| 5 |
+
import { Input } from "@/components/ui/input"
|
| 6 |
+
import { Label } from "@/components/ui/label"
|
| 7 |
+
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select"
|
| 8 |
+
import { Button } from "@/components/ui/button"
|
| 9 |
+
import { RichTextEditor } from "./rich-text-editor"
|
| 10 |
+
import { FormNavigation } from "./form-navigation"
|
| 11 |
+
import { User, FileText, AlertCircle, Calendar } from "lucide-react"
|
| 12 |
+
|
| 13 |
+
export function CrossReferralForm() {
|
| 14 |
+
const [activeSection, setActiveSection] = useState("referral-info")
|
| 15 |
+
const [formData, setFormData] = useState({
|
| 16 |
+
referralInfo: "",
|
| 17 |
+
clinicalDetails: "",
|
| 18 |
+
urgency: "",
|
| 19 |
+
followUp: "",
|
| 20 |
+
})
|
| 21 |
+
|
| 22 |
+
const sections = [
|
| 23 |
+
{ id: "referral-info", label: "Referral Info", icon: <User className="w-4 h-4" /> },
|
| 24 |
+
{ id: "clinical-details", label: "Clinical Details", icon: <FileText className="w-4 h-4" /> },
|
| 25 |
+
{ id: "urgency", label: "Urgency", icon: <AlertCircle className="w-4 h-4" /> },
|
| 26 |
+
{ id: "follow-up", label: "Follow-up", icon: <Calendar className="w-4 h-4" /> },
|
| 27 |
+
]
|
| 28 |
+
|
| 29 |
+
useEffect(() => {
|
| 30 |
+
const handleScroll = () => {
|
| 31 |
+
const sectionElements = sections.map((section) => ({
|
| 32 |
+
id: section.id,
|
| 33 |
+
element: document.getElementById(section.id),
|
| 34 |
+
}))
|
| 35 |
+
|
| 36 |
+
const currentSection = sectionElements.find(({ element }) => {
|
| 37 |
+
if (!element) return false
|
| 38 |
+
const rect = element.getBoundingClientRect()
|
| 39 |
+
return rect.top <= 100 && rect.bottom >= 100
|
| 40 |
+
})
|
| 41 |
+
|
| 42 |
+
if (currentSection) {
|
| 43 |
+
setActiveSection(currentSection.id)
|
| 44 |
+
}
|
| 45 |
+
}
|
| 46 |
+
|
| 47 |
+
window.addEventListener("scroll", handleScroll)
|
| 48 |
+
return () => window.removeEventListener("scroll", handleScroll)
|
| 49 |
+
}, [])
|
| 50 |
+
|
| 51 |
+
const updateFormData = (field: string, value: string) => {
|
| 52 |
+
setFormData((prev) => ({ ...prev, [field]: value }))
|
| 53 |
+
}
|
| 54 |
+
|
| 55 |
+
return (
|
| 56 |
+
<div className="relative">
|
| 57 |
+
<FormNavigation sections={sections} activeSection={activeSection} onSectionChange={setActiveSection} />
|
| 58 |
+
|
| 59 |
+
<div className="w-full space-y-6 pl-0 md:pl-16">
|
| 60 |
+
{/* Referral Info Section */}
|
| 61 |
+
<Card id="referral-info" className="scroll-mt-20">
|
| 62 |
+
<CardHeader className="bg-blue-50 border-b">
|
| 63 |
+
<CardTitle className="flex items-center gap-2 text-blue-800">
|
| 64 |
+
<User className="w-5 h-5" />
|
| 65 |
+
Referral Information
|
| 66 |
+
</CardTitle>
|
| 67 |
+
</CardHeader>
|
| 68 |
+
<CardContent className="p-6 space-y-4">
|
| 69 |
+
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4">
|
| 70 |
+
<div>
|
| 71 |
+
<Label htmlFor="referring-doctor">Referring Doctor</Label>
|
| 72 |
+
<Input id="referring-doctor" placeholder="Dr. Name" />
|
| 73 |
+
</div>
|
| 74 |
+
<div>
|
| 75 |
+
<Label htmlFor="referring-department">Referring Department</Label>
|
| 76 |
+
<Select>
|
| 77 |
+
<SelectTrigger>
|
| 78 |
+
<SelectValue placeholder="Select department" />
|
| 79 |
+
</SelectTrigger>
|
| 80 |
+
<SelectContent>
|
| 81 |
+
<SelectItem value="medicine">Internal Medicine</SelectItem>
|
| 82 |
+
<SelectItem value="surgery">Surgery</SelectItem>
|
| 83 |
+
<SelectItem value="cardiology">Cardiology</SelectItem>
|
| 84 |
+
<SelectItem value="neurology">Neurology</SelectItem>
|
| 85 |
+
<SelectItem value="orthopedics">Orthopedics</SelectItem>
|
| 86 |
+
</SelectContent>
|
| 87 |
+
</Select>
|
| 88 |
+
</div>
|
| 89 |
+
<div>
|
| 90 |
+
<Label htmlFor="referred-to">Referred To</Label>
|
| 91 |
+
<Input id="referred-to" placeholder="Dr. Name / Department" />
|
| 92 |
+
</div>
|
| 93 |
+
<div>
|
| 94 |
+
<Label htmlFor="referral-date">Referral Date</Label>
|
| 95 |
+
<Input id="referral-date" type="date" />
|
| 96 |
+
</div>
|
| 97 |
+
</div>
|
| 98 |
+
<div>
|
| 99 |
+
<Label htmlFor="reason-referral">Reason for Referral</Label>
|
| 100 |
+
<RichTextEditor
|
| 101 |
+
value={formData.referralInfo}
|
| 102 |
+
onChange={(value) => updateFormData("referralInfo", value)}
|
| 103 |
+
placeholder="Reason for cross-referral and specific consultation request..."
|
| 104 |
+
fieldType="chief-complaints"
|
| 105 |
+
showAutofill={true}
|
| 106 |
+
autofillSource="Referring Doctor"
|
| 107 |
+
autofillTimestamp="2024-01-15, 2:30 PM"
|
| 108 |
+
/>
|
| 109 |
+
</div>
|
| 110 |
+
</CardContent>
|
| 111 |
+
</Card>
|
| 112 |
+
|
| 113 |
+
{/* Clinical Details Section */}
|
| 114 |
+
<Card id="clinical-details" className="scroll-mt-20">
|
| 115 |
+
<CardHeader className="bg-green-50 border-b">
|
| 116 |
+
<CardTitle className="flex items-center gap-2 text-green-800">
|
| 117 |
+
<FileText className="w-5 h-5" />
|
| 118 |
+
Clinical Details
|
| 119 |
+
</CardTitle>
|
| 120 |
+
</CardHeader>
|
| 121 |
+
<CardContent className="p-6 space-y-4">
|
| 122 |
+
<div>
|
| 123 |
+
<Label htmlFor="clinical-summary">Clinical Summary</Label>
|
| 124 |
+
<RichTextEditor
|
| 125 |
+
value={formData.clinicalDetails}
|
| 126 |
+
onChange={(value) => updateFormData("clinicalDetails", value)}
|
| 127 |
+
placeholder="Current clinical status, relevant history, and findings..."
|
| 128 |
+
fieldType="assessment"
|
| 129 |
+
rows={6}
|
| 130 |
+
/>
|
| 131 |
+
</div>
|
| 132 |
+
<div className="grid grid-cols-1 md:grid-cols-2 xl:grid-cols-2 gap-4">
|
| 133 |
+
<div>
|
| 134 |
+
<Label htmlFor="current-medications">Current Medications</Label>
|
| 135 |
+
<RichTextEditor
|
| 136 |
+
value=""
|
| 137 |
+
onChange={() => {}}
|
| 138 |
+
placeholder="List of current medications and dosages..."
|
| 139 |
+
fieldType="plan"
|
| 140 |
+
rows={4}
|
| 141 |
+
/>
|
| 142 |
+
</div>
|
| 143 |
+
<div>
|
| 144 |
+
<Label htmlFor="relevant-investigations">Relevant Investigations</Label>
|
| 145 |
+
<RichTextEditor
|
| 146 |
+
value=""
|
| 147 |
+
onChange={() => {}}
|
| 148 |
+
placeholder="Recent lab results, imaging, and other investigations..."
|
| 149 |
+
fieldType="general"
|
| 150 |
+
rows={4}
|
| 151 |
+
showAutofill={true}
|
| 152 |
+
autofillSource="Lab System"
|
| 153 |
+
autofillTimestamp="2024-01-15, 1:00 PM"
|
| 154 |
+
/>
|
| 155 |
+
</div>
|
| 156 |
+
</div>
|
| 157 |
+
</CardContent>
|
| 158 |
+
</Card>
|
| 159 |
+
|
| 160 |
+
{/* Urgency Section */}
|
| 161 |
+
<Card id="urgency" className="scroll-mt-20">
|
| 162 |
+
<CardHeader className="bg-orange-50 border-b">
|
| 163 |
+
<CardTitle className="flex items-center gap-2 text-orange-800">
|
| 164 |
+
<AlertCircle className="w-5 h-5" />
|
| 165 |
+
Urgency & Priority
|
| 166 |
+
</CardTitle>
|
| 167 |
+
</CardHeader>
|
| 168 |
+
<CardContent className="p-6 space-y-4">
|
| 169 |
+
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4">
|
| 170 |
+
<div>
|
| 171 |
+
<Label htmlFor="urgency-level">Urgency Level</Label>
|
| 172 |
+
<Select>
|
| 173 |
+
<SelectTrigger>
|
| 174 |
+
<SelectValue placeholder="Select urgency level" />
|
| 175 |
+
</SelectTrigger>
|
| 176 |
+
<SelectContent>
|
| 177 |
+
<SelectItem value="routine">Routine</SelectItem>
|
| 178 |
+
<SelectItem value="urgent">Urgent (within 24 hours)</SelectItem>
|
| 179 |
+
<SelectItem value="emergency">Emergency (immediate)</SelectItem>
|
| 180 |
+
</SelectContent>
|
| 181 |
+
</Select>
|
| 182 |
+
</div>
|
| 183 |
+
<div>
|
| 184 |
+
<Label htmlFor="expected-timeframe">Expected Timeframe</Label>
|
| 185 |
+
<Input id="expected-timeframe" placeholder="e.g., Within 2 hours" />
|
| 186 |
+
</div>
|
| 187 |
+
</div>
|
| 188 |
+
<div>
|
| 189 |
+
<Label htmlFor="urgency-justification">Urgency Justification</Label>
|
| 190 |
+
<RichTextEditor
|
| 191 |
+
value={formData.urgency}
|
| 192 |
+
onChange={(value) => updateFormData("urgency", value)}
|
| 193 |
+
placeholder="Justification for the urgency level and any time-sensitive concerns..."
|
| 194 |
+
fieldType="assessment"
|
| 195 |
+
rows={4}
|
| 196 |
+
/>
|
| 197 |
+
</div>
|
| 198 |
+
</CardContent>
|
| 199 |
+
</Card>
|
| 200 |
+
|
| 201 |
+
{/* Follow-up Section */}
|
| 202 |
+
<Card id="follow-up" className="scroll-mt-20">
|
| 203 |
+
<CardHeader className="bg-purple-50 border-b">
|
| 204 |
+
<CardTitle className="flex items-center gap-2 text-purple-800">
|
| 205 |
+
<Calendar className="w-5 h-5" />
|
| 206 |
+
Follow-up Instructions
|
| 207 |
+
</CardTitle>
|
| 208 |
+
</CardHeader>
|
| 209 |
+
<CardContent className="p-6 space-y-4">
|
| 210 |
+
<div>
|
| 211 |
+
<Label htmlFor="follow-up-instructions">Follow-up Instructions</Label>
|
| 212 |
+
<RichTextEditor
|
| 213 |
+
value={formData.followUp}
|
| 214 |
+
onChange={(value) => updateFormData("followUp", value)}
|
| 215 |
+
placeholder="Specific follow-up instructions and communication requirements..."
|
| 216 |
+
fieldType="plan"
|
| 217 |
+
rows={4}
|
| 218 |
+
/>
|
| 219 |
+
</div>
|
| 220 |
+
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4">
|
| 221 |
+
<div>
|
| 222 |
+
<Label htmlFor="contact-info">Contact Information</Label>
|
| 223 |
+
<Input id="contact-info" placeholder="Phone/Extension for updates" />
|
| 224 |
+
</div>
|
| 225 |
+
<div>
|
| 226 |
+
<Label htmlFor="preferred-communication">Preferred Communication</Label>
|
| 227 |
+
<Select>
|
| 228 |
+
<SelectTrigger>
|
| 229 |
+
<SelectValue placeholder="Select method" />
|
| 230 |
+
</SelectTrigger>
|
| 231 |
+
<SelectContent>
|
| 232 |
+
<SelectItem value="phone">Phone Call</SelectItem>
|
| 233 |
+
<SelectItem value="email">Email</SelectItem>
|
| 234 |
+
<SelectItem value="in-person">In-Person</SelectItem>
|
| 235 |
+
<SelectItem value="system">Hospital System</SelectItem>
|
| 236 |
+
</SelectContent>
|
| 237 |
+
</Select>
|
| 238 |
+
</div>
|
| 239 |
+
</div>
|
| 240 |
+
</CardContent>
|
| 241 |
+
</Card>
|
| 242 |
+
|
| 243 |
+
{/* Form Actions */}
|
| 244 |
+
<div className="flex justify-end gap-4 py-6">
|
| 245 |
+
<Button variant="outline">Save Draft</Button>
|
| 246 |
+
<Button variant="outline">Print</Button>
|
| 247 |
+
<Button>Submit Referral</Button>
|
| 248 |
+
</div>
|
| 249 |
+
</div>
|
| 250 |
+
</div>
|
| 251 |
+
)
|
| 252 |
+
}
|
ipdmodule/components/discharge-summary-form.tsx
ADDED
|
@@ -0,0 +1,1463 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"use client"
|
| 2 |
+
|
| 3 |
+
import { useState } from "react"
|
| 4 |
+
import { Button } from "@/components/ui/button"
|
| 5 |
+
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"
|
| 6 |
+
import { Input } from "@/components/ui/input"
|
| 7 |
+
import { Label } from "@/components/ui/label"
|
| 8 |
+
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select"
|
| 9 |
+
import { Badge } from "@/components/ui/badge"
|
| 10 |
+
import { Checkbox } from "@/components/ui/checkbox"
|
| 11 |
+
import { Textarea } from "@/components/ui/textarea"
|
| 12 |
+
import {
|
| 13 |
+
FileText,
|
| 14 |
+
Download,
|
| 15 |
+
Edit,
|
| 16 |
+
Eye,
|
| 17 |
+
Printer,
|
| 18 |
+
CheckCircle,
|
| 19 |
+
Save,
|
| 20 |
+
RefreshCw,
|
| 21 |
+
AlertCircle,
|
| 22 |
+
User,
|
| 23 |
+
Stethoscope,
|
| 24 |
+
TestTube,
|
| 25 |
+
Pill,
|
| 26 |
+
MapPin,
|
| 27 |
+
Activity,
|
| 28 |
+
Upload,
|
| 29 |
+
Calendar,
|
| 30 |
+
} from "lucide-react"
|
| 31 |
+
|
| 32 |
+
interface DischargeSummaryFormProps {
|
| 33 |
+
patient: any
|
| 34 |
+
}
|
| 35 |
+
|
| 36 |
+
interface AutofillSource {
|
| 37 |
+
source: string
|
| 38 |
+
timestamp?: string
|
| 39 |
+
available: boolean
|
| 40 |
+
data?: any
|
| 41 |
+
}
|
| 42 |
+
|
| 43 |
+
interface FormField {
|
| 44 |
+
value: string
|
| 45 |
+
source?: AutofillSource
|
| 46 |
+
isEdited: boolean
|
| 47 |
+
isRequired: boolean
|
| 48 |
+
}
|
| 49 |
+
|
| 50 |
+
export function DischargeSummaryForm({ patient }: DischargeSummaryFormProps) {
|
| 51 |
+
const [isEditing, setIsEditing] = useState(true)
|
| 52 |
+
const [isFinalized, setIsFinalized] = useState(false)
|
| 53 |
+
const [showProcedures, setShowProcedures] = useState(true)
|
| 54 |
+
const [currentUser] = useState({
|
| 55 |
+
name: "Dr. Sarah Johnson",
|
| 56 |
+
role: "Medical Officer",
|
| 57 |
+
id: "MO001",
|
| 58 |
+
})
|
| 59 |
+
|
| 60 |
+
// Form data with autofill source tracking
|
| 61 |
+
const [formData, setFormData] = useState({
|
| 62 |
+
// Patient Identification
|
| 63 |
+
patientName: {
|
| 64 |
+
value: "John Smith",
|
| 65 |
+
source: { source: "Admission Form/HIS", available: true, timestamp: "2024-01-15 09:30" },
|
| 66 |
+
isEdited: false,
|
| 67 |
+
isRequired: true,
|
| 68 |
+
} as FormField,
|
| 69 |
+
age: {
|
| 70 |
+
value: "45",
|
| 71 |
+
source: { source: "Admission Form/HIS", available: true, timestamp: "2024-01-15 09:30" },
|
| 72 |
+
isEdited: false,
|
| 73 |
+
isRequired: true,
|
| 74 |
+
} as FormField,
|
| 75 |
+
gender: {
|
| 76 |
+
value: "Male",
|
| 77 |
+
source: { source: "Admission Form/HIS", available: true, timestamp: "2024-01-15 09:30" },
|
| 78 |
+
isEdited: false,
|
| 79 |
+
isRequired: true,
|
| 80 |
+
} as FormField,
|
| 81 |
+
uhid: {
|
| 82 |
+
value: "MRN001234",
|
| 83 |
+
source: { source: "Admission Notes", available: true, timestamp: "2024-01-15 09:30" },
|
| 84 |
+
isEdited: false,
|
| 85 |
+
isRequired: true,
|
| 86 |
+
} as FormField,
|
| 87 |
+
ipdNo: {
|
| 88 |
+
value: "IPD-2024-001234",
|
| 89 |
+
source: { source: "Admission Notes", available: true, timestamp: "2024-01-15 09:30" },
|
| 90 |
+
isEdited: false,
|
| 91 |
+
isRequired: true,
|
| 92 |
+
} as FormField,
|
| 93 |
+
bedNo: {
|
| 94 |
+
value: "A-101",
|
| 95 |
+
source: { source: "Admission Notes", available: true, timestamp: "2024-01-15 09:30" },
|
| 96 |
+
isEdited: false,
|
| 97 |
+
isRequired: true,
|
| 98 |
+
} as FormField,
|
| 99 |
+
ward: {
|
| 100 |
+
value: "General Ward",
|
| 101 |
+
source: { source: "Admission Form/HIS", available: true, timestamp: "2024-01-15 09:30" },
|
| 102 |
+
isEdited: false,
|
| 103 |
+
isRequired: true,
|
| 104 |
+
} as FormField,
|
| 105 |
+
admissionDateTime: {
|
| 106 |
+
value: "2024-01-15 14:30",
|
| 107 |
+
source: { source: "System Generated", available: true, timestamp: "2024-01-15 14:30" },
|
| 108 |
+
isEdited: false,
|
| 109 |
+
isRequired: true,
|
| 110 |
+
} as FormField,
|
| 111 |
+
dischargeDateTime: {
|
| 112 |
+
value: "",
|
| 113 |
+
source: { source: "System Generated", available: false },
|
| 114 |
+
isEdited: false,
|
| 115 |
+
isRequired: true,
|
| 116 |
+
} as FormField,
|
| 117 |
+
referringDoctor: {
|
| 118 |
+
value: "",
|
| 119 |
+
source: { source: "Manual Entry", available: false },
|
| 120 |
+
isEdited: false,
|
| 121 |
+
isRequired: false,
|
| 122 |
+
} as FormField,
|
| 123 |
+
treatingConsultant: {
|
| 124 |
+
value: "Dr. Sarah Johnson",
|
| 125 |
+
source: { source: "Assignment Sheet", available: true, timestamp: "2024-01-15 09:45" },
|
| 126 |
+
isEdited: false,
|
| 127 |
+
isRequired: true,
|
| 128 |
+
} as FormField,
|
| 129 |
+
|
| 130 |
+
// Admission Details
|
| 131 |
+
reasonForAdmission: {
|
| 132 |
+
value: "Chest pain and shortness of breath for 2 days",
|
| 133 |
+
source: { source: "Admission Note", available: true, timestamp: "2024-01-15 15:00" },
|
| 134 |
+
isEdited: false,
|
| 135 |
+
isRequired: true,
|
| 136 |
+
} as FormField,
|
| 137 |
+
presentingComplaints: {
|
| 138 |
+
value: "Substernal chest pain radiating to left arm, associated with dyspnea on exertion",
|
| 139 |
+
source: { source: "Initial Assessment", available: true, timestamp: "2024-01-15 15:15" },
|
| 140 |
+
isEdited: false,
|
| 141 |
+
isRequired: true,
|
| 142 |
+
} as FormField,
|
| 143 |
+
conditionOnAdmission: {
|
| 144 |
+
value: "BP: 150/90 mmHg, HR: 95 bpm, RR: 22/min, Temp: 98.6°F, SpO2: 94% on room air",
|
| 145 |
+
source: { source: "HIS/Nursing Vitals Form", available: true, timestamp: "2024-01-15 15:30" },
|
| 146 |
+
isEdited: false,
|
| 147 |
+
isRequired: true,
|
| 148 |
+
} as FormField,
|
| 149 |
+
mlcStatus: {
|
| 150 |
+
value: "No",
|
| 151 |
+
source: { source: "Admission Note", available: true, timestamp: "2024-01-15 15:00" },
|
| 152 |
+
isEdited: false,
|
| 153 |
+
isRequired: false,
|
| 154 |
+
} as FormField,
|
| 155 |
+
|
| 156 |
+
// Diagnosis
|
| 157 |
+
provisionalDiagnosis: {
|
| 158 |
+
value: "Acute coronary syndrome",
|
| 159 |
+
source: { source: "Admission Note", available: true, timestamp: "2024-01-15 09:30" },
|
| 160 |
+
isEdited: false,
|
| 161 |
+
isRequired: true,
|
| 162 |
+
} as FormField,
|
| 163 |
+
finalDiagnosis: {
|
| 164 |
+
value: "NSTEMI (Non-ST elevation myocardial infarction)",
|
| 165 |
+
source: { source: "Final Consultant Notes", available: true, timestamp: "2024-01-18 10:30" },
|
| 166 |
+
isEdited: false,
|
| 167 |
+
isRequired: true,
|
| 168 |
+
} as FormField,
|
| 169 |
+
icdCode: {
|
| 170 |
+
value: "I21.4",
|
| 171 |
+
source: { source: "Coding System", available: true, timestamp: "2024-01-18 10:35" },
|
| 172 |
+
isEdited: false,
|
| 173 |
+
isRequired: false,
|
| 174 |
+
} as FormField,
|
| 175 |
+
|
| 176 |
+
// Course in Hospital
|
| 177 |
+
chronologicalSummary: {
|
| 178 |
+
value: `Day 1: Patient admitted with chest pain, started on dual antiplatelet therapy and anticoagulation. Day 2: Cardiac enzymes elevated, ECG changes noted. Day 3: Cardiac catheterization performed showing 70% LAD stenosis. Day 4: PCI with drug-eluting stent placement. Day 5: Patient stable, ambulating, ready for discharge.`,
|
| 179 |
+
source: {
|
| 180 |
+
source: "Summarized from last 5 days of Progress Notes",
|
| 181 |
+
available: true,
|
| 182 |
+
timestamp: "2024-01-18 11:00",
|
| 183 |
+
},
|
| 184 |
+
isEdited: false,
|
| 185 |
+
isRequired: true,
|
| 186 |
+
} as FormField,
|
| 187 |
+
complications: {
|
| 188 |
+
value: "None",
|
| 189 |
+
source: { source: "Incident Logs/Notes", available: true, timestamp: "2024-01-18 11:00" },
|
| 190 |
+
isEdited: false,
|
| 191 |
+
isRequired: false,
|
| 192 |
+
} as FormField,
|
| 193 |
+
|
| 194 |
+
// Investigations
|
| 195 |
+
labSummary: {
|
| 196 |
+
value: "Troponin I: 2.5 ng/mL (elevated), CK-MB: 45 U/L (elevated), CBC: WNL, BMP: Creatinine 1.2 mg/dL",
|
| 197 |
+
source: { source: "Lab Attachments/HIS", available: true, timestamp: "2024-01-17 08:00" },
|
| 198 |
+
isEdited: false,
|
| 199 |
+
isRequired: false,
|
| 200 |
+
} as FormField,
|
| 201 |
+
imagingFindings: {
|
| 202 |
+
value: "ECG: ST depression in leads V4-V6. Echo: EF 45%, regional wall motion abnormality in anterior wall",
|
| 203 |
+
source: { source: "Radiology Reports", available: true, timestamp: "2024-01-16 16:30" },
|
| 204 |
+
isEdited: false,
|
| 205 |
+
isRequired: false,
|
| 206 |
+
} as FormField,
|
| 207 |
+
abnormalResults: {
|
| 208 |
+
value: "Elevated cardiac enzymes consistent with myocardial infarction. Reduced ejection fraction.",
|
| 209 |
+
source: { source: "AI-summarized, editable", available: true, timestamp: "2024-01-18 11:15" },
|
| 210 |
+
isEdited: false,
|
| 211 |
+
isRequired: false,
|
| 212 |
+
} as FormField,
|
| 213 |
+
|
| 214 |
+
// Treatment Given
|
| 215 |
+
ivFluidsInjections: {
|
| 216 |
+
value: "Normal Saline 1000ml over 8 hours x 2 days, Heparin 5000 units SC q12h",
|
| 217 |
+
source: { source: "Orders + Nursing Chart", available: true, timestamp: "2024-01-18 11:20" },
|
| 218 |
+
isEdited: false,
|
| 219 |
+
isRequired: false,
|
| 220 |
+
} as FormField,
|
| 221 |
+
medicationsDuringStay: {
|
| 222 |
+
value: "Aspirin 325mg daily, Atorvastatin 80mg daily, Metoprolol 25mg BID, Lisinopril 5mg daily",
|
| 223 |
+
source: { source: "Medicine Chart / Drug Orders", available: true, timestamp: "2024-01-18 11:20" },
|
| 224 |
+
isEdited: false,
|
| 225 |
+
isRequired: true,
|
| 226 |
+
} as FormField,
|
| 227 |
+
supportiveTherapies: {
|
| 228 |
+
value: "Cardiac rehabilitation consultation",
|
| 229 |
+
source: { source: "Physio Logs", available: true, timestamp: "2024-01-17 14:00" },
|
| 230 |
+
isEdited: false,
|
| 231 |
+
isRequired: false,
|
| 232 |
+
} as FormField,
|
| 233 |
+
|
| 234 |
+
// Procedures/Surgeries
|
| 235 |
+
procedureName: {
|
| 236 |
+
value: "Percutaneous Coronary Intervention (PCI)",
|
| 237 |
+
source: { source: "OT Notes", available: true, timestamp: "2024-01-17 10:00" },
|
| 238 |
+
isEdited: false,
|
| 239 |
+
isRequired: false,
|
| 240 |
+
} as FormField,
|
| 241 |
+
procedureIndication: {
|
| 242 |
+
value: "70% stenosis of LAD artery",
|
| 243 |
+
source: { source: "OT Notes", available: true, timestamp: "2024-01-17 10:00" },
|
| 244 |
+
isEdited: false,
|
| 245 |
+
isRequired: false,
|
| 246 |
+
} as FormField,
|
| 247 |
+
operativeFindings: {
|
| 248 |
+
value: "70% stenosis in proximal LAD, good distal flow after stent placement",
|
| 249 |
+
source: { source: "OT Report", available: true, timestamp: "2024-01-17 12:30" },
|
| 250 |
+
isEdited: false,
|
| 251 |
+
isRequired: false,
|
| 252 |
+
} as FormField,
|
| 253 |
+
procedureSteps: {
|
| 254 |
+
value: "Right radial access, 6F sheath, coronary angiography, PCI to LAD with drug-eluting stent 3.0x18mm",
|
| 255 |
+
source: { source: "OT Report", available: true, timestamp: "2024-01-17 12:30" },
|
| 256 |
+
isEdited: false,
|
| 257 |
+
isRequired: false,
|
| 258 |
+
} as FormField,
|
| 259 |
+
procedureOutcome: {
|
| 260 |
+
value: "Successful PCI with TIMI 3 flow, no complications",
|
| 261 |
+
source: { source: "OT Report", available: true, timestamp: "2024-01-17 12:30" },
|
| 262 |
+
isEdited: false,
|
| 263 |
+
isRequired: false,
|
| 264 |
+
} as FormField,
|
| 265 |
+
surgeon: {
|
| 266 |
+
value: "Dr. Sarah Johnson",
|
| 267 |
+
source: { source: "OT Scheduling/Logs", available: true, timestamp: "2024-01-17 09:00" },
|
| 268 |
+
isEdited: false,
|
| 269 |
+
isRequired: false,
|
| 270 |
+
} as FormField,
|
| 271 |
+
anesthetist: {
|
| 272 |
+
value: "Local anesthesia",
|
| 273 |
+
source: { source: "OT Scheduling/Logs", available: true, timestamp: "2024-01-17 09:00" },
|
| 274 |
+
isEdited: false,
|
| 275 |
+
isRequired: false,
|
| 276 |
+
} as FormField,
|
| 277 |
+
|
| 278 |
+
// Discharge Condition
|
| 279 |
+
dischargeVitals: {
|
| 280 |
+
value: "BP: 130/80 mmHg, HR: 72 bpm, RR: 16/min, Temp: 98.4°F, SpO2: 98% on room air",
|
| 281 |
+
source: { source: "Final Day Progress Note", available: true, timestamp: "2024-01-18 08:00" },
|
| 282 |
+
isEdited: false,
|
| 283 |
+
isRequired: true,
|
| 284 |
+
} as FormField,
|
| 285 |
+
clinicalStatus: {
|
| 286 |
+
value: "Stable, ambulating, chest pain resolved, tolerating oral medications",
|
| 287 |
+
source: { source: "Final Day Progress Note", available: true, timestamp: "2024-01-18 08:00" },
|
| 288 |
+
isEdited: false,
|
| 289 |
+
isRequired: true,
|
| 290 |
+
} as FormField,
|
| 291 |
+
comparedToAdmission: {
|
| 292 |
+
value: "Significant improvement - chest pain resolved, vitals stable, cardiac enzymes trending down",
|
| 293 |
+
source: { source: "Auto-comparison with admission vitals", available: true, timestamp: "2024-01-18 11:30" },
|
| 294 |
+
isEdited: false,
|
| 295 |
+
isRequired: false,
|
| 296 |
+
} as FormField,
|
| 297 |
+
|
| 298 |
+
// Discharge Medications
|
| 299 |
+
dischargeMedications: {
|
| 300 |
+
value: `1. Aspirin 75mg daily
|
| 301 |
+
2. Atorvastatin 40mg at bedtime
|
| 302 |
+
3. Metoprolol 25mg twice daily
|
| 303 |
+
4. Lisinopril 5mg daily
|
| 304 |
+
5. Clopidogrel 75mg daily x 12 months`,
|
| 305 |
+
source: { source: "Final Orders", available: true, timestamp: "2024-01-18 10:45" },
|
| 306 |
+
isEdited: false,
|
| 307 |
+
isRequired: true,
|
| 308 |
+
} as FormField,
|
| 309 |
+
|
| 310 |
+
// Discharge Advice
|
| 311 |
+
diet: {
|
| 312 |
+
value: "Low sodium, heart-healthy diet. Limit saturated fats.",
|
| 313 |
+
source: { source: "Consultant Notes / Templates", available: true, timestamp: "2024-01-18 10:50" },
|
| 314 |
+
isEdited: false,
|
| 315 |
+
isRequired: false,
|
| 316 |
+
} as FormField,
|
| 317 |
+
activity: {
|
| 318 |
+
value:
|
| 319 |
+
"Gradual increase in activity. Avoid heavy lifting >10 lbs for 1 week. Cardiac rehabilitation recommended.",
|
| 320 |
+
source: { source: "Standard Template - editable", available: true, timestamp: "2024-01-18 10:50" },
|
| 321 |
+
isEdited: false,
|
| 322 |
+
isRequired: false,
|
| 323 |
+
} as FormField,
|
| 324 |
+
warningSigns: {
|
| 325 |
+
value: "Return immediately if chest pain, shortness of breath, dizziness, or palpitations occur.",
|
| 326 |
+
source: { source: "Standard Template - editable", available: true, timestamp: "2024-01-18 10:50" },
|
| 327 |
+
isEdited: false,
|
| 328 |
+
isRequired: true,
|
| 329 |
+
} as FormField,
|
| 330 |
+
|
| 331 |
+
// Follow-up
|
| 332 |
+
followUpDate: {
|
| 333 |
+
value: "25/01/2024",
|
| 334 |
+
source: { source: "Follow-up Order", available: true, timestamp: "2024-01-18 10:55" },
|
| 335 |
+
isEdited: false,
|
| 336 |
+
isRequired: true,
|
| 337 |
+
} as FormField,
|
| 338 |
+
followUpDept: {
|
| 339 |
+
value: "Cardiology",
|
| 340 |
+
source: { source: "Consultant Note", available: true, timestamp: "2024-01-18 10:55" },
|
| 341 |
+
isEdited: false,
|
| 342 |
+
isRequired: true,
|
| 343 |
+
} as FormField,
|
| 344 |
+
followUpDoctor: {
|
| 345 |
+
value: "Dr. Sarah Johnson",
|
| 346 |
+
source: { source: "Consultant Note", available: true, timestamp: "2024-01-18 10:55" },
|
| 347 |
+
isEdited: false,
|
| 348 |
+
isRequired: true,
|
| 349 |
+
} as FormField,
|
| 350 |
+
|
| 351 |
+
// Patient/Relative Acknowledgement
|
| 352 |
+
acknowledgement: {
|
| 353 |
+
value: "Patient/Relative has been informed about discharge instructions and medications",
|
| 354 |
+
source: { source: "Manual Entry", available: true, timestamp: "2024-01-18 11:15" },
|
| 355 |
+
isEdited: false,
|
| 356 |
+
isRequired: false,
|
| 357 |
+
} as FormField,
|
| 358 |
+
additionalNotes: {
|
| 359 |
+
value:
|
| 360 |
+
"Patient and spouse counseled about discharge medications, dietary restrictions, and warning signs. All questions answered.",
|
| 361 |
+
source: { source: "Manual Entry", available: true, timestamp: "2024-01-18 11:15" },
|
| 362 |
+
isEdited: false,
|
| 363 |
+
isRequired: false,
|
| 364 |
+
} as FormField,
|
| 365 |
+
})
|
| 366 |
+
|
| 367 |
+
const [validationErrors, setValidationErrors] = useState<string[]>([])
|
| 368 |
+
|
| 369 |
+
// Auto-fill source indicator component
|
| 370 |
+
const AutofillIndicator = ({ field }: { field: FormField }) => {
|
| 371 |
+
if (!field.source) return null
|
| 372 |
+
|
| 373 |
+
const getIndicatorStyle = (available: boolean, isEdited: boolean) => {
|
| 374 |
+
if (isEdited) {
|
| 375 |
+
return {
|
| 376 |
+
bg: "bg-blue-50",
|
| 377 |
+
text: "text-blue-700",
|
| 378 |
+
border: "border-blue-200",
|
| 379 |
+
icon: <Edit className="w-3 h-3" />,
|
| 380 |
+
}
|
| 381 |
+
}
|
| 382 |
+
if (available) {
|
| 383 |
+
return {
|
| 384 |
+
bg: "bg-green-50",
|
| 385 |
+
text: "text-green-700",
|
| 386 |
+
border: "border-green-200",
|
| 387 |
+
icon: <CheckCircle className="w-3 h-3 text-green-600" />,
|
| 388 |
+
}
|
| 389 |
+
}
|
| 390 |
+
return {
|
| 391 |
+
bg: "bg-gray-50",
|
| 392 |
+
text: "text-gray-600",
|
| 393 |
+
border: "border-gray-200",
|
| 394 |
+
icon: <AlertCircle className="w-3 h-3 text-gray-500" />,
|
| 395 |
+
}
|
| 396 |
+
}
|
| 397 |
+
|
| 398 |
+
const style = getIndicatorStyle(field.source.available, field.isEdited)
|
| 399 |
+
|
| 400 |
+
return (
|
| 401 |
+
<div
|
| 402 |
+
className={`flex items-center justify-between px-3 py-1.5 rounded-md text-xs border mb-2 ${style.bg} ${style.text} ${style.border}`}
|
| 403 |
+
>
|
| 404 |
+
<div className="flex items-center gap-2">
|
| 405 |
+
{style.icon}
|
| 406 |
+
<span className="font-medium">
|
| 407 |
+
{field.isEdited
|
| 408 |
+
? "Manually edited"
|
| 409 |
+
: field.source.available
|
| 410 |
+
? `Auto-filled from: ${field.source.source}`
|
| 411 |
+
: `No data available from: ${field.source.source}`}
|
| 412 |
+
</span>
|
| 413 |
+
{field.source.timestamp && field.source.available && (
|
| 414 |
+
<span className="opacity-70">• {field.source.timestamp}</span>
|
| 415 |
+
)}
|
| 416 |
+
</div>
|
| 417 |
+
{field.source.available && !field.isEdited && (
|
| 418 |
+
<Button
|
| 419 |
+
size="sm"
|
| 420 |
+
variant="ghost"
|
| 421 |
+
className="h-5 w-5 p-0 hover:bg-green-100 rounded"
|
| 422 |
+
onClick={() =>
|
| 423 |
+
refreshField(Object.keys(formData).find((key) => formData[key as keyof typeof formData] === field) || "")
|
| 424 |
+
}
|
| 425 |
+
>
|
| 426 |
+
<RefreshCw className="w-3 h-3 text-green-600" />
|
| 427 |
+
</Button>
|
| 428 |
+
)}
|
| 429 |
+
</div>
|
| 430 |
+
)
|
| 431 |
+
}
|
| 432 |
+
|
| 433 |
+
const handleFieldChange = (fieldName: string, value: string) => {
|
| 434 |
+
setFormData((prev) => ({
|
| 435 |
+
...prev,
|
| 436 |
+
[fieldName]: {
|
| 437 |
+
...prev[fieldName as keyof typeof prev],
|
| 438 |
+
value,
|
| 439 |
+
isEdited: true,
|
| 440 |
+
},
|
| 441 |
+
}))
|
| 442 |
+
}
|
| 443 |
+
|
| 444 |
+
const refreshField = (fieldName: string) => {
|
| 445 |
+
alert(`Refreshing ${fieldName} from source...`)
|
| 446 |
+
}
|
| 447 |
+
|
| 448 |
+
const validateForm = () => {
|
| 449 |
+
const errors: string[] = []
|
| 450 |
+
Object.entries(formData).forEach(([key, field]) => {
|
| 451 |
+
if (field.isRequired && !field.value.trim()) {
|
| 452 |
+
errors.push(`${key.replace(/([A-Z])/g, " $1").toLowerCase()} is required`)
|
| 453 |
+
}
|
| 454 |
+
})
|
| 455 |
+
setValidationErrors(errors)
|
| 456 |
+
return errors.length === 0
|
| 457 |
+
}
|
| 458 |
+
|
| 459 |
+
const handleSave = () => {
|
| 460 |
+
if (validateForm()) {
|
| 461 |
+
console.log("Saving discharge summary:", formData)
|
| 462 |
+
alert("Discharge summary saved successfully!")
|
| 463 |
+
}
|
| 464 |
+
}
|
| 465 |
+
|
| 466 |
+
const handleFinalize = () => {
|
| 467 |
+
if (validateForm()) {
|
| 468 |
+
setIsFinalized(true)
|
| 469 |
+
setIsEditing(false)
|
| 470 |
+
alert("Discharge summary finalized and saved to patient record!")
|
| 471 |
+
}
|
| 472 |
+
}
|
| 473 |
+
|
| 474 |
+
const handleDownloadPDF = () => {
|
| 475 |
+
alert("Generating structured PDF with autofill source annotations...")
|
| 476 |
+
}
|
| 477 |
+
|
| 478 |
+
return (
|
| 479 |
+
<div className="w-full space-y-6">
|
| 480 |
+
{/* Header */}
|
| 481 |
+
<div className="flex items-center justify-between">
|
| 482 |
+
<div>
|
| 483 |
+
<h2 className="text-2xl font-bold text-gray-900">Discharge Summary</h2>
|
| 484 |
+
<p className="text-sm text-gray-600">
|
| 485 |
+
Comprehensive discharge summary with autofill source tracking for {formData.patientName.value}
|
| 486 |
+
</p>
|
| 487 |
+
</div>
|
| 488 |
+
<div className="flex gap-2">
|
| 489 |
+
{!isFinalized && (
|
| 490 |
+
<Button variant={isEditing ? "outline" : "default"} onClick={() => setIsEditing(!isEditing)}>
|
| 491 |
+
{isEditing ? <Eye className="w-4 h-4 mr-2" /> : <Edit className="w-4 h-4 mr-2" />}
|
| 492 |
+
{isEditing ? "View Mode" : "Edit Mode"}
|
| 493 |
+
</Button>
|
| 494 |
+
)}
|
| 495 |
+
<Button variant="outline" onClick={handleDownloadPDF}>
|
| 496 |
+
<Download className="w-4 h-4 mr-2" />
|
| 497 |
+
Download PDF
|
| 498 |
+
</Button>
|
| 499 |
+
<Button variant="outline">
|
| 500 |
+
<Printer className="w-4 h-4 mr-2" />
|
| 501 |
+
Print
|
| 502 |
+
</Button>
|
| 503 |
+
</div>
|
| 504 |
+
</div>
|
| 505 |
+
|
| 506 |
+
{/* Validation Errors */}
|
| 507 |
+
{validationErrors.length > 0 && (
|
| 508 |
+
<Card className="bg-red-50 border-red-200">
|
| 509 |
+
<CardContent className="p-4">
|
| 510 |
+
<div className="flex items-center gap-2 mb-2">
|
| 511 |
+
<AlertCircle className="w-5 h-5 text-red-600" />
|
| 512 |
+
<span className="font-medium text-red-900">Please complete the following required fields:</span>
|
| 513 |
+
</div>
|
| 514 |
+
<ul className="list-disc list-inside text-sm text-red-700 space-y-1">
|
| 515 |
+
{validationErrors.map((error, index) => (
|
| 516 |
+
<li key={index}>{error}</li>
|
| 517 |
+
))}
|
| 518 |
+
</ul>
|
| 519 |
+
</CardContent>
|
| 520 |
+
</Card>
|
| 521 |
+
)}
|
| 522 |
+
|
| 523 |
+
{/* Finalization Status */}
|
| 524 |
+
{isFinalized && (
|
| 525 |
+
<Card className="bg-green-50 border-green-200">
|
| 526 |
+
<CardContent className="p-4">
|
| 527 |
+
<div className="flex items-center gap-2">
|
| 528 |
+
<CheckCircle className="w-5 h-5 text-green-600" />
|
| 529 |
+
<span className="font-medium text-green-900">Discharge Summary Finalized</span>
|
| 530 |
+
<Badge variant="secondary" className="bg-green-100 text-green-800">
|
| 531 |
+
Final
|
| 532 |
+
</Badge>
|
| 533 |
+
<span className="text-sm text-green-700 ml-auto">
|
| 534 |
+
by {currentUser.name} on {new Date().toLocaleString()}
|
| 535 |
+
</span>
|
| 536 |
+
</div>
|
| 537 |
+
</CardContent>
|
| 538 |
+
</Card>
|
| 539 |
+
)}
|
| 540 |
+
|
| 541 |
+
<div className="w-full space-y-6">
|
| 542 |
+
{/* Patient Identification */}
|
| 543 |
+
<Card>
|
| 544 |
+
<CardHeader>
|
| 545 |
+
<CardTitle className="flex items-center gap-2">
|
| 546 |
+
<User className="w-5 h-5 text-blue-600" />
|
| 547 |
+
Patient Identification
|
| 548 |
+
</CardTitle>
|
| 549 |
+
</CardHeader>
|
| 550 |
+
<CardContent className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4">
|
| 551 |
+
<div>
|
| 552 |
+
<Label htmlFor="patientName">Patient Name *</Label>
|
| 553 |
+
<AutofillIndicator field={formData.patientName} />
|
| 554 |
+
{isEditing ? (
|
| 555 |
+
<Input
|
| 556 |
+
id="patientName"
|
| 557 |
+
value={formData.patientName.value}
|
| 558 |
+
onChange={(e) => handleFieldChange("patientName", e.target.value)}
|
| 559 |
+
/>
|
| 560 |
+
) : (
|
| 561 |
+
<p className="font-medium">{formData.patientName.value}</p>
|
| 562 |
+
)}
|
| 563 |
+
</div>
|
| 564 |
+
|
| 565 |
+
<div>
|
| 566 |
+
<Label htmlFor="age">Age *</Label>
|
| 567 |
+
<AutofillIndicator field={formData.age} />
|
| 568 |
+
{isEditing ? (
|
| 569 |
+
<Input id="age" value={formData.age.value} onChange={(e) => handleFieldChange("age", e.target.value)} />
|
| 570 |
+
) : (
|
| 571 |
+
<p className="font-medium">{formData.age.value}</p>
|
| 572 |
+
)}
|
| 573 |
+
</div>
|
| 574 |
+
|
| 575 |
+
<div>
|
| 576 |
+
<Label htmlFor="gender">Gender *</Label>
|
| 577 |
+
<AutofillIndicator field={formData.gender} />
|
| 578 |
+
{isEditing ? (
|
| 579 |
+
<Select value={formData.gender.value} onValueChange={(value) => handleFieldChange("gender", value)}>
|
| 580 |
+
<SelectTrigger>
|
| 581 |
+
<SelectValue />
|
| 582 |
+
</SelectTrigger>
|
| 583 |
+
<SelectContent>
|
| 584 |
+
<SelectItem value="Male">Male</SelectItem>
|
| 585 |
+
<SelectItem value="Female">Female</SelectItem>
|
| 586 |
+
<SelectItem value="Other">Other</SelectItem>
|
| 587 |
+
</SelectContent>
|
| 588 |
+
</Select>
|
| 589 |
+
) : (
|
| 590 |
+
<p className="font-medium">{formData.gender.value}</p>
|
| 591 |
+
)}
|
| 592 |
+
</div>
|
| 593 |
+
|
| 594 |
+
<div>
|
| 595 |
+
<Label htmlFor="uhid">UHID *</Label>
|
| 596 |
+
<AutofillIndicator field={formData.uhid} />
|
| 597 |
+
{isEditing ? (
|
| 598 |
+
<Input
|
| 599 |
+
id="uhid"
|
| 600 |
+
value={formData.uhid.value}
|
| 601 |
+
onChange={(e) => handleFieldChange("uhid", e.target.value)}
|
| 602 |
+
/>
|
| 603 |
+
) : (
|
| 604 |
+
<p className="font-medium">{formData.uhid.value}</p>
|
| 605 |
+
)}
|
| 606 |
+
</div>
|
| 607 |
+
|
| 608 |
+
<div>
|
| 609 |
+
<Label htmlFor="ipdNo">IPD No. *</Label>
|
| 610 |
+
<AutofillIndicator field={formData.ipdNo} />
|
| 611 |
+
{isEditing ? (
|
| 612 |
+
<Input
|
| 613 |
+
id="ipdNo"
|
| 614 |
+
value={formData.ipdNo.value}
|
| 615 |
+
onChange={(e) => handleFieldChange("ipdNo", e.target.value)}
|
| 616 |
+
/>
|
| 617 |
+
) : (
|
| 618 |
+
<p className="font-medium">{formData.ipdNo.value}</p>
|
| 619 |
+
)}
|
| 620 |
+
</div>
|
| 621 |
+
|
| 622 |
+
<div>
|
| 623 |
+
<Label htmlFor="bedNo">Bed No. *</Label>
|
| 624 |
+
<AutofillIndicator field={formData.bedNo} />
|
| 625 |
+
{isEditing ? (
|
| 626 |
+
<Input
|
| 627 |
+
id="bedNo"
|
| 628 |
+
value={formData.bedNo.value}
|
| 629 |
+
onChange={(e) => handleFieldChange("bedNo", e.target.value)}
|
| 630 |
+
/>
|
| 631 |
+
) : (
|
| 632 |
+
<p className="font-medium">{formData.bedNo.value}</p>
|
| 633 |
+
)}
|
| 634 |
+
</div>
|
| 635 |
+
|
| 636 |
+
<div>
|
| 637 |
+
<Label htmlFor="ward">Ward *</Label>
|
| 638 |
+
<AutofillIndicator field={formData.ward} />
|
| 639 |
+
{isEditing ? (
|
| 640 |
+
<Input
|
| 641 |
+
id="ward"
|
| 642 |
+
value={formData.ward.value}
|
| 643 |
+
onChange={(e) => handleFieldChange("ward", e.target.value)}
|
| 644 |
+
/>
|
| 645 |
+
) : (
|
| 646 |
+
<p className="font-medium">{formData.ward.value}</p>
|
| 647 |
+
)}
|
| 648 |
+
</div>
|
| 649 |
+
|
| 650 |
+
<div>
|
| 651 |
+
<Label htmlFor="admissionDateTime">Admission Date/Time *</Label>
|
| 652 |
+
<AutofillIndicator field={formData.admissionDateTime} />
|
| 653 |
+
{isEditing ? (
|
| 654 |
+
<Input
|
| 655 |
+
id="admissionDateTime"
|
| 656 |
+
type="datetime-local"
|
| 657 |
+
value={formData.admissionDateTime.value}
|
| 658 |
+
onChange={(e) => handleFieldChange("admissionDateTime", e.target.value)}
|
| 659 |
+
/>
|
| 660 |
+
) : (
|
| 661 |
+
<p className="font-medium">{formData.admissionDateTime.value}</p>
|
| 662 |
+
)}
|
| 663 |
+
</div>
|
| 664 |
+
|
| 665 |
+
<div>
|
| 666 |
+
<Label htmlFor="dischargeDateTime">Discharge Date/Time *</Label>
|
| 667 |
+
<AutofillIndicator field={formData.dischargeDateTime} />
|
| 668 |
+
{isEditing ? (
|
| 669 |
+
<Input
|
| 670 |
+
id="dischargeDateTime"
|
| 671 |
+
type="datetime-local"
|
| 672 |
+
value={formData.dischargeDateTime.value}
|
| 673 |
+
onChange={(e) => handleFieldChange("dischargeDateTime", e.target.value)}
|
| 674 |
+
placeholder="dd/mm/yyyy, --:--"
|
| 675 |
+
/>
|
| 676 |
+
) : (
|
| 677 |
+
<p className="font-medium">{formData.dischargeDateTime.value || "Not set"}</p>
|
| 678 |
+
)}
|
| 679 |
+
</div>
|
| 680 |
+
|
| 681 |
+
<div>
|
| 682 |
+
<Label htmlFor="referringDoctor">Referring Doctor/Hospital</Label>
|
| 683 |
+
<AutofillIndicator field={formData.referringDoctor} />
|
| 684 |
+
{isEditing ? (
|
| 685 |
+
<Input
|
| 686 |
+
id="referringDoctor"
|
| 687 |
+
value={formData.referringDoctor.value}
|
| 688 |
+
onChange={(e) => handleFieldChange("referringDoctor", e.target.value)}
|
| 689 |
+
placeholder="Optional"
|
| 690 |
+
/>
|
| 691 |
+
) : (
|
| 692 |
+
<p className="font-medium">{formData.referringDoctor.value || "Not specified"}</p>
|
| 693 |
+
)}
|
| 694 |
+
</div>
|
| 695 |
+
|
| 696 |
+
<div>
|
| 697 |
+
<Label htmlFor="treatingConsultant">Treating Consultant *</Label>
|
| 698 |
+
<AutofillIndicator field={formData.treatingConsultant} />
|
| 699 |
+
{isEditing ? (
|
| 700 |
+
<Input
|
| 701 |
+
id="treatingConsultant"
|
| 702 |
+
value={formData.treatingConsultant.value}
|
| 703 |
+
onChange={(e) => handleFieldChange("treatingConsultant", e.target.value)}
|
| 704 |
+
/>
|
| 705 |
+
) : (
|
| 706 |
+
<p className="font-medium">{formData.treatingConsultant.value}</p>
|
| 707 |
+
)}
|
| 708 |
+
</div>
|
| 709 |
+
</CardContent>
|
| 710 |
+
</Card>
|
| 711 |
+
|
| 712 |
+
<div className="grid grid-cols-1 xl:grid-cols-2 gap-6">
|
| 713 |
+
{/* Admission Details */}
|
| 714 |
+
<Card>
|
| 715 |
+
<CardHeader>
|
| 716 |
+
<CardTitle className="flex items-center gap-2">
|
| 717 |
+
<MapPin className="w-5 h-5 text-green-600" />
|
| 718 |
+
Admission Details
|
| 719 |
+
</CardTitle>
|
| 720 |
+
</CardHeader>
|
| 721 |
+
<CardContent className="space-y-4">
|
| 722 |
+
<div>
|
| 723 |
+
<Label htmlFor="reasonForAdmission">Reason for Admission *</Label>
|
| 724 |
+
<AutofillIndicator field={formData.reasonForAdmission} />
|
| 725 |
+
{isEditing ? (
|
| 726 |
+
<Textarea
|
| 727 |
+
id="reasonForAdmission"
|
| 728 |
+
value={formData.reasonForAdmission.value}
|
| 729 |
+
onChange={(e) => handleFieldChange("reasonForAdmission", e.target.value)}
|
| 730 |
+
placeholder="Enter reason for admission..."
|
| 731 |
+
rows={2}
|
| 732 |
+
/>
|
| 733 |
+
) : (
|
| 734 |
+
<p className="text-gray-900">{formData.reasonForAdmission.value}</p>
|
| 735 |
+
)}
|
| 736 |
+
</div>
|
| 737 |
+
|
| 738 |
+
<div>
|
| 739 |
+
<Label htmlFor="presentingComplaints">Presenting Complaints *</Label>
|
| 740 |
+
<AutofillIndicator field={formData.presentingComplaints} />
|
| 741 |
+
{isEditing ? (
|
| 742 |
+
<Textarea
|
| 743 |
+
id="presentingComplaints"
|
| 744 |
+
value={formData.presentingComplaints.value}
|
| 745 |
+
onChange={(e) => handleFieldChange("presentingComplaints", e.target.value)}
|
| 746 |
+
placeholder="Enter presenting complaints..."
|
| 747 |
+
rows={3}
|
| 748 |
+
/>
|
| 749 |
+
) : (
|
| 750 |
+
<p className="text-gray-900">{formData.presentingComplaints.value}</p>
|
| 751 |
+
)}
|
| 752 |
+
</div>
|
| 753 |
+
|
| 754 |
+
<div>
|
| 755 |
+
<Label htmlFor="conditionOnAdmission">Condition on Admission *</Label>
|
| 756 |
+
<AutofillIndicator field={formData.conditionOnAdmission} />
|
| 757 |
+
{isEditing ? (
|
| 758 |
+
<Textarea
|
| 759 |
+
id="conditionOnAdmission"
|
| 760 |
+
value={formData.conditionOnAdmission.value}
|
| 761 |
+
onChange={(e) => handleFieldChange("conditionOnAdmission", e.target.value)}
|
| 762 |
+
placeholder="Enter vital signs and condition..."
|
| 763 |
+
rows={2}
|
| 764 |
+
/>
|
| 765 |
+
) : (
|
| 766 |
+
<p className="text-gray-900">{formData.conditionOnAdmission.value}</p>
|
| 767 |
+
)}
|
| 768 |
+
</div>
|
| 769 |
+
|
| 770 |
+
<div>
|
| 771 |
+
<Label htmlFor="mlcStatus">MLC Status</Label>
|
| 772 |
+
<AutofillIndicator field={formData.mlcStatus} />
|
| 773 |
+
{isEditing ? (
|
| 774 |
+
<Select
|
| 775 |
+
value={formData.mlcStatus.value}
|
| 776 |
+
onValueChange={(value) => handleFieldChange("mlcStatus", value)}
|
| 777 |
+
>
|
| 778 |
+
<SelectTrigger>
|
| 779 |
+
<SelectValue />
|
| 780 |
+
</SelectTrigger>
|
| 781 |
+
<SelectContent>
|
| 782 |
+
<SelectItem value="Yes">Yes</SelectItem>
|
| 783 |
+
<SelectItem value="No">No</SelectItem>
|
| 784 |
+
</SelectContent>
|
| 785 |
+
</Select>
|
| 786 |
+
) : (
|
| 787 |
+
<p className="font-medium">{formData.mlcStatus.value}</p>
|
| 788 |
+
)}
|
| 789 |
+
</div>
|
| 790 |
+
</CardContent>
|
| 791 |
+
</Card>
|
| 792 |
+
|
| 793 |
+
{/* Diagnosis */}
|
| 794 |
+
<Card>
|
| 795 |
+
<CardHeader>
|
| 796 |
+
<CardTitle className="flex items-center gap-2">
|
| 797 |
+
<Stethoscope className="w-5 h-5 text-purple-600" />
|
| 798 |
+
Diagnosis
|
| 799 |
+
</CardTitle>
|
| 800 |
+
</CardHeader>
|
| 801 |
+
<CardContent className="space-y-4">
|
| 802 |
+
<div>
|
| 803 |
+
<Label htmlFor="provisionalDiagnosis">Provisional Diagnosis *</Label>
|
| 804 |
+
<AutofillIndicator field={formData.provisionalDiagnosis} />
|
| 805 |
+
{isEditing ? (
|
| 806 |
+
<Input
|
| 807 |
+
id="provisionalDiagnosis"
|
| 808 |
+
value={formData.provisionalDiagnosis.value}
|
| 809 |
+
onChange={(e) => handleFieldChange("provisionalDiagnosis", e.target.value)}
|
| 810 |
+
/>
|
| 811 |
+
) : (
|
| 812 |
+
<p className="font-medium">{formData.provisionalDiagnosis.value}</p>
|
| 813 |
+
)}
|
| 814 |
+
</div>
|
| 815 |
+
|
| 816 |
+
<div>
|
| 817 |
+
<Label htmlFor="finalDiagnosis">Final Diagnosis *</Label>
|
| 818 |
+
<AutofillIndicator field={formData.finalDiagnosis} />
|
| 819 |
+
{isEditing ? (
|
| 820 |
+
<Input
|
| 821 |
+
id="finalDiagnosis"
|
| 822 |
+
value={formData.finalDiagnosis.value}
|
| 823 |
+
onChange={(e) => handleFieldChange("finalDiagnosis", e.target.value)}
|
| 824 |
+
/>
|
| 825 |
+
) : (
|
| 826 |
+
<p className="font-medium">{formData.finalDiagnosis.value}</p>
|
| 827 |
+
)}
|
| 828 |
+
</div>
|
| 829 |
+
|
| 830 |
+
<div>
|
| 831 |
+
<Label htmlFor="icdCode">ICD Code</Label>
|
| 832 |
+
<AutofillIndicator field={formData.icdCode} />
|
| 833 |
+
{isEditing ? (
|
| 834 |
+
<Input
|
| 835 |
+
id="icdCode"
|
| 836 |
+
value={formData.icdCode.value}
|
| 837 |
+
onChange={(e) => handleFieldChange("icdCode", e.target.value)}
|
| 838 |
+
placeholder="ICD-10 Code"
|
| 839 |
+
/>
|
| 840 |
+
) : (
|
| 841 |
+
<p className="font-medium">{formData.icdCode.value}</p>
|
| 842 |
+
)}
|
| 843 |
+
</div>
|
| 844 |
+
</CardContent>
|
| 845 |
+
</Card>
|
| 846 |
+
</div>
|
| 847 |
+
|
| 848 |
+
{/* Course in Hospital */}
|
| 849 |
+
<Card>
|
| 850 |
+
<CardHeader>
|
| 851 |
+
<CardTitle className="flex items-center gap-2">
|
| 852 |
+
<Activity className="w-5 h-5 text-orange-600" />
|
| 853 |
+
Course in Hospital
|
| 854 |
+
</CardTitle>
|
| 855 |
+
</CardHeader>
|
| 856 |
+
<CardContent className="space-y-4">
|
| 857 |
+
<div>
|
| 858 |
+
<Label htmlFor="chronologicalSummary">Chronological Summary *</Label>
|
| 859 |
+
<AutofillIndicator field={formData.chronologicalSummary} />
|
| 860 |
+
{isEditing ? (
|
| 861 |
+
<Textarea
|
| 862 |
+
id="chronologicalSummary"
|
| 863 |
+
value={formData.chronologicalSummary.value}
|
| 864 |
+
onChange={(e) => handleFieldChange("chronologicalSummary", e.target.value)}
|
| 865 |
+
placeholder="Day-wise summary of patient's progress..."
|
| 866 |
+
rows={6}
|
| 867 |
+
/>
|
| 868 |
+
) : (
|
| 869 |
+
<div className="whitespace-pre-line text-gray-900">{formData.chronologicalSummary.value}</div>
|
| 870 |
+
)}
|
| 871 |
+
</div>
|
| 872 |
+
|
| 873 |
+
<div>
|
| 874 |
+
<Label htmlFor="complications">Complications</Label>
|
| 875 |
+
<AutofillIndicator field={formData.complications} />
|
| 876 |
+
{isEditing ? (
|
| 877 |
+
<Textarea
|
| 878 |
+
id="complications"
|
| 879 |
+
value={formData.complications.value}
|
| 880 |
+
onChange={(e) => handleFieldChange("complications", e.target.value)}
|
| 881 |
+
placeholder="Any complications during stay..."
|
| 882 |
+
rows={2}
|
| 883 |
+
/>
|
| 884 |
+
) : (
|
| 885 |
+
<p className="text-gray-900">{formData.complications.value}</p>
|
| 886 |
+
)}
|
| 887 |
+
</div>
|
| 888 |
+
</CardContent>
|
| 889 |
+
</Card>
|
| 890 |
+
|
| 891 |
+
{/* Investigations */}
|
| 892 |
+
<Card>
|
| 893 |
+
<CardHeader>
|
| 894 |
+
<CardTitle className="flex items-center gap-2">
|
| 895 |
+
<TestTube className="w-5 h-5 text-red-600" />
|
| 896 |
+
Investigations
|
| 897 |
+
</CardTitle>
|
| 898 |
+
</CardHeader>
|
| 899 |
+
<CardContent className="space-y-4">
|
| 900 |
+
<div>
|
| 901 |
+
<Label htmlFor="labSummary">Lab Summary</Label>
|
| 902 |
+
<AutofillIndicator field={formData.labSummary} />
|
| 903 |
+
{isEditing ? (
|
| 904 |
+
<Textarea
|
| 905 |
+
id="labSummary"
|
| 906 |
+
value={formData.labSummary.value}
|
| 907 |
+
onChange={(e) => handleFieldChange("labSummary", e.target.value)}
|
| 908 |
+
placeholder="Laboratory investigation results..."
|
| 909 |
+
rows={3}
|
| 910 |
+
/>
|
| 911 |
+
) : (
|
| 912 |
+
<p className="text-gray-900">{formData.labSummary.value}</p>
|
| 913 |
+
)}
|
| 914 |
+
</div>
|
| 915 |
+
|
| 916 |
+
<div>
|
| 917 |
+
<Label htmlFor="imagingFindings">Imaging Findings</Label>
|
| 918 |
+
<AutofillIndicator field={formData.imagingFindings} />
|
| 919 |
+
{isEditing ? (
|
| 920 |
+
<Textarea
|
| 921 |
+
id="imagingFindings"
|
| 922 |
+
value={formData.imagingFindings.value}
|
| 923 |
+
onChange={(e) => handleFieldChange("imagingFindings", e.target.value)}
|
| 924 |
+
placeholder="Radiology and imaging results..."
|
| 925 |
+
rows={3}
|
| 926 |
+
/>
|
| 927 |
+
) : (
|
| 928 |
+
<p className="text-gray-900">{formData.imagingFindings.value}</p>
|
| 929 |
+
)}
|
| 930 |
+
</div>
|
| 931 |
+
|
| 932 |
+
<div>
|
| 933 |
+
<Label htmlFor="abnormalResults">Abnormal Results</Label>
|
| 934 |
+
<AutofillIndicator field={formData.abnormalResults} />
|
| 935 |
+
{isEditing ? (
|
| 936 |
+
<Textarea
|
| 937 |
+
id="abnormalResults"
|
| 938 |
+
value={formData.abnormalResults.value}
|
| 939 |
+
onChange={(e) => handleFieldChange("abnormalResults", e.target.value)}
|
| 940 |
+
placeholder="Key abnormal findings..."
|
| 941 |
+
rows={2}
|
| 942 |
+
/>
|
| 943 |
+
) : (
|
| 944 |
+
<p className="text-gray-900">{formData.abnormalResults.value}</p>
|
| 945 |
+
)}
|
| 946 |
+
</div>
|
| 947 |
+
</CardContent>
|
| 948 |
+
</Card>
|
| 949 |
+
|
| 950 |
+
{/* Treatment Given */}
|
| 951 |
+
<Card>
|
| 952 |
+
<CardHeader>
|
| 953 |
+
<CardTitle className="flex items-center gap-2">
|
| 954 |
+
<Pill className="w-5 h-5 text-indigo-600" />
|
| 955 |
+
Treatment Given
|
| 956 |
+
</CardTitle>
|
| 957 |
+
</CardHeader>
|
| 958 |
+
<CardContent className="space-y-4">
|
| 959 |
+
<div>
|
| 960 |
+
<Label htmlFor="ivFluidsInjections">IV Fluids, Injections, Transfusions</Label>
|
| 961 |
+
<AutofillIndicator field={formData.ivFluidsInjections} />
|
| 962 |
+
{isEditing ? (
|
| 963 |
+
<Textarea
|
| 964 |
+
id="ivFluidsInjections"
|
| 965 |
+
value={formData.ivFluidsInjections.value}
|
| 966 |
+
onChange={(e) => handleFieldChange("ivFluidsInjections", e.target.value)}
|
| 967 |
+
placeholder="IV fluids and injections given..."
|
| 968 |
+
rows={2}
|
| 969 |
+
/>
|
| 970 |
+
) : (
|
| 971 |
+
<p className="text-gray-900">{formData.ivFluidsInjections.value}</p>
|
| 972 |
+
)}
|
| 973 |
+
</div>
|
| 974 |
+
|
| 975 |
+
<div>
|
| 976 |
+
<Label htmlFor="medicationsDuringStay">Medications during Stay *</Label>
|
| 977 |
+
<AutofillIndicator field={formData.medicationsDuringStay} />
|
| 978 |
+
{isEditing ? (
|
| 979 |
+
<Textarea
|
| 980 |
+
id="medicationsDuringStay"
|
| 981 |
+
value={formData.medicationsDuringStay.value}
|
| 982 |
+
onChange={(e) => handleFieldChange("medicationsDuringStay", e.target.value)}
|
| 983 |
+
placeholder="Medications administered during stay..."
|
| 984 |
+
rows={3}
|
| 985 |
+
/>
|
| 986 |
+
) : (
|
| 987 |
+
<p className="text-gray-900">{formData.medicationsDuringStay.value}</p>
|
| 988 |
+
)}
|
| 989 |
+
</div>
|
| 990 |
+
|
| 991 |
+
<div>
|
| 992 |
+
<Label htmlFor="supportiveTherapies">Supportive Therapies</Label>
|
| 993 |
+
<AutofillIndicator field={formData.supportiveTherapies} />
|
| 994 |
+
{isEditing ? (
|
| 995 |
+
<Textarea
|
| 996 |
+
id="supportiveTherapies"
|
| 997 |
+
value={formData.supportiveTherapies.value}
|
| 998 |
+
onChange={(e) => handleFieldChange("supportiveTherapies", e.target.value)}
|
| 999 |
+
placeholder="Physiotherapy, dialysis, etc..."
|
| 1000 |
+
rows={2}
|
| 1001 |
+
/>
|
| 1002 |
+
) : (
|
| 1003 |
+
<p className="text-gray-900">{formData.supportiveTherapies.value}</p>
|
| 1004 |
+
)}
|
| 1005 |
+
</div>
|
| 1006 |
+
</CardContent>
|
| 1007 |
+
</Card>
|
| 1008 |
+
|
| 1009 |
+
{/* Procedures/Surgeries */}
|
| 1010 |
+
<Card>
|
| 1011 |
+
<CardHeader>
|
| 1012 |
+
<CardTitle className="flex items-center justify-between">
|
| 1013 |
+
<div className="flex items-center gap-2">
|
| 1014 |
+
<FileText className="w-5 h-5 text-teal-600" />
|
| 1015 |
+
Procedures / Surgeries
|
| 1016 |
+
</div>
|
| 1017 |
+
<div className="flex items-center space-x-2">
|
| 1018 |
+
<Checkbox id="showProcedures" checked={showProcedures} onCheckedChange={setShowProcedures} />
|
| 1019 |
+
<Label htmlFor="showProcedures" className="text-sm">
|
| 1020 |
+
Patient had procedures/surgeries
|
| 1021 |
+
</Label>
|
| 1022 |
+
</div>
|
| 1023 |
+
</CardTitle>
|
| 1024 |
+
</CardHeader>
|
| 1025 |
+
{showProcedures && (
|
| 1026 |
+
<CardContent className="space-y-4">
|
| 1027 |
+
<div className="grid grid-cols-1 md:grid-cols-2 gap-4">
|
| 1028 |
+
<div>
|
| 1029 |
+
<Label htmlFor="procedureName">Procedure Name</Label>
|
| 1030 |
+
<AutofillIndicator field={formData.procedureName} />
|
| 1031 |
+
{isEditing ? (
|
| 1032 |
+
<Input
|
| 1033 |
+
id="procedureName"
|
| 1034 |
+
value={formData.procedureName.value}
|
| 1035 |
+
onChange={(e) => handleFieldChange("procedureName", e.target.value)}
|
| 1036 |
+
placeholder="Name of procedure"
|
| 1037 |
+
/>
|
| 1038 |
+
) : (
|
| 1039 |
+
<p className="font-medium">{formData.procedureName.value}</p>
|
| 1040 |
+
)}
|
| 1041 |
+
</div>
|
| 1042 |
+
|
| 1043 |
+
<div>
|
| 1044 |
+
<Label htmlFor="procedureIndication">Indication</Label>
|
| 1045 |
+
<AutofillIndicator field={formData.procedureIndication} />
|
| 1046 |
+
{isEditing ? (
|
| 1047 |
+
<Input
|
| 1048 |
+
id="procedureIndication"
|
| 1049 |
+
value={formData.procedureIndication.value}
|
| 1050 |
+
onChange={(e) => handleFieldChange("procedureIndication", e.target.value)}
|
| 1051 |
+
placeholder="Indication for procedure"
|
| 1052 |
+
/>
|
| 1053 |
+
) : (
|
| 1054 |
+
<p className="font-medium">{formData.procedureIndication.value}</p>
|
| 1055 |
+
)}
|
| 1056 |
+
</div>
|
| 1057 |
+
</div>
|
| 1058 |
+
|
| 1059 |
+
<div>
|
| 1060 |
+
<Label htmlFor="operativeFindings">Operative Findings</Label>
|
| 1061 |
+
<AutofillIndicator field={formData.operativeFindings} />
|
| 1062 |
+
{isEditing ? (
|
| 1063 |
+
<Textarea
|
| 1064 |
+
id="operativeFindings"
|
| 1065 |
+
value={formData.operativeFindings.value}
|
| 1066 |
+
onChange={(e) => handleFieldChange("operativeFindings", e.target.value)}
|
| 1067 |
+
placeholder="Operative findings..."
|
| 1068 |
+
rows={2}
|
| 1069 |
+
/>
|
| 1070 |
+
) : (
|
| 1071 |
+
<p className="text-gray-900">{formData.operativeFindings.value}</p>
|
| 1072 |
+
)}
|
| 1073 |
+
</div>
|
| 1074 |
+
|
| 1075 |
+
<div>
|
| 1076 |
+
<Label htmlFor="procedureSteps">Procedure Steps</Label>
|
| 1077 |
+
<AutofillIndicator field={formData.procedureSteps} />
|
| 1078 |
+
{isEditing ? (
|
| 1079 |
+
<Textarea
|
| 1080 |
+
id="procedureSteps"
|
| 1081 |
+
value={formData.procedureSteps.value}
|
| 1082 |
+
onChange={(e) => handleFieldChange("procedureSteps", e.target.value)}
|
| 1083 |
+
placeholder="Detailed procedure steps..."
|
| 1084 |
+
rows={2}
|
| 1085 |
+
/>
|
| 1086 |
+
) : (
|
| 1087 |
+
<p className="text-gray-900">{formData.procedureSteps.value}</p>
|
| 1088 |
+
)}
|
| 1089 |
+
</div>
|
| 1090 |
+
|
| 1091 |
+
<div>
|
| 1092 |
+
<Label htmlFor="procedureOutcome">Outcome</Label>
|
| 1093 |
+
<AutofillIndicator field={formData.procedureOutcome} />
|
| 1094 |
+
{isEditing ? (
|
| 1095 |
+
<Textarea
|
| 1096 |
+
id="procedureOutcome"
|
| 1097 |
+
value={formData.procedureOutcome.value}
|
| 1098 |
+
onChange={(e) => handleFieldChange("procedureOutcome", e.target.value)}
|
| 1099 |
+
placeholder="Procedure outcome..."
|
| 1100 |
+
rows={2}
|
| 1101 |
+
/>
|
| 1102 |
+
) : (
|
| 1103 |
+
<p className="text-gray-900">{formData.procedureOutcome.value}</p>
|
| 1104 |
+
)}
|
| 1105 |
+
</div>
|
| 1106 |
+
|
| 1107 |
+
<div className="grid grid-cols-1 md:grid-cols-2 gap-4">
|
| 1108 |
+
<div>
|
| 1109 |
+
<Label htmlFor="surgeon">Surgeon</Label>
|
| 1110 |
+
<AutofillIndicator field={formData.surgeon} />
|
| 1111 |
+
{isEditing ? (
|
| 1112 |
+
<Input
|
| 1113 |
+
id="surgeon"
|
| 1114 |
+
value={formData.surgeon.value}
|
| 1115 |
+
onChange={(e) => handleFieldChange("surgeon", e.target.value)}
|
| 1116 |
+
placeholder="Surgeon name"
|
| 1117 |
+
/>
|
| 1118 |
+
) : (
|
| 1119 |
+
<p className="font-medium">{formData.surgeon.value}</p>
|
| 1120 |
+
)}
|
| 1121 |
+
</div>
|
| 1122 |
+
|
| 1123 |
+
<div>
|
| 1124 |
+
<Label htmlFor="anesthetist">Anesthetist</Label>
|
| 1125 |
+
<AutofillIndicator field={formData.anesthetist} />
|
| 1126 |
+
{isEditing ? (
|
| 1127 |
+
<Input
|
| 1128 |
+
id="anesthetist"
|
| 1129 |
+
value={formData.anesthetist.value}
|
| 1130 |
+
onChange={(e) => handleFieldChange("anesthetist", e.target.value)}
|
| 1131 |
+
placeholder="Anesthetist name or type"
|
| 1132 |
+
/>
|
| 1133 |
+
) : (
|
| 1134 |
+
<p className="font-medium">{formData.anesthetist.value}</p>
|
| 1135 |
+
)}
|
| 1136 |
+
</div>
|
| 1137 |
+
</div>
|
| 1138 |
+
</CardContent>
|
| 1139 |
+
)}
|
| 1140 |
+
</Card>
|
| 1141 |
+
|
| 1142 |
+
{/* Discharge Condition */}
|
| 1143 |
+
<Card>
|
| 1144 |
+
<CardHeader>
|
| 1145 |
+
<CardTitle className="flex items-center gap-2">
|
| 1146 |
+
<Activity className="w-5 h-5 text-green-600" />
|
| 1147 |
+
Discharge Condition
|
| 1148 |
+
</CardTitle>
|
| 1149 |
+
</CardHeader>
|
| 1150 |
+
<CardContent className="space-y-4">
|
| 1151 |
+
<div>
|
| 1152 |
+
<Label htmlFor="dischargeVitals">Patient Vitals *</Label>
|
| 1153 |
+
<AutofillIndicator field={formData.dischargeVitals} />
|
| 1154 |
+
{isEditing ? (
|
| 1155 |
+
<Textarea
|
| 1156 |
+
id="dischargeVitals"
|
| 1157 |
+
value={formData.dischargeVitals.value}
|
| 1158 |
+
onChange={(e) => handleFieldChange("dischargeVitals", e.target.value)}
|
| 1159 |
+
placeholder="Vital signs at discharge..."
|
| 1160 |
+
rows={2}
|
| 1161 |
+
/>
|
| 1162 |
+
) : (
|
| 1163 |
+
<p className="text-gray-900">{formData.dischargeVitals.value}</p>
|
| 1164 |
+
)}
|
| 1165 |
+
</div>
|
| 1166 |
+
|
| 1167 |
+
<div>
|
| 1168 |
+
<Label htmlFor="clinicalStatus">Clinical Status *</Label>
|
| 1169 |
+
<AutofillIndicator field={formData.clinicalStatus} />
|
| 1170 |
+
{isEditing ? (
|
| 1171 |
+
<Textarea
|
| 1172 |
+
id="clinicalStatus"
|
| 1173 |
+
value={formData.clinicalStatus.value}
|
| 1174 |
+
onChange={(e) => handleFieldChange("clinicalStatus", e.target.value)}
|
| 1175 |
+
placeholder="Clinical status at discharge..."
|
| 1176 |
+
rows={2}
|
| 1177 |
+
/>
|
| 1178 |
+
) : (
|
| 1179 |
+
<p className="text-gray-900">{formData.clinicalStatus.value}</p>
|
| 1180 |
+
)}
|
| 1181 |
+
</div>
|
| 1182 |
+
|
| 1183 |
+
<div>
|
| 1184 |
+
<Label htmlFor="comparedToAdmission">Compared to Admission</Label>
|
| 1185 |
+
<AutofillIndicator field={formData.comparedToAdmission} />
|
| 1186 |
+
{isEditing ? (
|
| 1187 |
+
<Textarea
|
| 1188 |
+
id="comparedToAdmission"
|
| 1189 |
+
value={formData.comparedToAdmission.value}
|
| 1190 |
+
onChange={(e) => handleFieldChange("comparedToAdmission", e.target.value)}
|
| 1191 |
+
placeholder="Improvement/changes since admission..."
|
| 1192 |
+
rows={2}
|
| 1193 |
+
/>
|
| 1194 |
+
) : (
|
| 1195 |
+
<p className="text-gray-900">{formData.comparedToAdmission.value}</p>
|
| 1196 |
+
)}
|
| 1197 |
+
</div>
|
| 1198 |
+
</CardContent>
|
| 1199 |
+
</Card>
|
| 1200 |
+
|
| 1201 |
+
{/* Discharge Medications */}
|
| 1202 |
+
<Card>
|
| 1203 |
+
<CardHeader>
|
| 1204 |
+
<CardTitle className="flex items-center gap-2">
|
| 1205 |
+
<Pill className="w-5 h-5 text-blue-600" />
|
| 1206 |
+
Discharge Medications
|
| 1207 |
+
</CardTitle>
|
| 1208 |
+
</CardHeader>
|
| 1209 |
+
<CardContent>
|
| 1210 |
+
<div>
|
| 1211 |
+
<Label htmlFor="dischargeMedications">Medications *</Label>
|
| 1212 |
+
<AutofillIndicator field={formData.dischargeMedications} />
|
| 1213 |
+
{isEditing ? (
|
| 1214 |
+
<Textarea
|
| 1215 |
+
id="dischargeMedications"
|
| 1216 |
+
value={formData.dischargeMedications.value}
|
| 1217 |
+
onChange={(e) => handleFieldChange("dischargeMedications", e.target.value)}
|
| 1218 |
+
placeholder="Medications prescribed at discharge..."
|
| 1219 |
+
rows={5}
|
| 1220 |
+
/>
|
| 1221 |
+
) : (
|
| 1222 |
+
<div className="whitespace-pre-line text-gray-900">{formData.dischargeMedications.value}</div>
|
| 1223 |
+
)}
|
| 1224 |
+
</div>
|
| 1225 |
+
</CardContent>
|
| 1226 |
+
</Card>
|
| 1227 |
+
|
| 1228 |
+
{/* Discharge Advice */}
|
| 1229 |
+
<Card>
|
| 1230 |
+
<CardHeader>
|
| 1231 |
+
<CardTitle className="flex items-center gap-2">
|
| 1232 |
+
<FileText className="w-5 h-5 text-amber-600" />
|
| 1233 |
+
Discharge Advice
|
| 1234 |
+
</CardTitle>
|
| 1235 |
+
</CardHeader>
|
| 1236 |
+
<CardContent className="space-y-4">
|
| 1237 |
+
<div>
|
| 1238 |
+
<Label htmlFor="diet">Diet</Label>
|
| 1239 |
+
<AutofillIndicator field={formData.diet} />
|
| 1240 |
+
{isEditing ? (
|
| 1241 |
+
<Textarea
|
| 1242 |
+
id="diet"
|
| 1243 |
+
value={formData.diet.value}
|
| 1244 |
+
onChange={(e) => handleFieldChange("diet", e.target.value)}
|
| 1245 |
+
placeholder="Dietary recommendations..."
|
| 1246 |
+
rows={2}
|
| 1247 |
+
/>
|
| 1248 |
+
) : (
|
| 1249 |
+
<p className="text-gray-900">{formData.diet.value}</p>
|
| 1250 |
+
)}
|
| 1251 |
+
</div>
|
| 1252 |
+
|
| 1253 |
+
<div>
|
| 1254 |
+
<Label htmlFor="activity">Activity</Label>
|
| 1255 |
+
<AutofillIndicator field={formData.activity} />
|
| 1256 |
+
{isEditing ? (
|
| 1257 |
+
<Textarea
|
| 1258 |
+
id="activity"
|
| 1259 |
+
value={formData.activity.value}
|
| 1260 |
+
onChange={(e) => handleFieldChange("activity", e.target.value)}
|
| 1261 |
+
placeholder="Activity recommendations..."
|
| 1262 |
+
rows={2}
|
| 1263 |
+
/>
|
| 1264 |
+
) : (
|
| 1265 |
+
<p className="text-gray-900">{formData.activity.value}</p>
|
| 1266 |
+
)}
|
| 1267 |
+
</div>
|
| 1268 |
+
|
| 1269 |
+
<div>
|
| 1270 |
+
<Label htmlFor="warningSigns">Warning Signs *</Label>
|
| 1271 |
+
<AutofillIndicator field={formData.warningSigns} />
|
| 1272 |
+
{isEditing ? (
|
| 1273 |
+
<Textarea
|
| 1274 |
+
id="warningSigns"
|
| 1275 |
+
value={formData.warningSigns.value}
|
| 1276 |
+
onChange={(e) => handleFieldChange("warningSigns", e.target.value)}
|
| 1277 |
+
placeholder="Warning signs to watch for..."
|
| 1278 |
+
rows={2}
|
| 1279 |
+
/>
|
| 1280 |
+
) : (
|
| 1281 |
+
<p className="text-gray-900">{formData.warningSigns.value}</p>
|
| 1282 |
+
)}
|
| 1283 |
+
</div>
|
| 1284 |
+
</CardContent>
|
| 1285 |
+
</Card>
|
| 1286 |
+
|
| 1287 |
+
{/* Follow-up */}
|
| 1288 |
+
<Card>
|
| 1289 |
+
<CardHeader>
|
| 1290 |
+
<CardTitle className="flex items-center gap-2">
|
| 1291 |
+
<Calendar className="w-5 h-5 text-purple-600" />
|
| 1292 |
+
Follow-up
|
| 1293 |
+
</CardTitle>
|
| 1294 |
+
</CardHeader>
|
| 1295 |
+
<CardContent className="grid grid-cols-1 md:grid-cols-3 gap-4">
|
| 1296 |
+
<div>
|
| 1297 |
+
<Label htmlFor="followUpDate">Date *</Label>
|
| 1298 |
+
<AutofillIndicator field={formData.followUpDate} />
|
| 1299 |
+
{isEditing ? (
|
| 1300 |
+
<Input
|
| 1301 |
+
id="followUpDate"
|
| 1302 |
+
value={formData.followUpDate.value}
|
| 1303 |
+
onChange={(e) => handleFieldChange("followUpDate", e.target.value)}
|
| 1304 |
+
placeholder="DD/MM/YYYY"
|
| 1305 |
+
/>
|
| 1306 |
+
) : (
|
| 1307 |
+
<p className="font-medium">{formData.followUpDate.value}</p>
|
| 1308 |
+
)}
|
| 1309 |
+
</div>
|
| 1310 |
+
|
| 1311 |
+
<div>
|
| 1312 |
+
<Label htmlFor="followUpDept">Department *</Label>
|
| 1313 |
+
<AutofillIndicator field={formData.followUpDept} />
|
| 1314 |
+
{isEditing ? (
|
| 1315 |
+
<Input
|
| 1316 |
+
id="followUpDept"
|
| 1317 |
+
value={formData.followUpDept.value}
|
| 1318 |
+
onChange={(e) => handleFieldChange("followUpDept", e.target.value)}
|
| 1319 |
+
/>
|
| 1320 |
+
) : (
|
| 1321 |
+
<p className="font-medium">{formData.followUpDept.value}</p>
|
| 1322 |
+
)}
|
| 1323 |
+
</div>
|
| 1324 |
+
|
| 1325 |
+
<div>
|
| 1326 |
+
<Label htmlFor="followUpDoctor">Doctor *</Label>
|
| 1327 |
+
<AutofillIndicator field={formData.followUpDoctor} />
|
| 1328 |
+
{isEditing ? (
|
| 1329 |
+
<Input
|
| 1330 |
+
id="followUpDoctor"
|
| 1331 |
+
value={formData.followUpDoctor.value}
|
| 1332 |
+
onChange={(e) => handleFieldChange("followUpDoctor", e.target.value)}
|
| 1333 |
+
/>
|
| 1334 |
+
) : (
|
| 1335 |
+
<p className="font-medium">{formData.followUpDoctor.value}</p>
|
| 1336 |
+
)}
|
| 1337 |
+
</div>
|
| 1338 |
+
</CardContent>
|
| 1339 |
+
</Card>
|
| 1340 |
+
|
| 1341 |
+
{/* Patient/Relative Acknowledgement */}
|
| 1342 |
+
<Card>
|
| 1343 |
+
<CardHeader>
|
| 1344 |
+
<CardTitle className="flex items-center gap-2">
|
| 1345 |
+
<User className="w-5 h-5 text-gray-600" />
|
| 1346 |
+
Patient/Relative Acknowledgement
|
| 1347 |
+
</CardTitle>
|
| 1348 |
+
</CardHeader>
|
| 1349 |
+
<CardContent className="space-y-4">
|
| 1350 |
+
<div>
|
| 1351 |
+
<Label htmlFor="acknowledgement">Acknowledgement</Label>
|
| 1352 |
+
<AutofillIndicator field={formData.acknowledgement} />
|
| 1353 |
+
{isEditing ? (
|
| 1354 |
+
<Textarea
|
| 1355 |
+
id="acknowledgement"
|
| 1356 |
+
value={formData.acknowledgement.value}
|
| 1357 |
+
onChange={(e) => handleFieldChange("acknowledgement", e.target.value)}
|
| 1358 |
+
placeholder="Patient/relative acknowledgement..."
|
| 1359 |
+
rows={2}
|
| 1360 |
+
/>
|
| 1361 |
+
) : (
|
| 1362 |
+
<p className="text-gray-900">{formData.acknowledgement.value}</p>
|
| 1363 |
+
)}
|
| 1364 |
+
</div>
|
| 1365 |
+
|
| 1366 |
+
<div>
|
| 1367 |
+
<Label htmlFor="additionalNotes">Additional Notes</Label>
|
| 1368 |
+
<AutofillIndicator field={formData.additionalNotes} />
|
| 1369 |
+
{isEditing ? (
|
| 1370 |
+
<Textarea
|
| 1371 |
+
id="additionalNotes"
|
| 1372 |
+
value={formData.additionalNotes.value}
|
| 1373 |
+
onChange={(e) => handleFieldChange("additionalNotes", e.target.value)}
|
| 1374 |
+
placeholder="Additional notes..."
|
| 1375 |
+
rows={3}
|
| 1376 |
+
/>
|
| 1377 |
+
) : (
|
| 1378 |
+
<p className="text-gray-900">{formData.additionalNotes.value}</p>
|
| 1379 |
+
)}
|
| 1380 |
+
</div>
|
| 1381 |
+
</CardContent>
|
| 1382 |
+
</Card>
|
| 1383 |
+
|
| 1384 |
+
{/* Attachments */}
|
| 1385 |
+
<Card>
|
| 1386 |
+
<CardHeader>
|
| 1387 |
+
<CardTitle className="flex items-center gap-2">
|
| 1388 |
+
<Upload className="w-5 h-5 text-indigo-600" />
|
| 1389 |
+
Attachments (Optional)
|
| 1390 |
+
</CardTitle>
|
| 1391 |
+
</CardHeader>
|
| 1392 |
+
<CardContent>
|
| 1393 |
+
<div className="border-2 border-dashed border-gray-300 rounded-lg p-6 text-center">
|
| 1394 |
+
<Upload className="w-8 h-8 text-gray-400 mx-auto mb-2" />
|
| 1395 |
+
<p className="text-sm text-gray-600 mb-2">Upload slots for Lab Reports, Imaging, OT Notes, etc.</p>
|
| 1396 |
+
<p className="text-xs text-gray-500 mb-4">Inline reference text to note which reports are attached</p>
|
| 1397 |
+
<Button variant="outline" disabled={!isEditing}>
|
| 1398 |
+
Choose Files
|
| 1399 |
+
</Button>
|
| 1400 |
+
</div>
|
| 1401 |
+
</CardContent>
|
| 1402 |
+
</Card>
|
| 1403 |
+
|
| 1404 |
+
{/* Consultant and Author Info */}
|
| 1405 |
+
<Card>
|
| 1406 |
+
<CardHeader>
|
| 1407 |
+
<CardTitle className="flex items-center gap-2">
|
| 1408 |
+
<User className="w-5 h-5 text-gray-500" />
|
| 1409 |
+
Consultant and Author Info
|
| 1410 |
+
</CardTitle>
|
| 1411 |
+
</CardHeader>
|
| 1412 |
+
<CardContent className="grid grid-cols-1 md:grid-cols-3 gap-4 text-sm">
|
| 1413 |
+
<div>
|
| 1414 |
+
<Label className="text-gray-500">Consultant Name</Label>
|
| 1415 |
+
<p className="font-medium text-gray-900">{currentUser.name}</p>
|
| 1416 |
+
</div>
|
| 1417 |
+
<div>
|
| 1418 |
+
<Label className="text-gray-500">M.O./M.T. name</Label>
|
| 1419 |
+
<p className="font-medium text-gray-900">M.O. - Dr. Smith</p>
|
| 1420 |
+
</div>
|
| 1421 |
+
<div>
|
| 1422 |
+
<Label className="text-gray-500">Status</Label>
|
| 1423 |
+
<Badge variant={isFinalized ? "default" : "secondary"} className="w-fit">
|
| 1424 |
+
{isFinalized ? "Final" : "Draft"}
|
| 1425 |
+
</Badge>
|
| 1426 |
+
</div>
|
| 1427 |
+
<div>
|
| 1428 |
+
<Label className="text-gray-500">Created on</Label>
|
| 1429 |
+
<p className="font-medium text-gray-900">{new Date().toLocaleDateString()}</p>
|
| 1430 |
+
</div>
|
| 1431 |
+
<div>
|
| 1432 |
+
<Label className="text-gray-500">Last modified</Label>
|
| 1433 |
+
<p className="font-medium text-gray-900">{new Date().toLocaleDateString()}</p>
|
| 1434 |
+
</div>
|
| 1435 |
+
<div>
|
| 1436 |
+
<Label className="text-gray-500">Auto-timestamp signature</Label>
|
| 1437 |
+
<p className="font-medium text-gray-900">{new Date().toLocaleTimeString()}</p>
|
| 1438 |
+
</div>
|
| 1439 |
+
</CardContent>
|
| 1440 |
+
</Card>
|
| 1441 |
+
</div>
|
| 1442 |
+
|
| 1443 |
+
{/* Action Buttons */}
|
| 1444 |
+
<div className="flex justify-between items-center pt-6 border-t">
|
| 1445 |
+
<div className="text-sm text-gray-600">* Required fields must be completed before finalizing</div>
|
| 1446 |
+
<div className="flex gap-2">
|
| 1447 |
+
{isEditing && !isFinalized && (
|
| 1448 |
+
<>
|
| 1449 |
+
<Button variant="outline" onClick={handleSave}>
|
| 1450 |
+
<Save className="w-4 h-4 mr-2" />
|
| 1451 |
+
Save Draft
|
| 1452 |
+
</Button>
|
| 1453 |
+
<Button onClick={handleFinalize} className="bg-green-600 hover:bg-green-700">
|
| 1454 |
+
<CheckCircle className="w-4 h-4 mr-2" />
|
| 1455 |
+
Finalize Summary
|
| 1456 |
+
</Button>
|
| 1457 |
+
</>
|
| 1458 |
+
)}
|
| 1459 |
+
</div>
|
| 1460 |
+
</div>
|
| 1461 |
+
</div>
|
| 1462 |
+
)
|
| 1463 |
+
}
|
ipdmodule/components/discharge-summary.tsx
ADDED
|
@@ -0,0 +1,276 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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Title } from "@/components/ui/card"
|
| 6 |
+
import { Input } from "@/components/ui/input"
|
| 7 |
+
import { Label } from "@/components/ui/label"
|
| 8 |
+
import { RichTextEditor } from "./rich-text-editor"
|
| 9 |
+
import { User, Home, Save, Printer } from "lucide-react"
|
| 10 |
+
|
| 11 |
+
interface DischargeSummaryProps {
|
| 12 |
+
patient: any
|
| 13 |
+
}
|
| 14 |
+
|
| 15 |
+
export function DischargeSummary({ patient }: DischargeSummaryProps) {
|
| 16 |
+
const [summaryData, setSummaryData] = useState({
|
| 17 |
+
admissionDate: "",
|
| 18 |
+
dischargeDate: new Date().toISOString().split("T")[0],
|
| 19 |
+
lengthOfStay: "",
|
| 20 |
+
admissionDiagnosis: "",
|
| 21 |
+
finalDiagnosis: "",
|
| 22 |
+
clinicalSummary: "",
|
| 23 |
+
hospitalCourse: "",
|
| 24 |
+
proceduresPerformed: "",
|
| 25 |
+
investigations: "",
|
| 26 |
+
treatmentGiven: "",
|
| 27 |
+
conditionAtDischarge: "",
|
| 28 |
+
dischargeMedications: "",
|
| 29 |
+
followUpInstructions: "",
|
| 30 |
+
dietaryAdvice: "",
|
| 31 |
+
activityRestrictions: "",
|
| 32 |
+
warningSignsToReturn: "",
|
| 33 |
+
followUpAppointments: "",
|
| 34 |
+
})
|
| 35 |
+
|
| 36 |
+
const handleInputChange = (field: string, value: string) => {
|
| 37 |
+
setSummaryData((prev) => ({ ...prev, [field]: value }))
|
| 38 |
+
}
|
| 39 |
+
|
| 40 |
+
return (
|
| 41 |
+
<div className="space-y-6">
|
| 42 |
+
{/* Header */}
|
| 43 |
+
<div className="flex items-center justify-between">
|
| 44 |
+
<div>
|
| 45 |
+
<h2 className="text-xl font-semibold">Discharge Summary</h2>
|
| 46 |
+
<p className="text-sm text-gray-600">Comprehensive discharge documentation for {patient.name}</p>
|
| 47 |
+
</div>
|
| 48 |
+
<div className="flex gap-2">
|
| 49 |
+
<Button variant="outline" className="gap-2 bg-transparent">
|
| 50 |
+
<Printer className="w-4 h-4" />
|
| 51 |
+
Print
|
| 52 |
+
</Button>
|
| 53 |
+
<Button className="gap-2">
|
| 54 |
+
<Save className="w-4 h-4" />
|
| 55 |
+
Save Summary
|
| 56 |
+
</Button>
|
| 57 |
+
</div>
|
| 58 |
+
</div>
|
| 59 |
+
|
| 60 |
+
{/* Patient Information */}
|
| 61 |
+
<Card>
|
| 62 |
+
<CardHeader>
|
| 63 |
+
<CardTitle className="flex items-center gap-2">
|
| 64 |
+
<User className="w-5 h-5" />
|
| 65 |
+
Patient Information
|
| 66 |
+
</CardTitle>
|
| 67 |
+
</CardHeader>
|
| 68 |
+
<CardContent>
|
| 69 |
+
<div className="grid grid-cols-1 md:grid-cols-3 gap-4">
|
| 70 |
+
<div>
|
| 71 |
+
<Label>Admission Date</Label>
|
| 72 |
+
<Input
|
| 73 |
+
type="date"
|
| 74 |
+
value={summaryData.admissionDate}
|
| 75 |
+
onChange={(e) => handleInputChange("admissionDate", e.target.value)}
|
| 76 |
+
/>
|
| 77 |
+
</div>
|
| 78 |
+
<div>
|
| 79 |
+
<Label>Discharge Date</Label>
|
| 80 |
+
<Input
|
| 81 |
+
type="date"
|
| 82 |
+
value={summaryData.dischargeDate}
|
| 83 |
+
onChange={(e) => handleInputChange("dischargeDate", e.target.value)}
|
| 84 |
+
/>
|
| 85 |
+
</div>
|
| 86 |
+
<div>
|
| 87 |
+
<Label>Length of Stay (days)</Label>
|
| 88 |
+
<Input
|
| 89 |
+
type="number"
|
| 90 |
+
value={summaryData.lengthOfStay}
|
| 91 |
+
onChange={(e) => handleInputChange("lengthOfStay", e.target.value)}
|
| 92 |
+
placeholder="5"
|
| 93 |
+
/>
|
| 94 |
+
</div>
|
| 95 |
+
</div>
|
| 96 |
+
</CardContent>
|
| 97 |
+
</Card>
|
| 98 |
+
|
| 99 |
+
{/* Clinical Information */}
|
| 100 |
+
<Card>
|
| 101 |
+
<CardHeader>
|
| 102 |
+
<CardTitle>Clinical Information</CardTitle>
|
| 103 |
+
</CardHeader>
|
| 104 |
+
<CardContent className="space-y-6">
|
| 105 |
+
<div>
|
| 106 |
+
<Label className="text-base font-medium">Admission Diagnosis</Label>
|
| 107 |
+
<RichTextEditor
|
| 108 |
+
value={summaryData.admissionDiagnosis}
|
| 109 |
+
onChange={(value) => handleInputChange("admissionDiagnosis", value)}
|
| 110 |
+
placeholder="Enter admission diagnosis..."
|
| 111 |
+
rows={2}
|
| 112 |
+
fieldType="assessment"
|
| 113 |
+
showAutofill={true}
|
| 114 |
+
autofillSource="Admission Notes"
|
| 115 |
+
autofillTimestamp="2024-01-10, 09:15 AM"
|
| 116 |
+
/>
|
| 117 |
+
</div>
|
| 118 |
+
|
| 119 |
+
<div>
|
| 120 |
+
<Label className="text-base font-medium">Final Diagnosis</Label>
|
| 121 |
+
<RichTextEditor
|
| 122 |
+
value={summaryData.finalDiagnosis}
|
| 123 |
+
onChange={(value) => handleInputChange("finalDiagnosis", value)}
|
| 124 |
+
placeholder="Enter final diagnosis at discharge..."
|
| 125 |
+
rows={2}
|
| 126 |
+
fieldType="assessment"
|
| 127 |
+
/>
|
| 128 |
+
</div>
|
| 129 |
+
|
| 130 |
+
<div>
|
| 131 |
+
<Label className="text-base font-medium">Clinical Summary</Label>
|
| 132 |
+
<RichTextEditor
|
| 133 |
+
value={summaryData.clinicalSummary}
|
| 134 |
+
onChange={(value) => handleInputChange("clinicalSummary", value)}
|
| 135 |
+
placeholder="Brief summary of patient's clinical presentation and course..."
|
| 136 |
+
rows={4}
|
| 137 |
+
fieldType="general"
|
| 138 |
+
/>
|
| 139 |
+
</div>
|
| 140 |
+
|
| 141 |
+
<div>
|
| 142 |
+
<Label className="text-base font-medium">Hospital Course</Label>
|
| 143 |
+
<RichTextEditor
|
| 144 |
+
value={summaryData.hospitalCourse}
|
| 145 |
+
onChange={(value) => handleInputChange("hospitalCourse", value)}
|
| 146 |
+
placeholder="Detailed description of patient's hospital stay, treatments, and progress..."
|
| 147 |
+
rows={5}
|
| 148 |
+
fieldType="general"
|
| 149 |
+
/>
|
| 150 |
+
</div>
|
| 151 |
+
|
| 152 |
+
<div>
|
| 153 |
+
<Label className="text-base font-medium">Procedures Performed</Label>
|
| 154 |
+
<RichTextEditor
|
| 155 |
+
value={summaryData.proceduresPerformed}
|
| 156 |
+
onChange={(value) => handleInputChange("proceduresPerformed", value)}
|
| 157 |
+
placeholder="List all procedures, surgeries, or interventions performed..."
|
| 158 |
+
rows={3}
|
| 159 |
+
fieldType="ot-procedure"
|
| 160 |
+
/>
|
| 161 |
+
</div>
|
| 162 |
+
|
| 163 |
+
<div>
|
| 164 |
+
<Label className="text-base font-medium">Investigations</Label>
|
| 165 |
+
<RichTextEditor
|
| 166 |
+
value={summaryData.investigations}
|
| 167 |
+
onChange={(value) => handleInputChange("investigations", value)}
|
| 168 |
+
placeholder="Significant laboratory results, imaging findings, and other investigations..."
|
| 169 |
+
rows={4}
|
| 170 |
+
fieldType="general"
|
| 171 |
+
/>
|
| 172 |
+
</div>
|
| 173 |
+
|
| 174 |
+
<div>
|
| 175 |
+
<Label className="text-base font-medium">Treatment Given</Label>
|
| 176 |
+
<RichTextEditor
|
| 177 |
+
value={summaryData.treatmentGiven}
|
| 178 |
+
onChange={(value) => handleInputChange("treatmentGiven", value)}
|
| 179 |
+
placeholder="Medications, therapies, and treatments provided during admission..."
|
| 180 |
+
rows={4}
|
| 181 |
+
fieldType="plan"
|
| 182 |
+
/>
|
| 183 |
+
</div>
|
| 184 |
+
</CardContent>
|
| 185 |
+
</Card>
|
| 186 |
+
|
| 187 |
+
{/* Discharge Information */}
|
| 188 |
+
<Card>
|
| 189 |
+
<CardHeader>
|
| 190 |
+
<CardTitle className="flex items-center gap-2">
|
| 191 |
+
<Home className="w-5 h-5" />
|
| 192 |
+
Discharge Information
|
| 193 |
+
</CardTitle>
|
| 194 |
+
</CardHeader>
|
| 195 |
+
<CardContent className="space-y-6">
|
| 196 |
+
<div>
|
| 197 |
+
<Label className="text-base font-medium">Condition at Discharge</Label>
|
| 198 |
+
<RichTextEditor
|
| 199 |
+
value={summaryData.conditionAtDischarge}
|
| 200 |
+
onChange={(value) => handleInputChange("conditionAtDischarge", value)}
|
| 201 |
+
placeholder="Patient's condition at the time of discharge (stable, improved, etc.)..."
|
| 202 |
+
rows={2}
|
| 203 |
+
fieldType="assessment"
|
| 204 |
+
/>
|
| 205 |
+
</div>
|
| 206 |
+
|
| 207 |
+
<div>
|
| 208 |
+
<Label className="text-base font-medium">Discharge Medications</Label>
|
| 209 |
+
<RichTextEditor
|
| 210 |
+
value={summaryData.dischargeMedications}
|
| 211 |
+
onChange={(value) => handleInputChange("dischargeMedications", value)}
|
| 212 |
+
placeholder="Complete list of medications prescribed at discharge with dosages and instructions..."
|
| 213 |
+
rows={5}
|
| 214 |
+
fieldType="plan"
|
| 215 |
+
/>
|
| 216 |
+
</div>
|
| 217 |
+
|
| 218 |
+
<div>
|
| 219 |
+
<Label className="text-base font-medium">Follow-up Instructions</Label>
|
| 220 |
+
<RichTextEditor
|
| 221 |
+
value={summaryData.followUpInstructions}
|
| 222 |
+
onChange={(value) => handleInputChange("followUpInstructions", value)}
|
| 223 |
+
placeholder="Specific instructions for follow-up care, wound care, activity modifications..."
|
| 224 |
+
rows={4}
|
| 225 |
+
fieldType="plan"
|
| 226 |
+
/>
|
| 227 |
+
</div>
|
| 228 |
+
|
| 229 |
+
<div>
|
| 230 |
+
<Label className="text-base font-medium">Dietary Advice</Label>
|
| 231 |
+
<RichTextEditor
|
| 232 |
+
value={summaryData.dietaryAdvice}
|
| 233 |
+
onChange={(value) => handleInputChange("dietaryAdvice", value)}
|
| 234 |
+
placeholder="Dietary restrictions, recommendations, and nutritional guidance..."
|
| 235 |
+
rows={3}
|
| 236 |
+
fieldType="general"
|
| 237 |
+
/>
|
| 238 |
+
</div>
|
| 239 |
+
|
| 240 |
+
<div>
|
| 241 |
+
<Label className="text-base font-medium">Activity Restrictions</Label>
|
| 242 |
+
<RichTextEditor
|
| 243 |
+
value={summaryData.activityRestrictions}
|
| 244 |
+
onChange={(value) => handleInputChange("activityRestrictions", value)}
|
| 245 |
+
placeholder="Physical activity limitations, work restrictions, driving restrictions..."
|
| 246 |
+
rows={3}
|
| 247 |
+
fieldType="general"
|
| 248 |
+
/>
|
| 249 |
+
</div>
|
| 250 |
+
|
| 251 |
+
<div>
|
| 252 |
+
<Label className="text-base font-medium">Warning Signs to Return</Label>
|
| 253 |
+
<RichTextEditor
|
| 254 |
+
value={summaryData.warningSignsToReturn}
|
| 255 |
+
onChange={(value) => handleInputChange("warningSignsToReturn", value)}
|
| 256 |
+
placeholder="Symptoms or signs that should prompt immediate medical attention..."
|
| 257 |
+
rows={3}
|
| 258 |
+
fieldType="general"
|
| 259 |
+
/>
|
| 260 |
+
</div>
|
| 261 |
+
|
| 262 |
+
<div>
|
| 263 |
+
<Label className="text-base font-medium">Follow-up Appointments</Label>
|
| 264 |
+
<RichTextEditor
|
| 265 |
+
value={summaryData.followUpAppointments}
|
| 266 |
+
onChange={(value) => handleInputChange("followUpAppointments", value)}
|
| 267 |
+
placeholder="Scheduled appointments with specialists, primary care, or other healthcare providers..."
|
| 268 |
+
rows={3}
|
| 269 |
+
fieldType="plan"
|
| 270 |
+
/>
|
| 271 |
+
</div>
|
| 272 |
+
</CardContent>
|
| 273 |
+
</Card>
|
| 274 |
+
</div>
|
| 275 |
+
)
|
| 276 |
+
}
|
ipdmodule/components/form-navigation.tsx
ADDED
|
@@ -0,0 +1,114 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"use client"
|
| 2 |
+
|
| 3 |
+
import type React from "react"
|
| 4 |
+
|
| 5 |
+
import { useState, useEffect } from "react"
|
| 6 |
+
import { Button } from "@/components/ui/button"
|
| 7 |
+
import { ChevronLeft, ChevronRight } from "lucide-react"
|
| 8 |
+
import { cn } from "@/lib/utils"
|
| 9 |
+
|
| 10 |
+
interface NavigationSection {
|
| 11 |
+
id: string
|
| 12 |
+
label: string
|
| 13 |
+
icon: React.ReactNode
|
| 14 |
+
}
|
| 15 |
+
|
| 16 |
+
interface FormNavigationProps {
|
| 17 |
+
sections: NavigationSection[]
|
| 18 |
+
activeSection: string
|
| 19 |
+
onSectionChange: (sectionId: string) => void
|
| 20 |
+
className?: string
|
| 21 |
+
}
|
| 22 |
+
|
| 23 |
+
export function FormNavigation({ sections, activeSection, onSectionChange, className }: FormNavigationProps) {
|
| 24 |
+
const [isCollapsed, setIsCollapsed] = useState(false)
|
| 25 |
+
const [isMobile, setIsMobile] = useState(false)
|
| 26 |
+
|
| 27 |
+
useEffect(() => {
|
| 28 |
+
const checkMobile = () => {
|
| 29 |
+
setIsMobile(window.innerWidth < 768)
|
| 30 |
+
}
|
| 31 |
+
|
| 32 |
+
checkMobile()
|
| 33 |
+
window.addEventListener("resize", checkMobile)
|
| 34 |
+
return () => window.removeEventListener("resize", checkMobile)
|
| 35 |
+
}, [])
|
| 36 |
+
|
| 37 |
+
const scrollToSection = (sectionId: string) => {
|
| 38 |
+
const element = document.getElementById(sectionId)
|
| 39 |
+
if (element) {
|
| 40 |
+
const headerOffset = 80
|
| 41 |
+
const elementPosition = element.getBoundingClientRect().top
|
| 42 |
+
const offsetPosition = elementPosition + window.pageYOffset - headerOffset
|
| 43 |
+
|
| 44 |
+
window.scrollTo({
|
| 45 |
+
top: offsetPosition,
|
| 46 |
+
behavior: "smooth",
|
| 47 |
+
})
|
| 48 |
+
}
|
| 49 |
+
onSectionChange(sectionId)
|
| 50 |
+
}
|
| 51 |
+
|
| 52 |
+
if (isMobile) {
|
| 53 |
+
return (
|
| 54 |
+
<div className={cn("sticky top-4 z-10 bg-white border border-gray-200 rounded-lg p-2 mb-4", className)}>
|
| 55 |
+
<div className="flex gap-1 overflow-x-auto">
|
| 56 |
+
{sections.map((section) => (
|
| 57 |
+
<Button
|
| 58 |
+
key={section.id}
|
| 59 |
+
variant={activeSection === section.id ? "default" : "ghost"}
|
| 60 |
+
size="sm"
|
| 61 |
+
onClick={() => scrollToSection(section.id)}
|
| 62 |
+
className="flex-shrink-0 text-xs px-2 py-1 h-8"
|
| 63 |
+
>
|
| 64 |
+
<span className="mr-1">{section.icon}</span>
|
| 65 |
+
{section.label}
|
| 66 |
+
</Button>
|
| 67 |
+
))}
|
| 68 |
+
</div>
|
| 69 |
+
</div>
|
| 70 |
+
)
|
| 71 |
+
}
|
| 72 |
+
|
| 73 |
+
return (
|
| 74 |
+
<div className={cn("fixed left-4 top-1/2 -translate-y-1/2 z-10", className)}>
|
| 75 |
+
<div
|
| 76 |
+
className={cn(
|
| 77 |
+
"bg-white border border-gray-200 rounded-lg shadow-lg transition-all duration-300",
|
| 78 |
+
isCollapsed ? "w-12" : "w-48",
|
| 79 |
+
)}
|
| 80 |
+
>
|
| 81 |
+
<div className="p-2">
|
| 82 |
+
<Button
|
| 83 |
+
variant="ghost"
|
| 84 |
+
size="sm"
|
| 85 |
+
onClick={() => setIsCollapsed(!isCollapsed)}
|
| 86 |
+
className="w-full justify-center mb-2 h-8"
|
| 87 |
+
>
|
| 88 |
+
{isCollapsed ? <ChevronRight className="w-4 h-4" /> : <ChevronLeft className="w-4 h-4" />}
|
| 89 |
+
</Button>
|
| 90 |
+
|
| 91 |
+
<div className="space-y-1">
|
| 92 |
+
{sections.map((section) => (
|
| 93 |
+
<Button
|
| 94 |
+
key={section.id}
|
| 95 |
+
variant={activeSection === section.id ? "default" : "ghost"}
|
| 96 |
+
size="sm"
|
| 97 |
+
onClick={() => scrollToSection(section.id)}
|
| 98 |
+
className={cn(
|
| 99 |
+
"w-full justify-start h-8 transition-all",
|
| 100 |
+
isCollapsed ? "px-2" : "px-3",
|
| 101 |
+
activeSection === section.id && "bg-blue-100 text-blue-700 border-l-2 border-blue-500",
|
| 102 |
+
)}
|
| 103 |
+
title={isCollapsed ? section.label : undefined}
|
| 104 |
+
>
|
| 105 |
+
<span className={cn("flex-shrink-0", !isCollapsed && "mr-2")}>{section.icon}</span>
|
| 106 |
+
{!isCollapsed && <span className="text-xs truncate">{section.label}</span>}
|
| 107 |
+
</Button>
|
| 108 |
+
))}
|
| 109 |
+
</div>
|
| 110 |
+
</div>
|
| 111 |
+
</div>
|
| 112 |
+
</div>
|
| 113 |
+
)
|
| 114 |
+
}
|
ipdmodule/components/ipd-page.tsx
ADDED
|
@@ -0,0 +1,416 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"use client"
|
| 2 |
+
|
| 3 |
+
import { useState } from "react"
|
| 4 |
+
import { Button } from "@/components/ui/button"
|
| 5 |
+
import { Input } from "@/components/ui/input"
|
| 6 |
+
import {
|
| 7 |
+
ChevronLeft,
|
| 8 |
+
Search,
|
| 9 |
+
Calendar,
|
| 10 |
+
Filter,
|
| 11 |
+
MoreHorizontal,
|
| 12 |
+
Users,
|
| 13 |
+
Bed,
|
| 14 |
+
FileText,
|
| 15 |
+
Activity,
|
| 16 |
+
TestTube,
|
| 17 |
+
ReceiptTextIcon,
|
| 18 |
+
ChevronDown,
|
| 19 |
+
} from "lucide-react"
|
| 20 |
+
|
| 21 |
+
interface Patient {
|
| 22 |
+
id: string
|
| 23 |
+
name: string
|
| 24 |
+
patientId: string
|
| 25 |
+
age: number
|
| 26 |
+
gender: string
|
| 27 |
+
ward: string
|
| 28 |
+
room: string
|
| 29 |
+
contact: string
|
| 30 |
+
admittingDoctor: string
|
| 31 |
+
admittedOn: string
|
| 32 |
+
mrn: string
|
| 33 |
+
bed: string
|
| 34 |
+
}
|
| 35 |
+
|
| 36 |
+
interface IPDPageProps {
|
| 37 |
+
onPatientSelect: (patient: Patient) => void
|
| 38 |
+
onBackClick: () => void
|
| 39 |
+
}
|
| 40 |
+
|
| 41 |
+
export function IPDPage({ onPatientSelect, onBackClick }: IPDPageProps) {
|
| 42 |
+
const [searchTerm, setSearchTerm] = useState("")
|
| 43 |
+
|
| 44 |
+
const patients: Patient[] = [
|
| 45 |
+
{
|
| 46 |
+
id: "1",
|
| 47 |
+
name: "Tara Patil",
|
| 48 |
+
patientId: "PAT00012",
|
| 49 |
+
age: 28,
|
| 50 |
+
gender: "Male",
|
| 51 |
+
ward: "General",
|
| 52 |
+
room: "011",
|
| 53 |
+
contact: "6405065678",
|
| 54 |
+
admittingDoctor: "Dr Prudhvi Raj",
|
| 55 |
+
admittedOn: "02-01-2025",
|
| 56 |
+
mrn: "MRN001",
|
| 57 |
+
bed: "B01",
|
| 58 |
+
},
|
| 59 |
+
{
|
| 60 |
+
id: "2",
|
| 61 |
+
name: "Laila Grewal",
|
| 62 |
+
patientId: "PAT00011",
|
| 63 |
+
age: 28,
|
| 64 |
+
gender: "Female",
|
| 65 |
+
ward: "Gyn",
|
| 66 |
+
room: "002",
|
| 67 |
+
contact: "8357786893",
|
| 68 |
+
admittingDoctor: "Dr Thanuja Korlepa",
|
| 69 |
+
admittedOn: "02-01-2025",
|
| 70 |
+
mrn: "MRN002",
|
| 71 |
+
bed: "B02",
|
| 72 |
+
},
|
| 73 |
+
{
|
| 74 |
+
id: "3",
|
| 75 |
+
name: "Yagya Gahalot",
|
| 76 |
+
patientId: "PAT00010",
|
| 77 |
+
age: 28,
|
| 78 |
+
gender: "Male",
|
| 79 |
+
ward: "Opt",
|
| 80 |
+
room: "004",
|
| 81 |
+
contact: "7799729743",
|
| 82 |
+
admittingDoctor: "Dr Ramilla",
|
| 83 |
+
admittedOn: "02-01-2025",
|
| 84 |
+
mrn: "MRN003",
|
| 85 |
+
bed: "B03",
|
| 86 |
+
},
|
| 87 |
+
{
|
| 88 |
+
id: "4",
|
| 89 |
+
name: "Alaina Mahajan",
|
| 90 |
+
patientId: "PAT00009",
|
| 91 |
+
age: 28,
|
| 92 |
+
gender: "Male",
|
| 93 |
+
ward: "Neu",
|
| 94 |
+
room: "040",
|
| 95 |
+
contact: "9581468185",
|
| 96 |
+
admittingDoctor: "02-01-2025",
|
| 97 |
+
admittedOn: "02-01-2025",
|
| 98 |
+
mrn: "MRN004",
|
| 99 |
+
bed: "B04",
|
| 100 |
+
},
|
| 101 |
+
{
|
| 102 |
+
id: "5",
|
| 103 |
+
name: "Devasena",
|
| 104 |
+
patientId: "PAT00008",
|
| 105 |
+
age: 28,
|
| 106 |
+
gender: "Female",
|
| 107 |
+
ward: "Gyn",
|
| 108 |
+
room: "002",
|
| 109 |
+
contact: "8670940984",
|
| 110 |
+
admittingDoctor: "02-01-2025",
|
| 111 |
+
admittedOn: "02-01-2025",
|
| 112 |
+
mrn: "MRN005",
|
| 113 |
+
bed: "B05",
|
| 114 |
+
},
|
| 115 |
+
{
|
| 116 |
+
id: "6",
|
| 117 |
+
name: "Puravi Arakeri",
|
| 118 |
+
patientId: "PAT00007",
|
| 119 |
+
age: 28,
|
| 120 |
+
gender: "Male",
|
| 121 |
+
ward: "General",
|
| 122 |
+
room: "009",
|
| 123 |
+
contact: "7464002468",
|
| 124 |
+
admittingDoctor: "01-01-2025",
|
| 125 |
+
admittedOn: "01-01-2025",
|
| 126 |
+
mrn: "MRN006",
|
| 127 |
+
bed: "B06",
|
| 128 |
+
},
|
| 129 |
+
{
|
| 130 |
+
id: "7",
|
| 131 |
+
name: "Sragvibhushan",
|
| 132 |
+
patientId: "PAT00006",
|
| 133 |
+
age: 28,
|
| 134 |
+
gender: "Male",
|
| 135 |
+
ward: "General",
|
| 136 |
+
room: "008",
|
| 137 |
+
contact: "8542560341",
|
| 138 |
+
admittingDoctor: "01-01-2025",
|
| 139 |
+
admittedOn: "01-01-2025",
|
| 140 |
+
mrn: "MRN007",
|
| 141 |
+
bed: "B07",
|
| 142 |
+
},
|
| 143 |
+
{
|
| 144 |
+
id: "8",
|
| 145 |
+
name: "Aryan Hanagandi",
|
| 146 |
+
patientId: "PAT00005",
|
| 147 |
+
age: 28,
|
| 148 |
+
gender: "Female",
|
| 149 |
+
ward: "General",
|
| 150 |
+
room: "010",
|
| 151 |
+
contact: "9763087109",
|
| 152 |
+
admittingDoctor: "01-01-2025",
|
| 153 |
+
admittedOn: "01-01-2025",
|
| 154 |
+
mrn: "MRN008",
|
| 155 |
+
bed: "B08",
|
| 156 |
+
},
|
| 157 |
+
]
|
| 158 |
+
|
| 159 |
+
const filteredPatients = patients.filter(
|
| 160 |
+
(patient) =>
|
| 161 |
+
patient.name.toLowerCase().includes(searchTerm.toLowerCase()) ||
|
| 162 |
+
patient.patientId.toLowerCase().includes(searchTerm.toLowerCase()) ||
|
| 163 |
+
patient.contact.includes(searchTerm) ||
|
| 164 |
+
patient.room.includes(searchTerm),
|
| 165 |
+
)
|
| 166 |
+
|
| 167 |
+
return (
|
| 168 |
+
<div className="h-screen bg-[#fafafb] flex flex-col">
|
| 169 |
+
{/* Header */}
|
| 170 |
+
<div className="bg-white px-6 py-4 flex items-center justify-between border-b border-[#e2e2ea]">
|
| 171 |
+
<div className="flex items-center gap-4">
|
| 172 |
+
<Button variant="ghost" size="sm" onClick={onBackClick} className="text-[#44444f] hover:bg-[#f1f1f5]">
|
| 173 |
+
<ChevronLeft className="h-4 w-4" />
|
| 174 |
+
</Button>
|
| 175 |
+
<h1 className="text-xl font-semibold text-[#171725]">IPD</h1>
|
| 176 |
+
</div>
|
| 177 |
+
<div className="flex items-center gap-4">
|
| 178 |
+
<Button
|
| 179 |
+
variant="outline"
|
| 180 |
+
size="sm"
|
| 181 |
+
className="text-[#4b4ad5] border-[#4b4ad5] bg-[#4b4ad5] text-white hover:bg-[#4b4ad5]/90 rounded-full px-4 py-2 h-8 text-sm font-medium"
|
| 182 |
+
>
|
| 183 |
+
Tutorial
|
| 184 |
+
</Button>
|
| 185 |
+
<div className="relative">
|
| 186 |
+
<select className="appearance-none px-4 py-2 pr-8 border border-[#e2e2ea] rounded-md text-[#44444f] bg-white text-sm font-medium h-10 min-w-[140px]">
|
| 187 |
+
<option>Hospital Name</option>
|
| 188 |
+
</select>
|
| 189 |
+
<ChevronDown className="absolute right-2 top-1/2 transform -translate-y-1/2 h-4 w-4 text-[#92929d] pointer-events-none" />
|
| 190 |
+
</div>
|
| 191 |
+
</div>
|
| 192 |
+
</div>
|
| 193 |
+
|
| 194 |
+
<div className="flex flex-1">
|
| 195 |
+
{/* Left Sidebar */}
|
| 196 |
+
<div className="w-[107px] bg-white flex flex-col items-center py-4 relative border-r border-[#e2e2ea]">
|
| 197 |
+
{/* Active indicator positioned for InPatients */}
|
| 198 |
+
<div className="absolute left-0 w-[3px] h-[46px] bg-[#4b4ad5] rounded-r-full top-[24px]" />
|
| 199 |
+
|
| 200 |
+
<div className="flex flex-col items-center gap-2 mt-2">
|
| 201 |
+
<div className="flex flex-col items-center gap-1 py-2 w-full">
|
| 202 |
+
<div className="p-2 text-[#4b4ad5]">
|
| 203 |
+
<Users className="h-6 w-6" />
|
| 204 |
+
</div>
|
| 205 |
+
<span
|
| 206 |
+
className="text-[10px] font-semibold text-center leading-tight px-1 text-[#4b4ad5]"
|
| 207 |
+
style={{ fontSize: "10px", lineHeight: "12px" }}
|
| 208 |
+
>
|
| 209 |
+
InPatients
|
| 210 |
+
</span>
|
| 211 |
+
</div>
|
| 212 |
+
|
| 213 |
+
<div className="flex flex-col items-center gap-1 py-2 w-full">
|
| 214 |
+
<div className="p-2 text-[#a2a2a8]">
|
| 215 |
+
<Activity className="h-6 w-6" />
|
| 216 |
+
</div>
|
| 217 |
+
<span
|
| 218 |
+
className="text-[10px] font-semibold text-center leading-tight px-1 text-[#454551]"
|
| 219 |
+
style={{ fontSize: "10px", lineHeight: "12px" }}
|
| 220 |
+
>
|
| 221 |
+
ATD
|
| 222 |
+
</span>
|
| 223 |
+
</div>
|
| 224 |
+
|
| 225 |
+
<div className="flex flex-col items-center gap-1 py-2 w-full">
|
| 226 |
+
<div className="p-2 text-[#a2a2a8]">
|
| 227 |
+
<Bed className="h-6 w-6" />
|
| 228 |
+
</div>
|
| 229 |
+
<span
|
| 230 |
+
className="text-[10px] font-semibold text-center leading-tight px-1 text-[#454551]"
|
| 231 |
+
style={{ fontSize: "10px", lineHeight: "12px" }}
|
| 232 |
+
>
|
| 233 |
+
Ward Manager
|
| 234 |
+
</span>
|
| 235 |
+
</div>
|
| 236 |
+
|
| 237 |
+
|
| 238 |
+
|
| 239 |
+
<div className="flex flex-col items-center gap-1 py-2 w-full">
|
| 240 |
+
<div className="p-2 text-[#a2a2a8]">
|
| 241 |
+
<TestTube className="h-6 w-6" />
|
| 242 |
+
</div>
|
| 243 |
+
<span
|
| 244 |
+
className="text-[10px] font-semibold text-center leading-tight px-1 text-[#454551]"
|
| 245 |
+
style={{ fontSize: "10px", lineHeight: "12px" }}
|
| 246 |
+
>
|
| 247 |
+
Pathology
|
| 248 |
+
</span>
|
| 249 |
+
</div>
|
| 250 |
+
|
| 251 |
+
<div className="flex flex-col items-center gap-1 py-2 w-full">
|
| 252 |
+
<div className="p-2 text-[#a2a2a8]">
|
| 253 |
+
<ReceiptTextIcon className="h-6 w-6" />
|
| 254 |
+
</div>
|
| 255 |
+
<span
|
| 256 |
+
className="text-[10px] font-semibold text-center leading-tight px-1 text-[#454551]"
|
| 257 |
+
style={{ fontSize: "10px", lineHeight: "12px" }}
|
| 258 |
+
>
|
| 259 |
+
IPD Billing
|
| 260 |
+
</span>
|
| 261 |
+
</div>
|
| 262 |
+
</div>
|
| 263 |
+
</div>
|
| 264 |
+
|
| 265 |
+
{/* Main Content */}
|
| 266 |
+
<div className="flex-1 relative">
|
| 267 |
+
{/* Yellow Background Section - 200px height */}
|
| 268 |
+
<div className="bg-[#fed15e] h-[200px] w-full">
|
| 269 |
+
{/* InPatients Heading - Outside the white frame */}
|
| 270 |
+
<div className="px-6 pt-6">
|
| 271 |
+
<h2 className="text-2xl font-bold text-[#171725]">InPatients</h2>
|
| 272 |
+
</div>
|
| 273 |
+
</div>
|
| 274 |
+
|
| 275 |
+
{/* White Content Frame - Overlapping yellow background */}
|
| 276 |
+
<div className="absolute top-16 left-6 right-6 bottom-6 bg-white rounded-lg shadow-sm flex flex-col">
|
| 277 |
+
{/* Summary Cards Section */}
|
| 278 |
+
<div className="px-6 border-b border-[#e2e2ea] border-none py-0 pt-6">
|
| 279 |
+
<div className="flex gap-6 border-[] justify-start">
|
| 280 |
+
<div className="bg-white min-w-[200px] p-6 text-center rounded-lg shadow border-[.5px] text-slate-100">
|
| 281 |
+
<p className="text-[#92929d] text-sm mb-2 font-medium">Total No of wards</p>
|
| 282 |
+
<p className="text-3xl font-bold text-[#171725]">04</p>
|
| 283 |
+
</div>
|
| 284 |
+
<div className="bg-white rounded-lg min-w-[200px] p-6 text-center border-[.5px] shadow px-6">
|
| 285 |
+
<p className="text-[#92929d] text-sm mb-2 font-medium">Total Beds Occupied</p>
|
| 286 |
+
<p className="text-3xl font-bold text-[#171725]">
|
| 287 |
+
14<span className="text-[#92929d] leading-[1.75] text-lg font-normal">/24</span>
|
| 288 |
+
</p>
|
| 289 |
+
</div>
|
| 290 |
+
</div>
|
| 291 |
+
</div>
|
| 292 |
+
|
| 293 |
+
{/* Patient List Section */}
|
| 294 |
+
<div className="flex-1 px-6 py-6 overflow-auto">
|
| 295 |
+
{/* Search and Filters */}
|
| 296 |
+
<div className="flex flex-col lg:flex-row gap-4 items-start lg:items-center justify-between mb-4 pb-4">
|
| 297 |
+
<div className="relative flex-1 max-w-md">
|
| 298 |
+
<Search className="absolute left-3 top-1/2 transform -translate-y-1/2 text-[#92929d] h-4 w-4" />
|
| 299 |
+
<Input
|
| 300 |
+
placeholder="Search by patient name / ID / Bed no/ mobile no"
|
| 301 |
+
value={searchTerm}
|
| 302 |
+
onChange={(e) => setSearchTerm(e.target.value)}
|
| 303 |
+
className="pl-10 border-[#e2e2ea] h-10 text-sm placeholder:text-[#92929d]"
|
| 304 |
+
/>
|
| 305 |
+
</div>
|
| 306 |
+
|
| 307 |
+
<div className="flex gap-3 flex-wrap">
|
| 308 |
+
<Button
|
| 309 |
+
variant="outline"
|
| 310 |
+
className="text-[#44444f] border-[#e2e2ea] bg-white hover:bg-[#f1f1f5] h-10 px-4 text-sm font-medium"
|
| 311 |
+
>
|
| 312 |
+
Filter by Ward
|
| 313 |
+
<Filter className="h-4 w-4 ml-2" />
|
| 314 |
+
</Button>
|
| 315 |
+
<Button
|
| 316 |
+
variant="outline"
|
| 317 |
+
className="text-[#44444f] border-[#e2e2ea] bg-white hover:bg-[#f1f1f5] h-10 px-4 text-sm font-medium"
|
| 318 |
+
>
|
| 319 |
+
Filter by Doctor
|
| 320 |
+
<Filter className="h-4 w-4 ml-2" />
|
| 321 |
+
</Button>
|
| 322 |
+
<Button
|
| 323 |
+
variant="outline"
|
| 324 |
+
className="text-[#44444f] border-[#e2e2ea] bg-white hover:bg-[#f1f1f5] h-10 px-4 text-sm font-medium"
|
| 325 |
+
>
|
| 326 |
+
Today
|
| 327 |
+
<Calendar className="h-4 w-4 ml-2" />
|
| 328 |
+
</Button>
|
| 329 |
+
</div>
|
| 330 |
+
</div>
|
| 331 |
+
|
| 332 |
+
{/* Patient Count */}
|
| 333 |
+
|
| 334 |
+
|
| 335 |
+
{/* Patient Table */}
|
| 336 |
+
<div className="overflow-x-auto">
|
| 337 |
+
<table className="w-full">
|
| 338 |
+
<thead>
|
| 339 |
+
<tr className="border-b border-[#e2e2ea]">
|
| 340 |
+
<th className="text-left py-3 px-4 text-[#92929d] font-semibold text-sm uppercase tracking-wide bg-slate-100">
|
| 341 |
+
#
|
| 342 |
+
</th>
|
| 343 |
+
<th className="text-left py-3 px-4 text-[#92929d] font-semibold text-sm uppercase tracking-wide bg-slate-100">
|
| 344 |
+
PATIENT DETAILS
|
| 345 |
+
</th>
|
| 346 |
+
<th className="text-left py-3 px-4 text-[#92929d] font-semibold text-sm uppercase tracking-wide bg-slate-100">
|
| 347 |
+
PATIENT ID
|
| 348 |
+
</th>
|
| 349 |
+
<th className="text-left py-3 px-4 text-[#92929d] font-semibold text-sm uppercase tracking-wide bg-slate-100">
|
| 350 |
+
Ward/Room
|
| 351 |
+
</th>
|
| 352 |
+
<th className="text-left py-3 px-4 text-[#92929d] font-semibold text-sm uppercase tracking-wide bg-slate-100">
|
| 353 |
+
CONTACT
|
| 354 |
+
</th>
|
| 355 |
+
<th className="text-left py-3 px-4 text-[#92929d] font-semibold text-sm uppercase tracking-wide bg-slate-100">
|
| 356 |
+
Admitting Doctor
|
| 357 |
+
</th>
|
| 358 |
+
<th className="text-left py-3 px-4 text-[#92929d] font-semibold text-sm uppercase tracking-wide bg-slate-100">
|
| 359 |
+
Admitted on
|
| 360 |
+
</th>
|
| 361 |
+
<th className="text-left py-3 px-4 text-[#92929d] font-semibold text-sm uppercase tracking-wide bg-slate-100">
|
| 362 |
+
ACTION
|
| 363 |
+
</th>
|
| 364 |
+
</tr>
|
| 365 |
+
</thead>
|
| 366 |
+
<tbody>
|
| 367 |
+
{filteredPatients.map((patient, index) => (
|
| 368 |
+
<tr key={patient.id} className="border-b border-[#f1f1f5] hover:bg-[#fafafb] transition-colors">
|
| 369 |
+
<td className="py-4 px-4 text-[#44444f] font-medium">{index + 1}</td>
|
| 370 |
+
<td className="py-4 px-4">
|
| 371 |
+
<div>
|
| 372 |
+
<button
|
| 373 |
+
className="text-[#4b4ad5] font-semibold hover:underline text-left"
|
| 374 |
+
onClick={() => onPatientSelect?.(patient)}
|
| 375 |
+
>
|
| 376 |
+
{patient.name}
|
| 377 |
+
</button>
|
| 378 |
+
<div className="text-[#92929d] text-sm mt-1">
|
| 379 |
+
{patient.gender}, {patient.age}y
|
| 380 |
+
</div>
|
| 381 |
+
</div>
|
| 382 |
+
</td>
|
| 383 |
+
<td className="py-4 px-4 text-[#44444f] font-medium">{patient.patientId}</td>
|
| 384 |
+
<td className="py-4 px-4 text-[#44444f]">
|
| 385 |
+
{patient.ward}/ {patient.room}
|
| 386 |
+
</td>
|
| 387 |
+
<td className="py-4 px-4 text-[#44444f]">{patient.contact}</td>
|
| 388 |
+
<td className="py-4 px-4 text-[#44444f]">{patient.admittingDoctor}</td>
|
| 389 |
+
<td className="py-4 px-4 text-[#44444f]">{patient.admittedOn}</td>
|
| 390 |
+
<td className="py-4 px-4">
|
| 391 |
+
<div className="flex items-center gap-2">
|
| 392 |
+
<Button
|
| 393 |
+
variant="outline"
|
| 394 |
+
size="sm"
|
| 395 |
+
className="text-[#4b4ad5] border-[#4b4ad5] hover:bg-[#4b4ad5] hover:text-white bg-white h-8 px-3 text-sm font-medium"
|
| 396 |
+
onClick={() => onPatientSelect?.(patient)}
|
| 397 |
+
>
|
| 398 |
+
View Details
|
| 399 |
+
</Button>
|
| 400 |
+
<Button variant="ghost" size="sm" className="text-[#92929d] h-8 w-8 p-0">
|
| 401 |
+
<MoreHorizontal className="h-4 w-4" />
|
| 402 |
+
</Button>
|
| 403 |
+
</div>
|
| 404 |
+
</td>
|
| 405 |
+
</tr>
|
| 406 |
+
))}
|
| 407 |
+
</tbody>
|
| 408 |
+
</table>
|
| 409 |
+
</div>
|
| 410 |
+
</div>
|
| 411 |
+
</div>
|
| 412 |
+
</div>
|
| 413 |
+
</div>
|
| 414 |
+
</div>
|
| 415 |
+
)
|
| 416 |
+
}
|
ipdmodule/components/ipd-patient-details.tsx
ADDED
|
@@ -0,0 +1,414 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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/components/ui/button"
|
| 5 |
+
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"
|
| 6 |
+
import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs"
|
| 7 |
+
import { Badge } from "@/components/ui/badge"
|
| 8 |
+
import {
|
| 9 |
+
ChevronLeft,
|
| 10 |
+
User,
|
| 11 |
+
Calendar,
|
| 12 |
+
MapPin,
|
| 13 |
+
Phone,
|
| 14 |
+
FileText,
|
| 15 |
+
Activity,
|
| 16 |
+
TestTube,
|
| 17 |
+
Stethoscope,
|
| 18 |
+
ClipboardList,
|
| 19 |
+
Heart,
|
| 20 |
+
} from "lucide-react"
|
| 21 |
+
|
| 22 |
+
interface Patient {
|
| 23 |
+
id: string
|
| 24 |
+
name: string
|
| 25 |
+
patientId: string
|
| 26 |
+
age: number
|
| 27 |
+
gender: string
|
| 28 |
+
ward: string
|
| 29 |
+
room: string
|
| 30 |
+
contact: string
|
| 31 |
+
admittingDoctor: string
|
| 32 |
+
admittedOn: string
|
| 33 |
+
}
|
| 34 |
+
|
| 35 |
+
interface IPDPatientDetailsProps {
|
| 36 |
+
patient: Patient
|
| 37 |
+
onBackClick: () => void
|
| 38 |
+
}
|
| 39 |
+
|
| 40 |
+
export function IPDPatientDetails({ patient, onBackClick }: IPDPatientDetailsProps) {
|
| 41 |
+
const [activeTab, setActiveTab] = useState("progress-notes")
|
| 42 |
+
|
| 43 |
+
return (
|
| 44 |
+
<div className="h-screen bg-[#fafafb] flex flex-col">
|
| 45 |
+
{/* Header */}
|
| 46 |
+
<div className="bg-white px-6 py-4 flex items-center justify-between border-b border-[#e2e2ea]">
|
| 47 |
+
<div className="flex items-center gap-4">
|
| 48 |
+
<Button variant="ghost" size="sm" onClick={onBackClick} className="text-[#44444f] hover:bg-[#f1f1f5]">
|
| 49 |
+
<ChevronLeft className="h-4 w-4" />
|
| 50 |
+
</Button>
|
| 51 |
+
<h1 className="text-xl font-semibold text-[#171725]">Patient Details</h1>
|
| 52 |
+
</div>
|
| 53 |
+
</div>
|
| 54 |
+
|
| 55 |
+
{/* Patient Header Card */}
|
| 56 |
+
<div className="bg-white mx-6 mt-6 rounded-lg border border-[#e2e2ea] p-6">
|
| 57 |
+
<div className="flex flex-col lg:flex-row lg:items-center gap-6">
|
| 58 |
+
<div className="flex items-center gap-4">
|
| 59 |
+
<div className="w-16 h-16 bg-[#4b4ad5] rounded-full flex items-center justify-center">
|
| 60 |
+
<User className="h-8 w-8 text-white" />
|
| 61 |
+
</div>
|
| 62 |
+
<div>
|
| 63 |
+
<h2 className="text-2xl font-bold text-[#171725]">{patient.name}</h2>
|
| 64 |
+
<p className="text-[#92929d]">
|
| 65 |
+
{patient.gender}, {patient.age} years old
|
| 66 |
+
</p>
|
| 67 |
+
<Badge variant="outline" className="mt-2 text-[#4b4ad5] border-[#4b4ad5]">
|
| 68 |
+
{patient.patientId}
|
| 69 |
+
</Badge>
|
| 70 |
+
</div>
|
| 71 |
+
</div>
|
| 72 |
+
|
| 73 |
+
<div className="flex-1 grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4">
|
| 74 |
+
<div className="flex items-center gap-2">
|
| 75 |
+
<MapPin className="h-4 w-4 text-[#92929d]" />
|
| 76 |
+
<div>
|
| 77 |
+
<p className="text-sm text-[#92929d]">Ward/Room</p>
|
| 78 |
+
<p className="font-medium text-[#44444f]">
|
| 79 |
+
{patient.ward}/{patient.room}
|
| 80 |
+
</p>
|
| 81 |
+
</div>
|
| 82 |
+
</div>
|
| 83 |
+
<div className="flex items-center gap-2">
|
| 84 |
+
<Phone className="h-4 w-4 text-[#92929d]" />
|
| 85 |
+
<div>
|
| 86 |
+
<p className="text-sm text-[#92929d]">Contact</p>
|
| 87 |
+
<p className="font-medium text-[#44444f]">{patient.contact}</p>
|
| 88 |
+
</div>
|
| 89 |
+
</div>
|
| 90 |
+
<div className="flex items-center gap-2">
|
| 91 |
+
<Stethoscope className="h-4 w-4 text-[#92929d]" />
|
| 92 |
+
<div>
|
| 93 |
+
<p className="text-sm text-[#92929d]">Admitting Doctor</p>
|
| 94 |
+
<p className="font-medium text-[#44444f]">{patient.admittingDoctor}</p>
|
| 95 |
+
</div>
|
| 96 |
+
</div>
|
| 97 |
+
<div className="flex items-center gap-2">
|
| 98 |
+
<Calendar className="h-4 w-4 text-[#92929d]" />
|
| 99 |
+
<div>
|
| 100 |
+
<p className="text-sm text-[#92929d]">Admitted On</p>
|
| 101 |
+
<p className="font-medium text-[#44444f]">{patient.admittedOn}</p>
|
| 102 |
+
</div>
|
| 103 |
+
</div>
|
| 104 |
+
</div>
|
| 105 |
+
</div>
|
| 106 |
+
</div>
|
| 107 |
+
|
| 108 |
+
{/* Tabs Section */}
|
| 109 |
+
<div className="flex-1 mx-6 mt-6 mb-6">
|
| 110 |
+
<Tabs value={activeTab} onValueChange={setActiveTab} className="h-full flex flex-col">
|
| 111 |
+
<TabsList className="grid w-full grid-cols-6 bg-white border border-[#e2e2ea] rounded-lg p-1">
|
| 112 |
+
<TabsTrigger
|
| 113 |
+
value="progress-notes"
|
| 114 |
+
className="data-[state=active]:bg-[#4b4ad5] data-[state=active]:text-white"
|
| 115 |
+
>
|
| 116 |
+
<FileText className="h-4 w-4 mr-2" />
|
| 117 |
+
Progress Notes
|
| 118 |
+
</TabsTrigger>
|
| 119 |
+
<TabsTrigger
|
| 120 |
+
value="existing-ipd"
|
| 121 |
+
className="data-[state=active]:bg-[#4b4ad5] data-[state=active]:text-white"
|
| 122 |
+
>
|
| 123 |
+
<Activity className="h-4 w-4 mr-2" />
|
| 124 |
+
Existing IPD
|
| 125 |
+
</TabsTrigger>
|
| 126 |
+
<TabsTrigger
|
| 127 |
+
value="opd-history"
|
| 128 |
+
className="data-[state=active]:bg-[#4b4ad5] data-[state=active]:text-white"
|
| 129 |
+
>
|
| 130 |
+
<ClipboardList className="h-4 w-4 mr-2" />
|
| 131 |
+
OPD History
|
| 132 |
+
</TabsTrigger>
|
| 133 |
+
<TabsTrigger
|
| 134 |
+
value="assessments"
|
| 135 |
+
className="data-[state=active]:bg-[#4b4ad5] data-[state=active]:text-white"
|
| 136 |
+
>
|
| 137 |
+
<Heart className="h-4 w-4 mr-2" />
|
| 138 |
+
Assessments
|
| 139 |
+
</TabsTrigger>
|
| 140 |
+
<TabsTrigger
|
| 141 |
+
value="lab-radiology"
|
| 142 |
+
className="data-[state=active]:bg-[#4b4ad5] data-[state=active]:text-white"
|
| 143 |
+
>
|
| 144 |
+
<TestTube className="h-4 w-4 mr-2" />
|
| 145 |
+
Lab & Radiology
|
| 146 |
+
</TabsTrigger>
|
| 147 |
+
<TabsTrigger
|
| 148 |
+
value="activity-logs"
|
| 149 |
+
className="data-[state=active]:bg-[#4b4ad5] data-[state=active]:text-white"
|
| 150 |
+
>
|
| 151 |
+
<Activity className="h-4 w-4 mr-2" />
|
| 152 |
+
Activity Logs
|
| 153 |
+
</TabsTrigger>
|
| 154 |
+
</TabsList>
|
| 155 |
+
|
| 156 |
+
<div className="flex-1 mt-4">
|
| 157 |
+
<TabsContent value="progress-notes" className="h-full">
|
| 158 |
+
<Card className="h-full">
|
| 159 |
+
<CardHeader>
|
| 160 |
+
<CardTitle className="text-[#171725]">Progress Notes</CardTitle>
|
| 161 |
+
</CardHeader>
|
| 162 |
+
<CardContent>
|
| 163 |
+
<div className="space-y-4">
|
| 164 |
+
<div className="border-l-4 border-[#4b4ad5] pl-4">
|
| 165 |
+
<div className="flex justify-between items-start mb-2">
|
| 166 |
+
<h4 className="font-semibold text-[#171725]">Daily Progress Note</h4>
|
| 167 |
+
<span className="text-sm text-[#92929d]">02-01-2025 10:30 AM</span>
|
| 168 |
+
</div>
|
| 169 |
+
<p className="text-[#44444f] mb-2">
|
| 170 |
+
Patient is stable and responding well to treatment. Vital signs are within normal limits.
|
| 171 |
+
</p>
|
| 172 |
+
<p className="text-sm text-[#92929d]">Dr. Prudhvi Raj</p>
|
| 173 |
+
</div>
|
| 174 |
+
<div className="border-l-4 border-[#fed15e] pl-4">
|
| 175 |
+
<div className="flex justify-between items-start mb-2">
|
| 176 |
+
<h4 className="font-semibold text-[#171725]">Nursing Note</h4>
|
| 177 |
+
<span className="text-sm text-[#92929d]">01-01-2025 08:00 PM</span>
|
| 178 |
+
</div>
|
| 179 |
+
<p className="text-[#44444f] mb-2">
|
| 180 |
+
Patient comfortable, no complaints. Medications administered as prescribed.
|
| 181 |
+
</p>
|
| 182 |
+
<p className="text-sm text-[#92929d]">Nurse Sarah Johnson</p>
|
| 183 |
+
</div>
|
| 184 |
+
</div>
|
| 185 |
+
</CardContent>
|
| 186 |
+
</Card>
|
| 187 |
+
</TabsContent>
|
| 188 |
+
|
| 189 |
+
<TabsContent value="existing-ipd" className="h-full">
|
| 190 |
+
<Card className="h-full">
|
| 191 |
+
<CardHeader>
|
| 192 |
+
<CardTitle className="text-[#171725]">Current IPD Details</CardTitle>
|
| 193 |
+
</CardHeader>
|
| 194 |
+
<CardContent>
|
| 195 |
+
<div className="grid grid-cols-1 md:grid-cols-2 gap-6">
|
| 196 |
+
<div>
|
| 197 |
+
<h4 className="font-semibold text-[#171725] mb-3">Admission Information</h4>
|
| 198 |
+
<div className="space-y-2">
|
| 199 |
+
<div className="flex justify-between">
|
| 200 |
+
<span className="text-[#92929d]">Admission Date:</span>
|
| 201 |
+
<span className="text-[#44444f]">{patient.admittedOn}</span>
|
| 202 |
+
</div>
|
| 203 |
+
<div className="flex justify-between">
|
| 204 |
+
<span className="text-[#92929d]">Length of Stay:</span>
|
| 205 |
+
<span className="text-[#44444f]">2 days</span>
|
| 206 |
+
</div>
|
| 207 |
+
<div className="flex justify-between">
|
| 208 |
+
<span className="text-[#92929d]">Admission Type:</span>
|
| 209 |
+
<span className="text-[#44444f]">Emergency</span>
|
| 210 |
+
</div>
|
| 211 |
+
</div>
|
| 212 |
+
</div>
|
| 213 |
+
<div>
|
| 214 |
+
<h4 className="font-semibold text-[#171725] mb-3">Current Status</h4>
|
| 215 |
+
<div className="space-y-2">
|
| 216 |
+
<div className="flex justify-between">
|
| 217 |
+
<span className="text-[#92929d]">Status:</span>
|
| 218 |
+
<Badge className="bg-green-100 text-green-800">Stable</Badge>
|
| 219 |
+
</div>
|
| 220 |
+
<div className="flex justify-between">
|
| 221 |
+
<span className="text-[#92929d]">Diet:</span>
|
| 222 |
+
<span className="text-[#44444f]">Regular</span>
|
| 223 |
+
</div>
|
| 224 |
+
<div className="flex justify-between">
|
| 225 |
+
<span className="text-[#92929d]">Activity Level:</span>
|
| 226 |
+
<span className="text-[#44444f]">Bed Rest</span>
|
| 227 |
+
</div>
|
| 228 |
+
</div>
|
| 229 |
+
</div>
|
| 230 |
+
</div>
|
| 231 |
+
</CardContent>
|
| 232 |
+
</Card>
|
| 233 |
+
</TabsContent>
|
| 234 |
+
|
| 235 |
+
<TabsContent value="opd-history" className="h-full">
|
| 236 |
+
<Card className="h-full">
|
| 237 |
+
<CardHeader>
|
| 238 |
+
<CardTitle className="text-[#171725]">OPD Consultation History</CardTitle>
|
| 239 |
+
</CardHeader>
|
| 240 |
+
<CardContent>
|
| 241 |
+
<div className="space-y-4">
|
| 242 |
+
<div className="border border-[#e2e2ea] rounded-lg p-4">
|
| 243 |
+
<div className="flex justify-between items-start mb-2">
|
| 244 |
+
<h4 className="font-semibold text-[#171725]">General Medicine Consultation</h4>
|
| 245 |
+
<span className="text-sm text-[#92929d]">28-12-2024</span>
|
| 246 |
+
</div>
|
| 247 |
+
<p className="text-[#44444f] mb-2">Chief Complaint: Fever and body ache for 3 days</p>
|
| 248 |
+
<p className="text-sm text-[#92929d]">Dr. Prudhvi Raj</p>
|
| 249 |
+
</div>
|
| 250 |
+
<div className="border border-[#e2e2ea] rounded-lg p-4">
|
| 251 |
+
<div className="flex justify-between items-start mb-2">
|
| 252 |
+
<h4 className="font-semibold text-[#171725]">Follow-up Consultation</h4>
|
| 253 |
+
<span className="text-sm text-[#92929d]">25-12-2024</span>
|
| 254 |
+
</div>
|
| 255 |
+
<p className="text-[#44444f] mb-2">Routine check-up, all parameters normal</p>
|
| 256 |
+
<p className="text-sm text-[#92929d]">Dr. Prudhvi Raj</p>
|
| 257 |
+
</div>
|
| 258 |
+
</div>
|
| 259 |
+
</CardContent>
|
| 260 |
+
</Card>
|
| 261 |
+
</TabsContent>
|
| 262 |
+
|
| 263 |
+
<TabsContent value="assessments" className="h-full">
|
| 264 |
+
<Card className="h-full">
|
| 265 |
+
<CardHeader>
|
| 266 |
+
<CardTitle className="text-[#171725]">Clinical Assessments</CardTitle>
|
| 267 |
+
</CardHeader>
|
| 268 |
+
<CardContent>
|
| 269 |
+
<div className="grid grid-cols-1 md:grid-cols-2 gap-6">
|
| 270 |
+
<div>
|
| 271 |
+
<h4 className="font-semibold text-[#171725] mb-3">Vital Signs</h4>
|
| 272 |
+
<div className="space-y-2">
|
| 273 |
+
<div className="flex justify-between">
|
| 274 |
+
<span className="text-[#92929d]">Blood Pressure:</span>
|
| 275 |
+
<span className="text-[#44444f]">120/80 mmHg</span>
|
| 276 |
+
</div>
|
| 277 |
+
<div className="flex justify-between">
|
| 278 |
+
<span className="text-[#92929d]">Heart Rate:</span>
|
| 279 |
+
<span className="text-[#44444f]">72 bpm</span>
|
| 280 |
+
</div>
|
| 281 |
+
<div className="flex justify-between">
|
| 282 |
+
<span className="text-[#92929d]">Temperature:</span>
|
| 283 |
+
<span className="text-[#44444f]">98.6°F</span>
|
| 284 |
+
</div>
|
| 285 |
+
<div className="flex justify-between">
|
| 286 |
+
<span className="text-[#92929d]">Respiratory Rate:</span>
|
| 287 |
+
<span className="text-[#44444f]">16/min</span>
|
| 288 |
+
</div>
|
| 289 |
+
</div>
|
| 290 |
+
</div>
|
| 291 |
+
<div>
|
| 292 |
+
<h4 className="font-semibold text-[#171725] mb-3">Physical Examination</h4>
|
| 293 |
+
<div className="space-y-2">
|
| 294 |
+
<div className="flex justify-between">
|
| 295 |
+
<span className="text-[#92929d]">General Appearance:</span>
|
| 296 |
+
<span className="text-[#44444f]">Alert & Oriented</span>
|
| 297 |
+
</div>
|
| 298 |
+
<div className="flex justify-between">
|
| 299 |
+
<span className="text-[#92929d]">Cardiovascular:</span>
|
| 300 |
+
<span className="text-[#44444f]">Normal</span>
|
| 301 |
+
</div>
|
| 302 |
+
<div className="flex justify-between">
|
| 303 |
+
<span className="text-[#92929d]">Respiratory:</span>
|
| 304 |
+
<span className="text-[#44444f]">Clear</span>
|
| 305 |
+
</div>
|
| 306 |
+
<div className="flex justify-between">
|
| 307 |
+
<span className="text-[#92929d]">Neurological:</span>
|
| 308 |
+
<span className="text-[#44444f]">Intact</span>
|
| 309 |
+
</div>
|
| 310 |
+
</div>
|
| 311 |
+
</div>
|
| 312 |
+
</div>
|
| 313 |
+
</CardContent>
|
| 314 |
+
</Card>
|
| 315 |
+
</TabsContent>
|
| 316 |
+
|
| 317 |
+
<TabsContent value="lab-radiology" className="h-full">
|
| 318 |
+
<Card className="h-full">
|
| 319 |
+
<CardHeader>
|
| 320 |
+
<CardTitle className="text-[#171725]">Lab Results & Radiology</CardTitle>
|
| 321 |
+
</CardHeader>
|
| 322 |
+
<CardContent>
|
| 323 |
+
<div className="space-y-6">
|
| 324 |
+
<div>
|
| 325 |
+
<h4 className="font-semibold text-[#171725] mb-3">Recent Lab Results</h4>
|
| 326 |
+
<div className="overflow-x-auto">
|
| 327 |
+
<table className="w-full border border-[#e2e2ea] rounded-lg">
|
| 328 |
+
<thead className="bg-[#f1f1f5]">
|
| 329 |
+
<tr>
|
| 330 |
+
<th className="text-left p-3 text-[#92929d] font-medium">Test</th>
|
| 331 |
+
<th className="text-left p-3 text-[#92929d] font-medium">Result</th>
|
| 332 |
+
<th className="text-left p-3 text-[#92929d] font-medium">Reference Range</th>
|
| 333 |
+
<th className="text-left p-3 text-[#92929d] font-medium">Date</th>
|
| 334 |
+
</tr>
|
| 335 |
+
</thead>
|
| 336 |
+
<tbody>
|
| 337 |
+
<tr className="border-t border-[#e2e2ea]">
|
| 338 |
+
<td className="p-3 text-[#44444f]">Hemoglobin</td>
|
| 339 |
+
<td className="p-3 text-[#44444f]">12.5 g/dL</td>
|
| 340 |
+
<td className="p-3 text-[#92929d]">12.0-15.5 g/dL</td>
|
| 341 |
+
<td className="p-3 text-[#92929d]">02-01-2025</td>
|
| 342 |
+
</tr>
|
| 343 |
+
<tr className="border-t border-[#e2e2ea]">
|
| 344 |
+
<td className="p-3 text-[#44444f]">White Blood Cells</td>
|
| 345 |
+
<td className="p-3 text-[#44444f]">7,200/μL</td>
|
| 346 |
+
<td className="p-3 text-[#92929d]">4,000-11,000/μL</td>
|
| 347 |
+
<td className="p-3 text-[#92929d]">02-01-2025</td>
|
| 348 |
+
</tr>
|
| 349 |
+
</tbody>
|
| 350 |
+
</table>
|
| 351 |
+
</div>
|
| 352 |
+
</div>
|
| 353 |
+
<div>
|
| 354 |
+
<h4 className="font-semibold text-[#171725] mb-3">Radiology Reports</h4>
|
| 355 |
+
<div className="border border-[#e2e2ea] rounded-lg p-4">
|
| 356 |
+
<div className="flex justify-between items-start mb-2">
|
| 357 |
+
<h5 className="font-medium text-[#171725]">Chest X-Ray</h5>
|
| 358 |
+
<span className="text-sm text-[#92929d]">01-01-2025</span>
|
| 359 |
+
</div>
|
| 360 |
+
<p className="text-[#44444f]">Normal chest X-ray. No acute cardiopulmonary abnormalities.</p>
|
| 361 |
+
</div>
|
| 362 |
+
</div>
|
| 363 |
+
</div>
|
| 364 |
+
</CardContent>
|
| 365 |
+
</Card>
|
| 366 |
+
</TabsContent>
|
| 367 |
+
|
| 368 |
+
<TabsContent value="activity-logs" className="h-full">
|
| 369 |
+
<Card className="h-full">
|
| 370 |
+
<CardHeader>
|
| 371 |
+
<CardTitle className="text-[#171725]">Activity Logs</CardTitle>
|
| 372 |
+
</CardHeader>
|
| 373 |
+
<CardContent>
|
| 374 |
+
<div className="space-y-4">
|
| 375 |
+
<div className="flex items-start gap-3">
|
| 376 |
+
<div className="w-2 h-2 bg-[#4b4ad5] rounded-full mt-2"></div>
|
| 377 |
+
<div className="flex-1">
|
| 378 |
+
<div className="flex justify-between items-start mb-1">
|
| 379 |
+
<span className="font-medium text-[#171725]">Medication administered</span>
|
| 380 |
+
<span className="text-sm text-[#92929d]">02-01-2025 10:30 AM</span>
|
| 381 |
+
</div>
|
| 382 |
+
<p className="text-[#44444f] text-sm">Paracetamol 500mg administered by Nurse Sarah</p>
|
| 383 |
+
</div>
|
| 384 |
+
</div>
|
| 385 |
+
<div className="flex items-start gap-3">
|
| 386 |
+
<div className="w-2 h-2 bg-[#fed15e] rounded-full mt-2"></div>
|
| 387 |
+
<div className="flex-1">
|
| 388 |
+
<div className="flex justify-between items-start mb-1">
|
| 389 |
+
<span className="font-medium text-[#171725]">Vital signs recorded</span>
|
| 390 |
+
<span className="text-sm text-[#92929d]">02-01-2025 08:00 AM</span>
|
| 391 |
+
</div>
|
| 392 |
+
<p className="text-[#44444f] text-sm">BP: 120/80, HR: 72, Temp: 98.6°F</p>
|
| 393 |
+
</div>
|
| 394 |
+
</div>
|
| 395 |
+
<div className="flex items-start gap-3">
|
| 396 |
+
<div className="w-2 h-2 bg-green-500 rounded-full mt-2"></div>
|
| 397 |
+
<div className="flex-1">
|
| 398 |
+
<div className="flex justify-between items-start mb-1">
|
| 399 |
+
<span className="font-medium text-[#171725]">Doctor's round</span>
|
| 400 |
+
<span className="text-sm text-[#92929d]">01-01-2025 06:00 PM</span>
|
| 401 |
+
</div>
|
| 402 |
+
<p className="text-[#44444f] text-sm">Dr. Prudhvi Raj completed evening rounds</p>
|
| 403 |
+
</div>
|
| 404 |
+
</div>
|
| 405 |
+
</div>
|
| 406 |
+
</CardContent>
|
| 407 |
+
</Card>
|
| 408 |
+
</TabsContent>
|
| 409 |
+
</div>
|
| 410 |
+
</Tabs>
|
| 411 |
+
</div>
|
| 412 |
+
</div>
|
| 413 |
+
)
|
| 414 |
+
}
|
ipdmodule/components/ipd-patient-flow.tsx
ADDED
|
@@ -0,0 +1,171 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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Button } from "@/components/ui/button"
|
| 5 |
+
import { Card, CardContent } from "@/components/ui/card"
|
| 6 |
+
import { Badge } from "@/components/ui/badge"
|
| 7 |
+
import { Input } from "@/components/ui/input"
|
| 8 |
+
import { Search, Plus, Filter, MoreHorizontal, ArrowLeft } from "lucide-react"
|
| 9 |
+
import { AdmissionAssessment } from "./admission-assessment"
|
| 10 |
+
|
| 11 |
+
const mockPatients = [
|
| 12 |
+
{
|
| 13 |
+
id: 1,
|
| 14 |
+
name: "John Doe",
|
| 15 |
+
age: 45,
|
| 16 |
+
gender: "Male",
|
| 17 |
+
admissionDate: "2024-01-15",
|
| 18 |
+
condition: "Stable",
|
| 19 |
+
room: "A-101",
|
| 20 |
+
doctor: "Dr. Smith",
|
| 21 |
+
},
|
| 22 |
+
{
|
| 23 |
+
id: 2,
|
| 24 |
+
name: "Jane Smith",
|
| 25 |
+
age: 32,
|
| 26 |
+
gender: "Female",
|
| 27 |
+
admissionDate: "2024-01-14",
|
| 28 |
+
condition: "Critical",
|
| 29 |
+
room: "B-205",
|
| 30 |
+
doctor: "Dr. Johnson",
|
| 31 |
+
},
|
| 32 |
+
{
|
| 33 |
+
id: 3,
|
| 34 |
+
name: "Robert Wilson",
|
| 35 |
+
age: 67,
|
| 36 |
+
gender: "Male",
|
| 37 |
+
admissionDate: "2024-01-13",
|
| 38 |
+
condition: "Stable",
|
| 39 |
+
room: "C-301",
|
| 40 |
+
doctor: "Dr. Brown",
|
| 41 |
+
},
|
| 42 |
+
]
|
| 43 |
+
|
| 44 |
+
export function IPDPatientFlow() {
|
| 45 |
+
const [selectedPatient, setSelectedPatient] = useState<number | null>(null)
|
| 46 |
+
const [searchTerm, setSearchTerm] = useState("")
|
| 47 |
+
|
| 48 |
+
const filteredPatients = mockPatients.filter((patient) =>
|
| 49 |
+
patient.name.toLowerCase().includes(searchTerm.toLowerCase()),
|
| 50 |
+
)
|
| 51 |
+
|
| 52 |
+
const getConditionColor = (condition: string) => {
|
| 53 |
+
switch (condition.toLowerCase()) {
|
| 54 |
+
case "critical":
|
| 55 |
+
return "bg-red-100 text-red-800"
|
| 56 |
+
case "stable":
|
| 57 |
+
return "bg-green-100 text-green-800"
|
| 58 |
+
case "moderate":
|
| 59 |
+
return "bg-yellow-100 text-yellow-800"
|
| 60 |
+
default:
|
| 61 |
+
return "bg-gray-100 text-gray-800"
|
| 62 |
+
}
|
| 63 |
+
}
|
| 64 |
+
|
| 65 |
+
if (selectedPatient) {
|
| 66 |
+
const patient = mockPatients.find((p) => p.id === selectedPatient)
|
| 67 |
+
return (
|
| 68 |
+
<div className="p-6 bg-[#fafafb] min-h-screen">
|
| 69 |
+
<div className="mb-6">
|
| 70 |
+
<Button variant="ghost" onClick={() => setSelectedPatient(null)} className="mb-4">
|
| 71 |
+
<ArrowLeft className="h-4 w-4 mr-2" />
|
| 72 |
+
Back to Patient List
|
| 73 |
+
</Button>
|
| 74 |
+
<h1 className="text-2xl font-bold text-[#171725]">IPD Patient Details - {patient?.name}</h1>
|
| 75 |
+
</div>
|
| 76 |
+
<AdmissionAssessment />
|
| 77 |
+
</div>
|
| 78 |
+
)
|
| 79 |
+
}
|
| 80 |
+
|
| 81 |
+
return (
|
| 82 |
+
<div className="p-6 bg-[#fafafb] min-h-screen">
|
| 83 |
+
<div className="mb-6">
|
| 84 |
+
<h1 className="text-2xl font-bold text-[#171725] mb-2">IPD Patient Management</h1>
|
| 85 |
+
<p className="text-[#454551]">Manage in-patient department patients and their care</p>
|
| 86 |
+
</div>
|
| 87 |
+
|
| 88 |
+
{/* Search and Actions */}
|
| 89 |
+
<div className="flex items-center justify-between mb-6">
|
| 90 |
+
<div className="flex items-center gap-4">
|
| 91 |
+
<div className="relative">
|
| 92 |
+
<Search className="absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-[#a2a2a8]" />
|
| 93 |
+
<Input
|
| 94 |
+
placeholder="Search patients..."
|
| 95 |
+
value={searchTerm}
|
| 96 |
+
onChange={(e) => setSearchTerm(e.target.value)}
|
| 97 |
+
className="pl-10 w-80"
|
| 98 |
+
/>
|
| 99 |
+
</div>
|
| 100 |
+
<Button variant="outline" size="icon">
|
| 101 |
+
<Filter className="h-4 w-4" />
|
| 102 |
+
</Button>
|
| 103 |
+
</div>
|
| 104 |
+
<Button className="bg-[#4b4ad5] hover:bg-[#4b4ad5]/90">
|
| 105 |
+
<Plus className="h-4 w-4 mr-2" />
|
| 106 |
+
New Admission
|
| 107 |
+
</Button>
|
| 108 |
+
</div>
|
| 109 |
+
|
| 110 |
+
{/* Patient List */}
|
| 111 |
+
<div className="grid gap-4">
|
| 112 |
+
{filteredPatients.map((patient) => (
|
| 113 |
+
<Card key={patient.id} className="hover:shadow-md transition-shadow cursor-pointer">
|
| 114 |
+
<CardContent className="p-6">
|
| 115 |
+
<div className="flex items-center justify-between">
|
| 116 |
+
<div className="flex items-center gap-4">
|
| 117 |
+
<div className="w-12 h-12 bg-[#4b4ad5] rounded-full flex items-center justify-center text-white font-semibold">
|
| 118 |
+
{patient.name
|
| 119 |
+
.split(" ")
|
| 120 |
+
.map((n) => n[0])
|
| 121 |
+
.join("")}
|
| 122 |
+
</div>
|
| 123 |
+
<div>
|
| 124 |
+
<h3 className="font-semibold text-lg text-[#171725]">{patient.name}</h3>
|
| 125 |
+
<p className="text-[#454551]">
|
| 126 |
+
{patient.age} years • {patient.gender}
|
| 127 |
+
</p>
|
| 128 |
+
</div>
|
| 129 |
+
</div>
|
| 130 |
+
|
| 131 |
+
<div className="flex items-center gap-6">
|
| 132 |
+
<div className="text-right">
|
| 133 |
+
<p className="text-sm text-[#454551]">Room</p>
|
| 134 |
+
<p className="font-semibold">{patient.room}</p>
|
| 135 |
+
</div>
|
| 136 |
+
<div className="text-right">
|
| 137 |
+
<p className="text-sm text-[#454551]">Doctor</p>
|
| 138 |
+
<p className="font-semibold">{patient.doctor}</p>
|
| 139 |
+
</div>
|
| 140 |
+
<div className="text-right">
|
| 141 |
+
<p className="text-sm text-[#454551]">Admitted</p>
|
| 142 |
+
<p className="font-semibold">{new Date(patient.admissionDate).toLocaleDateString()}</p>
|
| 143 |
+
</div>
|
| 144 |
+
<Badge className={getConditionColor(patient.condition)}>{patient.condition}</Badge>
|
| 145 |
+
<div className="flex gap-2">
|
| 146 |
+
<Button
|
| 147 |
+
onClick={() => setSelectedPatient(patient.id)}
|
| 148 |
+
className="bg-[#4b4ad5] hover:bg-[#4b4ad5]/90"
|
| 149 |
+
>
|
| 150 |
+
View Details
|
| 151 |
+
</Button>
|
| 152 |
+
<Button variant="ghost" size="icon">
|
| 153 |
+
<MoreHorizontal className="h-4 w-4" />
|
| 154 |
+
</Button>
|
| 155 |
+
</div>
|
| 156 |
+
</div>
|
| 157 |
+
</div>
|
| 158 |
+
</CardContent>
|
| 159 |
+
</Card>
|
| 160 |
+
))}
|
| 161 |
+
</div>
|
| 162 |
+
|
| 163 |
+
{filteredPatients.length === 0 && (
|
| 164 |
+
<div className="text-center py-12">
|
| 165 |
+
<p className="text-[#454551] text-lg">No patients found</p>
|
| 166 |
+
<p className="text-[#a2a2a8]">Try adjusting your search criteria</p>
|
| 167 |
+
</div>
|
| 168 |
+
)}
|
| 169 |
+
</div>
|
| 170 |
+
)
|
| 171 |
+
}
|
ipdmodule/components/ipd-patient-list.tsx
ADDED
|
@@ -0,0 +1,215 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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import { Input } from "@/components/ui/input"
|
| 6 |
+
import { Button } from "@/components/ui/button"
|
| 7 |
+
import { Badge } from "@/components/ui/badge"
|
| 8 |
+
import { Search, Filter, User, MapPin, Calendar, Stethoscope } from "lucide-react"
|
| 9 |
+
|
| 10 |
+
interface Patient {
|
| 11 |
+
id: string
|
| 12 |
+
name: string
|
| 13 |
+
mrn: string
|
| 14 |
+
age: number
|
| 15 |
+
gender: string
|
| 16 |
+
ward: string
|
| 17 |
+
bed: string
|
| 18 |
+
admissionDate: string
|
| 19 |
+
diagnosis: string
|
| 20 |
+
consultant: string
|
| 21 |
+
}
|
| 22 |
+
|
| 23 |
+
interface IPDPatientListProps {
|
| 24 |
+
onPatientSelect: (patient: Patient) => void
|
| 25 |
+
}
|
| 26 |
+
|
| 27 |
+
export function IPDPatientList({ onPatientSelect }: IPDPatientListProps) {
|
| 28 |
+
const [searchTerm, setSearchTerm] = useState("")
|
| 29 |
+
const [selectedWard, setSelectedWard] = useState("all")
|
| 30 |
+
|
| 31 |
+
const patients: Patient[] = [
|
| 32 |
+
{
|
| 33 |
+
id: "1",
|
| 34 |
+
name: "John Smith",
|
| 35 |
+
mrn: "MRN001234",
|
| 36 |
+
age: 45,
|
| 37 |
+
gender: "Male",
|
| 38 |
+
ward: "General Ward",
|
| 39 |
+
bed: "A-101",
|
| 40 |
+
admissionDate: "2024-01-15",
|
| 41 |
+
diagnosis: "Acute Myocardial Infarction",
|
| 42 |
+
consultant: "Dr. Sarah Johnson",
|
| 43 |
+
},
|
| 44 |
+
{
|
| 45 |
+
id: "2",
|
| 46 |
+
name: "Mary Johnson",
|
| 47 |
+
mrn: "MRN001235",
|
| 48 |
+
age: 62,
|
| 49 |
+
gender: "Female",
|
| 50 |
+
ward: "ICU",
|
| 51 |
+
bed: "ICU-05",
|
| 52 |
+
admissionDate: "2024-01-16",
|
| 53 |
+
diagnosis: "Pneumonia with Respiratory Failure",
|
| 54 |
+
consultant: "Dr. Michael Chen",
|
| 55 |
+
},
|
| 56 |
+
{
|
| 57 |
+
id: "3",
|
| 58 |
+
name: "Robert Davis",
|
| 59 |
+
mrn: "MRN001236",
|
| 60 |
+
age: 38,
|
| 61 |
+
gender: "Male",
|
| 62 |
+
ward: "Surgical Ward",
|
| 63 |
+
bed: "S-203",
|
| 64 |
+
admissionDate: "2024-01-17",
|
| 65 |
+
diagnosis: "Acute Appendicitis",
|
| 66 |
+
consultant: "Dr. Lisa Wang",
|
| 67 |
+
},
|
| 68 |
+
{
|
| 69 |
+
id: "4",
|
| 70 |
+
name: "Emily Wilson",
|
| 71 |
+
mrn: "MRN001237",
|
| 72 |
+
age: 29,
|
| 73 |
+
gender: "Female",
|
| 74 |
+
ward: "Maternity Ward",
|
| 75 |
+
bed: "M-108",
|
| 76 |
+
admissionDate: "2024-01-18",
|
| 77 |
+
diagnosis: "Normal Delivery",
|
| 78 |
+
consultant: "Dr. James Brown",
|
| 79 |
+
},
|
| 80 |
+
{
|
| 81 |
+
id: "5",
|
| 82 |
+
name: "David Miller",
|
| 83 |
+
mrn: "MRN001238",
|
| 84 |
+
age: 71,
|
| 85 |
+
gender: "Male",
|
| 86 |
+
ward: "General Ward",
|
| 87 |
+
bed: "A-205",
|
| 88 |
+
admissionDate: "2024-01-19",
|
| 89 |
+
diagnosis: "Diabetes Mellitus with Complications",
|
| 90 |
+
consultant: "Dr. Sarah Johnson",
|
| 91 |
+
},
|
| 92 |
+
]
|
| 93 |
+
|
| 94 |
+
const wards = ["all", "General Ward", "ICU", "Surgical Ward", "Maternity Ward"]
|
| 95 |
+
|
| 96 |
+
const filteredPatients = patients.filter((patient) => {
|
| 97 |
+
const matchesSearch =
|
| 98 |
+
patient.name.toLowerCase().includes(searchTerm.toLowerCase()) ||
|
| 99 |
+
patient.mrn.toLowerCase().includes(searchTerm.toLowerCase()) ||
|
| 100 |
+
patient.diagnosis.toLowerCase().includes(searchTerm.toLowerCase())
|
| 101 |
+
|
| 102 |
+
const matchesWard = selectedWard === "all" || patient.ward === selectedWard
|
| 103 |
+
|
| 104 |
+
return matchesSearch && matchesWard
|
| 105 |
+
})
|
| 106 |
+
|
| 107 |
+
return (
|
| 108 |
+
<div className="space-y-6">
|
| 109 |
+
{/* Header */}
|
| 110 |
+
<div className="flex items-center justify-between">
|
| 111 |
+
<div>
|
| 112 |
+
<h2 className="text-2xl font-bold text-gray-900">IPD Patient List</h2>
|
| 113 |
+
<p className="text-gray-600">Select a patient to view their medical records</p>
|
| 114 |
+
</div>
|
| 115 |
+
<Badge variant="outline" className="text-lg px-3 py-1">
|
| 116 |
+
{filteredPatients.length} Patients
|
| 117 |
+
</Badge>
|
| 118 |
+
</div>
|
| 119 |
+
|
| 120 |
+
{/* Search and Filter */}
|
| 121 |
+
<div className="flex flex-col sm:flex-row gap-4">
|
| 122 |
+
<div className="relative flex-1">
|
| 123 |
+
<Search className="absolute left-3 top-1/2 transform -translate-y-1/2 text-gray-400 h-4 w-4" />
|
| 124 |
+
<Input
|
| 125 |
+
placeholder="Search by name, MRN, or diagnosis..."
|
| 126 |
+
value={searchTerm}
|
| 127 |
+
onChange={(e) => setSearchTerm(e.target.value)}
|
| 128 |
+
className="pl-10"
|
| 129 |
+
/>
|
| 130 |
+
</div>
|
| 131 |
+
<div className="flex items-center space-x-2">
|
| 132 |
+
<Filter className="h-4 w-4 text-gray-400" />
|
| 133 |
+
<select
|
| 134 |
+
value={selectedWard}
|
| 135 |
+
onChange={(e) => setSelectedWard(e.target.value)}
|
| 136 |
+
className="px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500"
|
| 137 |
+
>
|
| 138 |
+
{wards.map((ward) => (
|
| 139 |
+
<option key={ward} value={ward}>
|
| 140 |
+
{ward === "all" ? "All Wards" : ward}
|
| 141 |
+
</option>
|
| 142 |
+
))}
|
| 143 |
+
</select>
|
| 144 |
+
</div>
|
| 145 |
+
</div>
|
| 146 |
+
|
| 147 |
+
{/* Patient Cards */}
|
| 148 |
+
<div className="grid gap-4">
|
| 149 |
+
{filteredPatients.map((patient) => (
|
| 150 |
+
<Card
|
| 151 |
+
key={patient.id}
|
| 152 |
+
className="hover:shadow-md transition-shadow cursor-pointer border-l-4 border-l-blue-500"
|
| 153 |
+
onClick={() => onPatientSelect(patient)}
|
| 154 |
+
>
|
| 155 |
+
<CardContent className="p-4">
|
| 156 |
+
<div className="flex items-center justify-between">
|
| 157 |
+
<div className="flex-1">
|
| 158 |
+
<div className="flex items-center space-x-3 mb-2">
|
| 159 |
+
<User className="h-5 w-5 text-blue-600" />
|
| 160 |
+
<h3 className="text-lg font-semibold text-gray-900">{patient.name}</h3>
|
| 161 |
+
<Badge variant="secondary">
|
| 162 |
+
{patient.age}Y {patient.gender}
|
| 163 |
+
</Badge>
|
| 164 |
+
</div>
|
| 165 |
+
|
| 166 |
+
<div className="grid grid-cols-1 md:grid-cols-3 gap-2 text-sm text-gray-600">
|
| 167 |
+
<div className="flex items-center space-x-2">
|
| 168 |
+
<span className="font-medium">MRN:</span>
|
| 169 |
+
<span>{patient.mrn}</span>
|
| 170 |
+
</div>
|
| 171 |
+
<div className="flex items-center space-x-2">
|
| 172 |
+
<MapPin className="h-4 w-4" />
|
| 173 |
+
<span>
|
| 174 |
+
{patient.ward} - {patient.bed}
|
| 175 |
+
</span>
|
| 176 |
+
</div>
|
| 177 |
+
<div className="flex items-center space-x-2">
|
| 178 |
+
<Calendar className="h-4 w-4" />
|
| 179 |
+
<span>Admitted: {patient.admissionDate}</span>
|
| 180 |
+
</div>
|
| 181 |
+
</div>
|
| 182 |
+
|
| 183 |
+
<div className="mt-2 flex items-center space-x-2">
|
| 184 |
+
<Stethoscope className="h-4 w-4 text-green-600" />
|
| 185 |
+
<span className="text-sm font-medium text-gray-900">{patient.diagnosis}</span>
|
| 186 |
+
</div>
|
| 187 |
+
</div>
|
| 188 |
+
|
| 189 |
+
<div className="text-right">
|
| 190 |
+
<Badge variant="outline" className="mb-2">
|
| 191 |
+
{patient.consultant}
|
| 192 |
+
</Badge>
|
| 193 |
+
<Button variant="outline" size="sm">
|
| 194 |
+
View Records
|
| 195 |
+
</Button>
|
| 196 |
+
</div>
|
| 197 |
+
</div>
|
| 198 |
+
</CardContent>
|
| 199 |
+
</Card>
|
| 200 |
+
))}
|
| 201 |
+
</div>
|
| 202 |
+
|
| 203 |
+
{/* Empty State */}
|
| 204 |
+
{filteredPatients.length === 0 && (
|
| 205 |
+
<Card>
|
| 206 |
+
<CardContent className="text-center py-12">
|
| 207 |
+
<User className="h-12 w-12 text-gray-400 mx-auto mb-4" />
|
| 208 |
+
<h3 className="text-lg font-medium text-gray-900 mb-2">No patients found</h3>
|
| 209 |
+
<p className="text-gray-600">Try adjusting your search criteria or filters</p>
|
| 210 |
+
</CardContent>
|
| 211 |
+
</Card>
|
| 212 |
+
)}
|
| 213 |
+
</div>
|
| 214 |
+
)
|
| 215 |
+
}
|
ipdmodule/components/ipd-patient-module.tsx
ADDED
|
@@ -0,0 +1,445 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"use client"
|
| 2 |
+
|
| 3 |
+
import { useState } from "react"
|
| 4 |
+
import { Button } from "@/components/ui/button"
|
| 5 |
+
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"
|
| 6 |
+
import {
|
| 7 |
+
ChevronLeft,
|
| 8 |
+
User,
|
| 9 |
+
Calendar,
|
| 10 |
+
MapPin,
|
| 11 |
+
Stethoscope,
|
| 12 |
+
FileText,
|
| 13 |
+
TestTube,
|
| 14 |
+
ClipboardList,
|
| 15 |
+
Plus,
|
| 16 |
+
History,
|
| 17 |
+
Scissors,
|
| 18 |
+
ArrowLeftRight,
|
| 19 |
+
FolderOpen,
|
| 20 |
+
Home,
|
| 21 |
+
BarChart3,
|
| 22 |
+
} from "lucide-react"
|
| 23 |
+
|
| 24 |
+
// Import form components
|
| 25 |
+
import { AdmissionAssessmentForm } from "./admission-assessment-form"
|
| 26 |
+
import { ProgressNotesForm } from "./progress-notes-form"
|
| 27 |
+
import { ConsultantNotesForm } from "./consultant-notes-form"
|
| 28 |
+
import { OTNotesForm } from "./ot-notes-form"
|
| 29 |
+
import { CrossReferralForm } from "./cross-referral-form"
|
| 30 |
+
import { DischargeSummaryForm } from "./discharge-summary-form"
|
| 31 |
+
import { LabRadiologyTab } from "./lab-radiology-tab"
|
| 32 |
+
import { ActivityLogsTab } from "./activity-logs-tab"
|
| 33 |
+
|
| 34 |
+
interface Patient {
|
| 35 |
+
id: string
|
| 36 |
+
name: string
|
| 37 |
+
patientId: string
|
| 38 |
+
age: number
|
| 39 |
+
gender: string
|
| 40 |
+
ward: string
|
| 41 |
+
room: string
|
| 42 |
+
contact: string
|
| 43 |
+
admittingDoctor: string
|
| 44 |
+
admittedOn: string
|
| 45 |
+
mrn: string
|
| 46 |
+
bed: string
|
| 47 |
+
}
|
| 48 |
+
|
| 49 |
+
interface IPDPatientModuleProps {
|
| 50 |
+
patient: Patient
|
| 51 |
+
onBackClick: () => void
|
| 52 |
+
}
|
| 53 |
+
|
| 54 |
+
interface SavedData {
|
| 55 |
+
assessments: any[]
|
| 56 |
+
progressNotes: any[]
|
| 57 |
+
consultantNotes: any[]
|
| 58 |
+
otNotes: any[]
|
| 59 |
+
crossReferrals: any[]
|
| 60 |
+
dischargeSummaries: any[]
|
| 61 |
+
}
|
| 62 |
+
|
| 63 |
+
export function IPDPatientModule({ patient, onBackClick }: IPDPatientModuleProps) {
|
| 64 |
+
const [activeSection, setActiveSection] = useState("assessment")
|
| 65 |
+
const [currentView, setCurrentView] = useState("list") // 'list', 'form', 'preview'
|
| 66 |
+
const [savedData, setSavedData] = useState<SavedData>({
|
| 67 |
+
assessments: [],
|
| 68 |
+
progressNotes: [],
|
| 69 |
+
consultantNotes: [],
|
| 70 |
+
otNotes: [],
|
| 71 |
+
crossReferrals: [],
|
| 72 |
+
dischargeSummaries: [],
|
| 73 |
+
})
|
| 74 |
+
|
| 75 |
+
const sidebarItems = [
|
| 76 |
+
{ id: "opd-history", label: "OPD Visit History", icon: History },
|
| 77 |
+
{ id: "assessment", label: "Assessment", icon: ClipboardList },
|
| 78 |
+
{ id: "progress-notes", label: "Progress Notes", icon: FileText },
|
| 79 |
+
{ id: "consultant-notes", label: "Consultant Notes", icon: Stethoscope },
|
| 80 |
+
{ id: "ot-details", label: "OT Details", icon: Scissors },
|
| 81 |
+
{ id: "lab-reports", label: "Lab Reports", icon: TestTube },
|
| 82 |
+
{ id: "cross-referral", label: "Cross Referral", icon: ArrowLeftRight },
|
| 83 |
+
{ id: "medical-records", label: "Medical Records", icon: FolderOpen },
|
| 84 |
+
{ id: "discharge-summary", label: "Discharge Summary", icon: Home },
|
| 85 |
+
{ id: "activity-logs", label: "Activity Logs", icon: BarChart3 },
|
| 86 |
+
]
|
| 87 |
+
|
| 88 |
+
const handleSectionChange = (sectionId: string) => {
|
| 89 |
+
setActiveSection(sectionId)
|
| 90 |
+
setCurrentView("list")
|
| 91 |
+
}
|
| 92 |
+
|
| 93 |
+
const handleAddNew = () => {
|
| 94 |
+
setCurrentView("form")
|
| 95 |
+
}
|
| 96 |
+
|
| 97 |
+
const handleSave = (data: any) => {
|
| 98 |
+
const newData = { ...savedData }
|
| 99 |
+
const timestamp = new Date().toISOString()
|
| 100 |
+
const dataWithTimestamp = { ...data, id: Date.now().toString(), timestamp }
|
| 101 |
+
|
| 102 |
+
switch (activeSection) {
|
| 103 |
+
case "assessment":
|
| 104 |
+
newData.assessments.push(dataWithTimestamp)
|
| 105 |
+
break
|
| 106 |
+
case "progress-notes":
|
| 107 |
+
newData.progressNotes.push(dataWithTimestamp)
|
| 108 |
+
break
|
| 109 |
+
case "consultant-notes":
|
| 110 |
+
newData.consultantNotes.push(dataWithTimestamp)
|
| 111 |
+
break
|
| 112 |
+
case "ot-details":
|
| 113 |
+
newData.otNotes.push(dataWithTimestamp)
|
| 114 |
+
break
|
| 115 |
+
case "cross-referral":
|
| 116 |
+
newData.crossReferrals.push(dataWithTimestamp)
|
| 117 |
+
break
|
| 118 |
+
case "discharge-summary":
|
| 119 |
+
newData.dischargeSummaries.push(dataWithTimestamp)
|
| 120 |
+
break
|
| 121 |
+
}
|
| 122 |
+
|
| 123 |
+
setSavedData(newData)
|
| 124 |
+
setCurrentView("list")
|
| 125 |
+
}
|
| 126 |
+
|
| 127 |
+
const handleCancel = () => {
|
| 128 |
+
setCurrentView("list")
|
| 129 |
+
}
|
| 130 |
+
|
| 131 |
+
const renderEmptyState = (title: string, description: string, buttonText: string) => (
|
| 132 |
+
<div className="flex-1 flex items-center justify-center">
|
| 133 |
+
<div className="text-center">
|
| 134 |
+
<div className="w-24 h-24 mx-auto mb-6 bg-[#f1f1f5] rounded-full flex items-center justify-center">
|
| 135 |
+
<FileText className="w-12 h-12 text-[#92929d]" />
|
| 136 |
+
</div>
|
| 137 |
+
<h3 className="text-xl font-semibold text-[#171725] mb-2">{title}</h3>
|
| 138 |
+
<p className="text-[#92929d] mb-6 max-w-md">{description}</p>
|
| 139 |
+
<Button onClick={handleAddNew} className="bg-[#4b4ad5] hover:bg-[#4b4ad5]/90 text-white">
|
| 140 |
+
<Plus className="w-4 h-4 mr-2" />
|
| 141 |
+
{buttonText}
|
| 142 |
+
</Button>
|
| 143 |
+
</div>
|
| 144 |
+
</div>
|
| 145 |
+
)
|
| 146 |
+
|
| 147 |
+
const renderSavedItems = (items: any[], title: string, buttonText: string) => (
|
| 148 |
+
<div className="flex-1 p-6">
|
| 149 |
+
<div className="flex items-center justify-between mb-6">
|
| 150 |
+
<h2 className="text-2xl font-bold text-[#171725]">{title}</h2>
|
| 151 |
+
<Button onClick={handleAddNew} className="bg-[#4b4ad5] hover:bg-[#4b4ad5]/90 text-white">
|
| 152 |
+
<Plus className="w-4 h-4 mr-2" />
|
| 153 |
+
{buttonText}
|
| 154 |
+
</Button>
|
| 155 |
+
</div>
|
| 156 |
+
<div className="space-y-4">
|
| 157 |
+
{items.map((item) => (
|
| 158 |
+
<Card key={item.id} className="border border-[#e2e2ea]">
|
| 159 |
+
<CardHeader>
|
| 160 |
+
<div className="flex items-center justify-between">
|
| 161 |
+
<CardTitle className="text-lg text-[#171725]">
|
| 162 |
+
{activeSection === "assessment" && "Admission Assessment"}
|
| 163 |
+
{activeSection === "progress-notes" && "Progress Note"}
|
| 164 |
+
{activeSection === "consultant-notes" && "Consultant Note"}
|
| 165 |
+
{activeSection === "ot-details" && "OT Note"}
|
| 166 |
+
{activeSection === "cross-referral" && "Cross Referral"}
|
| 167 |
+
{activeSection === "discharge-summary" && "Discharge Summary"}
|
| 168 |
+
</CardTitle>
|
| 169 |
+
<span className="text-sm text-[#92929d]">
|
| 170 |
+
{new Date(item.timestamp).toLocaleDateString()} {new Date(item.timestamp).toLocaleTimeString()}
|
| 171 |
+
</span>
|
| 172 |
+
</div>
|
| 173 |
+
</CardHeader>
|
| 174 |
+
<CardContent>
|
| 175 |
+
<p className="text-[#44444f]">
|
| 176 |
+
{item.chiefComplaint ||
|
| 177 |
+
item.clinicalSummary ||
|
| 178 |
+
item.procedureName ||
|
| 179 |
+
item.reasonForReferral ||
|
| 180 |
+
"Saved entry"}
|
| 181 |
+
</p>
|
| 182 |
+
<div className="flex gap-2 mt-4">
|
| 183 |
+
<Button variant="outline" size="sm">
|
| 184 |
+
View Details
|
| 185 |
+
</Button>
|
| 186 |
+
<Button variant="outline" size="sm">
|
| 187 |
+
Edit
|
| 188 |
+
</Button>
|
| 189 |
+
</div>
|
| 190 |
+
</CardContent>
|
| 191 |
+
</Card>
|
| 192 |
+
))}
|
| 193 |
+
</div>
|
| 194 |
+
</div>
|
| 195 |
+
)
|
| 196 |
+
|
| 197 |
+
const renderMainContent = () => {
|
| 198 |
+
if (currentView === "form") {
|
| 199 |
+
switch (activeSection) {
|
| 200 |
+
case "assessment":
|
| 201 |
+
return <AdmissionAssessmentForm onSave={handleSave} onCancel={handleCancel} />
|
| 202 |
+
case "progress-notes":
|
| 203 |
+
return <ProgressNotesForm onSave={handleSave} onCancel={handleCancel} />
|
| 204 |
+
case "consultant-notes":
|
| 205 |
+
return <ConsultantNotesForm onSave={handleSave} onCancel={handleCancel} />
|
| 206 |
+
case "ot-details":
|
| 207 |
+
return <OTNotesForm onSave={handleSave} onCancel={handleCancel} />
|
| 208 |
+
case "cross-referral":
|
| 209 |
+
return <CrossReferralForm onSave={handleSave} onCancel={handleCancel} />
|
| 210 |
+
case "discharge-summary":
|
| 211 |
+
return <DischargeSummaryForm onSave={handleSave} onCancel={handleCancel} />
|
| 212 |
+
default:
|
| 213 |
+
return <div>Form not implemented</div>
|
| 214 |
+
}
|
| 215 |
+
}
|
| 216 |
+
|
| 217 |
+
// List view
|
| 218 |
+
switch (activeSection) {
|
| 219 |
+
case "opd-history":
|
| 220 |
+
return (
|
| 221 |
+
<div className="flex-1 p-6">
|
| 222 |
+
<h2 className="text-2xl font-bold text-[#171725] mb-6">OPD Visit History</h2>
|
| 223 |
+
<div className="space-y-4">
|
| 224 |
+
<Card className="border border-[#e2e2ea]">
|
| 225 |
+
<CardHeader>
|
| 226 |
+
<div className="flex items-center justify-between">
|
| 227 |
+
<CardTitle className="text-lg text-[#171725]">General Medicine Consultation</CardTitle>
|
| 228 |
+
<span className="text-sm text-[#92929d]">28-12-2024</span>
|
| 229 |
+
</div>
|
| 230 |
+
</CardHeader>
|
| 231 |
+
<CardContent>
|
| 232 |
+
<p className="text-[#44444f] mb-2">Chief Complaint: Fever and body ache for 3 days</p>
|
| 233 |
+
<p className="text-sm text-[#92929d]">Dr. {patient.admittingDoctor}</p>
|
| 234 |
+
</CardContent>
|
| 235 |
+
</Card>
|
| 236 |
+
<Card className="border border-[#e2e2ea]">
|
| 237 |
+
<CardHeader>
|
| 238 |
+
<div className="flex items-center justify-between">
|
| 239 |
+
<CardTitle className="text-lg text-[#171725]">Follow-up Consultation</CardTitle>
|
| 240 |
+
<span className="text-sm text-[#92929d]">25-12-2024</span>
|
| 241 |
+
</div>
|
| 242 |
+
</CardHeader>
|
| 243 |
+
<CardContent>
|
| 244 |
+
<p className="text-[#44444f] mb-2">Routine check-up, all parameters normal</p>
|
| 245 |
+
<p className="text-sm text-[#92929d]">Dr. {patient.admittingDoctor}</p>
|
| 246 |
+
</CardContent>
|
| 247 |
+
</Card>
|
| 248 |
+
</div>
|
| 249 |
+
</div>
|
| 250 |
+
)
|
| 251 |
+
|
| 252 |
+
case "assessment":
|
| 253 |
+
return savedData.assessments.length > 0
|
| 254 |
+
? renderSavedItems(savedData.assessments, "Assessment", "Add Assessment")
|
| 255 |
+
: renderEmptyState(
|
| 256 |
+
"No Assessment Available",
|
| 257 |
+
"Start documenting patient assessments to track clinical progress and treatment plans.",
|
| 258 |
+
"Add Assessment",
|
| 259 |
+
)
|
| 260 |
+
|
| 261 |
+
case "progress-notes":
|
| 262 |
+
return savedData.progressNotes.length > 0
|
| 263 |
+
? renderSavedItems(savedData.progressNotes, "Progress Notes", "Add Progress Note")
|
| 264 |
+
: renderEmptyState(
|
| 265 |
+
"No Progress Notes Available",
|
| 266 |
+
"Document daily progress notes to track patient recovery and treatment response.",
|
| 267 |
+
"Add Progress Note",
|
| 268 |
+
)
|
| 269 |
+
|
| 270 |
+
case "consultant-notes":
|
| 271 |
+
return savedData.consultantNotes.length > 0
|
| 272 |
+
? renderSavedItems(savedData.consultantNotes, "Consultant Notes", "Add Consultant Note")
|
| 273 |
+
: renderEmptyState(
|
| 274 |
+
"No Consultant Notes Available",
|
| 275 |
+
"Record specialist consultations and expert recommendations for comprehensive care.",
|
| 276 |
+
"Add Consultant Note",
|
| 277 |
+
)
|
| 278 |
+
|
| 279 |
+
case "ot-details":
|
| 280 |
+
return savedData.otNotes.length > 0
|
| 281 |
+
? renderSavedItems(savedData.otNotes, "OT Details", "Add OT Note")
|
| 282 |
+
: renderEmptyState(
|
| 283 |
+
"No OT Details Available",
|
| 284 |
+
"Document surgical procedures and operative details for complete medical records.",
|
| 285 |
+
"Add OT Note",
|
| 286 |
+
)
|
| 287 |
+
|
| 288 |
+
case "lab-reports":
|
| 289 |
+
return <LabRadiologyTab patient={patient} />
|
| 290 |
+
|
| 291 |
+
case "cross-referral":
|
| 292 |
+
return savedData.crossReferrals.length > 0
|
| 293 |
+
? renderSavedItems(savedData.crossReferrals, "Cross Referrals", "Add Cross Referral")
|
| 294 |
+
: renderEmptyState(
|
| 295 |
+
"No Cross Referrals Available",
|
| 296 |
+
"Create referrals to other departments or specialists for comprehensive patient care.",
|
| 297 |
+
"Add Cross Referral",
|
| 298 |
+
)
|
| 299 |
+
|
| 300 |
+
case "medical-records":
|
| 301 |
+
return (
|
| 302 |
+
<div className="flex-1 p-6">
|
| 303 |
+
<h2 className="text-2xl font-bold text-[#171725] mb-6">Medical Records</h2>
|
| 304 |
+
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4">
|
| 305 |
+
<Card className="border border-[#e2e2ea]">
|
| 306 |
+
<CardHeader>
|
| 307 |
+
<CardTitle className="text-lg text-[#171725]">Lab Reports</CardTitle>
|
| 308 |
+
</CardHeader>
|
| 309 |
+
<CardContent>
|
| 310 |
+
<p className="text-[#92929d] text-sm">Latest blood work and diagnostic tests</p>
|
| 311 |
+
<Button variant="outline" size="sm" className="mt-2 bg-transparent">
|
| 312 |
+
View Reports
|
| 313 |
+
</Button>
|
| 314 |
+
</CardContent>
|
| 315 |
+
</Card>
|
| 316 |
+
<Card className="border border-[#e2e2ea]">
|
| 317 |
+
<CardHeader>
|
| 318 |
+
<CardTitle className="text-lg text-[#171725]">Imaging Studies</CardTitle>
|
| 319 |
+
</CardHeader>
|
| 320 |
+
<CardContent>
|
| 321 |
+
<p className="text-[#92929d] text-sm">X-rays, CT scans, and MRI reports</p>
|
| 322 |
+
<Button variant="outline" size="sm" className="mt-2 bg-transparent">
|
| 323 |
+
View Images
|
| 324 |
+
</Button>
|
| 325 |
+
</CardContent>
|
| 326 |
+
</Card>
|
| 327 |
+
<Card className="border border-[#e2e2ea]">
|
| 328 |
+
<CardHeader>
|
| 329 |
+
<CardTitle className="text-lg text-[#171725]">Prescriptions</CardTitle>
|
| 330 |
+
</CardHeader>
|
| 331 |
+
<CardContent>
|
| 332 |
+
<p className="text-[#92929d] text-sm">Current and past medications</p>
|
| 333 |
+
<Button variant="outline" size="sm" className="mt-2 bg-transparent">
|
| 334 |
+
View Prescriptions
|
| 335 |
+
</Button>
|
| 336 |
+
</CardContent>
|
| 337 |
+
</Card>
|
| 338 |
+
</div>
|
| 339 |
+
</div>
|
| 340 |
+
)
|
| 341 |
+
|
| 342 |
+
case "discharge-summary":
|
| 343 |
+
return savedData.dischargeSummaries.length > 0
|
| 344 |
+
? renderSavedItems(savedData.dischargeSummaries, "Discharge Summaries", "Add Discharge Summary")
|
| 345 |
+
: renderEmptyState(
|
| 346 |
+
"No Discharge Summary Available",
|
| 347 |
+
"Create comprehensive discharge summaries for patient care continuity.",
|
| 348 |
+
"Add Discharge Summary",
|
| 349 |
+
)
|
| 350 |
+
|
| 351 |
+
case "activity-logs":
|
| 352 |
+
return <ActivityLogsTab patient={patient} />
|
| 353 |
+
|
| 354 |
+
default:
|
| 355 |
+
return renderEmptyState("Coming Soon", "This feature is under development.", "Add New")
|
| 356 |
+
}
|
| 357 |
+
}
|
| 358 |
+
|
| 359 |
+
return (
|
| 360 |
+
<div className="h-screen bg-[#fafafb] flex flex-col">
|
| 361 |
+
{/* Header */}
|
| 362 |
+
<div className="bg-white px-6 py-4 flex items-center justify-between border-b border-[#e2e2ea]">
|
| 363 |
+
<div className="flex items-center gap-4">
|
| 364 |
+
<Button variant="ghost" size="sm" onClick={onBackClick} className="text-[#44444f] hover:bg-[#f1f1f5]">
|
| 365 |
+
<ChevronLeft className="h-4 w-4" />
|
| 366 |
+
</Button>
|
| 367 |
+
<h1 className="text-xl font-semibold text-[#171725]">Patient Module</h1>
|
| 368 |
+
</div>
|
| 369 |
+
<div className="flex items-center gap-4">
|
| 370 |
+
<Button variant="outline" size="sm" className="text-[#4b4ad5] border-[#4b4ad5] bg-transparent">
|
| 371 |
+
Tutorial
|
| 372 |
+
</Button>
|
| 373 |
+
<select className="border border-[#e2e2ea] rounded px-3 py-1 text-sm">
|
| 374 |
+
<option>Hospital Name</option>
|
| 375 |
+
</select>
|
| 376 |
+
</div>
|
| 377 |
+
</div>
|
| 378 |
+
|
| 379 |
+
<div className="flex flex-1">
|
| 380 |
+
{/* Left Sidebar */}
|
| 381 |
+
<div className="w-64 bg-white border-r border-[#e2e2ea] flex flex-col">
|
| 382 |
+
{/* Patient Info */}
|
| 383 |
+
<div className="p-4 border-b border-[#e2e2ea]">
|
| 384 |
+
<div className="flex items-center gap-3">
|
| 385 |
+
<div className="w-12 h-12 bg-[#4b4ad5] rounded-full flex items-center justify-center">
|
| 386 |
+
<User className="h-6 w-6 text-white" />
|
| 387 |
+
</div>
|
| 388 |
+
<div>
|
| 389 |
+
<h3 className="font-semibold text-[#171725]">{patient.name}</h3>
|
| 390 |
+
<p className="text-sm text-[#92929d]">
|
| 391 |
+
{patient.gender}, {patient.age}Y | {patient.patientId}
|
| 392 |
+
</p>
|
| 393 |
+
</div>
|
| 394 |
+
</div>
|
| 395 |
+
<div className="mt-3 space-y-1 text-sm">
|
| 396 |
+
<div className="flex items-center gap-2">
|
| 397 |
+
<MapPin className="h-3 w-3 text-[#92929d]" />
|
| 398 |
+
<span className="text-[#44444f]">
|
| 399 |
+
{patient.ward} - {patient.room}
|
| 400 |
+
</span>
|
| 401 |
+
</div>
|
| 402 |
+
<div className="flex items-center gap-2">
|
| 403 |
+
<Calendar className="h-3 w-3 text-[#92929d]" />
|
| 404 |
+
<span className="text-[#44444f]">Admitted: {patient.admittedOn}</span>
|
| 405 |
+
</div>
|
| 406 |
+
</div>
|
| 407 |
+
</div>
|
| 408 |
+
|
| 409 |
+
{/* Navigation */}
|
| 410 |
+
<div className="flex-1 py-4">
|
| 411 |
+
{sidebarItems.map((item) => {
|
| 412 |
+
const Icon = item.icon
|
| 413 |
+
const isActive = activeSection === item.id
|
| 414 |
+
return (
|
| 415 |
+
<button
|
| 416 |
+
key={item.id}
|
| 417 |
+
onClick={() => handleSectionChange(item.id)}
|
| 418 |
+
className={`w-full flex items-center gap-3 px-4 py-3 text-left hover:bg-[#f1f1f5] transition-colors ${
|
| 419 |
+
isActive ? "bg-[#4b4ad5] text-white" : "text-[#44444f]"
|
| 420 |
+
}`}
|
| 421 |
+
>
|
| 422 |
+
<Icon className="h-4 w-4" />
|
| 423 |
+
<span className="text-sm font-medium">{item.label}</span>
|
| 424 |
+
</button>
|
| 425 |
+
)
|
| 426 |
+
})}
|
| 427 |
+
</div>
|
| 428 |
+
</div>
|
| 429 |
+
|
| 430 |
+
{/* Main Content */}
|
| 431 |
+
<div className="flex-1 flex flex-col">
|
| 432 |
+
{/* Section Header */}
|
| 433 |
+
<div className="bg-[#fed15e] px-6 py-4">
|
| 434 |
+
<h2 className="text-2xl font-bold text-[#171725]">
|
| 435 |
+
{sidebarItems.find((item) => item.id === activeSection)?.label}
|
|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
|
| 3 |
+
import { useState } from "react"
|
| 4 |
+
import { Button } from "@/components/ui/button"
|
| 5 |
+
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"
|
| 6 |
+
import { Input } from "@/components/ui/input"
|
| 7 |
+
import { Label } from "@/components/ui/label"
|
| 8 |
+
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select"
|
| 9 |
+
import { Badge } from "@/components/ui/badge"
|
| 10 |
+
import { Checkbox } from "@/components/ui/checkbox"
|
| 11 |
+
import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs"
|
| 12 |
+
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "@/components/ui/table"
|
| 13 |
+
import {
|
| 14 |
+
Download,
|
| 15 |
+
Eye,
|
| 16 |
+
TrendingUp,
|
| 17 |
+
TrendingDown,
|
| 18 |
+
Minus,
|
| 19 |
+
AlertTriangle,
|
| 20 |
+
CheckCircle,
|
| 21 |
+
Plus,
|
| 22 |
+
Search,
|
| 23 |
+
X,
|
| 24 |
+
ImageIcon,
|
| 25 |
+
Activity,
|
| 26 |
+
} from "lucide-react"
|
| 27 |
+
|
| 28 |
+
interface LabRadiologyTabProps {
|
| 29 |
+
patient: any
|
| 30 |
+
}
|
| 31 |
+
|
| 32 |
+
interface LabResult {
|
| 33 |
+
id: string
|
| 34 |
+
testName: string
|
| 35 |
+
parameter: string
|
| 36 |
+
value: string
|
| 37 |
+
unit: string
|
| 38 |
+
normalRange: string
|
| 39 |
+
status: "normal" | "high" | "low" | "critical"
|
| 40 |
+
date: string
|
| 41 |
+
time: string
|
| 42 |
+
reportedBy: string
|
| 43 |
+
selectedForDischarge: boolean
|
| 44 |
+
}
|
| 45 |
+
|
| 46 |
+
interface RadiologyReport {
|
| 47 |
+
id: string
|
| 48 |
+
examType: string
|
| 49 |
+
bodyPart: string
|
| 50 |
+
findings: string
|
| 51 |
+
impression: string
|
| 52 |
+
date: string
|
| 53 |
+
time: string
|
| 54 |
+
radiologist: string
|
| 55 |
+
status: "pending" | "reported" | "reviewed"
|
| 56 |
+
selectedForDischarge: boolean
|
| 57 |
+
imageUrl?: string
|
| 58 |
+
}
|
| 59 |
+
|
| 60 |
+
export function LabRadiologyTab({ patient }: LabRadiologyTabProps) {
|
| 61 |
+
const [activeTab, setActiveTab] = useState("lab-results")
|
| 62 |
+
const [searchTerm, setSearchTerm] = useState("")
|
| 63 |
+
const [dateFilter, setDateFilter] = useState("all")
|
| 64 |
+
const [statusFilter, setStatusFilter] = useState("all")
|
| 65 |
+
|
| 66 |
+
// Sample lab results data with date-wise comparison
|
| 67 |
+
const [labResults, setLabResults] = useState<LabResult[]>([
|
| 68 |
+
{
|
| 69 |
+
id: "lab-001",
|
| 70 |
+
testName: "Complete Blood Count (CBC)",
|
| 71 |
+
parameter: "Hemoglobin (Hb)",
|
| 72 |
+
value: "7.2",
|
| 73 |
+
unit: "g/dL",
|
| 74 |
+
normalRange: "12.0-15.5",
|
| 75 |
+
status: "low",
|
| 76 |
+
date: "2024-01-18",
|
| 77 |
+
time: "08:30",
|
| 78 |
+
reportedBy: "Dr. Pathology",
|
| 79 |
+
selectedForDischarge: true,
|
| 80 |
+
},
|
| 81 |
+
{
|
| 82 |
+
id: "lab-002",
|
| 83 |
+
testName: "Complete Blood Count (CBC)",
|
| 84 |
+
parameter: "White Blood Cells (WBC)",
|
| 85 |
+
value: "12,500",
|
| 86 |
+
unit: "/μL",
|
| 87 |
+
normalRange: "4,000-11,000",
|
| 88 |
+
status: "high",
|
| 89 |
+
date: "2024-01-18",
|
| 90 |
+
time: "08:30",
|
| 91 |
+
reportedBy: "Dr. Pathology",
|
| 92 |
+
selectedForDischarge: true,
|
| 93 |
+
},
|
| 94 |
+
{
|
| 95 |
+
id: "lab-003",
|
| 96 |
+
testName: "Complete Blood Count (CBC)",
|
| 97 |
+
parameter: "Platelets",
|
| 98 |
+
value: "180,000",
|
| 99 |
+
unit: "/μL",
|
| 100 |
+
normalRange: "150,000-450,000",
|
| 101 |
+
status: "normal",
|
| 102 |
+
date: "2024-01-18",
|
| 103 |
+
time: "08:30",
|
| 104 |
+
reportedBy: "Dr. Pathology",
|
| 105 |
+
selectedForDischarge: false,
|
| 106 |
+
},
|
| 107 |
+
{
|
| 108 |
+
id: "lab-004",
|
| 109 |
+
testName: "Liver Function Test (LFT)",
|
| 110 |
+
parameter: "ALT",
|
| 111 |
+
value: "45",
|
| 112 |
+
unit: "U/L",
|
| 113 |
+
normalRange: "7-35",
|
| 114 |
+
status: "high",
|
| 115 |
+
date: "2024-01-17",
|
| 116 |
+
time: "14:15",
|
| 117 |
+
reportedBy: "Dr. Pathology",
|
| 118 |
+
selectedForDischarge: true,
|
| 119 |
+
},
|
| 120 |
+
{
|
| 121 |
+
id: "lab-005",
|
| 122 |
+
testName: "Kidney Function Test",
|
| 123 |
+
parameter: "Creatinine",
|
| 124 |
+
value: "1.8",
|
| 125 |
+
unit: "mg/dL",
|
| 126 |
+
normalRange: "0.6-1.2",
|
| 127 |
+
status: "high",
|
| 128 |
+
date: "2024-01-17",
|
| 129 |
+
time: "14:15",
|
| 130 |
+
reportedBy: "Dr. Pathology",
|
| 131 |
+
selectedForDischarge: true,
|
| 132 |
+
},
|
| 133 |
+
// Previous day results for comparison
|
| 134 |
+
{
|
| 135 |
+
id: "lab-006",
|
| 136 |
+
testName: "Complete Blood Count (CBC)",
|
| 137 |
+
parameter: "Hemoglobin (Hb)",
|
| 138 |
+
value: "6.8",
|
| 139 |
+
unit: "g/dL",
|
| 140 |
+
normalRange: "12.0-15.5",
|
| 141 |
+
status: "critical",
|
| 142 |
+
date: "2024-01-16",
|
| 143 |
+
time: "09:00",
|
| 144 |
+
reportedBy: "Dr. Pathology",
|
| 145 |
+
selectedForDischarge: false,
|
| 146 |
+
},
|
| 147 |
+
{
|
| 148 |
+
id: "lab-007",
|
| 149 |
+
testName: "Complete Blood Count (CBC)",
|
| 150 |
+
parameter: "White Blood Cells (WBC)",
|
| 151 |
+
value: "15,200",
|
| 152 |
+
unit: "/μL",
|
| 153 |
+
normalRange: "4,000-11,000",
|
| 154 |
+
status: "high",
|
| 155 |
+
date: "2024-01-16",
|
| 156 |
+
time: "09:00",
|
| 157 |
+
reportedBy: "Dr. Pathology",
|
| 158 |
+
selectedForDischarge: false,
|
| 159 |
+
},
|
| 160 |
+
])
|
| 161 |
+
|
| 162 |
+
// Sample radiology reports data
|
| 163 |
+
const [radiologyReports, setRadiologyReports] = useState<RadiologyReport[]>([
|
| 164 |
+
{
|
| 165 |
+
id: "rad-001",
|
| 166 |
+
examType: "Chest X-Ray",
|
| 167 |
+
bodyPart: "Chest",
|
| 168 |
+
findings: "Bilateral lower lobe consolidation with air bronchograms. No pleural effusion. Heart size normal.",
|
| 169 |
+
impression: "Bilateral pneumonia",
|
| 170 |
+
date: "2024-01-18",
|
| 171 |
+
time: "10:30",
|
| 172 |
+
radiologist: "Dr. Radiology Smith",
|
| 173 |
+
status: "reported",
|
| 174 |
+
selectedForDischarge: true,
|
| 175 |
+
imageUrl: "/placeholder.svg?height=300&width=400&text=Chest+X-Ray",
|
| 176 |
+
},
|
| 177 |
+
{
|
| 178 |
+
id: "rad-002",
|
| 179 |
+
examType: "CT Chest",
|
| 180 |
+
bodyPart: "Chest",
|
| 181 |
+
findings:
|
| 182 |
+
"Multiple ground glass opacities in bilateral lungs. No mediastinal lymphadenopathy. No pleural effusion.",
|
| 183 |
+
impression: "Viral pneumonia, COVID-19 suspected",
|
| 184 |
+
date: "2024-01-17",
|
| 185 |
+
time: "16:45",
|
| 186 |
+
radiologist: "Dr. Radiology Johnson",
|
| 187 |
+
status: "reported",
|
| 188 |
+
selectedForDischarge: true,
|
| 189 |
+
imageUrl: "/placeholder.svg?height=300&width=400&text=CT+Chest",
|
| 190 |
+
},
|
| 191 |
+
{
|
| 192 |
+
id: "rad-003",
|
| 193 |
+
examType: "Ultrasound Abdomen",
|
| 194 |
+
bodyPart: "Abdomen",
|
| 195 |
+
findings: "Liver shows normal echogenicity. Gallbladder normal. Kidneys show normal size and echogenicity.",
|
| 196 |
+
impression: "Normal abdominal ultrasound",
|
| 197 |
+
date: "2024-01-16",
|
| 198 |
+
time: "11:20",
|
| 199 |
+
radiologist: "Dr. Radiology Brown",
|
| 200 |
+
status: "reported",
|
| 201 |
+
selectedForDischarge: false,
|
| 202 |
+
},
|
| 203 |
+
])
|
| 204 |
+
|
| 205 |
+
const getStatusColor = (status: string) => {
|
| 206 |
+
switch (status) {
|
| 207 |
+
case "critical":
|
| 208 |
+
return "bg-red-100 text-red-800 border-red-200"
|
| 209 |
+
case "high":
|
| 210 |
+
return "bg-orange-100 text-orange-800 border-orange-200"
|
| 211 |
+
case "low":
|
| 212 |
+
return "bg-yellow-100 text-yellow-800 border-yellow-200"
|
| 213 |
+
case "normal":
|
| 214 |
+
return "bg-green-100 text-green-800 border-green-200"
|
| 215 |
+
case "pending":
|
| 216 |
+
return "bg-gray-100 text-gray-800 border-gray-200"
|
| 217 |
+
case "reported":
|
| 218 |
+
return "bg-blue-100 text-blue-800 border-blue-200"
|
| 219 |
+
case "reviewed":
|
| 220 |
+
return "bg-green-100 text-green-800 border-green-200"
|
| 221 |
+
default:
|
| 222 |
+
return "bg-gray-100 text-gray-800 border-gray-200"
|
| 223 |
+
}
|
| 224 |
+
}
|
| 225 |
+
|
| 226 |
+
const getStatusIcon = (status: string) => {
|
| 227 |
+
switch (status) {
|
| 228 |
+
case "critical":
|
| 229 |
+
return <AlertTriangle className="w-3 h-3" />
|
| 230 |
+
case "high":
|
| 231 |
+
return <TrendingUp className="w-3 h-3" />
|
| 232 |
+
case "low":
|
| 233 |
+
return <TrendingDown className="w-3 h-3" />
|
| 234 |
+
case "normal":
|
| 235 |
+
return <CheckCircle className="w-3 h-3" />
|
| 236 |
+
default:
|
| 237 |
+
return <Minus className="w-3 h-3" />
|
| 238 |
+
}
|
| 239 |
+
}
|
| 240 |
+
|
| 241 |
+
const toggleLabSelection = (labId: string) => {
|
| 242 |
+
setLabResults((prev) =>
|
| 243 |
+
prev.map((lab) => (lab.id === labId ? { ...lab, selectedForDischarge: !lab.selectedForDischarge } : lab)),
|
| 244 |
+
)
|
| 245 |
+
}
|
| 246 |
+
|
| 247 |
+
const toggleRadiologySelection = (reportId: string) => {
|
| 248 |
+
setRadiologyReports((prev) =>
|
| 249 |
+
prev.map((report) =>
|
| 250 |
+
report.id === reportId ? { ...report, selectedForDischarge: !report.selectedForDischarge } : report,
|
| 251 |
+
),
|
| 252 |
+
)
|
| 253 |
+
}
|
| 254 |
+
|
| 255 |
+
const getSelectedLabResults = () => {
|
| 256 |
+
return labResults.filter((lab) => lab.selectedForDischarge)
|
| 257 |
+
}
|
| 258 |
+
|
| 259 |
+
const getSelectedRadiologyReports = () => {
|
| 260 |
+
return radiologyReports.filter((report) => report.selectedForDischarge)
|
| 261 |
+
}
|
| 262 |
+
|
| 263 |
+
// Group lab results by parameter for trend analysis
|
| 264 |
+
const getParameterTrends = () => {
|
| 265 |
+
const trends: { [key: string]: LabResult[] } = {}
|
| 266 |
+
labResults.forEach((lab) => {
|
| 267 |
+
if (!trends[lab.parameter]) {
|
| 268 |
+
trends[lab.parameter] = []
|
| 269 |
+
}
|
| 270 |
+
trends[lab.parameter].push(lab)
|
| 271 |
+
})
|
| 272 |
+
|
| 273 |
+
// Sort by date for each parameter
|
| 274 |
+
Object.keys(trends).forEach((param) => {
|
| 275 |
+
trends[param].sort((a, b) => new Date(b.date).getTime() - new Date(a.date).getTime())
|
| 276 |
+
})
|
| 277 |
+
|
| 278 |
+
return trends
|
| 279 |
+
}
|
| 280 |
+
|
| 281 |
+
const filteredLabResults = labResults.filter((lab) => {
|
| 282 |
+
const matchesSearch =
|
| 283 |
+
lab.testName.toLowerCase().includes(searchTerm.toLowerCase()) ||
|
| 284 |
+
lab.parameter.toLowerCase().includes(searchTerm.toLowerCase())
|
| 285 |
+
const matchesDate = dateFilter === "all" || lab.date === dateFilter
|
| 286 |
+
const matchesStatus = statusFilter === "all" || lab.status === statusFilter
|
| 287 |
+
return matchesSearch && matchesDate && matchesStatus
|
| 288 |
+
})
|
| 289 |
+
|
| 290 |
+
const filteredRadiologyReports = radiologyReports.filter((report) => {
|
| 291 |
+
const matchesSearch =
|
| 292 |
+
report.examType.toLowerCase().includes(searchTerm.toLowerCase()) ||
|
| 293 |
+
report.bodyPart.toLowerCase().includes(searchTerm.toLowerCase()) ||
|
| 294 |
+
report.findings.toLowerCase().includes(searchTerm.toLowerCase())
|
| 295 |
+
const matchesDate = dateFilter === "all" || report.date === dateFilter
|
| 296 |
+
const matchesStatus = statusFilter === "all" || report.status === statusFilter
|
| 297 |
+
return matchesSearch && matchesDate && matchesStatus
|
| 298 |
+
})
|
| 299 |
+
|
| 300 |
+
return (
|
| 301 |
+
<div className="space-y-6">
|
| 302 |
+
{/* Header */}
|
| 303 |
+
<div className="flex items-center justify-between">
|
| 304 |
+
<div>
|
| 305 |
+
<h2 className="text-xl font-semibold">Lab Results & Radiology Reports</h2>
|
| 306 |
+
<p className="text-sm text-gray-600">View and select investigations for discharge summary - {patient.name}</p>
|
| 307 |
+
</div>
|
| 308 |
+
<div className="flex gap-2">
|
| 309 |
+
<Badge variant="outline" className="gap-1">
|
| 310 |
+
<Activity className="w-3 h-3" />
|
| 311 |
+
{getSelectedLabResults().length} Lab Results Selected
|
| 312 |
+
</Badge>
|
| 313 |
+
<Badge variant="outline" className="gap-1">
|
| 314 |
+
<ImageIcon className="w-3 h-3" />
|
| 315 |
+
{getSelectedRadiologyReports().length} Reports Selected
|
| 316 |
+
</Badge>
|
| 317 |
+
</div>
|
| 318 |
+
</div>
|
| 319 |
+
|
| 320 |
+
{/* Filters */}
|
| 321 |
+
<Card>
|
| 322 |
+
<CardContent className="p-4">
|
| 323 |
+
<div className="flex flex-wrap gap-4 items-center">
|
| 324 |
+
<div className="flex-1 min-w-64">
|
| 325 |
+
<div className="relative">
|
| 326 |
+
<Search className="absolute left-3 top-1/2 transform -translate-y-1/2 text-gray-400 w-4 h-4" />
|
| 327 |
+
<Input
|
| 328 |
+
placeholder="Search tests, parameters, or findings..."
|
| 329 |
+
value={searchTerm}
|
| 330 |
+
onChange={(e) => setSearchTerm(e.target.value)}
|
| 331 |
+
className="pl-10"
|
| 332 |
+
/>
|
| 333 |
+
</div>
|
| 334 |
+
</div>
|
| 335 |
+
<div className="flex gap-2">
|
| 336 |
+
<Select value={dateFilter} onValueChange={setDateFilter}>
|
| 337 |
+
<SelectTrigger className="w-40">
|
| 338 |
+
<SelectValue placeholder="Filter by date" />
|
| 339 |
+
</SelectTrigger>
|
| 340 |
+
<SelectContent>
|
| 341 |
+
<SelectItem value="all">All Dates</SelectItem>
|
| 342 |
+
<SelectItem value="2024-01-18">Today (18 Jan)</SelectItem>
|
| 343 |
+
<SelectItem value="2024-01-17">Yesterday (17 Jan)</SelectItem>
|
| 344 |
+
<SelectItem value="2024-01-16">16 Jan 2024</SelectItem>
|
| 345 |
+
</SelectContent>
|
| 346 |
+
</Select>
|
| 347 |
+
<Select value={statusFilter} onValueChange={setStatusFilter}>
|
| 348 |
+
<SelectTrigger className="w-32">
|
| 349 |
+
<SelectValue placeholder="Status" />
|
| 350 |
+
</SelectTrigger>
|
| 351 |
+
<SelectContent>
|
| 352 |
+
<SelectItem value="all">All Status</SelectItem>
|
| 353 |
+
<SelectItem value="critical">Critical</SelectItem>
|
| 354 |
+
<SelectItem value="high">High</SelectItem>
|
| 355 |
+
<SelectItem value="low">Low</SelectItem>
|
| 356 |
+
<SelectItem value="normal">Normal</SelectItem>
|
| 357 |
+
<SelectItem value="pending">Pending</SelectItem>
|
| 358 |
+
<SelectItem value="reported">Reported</SelectItem>
|
| 359 |
+
</SelectContent>
|
| 360 |
+
</Select>
|
| 361 |
+
{(searchTerm || dateFilter !== "all" || statusFilter !== "all") && (
|
| 362 |
+
<Button
|
| 363 |
+
variant="outline"
|
| 364 |
+
size="sm"
|
| 365 |
+
onClick={() => {
|
| 366 |
+
setSearchTerm("")
|
| 367 |
+
setDateFilter("all")
|
| 368 |
+
setStatusFilter("all")
|
| 369 |
+
}}
|
| 370 |
+
>
|
| 371 |
+
<X className="w-4 h-4 mr-1" />
|
| 372 |
+
Clear
|
| 373 |
+
</Button>
|
| 374 |
+
)}
|
| 375 |
+
</div>
|
| 376 |
+
</div>
|
| 377 |
+
</CardContent>
|
| 378 |
+
</Card>
|
| 379 |
+
|
| 380 |
+
{/* Main Content Tabs */}
|
| 381 |
+
<Tabs value={activeTab} onValueChange={setActiveTab}>
|
| 382 |
+
<TabsList className="grid w-full grid-cols-3">
|
| 383 |
+
<TabsTrigger value="lab-results">Lab Results</TabsTrigger>
|
| 384 |
+
<TabsTrigger value="radiology">Radiology Reports</TabsTrigger>
|
| 385 |
+
<TabsTrigger value="trends">Trend Analysis</TabsTrigger>
|
| 386 |
+
</TabsList>
|
| 387 |
+
|
| 388 |
+
{/* Lab Results Tab */}
|
| 389 |
+
<TabsContent value="lab-results" className="space-y-4">
|
| 390 |
+
<Card>
|
| 391 |
+
<CardHeader>
|
| 392 |
+
<CardTitle className="flex items-center justify-between">
|
| 393 |
+
<span>Laboratory Results</span>
|
| 394 |
+
<div className="flex gap-2">
|
| 395 |
+
<Button size="sm" variant="outline">
|
| 396 |
+
<Download className="w-4 h-4 mr-2" />
|
| 397 |
+
Export Selected
|
| 398 |
+
</Button>
|
| 399 |
+
<Button size="sm" variant="outline">
|
| 400 |
+
<Plus className="w-4 h-4 mr-2" />
|
| 401 |
+
Add to Discharge Summary
|
| 402 |
+
</Button>
|
| 403 |
+
</div>
|
| 404 |
+
</CardTitle>
|
| 405 |
+
</CardHeader>
|
| 406 |
+
<CardContent>
|
| 407 |
+
<Table>
|
| 408 |
+
<TableHeader>
|
| 409 |
+
<TableRow>
|
| 410 |
+
<TableHead className="w-12">Select</TableHead>
|
| 411 |
+
<TableHead>Test Name</TableHead>
|
| 412 |
+
<TableHead>Parameter</TableHead>
|
| 413 |
+
<TableHead>Value</TableHead>
|
| 414 |
+
<TableHead>Normal Range</TableHead>
|
| 415 |
+
<TableHead>Status</TableHead>
|
| 416 |
+
<TableHead>Date/Time</TableHead>
|
| 417 |
+
<TableHead>Reported By</TableHead>
|
| 418 |
+
</TableRow>
|
| 419 |
+
</TableHeader>
|
| 420 |
+
<TableBody>
|
| 421 |
+
{filteredLabResults.map((lab) => (
|
| 422 |
+
<TableRow key={lab.id} className={lab.selectedForDischarge ? "bg-blue-50" : ""}>
|
| 423 |
+
<TableCell>
|
| 424 |
+
<Checkbox
|
| 425 |
+
checked={lab.selectedForDischarge}
|
| 426 |
+
onCheckedChange={() => toggleLabSelection(lab.id)}
|
| 427 |
+
/>
|
| 428 |
+
</TableCell>
|
| 429 |
+
<TableCell className="font-medium">{lab.testName}</TableCell>
|
| 430 |
+
<TableCell>{lab.parameter}</TableCell>
|
| 431 |
+
<TableCell className="font-mono">
|
| 432 |
+
{lab.value} {lab.unit}
|
| 433 |
+
</TableCell>
|
| 434 |
+
<TableCell className="text-sm text-gray-600">{lab.normalRange}</TableCell>
|
| 435 |
+
<TableCell>
|
| 436 |
+
<Badge className={getStatusColor(lab.status)}>
|
| 437 |
+
{getStatusIcon(lab.status)}
|
| 438 |
+
<span className="ml-1 capitalize">{lab.status}</span>
|
| 439 |
+
</Badge>
|
| 440 |
+
</TableCell>
|
| 441 |
+
<TableCell className="text-sm">
|
| 442 |
+
<div>{lab.date}</div>
|
| 443 |
+
<div className="text-gray-500">{lab.time}</div>
|
| 444 |
+
</TableCell>
|
| 445 |
+
<TableCell className="text-sm">{lab.reportedBy}</TableCell>
|
| 446 |
+
</TableRow>
|
| 447 |
+
))}
|
| 448 |
+
</TableBody>
|
| 449 |
+
</Table>
|
| 450 |
+
</CardContent>
|
| 451 |
+
</Card>
|
| 452 |
+
</TabsContent>
|
| 453 |
+
|
| 454 |
+
{/* Radiology Reports Tab */}
|
| 455 |
+
<TabsContent value="radiology" className="space-y-4">
|
| 456 |
+
<div className="grid gap-4">
|
| 457 |
+
{filteredRadiologyReports.map((report) => (
|
| 458 |
+
<Card key={report.id} className={report.selectedForDischarge ? "border-blue-500 bg-blue-50" : ""}>
|
| 459 |
+
<CardHeader>
|
| 460 |
+
<div className="flex items-center justify-between">
|
| 461 |
+
<div className="flex items-center gap-3">
|
| 462 |
+
<Checkbox
|
| 463 |
+
checked={report.selectedForDischarge}
|
| 464 |
+
onCheckedChange={() => toggleRadiologySelection(report.id)}
|
| 465 |
+
/>
|
| 466 |
+
<div>
|
| 467 |
+
<CardTitle className="text-lg">{report.examType}</CardTitle>
|
| 468 |
+
<p className="text-sm text-gray-600">{report.bodyPart}</p>
|
| 469 |
+
</div>
|
| 470 |
+
</div>
|
| 471 |
+
<div className="flex items-center gap-2">
|
| 472 |
+
<Badge className={getStatusColor(report.status)}>{report.status}</Badge>
|
| 473 |
+
<div className="text-sm text-gray-600">
|
| 474 |
+
<div>{report.date}</div>
|
| 475 |
+
<div>{report.time}</div>
|
| 476 |
+
</div>
|
| 477 |
+
</div>
|
| 478 |
+
</div>
|
| 479 |
+
</CardHeader>
|
| 480 |
+
<CardContent>
|
| 481 |
+
<div className="grid md:grid-cols-2 gap-4">
|
| 482 |
+
<div className="space-y-4">
|
| 483 |
+
<div>
|
| 484 |
+
<Label className="font-medium">Findings:</Label>
|
| 485 |
+
<p className="text-sm text-gray-700 mt-1">{report.findings}</p>
|
| 486 |
+
</div>
|
| 487 |
+
<div>
|
| 488 |
+
<Label className="font-medium">Impression:</Label>
|
| 489 |
+
<p className="text-sm font-medium text-gray-900 mt-1">{report.impression}</p>
|
| 490 |
+
</div>
|
| 491 |
+
<div>
|
| 492 |
+
<Label className="font-medium">Radiologist:</Label>
|
| 493 |
+
<p className="text-sm text-gray-700 mt-1">{report.radiologist}</p>
|
| 494 |
+
</div>
|
| 495 |
+
</div>
|
| 496 |
+
{report.imageUrl && (
|
| 497 |
+
<div>
|
| 498 |
+
<Label className="font-medium">Image:</Label>
|
| 499 |
+
<div className="mt-2 border rounded-lg overflow-hidden">
|
| 500 |
+
<img
|
| 501 |
+
src={report.imageUrl || "/placeholder.svg"}
|
| 502 |
+
alt={`${report.examType} - ${report.bodyPart}`}
|
| 503 |
+
className="w-full h-48 object-cover"
|
| 504 |
+
/>
|
| 505 |
+
</div>
|
| 506 |
+
<div className="flex gap-2 mt-2">
|
| 507 |
+
<Button size="sm" variant="outline">
|
| 508 |
+
<Eye className="w-4 h-4 mr-1" />
|
| 509 |
+
View Full
|
| 510 |
+
</Button>
|
| 511 |
+
<Button size="sm" variant="outline">
|
| 512 |
+
<Download className="w-4 h-4 mr-1" />
|
| 513 |
+
Download
|
| 514 |
+
</Button>
|
| 515 |
+
</div>
|
| 516 |
+
</div>
|
| 517 |
+
)}
|
| 518 |
+
</div>
|
| 519 |
+
</CardContent>
|
| 520 |
+
</Card>
|
| 521 |
+
))}
|
| 522 |
+
</div>
|
| 523 |
+
</TabsContent>
|
| 524 |
+
|
| 525 |
+
{/* Trend Analysis Tab */}
|
| 526 |
+
<TabsContent value="trends" className="space-y-4">
|
| 527 |
+
<Card>
|
| 528 |
+
<CardHeader>
|
| 529 |
+
<CardTitle>Parameter Trends & Comparison</CardTitle>
|
| 530 |
+
<p className="text-sm text-gray-600">Date-wise comparison of lab parameters to track patient progress</p>
|
| 531 |
+
</CardHeader>
|
| 532 |
+
<CardContent>
|
| 533 |
+
<div className="space-y-6">
|
| 534 |
+
{Object.entries(getParameterTrends()).map(([parameter, results]) => (
|
| 535 |
+
<div key={parameter} className="border rounded-lg p-4">
|
| 536 |
+
<h3 className="font-medium text-lg mb-3">{parameter}</h3>
|
| 537 |
+
<Table>
|
| 538 |
+
<TableHeader>
|
| 539 |
+
<TableRow>
|
| 540 |
+
<TableHead>Date</TableHead>
|
| 541 |
+
<TableHead>Value</TableHead>
|
| 542 |
+
<TableHead>Status</TableHead>
|
| 543 |
+
<TableHead>Trend</TableHead>
|
| 544 |
+
<TableHead>Normal Range</TableHead>
|
| 545 |
+
</TableRow>
|
| 546 |
+
</TableHeader>
|
| 547 |
+
<TableBody>
|
| 548 |
+
{results.map((result, index) => {
|
| 549 |
+
const prevResult = results[index + 1]
|
| 550 |
+
let trend = "stable"
|
| 551 |
+
if (prevResult) {
|
| 552 |
+
const currentVal = Number.parseFloat(result.value.replace(/,/g, ""))
|
| 553 |
+
const prevVal = Number.parseFloat(prevResult.value.replace(/,/g, ""))
|
| 554 |
+
if (currentVal > prevVal) trend = "up"
|
| 555 |
+
else if (currentVal < prevVal) trend = "down"
|
| 556 |
+
}
|
| 557 |
+
|
| 558 |
+
return (
|
| 559 |
+
<TableRow key={result.id}>
|
| 560 |
+
<TableCell>{result.date}</TableCell>
|
| 561 |
+
<TableCell className="font-mono">
|
| 562 |
+
{result.value} {result.unit}
|
| 563 |
+
</TableCell>
|
| 564 |
+
<TableCell>
|
| 565 |
+
<Badge className={getStatusColor(result.status)}>
|
| 566 |
+
{getStatusIcon(result.status)}
|
| 567 |
+
<span className="ml-1 capitalize">{result.status}</span>
|
| 568 |
+
</Badge>
|
| 569 |
+
</TableCell>
|
| 570 |
+
<TableCell>
|
| 571 |
+
{index === results.length - 1 ? (
|
| 572 |
+
<span className="text-gray-400">-</span>
|
| 573 |
+
) : (
|
| 574 |
+
<div className="flex items-center gap-1">
|
| 575 |
+
{trend === "up" && <TrendingUp className="w-4 h-4 text-red-500" />}
|
| 576 |
+
{trend === "down" && <TrendingDown className="w-4 h-4 text-green-500" />}
|
| 577 |
+
{trend === "stable" && <Minus className="w-4 h-4 text-gray-500" />}
|
| 578 |
+
<span className="text-sm capitalize">{trend}</span>
|
| 579 |
+
</div>
|
| 580 |
+
)}
|
| 581 |
+
</TableCell>
|
| 582 |
+
<TableCell className="text-sm text-gray-600">{result.normalRange}</TableCell>
|
| 583 |
+
</TableRow>
|
| 584 |
+
)
|
| 585 |
+
})}
|
| 586 |
+
</TableBody>
|
| 587 |
+
</Table>
|
| 588 |
+
</div>
|
| 589 |
+
))}
|
| 590 |
+
</div>
|
| 591 |
+
</CardContent>
|
| 592 |
+
</Card>
|
| 593 |
+
</TabsContent>
|
| 594 |
+
</Tabs>
|
| 595 |
+
|
| 596 |
+
{/* Selected Items Summary */}
|
| 597 |
+
{(getSelectedLabResults().length > 0 || getSelectedRadiologyReports().length > 0) && (
|
| 598 |
+
<Card className="bg-green-50 border-green-200">
|
| 599 |
+
<CardHeader>
|
| 600 |
+
<CardTitle className="text-green-900">Selected for Discharge Summary</CardTitle>
|
| 601 |
+
</CardHeader>
|
| 602 |
+
<CardContent>
|
| 603 |
+
<div className="grid md:grid-cols-2 gap-4">
|
| 604 |
+
{getSelectedLabResults().length > 0 && (
|
| 605 |
+
<div>
|
| 606 |
+
<h4 className="font-medium text-green-900 mb-2">Lab Results ({getSelectedLabResults().length})</h4>
|
| 607 |
+
<div className="space-y-1">
|
| 608 |
+
{getSelectedLabResults().map((lab) => (
|
| 609 |
+
<div key={lab.id} className="text-sm text-green-800">
|
| 610 |
+
• {lab.parameter}: {lab.value} {lab.unit} ({lab.date})
|
| 611 |
+
</div>
|
| 612 |
+
))}
|
| 613 |
+
</div>
|
| 614 |
+
</div>
|
| 615 |
+
)}
|
| 616 |
+
{getSelectedRadiologyReports().length > 0 && (
|
| 617 |
+
<div>
|
| 618 |
+
<h4 className="font-medium text-green-900 mb-2">
|
| 619 |
+
Radiology Reports ({getSelectedRadiologyReports().length})
|
| 620 |
+
</h4>
|
| 621 |
+
<div className="space-y-1">
|
| 622 |
+
{getSelectedRadiologyReports().map((report) => (
|
| 623 |
+
<div key={report.id} className="text-sm text-green-800">
|
| 624 |
+
• {report.examType}: {report.impression} ({report.date})
|
| 625 |
+
</div>
|
| 626 |
+
))}
|
| 627 |
+
</div>
|
| 628 |
+
</div>
|
| 629 |
+
)}
|
| 630 |
+
</div>
|
| 631 |
+
<div className="flex gap-2 mt-4">
|
| 632 |
+
<Button size="sm" className="bg-green-600 hover:bg-green-700">
|
| 633 |
+
<Plus className="w-4 h-4 mr-2" />
|
| 634 |
+
Add Selected to Discharge Summary
|
| 635 |
+
</Button>
|
| 636 |
+
<Button size="sm" variant="outline">
|
| 637 |
+
<Download className="w-4 h-4 mr-2" />
|
| 638 |
+
Export Selected Results
|
| 639 |
+
</Button>
|
| 640 |
+
</div>
|
| 641 |
+
</CardContent>
|
| 642 |
+
</Card>
|
| 643 |
+
)}
|
| 644 |
+
</div>
|
| 645 |
+
)
|
| 646 |
+
}
|
ipdmodule/components/opd-consultation-history.tsx
ADDED
|
@@ -0,0 +1,519 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"use client"
|
| 2 |
+
|
| 3 |
+
import { useState, useEffect } from "react"
|
| 4 |
+
import { Button } from "@/components/ui/button"
|
| 5 |
+
import { Card, CardContent, CardHeader } from "@/components/ui/card"
|
| 6 |
+
import { Badge } from "@/components/ui/badge"
|
| 7 |
+
import {
|
| 8 |
+
Users,
|
| 9 |
+
Calendar,
|
| 10 |
+
User,
|
| 11 |
+
Copy,
|
| 12 |
+
ChevronDown,
|
| 13 |
+
ChevronUp,
|
| 14 |
+
FileText,
|
| 15 |
+
Stethoscope,
|
| 16 |
+
Pill,
|
| 17 |
+
TestTube,
|
| 18 |
+
AlertCircle,
|
| 19 |
+
CheckCircle,
|
| 20 |
+
} from "lucide-react"
|
| 21 |
+
|
| 22 |
+
interface OPDConsultationHistoryProps {
|
| 23 |
+
patient: any
|
| 24 |
+
}
|
| 25 |
+
|
| 26 |
+
interface OPDConsultation {
|
| 27 |
+
id: string
|
| 28 |
+
date: string
|
| 29 |
+
time: string
|
| 30 |
+
doctor: string
|
| 31 |
+
department: string
|
| 32 |
+
symptoms: string
|
| 33 |
+
examination: string
|
| 34 |
+
advice: string
|
| 35 |
+
investigation: string
|
| 36 |
+
diagnosis: string
|
| 37 |
+
medicine: string
|
| 38 |
+
followUp: string
|
| 39 |
+
status: "completed" | "pending" | "cancelled"
|
| 40 |
+
}
|
| 41 |
+
|
| 42 |
+
export function OPDConsultationHistory({ patient }: OPDConsultationHistoryProps) {
|
| 43 |
+
const [consultations, setConsultations] = useState<OPDConsultation[]>([])
|
| 44 |
+
const [visibleCount, setVisibleCount] = useState(3)
|
| 45 |
+
const [expandedConsultations, setExpandedConsultations] = useState<Set<string>>(new Set())
|
| 46 |
+
const [copySuccess, setCopySuccess] = useState<string | null>(null)
|
| 47 |
+
|
| 48 |
+
// Mock data - in real implementation, this would come from API
|
| 49 |
+
const allConsultations: OPDConsultation[] = [
|
| 50 |
+
{
|
| 51 |
+
id: "opd-001",
|
| 52 |
+
date: "2024-01-10",
|
| 53 |
+
time: "10:30 AM",
|
| 54 |
+
doctor: "Dr. Smith",
|
| 55 |
+
department: "Internal Medicine",
|
| 56 |
+
symptoms:
|
| 57 |
+
"Chest pain and shortness of breath for 2 days. Patient reports acute onset chest pain, substernal, radiating to left arm. Associated with shortness of breath, diaphoresis, and nausea. Pain is 7/10 in intensity, worsens with exertion.",
|
| 58 |
+
examination:
|
| 59 |
+
"General: Alert, oriented, mild distress. Vitals: BP 140/90, HR 88, Temp 98.6°F. CVS: S1S2 heard, no murmurs, no gallops. Chest: Clear to auscultation bilaterally. Abdomen: Soft, non-tender, no organomegaly. Extremities: No pedal edema.",
|
| 60 |
+
advice:
|
| 61 |
+
"Avoid strenuous activity, low salt diet, medication compliance. Return immediately if chest pain worsens or new symptoms develop. Regular follow-up as scheduled.",
|
| 62 |
+
investigation:
|
| 63 |
+
"ECG - shows ST depression in leads V4-V6. Troponin I - elevated at 2.5 ng/mL. Chest X-ray - normal heart size, clear lung fields. Lipid profile - Total cholesterol 280 mg/dL, LDL 180 mg/dL.",
|
| 64 |
+
diagnosis:
|
| 65 |
+
"Acute coronary syndrome - NSTEMI (Non-ST elevation myocardial infarction). Secondary diagnosis: Hyperlipidemia",
|
| 66 |
+
medicine:
|
| 67 |
+
"Tab. Aspirin 75mg once daily after food. Tab. Atorvastatin 20mg once daily at bedtime. Tab. Metoprolol 25mg twice daily. Tab. Clopidogrel 75mg once daily for 1 year.",
|
| 68 |
+
followUp: "Follow up in cardiology clinic in 1 week. Emergency visit if symptoms worsen.",
|
| 69 |
+
status: "completed",
|
| 70 |
+
},
|
| 71 |
+
{
|
| 72 |
+
id: "opd-002",
|
| 73 |
+
date: "2024-01-05",
|
| 74 |
+
time: "02:15 PM",
|
| 75 |
+
doctor: "Dr. Johnson",
|
| 76 |
+
department: "Cardiology",
|
| 77 |
+
symptoms:
|
| 78 |
+
"Follow-up for hypertension and diabetes. Patient reports good medication compliance. Occasional morning headaches. Blood sugar levels well controlled with current regimen. No chest pain or shortness of breath.",
|
| 79 |
+
examination:
|
| 80 |
+
"General: Well-appearing, no acute distress. Vitals: BP 130/80, HR 72, Weight 68kg. CVS: Regular rate and rhythm, no murmurs. No pedal edema. Fundoscopy: No diabetic retinopathy. Peripheral pulses palpable.",
|
| 81 |
+
advice:
|
| 82 |
+
"Continue current medications as prescribed. Regular exercise 30 minutes daily. Diabetic diet with carbohydrate counting. Home blood pressure monitoring twice weekly. Weight management.",
|
| 83 |
+
investigation:
|
| 84 |
+
"HbA1c - 6.8% (target <7%). Fasting glucose - 110 mg/dL. Lipid profile - within normal limits. Microalbumin - negative. ECG - normal sinus rhythm.",
|
| 85 |
+
diagnosis:
|
| 86 |
+
"Essential hypertension - well controlled. Diabetes mellitus type 2 - well controlled. No evidence of diabetic complications.",
|
| 87 |
+
medicine:
|
| 88 |
+
"Tab. Amlodipine 5mg once daily in morning. Tab. Metformin 500mg twice daily with meals. Tab. Glimepiride 2mg once daily before breakfast. Tab. Aspirin 75mg once daily.",
|
| 89 |
+
followUp: "Follow up in 3 months with HbA1c and lipid profile. Ophthalmology screening annually.",
|
| 90 |
+
status: "completed",
|
| 91 |
+
},
|
| 92 |
+
{
|
| 93 |
+
id: "opd-003",
|
| 94 |
+
date: "2023-12-20",
|
| 95 |
+
time: "11:00 AM",
|
| 96 |
+
doctor: "Dr. Brown",
|
| 97 |
+
department: "General Medicine",
|
| 98 |
+
symptoms:
|
| 99 |
+
"Fever and productive cough for 5 days. Maximum temperature 101°F, mainly in evenings. Cough with yellowish sputum, mild shortness of breath on exertion. Decreased appetite and mild fatigue. No chest pain.",
|
| 100 |
+
examination:
|
| 101 |
+
"General: Febrile (100.8°F), mild respiratory distress. Vitals: BP 120/80, HR 96. Chest: Bilateral crepitations in lower zones, dullness on percussion. CVS: Normal heart sounds. Abdomen: Soft, non-tender.",
|
| 102 |
+
advice:
|
| 103 |
+
"Complete full course of antibiotics even if feeling better. Adequate rest and avoid strenuous activities. Plenty of warm fluids. Steam inhalation twice daily. Return if fever persists beyond 3 days of treatment.",
|
| 104 |
+
investigation:
|
| 105 |
+
"Chest X-ray - bilateral lower lobe consolidation. CBC - WBC 12,000 with neutrophilia. CRP - elevated at 45 mg/L. Sputum culture - Streptococcus pneumoniae sensitive to Amoxicillin.",
|
| 106 |
+
diagnosis: "Community-acquired pneumonia (bilateral lower lobe). Secondary diagnosis: Mild dehydration",
|
| 107 |
+
medicine:
|
| 108 |
+
"Tab. Amoxicillin 500mg three times daily for 7 days. Tab. Paracetamol 500mg as needed for fever (max 4 times daily). Salbutamol inhaler 2 puffs twice daily for 5 days.",
|
| 109 |
+
followUp: "Follow up in 5 days or earlier if symptoms worsen. Chest X-ray repeat after 2 weeks.",
|
| 110 |
+
status: "completed",
|
| 111 |
+
},
|
| 112 |
+
{
|
| 113 |
+
id: "opd-004",
|
| 114 |
+
date: "2023-12-10",
|
| 115 |
+
time: "09:45 AM",
|
| 116 |
+
doctor: "Dr. Wilson",
|
| 117 |
+
department: "Endocrinology",
|
| 118 |
+
symptoms:
|
| 119 |
+
"Diabetes follow-up visit. Patient reports frequent urination, especially at night (3-4 times). Increased thirst and occasional blurred vision. Fatigue in afternoons. No weight loss or diabetic foot symptoms.",
|
| 120 |
+
examination:
|
| 121 |
+
"General: Overweight (BMI 28), no acute distress. Vitals: BP 135/85, Weight 72kg. Diabetic foot examination - no ulcers, good peripheral pulses. Fundoscopy: Mild background diabetic retinopathy with few microaneurysms.",
|
| 122 |
+
advice:
|
| 123 |
+
"Strict adherence to diabetic diet with carbohydrate restriction. Regular exercise program - walking 45 minutes daily. Home blood glucose monitoring twice daily. Weight reduction target 5kg in 6 months. Diabetic foot care education.",
|
| 124 |
+
investigation:
|
| 125 |
+
"HbA1c - 9.2% (poor control). Fasting glucose - 180 mg/dL. Post-meal glucose - 280 mg/dL. Lipid profile - elevated triglycerides. Kidney function tests - normal. Urine microalbumin - trace positive.",
|
| 126 |
+
diagnosis:
|
| 127 |
+
"Diabetes mellitus type 2 - poorly controlled (HbA1c 9.2%). Diabetic retinopathy - mild background changes. Pre-diabetic nephropathy (microalbuminuria).",
|
| 128 |
+
medicine:
|
| 129 |
+
"Tab. Metformin 1000mg twice daily with meals. Insulin Glargine 20 units at bedtime (to be increased gradually). Tab. Aspirin 75mg once daily. Multivitamin once daily.",
|
| 130 |
+
followUp:
|
| 131 |
+
"Follow up in 6 weeks with glucose logs. Ophthalmology referral for detailed retinal examination. Dietitian consultation scheduled.",
|
| 132 |
+
status: "completed",
|
| 133 |
+
},
|
| 134 |
+
{
|
| 135 |
+
id: "opd-005",
|
| 136 |
+
date: "2023-11-25",
|
| 137 |
+
time: "03:30 PM",
|
| 138 |
+
doctor: "Dr. Martinez",
|
| 139 |
+
department: "Internal Medicine",
|
| 140 |
+
symptoms:
|
| 141 |
+
"Routine health check-up. No specific complaints. Patient feels generally well and energetic. Occasional mild headaches during stress. Good sleep pattern and appetite. No urinary or bowel complaints.",
|
| 142 |
+
examination:
|
| 143 |
+
"General: Well-appearing, healthy-looking individual. Vitals: BP 125/75, HR 70, Weight 68kg. All systems examination normal. Heart sounds normal, lungs clear. Abdomen soft with no organomegaly. No lymphadenopathy.",
|
| 144 |
+
advice:
|
| 145 |
+
"Maintain current healthy lifestyle. Continue regular exercise routine. Balanced diet with adequate fruits and vegetables. Stress management techniques. Annual health screening as recommended for age group.",
|
| 146 |
+
investigation:
|
| 147 |
+
"CBC - all parameters normal. Comprehensive metabolic panel - normal kidney and liver function. Lipid profile - optimal levels. PSA - normal for age. Vitamin D - sufficient levels.",
|
| 148 |
+
diagnosis: "Routine health maintenance - all parameters normal. Overall excellent health status for age group.",
|
| 149 |
+
medicine:
|
| 150 |
+
"Multivitamin tablet once daily. Calcium with Vitamin D supplement once daily. No other medications required at present.",
|
| 151 |
+
followUp: "Annual comprehensive health check-up in 1 year. Earlier visit if any health concerns arise.",
|
| 152 |
+
status: "completed",
|
| 153 |
+
},
|
| 154 |
+
]
|
| 155 |
+
|
| 156 |
+
useEffect(() => {
|
| 157 |
+
// Simulate loading consultations
|
| 158 |
+
setConsultations(allConsultations)
|
| 159 |
+
}, [])
|
| 160 |
+
|
| 161 |
+
const loadMoreConsultations = () => {
|
| 162 |
+
setVisibleCount((prev) => Math.min(prev + 3, allConsultations.length))
|
| 163 |
+
}
|
| 164 |
+
|
| 165 |
+
const toggleExpanded = (consultationId: string) => {
|
| 166 |
+
setExpandedConsultations((prev) => {
|
| 167 |
+
const newSet = new Set(prev)
|
| 168 |
+
if (newSet.has(consultationId)) {
|
| 169 |
+
newSet.delete(consultationId)
|
| 170 |
+
} else {
|
| 171 |
+
newSet.add(consultationId)
|
| 172 |
+
}
|
| 173 |
+
return newSet
|
| 174 |
+
})
|
| 175 |
+
}
|
| 176 |
+
|
| 177 |
+
const copyToClipboard = async (text: string, label: string) => {
|
| 178 |
+
try {
|
| 179 |
+
await navigator.clipboard.writeText(text)
|
| 180 |
+
setCopySuccess(label)
|
| 181 |
+
setTimeout(() => setCopySuccess(null), 2000)
|
| 182 |
+
} catch (err) {
|
| 183 |
+
console.error("Failed to copy text: ", err)
|
| 184 |
+
}
|
| 185 |
+
}
|
| 186 |
+
|
| 187 |
+
const getStatusColor = (status: string) => {
|
| 188 |
+
switch (status) {
|
| 189 |
+
case "completed":
|
| 190 |
+
return "bg-green-100 text-green-800"
|
| 191 |
+
case "pending":
|
| 192 |
+
return "bg-yellow-100 text-yellow-800"
|
| 193 |
+
case "cancelled":
|
| 194 |
+
return "bg-red-100 text-red-800"
|
| 195 |
+
default:
|
| 196 |
+
return "bg-gray-100 text-gray-800"
|
| 197 |
+
}
|
| 198 |
+
}
|
| 199 |
+
|
| 200 |
+
const getStatusIcon = (status: string) => {
|
| 201 |
+
switch (status) {
|
| 202 |
+
case "completed":
|
| 203 |
+
return <CheckCircle className="w-4 h-4" />
|
| 204 |
+
case "pending":
|
| 205 |
+
return <AlertCircle className="w-4 h-4" />
|
| 206 |
+
case "cancelled":
|
| 207 |
+
return <AlertCircle className="w-4 h-4" />
|
| 208 |
+
default:
|
| 209 |
+
return <FileText className="w-4 h-4" />
|
| 210 |
+
}
|
| 211 |
+
}
|
| 212 |
+
|
| 213 |
+
const visibleConsultations = consultations.slice(0, visibleCount)
|
| 214 |
+
|
| 215 |
+
return (
|
| 216 |
+
<div className="space-y-6">
|
| 217 |
+
{/* Header */}
|
| 218 |
+
<div className="flex items-center justify-between">
|
| 219 |
+
<div>
|
| 220 |
+
<h2 className="text-xl font-semibold">OPD Consultation History</h2>
|
| 221 |
+
<p className="text-sm text-gray-600">
|
| 222 |
+
Historical OPD consultations for {patient.name} - Showing {visibleCount} of {consultations.length}{" "}
|
| 223 |
+
consultations
|
| 224 |
+
</p>
|
| 225 |
+
</div>
|
| 226 |
+
<Badge variant="secondary" className="gap-2">
|
| 227 |
+
<Users className="w-4 h-4" />
|
| 228 |
+
{consultations.length} Total Consultations
|
| 229 |
+
</Badge>
|
| 230 |
+
</div>
|
| 231 |
+
|
| 232 |
+
{/* Copy Success Message */}
|
| 233 |
+
{copySuccess && (
|
| 234 |
+
<div className="fixed top-4 right-4 bg-green-100 border border-green-400 text-green-700 px-4 py-2 rounded-md shadow-lg z-50">
|
| 235 |
+
<div className="flex items-center gap-2">
|
| 236 |
+
<CheckCircle className="w-4 h-4" />
|
| 237 |
+
{copySuccess} copied to clipboard!
|
| 238 |
+
</div>
|
| 239 |
+
</div>
|
| 240 |
+
)}
|
| 241 |
+
|
| 242 |
+
{/* Consultations List */}
|
| 243 |
+
<div className="space-y-4">
|
| 244 |
+
{visibleConsultations.map((consultation) => {
|
| 245 |
+
const isExpanded = expandedConsultations.has(consultation.id)
|
| 246 |
+
|
| 247 |
+
return (
|
| 248 |
+
<Card key={consultation.id} className="transition-all duration-200 hover:shadow-md">
|
| 249 |
+
<CardHeader>
|
| 250 |
+
<div className="flex items-center justify-between">
|
| 251 |
+
<div className="flex items-center gap-3">
|
| 252 |
+
<Stethoscope className="w-5 h-5 text-blue-600" />
|
| 253 |
+
<div>
|
| 254 |
+
<h3 className="font-semibold">{consultation.department}</h3>
|
| 255 |
+
<div className="flex items-center gap-4 text-sm text-gray-600">
|
| 256 |
+
<span className="flex items-center gap-1">
|
| 257 |
+
<Calendar className="w-3 h-3" />
|
| 258 |
+
{consultation.date} at {consultation.time}
|
| 259 |
+
</span>
|
| 260 |
+
<span className="flex items-center gap-1">
|
| 261 |
+
<User className="w-3 h-3" />
|
| 262 |
+
{consultation.doctor}
|
| 263 |
+
</span>
|
| 264 |
+
</div>
|
| 265 |
+
</div>
|
| 266 |
+
</div>
|
| 267 |
+
<div className="flex items-center gap-2">
|
| 268 |
+
<Badge className={getStatusColor(consultation.status)}>
|
| 269 |
+
{getStatusIcon(consultation.status)}
|
| 270 |
+
<span className="ml-1 capitalize">{consultation.status}</span>
|
| 271 |
+
</Badge>
|
| 272 |
+
<Button variant="outline" size="sm" onClick={() => toggleExpanded(consultation.id)}>
|
| 273 |
+
{isExpanded ? <ChevronUp className="w-4 h-4" /> : <ChevronDown className="w-4 h-4" />}
|
| 274 |
+
</Button>
|
| 275 |
+
</div>
|
| 276 |
+
</div>
|
| 277 |
+
</CardHeader>
|
| 278 |
+
|
| 279 |
+
<CardContent className="space-y-4">
|
| 280 |
+
{/* Always visible summary */}
|
| 281 |
+
<div className="grid grid-cols-1 md:grid-cols-2 gap-4">
|
| 282 |
+
<div>
|
| 283 |
+
<div className="flex items-center justify-between mb-2">
|
| 284 |
+
<h4 className="font-medium text-gray-900">Symptoms:</h4>
|
| 285 |
+
<Button
|
| 286 |
+
size="sm"
|
| 287 |
+
variant="ghost"
|
| 288 |
+
onClick={() => copyToClipboard(consultation.symptoms, "Symptoms")}
|
| 289 |
+
className="h-6 px-2"
|
| 290 |
+
>
|
| 291 |
+
<Copy className="w-3 h-3" />
|
| 292 |
+
</Button>
|
| 293 |
+
</div>
|
| 294 |
+
<p className="text-sm text-gray-700 bg-gray-50 p-2 rounded line-clamp-2">{consultation.symptoms}</p>
|
| 295 |
+
</div>
|
| 296 |
+
|
| 297 |
+
<div>
|
| 298 |
+
<div className="flex items-center justify-between mb-2">
|
| 299 |
+
<h4 className="font-medium text-gray-900">Diagnosis:</h4>
|
| 300 |
+
<Button
|
| 301 |
+
size="sm"
|
| 302 |
+
variant="ghost"
|
| 303 |
+
onClick={() => copyToClipboard(consultation.diagnosis, "Diagnosis")}
|
| 304 |
+
className="h-6 px-2"
|
| 305 |
+
>
|
| 306 |
+
<Copy className="w-3 h-3" />
|
| 307 |
+
</Button>
|
| 308 |
+
</div>
|
| 309 |
+
<p className="text-sm text-gray-700 bg-blue-50 p-2 rounded border border-blue-200 line-clamp-2">
|
| 310 |
+
{consultation.diagnosis}
|
| 311 |
+
</p>
|
| 312 |
+
</div>
|
| 313 |
+
</div>
|
| 314 |
+
|
| 315 |
+
{/* Expanded content */}
|
| 316 |
+
{isExpanded && (
|
| 317 |
+
<div className="space-y-4 border-t pt-4">
|
| 318 |
+
{/* Symptoms */}
|
| 319 |
+
<div>
|
| 320 |
+
<div className="flex items-center justify-between mb-2">
|
| 321 |
+
<h4 className="font-medium text-gray-900">Symptoms:</h4>
|
| 322 |
+
<Button
|
| 323 |
+
size="sm"
|
| 324 |
+
variant="ghost"
|
| 325 |
+
onClick={() => copyToClipboard(consultation.symptoms, "Symptoms")}
|
| 326 |
+
className="h-6 px-2"
|
| 327 |
+
>
|
| 328 |
+
<Copy className="w-3 h-3" />
|
| 329 |
+
</Button>
|
| 330 |
+
</div>
|
| 331 |
+
<p className="text-sm text-gray-700 bg-red-50 p-3 rounded border border-red-200 leading-relaxed">
|
| 332 |
+
{consultation.symptoms}
|
| 333 |
+
</p>
|
| 334 |
+
</div>
|
| 335 |
+
|
| 336 |
+
{/* Examination */}
|
| 337 |
+
<div>
|
| 338 |
+
<div className="flex items-center justify-between mb-2">
|
| 339 |
+
<h4 className="font-medium text-gray-900">Examination:</h4>
|
| 340 |
+
<Button
|
| 341 |
+
size="sm"
|
| 342 |
+
variant="ghost"
|
| 343 |
+
onClick={() => copyToClipboard(consultation.examination, "Examination")}
|
| 344 |
+
className="h-6 px-2"
|
| 345 |
+
>
|
| 346 |
+
<Copy className="w-3 h-3" />
|
| 347 |
+
</Button>
|
| 348 |
+
</div>
|
| 349 |
+
<p className="text-sm text-gray-700 bg-blue-50 p-3 rounded border border-blue-200 leading-relaxed">
|
| 350 |
+
{consultation.examination}
|
| 351 |
+
</p>
|
| 352 |
+
</div>
|
| 353 |
+
|
| 354 |
+
{/* Investigation */}
|
| 355 |
+
<div>
|
| 356 |
+
<div className="flex items-center justify-between mb-2">
|
| 357 |
+
<h4 className="font-medium text-gray-900 flex items-center gap-2">
|
| 358 |
+
<TestTube className="w-4 h-4" />
|
| 359 |
+
Investigation:
|
| 360 |
+
</h4>
|
| 361 |
+
<Button
|
| 362 |
+
size="sm"
|
| 363 |
+
variant="ghost"
|
| 364 |
+
onClick={() => copyToClipboard(consultation.investigation, "Investigation")}
|
| 365 |
+
className="h-6 px-2"
|
| 366 |
+
>
|
| 367 |
+
<Copy className="w-3 h-3" />
|
| 368 |
+
</Button>
|
| 369 |
+
</div>
|
| 370 |
+
<p className="text-sm text-gray-700 bg-purple-50 p-3 rounded border border-purple-200 leading-relaxed">
|
| 371 |
+
{consultation.investigation}
|
| 372 |
+
</p>
|
| 373 |
+
</div>
|
| 374 |
+
|
| 375 |
+
{/* Diagnosis */}
|
| 376 |
+
<div>
|
| 377 |
+
<div className="flex items-center justify-between mb-2">
|
| 378 |
+
<h4 className="font-medium text-gray-900">Diagnosis:</h4>
|
| 379 |
+
<Button
|
| 380 |
+
size="sm"
|
| 381 |
+
variant="ghost"
|
| 382 |
+
onClick={() => copyToClipboard(consultation.diagnosis, "Diagnosis")}
|
| 383 |
+
className="h-6 px-2"
|
| 384 |
+
>
|
| 385 |
+
<Copy className="w-3 h-3" />
|
| 386 |
+
</Button>
|
| 387 |
+
</div>
|
| 388 |
+
<p className="text-sm text-gray-700 bg-green-50 p-3 rounded border border-green-200 leading-relaxed">
|
| 389 |
+
{consultation.diagnosis}
|
| 390 |
+
</p>
|
| 391 |
+
</div>
|
| 392 |
+
|
| 393 |
+
{/* Medicine */}
|
| 394 |
+
<div>
|
| 395 |
+
<div className="flex items-center justify-between mb-2">
|
| 396 |
+
<h4 className="font-medium text-gray-900 flex items-center gap-2">
|
| 397 |
+
<Pill className="w-4 h-4" />
|
| 398 |
+
Medicine:
|
| 399 |
+
</h4>
|
| 400 |
+
<Button
|
| 401 |
+
size="sm"
|
| 402 |
+
variant="ghost"
|
| 403 |
+
onClick={() => copyToClipboard(consultation.medicine, "Medicine")}
|
| 404 |
+
className="h-6 px-2"
|
| 405 |
+
>
|
| 406 |
+
<Copy className="w-3 h-3" />
|
| 407 |
+
</Button>
|
| 408 |
+
</div>
|
| 409 |
+
<p className="text-sm text-gray-700 bg-yellow-50 p-3 rounded border border-yellow-200 leading-relaxed">
|
| 410 |
+
{consultation.medicine}
|
| 411 |
+
</p>
|
| 412 |
+
</div>
|
| 413 |
+
|
| 414 |
+
{/* Advice */}
|
| 415 |
+
<div>
|
| 416 |
+
<div className="flex items-center justify-between mb-2">
|
| 417 |
+
<h4 className="font-medium text-gray-900">Advice:</h4>
|
| 418 |
+
<Button
|
| 419 |
+
size="sm"
|
| 420 |
+
variant="ghost"
|
| 421 |
+
onClick={() => copyToClipboard(consultation.advice, "Advice")}
|
| 422 |
+
className="h-6 px-2"
|
| 423 |
+
>
|
| 424 |
+
<Copy className="w-3 h-3" />
|
| 425 |
+
</Button>
|
| 426 |
+
</div>
|
| 427 |
+
<p className="text-sm text-gray-700 bg-orange-50 p-3 rounded border border-orange-200 leading-relaxed">
|
| 428 |
+
{consultation.advice}
|
| 429 |
+
</p>
|
| 430 |
+
</div>
|
| 431 |
+
|
| 432 |
+
{/* Follow-up */}
|
| 433 |
+
<div>
|
| 434 |
+
<div className="flex items-center justify-between mb-2">
|
| 435 |
+
<h4 className="font-medium text-gray-900">Follow-up:</h4>
|
| 436 |
+
<Button
|
| 437 |
+
size="sm"
|
| 438 |
+
variant="ghost"
|
| 439 |
+
onClick={() => copyToClipboard(consultation.followUp, "Follow-up")}
|
| 440 |
+
className="h-6 px-2"
|
| 441 |
+
>
|
| 442 |
+
<Copy className="w-3 h-3" />
|
| 443 |
+
</Button>
|
| 444 |
+
</div>
|
| 445 |
+
<p className="text-sm text-gray-700 bg-indigo-50 p-3 rounded border border-indigo-200 leading-relaxed">
|
| 446 |
+
{consultation.followUp}
|
| 447 |
+
</p>
|
| 448 |
+
</div>
|
| 449 |
+
|
| 450 |
+
{/* Copy All Button */}
|
| 451 |
+
<div className="pt-2 border-t">
|
| 452 |
+
<Button
|
| 453 |
+
variant="outline"
|
| 454 |
+
onClick={() => {
|
| 455 |
+
const fullConsultation = `
|
| 456 |
+
OPD Consultation - ${consultation.date}
|
| 457 |
+
Doctor: ${consultation.doctor}
|
| 458 |
+
Department: ${consultation.department}
|
| 459 |
+
|
| 460 |
+
SYMPTOMS:
|
| 461 |
+
${consultation.symptoms}
|
| 462 |
+
|
| 463 |
+
EXAMINATION:
|
| 464 |
+
${consultation.examination}
|
| 465 |
+
|
| 466 |
+
INVESTIGATION:
|
| 467 |
+
${consultation.investigation}
|
| 468 |
+
|
| 469 |
+
DIAGNOSIS:
|
| 470 |
+
${consultation.diagnosis}
|
| 471 |
+
|
| 472 |
+
MEDICINE:
|
| 473 |
+
${consultation.medicine}
|
| 474 |
+
|
| 475 |
+
ADVICE:
|
| 476 |
+
${consultation.advice}
|
| 477 |
+
|
| 478 |
+
FOLLOW-UP:
|
| 479 |
+
${consultation.followUp}
|
| 480 |
+
`.trim()
|
| 481 |
+
copyToClipboard(fullConsultation, "Complete Consultation")
|
| 482 |
+
}}
|
| 483 |
+
className="w-full"
|
| 484 |
+
>
|
| 485 |
+
<Copy className="w-4 h-4 mr-2" />
|
| 486 |
+
Copy Complete Consultation
|
| 487 |
+
</Button>
|
| 488 |
+
</div>
|
| 489 |
+
</div>
|
| 490 |
+
)}
|
| 491 |
+
</CardContent>
|
| 492 |
+
</Card>
|
| 493 |
+
)
|
| 494 |
+
})}
|
| 495 |
+
</div>
|
| 496 |
+
|
| 497 |
+
{/* Load More Button */}
|
| 498 |
+
{visibleCount < consultations.length && (
|
| 499 |
+
<div className="text-center">
|
| 500 |
+
<Button variant="outline" onClick={loadMoreConsultations}>
|
| 501 |
+
<ChevronDown className="w-4 h-4 mr-2" />
|
| 502 |
+
Load More Consultations ({consultations.length - visibleCount} remaining)
|
| 503 |
+
</Button>
|
| 504 |
+
</div>
|
| 505 |
+
)}
|
| 506 |
+
|
| 507 |
+
{/* Empty State */}
|
| 508 |
+
{consultations.length === 0 && (
|
| 509 |
+
<Card className="text-center py-12">
|
| 510 |
+
<CardContent>
|
| 511 |
+
<Users className="w-12 h-12 text-gray-400 mx-auto mb-4" />
|
| 512 |
+
<h3 className="text-lg font-medium text-gray-900 mb-2">No OPD Consultations</h3>
|
| 513 |
+
<p className="text-gray-600">No previous OPD consultations found for this patient.</p>
|
| 514 |
+
</CardContent>
|
| 515 |
+
</Card>
|
| 516 |
+
)}
|
| 517 |
+
</div>
|
| 518 |
+
)
|
| 519 |
+
}
|
ipdmodule/components/ot-details-form.tsx
ADDED
|
@@ -0,0 +1,464 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"use client"
|
| 2 |
+
|
| 3 |
+
import { useState } from "react"
|
| 4 |
+
import { Button } from "@/components/ui/button"
|
| 5 |
+
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"
|
| 6 |
+
import { Input } from "@/components/ui/input"
|
| 7 |
+
import { Label } from "@/components/ui/label"
|
| 8 |
+
import { Textarea } from "@/components/ui/textarea"
|
| 9 |
+
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select"
|
| 10 |
+
import { Badge } from "@/components/ui/badge"
|
| 11 |
+
import { Scissors, Save, Plus, Edit, Trash2, AlertTriangle, CheckCircle } from "lucide-react"
|
| 12 |
+
|
| 13 |
+
interface OTDetailsFormProps {
|
| 14 |
+
patient: any
|
| 15 |
+
}
|
| 16 |
+
|
| 17 |
+
export function OTDetailsForm({ patient }: OTDetailsFormProps) {
|
| 18 |
+
const [showAddOT, setShowAddOT] = useState(false)
|
| 19 |
+
const [formData, setFormData] = useState({
|
| 20 |
+
dateOfSurgery: "",
|
| 21 |
+
surgeryName: "",
|
| 22 |
+
indication: "",
|
| 23 |
+
surgeon: "",
|
| 24 |
+
assistants: "",
|
| 25 |
+
anesthesiaType: "",
|
| 26 |
+
anesthesiologist: "",
|
| 27 |
+
intraoperativeFindings: "",
|
| 28 |
+
procedureDescription: "",
|
| 29 |
+
complications: "No",
|
| 30 |
+
complicationDetails: "",
|
| 31 |
+
postOpPlan: "",
|
| 32 |
+
estimatedBloodLoss: "",
|
| 33 |
+
fluidBalance: "",
|
| 34 |
+
duration: "",
|
| 35 |
+
implants: "",
|
| 36 |
+
specimens: "",
|
| 37 |
+
})
|
| 38 |
+
|
| 39 |
+
const [otRecords, setOtRecords] = useState([
|
| 40 |
+
{
|
| 41 |
+
id: "1",
|
| 42 |
+
date: "2024-01-16",
|
| 43 |
+
surgeryName: "Laparoscopic Cholecystectomy",
|
| 44 |
+
surgeon: "Dr. Brown",
|
| 45 |
+
anesthesia: "General",
|
| 46 |
+
duration: "2 hours 30 minutes",
|
| 47 |
+
status: "Completed",
|
| 48 |
+
complications: "None",
|
| 49 |
+
postOpPlan: "Recovery Room → Ward",
|
| 50 |
+
},
|
| 51 |
+
])
|
| 52 |
+
|
| 53 |
+
const handleInputChange = (field: string, value: string) => {
|
| 54 |
+
setFormData((prev) => ({ ...prev, [field]: value }))
|
| 55 |
+
}
|
| 56 |
+
|
| 57 |
+
const handleSaveOT = () => {
|
| 58 |
+
const newRecord = {
|
| 59 |
+
id: Date.now().toString(),
|
| 60 |
+
date: formData.dateOfSurgery,
|
| 61 |
+
surgeryName: formData.surgeryName,
|
| 62 |
+
surgeon: formData.surgeon,
|
| 63 |
+
anesthesia: formData.anesthesiaType,
|
| 64 |
+
duration: formData.duration,
|
| 65 |
+
status: "Completed",
|
| 66 |
+
complications: formData.complications === "Yes" ? formData.complicationDetails : "None",
|
| 67 |
+
postOpPlan: formData.postOpPlan,
|
| 68 |
+
}
|
| 69 |
+
|
| 70 |
+
setOtRecords((prev) => [newRecord, ...prev])
|
| 71 |
+
setFormData({
|
| 72 |
+
dateOfSurgery: "",
|
| 73 |
+
surgeryName: "",
|
| 74 |
+
indication: "",
|
| 75 |
+
surgeon: "",
|
| 76 |
+
assistants: "",
|
| 77 |
+
anesthesiaType: "",
|
| 78 |
+
anesthesiologist: "",
|
| 79 |
+
intraoperativeFindings: "",
|
| 80 |
+
procedureDescription: "",
|
| 81 |
+
complications: "No",
|
| 82 |
+
complicationDetails: "",
|
| 83 |
+
postOpPlan: "",
|
| 84 |
+
estimatedBloodLoss: "",
|
| 85 |
+
fluidBalance: "",
|
| 86 |
+
duration: "",
|
| 87 |
+
implants: "",
|
| 88 |
+
specimens: "",
|
| 89 |
+
})
|
| 90 |
+
setShowAddOT(false)
|
| 91 |
+
alert("OT record saved successfully!")
|
| 92 |
+
}
|
| 93 |
+
|
| 94 |
+
return (
|
| 95 |
+
<div className="space-y-6">
|
| 96 |
+
{/* Header */}
|
| 97 |
+
<div className="flex items-center justify-between">
|
| 98 |
+
<div>
|
| 99 |
+
<h2 className="text-xl font-semibold">OT Details</h2>
|
| 100 |
+
<p className="text-sm text-gray-600">Surgery and operation theater details for {patient.name}</p>
|
| 101 |
+
</div>
|
| 102 |
+
<Button onClick={() => setShowAddOT(!showAddOT)}>
|
| 103 |
+
<Plus className="w-4 h-4 mr-2" />
|
| 104 |
+
Add OT Record
|
| 105 |
+
</Button>
|
| 106 |
+
</div>
|
| 107 |
+
|
| 108 |
+
{/* Add New OT Record Form */}
|
| 109 |
+
{showAddOT && (
|
| 110 |
+
<Card className="border-blue-200 bg-blue-50">
|
| 111 |
+
<CardHeader>
|
| 112 |
+
<CardTitle className="flex items-center gap-2">
|
| 113 |
+
<Scissors className="w-5 h-5" />
|
| 114 |
+
Add New OT Record
|
| 115 |
+
</CardTitle>
|
| 116 |
+
</CardHeader>
|
| 117 |
+
<CardContent className="space-y-6">
|
| 118 |
+
{/* Basic Surgery Information */}
|
| 119 |
+
<div className="grid grid-cols-1 md:grid-cols-2 gap-4">
|
| 120 |
+
<div>
|
| 121 |
+
<Label htmlFor="dateOfSurgery">Date of Surgery</Label>
|
| 122 |
+
<Input
|
| 123 |
+
id="dateOfSurgery"
|
| 124 |
+
type="date"
|
| 125 |
+
value={formData.dateOfSurgery}
|
| 126 |
+
onChange={(e) => handleInputChange("dateOfSurgery", e.target.value)}
|
| 127 |
+
className="bg-white"
|
| 128 |
+
/>
|
| 129 |
+
</div>
|
| 130 |
+
|
| 131 |
+
<div>
|
| 132 |
+
<Label htmlFor="duration">Duration</Label>
|
| 133 |
+
<Input
|
| 134 |
+
id="duration"
|
| 135 |
+
placeholder="e.g., 2 hours 30 minutes"
|
| 136 |
+
value={formData.duration}
|
| 137 |
+
onChange={(e) => handleInputChange("duration", e.target.value)}
|
| 138 |
+
className="bg-white"
|
| 139 |
+
/>
|
| 140 |
+
</div>
|
| 141 |
+
|
| 142 |
+
<div className="md:col-span-2">
|
| 143 |
+
<Label htmlFor="surgeryName">Surgery/Procedure Name</Label>
|
| 144 |
+
<Input
|
| 145 |
+
id="surgeryName"
|
| 146 |
+
placeholder="Enter surgery name..."
|
| 147 |
+
value={formData.surgeryName}
|
| 148 |
+
onChange={(e) => handleInputChange("surgeryName", e.target.value)}
|
| 149 |
+
className="bg-white"
|
| 150 |
+
/>
|
| 151 |
+
</div>
|
| 152 |
+
|
| 153 |
+
<div className="md:col-span-2">
|
| 154 |
+
<Label htmlFor="indication">Indication for Surgery</Label>
|
| 155 |
+
<Textarea
|
| 156 |
+
id="indication"
|
| 157 |
+
placeholder="Enter indication for surgery..."
|
| 158 |
+
value={formData.indication}
|
| 159 |
+
onChange={(e) => handleInputChange("indication", e.target.value)}
|
| 160 |
+
rows={2}
|
| 161 |
+
className="bg-white"
|
| 162 |
+
/>
|
| 163 |
+
</div>
|
| 164 |
+
</div>
|
| 165 |
+
|
| 166 |
+
{/* Surgical Team */}
|
| 167 |
+
<Card>
|
| 168 |
+
<CardHeader>
|
| 169 |
+
<CardTitle className="text-lg">Surgical Team</CardTitle>
|
| 170 |
+
</CardHeader>
|
| 171 |
+
<CardContent className="space-y-4">
|
| 172 |
+
<div className="grid grid-cols-1 md:grid-cols-2 gap-4">
|
| 173 |
+
<div>
|
| 174 |
+
<Label htmlFor="surgeon">Primary Surgeon</Label>
|
| 175 |
+
<Input
|
| 176 |
+
id="surgeon"
|
| 177 |
+
placeholder="Primary surgeon name..."
|
| 178 |
+
value={formData.surgeon}
|
| 179 |
+
onChange={(e) => handleInputChange("surgeon", e.target.value)}
|
| 180 |
+
className="bg-white"
|
| 181 |
+
/>
|
| 182 |
+
</div>
|
| 183 |
+
|
| 184 |
+
<div>
|
| 185 |
+
<Label htmlFor="assistants">Assistant Surgeons</Label>
|
| 186 |
+
<Input
|
| 187 |
+
id="assistants"
|
| 188 |
+
placeholder="Assistant surgeon names..."
|
| 189 |
+
value={formData.assistants}
|
| 190 |
+
onChange={(e) => handleInputChange("assistants", e.target.value)}
|
| 191 |
+
className="bg-white"
|
| 192 |
+
/>
|
| 193 |
+
</div>
|
| 194 |
+
|
| 195 |
+
<div>
|
| 196 |
+
<Label htmlFor="anesthesiaType">Anesthesia Type</Label>
|
| 197 |
+
<Select onValueChange={(value) => handleInputChange("anesthesiaType", value)}>
|
| 198 |
+
<SelectTrigger className="bg-white">
|
| 199 |
+
<SelectValue placeholder="Select anesthesia type" />
|
| 200 |
+
</SelectTrigger>
|
| 201 |
+
<SelectContent>
|
| 202 |
+
<SelectItem value="general">General</SelectItem>
|
| 203 |
+
<SelectItem value="spinal">Spinal</SelectItem>
|
| 204 |
+
<SelectItem value="epidural">Epidural</SelectItem>
|
| 205 |
+
<SelectItem value="local">Local</SelectItem>
|
| 206 |
+
<SelectItem value="sedation">Sedation</SelectItem>
|
| 207 |
+
<SelectItem value="regional">Regional Block</SelectItem>
|
| 208 |
+
</SelectContent>
|
| 209 |
+
</Select>
|
| 210 |
+
</div>
|
| 211 |
+
|
| 212 |
+
<div>
|
| 213 |
+
<Label htmlFor="anesthesiologist">Anesthesiologist</Label>
|
| 214 |
+
<Input
|
| 215 |
+
id="anesthesiologist"
|
| 216 |
+
placeholder="Anesthesiologist name..."
|
| 217 |
+
value={formData.anesthesiologist}
|
| 218 |
+
onChange={(e) => handleInputChange("anesthesiologist", e.target.value)}
|
| 219 |
+
className="bg-white"
|
| 220 |
+
/>
|
| 221 |
+
</div>
|
| 222 |
+
</div>
|
| 223 |
+
</CardContent>
|
| 224 |
+
</Card>
|
| 225 |
+
|
| 226 |
+
{/* Operative Details */}
|
| 227 |
+
<Card>
|
| 228 |
+
<CardHeader>
|
| 229 |
+
<CardTitle className="text-lg">Operative Details</CardTitle>
|
| 230 |
+
</CardHeader>
|
| 231 |
+
<CardContent className="space-y-4">
|
| 232 |
+
<div>
|
| 233 |
+
<Label htmlFor="intraoperativeFindings">Intraoperative Findings</Label>
|
| 234 |
+
<Textarea
|
| 235 |
+
id="intraoperativeFindings"
|
| 236 |
+
placeholder="Enter intraoperative findings..."
|
| 237 |
+
value={formData.intraoperativeFindings}
|
| 238 |
+
onChange={(e) => handleInputChange("intraoperativeFindings", e.target.value)}
|
| 239 |
+
rows={3}
|
| 240 |
+
className="bg-white"
|
| 241 |
+
/>
|
| 242 |
+
</div>
|
| 243 |
+
|
| 244 |
+
<div>
|
| 245 |
+
<Label htmlFor="procedureDescription">Procedure Description</Label>
|
| 246 |
+
<Textarea
|
| 247 |
+
id="procedureDescription"
|
| 248 |
+
placeholder="Detailed step-by-step procedure description..."
|
| 249 |
+
value={formData.procedureDescription}
|
| 250 |
+
onChange={(e) => handleInputChange("procedureDescription", e.target.value)}
|
| 251 |
+
rows={5}
|
| 252 |
+
className="bg-white"
|
| 253 |
+
/>
|
| 254 |
+
</div>
|
| 255 |
+
|
| 256 |
+
<div className="grid grid-cols-1 md:grid-cols-2 gap-4">
|
| 257 |
+
<div>
|
| 258 |
+
<Label htmlFor="estimatedBloodLoss">Estimated Blood Loss</Label>
|
| 259 |
+
<Input
|
| 260 |
+
id="estimatedBloodLoss"
|
| 261 |
+
placeholder="e.g., 50 ml"
|
| 262 |
+
value={formData.estimatedBloodLoss}
|
| 263 |
+
onChange={(e) => handleInputChange("estimatedBloodLoss", e.target.value)}
|
| 264 |
+
className="bg-white"
|
| 265 |
+
/>
|
| 266 |
+
</div>
|
| 267 |
+
|
| 268 |
+
<div>
|
| 269 |
+
<Label htmlFor="fluidBalance">Fluid Balance</Label>
|
| 270 |
+
<Input
|
| 271 |
+
id="fluidBalance"
|
| 272 |
+
placeholder="Input/Output balance"
|
| 273 |
+
value={formData.fluidBalance}
|
| 274 |
+
onChange={(e) => handleInputChange("fluidBalance", e.target.value)}
|
| 275 |
+
className="bg-white"
|
| 276 |
+
/>
|
| 277 |
+
</div>
|
| 278 |
+
</div>
|
| 279 |
+
|
| 280 |
+
<div>
|
| 281 |
+
<Label htmlFor="implants">Implants/Prosthetics Used</Label>
|
| 282 |
+
<Textarea
|
| 283 |
+
id="implants"
|
| 284 |
+
placeholder="List any implants, prosthetics, or foreign materials used..."
|
| 285 |
+
value={formData.implants}
|
| 286 |
+
onChange={(e) => handleInputChange("implants", e.target.value)}
|
| 287 |
+
rows={2}
|
| 288 |
+
className="bg-white"
|
| 289 |
+
/>
|
| 290 |
+
</div>
|
| 291 |
+
|
| 292 |
+
<div>
|
| 293 |
+
<Label htmlFor="specimens">Specimens Sent</Label>
|
| 294 |
+
<Textarea
|
| 295 |
+
id="specimens"
|
| 296 |
+
placeholder="List specimens sent for pathology/analysis..."
|
| 297 |
+
value={formData.specimens}
|
| 298 |
+
onChange={(e) => handleInputChange("specimens", e.target.value)}
|
| 299 |
+
rows={2}
|
| 300 |
+
className="bg-white"
|
| 301 |
+
/>
|
| 302 |
+
</div>
|
| 303 |
+
</CardContent>
|
| 304 |
+
</Card>
|
| 305 |
+
|
| 306 |
+
{/* Complications */}
|
| 307 |
+
<Card>
|
| 308 |
+
<CardHeader>
|
| 309 |
+
<CardTitle className="text-lg">Complications</CardTitle>
|
| 310 |
+
</CardHeader>
|
| 311 |
+
<CardContent className="space-y-4">
|
| 312 |
+
<div>
|
| 313 |
+
<Label>Intraoperative Complications</Label>
|
| 314 |
+
<div className="flex gap-4 mt-2">
|
| 315 |
+
<label className="flex items-center gap-2">
|
| 316 |
+
<input
|
| 317 |
+
type="radio"
|
| 318 |
+
name="complications"
|
| 319 |
+
value="No"
|
| 320 |
+
checked={formData.complications === "No"}
|
| 321 |
+
onChange={(e) => handleInputChange("complications", e.target.value)}
|
| 322 |
+
/>
|
| 323 |
+
No
|
| 324 |
+
</label>
|
| 325 |
+
<label className="flex items-center gap-2">
|
| 326 |
+
<input
|
| 327 |
+
type="radio"
|
| 328 |
+
name="complications"
|
| 329 |
+
value="Yes"
|
| 330 |
+
checked={formData.complications === "Yes"}
|
| 331 |
+
onChange={(e) => handleInputChange("complications", e.target.value)}
|
| 332 |
+
/>
|
| 333 |
+
Yes
|
| 334 |
+
</label>
|
| 335 |
+
</div>
|
| 336 |
+
{formData.complications === "Yes" && (
|
| 337 |
+
<Textarea
|
| 338 |
+
placeholder="Describe complications in detail..."
|
| 339 |
+
value={formData.complicationDetails}
|
| 340 |
+
onChange={(e) => handleInputChange("complicationDetails", e.target.value)}
|
| 341 |
+
rows={3}
|
| 342 |
+
className="mt-2 bg-white"
|
| 343 |
+
/>
|
| 344 |
+
)}
|
| 345 |
+
</div>
|
| 346 |
+
</CardContent>
|
| 347 |
+
</Card>
|
| 348 |
+
|
| 349 |
+
{/* Post-operative Plan */}
|
| 350 |
+
<Card>
|
| 351 |
+
<CardHeader>
|
| 352 |
+
<CardTitle className="text-lg">Post-operative Plan</CardTitle>
|
| 353 |
+
</CardHeader>
|
| 354 |
+
<CardContent>
|
| 355 |
+
<div>
|
| 356 |
+
<Label htmlFor="postOpPlan">Post-op Destination & Plan</Label>
|
| 357 |
+
<Select onValueChange={(value) => handleInputChange("postOpPlan", value)}>
|
| 358 |
+
<SelectTrigger className="bg-white">
|
| 359 |
+
<SelectValue placeholder="Select post-op plan" />
|
| 360 |
+
</SelectTrigger>
|
| 361 |
+
<SelectContent>
|
| 362 |
+
<SelectItem value="icu">ICU</SelectItem>
|
| 363 |
+
<SelectItem value="recovery">Recovery Room</SelectItem>
|
| 364 |
+
<SelectItem value="ward">General Ward</SelectItem>
|
| 365 |
+
<SelectItem value="pacu">PACU (Post Anesthesia Care Unit)</SelectItem>
|
| 366 |
+
<SelectItem value="discharge">Day Surgery Discharge</SelectItem>
|
| 367 |
+
</SelectContent>
|
| 368 |
+
</Select>
|
| 369 |
+
</div>
|
| 370 |
+
</CardContent>
|
| 371 |
+
</Card>
|
| 372 |
+
|
| 373 |
+
<div className="flex gap-2">
|
| 374 |
+
<Button onClick={handleSaveOT}>
|
| 375 |
+
<Save className="w-4 h-4 mr-2" />
|
| 376 |
+
Save OT Record
|
| 377 |
+
</Button>
|
| 378 |
+
<Button variant="outline" onClick={() => setShowAddOT(false)}>
|
| 379 |
+
Cancel
|
| 380 |
+
</Button>
|
| 381 |
+
</div>
|
| 382 |
+
</CardContent>
|
| 383 |
+
</Card>
|
| 384 |
+
)}
|
| 385 |
+
|
| 386 |
+
{/* Existing OT Records */}
|
| 387 |
+
<div className="space-y-4">
|
| 388 |
+
{otRecords.map((record) => (
|
| 389 |
+
<Card key={record.id}>
|
| 390 |
+
<CardHeader>
|
| 391 |
+
<div className="flex items-center justify-between">
|
| 392 |
+
<CardTitle className="flex items-center gap-2">
|
| 393 |
+
<Scissors className="w-5 h-5" />
|
| 394 |
+
{record.surgeryName}
|
| 395 |
+
</CardTitle>
|
| 396 |
+
<div className="flex items-center gap-2">
|
| 397 |
+
<Badge variant="secondary" className="bg-green-100 text-green-800">
|
| 398 |
+
<CheckCircle className="w-3 h-3 mr-1" />
|
| 399 |
+
{record.status}
|
| 400 |
+
</Badge>
|
| 401 |
+
<Button size="sm" variant="outline">
|
| 402 |
+
<Edit className="w-4 h-4" />
|
| 403 |
+
</Button>
|
| 404 |
+
<Button size="sm" variant="outline">
|
| 405 |
+
<Trash2 className="w-4 h-4" />
|
| 406 |
+
</Button>
|
| 407 |
+
</div>
|
| 408 |
+
</div>
|
| 409 |
+
</CardHeader>
|
| 410 |
+
<CardContent>
|
| 411 |
+
<div className="grid grid-cols-1 md:grid-cols-3 gap-4 text-sm mb-4">
|
| 412 |
+
<div>
|
| 413 |
+
<span className="font-medium text-gray-600">Date:</span>
|
| 414 |
+
<p className="text-gray-900">{record.date}</p>
|
| 415 |
+
</div>
|
| 416 |
+
<div>
|
| 417 |
+
<span className="font-medium text-gray-600">Surgeon:</span>
|
| 418 |
+
<p className="text-gray-900">{record.surgeon}</p>
|
| 419 |
+
</div>
|
| 420 |
+
<div>
|
| 421 |
+
<span className="font-medium text-gray-600">Duration:</span>
|
| 422 |
+
<p className="text-gray-900">{record.duration}</p>
|
| 423 |
+
</div>
|
| 424 |
+
<div>
|
| 425 |
+
<span className="font-medium text-gray-600">Anesthesia:</span>
|
| 426 |
+
<p className="text-gray-900">{record.anesthesia}</p>
|
| 427 |
+
</div>
|
| 428 |
+
<div>
|
| 429 |
+
<span className="font-medium text-gray-600">Post-op Plan:</span>
|
| 430 |
+
<p className="text-gray-900">{record.postOpPlan}</p>
|
| 431 |
+
</div>
|
| 432 |
+
</div>
|
| 433 |
+
|
| 434 |
+
{record.complications !== "None" && (
|
| 435 |
+
<div className="mt-4 p-3 bg-yellow-50 border border-yellow-200 rounded-md">
|
| 436 |
+
<div className="flex items-center gap-2">
|
| 437 |
+
<AlertTriangle className="w-4 h-4 text-yellow-600" />
|
| 438 |
+
<span className="font-medium text-yellow-800">Complications:</span>
|
| 439 |
+
<span className="text-yellow-700">{record.complications}</span>
|
| 440 |
+
</div>
|
| 441 |
+
</div>
|
| 442 |
+
)}
|
| 443 |
+
</CardContent>
|
| 444 |
+
</Card>
|
| 445 |
+
))}
|
| 446 |
+
</div>
|
| 447 |
+
|
| 448 |
+
{/* Empty State */}
|
| 449 |
+
{otRecords.length === 0 && !showAddOT && (
|
| 450 |
+
<Card className="text-center py-12">
|
| 451 |
+
<CardContent>
|
| 452 |
+
<Scissors className="w-12 h-12 text-gray-400 mx-auto mb-4" />
|
| 453 |
+
<h3 className="text-lg font-medium text-gray-900 mb-2">No OT Records</h3>
|
| 454 |
+
<p className="text-gray-600 mb-4">No surgery records found for this patient.</p>
|
| 455 |
+
<Button onClick={() => setShowAddOT(true)}>
|
| 456 |
+
<Plus className="w-4 h-4 mr-2" />
|
| 457 |
+
Add First OT Record
|
| 458 |
+
</Button>
|
| 459 |
+
</CardContent>
|
| 460 |
+
</Card>
|
| 461 |
+
)}
|
| 462 |
+
</div>
|
| 463 |
+
)
|
| 464 |
+
}
|
ipdmodule/components/ot-details.tsx
ADDED
|
@@ -0,0 +1,204 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"use client"
|
| 2 |
+
|
| 3 |
+
import { useState } from "react"
|
| 4 |
+
import { Button } from "@/components/ui/button"
|
| 5 |
+
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"
|
| 6 |
+
import { Input } from "@/components/ui/input"
|
| 7 |
+
import { Label } from "@/components/ui/label"
|
| 8 |
+
import { RichTextEditor } from "./rich-text-editor"
|
| 9 |
+
import { Scissors, Save } from "lucide-react"
|
| 10 |
+
|
| 11 |
+
interface OTDetailsProps {
|
| 12 |
+
patient: any
|
| 13 |
+
}
|
| 14 |
+
|
| 15 |
+
export function OTDetails({ patient }: OTDetailsProps) {
|
| 16 |
+
const [otData, setOTData] = useState({
|
| 17 |
+
operationDate: new Date().toISOString().split("T")[0],
|
| 18 |
+
operationTime: "",
|
| 19 |
+
duration: "",
|
| 20 |
+
surgeon: "",
|
| 21 |
+
assistant: "",
|
| 22 |
+
anesthesia: "",
|
| 23 |
+
preOpNotes: "",
|
| 24 |
+
procedure: "",
|
| 25 |
+
findings: "",
|
| 26 |
+
complications: "",
|
| 27 |
+
postOpInstructions: "",
|
| 28 |
+
})
|
| 29 |
+
|
| 30 |
+
const handleInputChange = (field: string, value: string) => {
|
| 31 |
+
setOTData((prev) => ({ ...prev, [field]: value }))
|
| 32 |
+
}
|
| 33 |
+
|
| 34 |
+
return (
|
| 35 |
+
<div className="space-y-6">
|
| 36 |
+
{/* Header */}
|
| 37 |
+
<div className="flex items-center justify-between">
|
| 38 |
+
<div>
|
| 39 |
+
<h2 className="text-xl font-semibold">Operation Theatre Notes</h2>
|
| 40 |
+
<p className="text-sm text-gray-600">Comprehensive surgical documentation for {patient.name}</p>
|
| 41 |
+
</div>
|
| 42 |
+
<Button className="gap-2">
|
| 43 |
+
<Save className="w-4 h-4" />
|
| 44 |
+
Save OT Notes
|
| 45 |
+
</Button>
|
| 46 |
+
</div>
|
| 47 |
+
|
| 48 |
+
{/* Operation Details */}
|
| 49 |
+
<Card>
|
| 50 |
+
<CardHeader>
|
| 51 |
+
<CardTitle className="flex items-center gap-2">
|
| 52 |
+
<Scissors className="w-5 h-5" />
|
| 53 |
+
Operation Details
|
| 54 |
+
</CardTitle>
|
| 55 |
+
</CardHeader>
|
| 56 |
+
<CardContent className="space-y-4">
|
| 57 |
+
<div className="grid grid-cols-1 md:grid-cols-3 gap-4">
|
| 58 |
+
<div>
|
| 59 |
+
<Label>Operation Date</Label>
|
| 60 |
+
<Input
|
| 61 |
+
type="date"
|
| 62 |
+
value={otData.operationDate}
|
| 63 |
+
onChange={(e) => handleInputChange("operationDate", e.target.value)}
|
| 64 |
+
/>
|
| 65 |
+
</div>
|
| 66 |
+
<div>
|
| 67 |
+
<Label>Operation Time</Label>
|
| 68 |
+
<Input
|
| 69 |
+
type="time"
|
| 70 |
+
value={otData.operationTime}
|
| 71 |
+
onChange={(e) => handleInputChange("operationTime", e.target.value)}
|
| 72 |
+
placeholder="Start time"
|
| 73 |
+
/>
|
| 74 |
+
</div>
|
| 75 |
+
<div>
|
| 76 |
+
<Label>Duration (minutes)</Label>
|
| 77 |
+
<Input
|
| 78 |
+
type="number"
|
| 79 |
+
value={otData.duration}
|
| 80 |
+
onChange={(e) => handleInputChange("duration", e.target.value)}
|
| 81 |
+
placeholder="120"
|
| 82 |
+
/>
|
| 83 |
+
</div>
|
| 84 |
+
</div>
|
| 85 |
+
|
| 86 |
+
<div className="grid grid-cols-1 md:grid-cols-3 gap-4">
|
| 87 |
+
<div>
|
| 88 |
+
<Label>Primary Surgeon</Label>
|
| 89 |
+
<Input
|
| 90 |
+
value={otData.surgeon}
|
| 91 |
+
onChange={(e) => handleInputChange("surgeon", e.target.value)}
|
| 92 |
+
placeholder="Enter surgeon name"
|
| 93 |
+
/>
|
| 94 |
+
</div>
|
| 95 |
+
<div>
|
| 96 |
+
<Label>Assistant Surgeon</Label>
|
| 97 |
+
<Input
|
| 98 |
+
value={otData.assistant}
|
| 99 |
+
onChange={(e) => handleInputChange("assistant", e.target.value)}
|
| 100 |
+
placeholder="Enter assistant name"
|
| 101 |
+
/>
|
| 102 |
+
</div>
|
| 103 |
+
<div>
|
| 104 |
+
<Label>Anesthesia Type</Label>
|
| 105 |
+
<Input
|
| 106 |
+
value={otData.anesthesia}
|
| 107 |
+
onChange={(e) => handleInputChange("anesthesia", e.target.value)}
|
| 108 |
+
placeholder="General/Spinal/Local"
|
| 109 |
+
/>
|
| 110 |
+
</div>
|
| 111 |
+
</div>
|
| 112 |
+
</CardContent>
|
| 113 |
+
</Card>
|
| 114 |
+
|
| 115 |
+
{/* Pre-operative Notes */}
|
| 116 |
+
<Card>
|
| 117 |
+
<CardHeader>
|
| 118 |
+
<CardTitle>Pre-operative Notes</CardTitle>
|
| 119 |
+
</CardHeader>
|
| 120 |
+
<CardContent>
|
| 121 |
+
<Label className="text-base font-medium">Pre-operative Assessment and Preparation</Label>
|
| 122 |
+
<RichTextEditor
|
| 123 |
+
value={otData.preOpNotes}
|
| 124 |
+
onChange={(value) => handleInputChange("preOpNotes", value)}
|
| 125 |
+
placeholder="Enter pre-operative assessment, patient preparation, consent details..."
|
| 126 |
+
rows={4}
|
| 127 |
+
fieldType="assessment"
|
| 128 |
+
showAutofill={true}
|
| 129 |
+
autofillSource="Pre-op Assessment"
|
| 130 |
+
autofillTimestamp="2024-01-15, 08:30 AM"
|
| 131 |
+
/>
|
| 132 |
+
</CardContent>
|
| 133 |
+
</Card>
|
| 134 |
+
|
| 135 |
+
{/* Operative Procedure */}
|
| 136 |
+
<Card>
|
| 137 |
+
<CardHeader>
|
| 138 |
+
<CardTitle>Operative Procedure</CardTitle>
|
| 139 |
+
</CardHeader>
|
| 140 |
+
<CardContent>
|
| 141 |
+
<Label className="text-base font-medium">Detailed Procedure Description</Label>
|
| 142 |
+
<RichTextEditor
|
| 143 |
+
value={otData.procedure}
|
| 144 |
+
onChange={(value) => handleInputChange("procedure", value)}
|
| 145 |
+
placeholder="Enter detailed step-by-step description of the surgical procedure..."
|
| 146 |
+
rows={6}
|
| 147 |
+
fieldType="ot-procedure"
|
| 148 |
+
/>
|
| 149 |
+
</CardContent>
|
| 150 |
+
</Card>
|
| 151 |
+
|
| 152 |
+
{/* Operative Findings */}
|
| 153 |
+
<Card>
|
| 154 |
+
<CardHeader>
|
| 155 |
+
<CardTitle>Operative Findings</CardTitle>
|
| 156 |
+
</CardHeader>
|
| 157 |
+
<CardContent>
|
| 158 |
+
<Label className="text-base font-medium">Intraoperative Findings and Observations</Label>
|
| 159 |
+
<RichTextEditor
|
| 160 |
+
value={otData.findings}
|
| 161 |
+
onChange={(value) => handleInputChange("findings", value)}
|
| 162 |
+
placeholder="Describe anatomical findings, pathological observations..."
|
| 163 |
+
rows={5}
|
| 164 |
+
fieldType="ot-findings"
|
| 165 |
+
/>
|
| 166 |
+
</CardContent>
|
| 167 |
+
</Card>
|
| 168 |
+
|
| 169 |
+
{/* Complications */}
|
| 170 |
+
<Card>
|
| 171 |
+
<CardHeader>
|
| 172 |
+
<CardTitle>Complications</CardTitle>
|
| 173 |
+
</CardHeader>
|
| 174 |
+
<CardContent>
|
| 175 |
+
<Label className="text-base font-medium">Intraoperative Complications (if any)</Label>
|
| 176 |
+
<RichTextEditor
|
| 177 |
+
value={otData.complications}
|
| 178 |
+
onChange={(value) => handleInputChange("complications", value)}
|
| 179 |
+
placeholder="Document any complications. Enter 'None' if no complications occurred..."
|
| 180 |
+
rows={3}
|
| 181 |
+
fieldType="general"
|
| 182 |
+
/>
|
| 183 |
+
</CardContent>
|
| 184 |
+
</Card>
|
| 185 |
+
|
| 186 |
+
{/* Post-operative Instructions */}
|
| 187 |
+
<Card>
|
| 188 |
+
<CardHeader>
|
| 189 |
+
<CardTitle>Post-operative Instructions</CardTitle>
|
| 190 |
+
</CardHeader>
|
| 191 |
+
<CardContent>
|
| 192 |
+
<Label className="text-base font-medium">Post-operative Care and Instructions</Label>
|
| 193 |
+
<RichTextEditor
|
| 194 |
+
value={otData.postOpInstructions}
|
| 195 |
+
onChange={(value) => handleInputChange("postOpInstructions", value)}
|
| 196 |
+
placeholder="Enter post-operative care instructions, monitoring requirements..."
|
| 197 |
+
rows={5}
|
| 198 |
+
fieldType="plan"
|
| 199 |
+
/>
|
| 200 |
+
</CardContent>
|
| 201 |
+
</Card>
|
| 202 |
+
</div>
|
| 203 |
+
)
|
| 204 |
+
}
|
ipdmodule/components/ot-notes-form.tsx
ADDED
|
@@ -0,0 +1,266 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"use client"
|
| 2 |
+
|
| 3 |
+
import { useState, useEffect } from "react"
|
| 4 |
+
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"
|
| 5 |
+
import { Input } from "@/components/ui/input"
|
| 6 |
+
import { Label } from "@/components/ui/label"
|
| 7 |
+
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select"
|
| 8 |
+
import { Button } from "@/components/ui/button"
|
| 9 |
+
import { RichTextEditor } from "./rich-text-editor"
|
| 10 |
+
import { FormNavigation } from "./form-navigation"
|
| 11 |
+
import { Clock, Scissors, Heart, AlertTriangle } from "lucide-react"
|
| 12 |
+
|
| 13 |
+
export function OTNotesForm() {
|
| 14 |
+
const [activeSection, setActiveSection] = useState("pre-operative")
|
| 15 |
+
const [formData, setFormData] = useState({
|
| 16 |
+
preOperative: "",
|
| 17 |
+
operativeDetails: "",
|
| 18 |
+
postOperative: "",
|
| 19 |
+
complications: "",
|
| 20 |
+
})
|
| 21 |
+
|
| 22 |
+
const sections = [
|
| 23 |
+
{ id: "pre-operative", label: "Pre-Operative", icon: <Clock className="w-4 h-4" /> },
|
| 24 |
+
{ id: "operative-details", label: "Operative Details", icon: <Scissors className="w-4 h-4" /> },
|
| 25 |
+
{ id: "post-operative", label: "Post-Operative", icon: <Heart className="w-4 h-4" /> },
|
| 26 |
+
{ id: "complications", label: "Complications", icon: <AlertTriangle className="w-4 h-4" /> },
|
| 27 |
+
]
|
| 28 |
+
|
| 29 |
+
useEffect(() => {
|
| 30 |
+
const handleScroll = () => {
|
| 31 |
+
const sectionElements = sections.map((section) => ({
|
| 32 |
+
id: section.id,
|
| 33 |
+
element: document.getElementById(section.id),
|
| 34 |
+
}))
|
| 35 |
+
|
| 36 |
+
const currentSection = sectionElements.find(({ element }) => {
|
| 37 |
+
if (!element) return false
|
| 38 |
+
const rect = element.getBoundingClientRect()
|
| 39 |
+
return rect.top <= 100 && rect.bottom >= 100
|
| 40 |
+
})
|
| 41 |
+
|
| 42 |
+
if (currentSection) {
|
| 43 |
+
setActiveSection(currentSection.id)
|
| 44 |
+
}
|
| 45 |
+
}
|
| 46 |
+
|
| 47 |
+
window.addEventListener("scroll", handleScroll)
|
| 48 |
+
return () => window.removeEventListener("scroll", handleScroll)
|
| 49 |
+
}, [])
|
| 50 |
+
|
| 51 |
+
const updateFormData = (field: string, value: string) => {
|
| 52 |
+
setFormData((prev) => ({ ...prev, [field]: value }))
|
| 53 |
+
}
|
| 54 |
+
|
| 55 |
+
return (
|
| 56 |
+
<div className="relative">
|
| 57 |
+
<FormNavigation sections={sections} activeSection={activeSection} onSectionChange={setActiveSection} />
|
| 58 |
+
|
| 59 |
+
<div className="max-w-4xl mx-auto space-y-6 pl-0 md:pl-16">
|
| 60 |
+
{/* Pre-Operative Section */}
|
| 61 |
+
<Card id="pre-operative" className="scroll-mt-20">
|
| 62 |
+
<CardHeader className="bg-blue-50 border-b">
|
| 63 |
+
<CardTitle className="flex items-center gap-2 text-blue-800">
|
| 64 |
+
<Clock className="w-5 h-5" />
|
| 65 |
+
Pre-Operative Assessment
|
| 66 |
+
</CardTitle>
|
| 67 |
+
</CardHeader>
|
| 68 |
+
<CardContent className="p-6 space-y-4">
|
| 69 |
+
<div className="grid grid-cols-1 md:grid-cols-2 gap-4">
|
| 70 |
+
<div>
|
| 71 |
+
<Label htmlFor="procedure-name">Procedure Name</Label>
|
| 72 |
+
<Input id="procedure-name" placeholder="Name of surgical procedure" />
|
| 73 |
+
</div>
|
| 74 |
+
<div>
|
| 75 |
+
<Label htmlFor="surgeon">Primary Surgeon</Label>
|
| 76 |
+
<Input id="surgeon" placeholder="Dr. Name" />
|
| 77 |
+
</div>
|
| 78 |
+
<div>
|
| 79 |
+
<Label htmlFor="anesthesia-type">Anesthesia Type</Label>
|
| 80 |
+
<Select>
|
| 81 |
+
<SelectTrigger>
|
| 82 |
+
<SelectValue placeholder="Select anesthesia type" />
|
| 83 |
+
</SelectTrigger>
|
| 84 |
+
<SelectContent>
|
| 85 |
+
<SelectItem value="general">General</SelectItem>
|
| 86 |
+
<SelectItem value="spinal">Spinal</SelectItem>
|
| 87 |
+
<SelectItem value="epidural">Epidural</SelectItem>
|
| 88 |
+
<SelectItem value="local">Local</SelectItem>
|
| 89 |
+
</SelectContent>
|
| 90 |
+
</Select>
|
| 91 |
+
</div>
|
| 92 |
+
<div>
|
| 93 |
+
<Label htmlFor="asa-grade">ASA Grade</Label>
|
| 94 |
+
<Select>
|
| 95 |
+
<SelectTrigger>
|
| 96 |
+
<SelectValue placeholder="Select ASA grade" />
|
| 97 |
+
</SelectTrigger>
|
| 98 |
+
<SelectContent>
|
| 99 |
+
<SelectItem value="1">ASA I</SelectItem>
|
| 100 |
+
<SelectItem value="2">ASA II</SelectItem>
|
| 101 |
+
<SelectItem value="3">ASA III</SelectItem>
|
| 102 |
+
<SelectItem value="4">ASA IV</SelectItem>
|
| 103 |
+
</SelectContent>
|
| 104 |
+
</Select>
|
| 105 |
+
</div>
|
| 106 |
+
</div>
|
| 107 |
+
<div>
|
| 108 |
+
<Label htmlFor="pre-op-assessment">Pre-Operative Assessment</Label>
|
| 109 |
+
<RichTextEditor
|
| 110 |
+
value={formData.preOperative}
|
| 111 |
+
onChange={(value) => updateFormData("preOperative", value)}
|
| 112 |
+
placeholder="Pre-operative patient condition, vital signs, investigations..."
|
| 113 |
+
fieldType="assessment"
|
| 114 |
+
rows={5}
|
| 115 |
+
showAutofill={true}
|
| 116 |
+
autofillSource="Pre-Op Checklist"
|
| 117 |
+
autofillTimestamp="2024-01-15, 8:00 AM"
|
| 118 |
+
/>
|
| 119 |
+
</div>
|
| 120 |
+
</CardContent>
|
| 121 |
+
</Card>
|
| 122 |
+
|
| 123 |
+
{/* Operative Details Section */}
|
| 124 |
+
<Card id="operative-details" className="scroll-mt-20">
|
| 125 |
+
<CardHeader className="bg-red-50 border-b">
|
| 126 |
+
<CardTitle className="flex items-center gap-2 text-red-800">
|
| 127 |
+
<Scissors className="w-5 h-5" />
|
| 128 |
+
Operative Details
|
| 129 |
+
</CardTitle>
|
| 130 |
+
</CardHeader>
|
| 131 |
+
<CardContent className="p-6 space-y-4">
|
| 132 |
+
<div className="grid grid-cols-1 md:grid-cols-3 gap-4">
|
| 133 |
+
<div>
|
| 134 |
+
<Label htmlFor="start-time">Start Time</Label>
|
| 135 |
+
<Input id="start-time" type="time" />
|
| 136 |
+
</div>
|
| 137 |
+
<div>
|
| 138 |
+
<Label htmlFor="end-time">End Time</Label>
|
| 139 |
+
<Input id="end-time" type="time" />
|
| 140 |
+
</div>
|
| 141 |
+
<div>
|
| 142 |
+
<Label htmlFor="duration">Duration</Label>
|
| 143 |
+
<Input id="duration" placeholder="e.g., 2 hours 30 mins" />
|
| 144 |
+
</div>
|
| 145 |
+
</div>
|
| 146 |
+
<div>
|
| 147 |
+
<Label htmlFor="operative-procedure">Operative Procedure</Label>
|
| 148 |
+
<RichTextEditor
|
| 149 |
+
value={formData.operativeDetails}
|
| 150 |
+
onChange={(value) => updateFormData("operativeDetails", value)}
|
| 151 |
+
placeholder="Detailed description of the surgical procedure performed..."
|
| 152 |
+
fieldType="ot-procedure"
|
| 153 |
+
rows={8}
|
| 154 |
+
/>
|
| 155 |
+
</div>
|
| 156 |
+
<div className="grid grid-cols-1 md:grid-cols-2 gap-4">
|
| 157 |
+
<div>
|
| 158 |
+
<Label htmlFor="findings">Operative Findings</Label>
|
| 159 |
+
<RichTextEditor
|
| 160 |
+
value=""
|
| 161 |
+
onChange={() => {}}
|
| 162 |
+
placeholder="Intraoperative findings and observations..."
|
| 163 |
+
fieldType="assessment"
|
| 164 |
+
rows={4}
|
| 165 |
+
/>
|
| 166 |
+
</div>
|
| 167 |
+
<div>
|
| 168 |
+
<Label htmlFor="specimens">Specimens Sent</Label>
|
| 169 |
+
<RichTextEditor
|
| 170 |
+
value=""
|
| 171 |
+
onChange={() => {}}
|
| 172 |
+
placeholder="Specimens sent for histopathology..."
|
| 173 |
+
fieldType="general"
|
| 174 |
+
rows={4}
|
| 175 |
+
/>
|
| 176 |
+
</div>
|
| 177 |
+
</div>
|
| 178 |
+
</CardContent>
|
| 179 |
+
</Card>
|
| 180 |
+
|
| 181 |
+
{/* Post-Operative Section */}
|
| 182 |
+
<Card id="post-operative" className="scroll-mt-20">
|
| 183 |
+
<CardHeader className="bg-green-50 border-b">
|
| 184 |
+
<CardTitle className="flex items-center gap-2 text-green-800">
|
| 185 |
+
<Heart className="w-5 h-5" />
|
| 186 |
+
Post-Operative Care
|
| 187 |
+
</CardTitle>
|
| 188 |
+
</CardHeader>
|
| 189 |
+
<CardContent className="p-6 space-y-4">
|
| 190 |
+
<div>
|
| 191 |
+
<Label htmlFor="post-op-condition">Post-Operative Condition</Label>
|
| 192 |
+
<RichTextEditor
|
| 193 |
+
value={formData.postOperative}
|
| 194 |
+
onChange={(value) => updateFormData("postOperative", value)}
|
| 195 |
+
placeholder="Patient's condition immediately post-surgery..."
|
| 196 |
+
fieldType="assessment"
|
| 197 |
+
rows={4}
|
| 198 |
+
/>
|
| 199 |
+
</div>
|
| 200 |
+
<div className="grid grid-cols-1 md:grid-cols-2 gap-4">
|
| 201 |
+
<div>
|
| 202 |
+
<Label htmlFor="post-op-orders">Post-Operative Orders</Label>
|
| 203 |
+
<RichTextEditor
|
| 204 |
+
value=""
|
| 205 |
+
onChange={() => {}}
|
| 206 |
+
placeholder="Post-operative care instructions and orders..."
|
| 207 |
+
fieldType="plan"
|
| 208 |
+
rows={5}
|
| 209 |
+
/>
|
| 210 |
+
</div>
|
| 211 |
+
<div>
|
| 212 |
+
<Label htmlFor="recovery-plan">Recovery Plan</Label>
|
| 213 |
+
<RichTextEditor
|
| 214 |
+
value=""
|
| 215 |
+
onChange={() => {}}
|
| 216 |
+
placeholder="Expected recovery timeline and milestones..."
|
| 217 |
+
fieldType="plan"
|
| 218 |
+
rows={5}
|
| 219 |
+
/>
|
| 220 |
+
</div>
|
| 221 |
+
</div>
|
| 222 |
+
</CardContent>
|
| 223 |
+
</Card>
|
| 224 |
+
|
| 225 |
+
{/* Complications Section */}
|
| 226 |
+
<Card id="complications" className="scroll-mt-20">
|
| 227 |
+
<CardHeader className="bg-yellow-50 border-b">
|
| 228 |
+
<CardTitle className="flex items-center gap-2 text-yellow-800">
|
| 229 |
+
<AlertTriangle className="w-5 h-5" />
|
| 230 |
+
Complications & Notes
|
| 231 |
+
</CardTitle>
|
| 232 |
+
</CardHeader>
|
| 233 |
+
<CardContent className="p-6 space-y-4">
|
| 234 |
+
<div>
|
| 235 |
+
<Label htmlFor="complications-notes">Complications (if any)</Label>
|
| 236 |
+
<RichTextEditor
|
| 237 |
+
value={formData.complications}
|
| 238 |
+
onChange={(value) => updateFormData("complications", value)}
|
| 239 |
+
placeholder="Any intraoperative or immediate post-operative complications..."
|
| 240 |
+
fieldType="general"
|
| 241 |
+
rows={4}
|
| 242 |
+
/>
|
| 243 |
+
</div>
|
| 244 |
+
<div>
|
| 245 |
+
<Label htmlFor="additional-notes">Additional Notes</Label>
|
| 246 |
+
<RichTextEditor
|
| 247 |
+
value=""
|
| 248 |
+
onChange={() => {}}
|
| 249 |
+
placeholder="Any additional observations or special instructions..."
|
| 250 |
+
fieldType="general"
|
| 251 |
+
rows={4}
|
| 252 |
+
/>
|
| 253 |
+
</div>
|
| 254 |
+
</CardContent>
|
| 255 |
+
</Card>
|
| 256 |
+
|
| 257 |
+
{/* Form Actions */}
|
| 258 |
+
<div className="flex justify-end gap-4 py-6">
|
| 259 |
+
<Button variant="outline">Save Draft</Button>
|
| 260 |
+
<Button variant="outline">Print</Button>
|
| 261 |
+
<Button>Submit OT Notes</Button>
|
| 262 |
+
</div>
|
| 263 |
+
</div>
|
| 264 |
+
</div>
|
| 265 |
+
)
|
| 266 |
+
}
|
ipdmodule/components/progress-notes-form.tsx
ADDED
|
@@ -0,0 +1,217 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"use client"
|
| 2 |
+
|
| 3 |
+
import { useState, useEffect } from "react"
|
| 4 |
+
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"
|
| 5 |
+
import { Input } from "@/components/ui/input"
|
| 6 |
+
import { Label } from "@/components/ui/label"
|
| 7 |
+
import { Button } from "@/components/ui/button"
|
| 8 |
+
import { RichTextEditor } from "./rich-text-editor"
|
| 9 |
+
import { FormNavigation } from "./form-navigation"
|
| 10 |
+
import { User, Activity, ClipboardList, Heart, FileText } from "lucide-react"
|
| 11 |
+
|
| 12 |
+
export function ProgressNotesForm() {
|
| 13 |
+
const [activeSection, setActiveSection] = useState("basic-info")
|
| 14 |
+
const [formData, setFormData] = useState({
|
| 15 |
+
basicInfo: "",
|
| 16 |
+
vitals: "",
|
| 17 |
+
assessment: "",
|
| 18 |
+
plan: "",
|
| 19 |
+
notes: "",
|
| 20 |
+
})
|
| 21 |
+
|
| 22 |
+
const sections = [
|
| 23 |
+
{ id: "basic-info", label: "Basic Info", icon: <User className="w-4 h-4" /> },
|
| 24 |
+
{ id: "vitals", label: "Vitals", icon: <Activity className="w-4 h-4" /> },
|
| 25 |
+
{ id: "assessment", label: "Assessment", icon: <ClipboardList className="w-4 h-4" /> },
|
| 26 |
+
{ id: "plan", label: "Plan", icon: <Heart className="w-4 h-4" /> },
|
| 27 |
+
{ id: "notes", label: "Notes", icon: <FileText className="w-4 h-4" /> },
|
| 28 |
+
]
|
| 29 |
+
|
| 30 |
+
useEffect(() => {
|
| 31 |
+
const handleScroll = () => {
|
| 32 |
+
const sectionElements = sections.map((section) => ({
|
| 33 |
+
id: section.id,
|
| 34 |
+
element: document.getElementById(section.id),
|
| 35 |
+
}))
|
| 36 |
+
|
| 37 |
+
const currentSection = sectionElements.find(({ element }) => {
|
| 38 |
+
if (!element) return false
|
| 39 |
+
const rect = element.getBoundingClientRect()
|
| 40 |
+
return rect.top <= 100 && rect.bottom >= 100
|
| 41 |
+
})
|
| 42 |
+
|
| 43 |
+
if (currentSection) {
|
| 44 |
+
setActiveSection(currentSection.id)
|
| 45 |
+
}
|
| 46 |
+
}
|
| 47 |
+
|
| 48 |
+
window.addEventListener("scroll", handleScroll)
|
| 49 |
+
return () => window.removeEventListener("scroll", handleScroll)
|
| 50 |
+
}, [])
|
| 51 |
+
|
| 52 |
+
const updateFormData = (field: string, value: string) => {
|
| 53 |
+
setFormData((prev) => ({ ...prev, [field]: value }))
|
| 54 |
+
}
|
| 55 |
+
|
| 56 |
+
return (
|
| 57 |
+
<div className="relative">
|
| 58 |
+
<FormNavigation sections={sections} activeSection={activeSection} onSectionChange={setActiveSection} />
|
| 59 |
+
|
| 60 |
+
<div className="max-w-4xl mx-auto space-y-6 pl-0 md:pl-16">
|
| 61 |
+
{/* Basic Info Section */}
|
| 62 |
+
<Card id="basic-info" className="scroll-mt-20">
|
| 63 |
+
<CardHeader className="bg-blue-50 border-b">
|
| 64 |
+
<CardTitle className="flex items-center gap-2 text-blue-800">
|
| 65 |
+
<User className="w-5 h-5" />
|
| 66 |
+
Basic Information
|
| 67 |
+
</CardTitle>
|
| 68 |
+
</CardHeader>
|
| 69 |
+
<CardContent className="p-6 space-y-4">
|
| 70 |
+
<div className="grid grid-cols-1 md:grid-cols-3 gap-4">
|
| 71 |
+
<div>
|
| 72 |
+
<Label htmlFor="date">Date</Label>
|
| 73 |
+
<Input id="date" type="date" />
|
| 74 |
+
</div>
|
| 75 |
+
<div>
|
| 76 |
+
<Label htmlFor="time">Time</Label>
|
| 77 |
+
<Input id="time" type="time" />
|
| 78 |
+
</div>
|
| 79 |
+
<div>
|
| 80 |
+
<Label htmlFor="day-post-op">Day Post-Op</Label>
|
| 81 |
+
<Input id="day-post-op" placeholder="e.g., POD #3" />
|
| 82 |
+
</div>
|
| 83 |
+
</div>
|
| 84 |
+
<div>
|
| 85 |
+
<Label htmlFor="subjective">Subjective (Patient's Complaints)</Label>
|
| 86 |
+
<RichTextEditor
|
| 87 |
+
value={formData.basicInfo}
|
| 88 |
+
onChange={(value) => updateFormData("basicInfo", value)}
|
| 89 |
+
placeholder="Patient's subjective complaints and symptoms..."
|
| 90 |
+
fieldType="chief-complaints"
|
| 91 |
+
showAutofill={true}
|
| 92 |
+
autofillSource="Patient Interview"
|
| 93 |
+
autofillTimestamp="2024-01-15, 10:30 AM"
|
| 94 |
+
/>
|
| 95 |
+
</div>
|
| 96 |
+
</CardContent>
|
| 97 |
+
</Card>
|
| 98 |
+
|
| 99 |
+
{/* Vitals Section */}
|
| 100 |
+
<Card id="vitals" className="scroll-mt-20">
|
| 101 |
+
<CardHeader className="bg-green-50 border-b">
|
| 102 |
+
<CardTitle className="flex items-center gap-2 text-green-800">
|
| 103 |
+
<Activity className="w-5 h-5" />
|
| 104 |
+
Vital Signs & Objective Findings
|
| 105 |
+
</CardTitle>
|
| 106 |
+
</CardHeader>
|
| 107 |
+
<CardContent className="p-6 space-y-4">
|
| 108 |
+
<div className="grid grid-cols-2 md:grid-cols-4 gap-4">
|
| 109 |
+
<div>
|
| 110 |
+
<Label htmlFor="bp">Blood Pressure</Label>
|
| 111 |
+
<Input id="bp" placeholder="120/80" />
|
| 112 |
+
</div>
|
| 113 |
+
<div>
|
| 114 |
+
<Label htmlFor="pulse">Pulse</Label>
|
| 115 |
+
<Input id="pulse" placeholder="72 bpm" />
|
| 116 |
+
</div>
|
| 117 |
+
<div>
|
| 118 |
+
<Label htmlFor="temp">Temperature</Label>
|
| 119 |
+
<Input id="temp" placeholder="98.6°F" />
|
| 120 |
+
</div>
|
| 121 |
+
<div>
|
| 122 |
+
<Label htmlFor="resp">Respiratory Rate</Label>
|
| 123 |
+
<Input id="resp" placeholder="16/min" />
|
| 124 |
+
</div>
|
| 125 |
+
</div>
|
| 126 |
+
<div>
|
| 127 |
+
<Label htmlFor="objective">Objective Findings</Label>
|
| 128 |
+
<RichTextEditor
|
| 129 |
+
value={formData.vitals}
|
| 130 |
+
onChange={(value) => updateFormData("vitals", value)}
|
| 131 |
+
placeholder="Physical examination findings, lab results, imaging..."
|
| 132 |
+
fieldType="assessment"
|
| 133 |
+
rows={5}
|
| 134 |
+
showAutofill={true}
|
| 135 |
+
autofillSource="Nursing Station"
|
| 136 |
+
autofillTimestamp="2024-01-15, 11:00 AM"
|
| 137 |
+
/>
|
| 138 |
+
</div>
|
| 139 |
+
</CardContent>
|
| 140 |
+
</Card>
|
| 141 |
+
|
| 142 |
+
{/* Assessment Section */}
|
| 143 |
+
<Card id="assessment" className="scroll-mt-20">
|
| 144 |
+
<CardHeader className="bg-red-50 border-b">
|
| 145 |
+
<CardTitle className="flex items-center gap-2 text-red-800">
|
| 146 |
+
<ClipboardList className="w-5 h-5" />
|
| 147 |
+
Assessment
|
| 148 |
+
</CardTitle>
|
| 149 |
+
</CardHeader>
|
| 150 |
+
<CardContent className="p-6 space-y-4">
|
| 151 |
+
<div>
|
| 152 |
+
<Label htmlFor="clinical-assessment">Clinical Assessment</Label>
|
| 153 |
+
<RichTextEditor
|
| 154 |
+
value={formData.assessment}
|
| 155 |
+
onChange={(value) => updateFormData("assessment", value)}
|
| 156 |
+
placeholder="Current clinical status, progress, complications..."
|
| 157 |
+
fieldType="assessment"
|
| 158 |
+
rows={6}
|
| 159 |
+
/>
|
| 160 |
+
</div>
|
| 161 |
+
</CardContent>
|
| 162 |
+
</Card>
|
| 163 |
+
|
| 164 |
+
{/* Plan Section */}
|
| 165 |
+
<Card id="plan" className="scroll-mt-20">
|
| 166 |
+
<CardHeader className="bg-indigo-50 border-b">
|
| 167 |
+
<CardTitle className="flex items-center gap-2 text-indigo-800">
|
| 168 |
+
<Heart className="w-5 h-5" />
|
| 169 |
+
Plan
|
| 170 |
+
</CardTitle>
|
| 171 |
+
</CardHeader>
|
| 172 |
+
<CardContent className="p-6 space-y-4">
|
| 173 |
+
<div>
|
| 174 |
+
<Label htmlFor="treatment-plan">Treatment Plan</Label>
|
| 175 |
+
<RichTextEditor
|
| 176 |
+
value={formData.plan}
|
| 177 |
+
onChange={(value) => updateFormData("plan", value)}
|
| 178 |
+
placeholder="Treatment modifications, new orders, discharge planning..."
|
| 179 |
+
fieldType="plan"
|
| 180 |
+
rows={6}
|
| 181 |
+
/>
|
| 182 |
+
</div>
|
| 183 |
+
</CardContent>
|
| 184 |
+
</Card>
|
| 185 |
+
|
| 186 |
+
{/* Additional Notes Section */}
|
| 187 |
+
<Card id="notes" className="scroll-mt-20">
|
| 188 |
+
<CardHeader className="bg-gray-50 border-b">
|
| 189 |
+
<CardTitle className="flex items-center gap-2 text-gray-800">
|
| 190 |
+
<FileText className="w-5 h-5" />
|
| 191 |
+
Additional Notes
|
| 192 |
+
</CardTitle>
|
| 193 |
+
</CardHeader>
|
| 194 |
+
<CardContent className="p-6 space-y-4">
|
| 195 |
+
<div>
|
| 196 |
+
<Label htmlFor="additional-notes">Additional Notes</Label>
|
| 197 |
+
<RichTextEditor
|
| 198 |
+
value={formData.notes}
|
| 199 |
+
onChange={(value) => updateFormData("notes", value)}
|
| 200 |
+
placeholder="Any additional observations, communications, or instructions..."
|
| 201 |
+
fieldType="general"
|
| 202 |
+
rows={4}
|
| 203 |
+
/>
|
| 204 |
+
</div>
|
| 205 |
+
</CardContent>
|
| 206 |
+
</Card>
|
| 207 |
+
|
| 208 |
+
{/* Form Actions */}
|
| 209 |
+
<div className="flex justify-end gap-4 py-6">
|
| 210 |
+
<Button variant="outline">Save Draft</Button>
|
| 211 |
+
<Button variant="outline">Print</Button>
|
| 212 |
+
<Button>Submit Progress Note</Button>
|
| 213 |
+
</div>
|
| 214 |
+
</div>
|
| 215 |
+
</div>
|
| 216 |
+
)
|
| 217 |
+
}
|
ipdmodule/components/progress-notes.tsx
ADDED
|
@@ -0,0 +1,230 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"use client"
|
| 2 |
+
|
| 3 |
+
import { useState } from "react"
|
| 4 |
+
import { Button } from "@/components/ui/button"
|
| 5 |
+
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"
|
| 6 |
+
import { Input } from "@/components/ui/input"
|
| 7 |
+
import { Label } from "@/components/ui/label"
|
| 8 |
+
import { RichTextEditor } from "./rich-text-editor"
|
| 9 |
+
import { Plus, Calendar, Sun, Sunset, Moon, Clock } from "lucide-react"
|
| 10 |
+
|
| 11 |
+
interface ProgressNotesProps {
|
| 12 |
+
patient: any
|
| 13 |
+
}
|
| 14 |
+
|
| 15 |
+
export function ProgressNotes({ patient }: ProgressNotesProps) {
|
| 16 |
+
const [showAddNote, setShowAddNote] = useState(false)
|
| 17 |
+
const [currentDate, setCurrentDate] = useState(new Date().toISOString().split("T")[0])
|
| 18 |
+
|
| 19 |
+
const [morningShift, setMorningShift] = useState({
|
| 20 |
+
complaints: "",
|
| 21 |
+
findings: "",
|
| 22 |
+
vitals: "",
|
| 23 |
+
events: "",
|
| 24 |
+
doctor: "",
|
| 25 |
+
})
|
| 26 |
+
|
| 27 |
+
const [eveningShift, setEveningShift] = useState({
|
| 28 |
+
complaints: "",
|
| 29 |
+
findings: "",
|
| 30 |
+
vitals: "",
|
| 31 |
+
events: "",
|
| 32 |
+
doctor: "",
|
| 33 |
+
})
|
| 34 |
+
|
| 35 |
+
const [nightShift, setNightShift] = useState({
|
| 36 |
+
complaints: "",
|
| 37 |
+
findings: "",
|
| 38 |
+
vitals: "",
|
| 39 |
+
events: "",
|
| 40 |
+
doctor: "",
|
| 41 |
+
})
|
| 42 |
+
|
| 43 |
+
const handleShiftChange = (shift: string, field: string, value: string) => {
|
| 44 |
+
if (shift === "morning") {
|
| 45 |
+
setMorningShift((prev) => ({ ...prev, [field]: value }))
|
| 46 |
+
} else if (shift === "evening") {
|
| 47 |
+
setEveningShift((prev) => ({ ...prev, [field]: value }))
|
| 48 |
+
} else if (shift === "night") {
|
| 49 |
+
setNightShift((prev) => ({ ...prev, [field]: value }))
|
| 50 |
+
}
|
| 51 |
+
}
|
| 52 |
+
|
| 53 |
+
const ShiftCard = ({
|
| 54 |
+
title,
|
| 55 |
+
icon: Icon,
|
| 56 |
+
bgColor,
|
| 57 |
+
shift,
|
| 58 |
+
shiftData,
|
| 59 |
+
}: {
|
| 60 |
+
title: string
|
| 61 |
+
icon: any
|
| 62 |
+
bgColor: string
|
| 63 |
+
shift: string
|
| 64 |
+
shiftData: any
|
| 65 |
+
}) => (
|
| 66 |
+
<Card className={`${bgColor} border-2`}>
|
| 67 |
+
<CardHeader>
|
| 68 |
+
<CardTitle className="flex items-center gap-2">
|
| 69 |
+
<Icon className="w-5 h-5" />
|
| 70 |
+
{title}
|
| 71 |
+
</CardTitle>
|
| 72 |
+
</CardHeader>
|
| 73 |
+
<CardContent className="space-y-4">
|
| 74 |
+
<div>
|
| 75 |
+
<Label className="text-sm font-medium">Chief Complaints</Label>
|
| 76 |
+
<RichTextEditor
|
| 77 |
+
value={shiftData.complaints}
|
| 78 |
+
onChange={(value) => handleShiftChange(shift, "complaints", value)}
|
| 79 |
+
placeholder="Enter chief complaints for this shift..."
|
| 80 |
+
rows={2}
|
| 81 |
+
fieldType="chief-complaints"
|
| 82 |
+
/>
|
| 83 |
+
</div>
|
| 84 |
+
|
| 85 |
+
<div>
|
| 86 |
+
<Label className="text-sm font-medium">Findings (Systemic examination)</Label>
|
| 87 |
+
<RichTextEditor
|
| 88 |
+
value={shiftData.findings}
|
| 89 |
+
onChange={(value) => handleShiftChange(shift, "findings", value)}
|
| 90 |
+
placeholder="Enter examination findings..."
|
| 91 |
+
rows={3}
|
| 92 |
+
fieldType="assessment"
|
| 93 |
+
/>
|
| 94 |
+
</div>
|
| 95 |
+
|
| 96 |
+
<div>
|
| 97 |
+
<Label className="text-sm font-medium">Vital Parameters</Label>
|
| 98 |
+
<RichTextEditor
|
| 99 |
+
value={shiftData.vitals}
|
| 100 |
+
onChange={(value) => handleShiftChange(shift, "vitals", value)}
|
| 101 |
+
placeholder="BP: 120/80, Pulse: 72, Temp: 98.6°F, RR: 16"
|
| 102 |
+
rows={2}
|
| 103 |
+
fieldType="general"
|
| 104 |
+
/>
|
| 105 |
+
</div>
|
| 106 |
+
|
| 107 |
+
<div>
|
| 108 |
+
<Label className="text-sm font-medium">Specific Event</Label>
|
| 109 |
+
<RichTextEditor
|
| 110 |
+
value={shiftData.events}
|
| 111 |
+
onChange={(value) => handleShiftChange(shift, "events", value)}
|
| 112 |
+
placeholder="Any specific events or observations..."
|
| 113 |
+
rows={2}
|
| 114 |
+
fieldType="general"
|
| 115 |
+
/>
|
| 116 |
+
</div>
|
| 117 |
+
|
| 118 |
+
<div>
|
| 119 |
+
<Label className="text-sm font-medium">Doctor Name</Label>
|
| 120 |
+
<Input
|
| 121 |
+
value={shiftData.doctor}
|
| 122 |
+
onChange={(e) => handleShiftChange(shift, "doctor", e.target.value)}
|
| 123 |
+
placeholder="Enter doctor name"
|
| 124 |
+
className="bg-white"
|
| 125 |
+
/>
|
| 126 |
+
</div>
|
| 127 |
+
</CardContent>
|
| 128 |
+
</Card>
|
| 129 |
+
)
|
| 130 |
+
|
| 131 |
+
return (
|
| 132 |
+
<div className="space-y-6">
|
| 133 |
+
{/* Header */}
|
| 134 |
+
<div className="flex items-center justify-between">
|
| 135 |
+
<div>
|
| 136 |
+
<h2 className="text-xl font-semibold">Daily Progress Notes</h2>
|
| 137 |
+
<p className="text-sm text-gray-600">Three-shift monitoring for {patient.name}</p>
|
| 138 |
+
</div>
|
| 139 |
+
<Button onClick={() => setShowAddNote(!showAddNote)} className="gap-2">
|
| 140 |
+
<Plus className="w-4 h-4" />
|
| 141 |
+
Add Progress Note
|
| 142 |
+
</Button>
|
| 143 |
+
</div>
|
| 144 |
+
|
| 145 |
+
{/* Add New Note Form */}
|
| 146 |
+
{showAddNote && (
|
| 147 |
+
<Card className="border-blue-200 bg-blue-50">
|
| 148 |
+
<CardHeader>
|
| 149 |
+
<div className="flex items-center justify-between">
|
| 150 |
+
<CardTitle className="flex items-center gap-2">
|
| 151 |
+
<Calendar className="w-5 h-5" />
|
| 152 |
+
New Daily Progress Note
|
| 153 |
+
</CardTitle>
|
| 154 |
+
<div className="flex items-center gap-2">
|
| 155 |
+
<Label>Date:</Label>
|
| 156 |
+
<Input
|
| 157 |
+
type="date"
|
| 158 |
+
value={currentDate}
|
| 159 |
+
onChange={(e) => setCurrentDate(e.target.value)}
|
| 160 |
+
className="bg-white"
|
| 161 |
+
/>
|
| 162 |
+
</div>
|
| 163 |
+
</div>
|
| 164 |
+
</CardHeader>
|
| 165 |
+
<CardContent className="space-y-6">
|
| 166 |
+
{/* Patient Info */}
|
| 167 |
+
<div className="bg-white p-3 rounded border">
|
| 168 |
+
<Label className="font-medium">Patient Label:</Label>
|
| 169 |
+
<div className="text-sm text-gray-700 mt-1">
|
| 170 |
+
<strong>{patient.name}</strong> | MRN: {patient.mrn} | {patient.age}Y {patient.gender} | Ward:{" "}
|
| 171 |
+
{patient.ward} | Bed: {patient.bed}
|
| 172 |
+
</div>
|
| 173 |
+
</div>
|
| 174 |
+
|
| 175 |
+
{/* Three Shifts */}
|
| 176 |
+
<div className="space-y-6">
|
| 177 |
+
<ShiftCard
|
| 178 |
+
title="Morning"
|
| 179 |
+
icon={Sun}
|
| 180 |
+
bgColor="bg-yellow-50 border-yellow-200"
|
| 181 |
+
shift="morning"
|
| 182 |
+
shiftData={morningShift}
|
| 183 |
+
/>
|
| 184 |
+
|
| 185 |
+
<ShiftCard
|
| 186 |
+
title="Evening"
|
| 187 |
+
icon={Sunset}
|
| 188 |
+
bgColor="bg-orange-50 border-orange-200"
|
| 189 |
+
shift="evening"
|
| 190 |
+
shiftData={eveningShift}
|
| 191 |
+
/>
|
| 192 |
+
|
| 193 |
+
<ShiftCard
|
| 194 |
+
title="Night"
|
| 195 |
+
icon={Moon}
|
| 196 |
+
bgColor="bg-indigo-50 border-indigo-200"
|
| 197 |
+
shift="night"
|
| 198 |
+
shiftData={nightShift}
|
| 199 |
+
/>
|
| 200 |
+
</div>
|
| 201 |
+
|
| 202 |
+
<div className="flex gap-2">
|
| 203 |
+
<Button className="gap-2">
|
| 204 |
+
<Calendar className="w-4 h-4" />
|
| 205 |
+
Save Progress Note
|
| 206 |
+
</Button>
|
| 207 |
+
<Button variant="outline" onClick={() => setShowAddNote(false)}>
|
| 208 |
+
Cancel
|
| 209 |
+
</Button>
|
| 210 |
+
</div>
|
| 211 |
+
</CardContent>
|
| 212 |
+
</Card>
|
| 213 |
+
)}
|
| 214 |
+
|
| 215 |
+
{/* Existing Notes */}
|
| 216 |
+
<Card>
|
| 217 |
+
<CardHeader>
|
| 218 |
+
<CardTitle>Progress Notes History</CardTitle>
|
| 219 |
+
</CardHeader>
|
| 220 |
+
<CardContent>
|
| 221 |
+
<div className="text-center py-8 text-gray-500">
|
| 222 |
+
<Clock className="w-12 h-12 mx-auto mb-4 text-gray-400" />
|
| 223 |
+
<h3 className="text-lg font-medium mb-2">No Progress Notes</h3>
|
| 224 |
+
<p className="text-sm">Start documenting daily progress with three-shift monitoring.</p>
|
| 225 |
+
</div>
|
| 226 |
+
</CardContent>
|
| 227 |
+
</Card>
|
| 228 |
+
</div>
|
| 229 |
+
)
|
| 230 |
+
}
|
ipdmodule/components/radiology-findings-form.tsx
ADDED
|
@@ -0,0 +1,331 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"use client"
|
| 2 |
+
|
| 3 |
+
import { useState } from "react"
|
| 4 |
+
import { Button } from "@/components/ui/button"
|
| 5 |
+
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"
|
| 6 |
+
import { Input } from "@/components/ui/input"
|
| 7 |
+
import { Label } from "@/components/ui/label"
|
| 8 |
+
import { Textarea } from "@/components/ui/textarea"
|
| 9 |
+
import { Badge } from "@/components/ui/badge"
|
| 10 |
+
import { Zap, Plus, Save, Eye, Calendar, User, FileText } from "lucide-react"
|
| 11 |
+
|
| 12 |
+
interface RadiologyFindingsFormProps {
|
| 13 |
+
patient: any
|
| 14 |
+
}
|
| 15 |
+
|
| 16 |
+
export function RadiologyFindingsForm({ patient }: RadiologyFindingsFormProps) {
|
| 17 |
+
const [radiologyRecords, setRadiologyRecords] = useState([
|
| 18 |
+
{
|
| 19 |
+
id: "1",
|
| 20 |
+
date: "2024-01-17",
|
| 21 |
+
time: "14:30",
|
| 22 |
+
studyType: "Chest X-Ray",
|
| 23 |
+
indication: "Chest pain, rule out pneumonia",
|
| 24 |
+
technique: "PA and Lateral views",
|
| 25 |
+
findings:
|
| 26 |
+
"Lungs are clear bilaterally. No consolidation, pleural effusion, or pneumothorax. Heart size normal. Mediastinum unremarkable.",
|
| 27 |
+
impression: "Normal chest radiograph",
|
| 28 |
+
radiologist: "Dr. Wilson",
|
| 29 |
+
status: "Final Report",
|
| 30 |
+
},
|
| 31 |
+
{
|
| 32 |
+
id: "2",
|
| 33 |
+
date: "2024-01-18",
|
| 34 |
+
time: "09:15",
|
| 35 |
+
studyType: "CT Chest with Contrast",
|
| 36 |
+
indication: "Follow-up chest pain, detailed evaluation",
|
| 37 |
+
technique: "Axial CT images of chest with IV contrast",
|
| 38 |
+
findings:
|
| 39 |
+
"No pulmonary embolism. Lungs show no focal consolidation. Small bilateral pleural effusions noted. Heart and great vessels appear normal.",
|
| 40 |
+
impression: "Small bilateral pleural effusions, otherwise normal study",
|
| 41 |
+
radiologist: "Dr. Martinez",
|
| 42 |
+
status: "Final Report",
|
| 43 |
+
},
|
| 44 |
+
])
|
| 45 |
+
|
| 46 |
+
const [newRecord, setNewRecord] = useState({
|
| 47 |
+
date: new Date().toISOString().split("T")[0],
|
| 48 |
+
time: new Date().toTimeString().slice(0, 5),
|
| 49 |
+
studyType: "",
|
| 50 |
+
indication: "",
|
| 51 |
+
technique: "",
|
| 52 |
+
findings: "",
|
| 53 |
+
impression: "",
|
| 54 |
+
radiologist: "",
|
| 55 |
+
status: "Pending",
|
| 56 |
+
})
|
| 57 |
+
|
| 58 |
+
const [showAddRecord, setShowAddRecord] = useState(false)
|
| 59 |
+
|
| 60 |
+
const handleInputChange = (field: string, value: string) => {
|
| 61 |
+
setNewRecord((prev) => ({ ...prev, [field]: value }))
|
| 62 |
+
}
|
| 63 |
+
|
| 64 |
+
const handleSaveRecord = () => {
|
| 65 |
+
const recordToSave = {
|
| 66 |
+
id: Date.now().toString(),
|
| 67 |
+
...newRecord,
|
| 68 |
+
status: "Final Report",
|
| 69 |
+
}
|
| 70 |
+
setRadiologyRecords((prev) => [recordToSave, ...prev])
|
| 71 |
+
setNewRecord({
|
| 72 |
+
date: new Date().toISOString().split("T")[0],
|
| 73 |
+
time: new Date().toTimeString().slice(0, 5),
|
| 74 |
+
studyType: "",
|
| 75 |
+
indication: "",
|
| 76 |
+
technique: "",
|
| 77 |
+
findings: "",
|
| 78 |
+
impression: "",
|
| 79 |
+
radiologist: "",
|
| 80 |
+
status: "Pending",
|
| 81 |
+
})
|
| 82 |
+
setShowAddRecord(false)
|
| 83 |
+
alert("Radiology findings saved successfully!")
|
| 84 |
+
}
|
| 85 |
+
|
| 86 |
+
const getStatusColor = (status: string) => {
|
| 87 |
+
switch (status) {
|
| 88 |
+
case "Final Report":
|
| 89 |
+
return "bg-green-100 text-green-800"
|
| 90 |
+
case "Preliminary":
|
| 91 |
+
return "bg-yellow-100 text-yellow-800"
|
| 92 |
+
case "Pending":
|
| 93 |
+
return "bg-gray-100 text-gray-800"
|
| 94 |
+
default:
|
| 95 |
+
return "bg-gray-100 text-gray-800"
|
| 96 |
+
}
|
| 97 |
+
}
|
| 98 |
+
|
| 99 |
+
const commonStudyTypes = [
|
| 100 |
+
"Chest X-Ray",
|
| 101 |
+
"CT Chest",
|
| 102 |
+
"CT Abdomen",
|
| 103 |
+
"CT Head",
|
| 104 |
+
"MRI Brain",
|
| 105 |
+
"MRI Spine",
|
| 106 |
+
"Ultrasound Abdomen",
|
| 107 |
+
"Ultrasound Pelvis",
|
| 108 |
+
"Mammography",
|
| 109 |
+
"Bone Scan",
|
| 110 |
+
"PET Scan",
|
| 111 |
+
"Angiography",
|
| 112 |
+
]
|
| 113 |
+
|
| 114 |
+
return (
|
| 115 |
+
<div className="space-y-6">
|
| 116 |
+
{/* Header */}
|
| 117 |
+
<div className="flex items-center justify-between">
|
| 118 |
+
<div>
|
| 119 |
+
<h2 className="text-xl font-semibold">Radiology Findings</h2>
|
| 120 |
+
<p className="text-sm text-gray-600">Imaging studies and radiology reports for {patient.name}</p>
|
| 121 |
+
</div>
|
| 122 |
+
<Button onClick={() => setShowAddRecord(!showAddRecord)}>
|
| 123 |
+
<Plus className="w-4 h-4 mr-2" />
|
| 124 |
+
Add Radiology Report
|
| 125 |
+
</Button>
|
| 126 |
+
</div>
|
| 127 |
+
|
| 128 |
+
{/* Add New Record Form */}
|
| 129 |
+
{showAddRecord && (
|
| 130 |
+
<Card className="border-blue-200 bg-blue-50">
|
| 131 |
+
<CardHeader>
|
| 132 |
+
<CardTitle className="flex items-center gap-2">
|
| 133 |
+
<Zap className="w-5 h-5" />
|
| 134 |
+
Add New Radiology Report
|
| 135 |
+
</CardTitle>
|
| 136 |
+
</CardHeader>
|
| 137 |
+
<CardContent className="space-y-4">
|
| 138 |
+
<div className="grid grid-cols-2 gap-4">
|
| 139 |
+
<div>
|
| 140 |
+
<Label htmlFor="date">Study Date</Label>
|
| 141 |
+
<Input
|
| 142 |
+
id="date"
|
| 143 |
+
type="date"
|
| 144 |
+
value={newRecord.date}
|
| 145 |
+
onChange={(e) => handleInputChange("date", e.target.value)}
|
| 146 |
+
className="bg-white"
|
| 147 |
+
/>
|
| 148 |
+
</div>
|
| 149 |
+
<div>
|
| 150 |
+
<Label htmlFor="time">Study Time</Label>
|
| 151 |
+
<Input
|
| 152 |
+
id="time"
|
| 153 |
+
type="time"
|
| 154 |
+
value={newRecord.time}
|
| 155 |
+
onChange={(e) => handleInputChange("time", e.target.value)}
|
| 156 |
+
className="bg-white"
|
| 157 |
+
/>
|
| 158 |
+
</div>
|
| 159 |
+
</div>
|
| 160 |
+
|
| 161 |
+
<div className="grid grid-cols-1 md:grid-cols-2 gap-4">
|
| 162 |
+
<div>
|
| 163 |
+
<Label htmlFor="studyType">Study Type</Label>
|
| 164 |
+
<select
|
| 165 |
+
id="studyType"
|
| 166 |
+
value={newRecord.studyType}
|
| 167 |
+
onChange={(e) => handleInputChange("studyType", e.target.value)}
|
| 168 |
+
className="w-full px-3 py-2 border border-gray-300 rounded-md bg-white"
|
| 169 |
+
>
|
| 170 |
+
<option value="">Select study type...</option>
|
| 171 |
+
{commonStudyTypes.map((type) => (
|
| 172 |
+
<option key={type} value={type}>
|
| 173 |
+
{type}
|
| 174 |
+
</option>
|
| 175 |
+
))}
|
| 176 |
+
<option value="Other">Other</option>
|
| 177 |
+
</select>
|
| 178 |
+
</div>
|
| 179 |
+
<div>
|
| 180 |
+
<Label htmlFor="radiologist">Radiologist</Label>
|
| 181 |
+
<Input
|
| 182 |
+
id="radiologist"
|
| 183 |
+
placeholder="Dr. Name"
|
| 184 |
+
value={newRecord.radiologist}
|
| 185 |
+
onChange={(e) => handleInputChange("radiologist", e.target.value)}
|
| 186 |
+
className="bg-white"
|
| 187 |
+
/>
|
| 188 |
+
</div>
|
| 189 |
+
</div>
|
| 190 |
+
|
| 191 |
+
<div>
|
| 192 |
+
<Label htmlFor="indication">Clinical Indication</Label>
|
| 193 |
+
<Textarea
|
| 194 |
+
id="indication"
|
| 195 |
+
placeholder="Clinical reason for the study..."
|
| 196 |
+
value={newRecord.indication}
|
| 197 |
+
onChange={(e) => handleInputChange("indication", e.target.value)}
|
| 198 |
+
rows={2}
|
| 199 |
+
className="bg-white"
|
| 200 |
+
/>
|
| 201 |
+
</div>
|
| 202 |
+
|
| 203 |
+
<div>
|
| 204 |
+
<Label htmlFor="technique">Technique</Label>
|
| 205 |
+
<Textarea
|
| 206 |
+
id="technique"
|
| 207 |
+
placeholder="Technical details of the study (contrast, views, etc.)..."
|
| 208 |
+
value={newRecord.technique}
|
| 209 |
+
onChange={(e) => handleInputChange("technique", e.target.value)}
|
| 210 |
+
rows={2}
|
| 211 |
+
className="bg-white"
|
| 212 |
+
/>
|
| 213 |
+
</div>
|
| 214 |
+
|
| 215 |
+
<div>
|
| 216 |
+
<Label htmlFor="findings">Findings</Label>
|
| 217 |
+
<Textarea
|
| 218 |
+
id="findings"
|
| 219 |
+
placeholder="Detailed radiological findings..."
|
| 220 |
+
value={newRecord.findings}
|
| 221 |
+
onChange={(e) => handleInputChange("findings", e.target.value)}
|
| 222 |
+
rows={4}
|
| 223 |
+
className="bg-white"
|
| 224 |
+
/>
|
| 225 |
+
</div>
|
| 226 |
+
|
| 227 |
+
<div>
|
| 228 |
+
<Label htmlFor="impression">Impression</Label>
|
| 229 |
+
<Textarea
|
| 230 |
+
id="impression"
|
| 231 |
+
placeholder="Radiologist's impression and conclusion..."
|
| 232 |
+
value={newRecord.impression}
|
| 233 |
+
onChange={(e) => handleInputChange("impression", e.target.value)}
|
| 234 |
+
rows={3}
|
| 235 |
+
className="bg-white"
|
| 236 |
+
/>
|
| 237 |
+
</div>
|
| 238 |
+
|
| 239 |
+
<div className="flex gap-2">
|
| 240 |
+
<Button onClick={handleSaveRecord}>
|
| 241 |
+
<Save className="w-4 h-4 mr-2" />
|
| 242 |
+
Save Report
|
| 243 |
+
</Button>
|
| 244 |
+
<Button variant="outline" onClick={() => setShowAddRecord(false)}>
|
| 245 |
+
Cancel
|
| 246 |
+
</Button>
|
| 247 |
+
</div>
|
| 248 |
+
</CardContent>
|
| 249 |
+
</Card>
|
| 250 |
+
)}
|
| 251 |
+
|
| 252 |
+
{/* Radiology Records */}
|
| 253 |
+
<div className="space-y-4">
|
| 254 |
+
{radiologyRecords.map((record) => (
|
| 255 |
+
<Card key={record.id}>
|
| 256 |
+
<CardHeader>
|
| 257 |
+
<div className="flex items-center justify-between">
|
| 258 |
+
<div className="flex items-center gap-3">
|
| 259 |
+
<Zap className="w-5 h-5 text-blue-600" />
|
| 260 |
+
<div>
|
| 261 |
+
<h3 className="font-semibold">{record.studyType}</h3>
|
| 262 |
+
<div className="flex items-center gap-4 text-sm text-gray-600">
|
| 263 |
+
<span className="flex items-center gap-1">
|
| 264 |
+
<Calendar className="w-3 h-3" />
|
| 265 |
+
{record.date} at {record.time}
|
| 266 |
+
</span>
|
| 267 |
+
<span className="flex items-center gap-1">
|
| 268 |
+
<User className="w-3 h-3" />
|
| 269 |
+
{record.radiologist}
|
| 270 |
+
</span>
|
| 271 |
+
</div>
|
| 272 |
+
</div>
|
| 273 |
+
</div>
|
| 274 |
+
<Badge className={getStatusColor(record.status)}>{record.status}</Badge>
|
| 275 |
+
</div>
|
| 276 |
+
</CardHeader>
|
| 277 |
+
<CardContent className="space-y-4">
|
| 278 |
+
<div>
|
| 279 |
+
<h4 className="font-medium text-gray-900 mb-2">Clinical Indication:</h4>
|
| 280 |
+
<p className="text-gray-700 text-sm bg-gray-50 p-3 rounded-md">{record.indication}</p>
|
| 281 |
+
</div>
|
| 282 |
+
|
| 283 |
+
<div>
|
| 284 |
+
<h4 className="font-medium text-gray-900 mb-2">Technique:</h4>
|
| 285 |
+
<p className="text-gray-700 text-sm bg-gray-50 p-3 rounded-md">{record.technique}</p>
|
| 286 |
+
</div>
|
| 287 |
+
|
| 288 |
+
<div>
|
| 289 |
+
<h4 className="font-medium text-gray-900 mb-2">Findings:</h4>
|
| 290 |
+
<p className="text-gray-700 text-sm bg-gray-50 p-3 rounded-md leading-relaxed">{record.findings}</p>
|
| 291 |
+
</div>
|
| 292 |
+
|
| 293 |
+
<div>
|
| 294 |
+
<h4 className="font-medium text-gray-900 mb-2">Impression:</h4>
|
| 295 |
+
<div className="bg-blue-50 border border-blue-200 rounded-md p-3">
|
| 296 |
+
<p className="text-blue-900 text-sm font-medium">{record.impression}</p>
|
| 297 |
+
</div>
|
| 298 |
+
</div>
|
| 299 |
+
|
| 300 |
+
<div className="flex gap-2 pt-2">
|
| 301 |
+
<Button size="sm" variant="outline">
|
| 302 |
+
<Eye className="w-4 h-4 mr-1" />
|
| 303 |
+
View Images
|
| 304 |
+
</Button>
|
| 305 |
+
<Button size="sm" variant="outline">
|
| 306 |
+
<FileText className="w-4 h-4 mr-1" />
|
| 307 |
+
Print Report
|
| 308 |
+
</Button>
|
| 309 |
+
</div>
|
| 310 |
+
</CardContent>
|
| 311 |
+
</Card>
|
| 312 |
+
))}
|
| 313 |
+
</div>
|
| 314 |
+
|
| 315 |
+
{/* Empty State */}
|
| 316 |
+
{radiologyRecords.length === 0 && !showAddRecord && (
|
| 317 |
+
<Card className="text-center py-12">
|
| 318 |
+
<CardContent>
|
| 319 |
+
<Zap className="w-12 h-12 text-gray-400 mx-auto mb-4" />
|
| 320 |
+
<h3 className="text-lg font-medium text-gray-900 mb-2">No Radiology Reports</h3>
|
| 321 |
+
<p className="text-gray-600 mb-4">No imaging studies have been recorded for this patient.</p>
|
| 322 |
+
<Button onClick={() => setShowAddRecord(true)}>
|
| 323 |
+
<Plus className="w-4 h-4 mr-2" />
|
| 324 |
+
Add First Report
|
| 325 |
+
</Button>
|
| 326 |
+
</CardContent>
|
| 327 |
+
</Card>
|
| 328 |
+
)}
|
| 329 |
+
</div>
|
| 330 |
+
)
|
| 331 |
+
}
|
ipdmodule/components/rich-text-editor.tsx
ADDED
|
@@ -0,0 +1,334 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"use client"
|
| 2 |
+
|
| 3 |
+
import { useState, useRef, useEffect } from "react"
|
| 4 |
+
import { Button } from "@/components/ui/button"
|
| 5 |
+
import { Textarea } from "@/components/ui/textarea"
|
| 6 |
+
import { Badge } from "@/components/ui/badge"
|
| 7 |
+
import { Bold, List, Mic, Save, Sparkles, Volume2, VolumeX, Copy } from "lucide-react"
|
| 8 |
+
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select"
|
| 9 |
+
|
| 10 |
+
interface RichTextEditorProps {
|
| 11 |
+
value: string
|
| 12 |
+
onChange: (value: string) => void
|
| 13 |
+
placeholder: string
|
| 14 |
+
disabled?: boolean
|
| 15 |
+
rows?: number
|
| 16 |
+
fieldType: string
|
| 17 |
+
label?: string
|
| 18 |
+
showAutofill?: boolean
|
| 19 |
+
autofillSource?: string
|
| 20 |
+
autofillTimestamp?: string
|
| 21 |
+
className?: string
|
| 22 |
+
}
|
| 23 |
+
|
| 24 |
+
export function RichTextEditor({
|
| 25 |
+
value,
|
| 26 |
+
onChange,
|
| 27 |
+
placeholder,
|
| 28 |
+
disabled = false,
|
| 29 |
+
rows = 4,
|
| 30 |
+
fieldType,
|
| 31 |
+
label = "",
|
| 32 |
+
showAutofill = false,
|
| 33 |
+
autofillSource = "",
|
| 34 |
+
autofillTimestamp = "",
|
| 35 |
+
className = "",
|
| 36 |
+
}: RichTextEditorProps) {
|
| 37 |
+
const [isListening, setIsListening] = useState(false)
|
| 38 |
+
const [speechSupported, setSpeechSupported] = useState(false)
|
| 39 |
+
const [selectedTemplate, setSelectedTemplate] = useState("")
|
| 40 |
+
const textareaRef = useRef<HTMLTextAreaElement>(null)
|
| 41 |
+
const recognitionRef = useRef<any>(null)
|
| 42 |
+
|
| 43 |
+
useEffect(() => {
|
| 44 |
+
// Check if speech recognition is supported
|
| 45 |
+
if (typeof window !== "undefined") {
|
| 46 |
+
const SpeechRecognition = (window as any).SpeechRecognition || (window as any).webkitSpeechRecognition
|
| 47 |
+
setSpeechSupported(!!SpeechRecognition)
|
| 48 |
+
|
| 49 |
+
if (SpeechRecognition) {
|
| 50 |
+
recognitionRef.current = new SpeechRecognition()
|
| 51 |
+
recognitionRef.current.continuous = true
|
| 52 |
+
recognitionRef.current.interimResults = true
|
| 53 |
+
recognitionRef.current.lang = "en-US"
|
| 54 |
+
|
| 55 |
+
recognitionRef.current.onresult = (event: any) => {
|
| 56 |
+
let finalTranscript = ""
|
| 57 |
+
for (let i = event.resultIndex; i < event.results.length; i++) {
|
| 58 |
+
const transcript = event.results[i][0].transcript
|
| 59 |
+
if (event.results[i].isFinal) {
|
| 60 |
+
finalTranscript += transcript
|
| 61 |
+
}
|
| 62 |
+
}
|
| 63 |
+
|
| 64 |
+
if (finalTranscript) {
|
| 65 |
+
const newValue = value + (value ? " " : "") + finalTranscript
|
| 66 |
+
onChange(newValue)
|
| 67 |
+
}
|
| 68 |
+
}
|
| 69 |
+
|
| 70 |
+
recognitionRef.current.onerror = () => setIsListening(false)
|
| 71 |
+
recognitionRef.current.onend = () => setIsListening(false)
|
| 72 |
+
}
|
| 73 |
+
}
|
| 74 |
+
}, [value, onChange])
|
| 75 |
+
|
| 76 |
+
const handleFormat = (format: string) => {
|
| 77 |
+
const textarea = textareaRef.current
|
| 78 |
+
if (!textarea) return
|
| 79 |
+
|
| 80 |
+
const start = textarea.selectionStart
|
| 81 |
+
const end = textarea.selectionEnd
|
| 82 |
+
const selectedText = value.substring(start, end)
|
| 83 |
+
|
| 84 |
+
if (!selectedText) {
|
| 85 |
+
let markers = ""
|
| 86 |
+
switch (format) {
|
| 87 |
+
case "bold":
|
| 88 |
+
markers = "****"
|
| 89 |
+
break
|
| 90 |
+
case "list":
|
| 91 |
+
markers = "• "
|
| 92 |
+
break
|
| 93 |
+
}
|
| 94 |
+
const newValue = value.substring(0, start) + markers + value.substring(end)
|
| 95 |
+
onChange(newValue)
|
| 96 |
+
setTimeout(() => {
|
| 97 |
+
textarea.focus()
|
| 98 |
+
const cursorPos = format === "list" ? start + markers.length : start + markers.length / 2
|
| 99 |
+
textarea.setSelectionRange(cursorPos, cursorPos)
|
| 100 |
+
}, 0)
|
| 101 |
+
return
|
| 102 |
+
}
|
| 103 |
+
|
| 104 |
+
let formattedText = selectedText
|
| 105 |
+
switch (format) {
|
| 106 |
+
case "bold":
|
| 107 |
+
formattedText = `**${selectedText}**`
|
| 108 |
+
break
|
| 109 |
+
case "list":
|
| 110 |
+
formattedText = `• ${selectedText}`
|
| 111 |
+
break
|
| 112 |
+
}
|
| 113 |
+
|
| 114 |
+
const newValue = value.substring(0, start) + formattedText + value.substring(end)
|
| 115 |
+
onChange(newValue)
|
| 116 |
+
|
| 117 |
+
setTimeout(() => {
|
| 118 |
+
textarea.focus()
|
| 119 |
+
textarea.setSelectionRange(start, start + formattedText.length)
|
| 120 |
+
}, 0)
|
| 121 |
+
}
|
| 122 |
+
|
| 123 |
+
const getTemplatesByFieldType = (fieldType: string) => {
|
| 124 |
+
const templates = {
|
| 125 |
+
"chief-complaints": [
|
| 126 |
+
"Patient presents with chest pain radiating to left arm, onset 2 hours ago, associated with shortness of breath and diaphoresis.",
|
| 127 |
+
"Abdominal pain in right lower quadrant, sharp in nature, started 6 hours ago, associated with nausea and vomiting.",
|
| 128 |
+
"Shortness of breath on exertion for past 3 days, associated with bilateral lower extremity swelling.",
|
| 129 |
+
"Fever with chills for 2 days, temperature up to 102°F, associated with body aches and headache.",
|
| 130 |
+
],
|
| 131 |
+
assessment: [
|
| 132 |
+
"Patient is hemodynamically stable with improving clinical condition. Vital signs within normal limits.",
|
| 133 |
+
"Clinical improvement noted with current treatment regimen. Patient tolerating oral intake well.",
|
| 134 |
+
"Stable patient with good response to therapy. No acute distress observed.",
|
| 135 |
+
"Patient showing signs of clinical deterioration. Requires close monitoring and possible intervention.",
|
| 136 |
+
],
|
| 137 |
+
plan: [
|
| 138 |
+
"Continue current medical management with close monitoring of clinical response.",
|
| 139 |
+
"Initiate new treatment protocol with frequent reassessment and adjustment as needed.",
|
| 140 |
+
"Prepare for discharge with appropriate follow-up arrangements and patient education.",
|
| 141 |
+
"Consider escalation of care if no improvement noted within specified timeframe.",
|
| 142 |
+
],
|
| 143 |
+
"ot-procedure": [
|
| 144 |
+
"Standard laparoscopic technique employed with CO2 insufflation. Four-port access obtained safely.",
|
| 145 |
+
"Midline incision made and extended through all layers. Adequate exposure achieved.",
|
| 146 |
+
"Careful dissection performed with identification and preservation of vital structures.",
|
| 147 |
+
"Hemostasis achieved with electrocautery. Irrigation and inspection of surgical site completed.",
|
| 148 |
+
],
|
| 149 |
+
general: [
|
| 150 |
+
"Patient tolerated procedure well without complications.",
|
| 151 |
+
"No acute distress noted at this time.",
|
| 152 |
+
"Stable clinical condition with appropriate response to treatment.",
|
| 153 |
+
"Requires continued monitoring and supportive care.",
|
| 154 |
+
],
|
| 155 |
+
}
|
| 156 |
+
|
| 157 |
+
return templates[fieldType as keyof typeof templates] || templates.general
|
| 158 |
+
}
|
| 159 |
+
|
| 160 |
+
const loadTemplate = (templateText: string) => {
|
| 161 |
+
onChange(templateText)
|
| 162 |
+
setSelectedTemplate("")
|
| 163 |
+
}
|
| 164 |
+
|
| 165 |
+
const startVoiceInput = () => {
|
| 166 |
+
if (!speechSupported || !recognitionRef.current) {
|
| 167 |
+
alert("Speech recognition is not supported in your browser. Please use Chrome or Edge for voice input.")
|
| 168 |
+
return
|
| 169 |
+
}
|
| 170 |
+
|
| 171 |
+
if (isListening) {
|
| 172 |
+
recognitionRef.current.stop()
|
| 173 |
+
setIsListening(false)
|
| 174 |
+
} else {
|
| 175 |
+
try {
|
| 176 |
+
recognitionRef.current.start()
|
| 177 |
+
setIsListening(true)
|
| 178 |
+
} catch (error) {
|
| 179 |
+
console.error("Error starting speech recognition:", error)
|
| 180 |
+
alert("Unable to start voice recognition. Please check your microphone permissions.")
|
| 181 |
+
}
|
| 182 |
+
}
|
| 183 |
+
}
|
| 184 |
+
|
| 185 |
+
const handleSave = () => {
|
| 186 |
+
console.log("Saving content:", value)
|
| 187 |
+
alert("Content saved successfully!")
|
| 188 |
+
}
|
| 189 |
+
|
| 190 |
+
const handleMagicEnhance = () => {
|
| 191 |
+
alert("Magic AI enhancement feature would be implemented here to improve and expand the content using AI.")
|
| 192 |
+
}
|
| 193 |
+
|
| 194 |
+
const handleAutofillClick = () => {
|
| 195 |
+
if (showAutofill && autofillSource) {
|
| 196 |
+
alert(`Loading data from ${autofillSource} (${autofillTimestamp})`)
|
| 197 |
+
}
|
| 198 |
+
}
|
| 199 |
+
|
| 200 |
+
const templates = getTemplatesByFieldType(fieldType)
|
| 201 |
+
|
| 202 |
+
return (
|
| 203 |
+
<div className={`space-y-2 ${className}`}>
|
| 204 |
+
{/* Header with Templates and Save buttons */}
|
| 205 |
+
<div className="flex justify-between items-center gap-2 mb-2">
|
| 206 |
+
<h3 className="text-lg font-bold text-gray-800">
|
| 207 |
+
{label || fieldType.replace("-", " ").replace(/\b\w/g, (l) => l.toUpperCase())}
|
| 208 |
+
</h3>
|
| 209 |
+
<div className="flex gap-2">
|
| 210 |
+
<Select value={selectedTemplate} onValueChange={loadTemplate}>
|
| 211 |
+
<SelectTrigger className="w-32 h-8 text-sm bg-white">
|
| 212 |
+
<SelectValue placeholder="Templates" />
|
| 213 |
+
</SelectTrigger>
|
| 214 |
+
<SelectContent>
|
| 215 |
+
{templates.map((template, index) => (
|
| 216 |
+
<SelectItem key={index} value={template} className="text-sm">
|
| 217 |
+
Template {index + 1}
|
| 218 |
+
</SelectItem>
|
| 219 |
+
))}
|
| 220 |
+
</SelectContent>
|
| 221 |
+
</Select>
|
| 222 |
+
<Button
|
| 223 |
+
size="sm"
|
| 224 |
+
variant="outline"
|
| 225 |
+
onClick={handleSave}
|
| 226 |
+
disabled={disabled}
|
| 227 |
+
className="h-8 px-3 bg-white border-gray-300"
|
| 228 |
+
>
|
| 229 |
+
<Save className="w-3 h-3 mr-1" />
|
| 230 |
+
Save
|
| 231 |
+
</Button>
|
| 232 |
+
</div>
|
| 233 |
+
</div>
|
| 234 |
+
|
| 235 |
+
{/* Main textarea container */}
|
| 236 |
+
<div className="relative border rounded-lg bg-white border-gray-300">
|
| 237 |
+
<Textarea
|
| 238 |
+
ref={textareaRef}
|
| 239 |
+
placeholder={placeholder}
|
| 240 |
+
value={value}
|
| 241 |
+
onChange={(e) => onChange(e.target.value)}
|
| 242 |
+
disabled={disabled}
|
| 243 |
+
rows={rows}
|
| 244 |
+
className="min-h-[120px] resize-y border-0 focus:ring-0 focus:border-0 rounded-lg pr-4 pb-12"
|
| 245 |
+
/>
|
| 246 |
+
|
| 247 |
+
{/* Bottom toolbar */}
|
| 248 |
+
<div className="flex items-center justify-between p-2 border-t bg-gray-50 rounded-b-lg">
|
| 249 |
+
{/* Left side - Formatting toolbar */}
|
| 250 |
+
<div className="flex items-center gap-1">
|
| 251 |
+
<Button
|
| 252 |
+
size="sm"
|
| 253 |
+
variant="ghost"
|
| 254 |
+
onClick={() => handleFormat("bold")}
|
| 255 |
+
type="button"
|
| 256 |
+
className="h-7 w-7 p-0 hover:bg-gray-200"
|
| 257 |
+
disabled={disabled}
|
| 258 |
+
title="Bold"
|
| 259 |
+
>
|
| 260 |
+
<Bold className="w-4 h-4" />
|
| 261 |
+
</Button>
|
| 262 |
+
<Button
|
| 263 |
+
size="sm"
|
| 264 |
+
variant="ghost"
|
| 265 |
+
onClick={() => handleFormat("list")}
|
| 266 |
+
type="button"
|
| 267 |
+
className="h-7 w-7 p-0 hover:bg-gray-200"
|
| 268 |
+
disabled={disabled}
|
| 269 |
+
title="Bullet List"
|
| 270 |
+
>
|
| 271 |
+
<List className="w-4 h-4" />
|
| 272 |
+
</Button>
|
| 273 |
+
<div className="w-px h-4 bg-gray-300 mx-1" />
|
| 274 |
+
<Button
|
| 275 |
+
size="sm"
|
| 276 |
+
variant="ghost"
|
| 277 |
+
onClick={startVoiceInput}
|
| 278 |
+
type="button"
|
| 279 |
+
className={`h-7 w-7 p-0 hover:bg-gray-200 ${isListening ? "text-red-600" : ""}`}
|
| 280 |
+
disabled={!speechSupported || disabled}
|
| 281 |
+
title={speechSupported ? "Voice Input" : "Voice input not supported"}
|
| 282 |
+
>
|
| 283 |
+
{isListening ? <Volume2 className="w-4 h-4" /> : <Mic className="w-4 h-4" />}
|
| 284 |
+
</Button>
|
| 285 |
+
<Button
|
| 286 |
+
size="sm"
|
| 287 |
+
variant="ghost"
|
| 288 |
+
onClick={handleMagicEnhance}
|
| 289 |
+
type="button"
|
| 290 |
+
className="h-7 w-7 p-0 hover:bg-gray-200 text-purple-600"
|
| 291 |
+
disabled={disabled}
|
| 292 |
+
title="AI Magic Enhancement"
|
| 293 |
+
>
|
| 294 |
+
<Sparkles className="w-4 h-4" />
|
| 295 |
+
</Button>
|
| 296 |
+
</div>
|
| 297 |
+
|
| 298 |
+
{/* Right side - Autofill button */}
|
| 299 |
+
{showAutofill && autofillSource && autofillTimestamp && (
|
| 300 |
+
<Button
|
| 301 |
+
size="sm"
|
| 302 |
+
variant="ghost"
|
| 303 |
+
onClick={handleAutofillClick}
|
| 304 |
+
type="button"
|
| 305 |
+
className="h-auto px-2 py-1 text-xs text-purple-700 hover:text-purple-900 hover:bg-purple-100 border border-purple-300 rounded-md bg-purple-50"
|
| 306 |
+
disabled={disabled}
|
| 307 |
+
title={`Autofill From ${autofillSource} (${autofillTimestamp})`}
|
| 308 |
+
>
|
| 309 |
+
<Copy className="w-3 h-3 mr-1" />
|
| 310 |
+
Autofill From {autofillSource} ({autofillTimestamp})
|
| 311 |
+
</Button>
|
| 312 |
+
)}
|
| 313 |
+
</div>
|
| 314 |
+
|
| 315 |
+
{/* Listening indicator */}
|
| 316 |
+
{isListening && (
|
| 317 |
+
<div className="absolute top-2 right-2">
|
| 318 |
+
<Badge variant="secondary" className="bg-red-100 text-red-800 animate-pulse text-xs">
|
| 319 |
+
<Volume2 className="w-3 h-3 mr-1" />
|
| 320 |
+
Listening...
|
| 321 |
+
</Badge>
|
| 322 |
+
</div>
|
| 323 |
+
)}
|
| 324 |
+
</div>
|
| 325 |
+
|
| 326 |
+
{!speechSupported && (
|
| 327 |
+
<div className="text-xs text-gray-500 mt-1">
|
| 328 |
+
<VolumeX className="w-3 h-3 inline mr-1" />
|
| 329 |
+
Voice input requires Chrome or Edge browser
|
| 330 |
+
</div>
|
| 331 |
+
)}
|
| 332 |
+
</div>
|
| 333 |
+
)
|
| 334 |
+
}
|
ipdmodule/components/sidebar.tsx
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"use client"
|
| 2 |
+
|
| 3 |
+
import { useState } from "react"
|
| 4 |
+
import { Button } from "@/components/ui/button"
|
| 5 |
+
import { ScrollArea } from "@/components/ui/scroll-area"
|
| 6 |
+
import { Hospital, FileText, Menu, X, Stethoscope, Bed } from "lucide-react"
|
| 7 |
+
|
| 8 |
+
interface SidebarProps {
|
| 9 |
+
activeModule: string
|
| 10 |
+
onModuleSelect: (module: string) => void
|
| 11 |
+
}
|
| 12 |
+
|
| 13 |
+
export function Sidebar({ activeModule, onModuleSelect }: SidebarProps) {
|
| 14 |
+
const [isCollapsed, setIsCollapsed] = useState(false)
|
| 15 |
+
|
| 16 |
+
const modules = [
|
| 17 |
+
{ id: "ipd", label: "IPD", icon: Bed },
|
| 18 |
+
{ id: "opd", label: "OPD", icon: Stethoscope },
|
| 19 |
+
{ id: "emergency", label: "Emergency", icon: Hospital },
|
| 20 |
+
{ id: "pharmacy", label: "Pharmacy", icon: FileText },
|
| 21 |
+
{ id: "lab", label: "Laboratory", icon: FileText },
|
| 22 |
+
{ id: "radiology", label: "Radiology", icon: FileText },
|
| 23 |
+
]
|
| 24 |
+
|
| 25 |
+
return (
|
| 26 |
+
<>
|
| 27 |
+
{/* Mobile overlay */}
|
| 28 |
+
{!isCollapsed && (
|
| 29 |
+
<div className="fixed inset-0 bg-black bg-opacity-50 z-40 md:hidden" onClick={() => setIsCollapsed(true)} />
|
| 30 |
+
)}
|
| 31 |
+
|
| 32 |
+
{/* Sidebar */}
|
| 33 |
+
<div
|
| 34 |
+
className={`
|
| 35 |
+
fixed left-0 top-0 h-full bg-white border-r border-gray-200 z-50 transition-all duration-300
|
| 36 |
+
${isCollapsed ? "-translate-x-full md:translate-x-0 md:w-16" : "w-64"}
|
| 37 |
+
`}
|
| 38 |
+
>
|
| 39 |
+
{/* Header */}
|
| 40 |
+
<div className="flex items-center justify-between p-4 border-b border-gray-200">
|
| 41 |
+
{!isCollapsed && (
|
| 42 |
+
<div className="flex items-center space-x-2">
|
| 43 |
+
<Hospital className="h-8 w-8 text-blue-600" />
|
| 44 |
+
<span className="text-xl font-bold text-gray-800">TatvaCare</span>
|
| 45 |
+
</div>
|
| 46 |
+
)}
|
| 47 |
+
<Button variant="ghost" size="sm" onClick={() => setIsCollapsed(!isCollapsed)} className="md:hidden">
|
| 48 |
+
{isCollapsed ? <Menu className="h-4 w-4" /> : <X className="h-4 w-4" />}
|
| 49 |
+
</Button>
|
| 50 |
+
</div>
|
| 51 |
+
|
| 52 |
+
{/* Navigation */}
|
| 53 |
+
<ScrollArea className="flex-1 p-4">
|
| 54 |
+
<div className="space-y-2">
|
| 55 |
+
{modules.map((module) => {
|
| 56 |
+
const Icon = module.icon
|
| 57 |
+
return (
|
| 58 |
+
<Button
|
| 59 |
+
key={module.id}
|
| 60 |
+
variant={activeModule === module.id ? "default" : "ghost"}
|
| 61 |
+
className={`
|
| 62 |
+
w-full justify-start
|
| 63 |
+
${isCollapsed ? "px-2" : "px-4"}
|
| 64 |
+
`}
|
| 65 |
+
onClick={() => {
|
| 66 |
+
onModuleSelect(module.id)
|
| 67 |
+
if (window.innerWidth < 768) setIsCollapsed(true)
|
| 68 |
+
}}
|
| 69 |
+
>
|
| 70 |
+
<Icon className="h-4 w-4" />
|
| 71 |
+
{!isCollapsed && <span className="ml-2">{module.label}</span>}
|
| 72 |
+
</Button>
|
| 73 |
+
)
|
| 74 |
+
})}
|
| 75 |
+
</div>
|
| 76 |
+
</ScrollArea>
|
| 77 |
+
</div>
|
| 78 |
+
|
| 79 |
+
{/* Mobile menu button */}
|
| 80 |
+
<Button
|
| 81 |
+
variant="outline"
|
| 82 |
+
size="sm"
|
| 83 |
+
className="fixed top-4 left-4 z-40 md:hidden bg-transparent"
|
| 84 |
+
onClick={() => setIsCollapsed(false)}
|
| 85 |
+
>
|
| 86 |
+
<Menu className="h-4 w-4" />
|
| 87 |
+
</Button>
|
| 88 |
+
</>
|
| 89 |
+
)
|
| 90 |
+
}
|
ipdmodule/components/theme-provider.tsx
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
'use client'
|
| 2 |
+
|
| 3 |
+
import * as React from 'react'
|
| 4 |
+
import {
|
| 5 |
+
ThemeProvider as NextThemesProvider,
|
| 6 |
+
type ThemeProviderProps,
|
| 7 |
+
} from 'next-themes'
|
| 8 |
+
|
| 9 |
+
export function ThemeProvider({ children, ...props }: ThemeProviderProps) {
|
| 10 |
+
return <NextThemesProvider {...props}>{children}</NextThemesProvider>
|
| 11 |
+
}
|
ipdmodule/components/ui/accordion.tsx
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"use client"
|
| 2 |
+
|
| 3 |
+
import * as React from "react"
|
| 4 |
+
import * as AccordionPrimitive from "@radix-ui/react-accordion"
|
| 5 |
+
import { ChevronDown } from "lucide-react"
|
| 6 |
+
|
| 7 |
+
import { cn } from "@/lib/utils"
|
| 8 |
+
|
| 9 |
+
const Accordion = AccordionPrimitive.Root
|
| 10 |
+
|
| 11 |
+
const AccordionItem = React.forwardRef<
|
| 12 |
+
React.ElementRef<typeof AccordionPrimitive.Item>,
|
| 13 |
+
React.ComponentPropsWithoutRef<typeof AccordionPrimitive.Item>
|
| 14 |
+
>(({ className, ...props }, ref) => (
|
| 15 |
+
<AccordionPrimitive.Item
|
| 16 |
+
ref={ref}
|
| 17 |
+
className={cn("border-b", className)}
|
| 18 |
+
{...props}
|
| 19 |
+
/>
|
| 20 |
+
))
|
| 21 |
+
AccordionItem.displayName = "AccordionItem"
|
| 22 |
+
|
| 23 |
+
const AccordionTrigger = React.forwardRef<
|
| 24 |
+
React.ElementRef<typeof AccordionPrimitive.Trigger>,
|
| 25 |
+
React.ComponentPropsWithoutRef<typeof AccordionPrimitive.Trigger>
|
| 26 |
+
>(({ className, children, ...props }, ref) => (
|
| 27 |
+
<AccordionPrimitive.Header className="flex">
|
| 28 |
+
<AccordionPrimitive.Trigger
|
| 29 |
+
ref={ref}
|
| 30 |
+
className={cn(
|
| 31 |
+
"flex flex-1 items-center justify-between py-4 font-medium transition-all hover:underline [&[data-state=open]>svg]:rotate-180",
|
| 32 |
+
className
|
| 33 |
+
)}
|
| 34 |
+
{...props}
|
| 35 |
+
>
|
| 36 |
+
{children}
|
| 37 |
+
<ChevronDown className="h-4 w-4 shrink-0 transition-transform duration-200" />
|
| 38 |
+
</AccordionPrimitive.Trigger>
|
| 39 |
+
</AccordionPrimitive.Header>
|
| 40 |
+
))
|
| 41 |
+
AccordionTrigger.displayName = AccordionPrimitive.Trigger.displayName
|
| 42 |
+
|
| 43 |
+
const AccordionContent = React.forwardRef<
|
| 44 |
+
React.ElementRef<typeof AccordionPrimitive.Content>,
|
| 45 |
+
React.ComponentPropsWithoutRef<typeof AccordionPrimitive.Content>
|
| 46 |
+
>(({ className, children, ...props }, ref) => (
|
| 47 |
+
<AccordionPrimitive.Content
|
| 48 |
+
ref={ref}
|
| 49 |
+
className="overflow-hidden text-sm transition-all data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down"
|
| 50 |
+
{...props}
|
| 51 |
+
>
|
| 52 |
+
<div className={cn("pb-4 pt-0", className)}>{children}</div>
|
| 53 |
+
</AccordionPrimitive.Content>
|
| 54 |
+
))
|
| 55 |
+
|
| 56 |
+
AccordionContent.displayName = AccordionPrimitive.Content.displayName
|
| 57 |
+
|
| 58 |
+
export { Accordion, AccordionItem, AccordionTrigger, AccordionContent }
|
ipdmodule/components/ui/alert-dialog.tsx
ADDED
|
@@ -0,0 +1,141 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"use client"
|
| 2 |
+
|
| 3 |
+
import * as React from "react"
|
| 4 |
+
import * as AlertDialogPrimitive from "@radix-ui/react-alert-dialog"
|
| 5 |
+
|
| 6 |
+
import { cn } from "@/lib/utils"
|
| 7 |
+
import { buttonVariants } from "@/components/ui/button"
|
| 8 |
+
|
| 9 |
+
const AlertDialog = AlertDialogPrimitive.Root
|
| 10 |
+
|
| 11 |
+
const AlertDialogTrigger = AlertDialogPrimitive.Trigger
|
| 12 |
+
|
| 13 |
+
const AlertDialogPortal = AlertDialogPrimitive.Portal
|
| 14 |
+
|
| 15 |
+
const AlertDialogOverlay = React.forwardRef<
|
| 16 |
+
React.ElementRef<typeof AlertDialogPrimitive.Overlay>,
|
| 17 |
+
React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Overlay>
|
| 18 |
+
>(({ className, ...props }, ref) => (
|
| 19 |
+
<AlertDialogPrimitive.Overlay
|
| 20 |
+
className={cn(
|
| 21 |
+
"fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
|
| 22 |
+
className
|
| 23 |
+
)}
|
| 24 |
+
{...props}
|
| 25 |
+
ref={ref}
|
| 26 |
+
/>
|
| 27 |
+
))
|
| 28 |
+
AlertDialogOverlay.displayName = AlertDialogPrimitive.Overlay.displayName
|
| 29 |
+
|
| 30 |
+
const AlertDialogContent = React.forwardRef<
|
| 31 |
+
React.ElementRef<typeof AlertDialogPrimitive.Content>,
|
| 32 |
+
React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Content>
|
| 33 |
+
>(({ className, ...props }, ref) => (
|
| 34 |
+
<AlertDialogPortal>
|
| 35 |
+
<AlertDialogOverlay />
|
| 36 |
+
<AlertDialogPrimitive.Content
|
| 37 |
+
ref={ref}
|
| 38 |
+
className={cn(
|
| 39 |
+
"fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",
|
| 40 |
+
className
|
| 41 |
+
)}
|
| 42 |
+
{...props}
|
| 43 |
+
/>
|
| 44 |
+
</AlertDialogPortal>
|
| 45 |
+
))
|
| 46 |
+
AlertDialogContent.displayName = AlertDialogPrimitive.Content.displayName
|
| 47 |
+
|
| 48 |
+
const AlertDialogHeader = ({
|
| 49 |
+
className,
|
| 50 |
+
...props
|
| 51 |
+
}: React.HTMLAttributes<HTMLDivElement>) => (
|
| 52 |
+
<div
|
| 53 |
+
className={cn(
|
| 54 |
+
"flex flex-col space-y-2 text-center sm:text-left",
|
| 55 |
+
className
|
| 56 |
+
)}
|
| 57 |
+
{...props}
|
| 58 |
+
/>
|
| 59 |
+
)
|
| 60 |
+
AlertDialogHeader.displayName = "AlertDialogHeader"
|
| 61 |
+
|
| 62 |
+
const AlertDialogFooter = ({
|
| 63 |
+
className,
|
| 64 |
+
...props
|
| 65 |
+
}: React.HTMLAttributes<HTMLDivElement>) => (
|
| 66 |
+
<div
|
| 67 |
+
className={cn(
|
| 68 |
+
"flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",
|
| 69 |
+
className
|
| 70 |
+
)}
|
| 71 |
+
{...props}
|
| 72 |
+
/>
|
| 73 |
+
)
|
| 74 |
+
AlertDialogFooter.displayName = "AlertDialogFooter"
|
| 75 |
+
|
| 76 |
+
const AlertDialogTitle = React.forwardRef<
|
| 77 |
+
React.ElementRef<typeof AlertDialogPrimitive.Title>,
|
| 78 |
+
React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Title>
|
| 79 |
+
>(({ className, ...props }, ref) => (
|
| 80 |
+
<AlertDialogPrimitive.Title
|
| 81 |
+
ref={ref}
|
| 82 |
+
className={cn("text-lg font-semibold", className)}
|
| 83 |
+
{...props}
|
| 84 |
+
/>
|
| 85 |
+
))
|
| 86 |
+
AlertDialogTitle.displayName = AlertDialogPrimitive.Title.displayName
|
| 87 |
+
|
| 88 |
+
const AlertDialogDescription = React.forwardRef<
|
| 89 |
+
React.ElementRef<typeof AlertDialogPrimitive.Description>,
|
| 90 |
+
React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Description>
|
| 91 |
+
>(({ className, ...props }, ref) => (
|
| 92 |
+
<AlertDialogPrimitive.Description
|
| 93 |
+
ref={ref}
|
| 94 |
+
className={cn("text-sm text-muted-foreground", className)}
|
| 95 |
+
{...props}
|
| 96 |
+
/>
|
| 97 |
+
))
|
| 98 |
+
AlertDialogDescription.displayName =
|
| 99 |
+
AlertDialogPrimitive.Description.displayName
|
| 100 |
+
|
| 101 |
+
const AlertDialogAction = React.forwardRef<
|
| 102 |
+
React.ElementRef<typeof AlertDialogPrimitive.Action>,
|
| 103 |
+
React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Action>
|
| 104 |
+
>(({ className, ...props }, ref) => (
|
| 105 |
+
<AlertDialogPrimitive.Action
|
| 106 |
+
ref={ref}
|
| 107 |
+
className={cn(buttonVariants(), className)}
|
| 108 |
+
{...props}
|
| 109 |
+
/>
|
| 110 |
+
))
|
| 111 |
+
AlertDialogAction.displayName = AlertDialogPrimitive.Action.displayName
|
| 112 |
+
|
| 113 |
+
const AlertDialogCancel = React.forwardRef<
|
| 114 |
+
React.ElementRef<typeof AlertDialogPrimitive.Cancel>,
|
| 115 |
+
React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Cancel>
|
| 116 |
+
>(({ className, ...props }, ref) => (
|
| 117 |
+
<AlertDialogPrimitive.Cancel
|
| 118 |
+
ref={ref}
|
| 119 |
+
className={cn(
|
| 120 |
+
buttonVariants({ variant: "outline" }),
|
| 121 |
+
"mt-2 sm:mt-0",
|
| 122 |
+
className
|
| 123 |
+
)}
|
| 124 |
+
{...props}
|
| 125 |
+
/>
|
| 126 |
+
))
|
| 127 |
+
AlertDialogCancel.displayName = AlertDialogPrimitive.Cancel.displayName
|
| 128 |
+
|
| 129 |
+
export {
|
| 130 |
+
AlertDialog,
|
| 131 |
+
AlertDialogPortal,
|
| 132 |
+
AlertDialogOverlay,
|
| 133 |
+
AlertDialogTrigger,
|
| 134 |
+
AlertDialogContent,
|
| 135 |
+
AlertDialogHeader,
|
| 136 |
+
AlertDialogFooter,
|
| 137 |
+
AlertDialogTitle,
|
| 138 |
+
AlertDialogDescription,
|
| 139 |
+
AlertDialogAction,
|
| 140 |
+
AlertDialogCancel,
|
| 141 |
+
}
|
ipdmodule/components/ui/alert.tsx
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import * as React from "react"
|
| 2 |
+
import { cva, type VariantProps } from "class-variance-authority"
|
| 3 |
+
|
| 4 |
+
import { cn } from "@/lib/utils"
|
| 5 |
+
|
| 6 |
+
const alertVariants = cva(
|
| 7 |
+
"relative w-full rounded-lg border p-4 [&>svg~*]:pl-7 [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground",
|
| 8 |
+
{
|
| 9 |
+
variants: {
|
| 10 |
+
variant: {
|
| 11 |
+
default: "bg-background text-foreground",
|
| 12 |
+
destructive:
|
| 13 |
+
"border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive",
|
| 14 |
+
},
|
| 15 |
+
},
|
| 16 |
+
defaultVariants: {
|
| 17 |
+
variant: "default",
|
| 18 |
+
},
|
| 19 |
+
}
|
| 20 |
+
)
|
| 21 |
+
|
| 22 |
+
const Alert = React.forwardRef<
|
| 23 |
+
HTMLDivElement,
|
| 24 |
+
React.HTMLAttributes<HTMLDivElement> & VariantProps<typeof alertVariants>
|
| 25 |
+
>(({ className, variant, ...props }, ref) => (
|
| 26 |
+
<div
|
| 27 |
+
ref={ref}
|
| 28 |
+
role="alert"
|
| 29 |
+
className={cn(alertVariants({ variant }), className)}
|
| 30 |
+
{...props}
|
| 31 |
+
/>
|
| 32 |
+
))
|
| 33 |
+
Alert.displayName = "Alert"
|
| 34 |
+
|
| 35 |
+
const AlertTitle = React.forwardRef<
|
| 36 |
+
HTMLParagraphElement,
|
| 37 |
+
React.HTMLAttributes<HTMLHeadingElement>
|
| 38 |
+
>(({ className, ...props }, ref) => (
|
| 39 |
+
<h5
|
| 40 |
+
ref={ref}
|
| 41 |
+
className={cn("mb-1 font-medium leading-none tracking-tight", className)}
|
| 42 |
+
{...props}
|
| 43 |
+
/>
|
| 44 |
+
))
|
| 45 |
+
AlertTitle.displayName = "AlertTitle"
|
| 46 |
+
|
| 47 |
+
const AlertDescription = React.forwardRef<
|
| 48 |
+
HTMLParagraphElement,
|
| 49 |
+
React.HTMLAttributes<HTMLParagraphElement>
|
| 50 |
+
>(({ className, ...props }, ref) => (
|
| 51 |
+
<div
|
| 52 |
+
ref={ref}
|
| 53 |
+
className={cn("text-sm [&_p]:leading-relaxed", className)}
|
| 54 |
+
{...props}
|
| 55 |
+
/>
|
| 56 |
+
))
|
| 57 |
+
AlertDescription.displayName = "AlertDescription"
|
| 58 |
+
|
| 59 |
+
export { Alert, AlertTitle, AlertDescription }
|
ipdmodule/components/ui/aspect-ratio.tsx
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"use client"
|
| 2 |
+
|
| 3 |
+
import * as AspectRatioPrimitive from "@radix-ui/react-aspect-ratio"
|
| 4 |
+
|
| 5 |
+
const AspectRatio = AspectRatioPrimitive.Root
|
| 6 |
+
|
| 7 |
+
export { AspectRatio }
|
ipdmodule/components/ui/avatar.tsx
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"use client"
|
| 2 |
+
|
| 3 |
+
import * as React from "react"
|
| 4 |
+
import * as AvatarPrimitive from "@radix-ui/react-avatar"
|
| 5 |
+
|
| 6 |
+
import { cn } from "@/lib/utils"
|
| 7 |
+
|
| 8 |
+
const Avatar = React.forwardRef<
|
| 9 |
+
React.ElementRef<typeof AvatarPrimitive.Root>,
|
| 10 |
+
React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Root>
|
| 11 |
+
>(({ className, ...props }, ref) => (
|
| 12 |
+
<AvatarPrimitive.Root
|
| 13 |
+
ref={ref}
|
| 14 |
+
className={cn(
|
| 15 |
+
"relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",
|
| 16 |
+
className
|
| 17 |
+
)}
|
| 18 |
+
{...props}
|
| 19 |
+
/>
|
| 20 |
+
))
|
| 21 |
+
Avatar.displayName = AvatarPrimitive.Root.displayName
|
| 22 |
+
|
| 23 |
+
const AvatarImage = React.forwardRef<
|
| 24 |
+
React.ElementRef<typeof AvatarPrimitive.Image>,
|
| 25 |
+
React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Image>
|
| 26 |
+
>(({ className, ...props }, ref) => (
|
| 27 |
+
<AvatarPrimitive.Image
|
| 28 |
+
ref={ref}
|
| 29 |
+
className={cn("aspect-square h-full w-full", className)}
|
| 30 |
+
{...props}
|
| 31 |
+
/>
|
| 32 |
+
))
|
| 33 |
+
AvatarImage.displayName = AvatarPrimitive.Image.displayName
|
| 34 |
+
|
| 35 |
+
const AvatarFallback = React.forwardRef<
|
| 36 |
+
React.ElementRef<typeof AvatarPrimitive.Fallback>,
|
| 37 |
+
React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Fallback>
|
| 38 |
+
>(({ className, ...props }, ref) => (
|
| 39 |
+
<AvatarPrimitive.Fallback
|
| 40 |
+
ref={ref}
|
| 41 |
+
className={cn(
|
| 42 |
+
"flex h-full w-full items-center justify-center rounded-full bg-muted",
|
| 43 |
+
className
|
| 44 |
+
)}
|
| 45 |
+
{...props}
|
| 46 |
+
/>
|
| 47 |
+
))
|
| 48 |
+
AvatarFallback.displayName = AvatarPrimitive.Fallback.displayName
|
| 49 |
+
|
| 50 |
+
export { Avatar, AvatarImage, AvatarFallback }
|
ipdmodule/components/ui/badge.tsx
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import * as React from "react"
|
| 2 |
+
import { cva, type VariantProps } from "class-variance-authority"
|
| 3 |
+
|
| 4 |
+
import { cn } from "@/lib/utils"
|
| 5 |
+
|
| 6 |
+
const badgeVariants = cva(
|
| 7 |
+
"inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",
|
| 8 |
+
{
|
| 9 |
+
variants: {
|
| 10 |
+
variant: {
|
| 11 |
+
default:
|
| 12 |
+
"border-transparent bg-primary text-primary-foreground hover:bg-primary/80",
|
| 13 |
+
secondary:
|
| 14 |
+
"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",
|
| 15 |
+
destructive:
|
| 16 |
+
"border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80",
|
| 17 |
+
outline: "text-foreground",
|
| 18 |
+
},
|
| 19 |
+
},
|
| 20 |
+
defaultVariants: {
|
| 21 |
+
variant: "default",
|
| 22 |
+
},
|
| 23 |
+
}
|
| 24 |
+
)
|
| 25 |
+
|
| 26 |
+
export interface BadgeProps
|
| 27 |
+
extends React.HTMLAttributes<HTMLDivElement>,
|
| 28 |
+
VariantProps<typeof badgeVariants> {}
|
| 29 |
+
|
| 30 |
+
function Badge({ className, variant, ...props }: BadgeProps) {
|
| 31 |
+
return (
|
| 32 |
+
<div className={cn(badgeVariants({ variant }), className)} {...props} />
|
| 33 |
+
)
|
| 34 |
+
}
|
| 35 |
+
|
| 36 |
+
export { Badge, badgeVariants }
|
ipdmodule/components/ui/breadcrumb.tsx
ADDED
|
@@ -0,0 +1,115 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import * as React from "react"
|
| 2 |
+
import { Slot } from "@radix-ui/react-slot"
|
| 3 |
+
import { ChevronRight, MoreHorizontal } from "lucide-react"
|
| 4 |
+
|
| 5 |
+
import { cn } from "@/lib/utils"
|
| 6 |
+
|
| 7 |
+
const Breadcrumb = React.forwardRef<
|
| 8 |
+
HTMLElement,
|
| 9 |
+
React.ComponentPropsWithoutRef<"nav"> & {
|
| 10 |
+
separator?: React.ReactNode
|
| 11 |
+
}
|
| 12 |
+
>(({ ...props }, ref) => <nav ref={ref} aria-label="breadcrumb" {...props} />)
|
| 13 |
+
Breadcrumb.displayName = "Breadcrumb"
|
| 14 |
+
|
| 15 |
+
const BreadcrumbList = React.forwardRef<
|
| 16 |
+
HTMLOListElement,
|
| 17 |
+
React.ComponentPropsWithoutRef<"ol">
|
| 18 |
+
>(({ className, ...props }, ref) => (
|
| 19 |
+
<ol
|
| 20 |
+
ref={ref}
|
| 21 |
+
className={cn(
|
| 22 |
+
"flex flex-wrap items-center gap-1.5 break-words text-sm text-muted-foreground sm:gap-2.5",
|
| 23 |
+
className
|
| 24 |
+
)}
|
| 25 |
+
{...props}
|
| 26 |
+
/>
|
| 27 |
+
))
|
| 28 |
+
BreadcrumbList.displayName = "BreadcrumbList"
|
| 29 |
+
|
| 30 |
+
const BreadcrumbItem = React.forwardRef<
|
| 31 |
+
HTMLLIElement,
|
| 32 |
+
React.ComponentPropsWithoutRef<"li">
|
| 33 |
+
>(({ className, ...props }, ref) => (
|
| 34 |
+
<li
|
| 35 |
+
ref={ref}
|
| 36 |
+
className={cn("inline-flex items-center gap-1.5", className)}
|
| 37 |
+
{...props}
|
| 38 |
+
/>
|
| 39 |
+
))
|
| 40 |
+
BreadcrumbItem.displayName = "BreadcrumbItem"
|
| 41 |
+
|
| 42 |
+
const BreadcrumbLink = React.forwardRef<
|
| 43 |
+
HTMLAnchorElement,
|
| 44 |
+
React.ComponentPropsWithoutRef<"a"> & {
|
| 45 |
+
asChild?: boolean
|
| 46 |
+
}
|
| 47 |
+
>(({ asChild, className, ...props }, ref) => {
|
| 48 |
+
const Comp = asChild ? Slot : "a"
|
| 49 |
+
|
| 50 |
+
return (
|
| 51 |
+
<Comp
|
| 52 |
+
ref={ref}
|
| 53 |
+
className={cn("transition-colors hover:text-foreground", className)}
|
| 54 |
+
{...props}
|
| 55 |
+
/>
|
| 56 |
+
)
|
| 57 |
+
})
|
| 58 |
+
BreadcrumbLink.displayName = "BreadcrumbLink"
|
| 59 |
+
|
| 60 |
+
const BreadcrumbPage = React.forwardRef<
|
| 61 |
+
HTMLSpanElement,
|
| 62 |
+
React.ComponentPropsWithoutRef<"span">
|
| 63 |
+
>(({ className, ...props }, ref) => (
|
| 64 |
+
<span
|
| 65 |
+
ref={ref}
|
| 66 |
+
role="link"
|
| 67 |
+
aria-disabled="true"
|
| 68 |
+
aria-current="page"
|
| 69 |
+
className={cn("font-normal text-foreground", className)}
|
| 70 |
+
{...props}
|
| 71 |
+
/>
|
| 72 |
+
))
|
| 73 |
+
BreadcrumbPage.displayName = "BreadcrumbPage"
|
| 74 |
+
|
| 75 |
+
const BreadcrumbSeparator = ({
|
| 76 |
+
children,
|
| 77 |
+
className,
|
| 78 |
+
...props
|
| 79 |
+
}: React.ComponentProps<"li">) => (
|
| 80 |
+
<li
|
| 81 |
+
role="presentation"
|
| 82 |
+
aria-hidden="true"
|
| 83 |
+
className={cn("[&>svg]:w-3.5 [&>svg]:h-3.5", className)}
|
| 84 |
+
{...props}
|
| 85 |
+
>
|
| 86 |
+
{children ?? <ChevronRight />}
|
| 87 |
+
</li>
|
| 88 |
+
)
|
| 89 |
+
BreadcrumbSeparator.displayName = "BreadcrumbSeparator"
|
| 90 |
+
|
| 91 |
+
const BreadcrumbEllipsis = ({
|
| 92 |
+
className,
|
| 93 |
+
...props
|
| 94 |
+
}: React.ComponentProps<"span">) => (
|
| 95 |
+
<span
|
| 96 |
+
role="presentation"
|
| 97 |
+
aria-hidden="true"
|
| 98 |
+
className={cn("flex h-9 w-9 items-center justify-center", className)}
|
| 99 |
+
{...props}
|
| 100 |
+
>
|
| 101 |
+
<MoreHorizontal className="h-4 w-4" />
|
| 102 |
+
<span className="sr-only">More</span>
|
| 103 |
+
</span>
|
| 104 |
+
)
|
| 105 |
+
BreadcrumbEllipsis.displayName = "BreadcrumbElipssis"
|
| 106 |
+
|
| 107 |
+
export {
|
| 108 |
+
Breadcrumb,
|
| 109 |
+
BreadcrumbList,
|
| 110 |
+
BreadcrumbItem,
|
| 111 |
+
BreadcrumbLink,
|
| 112 |
+
BreadcrumbPage,
|
| 113 |
+
BreadcrumbSeparator,
|
| 114 |
+
BreadcrumbEllipsis,
|
| 115 |
+
}
|
ipdmodule/components/ui/button.tsx
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import * as React from "react"
|
| 2 |
+
import { Slot } from "@radix-ui/react-slot"
|
| 3 |
+
import { cva, type VariantProps } from "class-variance-authority"
|
| 4 |
+
|
| 5 |
+
import { cn } from "@/lib/utils"
|
| 6 |
+
|
| 7 |
+
const buttonVariants = cva(
|
| 8 |
+
"inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",
|
| 9 |
+
{
|
| 10 |
+
variants: {
|
| 11 |
+
variant: {
|
| 12 |
+
default: "bg-primary text-primary-foreground hover:bg-primary/90",
|
| 13 |
+
destructive:
|
| 14 |
+
"bg-destructive text-destructive-foreground hover:bg-destructive/90",
|
| 15 |
+
outline:
|
| 16 |
+
"border border-input bg-background hover:bg-accent hover:text-accent-foreground",
|
| 17 |
+
secondary:
|
| 18 |
+
"bg-secondary text-secondary-foreground hover:bg-secondary/80",
|
| 19 |
+
ghost: "hover:bg-accent hover:text-accent-foreground",
|
| 20 |
+
link: "text-primary underline-offset-4 hover:underline",
|
| 21 |
+
},
|
| 22 |
+
size: {
|
| 23 |
+
default: "h-10 px-4 py-2",
|
| 24 |
+
sm: "h-9 rounded-md px-3",
|
| 25 |
+
lg: "h-11 rounded-md px-8",
|
| 26 |
+
icon: "h-10 w-10",
|
| 27 |
+
},
|
| 28 |
+
},
|
| 29 |
+
defaultVariants: {
|
| 30 |
+
variant: "default",
|
| 31 |
+
size: "default",
|
| 32 |
+
},
|
| 33 |
+
}
|
| 34 |
+
)
|
| 35 |
+
|
| 36 |
+
export interface ButtonProps
|
| 37 |
+
extends React.ButtonHTMLAttributes<HTMLButtonElement>,
|
| 38 |
+
VariantProps<typeof buttonVariants> {
|
| 39 |
+
asChild?: boolean
|
| 40 |
+
}
|
| 41 |
+
|
| 42 |
+
const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
|
| 43 |
+
({ className, variant, size, asChild = false, ...props }, ref) => {
|
| 44 |
+
const Comp = asChild ? Slot : "button"
|
| 45 |
+
return (
|
| 46 |
+
<Comp
|
| 47 |
+
className={cn(buttonVariants({ variant, size, className }))}
|
| 48 |
+
ref={ref}
|
| 49 |
+
{...props}
|
| 50 |
+
/>
|
| 51 |
+
)
|
| 52 |
+
}
|
| 53 |
+
)
|
| 54 |
+
Button.displayName = "Button"
|
| 55 |
+
|
| 56 |
+
export { Button, buttonVariants }
|
ipdmodule/components/ui/calendar.tsx
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"use client"
|
| 2 |
+
|
| 3 |
+
import * as React from "react"
|
| 4 |
+
import { ChevronLeft, ChevronRight } from "lucide-react"
|
| 5 |
+
import { DayPicker } from "react-day-picker"
|
| 6 |
+
|
| 7 |
+
import { cn } from "@/lib/utils"
|
| 8 |
+
import { buttonVariants } from "@/components/ui/button"
|
| 9 |
+
|
| 10 |
+
export type CalendarProps = React.ComponentProps<typeof DayPicker>
|
| 11 |
+
|
| 12 |
+
function Calendar({
|
| 13 |
+
className,
|
| 14 |
+
classNames,
|
| 15 |
+
showOutsideDays = true,
|
| 16 |
+
...props
|
| 17 |
+
}: CalendarProps) {
|
| 18 |
+
return (
|
| 19 |
+
<DayPicker
|
| 20 |
+
showOutsideDays={showOutsideDays}
|
| 21 |
+
className={cn("p-3", className)}
|
| 22 |
+
classNames={{
|
| 23 |
+
months: "flex flex-col sm:flex-row space-y-4 sm:space-x-4 sm:space-y-0",
|
| 24 |
+
month: "space-y-4",
|
| 25 |
+
caption: "flex justify-center pt-1 relative items-center",
|
| 26 |
+
caption_label: "text-sm font-medium",
|
| 27 |
+
nav: "space-x-1 flex items-center",
|
| 28 |
+
nav_button: cn(
|
| 29 |
+
buttonVariants({ variant: "outline" }),
|
| 30 |
+
"h-7 w-7 bg-transparent p-0 opacity-50 hover:opacity-100"
|
| 31 |
+
),
|
| 32 |
+
nav_button_previous: "absolute left-1",
|
| 33 |
+
nav_button_next: "absolute right-1",
|
| 34 |
+
table: "w-full border-collapse space-y-1",
|
| 35 |
+
head_row: "flex",
|
| 36 |
+
head_cell:
|
| 37 |
+
"text-muted-foreground rounded-md w-9 font-normal text-[0.8rem]",
|
| 38 |
+
row: "flex w-full mt-2",
|
| 39 |
+
cell: "h-9 w-9 text-center text-sm p-0 relative [&:has([aria-selected].day-range-end)]:rounded-r-md [&:has([aria-selected].day-outside)]:bg-accent/50 [&:has([aria-selected])]:bg-accent first:[&:has([aria-selected])]:rounded-l-md last:[&:has([aria-selected])]:rounded-r-md focus-within:relative focus-within:z-20",
|
| 40 |
+
day: cn(
|
| 41 |
+
buttonVariants({ variant: "ghost" }),
|
| 42 |
+
"h-9 w-9 p-0 font-normal aria-selected:opacity-100"
|
| 43 |
+
),
|
| 44 |
+
day_range_end: "day-range-end",
|
| 45 |
+
day_selected:
|
| 46 |
+
"bg-primary text-primary-foreground hover:bg-primary hover:text-primary-foreground focus:bg-primary focus:text-primary-foreground",
|
| 47 |
+
day_today: "bg-accent text-accent-foreground",
|
| 48 |
+
day_outside:
|
| 49 |
+
"day-outside text-muted-foreground aria-selected:bg-accent/50 aria-selected:text-muted-foreground",
|
| 50 |
+
day_disabled: "text-muted-foreground opacity-50",
|
| 51 |
+
day_range_middle:
|
| 52 |
+
"aria-selected:bg-accent aria-selected:text-accent-foreground",
|
| 53 |
+
day_hidden: "invisible",
|
| 54 |
+
...classNames,
|
| 55 |
+
}}
|
| 56 |
+
components={{
|
| 57 |
+
IconLeft: ({ ...props }) => <ChevronLeft className="h-4 w-4" />,
|
| 58 |
+
IconRight: ({ ...props }) => <ChevronRight className="h-4 w-4" />,
|
| 59 |
+
}}
|
| 60 |
+
{...props}
|
| 61 |
+
/>
|
| 62 |
+
)
|
| 63 |
+
}
|
| 64 |
+
Calendar.displayName = "Calendar"
|
| 65 |
+
|
| 66 |
+
export { Calendar }
|
ipdmodule/components/ui/card.tsx
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import * as React from "react"
|
| 2 |
+
|
| 3 |
+
import { cn } from "@/lib/utils"
|
| 4 |
+
|
| 5 |
+
const Card = React.forwardRef<
|
| 6 |
+
HTMLDivElement,
|
| 7 |
+
React.HTMLAttributes<HTMLDivElement>
|
| 8 |
+
>(({ className, ...props }, ref) => (
|
| 9 |
+
<div
|
| 10 |
+
ref={ref}
|
| 11 |
+
className={cn(
|
| 12 |
+
"rounded-lg border bg-card text-card-foreground shadow-sm",
|
| 13 |
+
className
|
| 14 |
+
)}
|
| 15 |
+
{...props}
|
| 16 |
+
/>
|
| 17 |
+
))
|
| 18 |
+
Card.displayName = "Card"
|
| 19 |
+
|
| 20 |
+
const CardHeader = React.forwardRef<
|
| 21 |
+
HTMLDivElement,
|
| 22 |
+
React.HTMLAttributes<HTMLDivElement>
|
| 23 |
+
>(({ className, ...props }, ref) => (
|
| 24 |
+
<div
|
| 25 |
+
ref={ref}
|
| 26 |
+
className={cn("flex flex-col space-y-1.5 p-6", className)}
|
| 27 |
+
{...props}
|
| 28 |
+
/>
|
| 29 |
+
))
|
| 30 |
+
CardHeader.displayName = "CardHeader"
|
| 31 |
+
|
| 32 |
+
const CardTitle = React.forwardRef<
|
| 33 |
+
HTMLDivElement,
|
| 34 |
+
React.HTMLAttributes<HTMLDivElement>
|
| 35 |
+
>(({ className, ...props }, ref) => (
|
| 36 |
+
<div
|
| 37 |
+
ref={ref}
|
| 38 |
+
className={cn(
|
| 39 |
+
"text-2xl font-semibold leading-none tracking-tight",
|
| 40 |
+
className
|
| 41 |
+
)}
|
| 42 |
+
{...props}
|
| 43 |
+
/>
|
| 44 |
+
))
|
| 45 |
+
CardTitle.displayName = "CardTitle"
|
| 46 |
+
|
| 47 |
+
const CardDescription = React.forwardRef<
|
| 48 |
+
HTMLDivElement,
|
| 49 |
+
React.HTMLAttributes<HTMLDivElement>
|
| 50 |
+
>(({ className, ...props }, ref) => (
|
| 51 |
+
<div
|
| 52 |
+
ref={ref}
|
| 53 |
+
className={cn("text-sm text-muted-foreground", className)}
|
| 54 |
+
{...props}
|
| 55 |
+
/>
|
| 56 |
+
))
|
| 57 |
+
CardDescription.displayName = "CardDescription"
|
| 58 |
+
|
| 59 |
+
const CardContent = React.forwardRef<
|
| 60 |
+
HTMLDivElement,
|
| 61 |
+
React.HTMLAttributes<HTMLDivElement>
|
| 62 |
+
>(({ className, ...props }, ref) => (
|
| 63 |
+
<div ref={ref} className={cn("p-6 pt-0", className)} {...props} />
|
| 64 |
+
))
|
| 65 |
+
CardContent.displayName = "CardContent"
|
| 66 |
+
|
| 67 |
+
const CardFooter = React.forwardRef<
|
| 68 |
+
HTMLDivElement,
|
| 69 |
+
React.HTMLAttributes<HTMLDivElement>
|
| 70 |
+
>(({ className, ...props }, ref) => (
|
| 71 |
+
<div
|
| 72 |
+
ref={ref}
|
| 73 |
+
className={cn("flex items-center p-6 pt-0", className)}
|
| 74 |
+
{...props}
|
| 75 |
+
/>
|
| 76 |
+
))
|
| 77 |
+
CardFooter.displayName = "CardFooter"
|
| 78 |
+
|
| 79 |
+
export { Card, CardHeader, CardFooter, CardTitle, CardDescription, CardContent }
|
ipdmodule/components/ui/carousel.tsx
ADDED
|
@@ -0,0 +1,262 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"use client"
|
| 2 |
+
|
| 3 |
+
import * as React from "react"
|
| 4 |
+
import useEmblaCarousel, {
|
| 5 |
+
type UseEmblaCarouselType,
|
| 6 |
+
} from "embla-carousel-react"
|
| 7 |
+
import { ArrowLeft, ArrowRight } from "lucide-react"
|
| 8 |
+
|
| 9 |
+
import { cn } from "@/lib/utils"
|
| 10 |
+
import { Button } from "@/components/ui/button"
|
| 11 |
+
|
| 12 |
+
type CarouselApi = UseEmblaCarouselType[1]
|
| 13 |
+
type UseCarouselParameters = Parameters<typeof useEmblaCarousel>
|
| 14 |
+
type CarouselOptions = UseCarouselParameters[0]
|
| 15 |
+
type CarouselPlugin = UseCarouselParameters[1]
|
| 16 |
+
|
| 17 |
+
type CarouselProps = {
|
| 18 |
+
opts?: CarouselOptions
|
| 19 |
+
plugins?: CarouselPlugin
|
| 20 |
+
orientation?: "horizontal" | "vertical"
|
| 21 |
+
setApi?: (api: CarouselApi) => void
|
| 22 |
+
}
|
| 23 |
+
|
| 24 |
+
type CarouselContextProps = {
|
| 25 |
+
carouselRef: ReturnType<typeof useEmblaCarousel>[0]
|
| 26 |
+
api: ReturnType<typeof useEmblaCarousel>[1]
|
| 27 |
+
scrollPrev: () => void
|
| 28 |
+
scrollNext: () => void
|
| 29 |
+
canScrollPrev: boolean
|
| 30 |
+
canScrollNext: boolean
|
| 31 |
+
} & CarouselProps
|
| 32 |
+
|
| 33 |
+
const CarouselContext = React.createContext<CarouselContextProps | null>(null)
|
| 34 |
+
|
| 35 |
+
function useCarousel() {
|
| 36 |
+
const context = React.useContext(CarouselContext)
|
| 37 |
+
|
| 38 |
+
if (!context) {
|
| 39 |
+
throw new Error("useCarousel must be used within a <Carousel />")
|
| 40 |
+
}
|
| 41 |
+
|
| 42 |
+
return context
|
| 43 |
+
}
|
| 44 |
+
|
| 45 |
+
const Carousel = React.forwardRef<
|
| 46 |
+
HTMLDivElement,
|
| 47 |
+
React.HTMLAttributes<HTMLDivElement> & CarouselProps
|
| 48 |
+
>(
|
| 49 |
+
(
|
| 50 |
+
{
|
| 51 |
+
orientation = "horizontal",
|
| 52 |
+
opts,
|
| 53 |
+
setApi,
|
| 54 |
+
plugins,
|
| 55 |
+
className,
|
| 56 |
+
children,
|
| 57 |
+
...props
|
| 58 |
+
},
|
| 59 |
+
ref
|
| 60 |
+
) => {
|
| 61 |
+
const [carouselRef, api] = useEmblaCarousel(
|
| 62 |
+
{
|
| 63 |
+
...opts,
|
| 64 |
+
axis: orientation === "horizontal" ? "x" : "y",
|
| 65 |
+
},
|
| 66 |
+
plugins
|
| 67 |
+
)
|
| 68 |
+
const [canScrollPrev, setCanScrollPrev] = React.useState(false)
|
| 69 |
+
const [canScrollNext, setCanScrollNext] = React.useState(false)
|
| 70 |
+
|
| 71 |
+
const onSelect = React.useCallback((api: CarouselApi) => {
|
| 72 |
+
if (!api) {
|
| 73 |
+
return
|
| 74 |
+
}
|
| 75 |
+
|
| 76 |
+
setCanScrollPrev(api.canScrollPrev())
|
| 77 |
+
setCanScrollNext(api.canScrollNext())
|
| 78 |
+
}, [])
|
| 79 |
+
|
| 80 |
+
const scrollPrev = React.useCallback(() => {
|
| 81 |
+
api?.scrollPrev()
|
| 82 |
+
}, [api])
|
| 83 |
+
|
| 84 |
+
const scrollNext = React.useCallback(() => {
|
| 85 |
+
api?.scrollNext()
|
| 86 |
+
}, [api])
|
| 87 |
+
|
| 88 |
+
const handleKeyDown = React.useCallback(
|
| 89 |
+
(event: React.KeyboardEvent<HTMLDivElement>) => {
|
| 90 |
+
if (event.key === "ArrowLeft") {
|
| 91 |
+
event.preventDefault()
|
| 92 |
+
scrollPrev()
|
| 93 |
+
} else if (event.key === "ArrowRight") {
|
| 94 |
+
event.preventDefault()
|
| 95 |
+
scrollNext()
|
| 96 |
+
}
|
| 97 |
+
},
|
| 98 |
+
[scrollPrev, scrollNext]
|
| 99 |
+
)
|
| 100 |
+
|
| 101 |
+
React.useEffect(() => {
|
| 102 |
+
if (!api || !setApi) {
|
| 103 |
+
return
|
| 104 |
+
}
|
| 105 |
+
|
| 106 |
+
setApi(api)
|
| 107 |
+
}, [api, setApi])
|
| 108 |
+
|
| 109 |
+
React.useEffect(() => {
|
| 110 |
+
if (!api) {
|
| 111 |
+
return
|
| 112 |
+
}
|
| 113 |
+
|
| 114 |
+
onSelect(api)
|
| 115 |
+
api.on("reInit", onSelect)
|
| 116 |
+
api.on("select", onSelect)
|
| 117 |
+
|
| 118 |
+
return () => {
|
| 119 |
+
api?.off("select", onSelect)
|
| 120 |
+
}
|
| 121 |
+
}, [api, onSelect])
|
| 122 |
+
|
| 123 |
+
return (
|
| 124 |
+
<CarouselContext.Provider
|
| 125 |
+
value={{
|
| 126 |
+
carouselRef,
|
| 127 |
+
api: api,
|
| 128 |
+
opts,
|
| 129 |
+
orientation:
|
| 130 |
+
orientation || (opts?.axis === "y" ? "vertical" : "horizontal"),
|
| 131 |
+
scrollPrev,
|
| 132 |
+
scrollNext,
|
| 133 |
+
canScrollPrev,
|
| 134 |
+
canScrollNext,
|
| 135 |
+
}}
|
| 136 |
+
>
|
| 137 |
+
<div
|
| 138 |
+
ref={ref}
|
| 139 |
+
onKeyDownCapture={handleKeyDown}
|
| 140 |
+
className={cn("relative", className)}
|
| 141 |
+
role="region"
|
| 142 |
+
aria-roledescription="carousel"
|
| 143 |
+
{...props}
|
| 144 |
+
>
|
| 145 |
+
{children}
|
| 146 |
+
</div>
|
| 147 |
+
</CarouselContext.Provider>
|
| 148 |
+
)
|
| 149 |
+
}
|
| 150 |
+
)
|
| 151 |
+
Carousel.displayName = "Carousel"
|
| 152 |
+
|
| 153 |
+
const CarouselContent = React.forwardRef<
|
| 154 |
+
HTMLDivElement,
|
| 155 |
+
React.HTMLAttributes<HTMLDivElement>
|
| 156 |
+
>(({ className, ...props }, ref) => {
|
| 157 |
+
const { carouselRef, orientation } = useCarousel()
|
| 158 |
+
|
| 159 |
+
return (
|
| 160 |
+
<div ref={carouselRef} className="overflow-hidden">
|
| 161 |
+
<div
|
| 162 |
+
ref={ref}
|
| 163 |
+
className={cn(
|
| 164 |
+
"flex",
|
| 165 |
+
orientation === "horizontal" ? "-ml-4" : "-mt-4 flex-col",
|
| 166 |
+
className
|
| 167 |
+
)}
|
| 168 |
+
{...props}
|
| 169 |
+
/>
|
| 170 |
+
</div>
|
| 171 |
+
)
|
| 172 |
+
})
|
| 173 |
+
CarouselContent.displayName = "CarouselContent"
|
| 174 |
+
|
| 175 |
+
const CarouselItem = React.forwardRef<
|
| 176 |
+
HTMLDivElement,
|
| 177 |
+
React.HTMLAttributes<HTMLDivElement>
|
| 178 |
+
>(({ className, ...props }, ref) => {
|
| 179 |
+
const { orientation } = useCarousel()
|
| 180 |
+
|
| 181 |
+
return (
|
| 182 |
+
<div
|
| 183 |
+
ref={ref}
|
| 184 |
+
role="group"
|
| 185 |
+
aria-roledescription="slide"
|
| 186 |
+
className={cn(
|
| 187 |
+
"min-w-0 shrink-0 grow-0 basis-full",
|
| 188 |
+
orientation === "horizontal" ? "pl-4" : "pt-4",
|
| 189 |
+
className
|
| 190 |
+
)}
|
| 191 |
+
{...props}
|
| 192 |
+
/>
|
| 193 |
+
)
|
| 194 |
+
})
|
| 195 |
+
CarouselItem.displayName = "CarouselItem"
|
| 196 |
+
|
| 197 |
+
const CarouselPrevious = React.forwardRef<
|
| 198 |
+
HTMLButtonElement,
|
| 199 |
+
React.ComponentProps<typeof Button>
|
| 200 |
+
>(({ className, variant = "outline", size = "icon", ...props }, ref) => {
|
| 201 |
+
const { orientation, scrollPrev, canScrollPrev } = useCarousel()
|
| 202 |
+
|
| 203 |
+
return (
|
| 204 |
+
<Button
|
| 205 |
+
ref={ref}
|
| 206 |
+
variant={variant}
|
| 207 |
+
size={size}
|
| 208 |
+
className={cn(
|
| 209 |
+
"absolute h-8 w-8 rounded-full",
|
| 210 |
+
orientation === "horizontal"
|
| 211 |
+
? "-left-12 top-1/2 -translate-y-1/2"
|
| 212 |
+
: "-top-12 left-1/2 -translate-x-1/2 rotate-90",
|
| 213 |
+
className
|
| 214 |
+
)}
|
| 215 |
+
disabled={!canScrollPrev}
|
| 216 |
+
onClick={scrollPrev}
|
| 217 |
+
{...props}
|
| 218 |
+
>
|
| 219 |
+
<ArrowLeft className="h-4 w-4" />
|
| 220 |
+
<span className="sr-only">Previous slide</span>
|
| 221 |
+
</Button>
|
| 222 |
+
)
|
| 223 |
+
})
|
| 224 |
+
CarouselPrevious.displayName = "CarouselPrevious"
|
| 225 |
+
|
| 226 |
+
const CarouselNext = React.forwardRef<
|
| 227 |
+
HTMLButtonElement,
|
| 228 |
+
React.ComponentProps<typeof Button>
|
| 229 |
+
>(({ className, variant = "outline", size = "icon", ...props }, ref) => {
|
| 230 |
+
const { orientation, scrollNext, canScrollNext } = useCarousel()
|
| 231 |
+
|
| 232 |
+
return (
|
| 233 |
+
<Button
|
| 234 |
+
ref={ref}
|
| 235 |
+
variant={variant}
|
| 236 |
+
size={size}
|
| 237 |
+
className={cn(
|
| 238 |
+
"absolute h-8 w-8 rounded-full",
|
| 239 |
+
orientation === "horizontal"
|
| 240 |
+
? "-right-12 top-1/2 -translate-y-1/2"
|
| 241 |
+
: "-bottom-12 left-1/2 -translate-x-1/2 rotate-90",
|
| 242 |
+
className
|
| 243 |
+
)}
|
| 244 |
+
disabled={!canScrollNext}
|
| 245 |
+
onClick={scrollNext}
|
| 246 |
+
{...props}
|
| 247 |
+
>
|
| 248 |
+
<ArrowRight className="h-4 w-4" />
|
| 249 |
+
<span className="sr-only">Next slide</span>
|
| 250 |
+
</Button>
|
| 251 |
+
)
|
| 252 |
+
})
|
| 253 |
+
CarouselNext.displayName = "CarouselNext"
|
| 254 |
+
|
| 255 |
+
export {
|
| 256 |
+
type CarouselApi,
|
| 257 |
+
Carousel,
|
| 258 |
+
CarouselContent,
|
| 259 |
+
CarouselItem,
|
| 260 |
+
CarouselPrevious,
|
| 261 |
+
CarouselNext,
|
| 262 |
+
}
|
ipdmodule/components/ui/chart.tsx
ADDED
|
@@ -0,0 +1,365 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"use client"
|
| 2 |
+
|
| 3 |
+
import * as React from "react"
|
| 4 |
+
import * as RechartsPrimitive from "recharts"
|
| 5 |
+
|
| 6 |
+
import { cn } from "@/lib/utils"
|
| 7 |
+
|
| 8 |
+
// Format: { THEME_NAME: CSS_SELECTOR }
|
| 9 |
+
const THEMES = { light: "", dark: ".dark" } as const
|
| 10 |
+
|
| 11 |
+
export type ChartConfig = {
|
| 12 |
+
[k in string]: {
|
| 13 |
+
label?: React.ReactNode
|
| 14 |
+
icon?: React.ComponentType
|
| 15 |
+
} & (
|
| 16 |
+
| { color?: string; theme?: never }
|
| 17 |
+
| { color?: never; theme: Record<keyof typeof THEMES, string> }
|
| 18 |
+
)
|
| 19 |
+
}
|
| 20 |
+
|
| 21 |
+
type ChartContextProps = {
|
| 22 |
+
config: ChartConfig
|
| 23 |
+
}
|
| 24 |
+
|
| 25 |
+
const ChartContext = React.createContext<ChartContextProps | null>(null)
|
| 26 |
+
|
| 27 |
+
function useChart() {
|
| 28 |
+
const context = React.useContext(ChartContext)
|
| 29 |
+
|
| 30 |
+
if (!context) {
|
| 31 |
+
throw new Error("useChart must be used within a <ChartContainer />")
|
| 32 |
+
}
|
| 33 |
+
|
| 34 |
+
return context
|
| 35 |
+
}
|
| 36 |
+
|
| 37 |
+
const ChartContainer = React.forwardRef<
|
| 38 |
+
HTMLDivElement,
|
| 39 |
+
React.ComponentProps<"div"> & {
|
| 40 |
+
config: ChartConfig
|
| 41 |
+
children: React.ComponentProps<
|
| 42 |
+
typeof RechartsPrimitive.ResponsiveContainer
|
| 43 |
+
>["children"]
|
| 44 |
+
}
|
| 45 |
+
>(({ id, className, children, config, ...props }, ref) => {
|
| 46 |
+
const uniqueId = React.useId()
|
| 47 |
+
const chartId = `chart-${id || uniqueId.replace(/:/g, "")}`
|
| 48 |
+
|
| 49 |
+
return (
|
| 50 |
+
<ChartContext.Provider value={{ config }}>
|
| 51 |
+
<div
|
| 52 |
+
data-chart={chartId}
|
| 53 |
+
ref={ref}
|
| 54 |
+
className={cn(
|
| 55 |
+
"flex aspect-video justify-center text-xs [&_.recharts-cartesian-axis-tick_text]:fill-muted-foreground [&_.recharts-cartesian-grid_line[stroke='#ccc']]:stroke-border/50 [&_.recharts-curve.recharts-tooltip-cursor]:stroke-border [&_.recharts-dot[stroke='#fff']]:stroke-transparent [&_.recharts-layer]:outline-none [&_.recharts-polar-grid_[stroke='#ccc']]:stroke-border [&_.recharts-radial-bar-background-sector]:fill-muted [&_.recharts-rectangle.recharts-tooltip-cursor]:fill-muted [&_.recharts-reference-line_[stroke='#ccc']]:stroke-border [&_.recharts-sector[stroke='#fff']]:stroke-transparent [&_.recharts-sector]:outline-none [&_.recharts-surface]:outline-none",
|
| 56 |
+
className
|
| 57 |
+
)}
|
| 58 |
+
{...props}
|
| 59 |
+
>
|
| 60 |
+
<ChartStyle id={chartId} config={config} />
|
| 61 |
+
<RechartsPrimitive.ResponsiveContainer>
|
| 62 |
+
{children}
|
| 63 |
+
</RechartsPrimitive.ResponsiveContainer>
|
| 64 |
+
</div>
|
| 65 |
+
</ChartContext.Provider>
|
| 66 |
+
)
|
| 67 |
+
})
|
| 68 |
+
ChartContainer.displayName = "Chart"
|
| 69 |
+
|
| 70 |
+
const ChartStyle = ({ id, config }: { id: string; config: ChartConfig }) => {
|
| 71 |
+
const colorConfig = Object.entries(config).filter(
|
| 72 |
+
([_, config]) => config.theme || config.color
|
| 73 |
+
)
|
| 74 |
+
|
| 75 |
+
if (!colorConfig.length) {
|
| 76 |
+
return null
|
| 77 |
+
}
|
| 78 |
+
|
| 79 |
+
return (
|
| 80 |
+
<style
|
| 81 |
+
dangerouslySetInnerHTML={{
|
| 82 |
+
__html: Object.entries(THEMES)
|
| 83 |
+
.map(
|
| 84 |
+
([theme, prefix]) => `
|
| 85 |
+
${prefix} [data-chart=${id}] {
|
| 86 |
+
${colorConfig
|
| 87 |
+
.map(([key, itemConfig]) => {
|
| 88 |
+
const color =
|
| 89 |
+
itemConfig.theme?.[theme as keyof typeof itemConfig.theme] ||
|
| 90 |
+
itemConfig.color
|
| 91 |
+
return color ? ` --color-${key}: ${color};` : null
|
| 92 |
+
})
|
| 93 |
+
.join("\n")}
|
| 94 |
+
}
|
| 95 |
+
`
|
| 96 |
+
)
|
| 97 |
+
.join("\n"),
|
| 98 |
+
}}
|
| 99 |
+
/>
|
| 100 |
+
)
|
| 101 |
+
}
|
| 102 |
+
|
| 103 |
+
const ChartTooltip = RechartsPrimitive.Tooltip
|
| 104 |
+
|
| 105 |
+
const ChartTooltipContent = React.forwardRef<
|
| 106 |
+
HTMLDivElement,
|
| 107 |
+
React.ComponentProps<typeof RechartsPrimitive.Tooltip> &
|
| 108 |
+
React.ComponentProps<"div"> & {
|
| 109 |
+
hideLabel?: boolean
|
| 110 |
+
hideIndicator?: boolean
|
| 111 |
+
indicator?: "line" | "dot" | "dashed"
|
| 112 |
+
nameKey?: string
|
| 113 |
+
labelKey?: string
|
| 114 |
+
}
|
| 115 |
+
>(
|
| 116 |
+
(
|
| 117 |
+
{
|
| 118 |
+
active,
|
| 119 |
+
payload,
|
| 120 |
+
className,
|
| 121 |
+
indicator = "dot",
|
| 122 |
+
hideLabel = false,
|
| 123 |
+
hideIndicator = false,
|
| 124 |
+
label,
|
| 125 |
+
labelFormatter,
|
| 126 |
+
labelClassName,
|
| 127 |
+
formatter,
|
| 128 |
+
color,
|
| 129 |
+
nameKey,
|
| 130 |
+
labelKey,
|
| 131 |
+
},
|
| 132 |
+
ref
|
| 133 |
+
) => {
|
| 134 |
+
const { config } = useChart()
|
| 135 |
+
|
| 136 |
+
const tooltipLabel = React.useMemo(() => {
|
| 137 |
+
if (hideLabel || !payload?.length) {
|
| 138 |
+
return null
|
| 139 |
+
}
|
| 140 |
+
|
| 141 |
+
const [item] = payload
|
| 142 |
+
const key = `${labelKey || item.dataKey || item.name || "value"}`
|
| 143 |
+
const itemConfig = getPayloadConfigFromPayload(config, item, key)
|
| 144 |
+
const value =
|
| 145 |
+
!labelKey && typeof label === "string"
|
| 146 |
+
? config[label as keyof typeof config]?.label || label
|
| 147 |
+
: itemConfig?.label
|
| 148 |
+
|
| 149 |
+
if (labelFormatter) {
|
| 150 |
+
return (
|
| 151 |
+
<div className={cn("font-medium", labelClassName)}>
|
| 152 |
+
{labelFormatter(value, payload)}
|
| 153 |
+
</div>
|
| 154 |
+
)
|
| 155 |
+
}
|
| 156 |
+
|
| 157 |
+
if (!value) {
|
| 158 |
+
return null
|
| 159 |
+
}
|
| 160 |
+
|
| 161 |
+
return <div className={cn("font-medium", labelClassName)}>{value}</div>
|
| 162 |
+
}, [
|
| 163 |
+
label,
|
| 164 |
+
labelFormatter,
|
| 165 |
+
payload,
|
| 166 |
+
hideLabel,
|
| 167 |
+
labelClassName,
|
| 168 |
+
config,
|
| 169 |
+
labelKey,
|
| 170 |
+
])
|
| 171 |
+
|
| 172 |
+
if (!active || !payload?.length) {
|
| 173 |
+
return null
|
| 174 |
+
}
|
| 175 |
+
|
| 176 |
+
const nestLabel = payload.length === 1 && indicator !== "dot"
|
| 177 |
+
|
| 178 |
+
return (
|
| 179 |
+
<div
|
| 180 |
+
ref={ref}
|
| 181 |
+
className={cn(
|
| 182 |
+
"grid min-w-[8rem] items-start gap-1.5 rounded-lg border border-border/50 bg-background px-2.5 py-1.5 text-xs shadow-xl",
|
| 183 |
+
className
|
| 184 |
+
)}
|
| 185 |
+
>
|
| 186 |
+
{!nestLabel ? tooltipLabel : null}
|
| 187 |
+
<div className="grid gap-1.5">
|
| 188 |
+
{payload.map((item, index) => {
|
| 189 |
+
const key = `${nameKey || item.name || item.dataKey || "value"}`
|
| 190 |
+
const itemConfig = getPayloadConfigFromPayload(config, item, key)
|
| 191 |
+
const indicatorColor = color || item.payload.fill || item.color
|
| 192 |
+
|
| 193 |
+
return (
|
| 194 |
+
<div
|
| 195 |
+
key={item.dataKey}
|
| 196 |
+
className={cn(
|
| 197 |
+
"flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5 [&>svg]:text-muted-foreground",
|
| 198 |
+
indicator === "dot" && "items-center"
|
| 199 |
+
)}
|
| 200 |
+
>
|
| 201 |
+
{formatter && item?.value !== undefined && item.name ? (
|
| 202 |
+
formatter(item.value, item.name, item, index, item.payload)
|
| 203 |
+
) : (
|
| 204 |
+
<>
|
| 205 |
+
{itemConfig?.icon ? (
|
| 206 |
+
<itemConfig.icon />
|
| 207 |
+
) : (
|
| 208 |
+
!hideIndicator && (
|
| 209 |
+
<div
|
| 210 |
+
className={cn(
|
| 211 |
+
"shrink-0 rounded-[2px] border-[--color-border] bg-[--color-bg]",
|
| 212 |
+
{
|
| 213 |
+
"h-2.5 w-2.5": indicator === "dot",
|
| 214 |
+
"w-1": indicator === "line",
|
| 215 |
+
"w-0 border-[1.5px] border-dashed bg-transparent":
|
| 216 |
+
indicator === "dashed",
|
| 217 |
+
"my-0.5": nestLabel && indicator === "dashed",
|
| 218 |
+
}
|
| 219 |
+
)}
|
| 220 |
+
style={
|
| 221 |
+
{
|
| 222 |
+
"--color-bg": indicatorColor,
|
| 223 |
+
"--color-border": indicatorColor,
|
| 224 |
+
} as React.CSSProperties
|
| 225 |
+
}
|
| 226 |
+
/>
|
| 227 |
+
)
|
| 228 |
+
)}
|
| 229 |
+
<div
|
| 230 |
+
className={cn(
|
| 231 |
+
"flex flex-1 justify-between leading-none",
|
| 232 |
+
nestLabel ? "items-end" : "items-center"
|
| 233 |
+
)}
|
| 234 |
+
>
|
| 235 |
+
<div className="grid gap-1.5">
|
| 236 |
+
{nestLabel ? tooltipLabel : null}
|
| 237 |
+
<span className="text-muted-foreground">
|
| 238 |
+
{itemConfig?.label || item.name}
|
| 239 |
+
</span>
|
| 240 |
+
</div>
|
| 241 |
+
{item.value && (
|
| 242 |
+
<span className="font-mono font-medium tabular-nums text-foreground">
|
| 243 |
+
{item.value.toLocaleString()}
|
| 244 |
+
</span>
|
| 245 |
+
)}
|
| 246 |
+
</div>
|
| 247 |
+
</>
|
| 248 |
+
)}
|
| 249 |
+
</div>
|
| 250 |
+
)
|
| 251 |
+
})}
|
| 252 |
+
</div>
|
| 253 |
+
</div>
|
| 254 |
+
)
|
| 255 |
+
}
|
| 256 |
+
)
|
| 257 |
+
ChartTooltipContent.displayName = "ChartTooltip"
|
| 258 |
+
|
| 259 |
+
const ChartLegend = RechartsPrimitive.Legend
|
| 260 |
+
|
| 261 |
+
const ChartLegendContent = React.forwardRef<
|
| 262 |
+
HTMLDivElement,
|
| 263 |
+
React.ComponentProps<"div"> &
|
| 264 |
+
Pick<RechartsPrimitive.LegendProps, "payload" | "verticalAlign"> & {
|
| 265 |
+
hideIcon?: boolean
|
| 266 |
+
nameKey?: string
|
| 267 |
+
}
|
| 268 |
+
>(
|
| 269 |
+
(
|
| 270 |
+
{ className, hideIcon = false, payload, verticalAlign = "bottom", nameKey },
|
| 271 |
+
ref
|
| 272 |
+
) => {
|
| 273 |
+
const { config } = useChart()
|
| 274 |
+
|
| 275 |
+
if (!payload?.length) {
|
| 276 |
+
return null
|
| 277 |
+
}
|
| 278 |
+
|
| 279 |
+
return (
|
| 280 |
+
<div
|
| 281 |
+
ref={ref}
|
| 282 |
+
className={cn(
|
| 283 |
+
"flex items-center justify-center gap-4",
|
| 284 |
+
verticalAlign === "top" ? "pb-3" : "pt-3",
|
| 285 |
+
className
|
| 286 |
+
)}
|
| 287 |
+
>
|
| 288 |
+
{payload.map((item) => {
|
| 289 |
+
const key = `${nameKey || item.dataKey || "value"}`
|
| 290 |
+
const itemConfig = getPayloadConfigFromPayload(config, item, key)
|
| 291 |
+
|
| 292 |
+
return (
|
| 293 |
+
<div
|
| 294 |
+
key={item.value}
|
| 295 |
+
className={cn(
|
| 296 |
+
"flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3 [&>svg]:text-muted-foreground"
|
| 297 |
+
)}
|
| 298 |
+
>
|
| 299 |
+
{itemConfig?.icon && !hideIcon ? (
|
| 300 |
+
<itemConfig.icon />
|
| 301 |
+
) : (
|
| 302 |
+
<div
|
| 303 |
+
className="h-2 w-2 shrink-0 rounded-[2px]"
|
| 304 |
+
style={{
|
| 305 |
+
backgroundColor: item.color,
|
| 306 |
+
}}
|
| 307 |
+
/>
|
| 308 |
+
)}
|
| 309 |
+
{itemConfig?.label}
|
| 310 |
+
</div>
|
| 311 |
+
)
|
| 312 |
+
})}
|
| 313 |
+
</div>
|
| 314 |
+
)
|
| 315 |
+
}
|
| 316 |
+
)
|
| 317 |
+
ChartLegendContent.displayName = "ChartLegend"
|
| 318 |
+
|
| 319 |
+
// Helper to extract item config from a payload.
|
| 320 |
+
function getPayloadConfigFromPayload(
|
| 321 |
+
config: ChartConfig,
|
| 322 |
+
payload: unknown,
|
| 323 |
+
key: string
|
| 324 |
+
) {
|
| 325 |
+
if (typeof payload !== "object" || payload === null) {
|
| 326 |
+
return undefined
|
| 327 |
+
}
|
| 328 |
+
|
| 329 |
+
const payloadPayload =
|
| 330 |
+
"payload" in payload &&
|
| 331 |
+
typeof payload.payload === "object" &&
|
| 332 |
+
payload.payload !== null
|
| 333 |
+
? payload.payload
|
| 334 |
+
: undefined
|
| 335 |
+
|
| 336 |
+
let configLabelKey: string = key
|
| 337 |
+
|
| 338 |
+
if (
|
| 339 |
+
key in payload &&
|
| 340 |
+
typeof payload[key as keyof typeof payload] === "string"
|
| 341 |
+
) {
|
| 342 |
+
configLabelKey = payload[key as keyof typeof payload] as string
|
| 343 |
+
} else if (
|
| 344 |
+
payloadPayload &&
|
| 345 |
+
key in payloadPayload &&
|
| 346 |
+
typeof payloadPayload[key as keyof typeof payloadPayload] === "string"
|
| 347 |
+
) {
|
| 348 |
+
configLabelKey = payloadPayload[
|
| 349 |
+
key as keyof typeof payloadPayload
|
| 350 |
+
] as string
|
| 351 |
+
}
|
| 352 |
+
|
| 353 |
+
return configLabelKey in config
|
| 354 |
+
? config[configLabelKey]
|
| 355 |
+
: config[key as keyof typeof config]
|
| 356 |
+
}
|
| 357 |
+
|
| 358 |
+
export {
|
| 359 |
+
ChartContainer,
|
| 360 |
+
ChartTooltip,
|
| 361 |
+
ChartTooltipContent,
|
| 362 |
+
ChartLegend,
|
| 363 |
+
ChartLegendContent,
|
| 364 |
+
ChartStyle,
|
| 365 |
+
}
|
ipdmodule/components/ui/checkbox.tsx
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"use client"
|
| 2 |
+
|
| 3 |
+
import * as React from "react"
|
| 4 |
+
import * as CheckboxPrimitive from "@radix-ui/react-checkbox"
|
| 5 |
+
import { Check } from "lucide-react"
|
| 6 |
+
|
| 7 |
+
import { cn } from "@/lib/utils"
|
| 8 |
+
|
| 9 |
+
const Checkbox = React.forwardRef<
|
| 10 |
+
React.ElementRef<typeof CheckboxPrimitive.Root>,
|
| 11 |
+
React.ComponentPropsWithoutRef<typeof CheckboxPrimitive.Root>
|
| 12 |
+
>(({ className, ...props }, ref) => (
|
| 13 |
+
<CheckboxPrimitive.Root
|
| 14 |
+
ref={ref}
|
| 15 |
+
className={cn(
|
| 16 |
+
"peer h-4 w-4 shrink-0 rounded-sm border border-primary ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",
|
| 17 |
+
className
|
| 18 |
+
)}
|
| 19 |
+
{...props}
|
| 20 |
+
>
|
| 21 |
+
<CheckboxPrimitive.Indicator
|
| 22 |
+
className={cn("flex items-center justify-center text-current")}
|
| 23 |
+
>
|
| 24 |
+
<Check className="h-4 w-4" />
|
| 25 |
+
</CheckboxPrimitive.Indicator>
|
| 26 |
+
</CheckboxPrimitive.Root>
|
| 27 |
+
))
|
| 28 |
+
Checkbox.displayName = CheckboxPrimitive.Root.displayName
|
| 29 |
+
|
| 30 |
+
export { Checkbox }
|
ipdmodule/components/ui/collapsible.tsx
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"use client"
|
| 2 |
+
|
| 3 |
+
import * as CollapsiblePrimitive from "@radix-ui/react-collapsible"
|
| 4 |
+
|
| 5 |
+
const Collapsible = CollapsiblePrimitive.Root
|
| 6 |
+
|
| 7 |
+
const CollapsibleTrigger = CollapsiblePrimitive.CollapsibleTrigger
|
| 8 |
+
|
| 9 |
+
const CollapsibleContent = CollapsiblePrimitive.CollapsibleContent
|
| 10 |
+
|
| 11 |
+
export { Collapsible, CollapsibleTrigger, CollapsibleContent }
|
ipdmodule/components/ui/command.tsx
ADDED
|
@@ -0,0 +1,153 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"use client"
|
| 2 |
+
|
| 3 |
+
import * as React from "react"
|
| 4 |
+
import { type DialogProps } from "@radix-ui/react-dialog"
|
| 5 |
+
import { Command as CommandPrimitive } from "cmdk"
|
| 6 |
+
import { Search } from "lucide-react"
|
| 7 |
+
|
| 8 |
+
import { cn } from "@/lib/utils"
|
| 9 |
+
import { Dialog, DialogContent } from "@/components/ui/dialog"
|
| 10 |
+
|
| 11 |
+
const Command = React.forwardRef<
|
| 12 |
+
React.ElementRef<typeof CommandPrimitive>,
|
| 13 |
+
React.ComponentPropsWithoutRef<typeof CommandPrimitive>
|
| 14 |
+
>(({ className, ...props }, ref) => (
|
| 15 |
+
<CommandPrimitive
|
| 16 |
+
ref={ref}
|
| 17 |
+
className={cn(
|
| 18 |
+
"flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",
|
| 19 |
+
className
|
| 20 |
+
)}
|
| 21 |
+
{...props}
|
| 22 |
+
/>
|
| 23 |
+
))
|
| 24 |
+
Command.displayName = CommandPrimitive.displayName
|
| 25 |
+
|
| 26 |
+
const CommandDialog = ({ children, ...props }: DialogProps) => {
|
| 27 |
+
return (
|
| 28 |
+
<Dialog {...props}>
|
| 29 |
+
<DialogContent className="overflow-hidden p-0 shadow-lg">
|
| 30 |
+
<Command className="[&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-group]]:px-2 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5">
|
| 31 |
+
{children}
|
| 32 |
+
</Command>
|
| 33 |
+
</DialogContent>
|
| 34 |
+
</Dialog>
|
| 35 |
+
)
|
| 36 |
+
}
|
| 37 |
+
|
| 38 |
+
const CommandInput = React.forwardRef<
|
| 39 |
+
React.ElementRef<typeof CommandPrimitive.Input>,
|
| 40 |
+
React.ComponentPropsWithoutRef<typeof CommandPrimitive.Input>
|
| 41 |
+
>(({ className, ...props }, ref) => (
|
| 42 |
+
<div className="flex items-center border-b px-3" cmdk-input-wrapper="">
|
| 43 |
+
<Search className="mr-2 h-4 w-4 shrink-0 opacity-50" />
|
| 44 |
+
<CommandPrimitive.Input
|
| 45 |
+
ref={ref}
|
| 46 |
+
className={cn(
|
| 47 |
+
"flex h-11 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",
|
| 48 |
+
className
|
| 49 |
+
)}
|
| 50 |
+
{...props}
|
| 51 |
+
/>
|
| 52 |
+
</div>
|
| 53 |
+
))
|
| 54 |
+
|
| 55 |
+
CommandInput.displayName = CommandPrimitive.Input.displayName
|
| 56 |
+
|
| 57 |
+
const CommandList = React.forwardRef<
|
| 58 |
+
React.ElementRef<typeof CommandPrimitive.List>,
|
| 59 |
+
React.ComponentPropsWithoutRef<typeof CommandPrimitive.List>
|
| 60 |
+
>(({ className, ...props }, ref) => (
|
| 61 |
+
<CommandPrimitive.List
|
| 62 |
+
ref={ref}
|
| 63 |
+
className={cn("max-h-[300px] overflow-y-auto overflow-x-hidden", className)}
|
| 64 |
+
{...props}
|
| 65 |
+
/>
|
| 66 |
+
))
|
| 67 |
+
|
| 68 |
+
CommandList.displayName = CommandPrimitive.List.displayName
|
| 69 |
+
|
| 70 |
+
const CommandEmpty = React.forwardRef<
|
| 71 |
+
React.ElementRef<typeof CommandPrimitive.Empty>,
|
| 72 |
+
React.ComponentPropsWithoutRef<typeof CommandPrimitive.Empty>
|
| 73 |
+
>((props, ref) => (
|
| 74 |
+
<CommandPrimitive.Empty
|
| 75 |
+
ref={ref}
|
| 76 |
+
className="py-6 text-center text-sm"
|
| 77 |
+
{...props}
|
| 78 |
+
/>
|
| 79 |
+
))
|
| 80 |
+
|
| 81 |
+
CommandEmpty.displayName = CommandPrimitive.Empty.displayName
|
| 82 |
+
|
| 83 |
+
const CommandGroup = React.forwardRef<
|
| 84 |
+
React.ElementRef<typeof CommandPrimitive.Group>,
|
| 85 |
+
React.ComponentPropsWithoutRef<typeof CommandPrimitive.Group>
|
| 86 |
+
>(({ className, ...props }, ref) => (
|
| 87 |
+
<CommandPrimitive.Group
|
| 88 |
+
ref={ref}
|
| 89 |
+
className={cn(
|
| 90 |
+
"overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",
|
| 91 |
+
className
|
| 92 |
+
)}
|
| 93 |
+
{...props}
|
| 94 |
+
/>
|
| 95 |
+
))
|
| 96 |
+
|
| 97 |
+
CommandGroup.displayName = CommandPrimitive.Group.displayName
|
| 98 |
+
|
| 99 |
+
const CommandSeparator = React.forwardRef<
|
| 100 |
+
React.ElementRef<typeof CommandPrimitive.Separator>,
|
| 101 |
+
React.ComponentPropsWithoutRef<typeof CommandPrimitive.Separator>
|
| 102 |
+
>(({ className, ...props }, ref) => (
|
| 103 |
+
<CommandPrimitive.Separator
|
| 104 |
+
ref={ref}
|
| 105 |
+
className={cn("-mx-1 h-px bg-border", className)}
|
| 106 |
+
{...props}
|
| 107 |
+
/>
|
| 108 |
+
))
|
| 109 |
+
CommandSeparator.displayName = CommandPrimitive.Separator.displayName
|
| 110 |
+
|
| 111 |
+
const CommandItem = React.forwardRef<
|
| 112 |
+
React.ElementRef<typeof CommandPrimitive.Item>,
|
| 113 |
+
React.ComponentPropsWithoutRef<typeof CommandPrimitive.Item>
|
| 114 |
+
>(({ className, ...props }, ref) => (
|
| 115 |
+
<CommandPrimitive.Item
|
| 116 |
+
ref={ref}
|
| 117 |
+
className={cn(
|
| 118 |
+
"relative flex cursor-default gap-2 select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[disabled=true]:pointer-events-none data-[selected='true']:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",
|
| 119 |
+
className
|
| 120 |
+
)}
|
| 121 |
+
{...props}
|
| 122 |
+
/>
|
| 123 |
+
))
|
| 124 |
+
|
| 125 |
+
CommandItem.displayName = CommandPrimitive.Item.displayName
|
| 126 |
+
|
| 127 |
+
const CommandShortcut = ({
|
| 128 |
+
className,
|
| 129 |
+
...props
|
| 130 |
+
}: React.HTMLAttributes<HTMLSpanElement>) => {
|
| 131 |
+
return (
|
| 132 |
+
<span
|
| 133 |
+
className={cn(
|
| 134 |
+
"ml-auto text-xs tracking-widest text-muted-foreground",
|
| 135 |
+
className
|
| 136 |
+
)}
|
| 137 |
+
{...props}
|
| 138 |
+
/>
|
| 139 |
+
)
|
| 140 |
+
}
|
| 141 |
+
CommandShortcut.displayName = "CommandShortcut"
|
| 142 |
+
|
| 143 |
+
export {
|
| 144 |
+
Command,
|
| 145 |
+
CommandDialog,
|
| 146 |
+
CommandInput,
|
| 147 |
+
CommandList,
|
| 148 |
+
CommandEmpty,
|
| 149 |
+
CommandGroup,
|
| 150 |
+
CommandItem,
|
| 151 |
+
CommandShortcut,
|
| 152 |
+
CommandSeparator,
|
| 153 |
+
}
|
ipdmodule/components/ui/context-menu.tsx
ADDED
|
@@ -0,0 +1,200 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"use client"
|
| 2 |
+
|
| 3 |
+
import * as React from "react"
|
| 4 |
+
import * as ContextMenuPrimitive from "@radix-ui/react-context-menu"
|
| 5 |
+
import { Check, ChevronRight, Circle } from "lucide-react"
|
| 6 |
+
|
| 7 |
+
import { cn } from "@/lib/utils"
|
| 8 |
+
|
| 9 |
+
const ContextMenu = ContextMenuPrimitive.Root
|
| 10 |
+
|
| 11 |
+
const ContextMenuTrigger = ContextMenuPrimitive.Trigger
|
| 12 |
+
|
| 13 |
+
const ContextMenuGroup = ContextMenuPrimitive.Group
|
| 14 |
+
|
| 15 |
+
const ContextMenuPortal = ContextMenuPrimitive.Portal
|
| 16 |
+
|
| 17 |
+
const ContextMenuSub = ContextMenuPrimitive.Sub
|
| 18 |
+
|
| 19 |
+
const ContextMenuRadioGroup = ContextMenuPrimitive.RadioGroup
|
| 20 |
+
|
| 21 |
+
const ContextMenuSubTrigger = React.forwardRef<
|
| 22 |
+
React.ElementRef<typeof ContextMenuPrimitive.SubTrigger>,
|
| 23 |
+
React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.SubTrigger> & {
|
| 24 |
+
inset?: boolean
|
| 25 |
+
}
|
| 26 |
+
>(({ className, inset, children, ...props }, ref) => (
|
| 27 |
+
<ContextMenuPrimitive.SubTrigger
|
| 28 |
+
ref={ref}
|
| 29 |
+
className={cn(
|
| 30 |
+
"flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground",
|
| 31 |
+
inset && "pl-8",
|
| 32 |
+
className
|
| 33 |
+
)}
|
| 34 |
+
{...props}
|
| 35 |
+
>
|
| 36 |
+
{children}
|
| 37 |
+
<ChevronRight className="ml-auto h-4 w-4" />
|
| 38 |
+
</ContextMenuPrimitive.SubTrigger>
|
| 39 |
+
))
|
| 40 |
+
ContextMenuSubTrigger.displayName = ContextMenuPrimitive.SubTrigger.displayName
|
| 41 |
+
|
| 42 |
+
const ContextMenuSubContent = React.forwardRef<
|
| 43 |
+
React.ElementRef<typeof ContextMenuPrimitive.SubContent>,
|
| 44 |
+
React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.SubContent>
|
| 45 |
+
>(({ className, ...props }, ref) => (
|
| 46 |
+
<ContextMenuPrimitive.SubContent
|
| 47 |
+
ref={ref}
|
| 48 |
+
className={cn(
|
| 49 |
+
"z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
|
| 50 |
+
className
|
| 51 |
+
)}
|
| 52 |
+
{...props}
|
| 53 |
+
/>
|
| 54 |
+
))
|
| 55 |
+
ContextMenuSubContent.displayName = ContextMenuPrimitive.SubContent.displayName
|
| 56 |
+
|
| 57 |
+
const ContextMenuContent = React.forwardRef<
|
| 58 |
+
React.ElementRef<typeof ContextMenuPrimitive.Content>,
|
| 59 |
+
React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Content>
|
| 60 |
+
>(({ className, ...props }, ref) => (
|
| 61 |
+
<ContextMenuPrimitive.Portal>
|
| 62 |
+
<ContextMenuPrimitive.Content
|
| 63 |
+
ref={ref}
|
| 64 |
+
className={cn(
|
| 65 |
+
"z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md animate-in fade-in-80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
|
| 66 |
+
className
|
| 67 |
+
)}
|
| 68 |
+
{...props}
|
| 69 |
+
/>
|
| 70 |
+
</ContextMenuPrimitive.Portal>
|
| 71 |
+
))
|
| 72 |
+
ContextMenuContent.displayName = ContextMenuPrimitive.Content.displayName
|
| 73 |
+
|
| 74 |
+
const ContextMenuItem = React.forwardRef<
|
| 75 |
+
React.ElementRef<typeof ContextMenuPrimitive.Item>,
|
| 76 |
+
React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Item> & {
|
| 77 |
+
inset?: boolean
|
| 78 |
+
}
|
| 79 |
+
>(({ className, inset, ...props }, ref) => (
|
| 80 |
+
<ContextMenuPrimitive.Item
|
| 81 |
+
ref={ref}
|
| 82 |
+
className={cn(
|
| 83 |
+
"relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
| 84 |
+
inset && "pl-8",
|
| 85 |
+
className
|
| 86 |
+
)}
|
| 87 |
+
{...props}
|
| 88 |
+
/>
|
| 89 |
+
))
|
| 90 |
+
ContextMenuItem.displayName = ContextMenuPrimitive.Item.displayName
|
| 91 |
+
|
| 92 |
+
const ContextMenuCheckboxItem = React.forwardRef<
|
| 93 |
+
React.ElementRef<typeof ContextMenuPrimitive.CheckboxItem>,
|
| 94 |
+
React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.CheckboxItem>
|
| 95 |
+
>(({ className, children, checked, ...props }, ref) => (
|
| 96 |
+
<ContextMenuPrimitive.CheckboxItem
|
| 97 |
+
ref={ref}
|
| 98 |
+
className={cn(
|
| 99 |
+
"relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
| 100 |
+
className
|
| 101 |
+
)}
|
| 102 |
+
checked={checked}
|
| 103 |
+
{...props}
|
| 104 |
+
>
|
| 105 |
+
<span className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
|
| 106 |
+
<ContextMenuPrimitive.ItemIndicator>
|
| 107 |
+
<Check className="h-4 w-4" />
|
| 108 |
+
</ContextMenuPrimitive.ItemIndicator>
|
| 109 |
+
</span>
|
| 110 |
+
{children}
|
| 111 |
+
</ContextMenuPrimitive.CheckboxItem>
|
| 112 |
+
))
|
| 113 |
+
ContextMenuCheckboxItem.displayName =
|
| 114 |
+
ContextMenuPrimitive.CheckboxItem.displayName
|
| 115 |
+
|
| 116 |
+
const ContextMenuRadioItem = React.forwardRef<
|
| 117 |
+
React.ElementRef<typeof ContextMenuPrimitive.RadioItem>,
|
| 118 |
+
React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.RadioItem>
|
| 119 |
+
>(({ className, children, ...props }, ref) => (
|
| 120 |
+
<ContextMenuPrimitive.RadioItem
|
| 121 |
+
ref={ref}
|
| 122 |
+
className={cn(
|
| 123 |
+
"relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
| 124 |
+
className
|
| 125 |
+
)}
|
| 126 |
+
{...props}
|
| 127 |
+
>
|
| 128 |
+
<span className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
|
| 129 |
+
<ContextMenuPrimitive.ItemIndicator>
|
| 130 |
+
<Circle className="h-2 w-2 fill-current" />
|
| 131 |
+
</ContextMenuPrimitive.ItemIndicator>
|
| 132 |
+
</span>
|
| 133 |
+
{children}
|
| 134 |
+
</ContextMenuPrimitive.RadioItem>
|
| 135 |
+
))
|
| 136 |
+
ContextMenuRadioItem.displayName = ContextMenuPrimitive.RadioItem.displayName
|
| 137 |
+
|
| 138 |
+
const ContextMenuLabel = React.forwardRef<
|
| 139 |
+
React.ElementRef<typeof ContextMenuPrimitive.Label>,
|
| 140 |
+
React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Label> & {
|
| 141 |
+
inset?: boolean
|
| 142 |
+
}
|
| 143 |
+
>(({ className, inset, ...props }, ref) => (
|
| 144 |
+
<ContextMenuPrimitive.Label
|
| 145 |
+
ref={ref}
|
| 146 |
+
className={cn(
|
| 147 |
+
"px-2 py-1.5 text-sm font-semibold text-foreground",
|
| 148 |
+
inset && "pl-8",
|
| 149 |
+
className
|
| 150 |
+
)}
|
| 151 |
+
{...props}
|
| 152 |
+
/>
|
| 153 |
+
))
|
| 154 |
+
ContextMenuLabel.displayName = ContextMenuPrimitive.Label.displayName
|
| 155 |
+
|
| 156 |
+
const ContextMenuSeparator = React.forwardRef<
|
| 157 |
+
React.ElementRef<typeof ContextMenuPrimitive.Separator>,
|
| 158 |
+
React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Separator>
|
| 159 |
+
>(({ className, ...props }, ref) => (
|
| 160 |
+
<ContextMenuPrimitive.Separator
|
| 161 |
+
ref={ref}
|
| 162 |
+
className={cn("-mx-1 my-1 h-px bg-border", className)}
|
| 163 |
+
{...props}
|
| 164 |
+
/>
|
| 165 |
+
))
|
| 166 |
+
ContextMenuSeparator.displayName = ContextMenuPrimitive.Separator.displayName
|
| 167 |
+
|
| 168 |
+
const ContextMenuShortcut = ({
|
| 169 |
+
className,
|
| 170 |
+
...props
|
| 171 |
+
}: React.HTMLAttributes<HTMLSpanElement>) => {
|
| 172 |
+
return (
|
| 173 |
+
<span
|
| 174 |
+
className={cn(
|
| 175 |
+
"ml-auto text-xs tracking-widest text-muted-foreground",
|
| 176 |
+
className
|
| 177 |
+
)}
|
| 178 |
+
{...props}
|
| 179 |
+
/>
|
| 180 |
+
)
|
| 181 |
+
}
|
| 182 |
+
ContextMenuShortcut.displayName = "ContextMenuShortcut"
|
| 183 |
+
|
| 184 |
+
export {
|
| 185 |
+
ContextMenu,
|
| 186 |
+
ContextMenuTrigger,
|
| 187 |
+
ContextMenuContent,
|
| 188 |
+
ContextMenuItem,
|
| 189 |
+
ContextMenuCheckboxItem,
|
| 190 |
+
ContextMenuRadioItem,
|
| 191 |
+
ContextMenuLabel,
|
| 192 |
+
ContextMenuSeparator,
|
| 193 |
+
ContextMenuShortcut,
|
| 194 |
+
ContextMenuGroup,
|
| 195 |
+
ContextMenuPortal,
|
| 196 |
+
ContextMenuSub,
|
| 197 |
+
ContextMenuSubContent,
|
| 198 |
+
ContextMenuSubTrigger,
|
| 199 |
+
ContextMenuRadioGroup,
|
| 200 |
+
}
|