@openmrs/esm-laboratory-app 1.0.1-pre.106
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/.editorconfig +12 -0
- package/.eslintignore +2 -0
- package/.eslintrc +32 -0
- package/.husky/pre-commit +4 -0
- package/.husky/pre-push +6 -0
- package/.prettierignore +14 -0
- package/.turbo/turbo-build.log +30 -0
- package/.turbo/turbo-lint.log +12 -0
- package/.turbo/turbo-typescript.log +0 -0
- package/.yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs +541 -0
- package/.yarn/plugins/@yarnpkg/plugin-outdated.cjs +35 -0
- package/.yarn/plugins/@yarnpkg/plugin-version.cjs +550 -0
- package/.yarn/versions/3d4697b8.yml +0 -0
- package/README.md +39 -0
- package/__mocks__/react-i18next.js +50 -0
- package/assets/logo/logo.png +0 -0
- package/assets/logo/moh_logo_without_word.png +0 -0
- package/assets/screenshots/labs_enter_results.png +0 -0
- package/assets/screenshots/labs_general_dashboard.png +0 -0
- package/dist/142.js +1 -0
- package/dist/142.js.map +1 -0
- package/dist/319.js +1 -0
- package/dist/36.js +1 -0
- package/dist/36.js.map +1 -0
- package/dist/395.js +1 -0
- package/dist/395.js.map +1 -0
- package/dist/453.js +1 -0
- package/dist/453.js.map +1 -0
- package/dist/533.js +1 -0
- package/dist/533.js.map +1 -0
- package/dist/56.js +2 -0
- package/dist/56.js.LICENSE.txt +32 -0
- package/dist/56.js.map +1 -0
- package/dist/572.js +1 -0
- package/dist/572.js.map +1 -0
- package/dist/574.js +1 -0
- package/dist/581.js +1 -0
- package/dist/581.js.map +1 -0
- package/dist/66.js +1 -0
- package/dist/66.js.map +1 -0
- package/dist/757.js +1 -0
- package/dist/769.js +1 -0
- package/dist/769.js.map +1 -0
- package/dist/770.js +1 -0
- package/dist/770.js.map +1 -0
- package/dist/800.js +2 -0
- package/dist/800.js.LICENSE.txt +3 -0
- package/dist/800.js.map +1 -0
- package/dist/809.js +1 -0
- package/dist/809.js.map +1 -0
- package/dist/889.js +1 -0
- package/dist/889.js.map +1 -0
- package/dist/894.js +2 -0
- package/dist/894.js.LICENSE.txt +48 -0
- package/dist/894.js.map +1 -0
- package/dist/924.js +1 -0
- package/dist/924.js.map +1 -0
- package/dist/928.js +1 -0
- package/dist/928.js.map +1 -0
- package/dist/967b98e46b0984c4.png +0 -0
- package/dist/97.js +1 -0
- package/dist/97.js.map +1 -0
- package/dist/983.js +1 -0
- package/dist/983.js.map +1 -0
- package/dist/main.js +2 -0
- package/dist/main.js.LICENSE.txt +48 -0
- package/dist/main.js.map +1 -0
- package/dist/openmrs-esm-laboratory-app.js +1 -0
- package/dist/openmrs-esm-laboratory-app.js.buildmanifest.json +628 -0
- package/dist/openmrs-esm-laboratory-app.js.map +1 -0
- package/dist/routes.json +1 -0
- package/i18next-parser.config.js +89 -0
- package/jest.config.js +16 -0
- package/package.json +121 -0
- package/src/completed-list/completed-list.component.tsx +242 -0
- package/src/completed-list/completed-list.resource.ts +0 -0
- package/src/completed-list/completed-list.scss +232 -0
- package/src/components/create-dashboard-link.component.tsx +44 -0
- package/src/components/overlay/hook.ts +47 -0
- package/src/components/overlay/overlay.component.tsx +52 -0
- package/src/components/overlay/overlay.scss +93 -0
- package/src/config-schema.ts +36 -0
- package/src/constants.ts +5 -0
- package/src/declarations.d.ts +6 -0
- package/src/header/laboratory-header.component.tsx +35 -0
- package/src/header/laboratory-header.scss +68 -0
- package/src/header/laboratory-illustration.component.tsx +13 -0
- package/src/index.ts +92 -0
- package/src/laboratory.component.tsx +18 -0
- package/src/patient-chart/laboratory-item/view-laboratory-item.component.tsx +39 -0
- package/src/patient-chart/laboratory-item/view-laboratory-item.resource.ts +290 -0
- package/src/patient-chart/laboratory-item/view-laboratory-item.scss +0 -0
- package/src/patient-chart/laboratory-order.component.tsx +453 -0
- package/src/patient-chart/laboratory-order.resource.ts +437 -0
- package/src/patient-chart/laboratory-order.scss +66 -0
- package/src/patient-chart/results-summary/print-results-summary.component.tsx +240 -0
- package/src/patient-chart/results-summary/print-results-summary.scss +105 -0
- package/src/patient-chart/results-summary/print-results-table.component.tsx +163 -0
- package/src/patient-chart/results-summary/results/results.component.tsx +25 -0
- package/src/patient-chart/results-summary/results/results.resource.ts +50 -0
- package/src/patient-chart/results-summary/results/results.scss +0 -0
- package/src/patient-chart/results-summary/results-dialog/edit-results-dialog.component.tsx +46 -0
- package/src/patient-chart/results-summary/results-summary.component.tsx +98 -0
- package/src/patient-chart/results-summary/results-summary.resource.tsx +185 -0
- package/src/patient-chart/results-summary/results-summary.scss +154 -0
- package/src/patient-chart/results-summary/send-email-dialog.component.tsx +111 -0
- package/src/patient-chart/results-summary/test-children-results.component.tsx +221 -0
- package/src/patient-chart/results-summary/test-print-results-table.component.tsx +148 -0
- package/src/patient-chart/results-summary/test-results-delete-action-menu.component.tsx +27 -0
- package/src/patient-chart/results-summary/test-results-rescend-action-menu.component.tsx +26 -0
- package/src/patient-chart/results-summary/test-results-table.component.tsx +153 -0
- package/src/patient-chart/results-summary/tests-children-detail.component.tsx +54 -0
- package/src/patient-chart/results-summary/views/email.handlebars +13 -0
- package/src/queue-list/lab-dialogs/add-to-worklist-dialog.component.tsx +323 -0
- package/src/queue-list/lab-dialogs/add-to-worklist-dialog.resource.ts +155 -0
- package/src/queue-list/lab-dialogs/add-to-worklist-dialog.scss +20 -0
- package/src/queue-list/lab-tests/lab-tests.component.tsx +116 -0
- package/src/queue-list/lab-tests/lab-tests.resource.ts +17 -0
- package/src/queue-list/lab-tests/lab-tests.scss +12 -0
- package/src/queue-list/laboratory-patient-list.component.tsx +277 -0
- package/src/queue-list/laboratory-patient-list.resource.ts +86 -0
- package/src/queue-list/laboratory-queue.component.tsx +120 -0
- package/src/queue-list/laboratory-queue.scss +213 -0
- package/src/queue-list/laboratory-tabs.component.tsx +81 -0
- package/src/queue-list/pick-lab-request-menu.component.tsx +38 -0
- package/src/reject-order/reject-order-dialog.component.tsx +114 -0
- package/src/reject-order/reject-order-dialog.resource.ts +14 -0
- package/src/reject-order/reject-order-dialog.scss +14 -0
- package/src/results/result-form.component.tsx +223 -0
- package/src/results/result-form.resource.ts +328 -0
- package/src/results/result-form.scss +19 -0
- package/src/review-list/dialog/review-item.component.tsx +283 -0
- package/src/review-list/dialog/review-item.resource.ts +14 -0
- package/src/review-list/dialog/review-item.scss +0 -0
- package/src/review-list/review-list.component.tsx +277 -0
- package/src/review-list/review-list.resource.ts +0 -0
- package/src/review-list/review-list.scss +189 -0
- package/src/root.component.tsx +15 -0
- package/src/root.scss +50 -0
- package/src/routes.json +72 -0
- package/src/setup-tests.ts +1 -0
- package/src/summary-tiles/laboratory-summary-tiles.component.tsx +53 -0
- package/src/summary-tiles/laboratory-summary-tiles.scss +12 -0
- package/src/summary-tiles/laboratory-summary.resource.tsx +50 -0
- package/src/summary-tiles/summary-tile.component.tsx +48 -0
- package/src/summary-tiles/summary-tile.scss +43 -0
- package/src/types/index.ts +412 -0
- package/src/types/patient-queues.ts +189 -0
- package/src/utils/functions.ts +246 -0
- package/src/work-list/work-list.component.tsx +310 -0
- package/src/work-list/work-list.resource.ts +136 -0
- package/src/work-list/work-list.scss +215 -0
- package/translations/en.json +16 -0
- package/translations/es.json +3 -0
- package/translations/fr.json +3 -0
- package/tsconfig.json +23 -0
- package/webpack.config.js +29 -0
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import React, { useEffect, useState } from "react";
|
|
2
|
+
import { Tab, Tabs, TabList, TabPanels, TabPanel, Search } from "@carbon/react";
|
|
3
|
+
import { useTranslation } from "react-i18next";
|
|
4
|
+
import styles from "./laboratory-queue.scss";
|
|
5
|
+
import LaboratoryPatientList from "./laboratory-patient-list.component";
|
|
6
|
+
import { EmptyState } from "@openmrs/esm-patient-common-lib";
|
|
7
|
+
import WorkList from "../work-list/work-list.component";
|
|
8
|
+
import ReviewList from "../review-list/review-list.component";
|
|
9
|
+
import CompletedList from "../completed-list/completed-list.component";
|
|
10
|
+
|
|
11
|
+
enum TabTypes {
|
|
12
|
+
STARRED,
|
|
13
|
+
SYSTEM,
|
|
14
|
+
USER,
|
|
15
|
+
ALL,
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const LaboratoryQueueTabs: React.FC = () => {
|
|
19
|
+
const { t } = useTranslation();
|
|
20
|
+
const [selectedTab, setSelectedTab] = useState(0);
|
|
21
|
+
return (
|
|
22
|
+
<main className={`omrs-main-content`}>
|
|
23
|
+
<section className={styles.orderTabsContainer}>
|
|
24
|
+
<Tabs
|
|
25
|
+
selectedIndex={selectedTab}
|
|
26
|
+
onChange={({ selectedIndex }) => setSelectedTab(selectedIndex)}
|
|
27
|
+
className={styles.tabs}
|
|
28
|
+
>
|
|
29
|
+
<TabList
|
|
30
|
+
style={{ paddingLeft: "1rem" }}
|
|
31
|
+
aria-label="Laboratory tabs"
|
|
32
|
+
contained
|
|
33
|
+
>
|
|
34
|
+
<Tab>{t("testedOrders", "Tests ordered")}</Tab>
|
|
35
|
+
<Tab>{t("worklist", "Worklist")}</Tab>
|
|
36
|
+
<Tab>{t("referredTests", "Referred tests")}</Tab>
|
|
37
|
+
<Tab>{t("reviewList", "Review")}</Tab>
|
|
38
|
+
<Tab>{t("approveList", "Approved")}</Tab>
|
|
39
|
+
</TabList>
|
|
40
|
+
<TabPanels>
|
|
41
|
+
<TabPanel style={{ padding: 0 }}>
|
|
42
|
+
<div>
|
|
43
|
+
<div className={styles.headerBtnContainer}></div>
|
|
44
|
+
<LaboratoryPatientList />
|
|
45
|
+
</div>
|
|
46
|
+
</TabPanel>
|
|
47
|
+
<TabPanel style={{ padding: 0 }}>
|
|
48
|
+
<div>
|
|
49
|
+
<div className={styles.headerBtnContainer}></div>
|
|
50
|
+
<WorkList fulfillerStatus={"IN_PROGRESS"} />
|
|
51
|
+
</div>
|
|
52
|
+
</TabPanel>
|
|
53
|
+
<TabPanel style={{ padding: 0 }}>
|
|
54
|
+
<div>
|
|
55
|
+
<div className={styles.headerBtnContainer}></div>
|
|
56
|
+
<EmptyState
|
|
57
|
+
displayText={"referred tests"}
|
|
58
|
+
headerTitle={"Referred tests"}
|
|
59
|
+
/>
|
|
60
|
+
</div>
|
|
61
|
+
</TabPanel>
|
|
62
|
+
<TabPanel style={{ padding: 0 }}>
|
|
63
|
+
<div>
|
|
64
|
+
<div className={styles.headerBtnContainer}></div>
|
|
65
|
+
<ReviewList fulfillerStatus={"IN_PROGRESS"} />
|
|
66
|
+
</div>
|
|
67
|
+
</TabPanel>
|
|
68
|
+
<TabPanel style={{ padding: 0 }}>
|
|
69
|
+
<div>
|
|
70
|
+
<div className={styles.headerBtnContainer}></div>
|
|
71
|
+
<CompletedList fulfillerStatus={"COMPLETED"} />
|
|
72
|
+
</div>
|
|
73
|
+
</TabPanel>
|
|
74
|
+
</TabPanels>
|
|
75
|
+
</Tabs>
|
|
76
|
+
</section>
|
|
77
|
+
</main>
|
|
78
|
+
);
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
export default LaboratoryQueueTabs;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { Button, Tooltip } from "@carbon/react";
|
|
2
|
+
import { Notification } from "@carbon/react/icons";
|
|
3
|
+
|
|
4
|
+
import { showModal } from "@openmrs/esm-framework";
|
|
5
|
+
import React, { useCallback } from "react";
|
|
6
|
+
import { useTranslation } from "react-i18next";
|
|
7
|
+
import { MappedPatientQueueEntry } from "./laboratory-patient-list.resource";
|
|
8
|
+
import { Encounter, Order } from "../types/patient-queues";
|
|
9
|
+
|
|
10
|
+
interface PickLabRequestActionMenuProps {
|
|
11
|
+
order: Order;
|
|
12
|
+
closeModal: () => void;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const PickLabRequestActionMenu: React.FC<PickLabRequestActionMenuProps> = ({
|
|
16
|
+
order,
|
|
17
|
+
}) => {
|
|
18
|
+
const { t } = useTranslation();
|
|
19
|
+
|
|
20
|
+
const launchPickLabRequestQueueModal = useCallback(() => {
|
|
21
|
+
const dispose = showModal("add-to-worklist-dialog", {
|
|
22
|
+
closeModal: () => dispose(),
|
|
23
|
+
|
|
24
|
+
order,
|
|
25
|
+
});
|
|
26
|
+
}, [order]);
|
|
27
|
+
|
|
28
|
+
return (
|
|
29
|
+
<Button
|
|
30
|
+
kind="ghost"
|
|
31
|
+
onClick={launchPickLabRequestQueueModal}
|
|
32
|
+
iconDescription={t("pickRequest", "Pick Lab Request ")}
|
|
33
|
+
renderIcon={(props) => <Notification size={16} {...props} />}
|
|
34
|
+
/>
|
|
35
|
+
);
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export default PickLabRequestActionMenu;
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import React, { useState } from "react";
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
Button,
|
|
5
|
+
ContentSwitcher,
|
|
6
|
+
Form,
|
|
7
|
+
ModalBody,
|
|
8
|
+
ModalFooter,
|
|
9
|
+
ModalHeader,
|
|
10
|
+
Select,
|
|
11
|
+
SelectItem,
|
|
12
|
+
Switch,
|
|
13
|
+
TextArea,
|
|
14
|
+
Grid,
|
|
15
|
+
Checkbox,
|
|
16
|
+
TextInput,
|
|
17
|
+
IconButton,
|
|
18
|
+
} from "@carbon/react";
|
|
19
|
+
import { useTranslation } from "react-i18next";
|
|
20
|
+
import styles from "./reject-order-dialog.scss";
|
|
21
|
+
import { Result } from "../work-list/work-list.resource";
|
|
22
|
+
import { RejectOrder } from "./reject-order-dialog.resource";
|
|
23
|
+
import { showNotification, showToast } from "@openmrs/esm-framework";
|
|
24
|
+
|
|
25
|
+
interface RejectOrderDialogProps {
|
|
26
|
+
order: Result;
|
|
27
|
+
closeModal: () => void;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const RejectOrderDialog: React.FC<RejectOrderDialogProps> = ({
|
|
31
|
+
order,
|
|
32
|
+
closeModal,
|
|
33
|
+
}) => {
|
|
34
|
+
const { t } = useTranslation();
|
|
35
|
+
|
|
36
|
+
const [notes, setNotes] = useState("");
|
|
37
|
+
|
|
38
|
+
const rejectOrder = async (event) => {
|
|
39
|
+
event.preventDefault();
|
|
40
|
+
|
|
41
|
+
const payload = {
|
|
42
|
+
fulfillerStatus: "EXCEPTION", // Todo changed to Declined when UgEMR module is upgraded to 2.6.1
|
|
43
|
+
fulfillerComment: notes,
|
|
44
|
+
};
|
|
45
|
+
RejectOrder(order.uuid, payload).then(
|
|
46
|
+
(resp) => {
|
|
47
|
+
showToast({
|
|
48
|
+
critical: true,
|
|
49
|
+
title: t("rejectOrder", "Rejected Order"),
|
|
50
|
+
kind: "success",
|
|
51
|
+
description: t(
|
|
52
|
+
"successfullyrejected",
|
|
53
|
+
`You have successfully rejected an Order with OrderNumber ${order.orderNumber} `
|
|
54
|
+
),
|
|
55
|
+
});
|
|
56
|
+
closeModal();
|
|
57
|
+
},
|
|
58
|
+
(err) => {
|
|
59
|
+
showNotification({
|
|
60
|
+
title: t(`errorRejecting order', 'Error Rejecting a order`),
|
|
61
|
+
kind: "error",
|
|
62
|
+
critical: true,
|
|
63
|
+
description: err?.message,
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
);
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
return (
|
|
70
|
+
<div>
|
|
71
|
+
<Form onSubmit={rejectOrder}>
|
|
72
|
+
<ModalHeader
|
|
73
|
+
closeModal={closeModal}
|
|
74
|
+
title={t("rejectOrder", "Reject Order")}
|
|
75
|
+
/>
|
|
76
|
+
<ModalBody>
|
|
77
|
+
<div className={styles.modalBody}>
|
|
78
|
+
<section className={styles.section}>
|
|
79
|
+
<h5 className={styles.section}>
|
|
80
|
+
{order?.accessionNumber} · {order?.fulfillerStatus}{" "}
|
|
81
|
+
·
|
|
82
|
+
{order?.orderNumber}
|
|
83
|
+
|
|
84
|
+
</h5>
|
|
85
|
+
</section>
|
|
86
|
+
<br />
|
|
87
|
+
<section className={styles.section}>
|
|
88
|
+
<TextArea
|
|
89
|
+
labelText={t("notes", "Enter Comments ")}
|
|
90
|
+
id="nextNotes"
|
|
91
|
+
name="nextNotes"
|
|
92
|
+
invalidText="Required"
|
|
93
|
+
helperText="Please enter comment"
|
|
94
|
+
maxCount={500}
|
|
95
|
+
enableCounter
|
|
96
|
+
onChange={(e) => setNotes(e.target.value)}
|
|
97
|
+
/>
|
|
98
|
+
</section>
|
|
99
|
+
</div>
|
|
100
|
+
</ModalBody>
|
|
101
|
+
<ModalFooter>
|
|
102
|
+
<Button kind="secondary" onClick={closeModal}>
|
|
103
|
+
{t("cancel", "Cancel")}
|
|
104
|
+
</Button>
|
|
105
|
+
<Button kind="danger" type="submit">
|
|
106
|
+
{t("rejectOrder", "Reject Order")}
|
|
107
|
+
</Button>
|
|
108
|
+
</ModalFooter>
|
|
109
|
+
</Form>
|
|
110
|
+
</div>
|
|
111
|
+
);
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
export default RejectOrderDialog;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { FetchResponse, openmrsFetch, useConfig } from "@openmrs/esm-framework";
|
|
2
|
+
|
|
3
|
+
export async function RejectOrder(uuid: string, body: any) {
|
|
4
|
+
const abortController = new AbortController();
|
|
5
|
+
|
|
6
|
+
return openmrsFetch(`/ws/rest/v1/order/${uuid}/fulfillerdetails/`, {
|
|
7
|
+
method: "POST",
|
|
8
|
+
headers: {
|
|
9
|
+
"Content-Type": "application/json",
|
|
10
|
+
},
|
|
11
|
+
signal: abortController.signal,
|
|
12
|
+
body: body,
|
|
13
|
+
});
|
|
14
|
+
}
|
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
import React, { useMemo, useState } from "react";
|
|
2
|
+
import styles from "./result-form.scss";
|
|
3
|
+
import {
|
|
4
|
+
Button,
|
|
5
|
+
InlineLoading,
|
|
6
|
+
TextInput,
|
|
7
|
+
Select,
|
|
8
|
+
SelectItem,
|
|
9
|
+
ModalBody,
|
|
10
|
+
ModalFooter,
|
|
11
|
+
ModalHeader,
|
|
12
|
+
} from "@carbon/react";
|
|
13
|
+
import { useTranslation } from "react-i18next";
|
|
14
|
+
import { closeOverlay } from "../components/overlay/hook";
|
|
15
|
+
import {
|
|
16
|
+
ExtensionSlot,
|
|
17
|
+
showNotification,
|
|
18
|
+
showToast,
|
|
19
|
+
usePatient,
|
|
20
|
+
} from "@openmrs/esm-framework";
|
|
21
|
+
import {
|
|
22
|
+
UpdateEncounter,
|
|
23
|
+
useGetOrderConceptByUuid,
|
|
24
|
+
} from "./result-form.resource";
|
|
25
|
+
import { Result } from "../work-list/work-list.resource";
|
|
26
|
+
|
|
27
|
+
interface ResultFormProps {
|
|
28
|
+
patientUuid: string;
|
|
29
|
+
order: Result;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const ResultForm: React.FC<ResultFormProps> = ({ order, patientUuid }) => {
|
|
33
|
+
const { t } = useTranslation();
|
|
34
|
+
|
|
35
|
+
const { patient, isLoading } = usePatient(patientUuid);
|
|
36
|
+
|
|
37
|
+
const { concept } = useGetOrderConceptByUuid(order.concept.uuid);
|
|
38
|
+
|
|
39
|
+
const [isSubmitting, setIsSubmitting] = useState(false);
|
|
40
|
+
|
|
41
|
+
const [inputValues, setInputValues] = useState({});
|
|
42
|
+
|
|
43
|
+
const [selectedOption, setSelectedOption] = useState();
|
|
44
|
+
|
|
45
|
+
const bannerState = useMemo(() => {
|
|
46
|
+
if (patient) {
|
|
47
|
+
return {
|
|
48
|
+
patient,
|
|
49
|
+
patientUuid,
|
|
50
|
+
hideActionsOverflow: true,
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
}, [patient, patientUuid]);
|
|
54
|
+
|
|
55
|
+
// getInput values
|
|
56
|
+
const handleInputChange = (memberUuid, value) => {
|
|
57
|
+
setInputValues((prevValues) => ({
|
|
58
|
+
...prevValues,
|
|
59
|
+
[memberUuid]: value,
|
|
60
|
+
}));
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
// create input fields
|
|
64
|
+
const Questions = ({ conceptMembers }) => {
|
|
65
|
+
const inputFields = useMemo(() => {
|
|
66
|
+
return conceptMembers.map((member) => {
|
|
67
|
+
let inputField;
|
|
68
|
+
|
|
69
|
+
if (
|
|
70
|
+
member.datatype.display === "Text" ||
|
|
71
|
+
member.datatype.display === "Numeric"
|
|
72
|
+
) {
|
|
73
|
+
inputField = (
|
|
74
|
+
<TextInput
|
|
75
|
+
key={member.uuid}
|
|
76
|
+
className={styles.textInput}
|
|
77
|
+
name={`member-${member.uuid}-test-id`}
|
|
78
|
+
id={`member-${member.uuid}-test-id`}
|
|
79
|
+
type={member.datatype.display === "Numeric" ? "number" : "text"}
|
|
80
|
+
labelText={member?.display}
|
|
81
|
+
value={inputValues[member.uuid] || ""}
|
|
82
|
+
onChange={(e) => handleInputChange(member.uuid, e.target.value)}
|
|
83
|
+
/>
|
|
84
|
+
);
|
|
85
|
+
} else if (member.datatype.display === "Coded") {
|
|
86
|
+
inputField = (
|
|
87
|
+
<Select
|
|
88
|
+
key={member.uuid}
|
|
89
|
+
className={styles.textInput}
|
|
90
|
+
name={`member-${member.uuid}-test-id`}
|
|
91
|
+
id={`member-${member.uuid}-test-id`}
|
|
92
|
+
type="text"
|
|
93
|
+
labelText={member?.display}
|
|
94
|
+
value={inputValues[member.uuid] || ""}
|
|
95
|
+
onChange={(e) => handleInputChange(member.uuid, e.target.value)}
|
|
96
|
+
>
|
|
97
|
+
{!setSelectedOption ? (
|
|
98
|
+
<SelectItem text={t("option", "Choose an Option")} value="" />
|
|
99
|
+
) : null}
|
|
100
|
+
{member?.answers?.map((answer) => (
|
|
101
|
+
<SelectItem
|
|
102
|
+
key={answer.uuid}
|
|
103
|
+
text={answer.display}
|
|
104
|
+
value={answer.uuid}
|
|
105
|
+
>
|
|
106
|
+
{answer.display}
|
|
107
|
+
</SelectItem>
|
|
108
|
+
))}
|
|
109
|
+
</Select>
|
|
110
|
+
);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
return inputField;
|
|
114
|
+
});
|
|
115
|
+
}, [conceptMembers]); // Memoize when conceptMembers changes
|
|
116
|
+
|
|
117
|
+
return <>{inputFields}</>;
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
const handleSubmit = (e) => {
|
|
121
|
+
e.preventDefault();
|
|
122
|
+
// assign value to test
|
|
123
|
+
let groupMembers = [];
|
|
124
|
+
let obsValue = [];
|
|
125
|
+
const ob = {
|
|
126
|
+
concept: { uuid: order.concept.uuid },
|
|
127
|
+
status: "FINAL",
|
|
128
|
+
order: { uuid: order.uuid },
|
|
129
|
+
groupMembers: groupMembers,
|
|
130
|
+
};
|
|
131
|
+
concept.forEach((item) => {
|
|
132
|
+
let value;
|
|
133
|
+
if (
|
|
134
|
+
item.datatype.display === "Numeric" ||
|
|
135
|
+
item.datatype.display === "Text"
|
|
136
|
+
) {
|
|
137
|
+
value = inputValues[`${item.uuid}`];
|
|
138
|
+
} else if (item.datatype.display === "Coded") {
|
|
139
|
+
value = {
|
|
140
|
+
uuid: inputValues[`${item.uuid}`],
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
const groupMember = {
|
|
144
|
+
concept: { uuid: item.uuid },
|
|
145
|
+
value: value,
|
|
146
|
+
status: "FINAL",
|
|
147
|
+
order: { uuid: order.uuid },
|
|
148
|
+
};
|
|
149
|
+
groupMembers.push(groupMember);
|
|
150
|
+
});
|
|
151
|
+
obsValue.push(ob);
|
|
152
|
+
|
|
153
|
+
const payload = {
|
|
154
|
+
obs: obsValue,
|
|
155
|
+
};
|
|
156
|
+
setIsSubmitting(true);
|
|
157
|
+
// update encounter
|
|
158
|
+
UpdateEncounter(order.encounter.uuid, payload).then(
|
|
159
|
+
() => {
|
|
160
|
+
setIsSubmitting(false);
|
|
161
|
+
showToast({
|
|
162
|
+
critical: true,
|
|
163
|
+
title: t("updateEncounter", "Update Encounter"),
|
|
164
|
+
kind: "success",
|
|
165
|
+
description: t(
|
|
166
|
+
"generateSuccessfully",
|
|
167
|
+
"You have successfully encounter with test results"
|
|
168
|
+
),
|
|
169
|
+
});
|
|
170
|
+
},
|
|
171
|
+
(err) => {
|
|
172
|
+
setIsSubmitting(false);
|
|
173
|
+
showNotification({
|
|
174
|
+
title: t(
|
|
175
|
+
`errorUpdatingEncounter', 'Error occurred while updating encounter`
|
|
176
|
+
),
|
|
177
|
+
kind: "error",
|
|
178
|
+
critical: true,
|
|
179
|
+
description: err?.message,
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
);
|
|
183
|
+
};
|
|
184
|
+
|
|
185
|
+
return (
|
|
186
|
+
<>
|
|
187
|
+
<div className="">
|
|
188
|
+
<ModalBody>
|
|
189
|
+
{isLoading && (
|
|
190
|
+
<InlineLoading
|
|
191
|
+
className={styles.bannerLoading}
|
|
192
|
+
iconDescription="Loading"
|
|
193
|
+
description="Loading banner"
|
|
194
|
+
status="active"
|
|
195
|
+
/>
|
|
196
|
+
)}
|
|
197
|
+
{patient && (
|
|
198
|
+
<ExtensionSlot name="patient-header-slot" state={bannerState} />
|
|
199
|
+
)}
|
|
200
|
+
|
|
201
|
+
{concept?.length > 0 && (
|
|
202
|
+
<section className={styles.section}>
|
|
203
|
+
<Questions conceptMembers={concept} />
|
|
204
|
+
</section>
|
|
205
|
+
)}
|
|
206
|
+
</ModalBody>
|
|
207
|
+
|
|
208
|
+
<ModalFooter>
|
|
209
|
+
<Button
|
|
210
|
+
disabled={isSubmitting}
|
|
211
|
+
onClick={() => closeOverlay()}
|
|
212
|
+
kind="secondary"
|
|
213
|
+
>
|
|
214
|
+
{t("cancel", "Cancel")}
|
|
215
|
+
</Button>
|
|
216
|
+
<Button onClick={(e) => handleSubmit(e)}>Save tests</Button>
|
|
217
|
+
</ModalFooter>
|
|
218
|
+
</div>
|
|
219
|
+
</>
|
|
220
|
+
);
|
|
221
|
+
};
|
|
222
|
+
|
|
223
|
+
export default ResultForm;
|