|
|
|
<?php
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
include_once(dirname(dirname(__FILE__))."/library/publicBase.php");
|
|
|
|
|
|
|
|
class index extends publicBase {
|
|
|
|
public function home() {
|
|
|
|
$id = $this->get('id');
|
|
|
|
|
|
|
|
$mCase = new mCase();
|
|
|
|
$data = $mCase->getCaseInfo($id);
|
|
|
|
|
|
|
|
$this->view['data'] = $data;
|
|
|
|
|
|
|
|
$this->setViewFormat('html');
|
|
|
|
$this->setViewTpl('index/home.html');
|
|
|
|
}
|
|
|
|
public function ajax_save_case() {
|
|
|
|
$id = $this->post('id');
|
|
|
|
$name = $this->post('name');
|
|
|
|
$source = $this->post('source');
|
|
|
|
$method = $this->post('method');
|
|
|
|
$herbs = $this->post('herbs');
|
|
|
|
if(empty($name)||empty($source)||empty($method)||empty($herbs))$this->ajax_json(false, '参数错误');
|
|
|
|
|
|
|
|
$mCase = new mCase();
|
|
|
|
|
|
|
|
$case_data = array(
|
|
|
|
'name'=>$name,
|
|
|
|
'source'=>$source,
|
|
|
|
'method'=>$method,
|
|
|
|
);
|
|
|
|
|
|
|
|
if($id){
|
|
|
|
$case_id = $id;
|
|
|
|
$res = $mCase->updateCase($id, $case_data);
|
|
|
|
if(empty($res))$this->ajax_json(false, '保存失败');
|
|
|
|
}else{
|
|
|
|
$case_id = $mCase->createCase($case_data);
|
|
|
|
if(empty($case_id))$this->ajax_json(false, '添加失败');
|
|
|
|
}
|
|
|
|
|
|
|
|
$case_herb = array();
|
|
|
|
foreach ($herbs as $key=>$item) {
|
|
|
|
$temp = array();
|
|
|
|
$temp['case_id']=$case_id;
|
|
|
|
$temp['num']=$item['num'];
|
|
|
|
$temp['sort']=$key;
|
|
|
|
|
|
|
|
$herb = $mCase->getHerbByName($item['name']);
|
|
|
|
if($herb){
|
|
|
|
$temp['herb_id']=$herb['id'];
|
|
|
|
}else{
|
|
|
|
$temp['herb_id'] = $mCase->createHerb(array('name'=>$item['name']));
|
|
|
|
}
|
|
|
|
|
|
|
|
if(empty($temp['herb_id'])){
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
$case_herb[] = $temp;
|
|
|
|
}
|
|
|
|
|
|
|
|
if($id){
|
|
|
|
$odata = $mCase->getCaseHerbByCaseId($id);
|
|
|
|
$mCase->compareCaseHerb($odata,$case_herb);
|
|
|
|
|
|
|
|
$this->ajax_json(true, '保存成功');
|
|
|
|
}
|
|
|
|
|
|
|
|
$res = $mCase->createCaseHerb($case_herb);
|
|
|
|
if(empty($res))$this->ajax_json(false, '添加失败');
|
|
|
|
|
|
|
|
$this->ajax_json(true, '添加成功');
|
|
|
|
}
|
|
|
|
|
|
|
|
public function ajax_search() {
|
|
|
|
$content = $this->post('content');
|
|
|
|
if(empty($content))$this->ajax_json(false, '非法请求');
|
|
|
|
|
|
|
|
$start = $this->post('start') ? $this->post('start') : 0;
|
|
|
|
$pagesize = $this->post('pagesize') ? $this->post('pagesize') : 200;
|
|
|
|
|
|
|
|
$mCase = new mCase();
|
|
|
|
$data = $mCase->getCaseByName($content,$start,$pagesize);
|
|
|
|
|
|
|
|
$this->ajax_json(true, '获取成功', $data);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function ajax_case_detail() {
|
|
|
|
$id = $this->get('id');
|
|
|
|
$is_search = $this->get('is_search');
|
|
|
|
if(empty($id))$this->ajax_json(false, '非法请求');
|
|
|
|
|
|
|
|
$mCase = new mCase();
|
|
|
|
|
|
|
|
if($is_search){
|
|
|
|
//先更新搜索次数
|
|
|
|
$mCase->updateCaseSearchNum($id);
|
|
|
|
}
|
|
|
|
|
|
|
|
//查询药方信息
|
|
|
|
$data = $mCase->getCaseInfo($id);
|
|
|
|
|
|
|
|
$this->ajax_json(true, '获取成功', $data);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function ajax_save_user_case() {
|
|
|
|
$uid = $this->post('uid');
|
|
|
|
$token = $this->post('token');
|
|
|
|
if(empty($uid) || empty($token))$this->ajax_json(false, '非法请求');
|
|
|
|
|
|
|
|
$this->ajax_json(true, '保存成功');
|
|
|
|
}
|
|
|
|
|
|
|
|
public function ajax_user_case_list() {
|
|
|
|
$uid = $this->post('uid');
|
|
|
|
$token = $this->post('token');
|
|
|
|
if(empty($uid) || empty($token))$this->ajax_json(false, '非法请求');
|
|
|
|
|
|
|
|
$id = $this->post('id');
|
|
|
|
if($id){
|
|
|
|
$data = array(
|
|
|
|
'user_case' =>array(
|
|
|
|
"id"=>"1",
|
|
|
|
"uid"=>"8112779578",
|
|
|
|
"case_id"=> "1",
|
|
|
|
"name"=> "11",
|
|
|
|
"patient_name"=> "11",
|
|
|
|
"patient_age"=> "1",
|
|
|
|
"patient_sex"=> "1",
|
|
|
|
"patient_say"=> "1",
|
|
|
|
"first_diagnosis"=> "1",
|
|
|
|
"diagnosis"=> "1",
|
|
|
|
"prescribe_num"=> "1",
|
|
|
|
"prescribe_herb"=> array(
|
|
|
|
array(
|
|
|
|
"herb_id"=> 1,
|
|
|
|
"num"=> 5
|
|
|
|
),
|
|
|
|
array(
|
|
|
|
"herb_id"=> 'u_1',
|
|
|
|
"num"=> 5
|
|
|
|
)
|
|
|
|
),
|
|
|
|
"feedback"=> "111",
|
|
|
|
"case_time"=> "2024-08-28 11:49:46",
|
|
|
|
"create_time"=> "2024-08-28 11:49:46"
|
|
|
|
),
|
|
|
|
'case'=> array(
|
|
|
|
'id'=>1,
|
|
|
|
'name'=>"大陷胸丸方",
|
|
|
|
'source'=>"仲景伤寒论卷第四",
|
|
|
|
'search_num'=>100,
|
|
|
|
'sort'=>1,
|
|
|
|
),
|
|
|
|
'herb'=>array(
|
|
|
|
'1'=>array(
|
|
|
|
"id"=> "1",
|
|
|
|
"name"=> "知母",
|
|
|
|
"desc"=> "",
|
|
|
|
),
|
|
|
|
),
|
|
|
|
'user_herb'=>array(
|
|
|
|
'1'=>array(
|
|
|
|
"id"=> "1",
|
|
|
|
"uid"=> "12",
|
|
|
|
"name"=> "当归",
|
|
|
|
"desc"=> "",
|
|
|
|
),
|
|
|
|
)
|
|
|
|
);
|
|
|
|
}else{
|
|
|
|
$data = array(
|
|
|
|
'user_case'=>array(
|
|
|
|
array(
|
|
|
|
"id"=>"1",
|
|
|
|
"uid"=>"8112779578",
|
|
|
|
"case_id"=> "1",
|
|
|
|
"name"=> "11",
|
|
|
|
"patient_name"=> "11",
|
|
|
|
"patient_age"=> "1",
|
|
|
|
"patient_sex"=> "1",
|
|
|
|
"patient_say"=> "1",
|
|
|
|
"first_diagnosis"=> "1",
|
|
|
|
"diagnosis"=> "1",
|
|
|
|
"prescribe_num"=> "1",
|
|
|
|
"prescribe_herb"=> "[{\"herb_id\":1,\"num\":5},{\"num\":5,\"herb_id\":\"u_1\"}]",
|
|
|
|
"feedback"=> "111",
|
|
|
|
"case_time"=> "2024-08-28 11:49:46",
|
|
|
|
"create_time"=> "2024-08-28 11:49:46"
|
|
|
|
),
|
|
|
|
array(
|
|
|
|
"id"=>"2",
|
|
|
|
"uid"=>"8112779578",
|
|
|
|
"case_id"=> "1",
|
|
|
|
"name"=> "11",
|
|
|
|
"patient_name"=> "11",
|
|
|
|
"patient_age"=> "1",
|
|
|
|
"patient_sex"=> "1",
|
|
|
|
"patient_say"=> "1",
|
|
|
|
"first_diagnosis"=> "1",
|
|
|
|
"diagnosis"=> "1",
|
|
|
|
"prescribe_num"=> "1",
|
|
|
|
"prescribe_herb"=> "[{\"herb_id\":1,\"num\":5},{\"num\":5,\"herb_id\":\"u_1\"}]",
|
|
|
|
"feedback"=> "111",
|
|
|
|
"case_time"=> "2024-08-28 11:49:46",
|
|
|
|
"create_time"=> "2024-08-28 11:49:46"
|
|
|
|
)
|
|
|
|
),
|
|
|
|
'case'=>array(
|
|
|
|
array(
|
|
|
|
'id'=>1,
|
|
|
|
'name'=>"大陷胸丸方",
|
|
|
|
'source'=>"仲景伤寒论卷第四",
|
|
|
|
'search_num'=>100,
|
|
|
|
'sort'=>1,
|
|
|
|
),
|
|
|
|
array(
|
|
|
|
'id'=>2,
|
|
|
|
'name'=>"大陷胸汤方",
|
|
|
|
'source'=>"仲景伤寒论卷第四",
|
|
|
|
'search_num'=>88,
|
|
|
|
'sort'=>1,
|
|
|
|
)
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
$this->ajax_json(true, '获取成功', $data);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function ajax_collect_log() {
|
|
|
|
$start = $this->get('start') ? $this->get('start') : 0;
|
|
|
|
$pagesize = $this->get('pagesize') ? $this->get('pagesize') : 200;
|
|
|
|
|
|
|
|
$data = array(
|
|
|
|
array(
|
|
|
|
'id'=>1,
|
|
|
|
'collect_msg'=>"大陷胸丸方",
|
|
|
|
'collect_time'=>"2024-08-28 11:13:39",
|
|
|
|
),
|
|
|
|
array(
|
|
|
|
'id'=>2,
|
|
|
|
'collect_msg'=>"大陷胸丸方",
|
|
|
|
'collect_time'=>"2024-08-28 11:13:35",
|
|
|
|
)
|
|
|
|
);
|
|
|
|
|
|
|
|
$this->ajax_json(true, '获取成功', $data);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function ajax_login(){
|
|
|
|
$code = $this->get('code');
|
|
|
|
if(!$code)$this->ajax_json(false, '非法请求');
|
|
|
|
|
|
|
|
$data = array(
|
|
|
|
'uid'=>'12312321',
|
|
|
|
'token'=>'asdasdasdsa'
|
|
|
|
);
|
|
|
|
|
|
|
|
$this->ajax_json(true, '登录成功', $data);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function ajax_contact_us(){
|
|
|
|
$this->ajax_json(true, '获取成功',array('img_url'=> CONTACT_US_IMG_URL));
|
|
|
|
}
|
|
|
|
|
|
|
|
public function ajax_pdf_url(){
|
|
|
|
$uid = $this->post('uid');
|
|
|
|
$token = $this->post('token');
|
|
|
|
if(empty($uid) || empty($token))$this->ajax_json(false, '非法请求');
|
|
|
|
|
|
|
|
$this->ajax_json(true, '获取成功',array('pdf_url'=>''));
|
|
|
|
}
|
|
|
|
|
|
|
|
public function ajax_mail(){
|
|
|
|
$uid = $this->post('uid');
|
|
|
|
$token = $this->post('token');
|
|
|
|
if(empty($uid) || empty($token))$this->ajax_json(false, '非法请求');
|
|
|
|
|
|
|
|
$this->ajax_json(true, '发送成功');
|
|
|
|
}
|
|
|
|
}
|