Browse Source

药方模型

pull/1/head
pengda 9 months ago
parent
commit
2ddc0df796
  1. 10
      control/index.php
  2. 6
      model/mFormula.php
  3. 14
      model/mUserCase.php

10
control/index.php

@ -43,7 +43,11 @@ class index extends publicBase {
}
if (empty($user_info)) {
$robj->setex(_QR_ADMIN_USER_INFO, 12 * 60 * 60, json_encode(array('name' => 'admin', 'password' => bin2hex(openssl_random_pseudo_bytes(8)))));
$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);
}
}
@ -273,7 +277,7 @@ class index extends publicBase {
$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;
$page_size = $this->post('page_size') ? $this->post('page_size') : 20;
$m_user_case = new mUserCase();
$data = $m_user_case->getUserCaseList($uinfo['uid'], $page_num, $page_size);
@ -305,7 +309,7 @@ class index extends publicBase {
public function ajax_collect_log() {
$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') : 20;
$mformula = new mFormula();
$data = $mformula->getCollectLog($page_num, $page_size);

6
model/mFormula.php

@ -235,7 +235,7 @@ class mFormula extends mBase {
public function insertHerb($info) {
$herb_id = $this->obj->insert($this->herb_tbl, $info);
if (!$herb_id) {
$this->setError('添加药材失败');
$this->writeLog('formula', 'update_error_log', '添加药材失败|' . json_encode($info));
return false;
}
@ -265,7 +265,7 @@ class mFormula extends mBase {
} else {
$temp['herb_id'] = $this->insertHerb(array('uid' => $uid, 'name' => $name));
if (!$temp['herb_id']) {
$this->writeLog('formula', 'update_error_log', '添加药材失败|' . $uid . '|' . $name);
$this->setError('添加药材失败');
return false;
}
}
@ -502,7 +502,7 @@ class mFormula extends mBase {
public function updateFormulaUseLog($uid, $formula_id) {
$res = $this->obj->increase($this->formula_use_log_tbl, array('sql' => '`uid`=? and `formula_id`=?', 'vals' => array($uid, $formula_id)), 'use_num');
if (!$res) {
$this->setError('添加药方药材失败');
$this->writeLog('formula', 'update_error_log', '药方使用次数更新失败|' . $uid . '|' . $formula_id);
return false;
}

14
model/mUserCase.php

@ -17,7 +17,7 @@ class mUserCase extends mBase {
public function insertUserCase($info) {
$id = $this->obj->insert($this->tbl, $info);
if (empty($id)) {
$this->setError('添加医案失败');
$this->writeLog('user_case', 'insert_error_log', '添加医案失败|' . json_encode($info, JSON_UNESCAPED_UNICODE));
return false;
}
@ -27,7 +27,7 @@ class mUserCase extends mBase {
public function updateUserCase($id, $info) {
$res = $this->obj->update($this->tbl, $info, array('sql' => '`id`=?', 'vals' => array($id)));
if (!$res) {
$this->setError('更新失败');
$this->writeLog('user_case', 'update_error_log', '更新医案失败|' . $id . '|' . json_encode($info, JSON_UNESCAPED_UNICODE));
return false;
}
@ -56,7 +56,7 @@ class mUserCase extends mBase {
$res = $this->updateUserCase($id, $data);
if (!$res) {
$this->writeLog('user_case', 'update_error_log', '更新医案失败|' . $uid . '|' . json_encode($data, JSON_UNESCAPED_UNICODE));
$this->setError('更新失败');
return false;
}
@ -151,7 +151,7 @@ class mUserCase extends mBase {
$herb_id = $mformula->insertHerb(array('uid' => $uid, 'name' => $item['name']));
if (!$herb_id) {
$this->writeLog('formula', 'insert_error_log', '添加药材失败|' . $uid . '|' . $item['name']);
$this->setError('添加药材失败');
return false;
}
@ -171,7 +171,7 @@ class mUserCase extends mBase {
$id = $this->insertUserCase($data);
if (!$id) {
$this->writeLog('user_case', 'insert_error_log', '添加医案失败|' . $uid . '|' . json_encode($data, JSON_UNESCAPED_UNICODE));
$this->setError('添加医案失败');
return false;
}
@ -179,7 +179,7 @@ class mUserCase extends mBase {
//更新用户药方使用次数
$res = $mformula->updateFormulaUseLog($uid, $formula_id);
if (!$res) {
$this->writeLog('formula', 'update_error_log', '药方使用次数更新失败|' . $uid . '|' . $formula_id);
$this->setError('药方使用次数更新失败');
return false;
}
}
@ -227,7 +227,6 @@ class mUserCase extends mBase {
$user_case['prescribe_herb'] = $prescribe_herb;
return $user_case;
}
@ -295,7 +294,6 @@ class mUserCase extends mBase {
$value['formula_info'] = '';
if (isset($formula_arr[$value['formula_id']])) {
$formula_info = $formula_arr[$value['formula_id']];
$value['formula_info'] .= "选 ";

Loading…
Cancel
Save