Skip to content

Commit

Permalink
Merge pull request #34 from advanced-computer-lab-2023/health_records
Browse files Browse the repository at this point in the history
not showing any medical record that is file uploaded in health records
  • Loading branch information
MarkMahrous authored Nov 14, 2023
2 parents f3c3bc2 + 0c25239 commit c29aff0
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
5 changes: 5 additions & 0 deletions client/src/layouts/dashboard/config-navigation.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,11 @@ const navConfig = [
path: '/medical-history',
icon: icon('ic_disabled')
},
{
title: 'My Health Records',
path: '/health-record',
icon: icon('ic_analytics'),
},
{
title: 'Not found',
path: '/404',
Expand Down
11 changes: 10 additions & 1 deletion server/src/services/patient.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -231,14 +231,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');
};

const getHealthPackage = async (userID: string) => {
const user = await Patient.findOne({ _id: userID });

Expand Down

0 comments on commit c29aff0

Please sign in to comment.