Browse Source

tianjia tongji

lgy 6 years ago
parent
commit
8f84702ebf
2 changed files with 258 additions and 0 deletions
  1. 101 0
      application/manage/controller/Counts.php
  2. 157 0
      application/manage/view/counts/index.html

+ 101 - 0
application/manage/controller/Counts.php

@@ -0,0 +1,101 @@
+<?php
+
+namespace app\manage\controller;
+
+use think\Controller;
+use think\Db;
+use think\Session;
+use think\Config;
+use think\Cookie;
+use think\Request;
+use app\common\library\SysLogs;
+use app\common\library\UUIDs;
+
+/**
+ * 
+ */
+class Counts extends Base {
+	public function index(){
+        return $this->fetch();
+	}
+
+    public function datas(){
+        $admin = Session::get('session_manager');
+        $institution_id = $admin['institution_id'];
+        $request = Request::instance();
+        $params = $request->param();
+        $where = array();
+        foreach ($params as $k=>$v) {
+            switch($k){
+                case 'upload1':
+                    if($params['upload1'] == null){
+                        continue;
+                    }
+                    $where[] = ' s.createdAt > \''.$params['upload1'].'\' ';
+                    break;
+                case 'upload2':
+                    if($params['upload2'] == null){
+                        continue;
+                    }
+                    $where[] = ' s.createdAt < \''.$params['upload2'].'\' ';
+                    break;
+                case 'exam1':
+                    if($params['exam1'] == null){
+                        continue;
+                    }
+                    $exam1 = str_replace('-', '', $params['exam1']);
+                    $where[] = ' s.studydate > \''.$exam1.'\' ';
+                    break;
+                case 'exam2':
+                    if($params['exam2'] == null){
+                        continue;
+                    }
+                    $exam2 = str_replace('-', '', $params['exam2']);
+                    $where[] = ' s.studydate < \''.$exam2.'\' ';
+                    break;
+                case 'exam_class':
+                    if($params['exam_class'] == null){
+                        continue;
+                    }
+                    $where[] = 's.modality=\''.$params['exam_class'].'\' ';
+                    break;
+            }
+        }
+        if(count($where) <= 1){
+            $where1  =  implode('',$where);
+            $search = $where1;
+        }else{
+            $where1 = implode(' and ',$where);
+            $search = $where1;
+        }
+        $page = empty($_GET["page"]) ? 1 : $_GET["page"];
+        $pagesize = empty($_GET["rows"]) ? 1 : $_GET["rows"];
+        if (empty($page) || $page < 1) {
+            $page = 1;
+        }
+        if (empty($pagesize) || $pagesize < 1) {
+            $pagesize = 30;
+        }
+        $count = DB::table('studies')
+            ->alias('s')
+            ->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)
+            ->where($search)
+            ->count();
+        $list = DB::table('studies')
+            ->alias('s')
+            ->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)
+            ->where($search)
+            ->page($page, $pagesize)
+            ->field('p.name,p.age,p.sex,s.studydate,s.createdAt,s.modality,u.exam_id')
+            ->order('s.createdAt desc')
+            ->select();
+        $data["total"] = $count;
+        $data["rows"] = $list;
+        echo json_encode($data);
+
+    }
+}

+ 157 - 0
application/manage/view/counts/index.html

@@ -0,0 +1,157 @@
+<!DOCTYPE html>
+<html>
+    <head>
+        <title>TODO supply a title</title>
+        {include file="../application/manage/view/commons/headers.html" }
+        <script >
+            
+            // 编辑窗口
+            var $editWin;
+            var editWinHeight=$(window).height()-35;
+            var editWinWidth=$(window).width()*0.98;
+            
+            $(function(){
+                    $editWin = $('#edit-window').window({
+                        title: '数据统计信息',
+                        width: editWinWidth,height: editWinHeight,
+                        top: ($(window).height() -editWinHeight ) /2 ,
+                        left: ($(window).width() -editWinWidth ) /2 ,
+                        shadow: true,modal: true,
+                        iconCls: 'icon-edit',closed: true,resizable:true,
+                        minimizable: false,maximizable: true,collapsible: false
+                    });
+
+            });
+
+            $(window).resize(function() {
+                editWinWidth=$(window).width()*0.98;
+                $('#edit-window').window('resize',{
+                    width: editWinWidth,height: editWinHeight
+                });
+            });
+            
+            function dateFormatter(date){
+	    	if(typeof date=="undefined"){ return "--"; }
+	    	return new Date(date).format("yy-MM-dd hh:mm");
+	    }
+            
+            function statusFormatter(status){
+                if(status=="1"){
+                    return "正常";
+                }else if(status=="0"){
+                    return "屏蔽";
+                }else{
+                    return "非正常";
+                }
+            }
+            
+            function insFormatter(id,row){
+                for(var i=0;i<institutionsData.length;i++){
+                    var row=institutionsData[i];
+                    if(row.id==id){
+                        return row.name;
+                    }
+                }
+	    	return "<font color='#ccc' >顶级机构<font>";
+            }
+            
+            function commandsFormatter(id,row){
+	    	var cmdEdit="<a href='#' onclick=\"javascript:showEditWin('"+row.id+"');\" >编辑</a>&nbsp;";
+                cmdEdit+="<a href='#' onclick=\"javascript:deleteRow('"+row.id+"');\" >删除</a>";
+	    	return cmdEdit;
+	    }
+            
+            
+            
+            function statusFormatter(status){
+                if(status=="0"){
+                    return "屏蔽";
+                }else if(status=="1"){
+                    return "正常";
+                }else{
+                    return status;
+                }
+            }
+
+
+            function pfromFormatter(source){
+                if(source){
+                    return "绑定";
+                }else if(source==null){
+                    return "未绑定";
+                }else{
+                    return source;
+                }
+            }
+
+            function sfromFormatter(source){
+                if(source=="M"){
+                    return "男";
+                }else if(source=="F"){
+                    return "女";
+                }else{
+                    return source;
+                }
+            }
+
+            $(function(){
+                
+                var height=$(document).height();
+                $("#dg").height(height);
+                                
+                $('#dg').datagrid({
+                    url:'/manage/counts/datas',
+                    idField:'id',method: 'get',rownumbers: true,showFooter: true,singleSelect:true,selectOnCheck:false,
+                    toolbar: '#tb',pageList: [dgRowSize,dgRowSize*2,50,100],pagination:true,pageSize:dgRowSize,
+                    columns:[[
+                            {field:'name',title:'患者姓名',width:"120",align:'left'},
+                            {field:'sex',title:'患者性别',width:100 , formatter:sfromFormatter  },
+                            {field:'age',title:'患者年龄', hidden:true,width:115  },
+                            {field:'modality',title:'检查类型',width:135  },
+                            {field:'studydate',title:'检查时间',width:200  },
+                            {field:'createdAt',title:'上传时间',width:200 },
+                            {field:'exam_id',title:'是否绑定微信',width:115  , formatter:pfromFormatter  },
+                    ]],
+                    onDblClickRow :function(rowIndex,rowData){
+                        showEditWin(rowData.id);
+                    },
+                });
+
+
+            });
+            
+            function reload(){
+                var upload1 = $("#upload1").val();
+                var upload2 = $("#upload2").val();
+                var exam1 = $("#exam1").val();
+                var exam2 = $("#exam2").val();
+                var exam=$('#exam_class').val();
+                var url="/manage/counts/datas?exam_class="+(exam==null?"":exam)+"&upload1="+(upload1==null?"":upload1)+"&upload2="+(upload2==null?"":upload2)+"&exam1="+(exam1==null?"":exam1)+"&exam2="+(exam2==null?"":exam2);
+                $('#dg').datagrid("reload",url);
+            }
+            
+        
+            
+            $(function(){
+                $('#institution_id').combotree({
+                    required:true,multiple:false,editable:false,
+                    valueField:'id',textField:'name',panelWidth:550,
+                    url:"/manage/institution/insCombobox"
+                });
+            });
+            
+        </script>
+        
+    </head>
+    <body>
+        <div id="dg" class="easyui-datagrid" style="width:100%;height:auto;" ></div>
+        <div id="tb" class="editform" style="display: none; padding-top: 1px;">&nbsp;
+            检查类型:<input type="text" name="exam_class" id="exam_class" style="width:150px;" />&nbsp;
+            检查时间:<input type="text" id="exam1"  name="upload_datetime[]" class="easyui-datebox" style="width: 120px;" />----<input type="text" id="exam2" name="upload_datetime[]" class="easyui-datebox" style="width: 120px;" />&nbsp;&nbsp;&nbsp;
+            上传时间:<input type="text" id="upload1"  name="upload_datetime[]" class="easyui-datebox" style="width: 120px;" />----<input type="text" id="upload2"  name="upload_datetime[]" class="easyui-datebox" style="width: 120px;" />&nbsp;&nbsp;&nbsp;
+            <a id="submit" href="#" class="easyui-linkbutton" data-options="iconCls:'icon-search'" style="width: 80px" onclick="reload()" >查询</a>
+        </div>
+        <div id="edit-window" class="easyui-window" style="overflow: hidden" ><iframe src="about:blank" id="editFrame" style="width:100%;height:100%" frameborder="0" scrolling="yes" ></iframe></div>
+        
+    </body>
+</html>