126 lines
4.3 KiB
PHP
126 lines
4.3 KiB
PHP
<?php
|
|
class Terminologi extends MY_Controller{
|
|
var $db;
|
|
function __construct()
|
|
{
|
|
parent::__construct();
|
|
$this->load->library('Satusehat');
|
|
}
|
|
|
|
function index()
|
|
{
|
|
echo "Terminologi";
|
|
}
|
|
|
|
function getterminologicategory()
|
|
{
|
|
$prm = $this->sys_input;
|
|
try {
|
|
$orderheaderID = $prm['orderheaderID'];
|
|
|
|
// get terminology category
|
|
$sql = "SELECT code_system, code, display
|
|
FROM one_terminology.terminology
|
|
WHERE attribute_path = 'DiagnosticReport.category'
|
|
";
|
|
|
|
$qry = $this->db->query($sql, []);
|
|
$last_qry = $this->db->last_query();
|
|
|
|
if (!$qry) {
|
|
$error = array(
|
|
"message" => $this->db->error()["message"],
|
|
"sql" => $last_qry
|
|
);
|
|
$this->sys_error_db($error);
|
|
exit;
|
|
}
|
|
$result_cek = $qry->result_array();
|
|
|
|
// Add auto-incremented ID
|
|
$incrementedId = 1;
|
|
foreach ($result_cek as &$row) {
|
|
$row['id'] = (string)$incrementedId;
|
|
$incrementedId++;
|
|
}
|
|
|
|
echo json_encode($result_cek);
|
|
} catch (Exception $exc) {
|
|
$message = $exc->getMessage();
|
|
$this->sys_error($message);
|
|
}
|
|
}
|
|
function getterminologicategorycodesystem()
|
|
{
|
|
|
|
$prm = $this->sys_input;
|
|
try {
|
|
$orderheaderID = $prm['orderheaderID'];
|
|
|
|
// get terminology conclusion
|
|
$sql = "SELECT code_system, code, display
|
|
FROM one_terminology.terminology
|
|
WHERE resource_type = 'DiagnosticReport'
|
|
AND code_system = ?
|
|
AND (code LIKE ? OR display LIKE ?)
|
|
";
|
|
$qry = $this->db->query($sql, [$prm['code_system'], $prm['code'] . '%', $prm['code'] . '%']);
|
|
$last_qry = $this->db->last_query();
|
|
|
|
if (!$qry) {
|
|
$error = array(
|
|
"message" => $this->db->error()["message"],
|
|
"sql" => $last_qry
|
|
);
|
|
$this->sys_error_db($error);
|
|
exit;
|
|
}
|
|
$result_cek = $qry->result_array();
|
|
// Add auto-incremented ID
|
|
foreach ($result_cek as &$row) {
|
|
$row['id'] = $row['code'];
|
|
}
|
|
|
|
echo json_encode($result_cek);
|
|
} catch (Exception $exc) {
|
|
$message = $exc->getMessage();
|
|
$this->sys_error($message);
|
|
}
|
|
}
|
|
function groubbycodesystem() {
|
|
try {
|
|
$orderheaderID = $prm['orderheaderID'];
|
|
|
|
// get terminology conclusion
|
|
$sql = "SELECT DISTINCT code_system
|
|
FROM one_terminology.terminology
|
|
WHERE resource_type= 'DiagnosticReport'
|
|
Group by code_system
|
|
";
|
|
|
|
$qry = $this->db->query($sql, []);
|
|
$last_qry = $this->db->last_query();
|
|
|
|
if (!$qry) {
|
|
$error = array(
|
|
"message" => $this->db->error()["message"],
|
|
"sql" => $last_qry
|
|
);
|
|
$this->sys_error_db($error);
|
|
exit;
|
|
}
|
|
$result_cek = $qry->result_array();
|
|
// Add auto-incremented ID
|
|
$incrementedId = 1;
|
|
foreach ($result_cek as &$row) {
|
|
$row['id'] = $row['code_system'];
|
|
}
|
|
|
|
echo json_encode($result_cek);
|
|
} catch (Exception $exc) {
|
|
$message = $exc->getMessage();
|
|
$this->sys_error($message);
|
|
}
|
|
}
|
|
}
|
|
?>
|