@kenyaemr/esm-billing-app 5.4.2-pre.2911 → 5.4.2
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 +4 -4
- package/dist/723.js +1 -1
- package/dist/723.js.map +1 -1
- package/dist/kenyaemr-esm-billing-app.js.buildmanifest.json +6 -6
- package/dist/main.js +2 -2
- package/dist/main.js.map +1 -1
- package/dist/routes.json +1 -1
- package/package.json +2 -3
- package/src/billing-form/billing-checkin-form.component.tsx +84 -54
- package/src/billing-form/billing-checkin-form.scss +3 -0
- package/src/billing-form/visit-attributes/visit-attributes-form.scss +1 -1
- package/src/routes.json +3 -2
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},{"component":"billingAdmin","route":"billing-admin"}],"extensions":[{"component":"accountingDashboardLink","name":"accounting-dashboard-link","slots":["homepage-dashboard-slot"],"meta":{"name":"accounting","slot":"accounting-dashboard-slot","title":"Accounting"}},{"name":"billing-dashboard","component":"billingDashboard","slot":"accounting-dashboard-slot"},{"component":"benefitsPackageDashboardLink","name":"benefits-package-dashboard-link","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","order":11,"meta":{"columns":1,"columnSpan":1,"slot":"patient-chart-billing-dashboard-slot","path":"Billing","layoutMode":"anchored"}},{"name":"billing-check-in-form","slot":"
|
|
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},{"component":"billingAdmin","route":"billing-admin"}],"extensions":[{"component":"accountingDashboardLink","name":"accounting-dashboard-link","slots":["homepage-dashboard-slot"],"meta":{"name":"accounting","slot":"accounting-dashboard-slot","title":"Accounting"}},{"name":"billing-dashboard","component":"billingDashboard","slot":"accounting-dashboard-slot"},{"component":"benefitsPackageDashboardLink","name":"benefits-package-dashboard-link","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","order":11,"meta":{"columns":1,"columnSpan":1,"slot":"patient-chart-billing-dashboard-slot","path":"Billing","layoutMode":"anchored"}},{"name":"billing-check-in-form","slot":"visit-form-bottom-slot","component":"billingCheckInForm","order":1},{"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":"order-action-button","component":"orderActionButton","slots":["prescription-action-button-slot","imaging-orders-action","procedure-orders-action","tests-ordered-actions-slot"],"order":0},{"component":"claimsManagementOverviewDashboardLink","name":"claims-management-overview-link","slots":["claims-management-dashboard-link-slot"]},{"component":"preAuthRequestsDashboardLink","name":"preauthrequest-overview-link","slots":["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"},{"name":"patient-info-sha-status","component":"patientBannerShaStatus","slot":"patient-banner-tags-slot"},{"name":"payments-points-dashboard-link","component":"paymentPointDashboardLink","slot":"billing-admin-dashboard-slot","meta":{"name":"cashier-points","title":"Payment Point","slot":"payment-point-dashboard-slot"}},{"name":"payment-points-dashboard","component":"paymentPoints","slot":"payment-point-dashboard-slot"},{"name":"payment-mode-dashboard-link","component":"paymentModeLink","slot":"billing-admin-dashboard-slot","meta":{"name":"payment-modes","title":"Payment Mode","slot":"payment-mode-dashboard-slot"}},{"name":"payment-mode-dashboard","component":"paymentModeDashboard","slot":"payment-mode-dashboard-slot"},{"name":"bill-deposit-dashboard-link","component":"billDepositDashboardLink","slot":"billing-admin-dashboard-slot","meta":{"name":"bill-deposit","title":"Bill Deposit","slot":"billing-deposit-dashboard-slot"}},{"name":"bill-deposit-dashboard","component":"billDepositDashboard","slot":"billing-deposit-dashboard-slot"},{"name":"billable-exemptions-dashboard-link","component":"billableExemptionsLink","slot":"billing-admin-dashboard-slot","meta":{"name":"billable-exemptions","title":"Billable Exemptions","slot":"billing-exemptions-dashboard-slot"}},{"name":"billable-exemptions-dashboard","component":"billableExemptions","slot":"billing-exemptions-dashboard-slot"},{"name":"clinical-charges-dashboard-link","component":"clinicalChargesLink","slot":"billing-admin-dashboard-slot","meta":{"name":"clinical-charges","title":"Clinical Charges","slot":"clinical-charges-dashboard-slot"}},{"name":"clinical-charges-dashboard","component":"clinicalCharges","slot":"clinical-charges-dashboard-slot"},{"name":"payment-history-dashboard-link","component":"paymentHistoryLink","slot":"billing-admin-dashboard-slot","meta":{"name":"payment-history","title":"Payment History","slot":"payment-history-dashboard-slot"}},{"name":"payment-history-dashboard","component":"paymentHistoryDashboard","slot":"payment-history-dashboard-slot"},{"name":"patient-billing-dashboard-link","component":"patientBillingLink","slot":"billing-admin-dashboard-slot","meta":{"name":"patient-billing","title":"Patient Billing","slot":"patient-billing-dashboard-slot"}},{"name":"patient-billing-dashboard","component":"patientBilling","slot":"patient-billing-dashboard-slot"}],"workspaces":[{"name":"create-bill-workspace","component":"createBillWorkspace","title":"Create Bill Workspace","type":"other-form"},{"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":"commodityForm","title":"Charge Commodity 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"},{"name":"add-deposit-workspace","component":"addDepositWorkspace","title":"Add Deposit","type":"other-form"},{"name":"deposit-transaction-workspace","component":"depositTransactionWorkspace","title":"Deposit Transaction","type":"other-form"},{"name":"payment-workspace","component":"paymentWorkspace","title":"Payment 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":"manage-claim-request-modal","component":"manageClaimRequestModal"},{"name":"claim-summary-modal","component":"claimSummaryModal"},{"name":"clock-in-modal","component":"clockIn"},{"name":"create-bill-item-modal","component":"createBillItemModal"},{"name":"delete-deposit-modal","component":"deleteDepositModal"},{"name":"reverse-transaction-modal","component":"reverseTransactionModal"},{"name":"print-preview-modal","component":"printPreviewModal"},{"name":"bill-action-modal","component":"billActionModal"},{"name":"require-billing-modal","component":"requirePaymentModal"}],"version":"5.4.2"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kenyaemr/esm-billing-app",
|
|
3
|
-
"version": "5.4.2
|
|
3
|
+
"version": "5.4.2",
|
|
4
4
|
"description": "Billing app for KenyaEMR",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"openmrs"
|
|
@@ -47,6 +47,5 @@
|
|
|
47
47
|
},
|
|
48
48
|
"publishConfig": {
|
|
49
49
|
"access": "public"
|
|
50
|
-
}
|
|
51
|
-
"stableVersion": "5.4.1"
|
|
50
|
+
}
|
|
52
51
|
}
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import { FilterableMultiSelect, InlineLoading, InlineNotification } from '@carbon/react';
|
|
2
2
|
import { zodResolver } from '@hookform/resolvers/zod';
|
|
3
|
-
import { showSnackbar, useConfig, useFeatureFlag } from '@openmrs/esm-framework';
|
|
3
|
+
import { showSnackbar, useConfig, useFeatureFlag, type Visit } from '@openmrs/esm-framework';
|
|
4
4
|
import React, { useCallback, useEffect, useState } from 'react';
|
|
5
5
|
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
9
|
import { EXEMPTED_PAYMENT_STATUS, PENDING_PAYMENT_STATUS, SHA_INSURANCE_SCHEME } from '../constants';
|
|
10
|
-
import { BillingService } from '../types';
|
|
11
10
|
import styles from './billing-checkin-form.scss';
|
|
12
11
|
import { visitAttributesFormSchema, VisitAttributesFormValue } from './check-in-form.utils';
|
|
13
12
|
import { hasPatientBeenExempted } from './helper';
|
|
@@ -15,12 +14,16 @@ import SHANumberValidity from './social-health-authority/sha-number-validity.com
|
|
|
15
14
|
import VisitAttributesForm from './visit-attributes/visit-attributes-form.component';
|
|
16
15
|
import SHABenefitPackangesAndInterventions from '../benefits-package/forms/packages-and-interventions-form.component';
|
|
17
16
|
|
|
17
|
+
interface VisitFormCallbacks {
|
|
18
|
+
onVisitCreatedOrUpdated: (visit: Visit) => Promise<any>;
|
|
19
|
+
}
|
|
20
|
+
|
|
18
21
|
type BillingCheckInFormProps = {
|
|
19
22
|
patientUuid: string;
|
|
20
|
-
|
|
23
|
+
setVisitFormCallbacks: (callbacks: VisitFormCallbacks) => void;
|
|
21
24
|
};
|
|
22
25
|
|
|
23
|
-
const BillingCheckInForm: React.FC<BillingCheckInFormProps> = ({ patientUuid,
|
|
26
|
+
const BillingCheckInForm: React.FC<BillingCheckInFormProps> = ({ patientUuid, setVisitFormCallbacks }) => {
|
|
24
27
|
const { t } = useTranslation();
|
|
25
28
|
const hieFeatureFlags = useFeatureFlag('healthInformationExchange');
|
|
26
29
|
const {
|
|
@@ -29,6 +32,8 @@ const BillingCheckInForm: React.FC<BillingCheckInFormProps> = ({ patientUuid, se
|
|
|
29
32
|
const { cashPoints, isLoading: isLoadingCashPoints, error: cashError } = useCashPoint();
|
|
30
33
|
const { lineItems, isLoading: isLoadingLineItems, error: lineError } = useBillableItems();
|
|
31
34
|
const [attributes, setAttributes] = useState([]);
|
|
35
|
+
const [selectedBillingServices, setSelectedBillingServices] = useState([]);
|
|
36
|
+
|
|
32
37
|
const formMethods = useForm<VisitAttributesFormValue>({
|
|
33
38
|
mode: 'all',
|
|
34
39
|
defaultValues: {
|
|
@@ -42,67 +47,92 @@ const BillingCheckInForm: React.FC<BillingCheckInFormProps> = ({ patientUuid, se
|
|
|
42
47
|
},
|
|
43
48
|
resolver: zodResolver(visitAttributesFormSchema),
|
|
44
49
|
});
|
|
50
|
+
|
|
45
51
|
const isPatientExemptedValue = formMethods.watch('isPatientExempted');
|
|
46
52
|
const paymentMethod = formMethods.watch('paymentMethods');
|
|
47
53
|
const isInsuranceSchemeSha = formMethods.watch('insuranceScheme') === SHA_INSURANCE_SCHEME;
|
|
48
54
|
|
|
49
|
-
const handleCreateBill = useCallback(
|
|
50
|
-
|
|
51
|
-
()
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
55
|
+
const handleCreateBill = useCallback(
|
|
56
|
+
(billPayload) => {
|
|
57
|
+
return createPatientBill(billPayload).then(
|
|
58
|
+
() => {
|
|
59
|
+
showSnackbar({
|
|
60
|
+
title: t('patientBill', 'Patient Bill'),
|
|
61
|
+
subtitle: t('patientBilledSuccessfully', 'Patient has been billed successfully'),
|
|
62
|
+
kind: 'success',
|
|
63
|
+
});
|
|
64
|
+
},
|
|
65
|
+
(error) => {
|
|
66
|
+
const errorMessage = JSON.stringify(
|
|
67
|
+
error?.responseBody?.error?.message?.replace(/\[/g, '').replace(/\]/g, '') || '',
|
|
68
|
+
);
|
|
69
|
+
showSnackbar({
|
|
70
|
+
title: t('patientBillError', 'Patient Bill Error'),
|
|
71
|
+
subtitle: t(
|
|
72
|
+
'errorCreatingBill',
|
|
73
|
+
'An error has occurred while creating patient bill, Contact system administrator quoting this error {{errorMessage}}',
|
|
74
|
+
{ errorMessage },
|
|
75
|
+
),
|
|
76
|
+
kind: 'error',
|
|
77
|
+
isLowContrast: true,
|
|
78
|
+
});
|
|
79
|
+
// Re-throw to propagate error up the promise chain
|
|
80
|
+
throw error;
|
|
81
|
+
},
|
|
82
|
+
);
|
|
83
|
+
},
|
|
84
|
+
[t],
|
|
85
|
+
);
|
|
65
86
|
|
|
66
|
-
const
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
87
|
+
const createBillPayload = useCallback(
|
|
88
|
+
(selectedItems) => {
|
|
89
|
+
const cashPointUuid = cashPoints?.[0]?.uuid ?? '';
|
|
90
|
+
const billStatus = hasPatientBeenExempted(attributes, isPatientExempted)
|
|
91
|
+
? EXEMPTED_PAYMENT_STATUS
|
|
92
|
+
: PENDING_PAYMENT_STATUS;
|
|
93
|
+
|
|
94
|
+
const lineItemsData = selectedItems.map((item, index) => {
|
|
95
|
+
const priceForPaymentMode =
|
|
96
|
+
item.servicePrices.find((p) => p.paymentMode?.uuid === paymentMethod) || item?.servicePrices[0];
|
|
97
|
+
return {
|
|
98
|
+
billableService: item?.uuid ?? '',
|
|
99
|
+
quantity: 1,
|
|
100
|
+
price: priceForPaymentMode ? priceForPaymentMode.price : '0.000',
|
|
101
|
+
priceName: 'Default',
|
|
102
|
+
priceUuid: priceForPaymentMode ? priceForPaymentMode.uuid : '',
|
|
103
|
+
lineItemOrder: index,
|
|
104
|
+
paymentStatus: billStatus,
|
|
105
|
+
};
|
|
106
|
+
});
|
|
71
107
|
|
|
72
|
-
const lineItems = selectedItems.map((item, index) => {
|
|
73
|
-
const priceForPaymentMode =
|
|
74
|
-
item.servicePrices.find((p) => p.paymentMode?.uuid === paymentMethod) || item?.servicePrices[0];
|
|
75
108
|
return {
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
lineItemOrder: index,
|
|
82
|
-
paymentStatus: billStatus,
|
|
109
|
+
lineItems: lineItemsData,
|
|
110
|
+
cashPoint: cashPointUuid,
|
|
111
|
+
patient: patientUuid,
|
|
112
|
+
status: billStatus,
|
|
113
|
+
payments: [],
|
|
83
114
|
};
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
lineItems: lineItems,
|
|
88
|
-
cashPoint: cashPointUuid,
|
|
89
|
-
patient: patientUuid,
|
|
90
|
-
status: billStatus,
|
|
91
|
-
payments: [],
|
|
92
|
-
};
|
|
115
|
+
},
|
|
116
|
+
[cashPoints, attributes, isPatientExempted, paymentMethod, patientUuid],
|
|
117
|
+
);
|
|
93
118
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
});
|
|
98
|
-
};
|
|
119
|
+
const handleBillingService = useCallback((selectedItems) => {
|
|
120
|
+
setSelectedBillingServices(selectedItems);
|
|
121
|
+
}, []);
|
|
99
122
|
|
|
100
123
|
useEffect(() => {
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
124
|
+
const onVisitCreatedOrUpdated = async (visit: Visit) => {
|
|
125
|
+
if (selectedBillingServices.length > 0) {
|
|
126
|
+
const billPayload = createBillPayload(selectedBillingServices);
|
|
127
|
+
await handleCreateBill(billPayload);
|
|
128
|
+
}
|
|
129
|
+
return visit;
|
|
130
|
+
};
|
|
131
|
+
|
|
132
|
+
setVisitFormCallbacks({
|
|
133
|
+
onVisitCreatedOrUpdated,
|
|
104
134
|
});
|
|
105
|
-
}, [
|
|
135
|
+
}, [selectedBillingServices, createBillPayload, handleCreateBill, setVisitFormCallbacks]);
|
|
106
136
|
|
|
107
137
|
if (isLoadingLineItems || isLoadingCashPoints) {
|
|
108
138
|
return (
|
|
@@ -132,7 +162,7 @@ const BillingCheckInForm: React.FC<BillingCheckInFormProps> = ({ patientUuid, se
|
|
|
132
162
|
{hieFeatureFlags && isInsuranceSchemeSha && <SHABenefitPackangesAndInterventions patientUuid={patientUuid} />}
|
|
133
163
|
{paymentMethod && (
|
|
134
164
|
<section className={styles.sectionContainer}>
|
|
135
|
-
<div className={styles.sectionTitle}>{t('
|
|
165
|
+
<div className={styles.sectionTitle}>{t('chargeableService', 'Chargeable service')}</div>
|
|
136
166
|
<div className={styles.sectionField}>
|
|
137
167
|
<FilterableMultiSelect
|
|
138
168
|
key={isPatientExemptedValue}
|
package/src/routes.json
CHANGED