-
Notifications
You must be signed in to change notification settings - Fork 1
/
doctor_service.php
111 lines (81 loc) · 3.63 KB
/
doctor_service.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
<?php
function get_db_connection(){
$servername = "localhost";
$username = "root";
$password = "";
$dbname = "doctorpatientportal";
// Create connection
$conn = mysqli_connect($servername, $username, $password, $dbname);
// Check connection
if (!$conn) {
die("Ops! Something wrong has happened!" . mysqli_connect_error());
}
return $conn;
}
?>
<?php
//method for doctors
function get_doctor_profile($username){
$query = "SELECT * FROM doctors WHERE user_name like '$username'";
return mysqli_query(get_db_connection(), $query);
}
function edit_doctor_password($username, $password){
$query = "UPDATE doctors SET password ='$password' WHERE user_name = '$username'";
return mysqli_query(get_db_connection(), $query);
}
function edit_doctor_profile($username, $first_name, $last_name, $gender, $email, $specialty,
$address, $contact_no){
$query = "UPDATE doctors SET first_name ='$first_name', last_name ='$last_name',
gender = '$gender', email = '$email', specialty = '$specialty',
address= '$address', contact_no= '$contact_no' WHERE user_name = '$username'";
return mysqli_query(get_db_connection(), $query);
}
//method donors
function get_all_donar(){
$query = "SELECT * FROM organ_donar ORDER BY name";
return mysqli_query(get_db_connection(), $query);
}
function get_donar_by_blood_group($blood_group){
$query = "SELECT * FROM organ_donar WHERE blood_group like '$blood_group'";
return mysqli_query(get_db_connection(), $query);
}
function get_donar_by_organ_name($organname){
$query = "SELECT * FROM organ_donar WHERE organname like '$organname'";
return mysqli_query(get_db_connection(), $query);
}
//Search donar
function search_donar($name, $blood_group, $organname, $contact_no){
$query="SELECT * FROM organ_donar where name like '%$name%'
or blood_group like '%$blood_group%' or organname like '%$organname%' or
contact_no like '%$contact_no%' ORDER BY name";
return mysqli_query(get_db_connection(), $query);
}
//add treatement history
function doctor_add_treatment_history($patient_id, $doctor_id, $treatment_for, $treatment, $note){
$query = "INSERT INTO treatment_history (patient_id, doctor_id, treatment_for, treatment, note) VALUES ('$patient_id', '$doctor_id', '$treatment_for', '$treatment', '$note')";
return mysqli_query(get_db_connection(), $query);
}
function doctor_add_treatment_history_one($patient_id, $doctor_id, $treatment_for, $treatment, $note, $dname){
$query = "INSERT INTO treatment_history (patient_id, doctor_id, treatment_for, treatment, note, dname) VALUES ('$patient_id', '$doctor_id', '$treatment_for', '$treatment', '$note', $dname)";
return mysqli_query(get_db_connection(), $query);
}
function search_patient_by_doctor_id($patient_id,$doctor_id){
$query="SELECT * FROM treatment_history WHERE patient_id like '%$patient_id%' and
doctor_id like '%$doctor_id%'";
return mysqli_query(get_db_connection(),$query);
}
//View Appointment schedule
function get_my_appontment($doctor_id){
$query="SELECT * FROM appointment WHERE doctor_id = $doctor_id";
return mysqli_query(get_db_connection(),$query);
}
//add appointment schedule
function add_schedule($doctor_id,$appoint_date,$appoint_time,$status){
$query="INSERT INTO appointment (doctor_id, appoint_date, appoint_time, status)
VALUES ('$doctor_id', '$appoint_date', '$appoint_time', '$status')";
return mysqli_query(get_db_connection(),$query);
}
//-------------- Join query -------------
function get_my_appontment_by_name($doctor_id){
}
?>