@openmrs/esm-fast-data-entry-app 1.0.0-pre.9 → 1.0.1-pre.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.js +10 -0
- package/.husky/pre-push +1 -6
- package/.yarn/plugins/@yarnpkg/plugin-version.cjs +550 -0
- package/.yarn/versions/7ee3eceb.yml +0 -0
- package/README.md +39 -12
- package/dist/openmrs-esm-fast-data-entry-app.js +1 -1
- package/docs/config-icrc-forms.png +0 -0
- package/docs/config-other-forms.png +0 -0
- package/docs/configuring-form-categories.md +77 -0
- package/docs/fde-workflow.mov +0 -0
- package/docs/form-workflow-state-diagram.png +0 -0
- package/jest.config.json +20 -18
- package/package.json +97 -106
- package/src/FormBootstrap.tsx +151 -0
- package/src/Root.tsx +14 -3
- package/src/add-group-modal/AddGroupModal.tsx +209 -0
- package/src/add-group-modal/styles.scss +35 -0
- package/src/config-schema.ts +63 -31
- package/src/context/FormWorkflowContext.tsx +114 -0
- package/src/context/FormWorkflowReducer.ts +277 -0
- package/src/context/GroupFormWorkflowContext.tsx +141 -0
- package/src/context/GroupFormWorkflowReducer.ts +272 -0
- package/src/empty-state/EmptyDataIllustration.tsx +51 -0
- package/src/empty-state/EmptyState.tsx +33 -0
- package/src/empty-state/styles.scss +55 -0
- package/src/form-entry-workflow/FormEntryWorkflow.tsx +230 -0
- package/src/form-entry-workflow/form-review-card/FormReviewCard.tsx +50 -0
- package/src/form-entry-workflow/form-review-card/index.ts +3 -0
- package/src/form-entry-workflow/form-review-card/styles.scss +39 -0
- package/src/form-entry-workflow/index.ts +3 -0
- package/src/form-entry-workflow/patient-banner/PatientBanner.test.tsx +9 -0
- package/src/form-entry-workflow/patient-banner/PatientBanner.tsx +86 -0
- package/src/form-entry-workflow/patient-banner/index.ts +3 -0
- package/src/form-entry-workflow/patient-banner/styles.scss +45 -0
- package/src/form-entry-workflow/patient-search-header/PatientSearchHeader.tsx +63 -0
- package/src/form-entry-workflow/patient-search-header/index.ts +3 -0
- package/src/form-entry-workflow/patient-search-header/styles.scss +22 -0
- package/src/form-entry-workflow/styles.scss +64 -0
- package/src/form-entry-workflow/workflow-review/WorkflowReview.tsx +35 -0
- package/src/form-entry-workflow/workflow-review/index.ts +3 -0
- package/src/form-entry-workflow/workflow-review/styles.scss +34 -0
- package/src/forms-app-menu-link.tsx +3 -2
- package/src/forms-page/FormsPage.tsx +129 -0
- package/src/forms-page/forms-table/FormsTable.tsx +131 -0
- package/src/forms-page/forms-table/index.ts +3 -0
- package/src/forms-page/forms-table/styles.scss +20 -0
- package/src/forms-page/index.ts +3 -0
- package/src/forms-page/styles.scss +11 -0
- package/src/group-form-entry-workflow/GroupFormEntryWorkflow.tsx +413 -0
- package/src/group-form-entry-workflow/group-banner/GroupBanner.test.tsx +9 -0
- package/src/group-form-entry-workflow/group-banner/GroupBanner.tsx +45 -0
- package/src/group-form-entry-workflow/group-banner/index.ts +3 -0
- package/src/group-form-entry-workflow/group-banner/styles.scss +60 -0
- package/src/group-form-entry-workflow/group-search/CompactGroupResults.tsx +106 -0
- package/src/group-form-entry-workflow/group-search/CompactGroupSearch.tsx +63 -0
- package/src/group-form-entry-workflow/group-search/GroupSearch.tsx +93 -0
- package/src/group-form-entry-workflow/group-search/compact-group-result.scss +64 -0
- package/src/group-form-entry-workflow/group-search/compact-group-search.scss +35 -0
- package/src/group-form-entry-workflow/group-search/group-search.scss +94 -0
- package/src/group-form-entry-workflow/group-search/mock-group-data.ts +79 -0
- package/src/group-form-entry-workflow/group-search/useGroupSearch.ts +14 -0
- package/src/group-form-entry-workflow/group-search-header/GroupSearchHeader.tsx +42 -0
- package/src/group-form-entry-workflow/group-search-header/index.ts +3 -0
- package/src/group-form-entry-workflow/group-search-header/styles.scss +20 -0
- package/src/group-form-entry-workflow/index.ts +3 -0
- package/src/group-form-entry-workflow/styles.scss +86 -0
- package/src/hooks/index.ts +6 -0
- package/src/hooks/useFormState.ts +23 -0
- package/src/hooks/useGetAllForms.ts +45 -0
- package/src/hooks/useGetEncounter.ts +21 -0
- package/src/hooks/useGetPatient.ts +23 -0
- package/src/hooks/useKeyPress.ts +31 -0
- package/src/hooks/usePostCohort.ts +18 -0
- package/src/index.ts +20 -4
- package/src/patient-card/PatientCard.tsx +67 -0
- package/src/patient-card/index.ts +3 -0
- package/src/patient-card/styles.scss +45 -0
- package/translations/en.json +49 -4
- package/tsconfig.json +26 -23
- package/.eslintrc +0 -4
- package/.github/workflows/node.js.yml +0 -79
- package/.husky/pre-commit +0 -6
- package/dist/24.js +0 -3
- package/dist/24.js.LICENSE.txt +0 -16
- package/dist/24.js.map +0 -1
- package/dist/294.js +0 -3
- package/dist/294.js.LICENSE.txt +0 -14
- package/dist/294.js.map +0 -1
- package/dist/296.js +0 -2
- package/dist/296.js.map +0 -1
- package/dist/299.js +0 -2
- package/dist/299.js.map +0 -1
- package/dist/382.js +0 -3
- package/dist/382.js.LICENSE.txt +0 -8
- package/dist/382.js.map +0 -1
- package/dist/415.js +0 -2
- package/dist/415.js.map +0 -1
- package/dist/574.js +0 -1
- package/dist/595.js +0 -3
- package/dist/595.js.LICENSE.txt +0 -1
- package/dist/595.js.map +0 -1
- package/dist/69.js +0 -2
- package/dist/69.js.map +0 -1
- package/dist/735.js +0 -3
- package/dist/735.js.LICENSE.txt +0 -29
- package/dist/735.js.map +0 -1
- package/dist/777.js +0 -2
- package/dist/777.js.map +0 -1
- package/dist/860.js +0 -2
- package/dist/860.js.map +0 -1
- package/dist/906.js +0 -2
- package/dist/906.js.map +0 -1
- package/dist/openmrs-esm-fast-data-entry-app.js.buildmanifest.json +0 -369
- package/dist/openmrs-esm-fast-data-entry-app.js.map +0 -1
- package/dist/openmrs-esm-fast-data-entry-app.old +0 -2
- package/src/boxes/extensions/blue-box.tsx +0 -15
- package/src/boxes/extensions/box.scss +0 -23
- package/src/boxes/extensions/brand-box.tsx +0 -15
- package/src/boxes/extensions/red-box.tsx +0 -15
- package/src/boxes/slot/boxes.css +0 -23
- package/src/boxes/slot/boxes.tsx +0 -19
- package/src/forms/FormsRoot.tsx +0 -32
- package/src/forms/FormsTable.tsx +0 -64
- package/src/forms/mockData.ts +0 -43
- package/src/greeter/greeter.css +0 -4
- package/src/greeter/greeter.test.tsx +0 -29
- package/src/greeter/greeter.tsx +0 -25
- package/src/hello.css +0 -3
- package/src/hello.test.tsx +0 -45
- package/src/hello.tsx +0 -30
- package/src/patient-getter/patient-getter.resource.ts +0 -31
- package/src/patient-getter/patient-getter.test.tsx +0 -28
- package/src/patient-getter/patient-getter.tsx +0 -28
package/src/forms/FormsTable.tsx
DELETED
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
DataTable,
|
|
3
|
-
Table,
|
|
4
|
-
TableBody,
|
|
5
|
-
TableCell,
|
|
6
|
-
TableContainer,
|
|
7
|
-
TableHead,
|
|
8
|
-
TableHeader,
|
|
9
|
-
TableRow,
|
|
10
|
-
TableToolbar,
|
|
11
|
-
TableToolbarContent,
|
|
12
|
-
TableToolbarSearch,
|
|
13
|
-
} from "carbon-components-react";
|
|
14
|
-
import React from "react";
|
|
15
|
-
import { tableData } from "./mockData";
|
|
16
|
-
|
|
17
|
-
const FormsTable = () => {
|
|
18
|
-
const { rows, headers } = tableData;
|
|
19
|
-
return (
|
|
20
|
-
<DataTable rows={rows} headers={headers} isSortable>
|
|
21
|
-
{({
|
|
22
|
-
rows,
|
|
23
|
-
headers,
|
|
24
|
-
getTableProps,
|
|
25
|
-
getHeaderProps,
|
|
26
|
-
getRowProps,
|
|
27
|
-
onInputChange,
|
|
28
|
-
}) => {
|
|
29
|
-
return (
|
|
30
|
-
<TableContainer>
|
|
31
|
-
<TableToolbar style={{ position: "relative" }}>
|
|
32
|
-
<TableToolbarContent>
|
|
33
|
-
<TableToolbarSearch onChange={onInputChange} />
|
|
34
|
-
</TableToolbarContent>
|
|
35
|
-
</TableToolbar>
|
|
36
|
-
<Table {...getTableProps()}>
|
|
37
|
-
<TableHead>
|
|
38
|
-
<TableRow>
|
|
39
|
-
{headers.map((header) => (
|
|
40
|
-
<TableHeader {...getHeaderProps({ header })}>
|
|
41
|
-
{header.header}
|
|
42
|
-
</TableHeader>
|
|
43
|
-
))}
|
|
44
|
-
</TableRow>
|
|
45
|
-
</TableHead>
|
|
46
|
-
<TableBody>
|
|
47
|
-
{rows.map((row) => (
|
|
48
|
-
<TableRow {...getRowProps({ row })}>
|
|
49
|
-
{row.cells.map((cell) => (
|
|
50
|
-
<TableCell key={cell.id}>{cell.value}</TableCell>
|
|
51
|
-
))}
|
|
52
|
-
</TableRow>
|
|
53
|
-
))}
|
|
54
|
-
</TableBody>
|
|
55
|
-
</Table>
|
|
56
|
-
</TableContainer>
|
|
57
|
-
);
|
|
58
|
-
}}
|
|
59
|
-
</DataTable>
|
|
60
|
-
);
|
|
61
|
-
};
|
|
62
|
-
|
|
63
|
-
export default FormsTable;
|
|
64
|
-
export { FormsTable };
|
package/src/forms/mockData.ts
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
const rows = [
|
|
2
|
-
{
|
|
3
|
-
id: "admission-form",
|
|
4
|
-
name: "Admission form",
|
|
5
|
-
region: "All regions",
|
|
6
|
-
actions: "Fill Form",
|
|
7
|
-
},
|
|
8
|
-
{
|
|
9
|
-
id: "dass-form",
|
|
10
|
-
name: "DASS 21",
|
|
11
|
-
region: "All regions",
|
|
12
|
-
actions: "Fill form",
|
|
13
|
-
},
|
|
14
|
-
{
|
|
15
|
-
id: "follow-up-form",
|
|
16
|
-
name: "Follow-up form",
|
|
17
|
-
region: "All regions",
|
|
18
|
-
actions: "Fill form",
|
|
19
|
-
},
|
|
20
|
-
{
|
|
21
|
-
id: "closure-form",
|
|
22
|
-
name: "Closure form",
|
|
23
|
-
region: "All regions",
|
|
24
|
-
actions: "Fill form",
|
|
25
|
-
},
|
|
26
|
-
];
|
|
27
|
-
|
|
28
|
-
const headers = [
|
|
29
|
-
{
|
|
30
|
-
key: "name",
|
|
31
|
-
header: "Form name",
|
|
32
|
-
},
|
|
33
|
-
{
|
|
34
|
-
key: "region",
|
|
35
|
-
header: "Region",
|
|
36
|
-
},
|
|
37
|
-
{
|
|
38
|
-
key: "actions",
|
|
39
|
-
header: "Actions",
|
|
40
|
-
},
|
|
41
|
-
];
|
|
42
|
-
|
|
43
|
-
export const tableData = { ...{ rows, headers } };
|
package/src/greeter/greeter.css
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { render, cleanup, screen, getByText } from "@testing-library/react";
|
|
3
|
-
import { useConfig } from "@openmrs/esm-framework";
|
|
4
|
-
import { Greeter } from "./greeter";
|
|
5
|
-
import { Config } from "../config-schema";
|
|
6
|
-
|
|
7
|
-
const mockUseConfig = useConfig as jest.Mock;
|
|
8
|
-
|
|
9
|
-
describe(`<Greeter />`, () => {
|
|
10
|
-
afterEach(cleanup);
|
|
11
|
-
it(`displays the expected default text`, () => {
|
|
12
|
-
const config: Config = { casualGreeting: false, whoToGreet: ["World"] };
|
|
13
|
-
mockUseConfig.mockReturnValue(config);
|
|
14
|
-
render(<Greeter />);
|
|
15
|
-
expect(screen.getByText(/world/i)).toHaveTextContent("hello World!");
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
it(`will casually greet my friends`, () => {
|
|
19
|
-
const config: Config = {
|
|
20
|
-
casualGreeting: true,
|
|
21
|
-
whoToGreet: ["Ariel", "Barak", "Callum"],
|
|
22
|
-
};
|
|
23
|
-
mockUseConfig.mockReturnValue(config);
|
|
24
|
-
render(<Greeter />);
|
|
25
|
-
expect(screen.getByText(/ariel/i)).toHaveTextContent(
|
|
26
|
-
"hey Ariel, Barak, Callum!"
|
|
27
|
-
);
|
|
28
|
-
});
|
|
29
|
-
});
|
package/src/greeter/greeter.tsx
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This component demonstrates usage of the config object. Its structure
|
|
3
|
-
* comes from `../config-schema.ts`. For more information about the
|
|
4
|
-
* configuration system, please see that file.
|
|
5
|
-
*/
|
|
6
|
-
import { useConfig } from "@openmrs/esm-framework";
|
|
7
|
-
import React from "react";
|
|
8
|
-
import { Trans } from "react-i18next";
|
|
9
|
-
import { Config } from "../config-schema";
|
|
10
|
-
import styles from "./greeter.css";
|
|
11
|
-
|
|
12
|
-
export const Greeter: React.FC = () => {
|
|
13
|
-
const config = useConfig() as Config;
|
|
14
|
-
|
|
15
|
-
return (
|
|
16
|
-
<div className={styles.greeting}>
|
|
17
|
-
{config.casualGreeting ? (
|
|
18
|
-
<Trans key="casualGreeting">hey</Trans>
|
|
19
|
-
) : (
|
|
20
|
-
<Trans key="formalGreeting">hello</Trans>
|
|
21
|
-
)}{" "}
|
|
22
|
-
{config.whoToGreet.join(", ")}!
|
|
23
|
-
</div>
|
|
24
|
-
);
|
|
25
|
-
};
|
package/src/hello.css
DELETED
package/src/hello.test.tsx
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This is the root test for this page. It simply checks that the page
|
|
3
|
-
* renders. If the components of your page are highly interdependent,
|
|
4
|
-
* (e.g., if the `Hello` component had state that communicated
|
|
5
|
-
* information between `Greeter` and `PatientGetter`) then you might
|
|
6
|
-
* want to do most of your testing here. If those components are
|
|
7
|
-
* instead quite independent (as is the case in this example), then
|
|
8
|
-
* it would make more sense to test those components independently.
|
|
9
|
-
*
|
|
10
|
-
* The key thing to remember, always, is: write tests that behave like
|
|
11
|
-
* users. They should *look* for elements by their visual
|
|
12
|
-
* characteristics, *interact* with them, and (mostly) *assert* based
|
|
13
|
-
* on things that would be visually apparent to a user.
|
|
14
|
-
*
|
|
15
|
-
* To learn more about how we do testing, see the following resources:
|
|
16
|
-
* https://kentcdodds.com/blog/how-to-know-what-to-test
|
|
17
|
-
* https://kentcdodds.com/blog/testing-implementation-details
|
|
18
|
-
* https://kentcdodds.com/blog/common-mistakes-with-react-testing-library
|
|
19
|
-
*
|
|
20
|
-
* Kent C. Dodds is the inventor of `@testing-library`:
|
|
21
|
-
* https://testing-library.com/docs/guiding-principles
|
|
22
|
-
*/
|
|
23
|
-
import React from "react";
|
|
24
|
-
import { render, cleanup } from "@testing-library/react";
|
|
25
|
-
import Hello from "./hello";
|
|
26
|
-
import { useConfig } from "@openmrs/esm-framework";
|
|
27
|
-
import { Config } from "./config-schema";
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* This is an idiomatic way of dealing with mocked files. Note that
|
|
31
|
-
* `useConfig` is already mocked; the Jest moduleNameMapper (see the
|
|
32
|
-
* Jest config) has mapped the `@openmrs/esm-framework` import to a
|
|
33
|
-
* mock file. This line just tells TypeScript that the object is, in
|
|
34
|
-
* fact, a mock, and so will have methods like `mockReturnValue`.
|
|
35
|
-
*/
|
|
36
|
-
const mockUseConfig = useConfig as jest.Mock;
|
|
37
|
-
|
|
38
|
-
describe(`<Hello />`, () => {
|
|
39
|
-
afterEach(cleanup);
|
|
40
|
-
it(`renders without dying`, () => {
|
|
41
|
-
const config: Config = { casualGreeting: false, whoToGreet: ["World"] };
|
|
42
|
-
mockUseConfig.mockReturnValue(config);
|
|
43
|
-
render(<Hello />);
|
|
44
|
-
});
|
|
45
|
-
});
|
package/src/hello.tsx
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* From here, the application is pretty typical React, but with lots of
|
|
3
|
-
* support from `@openmrs/esm-framework`. Check out `Greeter` to see
|
|
4
|
-
* usage of the configuration system, and check out `PatientGetter` to
|
|
5
|
-
* see data fetching using the OpenMRS FHIR API.
|
|
6
|
-
*
|
|
7
|
-
* Check out the Config docs:
|
|
8
|
-
* https://openmrs.github.io/openmrs-esm-core/#/main/config
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
import React from "react";
|
|
12
|
-
import styles from "./hello.css";
|
|
13
|
-
import { Greeter } from "./greeter/greeter";
|
|
14
|
-
import { PatientGetter } from "./patient-getter/patient-getter";
|
|
15
|
-
import { Boxes } from "./boxes/slot/boxes";
|
|
16
|
-
|
|
17
|
-
const Hello: React.FC = () => {
|
|
18
|
-
return (
|
|
19
|
-
<div className={`omrs-main-content ${styles.container}`}>
|
|
20
|
-
{/* Greeter: demonstrates the configuration system */}
|
|
21
|
-
<Greeter />
|
|
22
|
-
{/* PatientGetter: demonstrates data fetching */}
|
|
23
|
-
<PatientGetter />
|
|
24
|
-
{/* Boxes: demonstrates the extension system */}
|
|
25
|
-
<Boxes />
|
|
26
|
-
</div>
|
|
27
|
-
);
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
export default Hello;
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { openmrsFetch, fhir } from "@openmrs/esm-framework";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* This is a somewhat silly resource function. It searches for a patient
|
|
5
|
-
* using the REST API, and then immediately gets the data using the FHIR
|
|
6
|
-
* API for the first patient found. OpenMRS API endpoints are generally
|
|
7
|
-
* hit using `openmrsFetch`. For FHIR endpoints we use the FHIR API
|
|
8
|
-
* object.
|
|
9
|
-
*
|
|
10
|
-
* See the `fhir` object API docs: https://github.com/openmrs/openmrs-esm-core/blob/master/packages/framework/esm-api/docs/API.md#fhir
|
|
11
|
-
* See the docs for the underlying fhir.js Client object: https://github.com/FHIR/fhir.js#api
|
|
12
|
-
* See the OpenMRS FHIR Module docs: https://wiki.openmrs.org/display/projects/OpenMRS+FHIR+Module
|
|
13
|
-
* See the OpenMRS REST API docs: https://rest.openmrs.org/#openmrs-rest-api
|
|
14
|
-
*
|
|
15
|
-
* @param query A patient name or ID
|
|
16
|
-
* @returns The first matching patient
|
|
17
|
-
*/
|
|
18
|
-
export async function getPatient(query) {
|
|
19
|
-
const searchResult = await openmrsFetch(
|
|
20
|
-
`/ws/rest/v1/patient?q=${query}&limit=1`,
|
|
21
|
-
{
|
|
22
|
-
method: "GET",
|
|
23
|
-
}
|
|
24
|
-
);
|
|
25
|
-
return (
|
|
26
|
-
await fhir.read<fhir.Patient>({
|
|
27
|
-
type: "Patient",
|
|
28
|
-
patient: searchResult.data.results[0].uuid,
|
|
29
|
-
})
|
|
30
|
-
).data;
|
|
31
|
-
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { render, screen } from "@testing-library/react";
|
|
3
|
-
import userEvent from "@testing-library/user-event";
|
|
4
|
-
import { PatientGetter } from "./patient-getter";
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* This is an idiomatic mock of a backend resource. We generally mock
|
|
8
|
-
* resource fetching functions like `getPatient`, rather than mocking
|
|
9
|
-
* `fetch` or anything lower-level.
|
|
10
|
-
*/
|
|
11
|
-
jest.mock("./patient-getter.resource.ts", () => ({
|
|
12
|
-
getPatient: jest.fn(() =>
|
|
13
|
-
Promise.resolve({
|
|
14
|
-
name: [{ id: "abc123", given: "Joeboy", family: "Testguy" }],
|
|
15
|
-
gender: "male",
|
|
16
|
-
birthDate: "1997-05-21",
|
|
17
|
-
})
|
|
18
|
-
),
|
|
19
|
-
}));
|
|
20
|
-
|
|
21
|
-
describe(`<PatientGetter />`, () => {
|
|
22
|
-
it("gets a patient when the button is clicked", async () => {
|
|
23
|
-
render(<PatientGetter />);
|
|
24
|
-
userEvent.click(screen.getByRole("button"));
|
|
25
|
-
const resultText = await screen.findByText(/joeboy/i);
|
|
26
|
-
expect(resultText).toHaveTextContent("Joeboy Testguy / male / 1997-05-21");
|
|
27
|
-
});
|
|
28
|
-
});
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Components that make queries delegate the query-making logic to a
|
|
3
|
-
* `.resource.ts` function. This component simply calls `getPatient`
|
|
4
|
-
* and sets a state variable using the result.
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
import React, { useState } from "react";
|
|
8
|
-
import { Trans } from "react-i18next";
|
|
9
|
-
import Button from "carbon-components-react/es/components/Button";
|
|
10
|
-
import { Tile } from "carbon-components-react/es/components/Tile";
|
|
11
|
-
import { getPatient } from "./patient-getter.resource";
|
|
12
|
-
|
|
13
|
-
export function PatientGetter() {
|
|
14
|
-
const [patient, setPatient] = useState<fhir.Patient>();
|
|
15
|
-
const patientName = "test";
|
|
16
|
-
return (
|
|
17
|
-
<div>
|
|
18
|
-
<Button onClick={() => getPatient(patientName).then(setPatient)}>
|
|
19
|
-
<Trans key="getPatient">Get a patient named</Trans> 'test'
|
|
20
|
-
</Button>
|
|
21
|
-
<Tile>
|
|
22
|
-
{patient
|
|
23
|
-
? `${patient.name[0].given} ${patient.name[0].family} / ${patient.gender} / ${patient.birthDate}`
|
|
24
|
-
: null}
|
|
25
|
-
</Tile>
|
|
26
|
-
</div>
|
|
27
|
-
);
|
|
28
|
-
}
|