HospitalController.php 3.2 KB
<?php
/**
 * Created by PhpStorm.
 * auther: sgj
 * Date: 2018/11/25
 * Time: 11:49
 */

namespace app\admin\controller;


use app\admin\model\HospitalModel;
use cmf\controller\AdminBaseController;
use think\db;
use think\Request;

/**
 * Class HosptialController
 * @package app\admin\controller
 * @adminMenuRoot(
 *     'name'   =>'医院管理',
 *     'action' =>'default',
 *     'parent' =>'',
 *     'display'=> true,
 *     'order'  => 30,
 *     'icon'   =>'th',
 *     'remark' =>'医院管理'
 * )
 */
class HospitalController extends AdminBaseController
{
    protected $HospitalModel;


    public function __construct(HospitalModel $HospitalModel)
    {
        parent::__construct();
        $this->HospitalModel = $HospitalModel;
    }

    /**
     *平台列表
     * @adminMenu(
     *     'name'   => '平台列表',
     *     'parent' => 'default',
     *     'display'=> true,
     *	   'hasView'=> true,
     *     'order'  => 10000,
     *     'icon'   => '',
     *     'remark' => '密码修改',
     *     'param'  => ''
     * )
     */
      public function index(){
        $platment=$this->HospitalModel->getPlatment()->toArray();
        dump($platment);
        $this->assign('platment',$platment);
         return $this->fetch();
      }


        /**
         *平台列表
         * @adminMenu(
         *     'name'   => '医院列表',
         *     'parent' => 'default',
         *     'display'=> false,
         *	   'hasView'=> true,
         *     'order'  => 10000,
         *     'icon'   => '',
         *     'remark' => '',
         *     'param'  => ''
         * )
         */
        public function hospital(){
            $platment_id=input('id');
            if (empty($platment_id)){
                return $this->error();
            }
            $hospital=$this->HospitalModel->getHospital($platment_id)->toArray();
            $this->assign('hospital',$hospital);
            $this->assign('platform_id',$platment_id);
            return $this->fetch();
        }

        /**
         *
         * @adminMenu(
         *     'name'   => '删除医院',
         *     'parent' => 'default',
         *     'display'=> false,
         *	   'hasView'=> true,
         *     'order'  => 10000,
         *     'icon'   => '',
         *     'remark' => '',
         *     'param'  => ''
         * )
         */
        public function hosptialDel(){
            $hosptial_id=input('id');
            if (empty($hosptial_id)){
                return $this->error('操作错误!');
            }
            $result=$this->HospitalModel->hospitalDel($hosptial_id);
            if ($result==1){
                $this->success('删除成功!');
            }else{
                $this->error('删除失败!');
            }
        }

    /**
     *
     * @adminMenu(
     *     'name'   => '添加医院',
     *     'parent' => 'default',
     *     'display'=> false,
     *	   'hasView'=> true,
     *     'order'  => 10000,
     *     'icon'   => '',
     *     'remark' => '',
     *     'param'  => ''
     * )
     */
        public function hospitalAdd(){
            if(\request()->isAjax()){
                  /*验证器*/
            }else{
                $this->fetch();
            }
        }




}