Skip to content

Commit

Permalink
fetching patient uuid
Browse files Browse the repository at this point in the history
  • Loading branch information
lucyjemutai committed May 21, 2024
1 parent 3b50cd1 commit 2e9ecc7
Showing 1 changed file with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,16 @@ const MaternalSummary: React.FC<PatientChartProps> = ({ 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 (
<>
Expand Down

0 comments on commit 2e9ecc7

Please sign in to comment.