新增对外接口 号源列表、占用号源、预约订单查询
parent
673f55aee4
commit
b8ea9c4c06
@ -0,0 +1,48 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers\API\Internal;
|
||||||
|
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
|
|
||||||
|
class PlanController extends Controller
|
||||||
|
{
|
||||||
|
//给自助机用接口
|
||||||
|
//获取可用号源列表,
|
||||||
|
public function PlanList()
|
||||||
|
{
|
||||||
|
$hospital_id =request('hospital');
|
||||||
|
$date=request('date');
|
||||||
|
$is_vip=request('is_vip');
|
||||||
|
$checkup_type_id=(string)request('checkup_type_id');//体检类型表对应id
|
||||||
|
if(!isset($checkup_type_id)) return \Yz::echoError1("体检类型不能为空");
|
||||||
|
$currentDateTime = now();
|
||||||
|
$list=DB::table('plans')
|
||||||
|
->where('date',$date)->whereIn('status',[1])
|
||||||
|
->whereRaw('CONCAT(date, " ", time) >?', [$currentDateTime])
|
||||||
|
->whereRaw('JSON_CONTAINS(checkup_type_id, ?, "$")',[$checkup_type_id])
|
||||||
|
->where(['hospital_id'=>$hospital_id,'type'=>1])
|
||||||
|
->where('is_vip','=',$is_vip);
|
||||||
|
|
||||||
|
|
||||||
|
$list=$list->get();
|
||||||
|
return \Yz::Return(true,"查询完成",['list'=>$list]);
|
||||||
|
}
|
||||||
|
//给自助机用接口
|
||||||
|
//占用号源
|
||||||
|
public function UsePlan(){
|
||||||
|
$id =request('id');
|
||||||
|
$plan=DB::table('plans')->where('id',$id)->first();
|
||||||
|
if(!$plan) return \Yz::echoError1("该号源不存在");
|
||||||
|
if($plan->status<>1) return \Yz::echoError1("该号源不已被占用,请重新选择");
|
||||||
|
|
||||||
|
$u=DB::table('plans')->where(['id',$id,'status'=>1])->update(['status'=>2]);
|
||||||
|
if($u){
|
||||||
|
return \Yz::Return(true,'操作成功',[]);
|
||||||
|
}else{
|
||||||
|
return \Yz::echoError1("操作失败");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue