Weβre going to design an API for the doctors of a Hospital which has been allocated by the govt for testing and quarantine + well being of COVID-19 patients
Client: JAVASCRIPT
Server: Node.js
, Express.js
, Mongoose
, EJS
,
Github Link:-
Render Link:-
Hospital API /
β
βββ routes/
β βββ api/v1/doctors.js
β βββ api/v1/index.js
β βββ api/v1/patients.js
β βββ api/v1/reports.js
β βββ api/index.js
| βββ routes/index.js
β
βββ controllers/
β βββ api/v1/doctor_controller.js
β βββ api/v1/patient_controller.js
β βββ api/v1/report_controller.js
| |
βββ models/
β βββ doctorModel.js
β βββ patientModel.js
β βββ reportModel.js
| |
βββ index.js
βββ package-lock.json
βββ package.json
βββ README.md
Install the required Node.js packages by running the following command.
npm install
Set up the MongoDB database using Mongoose. Modify the config.js file in the config directory with your MongoDB connection URL. Create necessary models for the placement cell app in the models directory using Mongoose schema. Implement the required routes and logic in the routes directory to handle Hospital API functionalities.
Run the following command to start the server.
node index.js
Open your web browser and visit http://localhost:8000 to access the Employee Review System web app.
-
There can be 2 types of Users
-
Doctors
-
Patients
-
Doctors can log in
-
Each time a patient visits, the doctor will follow 2 steps
-
Register the patient in the app (using phone number, if the patient already exists, just return the patient info in the API)
-
After the checkup, create a Report
-
Patient Report will have the following fields
-
Created by doctor
-
Status (You can use enums if you want to):
-
Can be either of: [Negative, Travelled-Quarantine, Symptoms-Quarantine, Positive-Admit]
-
Date
-
Required Routes
-
/doctors/register β with username and password
-
/doctors/login β returns the JWT to be used
-
/patients/register
-
/patients/:id/create_report
-
/patients/:id/all_reports β List all the reports of a patient oldest to latest
-
/reports/:status β List all the reports of all the patients filtered by a specific status
use postman to test the Hospital API