A simple, yet powerful healthcare management system built using .NET Core, Entity Framework Core, and JWT-based authentication. This project aims to provide a streamlined and efficient solution for managing various aspects of a healthcare system.
- User registration and authentication with JWT
- Role-based authorization (Admin and User roles)
- Manage patients, doctors, visits, and tests
- Logging with Serilog to console and database
- AutoMapper for object-object mapping
- Comprehensive error handling and logging
- .NET Core SDK
- MySQL (or any other compatible database)
- Git
-
Clone the repository:
git clone https://github.com/USERNAME/SimpleHealthCareManagementSystem.git cd SimpleHealthCareManagementSystem
-
Set up the database:
- Create a new MySQL database.
- Update the connection string in
appsettings.json
:"ConnectionStrings": { "MySqlConnectionString": "Server=your_server;Database=your_database;User=your_user;Password=your_password;" }
-
Apply migrations:
dotnet ef database update
Configure the appsettings.Development.json
file with the necessary settings:
- Logging: Set the appropriate log levels for your application.
- JWT Settings: Configure the key, issuer, and audience for JWT authentication.
- WhatsApp Settings: Add the access token for WhatsApp integration.
- Admin User: Define the admin user's email and password.
Here is an example structure for the appsettings.Development.json
file:
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
},
"JwtSettings": {
"Key": "your_jwt_key",
"Issuer": "your_issuer",
"Audience": "your_audience"
},
"WhatsAppSettings": {
"AccessToken": "your_whatsapp_access_token"
},
"AdminUser": {
"Email": "your_admin_email",
"Password": "your_admin_password"
}
}
-
Build and run the application:
dotnet build dotnet run
-
Open your browser and navigate to
https://localhost:5001/swagger
to access the Swagger UI.
The API endpoints are documented using Swagger. You can access the API documentation at https://localhost:5001/swagger
.
-
Register a new user:
POST /api/Account/register
-
Login to get a JWT token:
POST /api/Account/login
The system supports role-based authorization for Admin and User roles.
-
Admin-only endpoints:
- Accessible only to users with the Admin role.
- Example:
GET /api/Admin
-
User-only endpoints:
- Accessible only to users with the User role.
- Example:
GET /api/User
To assign roles to users, use the RoleService during user registration or via admin endpoints.
The application uses Serilog for logging. Logs are written to both the console and the database.
Logs are stored in the LogEntries
table. The logging configuration can be found in Program.cs
.
This project is licensed under the MIT License. See the LICENSE file for details.
For any inquiries or support, please contact:
- Your Name
- Email: [email protected]
- GitHub: USERNAME
This README.md
provides a comprehensive overview of your project, including features, technologies, setup instructions, usage guidelines, logging information, contribution guidelines, and contact details. Adjust the placeholders (USERNAME
, your_server
, your_database
, your_user
, your_password
, etc.) with your actual information. This will make it easier for users and contributors to understand and work with your project.