diff --git a/packages/esm-tb-app/src/config-schema.ts b/packages/esm-tb-app/src/config-schema.ts index f3a3121c0..ffd5ccb47 100644 --- a/packages/esm-tb-app/src/config-schema.ts +++ b/packages/esm-tb-app/src/config-schema.ts @@ -16,6 +16,8 @@ export const configSchema = { tbPatientTracing: '98c938e9-fb3e-4982-ae22-0305cbd12f8c', tbProgramEnrollment: '9a199b59-b185-485b-b9b3-a9754e65ae57', tbTreatmentAndFollowUp: '1881304a-4854-4927-b0b1-a6231d61e43c', + tptCaseEnrollment: 'dc6ce80c-83f8-4ace-a638-21df78542551', + tptTreatmentAndFollowUp: '1ac3de3f-8fc2-43a7-addb-e805c393ecae', }, }, obsConcepts: { @@ -47,6 +49,12 @@ export const configSchema = { tBEnrollmentType: '163775AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', dsTBEnrollment: '160541AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', dRTBEnrollment: '160052AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + tptTreatmentId: '162727AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + tptEnrollmentDate: '164852AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + tptIndication: '162276AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + tptRegimen: '1264AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + tptAppointmentDate: '5096AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + tptAdherence: '164075AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', }, }, cohorts: { diff --git a/packages/esm-tb-app/src/views/tpt/patient-summary/patient-summary.component.tsx b/packages/esm-tb-app/src/views/tpt/patient-summary/patient-summary.component.tsx index ac9e64b03..012205e1c 100644 --- a/packages/esm-tb-app/src/views/tpt/patient-summary/patient-summary.component.tsx +++ b/packages/esm-tb-app/src/views/tpt/patient-summary/patient-summary.component.tsx @@ -1,19 +1,87 @@ -import React from 'react'; +import { + EmptyStateComingSoon, + EncounterList, + EncounterListColumn, + PatientChartProps, + SummaryCard, + SummaryCardColumn, + getObsFromEncounter, +} from '@ohri/openmrs-esm-ohri-commons-lib'; +import { useConfig } from '@openmrs/esm-framework'; +import React, { useMemo } from 'react'; import { useTranslation } from 'react-i18next'; -import { EmptyStateComingSoon } from '@ohri/openmrs-esm-ohri-commons-lib'; +import { moduleName } from '../../..'; -interface TptPatientSummaryProps { - patientUuid: string; -} - -const TptPatientSummary: React.FC = ({ patientUuid }) => { +const TptPatientSummary: React.FC = ({ patientUuid }) => { const { t } = useTranslation(); + const { obsConcepts, encounterTypes } = useConfig(); + + const headerRecentTPT = t('recentTptCases', 'Recent TPT Cases'); + const headerPreviousCases = t('previousTptCases', 'Previous TPT Cases'); - const headerTitle = t('patientSummary', 'Patient Summary'); + const recentTbPreventionColumns: SummaryCardColumn[] = useMemo( + () => [ + { + key: 'tptTreatmentId', + header: t('tptTreatmentId', 'TPT Treatment ID'), + encounterTypes: [encounterTypes.tptCaseEnrollment], + getObsValue: async ([encounter]) => { + return getObsFromEncounter(encounter, obsConcepts.tptTreatmentId); + }, + }, + { + key: 'tptEnrollmentDate', + header: t('enrollmentDate', 'Enrollment Date'), + encounterTypes: [encounterTypes.tptCaseEnrollment], + getObsValue: async ([encounter]) => { + return getObsFromEncounter(encounter, obsConcepts.tptEnrollmentDate, true); + }, + }, + { + key: 'tptIndication', + header: t('indication', 'Indication'), + encounterTypes: [encounterTypes.tptCaseEnrollment], + getObsValue: (encounter) => { + return getObsFromEncounter(encounter, obsConcepts.tptIndication); + }, + }, + { + key: 'tptRegimen', + header: t('regimen', 'Regimen'), + encounterTypes: [encounterTypes.tptCaseEnrollment], + getObsValue: (encounter) => { + return getObsFromEncounter(encounter, obsConcepts.tptRegimen); + }, + }, + { + key: 'tptAdherence', + header: t('tptAdherence', 'Adherence'), + encounterTypes: [encounterTypes.tptTreatmentAndFollowUp], + getObsValue: (encounter) => { + return getObsFromEncounter(encounter, obsConcepts.tptAdherence); + }, + }, + { + key: 'tptAppointmentDate', + header: t('nextAppointmentDate', 'Next Appointment Date'), + encounterTypes: [encounterTypes.tptTreatmentAndFollowUp], + getObsValue: (encounter) => { + return getObsFromEncounter(encounter, obsConcepts.tptAppointmentDate, true); + }, + }, + ], + [], + ); return ( <> - + + ); }; diff --git a/packages/esm-tb-app/translations/en.json b/packages/esm-tb-app/translations/en.json index 7275f3a44..be686e76e 100644 --- a/packages/esm-tb-app/translations/en.json +++ b/packages/esm-tb-app/translations/en.json @@ -33,5 +33,12 @@ "tptTreatment": "TPT Treatment", "patientSummary": "Patient Summary", "allTptClients": "All TPT Clients", - "currentTptClients": "Clients Currently on TPT" + "currentTptClients": "Clients Currently on TPT", + "tptTreatmentId": "TPT Treatment ID", + "indication": "Indication", + "tptAdherence": "Adherence", + "nextAppointmentDate": "Next Appointment Date", + "previousCases": "Previous TPT Cases", + "previousTptCases": "Recent TPT Cases" + }