82 lines
2.9 KiB
PHP
82 lines
2.9 KiB
PHP
<?php
|
|
class Lisrspad extends MY_Controller
|
|
{
|
|
function __construct()
|
|
{
|
|
parent::__construct();
|
|
}
|
|
function index()
|
|
{
|
|
echo "Api: Get Hasil RSPAD";
|
|
}
|
|
function gethasil()
|
|
{
|
|
try {
|
|
$prm = $this->sys_input;
|
|
$pid = $prm['pid'];
|
|
$pid = "";
|
|
if (isset($prm['pid'])) {
|
|
$pid = trim($prm["pid"]);
|
|
}
|
|
$username = "ADMIN";
|
|
|
|
if ($pid == "") {
|
|
|
|
$this->sys_error_db("pid is mandatory");
|
|
exit;
|
|
}
|
|
|
|
$sql = "call sp_rpt_t_hasil_rspad(?, ?)";
|
|
$qry = $this->db->query($sql, array($pid, $username));
|
|
if (!$qry) {
|
|
$this->sys_error_db("save warehouse location error", $this->db->last_query());
|
|
exit;
|
|
}
|
|
$this->clean_mysqli_connection($this->db->conn_id);
|
|
$rows = $qry->result_array();
|
|
$data = array(
|
|
"no_reg" => $rows[0]["T_OrderHeaderLabNumber"],
|
|
"nama" => $rows[0]["M_PatientName"],
|
|
"pengirim" => $rows[0]["M_DoctorName"],
|
|
"kel_pelanggan" => $rows[0]["M_CompanyName"],
|
|
"alamat" => $rows[0]["M_PatientAddressDescription"],
|
|
"tanggal_reg" => $rows[0]["T_OrderHeaderDate"],
|
|
"pid" => $rows[0]["T_OrderHeaderLabNumber"],
|
|
"jenis_kelamin" => $rows[0]["M_SexName"],
|
|
"tgl_lahir" => $rows[0]["T_OrderHeaderM_PatientAge"],
|
|
"no_tlp" => $rows[0]["M_PatientHP"],
|
|
"hp" => $rows[0]["M_PatientPhone"],
|
|
);
|
|
// $dtl = array();
|
|
// $rawGroup = array();
|
|
// foreach ($rows as $key => $val) {
|
|
// $rawGroup[] = $val['Nat_SubGroupName'];
|
|
// }
|
|
// $rawSubGroup = array();
|
|
// foreach ($rows as $key => $val) {
|
|
// $rawSubGroup[] = $val['Nat_SubgroupID'];
|
|
// }
|
|
// $grup = array_unique($rawGroup);
|
|
$details = array();
|
|
foreach ($rows as $key => $val) {
|
|
$dtl = array(
|
|
"jenis_pemeriksaan" => $val["T_TestNameAA"],
|
|
"hasil" => $val["T_OrderDetailResult"],
|
|
"nilai_rujukan" => $val["T_OrderDetailNormalValueNote"],
|
|
"satuan" => $val["Nat_UnitName"],
|
|
"metode" => $val["T_OrderdetailNat_MethodeName"],
|
|
);
|
|
$details[] = $dtl;
|
|
}
|
|
$data['details'] = $details;
|
|
$result = array(
|
|
"records" => $data,
|
|
);
|
|
$this->sys_ok($result);
|
|
} catch (Exception $exc) {
|
|
$message = $exc->getMessage();
|
|
$this->sys_error($message);
|
|
}
|
|
}
|
|
}
|