|
@@ -2,6 +2,7 @@
|
|
|
namespace app\inter\controller;
|
|
|
|
|
|
//use Doctrine\Common\Cache\Cache;
|
|
|
+use app\common\library\Message;
|
|
|
use think\Controller;
|
|
|
use think\Db;
|
|
|
use think\Session;
|
|
@@ -247,13 +248,12 @@ class Writereport extends Base
|
|
|
$info['exam_id'] = $param['id'];
|
|
|
$info['impression'] = isset($param['impression']) ? $param['impression'] : '';
|
|
|
$info['description'] = isset($param['description']) ? $param['description'] : '';
|
|
|
- $info['phone'] = isset($param['phone']) ? $param['phone'] : '';
|
|
|
if(isset($param['r_result']) && $param['r_result'] == 'true'){
|
|
|
$info['report_result'] = 2;
|
|
|
}else{
|
|
|
$info['report_result'] = 1;
|
|
|
}
|
|
|
- DB::table('exams')->where('id',$param['id'])->update(['film_type'=>$film_type,'exam_report'=>$info['report_result']]);
|
|
|
+ DB::table('exams')->where('id',$param['id'])->update(['film_type'=>$film_type,'phone'=>isset($param['phone']) ? $param['phone'] : '','exam_report'=>$info['report_result']]);
|
|
|
// 报告的id
|
|
|
$report_id = $param['report_id'];
|
|
|
if(isset($_REQUEST['is_remote']) && !empty($_REQUEST['is_remote'])){
|
|
@@ -461,7 +461,7 @@ class Writereport extends Base
|
|
|
}
|
|
|
}else{
|
|
|
//远程
|
|
|
- $status = DB::table('remote_application')->where('id',$report_info['remote_application_id'])->field('report_status')->find();
|
|
|
+ $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){
|
|
@@ -484,6 +484,14 @@ class Writereport extends Base
|
|
|
}else{
|
|
|
//远程确认
|
|
|
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 = '报告确认';
|
|
|
+ $url = '';
|
|
|
+ Message::insert($t,$c,$d,$type,$url);
|
|
|
}
|
|
|
DB::table('exams')->where('id',$id)->update(['film_type'=>$_REQUEST['param']['film_type']]);
|
|
|
DB::table('report')->where('id',$report_id)->update($rinfo);
|
|
@@ -546,7 +554,7 @@ class Writereport extends Base
|
|
|
if(isset($_REQUEST['is_remote']) && $_REQUEST['is_remote'] == 1){
|
|
|
// 是远程审核报告 8
|
|
|
$return = Verify::check_role($sessionid,8);
|
|
|
- $status = DB::table('remote_application')->where('id',$report['remote_application_id'])->field('report_status')->find();
|
|
|
+ $status = DB::table('remote_application')->where('id',$report['remote_application_id'])->field('req_doctor_id,report_status')->find();
|
|
|
if($status['report_status'] < 7){
|
|
|
return json_encode(['status'=>'fail','code'=>'1032','msg'=>'只能审核已提交的报告']);
|
|
|
}elseif($status['report_status']>7){
|
|
@@ -591,7 +599,6 @@ class Writereport extends Base
|
|
|
DB::table('exams')->where('id',$id)->update(['film_type'=>$param['film_type']]);
|
|
|
// 已审核 发送短信
|
|
|
$application = DB::table('remote_application')->where('exam_id',$id)->find();
|
|
|
-// if($application['req_doctor_id'] == 'c44663d6d3c0b535'){
|
|
|
$dinfo = DB::table('doctors')->where('id',$application['req_doctor_id'])->find();
|
|
|
$d_phone = $dinfo['phone'];
|
|
|
log::record('发短信的手机号为'.$d_phone);
|
|
@@ -605,8 +612,17 @@ class Writereport extends Base
|
|
|
$content =$application['id'];
|
|
|
send_message::sendSms2Self($tel,$type,$content);
|
|
|
}
|
|
|
-// }
|
|
|
- DB::table('exams')->where('id',$id)->update(['film_type'=>$param['film_type']]);
|
|
|
+ // 添加messages消息
|
|
|
+ if(isset($_REQUEST['is_remote']) && $_REQUEST['is_remote'] == 1){
|
|
|
+ $t = '您的远程诊断申请已完成';
|
|
|
+ $institution = DB::table('institution')->where('id',$doctor['institution_id'])->field('name')->find();
|
|
|
+ $c = '您的远程诊断申请,已由被'.$institution['name'].$doctor['realname'].'医师完成报告';
|
|
|
+ $d = $status['req_doctor_id'];
|
|
|
+ $type = '报告已审核';
|
|
|
+ $exam_class = DB::table('exams')->where('id',$id)->field('exam_class')->find();
|
|
|
+ $url = Message::url($sessionid,$id,0,$exam_class['exam_class'],$report_id);
|
|
|
+ Message::insert($t,$c,$d,$type,$url);
|
|
|
+ }
|
|
|
return json_encode(['status'=>'ok','code'=>'0000','msg'=>'已审核']);
|
|
|
}catch(\Exception $e){
|
|
|
return json_encode(['status'=>'fail','code'=>'2000','msg'=>$e->getMessage()]);
|