A comprehensive desktop application for managing hospital operations including patient records, appointments, diagnoses, and internal staff communication.
- Patient Management: Register, update, and search patient records
- Appointment Scheduling: Schedule and manage patient appointments
- Diagnosis Management: Record patient diagnoses and prescriptions
- Doctor Management: Manage doctor profiles and specializations
- User Authentication: Secure login system with role-based access
- Internal Messaging: Real-time messaging between hospital staff using socket programming
- File Transfer: Share medical files and documents between staff members
- Client-Server Architecture: Dedicated server for handling messaging and file transfers
- Database Integration: MySQL database for persistent data storage
- Core Java: Main application logic
- Java Swing/AWT: GUI components and user interface
- MySQL: Database management
- Socket Programming: Real-time communication (messaging & file transfer)
- JDBC: Database connectivity
- NetBeans: IDE project configuration
Hospital-Management-System/
├── src/
│ └── com/
│ └── hospital/
│ ├── client/ # Socket client implementation
│ ├── database/ # Database connection and DAO classes
│ ├── gui/ # Swing GUI components
│ ├── model/ # POJO classes
│ ├── server/ # Socket server implementation
│ └── utils/ # Utility classes
├── resources/
│ └── sql/ # Database schema and scripts
├── lib/ # External libraries
├── nbproject/ # NetBeans configuration
├── build.xml # Ant build file
├── compile.sh # Compilation script
├── run-client.sh # Client launcher
└── run-server.sh # Server launcher
The system uses the following main tables:
users- Staff/user accountspatients- Patient recordsdoctors- Doctor informationdepartments- Hospital departmentsappointments- Appointment schedulingdiagnoses- Medical diagnosesprescriptions- Prescription recordsmessages- Internal messagingfile_transfers- File transfer logsbilling- Billing information
- Java Development Kit (JDK) 8 or higher
- MySQL Server 5.7 or higher
- MySQL Connector/J 8.0.28 (included in lib/)
- Start MySQL server
- Run the database schema script:
mysql -u root -p < resources/sql/hospital_schema.sql- Update database credentials in
src/com/hospital/database/DatabaseConnection.java:
private static final String DB_USER = "root";
private static final String DB_PASSWORD = "your_password";./compile.shant compile
ant jarmkdir -p build/classes
javac -d build/classes -cp "lib/*" $(find src -name "*.java")- Start the Server (for messaging and file transfer):
./run-server.sh- Start the Client (in a new terminal):
./run-client.sh- Start the Server:
java -cp "dist/HospitalManagementSystem.jar:lib/*" com.hospital.server.HospitalServer- Start the Client:
java -cp "dist/HospitalManagementSystem.jar:lib/*" com.hospital.gui.LoginFrame- Open the project in NetBeans
- Click "Run Project" or press F6
| Username | Password | Role |
|---|---|---|
| admin | admin123 | ADMIN |
| dr.smith | doctor123 | DOCTOR |
| dr.jones | doctor123 | DOCTOR |
| nurse.mary | nurse123 | NURSE |
| reception | reception123 | RECEPTIONIST |
- Launch the application
- Enter username and password
- Click "Login"
- Click "Patient Management" from the sidebar
- Add Patient: Click "Add New Patient" button
- Search: Enter name or phone number
- View Details: Select patient and click "View Details"
- Click "Appointments" from the sidebar
- Schedule: Click "Schedule Appointment"
- Select patient, doctor, date, and time
- Manage: Mark appointments as completed or cancelled
- Click "Diagnoses" from the sidebar
- Add Diagnosis: Click "Add Diagnosis"
- Enter symptoms, diagnosis, and treatment notes
- Set follow-up dates if needed
- Click "Messages" from the sidebar
- Compose: Click "Compose Message"
- Select recipient and write message
- Messages are delivered in real-time if server is running
- Click "File Transfer" from the sidebar
- Select recipient
- Choose file to send (max 5MB)
- Click "Send File"
The system uses TCP sockets for real-time communication:
Server (Port 8888):
- Handles multiple client connections
- Routes messages between users
- Manages file transfers
Client:
- Connects to server on startup
- Sends/receives messages
- Handles file transfers
REGISTER|<user_id>
MESSAGE|<receiver_id>|<message_content>
FILE|<receiver_id>,<filename>|<base64_encoded_data>
- Complete medical history tracking
- Symptom and diagnosis recording
- Prescription management
- Follow-up scheduling
- Real-time messaging between staff
- Message read/unread status
- Sent/received message views
- Notification system
- Centralized message routing
- Multi-client support
- Connection management
- Error handling
- Modern, professional interface
- Color-coded components
- Responsive design
- User-friendly navigation
- Ensure MySQL server is running
- Verify database credentials in
DatabaseConnection.java - Check if database
hospital_managementexists
- Ensure server is running before starting clients
- Check if port 8888 is available
- Verify firewall settings
- Ensure JDK is properly installed
- Verify MySQL Connector JAR is in lib/ folder
- Check JAVA_HOME environment variable
- Create model class in
src/com/hospital/model/ - Create DAO class in
src/com/hospital/database/ - Create GUI panel in
src/com/hospital/gui/ - Add menu item in
MainDashboard.java
- Update
resources/sql/hospital_schema.sql - Create migration scripts if needed
- Update corresponding model and DAO classes
- Laboratory test management
- Pharmacy integration
- Billing and invoicing
- Report generation (PDF)
- Email notifications
- Backup and restore functionality
- Multi-language support
- Mobile app integration
This project is created for educational purposes.
For questions or support, please contact the development team.
Note: This is a demonstration project. For production use, implement additional security measures including:
- Password encryption
- SQL injection prevention
- Input validation
- SSL/TLS for socket communication
- Session management
- Audit logging