From b529890b6c8f4bbb05312a7967cf5e470973ae94 Mon Sep 17 00:00:00 2001 From: pengda <10266652509@qq.com> Date: Tue, 3 Sep 2024 10:27:55 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=86=E9=A1=B5=E7=9B=B8=E5=85=B3=E4=BC=98?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- control/index.php | 45 ++++++++++++-------------- index.php | 1 - view/templates/index/export_pdf.html | 62 ++++++++++++++++++++++++++++++++++++ view/templates/index/user_case.html | 62 ------------------------------------ 4 files changed, 82 insertions(+), 88 deletions(-) create mode 100644 view/templates/index/export_pdf.html delete mode 100644 view/templates/index/user_case.html diff --git a/control/index.php b/control/index.php index bc63cda..e4c78f6 100644 --- a/control/index.php +++ b/control/index.php @@ -13,9 +13,6 @@ class index extends publicBase { $data = $m_case->getCaseInfo($id); $this->view['data'] = $data; - - $this->setViewFormat('html'); - $this->setViewTpl('index/home.html'); } public function ajax_save_case() { @@ -77,11 +74,11 @@ class index extends publicBase { $uid = $this->post('uid'); $token = $this->post('token'); $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(); $is_login = $m_user->validateToken($uid,$token); - if(!$is_login)$this->ajax_json(false, '请登录后操作'); + if(!$is_login) $this->ajax_json(false, '请登录后操作'); $data = array( 'name' => trim($this->post('name')), @@ -97,7 +94,7 @@ class index extends publicBase { $m_user_case = new mUserCase(); $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)); } @@ -155,15 +152,15 @@ class index extends publicBase { $uid = $this->post('uid'); $token = $this->post('token'); $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(); $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(); $data = $m_user_case->getUserCaseInfo($uid, $id); - if(!$data)$this->ajax_json(false, $m_user_case->getError()); + if(!$data) $this->ajax_json(false, $m_user_case->getError()); $this->ajax_json(true, '获取成功', $data); } @@ -212,18 +209,18 @@ class index extends publicBase { public function export_user_case_list(){ $uid = $this->post('uid'); $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(); $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_size = $this->post('page_size') ? $this->post('page_size') : 100; $m_user_case = new mUserCase(); $data = $m_user_case->getUserCaseList($uid, array(), $page_num, $page_size, true, true); - 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); $data_key = sprintf(RQ_USER_CASE_DATA, $uid, 0); @@ -239,15 +236,15 @@ class index extends publicBase { $uid = $this->post('uid'); $token = $this->post('token'); $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(); $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(); $data = $m_user_case->getUserCaseInfo($uid, $id, true); - if(!$data)$this->ajax_json(false, $m_user_case->getError()); + if(!$data) $this->ajax_json(false, $m_user_case->getError()); $data_key = sprintf(RQ_USER_CASE_DATA, $uid, $id); @@ -267,33 +264,31 @@ class index extends publicBase { $data = $robj->get($key); $this->view['data'] = json_decode($data,true); - $this->setViewFormat('html'); - $this->setViewTpl('index/user_case.html'); } public function ajax_mail(){ $uid = $this->post('uid'); $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(); $is_login = $mUser->validateToken($uid,$token); - if(!$is_login)$this->ajax_json(false, '请登录后操作'); + if(!$is_login) $this->ajax_json(false, '请登录后操作'); $email = $this->post('email'); - if(empty($email))$this->ajax_json(false, '邮箱地址不能为空'); - if(!filter_var($email, FILTER_VALIDATE_EMAIL))$this->ajax_json(false, '邮箱地址无效'); + 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地址无效'); + 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 != $uid)$this->ajax_json(false, '非法请求'); + if($directory_name != $uid) $this->ajax_json(false, '非法请求'); $mUserCase = new mUserCase(); $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, '发送成功'); } diff --git a/index.php b/index.php index 6d490a8..f058e13 100644 --- a/index.php +++ b/index.php @@ -13,7 +13,6 @@ } private function beforecheckpara() { - $this->para['viewFormat'] = 'json'; } private function checkpara() { diff --git a/view/templates/index/export_pdf.html b/view/templates/index/export_pdf.html new file mode 100644 index 0000000..5cef995 --- /dev/null +++ b/view/templates/index/export_pdf.html @@ -0,0 +1,62 @@ + + + + + + + + 首页 + + {literal} + + {/literal} + + +
我的医案
+ {foreach from=$data.list key=key item=item} +
{$item.name}
+
{$item.patient_name},{$item.patient_sex},{$item.patient_age}岁,{$item.case_time}诊
+
{$item.patient_say}
+
{$item.first_diagnosis}
+
{$item.diagnosis}
+
+
处方   共{$item.prescribe_num}付
+
{$item.case_info}{$item.case_herb_info}
+
+
{$item.feedback}
+ {/foreach} + + diff --git a/view/templates/index/user_case.html b/view/templates/index/user_case.html deleted file mode 100644 index 5cef995..0000000 --- a/view/templates/index/user_case.html +++ /dev/null @@ -1,62 +0,0 @@ - - - - - - - - 首页 - - {literal} - - {/literal} - - -
我的医案
- {foreach from=$data.list key=key item=item} -
{$item.name}
-
{$item.patient_name},{$item.patient_sex},{$item.patient_age}岁,{$item.case_time}诊
-
{$item.patient_say}
-
{$item.first_diagnosis}
-
{$item.diagnosis}
-
-
处方   共{$item.prescribe_num}付
-
{$item.case_info}{$item.case_herb_info}
-
-
{$item.feedback}
- {/foreach} - -