Files
BE_IBL/application/controllers/mockup/resultentrysoxray-v2/Email.php
2026-04-15 15:24:12 +07:00

70 lines
2.1 KiB
PHP

<?php
class Email extends MY_Controller
{
var $db_onedev;
public function index()
{
echo "Resultentry API";
}
public function __construct()
{
parent::__construct();
$this->db_onedev = $this->load->database("onedev", true);
$this->load->helper(array('form', 'url'));
}
function save() {
$prm = $this->sys_input;
$userid = $this->sys_user["M_UserID"];
if (! $this->isLogin) {
$this->sys_error("Invalid Token");
exit;
}
$orderID = $prm["orderID"];
$url = $prm["url"];
$type = $prm["type"];
if (strtolower($type) == "xray" ) $type = "Rontgen";
if (strtolower($type) == "bdm" ) $type = "BMD";
$format = $prm["format"];
$re_id=0;
$userid = $this->sys_user["M_UserID"];
$sql = "insert into t_email_nonlab(T_EmailNonLabT_OrderHeaderID,T_EmailNonLabType,
T_EmailNonLabFormat, T_EmailNonLabUrl, T_EmailNonLabResultEntryID,T_EmailNonLabUserID)
values(?,?,?,?,?,?)
on duplicate key update
T_EmailNonLabFormat = ? , T_EmailNonLabUrl = ? , T_EmailNonLabResultEntryID = ?,
T_EmailNonLabUserID = ? ";
$query= $this->db_onedev->query($sql,array($orderID, $type,$format, $url, $re_id,$userid,
$format, $url, $re_id, $userid));
if ($query) {
$this->sys_ok("");
exit;
}
$msg = array(
"message" => print_r($this->db_onedev->error(), true) ,
"query" => $this->db_onedev->last_query()
);
$this->sys_error($msg);
}
function get() {
$prm = $this->sys_input;
if (! $this->isLogin) {
$this->sys_error("Invalid Token");
exit;
}
$orderID = $prm["orderID"];
$type= $prm["type"];
if ($type == "xray") $type = "Rontgen";
$sql = "select * from t_email_nonlab where T_EmailNonLabT_OrderHeaderID = ?
and T_EmailNonLabType=?";
$qry = $this->db_onedev->query($sql, array($orderID,$type)) ;
$rows = array();
if ($qry) {
$rows = $qry->result_array();
}
$this->sys_ok($rows);
}
}