lgy 14 시간 전
부모
커밋
8e1d7c94df
1개의 변경된 파일31개의 추가작업 그리고 32개의 파일을 삭제
  1. 31 32
      server/application/api/model/exam/ExamModel.php

+ 31 - 32
server/application/api/model/exam/ExamModel.php

@@ -202,7 +202,7 @@ class ExamModel extends ZskkDefaultModel {
             }
             $field = [
                 'e.name', 'e.sex', 'e.age','e.patient_id as pid','e.hopitalized_no','e.bed_no','e.patient_area','e.body_part','e.application_department','e.application_doctor','e.out_patient','e.delivery_doctor','e.his_patient_id',
-                'e.id as exam_id', 'e.patient_num', 'e.exam_class', 'e.exam_datetime', "CONCAT(study_id,'&node_type=',node_type) as study_id", 'e.exam_status', 'e.accession_num', 'e.exam_project','e.medical_code','e.body_part_code','e.device_code','e.exam_datetime_code',
+                'e.id as exam_id', 'e.patient_num', 'e.exam_class', 'e.exam_datetime', "study_id",/*"CONCAT(study_id,'&node_type=',node_type) as study_id",*/ 'e.exam_status', 'e.accession_num', 'e.exam_project','e.medical_code','e.body_part_code','e.device_code','e.exam_datetime_code',
                 'r.report_result', 'r.report_datetime','r.id as rid','e.doctor_sign','e.patient_source','e.node_type',
                 'r.report_doctor_name','r.report_datetime',
                 'r.review_doctor_name','r.review_datetime',
@@ -221,35 +221,35 @@ class ExamModel extends ZskkDefaultModel {
                 $depart_where[] = ['application_department','in',$moreWhere['application_department'][1]];
                 unset($moreWhere['application_department']);
             }
-//            $total = $this
-//                ->alias('e')
-////                ->join(['patient_infos'=>'p'],'p.id=e.patient_id')
-////                ->join(['report'=>'r'], 'e.id = r.exam_id and r.type=1','LEFT')
-//                ->where($fuzzyWhere)
-//                ->where($whereDate)
-//                ->where($gradeWhere)
-//                ->where($moreWhere)
-//                ->where($depart_where)
-//                ->where($whereStatus)
-//                ->where($report_where)
-//                ->where($nameWhere)
-//                ->where($class_where)
-//                ->where('e.institution_id', $institutionId)
-//                ->where('e.status', 1)
-//                ->count();
-//            $limit = ($params['page']-1) * $params['num'];
-//            $num = $params['num'];
-//            // if($limit > $total)
-//            // {
-//            //     $limit = $limit-$total;
-//            // }
-//            if($limit + $num > $total)
-//            {
-//                $num = $total-$limit;
-//                if($num < 0) {
-//                    $num = 0;
-//                }
-//            }
+            $total = $this
+                ->alias('e')
+//                ->join(['patient_infos'=>'p'],'p.id=e.patient_id')
+//                ->join(['report'=>'r'], 'e.id = r.exam_id and r.type=1','LEFT')
+                ->where($fuzzyWhere)
+                ->where($whereDate)
+                ->where($gradeWhere)
+                ->where($moreWhere)
+                ->where($depart_where)
+                ->where($whereStatus)
+                ->where($report_where)
+                ->where($nameWhere)
+                ->where($class_where)
+                ->where('e.institution_id', $institutionId)
+                ->where('e.status', 1)
+                ->count();
+            $limit = ($params['page']-1) * $params['num'];
+            $num = $params['num'];
+            // if($limit > $total)
+            // {
+            //     $limit = $limit-$total;
+            // }
+            if($limit + $num > $total)
+            {
+                $num = $total-$limit;
+                if($num < 0) {
+                    $num = 0;
+                }
+            }
             $list = $this
                 ->alias('e')
                 ->join(['report'=>'r'], 'e.id = r.exam_id and r.type=1','LEFT')
@@ -264,11 +264,10 @@ class ExamModel extends ZskkDefaultModel {
                 ->where($class_where)
                 ->where('e.institution_id', $institutionId)
                 ->where('e.status', 1)
-                ->limit(10)
+                ->limit($limit,$num)
                 ->order($order)
                 ->field($field)
                 ->select();
-            var_dump($list);die;
             if($institutionId == '73000003')
             {
                 foreach ($list as $k=>$v)