Quellcode durchsuchen

咨询,对接

1550076451 vor 3 Jahren
Ursprung
Commit
f516a23bec

+ 2 - 2
RMYY_CallCenter_Api.Dal/T_Dis_WorkOrderItem.cs

@@ -320,7 +320,7 @@ namespace RMYY_CallCenter_Api.Dal
320 320
         public DataSet GetList(string strWhere)
321 321
         {
322 322
             StringBuilder strSql = new StringBuilder();
323
-            strSql.Append("select F_ID,F_WoID,F_WoType,F_WoState,F_ItemType,F_OptType,F_OptContent,F_NextUser,F_NextUserName,F_NexUserPhon,F_NextUserTalkie,F_NextDept,F_IsUsed,F_CreateUser,F_CreateTime ");
323
+            strSql.Append("select F_ID,F_EnterReason,F_AboutReason,F_AboutKey,F_WoID,F_WoType,F_WoState,F_ItemType,F_OptType,F_OptContent,F_NextUser,F_NextUserName,F_NexUserPhon,F_NextUserTalkie,F_NextDept,F_IsUsed,F_CreateUser,F_CreateTime ");
324 324
             strSql.Append(" FROM T_Dis_WorkOrderItem ");
325 325
             if (strWhere.Trim() != "")
326 326
             {
@@ -340,7 +340,7 @@ namespace RMYY_CallCenter_Api.Dal
340 340
             {
341 341
                 strSql.Append(" top " + Top.ToString());
342 342
             }
343
-            strSql.Append(" F_ID,F_WoID,F_WoType,F_WoState,F_ItemType,F_OptType,F_OptContent,F_NextUser,F_NextUserName,F_NexUserPhon,F_NextUserTalkie,F_NextDept,F_IsUsed,F_CreateUser,F_CreateTime ");
343
+            strSql.Append(" F_ID,F_WoID,F_WoType,F_EnterReason,F_AboutReason,F_AboutKey,F_WoState,F_ItemType,F_OptType,F_OptContent,F_NextUser,F_NextUserName,F_NexUserPhon,F_NextUserTalkie,F_NextDept,F_IsUsed,F_CreateUser,F_CreateTime ");
344 344
             strSql.Append(" FROM T_Dis_WorkOrderItem ");
345 345
             if (strWhere.Trim() != "")
346 346
             {

+ 7 - 4
RMYY_CallCenter_Api/Configs/system.config

@@ -75,12 +75,15 @@
75 75
      <!--排班信息-->
76 76
 <add key="xmlurl" value ="http://172.16.10.83:8093/Service1.asmx"/>
77 77
  <add key="SOAPAction" value ="http://tempuri.org/SearchWeekWorkPlan"/>
78
-  
79
-     <!--患者信息-->
80
-     <add key="PatientURL" value ="http://172.16.0.177:8081/winempi/webapi/"/>
81
-   <!-- <add key="PatientURL" value ="http://172.16.0.197:10045/winempi/webapi/"/>-->
82 78
 
79
+     <!--患者信息-->
80
+   <!--  <add key="PatientURL" value ="http://172.16.0.177:8081/winempi/webapi/"/>   -->
81
+    <add key="PatientURL" value ="http://172.16.0.197:10045/winempi/webapi/"/>
82
+        <!--   <add key="wsdlURL" value ="http://172.16.0.177:8081/winempi/HandlePatientHttpSoap11Endpoint?wsdl"/>-->
83
+    <add key="wsdlURL" value ="http://172.16.0.197:10045/winempi/HandlePatientHttpSoap11Endpoint?wsdl"/>
83 84
 
84 85
     <!--360-->
85 86
      <add key="PortalURL" value ="http://172.16.0.138:10016/"/>
87
+
88
+  
86 89
 </appSettings>

+ 181 - 12
RMYY_CallCenter_Api/Controllers/PatientController.cs

@@ -1,19 +1,25 @@
1
-using Newtonsoft.Json;
1
+using Microsoft.CodeDom.Providers.DotNetCompilerPlatform;
2
+using Newtonsoft.Json;
2 3
 using RMYY_CallCenter_Api.Utility;
3 4
 using System;
5
+using System.CodeDom;
6
+using System.CodeDom.Compiler;
4 7
 using System.Collections;
5 8
 using System.Collections.Generic;
6 9
 using System.IO;
7 10
 using System.Linq;
8 11
 using System.Net;
12
+using System.Reflection;
9 13
 using System.Text;
10 14
 using System.Web;
11 15
 using System.Web.Mvc;
16
+using System.Web.Services.Description;
12 17
 using System.Xml;
18
+using System.Xml.Linq;
13 19
 
14 20
 namespace RMYY_CallCenter_Api.Controllers
15 21
 {
16
-  
22
+    [AllowAnonymous]
17 23
     public class PatientController : BaseController
18 24
     {
19 25
       
@@ -22,6 +28,7 @@ namespace RMYY_CallCenter_Api.Controllers
22 28
 
23 29
 
24 30
         private string url = ConfigHelper.GetValue("PatientURL");
31
+        private string wsdlURL = ConfigHelper.GetValue("wsdlURL");
25 32
         public class Patient
26 33
         {
27 34
             public string zsyh { set; get; }//主索引号
@@ -41,7 +48,7 @@ namespace RMYY_CallCenter_Api.Controllers
41 48
             public string ncount { set; get; }//符合查询的数量
42 49
         }
43 50
 
44
-        [AllowAnonymous]
51
+       
45 52
         public ActionResult GetModelList(string zsyh="",string hzxm="",string sfzh=""
46 53
             ,string zlkh="",string jzlx="",string jzh="",string lxdh="")
47 54
         {
@@ -71,25 +78,180 @@ namespace RMYY_CallCenter_Api.Controllers
71 78
 
72 79
 
73 80
         }
81
+        string SOAPAction = ConfigHelper.GetValue("SOAPAction");
82
+        public ActionResult GetRcord(string starttime, string endtime, string PatientClass, string GlobalPID, string Facility)
83
+        {
84
+          //  string url = wsdlURL;
85
+            string arg = "action=QueryPatientVisitByID&inxml="+ LoadXmls(starttime, endtime, PatientClass, GlobalPID, Facility);
86
+
87
+            Dictionary<string, string> values = new Dictionary<string, string>();
88
+            values.Add("action", "QueryPatientVisitByID");//主索引号
89
+            values.Add("inxml", LoadXmls(starttime, endtime, PatientClass, GlobalPID, Facility));//患者姓名
90
+
91
+            var responseString = HttpMethods.HttpPost(url + "controller", values.ToJson (), "text/xml;charset=utf-8");
92
+            return Success("", responseString);
93
+
94
+
95
+            Hashtable header = new Hashtable();
96
+            header.Add("SOAPAction", SOAPAction);
97
+            string contenttype = "text/xml;charset=utf-8";
98
+            try
99
+            {
100
+                string filexml = Http(url, "post", contenttype, header, LoadXmls(starttime, endtime, PatientClass, GlobalPID, Facility));
101
+              //  LogHelper.Warn("responseString" + responseString);
102
+                // List<Patient> jo = JsonConvert.DeserializeObject<List<Patient>>(responseString);
103
+                //var obj = new
104
+                //{
105
+                //    rows = jo
106
+                //};
107
+                // return Content(obj.ToJson());
108
+                return Success("", filexml);
109
+            }
110
+            catch (Exception e)
111
+            {
112
+                return Error(e.Message);
113
+            }
114
+
115
+
116
+
117
+            //  string contenttype = "text/xml;charset=utf-8";
118
+            //  Hashtable header = new Hashtable();
119
+            //  header.Add("action", "QueryPatientVisitByID");
120
+            // header.Add("inxml", LoadXmls(starttime, endtime, PatientClass, GlobalPID));
74 121
 
122
+            //try
123
+            //{
124
+            //    // string filexml = Http(url, "post", contenttype, header, null);
125
+            //    var filexml = InvokeWebService(url, "controller", arg);
126
+            //    return Success("", filexml);
127
+            //  //  XmlDocument xmlDoc = new XmlDocument();
128
+            // //   xmlDoc.LoadXml(filexml);//Load加载XML文件,LoadXML加载XML字符串
129
+            //    //string value = xmlDoc.DocumentElement["soap:Body"]["SearchWeekWorkPlanResponse"]["SearchWeekWorkPlanResult"].InnerText;
130
+            //    //XDocument doc = XDocument.Parse(value);
131
+            //    //var xmlDocument = new XmlDocument();
132
+            //    //using (var xmlReader = doc.CreateReader())
133
+            //    //{
134
+            //    //    xmlDocument.Load(xmlReader);
135
+            //    //}
136
+            //    //var model = Newtonsoft.Json.JsonConvert.SerializeXmlNode(xmlDocument);
137
+            //  //  return Content(model);
138
+            //}
139
+            //catch (Exception e)
140
+            //{
141
+            //    return Error(e.ToString());
142
+            //}
143
+        }
75 144
 
76 145
         /// <summary>
77
-        /// 接口入参拼接
146
+        /// 接口入参拼接PatientClassI-入院,O-门诊,E-急诊
78 147
         /// </summary>
79 148
         /// <param name="data"></param>
80 149
         /// <returns></returns>
81
-        public string LoadXmls(string data)
150
+        public string LoadXmls(string starttime,string endtime,string  PatientClass,string GlobalPID,string Facility)
82 151
         {
83
-            XmlDocument doc1 = new XmlDocument();
152
+           
84 153
             StringBuilder stringBuilder = new StringBuilder();
85
-            stringBuilder.Append($"<![CDATA[<ConfigHeader><Facility>41604745</Facility><Application>41604745</Application></ConfigHeader>]]>");
86
-            stringBuilder.Append($"<![CDATA[<QueryParameter>");
154
+           // stringBuilder.Append(@"<soapenv:Envelope xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/' xmlns:tem='http://tempuri.org/'>
155
+           //  <soapenv:Header />
156
+           // <soapenv:Body >
157
+           //<tem:controller >
158
+           // <!--Optional:-->
159
+           //  <action>QueryPatientVisitByID</action> 
160
+           //  <tem:xml > ");
161
+            stringBuilder.Append($"<ConfigHeader><Facility>41604745</Facility><Application>41604745</Application></ConfigHeader>");
162
+            stringBuilder.Append($"<QueryParameter>");
87 163
             stringBuilder.Append($"<FromLimit></FromLimit><ToLimit></ToLimit>");
164
+            stringBuilder.Append($"<FromDateTime>{starttime}</FromDateTime><ToDateTime>{endtime}</ToDateTime>");
165
+            stringBuilder.Append($"<PatientClass>{PatientClass}</PatientClass>");//PatientClassI-入院,O-门诊,E-急诊
166
+            stringBuilder.Append(@"<VisitNumbers>");
167
+            stringBuilder.Append($"<CardID></CardID>");
168
+            stringBuilder.Append($"<DomainCode></DomainCode>");
169
+            stringBuilder.Append($"<Facility>{Facility}</Facility>");//院区代码
170
+            stringBuilder.Append(@"</VisitNumbers>");
171
+            stringBuilder.Append($"<GlobalPID>{GlobalPID}</GlobalPID>");//患者主索引号
172
+            //stringBuilder.Append(@"<PatientIDs\PatientID>");
173
+            //stringBuilder.Append($"<CardID></CardID>");
174
+            //stringBuilder.Append($"<DomainCode></DomainCode>");
175
+            //stringBuilder.Append($"<Facility>{Facility}</Facility>");//院区代码
176
+            //stringBuilder.Append(@"<PatientIDs\PatientID>");
177
+            stringBuilder.Append($"</QueryParameter>");
178
+         //   stringBuilder.Append(@"</tem:xml>
179
+         //   </tem:controller>
180
+         //  </soapenv:Body>
181
+         //</soapenv:Envelope> ");
182
+
183
+
88 184
 
89
-            stringBuilder.Append($"</QueryParameter>]]>");
90 185
 
91 186
             return stringBuilder.ToString();
92 187
         }
188
+         /// <summary>
189
+            /// 实例化WebServices
190
+            /// </summary>
191
+            /// <param name="url">WebServices地址</param>
192
+            /// <param name="methodname">调用的方法</param>
193
+            /// <param name="args">把webservices里需要的参数按顺序放到这个object[]里</param>
194
+            public static object InvokeWebService(string url, string methodname, object[] args)
195
+            {
196
+                //这里的namespace是需引用的webservices的命名空间,我没有改过,也可以使用。也可以加一个参数从外面传进来。
197
+                string @namespace = "client";
198
+
199
+                try
200
+                {
201
+                    //获取WSDL
202
+                    WebClient wc = new WebClient();
203
+                    Stream stream = wc.OpenRead(url);
204
+                    ServiceDescription sd = ServiceDescription.Read(stream);
205
+                    string classname = sd.Services[0].Name;
206
+                    ServiceDescriptionImporter sdi = new ServiceDescriptionImporter();
207
+                    sdi.AddServiceDescription(sd, "", "");
208
+                    CodeNamespace cn = new CodeNamespace(@namespace);
209
+
210
+                    //生成客户端代理类代码
211
+                    CodeCompileUnit ccu = new CodeCompileUnit();
212
+                    ccu.Namespaces.Add(cn);
213
+                    sdi.Import(cn, ccu);
214
+                    CSharpCodeProvider csc = new CSharpCodeProvider();
215
+                    //ICodeCompiler icc = csc.CreateCompiler();
216
+
217
+                    //设定编译参数
218
+                    CompilerParameters cplist = new CompilerParameters();
219
+                    cplist.GenerateExecutable = false; //动态编译后的程序集不生成可执行文件
220
+                    cplist.GenerateInMemory = true; //动态编译后的程序集只存在于内存中,不在硬盘的文件上
221
+                    cplist.ReferencedAssemblies.Add("System.dll");
222
+                    cplist.ReferencedAssemblies.Add("System.XML.dll");
223
+                    cplist.ReferencedAssemblies.Add("System.Web.Services.dll");
224
+                    cplist.ReferencedAssemblies.Add("System.Data.dll");
225
+
226
+                    //编译代理类
227
+                    CompilerResults cr = csc.CompileAssemblyFromDom(cplist, ccu);
228
+                    if (true == cr.Errors.HasErrors)
229
+                    {
230
+                        StringBuilder sb = new StringBuilder();
231
+                        foreach (CompilerError ce in cr.Errors)
232
+                        {
233
+                            sb.Append(ce.ToString());
234
+                            sb.Append(Environment.NewLine);
235
+                        }
236
+
237
+                        throw new Exception(sb.ToString());
238
+                    }
239
+
240
+                    //生成代理实例,并调用方法
241
+                    Assembly assembly = cr.CompiledAssembly;
242
+                    Type t = assembly.GetType(@namespace + "." + classname, true, true);
243
+                    object obj = Activator.CreateInstance(t);
244
+                    MethodInfo mi = t.GetMethod(methodname);
245
+
246
+                    //注:method.Invoke(o, null)返回的是一个Object,如果你服务端返回的是DataSet,这里也是用(DataSet)method.Invoke(o, null)转一下就行了,method.Invoke(0,null)这里的null可以传调用方法需要的参数,string[]形式的
247
+                    return mi.Invoke(obj, args);
248
+                }
249
+                catch (Exception e)
250
+                {
251
+                    return e ;
252
+                }
253
+            }
254
+
93 255
         /// <summary>
94 256
         /// 调用soap协议接口   webservice    wsdl   
95 257
         /// </summary>
@@ -118,7 +280,16 @@ namespace RMYY_CallCenter_Api.Controllers
118 280
                 RequestStream.Write(bytes, 0, bytes.Length);
119 281
                 RequestStream.Close();
120 282
             }
121
-            HttpWebResponse response = (HttpWebResponse)request.GetResponse();
283
+            HttpWebResponse response;
284
+            try
285
+            {
286
+                 response = (HttpWebResponse)request.GetResponse();
287
+            }
288
+            catch (WebException ex)
289
+            {
290
+                response = (HttpWebResponse)ex.Response;
291
+            }
292
+          
122 293
             Stream ResponseStream = response.GetResponseStream();
123 294
             StreamReader StreamReader = new StreamReader(ResponseStream, Encoding.GetEncoding("utf-8"));
124 295
             string re = StreamReader.ReadToEnd();
@@ -127,7 +298,5 @@ namespace RMYY_CallCenter_Api.Controllers
127 298
             return re;
128 299
         }
129 300
 
130
-
131
-
132 301
     }
133 302
 }

+ 2 - 2
RMYY_CallCenter_Api/Controllers/WorkOrder/Con_WorkOrderController.cs

@@ -1288,7 +1288,7 @@ namespace RMYY_CallCenter_Api.Controllers
1288 1288
         /// <param name="F_Files"></param>
1289 1289
         /// <param name="isover"></param>
1290 1290
         /// <returns></returns>
1291
-        public ActionResult DealWorkOrder(string WorkOrderCode, string cont, int isover=0,int isvisit=0,int communicate=0)
1291
+        public ActionResult DealWorkOrder(string WorkOrderCode, string cont, int isover=0,int isvisit=0,int communicate=-1)
1292 1292
         {
1293 1293
             if (User!=null)
1294 1294
             {
@@ -1327,7 +1327,7 @@ namespace RMYY_CallCenter_Api.Controllers
1327 1327
         /// <param name="F_Files"></param>
1328 1328
         /// <param name="isover"></param>
1329 1329
         /// <returns></returns>
1330
-        public bool DealWO(Model.T_Sys_UserAccount nowUser, Model.T_Con_WorkOrder model, string cont, string F_Files = "", int isover = 0, int isvisit = 0, int communicate = 0)
1330
+        public bool DealWO(Model.T_Sys_UserAccount nowUser, Model.T_Con_WorkOrder model, string cont, string F_Files = "", int isover = 0, int isvisit = 0, int communicate = -1)
1331 1331
         {
1332 1332
             #region 工单处理
1333 1333
             var opt = "处理";

+ 3 - 0
RMYY_CallCenter_Api/RMYY_CallCenter_Api.csproj

@@ -290,6 +290,9 @@
290 290
       <Name>RMYY_CallCenter_Api.Utility</Name>
291 291
     </ProjectReference>
292 292
   </ItemGroup>
293
+  <ItemGroup>
294
+    <WCFMetadata Include="Connected Services\" />
295
+  </ItemGroup>
293 296
   <PropertyGroup>
294 297
     <VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
295 298
     <VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>