【调度系统】广东民航医疗快线调度系统源代码
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
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
<%
'人员列表
sql="select vID,vtext from dictionary where vType=1 and vtitle='DispatchOrdEntourage' and vtext='司机' order by vOrder"
rs.open sql,objConn,1,1
i=0
EntourageIDs=""
do while not rs.Eof
    EntourageID    = rs("vID")
    EntourageName= rs("vtext")
    EntourageNames=EntourageNames&","&EntourageName
    EntourageIDs=EntourageIDs&","&EntourageID
    i=i+1
    rs.movenext
loop
rs.close()
EntourageNamePS    = SPLIT(EntourageNames,",")
EntourageIDPS    = SPLIT(EntourageIDs,",")
 
acc1=request("page")
if acc1=empty then acc1=clng(1)
QuantityInt = 20
acc2=0
acc3=0
 
'查看各分公司报表权限
if isDepartment("070109")=1 then
  OrdClassListSql=""
  If UnitNameID<>"" And UnitNameID<>"0" Then
    sql="select vOrder2 from dictionary where vtitle='UnitName' and vID="&UnitNameID
    rs.open sql,objConn,1,1
    If not rs.Eof Then
        UnitTypeID=rs(0)
        rs.close()
        sql="select vID,vtext,vOrder2 from dictionary where vID in ("&UnitTypeID&") and vtitle='OrderClass' order by vOrder"
        rs.open sql,objConn,1,1
        do while not rs.Eof
            OrderClassID    = rs("vOrder2")
            OrdClassListSql    = OrdClassListSql&","&OrderClassID
            rs.movenext
        Loop
        OrdClassListSql=Mid(OrdClassListSql,2)
        OrdClassListSql=Replace(OrdClassListSql,",","','")
    End If
    rs.close()
  Else
    sql="select vID,vtext,vOrder2 from dictionary where vType in (1,2) and vtitle='OrderClass' order by vOrder"
    rs.open sql,objConn,1,1
    do while not rs.Eof
        OrderClassID    = rs("vOrder2")
        OrdClassListSql    = OrdClassListSql&","&OrderClassID
        rs.movenext
    loop
    rs.close()
    OrdClassListSql=Mid(OrdClassListSql,2)
    OrdClassListSql=Replace(OrdClassListSql,",","','")
  End If
end If
 
'查看合作公司
If CoopUnitID<>"" And CoopUnitID<>"0" Then
  If Left(CoopUnitID,2)="0," Then CoopUnitID=Mid(CoopUnitID,3)
  CoopUnitSql=" And  (ServiceOrdUnitID in ("&CoopUnitID&")"
    sql="select HospID,HospIntroducerDate from HospData,IntroducerData where HospIntroducerID=IntroducerID and IntroducerUnitID in ("&CoopUnitID&") GROUP BY HospID,HospIntroducerDate order by HospIntroducerDate"
    rs.open sql,objConn,1,1
    If not rs.Eof Then
        UnitHospDateOld=""
        do while not rs.Eof
            If UnitHospDateOld<>rs(1) then
                UnitHospDate=UnitHospDate&"|"&rs(1)
                UnitHospID=UnitHospID&"|"
                UnitHospDateOld=rs(1)
            End If
            UnitHospID=UnitHospID&","&rs(0)
        rs.movenext
        Loop
        UnitHospDateSP    = SPLIT(UnitHospDate,"|")
        UnitHospIDSP    = SPLIT(UnitHospID,"|")
        for i=1 to ubound(UnitHospDateSP)
            CoopUnitSql=CoopUnitSql&" or (ServiceOrdPtOutHospID in ("&Mid(UnitHospIDSP(i),2)&") and ServiceOrd_CC_Time>='"&UnitHospDateSP(i)&"')"
        Next
    End If
    rs.close()
  CoopUnitSql=CoopUnitSql&")"
Else
  CoopUnitSql=""
End If
 
if searchTXT<>"" Then
  searchSql=" and (HospName like '%"&searchTXT&"%' or HospShort like '%"&searchTXT&"%' or HospAddress like '%"&searchTXT&"%') "
else
  searchSql=""
end If
If InStr(orderby," desc")>1 Then
    orderbydesc=""
    descTXT="↓"
Else
    orderbydesc=" desc"
    descTXT="↑"
End If
'sql="select * from (select vID,HospName,OutHosp=(select count(ServiceOrdPtOutHosp) from ServiceOrder where ServiceOrdPtOutHosp=vID and ServiceOrd_CC_Time "&SqlOrdDateType&"),InHosp=(select count(ServiceOrdPtInHosp) from ServiceOrder where ServiceOrdPtInHosp=vID and ServiceOrd_CC_Time "&SqlOrdDateType&") from HospData,dictionary where vtitle='HospName' and HospState=1 and vtext=HospName GROUP BY vID,HospName) as aa order by OutHosp+OutHosp desc"
If orderby="" Then
  orderby="OutHosp|InHosp desc,OutHospPrice|InHospPrice desc"
  descTXT="↓"
End If
'只显示个人分管医院
If isDepartment("070103")=0 Then
    OAsql=" and (HospOAID='"&session("adminID")&"' or HospOAID like '%,"&session("adminID")&",%')"
    CoopUnitSql=CoopUnitSql&" and FromHQ_is=1 "
End If
If OrdClassType="2" Then
    hrefURL="ServiceOrder_List.gds"
    sql="select * from (select HospID,HospName,OutHosp=(select count(ServiceOrdPtOutHospID) from ServiceOrder where ServiceOrdPtOutHospID=HospID and ServiceOrd_CC_Time "&SqlOrdDateType&CoopUnitSql&" and ServiceOrdClass in ('"&OrdClassListSql&"')),OutHospPrice=isnull((select SUM(ServiceOrdTraTxnPrice) from ServiceOrder where ServiceOrdPtOutHospID=HospID and ServiceOrd_CC_Time "&SqlOrdDateType&CoopUnitSql&" and ServiceOrdClass in ('"&OrdClassListSql&"')),0)+isnull((select SUM(StretcherMoney) from ServiceOrder,DispatchOrd  where ServiceOrdIDDt=ServiceOrdID and ServiceOrdPtOutHospID=HospID and ServiceOrd_CC_Time "&SqlOrdDateType&CoopUnitSql&" and ServiceOrdClass in ('"&OrdClassListSql&"') and ServiceOrdState=3),0),InHosp=(select count(ServiceOrdPtInHospID) from ServiceOrder where ServiceOrdPtInHospID=HospID and ServiceOrd_CC_Time "&SqlOrdDateType&CoopUnitSql&" and ServiceOrdClass in ('"&OrdClassListSql&"')),InHospPrice=isnull((select SUM(ServiceOrdTraTxnPrice) from ServiceOrder where ServiceOrdPtInHospID=HospID and ServiceOrd_CC_Time "&SqlOrdDateType&CoopUnitSql&" and ServiceOrdClass in ('"&OrdClassListSql&"')),0) from HospData where HospState=1"&searchSql&OAsql&" GROUP BY HospID,HospName) as aa where (OutHosp>0 or OutHospPrice>0 or InHosp>0 or InHospPrice>0) order by "&Replace(orderby,"|","+")
Else
    hrefURL="DispatchOrder_List.gds"
    sql="select * from (select HospID,HospName,OutHosp=(select count(ServiceOrdPtOutHospID) from ServiceOrder,DispatchOrd where ServiceOrdIDDt=ServiceOrdID and ServiceOrdPtOutHospID=HospID and DispatchOrd_NS_Time "&SqlOrdDateType&CoopUnitSql&" and ServiceOrdClass in ('"&OrdClassListSql&"') and ServiceOrdState=3 and DispatchOrdState<>10 and (DispatchOrdState<>9 or ServiceOrdTraTxnPrice+StretcherMoney>0)),OutHospPrice=isnull((select SUM(ServiceOrdTraTxnPrice+StretcherMoney) from ServiceOrder,DispatchOrd where ServiceOrdIDDt=ServiceOrdID and ServiceOrdPtOutHospID=HospID and DispatchOrd_NS_Time "&SqlOrdDateType&CoopUnitSql&" and ServiceOrdClass in ('"&OrdClassListSql&"') and ServiceOrdState=3 and DispatchOrdState<>10 and (DispatchOrdState<>9 or ServiceOrdTraTxnPrice+StretcherMoney>0)),0),InHosp=(select count(ServiceOrdPtInHospID) from ServiceOrder,DispatchOrd where ServiceOrdIDDt=ServiceOrdID and ServiceOrdPtInHospID=HospID and DispatchOrd_NS_Time "&SqlOrdDateType&CoopUnitSql&" and ServiceOrdClass in ('"&OrdClassListSql&"') and ServiceOrdState=3 and DispatchOrdState<>10 and (DispatchOrdState<>9 or ServiceOrdTraTxnPrice+StretcherMoney>0)),InHospPrice=isnull((select SUM(ServiceOrdTraTxnPrice+StretcherMoney) from ServiceOrder,DispatchOrd where ServiceOrdIDDt=ServiceOrdID and ServiceOrdPtInHospID=HospID and DispatchOrd_NS_Time "&SqlOrdDateType&CoopUnitSql&" and ServiceOrdClass in ('"&OrdClassListSql&"') and ServiceOrdState=3 and DispatchOrdState<>10 and (DispatchOrdState<>9 or ServiceOrdTraTxnPrice+StretcherMoney>0)),0) from HospData where HospState=1"&searchSql&OAsql&" GROUP BY HospID,HospName) as aa where (OutHosp>0 or OutHospPrice>0 or InHosp>0 or InHospPrice>0) order by "&Replace(orderby,"|","+")
    '从总部转出的+分部支援执行的 但是来源仅限于966120同微信小程序 转运类型系救护车(2024.2.23)
    'sql="select * from (select HospID,HospName,OutHosp=(select count(ServiceOrdPtOutHospID) from ServiceOrder,DispatchOrd where ServiceOrdIDDt=ServiceOrdID and ServiceOrdPtOutHospID=HospID and DispatchOrd_NS_Time "&SqlOrdDateType&CoopUnitSql&" and (ServiceOrdClass in ('"&OrdClassListSql&"') or FromHQ2_is<>'0') and ServiceOrdType=20 and ServiceOrdSource in ('2','5') and ServiceOrdState=3 and DispatchOrdState<>10 and (DispatchOrdState<>9 or ServiceOrdTraTxnPrice+StretcherMoney>0)),OutHospPrice=isnull((select SUM(ServiceOrdTraTxnPrice+StretcherMoney) from ServiceOrder,DispatchOrd where ServiceOrdIDDt=ServiceOrdID and ServiceOrdPtOutHospID=HospID and DispatchOrd_NS_Time "&SqlOrdDateType&CoopUnitSql&" and (ServiceOrdClass in ('"&OrdClassListSql&"') or FromHQ2_is<>'0') and ServiceOrdType=20 and ServiceOrdSource in ('2','5')  and ServiceOrdState=3 and DispatchOrdState<>10 and (DispatchOrdState<>9 or ServiceOrdTraTxnPrice+StretcherMoney>0)),0),InHosp=(select count(ServiceOrdPtInHospID) from ServiceOrder,DispatchOrd where ServiceOrdIDDt=ServiceOrdID and ServiceOrdPtInHospID=HospID and DispatchOrd_NS_Time "&SqlOrdDateType&CoopUnitSql&" and (ServiceOrdClass in ('"&OrdClassListSql&"') or FromHQ2_is<>'0') and ServiceOrdType=20 and ServiceOrdSource in ('2','5')  and ServiceOrdState=3 and DispatchOrdState<>10 and (DispatchOrdState<>9 or ServiceOrdTraTxnPrice+StretcherMoney>0)),InHospPrice=isnull((select SUM(ServiceOrdTraTxnPrice+StretcherMoney) from ServiceOrder,DispatchOrd where ServiceOrdIDDt=ServiceOrdID and ServiceOrdPtInHospID=HospID and DispatchOrd_NS_Time "&SqlOrdDateType&CoopUnitSql&" and (ServiceOrdClass in ('"&OrdClassListSql&"') or FromHQ2_is<>'0') and ServiceOrdType=20 and ServiceOrdSource in ('2','5')  and ServiceOrdState=3 and DispatchOrdState<>10 and (DispatchOrdState<>9 or ServiceOrdTraTxnPrice+StretcherMoney>0)),0) from HospData where HospState=1"&searchSql&OAsql&" GROUP BY HospID,HospName) as aa where (OutHosp>0 or OutHospPrice>0 or InHosp>0 or InHospPrice>0) order by "&Replace(orderby,"|","+")
 
End If
'If Right(sql,2)=", " Then sql=Left(sql,Len(sql)-2)
'Response.Write sql
rs.open sql,objConn,1,1
if not rs.eof then
rs.pagesize=QuantityInt
rs.absolutepage=acc1
acc2=rs.pagecount
acc3=rs.recordcount
else
SystemMessageType=2
SystemMessageTXT="数据库中相关无数据!"
end If
If SystemMessageType<>"2" then
    Dim FormArray()
    ArrayX=50
    If acc3<QuantityInt Or (is_CSV=1 And acc3>QuantityInt) Then
        ArrayY=acc3
    Else
        ArrayY=QuantityInt
    End If
    '表头
    FormFields="序号,,医院名称,,<a href=""?orderby=OutHosp"&orderbydesc&Replace(page_URL,"orderby=","orderbyOld=")&""">转出次数"&descTXT&"</a>,,<a href=""?orderby=OutHospPrice"&orderbydesc&Replace(page_URL,"orderby=","orderbyOld=")&""">转出成交价"&descTXT&"</a>,,<a href=""?orderby=InHosp"&orderbydesc&Replace(page_URL,"orderby=","orderbyOld=")&""">转入次数"&descTXT&"</a>,,<a href=""?orderby=InHospPrice"&orderbydesc&Replace(page_URL,"orderby=","orderbyOld=")&""">转入成交价"&descTXT&"</a>,,<a href=""?orderby=OutHospPrice|InHospPrice"&orderbydesc&Replace(page_URL,"orderby=","orderbyOld=")&""">成交总价"&descTXT&"</a>"
    FormFields=split(FormFields,",,")
    ArrayX=ubound(FormFields)+1
    REDIM FormArray(ArrayX,ArrayY+1)
    for i=0 to ubound(FormFields) 
        FormArray((i+1),0)=FormFields(i)
    next  
    Y=1
    do while not rs.Eof and Y<=ArrayY
      '读取数据
      HospID        = rs("HospID")
      HospName        = rs("HospName")
      OutHosp        = rs("OutHosp")
      OutHospPrice    = rs("OutHospPrice")
      InHosp        = rs("InHosp")
      InHospPrice    = rs("InHospPrice")
      If OutHosp=0 Then OutHospPrice=0
      If InHosp=0 Then InHospPrice=0
 
      Y=Y+1
      '读取数据--End
 
      '写入数组
      FormArray(1,Y)=(Y-1)+((acc1-1)*QuantityInt)
      FormArray(2,Y)="<a href="""&hrefURL&"?OrdDateType="&OrdDateType&"&OrdClassList=0&h_menu1_1=1&searchTXT=hosp|"&HospName&"&OrdDateStart="&OrdDateStart&"&OrdDateEnd="&OrdDateEnd&"&UnitNameID="&UnitNameID&"&CoopUnitID="&CoopUnitID&""" target=""_blank"">"&HospName&"</a>"
      FormArray(3,Y)="<a href="""&hrefURL&"?OrdDateType="&OrdDateType&"&OrdClassList=0&h_menu1_1=1&searchTXT=out|"&HospName&"&OrdDateStart="&OrdDateStart&"&OrdDateEnd="&OrdDateEnd&"&UnitNameID="&UnitNameID&"&CoopUnitID="&CoopUnitID&""" target=""_blank"">"&OutHosp&"</a>"
      FormArray(4,Y)="<a href="""&hrefURL&"?OrdDateType="&OrdDateType&"&OrdClassList=0&h_menu1_1=1&searchTXT=out|"&HospName&"&OrdDateStart="&OrdDateStart&"&OrdDateEnd="&OrdDateEnd&"&UnitNameID="&UnitNameID&"&CoopUnitID="&CoopUnitID&""" target=""_blank"">"&OutHospPrice&"</a>"
      FormArray(5,Y)="<a href="""&hrefURL&"?OrdDateType="&OrdDateType&"&OrdClassList=0&h_menu1_1=1&searchTXT=in|"&HospName&"&OrdDateStart="&OrdDateStart&"&OrdDateEnd="&OrdDateEnd&"&UnitNameID="&UnitNameID&"&CoopUnitID="&CoopUnitID&""" target=""_blank"">"&InHosp&"</a>"
      FormArray(6,Y)="<a href="""&hrefURL&"?OrdDateType="&OrdDateType&"&OrdClassList=0&h_menu1_1=1&searchTXT=in|"&HospName&"&OrdDateStart="&OrdDateStart&"&OrdDateEnd="&OrdDateEnd&"&UnitNameID="&UnitNameID&"&CoopUnitID="&CoopUnitID&""" target=""_blank"">"&InHospPrice&"</a>"
      FormArray(7,Y)="<a href="""&hrefURL&"?OrdDateType="&OrdDateType&"&OrdClassList=0&h_menu1_1=1&searchTXT=hosp|"&HospName&"&OrdDateStart="&OrdDateStart&"&OrdDateEnd="&OrdDateEnd&"&UnitNameID="&UnitNameID&"&CoopUnitID="&CoopUnitID&""" target=""_blank"">"&OutHospPrice+InHospPrice&"</a>"
      '写入数组--End
 
      rs.movenext
    Loop
    'REDIM FormArray(ArrayX,Y)
    rs.close()
End If
%>