diff --git a/apps/Frontend/src/components/claims/claim-form.tsx b/apps/Frontend/src/components/claims/claim-form.tsx index 5407d96..6777311 100644 --- a/apps/Frontend/src/components/claims/claim-form.tsx +++ b/apps/Frontend/src/components/claims/claim-form.tsx @@ -1,7 +1,7 @@ import { useState, useEffect } from "react"; import { Button } from "@/components/ui/button"; import { Input } from "@/components/ui/input"; -import { +import { Select, SelectContent, SelectItem, @@ -14,103 +14,145 @@ import { Label } from "@/components/ui/label"; import { X, Calendar as CalendarIcon } from "lucide-react"; import { useToast } from "@/hooks/use-toast"; import { Calendar } from "@/components/ui/calendar"; -import { Popover, PopoverContent, PopoverTrigger } from "@/components/ui/popover"; +import { + Popover, + PopoverContent, + PopoverTrigger, +} from "@/components/ui/popover"; import { PatientUncheckedCreateInputObjectSchema } from "@repo/db/usedSchemas"; -import {z} from "zod"; +import { z } from "zod"; +import { useQuery } from "@tanstack/react-query"; +import { apiRequest } from "@/lib/queryClient"; -const PatientSchema = (PatientUncheckedCreateInputObjectSchema as unknown as z.ZodObject).omit({ +const PatientSchema = ( + PatientUncheckedCreateInputObjectSchema as unknown as z.ZodObject +).omit({ appointments: true, }); type Patient = z.infer; -interface ClaimFormProps { - patientId: number; - appointmentId: number; - patientName: string; - onClose: () => void; - patientData?: Patient; +interface ServiceLine { + procedureCode: string; + toothNumber: string; + surface: string; + quad: string; + authNo: string; + billedAmount: string; } -export function ClaimForm({ - patientId, - appointmentId, - patientName, +interface ClaimFormProps { + patientId?: number; + extractedData?: Partial; + onSubmit: (claimData: any) => void; + onClose: () => void; +} + +export function ClaimForm({ + patientId, + extractedData, + onSubmit, onClose, - patientData }: ClaimFormProps) { const { toast } = useToast(); - const [patient, setPatient] = useState(null); - const [loading, setLoading] = useState(false); - const [serviceDateValue, setServiceDateValue] = useState(new Date()); - const [serviceDate, setServiceDate] = useState(format(new Date(), 'MM/dd/yy')); - const [clinicalNotes, setClinicalNotes] = useState(''); - - // Fetch patient data if not provided + + // Query patient if patientId provided + const { data: fetchedPatient, isLoading, error } = useQuery({ + queryKey: ["/api/patients/", patientId], + queryFn: async () => { + const res = await apiRequest("GET", `/api/patients/${patientId}`); + if (!res.ok) throw new Error("Failed to fetch patient"); + return res.json(); + }, + enabled: !!patientId, + }); + + // Patient state - initialize from extractedData or null (new patient) + const [patient, setPatient] = useState( + extractedData ? ({ ...extractedData } as Patient) : null + ); + + // Sync fetched patient when available useEffect(() => { - if (patientData) { - setPatient(patientData); - return; + if (fetchedPatient) { + setPatient(fetchedPatient); } - - const fetchPatient = async () => { - try { - setLoading(true); - const response = await fetch(`/api/patients/${patientId}`); - if (!response.ok) { - throw new Error("Failed to fetch patient data"); - } - const data = await response.json(); - setPatient(data); - } catch (error) { - console.error("Error fetching patient:", error); - toast({ - title: "Error", - description: "Failed to load patient information", - variant: "destructive", - }); - } finally { - setLoading(false); + }, [fetchedPatient]); + + + // Service date state + const [serviceDateValue, setServiceDateValue] = useState(new Date()); + const [serviceDate, setServiceDate] = useState(format(new Date(), "MM/dd/yy")); + + // Clinical notes state + const [clinicalNotes, setClinicalNotes] = useState(""); + + // Doctor selection state + const [doctor, setDoctor] = useState("doctor1"); + + // Service lines state with one empty default line + const [serviceLines, setServiceLines] = useState([ + { + procedureCode: "", + toothNumber: "", + surface: "", + quad: "", + authNo: "", + billedAmount: "", + }, + ]); + + // Update a field in serviceLines at index + const updateServiceLine = ( + index: number, + field: keyof ServiceLine, + value: string + ) => { + setServiceLines((prev) => { + const updated = [...prev]; + if (updated[index]) { + updated[index][field] = value; } - }; - - if (patientId) { - fetchPatient(); - } - }, [patientId, patientData, toast]); + return updated; + }); + }; + // Handle patient field changes (to make inputs controlled and editable) + const updatePatientField = (field: keyof Patient, value: any) => { + setPatient((prev) => (prev ? { ...prev, [field]: value } : null)); + }; // Update service date when calendar date changes const onServiceDateChange = (date: Date | undefined) => { if (date) { setServiceDateValue(date); - setServiceDate(format(date, 'MM/dd/yy')); + setServiceDate(format(date, "MM/dd/yy")); } }; // Determine patient date of birth format const formatDOB = (dob: string | undefined) => { - if (!dob) return ''; - - // If already in MM/DD/YYYY format, return as is - if (/^\d{2}\/\d{2}\/\d{4}$/.test(dob)) { - return dob; - } - - // If in YYYY-MM-DD format, convert to MM/DD/YYYY - if (/^\d{4}-\d{2}-\d{2}$/.test(dob)) { - const [year, month, day] = dob.split('-'); - return `${month}/${day}/${year}`; - } - - return dob; - }; + if (!dob) return ""; + + if (/^\d{2}\/\d{2}\/\d{4}$/.test(dob)) return dob; // already MM/DD/YYYY + + if (/^\d{4}-\d{2}-\d{2}/.test(dob)) { + const datePart = dob?.split("T")[0]; // safe optional chaining + if (!datePart) return ""; + const [year, month, day] = datePart.split("-"); + return `${month}/${day}/${year}`; + } + + return dob; +}; return (
- Insurance Claim Form + + Insurance Claim Form + @@ -121,52 +163,56 @@ export function ClaimForm({
- updatePatientField("insuranceId", e.target.value)} + disabled={isLoading} />
- updatePatientField("dateOfBirth", e.target.value)} + disabled={isLoading} />
- updatePatientField("firstName", e.target.value)} + disabled={isLoading} />
- updatePatientField("lastName", e.target.value)} + disabled={isLoading} />
- - {/* Clinical Notes Entry */}
- - + Clinical Notes: + + setClinicalNotes(e.target.value)} /> -
@@ -295,7 +370,10 @@ export function ClaimForm({ {/* File Upload Section */}
-

Please note that file types with 4 or more character extensions are not allowed, such as .DOCX, .PPTX, or .XLSX

+

+ Please note that file types with 4 or more character + extensions are not allowed, such as .DOCX, .PPTX, or .XLSX +

@@ -304,7 +382,9 @@ export function ClaimForm({ - Support Data for Claim + + Support Data for Claim + X-Ray Images Clinical Photos @@ -317,18 +397,24 @@ export function ClaimForm({ {/* Insurance Carriers */}
-

Insurance Carriers

+

+ Insurance Carriers +

- - - + + +
- -
); -} \ No newline at end of file +} diff --git a/apps/Frontend/src/pages/claims-page.tsx b/apps/Frontend/src/pages/claims-page.tsx index 1c6dd4a..fdd246c 100644 --- a/apps/Frontend/src/pages/claims-page.tsx +++ b/apps/Frontend/src/pages/claims-page.tsx @@ -1,16 +1,20 @@ import { useState, useEffect } from "react"; -import { useQuery } from "@tanstack/react-query"; +import { useMutation, useQuery } from "@tanstack/react-query"; import { TopAppBar } from "@/components/layout/top-app-bar"; import { Sidebar } from "@/components/layout/sidebar"; import { Card, CardHeader, CardTitle, CardContent } from "@/components/ui/card"; import { ClaimForm } from "@/components/claims/claim-form"; import { useToast } from "@/hooks/use-toast"; import { useAuth } from "@/hooks/use-auth"; -import { PatientUncheckedCreateInputObjectSchema, AppointmentUncheckedCreateInputObjectSchema } from "@repo/db/usedSchemas"; -import { Plus, FileCheck, CheckCircle, Clock, AlertCircle } from "lucide-react"; +import { + PatientUncheckedCreateInputObjectSchema, + AppointmentUncheckedCreateInputObjectSchema, +} from "@repo/db/usedSchemas"; +import { FileCheck, CheckCircle, Clock, AlertCircle } from "lucide-react"; import { format } from "date-fns"; -import {z} from "zod"; -import { apiRequest } from "@/lib/queryClient"; +import { z } from "zod"; +import { apiRequest, queryClient } from "@/lib/queryClient"; +import { useLocation } from "wouter"; //creating types out of schema auto generated. type Appointment = z.infer; @@ -60,40 +64,127 @@ const updatePatientSchema = ( type UpdatePatient = z.infer; +function getQueryParams() { + const search = window.location.search; + const params = new URLSearchParams(search); + return { + name: params.get("name") || "", + memberId: params.get("memberId") || "", + dob: params.get("dob") || "", + }; +} export default function ClaimsPage() { const [isMobileMenuOpen, setIsMobileMenuOpen] = useState(false); const [isClaimFormOpen, setIsClaimFormOpen] = useState(false); const [selectedPatient, setSelectedPatient] = useState(null); - const [selectedAppointment, setSelectedAppointment] = useState(null); - + const [selectedAppointment, setSelectedAppointment] = useState( + null + ); const { toast } = useToast(); const { user } = useAuth(); + const [claimFormData, setClaimFormData] = useState({ + patientId: null, + carrier: "", + doctorName: "", + serviceDate: "", + clinicalNotes: "", + serviceLines: [], + }); // Fetch patients const { data: patients = [], isLoading: isLoadingPatients } = useQuery< - Patient[] - >({ - queryKey: ["/api/patients/"], - queryFn: async () => { - const res = await apiRequest("GET", "/api/patients/"); - return res.json(); - }, - enabled: !!user, - }); - + Patient[] + >({ + queryKey: ["/api/patients/"], + queryFn: async () => { + const res = await apiRequest("GET", "/api/patients/"); + return res.json(); + }, + enabled: !!user, + }); + // Fetch appointments const { - data: appointments = [] as Appointment[], - isLoading: isLoadingAppointments, - } = useQuery({ - queryKey: ["/api/appointments/all"], - queryFn: async () => { - const res = await apiRequest("GET", "/api/appointments/all"); - return res.json(); - }, - enabled: !!user, - }); + data: appointments = [] as Appointment[], + isLoading: isLoadingAppointments, + } = useQuery({ + queryKey: ["/api/appointments/all"], + queryFn: async () => { + const res = await apiRequest("GET", "/api/appointments/all"); + return res.json(); + }, + enabled: !!user, + }); + + // Add patient mutation + const addPatientMutation = useMutation({ + mutationFn: async (patient: InsertPatient) => { + const res = await apiRequest("POST", "/api/patients/", patient); + return res.json(); + }, + onSuccess: (newPatient) => { + queryClient.invalidateQueries({ queryKey: ["/api/patients/"] }); + toast({ + title: "Success", + description: "Patient added successfully!", + variant: "default", + }); + }, + onError: (error) => { + toast({ + title: "Error", + description: `Failed to add patient: ${error.message}`, + variant: "destructive", + }); + }, + }); + + // Create appointment mutation + const createAppointmentMutation = useMutation({ + mutationFn: async (appointment: InsertAppointment) => { + const res = await apiRequest("POST", "/api/appointments/", appointment); + return await res.json(); + }, + onSuccess: () => { + toast({ + title: "Success", + description: "Appointment created successfully.", + }); + // Invalidate both appointments and patients queries + queryClient.invalidateQueries({ queryKey: ["/api/appointments/all"] }); + queryClient.invalidateQueries({ queryKey: ["/api/patients/"] }); + }, + onError: (error: Error) => { + toast({ + title: "Error", + description: `Failed to create appointment: ${error.message}`, + variant: "destructive", + }); + }, + }); + + const createClaimMutation = useMutation({ + mutationFn: async (claimData: any) => { + const res = await apiRequest("POST", "/api/claims/", claimData); + return res.json(); + }, + onSuccess: () => { + toast({ + title: "Claim submitted successfully", + variant: "default", + }); + closeClaim(); + // optionally refetch claims or appointments if needed + }, + onError: (error: any) => { + toast({ + title: "Error submitting claim", + description: error.message, + variant: "destructive", + }); + }, + }); const toggleMobileMenu = () => { setIsMobileMenuOpen(!isMobileMenuOpen); @@ -111,100 +202,182 @@ export default function ClaimsPage() { setSelectedAppointment(null); }; - // Get unique patients with appointments - const patientsWithAppointments = appointments.reduce((acc, appointment) => { - if (!acc.some(item => item.patientId === appointment.patientId)) { - const patient = patients.find(p => p.id === appointment.patientId); - if (patient) { - acc.push({ - patientId: patient.id, - patientName: `${patient.firstName} ${patient.lastName}`, - appointmentId: Number(appointment.id), - insuranceProvider: patient.insuranceProvider || 'N/A', - insuranceId: patient.insuranceId || 'N/A', - lastAppointment: String(appointment.date) + const { name, memberId, dob } = getQueryParams(); + const prefillClaimForm = (patient: Patient) => { + setClaimFormData((prev: any) => ({ + ...prev, + patientId: patient.id, + carrier: patient.insuranceProvider || "", + doctorName: user?.username || "", + serviceDate: new Date().toISOString().slice(0, 10), + clinicalNotes: "", + serviceLines: [], + })); + }; + + + useEffect(() => { + if (memberId && dob) { + const matchingPatient = patients.find( + (p) => + p.insuranceId?.toLowerCase().trim() === memberId.toLowerCase().trim() + ); + + if (matchingPatient) { + setSelectedPatient(matchingPatient.id); + prefillClaimForm(matchingPatient); + setIsClaimFormOpen(true); + } else { + const [firstName, ...rest] = name.trim().split(" "); + const lastName = rest.join(" ") || ""; + + const newPatient: InsertPatient = { + firstName, + lastName, + dateOfBirth: new Date(dob), + gender: "unknown", + phone: "000-000-0000", + userId: user?.id ?? 1, + insuranceId: memberId, + }; + + addPatientMutation.mutate(newPatient, { + onSuccess: (created) => { + setSelectedPatient(created.id); + prefillClaimForm(created); + setIsClaimFormOpen(true); + }, }); } } - return acc; - }, [] as Array<{ - patientId: number; - patientName: string; - appointmentId: number; - insuranceProvider: string; - insuranceId: string; - lastAppointment: string; - }>); + }, [memberId, dob, patients]); + + function handleClaimSubmit(claimData: any) { + createClaimMutation.mutate(claimData); + } + + // Get unique patients with appointments + const patientsWithAppointments = appointments.reduce( + (acc, appointment) => { + if (!acc.some((item) => item.patientId === appointment.patientId)) { + const patient = patients.find((p) => p.id === appointment.patientId); + if (patient) { + acc.push({ + patientId: patient.id, + patientName: `${patient.firstName} ${patient.lastName}`, + appointmentId: Number(appointment.id), + insuranceProvider: patient.insuranceProvider || "N/A", + insuranceId: patient.insuranceId || "N/A", + lastAppointment: String(appointment.date), + }); + } + } + return acc; + }, + [] as Array<{ + patientId: number; + patientName: string; + appointmentId: number; + insuranceProvider: string; + insuranceId: string; + lastAppointment: string; + }> + ); return (
- - + +
- +
{/* Header */}
-

Insurance Claims

-

Manage and submit insurance claims for patients

+

+ Insurance Claims +

+

+ Manage and submit insurance claims for patients +

{/* New Claims Section */}
-
{ if (patientsWithAppointments.length > 0) { const firstPatient = patientsWithAppointments[0]; - handleNewClaim(Number(firstPatient?.patientId), Number(firstPatient?.appointmentId)); + handleNewClaim( + Number(firstPatient?.patientId), + Number(firstPatient?.appointmentId) + ); } else { toast({ title: "No patients available", - description: "There are no patients with appointments to create a claim", + description: + "There are no patients with appointments to create a claim", }); } }} > -

New Claims

+

+ New Claims +

- + Recent Patients for Claims {isLoadingPatients || isLoadingAppointments ? ( -
Loading patients data...
+
+ Loading patients data... +
) : patientsWithAppointments.length > 0 ? (
{patientsWithAppointments.map((item) => ( -
handleNewClaim(item.patientId, item.appointmentId)} + onClick={() => + handleNewClaim(item.patientId, item.appointmentId) + } >

{item.patientName}

- Insurance: {item.insuranceProvider === 'delta' - ? 'Delta Dental' - : item.insuranceProvider === 'metlife' - ? 'MetLife' - : item.insuranceProvider === 'cigna' - ? 'Cigna' - : item.insuranceProvider === 'aetna' - ? 'Aetna' - : item.insuranceProvider} + + Insurance:{" "} + {item.insuranceProvider === "delta" + ? "Delta Dental" + : item.insuranceProvider === "metlife" + ? "MetLife" + : item.insuranceProvider === "cigna" + ? "Cigna" + : item.insuranceProvider === "aetna" + ? "Aetna" + : item.insuranceProvider} + ID: {item.insuranceId} - Last Visit: {new Date(item.lastAppointment).toLocaleDateString()} + + Last Visit:{" "} + {new Date( + item.lastAppointment + ).toLocaleDateString()} +
@@ -216,100 +389,30 @@ export default function ClaimsPage() { ) : (
-

No eligible patients for claims

+

+ No eligible patients for claims +

- Patients with appointments will appear here for insurance claim processing + Patients with appointments will appear here for insurance + claim processing

)}
- - {/* Old Claims Section */} -
-
-

Old Claims

-
- - - - Submitted Claims History - - - {/* Sample Old Claims */} -
- {patientsWithAppointments.slice(0, 3).map((item, index) => ( -
toast({ - title: "Claim Details", - description: `Viewing details for claim #${2000 + index}` - })} - > -
-

{item.patientName}

-
- Claim #: {2000 + index} - - Submitted: {format(new Date(new Date().setDate(new Date().getDate() - (index * 15))), 'MMM dd, yyyy')} - - Amount: ${(Math.floor(Math.random() * 500) + 100).toFixed(2)} -
-
-
- - {index === 0 ? ( - - - Pending - - ) : index === 1 ? ( - - - Approved - - ) : ( - - - Review - - )} - -
-
- ))} - - {patientsWithAppointments.length === 0 && ( -
- -

No claim history

-

- Submitted insurance claims will appear here -

-
- )} -
-
-
-
{/* Claim Form Modal */} - {isClaimFormOpen && selectedPatient !== null && selectedAppointment !== null && ( + {isClaimFormOpen && selectedPatient !== null && ( )}
); -} \ No newline at end of file +} diff --git a/apps/Frontend/src/pages/dashboard.tsx b/apps/Frontend/src/pages/dashboard.tsx index a597bf0..56310bc 100644 --- a/apps/Frontend/src/pages/dashboard.tsx +++ b/apps/Frontend/src/pages/dashboard.tsx @@ -1,6 +1,6 @@ import { useState, useRef } from "react"; import { useQuery, useMutation } from "@tanstack/react-query"; -import { format, parse, parseISO } from "date-fns"; +import { format, parse, isValid, parseISO } from "date-fns"; import { TopAppBar } from "@/components/layout/top-app-bar"; import { Sidebar } from "@/components/layout/sidebar"; import { StatCard } from "@/components/ui/stat-card"; @@ -14,8 +14,8 @@ import { useAuth } from "@/hooks/use-auth"; import { apiRequest, queryClient } from "@/lib/queryClient"; import { AppointmentsByDay } from "@/components/analytics/appointments-by-day"; import { NewPatients } from "@/components/analytics/new-patients"; -import { AppointmentUncheckedCreateInputObjectSchema } from '@repo/db/usedSchemas'; -import { PatientUncheckedCreateInputObjectSchema } from '@repo/db/usedSchemas'; +import { AppointmentUncheckedCreateInputObjectSchema } from "@repo/db/usedSchemas"; +import { PatientUncheckedCreateInputObjectSchema } from "@repo/db/usedSchemas"; import { Users, @@ -630,15 +630,26 @@ export default function Dashboard() {

- Date of Birth:{" "} - Date of Birth:{" "} - {format( - parse( - currentPatient.dateOfBirth, - "yyyy-MM-dd", - new Date() - ), - "PPP" + {currentPatient.dateOfBirth ? ( + (() => { + const dobDate = parseISO(currentPatient.dateOfBirth); + return isValid(dobDate) ? ( + + + Date of Birth: + {" "} + {format(dobDate, "PPP")} + + ) : ( + + Date of Birth: N/A + + ); + })() + ) : ( + + Date of Birth: N/A + )}

diff --git a/apps/Frontend/src/pages/patients-page.tsx b/apps/Frontend/src/pages/patients-page.tsx index b3e210c..82aa486 100644 --- a/apps/Frontend/src/pages/patients-page.tsx +++ b/apps/Frontend/src/pages/patients-page.tsx @@ -32,6 +32,7 @@ import { DialogTitle, } from "@/components/ui/dialog"; import useExtractPdfData from "@/hooks/use-extractPdfData"; +import { useLocation } from "wouter"; const PatientSchema = ( PatientUncheckedCreateInputObjectSchema as unknown as z.ZodObject @@ -86,9 +87,13 @@ export default function PatientsPage() { const [uploadedFile, setUploadedFile] = useState(null); const [isUploading, setIsUploading] = useState(false); const [isExtracting, setIsExtracting] = useState(false); - const [formData, setFormData] = useState({ PatientName: "", PatientMemberId: "", PatientDob:"" }); - const { mutate: extractPdf} = useExtractPdfData(); - + const [formData, setFormData] = useState({ + PatientName: "", + PatientMemberId: "", + PatientDob: "", + }); + const { mutate: extractPdf } = useExtractPdfData(); + const [location, navigate] = useLocation(); // Fetch patients const { @@ -244,7 +249,10 @@ export default function PatientsPage() { } }; - const isLoading = isLoadingPatients || addPatientMutation.isPending || updatePatientMutation.isPending; + const isLoading = + isLoadingPatients || + addPatientMutation.isPending || + updatePatientMutation.isPending; // Search handling const handleSearch = (criteria: SearchCriteria) => { @@ -291,10 +299,9 @@ export default function PatientsPage() { }); }, [patients, searchCriteria]); - // File upload handling const handleFileUpload = (file: File) => { - setIsUploading(true); + setIsUploading(true); setUploadedFile(file); toast({ @@ -307,13 +314,13 @@ export default function PatientsPage() { }; // data extraction - const handleExtract = () =>{ + const handleExtract = () => { setIsExtracting(true); - if (!uploadedFile){ - return toast({ + if (!uploadedFile) { + return toast({ title: "Error", - description:"Please upload a PDF", + description: "Please upload a PDF", variant: "destructive", }); } @@ -322,17 +329,24 @@ export default function PatientsPage() { setIsExtracting(false); toast({ - title: "Success Pdf Data Extracted", - description: `Name: ${data.name}, Member ID: ${data.memberId}, DOB: ${data.dob}`, - variant: "default", - }); + title: "Success Pdf Data Extracted", + description: `Name: ${data.name}, Member ID: ${data.memberId}, DOB: ${data.dob}`, + variant: "default", + }); - setFormData({ PatientName: data.name || "", PatientMemberId: data.memberId || "", PatientDob: data.dob || ""}); + const params = new URLSearchParams({ + name: data.name, + memberId: data.memberId, + dob: data.dob, + }); + + navigate( + `/claims?name=${encodeURIComponent(data.name)}&memberId=${data.memberId}&dob=${data.dob}` + ); }, }); - }; - + return (

{/* View Patient Modal */} - - - - Patient Details - - Complete information about the patient. - - - - {currentPatient && ( -
-
-
- {currentPatient.firstName.charAt(0)} - {currentPatient.lastName.charAt(0)} -
-
-

- {currentPatient.firstName} {currentPatient.lastName} -

-

- Patient ID: {currentPatient.id.toString().padStart(4, "0")} -

-
-
- -
-
-

- Personal Information -

-
-

- Date of Birth:{" "} - {new Date( - currentPatient.dateOfBirth - ).toLocaleDateString()} -

-

- Gender:{" "} - {currentPatient.gender.charAt(0).toUpperCase() + - currentPatient.gender.slice(1)} -

-

- Status:{" "} - - {currentPatient.status.charAt(0).toUpperCase() + - currentPatient.status.slice(1)} - -

-
-
- -
-

- Contact Information -

-
-

- Phone:{" "} - {currentPatient.phone} -

-

- Email:{" "} - {currentPatient.email || "N/A"} -

-

- Address:{" "} - {currentPatient.address ? ( - <> - {currentPatient.address} - {currentPatient.city && `, ${currentPatient.city}`} - {currentPatient.zipCode && - ` ${currentPatient.zipCode}`} - - ) : ( - "N/A" - )} -

-
-
- -
-

Insurance

-
-

- Provider:{" "} - {currentPatient.insuranceProvider - ? currentPatient.insuranceProvider === "delta" - ? "Delta Dental" - : currentPatient.insuranceProvider === "metlife" - ? "MetLife" - : currentPatient.insuranceProvider === "cigna" - ? "Cigna" - : currentPatient.insuranceProvider === "aetna" - ? "Aetna" - : currentPatient.insuranceProvider - : "N/A"} -

-

- ID:{" "} - {currentPatient.insuranceId || "N/A"} -

-

- Group Number:{" "} - {currentPatient.groupNumber || "N/A"} -

-

- Policy Holder:{" "} - {currentPatient.policyHolder || "Self"} -

-
-
- -
-

- Medical Information -

-
-

- Allergies:{" "} - {currentPatient.allergies || "None reported"} -

-

- Medical Conditions:{" "} - {currentPatient.medicalConditions || "None reported"} -

-
-
-
- -
- - -
+ {currentPatient.status.charAt(0).toUpperCase() + + currentPatient.status.slice(1)} + +

- )} -
-
- - +
+ +
+

+ Contact Information +

+
+

+ Phone:{" "} + {currentPatient.phone} +

+

+ Email:{" "} + {currentPatient.email || "N/A"} +

+

+ Address:{" "} + {currentPatient.address ? ( + <> + {currentPatient.address} + {currentPatient.city && + `, ${currentPatient.city}`} + {currentPatient.zipCode && + ` ${currentPatient.zipCode}`} + + ) : ( + "N/A" + )} +

+
+
+ +
+

Insurance

+
+

+ Provider:{" "} + {currentPatient.insuranceProvider + ? currentPatient.insuranceProvider === "delta" + ? "Delta Dental" + : currentPatient.insuranceProvider === "metlife" + ? "MetLife" + : currentPatient.insuranceProvider === "cigna" + ? "Cigna" + : currentPatient.insuranceProvider === + "aetna" + ? "Aetna" + : currentPatient.insuranceProvider + : "N/A"} +

+

+ ID:{" "} + {currentPatient.insuranceId || "N/A"} +

+

+ Group Number:{" "} + {currentPatient.groupNumber || "N/A"} +

+

+ + Policy Holder: + {" "} + {currentPatient.policyHolder || "Self"} +

+
+
+ +
+

+ Medical Information +

+
+

+ Allergies:{" "} + {currentPatient.allergies || "None reported"} +

+

+ + Medical Conditions: + {" "} + {currentPatient.medicalConditions || + "None reported"} +

+
+
+
+ +
+ + +
+
+ )} + + + {/* Add/Edit Patient Modal */}