-
Notifications
You must be signed in to change notification settings - Fork 1
/
bmi.php
261 lines (223 loc) · 8.31 KB
/
bmi.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
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
<?php
include ('conn.php');
session_start();
if($_SESSION["Username"]=="") // ตรวจสอบว่าผ่านการ login หรือไม่
{
header('location:login.php');
exit();
}
include 'header.php';
?>
<div class="container">
<div class="jumbotron">
<h1><font face ="JasmineUPC">โรงพยาบาลเจ้าพระยาอภัยภูเบศร</font></h1>
<p>คำนวณค่า BMI ให้กับผู้ป่วย<p>
<form method="POST">
<label for="department"> แผนก : </label>
<select id="dep" name="dep" required onchange="document.getElementById('selected_text').value=this.options[this.selectedIndex].text">
<option value="o" disabled selected>-------แสดงทั้งหมด-------</option>
<?
@include('conn.php');
$strSQL = "SELECT DISTINCT clinic, clinicdescribe FROM fpatient_info";
$objQuery = mysql_query($strSQL) or die("Error Query [".$strSQL."]");
while ($objReSult = mysql_fetch_array($objQuery)) {
?>
<option value=<?echo $objReSult["clinic"];?>><?echo $objReSult["clinicdescribe"];?></option>
<?
}
?>
</select>
<input type="hidden" name="selected_text" id="selected_text" value="" />
<input type="submit" name="search" value="Search"/>
</form>
</div>
</div>
<div class="container">
<?php
@include('conn.php');
$dep = $_POST['dep'];
if ($dep != 0) {
# code...
$strSQL = "SELECT * FROM fpatient_info where clinic = '".$dep."'";
$objQuery = mysql_query($strSQL) or die("Error Query [".$strSQL."]");
}
else{
# code...
$strSQL = "SELECT * FROM fpatient_info";
$objQuery = mysql_query($strSQL) or die("Error Query [".$strSQL."]");
}
?>
<form method="POST" action="chkPHP.php">
<table class="table table-striped table-bordered">
<tr class="warning">
<th><div align="center">Clinic</div></th>
<th><div align="center">Clinic Name</div></th>
<th><div align="center">HN</div></th>
<th><div align="center">FIRST NAME</div></th>
<th><div align="center">LAST NAME</div></th>
<th><div align="center">BMI</div></th>
</tr>
<?
$new_hn = array();
$i = 0;
while ($objReSult = mysql_fetch_array($objQuery)) {
# code...
$i++;
?>
<tr class ="info">
<td><div align = "center"><?php echo $objReSult["clinic"];?></div></td>
<td><div><? echo $objReSult["clinicdescribe"];?></div></td>
<td><div align = "center"><? echo $objReSult["hn"];?></div></td>
<td><div><? echo $objReSult["fname"];?></div></td>
<td><div><? echo $objReSult["lname"];?></div></td>
<td><div><center><a data-toggle="modal" name="hn" onclick="setHn(<? echo $objReSult["hn"]; $testtest = $objReSult["hn"];?>)" href="#myModal">BMI</a> <a data-toggle="modal" name="update" onclick="updateHn(<? echo $objReSult["hn"]; $testtest = $objReSult["hn"];?>)" href="#myModal1">แก้ไข</a></center></div></td>
</tr>
<?
// $temp = array("a", "b", "c");
// $_SESSION['hn'] = $new_hn[];
// $_SESSION['hn'] = $objReSult["hn"];
// $_SESSION['fname'] = $objReSult["fname"];
// list($data1,$data2,$data3) = split("_", $id);
}
?>
</table>
</div>
<div class="container">
<div class="col-md-2 col-xs-2"></div>
<div class="col-md-2 col-xs-2"></div>
<div class="col-md-2 col-xs-2"></div>
<div class="col-md-2 col-xs-2"></div>
<div class="col-md-2 col-xs-2"></div>
<div class="col-md-2 col-xs-2"><input type="submit" name="" class="btn btn-lg btn-success" value=" บันทึก "></div>
</div>
<br>
</form>
<footer class="text-center">
<a class="up-arrow" href="#myPage" data-toggle="tooltip" title="TO TOP">
<span class="glyphicon glyphicon-chevron-up"></span>
</a><br><br>
<p>จัดทำโดย <a href="http://www.cpa.go.th" data-toggle="tooltip">โรงพยาบาลเจ้าพระยาอภัยภูเบศร</a></p>
</footer>
<script>
function setHn(id){
//alert(id);
$('#hnModal').html(id);
}
function updateHn(id){
$('#hnModalUp').html(id);
}
function submitModal(){
var weight = $('#weight').val();
var hn = $('#hnModal').html();
var height = $('#height').val();
// alert(idFood + ' ' + hn + ' ' + detail);
$.ajax({
type: "POST",
url: "insert_bmi.php",
data: { 'hn': hn,
'weight' : weight,
'height' : height
}
})
.done(function( msg ) {
alert(msg);
});
}
$(document).ready(function(){
// Initialize Tooltip
$('[data-toggle="tooltip"]').tooltip();
// Add smooth scrolling to all links in navbar + footer link
$(".navbar a, footer a[href='#myPage']").on('click', function(event) {
// Make sure this.hash has a value before overriding default behavior
if (this.hash !== "") {
// Prevent default anchor click behavior
event.preventDefault();
// Store hash
var hash = this.hash;
// Using jQuery's animate() method to add smooth page scroll
// The optional number (900) specifies the number of milliseconds it takes to scroll to the specified area
$('html, body').animate({
scrollTop: $(hash).offset().top
}, 900, function(){
// Add hash (#) to URL when done scrolling (default click behavior)
window.location.hash = hash;
});
} // End if
});
})
</script>
<form id="bmi" method="POST" action="insert_bmi.php">
<div id="myModal" class="modal fade" role="dialog">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">×</button>
<h4 class="modal-title">การส่งค่า BMI</h4>
</div>
<div class="modal-body">
<?
@include("conn.php");
$strSQL2 = "SELECT * FROM fpatient_info where hn = '".$testtest."' ";
$objQuery2 = mysql_query($strSQL2, $connect2);
$objReSult2 = mysql_fetch_array($objQuery2);
// {
// ?>
<table>
<h4>รหัสผู้ป่วย : <label id="hnModal"></label></h4>
<tr> <h4> ชื่อ : <? echo $objReSult2["fname"];?> <? echo $objReSult2["lname"];?> </h4></span></tr></p><br>
น้ำหนัก : <input type="text" name="txtW" id="weight"> กิโลกรัม <br><br>
ส่วนสูง : <input type="text" name="txtH" id="height" > เซนติเมตร<br><br>
<?
// }
?>
</table>
</div>
<div class="modal-footer">
<input type="button" name= "submit" class="btn btn-success" value = "submit">
<button type="button" class="btn btn-danger" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
</div>
</form>
<form id="bmi" method="POST" action="update_bmi.php">
<div id="myModal1" class="modal fade" role="dialog">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">×</button>
<h4 class="modal-title">การส่งค่า BMI</h4>
</div>
<div class="modal-body">
<?
@include("conn.php");
$strSQL2 = "SELECT * FROM fpatient_info where hn = '".$testtest."' ";
$objQuery2 = mysql_query($strSQL2, $connect2);
$objReSult2 = mysql_fetch_array($objQuery2);
$strSQL3 = "SELECT * FROM bmi_table where hn = '".$testtest."' ";
$objQuery3 = mysql_query($strSQL3, $connect1);
$objReSult3 = mysql_fetch_array($objQuery3);
// {
// ?>
<table>
<h4>รหัสผู้ป่วย : <label id="hnModalUp"></label></h4>
<tr> <h4> ชื่อ : <? echo $objReSult2["fname"];?> <? echo $objReSult2["lname"];?> </h4></span></tr></p><br>
น้ำหนัก : <input type="text" name="txtW" id="weight" value="<? echo $objReSult3["weight"];?>"> กิโลกรัม <br><br>
ส่วนสูง : <input type="text" name="txtH" id="height" value="<? echo $objReSult3["height"];?>"> เซนติเมตร<br><br>
<?
// }
?>
</table>
</div>
<div class="modal-footer">
<input type="button" name= "submit" class="btn btn-success" value = "submit">
<button type="button" class="btn btn-danger" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
</div>
</form>
</body>
</html>