1092 lines
34 KiB
Plaintext
1092 lines
34 KiB
Plaintext
<?php
|
|
class Datajson extends MY_Controller
|
|
{
|
|
public function __construct() {
|
|
parent::__construct();
|
|
$this->db_smartone = $this->load->database("onedev", true);
|
|
}
|
|
|
|
function keluhan($id) {
|
|
$sql = "SELECT So_ResultEntryFisikUmumDetails as result
|
|
FROM so_resultentry_fisik_umum
|
|
JOIN fisik_template ON So_ResultEntryFisikUmumFisikTemplateID = FisikTemplateID AND
|
|
FisikTemplateCode = 'RI00.1'
|
|
WHERE
|
|
So_ResultEntryFisikUmumSo_ResultEntryID = {$id} AND So_ResultEntryFisikUmumIsActive = 'Y'
|
|
LIMIT 1";
|
|
//echo $sql;
|
|
$qry = $this->db_smartone->query($sql);
|
|
if (! $qry) {
|
|
return json_encode(array());
|
|
}
|
|
//echo $this->db_smartone->last_query();
|
|
$row_result = $qry->row_array();
|
|
$arr_result = json_decode($row_result['result']);
|
|
//print_r($arr_result);
|
|
$rtns = [];
|
|
foreach ($arr_result->details as $key => $value) {
|
|
//print_r($value);
|
|
$rtns[] = array(
|
|
"a1" => $value->label,
|
|
"a2" => $value->value
|
|
);
|
|
}
|
|
$rst[] = $rtns[0];
|
|
|
|
echo json_encode($rst);
|
|
}
|
|
|
|
function riwayat_kesehatan_sekarang($id) {
|
|
$sql = "SELECT So_ResultEntryFisikUmumDetails as result
|
|
FROM so_resultentry_fisik_umum
|
|
JOIN fisik_template ON So_ResultEntryFisikUmumFisikTemplateID = FisikTemplateID AND
|
|
FisikTemplateCode = 'RI08'
|
|
WHERE
|
|
So_ResultEntryFisikUmumSo_ResultEntryID = {$id} AND So_ResultEntryFisikUmumIsActive = 'Y'
|
|
LIMIT 1";
|
|
//echo $sql;
|
|
$qry = $this->db_smartone->query($sql);
|
|
if (! $qry) {
|
|
return json_encode(array());
|
|
}
|
|
//echo $this->db_smartone->last_query();
|
|
$row_result = $qry->row_array();
|
|
$arr_result = json_decode($row_result['result']);
|
|
$rtns = [];
|
|
$returns = [];
|
|
foreach ($arr_result->details as $key => $value) {
|
|
if($key % 2 === 0){
|
|
$rtns = [];
|
|
$rtns["a1"] = $value->chx?'Y':'N';
|
|
$rtns["a2"] = $value->label;
|
|
$rtns["a3"] = $value->value;
|
|
}else{
|
|
$rtns["a4"] = $value->chx?'Y':'N';
|
|
$rtns["a5"] = $value->label;
|
|
$rtns["a6"] = $value->value;
|
|
$returns[] = $rtns;
|
|
}
|
|
|
|
|
|
}
|
|
|
|
echo json_encode($returns, JSON_UNESCAPED_SLASHES);
|
|
}
|
|
|
|
|
|
function riwayat_penyakit_dahulu($id) {
|
|
$sql = "SELECT So_ResultEntryFisikUmumDetails as result
|
|
FROM so_resultentry_fisik_umum
|
|
JOIN fisik_template ON So_ResultEntryFisikUmumFisikTemplateID = FisikTemplateID AND
|
|
FisikTemplateCode = 'RI09'
|
|
WHERE
|
|
So_ResultEntryFisikUmumSo_ResultEntryID = {$id} AND So_ResultEntryFisikUmumIsActive = 'Y'
|
|
LIMIT 1";
|
|
//echo $sql;
|
|
$qry = $this->db_smartone->query($sql);
|
|
if (! $qry) {
|
|
return json_encode(array());
|
|
}
|
|
//echo $this->db_smartone->last_query();
|
|
$row_result = $qry->row_array();
|
|
$arr_result = json_decode($row_result['result']);
|
|
$rtns = [];
|
|
$returns = [];
|
|
foreach ($arr_result->details as $key => $value) {
|
|
if($key % 2 === 0){
|
|
$rtns = [];
|
|
$rtns["a1"] = $value->chx?'Y':'N';
|
|
$rtns["a2"] = $value->label;
|
|
$rtns["a3"] = $value->value;
|
|
}else{
|
|
$rtns["a4"] = $value->chx?'Y':'N';
|
|
$rtns["a5"] = $value->label;
|
|
$rtns["a6"] = $value->value;
|
|
$returns[] = $rtns;
|
|
}
|
|
|
|
|
|
}
|
|
|
|
echo json_encode($returns, JSON_UNESCAPED_SLASHES);
|
|
}
|
|
|
|
function riwayat_penyakit_keluarga($id) {
|
|
$sql = "SELECT So_ResultEntryFisikUmumDetails as result
|
|
FROM so_resultentry_fisik_umum
|
|
JOIN fisik_template ON So_ResultEntryFisikUmumFisikTemplateID = FisikTemplateID AND
|
|
FisikTemplateCode = 'RI10'
|
|
WHERE
|
|
So_ResultEntryFisikUmumSo_ResultEntryID = {$id} AND So_ResultEntryFisikUmumIsActive = 'Y'
|
|
LIMIT 1";
|
|
//echo $sql;
|
|
$qry = $this->db_smartone->query($sql);
|
|
if (! $qry) {
|
|
return json_encode(array());
|
|
}
|
|
//echo $this->db_smartone->last_query();
|
|
$row_result = $qry->row_array();
|
|
$arr_result = json_decode($row_result['result']);
|
|
$rtns = [];
|
|
$returns = [];
|
|
foreach ($arr_result->details as $key => $value) {
|
|
if($key % 2 === 0){
|
|
$rtns = [];
|
|
$rtns["a1"] = $value->chx?'Y':'N';
|
|
$rtns["a2"] = $value->label;
|
|
$rtns["a3"] = $value->value;
|
|
}else{
|
|
$rtns["a4"] = $value->chx?'Y':'N';
|
|
$rtns["a5"] = $value->label;
|
|
$rtns["a6"] = $value->value;
|
|
$returns[] = $rtns;
|
|
}
|
|
|
|
|
|
}
|
|
|
|
echo json_encode($returns, JSON_UNESCAPED_SLASHES);
|
|
}
|
|
|
|
|
|
function riwayat_sosial($id) {
|
|
$sql = "SELECT So_ResultEntryFisikUmumDetails as result
|
|
FROM so_resultentry_fisik_umum
|
|
JOIN fisik_template ON So_ResultEntryFisikUmumFisikTemplateID = FisikTemplateID AND
|
|
FisikTemplateCode = 'RI11'
|
|
WHERE
|
|
So_ResultEntryFisikUmumSo_ResultEntryID = {$id} AND So_ResultEntryFisikUmumIsActive = 'Y'
|
|
LIMIT 1";
|
|
//echo $sql;
|
|
$qry = $this->db_smartone->query($sql);
|
|
if (! $qry) {
|
|
return json_encode(array());
|
|
}
|
|
//echo $this->db_smartone->last_query();
|
|
$row_result = $qry->row_array();
|
|
$arr_result = json_decode($row_result['result']);
|
|
$rtns = [];
|
|
$returns = [];
|
|
foreach ($arr_result->details as $key => $value) {
|
|
if($key % 2 === 0){
|
|
$rtns = [];
|
|
$rtns["a1"] = $value->chx?'Y':'N';
|
|
$rtns["a2"] = $value->label;
|
|
$rtns["a3"] = $value->value;
|
|
}else{
|
|
$rtns["a4"] = $value->chx?'Y':'N';
|
|
$rtns["a5"] = $value->label;
|
|
$rtns["a6"] = $value->value;
|
|
$rtns["a7"] = isset($value->value1)?$value->value1:'';
|
|
$rtns["a8"] = isset($value->value2)?$value->value2:'';
|
|
|
|
$returns[] = $rtns;
|
|
}
|
|
|
|
|
|
}
|
|
|
|
echo json_encode($returns, JSON_UNESCAPED_SLASHES);
|
|
}
|
|
|
|
function hitung_bmi($bb,$tb,$standart_bmi){
|
|
$tb = $tb/100;
|
|
$bmi = '';
|
|
$bmi = $bb / ($tb * $tb);
|
|
$bmi_valuex = number_format($bmi,2);
|
|
$classs = "Undefined";
|
|
|
|
if($standart_bmi === 'asia_pacific'){
|
|
if($bmi_valuex < 18.5)
|
|
$classs = 'Underweight';
|
|
|
|
if($bmi_valuex >= 18.5 && $bmi_valuex < 23)
|
|
$classs = 'Normal';
|
|
|
|
if($bmi_valuex >= 23 && $bmi_valuex < 25)
|
|
$classs = 'Overweight';
|
|
|
|
if($bmi_valuex >= 25 && $bmi_valuex < 30)
|
|
$classs = 'Obese I';
|
|
|
|
if($bmi_valuex >= 30)
|
|
$classs = 'Obese II';
|
|
}
|
|
|
|
if($standart_bmi === 'who'){
|
|
if($bmi_valuex < 18.5)
|
|
$classs = 'Underweight';
|
|
|
|
if($bmi_valuex >= 18.5 && $bmi_valuex < 25){
|
|
$classs = 'Normal';
|
|
}
|
|
|
|
if($bmi_valuex >= 25 && $bmi_valuex < 30){
|
|
$classs = 'Overweight';
|
|
}
|
|
|
|
if($bmi_valuex >= 30)
|
|
$classs = 'Obese';
|
|
}
|
|
|
|
if($standart_bmi === 'kemenkes'){
|
|
if($bmi_valuex < 18.5)
|
|
$classs = 'Underweight';
|
|
|
|
if($bmi_valuex >= 18.5 && $bmi_valuex < 25.1)
|
|
$classs = 'Normal';
|
|
|
|
if($bmi_valuex >= 25.1 && $bmi_valuex < 27)
|
|
$classs = 'Overweight';
|
|
|
|
if($bmi_valuex >= 27)
|
|
$classs = 'Obese';
|
|
}
|
|
|
|
return array(
|
|
'bmi' => $bmi_valuex,
|
|
'class' => $classs
|
|
);
|
|
}
|
|
|
|
function klasifikasi_bmi($bmi){
|
|
$standart_bmi = 'asia_pacific';
|
|
$bmi_valuex = number_format($bmi,2);
|
|
$classs = "Undefined";
|
|
|
|
if($standart_bmi === 'asia_pacific'){
|
|
if($bmi_valuex < 18.5)
|
|
$classs = 'Underweight';
|
|
|
|
if($bmi_valuex >= 18.5 && $bmi_valuex < 23)
|
|
$classs = 'Normal';
|
|
|
|
if($bmi_valuex >= 23 && $bmi_valuex < 25)
|
|
$classs = 'Overweight';
|
|
|
|
if($bmi_valuex >= 25 && $bmi_valuex < 30)
|
|
$classs = 'Obese I';
|
|
|
|
if($bmi_valuex >= 30)
|
|
$classs = 'Obese II';
|
|
}
|
|
|
|
if($standart_bmi === 'who'){
|
|
if($bmi_valuex < 18.5)
|
|
$classs = 'Underweight';
|
|
|
|
if($bmi_valuex >= 18.5 && $bmi_valuex < 25){
|
|
$classs = 'Normal';
|
|
}
|
|
|
|
if($bmi_valuex >= 25 && $bmi_valuex < 30){
|
|
$classs = 'Overweight';
|
|
}
|
|
|
|
if($bmi_valuex >= 30)
|
|
$classs = 'Obese';
|
|
}
|
|
|
|
if($standart_bmi === 'kemenkes'){
|
|
if($bmi_valuex < 18.5)
|
|
$classs = 'Underweight';
|
|
|
|
if($bmi_valuex >= 18.5 && $bmi_valuex < 25.1)
|
|
$classs = 'Normal';
|
|
|
|
if($bmi_valuex >= 25.1 && $bmi_valuex < 27)
|
|
$classs = 'Overweight';
|
|
|
|
if($bmi_valuex >= 27)
|
|
$classs = 'Obese';
|
|
}
|
|
|
|
return $classs;
|
|
}
|
|
|
|
function postur_tubuh($id) {
|
|
$sql = "SELECT *
|
|
FROM so_resultentry
|
|
JOIN t_samplingso_additional_fisik_bbtb ON T_SamplingAdditionalFisikBBTBT_OrderHeaderID = So_ResultEntryT_OrderHeaderID AND
|
|
T_SamplingAdditionalFisikBBTBIsActive = 'Y'
|
|
JOIN so_resultentry_fisik_umum ON So_ResultEntryFisikUmumSo_ResultEntryID = So_ResultEntryID AND
|
|
So_ResultEntryFisikUmumIsActive = 'Y' AND So_ResultEntryFisikUmumFisikTemplateID = 24
|
|
WHERE
|
|
So_ResultEntryID = {$id} AND So_ResultEntryNonlab_TemplateID = '27' AND So_ResultEntryIsActive = 'Y'
|
|
LIMIT 1";
|
|
//echo $sql;
|
|
$qry = $this->db_smartone->query($sql);
|
|
if (! $qry) {
|
|
return json_encode(array());
|
|
}
|
|
//echo $this->db_smartone->last_query();
|
|
$row_result = $qry->row_array();
|
|
$arr_result = json_decode($row_result['So_ResultEntryFisikUmumDetails']);
|
|
$lingkar_perut = '';
|
|
$lingkar_pinggang = '';
|
|
$bb = $row_result['T_SamplingAdditionalFisikBBTBValueBB'];
|
|
$tb = $row_result['T_SamplingAdditionalFisikBBTBValueTB'];
|
|
$standart_bmi = $row_result['T_SamplingAdditionalFisikBBTBStandart'];
|
|
$get_bmi = $this->hitung_bmi($bb,$tb,$standart_bmi);
|
|
$bmi = $get_bmi['bmi'];
|
|
$standart_text = "Standart ".ucwords(str_replace("_"," ",$standart_bmi));
|
|
$classification = $get_bmi['class'];
|
|
|
|
foreach ($arr_result->details as $key => $value) {
|
|
if($value->name == 'Pengukuran'){
|
|
$lingkar_perut = $value->details[0]->value." ".$value->details[0]->unit;
|
|
$lingkar_pinggang = $value->details[1];
|
|
}
|
|
}
|
|
|
|
$rtn['a1'] = $tb;
|
|
$rtn['a2'] = $bb;
|
|
$rtn['a3'] = $lingkar_perut;
|
|
$rtn['a4'] = $bmi;
|
|
$rtn['a5'] = $classification;
|
|
$rtns[] = $rtn;
|
|
|
|
echo json_encode($rtns, JSON_UNESCAPED_SLASHES);
|
|
}
|
|
|
|
|
|
function tanda_vital($id) {
|
|
$sql = "SELECT So_ResultEntryFisikUmumDetails as result
|
|
FROM so_resultentry_fisik_umum
|
|
JOIN fisik_template ON So_ResultEntryFisikUmumFisikTemplateID = FisikTemplateID AND
|
|
FisikTemplateCode = 'FI00'
|
|
WHERE
|
|
So_ResultEntryFisikUmumSo_ResultEntryID = {$id} AND So_ResultEntryFisikUmumIsActive = 'Y'
|
|
LIMIT 1";
|
|
//echo $sql;
|
|
$qry = $this->db_smartone->query($sql);
|
|
if (! $qry) {
|
|
return json_encode(array());
|
|
}
|
|
//echo $this->db_smartone->last_query();
|
|
$row_result = $qry->row_array();
|
|
$arr_result = json_decode($row_result['result']);
|
|
$rtns = [];
|
|
$returns = [];
|
|
$details = $arr_result->details;
|
|
//print_r($arr_result);
|
|
|
|
$standart = $details[0]->standart;
|
|
$diastole = $details[0]->value_y;
|
|
$sistole = $details[0]->value_x;
|
|
$suhu = $details[1]->value;
|
|
$denyut_nadi = $details[2]->value;
|
|
//$ritme_denyut_nadi = $details[2]->value;
|
|
$laju_pernafasan = $details[4]->value;
|
|
//$pola_nafas = $details[4]->value;
|
|
|
|
$rtn['a1'] = $sistole;
|
|
$rtn['a2'] = $diastole;
|
|
$rtn['a3'] = $denyut_nadi;
|
|
$rtn['a4'] = $laju_pernafasan;
|
|
$rtn['a5'] = $suhu;
|
|
$rtns[] = $rtn;
|
|
|
|
|
|
echo json_encode($rtns, JSON_UNESCAPED_SLASHES);
|
|
}
|
|
|
|
function kulit($id){
|
|
$sql = "SELECT So_ResultEntryFisikUmumDetails as result
|
|
FROM so_resultentry_fisik_umum
|
|
JOIN fisik_template ON So_ResultEntryFisikUmumFisikTemplateID = FisikTemplateID AND
|
|
FisikTemplateCode = 'FI151'
|
|
WHERE
|
|
So_ResultEntryFisikUmumSo_ResultEntryID = {$id} AND So_ResultEntryFisikUmumIsActive = 'Y'
|
|
LIMIT 1";
|
|
//echo $sql;
|
|
$qry = $this->db_smartone->query($sql);
|
|
if (! $qry) {
|
|
return json_encode(array());
|
|
}
|
|
//echo $this->db_smartone->last_query();
|
|
$row_result_kulit = $qry->row_array();
|
|
$arr_result_kulit = json_decode($row_result_kulit['result']);
|
|
$is_normal = "N";
|
|
$keterangan_kulit = '';
|
|
$rtn = [];
|
|
//echo json_encode($arr_result_kulit->details[0]->details);
|
|
foreach ($arr_result_kulit->details[0]->details as $key => $value) {
|
|
if($value->chx){
|
|
if($value->is_normal == 'Y')
|
|
$is_normal = "Y";
|
|
else{
|
|
if($keterangan_kulit != '')
|
|
$keterangan_kulit .= ', ';
|
|
|
|
$ket = $value->value?" (".$value->value.") ":'';
|
|
$keterangan_kulit .= $value->label.$ket;
|
|
}
|
|
}
|
|
}
|
|
$rtn = array(
|
|
"a1" => $arr_result_kulit->details[0]->name,
|
|
"a2" => $is_normal == "Y"?"Y":"N",
|
|
"a3" => $is_normal == "N"?"Y":"N",
|
|
"a4" => $keterangan_kulit
|
|
);
|
|
|
|
return $rtn;
|
|
}
|
|
|
|
function kepala($id){
|
|
$sql = "SELECT So_ResultEntryFisikUmumDetails as result
|
|
FROM so_resultentry_fisik_umum
|
|
JOIN fisik_template ON So_ResultEntryFisikUmumFisikTemplateID = FisikTemplateID AND
|
|
FisikTemplateCode = 'FI03'
|
|
WHERE
|
|
So_ResultEntryFisikUmumSo_ResultEntryID = {$id} AND So_ResultEntryFisikUmumIsActive = 'Y'
|
|
LIMIT 1";
|
|
//echo $sql;
|
|
$qry = $this->db_smartone->query($sql);
|
|
if (! $qry) {
|
|
return json_encode(array());
|
|
}
|
|
//echo $this->db_smartone->last_query();
|
|
$row_result = $qry->row_array();
|
|
$arr_result = json_decode($row_result['result']);
|
|
$is_normal = "N";
|
|
$keterangan = '';
|
|
$rtn = [];
|
|
//echo json_encode($arr_result_kulit->details[0]->details);
|
|
foreach ($arr_result->details as $key => $value) {
|
|
if($value->chx){
|
|
if($value->is_normal == 'Y')
|
|
$is_normal = "Y";
|
|
else{
|
|
if($keterangan != '')
|
|
$keterangan .= ', ';
|
|
|
|
$ket = $value->value?" (".$value->value.") ":'';
|
|
$keterangan .= $value->label.$ket;
|
|
}
|
|
}
|
|
}
|
|
$rtn = array(
|
|
"a1" => "Kepala",
|
|
"a2" => $is_normal == "Y"?"Y":"N",
|
|
"a3" => $is_normal == "N"?"Y":"N",
|
|
"a4" => $keterangan
|
|
);
|
|
|
|
//echo json_encode($rtn);
|
|
return $rtn;
|
|
}
|
|
|
|
function mata($id){
|
|
$sql = "SELECT So_ResultEntryFisikUmumDetails as result
|
|
FROM so_resultentry_fisik_umum
|
|
JOIN fisik_template ON So_ResultEntryFisikUmumFisikTemplateID = FisikTemplateID AND
|
|
FisikTemplateCode = 'FI04'
|
|
WHERE
|
|
So_ResultEntryFisikUmumSo_ResultEntryID = {$id} AND So_ResultEntryFisikUmumIsActive = 'Y'
|
|
LIMIT 1";
|
|
//echo $sql;
|
|
$qry = $this->db_smartone->query($sql);
|
|
if (! $qry) {
|
|
return json_encode(array());
|
|
}
|
|
//echo $this->db_smartone->last_query();
|
|
$row_result = $qry->row_array();
|
|
$arr_result = json_decode($row_result['result']);
|
|
$is_normal = "N";
|
|
$keterangan = '';
|
|
$rtn = [];
|
|
//echo json_encode($arr_result_kulit->details[0]->details);
|
|
foreach ($arr_result->details as $key => $value) {
|
|
if($value->chx){
|
|
if($value->is_normal == 'Y')
|
|
$is_normal = "Y";
|
|
else{
|
|
if($keterangan != '')
|
|
$keterangan .= ', ';
|
|
|
|
$ket = $value->value?" (".$value->value.") ":'';
|
|
$keterangan .= $value->label.$ket;
|
|
}
|
|
}
|
|
}
|
|
$rtn = array(
|
|
"a1" => "Mata",
|
|
"a2" => $is_normal == "Y"?"Y":"N",
|
|
"a3" => $is_normal == "N"?"Y":"N",
|
|
"a4" => $keterangan
|
|
);
|
|
|
|
//echo json_encode($rtn);
|
|
return $rtn;
|
|
}
|
|
|
|
function telinga($id){
|
|
$sql = "SELECT So_ResultEntryFisikUmumDetails as result
|
|
FROM so_resultentry_fisik_umum
|
|
JOIN fisik_template ON So_ResultEntryFisikUmumFisikTemplateID = FisikTemplateID AND
|
|
FisikTemplateCode = 'FI07'
|
|
WHERE
|
|
So_ResultEntryFisikUmumSo_ResultEntryID = {$id} AND So_ResultEntryFisikUmumIsActive = 'Y'
|
|
LIMIT 1";
|
|
//echo $sql;
|
|
$qry = $this->db_smartone->query($sql);
|
|
if (! $qry) {
|
|
return json_encode(array());
|
|
}
|
|
//echo $this->db_smartone->last_query();
|
|
$row_result = $qry->row_array();
|
|
$arr_result = json_decode($row_result['result']);
|
|
$is_normal = "N";
|
|
$keterangan = '';
|
|
$rtn = [];
|
|
//echo json_encode($arr_result_kulit->details[0]->details);
|
|
foreach ($arr_result->details as $key => $value) {
|
|
if($value->chx){
|
|
if($value->is_normal == 'Y')
|
|
$is_normal = "Y";
|
|
else{
|
|
if($keterangan != '')
|
|
$keterangan .= ', ';
|
|
|
|
$ket = $value->value?" (".$value->value.") ":'';
|
|
$keterangan .= $value->label.$ket;
|
|
}
|
|
}
|
|
}
|
|
$rtn = array(
|
|
"a1" => "Telinga",
|
|
"a2" => $is_normal == "Y"?"Y":"N",
|
|
"a3" => $is_normal == "N"?"Y":"N",
|
|
"a4" => $keterangan
|
|
);
|
|
|
|
//echo json_encode($rtn);
|
|
return $rtn;
|
|
}
|
|
|
|
function hidung($id){
|
|
$sql = "SELECT So_ResultEntryFisikUmumDetails as result
|
|
FROM so_resultentry_fisik_umum
|
|
JOIN fisik_template ON So_ResultEntryFisikUmumFisikTemplateID = FisikTemplateID AND
|
|
FisikTemplateCode = 'FI08'
|
|
WHERE
|
|
So_ResultEntryFisikUmumSo_ResultEntryID = {$id} AND So_ResultEntryFisikUmumIsActive = 'Y'
|
|
LIMIT 1";
|
|
//echo $sql;
|
|
$qry = $this->db_smartone->query($sql);
|
|
if (! $qry) {
|
|
return json_encode(array());
|
|
}
|
|
//echo $this->db_smartone->last_query();
|
|
$row_result = $qry->row_array();
|
|
$arr_result = json_decode($row_result['result']);
|
|
$is_normal = "N";
|
|
$keterangan = '';
|
|
$rtn = [];
|
|
//echo json_encode($arr_result_kulit->details[0]->details);
|
|
foreach ($arr_result->details as $key => $value) {
|
|
if($value->chx){
|
|
if($value->is_normal == 'Y')
|
|
$is_normal = "Y";
|
|
else{
|
|
if($keterangan != '')
|
|
$keterangan .= ', ';
|
|
|
|
$ket = $value->value?" (".$value->value.") ":'';
|
|
$keterangan .= $value->label.$ket;
|
|
}
|
|
}
|
|
}
|
|
$rtn = array(
|
|
"a1" => "Hidung",
|
|
"a2" => $is_normal == "Y"?"Y":"N",
|
|
"a3" => $is_normal == "N"?"Y":"N",
|
|
"a4" => $keterangan
|
|
);
|
|
|
|
//echo json_encode($rtn);
|
|
return $rtn;
|
|
}
|
|
|
|
function mulut($id){
|
|
$sql = "SELECT So_ResultEntryFisikUmumDetails as result
|
|
FROM so_resultentry_fisik_umum
|
|
JOIN fisik_template ON So_ResultEntryFisikUmumFisikTemplateID = FisikTemplateID AND
|
|
FisikTemplateCode = 'FI10'
|
|
WHERE
|
|
So_ResultEntryFisikUmumSo_ResultEntryID = {$id} AND So_ResultEntryFisikUmumIsActive = 'Y'
|
|
LIMIT 1";
|
|
//echo $sql;
|
|
$qry = $this->db_smartone->query($sql);
|
|
if (! $qry) {
|
|
return json_encode(array());
|
|
}
|
|
//echo $this->db_smartone->last_query();
|
|
$row_result = $qry->row_array();
|
|
$arr_result = json_decode($row_result['result']);
|
|
$is_normal = "N";
|
|
$keterangan = '';
|
|
$rtn = [];
|
|
//echo json_encode($arr_result_kulit->details[0]->details);
|
|
foreach ($arr_result->details[0]->details as $key => $value) {
|
|
if($value->chx){
|
|
if($value->is_normal == 'Y')
|
|
$is_normal = "Y";
|
|
else{
|
|
if($keterangan != '')
|
|
$keterangan .= ', ';
|
|
|
|
$ket = $value->value?" (".$value->value.") ":'';
|
|
$keterangan .= $value->label.$ket;
|
|
}
|
|
}
|
|
}
|
|
|
|
foreach ($arr_result->details[1]->details as $key => $value) {
|
|
if($value->chx){
|
|
if($value->is_normal == 'Y')
|
|
$is_normal = "Y";
|
|
else{
|
|
if($keterangan != '')
|
|
$keterangan .= ', ';
|
|
|
|
$ket = $value->value?" (".$value->value.") ":'';
|
|
$keterangan .= $value->label.$ket;
|
|
}
|
|
}
|
|
}
|
|
|
|
$rtn = array(
|
|
"a1" => "Mulut",
|
|
"a2" => $is_normal == "Y"?"Y":"N",
|
|
"a3" => $is_normal == "N"?"Y":"N",
|
|
"a4" => $keterangan
|
|
);
|
|
|
|
//echo json_encode($rtn);
|
|
return $rtn;
|
|
}
|
|
|
|
function leher($id){
|
|
$sql = "SELECT So_ResultEntryFisikUmumDetails as result
|
|
FROM so_resultentry_fisik_umum
|
|
JOIN fisik_template ON So_ResultEntryFisikUmumFisikTemplateID = FisikTemplateID AND
|
|
FisikTemplateCode = 'FI11'
|
|
WHERE
|
|
So_ResultEntryFisikUmumSo_ResultEntryID = {$id} AND So_ResultEntryFisikUmumIsActive = 'Y'
|
|
LIMIT 1";
|
|
//echo $sql;
|
|
$qry = $this->db_smartone->query($sql);
|
|
if (! $qry) {
|
|
return json_encode(array());
|
|
}
|
|
//echo $this->db_smartone->last_query();
|
|
$row_result = $qry->row_array();
|
|
$arr_result = json_decode($row_result['result']);
|
|
$is_normal = "N";
|
|
$keterangan = '';
|
|
$rtn = [];
|
|
//echo json_encode($arr_result_kulit->details[0]->details);
|
|
foreach ($arr_result->details as $key => $value) {
|
|
if($value->chx){
|
|
if($value->is_normal == 'Y')
|
|
$is_normal = "Y";
|
|
else{
|
|
if($keterangan != '')
|
|
$keterangan .= ', ';
|
|
|
|
$ket = $value->value?" (".$value->value.") ":'';
|
|
$keterangan .= $value->label.$ket;
|
|
}
|
|
}
|
|
}
|
|
$rtn = array(
|
|
"a1" => "Leher",
|
|
"a2" => $is_normal == "Y"?"Y":"N",
|
|
"a3" => $is_normal == "N"?"Y":"N",
|
|
"a4" => $keterangan
|
|
);
|
|
|
|
//echo json_encode($rtn);
|
|
return $rtn;
|
|
}
|
|
|
|
function inspeksi_palpasi($id){
|
|
$rtn = [];
|
|
$rtn[] = $this->kulit($id);
|
|
$rtn[] = $this->kepala($id);
|
|
$rtn[] = $this->mata($id);
|
|
$rtn[] = $this->telinga($id);
|
|
$rtn[] = $this->hidung($id);
|
|
$rtn[] = $this->mulut($id);
|
|
$rtn[] = $this->leher($id);
|
|
echo json_encode($rtn);
|
|
}
|
|
|
|
function dada($id){
|
|
$sql = "SELECT So_ResultEntryFisikUmumDetails as result
|
|
FROM so_resultentry_fisik_umum
|
|
JOIN fisik_template ON So_ResultEntryFisikUmumFisikTemplateID = FisikTemplateID AND
|
|
FisikTemplateCode = 'FI12'
|
|
WHERE
|
|
So_ResultEntryFisikUmumSo_ResultEntryID = {$id} AND So_ResultEntryFisikUmumIsActive = 'Y'
|
|
LIMIT 1";
|
|
//echo $sql;
|
|
$qry = $this->db_smartone->query($sql);
|
|
if (! $qry) {
|
|
return json_encode(array());
|
|
}
|
|
//echo $this->db_smartone->last_query();
|
|
$row_result = $qry->row_array();
|
|
$arr_result = json_decode($row_result['result']);
|
|
$is_normal = "N";
|
|
$keterangan = '';
|
|
$rtn = [];
|
|
//echo json_encode($arr_result_kulit->details[0]->details);
|
|
foreach ($arr_result->details as $key => $value) {
|
|
if($value->chx){
|
|
if($value->is_normal == 'Y')
|
|
$is_normal = "Y";
|
|
else{
|
|
if($keterangan != '')
|
|
$keterangan .= ', ';
|
|
|
|
$ket = $value->value?" (".$value->value.") ":'';
|
|
$keterangan .= $value->label.$ket;
|
|
}
|
|
}
|
|
}
|
|
$rtn = array(
|
|
"a1" => "Dada",
|
|
"a2" => $is_normal == "Y"?"Y":"N",
|
|
"a3" => $is_normal == "N"?"Y":"N",
|
|
"a4" => $keterangan
|
|
);
|
|
|
|
//echo json_encode($rtn);
|
|
return $rtn;
|
|
}
|
|
|
|
function paru($id){
|
|
$sql = "SELECT So_ResultEntryFisikUmumDetails as result
|
|
FROM so_resultentry_fisik_umum
|
|
JOIN fisik_template ON So_ResultEntryFisikUmumFisikTemplateID = FisikTemplateID AND
|
|
FisikTemplateCode = 'FI13'
|
|
WHERE
|
|
So_ResultEntryFisikUmumSo_ResultEntryID = {$id} AND So_ResultEntryFisikUmumIsActive = 'Y'
|
|
LIMIT 1";
|
|
//echo $sql;
|
|
$qry = $this->db_smartone->query($sql);
|
|
if (! $qry) {
|
|
return json_encode(array());
|
|
}
|
|
//echo $this->db_smartone->last_query();
|
|
$row_result = $qry->row_array();
|
|
$arr_result = json_decode($row_result['result']);
|
|
$is_normal = "N";
|
|
$keterangan = '';
|
|
$rtn = [];
|
|
//echo json_encode($arr_result_kulit->details[0]->details);
|
|
foreach ($arr_result->details as $key => $value) {
|
|
if($value->chx){
|
|
if($value->is_normal == 'Y')
|
|
$is_normal = "Y";
|
|
else{
|
|
if($keterangan != '')
|
|
$keterangan .= ', ';
|
|
|
|
$ket = $value->value?" (".$value->value.") ":'';
|
|
$keterangan .= $value->label.$ket;
|
|
}
|
|
}
|
|
}
|
|
$rtn = array(
|
|
"a1" => "Paru",
|
|
"a2" => $is_normal == "Y"?"Y":"N",
|
|
"a3" => $is_normal == "N"?"Y":"N",
|
|
"a4" => $keterangan
|
|
);
|
|
|
|
//echo json_encode($rtn);
|
|
return $rtn;
|
|
}
|
|
|
|
function jantung($id){
|
|
$sql = "SELECT So_ResultEntryFisikUmumDetails as result
|
|
FROM so_resultentry_fisik_umum
|
|
JOIN fisik_template ON So_ResultEntryFisikUmumFisikTemplateID = FisikTemplateID AND
|
|
FisikTemplateCode = 'FI14'
|
|
WHERE
|
|
So_ResultEntryFisikUmumSo_ResultEntryID = {$id} AND So_ResultEntryFisikUmumIsActive = 'Y'
|
|
LIMIT 1";
|
|
//echo $sql;
|
|
$qry = $this->db_smartone->query($sql);
|
|
if (! $qry) {
|
|
return json_encode(array());
|
|
}
|
|
//echo $this->db_smartone->last_query();
|
|
$row_result = $qry->row_array();
|
|
$arr_result = json_decode($row_result['result']);
|
|
$is_normal = "N";
|
|
$keterangan = '';
|
|
$rtn = [];
|
|
//echo json_encode($arr_result_kulit->details[0]->details);
|
|
foreach ($arr_result->details as $key => $value) {
|
|
$name = $value->name;
|
|
foreach ($value->details as $k => $v) {
|
|
if($v->chx){
|
|
if($v->is_normal == 'Y')
|
|
$is_normal = "Y";
|
|
else{
|
|
if($keterangan != '')
|
|
$keterangan .= ', ';
|
|
|
|
$ket = $v->value?" (".$v->value.") ":'';
|
|
$keterangan .= $name." : ".$v->label.$ket;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
$rtn = array(
|
|
"a1" => "Jantung",
|
|
"a2" => $is_normal == "Y"?"Y":"N",
|
|
"a3" => $is_normal == "N"?"Y":"N",
|
|
"a4" => $keterangan
|
|
);
|
|
|
|
//echo json_encode($rtn);
|
|
return $rtn;
|
|
}
|
|
|
|
function pemeriksaan_dada($id){
|
|
$rtn = [];
|
|
$rtn[] = $this->dada($id);
|
|
$rtn[] = $this->paru($id);
|
|
$rtn[] = $this->jantung($id);
|
|
echo json_encode($rtn);
|
|
}
|
|
|
|
function perut($id){
|
|
$sql = "SELECT So_ResultEntryFisikUmumDetails as result
|
|
FROM so_resultentry_fisik_umum
|
|
JOIN fisik_template ON So_ResultEntryFisikUmumFisikTemplateID = FisikTemplateID AND
|
|
FisikTemplateCode = 'FI15'
|
|
WHERE
|
|
So_ResultEntryFisikUmumSo_ResultEntryID = {$id} AND So_ResultEntryFisikUmumIsActive = 'Y'
|
|
LIMIT 1";
|
|
//echo $sql;
|
|
$qry = $this->db_smartone->query($sql);
|
|
if (! $qry) {
|
|
return json_encode(array());
|
|
}
|
|
//echo $this->db_smartone->last_query();
|
|
$row_result = $qry->row_array();
|
|
$arr_result = json_decode($row_result['result']);
|
|
$is_normal = "N";
|
|
$keterangan = '';
|
|
$rtn = [];
|
|
//echo json_encode($arr_result_kulit->details[0]->details);
|
|
foreach ($arr_result->details as $key => $value) {
|
|
$name = $value->name;
|
|
if($name != 'Hernia'){
|
|
foreach ($value->details as $k => $v) {
|
|
if($v->chx){
|
|
if($v->is_normal == 'Y' || $v->label == 'Tidak Ada')
|
|
$is_normal = "Y";
|
|
else{
|
|
$is_normal = "N";
|
|
if($keterangan != '')
|
|
$keterangan .= ', ';
|
|
|
|
$ket = $v->value?" (".$v->value.") ":'';
|
|
$keterangan .= $name." : ".$v->label.$ket;
|
|
}
|
|
}
|
|
}
|
|
}else{
|
|
foreach ($value->details as $k => $v) {
|
|
if($v->chx){
|
|
if($v->is_normal == 'Y')
|
|
$is_normal = "Y";
|
|
else{
|
|
$is_normal = "N";
|
|
$umbilukus_chx = $v->details[0]->chx_value;
|
|
if($umbilukus_chx){
|
|
if($keterangan != '')
|
|
$keterangan .= ', ';
|
|
|
|
$keterangan .= $v->details[0]->label;
|
|
}
|
|
|
|
$inguinal_chx_a = $v->details[1]->chx_a_value;
|
|
$inguinal_chx_b = $v->details[1]->chx_b_value;
|
|
if($inguinal_chx_a || $inguinal_chx_b){
|
|
if($inguinal_chx_a){
|
|
if($keterangan != '')
|
|
$keterangan .= ', ';
|
|
|
|
$keterangan .= $v->details[1]->label." (".$v->details[1]->chx_a_label.")";
|
|
}
|
|
|
|
if($inguinal_chx_b){
|
|
if($keterangan != '')
|
|
$keterangan .= ', ';
|
|
|
|
$keterangan .= $v->details[1]->label." (".$v->details[1]->chx_b_label.")";
|
|
}
|
|
}
|
|
|
|
$scrotum_chx_a = $v->details[2]->chx_a_value;
|
|
$scrotum_chx_b = $v->details[2]->chx_b_value;
|
|
if($scrotum_chx_a || $scrotum_chx_b){
|
|
if($scrotum_chx_a){
|
|
if($keterangan != '')
|
|
$keterangan .= ', ';
|
|
|
|
$keterangan .= $v->details[2]->label." (".$v->details[2]->chx_a_label.")";
|
|
}
|
|
|
|
if($scrotum_chx_b){
|
|
if($keterangan != '')
|
|
$keterangan .= ', ';
|
|
|
|
$keterangan .= $v->details[2]->label." (".$v->details[2]->chx_b_label.")";
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|
|
$rtn = array(
|
|
"a1" => "Perut",
|
|
"a2" => $is_normal == "Y"?"Y":"N",
|
|
"a3" => $is_normal == "N"?"Y":"N",
|
|
"a4" => $keterangan
|
|
);
|
|
$returns[] = $rtn;
|
|
|
|
echo json_encode($returns);
|
|
//return $rtn;
|
|
}
|
|
|
|
function rectum_urogenital($id){
|
|
$sql = "SELECT So_ResultEntryFisikUmumDetails as result
|
|
FROM so_resultentry_fisik_umum
|
|
JOIN fisik_template ON So_ResultEntryFisikUmumFisikTemplateID = FisikTemplateID AND
|
|
FisikTemplateCode = 'RI13'
|
|
WHERE
|
|
So_ResultEntryFisikUmumSo_ResultEntryID = {$id} AND So_ResultEntryFisikUmumIsActive = 'Y'
|
|
LIMIT 1";
|
|
//echo $sql;
|
|
$qry = $this->db_smartone->query($sql);
|
|
if (! $qry) {
|
|
return json_encode(array());
|
|
}
|
|
//echo $this->db_smartone->last_query();
|
|
$row_result = $qry->row_array();
|
|
$arr_result = json_decode($row_result['result']);
|
|
$keterangan = '';
|
|
$rtn = [];
|
|
//echo json_encode($arr_result_kulit->details[0]->details);
|
|
foreach ($arr_result->details as $key => $value) {
|
|
$is_normal = "Y";
|
|
if($value->chx){
|
|
$is_normal = "N";
|
|
if($keterangan != '')
|
|
$keterangan .= ', ';
|
|
|
|
$ket = $value->value?" (".$value->value.") ":'';
|
|
$keterangan .= $value->label.$ket;
|
|
}
|
|
$ret = array(
|
|
"a1" => $value->label,
|
|
"a2" => $is_normal == "Y"?"Y":"N",
|
|
"a3" => $is_normal == "N"?"Y":"N",
|
|
"a4" => $keterangan
|
|
);
|
|
$rtn[] = $ret;
|
|
$keterangan = '';
|
|
}
|
|
|
|
|
|
|
|
echo json_encode($rtn);
|
|
//return $rtn;
|
|
}
|
|
|
|
|
|
function ekstremitas($id,$type){
|
|
$sql = "SELECT So_ResultEntryFisikUmumDetails as result
|
|
FROM so_resultentry_fisik_umum
|
|
JOIN fisik_template ON So_ResultEntryFisikUmumFisikTemplateID = FisikTemplateID AND
|
|
FisikTemplateCode = 'RI12'
|
|
WHERE
|
|
So_ResultEntryFisikUmumSo_ResultEntryID = {$id} AND So_ResultEntryFisikUmumIsActive = 'Y'
|
|
LIMIT 1";
|
|
//echo $sql;
|
|
$qry = $this->db_smartone->query($sql);
|
|
if (! $qry) {
|
|
return json_encode(array());
|
|
}
|
|
//echo $this->db_smartone->last_query();
|
|
$row_result = $qry->row_array();
|
|
$arr_result = json_decode($row_result['result']);
|
|
$is_normal = "N";
|
|
$keterangan = '';
|
|
$rtn = [];
|
|
if($type == 'otot'){
|
|
foreach ($arr_result->details as $key => $value) {
|
|
if($key <= 3){
|
|
$ret = [];
|
|
$ret['a1'] = $value->label;
|
|
foreach ($value->details as $k => $v) {
|
|
if($v->chx)
|
|
$ret['a2'] = $v->label;
|
|
}
|
|
$rtn[] = $ret;
|
|
}
|
|
|
|
}
|
|
}
|
|
if($type == 'disabilitas'){
|
|
foreach ($arr_result->details as $key => $value) {
|
|
if($key == 4 || $key == 5){
|
|
$ret = [];
|
|
$ret['a1'] = $value->label;
|
|
$ret['a2'] = $value->details[0]->chx?"Y":"N";
|
|
$ret['a3'] = $value->details[1]->chx?"Y":"N";
|
|
$rtn[] = $ret;
|
|
}
|
|
|
|
}
|
|
}
|
|
if($type == 'reflek'){
|
|
foreach ($arr_result->details as $key => $value) {
|
|
if($key == 6){
|
|
$ret = [];
|
|
$ret['a1'] = $value->label;
|
|
$ret['a2'] = $value->details[0]->chx?"Y":"N";
|
|
$ret['a3'] = $value->details[1]->chx?"Y":"N";
|
|
$rtn[] = $ret;
|
|
}
|
|
|
|
}
|
|
}
|
|
|
|
|
|
echo json_encode($rtn);
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
?>
|