vintasend 0.4.0 → 0.4.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.
- package/README.md +5 -0
- package/dist/examples/vintasend-medplum-example/.env.example +11 -0
- package/dist/examples/vintasend-medplum-example/IMPLEMENTATION_PLAN_FILE_ATTACHMENTS.md +597 -0
- package/dist/examples/vintasend-medplum-example/README.md +190 -0
- package/dist/examples/vintasend-medplum-example/TUTORIAL_EMAIL_NOTIFICATIONS.md +2596 -0
- package/dist/examples/vintasend-medplum-example/bots/handlers/send-pending-notifications-bot.ts +39 -0
- package/dist/examples/vintasend-medplum-example/bots/handlers/send-task-assignment-email.ts +41 -0
- package/dist/examples/vintasend-medplum-example/bots/handlers/task-due-soon-notification-bot.ts +86 -0
- package/dist/examples/vintasend-medplum-example/bots/index.ts +53 -0
- package/dist/examples/vintasend-medplum-example/bots/services/emails/schedule-task-due-soon-email.ts +84 -0
- package/dist/examples/vintasend-medplum-example/bots/services/emails/send-task-assignment-email.test.ts +388 -0
- package/dist/examples/vintasend-medplum-example/bots/services/emails/send-task-assignment-email.ts +113 -0
- package/dist/examples/vintasend-medplum-example/bots/shared/task-due-soon-helpers.ts +115 -0
- package/dist/examples/vintasend-medplum-example/bots/task-assignment-bot.ts +41 -0
- package/dist/examples/vintasend-medplum-example/compiled-notification-templates.json +6 -0
- package/dist/examples/vintasend-medplum-example/esbuild-script.mjs +71 -0
- package/dist/examples/vintasend-medplum-example/index.html +14 -0
- package/dist/examples/vintasend-medplum-example/lib/constants.ts +32 -0
- package/dist/examples/vintasend-medplum-example/lib/extensions.ts +1 -0
- package/dist/examples/vintasend-medplum-example/lib/file-upload.test.ts +389 -0
- package/dist/examples/vintasend-medplum-example/lib/file-upload.ts +222 -0
- package/dist/examples/vintasend-medplum-example/lib/medplum-singleton.ts +18 -0
- package/dist/examples/vintasend-medplum-example/lib/notification-service.test.ts +293 -0
- package/dist/examples/vintasend-medplum-example/lib/notification-service.ts +284 -0
- package/dist/examples/vintasend-medplum-example/lib/patients.ts +20 -0
- package/dist/examples/vintasend-medplum-example/notification-templates/emails/task-assignment/body.html.pug +37 -0
- package/dist/examples/vintasend-medplum-example/notification-templates/emails/task-assignment/subject.txt.pug +4 -0
- package/dist/examples/vintasend-medplum-example/notification-templates/emails/task-due-soon/body.html.pug +34 -0
- package/dist/examples/vintasend-medplum-example/notification-templates/emails/task-due-soon/subject.txt.pug +4 -0
- package/dist/examples/vintasend-medplum-example/package.json +75 -0
- package/dist/examples/vintasend-medplum-example/plugins/gql-plugin.mjs +31 -0
- package/dist/examples/vintasend-medplum-example/postcss.config.mjs +21 -0
- package/dist/examples/vintasend-medplum-example/public/favicon.ico +0 -0
- package/dist/examples/vintasend-medplum-example/public/img/integrations/acuity.png +0 -0
- package/dist/examples/vintasend-medplum-example/public/img/integrations/auth0.png +0 -0
- package/dist/examples/vintasend-medplum-example/public/img/integrations/azure.png +0 -0
- package/dist/examples/vintasend-medplum-example/public/img/integrations/calcom.png +0 -0
- package/dist/examples/vintasend-medplum-example/public/img/integrations/candid.png +0 -0
- package/dist/examples/vintasend-medplum-example/public/img/integrations/claude.png +0 -0
- package/dist/examples/vintasend-medplum-example/public/img/integrations/datadog.png +0 -0
- package/dist/examples/vintasend-medplum-example/public/img/integrations/deepseek.png +0 -0
- package/dist/examples/vintasend-medplum-example/public/img/integrations/entra.png +0 -0
- package/dist/examples/vintasend-medplum-example/public/img/integrations/epic.png +0 -0
- package/dist/examples/vintasend-medplum-example/public/img/integrations/google.png +0 -0
- package/dist/examples/vintasend-medplum-example/public/img/integrations/healthgorilla.png +0 -0
- package/dist/examples/vintasend-medplum-example/public/img/integrations/healthie.png +0 -0
- package/dist/examples/vintasend-medplum-example/public/img/integrations/labcorp.png +0 -0
- package/dist/examples/vintasend-medplum-example/public/img/integrations/okta.png +0 -0
- package/dist/examples/vintasend-medplum-example/public/img/integrations/openai.png +0 -0
- package/dist/examples/vintasend-medplum-example/public/img/integrations/particle.png +0 -0
- package/dist/examples/vintasend-medplum-example/public/img/integrations/quest.png +0 -0
- package/dist/examples/vintasend-medplum-example/public/img/integrations/recaptcha.png +0 -0
- package/dist/examples/vintasend-medplum-example/public/img/integrations/snowflake.png +0 -0
- package/dist/examples/vintasend-medplum-example/public/img/integrations/stedi.png +0 -0
- package/dist/examples/vintasend-medplum-example/public/img/integrations/stripe.png +0 -0
- package/dist/examples/vintasend-medplum-example/public/img/integrations/sumo.png +0 -0
- package/dist/examples/vintasend-medplum-example/scripts/README.md +162 -0
- package/dist/examples/vintasend-medplum-example/scripts/client.ts +18 -0
- package/dist/examples/vintasend-medplum-example/scripts/deploy-bots.ts +171 -0
- package/dist/examples/vintasend-medplum-example/src/App.tsx +185 -0
- package/dist/examples/vintasend-medplum-example/src/components/ChargeItem/ChargeItemList.test.tsx +350 -0
- package/dist/examples/vintasend-medplum-example/src/components/ChargeItem/ChargeItemList.tsx +241 -0
- package/dist/examples/vintasend-medplum-example/src/components/ChargeItem/ChargeItemPanel.test.tsx +616 -0
- package/dist/examples/vintasend-medplum-example/src/components/ChargeItem/ChargeItemPanel.tsx +138 -0
- package/dist/examples/vintasend-medplum-example/src/components/Conditions/ConditionItem.test.tsx +92 -0
- package/dist/examples/vintasend-medplum-example/src/components/Conditions/ConditionItem.tsx +47 -0
- package/dist/examples/vintasend-medplum-example/src/components/Conditions/ConditionList.test.tsx +464 -0
- package/dist/examples/vintasend-medplum-example/src/components/Conditions/ConditionList.tsx +186 -0
- package/dist/examples/vintasend-medplum-example/src/components/Conditions/ConditionModal.test.tsx +80 -0
- package/dist/examples/vintasend-medplum-example/src/components/Conditions/ConditionModal.tsx +82 -0
- package/dist/examples/vintasend-medplum-example/src/components/DoseSpotIcon.test.tsx +100 -0
- package/dist/examples/vintasend-medplum-example/src/components/DoseSpotIcon.tsx +20 -0
- package/dist/examples/vintasend-medplum-example/src/components/IntegrationCard.module.css +3 -0
- package/dist/examples/vintasend-medplum-example/src/components/IntegrationCard.tsx +62 -0
- package/dist/examples/vintasend-medplum-example/src/components/MessageWithLinks.tsx +47 -0
- package/dist/examples/vintasend-medplum-example/src/components/PerformingLabInput.test.tsx +299 -0
- package/dist/examples/vintasend-medplum-example/src/components/PerformingLabInput.tsx +52 -0
- package/dist/examples/vintasend-medplum-example/src/components/ResourceFormWithRequiredProfile.tsx +82 -0
- package/dist/examples/vintasend-medplum-example/src/components/encounter/BillingTab.test.tsx +1016 -0
- package/dist/examples/vintasend-medplum-example/src/components/encounter/BillingTab.tsx +298 -0
- package/dist/examples/vintasend-medplum-example/src/components/encounter/EncounterChart.test.tsx +732 -0
- package/dist/examples/vintasend-medplum-example/src/components/encounter/EncounterChart.tsx +282 -0
- package/dist/examples/vintasend-medplum-example/src/components/encounter/EncounterHeader.test.tsx +268 -0
- package/dist/examples/vintasend-medplum-example/src/components/encounter/EncounterHeader.tsx +224 -0
- package/dist/examples/vintasend-medplum-example/src/components/encounter/SignAddendum.test.tsx +255 -0
- package/dist/examples/vintasend-medplum-example/src/components/encounter/SignAddendum.tsx +212 -0
- package/dist/examples/vintasend-medplum-example/src/components/encounter/SignLockDialog.test.tsx +120 -0
- package/dist/examples/vintasend-medplum-example/src/components/encounter/SignLockDialog.tsx +57 -0
- package/dist/examples/vintasend-medplum-example/src/components/encounter/VisitDetailsPanel.test.tsx +224 -0
- package/dist/examples/vintasend-medplum-example/src/components/encounter/VisitDetailsPanel.tsx +100 -0
- package/dist/examples/vintasend-medplum-example/src/components/labs/CoverageInput.test.tsx +431 -0
- package/dist/examples/vintasend-medplum-example/src/components/labs/CoverageInput.tsx +130 -0
- package/dist/examples/vintasend-medplum-example/src/components/labs/LabListItem.module.css +31 -0
- package/dist/examples/vintasend-medplum-example/src/components/labs/LabListItem.test.tsx +234 -0
- package/dist/examples/vintasend-medplum-example/src/components/labs/LabListItem.tsx +143 -0
- package/dist/examples/vintasend-medplum-example/src/components/labs/LabOrderDetails.module.css +11 -0
- package/dist/examples/vintasend-medplum-example/src/components/labs/LabOrderDetails.test.tsx +875 -0
- package/dist/examples/vintasend-medplum-example/src/components/labs/LabOrderDetails.tsx +943 -0
- package/dist/examples/vintasend-medplum-example/src/components/labs/LabResultDetails.test.tsx +413 -0
- package/dist/examples/vintasend-medplum-example/src/components/labs/LabResultDetails.tsx +203 -0
- package/dist/examples/vintasend-medplum-example/src/components/labs/LabSelectEmpty.tsx +22 -0
- package/dist/examples/vintasend-medplum-example/src/components/labs/README.md +104 -0
- package/dist/examples/vintasend-medplum-example/src/components/labs/TestMetadataCardInput.test.tsx +318 -0
- package/dist/examples/vintasend-medplum-example/src/components/labs/TestMetadataCardInput.tsx +87 -0
- package/dist/examples/vintasend-medplum-example/src/components/messages/ChatList.test.tsx +126 -0
- package/dist/examples/vintasend-medplum-example/src/components/messages/ChatList.tsx +38 -0
- package/dist/examples/vintasend-medplum-example/src/components/messages/ChatListItem.module.css +23 -0
- package/dist/examples/vintasend-medplum-example/src/components/messages/ChatListItem.test.tsx +167 -0
- package/dist/examples/vintasend-medplum-example/src/components/messages/ChatListItem.tsx +53 -0
- package/dist/examples/vintasend-medplum-example/src/components/messages/NewTopicDialog.test.tsx +94 -0
- package/dist/examples/vintasend-medplum-example/src/components/messages/NewTopicDialog.tsx +165 -0
- package/dist/examples/vintasend-medplum-example/src/components/messages/ParticipantFilter.module.css +8 -0
- package/dist/examples/vintasend-medplum-example/src/components/messages/ParticipantFilter.test.tsx +523 -0
- package/dist/examples/vintasend-medplum-example/src/components/messages/ParticipantFilter.tsx +230 -0
- package/dist/examples/vintasend-medplum-example/src/components/messages/ThreadInbox.module.css +23 -0
- package/dist/examples/vintasend-medplum-example/src/components/messages/ThreadInbox.test.tsx +567 -0
- package/dist/examples/vintasend-medplum-example/src/components/messages/ThreadInbox.tsx +358 -0
- package/dist/examples/vintasend-medplum-example/src/components/plandefinition/AddPlanDefinition.module.css +40 -0
- package/dist/examples/vintasend-medplum-example/src/components/plandefinition/AddPlanDefinition.tsx +257 -0
- package/dist/examples/vintasend-medplum-example/src/components/schedule/CreateVisit.module.css +7 -0
- package/dist/examples/vintasend-medplum-example/src/components/schedule/CreateVisit.test.tsx +279 -0
- package/dist/examples/vintasend-medplum-example/src/components/schedule/CreateVisit.tsx +156 -0
- package/dist/examples/vintasend-medplum-example/src/components/spaces/HistoryList.module.css +45 -0
- package/dist/examples/vintasend-medplum-example/src/components/spaces/HistoryList.test.tsx +90 -0
- package/dist/examples/vintasend-medplum-example/src/components/spaces/HistoryList.tsx +84 -0
- package/dist/examples/vintasend-medplum-example/src/components/spaces/ResourceBox.module.css +26 -0
- package/dist/examples/vintasend-medplum-example/src/components/spaces/ResourceBox.tsx +90 -0
- package/dist/examples/vintasend-medplum-example/src/components/spaces/ResourcePanel.test.tsx +305 -0
- package/dist/examples/vintasend-medplum-example/src/components/spaces/ResourcePanel.tsx +46 -0
- package/dist/examples/vintasend-medplum-example/src/components/spaces/SpacesInbox.module.css +262 -0
- package/dist/examples/vintasend-medplum-example/src/components/spaces/SpacesInbox.test.tsx +622 -0
- package/dist/examples/vintasend-medplum-example/src/components/spaces/SpacesInbox.tsx +286 -0
- package/dist/examples/vintasend-medplum-example/src/components/tasks/NewTaskModal.tsx +275 -0
- package/dist/examples/vintasend-medplum-example/src/components/tasks/TaskAttachmentList.tsx +132 -0
- package/dist/examples/vintasend-medplum-example/src/components/tasks/TaskBoard.module.css +45 -0
- package/dist/examples/vintasend-medplum-example/src/components/tasks/TaskBoard.test.tsx +749 -0
- package/dist/examples/vintasend-medplum-example/src/components/tasks/TaskBoard.tsx +416 -0
- package/dist/examples/vintasend-medplum-example/src/components/tasks/TaskDetailPanel.test.tsx +278 -0
- package/dist/examples/vintasend-medplum-example/src/components/tasks/TaskDetailPanel.tsx +133 -0
- package/dist/examples/vintasend-medplum-example/src/components/tasks/TaskDetailsModal.module.css +16 -0
- package/dist/examples/vintasend-medplum-example/src/components/tasks/TaskDetailsModal.test.tsx +255 -0
- package/dist/examples/vintasend-medplum-example/src/components/tasks/TaskDetailsModal.tsx +203 -0
- package/dist/examples/vintasend-medplum-example/src/components/tasks/TaskFileUpload.tsx +129 -0
- package/dist/examples/vintasend-medplum-example/src/components/tasks/TaskFilterMenu.test.tsx +156 -0
- package/dist/examples/vintasend-medplum-example/src/components/tasks/TaskFilterMenu.tsx +142 -0
- package/dist/examples/vintasend-medplum-example/src/components/tasks/TaskFilterMenu.utils.ts +28 -0
- package/dist/examples/vintasend-medplum-example/src/components/tasks/TaskInputNote.test.tsx +134 -0
- package/dist/examples/vintasend-medplum-example/src/components/tasks/TaskInputNote.tsx +250 -0
- package/dist/examples/vintasend-medplum-example/src/components/tasks/TaskListItem.module.css +23 -0
- package/dist/examples/vintasend-medplum-example/src/components/tasks/TaskListItem.test.tsx +149 -0
- package/dist/examples/vintasend-medplum-example/src/components/tasks/TaskListItem.tsx +53 -0
- package/dist/examples/vintasend-medplum-example/src/components/tasks/TaskNoteItem.test.tsx +68 -0
- package/dist/examples/vintasend-medplum-example/src/components/tasks/TaskNoteItem.tsx +46 -0
- package/dist/examples/vintasend-medplum-example/src/components/tasks/TaskProperties.test.tsx +555 -0
- package/dist/examples/vintasend-medplum-example/src/components/tasks/TaskProperties.tsx +170 -0
- package/dist/examples/vintasend-medplum-example/src/components/tasks/TaskSelectEmpty.test.tsx +32 -0
- package/dist/examples/vintasend-medplum-example/src/components/tasks/TaskSelectEmpty.tsx +34 -0
- package/dist/examples/vintasend-medplum-example/src/components/tasks/encounter/SimpleTask.test.tsx +47 -0
- package/dist/examples/vintasend-medplum-example/src/components/tasks/encounter/SimpleTask.tsx +29 -0
- package/dist/examples/vintasend-medplum-example/src/components/tasks/encounter/TaskPanel.test.tsx +285 -0
- package/dist/examples/vintasend-medplum-example/src/components/tasks/encounter/TaskPanel.tsx +129 -0
- package/dist/examples/vintasend-medplum-example/src/components/tasks/encounter/TaskQuestionnaireForm.test.tsx +455 -0
- package/dist/examples/vintasend-medplum-example/src/components/tasks/encounter/TaskQuestionnaireForm.tsx +167 -0
- package/dist/examples/vintasend-medplum-example/src/components/tasks/encounter/TaskServiceRequest.test.tsx +435 -0
- package/dist/examples/vintasend-medplum-example/src/components/tasks/encounter/TaskServiceRequest.tsx +116 -0
- package/dist/examples/vintasend-medplum-example/src/components/tasks/encounter/TaskStatusPanel.module.css +38 -0
- package/dist/examples/vintasend-medplum-example/src/components/tasks/encounter/TaskStatusPanel.test.tsx +200 -0
- package/dist/examples/vintasend-medplum-example/src/components/tasks/encounter/TaskStatusPanel.tsx +84 -0
- package/dist/examples/vintasend-medplum-example/src/components/utils.test.ts +176 -0
- package/dist/examples/vintasend-medplum-example/src/components/utils.ts +17 -0
- package/dist/examples/vintasend-medplum-example/src/config/constants.ts +3 -0
- package/dist/examples/vintasend-medplum-example/src/hooks/useDebouncedUpdateResource.test.tsx +166 -0
- package/dist/examples/vintasend-medplum-example/src/hooks/useDebouncedUpdateResource.ts +28 -0
- package/dist/examples/vintasend-medplum-example/src/hooks/useEncounter.test.tsx +94 -0
- package/dist/examples/vintasend-medplum-example/src/hooks/useEncounter.ts +11 -0
- package/dist/examples/vintasend-medplum-example/src/hooks/useEncounterChart.test.tsx +477 -0
- package/dist/examples/vintasend-medplum-example/src/hooks/useEncounterChart.ts +191 -0
- package/dist/examples/vintasend-medplum-example/src/hooks/usePatient.test.tsx +100 -0
- package/dist/examples/vintasend-medplum-example/src/hooks/usePatient.ts +18 -0
- package/dist/examples/vintasend-medplum-example/src/hooks/useThreadInbox.test.tsx +379 -0
- package/dist/examples/vintasend-medplum-example/src/hooks/useThreadInbox.ts +194 -0
- package/dist/examples/vintasend-medplum-example/src/index.css +8 -0
- package/dist/examples/vintasend-medplum-example/src/main.tsx +57 -0
- package/dist/examples/vintasend-medplum-example/src/pages/SearchPage.module.css +6 -0
- package/dist/examples/vintasend-medplum-example/src/pages/SearchPage.test.tsx +295 -0
- package/dist/examples/vintasend-medplum-example/src/pages/SearchPage.tsx +124 -0
- package/dist/examples/vintasend-medplum-example/src/pages/SignInPage.test.tsx +77 -0
- package/dist/examples/vintasend-medplum-example/src/pages/SignInPage.tsx +22 -0
- package/dist/examples/vintasend-medplum-example/src/pages/encounter/EncounterChartPage.test.tsx +87 -0
- package/dist/examples/vintasend-medplum-example/src/pages/encounter/EncounterChartPage.tsx +27 -0
- package/dist/examples/vintasend-medplum-example/src/pages/encounter/EncounterModal.module.css +16 -0
- package/dist/examples/vintasend-medplum-example/src/pages/encounter/EncounterModal.test.tsx +287 -0
- package/dist/examples/vintasend-medplum-example/src/pages/encounter/EncounterModal.tsx +151 -0
- package/dist/examples/vintasend-medplum-example/src/pages/integrations/DoseSpotFavoritesPage.test.tsx +519 -0
- package/dist/examples/vintasend-medplum-example/src/pages/integrations/DoseSpotFavoritesPage.tsx +179 -0
- package/dist/examples/vintasend-medplum-example/src/pages/integrations/FavoriteMedicationsTable.tsx +76 -0
- package/dist/examples/vintasend-medplum-example/src/pages/integrations/IntegrationsPage.test.tsx +234 -0
- package/dist/examples/vintasend-medplum-example/src/pages/integrations/IntegrationsPage.tsx +222 -0
- package/dist/examples/vintasend-medplum-example/src/pages/labs/OrderLabsPage.test.tsx +356 -0
- package/dist/examples/vintasend-medplum-example/src/pages/labs/OrderLabsPage.tsx +275 -0
- package/dist/examples/vintasend-medplum-example/src/pages/messages/MessagesPage.module.css +8 -0
- package/dist/examples/vintasend-medplum-example/src/pages/messages/MessagesPage.test.tsx +103 -0
- package/dist/examples/vintasend-medplum-example/src/pages/messages/MessagesPage.tsx +78 -0
- package/dist/examples/vintasend-medplum-example/src/pages/patient/CommunicationTab.test.tsx +84 -0
- package/dist/examples/vintasend-medplum-example/src/pages/patient/CommunicationTab.tsx +82 -0
- package/dist/examples/vintasend-medplum-example/src/pages/patient/DoseSpotAdvancedOptions.test.tsx +364 -0
- package/dist/examples/vintasend-medplum-example/src/pages/patient/DoseSpotAdvancedOptions.tsx +149 -0
- package/dist/examples/vintasend-medplum-example/src/pages/patient/DoseSpotTab.test.tsx +159 -0
- package/dist/examples/vintasend-medplum-example/src/pages/patient/DoseSpotTab.tsx +37 -0
- package/dist/examples/vintasend-medplum-example/src/pages/patient/EditTab.test.tsx +140 -0
- package/dist/examples/vintasend-medplum-example/src/pages/patient/EditTab.tsx +72 -0
- package/dist/examples/vintasend-medplum-example/src/pages/patient/ExportTab.test.tsx +57 -0
- package/dist/examples/vintasend-medplum-example/src/pages/patient/ExportTab.tsx +14 -0
- package/dist/examples/vintasend-medplum-example/src/pages/patient/IntakeFormPage.test.tsx +241 -0
- package/dist/examples/vintasend-medplum-example/src/pages/patient/IntakeFormPage.tsx +710 -0
- package/dist/examples/vintasend-medplum-example/src/pages/patient/LabsPage.module.css +37 -0
- package/dist/examples/vintasend-medplum-example/src/pages/patient/LabsPage.test.tsx +428 -0
- package/dist/examples/vintasend-medplum-example/src/pages/patient/LabsPage.tsx +334 -0
- package/dist/examples/vintasend-medplum-example/src/pages/patient/PatientPage.module.css +24 -0
- package/dist/examples/vintasend-medplum-example/src/pages/patient/PatientPage.test.tsx +154 -0
- package/dist/examples/vintasend-medplum-example/src/pages/patient/PatientPage.tsx +115 -0
- package/dist/examples/vintasend-medplum-example/src/pages/patient/PatientPage.utils.test.ts +223 -0
- package/dist/examples/vintasend-medplum-example/src/pages/patient/PatientPage.utils.ts +89 -0
- package/dist/examples/vintasend-medplum-example/src/pages/patient/PatientSearchPage.test.tsx +147 -0
- package/dist/examples/vintasend-medplum-example/src/pages/patient/PatientSearchPage.tsx +79 -0
- package/dist/examples/vintasend-medplum-example/src/pages/patient/PatientTabsNavigation.tsx +35 -0
- package/dist/examples/vintasend-medplum-example/src/pages/patient/TasksTab.test.tsx +185 -0
- package/dist/examples/vintasend-medplum-example/src/pages/patient/TasksTab.tsx +115 -0
- package/dist/examples/vintasend-medplum-example/src/pages/patient/TimelineTab.tsx +14 -0
- package/dist/examples/vintasend-medplum-example/src/pages/resource/ResourceCreatePage.test.tsx +170 -0
- package/dist/examples/vintasend-medplum-example/src/pages/resource/ResourceCreatePage.tsx +117 -0
- package/dist/examples/vintasend-medplum-example/src/pages/resource/ResourceDetailPage.tsx +28 -0
- package/dist/examples/vintasend-medplum-example/src/pages/resource/ResourceEditPage.test.tsx +131 -0
- package/dist/examples/vintasend-medplum-example/src/pages/resource/ResourceEditPage.tsx +65 -0
- package/dist/examples/vintasend-medplum-example/src/pages/resource/ResourceHistoryPage.test.tsx +108 -0
- package/dist/examples/vintasend-medplum-example/src/pages/resource/ResourceHistoryPage.tsx +16 -0
- package/dist/examples/vintasend-medplum-example/src/pages/resource/ResourcePage.module.css +7 -0
- package/dist/examples/vintasend-medplum-example/src/pages/resource/ResourcePage.test.tsx +37 -0
- package/dist/examples/vintasend-medplum-example/src/pages/resource/ResourcePage.tsx +44 -0
- package/dist/examples/vintasend-medplum-example/src/pages/resource/useResourceType.ts +44 -0
- package/dist/examples/vintasend-medplum-example/src/pages/resource/utils.ts +9 -0
- package/dist/examples/vintasend-medplum-example/src/pages/schedule/SchedulePage.test.tsx +302 -0
- package/dist/examples/vintasend-medplum-example/src/pages/schedule/SchedulePage.tsx +416 -0
- package/dist/examples/vintasend-medplum-example/src/pages/spaces/ChatInput.tsx +91 -0
- package/dist/examples/vintasend-medplum-example/src/pages/spaces/SpacesPage.module.css +6 -0
- package/dist/examples/vintasend-medplum-example/src/pages/spaces/SpacesPage.test.tsx +102 -0
- package/dist/examples/vintasend-medplum-example/src/pages/spaces/SpacesPage.tsx +44 -0
- package/dist/examples/vintasend-medplum-example/src/pages/tasks/TasksPage.module.css +7 -0
- package/dist/examples/vintasend-medplum-example/src/pages/tasks/TasksPage.test.tsx +133 -0
- package/dist/examples/vintasend-medplum-example/src/pages/tasks/TasksPage.tsx +91 -0
- package/dist/examples/vintasend-medplum-example/src/test-utils/render.tsx +20 -0
- package/dist/examples/vintasend-medplum-example/src/test.setup.ts +49 -0
- package/dist/examples/vintasend-medplum-example/src/types/encounter.ts +8 -0
- package/dist/examples/vintasend-medplum-example/src/types/spaces.ts +10 -0
- package/dist/examples/vintasend-medplum-example/src/utils/chargeitems.test.ts +141 -0
- package/dist/examples/vintasend-medplum-example/src/utils/chargeitems.ts +59 -0
- package/dist/examples/vintasend-medplum-example/src/utils/claims.test.ts +153 -0
- package/dist/examples/vintasend-medplum-example/src/utils/claims.ts +65 -0
- package/dist/examples/vintasend-medplum-example/src/utils/communication-search.ts +47 -0
- package/dist/examples/vintasend-medplum-example/src/utils/coverage.test.ts +48 -0
- package/dist/examples/vintasend-medplum-example/src/utils/coverage.ts +33 -0
- package/dist/examples/vintasend-medplum-example/src/utils/documentReference.test.ts +102 -0
- package/dist/examples/vintasend-medplum-example/src/utils/documentReference.ts +55 -0
- package/dist/examples/vintasend-medplum-example/src/utils/encounter.test.ts +169 -0
- package/dist/examples/vintasend-medplum-example/src/utils/encounter.ts +261 -0
- package/dist/examples/vintasend-medplum-example/src/utils/intake-form.test.ts +154 -0
- package/dist/examples/vintasend-medplum-example/src/utils/intake-form.ts +272 -0
- package/dist/examples/vintasend-medplum-example/src/utils/intake-utils.test.ts +1137 -0
- package/dist/examples/vintasend-medplum-example/src/utils/intake-utils.ts +827 -0
- package/dist/examples/vintasend-medplum-example/src/utils/notifications.test.ts +27 -0
- package/dist/examples/vintasend-medplum-example/src/utils/notifications.ts +15 -0
- package/dist/examples/vintasend-medplum-example/src/utils/spaceMessaging.ts +249 -0
- package/dist/examples/vintasend-medplum-example/src/utils/spacePersistence.test.ts +450 -0
- package/dist/examples/vintasend-medplum-example/src/utils/spacePersistence.ts +147 -0
- package/dist/examples/vintasend-medplum-example/src/utils/task-search.ts +63 -0
- package/dist/examples/vintasend-medplum-example/src/vite-env.d.ts +3 -0
- package/dist/examples/vintasend-medplum-example/tsconfig.bots.json +4 -0
- package/dist/examples/vintasend-medplum-example/tsconfig.json +19 -0
- package/dist/examples/vintasend-medplum-example/vercel.json +3 -0
- package/dist/examples/vintasend-medplum-example/vite.config.ts +44 -0
- package/dist/services/notification-backends/base-notification-backend.d.ts +5 -0
- package/dist/services/notification-service.js +11 -1
- package/dist/services/notification-template-renderers/base-email-template-renderer.d.ts +5 -0
- package/package.json +1 -1
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: Copyright Orangebot, Inc. and Medplum contributors
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
import type { Encounter, Reference } from '@medplum/fhirtypes';
|
|
4
|
+
import type { JSX } from 'react';
|
|
5
|
+
import { Outlet, useParams } from 'react-router';
|
|
6
|
+
import { EncounterChart } from '../../components/encounter/EncounterChart';
|
|
7
|
+
import { showErrorNotification } from '../../utils/notifications';
|
|
8
|
+
|
|
9
|
+
export const EncounterChartPage = (): JSX.Element | null => {
|
|
10
|
+
const { encounterId } = useParams();
|
|
11
|
+
|
|
12
|
+
if (!encounterId) {
|
|
13
|
+
showErrorNotification('Encounter ID not found');
|
|
14
|
+
return null;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const encounterRef: Reference<Encounter> = {
|
|
18
|
+
reference: `Encounter/${encounterId}`,
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
return (
|
|
22
|
+
<>
|
|
23
|
+
<EncounterChart encounter={encounterRef} />
|
|
24
|
+
<Outlet />
|
|
25
|
+
</>
|
|
26
|
+
);
|
|
27
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
.footer {
|
|
2
|
+
display: flex;
|
|
3
|
+
justify-content: flex-end;
|
|
4
|
+
padding: var(--mantine-spacing-md);
|
|
5
|
+
height: 70px;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
[data-mantine-color-scheme='dark'] .planDefinition,
|
|
9
|
+
[data-mantine-color-scheme='dark'] .footer {
|
|
10
|
+
background-color: var(--mantine-color-dark-8);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
[data-mantine-color-scheme='light'] .planDefinition,
|
|
14
|
+
[data-mantine-color-scheme='light'] .footer {
|
|
15
|
+
background-color: var(--mantine-color-gray-1);
|
|
16
|
+
}
|
|
@@ -0,0 +1,287 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: Copyright Orangebot, Inc. and Medplum contributors
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
import { MantineProvider } from '@mantine/core';
|
|
4
|
+
import { Notifications } from '@mantine/notifications';
|
|
5
|
+
import { MockClient } from '@medplum/mock';
|
|
6
|
+
import { MedplumProvider } from '@medplum/react';
|
|
7
|
+
import { act, render, screen, waitFor } from '@testing-library/react';
|
|
8
|
+
import userEvent from '@testing-library/user-event';
|
|
9
|
+
import { MemoryRouter, Routes, Route } from 'react-router';
|
|
10
|
+
import * as reactRouter from 'react-router';
|
|
11
|
+
import { describe, expect, test, vi, beforeEach } from 'vitest';
|
|
12
|
+
import { EncounterModal } from './EncounterModal';
|
|
13
|
+
import * as usePatientModule from '../../hooks/usePatient';
|
|
14
|
+
import * as encounterUtils from '../../utils/encounter';
|
|
15
|
+
import type { Encounter, Patient, PlanDefinition } from '@medplum/fhirtypes';
|
|
16
|
+
|
|
17
|
+
vi.mock('../../utils/encounter', () => ({
|
|
18
|
+
createEncounter: vi.fn(),
|
|
19
|
+
}));
|
|
20
|
+
|
|
21
|
+
const mockPatient: Patient = {
|
|
22
|
+
resourceType: 'Patient',
|
|
23
|
+
id: 'patient-123',
|
|
24
|
+
name: [{ given: ['John'], family: 'Doe' }],
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
const mockPlanDefinition: PlanDefinition = {
|
|
28
|
+
resourceType: 'PlanDefinition',
|
|
29
|
+
id: 'plan-123',
|
|
30
|
+
status: 'active',
|
|
31
|
+
title: 'Test Plan',
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
describe('EncounterModal', () => {
|
|
35
|
+
let medplum: MockClient;
|
|
36
|
+
let navigateSpy: ReturnType<typeof vi.fn>;
|
|
37
|
+
|
|
38
|
+
beforeEach(async () => {
|
|
39
|
+
medplum = new MockClient();
|
|
40
|
+
vi.clearAllMocks();
|
|
41
|
+
navigateSpy = vi.fn().mockReturnValue(Promise.resolve());
|
|
42
|
+
vi.spyOn(reactRouter, 'useNavigate').mockReturnValue(navigateSpy as any);
|
|
43
|
+
vi.spyOn(usePatientModule, 'usePatient').mockReturnValue(mockPatient);
|
|
44
|
+
await medplum.createResource(mockPlanDefinition);
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
function setup(): ReturnType<typeof render> {
|
|
48
|
+
return render(
|
|
49
|
+
<MemoryRouter initialEntries={['/Patient/patient-123/Encounter/new']}>
|
|
50
|
+
<MedplumProvider medplum={medplum}>
|
|
51
|
+
<MantineProvider>
|
|
52
|
+
<Notifications />
|
|
53
|
+
<Routes>
|
|
54
|
+
<Route path="/Patient/:patientId/Encounter/new" element={<EncounterModal />} />
|
|
55
|
+
<Route path="/Patient/:patientId/Encounter/:encounterId" element={<div>Encounter Page</div>} />
|
|
56
|
+
</Routes>
|
|
57
|
+
</MantineProvider>
|
|
58
|
+
</MedplumProvider>
|
|
59
|
+
</MemoryRouter>
|
|
60
|
+
);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
test('Renders all form fields', async () => {
|
|
64
|
+
setup();
|
|
65
|
+
|
|
66
|
+
await waitFor(() => {
|
|
67
|
+
expect(screen.getByLabelText(/Start Time/i)).toBeInTheDocument();
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
expect(screen.getByLabelText(/End Time/i)).toBeInTheDocument();
|
|
71
|
+
expect(screen.getByLabelText(/Class/i)).toBeInTheDocument();
|
|
72
|
+
expect(screen.getByLabelText(/Status/i)).toBeInTheDocument();
|
|
73
|
+
expect(screen.getByText('Apply care template')).toBeInTheDocument();
|
|
74
|
+
expect(screen.getByRole('button', { name: /Create Encounter/i })).toBeInTheDocument();
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
test('Shows error notification when required fields are missing', async () => {
|
|
78
|
+
const user = userEvent.setup();
|
|
79
|
+
setup();
|
|
80
|
+
|
|
81
|
+
await waitFor(() => {
|
|
82
|
+
expect(screen.getByRole('button', { name: /Create Encounter/i })).toBeInTheDocument();
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
const createButton = screen.getByRole('button', { name: /Create Encounter/i });
|
|
86
|
+
await act(async () => {
|
|
87
|
+
await user.click(createButton);
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
await waitFor(() => {
|
|
91
|
+
expect(screen.getByText('Please fill out required fields.')).toBeInTheDocument();
|
|
92
|
+
});
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
test('Modal renders with dialog role', async () => {
|
|
96
|
+
setup();
|
|
97
|
+
|
|
98
|
+
await waitFor(() => {
|
|
99
|
+
expect(screen.getByText('New encounter')).toBeInTheDocument();
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
expect(screen.getByRole('dialog')).toBeInTheDocument();
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
test('Displays care template section', () => {
|
|
106
|
+
setup();
|
|
107
|
+
|
|
108
|
+
expect(screen.getByText('Apply care template')).toBeInTheDocument();
|
|
109
|
+
expect(screen.getByText(/You can select template for new encounter/i)).toBeInTheDocument();
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
test('Form fields can be populated with values', async () => {
|
|
113
|
+
const user = userEvent.setup();
|
|
114
|
+
const mockEncounter: Encounter = {
|
|
115
|
+
resourceType: 'Encounter',
|
|
116
|
+
id: 'encounter-456',
|
|
117
|
+
status: 'in-progress',
|
|
118
|
+
class: { code: 'AMB', display: 'Ambulatory' },
|
|
119
|
+
subject: { reference: 'Patient/patient-123' },
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
vi.mocked(encounterUtils.createEncounter).mockResolvedValue(mockEncounter);
|
|
123
|
+
|
|
124
|
+
setup();
|
|
125
|
+
|
|
126
|
+
await waitFor(() => {
|
|
127
|
+
expect(screen.getByLabelText(/Start Time/i)).toBeInTheDocument();
|
|
128
|
+
});
|
|
129
|
+
|
|
130
|
+
// Fill in start time
|
|
131
|
+
const startInput = screen.getByLabelText(/Start Time/i);
|
|
132
|
+
await act(async () => {
|
|
133
|
+
await user.clear(startInput);
|
|
134
|
+
await user.type(startInput, '2024-01-15T10:00');
|
|
135
|
+
});
|
|
136
|
+
expect(startInput).toHaveValue('2024-01-15T10:00');
|
|
137
|
+
|
|
138
|
+
// Fill in end time
|
|
139
|
+
const endInput = screen.getByLabelText(/End Time/i);
|
|
140
|
+
await act(async () => {
|
|
141
|
+
await user.clear(endInput);
|
|
142
|
+
await user.type(endInput, '2024-01-15T11:00');
|
|
143
|
+
});
|
|
144
|
+
expect(endInput).toHaveValue('2024-01-15T11:00');
|
|
145
|
+
|
|
146
|
+
// Verify Class and Status input fields are present
|
|
147
|
+
expect(screen.getByLabelText(/Class/i)).toBeInTheDocument();
|
|
148
|
+
expect(screen.getByLabelText(/Status/i)).toBeInTheDocument();
|
|
149
|
+
|
|
150
|
+
// Verify PlanDefinition ResourceInput is present
|
|
151
|
+
const planDefinitionInput = document.querySelector('input[name="plandefinition"]');
|
|
152
|
+
expect(planDefinitionInput).toBeInTheDocument();
|
|
153
|
+
|
|
154
|
+
// Verify Create button is enabled and clickable
|
|
155
|
+
const createButton = screen.getByRole('button', { name: /Create Encounter/i });
|
|
156
|
+
expect(createButton).toBeInTheDocument();
|
|
157
|
+
expect(createButton).not.toBeDisabled();
|
|
158
|
+
});
|
|
159
|
+
|
|
160
|
+
test('Shows error notification when encounter creation fails', async () => {
|
|
161
|
+
const user = userEvent.setup();
|
|
162
|
+
|
|
163
|
+
vi.mocked(encounterUtils.createEncounter).mockRejectedValue(new Error('Creation failed'));
|
|
164
|
+
vi.spyOn(usePatientModule, 'usePatient').mockReturnValue(mockPatient);
|
|
165
|
+
|
|
166
|
+
setup();
|
|
167
|
+
|
|
168
|
+
await waitFor(() => {
|
|
169
|
+
expect(screen.getByLabelText(/Start Time/i)).toBeInTheDocument();
|
|
170
|
+
});
|
|
171
|
+
|
|
172
|
+
// The error notification will show when trying to create without filling required fields
|
|
173
|
+
const createButton = screen.getByRole('button', { name: /Create Encounter/i });
|
|
174
|
+
await act(async () => {
|
|
175
|
+
await user.click(createButton);
|
|
176
|
+
});
|
|
177
|
+
|
|
178
|
+
// Should show validation error - use getAllByText since there may be multiple
|
|
179
|
+
await waitFor(() => {
|
|
180
|
+
const errorMessages = screen.getAllByText('Please fill out required fields.');
|
|
181
|
+
expect(errorMessages.length).toBeGreaterThan(0);
|
|
182
|
+
});
|
|
183
|
+
});
|
|
184
|
+
|
|
185
|
+
test('Modal can be dismissed by clicking outside or escape', async () => {
|
|
186
|
+
setup();
|
|
187
|
+
|
|
188
|
+
await waitFor(() => {
|
|
189
|
+
expect(screen.getByRole('dialog')).toBeInTheDocument();
|
|
190
|
+
});
|
|
191
|
+
|
|
192
|
+
// The modal is open and can be closed via keyboard escape
|
|
193
|
+
// This verifies the modal rendering behavior
|
|
194
|
+
expect(screen.getByText('New encounter')).toBeInTheDocument();
|
|
195
|
+
});
|
|
196
|
+
|
|
197
|
+
test('Sets start date when DateTimeInput changes', async () => {
|
|
198
|
+
const user = userEvent.setup();
|
|
199
|
+
setup();
|
|
200
|
+
|
|
201
|
+
await waitFor(() => {
|
|
202
|
+
expect(screen.getByLabelText(/Start Time/i)).toBeInTheDocument();
|
|
203
|
+
});
|
|
204
|
+
|
|
205
|
+
const startInput = screen.getByLabelText(/Start Time/i);
|
|
206
|
+
await act(async () => {
|
|
207
|
+
await user.clear(startInput);
|
|
208
|
+
await user.type(startInput, '2024-02-20T14:30');
|
|
209
|
+
});
|
|
210
|
+
|
|
211
|
+
expect(startInput).toHaveValue('2024-02-20T14:30');
|
|
212
|
+
});
|
|
213
|
+
|
|
214
|
+
test('Sets end date when DateTimeInput changes', async () => {
|
|
215
|
+
const user = userEvent.setup();
|
|
216
|
+
setup();
|
|
217
|
+
|
|
218
|
+
await waitFor(() => {
|
|
219
|
+
expect(screen.getByLabelText(/End Time/i)).toBeInTheDocument();
|
|
220
|
+
});
|
|
221
|
+
|
|
222
|
+
const endInput = screen.getByLabelText(/End Time/i);
|
|
223
|
+
await act(async () => {
|
|
224
|
+
await user.clear(endInput);
|
|
225
|
+
await user.type(endInput, '2024-02-20T15:30');
|
|
226
|
+
});
|
|
227
|
+
|
|
228
|
+
expect(endInput).toHaveValue('2024-02-20T15:30');
|
|
229
|
+
});
|
|
230
|
+
|
|
231
|
+
test('Patient context is available in modal', async () => {
|
|
232
|
+
setup();
|
|
233
|
+
|
|
234
|
+
await waitFor(() => {
|
|
235
|
+
expect(screen.getByLabelText(/Start Time/i)).toBeInTheDocument();
|
|
236
|
+
});
|
|
237
|
+
|
|
238
|
+
// Verify the modal has loaded with form fields
|
|
239
|
+
expect(screen.getByLabelText(/Start Time/i)).toBeInTheDocument();
|
|
240
|
+
expect(screen.getByLabelText(/End Time/i)).toBeInTheDocument();
|
|
241
|
+
});
|
|
242
|
+
|
|
243
|
+
test('Navigates to created encounter on success', async () => {
|
|
244
|
+
const mockEncounter: Encounter = {
|
|
245
|
+
resourceType: 'Encounter',
|
|
246
|
+
id: 'new-encounter-789',
|
|
247
|
+
status: 'in-progress',
|
|
248
|
+
class: { code: 'AMB', display: 'Ambulatory' },
|
|
249
|
+
subject: { reference: 'Patient/patient-123' },
|
|
250
|
+
};
|
|
251
|
+
|
|
252
|
+
vi.mocked(encounterUtils.createEncounter).mockResolvedValue(mockEncounter);
|
|
253
|
+
|
|
254
|
+
setup();
|
|
255
|
+
|
|
256
|
+
await waitFor(() => {
|
|
257
|
+
expect(screen.getByRole('dialog')).toBeInTheDocument();
|
|
258
|
+
});
|
|
259
|
+
|
|
260
|
+
// The navigation to the new encounter would happen after successful creation
|
|
261
|
+
// This verifies the modal renders correctly with all components
|
|
262
|
+
expect(screen.getByRole('button', { name: /Create Encounter/i })).toBeInTheDocument();
|
|
263
|
+
});
|
|
264
|
+
|
|
265
|
+
test('Handles missing patient gracefully', async () => {
|
|
266
|
+
vi.spyOn(usePatientModule, 'usePatient').mockReturnValue(undefined);
|
|
267
|
+
const user = userEvent.setup();
|
|
268
|
+
|
|
269
|
+
setup();
|
|
270
|
+
|
|
271
|
+
await waitFor(() => {
|
|
272
|
+
expect(screen.getByRole('button', { name: /Create Encounter/i })).toBeInTheDocument();
|
|
273
|
+
});
|
|
274
|
+
|
|
275
|
+
// Should show validation error when trying to create without patient
|
|
276
|
+
const createButton = screen.getByRole('button', { name: /Create Encounter/i });
|
|
277
|
+
await act(async () => {
|
|
278
|
+
await user.click(createButton);
|
|
279
|
+
});
|
|
280
|
+
|
|
281
|
+
// Use getAllByText since there may be multiple validation messages
|
|
282
|
+
await waitFor(() => {
|
|
283
|
+
const errorMessages = screen.getAllByText('Please fill out required fields.');
|
|
284
|
+
expect(errorMessages.length).toBeGreaterThan(0);
|
|
285
|
+
});
|
|
286
|
+
});
|
|
287
|
+
});
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: Copyright Orangebot, Inc. and Medplum contributors
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
import { Box, Button, Card, Grid, Modal, Stack, Text } from '@mantine/core';
|
|
4
|
+
import { showNotification } from '@mantine/notifications';
|
|
5
|
+
import { normalizeErrorString } from '@medplum/core';
|
|
6
|
+
import type { Coding, Encounter, PlanDefinition } from '@medplum/fhirtypes';
|
|
7
|
+
import { CodeInput, CodingInput, DateTimeInput, ResourceInput, useMedplum } from '@medplum/react';
|
|
8
|
+
import { IconAlertSquareRounded, IconCircleCheck, IconCircleOff } from '@tabler/icons-react';
|
|
9
|
+
import { useState } from 'react';
|
|
10
|
+
import type { JSX } from 'react';
|
|
11
|
+
import { useNavigate } from 'react-router';
|
|
12
|
+
import { usePatient } from '../../hooks/usePatient';
|
|
13
|
+
import classes from './EncounterModal.module.css';
|
|
14
|
+
import { createEncounter } from '../../utils/encounter';
|
|
15
|
+
|
|
16
|
+
export const EncounterModal = (): JSX.Element => {
|
|
17
|
+
const navigate = useNavigate();
|
|
18
|
+
const medplum = useMedplum();
|
|
19
|
+
const patient = usePatient();
|
|
20
|
+
const [isOpen, setIsOpen] = useState(true);
|
|
21
|
+
const [start, setStart] = useState<Date | undefined>();
|
|
22
|
+
const [end, setEnd] = useState<Date | undefined>();
|
|
23
|
+
const [encounterClass, setEncounterClass] = useState<Coding | undefined>();
|
|
24
|
+
const [planDefinitionData, setPlanDefinitionData] = useState<PlanDefinition | undefined>();
|
|
25
|
+
const [status, setStatus] = useState<Encounter['status'] | undefined>();
|
|
26
|
+
const [isLoading, setIsLoading] = useState(false);
|
|
27
|
+
|
|
28
|
+
const handleCreateEncounter = async (): Promise<void> => {
|
|
29
|
+
if (!patient || !encounterClass || !start || !end || !status || !planDefinitionData) {
|
|
30
|
+
showNotification({
|
|
31
|
+
color: 'yellow',
|
|
32
|
+
icon: <IconAlertSquareRounded />,
|
|
33
|
+
title: 'Error',
|
|
34
|
+
message: 'Please fill out required fields.',
|
|
35
|
+
});
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
setIsLoading(true);
|
|
40
|
+
|
|
41
|
+
try {
|
|
42
|
+
const encounter = await createEncounter(medplum, start, end, encounterClass, patient, planDefinitionData);
|
|
43
|
+
showNotification({ icon: <IconCircleCheck />, title: 'Success', message: 'Encounter created' });
|
|
44
|
+
navigate(`/Patient/${patient.id}/Encounter/${encounter.id}`)?.catch(console.error);
|
|
45
|
+
} catch (err) {
|
|
46
|
+
showNotification({ color: 'red', icon: <IconCircleOff />, title: 'Error', message: normalizeErrorString(err) });
|
|
47
|
+
} finally {
|
|
48
|
+
setIsLoading(false);
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
return (
|
|
53
|
+
<Modal
|
|
54
|
+
opened={isOpen}
|
|
55
|
+
onClose={() => {
|
|
56
|
+
navigate(-1)?.catch(console.error);
|
|
57
|
+
setIsOpen(false);
|
|
58
|
+
}}
|
|
59
|
+
size="60%"
|
|
60
|
+
title="New encounter"
|
|
61
|
+
styles={{ title: { fontSize: '1.125rem', fontWeight: 600 }, body: { padding: 0, height: '60vh' } }}
|
|
62
|
+
>
|
|
63
|
+
<Stack h="100%" justify="space-between" gap={0}>
|
|
64
|
+
<Box flex={1} miw={0}>
|
|
65
|
+
<Grid p="md" h="100%">
|
|
66
|
+
<Grid.Col span={6} pr="md">
|
|
67
|
+
<Stack gap="md">
|
|
68
|
+
<ResourceInput
|
|
69
|
+
resourceType="Patient"
|
|
70
|
+
name="Patient-id"
|
|
71
|
+
defaultValue={patient}
|
|
72
|
+
disabled={true}
|
|
73
|
+
required={true}
|
|
74
|
+
/>
|
|
75
|
+
|
|
76
|
+
<DateTimeInput
|
|
77
|
+
name="start"
|
|
78
|
+
label="Start Time"
|
|
79
|
+
required={true}
|
|
80
|
+
onChange={(value) => {
|
|
81
|
+
setStart(new Date(value));
|
|
82
|
+
}}
|
|
83
|
+
/>
|
|
84
|
+
|
|
85
|
+
<DateTimeInput
|
|
86
|
+
name="end"
|
|
87
|
+
label="End Time"
|
|
88
|
+
required={true}
|
|
89
|
+
onChange={(value) => {
|
|
90
|
+
setEnd(new Date(value));
|
|
91
|
+
}}
|
|
92
|
+
/>
|
|
93
|
+
|
|
94
|
+
<CodingInput
|
|
95
|
+
name="class"
|
|
96
|
+
label="Class"
|
|
97
|
+
binding="http://terminology.hl7.org/ValueSet/v3-ActEncounterCode"
|
|
98
|
+
required={true}
|
|
99
|
+
onChange={setEncounterClass}
|
|
100
|
+
path="Encounter.type"
|
|
101
|
+
/>
|
|
102
|
+
|
|
103
|
+
<CodeInput
|
|
104
|
+
name="status"
|
|
105
|
+
label="Status"
|
|
106
|
+
binding="http://hl7.org/fhir/ValueSet/encounter-status|4.0.1"
|
|
107
|
+
maxValues={1}
|
|
108
|
+
required={true}
|
|
109
|
+
onChange={(value) => {
|
|
110
|
+
if (value) {
|
|
111
|
+
setStatus(value as typeof status);
|
|
112
|
+
}
|
|
113
|
+
}}
|
|
114
|
+
/>
|
|
115
|
+
</Stack>
|
|
116
|
+
</Grid.Col>
|
|
117
|
+
|
|
118
|
+
<Grid.Col span={6}>
|
|
119
|
+
<Card padding="lg" radius="md" className={classes.planDefinition}>
|
|
120
|
+
<Text size="md" fw={500} mb="xs">
|
|
121
|
+
Apply care template
|
|
122
|
+
</Text>
|
|
123
|
+
<Text size="sm" color="dimmed" mb="lg">
|
|
124
|
+
You can select template for new encounter. Tasks from the template will be automatically added to the
|
|
125
|
+
encounter. Administrators can create and edit templates in the{' '}
|
|
126
|
+
<Text component="a" href="#" variant="link">
|
|
127
|
+
Medplum app
|
|
128
|
+
</Text>
|
|
129
|
+
.
|
|
130
|
+
</Text>
|
|
131
|
+
|
|
132
|
+
<ResourceInput
|
|
133
|
+
name="plandefinition"
|
|
134
|
+
resourceType="PlanDefinition"
|
|
135
|
+
onChange={(value) => setPlanDefinitionData(value as PlanDefinition)}
|
|
136
|
+
required={true}
|
|
137
|
+
/>
|
|
138
|
+
</Card>
|
|
139
|
+
</Grid.Col>
|
|
140
|
+
</Grid>
|
|
141
|
+
</Box>
|
|
142
|
+
|
|
143
|
+
<Box className={classes.footer} h={70} p="md">
|
|
144
|
+
<Button fullWidth={false} onClick={handleCreateEncounter} loading={isLoading} disabled={isLoading}>
|
|
145
|
+
Create Encounter
|
|
146
|
+
</Button>
|
|
147
|
+
</Box>
|
|
148
|
+
</Stack>
|
|
149
|
+
</Modal>
|
|
150
|
+
);
|
|
151
|
+
};
|