@kenyaemr/esm-morgue-app 5.3.10-pre.1702 → 5.3.10-pre.1703

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.
@@ -16,13 +16,10 @@ interface AvailableCompartmentProps {
16
16
  }
17
17
 
18
18
  const AvailableCompartment: React.FC<AvailableCompartmentProps> = ({ patientInfo, index }) => {
19
+ const patientUuid = patientInfo?.patient?.uuid;
19
20
  const { t } = useTranslation();
20
- const { isLoading, error, person } = usePerson(patientInfo.uuid);
21
- const {
22
- data: activeDeceased,
23
- error: isActiveError,
24
- isLoading: isActiveLoading,
25
- } = useActiveMorgueVisit(patientInfo?.uuid);
21
+ const { isLoading, error, person } = usePerson(patientInfo?.person?.uuid);
22
+ const { data: activeDeceased, error: isActiveError, isLoading: isActiveLoading } = useActiveMorgueVisit(patientUuid);
26
23
 
27
24
  const startVisitDate = activeDeceased?.[0]?.startDatetime;
28
25
 
@@ -72,7 +69,7 @@ const AvailableCompartment: React.FC<AvailableCompartmentProps> = ({ patientInfo
72
69
  <span className={styles.viewDetails}>
73
70
  <ConfigurableLink
74
71
  className={styles.viewDetailsLink}
75
- to={`\${openmrsSpaBase}/patient/${patientInfo.uuid}/chart/deceased-panel`}>
72
+ to={`\${openmrsSpaBase}/patient/${patientUuid}/chart/deceased-panel`}>
76
73
  <View size={20} />
77
74
  </ConfigurableLink>
78
75
  </span>
@@ -21,7 +21,7 @@ export const configSchema = {
21
21
  morgueDepartmentServiceTypeUuid: {
22
22
  _type: Type.String,
23
23
  _description: ' UUID for morgue department service type',
24
- _default: 'd7bd4cc0-90b1-4f22-90f2-ab7fde936727',
24
+ _default: '030bb7ab-9aea-454a-aa17-96abf17727c7',
25
25
  },
26
26
  insurancepaymentModeUuid: {
27
27
  _type: Type.String,
@@ -71,7 +71,7 @@ export const configSchema = {
71
71
  policeIDNumber: {
72
72
  _type: Type.String,
73
73
  _description: 'UUID for police id number concept',
74
- _default: '8d488d02-d1d8-41a5-8219-61f4fc5dbeb0',
74
+ _default: '163084AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA',
75
75
  },
76
76
  encounterProviderRoleUuid: {
77
77
  _type: Type.UUID,
@@ -81,7 +81,7 @@ export const configSchema = {
81
81
  dischargeAreaUuid: {
82
82
  _type: Type.String,
83
83
  _description: 'UUID for discharge area concept',
84
- _default: '89ebccf1-4cca-4195-aeff-3e75fdf976b4',
84
+ _default: '734f9526-84db-4002-9d98-58da580e501f',
85
85
  },
86
86
  adminUuid: {
87
87
  _type: Type.String,
@@ -84,12 +84,17 @@ export const useDeceasedPatient = (searchTerm?: string) => {
84
84
  try {
85
85
  setIsLoadingStatus(true);
86
86
  const status = await Promise.all(
87
- paginatedData?.map((data) => {
88
- return getMorguePatientStatus(data?.uuid, morgueVisitTypeUuid, morgueDischargeEncounterTypeUuid);
89
- }),
87
+ paginatedData.map((data) =>
88
+ getMorguePatientStatus(data.person?.uuid, morgueVisitTypeUuid, morgueDischargeEncounterTypeUuid),
89
+ ),
90
90
  );
91
91
 
92
- setDeceasedPatient(paginatedData?.map((patient, index) => ({ ...patient, status: status[index] })));
92
+ setDeceasedPatient(
93
+ paginatedData.map((patient, index) => ({
94
+ ...patient,
95
+ status: status[index],
96
+ })),
97
+ );
93
98
  } catch (error) {
94
99
  setStatusError(error);
95
100
  } finally {
@@ -51,23 +51,31 @@ export const DischargedBodies: React.FC<DischargedProps> = ({ isLoading, decease
51
51
 
52
52
  const dischargedDeceased = deceasedPatients?.filter((patient) => patient?.status === 'discharged') || [];
53
53
 
54
- const rows = dischargedDeceased.map((patient) => ({
55
- id: patient.uuid,
56
- name: (
57
- <ConfigurableLink
58
- style={{ textDecoration: 'none', maxWidth: '50%' }}
59
- to={patientChartUrl}
60
- templateParams={{ patientUuid: patient?.person?.uuid }}>
61
- {patient.person.display?.toUpperCase()}
62
- </ConfigurableLink>
63
- ),
64
- gender: patient.person.gender,
65
- age: patient?.person?.age,
66
- identifier: patient?.identifiers[0]?.identifier,
67
- deathDate: new Date(patient.person.deathDate).toLocaleString(),
68
- causeOfDeath: patient.person.causeOfDeath?.display,
69
- status: <Tag type="magenta">{patient.status}</Tag>,
70
- }));
54
+ const rows = dischargedDeceased.map((patient, index) => {
55
+ const openMrsId =
56
+ patient?.patient?.identifiers
57
+ ?.find((id) => id.display.startsWith('OpenMRS ID'))
58
+ ?.display.split('=')[1]
59
+ ?.trim() || '--';
60
+
61
+ return {
62
+ id: `${patient?.patient?.uuid}`,
63
+ name: (
64
+ <ConfigurableLink
65
+ style={{ textDecoration: 'none', maxWidth: '50%' }}
66
+ to={patientChartUrl}
67
+ templateParams={{ patientUuid: patient?.person?.uuid }}>
68
+ {patient?.person?.person?.display?.toUpperCase()}
69
+ </ConfigurableLink>
70
+ ),
71
+ gender: patient?.person?.person?.gender || '--',
72
+ age: patient?.person?.person?.age || '--',
73
+ identifier: openMrsId,
74
+ deathDate: formatDateTime(patient?.person?.person?.deathDate) || '--',
75
+ causeOfDeath: patient?.person?.person?.causeOfDeath?.display || '--',
76
+ status: <Tag type="magenta">{patient?.status || '--'}</Tag>,
77
+ };
78
+ });
71
79
 
72
80
  return <GenericTable rows={rows} headers={genericTableHeader} title={dischargedInLine} />;
73
81
  };
@@ -50,16 +50,24 @@ export const WaitingQueue: React.FC<WaitingQueueProps> = ({ isLoading, deceasedP
50
50
 
51
51
  const awaitingPatients = deceasedPatients?.filter((patient) => patient?.status === 'awaiting') || [];
52
52
 
53
- const rows = awaitingPatients.map((patient) => ({
54
- id: patient.uuid,
55
- name: patient.person.display?.toUpperCase(),
56
- gender: patient.person.gender,
57
- age: patient?.person?.age,
58
- identifier: patient?.identifiers[0]?.identifier,
59
- deathDate: patient.person.deathDate ? new Date(patient.person.deathDate).toLocaleString() : t('nullDate', '--'),
60
- causeOfDeath: patient.person.causeOfDeath?.display,
61
- status: <Tag type="magenta">{patient.status}</Tag>,
62
- }));
53
+ const rows = awaitingPatients.map((patient, index) => {
54
+ const openMrsId =
55
+ patient?.patient?.identifiers
56
+ ?.find((id) => id.display.startsWith('OpenMRS ID'))
57
+ ?.display.split('=')[1]
58
+ ?.trim() || t('missingIdentifier', '--');
59
+
60
+ return {
61
+ id: `${patient?.patient?.uuid}`,
62
+ name: toUpperCase(patient?.person?.person?.display || '--'),
63
+ gender: patient?.person?.person?.gender || '--',
64
+ age: patient?.person?.person?.age || '--',
65
+ identifier: openMrsId,
66
+ deathDate: formatDateTime(patient?.person?.person?.deathDate) || '--',
67
+ causeOfDeath: patient?.person?.person?.causeOfDeath?.display || '--',
68
+ status: <Tag type="magenta">{patient?.status || '--'}</Tag>,
69
+ };
70
+ });
63
71
 
64
72
  const handleAdmissionForm = (patientUuid: string) => {
65
73
  launchWorkspace('patient-additional-info-form', {
@@ -68,11 +76,16 @@ export const WaitingQueue: React.FC<WaitingQueueProps> = ({ isLoading, deceasedP
68
76
  });
69
77
  };
70
78
 
71
- const actionColumn = (row) => (
72
- <OverflowMenu size="sm" flipped>
73
- <OverflowMenuItem itemText={t('admit', 'Admit')} onClick={() => handleAdmissionForm(row.id)} />
74
- </OverflowMenu>
75
- );
79
+ const actionColumn = (row) => {
80
+ return (
81
+ <OverflowMenu size="sm" flipped>
82
+ <OverflowMenuItem
83
+ itemText={t('admitToMorgue', 'Admit to morgue')}
84
+ onClick={() => handleAdmissionForm(row.id)}
85
+ />
86
+ </OverflowMenu>
87
+ );
88
+ };
76
89
 
77
90
  return <GenericTable rows={rows} headers={genericTableHeader} actionColumn={actionColumn} title={waitingInLine} />;
78
91
  };
@@ -41,6 +41,10 @@ export interface DeceasedInfo {
41
41
  uuid: string;
42
42
  status?: string;
43
43
  display: string;
44
+ patient: {
45
+ uuid: string;
46
+ display: string;
47
+ };
44
48
  identifiers: Array<{
45
49
  identifier: string;
46
50
  uuid: string;
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "admissionForm": "Admission form",
3
- "admit": "Admit",
4
- "admitted": "Admitted Bodies",
3
+ "admitted": "Admitted",
4
+ "admitToMorgue": "Admit to morgue",
5
5
  "allocation": "Allocation",
6
6
  "allocations": "Allocation",
7
7
  "causeOfDeath": "Cause of death: ",
@@ -9,13 +9,13 @@
9
9
  "discharged": "Discharged",
10
10
  "empty": "Empty",
11
11
  "errorMessage": "Error",
12
+ "missingIdentifier": "--",
12
13
  "mortuary": "Mortuary",
13
14
  "mortuaryManagement": "Mortuary management",
14
15
  "noAdmittedBodies": "There are no admitted bodies",
15
16
  "noDeceasedPersons": "There are no deceased persons on the waiting list",
16
17
  "noResultFound": "Sorry, no results found",
17
18
  "noWaitingList": "Waiting List",
18
- "nullDate": "--",
19
19
  "pullingCompartment": "Pulling compartments data.....",
20
20
  "searchForADeceased": "Try to search again using the deceased patient's unique ID number",
21
21
  "waitingInLine": "Waiting In Line",