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

1217 lines
33 KiB
PHP

<div class="row">
<?php
if(isset($_POST['flex_opd_id']))
$id = $_POST['flex_opd_id'];
if ($_SESSION['RoleId'] == 7) {
$id = $_SESSION['logged_user_empid'];
}
$sql = "select * from guest_patient where id = '" . $id . "' ";
//echo $sql;
$result = mysqli_query($conn,$sql);
$row = mysqli_fetch_array($result);
$sql2 = "select * from health_advice";
$result2 = mysqli_query($conn,$sql2);
$row2 = mysqli_fetch_array($result2);
$sql3 = "select * from health_risk";
$result3 = mysqli_query($conn,$sql3);
$row3 = mysqli_fetch_array($result3);
?>
<div class="col-xs-12">
<div class="col-xs-12 col-sm-3 center">
<div>
<span class="profile-picture">
<?php if(isset($row['photo']) && $row['photo']!=null){?>
<img id="avatar" class="editable img-responsive"
alt="<?php echo $row['fname']?>'s Avatar"<img
src="data:<?php echo $row['image_type']?>;base64,<?php echo base64_encode( $row['photo'] )?>"
style="display: block; width: 150px; height: 150px;" />
<?php
} else {
$gender = $row['gender'];
if ($gender == 'M') {
?>
<img id="avatar" class="editable img-responsive"
alt="<?php echo $row['fname']?>'s Avatar"<img 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"<img
src="images/female-profile.png"
style="display: block; width: 150px; height: 150px;" />
<?php }}?>
</span>
<div class="width-80 label label-warnining label-xlg">
<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['fname']." ".$row['lname']?></span>
</a>
</div>
</div>
</div>
</div>
<div class="col-xs-12 col-sm-9 center">
<div class="row">
<p class="alert alert-info ">Guest 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"> <span
class="line-height-1 smaller-130 blue">7.5</span> <br /> <span
class="line-height-1 smaller-60">Health Score </span>
</span> <span class="btn btn-app btn-sm btn-light no-hover"> <span
class="line-height-1 smaller-130">42% </span> <br /> <span
class="line-height-1 smaller-60">Trainings Complete </span>
</span> <span class="btn btn-app btn-sm btn-grey no-hover"> <span
class="line-height-1 smaller-130">24.1 </span> <br /> <span
class="line-height-1 smaller-60"> BMI Ht:170cm Wt:69Kg </span>
</span> <span class="btn btn-app btn-sm btn-inverse no-hover"> <span
class="line-height-1 smaller-130">150/96 </span> <br /> <span
class="line-height-1 smaller-60">Blood Pressure </span>
</span> <span class="btn btn-app btn-sm btn-success no-hover"> <span
class="line-height-1 smaller-130">106 </span> <br /> <span
class="line-height-1 smaller-60">Blood Sugar </span>
</span> <span class="btn btn-app btn-sm btn-primary no-hover"> <span
class="line-height-1 smaller-130">12g/dl </span> <br /> <span
class="line-height-1 smaller-60">Haemoglobin </span>
</span>
</div>
</div>
<div class="space space-4"></div>
</div>
</div>
</div>
<div class="row">
<div class="col-xs-12" style="margin-top: 10px">
<div class="col-xs-12 col-sm-6 center">
<div class="profile-user-info profile-user-info-striped">
<div class="profile-info-row">
<div class="profile-info-name">Guest Name</div>
<div class="profile-info-value">
<span><?php echo ($row['fname'].' '.$row['lname']);?></span>
</div>
</div>
<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>
<div class="profile-info-row">
<div class="profile-info-name">Associated Employee</div>
<div class="profile-info-value">
<span><?php echo getTableFieldValue('employee',"concat(fname,' ',lname)",'id',$row['associated_emp_id'])?></span>
</div>
</div>
<div class="profile-info-row">
<div class="profile-info-name">Employee Relation Type</div>
<div class="profile-info-value">
<span><?php echo $row['emp_relationship_type']?></span>
</div>
</div>
<div class="profile-info-row">
<div class="profile-info-name">Age</div>
<div class="profile-info-value">
<span><?php echo $row['age'];?></span>
</div>
</div>
<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>
<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>
<div class="profile-info-row">
<div class="profile-info-name">Address</div>
<div class="profile-info-value">
<span><?php echo $row['address']?></span>
</div>
</div>
</div>
</div>
<div class="col-xs-12 col-sm-6 center">
<div id="accordion" class="accordion-style1 panel-group">
<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="http://ace.jeka.by/elements.html#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>
<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 * from guest_appointment where guest_id = '" . $id . "' and appointment_type='O' order by appointment_date desc limit 1";
if (! $result_opd = @mysqli_query($conn,$sql_opd)) {
exit(mysqli_error($conn));
}
if (mysqli_num_rows($result_opd) > 0) {
if ($row_opd = mysqli_fetch_assoc($result_opd)) {
?>
<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">Diagnosis:</div>
<div class="profile-info-value"><?php echo getCommaSeperatedValuesForInClause("select ailment_name from ailment ", "ailment_id", $row_opd['ailment_ids'])?></div>
</div>
<div class="profile-info-row">
<div class="profile-info-name">Treatment:</div>
<div class="profile-info-value"><?php echo getTreatmentTextForGuest($row_opd['appointment_id'])?></div>
</div>
<?php }else{?>
<?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="http://ace.jeka.by/elements.html#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 * from guest_appointment where guest_id = '" . $id . "' and appointment_type='I' order by appointment_date desc limit 1";
if (! $result_injury = @mysqli_query($conn,$sql_injury)) {
exit(mysqli_error($conn));
}
if (mysqli_num_rows($result_injury) > 0) {
if ($row_injury = mysqli_fetch_assoc($result_injury)) {
?>
<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">Diagnosis:</div>
<div class="profile-info-value"><?php echo getCommaSeperatedValuesForInClause("select injury_type_name from injury_type", "injury_type_id", $row_injury['injury_types'])?></div>
</div>
<div class="profile-info-row">
<div class="profile-info-name">Treatment:</div>
<div class="profile-info-value"><?php echo getTreatmentTextForGuest($row_injury['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">
<h4 class="panel-title" style="text-align: left">
<a class="accordion-toggle collapsed" data-toggle="collapse"
data-parent="#accordion"
href="http://ace.jeka.by/elements.html#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 guest_appointment where guest_id = '" . $id . "' and isEmergency='1' order by appointment_date desc limit 1";
if (! $result_emergency = @mysqli_query($conn,$sql_emergency)) {
exit(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'];
if ($appointment_type == 'O') {
$diagnosis = getCommaSeperatedValuesForInClause("select ailment_name from ailment ", "ailment_id", $row_emergency['ailment_ids']);
} else if ($appointment_type == 'I') {
$diagnosis = getCommaSeperatedValuesForInClause("select injury_type_name from injury_type", "injury_type_id", $row_emergency['injury_types']);
}
?>
<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 getTreatmentTextForGuest($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="http://ace.jeka.by/elements.html#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 guest_checkup_form where guest_id = '" . $id . "' order by checkup_date desc limit 1";
if (! $result_checkup = @mysqli_query($conn,$sql_checkup)) {
exit(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['checkup_date']),"d-M-Y H:i A")?></div>
</div>
<div class="profile-info-row">
<div class="profile-info-name">Abnormal Findings:</div>
<div class="profile-info-value">None</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="http://ace.jeka.by/elements.html#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
if (mysqli_num_rows($result_checkup) > 0) {
?>
<div class="profile-info-row">
<div class="profile-info-value">
<?php echo getCommaSeperatedValuesForInClause("select health_advice_name from health_advice ", "health_advice_id", $row_checkup['health_advice_id']);?></div>
</div>
<?php
} else {
?>
<div
class="profile-info-value">No Record found</div>
<?php }?>
</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="http://ace.jeka.by/elements.html#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 (mysqli_num_rows($result_checkup) > 0) {
?>
<div class="profile-info-row">
<div class="profile-info-value"><?php echo getCommaSeperatedValuesForInClause("select health_risk_name from health_risk ", "health_risk_id", $row_checkup['health_risk_id']);?></div>
</div>
<?php
} else {
?>
No Record found
<?php }?>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<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> Blood Pressure Tracker
</h4>
<div class="widget-body">
<div class="widget-main no-padding">
<div id="canvas-holder1" 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="chart"
style="display: block; width: 1013px; height: 506px;"
width="1013" height="506" class="chartjs-render-monitor"></canvas>
<div id="chartjs-tooltip" class="center"
style="opacity: 0; left: 527.674px; top: 88.722px; font-family: &amp; amp; quot; Helvetica Neue&amp;amp; quot; , Helvetica , Arial, sans-serif; font-size: 12px; font-style: normal; padding: 6px;">
<table>
<thead>
<tr>
<th>April</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="chartjs-tooltip-key"
style="background: rgb(255, 61, 103); border-color: rgb(255, 61, 103); border-width: 2px"></span>My
First dataset: 93</td>
</tr>
<tr>
<td><span class="chartjs-tooltip-key"
style="background: rgb(5, 155, 255); border-color: rgb(5, 155, 255); border-width: 2px"></span>My
Second dataset: 2</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<!-- /.widget-main -->
</div>
<!-- /.widget-body -->
</div>
<!-- /.widget-box -->
</div>
<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> Guest Weight
Tracker
</h4>
<div class="widget-body">
<div class="widget-main no-padding">
<div id="canvas-holder2" 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="chart1"
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>
</div>
<!-- PAGE CONTENT ENDS -->
</div>
<div class="row">
<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> Health Index Tracker
</h4>
<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: 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>
<!-- /.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> Guest Hemoglobin
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>
<script async="" src="./js/analytics.js"></script>
<script src="./js/Chart.min.js"></script>
<script src="./js/utils.js"></script>
<script>
var guest_id="<?php echo $id?>"
//alert(emp_id);
var health_index_array=[];
var health_index_labels=[];
var hemoglobin_values=[];
var hemoglobin_labels=[];
$(document).ready(function() {
$.ajax({
type:'get',
url:'select_guest_sbp.php',
data:{'guest_id':guest_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_guest_dbp.php',
data:{'guest_id':guest_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_guest_pulse.php',
data:{'guest_id':guest_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){
}
});
$.ajax({
type:'POST',
url:'select_guest_health_index.php',
data:{'guest_id':guest_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_guest_hb.php',
data:{'guest_id':guest_id},
dataType:'json',
async:false,
success:function(data){
for(var i=0;i<data.length;i++){
//myDbp.push(data[i].dbp);
hemoglobin_values.push(data[i].checkup_form_value);
hemoglobin_labels.push(data[i].checkup_date);
}
},
error:function(data){
}
});
var data = {
labels: hemoglobin_labels,
datasets: [
{
label: "Hemoglobin",
data:hemoglobin_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: 'Hemoglobin History'
},
tooltips: {
callbacks: {
label: function(tooltipItems, data) {
return data.datasets[tooltipItems.datasetIndex].label +':' + tooltipItems.yLabel + ' g/dl';
}
},
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 +' g/dl';
}
}
}]
}
}
});
var emp_weight_array=[];
var emp_weight_labels=[];
$.ajax({
type:'POST',
url:'select_guest_weight.php',
data:{'guest_id':guest_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';
}
}
}]
}
}
});
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 myData=[];
var mylabels=[];
var myDbp=[];
var heartRate=[];
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');
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();
});
});
</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;
}
.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>