@kenyaemr/esm-express-workflow-app 5.4.4-pre.96 → 5.4.5-pre.16
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/package.json +3 -3
- package/src/components/admissions/admissions-dashboard.component.tsx +2 -2
- package/src/components/anaesthetic/anaesthetic-dashboard.meta.ts +8 -0
- package/src/components/anaesthetic/anaesthetic-data-form.component.tsx +442 -0
- package/src/components/anaesthetic/anaesthetic-data-form.scss +278 -0
- package/src/components/anaesthetic/anaesthetic-link.component.tsx +21 -0
- package/src/components/anaesthetic/anaesthetic.component.tsx +618 -0
- package/src/components/anaesthetic/anaesthetic.resource.ts +1503 -0
- package/src/components/anaesthetic/anaesthetic.scss +1885 -0
- package/src/components/anaesthetic/forms/anaesthetic-form.component.tsx +304 -0
- package/src/components/anaesthetic/forms/anaesthetic-record-form.component.tsx +707 -0
- package/src/components/anaesthetic/forms/icd11-diagnosis-search.component.tsx +178 -0
- package/src/components/anaesthetic/forms/icd11-diagnosis-search.scss +126 -0
- package/src/components/anaesthetic/forms/index.ts +2 -0
- package/src/components/anaesthetic/forms/interoperative-record-drug-given-form.component.tsx +231 -0
- package/src/components/anaesthetic/forms/post-operative-summary-form.component.tsx +171 -0
- package/src/components/anaesthetic/forms/time-picker-dropdown.component.tsx +202 -0
- package/src/components/anaesthetic/forms/time-picker-dropdown.scss +107 -0
- package/src/components/anaesthetic/forms/time-picker-with-clock.component.tsx +174 -0
- package/src/components/anaesthetic/forms/time-picker-with-clock.scss +178 -0
- package/src/components/anaesthetic/forms/useAnaestheticData.ts +16 -0
- package/src/components/anaesthetic/graphs/anaesthetic-graph-wrapper.component.tsx +266 -0
- package/src/components/anaesthetic/graphs/anaesthetic-graph.component.tsx +185 -0
- package/src/components/anaesthetic/graphs/index.ts +2 -0
- package/src/components/anaesthetic/graphs/interoperative-record-drug-given-graph-wrapper.component.tsx +197 -0
- package/src/components/anaesthetic/graphs/interoperative-record-drug-given-graph.component.tsx +93 -0
- package/src/components/anaesthetic/resources/anaesthetic-amniotic-fluid.resource.ts +277 -0
- package/src/components/anaesthetic/resources/anaesthetic-form.resource.ts +716 -0
- package/src/components/anaesthetic/resources/anaesthetic.resource.ts +378 -0
- package/src/components/anaesthetic/types/index.ts +1349 -0
- package/src/components/consultation/clinical-encounter/clinical-encounter.component.tsx +4 -20
- package/src/components/consultation/index.ts +1 -1
- package/src/components/consultation/tabs/index.ts +67 -0
- package/src/components/facility-dashboard/components/header/home-header.component.tsx +8 -13
- package/src/components/laboratory/index.ts +11 -0
- package/src/components/laboratory/lab-table.component.tsx +32 -12
- package/src/components/laboratory/laboratory-tabs.component.tsx +3 -17
- package/src/components/mch/mch.component.tsx +1 -3
- package/src/components/pharmacy/index.ts +1 -1
- package/src/components/pharmacy/orders/pharmacy-orders.component.tsx +13 -2
- package/src/components/pharmacy/pharmacy-tabs.component.tsx +4 -20
- package/src/components/pharmacy/tabs/index.ts +21 -0
- package/src/components/preauth/index.ts +22 -0
- package/src/components/preauth/preauth-dashboard.component.tsx +20 -0
- package/src/components/procedures/index.ts +16 -0
- package/src/components/procedures/procedure-queues/index.ts +13 -0
- package/src/components/procedures/procedure-queues/procedure-form-extras.component.tsx +33 -0
- package/src/components/procedures/procedure-queues/procedure-form-extras.scss +5 -0
- package/src/components/procedures/procedure-queues/procedure-queues.component.tsx +35 -0
- package/src/components/procedures/procedure-queues/procedure-queues.resources.ts +37 -0
- package/src/components/procedures/procedure-queues/procedure-room-tabs.component.tsx +80 -0
- package/src/components/procedures/procedure-queues/procedure-rooms.scss +13 -0
- package/src/components/procedures/procedure-queues/queue-procedure-tabs.component.tsx +34 -0
- package/src/components/procedures/procedure-queues/summary-cards.component.tsx +81 -0
- package/src/components/procedures/procedure-queues/summary-cards.scss +35 -0
- package/src/components/procedures/procedures-table.component.tsx +42 -15
- package/src/components/procedures/procedures-tabs.component.test.tsx +57 -0
- package/src/components/procedures/procedures-tabs.component.tsx +3 -18
- package/src/components/radiology-and-imaging/index.ts +11 -0
- package/src/components/radiology-and-imaging/radiology-and-imaging-table.component.tsx +46 -14
- package/src/components/radiology-and-imaging/radiology-and-imaging.component.tsx +3 -19
- package/src/components/registration/card/Local-card/local-card.component.tsx +3 -3
- package/src/components/registration/checkin-form-extra/checkin-form-extra.extension.tsx +8 -2
- package/src/components/registration/checkin-form-extra/queue-fields.component.tsx +18 -19
- package/src/components/registration/checkin-form-extra/queue-fields.scss +0 -3
- package/src/components/registration/constant/index.ts +0 -9
- package/src/components/registration/dependants/dependants.component.tsx +43 -8
- package/src/components/registration/dependants/dependants.resource.ts +161 -15
- package/src/components/registration/end-visit-modal/end-visit-dialog.modal.tsx +320 -0
- package/src/components/registration/end-visit-modal/end-visit-dialog.scss +12 -0
- package/src/components/registration/end-visit-modal/end-visit.resource.tsx +59 -0
- package/src/components/registration/end-visit-modal/sha-end-visit.resource.ts +285 -0
- package/src/components/registration/helper/index.ts +27 -21
- package/src/components/registration/search-bar/search-bar.resource.ts +13 -5
- package/src/components/registration/start-visit-form/overflow-menu-extension/custom-end-active-visit.extension.tsx +44 -0
- package/src/components/registration/start-visit-form/overflow-menu-extension/overflow-menu-item.extension.tsx +32 -20
- package/src/components/registration/start-visit-form/start-visit-workspace/exported-visit-form.workspace.tsx +91 -26
- package/src/components/registration/start-visit-form/start-visit-workspace/visit-form.resource.ts +18 -0
- package/src/components/registration/start-visit-form/start-visit-workspace/visit-form.scss +2 -26
- package/src/components/registration/start-visit-form/visit-form-workspace/visit-form.workspace.tsx +1 -8
- package/src/components/registration/type/index.ts +102 -0
- package/src/components/reports/index.ts +1 -0
- package/src/config-schema.ts +433 -16
- package/src/hooks/useOrders.tsx +2 -2
- package/src/hooks/useServiceQueues.tsx +1 -1
- package/src/index.ts +69 -16
- package/src/routes.json +512 -45
- package/src/shared/dashboard-link/dashboard-link.component.tsx +11 -8
- package/src/shared/orders/OrderTable.scss +7 -0
- package/src/shared/orders/OrderTable.tsx +68 -8
- package/src/shared/orders/print-order/print-order.component.tsx +158 -0
- package/src/shared/orders/print-order/print-order.scss +225 -0
- package/src/shared/orders/print-prescription/print-prescription.component.tsx +65 -0
- package/src/shared/orders/print-prescription/print-prescription.resource.ts +45 -0
- package/src/shared/orders/print-prescription/print-prescription.scss +25 -0
- package/src/shared/otp-verification/index.ts +112 -29
- package/src/shared/otp-verification/otp-verification.modal.tsx +1110 -122
- package/src/shared/otp-verification/otp-verification.scss +374 -0
- package/src/shared/patient-chart/patient-summary-dashboard/patient-summary-dashboard.component.tsx +5 -84
- package/src/shared/tabs/create-tab-extension.tsx +33 -0
- package/src/shared/tabs/extension-tabs.component.tsx +51 -33
- package/src/shared/utils/index.ts +139 -3
- package/src/types/index.ts +12 -0
- package/translations/am.json +386 -123
- package/translations/en.json +276 -13
- package/translations/fr.json +372 -63
- package/translations/sw.json +295 -32
- package/tsconfig.json +1 -0
- package/.turbo/turbo-build.log +0 -8
- package/dist/1074.js +0 -1
- package/dist/1074.js.map +0 -1
- package/dist/12.js +0 -17
- package/dist/12.js.map +0 -1
- package/dist/1311.js +0 -1
- package/dist/1311.js.map +0 -1
- package/dist/1323.js +0 -1
- package/dist/1323.js.map +0 -1
- package/dist/1469.js +0 -1
- package/dist/1469.js.map +0 -1
- package/dist/1506.js +0 -13
- package/dist/1506.js.map +0 -1
- package/dist/1562.js +0 -1
- package/dist/1562.js.map +0 -1
- package/dist/1760.js +0 -1
- package/dist/1760.js.map +0 -1
- package/dist/1780.js +0 -1
- package/dist/1780.js.map +0 -1
- package/dist/1804.js +0 -1
- package/dist/1804.js.map +0 -1
- package/dist/1884.js +0 -1
- package/dist/1884.js.map +0 -1
- package/dist/1972.js +0 -1
- package/dist/1972.js.map +0 -1
- package/dist/1990.js +0 -1
- package/dist/1990.js.map +0 -1
- package/dist/2016.js +0 -1
- package/dist/2016.js.map +0 -1
- package/dist/2024.js +0 -1
- package/dist/2024.js.map +0 -1
- package/dist/2153.js +0 -1
- package/dist/2153.js.map +0 -1
- package/dist/216.js +0 -1
- package/dist/216.js.map +0 -1
- package/dist/2225.js +0 -1
- package/dist/2225.js.map +0 -1
- package/dist/2294.js +0 -1
- package/dist/2294.js.map +0 -1
- package/dist/2345.js +0 -1
- package/dist/2345.js.map +0 -1
- package/dist/2499.js +0 -1
- package/dist/2499.js.map +0 -1
- package/dist/2500.js +0 -1
- package/dist/2500.js.map +0 -1
- package/dist/2586.js +0 -1
- package/dist/2586.js.map +0 -1
- package/dist/2625.js +0 -1
- package/dist/2625.js.map +0 -1
- package/dist/2685.js +0 -1
- package/dist/2685.js.map +0 -1
- package/dist/2809.js +0 -1
- package/dist/2809.js.map +0 -1
- package/dist/2851.js +0 -1
- package/dist/2851.js.map +0 -1
- package/dist/2881.js +0 -1
- package/dist/2881.js.map +0 -1
- package/dist/2948.js +0 -1
- package/dist/2948.js.map +0 -1
- package/dist/2968.js +0 -1
- package/dist/2968.js.map +0 -1
- package/dist/2978.js +0 -1
- package/dist/2978.js.map +0 -1
- package/dist/2998.js +0 -1
- package/dist/2998.js.map +0 -1
- package/dist/3089.js +0 -1
- package/dist/3089.js.map +0 -1
- package/dist/3548.js +0 -1
- package/dist/3548.js.map +0 -1
- package/dist/3567.js +0 -1
- package/dist/3567.js.map +0 -1
- package/dist/3569.js +0 -1
- package/dist/3569.js.map +0 -1
- package/dist/3571.js +0 -1
- package/dist/3571.js.map +0 -1
- package/dist/3691.js +0 -1
- package/dist/3691.js.map +0 -1
- package/dist/3730.js +0 -1
- package/dist/3730.js.map +0 -1
- package/dist/3923.js +0 -1
- package/dist/3923.js.map +0 -1
- package/dist/3963.js +0 -1
- package/dist/3963.js.map +0 -1
- package/dist/4024.js +0 -1
- package/dist/4024.js.map +0 -1
- package/dist/405.js +0 -1
- package/dist/405.js.map +0 -1
- package/dist/4071.js +0 -1
- package/dist/4071.js.map +0 -1
- package/dist/4271.js +0 -1
- package/dist/4271.js.map +0 -1
- package/dist/4296.js +0 -1
- package/dist/4296.js.map +0 -1
- package/dist/4337.js +0 -1
- package/dist/4337.js.map +0 -1
- package/dist/4432.js +0 -1
- package/dist/4432.js.map +0 -1
- package/dist/4581.js +0 -1
- package/dist/4581.js.map +0 -1
- package/dist/4637.js +0 -11
- package/dist/4637.js.map +0 -1
- package/dist/4666.js +0 -1
- package/dist/4666.js.map +0 -1
- package/dist/4680.js +0 -1
- package/dist/4680.js.map +0 -1
- package/dist/4735.js +0 -1
- package/dist/4735.js.map +0 -1
- package/dist/4737.js +0 -1
- package/dist/4737.js.map +0 -1
- package/dist/4744.js +0 -1
- package/dist/4744.js.map +0 -1
- package/dist/4795.js +0 -1
- package/dist/4795.js.map +0 -1
- package/dist/4813.js +0 -2
- package/dist/4813.js.map +0 -1
- package/dist/4818.js +0 -1
- package/dist/4818.js.map +0 -1
- package/dist/4858.js +0 -1
- package/dist/4858.js.map +0 -1
- package/dist/487.js +0 -1
- package/dist/487.js.map +0 -1
- package/dist/4970.js +0 -1
- package/dist/4970.js.map +0 -1
- package/dist/5038.js +0 -1
- package/dist/5038.js.map +0 -1
- package/dist/5202.js +0 -1
- package/dist/5202.js.map +0 -1
- package/dist/5491.js +0 -1
- package/dist/5491.js.map +0 -1
- package/dist/5592.js +0 -1
- package/dist/5592.js.map +0 -1
- package/dist/5669.js +0 -1
- package/dist/5669.js.map +0 -1
- package/dist/586.js +0 -1
- package/dist/586.js.map +0 -1
- package/dist/5932.js +0 -1
- package/dist/5932.js.map +0 -1
- package/dist/5995.js +0 -1
- package/dist/5995.js.map +0 -1
- package/dist/6258.js +0 -1
- package/dist/6258.js.map +0 -1
- package/dist/629.js +0 -1
- package/dist/629.js.map +0 -1
- package/dist/6328.js +0 -1
- package/dist/6328.js.map +0 -1
- package/dist/6355.js +0 -1
- package/dist/6355.js.map +0 -1
- package/dist/6419.js +0 -1
- package/dist/6419.js.map +0 -1
- package/dist/644.js +0 -1
- package/dist/644.js.map +0 -1
- package/dist/6456.js +0 -1
- package/dist/6466.js +0 -3
- package/dist/6466.js.map +0 -1
- package/dist/655.js +0 -1
- package/dist/655.js.map +0 -1
- package/dist/6798.js +0 -66
- package/dist/6798.js.map +0 -1
- package/dist/6910.js +0 -1
- package/dist/6910.js.map +0 -1
- package/dist/6925.js +0 -1
- package/dist/6925.js.map +0 -1
- package/dist/70.js +0 -1
- package/dist/70.js.map +0 -1
- package/dist/7201.js +0 -1
- package/dist/7201.js.map +0 -1
- package/dist/7234.js +0 -1
- package/dist/7234.js.map +0 -1
- package/dist/7261.js +0 -1
- package/dist/7261.js.map +0 -1
- package/dist/7326.js +0 -1
- package/dist/7359.js +0 -1
- package/dist/7487.js +0 -1
- package/dist/7487.js.map +0 -1
- package/dist/7591.js +0 -1
- package/dist/7591.js.map +0 -1
- package/dist/7607.js +0 -1
- package/dist/7701.js +0 -1
- package/dist/7701.js.map +0 -1
- package/dist/7717.js +0 -1
- package/dist/7717.js.map +0 -1
- package/dist/7739.js +0 -1
- package/dist/7739.js.map +0 -1
- package/dist/7788.js +0 -1
- package/dist/7788.js.map +0 -1
- package/dist/7819.js +0 -1
- package/dist/7819.js.map +0 -1
- package/dist/7971.js +0 -1
- package/dist/7971.js.map +0 -1
- package/dist/7983.js +0 -1
- package/dist/7983.js.map +0 -1
- package/dist/807.js +0 -1
- package/dist/807.js.map +0 -1
- package/dist/8159.js +0 -7
- package/dist/8159.js.map +0 -1
- package/dist/8338.js +0 -1
- package/dist/8338.js.map +0 -1
- package/dist/845.js +0 -1
- package/dist/845.js.map +0 -1
- package/dist/8570.js +0 -1
- package/dist/8570.js.map +0 -1
- package/dist/8661.js +0 -1
- package/dist/8661.js.map +0 -1
- package/dist/87.js +0 -1
- package/dist/87.js.map +0 -1
- package/dist/8727.js +0 -1
- package/dist/8766.js +0 -1
- package/dist/8766.js.map +0 -1
- package/dist/8828.js +0 -1
- package/dist/8828.js.map +0 -1
- package/dist/8860.js +0 -1
- package/dist/8860.js.map +0 -1
- package/dist/8911.js +0 -1
- package/dist/8911.js.map +0 -1
- package/dist/8930.js +0 -1
- package/dist/8930.js.map +0 -1
- package/dist/8971.js +0 -1
- package/dist/8971.js.map +0 -1
- package/dist/9124.js +0 -1
- package/dist/9124.js.map +0 -1
- package/dist/9157.js +0 -1
- package/dist/9157.js.map +0 -1
- package/dist/9182.js +0 -1
- package/dist/921.js +0 -1
- package/dist/921.js.map +0 -1
- package/dist/9212.js +0 -1
- package/dist/9212.js.map +0 -1
- package/dist/9255.js +0 -1
- package/dist/9255.js.map +0 -1
- package/dist/9257.js +0 -1
- package/dist/9257.js.map +0 -1
- package/dist/9316.js +0 -1
- package/dist/9316.js.map +0 -1
- package/dist/9333.js +0 -1
- package/dist/9333.js.map +0 -1
- package/dist/9404.js +0 -1
- package/dist/9404.js.map +0 -1
- package/dist/9446.js +0 -1
- package/dist/9446.js.map +0 -1
- package/dist/9447.js +0 -1
- package/dist/9447.js.map +0 -1
- package/dist/9449.js +0 -1
- package/dist/9449.js.map +0 -1
- package/dist/9535.js +0 -1
- package/dist/9535.js.map +0 -1
- package/dist/9606.js +0 -1
- package/dist/9606.js.map +0 -1
- package/dist/973.js +0 -1
- package/dist/973.js.map +0 -1
- package/dist/9845.js +0 -1
- package/dist/9845.js.map +0 -1
- package/dist/kenyaemr-esm-express-workflow-app.js +0 -5
- package/dist/kenyaemr-esm-express-workflow-app.js.buildmanifest.json +0 -3521
- package/dist/kenyaemr-esm-express-workflow-app.js.map +0 -1
- package/dist/main.js +0 -5
- package/dist/main.js.map +0 -1
- package/dist/routes.json +0 -1
- package/src/shared/orders/OrdersTabs.tsx +0 -63
- package/src/shared/patient-chart/patient-chart.resources.ts +0 -180
- /package/src/shared/{patient-chart/patient-summary-dashboard → tabs}/patient-summary-dashboard.scss +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kenyaemr/esm-express-workflow-app",
|
|
3
|
-
"version": "5.4.
|
|
3
|
+
"version": "5.4.5-pre.16",
|
|
4
4
|
"description": "Express workflow app for OpenMRS 3",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"openmrs",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"build": "rspack --mode=production",
|
|
24
24
|
"coverage": "echo \"Jest has been removed; no unit test runner is configured\" && exit 0",
|
|
25
25
|
"debug": "npm run serve",
|
|
26
|
-
"extract-translations": "i18next 'src/**/*.
|
|
26
|
+
"extract-translations": "i18next 'src/**/*.{ts,tsx}' --config ../../tools/i18next-parser.config.js",
|
|
27
27
|
"lint": "cross-env eslint src --ext ts,tsx",
|
|
28
28
|
"serve": "rspack serve --mode=development",
|
|
29
29
|
"start": "openmrs develop",
|
|
@@ -53,5 +53,5 @@
|
|
|
53
53
|
"publishConfig": {
|
|
54
54
|
"access": "public"
|
|
55
55
|
},
|
|
56
|
-
"stableVersion": "5.4.
|
|
56
|
+
"stableVersion": "5.4.4"
|
|
57
57
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import React, { useMemo } from 'react';
|
|
2
1
|
import { Layer } from '@carbon/react';
|
|
3
2
|
import { ExtensionSlot } from '@openmrs/esm-framework';
|
|
3
|
+
import React, { useMemo } from 'react';
|
|
4
4
|
|
|
5
5
|
type AdmissionsDashboardProps = {
|
|
6
6
|
patientUuid: string;
|
|
7
|
-
patient:
|
|
7
|
+
patient: Record<string, unknown>;
|
|
8
8
|
};
|
|
9
9
|
|
|
10
10
|
const AdmissionsDashboard: React.FC<AdmissionsDashboardProps> = ({ patientUuid, patient }) => {
|
|
@@ -0,0 +1,442 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { useTranslation } from 'react-i18next';
|
|
3
|
+
import { useForm, Controller } from 'react-hook-form';
|
|
4
|
+
import { Modal, TextArea, TextInput, NumberInput, Select, SelectItem, Form, Grid, Column } from '@carbon/react';
|
|
5
|
+
import {
|
|
6
|
+
AMNIOTIC_FLUID_OPTIONS,
|
|
7
|
+
MOULDING_OPTIONS,
|
|
8
|
+
DESCENT_OF_HEAD_OPTIONS,
|
|
9
|
+
CONTRACTION_INTENSITY_OPTIONS,
|
|
10
|
+
URINE_LEVEL_OPTIONS,
|
|
11
|
+
BLOOD_GROUP_OPTIONS,
|
|
12
|
+
ADMISSION_OPTIONS,
|
|
13
|
+
TIME_SLOT_OPTIONS,
|
|
14
|
+
EVENT_TYPE_OPTIONS,
|
|
15
|
+
INPUT_RANGES,
|
|
16
|
+
getMeasurementLabel,
|
|
17
|
+
getFieldLabel,
|
|
18
|
+
getFieldPlaceholder,
|
|
19
|
+
getInputRangePlaceholder,
|
|
20
|
+
getGraphDataProcessor,
|
|
21
|
+
} from './types';
|
|
22
|
+
import styles from './anaesthetic-data-form.scss';
|
|
23
|
+
|
|
24
|
+
type Patient = {
|
|
25
|
+
name?: Array<{
|
|
26
|
+
given?: string[];
|
|
27
|
+
family?: string;
|
|
28
|
+
}>;
|
|
29
|
+
gender?: string;
|
|
30
|
+
birthDate?: string;
|
|
31
|
+
};
|
|
32
|
+
type PartographyFormData = {
|
|
33
|
+
admission: string;
|
|
34
|
+
bg: string;
|
|
35
|
+
am: string;
|
|
36
|
+
measurementValue: string;
|
|
37
|
+
systolic: string;
|
|
38
|
+
diastolic: string;
|
|
39
|
+
proteinLevel: string;
|
|
40
|
+
glucoseLevel: string;
|
|
41
|
+
ketoneLevel: string;
|
|
42
|
+
medication: string;
|
|
43
|
+
dosage: string;
|
|
44
|
+
eventType: string;
|
|
45
|
+
eventDescription: string;
|
|
46
|
+
amnioticFluid: string;
|
|
47
|
+
moulding: string;
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
type PartographyDataFormProps = {
|
|
51
|
+
isOpen: boolean;
|
|
52
|
+
onClose: () => void;
|
|
53
|
+
onSubmit: (data: any) => void;
|
|
54
|
+
graphType: string;
|
|
55
|
+
graphTitle: string;
|
|
56
|
+
patient?: Patient;
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
const PartographyDataForm: React.FC<PartographyDataFormProps> = ({
|
|
60
|
+
isOpen,
|
|
61
|
+
onClose,
|
|
62
|
+
onSubmit,
|
|
63
|
+
graphType,
|
|
64
|
+
graphTitle,
|
|
65
|
+
patient,
|
|
66
|
+
}) => {
|
|
67
|
+
const { t } = useTranslation();
|
|
68
|
+
|
|
69
|
+
const getPatientInfo = (patient?: Patient) => {
|
|
70
|
+
const getName = (): string => {
|
|
71
|
+
if (!patient?.name?.[0]) {
|
|
72
|
+
return '';
|
|
73
|
+
}
|
|
74
|
+
const name = patient.name[0];
|
|
75
|
+
const given = name.given?.join(' ') || '';
|
|
76
|
+
const family = name.family || '';
|
|
77
|
+
return `${given} ${family}`.trim();
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
const getGender = (): string => (patient?.gender ? t(patient.gender, patient.gender) : '');
|
|
81
|
+
|
|
82
|
+
const getAge = (): string => {
|
|
83
|
+
if (!patient?.birthDate) {
|
|
84
|
+
return '';
|
|
85
|
+
}
|
|
86
|
+
const birthDate = new Date(patient.birthDate);
|
|
87
|
+
const today = new Date();
|
|
88
|
+
const age = today.getFullYear() - birthDate.getFullYear();
|
|
89
|
+
const monthDiff = today.getMonth() - birthDate.getMonth();
|
|
90
|
+
const adjustedAge = monthDiff < 0 || (monthDiff === 0 && today.getDate() < birthDate.getDate()) ? age - 1 : age;
|
|
91
|
+
return `${adjustedAge} ${t('yearsOld', 'years old')}`;
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
return { name: getName(), gender: getGender(), age: getAge() };
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
const patientInfo = getPatientInfo(patient);
|
|
98
|
+
|
|
99
|
+
const { control, handleSubmit, reset } = useForm<PartographyFormData>({
|
|
100
|
+
defaultValues: {
|
|
101
|
+
admission: '',
|
|
102
|
+
bg: '',
|
|
103
|
+
am: '',
|
|
104
|
+
measurementValue: '',
|
|
105
|
+
systolic: '',
|
|
106
|
+
diastolic: '',
|
|
107
|
+
proteinLevel: '',
|
|
108
|
+
glucoseLevel: '',
|
|
109
|
+
ketoneLevel: '',
|
|
110
|
+
medication: '',
|
|
111
|
+
dosage: '',
|
|
112
|
+
eventType: '',
|
|
113
|
+
eventDescription: '',
|
|
114
|
+
amnioticFluid: '',
|
|
115
|
+
moulding: '',
|
|
116
|
+
},
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
const createNumberInput = (
|
|
120
|
+
id: string,
|
|
121
|
+
name: keyof PartographyFormData,
|
|
122
|
+
label: string,
|
|
123
|
+
placeholder: string,
|
|
124
|
+
range: any,
|
|
125
|
+
required = true,
|
|
126
|
+
) => (
|
|
127
|
+
<Controller
|
|
128
|
+
name={name}
|
|
129
|
+
control={control}
|
|
130
|
+
rules={required ? { required: t('fieldRequired', 'This field is required') } : {}}
|
|
131
|
+
render={({ field, fieldState }) => (
|
|
132
|
+
<NumberInput
|
|
133
|
+
id={id}
|
|
134
|
+
label={label}
|
|
135
|
+
placeholder={placeholder}
|
|
136
|
+
value={field.value || ''}
|
|
137
|
+
onChange={(e, { value }) => field.onChange(String(value))}
|
|
138
|
+
min={range.min}
|
|
139
|
+
max={range.max}
|
|
140
|
+
step={range.step}
|
|
141
|
+
invalid={!!fieldState.error}
|
|
142
|
+
invalidText={fieldState.error?.message}
|
|
143
|
+
required={required}
|
|
144
|
+
/>
|
|
145
|
+
)}
|
|
146
|
+
/>
|
|
147
|
+
);
|
|
148
|
+
|
|
149
|
+
const createSelect = (
|
|
150
|
+
id: string,
|
|
151
|
+
name: keyof PartographyFormData,
|
|
152
|
+
label: string,
|
|
153
|
+
options: readonly any[],
|
|
154
|
+
required = false,
|
|
155
|
+
) => (
|
|
156
|
+
<Controller
|
|
157
|
+
name={name}
|
|
158
|
+
control={control}
|
|
159
|
+
rules={required ? { required: t('fieldRequired', 'This field is required') } : {}}
|
|
160
|
+
render={({ field, fieldState }) => (
|
|
161
|
+
<Select
|
|
162
|
+
id={id}
|
|
163
|
+
labelText={label}
|
|
164
|
+
value={field.value}
|
|
165
|
+
onChange={(e) => field.onChange((e.target as HTMLSelectElement).value)}
|
|
166
|
+
invalid={!!fieldState.error}
|
|
167
|
+
invalidText={fieldState.error?.message}
|
|
168
|
+
required={required}>
|
|
169
|
+
{options.map((option) => (
|
|
170
|
+
<SelectItem
|
|
171
|
+
key={option.value || option.text}
|
|
172
|
+
value={option.value}
|
|
173
|
+
text={t(option.text as string, (option as any).display || option.text) as string}
|
|
174
|
+
/>
|
|
175
|
+
))}
|
|
176
|
+
</Select>
|
|
177
|
+
)}
|
|
178
|
+
/>
|
|
179
|
+
);
|
|
180
|
+
|
|
181
|
+
const createTextInput = (
|
|
182
|
+
id: string,
|
|
183
|
+
name: keyof PartographyFormData,
|
|
184
|
+
label: string,
|
|
185
|
+
placeholder: string,
|
|
186
|
+
required = true,
|
|
187
|
+
) => (
|
|
188
|
+
<Controller
|
|
189
|
+
name={name}
|
|
190
|
+
control={control}
|
|
191
|
+
rules={required ? { required: t('fieldRequired', 'This field is required') } : {}}
|
|
192
|
+
render={({ field, fieldState }) => (
|
|
193
|
+
<TextInput
|
|
194
|
+
id={id}
|
|
195
|
+
labelText={label}
|
|
196
|
+
placeholder={placeholder}
|
|
197
|
+
value={field.value || ''}
|
|
198
|
+
onChange={(e) => field.onChange((e.target as HTMLInputElement).value)}
|
|
199
|
+
invalid={!!fieldState.error}
|
|
200
|
+
invalidText={fieldState.error?.message}
|
|
201
|
+
required={required}
|
|
202
|
+
/>
|
|
203
|
+
)}
|
|
204
|
+
/>
|
|
205
|
+
);
|
|
206
|
+
|
|
207
|
+
const onSubmitForm = (data: PartographyFormData) => {
|
|
208
|
+
const processor = getGraphDataProcessor(graphType);
|
|
209
|
+
if (!processor.validate(data)) {
|
|
210
|
+
return;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
const dataPoint = {
|
|
214
|
+
time: new Date().toLocaleTimeString('en-US', { hour12: false, hour: '2-digit', minute: '2-digit' }),
|
|
215
|
+
value: processor.getValue(data),
|
|
216
|
+
graphType,
|
|
217
|
+
admission: data.admission,
|
|
218
|
+
bg: data.bg,
|
|
219
|
+
am: data.am,
|
|
220
|
+
timestamp: new Date(),
|
|
221
|
+
...processor.getAdditionalData(data),
|
|
222
|
+
};
|
|
223
|
+
|
|
224
|
+
onSubmit(dataPoint);
|
|
225
|
+
handleClose();
|
|
226
|
+
};
|
|
227
|
+
|
|
228
|
+
const handleClose = () => {
|
|
229
|
+
reset();
|
|
230
|
+
onClose();
|
|
231
|
+
};
|
|
232
|
+
|
|
233
|
+
const renderSpecificFields = () => {
|
|
234
|
+
const fieldConfigs = {
|
|
235
|
+
'fetal-heart-rate': () =>
|
|
236
|
+
createNumberInput(
|
|
237
|
+
'fetal-heart-rate-input',
|
|
238
|
+
'measurementValue',
|
|
239
|
+
getFieldLabel('fetalHeartRate', t),
|
|
240
|
+
getInputRangePlaceholder('fetal-heart-rate', t),
|
|
241
|
+
INPUT_RANGES['fetal-heart-rate'],
|
|
242
|
+
),
|
|
243
|
+
|
|
244
|
+
'cervical-dilation': () => (
|
|
245
|
+
<Grid>
|
|
246
|
+
<Column sm={4} md={4} lg={8}>
|
|
247
|
+
{createNumberInput(
|
|
248
|
+
'cervical-dilation-measurement',
|
|
249
|
+
'measurementValue',
|
|
250
|
+
getFieldLabel('cervicalDilation', t),
|
|
251
|
+
getInputRangePlaceholder('cervical-dilation', t),
|
|
252
|
+
INPUT_RANGES['cervical-dilation'],
|
|
253
|
+
)}
|
|
254
|
+
</Column>
|
|
255
|
+
<Column sm={4} md={4} lg={8}>
|
|
256
|
+
{createSelect('amniotic-fluid', 'amnioticFluid', getFieldLabel('amnioticFluid', t), AMNIOTIC_FLUID_OPTIONS)}
|
|
257
|
+
</Column>
|
|
258
|
+
<Column sm={4} md={4} lg={8}>
|
|
259
|
+
{createSelect('moulding', 'moulding', getFieldLabel('moulding', t), MOULDING_OPTIONS)}
|
|
260
|
+
</Column>
|
|
261
|
+
</Grid>
|
|
262
|
+
),
|
|
263
|
+
|
|
264
|
+
'descent-of-head': () =>
|
|
265
|
+
createSelect(
|
|
266
|
+
'descent-select',
|
|
267
|
+
'measurementValue',
|
|
268
|
+
getFieldLabel('descentOfHead', t),
|
|
269
|
+
DESCENT_OF_HEAD_OPTIONS,
|
|
270
|
+
true,
|
|
271
|
+
),
|
|
272
|
+
|
|
273
|
+
'uterine-contractions': () => (
|
|
274
|
+
<Grid>
|
|
275
|
+
<Column sm={4} md={4} lg={8}>
|
|
276
|
+
{createNumberInput(
|
|
277
|
+
'contraction-frequency',
|
|
278
|
+
'measurementValue',
|
|
279
|
+
getFieldLabel('frequency', t),
|
|
280
|
+
getInputRangePlaceholder('uterine-contractions', t),
|
|
281
|
+
INPUT_RANGES['uterine-contractions'],
|
|
282
|
+
)}
|
|
283
|
+
</Column>
|
|
284
|
+
<Column sm={4} md={4} lg={8}>
|
|
285
|
+
{createSelect(
|
|
286
|
+
'contraction-intensity',
|
|
287
|
+
'eventDescription',
|
|
288
|
+
getFieldLabel('intensity', t),
|
|
289
|
+
CONTRACTION_INTENSITY_OPTIONS,
|
|
290
|
+
)}
|
|
291
|
+
</Column>
|
|
292
|
+
</Grid>
|
|
293
|
+
),
|
|
294
|
+
|
|
295
|
+
'maternal-pulse': () =>
|
|
296
|
+
createNumberInput(
|
|
297
|
+
'maternal-pulse-input',
|
|
298
|
+
'measurementValue',
|
|
299
|
+
getFieldLabel('maternalPulse', t),
|
|
300
|
+
getInputRangePlaceholder('maternal-pulse', t),
|
|
301
|
+
INPUT_RANGES['maternal-pulse'],
|
|
302
|
+
),
|
|
303
|
+
|
|
304
|
+
'blood-pressure': () => (
|
|
305
|
+
<Grid>
|
|
306
|
+
<Column sm={4} md={4} lg={8}>
|
|
307
|
+
{createNumberInput(
|
|
308
|
+
'systolic-pressure',
|
|
309
|
+
'systolic',
|
|
310
|
+
getFieldLabel('systolic', t),
|
|
311
|
+
getInputRangePlaceholder('systolic-bp', t),
|
|
312
|
+
INPUT_RANGES['systolic-bp'],
|
|
313
|
+
)}
|
|
314
|
+
</Column>
|
|
315
|
+
<Column sm={4} md={4} lg={8}>
|
|
316
|
+
{createNumberInput(
|
|
317
|
+
'diastolic-pressure',
|
|
318
|
+
'diastolic',
|
|
319
|
+
getFieldLabel('diastolic', t),
|
|
320
|
+
getInputRangePlaceholder('diastolic-bp', t),
|
|
321
|
+
INPUT_RANGES['diastolic-bp'],
|
|
322
|
+
)}
|
|
323
|
+
</Column>
|
|
324
|
+
</Grid>
|
|
325
|
+
),
|
|
326
|
+
|
|
327
|
+
temperature: () =>
|
|
328
|
+
createNumberInput(
|
|
329
|
+
'temperature-input',
|
|
330
|
+
'measurementValue',
|
|
331
|
+
getFieldLabel('temperature', t),
|
|
332
|
+
getInputRangePlaceholder('temperature', t),
|
|
333
|
+
INPUT_RANGES.temperature,
|
|
334
|
+
),
|
|
335
|
+
|
|
336
|
+
'urine-analysis': () => (
|
|
337
|
+
<Grid>
|
|
338
|
+
<Column sm={4} md={2} lg={5}>
|
|
339
|
+
{createSelect('protein-level', 'proteinLevel', getFieldLabel('proteinLevel', t), URINE_LEVEL_OPTIONS)}
|
|
340
|
+
</Column>
|
|
341
|
+
<Column sm={4} md={3} lg={5}>
|
|
342
|
+
{createSelect('glucose-level', 'glucoseLevel', getFieldLabel('glucoseLevel', t), URINE_LEVEL_OPTIONS)}
|
|
343
|
+
</Column>
|
|
344
|
+
<Column sm={4} md={3} lg={6}>
|
|
345
|
+
{createSelect('ketone-level', 'ketoneLevel', getFieldLabel('ketoneLevel', t), URINE_LEVEL_OPTIONS)}
|
|
346
|
+
</Column>
|
|
347
|
+
</Grid>
|
|
348
|
+
),
|
|
349
|
+
|
|
350
|
+
'drugs-fluids': () => (
|
|
351
|
+
<Grid>
|
|
352
|
+
<Column sm={4} md={4} lg={8}>
|
|
353
|
+
{createTextInput(
|
|
354
|
+
'medication-input',
|
|
355
|
+
'medication',
|
|
356
|
+
getFieldLabel('medication', t),
|
|
357
|
+
getFieldPlaceholder('medicationType', t),
|
|
358
|
+
)}
|
|
359
|
+
</Column>
|
|
360
|
+
<Column sm={4} md={4} lg={8}>
|
|
361
|
+
{createTextInput(
|
|
362
|
+
'dosage-input',
|
|
363
|
+
'dosage',
|
|
364
|
+
getFieldLabel('dosageRate', t),
|
|
365
|
+
getFieldPlaceholder('dosageRate', t),
|
|
366
|
+
)}
|
|
367
|
+
</Column>
|
|
368
|
+
</Grid>
|
|
369
|
+
),
|
|
370
|
+
|
|
371
|
+
'progress-events': () => (
|
|
372
|
+
<Grid>
|
|
373
|
+
<Column sm={4} md={8} lg={16}>
|
|
374
|
+
{createSelect('event-type', 'eventType', getFieldLabel('eventType', t), EVENT_TYPE_OPTIONS, true)}
|
|
375
|
+
</Column>
|
|
376
|
+
<Column sm={4} md={8} lg={16}>
|
|
377
|
+
<Controller
|
|
378
|
+
name="eventDescription"
|
|
379
|
+
control={control}
|
|
380
|
+
rules={{ required: t('fieldRequired', 'This field is required') }}
|
|
381
|
+
render={({ field, fieldState }) => (
|
|
382
|
+
<TextArea
|
|
383
|
+
id="event-description"
|
|
384
|
+
labelText={getFieldLabel('eventDescription', t)}
|
|
385
|
+
placeholder={getFieldPlaceholder('eventDescription', t)}
|
|
386
|
+
value={field.value || ''}
|
|
387
|
+
onChange={(e) => field.onChange((e.target as HTMLTextAreaElement).value)}
|
|
388
|
+
invalid={!!fieldState.error}
|
|
389
|
+
invalidText={fieldState.error?.message}
|
|
390
|
+
rows={3}
|
|
391
|
+
required
|
|
392
|
+
/>
|
|
393
|
+
)}
|
|
394
|
+
/>
|
|
395
|
+
</Column>
|
|
396
|
+
</Grid>
|
|
397
|
+
),
|
|
398
|
+
};
|
|
399
|
+
|
|
400
|
+
const config = fieldConfigs[graphType as keyof typeof fieldConfigs];
|
|
401
|
+
return config
|
|
402
|
+
? config()
|
|
403
|
+
: createTextInput(
|
|
404
|
+
'general-measurement',
|
|
405
|
+
'measurementValue',
|
|
406
|
+
getMeasurementLabel(graphType, t, graphTitle),
|
|
407
|
+
getFieldPlaceholder('generalMeasurement', t),
|
|
408
|
+
);
|
|
409
|
+
};
|
|
410
|
+
|
|
411
|
+
return (
|
|
412
|
+
<Modal
|
|
413
|
+
open={isOpen}
|
|
414
|
+
onRequestClose={onClose}
|
|
415
|
+
modalHeading={`${getMeasurementLabel(graphType, t, graphTitle)} Data`}
|
|
416
|
+
modalLabel={`${patientInfo.name}, ${patientInfo.gender}, ${patientInfo.age}`}
|
|
417
|
+
primaryButtonText={t('save', 'Save')}
|
|
418
|
+
secondaryButtonText={t('cancel', 'Cancel')}
|
|
419
|
+
onRequestSubmit={handleSubmit(onSubmitForm)}
|
|
420
|
+
onSecondarySubmit={handleClose}
|
|
421
|
+
size="lg">
|
|
422
|
+
<div className={styles.modalContent}>
|
|
423
|
+
<Form onSubmit={handleSubmit(onSubmitForm)}>
|
|
424
|
+
<Grid>
|
|
425
|
+
<Column sm={4} md={8} lg={5}>
|
|
426
|
+
{createSelect('admission-select', 'admission', getFieldLabel('admission', t), ADMISSION_OPTIONS)}
|
|
427
|
+
</Column>
|
|
428
|
+
<Column sm={4} md={8} lg={5}>
|
|
429
|
+
{createSelect('bg-select', 'bg', getFieldLabel('bg', t), BLOOD_GROUP_OPTIONS)}
|
|
430
|
+
</Column>
|
|
431
|
+
<Column sm={4} md={8} lg={6}>
|
|
432
|
+
{createSelect('am-select', 'am', getFieldLabel('am', t), TIME_SLOT_OPTIONS)}
|
|
433
|
+
</Column>
|
|
434
|
+
</Grid>
|
|
435
|
+
<div className={styles.measurementSection}>{renderSpecificFields()}</div>
|
|
436
|
+
</Form>
|
|
437
|
+
</div>
|
|
438
|
+
</Modal>
|
|
439
|
+
);
|
|
440
|
+
};
|
|
441
|
+
|
|
442
|
+
export default PartographyDataForm;
|