diff --git a/packages/esm-commons-lib/src/api.resource.ts b/packages/esm-commons-lib/src/api.resource.ts index a74d875d1..0cacbd838 100644 --- a/packages/esm-commons-lib/src/api.resource.ts +++ b/packages/esm-commons-lib/src/api.resource.ts @@ -314,3 +314,61 @@ function isInvalidValue(value) { } return false; } + +export async function getCohortList( + cohortUuid: string, + queryParams?: string[], + isReportingCohort?: boolean, + encounterType?: string, +) { + const params = queryParams ? queryParams.join('&') : ''; + const cohortMembersUrl = params + ? `reportingrest/cohort/${cohortUuid}?${params}` + : `reportingrest/cohort/${cohortUuid}`; + const cohortUrl = `cohortm/cohort/${cohortUuid}?v=full`; + + const url = isReportingCohort ? cohortMembersUrl : cohortUrl; + + const { data } = await openmrsFetch(BASE_WS_API_URL + url); + + if (data?.members) { + return Promise.all( + data.members.map((member) => { + return openmrsFetch( + `/ws/rest/v1/encounter?encounterType=${encounterType}&patient=${member.uuid}&v=${encounterRepresentation}`, + ).then(({ data }) => { + if (data.results.length) { + const sortedEncounters = data.results.sort( + (firstEncounter, secondEncounter) => + new Date(secondEncounter.encounterDatetime).getTime() - + new Date(firstEncounter.encounterDatetime).getTime(), + ); + + return sortedEncounters[0]; + } + + return null; + }); + }), + ); + } else if (data?.cohortMembers) { + return Promise.all( + data.cohortMembers.map((member) => { + return openmrsFetch( + `/ws/rest/v1/encounter?encounterType=${encounterType}&patient=${member.patient.uuid}&v=${encounterRepresentation}`, + ).then(({ data }) => { + if (data.results.length) { + const sortedEncounters = data.results + .sort( + (firstEncounter, secondEncounter) => + new Date(secondEncounter.encounterDatetime).getTime() - + new Date(firstEncounter.encounterDatetime).getTime(), + ); + return sortedEncounters[0]; + } + return null; + }); + }), + ); + } +} diff --git a/packages/esm-commons-lib/src/components/cohort-patient-list/cohort-patient-list.component.tsx b/packages/esm-commons-lib/src/components/cohort-patient-list/cohort-patient-list.component.tsx index 349e20ede..2dc2a5a89 100644 --- a/packages/esm-commons-lib/src/components/cohort-patient-list/cohort-patient-list.component.tsx +++ b/packages/esm-commons-lib/src/components/cohort-patient-list/cohort-patient-list.component.tsx @@ -1,10 +1,7 @@ import React, { useCallback, useEffect, useMemo, useState } from 'react'; -import { attach, detach, ExtensionSlot } from '@openmrs/esm-framework'; import { - fetchPatientLastEncounter, fetchPatientsFinalHIVStatus, - getCohort, - getReportingCohortMembers, + getCohortList, } from '../../api.resource'; import dayjs from 'dayjs'; import { TableEmptyState } from '../empty-state/table-empty-state.component'; @@ -12,9 +9,9 @@ import { DataTableSkeleton } from '@carbon/react'; import { basePath } from '../../constants'; import { useTranslation } from 'react-i18next'; import { useFormsJson } from '../../hooks/useFormsJson'; -import { columns, consolidatatePatientMeta, filterPatientsByName, type PatientListColumn } from './helpers'; - +import { columns, consolidatatePatientMeta, type PatientListColumn } from './helpers'; import styles from './cohort-patient-list.scss'; +import { PatientTable } from '../patient-table/patient-table.component'; interface CohortPatientListProps { cohortId: string; @@ -59,47 +56,84 @@ export const CohortPatientList: React.FC = ({ viewTptPatientProgramSummary, }) => { const [isLoading, setIsLoading] = useState(true); - const [hasLoadedPatients, setHasLoadedPatients] = useState(false); - const [loadedEncounters, setLoadedEncounters] = useState(false); const [loadedHIVStatuses, setLoadedHIVStatuses] = useState(false); - const [currentPage, setCurrentPage] = useState(1); - const [pageSize, setPageSize] = useState(10); - const [patientsCount, setPatientsCount] = useState(0); - const [searchTerm, setSearchTerm] = useState(null); - const [counter, setCounter] = useState(0); - const [filteredResults, setFilteredResults] = useState([]); - const [loadedExtraEncounters, setLoadedExtraEncounters] = useState(false); - const [extraEncounters, setExtraEncounters] = useState([]); - const [paginatedPatients, setPaginatedPatients] = useState([]); const [allPatients, setAllPatients] = useState([]); - const [rawCohortData, setRawCohortData] = useState<{ location?: any; members: any[] }>({ members: [] }); - const [isLoadingCohorts, setIsLoadingCohorts] = useState(true); const columnAtLastIndex = 'actions'; const forms = useMemo(() => [launchableForm.name], [launchableForm]); const { formsJson, isLoading: isLoadingFormsJson } = useFormsJson(forms); + + useEffect(() => { + getCohortList(cohortId, queryParams, isReportingCohort, associatedEncounterType) + .then((data) => { + if(data) { + const mappedPatients = data.filter((patient) => patient !== null) + .map((mappedData) => { + const patient = constructPatient(mappedData?.patient); + patient.url = `${window.spaBase}/patient/${patient?.uuid}/chart/`; + return { + ...patient, + encounter: mappedData, + ...consolidatatePatientMeta(mappedData, formsJson[0], { + isDynamicCohort: isReportingCohort, + location: mappedData.location, + encounterType: associatedEncounterType, + moduleName, + launchableFormProps: launchableForm, + addPatientToListOptions: { + ...addPatientToListOptions, + displayText: t('moveToListSideNav', 'Move to list'), + }, + viewTptPatientProgramSummary, + viewPatientProgramSummary, + }), + }; + }) + setAllPatients(mappedPatients); + setIsLoading(false); + } + }).catch((error) => { + console.error('Error fetching cohort data:', error); + setIsLoading(false); + }) + }, []); + + useEffect(() => { + const fetchHivResults = excludeColumns ? !excludeColumns.includes('hivResult') : true; + if ((!isLoading || !associatedEncounterType) && !loadedHIVStatuses && fetchHivResults) { + Promise.all(allPatients.map((patient) => fetchPatientsFinalHIVStatus(patient.uuid))).then((results) => { + results.forEach((hivResult, index) => { + allPatients[index].hivResult = hivResult; + if (index == allPatients.length - 1) { + setAllPatients([...allPatients]); + setLoadedHIVStatuses(true); + } + }); + }); + } + }, [allPatients, associatedEncounterType, excludeColumns, isLoading, loadedHIVStatuses]); const constructPatient = useCallback( (rawPatient) => { - const patientUuid = isReportingCohort ? rawPatient.person.uuid : rawPatient.patient.uuid; + const patientUuid = isReportingCohort ? rawPatient.person.uuid : rawPatient.uuid; const dashboard = launchableForm?.targetDashboard ? `/${launchableForm?.targetDashboard}` : ''; return { uuid: patientUuid, id: isReportingCohort ? rawPatient?.identifiers[0]?.identifier : rawPatient?.patient?.identifiers[0]?.identifier, - age: isReportingCohort ? rawPatient.person.age : rawPatient.patient.person.age, - name: isReportingCohort ? rawPatient.person.display : rawPatient.patient.person.display, + age: isReportingCohort ? rawPatient.person.age : rawPatient.age, + name: isReportingCohort ? rawPatient.person.display : rawPatient.person.display, birthdate: isReportingCohort ? dayjs(rawPatient?.person?.birthdate).format('DD-MMM-YYYY') - : dayjs(rawPatient?.patient?.person?.birthdate).format('DD-MMM-YYYY'), + : dayjs(rawPatient?.person?.birthdate).format('DD-MMM-YYYY'), gender: isReportingCohort ? rawPatient.person.gender == 'M' ? 'Male' : 'Female' - : rawPatient.patient.person.gender == 'M' + : rawPatient.person.gender == 'M' ? 'Male' : 'Female', - birthday: isReportingCohort ? rawPatient.person.birthdate : rawPatient.patient.person.birthdate, + birthday: isReportingCohort ? rawPatient.person.birthdate : rawPatient.person.birthdate, url: `${basePath}${patientUuid}/chart${dashboard}`, }; }, @@ -108,143 +142,7 @@ export const CohortPatientList: React.FC = ({ const { t } = useTranslation(); - const updatePatientTable = (fullDataset, start, itemCount) => { - let currentRows = []; - - for (let i = start; i < start + itemCount; i++) { - if (i < fullDataset.length) { - currentRows.push(fullDataset[i]); - } - } - setPaginatedPatients(currentRows); - }; - - useEffect(() => { - if (!isReportingCohort) { - getCohort(cohortId, 'full').then((results) => { - setRawCohortData({ members: results.cohortMembers, location: results.location }); - setIsLoadingCohorts(false); - }); - } else { - getReportingCohortMembers(cohortId, queryParams).then((results) => { - setRawCohortData({ members: results.map((result) => result.data) }); - setIsLoadingCohorts(false); - }); - } - }, [cohortId, isReportingCohort, queryParams]); - - useEffect(() => { - if (!isLoadingCohorts && !isLoadingFormsJson) { - const patients = rawCohortData.members.map((member) => { - const patient = constructPatient(member); - member['patientUrl'] = patient.url; - return { - ...patient, - ...consolidatatePatientMeta(member, formsJson[0], { - isDynamicCohort: isReportingCohort, - location: rawCohortData.location, - encounterType: associatedEncounterType, - moduleName, - launchableFormProps: launchableForm, - addPatientToListOptions: { - ...addPatientToListOptions, - displayText: t('moveToListSideNav', 'Move to list'), - }, - viewTptPatientProgramSummary, - viewPatientProgramSummary, - }), - }; - }); - setAllPatients(patients); - updatePatientTable(patients, 0, pageSize); - setHasLoadedPatients(true); - setIsLoading(false); - } - }, [ - rawCohortData, - formsJson, - isLoadingCohorts, - isLoadingFormsJson, - pageSize, - constructPatient, - isReportingCohort, - associatedEncounterType, - moduleName, - launchableForm, - addPatientToListOptions, - t, - viewTptPatientProgramSummary, - viewPatientProgramSummary, - ]); - - useEffect(() => { - if (hasLoadedPatients && allPatients.length) { - Promise.all(allPatients.map((patient) => fetchPatientLastEncounter(patient.uuid, associatedEncounterType))).then( - (results) => { - results.forEach((encounter, index) => { - allPatients[index].latestEncounter = encounter; - if (index == allPatients.length - 1) { - setAllPatients([...allPatients]); - setLoadedEncounters(true); - setIsLoading(false); - } - }); - }, - ); - } - setPatientsCount(allPatients.length); - }, [allPatients, associatedEncounterType, hasLoadedPatients]); - - useEffect(() => { - const fetchHivResults = excludeColumns ? !excludeColumns.includes('hivResult') : true; - if ((loadedEncounters || !associatedEncounterType) && !loadedHIVStatuses && fetchHivResults) { - Promise.all(allPatients.map((patient) => fetchPatientsFinalHIVStatus(patient.uuid))).then((results) => { - results.forEach((hivResult, index) => { - allPatients[index].hivResult = hivResult; - if (index == allPatients.length - 1) { - setAllPatients([...allPatients]); - setLoadedHIVStatuses(true); - } - }); - }); - } - }, [allPatients, associatedEncounterType, excludeColumns, loadedEncounters, loadedHIVStatuses]); - - const pagination = useMemo(() => { - return { - usePagination: true, - currentPage: currentPage, - onChange: ({ pageSize, page }) => { - let startOffset = (page - 1) * pageSize; - updatePatientTable(allPatients, startOffset, pageSize); - - setCurrentPage(page); - setPageSize(pageSize); - return null; - }, - pageSize: pageSize, - totalItems: patientsCount, - }; - }, [currentPage, pageSize, patientsCount, allPatients]); - - const handleSearch = useCallback( - (searchTerm) => { - setSearchTerm(searchTerm); - const filtrate = filterPatientsByName(searchTerm, allPatients); - setFilteredResults(filtrate); - return true; - }, - [allPatients], - ); - - useEffect(() => { - attach(cohortSlotName, 'patient-table'); - return () => { - detach(cohortSlotName, 'patient-table'); - }; - }); - - const state = useMemo(() => { + const finalColumns = useMemo(() => { let filteredColumns = [...columns]; if (excludeColumns) { filteredColumns = columns.filter((c) => !excludeColumns.includes(c.key)); @@ -266,80 +164,29 @@ export const CohortPatientList: React.FC = ({ filteredColumns.push(column); } - return { - patients: searchTerm ? filteredResults : paginatedPatients, - columns: filteredColumns, - isLoading, - search: { - placeHolder: t('searchClientList', 'Search client list'), - onSearch: (searchTerm) => { - if (!searchTerm) { - // clear value - setSearchTerm(''); - } - }, - currentSearchTerm: searchTerm, - otherSearchProps: { - onKeyDown: (e) => { - if (e.keyCode == 13) { - handleSearch(e.target.value); - } - }, - autoFocus: true, - }, - }, - pagination: pagination, - autoFocus: true, - }; + return filteredColumns }, [ - searchTerm, - filteredResults, - paginatedPatients, - handleSearch, - pagination, - isLoading, - t, excludeColumns, otherColumns, + columns, ]); - useEffect(() => { - setCounter(counter + 1); - }, [counter, state]); - - useEffect(() => { - if (allPatients.length && extraAssociatedEncounterTypes && !loadedExtraEncounters) { - allPatients.forEach((patient) => { - extraAssociatedEncounterTypes.forEach((encType) => { - extraEncounters.push(fetchPatientLastEncounter(patient.uuid, encType)); - }); - }); - - Promise.all(extraEncounters).then((results) => { - results.forEach((encounter, index) => { - const idx = allPatients.findIndex((patient) => patient.uuid === encounter?.patient.uuid); - if (idx !== -1) { - allPatients[idx].latestExtraEncounters = allPatients[idx].latestExtraEncounters?.concat(encounter) ?? [ - encounter, - ]; - } - }); - setLoadedExtraEncounters(true); - }); - } - }, [allPatients, extraAssociatedEncounterTypes, extraEncounters, loadedExtraEncounters]); - return (
{isLoading ? ( - ) : !paginatedPatients.length ? ( + ) : !allPatients.length ? ( ) : ( - + )}
); diff --git a/packages/esm-commons-lib/src/components/cohort-patient-list/helpers.tsx b/packages/esm-commons-lib/src/components/cohort-patient-list/helpers.tsx index 9b44631f0..54d08f23c 100644 --- a/packages/esm-commons-lib/src/components/cohort-patient-list/helpers.tsx +++ b/packages/esm-commons-lib/src/components/cohort-patient-list/helpers.tsx @@ -163,7 +163,7 @@ export function consolidatatePatientMeta(rawPatientMeta, form, config: PatientMe viewPatientProgramSummary, viewTptPatientProgramSummary, } = config; - const patientUuid = !isDynamicCohort ? rawPatientMeta.patient.uuid : rawPatientMeta.person.uuid; + const patientUuid = !isDynamicCohort ? rawPatientMeta.patient.uuid : rawPatientMeta.patient.person.uuid; dayjs.extend(localizedFormat); dayjs.extend(relativeTime); diff --git a/packages/esm-commons-lib/src/components/patient-list-tabs/ohri-patient-list-tabs.component.tsx b/packages/esm-commons-lib/src/components/patient-list-tabs/ohri-patient-list-tabs.component.tsx index d8094580e..1ed4f4006 100644 --- a/packages/esm-commons-lib/src/components/patient-list-tabs/ohri-patient-list-tabs.component.tsx +++ b/packages/esm-commons-lib/src/components/patient-list-tabs/ohri-patient-list-tabs.component.tsx @@ -1,35 +1,45 @@ -import React from 'react'; +import React, { useState } from 'react'; import { Tabs, Tab, TabList, TabPanels, TabPanel } from '@carbon/react'; import { CohortPatientList } from '../cohort-patient-list/cohort-patient-list.component'; import styles from './ohri-patient-list-tabs.scss'; export function OHRIPatientListTabs({ patientListConfigs, moduleName }) { + const [activeTabIndex, setActiveTabIndex] = useState(0); // State to track active tab index + const handleTabChange = ({selectedIndex}) => { + setActiveTabIndex(selectedIndex); + }; return ( - + {patientListConfigs.map((config, index) => { - return {config.label}; + return ( + + {config.label} + + ); })} {patientListConfigs.map((config, index) => { return ( - + {index === activeTabIndex && ( + + )} ); })} diff --git a/packages/esm-commons-lib/src/components/patient-table/patient-table.component.tsx b/packages/esm-commons-lib/src/components/patient-table/patient-table.component.tsx index 170d62d92..be0f4d75d 100644 --- a/packages/esm-commons-lib/src/components/patient-table/patient-table.component.tsx +++ b/packages/esm-commons-lib/src/components/patient-table/patient-table.component.tsx @@ -1,6 +1,5 @@ -import React, { useId, useMemo, useState } from 'react'; +import React, { useMemo, useState } from 'react'; import type { CSSProperties, HTMLAttributes } from 'react'; -import fuzzy from 'fuzzy'; import { useTranslation } from 'react-i18next'; import { Button, @@ -11,7 +10,6 @@ import { Layer, Modal, Pagination, - Search, Table, TableBody, TableCell, @@ -21,10 +19,13 @@ import { TableRow, Tile, } from '@carbon/react'; -import { TrashCan } from '@carbon/react/icons'; -import { ConfigurableLink, useLayoutType, isDesktop, useDebounce } from '@openmrs/esm-framework'; +import { AudioConsole, TrashCan } from '@carbon/react/icons'; +import { ConfigurableLink, useLayoutType, isDesktop, usePagination } from '@openmrs/esm-framework'; import { EmptyDataIllustration } from '../empty-state/empty-data-illustration.component'; import styles from './patient-table.scss'; +import { TableToolbar } from '@carbon/react'; +import { TableToolbarContent } from '@carbon/react'; +import { TableToolbarSearch } from '@carbon/react'; // FIXME Temporarily included types from Carbon type InputPropsBase = Omit, 'onChange'>; @@ -126,17 +127,6 @@ interface PatientTableProps { patients: Array; isFetching?: boolean; isLoading: boolean; - mutateListDetails: () => void; - mutateListMembers: () => void; - pagination: { - usePagination: boolean; - currentPage: number; - onChange(props: any): any; - pageSize: number; - totalItems: number; - pagesUnknown?: boolean; - lastPage?: boolean; - }; style?: CSSProperties; } @@ -153,41 +143,23 @@ export const PatientTable: React.FC = ({ columns, isFetching, isLoading, - mutateListDetails, - mutateListMembers, - pagination, patients, }) => { const { t } = useTranslation(); - const id = useId(); const layout = useLayoutType(); const responsiveSize = isDesktop(layout) ? 'sm' : 'lg'; const [isDeleting, setIsDeleting] = useState(false); const [membershipUuid, setMembershipUuid] = useState(''); const [patientName, setPatientName] = useState(''); - const [searchTerm, setSearchTerm] = useState(''); const [showConfirmationModal, setShowConfirmationModal] = useState(false); - const debouncedSearchTerm = useDebounce(searchTerm); - - const filteredPatients = useMemo(() => { - if (!debouncedSearchTerm) { - return patients; - } - - return debouncedSearchTerm - ? fuzzy - .filter(debouncedSearchTerm, patients, { - extract: (patient: any) => `${patient.name} ${patient.identifier} ${patient.sex}`, - }) - .sort((r1, r2) => r1.score - r2.score) - .map((result) => result.original) - : patients; - }, [debouncedSearchTerm, patients]); + const [currentPageSize, setPageSize] = useState(10); + const pageSizes = [10, 20, 50, 100, 250]; + const { goTo, results, currentPage } = usePagination(patients, currentPageSize); const tableRows: Array = useMemo( () => - filteredPatients.map((patient, index) => { + results.map((patient, index) => { const row = { id: String(index), }; @@ -203,7 +175,8 @@ export const PatientTable: React.FC = ({ }); return row; }) ?? [], - [columns, filteredPatients], + + [columns, results], ); if (isLoading) { @@ -226,22 +199,27 @@ export const PatientTable: React.FC = ({
{isFetching && }
-
- - ) => setSearchTerm(e.target.value)} - placeholder={t('searchThisList', 'Search this list')} - size={responsiveSize} - /> - -
- {({ rows, headers, getHeaderProps, getTableProps, getRowProps }) => ( + {({ rows, headers, getHeaderProps, getTableProps, getRowProps, onInputChange }) => ( + + + + + @@ -295,7 +273,7 @@ export const PatientTable: React.FC = ({ )} - {filteredPatients?.length === 0 && ( + {results?.length === 0 && (
@@ -307,20 +285,22 @@ export const PatientTable: React.FC = ({
)} - {pagination.usePagination && ( - - )} + { + if (pageSize !== currentPageSize) { + setPageSize(pageSize); + } + if (page !== currentPage) { + goTo(page); + } + }} + /> {showConfirmationModal && ( div { - align-self: center; - justify-self: end; -} - -.searchOverrides { - width: 100%; - max-width: 250px; - border: 0px !important; -} - div.tableOverride { background-color: $ui-01; } @@ -46,19 +28,6 @@ div#table-tool-bar { height: spacing.$spacing-09 !important; } -.paginationOverride { - background-color: $ui-background; - border-top: 1px solid $ui-03 !important; - border-bottom: 1px solid $ui-03 !important; - overflow-x: hidden; -} - -.paginationOverride > div { - background-color: $ui-background; - border-bottom: 0px !important; - border-top: 0px !important; -} - .link { text-decoration: none; } @@ -146,3 +115,16 @@ div#table-tool-bar { @include type.type-style('body-compact-01'); color: $text-02; } + +.search { + max-width: 16rem; + + input { + background-color: $ui-02 !important; + } +} + +.toolbarContent { + height: spacing.$spacing-07; + margin-bottom: spacing.$spacing-02; +} \ No newline at end of file diff --git a/packages/esm-commons-lib/src/components/patient-table/patient-table.test.tsx b/packages/esm-commons-lib/src/components/patient-table/patient-table.test.tsx index 90fc7636b..d3a6c53fc 100644 --- a/packages/esm-commons-lib/src/components/patient-table/patient-table.test.tsx +++ b/packages/esm-commons-lib/src/components/patient-table/patient-table.test.tsx @@ -11,23 +11,12 @@ describe('PatientTable', () => { { key: 'age', header: 'Age', getValue: (patient) => patient.age }, ]; - const mockPagination = { - usePagination: true, - currentPage: 1, - onChange: jest.fn(), - pageSize: 10, - totalItems: 20, - }; - it('renders patient table correctly with specific columns and patient', () => { const { getByText } = render( {}} - mutateListMembers={() => {}} - pagination={mockPagination} patients={mockPatients} />, ); @@ -45,9 +34,6 @@ describe('PatientTable', () => { columns={mockColumns} isFetching={false} isLoading={true} - mutateListDetails={() => {}} - mutateListMembers={() => {}} - pagination={mockPagination} patients={[]} />, ); @@ -63,9 +49,6 @@ describe('PatientTable', () => { columns={mockColumns} isFetching={false} isLoading={false} - mutateListDetails={() => {}} - mutateListMembers={() => {}} - pagination={mockPagination} patients={[]} />, ); @@ -81,9 +64,6 @@ describe('PatientTable', () => { columns={mockColumns} isFetching={false} isLoading={false} - mutateListDetails={() => {}} - mutateListMembers={() => {}} - pagination={mockPagination} patients={mockPatients} />, ); diff --git a/packages/esm-commons-lib/src/constants.ts b/packages/esm-commons-lib/src/constants.ts index 03fc744c6..e872b1ff8 100644 --- a/packages/esm-commons-lib/src/constants.ts +++ b/packages/esm-commons-lib/src/constants.ts @@ -8,7 +8,7 @@ export const daysDurationUnit = { export const basePath = '${openmrsSpaBase}/patient/'; export const encounterRepresentation = 'custom:(uuid,encounterDatetime,encounterType,location:(uuid,name),' + - 'patient:(uuid,display,age),encounterProviders:(uuid,provider:(uuid,name)),' + + 'patient:(uuid,display,age,identifiers,person),encounterProviders:(uuid,provider:(uuid,name)),' + 'obs:(uuid,obsDatetime,voided,groupMembers,concept:(uuid,name:(uuid,name)),value:(uuid,name:(uuid,name),' + 'names:(uuid,conceptNameType,name))),form:(uuid,name))'; diff --git a/packages/esm-commons-lib/src/utils/patient-list-tabs-config-builder.ts b/packages/esm-commons-lib/src/utils/patient-list-tabs-config-builder.ts index 591f1be13..9ccbb6018 100644 --- a/packages/esm-commons-lib/src/utils/patient-list-tabs-config-builder.ts +++ b/packages/esm-commons-lib/src/utils/patient-list-tabs-config-builder.ts @@ -14,7 +14,6 @@ export const getPatientListTabsData = (patientListTabsSchema, config) => { index: column.index || null, getValue: (row) => { const { encounter } = row; - if (column.type === 'patientId') { return row.id; } @@ -46,7 +45,6 @@ export const getPatientListTabsData = (patientListTabsSchema, config) => { } return getObsFromEncounter(encounter, column.concept); } - return getObsFromEncounter(encounter, column.concept, column.isDate); }, }; diff --git a/packages/esm-covid-app/src/covid/dashboard/patient-list-tabs/covid-patient-list-schema-config.json b/packages/esm-covid-app/src/covid/dashboard/patient-list-tabs/covid-patient-list-schema-config.json index 0a63e6df1..731c2fbd9 100644 --- a/packages/esm-covid-app/src/covid/dashboard/patient-list-tabs/covid-patient-list-schema-config.json +++ b/packages/esm-covid-app/src/covid/dashboard/patient-list-tabs/covid-patient-list-schema-config.json @@ -24,12 +24,12 @@ { "id": "finalAssessment", "title": "Final result", - "concept": "rapidTestResult" + "concept": "pcrTestResult" }, { "id": "outcome", "title": "Outcome", - "concept": "covidOutcome" + "concept": "covidOutcomeUUID" } ] },