@argusoft/medplat-app-shell 1.0.6 → 1.0.7

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.
Files changed (263) hide show
  1. package/package.json +139 -141
  2. package/src/GlobalErrorBoundary.jsx +31 -0
  3. package/src/SilentErrorFallback.jsx +68 -0
  4. package/src/TrackingProviderWrapper.jsx +40 -0
  5. package/src/_tests_/__mocks__/MockTranslationProvider.jsx +21 -0
  6. package/src/_tests_/__mocks__/ckeditor.js +45 -0
  7. package/src/_tests_/__mocks__/fileMock.js +1 -0
  8. package/src/_tests_/__mocks__/useranalytics.js +5 -0
  9. package/src/_tests_/views/components/Dashboard/DashboardUI.test.jsx +137 -0
  10. package/src/_tests_/views/components/Dashboard/DashboardUIMock.js +877 -0
  11. package/src/_tests_/views/components/ForgotPassword/ForgotPassword.test.jsx +314 -0
  12. package/src/_tests_/views/components/LocationDirective/LocationDirective.test.jsx.disable +229 -0
  13. package/src/_tests_/views/components/LocationDirective/mockLocationDirective.js +810 -0
  14. package/src/_tests_/views/components/LocationType/MockLocationType.js +42259 -0
  15. package/src/_tests_/views/components/LocationType/addlocationtype.test.jsx.disable +276 -0
  16. package/src/_tests_/views/components/LocationType/editlocationtype.test.jsx.disable +262 -0
  17. package/src/_tests_/views/components/LocationType/locationtype.test.jsx.disable +148 -0
  18. package/src/_tests_/views/components/Profile/UpdateProfileModalData.js +4396 -0
  19. package/src/_tests_/views/components/Profile/updateprofilemodal.test.jsx +282 -0
  20. package/src/_tests_/views/components/SideBar/MockSideBar.js +1379 -0
  21. package/src/_tests_/views/components/SideBar/SideBar.test.jsx +98 -0
  22. package/src/_tests_/views/components/SystemConfig/ManageSystemConfig/AddManageSystemConfig.test.jsx.disable +164 -0
  23. package/src/_tests_/views/components/SystemConfig/ManageSystemConfig/UpdateManageSystemConfig.test.jsx.disable +157 -0
  24. package/src/_tests_/views/components/SystemConfig/MockSystemConfig.js +1280 -0
  25. package/src/_tests_/views/components/SystemConfig/SystemConfig.test.jsx.disable +165 -0
  26. package/src/_tests_/views/components/login/Login.test.jsx +276 -0
  27. package/src/_tests_/views/components/login/MockAuthorise.js +2414 -0
  28. package/src/_tests_/views/components/login/ServiceResponse.js +595 -0
  29. package/src/_tests_/views/components/user/MockManageUser.js +7965 -0
  30. package/src/_tests_/views/components/user/manageuser.test.jsx.disable +989 -0
  31. package/src/_tests_/views/components/user/mockUsersData.js +582 -0
  32. package/src/assets/img/OASISLogin.png +0 -0
  33. package/src/assets/img/bahaarNew.png +0 -0
  34. package/src/assets/img/dnhdd4K.png +0 -0
  35. package/src/assets/img/govtofup.png +0 -0
  36. package/src/assets/img/sewarural4K.png +0 -0
  37. package/src/assets/img/techo4K.png +0 -0
  38. package/src/assets/img/up4K.png +0 -0
  39. package/src/common/HolidayList.jsx +573 -0
  40. package/src/common/MalaciaousInputUtil.js +23 -0
  41. package/src/common/SafeHtml.jsx +17 -0
  42. package/src/common/VersionManager.jsx +109 -0
  43. package/src/common/constants/PerformanceDashboard.js +514 -0
  44. package/src/common/constants/app.constant.js +781 -0
  45. package/src/common/constants/cccVerificationConstants.js +18 -0
  46. package/src/common/constants/fhsrConstant.js +33 -0
  47. package/src/common/constants/gvk-verification.constant.js +76 -0
  48. package/src/common/constants/search.constant.js +23 -0
  49. package/src/common/constants/teleconsulatationConstant.jsx +1339 -0
  50. package/src/common/directives/SearchTemplate.jsx +784 -0
  51. package/src/common/directives/SearchTemplate.scss +14 -0
  52. package/src/common/dynamicView/DynamicView.jsx +353 -0
  53. package/src/common/dynamicView/InputFieldComponent.jsx +1501 -0
  54. package/src/common/dynamicView/InputViewComponent.jsx +298 -0
  55. package/src/common/dynamicView/InputViewComponent.scss +15 -0
  56. package/src/common/env.js +5 -0
  57. package/src/common/filters/locationNameFilter.js +26 -0
  58. package/src/common/fontAwesomeIcons/FontAwesomeIcons.jsx +27 -0
  59. package/src/common/fontAwesomeIcons/FontAwesomeIconsNames.js +1968 -0
  60. package/src/common/fontPreferences/fontSizeProvider.jsx +34 -0
  61. package/src/common/fontPreferences/fontSizeSelector.jsx +116 -0
  62. package/src/common/getAssignedFeature/getAssignedFeature.js +32 -0
  63. package/src/common/interceptors/AxiosInterceptor.js +216 -0
  64. package/src/common/languageTranslator/TranslationContext.js +5 -0
  65. package/src/common/languageTranslator/TranslationProvider.jsx +24 -0
  66. package/src/common/languageTranslator/i18n.js +49 -0
  67. package/src/common/services/AuthenticateService.js +116 -0
  68. package/src/common/services/DownloadFile.js +35 -0
  69. package/src/common/services/ForgotPassword.js +18 -0
  70. package/src/common/services/FormConfiguratorService.js +195 -0
  71. package/src/common/services/GlobalApis.js +84 -0
  72. package/src/common/services/InterceptorNavigationService.js +17 -0
  73. package/src/common/services/LocationService.js +65 -0
  74. package/src/common/services/LocationType.js +11 -0
  75. package/src/common/services/QueryBuilder.js +36 -0
  76. package/src/common/services/Roles.js +28 -0
  77. package/src/common/services/SyncWithServer.js +15 -0
  78. package/src/common/services/SystemConfig.js +15 -0
  79. package/src/common/services/TranslationService.js +70 -0
  80. package/src/common/services/TwoFactorService.js +7 -0
  81. package/src/common/services/Users.js +91 -0
  82. package/src/common/services/Webtasks.js +27 -0
  83. package/src/common/services/util/Convert-pad-data-to-API-format.jsx +167 -0
  84. package/src/common/services/util/Convert-to-UI-format.jsx +82 -0
  85. package/src/common/services/util/EmptyPrescriptionPadData.jsx +11 -0
  86. package/src/common/services/util/GeneralUtil.js +456 -0
  87. package/src/common/services/util/Prescription-pad-util.js +339 -0
  88. package/src/common/services/util/PrescriptionPadData.js +67 -0
  89. package/src/common/services/util/PrescriptionpadCommonUtil.js +96 -0
  90. package/src/common/services/util/ReportFieldUtil.jsx +398 -0
  91. package/src/common/services/util/WebSocketContext.jsx +261 -0
  92. package/src/common/syncWithServer/SyncWithServerDialog.jsx +170 -0
  93. package/src/common/syncWithServer/SyncWithServerDialogSkeleton.jsx +67 -0
  94. package/src/common/tests/CustomWrapper.jsx +49 -0
  95. package/src/common/tests/TranslationWrapper.jsx +38 -0
  96. package/src/common/themeProvider/ColorInputs.jsx +97 -0
  97. package/src/common/themeProvider/EditableColorInput.jsx +128 -0
  98. package/src/common/themeProvider/ThemeEditor.jsx +319 -0
  99. package/src/common/themeProvider/ThemeProvider.jsx +210 -0
  100. package/src/common/themeProvider/themeConfig.js +558 -0
  101. package/src/common/toaster/toaster.jsx +30 -0
  102. package/src/firebaseConfig.js +24 -0
  103. package/src/global.scss +221 -0
  104. package/src/hooks/.gitkeep +0 -0
  105. package/src/hooks/useAESEncryption.js +56 -0
  106. package/src/hooks/useCaching.js +43 -0
  107. package/src/hooks/useDebounce.js +34 -0
  108. package/src/hooks/useDebounceFn.js +50 -0
  109. package/src/hooks/useDownloadPdf.js +358 -0
  110. package/src/hooks/useDownloadXlsx.js +55 -0
  111. package/src/hooks/useListValueFieldValues.js +30 -0
  112. package/src/hooks/useLocationHierarchies.js +63 -0
  113. package/src/hooks/useLocationHierarchyTranslate.js +16 -0
  114. package/src/hooks/useOnline.js +27 -0
  115. package/src/hooks/usePagination.js +63 -0
  116. package/src/hooks/useRefreshToken.js +87 -0
  117. package/src/hooks/useScript.js +25 -0
  118. package/src/hooks/useStopwatch.js +75 -0
  119. package/src/hooks/useTrackEvent.js +22 -0
  120. package/src/hooks/useWebAudioRecorder.js +115 -0
  121. package/src/layout/LoaderComponet.jsx +22 -0
  122. package/src/layout/LoaderContext.jsx +29 -0
  123. package/src/layout/mainLayout/AdaptiveZoom.jsx +27 -0
  124. package/src/layout/mainLayout/Chatbot.jsx +243 -0
  125. package/src/layout/mainLayout/Layout.jsx +445 -0
  126. package/src/layout/mainLayout/Profile/UpdateProfileModal.jsx +684 -0
  127. package/src/layout/mainLayout/header/LogoutModal.jsx +131 -0
  128. package/src/layout/mainLayout/header/Navbar.jsx +1677 -0
  129. package/src/layout/mainLayout/header/Navbar.scss +4 -0
  130. package/src/layout/mainLayout/header/index.js +0 -0
  131. package/src/layout/mainLayout/sidebar/SideBar.jsx +1402 -0
  132. package/src/layout/mainLayout/sidebar/Sidebar.css +159 -0
  133. package/src/layout/mainLayout/sidebar/index.js +0 -0
  134. package/src/logo.svg +1 -0
  135. package/src/reportWebVitals.js +13 -0
  136. package/src/setupFirebaseMessaging.js +28 -0
  137. package/src/setupTests.js +8 -0
  138. package/src/store/actions/AuthenticationActions.js +0 -0
  139. package/src/store/actions/ReportsActions.js +0 -0
  140. package/src/store/actions/TranslationAction.js +0 -0
  141. package/src/store/index.js +8 -0
  142. package/src/store/reducer.js +46 -0
  143. package/src/store/reducers/AuthenticationReducer.js +50 -0
  144. package/src/store/reducers/CalendarEventReducer.js +41 -0
  145. package/src/store/reducers/ConditionClipboardReducer.js +45 -0
  146. package/src/store/reducers/FeatureReducer.js +27 -0
  147. package/src/store/reducers/FormConfiguratorReducer.js +38 -0
  148. package/src/store/reducers/LoadingReducer.js +20 -0
  149. package/src/store/reducers/MembersAuthenticationReducer.js +28 -0
  150. package/src/store/reducers/PrescriptionPadReducer.js +329 -0
  151. package/src/store/reducers/QuestionaireReducer.js +29 -0
  152. package/src/store/reducers/ReportsReducer.js +24 -0
  153. package/src/store/reducers/SkeletonReducer.js +20 -0
  154. package/src/store/reducers/ThemeReducer.js +106 -0
  155. package/src/store/reducers/TranslationReducer.js +126 -0
  156. package/src/store/reducers/dashboardEditorSlice.js +77 -0
  157. package/src/store/reducers/districtHealthDashboardSlice.js +58 -0
  158. package/src/store/reducers/immunizationSlice.js +234 -0
  159. package/src/store/slices/dashboardPagesSlice.js +51 -0
  160. package/src/utils/.gitkeep +0 -0
  161. package/src/utils/FormConstants.js +2629 -0
  162. package/src/utils/GujaratTopoChart.jsx +483 -0
  163. package/src/utils/UUIDgenerator.js +8 -0
  164. package/src/utils/appointment-utils/appointment-utils.js +123 -0
  165. package/src/utils/feature.js +42 -0
  166. package/src/utils/getThemeColor.js +12 -0
  167. package/src/utils/localStorageHelper.js +11 -0
  168. package/src/utils/notifications/enable-push-notifications.js +27 -0
  169. package/src/utils/resolveAppliedStyle.js +11 -0
  170. package/src/utils/themeConfigs.js +1483 -0
  171. package/src/views/custom-components/.gitkeep +0 -0
  172. package/src/views/custom-components/AgIconButton/RIf.jsx +14 -0
  173. package/src/views/custom-components/AgIconButton/button.jsx +108 -0
  174. package/src/views/custom-components/AgIconButton/waterDrop.jsx +95 -0
  175. package/src/views/custom-components/AgIconButton/waterDrop.scss +37 -0
  176. package/src/views/custom-components/AlertPlaceholder.jsx +32 -0
  177. package/src/views/custom-components/AllFaIconsSelector.jsx +56 -0
  178. package/src/views/custom-components/CkEditor/CkEditor.js +102 -0
  179. package/src/views/custom-components/CustomAccordion.jsx +72 -0
  180. package/src/views/custom-components/CustomActionIcons.jsx +118 -0
  181. package/src/views/custom-components/CustomAutoComplete.jsx +188 -0
  182. package/src/views/custom-components/CustomCheckBox.jsx +60 -0
  183. package/src/views/custom-components/CustomConfirmationModal.jsx +118 -0
  184. package/src/views/custom-components/CustomCountrySelect.jsx +129 -0
  185. package/src/views/custom-components/CustomDatePicker.jsx +122 -0
  186. package/src/views/custom-components/CustomDropdown.jsx +191 -0
  187. package/src/views/custom-components/CustomFileUpload.jsx +387 -0
  188. package/src/views/custom-components/CustomFullCalendar.jsx +514 -0
  189. package/src/views/custom-components/CustomInfiniteScroll.jsx +126 -0
  190. package/src/views/custom-components/CustomRadioComponent.jsx +65 -0
  191. package/src/views/custom-components/CustomStatsComponent.jsx +114 -0
  192. package/src/views/custom-components/CustomSvgUpload.jsx +170 -0
  193. package/src/views/custom-components/CustomSwitch.jsx +37 -0
  194. package/src/views/custom-components/CustomTabPanel.jsx +19 -0
  195. package/src/views/custom-components/CustomTextArea.jsx +62 -0
  196. package/src/views/custom-components/CustomTextArea.scss +27 -0
  197. package/src/views/custom-components/CustomTextField.jsx +116 -0
  198. package/src/views/custom-components/CustomToggleSwitch.jsx +138 -0
  199. package/src/views/custom-components/CustomTooltip.jsx +51 -0
  200. package/src/views/custom-components/CustomZoomImage.jsx +134 -0
  201. package/src/views/custom-components/CustomizedTable/CustomizedTableV2.jsx +1407 -0
  202. package/src/views/custom-components/CustomizedTable/VirtualizeTableBody.jsx +295 -0
  203. package/src/views/custom-components/CustomizedTable/helper.jsx +159 -0
  204. package/src/views/custom-components/CustomizedTable.jsx +532 -0
  205. package/src/views/custom-components/EditInputField.jsx +174 -0
  206. package/src/views/custom-components/FieldDescription.jsx +22 -0
  207. package/src/views/custom-components/FileDisplayComponent.jsx +138 -0
  208. package/src/views/custom-components/FormItem.jsx +53 -0
  209. package/src/views/custom-components/GenericChart.jsx +80 -0
  210. package/src/views/custom-components/InfoBadge.jsx +60 -0
  211. package/src/views/custom-components/PostgresEditor.jsx +801 -0
  212. package/src/views/custom-components/ResizableEditAutocompleteField.jsx +249 -0
  213. package/src/views/custom-components/ResizableEditInputField.jsx +215 -0
  214. package/src/views/custom-components/ResizeableEditSelectField.jsx +197 -0
  215. package/src/views/custom-components/SideOverlay.jsx +113 -0
  216. package/src/views/custom-components/SideOverlay.scss +42 -0
  217. package/src/views/custom-components/calendar.scss +571 -0
  218. package/src/views/feature-components/.gitkeep +0 -0
  219. package/src/views/feature-components/Dashboard/DashboardUI.jsx +1043 -0
  220. package/src/views/feature-components/Dashboard/DhnddModal/AshaDataQualityVerificationModal.jsx +278 -0
  221. package/src/views/feature-components/Dashboard/PinFeatureModal.jsx +143 -0
  222. package/src/views/feature-components/Dashboard/QuickLinks.jsx +163 -0
  223. package/src/views/feature-components/Dashboard/Taskbar.jsx +56 -0
  224. package/src/views/feature-components/Dashboard/WebtasksFilterForm.jsx +109 -0
  225. package/src/views/feature-components/Dashboard/WidgetCard.jsx +161 -0
  226. package/src/views/feature-components/Dashboard/actionModal.jsx +263 -0
  227. package/src/views/feature-components/Dashboard/ekavachModal/HealthWorkerIncorrectDetailsModal.jsx +332 -0
  228. package/src/views/feature-components/Dashboard/ekavachModal/MoMaternalDeathVerifcationModal.jsx +275 -0
  229. package/src/views/feature-components/Dashboard/ekavachModal/MoVerficationForChildScreeningMoadal.jsx +566 -0
  230. package/src/views/feature-components/FeatureUsageAnalytics/FeatureUsageAnalytics.jsx +989 -0
  231. package/src/views/feature-components/Features/NewServerManagement.jsx +217 -0
  232. package/src/views/feature-components/Features/ServerManagement.scss +120 -0
  233. package/src/views/feature-components/ForgotPassword/ForgotPassword.jsx +226 -0
  234. package/src/views/feature-components/LocationDirective/LocationDirective.jsx +992 -0
  235. package/src/views/feature-components/LocationDirective/LocationDirectiveV2.jsx +909 -0
  236. package/src/views/feature-components/NotFound.jsx +66 -0
  237. package/src/views/feature-components/Onboarding/Onboarding.jsx +1400 -0
  238. package/src/views/feature-components/Skeletons.js +115 -0
  239. package/src/views/feature-components/Unauthorized.jsx +48 -0
  240. package/src/views/feature-components/VerifyRoute.jsx +88 -0
  241. package/src/views/feature-components/YearlyRecap/YearlyRecap.jsx +357 -0
  242. package/src/views/feature-components/YearlyRecap/components/RecapSlide.jsx +183 -0
  243. package/src/views/feature-components/YearlyRecap/languageTranslator/TranslationContext.js +5 -0
  244. package/src/views/feature-components/YearlyRecap/languageTranslator/TranslationProvider.jsx +26 -0
  245. package/src/views/feature-components/YearlyRecap/languageTranslator/i18n.js +46 -0
  246. package/src/views/feature-components/YearlyRecap/languageTranslator/translations.json +167 -0
  247. package/src/views/feature-components/YearlyRecap/slides/IntroSlide.jsx +233 -0
  248. package/src/views/feature-components/YearlyRecap/slides/MaternalHealthSlide.jsx +146 -0
  249. package/src/views/feature-components/YearlyRecap/slides/MetricSlide.jsx +227 -0
  250. package/src/views/feature-components/YearlyRecap/slides/OutroSlide.jsx +701 -0
  251. package/src/views/feature-components/YearlyRecap/slides/ReachSlide.jsx +273 -0
  252. package/src/views/feature-components/login/Login.jsx +840 -0
  253. package/src/views/feature-components/login/Login.scss +154 -0
  254. package/src/views/feature-components/login/LoginConfigurator.jsx +1149 -0
  255. package/src/views/feature-components/login/TwoFactorSetupModal.jsx +411 -0
  256. package/src/views/feature-components/login/simplifyMenu.js +45 -0
  257. package/src/views/feature-components/system-config/ManageSystemConfigs.jsx +284 -0
  258. package/src/views/feature-components/system-config/SystemConfig.jsx +299 -0
  259. package/src/views/feature-components/users/ChangePasswordModal.jsx +243 -0
  260. package/src/views/feature-components/users/PasswordField.jsx +56 -0
  261. package/dist/index.css +0 -1
  262. package/dist/index.js +0 -32001
  263. package/dist/index.js.map +0 -1
@@ -0,0 +1,339 @@
1
+ import {
2
+ ACTIVE_STATE,
3
+ DATE_FORMAT,
4
+ DATE_TIME_FORMAT,
5
+ getUUID,
6
+ INACTIVE_STATE,
7
+ } from '@/common/constants/teleconsulatationConstant.jsx';
8
+ import dayjs from 'dayjs';
9
+
10
+ /**
11
+ * Marks all prescription data as inactive by setting their status to INACTIVE_STATE.
12
+ *
13
+ * @param {Object} prescriptionData - The current prescription data containing arrays for diagnosis, symptoms, medications, lab investigations, vaccines, procedures, and advices.
14
+ * @param {Object} removedPrescriptionData - The previously removed prescription data containing arrays for diagnosis, symptoms, medications, lab investigations, vaccines, procedures, and advices.
15
+ * @returns {Object} - An object with arrays for each category, containing the merged and updated prescription data marked as inactive.
16
+ */
17
+
18
+ export const markAllPrescriptionDataInactive = (prescriptionData, removedPrescriptionData) => {
19
+ return {
20
+ diagnosisArr: [
21
+ ...removedPrescriptionData.diagnosisArr,
22
+ ...prescriptionData.diagnosisArr.map((item) => ({
23
+ ...item,
24
+ status: INACTIVE_STATE,
25
+ })),
26
+ ],
27
+ symptomsArr: [
28
+ ...removedPrescriptionData.symptomsArr,
29
+ ...prescriptionData.symptomsArr.map((item) => ({
30
+ ...item,
31
+ status: INACTIVE_STATE,
32
+ })),
33
+ ],
34
+ medicationsArr: [
35
+ ...removedPrescriptionData.medicationsArr,
36
+ ...prescriptionData.medicationsArr.map((item) => ({
37
+ ...item,
38
+ status: INACTIVE_STATE,
39
+ })),
40
+ ],
41
+ labInvestigationsArr: [
42
+ ...removedPrescriptionData.labInvestigationsArr,
43
+ ...prescriptionData.labInvestigationsArr.map((item) => ({
44
+ ...item,
45
+ status: INACTIVE_STATE,
46
+ })),
47
+ ],
48
+ vaccineArr: [
49
+ ...removedPrescriptionData.vaccineArr,
50
+ ...prescriptionData.vaccineArr.map((item) => ({
51
+ ...item,
52
+ status: INACTIVE_STATE,
53
+ })),
54
+ ],
55
+ procedureArr: [
56
+ ...removedPrescriptionData.procedureArr,
57
+ ...prescriptionData.procedureArr.map((item) => ({
58
+ ...item,
59
+ status: INACTIVE_STATE,
60
+ })),
61
+ ],
62
+ advicesArr: [
63
+ ...removedPrescriptionData.advicesArr,
64
+ ...prescriptionData.advicesArr.map((item) => ({
65
+ ...item,
66
+ status: INACTIVE_STATE,
67
+ })),
68
+ ],
69
+ };
70
+ };
71
+
72
+ export const getEndDateForPrescriptionMedication = (duration) => {
73
+ if (!duration) return null;
74
+ const [countStr, type] = duration.split(' ');
75
+ const count = parseInt(countStr);
76
+ if (isNaN(count)) {
77
+ return null;
78
+ }
79
+ let endDate = dayjs();
80
+ switch (type?.toLowerCase()) {
81
+ case 'day':
82
+ case 'days':
83
+ endDate = endDate.add(count, 'day');
84
+ break;
85
+ case 'week':
86
+ case 'weeks':
87
+ endDate = endDate.add(count, 'week');
88
+ break;
89
+ case 'month':
90
+ case 'months':
91
+ endDate = endDate.add(count, 'month');
92
+ break;
93
+ default:
94
+ return null; // Invalid duration type
95
+ }
96
+ return endDate.format(DATE_TIME_FORMAT);
97
+ };
98
+
99
+ export const convertPrescriptionPadDataUItoAPI = ({
100
+ prescriptionData,
101
+ prescriptionId,
102
+ removedPrescriptionData,
103
+ patientId,
104
+ }) => {
105
+ const medicationDetails = [];
106
+ const symptomDetails = [];
107
+ const diagnosisDetails = [];
108
+ const labTestDetails = [];
109
+ const vaccineDetails = [];
110
+ const procedureDetails = [];
111
+
112
+ prescriptionData.medicationsArr?.forEach((medicine) => {
113
+ if (!medicine.medicationId || medicine.status === INACTIVE_STATE) {
114
+ return;
115
+ }
116
+ const prescriptionDetail = {
117
+ id: medicine.id || getUUID(),
118
+ medicationId: medicine.medicationId,
119
+ medicationResponse: medicine.medicationResponse,
120
+ duration: medicine.duration,
121
+ purpose: null,
122
+ frequency: medicine?.frequency?.trim() || '',
123
+ doseTiming: medicine?.doseTiming,
124
+ prescribingDoctor: null,
125
+ instructions: medicine.instructions,
126
+ patientId: patientId,
127
+ status: medicine.status || ACTIVE_STATE,
128
+ startDate: dayjs().format(DATE_TIME_FORMAT),
129
+ endDate: getEndDateForPrescriptionMedication(medicine.duration),
130
+ prescriptionId: prescriptionId,
131
+ };
132
+ medicationDetails.push(prescriptionDetail);
133
+ });
134
+
135
+ prescriptionData.symptomsArr?.forEach((symptom) => {
136
+ if (!symptom.symptomResponse?.id || symptom.status === INACTIVE_STATE) {
137
+ return;
138
+ }
139
+ const detail = {
140
+ id: symptom.id || getUUID(),
141
+ symptomResponse: symptom.symptomResponse,
142
+ severity: symptom.severity,
143
+ since: symptom.since,
144
+ complaints: 'complaints',
145
+ status: symptom.status || ACTIVE_STATE,
146
+ prescriptionId: prescriptionId,
147
+ };
148
+ symptomDetails.push(detail);
149
+ });
150
+
151
+ prescriptionData.diagnosisArr?.forEach((diagnosis) => {
152
+ if (!diagnosis.diagnosisResponse?.id || diagnosis.status === INACTIVE_STATE) {
153
+ return;
154
+ }
155
+ const detail = {
156
+ id: diagnosis.id || getUUID(),
157
+ diagnosisResponse: diagnosis.diagnosisResponse,
158
+ since: '2 days',
159
+ severity: 'MODERATE',
160
+ conclusions: diagnosis.conclusions,
161
+ status: diagnosis.status || ACTIVE_STATE,
162
+ prescriptionId: prescriptionId,
163
+ };
164
+ diagnosisDetails.push(detail);
165
+ });
166
+
167
+ prescriptionData.labInvestigationsArr?.forEach((labTest) => {
168
+ if (!labTest.labTestId || labTest.status === INACTIVE_STATE) {
169
+ return;
170
+ }
171
+ const detail = {
172
+ id: labTest.id || getUUID(),
173
+ patientId: patientId,
174
+ labTestId: labTest.labTestId,
175
+ labTestResponse: labTest.labTestResponse,
176
+ reportDate: dayjs().format(DATE_FORMAT),
177
+ performedBy: null,
178
+ orderedBy: null,
179
+ instructions: labTest.instructions,
180
+ status: labTest.status || ACTIVE_STATE,
181
+ prescriptionId: prescriptionId,
182
+ };
183
+ labTestDetails.push(detail);
184
+ });
185
+
186
+ prescriptionData.vaccineArr?.forEach((vaccine) => {
187
+ if (!vaccine.vaccineId || vaccine.status === INACTIVE_STATE) {
188
+ return;
189
+ }
190
+ const detail = {
191
+ id: vaccine.id || getUUID(),
192
+ patientId: patientId,
193
+ vaccineId: vaccine.vaccineId,
194
+ vaccineResponse: vaccine.vaccineResponse,
195
+ vaccineName: vaccine.displayName,
196
+ dose: vaccine.dose || '',
197
+ status: vaccine.status || ACTIVE_STATE,
198
+ prescriptionId: prescriptionId,
199
+ };
200
+ vaccineDetails.push(detail);
201
+ });
202
+
203
+ prescriptionData.procedureArr?.forEach((procedure) => {
204
+ if (!procedure.procedureId || procedure.status === INACTIVE_STATE) {
205
+ return;
206
+ }
207
+ const detail = {
208
+ id: procedure.id || getUUID(),
209
+ patientId: patientId,
210
+ procedureId: procedure.procedureId,
211
+ procedureResponse: procedure.procedureResponse,
212
+ procedureName: procedure.displayName,
213
+ instructions: procedure.instructions,
214
+ status: procedure.status || ACTIVE_STATE,
215
+ prescriptionId: prescriptionId,
216
+ };
217
+ procedureDetails.push(detail);
218
+ });
219
+ medicationDetails.push(...removedPrescriptionData.medicationsArr.filter((medicine) => medicine.medicationId));
220
+ symptomDetails.push(...removedPrescriptionData.symptomsArr.filter((symptom) => symptom.symptomId));
221
+ diagnosisDetails.push(...removedPrescriptionData.diagnosisArr.filter((diagnosis) => diagnosis.diagnosisId));
222
+ labTestDetails.push(...removedPrescriptionData.labInvestigationsArr.filter((labTest) => labTest.labTestId));
223
+ vaccineDetails.push(...removedPrescriptionData.vaccineArr.filter((vaccine) => vaccine.vaccineId));
224
+ procedureDetails.push(...removedPrescriptionData.procedureArr.filter((procedure) => procedure.procedureId));
225
+
226
+ return {
227
+ medicationDetails,
228
+ symptomDetails,
229
+ diagnosisDetails,
230
+ labTestDetails,
231
+ vaccineDetails,
232
+ procedureDetails,
233
+ };
234
+ };
235
+
236
+ export const convertPrescriptionPadDataAPItoUI = async ({ prescriptionDataResponse }) => {
237
+ let advice = prescriptionDataResponse.additionalRecommendations;
238
+ let advicesArr = [];
239
+
240
+ const diagnosisArr = prescriptionDataResponse.prescriptionDiagnosisResponses
241
+ ? [
242
+ ...prescriptionDataResponse.prescriptionDiagnosisResponses.map((diagnosis) => {
243
+ return {
244
+ ...diagnosis,
245
+ displayName: diagnosis.diagnosisResponse.name,
246
+ category: 'DX',
247
+ diagnosisId: diagnosis.diagnosisResponse.id,
248
+ };
249
+ }),
250
+ ]
251
+ : [];
252
+ const symptomsArr = prescriptionDataResponse.prescriptionSymptomResponses
253
+ ? [
254
+ ...prescriptionDataResponse.prescriptionSymptomResponses.map((symptom) => {
255
+ return {
256
+ ...symptom,
257
+ displayName: symptom.symptomResponse.name,
258
+ category: 'CC',
259
+ symptomId: symptom.symptomResponse.id,
260
+ };
261
+ }),
262
+ ]
263
+ : [];
264
+ const medicationsArr = prescriptionDataResponse.prescriptionMedicationResponses
265
+ ? [
266
+ ...prescriptionDataResponse.prescriptionMedicationResponses.map((medication) => {
267
+ return {
268
+ ...medication,
269
+ displayName: medication.medicationResponse.name,
270
+ category: 'RX',
271
+ };
272
+ }),
273
+ ]
274
+ : [];
275
+ const labInvestigationsArr = prescriptionDataResponse.prescriptionLabReportResponses
276
+ ? [
277
+ ...prescriptionDataResponse.prescriptionLabReportResponses.map((labTest) => {
278
+ return {
279
+ ...labTest,
280
+ displayName: labTest.labTestResponse.name,
281
+ category: 'LAB',
282
+ };
283
+ }),
284
+ ]
285
+ : [];
286
+ const vaccineArr = prescriptionDataResponse.prescriptionVaccineResponses
287
+ ? [
288
+ ...prescriptionDataResponse.prescriptionVaccineResponses.map((vaccine) => {
289
+ return {
290
+ ...vaccine,
291
+ displayName: vaccine.vaccineResponse.name,
292
+ category: 'VX',
293
+ };
294
+ }),
295
+ ]
296
+ : [];
297
+ const procedureArr = prescriptionDataResponse.prescriptionProcedureResponses
298
+ ? [
299
+ ...prescriptionDataResponse.prescriptionProcedureResponses.map((procedure) => {
300
+ return {
301
+ ...procedure,
302
+ displayName: procedure.procedureResponse.name,
303
+ category: 'SX',
304
+ };
305
+ }),
306
+ ]
307
+ : [];
308
+
309
+ if (advice && advice !== '') {
310
+ advicesArr = advice.split(',').map((adv) => {
311
+ return {
312
+ category: 'ADV',
313
+ displayName: adv.trim(),
314
+ };
315
+ });
316
+ }
317
+
318
+ return {
319
+ diagnosisArr,
320
+ symptomsArr,
321
+ medicationsArr,
322
+ labInvestigationsArr,
323
+ vaccineArr,
324
+ procedureArr,
325
+ advicesArr,
326
+ };
327
+ };
328
+
329
+ export const isPrescriptionPadEmpty = (prescriptionData) => {
330
+ return !(
331
+ prescriptionData?.advicesArr?.length > 0 ||
332
+ prescriptionData?.diagnosisArr?.length > 0 ||
333
+ prescriptionData?.labInvestigationsArr?.length > 0 ||
334
+ prescriptionData?.medicationsArr?.length > 0 ||
335
+ prescriptionData?.procedureArr?.length > 0 ||
336
+ prescriptionData?.symptomsArr?.length > 0 ||
337
+ prescriptionData?.vaccineArr?.length > 0
338
+ );
339
+ };
@@ -0,0 +1,67 @@
1
+ export const medicalAbbreviationsList = [
2
+ { abbr: "ac", fullName: "before meals" },
3
+ { abbr: "ad", fullName: "right ear" },
4
+ { abbr: "ad lib", fullName: "use as much as desired" },
5
+ { abbr: "ai", fullName: "left ear" },
6
+ { abbr: "as", fullName: "left ear" },
7
+ { abbr: "au", fullName: "both ears" },
8
+ { abbr: "bid", fullName: "twice a day" },
9
+ { abbr: "cap", fullName: "capsule" },
10
+ { abbr: "cf", fullName: "with food" },
11
+ { abbr: "daw", fullName: "dispense as written" },
12
+ { abbr: "dieb alt", fullName: "every other day" },
13
+ { abbr: "emp", fullName: "as directed" },
14
+ { abbr: "g", fullName: "gram" },
15
+ { abbr: "gr", fullName: "grain" },
16
+ { abbr: "gtt(s)", fullName: "drop(s)" },
17
+ { abbr: "IM", fullName: "intramuscular" },
18
+ { abbr: "IV", fullName: "intravenous" },
19
+ { abbr: "mdu", fullName: "to be used as directed" },
20
+ { abbr: "od", fullName: "right eye" },
21
+ { abbr: "os", fullName: "left eye" },
22
+ { abbr: "ou", fullName: "both eyes" },
23
+ { abbr: "pc", fullName: "after meals" },
24
+ { abbr: "po", fullName: "by mouth" },
25
+ { abbr: "pr", fullName: "by rectum" },
26
+ { abbr: "prn", fullName: "as needed" },
27
+ { abbr: "qad", fullName: "every other day" },
28
+ { abbr: "qd", fullName: "every day" },
29
+ { abbr: "qh", fullName: "every hour" },
30
+ { abbr: "qhs", fullName: "every night at bedtime" },
31
+ { abbr: "q3h", fullName: "every three hours" },
32
+ { abbr: "qid", fullName: "four times a day" },
33
+ { abbr: "qwk", fullName: "every week" },
34
+ { abbr: "sc", fullName: "subcutaneous" },
35
+ { abbr: "subc", fullName: "subcutaneous" },
36
+ { abbr: "subcut", fullName: "subcutaneous" },
37
+ { abbr: "subq", fullName: "subcutaneous" },
38
+ { abbr: "sq", fullName: "subcutaneous" },
39
+ { abbr: "sig", fullName: "write" },
40
+ { abbr: "tab", fullName: "tablet" },
41
+ { abbr: "tbsp", fullName: "tablespoon" },
42
+ { abbr: "tsp", fullName: "teaspoon" },
43
+ { abbr: "tid", fullName: "three times a day" },
44
+ { abbr: "top", fullName: "topical" },
45
+ { abbr: "ud", fullName: "as directed" },
46
+ { abbr: "ut dict", fullName: "as directed" },
47
+ { abbr: "w", fullName: "with" },
48
+ { abbr: "w/o", fullName: "without" },
49
+ { abbr: "x", fullName: "times" },
50
+ ];
51
+
52
+ export const symbols = [
53
+ { displayName: "!", category: "DX", readOnly: true },
54
+ { displayName: "@", category: "CC", readOnly: true },
55
+ { displayName: "#", category: "RX", readOnly: true },
56
+ { displayName: "$", category: "LAB", readOnly: true },
57
+ ];
58
+
59
+ export const categoryAbbr = [
60
+ { displayName: "DX", category: "CAT" },
61
+ { displayName: "CC", category: "CAT" },
62
+ { displayName: "RX", category: "CAT" },
63
+ { displayName: "LAB", category: "CAT" },
64
+ // { displayName: "VX", category: "CAT" },
65
+ // { displayName: "SX", category: "CAT" },
66
+ { displayName: "ADV", category: "CAT" },
67
+ ];
@@ -0,0 +1,96 @@
1
+ // Medicine pad duration auto-complete constants
2
+ export const defaultDurationMenuItems = [
3
+ { value: "1 Day", menuLabel: "1 Day" },
4
+ { value: "2 Days", menuLabel: "2 Days" },
5
+ { value: "5 Days", menuLabel: "5 Days" },
6
+ { value: "1 Week", menuLabel: "1 Week" },
7
+ { value: "2 Weeks", menuLabel: "2 Weeks" },
8
+ { value: "1 Month", menuLabel: "1 Month" },
9
+ { value: "2 Months", menuLabel: "2 Months" },
10
+ { value: "6 Months", menuLabel: "6 Months" },
11
+ { value: "1 Year", menuLabel: "1 Year" },
12
+ ];
13
+
14
+ export const defaultDurationMenuItemsForSymptom = [
15
+ { value: "1 Day", menuLabel: "1 Day" },
16
+ { value: "2 Days", menuLabel: "2 Days" },
17
+ { value: "3 Days", menuLabel: "3 Days" },
18
+ { value: "4 Days", menuLabel: "4 Days" },
19
+ { value: "5 Days", menuLabel: "5 Days" },
20
+ { value: "6 Days", menuLabel: "6 Days" },
21
+
22
+ { value: "1 Week", menuLabel: "1 Week" },
23
+ { value: "2 Weeks", menuLabel: "2 Weeks" },
24
+ { value: "3 Weeks", menuLabel: "3 Weeks" },
25
+
26
+ { value: "1 Month", menuLabel: "1 Month" },
27
+ { value: "2 Months", menuLabel: "2 Months" },
28
+ { value: "3 Months", menuLabel: "3 Months" },
29
+ { value: "4 Months", menuLabel: "4 Months" },
30
+ { value: "5 Months", menuLabel: "5 Months" },
31
+ { value: "6 Months", menuLabel: "6 Months" },
32
+
33
+ { value: "1 Year", menuLabel: "1 Year" },
34
+ ];
35
+
36
+ export const getDynamicDurationOptions = (inputText) => {
37
+ if (!inputText) return defaultDurationMenuItems;
38
+ const numericValue = inputText.trim();
39
+ const isNumeric = /^[0-9]+$/.test(numericValue);
40
+
41
+ if (isNumeric) {
42
+ const num = parseInt(numericValue, 10);
43
+ const isSingular = num === 1;
44
+
45
+ const units = ["day", "week", "month", "year"];
46
+
47
+ return units.map((unit) => {
48
+ const label = `${numericValue} ${isSingular ? unit : unit + "s"}`;
49
+ return { value: label, menuLabel: label };
50
+ });
51
+ }
52
+
53
+ return defaultDurationMenuItems;
54
+ };
55
+
56
+ // Medicine frequency auto-complete constants
57
+ export const defaultFrequencyMenuItems = () => {
58
+ const doses = ["0", "1/2", "1", "2"];
59
+ // const items = [];
60
+
61
+ // Generate all permutations (excluding "0-0-0")
62
+ const allPermutations = [];
63
+ for (let m of doses) {
64
+ for (let a of doses) {
65
+ for (let n of doses) {
66
+ if (m === "0" && a === "0" && n === "0") continue;
67
+ const label = `${m}-${a}-${n}`;
68
+ allPermutations.push(label);
69
+ }
70
+ }
71
+ }
72
+
73
+ // Your frequently used ones
74
+ const commonlyUsedFrequency = ["1-0-0", "1-0-1", "1-1-1", "0-1-0", "0-0-1", "1-1-0", "0-1-1"];
75
+
76
+ // Add frequently used first
77
+ const resultSet = new Set();
78
+ const finalItems = [];
79
+
80
+ for (const freq of commonlyUsedFrequency) {
81
+ if (!resultSet.has(freq)) {
82
+ finalItems.push({ value: freq, menuLabel: freq });
83
+ resultSet.add(freq);
84
+ }
85
+ }
86
+
87
+ // Add remaining permutations
88
+ for (const freq of allPermutations) {
89
+ if (!resultSet.has(freq)) {
90
+ finalItems.push({ value: freq, menuLabel: freq });
91
+ resultSet.add(freq);
92
+ }
93
+ }
94
+
95
+ return finalItems;
96
+ };