ohctech_p8/emp_dashboard_embed.php
Dushant Mali f1e0459afa Dushant
2024-11-19 09:59:09 +05:30

4227 lines
151 KiB
PHP

<!-- <script src="//code.jquery.com/jquery-1.12.0.min.js"></script> -->
<script src="js/Chart.min.js"></script>
<?php
include('includes/config/config.php');
include('form/add_chronic_illnes.php');
include('form/add_drug_allergy.php');
include('form/add_habit_data.php');
// error_reporting(0);
$id = ($_REQUEST['flex_opd_id'] != '') ? ($_REQUEST['flex_opd_id']) : ($_REQUEST['patient_id']);
if (!isset($id)) {
$id = ($_REQUEST['flex_patient_id'] != '') ? ($_REQUEST['flex_patient_id']) : ($_REQUEST['patient_id']);
}
$sql = "select * from patient_master where id = '$id' ";
$result = mysqli_query($conn, $sql);
if (mysqli_num_rows($result) > 0) {
$row = mysqli_fetch_array($result);
}
$sql2 = "select * from health_advice";
$result2 = mysqli_query($conn, $sql2);
if (mysqli_num_rows($result2) > 0) {
$row2 = mysqli_fetch_array($result2);
}
$sql3 = "select * from health_risk";
$result3 = mysqli_query($conn, $sql3);
if (mysqli_num_rows($result3) > 0) {
$row3 = mysqli_fetch_array($result3);
}
// $sql4 = "select * from training"; // training table not present ==> training_master
// $result4 = mysqli_query($conn, $sql4);
// if (mysqli_num_rows($result4) > 0) {
// $row4 = mysqli_fetch_array($result4);
// }
$query5 = "SELECT height, date(appointment_date) as dat FROM employee_appointment
where emp_id='$id'and height != ''
UNION
SELECT cf.checkup_form_value as weight ,date(c.checkup_date) as dat from
checkup_form c left join checkup_form_key_value cf on
c.checkup_id=cf.checkup_form_id left join checkup_parameter cp on
cp.`column_name` = cf.checkup_form_key
where c.emp_id='$id' and cp.key_health_map_name=(select key_param_id from key_health_reportable_parameter_master where key_param_name='height') order by dat desc limit 1";
error_log("height " . $query5);
$result5 = mysqli_query($conn, $query5);
$row5 = mysqli_fetch_array($result5);
$query6 = "SELECT `weight`, date(appointment_date) as dat FROM employee_appointment
where emp_id='$id' and `weight` != ''
UNION
SELECT cf.checkup_form_value as weight ,date(c.checkup_date) as dat from
checkup_form c left join checkup_form_key_value cf on
c.checkup_id=cf.checkup_form_id left join checkup_parameter cp on
cp.`column_name` = cf.checkup_form_key
where c.emp_id='$id' and cp.key_health_map_name=(select key_param_id from key_health_reportable_parameter_master where key_param_name='weight') order by dat desc limit 1";
error_log("weight " . $query6);
$result6 = @mysqli_query($conn, $query6);
$row6 = mysqli_fetch_array($result6);
$query7 = "SELECT heart_rate as pulse, date(appointment_date) as dat FROM employee_appointment
where emp_id='$id' and heart_rate != ''
UNION
SELECT cf.checkup_form_value as weight ,date(c.checkup_date) as dat from
checkup_form c left join checkup_form_key_value cf on
c.checkup_id=cf.checkup_form_id left join checkup_parameter cp on
cp.`column_name` = cf.checkup_form_key
where c.emp_id='$id' and cp.key_health_map_name=(select key_param_id from key_health_reportable_parameter_master where key_param_name='pulse') order by dat desc limit 1";
error_log("pulse " . $query7);
$result7 = @mysqli_query($conn, $query7);
$row7 = mysqli_fetch_array($result7);
$query8 = "SELECT bmi, date(appointment_date) as dat FROM employee_appointment
where emp_id='$id' and bmi != ''
UNION
SELECT cf.checkup_form_value as weight ,date(c.checkup_date) as dat from
checkup_form c left join checkup_form_key_value cf on
c.checkup_id=cf.checkup_form_id left join checkup_parameter cp on
cp.`column_name` = cf.checkup_form_key
where c.emp_id='$id' and cp.key_health_map_name=(select key_param_id from key_health_reportable_parameter_master where key_param_name='bmi') order by dat desc limit 1";
error_log("bmi " . $query8);
$result8 = @mysqli_query($conn, $query8);
$row8 = mysqli_fetch_array($result8);
$query9 = "SELECT bp_sbp as sbp, date(appointment_date) as dat FROM employee_appointment
where emp_id='$id'and bp_sbp != ''
UNION
SELECT cf.checkup_form_value as sbp ,date(c.checkup_date) as dat from
checkup_form c left join checkup_form_key_value cf on
c.checkup_id=cf.checkup_form_id left join checkup_parameter cp on
cp.`column_name` = cf.checkup_form_key
where c.emp_id='$id' and (cp.key_health_map_name=(select key_param_id from key_health_reportable_parameter_master where key_param_name='sbp') or
cp.key_health_map_name=(select key_param_id from key_health_reportable_parameter_master where key_param_name='sbp/dbp')) order by dat desc limit 1";
error_log("systolic_blood_pressure " . $query9);
$result9 = @mysqli_query($conn, $query9);
$row9 = mysqli_fetch_array($result9);
$query11 = "SELECT bp_dbp as dbp, date(appointment_date) as dat FROM employee_appointment
where emp_id='$id'and bp_sbp != ''
UNION
SELECT cf.checkup_form_value as dbp ,date(c.checkup_date) as dat from
checkup_form c left join checkup_form_key_value cf on
c.checkup_id=cf.checkup_form_id left join checkup_parameter cp on
cp.`column_name` = cf.checkup_form_key
where c.emp_id='$id' and (cp.key_health_map_name=(select key_param_id from key_health_reportable_parameter_master where key_param_name='dbp') or
cp.key_health_map_name=(select key_param_id from key_health_reportable_parameter_master where key_param_name='sbp/dbp')) order by dat desc limit 1";
error_log("systolic_blood_pressure " . $query11);
$result11 = @mysqli_query($conn, $query11);
$row11 = mysqli_fetch_array($result11);
$sbp = "";
$dbp = "";
$bp_arr = explode("/", $row9['sbp']);
error_log("size " . count($bp_arr));
if (count($bp_arr) > 1) {
$sbp = $bp_arr[0];
} else {
$sbp = $bp_arr[0];
}
$bp_arr = explode("/", $row11['dbp']);
error_log("size " . count($bp_arr));
if (count($bp_arr) > 1) {
$dbp = $bp_arr[1];
} else {
$dbp = $bp_arr[0];
}
$bp = $sbp . "/" . $dbp;
$query10 = "SELECT health_index from checkup_form where emp_id='$id' and (health_index!='' or health_index!=null) order by checkup_date desc limit 1";
error_log("health index query " . $query10);
$result10 = @mysqli_query($conn, $query10);
$row10 = mysqli_fetch_array($result10);
$query12 = "SELECT blood_sugar_fbs as fbs, date(appointment_date) as dat FROM employee_appointment
where emp_id='$id' and blood_sugar_fbs != ''
UNION
SELECT cf.checkup_form_value as weight ,date(c.checkup_date) as dat from
checkup_form c left join checkup_form_key_value cf on
c.checkup_id=cf.checkup_form_id left join checkup_parameter cp on
cp.`column_name` = cf.checkup_form_key
where c.emp_id='$id' and cp.key_health_map_name=(select key_param_id from key_health_reportable_parameter_master where key_param_name='fbs') order by dat desc limit 1";
error_log("fbs " . $query12);
$result12 = @mysqli_query($conn, $query12);
$row12 = mysqli_fetch_array($result12);
$query13 = "SELECT blood_sugar_rbs as rbs, date(appointment_date) as dat FROM employee_appointment
where emp_id='$id' and blood_sugar_rbs != ''
UNION
SELECT cf.checkup_form_value as weight ,date(c.checkup_date) as dat from
checkup_form c left join checkup_form_key_value cf on
c.checkup_id=cf.checkup_form_id left join checkup_parameter cp on
cp.`column_name` = cf.checkup_form_key
where c.emp_id='$id' and cp.key_health_map_name=(select key_param_id from key_health_reportable_parameter_master where key_param_name='rbs') order by dat desc limit 1";
error_log("fbs " . $query13);
$result13 = @mysqli_query($conn, $query13);
$row13 = mysqli_fetch_array($result13);
$query14 = "SELECT blood_sugar_ppbs as ppbs, date(appointment_date) as dat FROM employee_appointment
where emp_id='$id' and blood_sugar_ppbs != ''
UNION
SELECT cf.checkup_form_value as weight ,date(c.checkup_date) as dat from
checkup_form c left join checkup_form_key_value cf on
c.checkup_id=cf.checkup_form_id left join checkup_parameter cp on
cp.`column_name` = cf.checkup_form_key
where c.emp_id='$id' and cp.key_health_map_name=(select key_param_id from key_health_reportable_parameter_master where key_param_name='ppbs') order by dat desc limit 1";
error_log("fbs " . $query14);
$result14 = @mysqli_query($conn, $query14);
$row14 = mysqli_fetch_array($result14);
function calcBMI($weight, $height)
{
$bmi = ($weight / ($height * $height)) * 10000;
return round($bmi, 1) . PHP_EOL;
}
function ppa($past_illness)
{
$params = '';
$param_present = explode(', ', $past_illness);
foreach ($param_present as $x => $val) {
$params .= getFieldFromTable('param_name', 'history_parameter', 'param_id', $val) . "<br>";
}
return $params;
}
function healthAdvices($past_advices)
{
$params = '';
$param_present = explode(', ', $past_advices);
foreach ($param_present as $x => $val) {
$params .= getFieldFromTable('health_advice_name', 'health_advice', 'health_advice_id', $val) . "<br>";
}
return $params;
}
?>
<style>
.box {
position: relative;
border-radius: 3px;
background: #ffffff;
border-top: 3px solid #d2d6de;
margin-bottom: 20px;
width: 100%;
box-shadow: 0 1px 1px rgba(0, 0, 0, 0.1);
}
.box.box-info {
border-top-color: #00c0ef;
}
.box.box-danger {
border-top-color: #dd4b39;
}
.box.modal-greytop {
border-top-color: #d2d6de;
}
.box.box-success {
border-top-color: #00a65a;
}
.box.box-warning {
border-top-color: #f39c12;
}
.box.box-primary {
border-top-color: #3c8dbc;
}
.card {
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2);
transition: 0.3s;
/* width: 40%; */
border-radius: 5px;
margin-top: 10px;
border-radius: 5px 5px 5px 5px !important;
background-color: #EDF5E1;
/* font-family: 'Roboto Serif', serif; */
}
.card:hover {
box-shadow: 0 13px 16px 0 rgba(0, 0, 0, 0.5);
}
.card2 {
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2);
transition: 0.3s;
/* width: 40%; */
border-radius: 5px;
margin-top: 10px;
border-radius: 5px 5px 5px 5px !important;
font-family: 'Roboto Serif', serif;
}
.card2:hover {
box-shadow: 0 50px 70px 0 rgba(0, 0, 0, 0.5);
}
.center {
text-align: center;
}
</style>
<div class="row" style="background-color:#5CDB95;">
<div class="col-xs-12">
<div class="col-xs-12 col-sm-3 center">
<div>
<!-- Profile Photo and name starts here -->
<span class="profile-picture card">
<!-- Profile Photo starts here -->
<?php
if (isset($row['photo']) && $row['photo'] != null) {
?>
<img id="avatar" class="editable img-responsive" alt="<?php echo $row['patient_name'] ?>" src="data:<?php echo $row['image_type'] ?>;base64,<?php echo base64_encode($row['photo']) ?>" style="display: block; width: 150px; height: 150px;" />
<?php
} else {
if ($row['gender'] != 'F') {
?>
<img id="avatar" class="editable img-responsive" alt="<?php echo $row['fname'] ?>'s Avatar" src="images/male-profile.png" style="display: block; width: 150px; height: 150px;" />
<?php
} else {
?>
<img id="avatar" class="editable img-responsive" alt="<?php echo $row['fname'] ?>'s Avatar" src="images/female-profile.png" style="display: block; width: 150px; height: 150px;" />
<?php
}
}
?>
</span> <!-- Profile Photo ends here -->
<br>
<div class="label label-warnining label-xlg">
<!-- Profile name starts here -->
<div class="inline position-relative">
<a href="#" class="user-title-label dropdown-toggle" data-toggle="dropdown">
<i class="glyphicon glyphicon-tint red"></i>
<span class="red"><?php echo $row['blood_group'] ?></span>&nbsp;
<span class="white"><?php echo $row['patient_name'] ?></span>
</a>
</div>
</div> <!-- Profile name ends here -->
</div> <!-- Profile Photo and name ends here -->
</div>
<div class="col-xs-12 col-sm-9 center">
<div class="row">
<p class="alert" style="border-radius: 2%;background-color:#379683; color:#fff">Employee Health
Dashboard</p>
</div>
<div class="space space-4"></div>
<div class="row">
<div class="center">
<!-- <span class="btn btn-app btn-sm btn-pink no-hover"> <span
class="line-height-1 smaller-100">24.1 </span> <br /> <span
class="line-height-1 smaller-60"> Trend </span>
</span> -->
<span class="btn btn-app btn-sm btn-purple no-hover" style="width:80px;">
<span class="line-height-1 smaller-100 card2"><?php echo $row5['height'] ?></span><br />
<span class="line-height-1 smaller-60"> Height </span>
</span>
<span class="btn btn-app btn-sm btn-light no-hover" style="width:80px;">
<span class="line-height-1 smaller-100 card2"><?php echo $row6['weight'] ?></span><br />
<span class="line-height-1 smaller-60"> Weight </span>
</span>
<span class="btn btn-app btn-sm btn-grey no-hover" style="width:80px;">
<span class="line-height-1 smaller-100 card2"><?php echo $row8['bmi'] ?></span><br />
<span class="line-height-1 smaller-60"> BMI </span>
</span>
<span class="btn btn-app btn-sm btn-inverse no-hover" style="width:80px;">
<span class="line-height-1 smaller-100 card2"><?php echo $bp ?></span><br />
<span class="line-height-1 smaller-60">BP</span>
</span>
<span class="btn btn-app btn-sm btn-success no-hover" style="width:80px;"> <span class="line-height-1 smaller-100 card2"><?php echo $row7['pulse'] ?></span> <br /> <span class="line-height-1 smaller-60">Pulse</span>
</span>
<span class="btn btn-app btn-sm btn-primary no-hover" style="width:80px;"> <span class="line-height-1 smaller-100 card2"><?php echo $row10['health_index'] ?></span> <br />
<span class="line-height-1 smaller-60">Health Index</span>
</span>
<span class="btn btn-app btn-sm btn-success no-hover" style="width:80px;"> <span class="line-height-1 smaller-100 card2"><?php echo $row12['fbs'] ?></span> <br /> <span class="line-height-1 smaller-60">FBS</span>
</span>
<span class="btn btn-app btn-sm btn-secondary no-hover" style="width:80px;"> <span class="line-height-1 smaller-100 card2"><?php echo $row13['rbs'] ?></span> <br /> <span class="line-height-1 smaller-60">RBS</span>
</span>
<span class="btn btn-app btn-sm btn-warning no-hover" style="width:80px;"> <span class="line-height-1 smaller-100 card2"><?php echo $row14['ppbs'] ?></span> <br /> <span class="line-height-1 smaller-60">PPBS</span>
</span>
</div>
</div>
</div>
</div>
</div>
<div class="row" style="background-color:#8EE4AF;">
<div class="col-xs-12" style="margin-top: 10px">
<div class="col-xs-12 col-sm-6 center">
<!-- col-md-5 -->
<p class="alert center" style="border-radius: 2%;background-color:#379683; color:#fff"><i class="ace-icon fa fa-star orange card"></i> &nbsp;PATIENT BASIC INFO</p>
<div class="space space-4"></div>
<div class="profile-user-info profile-user-info-striped card">
<?php if (!empty($row['emp_code'])) {
?>
<div class="profile-info-row">
<div class="profile-info-name">Code</div>
<div class="profile-info-value">
<span><?php echo $row['emp_code'] ?></span>
</div>
</div>
<?php } ?>
<?php if (!empty($row['employment_type_id'])) {
?>
<div class="profile-info-row">
<div class="profile-info-name">Employment Type</div>
<div class="profile-info-value">
<span><?php echo ($row['employment_type_id']) == 1 ? "Permanent Employee" : "Contract" ?></span>
</div>
</div>
<?php } ?>
<?php if (!empty(getTableFieldValue('employer_contractor', 'employer_contractor_name', 'id', "'" . $row['employer_contractor_id'] . "'"))) {
?>
<div class="profile-info-row">
<div class="profile-info-name">Employer/Contractor</div>
<div class="profile-info-value">
<span><?php echo getTableFieldValue('employer_contractor', 'employer_contractor_name', 'id', "'" . $row['employer_contractor_id'] . "'") ?></span>
</div>
</div>
<?php } ?>
<?php if (!empty(getTableFieldValue('designation', 'designation_name', 'designation_id', "'" . $row['designation_id'] . "'"))) {
?>
<div class="profile-info-row">
<div class="profile-info-name">Designation</div>
<div class="profile-info-value">
<span><?php echo getTableFieldValue('designation', 'designation_name', 'designation_id', "'" . $row['designation_id'] . "'") ?></span>
</div>
</div>
<?php } ?>
<?php if (!empty(getTableFieldValue('department', 'dept_name', 'dept_id', "'" . $row['dept_id'] . "'"))) {
?>
<div class="profile-info-row">
<div class="profile-info-name">Department</div>
<div class="profile-info-value">
<span><?php echo getTableFieldValue('department', 'dept_name', 'dept_id', "'" . $row['dept_id'] . "'") ?></span>
</div>
</div>
<?php } ?>
<?php if (!empty(getTableFieldValue('employee', 'patient_name', 'id', $row['mgr_emp_id']))) {
?>
<div class="profile-info-row">
<div class="profile-info-name">Manager Name</div>
<div class="profile-info-value">
<span><?php echo getTableFieldValue('employee', 'patient_name', 'id', $row['mgr_emp_id']) ?></span>
</div>
</div>
<?php } ?>
<?php if (!empty($row['father_name'])) {
?>
<div class="profile-info-row">
<div class="profile-info-name">Father Name</div>
<div class="profile-info-value">
<span><?php echo $row['father_name'] ?></span>
</div>
</div>
<?php } ?>
<?php if (!empty($row['aadhar_no'])) {
?>
<div class="profile-info-row">
<div class="profile-info-name">Aadhar Number</div>
<div class="profile-info-value">
<span><?php echo $row['aadhar_no'] ?></span>
</div>
</div>
<?php } ?>
<?php if ($row['doj'] != '0000-00-00' && !empty($row['doj'])) {
?>
<div class="profile-info-row">
<div class="profile-info-name">Date of Joining</div>
<div class="profile-info-value">
<span><?php echo date_format(date_create($row['doj']), "d-M-Y ") ?></span>
</div>
</div>
<?php } ?>
<?php if (!empty(date_format(date_create($row['dob']), "d-M-Y "))) {
?>
<div class="profile-info-row">
<div class="profile-info-name">Date of Birth</div>
<div class="profile-info-value">
<span><?php echo date_format(date_create($row['dob']), "d-M-Y ") ?></span>
</div>
</div>
<?php } ?>
<?php if (!empty($row['dob'])) {
?>
<div class="profile-info-row">
<div class="profile-info-name">Age</div>
<div class="profile-info-value">
<span><?php echo isset($row['dob']) ? date_diff(date_create($row['dob']), date_create('today'))->y : "Not Available"; ?></span>
</div>
</div>
<?php } ?>
<?php if (!empty($row['primary_phone'])) {
?>
<div class="profile-info-row">
<div class="profile-info-name">Primary Phone</div>
<div class="profile-info-value">
<span><?php echo $row['primary_phone'] ?></span>
</div>
</div>
<?php } ?>
<?php if (!empty($row['email_id'])) {
?>
<div class="profile-info-row">
<div class="profile-info-name">Email</div>
<div class="profile-info-value">
<span>
<?php echo $row['email_id'] ?>
</span>
</div>
</div>
<?php } ?>
<?php if (!empty($row['village'] && $row['tehsil'] && $row['district'] && $row['state'])) {
?>
<div class="profile-info-row">
<div class="profile-info-name">Address</div>
<div class="profile-info-value">
<span><?php echo $row['village'] . " " . $row['tehsil'] . " " . $row['district'] . " " . $row['state'] ?></span>
</div>
</div>
<?php } ?>
<?php if (!empty(getFieldFromTable('ohc_type_name', 'ohc_type', 'ohc_type_id', $row['ohc_type_id']))) {
?>
<div class="profile-info-row">
<div class="profile-info-name">OHC Type</div>
<?php $ohc_name = getFieldFromTable('ohc_type_name', 'ohc_type', 'ohc_type_id', $row['ohc_type_id']); ?>
<div class="profile-info-value">
<span><?php echo $ohc_name ?></span>
</div>
</div>
<?php } ?>
</div>
</div>
<div class="col-xs-12 col-sm-6 center">
<p class="alert center" style="border-radius: 2%;background-color:#379683; color:#fff"><i class="ace-icon fa fa-star orange card"></i> &nbsp;PATIENT LATEST VISIT DATA</p>
<div class="space space-4"></div>
<div id="accordion" class="accordion-style1 panel-group card">
<div class="panel panel-default" style="text-align: left">
<div class="panel-heading">
<h4 class="panel-title">
<a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion" href="#collapseZero">
<i class="ace-icon fa fa-angle-down bigger-110" data-icon-hide="ace-icon fa fa-angle-down" data-icon-show="ace-icon fa fa-angle-right"></i>&nbsp;Dependent List
</a>
</h4>
</div>
<!-- Patient Detail Panel Starts here -->
<!-- OPD START -->
<div class="panel-collapse collapse " id="collapseZero">
<div class="panel-body">
<div class="profile-user-info profile-user-info-striped" style="margin: 0px; padding: 0px; width: 100%">
<?php
$sql_opd = "select * from patient_master where primary_patient_id='" . $id . "'";
error_log("sql opd: 407: " . $sql_opd);
if (!$result_opd = @mysqli_query($conn, $sql_opd)) {
die(error_log(mysqli_error($conn)));
}
if (mysqli_num_rows($result_opd) > 0) {
while ($row_opd = mysqli_fetch_array($result_opd)) {
$name = $row_opd['patient_name'];
$depd_id = $row_opd['id'];
error_log("dependent id" . $depd_id);
?>
<div class="profile-info-row">
<div class="profile-info-name">Name</div>
<div class="profile-info-value">
<a href="#" class="blue" title="Go To DashBoard" onclick="open_dashboard(<?= $depd_id ?>);"><i class="ace-icon fa fa-tachometer bigger-130\"></i><?= " " . $name ?></a>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<a href="#" title="add opd" class="green" onclick="add_opd(<?= $depd_id ?>,'opd');"><i class="ace-icon fa fa-edit bigger-130\"></i>Add OPD</a>
</div>
</div>
<?php
}
} else {
?>
<div class="profile-info-value">No Record found</div>
<?php } ?>
</div>
</div>
</div>
</div>
<div class="panel panel-default" style="text-align: left">
<div class="panel-heading">
<h4 class="panel-title">
<a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion" href="#collapseOne">
<i class="ace-icon fa fa-angle-down bigger-110" data-icon-hide="ace-icon fa fa-angle-down" data-icon-show="ace-icon fa fa-angle-right"></i>&nbsp;Previous OPD Visit
</a>
</h4>
</div>
<!-- Patient Detail Panel Starts here -->
<!-- OPD START -->
<div class="panel-collapse collapse in" id="collapseOne">
<div class="panel-body">
<div class="profile-user-info profile-user-info-striped" style="margin: 0px; padding: 0px; width: 100%">
<?php
$sql_opd = "select case_type,followup_remarks, patient_name,dept_id,emp_code ,e.id,appointment_id,ep.* ,ep.modified_by as mod_by from employee_appointment ep inner join patient_master e on e.id=ep.emp_id where ep.emp_id='" . $id . "' and appointment_type='O' order by ep.appointment_date desc limit 1";
error_log("sql opd: 407: " . $sql_opd);
if (!$result_opd = @mysqli_query($conn, $sql_opd)) {
die(error_log(mysqli_error($conn)));
}
if (mysqli_num_rows($result_opd) > 0) {
if ($row_opd = @mysqli_fetch_array($result_opd)) {
$aiment_ids = $row_opd['ailment_ids'];
error_log("explode" . $row_opd['ailment_ids']);
?>
<div class="profile-info-row">
<div class="profile-info-name">Ticket No:</div>
<div class="profile-info-value">
<?php echo $row_opd['ticket_no'] ?>&nbsp;&nbsp;&nbsp;
<?php if (isAccessible($_SESSION['RoleId'], $opd_menu_id, 'W')) { ?>
<a href="#" class="blue" onclick="open_employee_appointment_task(<?= $row_opd['appointment_id'] . ',`' . $row_opd['appointment_type'] . '`,' . $id . ',' . '`E`' . ',' . '``'; ?>);"><i class="ace-icon fa fa-edit" style="font-size: 15px;"></i></a>
<?php } ?>
</div>
<div class="profile-info-value">
<?php if (isAccessible($_SESSION['RoleId'], $opd_menu_id, 'W')) { ?>
<button type='button' class='btn btn-success btn-sm save_button' style='width:80%' onclick="opd_form(<?= $id ?>)">New OPD</button>
<?php } ?>
</div>
</div>
<div class="profile-info-row">
<div class="profile-info-name">Date & Time:</div>
<div class="profile-info-value">
<?php echo date_format(date_create($row_opd['appointment_date']), "d-M-Y H:i A") ?>
</div>
</div>
<div class="profile-info-row">
<div class="profile-info-name">complaints:</div>
<div class="profile-info-value">
<?php echo getCommaSeperatedValuesForInClause("select complaint from complaints ", "complaint_id", $row_opd['complaints']); ?>
</div>
</div>
<div class="profile-info-row">
<div class="profile-info-name">Diagnosis:</div>
<div class="profile-info-value">
<?php echo getCommaSeperatedValuesForInClause("select ailment_name from ailment ", "ailment_id", $row_opd['ailments_new']); ?>
</div>
</div>
<div class="profile-info-row">
<div class="profile-info-name">Treatment:</div>
<div class="profile-info-value">
<?php echo getTreatmentText($row_opd['appointment_id']) ?></div>
</div>
<div class="profile-info-row">
<div class="profile-info-name">Followups:</div>
<div class="profile-info-value">
<?php
$query_followup_opd = "select * from followup_details where appointment_id='" . $row_opd['appointment_id'] . "'";
error_log("Patient_Search_followup:" . $query_followup_opd);
if (!$result_followup_opd = @mysqli_query($conn, $query_followup_opd)) {
die(mysqli_error($conn));
}
if (mysqli_num_rows($result_followup_opd) > 0) {
while ($row_followup_opd = mysqli_fetch_assoc($result_followup_opd)) {
echo $row_followup_opd['ticket_no'];
if (isAccessible($_SESSION['RoleId'], $opd_menu_id, 'W')) {
?>
<a href="#" class="blue" onclick="open_employee_appointment_task(<?= $row_followup_opd['appointment_id'] . ',`' . $row_followup_opd['appointment_type'] . '`,' . $id . ',' . '`F`' . ',' . $row_followup_opd['followup_id'] ?>);"><i class="ace-icon fa fa-edit" style="font-size: 15px;"></i></a>
<?php }
}
} ?>
</div>
<div class="profile-info-value">
<?php if (isAccessible($_SESSION['RoleId'], $opd_menu_id, 'W')) { ?>
<button type='button' class='btn btn-info btn-sm save_button' onclick="open_employee_appointment_task(<?= $row_opd['appointment_id'] . ',`' . $row_opd['appointment_type'] . '`,' . $id . ',' . '`F`' . ',``' ?>);"><i class='ace-icon fa fa-plus'></i>Add Followup </button>
<?php } ?>
</div>
</div>
<?php
} else {
echo "No Results found";
}
} else {
?>
<div class="profile-info-value">No Record found</div>
<div class="profile-info-value">
<?php if (isAccessible($_SESSION['RoleId'], $opd_menu_id, 'W')) { ?>
<button type='button' class='btn btn-success btn-sm save_button' style='width:50%' onclick="opd_form(<?= $id ?>)">New OPD</button>
<?php } ?>
</div>
<?php } ?>
</div>
</div>
</div>
</div>
<!-- OPD ENDS -->
<!-- INJURY STARTS -->
<div class="panel panel-default">
<div class="panel-heading" style="text-align: left">
<h4 class="panel-title">
<a class="accordion-toggle collapsed" data-toggle="collapse" data-parent="#accordion" href="#collapseTwo">
<i class="ace-icon fa fa-angle-right bigger-110" data-icon-hide="ace-icon fa fa-angle-down" data-icon-show="ace-icon fa fa-angle-right"></i> &nbsp;Previous Injury </a>
</h4>
</div>
<div class="panel-collapse collapse" id="collapseTwo">
<div class="panel-body">
<div class="profile-user-info profile-user-info-striped" style="margin: 0px; padding: 0px; width: 100%">
<?php
$sql_injury = "select case_type,followup_remarks, patient_name,dept_id,emp_code ,e.id,appointment_id,ep.* ,ep.modified_by as mod_by from employee_appointment ep inner join patient_master e on e.id=ep.emp_id where ep.emp_id='" . $id . "' and appointment_type='I' order by ep.appointment_date desc limit 1";
error_log("sql injury: 407: " . $sql_injury);
if (!$result_injury = @mysqli_query($conn, $sql_injury)) {
die(error_log(mysqli_error($conn)));
}
if (mysqli_num_rows($result_injury) > 0) {
if ($row_injury = @mysqli_fetch_array($result_injury)) {
$aiment_ids = $row_injury['ailment_ids'];
error_log("explode" . $row_injury['ailment_ids']);
?>
<div class="profile-info-row">
<div class="profile-info-name">Ticket No:</div>
<div class="profile-info-value">
<?php echo $row_injury['ticket_no'] ?>&nbsp;&nbsp;&nbsp;
<?php if (isAccessible($_SESSION['RoleId'], $opd_menu_id, 'W')) { ?>
<a href="#" class="blue" onclick="open_employee_appointment_task(<?= $row_injury['appointment_id'] . ',`' . $row_injury['appointment_type'] . '`,' . $id . ',' . '`E`' . ',' . '``'; ?>);"><i class="ace-icon fa fa-edit" style="font-size: 15px;"></i></a>
<?php } ?>
</div>
<div class="profile-info-value">
<?php if (isAccessible($_SESSION['RoleId'], $opd_menu_id, 'W')) { ?>
<button type='button' class='btn btn-success btn-sm save_button' style='width:80%' onclick="injury_form(<?= $id ?>)">New Injury</button>
<?php } ?>
</div>
</div>
<div class="profile-info-row">
<div class="profile-info-name">Date & Time:</div>
<div class="profile-info-value">
<?php echo date_format(date_create($row_injury['appointment_date']), "d-M-Y H:i A") ?>
</div>
</div>
<div class="profile-info-row">
<div class="profile-info-name">complaints:</div>
<div class="profile-info-value">
<?php echo getCommaSeperatedValuesForInClause("select complaint from complaints ", "complaint_id", $row_injury['complaints']); ?>
</div>
</div>
<div class="profile-info-row">
<div class="profile-info-name">Diagnosis:</div>
<div class="profile-info-value">
<?php echo getCommaSeperatedValuesForInClause("select ailment_name from ailment ", "ailment_id", $row_injury['ailments_new']); ?>
</div>
</div>
<div class="profile-info-row">
<div class="profile-info-name">Treatment:</div>
<div class="profile-info-value">
<?php echo getTreatmentText($row_injury['appointment_id']) ?></div>
</div>
<div class="profile-info-row">
<div class="profile-info-name">Followups:</div>
<div class="profile-info-value">
<?php
$query_followup_injury = "select * from followup_details where appointment_id='" . $row_injury['appointment_id'] . "'";
error_log("Patient_Search_followup:" . $query_followup_injury);
if (!$result_followup_injury = @mysqli_query($conn, $query_followup_injury)) {
die(mysqli_error($conn));
}
if (mysqli_num_rows($result_followup_injury) > 0) {
while ($row_followup_injury = mysqli_fetch_assoc($result_followup_injury)) {
echo $row_followup_injury['ticket_no'];
if (isAccessible($_SESSION['RoleId'], $opd_menu_id, 'W')) {
?>
<a href="#" class="blue" onclick="open_employee_appointment_task(<?= $row_followup_injury['appointment_id'] . ',`' . $row_followup_injury['appointment_type'] . '`,' . $id . ',' . '`F`' . ',' . $row_followup_injury['followup_id'] ?>);"><i class="ace-icon fa fa-edit" style="font-size: 15px;"></i></a>
<?php }
}
} ?>
</div>
<div class="profile-info-value">
<?php if (isAccessible($_SESSION['RoleId'], $opd_menu_id, 'W')) { ?>
<button type='button' class='btn btn-info btn-sm save_button' onclick="open_employee_appointment_task(<?= $row_injury['appointment_id'] . ',`' . $row_injury['appointment_type'] . '`,' . $id . ',' . '`F`' . ',``' ?>);"><i class='ace-icon fa fa-plus'></i>Add Followup </button>
<?php } ?>
</div>
</div>
<?php
} else {
echo "No Results found";
}
} else {
?>
<div class="profile-info-value">No Record found</div>
<div class="profile-info-value">
<?php if (isAccessible($_SESSION['RoleId'], $opd_menu_id, 'W')) { ?>
<button type='button' class='btn btn-success btn-sm save_button' style='width:50%' onclick="injury_form(<?= $id ?>)">New Injury</button>
<?php } ?>
</div>
<?php } ?>
</div>
</div>
</div>
</div>
<!-- INJURY ENDS -->
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title" style="text-align: left">
<a class="accordion-toggle collapsed" data-toggle="collapse" data-parent="#accordion" href="#collapseThree"> <i class="ace-icon fa fa-angle-right bigger-110" data-icon-hide="ace-icon fa fa-angle-down" data-icon-show="ace-icon fa fa-angle-right"></i> &nbsp;Previous Emergency
</a>
</h4>
</div>
<div class="panel-collapse collapse" id="collapseThree">
<div class="panel-body">
<div class="profile-user-info profile-user-info-striped" style="margin: 0px; padding: 0px; width: 100%">
<?php
$sql_emergency = "select * from employee_appointment where emp_id = '" . $id . "' and isEmergency='1' order by appointment_date desc limit 1";
error_log("sql emergency: 643: " . $sql_emergency);
if (!$result_emergency = @mysqli_query($conn, $sql_emergency)) {
die(error_log(mysqli_error($conn)));
}
if (mysqli_num_rows($result_emergency) > 0) {
if ($row_emergency = mysqli_fetch_assoc($result_emergency)) {
?>
<div class="profile-info-row">
<div class="profile-info-name">Date & Time:</div>
<div class="profile-info-value">
<?php echo date_format(date_create($row_emergency['appointment_date']), "d-M-Y H:i A") ?>
</div>
</div>
<?php
$appointment_type = $row_emergency['appointment_type'];
$diagnosis = getCommaSeperatedValuesForInClause("select ailment_name from ailment ", "ailment_id", $row_emergency['ailment_new']);
?>
<div class="profile-info-row">
<div class="profile-info-name">Diagnosis:</div>
<div class="profile-info-value"><?php echo $diagnosis ?></div>
</div>
<div class="profile-info-row">
<div class="profile-info-name">Treatment:</div>
<div class="profile-info-value">
<?php echo getTreatmentText($row_emergency['appointment_id']) ?></div>
</div>
<?php } else { ?> No Results found
<?php
}
} else {
?>
<div class="profile-info-value">No Record found</div>
<?php } ?>
</div>
</div>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading" style="text-align: left">
<h4 class="panel-title">
<a class="accordion-toggle collapsed" data-toggle="collapse" data-parent="#accordion" href="#collapseFour"> <i class="ace-icon fa fa-angle-right bigger-110" data-icon-hide="ace-icon fa fa-angle-down" data-icon-show="ace-icon fa fa-angle-right"></i> &nbsp;Previous Sickness
Absenteeism
</a>
</h4>
</div>
<div class="panel-collapse collapse" id="collapseFour">
<div class="panel-body">
<div class="profile-user-info profile-user-info-striped" style="margin: 0px; padding: 0px; width: 100%">
<?php
$sql_sickness = "select * from sickness where emp_id = '" . $id . "' order by sickness_date desc limit 1";
error_log("sql sickness: 789: " . $sql_sickness);
if (!$result_sickness = @mysqli_query($conn, $sql_sickness)) {
die(error_log(mysqli_error($conn)));
}
if (mysqli_num_rows($result_sickness) > 0) {
if ($row_sickness = mysqli_fetch_assoc($result_sickness)) {
?>
<div class="profile-info-row">
<div class="profile-info-name">Ticket No:</div>
<div class="profile-info-value">
<?php echo ($row_sickness['ticket_no']) ?>&nbsp;&nbsp;&nbsp;
<?php if (isAccessible($_SESSION['RoleId'], $opd_menu_id, 'W')) { ?>
<button type='button' class='btn btn-success btn-sm save_button' onclick="sickness_form(<?= $id ?> )">New Medical</button>
<?php } ?>
</div>
</div>
<div class="profile-info-row">
<div class="profile-info-name">Date & Time:</div>
<div class="profile-info-value"><?php echo $row_sickness['sickness_date'] ?>
</div>
</div>
<div class="profile-info-row">
<div class="profile-info-name">Diagnosis:</div>
<div class="profile-info-value">
<?= getFieldFromTable('ailment_name', 'ailment', 'ailment_id', $row_sickness['ailment_name']) ?>
</div>
</div>
<!-- <div class="profile-info-row">
<div class="profile-info-name">Treatment:</div>
<div class="profile-info-value"><?php echo $row_sickness['des'] ?></div>
</div> -->
<?php } else { ?>
No Results found
<?php
}
} else {
?>
<div class="profile-info-value">No Record found</div>
<?php if (isAccessible($_SESSION['RoleId'], $opd_menu_id, 'W')) { ?>
<div class="profile-info-value">
<button type='button' class='btn btn-success btn-sm save_button' style='width:50%' onclick="sickness_form(<?= $id ?> )">New Sickness</button>
</div>
<?php } ?>
<?php } ?>
</div>
</div>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading" style="text-align: left">
<h4 class="panel-title">
<a class="accordion-toggle collapsed" data-toggle="collapse" data-parent="#accordion" href="#collapseFive">
<i class="ace-icon fa fa-angle-right bigger-110" data-icon-hide="ace-icon fa fa-angle-down" data-icon-show="ace-icon fa fa-angle-right"></i> &nbsp;Training
</a>
</h4>
</div>
<div class="panel-collapse collapse" id="collapseFive">
<div class="panel-body">
<div class="profile-user-info profile-user-info-striped" style="margin: 0px; padding: 0px; width: 100%">
<?php
$sql_training_complete = "select * from employee_assign_training where emp_id='" . $_SESSION['logged_user_empid'] . "' and status='Y' limit 1";
// echo $sql_training_complete;
error_log("sql training complete: 909: " . $sql_training_complete);
if (!$result_training_complete = @mysqli_query($conn, $sql_training_complete)) {
die(error_log(mysqli_error($conn)));
}
if (mysqli_num_rows($result_training_complete) > 0) {
if ($row_training_complete = mysqli_fetch_assoc($result_training_complete)) {
$query_schedule = "select * from training_schedule where schedule_id='" . $row_training_complete['training_schedule_id'] . "' limit 1";
// echo $query_schedule;
error_log("query_schedule: " . $query_schedule);
$result_schedule = @mysqli_query($conn, $query_schedule);
while ($rows_schedule = mysqli_fetch_assoc($result_schedule)) {
$training_name = getTableFieldValue('training_master', 'training_name', 'training_master_id', $rows_schedule['training_id']);
$from_date = date_format(date_create($row_training['from_date']), "d-M-Y");
$to_date = date_format(date_create($row_training['to_date']), "d-M-Y");
$trainer_name = $rows_schedule['trainer_name'];
$training_location = $rows_schedule['location'];
// $training_schedule= $training_name.'('.$rows_schedule['trainer_name'].','.date_format(date_create($row_training['from_date']),"d-M-Y").' '.date_format(date_create($row_training['to_date']),"d-M-Y").')';
}
?>
<div class="profile-info-row">
<div class="profile-info-name">Training Name:</div>
<div class="profile-info-value"><?php echo $training_name ?></div>
</div>
<div class="profile-info-row">
<div class="profile-info-name">To Date:</div>
<div class="profile-info-value"><?php echo $to_date ?></div>
</div>
<div class="profile-info-row">
<div class="profile-info-name">From Date:</div>
<div class="profile-info-value"><?php echo $from_date ?></div>
</div>
<div class="profile-info-row">
<div class="profile-info-name">Trainer Name:</div>
<div class="profile-info-value"><?php echo $trainer_name ?></div>
</div>
<div class="profile-info-row">
<div class="profile-info-name">Completion Date:</div>
<div class="profile-info-value">
<?php echo $date_completion = date_format(date_create($row_training_complete['completion_date']), "d-M-Y") ?>
</div>
</div>
<div class="profile-info-row">
<div class="profile-info-name">Status Name:</div>
<div class="profile-info-value"><?php echo 'complete' ?></div>
</div>
<?php
$date_completion = "";
// if($row_emp_assign_training['completion_date']!=null && $row_emp_assign_training['completion_date']!='0000-00-00' )
// $date_completion= date_format(date_create($row_emp_assign_training['completion_date']),"d-M-Y");
}
} else {
?> No Results found<?php
}
?>
</div>
</div>
</div>
</div>
<!-- Previous Medical Examination start here -->
<div class="panel panel-default">
<div class="panel-heading" style="text-align: left">
<h4 class="panel-title">
<a class="accordion-toggle collapsed" data-toggle="collapse" data-parent="#accordion" href="#collapseSix">
<i class="ace-icon fa fa-angle-right bigger-110" data-icon-hide="ace-icon fa fa-angle-down" data-icon-show="ace-icon fa fa-angle-right"></i> &nbsp;Previous Medical
Examination
</a>
</h4>
</div>
<div class="panel-collapse collapse" id="collapseSix">
<div class="panel-body">
<div class="profile-user-info profile-user-info-striped" style="margin: 0px; padding: 0px; width: 100%">
<?php
$sql_checkup = "select * from checkup_form where emp_id = '" . $id . "' order by checkup_date desc limit 1";
error_log("sql checkup: 1076: " . $sql_checkup);
if (!$result_checkup = @mysqli_query($conn, $sql_checkup)) {
die(error_log(mysqli_error($conn)));
}
if (mysqli_num_rows($result_checkup) > 0) {
if ($row_checkup = mysqli_fetch_assoc($result_checkup)) {
?>
<div class="profile-info-row">
<div class="profile-info-name">Ticket No:</div>
<div class="profile-info-value" align='center'>
<?php echo ($row_checkup['ticket_no']) ?>&nbsp;&nbsp;&nbsp;
<?php //if (isAccessible($_SESSION['RoleId'], $opd_menu_id, 'W')) {
?>
<!-- <button type='button' class='btn btn-success btn-sm save_button' onclick="checkup_selector(<?= $id ?> )">New Medical</button> -->
<?php //}
?>
</div>
</div>
<div class="profile-info-row">
<div class="profile-info-name">Date & Time:</div>
<div class="profile-info-value">
<?php echo date_format(date_create($row_checkup['checkup_date']), "d-M-Y H:i A") ?>
</div>
</div>
<div class="profile-info-row">
<div class="profile-info-name">Medications:</div>
<div class="profile-info-value">
<?php echo (isset($row_checkup['reglar_medication'])) ? ($row_checkup['reglar_medication']) : ("NA") ?>
</div>
</div>
<?php } else {
echo "No Results found";
}
} else {
?>
<div class="profile-info-value">No Record found</div>
<?php if (isAccessible($_SESSION['RoleId'], $opd_menu_id, 'W')) { ?>
<div class="profile-info-value">
<button type='button' class='btn btn-success btn-sm save_button' style='width:50%' onclick="checkup_selector(<?= $id ?> )">New Medical</button>
</div>
<?php } ?>
<?php } ?>
</div>
</div>
</div>
</div>
<!-- Previous Medical Examination ends here -->
<!-- PAst Present Illness start here -->
<div class="panel panel-default">
<div class="panel-heading" style="text-align: left">
<h4 class="panel-title">
<a class="accordion-toggle collapsed" data-toggle="collapse" data-parent="#accordion" href="#collapsePastIllness">
<i class="ace-icon fa fa-angle-right bigger-110" data-icon-hide="ace-icon fa fa-angle-down" data-icon-show="ace-icon fa fa-angle-right"></i> &nbsp;Chronic Illness &nbsp;&nbsp;<i class="ace-icon fa fa-plus bigger-130" onclick="add_cronic(<?= $id ?>)"></i></a>
</h4>
</div>
<div class="panel-collapse collapse" id="collapsePastIllness">
<div class="panel-body">
<div class="profile-user-info profile-user-info-striped" style="margin: 0px; padding: 0px; width: 100%">
<div class="profile-info-row">
<div class="profile-info-name">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Diagnosis date:</div>
<div class="profile-info-name">Illness:</div>
<div class="profile-info-name">Medicine:</div>
<div class="profile-info-name">Other Medicine:</div>
<div class="profile-info-name">Frequency:</div>
</div>
<?php
$sql_prescription_master = "SELECT * FROM `prescription_master` where emp_id = '" . $id . "' order by diagnosis_date desc";
error_log("prescription_master: " . $sql_prescription_master);
if (!$result_prescription_master = @mysqli_query($conn, $sql_prescription_master)) {
die(error_log(mysqli_error($conn)));
}
$illness = '';
if (mysqli_num_rows($result_prescription_master) > 0) {
while ($row_prescription_master = mysqli_fetch_assoc($result_prescription_master)) {
if ($row_prescription_master['diagnosis_date'] != null && $row_prescription_master['diagnosis_date'] != '' && $row_prescription_master['diagnosis_date'] != '1970-01-01' && $row_prescription_master['diagnosis_date'] != '0000-00-00') {
$date = DateTime::createFromFormat('Y-m-d', $row_prescription_master['diagnosis_date']);
// Format the date in "d/m/Y" format
$newDateFormat = $date->format('d/m/Y');
$diagnosis_date = $newDateFormat;
} else {
$diagnosis_date = "Not Present";
}
?>
<div class="profile-info-row">
<div class="profile-info-value">
<?php echo "<a href=\"#\" class=\"blue\" onclick=\"open_chronic('" . $row_prescription_master['prescription_id'] . "');\"><i class=\"ace-icon fa fa-edit bigger-130\"></i></a>" . "&nbsp;&nbsp;&nbsp;" . "<a href=\"#\" class=\"red\" onclick=\"delete_ambulance('" . $row_prescription_master['prescription_id'] . "');\"><i class=\"ace-icon fa fa-trash-o bigger-130\"></i></a>" . "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" . $diagnosis_date; ?>
</div>
<div class="profile-info-value">
<?php echo getTableFieldValue('abnormality', 'abnormality_name', 'abnormality_id', $row_prescription_master['diseases']); ?>
</div>
<div class="profile-info-value">
<?php echo getTableFieldValue('tbl_items', 'item_name', 'item_id', $row_prescription_master['medicine_name']); ?>
</div>
<div class="profile-info-value">
<?php echo $row_prescription_master['other_med']; ?>
</div>
<div class="profile-info-value">
<?php echo getTableFieldValue('medicine_frequency', 'medicine_frequency', 'frequency_id', $row_prescription_master['medicine_frequency']); ?>
</div>
</div>
<?php
}
} else {
?>
<div class="profile-info-value">No Record found</div>
<?php } ?>
</div>
</div>
</div>
</div>
<!-- PAst Present Illness ends here -->
<!-- Habit start -->
<div class="panel panel-default">
<div class="panel-heading" style="text-align: left">
<h4 class="panel-title">
<a class="accordion-toggle collapsed" data-toggle="collapse" data-parent="#accordion" href="#collapseHabit">
<i class="ace-icon fa fa-angle-right bigger-110" data-icon-hide="ace-icon fa fa-angle-down" data-icon-show="ace-icon fa fa-angle-right"></i> &nbsp;Habits &nbsp;&nbsp;<i class="ace-icon fa fa-plus bigger-130" onclick="add_habit(<?= $id ?>)"></i> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<i class="ace-icon fa fa-trash bigger-130" onclick="delete_habit(<?= $id ?>)"></i>
</a>
</h4>
</div>
<div class="panel-collapse collapse" id="collapseHabit">
<div class="panel-body">
<div class="profile-user-info profile-user-info-striped" style="margin: 0px; padding: 0px; width: 100%">
<?php
$habit_data = ucwords(strtolower(getHabitData($id)));
if ($habit_data != '' && $habit_data != null) {
?>
<!-- <div class="profile-info-row">
<div class="profile-info-name">Date & Time:</div>
<div class="profile-info-value"><?php echo $row_checkup['appointment_date'] ?>
</div>
</div> -->
<div class="profile-info-row">
<div class="profile-info-name">Habits:</div>
<div class="profile-info-value">
<?php echo $habit_data ?></div>
</div>
<?php
} else {
?>
<div class="profile-info-value">No Record found</div>
<?php } ?>
</div>
</div>
</div>
</div>
<!-- Habit end -->
<!-- Drug Allergy start -->
<div class="panel panel-default">
<div class="panel-heading" style="text-align: left">
<h4 class="panel-title">
<a class="accordion-toggle collapsed" data-toggle="collapse" data-parent="#accordion" href="#collapseAllergy">
<i class="ace-icon fa fa-angle-right bigger-110" data-icon-hide="ace-icon fa fa-angle-down" data-icon-show="ace-icon fa fa-angle-right"></i> &nbsp;Drug Allergy &nbsp;&nbsp;<i class="ace-icon fa fa-plus bigger-130" onclick="add_drug_allergy(<?= $id ?>)"></i>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<i class="ace-icon fa fa-trash bigger-130" onclick="delete_drug_allergy(<?= $id ?>)"></i>
</a>
</h4>
</div>
<div class="panel-collapse collapse" id="collapseAllergy">
<div class="panel-body">
<div class="profile-user-info profile-user-info-striped" style="margin: 0px; padding: 0px; width: 100%">
<?php
$drug_allergy_data = ucwords(strtolower(getDrugAllergyData($id)));
if ($drug_allergy_data != '' && $drug_allergy_data != null) {
?>
<div class="profile-info-row">
<div class="profile-info-name">Drug Allergies:</div>
<div class="profile-info-value">
<?php echo $drug_allergy_data ?></div>
</div>
<?php
} else {
?>
<div class="profile-info-value">No Record found</div>
<?php } ?>
</div>
</div>
</div>
</div>
<!-- Drug Allergy end -->
<!-- Health Advice start here -->
<div class="panel panel-default">
<div class="panel-heading" style="text-align: left">
<h4 class="panel-title">
<a class="accordion-toggle collapsed" data-toggle="collapse" data-parent="#accordion" href="#collapseHealthAdvices">
<i class="ace-icon fa fa-angle-right bigger-110" data-icon-hide="ace-icon fa fa-angle-down" data-icon-show="ace-icon fa fa-angle-right"></i> &nbsp;Health Advices
</a>
</h4>
</div>
<div class="panel-collapse collapse" id="collapseHealthAdvices">
<div class="panel-body">
<div class="profile-user-info profile-user-info-striped" style="margin: 0px; padding: 0px; width: 100%">
<?php
$sql_checkup = "select health_advices_new,appointment_date from employee_appointment where emp_id = '" . $id . "' order by appointment_date desc limit 1";
error_log("sql checkup: 1076: " . $sql_checkup);
if (!$result_checkup = @mysqli_query($conn, $sql_checkup)) {
die(error_log(mysqli_error($conn)));
}
if (mysqli_num_rows($result_checkup) > 0) {
if ($row_checkup = mysqli_fetch_assoc($result_checkup)) {
?>
<div class="profile-info-row">
<div class="profile-info-name">Date & Time:</div>
<div class="profile-info-value"><?php echo $row_checkup['appointment_date'] ?>
</div>
</div>
<div class="profile-info-row">
<div class="profile-info-name">Advices:</div>
<div class="profile-info-value">
<?php echo $row_checkup['health_advices_new'] ?></div>
</div>
<?php } else {
echo "No Results found";
}
} else {
?>
<div class="profile-info-value">No Record found</div>
<?php } ?>
</div>
</div>
</div>
</div>
<!-- Health Advice ends here -->
<!-- <div class="panel panel-default">
<div class="panel-heading" style="text-align: left">
<h4 class="panel-title">
<a class="accordion-toggle collapsed" data-toggle="collapse"
data-parent="#accordion"
href="#collapseSeven"> <i
class="ace-icon fa fa-angle-right bigger-110"
data-icon-hide="ace-icon fa fa-angle-down"
data-icon-show="ace-icon fa fa-angle-right"></i> &nbsp;Health
Advice
</a>
</h4>
</div>
<div class="panel-collapse collapse" id="collapseSeven">
<div class="panel-body">
<?php
error_log("HEALTH ADVICE IS " . $row['known_health_advices']);
if ($row['known_health_advices'] != "concat(known_health_advices,'')") {
$advices = explode(",", trim($row['known_health_advices'], ','));
// echo $advices;
$str_advices = '<ul>';
for ($i = 0; $i < count($advices); $i++) {
error_log("HEALTH ADVICE : " . getTableFieldValue('health_advice', 'health_advice_name', 'health_advice_id', $advices[$i], ''));
if ($i == 0) {
$str_advices .= "<li style='text-align:left'>" . getTableFieldValue('health_advice', 'health_advice_name', 'health_advice_id', $advices[$i], '');
$str_advices .= "</li>";
} else {
$str_advices .= '<li style="text-align:left">' . getTableFieldValue('health_advice', 'health_advice_name', 'health_advice_id', $advices[$i], '');
$str_advices .= "</li>";
}
}
$str_advices .= '</ul>';
echo $str_advices;
}
?>
</div>
</div> -->
<div class="panel panel-default">
<div class="panel-heading" style="text-align: left">
<h4 class="panel-title">
<a class="accordion-toggle collapsed" data-toggle="collapse" data-parent="#accordion" href="#collapseEight"> <i class="ace-icon fa fa-angle-right bigger-110" data-icon-hide="ace-icon fa fa-angle-down" data-icon-show="ace-icon fa fa-angle-right"></i>
&nbsp;Significant Health Risks
</a>
</h4>
</div>
<div class="panel-collapse collapse" id="collapseEight">
<div class="panel-body">
<?php
if ($row['known_health_risks'] != "concat(known_health_risks,'')") {
$risks = explode(",", trim($row['known_health_risks'], ','));
// echo $advices;
$str_risks = '<ul>';
for ($i = 0; $i < count($risks); $i++) {
if ($i == 0) {
$str_risks .= "<li style='text-align:left'>" . getTableFieldValue('health_risk', 'health_risk_name', 'health_risk_id', $risks[$i], '');
$str_risks .= "</li>";
} else {
$str_risks .= '<li style="text-align:left">' . getTableFieldValue('health_risk', 'health_risk_name', 'health_risk_id', $risks[$i], '');
$str_risks .= "</li>";
}
}
$str_risks .= '</ul>';
echo $str_risks;
}
?>
</div>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading" style="text-align: left">
<h4 class="panel-title">
<a class="accordion-toggle collapsed" data-toggle="collapse" data-parent="#accordion" href="#collapseNine"> <i class="ace-icon fa fa-angle-right bigger-110" data-icon-hide="ace-icon fa fa-angle-down" data-icon-show="ace-icon fa fa-angle-right"></i>
&nbsp;Additional Treatment Recommendations
</a>
</h4>
</div>
<div class="panel-collapse collapse" id="collapseNine">
<div class="panel-body">
<?php
$sql_checkup = "select * from employee_appointment where emp_id = '" . $id . "' order by appointment_date desc limit 1";
error_log("sql opd: 1076: " . $sql_checkup);
if (!$result_checkup = @mysqli_query($conn, $sql_checkup)) {
die(error_log(mysqli_error($conn)));
}
if (mysqli_num_rows($result_checkup) > 0) {
if ($row_checkup = mysqli_fetch_assoc($result_checkup)) {
?>
<div class="profile-info-row">
<div class="profile-info-name">Date & Time:</div>
<div class="profile-info-value">
<?php echo date_format(date_create($row_checkup['appointment_date']), "d-M-Y H:i A") ?>
</div>
</div>
<div class="profile-info-row">
<div class="profile-info-name">Recommendations:</div>
<div class="profile-info-value">
<?php echo (isset($row_checkup['external_treatments'])) ? ($row_checkup['external_treatments']) : ("NA") ?>
</div>
</div>
<?php } else {
echo "No Results found";
}
} else {
?>
<div class="profile-info-value">No Record found</div>
<?php } ?>
</div>
</div>
</div>
</div>
</div>
</div>
<?php if ($_REQUEST['task'] != 'DIRECT_ENTRY') { ?>
<!-- Charts starts here -->
<br>
<div class="container-fluid">
<form id="filter_report" name="filter_report">
<div class="row">
<div class="col-sm-12 alert center" style="border-radius: 2%;background-color:#379683; color:#fff"><i class="ace-icon fa fa-star orange card"></i> &nbsp;Choose date filter to see past data</div>
<div class="col-sm-2">
<div class="panel panel-warning card">
<div class="panel-heading">
<h3 class="panel-title center">Start date</h3>
</div>
<div class="panel-body">
<div class="input-group">
<?php
$startDate = date('d-m-Y', strtotime('-6 months'));
?>
<input class="form-control date-picker" style="width:auto" id="startDate" name="startDate" value="<?= $startDate ?>" type=" text" data-date-format="dd-mm-yyyy" />
</div>
</div>
</div>
</div>
<div class="col-sm-2">
<div class="panel panel-warning card">
<div class="panel-heading">
<h3 class="panel-title center">End date</h3>
</div>
<div class="panel-body">
<div class="input-group">
<input class="form-control date-picker" style="width:auto" id="endDate" name="endDate" value="<?= date('d-m-Y') ?>" type=" text" data-date-format="dd-mm-yyyy" />
</div>
</div>
</div>
</div>
<!-- a -->
<div class="col-sm-4">
<div class="panel panel-warning card">
<div class="panel-heading">
<h3 class="panel-title center">Select Health Parameter</h3>
</div>
<div class="panel-body">
<div class="input-group col-sm-12">
<select multiple style="width:380px" class="chosen-select form-control" id="health_parameter" name="health_parameter" data-placeholder="Select Health Parameter">
<?php
$sql = "SELECT DISTINCT khr.key_param_id, khr.key_param_name
FROM key_health_reportable_parameter_master khr
LEFT JOIN checkup_parameter cp ON cp.key_health_map_name = khr.key_param_id
WHERE cp.input_type = 'number'";
$result = mysqli_query($conn, $sql);
if ($result) {
while ($row = mysqli_fetch_assoc($result)) {
echo '<option value="' . $row['key_param_id'] . '">' . $row['key_param_name'] . '</option>';
}
mysqli_free_result($result);
} else {
echo 'Error: ' . mysqli_error($conn);
}
?>
</select>
</div>
</div>
</div>
</div>
<div class="col-sm-2">
<div class="panel panel-warning card">
<div class="panel-heading">
<h3 class="panel-title center">Select Chart</h3>
</div>
<div class="panel-body">
<div class="input-group">
<select class="select2 form-control" name="choose_chart" id="choose_chart" data-placeholder="Choose Chart" onchange="chartValidate()">
<option value="bar" selected>Bar Chart</option>
<option value="line">Line Chart</option>
<option value="doughnut">Doughnut Chart</option>
<option value="pie">Pie Chart</option>
<option value="radar">Radar Chart</option>
<!-- <option value="polarArea">PolarArea Chart</option> -->
</select>
</div>
</div>
</div>
</div>
<div class=" col-sm-1 wizard-card container-fluid " style="margin-top: 40px; ">
<button type="button" class="card" style="background-color: #dd4b39b5;width: 66px;height: 26px;" id="mybtn" onclick="getShowingData()">GO</button>
</div>
</div>
</form>
</div>
<?php
?>
<div name="data_shower">
<!-- /// -->
<div id="parameter_charts" class="row"></div>
<div class="container-fluid" id='bmi_div'>
<div class="row">
<p class="alert center" style="border-radius: 2%;background-color:#379683; color:#fff"><i class="ace-icon fa fa-star orange card"></i> &nbsp;Health Index Tracking &nbsp;&nbsp;&nbsp;&nbsp;<i class="fa fa-print" aria-hidden="true" onclick="printDiv('healthindex_div');"></i></p>
<div class="space space-4"></div>
<div class="col-sm-6 wizard-card container-fluid card" style=" padding-left: 20px;">
<canvas id="patient_healthidex"></canvas>
</div>
</div>
</div>
<br>
<!-- // -->
<div class="container-fluid" id='bmi_div'>
<div class="row">
<p class="alert center" style="border-radius: 2%;background-color:#379683; color:#fff"><i class="ace-icon fa fa-star orange card"></i> &nbsp;BMI TRACKING &nbsp;&nbsp;&nbsp;&nbsp;<i class="fa fa-print" aria-hidden="true" onclick="printDiv('bmi_div');"></i></p>
<div class="space space-4"></div>
<div class="col-sm-6 wizard-card container-fluid card" style="
padding-left: 20px;
">
<canvas id="patient_bmi"></canvas>
<?php //php include 'chart_employee_bmi_height_weight.php';
?>
</div>
<div class="col-sm-6 container-fluid">
<table style="width: 100%" id="bmi_table" class="center card table table-striped">
<!-- <thead>
<tr>
<td style="font-size: 10px" width="15%"><strong>Date</strong></td>
<td style="font-size: 10px" width="15%"><strong>height</strong></td>
<td style="font-size: 10px" width="15%"><strong>weight</strong></td>
<td style="font-size: 10px" width="15%"><strong>bmi</strong></td>
</tr>
</thead>
<tbody>
</tbody> -->
</table>
</div>
</div>
</div>
<hr>
<div class="container-fluid" id='osi_div'>
<div class="row">
<p class="alert center" style="border-radius: 2%;background-color:#379683; color:#fff"><i class="ace-icon fa fa-star orange card"></i> &nbsp;OSI TRACKING &nbsp;&nbsp;&nbsp;&nbsp;<i class="fa fa-print" aria-hidden="true" onclick="printDiv('osi_div');"></i></p>
<div class="space space-4"></div>
<div class="col-sm-6 wizard-card container-fluid card" style="
padding-left: 20px;
">
<canvas id="patient_osi"></canvas>
<?php //include 'chart_employee_OSI.php';
?>
</div>
<div class="col-sm-6 wizard-card container-fluid">
<table style="width: 100%" id="osi_table" class="center card table">
<thead>
<tr>
<td style="font-size: 10px" width="15%"><strong>Months</strong></td>
<td style="font-size: 10px" width="15%"><strong>OPD Visits</strong></td>
<td style="font-size: 10px" width="15%"><strong>Injury Visits</strong></td>
<td style="font-size: 10px" width="15%"><strong>Sickness Visits</strong></td>
</tr>
</thead>
<tbody>
<?php
$startMonth = '1';
$endMonth = '12';
$year = date("Y");
// SQL query to select data from database
for ($i = $startMonth; $i <= $endMonth; $i++) {
$query1 = "SELECT COUNT(appointment_id) FROM employee_appointment WHERE MONTH(appointment_date) = $i and YEAR(appointment_date)='$year' AND appointment_type='O' AND emp_id='$id' ";
// $testMonth = $endMonth - $m;
// if ($testMonth <= 0) {
// $testMonth += 12;
// }
error_log("count query for osi " . $query1);
$result1 = mysqli_query($conn, $query1);
while ($row1 = $result1->fetch_assoc()) {
$month_name = date("F", mktime(0, 0, 0, $i, 10));
?> <tr>
<td>
<?php echo $month_name; ?>
</td>
<td>
<?php echo $row1['COUNT(appointment_id)']; ?>
</td>
<?php
}
$m++;
$query2 = "SELECT COUNT(appointment_id) FROM employee_appointment WHERE MONTH(appointment_date) = $i and YEAR(appointment_date)='$year' AND appointment_type='I' AND emp_id='$id' ";
$result2 = mysqli_query($conn, $query2);
while ($row2 = $result2->fetch_assoc()) {
?>
<td>
<?php echo $row2['COUNT(appointment_id)']; ?>
</td>
<?php
$query3 = "SELECT COUNT(sickness_id) FROM sickness WHERE MONTH(sickness_date) = $i and YEAR(sickness_date)='$year' AND emp_id='$id' ";
error_log('query3 osi' . $query3);
while ($row3 = $result3->fetch_assoc()) {
?>
<td>
<?php echo $row3['COUNT(sickness_id)']; ?>
</td>
</tr>
<?php
}
}
}
?>
</tbody>
</table>
</div>
</div>
</div>
<hr>
<div class="container-fluid" id='bp_div'>
<div class="row">
<p class="alert center" style="border-radius: 2%;background-color:#379683; color:#fff"><i class="ace-icon fa fa-star orange card"></i> &nbsp;BP TRACKING&nbsp;&nbsp;&nbsp;&nbsp;<i class="fa fa-print" aria-hidden="true" onclick="printDiv('bp_div');"></i></p>
<div class="space space-4"></div>
<div class="col-sm-6 wizard-card container-fluid card" style="
padding-left: 20px;
">
<canvas id="patient_bp"></canvas>
<?php //php include 'chart_employee_blood_pressure.php';
?>
</div>
<div class="col-sm-6 wizard-card container-fluid">
<table style="width: 100%" id="bp_table" class="center card table table-striped">
<!-- <thead>
<tr>
<td style="font-size: 10px" width="15%"><strong>Date</strong></td>
<td style="font-size: 10px" width="15%"><strong>Sbp</strong></td>
<td style="font-size: 10px" width="15%"><strong>Dbp</strong></td>
</tr>
</thead>
<tbody>
<//?php
for ($i = 0; $i < count($medical_date); $i++) {
$newDate = date("d-m-Y", strtotime($medical_date[$i]));
?>
<tr>
<td><//?php echo $newDate; ?></td>
<td><//?php echo $sbp_new[$i] ?></td>
<td><//?php echo $dbp_new[$i]; ?></td>
</tr>
<//?php
} ?>
</tbody> -->
</table>
</div>
</div>
</div>
<hr>
<div class="container-fluid" id='bs_div'>
<div class="row">
<p class="alert center" style="border-radius: 2%;background-color:#379683; color:#fff"><i class="ace-icon fa fa-star orange card"></i> &nbsp;BLOOD SUGAR TRACKING &nbsp;&nbsp;&nbsp;&nbsp;<i class="fa fa-print" aria-hidden="true" onclick="printDiv('bs_div');"></i></p>
<div class="space space-4"></div>
<div class="col-sm-6 wizard-card container-fluid card" style="padding-left: 20px;">
<canvas id="patient_bs"></canvas>
<?php //php include 'chart_employee_blood_sugar.php';
?>
</div>
<div class="col-sm-6 wizard-card container-fluid">
<table style="width: 100%" id="suger_table" class="center card table table-striped">
<!-- <thead>
<tr>
<td style="font-size: 10px" width="15%"><strong>Date</strong></td>
<td style="font-size: 10px" width="15%"><strong>FBS</strong></td>
<td style="font-size: 10px" width="15%"><strong>RBS</strong></td>
<td style="font-size: 10px" width="15%"><strong>PPBS</strong></td>
</tr>
</thead>
<tbody>
<//?php
for ($i = 0; $i < count($medical_date); $i++) {
$newDate = date("d-m-Y", strtotime($medical_date[$i]));
?>
<tr>
<td><//?php echo $newDate; ?></td>
<td><//?php echo $fbs_new[$i] ?></td>
<td><//?php echo $rbs_new[$i]; ?></td>
<td><//?php echo $ppbs_new[$i] ?></td>
</tr>
<//?php
} ?>
</tbody> -->
</table>
</div>
</div>
</div>
</div>
<!-- PAGE CONTENT ENDS -->
<!-- </div> -->
<div class="row">
<div class="col-sm-6" style="padding-top: 30px">
<div class="widget-box transparent">
<div class="widget-body">
<div class="widget-main no-padding">
<div id="canvas-holder3" style="width: 100%;">
<div class="chartjs-size-monitor">
<div class="chartjs-size-monitor-expand">
<div class=""></div>
</div>
<div class="chartjs-size-monitor-shrink">
<div class=""></div>
</div>
</div>
<canvas id="chart3" style="display: block; width: 0px; height: 0px;" width="0" height="0" class="chartjs-render-monitor"></canvas>
</div>
<!-- /.widget-main -->
</div>
<!-- /.widget-body -->
</div>
<!-- /.widget-box -->
</div>
<!-- PAGE CONTENT ENDS -->
</div>
<!-- /.col -->
<!-- <div class="col-sm-6" style="padding-top: 30px">
<div class="widget-box transparent">
<h4 class="widget-title lighter">
<i class="ace-icon fa fa-star orange"></i> Patient Hygiene Parameter
Tracker
</h4> -->
<!-- <div class="widget-body">
<div class="widget-main no-padding"> -->
<!-- <div id="canvas-holder4" style="width: 100%;">
<div class="chartjs-size-monitor">
<div class="chartjs-size-monitor-expand">
<div class=""></div>
</div>
<div class="chartjs-size-monitor-shrink">
<div class=""></div>
</div>
</div>
<canvas id="chart4"
style="display: block; width: 1013px; height: 506px;"
width="1013" height="506" class="chartjs-render-monitor"></canvas>
</div> -->
<!-- /.widget-main -->
<!-- </div> -->
<!-- /.widget-body -->
<!-- </div> -->
<!-- /.widget-box -->
<!-- </div> -->
<!-- PAGE CONTENT ENDS -->
<!-- </div> -->
</div>
</div>
</div>
<form name="f1" method="post" id="flex_opd_id_medical" action="">
<div id="flex1" style="width: 100%"></div>
<input type="hidden" name="flex_opd_id" id="flex_opd_id" />
</form>
<form name="f2" method="post" id="employee_form" action="">
<div id="flex1" style="width: 100%"></div>
<input type="hidden" name="flex_patient_id" id="flex_patient_id" />
</form>
<script async="" src="./js/analytics.js"></script>
<script src="./js/Chart.min.js"></script>
<script src="./js/utils.js"></script>
<style>
.btn.btn-app.btn-sm {
width: 110px
}
.btn-xl {
width: 120px !important;
height: 100px;
}
.btn-xxl {
width: 170px !important;
height: 100px;
}
.label-xs {
font-size: 10px !important;
}
.print {
position: absolute;
right: 11%;
}
.label-xs-header {
font-size: 10px !important;
text-align: left;
margin-left: 0px;
padding-left: 0px;
font-weight: bold;
}
.profile-info-name {
font-size: 10px !important;
text-align: left;
width: 35%;
}
.profile-info-value {
font-size: 10px !important;
text-align: left;
width: 65%;
}
.widget-title {
font-size: 12px;
}
</style>
<script>
function open_dashboard(emp_id) {
// alert(emp_id);
if (emp_id != null && emp_id != '') {
$("#flex_opd_id").val(emp_id);
$("#flex_opd_id_medical").attr('target', '_blank');
$("#flex_opd_id_medical").attr('method', 'POST');
$("#flex_opd_id_medical").attr('action', 'emp_dashboard.php');
$("#flex_opd_id_medical").submit();
}
}
function add_opd(patientId, task) {
// alert(patientId + " "+ task);
if (task != null && task != '') {
if ((task == 'opd' || task == 'visitor_opd') && patientId != null && patientId != '') {
$("#flex_patient_id").val(patientId);
$("#employee_form").attr('method', 'POST');
$("#employee_form").attr('action', 'opd_form.php');
$("#employee_form").submit();
}
}
}
var emp_id = "<?php echo $id ?>"
//alert(emp_id);
var health_index_array = [];
var health_index_labels = [];
var hyg_param_values = [];
var hyg_param_labels = [];
var myData = [];
var mylabels = [];
var myDbp = [];
var heartRate = [];
$.ajax({
type: 'get',
url: 'select_employee_sbp.php',
data: {
'emp_id': emp_id
},
dataType: 'json',
async: false,
success: function(data) {
for (var i = 0; i < data.length; i++) {
myData.push(data[i].checkup_form_value);
mylabels.push(data[i].checkup_date);
//myDbp.push(data[i].dbp);
//heartRate.push(data[i].heart_rate);
}
},
error: function(data) {
}
});
$.ajax({
type: 'get',
url: 'select_employee_dbp.php',
data: {
'emp_id': emp_id
},
dataType: 'json',
async: false,
success: function(data) {
for (var i = 0; i < data.length; i++) {
myDbp.push(data[i].checkup_form_value);
//myDbp.push(data[i].dbp);
//heartRate.push(data[i].heart_rate);
}
},
error: function(data) {
}
});
$.ajax({
type: 'get',
url: 'select_employee_pulse.php',
data: {
'emp_id': emp_id
},
dataType: 'json',
async: false,
success: function(data) {
for (var i = 0; i < data.length; i++) {
//myDbp.push(data[i].dbp);
heartRate.push(data[i].checkup_form_value);
}
},
error: function(data) {
}
});
$(document).ready(function() {
$.ajax({
type: 'POST',
url: 'select_employee_health_index.php',
data: {
'emp_id': emp_id
},
dataType: 'json',
async: false,
success: function(data) {
if (data != null) {
for (var i = 0; i < data.length; i++) {
health_index_array[i] = data[i].health_score;
health_index_labels[i] = data[i].checkup_date;
}
}
},
error: function(data) {
}
});
var barChartData = {
labels: health_index_labels,
datasets: [{
label: 'Health Index',
backgroundColor: color(window.chartColors.red).alpha(0.5).rgbString(),
borderColor: window.chartColors.red,
borderWidth: 1,
data: health_index_array
}]
};
var ctx1 = document.getElementById('chart3');
var chart = new Chart(ctx1, {
type: 'bar',
data: barChartData,
options: {
responsive: true,
legend: {
position: 'bottom',
},
title: {
display: true,
text: 'Health Index History'
}
}
});
});
var color = Chart.helpers.color;
//var MONTHS = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'];
$.ajax({
type: 'get',
url: 'select_employee_hygiene_parameter.php',
data: {
'emp_id': emp_id
},
dataType: 'json',
async: false,
success: function(data) {
for (var i = 0; i < data.length; i++) {
//myDbp.push(data[i].dbp);
hyg_param_values.push(data[i].hyg_parameter_val);
hyg_param_labels.push(data[i].checkup_date);
}
},
error: function(data) {
}
});
var data = {
labels: hyg_param_labels,
datasets: [
{
label: "Indium",
data: hyg_param_values,
backgroundColor: "blue",
borderColor: "lightblue",
fill: false,
lineTension: 0,
radius: 5
},
]
};
var ctx = $("#chart4");
var chart = new Chart(ctx, {
type: "line",
data: data,
options: {
title: {
display: true,
text: 'Indium (Hygiene Parameter) In Employee'
},
tooltips: {
callbacks: {
label: function(tooltipItems, data) {
return data.datasets[tooltipItems.datasetIndex].label + ':' + tooltipItems.yLabel +
' mg/m3';
}
},
enabled: true,
mode: 'index',
position: 'nearest',
custom: customTooltips
},
legend: {
display: true,
position: 'bottom',
},
scales: {
yAxes: [{
ticks: {
// Include a dollar sign in the ticks
callback: function(value, index, values) {
return value + ' mg/m3';
}
}
}]
}
}
});
var emp_weight_array = [];
var emp_weight_labels = [];
$.ajax({
type: 'POST',
url: 'select_employee_weight.php',
data: {
'emp_id': emp_id
},
dataType: 'json',
async: false,
success: function(data) {
for (var i = 0; i < data.length; i++) {
emp_weight_array[i] = data[i].checkup_form_value;
emp_weight_labels[i] = data[i].checkup_date;
}
},
error: function(data) {
}
});
var data = {
labels: emp_weight_labels,
datasets: [
{
label: "Weight",
data: emp_weight_array,
backgroundColor: "blue",
borderColor: "lightblue",
fill: false,
lineTension: 0,
radius: 5
},
]
};
var ctx = $("#chart1");
var chart = new Chart(ctx, {
type: "line",
data: data,
options: {
title: {
display: true,
text: 'Weight History'
},
tooltips: {
callbacks: {
label: function(tooltipItems, data) {
return data.datasets[tooltipItems.datasetIndex].label + ':' + tooltipItems.yLabel +
' Kgs';
}
},
enabled: true,
mode: 'index',
position: 'nearest',
custom: customTooltips
},
legend: {
display: true,
position: 'bottom',
},
scales: {
yAxes: [{
ticks: {
// Include a dollar sign in the ticks
callback: function(value, index, values) {
return value + ' Kgs';
}
}
}]
}
}
});
var ctx = $("#chartWeight");
var chart = new Chart(ctx, {
type: "line",
data: data,
options: {
title: {
display: true,
text: 'Weight History'
},
tooltips: {
callbacks: {
label: function(tooltipItems, data) {
return data.datasets[tooltipItems.datasetIndex].label + ':' + tooltipItems.yLabel +
' Kgs';
}
},
enabled: true,
mode: 'index',
position: 'nearest',
custom: customTooltips
},
legend: {
display: true,
position: 'bottom',
},
scales: {
yAxes: [{
ticks: {
// Include a dollar sign in the ticks
callback: function(value, index, values) {
return value + ' Kgs';
}
}
}]
}
}
});
var rightVision = [];
var empRightVisionLabels = [];
$.ajax({
type: 'POST',
url: 'select_employee_vision.php',
data: {
'emp_id': emp_id
},
dataType: 'json',
async: false,
success: function(data) {
for (var i = 0; i < data.length; i++) {
rightVision[i] = data[i].checkup_form_value;
empRightVisionLabels[i] = data[i].checkup_date;
}
},
error: function(data) {
}
});
var dataVision = {
labels: empRightVisionLabels,
datasets: [
{
label: "Right Vision",
data: rightVision,
backgroundColor: "blue",
borderColor: "lightblue",
fill: false,
lineTension: 0,
radius: 5
},
]
};
var ctxVision = document.getElementById('chartVision');
if (ctxVision != null) {
var chart = new Chart(ctxVision, {
type: 'line',
data: dataVision,
options: {
responsive: true,
legend: {
position: 'bottom',
},
title: {
display: true,
text: 'Right Vision History'
}
}
});
}
Chart.defaults.global.pointHitDetectionRadius = 1;
var customTooltips = function(tooltip) {
// Tooltip Element
var tooltipEl = document.getElementById('chartjs-tooltip');
if (!tooltipEl) {
tooltipEl = document.createElement('div');
tooltipEl.id = 'chartjs-tooltip';
tooltipEl.innerHTML = '<table></table>';
this._chart.canvas.parentNode.appendChild(tooltipEl);
}
// Hide if no tooltip
if (tooltip.opacity === 0) {
tooltipEl.style.opacity = 0;
return;
}
// Set caret Position
tooltipEl.classList.remove('above', 'below', 'no-transform');
if (tooltip.yAlign) {
tooltipEl.classList.add(tooltip.yAlign);
} else {
tooltipEl.classList.add('no-transform');
}
function getBody(bodyItem) {
return bodyItem.lines;
}
// Set Text
if (tooltip.body) {
var titleLines = tooltip.title || [];
var bodyLines = tooltip.body.map(getBody);
var innerHtml = '<thead>';
titleLines.forEach(function(title) {
innerHtml += '<tr><th>' + title + '</th></tr>';
});
innerHtml += '</thead><tbody>';
bodyLines.forEach(function(body, i) {
var colors = tooltip.labelColors[i];
var style = 'background:' + colors.backgroundColor;
style += '; border-color:' + colors.borderColor;
style += '; border-width: 2px';
var span = '<span class="chartjs-tooltip-key" style="' + style + '"></span>';
innerHtml += '<tr><td>' + span + body + '</td></tr>';
});
innerHtml += '</tbody>';
var tableRoot = tooltipEl.querySelector('table');
tableRoot.innerHTML = innerHtml;
}
var positionY = this._chart.canvas.offsetTop;
var positionX = this._chart.canvas.offsetLeft;
// Display, position, and set styles for font
tooltipEl.style.opacity = 1;
tooltipEl.style.left = positionX + tooltip.caretX + 'px';
tooltipEl.style.top = positionY + tooltip.caretY + 'px';
tooltipEl.style.fontFamily = tooltip._bodyFontFamily;
tooltipEl.style.fontSize = tooltip.bodyFontSize + 'px';
tooltipEl.style.fontStyle = tooltip._bodyFontStyle;
tooltipEl.style.padding = tooltip.yPadding + 'px ' + tooltip.xPadding + 'px';
};
var lineChartData = {
labels: mylabels,
datasets: [{
label: 'Blood Pressure(SBP)',
data: myData,
borderColor: window.chartColors.blue,
pointBackgroundColor: window.chartColors.blue,
fill: false,
}, {
label: 'Blood Pressure(DBP)',
data: myDbp,
borderColor: window.chartColors.green,
pointBackgroundColor: window.chartColors.green,
fill: false,
}, {
label: 'Heart Rate',
data: heartRate,
borderColor: window.chartColors.red,
pointBackgroundColor: window.chartColors.red,
fill: false,
}
]
};
//window.onload = function() {
var chartEl = document.getElementById('chart');
if (chartEl != null) {
window.myLine = new Chart(chartEl, {
type: 'line',
data: lineChartData,
options: {
title: {
display: true,
text: 'Blood Pressure History'
},
tooltips: {
enabled: false,
mode: 'index',
position: 'nearest',
custom: customTooltips
},
legend: {
display: true,
position: 'bottom',
},
}
});
}
var chartEl = document.getElementById('chartBP');
if (chartEl != null) {
window.myLine = new Chart(chartEl, {
type: 'line',
data: lineChartData,
options: {
title: {
display: true,
text: 'Blood Pressure History'
},
tooltips: {
enabled: false,
mode: 'index',
position: 'nearest',
custom: customTooltips
},
legend: {
display: true,
position: 'bottom',
},
}
});
}
$(document).ready(function() {
$("#opd_visit").click(function() {
$("#opd_visit_list").toggle();
});
});
$(document).ready(function() {
$("#injury").click(function() {
$("#injury_list").toggle();
});
});
$(document).ready(function() {
$("#emergency").click(function() {
$("#emergency_list").toggle();
});
});
$(document).ready(function() {
$("#examination").click(function() {
$("#examination_list").toggle();
});
});
$(document).ready(function() {
$("#health_risk").click(function() {
$("#health_risk_list").toggle();
});
});
$(document).ready(function() {
$("#sickness").click(function() {
$("#sickness_list").toggle();
});
});
$(document).ready(function() {
$("#health_advice").click(function() {
$("#health_advice_list").toggle();
});
});
$(document).ready(function() {
$("#training").click(function() {
$("#training_list").toggle();
});
});
function clearCharts() {
var patient_healthidex = document.getElementById('patient_healthidex');
var indexCtx = patient_healthidex.getContext('2d');
indexCtx.clearRect(0, 0, patient_healthidex.width, patient_healthidex.height);
var bmiCanvas = document.getElementById('patient_bmi');
var bmiCtx = bmiCanvas.getContext('2d');
bmiCtx.clearRect(0, 0, bmiCanvas.width, bmiCanvas.height);
var osiCanvas = document.getElementById('patient_osi');
var osiCtx = osiCanvas.getContext('2d');
osiCtx.clearRect(0, 0, osiCanvas.width, osiCanvas.height);
var bpCanvas = document.getElementById('patient_bp');
var bpCtx = bpCanvas.getContext('2d');
bpCtx.clearRect(0, 0, bpCanvas.width, bpCanvas.height);
var bsCanvas = document.getElementById('patient_bs');
var bsCtx = bsCanvas.getContext('2d');
bsCtx.clearRect(0, 0, bsCanvas.width, bsCanvas.height);
}
function getShowingData() {
clearCharts();
var start = $("#startDate").val();
var end = $("#endDate").val();
var id = <?php echo $id ?>;
var date = [];
var BMI = [];
var weight = [];
var height = [];
var sbp = [];
var dbp = [];
var ppbs = [];
var fbs = [];
var rbs = [];
var health_index = [];
function formatDateBMI(input) {
var datePart = input.match(/\d+/g),
year = datePart[2],
month = datePart[1],
day = datePart[0];
return month;
}
function toMonthName(monthNumber) {
const date = new Date();
date.setMonth(monthNumber - 1);
return date.toLocaleString('en-US', {
month: 'long',
});
}
var start_Month = formatDateBMI(start);
var end_Month = formatDateBMI(end);
var months = [];
var sickness = [];
var opd = [];
var injury = [];
// var monthOSI = [];
$.ajax({
url: 'filter_report_deshboard.php',
data: {
startDate: start,
endDate: end,
id: id,
start_Month: start_Month,
end_Month: end_Month
},
type: 'POST',
dataType: 'json',
success: function(data) {
console.log(data);
date = data['date'][0];
BMI = data['bmi'][0];
weight = data['weight'][0];
height = data['height'][0];
sbp = data['bp_sbp'][0];
dbp = data['bp_dbp'][0];
ppbs = data['blood_sugar_ppbs'][0];
fbs = data['blood_sugar_fbs'][0];
rbs = data['blood_sugar_rbs'][0];
months = data['months'][0];
sickness = data['sickness'];
opd = data['opd'][0];
injury = data['injury'];
health_index = data['health_index'];
console.log(data['health_index']);
// monthOSI = data['monthOSI'][0];
//console.log(data['injury']);
// BMI table
var content = "<thead><tr><th class='center'>DATE</th><th class='center'>HEIGHT</th><th class='center'>WEIGHT</th><th class='center'>BMI</th></tr></thead>";
for (var l = 0; l < date.length; l++) {
if ((height[l] || weight[l] || BMI[l]) && !(height[l] === 0 && weight[l] === 0 && BMI[l] === 0)) {
content += "<tr><td>" + date[l].split("-").reverse().join("-") + "</td><td>" + (height[l] ? height[l] : 0) +
"</td><td>" + (weight[l] ? weight[l] : 0) +
"</td><td>" + (BMI[l] ? BMI[l] : 0) + "</td></tr>";
}
}
$("#bmi_table").html(content);
// OSI table
var content1 = "";
content1 += "<thead><tr>" +
"<td>Month</strong></td><td>OPD Visits</strong></td><td>Injure Visit</strong></td><td>Sickness Visits</strong></td>"
content1 += "</thead>";
for (var l = 0; l < months.length; l++) {
// alert(toMonthName(months[l]));
content1 += "<tr><td>" + toMonthName(months[l]) + "</td><td>" + opd[l] + "</td><td>" +
injury[l] +
"</td><td>" + sickness[l] + "</td>";
content1 += "</tr>";
}
$("#osi_table").html(content1);
// BP table
var content2 = "<thead><tr><th class='center'>DATE</th><th class='center'>SBP</th><th class='center'>DBP</th></tr></thead>";
for (var l = 0; l < date.length; l++) {
if ((sbp[l] || dbp[l]) && !(sbp[l] === 0 && dbp[l] === 0)) {
content2 += "<tr><td>" + date[l].split("-").reverse().join("-") + "</td><td>" + (sbp[l] ? sbp[l] : 0) +
"</td><td>" + (dbp[l] ? dbp[l] : 0) + "</td></tr>";
}
}
$("#bp_table").html(content2);
// Sugar table
var content3 = "<thead><tr><th class='center'>DATE</th><th class='center'>FBS</th><th class='center'>RBS</th><th class='center'>PPBS</th></tr></thead>";
for (var l = 0; l < date.length; l++) {
if ((fbs[l] || rbs[l] || ppbs[l]) && !(fbs[l] === 0 && rbs[l] === 0 && ppbs[l] === 0)) {
content3 += "<tr><td>" + date[l].split("-").reverse().join("-") + "</td><td>" + (fbs[l] ? fbs[l] : 0) +
"</td><td>" + (rbs[l] ? rbs[l] : 0) +
"</td><td>" + (ppbs[l] ? ppbs[l] : 0) + "</td></tr>";
}
}
$("#suger_table").html(content3);
var ctx_bmi = document.getElementById('patient_bmi').getContext('2d');
var ctx_osi = document.getElementById('patient_osi').getContext('2d');
var ctx_bp = document.getElementById('patient_bp').getContext('2d');
var ctx_bs = document.getElementById('patient_bs').getContext('2d');
var ctx_hi = document.getElementById('patient_healthidex').getContext('2d');
// BMI Graph
function formatDateBMI(input) {
var datePart = input.match(/\d+/g),
year = datePart[0],
month = datePart[1],
day = datePart[2];
return day + '-' + month + '-' + year;
}
var xaxis = [];
var bmiData = [];
var weightData = [];
var heightData = [];
for (let i = 0; i < date.length; i++) {
if (height[i] || weight[i] || BMI[i]) {
xaxis.push(formatDateBMI(date[i]));
bmiData.push(BMI[i] ? BMI[i] : 0);
weightData.push(weight[i] ? weight[i] : 0);
heightData.push(height[i] ? height[i] : 0);
}
}
var myChart_bmi = new Chart(ctx_bmi, {
type: 'line',
options: {
title: {
display: true,
text: "BMI Graph"
},
legend: {
position: "bottom"
},
scales: {
yAxes: [{
ticks: {
precision: 0
}
}]
}
},
data: {
labels: xaxis,
datasets: [{
data: bmiData,
label: "BMI",
borderColor: "#d45087",
backgroundColor: "#d45087",
fill: false,
pointBackgroundColor: function(context) {
var index = context.dataIndex;
var value = context.dataset.data[index];
return value < 85 ? 'red' : // draw negative values in red
index % 2 ? 'blue' :
// else, alternate values in blue and green
'green';
}
}, {
data: weightData,
label: "weight",
borderColor: "#ff7c43",
backgroundColor: "#ffa500",
fill: false,
pointBackgroundColor: function(context) {
var index = context.dataIndex;
var value = context.dataset.data[index];
return value < 124 ? 'red' : // draw negative values in red
index % 2 ? 'blue' :
// else, alternate values in blue and green
'green';
}
}, {
data: heightData,
label: "height",
borderColor: "#3e95cd",
backgroundColor: "#7bb6dd",
fill: false,
pointBackgroundColor: function(context) {
var index = context.dataIndex;
var value = context.dataset.data[index];
return value < 124 ? 'red' : // draw negative values in red
index % 2 ? 'blue' :
// else, alternate values in blue and green
'green';
}
}]
},
});
// OSI Graph
var axis = [];
for (var i = 0; i < months.length; i++) {
axis[i] = 'Month:' + months[i];
}
var myChart_osi = new Chart(ctx_osi, {
type: 'line',
options: {
title: {
display: true,
text: "OSI Graph"
},
legend: {
position: "bottom"
},
scales: {
yAxes: [{
ticks: {
precision: 0
}
}]
}
},
data: {
labels: axis,
datasets: [{
data: opd,
label: "OPD",
borderColor: "#d45087",
backgroundColor: "#d45087",
fill: false,
pointBackgroundColor: function(context) {
var index = context.dataIndex;
var value = context.dataset.data[index];
return value < 85 ? 'red' : // draw negative values in red
index % 2 ? 'blue' :
// else, alternate values in blue and green
'green';
}
}, {
data: injury,
label: "Injury",
borderColor: "#ff7c43",
backgroundColor: "#ffa500",
fill: false,
pointBackgroundColor: function(context) {
var index = context.dataIndex;
var value = context.dataset.data[index];
return value < 124 ? 'red' : // draw negative values in red
index % 2 ? 'blue' :
// else, alternate values in blue and green
'green';
}
}, {
data: sickness,
label: "Sickness",
borderColor: "#3e95cd",
backgroundColor: "#7bb6dd",
fill: false,
pointBackgroundColor: function(context) {
var index = context.dataIndex;
var value = context.dataset.data[index];
return value < 124 ? 'red' : // draw negative values in red
index % 2 ? 'blue' :
// else, alternate values in blue and green
'green';
}
}]
},
});
//---------- bp chart--------------//
function formatDateBP(input) {
var datePart = input.match(/\d+/g),
year = datePart[0],
month = datePart[1],
day = datePart[2];
return day + '-' + month + '-' + year;
}
var xaxis_bp = [];
var dbpData = [];
var sbpData = [];
for (let i = 0; i < date.length; i++) {
if (sbp[i] || dbp[i]) {
xaxis_bp.push(formatDateBP(date[i]));
dbpData.push(dbp[i] ? dbp[i] : 0);
sbpData.push(sbp[i] ? sbp[i] : 0);
}
}
var myChart_bp = new Chart(ctx_bp, {
type: 'line',
options: {
title: {
display: true,
text: "BP Graph"
},
legend: {
position: "bottom"
},
scales: {
yAxes: [{
ticks: {
precision: 0
}
}]
}
},
data: {
labels: xaxis_bp,
datasets: [{
data: dbpData,
label: "DBP",
borderColor: "#d45087",
backgroundColor: "#d45087",
fill: false,
pointBackgroundColor: function(context) {
var index = context.dataIndex;
var value = context.dataset.data[index];
return value < 85 ? 'red' : index % 2 ? 'blue' : 'green';
}
}, {
data: sbpData,
label: "SBP",
borderColor: "#ff7c43",
backgroundColor: "#ffa500",
fill: false,
pointBackgroundColor: function(context) {
var index = context.dataIndex;
var value = context.dataset.data[index];
return value < 124 ? 'red' : index % 2 ? 'blue' : 'green';
}
}]
},
});
//--------------- bs chart-------------//
function formatDateBS(input) {
var datePart = input.match(/\d+/g),
year = datePart[0],
month = datePart[1],
day = datePart[2];
return day + '-' + month + '-' + year;
}
var xaxis_bs = [];
var ppbsData = [];
var fbsData = [];
var rbsData = [];
for (let i = 0; i < date.length; i++) {
if (ppbs[i] || fbs[i] || rbs[i]) {
xaxis_bs.push(formatDateBS(date[i]));
ppbsData.push(ppbs[i] ? ppbs[i] : 0);
fbsData.push(fbs[i] ? fbs[i] : 0);
rbsData.push(rbs[i] ? rbs[i] : 0);
}
}
var myChart_bs = new Chart(ctx_bs, {
type: 'line',
options: {
title: {
display: true,
text: "BS Graph"
},
legend: {
position: "bottom"
},
scales: {
yAxes: [{
ticks: {
precision: 0
}
}]
}
},
data: {
labels: xaxis_bs,
datasets: [{
data: ppbsData,
label: "PPBS",
borderColor: "#3e95cd",
backgroundColor: "#7bb6dd",
fill: false,
pointBackgroundColor: function(context) {
var index = context.dataIndex;
var value = context.dataset.data[index];
return value < 140 ? 'red' : // draw negative values in red
index % 2 ? 'blue' :
// else, alternate values in blue and green
'green';
}
}, {
data: fbsData,
label: "FBS",
borderColor: "#d45087",
backgroundColor: "#d45087",
fill: false,
pointBackgroundColor: function(context) {
var index = context.dataIndex;
var value = context.dataset.data[index];
return value < 124 ? 'red' : // draw negative values in red
index % 2 ? 'blue' :
// else, alternate values in blue and green
'green';
}
}, {
data: rbsData,
label: "RBS",
borderColor: "#ff7c43",
backgroundColor: "#ffa500",
fill: false,
pointBackgroundColor: function(context) {
var index = context.dataIndex;
var value = context.dataset.data[index];
return value < 124 ? 'red' : // draw negative values in red
index % 2 ? 'blue' :
// else, alternate values in blue and green
'green';
}
}]
},
});
console.log(health_index[0]['score']);
var xaxis_hi = [];
var hiData = [];
for (let i = 0; i < health_index.length; i++) {
if (health_index[i]) {
xaxis_hi.push(health_index[i]['date']);
hiData.push(health_index[i]['score'] ? health_index[i]['score'] : 0);
}
console.log(health_index[i]['score'] + " SCORE");
}
var myChart_hi = new Chart(ctx_hi, {
type: 'line',
options: {
title: {
display: true,
text: "Health Index"
},
legend: {
position: "bottom"
},
scales: {
yAxes: [{
ticks: {
precision: 0
}
}]
}
},
data: {
labels: xaxis_hi,
datasets: [{
data: hiData,
label: "HEALTH INDEX",
borderColor: "#3e95cd",
backgroundColor: "#7bb6dd",
fill: false,
}, ]
},
});
},
error: function(data) {
BootstrapDialog.alert('Error Populating Reports Details');
return;
}
});
}
function getParameterData() {
let parameters = ($("#health_parameter").val());
var startDate = $("#startDate").val();
var endDate = $("#endDate").val();
// alert(endDate);
// document.querySelector("#collapse_").innerHTML = '<canvas id="chart_monthly_training"></canvas>';
$.ajax({
type: 'post',
url: 'chart_parametres_data_for dashboard.php',
data: {
emp_id: <?= $id ?>,
parameters: parameters,
startDate: startDate,
endDate: endDate,
},
dataType: 'json',
success: function(data) {
console.log(data);
let content = '';
for (var i = 0; i < parameters.length; i++) {
var key_param_name = data['key_param_name'][parameters[i]];
content += ` <div class="container-fluid col-sm-6" >
<div class="row" id='` + data['key_param_name'][parameters[i]] + `'>
<p class="alert center" style="border-radius: 2%;background-color:#379683; color:#fff;margin-right:10px"><i
class="ace-icon fa fa-star orange card"></i> &nbsp;` + key_param_name + ` &nbsp;&nbsp;&nbsp;&nbsp;<i class="fa fa-print" aria-hidden="true" onclick="printDiv('` + data['key_param_name'][parameters[i]] + `');"></i></p>
<div class="space space-4"></div>
<div class=" wizard-card container-fluid card" style="padding-left: 20px;margin-right:10px">
<canvas id="parameter_data` + i + `"></canvas>
</div>
</div>
<hr>
</div>
`;
// end content
}
$("#parameter_charts").html(content);
for (var i = 0; i < parameters.length; i++) {
let key_param_name = parameters[i];
console.log(data['checkup_parameter'][+key_param_name][0]);
var id = 'parameter_data' + i;
var ctx = document.getElementById(id).getContext('2d');
var chartData = data['checkup_parameter'][+key_param_name][1];
var xaxis = data['checkup_parameter'][+key_param_name][0];
var colors = [];
for (var c = 0; c < chartData.length; c++) {
colors.push("#" + Math.floor(Math.random() * 16777215).toString(16));
}
var dataset = [];
dataset.push({
label: data['key_param_name'][parameters[i]],
data: chartData,
borderColor: colors,
backgroundColor: colors,
fill: false,
});
var Cdata = {
labels: xaxis,
datasets: dataset
}
var myChart = new Chart(ctx, {
type: $("#choose_chart").val(),
data: Cdata,
options: {
legend: {
display: false
},
scales: {
yAxes: [{
ticks: {
beginAtZero: true
}
}]
}
}
});
}
},
error: function(date) {
}
})
}
function open_chronic(id, access) {
if (access == 'V') {
$("#save_button").hide()
} else if (access == 'E')
$("#save_button").show()
$.ajax({
url: 'select_chronic_illness.php',
data: {
id: id
},
type: 'POST',
dataType: 'json',
success: function(data) {
console.log(data.diseases);
$("#id").val(data.prescription_id);
$("#patient_name").val(data.patient_name);
$("#patient_id").val(data.emp_id);
$("#abnormality_id").val(data.diseases);
$("#abnormality_id").trigger('chosen:updated');
$("#diag_date").val(data.diagnosis_date);
$("#id_first").val(data.id_first);
$("#medicine_name0").val(data.medicine_name);
$("#other_med0").val(data.other_med);
$("#remark").val(data.remark);
$("#medicine_frequency0").val(data.medicine_frequency);
$("#medicine_timing0").val(data.medicine_timing);
$("#admin_route0").val(data.admin_route);
$("#duration0").val(data.duration);
$("#dose_qty0").val(data.dose_qty);
var health_advice = data.health_advices;
dataarray = health_advice.split(",");
$("#health_advice_name_new0").val(dataarray);
$("#health_advice_name_new0").trigger('chosen:updated');
document.getElementById('addrow').disabled = 'true';
$("#remission_date").val(data.remission_date);
$(".select2").select2();
$('#modal-add-chronic-illness').modal("show");
},
error: function(data) {
BootstrapDialog.alert('Error Populating chronic_illness');
return;
}
});
}
function delete_ambulance(id) {
$.ajax({
url: 'delete_chronic_illness.php',
data: {
id: id
},
type: 'POST',
dataType: 'json',
success: function(data) {
if (data == 'SUCCESS') {
BootstrapDialog.alert('Deleted Prescription Successfully');
location.reload();
return;
}
},
error: function(data) {
BootstrapDialog.alert('Error deleting Ambulance');
return;
}
});
}
function add_drug_allergy() {
$('#patient_id_drug').val('<?= $id ?>');
$('#modal-add-drug-allergy').modal('show');
$(document).ready(function() {
let drugs = '<?= getDrugAllergyDataIds($id); ?>';
// console.log("drugs ", drugs);
if (drugs != null && drugs != '') {
drugs = drugs.split(",");
$("#drug_allergy_new_id").val(drugs);
$('#drug_allergy_new_id').trigger('chosen:updated');
}
});
}
function delete_drug_allergy() {
$('#patient_id_drug').val('<?= $id ?>');
BootstrapDialog.confirm('Hi, are you sure?', function(result) {
if (result) {
$.ajax({
type: 'post',
url: 'delete_drug_allergy.php',
data: {
emp_id: $('#patient_id_drug').val()
},
success: function(data) {
BootstrapDialog.alert("Deleted Successfully");
setTimeout(() => {
location.reload();
}, 1000);
},
error: function(data) {
BootstrapDialog.alert("Error In Deleting Drug Allergy");
}
})
} else {
}
});
}
function add_habit() {
$('#patient_id_habit').val('<?= $id ?>');
$('#modal-add-habit').modal('show');
$(document).ready(function() {
let habits = '<?= getHabitDataIds($id); ?>';
// console.log("habits ", habits);
if (habits != null && habits != '') {
habits = habits.split(",");
$("#habits_new_id").val(habits);
$('#habits_new_id').trigger('chosen:updated');
}
});
}
function delete_habit() {
$('#patient_id_habit').val('<?= $id ?>');
BootstrapDialog.confirm('Hi, are you sure?', function(result) {
if (result) {
$.ajax({
type: 'post',
url: 'delete_habit_data.php',
data: {
emp_id: $('#patient_id_habit').val()
},
success: function(data) {
BootstrapDialog.alert("Deleted Successfully");
setTimeout(() => {
location.reload();
}, 1000);
},
error: function(data) {
BootstrapDialog.alert("Error In Deleting Drug Allergy");
}
});
} else {
}
});
}
function add_cronic(id) {
$('#patient_id').val(id);
$('#modal-add-chronic-illness').modal('show');
}
function save_chronic() {
$.ajax({
url: 'save_chronic_illness_list.php ',
type: "POST",
data: $("#task_form_data").serialize(),
success: function(data) {
// alert(data);
BootstrapDialog.alert('Prescription Saved Successfully.');
$("#flex1").flexReload();
setTimeout(function() {
window.location.reload(1);
}, 2000);
return;
},
error: function(data) {
BootstrapDialog.alert('Error Saving Prescription');
return;
}
});
$('.close').click();
// location.href="procurement_list.php";
}
<?php } ?>
window.onload = getShowingData();
</script>