Hi, mi name is Deibyd and this is my project to manage patients, doctors and appointments of an EPS.
You have to install these tools
- Get a list of the appointments, patients and doctors from the database and their information
- Create new appointments, patients and doctors in a PostgreSQL database
- Update appointments, patients and doctors
- Delete appointments, patients and doctors
- Filter appointments by patient's cedula and doctor's cedula and filter by speciality
1. Clone this repo by running the following commands
git clone https://github.com/DeibydBarragan/eps-spring-rest-api.git
2. Then, go to the root folder and install the dependencies
cd eps-spring-rest-api
mvn clean install
3. Configure the application.properties file in eps-spring-rest-api/src/main/resources/application.properties
with these values
spring.datasource.url = *YOUR POSTGRESQL DATABASE URL*
spring.datasource.username = *YOUR POSTGRESQL DATABASE USERNAME*
spring.datasource.password = *YOUR POSTGRESQL DATABASE PASSWORD*
spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.PostgreSQLDialect
spring.jpa.hibernate.ddl-auto = update
spring.jpa.show-sql = true
4. Then, go to the root folder and run the following command
mvn spring-boot:run
now you can test the API with Postman or another client with this url http://localhost:8080/api
5. Then, in another terminal go to the root folder and run the following
cd webui
npm install
6. Add a .env.local file with the following
NEXT_PUBLIC_API_URL=http://localhost:8080/api
7. Now run the following command
npm run dev
Then go to http://localhost:3000 and use the frontend app
To execute the backend app (with the postgreSQL database) in a docker container:
-
Make sure you have docker installed on your system
-
Configure the application.properties file in
eps-spring-rest-api/src/main/resources/application.properties
exactly like thisspring.datasource.url = ${DATABASE_URL} spring.datasource.username = ${DATABASE_USERNAME} spring.datasource.password = ${DATABASE_PASSWORD} spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.PostgreSQLDialect spring.jpa.hibernate.ddl-auto = update spring.jpa.show-sql = true
-
Open the root directory in the terminal and run the following
mvn clean package
-
Then execute the following command
docker-compose build java_app
-
Then run the following command:
docker compose up
Now you can use the api from http://localhost:8080/api and the database from http://localhost:5432
To execute the frontend app in a docker container:
-
Make sure you have docker installed on your system, also make sure that you have the backend API running and the .env.local file configured with the port of the backend API
-
Open the webui root directory in the terminal
-
Execute the following command
docker build -t eps-client-api .
-
Then run the following command:
docker run --env-file=./.env.local -p 3000:3000 eps-client-api:latest
Now you can use the frontend app in http://localhost:3000
Endpoint: POST /api/patients
{
"name": "Deibyd Santiago",
"lastname": "Barragán Gaitán",
"cedula": 1069445930,
"age": 19,
"email": "deibydbarragan@hotmail.com",
"phone": 3134828849
}
postPatient.mp4
Endpoint: PUT /api/patients/{id}
id
(required): patient id.
Use the same fields as creating a patient.
updatePatient.mp4
Endpoint: DELETE /api/patients/{id}
id
(required): patient id.
deletePatient.mp4
Endpoint: GET /api/patients
size
(optional): limit the number of patients in every page.page
(optional): bring patients of a specific page.
getAndPaginatePatients.mp4
Endpoint: POST /api/doctors
{
"name": "Pablo",
"lastname": "Casas MejĂa",
"cedula": 221345443,
"specialty": "CardiologĂa",
"office": 205,
"email": "pablomejia@hotmail.com",
"phone": 3134828849
}
postDoctor.mp4
Endpoint: PUT /api/doctors/{id}
id
(required): doctor id.
Use the same fields as creating a doctor
updateDoctor.mp4
Endpoint: DELETE /api/doctors/{id}
id
(required): patient id.
deleteDoctor.mp4
Endpoint: GET /api/doctors/all
specialty
(optional): value must between 0 and 7. Filter doctors by their speciality.
AllDoctorsAndFilterBySpecialty.mp4
Endpoint: GET /api/doctors
size
(optional): limit the number of doctors in every page.page
(optional): bring doctors of a specific page.
getAndPaginateDoctors.mp4
Endpoint: POST /api/appointments
{
"patientId": 4,
"doctorId": 2,
"date": "2023-09-15T06:30:00.0"
}
date
(required): It must be a date in 'YYYY-MM-DDTHH:MM:SS.0' format. The time must be in 24 hours and 30 minutes format and the date must be in the future.
postAppointment.mp4
Endpoint: PUT /api/appointments/{id}
id
(required): appointment id.
Use the same fields as creating an appointment.
updateAppointment.mp4
Endpoint: DELETE /api/appointments/{id}
id
(required): appointment id.
deleteAppointment.mp4
Endpoint: GET /api/appointments/patient/{cedula}
cedula
(required): patient's cedula.
getByPatientCedula.mp4
Endpoint: GET /api/appointments/doctor/{cedula}
cedula
(required): doctor's cedula.
getByDoctorCedula.mp4
Endpoint: GET /api/appointments
specialty
(optional): Get appointments by specialty.