|
| 1 | +import { PlusOutlined } from '@ant-design/icons'; |
| 2 | +import { t, Trans } from '@lingui/macro'; |
| 3 | +import { Encounter } from 'fhir/r4b'; |
| 4 | + |
| 5 | +import { questionnaireAction, navigationAction, ResourceListPage } from '@beda.software/emr/components'; |
| 6 | +import { SearchBarColumnType } from '@beda.software/emr/dist/components/SearchBar/types'; |
| 7 | +import { formatPeriodDateTime } from '@beda.software/emr/utils'; |
| 8 | + |
| 9 | +export function EncountersUberList() { |
| 10 | + return ( |
| 11 | + <ResourceListPage<Encounter> |
| 12 | + headerTitle="Encounters" |
| 13 | + resourceType="Encounter" |
| 14 | + getTableColumns={() => [ |
| 15 | + { |
| 16 | + title: 'Practitioner', |
| 17 | + dataIndex: 'practitioner', |
| 18 | + key: 'practitioner', |
| 19 | + render: (_text: any, { resource }) => resource.participant?.[0]?.individual?.display, |
| 20 | + }, |
| 21 | + { |
| 22 | + title: 'Status', |
| 23 | + dataIndex: 'status', |
| 24 | + key: 'status', |
| 25 | + render: (_text: any, { resource }) => { |
| 26 | + return resource.status; |
| 27 | + }, |
| 28 | + }, |
| 29 | + { |
| 30 | + title: 'Date', |
| 31 | + dataIndex: 'date', |
| 32 | + key: 'date', |
| 33 | + width: 250, |
| 34 | + render: (_text: any, { resource }) => formatPeriodDateTime(resource.period), |
| 35 | + }, |
| 36 | + ]} |
| 37 | + getFilters={() => [ |
| 38 | + { |
| 39 | + id: 'name', |
| 40 | + searchParam: '_ilike', |
| 41 | + type: SearchBarColumnType.STRING, |
| 42 | + placeholder: t`Find encounter`, |
| 43 | + placement: ['search-bar', 'table'], |
| 44 | + }, |
| 45 | + { |
| 46 | + id: 'status', |
| 47 | + searchParam: 'status', |
| 48 | + type: SearchBarColumnType.CHOICE, |
| 49 | + placeholder: t`Choose status`, |
| 50 | + options: [ |
| 51 | + { |
| 52 | + value: { |
| 53 | + Coding: { |
| 54 | + code: 'in-progress', |
| 55 | + display: 'In progress', |
| 56 | + }, |
| 57 | + }, |
| 58 | + }, |
| 59 | + { |
| 60 | + value: { |
| 61 | + Coding: { |
| 62 | + code: 'finished', |
| 63 | + display: 'Finished', |
| 64 | + }, |
| 65 | + }, |
| 66 | + }, |
| 67 | + ], |
| 68 | + placement: ['table', 'search-bar'], |
| 69 | + }, |
| 70 | + ]} |
| 71 | + getRecordActions={(record) => [navigationAction('Open', `/`)]} |
| 72 | + getHeaderActions={() => [ |
| 73 | + questionnaireAction(<Trans>Create encounter</Trans>, 'encounter-create', { icon: <PlusOutlined /> }), |
| 74 | + ]} |
| 75 | + getBatchActions={() => [questionnaireAction(<Trans>Finish encounters</Trans>, '')]} |
| 76 | + getReportColumns={(bundle) => [ |
| 77 | + { |
| 78 | + title: t`Number of Encounters`, |
| 79 | + value: bundle.total, |
| 80 | + }, |
| 81 | + ]} |
| 82 | + /> |
| 83 | + ); |
| 84 | +} |
0 commit comments