| xqd
@@ -44,13 +44,19 @@ class DocterController extends AuthController
|
|
|
$docter_ids5 = DocterServiceTime::where('type', 1)->where('start_time_line', '<=', $now_line)->where('end_time_line', '>', $now_line)->pluck('docter_id')->toArray();
|
|
|
$builder->where('is_phone', 1)->whereIn('id', $docter_ids5);
|
|
|
}
|
|
|
- if ($list_type == 2) {
|
|
|
+ elseif ($list_type == 2) {
|
|
|
$docter_ids6 = DocterServiceTime::where('type', 2)->where('start_time_line', '<=', $now_line)->where('end_time_line', '>', $now_line)->pluck('docter_id')->toArray();
|
|
|
$builder->where('is_chat', 1)->whereIn('id', $docter_ids6);
|
|
|
}
|
|
|
- if ($list_type == 3) {
|
|
|
+ elseif ($list_type == 3) {
|
|
|
$builder->where('is_appoint', 1);
|
|
|
}
|
|
|
+ else {
|
|
|
+ $builder->where(function ($query) {
|
|
|
+ $query->where('is_phone', 1)->orWhere('is_chat', 1)->orWhere('is_appoint', 1);
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
if (!empty($req['name'])) {
|
|
|
$name = $req['name'];
|
|
|
$organizations = Organization::with('docter')->select(['id'])->where('name', 'like', '%'.$name.'%')->get()->toArray();
|
| xqd
@@ -156,7 +162,6 @@ class DocterController extends AuthController
|
|
|
$req = request()->post();
|
|
|
$this->validate(request(), [
|
|
|
'docter_id' => 'required|integer',
|
|
|
- 'list_type' => 'in:0,1,2,3',
|
|
|
'latitude' => 'numeric',
|
|
|
'longitude' => 'numeric',
|
|
|
]);
|
| xqd
@@ -164,12 +169,12 @@ class DocterController extends AuthController
|
|
|
|
|
|
$distance_field = get_user_distance_field($user);
|
|
|
|
|
|
- $data = Docter::with('office', 'qualification', 'evaluate.user')->select(['id', 'type', 'name', 'phone', 'sex', 'birthday', 'avatar', 'status', 'label', 'sign', 'intro', 'office_id', 'qualification_id', 'score', 'service_persons', 'eva_num', 'service_days', 'phone_minutes', 'chat_price', 'phone_price', 'appoint_price', 'is_chat', 'is_phone', 'is_appoint', 'latitude', 'longitude', DB::raw($distance_field)])->where('id', $req['docter_id'])->where('status', 1)->first()->toArray();
|
|
|
+ $data = Docter::with(['office', 'qualification', 'evaluate.user'])->select(['id', 'type', 'name', 'phone', 'sex', 'birthday', 'avatar', 'status', 'label', 'sign', 'intro', 'office_id', 'qualification_id', 'score', 'service_persons', 'eva_num', 'service_days', 'phone_minutes', 'chat_price', 'phone_price', 'appoint_price', 'is_chat', 'is_phone', 'is_appoint', 'latitude', 'longitude', DB::raw($distance_field)])->where('id', $req['docter_id'])->where('status', 1)->first()->toArray();
|
|
|
|
|
|
- $data['organization'] = null;
|
|
|
- if (!empty($req['list_type']) && $req['list_type'] == 3) {
|
|
|
- $schedulePeriod = SchedulePeriod::with('organization')->select(['organization_id'])->where('docter_id', $req['docter_id'])->where('schedule_date', date('Y-m-d'))->first()->toArray();
|
|
|
- $data['organization'] = $schedulePeriod['organization'];
|
|
|
+ $organization_ids = SchedulePeriod::where('docter_id', $req['docter_id'])->groupBy('organization_id')->pluck('organization_id')->toArray();
|
|
|
+ $data['organization'] = [];
|
|
|
+ if (!empty($organization_ids)) {
|
|
|
+ $data['organization'] = Organization::select(['id', 'name', 'address', 'latitude', 'longitude', DB::raw($distance_field)])->whereIn('id', $organization_ids)->get()->toArray();
|
|
|
}
|
|
|
|
|
|
return ($data);
|
| xqd
@@ -180,17 +185,12 @@ class DocterController extends AuthController
|
|
|
$req = request()->post();
|
|
|
$this->validate(request(), [
|
|
|
'docter_id' => 'required|integer',
|
|
|
- 'organization_id' => 'integer',
|
|
|
'per_page' => 'integer',
|
|
|
'latitude' => 'numeric',
|
|
|
'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', 'asc');
|
|
|
- if (!empty($req['organization_id'])) {
|
|
|
- $builder->where('organization_id', $req['organization_id']);
|
|
|
- }
|
|
|
- $data = $builder->paginate($req['per_page']??15)->toArray();
|
|
|
+ $data = 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')->paginate($req['per_page']??15)->toArray();
|
|
|
if (!empty($data)) {
|
|
|
foreach ($data['data'] as $k => &$v) {
|
|
|
foreach ($v['schedule_period'] as $k1 => &$v1) {
|