|
@@ -76,14 +76,9 @@ class Counts extends Base {
|
|
|
if (empty($pagesize) || $pagesize < 1) {
|
|
|
$pagesize = 30;
|
|
|
}
|
|
|
- $start = $pagesize*($page-1);
|
|
|
- if($page != 1){
|
|
|
- $start = $start+1;
|
|
|
- }
|
|
|
- $finish = $pagesize*$page;
|
|
|
- $limit = "limit $start,$finish";
|
|
|
- /*$count = DB::table('studies')
|
|
|
+ $count = DB::table('studies')
|
|
|
->alias('s')
|
|
|
+ ->distinct(true)
|
|
|
->join(['patient_infos'=>'p'],'p.id=s.patient_id')
|
|
|
->join(['user_bind'=>'u'],'u.patient_id=s.patient_id','left')
|
|
|
->where('s.institution_id='.$institution_id)
|
|
@@ -91,6 +86,7 @@ class Counts extends Base {
|
|
|
->count();
|
|
|
$list = DB::table('studies')
|
|
|
->alias('s')
|
|
|
+ ->distinct(true)
|
|
|
->join(['patient_infos'=>'p'],'p.id=s.patient_id')
|
|
|
->join(['user_bind'=>'u'],'u.patient_id=s.patient_id','left')
|
|
|
->where('s.institution_id='.$institution_id)
|
|
@@ -98,9 +94,7 @@ class Counts extends Base {
|
|
|
->page($page, $pagesize)
|
|
|
->field('p.name,p.age,p.sex,s.studydate,s.createdAt,s.modality,u.exam_id')
|
|
|
->order('s.createdAt desc')
|
|
|
- ->select();*/
|
|
|
- $count = "SELECT count(*) FROM `studies` `s` INNER JOIN `patient_infos` `p` ON `p`.`id`=`s`.`patient_id` LEFT JOIN ( SELECT `patient_id`, max(`createAt`) FROM `user_bind` group by `patient_id`) AS u ON `u`.`patient_id`=`s`.`patient_id` WHERE ( s.institution_id=$institution_id ) ORDER BY `s`.`createdAt`";
|
|
|
- $list = "SELECT `p`.`name`,`p`.`age`,`p`.`sex`,`s`.`studydate`,`s`.`createdAt`,`s`.`modality`,`u`.`patient_id` FROM `studies` `s` INNER JOIN `patient_infos` `p` ON `p`.`id`=`s`.`patient_id` LEFT JOIN ( SELECT `patient_id`, max(`createAt`) FROM `user_bind` group by `patient_id`) AS u ON `u`.`patient_id`=`s`.`patient_id` WHERE ( s.institution_id=$institution_id ) ORDER BY `s`.`createdAt` $limit";
|
|
|
+ ->select();
|
|
|
$data["total"] = $count;
|
|
|
$data["rows"] = $list;
|
|
|
echo json_encode($data);
|
|
@@ -158,6 +152,7 @@ class Counts extends Base {
|
|
|
}
|
|
|
$data = DB::table('studies')
|
|
|
->alias('s')
|
|
|
+ ->distinct(true)
|
|
|
->join(['patient_infos'=>'p'],'p.id=s.patient_id')
|
|
|
->join(['user_bind'=>'u'],'u.patient_id=s.patient_id','left')
|
|
|
->where('s.institution_id='.$institution_id)
|