feat: MassHealth service history extraction, shown in Patient Details
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -51,6 +51,15 @@ import {
|
||||
type PatientDocument
|
||||
} from "@/lib/api/documents";
|
||||
|
||||
interface ServiceHistoryRow {
|
||||
id: number;
|
||||
procedureCode: string;
|
||||
description: string | null;
|
||||
toothQuadArchSurface: string | null;
|
||||
placeOfService: string | null;
|
||||
serviceDate: string | null;
|
||||
}
|
||||
|
||||
interface PatientApiResponse {
|
||||
patients: Patient[];
|
||||
totalCount: number;
|
||||
@@ -707,6 +716,16 @@ export function PatientTable({
|
||||
}
|
||||
};
|
||||
|
||||
const { data: serviceHistory = [], isLoading: isServiceHistoryLoading } = useQuery<ServiceHistoryRow[]>({
|
||||
queryKey: ["patient-service-history", currentPatient?.id],
|
||||
queryFn: async () => {
|
||||
const res = await apiRequest("GET", `/api/patients/${currentPatient?.id}/service-history`);
|
||||
if (!res.ok) throw new Error("Failed to load service history");
|
||||
return res.json();
|
||||
},
|
||||
enabled: isViewPatientOpen && !!currentPatient?.id,
|
||||
});
|
||||
|
||||
const searchKeyPart = debouncedSearchCriteria?.searchTerm || "recent";
|
||||
|
||||
const {
|
||||
@@ -1197,7 +1216,7 @@ export function PatientTable({
|
||||
|
||||
{/* View Patient Modal */}
|
||||
<Dialog open={isViewPatientOpen} onOpenChange={setIsViewPatientOpen}>
|
||||
<DialogContent className="sm:max-w-[600px]">
|
||||
<DialogContent className="sm:max-w-[800px] max-h-[90vh] overflow-y-auto">
|
||||
<DialogHeader>
|
||||
<DialogTitle>Patient Details</DialogTitle>
|
||||
<DialogDescription>
|
||||
@@ -1348,6 +1367,40 @@ export function PatientTable({
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="pt-4">
|
||||
<h4 className="font-medium text-gray-900">Service History</h4>
|
||||
{isServiceHistoryLoading ? (
|
||||
<p className="mt-2 text-gray-500">Loading...</p>
|
||||
) : serviceHistory.length === 0 ? (
|
||||
<p className="mt-2 text-gray-500">
|
||||
No service history on file. It is saved when MH eligibility is checked.
|
||||
</p>
|
||||
) : (
|
||||
<Table className="mt-2">
|
||||
<TableHeader>
|
||||
<TableRow>
|
||||
<TableHead>Procedure Code</TableHead>
|
||||
<TableHead>Procedure Code Description</TableHead>
|
||||
<TableHead>Tooth/Quad/Arch/Surface</TableHead>
|
||||
<TableHead>Place of Service</TableHead>
|
||||
<TableHead>Service Date</TableHead>
|
||||
</TableRow>
|
||||
</TableHeader>
|
||||
<TableBody>
|
||||
{serviceHistory.map((row) => (
|
||||
<TableRow key={row.id}>
|
||||
<TableCell>{row.procedureCode}</TableCell>
|
||||
<TableCell>{row.description}</TableCell>
|
||||
<TableCell>{row.toothQuadArchSurface}</TableCell>
|
||||
<TableCell>{row.placeOfService}</TableCell>
|
||||
<TableCell>{row.serviceDate}</TableCell>
|
||||
</TableRow>
|
||||
))}
|
||||
</TableBody>
|
||||
</Table>
|
||||
)}
|
||||
</div>
|
||||
|
||||
<div className="flex justify-end space-x-2 pt-4">
|
||||
<Button
|
||||
variant="outline"
|
||||
|
||||
Reference in New Issue
Block a user