001.
<?php
002.
header(
"content-type: text/html; charset=utf-8"
);
003.
session_start();
004.
include
(
"connect.php"
);
005.
if
(
$_GET
[
'f'
] != NULL )
006.
{
007.
$msg_warning
=
'<div class="error">'
.
$_GET
[
'f'
].
'</div>'
;
008.
}
009.
$data
=
$_GET
[
'data'
];
010.
$val
=
$_GET
[
'val'
];
011.
012.
013.
if
(
$data
==
'no_icd10'
) {
014.
echo
"<select name='no_icd10' onChange=\"dochange('icd10', this.value)\">"
;
015.
echo
"<option value='0'>- เลือกกลุ่มโรค -</option>\n"
;
016.
$result
=mysql_query(
"select * from no_icd10 order by icd10_bw"
);
017.
while
(
$row
= mysql_fetch_array(
$result
)){
018.
echo
"<option value='$row[icd10_bw]' >$row[icd10_bw]</option>"
;
019.
}
020.
}
else
if
(
$data
==
'icd10'
) {
021.
echo
"<select name='icd10'>"
;
022.
echo
"<option value='0'>- เลือกชื่อโรค -</option>\n"
;
023.
$result
=mysql_query(
"SELECT * FROM icd10 WHERE icd10_bw= '$val' order by icd10_name "
);
024.
while
(
$row
= mysql_fetch_array(
$result
)){
025.
echo
"<option value='$row[icd10_name]' >$row[icd10_name]</option> \n"
;
026.
}
027.
028.
}
029.
echo
"</select>\n"
;
030.
031.
?>
032.
<script language=Javascript>
033.
function
Inint_AJAX() {
034.
try {
return
new
ActiveXObject(
"Msxml2.XMLHTTP"
); } catch(e) {}
035.
try {
return
new
ActiveXObject(
"Microsoft.XMLHTTP"
); } catch(e) {}
036.
try {
return
new
XMLHttpRequest(); } catch(e) {}
037.
alert(
"XMLHttpRequest not supported"
);
038.
return
null;
039.
};
040.
041.
function
dochange(src, val) {
042.
var
req = Inint_AJAX();
043.
req.onreadystatechange =
function
() {
044.
if
(req.readyState==4) {
045.
if
(req.status==200) {
046.
document.getElementById(src).innerHTML=req.responseText;
047.
}
048.
}
049.
};
050.
req.setRequestHeader(
"Content-Type"
,
"application/x-www-form-urlencoded;charset=utf-8"
);
051.
req.send(null);
052.
}
053.
054.
window.onLoad=dochange(
'no_icd10'
, -1);
055.
</script>
056.
057.
<form id=
"form_search"
name=
"form_search"
method=
"post"
action=
""
>
058.
<table width=
"908"
border=
"2"
align=
"center"
bordercolor=
"#0066FF"
><tr><td width=
"956"
> <table width=
"896"
>
059.
<tr><td width=
"888"
align=
"center"
><br> HN <input type=
"text"
name=
"HN1"
id=
"form1"
value=
"<?=$_POST['HN1']?>"
/> ชื่อ-นามสกุล <input type=
"text"
name=
"name1"
size=
"35"
id=
"name1"
value=
"<?=$_POST['name1']?>"
/> </td></tr>
060.
<tr><td width=
"888"
align=
"center"
><br> ตั้งแต่วันที่ || <input type=
"date"
name=
"day1"
id=
"day1"
value=
"<?=$_POST['day1']?>"
/> ถึงวันที่ || <input type=
"date"
name=
"day2"
id=
"day2"
value=
"<?=$_POST['day2']?>"
/> ตัวอย่าง ดด/วว/ปีค.ศ.(2001)-ดด/วว/ปีค.ศ.(2005) </td></tr>
061.
<tr><td align=
"center"
><br />
062.
063.
อำเภอ ||
064.
<select name=
"myselect1"
id=
"myselect1"
>
065.
<option value=
""
>เลือกอำเภอ</option>
066.
<?php
067.
$sql
=
"select * from district "
;
068.
$a
=mysql_query(
$sql
);
069.
while
(
$objResult
=mysql_fetch_array(
$a
)){
070.
?>
071.
<option value=
"<?=$objResult['Dis_name']?>"
<?=(
$_POST
[
'myselect1'
]==
'$odjResult'
)?
" selected"
:
""
?>><?=
$objResult
[
'Dis_name'
]?></option>
072.
<?php } ?>
073.
</select>
074.
075.
ICD10 ||
076.
<span id=
"no_icd10"
>
077.
<select>
078.
<option value=
"0"
>- เลือกกลุ่มโรค -</option>
079.
</select>
080.
</span>
081.
082.
</td></tr>
083.
<tr><td height=
"47"
align=
"center"
>ICD10_name ||
084.
<span id=
"icd10"
>
085.
<select>
086.
<option value=
'0'
>- เลือกชื่อโรค -</option>
087.
</select>
088.
</span></td></tr>
089.
<tr><td align=
"center"
><br>
090.
<input type=
"radio"
name=
"myradio"
id=
"myradio1"
value=
"ผู้ป่วยรายเก่า"
<?=(
$_POST
[
'myradio'
]==
"ผู้ป่วยรายเก่า"
)?
" checked"
:
""
?>> ผู้ป่วยรายเก่า
091.
092.
<input type=
"radio"
name=
"myradio"
id=
"myradio2"
value=
"ผู้ป่วยรายใหม่"
<?=(
$_POST
[
'myradio'
]==
"ผู้ป่วยรายใหม่"
)?
" checked"
:
""
?>> ผู้ป่วยรายใหม่</td></tr>
093.
<tr><td align=
"center"
><br>
094.
<input type=
"submit"
name=
"button"
id=
"button"
value=
"ค้นหา"
/>
095.
096.
<input type=
"button"
name=
"btn_reset"
value=
"ยกเลิก"
onclick=
"window.location='Review_admin.php'"
> </td></tr></table><br /></td></tr></table>
097.
</form>
098.
<form name=
"form1"
method=
"post"
action=
"download_admin.php"
><div align=
"center"
>
099.
<br /><br />
100.
<input type=
"submit"
name=
"download"
id=
"download"
value=
"ดาวน์โหลด"
onclick="window.location=
'download_admin.php'
></div></form> <br />
101.
<br />
102.
<table width=
"100%"
border=
"0"
align=
"center"
cellpadding=
"0"
cellspacing=
"00"
>
103.
<tbody>
104.
<tr>
105.
<br />
106.
<td align=
"left"
>
107.
<br />
108.
<div style=
"width:1170px; height:500px; overflow:auto;"
>
109.
<table width=
"100%"
border=
"1"
cellspacing=
"0"
cellpadding=
"2"
style=
"border-collapse:collapse;"
>
110.
<tr><br/>
111.
<td height=
"20"
align=
"center"
bgcolor=
"#78e278"
> วันเข้ารับการรักษา </td>
112.
<td height=
"5"
align=
"center"
bgcolor=
"#78e278"
> รหัสผู้ป่วย </td>
113.
<td height=
"15"
align=
"center"
bgcolor=
"#78e278"
> ชื่อ-สกุล </td>
114.
<td height=
"5"
align=
"center"
bgcolor=
"#78e278"
> อายุ </td>
115.
<td height=
"10"
align=
"center"
bgcolor=
"#78e278"
> รหัสประจำตัวประชาชน </td>
116.
<td height=
"10"
align=
"center"
bgcolor=
"#78e278"
> กลุ่มโรค </td>
117.
<td height=
"5"
align=
"center"
bgcolor=
"#78e278"
> ที่อยู่ </td>
118.
<td height=
"10"
align=
"center"
bgcolor=
"#78e278"
> หมู่ </td>
119.
<td height=
"10"
align=
"center"
bgcolor=
"#78e278"
> ตำบล </td>
120.
<td height=
"10"
align=
"center"
bgcolor=
"#78e278"
> อำเภอ </td>
121.
<td height=
"10"
align=
"center"
bgcolor=
"#78e278"
> จังหวัด </td>
122.
</tr>
123.
124.
<?php
125.
$rows
=20;
126.
if
(
$page
<=0)
$page
=1;
127.
$total_data
=mysql_num_rows(mysql_query(
"Select * from psychiatric_patients "
));
128.
$total_page
=
ceil
(
$total_data
/
$rows
);
129.
if
(
$page
>=
$total_page
)
$page
=
$total_page
;
130.
$start
=(
$page
-1)*
$rows
;
131.
$i
=1;
132.
$q
.=
"SELECT b.x, b.y, a. * "
;
133.
$q
.=
" FROM `travmmre_psy`.`psychiatric_patients` a"
;
134.
$q
.=
" LEFT JOIN `travmmre_psy`.`subdistric` b ON a.Subdistric = b.Sub_name"
;
135.
$q
.=
" LEFT JOIN `travmmre_psy`.`icd10` c ON a.I10name = c.icd10_name"
;
136.
$q
.=
" LEFT JOIN `travmmre_psy`.`district` d ON a.District = d.Dis_name"
;
137.
$q
.=
" WHERE 1"
;
138.
139.
140.
141.
if
(
$_POST
[
'day1'
]&&
$_POST
[
'day2'
])
142.
{
143.
$q
.=
" AND Dates between '"
.
$_POST
['day1
']."'
and
'".$_POST['
day2
']."'
";
144.
}
145.
if
(
$_POST
[
'HN1'
])
146.
{
147.
$q
.=
" AND a.Hn LIKE '%"
.
$_POST
['HN1
']. "%'
";
148.
}
149.
if
(
$_POST
[
'name1'
])
150.
{
151.
$q
.=
" AND a.Names LIKE '%"
.
$_POST
['name1
']. "%'
";
152.
}
153.
if
(isset(
$_POST
[
'myradio'
]) &&
$_POST
[
'myradio'
]!=
''
){
154.
155.
if
(
$_POST
[
'myradio'
]===
'ผู้ป่วยรายเก่า'
)
156.
{
157.
$q
.=
" AND a.Hn !='' "
;
158.
159.
}
160.
else
161.
{
162.
$q
.=
" AND a.Hn ='' "
;
163.
164.
}
165.
}
166.
167.
if
(isset(
$_POST
[
'$row[icd10_name]'
]) &&
$_POST
[
'$row[icd10_name]'
]!=
''
){
168.
169.
$q
.=
" AND a.I10name ='"
.'
$row
[icd10_name]
'."'
" ;
170.
171.
}
172.
if
(isset(
$_POST
[
'myselect1'
]) &&
$_POST
[
'myselect1'
]!=
''
){
173.
174.
$q
.=
" AND a.District ='"
.
$_POST
['myselect1
']."'
" ;
175.
176.
}
177.
if
((isset(
$_POST
[
'myselect2'
])) &&
$_POST
[
'myselect2'
]!=
''
){
178.
179.
$q
.=
" AND substr(a.Dates,7,2) ="
.
$_POST
[
'myselect2'
] ;
180.
181.
}
182.
$_SESSION
[
'query'
]=
$q
;
183.
echo
$q
;
184.
$qr
=@mysql_query(
$q
);
185.
while
(
$rs
=@mysql_fetch_array(
$qr
)){
186.
if
(
$bg
==
"#ffffff"
){
187.
$bg
=
"#A4FFA4"
;}
188.
else
{
189.
$bg
=
"#ffffff"
;}
190.
?>
191.
192.
<tr bgcolor=
"<?=$bg?>"
scrolling=
"yes"
>
193.
194.
<td height=
"5"
> <?=
$rs
[
'Dates'
]?></td>
195.
<td height=
"5"
> <?=
$rs
[
'Hn'
]?></td>
196.
<td height=
"5"
> <?=
$rs
[
'Names'
]?></td>
197.
<td height=
"5"
> <?=
$rs
[
'Age_AVG'
]?></td>
198.
<td height=
"5"
> <?=
$rs
[
'Cid'
]?></td>
199.
<td height=
"5"
> <?=
$rs
[
'I10name'
]?></td>
200.
<td height=
"5"
> <?=
$rs
[
'Addrpart'
]?></td>
201.
<td height=
"5"
> <?=
$rs
[
'Moopart'
]?></td>
202.
<td height=
"5"
> <?=
$rs
[
'Subdistric'
]?></td>
203.
<td height=
"5"
> <?=
$rs
[
'District'
]?></td>
204.
<td height=
"5"
> <?=
$rs
[
'Province'
]?></td>
205.
</tr>
206.
<?php
$i
++; } ?>
207.
208.
</table>
209.
210.
</td>
211.
</tr>
212.
</tbody>
213.
214.
215.
<thead>
216.
<tr>
217.
<td align=
"left"
>
218.
219.
220.
221.
</div>
222.
223.
224.
</td>
225.
</tr>
226.
<tr>
227.
<td height=
"30"
align=
"left"
> </td>
228.
</tr>
229.
</thead>
230.
231.
<tfoot>
232.
<tr>
233.
<td height=
"30"
> </td>
234.
</tr>
235.
<tr>
236.
<td align=
"left"
>
237.
</td>
238.
</tr>
239.
</tfoot>
240.
</table>
241.
<nav>
242.
<ul
class
=
"pagination"
>
243.
<li><?
if
(
$page
==1)
'class="disabled"'
;?>
244.
<a href=
"Review_admin.php?page=<?=$page-1?>"
aria-label=
"Previous"
>
245.
<span aria-hidden=
"true"
>«</span>
246.
</a>
247.
</li>
248.
<?
for
(
$i
=1;
$i
<
$total_page
;
$i
++){?>
249.
<li <?
if
(
$page
==
$i
)
echo
'class="active"'
;?>><a href=
"Review_admin.php?page=<?=$i?>"
><?=
$i
?></a></li>
250.
<? } ?>
251.
<li><?
if
(
$page
==
$total_page
)
'class="disabled"'
;?>
252.
<a href=
"Review_admin.php?page=<?=$page+1?>"
aria-label=
"Next"
>
253.
<span aria-hidden=
"true"
>»</span>
254.
</a>
255.
</li>
256.
</ul>
257.
</nav>
258.
</div>
259.
260.
</div>
261.
</div>