ESH/checkup_form_view.php
2024-10-23 18:28:06 +05:30

2557 lines
41 KiB
PHP

<style>
#panel-title1>a,
#panel-title1>a:active {
display: block;
font-size: 12px;
font-family: "Source Sans Pro", "Helvetica Neue", Helvetica, Arial, sans-serif;
color: #337ab7;
height: 20px;
text-decoration: none;
}
#panel-heading1 a:before {
font-family: 'Glyphicons Halflings';
content: "\e114";
float: right;
transition: all 0.5s;
}
#panel-heading1.active a:before {
-webkit-transform: rotate(180deg);
-moz-transform: rotate(180deg);
transform: rotate(180deg);
}
input {
width: 100px;
}
th {
font-size: 11px;
font-weight: 600;
}
@media (min-width : 768px) {
.col-sm-12 {
width: 103%;
}
}
input,
input::-webkit-input-placeholder {
font-size: 10px;
}
select {
padding: unset;
}
</style>
<script>
function load_checkup_header(checkup_type_id) {
var roleId = "<?php echo $_SESSION['RoleId'] ?>";
if (roleId != 6)
document.checkup_form_employee.submit();
}
function showHeaderSection(section_id) {
if ($("#" + section_id).prop('checked')) {
$("#pannel_" + section_id).show();
} else {
$("#pannel_" + section_id).hide();
}
}
</script>
<form name="checkup_form_employee" id="checkup_form_employee" method="POST" action="checkup_from_before.php">
<input type="hidden" id="checkup_section_ids" name="checkup_section_ids[]">
<div class="mainPanel">
<div class="panel-group" id="accordion">
<div class="panel panel-default">
<div class="panel-heading" id="panel-heading1">
<h5 class="panel-title" id="panel-title1" style="display: block; font-size: 12px; color: #337ab7;
height: 17px;
text-decoration: none;
font-family: 'Source Sans Pro', 'Helvetica Neue',Helvetica, Arial, sans-serif;
;">
Patient DETAILS
</h5>
</div>
<div class="panel-body">
<div class="row">
<?php
$emp_id = $_REQUEST['flex_opd_id'] != '' ? $_REQUEST['flex_opd_id'] : $_REQUEST['emp_id_history'];
$sql_employee = "select * from patient_master where id='$emp_id'";
$result = mysqli_query($conn, $sql_employee);
$checkup_id = $_REQUEST['flex_checkup_id'];
$sql_checkup = "select * from checkup_form where checkup_id='$checkup_id'";
$checkup_result = mysqli_query($conn, $sql_checkup);
$row_checkup = mysqli_fetch_assoc($checkup_result);
while ($row_employee = mysqli_fetch_assoc($result)) {
?>
<input type="hidden" id="checkup_emp_id" name="checkup_emp_id" value="<?php echo ($_REQUEST['flex_opd_id'] != '' && $_REQUEST['flex_opd_id'] != null) ? $_POST['flex_opd_id'] : $_REQUEST['emp_id_history']; ?>">
<div class="table-responsive">
<table class="table table-bordered">
<thead>
<tr>
<th>Ticket No</th>
<th>Patient id</th>
<th>Employee Code</th>
<th>Employee Name</th>
<th>Employee Designation</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<?php
$ticket_no = getTableFieldValue('checkup_form', 'max(checkup_id)');
if ($row_checkup == "" or $row_checkup == null) {
?>
TCKT-<?php echo $ticket_no + 1;
} else {
echo $row_checkup['ticket_no'];
}
?>
<input id="ticket_no" type="hidden" style="height: 30px" class="form-control" name="ticket_no" value="<?php echo $row_checkup['ticket_no']; ?>" />
</td>
<td> <?= $row_employee['emp_code'] ?></td>
<td> <?= $row_employee['id'] ?></td>
<td> <?php echo ($row_employee['patient_name']) ?></td>
<td><?php echo $employee_designation = getTableFieldValue('designation', 'designation_name', 'designation_id', $row_employee['designation_id']); ?></td>
</tr>
</tbody>
</table>
</div>
<?php } ?>
</div>
<div class="row">
<div class="col-sm-4">
<div class="table-responsive">
<table class="table table-bordered">
<tr>
<th>Checkup Date</th>
</tr>
<tr>
<input type="hidden" name="checkup_id" id="checkup_id" value="<?php echo $checkup_id; ?>">
<input type="hidden" name="isHiperTensed" id="isHiperTensed">
<?php
if ($_SESSION['RoleId'] == 6) { ?>
<input type="hidden" name="is_test_completed" id="is_test_completed" value="N">
<?php } else { ?>
<input type="hidden" name="is_test_completed" id="is_test_completed" value="Y">
<?php }
?>
<td>
<div class="input-group"><input id="checkdown_date" readonly name="checkdown_date" type="text" class="form-control" style="height:30px" />
<span class="input-group-addon">
<i style="height:5px" class="fa fa-clock-o bigger-110"></i>
</span>
</div>
</td>
</tr>
</table>
</div>
</div>
<div class="col-sm-4">
<div style="margin-left: 10px;">
<table class="table table-bordered">
<tr>
<th>Remarks</th>
</tr>
<tr>
<td><textarea readonly class="form-control" rows="2" name="remarks" id="remarks"></textarea></td>
</tr>
</table>
</div>
</div>
</div>
</div>
<div style="display: none" class="row">
<div class="col-sm-12">
<div style="margin-left: 10px;">
<table class="table table-bordered">
<tr>
<th colspan="4">Checkup Section Header</th>
</tr>
<tr>
<?php
$sql_section = "select * from checkup_form_section order by section_id asc";
// echo $sql_section;
$count = 1;
$i = 0;
$checkup_section_header = [];
$checkup_section_headers = $row_checkup['checkup_section_ids'];
$check_section_ids = array();
$check_section_headers = array();
$result_section = mysqli_query($conn, $sql_section);
while ($row_section = mysqli_fetch_assoc($result_section)) {
array_push($check_section_ids, $row_section['section_id']);
array_push($check_section_headers, $row_section['section_desc']);
if ($count == 4) {
?>
<tr><?php
}
array_push($checkup_section_header, intval($checkup_section_headers[$i]));
?>
<td>
<div id="section_header_div">
<input type="checkbox" id="<?php echo $row_section['section_desc']; ?>" name="<?php echo $row_section['section_id']; ?>" value="<?php echo $row_section['section_id']; ?>" onclick="showHeaderSection('<?php echo $row_section['section_desc']; ?>')">
<?php echo $row_section['section_name'];
?>
</td>
</div>
<?php if ($count % 3 == 0) {
?></tr><?php
}
$count++;
$i = $i + 2;
} ?>
</table>
</div>
</div>
</div>
</div>
<?php
$sql_health_advice = "select * from health_advice";
$sql_health_risk = "select * from health_risk";
$result_health_advice = mysqli_query($conn, $sql_health_advice);
$heath_advice_array = array();
$k = 0;
while ($row_health_advice = mysqli_fetch_assoc($result_health_advice)) {
$heath_advice_array[$k] = $row_health_advice;
$k++;
}
$k = 0;
$result_health_risk = mysqli_query($conn, $sql_health_risk);
$heath_risk_array = array();
while ($row_health_risk = mysqli_fetch_assoc($result_health_risk)) {
$heath_risk_array[$k] = $row_health_risk;
$k++;
}
$sql_checkup_parameter_range = "select * from checkup_parameter ";
$result_checkup_parameter_range = mysqli_query($conn, $sql_checkup_parameter_range);
$i = 0;
$parameter_names = array();
$starting_ranges = array();
$ending_ranges = array();
$less_risks = array();
$more_risks = array();
$less_advices = array();
$more_advices = array();
$column_names = array();
while ($row_checkup_parameter_range = mysqli_fetch_assoc($result_checkup_parameter_range)) {
$parameter_names[$i] = $row_checkup_parameter_range['parameter_name'];
$column_names[$i] = $row_checkup_parameter_range['column_name'];
$starting_ranges[$i] = $row_checkup_parameter_range['starting_range'];
$ending_ranges[$i] = $row_checkup_parameter_range['ending_range'];
$less_advices[$i] = $row_checkup_parameter_range['less_advices'];
$more_advices[$i] = $row_checkup_parameter_range['more_advices'];
$less_risks[$i] = $row_checkup_parameter_range['less_risks'];
$more_risks[$i] = $row_checkup_parameter_range['more_risks'];
$i = $i + 1;
}
?>
<?php
$checkup_type_id = $_REQUEST['checkup_type_id_db'] != '' ? $_REQUEST['checkup_type_id_db'] : $_REQUEST['checkup_type_id'];
// $sql_checkup_parameter_section = "select * from checkup_form_section order by section_id asc";
$sql_checkup_parameter_section = "select * from checkup_form_section order by section_id asc";
// echo $sql_checkup_parameter_section;
?>
<?php
// echo $sql_checkup_parameter_section;
$i1 = 0;
$result_checkup_parameter_section = mysqli_query($conn, $sql_checkup_parameter_section);
while ($row_checkup_parameter_section = mysqli_fetch_assoc($result_checkup_parameter_section)) {
// if ($_SESSION['RoleId'] != 6) {
?>
<div class="panel panel-default" id="pannel_<?php echo $row_checkup_parameter_section['section_desc'] ?>" style="display: none;">
<div class="panel-heading" id="panel-heading1">
<h5 class="panel-title" id="panel-title1">
<a role="button" data-toggle="collapse" href="#collapseOne<?php echo $i1; ?>" aria-expanded="true" aria-controls="collapseOne">
<?php echo $row_checkup_parameter_section['section_name'] ?>
</a>
</h5>
</div>
<div id="collapseOne<?php echo $i1; ?>" class="panel-collapse collapse">
<div class="panel-body">
<div style="margin-bottom: 20px" class="panel panel-default">
<?php
$checkup_section_id = $row_checkup_parameter_section['section_id'];
//echo $checkup_section_id;
$sql_questionnaire_sections = "select * from questionnaire_section where section_id = $checkup_section_id";
//echo $sql_questionnaire_sections;
$result_questionnaire_sections = @mysqli_query($conn, $sql_questionnaire_sections);
$countSection = 0;
$count = 0;
$j = 0;
while ($row_questionnaire_sections = @mysqli_fetch_array($result_questionnaire_sections)) {
$section_id = $row_questionnaire_sections['section_id'];
$section_desc = $row_questionnaire_sections['section_description'];
//echo $section_desc;
$sql_questionnaire = "select * from questionnaire where question_section_id='$section_id'";
//echo $sql_questionnaire;
$result_questionnaire = @mysqli_query($conn, $sql_questionnaire);
$no_of__question_rows = mysqli_num_rows($result_questionnaire);
$srNo = 0;
?>
<div class="panel-heading" id="panel-heading1">
<h5 class="panel-title" id="panel-title1">
<a role="button" data-toggle="collapse" href="#collapseOne<?php echo $section_desc; ?>" aria-expanded="true" aria-controls="collapseOne">
Questionnaire
</a>
</h5>
</div>
<div id="collapseOne<?php echo $section_desc; ?>" class="panel-collapse collapse">
<div class="panel-body">
<?php if ($no_of__question_rows > 0) { ?>
<table class="table table-condensed table-bordered" width="100%" border=1 id="familyMembersTable" class="table-hover">
<tbody>
<tr bgcolor="#d3d3d3">
<th>Sr</th>
<th>Question</th>
<th>Answer</th>
</tr>
<?php
if ($no_of__question_rows > 0) {
?>
<input type="hidden" name="querowCount" id="querowCount" value="<?php echo $no_of_all_question_rows; ?>" />
<?php } else { ?>
<input type="hidden" name="querowCount" id="querowCount" value="1" />
<?php
}
?>
<?php
if ($no_of__question_rows > 0) {
while ($row_questionnaire = @mysqli_fetch_array($result_questionnaire)) {
$ques_id = $row_questionnaire['question_id'];
$sql_ans = "select * from questionnaire_ans where que_id='$ques_id' and emp_id=$emp_id";
//echo $sql_ans;
$result_ans = @mysqli_query($conn, $sql_ans);
$row_ans = @mysqli_fetch_array($result_ans);
?>
<tr id="queTableRow<?= $count; ?>">
<td> <?= $srNo + 1; ?></td>
<td><?php echo $row_questionnaire['question_name'] ?> <input name="que_id<?= $count; ?>" value="<?= $row_questionnaire['question_id'] ?>" type="hidden"> </td>
<td align="center"><?php if ($row_ans['answer'] == null || $row_ans['answer'] == "") {
echo "Not answered";
} else {
echo $row_ans['answer'];
} ?></td>
</tr>
<?php
++$count;
++$srNo;
}
}
?>
</tbody>
</table>
<?php } else { ?>
<center> No Questions Available</center>
<?php } ?>
</div>
<center><button class="btn-primary" onclick="goto_employee_questionnaire(<?php echo $emp_id ?>);"> Edit Questionnaire </button>
</center>
</div>
<?php $countSection++;
} ?>
</div>
<?php
$sql_group_by = "SELECT count(*) as total FROM checkup_parameter WHERE checkup_form_section_id = '" . $row_checkup_parameter_section['section_id'] . "' group by group_id order by column_order asc";
//echo $sql_group_by;
$result_group_by = mysqli_query($conn, $sql_group_by);
// $data_group_by=mysqli_fetch_assoc($result_group_by);
// $no_of_tables= $data_group_by['total'];
// echo "shu".$no_of_tables[0]['total'];
$rows_no_groups = array();
$h = 0;
while ($data_group_by = mysqli_fetch_array($result_group_by)) {
$rows_no_groups[$h] = $data_group_by['total'];
$h++;
}
if ($row_checkup != null && $row_checkup != '') {
$sql_checkup_parameter_col = "select * from checkup_parameter a inner join checkup_form_key_value b on b.checkup_form_key=a.column_name where checkup_form_section_id='" . $row_checkup_parameter_section['section_id'] . "' and b.checkup_form_id='" . $row_checkup['checkup_id'] . "' order by column_order asc";
} else {
$sql_checkup_parameter_col = "select * from checkup_parameter where checkup_form_section_id='" . $row_checkup_parameter_section['section_id'] . "' order by column_order asc";
}
// echo $sql_checkup_parameter_col;
$result_checkup_parameter_col = mysqli_query($conn, $sql_checkup_parameter_col);
$no_of_rows = mysqli_num_rows($result_checkup_parameter_col);
if ($no_of_rows == 0) {
$sql_checkup_parameter_col = "select * from checkup_parameter where checkup_form_section_id='" . $row_checkup_parameter_section['section_id'] . "' order by column_order asc";
// echo $sql_checkup_parameter_col;
$result_checkup_parameter_col = mysqli_query($conn, $sql_checkup_parameter_col);
$no_of_rows = mysqli_num_rows($result_checkup_parameter_col);
// echo $no_of_rows;
}
// $no_of_rows=ceil($no_of_rows/9);
// $no_of_rows=ceil($no_of_rows/9);
// echo $no_of_rows;
$data = array();
$count = 0;
$flag_rows = 0;
while ($row_checkup_parameter_col = mysqli_fetch_assoc($result_checkup_parameter_col)) {
$data[] = $row_checkup_parameter_col;
if ($row_checkup_parameter_col['checkup_form_section_id'] == 1 && $flag_rows == 0) {
$no_of_rows = ($no_of_rows / 10);
// echo $no_of_rows;
$flag_rows = 1;
}
}
if ($flag_rows == 0) {
$no_of_rows = ceil(count($rows_no_groups) / 3);
}
$counter = 0;
$h = 0;
$k = 0;
for ($i = 0; $i < $no_of_rows; $i++) {
?>
<div class="row">
<?php
for ($k = 0; $k < 3; $k++) {
$flag = 0;
?><div class="col-sm-4">
<div class="table-responsive" style="margin-left: 10px;">
<table class="table table-bordered">
<tr>
<?php
if ($data[$count]['checkup_form_section_id'] == 10 && $data[$count]['group_id'] == 1) {
?>
<strong>Right Ear-Air conduction</strong>
<?php } else if ($data[$count]['checkup_form_section_id'] == 10 && $data[$count]['group_id'] == 2) { ?>
<strong>Right Ear-Bone conduction</strong>
<?php } else if ($data[$count]['checkup_form_section_id'] == 10 && $data[$count]['group_id'] == 3) { ?>
<strong> Audiometry Result</strong>
<?php
} else if ($data[$count]['checkup_form_section_id'] == 10 && $data[$count]['group_id'] == 4) {
?>
<strong> Left Ear-Air conduction</strong>
<?php
} else if ($data[$count]['checkup_form_section_id'] == 10 && $data[$count]['group_id'] == 5) {
?>
<strong>Left Ear-Bone conduction</strong>
<?php
} else if ($data[$count]['checkup_form_section_id'] == 10 && $data[$count]['group_id'] == 6) {
?>
<strong> Audiometry Result</strong>
<?php
}
if ($data[$count]['checkup_form_section_id'] == 3 && $data[$count]['group_id'] == 1) {
?>
<strong> Distance vision without spectacle</strong>
<?php } else if ($data[$count]['checkup_form_section_id'] == 3 && $data[$count]['group_id'] == 2) { ?>
<strong> Distance vision with spectacle</strong>
<?php } else if ($data[$count]['checkup_form_section_id'] == 3 && $data[$count]['group_id'] == 3) { ?>
&nbsp;
<?php } else if ($data[$count]['checkup_form_section_id'] == 3 && $data[$count]['group_id'] == 4) { ?>
<strong> Correction Right Eye</strong>
<?php } else if ($data[$count]['checkup_form_section_id'] == 3 && $data[$count]['group_id'] == 5) { ?>
<strong> Correction spectacle</strong>
<?php } else if ($data[$count]['checkup_form_section_id'] == 3 && $data[$count]['group_id'] == 6) { ?>
&nbsp;
<?php
}
if ($data[$count]['checkup_form_section_id'] == 11 && $data[$count]['group_id'] == 1) {
?>
<strong> In Liters</strong>
<?php } else if ($data[$count]['checkup_form_section_id'] == 11 && $data[$count]['group_id'] == 2) { ?>
<strong> &nbsp;</strong>
<?php } else if ($data[$count]['checkup_form_section_id'] == 11 && $data[$count]['group_id'] == 3) { ?>
&nbsp;
<?php } else if ($data[$count]['checkup_form_section_id'] == 11 && $data[$count]['group_id'] == 4) { ?>
<strong> In %</strong>
<?php } else if ($data[$count]['checkup_form_section_id'] == 11 && $data[$count]['group_id'] == 5) { ?>
<strong> &nbsp;</strong>
<?php
}
for ($j = 0; $j < $rows_no_groups[$h]; $j++) {
?>
<th><?php
echo $data[$count]['parameter_name'];
$count++;
if ($count == count($data)) {
$flag = 1;
break;
}
?></th>
<?php
}
?>
</tr>
<tr>
<?php
for ($j = 0; $j < $rows_no_groups[$h]; $j++) {
$parameter_values = $data[$counter]['parameter_value'];
if ($parameter_values != "" || $parameter_values != null) {
$parameter_values_array = explode(",", $parameter_values);
?>
<td><select id="<?= $data[$counter]['column_name'] ?>" name="<?= $data[$counter]['column_name'] ?>" data-placeholder="Chose Tobacco Type">
<?php
for ($p = 0; $p < count($parameter_values_array); $p++) {
$parameter_name = getTableFieldValue('checkup_parameter_value', 'parameter_value_name', 'parameter_value_id', $parameter_values_array[$p]);
if ($data[$counter]['checkup_form_value'] == $parameter_values_array[$p]) {
echo "<option value='" . $parameter_values_array[$p] . "' selected >" . $parameter_name . "</option>";
} else {
echo "<option value='" . $parameter_values_array[$p] . "'>" . $parameter_name . "</option>";
}
}
?>
</select></td>
<?php
} else {
$input_type = $data[$counter]['input_type'];
if ($input_type == 'number') {
?>
<td><input readonly id="<?= $data[$counter]['column_name'] ?> class=" form-control" name="<?= $data[$counter]['column_name'] ?>" type="number" min="<?php echo $data[$counter]['starting_range']; ?>" max="<?php echo $data[$counter]['ending_range']; ?>" placeholder="<?= $data[$counter]['place_holder_name'] ?>" onchange="calculateRiskAndAdvice();calculateBMI();calculateIsHyperTense();"></td>
<?php
} else {
if ($data[$counter]['checkup_form_section_id'] == 12 || $data[$counter]['checkup_form_section_id'] == 13 || $data[$counter]['checkup_form_section_id'] == 14 || ($data[$counter]['checkup_form_section_id'] == 11 && $data[$counter]['group_id'] == 3)) {
?>
<td><textarea id="<?= $data[$counter]['column_name'] ?>" rows="4" class="form-control" name="<?= $data[$counter]['column_name'] ?>" onchange="calculateRiskAndAdvice()" placeholder="<?= $data[$counter]['place_holder_name'] ?>"> </textarea></td>
<?php
} else {
?>
<td><input readonly id="<?= $data[$counter]['column_name'] ?>" class="form-control" name="<?= $data[$counter]['column_name'] ?>" value="<?= $data[$counter]['checkup_form_value'] ?>" type="text" placeholder="<?= $data[$counter]['place_holder_name'] ?>" onchange="calculateRiskAndAdvice();calculateBMI();calculateIsHyperTense();"></td>
<?php
}
}
}
$counter++;
if ($counter == count($data)) {
// $flag1=1;
break;
}
}
$h++;
?>
</tr>
</table>
</div>
</div> <?php
if ($flag == 1)
break;
}
?>
</div>
<?php } ?>
</div>
</div>
</div>
<?php
// }
$i1++;
}
?>
</div>
</div>
<?php
if ($_SESSION['RoleId'] == 7) {
?>
<div class="row table-responsive">
<div class="col-xs-6 col-sm-6 widget-container-col table-responsive" id="widget-container-col-1">
<div class="widget-box collapsed" id="widget-box-1" data-action="collapse">
<div class="widget-header">
<h5 class="widget-title">Health Risk</h5>
<div class="widget-toolbar">
<?php
if ($_SESSION['RoleId'] == 7) {
?>
<?php
} else {
?>
<a href="#" onclick="validation_checkup_form();" data-action="none" class="green"> <i class="ace-icon fa fa-floppy-o bigger-120"></i>
</a>
<?php } ?>
<a href="#" data-action="collapse"> <i class="ace-icon fa fa-chevron-down"></i>
</a>
</div>
</div>
<div class="widget-body">
<div class="widget-main">
<div class="row">
<div class="col-sm-6">
<label class="control-label" for="health_risk_name"></label> <select readonly multiple="" class="chosen-select form-control" id="health_risk_name" name="health_risk_name[]" data-placeholder="">
<?php echo generateOption('health_risk', 'health_risk_name', 'health_risk_id', '', ''); ?>
</select>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="col-xs-6 col-sm-6 widget-container-col" id="widget-container-col-1">
<div class="widget-box box box-info collapsed" id="widget-box-1" data-action="collapse">
<div class="widget-header">
<h5 class="widget-title">Health Advice</h5>
<div class="widget-toolbar">
<?php
if ($_SESSION['RoleId'] == 7) {
?>
<?php
} else {
?>
<a href="#" onclick="validation_checkup_form();" data-action="none" class="green"> <i class="ace-icon fa fa-floppy-o bigger-120"></i>
</a>
<?php } ?>
<a href="#" data-action="collapse"> <i class="ace-icon fa fa-chevron-down"></i>
</a>
</div>
</div>
<div class="widget-body">
<div class="widget-main">
<div class="row">
<div class="col-sm-6">
<label class="control-label" for="health_advice_name"></label> <select readonly multiple="" style="" class="chosen-select form-control" id="health_advice_name" name="health_advice_name[]" data-placeholder="">
<?php echo generateOption('health_advice', 'health_advice_name', 'health_advice_id', '', ''); ?>
</select>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<?php } ?>
</form>
<style>
.row {
margin-right: 0px;
}
.ace-icon {
margin-right: unset;
}
.widget-toolbar>.widget-menu>a[data-action]>.ace-icon,
.widget-toolbar>a[data-action]>.ace-icon {
margin-right: 12px;
}
</style>
<script>
var checkup_section_name = [];
function get_section_id() {
<?php
$sql_section = "select * from checkup_form_section order by section_id asc";
$result_section = mysqli_query($conn, $sql_section);
$i = 0;
while ($row_section = mysqli_fetch_assoc($result_section)) { ?>
if (document.getElementById('<?php echo $row_section['section_desc'] ?>').checked) {
checkup_section_name.push(document.getElementById('<?php echo $row_section['section_desc'] ?>').name);
//alert(checkup_section_name);
}
<?php $i++;
} ?>
$("#checkup_section_ids").val(checkup_section_name);
alert(checkup_section_name);
/* checkup_section_name.push(section_name);
$("#checkup_section_ids").val(checkup_section_name);
alert(checkup_section_name); */
}
function load_checkup_header(checkup_type_id) {
document.checkup_form_employee.submit();
}
function calculateBMI() {
var height = $("#height").val();
var weight = $("#weight").val();
if (height != null && height != '' && weight != null && weight != '') {
height = parseFloat(height);
weight = parseFloat(weight);
if (height != 0.0)
var bmi = (weight / (height * height)) * 100 * 100;
$("#bmi").val(bmi.toFixed(1));
}
}
function goto_employee_questionnaire(empId) {
// window.location = 'edit_employee_details.php?emp_id='+empId+'&page="checkup"';
window.open('edit_employee_details.php?emp_id=' + empId + '&page="checkup"', '_blank');
}
function open_body() {
/*alert("shubham");
if( document.getElementsByTagName('i').className=='ace-icon fa fa-chevron-down'){
$('.widget-body').show();
$("i").removeClass("ace-icon fa fa-chevron-down").addClass("ace-icon fa fa-chevron-up");
$("#widget-box-1").removeClass("widget-box collapsed").addClass("widget-box");
// $('.widget-body').hide();
}*/
//$('#widget-box-1').find('widget-body').show();
//$('.widget-body'','#widget-box-1').show();
}
function calculateIsHyperTense() {
var sbp = $("#sbp").val();
var dbp = $("#dbp").val();
if (sbp != '' && sbp != null) {
var column_names = <?php echo json_encode($column_names) ?>;
var ending_ranges = <?php echo json_encode($ending_ranges) ?>;
var ending_range = 0;
for (var i = 0; i < column_names.length; i++) {
if (column_names[i] == 'sbp') {
ending_range = ending_ranges[i];
if (parseInt(ending_range) < parseInt(sbp))
$('#isHiperTensed').val("Yes");
break;
}
}
}
if (dbp != '' && dbp != null) {
var column_names = <?php echo json_encode($column_names) ?>;
var ending_ranges = <?php echo json_encode($ending_ranges) ?>;
var ending_range = 0;
for (var i = 0; i < column_names.length; i++) {
if (column_names[i] == 'dbp') {
ending_range = ending_ranges[i];
if (parseInt(ending_range) < parseInt(sbp))
$('#isHiperTensed').val("Yes");
break;
}
}
}
}
// function checkRange(parameter_val,minv,maxv,id) {
// let pv = parseInt(parameter_val);
// let min_val = parseInt(minv);
// let max_val = parseInt(maxv);
// let ids = id;
// let id2 = document.getElementById(id);
// // console.log(min_val);
// // console.log(max_val);
// // console.log(pv);
// // console.log(ids);
// if (pv < min_val) {
// // BootstrapDialog.alert("Value can't be less than min range");
// // id2.style.borderColor='red';
// $("#"+ids).val(" ");
// }
// if (pv > max_val) {
// // BootstrapDialog.alert("Value can't be greater than max range");
// // id2.style.borderColor='red';
// $("#"+ids).val(" ");
// }
// }
function calculateRiskAndAdvice() {
var risk_array = [];
var advice_array = [];
var l = 0;
var m = 0;
var parameter_names = <?php echo json_encode($parameter_names) ?>;
var starting_ranges = <?php echo json_encode($starting_ranges) ?>;
var ending_ranges = <?php echo json_encode($ending_ranges) ?>;
var less_risks = <?php echo json_encode($less_risks) ?>;
var more_risks = <?php echo json_encode($more_risks) ?>;
var less_advices = <?php echo json_encode($less_advices) ?>;
var more_advices = <?php echo json_encode($more_advices) ?>;
var column_names = <?php echo json_encode($column_names) ?>;
var contentForRisk = "";
var contentForAdvice = "";
for (var i = 0; i < column_names.length; i++) {
var starting_range = parseInt(starting_ranges[i]);
var ending_range = parseInt(ending_ranges[i]);
var column_name = column_names[i];
var less_risk = less_risks[i];
var more_risk = more_risks[i];
var less_advice = less_advices[i];
var more_advice = more_advices[i];
var column_value = '';
if ($("#" + column_names[i]).val() != "" && $("#" + column_names[i]).val() != null)
column_value = parseInt($("#" + column_names[i]).val());
if ((column_value != null && column_value != "") && column_value > ending_range) {
var more_risk_array = [];
var more_advice_array = [];
if (more_risk != null && more_risk != "")
more_risk_array = more_risk.split(",");
if (more_advice != null && more_advice != "")
more_advice_array = more_advice.split(",");
if (more_risk != null && more_risk != "")
for (var j = 0; j < more_risk_array.length; j++) {
risk_array[l] = more_risk_array[j];
l++;
/*var more_risk_name="";
$.ajax({
url : 'select_risk_name.php',
data: {id : more_risk_array[j]},
contentType:'json',
dataType:'json',
async: false,
success: function(data){
more_risk_name=data;
},
error:function(data){
alert(data);
}
});
contentForRisk=contentForRisk+"<option selected value='"+more_risk_array[j]+"'>"+more_risk_name+"</option>"*/
}
if (more_advice != null && more_advice != "")
for (var j = 0; j < more_advice_array.length; j++) {
advice_array[m] = more_advice_array[j];
m++;
/* var more_advice_name="";
$.ajax({
url : 'select_advice_name.php',
data: {id : more_advice_array[j]},
contentType:'json',
dataType:'json',
async: false,
success: function(data){
more_advice_name=data;
},
error:function(data){
alert(data);
}
});
contentForAdvice=contentForAdvice+"<option selected value='"+more_advice_array[j]+"'>"+more_advice_name+"</option>"*/
}
}
if ((column_value != null && column_value != "") && column_value < starting_range)
{
var less_risk_array = [];
var less_advice_array = [];
if (less_risk != null && less_risk != "")
less_risk_array = less_risk.split(",");
if (less_advice != null && less_advice != "")
less_advice_array = less_advice.split(",");
if (less_risk != null && less_risk != "")
for (var j = 0; j < less_risk_array.length; j++) {
risk_array[l] = less_risk_array[j];
l++;
/*var less_risk_name="";
$.ajax({
url : 'select_risk_name.php',
data: {id : less_risk_array[j]},
contentType:'json',
dataType:'json',
async: false,
success: function(data){
less_risk_name=data;
},
error:function(data){
alert(data);
}
});
contentForRisk=contentForRisk+"<option selected value='"+less_risk_array[j]+"'>"+less_risk_name+"</option>"*/
}
if (less_advice != null && less_advice != "")
for (var j = 0; j < less_advice_array.length; j++) {
advice_array[m] = less_advice_array[j];
m++;
/* var less_advice_name="";
$.ajax({
url : 'select_advice_name.php',
data: {id : less_advice_array[j]},
contentType:'json',
dataType:'json',
async: false,
success: function(data){
less_advice_name=data;
},
error:function(data){
alert(data);
}
});
contentForAdvice=contentForAdvice+"<option selected value='"+less_advice_array[j]+"' >"+less_advice_name+"</option>"*/
}
}
}
/*var heath_risk_array=<?php echo json_encode($heath_risk_array) ?>;
var heath_advice_array=<?php echo json_encode($heath_advice_array) ?>;
var element = document.getElementById('health_risk_name');
var element1 = document.getElementById('health_advice_name');
for (var i = 0; i < element.options.length; i++) {
element.options[i].selected = risk_array.indexOf(element.options[i].value) >= 0;
}
$('#health_risk_name').trigger('chosen:updated');
for (var i = 0; i < element1.options.length; i++) {
element1.options[i].selected = advice_array.indexOf(element1.options[i].value) >= 0;
}
$('#health_advice_name').trigger('chosen:updated');*/
/*for(var j=0;j<risk_array.length;j++)
{
var flag=0;
for(var k=0;heath_risk_array.length;k++){
if(risk_array[j]==heath_risk_array[k].health_risk_id){
flag=1;
contentForRisk=contentForRisk+"<option selected value='"+risk_array[j]+"'>"+heath_risk_array[k].health_risk_name+"</option>"
break;
}
}
if(flag==0){
contentForRisk=contentForRisk+"<option value='"+risk_array[j]+"'>"+heath_risk_array[k].health_risk_name+"</option>"
} */
/*for(var k=0;k<risk_array.length;k++){
if(risk_array[k]==heath_risk_array[j].health_advice_id){
flag=1;
contentForRisk=contentForRisk+"<option selected value='"+risk_array[j]+"'>"+heath_risk_array[j].health_risk_name+"</option>"
break;
}
}
if()*/
// $("#health_risk_name").html(contentForRisk);
/* $("#health_advice_name").append(contentForAdvice);
$('#health_advice_name').trigger('chosen:updated');*/
}
$(document).ready(function() {
//option A
$("#checkup_form_employee").submit(function(e) {
e.preventDefault();
});
});
function validation_checkup_form()
{
/* if(window.alert==true){
return false;
} */
/* document.getElementById("checkup_form_employee").onsubmit = function () {
var inputs = document.querySelectorAll(".input");
for (var i in inputs)
if (!inputs[i].validity.valid) {
inputs[i].focus();
return false;
}
ajaxSubmit();
return false;
};*/
// var inputs = document.querySelectorAll("input");
/*if(('inputs:invalid').length > 0){
return false;
}*/
/* for (var i in inputs)
if (!inputs[i].validity.valid) {
inputs[i].focus();
return false;
}*/
/* $("form#checkup_form_employee :input").each(function(){
var input = $(this); // This is the jquery object of the input, do what you will
if(('input:invalid').length > 0){
return false;
}
});*/
// alert("sh");
/*var sbp = $('#sbp').val();
if(sbp == ''){
BootstrapDialog.alert('Please Enter SBP.!!!');
return false;
}
var dbp = $('#dbp').val();
if(dbp == ''){
BootstrapDialog.alert('Please Enter DBP.!!!');
return false;
}
var dvrt = $('#dvrt').val();
if(dvrt == ''){
BootstrapDialog.alert('Please Enter DVRT.!!!');
return false;
}
var nvrt = $('#nvrt').val();
if(nvrt == ''){
BootstrapDialog.alert('Please Enter NVRT.!!!');
return false;
}
var nvlt = $('#nvlt').val();
if(nvlt == ''){
BootstrapDialog.alert('Please Enter NVLT.!!!');
return false;
}
var cv = $('#cv').val();
if(cv == ''){
BootstrapDialog.alert('Please Enter CV.!!!');
return false;
}
var fundoscopy = $('#fundoscopy').val();
if(fundoscopy == ''){
BootstrapDialog.alert('Please Enter Fundoscopy.!!!');
return false;
}
var urine_albumin = $('#urine_albumin').val();
if(urine_albumin == ''){
BootstrapDialog.alert('Please Enter Urine Albumin.!!!');
return false;
}
var urine_sugar = $('#urine_sugar').val();
if(urine_sugar == ''){
BootstrapDialog.alert('Please Enter Urine Sugar.!!!');
return false;
}
var urine_bile_pigments = $('#urine_bile_pigments').val();
if(urine_bile_pigments == ''){
BootstrapDialog.alert('Please Enter Urine Bile Pigment.!!!');
return false;
}
var urine_ketones = $('#urine_ketones').val();
if(urine_ketones == ''){
BootstrapDialog.alert('Please Enter Urine ketones.!!!');
return false;
}
var urine_epithelial_cells = $('#urine_epithelial_cells').val();
if(urine_epithelial_cells == ''){
BootstrapDialog.alert('Please Enter Urine Epithelial Cells .!!!');
return false;
}
var hb = $('#hb').val();
if(hb == ''){
BootstrapDialog.alert('Please Enter HB%.!!!');
return false;
}
*/
save();
}
jQuery(function($) {
var checkup_id = "<?php echo $checkup_id ?>"
if (checkup_id != '')
if (!ace.vars['old_ie']) $('#checkdown_date').datetimepicker({
format: 'DD/MM/YYYY h:mm A', //use this option to display seconds
defaultDate: new Date("<?= $row_checkup['checkup_date'] ?>"),
maxDate: new Date(),
//minDate: new Date()-10,
icons: {
time: 'fa fa-clock-o',
date: 'fa fa-calendar',
up: 'fa fa-chevron-up',
down: 'fa fa-chevron-down',
previous: 'fa fa-chevron-left',
next: 'fa fa-chevron-right',
today: 'fa fa-arrows ',
clear: 'fa fa-trash',
close: 'fa fa-times'
}
}).next().on(ace.click_event, function() {
$(this).prev().focus();
});
});
checkup_id = <?php echo $row_checkup['checkup_id'] ?>;
get_checkup_sections_id();
function get_checkup_sections_id() {
var check_section_ids = <?php echo json_encode($check_section_ids); ?>
var check_section_headers = <?php echo json_encode($check_section_headers); ?>
$.ajax({
url: 'get_checkup_section_ids.php',
type: "POST",
data: {
checkup_id: checkup_id
},
dataType: 'json',
success: function(data) {
var checkup_section_ids = data.checkup_section_ids;
var checkup_section_ids_array = checkup_section_ids.split(",");
for (var j = 0; j < checkup_section_ids_array.length; j++) {
for (var i = 0; i < check_section_ids.length; i++) {
if (check_section_ids[i] == checkup_section_ids_array[j]) {
$("#" + check_section_headers[i]).prop("checked", true);
$("#pannel_" + check_section_headers[i]).show();
break;
}
}
}
},
error: function(data) {
return;
}
});
$('.close').click();
}
</script>
<?php
$sql = "select health_risk_id form checkdown_form";
$result = mysqli_query($conn, $sql);
$rw = mysqli_fetch_array($result);
?>