2716 lines
101 KiB
PHP
2716 lines
101 KiB
PHP
<?php
|
|
defined("BASEPATH") or exit("No direct script access allowed");
|
|
class Mcuresult
|
|
{
|
|
function __construct()
|
|
{
|
|
$CI = &get_instance();
|
|
|
|
$this->db = $CI->load->database("default", true);
|
|
$this->db_smartone = $CI->load->database("default", true);
|
|
$this->db_corporate = $CI->load->database("cpone_corporate", true);
|
|
$this->db_log = $CI->load->database("log", 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 translate_word($word,$langid=1){
|
|
if($langid == 1){
|
|
return $word;
|
|
}
|
|
else{
|
|
$sql = "SELECT * FROM translate_word WHERE Translate_WordIsActive = 'Y' AND Translate_WordFrom = '{$word}'";
|
|
//echo $sql;
|
|
$qry = $this->db_smartone->query($sql);
|
|
if (! $qry) {
|
|
return $word;
|
|
}
|
|
|
|
$rows = $qry->result_array();
|
|
if(count($rows) > 0){
|
|
return $rows[0]["Translate_WordTo"];
|
|
}else{
|
|
return $word;
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
function generate_result_fisik($so_result_id = 0){
|
|
$this->db_log->trans_begin();
|
|
|
|
if($so_result_id == 0){
|
|
$results = array("status" => "error", "message" => "So_ResultEntryID is required", "data" => array());
|
|
return $results;
|
|
}
|
|
|
|
$sql = "SELECT T_OrderHeaderMgm_McuID as Mgm_McuID,
|
|
T_OrderHeaderID as T_OrderHeaderID,
|
|
T_OrderHeaderLabNumber as T_OrderHeaderLabNumber,
|
|
So_ResultEntryID as ReffID,
|
|
T_TestSasCode as T_TestCode,
|
|
T_TestName as T_TestName,
|
|
'' as Result,
|
|
'' as UnitName,
|
|
'' as refference
|
|
FROM so_resultentry
|
|
JOIN t_orderdetail ON So_ResultEntryT_OrderDetailID = T_OrderDetailID AND T_OrderDetailIsActive = 'Y'
|
|
JOIN t_orderheader ON T_OrderDetailT_OrderHeaderID = T_OrderHeaderID AND T_OrderHeaderIsActive = 'Y'
|
|
JOIN t_test ON T_OrderDetailT_TestID = T_TestID AND T_TestIsActive = 'Y'
|
|
WHERE
|
|
So_ResultEntryIsActive = 'Y' AND
|
|
So_ResultEntrySo_ResultEntryID = ? AND So_ResultEntryStatus <> 'NEW' AND
|
|
So_ResultEntryNonlab_TemplateID = 27";
|
|
$query = $this->db->query($sql, [$so_result_id]);
|
|
if(!$query){
|
|
$this->sys_error_db("select so_resultentry", $this->db);
|
|
}
|
|
$result = $query->result_array();
|
|
if(count($result) == 0){
|
|
$results = array("status" => "error", "message" => "No data found", "data" => array());
|
|
return $results;
|
|
}
|
|
|
|
$result = $result[0];
|
|
$mgm_mcuID = $result['Mgm_McuID'];
|
|
$T_OrderHeaderID = $result['T_OrderHeaderID'];
|
|
$T_OrderHeaderLabNumber = $result['T_OrderHeaderLabNumber'];
|
|
$ReffID = $result['ReffID'];
|
|
|
|
$sql = "DELETE FROM mcu_result_all WHERE
|
|
Mcu_ResultAllMgm_McuID = ? AND
|
|
Mcu_ResultAllT_OrderHeaderID = ? AND
|
|
Mcu_ResultAllT_OrderHeaderLabNumber = ? AND
|
|
Mcu_ResultAllReffID = ? AND
|
|
Mcu_ResultAllT_TestCode = ? AND
|
|
Mcu_ResultAllT_TestName = ?";
|
|
$query = $this->db_log->query($sql, [$mgm_mcuID, $T_OrderHeaderID, $T_OrderHeaderLabNumber, $ReffID, $T_TestCode, $T_TestName]);
|
|
if(!$query){
|
|
$this->sys_error_db("delete mcu_result_all", $this->db_log);
|
|
exit;
|
|
}
|
|
|
|
$sql = "INSERT INTO mcu_result_all (
|
|
Mcu_ResultAllMgm_McuID,
|
|
Mcu_ResultAllT_OrderHeaderID,
|
|
Mcu_ResultAllT_OrderHeaderLabNumber,
|
|
Mcu_ResultAllReffID,
|
|
Mcu_ResultAllT_TestCode,
|
|
Mcu_ResultAllT_TestName,
|
|
Mcu_ResultAllResult,
|
|
Mcu_ResultAllUnit,
|
|
Mcu_ResultAllRefference,
|
|
Mcu_ResultAllCreated
|
|
) VALUES (?,?,?,?,?,?,?,?,?,NOW())";
|
|
$query = $this->db_log->query($sql, [
|
|
$mgm_mcuID,
|
|
$T_OrderHeaderID,
|
|
$T_OrderHeaderLabNumber,
|
|
$result['ReffID'],
|
|
$result['T_TestCode'],
|
|
$result['T_TestName'],
|
|
$result['Result'],
|
|
$result['UnitName'],
|
|
$result['refference']
|
|
]);
|
|
if(!$query){
|
|
$this->db_log->trans_rollback();
|
|
$results = array("status" => "error", "message" => "Failed to insert mcu_result_all", "data" => array());
|
|
return $results;
|
|
}
|
|
|
|
|
|
|
|
$this->db_log->trans_commit();
|
|
|
|
$results = array("status" => "success", "message" => "Data generated successfully", "data" => $result);
|
|
return $results;
|
|
|
|
}
|
|
|
|
function generate_result_nonlab($so_result_id = 0){
|
|
|
|
$this->db_log->trans_begin();
|
|
|
|
if($so_result_id == 0){
|
|
$this->sys_error("So_ResultEntryID is required");
|
|
exit;
|
|
}
|
|
|
|
$sql = "SELECT
|
|
T_OrderHeaderMgm_McuID as Mgm_McuID,
|
|
T_OrderHeaderID as T_OrderHeaderID,
|
|
T_OrderHeaderLabNumber as T_OrderHeaderLabNumber,
|
|
So_ResultEntryID as ReffID,
|
|
T_TestSasCode as T_TestCode,
|
|
T_TestName as T_TestName,
|
|
'' as Result,
|
|
'' as UnitName,
|
|
'' as refference,
|
|
NonlabTemplateFlagOther
|
|
FROM so_resultentry
|
|
JOIN t_orderdetail ON So_ResultEntryT_OrderDetailID = T_OrderDetailID AND T_OrderDetailIsActive = 'Y'
|
|
JOIN t_orderheader ON T_OrderDetailT_OrderHeaderID = T_OrderHeaderID AND T_OrderHeaderIsActive = 'Y'
|
|
JOIN t_test ON T_OrderDetailT_TestID = T_TestID AND T_TestIsActive = 'Y'
|
|
JOIN nonlab_template ON So_ResultEntryNonlab_TemplateID = NonlabTemplateID AND NonlabTemplateIsActive = 'Y'
|
|
WHERE
|
|
So_ResultEntryIsActive = 'Y' AND
|
|
So_ResultEntryID = ? AND So_ResultEntryStatus <> 'NEW'";
|
|
$query = $this->db->query($sql, [$so_result_id]);
|
|
|
|
|
|
if(!$query){
|
|
$results = array("status" => "error", "message" => "Failed to select so_resultentry", "data" => array());
|
|
return $results;
|
|
}
|
|
$result = $query->result_array();
|
|
|
|
if(count($result) == 0){
|
|
$results = array("status" => "error", "message" => "No data found", "data" => array());
|
|
return $results;
|
|
}
|
|
|
|
$result = $result[0];
|
|
$mgm_mcuID = $result['Mgm_McuID'];
|
|
$T_OrderHeaderID = $result['T_OrderHeaderID'];
|
|
$T_OrderHeaderLabNumber = $result['T_OrderHeaderLabNumber'];
|
|
|
|
$sql = "DELETE FROM mcu_result_all WHERE
|
|
Mcu_ResultAllMgm_McuID = ? AND
|
|
Mcu_ResultAllT_OrderHeaderID = ? AND
|
|
Mcu_ResultAllT_OrderHeaderLabNumber = ? AND
|
|
Mcu_ResultAllReffID = ? AND
|
|
Mcu_ResultAllT_TestCode = ? AND
|
|
Mcu_ResultAllT_TestName = ?";
|
|
$query = $this->db_log->query($sql, [$mgm_mcuID, $T_OrderHeaderID, $T_OrderHeaderLabNumber, $result['ReffID'], $result['T_TestCode'], $result['T_TestName']]);
|
|
|
|
if(!$query){
|
|
$results = array("status" => "error", "message" => "Failed to delete mcu_result_all", "data" => array());
|
|
return $results;
|
|
}
|
|
|
|
$sql = "INSERT INTO mcu_result_all (
|
|
Mcu_ResultAllMgm_McuID,
|
|
Mcu_ResultAllT_OrderHeaderID,
|
|
Mcu_ResultAllT_OrderHeaderLabNumber,
|
|
Mcu_ResultAllReffID,
|
|
Mcu_ResultAllT_TestCode,
|
|
Mcu_ResultAllT_TestName,
|
|
Mcu_ResultAllResult,
|
|
Mcu_ResultAllUnit,
|
|
Mcu_ResultAllRefference,
|
|
Mcu_ResultAllCreated
|
|
) VALUES (?,?,?,?,?,?,?,?,?,NOW())";
|
|
$query = $this->db_log->query($sql, [
|
|
$mgm_mcuID,
|
|
$T_OrderHeaderID,
|
|
$T_OrderHeaderLabNumber,
|
|
$result['ReffID'],
|
|
$result['T_TestCode'],
|
|
$result['T_TestName'],
|
|
$result['Result'],
|
|
$result['UnitName'],
|
|
$result['refference']
|
|
]);
|
|
|
|
|
|
if(!$query){
|
|
$this->sys_error_db("insert mcu_result_all", $this->db_log);
|
|
exit;
|
|
}
|
|
|
|
if($result['NonlabTemplateFlagOther'] == 'N'){
|
|
$sql = "SELECT
|
|
So_ResultEntryDetailID as ReffID,
|
|
NonlabTemplateDetailCode as T_TestCode,
|
|
NonlabTemplateDetailName as T_TestName,
|
|
IFNULL(So_ResultEntryDetailResult,'') as Result,
|
|
IFNULL(Nat_UnitName,'') as UnitName,
|
|
'' as refference
|
|
FROM so_resultentrydetail
|
|
JOIN nonlab_template_detail ON So_ResultEntryDetailNonlab_TemplateDetailID = NonlabTemplateDetailID AND NonlabTemplateDetailIsActive = 'Y'
|
|
LEFT JOIN nat_unit ON NonlabTemplateDetaiNat_UnitID = Nat_UnitID AND Nat_UnitIsActive = 'Y'
|
|
WHERE
|
|
So_ResultEntryDetailSo_ResultEntryID = ? AND
|
|
So_ResultEntryDetailIsActive = 'Y'";
|
|
$query = $this->db->query($sql, [$so_result_id]);
|
|
|
|
if(!$query){
|
|
$results = array("status" => "error", "message" => "Failed to select so_resultentry_detail", "data" => array());
|
|
return $results;
|
|
}
|
|
$result = $query->result_array();
|
|
if(count($result) > 0){
|
|
foreach ($result as $key => $row) {
|
|
$sql = "DELETE FROM mcu_result_all WHERE
|
|
Mcu_ResultAllMgm_McuID = ? AND
|
|
Mcu_ResultAllT_OrderHeaderID = ? AND
|
|
Mcu_ResultAllT_OrderHeaderLabNumber = ? AND
|
|
Mcu_ResultAllReffID = ? AND
|
|
Mcu_ResultAllT_TestCode = ? AND
|
|
Mcu_ResultAllT_TestName = ?";
|
|
$query = $this->db_log->query($sql, [
|
|
$mgm_mcuID,
|
|
$T_OrderHeaderID,
|
|
$T_OrderHeaderLabNumber,
|
|
$row['ReffID'],
|
|
$row['T_TestCode'],
|
|
$row['T_TestName']]);
|
|
if(!$query){
|
|
$results = array("status" => "error", "message" => "Failed to delete mcu_result_all", "data" => array());
|
|
return $results;
|
|
}
|
|
|
|
$sql = "INSERT INTO mcu_result_all (
|
|
Mcu_ResultAllMgm_McuID,
|
|
Mcu_ResultAllT_OrderHeaderID,
|
|
Mcu_ResultAllT_OrderHeaderLabNumber,
|
|
Mcu_ResultAllReffID,
|
|
Mcu_ResultAllT_TestCode,
|
|
Mcu_ResultAllT_TestName,
|
|
Mcu_ResultAllResult,
|
|
Mcu_ResultAllUnit,
|
|
Mcu_ResultAllRefference,
|
|
Mcu_ResultAllCreated
|
|
) VALUES (?,?,?,?,?,?,?,?,?,NOW())";
|
|
$query = $this->db_log->query($sql, [
|
|
$mgm_mcuID,
|
|
$T_OrderHeaderID,
|
|
$T_OrderHeaderLabNumber,
|
|
$row['ReffID'],
|
|
$row['T_TestCode'],
|
|
$row['T_TestName'],
|
|
$row['Result'],
|
|
$row['UnitName'],
|
|
$row['refference']
|
|
]);
|
|
|
|
if(!$query){
|
|
$results = array("status" => "error", "message" => "Failed to insert mcu_result_all", "data" => array());
|
|
return $results;
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
|
|
$this->db_log->trans_commit();
|
|
|
|
$results = array("status" => "success", "message" => "Data generated successfully", "data" => $result);
|
|
return $results;
|
|
|
|
}
|
|
|
|
function get_data_fisik_resultentry($so_result_id){
|
|
$this->db_log->trans_begin();
|
|
|
|
if($so_result_id == 0){
|
|
$this->sys_error("So_ResultEntryID is required");
|
|
exit;
|
|
}
|
|
|
|
$sql = "SELECT
|
|
T_OrderHeaderMgm_McuID as Mgm_McuID,
|
|
T_OrderHeaderID as T_OrderHeaderID,
|
|
T_OrderHeaderLabNumber as T_OrderHeaderLabNumber,
|
|
So_ResultEntryID as ReffID,
|
|
T_TestSasCode as T_TestCode,
|
|
T_TestName as T_TestName,
|
|
'' as Result,
|
|
'' as UnitName,
|
|
'' as refference,
|
|
NonlabTemplateFlagOther
|
|
FROM so_resultentry
|
|
JOIN t_orderdetail ON So_ResultEntryT_OrderDetailID = T_OrderDetailID AND T_OrderDetailIsActive = 'Y'
|
|
JOIN t_orderheader ON T_OrderDetailT_OrderHeaderID = T_OrderHeaderID AND T_OrderHeaderIsActive = 'Y'
|
|
JOIN t_test ON T_OrderDetailT_TestID = T_TestID AND T_TestIsActive = 'Y'
|
|
JOIN nonlab_template ON So_ResultEntryNonlab_TemplateID = NonlabTemplateID AND NonlabTemplateIsActive = 'Y'
|
|
WHERE
|
|
So_ResultEntryIsActive = 'Y' AND
|
|
So_ResultEntryID = ? AND So_ResultEntryStatus <> 'NEW'";
|
|
$query = $this->db->query($sql, [$so_result_id]);
|
|
if(!$query){
|
|
$results = array("status" => "error", "message" => "Failed to select so_resultentry", "data" => array());
|
|
return $results;
|
|
}
|
|
$results = $query->result_array();
|
|
if(count($results) == 0){
|
|
$results = array("status" => "error", "message" => "No data found", "data" => array());
|
|
return $results;
|
|
}
|
|
|
|
|
|
$result = $results[0];
|
|
$mgm_mcuID = $result['Mgm_McuID'];
|
|
$T_OrderHeaderID = $result['T_OrderHeaderID'];
|
|
$T_OrderHeaderLabNumber = $result['T_OrderHeaderLabNumber'];
|
|
|
|
$sql = "DELETE FROM mcu_result_all WHERE
|
|
Mcu_ResultAllMgm_McuID = ? AND
|
|
Mcu_ResultAllT_OrderHeaderID = ? AND
|
|
Mcu_ResultAllT_OrderHeaderLabNumber = ? AND
|
|
Mcu_ResultAllReffID = ? AND
|
|
Mcu_ResultAllT_TestCode = ? AND
|
|
Mcu_ResultAllT_TestName = ?";
|
|
$query = $this->db_log->query($sql, [$mgm_mcuID, $T_OrderHeaderID, $T_OrderHeaderLabNumber, $result['ReffID'], $result['T_TestCode'], $result['T_TestName']]);
|
|
|
|
if(!$query){
|
|
$results = array("status" => "error", "message" => "Failed to delete mcu_result_all", "data" => array());
|
|
return $results;
|
|
}
|
|
|
|
$sql = "INSERT INTO mcu_result_all (
|
|
Mcu_ResultAllMgm_McuID,
|
|
Mcu_ResultAllT_OrderHeaderID,
|
|
Mcu_ResultAllT_OrderHeaderLabNumber,
|
|
Mcu_ResultAllReffID,
|
|
Mcu_ResultAllT_TestCode,
|
|
Mcu_ResultAllT_TestName,
|
|
Mcu_ResultAllResult,
|
|
Mcu_ResultAllUnit,
|
|
Mcu_ResultAllRefference,
|
|
Mcu_ResultAllCreated
|
|
) VALUES (?,?,?,?,?,?,?,?,?,NOW())";
|
|
$query = $this->db_log->query($sql, [
|
|
$mgm_mcuID,
|
|
$T_OrderHeaderID,
|
|
$T_OrderHeaderLabNumber,
|
|
$result['ReffID'],
|
|
$result['T_TestCode'],
|
|
$result['T_TestName'],
|
|
$result['Result'],
|
|
$result['UnitName'],
|
|
$result['refference']
|
|
]);
|
|
|
|
|
|
if(!$query){
|
|
$this->sys_error_db("insert mcu_result_all", $this->db_log);
|
|
exit;
|
|
}
|
|
|
|
$sql = "SELECT So_ResultEntryFisikUmumDetails as details,
|
|
So_ResultEntryFisikUmumID as ReffID
|
|
FROM so_resultentry_fisik_umum
|
|
JOIN fisik_template ON So_ResultEntryFisikUmumFisikTemplateID = FisikTemplateID AND FisikTemplateIsActive = 'Y'
|
|
WHERE
|
|
So_ResultEntryFisikUmumSo_ResultEntryID = ? AND
|
|
So_ResultEntryFisikUmumIsActive = 'Y'";
|
|
$query = $this->db->query($sql, [$so_result_id]);
|
|
|
|
if(!$query){
|
|
$details_results = array("status" => "error", "message" => "Failed to select so_resultentry_fisik_umum", "data" => array());
|
|
return $details_results;
|
|
}
|
|
$details_results = $query->result_array();
|
|
|
|
if(count($details_results) > 0){
|
|
foreach ($details_results as $key => $row) {
|
|
|
|
$ReffID = $row['ReffID'];
|
|
$details = $row['details'];
|
|
$results = $this->generate_result_fisik_umum($details);
|
|
|
|
if(count($results) > 0){
|
|
foreach ($results as $result) {
|
|
$test_code = $result['test_code'];
|
|
$test_name = $result['test_name'];
|
|
$result = $result['result'];
|
|
$hasil = array();
|
|
if(count($result) > 0){
|
|
foreach ($result as $r) {
|
|
$hasil[] = $r['string_value'];
|
|
}
|
|
}
|
|
$string_hasil = implode(', ', $hasil);
|
|
$sql = "DELETE FROM mcu_result_all WHERE
|
|
Mcu_ResultAllMgm_McuID = ? AND
|
|
Mcu_ResultAllT_OrderHeaderID = ? AND
|
|
Mcu_ResultAllT_OrderHeaderLabNumber = ? AND
|
|
Mcu_ResultAllReffID = ? AND
|
|
Mcu_ResultAllT_TestCode = ? AND
|
|
Mcu_ResultAllT_TestName = ?";
|
|
$query = $this->db_log->query($sql, [
|
|
$mgm_mcuID,
|
|
$T_OrderHeaderID,
|
|
$T_OrderHeaderLabNumber,
|
|
$ReffID,
|
|
$test_code,
|
|
$test_name]);
|
|
|
|
if(!$query){
|
|
$results = array("status" => "error", "message" => "Failed to delete mcu_result_all_fisik_umum", "data" => array());
|
|
return $results;
|
|
}
|
|
|
|
|
|
$sql = "INSERT INTO mcu_result_all (
|
|
Mcu_ResultAllMgm_McuID,
|
|
Mcu_ResultAllT_OrderHeaderID,
|
|
Mcu_ResultAllT_OrderHeaderLabNumber,
|
|
Mcu_ResultAllReffID,
|
|
Mcu_ResultAllT_TestCode,
|
|
Mcu_ResultAllT_TestName,
|
|
Mcu_ResultAllResult,
|
|
Mcu_ResultAllUnit,
|
|
Mcu_ResultAllRefference,
|
|
Mcu_ResultAllCreated
|
|
) VALUES (?,?,?,?,?,?,?,?,?,NOW())";
|
|
$query = $this->db_log->query($sql, [
|
|
$mgm_mcuID,
|
|
$T_OrderHeaderID,
|
|
$T_OrderHeaderLabNumber,
|
|
$ReffID,
|
|
$test_code,
|
|
$test_name,
|
|
$string_hasil,
|
|
'',
|
|
'']);
|
|
|
|
if(!$query){
|
|
$rtn = array("status" => "error", "message" => "Failed to insert mcu_result_all", "data" => array());
|
|
return $rtn;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
$this->db_log->trans_commit();
|
|
|
|
$results = array("status" => "success", "message" => "Data generated successfully", "data" => $result);
|
|
return $results;
|
|
}
|
|
|
|
function generate_kenal_warna($row,$langid=1){
|
|
$result = $this->persepsi_warna($row['T_OrderHeaderID'],$langid);
|
|
if($result['status'] == 'error'){
|
|
return array("status" => "error", "message" => "Failed to generate kenal warna", "data" => array());
|
|
}
|
|
|
|
$mgm_mcuID = $row['Mgm_McuID'];
|
|
$T_OrderHeaderID = $row['T_OrderHeaderID'];
|
|
$T_OrderHeaderLabNumber = $row['T_OrderHeaderLabNumber'];
|
|
$ReffID = $row['T_OrderHeaderID'];
|
|
$test_code = $result['t_test_code'];
|
|
$test_name = $result['t_test_name'];
|
|
$string_hasil = $result['string_value'];
|
|
$sql = "DELETE FROM mcu_result_all
|
|
WHERE
|
|
Mcu_ResultAllMgm_McuID = ? AND
|
|
Mcu_ResultAllT_OrderHeaderID = ? AND
|
|
Mcu_ResultAllT_OrderHeaderLabNumber = ? AND
|
|
Mcu_ResultAllReffID = ? AND
|
|
Mcu_ResultAllT_TestCode = ? AND
|
|
Mcu_ResultAllT_TestName = ?";
|
|
$query = $this->db_log->query($sql, [
|
|
$mgm_mcuID,
|
|
$T_OrderHeaderID,
|
|
$T_OrderHeaderLabNumber,
|
|
$ReffID,
|
|
$test_code,
|
|
$test_name]);
|
|
|
|
if(!$query){
|
|
$results = array("status" => "error", "message" => "Failed to delete mcu_result_all_fisik_umum", "data" => array());
|
|
return $results;
|
|
}
|
|
|
|
|
|
$sql = "INSERT INTO mcu_result_all (
|
|
Mcu_ResultAllMgm_McuID,
|
|
Mcu_ResultAllT_OrderHeaderID,
|
|
Mcu_ResultAllT_OrderHeaderLabNumber,
|
|
Mcu_ResultAllReffID,
|
|
Mcu_ResultAllT_TestCode,
|
|
Mcu_ResultAllT_TestName,
|
|
Mcu_ResultAllResult,
|
|
Mcu_ResultAllUnit,
|
|
Mcu_ResultAllRefference,
|
|
Mcu_ResultAllCreated
|
|
) VALUES (?,?,?,?,?,?,?,?,?,NOW())";
|
|
$query = $this->db_log->query($sql, [
|
|
$mgm_mcuID,
|
|
$T_OrderHeaderID,
|
|
$T_OrderHeaderLabNumber,
|
|
$ReffID,
|
|
$test_code,
|
|
$test_name,
|
|
$string_hasil,
|
|
'',
|
|
'']);
|
|
|
|
if(!$query){
|
|
$rtn = array("status" => "error", "message" => "Failed to insert mcu_result_all", "data" => array());
|
|
return $rtn;
|
|
}
|
|
if(!$result){
|
|
return array("status" => "error", "message" => "Failed to generate kenal warna", "data" => array());
|
|
}
|
|
return array("status" => "success", "message" => "Data generated successfully", "data" => $result);
|
|
}
|
|
|
|
function generate_status_gizi($row,$langid=1){
|
|
$result = $this->status_gizi($row['T_OrderHeaderID'],$langid);
|
|
if($result['status'] == 'error'){
|
|
return array("status" => "error", "message" => "Failed to generate status gizi", "data" => array());
|
|
}
|
|
|
|
|
|
$mgm_mcuID = $row['Mgm_McuID'];
|
|
$T_OrderHeaderID = $row['T_OrderHeaderID'];
|
|
$T_OrderHeaderLabNumber = $row['T_OrderHeaderLabNumber'];
|
|
$ReffID = $row['T_OrderHeaderID'];
|
|
|
|
foreach ($result as $key => $row) {
|
|
$test_code = $row['t_test_code'];
|
|
$test_name = $row['t_test_name'];
|
|
$string_hasil = $row['t_string_value'];
|
|
$sql = "DELETE FROM mcu_result_all
|
|
WHERE
|
|
Mcu_ResultAllMgm_McuID = ? AND
|
|
Mcu_ResultAllT_OrderHeaderID = ? AND
|
|
Mcu_ResultAllT_OrderHeaderLabNumber = ? AND
|
|
Mcu_ResultAllReffID = ? AND
|
|
Mcu_ResultAllT_TestCode = ? AND
|
|
Mcu_ResultAllT_TestName = ?";
|
|
$query = $this->db_log->query($sql, [
|
|
$mgm_mcuID,
|
|
$T_OrderHeaderID,
|
|
$T_OrderHeaderLabNumber,
|
|
$ReffID,
|
|
$test_code,
|
|
$test_name]);
|
|
|
|
if(!$query){
|
|
$results = array("status" => "error", "message" => "Failed to delete mcu_result_all status gizi", "data" => array());
|
|
return $results;
|
|
}
|
|
|
|
|
|
$sql = "INSERT INTO mcu_result_all (
|
|
Mcu_ResultAllMgm_McuID,
|
|
Mcu_ResultAllT_OrderHeaderID,
|
|
Mcu_ResultAllT_OrderHeaderLabNumber,
|
|
Mcu_ResultAllReffID,
|
|
Mcu_ResultAllT_TestCode,
|
|
Mcu_ResultAllT_TestName,
|
|
Mcu_ResultAllResult,
|
|
Mcu_ResultAllUnit,
|
|
Mcu_ResultAllRefference,
|
|
Mcu_ResultAllCreated
|
|
) VALUES (?,?,?,?,?,?,?,?,?,NOW())";
|
|
$query = $this->db_log->query($sql, [
|
|
$mgm_mcuID,
|
|
$T_OrderHeaderID,
|
|
$T_OrderHeaderLabNumber,
|
|
$ReffID,
|
|
$test_code,
|
|
$test_name,
|
|
$string_hasil,
|
|
'',
|
|
'']);
|
|
|
|
if(!$query){
|
|
$rtn = array("status" => "error", "message" => "Failed to insert mcu_result_all bodyfatmonitoring", "data" => array());
|
|
return $rtn;
|
|
}
|
|
}
|
|
|
|
return array("status" => "success", "message" => "Data generated successfully", "data" => $result);
|
|
}
|
|
|
|
|
|
function generate_bodyfatmonitoring($row,$langid=1){
|
|
$result = $this->bodyfatmonitoring($row['T_OrderHeaderID'],$langid);
|
|
if($result['status'] == 'error'){
|
|
return array("status" => "error", "message" => "Failed to generate bodyfatmonitoring", "data" => array());
|
|
}
|
|
$mgm_mcuID = $row['Mgm_McuID'];
|
|
$T_OrderHeaderID = $row['T_OrderHeaderID'];
|
|
$T_OrderHeaderLabNumber = $row['T_OrderHeaderLabNumber'];
|
|
$ReffID = $row['T_OrderHeaderID'];
|
|
$test_code = 'bodyfatmonitoring';
|
|
$test_name = $this->translate_word("Bodyfat Monitoring",$langid);
|
|
$string_hasil = $result['result']['hasil'];
|
|
$sql = "DELETE FROM mcu_result_all
|
|
WHERE
|
|
Mcu_ResultAllMgm_McuID = ? AND
|
|
Mcu_ResultAllT_OrderHeaderID = ? AND
|
|
Mcu_ResultAllT_OrderHeaderLabNumber = ? AND
|
|
Mcu_ResultAllReffID = ? AND
|
|
Mcu_ResultAllT_TestCode = ? AND
|
|
Mcu_ResultAllT_TestName = ?";
|
|
$query = $this->db_log->query($sql, [
|
|
$mgm_mcuID,
|
|
$T_OrderHeaderID,
|
|
$T_OrderHeaderLabNumber,
|
|
$ReffID,
|
|
$test_code,
|
|
$test_name]);
|
|
|
|
if(!$query){
|
|
$results = array("status" => "error", "message" => "Failed to delete mcu_result_all bodyfatmonitoring", "data" => array());
|
|
return $results;
|
|
}
|
|
|
|
|
|
$sql = "INSERT INTO mcu_result_all (
|
|
Mcu_ResultAllMgm_McuID,
|
|
Mcu_ResultAllT_OrderHeaderID,
|
|
Mcu_ResultAllT_OrderHeaderLabNumber,
|
|
Mcu_ResultAllReffID,
|
|
Mcu_ResultAllT_TestCode,
|
|
Mcu_ResultAllT_TestName,
|
|
Mcu_ResultAllResult,
|
|
Mcu_ResultAllUnit,
|
|
Mcu_ResultAllRefference,
|
|
Mcu_ResultAllCreated
|
|
) VALUES (?,?,?,?,?,?,?,?,?,NOW())";
|
|
$query = $this->db_log->query($sql, [
|
|
$mgm_mcuID,
|
|
$T_OrderHeaderID,
|
|
$T_OrderHeaderLabNumber,
|
|
$ReffID,
|
|
$test_code,
|
|
$test_name,
|
|
$string_hasil,
|
|
'',
|
|
'']);
|
|
|
|
if(!$query){
|
|
$rtn = array("status" => "error", "message" => "Failed to insert mcu_result_all bodyfatmonitoring", "data" => array());
|
|
return $rtn;
|
|
}
|
|
|
|
return array("status" => "success", "message" => "Data generated successfully", "data" => $result);
|
|
}
|
|
|
|
function generate_visus($row,$langid=1){
|
|
$result = $this->visus($row['T_OrderHeaderID'],$langid);
|
|
if($result['status'] == 'error'){
|
|
return array("status" => "error", "message" => "Failed to generate visus", "data" => array());
|
|
}
|
|
$mgm_mcuID = $row['Mgm_McuID'];
|
|
$T_OrderHeaderID = $row['T_OrderHeaderID'];
|
|
$T_OrderHeaderLabNumber = $row['T_OrderHeaderLabNumber'];
|
|
$ReffID = $row['T_OrderHeaderID'];
|
|
$test_code = 'visus_kiri';
|
|
$test_name = $this->translate_word("Visus Kiri",$langid);
|
|
$string_hasil = $result['result']['hasil_kiri'];
|
|
$sql = "DELETE FROM mcu_result_all
|
|
WHERE
|
|
Mcu_ResultAllMgm_McuID = ? AND
|
|
Mcu_ResultAllT_OrderHeaderID = ? AND
|
|
Mcu_ResultAllT_OrderHeaderLabNumber = ? AND
|
|
Mcu_ResultAllReffID = ? AND
|
|
Mcu_ResultAllT_TestCode = ? AND
|
|
Mcu_ResultAllT_TestName = ?";
|
|
$query = $this->db_log->query($sql, [
|
|
$mgm_mcuID,
|
|
$T_OrderHeaderID,
|
|
$T_OrderHeaderLabNumber,
|
|
$ReffID,
|
|
$test_code,
|
|
$test_name]);
|
|
|
|
if(!$query){
|
|
$results = array("status" => "error", "message" => "Failed to delete mcu_result_all visus kiri", "data" => array());
|
|
return $results;
|
|
}
|
|
|
|
$sql = "INSERT INTO mcu_result_all (
|
|
Mcu_ResultAllMgm_McuID,
|
|
Mcu_ResultAllT_OrderHeaderID,
|
|
Mcu_ResultAllT_OrderHeaderLabNumber,
|
|
Mcu_ResultAllReffID,
|
|
Mcu_ResultAllT_TestCode,
|
|
Mcu_ResultAllT_TestName,
|
|
Mcu_ResultAllResult,
|
|
Mcu_ResultAllUnit,
|
|
Mcu_ResultAllRefference,
|
|
Mcu_ResultAllCreated
|
|
) VALUES (?,?,?,?,?,?,?,?,?,NOW())";
|
|
$query = $this->db_log->query($sql, [
|
|
$mgm_mcuID,
|
|
$T_OrderHeaderID,
|
|
$T_OrderHeaderLabNumber,
|
|
$ReffID,
|
|
$test_code,
|
|
$test_name,
|
|
$string_hasil,
|
|
'',
|
|
'']);
|
|
|
|
if(!$query){
|
|
$rtn = array("status" => "error", "message" => "Failed to insert mcu_result_all", "data" => array());
|
|
return $rtn;
|
|
}
|
|
|
|
$test_code = 'visus_kanan';
|
|
$test_name = $this->translate_word("Visus Kanan",$langid);
|
|
$string_hasil = $result['result']['hasil_kanan'];
|
|
$sql = "DELETE FROM mcu_result_all
|
|
WHERE
|
|
Mcu_ResultAllMgm_McuID = ? AND
|
|
Mcu_ResultAllT_OrderHeaderID = ? AND
|
|
Mcu_ResultAllT_OrderHeaderLabNumber = ? AND
|
|
Mcu_ResultAllReffID = ? AND
|
|
Mcu_ResultAllT_TestCode = ? AND
|
|
Mcu_ResultAllT_TestName = ?";
|
|
$query = $this->db_log->query($sql, [
|
|
$mgm_mcuID,
|
|
$T_OrderHeaderID,
|
|
$T_OrderHeaderLabNumber,
|
|
$ReffID,
|
|
$test_code,
|
|
$test_name]);
|
|
|
|
if(!$query){
|
|
$results = array("status" => "error", "message" => "Failed to delete mcu_result_all visus kanan", "data" => array());
|
|
return $results;
|
|
}
|
|
|
|
|
|
$sql = "INSERT INTO mcu_result_all (
|
|
Mcu_ResultAllMgm_McuID,
|
|
Mcu_ResultAllT_OrderHeaderID,
|
|
Mcu_ResultAllT_OrderHeaderLabNumber,
|
|
Mcu_ResultAllReffID,
|
|
Mcu_ResultAllT_TestCode,
|
|
Mcu_ResultAllT_TestName,
|
|
Mcu_ResultAllResult,
|
|
Mcu_ResultAllUnit,
|
|
Mcu_ResultAllRefference,
|
|
Mcu_ResultAllCreated
|
|
) VALUES (?,?,?,?,?,?,?,?,?,NOW())";
|
|
$query = $this->db_log->query($sql, [
|
|
$mgm_mcuID,
|
|
$T_OrderHeaderID,
|
|
$T_OrderHeaderLabNumber,
|
|
$ReffID,
|
|
$test_code,
|
|
$test_name,
|
|
$string_hasil,
|
|
'',
|
|
'']);
|
|
|
|
if(!$query){
|
|
$rtn = array("status" => "error", "message" => "Failed to insert mcu_result_all", "data" => array());
|
|
return $rtn;
|
|
}
|
|
if(!$result){
|
|
return array("status" => "error", "message" => "Failed to generate visus", "data" => array());
|
|
}
|
|
return array("status" => "success", "message" => "Data generated successfully", "data" => $result);
|
|
}
|
|
|
|
|
|
|
|
|
|
function generate_result_fisik_umum($jsonDetails='',$langid=1){
|
|
$d = json_decode($jsonDetails, true);
|
|
//print_r($d);
|
|
// exit;
|
|
$results = [];
|
|
if ($d["title"] == "RIWAYAT POBIA") {
|
|
$test_code = "fisik_riwayatpobia";
|
|
$test_name = $this->translate_word("RIWAYAT POBIA",$langid);
|
|
if ($d["flag_normal"] == "Y") {
|
|
$result[] = array("string_value" => "");
|
|
} else {
|
|
foreach ($d["details"] as $gp) {
|
|
if ($gp["chx"] == 1) {
|
|
$arr_result[] = array($gp["label"], $gp["value"]);
|
|
$string_value = $this->translate_word($gp["label"],$langid);
|
|
if($gp["value"] != ''){
|
|
$string_value .= ' ( ' . $this->translate_word($gp["value"],$langid) . ' )';
|
|
}
|
|
$result[] = array(
|
|
"b1" => $this->translate_word($gp["label"],$langid),
|
|
"b2" => $this->translate_word($gp["value"],$langid),
|
|
"string_value" => $string_value,
|
|
);
|
|
}
|
|
}
|
|
}
|
|
$results[] = array(
|
|
"test_code" => $test_code,
|
|
"test_name" => $test_name,
|
|
"result" => $result
|
|
);
|
|
}
|
|
|
|
if ($d["title"] == "KELUHAN SAAT INI") {
|
|
$test_code = "fisik_keluhansaatini";
|
|
$test_name = $this->translate_word("KELUHAN SAAT INI",$langid);
|
|
if ($d["flag_normal"] == "Y") {
|
|
$result[] = array("string_value" => "");
|
|
|
|
} else {
|
|
foreach ($d["details"] as $gp) {
|
|
if ($gp["chx"] == 1) {
|
|
$arr_result[] = array($gp["label"], $gp["value"]);
|
|
$string_value = $this->translate_word($gp["label"],$langid);
|
|
if($gp["value"] != ''){
|
|
$string_value .= ' ( ' . $this->translate_word($gp["value"],$langid) . ' )';
|
|
}
|
|
$result[] = array(
|
|
"a1" => $this->translate_word($gp["label"],$langid),
|
|
"a2" => $this->translate_word($gp["value"],$langid),
|
|
"string_value" => $string_value,
|
|
);
|
|
}
|
|
}
|
|
}
|
|
$results[] = array(
|
|
"test_code" => $test_code,
|
|
"test_name" => $test_name,
|
|
"result" => $result
|
|
);
|
|
}
|
|
|
|
if ($d["title"] == "ETNIS") {
|
|
$test_code = "fisik_etnis";
|
|
$test_name = $this->translate_word("ETNIS",$langid);
|
|
if ($d["flag_normal"] == "Y") {
|
|
$result[] = array("string_value" => "");
|
|
} else {
|
|
foreach ($d["details"] as $gp) {
|
|
if ($gp["chx"] == 1) {
|
|
$arr_result[] = array($gp["label"], $gp["value"]);
|
|
$string_value = $this->translate_word($gp["label"],$langid);
|
|
if($gp["value"] != ''){
|
|
$string_value .= ' ( ' . $this->translate_word($gp["value"],$langid) . ' )';
|
|
}
|
|
$result[] = array(
|
|
"x1" => $this->translate_word($gp["label"],$langid),
|
|
"x2" => $this->translate_word($gp["value"],$langid),
|
|
"string_value" => $string_value
|
|
);
|
|
}
|
|
}
|
|
}
|
|
$results[] = array(
|
|
"test_code" => $test_code,
|
|
"test_name" => $test_name,
|
|
"result" => $result
|
|
);
|
|
}
|
|
|
|
if ($d["title"] == "RIWAYAT PENYAKIT") {
|
|
$test_code = "fisik_riwayatpenyakit";
|
|
$test_name = $this->translate_word("RIWAYAT PENYAKIT",$langid);
|
|
$allergi = [];
|
|
if ($d["flag_normal"] == "Y") {
|
|
$result[] = array(
|
|
"string_value" => ""
|
|
);
|
|
} else {
|
|
foreach($d["details"] as $gp) {
|
|
if( $gp['name'] != "Allergi"){
|
|
foreach($gp["details"] as $xd) {
|
|
|
|
if ($xd["chx"] == 1) {
|
|
$hasil = str_replace("Militus","Melitus",$xd["label"]);
|
|
$hasil = $this->translate_word($hasil,$langid);
|
|
|
|
$special_labels = [
|
|
"Lain-lain ( Penyakit lainnya )",
|
|
"Epilepsi (ayan), kejang, pingsan",
|
|
"Kecelakaan / cidera / trauma / luka parah",
|
|
"Lain-lain ( Kulit & Sistem Reproduksi )"
|
|
];
|
|
|
|
if (in_array($xd["label"], $special_labels)) {
|
|
$hasil = $this->translate_word($xd["value"], $langid);
|
|
} else {
|
|
$hasil = $hasil . " " . $this->translate_word($xd["value"], $langid) . "";
|
|
} ;
|
|
|
|
$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 )"
|
|
){
|
|
$result[] = array("string_value" => $hasil);
|
|
}else{
|
|
$result[] = array("string_value" => $hasil);
|
|
}
|
|
|
|
}
|
|
}
|
|
}
|
|
|
|
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 = $this->translate_word($xd["label"],$langid);
|
|
if($xd['value'] != '')
|
|
$hasil = $this->translate_word($xd["label"],$langid)." (".$xd["value"].")";
|
|
|
|
$allergi[] = array("string_value" => $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 = $this->translate_word($xd["label"],$langid);
|
|
if($xd['value'] != '')
|
|
$hasil = $this->translate_word($xd["label"],$langid)." (".$this->translate_word($xd["value"],$langid).")";
|
|
|
|
$allergi[] = array("string_value" => $hasil);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
$results[] = array(
|
|
"test_code" => $test_code,
|
|
"test_name" => $test_name,
|
|
"result" => $result
|
|
);
|
|
|
|
$results[] = array(
|
|
"test_code" => "fisik_allergi",
|
|
"test_name" => $this->translate_word("ALLERGI",$langid),
|
|
"result" => $allergi
|
|
);
|
|
}
|
|
|
|
if ($d["title"] == "RIWAYAT PENYAKIT KELUARGA") {
|
|
if ($d["flag_normal"] == "Y") {
|
|
$string_ayah = count($ayah) > 0?join(", ",$ayah):"-";
|
|
$string_ibu = count($ibu) > 0?join(", ",$ibu):"-";
|
|
if($string_ibu == '')
|
|
$string_ibu = "-";
|
|
|
|
if($string_ayah == '')
|
|
$string_ayah = "-";
|
|
$results[] = array(
|
|
"test_code" => "fisik_riwayatpenyakitkeluarga_ayah",
|
|
"test_name" => $this->translate_word("RIWAYAT PENYAKIT KELUARGA ( AYAH )",$langid),
|
|
"result" => [array("string_value" => $string_ayah)]
|
|
);
|
|
$results[] = array(
|
|
"test_code" => "fisik_riwayatpenyakitkeluarga_ibu",
|
|
"test_name" => $this->translate_word("RIWAYAT PENYAKIT KELUARGA ( IBU )",$langid),
|
|
"result" => [array("string_value" => $string_ibu)]
|
|
);
|
|
} else {
|
|
$ayah = [];
|
|
$ibu = [];
|
|
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";
|
|
}
|
|
$label = $this->translate_word($label,$langid);
|
|
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 = "-";
|
|
|
|
|
|
$results[] = array(
|
|
"test_code" => "fisik_riwayatpenyakitkeluarga_ayah",
|
|
"test_name" => $this->translate_word("RIWAYAT PENYAKIT KELUARGA ( AYAH )",$langid),
|
|
"result" => [array("string_value" => $string_ayah)]
|
|
);
|
|
$results[] = array(
|
|
"test_code" => "fisik_riwayatpenyakitkeluarga_ibu",
|
|
"test_name" => $this->translate_word("RIWAYAT PENYAKIT KELUARGA ( IBU )",$langid),
|
|
"result" => [array("string_value" => $string_ibu)]
|
|
);
|
|
}
|
|
}
|
|
|
|
if ($d["title"] == "RIWAYAT KEBIASAAN HIDUP") {
|
|
|
|
if ($d["flag_normal"] == "Y") {
|
|
$results[] = array(
|
|
"test_code" => "fisik_merokok",
|
|
"test_name" => $this->translate_word("Merokok",$langid),
|
|
"result" => [array("string_value" => "")]
|
|
);
|
|
$results[] = array(
|
|
"test_code" => "fisik_minumalkohol",
|
|
"test_name" => $this->translate_word("Minum alkohol",$langid),
|
|
"result" => [array("string_value" => "")]
|
|
);
|
|
} else {
|
|
foreach($d["details"] as $gp) {
|
|
if($gp['name'] == 'Merokok'){
|
|
$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'){
|
|
$merokok[] = array("string_value" => $this->translate_word($xd['label'],$langid).' '.$this->translate_word($xd["value"],$langid));
|
|
}else{
|
|
$merokok[] = array("string_value" => $this->translate_word($xd["label"],$langid).' '.$this->translate_word($xd["value"],$langid) .' '.$xd['suffix']);
|
|
}
|
|
|
|
}
|
|
}
|
|
|
|
$results[] = array(
|
|
"test_code" => "fisik_merokok",
|
|
"test_name" => $this->translate_word("Merokok",$langid),
|
|
"result" => $merokok
|
|
);
|
|
}
|
|
|
|
if($gp['name'] == 'Minum alkohol'){
|
|
$minumalkohol = [];
|
|
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'){
|
|
$minumalkohol[] = $this->translate_word($xd['label'],$langid).' '.$this->translate_word($xd["value"],$langid);
|
|
}else{
|
|
$minumalkohol[] = $this->translate_word($xd["label"],$langid).' '.$this->translate_word($xd["value"],$langid) .' '.$xd['suffix'];
|
|
}
|
|
|
|
}
|
|
}
|
|
|
|
$results[] = array(
|
|
"test_code" => "fisik_minumalkohol",
|
|
"test_name" => $this->translate_word("Minum alkohol",$langid),
|
|
"result" => $minumalkohol
|
|
);
|
|
}
|
|
|
|
if($gp['name'] == 'Olahraga'){
|
|
$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'){
|
|
$olahraga[] = array("string_value" => $this->translate_word($xd['label'],$langid).' '.$this->translate_word($xd["value"],$langid));
|
|
}else{
|
|
$jumlah_olahraga = "";
|
|
if($xd["value"] != '')
|
|
$jumlah_olahraga = $this->translate_word($xd["value"],$langid) .' '.$this->translate_word($xd['suffix'],$langid);
|
|
|
|
$olahraga[] = array("string_value" => $this->translate_word($xd["label"],$langid).' '.$jumlah_olahraga);
|
|
}
|
|
|
|
}
|
|
}
|
|
$results[] = array(
|
|
"test_code" => "fisik_olahraga",
|
|
"test_name" => $this->translate_word("Olahraga",$langid),
|
|
"result" => $olahraga
|
|
);
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
}
|
|
|
|
if ($d["title"] == "RIWAYAT KONSUMSI OBAT TERATUR") {
|
|
if ($d["flag_normal"] == "Y") {
|
|
$results[] = array(
|
|
"test_code" => "fisik_riwayatkonsumsiobat",
|
|
"test_name" => $this->translate_word("RIWAYAT KONSUMSI OBAT TERATUR",$langid),
|
|
"result" => [array("string_value" => "")]
|
|
);
|
|
//$d["label_flag_normal"];
|
|
// exit;
|
|
} else {
|
|
foreach($d["details"] as $gp) {
|
|
if ($gp["chx"] == 1 ) {
|
|
$arr_result[] = array($gp["label"],$gp["value"]) ;
|
|
$hasil = $this->translate_word($gp["label"],$langid);
|
|
if($gp["value"] != '')
|
|
$hasil = $this->translate_word($gp["label"],$langid)." (".$this->translate_word($gp["value"],$langid).")";
|
|
$result[] = array("string_value" => $hasil);
|
|
}
|
|
}
|
|
$results[] = array(
|
|
"test_code" => "fisik_riwayatkonsumsiobat",
|
|
"test_name" => $this->translate_word("RIWAYAT KONSUMSI OBAT TERATUR",$langid),
|
|
"result" => $result
|
|
);
|
|
|
|
}
|
|
}
|
|
|
|
if ($d["title"] == "RIWAYAT IMUNISASI") {
|
|
if ($d["flag_normal"] == "Y") {
|
|
$results[] = array(
|
|
"test_code" => "fisik_riwayatimunisasi",
|
|
"test_name" => $this->translate_word("RIWAYAT IMUNISASI",$langid),
|
|
"result" => [array("string_value" => "")]
|
|
);
|
|
|
|
} else {
|
|
foreach($d["details"] as $gp) {
|
|
foreach($gp["details"] as $xd) {
|
|
if ($xd["chx"] == 1 ) {
|
|
if($xd["label"] == 'Pernah')
|
|
$result[] = array("string_value" => str_replace(","," ",$this->translate_word($xd["segment_name"],$langid)).' '.$this->translate_word($xd["value"],$langid));
|
|
}
|
|
}
|
|
}
|
|
|
|
$string_obat = count($riwayat_imunisasi) > 0?join(", ",$riwayat_imunisasi):"-";
|
|
$results[] = array(
|
|
"test_code" => "fisik_riwayatimunisasi",
|
|
"test_name" => $this->translate_word("RIWAYAT IMUNISASI",$langid),
|
|
"result" => [array("string_value" => $string_obat)]
|
|
);
|
|
|
|
}
|
|
}
|
|
|
|
|
|
if ($d["title"] == "TANDA VITAL") {
|
|
|
|
$result_vital = [];
|
|
foreach ($d["details"] as $gp) {
|
|
if($gp['id_code'] == 'tanda_vital_1'){
|
|
$value = $gp['value']." ".$this->translate_word('x/menit',$langid);
|
|
|
|
$frekuensi_nadi[] = array(
|
|
"aa1" => $gp["label"],
|
|
"aa2" => $value,
|
|
"aa3" => "",
|
|
"string_value" => $value
|
|
);
|
|
$results[] = array(
|
|
"test_code" => "frekuensi_nadi",
|
|
"test_name" => $this->translate_word("Frekuensi Nadi",$langid),
|
|
"result" => $frekuensi_nadi
|
|
);
|
|
}
|
|
else if($gp['id_code'] == 'tanda_vital_3'){
|
|
$value = $gp['value']." ".$this->translate_word($gp['unit'],$langid);
|
|
$result_frekuensi_napas[] = array(
|
|
"aa1" => $gp["label"],
|
|
"aa2" => $value,
|
|
"aa3" => "",
|
|
"string_value" => $value
|
|
);
|
|
$results[] = array(
|
|
"test_code" => "frekuensi_napas",
|
|
"test_name" => $this->translate_word("Frekuensi Napas",$langid),
|
|
"result" => $result_frekuensi_napas
|
|
);
|
|
}
|
|
else if($gp['id_code'] == 'tanda_vital_6'){
|
|
if($gp['chx_x'] == 1)
|
|
$value = $this->translate_word($gp['label_x'],$langid);
|
|
if($gp['chx_y'] == 1)
|
|
$value = $this->translate_word($gp['label_y'],$langid);
|
|
$result_suhu[] = array(
|
|
"aa1" => $gp["label"],
|
|
"aa2" => $value,
|
|
"aa3" => "",
|
|
"string_value" => $value
|
|
);
|
|
$results[] = array(
|
|
"test_code" => "suhu",
|
|
"test_name" => $this->translate_word("Suhu",$langid),
|
|
"result" => $result_suhu
|
|
);
|
|
}
|
|
else if ($gp['id_code'] != 'tanda_vital_5') {
|
|
|
|
$value = $this->translate_word($gp["value"],$langid) . ' ' . $this->translate_word($gp["unit"],$langid);
|
|
if ($gp["chx_y"] == "1") $value = $this->translate_word($gp["label_y"],$langid);
|
|
|
|
if ($gp["chx_x"] == "1") $value = $this->translate_word($gp["label_x"],$langid) . ' ' . $gp["value"] . ' ' . $this->translate_word($gp["unit"],$langid);
|
|
|
|
$result_vital[] = array(
|
|
"aa1" => $gp["label"],
|
|
"aa2" => $value,
|
|
"aa3" => ucwords(strtolower($gp["value_x"])),
|
|
"string_value" => $gp["label"]." : ".$value
|
|
);
|
|
}
|
|
else {
|
|
$kesimpulan = str_replace("Stadium", "Stage", $gp["value"]);
|
|
$value = $gp["value_x"] . '/' . $gp["value_y"] . ' ' . $this->translate_word($gp["unit"],$langid);
|
|
$string_value = $value;
|
|
if($kesimpulan != ''){
|
|
$string_value .= ' ( ' . $this->translate_word(ucwords(strtolower($kesimpulan)),$langid) . ' )';
|
|
}
|
|
$result_tensi[] = array(
|
|
"aa1" => $gp["label"],
|
|
"aa2" => $value,
|
|
"aa3" => ucwords(strtolower($kesimpulan)),
|
|
"string_value" => $string_value
|
|
);
|
|
$results[] = array(
|
|
"test_code" => "tensi",
|
|
"test_name" => $this->translate_word("Tekanan darah",$langid),
|
|
"result" => $result_tensi
|
|
);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
$results[] = array(
|
|
"test_code" => "vital_sign",
|
|
"test_name" => $this->translate_word("TANDA VITAL",$langid),
|
|
"result" => $result_vital
|
|
);
|
|
|
|
|
|
}
|
|
|
|
if ($d["title"] == "LAPANG PANDANG") {
|
|
$test_code = "fisik_lapangpandang";
|
|
$test_name = $this->translate_word("LAPANG PANDANG",$langid);
|
|
|
|
foreach ($d["details"] as $gp) {
|
|
if ($gp["chx_y"] == "1") $value = $this->translate_word($gp["label_y"],$langid);
|
|
|
|
if ($gp["chx_x"] == "1") $value = $this->translate_word($gp["label_x"],$langid);
|
|
|
|
$result[] = array(
|
|
"aa1" => $gp["label"],
|
|
"aa2" => $value,
|
|
"aa3" => "",
|
|
"string_value" => $value
|
|
);
|
|
}
|
|
|
|
$results[] = array(
|
|
"test_code" => $test_code,
|
|
"test_name" => $test_name,
|
|
"result" => $result
|
|
);
|
|
}
|
|
|
|
if ($d["title"] == "KEADAAN UMUM") {
|
|
|
|
$test_code = "fisik_keadaanumum";
|
|
$test_name = $this->translate_word("KEADAAN UMUM",$langid);
|
|
|
|
foreach ($d["details"] as $gp) {
|
|
$value = $gp["value"];
|
|
if ($gp["chx_x"] == "1") $value = $this->translate_word($gp["label_x"],$langid);
|
|
if ($gp["chx_y"] == "1") $value = $this->translate_word($gp["label_y"],$langid);
|
|
|
|
$result[] = array(
|
|
"rr1" => $gp["label"],
|
|
"rr2" => $value,
|
|
"rr3" => $gp["unit"],
|
|
"string_value" => $this->translate_word($gp["label"],$langid) . ' : ' . $value
|
|
);
|
|
}
|
|
|
|
$results[] = array(
|
|
"test_code" => $test_code,
|
|
"test_name" => $test_name,
|
|
"result" => $result
|
|
);
|
|
}
|
|
|
|
if ($d["title"] == "KEPALA WAJAH") {
|
|
$test_code = "fisik_kepalawajah";
|
|
$test_name = $this->translate_word("KEPALA WAJAH",$langid);
|
|
foreach ($d["details"] as $gp) {
|
|
if ($gp["chx"] == 1) {
|
|
$arr_result[] = array($gp["label"], $gp["value"]);
|
|
$string_value = $this->translate_word($gp["label"],$langid);
|
|
if($gp["value"] != ''){
|
|
$string_value .= ' ( ' . $this->translate_word($gp["value"],$langid) . ' )';
|
|
}
|
|
$result[] = array(
|
|
"bb1" => $gp["label"],
|
|
"bb2" => $gp["value"],
|
|
"string_value" => $string_value
|
|
);
|
|
}
|
|
}
|
|
|
|
if (empty($result)) {
|
|
$result[] = array(
|
|
"bb1" => $this->translate_word("Tidak diperiksa",$langid),
|
|
"bb2" => "",
|
|
"string_value" => $this->translate_word("Tidak diperiksa",$langid)
|
|
);
|
|
}
|
|
|
|
$results[] = array(
|
|
"test_code" => $test_code,
|
|
"test_name" => $test_name,
|
|
"result" => $result
|
|
);
|
|
}
|
|
|
|
if ($d["title"] == "MATA") {
|
|
$test_code = "fisik_mata";
|
|
$test_name = $this->translate_word("MATA",$langid);
|
|
foreach ($d["details"] as $gp) {
|
|
if ($gp["chx"] == 1) {
|
|
$arr_result[] = array($gp["label"], $gp["value"]);
|
|
$string_value = $this->translate_word($gp["label"],$langid);
|
|
if($gp["value"] != ''){
|
|
$string_value .= ' ( ' . $gp["value"] . ' )';
|
|
}
|
|
$result[] = array(
|
|
"cc1" => $gp["label"],
|
|
"cc2" => $gp["value"],
|
|
"string_value" => $string_value
|
|
);
|
|
}
|
|
}
|
|
|
|
if (empty($result)) {
|
|
$result[] = array(
|
|
"cc1" => $this->translate_word("Tidak diperiksa",$langid),
|
|
"cc2" => "",
|
|
"string_value" => $this->translate_word("Tidak diperiksa",$langid)
|
|
);
|
|
}
|
|
|
|
$results[] = array(
|
|
"test_code" => $test_code,
|
|
"test_name" => $test_name,
|
|
"result" => $result
|
|
);
|
|
}
|
|
|
|
if ($d["title"] == "TELINGA") {
|
|
|
|
$test_code = "fisik_telinga";
|
|
$test_name = $this->translate_word("TELINGA",$langid);
|
|
foreach ($d["details"] as $gp) {
|
|
if ($gp["chx"] == 1) {
|
|
$arr_result[] = array($gp["label"], $gp["value"]);
|
|
$string_value = $this->translate_word($gp["label"],$langid);
|
|
if($gp["value"] != ''){
|
|
$string_value .= ' ( ' . $gp["value"] . ' )';
|
|
}
|
|
$result[] = array(
|
|
"ee1" => $gp["label"],
|
|
"ee2" => $gp["value"],
|
|
"string_value" => $string_value
|
|
);
|
|
}
|
|
}
|
|
|
|
if (empty($result)) {
|
|
$result[] = array(
|
|
"ee1" => 'Tidak diperiksa',
|
|
"ee2" => '',
|
|
"string_value" => "Tidak diperiksa"
|
|
);
|
|
}
|
|
|
|
$results[] = array(
|
|
"test_code" => $test_code,
|
|
"test_name" => $test_name,
|
|
"result" => $result
|
|
);
|
|
}
|
|
|
|
if ($d["title"] == "HIDUNG") {
|
|
|
|
$test_code = "fisik_hidung";
|
|
$test_name = $this->translate_word("HIDUNG",$langid);
|
|
foreach ($d["details"] as $gp) {
|
|
if ($gp["chx"] == 1) {
|
|
$arr_result[] = array($gp["label"], $gp["value"]);
|
|
$string_value = $this->translate_word($gp["label"],$langid);
|
|
if($gp["value"] != ''){
|
|
$string_value .= ' ( ' . $gp["value"] . ' )';
|
|
}
|
|
$result[] = array(
|
|
"ff1" => $gp["label"],
|
|
"ff2" => $gp["value"],
|
|
"string_value" => $string_value
|
|
);
|
|
}
|
|
}
|
|
|
|
if (empty($result)) {
|
|
$result[] = array(
|
|
"ff1" => 'Tidak diperiksa',
|
|
"ff2" => '',
|
|
"string_value" => $this->translate_word("Tidak diperiksa",$langid)
|
|
);
|
|
}
|
|
|
|
$results[] = array(
|
|
"test_code" => $test_code,
|
|
"test_name" => $test_name,
|
|
"result" => $result
|
|
);
|
|
}
|
|
|
|
if ($d["title"] == "GIGI") {
|
|
$test_code = "fisik_gigi";
|
|
$test_name = $this->translate_word("GIGI",$langid);
|
|
|
|
foreach ($d["details"] as $gp) {
|
|
if ($gp["chx"] == 1) {
|
|
$arr_result[] = array($gp["label"], $gp["value"]);
|
|
$string_value = $this->translate_word($gp["label"],$langid);
|
|
if($gp["value"] != ''){
|
|
$string_value .= ' ( ' . $this->translate_word($gp["value"],$langid) . ' )';
|
|
}
|
|
$result[] = array(
|
|
"ff1" => $gp["label"],
|
|
"ff2" => $gp["value"],
|
|
"string_value" => $string_value
|
|
);
|
|
}
|
|
}
|
|
|
|
if (empty($result)) {
|
|
$result[] = array(
|
|
"ff1" => 'Tidak diperiksa',
|
|
"ff2" => '',
|
|
"string_value" => $this->translate_word("Tidak diperiksa",$langid)
|
|
);
|
|
}
|
|
|
|
$results[] = array(
|
|
"test_code" => $test_code,
|
|
"test_name" => $test_name,
|
|
"result" => $result
|
|
);
|
|
}
|
|
|
|
if ($d["title"] == "MULUT") {
|
|
|
|
$test_code = "fisik_mulut";
|
|
$test_name = $this->translate_word("MULUT",$langid);
|
|
foreach ($d["details"] as $gp) {
|
|
foreach ($gp["details"] as $xd) {
|
|
if ($xd["chx"] == 1) {
|
|
$arr_result[] = array($gp["name"], $xd["label"], $xd["value"]);
|
|
$string_value = $this->translate_word($gp["name"],$langid) . ' : ' . $this->translate_word($xd["label"],$langid);
|
|
if($xd["value"] != ''){
|
|
$string_value .= ' ( ' . $xd["value"] . ' )';
|
|
}
|
|
$result[] = array(
|
|
"hh1" => $gp["name"],
|
|
"hh2" => $xd["label"],
|
|
"hh3" => $xd["value"],
|
|
"string_value" => $string_value
|
|
);
|
|
}
|
|
}
|
|
}
|
|
|
|
if (empty($result)) {
|
|
$result[] = array(
|
|
"hh1" => 'Tidak diperiksa',
|
|
"hh2" => '',
|
|
"hh3" => '',
|
|
"string_value" => $this->translate_word("Tidak diperiksa",$langid)
|
|
);
|
|
}
|
|
|
|
$results[] = array(
|
|
"test_code" => $test_code,
|
|
"test_name" => $test_name,
|
|
"result" => $result
|
|
);
|
|
}
|
|
|
|
if ($d["title"] == "LEHER") {
|
|
$test_code = "fisik_leher";
|
|
$test_name = "LEHER";
|
|
foreach ($d["details"] as $gp) {
|
|
if ($gp["chx"] == 1) {
|
|
$arr_result[] = array($gp["label"], $gp["value"]);
|
|
$string_value = $this->translate_word($gp["label"],$langid);
|
|
if($gp["value"] != ''){
|
|
$string_value .= ' ( ' . $gp["value"] . ' )';
|
|
}
|
|
$result[] = array(
|
|
"ii1" => $gp["label"],
|
|
"ii2" => $gp["value"],
|
|
"string_value" => $string_value
|
|
);
|
|
}
|
|
}
|
|
|
|
if (empty($result)) {
|
|
$result[] = array(
|
|
"ii1" => "Tidak diperiksa",
|
|
"ii2" => "",
|
|
"string_value" => $this->translate_word("Tidak diperiksa",$langid)
|
|
);
|
|
}
|
|
|
|
$results[] = array(
|
|
"test_code" => $test_code,
|
|
"test_name" => $test_name,
|
|
"result" => $result
|
|
);
|
|
}
|
|
|
|
if ($d["title"] == "THORAX / DADA") {
|
|
$test_code = "fisik_thoraxdada";
|
|
$test_name = $this->translate_word("THORAX / DADA",$langid);
|
|
foreach ($d["details"] as $gp) {
|
|
if ($gp["chx"] == 1) {
|
|
$arr_result[] = array($gp["label"], $gp["value"]);
|
|
$string_value = $this->translate_word($gp["label"],$langid);
|
|
if($gp["value"] != ''){
|
|
$string_value .= ' ( ' . $gp["value"] . ' )';
|
|
}
|
|
$result[] = array(
|
|
"jj1" => $gp["label"],
|
|
"jj2" => $gp["value"],
|
|
"string_value" => $string_value
|
|
);
|
|
}
|
|
}
|
|
|
|
if (empty($result)) {
|
|
$result[] = array(
|
|
"jj1" => $this->translate_word("Tidak diperiksa",$langid),
|
|
"jj2" => "",
|
|
"string_value" => $this->translate_word("Tidak diperiksa",$langid)
|
|
);
|
|
}
|
|
|
|
$results[] = array(
|
|
"test_code" => $test_code,
|
|
"test_name" => $test_name,
|
|
"result" => $result
|
|
);
|
|
}
|
|
|
|
if ($d["title"] == "PARU-PARU") {
|
|
$test_code = "fisik_paruparu";
|
|
$test_name = $this->translate_word("PARU-PARU",$langid);
|
|
foreach ($d["details"] as $gp) {
|
|
if ($gp["chx"] == 1) {
|
|
$arr_result[] = array($gp["label"], $gp["value"]);
|
|
$string_value = $this->translate_word($gp["label"],$langid);
|
|
if($gp["value"] != ''){
|
|
$string_value .= ' ( ' . $gp["value"] . ' )';
|
|
}
|
|
$result[] = array(
|
|
"kk1" => $gp["label"],
|
|
"kk2" => $gp["value"],
|
|
"string_value" => $string_value
|
|
);
|
|
}
|
|
}
|
|
|
|
if (empty($result)) {
|
|
$result[] = array(
|
|
"kk1" => "Tidak diperiksa",
|
|
"kk2" => "",
|
|
"string_value" => $this->translate_word("Tidak diperiksa",$langid)
|
|
);
|
|
}
|
|
}
|
|
|
|
if ($d["title"] == "JANTUNG") {
|
|
$test_code = "fisik_jantung";
|
|
$test_name = $this->translate_word("JANTUNG",$langid);
|
|
foreach ($d["details"] as $gp) {
|
|
foreach ($gp["details"] as $xd) {
|
|
if ($xd["chx"] == 1) {
|
|
$arr_result[] = array($gp["name"], $xd["label"], $xd["value"]);
|
|
$string_value = $this->translate_word($gp["name"],$langid).' : '.$this->translate_word($xd["label"],$langid);
|
|
if($xd["value"] != ''){
|
|
$string_value .= ' ( ' . $xd["value"] . ' )';
|
|
}
|
|
$result[] = array(
|
|
"ll1" => $gp["name"],
|
|
"ll2" => $xd["label"],
|
|
"ll3" => $xd["value"],
|
|
"string_value" => $string_value
|
|
);
|
|
}
|
|
}
|
|
}
|
|
|
|
if (empty($result)) {
|
|
$result[] = array(
|
|
"ll1" => "Tidak diperiksa",
|
|
"ll2" => "",
|
|
"ll3" => "",
|
|
"string_value" => $this->translate_word("Tidak diperiksa",$langid)
|
|
);
|
|
}
|
|
|
|
$results[] = array(
|
|
"test_code" => $test_code,
|
|
"test_name" => $test_name,
|
|
"result" => $result
|
|
);
|
|
}
|
|
|
|
if ($d["title"] == "PERUT / ABDOMEN") {
|
|
|
|
$non_hernia_pengukuran = array();
|
|
$hernia = array();
|
|
$pengukuran = array();
|
|
foreach ($d["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"]);
|
|
$string_value = $this->translate_word($gp["name"],$langid).' : '.$this->translate_word($xd["label"],$langid);
|
|
if($xd["value"] != ''){
|
|
$string_value .= ' ( ' . $xd["value"] . ' )';
|
|
}
|
|
$non_hernia_pengukuran[] = array(
|
|
"mm1" => $gp["name"],
|
|
"mm2" => $xd["label"],
|
|
"mm3" => $xd["value"],
|
|
"string_value" => $string_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 .= " " . $this->translate_word($gp["details"][1]["details"][0]["label"],$langid);
|
|
}
|
|
//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 .= $this->translate_word($gp["details"][1]["details"][1]["chx_a_label"],$langid);
|
|
}
|
|
|
|
if ($gp["details"][1]["details"][1]["chx_b_value"] == 1) {
|
|
if ($ds_hasil != "") $ds_hasil .= ", ";
|
|
$ds_hasil .= $this->translate_word($gp["details"][1]["details"][1]["chx_b_label"],$langid);
|
|
}
|
|
|
|
if ($hasil_detail != "") $hasil_detail .= ", ";
|
|
$hasil_detail .= " " . $this->translate_word($gp["details"][1]["details"][1]["label"],$langid) . " (" . $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 .= $this->translate_word($gp["details"][1]["details"][1]["chx_a_label"],$langid);
|
|
}
|
|
|
|
if ($gp["details"][1]["details"][2]["chx_b_value"] == 1) {
|
|
if ($ds_hasil != "") $ds_hasil .= ", ";
|
|
$ds_hasil .= $this->translate_word($gp["details"][1]["details"][2]["chx_b_label"],$langid);
|
|
}
|
|
|
|
if ($hasil_detail != "") $hasil_detail .= ", ";
|
|
$hasil_detail .= " " . $this->translate_word($gp["details"][1]["details"][2]["label"],$langid) . " (" . $ds_hasil . ")";
|
|
}
|
|
|
|
|
|
|
|
$hernia[] = array(
|
|
"mm1" => $gp["name"],
|
|
"mm2" => $gp["details"][1]["label"],
|
|
"mm3" => $hasil . $hasil_detail,
|
|
"string_value" => $this->translate_word($gp["name"],$langid).' : '.$this->translate_word($gp["details"][1]["label"],$langid).' ( '.$hasil . $hasil_detail.' )'
|
|
);
|
|
}
|
|
if ($gp["details"][0]["chx"] == "1") {
|
|
$hernia[] = array(
|
|
"mm1" => $gp["name"],
|
|
"mm2" => $gp["details"][0]["label"],
|
|
"mm3" => "",
|
|
"string_value" => $gp["name"].' : '.$gp["details"][0]["label"]
|
|
);
|
|
}
|
|
} elseif ($gp["name"] == 'Pengukuran') {
|
|
$string_value = $this->translate_word($gp["details"][0]["label"],$langid) . " : " . $gp["details"][0]["value"] . " " . $this->translate_word($gp["details"][0]["unit"],$langid).', '.$this->translate_word($gp["details"][1]["label"],$langid) . " : " . $gp["details"][1]["value"] . " " . $this->translate_word($gp["details"][1]["unit"],$langid);
|
|
$pengukuran[] = 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"],
|
|
"string_value" => $string_value
|
|
);
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
if (empty($non_hernia_pengukuran)) {
|
|
$non_hernia_pengukuran[] = array(
|
|
"mm1" => "Tidak diperiksa",
|
|
"mm2" => "",
|
|
"mm3" => "",
|
|
"string_value" => $this->translate_word("Tidak diperiksa",$langid)
|
|
);
|
|
}
|
|
|
|
if (empty($hernia)) {
|
|
$hernia[] = array(
|
|
"mm1" => "Tidak diperiksa",
|
|
"mm2" => "",
|
|
"mm3" => "",
|
|
"string_value" => $this->translate_word("Tidak diperiksa",$langid)
|
|
);
|
|
}
|
|
|
|
if (empty($pengukuran)) {
|
|
$pengukuran[] = array(
|
|
"mm1" => "Tidak diperiksa",
|
|
"mm2" => "",
|
|
"mm3" => "",
|
|
"string_value" => $this->translate_word("Tidak diperiksa",$langid)
|
|
);
|
|
}
|
|
|
|
$results[] = array(
|
|
"test_code" => "fisik_perutabdomen",
|
|
"test_name" => $this->translate_word("PERUT / ABDOMEN",$langid),
|
|
"result" => $non_hernia_pengukuran
|
|
);
|
|
$results[] = array(
|
|
"test_code" => "fisik_hernia",
|
|
"test_name" => $this->translate_word("HERNIA",$langid),
|
|
"result" => $hernia
|
|
);
|
|
$results[] = array(
|
|
"test_code" => "fisik_pengukuran",
|
|
"test_name" => $this->translate_word("PENGUKURAN",$langid),
|
|
"result" => $pengukuran
|
|
);
|
|
|
|
|
|
}
|
|
|
|
if ($d["title"] == "GENITOURINARIA") {
|
|
$test_code = "fisik_genitourinaria";
|
|
$test_name = "GENITOURINARIA";
|
|
foreach ($d["details"] as $gp) {
|
|
if ($gp["chx"] == 1) {
|
|
$arr_result[] = array($gp["label"], $gp["value"]);
|
|
$string_value = $this->translate_word($gp["label"],$langid);
|
|
if($gp["value"] != ''){
|
|
$string_value .= ' ( ' . $gp["value"] . ' )';
|
|
}
|
|
$result[] = array(
|
|
"nn1" => $gp["label"],
|
|
"nn2" => $gp["value"],
|
|
"string_value" => $string_value
|
|
);
|
|
|
|
}
|
|
}
|
|
|
|
if (empty($result)) {
|
|
$result[] = array(
|
|
"nn1" => "Tidak diperiksa",
|
|
"nn2" => "",
|
|
"string_value" => $this->translate_word("Tidak diperiksa",$langid)
|
|
);
|
|
}
|
|
$results[] = array(
|
|
"test_code" => $test_code,
|
|
"test_name" => $test_name,
|
|
"result" => $result
|
|
);
|
|
}
|
|
|
|
if ($d["title"] == "ANGGOTA GERAK") {
|
|
$test_code = "fisik_anggotagerak";
|
|
$test_name = "ANGGOTA GERAK";
|
|
foreach ($d["details"] as $gp) {
|
|
foreach ($gp["details"] as $xd) {
|
|
if ($xd["chx"] == 1) {
|
|
$arr_result[] = array($gp["name"], $xd["label"], $xd["value"]);
|
|
$string_value = $this->translate_word($gp["name"],$langid).' : '.$this->translate_word($xd["label"],$langid);
|
|
if($xd["value"] != ''){
|
|
$string_value .= ' ( ' . $xd["value"] . ' )';
|
|
}
|
|
$result[] = array(
|
|
"oo1" => $gp["name"],
|
|
"oo2" => $xd["label"],
|
|
"oo3" => $xd["value"],
|
|
"string_value" => $string_value
|
|
);
|
|
}
|
|
}
|
|
}
|
|
|
|
if (empty($result)) {
|
|
$result[] = array(
|
|
"oo1" => "Tidak diperiksa",
|
|
"oo2" => "",
|
|
"oo3" => "",
|
|
"string_value" => $this->translate_word("Tidak diperiksa",$langid)
|
|
);
|
|
}
|
|
$results[] = array(
|
|
"test_code" => $test_code,
|
|
"test_name" => $test_name,
|
|
"result" => $result
|
|
);
|
|
}
|
|
|
|
if ($d["title"] == "SISTEM PERSYARAFAN") {
|
|
$test_code = "fisik_sistempersyarafan";
|
|
$test_name = "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"]);
|
|
$string_value = $this->translate_word($gp["name"],$langid).' : '.$this->translate_word($xd["label"],$langid);
|
|
if($xd["value"] != ''){
|
|
$string_value .= ' ( ' . $xd["value"] . ' )';
|
|
}
|
|
$result[] = array(
|
|
"pp1" => $gp["name"],
|
|
"pp2" => $xd["label"],
|
|
"pp3" => $xd["value"],
|
|
"string_value" => $string_value
|
|
);
|
|
}
|
|
}
|
|
}
|
|
|
|
if (empty($result)) {
|
|
$result[] = array(
|
|
"pp1" => "Tidak diperiksa",
|
|
"pp2" => "",
|
|
"pp3" => "",
|
|
"string_value" => $this->translate_word("Tidak diperiksa",$langid)
|
|
);
|
|
}
|
|
$results[] = array(
|
|
"test_code" => $test_code,
|
|
"test_name" => $test_name,
|
|
"result" => $result
|
|
);
|
|
}
|
|
|
|
if ($d["title"] == "SMELL TEST") {
|
|
$test_code = "fisik_smelltest";
|
|
$test_name = "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"]);
|
|
$string_value = $this->translate_word($gp["name"],$langid).' : '.$this->translate_word($xd["label"],$langid);
|
|
if($xd["value"] != ''){
|
|
$string_value .= ' ( ' . $xd["value"] . ' )';
|
|
}
|
|
if($d["is_inspected"] == 'Y'){
|
|
|
|
$result[] = array(
|
|
"xx1" => $gp["name"],
|
|
"xx2" => $xd["label"],
|
|
"xx3" => $xd["value"],
|
|
"xx4" => $d["is_inspected"],
|
|
"string_value" => $string_value
|
|
|
|
);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
if (empty($result)) {
|
|
$result[] = array(
|
|
"xx1" => "Tidak periksa",
|
|
"xx2" => "",
|
|
"xx3" => "",
|
|
"string_value" => $this->translate_word("Tidak diperiksa",$langid)
|
|
);
|
|
}
|
|
$results[] = array(
|
|
"test_code" => $test_code,
|
|
"test_name" => $test_name,
|
|
"result" => $result
|
|
);
|
|
|
|
}
|
|
|
|
if ($d["title"] == "SISTEM INTEGUMEN") {
|
|
$test_code = "fisik_sistemintegrumen";
|
|
$test_name = "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"]);
|
|
$string_value = $this->translate_word($gp["name"],$langid).' : '.$this->translate_word($xd["label"],$langid);
|
|
if($xd["value"] != ''){
|
|
$string_value .= ' ( ' . $xd["value"] . ' )';
|
|
}
|
|
$result[] = array(
|
|
"pp1" => $gp["name"],
|
|
"pp2" => $xd["label"],
|
|
"pp3" => $xd["value"],
|
|
"string_value" => $string_value
|
|
);
|
|
}
|
|
}
|
|
}
|
|
|
|
if (empty($result)) {
|
|
$result[] = array(
|
|
"pp1" => "Tidak periksa",
|
|
"pp2" => "",
|
|
"pp3" => "",
|
|
"string_value" => $this->translate_word("Tidak diperiksa",$langid)
|
|
);
|
|
}
|
|
$results[] = array(
|
|
"test_code" => $test_code,
|
|
"test_name" => $test_name,
|
|
"result" => $result
|
|
);
|
|
}
|
|
|
|
if ($d["title"] == "TONOMETRI") {
|
|
$test_code = "fisik_tonometri";
|
|
$test_name = "TONOMETRI";
|
|
|
|
foreach ($d["details"] as $gp) {
|
|
foreach ($gp["details"] as $xd) {
|
|
$string_value = $this->translate_word($xd["label"],$langid).' : '.$xd["value"]." ".$this->translate_word($xd["unit"],$langid);
|
|
$result[] = array(
|
|
"string_value" => $string_value
|
|
);
|
|
}
|
|
}
|
|
|
|
if (empty($result)) {
|
|
$result[] = array(
|
|
"string_value" => $this->translate_word("Tidak diperiksa",$langid)
|
|
);
|
|
}
|
|
$results[] = array(
|
|
"test_code" => $test_code,
|
|
"test_name" => $test_name,
|
|
"result" => $result
|
|
);
|
|
}
|
|
|
|
if ($d["title"] == "FAKTOR PSIKOLOGI") {
|
|
$test_code = "faktor_psikologi";
|
|
$test_name = $this->translate_word("FAKTOR PSIKOLOGI",$langid);
|
|
foreach ($d["details"] as $gp) {
|
|
if ($gp["chx"] == 1) {
|
|
|
|
$string_value = $gp["label"];
|
|
if($gp["value_sumber"] != ''){
|
|
$string_value .= ' , '.$this->translate_word("sumber",$langid).' : ' . $gp["value_sumber"] ;
|
|
}
|
|
if($gp["value_lama"] != ''){
|
|
$string_value .= ' , '.$this->translate_word("lama",$langid).' : ' . $gp["value_lama"] ;
|
|
}
|
|
|
|
$result[] = array(
|
|
"string_value" => $string_value
|
|
);
|
|
|
|
}
|
|
}
|
|
|
|
if (empty($result)) {
|
|
$result[] = array(
|
|
"string_value" => $this->translate_word("Tidak ada faktor psikologi",$langid)
|
|
);
|
|
}
|
|
$results[] = array(
|
|
"test_code" => $test_code,
|
|
"test_name" => $test_name,
|
|
"result" => $result
|
|
);
|
|
}
|
|
|
|
if ($d["title"] == "FAKTOR ERGONOMI") {
|
|
$test_code = "faktor_ergonomi";
|
|
$test_name = $this->translate_word("FAKTOR ERGONOMI",$langid);
|
|
foreach ($d["details"] as $gp) {
|
|
if ($gp["chx"] == 1) {
|
|
|
|
$string_value = $gp["label"];
|
|
if($gp["value_sumber"] != ''){
|
|
$string_value .= ' , sumber : ' . $gp["value_sumber"] ;
|
|
}
|
|
if($gp["value_lama"] != ''){
|
|
$string_value .= ' , lama : ' . $gp["value_lama"] ;
|
|
}
|
|
|
|
$result[] = array(
|
|
"string_value" => $string_value
|
|
);
|
|
|
|
}
|
|
}
|
|
|
|
if (empty($result)) {
|
|
$result[] = array(
|
|
"string_value" => $this->translate_word("Tidak ada faktor ergonomi",$langid)
|
|
);
|
|
}
|
|
$results[] = array(
|
|
"test_code" => $test_code,
|
|
"test_name" => $test_name,
|
|
"result" => $result
|
|
);
|
|
}
|
|
|
|
if ($d["title"] == "FAKTOR BIOLOGI") {
|
|
$test_code = "faktor_biologi";
|
|
$test_name = $this->translate_word("FAKTOR BIOLOGI",$langid);
|
|
foreach ($d["details"] as $gp) {
|
|
if ($gp["chx"] == 1) {
|
|
|
|
$string_value = $gp["label"];
|
|
if($gp["value_sumber"] != ''){
|
|
$string_value .= ' , '.$this->translate_word("sumber",$langid).' : ' . $gp["value_sumber"] ;
|
|
}
|
|
if($gp["value_lama"] != ''){
|
|
$string_value .= ' , '.$this->translate_word("lama",$langid).' : ' . $gp["value_lama"] ;
|
|
}
|
|
|
|
$result[] = array(
|
|
"string_value" => $string_value
|
|
);
|
|
|
|
}
|
|
}
|
|
|
|
if (empty($result)) {
|
|
$result[] = array(
|
|
"string_value" => $this->translate_word("Tidak ada faktor biologi",$langid)
|
|
);
|
|
}
|
|
$results[] = array(
|
|
"test_code" => $test_code,
|
|
"test_name" => $test_name,
|
|
"result" => $result
|
|
);
|
|
}
|
|
|
|
if ($d["title"] == "FAKTOR KIMIA") {
|
|
$test_code = "faktor_kimia";
|
|
$test_name = $this->translate_word("FAKTOR KIMIA",$langid);
|
|
foreach ($d["details"] as $gp) {
|
|
if ($gp["chx"] == 1) {
|
|
|
|
$string_value = $gp["label"];
|
|
if($gp["value_sumber"] != ''){
|
|
$string_value .= ' , '.$this->translate_word("sumber",$langid).' : ' . $gp["value_sumber"] ;
|
|
}
|
|
if($gp["value_lama"] != ''){
|
|
$string_value .= ' , '.$this->translate_word("lama",$langid).' : ' . $gp["value_lama"] ;
|
|
}
|
|
|
|
$result[] = array(
|
|
"string_value" => $string_value
|
|
);
|
|
|
|
}
|
|
}
|
|
|
|
if (empty($result)) {
|
|
$result[] = array(
|
|
"string_value" => $this->translate_word("Tidak ada faktor kimia",$langid)
|
|
);
|
|
}
|
|
$results[] = array(
|
|
"test_code" => $test_code,
|
|
"test_name" => $test_name,
|
|
"result" => $result
|
|
);
|
|
}
|
|
|
|
if ($d["title"] == "FAKTOR FISIK") {
|
|
$test_code = "faktor_fisik";
|
|
$test_name = $this->translate_word("FAKTOR FISIK",$langid);
|
|
foreach ($d["details"] as $gp) {
|
|
if ($gp["chx"] == 1) {
|
|
|
|
$string_value = $gp["label"];
|
|
if($gp["value_sumber"] != ''){
|
|
$string_value .= ' , '.$this->translate_word("sumber",$langid).' : ' . $gp["value_sumber"] ;
|
|
}
|
|
if($gp["value_lama"] != ''){
|
|
$string_value .= ' , '.$this->translate_word("lama",$langid).' : ' . $gp["value_lama"] ;
|
|
}
|
|
|
|
$result[] = array(
|
|
"string_value" => $string_value
|
|
);
|
|
|
|
}
|
|
}
|
|
|
|
if (empty($result)) {
|
|
$result[] = array(
|
|
"string_value" => $this->translate_word("Tidak ada faktor fisik",$langid)
|
|
);
|
|
}
|
|
$results[] = array(
|
|
"test_code" => $test_code,
|
|
"test_name" => $test_name,
|
|
"result" => $result
|
|
);
|
|
}
|
|
|
|
|
|
|
|
return $results;
|
|
}
|
|
|
|
function visus($id,$langid=1) {
|
|
$ret_array = [];
|
|
|
|
$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 AND
|
|
T_SamplingAdditionalFisikVisusIsActive = 'Y'
|
|
WHERE
|
|
So_ResultEntryID = ?
|
|
LIMIT 1";
|
|
$qry = $this->db_smartone->query($sql,array($id));
|
|
if (! $qry) {
|
|
return array("status" => "error", "message" => "Failed to generate visus", "data" => 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","6/6","6/7.5","6/7,5");
|
|
|
|
$value_visus_od = "20/20";
|
|
$value_visus_os = "20/20";
|
|
$status_kcmt = $this->translate_word("tanpa kacamata",$langid);
|
|
|
|
$normal_kanan = "";
|
|
if(in_array($row_result['T_SamplingAdditionalFisikVisusTKODV'], $normal) || in_array($row_result['T_SamplingAdditionalFisikVisusDKODV'], $normal) )
|
|
$normal_kanan = "(Normal)";
|
|
|
|
$normal_kiri = "";
|
|
if(in_array($row_result['T_SamplingAdditionalFisikVisusTKOSV'], $normal) || in_array($row_result['T_SamplingAdditionalFisikVisusDKOSV'], $normal) )
|
|
$normal_kiri = "(Normal)";
|
|
|
|
if($row_result['T_SamplingAdditionalFisikVisusTKODV'] == '6/7,5' || $row_result['T_SamplingAdditionalFisikVisusTKODV'] == '6/6' || $row_result['T_SamplingAdditionalFisikVisusTKODV'] == '6/7.5')
|
|
$value_visus_od = $row_result['T_SamplingAdditionalFisikVisusTKODV'] ;
|
|
|
|
if($row_result['T_SamplingAdditionalFisikVisusTKOSV'] == '6/7,5' || $row_result['T_SamplingAdditionalFisikVisusTKOSV'] == '6/6' || $row_result['T_SamplingAdditionalFisikVisusTKOSV'] == '6/7.5')
|
|
$value_visus_os = $row_result['T_SamplingAdditionalFisikVisusTKOSV'] ;
|
|
|
|
|
|
if((strtolower($row_result['T_SamplingAdditionalFisikVisusTKODV']) != "normal" && $row_result['T_SamplingAdditionalFisikVisusTKODV'] != "" && $row_result['T_SamplingAdditionalFisikVisusTKODV'] != "-") && ($row_result['T_SamplingAdditionalFisikVisusTKOSV'] != "" && $row_result['T_SamplingAdditionalFisikVisusTKOSV'] != "-")){
|
|
$visus_kiri = "";
|
|
$visus_kanan = "";
|
|
|
|
$visus[] = array(
|
|
"xx1" => $row_result['T_SamplingAdditionalFisikVisusTKODV'] == 'OFF' ? '': $this->translate_word("Tanpa Kacamata",$langid),
|
|
"xx2" => "OD : ",
|
|
"xx3" => $row_result['T_SamplingAdditionalFisikVisusTKODV'] == 'OFF' ? '': $row_result['T_SamplingAdditionalFisikVisusTKODV']
|
|
);
|
|
|
|
$visus[] = array(
|
|
"xx1" => $row_result['T_SamplingAdditionalFisikVisusTKOSV'] == 'OFF' ? '': $this->translate_word("Tanpa Kacamata",$langid),
|
|
"xx2" => "OS",
|
|
"xx3" => $row_result['T_SamplingAdditionalFisikVisusTKOSV'] == 'OFF' ? '': $row_result['T_SamplingAdditionalFisikVisusTKOSV']
|
|
);
|
|
|
|
$rst['kelainan'] = $this->translate_word("Kelainan refraksi (tanpa kacamata)",$langid);
|
|
$value_visus_od = $row_result['T_SamplingAdditionalFisikVisusTKODV'] == 'OFF' ? '': $row_result['T_SamplingAdditionalFisikVisusTKODV'];
|
|
$value_visus_os = $row_result['T_SamplingAdditionalFisikVisusTKOSV'] == 'OFF' ? '': $row_result['T_SamplingAdditionalFisikVisusTKOSV'];
|
|
$status_kcmt = $row_result['T_SamplingAdditionalFisikVisusTKODV'] == 'OFF' ? '': $this->translate_word("tanpa kacamata",$langid);
|
|
|
|
|
|
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." (".$this->translate_word("Miopia",$langid).")";
|
|
}
|
|
|
|
|
|
$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." (".$this->translate_word("Astigmatismus",$langid).")";
|
|
}else{
|
|
if($od_cyl != "" && $od_cyl != "-" && $od_cyl != "--" && $od_cyl != "/-" && $od_cyl != "/" && $od_cyl != "-/")
|
|
$visus_kanan .= " (".$this->translate_word("Astigmatismus",$langid).")";
|
|
}
|
|
//$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." (".$this->translate_word("Miopia",$langid).")";
|
|
}
|
|
|
|
$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." (".$this->translate_word("Astigmatismus",$langid).")";
|
|
}else{
|
|
if($os_cyl != "" && $os_cyl != "-")
|
|
$visus_kiri .= " (".$this->translate_word("Astigmatismus",$langid).")";
|
|
}
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(($row_result['T_SamplingAdditionalFisikVisusDKODV'] != "" && $row_result['T_SamplingAdditionalFisikVisusDKODV'] != "-") && ($row_result['T_SamplingAdditionalFisikVisusDKOSV'] != "" && $row_result['T_SamplingAdditionalFisikVisusDKOSV'] != "-")){
|
|
$visus_kiri = "";
|
|
$visus_kanan = "";
|
|
$visus[] = array(
|
|
"xx1" => $row_result['T_SamplingAdditionalFisikVisusDKODV'] == 'OFF' ? '': $this->translate_word("Dengan Kacamata",$langid),
|
|
"xx2" => "OD : ",
|
|
"xx3" => $row_result['T_SamplingAdditionalFisikVisusDKODV'] == 'OFF' ? '': $row_result['T_SamplingAdditionalFisikVisusDKODV']
|
|
);
|
|
|
|
$visus[] = array(
|
|
"xx1" => $row_result['T_SamplingAdditionalFisikVisusDKOSV'] == 'OFF' ? '': $this->translate_word("Dengan Kacamata",$langid),
|
|
"xx2" => "OS",
|
|
"xx3" => $row_result['T_SamplingAdditionalFisikVisusDKOSV'] == 'OFF' ? '': $row_result['T_SamplingAdditionalFisikVisusDKOSV']
|
|
);
|
|
|
|
$rst['kelainan'] = $this->translate_word("Kelainan refraksi (dengan kacamata)",$langid);
|
|
$value_visus_od = $row_result['T_SamplingAdditionalFisikVisusDKODV'] == 'OFF' ? '': $row_result['T_SamplingAdditionalFisikVisusDKODV'];
|
|
$value_visus_os = $row_result['T_SamplingAdditionalFisikVisusDKOSV'] == 'OFF' ? '': $row_result['T_SamplingAdditionalFisikVisusDKOSV'];
|
|
$status_kcmt = $row_result['T_SamplingAdditionalFisikVisusDKODV'] == 'OFF' ? '': $this->translate_word("dengan kacamata",$langid);
|
|
|
|
//if (!in_array($row_result['T_SamplingAdditionalFisikVisusDKODV'], $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." (".$this->translate_word("Miopia",$langid).")";
|
|
}
|
|
|
|
|
|
$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." (".$this->translate_word("Astigmatismus",$langid).")";
|
|
}else{
|
|
if($od_cyl != "" && $od_cyl != "-" && $od_cyl != "--" && $od_cyl != "/-" && $od_cyl != "/" && $od_cyl != "-/")
|
|
$visus_kanan .= " (".$this->translate_word("Astigmatismus",$langid).")";
|
|
}
|
|
//$value_koreksi_od .= "X (".$od_x.") ";
|
|
|
|
|
|
|
|
// }
|
|
|
|
//if (!in_array($row_result['T_SamplingAdditionalFisikVisusDKOSV'], $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." (".$this->translate_word("Miopia",$langid).")";
|
|
}
|
|
|
|
$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." (".$this->translate_word("Astigmatismus",$langid).")";
|
|
}else{
|
|
if($os_cyl != "" && $os_cyl != "-")
|
|
$visus_kiri .= " (".$this->translate_word("Astigmatismus",$langid).")";
|
|
}
|
|
|
|
|
|
//}
|
|
|
|
|
|
}
|
|
|
|
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 == '' && $row_result['T_SamplingAdditionalFisikVisusTKODV'] != 'OFF'){
|
|
$visus_kanan = "Miopia";
|
|
}
|
|
|
|
if (!in_array($row_result['T_SamplingAdditionalFisikVisusTKOSV'], $normal) && $visus_kiri == '' && $row_result['T_SamplingAdditionalFisikVisusTKOSV'] != 'OFF'){
|
|
$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 == '' && $row_result['T_SamplingAdditionalFisikVisusDKODV'] != 'OFF'){
|
|
$visus_kanan = "Miopia";
|
|
}
|
|
|
|
if (!in_array($row_result['T_SamplingAdditionalFisikVisusDKOSV'], $normal) && $visus_kiri == '' && $row_result['T_SamplingAdditionalFisikVisusDKOSV'] != 'OFF'){
|
|
$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." (".$this->translate_word("Presbiopia",$langid).")";
|
|
|
|
if ($visus_kiri != "") $visus_kiri .= ", ";
|
|
$visus_kiri .= $od_add." (".$this->translate_word("Presbiopia",$langid).")";
|
|
}
|
|
|
|
|
|
if($row_result['T_SamplingAdditionalFisikVisusTKODV'] != 'OFF' &&
|
|
$row_result['T_SamplingAdditionalFisikVisusTKOSV'] != 'OFF' &&
|
|
$row_result['T_SamplingAdditionalFisikVisusDKODV'] != 'OFF' &&
|
|
$row_result['T_SamplingAdditionalFisikVisusDKOSV'] != 'OFF'){
|
|
|
|
|
|
if($visus_kiri != '' || $pre_result_os != ''){
|
|
$normal_kiri = " ";
|
|
}
|
|
|
|
if($visus_kanan != '' || $pre_result_od != ''){
|
|
$normal_kanan = " ";
|
|
}
|
|
|
|
|
|
$pre_result_od = $value_visus_od." ".strtolower($this->translate_word($status_kcmt,$langid))." ".$normal_kanan;
|
|
$pre_result_os = $value_visus_os." ".strtolower($this->translate_word($status_kcmt,$langid))." ".$normal_kiri;
|
|
|
|
$real_visus_kiri = $visus_kiri;
|
|
$real_visus_kanan = $visus_kanan;
|
|
|
|
|
|
|
|
$hasil_kiri = $visus_kiri == ""? $pre_result_os:$pre_result_os."; ".$visus_kiri;
|
|
|
|
|
|
$hasil_kanan = $visus_kanan == ""?$pre_result_od:$pre_result_od."; ".$visus_kanan;
|
|
|
|
|
|
|
|
}
|
|
|
|
if($row_result['T_SamplingAdditionalFisikVisusTKODV'] == 'OFF' &&
|
|
$row_result['T_SamplingAdditionalFisikVisusTKOSV'] == 'OFF' &&
|
|
$row_result['T_SamplingAdditionalFisikVisusDKODV'] == 'OFF' &&
|
|
$row_result['T_SamplingAdditionalFisikVisusDKOSV'] == 'OFF'){
|
|
$hasil_kiri = $visus_kiri == ""? "Normal":$visus_kiri;
|
|
$hasil_kanan = $visus_kanan == ""? "Normal":$visus_kanan;
|
|
}
|
|
|
|
}else{
|
|
$hasil_kanan = $this->translate_word("Bahan belum",$langid);
|
|
$hasil_kiri = $this->translate_word("Bahan belum",$langid);
|
|
}
|
|
|
|
return array("status" => "success", "message" => "Visus generated successfully", "result" => array("hasil_kiri" => $hasil_kiri, "hasil_kanan" => $hasil_kanan));
|
|
|
|
|
|
}
|
|
|
|
function persepsi_warna($id,$langid=1)
|
|
{
|
|
$sql = "SELECT IFNULL(T_SamplingAdditionalFisikBWPWValue,'') as result, IFNULL(T_SamplingAdditionalFisikBWPWVAngka,'') as angka
|
|
FROM t_samplingso_additional_fisik_bw
|
|
WHERE
|
|
T_SamplingAdditionalFisikBWT_OrderHeaderID = ? AND T_SamplingAdditionalFisikBWIsActive = 'Y' LIMIT 1 ";
|
|
$qry = $this->db_smartone->query($sql, array($id));
|
|
//echo $this->db_smartone->last_query(); exit;
|
|
|
|
if (! $qry) {
|
|
return array("status" => "error", "message" => "Failed to generate persepsi warna", "data" => array());
|
|
}
|
|
$row_results = $qry->result_array();
|
|
if(count($row_results) == 0){
|
|
return array();
|
|
}
|
|
//keluhan saat ini
|
|
$persepsi_warna = array();
|
|
|
|
$row_result = $row_results[0];
|
|
if ($row_result['result'] == '' || $row_result['result'] == 'X') {
|
|
$persepsi_warna = array(
|
|
"t_test_code" => "fisik_persepsi_warna",
|
|
"t_test_name" => $this->translate_word("Kenal Warna",$langid),
|
|
"t_result" => $this->translate_word("Tidak diperiksa",$langid),
|
|
"string_value" => $this->translate_word("Tidak diperiksa",$langid)
|
|
|
|
);
|
|
} else {
|
|
$result = $this->translate_word("Normal",$langid);
|
|
if ($row_result['result'] == 'BW')
|
|
$result = $this->translate_word("Red Green Deficiency",$langid) . " (" . $row_result['angka'] . ")";
|
|
|
|
$persepsi_warna = array(
|
|
"t_test_code" => "fisik_persepsi_warna",
|
|
"t_test_name" => $this->translate_word("Kenal Warna",$langid),
|
|
"t_result" => $result,
|
|
"string_value" => $result
|
|
|
|
);
|
|
}
|
|
|
|
return $persepsi_warna;
|
|
}
|
|
|
|
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 status_gizi($id,$langid=1)
|
|
{
|
|
$sql = "SELECT *
|
|
FROM t_samplingso_additional_fisik_bbtb
|
|
WHERE
|
|
T_SamplingAdditionalFisikBBTBT_OrderHeaderID = $id AND T_SamplingAdditionalFisikBBTBIsActive = 'Y' LIMIT 1";
|
|
//echo $sql;
|
|
$qry = $this->db_smartone->query($sql);
|
|
if (! $qry) {
|
|
return array();
|
|
}
|
|
//echo $this->db_smartone->last_query();
|
|
$row_results = $qry->result_array();
|
|
if(count($row_results) == 0){
|
|
return array();
|
|
}
|
|
$row_result = $row_results[0];
|
|
|
|
$status_gizi = array();
|
|
$bb = $row_result["T_SamplingAdditionalFisikBBTBValueBB"];
|
|
$tb = $row_result["T_SamplingAdditionalFisikBBTBValueTB"];
|
|
$bodyfat = $row_result["T_SamplingAdditionalFisikBBTBBodyFat"] == -1 ? $this->translate_word("Tidak dilakukan",$langid) : $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(
|
|
"t_test_code" => "fisik_tinggibadan",
|
|
"t_test_name" => "Tinggi Badan",
|
|
"t_result" => $tb,
|
|
"t_string_value" => $tb
|
|
);
|
|
|
|
$status_gizi[] = array(
|
|
"t_test_code" => "fisik_beratbadan",
|
|
"t_test_name" => "Berat Badan",
|
|
"t_result" => $bb,
|
|
"t_string_value" => $bb
|
|
);
|
|
|
|
$status_gizi[] = array(
|
|
"t_test_code" => "fisik_bmi",
|
|
"t_test_name" => "BMI (" . $standart_text . ")",
|
|
"t_result" => $bmi,
|
|
"t_string_value" => $bmi
|
|
);
|
|
|
|
$status_gizi[] = array(
|
|
"t_test_code" => "fisik_klasifikasi_bmi",
|
|
"t_test_name" => "Klasifikasi BMI",
|
|
"t_result" => $classification,
|
|
"t_string_value" => $classification.' ( '.$standart_text.' )'
|
|
);
|
|
|
|
|
|
return $status_gizi;
|
|
}
|
|
|
|
function bodyfatmonitoring($id, $langid = 1, $type = "fisik")
|
|
{
|
|
$sql = " SELECT *
|
|
FROM t_samplingso_additional_fisik_bbtb
|
|
WHERE
|
|
T_SamplingAdditionalFisikBBTBT_OrderHeaderID = ? AND T_SamplingAdditionalFisikBBTBIsActive = 'Y' LIMIT 1";
|
|
$qry = $this->db_smartone->query($sql, array($id));
|
|
if (! $qry) {
|
|
return array();
|
|
}
|
|
$row_results = $qry->result_array();
|
|
if (count($rows) == 0) {
|
|
return array();
|
|
}
|
|
$row_result = $row_results[0];
|
|
$d = $row_result["T_SamplingAdditionalFisikBBTBBodyFat"];
|
|
//keluhan saat ini
|
|
$bodyfat = [];
|
|
$bodyfat[] = array(
|
|
"t_test_code" => "fisik_bodyfat",
|
|
"t_test_name" => "Body Fat",
|
|
"t_result" => $d . "%",
|
|
"t_string_value" => "Body Fat ( " . $d . "% )"
|
|
);
|
|
|
|
return $bodyfat;
|
|
}
|
|
}
|