Skip to content

Commit

Permalink
WIP table level2
Browse files Browse the repository at this point in the history
  • Loading branch information
ir4y committed Jan 21, 2025
1 parent 96d2420 commit 5bd579b
Showing 1 changed file with 36 additions and 3 deletions.
39 changes: 36 additions & 3 deletions src/containers/PatientDetails/new.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,46 @@
import { Patient } from 'fhir/r4b';
import { Encounter, Patient } from 'fhir/r4b';

import { PatientEncounter } from 'src/components';
import { ResourceListPage } from 'src/components';
import { DetailPage, Tab } from 'src/uberComponents/DetailPage';
import { compileAsFirst } from 'src/utils';

import { PatientOverview } from './PatientOverviewDynamic';

const getName = compileAsFirst<Patient, string>("Patient.name.given.first() + ' ' + Patient.name.family");

function PatientEncounter({ patient }: { patient: Patient }) {
return (
<ResourceListPage<Encounter>
headerTitle="Encounters"
resourceType="Encounter"
searchParams={{ patient: patient.id! }}
getTableColumns={() => [
{
title: 'Practitioner',
dataIndex: 'practitioner',
key: 'practitioner',
render: (_text: any, { resource }) => JSON.stringify(resource.participant),
},
{
title: 'Status',
dataIndex: 'status',
key: 'status',
render: (_text: any, { resource }) => {
return resource.status;
},
},
{
title: 'Date',
dataIndex: 'date',
key: 'date',
width: 250,
render: (_text: any, { resource }) => JSON.stringify(resource.period),
},
]}
/>
);
}

const tabs: Array<Tab<Patient>> = [
{
path: '',
Expand All @@ -26,7 +59,7 @@ export function NewPatientDetails() {
<DetailPage<Patient>
resourceType="Patient"
getSearchParams={({ id }) => ({ _id: id })}
getTitle={({ resource }) => getName(resource)!}
getTitle={({ resource, bundle }) => getName(resource, { bundle })!}
tabs={tabs}
basePath="patients2"
/>
Expand Down

0 comments on commit 5bd579b

Please sign in to comment.