|
@@ -201,21 +201,13 @@ class Application extends Base
|
|
|
switch($exam_info['exam_status']){
|
|
|
case 1:
|
|
|
$msg = '患者还未检查,请检查完毕后再进行远程申请';
|
|
|
+ return json_encode(['status'=>'fail','code'=>'1029','msg'=>$msg]);
|
|
|
break;
|
|
|
case 2:
|
|
|
$msg = '影像未到达,不能发起远程申请';
|
|
|
- break;
|
|
|
- case 4:
|
|
|
- $msg = '已经发起了远程申请,请勿重复操作';
|
|
|
- break;
|
|
|
- case 9:
|
|
|
- $msg = '';
|
|
|
- break;
|
|
|
- default:
|
|
|
- $msg = '医师已经接受该远程申请,请耐心等待';
|
|
|
+ return json_encode(['status'=>'fail','code'=>'1029','msg'=>$msg]);
|
|
|
break;
|
|
|
}
|
|
|
- return json_encode(['status'=>'fail','code'=>'1029','msg'=>$msg]);
|
|
|
}
|
|
|
Verify::applicationCheck($param);
|
|
|
$where = array();
|
|
@@ -223,7 +215,7 @@ class Application extends Base
|
|
|
$where['req_doctor_id'] = $doctor['id'];
|
|
|
$where['remote_institution_id'] = $application_info['remote_institution_id'];
|
|
|
// 只允许有一个申请 ----------------------------- 暂时添加
|
|
|
- $r = DB::table('remote_application')->where('exam_id',$param['id'])->where('report_status','not in','5,12')->find();
|
|
|
+ $r = DB::table('remote_application')->where('exam_id',$param['id'])->where('report_status','not in','null,5,12')->find();
|
|
|
if($r){
|
|
|
return json_encode(['status'=>'fail','code'=>'1120','msg'=>'每个医院同一个检查只能申请一次']);
|
|
|
}
|
|
@@ -263,7 +255,6 @@ class Application extends Base
|
|
|
// 申请远程
|
|
|
// if(empty($remote_application)){
|
|
|
log::record('新增远程申请');
|
|
|
- $application_info['report_status'] = 4;
|
|
|
$re = DB::table('remote_application')->where('exam_id',$param['id'])->find();
|
|
|
if($re){
|
|
|
// 存在被驳回申请 再次申请时则为驳回后发起的申请
|
|
@@ -291,6 +282,7 @@ class Application extends Base
|
|
|
// $aid = $r['id'];
|
|
|
// }
|
|
|
if(isset($param['apply']) && !empty($param['apply'])){
|
|
|
+ DB::table('remote_application')->where('exam_id',$param['id'])->update(['report_status'=>4]);
|
|
|
//保存 申请
|
|
|
// if(isset($param['remote_doctor_id']) && $param['remote_doctor_id'] == 'c44663d6d3c0b535'){
|
|
|
$dinfo = DB::table('doctors')->where('id',$application_info['remote_doctor_id'])->find();
|
|
@@ -299,16 +291,13 @@ class Application extends Base
|
|
|
if($dinfo['institution_id'] == '22100003'){ //魏庙
|
|
|
$repsone = send_message::sendSms2Apply($d_phone,$d_time,$d_name);
|
|
|
}
|
|
|
- // 申请医院院名
|
|
|
- $x_institution = DB::table('institution')->where('id',$doctor['institution_id'])->field('name')->find();
|
|
|
- $s_institution = DB::table('institution')->where('id',$application_info['remote_institution_id'])->field('name')->find();
|
|
|
$tel = '18910184804';
|
|
|
$type = '发起申请';
|
|
|
$content = $aid;
|
|
|
$response = send_message::sendSms2Self($tel,$type,$content);
|
|
|
// }
|
|
|
}
|
|
|
- return json_encode(['status'=>'ok','code'=>'0000','sessionid'=>$sessionid]);
|
|
|
+ return json_encode(['status'=>'ok','code'=>'0000','sessionid'=>$sessionid,'aid'=>$aid]);
|
|
|
}catch(\Exception $e){
|
|
|
return json_encode(['status'=>'fail','code'=>'2000','msg'=>$e->getMessage()]);
|
|
|
}
|
|
@@ -391,6 +380,10 @@ class Application extends Base
|
|
|
$doctor = Cache::get($sessionid);
|
|
|
$param = $_REQUEST['param'];
|
|
|
$id = $param['id'];
|
|
|
+ $re = DB::table('remote_application')->where('id',$id)->field('report_status')->find();
|
|
|
+ if($re['report_status'] != 4){
|
|
|
+ return json_encode(['status'=>'fail','code'=>'0321','msg'=>'只能驳回申请中的单子']);
|
|
|
+ }
|
|
|
$report = DB::table('report')->where('remote_application_id',$id)->field('id')->find();
|
|
|
$info = array();
|
|
|
$info['id'] = UUIDs::uuid16();
|
|
@@ -400,6 +393,14 @@ class Application extends Base
|
|
|
$info['type'] = 4;
|
|
|
$info['doctor_id'] = $doctor['id'];
|
|
|
DB::table('report_record')->insert($info);
|
|
|
+ $binfo = array();
|
|
|
+ $binfo['id'] = UUIDs::uuid16();
|
|
|
+ $binfo['initiator'] = $doctor['id'];
|
|
|
+// $info['reply'] = $param['reply']; // 回复人
|
|
|
+ $binfo['remote_application_id'] = $id; //申请单id
|
|
|
+ $binfo['content'] = '驳回原因:'.$param['description'];
|
|
|
+ $binfo['createdAt'] = date('Y-m-d H:i:s',time());
|
|
|
+ DB::table('bbs')->insert($binfo);
|
|
|
// $message = array();
|
|
|
// $message['id'] = UUIDs::uuid16();
|
|
|
// $message['title'] = '申请单驳回';
|
|
@@ -417,11 +418,6 @@ class Application extends Base
|
|
|
$des = mb_substr($param['description'],0,20,'utf-8');
|
|
|
$repsone = send_message::sendSms2RejectApply($d_phone,$des);
|
|
|
}
|
|
|
- // 上级医院
|
|
|
- $s_institution = DB::table('institution')->where('id',$doctor['institution_id'])->field('name')->find();
|
|
|
- //下级医院
|
|
|
- $x_institution = DB::table('institution')->where('id',$application['local_institution_id'])->field('name')->find();
|
|
|
- $x_name = DB::table('doctors')->where('id',$application['req_doctor_id'])->field('realname')->find();
|
|
|
$tel = '18910184804';
|
|
|
$type = '驳回申请';
|
|
|
$content = $application['id'];
|
|
@@ -461,14 +457,13 @@ class Application extends Base
|
|
|
$sessionid = $_REQUEST['sessionid'];
|
|
|
$doctor = Cache::get($sessionid);
|
|
|
$id = $_REQUEST['id'];
|
|
|
+ $re = DB::table('remote_application')->where('id',$id)->field('report_status')->find();
|
|
|
+ if($re['report_status'] != 4){
|
|
|
+ return json_encode(['status'=>'fail','code'=>'0321','msg'=>'只能接收申请中的单子']);
|
|
|
+ }
|
|
|
DB::table('remote_application')->where('id',$id)->update(['report_status'=>6]);
|
|
|
$application = DB::table('remote_application')->where('exam_id',$id)->find();
|
|
|
if($application['req_doctor_id'] == 'c44663d6d3c0b535'){
|
|
|
- // 上级医院
|
|
|
- $s_institution = DB::table('institution')->where('id',$doctor['institution_id'])->field('name')->find();
|
|
|
- //下级医院
|
|
|
- $x_institution = DB::table('institution')->where('id',$application['local_institution_id'])->field('name')->find();
|
|
|
- $x_name = DB::table('doctors')->where('id',$application['req_doctor_id'])->field('realname')->find();
|
|
|
$tel = '18910184804';
|
|
|
$type = '接收申请';
|
|
|
$content = $application['id'];
|