-
Notifications
You must be signed in to change notification settings - Fork 211
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(feat) O3-3250: Add in-patient notes workspace (#1238)
- Loading branch information
1 parent
52605c0
commit 020cde3
Showing
21 changed files
with
557 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
export const emrConfigurationMock = { | ||
clinicianEncounterRole: { uuid: '240b26f9-dd88-4172-823d-4a8bfeb7841f' }, | ||
consultFreeTextCommentsConcept: { uuid: '162169AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA' }, | ||
visitNoteEncounterType: { uuid: 'd7151f82-c1f3-4152-a605-2f9ea7414a79' }, | ||
admissionEncounterType: { uuid: 'e8151f82-c1f3-4152-a605-2f9ea7414a79' }, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import type { DefaultWorkspaceProps, PatientUuid } from '@openmrs/esm-framework'; | ||
import type { WardPatientCardProps } from '../types'; | ||
|
||
export interface WardPatientWorkspaceProps extends DefaultWorkspaceProps, WardPatientCardProps { | ||
patientUuid: PatientUuid; | ||
} |
16 changes: 3 additions & 13 deletions
16
packages/esm-ward-app/src/ward-patient-workspace/ward-patient.workspace.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
packages/esm-ward-app/src/ward-workspace/patient-banner/patient-banner.component.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import React, { useMemo } from 'react'; | ||
import { useConfig } from '@openmrs/esm-framework'; | ||
import { defaultPatientCardElementConfig, type WardConfigObject } from '../../config-schema'; | ||
import { getPatientCardElementFromDefinition } from '../../ward-patient-card/ward-patient-card-row.resources'; | ||
import type { PatientCardElementType, WardPatientCardProps } from '../../types'; | ||
import styles from './style.scss'; | ||
import useWardLocation from '../../hooks/useWardLocation'; | ||
|
||
const WardPatientWorkspaceBanner = ({ bed, patient, visit }: WardPatientCardProps) => { | ||
const { location } = useWardLocation(); | ||
const { wardPatientCards } = useConfig<WardConfigObject>(); | ||
const { cardDefinitions } = wardPatientCards; | ||
|
||
// extract configured elements for the patient card header to use for the banner section | ||
const bannerElements = useMemo(() => { | ||
const cardDefinition = cardDefinitions.find((cardDef) => { | ||
const appliedTo = cardDef.appliedTo; | ||
|
||
return appliedTo == null || appliedTo.some((criteria) => criteria.location == location.uuid); | ||
}); | ||
|
||
const headerRow = cardDefinition.rows.find((cardDef) => cardDef.rowType === 'header'); | ||
|
||
return headerRow.elements.map((elementType: PatientCardElementType) => | ||
getPatientCardElementFromDefinition({ | ||
id: elementType, | ||
elementType, | ||
config: defaultPatientCardElementConfig, | ||
}), | ||
); | ||
}, [cardDefinitions]); | ||
|
||
if (!(patient && bed && visit)) return null; | ||
|
||
return ( | ||
<div className={styles.patientBanner}> | ||
{bannerElements.map((BannerElement) => ( | ||
<BannerElement patient={patient} visit={visit} bed={bed} /> | ||
))} | ||
</div> | ||
); | ||
}; | ||
|
||
export default WardPatientWorkspaceBanner; |
23 changes: 23 additions & 0 deletions
23
packages/esm-ward-app/src/ward-workspace/patient-banner/style.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
@use '@carbon/layout'; | ||
@import '~@openmrs/esm-styleguide/src/vars'; | ||
|
||
.patientBanner { | ||
@extend .dotSeparatedChildren; | ||
display: flex; | ||
flex-wrap: wrap; | ||
width: 100%; | ||
padding: layout.$spacing-04; | ||
background: $ui-01; | ||
} | ||
|
||
.dotSeparatedChildren { | ||
> div:not(div:first-of-type) { | ||
display: flex; | ||
align-items: center; | ||
|
||
&::before { | ||
content: '·'; | ||
padding: 0 layout.$spacing-02; | ||
} | ||
} | ||
} |
Oops, something went wrong.