| xqd
@@ -2646,7 +2646,7 @@ class DoctorController extends AuthController
|
|
|
$this->validate(request(), [
|
|
|
'schedule_date|日期' => 'required',
|
|
|
'week|日期' => 'required',
|
|
|
- 'type|日期' => 'required',
|
|
|
+ 'type|类型' => 'required',
|
|
|
'organization_id|日期' => 'required',
|
|
|
]);
|
|
|
} else {
|
| xqd
@@ -2657,23 +2657,46 @@ class DoctorController extends AuthController
|
|
|
$user = $this->user;
|
|
|
$doctor_id = $user['id'];
|
|
|
$save_data = [];
|
|
|
- $type_data = explode(',', $req['type']);
|
|
|
+// $type_data = explode(',', $req['type']);
|
|
|
DB::beginTransaction();
|
|
|
try {
|
|
|
-
|
|
|
- foreach ($type_data as $k => $v) {
|
|
|
- $finds = SelfSchedule::where(['schedule_date' => $req['schedule_date'], 'docter_id' => $doctor_id, 'schedule_type' => 1, 'organization_id' => $req['organization_id']])->delete();
|
|
|
- $times = $this->num_time($req['organization_id'], $v);
|
|
|
- $mf = $this->arrangeDay($times, ['organization_id' => $req['organization_id'], 'week' => $req['week'], 'schedule_date' => $req['schedule_date'], 'type' => $v], $doctor_id);
|
|
|
- if ($mf) {
|
|
|
- foreach ($mf as $v) {
|
|
|
+ $type_data = json_decode($req['type'],true);
|
|
|
+
|
|
|
+ $finds = SelfSchedule::where(['schedule_date' => $req['schedule_date'], 'docter_id' => $doctor_id, 'schedule_type' => 1])->delete();
|
|
|
+ $save_data=[];
|
|
|
+ if($type_data['mon']!=0) {
|
|
|
+ $mon_times = $this->num_time($type_data['mon'], 1);
|
|
|
+ $mf1 = $this->arrangeDay($mon_times, ['organization_id' => $type_data['mon'], 'week' => $req['week'], 'schedule_date' => $req['schedule_date'], 'type' => 1], $doctor_id);
|
|
|
+ if($mf1){
|
|
|
+ foreach ($mf1 as $v){
|
|
|
+ $save_data[] = $v;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if($type_data['aft']!=0){
|
|
|
+ $aft_times = $this->num_time($type_data['aft'], 2);
|
|
|
+ $mf2 = $this->arrangeDay($aft_times, ['organization_id' => $type_data['aft'], 'week' => $req['week'], 'schedule_date' => $req['schedule_date'], 'type' => 2], $doctor_id);
|
|
|
+ if($mf2){
|
|
|
+ foreach ($mf2 as $v){
|
|
|
+ $save_data[] = $v;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if($type_data['nig']!=0) {
|
|
|
+ $nig_times = $this->num_time($type_data['nig'], 3);
|
|
|
+ $mf3 = $this->arrangeDay($nig_times, ['organization_id' => $type_data['nig'], 'week' => $req['week'], 'schedule_date' => $req['schedule_date'], 'type' => 3], $doctor_id);
|
|
|
+ if($mf3){
|
|
|
+ foreach ($mf3 as $v){
|
|
|
$save_data[] = $v;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+
|
|
|
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 = [];
|
| xqd
@@ -2686,7 +2709,6 @@ class DoctorController extends AuthController
|
|
|
$chong[$k]['type'] = $v['type'];
|
|
|
$chong[$k]['schedule_date'] = $v['schedule_date'];
|
|
|
}
|
|
|
-
|
|
|
SchedulePeriod::insert($chong);
|
|
|
}
|
|
|
}
|
| xqd
@@ -2958,6 +2980,28 @@ class DoctorController extends AuthController
|
|
|
if ($list) {
|
|
|
$list = $list->toArray();
|
|
|
foreach ($list as $k => $v) {
|
|
|
+ $messages = ImMessage::where(['senderId'=>'doctor_'.$doctor_id,'receiverId'=>'member_'.$v['user_id']])->orWhere(function ($query) use ($req,$doctor_id,$v){
|
|
|
+ $query->where(['senderId'=>'member_'.$v['user_id'],'receiverId'=>'doctor_'.$doctor_id]);
|
|
|
+ })->orderBy('id','desc')->first();
|
|
|
+ if($messages){
|
|
|
+ if($messages['type']=='text'){
|
|
|
+ $newList[$v['user_id']]['out_message'] = $messages['payload'];
|
|
|
+ }else if ($messages['type'] == 'audio'){
|
|
|
+ $newList[$v['user_id']]['out_message'] = "[语音消息]";
|
|
|
+ }else{
|
|
|
+ $newList[$v['user_id']]['out_message'] = "[图片消息]";
|
|
|
+ }
|
|
|
+ if (empty($messages['create_time'])){
|
|
|
+ $newList[$v['user_id']]['out_time'] = "";
|
|
|
+
|
|
|
+ }else{
|
|
|
+ $newList[$v['user_id']]['out_time'] = date('m-d',$messages['create_time']);
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ $newList[$v['user_id']]['out_message'] = '';
|
|
|
+ $newList[$v['user_id']]['out_time'] = '';
|
|
|
+ }
|
|
|
+
|
|
|
$newList[$v['user_id']]['flag'] = 'member_' . $v['user_id'];
|
|
|
$newList[$v['user_id']]['order_status'] = $v['order_status'];
|
|
|
$newList[$v['user_id']]['nickname'] = $v['user']['nickname'];
|
| xqd
@@ -3048,13 +3092,15 @@ class DoctorController extends AuthController
|
|
|
}
|
|
|
}
|
|
|
}else{
|
|
|
- $orderList = Order::with(['user','calllog'])->where(['docter_id'=>$doctor_id,'product_type'=>1,'payment_status'=>2])->groupBy(['id','user_id'])->get();
|
|
|
+ $orderList = Order::with(['user','calllog'])->where(['docter_id'=>$doctor_id,'product_type'=>1,'payment_status'=>2])->groupBy(['user_id'])->get();
|
|
|
+
|
|
|
if ($orderList){
|
|
|
foreach ($orderList as $k=>$v){
|
|
|
$list[$k]['user'] = $v['user'];
|
|
|
- if ($v['calllog']){
|
|
|
- $dates = $v['calllog']->toArray();
|
|
|
- $list[$k]['user']['dates'] = end($dates)['call_time'];
|
|
|
+ $calls = CallLog::where('docter_id',$doctor_id)->orderBy('id','desc')->first();
|
|
|
+ if ($calls){
|
|
|
+
|
|
|
+ $list[$k]['user']['dates'] = $calls['call_time'];
|
|
|
}else{
|
|
|
$list[$k]['user']['dates'] = '无';
|
|
|
}
|