From 1fea17ff1fca2ec34fac7b6ffa464df3d83c7f94 Mon Sep 17 00:00:00 2001 From: CynthiaKamau Date: Wed, 5 Jun 2024 17:51:58 +0300 Subject: [PATCH] (refactor) OHRI-2222 Implement the Maternal and Child Care package schema workflow --- packages/esm-ohri-pmtct-app/src/index.ts | 2 +- .../child-health/child-health-config.json | 77 ++++++ .../child-health/child-health.component.tsx | 30 ++- .../tabs/infant-postnatal-care.component.tsx | 121 ---------- .../maternal-health-config.json | 221 ++++++++++++++++++ .../maternal-health.component.tsx | 40 ++-- .../tabs/antenatal-care.component.tsx | 115 --------- .../tabs/labour-delivery.component.tsx | 101 -------- .../tabs/postnatal-care.component.tsx | 101 -------- 9 files changed, 341 insertions(+), 467 deletions(-) create mode 100644 packages/esm-ohri-pmtct-app/src/views/child-health/child-health-config.json delete mode 100644 packages/esm-ohri-pmtct-app/src/views/child-health/tabs/infant-postnatal-care.component.tsx create mode 100644 packages/esm-ohri-pmtct-app/src/views/maternal-health/maternal-health-config.json delete mode 100644 packages/esm-ohri-pmtct-app/src/views/maternal-health/tabs/antenatal-care.component.tsx delete mode 100644 packages/esm-ohri-pmtct-app/src/views/maternal-health/tabs/labour-delivery.component.tsx delete mode 100644 packages/esm-ohri-pmtct-app/src/views/maternal-health/tabs/postnatal-care.component.tsx diff --git a/packages/esm-ohri-pmtct-app/src/index.ts b/packages/esm-ohri-pmtct-app/src/index.ts index 0eaf0eea4..b361357df 100644 --- a/packages/esm-ohri-pmtct-app/src/index.ts +++ b/packages/esm-ohri-pmtct-app/src/index.ts @@ -21,7 +21,7 @@ import { createDashboardLink } from '@openmrs/esm-patient-common-lib'; export const importTranslation = require.context('../translations', false, /.json$/, 'lazy'); -export const moduleName = '@ohri/openmrs-esm-ohri-pmtct'; +export const moduleName = '@ohri/openmrs-esm-ohri-pmtct-app'; require('./root.scss'); diff --git a/packages/esm-ohri-pmtct-app/src/views/child-health/child-health-config.json b/packages/esm-ohri-pmtct-app/src/views/child-health/child-health-config.json new file mode 100644 index 000000000..7b3ae0df6 --- /dev/null +++ b/packages/esm-ohri-pmtct-app/src/views/child-health/child-health-config.json @@ -0,0 +1,77 @@ +{ + "menuId": "childHealth", + "tabDefinitions": [ + { + "tabName": "Infant Postnatal Visit", + "headerTitle": "Infant Postnatal Visit", + "displayText": "Infant Postnatal Visit", + "encounterType": "af1f1b24-d2e8-4282-b308-0bf79b365584", + "columns": [ + { + "id": "pTrackerId", + "title": "PTracker Id", + "concept": "6c45421e-2566-47cb-bbb3-07586fffbfe2" + }, + { + "id": "mothersName", + "title": "Mothers Name", + "concept": "163260AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" + }, + { + "id": "artProphylaxisStatus", + "title": "ART Prophylaxis Status", + "concept": "1148AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" + }, + { + "id": "linkedToArt", + "title": "Linked to ART", + "concept": "a40d8bc4-56b8-4f28-a1dd-412da5cf20ed" + }, + { + "id": "breastfeedingStatus", + "title": "Breastfeeding status", + "concept": "1151AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" + }, + { + "id": "outcomeStatus", + "title": "Outcome Status", + "concept": "160433AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" + }, + { + "id": "nextVisitDate", + "isDate": true, + "title": "Next visit date", + "concept": "5096AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" + }, + { + "id": "actions", + "title": "Actions", + "actionOptions": [ + { + "formName": "Antenatal Form", + "package": "pmtct", + "label": "View Details", + "mode": "view" + }, + { + "formName": "Antenatal Form", + "package": "pmtct", + "label": "Edit Form", + "mode": "edit" + } + ] + } + ], + "launchOptions": { + "displayText": "Add", + "moduleName": "@ohri/openmrs-esm-ohri-pmtct-app" + }, + "formList": [ + { + "name": "Infant - Postanal Form", + "uuid": "5022c5d7-ea45-47ce-bd65-1ba1d8ad2467" + } + ] + } + ] + } \ No newline at end of file diff --git a/packages/esm-ohri-pmtct-app/src/views/child-health/child-health.component.tsx b/packages/esm-ohri-pmtct-app/src/views/child-health/child-health.component.tsx index 8eed1ef48..1d1b3e21d 100644 --- a/packages/esm-ohri-pmtct-app/src/views/child-health/child-health.component.tsx +++ b/packages/esm-ohri-pmtct-app/src/views/child-health/child-health.component.tsx @@ -1,29 +1,41 @@ import React from 'react'; import { Tabs, Tab, TabList, TabPanels, TabPanel } from '@carbon/react'; import styles from '../common.scss'; -import { useTranslation } from 'react-i18next'; -import InfantPostnatalList from './tabs/infant-postnatal-care.component'; +import { EncounterList, getMenuItemTabConfiguration } from '@ohri/openmrs-esm-ohri-commons-lib'; +import childHealthTabConfigSchema from './child-health-config.json'; interface OverviewListProps { patientUuid: string; } -const ChildHealthList: React.FC = ({ patientUuid }) => { - const { t } = useTranslation(); +const ChildHealthSummary: React.FC = ({ patientUuid }) => { + const tabs = getMenuItemTabConfiguration(childHealthTabConfigSchema); return (
- {t('infantPostnatalVisit', 'Infant Postnatal Visit')} + {tabs.map((tab) => ( + {tab.name} + ))} - - - + {tabs.map((tab) => ( + + + + ))}
); }; -export default ChildHealthList; +export default ChildHealthSummary; diff --git a/packages/esm-ohri-pmtct-app/src/views/child-health/tabs/infant-postnatal-care.component.tsx b/packages/esm-ohri-pmtct-app/src/views/child-health/tabs/infant-postnatal-care.component.tsx deleted file mode 100644 index 922cc67fd..000000000 --- a/packages/esm-ohri-pmtct-app/src/views/child-health/tabs/infant-postnatal-care.component.tsx +++ /dev/null @@ -1,121 +0,0 @@ -import React, { useMemo } from 'react'; -import { useTranslation } from 'react-i18next'; -import { - EncounterList, - EncounterListColumn, - fetchPatientRelationships, - getObsFromEncounter, -} from '@ohri/openmrs-esm-ohri-commons-lib'; -import { moduleName } from '../../..'; -import { useConfig } from '@openmrs/esm-framework'; - -interface InfantPostnatalListProps { - patientUuid: string; -} - -const InfantPostnatalList: React.FC = ({ patientUuid }) => { - const { t } = useTranslation(); - const config = useConfig(); - const headerTitle = t('hivExposedInfant', 'HIV Exposed Infant'); - const { encounterTypes, formNames, formUuids } = useConfig(); - - async function fetchMotherName() { - let motherName = '--'; - const response = await fetchPatientRelationships(patientUuid); - if (response.length) { - motherName = response[0].personA.display; - } - return motherName; - } - - const columns: EncounterListColumn[] = useMemo(() => { - return [ - { - key: 'pTrackerId', - header: t('pTrackerId', 'Child PTracker ID'), - getValue: (encounter) => { - return getObsFromEncounter(encounter, config.obsConcepts.pTrackerIdConcept); - }, - }, - { - key: 'mothersName', - header: t('mothersName', 'Mothers Name'), - getValue: async (encounter) => { - return await fetchMotherName(); - }, - }, - { - key: 'artProphylaxisStatus', - header: t('artProphylaxisStatus', 'ART Prophylaxis Status'), - getValue: (encounter) => { - return getObsFromEncounter(encounter, config.obsConcepts.artProphylaxisStatus); - }, - }, - { - key: 'linkedToArt', - header: t('linkedToArt', 'Linked to ART'), - getValue: (encounter) => { - return getObsFromEncounter(encounter, config.obsConcepts.linkedToArt); - }, - }, - { - key: 'breastfeedingStatus', - header: t('breastfeedingStatus', 'Breastfeeding status'), - getValue: (encounter) => { - return getObsFromEncounter(encounter, config.obsConcepts.breastfeedingStatus); - }, - }, - { - key: 'outcomeStatus', - header: t('outcomeStatus', 'Outcome Status'), - getValue: (encounter) => { - return getObsFromEncounter(encounter, config.obsConcepts.outcomeStatus); - }, - }, - { - key: 'nextVisitDate', - header: t('nextVisitDate', 'Next visit date'), - getValue: (encounter) => { - return getObsFromEncounter(encounter, config.obsConcepts.nextVisitDate, true); - }, - }, - { - key: 'actions', - header: t('actions', 'Actions'), - getValue: (encounter) => [ - { - form: { name: 'Infant - Postanal Form', package: 'child_health' }, - encounterUuid: encounter.uuid, - intent: '*', - label: t('viewDetails', 'View Details'), - mode: 'view', - }, - { - form: { name: 'Infant - Postanal Form', package: 'child_health' }, - encounterUuid: encounter.uuid, - intent: '*', - label: t('editForm', 'Edit Form'), - mode: 'edit', - }, - ], - }, - ]; - }, []); - - return ( - - ); -}; - -export default InfantPostnatalList; diff --git a/packages/esm-ohri-pmtct-app/src/views/maternal-health/maternal-health-config.json b/packages/esm-ohri-pmtct-app/src/views/maternal-health/maternal-health-config.json new file mode 100644 index 000000000..9183d275d --- /dev/null +++ b/packages/esm-ohri-pmtct-app/src/views/maternal-health/maternal-health-config.json @@ -0,0 +1,221 @@ +{ + "menuId": "maternalHealth", + "tabDefinitions": [ + { + "tabName": "Antenatal Care", + "headerTitle": "Antenatal Care", + "displayText": "Antenatal Care", + "encounterType": "677d1a80-dbbe-4399-be34-aa7f54f11405", + "columns": [ + { + "id": "pTrackerId", + "title": "PTracker Id", + "concept": "6c45421e-2566-47cb-bbb3-07586fffbfe2" + }, + { + "id": "visitDate", + "isDate": true, + "title": "Visit Date", + "concept": "163260AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" + }, + { + "id": "hivTestStatus", + "title": "HIV Test Status", + "concept": "164401AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" + }, + { + "id": "artLinkage", + "title": "ART linkage (if positive)", + "concept": "6e62bf7e-2107-4d09-b485-6e60cbbb2d08" + }, + { + "id": "edd", + "isDate": true, + "title": "EDD", + "concept": "5596AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" + }, + { + "id": "facility", + "title": "Facility", + "type": "location" + }, + { + "id": "followUpDate", + "isDate": true, + "title": "Next follow-up date", + "concept": "5096AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" + }, + { + "id": "vlResults", + "title": "VL Results", + "concept": "1305AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" + }, + { + "id": "actions", + "title": "Actions", + "actionOptions": [ + { + "formName": "Antenatal Form", + "package": "pmtct", + "label": "View Details", + "mode": "view" + }, + { + "formName": "Antenatal Form", + "package": "pmtct", + "label": "Edit Form", + "mode": "edit" + } + ] + } + ], + "launchOptions": { + "displayText": "Add", + "moduleName": "@ohri/openmrs-esm-ohri-pmtct-app" + }, + "formList": [ + { + "name": "Antenatal Form", + "uuid": "5255a535-2acb-3f44-bd0a-3f80595dece1" + } + ] + }, + { + "tabName": "Labour and Delivery", + "headerTitle": "Labour and Delivery", + "displayText": "Labour and Delivery", + "encounterType": "6dc5308d-27c9-4d49-b16f-2c5e3c759757", + "columns": [ + { + "id": "pTrackerId", + "title": "PTracker Id", + "concept": "6c45421e-2566-47cb-bbb3-07586fffbfe2" + }, + { + "id": "deliveryDate", + "isDate": true, + "title": "Delivery Date", + "concept": "5599AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" + }, + { + "id": "bookedForANC", + "title": "Booked for ANC", + "concept": "1719AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" + }, + { + "id": "hivTestStatus", + "title": "HIV Test Status", + "concept": "164401AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" + }, + { + "id": "artInitiation", + "isDate": true, + "title": "ART Initiation", + "concept": "159599AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" + }, + { + "id": "birthCount", + "title": "Birth Count", + "concept": "1568AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" + }, + { + "id": "actions", + "title": "Actions", + "actionOptions": [ + { + "formName": "Labour & Delivery Form", + "package": "pmtct", + "label": "View Details", + "mode": "view" + }, + { + "formName": "Labour & Delivery Form", + "package": "pmtct", + "label": "Edit Form", + "mode": "edit" + } + ] + } + ], + "launchOptions": { + "displayText": "Add", + "moduleName": "@ohri/openmrs-esm-ohri-pmtct-app" + }, + "formList": [ + { + "name": "Labour & Delivery Form", + "uuid": "1e5614d6-5306-11e6-beb8-9e71128cae77" + } + ] + }, + { + "tabName": "Postnatal Care", + "headerTitle": "Postnatal Care", + "displayText": "Postnatal Care", + "encounterType": "269bcc7f-04f8-4ddc-883d-7a3a0d569aad", + "columns": [ + { + "id": "pTrackerId", + "title": "PTracker Id", + "concept": "6c45421e-2566-47cb-bbb3-07586fffbfe2" + }, + { + "id": "visitDate", + "isDate": true, + "title": "Visit Date", + "concept": "163260AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" + }, + { + "id": "currentHivStatus", + "title": "Current HIV Status", + "concept": "164401AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" + }, + { + "id": "recentViralLoadTestDate", + "isDate": true, + "title": "Recent Viral load test date", + "concept": "163281AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" + }, + { + "id": "recentViralLoadResults", + "title": "Recent Viral load results", + "concept": "1305AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" + }, + { + "id": "nextVisitDate", + "isDate": true, + "title": "Next visit date", + "concept": "163260AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" + }, + { + "id": "actions", + "title": "Actions", + "actionOptions": [ + { + "formName": "Postnatal Care", + "package": "pmtct", + "label": "View Details", + "mode": "view" + }, + { + "formName": "Postnatal Care", + "package": "pmtct", + "label": "Edit Form", + "mode": "edit" + } + ] + } + ], + "launchOptions": { + "displayText": "Add", + "moduleName": "@ohri/openmrs-esm-ohri-pmtct-app" + }, + "formList": [ + { + "name": "Mother - Postnatal Form", + "uuid": "e6b67aa4-6c59-4470-8ad5-b994efeda553" + } + ] + } + ] +} \ No newline at end of file diff --git a/packages/esm-ohri-pmtct-app/src/views/maternal-health/maternal-health.component.tsx b/packages/esm-ohri-pmtct-app/src/views/maternal-health/maternal-health.component.tsx index 95cedbed7..42b420522 100644 --- a/packages/esm-ohri-pmtct-app/src/views/maternal-health/maternal-health.component.tsx +++ b/packages/esm-ohri-pmtct-app/src/views/maternal-health/maternal-health.component.tsx @@ -1,39 +1,41 @@ import React from 'react'; import { Tabs, Tab, TabList, TabPanels, TabPanel } from '@carbon/react'; import styles from '../common.scss'; -import { useTranslation } from 'react-i18next'; -import AntenatalCareList from './tabs/antenatal-care.component'; -import LabourDeliveryList from './tabs/labour-delivery.component'; -import PostnatalCareList from './tabs/postnatal-care.component'; +import { EncounterList, getMenuItemTabConfiguration } from '@ohri/openmrs-esm-ohri-commons-lib'; +import maternalHealthTabConfigSchema from './maternal-health-config.json'; interface OverviewListProps { patientUuid: string; } -const MaternalHealthList: React.FC = ({ patientUuid }) => { - const { t } = useTranslation(); +const MaternalHealthSummary: React.FC = ({ patientUuid }) => { + const tabs = getMenuItemTabConfiguration(maternalHealthTabConfigSchema); return (
- {t('antenatalCare', 'Antenatal Care')} - {t('labourAndDelivery', 'Labour and Delivery')} - {t('postnatalCare', 'Postnatal Care')} + {tabs.map((tab) => ( + {tab.name} + ))} - - - - - - - - - + {tabs.map((tab) => ( + + + + ))}
); }; -export default MaternalHealthList; +export default MaternalHealthSummary; diff --git a/packages/esm-ohri-pmtct-app/src/views/maternal-health/tabs/antenatal-care.component.tsx b/packages/esm-ohri-pmtct-app/src/views/maternal-health/tabs/antenatal-care.component.tsx deleted file mode 100644 index 80644d420..000000000 --- a/packages/esm-ohri-pmtct-app/src/views/maternal-health/tabs/antenatal-care.component.tsx +++ /dev/null @@ -1,115 +0,0 @@ -import React, { useMemo } from 'react'; -import { useTranslation } from 'react-i18next'; -import { EncounterList, EncounterListColumn, getObsFromEncounter } from '@ohri/openmrs-esm-ohri-commons-lib'; -import { moduleName } from '../../../index'; -import { useConfig } from '@openmrs/esm-framework'; - -interface AntenatalCareListProps { - patientUuid: string; -} - -const AntenatalCareList: React.FC = ({ patientUuid }) => { - const { t } = useTranslation(); - const config = useConfig(); - const headerTitle = t('antenatalCare', 'Antenatal Care'); - const { encounterTypes, formNames, formUuids } = useConfig(); - - const columns: EncounterListColumn[] = useMemo( - () => [ - { - key: 'pTrackerId', - header: t('pTrackerId', 'PTracker Id'), - getValue: (encounter) => { - return getObsFromEncounter(encounter, config.obsConcepts.pTrackerIdConcept); - }, - }, - { - key: 'visitDate', - header: t('visitDate', 'Visit Date'), - getValue: (encounter) => { - return getObsFromEncounter(encounter, config.obsConcepts.visitDateConcept, true); - }, - }, - { - key: 'hivTestStatus', - header: t('hivTestStatus', 'HIV Test Status'), - getValue: (encounter) => { - return getObsFromEncounter(encounter, config.obsConcepts.hivTestStatus); - }, - }, - { - key: 'artLinkage', - header: t('artLinkage', 'ART linkage (if positive)'), - getValue: (encounter) => { - return getObsFromEncounter(encounter, config.obsConcepts.artInitiationConcept); - }, - }, - { - key: 'edd', - header: t('edd', 'EDD'), - getValue: (encounter) => { - return getObsFromEncounter(encounter, config.obsConcepts.eDDConcept, true); - }, - }, - { - key: 'facility', - header: t('facility', 'Facility'), - getValue: (encounter) => { - return encounter.location.name; - }, - }, - { - key: 'followUpDate', - header: t('followUpDate', 'Next follow-up date'), - getValue: (encounter) => { - return getObsFromEncounter(encounter, config.obsConcepts.followUpDateConcept, true); - }, - }, - { - key: 'vlResults', - header: t('vlResults', 'VL Results'), - getValue: (encounter) => { - return getObsFromEncounter(encounter, config.obsConcepts.vLResultsConcept); - }, - }, - { - key: 'actions', - header: t('actions', 'Actions'), - getValue: (encounter) => [ - { - form: { name: 'Antenatal Form', package: 'maternal_health' }, - encounterUuid: encounter.uuid, - intent: '*', - label: t('viewDetails', 'View Details'), - mode: 'view', - }, - { - form: { name: 'Antenatal Form', package: 'maternal_health' }, - encounterUuid: encounter.uuid, - intent: '*', - label: t('editForm', 'Edit Form'), - mode: 'edit', - }, - ], - }, - ], - [], - ); - - return ( - - ); -}; - -export default AntenatalCareList; diff --git a/packages/esm-ohri-pmtct-app/src/views/maternal-health/tabs/labour-delivery.component.tsx b/packages/esm-ohri-pmtct-app/src/views/maternal-health/tabs/labour-delivery.component.tsx deleted file mode 100644 index 9515b21f3..000000000 --- a/packages/esm-ohri-pmtct-app/src/views/maternal-health/tabs/labour-delivery.component.tsx +++ /dev/null @@ -1,101 +0,0 @@ -import React, { useMemo } from 'react'; -import { useTranslation } from 'react-i18next'; -import { EncounterList, EncounterListColumn, getObsFromEncounter } from '@ohri/openmrs-esm-ohri-commons-lib'; -import { moduleName } from '../../../index'; -import { useConfig } from '@openmrs/esm-framework'; - -interface LabourDeliveryListProps { - patientUuid: string; -} - -const LabourDeliveryList: React.FC = ({ patientUuid }) => { - const { t } = useTranslation(); - const config = useConfig(); - const headerTitle = t('labourAndDelivery', 'Labour and Delivery'); - const { encounterTypes, formNames, formUuids } = useConfig(); - - const columns: EncounterListColumn[] = useMemo( - () => [ - { - key: 'pTrackerId', - header: t('pTrackerId', 'PTracker Id'), - getValue: (encounter) => { - return getObsFromEncounter(encounter, config.obsConcepts.pTrackerIdConcept); - }, - }, - { - key: 'deliveryDate', - header: t('deliveryDate', 'Delivery Date'), - getValue: (encounter) => { - return getObsFromEncounter(encounter, config.obsConcepts.visitDateConcept, true); - }, - }, - { - key: 'bookedForANC', - header: t('bookedForANC', 'Booked for ANC'), - getValue: (encounter) => { - return getObsFromEncounter(encounter, config.obsConcepts.bookedForAncConcept); - }, - }, - { - key: 'hivTestStatus', - header: t('hivTestStatus', 'HIV Test Status'), - getValue: (encounter) => { - return getObsFromEncounter(encounter, config.obsConcepts.hivTestStatus); - }, - }, - { - key: 'artInitiation', - header: t('artInitiation', 'ART Initiation'), - getValue: (encounter) => { - return getObsFromEncounter(encounter, config.obsConcepts.artInitiationConcept); - }, - }, - { - key: 'birthCount', - header: t('birthCount', 'Birth Count'), - getValue: (encounter) => { - return getObsFromEncounter(encounter, config.obsConcepts.birthCountConcept); - }, - }, - { - key: 'actions', - header: t('actions', 'Actions'), - getValue: (encounter) => [ - { - form: { name: 'Labour & Delivery Form', package: 'maternal_health' }, - encounterUuid: encounter.uuid, - intent: '*', - label: t('viewDetails', 'View Details'), - mode: 'view', - }, - { - form: { name: 'Labour & Delivery Form', package: 'maternal_health' }, - encounterUuid: encounter.uuid, - intent: '*', - label: t('editForm', 'Edit Form'), - mode: 'edit', - }, - ], - }, - ], - [], - ); - - return ( - - ); -}; - -export default LabourDeliveryList; diff --git a/packages/esm-ohri-pmtct-app/src/views/maternal-health/tabs/postnatal-care.component.tsx b/packages/esm-ohri-pmtct-app/src/views/maternal-health/tabs/postnatal-care.component.tsx deleted file mode 100644 index d581da9dd..000000000 --- a/packages/esm-ohri-pmtct-app/src/views/maternal-health/tabs/postnatal-care.component.tsx +++ /dev/null @@ -1,101 +0,0 @@ -import React, { useMemo } from 'react'; -import { useTranslation } from 'react-i18next'; -import { EncounterList, EncounterListColumn, getObsFromEncounter } from '@ohri/openmrs-esm-ohri-commons-lib'; -import { moduleName } from '../../..'; -import { useConfig } from '@openmrs/esm-framework'; - -interface PostnatalCareListProps { - patientUuid: string; -} - -const PostnatalCareList: React.FC = ({ patientUuid }) => { - const { t } = useTranslation(); - const config = useConfig(); - const headerTitle = t('postnatalCare', 'Postnatal Care'); - const { encounterTypes, formNames, formUuids } = useConfig(); - - const columns: EncounterListColumn[] = useMemo( - () => [ - { - key: 'pTrackerId', - header: t('pTrackerId', 'PTracker ID'), - getValue: (encounter) => { - return getObsFromEncounter(encounter, config.obsConcepts.pTrackerIdConcept); - }, - }, - { - key: 'visitDate', - header: t('visitDate', 'Visit Date'), - getValue: (encounter) => { - return getObsFromEncounter(encounter, config.obsConcepts.visitDate, true); - }, - }, - { - key: 'currentHivStatus', - header: t('currentHivStatus', 'Current HIV Status'), - getValue: (encounter) => { - return getObsFromEncounter(encounter, config.obsConcepts.hivTestStatus); - }, - }, - { - key: 'recentViralLoadTestDate', - header: t('recentViralLoadTestDate', 'Recent Viral load test date'), - getValue: (encounter) => { - return getObsFromEncounter(encounter, config.obsConcepts.MotherViralLoadDate, true); - }, - }, - { - key: 'recentViralLoadResults', - header: t('recentViralLoadResults', 'Recent Viral load results'), - getValue: (encounter) => { - return getObsFromEncounter(encounter, config.obsConcepts.MotherViralLoadResult); - }, - }, - { - key: 'nextVisitDate', - header: t('nextVisitDate', 'Next visit date'), - getValue: (encounter) => { - return getObsFromEncounter(encounter, config.obsConcepts.MotherNextVisitDate, true); - }, - }, - { - key: 'actions', - header: t('actions', 'Actions'), - getValue: (encounter) => [ - { - form: { name: 'Mother - Postnatal Form', package: 'maternal_health' }, - encounterUuid: encounter.uuid, - intent: '*', - label: t('viewDetails', 'View Details'), - mode: 'view', - }, - { - form: { name: 'Mother - Postnatal Form', package: 'maternal_health' }, - encounterUuid: encounter.uuid, - intent: '*', - label: t('editForm', 'Edit Form'), - mode: 'edit', - }, - ], - }, - ], - [], - ); - - return ( - - ); -}; - -export default PostnatalCareList;