|
@@ -57,22 +57,34 @@ class Order extends Base {
|
|
public function localdatas() {
|
|
public function localdatas() {
|
|
$request = Request::instance();
|
|
$request = Request::instance();
|
|
$params = $request->param();
|
|
$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');
|
|
$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['total'] = $row;
|
|
$data['rows'] = $rs;
|
|
$data['rows'] = $rs;
|
|
echo json_encode($data);
|
|
echo json_encode($data);
|
|
@@ -80,19 +92,23 @@ class Order extends Base {
|
|
public function remotedatas() {
|
|
public function remotedatas() {
|
|
$request = Request::instance();
|
|
$request = Request::instance();
|
|
$params = $request->param();
|
|
$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');
|
|
$manage = Session::get('session_manager');
|
|
$page = empty($_GET["page"]) ? 1 : $_GET["page"];
|
|
$page = empty($_GET["page"]) ? 1 : $_GET["page"];
|
|
$pagesize = empty($_GET["rows"]) ? 1 : $_GET["rows"];
|
|
$pagesize = empty($_GET["rows"]) ? 1 : $_GET["rows"];
|
|
@@ -102,8 +118,8 @@ class Order extends Base {
|
|
if (empty($pagesize) || $pagesize < 1) {
|
|
if (empty($pagesize) || $pagesize < 1) {
|
|
$pagesize = 30;
|
|
$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['total'] = $row;
|
|
$data['rows'] = $rs;
|
|
$data['rows'] = $rs;
|
|
// foreach ()
|
|
// foreach ()
|