|
|
|
@ -17,11 +17,17 @@ class OrderController extends Controller
|
|
|
|
$openid = $request->post('openid');
|
|
|
|
$openid = $request->post('openid');
|
|
|
|
$user = DB::table('web_users')->where(['openid' => $openid, 'is_del' => 0])->first();
|
|
|
|
$user = DB::table('web_users')->where(['openid' => $openid, 'is_del' => 0])->first();
|
|
|
|
if (!$user) return \Yz::echoError1("openid对应用户不存在");
|
|
|
|
if (!$user) return \Yz::echoError1("openid对应用户不存在");
|
|
|
|
|
|
|
|
$persons_sfz=DB::table('web_user_person')->where(['user_id' => $user->id,'is_del'=>0])->pluck('id_number')->toArray();
|
|
|
|
|
|
|
|
|
|
|
|
$OrderList = DB::table('orders')
|
|
|
|
$OrderList = DB::table('orders')
|
|
|
|
->select('id', 'title', 'status', 'name', 'appointment_time as time', 'order_number as order',
|
|
|
|
->select('id', 'title', 'status', 'name', 'appointment_time as time', 'order_number as order',
|
|
|
|
DB::raw("CASE WHEN type = 1 THEN '个检' WHEN type = 2 THEN '团检' ELSE 'unknown' END as type"),
|
|
|
|
DB::raw("CASE WHEN type = 1 THEN '个检' WHEN type = 2 THEN '团检' ELSE 'unknown' END as type"),
|
|
|
|
'price', 'true_price', 'pay_time', 'refund_time', 'created_at')
|
|
|
|
'price', 'true_price', 'pay_time', 'refund_time', 'created_at')
|
|
|
|
->where(['web_user_id' => $user->id])->get();
|
|
|
|
->where(['web_user_id' => $user->id])
|
|
|
|
|
|
|
|
->orWhere(function($query) use ($persons_sfz) {
|
|
|
|
|
|
|
|
$query->WhereIn('id_number', $persons_sfz)
|
|
|
|
|
|
|
|
->where('person_id', 0);
|
|
|
|
|
|
|
|
})->get();
|
|
|
|
$WaitingPaymentTime = config('app.globals.WaitingPaymentTime');//支付等待時間
|
|
|
|
$WaitingPaymentTime = config('app.globals.WaitingPaymentTime');//支付等待時間
|
|
|
|
foreach ($OrderList as $key => $list) {
|
|
|
|
foreach ($OrderList as $key => $list) {
|
|
|
|
if ($list->status == 1) {
|
|
|
|
if ($list->status == 1) {
|
|
|
|
@ -38,6 +44,7 @@ class OrderController extends Controller
|
|
|
|
'list' => $OrderList
|
|
|
|
'list' => $OrderList
|
|
|
|
]);
|
|
|
|
]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public function GetDetail()
|
|
|
|
public function GetDetail()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
$id = request('id');
|
|
|
|
$id = request('id');
|
|
|
|
@ -370,12 +377,25 @@ class OrderController extends Controller
|
|
|
|
"电话号码" => null,
|
|
|
|
"电话号码" => null,
|
|
|
|
"预约Id" => $create_appointment['data'][0][0],
|
|
|
|
"预约Id" => $create_appointment['data'][0][0],
|
|
|
|
]);
|
|
|
|
]);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//如果是医生web端预约,则调用预约时段修改接口,传入医生名称
|
|
|
|
|
|
|
|
if ($order_info->source == 'web') {
|
|
|
|
|
|
|
|
$peis = new PEISApiController();
|
|
|
|
|
|
|
|
$dat = [
|
|
|
|
|
|
|
|
"预约Id" => $create_appointment['data'][0][0],
|
|
|
|
|
|
|
|
"预约开始时间" => $order_info->appointment_date . ' ' . $order_info->appointment_time,
|
|
|
|
|
|
|
|
"预约截止时间" => $order_info->appointment_date . ' ' . $order_info->appointment_time,
|
|
|
|
|
|
|
|
"AppDoctor" => $order_info->appdoctor
|
|
|
|
|
|
|
|
];
|
|
|
|
|
|
|
|
$info = $peis::Post('预约时段修改', $order_info->hospital_id,$dat);
|
|
|
|
|
|
|
|
}
|
|
|
|
DB::table('orders')->where(['order_number' => $order_number])->update([
|
|
|
|
DB::table('orders')->where(['order_number' => $order_number])->update([
|
|
|
|
'appointment_number' => $create_appointment['data'][0][0],
|
|
|
|
'appointment_number' => $create_appointment['data'][0][0],
|
|
|
|
'appointment_back_info' => json_encode($appointment_info['data'][0], JSON_UNESCAPED_UNICODE)
|
|
|
|
'appointment_back_info' => json_encode($appointment_info['data'][0], JSON_UNESCAPED_UNICODE)
|
|
|
|
]);
|
|
|
|
]);
|
|
|
|
return ['status' => true, 'msg' => "完成"];
|
|
|
|
return ['status' => true, 'msg' => "完成"];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public function create_appointment($hospital, $data)
|
|
|
|
public function create_appointment($hospital, $data)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
$peis = new PEISApiController();
|
|
|
|
$peis = new PEISApiController();
|
|
|
|
@ -384,6 +404,7 @@ class OrderController extends Controller
|
|
|
|
$info = $peis::Post($url_code, $hospital, $data);
|
|
|
|
$info = $peis::Post($url_code, $hospital, $data);
|
|
|
|
return $info;
|
|
|
|
return $info;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public function appointment_info($hospital, $data)
|
|
|
|
public function appointment_info($hospital, $data)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
$peis = new PEISApiController();
|
|
|
|
$peis = new PEISApiController();
|
|
|
|
@ -392,6 +413,7 @@ class OrderController extends Controller
|
|
|
|
$info = $peis::Post($url_code, $hospital, $data);
|
|
|
|
$info = $peis::Post($url_code, $hospital, $data);
|
|
|
|
return $info;
|
|
|
|
return $info;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public function cancel_appointment($hospital, $data)
|
|
|
|
public function cancel_appointment($hospital, $data)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
$peis = new PEISApiController();
|
|
|
|
$peis = new PEISApiController();
|
|
|
|
|