2047 lines
85 KiB
Plaintext
2047 lines
85 KiB
Plaintext
<?php
|
|
defined("BASEPATH") or exit("No direct script access allowed");
|
|
class Kesimpulanfisik
|
|
{
|
|
function __construct()
|
|
{
|
|
$CI = &get_instance();
|
|
$this->db_onedev = $CI->load->database("default", true);
|
|
$this->db_smartone = $CI->load->database("default", true);
|
|
}
|
|
|
|
function clean_mysqli_connection($dbc)
|
|
{
|
|
while (mysqli_more_results($dbc)) {
|
|
if (mysqli_next_result($dbc)) {
|
|
$result = mysqli_use_result($dbc);
|
|
|
|
if (get_class($result) == 'mysqli_stmt') {
|
|
mysqli_stmt_free_result($result);
|
|
} else {
|
|
unset($result);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
function get_kelainans($id_code){
|
|
$rst = [];
|
|
$sql = "SELECT Mcu_SummaryFisikID, Mcu_SummaryFisikType, Mcu_KelainanID, Mcu_KelainanName
|
|
FROM mcu_summaryfisik
|
|
JOIN mcu_kelainan ON Mcu_SummaryFisikMcu_KelainanID = Mcu_KelainanID
|
|
WHERE
|
|
? IN (Mcu_SummaryFisikIDCodes) AND Mcu_SummaryFisikIsActive = 'Y'";
|
|
$qry = $this->db_smartone->query($sql, array($id_code));
|
|
if($id_code == 'tanda_vital_5')
|
|
//echo $this->db_smartone->last_query();
|
|
if(!$qry){
|
|
echo "error get kelainan ".$id_code;
|
|
}
|
|
|
|
$rst = $qry->result_array();
|
|
|
|
return $rst;
|
|
}
|
|
|
|
function status_gizi($id) {
|
|
$sql = "SELECT *
|
|
FROM so_resultentry
|
|
LEFT JOIN t_samplingso_additional_fisik_bbtb ON So_ResultEntryT_OrderHeaderID = T_SamplingAdditionalFisikBBTBT_OrderHeaderID
|
|
WHERE
|
|
So_ResultEntryID = ? LIMIT 1";
|
|
$qry = $this->db_smartone->query($sql,array($id));
|
|
if (! $qry) {
|
|
return json_encode(array());
|
|
}
|
|
//echo $this->db_smartone->last_query();
|
|
$row_result = $qry->row_array();
|
|
//print_r($row_result);
|
|
|
|
$status_gizi = array();
|
|
$bb = $row_result["T_SamplingAdditionalFisikBBTBValueBB"];
|
|
$tb = $row_result["T_SamplingAdditionalFisikBBTBValueTB"];
|
|
$standart_bmi = $row_result["T_SamplingAdditionalFisikBBTBStandart"];
|
|
$get_bmi = $this->hitung_bmi($bb,$tb,$standart_bmi);
|
|
$bmi = $get_bmi['bmi'];
|
|
$classification = $get_bmi['class'];
|
|
|
|
$standart_text = ucwords(str_replace("_"," ",$standart_bmi));
|
|
|
|
return array('bmi' => $bmi, 'xclassification' => $classification, 'standart' => $standart_text);
|
|
}
|
|
|
|
function persepsi_warna($id) {
|
|
$sql = "SELECT IFNULL(T_SamplingAdditionalFisikBWPWValue,'') as result, IFNULL(T_SamplingAdditionalFisikBWPWVAngka,'') 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();
|
|
//keluhan saat ini
|
|
return $row_result['result'];
|
|
}
|
|
|
|
function visus($id) {
|
|
$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();
|
|
|
|
$visus = array();
|
|
$visus_kiri = "";
|
|
$visus_kanan = "";
|
|
$visus_kesimpulan = "";
|
|
$normal = array("20/20", "20/25");
|
|
$rst['kelainan'] = "Normal";
|
|
|
|
|
|
if(($row_result['T_SamplingAdditionalFisikVisusTKODV'] != "" && $row_result['T_SamplingAdditionalFisikVisusTKODV'] != "-") && ($row_result['T_SamplingAdditionalFisikVisusTKOSV'] != "" && $row_result['T_SamplingAdditionalFisikVisusTKOSV'] != "-")){
|
|
$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 != ""){
|
|
if ($visus_kesimpulan != "") $visus_kesimpulan .= ", ";
|
|
$visus_kesimpulan .= "Miopia OD";
|
|
}
|
|
|
|
$od_cyl = $row_result['T_SamplingAdditionalFisikVisusODCYL'];
|
|
if($od_cyl != ""){
|
|
if ($visus_kesimpulan != "") $visus_kesimpulan .= ", ";
|
|
$visus_kesimpulan .= "Astigmatismus OD";
|
|
}
|
|
|
|
|
|
$od_x = $row_result['T_SamplingAdditionalFisikVisusODX'];
|
|
if($od_x != "")
|
|
$value_koreksi_od .= "X (".$od_x.") ";
|
|
|
|
$od_add = $row_result['T_SamplingAdditionalFisikVisusADD'];
|
|
if($od_add != ""){
|
|
if ($visus_kesimpulan != "") $visus_kesimpulan .= ", ";
|
|
$visus_kesimpulan .= "Presbiopia OD";
|
|
}
|
|
|
|
}
|
|
|
|
if (!in_array($row_result['T_SamplingAdditionalFisikVisusTKOSV'], $normal)){
|
|
$value_koreksi_os = "";
|
|
$os_sph = $row_result['T_SamplingAdditionalFisikVisusOSSPH'];
|
|
if($os_sph != ""){
|
|
if ($visus_kesimpulan != "") $visus_kesimpulan .= ", ";
|
|
$visus_kesimpulan .= "Miopia OS";
|
|
}
|
|
|
|
|
|
$os_cyl = $row_result['T_SamplingAdditionalFisikVisusOSCYL'];
|
|
if($os_cyl != ""){
|
|
if ($visus_kesimpulan != "") $visus_kesimpulan .= ", ";
|
|
$visus_kesimpulan .= "Astigmatismus OS";
|
|
}
|
|
|
|
|
|
$os_x = $row_result['T_SamplingAdditionalFisikVisusOSX'];
|
|
if($os_x != "")
|
|
$value_koreksi_os .= "X (".$os_x.") ";
|
|
|
|
$od_add = $row_result['T_SamplingAdditionalFisikVisusADD'];
|
|
if($od_add != ""){
|
|
if ($visus_kesimpulan != "") $visus_kesimpulan .= ", ";
|
|
$visus_kesimpulan .= "Presbiopia OS";
|
|
}
|
|
|
|
|
|
}
|
|
}
|
|
|
|
if(($row_result['T_SamplingAdditionalFisikVisusDKODV'] != "" && $row_result['T_SamplingAdditionalFisikVisusDKODV'] != "-") && ($row_result['T_SamplingAdditionalFisikVisusDKOSV'] != "" && $row_result['T_SamplingAdditionalFisikVisusDKOSV'] != "-")){
|
|
$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($od_sph != ""){
|
|
if ($visus_kesimpulan != "") $visus_kesimpulan .= ", ";
|
|
$visus_kesimpulan .= "Miopia OD";
|
|
}
|
|
|
|
|
|
$od_cyl = $row_result['T_SamplingAdditionalFisikVisusODCYL'];
|
|
if($od_cyl != ""){
|
|
if ($visus_kesimpulan != "") $visus_kesimpulan .= ", ";
|
|
$visus_kesimpulan .= "Astigmatismus OD";
|
|
}
|
|
|
|
|
|
$od_x = $row_result['T_SamplingAdditionalFisikVisusODX'];
|
|
if($od_x != "")
|
|
$value_koreksi_od .= "X (".$od_x.") ";
|
|
|
|
$od_add = $row_result['T_SamplingAdditionalFisikVisusADD'];
|
|
if($od_add != ""){
|
|
if ($visus_kesimpulan != "") $visus_kesimpulan .= ", ";
|
|
$visus_kesimpulan .= "Presbiopia OD";
|
|
}
|
|
|
|
|
|
|
|
|
|
$value_koreksi_os = "";
|
|
$os_sph = $row_result['T_SamplingAdditionalFisikVisusOSSPH'];
|
|
if($os_sph != ""){
|
|
if ($visus_kesimpulan != "") $visus_kesimpulan .= ", ";
|
|
$visus_kesimpulan .= "Miopia OS";
|
|
}
|
|
|
|
$os_cyl = $row_result['T_SamplingAdditionalFisikVisusOSCYL'];
|
|
if($os_cyl != ""){
|
|
if ($visus_kesimpulan != "") $visus_kesimpulan .= ", ";
|
|
$visus_kesimpulan .= "Astigmatismus OS";
|
|
}
|
|
|
|
$os_x = $row_result['T_SamplingAdditionalFisikVisusOSX'];
|
|
if($os_x != "")
|
|
$value_koreksi_os .= "X (".$os_x.") ";
|
|
|
|
$od_add = $row_result['T_SamplingAdditionalFisikVisusADD'];
|
|
if($od_add != ""){
|
|
if ($visus_kesimpulan != "") $visus_kesimpulan .= ", ";
|
|
$visus_kesimpulan .= "Presbiopia OS";
|
|
}
|
|
|
|
|
|
}
|
|
|
|
$rst['kesimpulan'] = $visus_kesimpulan;
|
|
$rst['kelainan'] = $rst['kelainan'];
|
|
return $rst;
|
|
}
|
|
|
|
function kesimpulan($id)
|
|
{
|
|
$kesimpulan = "";
|
|
$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"
|
|
);
|
|
|
|
$rst_statusgizi = $this->status_gizi($id);
|
|
//print_r($rst_statusgizi);
|
|
if($rst_statusgizi['xclassification'] != 'Normal'){
|
|
if ($kesimpulan != "") $kesimpulan .= ", ";
|
|
$kesimpulan .= $rst_statusgizi['xclassification'] . " ( BMI : ".$rst_statusgizi['bmi']." )";
|
|
}
|
|
|
|
$rst_persepsi_warna = $this->persepsi_warna($id);
|
|
if($rst_persepsi_warna == 'BW'){
|
|
if ($kesimpulan != "") $kesimpulan .= ", ";
|
|
$kesimpulan .= "Red Green Deficiency";
|
|
}
|
|
|
|
$rst_visus = $this->visus($id);
|
|
if($rst_visus['kesimpulan'] != ''){
|
|
if ($kesimpulan != "") $kesimpulan .= ", ";
|
|
$kesimpulan .= $rst_visus['kesimpulan'];
|
|
}
|
|
|
|
$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);
|
|
}
|
|
|
|
$sexcode = $xfisiks[0]["M_PatientGender"] == 'male' ? 'L' : 'P';
|
|
|
|
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" && $db["id_code"] != 'tanda_vital_5' ) {
|
|
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"] != 'NORMAL' && $db["value"] != 'OPTIMAL' && $db['value'] != 'HIGH NORMAL') {
|
|
if ($kesimpulan != "") $kesimpulan .= ", ";
|
|
$kesimpulan .= $db["label"] . " " . $db["value_x"] . "/" . $db["value_y"]." " . $db["unit"] . " ( " . ucwords(strtolower($db["value"])) . " )";
|
|
}
|
|
|
|
|
|
|
|
}
|
|
}/* elseif ($da["title"] == "STATUS GIZI") {
|
|
$bmi_value = "";
|
|
|
|
foreach ($da["details"] as $db) {
|
|
|
|
if ($db["id_code"] == "status_gizi_4") $bmi_value = $db["value"];
|
|
if ($db["chx_x"] == "1") {
|
|
if ($kesimpulan != "") $kesimpulan .= ", ";
|
|
$kesimpulan .= $db["label"] . " " . $db["label_x"];
|
|
}
|
|
if (($db["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"] == "LAPANG PANDANG") {
|
|
foreach($da["details"] as $gp) {
|
|
if ($gp["chx_x"] == "1"){
|
|
$keterangan = "";
|
|
if($gp['value'] != "")
|
|
$keterangan = " ( ".$gp['value']." )";
|
|
|
|
if ($kesimpulan != "") $kesimpulan .= ", ";
|
|
$kesimpulan .= ucwords(strtolower($da["title"]))." : ".$gp["label_x"] .$keterangan;
|
|
|
|
}
|
|
}
|
|
|
|
//echo $kesimpulan;
|
|
}
|
|
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) {
|
|
//print_r($dc);
|
|
if ($dc['chx'] == '1' && $dc['segment_name'] == 'Tanpa kacamata' && ($dc['value'] != '' && $dc['value'] != '20/20')) {
|
|
$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'] != '20/20')
|
|
$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". " " . strtolower($db['name']);
|
|
$str_data .= $kelainan . " ( " . $r_ods . ")";
|
|
}
|
|
if ($db['name'] == 'Dengan kacamata') {
|
|
$all66 = true;
|
|
foreach ($xr_ods as $xd => $xv) {
|
|
if ($xv != '20/20') {
|
|
$all66 = false;
|
|
}
|
|
}
|
|
if ($all66) {
|
|
$kelainan = "Kelainan refraksi terkoreksi". " " . strtolower($db['name']) ;
|
|
} else {
|
|
$kelainan = "Kelainan refraksi". " " . strtolower($db['name']) ;
|
|
}
|
|
if ($r_ods != '')
|
|
$str_data .= $kelainan . " ( " . $r_ods . ")";
|
|
else
|
|
$str_data .= $kelainan;
|
|
}
|
|
$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") {
|
|
$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"] == "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["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["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") {
|
|
$s_res = "";
|
|
$rst_x = '';
|
|
foreach($da["details"] as $gp) {
|
|
if($gp["name"] != 'Hernia' && $gp["name"] != 'Pengukuran' ){
|
|
foreach($gp["details"] as $xd) {
|
|
if ($xd["chx"] == 1 && $xd["is_normal"] == "N" && $xd["label"] != 'Lain-lain' && $xd['label'] != 'Tidak Ada'){
|
|
$arr_result[] = array($gp["name"],$xd["label"],$xd["value"]) ;
|
|
if ($rst_x != "") $rst_x .= ", ";
|
|
$rst_x .= $gp["name"]." : ".$db["label"] . " " . $db["value"];
|
|
|
|
if ($s_res != "") $s_res .= ", ";
|
|
$s_res .= $xd["label"] . " " . $xd["value"];
|
|
}
|
|
|
|
if ($xd["label"] == 'Lain-lain' && $xd["chx"] == "1") {
|
|
if ($s_res != "") $s_res .= ", ";
|
|
$s_res .= $xd["value"];
|
|
}
|
|
|
|
|
|
}
|
|
}elseif($gp["name"] == 'Hernia') {
|
|
//print_r($gp["details"][1]);
|
|
if($gp["details"][1]["chx"] == 1){
|
|
$hasil = $gp["details"][1]["value"];
|
|
$hasil_detail = "";
|
|
//print_r($gp["details"][1]);
|
|
if($gp["details"][1]["details"][0]["chx_value"] == 1){
|
|
if($hasil_detail != "") $hasil_detail .= ", ";
|
|
$hasil_detail .= " ".$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($hasil_detail != "") $hasil_detail .= ", ";
|
|
$hasil_detail .= " ".$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($hasil_detail != "") $hasil_detail .= ", ";
|
|
$hasil_detail .= " ".$gp["details"][1]["details"][2]["label"]." (".$ds_hasil.")";
|
|
}
|
|
|
|
if ($rst_x != "") $rst_x .= ", ";
|
|
$rst_x .= $gp["name"]." : ".$gp["details"][1]["label"] . " " . $hasil.$hasil_detail ;
|
|
|
|
if ($s_res != "") $s_res .= ", ";
|
|
$s_res .= $gp["name"]." : ".$gp["details"][1]["label"] . " " . $hasil.$hasil_detail ;
|
|
}
|
|
|
|
|
|
|
|
}
|
|
elseif($gp["name"] == 'Pengukuran' ){
|
|
$perut[] = array(
|
|
"mm1" => $gp["name"],
|
|
"mm2" => $gp["details"][0]["label"]." : ".$gp["details"][0]["value"]." ".$gp["details"][0]["unit"],
|
|
"mm3" => $gp["details"][1]["label"]." : ".$gp["details"][1]["value"]." ".$gp["details"][1]["unit"]
|
|
);
|
|
if ($rst_x != "") $rst_x .= ", ";{
|
|
$rst_x .= $gp["details"][0]["label"]." : ".$gp["details"][0]["value"]." ".$gp["details"][0]["unit"] ;
|
|
$rst_x .= $gp["details"][1]["label"]." : ".$gp["details"][1]["value"]." ".$gp["details"][1]["unit"] ;
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
if ($s_res != "") {
|
|
if ($kesimpulan != "") $kesimpulan .= "<br/>";
|
|
$kesimpulan .= ucwords(strtolower($da["title"])) . "<br/>";
|
|
$kesimpulan .= $s_res;
|
|
}
|
|
|
|
//echo $kesimpulan;
|
|
}
|
|
/*elseif ($da["title"] == "PERUT / ABDOMEN") {
|
|
foreach ($da["details"] as $db) {
|
|
$s_res = "";
|
|
if($db['name'] != 'Hernia' ){
|
|
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"];
|
|
}
|
|
}
|
|
}else{
|
|
foreach ($db["details"] as $dc) {
|
|
if ($dc["chx"] == "1" && $dc["is_normal"] == "N" && $dc["label"] != 'Lain-lain' && $dc['label'] != 'Tidak Ada') {
|
|
|
|
$regio_value = "";
|
|
|
|
foreach ($dc['details'] as $k_regio => $v_regio) {
|
|
if($v_regio['chx_a_value'] == "1" || $v_regio['chx_b_value'] == "1"){
|
|
$check_regio = "";
|
|
if($v_regio['chx_a_value'] == "1"){
|
|
if ($check_regio != "") $check_regio .= ", ";
|
|
$check_regio .= $v_regio['chx_a_label'];
|
|
}
|
|
if($v_regio['chx_b_value'] == "1"){
|
|
if ($check_regio != "") $check_regio .= ", ";
|
|
$check_regio .= $v_regio['chx_b_label'];
|
|
}
|
|
|
|
if ($regio_value != "") $regio_value .= ", ";
|
|
$regio_value .= $v_regio['label']. " (".$check_regio.")" ;
|
|
}
|
|
}
|
|
|
|
if ($s_res != "") $s_res .= ", ";
|
|
$s_res .= $regio_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 insert_t_kelainan_fisik($kelainans,$order_header_id,$re_id){
|
|
|
|
foreach ($kelainans as $key => $value) {
|
|
|
|
$sql = "UPDATE t_kelainan_fisik SET T_KelainanFiskIsActive = 'N' WHERE T_KelainanFiskSo_ResultEntryID = ? AND T_KelainanFiskMcu_SummaryFisikID = ?";
|
|
$qry = $this->db_smartone->query($sql, array($re_id, $value['Mcu_SummaryFisikID']));
|
|
|
|
$sql = "INSERT INTO t_kelainan_fisik (
|
|
T_KelainanFiskSo_ResultEntryID,
|
|
T_KelainanFiskT_OrderHeaderID,
|
|
T_KelainanFiskMcu_SummaryFisikID,
|
|
T_KelainanLabNonCreated
|
|
)
|
|
VALUES (
|
|
?,?,?,NOW()
|
|
)";
|
|
|
|
$qry = $this->db_smartone->query($sql, array($re_id, $order_header_id, $value['Mcu_SummaryFisikID']));
|
|
}
|
|
|
|
}
|
|
|
|
function hitung_bmi($bb,$tb,$standart_bmi){
|
|
$tb = $tb/100;
|
|
$bmi = '';
|
|
$classs = "";
|
|
$bmi_valuex= 0;
|
|
if(intval($bb) != 0 && intval($tb) != 0){
|
|
$bmi = $bb / ($tb * $tb);
|
|
$bmi_valuex = number_format($bmi,2);
|
|
|
|
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 generate_all_kelainan_fisik($mgm_mcuid,$limit){
|
|
$sql = "SELECT *
|
|
FROM so_resultentry
|
|
JOIN t_orderheader ON So_ResultEntryT_OrderHeaderID = T_OrderHeaderID AND T_OrderHeaderIsActive = 'Y' AND
|
|
T_OrderHeaderMgm_McuID = ?
|
|
WHERE
|
|
So_ResultEntryNonlab_TemplateID = 27 AND So_ResultEntryIsActive = 'Y'
|
|
LIMIT ?";
|
|
$qry = $this->db_smartone->query($sql, array($mgm_mcuid,intval($limit)));
|
|
// echo $this->db_smartone->last_query();
|
|
$datas = $qry->result_array();
|
|
if($datas && count($datas) > 0){
|
|
foreach ($datas as $key => $value) {
|
|
$this->generate_kelainan_fisik($value['So_ResultEntryID']);
|
|
}
|
|
}
|
|
}
|
|
|
|
function generate_kelainan_fisik($id)
|
|
{
|
|
$kesimpulan = "";
|
|
$all_kelainans = [];
|
|
|
|
$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
|
|
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();
|
|
$order_header_id = $xriwayats[0]['So_ResultEntryT_OrderHeaderID'];
|
|
$re_id = $xriwayats[0]['So_ResultEntryID'];
|
|
$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"];
|
|
}
|
|
}
|
|
}elseif ($riwayat_da["title"] == "RIWAYAT KEBIASAAN HIDUP") {
|
|
$rst_x = '';
|
|
foreach ($riwayat_da["details"] as $db) {
|
|
foreach ($db['details'] as $dc) {
|
|
$rows_summary = $this->get_kelainans($dc["id_code"]);
|
|
if(count($rows_summary) > 0){
|
|
$kelainans = [];
|
|
foreach ($rows_summary as $key => $value) {
|
|
if($value['Mcu_SummaryFisikType'] == 'C' && $dc["chx"] == "1"){
|
|
$kelainans[] = $value;
|
|
$all_kelainans[] = $value;
|
|
}
|
|
}
|
|
|
|
if(count($kelainans) > 0){
|
|
$this->insert_t_kelainan_fisik($kelainans,$order_header_id,$re_id);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
$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();
|
|
$order_header_id = $xfisiks[0]['So_ResultEntryT_OrderHeaderID'];
|
|
$re_id = $xfisiks[0]['So_ResultEntryID'];
|
|
$fisik_data = [];
|
|
foreach ($xfisiks as $kex => $valux) {
|
|
$fisik_data[] = json_decode($valux['So_ResultEntryFisikUmumDetails'], true);
|
|
}
|
|
//print_r($fisik_data);
|
|
|
|
$sexcode = $xfisiks[0]["M_PatientGender"] == 'male' ? 'L' : 'P';
|
|
|
|
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" && $db["id_code"] != 'tanda_vital_5') {
|
|
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"] != 'NORMAL' && $db["value"] != 'OPTIMAL' && $db['value'] != 'HIGH NORMAL') {
|
|
if ($kesimpulan != "") $kesimpulan .= ", ";
|
|
$kesimpulan .= $db["label"] . " " . $db["value_x"] . "/" . $db["value_y"]." " . $db["unit"] . " ( " . ucwords(strtolower($db["value"])) . " )";
|
|
}
|
|
|
|
//echo $db['value']." - ";
|
|
//echo $db["id_code"];
|
|
$rows_summary = $this->get_kelainans($db["id_code"]);
|
|
//print_r($rows_summary);
|
|
if(count($rows_summary) > 0){
|
|
$kelainans = [];
|
|
foreach ($rows_summary as $key => $value) {
|
|
$val = strtolower($db['value']);
|
|
$val = str_replace("stadium","stage",$val);
|
|
if($value['Mcu_SummaryFisikType'] == 'SD'){
|
|
if(strtolower($value['Mcu_KelainanName']) == $val){
|
|
$kelainans[] = $value;
|
|
$all_kelainans[] = $value;
|
|
|
|
}
|
|
}
|
|
}
|
|
|
|
if(count($kelainans) > 0){
|
|
$this->insert_t_kelainan_fisik($kelainans,$order_header_id,$re_id);
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
} 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 )";
|
|
}
|
|
}
|
|
|
|
$rows_summary = $this->get_kelainans($db["id_code"]);
|
|
if(count($rows_summary) > 0){
|
|
$kelainans = [];
|
|
foreach ($rows_summary as $key => $value) {
|
|
if($value['Mcu_SummaryFisikType'] == 'SD'){
|
|
if($value['Mcu_KelainanName'] == $db['value']){
|
|
$kelainans[] = $value;
|
|
$all_kelainans[] = $value;
|
|
}
|
|
}
|
|
}
|
|
|
|
if(count($kelainans) > 0){
|
|
$this->insert_t_kelainan_fisik($kelainans,$order_header_id,$re_id);
|
|
}
|
|
|
|
}
|
|
}
|
|
} 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"];
|
|
}
|
|
|
|
$rows_summary = $this->get_kelainans($db["id_code"]);
|
|
if(count($rows_summary) > 0){
|
|
$kelainans = [];
|
|
foreach ($rows_summary as $key => $value) {
|
|
if($value['Mcu_SummaryFisikType'] == 'C'){
|
|
if($db["chx"] == "1"){
|
|
$kelainans[] = $value;
|
|
$all_kelainans[] = $value;
|
|
}
|
|
}
|
|
}
|
|
|
|
if(count($kelainans) > 0){
|
|
$this->insert_t_kelainan_fisik($kelainans,$order_header_id,$re_id);
|
|
}
|
|
}
|
|
}
|
|
|
|
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'] != '20/20')) {
|
|
$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'] != '20/20')
|
|
$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". " " . strtolower($db['name']);
|
|
$str_data .= $kelainan . " ( " . $r_ods . ")";
|
|
}
|
|
if ($db['name'] == 'Dengan kacamata') {
|
|
$all66 = true;
|
|
foreach ($xr_ods as $xd => $xv) {
|
|
if ($xv != '20/20') {
|
|
$all66 = false;
|
|
}
|
|
}
|
|
if ($all66) {
|
|
$kelainan = "Kelainan refraksi terkoreksi". " " . strtolower($db['name']) ;
|
|
} else {
|
|
$kelainan = "Kelainan refraksi". " " . strtolower($db['name']) ;
|
|
}
|
|
if ($r_ods != '')
|
|
$str_data .= $kelainan . " ( " . $r_ods . ")";
|
|
else
|
|
$str_data .= $kelainan;
|
|
}
|
|
$s_rst .= $str_data;
|
|
|
|
$rows_summary = $this->get_kelainans($db["id_code"]);
|
|
if(count($rows_summary) > 0){
|
|
$kelainans = [];
|
|
foreach ($rows_summary as $key => $value) {
|
|
if($value['Mcu_SummaryFisikType'] == 'SD'){
|
|
if($value['Mcu_KelainanName'] == $kelainan){
|
|
$kelainans[] = $value;
|
|
$all_kelainans[] = $value;
|
|
}
|
|
}
|
|
}
|
|
|
|
if(count($kelainans) > 0){
|
|
$this->insert_t_kelainan_fisik($kelainans,$order_header_id,$re_id);
|
|
}
|
|
|
|
}
|
|
}
|
|
//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"];
|
|
}
|
|
|
|
$rows_summary = $this->get_kelainans($db["id_code"]);
|
|
if(count($rows_summary) > 0){
|
|
$kelainans = [];
|
|
foreach ($rows_summary as $key => $value) {
|
|
if($value['Mcu_SummaryFisikType'] == 'C' && $db["chx"] == "1"){
|
|
$kelainans[] = $value;
|
|
$all_kelainans[] = $value;
|
|
}
|
|
}
|
|
|
|
if(count($kelainans) > 0){
|
|
$this->insert_t_kelainan_fisik($kelainans,$order_header_id,$re_id);
|
|
}
|
|
}
|
|
}
|
|
|
|
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"];
|
|
}
|
|
|
|
$rows_summary = $this->get_kelainans($db["id_code"]);
|
|
if(count($rows_summary) > 0){
|
|
$kelainans = [];
|
|
foreach ($rows_summary as $key => $value) {
|
|
if($value['Mcu_SummaryFisikType'] == 'C' && $db["chx"] == "1"){
|
|
$kelainans[] = $value;
|
|
$all_kelainans[] = $value;
|
|
}
|
|
}
|
|
|
|
if(count($kelainans) > 0){
|
|
$this->insert_t_kelainan_fisik($kelainans,$order_header_id,$re_id);
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
if ($rst_x !== '') {
|
|
if ($kesimpulan != "") $kesimpulan .= "<br/>";
|
|
$kesimpulan .= ucwords(strtolower($da["title"])) . " : " . $rst_x;
|
|
}
|
|
//echo $kesimpulan;
|
|
}
|
|
elseif ($da["title"] == "GIGI") {
|
|
$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"];
|
|
}
|
|
|
|
$rows_summary = $this->get_kelainans($db["id_code"]);
|
|
if(count($rows_summary) > 0){
|
|
$kelainans = [];
|
|
foreach ($rows_summary as $key => $value) {
|
|
if($value['Mcu_SummaryFisikType'] == 'CSD' && $db["chx"] == "1"){
|
|
if($value['Mcu_KelainanName'] == $db["label"]){
|
|
$kelainans[] = $value;
|
|
$all_kelainans[] = $value;
|
|
}
|
|
}
|
|
}
|
|
|
|
if(count($kelainans) > 0){
|
|
$this->insert_t_kelainan_fisik($kelainans,$order_header_id,$re_id);
|
|
}
|
|
}
|
|
}
|
|
|
|
if ($rst_x !== '') {
|
|
if ($kesimpulan != "") $kesimpulan .= "<br/>";
|
|
$kesimpulan .= ucwords(strtolower($da["title"])) . " : " . $rst_x;
|
|
}
|
|
//echo $kesimpulan;
|
|
} elseif ($da["title"] == "MULUT") {
|
|
$s_rst = '';
|
|
foreach ($da["details"] as $db) {
|
|
$s_res = "";
|
|
foreach ($db["details"] as $dc) {
|
|
// print_r($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"];
|
|
}
|
|
|
|
$rows_summary = $this->get_kelainans($dc["id_code"]);
|
|
if(count($rows_summary) > 0){
|
|
$kelainans = [];
|
|
foreach ($rows_summary as $key => $value) {
|
|
if($value['Mcu_SummaryFisikType'] == 'C' && $dc["chx"] == "1"){
|
|
$kelainans[] = $value;
|
|
$all_kelainans[] = $value;
|
|
}
|
|
}
|
|
|
|
if(count($kelainans) > 0){
|
|
$this->insert_t_kelainan_fisik($kelainans,$order_header_id,$re_id);
|
|
}
|
|
}
|
|
}
|
|
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"];
|
|
}
|
|
|
|
$rows_summary = $this->get_kelainans($dc["id_code"]);
|
|
if(count($rows_summary) > 0){
|
|
$kelainans = [];
|
|
foreach ($rows_summary as $key => $value) {
|
|
if($value['Mcu_SummaryFisikType'] == 'C' && $dc["chx"] == "1"){
|
|
$kelainans[] = $value;
|
|
$all_kelainans[] = $value;
|
|
}
|
|
}
|
|
|
|
if(count($kelainans) > 0){
|
|
$this->insert_t_kelainan_fisik($kelainans,$order_header_id,$re_id);
|
|
}
|
|
}
|
|
}
|
|
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") {
|
|
|
|
$rst_x = '';
|
|
foreach($da["details"] as $gp) {
|
|
if($gp["name"] != 'Hernia' && $gp["name"] != 'Pengukuran' ){
|
|
foreach($gp["details"] as $xd) {
|
|
if ($xd["chx"] == 1 ){
|
|
$arr_result[] = array($gp["name"],$xd["label"],$xd["value"]) ;
|
|
if ($rst_x != "") $rst_x .= ", ";
|
|
$rst_x .= $gp["name"]." : ".$xd["label"] . " " . $xd["value"];
|
|
|
|
}
|
|
|
|
$rows_summary = $this->get_kelainans($xd["id_code"]);
|
|
if(count($rows_summary) > 0){
|
|
$kelainans = [];
|
|
foreach ($rows_summary as $key => $value) {
|
|
if($value['Mcu_SummaryFisikType'] == 'C' && $xd["chx"] == "1"){
|
|
$kelainans[] = $value;
|
|
$all_kelainans[] = $value;
|
|
}
|
|
}
|
|
|
|
if(count($kelainans) > 0){
|
|
$this->insert_t_kelainan_fisik($kelainans,$order_header_id,$re_id);
|
|
}
|
|
}
|
|
}
|
|
}elseif($gp["name"] == 'Hernia') {
|
|
//print_r($gp["details"][1]);
|
|
if($gp["details"][1]["chx"] == 1){
|
|
$hasil = $gp["details"][1]["value"];
|
|
$hasil_detail = "";
|
|
//print_r($gp["details"][1]);
|
|
if($gp["details"][1]["details"][0]["chx_value"] == 1){
|
|
if($hasil_detail != "") $hasil_detail .= ", ";
|
|
$hasil_detail .= " ".$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($hasil_detail != "") $hasil_detail .= ", ";
|
|
$hasil_detail .= " ".$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($hasil_detail != "") $hasil_detail .= ", ";
|
|
$hasil_detail .= " ".$gp["details"][1]["details"][2]["label"]." (".$ds_hasil.")";
|
|
}
|
|
|
|
if ($rst_x != "") $rst_x .= ", ";
|
|
$rst_x .= $gp["name"]." : ".$gp["details"][1]["label"] . " " . $hasil.$hasil_detail ;
|
|
|
|
$rows_summary = $this->get_kelainans($gp["details"][1]["id_code"]);
|
|
if(count($rows_summary) > 0){
|
|
$kelainans = [];
|
|
foreach ($rows_summary as $key => $value) {
|
|
if($value['Mcu_SummaryFisikType'] == 'C' && $gp["details"][1]["chx"] == "1"){
|
|
$kelainans[] = $value;
|
|
$all_kelainans[] = $value;
|
|
}
|
|
}
|
|
|
|
if(count($kelainans) > 0){
|
|
$this->insert_t_kelainan_fisik($kelainans,$order_header_id,$re_id);
|
|
}
|
|
}
|
|
}
|
|
|
|
if($gp["details"][0]["chx"] == 1){
|
|
if ($rst_x != "") $rst_x .= ", ";
|
|
$rst_x .= $gp["name"]." : ".$gp["details"][0]["label"];
|
|
|
|
$rows_summary = $this->get_kelainans($gp["details"][0]["id_code"]);
|
|
if(count($rows_summary) > 0){
|
|
$kelainans = [];
|
|
foreach ($rows_summary as $key => $value) {
|
|
if($value['Mcu_SummaryFisikType'] == 'C' && $gp["details"][0]["chx"] == "1"){
|
|
$kelainans[] = $value;
|
|
$all_kelainans[] = $value;
|
|
}
|
|
}
|
|
|
|
if(count($kelainans) > 0){
|
|
$this->insert_t_kelainan_fisik($kelainans,$order_header_id,$re_id);
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|
|
elseif($gp["name"] == 'Pengukuran' ){
|
|
$perut[] = array(
|
|
"mm1" => $gp["name"],
|
|
"mm2" => $gp["details"][0]["label"]." : ".$gp["details"][0]["value"]." ".$gp["details"][0]["unit"],
|
|
"mm3" => $gp["details"][1]["label"]." : ".$gp["details"][1]["value"]." ".$gp["details"][1]["unit"]
|
|
);
|
|
if ($rst_x != "") $rst_x .= ", ";{
|
|
$rst_x .= $gp["details"][0]["label"]." : ".$gp["details"][0]["value"]." ".$gp["details"][0]["unit"] ;
|
|
$rst_x .= $gp["details"][1]["label"]." : ".$gp["details"][1]["value"]." ".$gp["details"][1]["unit"] ;
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//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"];
|
|
}
|
|
|
|
$rows_summary = $this->get_kelainans($dc["id_code"]);
|
|
if(count($rows_summary) > 0){
|
|
$kelainans = [];
|
|
foreach ($rows_summary as $key => $value) {
|
|
if($value['Mcu_SummaryFisikType'] == 'C' && $dc["chx"] == "1"){
|
|
$kelainans[] = $value;
|
|
$all_kelainans[] = $value;
|
|
}
|
|
}
|
|
|
|
if(count($kelainans) > 0){
|
|
$this->insert_t_kelainan_fisik($kelainans,$order_header_id,$re_id);
|
|
}
|
|
}
|
|
}
|
|
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"];
|
|
}
|
|
|
|
$rows_summary = $this->get_kelainans($dc["id_code"]);
|
|
if(count($rows_summary) > 0){
|
|
$kelainans = [];
|
|
foreach ($rows_summary as $key => $value) {
|
|
if($value['Mcu_SummaryFisikType'] == 'C' && $dc["chx"] == "1"){
|
|
$kelainans[] = $value;
|
|
$all_kelainans[] = $value;
|
|
}
|
|
}
|
|
|
|
if(count($kelainans) > 0){
|
|
$this->insert_t_kelainan_fisik($kelainans,$order_header_id,$re_id);
|
|
}
|
|
}
|
|
}
|
|
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"];
|
|
}
|
|
|
|
$rows_summary = $this->get_kelainans($dc["id_code"]);
|
|
if(count($rows_summary) > 0){
|
|
$kelainans = [];
|
|
foreach ($rows_summary as $key => $value) {
|
|
if($value['Mcu_SummaryFisikType'] == 'C' && $dc["chx"] == "1"){
|
|
$kelainans[] = $value;
|
|
$all_kelainans[] = $value;
|
|
}
|
|
}
|
|
|
|
if(count($kelainans) > 0){
|
|
$this->insert_t_kelainan_fisik($kelainans,$order_header_id,$re_id);
|
|
}
|
|
}
|
|
}
|
|
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"];
|
|
}
|
|
|
|
$rows_summary = $this->get_kelainans($dc["id_code"]);
|
|
if(count($rows_summary) > 0){
|
|
$kelainans = [];
|
|
foreach ($rows_summary as $key => $value) {
|
|
if($value['Mcu_SummaryFisikType'] == 'C' && $dc["chx"] == "1"){
|
|
$kelainans[] = $value;
|
|
$all_kelainans[] = $value;
|
|
}
|
|
}
|
|
|
|
if(count($kelainans) > 0){
|
|
$this->insert_t_kelainan_fisik($kelainans,$order_header_id,$re_id);
|
|
}
|
|
}
|
|
}
|
|
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"];
|
|
}
|
|
|
|
$rows_summary = $this->get_kelainans($dc["id_code"]);
|
|
if(count($rows_summary) > 0){
|
|
$kelainans = [];
|
|
foreach ($rows_summary as $key => $value) {
|
|
if($value['Mcu_SummaryFisikType'] == 'C' && $dc["chx"] == "1"){
|
|
$kelainans[] = $value;
|
|
$all_kelainans[] = $value;
|
|
}
|
|
}
|
|
|
|
if(count($kelainans) > 0){
|
|
$this->insert_t_kelainan_fisik($kelainans,$order_header_id,$re_id);
|
|
}
|
|
}
|
|
}
|
|
if ($s_res != "") {
|
|
if ($kesimpulan != "") $kesimpulan .= "<br/>";
|
|
$kesimpulan .= $db["name"] . " : " . $s_res;
|
|
}
|
|
}
|
|
|
|
//echo $kesimpulan;
|
|
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
$rst_statusgizi = $this->status_gizi($id);
|
|
//print_r($rst_statusgizi);
|
|
$rows_summary = $this->get_kelainans("status_gizi_6");
|
|
if(count($rows_summary) > 0){
|
|
$kelainans = [];
|
|
foreach ($rows_summary as $key => $value) {
|
|
if($value['Mcu_SummaryFisikType'] == 'SD'){
|
|
if($value['Mcu_KelainanName'] == $rst_statusgizi['xclassification']){
|
|
$kelainans[] = $value;
|
|
$all_kelainans[] = $value;
|
|
}
|
|
}
|
|
}
|
|
|
|
if(count($kelainans) > 0){
|
|
$this->insert_t_kelainan_fisik($kelainans,$order_header_id,$re_id);
|
|
}
|
|
}
|
|
|
|
$rst_persepsi_warna = $this->persepsi_warna($id);
|
|
$rows_summary = $this->get_kelainans("persepsi_warna_3");
|
|
$persepsi_warna_hasil = "Normal";
|
|
if($rst_persepsi_warna == 'BW'){
|
|
$persepsi_warna_hasil = "Red Green Deficiency";
|
|
}
|
|
|
|
if(count($rows_summary) > 0){
|
|
$kelainans = [];
|
|
foreach ($rows_summary as $key => $value) {
|
|
if($value['Mcu_SummaryFisikType'] == 'SD'){
|
|
if($value['Mcu_KelainanName'] == $persepsi_warna_hasil){
|
|
$kelainans[] = $value;
|
|
$all_kelainans[] = $value;
|
|
}
|
|
}
|
|
}
|
|
|
|
if(count($kelainans) > 0){
|
|
$this->insert_t_kelainan_fisik($kelainans,$order_header_id,$re_id);
|
|
}
|
|
}
|
|
|
|
$rows_summary = $this->get_kelainans("visus");
|
|
$rst_visus = $this->visus($id);
|
|
//print_r($rst_visus);
|
|
//echo $rst_visus['kelainan'];
|
|
|
|
if(count($rows_summary) > 0){
|
|
$kelainans = [];
|
|
foreach ($rows_summary as $key => $value) {
|
|
if($value['Mcu_SummaryFisikType'] == 'SD'){
|
|
if($value['Mcu_KelainanName'] == $rst_visus['kelainan']){
|
|
$kelainans[] = $value;
|
|
$all_kelainans[] = $value;
|
|
}
|
|
}
|
|
}
|
|
|
|
if(count($kelainans) > 0){
|
|
$this->insert_t_kelainan_fisik($kelainans,$order_header_id,$re_id);
|
|
}
|
|
}
|
|
|
|
return $all_kelainans;
|
|
}
|
|
}
|