@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.
Files changed (116) hide show
  1. package/.turbo/turbo-build.log +20 -25
  2. package/dist/1.js +2 -0
  3. package/dist/1.js.map +1 -0
  4. package/dist/197.js +2 -1
  5. package/dist/197.js.map +1 -0
  6. package/dist/221.js +1 -1
  7. package/dist/221.js.map +1 -1
  8. package/dist/293.js +1 -1
  9. package/dist/294.js +1 -1
  10. package/dist/300.js +1 -1
  11. package/dist/340.js +2 -0
  12. package/dist/340.js.map +1 -0
  13. package/dist/351.js +1 -0
  14. package/dist/351.js.map +1 -0
  15. package/dist/404.js +1 -0
  16. package/dist/404.js.map +1 -0
  17. package/dist/441.js +1 -0
  18. package/dist/441.js.map +1 -0
  19. package/dist/578.js +1 -0
  20. package/dist/608.js +1 -0
  21. package/dist/608.js.map +1 -0
  22. package/dist/611.js +2 -0
  23. package/dist/611.js.map +1 -0
  24. package/dist/632.js +1 -1
  25. package/dist/632.js.map +1 -1
  26. package/dist/653.js +1 -1
  27. package/dist/653.js.map +1 -1
  28. package/dist/758.js +1 -0
  29. package/dist/758.js.map +1 -0
  30. package/dist/805.js +1 -1
  31. package/dist/805.js.map +1 -1
  32. package/dist/814.js +2 -0
  33. package/dist/814.js.LICENSE.txt +5 -0
  34. package/dist/814.js.map +1 -0
  35. package/dist/824.js +1 -1
  36. package/dist/824.js.map +1 -1
  37. package/dist/845.js +1 -0
  38. package/dist/845.js.map +1 -0
  39. package/dist/888.js +1 -0
  40. package/dist/888.js.map +1 -0
  41. package/dist/918.js +1 -1
  42. package/dist/918.js.map +1 -1
  43. package/dist/990.js +1 -0
  44. package/dist/990.js.map +1 -0
  45. package/dist/kenyaemr-esm-morgue-app.js +1 -1
  46. package/dist/kenyaemr-esm-morgue-app.js.buildmanifest.json +250 -203
  47. package/dist/kenyaemr-esm-morgue-app.js.map +1 -1
  48. package/dist/main.js +1 -1
  49. package/dist/main.js.LICENSE.txt +0 -6
  50. package/dist/main.js.map +1 -1
  51. package/dist/routes.json +1 -1
  52. package/package.json +1 -1
  53. package/src/bed/bed.component.tsx +63 -134
  54. package/src/bed/components/deceased-patient-card-header.component.tsx +73 -0
  55. package/src/bed/components/deceased-patient-info.component.tsx +47 -0
  56. package/src/bed/components/deceased-patient-status-footer.component.tsx +43 -0
  57. package/src/bed-layout/admitted/admitted-bed-layout.component.tsx +175 -96
  58. package/src/bed-layout/awaiting/awaiting-bed-layout.component.tsx +103 -36
  59. package/src/bed-layout/bed-layout.scss +4 -0
  60. package/src/bed-layout/discharged/discharged-bed-layout.component.tsx +131 -73
  61. package/src/bed-linelist-view/admitted/admitted-bed-linelist-view.component.tsx +182 -134
  62. package/src/bed-linelist-view/awaiting/awaiting-bed-linelist-view.component.tsx +115 -71
  63. package/src/bed-linelist-view/discharged/discharged-bed-line-view.component.tsx +181 -109
  64. package/src/config-schema.ts +140 -4
  65. package/src/context/deceased-person-context.tsx +33 -0
  66. package/src/extension/actionButton.component.tsx +1 -1
  67. package/src/forms/admit-deceased-person-workspace/admit-deceased-person.resource.ts +84 -166
  68. package/src/forms/admit-deceased-person-workspace/admit-deceased-person.scss +14 -0
  69. package/src/forms/admit-deceased-person-workspace/admit-deceased-person.workspace.tsx +504 -334
  70. package/src/forms/discharge-deceased-person-workspace/discharge-body.resource.ts +0 -1
  71. package/src/forms/discharge-deceased-person-workspace/discharge-body.scss +15 -0
  72. package/src/forms/discharge-deceased-person-workspace/discharge-body.workspace.tsx +303 -244
  73. package/src/helpers/expression-helper.ts +122 -0
  74. package/src/home/home.component.tsx +23 -4
  75. package/src/index.ts +0 -2
  76. package/src/metrics/metrics-card.component.tsx +2 -2
  77. package/src/routes.json +0 -6
  78. package/src/schemas/index.ts +243 -51
  79. package/src/summary/summary.component.tsx +16 -9
  80. package/src/switcher/content-switcher.component.tsx +61 -35
  81. package/src/switcher/content-switcher.scss +13 -0
  82. package/src/types/index.ts +43 -1
  83. package/translations/am.json +16 -6
  84. package/translations/en.json +16 -6
  85. package/translations/sw.json +16 -6
  86. package/dist/373.js +0 -2
  87. package/dist/373.js.map +0 -1
  88. package/dist/398.js +0 -1
  89. package/dist/398.js.map +0 -1
  90. package/dist/410.js +0 -1
  91. package/dist/410.js.map +0 -1
  92. package/dist/429.js +0 -2
  93. package/dist/429.js.map +0 -1
  94. package/dist/467.js +0 -1
  95. package/dist/467.js.map +0 -1
  96. package/dist/579.js +0 -2
  97. package/dist/579.js.map +0 -1
  98. package/dist/619.js +0 -1
  99. package/dist/619.js.map +0 -1
  100. package/dist/633.js +0 -1
  101. package/dist/633.js.map +0 -1
  102. package/dist/712.js +0 -1
  103. package/dist/712.js.map +0 -1
  104. package/dist/713.js +0 -1
  105. package/dist/713.js.map +0 -1
  106. package/dist/723.js +0 -1
  107. package/dist/723.js.map +0 -1
  108. package/dist/989.js +0 -2
  109. package/dist/989.js.map +0 -1
  110. package/src/forms/dispose-deceased-person-workspace/dispose-deceased-person.resource.ts +0 -18
  111. package/src/forms/dispose-deceased-person-workspace/dispose-deceased-person.scss +0 -84
  112. package/src/forms/dispose-deceased-person-workspace/dispose-deceased-person.workspace.tsx +0 -505
  113. /package/dist/{373.js.LICENSE.txt → 1.js.LICENSE.txt} +0 -0
  114. /package/dist/{989.js.LICENSE.txt → 197.js.LICENSE.txt} +0 -0
  115. /package/dist/{579.js.LICENSE.txt → 340.js.LICENSE.txt} +0 -0
  116. /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},{"name":"dispose-deceased-person-form","component":"disposeDeceasedPersonForm","title":"Dispose Deceased Person","type":"other-form"}],"modals":[{"name":"print-confirmation-modal","component":"printConfirmationModal"},{"name":"autopsy-report-modal","component":"autopsyReportModal"}],"pages":[{"component":"root","route":"morgue"}],"version":"5.4.2-pre.2333"}
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,6 +1,6 @@
1
1
  {
2
2
  "name": "@kenyaemr/esm-morgue-app",
3
- "version": "5.4.2-pre.2333",
3
+ "version": "5.4.2-pre.2347",
4
4
  "description": "morgue app for KenyaEMR",
5
5
  "browser": "dist/kenyaemr-esm-morgue-app.js",
6
6
  "main": "src/index.ts",
@@ -1,59 +1,37 @@
1
1
  import React from 'react';
2
- import { Layer, OverflowMenu, OverflowMenuItem, Tag, Tile } from '@carbon/react';
3
- import styles from './bed.scss';
2
+ import { Layer, Tile } from '@carbon/react';
4
3
  import { useTranslation } from 'react-i18next';
5
- import { Tag as TagIcon } from '@carbon/react/icons';
6
- import capitalize from 'lodash-es/capitalize';
7
- import startCase from 'lodash-es/startCase';
8
- import { formatDateTime, convertDateToDays } from '../utils/utils';
9
- import { ExtensionSlot, useVisit } from '@openmrs/esm-framework';
10
-
11
- interface BedProps {
12
- bedNumber?: string;
13
- patientName: string;
14
- gender: string;
15
- age: number;
16
- bedType?: string;
17
- causeOfDeath: string;
18
- dateOfDeath: string;
19
- patientUuid: string;
20
- onAdmit?: () => void;
21
- onPostmortem?: () => void;
22
- onDischarge?: () => void;
23
- onSwapCompartment?: () => void;
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(patientUuid);
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(dateOfDeath);
30
+ : calculateDaysInMortuary(patient.person.deathDate);
54
31
 
55
32
  const isAdmitted = !!activeVisit;
56
- const timeSpentTagType = lengthOfStay > 7 ? 'red' : lengthOfStay > 3 ? 'magenta' : 'green';
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
- <div className={styles.tileHeader}>
72
- <div className={styles.tagContainer}>
73
- <div className={styles.tagContainer}>
74
- {bedNumber ? (
75
- <Tag type="cool-gray" className={styles.bedNumberTag}>
76
- {bedNumber}
77
- </Tag>
78
- ) : (
79
- !isDischarged && (
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;