Add report template endpoint for setup MCU
This commit is contained in:
@@ -39,6 +39,57 @@ class Setupmcucponev7 extends MY_Controller
|
||||
Mgm_McuReportLastUpdatedUserID = VALUES(Mgm_McuReportLastUpdatedUserID)";
|
||||
$this->db_onedev->query($sql, array($mgmMcuID, $templateID, $userID, $userID));
|
||||
}
|
||||
|
||||
function get_report_template_mcu()
|
||||
{
|
||||
if (!$this->isLogin) {
|
||||
$this->sys_error("Invalid Token");
|
||||
exit;
|
||||
}
|
||||
|
||||
$prm = $this->sys_input;
|
||||
$mgmMcuID = 0;
|
||||
if (isset($prm['Mgm_McuID'])) {
|
||||
$mgmMcuID = intval($prm['Mgm_McuID']);
|
||||
}
|
||||
|
||||
$sql = "SELECT
|
||||
t.Mcu_ReportUrlTemplateID AS id,
|
||||
t.Mcu_ReportUrlTemplateName AS reportName,
|
||||
t.Mcu_ReportUrlTemplateType AS reportType,
|
||||
t.Mcu_ReportUrlTemplateUrl AS reportUrl,
|
||||
t.Mcu_ReportUrlTemplateParams AS reportParams,
|
||||
IF(mr.Mgm_McuReportMcu_ReportUrlTemplateID = t.Mcu_ReportUrlTemplateID, 'Y', 'N') AS selected
|
||||
FROM mcu_report_url_template t
|
||||
LEFT JOIN mgm_mcureport mr
|
||||
ON mr.Mgm_McuReportMcu_ReportUrlTemplateID = t.Mcu_ReportUrlTemplateID
|
||||
AND mr.Mgm_McuReportMgm_McuID = ?
|
||||
AND mr.Mgm_McuReportIsActive = 'Y'
|
||||
WHERE t.Mcu_ReportUrlTemplateIsActive = 'Y'
|
||||
ORDER BY t.Mcu_ReportUrlTemplateName ASC";
|
||||
$query = $this->db_onedev->query($sql, array($mgmMcuID));
|
||||
if (!$query) {
|
||||
$this->sys_error_db("mcu_report_url_template select", $this->db_onedev);
|
||||
exit;
|
||||
}
|
||||
|
||||
$rows = $query->result_array();
|
||||
$selected = null;
|
||||
foreach ($rows as $row) {
|
||||
if ($row['selected'] === 'Y') {
|
||||
$selected = $row;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$result = array(
|
||||
"total" => count($rows),
|
||||
"records" => $rows,
|
||||
"selected" => $selected
|
||||
);
|
||||
$this->sys_ok($result);
|
||||
exit;
|
||||
}
|
||||
public function index()
|
||||
{
|
||||
echo "Patient API";
|
||||
|
||||
Reference in New Issue
Block a user