体检推送订单

main
yanzai 1 year ago
parent e6c19624b5
commit b52b5cbe74

@ -14,39 +14,105 @@ class OrderController extends Controller
{
$password = request('password');
$serve_id = request('serve_id');
$exam_id= request('exam_id');
$exam_id = request('exam_id');
if ($password !== 'YRtA1rx1iWgbpYKX') return \Yz::echoError1("校验密码失败");
$orderInfo=DB::table('orders')->where('appointment_number',$serve_id)->orderBy('id','desc')->first();
if(!$orderInfo) return \Yz::echoError1("未找到有效订单");
if(!!$exam_id){
if($orderInfo->status==1) return \Yz::echoError1("订单未付款");
if($orderInfo->status==3) return \Yz::echoError1("订单已取消");
if($orderInfo->status==4 || $orderInfo->check_status==2) return \Yz::echoError1("人员已经到检");
if($orderInfo->status==5) return \Yz::echoError1("订单已退款");
if (isset($serve_id) and !empty($serve_id) and $serve_id <> '') { //到检通知
$orderInfo = DB::table('orders')->where('appointment_number', $serve_id)->orderBy('id', 'desc')->first();
if (!$orderInfo) return \Yz::echoError1("未找到有效订单");
if (!!$exam_id) {
if ($orderInfo->status == 1) return \Yz::echoError1("订单未付款");
if ($orderInfo->status == 3) return \Yz::echoError1("订单已取消");
if ($orderInfo->status == 4 || $orderInfo->check_status == 2) return \Yz::echoError1("人员已经到检");
if ($orderInfo->status == 5) return \Yz::echoError1("订单已退款");
// $peis = new PEISApiController();
// $data = [
// "电话号码" => $orderInfo->phone,
// "证件号码" => $orderInfo->id_number,
// ];
// $info = $peis::Post('分诊查询体检号', $orderInfo->hospital_id,$data);
DB::table('orders')->where('id',$orderInfo->id)->update([
'status'=>4,
// 'tj_number'=>$info['data'][0]['体检号'],
'tj_number'=>$exam_id,
'check_status'=>2,
'check_time'=>date('Y-m-d H:i:s')
]);
return \Yz::Return(true,"",['id'=>$orderInfo->id]);
}else{
return \Yz::echoError1("体检号不能为空");
DB::table('orders')->where('id', $orderInfo->id)->update([
'status' => 4,
// 'tj_number'=>$info['data'][0]['体检号'],
'tj_number' => $exam_id,
'check_status' => 2,
'check_time' => date('Y-m-d H:i:s')
]);
return \Yz::Return(true, "", ['id' => $orderInfo->id]);
} else {
return \Yz::echoError1("体检号不能为空");
}
} else { //体检直接登记用户信息没经过h5登记。根据体检号查询信息入库
if (isset($exam_id)) {
$peis = new PEISApiController();
$data = [
'电话号码' => "",
'证件号码' => "",
'体检号' => $exam_id,
'包含内部信息' => true
];
$reports = $peis::Post('体检报告查询', 1, $data);
if (isset($reports['data'][0]['收费项目列表'])) {
$data = $reports['data'][0];
$items=[];
foreach ($data['收费项目列表'] as $it) {
$items[]=[
'id' => $it['收费项目Id'],
'name' => $it['收费项目名称'],
'price' => '',
];
}
$buyInfo=[
'combo'=>[
'id'=>0,
'name'=>'',
'price'=>''
],
'items'=>$items,
'group'=>[
'id'=>'',
]
];
$sex = 0;
if ($data['性别'] == '男') $sex = 1;
if ($data['性别'] == '女') $sex = 2;
$dataInfo = [
'title' => $data['套餐名称'],
'type' => $data['单位名称'] == '个人' ? 1 : 2,
'source' => '体检推送',
'name' => $data['姓名'],
'id_number' => $data['证件号码'],
'buy_info' => json_encode($buyInfo, JSON_UNESCAPED_UNICODE),
'status' => 4,
'plan_number' => $data['分诊信息'],
'phone' => $data['电话号码'],
'sex' => $sex,
'birthday' => explode('T', $data['出生日期'])[0],
'check_status' => 2,
'check_time' => $data['登记时间'],
];
$insert=DB::table('orders')->insert($dataInfo);
if($insert){
return \Yz::Return(true, "创建成功", ['id' => $insert]);
}else{
return \Yz::echoError1("创建失败");
}
} else {
return \Yz::echoError1("根据体检号查询用户信息出错,结果非预期");
}
} else {
return \Yz::echoError1("体检号不能为空");
}
}
}
public function GetH5Order()
{
$appointment_number = request('appointment_number');//思信预约完成后的id
if(!isset($appointment_number) || empty($appointment_number)) return \Yz::echoError1('预约id 不能为空');
$order_info = DB::table('orders')->where(['appointment_number' => $appointment_number,'status'=>2,'check_status'=>1])->first();
if (!isset($appointment_number) || empty($appointment_number)) return \Yz::echoError1('预约id 不能为空');
$order_info = DB::table('orders')->where(['appointment_number' => $appointment_number, 'status' => 2, 'check_status' => 1])->first();
if (!!$order_info) {
$order_info->buy_info = json_decode($order_info->buy_info, true);
$order_info->erxian_appointment_info = json_decode($order_info->erxian_appointment_info, true);

@ -9,11 +9,12 @@ use App\Services\ComboItemGroupService;
use App\Services\OrderService;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Http;
class TestController extends Controller
{
public function DBtest(){
// echo DB::table('users')->count();
echo DB::table('users')->count();
// $order= new OrderService();
// dd($order->DepartmentItemCount(173));
//退款------------------
@ -54,12 +55,27 @@ class TestController extends Controller
// }
//弃检
$service = new ComboItemGroupService();
dd($service->QiJian("2411090001","张三",['1812']));
// $service = new ComboItemGroupService();
// dd($service->QiJian("2411090001","张三",['1812']));
// $peis = new PEISApiController();
// dd($peis::Get($peis::Api('报告时间计算',"2403020020"),"111111","报告时间计算"));
// $peis = new PEISApiController();
// $data = [
// '电话号码' => "",
// '证件号码' => "",
// '体检号' => "2411280001",
// '包含内部信息'=>true
// ];
// $reports = $peis::Post('体检报告查询', 1, $data);
// //到检
// $aa=Http::post('https://tj-h5.hnxdfe.com/TJCheck',[
// 'password'=>'YRtA1rx1iWgbpYKX',
// 'exam_id'=>'2411280001',
// 'serve_id'=>''
// ]);
// dd($aa->json());
// $data=[
// 'action'=>4,
// 'ghzid'=>'5a798c097bc64bd79c22050175e6236a',

Loading…
Cancel
Save