diff --git a/src/constants.ts b/src/constants.ts new file mode 100644 index 00000000..9f06dbd6 --- /dev/null +++ b/src/constants.ts @@ -0,0 +1,4 @@ +export const moduleName = '@ugandaemr/openmrs-esm-laboratory-app'; + +export const LABORATARORY_ENCOUNTER_TYPE = 'cbf01392-ca29-11e9-a32f-2a2ae2dbcce4'; +export const TEST_ORDER_ENCOUNTER_TYPE = 'dca07f4a-30ab-102d-86b0-7a5022ba4115'; \ No newline at end of file diff --git a/src/patient-chart/laboratory-order.component.tsx b/src/patient-chart/laboratory-order.component.tsx index ee7d0aab..973891fb 100644 --- a/src/patient-chart/laboratory-order.component.tsx +++ b/src/patient-chart/laboratory-order.component.tsx @@ -1,13 +1,75 @@ -import React from "react"; +import React, { useMemo } from "react"; import { useTranslation } from "react-i18next"; -import { EmptyStateComingSoon } from "@ohri/openmrs-esm-ohri-commons-lib"; +import { EncounterList, EncounterListColumn, getObsFromEncounter } from "@ohri/openmrs-esm-ohri-commons-lib"; +import moment from "moment"; +import { moduleName, LABORATARORY_ENCOUNTER_TYPE, TEST_ORDER_ENCOUNTER_TYPE } from "../constants"; + -const LaboratoryOrder: React.FC = () => { - const { t } = useTranslation(); - const headerTitle = t("laboratory", "Laboratory"); +interface LaboratoryOrderOverviewProps { + patientUuid: string; +} + +const LaboratoryOrder: React.FC = ({ patientUuid }) => { + const { t } = useTranslation(); + + const columnsLab: EncounterListColumn[] = useMemo( + () => [ + { + key: 'encounterDate', + header: t('encounterDate', 'Encounter Date'), + getValue: (encounter) => { + return moment(encounter.encounterDatetime).format('DD-MMM-YYYY'); + }, + }, + { + key: 'testOrders', + header: t('deliveryType', 'Test Order(s)'), + getValue: (encounter) => { + return getObsFromEncounter(encounter, TEST_ORDER_ENCOUNTER_TYPE); + }, + }, + + { + key: 'actions', + header: t('actions', 'Actions'), + getValue: (encounter) => { + const baseActions = [ + { + form: { name: 'HMIS LAB 001:General Laboratory Test Request Form'}, + encounterUuid: encounter.uuid, + intent: '*', + label: 'View Details', + mode: 'view', + }, + { + form: { name: 'HMIS LAB 001:General Laboratory Test Request Form' }, + encounterUuid: encounter.uuid, + intent: '*', + label: 'Edit Form', + mode: 'edit', + }, + ]; + return baseActions; + }, + }, + ], + [t], + ); + const headerTitle = t('Laboratory'); return ( - + ); };