Files
BE_IBL/application/controllers/tools/one-health/Encounterconditionlab.php
2026-04-15 15:23:57 +07:00

44 lines
1.9 KiB
PHP

<?php
class Encounterconditionlab extends MY_Controller
{
public function __construct()
{
parent::__construct();
$this->db_onedev = $this->load->database("onedev", true);
}
function show()
{
try {
//# cek token valid
$prm = $this->sys_input;
$sdate = date('Y-m-d',strtotime($prm['startdate']));
$edate = date('Y-m-d',strtotime($prm['enddate']));
$sql = $this->db_onedev->query("SELECT M_BranchIPAddress as branch_ip_address FROM m_branch WHERE M_BranchIsDefault = 'Y'")->row();
$branch_ip_address = $sql->branch_ip_address;
$url = "http://$branch_ip_address/one-api/tools/satu_sehat/condition/status/$sdate/$edate";
$post_rst = $this->post($url);
// echo "to $url \nresponse : $post_rst\n";
$j_rst = json_decode($post_rst,true);
$result = array ("total" => 1, "records" => array("xid" => 0),"pesan"=>$post_rst);
$this->sys_ok($result);
} catch(Exception $exc) {
$message = $exc->getMessage();
$this->sys_error($message);
}
}
function post($url) {
//$data = $data;
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$result = curl_exec($ch);
//echo "RST : $result ";
return $result;
}
}