|
|
@ -118,9 +118,9 @@ class index extends publicBase { |
|
|
|
$m_user_case = new mUserCase(); |
|
|
|
|
|
|
|
//生成唯一id 防止重复请求 |
|
|
|
$request_id = md5($uinfo['uid'].$case_id.$data['name'].$data['patient_name']); |
|
|
|
$request_times = $m_user_case->requestLimit(sprintf(_QR_REQUEST_LIMIT, $request_id),1,60); |
|
|
|
if(!$request_times) $this->ajax_json(false, $m_user_case->getError()); |
|
|
|
$request_id = md5($uinfo['uid'] . $case_id . $data['name'] . $data['patient_name']); |
|
|
|
$request_times = $m_user_case->requestLimit(sprintf(_QR_REQUEST_LIMIT, $request_id), 1, 60); |
|
|
|
if (!$request_times) $this->ajax_json(false, $m_user_case->getError()); |
|
|
|
|
|
|
|
$id = $m_user_case->createUserCase($uinfo['uid'], $case_id, $data); |
|
|
|
if (!$id) $this->ajax_json(false, $m_user_case->getError()); |
|
|
@ -228,70 +228,54 @@ class index extends publicBase { |
|
|
|
$this->ajax_json(true, '获取成功', array('img_url' => CONTACT_US_IMG_URL)); |
|
|
|
} |
|
|
|
|
|
|
|
public function export_user_case_list() { |
|
|
|
public function export_user_case() { |
|
|
|
$uinfo = $this->_check_login(); |
|
|
|
|
|
|
|
$page_num = $this->post('page_num') ? $this->post('page_num') : 1; |
|
|
|
$page_size = $this->post('page_size') ? $this->post('page_size') : 100; |
|
|
|
$id = $this->post('id') + 0; |
|
|
|
if ($id) { |
|
|
|
$post_url = USER_CASE_HTML_URL; |
|
|
|
$data = array( |
|
|
|
"uid" => $uinfo['uid'], |
|
|
|
"id" => $id, |
|
|
|
); |
|
|
|
} else { |
|
|
|
$post_url = USER_CASE_LIST_HTML_URL; |
|
|
|
$data = array( |
|
|
|
"uid" => $uinfo['uid'], |
|
|
|
); |
|
|
|
} |
|
|
|
|
|
|
|
$data = array( |
|
|
|
"uid" => $this->post('uid'), |
|
|
|
"token" => $this->post('token'), |
|
|
|
"page_num" => $page_num, |
|
|
|
"page_size" => $page_size, |
|
|
|
); |
|
|
|
$m_user_case = new mUserCase(); |
|
|
|
$return = $m_user_case->postCUrl(USER_CASE_LIST_HTML_URL, $data); |
|
|
|
$return = $m_user_case->postCUrl($post_url, $data); |
|
|
|
|
|
|
|
$res = json_decode($return, 1); |
|
|
|
if (isset($res['info'])) $this->ajax_json(false, $res['info']); |
|
|
|
|
|
|
|
$pdf_name = md5($uinfo['uid'] . $page_num . $page_size); |
|
|
|
$pdf_url = $m_user_case->createPdf($uinfo['uid'], $pdf_name, $return); |
|
|
|
|
|
|
|
$total = $m_user_case->getUserCaseListCount($uinfo['uid']); |
|
|
|
$rdata = array( |
|
|
|
'total' => $total, |
|
|
|
'per_page' => $page_size, |
|
|
|
'last_page' => ceil($total / $page_size), |
|
|
|
'current_page' => $page_num, |
|
|
|
'data' => $pdf_url, |
|
|
|
); |
|
|
|
|
|
|
|
$this->ajax_json(true, '获取成功', $rdata); |
|
|
|
} |
|
|
|
$pdf_name = md5($uinfo['uid'] . $id) . ".pdf"; |
|
|
|
$m_user_case->createPdf($uinfo['uid'], $pdf_name, $return); |
|
|
|
|
|
|
|
public function export_user_case() { |
|
|
|
$uinfo = $this->_check_login(); |
|
|
|
|
|
|
|
$id = $this->post('id') + 0; |
|
|
|
if (empty($id)) $this->ajax_json(false, '参数错误'); |
|
|
|
$email = $this->post('email'); |
|
|
|
if (!empty($email)) { |
|
|
|
if (!filter_var($email, FILTER_VALIDATE_EMAIL)) $this->ajax_json(false, '邮箱地址无效'); |
|
|
|
|
|
|
|
$data = array( |
|
|
|
"uid" => $this->post('uid'), |
|
|
|
"token" => $this->post('token'), |
|
|
|
"id" => $id, |
|
|
|
); |
|
|
|
$m_user_case = new mUserCase(); |
|
|
|
$return = $m_user_case->postCUrl(USER_CASE_HTML_URL, $data); |
|
|
|
$res = $m_user_case->sendMail(array($email), date('Y年m月d日', time()) . '-医案导出', '', sprintf(USER_CASE_PDF_PATH, $uinfo['uid']) . $pdf_name); |
|
|
|
if (!$res) $this->ajax_json(true, '发送失败'); |
|
|
|
|
|
|
|
$res = json_decode($return, 1); |
|
|
|
if (isset($res['info'])) $this->ajax_json(false, $res['info']); |
|
|
|
$this->ajax_json(true, '发送成功'); |
|
|
|
} |
|
|
|
|
|
|
|
$pdf_name = md5($uinfo['uid'] . $id); |
|
|
|
$pdf_url = $m_user_case->createPdf($uinfo['uid'], $pdf_name, $return); |
|
|
|
|
|
|
|
$this->ajax_json(true, '获取成功', array('pdf_url' => $pdf_url)); |
|
|
|
$this->ajax_json(true, '获取成功', array('pdf_url' => sprintf(USER_CASE_PDF_URL, $uinfo['uid']) . $pdf_name)); |
|
|
|
} |
|
|
|
|
|
|
|
public function user_case_list() { |
|
|
|
$uinfo = $this->_check_login(); |
|
|
|
$uid = $this->post('uid') + 0; |
|
|
|
if (empty($uid)) $this->ajax_json(false, '参数错误'); |
|
|
|
|
|
|
|
$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') : 500; |
|
|
|
|
|
|
|
$m_user_case = new mUserCase(); |
|
|
|
$data = $m_user_case->getUserCaseListPdfInfo($uinfo['uid'], $page_num, $page_size); |
|
|
|
$data = $m_user_case->getUserCaseListPdfInfo($uid, $page_num, $page_size); |
|
|
|
if (!$data) $this->ajax_json(false, $m_user_case->getError()); |
|
|
|
|
|
|
|
$this->view['data'] = $data['user_case']; |
|
|
@ -299,37 +283,15 @@ class index extends publicBase { |
|
|
|
} |
|
|
|
|
|
|
|
public function user_case() { |
|
|
|
$uinfo = $this->_check_login(); |
|
|
|
|
|
|
|
$id = $this->post('id') + 0; |
|
|
|
if (empty($id)) $this->ajax_json(false, '参数错误'); |
|
|
|
$uid = $this->post('uid') + 0; |
|
|
|
if (empty($uid) || empty($id)) $this->ajax_json(false, '参数错误'); |
|
|
|
|
|
|
|
$m_user_case = new mUserCase(); |
|
|
|
$data = $m_user_case->getUserCasePdfInfo($uinfo['uid'], $id); |
|
|
|
$data = $m_user_case->getUserCasePdfInfo($uid, $id); |
|
|
|
if (!$data) $this->ajax_json(false, $m_user_case->getError()); |
|
|
|
|
|
|
|
$this->view['data'] = $data['user_case']; |
|
|
|
$this->setViewTpl('index/export_pdf.html'); |
|
|
|
} |
|
|
|
|
|
|
|
public function ajax_mail() { |
|
|
|
$uinfo = $this->_check_login(); |
|
|
|
|
|
|
|
$email = $this->post('email'); |
|
|
|
if (empty($email)) $this->ajax_json(false, '邮箱地址不能为空'); |
|
|
|
if (!filter_var($email, FILTER_VALIDATE_EMAIL)) $this->ajax_json(false, '邮箱地址无效'); |
|
|
|
|
|
|
|
$pdf_url = $this->post('pdf_url'); |
|
|
|
if (empty($pdf_url)) $this->ajax_json(false, 'pdf地址不能为空'); |
|
|
|
if (!filter_var($pdf_url, FILTER_VALIDATE_URL)) $this->ajax_json(false, 'pdf地址无效'); |
|
|
|
|
|
|
|
$directory_name = basename(dirname($pdf_url)); |
|
|
|
if ($directory_name != $uinfo['uid']) $this->ajax_json(false, '参数错误'); |
|
|
|
|
|
|
|
$mUserCase = new mUserCase(); |
|
|
|
$res = $mUserCase->sendMail(array($email), date('Y年m月d日', time()) . '-医案导出', '', sprintf(USER_CASE_PDF_PATH, $uinfo['uid']) . basename($pdf_url)); |
|
|
|
if (!$res) $this->ajax_json(true, '发送失败'); |
|
|
|
|
|
|
|
$this->ajax_json(true, '发送成功'); |
|
|
|
} |
|
|
|
} |
|
|
|