Skip to content

Commit c6d6a0f

Browse files
committed
Add 8 uber components
1 parent a32a2a9 commit c6d6a0f

13 files changed

Lines changed: 574 additions & 9 deletions

File tree

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
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+
}
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
import { PlusOutlined } from '@ant-design/icons';
2+
import { t, Trans } from '@lingui/macro';
3+
import { Immunization } 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+
8+
export function ImmunizationsUberList() {
9+
return (
10+
<ResourceListPage<Immunization>
11+
headerTitle="Immunizations"
12+
resourceType="Immunization"
13+
getTableColumns={() => [
14+
{
15+
title: 'Status',
16+
dataIndex: 'status',
17+
key: 'status',
18+
render: (_text: any, { resource }) => {
19+
return resource.status;
20+
},
21+
},
22+
]}
23+
getFilters={() => [
24+
{
25+
id: 'status',
26+
searchParam: 'status',
27+
type: SearchBarColumnType.CHOICE,
28+
placeholder: t`Choose status`,
29+
options: [
30+
{
31+
value: {
32+
Coding: {
33+
code: 'completed ',
34+
display: 'Completed',
35+
},
36+
},
37+
},
38+
{
39+
value: {
40+
Coding: {
41+
code: ' entered-in-error ',
42+
display: 'Entered-in-error ',
43+
},
44+
},
45+
},
46+
{
47+
value: {
48+
Coding: {
49+
code: ' not-done ',
50+
display: 'Not-done',
51+
},
52+
},
53+
},
54+
],
55+
placement: ['table', 'search-bar'],
56+
},
57+
]}
58+
getRecordActions={(record) => [navigationAction('Open', `/`)]}
59+
getHeaderActions={() => [
60+
questionnaireAction(<Trans>Create immunization</Trans>, 'immunization-create', {
61+
icon: <PlusOutlined />,
62+
}),
63+
]}
64+
getBatchActions={() => [questionnaireAction(<Trans>Finish immunization</Trans>, '')]}
65+
getReportColumns={(bundle) => [
66+
{
67+
title: t`Number of Iimmunizations`,
68+
value: bundle.total,
69+
},
70+
]}
71+
/>
72+
);
73+
}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
import { PlusOutlined } from '@ant-design/icons';
2+
import { t, Trans } from '@lingui/macro';
3+
import { Medication } from 'fhir/r4b';
4+
5+
import { questionnaireAction, navigationAction, ResourceListPage } from '@beda.software/emr/components';
6+
7+
export function MedicationsUberList() {
8+
return (
9+
<ResourceListPage<Medication>
10+
headerTitle="Observations"
11+
resourceType="Medication"
12+
getTableColumns={() => [
13+
{
14+
title: 'Status',
15+
dataIndex: 'status',
16+
key: 'status',
17+
render: (_text: any, { resource }) => {
18+
return resource.status;
19+
},
20+
},
21+
]}
22+
getRecordActions={(record) => [navigationAction('Open', `/`)]}
23+
getHeaderActions={() => [
24+
questionnaireAction(<Trans>Create medication</Trans>, 'medication-create', {
25+
icon: <PlusOutlined />,
26+
}),
27+
]}
28+
getBatchActions={() => [questionnaireAction(<Trans>Finish Medication</Trans>, '')]}
29+
getReportColumns={(bundle) => [
30+
{
31+
title: t`Number of Medication`,
32+
value: bundle.total,
33+
},
34+
]}
35+
/>
36+
);
37+
}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
import { PlusOutlined } from '@ant-design/icons';
2+
import { t, Trans } from '@lingui/macro';
3+
import { Observation } from 'fhir/r4b';
4+
5+
import { questionnaireAction, navigationAction, ResourceListPage } from '@beda.software/emr/components';
6+
7+
export function ObservationsUberList() {
8+
return (
9+
<ResourceListPage<Observation>
10+
headerTitle="Observations"
11+
resourceType="Observation"
12+
getTableColumns={() => [
13+
{
14+
title: 'Status',
15+
dataIndex: 'status',
16+
key: 'status',
17+
render: (_text: any, { resource }) => {
18+
return resource.status;
19+
},
20+
},
21+
]}
22+
getRecordActions={(record) => [navigationAction('Open', `/`)]}
23+
getHeaderActions={() => [
24+
questionnaireAction(<Trans>Create observation</Trans>, 'observation-create', {
25+
icon: <PlusOutlined />,
26+
}),
27+
]}
28+
getBatchActions={() => [questionnaireAction(<Trans>Finish observation</Trans>, '')]}
29+
getReportColumns={(bundle) => [
30+
{
31+
title: t`Number of Observation`,
32+
value: bundle.total,
33+
},
34+
]}
35+
/>
36+
);
37+
}
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
import { PlusOutlined } from '@ant-design/icons';
2+
import { t, Trans } from '@lingui/macro';
3+
import { Organization } from 'fhir/r4b';
4+
5+
import { customAction, questionnaireAction, navigationAction, ResourceListPage } from '@beda.software/emr/components';
6+
import { SearchBarColumnType } from '@beda.software/emr/dist/components/SearchBar/types';
7+
8+
import { S } from './styles';
9+
10+
export function OrganizationsUberList() {
11+
return (
12+
<ResourceListPage<Organization>
13+
headerTitle={t`Organizations`}
14+
resourceType="Organization"
15+
getTableColumns={() => [
16+
{
17+
title: <Trans>Name</Trans>,
18+
dataIndex: 'name',
19+
key: 'name',
20+
render: (_text, { resource }) => {
21+
return resource.name;
22+
},
23+
width: 300,
24+
},
25+
]}
26+
getFilters={() => [
27+
{
28+
id: 'name',
29+
searchParam: 'name',
30+
type: SearchBarColumnType.STRING,
31+
placeholder: t`Find organization`,
32+
placement: ['search-bar', 'table'],
33+
},
34+
]}
35+
getRecordActions={(record) => [
36+
navigationAction('Open', `/organizations/${record.resource.id}`),
37+
questionnaireAction('Edit', 'organization-edit'),
38+
customAction(<S.LinkButton type="link">Custom action</S.LinkButton>),
39+
]}
40+
getHeaderActions={() => [
41+
questionnaireAction(<Trans>Add organization</Trans>, 'organization-create', { icon: <PlusOutlined /> }),
42+
]}
43+
getBatchActions={() => [
44+
questionnaireAction(<Trans>Delete organization</Trans>, 'organization-batch-delete'),
45+
]}
46+
getReportColumns={(bundle) => [
47+
{
48+
title: t`Number of Organization`,
49+
value: bundle.total,
50+
},
51+
]}
52+
></ResourceListPage>
53+
);
54+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import { Button } from 'antd';
2+
import styled from 'styled-components';
3+
4+
export const S = {
5+
LinkButton: styled(Button)`
6+
padding: 0;
7+
`,
8+
};

0 commit comments

Comments
 (0)