db_smartone = $this->load->database("onedev", true); } function translate($langid,$label) { $sql = "select fn_get_translation(?,?) as result "; $qry = $this->db_smartone->query($sql, array($langid,$label)); if ($qry) { $rows = $qry->result_array(); if (count($rows) > 0 ) { return $rows[0]["result"]; } } return $label . "--"; } function pribadi($id,$langid,$type) { //$id = So_ResultEntryID $sql = "select concat(M_TitleLangName,' ', M_PatientName) M_PatientName, T_OrderHeaderLabNumber RegNo, fn_numbering_external(T_OrderHeaderLabNumber) ExternalRegNo, REPLACE(REPLACE(REPLACE(T_OrderHeaderM_PatientAge, 'tahun', 'year') , 'bulan', 'month') , 'hari', 'days') as T_OrderHeaderM_PatientAge, date_format(M_PatientDOB,'%d-%m-%Y') M_PatientDOB , date_format(T_OrderHeaderDate,'%d-%m-%Y') T_OrderHeaderDate, M_SexNameLang as M_SexName, (SELECT concat(M_PatientAddressDescription,' ',M_KelurahanName,' ' ,M_DistrictName,' ',M_CityName) from m_patientaddress AS p left join m_kelurahan on M_PatientAddressM_KelurahanID = M_KelurahanID left join m_district on M_KelurahanM_DistrictID = M_DistrictID left join m_city on M_DistrictM_CityID = M_CityID WHERE M_PatientAddressM_PatientID = M_PatientID ORDER BY M_PatientAddressM_PatientID LIMIT 1) AS M_PatientAddressDescription, (case when M_CompanyName = 'Pasien klinisi' then 'CLINICIAN REFERENCE' when M_CompanyName = 'Pasien mandiri' then 'PERSONAL REQUEST' else M_CompanyName end ) as M_CompanyName, S_SystemsCompanyName ,M_PatientNoReg, concat(S_SystemsCompanyAddress, ' ',S_SystemsCompanyCity,' ', 'Telp. ', S_SystemsCompanyPhone ) as alamatcabang, M_No_FormRev,S_SystemsCompanyCity, DATE_FORMAT(now(), '%d-%m-%Y' ) AS DATENOW, concat('http://localhost/one-api/v1/su/code128/?no=',M_PatientNoReg) aS Barcode, M_PatientHP ,CONCAT(p.M_DoctorPrefix, ' ',p.M_DoctorName, ' ',p.M_DoctorSufix) AS M_DoctorName, CONCAT(so.M_DoctorPrefix, ' ',so.M_DoctorName, ' ',so.M_DoctorSufix) AS dokterso, ifnull(`fn_get_mcu_saran`($id,$langid),'') as saran, ifnull(`fn_get_mcu_konsul`($id,$langid),'') as konsul, replace(concat('http://localhost/charts/qr.php?d=',CONCAT(so.M_DoctorPrefix,' ',so.M_DoctorName,' ',so.M_DoctorSufix,' ',so.M_DoctorSufix2),'^',DATE_FORMAT(now(), '%d-%m-%Y %T')),' ','+') AS qrcode , if( So_SignatureID is null , concat('http://localhost/one-ui/blank.png','?ts=yymmddhhnnss') , concat('http://localhost/', So_SignatureUrl,'?ts=yymmddhhnnss') )AS ttd from so_resultentry join t_orderheader on So_ResultEntryT_OrderHeaderID = T_OrderHeaderID and So_ResultEntryID = ? join m_patient on M_PatientID = T_OrderHeaderM_PatientID join m_title on M_PatientM_TitleID = M_TitleID left join m_sex on M_PatientM_SexID = M_SexID left join m_company ON T_OrderHeaderM_CompanyID = M_CompanyID AND M_CompanyIsActive = 'Y' left join m_doctor p ON T_OrderHeaderSenderM_DoctorID = p.M_DoctorID AND p.M_DoctorIsActive = 'Y' LEFT JOIN m_no_form on M_No_FormID > 0 and M_No_FormName = 'FISIK' left join conf_systems on S_SystemsID > 0 left join t_orderdetail on So_ResultEntryT_OrderDetailID = T_OrderDetailID and T_OrderDetailIsActive = 'Y' left join t_test ON T_TestID = T_OrderDetailT_TestID and T_TestIsActive = 'Y' left join t_samplingso on T_SamplingSoT_OrderHeaderID = T_OrderHeaderID and T_SamplingSoT_TestID = T_TestID left join m_doctor so on T_SamplingSoM_DoctorID = so.M_DoctorID left join so_signature on So_SignatureT_OrderHeaderID = T_OrderHeaderID and So_SignatureIsActive = 'Y' "; $qry = $this->db_smartone->query($sql,array($id)); if ($qry) { $rows = $qry->result_array(); foreach($rows as $idx => $r ) { $rows[$idx]["keluhan_saat_ini"] = $this->keluhan_saat_ini($id,$langid,$type); $rows[$idx]["phobia"] = $this->phobia($id,$langid,$type); $rows[$idx]["kesimpulan"] = $this->kesimpulanv4($id,$langid); } echo json_encode($rows); } else { echo json_encode(array()); } } function phobia($id,$langid,$type) { $sql = "select * from so_resultentry_fisik_umum where So_ResultEntryFisikUmumSo_ResultEntryID= ? and So_ResultEntryFisikUmumM_LangID=? and So_ResultEntryFisikUmumType=?"; $qry = $this->db_smartone->query($sql,array($id,$langid,$type)); if (! $qry) { return ""; } $rows = $qry->result_array(); if (count($rows) == 0 ) { return ""; } $details = json_decode($rows[0]["So_ResultEntryFisikUmumDetails"],true); //keluhan saat ini $phobia = ""; foreach($details as $d) { if ($d["title"] == "RIWAYAT POBIA") { if ($d["flag_normal"] == "Y") { $phobia = $d["label_flag_normal"]; break; } else { foreach($d["details"] as $xd) { if ($xd["chx"] == "1" ) { if ( $phobia != "" ) $phobia .= ", "; $phobia .= $xd["label"]; if ($xd["value"] != "") $phobia .= " (" .$xd["value"] . ")"; } } } } } return $phobia; } function keluhan_saat_ini($id,$langid,$type) { $sql = "select * from so_resultentry_fisik_umum where So_ResultEntryFisikUmumSo_ResultEntryID = ? and So_ResultEntryFisikUmumM_LangID=? and So_ResultEntryFisikUmumType=?"; $qry = $this->db_smartone->query($sql,array($id,$langid,$type)); if (! $qry) { return ""; } $rows = $qry->result_array(); if (count($rows) == 0 ) { return ""; } $details = json_decode($rows[0]["So_ResultEntryFisikUmumDetails"],true); //keluhan saat ini $keluhan_saat_ini = ""; foreach($details as $d) { if ($d["title"] == "KELUHAN SAAT INI") { if ($d["flag_normal"] == "Y") { $keluhan_saat_ini = $d["label_flag_normal"]; break; } else { foreach($d["details"] as $xd) { if ($xd["chx"] == "1" ) { if ( $keluhan_saat_ini != "" ) $keluhan_saat_ini .= ", "; $keluhan_saat_ini .= $xd["label"]; } } } } } return $keluhan_saat_ini; } function keluhan_saat_ini_new($id,$langid,$type) { $sql = "select * from so_resultentry_fisik_umum where So_ResultEntryFisikUmumSo_ResultEntryID= ? and So_ResultEntryFisikUmumM_LangID=? and So_ResultEntryFisikUmumType=?"; $qry = $this->db_smartone->query($sql,array($id,$langid,$type)); if (! $qry) { return json_encode(array()); } $rows = $qry->result_array(); if (count($rows) == 0 ) { return json_encode(array()); } $details = json_decode($rows[0]["So_ResultEntryFisikUmumDetails"],true); //keluhan saat ini $keluhan_saat_ini_new = array(); foreach($details as $d) { if ($d["title"] == "KELUHAN SAAT INI") { if ($d["flag_normal"] == "Y") { $keluhan_saat_ini_new = array(); //$d["label_flag_normal"]; break; } else { foreach($d["details"] as $gp) { if ($gp["chx"] == 1 ) { $arr_result[] = array($gp["label"],$gp["value"]) ; $keluhan_saat_ini_new[] = array( "a1" => $this->translate($langid, $gp["label"]) , "a2" => $gp["value"], ); } } } } } echo json_encode($keluhan_saat_ini_new); } function riwayat_phobia($id,$langid,$type) { $sql = "select * from so_resultentry_fisik_umum where So_ResultEntryFisikUmumSo_ResultEntryID= ? and So_ResultEntryFisikUmumM_LangID=? and So_ResultEntryFisikUmumType=?"; $qry = $this->db_smartone->query($sql,array($id,$langid,$type)); if (! $qry) { return json_encode(array()); } $rows = $qry->result_array(); if (count($rows) == 0 ) { return json_encode(array()); } $details = json_decode($rows[0]["So_ResultEntryFisikUmumDetails"],true); //keluhan saat ini $riwayat_phobia = array(); foreach($details as $d) { if ($d["title"] == "RIWAYAT POBIA") { if ($d["flag_normal"] == "Y") { $riwayat_phobia = array(); //$d["label_flag_normal"]; break; } else { foreach($d["details"] as $gp) { if ($gp["chx"] == 1 ) { $arr_result[] = array($gp["label"],$gp["value"]) ; $riwayat_phobia[] = array( "b1" => $this->translate($langid, $gp["label"]) , "b2" => $gp["value"], ); } } } } } echo json_encode($riwayat_phobia); } function etnis($id,$langid,$type) { $sql = "select * from so_resultentry_fisik_umum where So_ResultEntryFisikUmumSo_ResultEntryID= ? and So_ResultEntryFisikUmumM_LangID=? and So_ResultEntryFisikUmumType=?"; $qry = $this->db_smartone->query($sql,array($id,$langid,$type)); if (! $qry) { return json_encode(array()); } $rows = $qry->result_array(); if (count($rows) == 0 ) { return json_encode(array()); } $details = json_decode($rows[0]["So_ResultEntryFisikUmumDetails"],true); //keluhan saat ini $etnis = array(); foreach($details as $d) { if ($d["title"] == "ETNIS") { if ($d["flag_normal"] == "Y") { $etnis = array(); //$d["label_flag_normal"]; break; } else { foreach($d["details"] as $gp) { if ($gp["chx"] == 1 ) { $arr_result[] = array($gp["label"],$gp["value"]) ; $etnis [] = array( "x1" => $this->translate($langid, $gp["label"]), "x2" => $this->translate($langid, $gp["value"]), ); } } } } } echo json_encode($etnis); } function riwayat_penyakit($id,$langid,$type) { $sql = "select * from so_resultentry_fisik_umum where So_ResultEntryFisikUmumSo_ResultEntryID= ? and So_ResultEntryFisikUmumM_LangID=? and So_ResultEntryFisikUmumType=?"; $qry = $this->db_smartone->query($sql,array($id,$langid,$type)); if (! $qry) { return json_encode(array()); } $rows = $qry->result_array(); if (count($rows) == 0 ) { return json_encode(array()); } $details = json_decode($rows[0]["So_ResultEntryFisikUmumDetails"],true); //keluhan saat ini $riwayat_penyakit = array(); foreach($details as $d) { if ($d["title"] == "RIWAYAT PENYAKIT") { if ($d["flag_normal"] == "Y") { $riwayat_penyakit = array(); //$d["label_flag_normal"]; break; } else { foreach($d["details"] as $gp) { foreach($gp["details"] as $xd) { if ($xd["chx"] == 1 ) { $arr_result[] = array($xd["label"],$xd["value"]) ; $riwayat_penyakit[] = array( "c1" => $this->translate($langid, $xd["label"]) , "c2" => $xd["value"], "c3" => $this->translate($langid, $xd["segment_name"]), "c4" => $xd["id"] ); } } } } } } echo json_encode($riwayat_penyakit); } function riwayat_keluarga($id,$langid,$type) { $sql = "select * from so_resultentry_fisik_umum where So_ResultEntryFisikUmumSo_ResultEntryID= ? and So_ResultEntryFisikUmumM_LangID=? and So_ResultEntryFisikUmumType=?"; $qry = $this->db_smartone->query($sql,array($id,$langid,$type)); if (! $qry) { return json_encode(array()); } $rows = $qry->result_array(); if (count($rows) == 0 ) { return json_encode(array()); } $details = json_decode($rows[0]["So_ResultEntryFisikUmumDetails"],true); //keluhan saat ini $riwayat_keluarga = array(); foreach($details as $d) { if ($d["title"] == "RIWAYAT PENYAKIT KELUARGA") { if ($d["flag_normal"] == "Y") { $riwayat_keluarga = array(); //$d["label_flag_normal"]; break; } else { foreach($d["details"] as $gp) { if (true || $gp["chx"] == 1 ) { $arr_result[] = array($gp["label"],$gp["value"],$gp["id"]) ; foreach($gp["options"] as $gpd) { if($gpd["selected"] == 1) { $riwayat_keluarga[] = array( "d1" => $this->translate($langid, $gp["label"]) , "d2" => $this->translate($langid, $gpd["label"]), "d3" => $gp["id"], ); } } } } } } } echo json_encode($riwayat_keluarga); } function riwayat_hidup($id,$langid,$type) { $sql = "select * from so_resultentry_fisik_umum where So_ResultEntryFisikUmumSo_ResultEntryID= ? and So_ResultEntryFisikUmumM_LangID=? and So_ResultEntryFisikUmumType=?"; $qry = $this->db_smartone->query($sql,array($id,$langid,$type)); if (! $qry) { return json_encode(array()); } $rows = $qry->result_array(); if (count($rows) == 0 ) { return json_encode(array()); } $details = json_decode($rows[0]["So_ResultEntryFisikUmumDetails"],true); //keluhan saat ini $riwayat_hidup = array(); foreach($details as $d) { if ($d["title"] == "RIWAYAT KEBIASAAN HIDUP") { if ($d["flag_normal"] == "Y") { $riwayat_hidup = array(); //$d["label_flag_normal"]; break; } else { foreach($d["details"] as $gp) { foreach($gp["details"] as $xd) { if ($xd["chx"] == 1 ) { $arr_result[] = array($xd["segment_name"],$xd["label"],$xd["value"]) ; $riwayat_hidup[] = array( "e1" => $this->translate($langid, $xd["segment_name"]) , "e2" => $this->translate($langid, $xd["label"] ) .' '.$this->translate($langid, $xd["value"]), "e3" => $xd["value"], ); } } } } } } echo json_encode($riwayat_hidup); } function riwayat_obat($id,$langid,$type) { $sql = "select * from so_resultentry_fisik_umum where So_ResultEntryFisikUmumSo_ResultEntryID= ? and So_ResultEntryFisikUmumM_LangID=? and So_ResultEntryFisikUmumType=?"; $qry = $this->db_smartone->query($sql,array($id,$langid,$type)); if (! $qry) { return json_encode(array()); } $rows = $qry->result_array(); if (count($rows) == 0 ) { return json_encode(array()); } $details = json_decode($rows[0]["So_ResultEntryFisikUmumDetails"],true); //keluhan saat ini $riwayat_obat = array(); foreach($details as $d) { if ($d["title"] == "RIWAYAT KONSUMSI OBAT TERATUR") { if ($d["flag_normal"] == "Y") { $riwayat_obat = array(); //$d["label_flag_normal"]; break; } else { foreach($d["details"] as $gp) { if ($gp["chx"] == 1 ) { $arr_result[] = array($gp["label"],$gp["value"]) ; $riwayat_obat[] = array( "f1" => $this->translate($langid, $gp["label"]) , "f2" => $gp["value"], ); } } } } } echo json_encode($riwayat_obat); } function riwayat_imunisasi($id,$langid,$type) { $sql = "select * from so_resultentry_fisik_umum where So_ResultEntryFisikUmumSo_ResultEntryID= ? and So_ResultEntryFisikUmumM_LangID=? and So_ResultEntryFisikUmumType=?"; $qry = $this->db_smartone->query($sql,array($id,$langid,$type)); if (! $qry) { return json_encode(array()); } $rows = $qry->result_array(); if (count($rows) == 0 ) { return json_encode(array()); } $details = json_decode($rows[0]["So_ResultEntryFisikUmumDetails"],true); //keluhan saat ini $riwayat_imunisasi= array(); foreach($details as $d) { if ($d["title"] == "RIWAYAT IMUNISASI") { if ($d["flag_normal"] == "Y") { $riwayat_imunisasi= array(); //$d["label_flag_normal"]; break; } else { foreach($d["details"] as $gp) { foreach($gp["details"] as $xd) { if ($xd["chx"] == 1 ) { $arr_result[] = array($xd["segment_name"],$xd["label"],$xd["value"]) ; $riwayat_imunisasi[] = array( "g1" => $this->translate($langid,$xd["segment_name"]), "g2" => $this->translate($langid,$xd["label"]).' '.$this->translate($langid,$xd["value"]) , "g3" => $this->translate($langid,$xd["value"]), ); } } } } } } echo json_encode($riwayat_imunisasi); } //pemeriksaan Fisik function tanda_vital($id,$langid,$type) { $sql = "select * from so_resultentry_fisik_umum where So_ResultEntryFisikUmumSo_ResultEntryID= ? and So_ResultEntryFisikUmumM_LangID=? and So_ResultEntryFisikUmumType=?"; $qry = $this->db_smartone->query($sql,array($id,$langid,$type)); if (! $qry) { return json_encode(array()); } $rows = $qry->result_array(); if (count($rows) == 0 ) { return json_encode(array()); } $details = json_decode($rows[0]["So_ResultEntryFisikUmumDetails"],true); //keluhan saat ini $tanda_vital = array(); foreach($details as $d) { if ($d["title"] == "TANDA VITAL") { foreach($d["details"] as $gp) { $value = $gp["value"].' '.$this->translate($langid,$gp["unit"]); if ($gp["chx_x"] == "1") $value = $gp["label_x"]; if ($gp["chx_y"] == "1") $value = $gp["label_y"]; $tanda_vital[] = array( "aa1" => $this->translate($langid, $gp["label"]), "aa2" => $value, "aa3" => ucwords(strtolower($gp["value_x"])), ); } } } echo json_encode($tanda_vital); } function status_gizi($id,$langid,$type) { $sql = "select * from so_resultentry_fisik_umum where So_ResultEntryFisikUmumSo_ResultEntryID= ? and So_ResultEntryFisikUmumM_LangID=? and So_ResultEntryFisikUmumType=?"; $qry = $this->db_smartone->query($sql,array($id,$langid,$type)); if (! $qry) { return json_encode(array()); } $rows = $qry->result_array(); if (count($rows) == 0 ) { return json_encode(array()); } $details = json_decode($rows[0]["So_ResultEntryFisikUmumDetails"],true); //keluhan saat ini $status_gizi = array(); foreach($details as $d) { if ($d["title"] == "STATUS GIZI") { foreach($d["details"] as $gp) { $value = $gp["value"]; if ($gp["chx_x"] == "1") $value = $gp["label_x"]; if ($gp["chx_y"] == "1") $value = $gp["label_y"]; if( $gp["value"] == NaN ){ $value = '-'; } $status_gizi[] = array( "qq1" => $this->translate($langid, $gp["label"]), "qq2" => $value, "qq3" => $gp["unit"], ); } } } echo json_encode($status_gizi); } function keadaan_umum($id,$langid,$type) { $sql = "select * from so_resultentry_fisik_umum where So_ResultEntryFisikUmumSo_ResultEntryID= ? and So_ResultEntryFisikUmumM_LangID=? and So_ResultEntryFisikUmumType=?"; $qry = $this->db_smartone->query($sql,array($id,$langid,$type)); if (! $qry) { return json_encode(array()); } $rows = $qry->result_array(); if (count($rows) == 0 ) { return json_encode(array()); } $details = json_decode($rows[0]["So_ResultEntryFisikUmumDetails"],true); //keluhan saat ini $keadaan_umum = array(); foreach($details as $d) { if ($d["title"] == "KEADAAN UMUM") { foreach($d["details"] as $gp) { $value = $gp["value"]; if ($gp["chx_x"] == "1") $value = $gp["label_x"]; if ($gp["chx_y"] == "1") $value = $gp["label_y"]; $keadaan_umum[] = array( "rr1" => $this->translate($langid, $gp["label"]), "rr2" => $this->translate($langid, $value) , "rr3" => $this->translate($langid,$gp["unit"]), ); } } } echo json_encode($keadaan_umum); } function kepala_wajah($id,$langid,$type) { $sql = "select * from so_resultentry_fisik_umum where So_ResultEntryFisikUmumSo_ResultEntryID= ? and So_ResultEntryFisikUmumM_LangID=? and So_ResultEntryFisikUmumType=?"; $qry = $this->db_smartone->query($sql,array($id,$langid,$type)); if (! $qry) { return json_encode(array()); } $rows = $qry->result_array(); if (count($rows) == 0 ) { return json_encode(array()); } $details = json_decode($rows[0]["So_ResultEntryFisikUmumDetails"],true); //keluhan saat ini $kepala_wajah = array(); foreach($details as $d) { if ($d["title"] == "KEPALA WAJAH") { foreach($d["details"] as $gp) { if ($gp["chx"] == 1 ) { $arr_result[] = array($gp["label"],$gp["value"]) ; $kepala_wajah[] = array( "bb1" => $this->translate($langid, $gp["label"]), "bb2" => $gp["value"], ); } } } } if(empty($kepala_wajah)){ $kepala_wajah[] = array( "bb1" =>"Not Inspected", "bb2" => "", ); } echo json_encode($kepala_wajah); } function mata($id,$langid,$type) { $sql = "select * from so_resultentry_fisik_umum where So_ResultEntryFisikUmumSo_ResultEntryID= ? and So_ResultEntryFisikUmumM_LangID=? and So_ResultEntryFisikUmumType=?"; $qry = $this->db_smartone->query($sql,array($id,$langid,$type)); if (! $qry) { return json_encode(array()); } $rows = $qry->result_array(); if (count($rows) == 0 ) { return json_encode(array()); } $details = json_decode($rows[0]["So_ResultEntryFisikUmumDetails"],true); //keluhan saat ini $mata = array(); foreach($details as $d) { if ($d["title"] == "MATA") { foreach($d["details"] as $gp) { if ($gp["chx"] == 1 ) { $arr_result[] = array($gp["label"],$gp["value"]) ; $mata[] = array( "cc1" => $this->translate($langid, $gp["label"]), "cc2" => $gp["value"], ); } } } } if(empty($mata)){ $mata[] = array( "cc1" => "Not Inspected", "cc2" => "" ); } echo json_encode($mata); } function persepsi_warna($id,$langid,$type) { $sql = "select * from so_resultentry_fisik_umum where So_ResultEntryFisikUmumSo_ResultEntryID= ? and So_ResultEntryFisikUmumM_LangID=? and So_ResultEntryFisikUmumType=?"; $qry = $this->db_smartone->query($sql,array($id,$langid,$type)); if (! $qry) { return json_encode(array()); } $rows = $qry->result_array(); if (count($rows) == 0 ) { return json_encode(array()); } $details = json_decode($rows[0]["So_ResultEntryFisikUmumDetails"],true); //keluhan saat ini $persepsi_warna = array(); foreach($details as $d) { if ($d["title"] == "PERSEPSI WARNA") { foreach($d["details"] as $gp) { if ($gp["chx"] == 1 ) { $arr_result[] = array($gp["label"],$gp["value"]) ; $persepsi_warna[] = array( "dd1" => $this->translate($langid, $gp["label"]), "dd2" => $gp["value"] , ); } } } } if(empty(persepsi_warna)){ $persepsi_warna[] = array( "dd1" => 'Not Inspected', "dd2" => '', ); } echo json_encode($persepsi_warna); } function telinga($id,$langid,$type) { $sql = "select * from so_resultentry_fisik_umum where So_ResultEntryFisikUmumSo_ResultEntryID= ? and So_ResultEntryFisikUmumM_LangID=? and So_ResultEntryFisikUmumType=?"; $qry = $this->db_smartone->query($sql,array($id,$langid,$type)); if (! $qry) { return json_encode(array()); } $rows = $qry->result_array(); if (count($rows) == 0 ) { return json_encode(array()); } $details = json_decode($rows[0]["So_ResultEntryFisikUmumDetails"],true); //keluhan saat ini $telinga = array(); foreach($details as $d) { if ($d["title"] == "TELINGA") { foreach($d["details"] as $gp) { if ($gp["chx"] == 1 ) { $arr_result[] = array($gp["label"],$gp["value"]) ; $telinga[] = array( "ee1" => $this->translate($langid, $gp["label"]), "ee2" => $gp["value"], ); } } } } if(empty($telinga)){ $telinga[] = array( "ee1" => 'Not Inspected', "ee2" => '' ); } echo json_encode($telinga); } function visus($id,$langid,$type) { $sql = "select * from so_resultentry_fisik_umum where So_ResultEntryFisikUmumSo_ResultEntryID= ? and So_ResultEntryFisikUmumM_LangID=? and So_ResultEntryFisikUmumType=?"; $qry = $this->db_smartone->query($sql,array($id,$langid,$type)); if (! $qry) { return json_encode(array()); } $rows = $qry->result_array(); if (count($rows) == 0 ) { return json_encode(array()); } $details = json_decode($rows[0]["So_ResultEntryFisikUmumDetails"],true); //keluhan saat ini $visus = array(); foreach($details as $d) { if ($d["title"] == "VISUS JAUH") { foreach($d["details"] as $gp) { foreach($gp["details"] as $xd) { if ($xd["chx"] == 1 ) { $arr_result[] = array($gp["name"],$xd["label"],$xd["value"]) ; $visus[] = array( "xx1" => $this->translate($langid, $gp["name"]), "xx2" => $xd["label"], "xx3" => $xd["value"] ); } } } } } if(empty($visus)){ $visus[] = array( "xx1" => "Not Inspected", "xx2" => "", "xx3" => "" ); } echo json_encode($visus); } function hidung($id,$langid,$type) { $sql = "select * from so_resultentry_fisik_umum where So_ResultEntryFisikUmumSo_ResultEntryID= ? and So_ResultEntryFisikUmumM_LangID=? and So_ResultEntryFisikUmumType=?"; $qry = $this->db_smartone->query($sql,array($id,$langid,$type)); if (! $qry) { return json_encode(array()); } $rows = $qry->result_array(); if (count($rows) == 0 ) { return json_encode(array()); } $details = json_decode($rows[0]["So_ResultEntryFisikUmumDetails"],true); //keluhan saat ini $hidung = array(); foreach($details as $d) { if ($d["title"] == "HIDUNG") { foreach($d["details"] as $gp) { if ($gp["chx"] == 1 ) { $arr_result[] = array($gp["label"],$gp["value"]) ; $hidung[] = array( "ff1" => $this->translate($langid, $gp["label"]), "ff2" => $gp["value"], ); } } } } if(empty($hidung)){ $hidung[] = array( "ff1" => 'Not Inspected', "ff2" => '', ); } echo json_encode($hidung); } function gigi($id,$langid,$type) { $kode_gigi = array( "X" => "Cavity" , "C" => "Fillings", "O" => "Missing Tooth", "R" => "Gangren Radix", "A" => "Dentures" , "K" => "Tartar"); $sql = "select * from so_resultentry_fisik_umum where So_ResultEntryFisikUmumSo_ResultEntryID= ? and So_ResultEntryFisikUmumM_LangID=? and So_ResultEntryFisikUmumType=?"; $qry = $this->db_smartone->query($sql,array($id,$langid,$type)); if (! $qry) { return json_encode(array()); } $rows = $qry->result_array(); if (count($rows) == 0 ) { return json_encode(array()); } $da= json_decode($rows[0]["So_ResultEntryFisikUmumDetails"],true); $arr_gigi= array(); // $header = array('is_normal'=>'N'); foreach($da as $db) { if ($db["title"] != "GIGI") continue; if($db["title"] == 'GIGI'){ //print_r($db); $header = $db['is_normal']; } foreach($db["details"] as $dx) { foreach($dx["details"] as $dc) { $dc["value"] = strtoupper($dc["value"]); if ($dc["value"] != "" && isset($kode_gigi[$dc["value"]])) { //$value = $kode_gigi[$dc["value"]]; $value = $dc["value"]; if (! isset($arr_gigi[$value]) ) $arr_gigi[$value] = array(); $kode = $dc["id_code"]; $pos = substr($kode,-1); if ( strpos($kode,"atas")) { if (strpos($kode,"kiri")) { $arr_gigi[$value][] = "└" . $pos ; } else { $arr_gigi[$value][] = $pos . "┘" ; } } else { if (strpos($kode,"kiri")) { $arr_gigi[$value][] = "┌" .$pos; } else { $arr_gigi[$value][] = $pos . "┐" ; } } } } } } //print_r($header); $gigi= array(); foreach($arr_gigi as $v => $g) { $gigi[] = array("header"=>$header,"gg1" => join($g,", "), "gg2" => "" , "gg3" => $v); } if(empty($gigi)){ $gigi[] = array("header"=>$header); } echo json_encode($gigi); } function gigi_lama($id,$langid,$type) { $sql = "select * from so_resultentry_fisik_umum where So_ResultEntryFisikUmumSo_ResultEntryID= ? and So_ResultEntryFisikUmumM_LangID=? and So_ResultEntryFisikUmumType=?"; $qry = $this->db_smartone->query($sql,array($id,$langid,$type)); if (! $qry) { return json_encode(array()); } $rows = $qry->result_array(); if (count($rows) == 0 ) { return json_encode(array()); } $details = json_decode($rows[0]["So_ResultEntryFisikUmumDetails"],true); //keluhan saat ini $gigi = array(); foreach($details as $d) { if ($d["title"] == "GIGI") { foreach($d["details"] as $gp) { foreach($gp["details"] as $xd) { if ($xd["value"] <> '' ) { $arr_result[] = array($xd["id_code"],$xd["label"],$xd["value"]) ; $gigi[] = array( "gg1" => $xd["id_code"], "gg2" => $xd["label"], "gg3" => $xd["value"] ); } } } } } $gigi = array( array("gg1" => "+8, +7, +7, +8", "gg2" => "b" , "gg3" => "O") ); echo json_encode($gigi); } function mulut($id,$langid,$type) { $sql = "select * from so_resultentry_fisik_umum where So_ResultEntryFisikUmumSo_ResultEntryID= ? and So_ResultEntryFisikUmumM_LangID=? and So_ResultEntryFisikUmumType=?"; $qry = $this->db_smartone->query($sql,array($id,$langid,$type)); if (! $qry) { return json_encode(array()); } $rows = $qry->result_array(); if (count($rows) == 0 ) { return json_encode(array()); } $details = json_decode($rows[0]["So_ResultEntryFisikUmumDetails"],true); //keluhan saat ini $mulut = array(); foreach($details as $d) { if ($d["title"] == "MULUT") { foreach($d["details"] as $gp) { foreach($gp["details"] as $xd) { if ($xd["chx"] == 1 ) { $arr_result[] = array($gp["name"],$xd["label"],$xd["value"]) ; $mulut[] = array( "hh1" => $this->translate($langid, $gp["name"]) , "hh2" => $this->translate($langid, $xd["label"]) , "hh3" => $xd["value"] ); } } } } } if(empty($mulut)){ $mulut[] = array( "hh1" => 'Not Inspected', "hh2" => '', "hh3" => '' ); } echo json_encode($mulut); } function leher($id,$langid,$type) { $sql = "select * from so_resultentry_fisik_umum where So_ResultEntryFisikUmumSo_ResultEntryID= ? and So_ResultEntryFisikUmumM_LangID=? and So_ResultEntryFisikUmumType=?"; $qry = $this->db_smartone->query($sql,array($id,$langid,$type)); if (! $qry) { return json_encode(array()); } $rows = $qry->result_array(); if (count($rows) == 0 ) { return json_encode(array()); } $details = json_decode($rows[0]["So_ResultEntryFisikUmumDetails"],true); //keluhan saat ini $leher = array(); foreach($details as $d) { if ($d["title"] == "LEHER") { foreach($d["details"] as $gp) { if ($gp["chx"] == 1 ) { $arr_result[] = array($gp["label"],$gp["value"]) ; $leher[] = array( "ii1" => $this->translate($langid, $gp["label"]), "ii2" => $gp["value"], ); } } } } if(empty($leher)){ $leher[] = array( "ii1" => "Not Inspected", "ii2" => "" ); } echo json_encode($leher); } function thorax($id,$langid,$type) { $sql = "select * from so_resultentry_fisik_umum where So_ResultEntryFisikUmumSo_ResultEntryID= ? and So_ResultEntryFisikUmumM_LangID=? and So_ResultEntryFisikUmumType=?"; $qry = $this->db_smartone->query($sql,array($id,$langid,$type)); if (! $qry) { return json_encode(array()); } $rows = $qry->result_array(); if (count($rows) == 0 ) { return json_encode(array()); } $details = json_decode($rows[0]["So_ResultEntryFisikUmumDetails"],true); //keluhan saat ini $thorax = array(); foreach($details as $d) { if ($d["title"] == "THORAX / DADA") { foreach($d["details"] as $gp) { if ($gp["chx"] == 1 ) { $arr_result[] = array($gp["label"],$gp["value"]) ; $thorax[] = array( "jj1" =>$this->translate($langid, $gp["label"]), "jj2" => $gp["value"], ); } } } } if(empty($thorax)){ $thorax[] = array( "jj1" => "Not Inspected", "jj2" => "" ); } echo json_encode($thorax); } function paru($id,$langid,$type) { $sql = "select * from so_resultentry_fisik_umum where So_ResultEntryFisikUmumSo_ResultEntryID= ? and So_ResultEntryFisikUmumM_LangID=? and So_ResultEntryFisikUmumType=?"; $qry = $this->db_smartone->query($sql,array($id,$langid,$type)); if (! $qry) { return json_encode(array()); } $rows = $qry->result_array(); if (count($rows) == 0 ) { return json_encode(array()); } $details = json_decode($rows[0]["So_ResultEntryFisikUmumDetails"],true); //keluhan saat ini $paru = array(); foreach($details as $d) { if ($d["title"] == "PARU-PARU") { foreach($d["details"] as $gp) { if ($gp["chx"] == 1 ) { $arr_result[] = array($gp["label"],$gp["value"]) ; $paru[] = array( "kk1" => $this->translate($langid, $gp["label"]), "kk2" => $gp["value"], ); } } } } if(empty($paru)){ $paru[] = array( "kk1" => "Not Inspected", "kk2" => "" ); } echo json_encode($paru); } function jantung($id,$langid,$type) { $sql = "select * from so_resultentry_fisik_umum where So_ResultEntryFisikUmumSo_ResultEntryID= ? and So_ResultEntryFisikUmumM_LangID=? and So_ResultEntryFisikUmumType=?"; $qry = $this->db_smartone->query($sql,array($id,$langid,$type)); if (! $qry) { return json_encode(array()); } $rows = $qry->result_array(); if (count($rows) == 0 ) { return json_encode(array()); } $details = json_decode($rows[0]["So_ResultEntryFisikUmumDetails"],true); //keluhan saat ini $jantung = array(); foreach($details as $d) { if ($d["title"] == "JANTUNG") { foreach($d["details"] as $gp) { foreach($gp["details"] as $xd) { if ($xd["chx"] == 1 ) { $arr_result[] = array($gp["name"],$xd["label"],$xd["value"]) ; $jantung[] = array( "ll1" => $this->translate($langid, $gp["name"]) , "ll2" => $this->translate($langid, $xd["label"]) , "ll3" => $xd["value"] ); } } } } } if(empty($jantung)){ $jantung[] = array( "ll1" => "Not Inspected", "ll2" => "", "ll3" => "" ); } echo json_encode($jantung); } function perut($id,$langid,$type) { $sql = "select * from so_resultentry_fisik_umum where So_ResultEntryFisikUmumSo_ResultEntryID= ? and So_ResultEntryFisikUmumM_LangID=? and So_ResultEntryFisikUmumType=?"; $qry = $this->db_smartone->query($sql,array($id,$langid,$type)); if (! $qry) { return json_encode(array()); } $rows = $qry->result_array(); if (count($rows) == 0 ) { return json_encode(array()); } $details = json_decode($rows[0]["So_ResultEntryFisikUmumDetails"],true); //keluhan saat ini $perut = array(); foreach($details as $d) { if ($d["title"] == "PERUT / ABDOMEN") { foreach($d["details"] as $gp) { foreach($gp["details"] as $xd) { if ($xd["chx"] == 1 ) { $arr_result[] = array($gp["name"],$xd["label"],$xd["value"]) ; $perut[] = array( "mm1" => $this->translate($langid, $gp["name"]), "mm2" => $this->translate($langid, $xd["label"] ), "mm3" => $xd["value"] ); } } } } } if(empty($perut)){ $perut[] = array( "mm1" => "Not Inspected", "mm2" => "", "mm3" => "" ); } echo json_encode($perut); } function genitourinaria($id,$langid,$type) { $sql = "select * from so_resultentry_fisik_umum where So_ResultEntryFisikUmumSo_ResultEntryID= ? and So_ResultEntryFisikUmumM_LangID=? and So_ResultEntryFisikUmumType=?"; $qry = $this->db_smartone->query($sql,array($id,$langid,$type)); if (! $qry) { return json_encode(array()); } $rows = $qry->result_array(); if (count($rows) == 0 ) { return json_encode(array()); } $details = json_decode($rows[0]["So_ResultEntryFisikUmumDetails"],true); //keluhan saat ini $genitourinaria = array(); foreach($details as $d) { if ($d["title"] == "GENITOURINARIA") { foreach($d["details"] as $gp) { if ($gp["chx"] == 1 ) { $arr_result[] = array($gp["label"],$gp["value"]) ; $genitourinaria[] = array( "nn1" => $this->translate($langid, $gp["label"]), "nn2" => $gp["value"], ); } } } } if(empty($genitourinaria)){ $genitourinaria[] = array( "nn1" => "Not Inspected", "nn2" => "" ); } echo json_encode($genitourinaria); } function anggota($id,$langid,$type) { $sql = "select * from so_resultentry_fisik_umum where So_ResultEntryFisikUmumSo_ResultEntryID= ? and So_ResultEntryFisikUmumM_LangID=? and So_ResultEntryFisikUmumType=?"; $qry = $this->db_smartone->query($sql,array($id,$langid,$type)); if (! $qry) { return json_encode(array()); } $rows = $qry->result_array(); if (count($rows) == 0 ) { return json_encode(array()); } $details = json_decode($rows[0]["So_ResultEntryFisikUmumDetails"],true); //keluhan saat ini $anggota = array(); foreach($details as $d) { if ($d["title"] == "ANGGOTA GERAK") { //WIP //echo "
"; print_r($d["details"]);
                          foreach($d["details"] as $gp) {
                             foreach($gp["details"] as $xd) {
                              if ($xd["chx"] == 1 )     {
                                   $arr_result[] = array($gp["name"],$xd["label"],$xd["value"]) ;
                                   $anggota[] = array(
                                     "oo1" => $this->translate($langid, $gp["name"]),
                                      "oo2" => $xd["label"],
                                      "oo3" => $xd["value"]
                                   );
                                }
                             }
                          }


                    }
                 }
				 if(empty($anggota)){
					 $anggota[] = array(
                                     "oo1" => "Not Inspected",
                                      "oo2" => "",
                                      "oo3" => ""
                                   );
				 }
                 echo json_encode($anggota);
               }
               function sistem($id,$langid,$type) {
                  $sql = "select * from so_resultentry_fisik_umum
                     where So_ResultEntryFisikUmumSo_ResultEntryID= ?
                     and So_ResultEntryFisikUmumM_LangID=?
                     and So_ResultEntryFisikUmumType=?";
                  $qry = $this->db_smartone->query($sql,array($id,$langid,$type));
                  if (! $qry) {
                     return json_encode(array());
                  }
                  $rows = $qry->result_array();
                  if (count($rows) == 0 ) {
                     return json_encode(array());
                  }
                  $details = json_decode($rows[0]["So_ResultEntryFisikUmumDetails"],true);
                  //keluhan saat ini
                  $sistem = array();
                  foreach($details as $d) {

                     if ($d["title"] == "SISTEM PERSYARAFAN") {

                           foreach($d["details"] as $gp) {
                              foreach($gp["details"] as $xd) {
                               if ($xd["chx"] == 1 )     {
                                    $arr_result[] = array($gp["name"],$xd["label"],$xd["value"]) ;
                                    $sistem[] = array(
                                      "pp1" => $this->translate($langid, $gp["name"]),
                                       "pp2" => $this->translate($langid, $xd["label"]) ,
                                       "pp3" => $xd["value"]
                                    );
                                 }
                              }
                           }


                     }
                  }
				  if(empty($sistem)){
					 $sistem[] = array(
                                     "pp1" => "Not Inspected",
                                       "pp2" => "",
                                       "pp3" => ""
                                   );
				 }
                  echo json_encode($sistem);
                }

function smell($id,$langid,$type) {
                   $sql = "select * from so_resultentry_fisik_umum
                      where So_ResultEntryFisikUmumSo_ResultEntryID= ?
                      and So_ResultEntryFisikUmumM_LangID=?
                      and So_ResultEntryFisikUmumType=?";
                   $qry = $this->db_smartone->query($sql,array($id,$langid,$type));
                   if (! $qry) {
                      return json_encode(array());
                   }
                   $rows = $qry->result_array();
                   if (count($rows) == 0 ) {
                      return json_encode(array());
                   }
                   $details = json_decode($rows[0]["So_ResultEntryFisikUmumDetails"],true);
                   //keluhan saat ini
                   $smell= array();
                   foreach($details as $d) {

                      if ($d["title"] == "SMELL TEST") {

                            foreach($d["details"] as $gp) {
                               foreach($gp["details"] as $xd) {
                                if ($xd["chx"] == 1 )     {
                                     $arr_result[] = array($gp["name"],$xd["label"],$xd["value"],$d["inspected"]) ;
                                     $smell[] = array(
                                       "xx1" => $this->translate($langid,$gp["name"]),
                                        "xx2" => $this->translate($langid,$xd["label"]),
                                        "xx3" => $this->translate($langid,$xd["value"]),
                                        "xx4" => $d["is_inspected"]

                                     );
                                  }
                               }
                            }


                      }
                   }
				   if(empty($smell)){
					   $smell[] = array(
                                       "xx1" => "Not Inspected",
                                        "xx2" => "",
                                        "xx3" => ""
                                     );
				   }
                   echo json_encode($smell);
                 }


function low($id,$langid,$type) {
                   $sql = "select * from so_resultentry_fisik_umum
                      where So_ResultEntryFisikUmumSo_ResultEntryID= ?
                      and So_ResultEntryFisikUmumM_LangID=?
                      and So_ResultEntryFisikUmumType=?";
                   $qry = $this->db_smartone->query($sql,array($id,$langid,$type));
                   if (! $qry) {
                      return json_encode(array());
                   }
                   $rows = $qry->result_array();
                   if (count($rows) == 0 ) {
                      return json_encode(array());
                   }
                   $details = json_decode($rows[0]["So_ResultEntryFisikUmumDetails"],true);
                   //keluhan saat ini
                   $low= array();
                   foreach($details as $d) {

                      if ($d["title"] == "LOW BACK PAIN SCREENING TEST") {

                            foreach($d["details"] as $gp) {
                               foreach($gp["details"] as $xd) {
                                if ($xd["chx"] == 1 )     {
                                     $arr_result[] = array($gp["name"],$xd["label"],$xd["value"],$d["is_inspected"]) ;
                                     $low[] = array(
                                       "yy1" => $this->translate($langid,$gp["name"]),
                                        "yy2" => $this->translate($langid,$xd["label"]),
                                        "yy3" => $this->translate($langid,$xd["value"]),
                                        "yy4" => $d["is_inspected"]

                                     );
                                  }
                               }
                            }


                      }
                   }
				   if(empty($low)){
					   $low[] = array(
                                       "yy1" => "Not Inspected",
                                        "yy2" => "",
                                        "yy3" => ""
                                     );
				   }
                   echo json_encode($low);
                 }


                function integumen($id,$langid,$type) {
                   $sql = "select * from so_resultentry_fisik_umum
                      where So_ResultEntryFisikUmumSo_ResultEntryID= ?
                      and So_ResultEntryFisikUmumM_LangID=?
                      and So_ResultEntryFisikUmumType=?";
                   $qry = $this->db_smartone->query($sql,array($id,$langid,$type));
                   if (! $qry) {
                      return json_encode(array());
                   }
                   $rows = $qry->result_array();
                   if (count($rows) == 0 ) {
                      return json_encode(array());
                   }
                   $details = json_decode($rows[0]["So_ResultEntryFisikUmumDetails"],true);
                   //keluhan saat ini
                   $integumen = array();
                   foreach($details as $d) {

                      if ($d["title"] == "SISTEM INTEGUMEN") {

                            foreach($d["details"] as $gp) {
                               foreach($gp["details"] as $xd) {
                                if ($xd["chx"] == 1 )     {
                                     $arr_result[] = array($gp["name"],$xd["label"],$xd["value"]) ;
                                     $integumen[] = array(
                                       "pp1" => $this->translate($langid, $gp["name"]),
                                        "pp2" => $this->translate($langid,  $xd["label"]),
                                        "pp3" => $xd["value"]
                                     );
                                  }
                               }
                            }


                      }
                   }
				   if(empty($integumen)){
					   $integumen[] = array(
                                       "pp1" => "Not Inspected",
                                        "pp2" => "",
                                        "pp3" => ""
                                     );
				   }
                   echo json_encode($integumen);
                 }


   //end pemeriksaan fisik

   //saran
   //konsul

    function kesimpulan($id,$langid) {
      return "Ini adalah contoh kesimpulan dari pemeriksaan di atas.";
/*      $sql = "select * from so_resultentry_fisik_umum
         where So_ResultEntryFisikUmumSo_ResultEntryID= ?
         and So_ResultEntryFisikUmumM_LangID=?
         and So_ResultEntryFisikUmumType=?";
      $qry = $this->db_smartone->query($sql,array($id,$langid,$type));
      $kesimpulan = "ada apa denganmu ";

      echo json_encode(array("abc" => $kesimpulan));
*/
    }

    function kesimpulanx($id,$langid) {

      $sql = "select * from so_resultentry_fisik_umum
         where So_ResultEntryFisikUmumSo_ResultEntryID= ?
         and So_ResultEntryFisikUmumM_LangID=?
         and So_ResultEntryFisikUmumType='fisik'";
      $qry = $this->db_smartone->query($sql,array($id,$langid));
      $rows = $qry->result_array();
      if ( count($rows) == 0 ) return '';

      $data = json_decode($rows[0]["So_ResultEntryFisikUmumDetails"],true);
      echo "
"; print_r($data);
    }

    function kesimpulanv4($id,$langid) {
		$kesimpulan = "";
		$sql = "SELECT *
				FROM so_resultentry_fisik_umum
				WHERE
					So_ResultEntryFisikUmumSo_ResultEntryID = ? AND
					So_ResultEntryFisikUmumM_LangID = ? AND
					So_ResultEntryFisikUmumType = 'riwayat'
				";
		$qry = $this->db_smartone->query($sql,array($id,$langid));
		$data_rows = $qry->result_array();
		if ( count($data_rows) == 0 ) return '';
		$riwayat_data = json_decode($data_rows[0]["So_ResultEntryFisikUmumDetails"],true);
		//print_r($riwayat_data);
		foreach($riwayat_data as $riwayat_da){
			if ($riwayat_da["title"] == "KELUHAN SAAT INI") {
				foreach($riwayat_da["details"] as $riwayat_db) {
					if( ($riwayat_db["chx"] == "1" || $riwayat_db["chx"] != false) &&    $riwayat_db["label"]   == 'Gastritis (maag)' ) {
					  if ($kesimpulan != "") $kesimpulan .= ", ";
					  $kesimpulan .= $this->translate($langid, $riwayat_db["label"]) . " " . $riwayat_db["value"];
					}
				}
			}
		}

		$kode_gigi 	= 	array( 	"X" => "Cavity" ,
								"C" => "Fillings",
								"O" => "Missing Tooth",
								"R" => "Gangren Radix",
								"A" => "Dentures" ,
								"K" => "Tartar"
						);
		$sql = "SELECT so_resultentry_fisik_umum.*, M_SexCode
				FROM so_resultentry_fisik_umum
				JOIN so_resultentry ON So_ResultEntryFisikUmumSo_ResultEntryID = So_ResultEntryID
				JOIN t_orderheader ON So_ResultEntryT_OrderHeaderID = T_OrderHeaderID
				JOIN m_patient ON T_OrderHeaderM_PatientID = M_PatientID
				JOIN m_sex ON M_PatientM_SexID = M_SexID
				WHERE So_ResultEntryFisikUmumSo_ResultEntryID = ?
					AND So_ResultEntryFisikUmumM_LangID = ?
					AND So_ResultEntryFisikUmumType = 'fisik'";
		$qry = $this->db_smartone->query($sql,array($id,$langid));
		$rows = $qry->result_array();
		if ( count($rows) == 0 ) return '';
		$data = json_decode($rows[0]["So_ResultEntryFisikUmumDetails"],true);

		$sexcode = $rows[0]["M_SexCode"];

		foreach($data as $da){
         if ($da["title"] == "TANDA VITAL") {
            foreach($da["details"] as $db) {
               if( $db["chx_x"] == "1" ) {
                  if ($kesimpulan != "") $kesimpulan .= ", ";
                  $kesimpulan .=  $this->translate($langid, $db["label"]) . " " .  $this->translate($langid, $db["label_x"]);
               }
			   if ($db["id_code"] == "tanda_vital_1") {
				   //echo intval($db["value"]);
				    if(intval($db["value"]) > 100 ){
						if ($kesimpulan != "") $kesimpulan .= ", ";
						$kesimpulan .= "Takhikardi "." ( ".$db["value"]." x/menit )";
					}
					if(intval($db["value"]) < 60 ){
						if ($kesimpulan != "") $kesimpulan .= ", ";
						$kesimpulan .= "Bradikardi "." ( ".$db["value"]." x/menit )";
					}
               }
			   if ($db["id_code"] == "tanda_vital_3") {
				    if(intval($db["value"]) > 20 || intval($db["value"]) < 16 ){
						if ($kesimpulan != "") $kesimpulan .= ", ";
						$kesimpulan .=  $this->translate($langid, $db["label"])." ( ".$db["value"]." x/menit )";
					}
               }
			   if($db["id_code"] == 'tanda_vital_5' && $db["value_x"] != 'NORMAL' && $db["value_x"] != 'OPTIMAL' && $db['value_x'] != 'HIGH NORMAL'){
						if ($kesimpulan != "") $kesimpulan .= ", ";
						$kesimpulan .=  $this->translate($langid, $db["label"])." ".$db["value"]." ".  $db["unit"] ." ( ".ucwords(strtolower($db["value_x"]))." )";
					}
            }
		} elseif($da["title"] == "STATUS GIZI") {
            $bmi_value = "";
            foreach($da["details"] as $db) {

               if ($db["id_code"] == "status_gizi_4") $bmi_value = $db["value"];
               if( $db["chx_x"] == "1" ) {
                  if ($kesimpulan != "") $kesimpulan .= ", ";
                  $kesimpulan .= $this->translate($langid, $db["label"] )  . " " . $db["label_x"];
               }
               if (($db["id_code"] == "status_gizi_6" && $db["value"] != "Normal" && $db["value"] != '-')) {
                  if ($kesimpulan != "") $kesimpulan .= ", ";
                  $kesimpulan .= $db["value"] . " ( BMI : $bmi_value )";
               }
			   if ($db["id_code"] == "status_gizi_3") {
				    if(intval($db["value"]) >= 90 && $sexcode == 'L' ){
						if ($kesimpulan != "") $kesimpulan .= ", ";
						$kesimpulan .= $this->translate($langid, $db["label"] ) . " "." ( ".$db["value"]." cm )";
					}
					if(intval($db["value"]) >= 80 && $sexcode == 'P' ){
						if ($kesimpulan != "") $kesimpulan .= ", ";
						$kesimpulan .= $this->translate($langid, $db["label"] ) . " "." ( ".$db["value"]." cm )";
					}
               }

            }
        } elseif($da["title"] == "KEADAAN UMUM") {
            foreach($da["details"] as $db) {
               if( $db["chx_x"] == "1" ) {
                  if ($kesimpulan != "") $kesimpulan .= ", ";
                  $kesimpulan .= $this->translate($langid, $db["label"] )  . " : ( " .$this->translate($langid,  $db["label_x"]) . " ) " . $db["value"];
               }
            }
        } elseif($da["title"] == "KEPALA WAJAH") {
            $rst_x = '';
            foreach($da["details"] as $db) {
               if( $db["chx"] == "1" && $db["is_normal"] == "N" && $db["label"] != "Lain-lain") {
                  if ($rst_x != "") $rst_x .= ", ";
                  $rst_x .= $this->translate($langid, $db["label"] ) ." ".$db["value"];
               }
			   if( $db["label"] == "Lain-lain" && $db["chx"] == "1") {
                  if ($rst_x != "") $rst_x .= ", ";
                  $rst_x .= $db["value"];
               }
            }

			if($rst_x !== ''){
				if ($kesimpulan != "") $kesimpulan .= "
"; $kesimpulan .= ucwords(strtolower($this->translate($langid, $da["title"] ) ))." : ".$rst_x; } } elseif($da["title"] == "MATA") { $rst_x = ''; foreach($da["details"] as $db) { if( $db["chx"] == "1" && $db["is_normal"] == "N" && $db["label"] != "Lain-lain") { if ($rst_x != "") $rst_x .= ", "; $rst_x .= $this->translate($langid, $db["label"] ) ." ".$db["value"]; } if( $db["label"] == "Lain-lain" && $db["chx"] == "1") { if ($rst_x != "") $rst_x .= ", "; $rst_x .= $db["value"]; } } if($rst_x !== ''){ if ($kesimpulan != "") $kesimpulan .= "
"; $kesimpulan .= ucwords(strtolower($this->translate($langid, $da["title"] )))." : ".$rst_x; } } elseif($da["title"] == "PERSEPSI WARNA") { $rst_x = ''; foreach($da["details"] as $db) { if( $db["chx"] == "1" && $db["is_normal"] == "N" && $db["label"] != "Lain-lain") { if ($rst_x != "") $rst_x .= ", "; $rst_x .= $this->translate($langid, $db["label"] ) ." ".$db["value"]; } if( $db["label"] == "Lain-lain" && $db["chx"] == "1") { if ($rst_x != "") $rst_x .= ", "; $rst_x .= $db["value"]; } } if($rst_x !== ''){ if ($kesimpulan != "") $kesimpulan .= "
"; $kesimpulan .= ucwords(strtolower($this->translate($langid, $da["title"] )))." : ".$rst_x; } } elseif($da["title"] == "VISUS JAUH") { $s_rst = ''; foreach($da["details"] as $db) { $str_data = ""; $r_ods = ''; $xr_ods = array(); $kelainan = ''; foreach($db['details'] as $dc){ if($dc['chx'] == '1' && $dc['segment_name'] == 'Tanpa kacamata' && ($dc['value'] != '' && $dc['value'] != '6/6')){ $r_ods .= $dc['label']." : ".$dc['value']." "; array_push($xr_ods,$dc['value']); } if($dc['chx'] == '1' && $dc['segment_name'] == 'Dengan kacamata' && $dc['value'] != ''){ if($dc['value'] != '6/6') $r_ods .= $dc['label']." : ".$dc['value']." "; array_push($r_ods); array_push($xr_ods,$dc['value']); } } //print_r($xr_ods); if(!empty($xr_ods)){ if($db['name'] == 'Tanpa kacamata'){ $kelainan = "Refraction Abnormalities"; $str_data .= $kelainan." ".$this->translate($langid,$db['name'] ) ." ( ".$r_ods.")"; } if($db['name'] == 'Dengan kacamata'){ $all66 = true; foreach($xr_ods as $xd=>$xv){ if($xv != '6/6'){ $all66 = false; } } if($all66){ $kelainan = "Corrected Refraction Abnormalities"; } else{ $kelainan = "Refraction Abnormalities"; } if($r_ods != '') $str_data .= $kelainan." ".$this->translate($langid,$db['name'] ) ." ( ".$r_ods.")"; else $str_data .= $kelainan." ".$this->translate($langid,$db['name'] ); } $s_rst .= $str_data; } //echo $str_data; } if ($s_rst != "" ) { if ($kesimpulan != "") $kesimpulan .= "
"; $kesimpulan .= $s_rst; } } elseif($da["title"] == "TELINGA") { $rst_x = ''; foreach($da["details"] as $db) { if( $db["chx"] == "1" && $db["is_normal"] == "N" && $db["label"] != "Lain-lain") { if ($rst_x != "") $rst_x .= ", "; $rst_x .= $db["label"]." ".$db["value"]; } if( $db["label"] == "Lain-lain" && $db["chx"] == "1") { if ($rst_x != "") $rst_x .= ", "; $rst_x .= $db["value"]; } } if($rst_x !== ''){ if ($kesimpulan != "") $kesimpulan .= "
"; $kesimpulan .= ucwords(strtolower($this->translate($langid, $da["title"] )))." : ".$rst_x; } } elseif($da["title"] == "HIDUNG") { $rst_x = ''; foreach($da["details"] as $db) { if( $db["chx"] == "1" && $db["is_normal"] == "N" && $db["label"] != "Lain-lain") { if ($rst_x != "") $rst_x .= ", "; $rst_x .= $db["label"]." ".$db["value"]; } if( $db["label"] == "Lain-lain" && $db["chx"] == "1") { if ($rst_x != "") $rst_x .= ", "; $rst_x .= $db["value"]; } } if($rst_x !== ''){ if ($kesimpulan != "") $kesimpulan .= "
"; $kesimpulan .= ucwords(strtolower($this->translate($langid, $da["title"] )))." : ".$rst_x; } } elseif($da["title"] == "GIGI") { $arr_gigi= array(); foreach($da["details"] as $db) { foreach($db["details"] as $dc) { $dc["value"] = strtoupper($dc["value"]); if ($dc["value"] != "" && isset($kode_gigi[$dc["value"]])) { $value = $kode_gigi[$dc["value"]]; if (! isset($arr_gigi[$value]) ) $arr_gigi[$value] = array(); $kode = $dc["id_code"]; $pos = substr($kode,-1); if ( strpos($kode,"atas")) { if (strpos($kode,"kiri")) { $arr_gigi[$value][] = "└" . $pos ; } else { $arr_gigi[$value][] = $pos . "┘" ; } } else { if (strpos($kode,"kiri")) { $arr_gigi[$value][] = "┌" .$pos; } else { $arr_gigi[$value][] = $pos . "┐" ; } } } } } $r_gigi = ""; foreach($arr_gigi as $v => $g) { if ($r_gigi != "") $r_gigi .= "
"; $r_gigi .= "".$v." ".join(",",$g).""; } //print_r($arr_gigi); //echo $r_gigi; if ($r_gigi != "" ) { if ($kesimpulan != "") $kesimpulan .= "
"; if ($kesimpulan != "") $kesimpulan .= "Tooth
"; $kesimpulan .= $r_gigi; } } elseif($da["title"] == "MULUT") { $s_rst = ''; foreach($da["details"] as $db) { $s_res = ""; foreach($db["details"] as $dc) { if( $dc["chx"] == "1" && $dc["is_normal"] == "N" && $dc["label"] != 'Lain-lain' ) { if ($s_res != "") $s_res.= ", "; $s_res .= $dc["label"] . " " . $dc["label_x"]." ".$dc["value"]; } if ($dc["label"] == 'Lain-lain' && $dc["chx"] == "1") { if ($s_res != "") $s_res.= ", "; $s_res .= $dc["value"]; } } if ($s_res != "" ) { if ($s_rst != "") $s_rst .= "
"; $s_rst .= "".$this->translate($langid,$db["name"] ) . " : " . $s_res .""; } } if ($s_rst != "" ) { if ($kesimpulan != "") $kesimpulan .= "
"; $kesimpulan .= "".ucwords(strtolower($this->translate($langid, $da["title"] )))."
"; $kesimpulan .= $s_rst; } } elseif($da["title"] == "LEHER") { $rst_x = ''; foreach($da["details"] as $db) { if( $db["chx"] == "1" && $db["is_normal"] == "N" && $db["label"] != "Lain-lain") { if ($rst_x != "") $rst_x .= ", "; $rst_x .= $this->translate($langid,$db["label"]) ." ".$this->translate($langid, $db["value"]); } if( $db["label"] == "Lain-lain" && $db["chx"] == "1") { if ($rst_x != "") $rst_x .= ", "; $rst_x .= $this->translate($langid, $db["value"]); } } if($rst_x !== ''){ if ($kesimpulan != "") $kesimpulan .= "
"; $kesimpulan .= ucwords(strtolower($this->translate($langid, $da["title"] )))." : ".$rst_x; } } elseif($da["title"] == "THORAX / DADA") { $rst_x = ''; foreach($da["details"] as $db) { if( $db["chx"] == "1" && $db["is_normal"] == "N" && $db["label"] != "Lain-lain") { if ($rst_x != "") $rst_x .= ", "; $rst_x .= $db["label"]." ".$db["value"]; } if( $db["label"] == "Lain-lain" && $db["chx"] == "1") { if ($rst_x != "") $rst_x .= ", "; $rst_x .= $db["value"]; } } if($rst_x !== ''){ if ($kesimpulan != "") $kesimpulan .= "
"; $kesimpulan .= ucwords(strtolower($this->translate($langid, $da["title"] )))." : ".$rst_x; } } elseif($da["title"] == "PARU-PARU") { $rst_x = ''; foreach($da["details"] as $db) { if( $db["chx"] == "1" && $db["is_normal"] == "N" && $db["label"] != "Lain-lain") { if ($rst_x != "") $rst_x .= ", "; $rst_x .= $this->translate($langid,$db["label"]) ." ".$db["value"]; } if( $db["label"] == "Lain-lain" && $db["chx"] == "1") { if ($rst_x != "") $rst_x .= ", "; $rst_x .= $db["value"]; } } if($rst_x !== ''){ if ($kesimpulan != "") $kesimpulan .= "
"; $kesimpulan .= ucwords(strtolower($this->translate($langid, $da["title"] )))." : ".$rst_x; } } elseif($da["title"] == "JANTUNG") { $s_rst = ''; foreach($da["details"] as $db) { $s_res = ""; foreach($db["details"] as $dc) { if( $dc["chx"] == "1" && $dc["is_normal"] == "N" && $dc["label"] != 'Lain-lain' ) { if ($s_res != "") $s_res.= ", "; $s_res .= " ( ". $this->translate($langid,$dc["label"]) . " : " . $dc["label_x"]." ".$dc["value"]." )"; } if ($dc["label"] == 'Lain-lain' && $dc["chx"] == "1") { if ($s_res != "") $s_res.= ", "; $s_res .= $dc["value"]; } } if ($s_res != "" ) { if ($s_rst != "") $s_rst .= "
"; $s_rst .= "".$this->translate($langid, $db["name"] ) . " : " . $s_res.""; } } if ($s_rst != "" ) { if ($kesimpulan != "") $kesimpulan .= "
"; $kesimpulan .= ucwords(strtolower($this->translate($langid, $da["title"] )))."
"; $kesimpulan .= $s_rst; } } elseif($da["title"] == "PERUT / ABDOMEN") { foreach($da["details"] as $db) { $s_res = ""; foreach($db["details"] as $dc) { if( $dc["chx"] == "1" && $dc["is_normal"] == "N" && $dc["label"] != 'Lain-lain' && $dc['label'] != 'Tidak Ada') { if ($s_res != "") $s_res.= ", "; $s_res .= $this->translate($langid,$dc["label"]) . " " . $this->translate($langid,$dc["value"]); } if ($dc["label"] == 'Lain-lain' && $dc["chx"] == "1") { if ($s_res != "") $s_res.= ", "; $s_res .= $this->translate($langid,$dc["value"]) ; } } if ($s_res != "" ) { if ($kesimpulan != "") $kesimpulan .= "
"; $kesimpulan .= $this->translate($langid,$db["name"]) . " : " . $s_res; } } } elseif($da["title"] == "GENITOURINARIA") { $rst_x = ''; foreach($da["details"] as $db) { if( $db["chx"] == "1" && $db["is_normal"] == "N" && $db["label"] != "Tidak diperiksa" && $db["label"] != "Lain-lain") { if ($rst_x != "") $rst_x .= ", "; $rst_x .= $this->translate($langid, $db["label"] ) ." ".$db["value"]; } if( $db["label"] == "Lain-lain" && $db["chx"] == "1") { if ($rst_x != "") $rst_x .= ", "; $rst_x .= $db["value"]; } } if($rst_x !== ''){ if ($kesimpulan != "") $kesimpulan .= "
"; $kesimpulan .= ucwords(strtolower($this->translate($langid, $da["title"] )))." : ".$rst_x; } } elseif($da["title"] == "ANGGOTA GERAK") { foreach($da["details"] as $db) { $s_res = ""; foreach($db["details"] as $dc) { if( $dc["chx"] == "1" && $dc["is_normal"] == "N" && $dc["label"] != 'Lain-lain' ) { if ($s_res != "") $s_res.= ", "; $s_res .= "( ".$this->translate($langid,$dc["label"] ) . " ) " . $dc["value"]; /* perubahan 180320 */ } if ($dc["label"] == 'Lain-lain' && $dc["chx"] == "1") { if ($s_res != "") $s_res.= ", "; $s_res .= $dc["value"]; } } if ($s_res != "" ) { if ($kesimpulan != "") $kesimpulan .= "
"; $kesimpulan .= $this->translate($langid, $db["name"] ) . " : " . $s_res; } } } elseif($da["title"] == "SISTEM PERSYARAFAN") { foreach($da["details"] as $db) { $s_res = ""; foreach($db["details"] as $dc) { if( $dc["chx"] == "1" && $dc["is_normal"] == "N" && $dc["label"] != 'Lain-lain' ) { if ($s_res != "") $s_res.= ", "; $s_res .= "( ".$this->translate($langid,$dc["label"] ) . " ) " . $dc["value"]; /* perubahan 180320 */ } if ($dc["label"] == 'Lain-lain' && $dc["chx"] == "1") { if ($s_res != "") $s_res.= ", "; $s_res .= $dc["value"]; } } if ($s_res != "" ) { if ($kesimpulan != "") $kesimpulan .= "
"; $kesimpulan .= $this->translate($langid, $db["name"] ). " : " . $s_res; } } } elseif($da["title"] == "SISTEM INTEGUMEN") { foreach($da["details"] as $db) { $s_res = ""; foreach($db["details"] as $dc) { if( $dc["chx"] == "1" && $dc["is_normal"] == "N" && $dc["label"] != 'Lain-lain' ) { if ($s_res != "") $s_res.= ", "; $s_res .= "( ".$this->translate($langid,$dc["label"] ) . " ) " . $dc["value"]; } if ($dc["label"] == 'Lain-lain' && $dc["chx"] == "1") { if ($s_res != "") $s_res.= ", "; $s_res .= $dc["value"]; } } if ($s_res != "" ) { if ($kesimpulan != "") $kesimpulan .= "
"; $kesimpulan .= $this->translate($langid, $db["name"] ) . " : " . $s_res; } } } } if ($kesimpulan == "" ) { $kesimpulan = "No abnormalities were found."; } else { $kesimpulan = "At this time, an abnormality was found :
" . $kesimpulan; } return $kesimpulan; } function kesimpulanv2($id,$langid) { $kode_gigi = array( "X" => "Cavity" , "C" => "Fillings", "O" => "Fall Out", "R" => "Rem. Roots", "A" => "Dentures" , "K" => "Tartar" ); $sql = "select * from so_resultentry_fisik_umum where So_ResultEntryFisikUmumSo_ResultEntryID= ? and So_ResultEntryFisikUmumM_LangID=? and So_ResultEntryFisikUmumType='fisik'"; $qry = $this->db_smartone->query($sql,array($id,$langid)); $rows = $qry->result_array(); if ( count($rows) == 0 ) return ''; $data = json_decode($rows[0]["So_ResultEntryFisikUmumDetails"],true); $kesimpulan = ""; $arr_gigi = array(); foreach($data as $obj) { if ( isset($obj["details"]) ) { $dd = $obj["details"]; if (isset($dd["details"])) { if (isset($dh["chx_x"])) { if ($dh["chx_x"] == "1") { if ($kesimpulan != "" ) $kesimpulan .= ", "; $kesimpulan .= $dh["label"] . " " . $dh["label_x"]; } } elseif (isset($dh["is_normal"])) { if ($dh["is_normal"] == "N" && $dh["chx"] == "1") { if ($kesimpulan != "" ) $kesimpulan .= ", "; $kesimpulan .= $dh["label"] . " " . $dh["value"]; } } elseif (isset($dh["chx"])) { if ($dh["chx"] == "1") { if ($kesimpulan != "" ) $kesimpulan .= ", "; $kesimpulan .= $dh["label"] . " " . $dh["value"]; } } } else { foreach($dd as $dh) { if ( $obj["type_form"] == "TOOTH" ) { foreach($dh["details"] as $xd) { if ($xd["value"] != "" ) { if ( ! in_array($arr_gigi , $kode_gigi[$xd["value"]]) ) { $arr_gigi[] = $kode_gigi[$xd["value"]]; } } } } elseif (isset($dh["chx_x"])) { if ($dh["chx_x"] == "1") { if ($kesimpulan != "" ) $kesimpulan .= ", "; $kesimpulan .= $dh["label"] . " " . $dh["label_x"]; } } elseif (isset($dh["is_normal"])) { if ($dh["is_normal"] == "N" && $dh["chx"] == "1") { if ($kesimpulan != "" ) $kesimpulan .= ", "; $kesimpulan .= $dh["label"] . " " . $dh["value"]; } } elseif (isset($dh["chx"])) { if ($dh["chx"] == "1") { if ($kesimpulan != "" ) $kesimpulan .= ", "; $kesimpulan .= $dh["label"] . " " . $dh["value"]; } } } } } } if ($kesimpulan == "" ) { $kesimpulan = "Normal Limit"; } else { $kesimpulan = "At this time, an abnormality was found : \n$kesimpulan"; } if ( count($arr_gigi) > 0 ) { $kesimpulan .= "\nGigi : " . join($arr_gigi); } else { $kesimpulan .= "\nGigi : normal."; } return $kesimpulan; } function kesimpulanv3($id,$langid) { $kode_gigi = array( "X" => "Cavity" , "C" => "Fillings", "O" => "Missing Tooth", "R" => "Gangren Radix", "A" => "Dentures" , "K" => "Tartar"); $sql = "select * from so_resultentry_fisik_umum where So_ResultEntryFisikUmumSo_ResultEntryID= ? and So_ResultEntryFisikUmumM_LangID=? and So_ResultEntryFisikUmumType='fisik'"; $qry = $this->db_smartone->query($sql,array($id,$langid)); $rows = $qry->result_array(); if ( count($rows) == 0 ) return ''; $data = json_decode($rows[0]["So_ResultEntryFisikUmumDetails"],true); $kesimpulan = ""; $arr_gigi = array(); foreach($data as $obj) { if ( isset($obj["details"]) ) { $dd = $obj["details"]; if (isset($dd["details"])) { if (isset($dh["chx_x"])) { if ($dh["chx_x"] == "1") { if ($kesimpulan != "" ) $kesimpulan .= ", "; $kesimpulan .= $dh["label"] . " " . $dh["label_x"]; } } elseif (isset($dh["is_normal"])) { if ($dh["is_normal"] == "N") { if ($kesimpulan != "" ) $kesimpulan .= ", "; $kesimpulan .= $dh["label"] . " " . $dh["value"]; } } elseif (isset($dh["chx"])) { if ($dh["chx"] == "1") { if ($kesimpulan != "" ) $kesimpulan .= ", "; $kesimpulan .= $dh["label"] . " " . $dh["value"]; } } } else { foreach($dd as $dh) { if ( $obj["type_form"] == "TOOTH" ) { foreach($dh["details"] as $xd) { if ($xd["value"] != "" ) { if ( ! in_array($arr_gigi , $kode_gigi[$xd["value"]]) ) { $arr_gigi[] = $kode_gigi[$xd["value"]]; } } } } elseif (isset($dh["chx_x"])) { if ($dh["chx_x"] == "1") { if ($kesimpulan != "" ) $kesimpulan .= ", "; $kesimpulan .= $dh["label"] . " " . $dh["label_x"]; } } elseif (isset($dh["is_normal"])) { if ($dh["is_normal"] == "N") { if ($kesimpulan != "" ) $kesimpulan .= ", "; $kesimpulan .= $dh["label"] . " " . $dh["value"]; } } elseif (isset($dh["chx"])) { if ($dh["chx"] == "1") { if ($kesimpulan != "" ) $kesimpulan .= ", "; $kesimpulan .= $dh["label"] . " " . $dh["value"]; } } } } } } if ($kesimpulan == "" ) { $kesimpulan = "Normal Limit"; } else { $kesimpulan = "At this time, an abnormality was found : \n$kesimpulan"; } if ( count($arr_gigi) > 0 ) { $kesimpulan .= "\nGigi : " . join($arr_gigi); } return $kesimpulan; } function saran($id,$langid) { $sql = "select * from so_resultentry_fisik_umum where So_ResultEntryFisikUmumSo_ResultEntryID= ? and So_ResultEntryFisikUmumM_LangID=? and So_ResultEntryFisikUmumType='saran'"; $qry = $this->db_smartone->query($sql,array($id,$langid)); $saran = ""; $rows = $qry->result_array(); if (count($rows) > 0 ) { $saran = $rows[0]["So_ResultEntryFisikUmumDetails"]; } echo json_encode(array("saran" => $saran)); } function konsul($id,$langid) { $sql = "select * from so_resultentry_fisik_umum where So_ResultEntryFisikUmumSo_ResultEntryID= ? and So_ResultEntryFisikUmumM_LangID=? and So_ResultEntryFisikUmumType='konsul'"; $qry = $this->db_smartone->query($sql,array($id,$langid)); $rows = $qry->result_array(); if (count($rows) > 0 ) { $konsul = $rows[0]["So_ResultEntryFisikUmumDetails"]; } echo json_encode(array( "konsul" => $konsul)); } //k3 function faktor_fisik($id,$langid,$type) { $sql = "select * from so_resultentry_fisik_umum where So_ResultEntryFisikUmumSo_ResultEntryID= ? and So_ResultEntryFisikUmumM_LangID=? and So_ResultEntryFisikUmumType=?"; $qry = $this->db_smartone->query($sql,array($id,$langid,$type)); if (! $qry) { return json_encode(array()); } $rows = $qry->result_array(); if (count($rows) == 0 ) { return json_encode(array()); } $details = json_decode($rows[0]["So_ResultEntryFisikUmumDetails"],true); //keluhan saat ini $faktor_fisik = array(); foreach($details as $d) { if ($d["title"] == "FAKTOR FISIK") { foreach($d["details"] as $gp) { // if ($gp["chx"] == 1 ) { $arr_result[] = array($gp["label"],$gp["value_sumber"],$gp["value_lama"],$gp["chx"]) ; $faktor_fisik[] = array( "aaa1" => $this->translate($langid, $gp["label"]), "aaa2" => $gp["value_sumber"], "aaa3" => $gp["value_lama"], "aaa4" => $gp["chx"] ); // } } } } echo json_encode($faktor_fisik); } function faktor_kimia($id,$langid,$type) { $sql = "select * from so_resultentry_fisik_umum where So_ResultEntryFisikUmumSo_ResultEntryID= ? and So_ResultEntryFisikUmumM_LangID=? and So_ResultEntryFisikUmumType=?"; $qry = $this->db_smartone->query($sql,array($id,$langid,$type)); if (! $qry) { return json_encode(array()); } $rows = $qry->result_array(); if (count($rows) == 0 ) { return json_encode(array()); } $details = json_decode($rows[0]["So_ResultEntryFisikUmumDetails"],true); //keluhan saat ini $faktor_kimia = array(); foreach($details as $d) { if ($d["title"] == "FAKTOR KIMIA") { foreach($d["details"] as $gp) { // if ($gp["chx"] == 1 ) { $arr_result[] = array($gp["label"],$gp["value_sumber"],$gp["value_lama"],$gp["chx"]) ; $faktor_kimia[] = array( "bbb1" => $this->translate($langid, $gp["label"]), "bbb2" => $gp["value_sumber"], "bbb3" => $gp["value_lama"], "bbb4" => $gp["chx"] ); // } } } } echo json_encode($faktor_kimia); } function faktor_biologi($id,$langid,$type) { $sql = "select * from so_resultentry_fisik_umum where So_ResultEntryFisikUmumSo_ResultEntryID= ? and So_ResultEntryFisikUmumM_LangID=? and So_ResultEntryFisikUmumType=?"; $qry = $this->db_smartone->query($sql,array($id,$langid,$type)); if (! $qry) { return json_encode(array()); } $rows = $qry->result_array(); if (count($rows) == 0 ) { return json_encode(array()); } $details = json_decode($rows[0]["So_ResultEntryFisikUmumDetails"],true); //keluhan saat ini $faktor_biologi = array(); foreach($details as $d) { if ($d["title"] == "FAKTOR BIOLOGI") { foreach($d["details"] as $gp) { // if ($gp["chx"] == 1 ) { $arr_result[] = array($gp["label"],$gp["value_sumber"],$gp["value_lama"],$gp["chx"]) ; $faktor_biologi[] = array( "ccc1" => $this->translate($langid, $gp["label"]), "ccc2" => $gp["value_sumber"], "ccc3" => $gp["value_lama"], "ccc4" => $gp["chx"] ); // } } } } echo json_encode($faktor_biologi); } function faktor_ergonomi($id,$langid,$type) { $sql = "select * from so_resultentry_fisik_umum where So_ResultEntryFisikUmumSo_ResultEntryID= ? and So_ResultEntryFisikUmumM_LangID=? and So_ResultEntryFisikUmumType=?"; $qry = $this->db_smartone->query($sql,array($id,$langid,$type)); if (! $qry) { return json_encode(array()); } $rows = $qry->result_array(); if (count($rows) == 0 ) { return json_encode(array()); } $details = json_decode($rows[0]["So_ResultEntryFisikUmumDetails"],true); //keluhan saat ini $faktor_ergonomi = array(); foreach($details as $d) { if ($d["title"] == "FAKTOR ERGONOMI") { foreach($d["details"] as $gp) { // if ($gp["chx"] == 1 ) { $arr_result[] = array($gp["label"],$gp["value_sumber"],$gp["value_lama"],$gp["chx"]) ; $faktor_ergonomi[] = array( "ddd1" => $this->translate($langid, $gp["label"]), "ddd2" => $gp["value_sumber"], "ddd3" => $gp["value_lama"], "ddd4" => $gp["chx"] ); // } } } } echo json_encode($faktor_ergonomi); } function faktor_psikologi($id,$langid,$type) { $sql = "select * from so_resultentry_fisik_umum where So_ResultEntryFisikUmumSo_ResultEntryID= ? and So_ResultEntryFisikUmumM_LangID=? and So_ResultEntryFisikUmumType=?"; $qry = $this->db_smartone->query($sql,array($id,$langid,$type)); if (! $qry) { return json_encode(array()); } $rows = $qry->result_array(); if (count($rows) == 0 ) { return json_encode(array()); } $details = json_decode($rows[0]["So_ResultEntryFisikUmumDetails"],true); //keluhan saat ini $faktor_psikologi = array(); foreach($details as $d) { if ($d["title"] == "FAKTOR PSIKOLOGI") { foreach($d["details"] as $gp) { $arr_result[] = array($gp["label"],$gp["value_sumber"],$gp["value_lama"],$gp["chx"]) ; $faktor_psikologi[] = array( "eee1" => $this->translate($langid, $gp["label"]), "eee2" => $gp["value_sumber"], "eee3" => $gp["value_lama"], "eee4" => $gp["chx"] ); } } } echo json_encode($faktor_psikologi); } //k3 function kesimpulanx2($id,$langid,$type) { $sql = "select * from so_resultentry_fisik_umum where So_ResultEntryFisikUmumSo_ResultEntryID= ? and So_ResultEntryFisikUmumM_LangID=? and So_ResultEntryFisikUmumType=?"; $qry = $this->db_smartone->query($sql,array($id,$langid,$type)); if (! $qry) { return json_encode(array()); } $rows = $qry->result_array(); if (count($rows) == 0 ) { return json_encode(array()); } $details = json_decode($rows[0]["So_ResultEntryFisikUmumDetails"],true); //keluhan saat ini $kesimpulanx = array("asdasdasdasdasd"); foreach($details as $d) { if ($d["title"] == "") { foreach($d["details"] as $gp) { if ($gp["chx"] == 1 ) { $arr_result[] = array($gp["label"],$gp["value"]) ; $kesimpulanx[] = array( "nn1" => $gp["label"], "nn2" => $gp["value"] ); } } } } echo json_encode(array("abc" => $kesimpulanx)); } function list() { $sql = "select * from m_religion"; $qry = $this->db_smartone->query($sql); if ($qry) { $rows = $qry->result_array(); echo json_encode($rows); } else { echo json_encode(array()); } } function get($id) { $sql = "select * from m_religion where M_ReligionID=?"; $qry = $this->db_smartone->query($sql,$id); if ($qry) { $rows = $qry->result_array(); echo json_encode($rows); } else { echo json_encode(array()); } } } ?>