| xqd
@@ -186,12 +186,11 @@ class DocterController extends AuthController
|
|
|
'longitude' => 'numeric',
|
|
|
]);
|
|
|
$user = $this->user;
|
|
|
- $builder = Schedule::with(['schedulePeriod.timePeriod', 'schedulePeriod.organization'])->where('docter_id', $req['docter_id'])->where('schedule_type', 1)->where('schedule_day', '>=', date('Ymd'))->orderBy('schedule_day');
|
|
|
+ $builder = Schedule::with(['schedulePeriod.timePeriod', 'schedulePeriod.organization'])->where('docter_id', $req['docter_id'])->where('schedule_type', 1)->where('schedule_day', '>=', date('Ymd'))->orderBy('schedule_day', 'asc');
|
|
|
if (!empty($req['organization_id'])) {
|
|
|
$builder->where('organization_id', $req['organization_id']);
|
|
|
}
|
|
|
$data = $builder->paginate($req['per_page']??15)->toArray();
|
|
|
- \Log::info($data);
|
|
|
if (!empty($data)) {
|
|
|
foreach ($data['data'] as $k => &$v) {
|
|
|
foreach ($v['schedule_period'] as $k1 => &$v1) {
|
| xqd
@@ -213,61 +212,6 @@ class DocterController extends AuthController
|
|
|
return out($data);
|
|
|
}
|
|
|
|
|
|
-// public function schedulePeriodList()
|
|
|
-// {
|
|
|
-// $req = request()->post();
|
|
|
-// $this->validate(request(), [
|
|
|
-// 'docter_id' => 'required|integer',
|
|
|
-// 'organization_id' => 'integer',
|
|
|
-// 'per_page' => 'integer',
|
|
|
-// 'latitude' => 'numeric',
|
|
|
-// 'longitude' => 'numeric',
|
|
|
-// ]);
|
|
|
-// $user = $this->user;
|
|
|
-// $builder = schedulePeriod::with(['timePeriod', 'organization'])->where('docter_id', $req['docter_id'])->where('schedule_date', '>=', date('Y-m-d'));
|
|
|
-// if (!empty($req['organization_id'])) {
|
|
|
-// $builder->where('organization_id', $req['organization_id']);
|
|
|
-// }
|
|
|
-// $data = $builder->paginate($req['per_page']??15)->toArray();
|
|
|
-// //日期有重复,不同机构排班
|
|
|
-// $newdata = array();
|
|
|
-// if (!empty($data)) {
|
|
|
-//// foreach ($data['data'] as $k => &$v) {
|
|
|
-// foreach ($data as $k1 => $v1) {
|
|
|
-// if (!empty($v1['organization'])) {
|
|
|
-// $v1['organization']['distance'] = get_user_distance($user, $v1['organization']['latitude'], $v1['organization']['longitude']);
|
|
|
-// }
|
|
|
-// $docterSettings = DocterSetting::select(['service_num'])->where('docter_id', $req['docter_id'])->where('type', 1)->where('org_id', $v1['organization_id'])->first();
|
|
|
-// if (empty($docterSettings)) {
|
|
|
-// $v1['can_appoint_num'] = 0;
|
|
|
-// }
|
|
|
-// else {
|
|
|
-// $can_appoint_num = $docterSettings['service_num'] - $v1['order_num'];
|
|
|
-// $v1['can_appoint_num'] = $can_appoint_num < 0 ? 0 : $can_appoint_num;
|
|
|
-// }
|
|
|
-//
|
|
|
-// if(empty($newdata[$v1['time_period']])){
|
|
|
-// $newdata[$v1['schedule_date']] = $v1;
|
|
|
-// }else{
|
|
|
-// $newd = $newdata[$v1['schedule_date']];
|
|
|
-// foreach ($newd['time_period'] as $k2 => $v2) {
|
|
|
-// array_push($v1['time_period'],$v2);
|
|
|
-// }
|
|
|
-// $newdata[$v['schedule_date']] = $v1;
|
|
|
-//
|
|
|
-// }
|
|
|
-// }
|
|
|
-//
|
|
|
-//// }
|
|
|
-// }
|
|
|
-// $res = array();
|
|
|
-// foreach ($newdata as $v) {
|
|
|
-// if (!empty($v['time_period']))$res[] = $v;
|
|
|
-// }
|
|
|
-//
|
|
|
-// return out($res);
|
|
|
-// }
|
|
|
-
|
|
|
public function timePeriodList()
|
|
|
{
|
|
|
$req = request()->post();
|