|
@ -26,28 +26,17 @@ class index extends publicBase { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public function login() { |
|
|
public function login() { |
|
|
$name = $this->get('name'); |
|
|
$name = trim($this->get('name')); |
|
|
$password = $this->get('password'); |
|
|
$password = trim($this->get('password')); |
|
|
|
|
|
|
|
|
$m_user = new mUser(); |
|
|
$m_user = new mUser(); |
|
|
$robj = $m_user->initRedis(); |
|
|
$m_user->createAdminPassWord(); |
|
|
|
|
|
|
|
|
$user_info = $robj->get(_QR_ADMIN_USER_INFO); |
|
|
|
|
|
if (!empty($name) && !empty($password)) { |
|
|
if (!empty($name) && !empty($password)) { |
|
|
$user_info = json_decode($user_info, true); |
|
|
$res = $m_user->checkAdminLogin($name, $password); |
|
|
if ($user_info['name'] == $name && $user_info['password'] == $password) { |
|
|
if (!$res) $this->show_message($m_user->getError(), '/index/login'); |
|
|
//设置登录状态 |
|
|
|
|
|
$robj->setex(_QR_ADMIN_LOGIN_USER_INFO, 12 * 60 * 60, json_encode(array('uid' => 0, 'token' => $m_user->getToken(0)))); |
|
|
|
|
|
header('Location: /index/home'); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (empty($user_info)) { |
|
|
header('Location: /index/home'); |
|
|
$email = ADMIN_PASSWORD_GET_EMAIL; |
|
|
|
|
|
$pass = bin2hex(openssl_random_pseudo_bytes(8)); |
|
|
|
|
|
$robj->setex(_QR_ADMIN_USER_INFO, 12 * 60 * 60, json_encode(array('name' => 'admin', 'password' => $pass))); |
|
|
|
|
|
|
|
|
|
|
|
$m_user->sendMail(array($email), '医案录入后台', '新密码是:' . $pass); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -108,6 +97,7 @@ class index extends publicBase { |
|
|
public function ajax_save_formula() { |
|
|
public function ajax_save_formula() { |
|
|
$uinfo = $this->_check_login(); |
|
|
$uinfo = $this->_check_login(); |
|
|
|
|
|
|
|
|
|
|
|
$id = $this->post('id') + 0; |
|
|
$name = trim($this->post('name')); |
|
|
$name = trim($this->post('name')); |
|
|
$source = trim($this->post('source')); |
|
|
$source = trim($this->post('source')); |
|
|
$method = trim($this->post('method')); |
|
|
$method = trim($this->post('method')); |
|
@ -121,27 +111,27 @@ class index extends publicBase { |
|
|
if (!$request_times) $this->ajax_json(false, $mformula->getError()); |
|
|
if (!$request_times) $this->ajax_json(false, $mformula->getError()); |
|
|
|
|
|
|
|
|
//新增药方 |
|
|
//新增药方 |
|
|
$id = $mformula->createFormula($uinfo['uid'], $name, $source, $method, $herbs); |
|
|
$id = $mformula->formula($uinfo['uid'], $id, $name, $source, $method, $herbs); |
|
|
if (!$id) $this->ajax_json(false, $mformula->getError()); |
|
|
if (!$id) $this->ajax_json(false, $mformula->getError()); |
|
|
|
|
|
|
|
|
$this->ajax_json(true, '添加成功', array('id' => $id)); |
|
|
$this->ajax_json(true, '成功', array('id' => $id)); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public function ajax_update_formula() { |
|
|
// public function ajax_update_formula() { |
|
|
$uinfo = $this->_check_login(); |
|
|
// $uinfo = $this->_check_login(); |
|
|
|
|
|
// |
|
|
$id = $this->post('id') + 0; |
|
|
// $id = $this->post('id') + 0; |
|
|
$name = trim($this->post('name')); |
|
|
// $name = trim($this->post('name')); |
|
|
$source = trim($this->post('source')); |
|
|
// $source = trim($this->post('source')); |
|
|
$method = trim($this->post('method')); |
|
|
// $method = trim($this->post('method')); |
|
|
$herbs = $this->post('herbs'); |
|
|
// $herbs = $this->post('herbs'); |
|
|
|
|
|
// |
|
|
$mformula = new mFormula(); |
|
|
// $mformula = new mFormula(); |
|
|
$res = $mformula->saveFormula($uinfo['uid'], $id, $name, $source, $method, $herbs); |
|
|
// $res = $mformula->saveFormula($uinfo['uid'], $id, $name, $source, $method, $herbs); |
|
|
if (!$res) $this->ajax_json(false, $mformula->getError()); |
|
|
// if (!$res) $this->ajax_json(false, $mformula->getError()); |
|
|
|
|
|
// |
|
|
$this->ajax_json(true, '保存成功'); |
|
|
// $this->ajax_json(true, '保存成功'); |
|
|
} |
|
|
// } |
|
|
|
|
|
|
|
|
public function ajax_user_formula() { |
|
|
public function ajax_user_formula() { |
|
|
$uinfo = $this->_check_login(); |
|
|
$uinfo = $this->_check_login(); |
|
@ -193,7 +183,6 @@ class index extends publicBase { |
|
|
$page_num = $this->post('page_num') ? $this->post('page_num') : 1; |
|
|
$page_num = $this->post('page_num') ? $this->post('page_num') : 1; |
|
|
$page_size = $this->post('page_size') ? $this->post('page_size') : 20; |
|
|
$page_size = $this->post('page_size') ? $this->post('page_size') : 20; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$condition = array(); |
|
|
$condition = array(); |
|
|
$condition['uid'] = array(0, $uinfo['uid']); |
|
|
$condition['uid'] = array(0, $uinfo['uid']); |
|
|
if ($content) $condition['name'] = $content; |
|
|
if ($content) $condition['name'] = $content; |
|
@ -356,9 +345,8 @@ class index extends publicBase { |
|
|
public function export_user_case() { |
|
|
public function export_user_case() { |
|
|
$uinfo = $this->_check_login(); |
|
|
$uinfo = $this->_check_login(); |
|
|
|
|
|
|
|
|
$id = $this->post('id') + 0; |
|
|
|
|
|
|
|
|
|
|
|
//导出单个医案 |
|
|
//导出单个医案 |
|
|
|
|
|
$id = $this->post('id') + 0; |
|
|
if ($id > 0) { |
|
|
if ($id > 0) { |
|
|
$post_url = USER_CASE_HTML_URL; |
|
|
$post_url = USER_CASE_HTML_URL; |
|
|
$data = array( |
|
|
$data = array( |
|
@ -369,11 +357,17 @@ class index extends publicBase { |
|
|
|
|
|
|
|
|
//导出全部医案 |
|
|
//导出全部医案 |
|
|
if ($id == 0) { |
|
|
if ($id == 0) { |
|
|
|
|
|
$start_date = $this->post('start_date'); |
|
|
|
|
|
if (empty($start_date)) $this->ajax_json(false, '请选择导出开始时间'); |
|
|
|
|
|
|
|
|
|
|
|
$end_date = $this->post('end_date'); |
|
|
|
|
|
if (empty($end_date)) $this->ajax_json(false, '请选择导出结束时间'); |
|
|
|
|
|
|
|
|
$post_url = USER_CASE_LIST_HTML_URL; |
|
|
$post_url = USER_CASE_LIST_HTML_URL; |
|
|
$data = array( |
|
|
$data = array( |
|
|
"uid" => $uinfo['uid'], |
|
|
"uid" => $uinfo['uid'], |
|
|
"start_date" => $this->post('start_date'), |
|
|
"start_date" => $start_date, |
|
|
"end_date" => $this->post('end_date'), |
|
|
"end_date" => $end_date, |
|
|
); |
|
|
); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -399,20 +393,13 @@ class index extends publicBase { |
|
|
|
|
|
|
|
|
public function user_case_list() { |
|
|
public function user_case_list() { |
|
|
$uid = $this->post('uid') + 0; |
|
|
$uid = $this->post('uid') + 0; |
|
|
if (empty($uid)) $this->ajax_json(false, '参数错误'); |
|
|
|
|
|
|
|
|
|
|
|
$start_date = $this->post('start_date'); |
|
|
$start_date = $this->post('start_date'); |
|
|
if (empty($start_date)) $this->ajax_json(false, '请选择导出开始时间'); |
|
|
|
|
|
|
|
|
|
|
|
$end_date = $this->post('end_date'); |
|
|
$end_date = $this->post('end_date'); |
|
|
if (empty($end_date)) $this->ajax_json(false, '请选择导出结束时间'); |
|
|
$page_num = 1; |
|
|
|
|
|
$page_size = 500; |
|
|
$page_num = $this->post('page_num') ? $this->post('page_num') : 1; |
|
|
|
|
|
$page_size = $this->post('page_size') ? $this->post('page_size') : 500; |
|
|
|
|
|
|
|
|
|
|
|
$m_user_case = new mUserCase(); |
|
|
$m_user_case = new mUserCase(); |
|
|
$data = $m_user_case->getUserCaseListPdfInfo($uid, $page_num, $page_size, $start_date, $end_date); |
|
|
$data = $m_user_case->getUserCaseListPdfInfo($uid, $page_num, $page_size, $start_date, $end_date); |
|
|
if (!$data) $this->ajax_json(false, $m_user_case->getError()); |
|
|
|
|
|
|
|
|
|
|
|
$this->view['data'] = $data; |
|
|
$this->view['data'] = $data; |
|
|
$this->setViewTpl('index/export_pdf.html'); |
|
|
$this->setViewTpl('index/export_pdf.html'); |
|
@ -421,11 +408,9 @@ class index extends publicBase { |
|
|
public function user_case() { |
|
|
public function user_case() { |
|
|
$id = $this->post('id') + 0; |
|
|
$id = $this->post('id') + 0; |
|
|
$uid = $this->post('uid') + 0; |
|
|
$uid = $this->post('uid') + 0; |
|
|
if (empty($uid) || empty($id)) $this->ajax_json(false, '参数错误'); |
|
|
|
|
|
|
|
|
|
|
|
$m_user_case = new mUserCase(); |
|
|
$m_user_case = new mUserCase(); |
|
|
$data = $m_user_case->getUserCasePdfInfo($uid, $id); |
|
|
$data = $m_user_case->getUserCasePdfInfo($uid, $id); |
|
|
if (!$data) $this->ajax_json(false, $m_user_case->getError()); |
|
|
|
|
|
|
|
|
|
|
|
$this->view['data'] = array($data); |
|
|
$this->view['data'] = array($data); |
|
|
$this->setViewTpl('index/export_pdf.html'); |
|
|
$this->setViewTpl('index/export_pdf.html'); |
|
|