|
@ -1,9 +1,10 @@ |
|
|
<?php |
|
|
<?php |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* |
|
|
* |
|
|
*/ |
|
|
*/ |
|
|
|
|
|
|
|
|
include_once(dirname(dirname(__FILE__))."/library/publicBase.php"); |
|
|
include_once(dirname(dirname(__FILE__)) . "/library/publicBase.php"); |
|
|
|
|
|
|
|
|
class index extends publicBase { |
|
|
class index extends publicBase { |
|
|
public function home() { |
|
|
public function home() { |
|
@ -31,7 +32,7 @@ class index extends publicBase { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public function ajax_update_case() { |
|
|
public function ajax_update_case() { |
|
|
$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')); |
|
|
$original = trim($this->post('original')); |
|
|
$original = trim($this->post('original')); |
|
@ -47,7 +48,7 @@ class index extends publicBase { |
|
|
|
|
|
|
|
|
public function ajax_search() { |
|
|
public function ajax_search() { |
|
|
$content = $this->post('content'); |
|
|
$content = $this->post('content'); |
|
|
if (empty($content))$this->ajax_json(false, '请输入方名'); |
|
|
if (empty($content)) $this->ajax_json(false, '请输入方名'); |
|
|
|
|
|
|
|
|
$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') : 100; |
|
|
$page_size = $this->post('page_size') ? $this->post('page_size') : 100; |
|
@ -56,11 +57,11 @@ class index extends publicBase { |
|
|
$data = $m_case->getCaseByName($content, $page_num, $page_size); |
|
|
$data = $m_case->getCaseByName($content, $page_num, $page_size); |
|
|
$total = $m_case->getCaseByNameTotal($content); |
|
|
$total = $m_case->getCaseByNameTotal($content); |
|
|
|
|
|
|
|
|
$this->ajax_json(true, '获取成功', array('total' => $total, 'current_page' => $page_num, 'total_page' => ceil($total/$page_size), 'list' => $data)); |
|
|
$this->ajax_json(true, '获取成功', array('total' => $total, 'current_page' => $page_num, 'total_page' => ceil($total / $page_size), 'list' => $data)); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public function ajax_case_detail() { |
|
|
public function ajax_case_detail() { |
|
|
$id = $this->get('id')+0; |
|
|
$id = $this->get('id') + 0; |
|
|
if (empty($id)) $this->ajax_json(false, '非法请求'); |
|
|
if (empty($id)) $this->ajax_json(false, '非法请求'); |
|
|
|
|
|
|
|
|
$m_case = new mCase(); |
|
|
$m_case = new mCase(); |
|
@ -73,11 +74,11 @@ class index extends publicBase { |
|
|
public function ajax_save_user_case() { |
|
|
public function ajax_save_user_case() { |
|
|
$uid = $this->post('uid'); |
|
|
$uid = $this->post('uid'); |
|
|
$token = $this->post('token'); |
|
|
$token = $this->post('token'); |
|
|
$case_id = $this->post('case_id')+0; |
|
|
$case_id = $this->post('case_id') + 0; |
|
|
if (empty($uid) || empty($token) || empty($case_id)) $this->ajax_json(false, '非法请求'); |
|
|
if (empty($uid) || empty($token) || empty($case_id)) $this->ajax_json(false, '非法请求'); |
|
|
|
|
|
|
|
|
$m_user = new mUser(); |
|
|
$m_user = new mUser(); |
|
|
$is_login = $m_user->validateToken($uid,$token); |
|
|
$is_login = $m_user->validateToken($uid, $token); |
|
|
if (!$is_login) $this->ajax_json(false, '请登录后操作'); |
|
|
if (!$is_login) $this->ajax_json(false, '请登录后操作'); |
|
|
|
|
|
|
|
|
$data = array( |
|
|
$data = array( |
|
@ -96,17 +97,17 @@ class index extends publicBase { |
|
|
$id = $m_user_case->createUserCase($uid, $case_id, $data); |
|
|
$id = $m_user_case->createUserCase($uid, $case_id, $data); |
|
|
if (!$id) $this->ajax_json(false, $m_user_case->getError()); |
|
|
if (!$id) $this->ajax_json(false, $m_user_case->getError()); |
|
|
|
|
|
|
|
|
$this->ajax_json(true, '保存成功',array('id' => $id)); |
|
|
$this->ajax_json(true, '保存成功', array('id' => $id)); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public function ajax_update_user_case() { |
|
|
public function ajax_update_user_case() { |
|
|
$uid = $this->post('uid'); |
|
|
$uid = $this->post('uid'); |
|
|
$token = $this->post('token'); |
|
|
$token = $this->post('token'); |
|
|
$id = $this->post('id')+0; |
|
|
$id = $this->post('id') + 0; |
|
|
if (empty($uid) || empty($token) || empty($id)) $this->ajax_json(false, '非法请求'); |
|
|
if (empty($uid) || empty($token) || empty($id)) $this->ajax_json(false, '非法请求'); |
|
|
|
|
|
|
|
|
$m_user = new mUser(); |
|
|
$m_user = new mUser(); |
|
|
$is_login = $m_user->validateToken($uid,$token); |
|
|
$is_login = $m_user->validateToken($uid, $token); |
|
|
if (!$is_login) $this->ajax_json(false, '请登录后操作'); |
|
|
if (!$is_login) $this->ajax_json(false, '请登录后操作'); |
|
|
|
|
|
|
|
|
$data = array( |
|
|
$data = array( |
|
@ -118,7 +119,7 @@ class index extends publicBase { |
|
|
$res = $m_user_case->updateUserCase($uid, $id, $data); |
|
|
$res = $m_user_case->updateUserCase($uid, $id, $data); |
|
|
if (!$res) $this->ajax_json(false, $m_user_case->getError()); |
|
|
if (!$res) $this->ajax_json(false, $m_user_case->getError()); |
|
|
|
|
|
|
|
|
$this->ajax_json(true, '保存成功',array('id' => $id)); |
|
|
$this->ajax_json(true, '保存成功', array('id' => $id)); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public function ajax_user_case_list() { |
|
|
public function ajax_user_case_list() { |
|
@ -127,7 +128,7 @@ class index extends publicBase { |
|
|
if (empty($uid) || empty($token)) $this->ajax_json(false, '非法请求'); |
|
|
if (empty($uid) || empty($token)) $this->ajax_json(false, '非法请求'); |
|
|
|
|
|
|
|
|
$m_user = new mUser(); |
|
|
$m_user = new mUser(); |
|
|
$is_login = $m_user->validateToken($uid,$token); |
|
|
$is_login = $m_user->validateToken($uid, $token); |
|
|
if (!$is_login) $this->ajax_json(false, '请登录后操作'); |
|
|
if (!$is_login) $this->ajax_json(false, '请登录后操作'); |
|
|
|
|
|
|
|
|
$page_num = $this->post('page_num') ? $this->post('page_num') : 1; |
|
|
$page_num = $this->post('page_num') ? $this->post('page_num') : 1; |
|
@ -138,11 +139,7 @@ class index extends publicBase { |
|
|
if (!$data) $this->ajax_json(false, $m_user_case->getError()); |
|
|
if (!$data) $this->ajax_json(false, $m_user_case->getError()); |
|
|
$total = $m_user_case->getUserCaseListCount($uid); |
|
|
$total = $m_user_case->getUserCaseListCount($uid); |
|
|
|
|
|
|
|
|
$return = array( |
|
|
$return = array('total' => $total, 'current_page' => $page_num, 'total_page' => ceil($total / $page_size)); |
|
|
'total' => $total, |
|
|
|
|
|
'current_page' => $page_num, |
|
|
|
|
|
'total_page' => ceil($total/$page_size) |
|
|
|
|
|
); |
|
|
|
|
|
$return = array_merge($return, $data); |
|
|
$return = array_merge($return, $data); |
|
|
|
|
|
|
|
|
$this->ajax_json(true, '获取成功', $return); |
|
|
$this->ajax_json(true, '获取成功', $return); |
|
@ -151,11 +148,11 @@ class index extends publicBase { |
|
|
public function ajax_user_case_detail() { |
|
|
public function ajax_user_case_detail() { |
|
|
$uid = $this->post('uid'); |
|
|
$uid = $this->post('uid'); |
|
|
$token = $this->post('token'); |
|
|
$token = $this->post('token'); |
|
|
$id = $this->post('id')+0; |
|
|
$id = $this->post('id') + 0; |
|
|
if (empty($uid) || empty($token) || empty($id)) $this->ajax_json(false, '非法请求'); |
|
|
if (empty($uid) || empty($token) || empty($id)) $this->ajax_json(false, '非法请求'); |
|
|
|
|
|
|
|
|
$m_user = new mUser(); |
|
|
$m_user = new mUser(); |
|
|
$is_login = $m_user->validateToken($uid,$token); |
|
|
$is_login = $m_user->validateToken($uid, $token); |
|
|
if (!$is_login) $this->ajax_json(false, '请登录后操作'); |
|
|
if (!$is_login) $this->ajax_json(false, '请登录后操作'); |
|
|
|
|
|
|
|
|
$m_user_case = new mUserCase(); |
|
|
$m_user_case = new mUserCase(); |
|
@ -173,31 +170,31 @@ class index extends publicBase { |
|
|
$data = $m_case->getCollectLog($page_num, $page_size); |
|
|
$data = $m_case->getCollectLog($page_num, $page_size); |
|
|
$total = $m_case->getCollectLogTotal(); |
|
|
$total = $m_case->getCollectLogTotal(); |
|
|
|
|
|
|
|
|
$this->ajax_json(true, '获取成功', array('total' => $total, 'current_page' => $page_num, 'total_page' => ceil($total/$page_size), 'list' => $data)); |
|
|
$this->ajax_json(true, '获取成功', array('total' => $total, 'current_page' => $page_num, 'total_page' => ceil($total / $page_size), 'list' => $data)); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public function ajax_login(){ |
|
|
public function ajax_login() { |
|
|
$code = $this->get('code'); |
|
|
$code = $this->get('code'); |
|
|
if (!$code)$this->ajax_json(false, '非法请求'); |
|
|
if (!$code) $this->ajax_json(false, '非法请求'); |
|
|
|
|
|
|
|
|
$m_user = new mUser(); |
|
|
$m_user = new mUser(); |
|
|
$uid = $m_user->getUid($code); |
|
|
$uid = $m_user->getUid($code); |
|
|
$token = $m_user->getToken($uid); |
|
|
$token = $m_user->getToken($uid); |
|
|
|
|
|
|
|
|
$this->ajax_json(true, '登录成功', array('uid' => $uid, 'token'=> $token)); |
|
|
$this->ajax_json(true, '登录成功', array('uid' => $uid, 'token' => $token)); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public function ajax_contact_us(){ |
|
|
public function ajax_contact_us() { |
|
|
$this->ajax_json(true, '获取成功',array('img_url'=> CONTACT_US_IMG_URL)); |
|
|
$this->ajax_json(true, '获取成功', array('img_url' => CONTACT_US_IMG_URL)); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public function export_user_case_list(){ |
|
|
public function export_user_case_list() { |
|
|
$uid = $this->post('uid'); |
|
|
$uid = $this->post('uid'); |
|
|
$token = $this->post('token'); |
|
|
$token = $this->post('token'); |
|
|
if (empty($uid) || empty($token)) $this->ajax_json(false, '非法请求'); |
|
|
if (empty($uid) || empty($token)) $this->ajax_json(false, '非法请求'); |
|
|
|
|
|
|
|
|
$m_user = new mUser(); |
|
|
$m_user = new mUser(); |
|
|
$is_login = $m_user->validateToken($uid,$token); |
|
|
$is_login = $m_user->validateToken($uid, $token); |
|
|
if (!$is_login) $this->ajax_json(false, '请登录后操作'); |
|
|
if (!$is_login) $this->ajax_json(false, '请登录后操作'); |
|
|
|
|
|
|
|
|
$page_num = $this->post('page_num') ? $this->post('page_num') : 1; |
|
|
$page_num = $this->post('page_num') ? $this->post('page_num') : 1; |
|
@ -214,17 +211,17 @@ class index extends publicBase { |
|
|
$robj->setex($data_key, 60, json_encode($data)); |
|
|
$robj->setex($data_key, 60, json_encode($data)); |
|
|
$pdf_url = $m_user_case->createPdf($uid, $data_key); |
|
|
$pdf_url = $m_user_case->createPdf($uid, $data_key); |
|
|
|
|
|
|
|
|
$this->ajax_json(true, '获取成功', array('total' => $total, 'current_page' => $page_num, 'total_page' => ceil($total/$page_size), 'pdf_url' => $pdf_url)); |
|
|
$this->ajax_json(true, '获取成功', array('total' => $total, 'current_page' => $page_num, 'total_page' => ceil($total / $page_size), 'pdf_url' => $pdf_url)); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public function export_user_case(){ |
|
|
public function export_user_case() { |
|
|
$uid = $this->post('uid'); |
|
|
$uid = $this->post('uid'); |
|
|
$token = $this->post('token'); |
|
|
$token = $this->post('token'); |
|
|
$id = $this->post('id')+0; |
|
|
$id = $this->post('id') + 0; |
|
|
if (empty($uid) || empty($token) || empty($id)) $this->ajax_json(false, '非法请求'); |
|
|
if (empty($uid) || empty($token) || empty($id)) $this->ajax_json(false, '非法请求'); |
|
|
|
|
|
|
|
|
$m_user = new mUser(); |
|
|
$m_user = new mUser(); |
|
|
$is_login = $m_user->validateToken($uid,$token); |
|
|
$is_login = $m_user->validateToken($uid, $token); |
|
|
if (!$is_login) $this->ajax_json(false, '请登录后操作'); |
|
|
if (!$is_login) $this->ajax_json(false, '请登录后操作'); |
|
|
|
|
|
|
|
|
$m_user_case = new mUserCase(); |
|
|
$m_user_case = new mUserCase(); |
|
@ -237,26 +234,26 @@ class index extends publicBase { |
|
|
$robj->setex($data_key, 60, json_encode($data)); |
|
|
$robj->setex($data_key, 60, json_encode($data)); |
|
|
$pdf_url = $m_user_case->createPdf($uid, $data_key); |
|
|
$pdf_url = $m_user_case->createPdf($uid, $data_key); |
|
|
|
|
|
|
|
|
$this->ajax_json(true, '获取成功',array('pdf_url'=> $pdf_url)); |
|
|
$this->ajax_json(true, '获取成功', array('pdf_url' => $pdf_url)); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public function export_pdf(){ |
|
|
public function export_pdf() { |
|
|
$key = $this->get('key'); |
|
|
$key = $this->get('key'); |
|
|
|
|
|
|
|
|
$m_user_case = new mUserCase(); |
|
|
$m_user_case = new mUserCase(); |
|
|
$robj = $m_user_case->initRedis(); |
|
|
$robj = $m_user_case->initRedis(); |
|
|
$data = $robj->get($key); |
|
|
$data = $robj->get($key); |
|
|
|
|
|
|
|
|
$this->view['data'] = json_decode($data,true); |
|
|
$this->view['data'] = json_decode($data, true); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public function ajax_mail(){ |
|
|
public function ajax_mail() { |
|
|
$uid = $this->post('uid'); |
|
|
$uid = $this->post('uid'); |
|
|
$token = $this->post('token'); |
|
|
$token = $this->post('token'); |
|
|
if (empty($uid) || empty($token)) $this->ajax_json(false, '非法请求'); |
|
|
if (empty($uid) || empty($token)) $this->ajax_json(false, '非法请求'); |
|
|
|
|
|
|
|
|
$mUser = new mUser(); |
|
|
$mUser = new mUser(); |
|
|
$is_login = $mUser->validateToken($uid,$token); |
|
|
$is_login = $mUser->validateToken($uid, $token); |
|
|
if (!$is_login) $this->ajax_json(false, '请登录后操作'); |
|
|
if (!$is_login) $this->ajax_json(false, '请登录后操作'); |
|
|
|
|
|
|
|
|
$email = $this->post('email'); |
|
|
$email = $this->post('email'); |
|
@ -271,7 +268,7 @@ class index extends publicBase { |
|
|
if ($directory_name != $uid) $this->ajax_json(false, '非法请求'); |
|
|
if ($directory_name != $uid) $this->ajax_json(false, '非法请求'); |
|
|
|
|
|
|
|
|
$mUserCase = new mUserCase(); |
|
|
$mUserCase = new mUserCase(); |
|
|
$res = $mUserCase->sendMail(array($email),date('Y年m月d日',time()).'-医案导出','',sprintf(USER_CASE_PDF_PATH, $uid) . basename($pdf_url)); |
|
|
$res = $mUserCase->sendMail(array($email), date('Y年m月d日', time()) . '-医案导出', '', sprintf(USER_CASE_PDF_PATH, $uid) . basename($pdf_url)); |
|
|
if (!$res) $this->ajax_json(true, '发送失败'); |
|
|
if (!$res) $this->ajax_json(true, '发送失败'); |
|
|
|
|
|
|
|
|
$this->ajax_json(true, '发送成功'); |
|
|
$this->ajax_json(true, '发送成功'); |
|
|