@kenyaemr/esm-billing-app 5.4.1-pre.1935 → 5.4.1-pre.1936
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/.turbo/turbo-build.log +68 -68
- package/dist/{202.js → 308.js} +1 -1
- package/dist/308.js.map +1 -0
- package/dist/kenyaemr-esm-billing-app.js +1 -1
- package/dist/kenyaemr-esm-billing-app.js.buildmanifest.json +28 -28
- package/dist/main.js +1 -1
- package/dist/main.js.map +1 -1
- package/dist/routes.json +1 -1
- package/package.json +1 -1
- package/src/benefits-package/benefits-package.resources.tsx +1 -1
- package/src/benefits-package/forms/benefit-pre-auth-form.workspace.tsx +8 -52
- package/src/benefits-package/forms/{package-interventions.component.tsx → interventions-form.component.tsx} +25 -13
- package/src/benefits-package/forms/packages-and-interventions-form.component.tsx +72 -0
- package/src/billing-form/billing-checkin-form.component.tsx +6 -1
- package/src/billing-form/check-in-form.utils.tsx +2 -0
- package/src/billing-form/visit-attributes/visit-attributes-form.component.tsx +13 -3
- package/src/claims/dashboard/form/claims-form.component.tsx +28 -59
- package/src/claims/dashboard/form/claims-form.resource.ts +18 -2
- package/src/config-schema.ts +6 -0
- package/src/constants.ts +1 -0
- package/src/hooks/useInterventions.ts +19 -21
- package/src/types/index.ts +1 -0
- package/dist/202.js.map +0 -1
package/dist/routes.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"$schema":"https://json.openmrs.org/routes.schema.json","backendDependencies":{"kenyaemr":"^19.0.0"},"pages":[{"component":"billableServicesHome","route":"billable-services"},{"component":"requirePaymentModal","routeRegex":"^patient/.+/chart","online":true,"offline":false}],"extensions":[{"component":"billingDashboardLink","name":"billing-dashboard-link","slot":"homepage-dashboard-slot","meta":{"name":"billing","title":"billing","slot":"billing-dashboard-slot"}},{"component":"benefitsPackageDashboardLink","name":"benefits-package-dashboard-link","slot":"patient-chart-dashboard-slot","meta":{"name":"benefits-package","slot":"patient-chart-benefits-dashboard-slot","path":"insurance-benefits","columns":1,"columnSpan":1},"featureFlag":"healthInformationExchange"},{"component":"benefitsPackage","name":"benefits-package","slot":"patient-chart-benefits-dashboard-slot"},{"component":"root","name":"billing-dashboard-root","slot":"billing-dashboard-slot"},{"component":"benefitsEligibilyRequestForm","name":"benefits-eligibility-request-form"},{"component":"benefitsPreAuthForm","name":"benefits-pre-auth-form"},{"name":"billing-patient-summary","component":"billingPatientSummary","slot":"patient-chart-billing-dashboard-slot","order":10,"meta":{"columnSpan":4}},{"name":"billing-summary-dashboard-link","component":"billingSummaryDashboardLink","slot":"patient-chart-dashboard-slot","order":11,"meta":{"columns":1,"columnSpan":1,"slot":"patient-chart-billing-dashboard-slot","path":"Billing","layoutMode":"anchored"}},{"name":"billing-check-in-form","slot":"extra-visit-attribute-slot","component":"billingCheckInForm"},{"name":"require-billing-modal","component":"requirePaymentModal"},{"name":"patient-banner-billing-tags","component":"visitAttributeTags","slot":"patient-banner-tags-slot","order":2},{"name":"initiate-payment-modal","component":"initiatePaymentDialog"},{"name":"delete-billableservice-modal","component":"deleteBillableServiceModal"},{"name":"refund-bill-modal","component":"refundBillModal"},{"name":"delete-bill-modal","component":"deleteBillModal"},{"name":"lab-order-billable-item","component":"labOrder","slot":"top-of-lab-order-form-slot"},{"name":"procedure-order-billable-item","component":"procedureOrder","slot":"top-of-procedure-order-form-slot"},{"name":"imaging-order-billable-item","component":"imagingOrder","slot":"top-of-imaging-order-form-slot"},{"name":"price-info-order","component":"priceInfoOrder"},{"name":"drug-order-billable-item","component":"drugOrder","slot":"medication-info-slot"},{"name":"billing-test-order-action","component":"testOrderAction","slot":"tests-ordered-actions-slot","order":0},{"component":"billingOverviewLink","name":"billing-overview-link","order":0,"slot":"billing-dashboard-link-slot"},{"component":"paymentHistoryLink","name":"payment-history-link","slot":"billing-dashboard-link-slot"},{"component":"paymentPointsLink","name":"payment-points-link","slot":"billing-dashboard-link-slot"},{"component":"paymentModesLink","name":"payment-modes-link","slot":"billing-dashboard-link-slot"},{"component":"billManagerLink","name":"bill-manager-link","slot":"billing-dashboard-link-slot"},{"component":"chargeableItemsLink","name":"chargeable-items-link","slot":"billing-dashboard-link-slot"},{"component":"billableExemptionsLink","name":"billable-exemptions-link","slot":"billing-dashboard-link-slot"},{"component":"claimsManagementSideNavGroup","name":"claims-management-dashboard-link","slot":"homepage-dashboard-slot","meta":{"name":"claims-management","title":"Claims management Overview","slot":"case-management-slot"},"featureFlag":"healthInformationExchange"},{"component":"claimsManagementOverviewDashboardLink","name":"claims-management-overview-link","order":0,"slot":"claims-management-dashboard-link-slot"},{"component":"preAuthRequestsDashboardLink","name":"preauthrequest-overview-link","slot":"claims-management-dashboard-link-slot"},{"component":"claimsOverview","name":"claims-overview-dashboard-link","slot":"claims-management-overview-slot"},{"component":"waiveBillActionButton","name":"waive-bill-action-button","slot":"bill-actions-slot"},{"component":"deleteBillActionButton","name":"delete-bill-action-button","slot":"bill-actions-slot"},{"component":"refundLineItem","name":"refund-line-item","slot":"bill-actions-overflow-menu-slot"},{"name":"edit-line-item","component":"editLineItem","slot":"bill-actions-overflow-menu-slot"},{"name":"cancel-line-item","component":"cancelLineItem","slot":"bill-actions-overflow-menu-slot"}],"workspaces":[{"name":"waive-bill-form","component":"waiveBillForm","title":"Waive Bill Form","type":"other-form"},{"name":"edit-bill-form","component":"editBillForm","title":"Edit Bill Form","type":"other-form"},{"name":"billable-service-form","component":"addServiceForm","title":"Create Charge Item Form","type":"other-form"},{"name":"commodity-form","component":"addCommodityForm","title":"Create Charge Item Form","type":"other-form"},{"name":"billing-form","component":"billingForm","title":"Billing Form","type":"other-form","width":"extra-wide"},{"name":"payment-mode-workspace","component":"paymentModeWorkspace","title":"Payment Mode Workspace","type":"other-form"},{"name":"cancel-bill-workspace","component":"cancelBillWorkspace","title":"Cancel Bill Workspace","type":"other-form"}],"modals":[{"name":"create-payment-point","component":"createPaymentPoint"},{"name":"clock-out-modal","component":"clockOut"},{"name":"bulk-import-billable-services-modal","component":"bulkImportBillableServicesModal"},{"name":"delete-payment-mode-modal","component":"deletePaymentModeModal"},{"name":"retry-claim-request-modal","component":"retryClaimRequestModal"},{"name":"paid-bill-receipt-print-preview-modal","component":"paidBillReceiptPrintPreviewModal"},{"name":"clock-in-modal","component":"clockIn"},{"name":"create-bill-item-modal","component":"createBillItemModal"}],"version":"5.4.1-pre.
|
|
1
|
+
{"$schema":"https://json.openmrs.org/routes.schema.json","backendDependencies":{"kenyaemr":"^19.0.0"},"pages":[{"component":"billableServicesHome","route":"billable-services"},{"component":"requirePaymentModal","routeRegex":"^patient/.+/chart","online":true,"offline":false}],"extensions":[{"component":"billingDashboardLink","name":"billing-dashboard-link","slot":"homepage-dashboard-slot","meta":{"name":"billing","title":"billing","slot":"billing-dashboard-slot"}},{"component":"benefitsPackageDashboardLink","name":"benefits-package-dashboard-link","slot":"patient-chart-dashboard-slot","meta":{"name":"benefits-package","slot":"patient-chart-benefits-dashboard-slot","path":"insurance-benefits","columns":1,"columnSpan":1},"featureFlag":"healthInformationExchange"},{"component":"benefitsPackage","name":"benefits-package","slot":"patient-chart-benefits-dashboard-slot"},{"component":"root","name":"billing-dashboard-root","slot":"billing-dashboard-slot"},{"component":"benefitsEligibilyRequestForm","name":"benefits-eligibility-request-form"},{"component":"benefitsPreAuthForm","name":"benefits-pre-auth-form"},{"name":"billing-patient-summary","component":"billingPatientSummary","slot":"patient-chart-billing-dashboard-slot","order":10,"meta":{"columnSpan":4}},{"name":"billing-summary-dashboard-link","component":"billingSummaryDashboardLink","slot":"patient-chart-dashboard-slot","order":11,"meta":{"columns":1,"columnSpan":1,"slot":"patient-chart-billing-dashboard-slot","path":"Billing","layoutMode":"anchored"}},{"name":"billing-check-in-form","slot":"extra-visit-attribute-slot","component":"billingCheckInForm"},{"name":"require-billing-modal","component":"requirePaymentModal"},{"name":"patient-banner-billing-tags","component":"visitAttributeTags","slot":"patient-banner-tags-slot","order":2},{"name":"initiate-payment-modal","component":"initiatePaymentDialog"},{"name":"delete-billableservice-modal","component":"deleteBillableServiceModal"},{"name":"refund-bill-modal","component":"refundBillModal"},{"name":"delete-bill-modal","component":"deleteBillModal"},{"name":"lab-order-billable-item","component":"labOrder","slot":"top-of-lab-order-form-slot"},{"name":"procedure-order-billable-item","component":"procedureOrder","slot":"top-of-procedure-order-form-slot"},{"name":"imaging-order-billable-item","component":"imagingOrder","slot":"top-of-imaging-order-form-slot"},{"name":"price-info-order","component":"priceInfoOrder"},{"name":"drug-order-billable-item","component":"drugOrder","slot":"medication-info-slot"},{"name":"billing-test-order-action","component":"testOrderAction","slot":"tests-ordered-actions-slot","order":0},{"component":"billingOverviewLink","name":"billing-overview-link","order":0,"slot":"billing-dashboard-link-slot"},{"component":"paymentHistoryLink","name":"payment-history-link","slot":"billing-dashboard-link-slot"},{"component":"paymentPointsLink","name":"payment-points-link","slot":"billing-dashboard-link-slot"},{"component":"paymentModesLink","name":"payment-modes-link","slot":"billing-dashboard-link-slot"},{"component":"billManagerLink","name":"bill-manager-link","slot":"billing-dashboard-link-slot"},{"component":"chargeableItemsLink","name":"chargeable-items-link","slot":"billing-dashboard-link-slot"},{"component":"billableExemptionsLink","name":"billable-exemptions-link","slot":"billing-dashboard-link-slot"},{"component":"claimsManagementSideNavGroup","name":"claims-management-dashboard-link","slot":"homepage-dashboard-slot","meta":{"name":"claims-management","title":"Claims management Overview","slot":"case-management-slot"},"featureFlag":"healthInformationExchange"},{"component":"claimsManagementOverviewDashboardLink","name":"claims-management-overview-link","order":0,"slot":"claims-management-dashboard-link-slot"},{"component":"preAuthRequestsDashboardLink","name":"preauthrequest-overview-link","slot":"claims-management-dashboard-link-slot"},{"component":"claimsOverview","name":"claims-overview-dashboard-link","slot":"claims-management-overview-slot"},{"component":"waiveBillActionButton","name":"waive-bill-action-button","slot":"bill-actions-slot"},{"component":"deleteBillActionButton","name":"delete-bill-action-button","slot":"bill-actions-slot"},{"component":"refundLineItem","name":"refund-line-item","slot":"bill-actions-overflow-menu-slot"},{"name":"edit-line-item","component":"editLineItem","slot":"bill-actions-overflow-menu-slot"},{"name":"cancel-line-item","component":"cancelLineItem","slot":"bill-actions-overflow-menu-slot"}],"workspaces":[{"name":"waive-bill-form","component":"waiveBillForm","title":"Waive Bill Form","type":"other-form"},{"name":"edit-bill-form","component":"editBillForm","title":"Edit Bill Form","type":"other-form"},{"name":"billable-service-form","component":"addServiceForm","title":"Create Charge Item Form","type":"other-form"},{"name":"commodity-form","component":"addCommodityForm","title":"Create Charge Item Form","type":"other-form"},{"name":"billing-form","component":"billingForm","title":"Billing Form","type":"other-form","width":"extra-wide"},{"name":"payment-mode-workspace","component":"paymentModeWorkspace","title":"Payment Mode Workspace","type":"other-form"},{"name":"cancel-bill-workspace","component":"cancelBillWorkspace","title":"Cancel Bill Workspace","type":"other-form"}],"modals":[{"name":"create-payment-point","component":"createPaymentPoint"},{"name":"clock-out-modal","component":"clockOut"},{"name":"bulk-import-billable-services-modal","component":"bulkImportBillableServicesModal"},{"name":"delete-payment-mode-modal","component":"deletePaymentModeModal"},{"name":"retry-claim-request-modal","component":"retryClaimRequestModal"},{"name":"paid-bill-receipt-print-preview-modal","component":"paidBillReceiptPrintPreviewModal"},{"name":"clock-in-modal","component":"clockIn"},{"name":"create-bill-item-modal","component":"createBillItemModal"}],"version":"5.4.1-pre.1936"}
|
package/package.json
CHANGED
|
@@ -16,7 +16,7 @@ export const preauthSchema = z.object({
|
|
|
16
16
|
providerUuid: z.string().uuid(),
|
|
17
17
|
facilityUuid: z.string().uuid(),
|
|
18
18
|
diagnosisUuids: z.array(z.string()),
|
|
19
|
-
|
|
19
|
+
packages: z.array(z.string()).nonempty('Require atleast 1 package'),
|
|
20
20
|
interventions: z.array(z.string()).nonempty('Require atleast 1 intervention'),
|
|
21
21
|
});
|
|
22
22
|
|
|
@@ -5,16 +5,15 @@ import {
|
|
|
5
5
|
DropdownSkeleton,
|
|
6
6
|
Form,
|
|
7
7
|
FormLabel,
|
|
8
|
-
InlineNotification,
|
|
9
8
|
Layer,
|
|
10
9
|
Loading,
|
|
11
10
|
MultiSelect,
|
|
12
11
|
Stack,
|
|
13
|
-
Tile,
|
|
14
12
|
} from '@carbon/react';
|
|
15
13
|
import { DocumentAttachment } from '@carbon/react/icons';
|
|
16
14
|
import { zodResolver } from '@hookform/resolvers/zod';
|
|
17
15
|
import { DefaultWorkspaceProps, showSnackbar, useSession } from '@openmrs/esm-framework';
|
|
16
|
+
import { ErrorState } from '@openmrs/esm-patient-common-lib';
|
|
18
17
|
import React, { useEffect, useRef, useState } from 'react';
|
|
19
18
|
import { Controller, FormProvider, useForm } from 'react-hook-form';
|
|
20
19
|
import { useTranslation } from 'react-i18next';
|
|
@@ -22,14 +21,12 @@ import { z } from 'zod';
|
|
|
22
21
|
import { useVisit } from '../../claims/dashboard/form/claims-form.resource';
|
|
23
22
|
import { MAX_ALLOWED_FILE_SIZE } from '../../constants';
|
|
24
23
|
import { useSystemSetting } from '../../hooks/getMflCode';
|
|
25
|
-
import usePackages from '../../hooks/usePackages';
|
|
26
24
|
import usePatientDiagnosis from '../../hooks/usePatientDiagnosis';
|
|
27
25
|
import useProvider from '../../hooks/useProvider';
|
|
28
26
|
import { PatientBenefit } from '../../types';
|
|
29
27
|
import { preAuthenticateBenefit, preauthSchema } from '../benefits-package.resources';
|
|
30
28
|
import styles from './benefits-pre-auth-form.scss';
|
|
31
|
-
import
|
|
32
|
-
import { ErrorState } from '@openmrs/esm-patient-common-lib';
|
|
29
|
+
import SHABenefitPackangesAndInterventions from './packages-and-interventions-form.component';
|
|
33
30
|
|
|
34
31
|
type BenefitsPreAuth = z.infer<typeof preauthSchema>;
|
|
35
32
|
|
|
@@ -41,7 +38,7 @@ interface BenefitPreAuthFormProps extends DefaultWorkspaceProps {
|
|
|
41
38
|
|
|
42
39
|
const BenefitPreAuthForm: React.FC<BenefitPreAuthFormProps> = ({ closeWorkspace, patientUuid }) => {
|
|
43
40
|
const { t } = useTranslation();
|
|
44
|
-
const { visits: recentVisit, isLoading } = useVisit(patientUuid);
|
|
41
|
+
const { visits: recentVisit, isLoading, error: visitError } = useVisit(patientUuid);
|
|
45
42
|
const { isLoading: diagnosesLoading, diagnoses } = usePatientDiagnosis(patientUuid);
|
|
46
43
|
const inputFileRef = useRef<HTMLInputElement>();
|
|
47
44
|
const [uploadedFile, setUploadedFile] = useState<File | null>(null);
|
|
@@ -53,7 +50,6 @@ const BenefitPreAuthForm: React.FC<BenefitPreAuthFormProps> = ({ closeWorkspace,
|
|
|
53
50
|
sessionLocation: { uuid: facilityUuid, display: facilityName },
|
|
54
51
|
} = useSession();
|
|
55
52
|
const { providerLoading: providerLoading, provider } = useProvider(providerUuid);
|
|
56
|
-
const { isLoading: packagesLoading, error: packageError, packages } = usePackages();
|
|
57
53
|
|
|
58
54
|
const form = useForm<BenefitsPreAuth>({
|
|
59
55
|
defaultValues: {
|
|
@@ -62,6 +58,7 @@ const BenefitPreAuthForm: React.FC<BenefitPreAuthFormProps> = ({ closeWorkspace,
|
|
|
62
58
|
facilityUuid,
|
|
63
59
|
diagnosisUuids: [],
|
|
64
60
|
interventions: [],
|
|
61
|
+
packages: [],
|
|
65
62
|
},
|
|
66
63
|
resolver: zodResolver(preauthSchema),
|
|
67
64
|
});
|
|
@@ -104,9 +101,7 @@ const BenefitPreAuthForm: React.FC<BenefitPreAuthFormProps> = ({ closeWorkspace,
|
|
|
104
101
|
}
|
|
105
102
|
};
|
|
106
103
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
if (packagesLoading || diagnosesLoading || isLoading || providerLoading) {
|
|
104
|
+
if (diagnosesLoading || isLoading || providerLoading) {
|
|
110
105
|
return (
|
|
111
106
|
<Layer className={styles.loading}>
|
|
112
107
|
<Loading withOverlay={false} small />
|
|
@@ -114,10 +109,10 @@ const BenefitPreAuthForm: React.FC<BenefitPreAuthFormProps> = ({ closeWorkspace,
|
|
|
114
109
|
);
|
|
115
110
|
}
|
|
116
111
|
|
|
117
|
-
if (
|
|
112
|
+
if (visitError) {
|
|
118
113
|
return (
|
|
119
114
|
<Layer className={styles.error}>
|
|
120
|
-
<ErrorState error={
|
|
115
|
+
<ErrorState error={visitError} headerTitle={t('errorMessage', 'Error')} />
|
|
121
116
|
</Layer>
|
|
122
117
|
);
|
|
123
118
|
}
|
|
@@ -206,46 +201,7 @@ const BenefitPreAuthForm: React.FC<BenefitPreAuthFormProps> = ({ closeWorkspace,
|
|
|
206
201
|
)}
|
|
207
202
|
/>
|
|
208
203
|
</Column>
|
|
209
|
-
<
|
|
210
|
-
<Controller
|
|
211
|
-
control={form.control}
|
|
212
|
-
name="packageUUid"
|
|
213
|
-
render={({ field }) => (
|
|
214
|
-
<>
|
|
215
|
-
{packageError ? (
|
|
216
|
-
<InlineNotification
|
|
217
|
-
kind="error"
|
|
218
|
-
subtitle={t('errorFetchingPackages', 'Error fetching packeges')}
|
|
219
|
-
lowContrast
|
|
220
|
-
/>
|
|
221
|
-
) : (
|
|
222
|
-
<Dropdown
|
|
223
|
-
ref={field.ref}
|
|
224
|
-
invalid={form.formState.errors[field.name]?.message}
|
|
225
|
-
invalidText={form.formState.errors[field.name]?.message}
|
|
226
|
-
id="package"
|
|
227
|
-
titleText={t('package', 'Package')}
|
|
228
|
-
onChange={(e) => {
|
|
229
|
-
field.onChange(e.selectedItem);
|
|
230
|
-
}}
|
|
231
|
-
initialSelectedItem={field.value}
|
|
232
|
-
label="Choose package"
|
|
233
|
-
items={packages.map((r) => r.uuid)}
|
|
234
|
-
itemToString={(item) => packages.find((r) => r.uuid === item)?.packageName ?? ''}
|
|
235
|
-
/>
|
|
236
|
-
)}
|
|
237
|
-
</>
|
|
238
|
-
)}
|
|
239
|
-
/>
|
|
240
|
-
</Column>
|
|
241
|
-
{selectedPackageObservable && (
|
|
242
|
-
<Column>
|
|
243
|
-
<PackageInterventions
|
|
244
|
-
category={packages.find((package_) => package_.uuid === selectedPackageObservable)?.packageCode ?? ''}
|
|
245
|
-
patientUuid={patientUuid}
|
|
246
|
-
/>
|
|
247
|
-
</Column>
|
|
248
|
-
)}
|
|
204
|
+
<SHABenefitPackangesAndInterventions patientUuid={patientUuid} />
|
|
249
205
|
<Column>
|
|
250
206
|
<Controller
|
|
251
207
|
control={form.control}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { useEffect, useMemo } from 'react';
|
|
2
2
|
import { InlineLoading, InlineNotification, MultiSelect } from '@carbon/react';
|
|
3
3
|
import { Controller, useFormContext } from 'react-hook-form';
|
|
4
4
|
import { useTranslation } from 'react-i18next';
|
|
@@ -10,19 +10,35 @@ import { usePatient } from '@openmrs/esm-framework';
|
|
|
10
10
|
type EligibilityRequest = z.infer<typeof eligibilityRequestShema>;
|
|
11
11
|
|
|
12
12
|
type PackageInterventionsProps = {
|
|
13
|
-
|
|
13
|
+
categories: Array<string>;
|
|
14
14
|
patientUuid: string;
|
|
15
15
|
};
|
|
16
|
-
const PackageInterventions: React.FC<PackageInterventionsProps> = ({
|
|
16
|
+
const PackageInterventions: React.FC<PackageInterventionsProps> = ({ categories, patientUuid }) => {
|
|
17
17
|
const { error: patientError, isLoading: isPatientLoading, patient } = usePatient(patientUuid);
|
|
18
18
|
const filters: InterventionsFilter = {
|
|
19
|
-
package_code:
|
|
19
|
+
package_code: categories.join(','),
|
|
20
20
|
applicable_gender: patient?.gender === 'male' ? 'MALE' : 'FEMALE',
|
|
21
21
|
};
|
|
22
|
-
const { error, interventions, isLoading } = useInterventions(filters);
|
|
22
|
+
const { error, interventions, isLoading, allInterventions } = useInterventions(filters);
|
|
23
23
|
|
|
24
|
-
const form = useFormContext<
|
|
24
|
+
const form = useFormContext<{ packages: Array<string>; interventions: Array<string> }>();
|
|
25
25
|
const { t } = useTranslation();
|
|
26
|
+
const selectedInterventionsObservable = form.watch('interventions');
|
|
27
|
+
|
|
28
|
+
const interventions_ = useMemo(() => {
|
|
29
|
+
const additionalInterventions = selectedInterventionsObservable.reduce((prev, curr) => {
|
|
30
|
+
const interventionContainedInOptions = interventions.some((i) => i.interventionCode === curr);
|
|
31
|
+
if (!interventionContainedInOptions) {
|
|
32
|
+
const intervention = allInterventions.find((i) => i.interventionCode === curr);
|
|
33
|
+
if (intervention) {
|
|
34
|
+
prev.push(intervention);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
return prev;
|
|
38
|
+
}, [] as typeof allInterventions);
|
|
39
|
+
|
|
40
|
+
return [...interventions, ...additionalInterventions];
|
|
41
|
+
}, [allInterventions, interventions, selectedInterventionsObservable]);
|
|
26
42
|
|
|
27
43
|
if (isLoading || isPatientLoading) {
|
|
28
44
|
return (
|
|
@@ -47,10 +63,6 @@ const PackageInterventions: React.FC<PackageInterventionsProps> = ({ category, p
|
|
|
47
63
|
);
|
|
48
64
|
}
|
|
49
65
|
|
|
50
|
-
if (interventions.length === 0) {
|
|
51
|
-
return null;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
66
|
return (
|
|
55
67
|
<Controller
|
|
56
68
|
control={form.control}
|
|
@@ -65,10 +77,10 @@ const PackageInterventions: React.FC<PackageInterventionsProps> = ({ category, p
|
|
|
65
77
|
onChange={(e) => {
|
|
66
78
|
field.onChange(e.selectedItems);
|
|
67
79
|
}}
|
|
68
|
-
|
|
80
|
+
selectedItems={field.value}
|
|
69
81
|
label={t('chooseInterventions', 'Choose interventions')}
|
|
70
|
-
items={
|
|
71
|
-
itemToString={(item) =>
|
|
82
|
+
items={interventions_.map((r) => r.interventionCode)}
|
|
83
|
+
itemToString={(item) => interventions_.find((r) => r.interventionCode === item)?.interventionName ?? ''}
|
|
72
84
|
/>
|
|
73
85
|
)}
|
|
74
86
|
/>
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { Column, InlineLoading, InlineNotification, MultiSelect } from '@carbon/react';
|
|
2
|
+
import React, { useEffect } from 'react';
|
|
3
|
+
import { Controller, useFormContext } from 'react-hook-form';
|
|
4
|
+
import { useTranslation } from 'react-i18next';
|
|
5
|
+
import PackageInterventions from './interventions-form.component';
|
|
6
|
+
import usePackages from '../../hooks/usePackages';
|
|
7
|
+
|
|
8
|
+
type Props = {
|
|
9
|
+
patientUuid: string;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
const SHABenefitPackangesAndInterventions: React.FC<Props> = ({ patientUuid }) => {
|
|
13
|
+
const form = useFormContext<{ packages: Array<string>; interventions: Array<string> }>();
|
|
14
|
+
const { isLoading: packagesLoading, error: packageError, packages } = usePackages();
|
|
15
|
+
const { t } = useTranslation();
|
|
16
|
+
const selectedPackageObservable = form.watch('packages');
|
|
17
|
+
|
|
18
|
+
if (packagesLoading) {
|
|
19
|
+
return (
|
|
20
|
+
<InlineLoading description={t('loading', 'Loading')} iconDescription={t('loading', 'Loading data') + '...'} />
|
|
21
|
+
);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
return (
|
|
25
|
+
<>
|
|
26
|
+
<Column>
|
|
27
|
+
<Controller
|
|
28
|
+
control={form.control}
|
|
29
|
+
name="packages"
|
|
30
|
+
render={({ field }) => (
|
|
31
|
+
<>
|
|
32
|
+
{packageError ? (
|
|
33
|
+
<InlineNotification
|
|
34
|
+
kind="error"
|
|
35
|
+
subtitle={t('errorFetchingPackages', 'Error fetching packeges')}
|
|
36
|
+
lowContrast
|
|
37
|
+
/>
|
|
38
|
+
) : (
|
|
39
|
+
<MultiSelect
|
|
40
|
+
ref={field.ref}
|
|
41
|
+
invalid={form.formState.errors[field.name]?.message}
|
|
42
|
+
invalidText={form.formState.errors[field.name]?.message}
|
|
43
|
+
id="packages"
|
|
44
|
+
titleText={t('package', 'Packages')}
|
|
45
|
+
onChange={(e) => {
|
|
46
|
+
field.onChange(e.selectedItems);
|
|
47
|
+
}}
|
|
48
|
+
selectedItems={field.value}
|
|
49
|
+
label={t('choosePackage', 'Choose package')}
|
|
50
|
+
items={packages.map((r) => r.uuid)}
|
|
51
|
+
itemToString={(item) => packages.find((r) => r.uuid === item)?.packageName ?? ''}
|
|
52
|
+
/>
|
|
53
|
+
)}
|
|
54
|
+
</>
|
|
55
|
+
)}
|
|
56
|
+
/>
|
|
57
|
+
</Column>
|
|
58
|
+
<Column>
|
|
59
|
+
<PackageInterventions
|
|
60
|
+
categories={
|
|
61
|
+
packages
|
|
62
|
+
.filter((packages_) => selectedPackageObservable.includes(packages_.uuid))
|
|
63
|
+
?.map((p) => p.packageCode) ?? []
|
|
64
|
+
}
|
|
65
|
+
patientUuid={patientUuid}
|
|
66
|
+
/>
|
|
67
|
+
</Column>
|
|
68
|
+
</>
|
|
69
|
+
);
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
export default SHABenefitPackangesAndInterventions;
|
|
@@ -6,13 +6,14 @@ import { FormProvider, useForm } from 'react-hook-form';
|
|
|
6
6
|
import { useTranslation } from 'react-i18next';
|
|
7
7
|
import { createPatientBill, useBillableItems, useCashPoint } from '../billing.resource';
|
|
8
8
|
import { BillingConfig } from '../config-schema';
|
|
9
|
-
import { EXEMPTED_PAYMENT_STATUS, PENDING_PAYMENT_STATUS } from '../constants';
|
|
9
|
+
import { EXEMPTED_PAYMENT_STATUS, PENDING_PAYMENT_STATUS, SHA_INSURANCE_SCHEME } from '../constants';
|
|
10
10
|
import { BillingService } from '../types';
|
|
11
11
|
import styles from './billing-checkin-form.scss';
|
|
12
12
|
import { visitAttributesFormSchema, VisitAttributesFormValue } from './check-in-form.utils';
|
|
13
13
|
import { hasPatientBeenExempted } from './helper';
|
|
14
14
|
import SHANumberValidity from './social-health-authority/sha-number-validity.component';
|
|
15
15
|
import VisitAttributesForm from './visit-attributes/visit-attributes-form.component';
|
|
16
|
+
import SHABenefitPackangesAndInterventions from '../benefits-package/forms/packages-and-interventions-form.component';
|
|
16
17
|
|
|
17
18
|
type BillingCheckInFormProps = {
|
|
18
19
|
patientUuid: string;
|
|
@@ -36,11 +37,14 @@ const BillingCheckInForm: React.FC<BillingCheckInFormProps> = ({ patientUuid, se
|
|
|
36
37
|
insuranceScheme: '',
|
|
37
38
|
policyNumber: '',
|
|
38
39
|
exemptionCategory: '',
|
|
40
|
+
interventions: [],
|
|
41
|
+
packages: [],
|
|
39
42
|
},
|
|
40
43
|
resolver: zodResolver(visitAttributesFormSchema),
|
|
41
44
|
});
|
|
42
45
|
const isPatientExemptedValue = formMethods.watch('isPatientExempted');
|
|
43
46
|
const paymentMethod = formMethods.watch('paymentMethods');
|
|
47
|
+
const isInsuranceSchemeSha = formMethods.watch('insuranceScheme') === SHA_INSURANCE_SCHEME;
|
|
44
48
|
|
|
45
49
|
const handleCreateBill = useCallback((createBillPayload) => {
|
|
46
50
|
createPatientBill(createBillPayload).then(
|
|
@@ -125,6 +129,7 @@ const BillingCheckInForm: React.FC<BillingCheckInFormProps> = ({ patientUuid, se
|
|
|
125
129
|
<FormProvider {...formMethods}>
|
|
126
130
|
<VisitAttributesForm setAttributes={setAttributes} />
|
|
127
131
|
{hieFeatureFlags && <SHANumberValidity paymentMethod={attributes} patientUuid={patientUuid} />}
|
|
132
|
+
{hieFeatureFlags && isInsuranceSchemeSha && <SHABenefitPackangesAndInterventions patientUuid={patientUuid} />}
|
|
128
133
|
{paymentMethod && (
|
|
129
134
|
<section className={styles.sectionContainer}>
|
|
130
135
|
<div className={styles.sectionTitle}>{t('billing', 'Billing')}</div>
|
|
@@ -6,6 +6,8 @@ export const visitAttributesFormSchema = z.object({
|
|
|
6
6
|
insuranceScheme: z.string().optional(),
|
|
7
7
|
policyNumber: z.string().optional(),
|
|
8
8
|
exemptionCategory: z.string().optional(),
|
|
9
|
+
packages: z.array(z.string()).nonempty('Require atleast 1 package'),
|
|
10
|
+
interventions: z.array(z.string()).nonempty('Require atleast 1 intervention'),
|
|
9
11
|
});
|
|
10
12
|
|
|
11
13
|
export type VisitAttributesFormValue = z.infer<typeof visitAttributesFormSchema>;
|
|
@@ -16,7 +16,7 @@ const VisitAttributesForm: React.FC<VisitAttributesFormProps> = ({ setAttributes
|
|
|
16
16
|
const { t } = useTranslation();
|
|
17
17
|
const { insuranceSchemes } = useConfig<BillingConfig>();
|
|
18
18
|
const { visitAttributeTypes, patientExemptionCategories, insurancePaymentMethod } = useConfig<BillingConfig>();
|
|
19
|
-
const { setValue, watch, control, getValues } = useFormContext<VisitAttributesFormValue>();
|
|
19
|
+
const { setValue, watch, control, getValues, resetField } = useFormContext<VisitAttributesFormValue>();
|
|
20
20
|
const { paymentModes, isLoading: isLoadingPaymentModes } = usePaymentModes();
|
|
21
21
|
const [isPatientExempted, paymentMethods] = watch(['isPatientExempted', 'paymentMethods']);
|
|
22
22
|
const resetFormFieldsForNonExemptedPatients = useCallback(() => {
|
|
@@ -24,7 +24,9 @@ const VisitAttributesForm: React.FC<VisitAttributesFormProps> = ({ setAttributes
|
|
|
24
24
|
setValue('policyNumber', '');
|
|
25
25
|
setValue('exemptionCategory', '');
|
|
26
26
|
setValue('paymentMethods', '');
|
|
27
|
-
|
|
27
|
+
resetField('packages');
|
|
28
|
+
resetField('interventions');
|
|
29
|
+
}, [setValue, resetField]);
|
|
28
30
|
|
|
29
31
|
useEffect(() => {
|
|
30
32
|
resetFormFieldsForNonExemptedPatients();
|
|
@@ -38,6 +40,10 @@ const VisitAttributesForm: React.FC<VisitAttributesFormProps> = ({ setAttributes
|
|
|
38
40
|
{ uuid: visitAttributeTypes.policyNumber, value: values.policyNumber },
|
|
39
41
|
{ uuid: visitAttributeTypes.insuranceScheme, value: values.insuranceScheme },
|
|
40
42
|
{ uuid: visitAttributeTypes.exemptionCategory, value: values.exemptionCategory },
|
|
43
|
+
{
|
|
44
|
+
uuid: visitAttributeTypes.shaBenefitPackagesAndInterventions,
|
|
45
|
+
value: JSON.stringify({ packages: values.packages, interventions: values.interventions }),
|
|
46
|
+
},
|
|
41
47
|
];
|
|
42
48
|
const visitAttributesPayload = formPayload.filter(
|
|
43
49
|
(item) => item.value !== undefined && item.value !== null && item.value !== '',
|
|
@@ -48,10 +54,12 @@ const VisitAttributesForm: React.FC<VisitAttributesFormProps> = ({ setAttributes
|
|
|
48
54
|
}));
|
|
49
55
|
}, [visitAttributeTypes, getValues]);
|
|
50
56
|
|
|
51
|
-
const [policyNumber, exemptionCategory, insuranceScheme] = watch([
|
|
57
|
+
const [policyNumber, exemptionCategory, insuranceScheme, interventions, packages] = watch([
|
|
52
58
|
'policyNumber',
|
|
53
59
|
'exemptionCategory',
|
|
54
60
|
'insuranceScheme',
|
|
61
|
+
'interventions',
|
|
62
|
+
'packages',
|
|
55
63
|
]);
|
|
56
64
|
|
|
57
65
|
useEffect(() => {
|
|
@@ -64,6 +72,8 @@ const VisitAttributesForm: React.FC<VisitAttributesFormProps> = ({ setAttributes
|
|
|
64
72
|
policyNumber,
|
|
65
73
|
exemptionCategory,
|
|
66
74
|
insuranceScheme,
|
|
75
|
+
interventions,
|
|
76
|
+
packages,
|
|
67
77
|
]);
|
|
68
78
|
|
|
69
79
|
if (isLoadingPaymentModes) {
|
|
@@ -15,21 +15,21 @@ import {
|
|
|
15
15
|
TextInputSkeleton,
|
|
16
16
|
} from '@carbon/react';
|
|
17
17
|
import { zodResolver } from '@hookform/resolvers/zod';
|
|
18
|
-
import { navigate, showSnackbar, useSession } from '@openmrs/esm-framework';
|
|
19
|
-
import React, { useEffect, useState } from 'react';
|
|
18
|
+
import { navigate, showSnackbar, useConfig, useSession } from '@openmrs/esm-framework';
|
|
19
|
+
import React, { useEffect, useMemo, useState } from 'react';
|
|
20
20
|
import { Controller, FormProvider, useForm } from 'react-hook-form';
|
|
21
21
|
import { useTranslation } from 'react-i18next';
|
|
22
22
|
import { useParams } from 'react-router-dom';
|
|
23
23
|
import { z } from 'zod';
|
|
24
|
-
import
|
|
24
|
+
import { BillingConfig } from '../../../config-schema';
|
|
25
25
|
import { formatDate } from '../../../helpers/functions';
|
|
26
26
|
import { useSystemSetting } from '../../../hooks/getMflCode';
|
|
27
|
-
import usePackages from '../../../hooks/usePackages';
|
|
28
27
|
import usePatientDiagnosis from '../../../hooks/usePatientDiagnosis';
|
|
28
|
+
import useProvider from '../../../hooks/useProvider';
|
|
29
29
|
import { LineItem, MappedBill } from '../../../types';
|
|
30
|
-
import { processClaims, useVisit } from './claims-form.resource';
|
|
30
|
+
import { processClaims, SHAPackagesAndInterventionVisitAttribute, useVisit } from './claims-form.resource';
|
|
31
31
|
import styles from './claims-form.scss';
|
|
32
|
-
import
|
|
32
|
+
import SHABenefitPackangesAndInterventions from '../../../benefits-package/forms/packages-and-interventions-form.component';
|
|
33
33
|
|
|
34
34
|
type ClaimsFormProps = {
|
|
35
35
|
bill: MappedBill;
|
|
@@ -44,7 +44,7 @@ const ClaimsFormSchema = z.object({
|
|
|
44
44
|
facility: z.string().nonempty({ message: 'Facility is required' }),
|
|
45
45
|
treatmentStart: z.string().nonempty({ message: 'Treatment start date is required' }),
|
|
46
46
|
treatmentEnd: z.string().nonempty({ message: 'Treatment end date is required' }),
|
|
47
|
-
|
|
47
|
+
packages: z.array(z.string()).nonempty({ message: 'At least one package is required' }),
|
|
48
48
|
interventions: z.array(z.string()).min(1, {
|
|
49
49
|
message: 'At least one intervention is required',
|
|
50
50
|
}),
|
|
@@ -57,11 +57,23 @@ const ClaimsForm: React.FC<ClaimsFormProps> = ({ bill, selectedLineItems }) => {
|
|
|
57
57
|
const { patientUuid, billUuid } = useParams();
|
|
58
58
|
const { visits: recentVisit, error: visitError, isLoading: visitLoading } = useVisit(patientUuid);
|
|
59
59
|
const { diagnoses, error: diagnosisError, isLoading: diagnosisLoading } = usePatientDiagnosis(patientUuid);
|
|
60
|
-
const { error: packagesError, isLoading: packagesLoading, packages } = usePackages();
|
|
61
60
|
const {
|
|
62
61
|
currentProvider: { uuid: providerUuid },
|
|
63
62
|
} = useSession();
|
|
64
63
|
const { providerLoading: providerLoading, provider, error: providerError } = useProvider(providerUuid);
|
|
64
|
+
const { visitAttributeTypes } = useConfig<BillingConfig>();
|
|
65
|
+
const packagesAndinterventions = useMemo(() => {
|
|
66
|
+
if (recentVisit) {
|
|
67
|
+
const values = recentVisit.attributes?.find(
|
|
68
|
+
(attr) => attr.attributeType.uuid === visitAttributeTypes.shaBenefitPackagesAndInterventions,
|
|
69
|
+
)?.value;
|
|
70
|
+
if (values) {
|
|
71
|
+
const payload: SHAPackagesAndInterventionVisitAttribute = JSON.parse(values);
|
|
72
|
+
return payload;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
return null;
|
|
76
|
+
}, [recentVisit, visitAttributeTypes]);
|
|
65
77
|
|
|
66
78
|
const encounterUuid = recentVisit?.encounters[0]?.uuid;
|
|
67
79
|
const visitTypeUuid = recentVisit?.visitType.uuid;
|
|
@@ -85,7 +97,7 @@ const ClaimsForm: React.FC<ClaimsFormProps> = ({ bill, selectedLineItems }) => {
|
|
|
85
97
|
facility: `${recentVisit?.location?.display || ''} - ${mflCodeValue || ''}`,
|
|
86
98
|
treatmentStart: recentVisit?.startDatetime ? formatDate(recentVisit.startDatetime) : '',
|
|
87
99
|
treatmentEnd: recentVisit?.stopDatetime ? formatDate(recentVisit.stopDatetime) : '',
|
|
88
|
-
|
|
100
|
+
packages: [],
|
|
89
101
|
interventions: [],
|
|
90
102
|
provider: providerUuid,
|
|
91
103
|
},
|
|
@@ -99,11 +111,6 @@ const ClaimsForm: React.FC<ClaimsFormProps> = ({ bill, selectedLineItems }) => {
|
|
|
99
111
|
reset,
|
|
100
112
|
} = form;
|
|
101
113
|
|
|
102
|
-
const handleInterventionsChange = (e: { selectedItem: string }) => {
|
|
103
|
-
form.setValue('interventions', []);
|
|
104
|
-
setValue('package', e.selectedItem);
|
|
105
|
-
};
|
|
106
|
-
|
|
107
114
|
const onSubmit = async (data: z.infer<typeof ClaimsFormSchema>) => {
|
|
108
115
|
setLoading(true);
|
|
109
116
|
const providedItems = selectedLineItems.reduce((acc, item) => {
|
|
@@ -139,7 +146,7 @@ const ClaimsForm: React.FC<ClaimsFormProps> = ({ bill, selectedLineItems }) => {
|
|
|
139
146
|
use: 'claim',
|
|
140
147
|
insurer: 'SHA',
|
|
141
148
|
billNumber: billUuid,
|
|
142
|
-
packages:
|
|
149
|
+
packages: data.packages,
|
|
143
150
|
interventions: data.interventions,
|
|
144
151
|
};
|
|
145
152
|
try {
|
|
@@ -170,7 +177,6 @@ const ClaimsForm: React.FC<ClaimsFormProps> = ({ bill, selectedLineItems }) => {
|
|
|
170
177
|
setLoading(false);
|
|
171
178
|
}
|
|
172
179
|
};
|
|
173
|
-
const selectedPackage = packages.find((package_) => package_.uuid === form.watch('package'))?.packageCode ?? '';
|
|
174
180
|
|
|
175
181
|
useEffect(() => {
|
|
176
182
|
setValue('diagnoses', diagnoses?.map((d) => d.id) ?? ([] as any));
|
|
@@ -178,9 +184,11 @@ const ClaimsForm: React.FC<ClaimsFormProps> = ({ bill, selectedLineItems }) => {
|
|
|
178
184
|
setValue('facility', `${recentVisit?.location?.display || ''} - ${mflCodeValue || ''}`);
|
|
179
185
|
setValue('treatmentStart', recentVisit?.startDatetime ? formatDate(recentVisit.startDatetime) : '');
|
|
180
186
|
setValue('treatmentEnd', recentVisit?.stopDatetime ? formatDate(recentVisit.stopDatetime) : '');
|
|
181
|
-
|
|
187
|
+
setValue('packages', (packagesAndinterventions?.packages ?? []) as any);
|
|
188
|
+
setValue('interventions', (packagesAndinterventions?.interventions ?? []) as any);
|
|
189
|
+
}, [diagnoses, recentVisit, mflCodeValue, setValue, provider, packagesAndinterventions]);
|
|
182
190
|
|
|
183
|
-
if (visitLoading || diagnosisLoading ||
|
|
191
|
+
if (visitLoading || diagnosisLoading || providerLoading) {
|
|
184
192
|
return (
|
|
185
193
|
<Layer className={styles.loading}>
|
|
186
194
|
{Array.from({ length: 6 }).map((_, index) => (
|
|
@@ -190,7 +198,7 @@ const ClaimsForm: React.FC<ClaimsFormProps> = ({ bill, selectedLineItems }) => {
|
|
|
190
198
|
);
|
|
191
199
|
}
|
|
192
200
|
|
|
193
|
-
if (visitError || diagnosisError ||
|
|
201
|
+
if (visitError || diagnosisError || providerError) {
|
|
194
202
|
return (
|
|
195
203
|
<Layer className={styles.loading}>
|
|
196
204
|
<InlineNotification
|
|
@@ -198,7 +206,6 @@ const ClaimsForm: React.FC<ClaimsFormProps> = ({ bill, selectedLineItems }) => {
|
|
|
198
206
|
subtitle={
|
|
199
207
|
visitError?.message ??
|
|
200
208
|
diagnosisError?.message ??
|
|
201
|
-
packagesError?.message ??
|
|
202
209
|
providerError?.message ??
|
|
203
210
|
'Error occured while loading claims form'
|
|
204
211
|
}
|
|
@@ -284,45 +291,7 @@ const ClaimsForm: React.FC<ClaimsFormProps> = ({ bill, selectedLineItems }) => {
|
|
|
284
291
|
</Layer>
|
|
285
292
|
</Column>
|
|
286
293
|
</Row>
|
|
287
|
-
<
|
|
288
|
-
<Layer className={styles.input}>
|
|
289
|
-
<Controller
|
|
290
|
-
control={form.control}
|
|
291
|
-
name="package"
|
|
292
|
-
render={({ field }) => (
|
|
293
|
-
<>
|
|
294
|
-
{packagesError ? (
|
|
295
|
-
<InlineNotification
|
|
296
|
-
kind="error"
|
|
297
|
-
subtitle={t('errorFetchingPackages', 'Error fetching packeges')}
|
|
298
|
-
lowContrast
|
|
299
|
-
/>
|
|
300
|
-
) : (
|
|
301
|
-
<Dropdown
|
|
302
|
-
ref={field.ref}
|
|
303
|
-
invalid={form.formState.errors[field.name]?.message}
|
|
304
|
-
invalidText={form.formState.errors[field.name]?.message}
|
|
305
|
-
id="package"
|
|
306
|
-
titleText={t('package', 'Package')}
|
|
307
|
-
onChange={handleInterventionsChange}
|
|
308
|
-
initialSelectedItem={field.value}
|
|
309
|
-
label="Choose package"
|
|
310
|
-
items={packages.map((r) => r.uuid)}
|
|
311
|
-
itemToString={(item) => packages.find((r) => r.uuid === item)?.packageName ?? ''}
|
|
312
|
-
/>
|
|
313
|
-
)}
|
|
314
|
-
</>
|
|
315
|
-
)}
|
|
316
|
-
/>
|
|
317
|
-
</Layer>
|
|
318
|
-
</Column>
|
|
319
|
-
|
|
320
|
-
<Column>
|
|
321
|
-
<Layer className={styles.input}>
|
|
322
|
-
<PackageInterventions key={selectedPackage} category={selectedPackage} patientUuid={patientUuid} />
|
|
323
|
-
</Layer>
|
|
324
|
-
</Column>
|
|
325
|
-
|
|
294
|
+
<SHABenefitPackangesAndInterventions patientUuid={patientUuid} />
|
|
326
295
|
<Column>
|
|
327
296
|
<Layer className={styles.input}>
|
|
328
297
|
<Controller
|
|
@@ -13,11 +13,27 @@ interface ProvidersResponse {
|
|
|
13
13
|
results: Provider[];
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
+
interface ExtendedVisit extends Visit {
|
|
17
|
+
attributes: Array<{
|
|
18
|
+
uuid: string;
|
|
19
|
+
display: string;
|
|
20
|
+
attributeType: {
|
|
21
|
+
uuid: string;
|
|
22
|
+
display: string;
|
|
23
|
+
};
|
|
24
|
+
value: string;
|
|
25
|
+
}>;
|
|
26
|
+
}
|
|
27
|
+
export interface SHAPackagesAndInterventionVisitAttribute {
|
|
28
|
+
packages: Array<string>;
|
|
29
|
+
interventions: Array<string>;
|
|
30
|
+
}
|
|
31
|
+
|
|
16
32
|
export function useVisit(patientUuid: string) {
|
|
17
33
|
const customRepresentation =
|
|
18
|
-
'custom:(uuid,patient,encounters:(uuid,diagnoses:(uuid,display,certainty,diagnosis:(coded:(uuid,display))),encounterDatetime,encounterType:(uuid,display),encounterProviders:(uuid,display,provider:(uuid,person:(uuid,display)))),location:(uuid,name,display),visitType:(uuid,name,display),startDatetime,stopDatetime)&limit=1';
|
|
34
|
+
'custom:(uuid,patient,encounters:(uuid,diagnoses:(uuid,display,certainty,diagnosis:(coded:(uuid,display))),encounterDatetime,encounterType:(uuid,display),encounterProviders:(uuid,display,provider:(uuid,person:(uuid,display)))),location:(uuid,name,display),visitType:(uuid,name,display),startDatetime,stopDatetime,attributes)&limit=1';
|
|
19
35
|
|
|
20
|
-
const { data, error, isLoading, isValidating, mutate } = useSWR<{ data: { results: Array<
|
|
36
|
+
const { data, error, isLoading, isValidating, mutate } = useSWR<{ data: { results: Array<ExtendedVisit> } }, Error>(
|
|
21
37
|
`${restBaseUrl}/visit?patient=${patientUuid}&v=${customRepresentation}`,
|
|
22
38
|
openmrsFetch,
|
|
23
39
|
);
|