diff --git a/Laravel/app/Services/Admin/YeWu/PlanListService.php b/Laravel/app/Services/Admin/YeWu/PlanListService.php index ca5555f..bd3a982 100644 --- a/Laravel/app/Services/Admin/YeWu/PlanListService.php +++ b/Laravel/app/Services/Admin/YeWu/PlanListService.php @@ -15,13 +15,6 @@ class PlanListService { date_default_timezone_set('PRC'); - //查询号源渠道是否有合并 - $appointment_types=[$appointment_type]; - $appointment_type_link = DB::table('s_appointment_type_ratio')->where(['appointment_type_id' => $appointment_type])->first(); - if (!empty($appointment_type_link->link)) { - $appointment_types=json_decode($appointment_type_link->link, true); - $appointment_types=array_merge($appointment_types, [$appointment_type]); - } $allDevice = [];//所有医嘱检查项目绑定的设备id $commPatientType = [];//所有医嘱共同的病人类型 foreach ($entrustids as $key => $entrustid) { @@ -67,6 +60,14 @@ class PlanListService $department_id = DB::table('s_department')->where(['department_number' => $info->RISRAcceptDeptCode])->first(); if (!$department_id) return \Yz::echoError1('获取医嘱检查项目科室信息失败'); + //查询号源渠道是否有合并 + $appointment_types=[$appointment_type]; + $appointment_type_link = DB::table('s_appointment_type_ratio')->where(['department_id'=>$department_id->id,'appointment_type_id' => $appointment_type])->first(); + if (!empty($appointment_type_link->link)) { + $appointment_types=json_decode($appointment_type_link->link, true); + $appointment_types=array_merge($appointment_types, [$appointment_type]); + } + if(count($commonDevice)==0) return \Yz::echoError1("无可用号源"); $placeholders = implode(',', array_fill(0, count($commonDevice), '?')); @@ -154,17 +155,20 @@ WHERE // $do_type = request('dotype');//操作类型,1预约,2改约 // if (!isset($do_type)) return \Yz::echoError1('参数:操作类型 不能为空'); + + + $planInfo = DB::table('s_source_roster_detail')->where(['id' => $planid, 'status' => 1, 'is_del' => 0])->first(); + if (!$planInfo) return \Yz::echoError1('当前时段不可用'); + if ($nowdatetime > $planInfo->date . ' ' . $planInfo->end_reservation_time) return \Yz::echoError1('已经超过预约截止时间'); + //查询号源渠道是否有合并 $appointment_types=[$appointment_type]; - $appointment_type_link = DB::table('s_appointment_type_ratio')->where(['appointment_type_id' => $appointment_type])->first(); + $appointment_type_link = DB::table('s_appointment_type_ratio')->where(['department_id'=>$planInfo->department_id,'appointment_type_id' => $appointment_type])->first(); if (!empty($appointment_type_link->link)) { $appointment_types=json_decode($appointment_type_link->link, true); $appointment_types=array_merge($appointment_types, [$appointment_type]); } - $planInfo = DB::table('s_source_roster_detail')->where(['id' => $planid, 'status' => 1, 'is_del' => 0])->first(); - if (!$planInfo) return \Yz::echoError1('当前时段不可用'); - if ($nowdatetime > $planInfo->date . ' ' . $planInfo->end_reservation_time) return \Yz::echoError1('已经超过预约截止时间'); $roster_detail_counts = DB::table('s_source_roster_detail_count') ->where(['roster_detail_id' => $planid]) ->whereIn('appointment_type_id', $appointment_types)