@ampath/esm-dha-workflow-app 4.0.0-next.15 → 4.0.0-next.16
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/dist/178.js +1 -0
- package/dist/178.js.map +1 -0
- package/dist/306.js +1 -1
- package/dist/635.js +1 -1
- package/dist/695.js +1 -1
- package/dist/695.js.map +1 -1
- package/dist/710.js +1 -1
- package/dist/875.js +2 -0
- package/dist/875.js.map +1 -0
- package/dist/91.js +1 -1
- package/dist/91.js.map +1 -1
- package/dist/93.js +1 -1
- package/dist/esm-dha-workflow-app.js +1 -1
- package/dist/esm-dha-workflow-app.js.buildmanifest.json +66 -66
- package/dist/main.js +1 -1
- package/dist/main.js.map +1 -1
- package/dist/routes.json +1 -1
- package/package.json +1 -1
- package/src/index.ts +9 -9
- package/src/root.component.tsx +2 -1
- package/src/triage/room/room.component.tsx +39 -0
- package/src/triage/room/room.scss +29 -0
- package/src/triage/triage.component.tsx +36 -0
- package/src/triage/triage.module.scss +19 -0
- package/src/triage/triage.resource.ts +19 -0
- package/src/triage/types.ts +22 -0
- package/dist/388.js +0 -2
- package/dist/388.js.map +0 -1
- package/dist/460.js +0 -1
- package/dist/460.js.map +0 -1
- /package/dist/{388.js.LICENSE.txt → 875.js.LICENSE.txt} +0 -0
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { useSession } from '@openmrs/esm-framework';
|
|
3
|
+
|
|
4
|
+
import { Tile } from '@carbon/react';
|
|
5
|
+
import Room from './room/room.component';
|
|
6
|
+
import styles from './triage.module.scss';
|
|
7
|
+
import useTriagePatients from './triage.resource';
|
|
8
|
+
|
|
9
|
+
interface TriageProps {}
|
|
10
|
+
const Triage: React.FC<TriageProps> = () => {
|
|
11
|
+
const session = useSession();
|
|
12
|
+
|
|
13
|
+
const locationUuid = session.sessionLocation.uuid;
|
|
14
|
+
const { patients, isLoading, isError } = useTriagePatients(locationUuid);
|
|
15
|
+
|
|
16
|
+
if (isLoading) return <p>Loading...</p>;
|
|
17
|
+
if (isError) return <p>Error loading patients</p>;
|
|
18
|
+
return (
|
|
19
|
+
<>
|
|
20
|
+
<div className={styles.container}>
|
|
21
|
+
<Tile className={styles.card}>
|
|
22
|
+
<h4 className={styles.title}>Patients in waiting</h4>
|
|
23
|
+
<h3>{patients.length}</h3>
|
|
24
|
+
</Tile>
|
|
25
|
+
<Tile className={styles.card}>
|
|
26
|
+
<h4>Patients attended to</h4>
|
|
27
|
+
</Tile>
|
|
28
|
+
</div>
|
|
29
|
+
<div style={{ display: 'flex' }}>
|
|
30
|
+
<Room name="Triage 1" patients={patients} />
|
|
31
|
+
<Room name="Triage 2" patients={patients} />
|
|
32
|
+
</div>
|
|
33
|
+
</>
|
|
34
|
+
);
|
|
35
|
+
};
|
|
36
|
+
export default Triage;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
.container {
|
|
4
|
+
display: inline-flex;
|
|
5
|
+
align-items: center;
|
|
6
|
+
margin-bottom: 1rem;
|
|
7
|
+
border: 1px solid #9e9e9e;
|
|
8
|
+
padding: 1rem;
|
|
9
|
+
margin: 1rem;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
.card {
|
|
15
|
+
width: 18rem;
|
|
16
|
+
border: 1px solid #b0b0b0;
|
|
17
|
+
padding: 1rem;
|
|
18
|
+
margin: 1rem;
|
|
19
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import useSWR from 'swr';
|
|
2
|
+
import { openmrsFetch } from '@openmrs/esm-framework';
|
|
3
|
+
|
|
4
|
+
import { type Patient } from './types';
|
|
5
|
+
export default function useTriagePatients(locationUuid: string) {
|
|
6
|
+
const { data, error, isLoading } = useSWR(
|
|
7
|
+
`https://staging.ampath.or.ke/openmrs/ws/rest/v1/queue-entry?v=custom:(uuid,display,queue:(display,uuid,location:(display,uuid)),status:(display),patient:(uuid,person:(gender,age)))&totalCount=true&isEnded=false&location=${locationUuid}`,
|
|
8
|
+
(url: string) =>
|
|
9
|
+
openmrsFetch<{
|
|
10
|
+
results: Array<Patient>;
|
|
11
|
+
}>(url).then((res) => res.data.results),
|
|
12
|
+
);
|
|
13
|
+
|
|
14
|
+
return {
|
|
15
|
+
patients: data,
|
|
16
|
+
isLoading,
|
|
17
|
+
isError: error,
|
|
18
|
+
};
|
|
19
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export interface Patient {
|
|
2
|
+
uuid: string;
|
|
3
|
+
display: string;
|
|
4
|
+
queue: {
|
|
5
|
+
display: string;
|
|
6
|
+
uuid: string;
|
|
7
|
+
location: {
|
|
8
|
+
display: string;
|
|
9
|
+
uuid: string;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
status: {
|
|
13
|
+
display: string;
|
|
14
|
+
};
|
|
15
|
+
patient: {
|
|
16
|
+
uuid: string;
|
|
17
|
+
person: {
|
|
18
|
+
gender: string;
|
|
19
|
+
age: number;
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
}
|