@kenyaemr/esm-morgue-app 5.4.2-pre.2333 → 5.4.2-pre.2347
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/.turbo/turbo-build.log +20 -25
- package/dist/1.js +2 -0
- package/dist/1.js.map +1 -0
- package/dist/197.js +2 -1
- package/dist/197.js.map +1 -0
- package/dist/221.js +1 -1
- package/dist/221.js.map +1 -1
- package/dist/293.js +1 -1
- package/dist/294.js +1 -1
- package/dist/300.js +1 -1
- package/dist/340.js +2 -0
- package/dist/340.js.map +1 -0
- package/dist/351.js +1 -0
- package/dist/351.js.map +1 -0
- package/dist/404.js +1 -0
- package/dist/404.js.map +1 -0
- package/dist/441.js +1 -0
- package/dist/441.js.map +1 -0
- package/dist/578.js +1 -0
- package/dist/608.js +1 -0
- package/dist/608.js.map +1 -0
- package/dist/611.js +2 -0
- package/dist/611.js.map +1 -0
- package/dist/632.js +1 -1
- package/dist/632.js.map +1 -1
- package/dist/653.js +1 -1
- package/dist/653.js.map +1 -1
- package/dist/758.js +1 -0
- package/dist/758.js.map +1 -0
- package/dist/805.js +1 -1
- package/dist/805.js.map +1 -1
- package/dist/814.js +2 -0
- package/dist/814.js.LICENSE.txt +5 -0
- package/dist/814.js.map +1 -0
- package/dist/824.js +1 -1
- package/dist/824.js.map +1 -1
- package/dist/845.js +1 -0
- package/dist/845.js.map +1 -0
- package/dist/888.js +1 -0
- package/dist/888.js.map +1 -0
- package/dist/918.js +1 -1
- package/dist/918.js.map +1 -1
- package/dist/990.js +1 -0
- package/dist/990.js.map +1 -0
- package/dist/kenyaemr-esm-morgue-app.js +1 -1
- package/dist/kenyaemr-esm-morgue-app.js.buildmanifest.json +250 -203
- package/dist/kenyaemr-esm-morgue-app.js.map +1 -1
- package/dist/main.js +1 -1
- package/dist/main.js.LICENSE.txt +0 -6
- package/dist/main.js.map +1 -1
- package/dist/routes.json +1 -1
- package/package.json +1 -1
- package/src/bed/bed.component.tsx +63 -134
- package/src/bed/components/deceased-patient-card-header.component.tsx +73 -0
- package/src/bed/components/deceased-patient-info.component.tsx +47 -0
- package/src/bed/components/deceased-patient-status-footer.component.tsx +43 -0
- package/src/bed-layout/admitted/admitted-bed-layout.component.tsx +175 -96
- package/src/bed-layout/awaiting/awaiting-bed-layout.component.tsx +103 -36
- package/src/bed-layout/bed-layout.scss +4 -0
- package/src/bed-layout/discharged/discharged-bed-layout.component.tsx +131 -73
- package/src/bed-linelist-view/admitted/admitted-bed-linelist-view.component.tsx +182 -134
- package/src/bed-linelist-view/awaiting/awaiting-bed-linelist-view.component.tsx +115 -71
- package/src/bed-linelist-view/discharged/discharged-bed-line-view.component.tsx +181 -109
- package/src/config-schema.ts +140 -4
- package/src/context/deceased-person-context.tsx +33 -0
- package/src/extension/actionButton.component.tsx +1 -1
- package/src/forms/admit-deceased-person-workspace/admit-deceased-person.resource.ts +84 -166
- package/src/forms/admit-deceased-person-workspace/admit-deceased-person.scss +14 -0
- package/src/forms/admit-deceased-person-workspace/admit-deceased-person.workspace.tsx +504 -334
- package/src/forms/discharge-deceased-person-workspace/discharge-body.resource.ts +0 -1
- package/src/forms/discharge-deceased-person-workspace/discharge-body.scss +15 -0
- package/src/forms/discharge-deceased-person-workspace/discharge-body.workspace.tsx +303 -244
- package/src/helpers/expression-helper.ts +122 -0
- package/src/home/home.component.tsx +23 -4
- package/src/index.ts +0 -2
- package/src/metrics/metrics-card.component.tsx +2 -2
- package/src/routes.json +0 -6
- package/src/schemas/index.ts +243 -51
- package/src/summary/summary.component.tsx +16 -9
- package/src/switcher/content-switcher.component.tsx +61 -35
- package/src/switcher/content-switcher.scss +13 -0
- package/src/types/index.ts +43 -1
- package/translations/am.json +16 -6
- package/translations/en.json +16 -6
- package/translations/sw.json +16 -6
- package/dist/373.js +0 -2
- package/dist/373.js.map +0 -1
- package/dist/398.js +0 -1
- package/dist/398.js.map +0 -1
- package/dist/410.js +0 -1
- package/dist/410.js.map +0 -1
- package/dist/429.js +0 -2
- package/dist/429.js.map +0 -1
- package/dist/467.js +0 -1
- package/dist/467.js.map +0 -1
- package/dist/579.js +0 -2
- package/dist/579.js.map +0 -1
- package/dist/619.js +0 -1
- package/dist/619.js.map +0 -1
- package/dist/633.js +0 -1
- package/dist/633.js.map +0 -1
- package/dist/712.js +0 -1
- package/dist/712.js.map +0 -1
- package/dist/713.js +0 -1
- package/dist/713.js.map +0 -1
- package/dist/723.js +0 -1
- package/dist/723.js.map +0 -1
- package/dist/989.js +0 -2
- package/dist/989.js.map +0 -1
- package/src/forms/dispose-deceased-person-workspace/dispose-deceased-person.resource.ts +0 -18
- package/src/forms/dispose-deceased-person-workspace/dispose-deceased-person.scss +0 -84
- package/src/forms/dispose-deceased-person-workspace/dispose-deceased-person.workspace.tsx +0 -505
- /package/dist/{373.js.LICENSE.txt → 1.js.LICENSE.txt} +0 -0
- /package/dist/{989.js.LICENSE.txt → 197.js.LICENSE.txt} +0 -0
- /package/dist/{579.js.LICENSE.txt → 340.js.LICENSE.txt} +0 -0
- /package/dist/{429.js.LICENSE.txt → 611.js.LICENSE.txt} +0 -0
package/dist/routes.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"$schema":"https://json.openmrs.org/routes.schema.json","backendDependencies":{"fhir2":">=1.2","webservices.rest":"^2.24.0"},"extensions":[{"name":"action-buttons","component":"actionBarButtons","slot":"mortuary-action-buttons-slot","meta":{"fullWidth":false,"privileges":["o3 : View Mortuary Dashboard","o3 : Admit Body to Mortuary","o3 : Edit Mortuary Records","o3 : Discharge Body from Mortuary","o3 : View Mortuary Compartments","o3 : Swap Mortuary Compartments","o3 : View Mortuary Billing","o3 : Process Mortuary Payments","o3 : View Mortuary Reports","o3 : Generate Mortuary Reports"]}},{"name":"deceased-banner-info","component":"bannerInfo","slot":"deceased-banner-info-slot","meta":{"fullWidth":false}},{"name":"print-post-mortem-overflow-menu-item","component":"printPostMortemOverflowMenuItem","slot":"print-post-mortem-overflow-menu-item-slot"},{"component":"root","name":"morgue-dashboard-root","slot":"morgue-dashboard-slot","meta":{"privileges":["o3 : View Mortuary Dashboard"]}}],"workspaces":[{"name":"patient-additional-info-form","component":"patientAdditionalInfoForm","title":"add more details","type":"other-form"},{"name":"discharge-body-form","component":"dischargeBodyForm","title":"discharge body form","type":"other-form"},{"name":"admit-body-form","component":"admitBodyForm","title":"Admission form","type":"other-form"},{"name":"swap-unit-form","component":"swapForm","title":"Swap form","type":"other-form"},{"name":"admit-deceased-person-form","component":"admitDeceasedPersonForm","title":"Admit Deceased Person","type":"other-form"},{"name":"mortuary-form-entry","component":"mortuaryFormEntry","title":"Mortuary Form Entry","type":"form","width":"extra-wide","canMaximize":true,"canHide":true}
|
|
1
|
+
{"$schema":"https://json.openmrs.org/routes.schema.json","backendDependencies":{"fhir2":">=1.2","webservices.rest":"^2.24.0"},"extensions":[{"name":"action-buttons","component":"actionBarButtons","slot":"mortuary-action-buttons-slot","meta":{"fullWidth":false,"privileges":["o3 : View Mortuary Dashboard","o3 : Admit Body to Mortuary","o3 : Edit Mortuary Records","o3 : Discharge Body from Mortuary","o3 : View Mortuary Compartments","o3 : Swap Mortuary Compartments","o3 : View Mortuary Billing","o3 : Process Mortuary Payments","o3 : View Mortuary Reports","o3 : Generate Mortuary Reports"]}},{"name":"deceased-banner-info","component":"bannerInfo","slot":"deceased-banner-info-slot","meta":{"fullWidth":false}},{"name":"print-post-mortem-overflow-menu-item","component":"printPostMortemOverflowMenuItem","slot":"print-post-mortem-overflow-menu-item-slot"},{"component":"root","name":"morgue-dashboard-root","slot":"morgue-dashboard-slot","meta":{"privileges":["o3 : View Mortuary Dashboard"]}}],"workspaces":[{"name":"patient-additional-info-form","component":"patientAdditionalInfoForm","title":"add more details","type":"other-form"},{"name":"discharge-body-form","component":"dischargeBodyForm","title":"discharge body form","type":"other-form"},{"name":"admit-body-form","component":"admitBodyForm","title":"Admission form","type":"other-form"},{"name":"swap-unit-form","component":"swapForm","title":"Swap form","type":"other-form"},{"name":"admit-deceased-person-form","component":"admitDeceasedPersonForm","title":"Admit Deceased Person","type":"other-form"},{"name":"mortuary-form-entry","component":"mortuaryFormEntry","title":"Mortuary Form Entry","type":"form","width":"extra-wide","canMaximize":true,"canHide":true}],"modals":[{"name":"print-confirmation-modal","component":"printConfirmationModal"},{"name":"autopsy-report-modal","component":"autopsyReportModal"}],"pages":[{"component":"root","route":"morgue"}],"version":"5.4.2-pre.2347"}
|
package/package.json
CHANGED
|
@@ -1,59 +1,37 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { Layer,
|
|
3
|
-
import styles from './bed.scss';
|
|
2
|
+
import { Layer, Tile } from '@carbon/react';
|
|
4
3
|
import { useTranslation } from 'react-i18next';
|
|
5
|
-
import {
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
onDispose?: () => void;
|
|
25
|
-
onPrintGatePass?: () => void;
|
|
26
|
-
onViewDetails?: () => void;
|
|
27
|
-
isDischarged?: boolean;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
const BedCard: React.FC<BedProps> = ({
|
|
31
|
-
bedNumber,
|
|
32
|
-
patientName,
|
|
33
|
-
gender,
|
|
34
|
-
age,
|
|
35
|
-
causeOfDeath,
|
|
36
|
-
bedType,
|
|
37
|
-
dateOfDeath,
|
|
38
|
-
patientUuid,
|
|
39
|
-
onAdmit,
|
|
40
|
-
onPostmortem,
|
|
41
|
-
onDischarge,
|
|
42
|
-
onSwapCompartment,
|
|
43
|
-
onDispose,
|
|
44
|
-
onPrintGatePass,
|
|
45
|
-
onViewDetails,
|
|
46
|
-
isDischarged = false,
|
|
4
|
+
import { convertDateToDays } from '../utils/utils';
|
|
5
|
+
import { useVisit } from '@openmrs/esm-framework';
|
|
6
|
+
import styles from './bed.scss';
|
|
7
|
+
import { PatientCardProps } from '../types';
|
|
8
|
+
import { usePatientContext } from '../context/deceased-person-context';
|
|
9
|
+
import DeceasedPatientCardHeader from './components/deceased-patient-card-header.component';
|
|
10
|
+
import DeceasedPatientInfo from './components/deceased-patient-info.component';
|
|
11
|
+
import DeceasedPatientStatusFooter from './components/deceased-patient-status-footer.component';
|
|
12
|
+
import { getOriginalPatient } from '../helpers/expression-helper';
|
|
13
|
+
const BedCard: React.FC<PatientCardProps> = ({
|
|
14
|
+
patient,
|
|
15
|
+
showActions = {
|
|
16
|
+
admit: false,
|
|
17
|
+
discharge: false,
|
|
18
|
+
postmortem: false,
|
|
19
|
+
swapCompartment: false,
|
|
20
|
+
printGatePass: false,
|
|
21
|
+
viewDetails: false,
|
|
22
|
+
},
|
|
47
23
|
}) => {
|
|
48
24
|
const { t } = useTranslation();
|
|
49
|
-
const { activeVisit } = useVisit(
|
|
25
|
+
const { activeVisit } = useVisit(patient.uuid);
|
|
26
|
+
const { onAdmit, onPostmortem, onDischarge, onSwapCompartment, onPrintGatePass, onViewDetails } = usePatientContext();
|
|
50
27
|
|
|
51
28
|
const lengthOfStay = activeVisit?.startDatetime
|
|
52
29
|
? convertDateToDays(activeVisit.startDatetime)
|
|
53
|
-
: calculateDaysInMortuary(
|
|
30
|
+
: calculateDaysInMortuary(patient.person.deathDate);
|
|
54
31
|
|
|
55
32
|
const isAdmitted = !!activeVisit;
|
|
56
|
-
const timeSpentTagType
|
|
33
|
+
const timeSpentTagType: 'red' | 'magenta' | 'green' =
|
|
34
|
+
lengthOfStay > 7 ? 'red' : lengthOfStay > 3 ? 'magenta' : 'green';
|
|
57
35
|
|
|
58
36
|
function calculateDaysInMortuary(dateOfDeath: string): number {
|
|
59
37
|
if (!dateOfDeath) {
|
|
@@ -65,96 +43,47 @@ const BedCard: React.FC<BedProps> = ({
|
|
|
65
43
|
return Math.floor(timeDiff / (1000 * 3600 * 24));
|
|
66
44
|
}
|
|
67
45
|
|
|
46
|
+
const handleAction = (actionType: string) => {
|
|
47
|
+
switch (actionType) {
|
|
48
|
+
case 'admit':
|
|
49
|
+
// For admit action, we need to pass the original MortuaryPatient if available
|
|
50
|
+
const originalPatient = getOriginalPatient(patient);
|
|
51
|
+
if (originalPatient) {
|
|
52
|
+
onAdmit?.(originalPatient);
|
|
53
|
+
} else {
|
|
54
|
+
onAdmit?.(patient);
|
|
55
|
+
}
|
|
56
|
+
break;
|
|
57
|
+
case 'postmortem':
|
|
58
|
+
onPostmortem?.(patient.uuid);
|
|
59
|
+
break;
|
|
60
|
+
case 'discharge':
|
|
61
|
+
onDischarge?.(patient.uuid, patient.bedInfo?.bedId);
|
|
62
|
+
break;
|
|
63
|
+
case 'swapCompartment':
|
|
64
|
+
onSwapCompartment?.(patient.uuid, patient.bedInfo?.bedId);
|
|
65
|
+
break;
|
|
66
|
+
case 'printGatePass':
|
|
67
|
+
onPrintGatePass?.(patient, patient.encounterDate);
|
|
68
|
+
break;
|
|
69
|
+
case 'viewDetails':
|
|
70
|
+
onViewDetails?.(patient.uuid, patient.bedInfo);
|
|
71
|
+
break;
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
|
|
68
75
|
return (
|
|
69
76
|
<Layer className={`${styles.cardWithChildren} ${styles.container}`}>
|
|
70
77
|
<Tile className={styles.tileContainer}>
|
|
71
|
-
<
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
<Tag type="cool-gray" className={styles.bedNumberTag}>
|
|
81
|
-
{t('awaiting', 'Awaiting')}
|
|
82
|
-
</Tag>
|
|
83
|
-
)
|
|
84
|
-
)}
|
|
85
|
-
{isDischarged && (
|
|
86
|
-
<Tag type="blue" className={styles.statusTag}>
|
|
87
|
-
{t('discharged', 'Discharged')}
|
|
88
|
-
</Tag>
|
|
89
|
-
)}
|
|
90
|
-
<TagIcon className={styles.tagIcon} />
|
|
91
|
-
</div>
|
|
92
|
-
</div>
|
|
93
|
-
<div>
|
|
94
|
-
{bedType ? <Tag type="green">{startCase(bedType)}</Tag> : null}
|
|
95
|
-
<OverflowMenu flipped>
|
|
96
|
-
{onAdmit && <OverflowMenuItem onClick={onAdmit} itemText={t('admit', 'Admit')} />}
|
|
97
|
-
{onViewDetails && (
|
|
98
|
-
<OverflowMenuItem onClick={onViewDetails} itemText={t('viewDetails', 'View details')} />
|
|
99
|
-
)}
|
|
100
|
-
{isDischarged && (
|
|
101
|
-
<ExtensionSlot
|
|
102
|
-
name="print-post-mortem-overflow-menu-item-slot"
|
|
103
|
-
state={{
|
|
104
|
-
patientUuid: patientUuid,
|
|
105
|
-
}}
|
|
106
|
-
/>
|
|
107
|
-
)}
|
|
108
|
-
{onDischarge && <OverflowMenuItem onClick={onDischarge} itemText={t('discharge', 'Discharge')} />}
|
|
109
|
-
{onSwapCompartment && (
|
|
110
|
-
<OverflowMenuItem onClick={onSwapCompartment} itemText={t('swapCompartment', 'Swap Compartment')} />
|
|
111
|
-
)}
|
|
112
|
-
{onDispose && <OverflowMenuItem onClick={onDispose} itemText={t('dispose', 'Dispose')} />}
|
|
113
|
-
{onPrintGatePass && (
|
|
114
|
-
<OverflowMenuItem onClick={onPrintGatePass} itemText={t('printGatePass', 'Gate Pass')} />
|
|
115
|
-
)}
|
|
116
|
-
</OverflowMenu>
|
|
117
|
-
</div>
|
|
118
|
-
</div>
|
|
119
|
-
|
|
120
|
-
<div className={styles.patientInfoRow}>
|
|
121
|
-
<span className={styles.patientName}>{capitalize(patientName)}</span>
|
|
122
|
-
<span className={styles.middot}>•</span>
|
|
123
|
-
<span className={styles.gender}>{gender}</span>
|
|
124
|
-
<span className={styles.middot}>•</span>
|
|
125
|
-
<span className={styles.age}>{age}</span>
|
|
126
|
-
<span className={styles.ageUnit}>{t('yearsOld', 'Yrs old')}</span>
|
|
127
|
-
</div>
|
|
128
|
-
|
|
129
|
-
<div className={styles.causeOfDeathRow}>
|
|
130
|
-
<span className={styles.causeLabel}>{t('causeOfDeath', 'Cause of death')}</span>
|
|
131
|
-
<span className={styles.causeValue}>{startCase(causeOfDeath)}</span>
|
|
132
|
-
</div>
|
|
133
|
-
<div className={styles.patientInfoRow}>
|
|
134
|
-
<span className={styles.causeLabel}>{t('dateOfDeath', 'Date of death')}</span>
|
|
135
|
-
<span className={styles.causeValue}>{formatDateTime(dateOfDeath)}</span>
|
|
136
|
-
</div>
|
|
137
|
-
{isAdmitted && (
|
|
138
|
-
<div className={styles.patientInfoRow}>
|
|
139
|
-
<span className={styles.causeLabel}>{t('admissionDate', 'Admission Date')}</span>
|
|
140
|
-
<span className={styles.causeValue}>
|
|
141
|
-
{activeVisit?.startDatetime ? formatDateTime(activeVisit.startDatetime) : '-'}
|
|
142
|
-
</span>
|
|
143
|
-
</div>
|
|
144
|
-
)}
|
|
145
|
-
<div className={styles.borderLine}></div>
|
|
146
|
-
<div className={styles.cardRow}>
|
|
147
|
-
<span className={styles.causeLabel}>
|
|
148
|
-
{isAdmitted ? t('timeSpent', 'Time spent') : t('daysInMortuary', 'Days in mortuary')}
|
|
149
|
-
</span>
|
|
150
|
-
<div className={styles.tagsContainer}>
|
|
151
|
-
<Tag size="md" type={timeSpentTagType}>
|
|
152
|
-
<span className={styles.causeLabel}>{lengthOfStay}</span>{' '}
|
|
153
|
-
{lengthOfStay === 1 ? t('day', 'Day') : t('days', 'Days')}
|
|
154
|
-
</Tag>
|
|
155
|
-
{isAdmitted && !isDischarged && <Tag type="green">{t('admitted', 'Admitted')}</Tag>}
|
|
156
|
-
</div>
|
|
157
|
-
</div>
|
|
78
|
+
<DeceasedPatientCardHeader patient={patient} showActions={showActions} onAction={handleAction} />
|
|
79
|
+
<DeceasedPatientInfo patient={patient} />
|
|
80
|
+
<DeceasedPatientStatusFooter
|
|
81
|
+
patient={patient}
|
|
82
|
+
isAdmitted={isAdmitted}
|
|
83
|
+
lengthOfStay={lengthOfStay}
|
|
84
|
+
timeSpentTagType={timeSpentTagType}
|
|
85
|
+
activeVisit={activeVisit}
|
|
86
|
+
/>
|
|
158
87
|
</Tile>
|
|
159
88
|
</Layer>
|
|
160
89
|
);
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Tag, OverflowMenu, OverflowMenuItem } from '@carbon/react';
|
|
3
|
+
import startCase from 'lodash-es/startCase';
|
|
4
|
+
import { useTranslation } from 'react-i18next';
|
|
5
|
+
import { type EnhancedPatient, PatientCardProps } from '../../types';
|
|
6
|
+
import { ExtensionSlot } from '@openmrs/esm-framework';
|
|
7
|
+
import styles from '../bed.scss';
|
|
8
|
+
import { Tag as TagIcon } from '@carbon/react/icons';
|
|
9
|
+
|
|
10
|
+
interface PatientCardHeaderProps {
|
|
11
|
+
patient: EnhancedPatient;
|
|
12
|
+
showActions: PatientCardProps['showActions'];
|
|
13
|
+
onAction: (actionType: string) => void;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const DeceasedPatientCardHeader: React.FC<PatientCardHeaderProps> = ({ patient, showActions, onAction }) => {
|
|
17
|
+
const { t } = useTranslation();
|
|
18
|
+
|
|
19
|
+
return (
|
|
20
|
+
<div className={styles.tileHeader}>
|
|
21
|
+
<div className={styles.tagContainer}>
|
|
22
|
+
{patient.bedInfo?.bedNumber ? (
|
|
23
|
+
<Tag type="cool-gray" className={styles.bedNumberTag}>
|
|
24
|
+
{patient.bedInfo.bedNumber}
|
|
25
|
+
</Tag>
|
|
26
|
+
) : (
|
|
27
|
+
!patient.isDischarged && (
|
|
28
|
+
<Tag type="cool-gray" className={styles.bedNumberTag}>
|
|
29
|
+
{t('awaiting', 'Awaiting')}
|
|
30
|
+
</Tag>
|
|
31
|
+
)
|
|
32
|
+
)}
|
|
33
|
+
{patient.isDischarged && (
|
|
34
|
+
<Tag type="blue" className={styles.statusTag}>
|
|
35
|
+
{t('discharged', 'Discharged')}
|
|
36
|
+
</Tag>
|
|
37
|
+
)}
|
|
38
|
+
<TagIcon className={styles.tagIcon} />
|
|
39
|
+
</div>
|
|
40
|
+
|
|
41
|
+
<div>
|
|
42
|
+
{patient.bedInfo?.bedType && <Tag type="green">{startCase(patient.bedInfo.bedType)}</Tag>}
|
|
43
|
+
|
|
44
|
+
<OverflowMenu flipped>
|
|
45
|
+
{showActions.admit && <OverflowMenuItem onClick={() => onAction('admit')} itemText={t('admit', 'Admit')} />}
|
|
46
|
+
{showActions.viewDetails && (
|
|
47
|
+
<OverflowMenuItem onClick={() => onAction('viewDetails')} itemText={t('viewDetails', 'View details')} />
|
|
48
|
+
)}
|
|
49
|
+
{patient.isDischarged && (
|
|
50
|
+
<ExtensionSlot name="print-post-mortem-overflow-menu-item-slot" state={{ patientUuid: patient.uuid }} />
|
|
51
|
+
)}
|
|
52
|
+
{showActions.discharge && (
|
|
53
|
+
<OverflowMenuItem onClick={() => onAction('discharge')} itemText={t('discharge', 'Discharge')} />
|
|
54
|
+
)}
|
|
55
|
+
{showActions.swapCompartment && (
|
|
56
|
+
<OverflowMenuItem
|
|
57
|
+
onClick={() => onAction('swapCompartment')}
|
|
58
|
+
itemText={t('swapCompartment', 'Swap Compartment')}
|
|
59
|
+
/>
|
|
60
|
+
)}
|
|
61
|
+
{showActions.postmortem && (
|
|
62
|
+
<OverflowMenuItem onClick={() => onAction('postmortem')} itemText={t('postmortem', 'Postmortem')} />
|
|
63
|
+
)}
|
|
64
|
+
{showActions.printGatePass && (
|
|
65
|
+
<OverflowMenuItem onClick={() => onAction('printGatePass')} itemText={t('printGatePass', 'Gate Pass')} />
|
|
66
|
+
)}
|
|
67
|
+
</OverflowMenu>
|
|
68
|
+
</div>
|
|
69
|
+
</div>
|
|
70
|
+
);
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
export default DeceasedPatientCardHeader;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { useTranslation } from 'react-i18next';
|
|
3
|
+
import { type EnhancedPatient } from '../../types';
|
|
4
|
+
import capitalize from 'lodash-es/capitalize';
|
|
5
|
+
import startCase from 'lodash-es/startCase';
|
|
6
|
+
import { formatDateTime } from '../../utils/utils';
|
|
7
|
+
import styles from '../bed.scss';
|
|
8
|
+
|
|
9
|
+
interface PatientInfoProps {
|
|
10
|
+
patient: EnhancedPatient;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const DeceasedPatientInfo: React.FC<PatientInfoProps> = ({ patient }) => {
|
|
14
|
+
const { t } = useTranslation();
|
|
15
|
+
|
|
16
|
+
return (
|
|
17
|
+
<>
|
|
18
|
+
<div className={styles.patientInfoRow}>
|
|
19
|
+
<span className={styles.patientName}>{capitalize(patient.person.display)}</span>
|
|
20
|
+
<span className={styles.middot}>•</span>
|
|
21
|
+
<span className={styles.gender}>{patient.person.gender}</span>
|
|
22
|
+
<span className={styles.middot}>•</span>
|
|
23
|
+
<span className={styles.age}>{patient.person.age}</span>
|
|
24
|
+
<span className={styles.ageUnit}>{t('yearsOld', 'Yrs old')}</span>
|
|
25
|
+
</div>
|
|
26
|
+
|
|
27
|
+
<div className={styles.causeOfDeathRow}>
|
|
28
|
+
<span className={styles.causeLabel}>{t('causeOfDeath', 'Cause of death')}</span>
|
|
29
|
+
<span className={styles.causeValue}>{startCase(patient.person.causeOfDeath?.display || '')}</span>
|
|
30
|
+
</div>
|
|
31
|
+
|
|
32
|
+
<div className={styles.patientInfoRow}>
|
|
33
|
+
<span className={styles.causeLabel}>{t('dateOfDeath', 'Date of death')}</span>
|
|
34
|
+
<span className={styles.causeValue}>{formatDateTime(patient.person.deathDate)}</span>
|
|
35
|
+
</div>
|
|
36
|
+
|
|
37
|
+
{patient.visitInfo?.admissionDate && (
|
|
38
|
+
<div className={styles.patientInfoRow}>
|
|
39
|
+
<span className={styles.causeLabel}>{t('admissionDate', 'Admission Date')}</span>
|
|
40
|
+
<span className={styles.causeValue}>{formatDateTime(patient.visitInfo.admissionDate)}</span>
|
|
41
|
+
</div>
|
|
42
|
+
)}
|
|
43
|
+
</>
|
|
44
|
+
);
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
export default DeceasedPatientInfo;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Tag } from '@carbon/react';
|
|
3
|
+
import styles from '../bed.scss';
|
|
4
|
+
import { useTranslation } from 'react-i18next';
|
|
5
|
+
import { type EnhancedPatient } from '../../types';
|
|
6
|
+
import { type Visit } from '@openmrs/esm-framework/src';
|
|
7
|
+
interface PatientStatusFooterProps {
|
|
8
|
+
patient: EnhancedPatient;
|
|
9
|
+
isAdmitted: boolean;
|
|
10
|
+
lengthOfStay: number;
|
|
11
|
+
timeSpentTagType: 'red' | 'magenta' | 'green';
|
|
12
|
+
activeVisit: Visit;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const DeceasedPatientStatusFooter: React.FC<PatientStatusFooterProps> = ({
|
|
16
|
+
patient,
|
|
17
|
+
isAdmitted,
|
|
18
|
+
lengthOfStay,
|
|
19
|
+
timeSpentTagType,
|
|
20
|
+
activeVisit,
|
|
21
|
+
}) => {
|
|
22
|
+
const { t } = useTranslation();
|
|
23
|
+
|
|
24
|
+
return (
|
|
25
|
+
<>
|
|
26
|
+
<div className={styles.borderLine}></div>
|
|
27
|
+
<div className={styles.cardRow}>
|
|
28
|
+
<span className={styles.causeLabel}>
|
|
29
|
+
{isAdmitted ? t('timeSpent', 'Time spent') : t('daysInMortuary', 'Days in mortuary')}
|
|
30
|
+
</span>
|
|
31
|
+
<div className={styles.tagsContainer}>
|
|
32
|
+
<Tag size="md" type={timeSpentTagType}>
|
|
33
|
+
<span className={styles.causeLabel}>{lengthOfStay}</span>{' '}
|
|
34
|
+
{lengthOfStay === 1 ? t('day', 'Day') : t('days', 'Days')}
|
|
35
|
+
</Tag>
|
|
36
|
+
{isAdmitted && !patient.isDischarged && <Tag type="green">{t('admitted', 'Admitted')}</Tag>}
|
|
37
|
+
</div>
|
|
38
|
+
</div>
|
|
39
|
+
</>
|
|
40
|
+
);
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
export default DeceasedPatientStatusFooter;
|