Skip to content

Theanh130124/SpringMVC_Health_Schedule

Repository files navigation

TOPIC : ONLINE HEALTH CHECKUP SCHEDULING APPLICATION

📁 Topic requirements:

    🚀Authentication and Authorization:
  • Login and registration with roles: patient, doctor, and administrator.
  • Doctors must be verified by the admin with a valid medical license before operating on the system.
    • 🚀Health Record Management:
  • Patients can create and manage personal health records (medical history, test results).
  • Doctors are allowed to view and update the information after each consultation.
    • 🚀Appointment Scheduling:
  • Patients can search for doctors by specialty, hospital, or doctor’s name.
  • Select available time slots and book appointments; the system sends confirmation emails.
  • Allow appointment cancellations or rescheduling at least 24 hours in advance.
    • 🚀Online Consultation:
  • Integrate video call using WebRTC or Jitsi to support remote consultations.
  • Patients and doctors can chat online before the in-person visit.
    • 🚀Service Payment:
  • Support online payment via VNPay, MoMo, Stripe.
  • Record invoices and send payment success notifications via email.
    • 🚀Rating and Feedback:
  • Patients can rate doctors with stars (1-5) and leave comments.
  • Doctors can respond to feedback to improve service quality.
    • 🚀Statistics and Reports:
  • Doctors can view the number of patients served and common diseases by month/quarter.
  • Administrators monitor system activities, number of appointments, and revenue.
    • 🚀Reminders and Notifications:
  • The system sends appointment reminders via email and push notifications.
  • Notifications about regular health checkup programs or special offers.
    • 🚀Real-time Chat Integration:
  • Use Firebase to enable direct chat between patients and doctors.
  • Allow image and rapid test result file sharing.
  • 📦Database Schema Diagram

    alt text

    💻System Architecture

    alt text

    🛠️ Settings and Run

    npm start
    
    cd function -> npm run serve
    
    
    npm install -g firebase-tools
    
    npm install express cors //(setting express.js)
    
    firebase init functions
    

    Run powershell alt text

    firebase login :

    -Select use .... then select the project created on firebase

    
      "chats": {
        "$chatId": { // ID duy nhất cho mỗi cuộc trò chuyện (ví dụ: kết hợp ID bệnh nhân và bác sĩ)
          "participants": {
            "$userId1": true, // ID của bệnh nhân
            "$userId2": true  // ID của bác sĩ
          },
          "messages": {
            "$messageId": {
              "senderId": "$userId",
              "text": "Nội dung tin nhắn",
              "imageUrl": "URL hình ảnh (nếu có)",
              "timestamp": 1678886400000 // Unix timestamp
            }
          }
        }
      },
      "users": {
        "$userId": {
          "name": "Tên người dùng",
          "role": "patient" | "doctor"
          // Các thông tin khác của người dùng
        }
      }
    
    

    (real time chat database structure) image

    image

    -Download json :

    var admin = require("firebase-admin");
    
    var serviceAccount = require("path/to/serviceAccountKey.json");
    
    admin.initializeApp({
      credential: admin.credential.cert(serviceAccount)
    });
    
    

    This part is FCM - Push notifications

    npx create-react-app push_notifications (hoặc có dự án rồi khỏi add này) 
    
    npm install firebase 
    
    -> Vào healthapp 
    
    

    Docs firebase messaging :

    https://firebase.google.com/docs/cloud-messaging/js/client?_gl=1*vxzd88*_up*MQ..&gclid=Cj0KCQjw2ZfABhDBARIsAHFTxGwUn9E4QYSXOvJ_EcaO-3DWACDU15atnoBbZeFZwiD3Bt-DnccGEs0aAlF9EALw_wcB&gclsrc=aw.ds&gbraid=0AAAAADpUDOj3EwOgVkhgcSZ3s2mZW3jlh

     - Take key pair
     - If you turn off allow then it is defined
     - Get this token after configuring the token
     - Turn on notifications for web allow 
     - Create on public in fe  
     - firebase-messaging-sw settings : import { initializeApp } from "firebase/app";
    import { getMessaging } from "firebase/messaging/sw";
    
    
    
    
    const firebaseApp = initializeApp({
      apiKey: 'api-key',
      authDomain: 'project-id.firebaseapp.com',
      databaseURL: 'https://project-id.firebaseio.com',
      projectId: 'project-id',
      storageBucket: 'project-id.appspot.com',
      messagingSenderId: 'sender-id',
      appId: 'app-id',
      measurementId: 'G-measurement-id',
    });
    
    // Retrieve an instance of Firebase Messaging so that it can handle background
    // messages.
    const messaging = getMessaging(firebaseApp);
    

    Key

    apiKey: "AIzaSyDPLqQJ5zYHHcB0gKRPI_BCuhDQ7pSn6bo",
      authDomain: "healthapp-a5a6d.firebaseapp.com",
      projectId: "healthapp-a5a6d",
      storageBucket: "healthapp-a5a6d.firebasestorage.app",
      messagingSenderId: "103302228290",
      appId: "1:103302228290:web:2da602462140612a6c00db",
      measurementId: "G-DJTKFWQHYV"
    
    

    thêm dòng này vào firebase-messagin-sw

    messaging.onBackgroundMessage((payload) => {
      console.log(
        '[firebase-messaging-sw.js] Received background message ',
        payload
      );
      // Customize notification here
      const notificationTitle = 'Background Message Title';
      const notificationOptions = {
        body: 'Background Message body.',
        icon: '/firebase-logo.png'
      };
    
      self.registration.showNotification(notificationTitle, notificationOptions);
    });
    
    

    Create

    Select SendTestMessgae try add token

    Css notifications :

    npm install react-hot-toast
    

    Here are demo account:

    
    Admin : tta1301 - 123456
    Doctor: doc_tuyet - 123456
    Patient: daobach - 123456
    
    

    Admin UI

    Login Admin:

    alt text

    Stats Admin :

    alt text

    Approve application:

    alt text

    Create account doctor:

    alt text

    Stats doctor :

    alt text

    anonymous users UI

    Home :

    alt text

    Register:

    alt text

    Finddoctor:

    alt text

    alt text

    alt text

    Doctor UI

    User UI

    -- DOCKER

    docker build -t springmvc-health-tomcat11 .

    docker run -d -p 8080:8080 --name health_schedule_app springmvc-health-tomcat11

    reactbits cài ts npm install --save-dev typescript

    image

    One-Time Installation JS + CSS

    npx jsrepo add https://reactbits.dev/default/TextAnimations/RotatingText JS + Tailwind

    npx jsrepo add https://reactbits.dev/tailwind/TextAnimations/RotatingText TS + CSS

    npx jsrepo add https://reactbits.dev/ts/default/TextAnimations/RotatingText TS + Tailwind

    npx jsrepo add https://reactbits.dev/ts/tailwind/TextAnimations/RotatingText

    NOTE:

    Lưu ý Tomcat11 nữa chỉ giải nén rồi qua server gọi thôi (không có run)

    About

    Online health check-up appointment system, integrated real-time chat, video calling, online payment

    Topics

    Resources

    License

    Stars

    Watchers

    Forks

    Releases

    No releases published

    Packages

    No packages published

    Contributors 2

    •  
    •