二线预约数据存储,预约前校验

main
yanzai 1 year ago
parent 066383f62b
commit 045fd4af86

@ -267,6 +267,7 @@ select combo_id as c_id,count(*) as sale_count from orders where status in(2,4)
$nmr_list[]=[
'item_id' => $v2['Id'],
'name' => $v2['名称'],
'price' => $v2['价格'],
];
}
$Nx1_arrInfo[] = [
@ -333,6 +334,7 @@ select combo_id as c_id,count(*) as sale_count from orders where status in(2,4)
$nmr_list[]=[
'item_id' => $item->item_id,
'name' => $item->name,
'price' => $item->price,
];
}
}
@ -360,6 +362,7 @@ select combo_id as c_id,count(*) as sale_count from orders where status in(2,4)
$nmr_list[]=[
'item_id' => $item->item_id,
'name' => $item->name,
'price' => $item->price,
];
}
}
@ -421,6 +424,7 @@ select combo_id as c_id,count(*) as sale_count from orders where status in(2,4)
$nmr_list[]=[
'item_id' => $it->item_id,
'name' => $it->name,
'price' => $it->price,
];
}
break;
@ -454,6 +458,7 @@ select combo_id as c_id,count(*) as sale_count from orders where status in(2,4)
if(count($nmr_list)>0){
$nmr_list=[
['item_id' => $nmr_list[0]['item_id'],
'price' => $nmr_list[0]['price'],
'name' =>$temp_nmr]
];

@ -391,6 +391,7 @@ class OrderController extends Controller
'name' => $plan_nmr['name'],
'date' => substr($plan_nmr['time'], 0, 10),
'time' => substr($plan_nmr['time'], 10, 5),
'price' => $plan_nmr['price'],
];
//调用接口校验号源是否可用
$erxian_status = $AspNet::ErXian(['YYRQ' => $p_nmr_data['date'], 'YYSJ' => $p_nmr_data['time'], 'yyid' => $yyid, 'action' => 4], uniqid());
@ -579,8 +580,33 @@ class OrderController extends Controller
//最后步骤,开始通知思信预约
public function Finish($order_number)
{
$AspNet=new AspNetZhuanController();
$order_info = DB::table('orders')->where(['order_number' => $order_number])->first();
if (!$order_info) return ['status' => false, 'msg' => "未找到有效订单。"];
$yyid=6;
if($order_info->hospital_id == 1){
$yyid=6;
}
if($order_info->hospital_id == 4){
$yyid=2;
}
//如果有二线信息校验二线号源是否可用
$erxian_info=json_decode($order_info->erxian_appointment_info, true);
if (isset($erxian_info) and !empty($erxian_info)) {
foreach ($erxian_info as $key => $plan_nmr) {
$p_nmr_data = [
'item_id' => $plan_nmr['item_id'],
'name' => $plan_nmr['name'],
'date' => substr($plan_nmr['time'], 0, 10),
'time' => substr($plan_nmr['time'], 10, 5),
];
//调用接口校验号源是否可用
$erxian_status = $AspNet::ErXian(['YYRQ' => $p_nmr_data['date'], 'YYSJ' => $p_nmr_data['time'], 'yyid' => $yyid, 'action' => 4], uniqid());
if ($erxian_status !== true) return \Yz::echoError1($p_nmr_data['name'] . '号源不可用');
}
}
$buy_info = json_decode($order_info->buy_info, true);
$combo_id = $buy_info['combo']['id'];
$item_arr = [];
@ -656,7 +682,8 @@ class OrderController extends Controller
//查询确认订单已经是支付状态
$cha = DB::table('orders')->where(['order_number' => $order_number, 'status' => 2])->first();
if (!$cha) return ['status' => false, 'msg' => "订单未支付,禁止预约"];
//把状态更新为支付后,然后再开始预约思信
//把状态更新为支付后,先二线,然后再开始预约思信
$create_appointment = self::create_appointment($order_info->hospital_id, $cad);
if (!isset($create_appointment['data'][0][0])) return ['status' => false, 'msg' => "体检预约,返回非预期结果"];

Loading…
Cancel
Save