作者 sgj

the platment and hospital info getment

... ... @@ -55,10 +55,15 @@ class HospitalController extends AdminBaseController
* )
*/
public function index(){
$platment=$this->HospitalModel->getPlatment()->toArray();
dump($platment);
$this->assign('platment',$platment);
return $this->fetch();
$platment_id=input('id');
if (empty($platment_id)){
// return $this->error();
}
$hospital=$this->HospitalModel->getHospital($platment_id)->toArray();
dump($hospital);
$this->assign('hospital',$hospital);
$this->assign('platform_id',$platment_id);
return $this->fetch('hospital');
}
... ... @@ -76,14 +81,7 @@ class HospitalController extends AdminBaseController
* )
*/
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();
}
/**
... ... @@ -144,9 +142,7 @@ class HospitalController extends AdminBaseController
/*查询本平台信息*/
$fatherPlatment=$this->HospitalModel->getPlatment($platform_id)->toArray();
/*查询所有平台信息*/
$allPlatment=$this->HospitalModel->getPlatment()->toArray();
$this->assign('fatherPlatment',$fatherPlatment);
$this->assign('allPlatment',$allPlatment);
return $this->fetch();
}
}
... ... @@ -195,7 +191,7 @@ class HospitalController extends AdminBaseController
if ($result !== true) {
$this->error($result);
}
$result=$this->OfficeModel->officeAdd($post['id'],$post['name']);
$result=$this->OfficeModel->officeAdd($post['id'],$post['name'],$post['platform']);
if ($result==1){
$this->success('添加成功!');
}else{
... ... @@ -208,6 +204,8 @@ class HospitalController extends AdminBaseController
/*查询所有平台信息*/
//$allPlatment=$this->HospitalModel->getPlatment()->toArray();
$this->assign('fatherPlatment',$fatherPlatment);
$allPlatment=$this->HospitalModel->getPlatment()->toArray();
$this->assign('allPlatment',$allPlatment);
// $this->assign('allPlatment',$allPlatment);
return $this->fetch();
}
... ...
... ... @@ -52,8 +52,12 @@ class HospitalModel extends Model
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function getHospital($platform_id){
$map['platform_id']=$platform_id;
public function getHospital($platform_id=''){
if ($platform_id!=''){
$map['platform_id']=$platform_id;
}else{
$map='';
}
$hospital=$this->where($map)->select();
return $hospital;
}
... ... @@ -76,4 +80,29 @@ class HospitalModel extends Model
return $this->save();
}
/**
* 获取平台内部医院
* @param $platform 平台id
* @return mixed
*/
public function getHospitalByPaltform($platform){
$map['platform_id']=$platform;
$info=view('platform_info')->field('hospital_name,hospital_id')->where($map)->select();
return $info;
}
/**
* 通过 平台 医院获取科室
* @param $platform 平台id
* @param $hospital 医院id
* @return mixed
*/
public function getOfficeByHP($platform,$hospital){
$map['platform_id']=$platform;
$map['hospital_id']=$hospital;
$info=view('platform_info')->field('office_name,office_id')->where($map)->select();
return $info;
}
}
\ No newline at end of file
... ...
... ... @@ -68,12 +68,13 @@ class OfficeModel extends Model
return $result;
}
public function officeAdd($id,$name){
public function officeAdd($id,$name,$platform){
$this->data([
'name' => $name,
'hospital_id' => $id
'hospital_id' => $id,
'platform' => $platform
]);
return $this->save();
return $this->save();
}
}
\ No newline at end of file
... ...
... ... @@ -14,4 +14,15 @@ use think\Model;
class UserModel extends Model
{
public function getUserByPlatform($platform){
$map['user_type']='2';
$map['platform']=$platform;
$this->where('')->select();
}
public function getExpertByPlatform(){
}
}
\ No newline at end of file
... ...
... ... @@ -15,7 +15,11 @@ class InquiryController extends WeChatBaseController
{
public function index(){
/*获取疾病分类*/
/*引入微信sdk*/
return $this->fetch();
}
}
\ No newline at end of file
... ...
<?php
/**
* Created by PhpStorm.
* auther: sgj
* Date: 2018/12/3
* Time: 10:42
*/
namespace app\portal\model;
use app\admin\model\HospitalModel;
use think\Model;
use traits\model\SoftDelete;
class InquiryModel extends Model
{
use SoftDelete;
protected $deleteTime = 'delete_time';
protected $insert =['addtime'];
/**
* 自动填充数据
* @return mixed
*/
protected function setAddtimeAttr()
{
return time();
}
public function getPlatform($platform){
$hospital= new HospitalModel();
$return=$hospital->getPlatment($platform);
return $return;
}
public function getExpert(){
new \app\admin\model\UserModel();
}
}
\ No newline at end of file
... ...
... ... @@ -15,6 +15,4 @@ use think\Model;
class UserModel extends Model
{
}
\ No newline at end of file
... ...
... ... @@ -3,7 +3,7 @@
<body>
<div class="wrap js-check-wrap">
<ul class="nav nav-tabs">
<li ><a href="{:url('hospital',['id'=>$fatherPlatment['0']['id']])}">医院管理</a></li>
<li ><a href="{:url('index')}">医院管理</a></li>
<li class="active"><a href="">添加医院</a></li>
</ul>
<form method="post" class="form-horizontal js-ajax-form margin-top-20" action="{:url('hospitalAdd')}">
... ... @@ -15,17 +15,7 @@
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">平台名称:</label>
<div class="col-md-6 col-sm-10">
<select name="id" class="form-control">
<option value="{$fatherPlatment['0']['id']}" >{$fatherPlatment['0']['name']}</option>
<foreach name="$allPlatment" key="k" item="vo">
<option value="{$vo['id']}" >{$vo['name']}</option>
</foreach>
</select>
</div>
</div>
<div class="col-sm-offset-2 col-sm-10">
<button type="submit" class="btn btn-primary js-ajax-submit">{:lang("SAVE")}</button>
... ...
... ... @@ -15,6 +15,18 @@
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">平台名称:</label>
<div class="col-md-6 col-sm-10">
<select name="platform" class="form-control">
<foreach name="$allPlatment" key="k" item="vo">
<option value="{$vo['id']}" >{$vo['name']}</option>
</foreach>
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">医院名称:</label>
<div class="col-md-6 col-sm-10">
... ... @@ -24,6 +36,7 @@
</div>
</div>
<div class="col-sm-offset-2 col-sm-10">
<button type="submit" class="btn btn-primary js-ajax-submit">{:lang("SAVE")}</button>
<a class="btn btn-default" href="__URL__">返回</a>
... ...