diff --git a/README.md b/README.md index 7eb25f554531463caebde4db0a524bdf3650f761..71fe2d333437c023850a30180a9ca06a9b3ced6f 100644 --- a/README.md +++ b/README.md @@ -1,49 +1,50 @@ -# CCU HTM - Hệ thống Quản lý Bệnh nhân Đơn vị Chăm sóc Tích cực +# CCU HTM - Critical Care Unit Healthcare Task Management System -CCU HTM là một ứng dụng web quản lý bệnh nhân cho Đơn vị Chăm sóc Tích cực (CCU), tập trung vào việc theo dõi chỉ số dinh dưỡng, quản lý chuyển tuyến, và tạo báo cáo. Ứng dụng được phát triển sử dụng Flask và có giao diện trực quan dựa trên Tailwind CSS. +CCU HTM is a web application for managing patients in a Critical Care Unit (CCU), focusing on nutritional monitoring, referral management, and report generation. The application is developed using Flask with an intuitive interface based on Tailwind CSS. -## Tính năng chính +## Key Features -- **Quản lý hồ sơ bệnh nhân**: Theo dõi thông tin cá nhân, chỉ số BMI, nhóm máu, và lịch sử nhập viện -- **Theo dõi chỉ số sinh lý**: Ghi nhận và phân tích các chỉ số quan trọng như nhịp tim, huyết áp, FiO2, nhiệt độ -- **Hệ thống chuyển tuyến**: Quản lý quy trình chuyển tuyến từ yêu cầu đến hoàn thành -- **Quản lý thủ thuật dinh dưỡng**: Ghi nhận và theo dõi các thủ thuật dinh dưỡng cho bệnh nhân -- **Tạo báo cáo**: Tạo và xuất báo cáo theo nhiều định dạng khác nhau (Excel, PDF) -- **Tải lên và xử lý dữ liệu CSV**: Nhập dữ liệu hàng loạt từ các file CSV -- **Dashboard trực quan**: Hiển thị thống kê và biểu đồ trực quan về tình trạng bệnh nhân và hoạt động của đơn vị -- **Hệ thống cảnh báo**: Cảnh báo tự động khi phát hiện các chỉ số bất thường +- **Patient Profile Management**: Track personal information, BMI, blood type, and admission history +- **Physiological Measurements Monitoring**: Record and analyze vital metrics like heart rate, blood pressure, FiO2, temperature +- **Referral System**: Manage the referral process from request to completion +- **Nutritional Procedure Management**: Document and track nutritional procedures for patients +- **Report Generation**: Create and export reports in various formats (Excel, PDF) +- **CSV Data Upload**: Batch import data from CSV files +- **Visual Dashboard**: Display statistics and visualizations about patient status and unit activities +- **Alert System**: Automatic notifications when abnormal metrics are detected +- **Dietitian Assignment**: Assign and manage dietitians for each patient -## Yêu cầu hệ thống +## System Requirements - Python 3.8+ -- MySQL 5.7+ hoặc MariaDB 10.2+ -- Trình duyệt web hiện đại (Chrome, Firefox, Edge) -- Kết nối Internet (cho các thành phần CDN) +- MySQL 5.7+ or MariaDB 10.2+ +- Modern web browser (Chrome, Firefox, Edge) +- Internet connection (for CDN components) -## Cài đặt +## Installation -1. Sao chép mã nguồn: +1. Clone the repository: ```bash git clone https://gitlab.uwe.ac.uk/bvn2-minh/ccu-htm.git cd ccu-htm ``` -2. Tạo và kích hoạt môi trường ảo: +2. Create and activate a virtual environment: ```bash python -m venv venv -# Trên Windows +# On Windows venv\Scripts\activate -# Trên Linux/Mac +# On Linux/Mac source venv/bin/activate ``` -3. Cài đặt các gói phụ thuộc: +3. Install dependencies: ```bash pip install -r requirements.txt ``` -4. Cấu hình cơ sở dữ liệu: - Tạo file `instance/config.py` với nội dung sau: +4. Configure the database: + Edit `instance/config.py` file with the following content: ```python SECRET_KEY = 'your-secret-key' SQLALCHEMY_DATABASE_URI = 'mysql://username:password@localhost/ccu_htm' @@ -51,114 +52,129 @@ SQLALCHEMY_TRACK_MODIFICATIONS = False UPLOAD_FOLDER = 'uploads' ``` -5. Chạy ứng dụng sử dụng menu trợ giúp: +5. Run the application using the helper menu: ```bash -# Trên Windows +# On Windows run_ccu.bat ``` -Menu hiển thị các tùy chọn sau: -- **1. Initialize the database (includes migration)**: Khởi tạo cơ sở dữ liệu và thực hiện migration -- **2. Run the application**: Khởi động hệ thống CCU HTM -- **3. Create admin account**: Tạo tài khoản quản trị viên -- **4. Update database schema**: Kiểm tra và cập nhật cấu trúc CSDL -- **5. Exit**: Đóng chương trình +The menu displays the following options: +- **1. Run the application**: Start the CCU HTM system +- **2. Stamp database to latest migration**: Fix synchronization issues +- **3. Generate new migration**: Create migration files after model changes +- **4. Apply database migrations**: Update the database structure +- **5. Reset database**: Delete all data and recreate the database (use with caution) +- **6. Exit**: Close the program -Để cài đặt hệ thống lần đầu, hãy chọn lần lượt tùy chọn 1 và 3 trước khi chạy ứng dụng. +For first-time setup, select option 5 to reset the database, then option 1 to run the application. -Hoặc chạy trực tiếp từ dòng lệnh: +Or run directly from the command line: ```bash -# Khởi tạo cơ sở dữ liệu và migration -python run.py --init --migrate +# Reset database (deletes all data) +python run.py --reset -# Tạo tài khoản admin (nếu cần) -python run.py --admin - -# Chạy ứng dụng +# Run the application python run.py --clean ``` -## Sử dụng +## Usage -1. Truy cập ứng dụng qua trình duyệt tại địa chỉ: `http://localhost:5000` -2. Đăng nhập với tài khoản mặc định: +1. Access the application via browser at: `http://localhost:5000` +2. Log in with the default account: - Email: admin@ccuhtm.com - Password: admin -## Cấu trúc dự án +## Project Structure ``` -ccu_bvnm/ -├── app/ # Thư mục ứng dụng chính -│ ├── models/ # Định nghĩa các model dữ liệu -│ │ ├── patient.py # Model bệnh nhân và cuộc gặp -│ │ ├── referral.py # Model chuyển tuyến -│ │ ├── report.py # Model báo cáo -│ │ ├── measurement.py # Model đo lường sinh lý -│ │ ├── procedure.py # Model thủ thuật -│ │ ├── uploaded_file.py # Model file tải lên -│ │ └── user.py # Model người dùng -│ ├── routes/ # Các blueprint và controller -│ │ ├── dashboard.py # Route cho dashboard -│ │ ├── patients.py # Route quản lý bệnh nhân -│ │ ├── report.py # Route quản lý báo cáo -│ │ ├── upload.py # Route xử lý tải lên -│ │ └── users.py # Route quản lý người dùng -│ ├── static/ # Tài nguyên tĩnh -│ │ ├── css/ # Stylesheet +ccu_htm/ +├── app/ # Main application directory +│ ├── models/ # Data model definitions +│ │ ├── patient.py # Patient and encounter models +│ │ ├── referral.py # Referral model +│ │ ├── report.py # Report model +│ │ ├── measurement.py # Physiological measurement model +│ │ ├── procedure.py # Procedure model +│ │ ├── dietitian.py # Dietitian model +│ │ └── user.py # User model +│ ├── routes/ # Blueprints and controllers +│ │ ├── auth.py # Authentication routes +│ │ ├── dashboard.py # Dashboard routes +│ │ ├── patients.py # Patient management routes +│ │ ├── dietitians.py # Dietitian management routes +│ │ ├── dietitian.py # Individual dietitian views +│ │ ├── report.py # Report management routes +│ │ ├── support.py # Support messaging system +│ │ ├── main.py # Main page and navigation +│ │ ├── notifications.py # User notifications +│ │ └── upload.py # CSV upload handling +│ ├── forms/ # Form definitions +│ │ ├── dietitian_forms.py # Dietitian-related forms +│ │ └── other form files +│ ├── static/ # Static resources +│ │ ├── css/ # Stylesheets │ │ ├── js/ # JavaScript -│ │ └── img/ # Hình ảnh -│ ├── templates/ # Template HTML -│ │ ├── base.html # Template cơ sở -│ │ ├── dashboard.html # Trang dashboard -│ │ ├── patients.html # Trang danh sách bệnh nhân -│ │ └── report.html # Trang báo cáo -│ ├── utils/ # Tiện ích và hàm hỗ trợ -│ │ ├── csv_handler.py # Xử lý file CSV -│ │ └── report_generator.py # Tạo báo cáo -│ └── __init__.py # Khởi tạo ứng dụng Flask -├── migrations/ # Các file migration cơ sở dữ liệu -├── uploads/ # Thư mục lưu trữ file tải lên -├── instance/ # Cấu hình riêng của từng máy -├── run.py # Điểm khởi chạy ứng dụng -├── run_ccu.bat # File batch để chạy trên Windows -└── requirements.txt # Danh sách các gói phụ thuộc +│ │ └── img/ # Images +│ ├── templates/ # HTML templates +│ │ ├── base.html # Base template +│ │ ├── _macros.html # Reusable template components +│ │ ├── _formhelpers.html # Form rendering helpers +│ │ ├── dashboard/ # Dashboard templates +│ │ ├── patients/ # Patient related templates +│ │ ├── dietitians/ # Dietitian templates +│ │ └── reports/ # Report templates +│ ├── utils/ # Utilities and helper functions +│ │ ├── decorators.py # Permission decorators +│ │ └── report_generator.py # Report generation +│ └── __init__.py # Flask application initialization +├── migrations/ # Database migration files +├── instance/ # Machine-specific configuration +│ └── config.py # Database and app configuration +├── run.py # Application entry point +├── run_ccu.bat # Windows batch file for easier execution +└── requirements.txt # Dependency list ``` -## Các chức năng chính +## Main Functions ### Dashboard -- Hiển thị tổng quan về số lượng bệnh nhân, chuyển tuyến, và báo cáo -- Biểu đồ phân phối BMI của bệnh nhân -- Cảnh báo về các vấn đề cần chú ý -- Dòng thời gian các hoạt động gần đây - -### Quản lý bệnh nhân -- Thêm, xem, chỉnh sửa thông tin bệnh nhân -- Theo dõi lịch sử cuộc gặp và chỉ số sinh lý -- Tạo chuyển tuyến cho bệnh nhân -- Xem báo cáo liên quan đến bệnh nhân - -### Quản lý chuyển tuyến -- Tạo yêu cầu chuyển tuyến mới -- Theo dõi trạng thái chuyển tuyến -- Ghi nhận phản hồi và kết quả - -### Báo cáo -- Tạo báo cáo đánh giá dinh dưỡng -- Tạo báo cáo thống kê theo ngày, tuần, tháng -- Xuất báo cáo dưới dạng Excel hoặc PDF - -### Tải lên dữ liệu -- Tải lên file CSV chứa dữ liệu bệnh nhân -- Xác thực và xử lý dữ liệu tự động -- Xem lịch sử tải lên và kết quả xử lý - -## Đóng góp và phát triển - -Dự án được phát triển bởi nhóm sinh viên năm 2 tại Đại học West of England. Nếu bạn muốn đóng góp: -1. Fork dự án -2. Tạo nhánh tính năng mới (`git checkout -b feature/amazing-feature`) -3. Commit thay đổi của bạn (`git commit -m 'Add some amazing feature'`) -4. Push lên nhánh (`git push origin feature/amazing-feature`) -5. Tạo Pull Request +- Overview of patient count, referrals, and reports +- Patient BMI distribution chart +- Alerts for issues requiring attention +- Timeline of recent activities + +### Patient Management +- Add, view, edit patient information +- Track encounter history and physiological metrics +- Create referrals for patients +- View reports related to patients + +### Dietitian Management +- Add, view, edit dietitian information +- Assign dietitians to patients +- Track dietitian workload and availability +- Monitor dietitian status (Available or Unavailable) + +### Referral Management +- Create new referral requests +- Track referral status +- Record feedback and results + +### Reports +- Create nutritional assessment reports +- Generate statistical reports by day, week, month +- Export reports as Excel or PDF + +### Data Upload +- Upload CSV files containing patient data +- Automatic data validation and processing +- View upload history and processing results + +## Contributing and Development + +This project was developed by second-year students at the University of the West of England - Phenikaa Campus. If you want to contribute: +1. Fork the project +2. Create a feature branch (`git checkout -b feature/amazing-feature`) +3. Commit your changes (`git commit -m 'Add some amazing feature'`) +4. Push to the branch (`git push origin feature/amazing-feature`) +5. Create a Pull Request