From 2e9ecc76323c2f8cfef3f79784ee765335f46d41 Mon Sep 17 00:00:00 2001 From: lucyjemutai Date: Tue, 21 May 2024 15:04:47 +0300 Subject: [PATCH] fetching patient uuid --- .../views/mch-summary/mch-summary.component.tsx | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/packages/esm-ohri-pmtct-app/src/views/mch-summary/mch-summary.component.tsx b/packages/esm-ohri-pmtct-app/src/views/mch-summary/mch-summary.component.tsx index d2fd4cea4..809adf959 100644 --- a/packages/esm-ohri-pmtct-app/src/views/mch-summary/mch-summary.component.tsx +++ b/packages/esm-ohri-pmtct-app/src/views/mch-summary/mch-summary.component.tsx @@ -18,16 +18,16 @@ const MaternalSummary: React.FC = ({ patientUuid }) => { useEffect(() => { if (patient) { - const lastIdentifier = patient.identifier - .slice() - .reverse() - .find((identifier) => identifier.type.id === identifiersTypes.PTrackerIdentifierType); + const reversedIdentifiers = patient.identifier.slice().reverse(); + const pTrackerIdentifier = reversedIdentifiers.find((identifier) => { + return identifier.type.coding[0].code === identifiersTypes.ptrackerIdentifierType; + }); - if (lastIdentifier) { - setPtrackerId(lastIdentifier.value); + if (pTrackerIdentifier) { + setPtrackerId(pTrackerIdentifier.value); } } - }, [patient]); + }, [identifiersTypes.PTrackerIdentifierType, identifiersTypes.ptrackerIdentifierType, patient]); return ( <>