Skip to content

Commit

Permalink
feat/adding a lab request
Browse files Browse the repository at this point in the history
  • Loading branch information
Mwanje committed Sep 21, 2023
1 parent 1563b5e commit e15eb93
Show file tree
Hide file tree
Showing 2 changed files with 72 additions and 6 deletions.
4 changes: 4 additions & 0 deletions src/constants.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export const moduleName = '@ugandaemr/openmrs-esm-laboratory-app';

Check failure on line 1 in src/constants.ts

View workflow job for this annotation

GitHub Actions / build

Replace `'@ugandaemr/openmrs-esm-laboratory-app'` with `"@ugandaemr/openmrs-esm-laboratory-app"`

export const LABORATARORY_ENCOUNTER_TYPE = 'cbf01392-ca29-11e9-a32f-2a2ae2dbcce4';

Check failure on line 3 in src/constants.ts

View workflow job for this annotation

GitHub Actions / build

Replace `·'cbf01392-ca29-11e9-a32f-2a2ae2dbcce4'` with `⏎··"cbf01392-ca29-11e9-a32f-2a2ae2dbcce4"`
export const TEST_ORDER_ENCOUNTER_TYPE = 'dca07f4a-30ab-102d-86b0-7a5022ba4115';

Check failure on line 4 in src/constants.ts

View workflow job for this annotation

GitHub Actions / build

Replace `'dca07f4a-30ab-102d-86b0-7a5022ba4115';` with `"dca07f4a-30ab-102d-86b0-7a5022ba4115";⏎`
74 changes: 68 additions & 6 deletions src/patient-chart/laboratory-order.component.tsx
Original file line number Diff line number Diff line change
@@ -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";

Check failure on line 3 in src/patient-chart/laboratory-order.component.tsx

View workflow job for this annotation

GitHub Actions / build

Replace `·EncounterList,·EncounterListColumn,·getObsFromEncounter·` with `⏎··EncounterList,⏎··EncounterListColumn,⏎··getObsFromEncounter,⏎`
import moment from "moment";
import { moduleName, LABORATARORY_ENCOUNTER_TYPE, TEST_ORDER_ENCOUNTER_TYPE } from "../constants";

Check failure on line 5 in src/patient-chart/laboratory-order.component.tsx

View workflow job for this annotation

GitHub Actions / build

Replace `·moduleName,·LABORATARORY_ENCOUNTER_TYPE,·TEST_ORDER_ENCOUNTER_TYPE·}·from·"../constants";⏎·` with `⏎··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<LaboratoryOrderOverviewProps> = ({ patientUuid }) => {

Check failure on line 12 in src/patient-chart/laboratory-order.component.tsx

View workflow job for this annotation

GitHub Actions / build

Replace `·patientUuid·` with `⏎··patientUuid,⏎`
const { t } = useTranslation();

Check failure on line 13 in src/patient-chart/laboratory-order.component.tsx

View workflow job for this annotation

GitHub Actions / build

Delete `··`

Check failure on line 14 in src/patient-chart/laboratory-order.component.tsx

View workflow job for this annotation

GitHub Actions / build

Delete `·`
const columnsLab: EncounterListColumn[] = useMemo(
() => [
{
key: 'encounterDate',

Check failure on line 18 in src/patient-chart/laboratory-order.component.tsx

View workflow job for this annotation

GitHub Actions / build

Replace `'encounterDate'` with `"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 (
<EmptyStateComingSoon headerTitle={headerTitle} displayText={headerTitle} />
<EncounterList
patientUuid={patientUuid}
encounterType={LABORATARORY_ENCOUNTER_TYPE}
formList={[{ name: 'HMIS LAB 001:General Laboratory Test Request Form' }]}
columns={columnsLab}
description={headerTitle}
headerTitle={headerTitle}
launchOptions={{
displayText: 'Add',
moduleName: moduleName,
}}
/>
);
};

Expand Down

0 comments on commit e15eb93

Please sign in to comment.