-
Notifications
You must be signed in to change notification settings - Fork 9
/
search-all2.php
168 lines (147 loc) · 5.17 KB
/
search-all2.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
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
<?php
include "connectdb.php";
include "session.php";
?>
<!DOCTYPE html>
<html>
<head>
<title>Search</title>
<meta http-equiv="Content-Type" content="text/html; charset=tis-620">
<script language=JavaScript src="frames_body_array_<?php echo $LANGUAGE; ?>.js" type=text/javascript></script>
<script language=JavaScript src="mmenu.js" type=text/javascript></script>
</head>
<body bgcolor="#d4d4d4">
<br />
<?php
//mysql_select_db($dbname,$dbconnect);
$mrn = $_POST['mrn'];
$fname = $_POST['fname'];
$lname = $_POST['lname'];
$accession = $_POST['accession'];
if ($mrn =="" && $fname =="" && $lname =="" && $accession == "")
{
?>
<script language=JavaScript src="frames_body_array_<?php echo $LANGUAGE; ?>.js" type=text/javascript></script>
<script language=JavaScript src="mmenu.js" type=text/javascript></script>
<table width="794" border="0" align=center bgcolor=#FFFFFF>
<tr><td bgcolor=#79acf3 colspan=2>Search Patient</td></tr>
<tr>
<td width="191"><font face="MS Sans Serif"><center><img src="./images/icoSearch.png"></center><br />Search Patient</font></td>
<td width="587" bgcolor="#f8d290">
<table width="90%" cellspacing="0" cellpadding="0">
<tr >
<td><form name="searchpatient" method="post" action="search-all2.php" accept-charset="UTF-8">
<p><font face="MS Sans Serif">MRN</font>
<input type="text" name="mrn" value="">
<font face="MS Sans Serif">Accession </font>
<input type="text" name="accession" value=""></p>
<p><font face="MS Sans Serif">Name<input type="text" name="fname" value="">Lastname </font>
<input type="text" name="lname" value="">
<input type="submit" name="Submit" value="Search">
</p>
</form></td>
</tr>
</table>
</td>
</tr>
</table>
<?php
echo "<br><center><font color=red>กรุณาใส่ข้อมูลค้นหา</font></center>";
exit;
}
//$result = mysql_query("SELECT HN,NAME,LASTNAME FROM `patient_info where NAME LIKE %$fname%");
if ($accession !== "")
{
$sql="SELECT
xray_patient_info.MRN,
xray_patient_info.NAME,
xray_patient_info.LASTNAME,
xray_patient_info.CENTER_CODE,
xray_request.MRN AS REQ_MRN,
xray_request_detail.ACCESSION
FROM xray_patient_info
LEFT JOIN xray_request ON xray_request.MRN = xray_patient_info.MRN
LEFT JOIN xray_request_detail ON xray_request_detail.REQUEST_NO = xray_request.REQUEST_NO
WHERE (xray_patient_info.MRN LIKE '%$mrn%')
AND (xray_patient_info.NAME LIKE '%$fname%')
AND (xray_patient_info.LASTNAME LIKE '%$lname%')
AND (xray_request_detail.ACCESSION LIKE '%$accession%')
AND (xray_patient_info.CENTER_CODE ='$center_code')
LIMIT 0,99";
}
if ($mrn !=="" OR $fname !=="" OR $lname !=="")
{
$sql = "SELECT
xray_patient_info.MRN,
xray_patient_info.NAME,
xray_patient_info.LASTNAME
FROM xray_patient_info
WHERE (MRN LIKE '%$mrn%')
AND (NAME LIKE '%$fname%')
AND (LASTNAME LIKE '%$lname%')
AND (CENTER_CODE ='$center_code')
LIMIT 0,99";
}
//echo $sql;
$result = mysql_query($sql);
//$result = mysql_query("SELECT HN,NAME,LASTNAME FROM patient_info WHERE HN LIKE $hn");
//$result = mysql_query("SELECT * FROM Persons");
$num_rows = mysql_num_rows($result);
?>
<table width="794" border="0" align=center bgcolor=#FFFFFF>
<tr><td bgcolor=#79acf3 colspan=2>Search Patient</td></tr>
<tr>
<td width="191"><font face="MS Sans Serif"><center><img src="./images/icoSearch.png"></center><br />Search Patient</font></td>
<td width="587" bgcolor="#f8d290">
<table width="90%" cellspacing="0" cellpadding="0">
<tr >
<td><form name="searchpatient" method="post" action="search-all2.php" accept-charset="UTF-8">
<p><font face="MS Sans Serif">MRN</font> <font face="MS Sans Serif">
<input type="text" name="mrn" value="">
ACCESSION <input type="text" name="accession" value="">
</font></p>
<p><font face="MS Sans Serif">Name<input type="text" name="fname" value="">Lastname </font>
<input type="text" name="lname" value="">
<input type="submit" name="Submit" value="Search">
</p>
</form></td>
</tr>
</table>
</td>
</tr>
</table>
<?php
if ($num_rows == 1)
{
while($row = mysql_fetch_array($result))
{
$mrn = $row['MRN'];
}
header("Location: patient-info.php?MRN=$mrn");
exit;
}
if ($num_rows > 1)
{
echo "<center>Found : ".$num_rows. " items (Limit Search 99)</center>";
echo "<table border='0' cellspacing='1' width=70% align=center>\n
<tr bgcolor=#CCCCCC>\n
<td><center>HN</center></td>\n
<td><center>$_NAME</center></td>\n
<td><center>$_LASTNAME</center></td>\n
<td><center>ACCESSION</center></td>\n
<td>Open </td>\n
</tr>";
while($row = mysql_fetch_array($result))
{
echo "<tr>";
echo "<td align=right>" . $row['MRN'] . "</td>";
echo "<td>" . $row['NAME'] . "</td>";
echo "<td>" . $row['LASTNAME'] . "</td>";
echo "<td>" . $row['ACCESSION']. "</td>";
echo "<td><a href=patient-info.php?MRN=". $row['MRN'] . ">Open Patient Info</a>";
echo "</tr>";
}
echo "</table>";
}
?>
</body></html>