|
@@ -22,6 +22,7 @@ class Counts extends Base {
|
|
|
public function datas(){
|
|
|
$admin = Session::get('session_manager');
|
|
|
$institution_id = $admin['institution_id'];
|
|
|
+ $institution = explode(',',$institution_id);
|
|
|
$request = Request::instance();
|
|
|
$params = $request->param();
|
|
|
$where = [];
|
|
@@ -77,25 +78,28 @@ class Counts extends Base {
|
|
|
if (empty($pagesize) || $pagesize < 1) {
|
|
|
$pagesize = 30;
|
|
|
}
|
|
|
+ $institution_where['s.institution_id'] = ['in',$institution];
|
|
|
$count = DB::table('studies')
|
|
|
->alias('s')
|
|
|
->distinct(true)
|
|
|
->join(['patient_infos'=>'p'],'p.id=s.patient_id')
|
|
|
- ->join(['exams'=>'e'],'e.patient_id=p.id')
|
|
|
+ ->join(['exams'=>'e'],'e.study_id=s.id')
|
|
|
->join(['user_bind'=>'u'],'u.patient_id=s.patient_id','left')
|
|
|
- ->where('s.institution_id='.$institution_id)
|
|
|
+ ->join(['institution'=>'ins'],'ins.id=e.institution_id','left')
|
|
|
+ ->where($institution_where)
|
|
|
->where($search)
|
|
|
->count();
|
|
|
$list = DB::table('studies')
|
|
|
->alias('s')
|
|
|
->distinct(true)
|
|
|
->join(['patient_infos'=>'p'],'p.id=s.patient_id')
|
|
|
- ->join(['exams'=>'e'],'e.patient_id=p.id')
|
|
|
+ ->join(['exams'=>'e'],'e.study_id=s.id')
|
|
|
->join(['user_bind'=>'u'],'u.patient_id=s.patient_id','left')
|
|
|
- ->where('s.institution_id='.$institution_id)
|
|
|
+ ->join(['institution'=>'ins'],'ins.id=e.institution_id','left')
|
|
|
+ ->where($institution_where)
|
|
|
->where($search)
|
|
|
->page($page, $pagesize)
|
|
|
- ->field('p.name,p.age,p.sex,s.studydate,s.createdAt,s.modality,u.exam_id')
|
|
|
+ ->field('p.name,p.age,p.sex,s.studydate,s.createdAt,s.modality,u.exam_id,ins.name as institution_name')
|
|
|
->order('s.createdAt desc')
|
|
|
->select();
|
|
|
$data["total"] = $count;
|
|
@@ -112,7 +116,7 @@ class Counts extends Base {
|
|
|
$where[] = ' e.film_type=2';
|
|
|
foreach ($params as $k=>$v) {
|
|
|
if(empty($v)){
|
|
|
- continue ;
|
|
|
+ continue;
|
|
|
}
|
|
|
switch($k){
|
|
|
case 'upload_datetime1':
|