【调度系统】广东民航医疗快线调度系统源代码
wzp
2025-05-14 a023d5daed320eb4dbf6cfb8c28529d41cf5f9c3
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
<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<%Session.CodePage=65001%>  
<!--#include file="JsonPost_1000006.gds"-->
<!--#include virtual="/inc/function.gds"-->
<%
ServiceOrdID    = trim(request("ServiceOrdID"))
OAid            = trim(request("OAid"))
OrdSendOARemarks= trim(request("OrdSendOARemarks"))
isPhone            = trim(request("isPhone"))
 
If ServiceOrdID="" Or OAid="" Or OAid="0" Then
    Response.Write "2"
    Response.End
End If
 
Set rs = Server.CreateObject("ADODB.Recordset")
Set rsDt = Server.CreateObject("ADODB.Recordset")
sql="select ServiceOrdID,ServiceOrdClass,ServiceOrd_CC_Time,ServiceOrdNo,ServiceOrdCoName,ServiceOrdCoPhone,OutHospName=(select HospName from HospData where HospID=ServiceOrdPtOutHospID),InHospName=(select HospName from HospData where HospID=ServiceOrdPtInHospID),ServiceOrdOperationRemarks,ServiceOrdSource,is_RecommendUser=(select COUNT(RecommendUserID)  from UserData where RecommendUserID is Not null and RecommendUserID<>0 and UserID=ServiceOrdUserID) from ServiceOrder where ServiceOrdID="&ServiceOrdID
rs.open sql,objConn,1,1
If not rs.Eof Then
    ServiceOrdID    = rs("ServiceOrdID")
    ServiceOrdClass        = rs("ServiceOrdClass")
    ServiceOrdCoName= rs("ServiceOrdCoName")
    ServiceOrdCoPhone= rs("ServiceOrdCoPhone")
    OutHospName        = rs("OutHospName")
    InHospName        = rs("InHospName")
    ServiceOrdOperationRemarks=rs("ServiceOrdOperationRemarks")
    ServiceOrdSource= rs("ServiceOrdSource")
    is_RecommendUser= rs("is_RecommendUser")
    ServiceOrdNo            = ServiceOrdClass& year(rs("ServiceOrd_CC_Time"))&Right("0"&month(rs("ServiceOrd_CC_Time")),2)&Right("0"&day(rs("ServiceOrd_CC_Time")),2) & "-"&Right("00"&rs("ServiceOrdNo"),3)
Else
    Response.Write "3"
    Response.End
End If
rs.close()
 
isOA=""
touser=""
touserPhone=""
MIDs=""
sql="select OA_User_ID,OA_weixinUserID,OA_Name from OA_User where OA_execLevel>-1 and OA_weixinStatus=1 and OA_User_ID in ("&OAid&")"
rs.open sql,objConn,1,1
do while not rs.Eof
    ToOA_UserID        = rs("OA_User_ID")
    ToOA_weixinUserID    = rs("OA_weixinUserID")
    ToOA_Name            = rs("OA_Name")
    touser            = touser&ToOA_weixinUserID&"|"
    touserPhone        = touserPhone&ToOA_weixinUserID&"|"
    If isPhone="1" Then isPhoneTXT="并电话强通知"
    Call OA_Running("发送服务单提醒通知给OA"&isPhoneTXT&":"&ToOA_Name&" 服务单:"&ServiceOrdNo&" ID:"&ServiceOrdID)
    MessageHeadline="已发送通知给["&ToOA_Name&"]"
    MessageContents=OrdSendOARemarks
    sql="insert into ServiceOrd_Message (ServiceOrdIDDt,MessageHeadline,MessageContents,MessageOAid,MessageToOAid) values ("&ServiceOrdID&",'"&MessageHeadline&"','"&MessageContents&"',"&session("adminID")&","&ToOA_UserID&")"
    objConn.Execute sql
    sql="update ServiceOrder set FromHQ_is=1 where ServiceOrdID="&ServiceOrdID
    objConn.Execute sql
    objConn.Execute "exec OrdDataUP "&ServiceOrdID '更新服务单状态
    sql="select top 1 MID from ServiceOrd_Message where MessageToOAid="&ToOA_UserID&" order by MID desc"
    rsDt.open sql,objConn,1,1
    MIDs    = MIDs&rsDt(0)&"|"
    rsDt.close()
rs.movenext
loop
rs.close()
If touser="" Then
    Response.Write "4"
    Response.End
End If
 
'同时通知监管人员
sql="select OA_User_ID,OA_weixinUserID,OA_Name from OA_User where OA_execLevel>-1 and OA_weixinStatus=1 and OA_Power like '%070205%'"
rs.open sql,objConn,1,1
do while not rs.Eof
    ToOA_UserID        = rs("OA_User_ID")
    ToOA_weixinUserID    = rs("OA_weixinUserID")
    ToOA_Name            = rs("OA_Name")
    touser            = touser&ToOA_weixinUserID&"|"
rs.movenext
loop
rs.close()
 
touser=Mid(touser,1,Len(touser)-1)
touserPhone=Mid(touserPhone,1,Len(touserPhone)-1)
MIDs=Mid(MIDs,1,Len(MIDs)-1)
 
Randomize Timer
OrdAuthorize = Int(899999 * Rnd + 100000)
 
'微信OA信息下发接口
appUrl="https://qyapi.weixin.qq.com/cgi-bin/message/send?access_token="&access_token
 
'微信验证码下发
args1="{"
args1=args1&"""touser"": """&touser&""","    '成员ID列表(消息接收者,多个接收者用‘|’分隔,最多支持1000个)。特殊情况:指定为@all,则向关注该企业应用的全部成员发送 |liaojunliang
args1=args1&"""toparty"": """","        '部门ID列表,多个接收者用‘|’分隔,最多支持100个。当touser为@all时忽略本参数
args1=args1&"""totag"": """","            '标签ID列表,多个接收者用‘|’分隔。当touser为@all时忽略本参数
args1=args1&"""agentid"": 1000006,"            '企业应用的id,整型。可在应用的设置页面查看
 
args1=args1&"""msgtype"": ""textcard"","
args1=args1&"""textcard"": {"
    args1=args1&"""title"": ""有一个服务单需要你即时处理"","
    args1=args1&"""description"": """&now()&"\n\n"
        args1=args1&"单号:"&ServiceOrdNo&"\n"
        If ServiceOrdCoName<>"" Then args1=args1&"联系人:"&ServiceOrdCoName&"\n"
        If ServiceOrdCoPhone<>"" Then args1=args1&"联系电话:点击查看\n"
        If OutHospName<>"" Then args1=args1&"转出:"&OutHospName&"\n"
        If InHospName<>"" Then args1=args1&"转入:"&InHospName&"\n"
        If OrdSendOARemarks<>"" Then args1=args1&"\n"&OrdSendOARemarks&"\n"
        If ServiceOrdSource="2" And is_RecommendUser="1" Then args1=args1&"\n请注意,本单完成后会产生积分成本!\n"
    args1=args1&""","
        
    args1=args1&"""url"" : ""https://sys.966120.com.cn/m_ServiceOrder.gds?ServiceOrdID="&ServiceOrdID&""","
    args1=args1&"""btntxt"":""点击查看"""
args1=args1&"}"
 
args1=args1&"}"
'Response.Write args1 &"<br>"
HTMLCODE= PostBody(appUrl,args1)
'Response.Write HTMLCODE &"<br>"
Call OA_Running("weixin_message_send|OrderOA|"&touser&"|"&HTMLCODE)
If Mid(HTMLCODE,12,1)<>"0" Then
    Call OA_Running("weixin_message_send|1000006|"&touser&"|"&HTMLCODE)
    Response.Write "5"
Else
    '微信电话通知接口
    If isPhone="1" And touserPhone<>"" Then
        If InStr(touserPhone,"|")>0 Then touserPhone=Replace(touserPhone,"|",""",""")
        appUrl="https://qyapi.weixin.qq.com/cgi-bin/pstncc/call?access_token="&access_token
        args1="{"
            args1=args1&"""callee_userid"":["""&touserPhone&"""]"
        args1=args1&"}"
        HTMLCODE= PostBody(appUrl,args1)
        If Mid(HTMLCODE,12,1)<>"0" Then
            Call OA_Running("weixin_message_send|phone|"&touserPhone&"|"&HTMLCODE)
            Response.Write "6"
            Response.End
        Else
            Call OA_Running("weixin_message_send|phone|"&touserPhone&"|"&HTMLCODE)
            MIDsSP    = SPLIT(MIDs,"|")
            for i=0 to ubound(MIDsSP) 
                callid=""
                If InStr(HTMLCODE,"callid"":""")>0 Then
                    HTMLCODE=Mid(HTMLCODE,InStr(HTMLCODE,"callid"":""")+9)
                    callid=Mid(HTMLCODE,1,InStr(HTMLCODE,"""")-1)
                End If
                MessageID=MIDsSP(i)
                sql="update ServiceOrd_Message set Phone_is=1,Phone_callid='"&callid&"' where MID="&MessageID
                objConn.Execute sql
            Next
        End If
    End If
    Response.Write "1"
End If
%>