|
@@ -27,6 +27,7 @@ class Application extends Base
|
|
|
* @ApiParams (name="param", type="string", required=true, description="参数json字符串")
|
|
|
* @ApiParams (name="is_remote", type="string", required=true, description="参数json字符串")
|
|
|
* @ApiParams (name="param[id]", type="string", sample="", description="预约登记exams表id值<必填>")
|
|
|
+ * @ApiParams (name="param[rid]", type="string", sample="", description="远程申请表id值<远程列表进入必填>")
|
|
|
* @ApiReturnParams (name="status", type="integer", required=true, sample="0", description="返回码 fail 失败 ok成功"))
|
|
|
* @ApiReturnParams (name="code", type="integer", required=true, sample="0", description="返回状态码")
|
|
|
* @ApiReturnParams (name="info", type="string", required=true, sample="返回成功", description="返回信息")
|
|
@@ -38,7 +39,8 @@ class Application extends Base
|
|
|
'code': '0000',
|
|
|
'sessionid': 'a17z7a7a8f9g9rh9d89jio',
|
|
|
'is_remote': 1,
|
|
|
-'info' : ''
|
|
|
+'info' : '',
|
|
|
+'rid' : ''
|
|
|
}
|
|
|
*")
|
|
|
**/
|
|
@@ -51,7 +53,7 @@ class Application extends Base
|
|
|
if(isset($_REQUEST['is_remote']) && $_REQUEST['is_remote']==1){
|
|
|
$is_remote = 1;
|
|
|
}
|
|
|
- $info = DB::table('exams')->where('id',$id)->field('id,study_id,patient_id,register_datetime,exam_class,exam_sub_class,exam_project,device,exam_datetime,exam_status')->find();
|
|
|
+ $info = DB::table('exams')->where('id',$id)->field('id,urgent,study_id,patient_id,register_datetime,exam_class,exam_sub_class,exam_project,device,exam_datetime,exam_status')->find();
|
|
|
$exam_class = DB::table('constant')->where('id',$info['exam_class'])->field('constant_value')->find();
|
|
|
$exam_subclass = DB::table('exam_subclass')->where('id',$info['exam_sub_class'])->cache(300)->find();
|
|
|
$exam_project = DB::table('exam_project')->where('id',$info['exam_project'])->cache(300)->find();
|
|
@@ -84,10 +86,10 @@ class Application extends Base
|
|
|
//申请信息
|
|
|
if(isset($param['rid']) && !empty($param['rid'])){
|
|
|
$rid = $param['rid'];
|
|
|
- $application = DB::table('remote_application')->where('id',$rid)->field(['report_status,id,remote_doctor_id','application_desc','attachment','req_doctor_id','illness_desc','phys_sign','clin_symp','anamnesis','family_ill','remark','clin_diag'])->find();
|
|
|
+ $application = DB::table('remote_application')->where('id',$rid)->field(['report_status,id,remote_doctor_id','application_desc','attachment','req_doctor_id','illness_desc','phys_sign','is_urgent','clin_symp','anamnesis','family_ill','remark','clin_diag'])->find();
|
|
|
}else{
|
|
|
$rid = '';
|
|
|
- $application = DB::table('remote_application')->where('exam_id',$id)->field(['report_status,id,remote_doctor_id','application_desc','attachment','req_doctor_id','illness_desc','phys_sign','clin_symp','anamnesis','family_ill','remark','clin_diag'])->find();
|
|
|
+ $application = DB::table('remote_application')->where('exam_id',$id)->field(['report_status,id,remote_doctor_id','application_desc','attachment','req_doctor_id','illness_desc','phys_sign','clin_symp','is_urgent','anamnesis','family_ill','remark','clin_diag'])->find();
|
|
|
}
|
|
|
if($is_remote == 1){
|
|
|
//远程申请点击进入
|
|
@@ -102,6 +104,7 @@ class Application extends Base
|
|
|
$exam_application = DB::table('exams')->where('id',$id)->field(['illness_desc','phys_sign','clin_symp','remark','clin_diag','anamnesis','family_ill'])->find();
|
|
|
$exam_application['anamnesis'] = explode(',',$exam_application['anamnesis']);
|
|
|
$exam_application['family_ill'] = explode(',',$exam_application['family_ill']);
|
|
|
+ $exam_application['report_status'] = '';
|
|
|
$info['application'] = $exam_application;
|
|
|
}else{
|
|
|
$remote_name = DB::table('doctors')->where('id',$application['remote_doctor_id'])->field('realname')->find();
|
|
@@ -204,12 +207,12 @@ 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'])->find();
|
|
|
+ $r = DB::table('remote_application')->where('exam_id',$param['id'])->where('report_status','not in','5,12')->find();
|
|
|
if($r){
|
|
|
return json_encode(['status'=>'fail','code'=>'1120','msg'=>'每个医院同一个检查只能申请一次']);
|
|
|
}
|
|
|
//不等于9 代表
|
|
|
- $a_info = DB::table('remote_application')->where($where)->where('exam_id',$param['id'])->where('report_status','<>','9')->find();
|
|
|
+ $a_info = DB::table('remote_application')->where($where)->where('exam_id',$param['id'])->where('report_status','not in','12,5,9')->find();
|
|
|
if($a_info){
|
|
|
return json_encode(['status'=>'fail','code'=>'1120','msg'=>'该申请目标医院存在未完成报告,只有报告完成后才能再次发起申请']);
|
|
|
}
|
|
@@ -244,11 +247,19 @@ class Application extends Base
|
|
|
// 申请远程
|
|
|
// if(empty($remote_application)){
|
|
|
log::record('新增远程申请');
|
|
|
- $application_info['id'] = UUIDs::uuid16();
|
|
|
- $application_info['createdAt'] = date('Y-m-d H:i:s',time());
|
|
|
$application_info['report_status'] = 4;
|
|
|
- DB::table('remote_application')->insert($application_info);
|
|
|
- $aid = $application_info['id'];
|
|
|
+ $re = DB::table('remote_application')->where('exam_id',$param['id'])->find();
|
|
|
+ if($re){
|
|
|
+ // 存在被驳回申请 再次申请时则为驳回后发起的申请
|
|
|
+ DB::table('remote_application')->where('exam_id',$param['id'])->update($application_info);
|
|
|
+ $app_id = $re['id'];
|
|
|
+ }else{
|
|
|
+ $application_info['id'] = UUIDs::uuid16();
|
|
|
+ $application_info['createdAt'] = date('Y-m-d H:i:s',time());
|
|
|
+ DB::table('remote_application')->insert($application_info);
|
|
|
+ $app_id = $application_info['id'];
|
|
|
+ }
|
|
|
+ $aid = $app_id;
|
|
|
$r_info = DB::table('report')->where('exam_id',$param['id'])->find();
|
|
|
if(empty($r_info)){
|
|
|
$report = array();
|
|
@@ -381,7 +392,7 @@ class Application extends Base
|
|
|
$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]);
|
|
|
+ DB::table('remote_application')->where('id',$id)->update(['report_status'=>5]);
|
|
|
// 驳回发短信
|
|
|
// if($application['req_doctor_id'] == 'c44663d6d3c0b535'){
|
|
|
$dinfo = DB::table('doctors')->where('id',$application['req_doctor_id'])->find();
|
|
@@ -498,4 +509,16 @@ class Application extends Base
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+ public function revoke(){
|
|
|
+ $id = $_REQUEST['id'];
|
|
|
+ $status = DB::table('remote_application')->where('exam_id',$id)->field('report_status')->find();
|
|
|
+ if($status['report_status'] == 4){
|
|
|
+ DB::table('remote_application')->where('exam_id',$id)->update(['report_status'=>12]);
|
|
|
+ }else{
|
|
|
+ return json_encode(['status'=>'ok','code'=>'0100','msg'=>'只能撤回申请中状态的申请单']);
|
|
|
+ }
|
|
|
+ return json_encode(['status'=>'ok','code'=>'0000','msg'=>'撤回成功']);
|
|
|
+ }
|
|
|
}
|