|
|
|
@ -51,6 +51,7 @@ class OrderController extends Controller
|
|
|
|
return $this->CreateOrder($exam_id);
|
|
|
|
return $this->CreateOrder($exam_id);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//根据体检号拉取数据进行存储
|
|
|
|
//根据体检号拉取数据进行存储
|
|
|
|
public function CreateOrder($exam_id)
|
|
|
|
public function CreateOrder($exam_id)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
@ -136,4 +137,86 @@ class OrderController extends Controller
|
|
|
|
'info' => $order_info
|
|
|
|
'info' => $order_info
|
|
|
|
]);
|
|
|
|
]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//线下预约完后,未支付,未到检,推送过来订单,由H5进行后续流程,支付改约等
|
|
|
|
|
|
|
|
public function OfflineOrderPush()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
$password = request('password');
|
|
|
|
|
|
|
|
if ($password !== 'YRtA1rx1iWgbpYKX') return \Yz::echoErrorJson("校验密码失败");
|
|
|
|
|
|
|
|
$hospital_id = request('hospital_id'); //秀英院区1,府城院区4
|
|
|
|
|
|
|
|
$appointment_number = request('appointment_number');
|
|
|
|
|
|
|
|
$plan_id = request('plan_id');
|
|
|
|
|
|
|
|
if (!isset($plan_id) or empty($plan_id)) return \Yz::echoErrorJson("占用的号源id不能为空");
|
|
|
|
|
|
|
|
$plan_info=DB::table('plans')->where('id', $plan_id)->first();
|
|
|
|
|
|
|
|
$data = [
|
|
|
|
|
|
|
|
"证件号码" => null,
|
|
|
|
|
|
|
|
"电话号码" => null,
|
|
|
|
|
|
|
|
"预约Id" => $appointment_number,
|
|
|
|
|
|
|
|
];
|
|
|
|
|
|
|
|
$peis = new PEISApiController();
|
|
|
|
|
|
|
|
$info = $peis::Post('个检预约查询', $hospital_id, $data);
|
|
|
|
|
|
|
|
if (isset($info['data'][0])) {
|
|
|
|
|
|
|
|
$res = $info['data'][0];
|
|
|
|
|
|
|
|
$checkup_type_id = null;
|
|
|
|
|
|
|
|
$checkup_type = DB::table('checkup_type')->where('name', $res['体检类型'])->first();
|
|
|
|
|
|
|
|
if(!!$checkup_type) $checkup_type_id = $checkup_type->id;
|
|
|
|
|
|
|
|
// $title=$res['项目列表'];
|
|
|
|
|
|
|
|
// if(empty($res['项目列表']) and $res['总计金额']==0){
|
|
|
|
|
|
|
|
// $title='空号源';
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
$items = [];
|
|
|
|
|
|
|
|
foreach ($res['项目列表'] as $it) {
|
|
|
|
|
|
|
|
$items[] = [
|
|
|
|
|
|
|
|
'id' => $it['Id'],
|
|
|
|
|
|
|
|
'name' => $it['名称'],
|
|
|
|
|
|
|
|
'price' => $it['价格'],
|
|
|
|
|
|
|
|
];
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
$buyInfo = [
|
|
|
|
|
|
|
|
'combo' => [
|
|
|
|
|
|
|
|
'id' => 0,
|
|
|
|
|
|
|
|
'name' => '',
|
|
|
|
|
|
|
|
'price' => ''
|
|
|
|
|
|
|
|
],
|
|
|
|
|
|
|
|
'items' => $items,
|
|
|
|
|
|
|
|
'group' => [
|
|
|
|
|
|
|
|
'id' => '',
|
|
|
|
|
|
|
|
]
|
|
|
|
|
|
|
|
];
|
|
|
|
|
|
|
|
$orderController= new \App\Http\Controllers\API\H5\OrderController();
|
|
|
|
|
|
|
|
$save_data = [
|
|
|
|
|
|
|
|
'title' => $res['套餐名称'],
|
|
|
|
|
|
|
|
'type' => 1,
|
|
|
|
|
|
|
|
'source' => count($items)==0?'线下体检预约-空号源':'线下体检预约-项目',
|
|
|
|
|
|
|
|
'checkup_type_id' => $checkup_type_id,
|
|
|
|
|
|
|
|
'person_id' => 0,
|
|
|
|
|
|
|
|
'name' => $res['姓名'],
|
|
|
|
|
|
|
|
'id_number' => $res['证件号码'],
|
|
|
|
|
|
|
|
'buy_info' => json_encode($buyInfo, JSON_UNESCAPED_UNICODE),
|
|
|
|
|
|
|
|
'price' => $res['总计金额'],
|
|
|
|
|
|
|
|
'true_price' => $res['总计金额'],
|
|
|
|
|
|
|
|
'order_number' =>$orderController->generateOrderNumber(),
|
|
|
|
|
|
|
|
'status' =>1,
|
|
|
|
|
|
|
|
'appointment_date' =>$plan_info->date,
|
|
|
|
|
|
|
|
'appointment_time' =>$plan_info->time,
|
|
|
|
|
|
|
|
'appointment_number' =>$res['预约Id'],
|
|
|
|
|
|
|
|
'appointment_back_info' => json_encode($res, JSON_UNESCAPED_UNICODE),
|
|
|
|
|
|
|
|
'plan_id' =>$plan_info->id,
|
|
|
|
|
|
|
|
'plan_number' =>$plan_info->plan_number,
|
|
|
|
|
|
|
|
'hospital_id' =>$hospital_id,
|
|
|
|
|
|
|
|
'phone' =>$res['电话号码'],
|
|
|
|
|
|
|
|
'sex' =>null,
|
|
|
|
|
|
|
|
'birthday' =>null,
|
|
|
|
|
|
|
|
'married' =>4,
|
|
|
|
|
|
|
|
];
|
|
|
|
|
|
|
|
$insert = DB::table('orders')->insert($save_data);
|
|
|
|
|
|
|
|
if ($insert) {
|
|
|
|
|
|
|
|
return \Yz::Return(true, "创建成功", ['id' => $insert]);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
return \Yz::echoErrorJson("创建失败");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
return \Yz::echoErrorJson("未获取到预约信息");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|