|
@@ -9,6 +9,7 @@ use think\Cache;
|
|
|
use think\Log;
|
|
|
use app\common\library\Verify;
|
|
|
use think\File;
|
|
|
+use app\common\library\send_message;
|
|
|
class Application extends Base
|
|
|
{
|
|
|
/**
|
|
@@ -215,6 +216,7 @@ class Application extends Base
|
|
|
$application_info['id'] = UUIDs::uuid16();
|
|
|
$application_info['createdAt'] = date('Y-m-d H:i:s',time());
|
|
|
DB::table('remote_application')->insert($application_info);
|
|
|
+ $aid = $application_info['id'];
|
|
|
$report = array();
|
|
|
$report['id'] = UUIDs::uuid16();
|
|
|
$report['exam_id'] = $param['id'];
|
|
@@ -222,12 +224,25 @@ class Application extends Base
|
|
|
}else{
|
|
|
log::record('修改远程申请');
|
|
|
DB::table('remote_application')->where('exam_id',$param['id'])->update($application_info);
|
|
|
+ $r = DB::table('remote_application')->where('exam_id',$param['id'])->field('id')->find();
|
|
|
+ $aid = $r['id'];
|
|
|
}
|
|
|
if(isset($param['apply']) && !empty($param['apply'])){
|
|
|
//保存 申请
|
|
|
DB::table('exams')->where('id',$param['id'])->update(['exam_status'=>4,'updatedAt'=>date('Y-m-d H:i:s',time())]);
|
|
|
if(isset($param['remote_doctor_id']) && $param['remote_doctor_id'] == 'c44663d6d3c0b535'){
|
|
|
- $response = AliyunSms::sendSms('13764569789', '中世康恺','SMS_153325044',array("name" => "刘", "time" => date('H:i',strtotime('+1 hour'))));
|
|
|
+ $dinfo = DB::table('doctors')->where('id',$param['remote_doctor_id'])->find();
|
|
|
+ $d_phone = $dinfo['phone'];
|
|
|
+ $d_name = '';
|
|
|
+ $d_time = date('H:i',strtotime('+1 hour'));
|
|
|
+ $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',$param['remote_institution'])->field('name')->find();
|
|
|
+ $tel = '18910184804';
|
|
|
+ $type = '发起申请';
|
|
|
+ $content = $x_institution['name'].'医院的'.$doctor['realname'].'医生向上级'.$s_institution['name'].'医院的'.$dinfo['realname'].'医生发起了申请,该申请于'.date('H:i',strtotime('+1 hour')).'过期,单子的申请单id是'.$aid;
|
|
|
+ send_message::sendSms2Self($tel,$type,$content);
|
|
|
}
|
|
|
}
|
|
|
return json_encode(['status'=>'ok','code'=>'0000','sessionid'=>$sessionid]);
|
|
@@ -313,7 +328,7 @@ class Application extends Base
|
|
|
$doctor = Cache::get($sessionid);
|
|
|
$param = $_REQUEST['param'];
|
|
|
$id = $param['id'];
|
|
|
- $report = DB::table('report')->where('exam_id',$id)->field('id')->find();
|
|
|
+ $report = DB::table('report')->where('exam_id',$id)->field('id,report_doctor_id')->find();
|
|
|
$info = array();
|
|
|
$info['id'] = UUIDs::uuid16();
|
|
|
$info['report_id'] = $report['id'];
|
|
@@ -327,10 +342,25 @@ class Application extends Base
|
|
|
$message['title'] = '申请单驳回';
|
|
|
$message['content'] = $param['description'];
|
|
|
$message['createdAt'] = date('Y-m-d H:i:s',time());
|
|
|
- $did = DB::table('remote_application')->where('exam_id',$id)->field('req_doctor_id,local_institution_id')->find();
|
|
|
- $message['doctor_id'] = $did['req_doctor_id'];
|
|
|
- $message['institution_id'] = $did['local_institution_id'];
|
|
|
+ $application = DB::table('remote_application')->where('exam_id',$id)->find();
|
|
|
+ $message['doctor_id'] = $application['req_doctor_id'];
|
|
|
+ $message['institution_id'] = $application['local_institution_id'];
|
|
|
DB::table('exams')->where('id',$id)->update(['exam_status'=>5]);
|
|
|
+ // 驳回发短信
|
|
|
+ if($application['req_doctor_id'] == 'c44663d6d3c0b535'){
|
|
|
+ $dinfo = DB::table('doctors')->where('id',$application['req_doctor_id'])->find();
|
|
|
+ $d_phone = $dinfo['phone'];
|
|
|
+ $repsone = send_message::sendSms2RejectApply($d_phone,$param['description']);
|
|
|
+ // 上级医院
|
|
|
+ $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 = $s_institution['name'].'医院的'.$doctor['realname'].'医生驳回了下级'.$x_institution['name'].'医院的'.$x_name['realname'].'医生发起的申请,单子的申请单id是'.$did['id'].',驳回的理由是'.$param['description'];
|
|
|
+ send_message::sendSms2Self($tel,$type,$content);
|
|
|
+ }
|
|
|
return json_encode(['status'=>'ok','code'=>'0000','sessionid'=>$sessionid]);
|
|
|
}
|
|
|
|
|
@@ -361,9 +391,21 @@ class Application extends Base
|
|
|
//接收
|
|
|
public function recive(){
|
|
|
$sessionid = $_REQUEST['sessionid'];
|
|
|
-// $doctor = Cache::get($sessionid);
|
|
|
+ $doctor = Cache::get($sessionid);
|
|
|
$id = $_REQUEST['id'];
|
|
|
DB::table('exams')->where('id',$id)->update(['exam_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 = $s_institution['name'].'医院的'.$doctor['realname'].'医生接收了下级'.$x_institution['name'].'医院的'.$x_name['realname'].'医生发起的申请,单子的申请单id是'.$application['id'];
|
|
|
+ send_message::sendSms2Self($tel,$type,$content);
|
|
|
+ }
|
|
|
return json_encode(['status'=>'ok','code'=>'0000','sessionid'=>$sessionid]);
|
|
|
}
|
|
|
}
|