db_smartone = $this->load->database("onedev", true); } function index() { echo "Api"; } function pribadi($id,$langid,$type) { //$id = So_ResultEntryID $sql = "select concat(M_TitleName,' ', M_PatientName) M_PatientName, T_OrderHeaderLabNumber RegNo, fn_numbering_external(T_OrderHeaderLabNumber) ExternalRegNo, T_OrderHeaderM_PatientAge, date_format(M_PatientDOB,'%d-%m-%Y') M_PatientDOB , date_format(T_OrderHeaderDate,'%d-%m-%Y') T_OrderHeaderDate, 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,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 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 = 'LAB' left join conf_systems on S_SystemsID > 0 left join t_samplingso on T_SamplingSoT_OrderHeaderID = T_OrderHeaderID left join m_doctor so on T_SamplingSoM_DoctorID = so.M_DoctorID "; $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" => $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" => $gp["label"], "b2" => $gp["value"], ); } } } } } echo json_encode($riwayat_phobia); } 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" => $xd["label"], "c2" => $xd["value"] ); } } } } } } 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 ($gp["chx"] == 1 ) { $arr_result[] = array($gp["label"],$gp["value"]) ; $riwayat_keluarga[] = array( "d1" => $gp["label"], "d2" => $gp["value"], ); } } } } } 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" => $xd["segment_name"], "e2" => $xd["label"].' '.$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" => $gp["label"], "f2" => $gp["value"], ); } } } } } echo json_encode($riwayat_obat); } //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"]; if ($gp["chx_x"] == "1") $value = $gp["label_x"]; if ($gp["chx_y"] == "1") $value = $gp["label_y"]; $tanda_vital[] = array( "aa1" => $gp["label"], "aa2" => $value, "aa3" => $gp["unit"], ); } } } 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"]; $status_gizi[] = array( "qq1" => $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" => $gp["label"], "rr2" => $value, "rr3" => $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" => $gp["label"], "bb2" => $gp["value"], ); } } } } 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" => $gp["label"], "cc2" => $gp["value"], ); } } } } 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" => $gp["label"], "dd2" => $gp["value"], ); } } } } 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" => $gp["label"], "ee2" => $gp["value"], ); } } } } 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" => $gp["name"], "xx2" => $xd["label"], "xx3" => $xd["value"] ); } } } } } 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" => $gp["label"], "ff2" => $gp["value"], ); } } } } echo json_encode($hidung); } function gigi($id,$langid,$type) { $kode_gigi = array( "X" => "Berlubang" , "C" => "Tambalan", "O" => "Tanggal", "R" => "Sisa akar", "A" => "Gigi Palsu" , "K" => "Karang Gigi" ); $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(); foreach($da as $db) { if ($db["title"] != "GIGI") continue; foreach($db["details"] as $dx) { foreach($dx["details"] as $dc) { 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; } } } } } } $gigi= array(); foreach($arr_gigi as $v => $g) { $gigi[] = array("gg1" => join($g,", "), "gg2" => "" , "gg3" => $v); } 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" => $gp["name"], "hh2" => $xd["label"], "hh3" => $xd["value"] ); } } } } } 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" => $gp["label"], "ii2" => $gp["value"], ); } } } } 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" => $gp["label"], "jj2" => $gp["value"], ); } } } } 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" => $gp["label"], "kk2" => $gp["value"], ); } } } } 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" => $gp["name"], "ll2" => $xd["label"], "ll3" => $xd["value"] ); } } } } } 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" => $gp["name"], "mm2" => $xd["label"], "mm3" => $xd["value"] ); } } } } } 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" => $gp["label"], "nn2" => $gp["value"], ); } } } } 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") { 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" => $gp["name"], "oo2" => $xd["label"], "oo3" => $xd["value"] ); } } } } } 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" => $gp["name"], "pp2" => $xd["label"], "pp3" => $xd["value"] ); } } } } } echo json_encode($sistem); } 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" => $gp["name"], "pp2" => $xd["label"], "pp3" => $xd["value"] ); } } } } } 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) {
      $kode_gigi = array( "X" => "Berlubang" , "C" => "Tambalan", "O" => "Tanggal",
         "R" => "Sisa akar", "A" => "Gigi Palsu" , "K" => "Karang Gigi" );
      $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 = "";

      foreach($data as $da) {
         if ($da["title"] == "TANDA VITAL") {
            foreach($da["details"] as $db) {
               if( $db["chx_x"] == "1" ) {
                  if ($kesimpulan != "") $kesimpulan .= ", ";
                  $kesimpulan .= $db["label"] . " " . $db["label_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 .= $db["label"] . " " . $db["label_x"];
               }
               if ($db["label"] == "Klasifikasi" && $db["value"] != "Normal" ) {
                  if ($kesimpulan != "") $kesimpulan .= ", ";
                  $kesimpulan .= $db["value"] . " ( BMI : $bmi_value )";
               }
            }
         } elseif($da["title"] == "KEADAAN UMUM") {
            foreach($da["details"] as $db) {
               if( $db["chx_x"] == "1" ) {
                  if ($kesimpulan != "") $kesimpulan .= ", ";
                  $kesimpulan .= $db["label"] . " " . $db["label_x"];
               }
            }
         } elseif($da["title"] == "KEPALA WAJAH") {
            foreach($da["details"] as $db) {
               if( $db["chx"] == "1" && $db["is_normal"] == "N" ) {
                  if ($kesimpulan != "") $kesimpulan .= ", ";
                  $kesimpulan .= $db["label"] . " " . $db["label_x"];
               }
            }
         } elseif($da["title"] == "MATA") {
            foreach($da["details"] as $db) {
               if( $db["chx"] == "1" && $db["is_normal"] == "N" ) {
                  if ($kesimpulan != "") $kesimpulan .= ", ";
                  $kesimpulan .= $db["label"] . " " . $db["label_x"];
               }
            }
         } elseif($da["title"] == "PERSEPSI WARNA") {
            foreach($da["details"] as $db) {
               if( $db["chx"] == "1" && $db["is_normal"] == "N" ) {
                  if ($kesimpulan != "") $kesimpulan .= ", ";
                  $kesimpulan .= $db["label"] . " " . $db["label_x"];
               }
            }
         } elseif($da["title"] == "VISUS JAUH") {
            foreach($da["details"] as $db) {
               $str_data = "";
               foreach($db["details"] as $dc ) {
                  if ($dc["chx"] == "") continue;
                  $value = str_replace(" ","",$dc["value"]);
                  if (strpos($value,"6/6") === false) {
                     $str_data .= $dc["label"] . " " . $dc["value"];
                  }
               }
               if ($str_data != "" ) {
                  if ($kesimpulan != "") $kesimpulan .= ", ";
                  $kesimpulan .= $db["name"] . "( " . $str_data . " )";
               }
            }
         } elseif($da["title"] == "TELINGA") {
            foreach($da["details"] as $db) {
               if( $db["chx"] == "1" && $db["is_normal"] == "N" ) {
                  if ($kesimpulan != "") $kesimpulan .= ", ";
                  $kesimpulan .= $db["label"] . " " . $db["label_x"];
               }
            }
         } elseif($da["title"] == "HIDUNG") {
            foreach($da["details"] as $db) {
               if( $db["chx"] == "1" && $db["is_normal"] == "N" ) {
                  if ($kesimpulan != "") $kesimpulan .= ", ";
                  $kesimpulan .= $db["label"] . " " . $db["label_x"];
               }
            }
         } elseif($da["title"] == "GIGI") {
            $arr_gigi= array();
            foreach($da["details"] as $db) {
               foreach($db["details"] as $dc) {
                  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) {
               $r_gigi .= $v . " " . join($g,", ");
            }
            if ($r_gigi != "" ) {
               if ($kesimpulan != "") $kesimpulan .= "
Gigi : "; $kesimpulan .= $r_gigi; } } elseif($da["title"] == "MULUT") { foreach($da["details"] as $db) { $s_res = ""; foreach($db["details"] as $dc) { if( $dc["chx"] == "1" && $dc["is_normal"] == "N" ) { if ($s_res != "") $s_res.= ", "; $s_res .= $dc["label"] . " " . $dc["label_x"]; } } if ($s_res != "" ) { if ($kesimpulan != "") $kesimpulan .= ", "; $kesimpulan .= $db["name"] . " " . $s_res; } } } elseif($da["title"] == "LEHER") { foreach($da["details"] as $db) { if( $db["chx"] == "1" && $db["is_normal"] == "N" ) { if ($kesimpulan != "") $kesimpulan .= ", "; $kesimpulan .= $db["label"] . " " . $db["label_x"]; } } } elseif($da["title"] == "THORAX / DADA") { foreach($da["details"] as $db) { if( $db["chx"] == "1" && $db["is_normal"] == "N" ) { if ($kesimpulan != "") $kesimpulan .= ", "; $kesimpulan .= $db["label"] . " " . $db["label_x"]; } } } elseif($da["title"] == "PARU-PARU") { foreach($da["details"] as $db) { if( $db["chx"] == "1" && $db["is_normal"] == "N" ) { if ($kesimpulan != "") $kesimpulan .= ", "; $kesimpulan .= $db["label"] . " " . $db["label_x"]; } } } elseif($da["title"] == "JANTUNG") { foreach($da["details"] as $db) { $s_res = ""; foreach($db["details"] as $dc) { if( $dc["chx"] == "1" && $dc["is_normal"] == "N" ) { if ($s_res != "") $s_res.= ", "; $s_res .= $dc["label"] . " " . $dc["label_x"]; } } if ($s_res != "" ) { if ($kesimpulan != "") $kesimpulan .= ", "; $kesimpulan .= $db["name"] . " " . $s_res; } } } elseif($da["title"] == "PERUT / ABDOMEN") { foreach($da["details"] as $db) { $s_res = ""; foreach($db["details"] as $dc) { if ($dc["label"] == "Tidak Ada") continue; if( $dc["chx"] == "1" && $dc["is_normal"] == "N" ) { if ($s_res != "") $s_res.= ", "; $s_res .= $dc["label"] . " " . $dc["value"]; } } if ($s_res != "" ) { if ($kesimpulan != "") $kesimpulan .= ", "; $kesimpulan .= $db["name"] . " " . $s_res; } } } elseif($da["title"] == "GENITOURINARIA") { foreach($da["details"] as $db) { if( $db["chx"] == "1" && $db["is_normal"] == "N" && $db["label"] != "Tidak diperiksa") { if ($kesimpulan != "") $kesimpulan .= ", "; $kesimpulan .= $db["label"] . " " . $db["value"]; } } } 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" ) { if ($s_res != "") $s_res.= ", "; $s_res .= $dc["label"] . " " . $dc["value"]; } } if ($s_res != "" ) { if ($kesimpulan != "") $kesimpulan .= ", "; $kesimpulan .= $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" ) { if ($s_res != "") $s_res.= ", "; $s_res .= $dc["label"] . " " . $dc["value"]; } } if ($s_res != "" ) { if ($kesimpulan != "") $kesimpulan .= ", "; $kesimpulan .= $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" ) { if ($s_res != "") $s_res.= ", "; $s_res .= $dc["label"] . " " . $dc["value"]; } } if ($s_res != "" ) { if ($kesimpulan != "") $kesimpulan .= ", "; $kesimpulan .= $db["name"] . " " . $s_res; } } } } if ($kesimpulan == "" ) { $kesimpulan = "Dalam batas normal."; } else { $kesimpulan = "Pada saat ini didapatkan kelainan berupa :
" . $kesimpulan; } return $kesimpulan; } function kesimpulanv2($id,$langid) { $kode_gigi = array( "X" => "Berlubang" , "C" => "Tambalan", "O" => "Tanggal", "R" => "Sisa akar", "A" => "Gigi Palsu" , "K" => "Karang Gigi" ); $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 = "Dalam batas normal"; } else { $kesimpulan = "Pada saat ini di dapatkan kelainan berupa : \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" => "Berlubang" , "C" => "Tambalan", "O" => "Tanggal", "R" => "Sisa akar", "A" => "Gigi Palsu" , "K" => "Karang Gigi" ); $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 = "Dalam batas normal"; } else { $kesimpulan = "Pada saat ini di dapatkan kelainan berupa : \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"]) ; $faktor_fisik[] = array( "aaa1" => $gp["label"], "aaa2" => $gp["value_sumber"], "aaa3" => $gp["value_lama"] ); } } } } 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"]) ; $faktor_kimia[] = array( "bbb1" => $gp["label"], "bbb2" => $gp["value_sumber"], "bbb3" => $gp["value_lama"] ); } } } } 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"]) ; $faktor_biologi[] = array( "ccc1" => $gp["label"], "ccc2" => $gp["value_sumber"], "ccc3" => $gp["value_lama"] ); } } } } 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"]) ; $faktor_ergonomi[] = array( "ddd1" => $gp["label"], "ddd2" => $gp["value_sumber"], "ddd3" => $gp["value_lama"] ); } } } } 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) { if ($gp["chx"] == 1 ) { $arr_result[] = array($gp["label"],$gp["value_sumber"],$gp["value_lama"]) ; $faktor_psikologi[] = array( "eee1" => $gp["label"], "eee2" => $gp["value_sumber"], "eee3" => $gp["value_lama"] ); } } } } 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()); } } } ?>