Files
REG_IBL/one-api/application/controllers/mockup/fo/registration/Delivery.php
2026-05-25 20:01:37 +07:00

56 lines
1.8 KiB
PHP

<?php
class Delivery extends MY_Controller
{
var $db_smartone;
public function index()
{
echo "Patient API";
}
public function __construct()
{
parent::__construct();
$this->db_smartone = $this->load->database("onedev", true);
}
public function search()
{
$prm = $this->sys_input;
$q = [
"patient_id" => 0,
"doctor_id" => 0,
"mou_id" => 0
];
if (isset($prm['patient_id']))
$q["patient_id"] = $prm['patient_id'];
if (isset($prm['doctor_id']))
$q["doctor_id"] = $prm['doctor_id'];
if (isset($prm['mou_id']))
$q["mou_id"] = $prm['mou_id'];
$sql = "CALL sp_fo_delivery_address('', '{$q['patient_id']}', '{$q['doctor_id']}', '{$q['mou_id']}')";
$query = $this->db_smartone->query($sql);
if ($query) {
$rows= $query->row();
$data = json_decode($rows->x);
$result = array("records" => $data);
$this->sys_ok($result);
exit;
} else {
$this->sys_error_db("delivery address",$this->db_smartone);
exit;
}
// $rows = array();
// $rows[] = array("id" =>1, "name" => "Ambil Sendiri", "selected" => false, "note" => "");
// $rows[] = array("id" =>2, "name" => "Kirim ke dokter", "selected" => false, "note" => "");
// $rows[] = array("id" =>3, "name" => "Kirim ke email pasien", "selected" => false, "note" => "");
// $rows[] = array("id" =>4, "name" => "Kirim ke email dokter", "selected" => false, "note" => "");
// $rows[] = array("id" =>5, "name" => "Kirim ke alamat utama pasien", "selected" => false, "note" => "");
// $rows[] = array("id" =>6, "name" => "Kirim ke alamat utama dokter", "selected" => false, "note" => "");
// $rows[] = array("id" =>7, "name" => "Kirim ke rekanan");
}
}