|
@@ -465,72 +465,77 @@ class Writereport extends Base
|
|
public function confirm(){
|
|
public function confirm(){
|
|
try{
|
|
try{
|
|
Log::record('confirm');
|
|
Log::record('confirm');
|
|
- // $is_remote = $_REQUEST['is_remote'];
|
|
|
|
- // if($is_remote == 1){
|
|
|
|
- // return json_encode(['status'=>'fail','code'=>'1133','msg'=>'远程无法确诊报告']);
|
|
|
|
- // }
|
|
|
|
- // $sessionid = $_REQUEST['sessionid'];
|
|
|
|
- // $doctor = Cache::get($sessionid);
|
|
|
|
- // $param = $_REQUEST['param'];
|
|
|
|
- // $id = $param['id'];
|
|
|
|
- // $report_id = $param['report_id'];
|
|
|
|
- // $report_info = DB::table('report')->where('id',$report_id)->find();
|
|
|
|
- // if($report_info['type'] == 1){
|
|
|
|
- // //本地报告
|
|
|
|
- // $status = DB::table('exams')->where('id',$id)->field('exam_status')->find();
|
|
|
|
- // if($status['exam_status'] < 8 ){
|
|
|
|
- // return json_encode(['status'=>'fail','code'=>'1033','msg'=>'只能确认通过审核的报告']);
|
|
|
|
- // }elseif($status['exam_status'] == 9){
|
|
|
|
- // return json_encode(['status'=>'fail','code'=>'1034','msg'=>'已经确认过该报告,不可再次确认']);
|
|
|
|
- // }
|
|
|
|
- // }else{
|
|
|
|
- // //远程
|
|
|
|
- // $status = DB::table('remote_application')->where('id',$report_info['remote_application_id'])->field('remote_doctor_id,report_status')->find();
|
|
|
|
- // if($status['report_status'] < 8 ){
|
|
|
|
- // return json_encode(['status'=>'fail','code'=>'1033','msg'=>'只能确认通过审核的报告']);
|
|
|
|
- // }elseif($status['report_status'] == 9){
|
|
|
|
- // return json_encode(['status'=>'fail','code'=>'1034','msg'=>'已经确认过该报告,不可再次确认']);
|
|
|
|
- // }
|
|
|
|
- // }
|
|
|
|
- // $rinfo = array();
|
|
|
|
- // if(isset($param['r_result']) && $param['r_result'] == 'true'){
|
|
|
|
- // $rinfo['report_result'] = 2;
|
|
|
|
- // }else{
|
|
|
|
- // $rinfo['report_result'] = 1;
|
|
|
|
- // }
|
|
|
|
- // $rinfo['confirm_datetime'] = date('Y-m-d H:i:s',time());
|
|
|
|
- // $rinfo['confirm_doctor_id'] = $doctor['id'];
|
|
|
|
- // if($report_info['type'] == 1){
|
|
|
|
- // //本地报告确认
|
|
|
|
- // DB::table('exams')->where('id',$id)->update(['exam_status'=>'9']);
|
|
|
|
- // }else{
|
|
|
|
- // Message::read($doctor['id'],$report_info['remote_application_id'],4);
|
|
|
|
- // //远程
|
|
|
|
- // $this->confirmReport($report_info['remote_application_id']);
|
|
|
|
- // // DB::table('remote_application')->where('id',$report_info['remote_application_id'])->update(['report_status'=>'9']);
|
|
|
|
- // // 添加messages消息
|
|
|
|
- // $t = '您的报告已确认';
|
|
|
|
- // $institution = DB::table('institution')->where('id',$doctor['institution_id'])->field('name')->find();
|
|
|
|
- // $c = '您的远程诊断报告,已被'.$institution['name'].$doctor['realname'].'医师确认';
|
|
|
|
- // $d = $status['remote_doctor_id'];
|
|
|
|
- // $type = '6';
|
|
|
|
- // $url = '';
|
|
|
|
- // Message::insert($t,$c,$d,$type,$url,1,$report_info['remote_application_id']);
|
|
|
|
- // }
|
|
|
|
- // DB::table('exams')->where('id',$id)->update(['film_type'=>$_REQUEST['param']['film_type']]);
|
|
|
|
- // DB::table('report')->where('id',$report_id)->update($rinfo);
|
|
|
|
- // $cache_key = $doctor['id'].'_'.$report_info['id'];
|
|
|
|
- // if(Cache::get($cache_key)){
|
|
|
|
- // Cache::rm($cache_key);
|
|
|
|
- // }
|
|
|
|
- // // 添加 确认log日志
|
|
|
|
- // $info = array();
|
|
|
|
- // $info['id'] = UUIDs::uuid16();
|
|
|
|
- // $info['createdAt'] = date('Y-m-d H:i:s',time());
|
|
|
|
- // $info['doctor_id'] = $doctor['id'];
|
|
|
|
- // $info['type'] = 3;
|
|
|
|
- // $info['report_id'] = $report_id;
|
|
|
|
- // DB::table('report_record')->insert($info);
|
|
|
|
|
|
+ Log::record($_REQUEST);
|
|
|
|
+ $is_remote = $_REQUEST['is_remote'];
|
|
|
|
+ if($is_remote == 1){
|
|
|
|
+ return json_encode(['status'=>'fail','code'=>'1133','msg'=>'远程无法确诊报告']);
|
|
|
|
+ }
|
|
|
|
+ $sessionid = $_REQUEST['sessionid'];
|
|
|
|
+ Log::record($sessionid);
|
|
|
|
+ $doctor = Cache::get($sessionid);
|
|
|
|
+ $param = $_REQUEST['param'];
|
|
|
|
+ Log::record($param);
|
|
|
|
+ $id = $param['id'];
|
|
|
|
+ $report_id = $param['report_id'];
|
|
|
|
+ $report_info = DB::table('report')->where('id',$report_id)->find();
|
|
|
|
+ Log::record($report_info);
|
|
|
|
+
|
|
|
|
+ if($report_info['type'] == 1){
|
|
|
|
+ //本地报告
|
|
|
|
+ $status = DB::table('exams')->where('id',$id)->field('exam_status')->find();
|
|
|
|
+ if($status['exam_status'] < 8 ){
|
|
|
|
+ return json_encode(['status'=>'fail','code'=>'1033','msg'=>'只能确认通过审核的报告']);
|
|
|
|
+ }elseif($status['exam_status'] == 9){
|
|
|
|
+ return json_encode(['status'=>'fail','code'=>'1034','msg'=>'已经确认过该报告,不可再次确认']);
|
|
|
|
+ }
|
|
|
|
+ }else{
|
|
|
|
+ //远程
|
|
|
|
+ $status = DB::table('remote_application')->where('id',$report_info['remote_application_id'])->field('remote_doctor_id,report_status')->find();
|
|
|
|
+ if($status['report_status'] < 8 ){
|
|
|
|
+ return json_encode(['status'=>'fail','code'=>'1033','msg'=>'只能确认通过审核的报告']);
|
|
|
|
+ }elseif($status['report_status'] == 9){
|
|
|
|
+ return json_encode(['status'=>'fail','code'=>'1034','msg'=>'已经确认过该报告,不可再次确认']);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ $rinfo = array();
|
|
|
|
+ if(isset($param['r_result']) && $param['r_result'] == 'true'){
|
|
|
|
+ $rinfo['report_result'] = 2;
|
|
|
|
+ }else{
|
|
|
|
+ $rinfo['report_result'] = 1;
|
|
|
|
+ }
|
|
|
|
+ $rinfo['confirm_datetime'] = date('Y-m-d H:i:s',time());
|
|
|
|
+ $rinfo['confirm_doctor_id'] = $doctor['id'];
|
|
|
|
+ if($report_info['type'] == 1){
|
|
|
|
+ //本地报告确认
|
|
|
|
+ DB::table('exams')->where('id',$id)->update(['exam_status'=>'9']);
|
|
|
|
+ }else{
|
|
|
|
+ Message::read($doctor['id'],$report_info['remote_application_id'],4);
|
|
|
|
+ //远程
|
|
|
|
+ $this->confirmReport($report_info['remote_application_id']);
|
|
|
|
+ // DB::table('remote_application')->where('id',$report_info['remote_application_id'])->update(['report_status'=>'9']);
|
|
|
|
+ // 添加messages消息
|
|
|
|
+ $t = '您的报告已确认';
|
|
|
|
+ $institution = DB::table('institution')->where('id',$doctor['institution_id'])->field('name')->find();
|
|
|
|
+ $c = '您的远程诊断报告,已被'.$institution['name'].$doctor['realname'].'医师确认';
|
|
|
|
+ $d = $status['remote_doctor_id'];
|
|
|
|
+ $type = '6';
|
|
|
|
+ $url = '';
|
|
|
|
+ Message::insert($t,$c,$d,$type,$url,1,$report_info['remote_application_id']);
|
|
|
|
+ }
|
|
|
|
+ DB::table('exams')->where('id',$id)->update(['film_type'=>$_REQUEST['param']['film_type']]);
|
|
|
|
+ DB::table('report')->where('id',$report_id)->update($rinfo);
|
|
|
|
+ $cache_key = $doctor['id'].'_'.$report_info['id'];
|
|
|
|
+ if(Cache::get($cache_key)){
|
|
|
|
+ Cache::rm($cache_key);
|
|
|
|
+ }
|
|
|
|
+ // 添加 确认log日志
|
|
|
|
+ $info = array();
|
|
|
|
+ $info['id'] = UUIDs::uuid16();
|
|
|
|
+ $info['createdAt'] = date('Y-m-d H:i:s',time());
|
|
|
|
+ $info['doctor_id'] = $doctor['id'];
|
|
|
|
+ $info['type'] = 3;
|
|
|
|
+ $info['report_id'] = $report_id;
|
|
|
|
+ DB::table('report_record')->insert($info);
|
|
return json_encode(['status'=>'ok','code'=>'0000','msg'=>'已确认']);
|
|
return json_encode(['status'=>'ok','code'=>'0000','msg'=>'已确认']);
|
|
}catch(\Exception $e){
|
|
}catch(\Exception $e){
|
|
return json_encode(['status'=>'fail','code'=>'2000','msg'=>$e->getMessage()]);
|
|
return json_encode(['status'=>'fail','code'=>'2000','msg'=>$e->getMessage()]);
|