| xqd
@@ -526,16 +526,13 @@ class PatientController extends AuthController
|
|
|
return out('',500,'患者电话不存在');
|
|
|
}
|
|
|
$phone = $find['order_patient']['phone'];
|
|
|
-
|
|
|
if($docter_phone==$phone){
|
|
|
return out('',500,'医生和患者电话号不能一样!');
|
|
|
-
|
|
|
}
|
|
|
$wheres['docter_id'] = $docter_id;
|
|
|
$wheres['user_id'] = $req['user_id'];
|
|
|
$commons = new Commons();
|
|
|
$finds = Axb::where($wheres)->orderBy('id','desc')->first();
|
|
|
-
|
|
|
if ($finds){
|
|
|
$querylok = $commons->QuerySubsId($finds['xphone']);
|
|
|
if ($querylok['Code']=='OK'){
|
| xqd
@@ -543,66 +540,38 @@ class PatientController extends AuthController
|
|
|
$new_arr = explode(',',$querylok['SubsId']);
|
|
|
foreach ($new_arr as $v){
|
|
|
$queryCallStatus = $commons->QuerySubscriptionDetail($finds['xphone'],$v);
|
|
|
- if ($queryCallStatus['Code']=='OK'){
|
|
|
- if ($queryCallStatus['Code']=="OK"){
|
|
|
- if ($queryCallStatus['SecretBindDetailDTO']['PhoneNoA']==$docter_phone&&$queryCallStatus['SecretBindDetailDTO']['PhoneNoB']==$phone){
|
|
|
- return out($finds['xphone']);
|
|
|
- }else{
|
|
|
- if ($phone){
|
|
|
- $callModel = $commons->BindAxb($docter_phone,$phone);
|
|
|
- if ($callModel['Code']=="OK"){
|
|
|
- Axb::create([
|
|
|
- 'docter_id'=>$docter_id,
|
|
|
- 'user_id'=>$req['user_id'],
|
|
|
- 'xphone'=>$callModel['SecretBindDTO']['SecretNo'],
|
|
|
- 'subs_id'=>$callModel['SecretBindDTO']['SubsId'],
|
|
|
- 'createtime'=>time(),
|
|
|
- ]);
|
|
|
- return out($callModel['SecretBindDTO']['SecretNo']);
|
|
|
- }
|
|
|
- }else{
|
|
|
- return out('',500,'患者电话不存在');
|
|
|
- }
|
|
|
- }
|
|
|
+ if ($queryCallStatus['Code']=="OK"){
|
|
|
+ if ($queryCallStatus['SecretBindDetailDTO']['PhoneNoA']==$docter_phone&&$queryCallStatus['SecretBindDetailDTO']['PhoneNoB']==$phone){
|
|
|
+ return out($finds['xphone']);
|
|
|
}else{
|
|
|
if ($phone){
|
|
|
- $callModel = $commons->BindAxb($docter_phone,$phone);
|
|
|
- if ($callModel['Code']=="OK"){
|
|
|
- Axb::create([
|
|
|
- 'docter_id'=>$docter_id,
|
|
|
- 'user_id'=>$req['user_id'],
|
|
|
- 'xphone'=>$callModel['SecretBindDTO']['SecretNo'],
|
|
|
- 'subs_id'=>$callModel['SecretBindDTO']['SubsId'],
|
|
|
- 'createtime'=>time(),
|
|
|
- ]);
|
|
|
- return out($callModel['SecretBindDTO']['SecretNo']);
|
|
|
- }
|
|
|
+ Axb::where('id',$finds['id'])->delete();
|
|
|
+ return $this->createCall($phone,$docter_phone,$docter_id,$req['user_id']);
|
|
|
}else{
|
|
|
return out('',500,'患者电话不存在');
|
|
|
}
|
|
|
}
|
|
|
+ }else{
|
|
|
+ if ($phone){
|
|
|
+ Axb::where('id',$finds['id'])->delete();
|
|
|
+ return $this->createCall($phone,$docter_phone,$docter_id,$req['user_id']);
|
|
|
+ }else{
|
|
|
+ return out('',500,'患者电话不存在');
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
+ }else{
|
|
|
+ if ($phone){
|
|
|
+ Axb::where('id',$finds['id'])->delete();
|
|
|
+ return $this->createCall($phone,$docter_phone,$docter_id,$req['user_id']);
|
|
|
+ }else{
|
|
|
+ return out('',500,'患者电话不存在');
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
}else{
|
|
|
if ($phone){
|
|
|
- $callModel = $commons->BindAxb($docter_phone,$phone);
|
|
|
-
|
|
|
- if ($callModel['Code']=="OK"){
|
|
|
- Axb::create([
|
|
|
- 'docter_id'=>$docter_id,
|
|
|
- 'user_id'=>$req['user_id'],
|
|
|
- 'xphone'=>$callModel['SecretBindDTO']['SecretNo'],
|
|
|
- 'subs_id'=>$callModel['SecretBindDTO']['SubsId'],
|
|
|
- 'createtime'=>time(),
|
|
|
- ]);
|
|
|
- return out($callModel['SecretBindDTO']['SecretNo']);
|
|
|
- }else{
|
|
|
- return out($callModel);
|
|
|
- }
|
|
|
+ return $this->createCall($phone,$docter_phone,$docter_id,$req['user_id']);
|
|
|
}else{
|
|
|
return out('',500,'患者电话不存在');
|
|
|
}
|
| xqd
@@ -610,6 +579,33 @@ class PatientController extends AuthController
|
|
|
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 创建电话
|
|
|
+ * @param $phone
|
|
|
+ * @param $docter_phone
|
|
|
+ * @param $docter_id
|
|
|
+ * @param $user_id
|
|
|
+ * @return \Illuminate\Http\JsonResponse
|
|
|
+ */
|
|
|
+ protected function createCall($phone,$docter_phone,$docter_id,$user_id){
|
|
|
+ $commons = new Commons();
|
|
|
+ $callModel = $commons->BindAxb($docter_phone,$phone);
|
|
|
+ if ($callModel['Code']=="OK"){
|
|
|
+ Axb::create([
|
|
|
+ 'docter_id'=>$docter_id,
|
|
|
+ 'user_id'=>$user_id,
|
|
|
+ 'xphone'=>$callModel['SecretBindDTO']['SecretNo'],
|
|
|
+ 'subs_id'=>$callModel['SecretBindDTO']['SubsId'],
|
|
|
+ 'createtime'=>time(),
|
|
|
+ ]);
|
|
|
+ return out($callModel['SecretBindDTO']['SecretNo']);
|
|
|
+ }else{
|
|
|
+ return out($callModel);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
|
|
|
/**
|
|
|
* 电话随访
|