@argusoft/medplat-app-shell 1.0.6 → 1.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +139 -141
- package/src/GlobalErrorBoundary.jsx +31 -0
- package/src/SilentErrorFallback.jsx +68 -0
- package/src/TrackingProviderWrapper.jsx +40 -0
- package/src/_tests_/__mocks__/MockTranslationProvider.jsx +21 -0
- package/src/_tests_/__mocks__/ckeditor.js +45 -0
- package/src/_tests_/__mocks__/fileMock.js +1 -0
- package/src/_tests_/__mocks__/useranalytics.js +5 -0
- package/src/_tests_/views/components/Dashboard/DashboardUI.test.jsx +137 -0
- package/src/_tests_/views/components/Dashboard/DashboardUIMock.js +877 -0
- package/src/_tests_/views/components/ForgotPassword/ForgotPassword.test.jsx +314 -0
- package/src/_tests_/views/components/LocationDirective/LocationDirective.test.jsx.disable +229 -0
- package/src/_tests_/views/components/LocationDirective/mockLocationDirective.js +810 -0
- package/src/_tests_/views/components/LocationType/MockLocationType.js +42259 -0
- package/src/_tests_/views/components/LocationType/addlocationtype.test.jsx.disable +276 -0
- package/src/_tests_/views/components/LocationType/editlocationtype.test.jsx.disable +262 -0
- package/src/_tests_/views/components/LocationType/locationtype.test.jsx.disable +148 -0
- package/src/_tests_/views/components/Profile/UpdateProfileModalData.js +4396 -0
- package/src/_tests_/views/components/Profile/updateprofilemodal.test.jsx +282 -0
- package/src/_tests_/views/components/SideBar/MockSideBar.js +1379 -0
- package/src/_tests_/views/components/SideBar/SideBar.test.jsx +98 -0
- package/src/_tests_/views/components/SystemConfig/ManageSystemConfig/AddManageSystemConfig.test.jsx.disable +164 -0
- package/src/_tests_/views/components/SystemConfig/ManageSystemConfig/UpdateManageSystemConfig.test.jsx.disable +157 -0
- package/src/_tests_/views/components/SystemConfig/MockSystemConfig.js +1280 -0
- package/src/_tests_/views/components/SystemConfig/SystemConfig.test.jsx.disable +165 -0
- package/src/_tests_/views/components/login/Login.test.jsx +276 -0
- package/src/_tests_/views/components/login/MockAuthorise.js +2414 -0
- package/src/_tests_/views/components/login/ServiceResponse.js +595 -0
- package/src/_tests_/views/components/user/MockManageUser.js +7965 -0
- package/src/_tests_/views/components/user/manageuser.test.jsx.disable +989 -0
- package/src/_tests_/views/components/user/mockUsersData.js +582 -0
- package/src/assets/img/OASISLogin.png +0 -0
- package/src/assets/img/bahaarNew.png +0 -0
- package/src/assets/img/dnhdd4K.png +0 -0
- package/src/assets/img/govtofup.png +0 -0
- package/src/assets/img/sewarural4K.png +0 -0
- package/src/assets/img/techo4K.png +0 -0
- package/src/assets/img/up4K.png +0 -0
- package/src/common/HolidayList.jsx +573 -0
- package/src/common/MalaciaousInputUtil.js +23 -0
- package/src/common/SafeHtml.jsx +17 -0
- package/src/common/VersionManager.jsx +109 -0
- package/src/common/constants/PerformanceDashboard.js +514 -0
- package/src/common/constants/app.constant.js +781 -0
- package/src/common/constants/cccVerificationConstants.js +18 -0
- package/src/common/constants/fhsrConstant.js +33 -0
- package/src/common/constants/gvk-verification.constant.js +76 -0
- package/src/common/constants/search.constant.js +23 -0
- package/src/common/constants/teleconsulatationConstant.jsx +1339 -0
- package/src/common/directives/SearchTemplate.jsx +784 -0
- package/src/common/directives/SearchTemplate.scss +14 -0
- package/src/common/dynamicView/DynamicView.jsx +353 -0
- package/src/common/dynamicView/InputFieldComponent.jsx +1501 -0
- package/src/common/dynamicView/InputViewComponent.jsx +298 -0
- package/src/common/dynamicView/InputViewComponent.scss +15 -0
- package/src/common/env.js +5 -0
- package/src/common/filters/locationNameFilter.js +26 -0
- package/src/common/fontAwesomeIcons/FontAwesomeIcons.jsx +27 -0
- package/src/common/fontAwesomeIcons/FontAwesomeIconsNames.js +1968 -0
- package/src/common/fontPreferences/fontSizeProvider.jsx +34 -0
- package/src/common/fontPreferences/fontSizeSelector.jsx +116 -0
- package/src/common/getAssignedFeature/getAssignedFeature.js +32 -0
- package/src/common/interceptors/AxiosInterceptor.js +216 -0
- package/src/common/languageTranslator/TranslationContext.js +5 -0
- package/src/common/languageTranslator/TranslationProvider.jsx +24 -0
- package/src/common/languageTranslator/i18n.js +49 -0
- package/src/common/services/AuthenticateService.js +116 -0
- package/src/common/services/DownloadFile.js +35 -0
- package/src/common/services/ForgotPassword.js +18 -0
- package/src/common/services/FormConfiguratorService.js +195 -0
- package/src/common/services/GlobalApis.js +84 -0
- package/src/common/services/InterceptorNavigationService.js +17 -0
- package/src/common/services/LocationService.js +65 -0
- package/src/common/services/LocationType.js +11 -0
- package/src/common/services/QueryBuilder.js +36 -0
- package/src/common/services/Roles.js +28 -0
- package/src/common/services/SyncWithServer.js +15 -0
- package/src/common/services/SystemConfig.js +15 -0
- package/src/common/services/TranslationService.js +70 -0
- package/src/common/services/TwoFactorService.js +7 -0
- package/src/common/services/Users.js +91 -0
- package/src/common/services/Webtasks.js +27 -0
- package/src/common/services/util/Convert-pad-data-to-API-format.jsx +167 -0
- package/src/common/services/util/Convert-to-UI-format.jsx +82 -0
- package/src/common/services/util/EmptyPrescriptionPadData.jsx +11 -0
- package/src/common/services/util/GeneralUtil.js +456 -0
- package/src/common/services/util/Prescription-pad-util.js +339 -0
- package/src/common/services/util/PrescriptionPadData.js +67 -0
- package/src/common/services/util/PrescriptionpadCommonUtil.js +96 -0
- package/src/common/services/util/ReportFieldUtil.jsx +398 -0
- package/src/common/services/util/WebSocketContext.jsx +261 -0
- package/src/common/syncWithServer/SyncWithServerDialog.jsx +170 -0
- package/src/common/syncWithServer/SyncWithServerDialogSkeleton.jsx +67 -0
- package/src/common/tests/CustomWrapper.jsx +49 -0
- package/src/common/tests/TranslationWrapper.jsx +38 -0
- package/src/common/themeProvider/ColorInputs.jsx +97 -0
- package/src/common/themeProvider/EditableColorInput.jsx +128 -0
- package/src/common/themeProvider/ThemeEditor.jsx +319 -0
- package/src/common/themeProvider/ThemeProvider.jsx +210 -0
- package/src/common/themeProvider/themeConfig.js +558 -0
- package/src/common/toaster/toaster.jsx +30 -0
- package/src/firebaseConfig.js +24 -0
- package/src/global.scss +221 -0
- package/src/hooks/.gitkeep +0 -0
- package/src/hooks/useAESEncryption.js +56 -0
- package/src/hooks/useCaching.js +43 -0
- package/src/hooks/useDebounce.js +34 -0
- package/src/hooks/useDebounceFn.js +50 -0
- package/src/hooks/useDownloadPdf.js +358 -0
- package/src/hooks/useDownloadXlsx.js +55 -0
- package/src/hooks/useListValueFieldValues.js +30 -0
- package/src/hooks/useLocationHierarchies.js +63 -0
- package/src/hooks/useLocationHierarchyTranslate.js +16 -0
- package/src/hooks/useOnline.js +27 -0
- package/src/hooks/usePagination.js +63 -0
- package/src/hooks/useRefreshToken.js +87 -0
- package/src/hooks/useScript.js +25 -0
- package/src/hooks/useStopwatch.js +75 -0
- package/src/hooks/useTrackEvent.js +22 -0
- package/src/hooks/useWebAudioRecorder.js +115 -0
- package/src/layout/LoaderComponet.jsx +22 -0
- package/src/layout/LoaderContext.jsx +29 -0
- package/src/layout/mainLayout/AdaptiveZoom.jsx +27 -0
- package/src/layout/mainLayout/Chatbot.jsx +243 -0
- package/src/layout/mainLayout/Layout.jsx +445 -0
- package/src/layout/mainLayout/Profile/UpdateProfileModal.jsx +684 -0
- package/src/layout/mainLayout/header/LogoutModal.jsx +131 -0
- package/src/layout/mainLayout/header/Navbar.jsx +1677 -0
- package/src/layout/mainLayout/header/Navbar.scss +4 -0
- package/src/layout/mainLayout/header/index.js +0 -0
- package/src/layout/mainLayout/sidebar/SideBar.jsx +1402 -0
- package/src/layout/mainLayout/sidebar/Sidebar.css +159 -0
- package/src/layout/mainLayout/sidebar/index.js +0 -0
- package/src/logo.svg +1 -0
- package/src/reportWebVitals.js +13 -0
- package/src/setupFirebaseMessaging.js +28 -0
- package/src/setupTests.js +8 -0
- package/src/store/actions/AuthenticationActions.js +0 -0
- package/src/store/actions/ReportsActions.js +0 -0
- package/src/store/actions/TranslationAction.js +0 -0
- package/src/store/index.js +8 -0
- package/src/store/reducer.js +46 -0
- package/src/store/reducers/AuthenticationReducer.js +50 -0
- package/src/store/reducers/CalendarEventReducer.js +41 -0
- package/src/store/reducers/ConditionClipboardReducer.js +45 -0
- package/src/store/reducers/FeatureReducer.js +27 -0
- package/src/store/reducers/FormConfiguratorReducer.js +38 -0
- package/src/store/reducers/LoadingReducer.js +20 -0
- package/src/store/reducers/MembersAuthenticationReducer.js +28 -0
- package/src/store/reducers/PrescriptionPadReducer.js +329 -0
- package/src/store/reducers/QuestionaireReducer.js +29 -0
- package/src/store/reducers/ReportsReducer.js +24 -0
- package/src/store/reducers/SkeletonReducer.js +20 -0
- package/src/store/reducers/ThemeReducer.js +106 -0
- package/src/store/reducers/TranslationReducer.js +126 -0
- package/src/store/reducers/dashboardEditorSlice.js +77 -0
- package/src/store/reducers/districtHealthDashboardSlice.js +58 -0
- package/src/store/reducers/immunizationSlice.js +234 -0
- package/src/store/slices/dashboardPagesSlice.js +51 -0
- package/src/store/slices/dashboardSlice.js +14 -0
- package/src/utils/.gitkeep +0 -0
- package/src/utils/FormConstants.js +2629 -0
- package/src/utils/GujaratTopoChart.jsx +483 -0
- package/src/utils/UUIDgenerator.js +8 -0
- package/src/utils/appointment-utils/appointment-utils.js +123 -0
- package/src/utils/feature.js +42 -0
- package/src/utils/getThemeColor.js +12 -0
- package/src/utils/localStorageHelper.js +11 -0
- package/src/utils/notifications/enable-push-notifications.js +27 -0
- package/src/utils/resolveAppliedStyle.js +11 -0
- package/src/utils/themeConfigs.js +1483 -0
- package/src/views/custom-components/.gitkeep +0 -0
- package/src/views/custom-components/AgIconButton/RIf.jsx +14 -0
- package/src/views/custom-components/AgIconButton/button.jsx +108 -0
- package/src/views/custom-components/AgIconButton/waterDrop.jsx +95 -0
- package/src/views/custom-components/AgIconButton/waterDrop.scss +37 -0
- package/src/views/custom-components/AlertPlaceholder.jsx +32 -0
- package/src/views/custom-components/AllFaIconsSelector.jsx +56 -0
- package/src/views/custom-components/CkEditor/CkEditor.js +102 -0
- package/src/views/custom-components/CustomAccordion.jsx +72 -0
- package/src/views/custom-components/CustomActionIcons.jsx +118 -0
- package/src/views/custom-components/CustomAutoComplete.jsx +188 -0
- package/src/views/custom-components/CustomCheckBox.jsx +60 -0
- package/src/views/custom-components/CustomConfirmationModal.jsx +118 -0
- package/src/views/custom-components/CustomCountrySelect.jsx +129 -0
- package/src/views/custom-components/CustomDatePicker.jsx +122 -0
- package/src/views/custom-components/CustomDropdown.jsx +191 -0
- package/src/views/custom-components/CustomFileUpload.jsx +387 -0
- package/src/views/custom-components/CustomFullCalendar.jsx +514 -0
- package/src/views/custom-components/CustomInfiniteScroll.jsx +126 -0
- package/src/views/custom-components/CustomRadioComponent.jsx +65 -0
- package/src/views/custom-components/CustomStatsComponent.jsx +114 -0
- package/src/views/custom-components/CustomSvgUpload.jsx +170 -0
- package/src/views/custom-components/CustomSwitch.jsx +37 -0
- package/src/views/custom-components/CustomTabPanel.jsx +19 -0
- package/src/views/custom-components/CustomTextArea.jsx +62 -0
- package/src/views/custom-components/CustomTextArea.scss +27 -0
- package/src/views/custom-components/CustomTextField.jsx +116 -0
- package/src/views/custom-components/CustomToggleSwitch.jsx +138 -0
- package/src/views/custom-components/CustomTooltip.jsx +51 -0
- package/src/views/custom-components/CustomZoomImage.jsx +134 -0
- package/src/views/custom-components/CustomizedTable/CustomizedTableV2.jsx +1407 -0
- package/src/views/custom-components/CustomizedTable/VirtualizeTableBody.jsx +295 -0
- package/src/views/custom-components/CustomizedTable/helper.jsx +159 -0
- package/src/views/custom-components/CustomizedTable.jsx +532 -0
- package/src/views/custom-components/EditInputField.jsx +174 -0
- package/src/views/custom-components/FieldDescription.jsx +22 -0
- package/src/views/custom-components/FileDisplayComponent.jsx +138 -0
- package/src/views/custom-components/FormItem.jsx +53 -0
- package/src/views/custom-components/GenericChart.jsx +80 -0
- package/src/views/custom-components/InfoBadge.jsx +60 -0
- package/src/views/custom-components/PostgresEditor.jsx +801 -0
- package/src/views/custom-components/ResizableEditAutocompleteField.jsx +249 -0
- package/src/views/custom-components/ResizableEditInputField.jsx +215 -0
- package/src/views/custom-components/ResizeableEditSelectField.jsx +197 -0
- package/src/views/custom-components/SideOverlay.jsx +113 -0
- package/src/views/custom-components/SideOverlay.scss +42 -0
- package/src/views/custom-components/calendar.scss +571 -0
- package/src/views/feature-components/.gitkeep +0 -0
- package/src/views/feature-components/Dashboard/DashboardUI.jsx +1043 -0
- package/src/views/feature-components/Dashboard/DhnddModal/AshaDataQualityVerificationModal.jsx +278 -0
- package/src/views/feature-components/Dashboard/PinFeatureModal.jsx +143 -0
- package/src/views/feature-components/Dashboard/QuickLinks.jsx +163 -0
- package/src/views/feature-components/Dashboard/Taskbar.jsx +56 -0
- package/src/views/feature-components/Dashboard/WebtasksFilterForm.jsx +109 -0
- package/src/views/feature-components/Dashboard/WidgetCard.jsx +161 -0
- package/src/views/feature-components/Dashboard/actionModal.jsx +263 -0
- package/src/views/feature-components/Dashboard/ekavachModal/HealthWorkerIncorrectDetailsModal.jsx +332 -0
- package/src/views/feature-components/Dashboard/ekavachModal/MoMaternalDeathVerifcationModal.jsx +275 -0
- package/src/views/feature-components/Dashboard/ekavachModal/MoVerficationForChildScreeningMoadal.jsx +566 -0
- package/src/views/feature-components/FeatureUsageAnalytics/FeatureUsageAnalytics.jsx +989 -0
- package/src/views/feature-components/Features/NewServerManagement.jsx +217 -0
- package/src/views/feature-components/Features/ServerManagement.scss +120 -0
- package/src/views/feature-components/ForgotPassword/ForgotPassword.jsx +226 -0
- package/src/views/feature-components/LocationDirective/LocationDirective.jsx +992 -0
- package/src/views/feature-components/LocationDirective/LocationDirectiveV2.jsx +909 -0
- package/src/views/feature-components/NotFound.jsx +66 -0
- package/src/views/feature-components/Onboarding/Onboarding.jsx +1400 -0
- package/src/views/feature-components/Skeletons.js +115 -0
- package/src/views/feature-components/Unauthorized.jsx +48 -0
- package/src/views/feature-components/VerifyRoute.jsx +88 -0
- package/src/views/feature-components/YearlyRecap/YearlyRecap.jsx +357 -0
- package/src/views/feature-components/YearlyRecap/components/RecapSlide.jsx +183 -0
- package/src/views/feature-components/YearlyRecap/languageTranslator/TranslationContext.js +5 -0
- package/src/views/feature-components/YearlyRecap/languageTranslator/TranslationProvider.jsx +26 -0
- package/src/views/feature-components/YearlyRecap/languageTranslator/i18n.js +46 -0
- package/src/views/feature-components/YearlyRecap/languageTranslator/translations.json +167 -0
- package/src/views/feature-components/YearlyRecap/slides/IntroSlide.jsx +233 -0
- package/src/views/feature-components/YearlyRecap/slides/MaternalHealthSlide.jsx +146 -0
- package/src/views/feature-components/YearlyRecap/slides/MetricSlide.jsx +227 -0
- package/src/views/feature-components/YearlyRecap/slides/OutroSlide.jsx +701 -0
- package/src/views/feature-components/YearlyRecap/slides/ReachSlide.jsx +273 -0
- package/src/views/feature-components/login/Login.jsx +840 -0
- package/src/views/feature-components/login/Login.scss +154 -0
- package/src/views/feature-components/login/LoginConfigurator.jsx +1149 -0
- package/src/views/feature-components/login/TwoFactorSetupModal.jsx +411 -0
- package/src/views/feature-components/login/simplifyMenu.js +45 -0
- package/src/views/feature-components/system-config/ManageSystemConfigs.jsx +284 -0
- package/src/views/feature-components/system-config/SystemConfig.jsx +299 -0
- package/src/views/feature-components/users/ChangePasswordModal.jsx +243 -0
- package/src/views/feature-components/users/PasswordField.jsx +56 -0
- package/dist/index.css +0 -1
- package/dist/index.js +0 -32001
- package/dist/index.js.map +0 -1
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { api } from '@/common/interceptors/AxiosInterceptor';
|
|
2
|
+
import GeneralUtil from './util/GeneralUtil';
|
|
3
|
+
|
|
4
|
+
export const getCount = (implementation) => {
|
|
5
|
+
if (!GeneralUtil.isTecho) {
|
|
6
|
+
return api.get('webtasks/count');
|
|
7
|
+
} else {
|
|
8
|
+
return api.post('webtasks/count');
|
|
9
|
+
}
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export const getWebTasksBasketDetails = (params = {}, implementation) => {
|
|
13
|
+
if (!GeneralUtil.isTecho) {
|
|
14
|
+
return api.get('webtasks/basketdetail', { params });
|
|
15
|
+
} else {
|
|
16
|
+
return api.post('webtasks/basketdetail', {}, { params: params });
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export const getWebTasksAction = (params) => api.get('webtasks/getaction', { params });
|
|
21
|
+
|
|
22
|
+
export const saveAction = (params) => api.post('webtasks/saveaction', params);
|
|
23
|
+
|
|
24
|
+
export const retrieveBasketPreferenceByUserId = (params) => api.get('webtasks/retrievebasketpreference', { params });
|
|
25
|
+
|
|
26
|
+
export const saveBasketPreferenceByUserId = (params) =>
|
|
27
|
+
api.post('webtasks/savebasketpreference', params, { showLoader: false });
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
import dayjs from 'dayjs';
|
|
2
|
+
import { ACTIVE_STATE, DATE_FORMAT, DATE_TIME_FORMAT } from '@/common/constants/teleconsulatationConstant.jsx';
|
|
3
|
+
|
|
4
|
+
export const convertPrescriptionPadDataToApiFormat = async (
|
|
5
|
+
{ medicationsArr, symptomsArr, diagnosisArr, labInvestigationsArr, vaccineArr, advicesArr, soapNotes },
|
|
6
|
+
appointment,
|
|
7
|
+
prescriptionId
|
|
8
|
+
) => {
|
|
9
|
+
const getPrescriptionDetails = (medicines) =>
|
|
10
|
+
medicines.map((medicine) => ({
|
|
11
|
+
id: medicine.id ?? null,
|
|
12
|
+
medicationId: medicine.medicationId,
|
|
13
|
+
duration: medicine.duration,
|
|
14
|
+
purpose: null,
|
|
15
|
+
frequency: medicine.frequency?.trim() ?? null,
|
|
16
|
+
doseTiming: medicine.doseTiming,
|
|
17
|
+
prescribingDoctor: null,
|
|
18
|
+
instructions: medicine.instructions,
|
|
19
|
+
patientId: appointment?.patientId,
|
|
20
|
+
status: medicine.status ?? ACTIVE_STATE,
|
|
21
|
+
startDate: dayjs().format(DATE_TIME_FORMAT),
|
|
22
|
+
endDate: getEndDateForPrescription(medicine.duration),
|
|
23
|
+
prescriptionId: prescriptionId ?? null,
|
|
24
|
+
medicationResponse: {
|
|
25
|
+
id: medicine.medicationId,
|
|
26
|
+
name: medicine.displayName,
|
|
27
|
+
isRx: true,
|
|
28
|
+
status: ACTIVE_STATE,
|
|
29
|
+
},
|
|
30
|
+
}));
|
|
31
|
+
|
|
32
|
+
const getSymptomDetails = (symptoms) =>
|
|
33
|
+
symptoms.map((symptom) => ({
|
|
34
|
+
id: symptom.id ?? null,
|
|
35
|
+
severity: symptom.severity,
|
|
36
|
+
since: symptom.since,
|
|
37
|
+
complaints: 'complaints',
|
|
38
|
+
status: symptom.status ?? ACTIVE_STATE,
|
|
39
|
+
prescriptionId: prescriptionId ?? null,
|
|
40
|
+
symptomResponse: {
|
|
41
|
+
id: symptom.symptomId,
|
|
42
|
+
name: symptom.displayName,
|
|
43
|
+
status: ACTIVE_STATE,
|
|
44
|
+
},
|
|
45
|
+
}));
|
|
46
|
+
|
|
47
|
+
const getDiagnosisDetails = (diagnosisList) =>
|
|
48
|
+
diagnosisList.map((diagnosis) => ({
|
|
49
|
+
id: diagnosis.id ?? null,
|
|
50
|
+
since: '2 days',
|
|
51
|
+
severity: 'MODERATE',
|
|
52
|
+
conclusions: diagnosis.conclusions,
|
|
53
|
+
status: diagnosis.status ?? ACTIVE_STATE,
|
|
54
|
+
prescriptionId: prescriptionId ?? null,
|
|
55
|
+
diagnosisResponse: {
|
|
56
|
+
id: diagnosis.diagnosisId,
|
|
57
|
+
name: diagnosis.displayName,
|
|
58
|
+
status: ACTIVE_STATE,
|
|
59
|
+
},
|
|
60
|
+
}));
|
|
61
|
+
|
|
62
|
+
const getLabTestDetails = (labTests) =>
|
|
63
|
+
labTests.map((labTest) => ({
|
|
64
|
+
id: labTest.id ?? null,
|
|
65
|
+
patientId: appointment?.patientId,
|
|
66
|
+
labTestId: labTest.labTestId,
|
|
67
|
+
reportDate: dayjs().format(DATE_FORMAT),
|
|
68
|
+
performedBy: null,
|
|
69
|
+
orderedBy: null,
|
|
70
|
+
instructions: labTest.instructions,
|
|
71
|
+
status: labTest.status ?? ACTIVE_STATE,
|
|
72
|
+
prescriptionId: prescriptionId ?? null,
|
|
73
|
+
labTestResponse: {
|
|
74
|
+
id: labTest.labTestId,
|
|
75
|
+
name: labTest.displayName,
|
|
76
|
+
status: ACTIVE_STATE,
|
|
77
|
+
},
|
|
78
|
+
}));
|
|
79
|
+
|
|
80
|
+
const getVaccineDetails = (vaccines) =>
|
|
81
|
+
vaccines.map((vaccine) => ({
|
|
82
|
+
id: vaccine?.id ?? null,
|
|
83
|
+
patientId: appointment?.patientId,
|
|
84
|
+
vaccineId: vaccine?.vaccineId,
|
|
85
|
+
instructions: 'use wisely',
|
|
86
|
+
vaccineName: vaccine?.vaccineName,
|
|
87
|
+
dose: vaccine?.dose,
|
|
88
|
+
frequency: vaccine?.frequency ?? null,
|
|
89
|
+
prescribingDoctor: null,
|
|
90
|
+
administeredOn: vaccine?.administeredOn,
|
|
91
|
+
status: vaccine?.status ?? ACTIVE_STATE,
|
|
92
|
+
prescriptionId: prescriptionId ?? null,
|
|
93
|
+
vaccineResponse: {
|
|
94
|
+
...vaccine.vaccineResponse,
|
|
95
|
+
id: vaccine.vaccineId,
|
|
96
|
+
},
|
|
97
|
+
}));
|
|
98
|
+
|
|
99
|
+
// const getProcedureDetails = (procedures) =>
|
|
100
|
+
// procedures.map((procedure) => ({
|
|
101
|
+
// id: procedure.id ?? null,
|
|
102
|
+
// procedureId: procedure.procedureId,
|
|
103
|
+
// instructions: procedure.instructions,
|
|
104
|
+
// performedBy: null,
|
|
105
|
+
// datePerformed: dayjs().format(DATE_FORMAT),
|
|
106
|
+
// complications: null,
|
|
107
|
+
// conclusions: null,
|
|
108
|
+
// prescriptionId: procedure.prescriptionId ?? null,
|
|
109
|
+
// status: procedure.status ?? ACTIVE_STATE,
|
|
110
|
+
// procedureResponse: {
|
|
111
|
+
// ...procedure.procedureResponse,
|
|
112
|
+
// id: procedure.procedureId,
|
|
113
|
+
// name: procedure.displayName,
|
|
114
|
+
// },
|
|
115
|
+
// }));
|
|
116
|
+
|
|
117
|
+
let generatedSoapNotes;
|
|
118
|
+
if (soapNotes) {
|
|
119
|
+
// eslint-disable-next-line no-unused-vars
|
|
120
|
+
let { oldPrescription, ...restSoap } = soapNotes;
|
|
121
|
+
generatedSoapNotes = restSoap;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
return {
|
|
125
|
+
appointmentId: appointment?.id,
|
|
126
|
+
appointmentResponse: appointment,
|
|
127
|
+
additionalRecommendations: advicesArr.map((advice) => advice?.displayName).join(', '),
|
|
128
|
+
doctorSignature: 'Signature',
|
|
129
|
+
followUpDate: dayjs().add(7, 'day').format(DATE_FORMAT),
|
|
130
|
+
referredTo: null,
|
|
131
|
+
status: ACTIVE_STATE,
|
|
132
|
+
templateId: null,
|
|
133
|
+
prescriptionMedicationResponses: getPrescriptionDetails(medicationsArr),
|
|
134
|
+
prescriptionSymptomResponses: getSymptomDetails(symptomsArr),
|
|
135
|
+
prescriptionDiagnosisResponses: getDiagnosisDetails(diagnosisArr),
|
|
136
|
+
prescriptionLabReportResponses: getLabTestDetails(labInvestigationsArr),
|
|
137
|
+
prescriptionVaccineResponses: getVaccineDetails(vaccineArr),
|
|
138
|
+
// prescriptionProcedureResponses: getProcedureDetails(procedureArr),
|
|
139
|
+
soapNotes: generatedSoapNotes,
|
|
140
|
+
};
|
|
141
|
+
};
|
|
142
|
+
|
|
143
|
+
const getEndDateForPrescription = (duration) => {
|
|
144
|
+
const [countStr, type] = duration.split(' ');
|
|
145
|
+
const count = parseInt(countStr);
|
|
146
|
+
if (isNaN(count)) return null;
|
|
147
|
+
|
|
148
|
+
let endDate = dayjs();
|
|
149
|
+
switch (type?.toLowerCase()) {
|
|
150
|
+
case 'day':
|
|
151
|
+
case 'days':
|
|
152
|
+
endDate = endDate.add(count, 'day');
|
|
153
|
+
break;
|
|
154
|
+
case 'week':
|
|
155
|
+
case 'weeks':
|
|
156
|
+
endDate = endDate.add(count, 'week');
|
|
157
|
+
break;
|
|
158
|
+
case 'month':
|
|
159
|
+
case 'months':
|
|
160
|
+
endDate = endDate.add(count, 'month');
|
|
161
|
+
break;
|
|
162
|
+
default:
|
|
163
|
+
return null;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
return endDate.format(DATE_TIME_FORMAT);
|
|
167
|
+
};
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { getUUID } from '@/common/constants/teleconsulatationConstant.jsx';
|
|
2
|
+
|
|
3
|
+
export const convertPrescriptionDataToUIFormat = async (prescriptionData) => {
|
|
4
|
+
try {
|
|
5
|
+
const diagnosisArr =
|
|
6
|
+
prescriptionData?.prescriptionDiagnosisResponses?.map((diagnosis) => ({
|
|
7
|
+
...diagnosis,
|
|
8
|
+
displayName: diagnosis.diagnosisResponse.name,
|
|
9
|
+
category: 'DX',
|
|
10
|
+
diagnosisId: diagnosis.diagnosisResponse.id,
|
|
11
|
+
id: diagnosis.id || getUUID(),
|
|
12
|
+
})) ?? [];
|
|
13
|
+
|
|
14
|
+
const symptomsArr =
|
|
15
|
+
prescriptionData?.prescriptionSymptomResponses?.map((symptom) => ({
|
|
16
|
+
...symptom,
|
|
17
|
+
displayName: symptom.symptomResponse.name,
|
|
18
|
+
category: 'CC',
|
|
19
|
+
symptomId: symptom.symptomResponse.id,
|
|
20
|
+
id: symptom.id || getUUID(),
|
|
21
|
+
})) ?? [];
|
|
22
|
+
|
|
23
|
+
const medicationsArr =
|
|
24
|
+
prescriptionData?.prescriptionMedicationResponses?.map((medication) => ({
|
|
25
|
+
...medication,
|
|
26
|
+
displayName: medication.medicationResponse.name,
|
|
27
|
+
category: 'RX',
|
|
28
|
+
id: medication.id || getUUID(),
|
|
29
|
+
})) ?? [];
|
|
30
|
+
|
|
31
|
+
const labInvestigationsArr =
|
|
32
|
+
prescriptionData?.prescriptionLabReportResponses?.map((labTest) => ({
|
|
33
|
+
...labTest,
|
|
34
|
+
displayName: labTest.labTestResponse.name,
|
|
35
|
+
category: 'LAB',
|
|
36
|
+
id: labTest.id || getUUID(),
|
|
37
|
+
})) ?? [];
|
|
38
|
+
|
|
39
|
+
const vaccineArr =
|
|
40
|
+
prescriptionData?.prescriptionVaccineResponses?.map((vaccine) => ({
|
|
41
|
+
...vaccine,
|
|
42
|
+
displayName: vaccine.vaccineResponse.name,
|
|
43
|
+
category: 'VX',
|
|
44
|
+
id: vaccine.id || getUUID(),
|
|
45
|
+
})) ?? [];
|
|
46
|
+
|
|
47
|
+
const procedureArr =
|
|
48
|
+
prescriptionData?.prescriptionProcedureResponses?.map((procedure) => ({
|
|
49
|
+
...procedure,
|
|
50
|
+
displayName: procedure.procedureResponse.name,
|
|
51
|
+
category: 'SX',
|
|
52
|
+
id: procedure.id || getUUID(),
|
|
53
|
+
})) ?? [];
|
|
54
|
+
|
|
55
|
+
let advicesArr = [];
|
|
56
|
+
if (prescriptionData?.additionalRecommendations && prescriptionData?.additionalRecommendations !== '') {
|
|
57
|
+
advicesArr = prescriptionData?.additionalRecommendations?.split(',').map((advice) => {
|
|
58
|
+
return {
|
|
59
|
+
category: 'ADV',
|
|
60
|
+
displayName: advice.trim(),
|
|
61
|
+
};
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
const data = {
|
|
66
|
+
diagnosisArr,
|
|
67
|
+
symptomsArr,
|
|
68
|
+
medicationsArr,
|
|
69
|
+
labInvestigationsArr,
|
|
70
|
+
vaccineArr,
|
|
71
|
+
procedureArr,
|
|
72
|
+
advicesArr,
|
|
73
|
+
soapNotes: prescriptionData?.soapNotes || {},
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
return {
|
|
77
|
+
data,
|
|
78
|
+
};
|
|
79
|
+
} catch (error) {
|
|
80
|
+
console.error(error);
|
|
81
|
+
}
|
|
82
|
+
};
|