3076 lines
105 KiB
PHP
3076 lines
105 KiB
PHP
<?php
|
|
|
|
class Mcu_chartgenerator extends MY_Controller
|
|
{
|
|
var $url_renderer;
|
|
function __construct()
|
|
{
|
|
parent::__construct();
|
|
$this->url_renderer = "http://localhost:3030/chart";
|
|
}
|
|
|
|
function render($type, $id)
|
|
{
|
|
switch ($type) {
|
|
case "mcu001":
|
|
$this->mcu001($id);
|
|
break;
|
|
|
|
case "mcu002":
|
|
$this->mcu002($id);
|
|
break;
|
|
}
|
|
}
|
|
|
|
// mcu001 peserta mcu total
|
|
function mcu001($id)
|
|
{
|
|
|
|
// Data
|
|
$sql = "SELECT
|
|
COUNT(distinct(T_OrderHeaderID)) as peserta,
|
|
COUNT( distinct(Mcu_PreregisterPatientsM_PatientID)) as total
|
|
FROM mcu_preregister_patients
|
|
LEFT JOIN t_orderheader ON Mcu_PreregisterPatientsT_OrderHeaderID = T_OrderHeaderID AND
|
|
T_OrderHeaderIsActive = 'Y'
|
|
WHERE
|
|
Mcu_PreregisterPatientsMgm_McuID = ? AND
|
|
Mcu_PreregisterPatientsIsActive = 'Y'";
|
|
|
|
$qry = $this->db->query($sql, [$id]);
|
|
$this->check_error($qry, "get total mcu");
|
|
$rows = $qry->result_array();
|
|
if (count($rows) == 0) {
|
|
$this->chart_error("No data found");
|
|
}
|
|
$total = $rows[0]["total"];
|
|
$peserta = $rows[0]["peserta"];
|
|
$belum_mcu = $total - $peserta;
|
|
// 2. generate parameter for the chart
|
|
$param = array(
|
|
'title' => array(
|
|
'text' => 'Peserta MCU',
|
|
'subtext' => 'Total Peserta ' . $total,
|
|
'left' => 'center'
|
|
),
|
|
'tooltip' => array(
|
|
'trigger' => 'item'
|
|
),
|
|
'legend' => array(
|
|
'top' => 'bottom',
|
|
'left' => 'center',
|
|
'orient' => 'vertical'
|
|
),
|
|
'series' => array(
|
|
array(
|
|
'label' => array(
|
|
'position' => 'inner',
|
|
'formatter' => '{d}%'
|
|
),
|
|
'name' => 'Access From',
|
|
'type' => 'pie',
|
|
'radius' => array('20%', '50%'),
|
|
'itemStyle' => array(
|
|
'borderRadius' => 10,
|
|
'borderColor' => '#fff',
|
|
'borderWidth' => 2
|
|
),
|
|
'data' => array(
|
|
array("value" => $peserta, "name" => "Sudah MCU : $peserta Peserta"),
|
|
array("value" => $belum_mcu, "name" => "Belum MCU : $belum_mcu Peserta")
|
|
),
|
|
'emphasis' => array(
|
|
'itemStyle' => array(
|
|
'shadowBlur' => 10,
|
|
'shadowOffsetX' => 0,
|
|
'shadowColor' => 'rgba(0, 0, 0, 0.5)'
|
|
)
|
|
)
|
|
)
|
|
)
|
|
);
|
|
// 3. encapsulate in config attribute and json encode
|
|
$config = ["config" => $param];
|
|
$j_param = json_encode($config);
|
|
header("Content-Type: image/png");
|
|
// 4. post to chart renderer
|
|
echo $this->post($this->url_renderer, $j_param);
|
|
}
|
|
|
|
// mcu002 peserta mcu berdasarkan gender
|
|
function mcu002($id)
|
|
{
|
|
|
|
// Data
|
|
$sql = "SELECT IF(M_PatientGender = 'male','Laki-laki','Perempuan') as M_PatientGender,
|
|
COUNT(T_OrderHeaderID) as Jumlah
|
|
FROM t_orderheader
|
|
LEFT JOIN m_patient ON T_OrderHeaderM_PatientID = M_PatientID AND M_PatientIsActive = 'Y'
|
|
WHERE T_OrderHeaderMgm_McuID = ? AND T_OrderHeaderIsActive = 'Y'
|
|
GROUP BY M_PatientGender";
|
|
|
|
$qry = $this->db->query($sql, [$id]);
|
|
$this->check_error($qry, "get total mcu");
|
|
$rows = $qry->result_array();
|
|
$data = [];
|
|
if (count($rows) == 0) {
|
|
// $this->chart_error("No data found");
|
|
$data = [];
|
|
}
|
|
if (count($rows) > 0) {
|
|
foreach ($rows as $key => $vx) {
|
|
$data[] = array(
|
|
"value" => $vx["Jumlah"],
|
|
"name" => $vx["M_PatientGender"] . ":" . $vx['Jumlah'] . " Peserta"
|
|
);
|
|
}
|
|
}
|
|
if (empty($data)) {
|
|
$param = [
|
|
"title" => [
|
|
"text" => "Peserta MCU",
|
|
'subtext' => 'berdasarkan jenis kelamin',
|
|
"show" => true,
|
|
'left' => 'center'
|
|
],
|
|
"graphic" => [
|
|
"elements" => [
|
|
[
|
|
"type" => "text",
|
|
"left" => "center",
|
|
"top" => "middle",
|
|
"style" => [
|
|
"text" => "Data tidak ditemukan",
|
|
"fontSize" => 18,
|
|
"color" => "#42aaf5"
|
|
]
|
|
]
|
|
]
|
|
]
|
|
];
|
|
} else {
|
|
$param = array(
|
|
'title' => array(
|
|
'text' => 'Peserta MCU',
|
|
'subtext' => 'berdasarkan jenis kelamin',
|
|
'left' => 'center'
|
|
),
|
|
'tooltip' => array(
|
|
'trigger' => 'item'
|
|
),
|
|
'legend' => array(
|
|
'top' => 'bottom',
|
|
'left' => 'center',
|
|
'orient' => 'vertical'
|
|
),
|
|
'series' => array(
|
|
array(
|
|
'label' => array(
|
|
'position' => 'inner',
|
|
'formatter' => '{d}%'
|
|
),
|
|
'name' => 'Access From',
|
|
'type' => 'pie',
|
|
'radius' => array('20%', '50%'),
|
|
'itemStyle' => array(
|
|
'borderRadius' => 10,
|
|
'borderColor' => '#fff',
|
|
'borderWidth' => 2
|
|
),
|
|
'data' => $data,
|
|
'emphasis' => array(
|
|
'itemStyle' => array(
|
|
'shadowBlur' => 10,
|
|
'shadowOffsetX' => 0,
|
|
'shadowColor' => 'rgba(0, 0, 0, 0.5)'
|
|
)
|
|
)
|
|
)
|
|
)
|
|
);}
|
|
|
|
// Encapsulate in config attribute and JSON encode
|
|
$config = ["config" => $param];
|
|
$j_param = json_encode($config);
|
|
|
|
// Set content type to image/png
|
|
header("Content-Type: image/png");
|
|
|
|
// Post to chart renderer
|
|
echo $this->post($this->url_renderer, $j_param);
|
|
}
|
|
|
|
// mcu003 Peserta mcu berdasarkan umur
|
|
function mcu003($id)
|
|
{
|
|
|
|
// Data
|
|
$sql = "SELECT
|
|
CASE
|
|
WHEN LEFT(T_OrderHeaderM_PatientAge,2) < '30' THEN '1. < 30 tahun'
|
|
WHEN LEFT(T_OrderHeaderM_PatientAge,2) >= '30' AND left(T_OrderHeaderM_PatientAge,2) < '40' THEN '2. 30 -< 40 tahun'
|
|
WHEN LEFT(T_OrderHeaderM_PatientAge,2) >= '40' AND left(T_OrderHeaderM_PatientAge,2) < '50' THEN '3. 40 - < 50 tahun'
|
|
WHEN LEFT(T_OrderHeaderM_PatientAge,2) >= '50' THEN '4. > 50 tahun' ELSE ''
|
|
END AS umur,
|
|
COUNT(T_OrderHeaderID) as total
|
|
FROM t_orderheader
|
|
LEFT JOIN m_patient ON T_OrderHeaderM_PatientID = M_PatientID AND M_PatientIsActive = 'Y'
|
|
WHERE t_orderheaderMgm_McuID = ? AND T_OrderHeaderIsActive = 'Y'
|
|
GROUP BY
|
|
CASE
|
|
WHEN LEFT(T_OrderHeaderM_PatientAge,2) < '30' THEN '1. < 30 tahun'
|
|
WHEN LEFT(T_OrderHeaderM_PatientAge,2) >= '30' AND left(T_OrderHeaderM_PatientAge,2) < '40' THEN '2. 30 -< 40 tahun'
|
|
WHEN LEFT(T_OrderHeaderM_PatientAge,2) >= '40' AND left(T_OrderHeaderM_PatientAge,2) < '50' THEN '3. 40 - < 50 tahun'
|
|
WHEN LEFT(T_OrderHeaderM_PatientAge,2) >= '50' THEN '4. > 50 tahun' ELSE ''
|
|
END
|
|
ORDER BY umur";
|
|
|
|
$qry = $this->db->query($sql, [$id]);
|
|
$this->check_error($qry, "get total mcu");
|
|
$rows = $qry->result_array();
|
|
|
|
$data = [];
|
|
if (count($rows) == 0) {
|
|
// $this->chart_error("No data found");
|
|
$data = [];
|
|
}
|
|
|
|
if (count($rows) > 0) {
|
|
foreach ($rows as $key => $vx) {
|
|
$data[] = array(
|
|
"value" => $vx["total"],
|
|
"name" => $vx["umur"] . ":" . $vx['total']
|
|
);
|
|
}
|
|
}
|
|
|
|
if (empty($data)) {
|
|
$param = [
|
|
"title" => [
|
|
"text" => "Peserta MCU",
|
|
'subtext' => 'berdasarkan umur',
|
|
"show" => true,
|
|
'left' => 'center'
|
|
],
|
|
"graphic" => [
|
|
"elements" => [
|
|
[
|
|
"type" => "text",
|
|
"left" => "center",
|
|
"top" => "middle",
|
|
"style" => [
|
|
"text" => "Data tidak ditemukan",
|
|
"fontSize" => 18,
|
|
"color" => "#42aaf5"
|
|
]
|
|
]
|
|
]
|
|
]
|
|
];
|
|
} else {
|
|
$param = array(
|
|
'title' => array(
|
|
'text' => 'Peserta MCU',
|
|
'subtext' => 'berdasarkan umur',
|
|
'left' => 'center'
|
|
),
|
|
'tooltip' => array(
|
|
'trigger' => 'item'
|
|
),
|
|
'legend' => array(
|
|
'top' => 'bottom',
|
|
'left' => 'center',
|
|
'orient' => 'vertical'
|
|
),
|
|
'series' => array(
|
|
array(
|
|
'label' => array(
|
|
'position' => 'inner',
|
|
'formatter' => '{d}%'
|
|
),
|
|
'name' => 'Access From',
|
|
'type' => 'pie',
|
|
'radius' => array('20%', '50%'),
|
|
'itemStyle' => array(
|
|
'borderRadius' => 10,
|
|
'borderColor' => '#fff',
|
|
'borderWidth' => 2
|
|
),
|
|
'data' => $data,
|
|
'emphasis' => array(
|
|
'itemStyle' => array(
|
|
'shadowBlur' => 10,
|
|
'shadowOffsetX' => 0,
|
|
'shadowColor' => 'rgba(0, 0, 0, 0.5)'
|
|
)
|
|
)
|
|
)
|
|
)
|
|
);
|
|
}
|
|
|
|
// Encapsulate in config attribute and JSON encode
|
|
$config = ["config" => $param];
|
|
$j_param = json_encode($config);
|
|
|
|
// Set content type to image/png
|
|
header("Content-Type: image/png");
|
|
|
|
// Post to chart renderer
|
|
echo $this->post($this->url_renderer, $j_param);
|
|
}
|
|
|
|
// mcu004 Kelainan Global 10 terbesar
|
|
function mcu004($id)
|
|
{
|
|
$sql = "SELECT * FROM (
|
|
SELECT Mcu_KelainanID,
|
|
Mcu_KelainanName as Test,
|
|
count(distinct T_OrderHeaderID) as Total
|
|
FROM t_kelainan_lab
|
|
JOIN t_orderheader ON T_KelainanLabT_OrderHeaderID = T_OrderHeaderID
|
|
JOIN mcu_summarylab ON T_KelainanLabMcu_SummaryLabID = Mcu_SummaryLabID
|
|
join mcu_kelainan on Mcu_summaryLabMcu_KelainanID = Mcu_KelainanID
|
|
join mcu_kelainangroup on Mcu_KelainanMcu_KelainanGroupID = Mcu_KelainanGroupID
|
|
JOIN nat_test ON Mcu_SummaryLabNat_TestID = Nat_TestID AND T_KelainanLabNat_TestID = Mcu_SummaryLabNat_TestID
|
|
where T_KelainanLabIsActive = 'Y' and T_OrderHeaderMgm_McuID = ?
|
|
group by Mcu_KelainanID
|
|
UNION
|
|
SELECT Mcu_KelainanID, Mcu_KelainanName as Test,
|
|
count(distinct T_OrderHeaderID) as Total
|
|
FROM t_kelainan_nonlab
|
|
JOIN t_orderheader ON T_KelainanNonLabT_OrderHeaderID = T_OrderHeaderID
|
|
JOIN mcu_summarynonlab ON T_KelainanNonLabMcu_SummaryNonlabID = Mcu_SummaryNonlabID
|
|
join mcu_kelainan on Mcu_SummaryNonlabMcu_KelainanID = Mcu_KelainanID
|
|
join mcu_kelainangroup on Mcu_KelainanMcu_KelainanGroupID = Mcu_KelainanGroupID
|
|
JOIN nat_test ON Mcu_SummaryNonlabNat_TestID = Nat_TestID AND
|
|
T_KelainanNonLabNat_TestID = Mcu_SummaryNonlabNat_TestID
|
|
where T_KelainanNonLabIsActive = 'Y' and T_OrderHeaderMgm_McuID = ?
|
|
group by Mcu_KelainanID
|
|
UNION
|
|
SELECT Mcu_KelainanID, Mcu_KelainanName as Test,
|
|
count(distinct T_OrderHeaderID) as Total
|
|
FROM t_kelainan_fisik
|
|
JOIN t_orderheader ON T_KelainanFiskT_OrderHeaderID = T_OrderHeaderID
|
|
JOIN mcu_summaryfisik ON T_KelainanFiskMcu_SummaryFisikID = Mcu_SummaryFisikID AND
|
|
Mcu_SummaryFisikID NOT IN (63,67,68,69,70,71,72,73)
|
|
join mcu_kelainan on Mcu_SummaryFisikMcu_KelainanID = Mcu_KelainanID
|
|
join mcu_kelainangroup on Mcu_KelainanMcu_KelainanGroupID = Mcu_KelainanGroupID
|
|
where T_KelainanFiskIsActive = 'Y' and T_OrderHeaderMgm_McuID = ? AND
|
|
Mcu_KelainanClasification NOT IN ('who','kemenkes','JNC-VIII','ESC/ESH')
|
|
group by Mcu_KelainanID
|
|
) a
|
|
|
|
ORDER BY total DESC
|
|
LIMIT 10
|
|
";
|
|
|
|
$qry = $this->db->query($sql, [$id, $id, $id]);
|
|
$this->check_error($qry, "get data global");
|
|
$rows = $qry->result_array();
|
|
|
|
$data = [
|
|
["score", "amount", "product", "percentage"]
|
|
];
|
|
if (count($rows) == 0) {
|
|
// $this->chart_error("No data found");
|
|
$data = [];
|
|
}
|
|
|
|
// Initialize the data array with headers
|
|
|
|
|
|
$sql_tot = "SELECT
|
|
COUNT(distinct(T_OrderHeaderID)) as peserta,
|
|
COUNT( distinct(Mcu_PreregisterPatientsM_PatientID)) as total
|
|
FROM mcu_preregister_patients
|
|
LEFT JOIN t_orderheader ON Mcu_PreregisterPatientsT_OrderHeaderID = T_OrderHeaderID AND
|
|
T_OrderHeaderIsActive = 'Y'
|
|
WHERE
|
|
Mcu_PreregisterPatientsMgm_McuID = ? AND
|
|
Mcu_PreregisterPatientsIsActive = 'Y'
|
|
";
|
|
$qry_tot = $this->db->query($sql_tot, [$id]);
|
|
$this->check_error($qry_tot, "get total peserta");
|
|
$rows_tot = $qry_tot->result_array();
|
|
|
|
$peserta = $rows_tot[0]['peserta'];
|
|
|
|
// Map the SQL query results to the data array
|
|
foreach ($rows as $index => $row) {
|
|
$percentage = floor(($row['Total'] / $peserta) * 100);
|
|
$data[] = [
|
|
$index + 1,
|
|
$row['Total'],
|
|
$this->splitString($row['Test']),
|
|
$percentage
|
|
];
|
|
}
|
|
|
|
if (empty($data)) {
|
|
$option = [
|
|
"title" => [
|
|
"text" => "Kelainan Global (10 Terbesar)",
|
|
"show" => true
|
|
],
|
|
"graphic" => [
|
|
"elements" => [
|
|
[
|
|
"type" => "text",
|
|
"left" => "center",
|
|
"top" => "middle",
|
|
"style" => [
|
|
"text" => "Data tidak ditemukan",
|
|
"fontSize" => 18,
|
|
"color" => "#42aaf5"
|
|
]
|
|
]
|
|
]
|
|
]
|
|
];
|
|
} else {
|
|
$option = [
|
|
"title" => [
|
|
"text" => "Kelainan Global (10 Terbesar)"
|
|
],
|
|
"dataset" => [
|
|
"source" => $data
|
|
],
|
|
"grid" => [
|
|
"containLabel" => true
|
|
],
|
|
"xAxis" => [
|
|
"name" => "peserta"
|
|
],
|
|
"yAxis" => [
|
|
"type" => "category",
|
|
"axisLabel" => [
|
|
"fontSize" => 10
|
|
]
|
|
],
|
|
"visualMap" => [
|
|
"orient" => "horizontal",
|
|
"left" => "center",
|
|
"min" => 1,
|
|
"max" => 10,
|
|
"show" => false,
|
|
"dimension" => 0,
|
|
"inRange" => [
|
|
"color" => ["#42aaf5", "#00eaf2", "#035bff"]
|
|
]
|
|
],
|
|
"series" => [
|
|
[
|
|
"label" => [
|
|
"position" => "right",
|
|
"show" => true,
|
|
"formatter" => "{@[3]} %"
|
|
],
|
|
"type" => "bar",
|
|
"encode" => [
|
|
"x" => "amount",
|
|
"y" => "product"
|
|
]
|
|
]
|
|
],
|
|
"tooltip" => [
|
|
"trigger" => "axis",
|
|
"axisPointer" => [
|
|
"type" => "shadow"
|
|
]
|
|
],
|
|
];
|
|
}
|
|
|
|
$config = ["config" => $option];
|
|
$j_param = json_encode($config);
|
|
|
|
// echo $j_param;
|
|
|
|
header("Content-Type: image/png");
|
|
// 4. post to chart renderer
|
|
echo $this->post($this->url_renderer, $j_param);
|
|
}
|
|
|
|
|
|
|
|
//mcu005 Kelainan Lab 10 terbesar
|
|
function mcu005($id)
|
|
{
|
|
$sql = "SELECT Mcu_KelainanID,
|
|
Mcu_KelainanName as Test,
|
|
count(distinct T_OrderHeaderID) as total
|
|
FROM t_kelainan_lab
|
|
JOIN t_orderheader ON T_KelainanLabT_OrderHeaderID = T_OrderHeaderID
|
|
JOIN mcu_summarylab ON T_KelainanLabMcu_SummaryLabID = Mcu_SummaryLabID
|
|
join mcu_kelainan on Mcu_summaryLabMcu_KelainanID = Mcu_KelainanID
|
|
join mcu_kelainangroup on Mcu_KelainanMcu_KelainanGroupID = Mcu_KelainanGroupID
|
|
JOIN nat_test ON Mcu_SummaryLabNat_TestID = Nat_TestID AND T_KelainanLabNat_TestID = Mcu_SummaryLabNat_TestID
|
|
where T_KelainanLabIsActive = 'Y' and T_OrderHeaderMgm_McuID = ?
|
|
group by Mcu_KelainanID
|
|
ORDER BY total DESC
|
|
LIMIT 10
|
|
";
|
|
|
|
$qry = $this->db->query($sql, [$id]);
|
|
$this->check_error($qry, "get non lab");
|
|
$rows = $qry->result_array();
|
|
|
|
// Initialize the data array with headers
|
|
$data = [
|
|
["score", "amount", "product", "percentage"]
|
|
];
|
|
if (count($rows) == 0) {
|
|
// $this->chart_error("No data found");
|
|
$data = [];
|
|
}
|
|
|
|
|
|
|
|
$sql_tot = "SELECT
|
|
COUNT(distinct(T_OrderHeaderID)) as peserta,
|
|
COUNT( distinct(Mcu_PreregisterPatientsM_PatientID)) as total
|
|
FROM mcu_preregister_patients
|
|
LEFT JOIN t_orderheader ON Mcu_PreregisterPatientsT_OrderHeaderID = T_OrderHeaderID AND
|
|
T_OrderHeaderIsActive = 'Y'
|
|
WHERE
|
|
Mcu_PreregisterPatientsMgm_McuID = ? AND
|
|
Mcu_PreregisterPatientsIsActive = 'Y'
|
|
";
|
|
$qry_tot = $this->db->query($sql_tot, [$id]);
|
|
$this->check_error($qry_tot, "get total peserta");
|
|
$rows_tot = $qry_tot->result_array();
|
|
|
|
$peserta = $rows_tot[0]['peserta'];
|
|
|
|
// Map the SQL query results to the data array
|
|
foreach ($rows as $index => $row) {
|
|
$percentage = floor(($row['total'] / $peserta) * 100);
|
|
$data[] = [
|
|
$index + 1,
|
|
$row['total'],
|
|
$this->splitString($row['Test']),
|
|
$percentage
|
|
];
|
|
}
|
|
|
|
if (empty($data)) {
|
|
$option = [
|
|
"title" => [
|
|
"text" => "Kelainan Lab (10 Terbesar)",
|
|
"show" => true
|
|
],
|
|
|
|
"graphic" => [
|
|
"elements" => [
|
|
[
|
|
"type" => "text",
|
|
"left" => "center",
|
|
"top" => "middle",
|
|
"style" => [
|
|
"text" => "Data tidak Ditemukan",
|
|
"fontSize" => 18,
|
|
"color" => "#42aaf5"
|
|
]
|
|
]
|
|
]
|
|
]
|
|
];
|
|
} else {
|
|
$option = [
|
|
"title" => [
|
|
"text" => "Kelainan Lab (10 Terbesar)"
|
|
],
|
|
"dataset" => [
|
|
"source" => $data
|
|
],
|
|
"grid" => [
|
|
"containLabel" => true
|
|
],
|
|
"xAxis" => [
|
|
"name" => "peserta"
|
|
],
|
|
"yAxis" => [
|
|
"type" => "category",
|
|
"axisLabel" => [
|
|
"fontSize" => 10
|
|
]
|
|
],
|
|
"visualMap" => [
|
|
"orient" => "horizontal",
|
|
"left" => "center",
|
|
"min" => 1,
|
|
"max" => 10,
|
|
"show" => false,
|
|
"dimension" => 0,
|
|
"inRange" => [
|
|
"color" => ["#42aaf5", "#00eaf2", "#035bff"]
|
|
]
|
|
],
|
|
"series" => [
|
|
[
|
|
"label" => [
|
|
"position" => "right",
|
|
"show" => true,
|
|
"formatter" => "{@[3]} %"
|
|
],
|
|
"type" => "bar",
|
|
"encode" => [
|
|
"x" => "amount",
|
|
"y" => "product"
|
|
]
|
|
]
|
|
],
|
|
"tooltip" => [
|
|
"trigger" => "axis",
|
|
"axisPointer" => [
|
|
"type" => "shadow"
|
|
]
|
|
],
|
|
];
|
|
}
|
|
|
|
$config = ["config" => $option];
|
|
$j_param = json_encode($config);
|
|
|
|
// echo $j_param;
|
|
|
|
header("Content-Type: image/png");
|
|
// 4. post to chart renderer
|
|
echo $this->post($this->url_renderer, $j_param);
|
|
}
|
|
|
|
//mcu006 Kelainan Hematologi
|
|
function mcu006($id)
|
|
{
|
|
$sql = "SELECT Mcu_KelainanID,
|
|
Mcu_KelainanName as Test,
|
|
count(distinct T_OrderHeaderID) as total
|
|
FROM t_kelainan_lab
|
|
JOIN t_orderheader ON T_KelainanLabT_OrderHeaderID = T_OrderHeaderID
|
|
JOIN mcu_summarylab ON T_KelainanLabMcu_SummaryLabID = Mcu_SummaryLabID
|
|
join mcu_kelainan on Mcu_summaryLabMcu_KelainanID = Mcu_KelainanID
|
|
join mcu_kelainangroup on Mcu_KelainanMcu_KelainanGroupID = Mcu_KelainanGroupID AND Mcu_KelainanGroupID = 14
|
|
JOIN nat_test ON Mcu_SummaryLabNat_TestID = Nat_TestID AND T_KelainanLabNat_TestID = Mcu_SummaryLabNat_TestID
|
|
where T_KelainanLabIsActive = 'Y' and T_OrderHeaderMgm_McuID = ?
|
|
group by Mcu_KelainanID
|
|
ORDER BY total DESC
|
|
LIMIT 10
|
|
";
|
|
|
|
$qry = $this->db->query($sql, [$id]);
|
|
$this->check_error($qry, "get data hematologi");
|
|
$rows = $qry->result_array();
|
|
|
|
$data = [
|
|
["score", "amount", "product"]
|
|
];
|
|
if (count($rows) == 0) {
|
|
// $this->chart_error("No data found");
|
|
$data = [];
|
|
}
|
|
foreach ($rows as $index => $row) {
|
|
$data[] = [
|
|
$index + 1,
|
|
$row['total'],
|
|
$this->splitString($row['Test'])
|
|
];
|
|
}
|
|
if (empty($data)) {
|
|
$option = [
|
|
"title" => [
|
|
"text" => "Hematologi",
|
|
"show" => true
|
|
],
|
|
"graphic" => [
|
|
"elements" => [
|
|
[
|
|
"type" => "text",
|
|
"left" => "center",
|
|
"top" => "middle",
|
|
"style" => [
|
|
"text" => "Data tidak ditemukan",
|
|
"fontSize" => 18,
|
|
"color" => "#42aaf5"
|
|
]
|
|
]
|
|
]
|
|
]
|
|
];
|
|
} else {
|
|
$option = [
|
|
"title" => [
|
|
"text" => "Hematologi"
|
|
],
|
|
"dataset" => [
|
|
"source" => $data
|
|
],
|
|
"grid" => [
|
|
"containLabel" => true
|
|
],
|
|
"xAxis" => [
|
|
"name" => "",
|
|
"type" => "category",
|
|
"axisLabel" => [
|
|
"interval" => 0,
|
|
"rotate" => 20
|
|
]
|
|
],
|
|
"yAxis" => [
|
|
"type" => "value",
|
|
"name" => "",
|
|
"nameTextStyle" => [
|
|
"align" => "right"
|
|
],
|
|
"nameGap" => 20
|
|
],
|
|
"visualMap" => [
|
|
"orient" => "horizontal",
|
|
"left" => "center",
|
|
"min" => 0,
|
|
"max" => count($data),
|
|
"dimension" => 0,
|
|
"show" => false,
|
|
"inRange" => [
|
|
"color" => ["#42aaf5", "#00eaf2", "#035bff"]
|
|
]
|
|
],
|
|
"series" => [
|
|
[
|
|
"label" => [
|
|
"position" => "inside",
|
|
"show" => true,
|
|
"formatter" => "{@[1]}"
|
|
],
|
|
"type" => "bar",
|
|
"encode" => [
|
|
"x" => "product",
|
|
"y" => "amount"
|
|
]
|
|
]
|
|
],
|
|
"tooltip" => [
|
|
"trigger" => "axis",
|
|
"axisPointer" => [
|
|
"type" => "shadow"
|
|
]
|
|
]
|
|
];
|
|
}
|
|
|
|
$config = ["config" => $option];
|
|
$j_param = json_encode($config);
|
|
|
|
// echo $j_param;
|
|
|
|
header("Content-Type: image/png");
|
|
// 4. post to chart renderer
|
|
echo $this->post($this->url_renderer, $j_param);
|
|
}
|
|
|
|
// mcu007 = Kelainan Urinalisa
|
|
function mcu007($id)
|
|
{
|
|
$sql = "SELECT Mcu_KelainanID,
|
|
Mcu_KelainanName as Test,
|
|
count(distinct T_OrderHeaderID) as total
|
|
FROM t_kelainan_lab
|
|
JOIN t_orderheader ON T_KelainanLabT_OrderHeaderID = T_OrderHeaderID
|
|
JOIN mcu_summarylab ON T_KelainanLabMcu_SummaryLabID = Mcu_SummaryLabID
|
|
join mcu_kelainan on Mcu_summaryLabMcu_KelainanID = Mcu_KelainanID
|
|
join mcu_kelainangroup on Mcu_KelainanMcu_KelainanGroupID = Mcu_KelainanGroupID
|
|
AND Mcu_KelainanGroupID = 15
|
|
JOIN nat_test ON Mcu_SummaryLabNat_TestID = Nat_TestID
|
|
AND T_KelainanLabNat_TestID = Mcu_SummaryLabNat_TestID
|
|
where T_KelainanLabIsActive = 'Y' and T_OrderHeaderMgm_McuID = ?
|
|
group by Mcu_KelainanID
|
|
ORDER BY total DESC
|
|
LIMIT 10
|
|
";
|
|
|
|
$qry = $this->db->query($sql, [$id]);
|
|
$this->check_error($qry, "get data urinalisa");
|
|
$rows = $qry->result_array();
|
|
|
|
$data = [
|
|
["score", "amount", "product"]
|
|
];
|
|
if (count($rows) == 0) {
|
|
// $this->chart_error("No data found");
|
|
$data = [];
|
|
}
|
|
foreach ($rows as $index => $row) {
|
|
$data[] = [
|
|
$index + 1,
|
|
$row['total'],
|
|
$this->splitString($row['Test'])
|
|
];
|
|
}
|
|
if (empty($data)) {
|
|
$option = [
|
|
"title" => [
|
|
"text" => "Urinalisa",
|
|
"show" => true
|
|
],
|
|
"graphic" => [
|
|
"elements" => [
|
|
[
|
|
"type" => "text",
|
|
"left" => "center",
|
|
"top" => "middle",
|
|
"style" => [
|
|
"text" => "Data tidak ditemukan",
|
|
"fontSize" => 18,
|
|
"color" => "#42aaf5"
|
|
]
|
|
]
|
|
]
|
|
]
|
|
];
|
|
} else {
|
|
$option = [
|
|
"title" => [
|
|
"text" => "Urinalisa"
|
|
],
|
|
"dataset" => [
|
|
"source" => $data
|
|
],
|
|
"grid" => [
|
|
"containLabel" => true
|
|
],
|
|
"xAxis" => [
|
|
"name" => "",
|
|
"type" => "category",
|
|
"axisLabel" => [
|
|
"interval" => 0,
|
|
"rotate" => 20
|
|
]
|
|
],
|
|
"yAxis" => [
|
|
"type" => "value",
|
|
"name" => "",
|
|
"nameTextStyle" => [
|
|
"align" => "right"
|
|
],
|
|
"nameGap" => 20
|
|
],
|
|
"visualMap" => [
|
|
"orient" => "horizontal",
|
|
"left" => "center",
|
|
"min" => 0,
|
|
"max" => count($data),
|
|
"dimension" => 0,
|
|
"show" => false,
|
|
"inRange" => [
|
|
"color" => ["#42aaf5", "#00eaf2", "#035bff"]
|
|
]
|
|
],
|
|
"series" => [
|
|
[
|
|
"label" => [
|
|
"position" => "inside",
|
|
"show" => true,
|
|
"formatter" => "{@[1]}"
|
|
],
|
|
"type" => "bar",
|
|
"encode" => [
|
|
"x" => "product",
|
|
"y" => "amount"
|
|
]
|
|
]
|
|
],
|
|
"tooltip" => [
|
|
"trigger" => "axis",
|
|
"axisPointer" => [
|
|
"type" => "shadow"
|
|
]
|
|
]
|
|
];
|
|
}
|
|
|
|
$config = ["config" => $option];
|
|
$j_param = json_encode($config);
|
|
|
|
// echo $j_param;
|
|
|
|
header("Content-Type: image/png");
|
|
// 4. post to chart renderer
|
|
echo $this->post($this->url_renderer, $j_param);
|
|
}
|
|
|
|
// mcu008 = Kelainan Gangguan Fungsi Hati
|
|
function mcu008($id)
|
|
{
|
|
$sql = "SELECT Mcu_KelainanID,
|
|
Mcu_KelainanName as Test,
|
|
count(distinct T_OrderHeaderID) as total
|
|
FROM t_kelainan_lab
|
|
JOIN t_orderheader ON T_KelainanLabT_OrderHeaderID = T_OrderHeaderID
|
|
JOIN mcu_summarylab ON T_KelainanLabMcu_SummaryLabID = Mcu_SummaryLabID
|
|
join mcu_kelainan on Mcu_summaryLabMcu_KelainanID = Mcu_KelainanID
|
|
join mcu_kelainangroup on Mcu_KelainanMcu_KelainanGroupID = Mcu_KelainanGroupID AND Mcu_KelainanGroupID = 16
|
|
JOIN nat_test ON Mcu_SummaryLabNat_TestID = Nat_TestID AND T_KelainanLabNat_TestID = Mcu_SummaryLabNat_TestID
|
|
where T_KelainanLabIsActive = 'Y' and T_OrderHeaderMgm_McuID = ?
|
|
group by Mcu_KelainanID
|
|
ORDER BY total DESC
|
|
LIMIT 10
|
|
";
|
|
|
|
$qry = $this->db->query($sql, [$id]);
|
|
$this->check_error($qry, "get data gangguan fungsi hati");
|
|
$rows = $qry->result_array();
|
|
$data = [
|
|
["score", "amount", "product"]
|
|
];
|
|
if (count($rows) == 0) {
|
|
// $this->chart_error("No data found");
|
|
$data = [];
|
|
}
|
|
foreach ($rows as $index => $row) {
|
|
$data[] = [
|
|
$index + 1,
|
|
$row['total'],
|
|
$this->splitString($row['Test'])
|
|
];
|
|
}
|
|
if (empty($data)) {
|
|
$option = [
|
|
"title" => [
|
|
"text" => "Gangguan Fungsi Hati",
|
|
"show" => true
|
|
],
|
|
"graphic" => [
|
|
"elements" => [
|
|
[
|
|
"type" => "text",
|
|
"left" => "center",
|
|
"top" => "middle",
|
|
"style" => [
|
|
"text" => "Data tidak ditemukan",
|
|
"fontSize" => 18,
|
|
"color" => "#42aaf5"
|
|
]
|
|
]
|
|
]
|
|
]
|
|
];
|
|
} else {
|
|
$option = [
|
|
"title" => [
|
|
"text" => "Gangguan Fungsi Hati"
|
|
],
|
|
"dataset" => [
|
|
"source" => $data
|
|
],
|
|
"grid" => [
|
|
"containLabel" => true
|
|
],
|
|
"xAxis" => [
|
|
"name" => "",
|
|
"type" => "category",
|
|
"axisLabel" => [
|
|
"interval" => 0,
|
|
"rotate" => 20
|
|
]
|
|
],
|
|
"yAxis" => [
|
|
"type" => "value",
|
|
"name" => "",
|
|
"nameTextStyle" => [
|
|
"align" => "right"
|
|
],
|
|
"nameGap" => 20
|
|
],
|
|
"visualMap" => [
|
|
"orient" => "horizontal",
|
|
"left" => "center",
|
|
"min" => 0,
|
|
"max" => count($data),
|
|
"dimension" => 0,
|
|
"show" => false,
|
|
"inRange" => [
|
|
"color" => ["#42aaf5", "#00eaf2", "#035bff"]
|
|
]
|
|
],
|
|
"series" => [
|
|
[
|
|
"label" => [
|
|
"position" => "inside",
|
|
"show" => true,
|
|
"formatter" => "{@[1]}"
|
|
],
|
|
"type" => "bar",
|
|
"encode" => [
|
|
"x" => "product",
|
|
"y" => "amount"
|
|
]
|
|
]
|
|
],
|
|
"tooltip" => [
|
|
"trigger" => "axis",
|
|
"axisPointer" => [
|
|
"type" => "shadow"
|
|
]
|
|
]
|
|
];
|
|
}
|
|
|
|
$config = ["config" => $option];
|
|
$j_param = json_encode($config);
|
|
|
|
// echo $j_param;
|
|
|
|
header("Content-Type: image/png");
|
|
// 4. post to chart renderer
|
|
echo $this->post($this->url_renderer, $j_param);
|
|
}
|
|
// mcu009 = Kelainan Gangguan Metabolisme Lemak
|
|
function mcu009($id)
|
|
{
|
|
$sql = "SELECT Mcu_KelainanID,
|
|
Mcu_KelainanName as Test,
|
|
count(distinct T_OrderHeaderID) as total
|
|
FROM t_kelainan_lab
|
|
JOIN t_orderheader ON T_KelainanLabT_OrderHeaderID = T_OrderHeaderID
|
|
JOIN mcu_summarylab ON T_KelainanLabMcu_SummaryLabID = Mcu_SummaryLabID
|
|
join mcu_kelainan on Mcu_summaryLabMcu_KelainanID = Mcu_KelainanID
|
|
join mcu_kelainangroup on Mcu_KelainanMcu_KelainanGroupID = Mcu_KelainanGroupID
|
|
JOIN nat_test ON Mcu_SummaryLabNat_TestID = Nat_TestID AND
|
|
T_KelainanLabNat_TestID = Mcu_SummaryLabNat_TestID AND Nat_TestCode IN ( '10520300','10520400')
|
|
where T_KelainanLabIsActive = 'Y' and T_OrderHeaderMgm_McuID = ?
|
|
group by Mcu_KelainanID
|
|
ORDER BY total DESC
|
|
LIMIT 10
|
|
";
|
|
|
|
$qry = $this->db->query($sql, [$id]);
|
|
$this->check_error($qry, "get data gangguan metabolisme lemak");
|
|
$rows = $qry->result_array();
|
|
|
|
$data = [
|
|
["score", "amount", "product"]
|
|
];
|
|
if (count($rows) == 0) {
|
|
// $this->chart_error("No data found");
|
|
$data = [];
|
|
}
|
|
|
|
|
|
|
|
foreach ($rows as $index => $row) {
|
|
$data[] = [
|
|
$index + 1,
|
|
$row['total'],
|
|
$this->splitString($row['Test'])
|
|
];
|
|
}
|
|
|
|
if (empty($data)) {
|
|
$option = [
|
|
"title" => [
|
|
"text" => "Ganggian Metabolisme Lemak",
|
|
"show" => true
|
|
],
|
|
"graphic" => [
|
|
"elements" => [
|
|
[
|
|
"type" => "text",
|
|
"left" => "center",
|
|
"top" => "middle",
|
|
"style" => [
|
|
"text" => "Data tidak ditemukan",
|
|
"fontSize" => 18,
|
|
"color" => "#42aaf5"
|
|
]
|
|
]
|
|
]
|
|
]
|
|
];
|
|
} else {
|
|
$option = [
|
|
"title" => [
|
|
"text" => "Gangguan Metabolisme Lemak"
|
|
],
|
|
"dataset" => [
|
|
"source" => $data
|
|
],
|
|
"grid" => [
|
|
"containLabel" => true
|
|
],
|
|
"xAxis" => [
|
|
"name" => "",
|
|
"type" => "category",
|
|
"axisLabel" => [
|
|
"interval" => 0,
|
|
"rotate" => 20
|
|
]
|
|
],
|
|
"yAxis" => [
|
|
"type" => "value",
|
|
"name" => "",
|
|
"nameTextStyle" => [
|
|
"align" => "right"
|
|
],
|
|
"nameGap" => 20
|
|
],
|
|
"visualMap" => [
|
|
"orient" => "horizontal",
|
|
"left" => "center",
|
|
"min" => 0,
|
|
"max" => count($data),
|
|
"dimension" => 0,
|
|
"show" => false,
|
|
"inRange" => [
|
|
"color" => ["#42aaf5", "#00eaf2", "#035bff"]
|
|
]
|
|
],
|
|
"series" => [
|
|
[
|
|
"label" => [
|
|
"position" => "inside",
|
|
"show" => true,
|
|
"formatter" => "{@[1]}"
|
|
],
|
|
"type" => "bar",
|
|
"encode" => [
|
|
"x" => "product",
|
|
"y" => "amount"
|
|
]
|
|
]
|
|
],
|
|
"tooltip" => [
|
|
"trigger" => "axis",
|
|
"axisPointer" => [
|
|
"type" => "shadow"
|
|
]
|
|
]
|
|
];
|
|
}
|
|
|
|
$config = ["config" => $option];
|
|
$j_param = json_encode($config);
|
|
|
|
// echo $j_param;
|
|
|
|
header("Content-Type: image/png");
|
|
// 4. post to chart renderer
|
|
echo $this->post($this->url_renderer, $j_param);
|
|
}
|
|
// mcu010 = Kelainan Peningkatan Glukosa
|
|
function mcu010($id)
|
|
{
|
|
$sql = "SELECT Mcu_KelainanID,
|
|
Mcu_KelainanName as Test,
|
|
count(distinct T_OrderHeaderID) as total
|
|
FROM t_kelainan_lab
|
|
JOIN t_orderheader ON T_KelainanLabT_OrderHeaderID = T_OrderHeaderID
|
|
JOIN mcu_summarylab ON T_KelainanLabMcu_SummaryLabID = Mcu_SummaryLabID
|
|
join mcu_kelainan on Mcu_summaryLabMcu_KelainanID = Mcu_KelainanID
|
|
join mcu_kelainangroup on Mcu_KelainanMcu_KelainanGroupID = Mcu_KelainanGroupID
|
|
JOIN nat_test ON Mcu_SummaryLabNat_TestID = Nat_TestID AND
|
|
T_KelainanLabNat_TestID = Mcu_SummaryLabNat_TestID AND Nat_TestCode IN ( '10540200')
|
|
where T_KelainanLabIsActive = 'Y' and T_OrderHeaderMgm_McuID = ?
|
|
group by Mcu_KelainanID
|
|
ORDER BY total DESC
|
|
LIMIT 10
|
|
";
|
|
|
|
$qry = $this->db->query($sql, [$id]);
|
|
$this->check_error($qry, "get data peningkatan glukosa");
|
|
$rows = $qry->result_array();
|
|
|
|
$data = [
|
|
["score", "amount", "product"]
|
|
];
|
|
if (count($rows) == 0) {
|
|
// $this->chart_error("No data found");
|
|
$data = [];
|
|
}
|
|
|
|
foreach ($rows as $index => $row) {
|
|
$data[] = [
|
|
$index + 1,
|
|
$row['total'],
|
|
$this->splitString($row['Test'])
|
|
];
|
|
}
|
|
|
|
if (empty($data)) {
|
|
$option = [
|
|
"title" => [
|
|
"text" => "Peningkatan Glukosa",
|
|
"show" => true
|
|
],
|
|
"graphic" => [
|
|
"elements" => [
|
|
[
|
|
"type" => "text",
|
|
"left" => "center",
|
|
"top" => "middle",
|
|
"style" => [
|
|
"text" => "Data tidak ditemukan",
|
|
"fontSize" => 18,
|
|
"color" => "#42aaf5"
|
|
]
|
|
]
|
|
]
|
|
]
|
|
];
|
|
} else {
|
|
$option = [
|
|
"title" => [
|
|
"text" => "Peningkatan Glukosa",
|
|
"show" => true
|
|
],
|
|
"dataset" => [
|
|
"source" => $data
|
|
],
|
|
"grid" => [
|
|
"containLabel" => true
|
|
],
|
|
"xAxis" => [
|
|
"name" => "",
|
|
"type" => "category",
|
|
"axisLabel" => [
|
|
"interval" => 0,
|
|
"rotate" => 20
|
|
]
|
|
],
|
|
"yAxis" => [
|
|
"type" => "value",
|
|
"name" => "",
|
|
"nameTextStyle" => [
|
|
"align" => "right"
|
|
],
|
|
"nameGap" => 20
|
|
],
|
|
"visualMap" => [
|
|
"orient" => "horizontal",
|
|
"left" => "center",
|
|
"min" => 0,
|
|
"max" => count($data),
|
|
"dimension" => 0,
|
|
"show" => false,
|
|
"inRange" => [
|
|
"color" => ["#42aaf5", "#00eaf2", "#035bff"]
|
|
]
|
|
],
|
|
"series" => [
|
|
[
|
|
"label" => [
|
|
"position" => "inside",
|
|
"show" => true,
|
|
"formatter" => "{@[1]}"
|
|
],
|
|
"type" => "bar",
|
|
"encode" => [
|
|
"x" => "product",
|
|
"y" => "amount"
|
|
]
|
|
]
|
|
],
|
|
"tooltip" => [
|
|
"trigger" => "axis",
|
|
"axisPointer" => [
|
|
"type" => "shadow"
|
|
]
|
|
],
|
|
];
|
|
}
|
|
|
|
$config = ["config" => $option];
|
|
$j_param = json_encode($config);
|
|
|
|
// echo $j_param;
|
|
|
|
header("Content-Type: image/png");
|
|
// 4. post to chart renderer
|
|
echo $this->post($this->url_renderer, $j_param);
|
|
}
|
|
// mcu011 = Kelainan Non Lab 10 Terbesar
|
|
function mcu011($id)
|
|
{
|
|
$sql = "SELECT Mcu_KelainanID, Mcu_KelainanName as Test,
|
|
count(distinct T_OrderHeaderID) as total
|
|
FROM t_kelainan_nonlab
|
|
JOIN t_orderheader ON T_KelainanNonLabT_OrderHeaderID = T_OrderHeaderID
|
|
JOIN mcu_summarynonlab ON T_KelainanNonLabMcu_SummaryNonlabID = Mcu_SummaryNonlabID
|
|
join mcu_kelainan on Mcu_SummaryNonlabMcu_KelainanID = Mcu_KelainanID
|
|
join mcu_kelainangroup on Mcu_KelainanMcu_KelainanGroupID = Mcu_KelainanGroupID
|
|
JOIN nat_test ON Mcu_SummaryNonlabNat_TestID = Nat_TestID AND
|
|
T_KelainanNonLabNat_TestID = Mcu_SummaryNonlabNat_TestID
|
|
where T_KelainanNonLabIsActive = 'Y' and T_OrderHeaderMgm_McuID = ?
|
|
group by Mcu_KelainanID
|
|
ORDER BY total DESC
|
|
LIMIT 10
|
|
";
|
|
|
|
$qry = $this->db->query($sql, [$id]);
|
|
$this->check_error($qry, "get data non lab");
|
|
$rows = $qry->result_array();
|
|
|
|
// Initialize the data array with headers
|
|
$data = [
|
|
["score", "amount", "product", "percentage"]
|
|
];
|
|
if (count($rows) == 0) {
|
|
// $this->chart_error("No data found");
|
|
$data = [];
|
|
}
|
|
|
|
$sql_tot = "SELECT
|
|
COUNT(distinct(T_OrderHeaderID)) as peserta,
|
|
COUNT( distinct(Mcu_PreregisterPatientsM_PatientID)) as total
|
|
FROM mcu_preregister_patients
|
|
LEFT JOIN t_orderheader ON Mcu_PreregisterPatientsT_OrderHeaderID = T_OrderHeaderID AND
|
|
T_OrderHeaderIsActive = 'Y'
|
|
WHERE
|
|
Mcu_PreregisterPatientsMgm_McuID = ? AND
|
|
Mcu_PreregisterPatientsIsActive = 'Y'
|
|
";
|
|
$qry_tot = $this->db->query($sql_tot, [$id]);
|
|
$this->check_error($qry_tot, "get total peserta");
|
|
$rows_tot = $qry_tot->result_array();
|
|
|
|
$peserta = $rows_tot[0]['peserta'];
|
|
|
|
// Map the SQL query results to the data array
|
|
foreach ($rows as $index => $row) {
|
|
$percentage = floor(($row['total'] / $peserta) * 100);
|
|
$data[] = [
|
|
$index + 1,
|
|
$row['total'],
|
|
$this->splitString($row['Test']),
|
|
$percentage
|
|
];
|
|
}
|
|
if (empty($data)) {
|
|
$option = [
|
|
"title" => [
|
|
"text" => "Kelainan Non Lab (10 Terbesar)",
|
|
"show" => true
|
|
],
|
|
"graphic" => [
|
|
"elements" => [
|
|
[
|
|
"type" => "text",
|
|
"left" => "center",
|
|
"top" => "middle",
|
|
"style" => [
|
|
"text" => "Data tidak ditemukan",
|
|
"fontSize" => 18,
|
|
"color" => "#42aaf5"
|
|
]
|
|
]
|
|
]
|
|
]
|
|
];
|
|
} else {
|
|
$option = [
|
|
"title" => [
|
|
"text" => "Kelainan Non Lab (10 Terbesar)"
|
|
],
|
|
"dataset" => [
|
|
"source" => $data
|
|
],
|
|
"grid" => [
|
|
"containLabel" => true
|
|
],
|
|
"xAxis" => [
|
|
"name" => "peserta"
|
|
],
|
|
"yAxis" => [
|
|
"type" => "category",
|
|
"axisLabel" => [
|
|
"fontSize" => 10
|
|
]
|
|
],
|
|
"visualMap" => [
|
|
"orient" => "horizontal",
|
|
"left" => "center",
|
|
"min" => 1,
|
|
"max" => 10,
|
|
"show" => false,
|
|
"dimension" => 0,
|
|
"inRange" => [
|
|
"color" => ["#42aaf5", "#00eaf2", "#035bff"]
|
|
]
|
|
],
|
|
"series" => [
|
|
[
|
|
"label" => [
|
|
"position" => "right",
|
|
"show" => true,
|
|
"formatter" => "{@[3]} %"
|
|
],
|
|
"type" => "bar",
|
|
"encode" => [
|
|
"x" => "amount",
|
|
"y" => "product"
|
|
]
|
|
]
|
|
],
|
|
"tooltip" => [
|
|
"trigger" => "axis",
|
|
"axisPointer" => [
|
|
"type" => "shadow"
|
|
]
|
|
],
|
|
];
|
|
}
|
|
$config = ["config" => $option];
|
|
$j_param = json_encode($config);
|
|
|
|
// echo $j_param;
|
|
|
|
header("Content-Type: image/png");
|
|
// 4. post to chart renderer
|
|
echo $this->post($this->url_renderer, $j_param);
|
|
}
|
|
// mcu012 = Kelainan Gangguan Jantung
|
|
function mcu012($id)
|
|
{
|
|
$sql = "SELECT Mcu_KelainanID, Mcu_KelainanName as Test,
|
|
count(distinct T_OrderHeaderID) as total
|
|
FROM t_kelainan_nonlab
|
|
JOIN t_orderheader ON T_KelainanNonLabT_OrderHeaderID = T_OrderHeaderID
|
|
JOIN mcu_summarynonlab ON T_KelainanNonLabMcu_SummaryNonlabID = Mcu_SummaryNonlabID
|
|
join mcu_kelainan on Mcu_SummaryNonlabMcu_KelainanID = Mcu_KelainanID
|
|
join mcu_kelainangroup on Mcu_KelainanMcu_KelainanGroupID = Mcu_KelainanGroupID AND
|
|
Mcu_KelainanGroupID = 10
|
|
JOIN nat_test ON Mcu_SummaryNonlabNat_TestID = Nat_TestID AND
|
|
T_KelainanNonLabNat_TestID = Mcu_SummaryNonlabNat_TestID
|
|
where T_KelainanNonLabIsActive = 'Y' and T_OrderHeaderMgm_McuID = ?
|
|
group by Mcu_KelainanID
|
|
ORDER BY total DESC
|
|
LIMIT 10
|
|
";
|
|
|
|
$qry = $this->db->query($sql, [$id]);
|
|
$this->check_error($qry, "get data gangguan jantung");
|
|
$rows = $qry->result_array();
|
|
|
|
$data = [
|
|
["score", "amount", "product"]
|
|
];
|
|
if (count($rows) == 0) {
|
|
// $this->chart_error("No data found");
|
|
$data = [];
|
|
}
|
|
foreach ($rows as $index => $row) {
|
|
$data[] = [
|
|
$index + 1,
|
|
$row['total'],
|
|
$this->splitString($row['Test'])
|
|
];
|
|
}
|
|
if (empty($data)) {
|
|
$option = [
|
|
"title" => [
|
|
"text" => "Gangguan Jantung",
|
|
"show" => true
|
|
],
|
|
"graphic" => [
|
|
"elements" => [
|
|
[
|
|
"type" => "text",
|
|
"left" => "center",
|
|
"top" => "middle",
|
|
"style" => [
|
|
"text" => "Data tidak ditemukan",
|
|
"fontSize" => 18,
|
|
"color" => "#42aaf5"
|
|
]
|
|
]
|
|
]
|
|
]
|
|
];
|
|
} else {
|
|
$option = [
|
|
"title" => [
|
|
"text" => "Gangguan Jantung"
|
|
],
|
|
"dataset" => [
|
|
"source" => $data
|
|
],
|
|
"grid" => [
|
|
"containLabel" => true
|
|
],
|
|
"xAxis" => [
|
|
"name" => "",
|
|
"type" => "category",
|
|
"axisLabel" => [
|
|
"interval" => 0,
|
|
"rotate" => 20
|
|
]
|
|
],
|
|
"yAxis" => [
|
|
"type" => "value",
|
|
"name" => "",
|
|
"nameTextStyle" => [
|
|
"align" => "right"
|
|
],
|
|
"nameGap" => 20
|
|
],
|
|
"visualMap" => [
|
|
"orient" => "horizontal",
|
|
"left" => "center",
|
|
"min" => 0,
|
|
"max" => count($data),
|
|
"dimension" => 0,
|
|
"show" => false,
|
|
"inRange" => [
|
|
"color" => ["#42aaf5", "#00eaf2", "#035bff"]
|
|
]
|
|
],
|
|
"series" => [
|
|
[
|
|
"label" => [
|
|
"position" => "inside",
|
|
"show" => true,
|
|
"formatter" => "{@[1]}"
|
|
],
|
|
"type" => "bar",
|
|
"encode" => [
|
|
"x" => "product",
|
|
"y" => "amount"
|
|
]
|
|
]
|
|
],
|
|
"tooltip" => [
|
|
"trigger" => "axis",
|
|
"axisPointer" => [
|
|
"type" => "shadow"
|
|
]
|
|
]
|
|
];
|
|
}
|
|
|
|
$config = ["config" => $option];
|
|
$j_param = json_encode($config);
|
|
|
|
// echo $j_param;
|
|
|
|
header("Content-Type: image/png");
|
|
// 4. post to chart renderer
|
|
echo $this->post($this->url_renderer, $j_param);
|
|
}
|
|
// mcu013 = Kelainan Thorax PA
|
|
function mcu013($id)
|
|
{
|
|
$sql = "SELECT Mcu_KelainanID, Mcu_KelainanName as Test,
|
|
count(distinct T_OrderHeaderID) as total
|
|
FROM t_kelainan_nonlab
|
|
JOIN t_orderheader ON T_KelainanNonLabT_OrderHeaderID = T_OrderHeaderID
|
|
JOIN mcu_summarynonlab ON T_KelainanNonLabMcu_SummaryNonlabID = Mcu_SummaryNonlabID
|
|
join mcu_kelainan on Mcu_SummaryNonlabMcu_KelainanID = Mcu_KelainanID
|
|
join mcu_kelainangroup on Mcu_KelainanMcu_KelainanGroupID = Mcu_KelainanGroupID
|
|
JOIN nat_test ON Mcu_SummaryNonlabNat_TestID = Nat_TestID AND
|
|
T_KelainanNonLabNat_TestID = Mcu_SummaryNonlabNat_TestID AND Nat_TestID = 5798
|
|
where T_KelainanNonLabIsActive = 'Y' and T_OrderHeaderMgm_McuID = ?
|
|
group by Mcu_KelainanID
|
|
ORDER BY total DESC
|
|
LIMIT 10
|
|
";
|
|
|
|
$qry = $this->db->query($sql, [$id]);
|
|
$this->check_error($qry, "get data thorax pa");
|
|
$rows = $qry->result_array();
|
|
|
|
$data = [
|
|
["score", "amount", "product"]
|
|
];
|
|
if (count($rows) == 0) {
|
|
// $this->chart_error("No data found");
|
|
$data = [];
|
|
}
|
|
|
|
foreach ($rows as $index => $row) {
|
|
$data[] = [
|
|
$index + 1,
|
|
$row['total'],
|
|
$this->splitString($row['Test'])
|
|
];
|
|
}
|
|
|
|
if (empty($data)) {
|
|
$option = [
|
|
"title" => [
|
|
"text" => "Thorax PA",
|
|
"show" => true
|
|
],
|
|
"graphic" => [
|
|
"elements" => [
|
|
[
|
|
"type" => "text",
|
|
"left" => "center",
|
|
"top" => "middle",
|
|
"style" => [
|
|
"text" => "Data tidak ditemukan",
|
|
"fontSize" => 18,
|
|
"color" => "#42aaf5"
|
|
]
|
|
]
|
|
]
|
|
]
|
|
];
|
|
} else {
|
|
$option = [
|
|
"title" => [
|
|
"text" => "Thorax PA"
|
|
],
|
|
"dataset" => [
|
|
"source" => $data
|
|
],
|
|
"grid" => [
|
|
"containLabel" => true
|
|
],
|
|
"xAxis" => [
|
|
"name" => "",
|
|
"type" => "category",
|
|
"axisLabel" => [
|
|
"interval" => 0,
|
|
"rotate" => 20
|
|
]
|
|
],
|
|
"yAxis" => [
|
|
"type" => "value",
|
|
"name" => "",
|
|
"nameTextStyle" => [
|
|
"align" => "right"
|
|
],
|
|
"nameGap" => 20
|
|
],
|
|
"visualMap" => [
|
|
"orient" => "horizontal",
|
|
"left" => "center",
|
|
"min" => 0,
|
|
"max" => count($data),
|
|
"dimension" => 0,
|
|
"show" => false,
|
|
"inRange" => [
|
|
"color" => ["#42aaf5", "#00eaf2", "#035bff"]
|
|
]
|
|
],
|
|
"series" => [
|
|
[
|
|
"label" => [
|
|
"position" => "inside",
|
|
"show" => true,
|
|
"formatter" => "{@[1]}"
|
|
],
|
|
"type" => "bar",
|
|
"encode" => [
|
|
"x" => "product",
|
|
"y" => "amount"
|
|
]
|
|
]
|
|
],
|
|
"tooltip" => [
|
|
"trigger" => "axis",
|
|
"axisPointer" => [
|
|
"type" => "shadow"
|
|
]
|
|
]
|
|
];
|
|
}
|
|
|
|
$config = ["config" => $option];
|
|
$j_param = json_encode($config);
|
|
|
|
// echo $j_param;
|
|
|
|
header("Content-Type: image/png");
|
|
// 4. post to chart renderer
|
|
echo $this->post($this->url_renderer, $j_param);
|
|
}
|
|
// mcu014 = Kelainan Spirometri
|
|
function mcu014($id)
|
|
{
|
|
$sql = "SELECT Mcu_KelainanID, Mcu_KelainanName as Test,
|
|
count(distinct T_OrderHeaderID) as total
|
|
FROM t_kelainan_nonlab
|
|
JOIN t_orderheader ON T_KelainanNonLabT_OrderHeaderID = T_OrderHeaderID
|
|
JOIN mcu_summarynonlab ON T_KelainanNonLabMcu_SummaryNonlabID = Mcu_SummaryNonlabID
|
|
join mcu_kelainan on Mcu_SummaryNonlabMcu_KelainanID = Mcu_KelainanID
|
|
join mcu_kelainangroup on Mcu_KelainanMcu_KelainanGroupID = Mcu_KelainanGroupID
|
|
JOIN nat_test ON Mcu_SummaryNonlabNat_TestID = Nat_TestID AND
|
|
T_KelainanNonLabNat_TestID = Mcu_SummaryNonlabNat_TestID AND Nat_TestID = 5321
|
|
where T_KelainanNonLabIsActive = 'Y' and T_OrderHeaderMgm_McuID = ?
|
|
group by Mcu_KelainanID
|
|
ORDER BY total DESC
|
|
LIMIT 10
|
|
";
|
|
|
|
$qry = $this->db->query($sql, [$id]);
|
|
$this->check_error($qry, "get data spirometri");
|
|
$rows = $qry->result_array();
|
|
$data = [
|
|
["score", "amount", "product"]
|
|
];
|
|
if (count($rows) == 0) {
|
|
// $this->chart_error("No data found");
|
|
$data = [];
|
|
}
|
|
|
|
foreach ($rows as $index => $row) {
|
|
$data[] = [
|
|
$index + 1,
|
|
$row['total'],
|
|
$this->splitString($row['Test'])
|
|
];
|
|
}
|
|
|
|
if (empty($data)) {
|
|
$option = [
|
|
"title" => [
|
|
"text" => "Spirometri",
|
|
"show" => true
|
|
],
|
|
"graphic" => [
|
|
"elements" => [
|
|
[
|
|
"type" => "text",
|
|
"left" => "center",
|
|
"top" => "middle",
|
|
"style" => [
|
|
"text" => "Data tidak ditemukan",
|
|
"fontSize" => 18,
|
|
"color" => "#42aaf5"
|
|
]
|
|
]
|
|
]
|
|
]
|
|
];
|
|
} else {
|
|
$option = [
|
|
"title" => [
|
|
"text" => "Spirometri"
|
|
],
|
|
"dataset" => [
|
|
"source" => $data
|
|
],
|
|
"grid" => [
|
|
"containLabel" => true
|
|
],
|
|
"xAxis" => [
|
|
"name" => "",
|
|
"type" => "category",
|
|
"axisLabel" => [
|
|
"interval" => 0,
|
|
"rotate" => 20
|
|
]
|
|
],
|
|
"yAxis" => [
|
|
"type" => "value",
|
|
"name" => "",
|
|
"nameTextStyle" => [
|
|
"align" => "right"
|
|
],
|
|
"nameGap" => 20
|
|
],
|
|
"visualMap" => [
|
|
"orient" => "horizontal",
|
|
"left" => "center",
|
|
"min" => 0,
|
|
"max" => count($data),
|
|
"dimension" => 0,
|
|
"show" => false,
|
|
"inRange" => [
|
|
"color" => ["#42aaf5", "#00eaf2", "#035bff"]
|
|
]
|
|
],
|
|
"series" => [
|
|
[
|
|
"label" => [
|
|
"position" => "inside",
|
|
"show" => true,
|
|
"formatter" => "{@[1]}"
|
|
],
|
|
"type" => "bar",
|
|
"encode" => [
|
|
"x" => "product",
|
|
"y" => "amount"
|
|
]
|
|
]
|
|
],
|
|
"tooltip" => [
|
|
"trigger" => "axis",
|
|
"axisPointer" => [
|
|
"type" => "shadow"
|
|
]
|
|
]
|
|
];
|
|
}
|
|
|
|
$config = ["config" => $option];
|
|
$j_param = json_encode($config);
|
|
|
|
// echo $j_param;
|
|
|
|
header("Content-Type: image/png");
|
|
// 4. post to chart renderer
|
|
echo $this->post($this->url_renderer, $j_param);
|
|
}
|
|
// mcu015 = Kelainan Pendengaran
|
|
function mcu015($id)
|
|
{
|
|
$sql = "SELECT Mcu_KelainanID, Mcu_KelainanName as Test,
|
|
count(distinct T_OrderHeaderID) as total
|
|
FROM t_kelainan_nonlab
|
|
JOIN t_orderheader ON T_KelainanNonLabT_OrderHeaderID = T_OrderHeaderID
|
|
JOIN mcu_summarynonlab ON T_KelainanNonLabMcu_SummaryNonlabID = Mcu_SummaryNonlabID
|
|
join mcu_kelainan on Mcu_SummaryNonlabMcu_KelainanID = Mcu_KelainanID
|
|
join mcu_kelainangroup on Mcu_KelainanMcu_KelainanGroupID = Mcu_KelainanGroupID
|
|
JOIN nat_test ON Mcu_SummaryNonlabNat_TestID = Nat_TestID AND
|
|
T_KelainanNonLabNat_TestID = Mcu_SummaryNonlabNat_TestID AND Nat_TestID = 5308
|
|
where T_KelainanNonLabIsActive = 'Y' and T_OrderHeaderMgm_McuID = ?
|
|
group by Mcu_KelainanID
|
|
ORDER BY total DESC
|
|
LIMIT 10
|
|
";
|
|
|
|
$qry = $this->db->query($sql, [$id]);
|
|
$this->check_error($qry, "get data pendengaran");
|
|
$rows = $qry->result_array();
|
|
$data = [
|
|
["score", "amount", "product"]
|
|
];
|
|
if (count($rows) == 0) {
|
|
// $this->chart_error("No data found");
|
|
$data = [];
|
|
}
|
|
foreach ($rows as $index => $row) {
|
|
$data[] = [
|
|
$index + 1,
|
|
$row['total'],
|
|
$this->splitString($row['Test'])
|
|
];
|
|
}
|
|
if (empty($data)) {
|
|
$option = [
|
|
"title" => [
|
|
"text" => "Gangguan Pendengaran",
|
|
"show" => true
|
|
],
|
|
"graphic" => [
|
|
"elements" => [
|
|
[
|
|
"type" => "text",
|
|
"left" => "center",
|
|
"top" => "middle",
|
|
"style" => [
|
|
"text" => "Data tidak ditemukan",
|
|
"fontSize" => 18,
|
|
"color" => "#42aaf5"
|
|
]
|
|
]
|
|
]
|
|
]
|
|
];
|
|
} else {
|
|
$option = [
|
|
"title" => [
|
|
"text" => "Gangguan Pendengaran"
|
|
],
|
|
"dataset" => [
|
|
"source" => $data
|
|
],
|
|
"grid" => [
|
|
"containLabel" => true
|
|
],
|
|
"xAxis" => [
|
|
"name" => "",
|
|
"type" => "category",
|
|
"axisLabel" => [
|
|
"interval" => 0,
|
|
"rotate" => 20
|
|
]
|
|
],
|
|
"yAxis" => [
|
|
"type" => "value",
|
|
"name" => "",
|
|
"nameTextStyle" => [
|
|
"align" => "right"
|
|
],
|
|
"nameGap" => 20
|
|
],
|
|
"visualMap" => [
|
|
"orient" => "horizontal",
|
|
"left" => "center",
|
|
"min" => 0,
|
|
"max" => count($data),
|
|
"dimension" => 0,
|
|
"show" => false,
|
|
"inRange" => [
|
|
"color" => ["#42aaf5", "#00eaf2", "#035bff"]
|
|
]
|
|
],
|
|
"series" => [
|
|
[
|
|
"label" => [
|
|
"position" => "inside",
|
|
"show" => true,
|
|
"formatter" => "{@[1]}"
|
|
],
|
|
"type" => "bar",
|
|
"encode" => [
|
|
"x" => "product",
|
|
"y" => "amount"
|
|
]
|
|
]
|
|
],
|
|
"tooltip" => [
|
|
"trigger" => "axis",
|
|
"axisPointer" => [
|
|
"type" => "shadow"
|
|
]
|
|
]
|
|
];
|
|
}
|
|
$config = ["config" => $option];
|
|
$j_param = json_encode($config);
|
|
|
|
// echo $j_param;
|
|
|
|
header("Content-Type: image/png");
|
|
// 4. post to chart renderer
|
|
echo $this->post($this->url_renderer, $j_param);
|
|
}
|
|
|
|
// mcu016 Kelainan Fisik Terbesar 10
|
|
function mcu016($id)
|
|
{
|
|
$sql = "SELECT Mcu_KelainanName as Test,
|
|
count(distinct T_OrderHeaderID) as total
|
|
FROM t_kelainan_fisik
|
|
JOIN t_orderheader ON T_KelainanFiskT_OrderHeaderID = T_OrderHeaderID
|
|
JOIN mcu_summaryfisik ON T_KelainanFiskMcu_SummaryFisikID = Mcu_SummaryFisikID AND
|
|
Mcu_SummaryFisikID NOT IN (63,67,68,69,70,71,72,73)
|
|
join mcu_kelainan on Mcu_SummaryFisikMcu_KelainanID = Mcu_KelainanID
|
|
join mcu_kelainangroup on Mcu_KelainanMcu_KelainanGroupID = Mcu_KelainanGroupID
|
|
where T_KelainanFiskIsActive = 'Y' and T_OrderHeaderMgm_McuID = ? AND
|
|
Mcu_KelainanClasification NOT IN ('who','kemenkes','JNC-VIII','ESC/ESH')
|
|
group by Mcu_KelainanID
|
|
ORDER BY total DESC
|
|
LIMIT 10
|
|
";
|
|
|
|
$qry = $this->db->query($sql, [$id]);
|
|
$this->check_error($qry, "get data fisik");
|
|
$rows = $qry->result_array();
|
|
// Initialize the data array with headers
|
|
$data = [
|
|
["score", "amount", "product", "percentage"]
|
|
];
|
|
if (count($rows) == 0) {
|
|
// $this->chart_error("No data found");
|
|
$data = [];
|
|
}
|
|
|
|
|
|
$sql_tot = "SELECT
|
|
COUNT(distinct(T_OrderHeaderID)) as peserta,
|
|
COUNT( distinct(Mcu_PreregisterPatientsM_PatientID)) as total
|
|
FROM mcu_preregister_patients
|
|
LEFT JOIN t_orderheader ON Mcu_PreregisterPatientsT_OrderHeaderID = T_OrderHeaderID AND
|
|
T_OrderHeaderIsActive = 'Y'
|
|
WHERE
|
|
Mcu_PreregisterPatientsMgm_McuID = ? AND
|
|
Mcu_PreregisterPatientsIsActive = 'Y'
|
|
";
|
|
$qry_tot = $this->db->query($sql_tot, [$id]);
|
|
$this->check_error($qry_tot, "get total peserta");
|
|
$rows_tot = $qry_tot->result_array();
|
|
|
|
$peserta = $rows_tot[0]['peserta'];
|
|
|
|
// Map the SQL query results to the data array
|
|
foreach ($rows as $index => $row) {
|
|
$percentage = floor(($row['total'] / $peserta) * 100);
|
|
$data[] = [
|
|
$index + 1,
|
|
$row['total'],
|
|
$this->splitString($row['Test']),
|
|
$percentage
|
|
];
|
|
}
|
|
|
|
if (empty($data)) {
|
|
$option = [
|
|
"title" => [
|
|
"text" => "Kelainan Fisik (10 Terbesar)",
|
|
"show" => true
|
|
],
|
|
"graphic" => [
|
|
"elements" => [
|
|
[
|
|
"type" => "text",
|
|
"left" => "center",
|
|
"top" => "middle",
|
|
"style" => [
|
|
"text" => "No Data Found",
|
|
"fontSize" => 18,
|
|
"color" => "#42aaf5"
|
|
]
|
|
]
|
|
]
|
|
]
|
|
];
|
|
} else {
|
|
$option = [
|
|
"title" => [
|
|
"text" => "Kelainan Fisik (10 Terbesar)"
|
|
],
|
|
"dataset" => [
|
|
"source" => $data
|
|
],
|
|
"grid" => [
|
|
"containLabel" => true
|
|
],
|
|
"xAxis" => [
|
|
"name" => "peserta",
|
|
],
|
|
"yAxis" => [
|
|
"type" => "category",
|
|
"axisLabel" => [
|
|
"fontSize" => 10
|
|
]
|
|
],
|
|
"visualMap" => [
|
|
"orient" => "horizontal",
|
|
"left" => "center",
|
|
"min" => 1,
|
|
"max" => 10,
|
|
"show" => false,
|
|
"dimension" => 0,
|
|
"inRange" => [
|
|
"color" => ["#42aaf5", "#00eaf2", "#035bff"]
|
|
]
|
|
],
|
|
"series" => [
|
|
[
|
|
"label" => [
|
|
"position" => "right",
|
|
"show" => true,
|
|
"formatter" => "{@[3]} %"
|
|
],
|
|
"type" => "bar",
|
|
"encode" => [
|
|
"x" => "amount",
|
|
"y" => "product"
|
|
]
|
|
]
|
|
],
|
|
"tooltip" => [
|
|
"trigger" => "axis",
|
|
"axisPointer" => [
|
|
"type" => "shadow"
|
|
]
|
|
],
|
|
];
|
|
}
|
|
|
|
$config = ["config" => $option];
|
|
$j_param = json_encode($config);
|
|
|
|
// echo $j_param;
|
|
|
|
header("Content-Type: image/png");
|
|
// 4. post to chart renderer
|
|
echo $this->post($this->url_renderer, $j_param);
|
|
}
|
|
|
|
// mcu017 = Status Index Masa Tubuh(BMI)
|
|
function mcu017($id)
|
|
{
|
|
// Data
|
|
$sql = "SELECT Mcu_KelainanName as test,
|
|
Mcu_KelainanClasification,
|
|
count(distinct orderkel.T_OrderHeaderID) as total
|
|
FROM mcu_kelainan
|
|
JOIN mcu_summaryfisik ON Mcu_SummaryFisikMcu_KelainanID = Mcu_KelainanID AND
|
|
Mcu_SummaryFisikIsActive = 'Y'
|
|
LEFT JOIN t_kelainan_fisik ON T_KelainanFiskMcu_SummaryFisikID = Mcu_SummaryFisikID AND
|
|
T_KelainanFiskIsActive= 'Y'
|
|
LEFT JOIN t_orderheader orderkel ON T_KelainanFiskT_OrderHeaderID = orderkel.T_OrderHeaderID AND
|
|
orderkel.T_OrderHeaderIsActive = 'Y' AND orderkel.T_OrderHeaderMgm_McuID = ?
|
|
WHERE
|
|
Mcu_KelainanIsActive = 'Y' AND Mcu_KelainanClasification = 'asia_pacific'
|
|
group by Mcu_KelainanID
|
|
UNION
|
|
SELECT 'Normal' as test,
|
|
'asia_pacific' as Mcu_KelainanClasification,
|
|
ifnull(count(distinct T_OrderHeaderID) - summary_total_kelainan_bmi(?), 0) as total
|
|
FROM t_orderheader
|
|
WHERE
|
|
T_OrderHeaderMgm_McuID = ? AND T_OrderHeaderIsActive = 'Y'
|
|
group by T_OrderHeaderMgm_McuID ";
|
|
|
|
$qry = $this->db->query($sql, [$id, $id, $id]);
|
|
$this->check_error($qry, "get total bmi");
|
|
$rows = $qry->result_array();
|
|
if (count($rows) == 0) {
|
|
$this->chart_error("No data found");
|
|
}
|
|
|
|
$data = [];
|
|
|
|
if (count($rows) > 0) {
|
|
foreach ($rows as $key => $vx) {
|
|
$data[] = array(
|
|
"value" => $vx["total"],
|
|
"name" => $vx["test"] . ":" . $vx['total'] . " Peserta"
|
|
);
|
|
}
|
|
}
|
|
|
|
$param = array(
|
|
'title' => array(
|
|
'text' => 'Status Index Masa Tubuh(BMI)',
|
|
'subtext' => '',
|
|
'left' => 'center'
|
|
),
|
|
'tooltip' => array(
|
|
'trigger' => 'item'
|
|
),
|
|
'legend' => array(
|
|
'top' => 'center',
|
|
'right' => '15%',
|
|
'orient' => 'vertical'
|
|
),
|
|
'series' => array(
|
|
array(
|
|
'label' => array(
|
|
'position' => 'inner',
|
|
'formatter' => '{d}%'
|
|
),
|
|
'left' => -150,
|
|
'name' => 'Access From',
|
|
'type' => 'pie',
|
|
'radius' => array('20%', '50%'),
|
|
'itemStyle' => array(
|
|
'borderRadius' => 10,
|
|
'borderColor' => '#fff',
|
|
'borderWidth' => 2
|
|
),
|
|
'data' => $data,
|
|
'emphasis' => array(
|
|
'itemStyle' => array(
|
|
'shadowBlur' => 10,
|
|
'shadowOffsetX' => 0,
|
|
'shadowColor' => 'rgba(0, 0, 0, 0.5)'
|
|
)
|
|
)
|
|
)
|
|
)
|
|
);
|
|
|
|
// Encapsulate in config attribute and JSON encode
|
|
$config = ["config" => $param];
|
|
$j_param = json_encode($config);
|
|
|
|
// Set content type to image/png
|
|
header("Content-Type: image/png");
|
|
|
|
// Post to chart renderer
|
|
echo $this->post($this->url_renderer, $j_param);
|
|
}
|
|
// mcu018 = Hipertensi
|
|
function mcu018($id)
|
|
{
|
|
// Data
|
|
$sql = "SELECT Mcu_KelainanName as test,
|
|
Mcu_KelainanClasification,
|
|
count(distinct orderkel.T_OrderHeaderID) as total
|
|
FROM mcu_kelainan
|
|
JOIN mcu_summaryfisik ON Mcu_SummaryFisikMcu_KelainanID = Mcu_KelainanID AND
|
|
Mcu_SummaryFisikIsActive = 'Y'
|
|
LEFT JOIN t_kelainan_fisik ON T_KelainanFiskMcu_SummaryFisikID = Mcu_SummaryFisikID AND
|
|
T_KelainanFiskIsActive= 'Y'
|
|
LEFT JOIN t_orderheader orderkel ON T_KelainanFiskT_OrderHeaderID = orderkel.T_OrderHeaderID AND
|
|
orderkel.T_OrderHeaderIsActive = 'Y' AND orderkel.T_OrderHeaderMgm_McuID = ?
|
|
WHERE
|
|
Mcu_KelainanIsActive = 'Y' AND Mcu_KelainanClasification = 'JNC-VII'
|
|
group by Mcu_KelainanID
|
|
UNION
|
|
SELECT 'Normal' as test,
|
|
'JNC-VII' as Mcu_KelainanClasification,
|
|
IFNULL(COUNT(T_OrderHeaderID) - summary_total_kelainan_hipertensi(?), 0) as total
|
|
FROM t_orderheader
|
|
WHERE
|
|
T_OrderHeaderMgm_McuID = ? AND T_OrderHeaderIsActive = 'Y'
|
|
group by T_OrderHeaderMgm_McuID ";
|
|
|
|
$qry = $this->db->query($sql, [$id, $id, $id]);
|
|
$this->check_error($qry, "get total bmi");
|
|
$rows = $qry->result_array();
|
|
if (count($rows) == 0) {
|
|
$this->chart_error("No data found");
|
|
}
|
|
|
|
$data = [];
|
|
|
|
if (count($rows) > 0) {
|
|
foreach ($rows as $key => $vx) {
|
|
$data[] = array(
|
|
"value" => $vx["total"],
|
|
"name" => $vx["test"] . ":" . $vx['total'] . " Peserta"
|
|
);
|
|
}
|
|
}
|
|
|
|
$param = array(
|
|
'title' => array(
|
|
'text' => 'Kriteria Hipertensi',
|
|
'subtext' => '',
|
|
'left' => 'center'
|
|
),
|
|
'tooltip' => array(
|
|
'trigger' => 'item'
|
|
),
|
|
'legend' => array(
|
|
'top' => 'center',
|
|
'right' => '12.5%',
|
|
'orient' => 'vertical'
|
|
),
|
|
'series' => array(
|
|
array(
|
|
'label' => array(
|
|
'position' => 'inner',
|
|
'formatter' => '{d}%'
|
|
),
|
|
'left' => -200,
|
|
'name' => 'Access From',
|
|
'type' => 'pie',
|
|
'radius' => array('20%', '50%'),
|
|
'itemStyle' => array(
|
|
'borderRadius' => 10,
|
|
'borderColor' => '#fff',
|
|
'borderWidth' => 2
|
|
),
|
|
'data' => $data,
|
|
'emphasis' => array(
|
|
'itemStyle' => array(
|
|
'shadowBlur' => 10,
|
|
'shadowOffsetX' => 0,
|
|
'shadowColor' => 'rgba(0, 0, 0, 0.5)'
|
|
)
|
|
)
|
|
)
|
|
)
|
|
);
|
|
|
|
// Encapsulate in config attribute and JSON encode
|
|
$config = ["config" => $param];
|
|
$j_param = json_encode($config);
|
|
|
|
// Set content type to image/png
|
|
header("Content-Type: image/png");
|
|
|
|
// Post to chart renderer
|
|
echo $this->post($this->url_renderer, $j_param);
|
|
}
|
|
// mcu019 = Refraksi
|
|
function mcu019($id)
|
|
{
|
|
// Data
|
|
$sql = "SELECT Mcu_KelainanName as test,
|
|
count(distinct orderkel.T_OrderHeaderID) as total
|
|
FROM mcu_kelainan
|
|
JOIN mcu_summaryfisik ON Mcu_SummaryFisikMcu_KelainanID = Mcu_KelainanID AND
|
|
Mcu_SummaryFisikIsActive = 'Y'
|
|
LEFT JOIN t_kelainan_fisik ON T_KelainanFiskMcu_SummaryFisikID = Mcu_SummaryFisikID AND
|
|
T_KelainanFiskIsActive= 'Y'
|
|
LEFT JOIN t_orderheader orderkel ON T_KelainanFiskT_OrderHeaderID = orderkel.T_OrderHeaderID AND
|
|
orderkel.T_OrderHeaderIsActive = 'Y' AND orderkel.T_OrderHeaderMgm_McuID = ?
|
|
WHERE
|
|
Mcu_KelainanIsActive = 'Y' AND Mcu_KelainanID IN (24,25)
|
|
group by Mcu_KelainanID
|
|
UNION
|
|
SELECT 'Normal' as test,
|
|
IFNULL(count(distinct T_OrderHeaderID) - summary_total_kelainan_visus(?), 0) as total
|
|
FROM t_orderheader
|
|
WHERE
|
|
T_OrderHeaderMgm_McuID = ? AND T_OrderHeaderIsActive = 'Y'
|
|
group by T_OrderHeaderMgm_McuID ";
|
|
|
|
$qry = $this->db->query($sql, [$id, $id, $id]);
|
|
$this->check_error($qry, "get total bmi");
|
|
$rows = $qry->result_array();
|
|
if (count($rows) == 0) {
|
|
$this->chart_error("No data found");
|
|
}
|
|
|
|
$data = [];
|
|
|
|
if (count($rows) > 0) {
|
|
foreach ($rows as $key => $vx) {
|
|
$data[] = array(
|
|
"value" => $vx["total"],
|
|
"name" => $vx["test"] . ":" . $vx['total'] . " Peserta"
|
|
);
|
|
}
|
|
}
|
|
|
|
$param = array(
|
|
'title' => array(
|
|
'text' => 'Refraksi',
|
|
'subtext' => '',
|
|
'left' => 'center'
|
|
),
|
|
'tooltip' => array(
|
|
'trigger' => 'item'
|
|
),
|
|
'legend' => array(
|
|
'bottom' => '5%',
|
|
'left' => 'center',
|
|
'orient' => 'vertical'
|
|
),
|
|
'series' => array(
|
|
array(
|
|
'label' => array(
|
|
'position' => 'inner',
|
|
'formatter' => '{d}%'
|
|
),
|
|
'top' => -50,
|
|
'name' => 'Access From',
|
|
'type' => 'pie',
|
|
'radius' => array('20%', '50%'),
|
|
'itemStyle' => array(
|
|
'borderRadius' => 10,
|
|
'borderColor' => '#fff',
|
|
'borderWidth' => 2
|
|
),
|
|
'data' => $data,
|
|
'emphasis' => array(
|
|
'itemStyle' => array(
|
|
'shadowBlur' => 10,
|
|
'shadowOffsetX' => 0,
|
|
'shadowColor' => 'rgba(0, 0, 0, 0.5)'
|
|
)
|
|
)
|
|
)
|
|
)
|
|
);
|
|
|
|
// Encapsulate in config attribute and JSON encode
|
|
$config = ["config" => $param];
|
|
$j_param = json_encode($config);
|
|
|
|
// Set content type to image/png
|
|
header("Content-Type: image/png");
|
|
|
|
// Post to chart renderer
|
|
echo $this->post($this->url_renderer, $j_param);
|
|
}
|
|
// MCU020 = Konsumsi Alkohol
|
|
|
|
function mcu020($id)
|
|
{
|
|
|
|
// Data
|
|
$sql = "SELECT
|
|
Mcu_KelainanName as test,
|
|
COUNT( distinct T_OrderHeaderID) as total
|
|
FROM mcu_kelainan
|
|
JOIN mcu_summaryfisik ON Mcu_SummaryFisikMcu_KelainanID = Mcu_KelainanID AND
|
|
Mcu_KelainanIsActive = 'Y' AND Mcu_KelainanID IN (117,118,119)
|
|
LEFT JOIN t_kelainan_fisik ON T_KelainanFiskMcu_SummaryFisikID = Mcu_SummaryFisikID AND
|
|
T_KelainanFiskIsActive = 'Y'
|
|
LEFT JOIN so_resultentry ON T_KelainanFiskSo_ResultEntryID = So_ResultEntryID AND
|
|
So_ResultEntryIsActive = 'Y'
|
|
LEFT JOIN so_resultentry_fisik_umum ON So_ResultEntryFisikUmumSo_ResultEntryID = So_ResultEntryID AND
|
|
So_ResultEntryFisikUmumIsActive = 'Y'
|
|
LEFT JOIN t_orderheader ON So_ResultEntryT_OrderHeaderID = T_OrderHeaderID AND
|
|
T_OrderHeaderMgm_McuID = ?
|
|
group by Mcu_KelainanID";
|
|
|
|
$qry = $this->db->query($sql, [$id]);
|
|
$this->check_error($qry, "get total mcu");
|
|
$rows = $qry->result_array();
|
|
if (count($rows) == 0) {
|
|
$this->chart_error("No data found");
|
|
}
|
|
|
|
$data = [];
|
|
|
|
if (count($rows) > 0) {
|
|
foreach ($rows as $key => $vx) {
|
|
$data[] = array(
|
|
"value" => $vx["total"],
|
|
"name" => $vx["test"] . ":" . $vx['total'] . " Peserta"
|
|
);
|
|
}
|
|
}
|
|
|
|
$param = array(
|
|
'title' => array(
|
|
'text' => 'Minum Alkohol',
|
|
'subtext' => '',
|
|
'left' => 'center'
|
|
),
|
|
'tooltip' => array(
|
|
'trigger' => 'item'
|
|
),
|
|
'legend' => array(
|
|
'top' => 'bottom',
|
|
'left' => 'center',
|
|
'orient' => 'vertical'
|
|
),
|
|
'series' => array(
|
|
array(
|
|
'label' => array(
|
|
'position' => 'inner',
|
|
'formatter' => '{d}%'
|
|
),
|
|
'name' => 'Access From',
|
|
'type' => 'pie',
|
|
'radius' => array('20%', '50%'),
|
|
'itemStyle' => array(
|
|
'borderRadius' => 10,
|
|
'borderColor' => '#fff',
|
|
'borderWidth' => 2
|
|
),
|
|
'data' => $data,
|
|
'emphasis' => array(
|
|
'itemStyle' => array(
|
|
'shadowBlur' => 10,
|
|
'shadowOffsetX' => 0,
|
|
'shadowColor' => 'rgba(0, 0, 0, 0.5)'
|
|
)
|
|
)
|
|
)
|
|
)
|
|
);
|
|
|
|
// Encapsulate in config attribute and JSON encode
|
|
$config = ["config" => $param];
|
|
$j_param = json_encode($config);
|
|
|
|
// Set content type to image/png
|
|
header("Content-Type: image/png");
|
|
|
|
// Post to chart renderer
|
|
echo $this->post($this->url_renderer, $j_param);
|
|
}
|
|
// mcu021 = Merokok
|
|
|
|
function mcu021($id)
|
|
{
|
|
|
|
// Data
|
|
$sql = "SELECT Mcu_KelainanName as test, COUNT( distinct T_OrderHeaderID) as total
|
|
FROM mcu_kelainan
|
|
JOIN mcu_summaryfisik ON Mcu_SummaryFisikMcu_KelainanID = Mcu_KelainanID AND
|
|
Mcu_KelainanIsActive = 'Y' AND Mcu_KelainanID IN (120,121,122)
|
|
LEFT JOIN t_kelainan_fisik ON T_KelainanFiskMcu_SummaryFisikID = Mcu_SummaryFisikID AND
|
|
T_KelainanFiskIsActive = 'Y'
|
|
LEFT JOIN so_resultentry ON T_KelainanFiskSo_ResultEntryID = So_ResultEntryID AND
|
|
So_ResultEntryIsActive = 'Y'
|
|
LEFT JOIN so_resultentry_fisik_umum ON So_ResultEntryFisikUmumSo_ResultEntryID = So_ResultEntryID AND
|
|
So_ResultEntryFisikUmumIsActive = 'Y'
|
|
LEFT JOIN t_orderheader ON So_ResultEntryT_OrderHeaderID = T_OrderHeaderID AND
|
|
T_OrderHeaderMgm_McuID = ?
|
|
group by Mcu_KelainanID";
|
|
|
|
$qry = $this->db->query($sql, [$id]);
|
|
$this->check_error($qry, "get total mcu");
|
|
$rows = $qry->result_array();
|
|
if (count($rows) == 0) {
|
|
$this->chart_error("No data found");
|
|
}
|
|
|
|
$data = [];
|
|
|
|
if (count($rows) > 0) {
|
|
foreach ($rows as $key => $vx) {
|
|
$data[] = array(
|
|
"value" => $vx["total"],
|
|
"name" => $vx["test"] . ":" . $vx['total'] . " Peserta"
|
|
);
|
|
}
|
|
}
|
|
|
|
$param = array(
|
|
'title' => array(
|
|
'text' => 'Merokok',
|
|
'subtext' => '',
|
|
'left' => 'center'
|
|
),
|
|
'tooltip' => array(
|
|
'trigger' => 'item'
|
|
),
|
|
'legend' => array(
|
|
'top' => 'bottom',
|
|
'left' => 'center',
|
|
'orient' => 'vertical'
|
|
),
|
|
'series' => array(
|
|
array(
|
|
'label' => array(
|
|
'position' => 'inner',
|
|
'formatter' => '{d}%'
|
|
),
|
|
'name' => 'Access From',
|
|
'type' => 'pie',
|
|
'radius' => array('20%', '50%'),
|
|
'itemStyle' => array(
|
|
'borderRadius' => 10,
|
|
'borderColor' => '#fff',
|
|
'borderWidth' => 2
|
|
),
|
|
'data' => $data,
|
|
'emphasis' => array(
|
|
'itemStyle' => array(
|
|
'shadowBlur' => 10,
|
|
'shadowOffsetX' => 0,
|
|
'shadowColor' => 'rgba(0, 0, 0, 0.5)'
|
|
)
|
|
)
|
|
)
|
|
)
|
|
);
|
|
|
|
// Encapsulate in config attribute and JSON encode
|
|
$config = ["config" => $param];
|
|
$j_param = json_encode($config);
|
|
|
|
// Set content type to image/png
|
|
header("Content-Type: image/png");
|
|
|
|
// Post to chart renderer
|
|
echo $this->post($this->url_renderer, $j_param);
|
|
}
|
|
|
|
// mcu022 = olahraga
|
|
function mcu022($id)
|
|
{
|
|
// Data
|
|
$sql = "SELECT Mcu_KelainanName as test, COUNT( distinct T_OrderHeaderID) as total
|
|
FROM mcu_kelainan
|
|
JOIN mcu_summaryfisik ON Mcu_SummaryFisikMcu_KelainanID = Mcu_KelainanID AND
|
|
Mcu_KelainanIsActive = 'Y' AND Mcu_KelainanID IN (123,124)
|
|
LEFT JOIN t_kelainan_fisik ON T_KelainanFiskMcu_SummaryFisikID = Mcu_SummaryFisikID AND
|
|
T_KelainanFiskIsActive = 'Y'
|
|
LEFT JOIN so_resultentry ON T_KelainanFiskSo_ResultEntryID = So_ResultEntryID AND
|
|
So_ResultEntryIsActive = 'Y'
|
|
LEFT JOIN so_resultentry_fisik_umum ON So_ResultEntryFisikUmumSo_ResultEntryID = So_ResultEntryID AND
|
|
So_ResultEntryFisikUmumIsActive = 'Y'
|
|
LEFT JOIN t_orderheader ON So_ResultEntryT_OrderHeaderID = T_OrderHeaderID AND
|
|
T_OrderHeaderMgm_McuID = ?
|
|
group by Mcu_KelainanID";
|
|
|
|
$qry = $this->db->query($sql, [$id]);
|
|
$this->check_error($qry, "get total bmi");
|
|
$rows = $qry->result_array();
|
|
if (count($rows) == 0) {
|
|
$this->chart_error("No data found");
|
|
}
|
|
|
|
$data = [];
|
|
|
|
if (count($rows) > 0) {
|
|
foreach ($rows as $key => $vx) {
|
|
$data[] = array(
|
|
"value" => $vx["total"],
|
|
"name" => $vx["test"] . ":" . $vx['total'] . " Peserta"
|
|
);
|
|
}
|
|
}
|
|
|
|
$param = array(
|
|
'title' => array(
|
|
'text' => 'Olahraga',
|
|
'subtext' => '',
|
|
'left' => 'center'
|
|
),
|
|
'tooltip' => array(
|
|
'trigger' => 'item'
|
|
),
|
|
'legend' => array(
|
|
'bottom' => '5%',
|
|
'left' => 'center',
|
|
'orient' => 'vertical'
|
|
),
|
|
'series' => array(
|
|
array(
|
|
'label' => array(
|
|
'position' => 'inner',
|
|
'formatter' => '{d}%'
|
|
),
|
|
'top' => -50,
|
|
'name' => 'Access From',
|
|
'type' => 'pie',
|
|
'radius' => array('20%', '50%'),
|
|
'itemStyle' => array(
|
|
'borderRadius' => 10,
|
|
'borderColor' => '#fff',
|
|
'borderWidth' => 2
|
|
),
|
|
'data' => $data,
|
|
'emphasis' => array(
|
|
'itemStyle' => array(
|
|
'shadowBlur' => 10,
|
|
'shadowOffsetX' => 0,
|
|
'shadowColor' => 'rgba(0, 0, 0, 0.5)'
|
|
)
|
|
)
|
|
)
|
|
)
|
|
);
|
|
|
|
// Encapsulate in config attribute and JSON encode
|
|
$config = ["config" => $param];
|
|
$j_param = json_encode($config);
|
|
|
|
// Set content type to image/png
|
|
header("Content-Type: image/png");
|
|
|
|
// Post to chart renderer
|
|
echo $this->post($this->url_renderer, $j_param);
|
|
}
|
|
|
|
function generate_default_graph($id)
|
|
{
|
|
$title = "";
|
|
$param_not_found = [
|
|
"title" => [
|
|
"text" => $title,
|
|
'subtext' => '',
|
|
"show" => true,
|
|
'left' => 'center'
|
|
],
|
|
"graphic" => [
|
|
"elements" => [
|
|
[
|
|
"type" => "text",
|
|
"left" => "center",
|
|
"top" => "middle",
|
|
"style" => [
|
|
"text" => "Data tidak ditemukan",
|
|
"fontSize" => 18,
|
|
"color" => "#42aaf5"
|
|
]
|
|
]
|
|
]
|
|
]
|
|
];
|
|
|
|
$param = array(
|
|
'title' => array(
|
|
'text' => $title,
|
|
'subtext' => '',
|
|
'left' => 'center'
|
|
),
|
|
'tooltip' => array(
|
|
'trigger' => 'item'
|
|
),
|
|
'legend' => array(
|
|
'top' => 'bottom',
|
|
'left' => 'center',
|
|
'orient' => 'vertical'
|
|
),
|
|
'series' => array(
|
|
array(
|
|
'label' => array(
|
|
'position' => 'inner',
|
|
'formatter' => '{d}%'
|
|
),
|
|
'name' => 'Access From',
|
|
'type' => 'pie',
|
|
'radius' => array('20%', '50%'),
|
|
'itemStyle' => array(
|
|
'borderRadius' => 10,
|
|
'borderColor' => '#fff',
|
|
'borderWidth' => 2
|
|
),
|
|
'data' => [],
|
|
'emphasis' => array(
|
|
'itemStyle' => array(
|
|
'shadowBlur' => 10,
|
|
'shadowOffsetX' => 0,
|
|
'shadowColor' => 'rgba(0, 0, 0, 0.5)'
|
|
)
|
|
)
|
|
)
|
|
)
|
|
);
|
|
|
|
$option_not_found = [
|
|
"title" => [
|
|
"text" => $title,
|
|
"show" => true
|
|
],
|
|
"graphic" => [
|
|
"elements" => [
|
|
[
|
|
"type" => "text",
|
|
"left" => "center",
|
|
"top" => "middle",
|
|
"style" => [
|
|
"text" => "Data tidak ditemukan",
|
|
"fontSize" => 18,
|
|
"color" => "#42aaf5"
|
|
]
|
|
]
|
|
]
|
|
]
|
|
];
|
|
|
|
$option = [
|
|
"title" => [
|
|
"text" => $title,
|
|
"show" => true
|
|
],
|
|
"dataset" => [
|
|
"source" => []
|
|
],
|
|
"grid" => [
|
|
"containLabel" => true
|
|
],
|
|
"xAxis" => [
|
|
"name" => "",
|
|
"type" => "category",
|
|
"axisLabel" => [
|
|
"interval" => 0,
|
|
"rotate" => 20
|
|
]
|
|
],
|
|
"yAxis" => [
|
|
"type" => "value",
|
|
"name" => "",
|
|
"nameTextStyle" => [
|
|
"align" => "right"
|
|
],
|
|
"nameGap" => 20
|
|
],
|
|
"visualMap" => [
|
|
"orient" => "horizontal",
|
|
"left" => "center",
|
|
"min" => 0,
|
|
"max" => count($data),
|
|
"dimension" => 0,
|
|
"show" => false,
|
|
"inRange" => [
|
|
"color" => ["#42aaf5", "#00eaf2", "#035bff"]
|
|
]
|
|
],
|
|
"series" => [
|
|
[
|
|
"label" => [
|
|
"position" => "inside",
|
|
"show" => true,
|
|
"formatter" => "{@[1]}"
|
|
],
|
|
"type" => "bar",
|
|
"encode" => [
|
|
"x" => "product",
|
|
"y" => "amount"
|
|
]
|
|
]
|
|
],
|
|
"tooltip" => [
|
|
"trigger" => "axis",
|
|
"axisPointer" => [
|
|
"type" => "shadow"
|
|
]
|
|
],
|
|
];
|
|
|
|
|
|
$title = "Peserta MCU";
|
|
$sql = "INSERT INTO mcu_image_grafik(
|
|
Mcu_ImageGrafikMgm_McuID,
|
|
Mcu_ImageGrafikMcu_KelainanGroupSummaryID,
|
|
Mcu_ImageGrafikGroupMenu,
|
|
Mcu_ImageGrafikName,
|
|
Mcu_ImageGrafikType,
|
|
Mcu_ImageGrafikUseRest,
|
|
Mcu_ImageGrafikRestLabel,
|
|
Mcu_ImageGrafikJson,
|
|
Mcu_ImageGrafikJsonNotFound,
|
|
Mcu_ImageGrafikCreated
|
|
)
|
|
VALUES(?,?,?,?,?,?,?,?,?,NOW())";
|
|
$qry = $this->db->query($sql,[
|
|
$id,
|
|
1,
|
|
'PESERTA',
|
|
"Peserta MCU",
|
|
'pie',
|
|
'Y',
|
|
'Normal',
|
|
json_encode($param_not_found),
|
|
json_encode($param)
|
|
]);
|
|
|
|
$sql = "INSERT INTO mcu_image_grafik(
|
|
Mcu_ImageGrafikMgm_McuID,
|
|
Mcu_ImageGrafikMcu_KelainanGroupSummaryID,
|
|
Mcu_ImageGrafikGroupMenu,
|
|
Mcu_ImageGrafikName,
|
|
Mcu_ImageGrafikType,
|
|
Mcu_ImageGrafikUseRest,
|
|
Mcu_ImageGrafikRestLabel,
|
|
Mcu_ImageGrafikJson,
|
|
Mcu_ImageGrafikJsonNotFound,
|
|
Mcu_ImageGrafikCreated
|
|
)
|
|
VALUES(?,?,?,?,?,?,?,?,?,NOW())";
|
|
$qry = $this->db->query($sql,[
|
|
$id,
|
|
1,
|
|
'PESERTA',
|
|
"Peserta MCU",
|
|
'bar',
|
|
'Y',
|
|
'Normal',
|
|
json_encode($option_not_found),
|
|
json_encode($option)
|
|
]);
|
|
|
|
$title = "Peserta MCU Berdasarkan Jenis Kelamin";
|
|
$sql = "INSERT INTO mcu_image_grafik(
|
|
Mcu_ImageGrafikMgm_McuID,
|
|
Mcu_ImageGrafikMcu_KelainanGroupSummaryID,
|
|
Mcu_ImageGrafikGroupMenu,
|
|
Mcu_ImageGrafikName,
|
|
Mcu_ImageGrafikType,
|
|
Mcu_ImageGrafikUseRest,
|
|
Mcu_ImageGrafikRestLabel,
|
|
Mcu_ImageGrafikJson,
|
|
Mcu_ImageGrafikJsonNotFound,
|
|
Mcu_ImageGrafikCreated
|
|
)
|
|
VALUES(?,?,?,?,?,?,?,?,?,NOW())";
|
|
$qry = $this->db->query($sql,[
|
|
$id,
|
|
2,
|
|
'PESERTA',
|
|
"Peserta MCU Berdasarkan Jenis Kelamin",
|
|
'pie',
|
|
'Y',
|
|
'Normal',
|
|
json_encode($param_not_found),
|
|
json_encode($param)
|
|
]);
|
|
|
|
$sql = "INSERT INTO mcu_image_grafik(
|
|
Mcu_ImageGrafikMgm_McuID,
|
|
Mcu_ImageGrafikMcu_KelainanGroupSummaryID,
|
|
Mcu_ImageGrafikGroupMenu,
|
|
Mcu_ImageGrafikName,
|
|
Mcu_ImageGrafikType,
|
|
Mcu_ImageGrafikUseRest,
|
|
Mcu_ImageGrafikRestLabel,
|
|
Mcu_ImageGrafikJson,
|
|
Mcu_ImageGrafikJsonNotFound,
|
|
Mcu_ImageGrafikCreated
|
|
)
|
|
VALUES(?,?,?,?,?,?,?,?,?,NOW())";
|
|
$qry = $this->db->query($sql,[
|
|
$id,
|
|
2,
|
|
'PESERTA',
|
|
"Peserta MCU Berdasarkan Jenis Kelamin",
|
|
'bar',
|
|
'Y',
|
|
'Normal',
|
|
json_encode($option_not_found),
|
|
json_encode($option)
|
|
]);
|
|
|
|
$title = "Peserta MCU Berdasarkan Umur";
|
|
$sql = "INSERT INTO mcu_image_grafik(
|
|
Mcu_ImageGrafikMgm_McuID,
|
|
Mcu_ImageGrafikMcu_KelainanGroupSummaryID,
|
|
Mcu_ImageGrafikGroupMenu,
|
|
Mcu_ImageGrafikName,
|
|
Mcu_ImageGrafikType,
|
|
Mcu_ImageGrafikUseRest,
|
|
Mcu_ImageGrafikRestLabel,
|
|
Mcu_ImageGrafikJson,
|
|
Mcu_ImageGrafikJsonNotFound,
|
|
Mcu_ImageGrafikCreated
|
|
)
|
|
VALUES(?,?,?,?,?,?,?,?,?,NOW())";
|
|
$qry = $this->db->query($sql,[
|
|
$id,
|
|
3,
|
|
'PESERTA',
|
|
"Peserta MCU Berdasarkan Umur",
|
|
'pie',
|
|
'Y',
|
|
'Normal',
|
|
json_encode($param_not_found),
|
|
json_encode($param)
|
|
]);
|
|
|
|
$sql = "INSERT INTO mcu_image_grafik(
|
|
Mcu_ImageGrafikMgm_McuID,
|
|
Mcu_ImageGrafikMcu_KelainanGroupSummaryID,
|
|
Mcu_ImageGrafikGroupMenu,
|
|
Mcu_ImageGrafikName,
|
|
Mcu_ImageGrafikType,
|
|
Mcu_ImageGrafikUseRest,
|
|
Mcu_ImageGrafikRestLabel,
|
|
Mcu_ImageGrafikJson,
|
|
Mcu_ImageGrafikJsonNotFound,
|
|
Mcu_ImageGrafikCreated
|
|
)
|
|
VALUES(?,?,?,?,?,?,?,?,?,NOW())";
|
|
$qry = $this->db->query($sql,[
|
|
$id,
|
|
3,
|
|
'PESERTA',
|
|
"Peserta MCU Berdasarkan Umur",
|
|
'bar',
|
|
'Y',
|
|
'Normal',
|
|
json_encode($option_not_found),
|
|
json_encode($option)
|
|
]);
|
|
|
|
$sql = "SELECT *
|
|
FROM mcu_kelainangroupsummary
|
|
WHERE
|
|
Mcu_KelainanGroupSummaryIsActive = 'Y'";
|
|
$qry = $this->db->query($sql);
|
|
$rows = $qry->result_array();
|
|
if($rows){
|
|
foreach ($rows as $key => $value) {
|
|
$title = $value['Mcu_KelainanGroupSummaryName'];
|
|
$sql = "INSERT INTO mcu_image_grafik(
|
|
Mcu_ImageGrafikMgm_McuID,
|
|
Mcu_ImageGrafikMcu_KelainanGroupSummaryID,
|
|
Mcu_ImageGrafikGroupMenu,
|
|
Mcu_ImageGrafikName,
|
|
Mcu_ImageGrafikType,
|
|
Mcu_ImageGrafikUseRest,
|
|
Mcu_ImageGrafikRestLabel,
|
|
Mcu_ImageGrafikJson,
|
|
Mcu_ImageGrafikJsonNotFound,
|
|
Mcu_ImageGrafikCreated
|
|
)
|
|
VALUES(?,?,?,?,?,?,?,?,?,NOW())";
|
|
$qry = $this->db->query($sql,[
|
|
$id,
|
|
$value['Mcu_KelainanGroupSummaryID'],
|
|
'SUMMARY',
|
|
$value['Mcu_KelainanGroupSummaryName'],
|
|
'pie',
|
|
'Y',
|
|
'Normal',
|
|
json_encode($param_not_found),
|
|
json_encode($param)
|
|
]);
|
|
|
|
$sql = "INSERT INTO mcu_image_grafik(
|
|
Mcu_ImageGrafikMgm_McuID,
|
|
Mcu_ImageGrafikMcu_KelainanGroupSummaryID,
|
|
Mcu_ImageGrafikGroupMenu,
|
|
Mcu_ImageGrafikName,
|
|
Mcu_ImageGrafikType,
|
|
Mcu_ImageGrafikUseRest,
|
|
Mcu_ImageGrafikRestLabel,
|
|
Mcu_ImageGrafikJson,
|
|
Mcu_ImageGrafikJsonNotFound,
|
|
Mcu_ImageGrafikCreated
|
|
)
|
|
VALUES(?,?,?,?,?,?,?,?,?,NOW())";
|
|
$qry = $this->db->query($sql,[
|
|
$id,
|
|
$value['Mcu_KelainanGroupSummaryID'],
|
|
'SUMMARY',
|
|
$value['Mcu_KelainanGroupSummaryName'],
|
|
'bar',
|
|
'Y',
|
|
'Normal',
|
|
json_encode($option_not_found),
|
|
json_encode($option)
|
|
]);
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
function splitString($string, $wordsPerLine = 3)
|
|
{
|
|
$words = explode(' ', $string);
|
|
$lines = [];
|
|
for ($i = 0; $i < count($words); $i += $wordsPerLine) {
|
|
$lines[] = implode(' ', array_slice($words, $i, $wordsPerLine));
|
|
}
|
|
return implode("\n", $lines);
|
|
}
|
|
|
|
function check_error($qry, $stage)
|
|
{
|
|
if (!$qry) {
|
|
$errMsg = $stage . "<br/>" . $this->db->error()["messge"];
|
|
print_r($errMsg);
|
|
$this->chart_error($errMsg);
|
|
}
|
|
}
|
|
|
|
function chart_error($msg)
|
|
{
|
|
$param = array(
|
|
'title' => array(
|
|
'show' => true,
|
|
'textStyle' => array(
|
|
'color' => 'grey',
|
|
'fontSize' => 20
|
|
),
|
|
'text' => $msg,
|
|
'left' => 'center',
|
|
'top' => 'center'
|
|
),
|
|
'xAxis' => array(
|
|
'show' => false
|
|
),
|
|
'yAxis' => array(
|
|
'show' => false
|
|
),
|
|
'series' => array()
|
|
);
|
|
header("Content-Type: image/png");
|
|
$config = ["config" => $param];
|
|
$j_param = json_encode($config);
|
|
echo $this->post($this->url_renderer, $j_param);
|
|
exit;
|
|
}
|
|
|
|
function post($url, $data)
|
|
{
|
|
$ch = curl_init($url);
|
|
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
|
|
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
|
|
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
|
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);
|
|
curl_setopt($ch, CURLOPT_TIMEOUT, j120);
|
|
curl_setopt($ch, CURLOPT_HTTPHEADER, [
|
|
"Content-Type: application/json",
|
|
"Content-Length: " . strlen($data),
|
|
]);
|
|
$result = curl_exec($ch);
|
|
if (curl_errno($ch) > 0) {
|
|
return [
|
|
"status" => "ERR",
|
|
"message" => curl_error($ch),
|
|
];
|
|
}
|
|
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
|
if ($httpCode != 200) {
|
|
return [
|
|
"status" => "ERR",
|
|
"message" => "Http Response : $httpCode",
|
|
];
|
|
}
|
|
return $result;
|
|
}
|
|
}
|