|
@@ -107,7 +107,7 @@ class Counts extends Base {
|
|
|
->where($institution_where)
|
|
|
->where($search)
|
|
|
->page($page, $pagesize)
|
|
|
- ->field('p.name,p.age,p.sex,s.studydate,s.createdAt,s.modality,u.exam_id,ins.name as institution_name')
|
|
|
+ ->field('p.name,p.age,p.sex,s.studydate,s.createdAt,s.modality,u.exam_id,ins.name as institution_name,e.accession_num')
|
|
|
->order('s.createdAt desc')
|
|
|
->select();
|
|
|
$data["total"] = $count;
|
|
@@ -119,8 +119,14 @@ class Counts extends Base {
|
|
|
public function out() {
|
|
|
$admin = Session::get('session_manager');
|
|
|
$institution_id = $admin['institution_id'];
|
|
|
+ $institution = explode(',',$institution_id);
|
|
|
$request = Request::instance();
|
|
|
$params = $request->param();
|
|
|
+ if(isset($params['institution']) && $params['institution'] != null){
|
|
|
+ $institution_where['s.institution_id'] = $params['institution'];
|
|
|
+ }else{
|
|
|
+ $institution_where['s.institution_id'] = ['in',$institution];
|
|
|
+ }
|
|
|
$where[] = ' e.film_type=2';
|
|
|
foreach ($params as $k=>$v) {
|
|
|
if(empty($v)){
|
|
@@ -157,11 +163,12 @@ class Counts extends Base {
|
|
|
->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)
|
|
|
- ->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,e.accession_num')
|
|
|
->order('s.createdAt desc')
|
|
|
->select();
|
|
|
//导入PHPExcel类库,因为PHPExcel没有用命名空间,只能inport导入
|
|
@@ -187,7 +194,7 @@ class Counts extends Base {
|
|
|
}
|
|
|
}
|
|
|
$filename = time()."数据统计表";
|
|
|
- $headArr = array("患者姓名","患者年龄", "患者性别","检查时间", "上传时间", "患者类型", "是否绑定微信");
|
|
|
+ $headArr = array("患者姓名","患者年龄", "患者性别","检查时间", "上传时间", "患者类型", "是否绑定微信","科室检查号");
|
|
|
$this->getExcel($filename, $headArr, $data);
|
|
|
}
|
|
|
public function getExcel($fileName, $headArr, $data) {
|