【调度系统】广东民航医疗快线调度系统源代码
wzp
2024-12-05 8a09f655eace34e9c90bbfc711eedb7a69e4e068
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<%Session.CodePage=65001%>
<!--#include virtual="/inc/chkadmin.gds"-->
<!--#include virtual="/inc/function.gds"-->
<script language=javascript>
var EntourageListArray=new Array()
<%
EntourageSearchTXT=trim(Request("EntourageSearchTXT"))
OA_CompetencyID=trim(Request("OA_CompetencyID"))
DateDay=trim(Request("DateDay"))
OrdClass=trim(Request("OrdClass"))
HospID=trim(Request("HospID"))
acc1=trim(Request("page"))
Response.Write "11"
if acc1="" then acc1=1
'if admin_OrderClass<>"" And (OrdClass="" or  Not IsNumeric(OA_CompetencyID)) then
if admin_OrderClass<>"" then
    if OA_CompetencyID="ServiceOrdIntroducer" then
        ClassSql=" and ("
        UnitClassSql=" and ("
    else
        ClassSql=" and (OA_Power like '%,020114,%' or "
        UnitClassSql=" and (OA_Power like '%,020114,%' or "
    end if
    admin_OrderClassPS    = SPLIT(admin_OrderClass,",")
    for s = 0 to UBOUND(admin_OrderClassPS)
        if admin_OrderClassPS(s)<>"" then
            if InStr(ClassSql,"OA_OrderClass")<=0 then
                ClassSql=ClassSql&" OA_OrderClass like '%"&admin_OrderClassPS(s)&"%' "
                UnitClassSql=UnitClassSql&" IntroducerOrdClass like '%"&admin_OrderClassPS(s)&"%' "
            else
                ClassSql=ClassSql&" or OA_OrderClass like '%"&admin_OrderClassPS(s)&"%' "
                UnitClassSql=UnitClassSql&" or IntroducerOrdClass like '%"&admin_OrderClassPS(s)&"%' "
            end if
        end if
    Next
    ClassSql=ClassSql&")"
    UnitClassSql=UnitClassSql&")"
ElseIf OrdClass<>"" Then    '排序优化方案B 只显示当前地区人员(22.11.19)
    ClassSql=" and (OA_OrderClass like '%"&OrdClass&"%')"
    UnitClassSql=" and (IntroducerOrdClass like '%"&OrdClass&"%')"
end If
if OrdClass="" then OrdClass="SA"
acc2=1
i=0
 
Set rs = Server.CreateObject("ADODB.Recordset")
Set rsDt = Server.CreateObject("ADODB.Recordset")
if OA_CompetencyID="ServiceOrdIntroducer" then
    if len(EntourageSearchTXT)>0 and EntourageSearchTXT<>"Schedules" then SQLSearch=" and (IntroducerName like '%"&EntourageSearchTXT&"%' or IntroducerTEL='"&EntourageSearchTXT&"')"
    sql="select OA_User_ID=IntroducerID,OA_Name=IntroducerName,OA_mobile=IntroducerTEL,OA_weixinAvatar='',OA_Img='',OA_Img_64='',OA_UserRemark='',SchedulesTypeManeuver=0,SchedulesTypeAM=0,SchedulesTypePM=0,aa=10002,IntroducerUnitID from IntroducerData where IntroducerState=1"&UnitClassSql&SQLSearch
elseif len(EntourageSearchTXT)>0 and EntourageSearchTXT<>"Schedules" then
    sql="select OA_User_ID,OA_Name,OA_mobile,OA_weixinAvatar,OA_Img,OA_Img_64,OA_UserRemark,aa=10002,SchedulesTypeManeuver=0,SchedulesTypeAM=0,SchedulesTypePM=0 from OA_User where (OA_Name like '%"&EntourageSearchTXT&"%' or OA_mobile='"&EntourageSearchTXT&"') and OA_execLevel>=0 and OA_execLevel<=2"&ClassSql&" order by OA_User_ID"
elseif OA_CompetencyID="me" then
    sql="select OA_User_ID,OA_Name,OA_mobile,OA_weixinAvatar,OA_Img,OA_Img_64,OA_UserRemark,aa=10002,SchedulesTypeManeuver=0,SchedulesTypeAM=0,SchedulesTypePM=0 from OA_User where OA_User_ID="&session("adminID")&" and OA_execLevel>=0 and OA_execLevel<=2 order by OA_User_ID"
elseif OA_CompetencyID="OrdSendOA" then
    HospOAIDs=""
    if HospID<>"" then
        sql="select HospOAID from HospData where HospOAID<>'' and HospID in ("&HospID&")"
        rs.open Sql,objConn,1,1
        do while not rs.Eof
            HospOAID    = rs("HospOAID")
            if Left(HospOAID,1)="," then HospOAID=mid(HospOAID,2)
            if Right(HospOAID,1)="," then HospOAID=mid(HospOAID,1,len(HospOAID)-1)
            HospOAIDs=HospOAIDs&","&HospOAID
            rs.movenext
        loop
        rs.close()
    end if
    if HospOAIDs<>"" then
        HospOAIDs=mid(HospOAIDs,2)
        HospOASql=" or OA_User_ID in ("&HospOAIDs&") "
    elseif instr(admin_OrderClass,"BF")>0 or instr(admin_OrderClass,"SA")>0 then
        HospOASql=" or OA_Position like '%外联部领导%' "
    end if
    sql="select OA_User_ID,OA_Name=OA_Name+'('+vtext+')',OA_mobile,OA_weixinAvatar,OA_Img,OA_Img_64,OA_UserRemark,aa=10002,SchedulesTypeManeuver=0,SchedulesTypeAM=0,SchedulesTypePM=0 from OA_User,dictionary where vtitle='OA_Department' and vID=OA_DepartmentID and ((OA_Power like '%,020113,%' and OA_OrderClass like '%"&OrdClass&"%')"&HospOASql&") and OA_execLevel>=0 and OA_weixinStatus=1 order by OA_User_ID"
elseif OA_CompetencyID<0 then
    departmentID=Abs(OA_CompetencyID)
    'if departmentID="10" then departmentID="10,18"
    sql="select OA_User_ID,OA_Name,OA_mobile,OA_weixinAvatar,OA_Img,OA_Img_64,OA_UserRemark,aa=10002,SchedulesTypeManeuver=0,SchedulesTypeAM=0,SchedulesTypePM=0 from OA_User where OA_DepartmentID in ("&departmentID&") and OA_execLevel>=0 and OA_execLevel<=2"&ClassSql&" order by OA_User_ID"
else
    'sql="select OA_User_ID,OA_Name,OA_mobile,OA_weixinAvatar,OA_Img,OA_Img_64,OA_UserRemark from OA_User,OA_Competency where OA_User_ID=OA_CompetencyUserID and OA_CompetencyID="&OA_CompetencyID&" and OA_execLevel>=0 and OA_execLevel<=2"&ClassSql&" order by OA_User_ID"
    'if DateDay="" then DateDay=now()
    DateDay=now()
    TimeDay=CDate(DateDay)
    DateDay=CDate(year(DateDay)&"-"&month(DateDay)&"-"&day(DateDay))
    SameDay=DateDiff("n",CDate(year(TimeDay)&"-"&month(TimeDay)&"-"&day(TimeDay)&" 8:30:00"),TimeDay)
    '早夜班而17:30为界到明天8:30
    If SameDay>=0 And SameDay<=540 Then
      SchedulesShiftID=1
    ElseIf SameDay<0 Then
      SchedulesShiftID=2
      DateDay=DateAdd("d",-1,DateDay)
    Else
      SchedulesShiftID=2
    End If
    '休上午下午,13:00为界
    If SameDay>=0 And SameDay<=270 Then
      SqlAMPM=" and SchedulesTypeAM=0 "
    elseif SameDay>270 And SameDay<=540 Then
      SqlAMPM=" and SchedulesTypePM=0 "
    end if
    if EntourageSearchTXT="Schedules" then
      sql="select OA_User_ID,OA_Name,OA_mobile,OA_weixinAvatar,OA_Img,OA_Img_64,OA_UserRemark,aa=(isnull(SchedulesShiftTOP,10000)+1+isnull((select top 1 5000 from DispatchOrd_Entourage,DispatchOrd where DispatchOrdID=DispatchOrdIDDt and EntourageState<>4 and DispatchOrdState not in (10,14) and EntourageEnd_Time is null and DATEDIFF(d,EntourageState_Time,GETDATE())<3 and EntourageOAid=OA_User_ID),0)+isnull((select top 1 DateDiff(n,'"&DateDay&" 8:30:00',EntourageEnd_Time) from DispatchOrd_Entourage,DispatchOrd where DispatchOrdID=DispatchOrdIDDt and EntourageState<>4 and DispatchOrdState not in (10,14) and EntourageEnd_Time between '"&DateDay&" 8:30:00' and '"&DateAdd("d",1,DateDay)&" 8:29:59' and EntourageOAid=OA_User_ID),0)),SchedulesTypeManeuver=isnull(SchedulesTypeManeuver,0),SchedulesTypeAM,SchedulesTypePM from OA_User LEFT JOIN OA_Schedules on OAid=OA_User_ID and SchedulesDate='"&DateDay&"' and CompetencyID="&OA_CompetencyID&" and SchedulesShiftID="&SchedulesShiftID&" ,OA_Competency where OA_User_ID=OA_CompetencyUserID and OA_CompetencyID="&OA_CompetencyID&" and OA_execLevel in (0,1,2)"&ClassSql&" and SchedulesShiftTOP is not null order by SchedulesTypeManeuver desc,aa,OA_User_ID"
      '取消部分排序算法(22.11.19) 排序优化方案A
      sql="select OA_User_ID,OA_Name,OA_mobile,OA_weixinAvatar,OA_Img,OA_Img_64,OA_UserRemark,aa=(isnull(SchedulesShiftTOP,10000)+1),SchedulesTypeManeuver=isnull(SchedulesTypeManeuver,0),SchedulesTypeAM,SchedulesTypePM from OA_User LEFT JOIN OA_Schedules on OAid=OA_User_ID and SchedulesDate='"&DateDay&"' and CompetencyID="&OA_CompetencyID&" and SchedulesShiftID="&SchedulesShiftID&" ,OA_Competency where OA_User_ID=OA_CompetencyUserID and OA_CompetencyID="&OA_CompetencyID&" and OA_execLevel in (0,1,2)"&ClassSql&" and SchedulesShiftTOP is not null order by SchedulesTypeManeuver desc,aa,OA_User_ID"
    else
      sql="select OA_User_ID,OA_Name,OA_mobile,OA_weixinAvatar,OA_Img,OA_Img_64,OA_UserRemark,aa=(isnull(SchedulesShiftTOP,10000)+1+isnull((select top 1 5000 from DispatchOrd_Entourage,DispatchOrd where DispatchOrdID=DispatchOrdIDDt and EntourageState<>4 and DispatchOrdState not in (10,14) and EntourageEnd_Time is null and DATEDIFF(d,EntourageState_Time,GETDATE())<3 and EntourageOAid=OA_User_ID),0)+isnull((select top 1 DateDiff(n,'"&DateDay&" 8:30:00',EntourageEnd_Time),SchedulesTypeAM,SchedulesTypePM from DispatchOrd_Entourage,DispatchOrd where DispatchOrdID=DispatchOrdIDDt and EntourageState<>4 and DispatchOrdState not in (10,14) and EntourageEnd_Time between '"&DateDay&" 8:30:00' and '"&DateAdd("d",1,DateDay)&" 8:29:59' and EntourageOAid=OA_User_ID),0)),SchedulesTypeManeuver=isnull(SchedulesTypeManeuver,0),SchedulesTypeAM,SchedulesTypePM from OA_User LEFT JOIN OA_Schedules on OAid=OA_User_ID and SchedulesDate='"&DateDay&"' and CompetencyID="&OA_CompetencyID&" and SchedulesShiftID="&SchedulesShiftID&" ,OA_Competency where OA_User_ID=OA_CompetencyUserID and OA_CompetencyID="&OA_CompetencyID&" and OA_execLevel in (0,1,2)"&ClassSql&" order by SchedulesTypeManeuver desc,aa,OA_User_ID"
      '取消部分排序算法(22.11.19) 排序优化方案A
      sql="select OA_User_ID,OA_Name,OA_mobile,OA_weixinAvatar,OA_Img,OA_Img_64,OA_UserRemark,aa=(isnull(SchedulesShiftTOP,10000)+1),SchedulesTypeManeuver=isnull(SchedulesTypeManeuver,0),SchedulesTypeAM,SchedulesTypePM from OA_User LEFT JOIN OA_Schedules on OAid=OA_User_ID and SchedulesDate='"&DateDay&"' and CompetencyID="&OA_CompetencyID&" and SchedulesShiftID="&SchedulesShiftID&" ,OA_Competency where OA_User_ID=OA_CompetencyUserID and OA_CompetencyID="&OA_CompetencyID&" and OA_execLevel in (0,1,2)"&ClassSql&" order by SchedulesTypeManeuver desc,aa,OA_User_ID"
    end If
'Response.Write sql
 
end if
 
    rs.open Sql,objConn,1,1
    if not rs.eof then
        if EntourageSearchTXT="Schedules" then
            j=100
        else
            j=10
        end if
        rs.pagesize=j
        rs.absolutepage=acc1
        acc2=rs.pagecount
    end if
    do while not rs.Eof and i<j
        OA_UserID        = rs("OA_User_ID")
        OA_Name            = rs("OA_Name")
        OA_mobile        = rs("OA_mobile")
        OA_weixinAvatar    = rs("OA_weixinAvatar")
        OA_Img            = rs("OA_Img")
        OA_Img            = rs("OA_Img_64")
        OA_UserRemark    = rs("OA_UserRemark")
        SchedulesTypeAM    = rs("SchedulesTypeAM")
        SchedulesTypePM    = rs("SchedulesTypePM")
        If OA_Img="" Or isnull(OA_Img) Then
            If OA_weixinAvatar<>"" Then
                'OA_weixinAvatar=OA_weixinAvatar&"64"
            Else
                OA_weixinAvatar="/resources/images/icon_avatar_default.png"
            End if
        Else
            OA_weixinAvatar    = OAImgURL&OA_Img
        End If
        
        OA_weixinAvatar=replace(OA_weixinAvatar,"\","\\")
 
        'if rs("aa")<10001 then OA_Name=OA_Name&" "&rs("aa")
        if rs("SchedulesTypeManeuver")="1" then 
            if OA_CompetencyID="2" then
                OA_Name=OA_Name&"[加班]"
            else
                OA_Name=OA_Name&"[机动]"
            end if
 
        elseif rs("SchedulesTypeManeuver")="-1" then 
            OA_Name=OA_Name&"[不加班]"
        end If
        if rs("SchedulesTypeAM")="1" then 
            OA_Name=OA_Name&"[休上午]"
        end If
        if rs("SchedulesTypePM")="1" then 
            OA_Name=OA_Name&"[休下午]"
        end if
        if rs("aa")<10001 then
          sql="select top 1 DispatchOrdIDDt from DispatchOrd_Entourage,DispatchOrd where DispatchOrdID=DispatchOrdIDDt and EntourageState<>4 and DispatchOrdState not in (8,9,10,14) and EntourageEnd_Time is null and DATEDIFF(d,EntourageState_Time,GETDATE())<3 and EntourageOAid="&OA_UserID
          rsDt.open Sql,objConn,1,1
          if not rsDt.Eof then
            OA_Name="<img src=/resources/images/2016090802.png>"&OA_Name
          elseif rs("SchedulesTypeManeuver")<>"-1" then
            OA_Name="<img src=/resources/images/2016090803.png>"&OA_Name
          end if
          rsDt.close()
        end if
        if OA_UserRemark<>"" then OA_Name=OA_Name&"("&OA_UserRemark&")"
        if instr(OA_Name,"--")>0 and instr(OA_Name,")")>0 then OA_Name=mid(OA_Name,1,instr(OA_Name,"--")-1)& mid(OA_Name,instr(OA_Name,")"))
        %>
        EntourageListArray[<%=i%>]=new Array("<%=OA_UserID%>","<%=OA_Name%>","<%=OA_mobile%>","<%=OA_weixinAvatar%>")
        <%i=i+1
        rs.movenext
    loop
    rs.close()
    if OA_CompetencyID="ServiceOrdIntroducer" then
        OA_CompetencyName="ServiceOrdIntroducer"
    elseif OA_CompetencyID="OrdSendOA" then
        OA_CompetencyName="OrdSendOA"
    elseif OA_CompetencyID="me" then
        OA_CompetencyName="me"
    else
        OA_CompetencyName=OACompetency(OA_CompetencyID,"CompetencyName")
    end if
%>
parent.JS_EntourageList(EntourageListArray,<%=acc1%>,<%=acc2%>,'<%=EntourageSearchTXT%>','<%=OA_CompetencyID%>','<%=OA_CompetencyName%>');
</script> 
<%Response.End%>