From 6f4bf989d104d763fbe3937793fbf63b00b01c5b Mon Sep 17 00:00:00 2001 From: Mark Mahrous Date: Tue, 14 Nov 2023 13:48:36 +0200 Subject: [PATCH 1/2] not showing any medical record that is file uploaded in health records --- server/src/services/patient.service.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/server/src/services/patient.service.ts b/server/src/services/patient.service.ts index e589474..dd9b63e 100644 --- a/server/src/services/patient.service.ts +++ b/server/src/services/patient.service.ts @@ -210,13 +210,23 @@ const getHealthRecords = async (patientID: String) => { const healthRecords = user.medicalHistory; if (!healthRecords) throw new HttpError(StatusCodes.NOT_FOUND, 'health records not found'); + //create a new array of objects where the medicalRecord is not a URL + let filteredRecords = healthRecords.filter((record: any) => isNotURL(record.medicalRecord)); + if (!filteredRecords) throw new HttpError(StatusCodes.NOT_FOUND, 'health records not found'); + // console.log(healthRecords); + // console.log(filteredRecords); return { - result: healthRecords, + result: filteredRecords, status: StatusCodes.OK, message: 'Health records retrieved successfully' }; }; + +const isNotURL = (str: String) => { + return !str.endsWith('.pdf') && !str.endsWith('.jpeg') && !str.endsWith('.jpg') && !str.endsWith('.png'); +}; + export { viewDoctorsForPatient as viewAllDoctorsForPatient, getFamily, From d833949d7f7f48239f8b29bd1921bda2d96acec8 Mon Sep 17 00:00:00 2001 From: Mark Mahrous Date: Tue, 14 Nov 2023 14:41:58 +0200 Subject: [PATCH 2/2] adding option for patient to view his own health records --- client/src/layouts/dashboard/config-navigation.jsx | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/client/src/layouts/dashboard/config-navigation.jsx b/client/src/layouts/dashboard/config-navigation.jsx index 1c990b4..dac7ae2 100644 --- a/client/src/layouts/dashboard/config-navigation.jsx +++ b/client/src/layouts/dashboard/config-navigation.jsx @@ -47,6 +47,11 @@ const navConfig = [ path: '/patients', icon: icon('ic_user'), }, + { + title: 'My Health Records', + path: '/health-record', + icon: icon('ic_analytics'), + }, { title: 'Not found', path: '/404',