Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(feat) O3-4363 - Add Visit context header to Order, Visit Note, and F… #2222

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions packages/esm-patient-chart-app/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import cancelVisitActionButtonComponent from './actions-buttons/cancel-visit.com
import currentVisitSummaryComponent from './visit/visits-widget/current-visit-summary.component';
import markPatientAliveActionButtonComponent from './actions-buttons/mark-patient-alive.component';
import markPatientDeceasedActionButtonComponent from './actions-buttons/mark-patient-deceased.component';
import pastVisitsDetailOverviewComponent from './visit/past-visit-overview.component';
import pastVisitsOverviewComponent from './visit/visits-widget/visit-detail-overview.component';
import patientChartPageComponent from './root.component';
import patientDetailsTileComponent from './patient-details-tile/patient-details-tile.component';
Expand Down Expand Up @@ -133,11 +132,6 @@ export const currentVisitSummary = getSyncLifecycle(currentVisitSummaryComponent
moduleName,
});

export const pastVisitsOverview = getSyncLifecycle(pastVisitsDetailOverviewComponent, {
featureName: 'past-visits-overview',
moduleName,
});

export const pastVisitsDetailOverview = getSyncLifecycle(pastVisitsOverviewComponent, {
featureName: 'visits-detail-slot',
moduleName,
Expand Down Expand Up @@ -235,3 +229,13 @@ export const encounterListTableTabs = getAsyncLifecycle(
() => import('./clinical-views/encounter-list/encounter-list-tabs.component'),
{ featureName: 'encounter-list-table-tabs', moduleName },
);

export const visitContextSwitcherModal = getAsyncLifecycle(
() => import('./visit/visits-widget/visit-context/visit-context-switcher.modal'),
{ featureName: 'visit-context-switcher-modal', moduleName },
);

export const visitContextHeader = getAsyncLifecycle(
() => import('./visit/visits-widget/visit-context/visit-context-header.component'),
{ featureName: 'visit-context-header', moduleName },
);
17 changes: 9 additions & 8 deletions packages/esm-patient-chart-app/src/routes.json
Original file line number Diff line number Diff line change
Expand Up @@ -124,14 +124,6 @@
"online": true,
"offline": true
},
{
"name": "past-visits-overview",
"component": "pastVisitsOverview",
"meta": {
"title": "Edit or load a past visit",
"view": "visits"
}
},
{
"name": "patient-details-tile",
"slot": "visit-form-header-slot",
Expand Down Expand Up @@ -198,6 +190,11 @@
"online": true,
"offline": true,
"order": 1
},
{
"name": "visit-context-header",
"slot": "visit-context-header-slot",
"component": "visitContextHeader"
}
],
"modals": [
Expand Down Expand Up @@ -228,6 +225,10 @@
{
"name": "start-visit-dialog",
"component": "startVisitModal"
},
{
"name": "visit-context-switcher-modal",
"component": "visitContextSwitcherModal"
}
],
"pages": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ interface RetrospectiveVisitLabelProps {

const RetrospectiveVisitLabel: React.FC<RetrospectiveVisitLabelProps> = ({ currentVisit }) => {
const { t } = useTranslation();
if (!currentVisit) {
return <></>;
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We only render the retrospective entry toggle if it's not the current visit? (I'm probably just not understanding this correctly and it's legacy functionality anyway?)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah, current visit means the visit in the current context, not the active visit?

return (
<Toggletip align="bottom">
<ToggletipButton label={t('retrospectiveEntry', 'Retrospective Entry')}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,14 +123,15 @@ function launchStartVisitForm() {

const VisitHeader: React.FC<{ patient: fhir.Patient }> = ({ patient }) => {
const { t } = useTranslation();
const { currentVisit, currentVisitIsRetrospective, isLoading } = useVisit(patient?.id);
const { currentVisit, isLoading } = useVisit(patient?.id);
const [isSideMenuExpanded, setIsSideMenuExpanded] = useState(false);
const navMenuItems = useAssignedExtensions('patient-chart-dashboard-slot').map((extension) => extension.id);
const { logo } = useConfig();
const { systemVisitEnabled } = useSystemVisitSetting();
const isTablet = useLayoutType() === 'tablet';

const showHamburger = useLayoutType() !== 'large-desktop' && navMenuItems.length > 0;
const currentVisitIsRetrospective = Boolean(currentVisit && currentVisit.stopDatetime);

const toggleSideMenu = useCallback(
(state?: boolean) => setIsSideMenuExpanded((prevState) => (state !== undefined ? state : !prevState)),
Expand Down

This file was deleted.

17 changes: 0 additions & 17 deletions packages/esm-patient-chart-app/src/visit/past-visit-overview.scss

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,16 @@ jest.mock('./visit-form.resource', () => {
};
});

jest.mock('../visits-widget/visit.resource', () => {
const requireActual = jest.requireActual('../visits-widget/visit.resource');
return {
...requireActual,
useInfiniteVisits: jest.fn(() => ({
mutate: jest.fn(),
})),
};
});

mockSaveVisit.mockResolvedValue({
status: 201,
data: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ const StartVisitForm: React.FC<StartVisitFormProps> = ({
const visitHeaderSlotState = useMemo(() => ({ patientUuid }), [patientUuid]);
const { activePatientEnrollment, isLoading } = useActivePatientEnrollment(patientUuid);
const { mutate: mutateCurrentVisit } = useVisit(patientUuid);
const { mutateVisits: mutateInfiniteVisits } = useInfiniteVisits(patientUuid);
const { mutate: mutateInfiniteVisits } = useInfiniteVisits(patientUuid);
const allVisitTypes = useConditionalVisitTypes();

const [errorFetchingResources, setErrorFetchingResources] = useState<{
Expand Down
Loading