-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpatientinfo.php
148 lines (98 loc) · 2.8 KB
/
patientinfo.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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
<?php
function patientExists($phno, $patname)
{
include 'dbconn.php';
$stmt = $conn->prepare("SELECT id FROM patient_info WHERE name=? AND phid=(SELECT id FROM user_info WHERE phone=?)");
$stmt->bind_param("ss", $patname, $phno);
$stmt->execute();
$stmt->store_result();
if($stmt->num_rows>0)
{
$stmt->close();
$conn->close();
return true;
}
$stmt->close();
$conn->close();
return false;
}
function patientID($phno, $patname)
{
include 'dbconn.php';
$stmt = $conn->prepare("SELECT id FROM patient_info WHERE name=? AND phid=(SELECT id FROM user_info WHERE phone=?)");
$stmt->bind_param("ss", $patname, $phno);
$stmt->execute();
/* bind variables to prepared statement */
$stmt->bind_result($user_id);
/* fetch values */
$stmt->fetch();
$stmt->close();
$conn->close();
return $user_id;
}
function addPatient($phno, $patname, $dob)
{
include 'dbconn.php';
$stmt = $conn->prepare("SELECT id FROM user_info WHERE phone=?");
$stmt->bind_param("s", $phno);
$stmt->execute();
/* bind variables to prepared statement */
$stmt->bind_result($user_id);
/* fetch values */
$stmt->fetch();
$stmt->close();
// prepare and bind
$stmt = $conn->prepare("INSERT INTO patient_info(name, phid, dob) VALUES(?, ?, ?)");
$stmt->bind_param("sis", $patname, $user_id, $dob);
$stmt->execute();
$stmt->close();
$conn->close();
}
function addAppointment($patid, $docid, $appodate)
{
include 'dbconn.php';
// prepare and bind
$stmt = $conn->prepare("INSERT INTO appointments(patid, docid, appodate) VALUES(?, ?, ?)");
$stmt->bind_param("iis", $patid, $docid, $appodate);
$stmt->execute();
$stmt->close();
$conn->close();
}
function getAppoID($patid)
{
include 'dbconn.php';
$stmt = $conn->prepare("SELECT max(id) FROM appointments WHERE patid=?");
$stmt->bind_param("i", $patid);
$stmt->execute();
/* bind variables to prepared statement */
$stmt->bind_result($appoid);
/* fetch values */
$stmt->fetch();
$stmt->close();
return $appoid;
}
function getAppoDocName()
{
include 'dbconn.php';
$stmt = $conn->prepare("SELECT name FROM doctor_info WHERE id=(SELECT docid FROM appointments WHERE id=(SELECT max(id) FROM appointments))");
$stmt->execute();
/* bind variables to prepared statement */
$stmt->bind_result($name);
/* fetch values */
$stmt->fetch();
$stmt->close();
return $name;
}
function getAppoDate()
{
include 'dbconn.php';
$stmt = $conn->prepare("SELECT appodate FROM appointments WHERE id=(SELECT max(id) FROM appointments)");
$stmt->execute();
/* bind variables to prepared statement */
$stmt->bind_result($appodate);
/* fetch values */
$stmt->fetch();
$stmt->close();
return $appodate;
}
?>