Selaa lähdekoodia

tongji shuliang

lgy 6 vuotta sitten
vanhempi
commit
c5b417a39a
1 muutettua tiedostoa jossa 67 lisäystä ja 0 poistoa
  1. 67 0
      application/inter/controller/Dcquery.php

+ 67 - 0
application/inter/controller/Dcquery.php

@@ -422,4 +422,71 @@ class Dcquery extends Controller
             'frameIndex' => $frameIndex,
         ];
     }
+
+    public function get_infos()
+    {
+        $date = $_REQUEST['date'];
+        $time = strtotime($date);
+        $d1 = date('Y-m-d 00:00:00',$time);
+        $d2 = date('Y-m-d 23:59:59',$time);
+        $timedate = [$d1,$d2];
+        $institution = DB::table('institution')->field('id,name')->select();
+        $info = [];
+        foreach($institution as $k=>$v){
+            // 某天患者数量
+            $patient_num = DB::table('patient_infos')->where('institution_id',$v['id'])->where('createdAt','between',$timedate)->count();
+            // 某天检查数量
+            $studies_num = DB::table('studies')->where('institution_id',$v['id'])->where('studydate',$date)->count();
+            $study_id = DB::table('studies')->where('institution_id',$v['id'])->where('studydate',$date)->column('id');
+            // exams检查的数量
+            $exam_num = DB::table('exams')->where('study_id','in',$study_id)->count();
+            // 序列数量
+            $series_num = DB::table('series')->where('study_id','in',$study_id)->count();
+            $series_id = DB::table('series')->where('study_id','in',$study_id)->column('id');
+            // 影像数量
+            $image_num = DB::table('images')->where('series_id','in',$series_id)->count();
+            $doctor_id = DB::table('doctors')->where('institution_id',$v['id'])->column('id');
+            // 某天报告数量
+            $report_num = DB::table('report')->where('report_doctor_id','in',$doctor_id)->where('report_datetime','between',$timedate)->count();
+            // 某天发起的远程申请单数量
+            $application_num = DB::table('remote_application')->where('local_institution_id',$v['id'])->where('req_date_time','between',$timedate)->count();
+            // 各个状态的数量
+            $exams3 = DB::table('exams')->where('study_id','in',$study_id)->where('exam_status',3)->count(); //检查完毕
+            $exams7 = DB::table('exams')->where('study_id','in',$study_id)->where('exam_status',7)->count(); //已写报告
+            $exams8 = DB::table('exams')->where('study_id','in',$study_id)->where('exam_status',8)->count(); //已审报告
+            $exams9 = DB::table('exams')->where('study_id','in',$study_id)->where('exam_status',9)->count(); //已确认报告
+            $appliaction3 = DB::table('remote_application')->where('local_institution_id',$v['id'])->where('req_date_time','between',$timedate)->where('report_status','')->count();
+            $appliaction4 = DB::table('remote_application')->where('local_institution_id',$v['id'])->where('req_date_time','between',$timedate)->where('report_status',4)->count();
+            $appliaction5 = DB::table('remote_application')->where('local_institution_id',$v['id'])->where('req_date_time','between',$timedate)->where('report_status',5)->count();
+            $appliaction6 = DB::table('remote_application')->where('local_institution_id',$v['id'])->where('req_date_time','between',$timedate)->where('report_status',6)->count();
+            $appliaction7 = DB::table('remote_application')->where('local_institution_id',$v['id'])->where('req_date_time','between',$timedate)->where('report_status',7)->count();
+            $appliaction8 = DB::table('remote_application')->where('local_institution_id',$v['id'])->where('req_date_time','between',$timedate)->where('report_status',8)->count();
+            $appliaction9 = DB::table('remote_application')->where('local_institution_id',$v['id'])->where('req_date_time','between',$timedate)->where('report_status',9)->count();
+            $appliaction12 = DB::table('remote_application')->where('local_institution_id',$v['id'])->where('req_date_time','between',$timedate)->where('report_status',12)->count();
+            $info[] = [
+                'institution_id'=>$v['id'],
+                'institution_name'=>$v['name'],
+                'patient'=>$patient_num, //患者数量
+                'studies'=>$studies_num, //检查数量
+                'exams' =>$exam_num, //检查数量
+                'exams3'=>$exams3, //检查完毕
+                'exams7'=>$exams7, //已写报告
+                'exams8'=>$exams8, //已审报告
+                'exams9'=>$exams9, //已确认报告
+                'series'=>$series_num, //序列数量
+                'images'=>$image_num, //影像数量
+                'report'=>$report_num, //报告数量
+                'application'=>$application_num, //申请数量
+                'application3'=>$appliaction3, //申请数量
+                'application4'=>$appliaction4, //申请数量
+                'application5'=>$appliaction5, //申请数量
+                'application6'=>$appliaction6, //申请数量
+                'application7'=>$appliaction7, //申请数量
+                'application8'=>$appliaction8, //申请数量
+                'application9'=>$appliaction9, //申请数量
+                'application12'=>$appliaction12, //申请数量
+            ];
+        }
+        return json_encode($info);
+    }
 }