刘桂岩 vor 5 Jahren
Ursprung
Commit
633e3b7ee2

+ 46 - 30
application/manage/controller/Order.php

@@ -57,22 +57,34 @@ class Order extends Base {
     public function localdatas() {
         $request = Request::instance();
         $params = $request->param();
-//        $pid = isset($params["pid"]) ? $params["pid"] : null;
-//        $status = isset($params["status"]) ? $params["status"] : null;
-//        $name = isset($params["name"]) ? $params["name"] : null;
-//        $whereArr = array();
-//        if ($pid != null) {
-//            $whereArr["parent_institution"] = array("like", "%" . $pid . "%");
-//        }
-//        if ($status != null) {
-//            $whereArr["status"] = $status;
-//        }
-//        if ($name != null) {
-//            $whereArr["name"] = array("like", "%" . $name . "%");
-//        }
+        $ins = isset($params["ins"]) ? $params["ins"] : null;
+        $time1 = isset($params["time1"]) ? $params["time1"] : null;
+        $time2 = isset($params["time2"]) ? $params["time2"] : null;
+        $whereArr = array();
+        if ($ins != null) {
+            $whereArr["super_hospital_id"] = $ins;
+        }
+        $timeWhere = [];
+        if($time2 == $time1 && $time1 != null){
+            $timeWhere["createdAt"] =["between",[$time1." 00:00:00",$time2." 23:59:59"]];
+        }elseif($time2 ==  null && $time1 != null){
+            $timeWhere["createdAt"] = [">",$time1." 00:00:00"];
+        }elseif ($time1 ==  null && $time2 != null) {
+            $timeWhere["createdAt"] = ["<",$time2." 23:59:59"];
+        }elseif($time1 !=  null && $time2 != null && $time1<$time2){
+            $timeWhere["createdAt"] = ["between",[$time1." 00:00:00",$time2." 23:59:59"]];
+        }
         $manage = Session::get('session_manager');
-        $rs = Db::table("remote_order")->where('hospital_id','in',$manage['institution_id'])->select();
-        $row = Db::table("remote_order")->where('hospital_id','in',$manage['institution_id'])->count();
+        $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;
+        }
+        $rs = Db::table("remote_order")->where('hospital_id','in',$manage['institution_id'])->where($whereArr)->where($timeWhere)->page($page, $pagesize)->select();
+        $row = Db::table("remote_order")->where('hospital_id','in',$manage['institution_id'])->where($whereArr)->where($timeWhere)->count();
         $data['total'] = $row;
         $data['rows'] = $rs;
         echo json_encode($data);
@@ -80,19 +92,23 @@ class Order extends Base {
     public function remotedatas() {
         $request = Request::instance();
         $params = $request->param();
-//        $pid = isset($params["pid"]) ? $params["pid"] : null;
-//        $status = isset($params["status"]) ? $params["status"] : null;
-//        $name = isset($params["name"]) ? $params["name"] : null;
-//        $whereArr = array();
-//        if ($pid != null) {
-//            $whereArr["parent_institution"] = array("like", "%" . $pid . "%");
-//        }
-//        if ($status != null) {
-//            $whereArr["status"] = $status;
-//        }
-//        if ($name != null) {
-//            $whereArr["name"] = array("like", "%" . $name . "%");
-//        }
+        $ins = isset($params["ins"]) ? $params["ins"] : null;
+        $time1 = isset($params["time1"]) ? $params["time1"] : null;
+        $time2 = isset($params["time2"]) ? $params["time2"] : null;
+        $whereArr = array();
+        if ($ins != null) {
+            $whereArr["super_hospital_id"] = $ins;
+        }
+        $timeWhere = [];
+        if($time2 == $time1 && $time1 != null){
+            $timeWhere["createdAt"] =["between",[$time1." 00:00:00",$time2." 23:59:59"]];
+        }elseif($time2 ==  null && $time1 != null){
+            $timeWhere["createdAt"] = [">",$time1." 00:00:00"];
+        }elseif ($time1 ==  null && $time2 != null) {
+            $timeWhere["createdAt"] = ["<",$time2." 23:59:59"];
+        }elseif($time1 !=  null && $time2 != null && $time1<$time2){
+            $timeWhere["createdAt"] = ["between",[$time1." 00:00:00",$time2." 23:59:59"]];
+        }
         $manage = Session::get('session_manager');
         $page = empty($_GET["page"]) ? 1 : $_GET["page"];
         $pagesize = empty($_GET["rows"]) ? 1 : $_GET["rows"];
@@ -102,8 +118,8 @@ class Order extends Base {
         if (empty($pagesize) || $pagesize < 1) {
             $pagesize = 30;
         }
-        $rs = Db::table("remote_order")->where('super_hospital_id','in',$manage['institution_id'])->page($page, $pagesize)->select();
-        $row = Db::table("remote_order")->where('super_hospital_id','in',$manage['institution_id'])->count();
+        $rs = Db::table("remote_order")->where('super_hospital_id','in',$manage['institution_id'])->where($whereArr)->where($timeWhere)->page($page, $pagesize)->select();
+        $row = Db::table("remote_order")->where('super_hospital_id','in',$manage['institution_id'])->where($whereArr)->where($timeWhere)->count();
         $data['total'] = $row;
         $data['rows'] = $rs;
 //        foreach ()

+ 9 - 13
application/manage/view/order/local.html

@@ -183,12 +183,12 @@
             
             function reload(){
                 var institution_id=$("#institution_id").combotree("getValue");
-                var status=$("#status").combobox("getValue");
-                var name=$("#name").textbox("getValue");
+                var time1=$("#time1").combobox("getValue");
+                var time2=$("#time2").textbox("getValue");
                 var queryParams = $('#dg').datagrid('options').queryParams;
-                queryParams.pid=institution_id;
-                queryParams.status=status;
-                queryParams.name=name;
+                queryParams.ins=institution_id;
+                queryParams.time1=time1;
+                queryParams.time2=time2;
                 $('#dg').datagrid('options').queryParams=queryParams;
                 $('#dg').datagrid("reload");
             }
@@ -245,9 +245,8 @@
                 });
                 $("#reset").click(function(){
                     $('#institution_id').combotree("setValue","");
-                    $('#status').combobox("setValue","");
-                    $('#username').textbox("setValue","");
-                    $("#name").textbox("setValue","");
+                    $('#time1').combotree("setValue","");
+                    $('#time2').textbox("setValue","");
                 });
             });
             
@@ -257,11 +256,8 @@
     <body>
         <table id="dg" class="easyui-datagrid" style="width:100%;height:auto;" ></table>
         <div id="tb" class="editform" style="display: none; padding-top: 1px;">&nbsp;
-            父机构:<input type="text" name="institution_id" id="institution_id" />&nbsp;
-            状态:<select id="status" name="status" class="easyui-combobox" style="width: 100px; " >
-            <option value="" >查询全部</option><option value="1" >可用</option><option value="2" >不可用</option>
-            </select>&nbsp;
-            名称:<input type="text" id="name" name="name" class="easyui-textbox" style="width: 200px; vertical-align: middle;" />&nbsp;
+            接收机构:<input type="text" name="institution_id" id="institution_id" />&nbsp;&nbsp;
+            订单创建时间:<input type="text" id="time1"  class="easyui-datebox" style="width: 120px;" />----<input type="text" id="time2" class="easyui-datebox" style="width: 120px;" />&nbsp;
             <a id="submit" href="#" class="easyui-linkbutton" data-options="iconCls:'icon-search'" style="width: 80px">查询</a>
             <a id="reset" href="#" class="easyui-linkbutton" data-options="iconCls:'icon-clear'" style="width: 80px" >重置</a>
             &nbsp;&nbsp;&nbsp;&nbsp;

+ 9 - 13
application/manage/view/order/remote.html

@@ -183,12 +183,12 @@
             
             function reload(){
                 var institution_id=$("#institution_id").combotree("getValue");
-                var status=$("#status").combobox("getValue");
-                var name=$("#name").textbox("getValue");
+                var time1=$("#time1").combobox("getValue");
+                var time2=$("#time2").textbox("getValue");
                 var queryParams = $('#dg').datagrid('options').queryParams;
-                queryParams.pid=institution_id;
-                queryParams.status=status;
-                queryParams.name=name;
+                queryParams.ins=institution_id;
+                queryParams.time1=time1;
+                queryParams.time2=time2;
                 $('#dg').datagrid('options').queryParams=queryParams;
                 $('#dg').datagrid("reload");
             }
@@ -245,9 +245,8 @@
                 });
                 $("#reset").click(function(){
                     $('#institution_id').combotree("setValue","");
-                    $('#status').combobox("setValue","");
-                    $('#username').textbox("setValue","");
-                    $("#name").textbox("setValue","");
+                    $('#time1').combobox("setValue","");
+                    $('#time2').textbox("setValue","");
                 });
             });
             
@@ -257,11 +256,8 @@
     <body>
         <table id="dg" class="easyui-datagrid" style="width:100%;height:auto;" ></table>
         <div id="tb" class="editform" style="display: none; padding-top: 1px;">&nbsp;
-            父机构:<input type="text" name="institution_id" id="institution_id" />&nbsp;
-            状态:<select id="status" name="status" class="easyui-combobox" style="width: 100px; " >
-            <option value="" >查询全部</option><option value="1" >可用</option><option value="2" >不可用</option>
-            </select>&nbsp;
-            名称:<input type="text" id="name" name="name" class="easyui-textbox" style="width: 200px; vertical-align: middle;" />&nbsp;
+            发起机构:<input type="text" name="institution_id" id="institution_id" />&nbsp;
+            订单创建时间:<input type="text" id="time1" class="easyui-datebox" style="width: 120px;" />----<input type="text" id="time2" class="easyui-datebox" style="width: 120px;" />&nbsp;
             <a id="submit" href="#" class="easyui-linkbutton" data-options="iconCls:'icon-search'" style="width: 80px">查询</a>
             <a id="reset" href="#" class="easyui-linkbutton" data-options="iconCls:'icon-clear'" style="width: 80px" >重置</a>
             &nbsp;&nbsp;&nbsp;&nbsp;