【调度系统】广东民航医疗快线调度系统源代码
wzp
2024-12-06 0df39a8c5a45c6ff25411eace15d40a606f9769c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
<?php
//分页信息
$page=empty($_REQUEST['page'])!=false ? 1 : $_REQUEST['page'];
$QuantityInt = 20;    //每页显示数量
$acc1=$page;        //当前页数
$acc2=0;            //总页数
$acc3=0;            //总记录数
 
//查询条件
$searchSql="";
/*
$searchTXT=empty($searchTXT)!=false ? "" : $searchTXT;
if ($searchTXT!=""){
    $searchSql=" and (OA_Name like '%$searchTXT%') ";
}else{
    $searchSql="";
}
*/
 
$orderby=empty($orderby)!=false ? "" : $orderby;
If (strrpos($orderby," desc")>1){
    $orderbydesc="";
    $descTXT="↓";
}else{
    $orderbydesc=" desc";
    $descTXT="↑";
}
 
If ($orderby=="") {
  $orderby="OA_DepartmentID,OA_User_ID";
  $descTXT="↓";
}
 
//查询开始
$SqlOrdDateType=empty($SqlOrdDateType)!=false ? "" : $SqlOrdDateType;
$OrdClassType=empty($OrdClassType)!=false ? "1" : $OrdClassType;
 
$sql="select SourceName,sum(LoginUserInt) as LoginUserInt,sum(NewUserInt) as NewUserInt from (select (CASE when LEFT(UserSource,3)='Iid' then (select top 1 IntroducerName from IntroducerData where IntroducerID=replace(UserSource,LEFT(UserSource,3),'')) when LEFT(UserSource,4)='UUID' then '营销小程序' else UserSource END) as SourceName,LEFT(UserSource,3) as Source,replace(UserSource,LEFT(UserSource,3),'') as SourceID,count(UserID) as LoginUserInt,NewUserInt=(select count(UserID) from UserData as b where a.UserSource=b.UserSource and UserRegisterTime ".$SqlDateType." ) from UserData as a where UserSource<>'' and UserLoginTime ".$SqlDateType." GROUP BY UserSource) as aa GROUP BY SourceName";
//echo $sql;exit;
$data = sqlsrv_query($conn,$sql);
if($data == true){
    $FormArray=array();
    //表头
    $FormArray[0]=array("来源","新用户","活跃用户");
    $FormArrayX=count($FormArray[0]);
    if (sqlsrv_rows_affected($data)==0) {
        $SystemMessageType=2;
        $SystemMessageTXT="数据库中相关无数据!";
        $y=0;
    } else {
        $i=0;
        while($rs = sqlsrv_fetch_array( $data, SQLSRV_FETCH_ASSOC) ) {
            //读取数据
            $SourceName        = $rs['SourceName'];
            $NewUserInt        = $rs['NewUserInt'];
            $LoginUserInt        = $rs['LoginUserInt'];
            //读取数据--End
            
            //写入数组
            $i++;
            $FormArray[$i][0]=$SourceName;
            $FormArray[$i][1]=$NewUserInt;
            $FormArray[$i][2]=$LoginUserInt;
            
            //写入数组--End
        }
 
    }
}
 
//echo print_r($FormArray);
//exit;
?>