对接思信预约登记

wenjuan
yanzai 1 year ago
parent 35c13b4c3f
commit f68ae46188

@ -184,7 +184,10 @@ class OrderController extends Controller
]; ];
$title = "单位团检" . $group_info['combo_name']; $title = "单位团检" . $group_info['combo_name'];
$price = $price + $group_info['sixi_zong_ji_jin_e']; $price = $price + $group_info['sixi_zong_ji_jin_e'];
$true_price = ($price - $group_info['tongshou_xiane']) > 0 ? $price - $group_info['tongshou_xiane'] : 0; $need_pay = ($price - $group_info['tongshou_xiane']) > 0 ? $price - $group_info['tongshou_xiane'] : 0;
//团检订单金额为减去统收后的金的
$price = $need_pay;
$true_price = $need_pay;
} }
//调用思信接口判断各个项目是否可用 //调用思信接口判断各个项目是否可用
@ -310,4 +313,72 @@ class OrderController extends Controller
$check = $peis::Post('套餐项目检查', $hospital, $data); $check = $peis::Post('套餐项目检查', $hospital, $data);
return $check; return $check;
} }
public function Finish_test() //删除!!!
{
self::Finish('20240915183440999WMp2yu');
}
//最后步骤,开始通知思信预约
public function Finish($order_number)
{
$order_info = DB::table('orders')->where(['order_number' => $order_number, 'status' => 1])->first();
if (!$order_info) return ['status' => false, 'msg' => "未找到有效订单"];
$buy_info = json_decode($order_info->buy_info, true);
$combo_id = $buy_info['combo']['id'];
$item_arr = [];
foreach ($buy_info['items'] as $item) {
$item_arr[] = ['Id' => $item['id'], '已收费' => true];
}
//调用思信 套餐项目检查
if ((isset($combo_id) and $combo_id <> 0) || count($item_arr) != 0) {
$item_check = self::item_check($order_info->hospital_id, [
'人员信息列表' => [[
"序号" => 0,
"性别" => $order_info->sex == 1 ? '男' : '女',
"年龄" => floor((time() - strtotime($order_info->birthday)) / 86400 / 360),
"婚姻状态" => $order_info->married == 1 ? '已婚' : '未婚',
]],
'套餐Id' => $combo_id == 0 ? null : $combo_id,
'可选项目信息' => $item_arr,
]);
if (count($item_check['data']) != 1) {
return \Yz::echoError1("体检系统提示:" . $item_check['message']);
}
}
//如果是个检
if ($order_info->type == 1) {
$cad = [
'type' => 1,
"姓名" => $order_info->name,
"性别" => $order_info->sex == 1 ? '男' : '女',
"年龄" => floor((time() - strtotime($order_info->birthday)) / 86400 / 360),
"婚姻状态" => $order_info->married == 1 ? '已婚' : '未婚',
"证件号码" => $order_info->id_number,
"电话号码" => $order_info->phone,
"预约时间" => $order_info->appointment_date . ' ' . $order_info->appointment_time,
"介绍人" => $order_info->referral,
'套餐Id' => $order_info->combo_id == 0 ? null : $order_info->combo_id,
"可选项目信息" => $item_arr,
"已收费" => true,
"总计金额" => $order_info->price,
];
} else {
$cad = [
'type' => 2,
"预约Id" => $buy_info['group']['group_id'],
"预约时间" => $order_info->appointment_date . ' ' . $order_info->appointment_time,
'套餐Id' => null,
"可选项目信息" => $item_arr
];
}
//更新订单状态为已支付, 支付流水号在 上一步(方法)更新,
DB::table('orders')->where(['order_number' => $order_number])->update([
'status' => 2,
'pay_time' => date('Y-m-d H:i:s'),
]);
//先把状态更新为支付,然后再开始预约思信
}
} }

@ -57,6 +57,10 @@ Route::group(['prefix' => 'api/H5'], function () {
Route::post('/GetGroupUnit', 'App\Http\Controllers\API\H5\PersonController@GetGroupUnit');//团检登记查询获取单位分组 Route::post('/GetGroupUnit', 'App\Http\Controllers\API\H5\PersonController@GetGroupUnit');//团检登记查询获取单位分组
Route::post('/GetGroupCombo', 'App\Http\Controllers\API\H5\PersonController@GetGroupCombo');//获取团检套餐 Route::post('/GetGroupCombo', 'App\Http\Controllers\API\H5\PersonController@GetGroupCombo');//获取团检套餐
//测试----------------------------
Route::post('/Finish_test', 'App\Http\Controllers\API\H5\OrderController@Finish_test');//测试
}); });

Loading…
Cancel
Save