Skip to content

advanced-computer-lab-2023/MangoDB-Clinic

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation


Logo

MangoDB Virtual Clinic

Next-Level Care, One Click Away

Table of Contents
  1. About The Project
  2. Getting Started
  3. Running Tests
  4. Code Specifcations
  5. Generate API Documentation
  6. Contributing
  7. Credits
  8. License

About The Project

Description 🧾

MangoDB Virtual Clinic is a comprehensive virtual healthcare platform that bridges the gap between patients, doctors, and administrators. Our platform is built on the principles of accessibility, efficiency, and security, ensuring that every interaction within the healthcare ecosystem is seamless and beneficial. The platform offers a user-friendly interface for patients to manage their health records, schedule appointments, and avail of exclusive discounts on medicines through subscription packages. Doctors, on the other hand, have tools to efficiently manage prescriptions, appointments, and patient interactions.

(back to top)

Features ✨

Patient-Centric Features:
  1. User Registration and Authentication:

    • Securely register as a patient with authentication mechanisms to protect user information.
    • Easily change your passowrd anytime.
  2. Doctor Interaction:

    • View profiles of all available doctors.
    • Conduct video calls with doctors for remote consultations.
    • Engage in two-way communication with healthcare providers through secure messaging.
  3. Convenient Appointment Scheduling:

    • Schedule appointments with available doctors.
    • Receive automated reminders through our system or by mail well in advance to ensure you never miss a scheduled appointment.
    • Receive instant notifications in-app and via email if there are any changes to your scheduled appointments.
  4. Subscription Packages:

    • Subscribe to yearly packages for exclusive discounts on medicines and additional perks.
    • Link family members to extend benefits to them.
  5. Prescription Management:

    • View and manage all prescriptions written by doctors.
    • Download your prescription for easy access.
  6. Wallet for Hassle-Free Payments:

    • Utilize a wallet for easy and secure payments within the platform.
  7. Personalized Health Records:

    • Store and manage your health records in a centralized and secure environment.
    • Access your medical history anytime, anywhere, facilitating informed decision-making.
Doctor-Empowering Tools:
  1. Streamlined Prescription Management:

    • View all prescriptions written for patients.
    • Modify prescriptions as needed.
  2. Patient Interaction Hub:

    • View a list of all patients with whom at least one appointment has been scheduled.
    • Streamline communication and follow-up care through video calls for enhanced patient outcomes.
    • Engage in real-time chat conversations with patients with whom you have scheduled appointments.
  3. Efficient Appointment Management:

    • Organize and manage appointments efficiently, optimizing the doctor's schedule.
    • View upcoming appointments.
  4. Notifications System:

    • Be promptly informed about cancellations or rescheduling to adapt your plans accordingly.
    • Utilize our user-friendly interface to view updated appointment details and take necessary actions.
Administrator Oversight:
  1. Centralized System Control:

    • Administrators have a powerful interface to oversee and manage all aspects of the MangoDB Virtual Clinic.
    • Ensure compliance, security, and seamless operation of the entire healthcare platform.
  2. Analytics and Reporting:

    • Leverage comprehensive analytics to gain insights into user engagement, appointment trends, and overall system performance.
    • Generate detailed reports to inform strategic decisions and enhance the overall user experience.

Screenshots πŸ“Έ

Landing Page

Landing Page

List Of Doctors

Doctor's List

Doctor's HomePage

Doctor's HomePage

Doctor's Appointments

Doctor's Appointments

Doctor's Registration

Doctor's Registration

Patient's Packages

Patient's Packages

Patient's Appointments

Patient's Appointments

Built With πŸ› οΈ

Tech/Framework used:

  • Node
  • React
  • Express
  • Mui
  • Mongo
  • JWT
  • Stripe
  • Figma
  • VScode
  • Postman
  • Github
  • Git
  • Dailyco

Build Status

  • The project is currently in development.
  • Unit Tests needs to be implemented.
  • Some input fields are case senstive.
  • Cookies may be implemented for smoother operations.
  • Files sizes too large due to redundant code and could be more organized.
  • The use of comments may be increased to aid in future maintenance.
  • Ui could be improved.
  • There may bugs that isn't found yet.
    • (back to top)

      Getting Started

      To set up MangoDB Virtual Clinic locally and start exploring its features, follow these simple steps:

      Prerequisites

      Before you begin, make sure you have the following installed on your machine:

      • Node.js - Ensure Node.js is installed to run the application.
      • MongoDB - Set up a MongoDB database to store application data.
      • VScode - Install any IDE to run the project on.
      • Stripe - Head to Stripe and get your Stipe private key.

      Installation πŸ“₯

      1. Clone the repo

        git clone https://github.com/advanced-computer-lab-2023/MangoDB-Clinic.git
      2. Navigate to the project directory:

        cd MangoDB-Clinic
      3. Install NPM packages

        npm install
      4. Navigate to the frontend folder:

        cd frontned
      5. Install NPM packages

        npm install
      6. Create a .env File:

        In the root directory of MangoDB Virtual Clinic, create a .env file with the following content:

         # MongoDB Connection URI
         MONGO_URI="your_mongodb_url"
        
         # JSON Web Token Secret
         JWT_SECRET="your_secure_passphrase"
        
         # Stripe Private Key
         STRIPE_PRIVATE_KEY="your_stripe_private_key" 

        Make sure to replace the placeholder values with your actual MongoDB connection URL, a secure passphrase for JWT, and your Stripe private key.

        Note: Keep your `.env file secure and never expose it to the public. It contains sensitive information required for the proper functioning of MangoDB Virtual Clinic.

      7. Navigate Back to the Root Directory:

        After creating the .env file, navigate back to the root directory of MangoDB Virtual Clinic:

        cd ..
        
      8. Run the Application:

        npm run dev

        This command will launch MangoDB Virtual Clinic with the specified configurations from your .env file. Access the application in your web browser at http://localhost:3000.

        Note: Ensure that MongoDB is running and accessible before starting the application.

      (back to top)

      Usage

      Experience the MangoDB Virtual Clinic by following these simple steps:

      1. Open your Web Browser:

        • Launch your preferred web browser.
      2. Visit MangoDB Virtual Clinic:

      3. Register Your Account:

        • Sign up as either a patient or a doctor to unlock the platform's rich features.
      4. Explore the Patient Dashboard:

        • Dive into the intuitive patient dashboard to seamlessly manage your health journey.
      5. Schedule Appointments:

        • Use the scheduling feature to book appointments with your chosen healthcare professional.
      6. Manage Prescriptions:

        • Keep track of your prescriptions, and easily modify or renew them when needed.
      7. Exclusive Subscription Packages:

        • Explore and subscribe to exclusive yearly packages for discounts on medicines and additional perks.
      8. For Doctors: Efficiently Manage Appointments:

        • Access tools to manage appointments efficiently, ensuring optimal scheduling and patient care.
      9. For Doctors: Streamlined Prescription Management:

        • View and modify prescriptions with ease, providing accurate and up-to-date medical information.
      10. For Doctors: Engage with Patients:

        • View patient interactions and communicate effectively to enhance overall healthcare outcomes.

      Note: To gain full experience try first filling the database with doctors and patients so you can see all the features.

      (back to top)

      Running Tests

      The testing is done using Postman **Note:**For testing any GET, PUT,

      Login test:

      You should register first a doctor or a patient to test the Login loginPostman

      Prescriptions test: Enter the token you got from the login in bearer auth in postman

      getPrescPostman

      Note: You may get an empty array in case there are no prescriptions.

      add Prescription:

      addPrescPostman

      Check Patient's health package test:

      checkPackagePostman

      Get Family Members test:

      getFamilyMembers

      Add Family Members test:

      addFamilyMembers

      Filter Doctors test:

      filterDoctors

      Code Specifcations βš™οΈ

      Structure:
      .
      β”œβ”€β”€ README.md
      β”œβ”€β”€ backend
      β”‚ β”œβ”€β”€ config
      β”‚ β”‚ └── db.js
      β”‚ β”œβ”€β”€ controllers
      β”‚ β”‚ β”œβ”€β”€ adminController.js
      β”‚ β”‚ β”œβ”€β”€ doctorController.js
      β”‚ β”‚ β”œβ”€β”€ guestController.js
      β”‚ β”‚ └── patientController.js
      β”‚ β”œβ”€β”€ middleware
      β”‚ β”‚ β”œβ”€β”€ adminMiddleware.js
      β”‚ β”‚ β”œβ”€β”€ authMiddleware.js
      β”‚ β”‚ β”œβ”€β”€ doctorMiddleware.js
      β”‚ β”‚ β”œβ”€β”€ errorMiddleware.js
      β”‚ β”‚ β”œβ”€β”€ patientMiddleware.js
      β”‚ β”‚ β”œβ”€β”€ stripeMiddleware.js
      β”‚ β”‚ └── upload.js
      β”‚ β”œβ”€β”€ models
      β”‚ β”‚ β”œβ”€β”€ adminModel.js
      β”‚ β”‚ β”œβ”€β”€ appointmentModel.js
      β”‚ β”‚ β”œβ”€β”€ doctorModel.js
      β”‚ β”‚ β”œβ”€β”€ packagesModel.js
      β”‚ β”‚ β”œβ”€β”€ patientModel.js
      β”‚ β”‚ β”œβ”€β”€ prescriptionModel.js
      β”‚ β”‚ β”œβ”€β”€ userModel.js
      β”‚ β”‚ └── walletModel.js
      β”‚ β”œβ”€β”€ routes
      β”‚ β”‚ β”œβ”€β”€ adminRoutes.js
      β”‚ β”‚ β”œβ”€β”€ doctorRoutes.js
      β”‚ β”‚ β”œβ”€β”€ guestRoutes.js
      β”‚ β”‚ └── patientRoutes.js
      β”‚ β”œβ”€β”€ server.js
      β”‚ └── views
      β”‚ β”œβ”€β”€ addFamilyMember.ejs
      β”‚ β”œβ”€β”€ adminDashboard.ejs
      β”‚ β”œβ”€β”€ doctorHomePage.ejs
      β”‚ β”œβ”€β”€ doctorRegistration.ejs
      β”‚ β”œβ”€β”€ patientDashboard.ejs
      β”‚ β”œβ”€β”€ patientRegistration.ejs
      β”‚ β”œβ”€β”€ selectedPatient.ejs
      β”‚ └── viewAllPatients.ejs
      β”œβ”€β”€ frontend
      β”‚ β”œβ”€β”€ README.md
      β”‚ β”œβ”€β”€ package-lock.json
      β”‚ β”œβ”€β”€ package.json
      β”‚ β”œβ”€β”€ public
      β”‚ β”‚ β”œβ”€β”€ favicon.ico
      β”‚ β”‚ β”œβ”€β”€ icons
      β”‚ β”‚ β”‚ β”œβ”€β”€ accept.svg
      β”‚ β”‚ β”‚ β”œβ”€β”€ add.svg
      β”‚ β”‚ β”‚ β”œβ”€β”€ addMember.svg
      β”‚ β”‚ β”‚ β”œβ”€β”€ address.svg
      β”‚ β”‚ β”‚ β”œβ”€β”€ appointment.svg
      β”‚ β”‚ β”‚ β”œβ”€β”€ approvedDocument.svg
      β”‚ β”‚ β”‚ β”œβ”€β”€ call.svg
      β”‚ β”‚ β”‚ β”œβ”€β”€ cart.svg
      β”‚ β”‚ β”‚ β”œβ”€β”€ certificate.svg
      β”‚ β”‚ β”‚ β”œβ”€β”€ chart.svg
      β”‚ β”‚ β”‚ β”œβ”€β”€ chat.svg
      β”‚ β”‚ β”‚ β”œβ”€β”€ clinic.svg
      β”‚ β”‚ β”‚ β”œβ”€β”€ clinicLogo.svg
      β”‚ β”‚ β”‚ β”œβ”€β”€ clinicLogo2.svg
      β”‚ β”‚ β”‚ β”œβ”€β”€ clinicalDocument.svg
      β”‚ β”‚ β”‚ β”œβ”€β”€ clinicalRecord.svg
      β”‚ β”‚ β”‚ β”œβ”€β”€ creditCard.svg
      β”‚ β”‚ β”‚ β”œβ”€β”€ dashboard.svg
      β”‚ β”‚ β”‚ β”œβ”€β”€ date.svg
      β”‚ β”‚ β”‚ β”œβ”€β”€ defaultLogo.svg
      β”‚ β”‚ β”‚ β”œβ”€β”€ deniedDocument.svg
      β”‚ β”‚ β”‚ β”œβ”€β”€ editDocument.svg
      β”‚ β”‚ β”‚ β”œβ”€β”€ family.svg
      β”‚ β”‚ β”‚ β”œβ”€β”€ familyFolder.svg
      β”‚ β”‚ β”‚ β”œβ”€β”€ filter.svg
      β”‚ β”‚ β”‚ β”œβ”€β”€ finance.svg
      β”‚ β”‚ β”‚ β”œβ”€β”€ healthPackage.svg
      β”‚ β”‚ β”‚ β”œβ”€β”€ index.js
      β”‚ β”‚ β”‚ β”œβ”€β”€ info.svg
      β”‚ β”‚ β”‚ β”œβ”€β”€ login.svg
      β”‚ β”‚ β”‚ β”œβ”€β”€ logoEmblem.svg
      β”‚ β”‚ β”‚ β”œβ”€β”€ logout.svg
      β”‚ β”‚ β”‚ β”œβ”€β”€ meds.svg
      β”‚ β”‚ β”‚ β”œβ”€β”€ medsV2.svg
      β”‚ β”‚ β”‚ β”œβ”€β”€ menu.svg
      β”‚ β”‚ β”‚ β”œβ”€β”€ mobile.svg
      β”‚ β”‚ β”‚ β”œβ”€β”€ notes.svg
      β”‚ β”‚ β”‚ β”œβ”€β”€ notifications.svg
      β”‚ β”‚ β”‚ β”œβ”€β”€ password.svg
      β”‚ β”‚ β”‚ β”œβ”€β”€ patient.svg
      β”‚ β”‚ β”‚ β”œβ”€β”€ person.svg
      β”‚ β”‚ β”‚ β”œβ”€β”€ pharmacist.svg
      β”‚ β”‚ β”‚ β”œβ”€β”€ pharmacy.svg
      β”‚ β”‚ β”‚ β”œβ”€β”€ pharmacyLogo.svg
      β”‚ β”‚ β”‚ β”œβ”€β”€ pharmacyLogo2.svg
      β”‚ β”‚ β”‚ β”œβ”€β”€ preferences.svg
      β”‚ β”‚ β”‚ β”œβ”€β”€ prescription.svg
      β”‚ β”‚ β”‚ β”œβ”€β”€ profile.svg
      β”‚ β”‚ β”‚ β”œβ”€β”€ reject.svg
      β”‚ β”‚ β”‚ β”œβ”€β”€ remove.svg
      β”‚ β”‚ β”‚ β”œβ”€β”€ search.svg
      β”‚ β”‚ β”‚ β”œβ”€β”€ secure.svg
      β”‚ β”‚ β”‚ β”œβ”€β”€ settings.svg
      β”‚ β”‚ β”‚ β”œβ”€β”€ tabIcon.png
      β”‚ β”‚ β”‚ β”œβ”€β”€ ticket.svg
      β”‚ β”‚ β”‚ β”œβ”€β”€ upload.svg
      β”‚ β”‚ β”‚ β”œβ”€β”€ wallet.svg
      β”‚ β”‚ β”‚ └── warning.svg
      β”‚ β”‚ β”œβ”€β”€ index.html
      β”‚ β”‚ β”œβ”€β”€ logo192.png
      β”‚ β”‚ β”œβ”€β”€ logo512.png
      β”‚ β”‚ β”œβ”€β”€ manifest.json
      β”‚ β”‚ └── robots.txt
      β”‚ └── src
      β”‚ β”œβ”€β”€ App.css
      β”‚ β”œβ”€β”€ App.js
      β”‚ β”œβ”€β”€ App.test.js
      β”‚ β”œβ”€β”€ components
      β”‚ β”‚ β”œβ”€β”€ AccountBalance.js
      β”‚ β”‚ β”œβ”€β”€ Admin
      β”‚ β”‚ β”‚ β”œβ”€β”€ AddAdmin.jsx
      β”‚ β”‚ β”‚ β”œβ”€β”€ AddPackage.jsx
      β”‚ β”‚ β”‚ β”œβ”€β”€ AdminDashboard.jsx
      β”‚ β”‚ β”‚ β”œβ”€β”€ ChangePasswordAdmin.jsx
      β”‚ β”‚ β”‚ β”œβ”€β”€ Chart.jsx
      β”‚ β”‚ β”‚ β”œβ”€β”€ DateCard.jsx
      β”‚ β”‚ β”‚ β”œβ”€β”€ EditHealthPackage.jsx
      β”‚ β”‚ β”‚ β”œβ”€β”€ ForgotPasswordAdmin.jsx
      β”‚ β”‚ β”‚ β”œβ”€β”€ HealthPackages.jsx
      β”‚ β”‚ β”‚ β”œβ”€β”€ LoginAdmin.jsx
      β”‚ β”‚ β”‚ β”œβ”€β”€ RemoveAdmin.jsx
      β”‚ β”‚ β”‚ β”œβ”€β”€ RemoveDoctor.jsx
      β”‚ β”‚ β”‚ β”œβ”€β”€ RemovePatient.jsx
      β”‚ β”‚ β”‚ β”œβ”€β”€ RequestedDoctors.jsx
      β”‚ β”‚ β”‚ β”œβ”€β”€ RequestedDoctorsTable.jsx
      β”‚ β”‚ β”‚ β”œβ”€β”€ Title.jsx
      β”‚ β”‚ β”‚ β”œβ”€β”€ UserManagement.jsx
      β”‚ β”‚ β”‚ └── listItems.jsx
      β”‚ β”‚ β”œβ”€β”€ ChangePasswordDoctor.js
      β”‚ β”‚ β”œβ”€β”€ Dashboard.js
      β”‚ β”‚ β”œβ”€β”€ Doctor
      β”‚ β”‚ β”‚ β”œβ”€β”€ DoctorForm.js
      β”‚ β”‚ β”‚ β”œβ”€β”€ DoctorListItems.js
      β”‚ β”‚ β”‚ └── Reschedule.js
      β”‚ β”‚ β”œβ”€β”€ DoctorDetails.js
      β”‚ β”‚ β”œβ”€β”€ DoctorSearch.js
      β”‚ β”‚ β”œβ”€β”€ DoctorsTable.js
      β”‚ β”‚ β”œβ”€β”€ Filter.js
      β”‚ β”‚ β”œβ”€β”€ GeneralComponents
      β”‚ β”‚ β”‚ β”œβ”€β”€ ForgotPasswordUser.jsx
      β”‚ β”‚ β”‚ β”œβ”€β”€ LoginUser.jsx
      β”‚ β”‚ β”‚ β”œβ”€β”€ PrescriptionsTable.js
      β”‚ β”‚ β”‚ └── Spinner.jsx
      β”‚ β”‚ β”œβ”€β”€ NavBar.js
      β”‚ β”‚ β”œβ”€β”€ Patient
      β”‚ β”‚ β”‚ β”œβ”€β”€ ChangePasswordPatient.js
      β”‚ β”‚ β”‚ β”œβ”€β”€ Notification.js
      β”‚ β”‚ β”‚ β”œβ”€β”€ PatientForm.js
      β”‚ β”‚ β”‚ └── patientListItems.js
      β”‚ β”‚ β”œβ”€β”€ PrescriptionDetails.jsx
      β”‚ β”‚ └── ReusableTable2.js
      β”‚ β”œβ”€β”€ index.css
      β”‚ β”œβ”€β”€ index.js
      β”‚ β”œβ”€β”€ pages
      β”‚ β”‚ β”œβ”€β”€ AddHealthRecordsPatient.js
      β”‚ β”‚ β”œβ”€β”€ AddSlots.js
      β”‚ β”‚ β”œβ”€β”€ Admin
      β”‚ β”‚ β”‚ β”œβ”€β”€ AddAdminPage.jsx
      β”‚ β”‚ β”‚ β”œβ”€β”€ AddPackagePage.jsx
      β”‚ β”‚ β”‚ β”œβ”€β”€ ChangePasswordPage.jsx
      β”‚ β”‚ β”‚ β”œβ”€β”€ DashboardPage.jsx
      β”‚ β”‚ β”‚ β”œβ”€β”€ EditHealthPackagePage.jsx
      β”‚ β”‚ β”‚ β”œβ”€β”€ ForgotPasswordAdminPage.jsx
      β”‚ β”‚ β”‚ β”œβ”€β”€ HealthPackagesPage.jsx
      β”‚ β”‚ β”‚ β”œβ”€β”€ LoginAdminPage.jsx
      β”‚ β”‚ β”‚ β”œβ”€β”€ RemoveAdminPage.jsx
      β”‚ β”‚ β”‚ β”œβ”€β”€ RemoveDoctorPage.jsx
      β”‚ β”‚ β”‚ β”œβ”€β”€ RemovePatientPage.jsx
      β”‚ β”‚ β”‚ β”œβ”€β”€ RequestedDoctorsPage.jsx
      β”‚ β”‚ β”‚ └── UserManagementPage.jsx
      β”‚ β”‚ β”œβ”€β”€ Cancel.js
      β”‚ β”‚ β”œβ”€β”€ Checkout.js
      β”‚ β”‚ β”œβ”€β”€ Doctor
      β”‚ β”‚ β”‚ β”œβ”€β”€ ChangePasswordDoctorPage.js
      β”‚ β”‚ β”‚ β”œβ”€β”€ DoctorApps.js
      β”‚ β”‚ β”‚ β”œβ”€β”€ EditDoctor.js
      β”‚ β”‚ β”‚ β”œβ”€β”€ PatientDetails.js
      β”‚ β”‚ β”‚ β”œβ”€β”€ PatientList.js
      β”‚ β”‚ β”‚ β”œβ”€β”€ ViewPrescriptionsDoctor.js
      β”‚ β”‚ β”‚ └── doctorDashboard.jsx
      β”‚ β”‚ β”œβ”€β”€ General
      β”‚ β”‚ β”‚ β”œβ”€β”€ ForgotPasswordUserPage.jsx
      β”‚ β”‚ β”‚ └── LoginUserPage.jsx
      β”‚ β”‚ β”œβ”€β”€ Home.js
      β”‚ β”‚ β”œβ”€β”€ LinkFamMember.js
      β”‚ β”‚ β”œβ”€β”€ LinkPatientAsFam.js
      β”‚ β”‚ β”œβ”€β”€ Patient
      β”‚ β”‚ β”‚ β”œβ”€β”€ ChangePasswordPatientPage.js
      β”‚ β”‚ β”‚ β”œβ”€β”€ PatientDashboard.jsx
      β”‚ β”‚ β”‚ β”œβ”€β”€ ViewPackagesPatient.js
      β”‚ β”‚ β”‚ └── ViewPrescriptionsPatient.js
      β”‚ β”‚ β”œβ”€β”€ PrescriptionDetails.js
      β”‚ β”‚ β”œβ”€β”€ Success.js
      β”‚ β”‚ β”œβ”€β”€ ViewAppointments.js
      β”‚ β”‚ β”œβ”€β”€ ViewDoctors.js
      β”‚ β”‚ β”œβ”€β”€ ViewEmploymentContract.js
      β”‚ β”‚ β”œβ”€β”€ ViewFamilyMembers.js
      β”‚ β”‚ β”œβ”€β”€ ViewHealthRecordsPat.js
      β”‚ β”‚ β”œβ”€β”€ ViewPackages.js
      β”‚ β”‚ β”œβ”€β”€ ViewProfile.js
      β”‚ β”‚ β”œβ”€β”€ ViewWallet.js
      β”‚ β”‚ β”œβ”€β”€ cancelHealthPackageSubscription.js
      β”‚ β”‚ β”œβ”€β”€ successfulPackagePayment.js
      β”‚ β”‚ └── viewHealthPackageSubscription.js
      β”‚ β”œβ”€β”€ reportWebVitals.js
      β”‚ β”œβ”€β”€ services
      β”‚ β”‚ └── api.js
      β”‚ β”œβ”€β”€ setupTests.js
      β”‚ β”œβ”€β”€ theme.js
      β”‚ └── useFetch.js
      β”œβ”€β”€ package-lock.json
      β”œβ”€β”€ package.json
      β”œβ”€β”€ readme_images
      β”‚ β”œβ”€β”€ clinicLogo.svg
      β”‚ β”œβ”€β”€ dailyco.png
      β”‚ β”œβ”€β”€ doctorDashboard.png
      β”‚ β”œβ”€β”€ homepage.png
      β”‚ └── pateintDashboard.png
      └── uploads
      └── placeholderImg.jpeg
      Styles πŸͺ„:
      • Indentation: We use spaces for indentation, with a tab width of 2 spaces.
      • Naming Conventions:
        • Follow camelCase for variable, function names, and routes.
        • Use PascalCase for frontend folders and camelcase for backend folders.
      • Comments: Add meaningful comments to explain complex sections of code.
      • Files Managment: Files should be placed at the right place.

      Code Examples:

      Get Prescriptions of patient
      const getAllPrescriptionsOfPatient = async (req, res) => {
      	const patientId = req.user._id;
      
      	if (!mongoose.Types.ObjectId.isValid(patientId)) {
      		return res.status(404).json({ error: "Id Not Found" });
      	}
      
      	try {
      		const patient = await Patient.findById(patientId);
      
      		if (!patient) {
      			return res.status(404).json({ error: "Patient Not Found" });
      		}
      
      		const prescriptions = await Prescription.find({
      			patientId: patientId,
      		})
      			.populate("doctorId")
      			.populate("patientId");
      		console.log(prescriptions);
      		res.status(200).json(prescriptions);
      	} catch (error) {
      		console.error(error);
      		res.status(500).json({ error: "Internal Server Error" });
      	}
      };
      Create Video Chat
      // @desc Create a new video chat with selected doctor
      // @route POST /patient/createVideoChat/:doctorId
      // @access Private
      const createVideoChat = asyncHandler(async (req, res) => {
      	const patient = req.user;
      	const doctor = await Doctor.findById(req.params.doctorId);
      
      	if (!doctor) {
      		res.status(400);
      		throw new Error("Doctor Not Found");
      	}
      
      	fetch("https://api.daily.co/v1/rooms", {
      		method: "POST",
      		headers: {
      			Accept: "application/json",
      			"Content-Type": "application/json",
      			Authorization:
      				"Bearer 8f336eeba4331019a6bab843ab49c57d657a2a3f80fdc0bda2c8afe600a9b3e9",
      		},
      		body: JSON.stringify({
      			name: `Meeting-${generateRandomId(10)}`,
      			properties: {
      				enable_screenshare: true,
      				enable_chat: true,
      				enable_knocking: true,
      				start_video_off: true,
      				start_audio_off: false,
      				lang: "en",
      			},
      		}),
      	})
      		.then((res) => res.json())
      		.then((json) => {
      			console.log("json: ", json);
      			const roomUrl = json.url;
      
      			// Send email to doctor
      			const transporter = nodemailer.createTransport({
      				service: "Gmail",
      				auth: {
      					user: "[email protected]",
      					pass: "vtzilhuubkdtphww",
      				},
      			});
      
      			const mailOptions = {
      				from: "[email protected]",
      				to: doctor.email,
      				subject: `Video Chat Request From ${patient.firstName} ${patient.lastName}`,
      				text: `Hello Dr. ${doctor.lastName},\n\nYou have a video chat scheduled with ${patient.firstName} ${patient.lastName}.\n\nPlease join the video chat using the following URL: ${roomUrl}\n\nBest regards,\nYour Clinic`,
      			};
      
      			transporter.sendMail(mailOptions, (error, info) => {
      				if (error) {
      					console.log("Error sending email:", error);
      				} else {
      					res.status(200).json({
      						message: "Video chat created successfully.",
      						url: roomUrl,
      					});
      					console.log("Email sent:", info.response);
      				}
      			});
      
      			return json;
      		})
      		.catch((err) => console.log("error: ", err));
      });
      Add Prescriptions By Doctor
      const addPrescription = async (req, res) => {
      	const doctorId = req.user.id;
      	const { patientName, date, medications } = req.body;
      
      	if (!patientName || !date) {
      		return res
      			.status(400)
      			.json({ message: "Please enter patient name and date." });
      	}
      	try {
      		const patient = await Patient.findOne({ username: patientName });
      		if (!patient) {
      			return res.status(400).json({ message: "Patient not found." });
      		}
      		const prescription = await Prescription.create({
      			patientId: patient._id,
      			doctorId: doctorId,
      			medications: medications,
      			date: date,
      		});
      		const updatedPrescription = await prescription.populate("patientId");
      		console.log(updatedPrescription);
      		res.status(201).json(updatedPrescription);
      	} catch (error) {
      		console.error(error);
      		res.status(500).json({ message: "Error adding prescription." });
      	}
      };
      View Employment Contract By Doctor
      const viewEmploymentContract = async (req, res) => {
      	try {
      		const doctorId = req.user._id;
      
      		const doctor = await Doctor.findById(doctorId);
      
      		if (!doctor) {
      			return res.status(404).json({ error: "Doctor not found" });
      		}
      
      		if (!doctor.employmentContract || !doctor.employmentContract.file) {
      			return res.status(404).json({ error: "Employment contract not found" });
      		}
      
      		// Construct the file path to the employment contract
      		const filePath = path.join(
      			__dirname,
      			"../uploads/employment_contracts",
      			doctor.employmentContract.file
      		);
      
      		// Check if the file exists
      		if (fs.existsSync(filePath)) {
      			// Return the file as a response
      			res.download(filePath);
      		} else {
      			res.status(404).json({ error: "Employment contract file not found" });
      		}
      	} catch (error) {
      		console.error("Error viewing employment contract:", error);
      		res.status(500).json({ error: "An error occurred" });
      	}
      };
      Create Admin
      // @desc Create new admin
      // @route POST /admin/create-admin
      // @access Private
      const createAdmin = asyncHandler(async (req, res) => {
      	const { email, firstName, lastName } = req.body;
      
      	if (!email || !firstName || !lastName) {
      		res.status(400);
      		throw new Error("Please Enter All Fields");
      	}
      
      	if (!emailValidator(email)) {
      		res.status(400);
      		throw new Error("Invalid Email Format");
      	}
      
      	// Check if admin exists
      	const adminExists = await Admin.findOne({ email });
      
      	if (adminExists) {
      		res.status(400);
      		throw new Error("An Admin With This Email Already Exists");
      	}
      
      	const randomUsername = generateRandomUsername();
      	const password = generateRandomPassword();
      
      	// Hash password
      	const salt = await bcrypt.genSalt(10);
      	const hashedPassword = await bcrypt.hash(password, salt);
      
      	// Create user
      	const admin = await Admin.create({
      		username: randomUsername,
      		email,
      		password: hashedPassword,
      		firstName,
      		lastName,
      	});
      
      	if (admin) {
      		res.status(201).json({
      			_id: admin.id,
      			name: admin.firstName + " " + admin.lastName,
      			username: randomUsername,
      			password: password,
      		});
      	} else {
      		res.status(400);
      		throw new Error("Invalid Data");
      	}
      });
      Login Page return statement:
      return (
      		<ThemeProvider theme={defaultTheme}>
      			<Container component='main' maxWidth='xs'>
      				<CssBaseline />
      				{isLoading ? (
      					<Spinner />
      				) : (
      					<>
      						<Box
      							sx={{
      								marginTop: 8,
      								display: "flex",
      								flexDirection: "column",
      								alignItems: "center",
      							}}
      						>
      							<Avatar sx={{ m: 1, bgcolor: "secondary.main" }}>
      								<LockOutlinedIcon />
      							</Avatar>
      							<Typography component='h1' variant='h5'>
      								Welcome Back πŸ‘‹πŸ½
      							</Typography>
      
      							<Typography component='h4' variant='h5'>
      								Login To Use The Dashboard
      							</Typography>
      
      							<Box
      								component='form'
      								onSubmit={handleSubmit}
      								noValidate
      								sx={{ mt: 1 }}
      							>
      								<TextField
      									margin='normal'
      									required
      									fullWidth
      									id='username'
      									label='Username'
      									name='username'
      									value={formData.username}
      									onChange={handleInputChange}
      									autoComplete='username'
      									autoFocus
      								/>
      								<TextField
      									margin='normal'
      									required
      									fullWidth
      									name='password'
      									label='Password'
      									type='password'
      									id='password'
      									onChange={handleInputChange}
      									value={formData.password}
      									autoComplete='current-password'
      								/>
      								<Button
      									type='submit'
      									fullWidth
      									variant='contained'
      									sx={{ mt: 3, mb: 2 }}
      								>
      									Login
      								</Button>
      								<Grid container>
      									<Grid item xs>
      										<Link href='/forgot-password' color='#2fc4b2'>
      											Forgot password?
      										</Link>
      									</Grid>
      
      									<Grid container justifyContent='space-between'>
      										<Grid item>
      											<Link href='/patientform' color='#2fc4b2'>
      												Register As Patient
      											</Link>
      										</Grid>
      
      										<Grid item>
      											<Link href='/doctorform' color='#2fc4b2'>
      												Register As Doctor
      											</Link>
      										</Grid>
      									</Grid>
      								</Grid>
      							</Box>
      						</Box>
      						<Copyright sx={{ mt: 8, mb: 4 }} />
      					</>
      				)}
      			</Container>
      		</ThemeProvider>
      	);
      Use Effects hooks for getting the packages
      useEffect(() => {
      		const fetchPackages = async () => {
      			setIsPending(true);
      			setError(null);
      
      			const token = localStorage.getItem("token");
      			try {
      				const res = await fetch(
      					"http://localhost:4000/patient/view_health_packages",
      					{
      						method: "GET",
      						headers: {
      							Authorization: `Bearer ${token}`,
      							"Content-Type": "application/json",
      						},
      					}
      				);
      
      				if (!res.ok) {
      					throw Error("Could not fetch the data for that resource");
      				}
      
      				const data = await res.json();
      				setPackages(data);
      				setIsPending(false);
      			} catch (err) {
      				setError(err.message);
      				setIsPending(false);
      			}
      		};
      		fetchPackages();
      	}, []);
      
      	useEffect(() => {
      		const checkSubscription = async () => {
                  try {
                    const data = await subscribedPatient();
                      console.log("enttt");
                    if (data.healthPackage.status === "Subscribed") {
                      setSubscribed(true);
                      setCancelled(false);
                      setPackageInfo(data.healthPackage);
                      setPatient(data.patient);
                      console.log(data.healthPackage);
                      console.log(data);
                    } else if (data.healthPackage.status === "Cancelled") {
                      setCancelled(true);
                      setSubscribed(false);
                      setPackageInfo(data.healthPackage);
                      setPatient(data.patient);
                    } else {
                      setSubscribed(false);
                      setCancelled(false); 
                      setPackageInfo(null);
                      setPatient(null);
                    }
                  } catch (error) {
                    console.error("Error while checking subscription:", error);
                  }
                };
                
      		checkSubscription();
      	}, [cancelled, subscribed]);

      (back to top)

      Generate API Documentation

      To view all the routes:

      Run at route Directory

      npm run generate-swagger

      Note: you will find the routes in backend/swagger-output.json

      Contributing

      Contributions are always welcomed!

      See contributing.md for ways to get started.

      Please adhere to this project's code of conduct.

      Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.

      (back to top)

      Credits

      (back to top)

      License

      This project utilizes the Stripe service for payment processing. By using this project, you agree to comply with Stripe's terms of service. Any use of Stripe is subject to their terms and conditions.

      This project integrates with Daily.co for video call functionality. Your use of this project is subject to Daily.co's terms of service. Please review their terms and conditions for compliance.

      The software is open source under the GPL.3 License. GPT3

      (back to top)

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages