206 lines
5.8 KiB
PHP
206 lines
5.8 KiB
PHP
<?php
|
|
|
|
$opd=array();
|
|
$xaxis = array();
|
|
$opd2=array();
|
|
$xaxis2 = array();
|
|
$opd3=array();
|
|
$xaxis3 = array();
|
|
|
|
$year = date("Y");
|
|
for($i=1;$i<=15;$i++){
|
|
$query="SELECT COUNT(appointment_id) as count,date(NOW()-INTERVAL ($i*7) DAY) as date FROM employee_appointment WHERE DATE(appointment_date) BETWEEN date(NOW()-INTERVAL ($i*7) DAY) and date(NOW()-INTERVAL (($i-1)*7) DAY) AND APPOINTMENT_TYPE='O'";
|
|
|
|
if (!$result = @mysqli_query($conn,$query)) {
|
|
exit(mysqli_error($conn));
|
|
}
|
|
if(mysqli_num_rows($result) > 0) {
|
|
while ($row = @mysqli_fetch_array($result)) {
|
|
array_push($xaxis,date('d-m-Y',strtotime($row['date'])));
|
|
array_push($opd,$row['count']);
|
|
error_log('yy'.$row['date'].'ccc'.$row['count']) ;
|
|
}
|
|
}
|
|
|
|
|
|
$query2="SELECT COUNT(appointment_id) as count,date(NOW()-INTERVAL ($i*7) DAY) as date FROM employee_appointment WHERE DATE(appointment_date) BETWEEN date(NOW()-INTERVAL ($i*7) DAY) and date(NOW()-INTERVAL (($i-1)*7) DAY) AND APPOINTMENT_TYPE='O'and ailment_systems_new='1'";
|
|
error_log('yy'.$query2) ;
|
|
if (!$result2 = @mysqli_query($conn,$query2)) {
|
|
exit(mysqli_error($conn));
|
|
}
|
|
if(mysqli_num_rows($result2) > 0) {
|
|
while ($row2 = @mysqli_fetch_array($result2)) {
|
|
array_push($xaxis2,date('d-m-Y',strtotime($row2['date'])));
|
|
array_push($opd2,$row2['count']);
|
|
}
|
|
}
|
|
$query3="SELECT COUNT(e.appointment_id) as count,date(NOW()-INTERVAL ($i*7) DAY) as date FROM employee_appointment e left join patient_master p on e.emp_id=p.id WHERE DATE(e.appointment_date) BETWEEN date(NOW()-INTERVAL ($i*7) DAY) and date(NOW()-INTERVAL (($i-1)*7) DAY) AND e.APPOINTMENT_TYPE='O'and p.designation_id='38'";
|
|
error_log('yy'.$query3) ;
|
|
if (!$result3 = @mysqli_query($conn,$query3)) {
|
|
exit(mysqli_error($conn));
|
|
}
|
|
if(mysqli_num_rows($result3) > 0) {
|
|
while ($row3 = @mysqli_fetch_array($result3)) {
|
|
array_push($xaxis3,date('d-m-Y',strtotime($row3['date'])));
|
|
array_push($opd3,$row3['count']);
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
|
|
?>
|
|
|
|
|
|
<script>
|
|
var ctx = document.getElementById('patient_week').getContext('2d');
|
|
var opd = [<?php echo join(',',$opd); ?>];
|
|
var xaxis = [<?php echo json_encode($xaxis); ?>];
|
|
|
|
function formatDate(input) {
|
|
var datePart = input.match(/\d+/g),
|
|
year = datePart[0],
|
|
month = datePart[1],
|
|
day = datePart[2];
|
|
return day + '-' + month + '-' + year;
|
|
}
|
|
for (let i = 0; i < xaxis.length; i++) {
|
|
xaxis[0][i] = formatDate(xaxis[0][i]);
|
|
}
|
|
|
|
var myChart = new Chart(ctx, {
|
|
type: 'line',
|
|
options: {
|
|
title: {
|
|
display: true,
|
|
text: "week Wise No. of OPD Patients"
|
|
},
|
|
legend: {
|
|
position: "bottom"
|
|
},
|
|
scales: {
|
|
yAxes: [{
|
|
ticks: {
|
|
precision: 0
|
|
}
|
|
}]
|
|
}
|
|
},
|
|
data: {
|
|
labels: xaxis[0],
|
|
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';
|
|
}
|
|
|
|
}]
|
|
},
|
|
});
|
|
|
|
var ctx2 = document.getElementById('patient_week2').getContext('2d');
|
|
var opd2 = [<?php echo join(',',$opd2); ?>];
|
|
var xaxis2 = [<?php echo json_encode($xaxis2); ?>];
|
|
|
|
for (let i = 0; i < xaxis2.length; i++) {
|
|
xaxis2[0][i] = formatDate(xaxis2[0][i]);
|
|
}
|
|
|
|
var myChart2 = new Chart(ctx2, {
|
|
type: 'line',
|
|
options: {
|
|
title: {
|
|
display: true,
|
|
text: "week Wise No. of OPD Patients"
|
|
},
|
|
legend: {
|
|
position: "bottom"
|
|
},
|
|
scales: {
|
|
yAxes: [{
|
|
ticks: {
|
|
precision: 0
|
|
}
|
|
}]
|
|
}
|
|
},
|
|
data: {
|
|
labels: xaxis2[0],
|
|
datasets: [{
|
|
data: opd2,
|
|
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';
|
|
}
|
|
|
|
}]
|
|
},
|
|
});
|
|
|
|
|
|
///desig\\
|
|
|
|
var ctx3 = document.getElementById('patient_week3').getContext('2d');
|
|
var opd3 = [<?php echo join(',',$opd3); ?>];
|
|
var xaxis3 = [<?php echo json_encode($xaxis3); ?>];
|
|
|
|
for (let i = 0; i < xaxis3.length; i++) {
|
|
xaxis3[0][i] = formatDate(xaxis3[0][i]);
|
|
}
|
|
|
|
var myChart3 = new Chart(ctx3, {
|
|
type: 'line',
|
|
options: {
|
|
title: {
|
|
display: true,
|
|
text: "week Wise No. of OPD Patients"
|
|
},
|
|
legend: {
|
|
position: "bottom"
|
|
},
|
|
scales: {
|
|
yAxes: [{
|
|
ticks: {
|
|
precision: 0
|
|
}
|
|
}]
|
|
}
|
|
},
|
|
data: {
|
|
labels: xaxis3[0],
|
|
datasets: [{
|
|
data: opd3,
|
|
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';
|
|
}
|
|
|
|
}]
|
|
},
|
|
});
|
|
</script>
|