4800 lines
191 KiB
PHP
4800 lines
191 KiB
PHP
<?php
|
|
class Fisik extends MY_Controller
|
|
{
|
|
public function __construct() {
|
|
parent::__construct();
|
|
$this->db_smartone = $this->load->database("onedev", true);
|
|
}
|
|
function pribadi($id,$type) {
|
|
//$id = So_ResultEntryID
|
|
$sql = "
|
|
select
|
|
DATE_FORMAT(T_OrderHeaderDate, '%d-%m-%Y') as T_OrderHeaderDate ,
|
|
T_OrderHeaderLabNumber ,
|
|
concat(M_TitleName ,'. ' , M_PatientName) as M_PatientName,
|
|
if(M_PatientGender = 'male' , 'Laki-Laki' , 'Perempuan') as Gender,
|
|
M_PatientNoReg,
|
|
M_PatientDOB,
|
|
T_OrderHeaderM_PatientAge,
|
|
CorporateName,
|
|
CorporateAddress as M_PatientAddress,
|
|
M_PatientHp ,
|
|
M_PatientEmail,
|
|
M_PatientAddressCity,
|
|
M_PatientAddressState,
|
|
CorporateAddress,
|
|
CorporateEmail ,
|
|
CorporatePhone,
|
|
CorporateAddressCity,
|
|
CorporateAddressState,
|
|
CONCAT(ifnull(M_DoctorPrefix,''),' ',ifnull(M_DoctorPrefix2,''),' ',M_DoctorName,' ',ifnull(M_DoctorSuffix,''),' ',ifnull(M_DoctorSuffix2,'') ) AS M_DoctorName ,
|
|
CONCAT(DATE_FORMAT(M_PatientDOB, '%d-%m-%Y') ,' / ',T_OrderHeaderM_PatientAge) AS Umur,
|
|
NOW() as tanggalsekarang,
|
|
concat(M_PatientDepartement ,' - ' ,M_PatientNIP ) as M_PatientDepartement
|
|
|
|
|
|
|
|
from so_resultentry
|
|
join t_orderheader on So_ResultEntryT_OrderHeaderID = T_OrderHeaderID
|
|
|
|
left join m_patient ON T_OrderHeaderM_PatientID = M_PatientID AND M_PatientIsActive = 'Y'
|
|
left join m_title ON M_PatientM_TitleID = M_TitleID AND M_TitleIsActive = 'Y'
|
|
left join corporate on T_OrderHeaderCorporateID = CorporateID and CorporateIsActive = 'Y'
|
|
left join m_doctorpj ON T_OrderHeaderPjM_DoctorID = M_DoctorPjID and M_DoctorPjIsDefaultPJ = 'Y'
|
|
left join m_doctor ON So_ResultEntryM_DoctorID = M_DoctorID AND M_DoctorIsActive = 'Y'
|
|
|
|
where
|
|
So_ResultEntryID = ? and T_OrderHeaderIsActive = 'Y' group by T_OrderHeaderID ";
|
|
$qry = $this->db_smartone->query($sql,array($id));
|
|
if ($qry) {
|
|
$rows = $qry->result_array();
|
|
|
|
foreach($rows as $idx => $r ) {
|
|
$rows[$idx]["kesimpulan"] = $this->kesimpulanv4($id,$langid);
|
|
|
|
}
|
|
|
|
echo json_encode($rows);
|
|
} else {
|
|
echo json_encode(array());
|
|
}
|
|
}
|
|
|
|
function phobia($id) {
|
|
$sql = "SELECT *
|
|
FROM so_resultentry_fisik_umum
|
|
JOIN fisik_template ON So_ResultEntryFisikUmumFisikTemplateID = FisikTemplateID AND FisikTemplateIsActive = 'Y' AND FisikTemplateTitle = 'RIWAYAT POBIA'
|
|
WHERE
|
|
So_ResultEntryFisikUmumSo_ResultEntryID = ? AND So_ResultEntryFisikUmumIsActive = 'Y'";
|
|
$qry = $this->db_smartone->query($sql,array($id));
|
|
if (! $qry) {
|
|
return "";
|
|
}
|
|
$rows = $qry->result_array();
|
|
if (count($rows) == 0 ) {
|
|
return "";
|
|
}
|
|
$d = json_decode($rows[0]["So_ResultEntryFisikUmumDetails"],true);
|
|
//keluhan saat ini
|
|
$phobia = "";
|
|
//echo $d["title"] ;
|
|
if ($d["title"] == "RIWAYAT POBIA") {
|
|
if ($d["flag_normal"] == "Y") {
|
|
$phobia = $d["label_flag_normal"];
|
|
exit;
|
|
} 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) {
|
|
$ret_array = [];
|
|
$rst_xc = [];
|
|
$sql = "SELECT *, IFNULL(M_PatientOldPID,'') as M_PatientOldPID
|
|
FROM t_orderheader
|
|
JOIN so_resultentry ON So_ResultEntryT_OrderHeaderID = T_OrderHeaderID AND So_ResultEntryID = {$id}
|
|
JOIN m_patient ON T_OrderHeaderM_PatientID = M_PatientID";
|
|
// echo $sql;
|
|
$data_patient = $this->db_smartone->query($sql)->row_array();
|
|
if($data_patient){
|
|
$patient_name = addslashes($data_patient['M_PatientName']);
|
|
$sql = "SELECT *
|
|
FROM x_adm_rekap_patient patient
|
|
JOIN x_adm_rekap_riwayat riwayat ON riwayat.REG_NO = patient.REG_NO
|
|
WHERE
|
|
patient.PATIENT_ID = '{$data_patient['M_PatientOldPID']}' AND
|
|
patient.DOB = '{$data_patient['M_PatientDOB']}' AND
|
|
patient.PATIENT_NAME = '{$patient_name}'";
|
|
//echo $sql;
|
|
$data_tahun_lalu = $this->db_smartone->query($sql)->row_array();
|
|
$ret_array['a1'] = $data_tahun_lalu['Keluhan']?$data_tahun_lalu['Keluhan']:'-';
|
|
$rst_xc[] = $data_tahun_lalu['Keluhan']?$data_tahun_lalu['Keluhan']:'-';
|
|
}else{
|
|
$ret_array['a1'] = "-";
|
|
}
|
|
|
|
$sql = "SELECT *
|
|
FROM so_resultentry_fisik_umum
|
|
JOIN fisik_template ON So_ResultEntryFisikUmumFisikTemplateID = FisikTemplateID AND FisikTemplateIsActive = 'Y' AND FisikTemplateTitle = 'KELUHAN SAAT INI'
|
|
WHERE
|
|
So_ResultEntryFisikUmumSo_ResultEntryID = ? AND So_ResultEntryFisikUmumIsActive = 'Y'";
|
|
$qry = $this->db_smartone->query($sql,array($id));
|
|
if (! $qry) {
|
|
return "";
|
|
}
|
|
$rows = $qry->result_array();
|
|
if (count($rows) == 0 ) {
|
|
return "";
|
|
}
|
|
$d = json_decode($rows[0]["So_ResultEntryFisikUmumDetails"],true);
|
|
|
|
//keluhan saat ini
|
|
$keluhan_saat_ini = "";
|
|
$arr_keluhan = [];
|
|
//echo $d["title"];
|
|
if ($d["title"] == "KELUHAN SAAT INI") {
|
|
if ($d["flag_normal"] == "Y") {
|
|
$keluhan_saat_ini = "";
|
|
|
|
} else {
|
|
foreach($d["details"] as $xd) {
|
|
if ($xd["chx"] == "1" ) {
|
|
//echo $xd["label"];
|
|
$arr_keluhan[] = $xd["label"]." ".$xd["value"];
|
|
if ( $keluhan_saat_ini != "" ) $keluhan_saat_ini .= ", ";
|
|
$keluhan_saat_ini .= $xd["label"];
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
$string_keluhan = count($arr_keluhan > 0)?join(", ",$arr_keluhan):"-";
|
|
if($string_keluhan == '')
|
|
$string_keluhan = "-";
|
|
$ret_array['a2'] = $string_keluhan ;
|
|
//$rst_xc[] = $keluhan_saat_ini == ''?$keluhan_saat_ini :"-";
|
|
//print_r($rst_xc);
|
|
//return $rst;
|
|
echo json_encode([$ret_array]);
|
|
}
|
|
function keluhan_saat_ini_new($id,$langid=1,$type="riwayat") {
|
|
$sql = "SELECT *
|
|
FROM so_resultentry_fisik_umum
|
|
JOIN fisik_template ON So_ResultEntryFisikUmumFisikTemplateID = FisikTemplateID AND FisikTemplateIsActive = 'Y' AND FisikTemplateTitle = 'KELUHAN SAAT INI'
|
|
WHERE
|
|
So_ResultEntryFisikUmumSo_ResultEntryID = ? AND So_ResultEntryFisikUmumIsActive = 'Y'";
|
|
$qry = $this->db_smartone->query($sql,array($id));
|
|
if (! $qry) {
|
|
return "";
|
|
}
|
|
// echo $this->db_smartone->last_query();
|
|
$rows = $qry->result_array();
|
|
if (count($rows) == 0 ) {
|
|
return "";
|
|
}
|
|
$d = json_decode($rows[0]["So_ResultEntryFisikUmumDetails"],true);
|
|
//print_r($details);
|
|
//keluhan saat ini
|
|
$keluhan_saat_ini_new = array();
|
|
|
|
|
|
if ($d["title"] == "KELUHAN SAAT INI") {
|
|
if ($d["flag_normal"] == "Y") {
|
|
$keluhan_saat_ini_new = array();
|
|
//$d["label_flag_normal"];
|
|
|
|
} 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) {
|
|
$sql = "SELECT *
|
|
FROM so_resultentry_fisik_umum
|
|
JOIN fisik_template ON So_ResultEntryFisikUmumFisikTemplateID = FisikTemplateID AND FisikTemplateIsActive = 'Y' AND FisikTemplateTitle = 'RIWAYAT POBIA'
|
|
WHERE
|
|
So_ResultEntryFisikUmumSo_ResultEntryID = ? AND So_ResultEntryFisikUmumIsActive = 'Y'";
|
|
$qry = $this->db_smartone->query($sql,array($id));
|
|
if (! $qry) {
|
|
return json_encode(array());
|
|
}
|
|
$rows = $qry->result_array();
|
|
if (count($rows) == 0 ) {
|
|
return json_encode(array());
|
|
}
|
|
$d = json_decode($rows[0]["So_ResultEntryFisikUmumDetails"],true);
|
|
//keluhan saat ini
|
|
$riwayat_phobia = array();
|
|
|
|
if ($d["title"] == "RIWAYAT POBIA") {
|
|
if ($d["flag_normal"] == "Y") {
|
|
$riwayat_phobia = array();
|
|
|
|
} else {
|
|
foreach($d["details"] as $gp) {
|
|
if ($gp["chx"] == 1 ) {
|
|
$arr_result[] = array($gp["label"],$gp["value"]) ;
|
|
$riwayat_phobia[] = $gp["label"];
|
|
}
|
|
}
|
|
|
|
}
|
|
}
|
|
|
|
$rst = array();
|
|
$rst['a1'] = "-";
|
|
if(count($riwayat_phobia) == 0)
|
|
$rst['a2'] = "-";
|
|
else
|
|
$rst['a2'] = join(", ",$riwayat_phobia);
|
|
|
|
echo json_encode([$rst]);
|
|
}
|
|
|
|
function etnis($id) {
|
|
$sql = "SELECT *
|
|
FROM so_resultentry_fisik_umum
|
|
JOIN fisik_template ON So_ResultEntryFisikUmumFisikTemplateID = FisikTemplateID AND FisikTemplateIsActive = 'Y' AND FisikTemplateTitle = 'ETNIS'
|
|
WHERE
|
|
So_ResultEntryFisikUmumSo_ResultEntryID = ? AND So_ResultEntryFisikUmumIsActive = 'Y'";
|
|
$qry = $this->db_smartone->query($sql,array($id));
|
|
if (! $qry) {
|
|
return json_encode(array());
|
|
}
|
|
$rows = $qry->result_array();
|
|
if (count($rows) == 0 ) {
|
|
return json_encode(array());
|
|
}
|
|
$d = json_decode($rows[0]["So_ResultEntryFisikUmumDetails"],true);
|
|
//keluhan saat ini
|
|
$etnis = array();
|
|
|
|
//echo $d["title"];
|
|
if ($d["title"] == "ETNIS") {
|
|
if ($d["flag_normal"] == "Y") {
|
|
$etnis = array();
|
|
//$d["label_flag_normal"];
|
|
exit;
|
|
} else {
|
|
foreach($d["details"] as $gp) {
|
|
if ($gp["chx"] == 1 ) {
|
|
$arr_result[] = array($gp["label"],$gp["value"]) ;
|
|
$etnis [] = array(
|
|
"x1" => $gp["label"],
|
|
"x2" => $gp["value"],
|
|
);
|
|
}
|
|
}
|
|
|
|
}
|
|
}
|
|
|
|
echo json_encode($etnis);
|
|
}
|
|
|
|
|
|
function bodyfatmonitoring($id,$langid=1,$type="fisik") {
|
|
$sql = " SELECT *
|
|
FROM so_resultentry
|
|
JOIN t_samplingso_additional_fisik_bbtb ON T_SamplingAdditionalFisikBBTBT_OrderHeaderID = So_ResultEntryT_OrderHeaderID
|
|
WHERE
|
|
So_ResultEntryID = ? AND So_ResultEntryIsActive = 'Y'";
|
|
$qry = $this->db_smartone->query($sql,array($id));
|
|
if (! $qry) {
|
|
return json_encode(array());
|
|
}
|
|
$rows = $qry->result_array();
|
|
if (count($rows) == 0 ) {
|
|
return json_encode(array());
|
|
}
|
|
$d = $rows[0]["T_SamplingAdditionalFisikBBTBBodyFat"];
|
|
//keluhan saat ini
|
|
$bodyfat = array();
|
|
$bodyfat [] = array(
|
|
"x1" => "Body Fat",
|
|
"x2" => $d ."%"
|
|
);
|
|
|
|
echo json_encode($bodyfat);
|
|
}
|
|
|
|
|
|
|
|
|
|
function riwayat_penyakit($id) {
|
|
$ret_array = [];
|
|
$sql = "SELECT *, IFNULL(M_PatientOldPID,'') as M_PatientOldPID
|
|
FROM t_orderheader
|
|
JOIN so_resultentry ON So_ResultEntryT_OrderHeaderID = T_OrderHeaderID AND So_ResultEntryID = {$id}
|
|
JOIN m_patient ON T_OrderHeaderM_PatientID = M_PatientID";
|
|
// echo $sql;
|
|
$data_patient = $this->db_smartone->query($sql)->row_array();
|
|
if($data_patient){
|
|
$patient_name = addslashes($data_patient['M_PatientName']);
|
|
$sql = "SELECT *
|
|
FROM x_adm_rekap_patient patient
|
|
JOIN x_adm_rekap_riwayat riwayat ON riwayat.REG_NO = patient.REG_NO
|
|
WHERE
|
|
patient.PATIENT_ID = '{$data_patient['M_PatientOldPID']}' AND
|
|
patient.DOB = '{$data_patient['M_PatientDOB']}' AND
|
|
patient.PATIENT_NAME = '{$patient_name}'";
|
|
//echo $sql;
|
|
$data_tahun_lalu = $this->db_smartone->query($sql)->row_array();
|
|
$ret_array['b1'] = $data_tahun_lalu['Riwayat Penyakit Dahulu']?$data_tahun_lalu['Riwayat Penyakit Dahulu']:'-';
|
|
}else{
|
|
$ret_array['b1'] = "-";
|
|
}
|
|
|
|
|
|
|
|
$sql = "SELECT *
|
|
FROM so_resultentry_fisik_umum
|
|
JOIN fisik_template ON So_ResultEntryFisikUmumFisikTemplateID = FisikTemplateID AND FisikTemplateIsActive = 'Y' AND FisikTemplateTitle = 'RIWAYAT PENYAKIT'
|
|
WHERE
|
|
So_ResultEntryFisikUmumSo_ResultEntryID = ? AND So_ResultEntryFisikUmumIsActive = 'Y'";
|
|
$qry = $this->db_smartone->query($sql,array($id));
|
|
if (! $qry) {
|
|
return json_encode(array());
|
|
}
|
|
$rows = $qry->result_array();
|
|
if (count($rows) == 0 ) {
|
|
return json_encode(array());
|
|
}
|
|
$d = json_decode($rows[0]["So_ResultEntryFisikUmumDetails"],true);
|
|
//keluhan saat ini
|
|
$riwayat_penyakit = array();
|
|
|
|
|
|
if ($d["title"] == "RIWAYAT PENYAKIT") {
|
|
if ($d["flag_normal"] == "Y") {
|
|
$riwayat_penyakit = array();
|
|
//$d["label_flag_normal"];
|
|
// exit;
|
|
} else {
|
|
foreach($d["details"] as $gp) {
|
|
if( $gp['name'] != "Allergi"){
|
|
foreach($gp["details"] as $xd) {
|
|
|
|
if ($xd["chx"] == 1) {
|
|
//print_r($xd);
|
|
$hasil = str_replace("Militus","Melitus",$xd["label"]);
|
|
if($xd["value"] != '')
|
|
$hasil = $xd["label"]." (".$xd["value"].")";
|
|
$arr_result[] = array($xd["label"],$xd["value"],$xd["segment_name"],$xd["id"]) ;
|
|
if($xd["label"] !== "Lain-lain ( Sistem Pencernaan )" &&
|
|
$xd["label"] !== "Lain-lain ( Sistem Pernafasan )" &&
|
|
$xd["label"] !== "Lain-lain ( Sistem Cardiovaskuler )*" &&
|
|
$xd["label"] !== "Lain-lain ( Sistem Syaraf )" &&
|
|
$xd["label"] !== "Lain-lain ( Sistem Penglihatan )" &&
|
|
$xd["label"] !== "Lain-lain ( Sistem Pendengaran/THT )" &&
|
|
$xd["label"] !== "Lain-lain ( Ginjal & Saluran Kemih )" &&
|
|
$xd["label"] !== "Lain-lain ( Tulang, Sendi & Otot )" &&
|
|
$xd["label"] !== "Lain-lain ( Kulit & Sistem Reproduksi )" &&
|
|
$xd["label"] !== "Lain-lain ( Sistem Endokrin )" &&
|
|
$xd["label"] !== "Lain-lain ( Penyakit daerah tropis )" &&
|
|
$xd["label"] !== "Lain-lain ( Penyakit lainnya )"
|
|
){
|
|
$riwayat_penyakit[] = $hasil;
|
|
}else{
|
|
$riwayat_penyakit[] = $hasil;
|
|
}
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|
|
}
|
|
|
|
if(count($riwayat_penyakit) > 0)
|
|
$ret_array['b2'] = join("\r\n",str_replace("*","",$riwayat_penyakit));
|
|
else
|
|
$ret_array['b2'] = "-";
|
|
|
|
echo json_encode([$ret_array]);
|
|
}
|
|
|
|
|
|
|
|
function alergi($id) {
|
|
$ret_array = [];
|
|
$sql = "SELECT *, IFNULL(M_PatientOldPID,'') as M_PatientOldPID
|
|
FROM t_orderheader
|
|
JOIN so_resultentry ON So_ResultEntryT_OrderHeaderID = T_OrderHeaderID AND So_ResultEntryID = {$id}
|
|
JOIN m_patient ON T_OrderHeaderM_PatientID = M_PatientID";
|
|
// echo $sql;
|
|
$data_patient = $this->db_smartone->query($sql)->row_array();
|
|
if($data_patient){
|
|
$patient_name = addslashes($data_patient['M_PatientName']);
|
|
$sql = "SELECT *
|
|
FROM x_adm_rekap_patient patient
|
|
JOIN x_adm_rekap_riwayat riwayat ON riwayat.REG_NO = patient.REG_NO
|
|
WHERE
|
|
patient.PATIENT_ID = '{$data_patient['M_PatientOldPID']}' AND
|
|
patient.DOB = '{$data_patient['M_PatientDOB']}' AND
|
|
patient.PATIENT_NAME = '{$patient_name}'";
|
|
//echo $sql;
|
|
$data_tahun_lalu = $this->db_smartone->query($sql)->row_array();
|
|
$ret_array['a1'] = $data_tahun_lalu['Alergi']? $data_tahun_lalu['Alergi']:'-';
|
|
}else{
|
|
$ret_array['a1'] = "-";
|
|
}
|
|
|
|
|
|
|
|
$sql = "SELECT *
|
|
FROM so_resultentry_fisik_umum
|
|
JOIN fisik_template ON So_ResultEntryFisikUmumFisikTemplateID = FisikTemplateID AND FisikTemplateIsActive = 'Y' AND FisikTemplateTitle = 'RIWAYAT PENYAKIT'
|
|
WHERE
|
|
So_ResultEntryFisikUmumSo_ResultEntryID = ? AND So_ResultEntryFisikUmumIsActive = 'Y'";
|
|
$qry = $this->db_smartone->query($sql,array($id));
|
|
if (! $qry) {
|
|
return json_encode(array());
|
|
}
|
|
$rows = $qry->result_array();
|
|
if (count($rows) == 0 ) {
|
|
return json_encode(array());
|
|
}
|
|
$d = json_decode($rows[0]["So_ResultEntryFisikUmumDetails"],true);
|
|
//keluhan saat ini
|
|
$riwayat_penyakit = array();
|
|
|
|
|
|
if ($d["title"] == "RIWAYAT PENYAKIT") {
|
|
if ($d["flag_normal"] == "Y") {
|
|
$riwayat_penyakit = array();
|
|
//$d["label_flag_normal"];
|
|
// exit;
|
|
} else {
|
|
foreach($d["details"] as $gp) {
|
|
if( $gp['name'] == "Allergi"){
|
|
foreach($gp["details"] as $xd) {
|
|
if ($xd["chx"] == 1 && $xd['id_code'] != 'fisik_penyakit_64') {
|
|
$arr_result[] = array($xd["label"],$xd["value"],$xd["segment_name"],$xd["id"]) ;
|
|
$hasil = $xd["label"];
|
|
if($xd['value'] != '')
|
|
$hasil = $xd["label"]." (".$xd["value"].")";
|
|
|
|
$riwayat_penyakit[] = $hasil;
|
|
}
|
|
if ($xd["chx"] == 1 && $xd['id_code'] == 'fisik_penyakit_64') {
|
|
//echo $xd['id_code'];
|
|
$arr_result[] = array($xd["label"],$xd["value"],$xd["segment_name"],$xd["id"]) ;
|
|
$hasil = $xd["label"];
|
|
if($xd['value'] != '')
|
|
$hasil = $xd["label"]." (".$xd["value"].")";
|
|
$riwayat_penyakit[] = $hasil;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|
|
}
|
|
|
|
if(count($riwayat_penyakit) > 0)
|
|
$ret_array['a2'] = join(", ",$riwayat_penyakit);
|
|
else
|
|
$ret_array['a2'] = "-";
|
|
|
|
echo json_encode([$ret_array]);
|
|
}
|
|
|
|
function riwayat_keluarga($id,$type) {
|
|
$ret_array = [];
|
|
$sql = "SELECT *, IFNULL(M_PatientOldPID,'') as M_PatientOldPID
|
|
FROM t_orderheader
|
|
JOIN so_resultentry ON So_ResultEntryT_OrderHeaderID = T_OrderHeaderID AND So_ResultEntryID = {$id}
|
|
JOIN m_patient ON T_OrderHeaderM_PatientID = M_PatientID";
|
|
// echo $sql;
|
|
$data_patient = $this->db_smartone->query($sql)->row_array();
|
|
if($data_patient){
|
|
$patient_name = addslashes($data_patient['M_PatientName']);
|
|
$sql = "SELECT *
|
|
FROM x_adm_rekap_patient patient
|
|
JOIN x_adm_rekap_riwayat riwayat ON riwayat.REG_NO = patient.REG_NO
|
|
WHERE
|
|
patient.PATIENT_ID = '{$data_patient['M_PatientOldPID']}' AND
|
|
patient.DOB = '{$data_patient['M_PatientDOB']}' AND
|
|
patient.PATIENT_NAME = '{$patient_name}'";
|
|
//echo $sql;
|
|
$data_tahun_lalu = $this->db_smartone->query($sql)->row_array();
|
|
if($type == 'ayah')
|
|
$ret_array['a1'] = $data_tahun_lalu['Ayah']? $data_tahun_lalu['Ayah']:'-';
|
|
else
|
|
$ret_array['c1'] = $data_tahun_lalu['Ibu']?$data_tahun_lalu['Ibu']:'-';
|
|
}else{
|
|
if($type == 'ayah')
|
|
$ret_array['a1'] = '-';
|
|
else
|
|
$ret_array['c1'] = '-';
|
|
}
|
|
|
|
$sql = "SELECT *
|
|
FROM so_resultentry_fisik_umum
|
|
JOIN fisik_template ON So_ResultEntryFisikUmumFisikTemplateID = FisikTemplateID AND FisikTemplateIsActive = 'Y' AND FisikTemplateTitle = 'RIWAYAT PENYAKIT KELUARGA'
|
|
WHERE
|
|
So_ResultEntryFisikUmumSo_ResultEntryID = ? AND So_ResultEntryFisikUmumIsActive = 'Y'";
|
|
$qry = $this->db_smartone->query($sql,array($id));
|
|
if (! $qry) {
|
|
return json_encode(array());
|
|
}
|
|
$rows = $qry->result_array();
|
|
if (count($rows) == 0 ) {
|
|
return json_encode(array());
|
|
}
|
|
$d = json_decode($rows[0]["So_ResultEntryFisikUmumDetails"],true);
|
|
//keluhan saat ini
|
|
$riwayat_keluarga = array();
|
|
$ayah = [];
|
|
$ibu = [];
|
|
|
|
if ($d["title"] == "RIWAYAT PENYAKIT KELUARGA") {
|
|
if ($d["flag_normal"] == "Y") {
|
|
// $ret_array[] = array("Ayah" => "-","Ibu" => "-");
|
|
//$d["label_flag_normal"];
|
|
//exit;
|
|
$string_ayah = count($ayah > 0)?join(", ",$ayah):"-";
|
|
$string_ibu = count($ibu > 0)?join(", ",$ibu):"-";
|
|
if($string_ibu == '')
|
|
$string_ibu = "-";
|
|
|
|
if($string_ayah == '')
|
|
$string_ayah = "-";
|
|
//echo $string_ibu;
|
|
if($type == 'ayah')
|
|
$ret_array['a2'] = $string_ayah;
|
|
else
|
|
$ret_array['c2'] = $string_ibu;
|
|
} else {
|
|
//print_r($d["details"]);
|
|
|
|
foreach($d["details"] as $gp) {
|
|
if (true || $gp["chx"] == 1 ) {
|
|
//print_r($gp["options"]);
|
|
$arr_result[] = array($gp["label"],$gp["value"],$gp["id"]) ;
|
|
foreach($gp["options"] as $k => $gpd) {
|
|
if($gpd["selected"] == 1) {
|
|
$label = $gp["label"];
|
|
if($label == "Diabetes Millitus"){
|
|
$label = "Diabetes Melitus";
|
|
}
|
|
if($label == "Hypertensi"){
|
|
$label = "Hipertensi";
|
|
}
|
|
if($k == 0){
|
|
$ayah[] = $label;
|
|
}else{
|
|
$ibu[] = $label;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
//echo count($ibu);
|
|
$string_ayah = count($ayah > 0)?join(", ",$ayah):"-";
|
|
$string_ibu = count($ibu > 0)?join(", ",$ibu):"-";
|
|
if($string_ibu == '')
|
|
$string_ibu = "-";
|
|
|
|
if($string_ayah == '')
|
|
$string_ayah = "-";
|
|
//echo $string_ibu;
|
|
if($type == 'ayah')
|
|
$ret_array['a2'] = $string_ayah;
|
|
else
|
|
$ret_array['c2'] = $string_ibu;
|
|
}
|
|
}
|
|
|
|
//echo $string_ibu;
|
|
//echo $string_ayah;
|
|
|
|
echo json_encode([$ret_array]);
|
|
}
|
|
|
|
function merokok($id) {
|
|
$ret_array = [];
|
|
$sql = "SELECT *, IFNULL(M_PatientOldPID,'') as M_PatientOldPID
|
|
FROM t_orderheader
|
|
JOIN so_resultentry ON So_ResultEntryT_OrderHeaderID = T_OrderHeaderID AND So_ResultEntryID = {$id}
|
|
JOIN m_patient ON T_OrderHeaderM_PatientID = M_PatientID";
|
|
// echo $sql;
|
|
$data_patient = $this->db_smartone->query($sql)->row_array();
|
|
if($data_patient){
|
|
$patient_name = addslashes($data_patient['M_PatientName']);
|
|
$sql = "SELECT *
|
|
FROM x_adm_rekap_patient patient
|
|
JOIN x_adm_rekap_riwayat riwayat ON riwayat.REG_NO = patient.REG_NO
|
|
WHERE
|
|
patient.PATIENT_ID = '{$data_patient['M_PatientOldPID']}' AND
|
|
patient.DOB = '{$data_patient['M_PatientDOB']}' AND
|
|
patient.PATIENT_NAME = '{$patient_name}'";
|
|
//echo $sql;
|
|
$data_tahun_lalu = $this->db_smartone->query($sql)->row_array();
|
|
$ret_array['a1'] = $data_tahun_lalu['Kebiasaan Merokok']?$data_tahun_lalu['Kebiasaan Merokok']:'-';
|
|
}else{
|
|
$ret_array['a1'] = "-";
|
|
}
|
|
|
|
|
|
$sql = "SELECT *
|
|
FROM so_resultentry_fisik_umum
|
|
JOIN fisik_template ON So_ResultEntryFisikUmumFisikTemplateID = FisikTemplateID AND FisikTemplateIsActive = 'Y' AND FisikTemplateTitle = 'RIWAYAT KEBIASAAN HIDUP'
|
|
WHERE
|
|
So_ResultEntryFisikUmumSo_ResultEntryID = ? AND So_ResultEntryFisikUmumIsActive = 'Y'";
|
|
$qry = $this->db_smartone->query($sql,array($id));
|
|
if (! $qry) {
|
|
return json_encode(array());
|
|
}
|
|
$rows = $qry->result_array();
|
|
if (count($rows) == 0 ) {
|
|
return json_encode(array());
|
|
}
|
|
$d = json_decode($rows[0]["So_ResultEntryFisikUmumDetails"],true);
|
|
//keluhan saat ini
|
|
$riwayat_hidup = array();
|
|
|
|
if ($d["title"] == "RIWAYAT KEBIASAAN HIDUP") {
|
|
if ($d["flag_normal"] == "Y") {
|
|
$riwayat_hidup = array();
|
|
//$d["label_flag_normal"];
|
|
//exit;
|
|
} else {
|
|
foreach($d["details"] as $gp) {
|
|
if($gp['name'] == 'Merokok'){
|
|
foreach($gp["details"] as $xd) {
|
|
if ($xd["chx"] == 1 ) {
|
|
$arr_result[] = array($xd["segment_name"],$xd["label"],$xd["value"]) ;
|
|
if($xd['id_code'] != 'fisik_kebiasaanhidup_4'){
|
|
$riwayat_hidup[] = $xd['label'].' '.$xd["value"];
|
|
}else{
|
|
$riwayat_hidup[] = $xd["label"].' '.$xd["value"] .' '.$xd['suffix'];
|
|
}
|
|
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
}
|
|
|
|
if(count($riwayat_hidup) > 0){
|
|
$ret_array['a2'] = join(", ",$riwayat_hidup);
|
|
}else{
|
|
$ret_array['a2'] = "-";
|
|
}
|
|
|
|
echo json_encode([$ret_array]);
|
|
}
|
|
|
|
function alkohol($id) {
|
|
$ret_array = [];
|
|
$sql = "SELECT *, IFNULL(M_PatientOldPID,'') as M_PatientOldPID
|
|
FROM t_orderheader
|
|
JOIN so_resultentry ON So_ResultEntryT_OrderHeaderID = T_OrderHeaderID AND So_ResultEntryID = {$id}
|
|
JOIN m_patient ON T_OrderHeaderM_PatientID = M_PatientID";
|
|
// echo $sql;
|
|
$data_patient = $this->db_smartone->query($sql)->row_array();
|
|
if($data_patient){
|
|
$patient_name = addslashes($data_patient['M_PatientName']);
|
|
$sql = "SELECT *
|
|
FROM x_adm_rekap_patient patient
|
|
JOIN x_adm_rekap_riwayat riwayat ON riwayat.REG_NO = patient.REG_NO
|
|
WHERE
|
|
patient.PATIENT_ID = '{$data_patient['M_PatientOldPID']}' AND
|
|
patient.DOB = '{$data_patient['M_PatientDOB']}' AND
|
|
patient.PATIENT_NAME = '{$patient_name}'";
|
|
//echo $sql;
|
|
$data_tahun_lalu = $this->db_smartone->query($sql)->row_array();
|
|
$ret_array['a1'] = $data_tahun_lalu['Kebiasaan Alkohol']?$data_tahun_lalu['Kebiasaan Alkohol']:'-';
|
|
}else{
|
|
$ret_array['a1'] = "-";
|
|
}
|
|
|
|
|
|
$sql = "SELECT *
|
|
FROM so_resultentry_fisik_umum
|
|
JOIN fisik_template ON So_ResultEntryFisikUmumFisikTemplateID = FisikTemplateID AND FisikTemplateIsActive = 'Y' AND FisikTemplateTitle = 'RIWAYAT KEBIASAAN HIDUP'
|
|
WHERE
|
|
So_ResultEntryFisikUmumSo_ResultEntryID = ? AND So_ResultEntryFisikUmumIsActive = 'Y'";
|
|
$qry = $this->db_smartone->query($sql,array($id));
|
|
if (! $qry) {
|
|
return json_encode(array());
|
|
}
|
|
$rows = $qry->result_array();
|
|
if (count($rows) == 0 ) {
|
|
return json_encode(array());
|
|
}
|
|
$d = json_decode($rows[0]["So_ResultEntryFisikUmumDetails"],true);
|
|
//keluhan saat ini
|
|
$riwayat_hidup = array();
|
|
|
|
if ($d["title"] == "RIWAYAT KEBIASAAN HIDUP") {
|
|
if ($d["flag_normal"] == "Y") {
|
|
$riwayat_hidup = array();
|
|
//$d["label_flag_normal"];
|
|
//exit;
|
|
} else {
|
|
foreach($d["details"] as $gp) {
|
|
if($gp['name'] == 'Minum alkohol'){
|
|
foreach($gp["details"] as $xd) {
|
|
if ($xd["chx"] == 1 ) {
|
|
$arr_result[] = array($xd["segment_name"],$xd["label"],$xd["value"]) ;
|
|
if($xd['id_code'] != 'fisik_kebiasaanhidup_4'){
|
|
$riwayat_hidup[] = $xd['label'].' '.$xd["value"];
|
|
}else{
|
|
$riwayat_hidup[] = $xd["label"].' '.$xd["value"] .' '.$xd['suffix'];
|
|
}
|
|
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
}
|
|
|
|
if(count($riwayat_hidup) > 0){
|
|
$ret_array['a2'] = join(", ",$riwayat_hidup);
|
|
}else{
|
|
$ret_array['a2'] = "-";
|
|
}
|
|
|
|
echo json_encode([$ret_array]);
|
|
}
|
|
|
|
function olahraga($id) {
|
|
$ret_array = [];
|
|
$sql = "SELECT *, IFNULL(M_PatientOldPID,'') as M_PatientOldPID
|
|
FROM t_orderheader
|
|
JOIN so_resultentry ON So_ResultEntryT_OrderHeaderID = T_OrderHeaderID AND So_ResultEntryID = {$id}
|
|
JOIN m_patient ON T_OrderHeaderM_PatientID = M_PatientID";
|
|
// echo $sql;
|
|
$data_patient = $this->db_smartone->query($sql)->row_array();
|
|
if($data_patient){
|
|
$patient_name = addslashes($data_patient['M_PatientName']);
|
|
$sql = "SELECT *
|
|
FROM x_adm_rekap_patient patient
|
|
JOIN x_adm_rekap_riwayat riwayat ON riwayat.REG_NO = patient.REG_NO
|
|
WHERE
|
|
patient.PATIENT_ID = '{$data_patient['M_PatientOldPID']}' AND
|
|
patient.DOB = '{$data_patient['M_PatientDOB']}' AND
|
|
patient.PATIENT_NAME = '{$patient_name}'";
|
|
//echo $sql;
|
|
$data_tahun_lalu = $this->db_smartone->query($sql)->row_array();
|
|
$ret_array['a1'] = $data_tahun_lalu['Kebiasaan Olahraga']?$data_tahun_lalu['Kebiasaan Olahraga']:'-';
|
|
}else{
|
|
$ret_array['a1'] = "-";
|
|
}
|
|
|
|
|
|
$sql = "SELECT *
|
|
FROM so_resultentry_fisik_umum
|
|
JOIN fisik_template ON So_ResultEntryFisikUmumFisikTemplateID = FisikTemplateID AND FisikTemplateIsActive = 'Y' AND FisikTemplateTitle = 'RIWAYAT KEBIASAAN HIDUP'
|
|
WHERE
|
|
So_ResultEntryFisikUmumSo_ResultEntryID = ? AND So_ResultEntryFisikUmumIsActive = 'Y'";
|
|
$qry = $this->db_smartone->query($sql,array($id));
|
|
if (! $qry) {
|
|
return json_encode(array());
|
|
}
|
|
$rows = $qry->result_array();
|
|
if (count($rows) == 0 ) {
|
|
return json_encode(array());
|
|
}
|
|
$d = json_decode($rows[0]["So_ResultEntryFisikUmumDetails"],true);
|
|
//keluhan saat ini
|
|
$riwayat_hidup = array();
|
|
|
|
if ($d["title"] == "RIWAYAT KEBIASAAN HIDUP") {
|
|
if ($d["flag_normal"] == "Y") {
|
|
$riwayat_hidup = array();
|
|
//$d["label_flag_normal"];
|
|
//exit;
|
|
} else {
|
|
foreach($d["details"] as $gp) {
|
|
if($gp['name'] == 'Olahraga'){
|
|
foreach($gp["details"] as $xd) {
|
|
if ($xd["chx"] == 1 ) {
|
|
$arr_result[] = array($xd["segment_name"],$xd["label"],$xd["value"]) ;
|
|
if($xd['id_code'] != 'fisik_kebiasaanhidup_4'){
|
|
$riwayat_hidup[] = $xd['label'].' '.$xd["value"];
|
|
}else{
|
|
$jumlah_olahraga = "";
|
|
if($xd["value"] != '')
|
|
$jumlah_olahraga = $xd["value"] .' '.$xd['suffix'];
|
|
|
|
$riwayat_hidup[] = $xd["label"].' '.$jumlah_olahraga;
|
|
}
|
|
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
}
|
|
|
|
if(count($riwayat_hidup) > 0){
|
|
$ret_array['a2'] = join(", ",$riwayat_hidup);
|
|
}else{
|
|
$ret_array['a2'] = "-";
|
|
}
|
|
|
|
echo json_encode([$ret_array]);
|
|
}
|
|
|
|
function riwayat_obat($id) {
|
|
$ret_array = [];
|
|
$ret_array['a1'] = "-";
|
|
$sql = "SELECT *
|
|
FROM so_resultentry_fisik_umum
|
|
JOIN fisik_template ON So_ResultEntryFisikUmumFisikTemplateID = FisikTemplateID AND FisikTemplateIsActive = 'Y'
|
|
AND FisikTemplateTitle = 'RIWAYAT KONSUMSI OBAT TERATUR'
|
|
WHERE
|
|
So_ResultEntryFisikUmumSo_ResultEntryID = ? AND So_ResultEntryFisikUmumIsActive = 'Y'";
|
|
$qry = $this->db_smartone->query($sql,array($id));
|
|
if (! $qry) {
|
|
return json_encode(array());
|
|
}
|
|
$rows = $qry->result_array();
|
|
if (count($rows) == 0 ) {
|
|
return json_encode(array());
|
|
}
|
|
$d = json_decode($rows[0]["So_ResultEntryFisikUmumDetails"],true);
|
|
//keluhan saat ini
|
|
$riwayat_obat = array();
|
|
|
|
|
|
if ($d["title"] == "RIWAYAT KONSUMSI OBAT TERATUR") {
|
|
if ($d["flag_normal"] == "Y") {
|
|
$riwayat_obat = array();
|
|
//$d["label_flag_normal"];
|
|
// exit;
|
|
} else {
|
|
foreach($d["details"] as $gp) {
|
|
if ($gp["chx"] == 1 ) {
|
|
$arr_result[] = array($gp["label"],$gp["value"]) ;
|
|
$hasil = $gp["label"];
|
|
if($gp["value"] != '')
|
|
$hasil = $gp["label"]." (".$gp["value"].")";
|
|
$riwayat_obat[] = $hasil;
|
|
}
|
|
}
|
|
|
|
}
|
|
}
|
|
|
|
$string_obat = count($riwayat_obat) > 0?join(", ",$riwayat_obat):"-";
|
|
$ret_array['a2'] = $string_obat;
|
|
echo json_encode([$ret_array]);
|
|
}
|
|
|
|
|
|
|
|
function riwayat_imunisasi($id) {
|
|
$ret_array = [];
|
|
$ret_array['a1'] = "-";
|
|
$sql = "SELECT *
|
|
FROM so_resultentry_fisik_umum
|
|
JOIN fisik_template ON So_ResultEntryFisikUmumFisikTemplateID = FisikTemplateID AND FisikTemplateIsActive = 'Y' AND FisikTemplateTitle = 'RIWAYAT IMUNISASI'
|
|
WHERE
|
|
So_ResultEntryFisikUmumSo_ResultEntryID = ? AND So_ResultEntryFisikUmumIsActive = 'Y'";
|
|
$qry = $this->db_smartone->query($sql,array($id));
|
|
if (! $qry) {
|
|
return json_encode(array());
|
|
}
|
|
$rows = $qry->result_array();
|
|
if (count($rows) == 0 ) {
|
|
return json_encode(array());
|
|
}
|
|
$d = json_decode($rows[0]["So_ResultEntryFisikUmumDetails"],true);
|
|
//keluhan saat ini
|
|
$riwayat_imunisasi= array();
|
|
|
|
|
|
if ($d["title"] == "RIWAYAT IMUNISASI") {
|
|
if ($d["flag_normal"] == "Y") {
|
|
$riwayat_imunisasi= array();
|
|
//$d["label_flag_normal"];
|
|
|
|
} else {
|
|
foreach($d["details"] as $gp) {
|
|
foreach($gp["details"] as $xd) {
|
|
if ($xd["chx"] == 1 ) {
|
|
if($xd["label"] == 'Pernah')
|
|
$riwayat_imunisasi[] = str_replace(","," ",$xd["segment_name"]).' '.$xd["value"];
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|
|
}
|
|
$string_obat = count($riwayat_imunisasi) > 0?join(", ",$riwayat_imunisasi):"-";
|
|
$ret_array['a2'] = $string_obat;
|
|
echo json_encode([$ret_array]);
|
|
}
|
|
|
|
|
|
|
|
|
|
//pemeriksaan Fisik
|
|
function tanda_vital($id,$langid=1,$type="fisik") {
|
|
$sql = "SELECT *
|
|
FROM so_resultentry_fisik_umum
|
|
JOIN fisik_template ON So_ResultEntryFisikUmumFisikTemplateID = FisikTemplateID AND FisikTemplateIsActive = 'Y' AND FisikTemplateTitle = 'TANDA VITAL'
|
|
WHERE
|
|
So_ResultEntryFisikUmumSo_ResultEntryID = ? AND So_ResultEntryFisikUmumIsActive = 'Y'";
|
|
$qry = $this->db_smartone->query($sql,array($id));
|
|
if (! $qry) {
|
|
return json_encode(array());
|
|
}
|
|
$rows = $qry->result_array();
|
|
if (count($rows) == 0 ) {
|
|
return json_encode(array());
|
|
}
|
|
$d = json_decode($rows[0]["So_ResultEntryFisikUmumDetails"],true);
|
|
//keluhan saat ini
|
|
$tanda_vital = array();
|
|
|
|
if ($d["title"] == "TANDA VITAL") {
|
|
|
|
foreach($d["details"] as $gp) {
|
|
if($gp['id_code'] != 'tanda_vital_5'){
|
|
$value = $gp["value"].' '.$gp["unit"];
|
|
if ($gp["chx_y"] == "1") $value = $gp["label_y"];
|
|
|
|
if ($gp["chx_x"] == "1") $value = $gp["label_x"] .' ' .$gp["value"].' '.$gp["unit"];
|
|
|
|
|
|
$tanda_vital[] = array(
|
|
"aa1" => $gp["label"],
|
|
"aa2" => $value,
|
|
"aa3" => ucwords(strtolower($gp["value_x"])),
|
|
);
|
|
}else{
|
|
$kesimpulan = str_replace("Stadium","Stage",$gp["value"]);
|
|
$value = $gp["value_x"].'/'.$gp["value_y"].' '.$gp["unit"];
|
|
$tanda_vital[] = array(
|
|
"aa1" => $gp["label"],
|
|
"aa2" => $value,
|
|
"aa3" => ucwords(strtolower($kesimpulan)),
|
|
);
|
|
}
|
|
|
|
}
|
|
}
|
|
|
|
echo json_encode($tanda_vital);
|
|
}
|
|
|
|
function tbbbbodyfat($id,$type) {
|
|
$ret_array = [];
|
|
$OhID = -1;
|
|
$sql = "SELECT *, IFNULL(M_PatientOldPID,'') as M_PatientOldPID
|
|
FROM t_orderheader
|
|
JOIN so_resultentry ON So_ResultEntryT_OrderHeaderID = T_OrderHeaderID AND So_ResultEntryID = {$id}
|
|
JOIN m_patient ON T_OrderHeaderM_PatientID = M_PatientID";
|
|
// echo $sql;
|
|
$data_patient = $this->db_smartone->query($sql)->row_array();
|
|
if($data_patient){
|
|
$OhID = $data_patient['T_OrderHeaderID'];
|
|
$patient_name = addslashes($data_patient['M_PatientName']);
|
|
$sql = "SELECT *
|
|
FROM x_adm_rekap_patient patient
|
|
JOIN x_adm_rekap_fisik_vital vital ON vital.REG_NO = patient.REG_NO
|
|
WHERE
|
|
patient.PATIENT_ID = '{$data_patient['M_PatientOldPID']}' AND
|
|
patient.DOB = '{$data_patient['M_PatientDOB']}' AND
|
|
patient.PATIENT_NAME = '{$patient_name}'";
|
|
//echo $sql;
|
|
$data_tahun_lalu = $this->db_smartone->query($sql)->row_array();
|
|
if($type=="TB")
|
|
$ret_array['a1'] = $data_tahun_lalu['TB']." cm";
|
|
else if($type=="BB")
|
|
$ret_array['a1'] = $data_tahun_lalu['BB']." kg";
|
|
else if($type=="BMI"){
|
|
$kelas_bmi = $this->klasifikasi_bmi($data_tahun_lalu['BMI']);
|
|
if(intval($data_tahun_lalu['TB']) > 0 && intval($data_tahun_lalu['BB']) > 0)
|
|
$ret_array['a1'] = $data_tahun_lalu['BMI']." ".$kelas_bmi;
|
|
else
|
|
$ret_array['a1'] = "-";
|
|
}
|
|
else
|
|
$ret_array['a1'] = "-";
|
|
}else{
|
|
$ret_array['a1'] = "-";
|
|
}
|
|
|
|
$sql = "SELECT *
|
|
FROM so_resultentry
|
|
JOIN t_samplingso_additional_fisik_bbtb ON So_ResultEntryT_OrderHeaderID = T_SamplingAdditionalFisikBBTBT_OrderHeaderID
|
|
WHERE
|
|
So_ResultEntryID = $id LIMIT 1";
|
|
//echo $sql;
|
|
$qry = $this->db_smartone->query($sql);
|
|
if (! $qry) {
|
|
return json_encode(array());
|
|
}
|
|
//echo $this->db_smartone->last_query();
|
|
$row_result = $qry->row_array();
|
|
|
|
$status_gizi = array();
|
|
$bb = $row_result["T_SamplingAdditionalFisikBBTBValueBB"];
|
|
$tb = $row_result["T_SamplingAdditionalFisikBBTBValueTB"];
|
|
$bodyfat = $row_result["T_SamplingAdditionalFisikBBTBBodyFat"] == -1?"Tidak dilakukan":$row_result["T_SamplingAdditionalFisikBBTBBodyFat"];
|
|
$standart_bmi = $row_result["T_SamplingAdditionalFisikBBTBStandart"];
|
|
$get_bmi = $this->hitung_bmi($bb,$tb,$standart_bmi);
|
|
$bmi = $get_bmi['bmi'];
|
|
$classification = $get_bmi['class'];
|
|
if($type == "TB")
|
|
$ret_array['a2'] = $tb.' cm';
|
|
else if($type == "BB")
|
|
$ret_array['a2'] = $bb. ' kg';
|
|
else if($type == "BMI")
|
|
$ret_array['a2'] = $bmi." ".$classification;
|
|
else{
|
|
if($OhID != -1){
|
|
$sql = "SELECT *
|
|
FROM t_orderdetail
|
|
WHERE T_OrderDetailIsActive = 'Y' AND T_OrderDetailT_TestCode = '40110902' AND T_OrderDetailT_OrderHeaderID = {$OhID}";
|
|
$qry = $this->db_smartone->query($sql);
|
|
if (! $qry) {
|
|
return json_encode(array());
|
|
}
|
|
//echo $this->db_smartone->last_query();
|
|
$exist_result = $qry->result_array();
|
|
if(count($exist_result) == 0)
|
|
$ret_array['a2'] = 'NaN';
|
|
else
|
|
$ret_array['a2'] = $bodyfat.'%';
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
echo json_encode([$ret_array]);
|
|
}
|
|
|
|
|
|
function tekanan_darah($id,$type) {
|
|
$ret_array = [];
|
|
$sql = "SELECT *, IFNULL(M_PatientOldPID,'') as M_PatientOldPID
|
|
FROM t_orderheader
|
|
JOIN so_resultentry ON So_ResultEntryT_OrderHeaderID = T_OrderHeaderID AND So_ResultEntryID = {$id}
|
|
JOIN m_patient ON T_OrderHeaderM_PatientID = M_PatientID";
|
|
// echo $sql;
|
|
$data_patient = $this->db_smartone->query($sql)->row_array();
|
|
if($data_patient){
|
|
$patient_name = addslashes($data_patient['M_PatientName']);
|
|
$sql = "SELECT *
|
|
FROM x_adm_rekap_patient patient
|
|
JOIN x_adm_rekap_fisik_vital vital ON vital.REG_NO = patient.REG_NO
|
|
WHERE
|
|
patient.PATIENT_ID = '{$data_patient['M_PatientOldPID']}' AND
|
|
patient.DOB = '{$data_patient['M_PatientDOB']}' AND
|
|
patient.PATIENT_NAME = '{$patient_name}'";
|
|
//echo $sql;
|
|
$data_tahun_lalu = $this->db_smartone->query($sql)->row_array();
|
|
if($type == 'sistolik')
|
|
$ret_array['a1'] = $data_tahun_lalu['Sistolik']?$data_tahun_lalu['Sistolik'].' mmHg':'-';
|
|
else
|
|
$ret_array['a1'] = $data_tahun_lalu['Diastolik']?$data_tahun_lalu['Diastolik'].' mmHg':'-';
|
|
}else{
|
|
$ret_array['a1'] = "-";
|
|
}
|
|
|
|
$sql = "SELECT *
|
|
FROM so_resultentry_fisik_umum
|
|
JOIN fisik_template ON So_ResultEntryFisikUmumFisikTemplateID = FisikTemplateID AND FisikTemplateIsActive = 'Y' AND FisikTemplateTitle = 'TANDA VITAL'
|
|
WHERE
|
|
So_ResultEntryFisikUmumSo_ResultEntryID = ? AND So_ResultEntryFisikUmumIsActive = 'Y'";
|
|
$qry = $this->db_smartone->query($sql,array($id));
|
|
if (! $qry) {
|
|
return json_encode(array());
|
|
}
|
|
$rows = $qry->result_array();
|
|
if (count($rows) == 0 ) {
|
|
return json_encode(array());
|
|
}
|
|
$d = json_decode($rows[0]["So_ResultEntryFisikUmumDetails"],true);
|
|
//keluhan saat ini
|
|
$tanda_vital = array();
|
|
|
|
if ($d["title"] == "TANDA VITAL") {
|
|
|
|
foreach($d["details"] as $gp) {
|
|
if($gp['id_code'] == 'tanda_vital_5'){
|
|
if($type == 'sistolik')
|
|
$ret_array['a2'] = $gp['value_x']." mmHg";
|
|
else
|
|
$ret_array['a2'] = $gp['value_y']." mmHg";
|
|
//$ret_array['a2'] = array("Sistolik" => $gp['value_x']." mmHg","Diastolik" => $gp['value_y']." mmHg");
|
|
}
|
|
|
|
}
|
|
}
|
|
|
|
echo json_encode([$ret_array]);
|
|
}
|
|
|
|
function frekuensi_nafas($id) {
|
|
$ret_array = [];
|
|
$sql = "SELECT *, IFNULL(M_PatientOldPID,'') as M_PatientOldPID
|
|
FROM t_orderheader
|
|
JOIN so_resultentry ON So_ResultEntryT_OrderHeaderID = T_OrderHeaderID AND So_ResultEntryID = {$id}
|
|
JOIN m_patient ON T_OrderHeaderM_PatientID = M_PatientID";
|
|
// echo $sql;
|
|
$data_patient = $this->db_smartone->query($sql)->row_array();
|
|
if($data_patient){
|
|
$patient_name = addslashes($data_patient['M_PatientName']);
|
|
$sql = "SELECT *
|
|
FROM x_adm_rekap_patient patient
|
|
JOIN x_adm_rekap_fisik_vital vital ON vital.REG_NO = patient.REG_NO
|
|
WHERE
|
|
patient.PATIENT_ID = '{$data_patient['M_PatientOldPID']}' AND
|
|
patient.DOB = '{$data_patient['M_PatientDOB']}' AND
|
|
patient.PATIENT_NAME = '{$patient_name}'";
|
|
//echo $sql;
|
|
$data_tahun_lalu = $this->db_smartone->query($sql)->row_array();
|
|
$ret_array['a1'] = $data_tahun_lalu['Frekuensi'].' x/menit';
|
|
}else{
|
|
$ret_array['a1'] = "-";
|
|
}
|
|
|
|
$sql = "SELECT *
|
|
FROM so_resultentry_fisik_umum
|
|
JOIN fisik_template ON So_ResultEntryFisikUmumFisikTemplateID = FisikTemplateID AND FisikTemplateIsActive = 'Y' AND FisikTemplateTitle = 'TANDA VITAL'
|
|
WHERE
|
|
So_ResultEntryFisikUmumSo_ResultEntryID = ? AND So_ResultEntryFisikUmumIsActive = 'Y'";
|
|
$qry = $this->db_smartone->query($sql,array($id));
|
|
if (! $qry) {
|
|
return json_encode(array());
|
|
}
|
|
$rows = $qry->result_array();
|
|
if (count($rows) == 0 ) {
|
|
return json_encode(array());
|
|
}
|
|
$d = json_decode($rows[0]["So_ResultEntryFisikUmumDetails"],true);
|
|
//keluhan saat ini
|
|
$tanda_vital = array();
|
|
|
|
if ($d["title"] == "TANDA VITAL") {
|
|
|
|
foreach($d["details"] as $gp) {
|
|
if($gp['id_code'] == 'tanda_vital_3'){
|
|
$ret_array['a2'] = $gp['value']." ".$gp['unit'];
|
|
//$ret_array['a2'] = array("Sistolik" => $gp['value_x']." mmHg","Diastolik" => $gp['value_y']." mmHg");
|
|
}
|
|
|
|
}
|
|
}
|
|
|
|
echo json_encode([$ret_array]);
|
|
}
|
|
|
|
function frekuensi_nadi($id) {
|
|
$ret_array = [];
|
|
$sql = "SELECT *, IFNULL(M_PatientOldPID,'') as M_PatientOldPID
|
|
FROM t_orderheader
|
|
JOIN so_resultentry ON So_ResultEntryT_OrderHeaderID = T_OrderHeaderID AND So_ResultEntryID = {$id}
|
|
JOIN m_patient ON T_OrderHeaderM_PatientID = M_PatientID";
|
|
// echo $sql;
|
|
$data_patient = $this->db_smartone->query($sql)->row_array();
|
|
if($data_patient){
|
|
$patient_name = addslashes($data_patient['M_PatientName']);
|
|
$sql = "SELECT *
|
|
FROM x_adm_rekap_patient patient
|
|
JOIN x_adm_rekap_fisik_vital vital ON vital.REG_NO = patient.REG_NO
|
|
WHERE
|
|
patient.PATIENT_ID = '{$data_patient['M_PatientOldPID']}' AND
|
|
patient.DOB = '{$data_patient['M_PatientDOB']}' AND
|
|
patient.PATIENT_NAME = '{$patient_name}'";
|
|
//echo $sql;
|
|
$data_tahun_lalu = $this->db_smartone->query($sql)->row_array();
|
|
$ret_array['a1'] = $data_tahun_lalu['Nadi']." x/menit";
|
|
}else{
|
|
$ret_array['a1'] = "-";
|
|
}
|
|
|
|
$sql = "SELECT *
|
|
FROM so_resultentry_fisik_umum
|
|
JOIN fisik_template ON So_ResultEntryFisikUmumFisikTemplateID = FisikTemplateID AND FisikTemplateIsActive = 'Y' AND FisikTemplateTitle = 'TANDA VITAL'
|
|
WHERE
|
|
So_ResultEntryFisikUmumSo_ResultEntryID = ? AND So_ResultEntryFisikUmumIsActive = 'Y'";
|
|
$qry = $this->db_smartone->query($sql,array($id));
|
|
if (! $qry) {
|
|
return json_encode(array());
|
|
}
|
|
$rows = $qry->result_array();
|
|
if (count($rows) == 0 ) {
|
|
return json_encode(array());
|
|
}
|
|
$d = json_decode($rows[0]["So_ResultEntryFisikUmumDetails"],true);
|
|
//keluhan saat ini
|
|
$tanda_vital = array();
|
|
|
|
if ($d["title"] == "TANDA VITAL") {
|
|
|
|
foreach($d["details"] as $gp) {
|
|
if($gp['id_code'] == 'tanda_vital_1'){
|
|
$ret_array['a2'] = $gp['value']." x/menit";
|
|
}
|
|
|
|
}
|
|
}
|
|
|
|
echo json_encode([$ret_array]);
|
|
}
|
|
|
|
|
|
function suhu($id) {
|
|
$ret_array = [];
|
|
$sql = "SELECT *, IFNULL(M_PatientOldPID,'') as M_PatientOldPID
|
|
FROM t_orderheader
|
|
JOIN so_resultentry ON So_ResultEntryT_OrderHeaderID = T_OrderHeaderID AND So_ResultEntryID = {$id}
|
|
JOIN m_patient ON T_OrderHeaderM_PatientID = M_PatientID";
|
|
// echo $sql;
|
|
$data_patient = $this->db_smartone->query($sql)->row_array();
|
|
if($data_patient){
|
|
$patient_name = addslashes($data_patient['M_PatientName']);
|
|
$sql = "SELECT *
|
|
FROM x_adm_rekap_patient patient
|
|
JOIN x_adm_rekap_fisik_vital vital ON vital.REG_NO = patient.REG_NO
|
|
WHERE
|
|
patient.PATIENT_ID = '{$data_patient['M_PatientOldPID']}' AND
|
|
patient.DOB = '{$data_patient['M_PatientDOB']}' AND
|
|
patient.PATIENT_NAME = '{$patient_name}'";
|
|
//echo $sql;
|
|
$data_tahun_lalu = $this->db_smartone->query($sql)->row_array();
|
|
if($data_tahun_lalu){
|
|
//print_r($data_tahun_lalu);
|
|
$ret_array['a1'] = isset($data_tahun_lalu['Suhu'])?$data_tahun_lalu['Suhu']:"Afebrile";
|
|
if($ret_array['a1'] == ""){
|
|
$ret_array['a1'] = "Afebrile";
|
|
}
|
|
}
|
|
else
|
|
$ret_array['a1'] = "-";
|
|
|
|
}else{
|
|
$ret_array['a1'] = "Afebrile";
|
|
}
|
|
|
|
$sql = "SELECT *
|
|
FROM so_resultentry_fisik_umum
|
|
JOIN fisik_template ON So_ResultEntryFisikUmumFisikTemplateID = FisikTemplateID AND FisikTemplateIsActive = 'Y' AND FisikTemplateTitle = 'TANDA VITAL'
|
|
WHERE
|
|
So_ResultEntryFisikUmumSo_ResultEntryID = ? AND So_ResultEntryFisikUmumIsActive = 'Y'";
|
|
$qry = $this->db_smartone->query($sql,array($id));
|
|
if (! $qry) {
|
|
return json_encode(array());
|
|
}
|
|
$rows = $qry->result_array();
|
|
if (count($rows) == 0 ) {
|
|
return json_encode(array());
|
|
}
|
|
$d = json_decode($rows[0]["So_ResultEntryFisikUmumDetails"],true);
|
|
//keluhan saat ini
|
|
$tanda_vital = array();
|
|
|
|
if ($d["title"] == "TANDA VITAL") {
|
|
|
|
foreach($d["details"] as $gp) {
|
|
if($gp['id_code'] == 'tanda_vital_6'){
|
|
if($gp['chx_x'] == 1)
|
|
$ret_array['a2'] = $gp['label_x'];
|
|
if($gp['chx_y'] == 1)
|
|
$ret_array['a2'] = $gp['label_y'];
|
|
}
|
|
|
|
}
|
|
}
|
|
|
|
echo json_encode([$ret_array]);
|
|
}
|
|
|
|
function status_gizi($id,$langid=1,$type="fisik") {
|
|
$sql = "SELECT *
|
|
FROM so_resultentry
|
|
JOIN t_samplingso_additional_fisik_bbtb ON So_ResultEntryT_OrderHeaderID = T_SamplingAdditionalFisikBBTBT_OrderHeaderID
|
|
WHERE
|
|
So_ResultEntryID = $id LIMIT 1";
|
|
//echo $sql;
|
|
$qry = $this->db_smartone->query($sql);
|
|
if (! $qry) {
|
|
return json_encode(array());
|
|
}
|
|
//echo $this->db_smartone->last_query();
|
|
$row_result = $qry->row_array();
|
|
|
|
$status_gizi = array();
|
|
$bb = $row_result["T_SamplingAdditionalFisikBBTBValueBB"];
|
|
$tb = $row_result["T_SamplingAdditionalFisikBBTBValueTB"];
|
|
$bodyfat = $row_result["T_SamplingAdditionalFisikBBTBBodyFat"] == -1?"Tidak dilakukan":$row_result["T_SamplingAdditionalFisikBBTBBodyFat"];
|
|
$standart_bmi = $row_result["T_SamplingAdditionalFisikBBTBStandart"];
|
|
$get_bmi = $this->hitung_bmi($bb,$tb,$standart_bmi);
|
|
$bmi = $get_bmi['bmi'];
|
|
$classification = $get_bmi['class'];
|
|
|
|
$standart_text = ucwords(str_replace("_"," ",$standart_bmi));
|
|
|
|
$status_gizi[] = array(
|
|
"qq1" => "Tinggi Badan" ,
|
|
"qq2" => $tb,
|
|
"qq3" => "",
|
|
"qq4" => $standart_text,
|
|
|
|
);
|
|
|
|
$status_gizi[] = array(
|
|
"qq1" => "Berat Badan" ,
|
|
"qq2" => $bb,
|
|
"qq3" => "",
|
|
"qq4" => $standart_text,
|
|
|
|
);
|
|
|
|
$status_gizi[] = array(
|
|
"qq1" => "Body Fat" ,
|
|
"qq2" => $bodyfat,
|
|
"qq3" => "",
|
|
"qq4" => $standart_text,
|
|
|
|
);
|
|
|
|
$status_gizi[] = array(
|
|
"qq1" => "BMI (".$standart_text.")" ,
|
|
"qq2" => $bmi,
|
|
"qq3" => "",
|
|
"qq4" => $standart_text,
|
|
|
|
);
|
|
|
|
$status_gizi[] = array(
|
|
"qq1" => "Klasifikasi" ,
|
|
"qq2" => $classification,
|
|
"qq3" => "",
|
|
"qq4" => $standart_text,
|
|
|
|
);
|
|
|
|
|
|
echo json_encode($status_gizi);
|
|
}
|
|
|
|
function lapang_pandang($id) {
|
|
$OhID = -1;
|
|
$ret_array = [];
|
|
$sql = "SELECT *, IFNULL(M_PatientOldPID,'') as M_PatientOldPID
|
|
FROM t_orderheader
|
|
JOIN so_resultentry ON So_ResultEntryT_OrderHeaderID = T_OrderHeaderID AND So_ResultEntryID = {$id}
|
|
JOIN m_patient ON T_OrderHeaderM_PatientID = M_PatientID";
|
|
// echo $sql;
|
|
$data_patient = $this->db_smartone->query($sql)->row_array();
|
|
if($data_patient){
|
|
$OhID = $data_patient['T_OrderHeaderID'];
|
|
$patient_name = addslashes($data_patient['M_PatientName']);
|
|
$sql = "SELECT *
|
|
FROM x_adm_rekap_patient patient
|
|
JOIN x_adm_rekap_fisik_vital vital ON vital.REG_NO = patient.REG_NO
|
|
WHERE
|
|
patient.PATIENT_ID = '{$data_patient['M_PatientOldPID']}' AND
|
|
patient.DOB = '{$data_patient['M_PatientDOB']}' AND
|
|
patient.PATIENT_NAME = '{$patient_name}'";
|
|
//echo $sql;
|
|
$data_tahun_lalu = $this->db_smartone->query($sql)->row_array();
|
|
$ret_array['a1'] = isset($data_tahun_lalu['Lapang_Pandang'])?$data_tahun_lalu['Lapang_Pandang']:"-";
|
|
}else{
|
|
$ret_array['a1'] = "-";
|
|
}
|
|
|
|
$sql = "SELECT *
|
|
FROM so_resultentry_fisik_umum
|
|
JOIN fisik_template ON So_ResultEntryFisikUmumFisikTemplateID = FisikTemplateID AND FisikTemplateIsActive = 'Y' AND FisikTemplateTitle = 'LAPANG PANDANG'
|
|
WHERE
|
|
So_ResultEntryFisikUmumSo_ResultEntryID = ? AND So_ResultEntryFisikUmumIsActive = 'Y'";
|
|
$qry = $this->db_smartone->query($sql,array($id));
|
|
if (! $qry) {
|
|
echo json_encode(array());
|
|
}
|
|
$rows = $qry->result_array();
|
|
if (count($rows) == 0 ) {
|
|
$ret_array['a2'] = 'NaN';
|
|
echo json_encode([$ret_array]);
|
|
exit;
|
|
}
|
|
$d = json_decode($rows[0]["So_ResultEntryFisikUmumDetails"],true);
|
|
//keluhan saat ini
|
|
$lapang_pandang = array();
|
|
|
|
if ($d["title"] == "LAPANG PANDANG") {
|
|
foreach($d["details"] as $gp) {
|
|
if ($gp["chx_y"] == "1") $value = $gp["label_y"];
|
|
|
|
if ($gp["chx_x"] == "1") $value = $gp["label_x"] ;
|
|
|
|
$ret_array['a2'] = $value;
|
|
}
|
|
}
|
|
|
|
if($OhID != -1){
|
|
$sql = "SELECT *
|
|
FROM t_orderdetail
|
|
WHERE T_OrderDetailIsActive = 'Y' AND T_OrderDetailT_TestCode = '40210307' AND T_OrderDetailT_OrderHeaderID = {$OhID}";
|
|
$qry = $this->db_smartone->query($sql);
|
|
if (! $qry) {
|
|
return json_encode(array());
|
|
}
|
|
//echo $this->db_smartone->last_query();
|
|
$exist_result = $qry->result_array();
|
|
if(count($exist_result) == 0)
|
|
$ret_array['a2'] = 'NaN';
|
|
}
|
|
|
|
echo json_encode([$ret_array]);
|
|
}
|
|
|
|
function klasifikasi_bmi($bmi){
|
|
$standart_bmi = 'asia_pacific';
|
|
$bmi_valuex = number_format($bmi,2);
|
|
$classs = "Undefined";
|
|
|
|
if($standart_bmi === 'asia_pacific'){
|
|
if($bmi_valuex < 18.5)
|
|
$classs = 'Underweight';
|
|
|
|
if($bmi_valuex >= 18.5 && $bmi_valuex < 23)
|
|
$classs = 'Normal';
|
|
|
|
if($bmi_valuex >= 23 && $bmi_valuex < 25)
|
|
$classs = 'Overweight';
|
|
|
|
if($bmi_valuex >= 25 && $bmi_valuex < 30)
|
|
$classs = 'Obese I';
|
|
|
|
if($bmi_valuex >= 30)
|
|
$classs = 'Obese II';
|
|
}
|
|
|
|
if($standart_bmi === 'who'){
|
|
if($bmi_valuex < 18.5)
|
|
$classs = 'Underweight';
|
|
|
|
if($bmi_valuex >= 18.5 && $bmi_valuex < 25){
|
|
$classs = 'Normal';
|
|
}
|
|
|
|
if($bmi_valuex >= 25 && $bmi_valuex < 30){
|
|
$classs = 'Overweight';
|
|
}
|
|
|
|
if($bmi_valuex >= 30)
|
|
$classs = 'Obese';
|
|
}
|
|
|
|
if($standart_bmi === 'kemenkes'){
|
|
if($bmi_valuex < 18.5)
|
|
$classs = 'Underweight';
|
|
|
|
if($bmi_valuex >= 18.5 && $bmi_valuex < 25.1)
|
|
$classs = 'Normal';
|
|
|
|
if($bmi_valuex >= 25.1 && $bmi_valuex < 27)
|
|
$classs = 'Overweight';
|
|
|
|
if($bmi_valuex >= 27)
|
|
$classs = 'Obese';
|
|
}
|
|
|
|
return $classs;
|
|
}
|
|
|
|
function hitung_bmi($bb,$tb,$standart_bmi){
|
|
$tb = $tb/100;
|
|
$bmi = '';
|
|
$bmi = $bb / ($tb * $tb);
|
|
$bmi_valuex = number_format($bmi,2);
|
|
$classs = "Undefined";
|
|
|
|
if($standart_bmi === 'asia_pacific'){
|
|
if($bmi_valuex < 18.5)
|
|
$classs = 'Underweight';
|
|
|
|
if($bmi_valuex >= 18.5 && $bmi_valuex < 23)
|
|
$classs = 'Normal';
|
|
|
|
if($bmi_valuex >= 23 && $bmi_valuex < 25)
|
|
$classs = 'Overweight';
|
|
|
|
if($bmi_valuex >= 25 && $bmi_valuex < 30)
|
|
$classs = 'Obese I';
|
|
|
|
if($bmi_valuex >= 30)
|
|
$classs = 'Obese II';
|
|
}
|
|
|
|
if($standart_bmi === 'who'){
|
|
if($bmi_valuex < 18.5)
|
|
$classs = 'Underweight';
|
|
|
|
if($bmi_valuex >= 18.5 && $bmi_valuex < 25){
|
|
$classs = 'Normal';
|
|
}
|
|
|
|
if($bmi_valuex >= 25 && $bmi_valuex < 30){
|
|
$classs = 'Overweight';
|
|
}
|
|
|
|
if($bmi_valuex >= 30)
|
|
$classs = 'Obese';
|
|
}
|
|
|
|
if($standart_bmi === 'kemenkes'){
|
|
if($bmi_valuex < 18.5)
|
|
$classs = 'Underweight';
|
|
|
|
if($bmi_valuex >= 18.5 && $bmi_valuex < 25.1)
|
|
$classs = 'Normal';
|
|
|
|
if($bmi_valuex >= 25.1 && $bmi_valuex < 27)
|
|
$classs = 'Overweight';
|
|
|
|
if($bmi_valuex >= 27)
|
|
$classs = 'Obese';
|
|
}
|
|
|
|
return array(
|
|
'bmi' => $bmi_valuex,
|
|
'class' => $classs
|
|
);
|
|
}
|
|
|
|
function keadaan_umum($id) {
|
|
$sql = "SELECT *
|
|
FROM so_resultentry_fisik_umum
|
|
JOIN fisik_template ON So_ResultEntryFisikUmumFisikTemplateID = FisikTemplateID AND FisikTemplateIsActive = 'Y' AND FisikTemplateTitle = 'KEADAAN UMUM'
|
|
WHERE
|
|
So_ResultEntryFisikUmumSo_ResultEntryID = ? AND So_ResultEntryFisikUmumIsActive = 'Y'";
|
|
$qry = $this->db_smartone->query($sql,array($id));
|
|
if (! $qry) {
|
|
return json_encode(array());
|
|
}
|
|
$rows = $qry->result_array();
|
|
if (count($rows) == 0 ) {
|
|
return json_encode(array());
|
|
}
|
|
$d = json_decode($rows[0]["So_ResultEntryFisikUmumDetails"],true);
|
|
//keluhan saat ini
|
|
$keadaan_umum = array();
|
|
|
|
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=1,$type="fisik") {
|
|
$sql = "SELECT *
|
|
FROM so_resultentry_fisik_umum
|
|
JOIN fisik_template ON So_ResultEntryFisikUmumFisikTemplateID = FisikTemplateID AND FisikTemplateIsActive = 'Y' AND FisikTemplateTitle = 'KEPALA WAJAH'
|
|
WHERE
|
|
So_ResultEntryFisikUmumSo_ResultEntryID = ? AND So_ResultEntryFisikUmumIsActive = 'Y'";
|
|
$qry = $this->db_smartone->query($sql,array($id));
|
|
if (! $qry) {
|
|
return json_encode(array());
|
|
}
|
|
$rows = $qry->result_array();
|
|
if (count($rows) == 0 ) {
|
|
return json_encode(array());
|
|
}
|
|
$d = json_decode($rows[0]["So_ResultEntryFisikUmumDetails"],true);
|
|
//keluhan saat ini
|
|
$kepala_wajah = array();
|
|
|
|
|
|
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"],
|
|
);
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
if(empty($kepala_wajah)){
|
|
$kepala_wajah[] = array(
|
|
"bb1" =>"Tidak diperiksa",
|
|
"bb2" => "",
|
|
);
|
|
}
|
|
echo json_encode($kepala_wajah);
|
|
}
|
|
|
|
function mata_lama($id,$langid=1,$type="fisik") {
|
|
$sql = "SELECT *
|
|
FROM so_resultentry_fisik_umum
|
|
JOIN fisik_template ON So_ResultEntryFisikUmumFisikTemplateID = FisikTemplateID AND FisikTemplateIsActive = 'Y' AND FisikTemplateTitle = 'MATA'
|
|
WHERE
|
|
So_ResultEntryFisikUmumSo_ResultEntryID = ? AND So_ResultEntryFisikUmumIsActive = 'Y'";
|
|
$qry = $this->db_smartone->query($sql,array($id));
|
|
if (! $qry) {
|
|
return json_encode(array());
|
|
}
|
|
$rows = $qry->result_array();
|
|
if (count($rows) == 0 ) {
|
|
return json_encode(array());
|
|
}
|
|
$d = json_decode($rows[0]["So_ResultEntryFisikUmumDetails"],true);
|
|
//keluhan saat ini
|
|
$mata = array();
|
|
|
|
|
|
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"],
|
|
);
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
if(empty($mata)){
|
|
$mata[] = array(
|
|
"cc1" => "Tidak diperiksa",
|
|
"cc2" => ""
|
|
);
|
|
}
|
|
echo json_encode($mata);
|
|
}
|
|
|
|
function persepsi_warna($id) {
|
|
$ret_array = [];
|
|
$sql = "SELECT *, IFNULL(M_PatientOldPID,'') as M_PatientOldPID
|
|
FROM t_orderheader
|
|
JOIN so_resultentry ON So_ResultEntryT_OrderHeaderID = T_OrderHeaderID AND So_ResultEntryID = {$id}
|
|
JOIN m_patient ON T_OrderHeaderM_PatientID = M_PatientID";
|
|
// echo $sql;
|
|
$data_patient = $this->db_smartone->query($sql)->row_array();
|
|
if($data_patient){
|
|
$patient_name = addslashes($data_patient['M_PatientName']);
|
|
$sql = "SELECT *
|
|
FROM x_adm_rekap_patient patient
|
|
JOIN x_adm_rekap_fisik_vital vital ON vital.REG_NO = patient.REG_NO
|
|
WHERE
|
|
patient.PATIENT_ID = '{$data_patient['M_PatientOldPID']}' AND
|
|
patient.DOB = '{$data_patient['M_PatientDOB']}' AND
|
|
patient.PATIENT_NAME = '{$patient_name}'";
|
|
//echo $sql;
|
|
$data_tahun_lalu = $this->db_smartone->query($sql)->row_array();
|
|
$ret_array['a1'] = isset($data_tahun_lalu['Kenal_Warna'])?$data_tahun_lalu['Kenal_Warna']:"-";
|
|
}else{
|
|
$ret_array['a1'] = "-";
|
|
}
|
|
|
|
$sql = "SELECT IFNULL(T_SamplingAdditionalFisikBWPWValue,'X') as result, IFNULL(T_SamplingAdditionalFisikBWPWVAngka,'X') as angka
|
|
FROM so_resultentry
|
|
LEFT JOIN t_samplingso_additional_fisik_bw ON T_SamplingAdditionalFisikBWT_OrderHeaderID = So_ResultEntryT_OrderHeaderID
|
|
WHERE
|
|
So_ResultEntryID = ? LIMIT 1 ";
|
|
$qry = $this->db_smartone->query($sql,array($id));
|
|
|
|
if (! $qry) {
|
|
return json_encode(array());
|
|
}
|
|
$row_result = $qry->row_array();
|
|
//echo $this->db_smartone->last_query();
|
|
//keluhan saat ini
|
|
$persepsi_warna = array();
|
|
|
|
$result = "Bahan Belum";
|
|
if($row_result){
|
|
if($row_result['result'] == 'BW')
|
|
$result = "Red Green Deficiency";
|
|
if($row_result['result'] == 'N')
|
|
$result = "Normal";
|
|
}
|
|
|
|
$ret_array['a2'] = $result ;
|
|
|
|
echo json_encode([$ret_array]);
|
|
}
|
|
|
|
|
|
function tulang_belakang($id) {
|
|
$ret_array = [];
|
|
$sql = "SELECT *, IFNULL(M_PatientOldPID,'') as M_PatientOldPID
|
|
FROM t_orderheader
|
|
JOIN so_resultentry ON So_ResultEntryT_OrderHeaderID = T_OrderHeaderID AND So_ResultEntryID = {$id}
|
|
JOIN m_patient ON T_OrderHeaderM_PatientID = M_PatientID";
|
|
// echo $sql;
|
|
$data_patient = $this->db_smartone->query($sql)->row_array();
|
|
if($data_patient){
|
|
$patient_name = addslashes($data_patient['M_PatientName']);
|
|
$sql = "SELECT *
|
|
FROM x_adm_rekap_patient patient
|
|
JOIN x_adm_rekap_fisik_vital vital ON vital.REG_NO = patient.REG_NO
|
|
WHERE
|
|
patient.PATIENT_ID = '{$data_patient['M_PatientOldPID']}' AND
|
|
patient.DOB = '{$data_patient['M_PatientDOB']}' AND
|
|
patient.PATIENT_NAME = '{$patient_name}'";
|
|
//echo $sql;
|
|
$data_tahun_lalu = $this->db_smartone->query($sql)->row_array();
|
|
$ret_array['a1'] = isset($data_tahun_lalu['Tulang_belakang'])?$data_tahun_lalu['Tulang_belakang']:"-";
|
|
}else{
|
|
$ret_array['a1'] = "-";
|
|
}
|
|
|
|
|
|
$ret_array['a2'] = "-" ;
|
|
|
|
echo json_encode([$ret_array]);
|
|
}
|
|
|
|
|
|
function doctor($id) {
|
|
$ret_array = [];
|
|
$sql = "SELECT *, IFNULL(M_PatientOldPID,'') as M_PatientOldPID
|
|
FROM t_orderheader
|
|
JOIN so_resultentry ON So_ResultEntryT_OrderHeaderID = T_OrderHeaderID AND So_ResultEntryID = {$id}
|
|
JOIN m_patient ON T_OrderHeaderM_PatientID = M_PatientID";
|
|
// echo $sql;
|
|
$data_patient = $this->db_smartone->query($sql)->row_array();
|
|
if($data_patient){
|
|
$patient_name = addslashes($data_patient['M_PatientName']);
|
|
$sql = "SELECT *
|
|
FROM x_adm_rekap_patient patient
|
|
JOIN x_adm_rekap_fisik_doctor doctor ON doctor.REG_NO = patient.REG_NO
|
|
WHERE
|
|
patient.PATIENT_ID = '{$data_patient['M_PatientOldPID']}' AND
|
|
patient.DOB = '{$data_patient['M_PatientDOB']}' AND
|
|
patient.PATIENT_NAME = '{$patient_name}'";
|
|
//echo $sql;
|
|
$data_tahun_lalu = $this->db_smartone->query($sql)->row_array();
|
|
$ret_array['a1'] = isset($data_tahun_lalu['DOCTOR'])?$data_tahun_lalu['DOCTOR']:"-";
|
|
}else{
|
|
$ret_array['a1'] = "-";
|
|
}
|
|
|
|
|
|
$sql = "SELECT concat(if(M_DoctorPrefix is null, '',CONCAT(M_DoctorPrefix,' ')),if(M_DoctorPrefix2 is null, '',CONCAT(M_DoctorPrefix2,' ')),M_DoctorName) as doctor
|
|
FROM so_resultentry_fisik_umum
|
|
JOIN so_resultentry ON So_ResultEntryFisikUmumSo_ResultEntryID = So_ResultEntryID
|
|
JOIN m_doctor ON M_DOctorID = So_ResultEntryM_DoctorID
|
|
WHERE
|
|
So_ResultEntryFisikUmumSo_ResultEntryID = ? AND So_ResultEntryFisikUmumIsActive = 'Y'
|
|
LIMIT 1";
|
|
$qry = $this->db_smartone->query($sql,array($id));
|
|
if (! $qry) {
|
|
return json_encode(array());
|
|
}
|
|
$rows = $qry->result_array();
|
|
if (count($rows) == 0 ) {
|
|
return json_encode(array());
|
|
}
|
|
//$d = json_decode($rows[0]["doctor"],true);
|
|
//keluhan saat ini
|
|
//if($ret_array['a1'] == '-' || $ret_array['a1'] == '')
|
|
//$ret_array['a1'] = $rows[0]["doctor"];
|
|
|
|
$ret_array['a2'] = $rows[0]["doctor"];
|
|
echo json_encode([$ret_array]);
|
|
}
|
|
|
|
function konjuktiva_sklera($id) {
|
|
$ret_array = [];
|
|
$sql = "SELECT *, IFNULL(M_PatientOldPID,'') as M_PatientOldPID
|
|
FROM t_orderheader
|
|
JOIN so_resultentry ON So_ResultEntryT_OrderHeaderID = T_OrderHeaderID AND So_ResultEntryID = {$id}
|
|
JOIN m_patient ON T_OrderHeaderM_PatientID = M_PatientID";
|
|
// echo $sql;
|
|
$data_patient = $this->db_smartone->query($sql)->row_array();
|
|
if($data_patient){
|
|
$patient_name = addslashes($data_patient['M_PatientName']);
|
|
$sql = "SELECT *
|
|
FROM x_adm_rekap_patient patient
|
|
JOIN x_adm_rekap_fisik_vital vital ON vital.REG_NO = patient.REG_NO
|
|
WHERE
|
|
patient.PATIENT_ID = '{$data_patient['M_PatientOldPID']}' AND
|
|
patient.DOB = '{$data_patient['M_PatientDOB']}' AND
|
|
patient.PATIENT_NAME = '{$patient_name}'";
|
|
//echo $sql;
|
|
$data_tahun_lalu = $this->db_smartone->query($sql)->row_array();
|
|
$ret_array['a1'] = isset($data_tahun_lalu['Konjuktiva_Sklera'])?$data_tahun_lalu['Konjuktiva_Sklera']:"-";
|
|
}else{
|
|
$ret_array['a1'] = "-";
|
|
}
|
|
|
|
|
|
|
|
$sql = "SELECT *
|
|
FROM so_resultentry_fisik_umum
|
|
JOIN fisik_template ON So_ResultEntryFisikUmumFisikTemplateID = FisikTemplateID AND FisikTemplateIsActive = 'Y' AND
|
|
FisikTemplateTitle = 'MATA'
|
|
WHERE
|
|
So_ResultEntryFisikUmumSo_ResultEntryID = ? AND So_ResultEntryFisikUmumIsActive = 'Y'";
|
|
$qry = $this->db_smartone->query($sql,array($id));
|
|
if (! $qry) {
|
|
return json_encode(array());
|
|
}
|
|
$rows = $qry->result_array();
|
|
if (count($rows) == 0 ) {
|
|
return json_encode(array());
|
|
}
|
|
$d = json_decode($rows[0]["So_ResultEntryFisikUmumDetails"],true);
|
|
//keluhan saat ini
|
|
$mata = array();
|
|
|
|
|
|
if ($d["title"] == "MATA") {
|
|
|
|
foreach($d["details"] as $gp) {
|
|
//echo $gp["chx"];
|
|
//echo $gp["label"];
|
|
if ($gp["chx"] == 1 ) {
|
|
$arr_result[] = array($gp["label"],$gp["value"]) ;
|
|
$hasil = $gp["label"];
|
|
if($gp["value"] != '')
|
|
$hasil = $gp["label"]." (".$gp["value"].")";
|
|
$mata[] = $hasil;
|
|
}
|
|
}
|
|
|
|
}
|
|
$string_mata = count($mata) > 0?join(", ",$mata):"-";
|
|
$ret_array['a2'] = $string_mata;
|
|
echo json_encode([$ret_array]);
|
|
}
|
|
|
|
|
|
function telinga($id) {
|
|
$ret_array = [];
|
|
$sql = "SELECT *, IFNULL(M_PatientOldPID,'') as M_PatientOldPID
|
|
FROM t_orderheader
|
|
JOIN so_resultentry ON So_ResultEntryT_OrderHeaderID = T_OrderHeaderID AND So_ResultEntryID = {$id}
|
|
JOIN m_patient ON T_OrderHeaderM_PatientID = M_PatientID";
|
|
// echo $sql;
|
|
$data_patient = $this->db_smartone->query($sql)->row_array();
|
|
if($data_patient){
|
|
$patient_name = addslashes($data_patient['M_PatientName']);
|
|
$sql = "SELECT *
|
|
FROM x_adm_rekap_patient patient
|
|
JOIN x_adm_rekap_fisik_organ organ ON organ.REG_NO = patient.REG_NO
|
|
WHERE
|
|
patient.PATIENT_ID = '{$data_patient['M_PatientOldPID']}' AND
|
|
patient.DOB = '{$data_patient['M_PatientDOB']}' AND
|
|
patient.PATIENT_NAME = '{$patient_name}'";
|
|
//echo $sql;
|
|
$data_tahun_lalu = $this->db_smartone->query($sql)->row_array();
|
|
$ret_array['a1'] = isset($data_tahun_lalu['Telinga'])?$data_tahun_lalu['Telinga']:"-";
|
|
}else{
|
|
$ret_array['a1'] = "-";
|
|
}
|
|
$sql = "SELECT *
|
|
FROM so_resultentry_fisik_umum
|
|
JOIN fisik_template ON So_ResultEntryFisikUmumFisikTemplateID = FisikTemplateID AND FisikTemplateIsActive = 'Y' AND FisikTemplateTitle = 'TELINGA'
|
|
WHERE
|
|
So_ResultEntryFisikUmumSo_ResultEntryID = ? AND So_ResultEntryFisikUmumIsActive = 'Y'";
|
|
$qry = $this->db_smartone->query($sql,array($id));
|
|
|
|
if (! $qry) {
|
|
return json_encode(array());
|
|
}
|
|
$rows = $qry->result_array();
|
|
if (count($rows) == 0 ) {
|
|
return json_encode(array());
|
|
}
|
|
$d = json_decode($rows[0]["So_ResultEntryFisikUmumDetails"],true);
|
|
//keluhan saat ini
|
|
$telinga = array();
|
|
|
|
|
|
if ($d["title"] == "TELINGA") {
|
|
|
|
foreach($d["details"] as $gp) {
|
|
if ($gp["chx"] == 1 ) {
|
|
$arr_result[] = array($gp["label"],$gp["value"]) ;
|
|
$hasil = $gp["label"];
|
|
if($gp["value"] != '')
|
|
$hasil = $gp["label"]." (".$gp["value"].")";
|
|
$telinga[] = $hasil;
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
$string_telinga = count($telinga) > 0? join(", ",$telinga):"-";
|
|
$ret_array['a2'] = $string_telinga;
|
|
|
|
echo json_encode([$ret_array]);
|
|
}
|
|
|
|
function visus($id,$type) {
|
|
$ret_array = [];
|
|
$sql = "SELECT *, IFNULL(M_PatientOldPID,'') as M_PatientOldPID
|
|
FROM t_orderheader
|
|
JOIN so_resultentry ON So_ResultEntryT_OrderHeaderID = T_OrderHeaderID AND So_ResultEntryID = {$id}
|
|
JOIN m_patient ON T_OrderHeaderM_PatientID = M_PatientID";
|
|
// echo $sql;
|
|
$data_patient = $this->db_smartone->query($sql)->row_array();
|
|
if($data_patient){
|
|
$patient_name = addslashes($data_patient['M_PatientName']);
|
|
$sql = "SELECT *
|
|
FROM x_adm_rekap_patient patient
|
|
JOIN x_adm_rekap_fisik_vital vital ON vital.REG_NO = patient.REG_NO
|
|
WHERE
|
|
patient.PATIENT_ID = '{$data_patient['M_PatientOldPID']}' AND
|
|
patient.DOB = '{$data_patient['M_PatientDOB']}' AND
|
|
patient.PATIENT_NAME = '{$patient_name}'";
|
|
//echo $sql;
|
|
$data_tahun_lalu = $this->db_smartone->query($sql)->row_array();
|
|
if($type == 'left')
|
|
$ret_array['a1'] = isset($data_tahun_lalu['Visus_Kiri'])?$data_tahun_lalu['Visus_Kiri']:"-";
|
|
|
|
if($type == 'right')
|
|
$ret_array['a1'] = isset($data_tahun_lalu['Visus_Kanan'])?$data_tahun_lalu['Visus_Kanan']:"-";
|
|
}else{
|
|
$ret_array['a1'] = "-";
|
|
$ret_array['a2'] = "NaN";
|
|
}
|
|
$sql = " SELECT * , IFNULL(T_SamplingAdditionalFisikVisusID,0) as visus_id
|
|
FROM so_resultentry
|
|
LEFT JOIN t_samplingso_additional_fisik_visus ON T_SamplingAdditionalFisikVisusT_OrderHeaderID = So_ResultEntryT_OrderHeaderID
|
|
WHERE
|
|
So_ResultEntryID = ? LIMIT 1";
|
|
$qry = $this->db_smartone->query($sql,array($id));
|
|
if (! $qry) {
|
|
return json_encode(array());
|
|
}
|
|
|
|
$row_result = $qry->row_array();
|
|
//echo $this->db_smartone->last_query();
|
|
|
|
if($row_result && intval($row_result['visus_id']) > 0){
|
|
|
|
|
|
|
|
$visus = array();
|
|
$visus_kiri = "";
|
|
$visus_kanan = "";
|
|
$visus_kesimpulan = "";
|
|
$normal = array("20/20", "20/25");
|
|
|
|
|
|
if(($row_result['T_SamplingAdditionalFisikVisusTKODV'] != "" && $row_result['T_SamplingAdditionalFisikVisusTKODV'] != "-") && ($row_result['T_SamplingAdditionalFisikVisusTKOSV'] != "" && $row_result['T_SamplingAdditionalFisikVisusTKOSV'] != "-" && strtolower($row_result['T_SamplingAdditionalFisikVisusTKODV']) != "normal" && strtolower($row_result['T_SamplingAdditionalFisikVisusTKOSV']) != "normal")){
|
|
$visus[] = array(
|
|
"xx1" => "Tanpa Kacamata",
|
|
"xx2" => "OD : ",
|
|
"xx3" => $row_result['T_SamplingAdditionalFisikVisusTKODV']
|
|
);
|
|
|
|
$visus[] = array(
|
|
"xx1" => "Tanpa Kacamata",
|
|
"xx2" => "OS",
|
|
"xx3" => $row_result['T_SamplingAdditionalFisikVisusTKOSV']
|
|
);
|
|
|
|
$rst['kelainan'] = "Kelainan refraksi (tanpa kacamata)";
|
|
|
|
if (!in_array($row_result['T_SamplingAdditionalFisikVisusTKODV'], $normal)){
|
|
$value_koreksi_od = "";
|
|
$od_sph = $row_result['T_SamplingAdditionalFisikVisusODSPH'];
|
|
if($od_sph != "" && $od_sph != "-" && $od_sph != "--" && $od_sph != "/-" && $od_sph != "/" && $od_sph != "-/" && strtolower(trim($od_sph)) != 'plano'){
|
|
if ($visus_kanan != "") $visus_kanan .= ", ";
|
|
$visus_kanan .= $od_sph." (Miopia)";
|
|
}
|
|
|
|
|
|
$od_cyl = $row_result['T_SamplingAdditionalFisikVisusODCYL'];
|
|
|
|
//$od_cyl = $row_result['T_SamplingAdditionalFisikVisusODCYL'];
|
|
if($od_cyl != "" && $od_cyl != "-" && $od_cyl != "--" && $od_cyl != "/-" && $od_cyl != "/" && $od_cyl != "-/"){
|
|
if ($visus_kanan != "") $visus_kanan .= ", ";
|
|
$visus_kanan .= "Cyl ".$od_cyl;
|
|
}
|
|
|
|
|
|
$od_x = $row_result['T_SamplingAdditionalFisikVisusODX'];
|
|
//echo $od_x;
|
|
if($od_x != "" && $od_x != "-" && $od_x != "--" && $od_x != "/-" && $od_x != "/" && $od_x != "-/"){
|
|
//if ($visus_kanan != "") $visus_kanan .= ", ";
|
|
$visus_kanan .= " axis ".$od_x." (Astigmatismus)";
|
|
}else{
|
|
if($od_cyl != "" && $od_cyl != "-" && $od_cyl != "--" && $od_cyl != "/-" && $od_cyl != "/" && $od_cyl != "-/")
|
|
$visus_kanan .= " (Astigmatismus)";
|
|
}
|
|
//$value_koreksi_od .= "X (".$od_x.") ";
|
|
|
|
|
|
|
|
}
|
|
|
|
if (!in_array($row_result['T_SamplingAdditionalFisikVisusTKOSV'], $normal)){
|
|
$value_koreksi_os = "";
|
|
$os_sph = trim($row_result['T_SamplingAdditionalFisikVisusOSSPH']);
|
|
//echo $os_sph;
|
|
if(trim($os_sph) != " " && strtolower(trim($os_sph)) != "tidak terkoreksi" && strtolower(trim($os_sph)) != "tidak dapat dinilai" && $os_sph != "" && $os_sph != "-" && $os_sph != "--" && $os_sph != "/-" && $os_sph != "/" && $os_sph != "-/" && strtolower(trim($os_sph)) != 'plano'){
|
|
if ($visus_kiri != "") $visus_kiri .= ", ";
|
|
$visus_kiri .= $os_sph." (Miopia)";
|
|
}
|
|
|
|
$os_cyl = $row_result['T_SamplingAdditionalFisikVisusOSCYL'];
|
|
|
|
if(strtolower(trim($os_cyl)) != "tidak terkoreksi" && strtolower(trim($os_cyl)) != "tidak dapat dinilai" && $os_cyl != "" && $os_cyl != "-" && $os_cyl != "--" && $os_cyl != "/-" && $os_cyl != "/" && $os_cyl != "-/"){
|
|
if ($visus_kiri != "") $visus_kiri .= ", ";
|
|
$visus_kiri .= "Cyl ".$os_cyl;
|
|
}
|
|
|
|
|
|
$os_x = $row_result['T_SamplingAdditionalFisikVisusOSX'];
|
|
|
|
if(strtolower(trim($os_x)) != "tidak terkoreksi" && strtolower(trim($os_x)) != "tidak dapat dinilai" && $os_x != "" && $os_x != "-" && $os_x != "--" && $os_x != "/-" && $os_x != "/" && $os_x != "-/"){
|
|
//if ($visus_kiri != "") $visus_kiri .= ", ";
|
|
$visus_kiri .= " axis ".$os_x." (Astigmatismus)";
|
|
}else{
|
|
if($os_cyl != "" && $os_cyl != "-")
|
|
$visus_kiri .= " (Astigmatismus)";
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(($row_result['T_SamplingAdditionalFisikVisusDKODV'] != "" && $row_result['T_SamplingAdditionalFisikVisusDKODV'] != "-") && ($row_result['T_SamplingAdditionalFisikVisusDKOSV'] != "" && $row_result['T_SamplingAdditionalFisikVisusDKOSV'] != "-" && strtolower($row_result['T_SamplingAdditionalFisikVisusDKODV']) != "normal" && strtolower($row_result['T_SamplingAdditionalFisikVisusDKOSV']) != "normal")){
|
|
$visus[] = array(
|
|
"xx1" => "Dengan Kacamata",
|
|
"xx2" => "OD : ",
|
|
"xx3" => $row_result['T_SamplingAdditionalFisikVisusDKODV']
|
|
);
|
|
|
|
$visus[] = array(
|
|
"xx1" => "Dengan Kacamata",
|
|
"xx2" => "OS",
|
|
"xx3" => $row_result['T_SamplingAdditionalFisikVisusDKOSV']
|
|
);
|
|
|
|
$rst['kelainan'] = "Kelainan refraksi (dengan kacamata)";
|
|
|
|
$value_koreksi_od = "";
|
|
$od_sph = $row_result['T_SamplingAdditionalFisikVisusODSPH'];
|
|
if(strtolower(trim($od_sph)) != "tidak terkoreksi" && strtolower(trim($od_sph)) != "tidak dapat dinilai" && $od_sph != "" && $od_sph != "-" && $od_sph != "--" && $od_sph != "/-" && $od_sph != "/" && $od_sph != "-/" && strtolower(trim($od_sph)) != 'plano'){
|
|
if ($visus_kanan != "") $visus_kanan .= ", ";
|
|
$visus_kanan .= $od_sph." (Miopia)";
|
|
|
|
$miopia_od = true;
|
|
$miopia_od_value = $od_sph;
|
|
}
|
|
|
|
$od_cyl = $row_result['T_SamplingAdditionalFisikVisusODCYL'];
|
|
|
|
if(strtolower(trim($od_cyl)) != "tidak terkoreksi" && strtolower(trim($od_cyl)) != "tidak dapat dinilai" && $od_cyl != "" && $od_cyl != "-" && $od_cyl != "--" && $od_cyl != "/-" && $od_cyl != "/" && $od_cyl != "-/"){
|
|
if ($visus_kanan != "") $visus_kanan .= ", ";
|
|
$visus_kanan .= "Cyl ".$od_cyl;
|
|
|
|
$astigmatismus_od = true;
|
|
$astigmatismus_od_value = $od_cyl;
|
|
}
|
|
|
|
$od_x = $row_result['T_SamplingAdditionalFisikVisusODX'];
|
|
if(strtolower(trim($od_x)) != "tidak terkoreksi" && strtolower(trim($od_x)) != "tidak dapat dinilai" && $od_x != "" && $od_x != "-" && $od_x != "--" && $od_x != "/-" && $od_x != "/" && $od_x != "-/"){
|
|
//if ($visus_kanan != "") $visus_kanan .= ", ";
|
|
$visus_kanan .= " axis ".$od_x." (Astigmatismus)";
|
|
$x_od = true;
|
|
$x_od = $od_x;
|
|
}else{
|
|
if($od_cyl != "" && $od_cyl != "-" && $od_cyl != "--" && $od_cyl != "/-" && $od_cyl != "/" && $od_cyl != "-/")
|
|
$visus_kanan .= " (Astigmatismus)";
|
|
}
|
|
//$value_koreksi_od .= "X (".$od_x.") ";
|
|
|
|
|
|
|
|
|
|
|
|
$value_koreksi_os = "";
|
|
$os_sph = $row_result['T_SamplingAdditionalFisikVisusOSSPH'];
|
|
if(strtolower(trim($os_sph)) != "tidak terkoreksi" && strtolower(trim($os_sph)) != "tidak dapat dinilai" && $os_sph != "" && $os_sph != "-" && $os_sph != "--" && $os_sph != "/-" && $os_sph != "/" && $os_sph != "-/" && strtolower(trim($os_sph)) != 'plano'){
|
|
if ($visus_kiri != "") $visus_kiri .= ", ";
|
|
$visus_kiri .= $os_sph." (Miopia)";
|
|
|
|
$miopia_os = true;
|
|
$miopia_os_value = $os_sph;
|
|
}
|
|
|
|
$os_cyl = $row_result['T_SamplingAdditionalFisikVisusOSCYL'];
|
|
|
|
if(strtolower(trim($os_cyl)) != "tidak terkoreksi" && strtolower(trim($os_cyl)) != "tidak dapat dinilai" && $os_cyl != "" && $os_cyl != "-" && $os_cyl != "--" && $os_cyl != "/-" && $os_cyl != "/" && $os_cyl != "-/"){
|
|
if ($visus_kiri != "") $visus_kiri .= ", ";
|
|
$visus_kiri .= "Cyl ".$os_cyl;
|
|
|
|
$astigmatismus_os = true;
|
|
$astigmatismus_os_value = $os_cyl;
|
|
}
|
|
|
|
$os_x = $row_result['T_SamplingAdditionalFisikVisusOSX'];
|
|
|
|
if(strtolower(trim($os_x)) != "tidak terkoreksi" && strtolower(trim($os_x)) != "tidak dapat dinilai" && $os_x != "" && $os_x != "-" && $os_x != "--" && $os_x != "/-" && $os_x != "/" && $os_x != "-/"){
|
|
$visus_kiri .= " axis ".$os_x." (Astigmatismus)";
|
|
$x_os = true;
|
|
$x_os = $os_x;
|
|
}else{
|
|
if($os_cyl != "" && $os_cyl != "-" && $os_cyl != "--" && $os_cyl != "/-" && $os_cyl != "/" && $os_cyl != "-/")
|
|
$visus_kiri .= " (Astigmatismus)";
|
|
}
|
|
|
|
|
|
}
|
|
|
|
if(($row_result['T_SamplingAdditionalFisikVisusTKODV'] != "" && $row_result['T_SamplingAdditionalFisikVisusTKODV'] != "-") && ($row_result['T_SamplingAdditionalFisikVisusTKOSV'] != "" && $row_result['T_SamplingAdditionalFisikVisusTKOSV'] != "-")){
|
|
if (!in_array($row_result['T_SamplingAdditionalFisikVisusTKODV'], $normal) && $visus_kanan == ''){
|
|
$visus_kanan = "Miopia";
|
|
}
|
|
|
|
if (!in_array($row_result['T_SamplingAdditionalFisikVisusTKOSV'], $normal) && $visus_kiri == ''){
|
|
$visus_kiri = "Miopia";
|
|
}
|
|
}
|
|
|
|
if(($row_result['T_SamplingAdditionalFisikVisusDKODV'] != "" && $row_result['T_SamplingAdditionalFisikVisusDKODV'] != "-") && ($row_result['T_SamplingAdditionalFisikVisusDKOSV'] != "" && $row_result['T_SamplingAdditionalFisikVisusDKOSV'] != "-")){
|
|
if (!in_array($row_result['T_SamplingAdditionalFisikVisusDKODV'], $normal) && $visus_kanan == ''){
|
|
$visus_kanan = "Miopia";
|
|
}
|
|
|
|
if (!in_array($row_result['T_SamplingAdditionalFisikVisusDKOSV'], $normal) && $visus_kiri == ''){
|
|
$visus_kiri = "Miopia";
|
|
}
|
|
}
|
|
|
|
$od_add = $row_result['T_SamplingAdditionalFisikVisusADD'];
|
|
if($od_add != "" && $od_add != "-" && $od_add != "--" && $od_add != "/-" && $od_add != "/" && $od_add != "-/"){
|
|
if ($visus_kanan != "") $visus_kanan .= ", ";
|
|
$visus_kanan .= $od_add." (Presbiopia)";
|
|
|
|
if ($visus_kiri != "") $visus_kiri .= ", ";
|
|
$visus_kiri .= $od_add." (Presbiopia)";
|
|
}
|
|
|
|
|
|
|
|
|
|
if($type == 'left')
|
|
$ret_array['a2'] = $visus_kiri == ""?"Normal":$visus_kiri;
|
|
|
|
if($type == 'right')
|
|
$ret_array['a2'] = $visus_kanan == ""?"Normal":$visus_kanan;
|
|
|
|
}else{
|
|
$ret_array['a2'] = "Bahan belum";
|
|
}
|
|
|
|
echo json_encode([$ret_array]);
|
|
}
|
|
|
|
|
|
function hidung($id) {
|
|
$ret_array = [];
|
|
$sql = "SELECT *, IFNULL(M_PatientOldPID,'') as M_PatientOldPID
|
|
FROM t_orderheader
|
|
JOIN so_resultentry ON So_ResultEntryT_OrderHeaderID = T_OrderHeaderID AND So_ResultEntryID = {$id}
|
|
JOIN m_patient ON T_OrderHeaderM_PatientID = M_PatientID";
|
|
// echo $sql;
|
|
$data_patient = $this->db_smartone->query($sql)->row_array();
|
|
if($data_patient){
|
|
$patient_name = addslashes($data_patient['M_PatientName']);
|
|
$sql = "SELECT *
|
|
FROM x_adm_rekap_patient patient
|
|
JOIN x_adm_rekap_fisik_organ organ ON organ.REG_NO = patient.REG_NO
|
|
WHERE
|
|
patient.PATIENT_ID = '{$data_patient['M_PatientOldPID']}' AND
|
|
patient.DOB = '{$data_patient['M_PatientDOB']}' AND
|
|
patient.PATIENT_NAME = '{$patient_name}'";
|
|
//echo $sql;
|
|
$data_tahun_lalu = $this->db_smartone->query($sql)->row_array();
|
|
$ret_array['a1'] = isset($data_tahun_lalu['Hidung'])?$data_tahun_lalu['Hidung']:"-";
|
|
}else{
|
|
$ret_array['a1'] = "-";
|
|
}
|
|
|
|
$sql = "SELECT *
|
|
FROM so_resultentry_fisik_umum
|
|
JOIN fisik_template ON So_ResultEntryFisikUmumFisikTemplateID = FisikTemplateID AND FisikTemplateIsActive = 'Y' AND FisikTemplateTitle = 'HIDUNG'
|
|
WHERE
|
|
So_ResultEntryFisikUmumSo_ResultEntryID = ? AND So_ResultEntryFisikUmumIsActive = 'Y'";
|
|
$qry = $this->db_smartone->query($sql,array($id));
|
|
if (! $qry) {
|
|
return json_encode(array());
|
|
}
|
|
$rows = $qry->result_array();
|
|
if (count($rows) == 0 ) {
|
|
return json_encode(array());
|
|
}
|
|
$d = json_decode($rows[0]["So_ResultEntryFisikUmumDetails"],true);
|
|
//keluhan saat ini
|
|
$hidung = array();
|
|
|
|
|
|
if ($d["title"] == "HIDUNG") {
|
|
|
|
foreach($d["details"] as $gp) {
|
|
if ($gp["chx"] == 1 ) {
|
|
$arr_result[] = array($gp["label"],$gp["value"]) ;
|
|
$hasil = $gp["label"];
|
|
if($gp["value"] != '')
|
|
$hasil = $gp["label"]." (".$gp["value"].")";
|
|
$hidung[] = $hasil;
|
|
}
|
|
}
|
|
|
|
}
|
|
$string_hidung = count($hidung) > 0?join(", ",$hidung):"-";
|
|
$ret_array['a2'] = $string_hidung;
|
|
echo json_encode([$ret_array]);
|
|
}
|
|
|
|
function leher($id) {
|
|
$ret_array = [];
|
|
$sql = "SELECT *, IFNULL(M_PatientOldPID,'') as M_PatientOldPID
|
|
FROM t_orderheader
|
|
JOIN so_resultentry ON So_ResultEntryT_OrderHeaderID = T_OrderHeaderID AND So_ResultEntryID = {$id}
|
|
JOIN m_patient ON T_OrderHeaderM_PatientID = M_PatientID";
|
|
// echo $sql;
|
|
$data_patient = $this->db_smartone->query($sql)->row_array();
|
|
if($data_patient){
|
|
$patient_name = addslashes($data_patient['M_PatientName']);
|
|
$sql = "SELECT *
|
|
FROM x_adm_rekap_patient patient
|
|
JOIN x_adm_rekap_fisik_organ organ ON organ.REG_NO = patient.REG_NO
|
|
WHERE
|
|
patient.PATIENT_ID = '{$data_patient['M_PatientOldPID']}' AND
|
|
patient.DOB = '{$data_patient['M_PatientDOB']}' AND
|
|
patient.PATIENT_NAME = '{$patient_name}'";
|
|
//echo $sql;
|
|
$data_tahun_lalu = $this->db_smartone->query($sql)->row_array();
|
|
$ret_array['a1'] = isset($data_tahun_lalu['Leher'])?$data_tahun_lalu['Leher']:"-";
|
|
}else{
|
|
$ret_array['a1'] = "-";
|
|
}
|
|
|
|
$sql = "SELECT *
|
|
FROM so_resultentry_fisik_umum
|
|
JOIN fisik_template ON So_ResultEntryFisikUmumFisikTemplateID = FisikTemplateID AND FisikTemplateIsActive = 'Y' AND FisikTemplateTitle = 'LEHER'
|
|
WHERE
|
|
So_ResultEntryFisikUmumSo_ResultEntryID = ? AND So_ResultEntryFisikUmumIsActive = 'Y'";
|
|
$qry = $this->db_smartone->query($sql,array($id));
|
|
if (! $qry) {
|
|
return json_encode(array());
|
|
}
|
|
$rows = $qry->result_array();
|
|
if (count($rows) == 0 ) {
|
|
return json_encode(array());
|
|
}
|
|
$d = json_decode($rows[0]["So_ResultEntryFisikUmumDetails"],true);
|
|
//keluhan saat ini
|
|
$leher = array();
|
|
|
|
|
|
if ($d["title"] == "LEHER") {
|
|
|
|
foreach($d["details"] as $gp) {
|
|
if ($gp["chx"] == 1 ) {
|
|
$arr_result[] = array($gp["label"],$gp["value"]) ;
|
|
$hasil = $gp["label"];
|
|
if($gp["value"] != '')
|
|
$hasil = $gp["label"]." (".$gp["value"].")";
|
|
$leher[] = $hasil;
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
$string_leher = count($leher) > 0?join(", ",$leher):"Normal";
|
|
$ret_array['a2'] = $string_leher;
|
|
echo json_encode([$ret_array]);
|
|
}
|
|
|
|
function thorax($id) {
|
|
$ret_array = [];
|
|
$sql = "SELECT *, IFNULL(M_PatientOldPID,'') as M_PatientOldPID
|
|
FROM t_orderheader
|
|
JOIN so_resultentry ON So_ResultEntryT_OrderHeaderID = T_OrderHeaderID AND So_ResultEntryID = {$id}
|
|
JOIN m_patient ON T_OrderHeaderM_PatientID = M_PatientID";
|
|
// echo $sql;
|
|
$data_patient = $this->db_smartone->query($sql)->row_array();
|
|
if($data_patient){
|
|
$patient_name = addslashes($data_patient['M_PatientName']);
|
|
$sql = "SELECT *
|
|
FROM x_adm_rekap_patient patient
|
|
JOIN x_adm_rekap_fisik_organ organ ON organ.REG_NO = patient.REG_NO
|
|
WHERE
|
|
patient.PATIENT_ID = '{$data_patient['M_PatientOldPID']}' AND
|
|
patient.DOB = '{$data_patient['M_PatientDOB']}' AND
|
|
patient.PATIENT_NAME = '{$patient_name}'";
|
|
//echo $sql;
|
|
$data_tahun_lalu = $this->db_smartone->query($sql)->row_array();
|
|
$ret_array['a1'] = isset($data_tahun_lalu['Leher'])?$data_tahun_lalu['Leher']:"-";
|
|
}else{
|
|
$ret_array['a1'] = "-";
|
|
}
|
|
|
|
$sql = "SELECT *
|
|
FROM so_resultentry_fisik_umum
|
|
JOIN fisik_template ON So_ResultEntryFisikUmumFisikTemplateID = FisikTemplateID AND FisikTemplateIsActive = 'Y' AND
|
|
FisikTemplateTitle = 'THORAX / DADA'
|
|
WHERE
|
|
So_ResultEntryFisikUmumSo_ResultEntryID = ? AND So_ResultEntryFisikUmumIsActive = 'Y'";
|
|
$qry = $this->db_smartone->query($sql,array($id));
|
|
if (! $qry) {
|
|
return json_encode(array());
|
|
}
|
|
$rows = $qry->result_array();
|
|
if (count($rows) == 0 ) {
|
|
return json_encode(array());
|
|
}
|
|
$d = json_decode($rows[0]["So_ResultEntryFisikUmumDetails"],true);
|
|
//keluhan saat ini
|
|
$leher = array();
|
|
|
|
|
|
if ($d["title"] == "THORAX / DADA") {
|
|
|
|
foreach($d["details"] as $gp) {
|
|
if ($gp["chx"] == 1 ) {
|
|
$arr_result[] = array($gp["label"],$gp["value"]) ;
|
|
$hasil = $gp["label"];
|
|
if($gp["value"] != '')
|
|
$hasil = $gp["label"]." (".$gp["value"].")";
|
|
$leher[] = $hasil;
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
$string_leher = count($leher) > 0?join(", ",$leher):"Normal";
|
|
$ret_array['a2'] = $string_leher;
|
|
echo json_encode([$ret_array]);
|
|
}
|
|
|
|
|
|
|
|
function mulut_gigi($id) {
|
|
$ret_array = [];
|
|
$sql = "SELECT *, IFNULL(M_PatientOldPID,'') as M_PatientOldPID
|
|
FROM t_orderheader
|
|
JOIN so_resultentry ON So_ResultEntryT_OrderHeaderID = T_OrderHeaderID AND So_ResultEntryID = {$id}
|
|
JOIN m_patient ON T_OrderHeaderM_PatientID = M_PatientID";
|
|
// echo $sql;
|
|
$data_patient = $this->db_smartone->query($sql)->row_array();
|
|
if($data_patient){
|
|
$patient_name = addslashes($data_patient['M_PatientName']);
|
|
$sql = "SELECT *
|
|
FROM x_adm_rekap_patient patient
|
|
JOIN x_adm_rekap_fisik_organ organ ON organ.REG_NO = patient.REG_NO
|
|
WHERE
|
|
patient.PATIENT_ID = '{$data_patient['M_PatientOldPID']}' AND
|
|
patient.DOB = '{$data_patient['M_PatientDOB']}' AND
|
|
patient.PATIENT_NAME = '{$patient_name}'";
|
|
//echo $sql;
|
|
$data_tahun_lalu = $this->db_smartone->query($sql)->row_array();
|
|
$ret_array['a1'] = isset($data_tahun_lalu['Rongga_Mulut_Gigi'])?$data_tahun_lalu['Rongga_Mulut_Gigi']:"-";
|
|
}else{
|
|
$ret_array['a1'] = "-";
|
|
}
|
|
|
|
$sql = "SELECT *
|
|
FROM so_resultentry_fisik_umum
|
|
JOIN fisik_template ON So_ResultEntryFisikUmumFisikTemplateID = FisikTemplateID AND FisikTemplateIsActive = 'Y' AND FisikTemplateTitle = 'MULUT'
|
|
WHERE
|
|
So_ResultEntryFisikUmumSo_ResultEntryID = ? AND So_ResultEntryFisikUmumIsActive = 'Y'";
|
|
$qry = $this->db_smartone->query($sql,array($id));
|
|
if (! $qry) {
|
|
return json_encode(array());
|
|
}
|
|
$rows = $qry->result_array();
|
|
if (count($rows) == 0 ) {
|
|
return json_encode(array());
|
|
}
|
|
$d = json_decode($rows[0]["So_ResultEntryFisikUmumDetails"],true);
|
|
//print_r($d);
|
|
//keluhan saat ini
|
|
$mulut = array();
|
|
|
|
if ($d["title"] == "MULUT") {
|
|
//print_r($d['details']);
|
|
foreach($d["details"] as $gp) {
|
|
if($gp['name'] == "Mukosa rongga mulut"){
|
|
//print_r($gp["details"]);
|
|
foreach($gp["details"] as $xd) {
|
|
if ($xd["chx"] == 1 && $xd["label"] != 'Normal') {
|
|
$arr_result[] = array($gp["name"],$xd["label"],$xd["value"]) ;
|
|
$hasil = $xd["label"];
|
|
if($xd["value"] != '')
|
|
$hasil = $xd["label"]." (".$xd["value"].")";
|
|
|
|
//echo $hasil;
|
|
$mulut[] = $hasil;
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|
|
}
|
|
|
|
$sql = "SELECT *
|
|
FROM so_resultentry_fisik_umum
|
|
JOIN fisik_template ON So_ResultEntryFisikUmumFisikTemplateID = FisikTemplateID AND FisikTemplateIsActive = 'Y' AND FisikTemplateTitle = 'GIGI'
|
|
WHERE
|
|
So_ResultEntryFisikUmumSo_ResultEntryID = ? AND So_ResultEntryFisikUmumIsActive = 'Y'";
|
|
$qry = $this->db_smartone->query($sql,array($id));
|
|
if (! $qry) {
|
|
return json_encode(array());
|
|
}
|
|
$rows = $qry->result_array();
|
|
if (count($rows) == 0 ) {
|
|
return json_encode(array());
|
|
}
|
|
$d = json_decode($rows[0]["So_ResultEntryFisikUmumDetails"],true);
|
|
//keluhan saat ini
|
|
$gigi = array();
|
|
if ($d["title"] == "GIGI") {
|
|
|
|
foreach($d["details"] as $gp) {
|
|
if ($gp["chx"] == 1 && $xd["label"] != 'Normal') {
|
|
$arr_result[] = array($gp["label"],$gp["value"]) ;
|
|
$gigi[] = $gp["label"];
|
|
}
|
|
}
|
|
|
|
}
|
|
if(count($mulut) == 0 && count($gigi) == 0){
|
|
$ret_array['a2'] = "Normal";
|
|
}else{
|
|
// echo "XX";
|
|
$string_mulut = count($mulut) > 0?join(", ",$mulut):"";
|
|
$string_gigi = count($gigi) > 0?join(", ",$gigi):"";
|
|
if($string_gigi == "Normal")
|
|
$string_gigi = '';
|
|
if($string_mulut == 'Normal')
|
|
$string_mulut = '';
|
|
|
|
if($string_mulut != '' && $string_gigi != '')
|
|
$string_mulut = $string_mulut.', ';
|
|
|
|
if($string_mulut == '' && $string_gigi == '')
|
|
$string_mulut = "Normal";
|
|
|
|
|
|
$ret_array['a2'] = $string_mulut.$string_gigi;
|
|
}
|
|
|
|
echo json_encode([$ret_array]);
|
|
}
|
|
|
|
function tenggorokan($id) {
|
|
$ret_array = [];
|
|
$sql = "SELECT *, IFNULL(M_PatientOldPID,'') as M_PatientOldPID
|
|
FROM t_orderheader
|
|
JOIN so_resultentry ON So_ResultEntryT_OrderHeaderID = T_OrderHeaderID AND So_ResultEntryID = {$id}
|
|
JOIN m_patient ON T_OrderHeaderM_PatientID = M_PatientID";
|
|
// echo $sql;
|
|
$data_patient = $this->db_smartone->query($sql)->row_array();
|
|
if($data_patient){
|
|
$patient_name = addslashes($data_patient['M_PatientName']);
|
|
$sql = "SELECT *
|
|
FROM x_adm_rekap_patient patient
|
|
JOIN x_adm_rekap_fisik_organ organ ON organ.REG_NO = patient.REG_NO
|
|
WHERE
|
|
patient.PATIENT_ID = '{$data_patient['M_PatientOldPID']}' AND
|
|
patient.DOB = '{$data_patient['M_PatientDOB']}' AND
|
|
patient.PATIENT_NAME = '{$patient_name}'";
|
|
//echo $sql;
|
|
$data_tahun_lalu = $this->db_smartone->query($sql)->row_array();
|
|
$ret_array['a1'] = isset($data_tahun_lalu['Tenggorokan'])?$data_tahun_lalu['Tenggorokan']:"-";
|
|
}else{
|
|
$ret_array['a1'] = "-";
|
|
}
|
|
|
|
$sql = "SELECT *
|
|
FROM so_resultentry_fisik_umum
|
|
JOIN fisik_template ON So_ResultEntryFisikUmumFisikTemplateID = FisikTemplateID AND FisikTemplateIsActive = 'Y' AND FisikTemplateTitle = 'MULUT'
|
|
WHERE
|
|
So_ResultEntryFisikUmumSo_ResultEntryID = ? AND So_ResultEntryFisikUmumIsActive = 'Y'";
|
|
$qry = $this->db_smartone->query($sql,array($id));
|
|
if (! $qry) {
|
|
return json_encode(array());
|
|
}
|
|
$rows = $qry->result_array();
|
|
if (count($rows) == 0 ) {
|
|
return json_encode(array());
|
|
}
|
|
$d = json_decode($rows[0]["So_ResultEntryFisikUmumDetails"],true);
|
|
//keluhan saat ini
|
|
$mulut = array();
|
|
|
|
|
|
if ($d["title"] == "MULUT") {
|
|
|
|
foreach($d["details"] as $gp) {
|
|
if($gp['name'] == "Tenggorokan"){
|
|
foreach($gp["details"] as $xd) {
|
|
if ($xd["chx"] == 1 && $xd["label"] != 'Normal') {
|
|
$arr_result[] = array($gp["name"],$xd["label"],$xd["value"]) ;
|
|
$hasil = $xd["label"];
|
|
if($xd["value"] != '')
|
|
$hasil = $xd["label"]." (".$xd["value"].")";
|
|
$mulut[] = $hasil;
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|
|
}
|
|
|
|
|
|
$string_mulut = count($mulut) > 0?join(", ",$mulut):"Normal";
|
|
$ret_array['a2'] = $string_mulut;
|
|
|
|
echo json_encode([$ret_array]);
|
|
}
|
|
|
|
function gigi($id) {
|
|
$sql = "SELECT *
|
|
FROM so_resultentry_fisik_umum
|
|
JOIN fisik_template ON So_ResultEntryFisikUmumFisikTemplateID = FisikTemplateID AND FisikTemplateIsActive = 'Y' AND FisikTemplateTitle = 'GIGI'
|
|
WHERE
|
|
So_ResultEntryFisikUmumSo_ResultEntryID = ? AND So_ResultEntryFisikUmumIsActive = 'Y'";
|
|
$qry = $this->db_smartone->query($sql,array($id));
|
|
if (! $qry) {
|
|
return json_encode(array());
|
|
}
|
|
$rows = $qry->result_array();
|
|
if (count($rows) == 0 ) {
|
|
return json_encode(array());
|
|
}
|
|
$d = json_decode($rows[0]["So_ResultEntryFisikUmumDetails"],true);
|
|
//keluhan saat ini
|
|
$gigi = array();
|
|
|
|
|
|
if ($d["title"] == "GIGI") {
|
|
|
|
foreach($d["details"] as $gp) {
|
|
if ($gp["chx"] == 1 ) {
|
|
$arr_result[] = array($gp["label"],$gp["value"]) ;
|
|
$gigi[] = array(
|
|
"ff1" => $gp["label"],
|
|
"ff2" => $gp["value"],
|
|
);
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
if(empty($gigi)){
|
|
$gigi[] = array(
|
|
"ff1" => 'Tidak diperiksa',
|
|
"ff2" => '',
|
|
);
|
|
}
|
|
echo json_encode($gigi);
|
|
}
|
|
|
|
|
|
|
|
function paru($id) {
|
|
$ret_array = [];
|
|
$sql = "SELECT *, IFNULL(M_PatientOldPID,'') as M_PatientOldPID
|
|
FROM t_orderheader
|
|
JOIN so_resultentry ON So_ResultEntryT_OrderHeaderID = T_OrderHeaderID AND So_ResultEntryID = {$id}
|
|
JOIN m_patient ON T_OrderHeaderM_PatientID = M_PatientID";
|
|
// echo $sql;
|
|
$data_patient = $this->db_smartone->query($sql)->row_array();
|
|
if($data_patient){
|
|
$patient_name = addslashes($data_patient['M_PatientName']);
|
|
$sql = "SELECT *
|
|
FROM x_adm_rekap_patient patient
|
|
JOIN x_adm_rekap_fisik_organ organ ON organ.REG_NO = patient.REG_NO
|
|
WHERE
|
|
patient.PATIENT_ID = '{$data_patient['M_PatientOldPID']}' AND
|
|
patient.DOB = '{$data_patient['M_PatientDOB']}' AND
|
|
patient.PATIENT_NAME = '{$patient_name}'";
|
|
//echo $sql;
|
|
$data_tahun_lalu = $this->db_smartone->query($sql)->row_array();
|
|
$ret_array['a1'] = isset($data_tahun_lalu['Paru'])?$data_tahun_lalu['Paru']:"-";
|
|
}else{
|
|
$ret_array['a1'] = "-";
|
|
}
|
|
$sql = "SELECT *
|
|
FROM so_resultentry_fisik_umum
|
|
JOIN fisik_template ON So_ResultEntryFisikUmumFisikTemplateID = FisikTemplateID AND FisikTemplateIsActive = 'Y' AND FisikTemplateTitle = 'PARU-PARU'
|
|
WHERE
|
|
So_ResultEntryFisikUmumSo_ResultEntryID = ? AND So_ResultEntryFisikUmumIsActive = 'Y'";
|
|
$qry = $this->db_smartone->query($sql,array($id));
|
|
if (! $qry) {
|
|
return json_encode(array());
|
|
}
|
|
$rows = $qry->result_array();
|
|
if (count($rows) == 0 ) {
|
|
return json_encode(array());
|
|
}
|
|
$d = json_decode($rows[0]["So_ResultEntryFisikUmumDetails"],true);
|
|
//keluhan saat ini
|
|
$paru = array();
|
|
|
|
if ($d["title"] == "PARU-PARU") {
|
|
|
|
foreach($d["details"] as $gp) {
|
|
if ($gp["chx"] == 1 ) {
|
|
$arr_result[] = array($gp["label"],$gp["value"]) ;
|
|
$hasil = $gp["label"];
|
|
if($gp["value"] != '')
|
|
$hasil = $gp["label"]." (".$gp["value"].")";
|
|
$paru[] = $hasil;
|
|
}
|
|
}
|
|
|
|
}
|
|
$string_paru = count($paru) > 0?join(", ",$paru):"-";
|
|
$ret_array['a2'] = $string_paru;
|
|
echo json_encode([$ret_array]);
|
|
}
|
|
|
|
|
|
function jantung($id) {
|
|
$ret_array = [];
|
|
$sql = "SELECT *, IFNULL(M_PatientOldPID,'') as M_PatientOldPID
|
|
FROM t_orderheader
|
|
JOIN so_resultentry ON So_ResultEntryT_OrderHeaderID = T_OrderHeaderID AND So_ResultEntryID = {$id}
|
|
JOIN m_patient ON T_OrderHeaderM_PatientID = M_PatientID";
|
|
// echo $sql;
|
|
$data_patient = $this->db_smartone->query($sql)->row_array();
|
|
if($data_patient){
|
|
$patient_name = addslashes($data_patient['M_PatientName']);
|
|
$sql = "SELECT *
|
|
FROM x_adm_rekap_patient patient
|
|
JOIN x_adm_rekap_fisik_organ organ ON organ.REG_NO = patient.REG_NO
|
|
WHERE
|
|
patient.PATIENT_ID = '{$data_patient['M_PatientOldPID']}' AND
|
|
patient.DOB = '{$data_patient['M_PatientDOB']}' AND
|
|
patient.PATIENT_NAME = '{$patient_name}'";
|
|
//echo $sql;
|
|
$data_tahun_lalu = $this->db_smartone->query($sql)->row_array();
|
|
$ret_array['a1'] = isset($data_tahun_lalu['Jantung'])?$data_tahun_lalu['Jantung']:"-";
|
|
}else{
|
|
$ret_array['a1'] = "-";
|
|
}
|
|
$sql = "SELECT *
|
|
FROM so_resultentry_fisik_umum
|
|
JOIN fisik_template ON So_ResultEntryFisikUmumFisikTemplateID = FisikTemplateID AND FisikTemplateIsActive = 'Y' AND FisikTemplateTitle = 'JANTUNG'
|
|
WHERE
|
|
So_ResultEntryFisikUmumSo_ResultEntryID = ? AND So_ResultEntryFisikUmumIsActive = 'Y'";
|
|
$qry = $this->db_smartone->query($sql,array($id));
|
|
if (! $qry) {
|
|
return json_encode(array());
|
|
}
|
|
$rows = $qry->result_array();
|
|
if (count($rows) == 0 ) {
|
|
return json_encode(array());
|
|
}
|
|
$d = json_decode($rows[0]["So_ResultEntryFisikUmumDetails"],true);
|
|
//keluhan saat ini
|
|
$jantung = array();
|
|
|
|
|
|
if ($d["title"] == "JANTUNG") {
|
|
|
|
foreach($d["details"] as $gp) {
|
|
foreach($gp["details"] as $xd) {
|
|
if ($xd["chx"] == 1 && $xd["label"] != 'Normal') {
|
|
$arr_result[] = array($gp["name"],$xd["label"],$xd["value"]) ;
|
|
$hasil = $xd["label"];
|
|
if($xd["value"] != '')
|
|
$hasil = $xd["label"]." (".$xd["value"].")";
|
|
$jantung[] = $hasil;
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
|
|
$string_jantung = count($jantung) > 0?join(", ",$jantung):"Normal";
|
|
$ret_array['a2'] = $string_jantung;
|
|
echo json_encode([$ret_array]);
|
|
}
|
|
|
|
|
|
function low_back_pain($id) {
|
|
$ret_array = [];
|
|
$sql = "SELECT *, IFNULL(M_PatientOldPID,'') as M_PatientOldPID
|
|
FROM t_orderheader
|
|
JOIN so_resultentry ON So_ResultEntryT_OrderHeaderID = T_OrderHeaderID AND So_ResultEntryID = {$id}
|
|
JOIN m_patient ON T_OrderHeaderM_PatientID = M_PatientID";
|
|
// echo $sql;
|
|
$data_patient = $this->db_smartone->query($sql)->row_array();
|
|
if($data_patient){
|
|
$patient_name = addslashes($data_patient['M_PatientName']);
|
|
$sql = "SELECT *
|
|
FROM x_adm_rekap_patient patient
|
|
JOIN x_adm_rekap_fisik_organ organ ON organ.REG_NO = patient.REG_NO
|
|
WHERE
|
|
patient.PATIENT_ID = '{$data_patient['M_PatientOldPID']}' AND
|
|
patient.DOB = '{$data_patient['M_PatientDOB']}' AND
|
|
patient.PATIENT_NAME = '{$patient_name}'";
|
|
//echo $sql;
|
|
$data_tahun_lalu = $this->db_smartone->query($sql)->row_array();
|
|
$ret_array['a1'] = isset($data_tahun_lalu['Tulang_belakang'])?$data_tahun_lalu['Tulang_belakang']:"-";
|
|
}else{
|
|
$ret_array['a1'] = "-";
|
|
}
|
|
|
|
|
|
|
|
$ret_array['a2'] = "Normal";
|
|
echo json_encode([$ret_array]);
|
|
}
|
|
|
|
function anogenital($id) {
|
|
$ret_array = [];
|
|
$sql = "SELECT *, IFNULL(M_PatientOldPID,'') as M_PatientOldPID
|
|
FROM t_orderheader
|
|
JOIN so_resultentry ON So_ResultEntryT_OrderHeaderID = T_OrderHeaderID AND So_ResultEntryID = {$id}
|
|
JOIN m_patient ON T_OrderHeaderM_PatientID = M_PatientID";
|
|
// echo $sql;
|
|
$data_patient = $this->db_smartone->query($sql)->row_array();
|
|
if($data_patient){
|
|
$patient_name = addslashes($data_patient['M_PatientName']);
|
|
$sql = "SELECT *
|
|
FROM x_adm_rekap_patient patient
|
|
JOIN x_adm_rekap_fisik_organ organ ON organ.REG_NO = patient.REG_NO
|
|
WHERE
|
|
patient.PATIENT_ID = '{$data_patient['M_PatientOldPID']}' AND
|
|
patient.DOB = '{$data_patient['M_PatientDOB']}' AND
|
|
patient.PATIENT_NAME = '{$patient_name}'";
|
|
//echo $sql;
|
|
$data_tahun_lalu = $this->db_smartone->query($sql)->row_array();
|
|
$ret_array['a1'] = isset($data_tahun_lalu['Anogenital'])?$data_tahun_lalu['Anogenital']:"-";
|
|
}else{
|
|
$ret_array['a1'] = "-";
|
|
}
|
|
$sql = "SELECT *
|
|
FROM so_resultentry_fisik_umum
|
|
JOIN fisik_template ON So_ResultEntryFisikUmumFisikTemplateID = FisikTemplateID AND FisikTemplateIsActive = 'Y' AND FisikTemplateTitle = 'PERUT / ABDOMEN'
|
|
WHERE
|
|
So_ResultEntryFisikUmumSo_ResultEntryID = ? AND So_ResultEntryFisikUmumIsActive = 'Y'";
|
|
$qry = $this->db_smartone->query($sql,array($id));
|
|
if (! $qry) {
|
|
return json_encode(array());
|
|
}
|
|
$rows = $qry->result_array();
|
|
if (count($rows) == 0 ) {
|
|
return json_encode(array());
|
|
}
|
|
$d = json_decode($rows[0]["So_ResultEntryFisikUmumDetails"],true);
|
|
//keluhan saat ini
|
|
$perut = array();
|
|
|
|
|
|
if ($d["title"] == "PERUT / ABDOMEN") {
|
|
|
|
foreach($d["details"] as $gp) {
|
|
if($gp["name"] == 'Hemorroid' ){
|
|
foreach($gp["details"] as $xd) {
|
|
if ($xd["chx"] == 1 ){
|
|
$arr_result[] = array($gp["name"],$xd["label"],$xd["value"]) ;
|
|
$hasil = $xd["label"];
|
|
if($xd["value"] != '')
|
|
$hasil = $xd["label"]." (".$xd["value"].")";
|
|
$perut[] = $hasil;
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
$string_perut = count($perut) > 0?join(", ",$perut):"-";
|
|
$ret_array['a2'] = $string_perut;
|
|
echo json_encode([$ret_array]);
|
|
}
|
|
|
|
function tonometri($id) {
|
|
$ret_array = [];
|
|
$sql = "SELECT *, IFNULL(M_PatientOldPID,'') as M_PatientOldPID
|
|
FROM t_orderheader
|
|
JOIN so_resultentry ON So_ResultEntryT_OrderHeaderID = T_OrderHeaderID AND So_ResultEntryID = {$id}
|
|
JOIN m_patient ON T_OrderHeaderM_PatientID = M_PatientID";
|
|
// echo $sql;
|
|
$data_patient = $this->db_smartone->query($sql)->row_array();
|
|
if($data_patient){
|
|
$patient_name = addslashes($data_patient['M_PatientName']);
|
|
$sql = "SELECT *
|
|
FROM x_adm_rekap_patient patient
|
|
JOIN x_adm_rekap_fisik_organ organ ON organ.REG_NO = patient.REG_NO
|
|
WHERE
|
|
patient.PATIENT_ID = '{$data_patient['M_PatientOldPID']}' AND
|
|
patient.DOB = '{$data_patient['M_PatientDOB']}' AND
|
|
patient.PATIENT_NAME = '{$patient_name}'";
|
|
//echo $sql;
|
|
$data_tahun_lalu = $this->db_smartone->query($sql)->row_array();
|
|
$ret_array['a1'] = isset($data_tahun_lalu['Tonometri'])?$data_tahun_lalu['Tonometri']:"-";
|
|
}else{
|
|
$ret_array['a1'] = "-";
|
|
}
|
|
$sql = "SELECT *
|
|
FROM so_resultentry_fisik_umum
|
|
JOIN fisik_template ON So_ResultEntryFisikUmumFisikTemplateID = FisikTemplateID AND FisikTemplateIsActive = 'Y' AND FisikTemplateTitle = 'TONOMETRI'
|
|
WHERE
|
|
So_ResultEntryFisikUmumSo_ResultEntryID = ? AND So_ResultEntryFisikUmumIsActive = 'Y'";
|
|
$qry = $this->db_smartone->query($sql,array($id));
|
|
if (! $qry) {
|
|
echo json_encode(array());
|
|
}
|
|
$rows = $qry->result_array();
|
|
if (count($rows) == 0 ) {
|
|
|
|
$ret_array['a2'] = 'NaN';
|
|
echo json_encode([$ret_array]);
|
|
exit;
|
|
}
|
|
$d = json_decode($rows[0]["So_ResultEntryFisikUmumDetails"],true);
|
|
//keluhan saat ini
|
|
$od = "OD : - mmHg";
|
|
$os = "OS : - mmHg";
|
|
|
|
|
|
if ($d["title"] == "TONOMETRI") {
|
|
|
|
foreach($d["details"] as $gp) {
|
|
foreach($gp["details"] as $xd) {
|
|
if ($xd["id_code"] == 'tonometri_od'){
|
|
$od = "OD : " .$xd["value"]." ".$xd["unit"];
|
|
}
|
|
if ($xd["id_code"] == 'tonometri_os'){
|
|
$os = "OS : " .$xd["value"]." ".$xd["unit"];
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
$ret_array['a2'] = $od." ; ".$os;
|
|
echo json_encode([$ret_array]);
|
|
}
|
|
|
|
function perut($id) {
|
|
$ret_array = [];
|
|
$sql = "SELECT *, IFNULL(M_PatientOldPID,'') as M_PatientOldPID
|
|
FROM t_orderheader
|
|
JOIN so_resultentry ON So_ResultEntryT_OrderHeaderID = T_OrderHeaderID AND So_ResultEntryID = {$id}
|
|
JOIN m_patient ON T_OrderHeaderM_PatientID = M_PatientID";
|
|
// echo $sql;
|
|
$data_patient = $this->db_smartone->query($sql)->row_array();
|
|
if($data_patient){
|
|
$patient_name = addslashes($data_patient['M_PatientName']);
|
|
$sql = "SELECT *
|
|
FROM x_adm_rekap_patient patient
|
|
JOIN x_adm_rekap_fisik_organ organ ON organ.REG_NO = patient.REG_NO
|
|
WHERE
|
|
patient.PATIENT_ID = '{$data_patient['M_PatientOldPID']}' AND
|
|
patient.DOB = '{$data_patient['M_PatientDOB']}' AND
|
|
patient.PATIENT_NAME = '{$patient_name}'";
|
|
//echo $sql;
|
|
$data_tahun_lalu = $this->db_smartone->query($sql)->row_array();
|
|
$ret_array['a1'] = isset($data_tahun_lalu['Abdomen'])?$data_tahun_lalu['Abdomen']:"-";
|
|
}else{
|
|
$ret_array['a1'] = "-";
|
|
}
|
|
$sql = "SELECT *
|
|
FROM so_resultentry_fisik_umum
|
|
JOIN fisik_template ON So_ResultEntryFisikUmumFisikTemplateID = FisikTemplateID AND FisikTemplateIsActive = 'Y' AND FisikTemplateTitle = 'PERUT / ABDOMEN'
|
|
WHERE
|
|
So_ResultEntryFisikUmumSo_ResultEntryID = ? AND So_ResultEntryFisikUmumIsActive = 'Y'";
|
|
$qry = $this->db_smartone->query($sql,array($id));
|
|
if (! $qry) {
|
|
return json_encode(array());
|
|
}
|
|
$rows = $qry->result_array();
|
|
if (count($rows) == 0 ) {
|
|
return json_encode(array());
|
|
}
|
|
$d = json_decode($rows[0]["So_ResultEntryFisikUmumDetails"],true);
|
|
//keluhan saat ini
|
|
$perut = array();
|
|
|
|
|
|
if ($d["title"] == "PERUT / ABDOMEN") {
|
|
|
|
foreach($d["details"] as $gp) {
|
|
if($gp["name"] != 'Hernia' && $gp["name"] != 'Pengukuran' && $gp["name"] != 'Hemorroid' ){
|
|
foreach($gp["details"] as $xd) {
|
|
if ($xd["chx"] == 1 && $xd["label"] != 'Normal' && $xd["id_code"] !== 'perut_3'){
|
|
$arr_result[] = array($gp["name"],$xd["label"],$xd["value"]) ;
|
|
$hasil = $xd["label"];
|
|
if($xd["value"] != '')
|
|
$hasil = $xd["label"]." (".$xd["value"].")";
|
|
$perut[] = $hasil;
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
$string_perut = count($perut) > 0?join(", ",$perut):"Normal";
|
|
$ret_array['a2'] = $string_perut;
|
|
echo json_encode([$ret_array]);
|
|
}
|
|
|
|
function ginjal($id) {
|
|
$ret_array = [];
|
|
$sql = "SELECT *, IFNULL(M_PatientOldPID,'') as M_PatientOldPID
|
|
FROM t_orderheader
|
|
JOIN so_resultentry ON So_ResultEntryT_OrderHeaderID = T_OrderHeaderID AND So_ResultEntryID = {$id}
|
|
JOIN m_patient ON T_OrderHeaderM_PatientID = M_PatientID";
|
|
// echo $sql;
|
|
$data_patient = $this->db_smartone->query($sql)->row_array();
|
|
if($data_patient){
|
|
$patient_name = addslashes($data_patient['M_PatientName']);
|
|
$sql = "SELECT *
|
|
FROM x_adm_rekap_patient patient
|
|
JOIN x_adm_rekap_fisik_organ organ ON organ.REG_NO = patient.REG_NO
|
|
WHERE
|
|
patient.PATIENT_ID = '{$data_patient['M_PatientOldPID']}' AND
|
|
patient.DOB = '{$data_patient['M_PatientDOB']}' AND
|
|
patient.PATIENT_NAME = '{$patient_name}'";
|
|
//echo $sql;
|
|
$data_tahun_lalu = $this->db_smartone->query($sql)->row_array();
|
|
if($data_tahun_lalu){
|
|
$ret_array['a1'] = isset($data_tahun_lalu['Ginjal'])?$data_tahun_lalu['Ginjal']:"Normal";
|
|
if($ret_array['a1'] == "" || $ret_array['a1'] == "-"){
|
|
$ret_array['a1'] = "Normal";
|
|
}
|
|
}else{
|
|
$ret_array['a1'] = "-";
|
|
}
|
|
|
|
}else{
|
|
$ret_array['a1'] = "-";
|
|
}
|
|
|
|
|
|
|
|
$sql = "SELECT *
|
|
FROM so_resultentry_fisik_umum
|
|
JOIN fisik_template ON So_ResultEntryFisikUmumFisikTemplateID = FisikTemplateID AND FisikTemplateIsActive = 'Y' AND FisikTemplateTitle = 'PERUT / ABDOMEN'
|
|
WHERE
|
|
So_ResultEntryFisikUmumSo_ResultEntryID = ? AND So_ResultEntryFisikUmumIsActive = 'Y'";
|
|
$qry = $this->db_smartone->query($sql,array($id));
|
|
if (! $qry) {
|
|
return json_encode(array());
|
|
}
|
|
$rows = $qry->result_array();
|
|
if (count($rows) == 0 ) {
|
|
return json_encode(array());
|
|
}
|
|
$d = json_decode($rows[0]["So_ResultEntryFisikUmumDetails"],true);
|
|
//keluhan saat ini
|
|
$perut = [];
|
|
|
|
if ($d["title"] == "PERUT / ABDOMEN") {
|
|
|
|
foreach($d["details"] as $gp) {
|
|
if($gp["name"] == 'Abdomen') {
|
|
foreach($gp["details"] as $xd) {
|
|
if ($xd["chx"] == 1 && $xd["id_code"] == 'perut_3' ){
|
|
//$arr_result[] = array($gp["name"],$xd["label"],$xd["value"]) ;
|
|
$hasil = $xd["label"];
|
|
if($xd["value"] != '')
|
|
$hasil = $xd["label"]." (".$xd["value"].")";
|
|
$perut[] = $hasil;
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
$string_perut = count($perut) > 0?join(", ",$perut):"Normal";
|
|
if( $string_perut == "")
|
|
$string_perut = "Normal";
|
|
$ret_array['a2'] = $string_perut;
|
|
echo json_encode([$ret_array]);
|
|
|
|
}
|
|
|
|
function hernia($id) {
|
|
$ret_array = [];
|
|
$sql = "SELECT *, IFNULL(M_PatientOldPID,'') as M_PatientOldPID
|
|
FROM t_orderheader
|
|
JOIN so_resultentry ON So_ResultEntryT_OrderHeaderID = T_OrderHeaderID AND So_ResultEntryID = {$id}
|
|
JOIN m_patient ON T_OrderHeaderM_PatientID = M_PatientID";
|
|
// echo $sql;
|
|
$data_patient = $this->db_smartone->query($sql)->row_array();
|
|
if($data_patient){
|
|
$patient_name = addslashes($data_patient['M_PatientName']);
|
|
$sql = "SELECT *
|
|
FROM x_adm_rekap_patient patient
|
|
JOIN x_adm_rekap_fisik_organ organ ON organ.REG_NO = patient.REG_NO
|
|
WHERE
|
|
patient.PATIENT_ID = '{$data_patient['M_PatientOldPID']}' AND
|
|
patient.DOB = '{$data_patient['M_PatientDOB']}' AND
|
|
patient.PATIENT_NAME = '{$patient_name}'";
|
|
//echo $sql;
|
|
$data_tahun_lalu = $this->db_smartone->query($sql)->row_array();
|
|
$ret_array['a1'] = isset($data_tahun_lalu['Hernia'])?$data_tahun_lalu['Hernia']:"-";
|
|
}else{
|
|
$ret_array['a1'] = "-";
|
|
}
|
|
$sql = "SELECT *
|
|
FROM so_resultentry_fisik_umum
|
|
JOIN fisik_template ON So_ResultEntryFisikUmumFisikTemplateID = FisikTemplateID AND FisikTemplateIsActive = 'Y' AND FisikTemplateTitle = 'PERUT / ABDOMEN'
|
|
WHERE
|
|
So_ResultEntryFisikUmumSo_ResultEntryID = ? AND So_ResultEntryFisikUmumIsActive = 'Y'";
|
|
$qry = $this->db_smartone->query($sql,array($id));
|
|
if (! $qry) {
|
|
return json_encode(array());
|
|
}
|
|
$rows = $qry->result_array();
|
|
if (count($rows) == 0 ) {
|
|
return json_encode(array());
|
|
}
|
|
$d = json_decode($rows[0]["So_ResultEntryFisikUmumDetails"],true);
|
|
//keluhan saat ini
|
|
$perut = "";
|
|
|
|
|
|
if ($d["title"] == "PERUT / ABDOMEN") {
|
|
|
|
foreach($d["details"] as $gp) {
|
|
if($gp["name"] == 'Hernia') {
|
|
//print_r($gp["details"][1]);
|
|
if($gp["details"][1]["chx"] == "1"){
|
|
|
|
$perut = $gp["details"][1]["label"];
|
|
|
|
if($gp["details"][1]["details"][0]["chx_value"] == 1){
|
|
if($perut != "") $perut .= " : ";
|
|
$perut .= " ".$gp["details"][1]["details"][0]["label"];
|
|
}
|
|
//print_r($gp["details"][1]["details"][1]);
|
|
if($gp["details"][1]["details"][1]["chx_a_value"] == 1 || $gp["details"][1]["details"][1]["chx_b_value"] == 1 ){
|
|
$ds_hasil = "";
|
|
if($gp["details"][1]["details"][1]["chx_a_value"] == 1){
|
|
if($ds_hasil != "") $ds_hasil .= ", ";
|
|
$ds_hasil .= $gp["details"][1]["details"][1]["chx_a_label"];
|
|
}
|
|
|
|
if($gp["details"][1]["details"][1]["chx_b_value"] == 1){
|
|
if($ds_hasil != "") $ds_hasil .= ", ";
|
|
$ds_hasil .= $gp["details"][1]["details"][1]["chx_b_label"];
|
|
}
|
|
|
|
if($perut != "") $perut .= " : ";
|
|
$perut .= " ".$gp["details"][1]["details"][1]["label"]." (".$ds_hasil.")";
|
|
}
|
|
|
|
if($gp["details"][1]["details"][2]["chx_a_value"] == 1 || $gp["details"][1]["details"][2]["chx_b_value"] == 1 ){
|
|
$ds_hasil = "";
|
|
if($gp["details"][1]["details"][2]["chx_a_value"] == 1){
|
|
if($ds_hasil != "") $ds_hasil .= ", ";
|
|
$ds_hasil .= $gp["details"][1]["details"][1]["chx_a_label"];
|
|
}
|
|
|
|
if($gp["details"][1]["details"][2]["chx_b_value"] == 1){
|
|
if($ds_hasil != "") $ds_hasil .= ", ";
|
|
$ds_hasil .= $gp["details"][1]["details"][2]["chx_b_label"];
|
|
}
|
|
|
|
if($perut != "") $perut .= " : ";
|
|
$perut .= " ".$gp["details"][1]["details"][2]["label"]." (".$ds_hasil.")";
|
|
}
|
|
|
|
}
|
|
if($gp["details"][0]["chx"] == "1"){
|
|
$perut = $gp["details"][0]["label"];
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
$ret_array['a2'] = $perut;
|
|
echo json_encode([$ret_array]);
|
|
|
|
}
|
|
|
|
function kulit($id) {
|
|
$ret_array = [];
|
|
$sql = "SELECT *, IFNULL(M_PatientOldPID,'') as M_PatientOldPID
|
|
FROM t_orderheader
|
|
JOIN so_resultentry ON So_ResultEntryT_OrderHeaderID = T_OrderHeaderID AND So_ResultEntryID = {$id}
|
|
JOIN m_patient ON T_OrderHeaderM_PatientID = M_PatientID";
|
|
// echo $sql;
|
|
$data_patient = $this->db_smartone->query($sql)->row_array();
|
|
if($data_patient){
|
|
$patient_name = addslashes($data_patient['M_PatientName']);
|
|
$sql = "SELECT *
|
|
FROM x_adm_rekap_patient patient
|
|
JOIN x_adm_rekap_fisik_organ organ ON organ.REG_NO = patient.REG_NO
|
|
WHERE
|
|
patient.PATIENT_ID = '{$data_patient['M_PatientOldPID']}' AND
|
|
patient.DOB = '{$data_patient['M_PatientDOB']}' AND
|
|
patient.PATIENT_NAME = '{$patient_name}'";
|
|
//echo $sql;
|
|
$data_tahun_lalu = $this->db_smartone->query($sql)->row_array();
|
|
$ret_array['a1'] = isset($data_tahun_lalu['Kulit'])?$data_tahun_lalu['Kulit']:"-";
|
|
}else{
|
|
$ret_array['a1'] = "-";
|
|
}
|
|
$sql = "SELECT *
|
|
FROM so_resultentry_fisik_umum
|
|
JOIN fisik_template ON So_ResultEntryFisikUmumFisikTemplateID = FisikTemplateID AND FisikTemplateIsActive = 'Y' AND
|
|
FisikTemplateTitle = 'SISTEM INTEGUMEN'
|
|
WHERE
|
|
So_ResultEntryFisikUmumSo_ResultEntryID = ? AND So_ResultEntryFisikUmumIsActive = 'Y'";
|
|
$qry = $this->db_smartone->query($sql,array($id));
|
|
if (! $qry) {
|
|
return json_encode(array());
|
|
}
|
|
$rows = $qry->result_array();
|
|
if (count($rows) == 0 ) {
|
|
return json_encode(array());
|
|
}
|
|
$d = json_decode($rows[0]["So_ResultEntryFisikUmumDetails"],true);
|
|
//keluhan saat ini
|
|
$perut = array();
|
|
|
|
|
|
if ($d["title"] == "SISTEM INTEGUMEN") {
|
|
|
|
foreach($d["details"] as $gp) {
|
|
if($gp["name"] == 'Kulit' ){
|
|
//echo "kulit";
|
|
foreach($gp["details"] as $xd) {
|
|
if ($xd["chx"] == 1 && $xd["label"] != 'Lain-lain'){
|
|
// echo "IN";
|
|
$arr_result[] = array($gp["name"],$xd["label"],$xd["value"]) ;
|
|
$hasil = $xd["label"];
|
|
if($xd["value"] != '')
|
|
$hasil = $xd["label"]." (".$xd["value"].")";
|
|
$perut[] = $hasil;
|
|
}
|
|
|
|
if ($xd["chx"] == 1 && $xd["label"] == 'Lain-lain'){
|
|
// echo "lain";
|
|
$arr_result[] = array($gp["name"],$xd["label"],$xd["value"]) ;
|
|
$hasil = $xd["label"];
|
|
if($xd["value"] != '')
|
|
$hasil = $xd["label"]." (".$xd["value"].")";
|
|
$perut[] = $hasil;
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
$string_perut = count($perut) > 0?join(", ",$perut):"-";
|
|
$ret_array['a2'] = $string_perut;
|
|
echo json_encode([$ret_array]);
|
|
}
|
|
|
|
function extremitas($id) {
|
|
$ret_array = [];
|
|
$sql = "SELECT *, IFNULL(M_PatientOldPID,'') as M_PatientOldPID
|
|
FROM t_orderheader
|
|
JOIN so_resultentry ON So_ResultEntryT_OrderHeaderID = T_OrderHeaderID AND So_ResultEntryID = {$id}
|
|
JOIN m_patient ON T_OrderHeaderM_PatientID = M_PatientID";
|
|
// echo $sql;
|
|
$data_patient = $this->db_smartone->query($sql)->row_array();
|
|
if($data_patient){
|
|
$patient_name = addslashes($data_patient['M_PatientName']);
|
|
$sql = "SELECT *
|
|
FROM x_adm_rekap_patient patient
|
|
JOIN x_adm_rekap_fisik_organ organ ON organ.REG_NO = patient.REG_NO
|
|
WHERE
|
|
patient.PATIENT_ID = '{$data_patient['M_PatientOldPID']}' AND
|
|
patient.DOB = '{$data_patient['M_PatientDOB']}' AND
|
|
patient.PATIENT_NAME = '{$patient_name}'";
|
|
//echo $sql;
|
|
$data_tahun_lalu = $this->db_smartone->query($sql)->row_array();
|
|
$ret_array['a1'] = isset($data_tahun_lalu['Extremitas'])?$data_tahun_lalu['Extremitas']:"-";
|
|
}else{
|
|
$ret_array['a1'] = "-";
|
|
}
|
|
$sql = "SELECT *
|
|
FROM so_resultentry_fisik_umum
|
|
JOIN fisik_template ON So_ResultEntryFisikUmumFisikTemplateID = FisikTemplateID AND FisikTemplateIsActive = 'Y' AND
|
|
FisikTemplateTitle = 'ANGGOTA GERAK'
|
|
WHERE
|
|
So_ResultEntryFisikUmumSo_ResultEntryID = ? AND So_ResultEntryFisikUmumIsActive = 'Y'";
|
|
$qry = $this->db_smartone->query($sql,array($id));
|
|
if (! $qry) {
|
|
return json_encode(array());
|
|
}
|
|
$rows = $qry->result_array();
|
|
if (count($rows) == 0 ) {
|
|
return json_encode(array());
|
|
}
|
|
$d = json_decode($rows[0]["So_ResultEntryFisikUmumDetails"],true);
|
|
//keluhan saat ini
|
|
$perut = array();
|
|
|
|
|
|
if ($d["title"] == "ANGGOTA GERAK") {
|
|
|
|
foreach($d["details"] as $gp) {
|
|
|
|
//echo "kulit";
|
|
foreach($gp["details"] as $xd) {
|
|
if ($xd["chx"] == 1 && $xd["label"] != 'Lain-lain' && $xd["label"] != 'Normal'){
|
|
// echo "IN";
|
|
$arr_result[] = array($gp["name"],$xd["label"],$xd["value"]) ;
|
|
$perut[] = $xd["label"];
|
|
}
|
|
|
|
if ($xd["chx"] == 1 && $xd["label"] == 'Lain-lain'){
|
|
// echo "lain";
|
|
$arr_result[] = array($gp["name"],$xd["label"],$xd["value"]) ;
|
|
$hasil = $xd["label"];
|
|
if($xd["value"] != '')
|
|
$hasil = $xd["label"]." (".$xd["value"].")";
|
|
$perut[] = $hasil;
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
$string_perut = count($perut) > 0?join(", ",$perut):"Normal";
|
|
$ret_array['a2'] = $string_perut;
|
|
echo json_encode([$ret_array]);
|
|
}
|
|
|
|
function reflek($id,$type) {
|
|
$ret_array = [];
|
|
$sql = "SELECT *, IFNULL(M_PatientOldPID,'') as M_PatientOldPID
|
|
FROM t_orderheader
|
|
JOIN so_resultentry ON So_ResultEntryT_OrderHeaderID = T_OrderHeaderID AND So_ResultEntryID = {$id}
|
|
JOIN m_patient ON T_OrderHeaderM_PatientID = M_PatientID";
|
|
// echo $sql;
|
|
$data_patient = $this->db_smartone->query($sql)->row_array();
|
|
if($data_patient){
|
|
$patient_name = addslashes($data_patient['M_PatientName']);
|
|
$sql = "SELECT *
|
|
FROM x_adm_rekap_patient patient
|
|
JOIN x_adm_rekap_fisik_organ organ ON organ.REG_NO = patient.REG_NO
|
|
WHERE
|
|
patient.PATIENT_ID = '{$data_patient['M_PatientOldPID']}' AND
|
|
patient.DOB = '{$data_patient['M_PatientDOB']}' AND
|
|
patient.PATIENT_NAME = '{$patient_name}'";
|
|
//echo $sql;
|
|
$data_tahun_lalu = $this->db_smartone->query($sql)->row_array();
|
|
if($type == 'fisiologis')
|
|
$ret_array['a1'] = isset($data_tahun_lalu['Refleks_Fisiologis'])?$data_tahun_lalu['Refleks_Fisiologis']:"-";
|
|
if($type == 'patologis')
|
|
$ret_array['a1'] = isset($data_tahun_lalu['Refleks_Patologis'])?$data_tahun_lalu['Refleks_Patologis']:"-";
|
|
}else{
|
|
$ret_array['a1'] = "-";
|
|
}
|
|
$sql = "SELECT *
|
|
FROM so_resultentry_fisik_umum
|
|
JOIN fisik_template ON So_ResultEntryFisikUmumFisikTemplateID = FisikTemplateID AND FisikTemplateIsActive = 'Y' AND
|
|
FisikTemplateTitle = 'SISTEM PERSYARAFAN'
|
|
WHERE
|
|
So_ResultEntryFisikUmumSo_ResultEntryID = ? AND So_ResultEntryFisikUmumIsActive = 'Y'";
|
|
$qry = $this->db_smartone->query($sql,array($id));
|
|
if (! $qry) {
|
|
return json_encode(array());
|
|
}
|
|
$rows = $qry->result_array();
|
|
if (count($rows) == 0 ) {
|
|
return json_encode(array());
|
|
}
|
|
$d = json_decode($rows[0]["So_ResultEntryFisikUmumDetails"],true);
|
|
//keluhan saat ini
|
|
$fisiologis = array();
|
|
$patologis = array();
|
|
|
|
|
|
if ($d["title"] == "SISTEM PERSYARAFAN") {
|
|
|
|
foreach($d["details"] as $gp) {
|
|
if($gp['name'] == 'Refleks Fisiologis'){
|
|
foreach($gp["details"] as $xd) {
|
|
if ($xd["chx"] == 1 && $xd["label"] != 'Lain-lain' && $xd["label"] != 'Normal'){
|
|
// echo "IN";
|
|
$arr_result[] = array($gp["name"],$xd["label"],$xd["value"]) ;
|
|
$hasil = $xd["label"];
|
|
if($xd["value"] != '')
|
|
$hasil = $xd["label"]." (".$xd["value"].")";
|
|
$fisiologis[] = $hasil;
|
|
}
|
|
|
|
if ($xd["chx"] == 1 && $xd["label"] == 'Lain-lain'){
|
|
// echo "lain";
|
|
$arr_result[] = array($gp["name"],$xd["label"],$xd["value"]) ;
|
|
$hasil = $xd["label"];
|
|
if($xd["value"] != '')
|
|
$hasil = $xd["label"]." (".$xd["value"].")";
|
|
$fisiologis[] = $hasil;
|
|
}
|
|
}
|
|
//echo "kulit";
|
|
|
|
}
|
|
if($gp['name'] == 'Refleks Pathologis'){
|
|
foreach($gp["details"] as $xd) {
|
|
if ($xd["chx"] == 1 && $xd["label"] != 'Lain-lain' && $xd["label"] != 'Normal'){
|
|
// echo "IN";
|
|
$arr_result[] = array($gp["name"],$xd["label"],$xd["value"]) ;
|
|
$hasil = $xd["label"];
|
|
if($xd["value"] != '')
|
|
$hasil = $xd["label"]." (".$xd["value"].")";
|
|
$patologis[] = $hasil;
|
|
}
|
|
|
|
if ($xd["chx"] == 1 && $xd["label"] == 'Lain-lain'){
|
|
// echo "lain";
|
|
$arr_result[] = array($gp["name"],$xd["label"],$xd["value"]) ;
|
|
$hasil = $xd["label"];
|
|
if($xd["value"] != '')
|
|
$hasil = $xd["label"]." (".$xd["value"].")";
|
|
$patologis[] = $hasil;
|
|
}
|
|
}
|
|
//echo "kulit";
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
$string_hasil = '';
|
|
if($type == 'fisiologis'){
|
|
$string_hasil= count($fisiologis) > 0?join(", ",$fisiologis):"Normal";
|
|
}
|
|
|
|
if($type == 'patologis'){
|
|
$string_hasil= count($patologis) > 0?join(", ",$patologis):"Normal";
|
|
}
|
|
|
|
$ret_array['a2'] = $string_hasil;
|
|
echo json_encode([$ret_array]);
|
|
}
|
|
|
|
function genitourinaria($id) {
|
|
$sql = "SELECT *
|
|
FROM so_resultentry_fisik_umum
|
|
JOIN fisik_template ON So_ResultEntryFisikUmumFisikTemplateID = FisikTemplateID AND FisikTemplateIsActive = 'Y' AND FisikTemplateTitle = 'GENITOURINARIA'
|
|
WHERE
|
|
So_ResultEntryFisikUmumSo_ResultEntryID = ? AND So_ResultEntryFisikUmumIsActive = 'Y'";
|
|
$qry = $this->db_smartone->query($sql,array($id));
|
|
if (! $qry) {
|
|
return json_encode(array());
|
|
}
|
|
$rows = $qry->result_array();
|
|
if (count($rows) == 0 ) {
|
|
return json_encode(array());
|
|
}
|
|
$d = json_decode($rows[0]["So_ResultEntryFisikUmumDetails"],true);
|
|
//keluhan saat ini
|
|
$genitourinaria = array();
|
|
|
|
|
|
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"],
|
|
);
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
if(empty($genitourinaria)){
|
|
$genitourinaria[] = array(
|
|
"nn1" => "Tidak diperiksa",
|
|
"nn2" => ""
|
|
);
|
|
}
|
|
echo json_encode($genitourinaria);
|
|
}
|
|
function anggota($id) {
|
|
$sql = "SELECT *
|
|
FROM so_resultentry_fisik_umum
|
|
JOIN fisik_template ON So_ResultEntryFisikUmumFisikTemplateID = FisikTemplateID AND FisikTemplateIsActive = 'Y' AND FisikTemplateTitle = 'ANGGOTA GERAK'
|
|
WHERE
|
|
So_ResultEntryFisikUmumSo_ResultEntryID = ? AND So_ResultEntryFisikUmumIsActive = 'Y'";
|
|
$qry = $this->db_smartone->query($sql,array($id));
|
|
if (! $qry) {
|
|
return json_encode(array());
|
|
}
|
|
$rows = $qry->result_array();
|
|
if (count($rows) == 0 ) {
|
|
return json_encode(array());
|
|
}
|
|
$d = json_decode($rows[0]["So_ResultEntryFisikUmumDetails"],true);
|
|
//keluhan saat ini
|
|
$anggota = array();
|
|
|
|
|
|
if ($d["title"] == "ANGGOTA GERAK") {
|
|
//WIP
|
|
//echo "<pre>"; 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" => $gp["name"],
|
|
"oo2" => $xd["label"],
|
|
"oo3" => $xd["value"]
|
|
);
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
|
|
if(empty($anggota)){
|
|
$anggota[] = array(
|
|
"oo1" => "Tidak diperiksa",
|
|
"oo2" => "",
|
|
"oo3" => ""
|
|
);
|
|
}
|
|
echo json_encode($anggota);
|
|
}
|
|
function sistem($id) {
|
|
$sql = "SELECT *
|
|
FROM so_resultentry_fisik_umum
|
|
JOIN fisik_template ON So_ResultEntryFisikUmumFisikTemplateID = FisikTemplateID AND FisikTemplateIsActive = 'Y' AND FisikTemplateTitle = 'SISTEM PERSYARAFAN'
|
|
WHERE
|
|
So_ResultEntryFisikUmumSo_ResultEntryID = ? AND So_ResultEntryFisikUmumIsActive = 'Y'";
|
|
$qry = $this->db_smartone->query($sql,array($id));
|
|
if (! $qry) {
|
|
return json_encode(array());
|
|
}
|
|
$rows = $qry->result_array();
|
|
if (count($rows) == 0 ) {
|
|
return json_encode(array());
|
|
}
|
|
$d = json_decode($rows[0]["So_ResultEntryFisikUmumDetails"],true);
|
|
//keluhan saat ini
|
|
$sistem = array();
|
|
|
|
|
|
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"]
|
|
);
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
|
|
if(empty($sistem)){
|
|
$sistem[] = array(
|
|
"pp1" => "Tidak diperiksa",
|
|
"pp2" => "",
|
|
"pp3" => ""
|
|
);
|
|
}
|
|
echo json_encode($sistem);
|
|
}
|
|
|
|
|
|
function smell($id) {
|
|
$sql = "SELECT *
|
|
FROM so_resultentry_fisik_umum
|
|
JOIN fisik_template ON So_ResultEntryFisikUmumFisikTemplateID = FisikTemplateID AND FisikTemplateIsActive = 'Y' AND FisikTemplateTitle = 'SMELL TEST'
|
|
WHERE
|
|
So_ResultEntryFisikUmumSo_ResultEntryID = ? AND So_ResultEntryFisikUmumIsActive = 'Y'";
|
|
$qry = $this->db_smartone->query($sql,array($id));
|
|
if (! $qry) {
|
|
return json_encode(array());
|
|
}
|
|
$rows = $qry->result_array();
|
|
if (count($rows) == 0 ) {
|
|
return json_encode(array());
|
|
}
|
|
$d = json_decode($rows[0]["So_ResultEntryFisikUmumDetails"],true);
|
|
//keluhan saat ini
|
|
$smell= array();
|
|
|
|
|
|
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" => $gp["name"],
|
|
"xx2" => $xd["label"],
|
|
"xx3" => $xd["value"],
|
|
"xx4" => $d["is_inspected"]
|
|
|
|
);
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
|
|
if(empty($smell)){
|
|
$smell[] = array(
|
|
"xx1" => "Tidak periksa",
|
|
"xx2" => "",
|
|
"xx3" => ""
|
|
);
|
|
}
|
|
echo json_encode($smell);
|
|
}
|
|
|
|
|
|
function low($id) {
|
|
$sql = "SELECT *
|
|
FROM so_resultentry_fisik_umum
|
|
JOIN fisik_template ON So_ResultEntryFisikUmumFisikTemplateID = FisikTemplateID AND FisikTemplateIsActive = 'Y' AND FisikTemplateTitle = 'LOW BACK PAIN SCREENING TEST'
|
|
WHERE
|
|
So_ResultEntryFisikUmumSo_ResultEntryID = ? AND So_ResultEntryFisikUmumIsActive = 'Y'";
|
|
$qry = $this->db_smartone->query($sql,array($id));
|
|
if (! $qry) {
|
|
return json_encode(array());
|
|
}
|
|
$rows = $qry->result_array();
|
|
if (count($rows) == 0 ) {
|
|
return json_encode(array());
|
|
}
|
|
$d = json_decode($rows[0]["So_ResultEntryFisikUmumDetails"],true);
|
|
//keluhan saat ini
|
|
$low= array();
|
|
|
|
|
|
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" => $gp["name"],
|
|
"yy2" => $xd["label"],
|
|
"yy3" => $xd["value"],
|
|
"yy4" => $d["is_inspected"]
|
|
|
|
);
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
|
|
if(empty($low)){
|
|
$low[] = array(
|
|
"yy1" => "Tidak periksa",
|
|
"yy2" => "",
|
|
"yy3" => ""
|
|
);
|
|
}
|
|
echo json_encode($low);
|
|
}
|
|
|
|
|
|
|
|
function integumen($id) {
|
|
$sql = "SELECT *
|
|
FROM so_resultentry_fisik_umum
|
|
JOIN fisik_template ON So_ResultEntryFisikUmumFisikTemplateID = FisikTemplateID AND FisikTemplateIsActive = 'Y' AND FisikTemplateTitle = 'SISTEM INTEGUMEN'
|
|
WHERE
|
|
So_ResultEntryFisikUmumSo_ResultEntryID = ? AND So_ResultEntryFisikUmumIsActive = 'Y'";
|
|
$qry = $this->db_smartone->query($sql,array($id));
|
|
if (! $qry) {
|
|
return json_encode(array());
|
|
}
|
|
$rows = $qry->result_array();
|
|
if (count($rows) == 0 ) {
|
|
return json_encode(array());
|
|
}
|
|
$d = json_decode($rows[0]["So_ResultEntryFisikUmumDetails"],true);
|
|
//keluhan saat ini
|
|
$integumen = array();
|
|
|
|
|
|
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"]
|
|
);
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
|
|
if(empty($integumen)){
|
|
$integumen[] = array(
|
|
"pp1" => "Tidak periksa",
|
|
"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 "<pre>"; print_r($data);
|
|
}
|
|
|
|
function kesimpulanv4($id){
|
|
$this->load->library('kesimpulanfisik');
|
|
$kesimpulan = $this->kesimpulanfisik->kesimpulan($id);
|
|
return $kesimpulan;
|
|
}
|
|
|
|
function xkesimpulanv4($id) {
|
|
$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);*/
|
|
$sql = "SELECT *
|
|
FROM fisik_template
|
|
JOIN so_resultentry_fisik_umum ON So_ResultEntryFisikUmumFisikTemplateID = FisikTemplateID AND So_ResultEntryFisikUmumSo_ResultEntryID = ?
|
|
WHERE
|
|
FisikTemplateIsActive = 'Y' AND
|
|
FisikTemplateType = 'Riwayat'
|
|
ORDER BY FisikTemplateCode ASC
|
|
";
|
|
$qry = $this->db_smartone->query($sql,array($id));
|
|
// echo $this->db_smartone->last_query();
|
|
$xriwayats = $qry->result_array();
|
|
$riwayat_data = [];
|
|
foreach ($xriwayats as $key => $value) {
|
|
$riwayat_data[] = json_decode($value['So_ResultEntryFisikUmumDetails'],true);
|
|
}
|
|
//print_r($riwayat_data);
|
|
foreach($riwayat_data as $riwayat_da){
|
|
//print_r($riwayat_da);
|
|
//echo $riwayat_da["title"];
|
|
if ($riwayat_da["title"] == "KELUHAN SAAT INI") {
|
|
//print_r($riwayat_da["details"]);
|
|
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 .= $riwayat_db["label"] . " " . $riwayat_db["value"];
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
$kode_gigi = array( "X" => "Berlubang" ,
|
|
"C" => "Tambalan",
|
|
"O" => "Tanggal",
|
|
"R" => "Sisa akar",
|
|
"A" => "Gigi Palsu" ,
|
|
"K" => "Karang Gigi"
|
|
);
|
|
|
|
$sql = "SELECT *
|
|
FROM fisik_template
|
|
JOIN so_resultentry_fisik_umum ON So_ResultEntryFisikUmumFisikTemplateID = FisikTemplateID AND So_ResultEntryFisikUmumSo_ResultEntryID = ?
|
|
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
|
|
WHERE
|
|
FisikTemplateIsActive = 'Y' AND
|
|
FisikTemplateType = 'Fisik'
|
|
ORDER BY FisikTemplateCode ASC
|
|
";
|
|
$qry = $this->db_smartone->query($sql,array($id));
|
|
// echo $this->db_smartone->last_query();
|
|
$xfisiks = $qry->result_array();
|
|
$fisik_data = [];
|
|
foreach ($xfisiks as $kex => $valux) {
|
|
$fisik_data[] = json_decode($valux['So_ResultEntryFisikUmumDetails'],true);
|
|
}
|
|
//print_r($fisik_data);
|
|
/*$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 = $xfisiks[0]["M_PatientGender"] == 'male'?'L':'P';
|
|
//echo $xfisiks[0]["M_PatientGender"];
|
|
//echo $sexcode;
|
|
//$data = $fisik_data;
|
|
//echo json_encode($fisik_data);
|
|
// echo $kesimpulan;
|
|
foreach($fisik_data as $da) {
|
|
//echo $da["title"];
|
|
if ($da["title"] == "TANDA VITAL") {
|
|
foreach($da["details"] as $db) {
|
|
//print_r($db);
|
|
if( $db["chx_x"] == "1" ) {
|
|
if ($kesimpulan != "") $kesimpulan .= ", ";
|
|
$kesimpulan .= $db["label"] . " " . $db["label_x"];
|
|
}
|
|
if ($db["id_code"] == "tanda_vital_1") {
|
|
//echo $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 .= $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 .= $db["label"]." ".$db["value"]." ".$db["unit"]." ( ".ucwords(strtolower($db["value_x"]))." )";
|
|
}
|
|
}
|
|
} elseif($da["title"] == "STATUS GIZI") {
|
|
$bmi_value = "";
|
|
|
|
//echo json_encode($da['details']);
|
|
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["id_code"] == "status_gizi_6" && $db["value"] != "Normal" && $db["value"] != '-')) {
|
|
//echo $db["value"] ;
|
|
if ($kesimpulan != "") $kesimpulan .= ", ";
|
|
$kesimpulan .= $db["value"] . " ( BMI : $bmi_value )";
|
|
|
|
//echo $kesimpulan;
|
|
}
|
|
//echo $kesimpulan;
|
|
if ($db["id_code"] == "status_gizi_3") {
|
|
if(intval($db["value"]) >= 90 && $sexcode == 'L' ){
|
|
if ($kesimpulan != "") $kesimpulan .= ", ";
|
|
$kesimpulan .= $db["label"]. " "." ( ".$db["value"]." cm )";
|
|
}
|
|
if(intval($db["value"]) >= 80 && $sexcode == 'P' ){
|
|
if ($kesimpulan != "") $kesimpulan .= ", ";
|
|
$kesimpulan .= $db["label"]. " "." ( ".$db["value"]." cm )";
|
|
}
|
|
}
|
|
|
|
}
|
|
} elseif($da["title"] == "KEADAAN UMUM") {
|
|
foreach($da["details"] as $db) {
|
|
if( $db["chx_x"] == "1" ) {
|
|
if ($kesimpulan != "") $kesimpulan .= ", ";
|
|
$kesimpulan .= $db["label"] . " : ( " . $db["label_x"]. " ) " . $db["value"];
|
|
}
|
|
}
|
|
//echo $kesimpulan;
|
|
} elseif($da["title"] == "KEPALA WAJAH") {
|
|
//echo json_encode($da["details"]);
|
|
$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"];
|
|
}
|
|
}
|
|
//echo $kesimpulan;
|
|
|
|
if($rst_x !== ''){
|
|
if ($kesimpulan != "") $kesimpulan .= "<br/>";
|
|
$kesimpulan .= ucwords(strtolower($da["title"]))." : ".$rst_x;
|
|
}
|
|
//echo $kesimpulan;
|
|
} 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 .= $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 .= "<br/>";
|
|
$kesimpulan .= ucwords(strtolower($da["title"]))." : ".$rst_x;
|
|
}
|
|
//echo $kesimpulan;
|
|
} 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 .= $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 .= "<br/>";
|
|
$kesimpulan .= ucwords(strtolower($da["title"]))." : ".$rst_x;
|
|
}
|
|
//echo $kesimpulan;
|
|
} 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 = "Kelainan Refraksi";
|
|
$str_data .= $kelainan." ".$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 = "Kelainan Refraksi Terkoreksi";
|
|
}
|
|
else{
|
|
$kelainan = "Kelainan Refraksi";
|
|
}
|
|
if($r_ods != '')
|
|
$str_data .= $kelainan." ".$db['name']." ( ".$r_ods.")";
|
|
else
|
|
$str_data .= $kelainan." ".$db['name'];
|
|
}
|
|
$s_rst .= $str_data;
|
|
}
|
|
//echo $str_data;
|
|
|
|
}
|
|
if ($s_rst != "" ) {
|
|
if ($kesimpulan != "") $kesimpulan .= "<br/>";
|
|
$kesimpulan .= $s_rst;
|
|
}
|
|
//echo $kesimpulan;
|
|
} 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 .= "<br/>";
|
|
$kesimpulan .= ucwords(strtolower($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 .= "<br/>";
|
|
$kesimpulan .= ucwords(strtolower($da["title"]))." : ".$rst_x;
|
|
}
|
|
//echo $kesimpulan;
|
|
} 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 .= "<br/>";
|
|
$r_gigi .= "<span style='margin-left:25px'>".$v." ".join(",",$g)."</span>";
|
|
}
|
|
//print_r($arr_gigi);
|
|
//echo $r_gigi;
|
|
if ($r_gigi != "" ) {
|
|
if ($kesimpulan != "") $kesimpulan .= "<br/>";
|
|
if ($kesimpulan != "") $kesimpulan .= "Gigi<br/>";
|
|
$kesimpulan .= $r_gigi;
|
|
}
|
|
//echo $kesimpulan;
|
|
} 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 .= "<br/>";
|
|
$s_rst .= "<span style='margin-left:25px'>".$db["name"] . " : " . $s_res."</span>";
|
|
}
|
|
|
|
}
|
|
if ($s_rst != "" ) {
|
|
if ($kesimpulan != "") $kesimpulan .= "<br/>";
|
|
$kesimpulan .= "<span style='margin-left:-3px'>".ucwords(strtolower($da["title"]))." </span><br/>";
|
|
$kesimpulan .= $s_rst;
|
|
}
|
|
//echo $kesimpulan;
|
|
|
|
} 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 .= $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 .= "<br/>";
|
|
$kesimpulan .= ucwords(strtolower($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 .= "<br/>";
|
|
$kesimpulan .= ucwords(strtolower($da["title"]))." : ".$rst_x;
|
|
}
|
|
//echo $kesimpulan;
|
|
} 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 .= $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 .= "<br/>";
|
|
$kesimpulan .= ucwords(strtolower($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 .= " ( ".$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 .= "<br/>";
|
|
$s_rst .= "<span style='margin-left:25px'>".$db["name"] . " : " . $s_res."</span>";
|
|
}
|
|
|
|
}
|
|
if ($s_rst != "" ) {
|
|
if ($kesimpulan != "") $kesimpulan .= "<br/>";
|
|
$kesimpulan .= ucwords(strtolower($da["title"]))."<br/>";
|
|
$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 .= $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 .= "<br/>";
|
|
$kesimpulan .= $db["name"] . " : " . $s_res;
|
|
}
|
|
|
|
}
|
|
//echo $kesimpulan;
|
|
} 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 .= $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 .= "<br/>";
|
|
$kesimpulan .= ucwords(strtolower($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 .= "( ".$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 .= "<br/>";
|
|
$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" && $dc["label"] != 'Lain-lain' ) {
|
|
if ($s_res != "") $s_res.= ", ";
|
|
$s_res .= "( ".$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 .= "<br/>";
|
|
$kesimpulan .= $db["name"] . " : " . $s_res;
|
|
}
|
|
|
|
}
|
|
}
|
|
elseif($da["title"] == "SMELL TEST") {
|
|
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["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 .= "<br/>";
|
|
$kesimpulan .= $db["name"] . " : " . $s_res;
|
|
}
|
|
|
|
}
|
|
}
|
|
elseif($da["title"] == "LOW BACK PAIN SCREENING TEST") {
|
|
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["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 .= "<br/>";
|
|
$kesimpulan .= $db["name"] . " : " . $s_res;
|
|
}
|
|
|
|
}
|
|
//echo $kesimpulan;
|
|
}
|
|
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 .= "( ".$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 .= "<br/>";
|
|
$kesimpulan .= $db["name"] . " : " . $s_res;
|
|
}
|
|
|
|
}
|
|
|
|
//echo $kesimpulan;
|
|
|
|
|
|
|
|
|
|
}
|
|
}
|
|
if ($kesimpulan == "" ) {
|
|
$kesimpulan = "Tidak ditemukan kelainan.";
|
|
} else {
|
|
$kesimpulan = "Pada saat ini didapatkan kelainan berupa :<br/>" . $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) {
|
|
$sql = "SELECT *
|
|
FROM so_resultentry_fisik_umum
|
|
JOIN fisik_template ON So_ResultEntryFisikUmumFisikTemplateID = FisikTemplateID AND FisikTemplateIsActive = 'Y' AND FisikTemplateTitle = 'FAKTOR FISIK'
|
|
WHERE
|
|
So_ResultEntryFisikUmumSo_ResultEntryID = ? AND So_ResultEntryFisikUmumIsActive = 'Y'";
|
|
$qry = $this->db_smartone->query($sql,array($id));
|
|
if (! $qry) {
|
|
return json_encode(array());
|
|
}
|
|
$rows = $qry->result_array();
|
|
if (count($rows) == 0 ) {
|
|
return json_encode(array());
|
|
}
|
|
$d = json_decode($rows[0]["So_ResultEntryFisikUmumDetails"],true);
|
|
//keluhan saat ini
|
|
$faktor_fisik = array();
|
|
|
|
|
|
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" => $gp["label"],
|
|
"aaa2" => $gp["value_sumber"],
|
|
"aaa3" => $gp["value_lama"],
|
|
"aaa4" => $gp["chx"]
|
|
);
|
|
// }
|
|
}
|
|
|
|
}
|
|
|
|
echo json_encode($faktor_fisik);
|
|
}
|
|
|
|
function faktor_kimia($id) {
|
|
$sql = "SELECT *
|
|
FROM so_resultentry_fisik_umum
|
|
JOIN fisik_template ON So_ResultEntryFisikUmumFisikTemplateID = FisikTemplateID AND FisikTemplateIsActive = 'Y' AND FisikTemplateTitle = 'FAKTOR KIMIA'
|
|
WHERE
|
|
So_ResultEntryFisikUmumSo_ResultEntryID = ? AND So_ResultEntryFisikUmumIsActive = 'Y'";
|
|
$qry = $this->db_smartone->query($sql,array($id));
|
|
if (! $qry) {
|
|
return json_encode(array());
|
|
}
|
|
$rows = $qry->result_array();
|
|
if (count($rows) == 0 ) {
|
|
return json_encode(array());
|
|
}
|
|
$d = json_decode($rows[0]["So_ResultEntryFisikUmumDetails"],true);
|
|
//keluhan saat ini
|
|
$faktor_kimia = array();
|
|
|
|
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" => $gp["label"],
|
|
"bbb2" => $gp["value_sumber"],
|
|
"bbb3" => $gp["value_lama"],
|
|
"bbb4" => $gp["chx"]
|
|
|
|
);
|
|
// }
|
|
}
|
|
|
|
}
|
|
|
|
echo json_encode($faktor_kimia);
|
|
}
|
|
|
|
function faktor_biologi($id) {
|
|
$sql = "SELECT *
|
|
FROM so_resultentry_fisik_umum
|
|
JOIN fisik_template ON So_ResultEntryFisikUmumFisikTemplateID = FisikTemplateID AND FisikTemplateIsActive = 'Y' AND FisikTemplateTitle = 'FAKTOR BIOLOGI'
|
|
WHERE
|
|
So_ResultEntryFisikUmumSo_ResultEntryID = ? AND So_ResultEntryFisikUmumIsActive = 'Y'";
|
|
$qry = $this->db_smartone->query($sql,array($id));
|
|
if (! $qry) {
|
|
return json_encode(array());
|
|
}
|
|
$rows = $qry->result_array();
|
|
if (count($rows) == 0 ) {
|
|
return json_encode(array());
|
|
}
|
|
$d = json_decode($rows[0]["So_ResultEntryFisikUmumDetails"],true);
|
|
//keluhan saat ini
|
|
$faktor_biologi = array();
|
|
|
|
|
|
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" => $gp["label"],
|
|
"ccc2" => $gp["value_sumber"],
|
|
"ccc3" => $gp["value_lama"],
|
|
"ccc4" => $gp["chx"]
|
|
|
|
);
|
|
// }
|
|
}
|
|
|
|
}
|
|
|
|
echo json_encode($faktor_biologi);
|
|
}
|
|
|
|
function faktor_ergonomi($id) {
|
|
$sql = "SELECT *
|
|
FROM so_resultentry_fisik_umum
|
|
JOIN fisik_template ON So_ResultEntryFisikUmumFisikTemplateID = FisikTemplateID AND FisikTemplateIsActive = 'Y' AND FisikTemplateTitle = 'FAKTOR ERGONOMI'
|
|
WHERE
|
|
So_ResultEntryFisikUmumSo_ResultEntryID = ? AND So_ResultEntryFisikUmumIsActive = 'Y'";
|
|
$qry = $this->db_smartone->query($sql,array($id));
|
|
if (! $qry) {
|
|
return json_encode(array());
|
|
}
|
|
$rows = $qry->result_array();
|
|
if (count($rows) == 0 ) {
|
|
return json_encode(array());
|
|
}
|
|
$d = json_decode($rows[0]["So_ResultEntryFisikUmumDetails"],true);
|
|
//keluhan saat ini
|
|
$faktor_ergonomi = array();
|
|
|
|
|
|
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" => $gp["label"],
|
|
"ddd2" => $gp["value_sumber"],
|
|
"ddd3" => $gp["value_lama"],
|
|
"ddd4" => $gp["chx"]
|
|
|
|
);
|
|
// }
|
|
}
|
|
|
|
}
|
|
|
|
echo json_encode($faktor_ergonomi);
|
|
}
|
|
function faktor_psikologi($id) {
|
|
$sql = "SELECT *
|
|
FROM so_resultentry_fisik_umum
|
|
JOIN fisik_template ON So_ResultEntryFisikUmumFisikTemplateID = FisikTemplateID AND FisikTemplateIsActive = 'Y' AND FisikTemplateTitle = 'FAKTOR PSIKOLOGI'
|
|
WHERE
|
|
So_ResultEntryFisikUmumSo_ResultEntryID = ? AND So_ResultEntryFisikUmumIsActive = 'Y'";
|
|
$qry = $this->db_smartone->query($sql,array($id));
|
|
if (! $qry) {
|
|
return json_encode(array());
|
|
}
|
|
$rows = $qry->result_array();
|
|
if (count($rows) == 0 ) {
|
|
return json_encode(array());
|
|
}
|
|
$d = json_decode($rows[0]["So_ResultEntryFisikUmumDetails"],true);
|
|
//keluhan saat ini
|
|
$faktor_psikologi = array();
|
|
|
|
|
|
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" => $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());
|
|
}
|
|
}
|
|
}
|
|
?>
|