This repository is a demo for database subject , Chulalongkorn University
- run
pip3 install -r requirements.txt
to install module
- run
python3 flaskr/main.py
to run the application in PORT 8080
- Optional run
nodemon flaskr/main.py
instread of python3 to watch files
Get medical staff from database with / without condition
Query |
Type |
Output |
None |
None |
Get all staffs , return an array of object |
id |
number |
Get a staff which match id , return a single object |
type |
string |
Get staffs which medical_type match type , return an array of object |
{
"Address": string,
"Birthdate": datetime string eg. "Fri, 26 Apr 1991 00:00:00 GMT",
"Email": string,
"First_name": string,
"Home_tel": string,
"Last_name": string,
"Medical_type": 'Doctor' | 'Pharmacist' | 'Nurse',
"Mobile_tel": string,
"Salary": number,
"Sex": 'Male' | 'Female',
"Staff_ID": number
}
GET /api/medical_staff/<staff_id>
Get a medical staff that match staff_id
GET /api/medical_staff/doctor
POST /api/medical_staff/doctor
Body |
Type |
Value |
firstname |
string |
Doctor firstname |
lastname |
string |
Doctor lastname |
sex |
string |
Doctor sex |
salary |
number |
Doctor salary |
mobile_tel |
string |
Doctor mobile_tel |
home_tel |
string |
Doctor home_tel |
address |
string |
Doctor address |
email |
string |
Doctor email |
doctor_type |
string |
Doctor type |
birthdate |
string |
datestring in ISO format from Date.toISOString() |
GET /api/medical_staff/nurse
POST /api/medical_staff/nurse
Body |
Type |
Value |
firstname |
string |
Nurse firstname |
lastname |
string |
Nurse lastname |
sex |
string |
Nurse sex |
salary |
number |
Nurse salary |
mobile_tel |
string |
Nurse mobile_tel |
home_tel |
string |
Nurse home_tel |
address |
string |
Nurse address |
email |
string |
Nurse email |
nurse_type |
string |
Nurse type |
birthdate |
string |
datestring in ISO format from Date.toISOString() |
GET /api/medical_staff/pharmacist
POST /api/medical_staff/pharmacist
Body |
Type |
Value |
firstname |
string |
Pharmacist firstname |
lastname |
string |
Pharmacist lastname |
sex |
string |
Pharmacist sex |
salary |
number |
Pharmacist salary |
mobile_tel |
string |
Pharmacist mobile_tel |
home_tel |
string |
Pharmacist home_tel |
address |
string |
Pharmacist address |
email |
string |
Pharmacist email |
pharmacist_type |
string |
Pharmacist type |
birthdate |
string |
datestring in ISO format from Date.toISOString() |
PATCH /api/medical_staff/<staff_id>
Edit a medical staff that match staff_id, optional key can be used together.
Body |
Type |
Value |
firstname |
string (Optional) |
Staff firstname |
lastname |
string (Optional) |
Staff lastname |
sex |
string (Optional) |
Staff sex |
salary |
number (Optional) |
Staff salary |
mobile_tel |
string (Optional) |
Staff mobile_tel |
home_tel |
string (Optional) |
Staff home_tel |
address |
string (Optional) |
Staff address |
email |
string (Optional) |
Staff email |
DELETE /api/medical_staff/<staff_id>
Delete a medical staff that match staff_id
Get department from database
Query |
Type |
Output |
None |
None |
Get all departments , return an array of object |
{
"DepartmentName": string,
"Location": string,
"Manager_ID": number,
"Manager_first_name": string,
"Manager_last_name": string,
"Manager_sex": 'Male' | 'Female',
"Manager_tel": string
}
Add department to database
Body |
Type |
Value |
name |
string |
Department name |
location |
string |
Department location |
manager |
number |
staff_id of the manager |
Get patient from database with / without condition
Query |
Type |
Output |
None |
None |
Get all patients , return an array of object |
id |
number |
Get a patient which match id , return a single object |
{
"Address": string,
"Birthdate": datetime string eg. "Sun, 19 May 1985 00:00:00 GMT",
"Parent_first_name": string,
"Parent_last_name": string,
"Parent_phone_number": string,
"Patient_ID": number,
"Patient_first_name": string,
"Patient_last_name": string,
"Phone_number": string,
"Sex": 'Male' | 'Female'
"Allergy_name": Array<string> of allergy
}
Add a patient to the database
Body |
Type |
Value |
firstname |
string |
Patient firstname |
lastname |
string |
Patient lastname |
sex |
string |
'Male' or 'Female' |
birthdate |
string |
datestring in ISO format from Date.toISOString() |
address |
string |
Patient address |
phone |
string |
Patient phone number |
parent_firstname |
string |
Patient's parent firstname |
parent_lastname |
string |
Patient's parent lastname |
parent_phone |
string |
Patient's parent phone |
allergy |
string (Optional) |
Patient's allergy in comma seperate format eg. 'Peanut allergy,Shrimp' |
GET /api/patient/<patient_id>
Get a patient from database which match the patient_id
Get appointments from database, many optional queries can be used together.
Query |
Type |
Output |
None |
None |
Get all appointments , return an array of object |
patient_id |
number (Optional) |
Get appointments which match patient_id , return an array of object |
doctor_id |
number (Optional) |
Get appointments which match doctor_id , return an array of object |
{
"Appoint_ID": number,
"Appointment_date": datetime string eg. "Mon, 23 Jul 2018 13:00:00 GMT",
"Doctor_ID": number,
"Doctor_email": string,
"Doctor_first_name": string,
"Doctor_last_name": string,
"Doctor_sex": 'Male' | 'Female',
"Patient_ID": number,
"Patient_first_name": string,
"Patient_last_name": string,
"Patient_sex": 'Male' | 'Female'
}
Body |
Type |
Value |
doctor_id |
number |
Staff_ID of the doctor |
patient_id |
number |
Patient_ID |
appoint_date |
string |
datetimestring in ISO format from Date.toISOString() |
PATCH /api/appoint/<appoint_id>
Edit an appointment which match appoint_id
Body |
Type |
Value |
doctor_id |
number |
Staff_ID of the doctor |
patient_id |
number |
Patient_ID |
appoint_date |
string |
datetimestring in ISO format from Date.toISOString() |
DELETE /api/appoint/<appoint_id>
Get medicine from database with / without condition
Query |
Type |
Output |
None |
None |
Get all medicine , return an array of object |
id |
number |
Get a medicine which match id , return a single object |
{
"Medicine_ID" : number,
"Medicnie_name": string,
"Quantity": number,
"Exp_date": datetime string eg. "Fri, 26 Apr 1991 00:00:00 GMT"
}
Body |
Type |
Value |
name |
string |
medicine name |
quantity |
number |
quantity of medicines |
exp_date |
datetime string |
expiration date of medicine |
GET /api/medicine/<medicine_id>
Get a medicine that match medicine_id
DELETE /api/medicine/<medicine_id>
Delete a medicine that match medicine_id
Refill Medicine /api/medicine/refill
Body |
Type |
Value |
medicine_id |
number |
id of medicine |
pharmacist_id |
number |
is of pharmacist |
quantity |
number |
Quantity of medicine |
POST /api/medicine/perscribe
Perscribe a medicine to patient
Body |
Type |
Value |
medicine_id |
number |
Medicine ID |
quantity |
number |
Medicine's quantity |
doctor_id |
number |
Doctor ID |
patient_id |
number |
Patient ID |
GET /api/medicine/perscibe
Get a persription info. (query can combine together)
Query |
Type |
Output |
medicine_id |
number |
Get all Perscription match to medicine_id, Return array of object |
doctor_id |
number |
Get all Perscription match to doctor_id, Return array of object |
patient_id |
number |
Get all Perscription match to patient_id, Return array of object |
{
'Medicine_ID': number ,
'Patient_ID': number,
'Doctor_ID': number,
'Quantity' : number,
'Perscribe_date : datetime string eg. "Fri, 26 Apr 1991 00:00:00 GMT"'
}
Get a persription info. (query can combine together)
Query |
Type |
Output |
doctor_id |
number |
Get all Treatment match to doctor_id, Return array of object |
patient_id |
number |
Get all Treatment match to patient_id, Return array of object |
Body |
Type |
Value |
doctor_id |
number |
Doctor ID |
patient_id |
number |
Patient ID |
cost |
number |
Total cost |
symptom |
string |
Description |
PATCH /api/treatment/<treatment_id>
Edit a treatment which match treatment_id
Body |
Type |
Value |
doctor_id |
number |
Staff_ID of the doctor |
patient_id |
number |
Patient_ID |
cost |
number |
Total cost |
symptom |
string |
Description |
DELETE /api/treatment/<treatment_id>
Delete a treatment that match treatment_id
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.
MIT