Browse Source

医共体管理

sugangqiang 1 năm trước cách đây
mục cha
commit
e15e1d5cab

+ 125 - 0
app/admin/controller/hospital/Category.php

@@ -0,0 +1,125 @@
+<?php
+
+namespace app\admin\controller\hospital;
+
+use app\admin\common\AdminController;
+use app\common\api\DictApi;
+use app\common\api\UploadApi;
+use think\facade\Db;
+
+/**
+ * 医共体管理
+ */
+class Category extends AdminController {
+
+    public function index() {
+        return view("");
+    }
+
+    public function list() {
+        $order = trim($this->request->param("order")) ?: "desc";
+        $offset = trim($this->request->param("offset")) ?: 0;
+        $limit = trim($this->request->param("limit")) ?: 10;
+        $name = trim($this->request->param("name"));
+
+        $where = [];
+        $where[] = ["status", "<>", 3];
+        if ($name) {
+            $where[] = ["name", "like", "%" . $name . "%"];
+        }
+
+        $count = Db::table("new_hospital_category")->where($where)->count();
+        $rows = Db::table("new_hospital_category")->where($where)->limit($offset, $limit)->order("num asc,createTime " . $order)->select()->toArray();
+
+        return ["total" => $count, "rows" => $rows];
+    }
+
+    public function add() {
+        return view("update");
+    }
+
+    public function edit() {
+        $id = \StrUtil::getRequestDecodeParam($this->request, 'id');
+        $info = Db::table("new_hospital_category")->where("id", $id)->find();
+        return view("update", ["row" => $info]);
+    }
+
+    public function upsert() {
+        $response_obj = new \StdClass();
+        $response_obj->code = 500;
+        $id = \StrUtil::getRequestDecodeParam($this->request, 'id');
+        $where = [];
+        if ($id) {
+            $info = Db::table("new_hospital_category")->where("id", $id)->find();
+            if (!$info) {
+                $response_obj->msg = '找不到记录';
+                return \StrUtil::back($response_obj, 'CategoryInfo.callBack');
+            }
+            $where[] = ["id", "<>", $id];
+        }
+
+        $name = trim($this->request['name']);
+        if (\StrUtil::isEmpOrNull($name)) {
+            $response_obj->msg = '医共体名称不能为空';
+            return \StrUtil::back($response_obj, 'CategoryInfo.callBack');
+        }
+        $where[] = ["name", "=", $name];
+        $repeat = Db::table("new_hospital_category")->where($where)->find();
+
+        if ($repeat) {
+            $response_obj->msg = '医共体名称已经被使用';
+            return \StrUtil::back($response_obj, 'CategoryInfo.callBack');
+        }
+
+        $num = trim($this->request['num']);
+        if (\StrUtil::isNotEmpAndNull($num) && !is_numeric($num)) {
+            $response_obj->msg = '序号只能是数字';
+            return \StrUtil::back($response_obj, 'CategoryInfo.callBack');
+        }
+        $status = trim($this->request['status']);
+        if (\StrUtil::isEmpOrNull($status)) {
+            $response_obj->msg = '启用状态不能为空';
+            return \StrUtil::back($response_obj, 'CategoryInfo.callBack');
+        }
+        try {
+            $data["name"] = $name;
+            $data["status"] = $status;
+            $data["num"] = $num;
+            $data["description"] = \StrUtil::getRequestDecodeParam($this->request, "description");
+            if ($id) {
+                $data["id"] = $id;
+                $data["updateTime"] = date("Y-m-d H:i:s");
+                $data["updateUser"] = $this->user['uid'];
+                Db::table("new_hospital_category")->save($data);
+            } else {
+                $data["createTime"] = date("Y-m-d H:i:s");
+                $data["createUser"] = $this->user['uid'];
+                Db::table("new_hospital_category")->insert($data);
+            }
+            $response_obj->code = 200;
+            $response_obj->msg = '修改成功';
+            return \StrUtil::back($response_obj, "CategoryInfo.callBack");
+        } catch (\Exception $e) {
+            $response_obj->msg = $e->getMessage();
+            return \StrUtil::back($response_obj, "CategoryInfo.callBack");
+        }
+    }
+
+    public function delete() {
+        $id = \StrUtil::getRequestDecodeParam($this->request, 'id');
+        if (\StrUtil::isEmpOrNull($id)) {
+            return json(['code' => 500, 'msg' => '缺少参数']);
+        }
+        $data["id"] = $id;
+        $data["status"] = 3;
+        $data["updateTime"] = date("Y-m-d H:i:s");
+        $data["updateUser"] = $this->user["uid"];
+        try {
+            Db::table("new_hospital_category")->save($data);
+            return json(['code' => 200, 'msg' => "删除成功"]);
+        } catch (\Exception $e) {
+            return json(['code' => 500, 'msg' => $e->getMessage()]);
+        }
+    }
+
+}

+ 227 - 0
app/admin/controller/hospital/Mgr.php

@@ -0,0 +1,227 @@
+<?php
+
+namespace app\admin\controller\hospital;
+
+use app\admin\common\AdminController;
+use app\common\api\DictApi;
+use app\common\api\UploadApi;
+use think\facade\Db;
+
+/**
+ * 医院管理
+ */
+class Mgr extends AdminController {
+
+    public function index() {
+        return view("");
+    }
+
+    public function list() {
+        $order = trim($this->request->param("order")) ?: "desc";
+        $offset = trim($this->request->param("offset")) ?: 0;
+        $limit = trim($this->request->param("limit")) ?: 10;
+        $type = trim($this->request->param("type"));
+        $name = trim($this->request->param("name"));
+        $must = trim($this->request->param("must"));
+        $active = trim($this->request->param("active"));
+
+        $where = [];
+
+        if ($name) {
+            $where[] = ["name", "like", "%" . $name . "%"];
+        }
+        if ($type) {
+            $where[] = ["type", "=", $type];
+        }
+        if ($must) {
+            $where[] = ["must", "=", $must];
+        }
+        if ($active) {
+            $where[] = ["active", "=", $active];
+        }
+
+
+        $count = \app\admin\model\CurrencyFiletype::where($where)->count();
+        if ($count > 0) {
+            $rows = \app\admin\model\CurrencyFiletype::where($where)->limit($offset, $limit)->order("createTime " . $order)->select()->toArray();
+            $typeName = DictApi::selectByParentCode("common_declareType");
+            foreach ($rows as $k => &$v) {
+                $v['typeName'] = $typeName[$v['type']];
+                $v['templateUrl'] = getStoragePath($v['templateUrl']);
+            }
+        } else {
+            $rows = [];
+        }
+
+        return ["total" => $count, "rows" => $rows];
+    }
+
+    public function currencyFiletype_add() {
+        return view("");
+    }
+
+    public function add() {
+        $response_obj = new \StdClass();
+        $name = trim($this->request['name']);
+        if (\StrUtil::isEmpOrNull($name)) {
+            $response_obj->code = 500;
+            $response_obj->msg = '附件名称不能为空';
+            return \StrUtil::back($response_obj, 'CurrencyFiletypeInfoDlg.callBack');
+        }
+        $type = trim($this->request['type']);
+        if (\StrUtil::isEmpOrNull($type)) {
+            $response_obj->code = 500;
+            $response_obj->msg = '申报类别不能为空';
+            return \StrUtil::back($response_obj, 'CurrencyFiletypeInfoDlg.callBack');
+        }
+        $api = trim($this->request['api']);
+        if (\StrUtil::isEmpOrNull($api)) {
+            $response_obj->code = 500;
+            $response_obj->msg = 'api不能为空';
+            return \StrUtil::back($response_obj, 'CurrencyFiletypeInfoDlg.callBack');
+        }
+        $must = trim($this->request['must']);
+        if (\StrUtil::isEmpOrNull($must)) {
+            $response_obj->code = 500;
+            $response_obj->msg = '是否必传不能为空';
+            return \StrUtil::back($response_obj, 'CurrencyFiletypeInfoDlg.callBack');
+        }
+        $active = trim($this->request['active']);
+        if (\StrUtil::isEmpOrNull($active)) {
+            $response_obj->code = 500;
+            $response_obj->msg = '是否有效不能为空';
+            return \StrUtil::back($response_obj, 'CurrencyFiletypeInfoDlg.callBack');
+        }
+        $sn = trim($this->request['sn']);
+        if (\StrUtil::isEmpOrNull($sn)) {
+            $response_obj->code = 500;
+            $response_obj->msg = '排序不能为空';
+            return \StrUtil::back($response_obj, 'CurrencyFiletypeInfoDlg.callBack');
+        }
+
+
+        if ($this->request['templateFile']) {
+            $uploadapi = new UploadApi();
+            $file_check_res = $uploadapi->uploadOne($this->request->file('templateFile'), 'system');
+            if ($file_check_res->code == 500) {
+                return \StrUtil::back($file_check_res, "CurrencyFiletypeInfoDlg.callBack");
+            }
+            $templateUrl = $file_check_res->filepath;
+        } else {
+            $templateUrl = "";
+        }
+
+
+        $data = [
+            'id' => getStringId(),
+            'type' => $type,
+            'name' => $name,
+            'api' => $api,
+            'must' => $must,
+            'active' => $active,
+            'sn' => $sn,
+            'checkCompany' => '1158293574504660993',
+            'description' => $this->request['description'],
+            'createTime' => date("Y-m-d H:i:s"),
+            'createUser' => session('user')['uid'],
+            'templateUrl' => $templateUrl
+        ];
+
+        \app\admin\model\CurrencyFiletype::create($data);
+        $response_obj->code = 200;
+        $response_obj->msg = '添加成功';
+        return \StrUtil::back($response_obj, "CurrencyFiletypeInfoDlg.callBack");
+    }
+
+    public function currencyFiletype_update() {
+        $id = trim($this->request->get('id'));
+        if (\StrUtil::isEmpOrNull($id)) {
+            return json(['msg' => 'id不能为空']);
+        }
+        $cft = \app\admin\model\CurrencyFiletype::findOrEmpty($id);
+        return view("", ['item' => $cft]);
+    }
+
+    public function update() {
+        $response_obj = new \StdClass();
+        $id = \StrUtil::getRequestDecodeParam($this->request, 'id');
+        if (\StrUtil::isEmpOrNull($id)) {
+            $response_obj->code = 500;
+            $response_obj->msg = 'id不能为空';
+            return \StrUtil::back($response_obj, 'CurrencyFiletypeInfoDlg.callBack');
+        }
+        $cft = \app\admin\model\CurrencyFiletype::findOrEmpty($id);
+        if (!$cft) {
+            $response_obj->code = 500;
+            $response_obj->msg = '找不到记录';
+            return \StrUtil::back($response_obj, 'CurrencyFiletypeInfoDlg.callBack');
+        }
+
+        $cft->name = $name = trim($this->request['name']);
+        if (\StrUtil::isEmpOrNull($name)) {
+            $response_obj->code = 500;
+            $response_obj->msg = '附件名称不能为空';
+            return \StrUtil::back($response_obj, 'CurrencyFiletypeInfoDlg.callBack');
+        }
+        $cft->type = $type = trim($this->request['type']);
+        if (\StrUtil::isEmpOrNull($type)) {
+            $response_obj->code = 500;
+            $response_obj->msg = '申报类别不能为空';
+            return \StrUtil::back($response_obj, 'CurrencyFiletypeInfoDlg.callBack');
+        }
+        $cft->api = $api = trim($this->request['api']);
+        if (\StrUtil::isEmpOrNull($api)) {
+            $response_obj->code = 500;
+            $response_obj->msg = 'api不能为空';
+            return \StrUtil::back($response_obj, 'CurrencyFiletypeInfoDlg.callBack');
+        }
+        $cft->must = $must = trim($this->request['must']);
+        if (\StrUtil::isEmpOrNull($must)) {
+            $response_obj->code = 500;
+            $response_obj->msg = '是否必传不能为空';
+            return \StrUtil::back($response_obj, 'CurrencyFiletypeInfoDlg.callBack');
+        }
+        $cft->active = $active = trim($this->request['active']);
+        if (\StrUtil::isEmpOrNull($active)) {
+            $response_obj->code = 500;
+            $response_obj->msg = '是否有效不能为空';
+            return \StrUtil::back($response_obj, 'CurrencyFiletypeInfoDlg.callBack');
+        }
+        $cft->sn = $sn = trim($this->request['sn']);
+        if (\StrUtil::isEmpOrNull($sn)) {
+            $response_obj->code = 500;
+            $response_obj->msg = '排序不能为空';
+            return \StrUtil::back($response_obj, 'CurrencyFiletypeInfoDlg.callBack');
+        }
+        $files = $this->request->file();
+
+
+        if (array_key_exists('templateFile', $files)) {
+            $uploadapi = new UploadApi();
+            $file_check_res = $uploadapi->uploadOne($this->request->file('templateFile'), 'system');
+            if ($file_check_res->code == 500) {
+                return \StrUtil::back($file_check_res, "CurrencyFiletypeInfoDlg.callBack");
+            }
+            $cft->templateUrl = $file_check_res->filepath;
+        } else {
+            $cft->templateUrl = "";
+        }
+
+        $cft->updateTime = date("Y-m-d H:i:s");
+        $cft->updateUser = session('user')['uid'];
+        $cft->save();
+        $response_obj->code = 200;
+        $response_obj->msg = '修改成功';
+        return \StrUtil::back($response_obj, "CurrencyFiletypeInfoDlg.callBack");
+    }
+
+    public function delete() {
+        $id = \StrUtil::getRequestDecodeParam($this->request, 'currencyFiletypeId');
+        if (\StrUtil::isEmpOrNull($id)) {
+            return json(['code' => 500, 'msg' => '缺少参数']);
+        }
+        \app\admin\model\CurrencyFiletype::destroy($id);
+        return json(['code' => 200, 'msg' => '删除成功']);
+    }
+
+}

+ 62 - 0
app/admin/view/hospital/category/index.html

@@ -0,0 +1,62 @@
+{extend name="layout/content"}
+{block name="content"}
+<div class="row">
+    <div class="col-sm-12">
+        <div class="ibox float-e-margins">
+            <div class="ibox-title">
+                <h5>医共体管理</h5>
+            </div>
+            <div class="ibox-content">
+                <div class="row row-lg">
+                    <div class="col-sm-12">
+                        <div class="row">
+                            <div class="col-sm-3">
+                                <div class="input-group input-group-sm">
+                                    <div class="input-group-btn">
+                                        <button data-toggle="dropdown" class="btn btn-white dropdown-toggle" type="button">
+                                            医共体名称
+                                        </button>
+                                    </div>
+                                    <input type="text" class="form-control" id="name"/>
+                                </div>
+                            </div>
+                            <div class="col-sm-3">
+                                <button type="button" class="btn btn-sm btn-primary" onclick="HospitalCategory.search()">
+                                    <i class="fa fa-search"></i>&nbsp;搜索
+                                </button>
+                            </div>
+                        </div>
+                        <div class="hidden-xs" id="categoryTableToolbar" role="group">
+                            {if condition="chkCommission('/admin/hospital.category/add','')"}
+                            <button type="button" class="btn btn-sm btn-primary" onclick="HospitalCategory.openAddCategory()">
+                                <i class="fa fa-plus"></i>&nbsp;添加
+                            </button>
+                            {/if}
+                            {if condition="chkCommission('/admin/hospital.category/edit','')"}
+                            <button type="button" class="btn btn-sm btn-primary button-margin" onclick="HospitalCategory.openChangeCategory()">
+                                <i class="fa fa-edit"></i>&nbsp;修改
+                            </button>
+                            {/if}
+                            {if condition="chkCommission('/admin/hospital.category/delete','')"}
+                            <button type="button" class="btn btn-sm btn-primary button-margin" onclick="HospitalCategory.delCategory()">
+                                <i class="fa fa-remove"></i>&nbsp;删除
+                            </button>
+                            {/if}
+                        </div>
+                        <table id="categoryTable" class="table-condensed" style="font-size: 10px;table-layout: fixed!important;" data-mobile-responsive="true" data-click-to-select="true">
+                            <thead>
+                                <tr>
+                                    <th data-field="selectItem" data-checkbox="true"></th>
+                                </tr>
+                            </thead>
+                        </table>
+                    </div>
+                </div>
+            </div>
+        </div>
+    </div>
+</div>
+<script type="text/javascript">
+    document.write('<script src="/static/modular/hospital/category/category.js?v=' + (new Date()).getTime() + '"><\/script>');
+</script>
+{/block}

+ 65 - 0
app/admin/view/hospital/category/update.html

@@ -0,0 +1,65 @@
+{extend name="layout/content"}
+{block name="content"}
+<div class="ibox float-e-margins">
+    <div class="ibox-content">
+        <form id="hospitalCategoryInfoForm" action="/admin/hospital.category/upsert" method="post" target="hiddenIframe">
+            <div class="form-horizontal">
+                <input id="id" name="id" value="{$row.id}" type="hidden"/>
+                <div class="row">
+                    <div class="col-sm-6">
+                        <div class="form-group">
+                            <label class="col-sm-3 control-label">名称</label>
+                            <div class="col-sm-9">
+                                <input class="form-control" id="name" name="name" value="{$row.name}"/>
+                            </div>
+                        </div>
+                        <div class="form-group">
+                            <label class="col-sm-3 control-label">
+                                是否启用
+                            </label>
+                            <div class="col-sm-9">
+                                <select class="form-control" id="status" name="status" selectVal="{$row.status}">
+                                    <option value="1">是</option>
+                                    <option value="2">否</option>
+                                </select>
+                            </div>
+                        </div>
+                    </div>
+                    <div class="col-sm-6">
+                        <div class="form-group">
+                            <label class="col-sm-3 control-label">
+                                排序
+                            </label>
+                            <div class="col-sm-9">
+                                <input class="form-control" id="num" name="num" type="text" value="{$row.num}">
+                            </div>
+                        </div>
+                        <div class="form-group">
+                            <label class="col-sm-3 control-label">
+                                备注
+                            </label>
+                            <div class="col-sm-9">
+                                <input class="form-control" id="description" name="description" type="text" value="{$row.description}">
+                            </div>
+                        </div>
+                    </div>
+                </div>
+                <div class="row btn-group-m-t">
+                    <div class="col-sm-12" style="text-align: center;">
+                        <button type="button" class="btn btn-sm btn-info " onclick="CategoryInfo.editSubmit()" id="ensure">
+                            <i class="fa fa-check"></i>&nbsp;提交
+                        </button>
+                        <button type="button" class="btn btn-sm btn-danger " onclick="CategoryInfo.close()" id="cancel">
+                            <i class="fa fa-eraser"></i>&nbsp;取消
+                        </button>
+                    </div>
+                </div>
+            </div>
+        </form>
+    </div>
+</div>
+<iframe id="hiddenIframe" name="hiddenIframe" style="display: none;"></iframe>
+<script type="text/javascript">
+    document.write('<script src="/static/modular/hospital/category/category_info.js?v=' + (new Date()).getTime() + '"><\/script>');
+</script>
+{/block}

+ 77 - 0
app/admin/view/hospital/mgr/index.html

@@ -0,0 +1,77 @@
+{extend name="layout/content"}
+{block name="content"}
+<div class="row">
+    <div class="col-sm-12">
+        <div class="ibox float-e-margins">
+            <div class="ibox-title">
+                <h5>医院管理</h5>
+            </div>
+            <div class="ibox-content">
+                <div class="row row-lg">
+                    <div class="col-sm-12">
+                        <div class="row">
+                            <div class="col-sm-3">
+                                <div class="input-group input-group-sm">
+                                    <div class="input-group-btn">
+                                        <button data-toggle="dropdown" class="btn btn-white dropdown-toggle" type="button">
+                                            医院名称
+                                        </button>
+                                    </div>
+                                    <input type="text" class="form-control" id="hospitalName"/>
+                                </div>
+                            </div>
+                            <div class="col-sm-3">
+                                <div class="input-group input-group-sm">
+                                    <div class="input-group-btn">
+                                        <button data-toggle="dropdown" class="btn btn-white dropdown-toggle" type="button">
+                                            医共体名称
+                                        </button>
+                                    </div>
+                                    <input type="text" class="form-control" id="categoryName"/>
+                                </div>
+                            </div>
+                            <div class="col-sm-3">
+                                <button type="button" class="btn btn-sm btn-primary" onclick="Hospital.search()">
+                                    <i class="fa fa-search"></i>&nbsp;搜索
+                                </button>
+                            </div>
+                        </div>
+                        <div class="hidden-xs" id="hospitalTableToolbar" role="group">
+                            {if condition="chkCommission('/admin/hospital.mgr/add','')"}
+                            <button type="button" class="btn btn-sm btn-primary" onclick="Hospital.openAddHospital()">
+                                <i class="fa fa-plus"></i>&nbsp;添加医院
+                            </button>
+                            {/if}                            
+                            {if condition="chkCommission('/admin/hospital.mgr/edit','')"}
+                            <button type="button" class="btn btn-sm btn-primary button-margin" onclick="Hospital.openChangeHospital()">
+                                <i class="fa fa-edit"></i>&nbsp;修改医院
+                            </button>
+                            {/if}                       
+                            {if condition="chkCommission('/admin/hospital.mgr/setGeneral','')"}
+                            <button type="button" class="btn btn-sm btn-primary button-margin" onclick="Hospital.setGeneral()">
+                                <i class="fa fa-edit"></i>&nbsp;设为总院
+                            </button>
+                            {/if}
+                            {if condition="chkCommission('/admin/hospital.mgr/delete','')"}
+                            <button type="button" class="btn btn-sm btn-primary button-margin" onclick="Hospital.delHospital()">
+                                <i class="fa fa-remove"></i>&nbsp;删除医院
+                            </button>
+                            {/if}
+                        </div>
+                        <table id="hospitalTable" class="table-condensed" style="font-size: 10px;table-layout: fixed!important;" data-mobile-responsive="true" data-click-to-select="true">
+                            <thead>
+                                <tr>
+                                    <th data-field="selectItem" data-checkbox="true"></th>
+                                </tr>
+                            </thead>
+                        </table>
+                    </div>
+                </div>
+            </div>
+        </div>
+    </div>
+</div>
+<script type="text/javascript">
+    document.write('<script src="/static/modular/hospital/mgr/hospital.js?v=' + (new Date()).getTime() + '"><\/script>');
+</script>
+{/block}

+ 7 - 1
app/common/middleware/Permission.php

@@ -20,7 +20,13 @@ class Permission {
      */
     public function handle($request, \Closure $next) {
         $controller = $request->controller();
-        $ref = new \ReflectionClass("\app\admin\controller\\" . $controller);
+        if (strpos($controller, ".") !== false) {
+            $paths = array_filter(explode(".", $controller));
+            $classpath = "\app\admin\controller\\" . implode("\\", $paths);
+            $ref = new \ReflectionClass($classpath);
+        } else {
+            $ref = new \ReflectionClass("\app\admin\controller\\" . $controller);
+        }
         $action = $request->action();
         $comment = $ref->getMethod($action)->getDocComment();
         $old_auth_url = "";

+ 117 - 0
public/static/modular/hospital/category/category.js

@@ -0,0 +1,117 @@
+/**
+ * 角色管理的单例
+ */
+var HospitalCategory = {
+    id: "categoryTable", //表格id
+    seItem: null, //选中的条目
+    table: null,
+    layerIndex: -1
+};
+
+/**
+ * 初始化表格的列
+ */
+HospitalCategory.initColumn = function () {
+    var columns = [
+        {field: 'selectItem', radio: true},
+        {title: 'id', field: 'id', visible: false, align: 'center', valign: 'middle'},
+        {title: '医共体名称', field: 'name', align: 'center', valign: 'middle', sortable: true},
+        {title: '备注', field: 'description', align: 'center', valign: 'middle', sortable: true},
+        {title: '排序', field: 'num', align: 'center', valign: 'middle', sortable: true},
+        {title: '状态', field: 'status', align: 'center', valign: 'middle', sortable: true,
+            formatter: function (value) {
+                if (value == 1) {
+                    return "正常";
+                }
+                return "停用";
+            }
+        }
+    ]
+    return columns;
+};
+
+
+/**
+ * 检查是否选中
+ */
+HospitalCategory.check = function () {
+    var selected = $('#' + this.id).bootstrapTable('getSelections');
+    if (selected.length == 0) {
+        Feng.info("请先选中表格中的某一记录!");
+        return false;
+    } else {
+        HospitalCategory.seItem = selected[0];
+        return true;
+    }
+};
+
+/**
+ * 点击添加菜单
+ */
+HospitalCategory.openAddCategory = function () {
+    var index = layer.open({
+        type: 2,
+        title: '添加医共体',
+        area: ['830px', '450px'], //宽高
+        fix: false, //不固定
+        maxmin: true,
+        content: Feng.ctxPath + '/admin/hospital.category/add'
+    });
+    this.layerIndex = index;
+};
+
+/**
+ * 点击修改
+ */
+HospitalCategory.openChangeCategory = function () {
+    if (this.check()) {
+        var index = layer.open({
+            type: 2,
+            title: '修改医共体',
+            area: ['800px', '450px'], //宽高
+            fix: false, //不固定
+            maxmin: true,
+            content: Feng.ctxPath + '/admin/hospital.category/edit/id/' + this.seItem.id
+        });
+        this.layerIndex = index;
+    }
+};
+
+/**
+ * 删除
+ */
+HospitalCategory.delCategory = function () {
+    if (this.check()) {
+
+        var operation = function () {
+            var ajax = new $ax(Feng.ctxPath + "/admin/hospital.category/delete", function (data) {
+                Feng.success("删除成功!");
+                HospitalCategory.table.refresh();
+            }, function (data) {
+                Feng.error("删除失败!" + data.responseJSON.message + "!");
+            });
+            ajax.set("id", HospitalCategory.seItem.id);
+            ajax.start();
+        };
+
+        Feng.confirm("是否刪除该医共体?", operation);
+    }
+};
+
+/**
+ * 搜索
+ */
+HospitalCategory.search = function () {
+    var queryData = {};
+
+    queryData['name'] = $("#name").val();
+
+    HospitalCategory.table.refresh({query: queryData});
+}
+
+$(function () {
+    var defaultColunms = HospitalCategory.initColumn();
+    var table = new BSTable(HospitalCategory.id, "/admin/hospital.category/list", defaultColunms);
+    table.init();
+    HospitalCategory.table = table;
+});

+ 119 - 0
public/static/modular/hospital/category/category_info.js

@@ -0,0 +1,119 @@
+/**
+ * 医共体
+ */
+var CategoryInfo = {
+    infoData: {},
+    validateFields: {
+        name: {
+            validators: {
+                notEmpty: {
+                    message: '医共体名称不能为空'
+                }
+            }
+        },
+        status: {
+            validators: {
+                notEmpty: {
+                    message: '启用状态不能为空'
+                }
+            }
+        },
+        num: {
+            validators: {
+                notEmpty: {
+                    message: '排序不能为空'
+                },
+                regexp: {
+                    regexp: /^\d+$/,
+                    message: '只能输入数字'
+                }
+            }
+        }
+    }
+};
+
+/**
+ * 清除数据
+ */
+CategoryInfo.clearData = function () {
+    this.infoData = {};
+}
+
+/**
+ * 设置对话框中的数据
+ *
+ * @param key 数据的名称
+ * @param val 数据的具体值
+ */
+CategoryInfo.set = function (key, val) {
+    this.infoData[key] = (typeof val == "undefined") ? $("#" + key).val() : val;
+    return this;
+}
+
+/**
+ * 设置对话框中的数据
+ *
+ * @param key 数据的名称
+ * @param val 数据的具体值
+ */
+CategoryInfo.get = function (key) {
+    return $("#" + key).val();
+}
+
+/**
+ * 关闭此对话框
+ */
+CategoryInfo.close = function () {
+    parent.layer.close(window.parent.HospitalCategory.layerIndex);
+}
+
+/**
+ * 收集数据
+ */
+CategoryInfo.collectData = function () {
+    this.set('id')
+            .set('name')
+            .set('status')
+            .set('num')
+            .set('description');
+}
+
+/**
+ * 验证数据是否为空
+ */
+CategoryInfo.validate = function () {
+    $('#hospitalCategoryInfoForm').data("bootstrapValidator").resetForm();
+    $('#hospitalCategoryInfoForm').bootstrapValidator('validate');
+    return $("#hospitalCategoryInfoForm").data('bootstrapValidator').isValid();
+}
+
+/**
+ * 提交修改
+ */
+CategoryInfo.editSubmit = function () {
+    this.clearData();
+    this.collectData();
+    if (!this.validate()) {
+        return;
+    }
+    $('#hospitalCategoryInfoForm')[0].submit();
+}
+
+//回调
+CategoryInfo.callBack = function (data) {
+    if (data.code == "200") {
+        Feng.success(data.msg);
+        window.parent.HospitalCategory.table.refresh();
+        CategoryInfo.close();
+    } else {
+        Feng.error(data.msg);
+    }
+}
+
+$(function () {
+    //下拉框数据回显
+    $("select").each(function () {
+        $(this).val($(this).attr("selectVal"));
+    });
+    Feng.initValidator("hospitalCategoryInfoForm", CategoryInfo.validateFields);
+});

+ 123 - 0
public/static/modular/hospital/mgr/hospital.js

@@ -0,0 +1,123 @@
+/**
+ * 角色管理的单例
+ */
+var Hospital = {
+    id: "hospitalTable", //表格id
+    seItem: null, //选中的条目
+    table: null,
+    layerIndex: -1
+};
+
+/**
+ * 初始化表格的列
+ */
+Hospital.initColumn = function () {
+    var columns = [
+        {field: 'selectItem', radio: true},
+        {title: 'id', field: 'id', visible: false, align: 'center', valign: 'middle'},
+        {title: '医院名称', field: 'name', align: 'center', valign: 'middle', sortable: true},
+        {title: '医共体', field: 'categoryName', align: 'center', valign: 'middle', sortable: true},
+        {title: '是否总院', field: 'isGeneral', align: 'center', valign: 'middle', sortable: true},
+        {title: '状态', field: 'status', align: 'center', valign: 'middle', sortable: true,
+            formatter: function (value) {
+                if (value == 1) {
+                    return "正常";
+                }
+                return "停用";
+            }
+        }
+    ]
+    return columns;
+};
+
+
+/**
+ * 检查是否选中
+ */
+Hospital.check = function () {
+    var selected = $('#' + this.id).bootstrapTreeTable('getSelections');
+    if (selected.length == 0) {
+        Feng.info("请先选中表格中的某一记录!");
+        return false;
+    } else {
+        Hospital.seItem = selected[0];
+        return true;
+    }
+};
+
+/**
+ * 点击添加菜单
+ */
+Hospital.openAddHospital = function () {
+    var index = layer.open({
+        type: 2,
+        title: '添加医院',
+        area: ['830px', '450px'], //宽高
+        fix: false, //不固定
+        maxmin: true,
+        content: Feng.ctxPath + '/admin/hospital.mgr/add'
+    });
+    this.layerIndex = index;
+};
+
+/**
+ * 点击修改
+ */
+Hospital.openChangeHospital = function () {
+    if (this.check()) {
+        var index = layer.open({
+            type: 2,
+            title: '修改医院',
+            area: ['800px', '450px'], //宽高
+            fix: false, //不固定
+            maxmin: true,
+            content: Feng.ctxPath + '/admin/hospital.mgr/edit/id/' + this.seItem.id
+        });
+        this.layerIndex = index;
+    }
+};
+
+/**
+ * 删除
+ */
+Hospital.delHospital = function () {
+    if (this.check()) {
+
+        var operation = function () {
+            var ajax = new $ax(Feng.ctxPath + "/admin/hospital.mgr/delete", function (data) {
+                Feng.success("删除成功!");
+                Hospital.table.refresh();
+            }, function (data) {
+                Feng.error("删除失败!" + data.responseJSON.message + "!");
+            });
+            ajax.set("id", Hospital.seItem.id);
+            ajax.start();
+        };
+
+        Feng.confirm("是否刪除该医院?", operation);
+    }
+};
+
+/**
+ * 搜索
+ */
+Hospital.search = function () {
+    var queryData = {};
+
+    queryData['categoryName'] = $("#categoryName").val();
+    queryData['hospitalName'] = $("#hospitalName").val();
+
+    Hospital.table.refresh({query: queryData});
+}
+
+$(function () {
+    var defaultColunms = Hospital.initColumn();
+    var table = new BSTreeTable(Hospital.id, "/admin/hospital.mgr/list", defaultColunms);
+    table.setExpandColumn(2);
+    table.setIdField("id");
+    table.setCodeField("code");
+    table.setParentCodeField("categoryId");
+    table.setExpandAll(true);
+    table.init();
+    Hospital.table = table;
+});