765 lines
14 KiB
PHP
765 lines
14 KiB
PHP
|
<?php
|
||
|
|
||
|
error_reporting(E_ERROR | E_PARSE);
|
||
|
|
||
|
|
||
|
|
||
|
$id = ($_REQUEST['patient_id'] != '' && $_REQUEST['patient_id'] != null) ? $_POST['patient_id'] : $_REQUEST['emp_id_history'];
|
||
|
|
||
|
|
||
|
error_log("checking_idinquest " . $id);
|
||
|
// echo $id;
|
||
|
|
||
|
|
||
|
|
||
|
/*
|
||
|
|
||
|
* $query_checkup_parameter="select * from checkup_parameter ";
|
||
|
|
||
|
*
|
||
|
|
||
|
* $result_checkup_parameter = @mysqli_query($conn,$query_checkup_parameter);
|
||
|
|
||
|
*
|
||
|
|
||
|
* $checkup_parameter_array=array();
|
||
|
|
||
|
*
|
||
|
|
||
|
* $k=0;
|
||
|
|
||
|
*
|
||
|
|
||
|
* while($row_checkup_parameter=@mysqli_fetch_assoc($result_checkup_parameter)){
|
||
|
|
||
|
*
|
||
|
|
||
|
* $checkup_parameter_array[$k]=$row_checkup_parameter;
|
||
|
|
||
|
*
|
||
|
|
||
|
* $k++;
|
||
|
|
||
|
*
|
||
|
|
||
|
* }
|
||
|
|
||
|
*/
|
||
|
|
||
|
|
||
|
|
||
|
?>
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
<div class="main-content">
|
||
|
|
||
|
|
||
|
|
||
|
<div class="main-content-inner">
|
||
|
|
||
|
<div class="panel-group" id="accordion" role="tablist" aria-multiselectable="true">
|
||
|
|
||
|
|
||
|
|
||
|
<div class="panel panel-default">
|
||
|
|
||
|
<div class="panel-heading">
|
||
|
|
||
|
|
||
|
|
||
|
<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;">
|
||
|
|
||
|
|
||
|
|
||
|
Questionnaire Section Header</h5>
|
||
|
|
||
|
|
||
|
|
||
|
</div>
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
<div class="panel-body">
|
||
|
|
||
|
|
||
|
|
||
|
<div class="row">
|
||
|
|
||
|
<input type="hidden" name="checkup_header_val" id="checkup_header_val">
|
||
|
|
||
|
<div class="col-sm-12">
|
||
|
|
||
|
<div style="margin-left: 10px;">
|
||
|
|
||
|
<table class="table table-bordered">
|
||
|
|
||
|
<tr>
|
||
|
|
||
|
<th colspan="4">Please Tick For Showing Questionnaire Section</th>
|
||
|
|
||
|
</tr>
|
||
|
|
||
|
<tr>
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
<?php
|
||
|
|
||
|
$questionnaire_desc = array();
|
||
|
|
||
|
$sql_section = "select * from checkup_form_section order by section_id asc";
|
||
|
|
||
|
// echo $sql_section;
|
||
|
|
||
|
$count = 1;
|
||
|
|
||
|
$i = 0;
|
||
|
|
||
|
$section_id_array = array();
|
||
|
|
||
|
$section_desc = array();
|
||
|
|
||
|
$result_section = mysqli_query($conn, $sql_section);
|
||
|
|
||
|
while ($row_section = mysqli_fetch_assoc($result_section)) {
|
||
|
|
||
|
|
||
|
|
||
|
$section_id_array[$i] = $row_section['section_id'];
|
||
|
|
||
|
$section_desc[$i] = $row_section['section_desc'];
|
||
|
|
||
|
$questionnaire_desc[$count] = $row_section['section_desc'];
|
||
|
|
||
|
|
||
|
|
||
|
if ($count == 4) {
|
||
|
|
||
|
?>
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
<tr><?php
|
||
|
|
||
|
}
|
||
|
|
||
|
$i++;
|
||
|
|
||
|
?>
|
||
|
|
||
|
|
||
|
|
||
|
<td><input class="chk" type="checkbox" id="<?php echo $row_section['section_desc']; ?>" onclick="showHeaderSection('<?php echo $row_section['section_desc']; ?>')" value="<?php echo $row_section['section_id'] ?>">
|
||
|
|
||
|
<?php
|
||
|
|
||
|
|
||
|
|
||
|
echo $row_section['section_name'];
|
||
|
|
||
|
?>
|
||
|
|
||
|
</td>
|
||
|
|
||
|
<?php
|
||
|
|
||
|
|
||
|
|
||
|
if ($count % 3 == 0) {
|
||
|
|
||
|
?>
|
||
|
</tr><?php
|
||
|
|
||
|
}
|
||
|
|
||
|
|
||
|
|
||
|
$count++;
|
||
|
}
|
||
|
|
||
|
?>
|
||
|
|
||
|
</table>
|
||
|
|
||
|
</div>
|
||
|
|
||
|
</div>
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
</div>
|
||
|
|
||
|
</div>
|
||
|
|
||
|
</div>
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
<?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 section_id,section_name,section_desc from checkup_parameter a inner join checkup_form_section b on a.checkup_form_section_id=b.section_id group by checkup_form_section_id";
|
||
|
|
||
|
// echo $sql_checkup_parameter_section;
|
||
|
|
||
|
// $sql_checkup_parameter_section= "";
|
||
|
|
||
|
|
||
|
|
||
|
?>
|
||
|
|
||
|
|
||
|
|
||
|
<?php
|
||
|
|
||
|
// echo $sql_checkup_parameter_section;
|
||
|
|
||
|
$i1 = 0;
|
||
|
|
||
|
$count = 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 class="row">
|
||
|
|
||
|
<?php
|
||
|
|
||
|
|
||
|
|
||
|
$section_name = $row_checkup_parameter_section['section_name'];
|
||
|
|
||
|
$sql_questionnaire_sections = "select * from checkup_form_section where section_name ='$section_name' ";
|
||
|
|
||
|
// echo $sql_questionnaire_sections;
|
||
|
error_log("checksectionname " . $sql_questionnaire_sections);
|
||
|
$result_questionnaire_sections = @mysqli_query($conn, $sql_questionnaire_sections);
|
||
|
|
||
|
$countSection = 0;
|
||
|
|
||
|
|
||
|
|
||
|
while ($row_questionnaire_sections = @mysqli_fetch_array($result_questionnaire_sections)) {
|
||
|
|
||
|
$section_id = $row_questionnaire_sections['section_id'];
|
||
|
|
||
|
|
||
|
|
||
|
$sql_questionnaire = "select * from questionnaire where question_section_id='$section_id'";
|
||
|
error_log("checksectionid " . $sql_questionnaire);
|
||
|
// echo $sql_questionnaire;
|
||
|
|
||
|
$result_questionnaire = @mysqli_query($conn, $sql_questionnaire);
|
||
|
|
||
|
$no_of__question_rows = mysqli_num_rows($result_questionnaire);
|
||
|
|
||
|
$srNo = 0;
|
||
|
|
||
|
if ($no_of__question_rows != 0) {
|
||
|
|
||
|
?>
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
<div class=" col-sm-12">
|
||
|
|
||
|
|
||
|
|
||
|
<?php
|
||
|
|
||
|
|
||
|
|
||
|
$sql_all_questionnaire = "select * from questionnaire ";
|
||
|
|
||
|
$result_all_questionnaire = @mysqli_query($conn, $sql_all_questionnaire);
|
||
|
|
||
|
$no_of_all_question_rows = mysqli_num_rows($result_all_questionnaire);
|
||
|
|
||
|
|
||
|
|
||
|
?>
|
||
|
|
||
|
<table class="table table-condensed table-bordered" width="100%" border=1 id="familyMembersTable" class="table-hover">
|
||
|
|
||
|
|
||
|
|
||
|
<tbody>
|
||
|
|
||
|
<tr bgcolor="#d3d3d3">
|
||
|
|
||
|
<th width="5%">Sr</th>
|
||
|
|
||
|
<th width="55%">Question</th>
|
||
|
|
||
|
<th width="40%">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'];
|
||
|
|
||
|
$queryChildQuestions = "select * from questionnaire where parentId = '$ques_id'";
|
||
|
|
||
|
// echo $queryChildQuestions;
|
||
|
|
||
|
$resultChildQuestion = @mysqli_query($conn, $queryChildQuestions);
|
||
|
|
||
|
$num_child_questions = @mysqli_num_rows($resultChildQuestion);
|
||
|
|
||
|
// echo $num_child_questions;
|
||
|
|
||
|
$questionName = "";
|
||
|
|
||
|
$parentId = $row_questionnaire['parentId'];
|
||
|
|
||
|
if ($parentId != 0) {
|
||
|
|
||
|
continue;
|
||
|
}
|
||
|
|
||
|
$questionName = $row_questionnaire['question_name'];
|
||
|
|
||
|
|
||
|
$sql_ans = "select * from questionnaire_ans where que_id=$ques_id and emp_id=" . $_REQUEST['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 $questionName; ?> <input name="que_id<?= $count; ?>" value="<?= $row_questionnaire['question_id'] ?>" type="hidden">
|
||
|
|
||
|
</td>
|
||
|
|
||
|
<td align="center"> <?php if ($row_questionnaire['question_type'] == "Input") { ?><textarea name="ans<?= $count; ?>"><?= $row_ans['answer'] ?></textarea><?php
|
||
|
|
||
|
} else {
|
||
|
|
||
|
if ($num_child_questions != 0) {
|
||
|
|
||
|
|
||
|
|
||
|
while ($row_child_questions = @mysqli_fetch_array($resultChildQuestion)) {
|
||
|
|
||
|
$childQuestionId = $row_child_questions['question_id'];
|
||
|
|
||
|
|
||
|
|
||
|
$childQuestionAnsQuery = "select * from questionnaire_ans where que_id=$childQuestionId and emp_id=$emp_id ";
|
||
|
|
||
|
// echo $sql_ans;
|
||
|
|
||
|
$result_child_ans = @mysqli_query($conn, $childQuestionAnsQuery);
|
||
|
|
||
|
$row_child_ans = @mysqli_fetch_array($result_child_ans);
|
||
|
|
||
|
?>
|
||
|
|
||
|
|
||
|
|
||
|
<?php
|
||
|
|
||
|
|
||
|
|
||
|
echo $row_child_questions['question_name'];
|
||
|
|
||
|
|
||
|
|
||
|
?>
|
||
|
|
||
|
<input type="hidden" value="<?= $childQuestionId ?>" name="<?= $childQuestionId; ?>que_id<?= $count ?>"> <input id="ans<?= $count; ?>" type="checkbox" name="<?= $childQuestionId; ?>ans<?= $count; ?>" <?php if ($row_child_ans['answer'] != "" or $row_child_ans['answer'] != null) { ?> checked <?php } ?> value="Yes"> <br>
|
||
|
|
||
|
<?php }
|
||
|
} else { ?><input id="ans<?= $count; ?>" type="checkbox" name="ans<?= $count; ?>" <?php if ($row_ans['answer'] != "" or $row_ans['answer'] != null) { ?> checked <?php } ?> onclick="getInputFields(this.id,<?= $count ?>)" value="Yes">
|
||
|
|
||
|
<?php }
|
||
|
} ?><div id="detailed_ans<?= $count; ?>" <?php if ($row_ans['answer'] == "" or $row_ans['answer'] == null) { ?> style="display: none" <?php } ?>>
|
||
|
|
||
|
<div class="form-group" style="display: flex;
|
||
|
justify-content: center;" class="row"> <?php
|
||
|
|
||
|
$ansArray = explode(",", $row_ans['answer']);
|
||
|
|
||
|
// print_r($ansArray);
|
||
|
|
||
|
$requiredDetails = $row_questionnaire['requiredDetailsIds'];
|
||
|
|
||
|
// echo $requiredDetails;
|
||
|
|
||
|
$requiredDetailsArr = explode(",", $requiredDetails);
|
||
|
$loopCount = 1;
|
||
|
foreach ($ansArray as $ansValue) {
|
||
|
|
||
|
if ($ansValue != null or $ansValue != "") {
|
||
|
|
||
|
$requiredDetailsArrval = getTableFieldValue('question_sub_details', 'sub_detail_name', 'sub_detail_id', $requiredDetailsIdsArrval);
|
||
|
|
||
|
$ansArraysplit = explode(":", $ansArray[$loopCount]);
|
||
|
|
||
|
// print_r($ansArraysplit);
|
||
|
|
||
|
?>
|
||
|
<div class="col-sm-6" align="center">
|
||
|
|
||
|
<label for="requiredDetails"><?= $requiredDetailsArrval ?></label>
|
||
|
|
||
|
<textarea class="form-control" align="center" id="<?= $requiredDetailsArrval . $count; ?>" name="<?= $requiredDetailsArrval . $count; ?>"> <?= $ansValue ?></textarea>
|
||
|
|
||
|
</div>
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
<?php }
|
||
|
$loopCount++;
|
||
|
} ?>
|
||
|
|
||
|
</div>
|
||
|
|
||
|
</div>
|
||
|
</td>
|
||
|
|
||
|
</tr>
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
<?php
|
||
|
|
||
|
|
||
|
|
||
|
++$count;
|
||
|
|
||
|
++$srNo;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
?>
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
</tbody>
|
||
|
|
||
|
</table>
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
</div>
|
||
|
|
||
|
<?php }
|
||
|
$countSection++;
|
||
|
} ?>
|
||
|
|
||
|
</div>
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
</div>
|
||
|
|
||
|
|
||
|
|
||
|
</div>
|
||
|
|
||
|
|
||
|
|
||
|
</div>
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
<?php
|
||
|
|
||
|
|
||
|
|
||
|
$i1++;
|
||
|
}
|
||
|
|
||
|
?>
|
||
|
|
||
|
</div>
|
||
|
|
||
|
|
||
|
|
||
|
<script>
|
||
|
function showHeaderSection(section_id) {
|
||
|
if ($("#" + section_id).prop('checked')) {
|
||
|
$("#pannel_" + section_id).show();
|
||
|
} else {
|
||
|
$("#pannel_" + section_id).hide();
|
||
|
}
|
||
|
console.log(section_id);
|
||
|
//alert(section_id);
|
||
|
}
|
||
|
<?php $_SESSION['logged_user_emp_id'] = getFieldFromTable('patient_id', 'tbl_users', 'user_id', $_SESSION['user_id']);
|
||
|
$emp_id = $_SESSION['logged_user_emp_id'];
|
||
|
?>
|
||
|
var emp_id = <?php if ($_SESSION['RoleId'] == 7) {
|
||
|
echo $_SESSION['logged_user_empid'];
|
||
|
} else {
|
||
|
echo $_REQUEST['emp_id'];
|
||
|
} ?>;
|
||
|
var section_id_array = <?php echo json_encode($section_id_array) ?>;
|
||
|
var section_desc = <?php echo json_encode($section_desc) ?>;
|
||
|
select_questionnaire();
|
||
|
|
||
|
function select_questionnaire() {
|
||
|
$.ajax({
|
||
|
url: 'select_quetionnaire_include.php',
|
||
|
type: "POST",
|
||
|
data: {
|
||
|
emp_id: emp_id
|
||
|
},
|
||
|
dataType: 'json',
|
||
|
success: function(data) {
|
||
|
console.log(data);
|
||
|
for (var j = 0; j < data.length; j++) {
|
||
|
for (var i = 0; i < section_id_array.length; i++) {
|
||
|
if (section_id_array[i] == data[j].section_id) {
|
||
|
$("#" + section_desc[i]).prop("checked", true);
|
||
|
$("#pannel_" + section_desc[i]).show();
|
||
|
break;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
},
|
||
|
|
||
|
error: function(data) {
|
||
|
|
||
|
|
||
|
|
||
|
return;
|
||
|
|
||
|
}
|
||
|
|
||
|
});
|
||
|
|
||
|
$('.close').click();
|
||
|
|
||
|
}
|
||
|
|
||
|
function getInputFields(fieldId, count) {
|
||
|
var isChecked = $("#" + fieldId).val();
|
||
|
|
||
|
if ($("#" + fieldId).prop("checked") == true) {
|
||
|
$("#detailed_ans" + count).show();
|
||
|
|
||
|
} else {
|
||
|
$("#detailed_ans" + count).hide();
|
||
|
}
|
||
|
}
|
||
|
</script>
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
</div>
|
||
|
|
||
|
</div>
|
||
|
|
||
|
<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: 17px;
|
||
|
|
||
|
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);
|
||
|
|
||
|
}
|
||
|
</style>
|