|
@@ -75,22 +75,59 @@ class Application extends Base
|
|
|
$doctor = Cache::get($sessionid);
|
|
|
$institution_id = $doctor['institution_id'];
|
|
|
$hospital = DB::table('institution')->where('id',$institution_id)->find();
|
|
|
- $parent_hosp = explode(',',$hospital['parent_institution']);
|
|
|
+ $is_pay = $hospital['is_pay'];
|
|
|
$parent_name = array();
|
|
|
- foreach($parent_hosp as $v){
|
|
|
- $phname = DB::table("institution")->where('id',$v)->cache(300)->field(['id','name'])->find();
|
|
|
- log::record('上级医院----'.json_encode($phname));
|
|
|
- if(!isset($phname['id']) || empty($phname['id'])){
|
|
|
- $phname['id'] = $v;
|
|
|
+ // select rc1.hospital_id, rc1.super_hospital_id, rc1.hospital_name, rc1.super_hospital_name, rc1.pay_type, rc2.super_doctor_id, rc2.super_doctor_name, rc2.exam_class from remote_contact rc1 join remote_cost rc2 on rc1.hospital_id = rc2.hospital_id and rc1.super_hospital_id = rc2.super_hospital_id where rc1.hospital_id = '13000003' and rc2.exam_class='CT' order by rc1.sort, rc2.sort
|
|
|
+ if($is_pay === 1) {
|
|
|
+ $super_hospitals = array();
|
|
|
+ $super_doctors = DB::table("remote_contact")
|
|
|
+ ->alias("rc1")
|
|
|
+ ->join('remote_contact rc2', 'r1.hospital_id = rc2.hospital_id and rc1.super_hospital_id = rc2.super_hospital_id')
|
|
|
+ ->where('rc1.hospital_id', $institution_id)
|
|
|
+ ->where('rc2.exam_class', $info['exam_class'])
|
|
|
+ ->field('rc1.hospital_id, rc1.super_hospital_id, rc1.hospital_name, rc1.super_hospital_name, rc1.pay_type, rc2.super_doctor_id, rc2.super_doctor_name, rc2.exam_class')
|
|
|
+ ->select();
|
|
|
+ foreach($super_doctors as $v) {
|
|
|
+ if(!isset($super_hospitals[$v['hospital_id']])){
|
|
|
+ $super_hospitals[$v['hospital_id']] = [
|
|
|
+ "doctor" => [
|
|
|
+ [
|
|
|
+ "id" => $v['super_doctor_id'],
|
|
|
+ "is_admin" => 0,
|
|
|
+ "realname" => $v['super_doctor_name']
|
|
|
+ ]
|
|
|
+ ],
|
|
|
+ "id" => $v['super_hospital_id'],
|
|
|
+ "name" => $v['super_hospital_name'],
|
|
|
+ ];
|
|
|
+ } else {
|
|
|
+ $super_hospitals[$v['hospital_id']]['doctor'][] = [
|
|
|
+ "id" => $v['super_doctor_id'],
|
|
|
+ "is_admin" => 0,
|
|
|
+ "realname" => $v['super_doctor_name']
|
|
|
+ ];
|
|
|
+ }
|
|
|
+ }
|
|
|
+ foreach($super_hospitals as $v) {
|
|
|
+ $parent_name[] = $v;
|
|
|
}
|
|
|
- $doctor_info = DB::table('doctors')->where('institution_id',$v)->field('id,realname,is_admin')->order('is_admin desc')->select();
|
|
|
- foreach($doctor_info as $key=>$value){
|
|
|
- if($value['is_admin'] == 1){
|
|
|
- $doctor_info[$key]['realname'] = $value['realname'].'---医院管理员';
|
|
|
+ } else {
|
|
|
+ $parent_hosp = explode(',',$hospital['parent_institution']);
|
|
|
+ foreach($parent_hosp as $v){
|
|
|
+ $phname = DB::table("institution")->where('id',$v)->cache(300)->field(['id','name'])->find();
|
|
|
+ log::record('上级医院----'.json_encode($phname));
|
|
|
+ if(!isset($phname['id']) || empty($phname['id'])){
|
|
|
+ $phname['id'] = $v;
|
|
|
+ }
|
|
|
+ $doctor_info = DB::table('doctors')->where('institution_id',$v)->field('id,realname,is_admin')->order('is_admin desc')->select();
|
|
|
+ foreach($doctor_info as $key=>$value){
|
|
|
+ if($value['is_admin'] == 1){
|
|
|
+ $doctor_info[$key]['realname'] = $value['realname'].'---医院管理员';
|
|
|
+ }
|
|
|
}
|
|
|
+ $phname['doctor'] = $doctor_info;
|
|
|
+ $parent_name[] =$phname;
|
|
|
}
|
|
|
- $phname['doctor'] = $doctor_info;
|
|
|
- $parent_name[] =$phname;
|
|
|
}
|
|
|
$info['parent_hospital'] = $parent_name;
|
|
|
//申请信息
|