For CZ2006 Software Engineering project at Nanyang Technological University (A.Y. 2014-2015 semester 2).
Front-end Android app can be found at DroidCare
- Assumptions: PHP, Apache, MySQL have been set up.
- Clone (download) this project
- On the project's folder, run
php composer.phar update
- Set-up database: run the SQL provided
dc.sql
OR importdc.sql
to phpmyadmin. - Change configurations at
config.php
(especially database configuration) - Done: access via REST API to
http://localhost/[PATH_TO_YOUR_PROJECT]/
- Example: Login via
POST http://localhost/[PATH_TO_YOUR_PROJECT]/user/login
All return values are in JSON string format, with two keys:
status
:0
on success,-1
otherwisemessage
: contains the error/success messages or data requested Note: "REQUEST
"-type request accepts bothPOST
andGET
.
http://dc.kenrick95.org/
or
https://dc-kenrick95.rhcloud.com/
POST /user/register
Name | Type | Description |
---|---|---|
email |
string |
User's email, should be a valid email, checked by PHP's filter_var |
password |
string |
User's password, 6-32 character long |
full_name |
string |
User's full name |
address |
string |
User's address |
phone_number |
string |
User's phone_number |
passport_number |
string |
User's passport number |
gender |
string |
"male " or "female " |
nationality |
string |
User's nationality |
date_of_birth |
string |
Date of Birth, in YYYY-MM-DD format. |
notification |
string |
Notification preference: "local ", "email ", "sms ", or "all " |
location |
string |
User's country location |
status
:0
on success,-1
otherwisemessage
: array of success/error messages
POST /user/login
Name | Type | Description |
---|---|---|
email |
string |
User's email, should be a valid email, checked by PHP's filter_var |
password |
string |
User's password |
status
:0
on success,-1
otherwisemessage
: array of error messages; orsession_id
on success, please save thissession_id
locally as it will be used for authentication for other method.
POST /user/[i:id]
POST /user/
Name | Type | Description |
---|---|---|
id |
integer |
(Optional) User id. If not set, user id used is from the session, i.e. current logged in user. Note: If id is not set, URL must end with "/ ". |
session_id |
string |
Session id, returned from /user/login |
status
:0
on success,-1
otherwisemessage
: array of error messages; or object containing the data:id
: user idemail
full_name
address
phone_number
gender
: 'male', or 'female'passport_number
nationality
date_of_birth
notification
: 'local', 'email', 'sms', or 'all'location
: countryspecialization
: not empty if consultanttype
: 'patient', 'admin', or 'consultant'
POST /user/update
Name | Type | Description |
---|---|---|
id |
integer |
User id. |
email |
string |
User's email, should be a valid email, checked by PHP's filter_var |
password |
string |
User's password, 6-32 character long |
full_name |
string |
User's full name |
address |
string |
User's address |
phone_number |
string |
User's phone_number |
passport_number |
string |
User's passport number |
gender |
string |
"Male " or "Female " |
nationality |
string |
User's nationality |
date_of_birth |
string |
Date of Birth, in YYYY-MM-DD format. |
notification |
string |
Notification preference: "local ", "email ", "sms ", or "all " |
location |
string |
User's country location |
session_id |
string |
Session id, returned from /user/login |
status
:0
on success,-1
otherwisemessage
: array of error/success messages
POST /user/logout
Name | Type | Description |
---|---|---|
session_id |
string |
Session id, returned from /user/login |
status
:0
on success,-1
otherwisemessage
: array of success/error messages
POST /appointment/new
Name | Type | Description |
---|---|---|
patient_id |
integer |
(Optional) User id of type 'patient'. If not set, user id used is from the session, i.e. current logged in user. |
consultant_id |
integer |
User id of type 'consultant' |
date_time |
string |
YYYY-MM-DD HH:mm:SS; Y-M-D H:i:s ; should be multiple of 30 minutes |
health_issue |
string |
Text describing the health issue |
attachment |
string |
Base64-encoded string of the image, may be NULL if type is not 'follow-up ' |
type |
string |
'follow-up ', 'referral ', or 'normal ' |
referrer_name |
string |
may be NULL if type is not 'referral ' |
referrer_clinic |
string |
may be NULL if type is not 'referral ' |
previous_id |
integer |
may be NULL if type is not 'follow-up ' |
session_id |
string |
Session id, returned from /user/login |
status
:0
on success,-1
otherwisemessage
: array of error messages; OR object containing success message and ID of recently inserted row.
REQUEST /appointment/attachment/[i:id]
Name | Type | Description |
---|---|---|
id |
integer |
Appointment id. |
status
: 0 on success, -1 otherwisemessage
: array of error messages; or base-64 encoded image
POST appointment/status
Name | Type | Description |
---|---|---|
id |
integer |
Appointment id. |
status |
string |
'pending ', 'accepted ', 'rejected ', or 'finished ' |
remarks |
string |
(Optional) |
session_id |
string |
Session id, returned from /user/login |
status
:0
on success,-1
otherwisemessage
: array of success/error messages
POST /appointment/[i:id]
Name | Type | Description |
---|---|---|
id |
integer |
Appointment id. |
session_id |
string |
Session id, returned from /user/login |
status
: 0 on success, -1 otherwisemessage
: array of error messages; or object containing the data:patient_id
patient_name
consultant_id
consultant_name
date_time
health_issue
attachment
type
referrer_name
referrer_clinic
previous_id
remarks
status
POST /appointment/user/[i:id]
POST /appointment/user
List down appointments:
- created by user (if user type is 'patient') OR
- assigned to user (if user type is 'consultant') OR
- of all users (if user_type is 'admin').
Name | Type | Description |
---|---|---|
id |
integer |
(Optional) User id. If not set, user id used is from the session, i.e. current logged in user. |
session_id |
string |
Session id, returned from /user/login |
status
: 0 on success, -1 otherwisemessage
: array of error messages; or array of objects containing the data:id
: appointment idpatient_id
patient_name
consultant_id
consultant_name
date_time
health_issue
attachment
(base64-encoded string of the image)type
referrer_name
referrer_clinic
previous_id
remarks
status
POST appointment/cancel
Name | Type | Description |
---|---|---|
id |
integer |
Appointment id |
session_id |
string |
Session id, returned from /user/login |
status
:0
on success,-1
otherwisemessage
: array of success/error messages
POST /appointment/edit
Name | Type | Description |
---|---|---|
id |
integer |
Appointment id |
patient_id |
integer |
(Optional) User id of type 'patient' . If not set, user id used is from the session, i.e. current logged in user. |
consultant_id |
integer |
User id of type 'consultant' |
date_time |
string |
YYYY-MM-DD HH:mm:SS; Y-M-D H:i:s |
health_issue |
string |
Text describing the health issue |
referrer_name |
string |
may be NULL if type is not 'referral ' |
referrer_clinic |
string |
may be NULL if type is not 'referral ' |
session_id |
string |
Session id, returned from /user/login |
status
: 0 on success, -1 otherwisemessage
: array of error/success messages
REQUEST appointment/timeslot/[i:user_id]/[s:date]
Name | Type | Description |
---|---|---|
user_id |
integer |
user id, should be of 'consultant'-type |
date |
string |
YYYY-MM-DD (Y-m-d ) |
status
:0
on success,-1
otherwisemessage
: array of error messages; if success, array of date_time representing time start of consultant's AVAILABLE time slot.
REQUEST /user/consultant
Name | Type | Description |
---|---|---|
location |
string |
(optional) Consultant's country location |
status
:0
on success,-1
otherwisemessage
: array of error messages; or array of objects containing the data:id
: user id of consultantfull_name
POST /user/forget
Name | Type | Description |
---|---|---|
email |
string |
user email |
status
: 0 on success, -1 otherwisemessage
: array of error/success messages
GET /user/reset/[s:password_token]
Users are expected to access this URL from e-mail sent by /user/forget
Name | Type | Description |
---|---|---|
password_token |
string |
Generated from /user/forget and sent to user's e-mail |
status
: 0 on success, -1 otherwisemessage
: array of error/success messages
POST /appointment/notify
Name | Type | Description |
---|---|---|
id |
integer |
appointment id, which appointment to be notified |
session_id |
string |
Session id, returned from /user/login |
status
: 0 on success, -1 otherwisemessage
: array of error/success messages