获取可用号源时,同时返回项目占位数量

main
yanzai 5 months ago
parent a0c156027b
commit d0f1e205e9

@ -18,14 +18,15 @@ class PlanListService
$allDevice = [];//所有医嘱检查项目绑定的设备id
$commPatientType = [];//所有医嘱共同的病人类型
$zhanweiCount=0;//勾选的检查项目共计占多少名额
foreach ($entrustids as $key => $entrustid) {
// $info = DB::table('s_list')->where(['reg_num' => $regnum, 'entrust_id' => $entrustid, 'episodeid' => $episodeid, 'is_nullify' => 0])->first();
$info = DB::table('s_list')->where(['entrust_id' => $entrustid, 'is_nullify' => 0])->first();
if (!$info) return \Yz::echoError1('没有找到对应医嘱信息:'.$entrustid);
$itemInfo = DB::table('s_check_item')->where(['item_name' => $info->entrust, 'status' => 1, "is_del" => 0])->get();
if (count($itemInfo) == 0) return \Yz::echoError1('没有找到可用的检查项目信息');
$itemInfo = $itemInfo[0];
$zhanweiCount+=isset($itemInfo->use_seats)?$itemInfo->use_seats:0;
$qudaos = explode(',', $itemInfo->reservation_method);
//只判断主渠道,如果主渠道支持,则子渠道默认也支持,即使项目没绑定子渠道
if (!in_array($appointment_type, $qudaos)) return \Yz::echoError1('此检查项目不支持在当前渠道预约');
@ -142,7 +143,7 @@ WHERE
$planPatientType = explode(",", $p->patient_type);
if (!empty(array_diff($commPatientType, $planPatientType))) {
continue;
}
}
//过期的排在后面
$time = $p->date . ' ' . $p->end_time;
if ($time > $nowtime) {
@ -153,7 +154,7 @@ WHERE
}
$pp = array_merge($pl1, $pl2);
return \Yz::Return(true, '查询完成', ['today_date' => date("Y-m-d"), 'appointment_date' => $appointment_date, 'weekname' => Tools::GetWeekName($appointment_date), 'mainInfo' => $info, 'plan_list' => $pp]);
return \Yz::Return(true, '查询完成', ['today_date' => date("Y-m-d"), 'appointment_date' => $appointment_date, 'weekname' => Tools::GetWeekName($appointment_date), 'mainInfo' => $info, 'plan_list' => $pp,'zhanWeiCount'=>$zhanweiCount]);
}
//开始预约占用名额

Loading…
Cancel
Save