| xqd
@@ -44,6 +44,8 @@ use App\Models\DocterServiceTimes;
|
|
|
use App\Models\CallLog;
|
|
|
use App\Models\ImMessage;
|
|
|
use App\Models\DocterLable;
|
|
|
+use App\Models\SchedueFlags as Sflag;
|
|
|
+
|
|
|
|
|
|
/**
|
|
|
* 医生相关类
|
| xqd
@@ -654,7 +656,9 @@ class DoctorController extends AuthController
|
|
|
|
|
|
$timeList = $this->getTimeHoures($v['service_times']);
|
|
|
foreach ($timeList as $kk => $vv) {
|
|
|
- $times_data[$k][$kk]['type'] = 2;
|
|
|
+
|
|
|
+ $times_data[$k][$kk]['type'] = 1;
|
|
|
+
|
|
|
$times_data[$k][$kk]['docter_id'] = $doctor_id;
|
|
|
$times_data[$k][$kk]['start_time_period'] = $vv[0];
|
|
|
$times_data[$k][$kk]['end_time_period'] = $vv[1];
|
| xqd
@@ -924,7 +928,7 @@ class DoctorController extends AuthController
|
|
|
// 第二步, 根据时长去生成24小时的时间段,也要存id
|
|
|
$timeList = $this->getTimeHoures($v['service_times']);
|
|
|
foreach ($timeList as $kk => $vv) {
|
|
|
- $times_data[$k][$kk]['type'] = 2;
|
|
|
+ $times_data[$k][$kk]['type'] = 1;
|
|
|
$times_data[$k][$kk]['docter_id'] = $doctor_id;
|
|
|
$times_data[$k][$kk]['start_time_period'] = $vv[0];
|
|
|
$times_data[$k][$kk]['end_time_period'] = $vv[1];
|
| xqd
@@ -1037,7 +1041,11 @@ class DoctorController extends AuthController
|
|
|
|
|
|
|
|
|
/**
|
|
|
+<<<<<<< HEAD
|
|
|
+ * 联动医院
|
|
|
+=======
|
|
|
* 获取地区/联动医院
|
|
|
+>>>>>>> dev
|
|
|
* Auth:Yuanhang-Liu
|
|
|
* Date:2020/10/14 17:17 *
|
|
|
* @return \Illuminate\Http\JsonResponse
|
| xqd
@@ -2341,11 +2349,12 @@ class DoctorController extends AuthController
|
|
|
$morningWhere[] = ['end_time_period', '<=', $zaoTimes[1]];
|
|
|
$morningWhere['docter_id'] = $doctor_id;
|
|
|
$morningWhere['org_id'] = $org_id;
|
|
|
-
|
|
|
$morningd = TimePeriod::where($morningWhere)->get()->toArray();
|
|
|
-
|
|
|
- array_pop($morningd);
|
|
|
+ if (count($morningd)>1){
|
|
|
+ array_pop($morningd);
|
|
|
+ }
|
|
|
$morning = array_column($morningd, 'id');
|
|
|
+
|
|
|
return $morning;
|
|
|
} elseif ($type == 2) {
|
|
|
$afternoondWhere[] = ['start_time_period', '>=', $zhongTimes[0]];
|
| xqd
@@ -2353,7 +2362,9 @@ class DoctorController extends AuthController
|
|
|
$afternoondWhere['docter_id'] = $doctor_id;
|
|
|
$afternoondWhere['org_id'] = $org_id;
|
|
|
$afternoond = TimePeriod::where($afternoondWhere)->get()->toArray();
|
|
|
- array_pop($afternoond);
|
|
|
+ if (count($afternoond)>1){
|
|
|
+ array_pop($afternoond);
|
|
|
+ }
|
|
|
$afternoon = array_column($afternoond, 'id');
|
|
|
return $afternoon;
|
|
|
|
| xqd
@@ -2363,7 +2374,10 @@ class DoctorController extends AuthController
|
|
|
$nightWhere['docter_id'] = $doctor_id;
|
|
|
$nightWhere['org_id'] = $org_id;
|
|
|
$nightd = TimePeriod::where($nightWhere)->get()->toArray();
|
|
|
- array_pop($nightd);
|
|
|
+ if (count($nightd)>1){
|
|
|
+ array_pop($nightd);
|
|
|
+ }
|
|
|
+
|
|
|
$night = array_column($nightd, 'id');
|
|
|
return $night;
|
|
|
|
| xqd
@@ -2373,7 +2387,9 @@ class DoctorController extends AuthController
|
|
|
$morningWhere['docter_id'] = $doctor_id;
|
|
|
$morningWhere['org_id'] = $org_id;
|
|
|
$morningd = TimePeriod::where($morningWhere)->get()->toArray();
|
|
|
- array_pop($morningd);
|
|
|
+ if (count($morningd)>1){
|
|
|
+ array_pop($morningd);
|
|
|
+ }
|
|
|
$morning = array_column($morningd, 'id');
|
|
|
|
|
|
$afternoondWhere[] = ['start_time_period', '>=', $zhongTimes[0]];
|
| xqd
@@ -2381,7 +2397,9 @@ class DoctorController extends AuthController
|
|
|
$afternoondWhere['docter_id'] = $doctor_id;
|
|
|
$afternoondWhere['org_id'] = $org_id;
|
|
|
$afternoond = TimePeriod::where($afternoondWhere)->get()->toArray();
|
|
|
- array_pop($afternoond);
|
|
|
+ if (count($afternoond)>1){
|
|
|
+ array_pop($afternoond);
|
|
|
+ }
|
|
|
$afternoon = array_column($afternoond, 'id');
|
|
|
|
|
|
$nightWhere[] = ['start_time_period', '>=', $wanTimes[0]];
|
| xqd
@@ -2389,7 +2407,9 @@ class DoctorController extends AuthController
|
|
|
$nightWhere['docter_id'] = $doctor_id;
|
|
|
$nightWhere['org_id'] = $org_id;
|
|
|
$nightd = TimePeriod::where($nightWhere)->get()->toArray();
|
|
|
- array_pop($nightd);
|
|
|
+ if (count($nightd)>1){
|
|
|
+ array_pop($nightd);
|
|
|
+ }
|
|
|
$night = array_column($nightd, 'id');
|
|
|
return [$morning, $afternoon, $night];
|
|
|
}
|
| xqd
@@ -2660,6 +2680,11 @@ class DoctorController extends AuthController
|
|
|
// $type_data = explode(',', $req['type']);
|
|
|
DB::beginTransaction();
|
|
|
try {
|
|
|
+ $findFlag = Sflag::where(['docter_id'=>$doctor_id,'schedule_date'=>$req['schedule_date']])->first();
|
|
|
+ if (!$findFlag){
|
|
|
+ Sflag::create(['schedule_date'=>$req['schedule_date'],'docter_id'=>$doctor_id]);
|
|
|
+ }
|
|
|
+
|
|
|
$type_data = json_decode($req['type'],true);
|
|
|
|
|
|
$finds = SelfSchedule::where(['schedule_date' => $req['schedule_date'], 'docter_id' => $doctor_id, 'schedule_type' => 1])->delete();
|
| xqd
@@ -2695,24 +2720,27 @@ class DoctorController extends AuthController
|
|
|
|
|
|
if (!$flag){
|
|
|
$lists = Schedule::where(['docter_id'=>$doctor_id,'schedule_date'=>$req['schedule_date']])->first();
|
|
|
-
|
|
|
-
|
|
|
if($lists){
|
|
|
+
|
|
|
SchedulePeriod::where(['docter_id'=>$doctor_id,'schedule_date'=>$req['schedule_date']])->delete();
|
|
|
- $chong = [];
|
|
|
- foreach ($save_data as $k => $v) {
|
|
|
- $chong[$k]['schedule_id'] = $lists['id'];
|
|
|
- $chong[$k]['docter_id'] = $v['docter_id'];
|
|
|
- $chong[$k]['order_num'] = 0;
|
|
|
- $chong[$k]['organization_id'] = $v['organization_id'];
|
|
|
- $chong[$k]['time_period_id'] = $v['time_period_id'];
|
|
|
- $chong[$k]['type'] = $v['type'];
|
|
|
- $chong[$k]['schedule_date'] = $v['schedule_date'];
|
|
|
+ if($save_data){
|
|
|
+ $chong = [];
|
|
|
+ foreach ($save_data as $k => $v) {
|
|
|
+ $chong[$k]['schedule_id'] = $lists['id'];
|
|
|
+ $chong[$k]['docter_id'] = $v['docter_id'];
|
|
|
+ $chong[$k]['order_num'] = 0;
|
|
|
+ $chong[$k]['organization_id'] = $v['organization_id'];
|
|
|
+ $chong[$k]['time_period_id'] = $v['time_period_id'];
|
|
|
+ $chong[$k]['type'] = $v['type'];
|
|
|
+ $chong[$k]['schedule_date'] = $v['schedule_date'];
|
|
|
+ }
|
|
|
+ SchedulePeriod::insert($chong);
|
|
|
+ SelfSchedule::insert($save_data);
|
|
|
}
|
|
|
- SchedulePeriod::insert($chong);
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
- SelfSchedule::insert($save_data);
|
|
|
+
|
|
|
DB::commit();
|
|
|
if ($flag) {
|
|
|
return true;
|
| xqd
@@ -2779,7 +2807,6 @@ class DoctorController extends AuthController
|
|
|
$doctor_id = $user['id'];
|
|
|
$selfScheduleList = SelfSchedule::where('docter_id', '=', $doctor_id)->get();
|
|
|
$weekSchduleList = WeekSchedule::with('organization')->where('docter_id', '=', $doctor_id)->groupBy('type', 'week')->orderBy('week', 'asc')->get()->toArray();
|
|
|
-
|
|
|
// 占用效率
|
|
|
$scheduleLists = [];
|
|
|
$moth_date = $this->date_bool($req['start_day'], $req['end_day']);
|
| xqd
@@ -2843,7 +2870,9 @@ class DoctorController extends AuthController
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
$newList = [];
|
|
|
+
|
|
|
foreach ($moth_date as $k => $v) {
|
|
|
$newList[$k]['date'] = $v['date'];
|
|
|
$newList[$k]['ident']['zao'] = 0;
|
| xqd
@@ -2859,8 +2888,12 @@ class DoctorController extends AuthController
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
$selfList = [];
|
|
|
if ($selfScheduleList) {
|
|
|
+ $putArr = [];
|
|
|
// 自定义排班数组
|
|
|
$selfScheduleList = $selfScheduleList->toArray();
|
|
|
foreach ($selfScheduleList as $k => $v) {
|
| xqd
@@ -2890,6 +2923,30 @@ class DoctorController extends AuthController
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ // 自定义的
|
|
|
+ $pusList = Sflag::where('docter_id',$doctor_id)->get();
|
|
|
+ //然后查看下自定义排班是否删除了
|
|
|
+ if ($pusList){
|
|
|
+ foreach ($pusList as $k=>$v){
|
|
|
+ foreach ($selfScheduleList as $kk=>$vv){
|
|
|
+ if ($v['schedule_date']==$vv['schedule_date']){
|
|
|
+ unset($pusList[$k]);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ foreach ($pusList as $k=>$v){
|
|
|
+ $bl = [
|
|
|
+ 'schedule_date'=>$v['schedule_date'],
|
|
|
+ 'ident'=>[
|
|
|
+ 'zao_id'=>0,
|
|
|
+ 'xia_id'=>0,
|
|
|
+ 'wan_id'=>0,
|
|
|
+ ],
|
|
|
+ ];
|
|
|
+ $selfList[$v['schedule_date']] = $bl;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
foreach ($selfList as $k => $v) {
|
|
|
foreach ($newList as $kk => $vv) {
|
|
|
if ($v['schedule_date'] == $vv['date']) {
|
| xqd
@@ -2901,7 +2958,6 @@ class DoctorController extends AuthController
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-
|
|
|
}
|
|
|
return out($newList);
|
|
|
}
|
| xqd
@@ -2929,7 +2985,6 @@ class DoctorController extends AuthController
|
|
|
$maf[$k]['type'] = $req['type'];
|
|
|
$maf[$k]['order_num'] = 0;
|
|
|
}
|
|
|
-
|
|
|
return $maf;
|
|
|
}
|
|
|
|
| xqd
@@ -3141,18 +3196,18 @@ class DoctorController extends AuthController
|
|
|
|
|
|
$newList=[];
|
|
|
if ($list){
|
|
|
- foreach ($list as $k=>$v){
|
|
|
- $decode = json_decode($v['text'],true);
|
|
|
+ foreach ($list as $k=>$v){
|
|
|
+ $decode = json_decode($v['text'],true);
|
|
|
// $newList[$k]['id']=$decode['id'];
|
|
|
- $newList[$k]['messageId']=$decode[0]['messageId'];
|
|
|
- $newList[$k]['type']=$decode[0]['type'];
|
|
|
- $newList[$k]['senderId']=$decode[0]['senderId'];
|
|
|
- $newList[$k]['receiverId']=$decode[0]['receiverId'];
|
|
|
- $newList[$k]['timestamp']=$decode[0]['timestamp'];
|
|
|
- $newList[$k]['payload']= json_decode($decode[0]['payload'],true);
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
+ $newList[$k]['messageId']=$decode[0]['messageId'];
|
|
|
+ $newList[$k]['type']=$decode[0]['type'];
|
|
|
+ $newList[$k]['senderId']=$decode[0]['senderId'];
|
|
|
+ $newList[$k]['receiverId']=$decode[0]['receiverId'];
|
|
|
+ $newList[$k]['timestamp']=$decode[0]['timestamp'];
|
|
|
+ $newList[$k]['payload']= json_decode($decode[0]['payload'],true);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
return out($newList);
|
|
|
}
|
|
|
}
|