You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
78 lines
2.4 KiB
PHP
78 lines
2.4 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers\API\Admin\YeWu;
|
|
|
|
use App\Http\Controllers\Controller;
|
|
use Illuminate\Http\Request;
|
|
use Illuminate\Support\Facades\DB;
|
|
|
|
class HospitalController extends Controller
|
|
{
|
|
public function Save()
|
|
{
|
|
$Info =request('Info');
|
|
$data=[
|
|
'name'=>$Info['name'],
|
|
'code'=>$Info['code'],
|
|
'address'=>$Info['address'],
|
|
'longitude'=>$Info['longitude'],
|
|
'latitude'=>$Info['latitude'],
|
|
'logo'=>$Info['logo'],
|
|
'tel'=>$Info['tel'],
|
|
// 'frequency'=>$Info['frequency'],
|
|
// 'api_list'=>isset($Info['api_list'])? json_encode($Info['api_list']):null,
|
|
'status'=>$Info['status'],
|
|
];
|
|
if(isset($Info['id']) and $Info['id']!=0){
|
|
$ex=DB::table('hospitals')->where(['id'=>$Info['id']])->update($data);
|
|
}else{
|
|
$ex=DB::table('hospitals')->insert($data);
|
|
}
|
|
if($ex){
|
|
return \Yz::Return(true,"保存成功",[]);
|
|
}else{
|
|
return \Yz::echoError1("保存失败");
|
|
}
|
|
}
|
|
public function GetList()
|
|
{
|
|
$page = request('page');
|
|
$pageSize = request('pageSize');
|
|
$searchInfo = request('searchInfo');
|
|
$list =DB::table('hospitals')->where(['is_del'=>0]);
|
|
$count=$list->count();
|
|
$list=$list
|
|
->skip(($page-1)*$pageSize) // 跳过前9999条记录
|
|
->take($pageSize)->get();
|
|
return \Yz::Return(true,"查询成功",['list'=>$list,'count'=>$count]);
|
|
}
|
|
//获取医院基本信息详情
|
|
public function GetBaseInfoDetail()
|
|
{
|
|
$id = request('id');
|
|
$info=DB::table('hospitals')
|
|
->where(['id'=>$id,'is_del'=>0])->first();
|
|
if(!!$info){
|
|
$info->api_list= $info->api_list?implode(',',json_decode( $info->api_list)):'';
|
|
return \Yz::Return(true,'查询成功',$info);
|
|
}else{
|
|
return \Yz::echoError1("查询失败");
|
|
}
|
|
}
|
|
public function SaveCacheInfo()
|
|
{
|
|
$Info =request('Info');
|
|
$ex=DB::table('hospitals')->where(['id'=>$Info['id']])->update([
|
|
'frequency'=>$Info['frequency'],
|
|
'api_list'=>json_encode($Info['api_list'],JSON_UNESCAPED_UNICODE)
|
|
]);
|
|
if($ex){
|
|
return \Yz::Return(true,"保存成功",[]);
|
|
}else{
|
|
return \Yz::echoError1("保存失败");
|
|
}
|
|
|
|
}
|
|
//获取
|
|
}
|