https://github.com/ArgenisGonzalez-Ksquare/hms_itk.git
Is necessary to install some depedencies, please check the package.json
and install everithing that is needed
This Project is running on a postgres database, is necesary to you create the next .env file with the followings variables:
DB_PASS=root
DB_USER=admin_hospital
DB_NAME=hospital
PORT=5000
DB_HOSTNAME=localhost
HOST=localhost:5000
GOOGLE_APPLICATION_CREDENTIALS=C:\firebase\firebase.json.json
[email protected]
Be sure to create the hospital
database on sql Shell or pg admin, as well you have to create the user admin_hospital
and give him permission for createDB and set as the owner of hospital
, for more help I share with you the commands you have to put on sql shell
CREATE DATABASE hospital;
CREATE USER admin_hospital WITH PASSWORD 'root';
ALTER USER admin_hospital WITH CREATEDB;
ALTER DATABASE hospital OWNER TO admin_hospital;
Please be sure of create the firebase.json
file in the same PATH you saw in the .env
.
This is the structure of the json
{
"type": "service_account",
"project_id": "test-fe936",
"private_key_id": "834640f8d2dac7ab5bb03b7f90919bcc226ee365",
"private_key": "-----BEGIN PRIVATE KEY-----\nMIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQC4jR1Hb7Jq8qh0\nzIHzAoKJCIhtuR1JGXJAWC9b1P+Tfs4CoK5jUxuIQxEOiqtiLB9ggqHfS/mqa3sM\nMc0Q9wayJgOWhLMIjiRKSJQKYQV0UzpiTu9wHgJxM24mTd5eNLd8nX0dOnU6COKT\nbGbBsUmVvJS/VSLC2LuPtrCOL0pNMHy0kzacpIM917mdAv44jL4uDikRKmA7oFUe\nzEU5OSqE1LLdefQaSHaveF9au6mAsXSUNFCAjs4RVVdn27R6mCEVdpIskbqLjWJb\np1KbwSn7+EU59UK/9s5kzopUHLoDXXFgeatYSlfqG9krc89mbkDi17Ewb05BjBA5\n7y6LkLDvAgMBAAECggEAFLTXO1En0m0TLouq7Dz0sB2yJPwh8jY120ypqk2N4XAs\nUB9+1tZtHo7xJnxeOf/GWM8/YezwgHOvv3taTVQnaayZ4XUBG212BT77G+ZX333e\nbUelq3g1K5tVeVxqSI/0ow7j301+9/n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W1nroeEHqZ5RFVON1\nv95w3A4FvAyVKGd0pyiIRlIY\n-----END PRIVATE KEY-----\n",
"client_email": "[email protected]",
"client_id": "112518376288956875814",
"auth_uri": "https://accounts.google.com/o/oauth2/auth",
"token_uri": "https://oauth2.googleapis.com/token",
"auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
"client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/firebase-adminsdk-d04eu%40test-fe936.iam.gserviceaccount.com"
}
As you know, you have been provider of a Postman collection
for check the endpoints, there you will find a folder with a tokenGenerator. A will share with you an admin account for the test
email: [email protected]
password: 123456
Generate your token for a admin to create doctors accounts and more. Remember that a patient can make a sing up with out authentication. For the endpoints that the authentication and authorization is necesary, please, be sure to put on the header a key "Authorization" and in the value put Bearer , this is the token that you generate in the endpoint tokenGenerator
.
PatientInfo
Property | Type | References |
---|---|---|
Id | Int | Primary Key - NOT NULL - AUTOINCREMENT |
FullName | Varchar(70) | NOT NULL |
User_Id | STRING | NOT NULL - FOREING KEY |
Birthdate | Date | Not null |
Status | BOOLEAN |
The entity Patient will storage every single patient data
DoctorInfo
Property | Type | References |
---|---|---|
Id | Int | Primary Key - NOT NULL - AUTOINCREMENT |
FullName | Varchar(70) | NOT NULL |
User_Id | STRING | NOT NULL - FOREING KEY |
Birthdate | Date | Not null |
DepartmentId | INT | Not Null |
Status | BOOLEAN |
The entity Doctor will storage every single Doctor data
Department
Property | Type | References |
---|---|---|
Id | Int | Primary Key - NOT NULL - AUTOINCREMENT |
Department | Varchar (70) | NOT NULL |
This entity will help to reference the department or medical specialization of the doctor
Appointment
Property | Type | References |
---|---|---|
Id | Int | Primary Key - NOT NULL - AUTOINCREMENT |
PatientInfo_id | STRING | Foreing Key - NOT NULL |
DoctorInfo_id | STRING | Foreing Key - NOT NULL |
date | Datetime | not null |
Status | Varchar(25) | 'Complete', 'Pending', 'Canceled' |
This entity will help to storage the appointments or medical specialization of the hospital, here will be reference the patien by him ID and Doctor too, also it will have a property call status to know if the appoint has been complete or still pending.
User
Property | Type | References |
---|---|---|
Uid | Int | Primary Key - NOT NULL - AUTOINCREMENT |
UserName | Varchar(70) | NOT NULL |
Varchar(50 | NOT NULL | |
Password | Varchar(50) | NOT NULL |
Role | VarChar(25) | 'Auth', 'Admin', 'Doctor', 'Patient' |
Status | BOOLEAN |
The user entity storage all the users and the roles and permission on the system, for this we create a property call Role to know if the user is an admin, an author, a patient or a doctor.