Skip to main content
Glama
PatientPage.tsx1.55 kB
// SPDX-FileCopyrightText: Copyright Orangebot, Inc. and Medplum contributors // SPDX-License-Identifier: Apache-2.0 import { Grid, Loader, Paper } from '@mantine/core'; import type { Patient } from '@medplum/fhirtypes'; import { PatientSummary, useMedplum } from '@medplum/react'; import { useEffect, useState } from 'react'; import type { JSX } from 'react'; import { useParams } from 'react-router'; import { PatientDetails } from '../components/PatientDetails'; export function PatientPage(): JSX.Element { const medplum = useMedplum(); const { id } = useParams(); const [patient, setPatient] = useState<Patient | undefined>(); useEffect(() => { const fetchPatient = async (): Promise<void> => { if (!id) { return; } try { // Search for the patient. const patientData = await medplum.readResource('Patient', id); setPatient(patientData); } catch (error) { console.error(error); } }; fetchPatient().catch((error) => console.error(error)); }); const onPatientChange = (updatedPatient: Patient): void => { // Re-render when the patient is updated setPatient(updatedPatient); }; if (!patient) { return <Loader />; } return ( <Grid> <Grid.Col span={5}> <Paper> <PatientSummary patient={patient} /> </Paper> </Grid.Col> <Grid.Col span={7}> <Paper> <PatientDetails patient={patient} onChange={onPatientChange} /> </Paper> </Grid.Col> </Grid> ); }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/medplum/medplum'

If you have feedback or need assistance with the MCP directory API, please join our Discord server