-
Notifications
You must be signed in to change notification settings - Fork 11
/
statistik.php
executable file
·237 lines (224 loc) · 8.88 KB
/
statistik.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
<?php include_once ('layout/header.php'); ?>
<?php
if(isset($_GET['tahun'])) { $tahun = $_GET['tahun']; } else { $tahun = date("Y"); };
if(isset($_GET['bulan'])) { $bulan = $_GET['bulan']; } else { $bulan = date("m"); };
?>
<section class="content">
<div class="container-fluid">
<div class="block-header">
<h2>STATISTIK DOKTER <?php echo "Periode ".$bulan." - ".$tahun; ?></h2>
</div>
<!-- CPU Usage -->
<div class="row clearfix">
<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
<div class="card">
<div class="header">
<div class="row clearfix">
<div class="col-xs-12 col-sm-6">
<h2>10 PENYAKIT TERBANYAK</h2>
</div>
</div>
</div>
<div class="body">
<?php $dates = 'Tanggal : '.date("d-m-Y "); ?>
<?php
$jumlah=array();
$penyakit=array();
$kd_penyakit=array();
$date = $tahun."-".$bulan;
$sql = "SELECT c.nm_penyakit, a.kd_penyakit, count(a.kd_penyakit) AS jumlah, d.nm_poli
FROM diagnosa_pasien a, reg_periksa b, penyakit c, poliklinik d
WHERE b.tgl_registrasi LIKE '%$date%'
AND a.no_rawat = b.no_rawat
AND a.kd_penyakit = c.kd_penyakit
AND b.kd_poli = '{$_SESSION['jenis_poli']}'
AND b.kd_poli = d.kd_poli
AND a.status = 'Ralan'
GROUP BY a.kd_penyakit
ORDER BY jumlah DESC
LIMIT 10";
$hasil=query($sql);
while ($data = fetch_array ($hasil)){
$jumlah[]=intval($data['jumlah']);
$penyakit[]=$data['nm_penyakit'];
$kd_penyakit[]=$data['kd_penyakit'];
}
?>
<div id="10penyakit">
</div>
</div>
</div>
</div>
</div>
<!-- #END# CPU Usage -->
<div class="row clearfix">
<!-- Line Chart -->
<div class="col-lg-6 col-md-6 col-sm-12 col-xs-12">
<div class="card">
<div class="header">
<h2>STATUS PENYAKIT</h2>
</div>
<div class="body">
<div id="line_chart" class="graph"></div>
</div>
</div>
</div>
<!-- #END# Line Chart -->
<!-- Donut Chart -->
<div class="col-lg-6 col-md-6 col-sm-12 col-xs-12">
<div class="card">
<div class="header">
<h2>STATUS RAWAT</h2>
</div>
<div class="body">
<div id="donut_chart" class="graph"></div>
</div>
</div>
</div>
<!-- #END# Donut Chart -->
</div>
<div class="row clearfix">
<!-- Line Chart -->
<form method="get" action="">
<div class="col-lg-4">
<select name="bulan" class="form-control">
<option value="01">Januari</option>
<option value="02">Pebruari</option>
<option value="03">Maret</option>
<option value="04">April</option>
<option value="05">Mei</option>
<option value="06">Juni</option>
<option value="07">Juli</option>
<option value="08">Agustus</option>
<option value="09">September</option>
<option value="10">Oktober</option>
<option value="11">November</option>
<option value="12">Desember</option>
</select>
</div>
<div class="col-lg-4">
<select name="tahun" class="form-control">
<option value="2016">2016</option>
<option value="2017">2017</option>
<option value="2018">2018</option>
<option value="2019" selected>2019</option>
</select>
</div>
<div class="col-lg-4">
<input type="submit" class="btn bg-blue btn-block btn-lg waves-effect" value="Submit">
</div>
</form>
</div>
<div class="row clearfix">
<br><br>
</div>
</div>
</section>
<?php include_once ('layout/footer.php'); ?>
<!-- Morris Plugin Js -->
<script src="<?php echo URL; ?>/plugins/raphael/raphael.min.js"></script>
<script src="<?php echo URL; ?>/plugins/morrisjs/morris.js"></script>
<script type="text/javascript">
Highcharts.chart('10penyakit', {
chart: {
type: 'column'
},
exporting: {
enabled: false
},
title: {
text: 'Grafik Penyakit <?php echo ucwords(strtolower($nmpoli)); ?>'
},
subtitle: {
text: <?=json_encode($dates);?>
},
xAxis: {
categories: <?=json_encode($penyakit);?> ,
title: {
enabled: false
}
},
yAxis: {
title: {
text: 'Jumlah Pasien'
},
labels: {
formatter: function () {
return this.value;
}
}
},
tooltip: {
split: true,
valueSuffix: ''
},
plotOptions: {
area: {
stacking: 'normal',
lineColor: '#666666',
lineWidth: 1,
marker: {
lineWidth: 1,
lineColor: '#666666'
}
}
},
series: [{
name: 'Jumlah Kejadian',
data: <?=json_encode($jumlah);?>
}]
});
</script>
<?php
$date = $tahun."-".$bulan;
$_tgl_registrasi = "SELECT tgl_registrasi AS tanggal FROM reg_periksa WHERE tgl_registrasi LIKE '%$date%' AND kd_poli = '{$_SESSION['jenis_poli']}' GROUP BY tgl_registrasi";
$hasil = query($_tgl_registrasi);
?>
<script type="text/javascript">
$(function () {
getMorris('line', 'line_chart');
getMorris('donut', 'donut_chart');
});
function getMorris(type, element) {
if (type === 'line') {
Morris.Line({
element: element,
data: [
<?php while($data = fetch_array($hasil)){ ?>
{
tanggal: '<?php echo $data['tanggal']; ?>',
baru: '<?php echo num_rows(query("SELECT status_poli AS baru FROM reg_periksa WHERE status_poli = 'Baru' AND tgl_registrasi = '{$data['tanggal']}' AND kd_poli = '{$_SESSION['jenis_poli']}'"));?>',
lama: '<?php echo num_rows(query("SELECT status_poli AS lama FROM reg_periksa WHERE status_poli = 'Lama' AND tgl_registrasi = '{$data['tanggal']}' AND kd_poli = '{$_SESSION['jenis_poli']}'"));?>'
},
<?php } ?>
],
xkey: 'tanggal',
ykeys: ['baru', 'lama'],
labels: ['Baru', 'Lama'],
lineColors: ['rgb(233, 30, 99)', 'rgb(0, 188, 212)'],
lineWidth: 3
});
} else if (type === 'donut') {
Morris.Donut({
element: element,
data: [{
label: 'Sudah',
value: <?php echo num_rows(query("SELECT no_rawat FROM reg_periksa WHERE tgl_registrasi LIKE '%$date%' AND kd_poli = '{$_SESSION['jenis_poli']}' AND stts = 'Sudah'"));?>
}, {
label: 'Batal',
value: <?php echo num_rows(query("SELECT no_rawat FROM reg_periksa WHERE tgl_registrasi LIKE '%$date%' AND kd_poli = '{$_SESSION['jenis_poli']}' AND stts = 'Batal'"));?>
}, {
label: 'Dirawat',
value: <?php echo num_rows(query("SELECT no_rawat FROM reg_periksa WHERE tgl_registrasi LIKE '%$date%' AND kd_poli = '{$_SESSION['jenis_poli']}' AND stts = 'Dirawat'"));?>
}, {
label: 'Belum',
value: <?php echo num_rows(query("SELECT no_rawat FROM reg_periksa WHERE tgl_registrasi LIKE '%$date%' AND kd_poli = '{$_SESSION['jenis_poli']}' AND stts = 'Dirawat'"));?>
}],
colors: ['rgb(233, 30, 99)', 'rgb(0, 188, 212)', 'rgb(255, 152, 0)', 'rgb(0, 150, 136)'],
formatter: function (y) {
return y
}
});
}
}
</script>