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.
70 lines
2.4 KiB
PHP
70 lines
2.4 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers\API\mH5;
|
|
|
|
use App\Http\Controllers\Controller;
|
|
use Illuminate\Http\Request;
|
|
use App\Services\mH5\OrganizationService;
|
|
use Illuminate\Support\Facades\DB;
|
|
|
|
class OrganizationController extends Controller
|
|
{
|
|
//获取正常状态的体检机构
|
|
public function GetEnableList(){
|
|
$yuyue_type=request('yuyue_type');
|
|
$s=app()->make(OrganizationService::class);
|
|
return $s->GetList(['type'=>'enable','yuyue_type'=>$yuyue_type]);
|
|
}
|
|
//获取单独体检机构可预约日历时间表
|
|
public function GetEnableCalendar(){
|
|
$org_id=request('org_id');
|
|
$institutionalId =request('id'); //机构id
|
|
$s=app()->make(OrganizationService::class);
|
|
return $s->GetCalendar(['type'=>'enable','institutionalId'=>$institutionalId,'org_id'=>$org_id]);
|
|
}
|
|
|
|
//开始预约
|
|
public function StartYuYue(Request $request){
|
|
$openid = $request->get('userid');//中间件产生的参数
|
|
$group = $request->get('role');//中间件产生的参数
|
|
$subinfo=request('subinfo');
|
|
if(isset($openid) and isset($subinfo)){
|
|
foreach ($subinfo as $key=> $info){
|
|
if(!isset($info)) return \Yz::echoError1("部分参数不完整");
|
|
|
|
}
|
|
$s=app()->make(OrganizationService::class);
|
|
if($subinfo['yuyue_type']=='laonianren_mf'){
|
|
$type=2;//1 健康证体检 2老年人体检
|
|
}
|
|
if($subinfo['yuyue_type']=='jiankangzheng_mf'){
|
|
$type=1;//1 健康证体检 2老年人体检
|
|
}
|
|
if(!isset($type)) return \Yz::echoError1("体检类型不能为空");
|
|
|
|
return $s->StartYuYue(['openid'=>$openid,'group'=>$group,'info'=>$subinfo],$type);
|
|
}else{
|
|
return \Yz::echoError1("参数不完整");
|
|
}
|
|
|
|
}
|
|
//取消预约
|
|
public function CancelYuYue(Request $request)
|
|
{
|
|
$openid = $request->get('userid');//中间件产生的参数
|
|
// dd($openid);
|
|
$group = $request->get('role');//中间件产生的参数
|
|
$id=request('id');
|
|
$info=DB::table('appointment_record')->where(['id'=>$id,'openid'=>$openid])->update([
|
|
'is_del'=>1
|
|
]);
|
|
if($info){
|
|
return \Yz::Return(true,'取消成功',[]);
|
|
}else{
|
|
return \Yz::echoError1("取消失败");
|
|
}
|
|
|
|
}
|
|
|
|
}
|