1550076451 %!s(int64=3) %!d(string=hace) años
padre
commit
de3af0ec5a

+ 1 - 0
RMYY_CallCenter_Api.Bll/RMYY_CallCenter_Api.Bll.csproj

@@ -113,6 +113,7 @@
113 113
     <Compile Include="T_Sys_WorkOffDays.cs" />
114 114
     <Compile Include="T_Wowo_wocodetypebll.cs" />
115 115
     <Compile Include="T_Wo_CommonBase.cs" />
116
+    <Compile Include="T_Wo_MedicalRecord.cs" />
116 117
     <Compile Include="T_Wo_StatusOpt.cs" />
117 118
     <Compile Include="T_Wo_VisitResult.cs" />
118 119
   </ItemGroup>

+ 159 - 0
RMYY_CallCenter_Api.Bll/T_Wo_MedicalRecord.cs

@@ -0,0 +1,159 @@
1
+
2
+using System;
3
+using System.Collections.Generic;
4
+using System.Data;
5
+using System.IO;
6
+using System.Linq;
7
+using System.Text;
8
+
9
+namespace RMYY_CallCenter_Api.Bll
10
+{
11
+    /// <summary>
12
+	/// T_Wo_MedicalRecord
13
+	/// </summary>
14
+	public partial class T_Wo_MedicalRecord
15
+    {
16
+        private readonly RMYY_CallCenter_Api.Dal.T_Wo_MedicalRecord dal = new RMYY_CallCenter_Api.Dal.T_Wo_MedicalRecord();
17
+        public T_Wo_MedicalRecord()
18
+        { }
19
+        #region  BasicMethod
20
+
21
+        /// <summary>
22
+        /// 得到最大ID
23
+        /// </summary>
24
+        public int GetMaxId()
25
+        {
26
+            return dal.GetMaxId();
27
+        }
28
+
29
+        /// <summary>
30
+        /// 是否存在该记录
31
+        /// </summary>
32
+        public bool Exists(int F_ID)
33
+        {
34
+            return dal.Exists(F_ID);
35
+        }
36
+
37
+        /// <summary>
38
+        /// 增加一条数据
39
+        /// </summary>
40
+        public int Add(RMYY_CallCenter_Api.Model.T_Wo_MedicalRecord model)
41
+        {
42
+            return dal.Add(model);
43
+        }
44
+
45
+        /// <summary>
46
+        /// 更新一条数据
47
+        /// </summary>
48
+        public bool Update(RMYY_CallCenter_Api.Model.T_Wo_MedicalRecord model)
49
+        {
50
+            return dal.Update(model);
51
+        }
52
+
53
+        /// <summary>
54
+        /// 删除一条数据
55
+        /// </summary>
56
+        public bool Delete(int F_ID)
57
+        {
58
+
59
+            return dal.Delete(F_ID);
60
+        }
61
+        /// <summary>
62
+        /// 删除一条数据
63
+        /// </summary>
64
+        public bool DeleteList(string F_IDlist)
65
+        {
66
+            return dal.DeleteList(F_IDlist);
67
+        }
68
+
69
+        /// <summary>
70
+        /// 得到一个对象实体
71
+        /// </summary>
72
+        public RMYY_CallCenter_Api.Model.T_Wo_MedicalRecord GetModel(int F_ID)
73
+        {
74
+
75
+            return dal.GetModel(F_ID);
76
+        }
77
+
78
+      
79
+
80
+        /// <summary>
81
+        /// 获得数据列表
82
+        /// </summary>
83
+        public DataSet GetList(string strWhere)
84
+        {
85
+            return dal.GetList(strWhere);
86
+        }
87
+        /// <summary>
88
+        /// 获得前几行数据
89
+        /// </summary>
90
+        public DataSet GetList(int Top, string strWhere, string filedOrder)
91
+        {
92
+            return dal.GetList(Top, strWhere, filedOrder);
93
+        }
94
+        /// <summary>
95
+        /// 获得数据列表
96
+        /// </summary>
97
+        public List<RMYY_CallCenter_Api.Model.T_Wo_MedicalRecord> GetModelList(string strWhere)
98
+        {
99
+            DataSet ds = dal.GetList(strWhere);
100
+            return DataTableToList(ds.Tables[0]);
101
+        }
102
+        /// <summary>
103
+        /// 获得数据列表
104
+        /// </summary>
105
+        public List<RMYY_CallCenter_Api.Model.T_Wo_MedicalRecord> DataTableToList(DataTable dt)
106
+        {
107
+            List<RMYY_CallCenter_Api.Model.T_Wo_MedicalRecord> modelList = new List<RMYY_CallCenter_Api.Model.T_Wo_MedicalRecord>();
108
+            int rowsCount = dt.Rows.Count;
109
+            if (rowsCount > 0)
110
+            {
111
+                RMYY_CallCenter_Api.Model.T_Wo_MedicalRecord model;
112
+                for (int n = 0; n < rowsCount; n++)
113
+                {
114
+                    model = dal.DataRowToModel(dt.Rows[n]);
115
+                    if (model != null)
116
+                    {
117
+                        modelList.Add(model);
118
+                    }
119
+                }
120
+            }
121
+            return modelList;
122
+        }
123
+
124
+        /// <summary>
125
+        /// 获得数据列表
126
+        /// </summary>
127
+        public DataSet GetAllList()
128
+        {
129
+            return GetList("");
130
+        }
131
+
132
+        /// <summary>
133
+        /// 分页获取数据列表
134
+        /// </summary>
135
+        public int GetRecordCount(string strWhere)
136
+        {
137
+            return dal.GetRecordCount(strWhere);
138
+        }
139
+        /// <summary>
140
+        /// 分页获取数据列表
141
+        /// </summary>
142
+        public DataSet GetListByPage(string strWhere, string orderby, int startIndex, int endIndex)
143
+        {
144
+            return dal.GetListByPage(strWhere, orderby, startIndex, endIndex);
145
+        }
146
+        /// <summary>
147
+        /// 分页获取数据列表
148
+        /// </summary>
149
+        //public DataSet GetList(int PageSize,int PageIndex,string strWhere)
150
+        //{
151
+        //return dal.GetList(PageSize,PageIndex,strWhere);
152
+        //}
153
+
154
+        #endregion  BasicMethod
155
+        #region  ExtensionMethod
156
+
157
+        #endregion  ExtensionMethod
158
+    }
159
+}

+ 1 - 0
RMYY_CallCenter_Api.Dal/RMYY_CallCenter_Api.Dal.csproj

@@ -111,6 +111,7 @@
111 111
     <Compile Include="T_Sys_WorkOffDays.cs" />
112 112
     <Compile Include="T_Wowo_wocodetypedal.cs" />
113 113
     <Compile Include="T_Wo_CommonBase.cs" />
114
+    <Compile Include="T_Wo_MedicalRecord.cs" />
114 115
     <Compile Include="T_Wo_StatusOpt.cs" />
115 116
     <Compile Include="T_Wo_VisitResult.cs" />
116 117
   </ItemGroup>

+ 455 - 0
RMYY_CallCenter_Api.Dal/T_Wo_MedicalRecord.cs

@@ -0,0 +1,455 @@
1
+
2
+using RMYY_CallCenter_Api.DB;
3
+using System;
4
+using System.Collections.Generic;
5
+using System.Data;
6
+using System.Data.SqlClient;
7
+using System.IO;
8
+using System.Linq;
9
+using System.Text;
10
+
11
+namespace RMYY_CallCenter_Api.Dal
12
+{
13
+    /// <summary>
14
+    /// 数据访问类:T_Wo_MedicalRecord
15
+    /// </summary>
16
+    public partial class T_Wo_MedicalRecord
17
+    {
18
+        public T_Wo_MedicalRecord()
19
+        { }
20
+        #region  BasicMethod
21
+
22
+        /// <summary>
23
+        /// 得到最大ID
24
+        /// </summary>
25
+        public int GetMaxId()
26
+        {
27
+            return DbHelperSQL.GetMaxID("F_ID", "T_Wo_MedicalRecord");
28
+        }
29
+
30
+        /// <summary>
31
+        /// 是否存在该记录
32
+        /// </summary>
33
+        public bool Exists(int F_ID)
34
+        {
35
+            StringBuilder strSql = new StringBuilder();
36
+            strSql.Append("select count(1) from T_Wo_MedicalRecord");
37
+            strSql.Append(" where F_ID=@F_ID");
38
+            SqlParameter[] parameters = {
39
+                    new SqlParameter("@F_ID", SqlDbType.Int,4)
40
+            };
41
+            parameters[0].Value = F_ID;
42
+
43
+            return DbHelperSQL.Exists(strSql.ToString(), parameters);
44
+        }
45
+
46
+
47
+        /// <summary>
48
+        /// 增加一条数据
49
+        /// </summary>
50
+        public int Add(RMYY_CallCenter_Api.Model.T_Wo_MedicalRecord model)
51
+        {
52
+            StringBuilder strSql = new StringBuilder();
53
+            strSql.Append("insert into T_Wo_MedicalRecord(");
54
+            strSql.Append("F_GlobalPID,F_CardID,F_PhoneNumber,F_FamilyName,F_DateTimeOfBirth,F_Sex,F_PatientClass,F_FacilityName,F_JZH,F_PointOfCareName,F_AttendingDoctor,F_AdmittingDoctor,F_AttendingDoctorCode,F_AdmittingDoctorCode,F_AdmitDateTime,F_DiagnosisCode,F_DiagnosisName,F_CreatTime)");
55
+            strSql.Append(" values (");
56
+            strSql.Append("@F_GlobalPID,@F_CardID,@F_PhoneNumber,@F_FamilyName,@F_DateTimeOfBirth,@F_Sex,@F_PatientClass,@F_FacilityName,@F_JZH,@F_PointOfCareName,@F_AttendingDoctor,@F_AdmittingDoctor,@F_AttendingDoctorCode,@F_AdmittingDoctorCode,@F_AdmitDateTime,@F_DiagnosisCode,@F_DiagnosisName,@F_CreatTime)");
57
+            strSql.Append(";select @@IDENTITY");
58
+            SqlParameter[] parameters = {
59
+                    new SqlParameter("@F_GlobalPID", SqlDbType.NVarChar,50),
60
+                    new SqlParameter("@F_CardID", SqlDbType.NVarChar,50),
61
+                    new SqlParameter("@F_PhoneNumber", SqlDbType.NVarChar,50),
62
+                    new SqlParameter("@F_FamilyName", SqlDbType.NVarChar,50),
63
+                    new SqlParameter("@F_DateTimeOfBirth", SqlDbType.NVarChar,50),
64
+                    new SqlParameter("@F_Sex", SqlDbType.NVarChar,50),
65
+                    new SqlParameter("@F_PatientClass", SqlDbType.NVarChar,50),
66
+                    new SqlParameter("@F_FacilityName", SqlDbType.NVarChar,50),
67
+                    new SqlParameter("@F_JZH", SqlDbType.NVarChar,50),
68
+                    new SqlParameter("@F_PointOfCareName", SqlDbType.NVarChar,50),
69
+                    new SqlParameter("@F_AttendingDoctor", SqlDbType.NVarChar,50),
70
+                    new SqlParameter("@F_AdmittingDoctor", SqlDbType.NVarChar,50),
71
+                    new SqlParameter("@F_AttendingDoctorCode", SqlDbType.NVarChar,50),
72
+                    new SqlParameter("@F_AdmittingDoctorCode", SqlDbType.NVarChar,50),
73
+                    new SqlParameter("@F_AdmitDateTime", SqlDbType.NVarChar,50),
74
+                    new SqlParameter("@F_DiagnosisCode", SqlDbType.NVarChar,-1),
75
+                    new SqlParameter("@F_DiagnosisName", SqlDbType.NVarChar,-1),
76
+                    new SqlParameter("@F_CreatTime", SqlDbType.DateTime)};
77
+            parameters[0].Value = model.F_GlobalPID;
78
+            parameters[1].Value = model.F_CardID;
79
+            parameters[2].Value = model.F_PhoneNumber;
80
+            parameters[3].Value = model.F_FamilyName;
81
+            parameters[4].Value = model.F_DateTimeOfBirth;
82
+            parameters[5].Value = model.F_Sex;
83
+            parameters[6].Value = model.F_PatientClass;
84
+            parameters[7].Value = model.F_FacilityName;
85
+            parameters[8].Value = model.F_JZH;
86
+            parameters[9].Value = model.F_PointOfCareName;
87
+            parameters[10].Value = model.F_AttendingDoctor;
88
+            parameters[11].Value = model.F_AdmittingDoctor;
89
+            parameters[12].Value = model.F_AttendingDoctorCode;
90
+            parameters[13].Value = model.F_AdmittingDoctorCode;
91
+            parameters[14].Value = model.F_AdmitDateTime;
92
+            parameters[15].Value = model.F_DiagnosisCode;
93
+            parameters[16].Value = model.F_DiagnosisName;
94
+            parameters[17].Value = model.F_CreatTime;
95
+
96
+            object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters);
97
+            if (obj == null)
98
+            {
99
+                return 0;
100
+            }
101
+            else
102
+            {
103
+                return Convert.ToInt32(obj);
104
+            }
105
+        }
106
+        /// <summary>
107
+        /// 更新一条数据
108
+        /// </summary>
109
+        public bool Update(RMYY_CallCenter_Api.Model.T_Wo_MedicalRecord model)
110
+        {
111
+            StringBuilder strSql = new StringBuilder();
112
+            strSql.Append("update T_Wo_MedicalRecord set ");
113
+            strSql.Append("F_GlobalPID=@F_GlobalPID,");
114
+            strSql.Append("F_CardID=@F_CardID,");
115
+            strSql.Append("F_PhoneNumber=@F_PhoneNumber,");
116
+            strSql.Append("F_FamilyName=@F_FamilyName,");
117
+            strSql.Append("F_DateTimeOfBirth=@F_DateTimeOfBirth,");
118
+            strSql.Append("F_Sex=@F_Sex,");
119
+            strSql.Append("F_PatientClass=@F_PatientClass,");
120
+            strSql.Append("F_FacilityName=@F_FacilityName,");
121
+            strSql.Append("F_JZH=@F_JZH,");
122
+            strSql.Append("F_PointOfCareName=@F_PointOfCareName,");
123
+            strSql.Append("F_AttendingDoctor=@F_AttendingDoctor,");
124
+            strSql.Append("F_AdmittingDoctor=@F_AdmittingDoctor,");
125
+            strSql.Append("F_AttendingDoctorCode=@F_AttendingDoctorCode,");
126
+            strSql.Append("F_AdmittingDoctorCode=@F_AdmittingDoctorCode,");
127
+            strSql.Append("F_AdmitDateTime=@F_AdmitDateTime,");
128
+            strSql.Append("F_DiagnosisCode=@F_DiagnosisCode,");
129
+            strSql.Append("F_DiagnosisName=@F_DiagnosisName,");
130
+            strSql.Append("F_CreatTime=@F_CreatTime");
131
+            strSql.Append(" where F_ID=@F_ID");
132
+            SqlParameter[] parameters = {
133
+                    new SqlParameter("@F_GlobalPID", SqlDbType.NVarChar,50),
134
+                    new SqlParameter("@F_CardID", SqlDbType.NVarChar,50),
135
+                    new SqlParameter("@F_PhoneNumber", SqlDbType.NVarChar,50),
136
+                    new SqlParameter("@F_FamilyName", SqlDbType.NVarChar,50),
137
+                    new SqlParameter("@F_DateTimeOfBirth", SqlDbType.NVarChar,50),
138
+                    new SqlParameter("@F_Sex", SqlDbType.NVarChar,50),
139
+                    new SqlParameter("@F_PatientClass", SqlDbType.NVarChar,50),
140
+                    new SqlParameter("@F_FacilityName", SqlDbType.NVarChar,50),
141
+                    new SqlParameter("@F_JZH", SqlDbType.NVarChar,50),
142
+                    new SqlParameter("@F_PointOfCareName", SqlDbType.NVarChar,50),
143
+                    new SqlParameter("@F_AttendingDoctor", SqlDbType.NVarChar,50),
144
+                    new SqlParameter("@F_AdmittingDoctor", SqlDbType.NVarChar,50),
145
+                    new SqlParameter("@F_AttendingDoctorCode", SqlDbType.NVarChar,50),
146
+                    new SqlParameter("@F_AdmittingDoctorCode", SqlDbType.NVarChar,50),
147
+                    new SqlParameter("@F_AdmitDateTime", SqlDbType.NVarChar,50),
148
+                    new SqlParameter("@F_DiagnosisCode", SqlDbType.NVarChar,-1),
149
+                    new SqlParameter("@F_DiagnosisName", SqlDbType.NVarChar,-1),
150
+                    new SqlParameter("@F_CreatTime", SqlDbType.DateTime),
151
+                    new SqlParameter("@F_ID", SqlDbType.Int,4)};
152
+            parameters[0].Value = model.F_GlobalPID;
153
+            parameters[1].Value = model.F_CardID;
154
+            parameters[2].Value = model.F_PhoneNumber;
155
+            parameters[3].Value = model.F_FamilyName;
156
+            parameters[4].Value = model.F_DateTimeOfBirth;
157
+            parameters[5].Value = model.F_Sex;
158
+            parameters[6].Value = model.F_PatientClass;
159
+            parameters[7].Value = model.F_FacilityName;
160
+            parameters[8].Value = model.F_JZH;
161
+            parameters[9].Value = model.F_PointOfCareName;
162
+            parameters[10].Value = model.F_AttendingDoctor;
163
+            parameters[11].Value = model.F_AdmittingDoctor;
164
+            parameters[12].Value = model.F_AttendingDoctorCode;
165
+            parameters[13].Value = model.F_AdmittingDoctorCode;
166
+            parameters[14].Value = model.F_AdmitDateTime;
167
+            parameters[15].Value = model.F_DiagnosisCode;
168
+            parameters[16].Value = model.F_DiagnosisName;
169
+            parameters[17].Value = model.F_CreatTime;
170
+            parameters[18].Value = model.F_ID;
171
+
172
+            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
173
+            if (rows > 0)
174
+            {
175
+                return true;
176
+            }
177
+            else
178
+            {
179
+                return false;
180
+            }
181
+        }
182
+
183
+        /// <summary>
184
+        /// 删除一条数据
185
+        /// </summary>
186
+        public bool Delete(int F_ID)
187
+        {
188
+
189
+            StringBuilder strSql = new StringBuilder();
190
+            strSql.Append("delete from T_Wo_MedicalRecord ");
191
+            strSql.Append(" where F_ID=@F_ID");
192
+            SqlParameter[] parameters = {
193
+                    new SqlParameter("@F_ID", SqlDbType.Int,4)
194
+            };
195
+            parameters[0].Value = F_ID;
196
+
197
+            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
198
+            if (rows > 0)
199
+            {
200
+                return true;
201
+            }
202
+            else
203
+            {
204
+                return false;
205
+            }
206
+        }
207
+        /// <summary>
208
+        /// 批量删除数据
209
+        /// </summary>
210
+        public bool DeleteList(string F_IDlist)
211
+        {
212
+            StringBuilder strSql = new StringBuilder();
213
+            strSql.Append("delete from T_Wo_MedicalRecord ");
214
+            strSql.Append(" where F_ID in (" + F_IDlist + ")  ");
215
+            int rows = DbHelperSQL.ExecuteSql(strSql.ToString());
216
+            if (rows > 0)
217
+            {
218
+                return true;
219
+            }
220
+            else
221
+            {
222
+                return false;
223
+            }
224
+        }
225
+
226
+
227
+        /// <summary>
228
+        /// 得到一个对象实体
229
+        /// </summary>
230
+        public RMYY_CallCenter_Api.Model.T_Wo_MedicalRecord GetModel(int F_ID)
231
+        {
232
+
233
+            StringBuilder strSql = new StringBuilder();
234
+            strSql.Append("select  top 1 F_ID,F_GlobalPID,F_CardID,F_PhoneNumber,F_FamilyName,F_DateTimeOfBirth,F_Sex,F_PatientClass,F_FacilityName,F_JZH,F_PointOfCareName,F_AttendingDoctor,F_AdmittingDoctor,F_AttendingDoctorCode,F_AdmittingDoctorCode,F_AdmitDateTime,F_DiagnosisCode,F_DiagnosisName,F_CreatTime from T_Wo_MedicalRecord ");
235
+            strSql.Append(" where F_ID=@F_ID");
236
+            SqlParameter[] parameters = {
237
+                    new SqlParameter("@F_ID", SqlDbType.Int,4)
238
+            };
239
+            parameters[0].Value = F_ID;
240
+
241
+            RMYY_CallCenter_Api.Model.T_Wo_MedicalRecord model = new RMYY_CallCenter_Api.Model.T_Wo_MedicalRecord();
242
+            DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);
243
+            if (ds.Tables[0].Rows.Count > 0)
244
+            {
245
+                return DataRowToModel(ds.Tables[0].Rows[0]);
246
+            }
247
+            else
248
+            {
249
+                return null;
250
+            }
251
+        }
252
+
253
+
254
+        /// <summary>
255
+        /// 得到一个对象实体
256
+        /// </summary>
257
+        public RMYY_CallCenter_Api.Model.T_Wo_MedicalRecord DataRowToModel(DataRow row)
258
+        {
259
+            RMYY_CallCenter_Api.Model.T_Wo_MedicalRecord model = new RMYY_CallCenter_Api.Model.T_Wo_MedicalRecord();
260
+            if (row != null)
261
+            {
262
+                if (row["F_ID"] != null && row["F_ID"].ToString() != "")
263
+                {
264
+                    model.F_ID = int.Parse(row["F_ID"].ToString());
265
+                }
266
+                if (row["F_GlobalPID"] != null)
267
+                {
268
+                    model.F_GlobalPID = row["F_GlobalPID"].ToString();
269
+                }
270
+                if (row["F_CardID"] != null)
271
+                {
272
+                    model.F_CardID = row["F_CardID"].ToString();
273
+                }
274
+                if (row["F_PhoneNumber"] != null)
275
+                {
276
+                    model.F_PhoneNumber = row["F_PhoneNumber"].ToString();
277
+                }
278
+                if (row["F_FamilyName"] != null)
279
+                {
280
+                    model.F_FamilyName = row["F_FamilyName"].ToString();
281
+                }
282
+                if (row["F_DateTimeOfBirth"] != null)
283
+                {
284
+                    model.F_DateTimeOfBirth = row["F_DateTimeOfBirth"].ToString();
285
+                }
286
+                if (row["F_Sex"] != null)
287
+                {
288
+                    model.F_Sex = row["F_Sex"].ToString();
289
+                }
290
+                if (row["F_PatientClass"] != null)
291
+                {
292
+                    model.F_PatientClass = row["F_PatientClass"].ToString();
293
+                }
294
+                if (row["F_FacilityName"] != null)
295
+                {
296
+                    model.F_FacilityName = row["F_FacilityName"].ToString();
297
+                }
298
+                if (row["F_JZH"] != null)
299
+                {
300
+                    model.F_JZH = row["F_JZH"].ToString();
301
+                }
302
+                if (row["F_PointOfCareName"] != null)
303
+                {
304
+                    model.F_PointOfCareName = row["F_PointOfCareName"].ToString();
305
+                }
306
+                if (row["F_AttendingDoctor"] != null)
307
+                {
308
+                    model.F_AttendingDoctor = row["F_AttendingDoctor"].ToString();
309
+                }
310
+                if (row["F_AdmittingDoctor"] != null)
311
+                {
312
+                    model.F_AdmittingDoctor = row["F_AdmittingDoctor"].ToString();
313
+                }
314
+                if (row["F_AttendingDoctorCode"] != null)
315
+                {
316
+                    model.F_AttendingDoctorCode = row["F_AttendingDoctorCode"].ToString();
317
+                }
318
+                if (row["F_AdmittingDoctorCode"] != null)
319
+                {
320
+                    model.F_AdmittingDoctorCode = row["F_AdmittingDoctorCode"].ToString();
321
+                }
322
+                if (row["F_AdmitDateTime"] != null)
323
+                {
324
+                    model.F_AdmitDateTime = row["F_AdmitDateTime"].ToString();
325
+                }
326
+                if (row["F_DiagnosisCode"] != null)
327
+                {
328
+                    model.F_DiagnosisCode = row["F_DiagnosisCode"].ToString();
329
+                }
330
+                if (row["F_DiagnosisName"] != null)
331
+                {
332
+                    model.F_DiagnosisName = row["F_DiagnosisName"].ToString();
333
+                }
334
+                if (row["F_CreatTime"] != null && row["F_CreatTime"].ToString() != "")
335
+                {
336
+                    model.F_CreatTime = DateTime.Parse(row["F_CreatTime"].ToString());
337
+                }
338
+            }
339
+            return model;
340
+        }
341
+
342
+        /// <summary>
343
+        /// 获得数据列表
344
+        /// </summary>
345
+        public DataSet GetList(string strWhere)
346
+        {
347
+            StringBuilder strSql = new StringBuilder();
348
+            strSql.Append("select F_ID,F_GlobalPID,F_CardID,F_PhoneNumber,F_FamilyName,F_DateTimeOfBirth,F_Sex,F_PatientClass,F_FacilityName,F_JZH,F_PointOfCareName,F_AttendingDoctor,F_AdmittingDoctor,F_AttendingDoctorCode,F_AdmittingDoctorCode,F_AdmitDateTime,F_DiagnosisCode,F_DiagnosisName,F_CreatTime ");
349
+            strSql.Append(" FROM T_Wo_MedicalRecord ");
350
+            if (strWhere.Trim() != "")
351
+            {
352
+                strSql.Append(" where " + strWhere);
353
+            }
354
+            return DbHelperSQL.Query(strSql.ToString());
355
+        }
356
+
357
+        /// <summary>
358
+        /// 获得前几行数据
359
+        /// </summary>
360
+        public DataSet GetList(int Top, string strWhere, string filedOrder)
361
+        {
362
+            StringBuilder strSql = new StringBuilder();
363
+            strSql.Append("select ");
364
+            if (Top > 0)
365
+            {
366
+                strSql.Append(" top " + Top.ToString());
367
+            }
368
+            strSql.Append(" F_ID,F_GlobalPID,F_CardID,F_PhoneNumber,F_FamilyName,F_DateTimeOfBirth,F_Sex,F_PatientClass,F_FacilityName,F_JZH,F_PointOfCareName,F_AttendingDoctor,F_AdmittingDoctor,F_AttendingDoctorCode,F_AdmittingDoctorCode,F_AdmitDateTime,F_DiagnosisCode,F_DiagnosisName,F_CreatTime ");
369
+            strSql.Append(" FROM T_Wo_MedicalRecord ");
370
+            if (strWhere.Trim() != "")
371
+            {
372
+                strSql.Append(" where " + strWhere);
373
+            }
374
+            strSql.Append(" order by " + filedOrder);
375
+            return DbHelperSQL.Query(strSql.ToString());
376
+        }
377
+
378
+        /// <summary>
379
+        /// 获取记录总数
380
+        /// </summary>
381
+        public int GetRecordCount(string strWhere)
382
+        {
383
+            StringBuilder strSql = new StringBuilder();
384
+            strSql.Append("select count(1) FROM T_Wo_MedicalRecord ");
385
+            if (strWhere.Trim() != "")
386
+            {
387
+                strSql.Append(" where " + strWhere);
388
+            }
389
+            object obj = DbHelperSQL.GetSingle(strSql.ToString());
390
+            if (obj == null)
391
+            {
392
+                return 0;
393
+            }
394
+            else
395
+            {
396
+                return Convert.ToInt32(obj);
397
+            }
398
+        }
399
+        /// <summary>
400
+        /// 分页获取数据列表
401
+        /// </summary>
402
+        public DataSet GetListByPage(string strWhere, string orderby, int startIndex, int endIndex)
403
+        {
404
+            StringBuilder strSql = new StringBuilder();
405
+            strSql.Append("SELECT * FROM ( ");
406
+            strSql.Append(" SELECT ROW_NUMBER() OVER (");
407
+            if (!string.IsNullOrEmpty(orderby.Trim()))
408
+            {
409
+                strSql.Append("order by T." + orderby);
410
+            }
411
+            else
412
+            {
413
+                strSql.Append("order by T.F_ID desc");
414
+            }
415
+            strSql.Append(")AS Row, T.*  from T_Wo_MedicalRecord T ");
416
+            if (!string.IsNullOrEmpty(strWhere.Trim()))
417
+            {
418
+                strSql.Append(" WHERE " + strWhere);
419
+            }
420
+            strSql.Append(" ) TT");
421
+            strSql.AppendFormat(" WHERE TT.Row between {0} and {1}", startIndex, endIndex);
422
+            return DbHelperSQL.Query(strSql.ToString());
423
+        }
424
+
425
+        /*
426
+		/// <summary>
427
+		/// 分页获取数据列表
428
+		/// </summary>
429
+		public DataSet GetList(int PageSize,int PageIndex,string strWhere)
430
+		{
431
+			SqlParameter[] parameters = {
432
+					new SqlParameter("@tblName", SqlDbType.VarChar, 255),
433
+					new SqlParameter("@fldName", SqlDbType.VarChar, 255),
434
+					new SqlParameter("@PageSize", SqlDbType.Int),
435
+					new SqlParameter("@PageIndex", SqlDbType.Int),
436
+					new SqlParameter("@IsReCount", SqlDbType.Bit),
437
+					new SqlParameter("@OrderType", SqlDbType.Bit),
438
+					new SqlParameter("@strWhere", SqlDbType.VarChar,1000),
439
+					};
440
+			parameters[0].Value = "T_Wo_MedicalRecord";
441
+			parameters[1].Value = "F_ID";
442
+			parameters[2].Value = PageSize;
443
+			parameters[3].Value = PageIndex;
444
+			parameters[4].Value = 0;
445
+			parameters[5].Value = 0;
446
+			parameters[6].Value = strWhere;	
447
+			return DbHelperSQL.RunProcedure("UP_GetRecordByPage",parameters,"ds");
448
+		}*/
449
+
450
+        #endregion  BasicMethod
451
+        #region  ExtensionMethod
452
+
453
+        #endregion  ExtensionMethod
454
+    }
455
+}

+ 1 - 0
RMYY_CallCenter_Api.Model/RMYY_CallCenter_Api.Model.csproj

@@ -116,6 +116,7 @@
116 116
     <Compile Include="T_Sys_WorkOffDays.cs" />
117 117
     <Compile Include="T_Wowo_wocodetype.cs" />
118 118
     <Compile Include="T_Wo_CommonBase.cs" />
119
+    <Compile Include="T_Wo_MedicalRecord.cs" />
119 120
     <Compile Include="T_Wo_StatusOpt.cs" />
120 121
     <Compile Include="T_Wo_VisitResult.cs" />
121 122
   </ItemGroup>

+ 193 - 0
RMYY_CallCenter_Api.Model/T_Wo_MedicalRecord.cs

@@ -0,0 +1,193 @@
1
+
2
+using System;
3
+using System.Collections.Generic;
4
+using System.IO;
5
+using System.Linq;
6
+using System.Text;
7
+
8
+namespace RMYY_CallCenter_Api.Model
9
+{
10
+    /// <summary>
11
+	/// T_Wo_MedicalRecord:实体类(属性说明自动提取数据库字段的描述信息)
12
+	/// </summary>
13
+	[Serializable]
14
+    public partial class T_Wo_MedicalRecord
15
+    {
16
+        public T_Wo_MedicalRecord()
17
+        { }
18
+        #region Model
19
+        private int _f_id;
20
+        private string _f_globalpid;
21
+        private string _f_cardid;
22
+        private string _f_phonenumber;
23
+        private string _f_familyname;
24
+        private string _f_datetimeofbirth;
25
+        private string _f_sex;
26
+        private string _f_patientclass;
27
+        private string _f_facilityname;
28
+        private string _f_jzh;
29
+        private string _f_pointofcarename;
30
+        private string _f_attendingdoctor;
31
+        private string _f_admittingdoctor;
32
+        private string _f_attendingdoctorcode;
33
+        private string _f_admittingdoctorcode;
34
+        private string _f_admitdatetime;
35
+        private string _f_diagnosiscode;
36
+        private string _f_diagnosisname;
37
+        private DateTime? _f_creattime;
38
+        /// <summary>
39
+        /// 
40
+        /// </summary>
41
+        public int F_ID
42
+        {
43
+            set { _f_id = value; }
44
+            get { return _f_id; }
45
+        }
46
+        /// <summary>
47
+        /// 患者主索引号
48
+        /// </summary>
49
+        public string F_GlobalPID
50
+        {
51
+            set { _f_globalpid = value; }
52
+            get { return _f_globalpid; }
53
+        }
54
+        /// <summary>
55
+        /// 身份证号
56
+        /// </summary>
57
+        public string F_CardID
58
+        {
59
+            set { _f_cardid = value; }
60
+            get { return _f_cardid; }
61
+        }
62
+        /// <summary>
63
+        /// 电话号码
64
+        /// </summary>
65
+        public string F_PhoneNumber
66
+        {
67
+            set { _f_phonenumber = value; }
68
+            get { return _f_phonenumber; }
69
+        }
70
+        /// <summary>
71
+        /// 患者姓名
72
+        /// </summary>
73
+        public string F_FamilyName
74
+        {
75
+            set { _f_familyname = value; }
76
+            get { return _f_familyname; }
77
+        }
78
+        /// <summary>
79
+        /// 出生日期
80
+        /// </summary>
81
+        public string F_DateTimeOfBirth
82
+        {
83
+            set { _f_datetimeofbirth = value; }
84
+            get { return _f_datetimeofbirth; }
85
+        }
86
+        /// <summary>
87
+        /// 性别
88
+        /// </summary>
89
+        public string F_Sex
90
+        {
91
+            set { _f_sex = value; }
92
+            get { return _f_sex; }
93
+        }
94
+        /// <summary>
95
+        ///  I-入院,O-门诊,E-急诊
96
+        /// </summary>
97
+        public string F_PatientClass
98
+        {
99
+            set { _f_patientclass = value; }
100
+            get { return _f_patientclass; }
101
+        }
102
+        /// <summary>
103
+        /// 院区
104
+        /// </summary>
105
+        public string F_FacilityName
106
+        {
107
+            set { _f_facilityname = value; }
108
+            get { return _f_facilityname; }
109
+        }
110
+        /// <summary>
111
+        /// 就诊号
112
+        /// </summary>
113
+        public string F_JZH
114
+        {
115
+            set { _f_jzh = value; }
116
+            get { return _f_jzh; }
117
+        }
118
+        /// <summary>
119
+        /// 科室名称
120
+        /// </summary>
121
+        public string F_PointOfCareName
122
+        {
123
+            set { _f_pointofcarename = value; }
124
+            get { return _f_pointofcarename; }
125
+        }
126
+        /// <summary>
127
+        /// 接诊医生姓名
128
+        /// </summary>
129
+        public string F_AttendingDoctor
130
+        {
131
+            set { _f_attendingdoctor = value; }
132
+            get { return _f_attendingdoctor; }
133
+        }
134
+        /// <summary>
135
+        /// 入院医生姓名
136
+        /// </summary>
137
+        public string F_AdmittingDoctor
138
+        {
139
+            set { _f_admittingdoctor = value; }
140
+            get { return _f_admittingdoctor; }
141
+        }
142
+        /// <summary>
143
+        /// 接诊医生工号
144
+        /// </summary>
145
+        public string F_AttendingDoctorCode
146
+        {
147
+            set { _f_attendingdoctorcode = value; }
148
+            get { return _f_attendingdoctorcode; }
149
+        }
150
+        /// <summary>
151
+        /// 入院医生工号
152
+        /// </summary>
153
+        public string F_AdmittingDoctorCode
154
+        {
155
+            set { _f_admittingdoctorcode = value; }
156
+            get { return _f_admittingdoctorcode; }
157
+        }
158
+        /// <summary>
159
+        /// 门诊就诊日期,入院日期
160
+        /// </summary>
161
+        public string F_AdmitDateTime
162
+        {
163
+            set { _f_admitdatetime = value; }
164
+            get { return _f_admitdatetime; }
165
+        }
166
+        /// <summary>
167
+        /// 诊断代码
168
+        /// </summary>
169
+        public string F_DiagnosisCode
170
+        {
171
+            set { _f_diagnosiscode = value; }
172
+            get { return _f_diagnosiscode; }
173
+        }
174
+        /// <summary>
175
+        /// 诊断名称
176
+        /// </summary>
177
+        public string F_DiagnosisName
178
+        {
179
+            set { _f_diagnosisname = value; }
180
+            get { return _f_diagnosisname; }
181
+        }
182
+        /// <summary>
183
+        /// 
184
+        /// </summary>
185
+        public DateTime? F_CreatTime
186
+        {
187
+            set { _f_creattime = value; }
188
+            get { return _f_creattime; }
189
+        }
190
+        #endregion Model
191
+
192
+    }
193
+}

+ 1 - 1
RMYY_CallCenter_Api.Utility/SqlChecker.cs

@@ -18,7 +18,7 @@ namespace RMYY_CallCenter_Api.Utility
18 18
 
19 19
         //Sql注入时,可能出现的sql关键字,可根据自己的实际情况进行初始化,每个关键字由'|'分隔开来
20 20
         //private const string StrKeyWord = @"select|insert|delete|from|count(|drop table|update|truncate|asc(|mid(|char(|xp_cmdshell|exec master|netlocalgroup administrators|:|net user|""|or|and";
21
-        private const string StrKeyWord = @"select|insert|delete|from|drop table|update|truncate|exec master|netlocalgroup administrators|:|net user|or|and|waitfor delay|waitfor|delay";
21
+        private const string StrKeyWord = @"select|insert|delete|from|drop table|update|truncate|exec master|netlocalgroup administrators|net user|or|and|waitfor delay|waitfor|delay";
22 22
         //Sql注入时,可能出现的特殊符号,,可根据自己的实际情况进行初始化,每个符号由'|'分隔开来
23 23
         private const string StrRegex = @"@|*";
24 24
         //private const string StrRegex = @"=|!|'";

+ 2 - 1
RMYY_CallCenter_Api/Controllers/HospitalUserController.cs

@@ -793,6 +793,7 @@ namespace RMYY_CallCenter_Api.Controllers
793 793
                         dModel.F_Sort = 0;
794 794
                         dModel.F_DeptCode = jo.DeptCode;
795 795
                         dModel.F_DeptName = jo.deptName;
796
+                        dModel.F_ParentId = 0;
796 797
                         if (jo .useFlag )
797 798
                         dModel.F_State = 1;
798 799
                         else
@@ -1325,7 +1326,7 @@ namespace RMYY_CallCenter_Api.Controllers
1325 1326
         public ActionResult Getbeonduty(string id, string datetime)
1326 1327
         {
1327 1328
 
1328
-            return Content(be);
1329
+           return Content(be);
1329 1330
 
1330 1331
 
1331 1332
             string url = xmlurl;

+ 11 - 9
RMYY_CallCenter_Api/Controllers/InternalMessagesController.cs

@@ -1,4 +1,6 @@
1
-using RMYY_CallCenter_Api.DB;
1
+using Newtonsoft.Json;
2
+using Newtonsoft.Json.Linq;
3
+using RMYY_CallCenter_Api.DB;
2 4
 using RMYY_CallCenter_Api.Model;
3 5
 using RMYY_CallCenter_Api.Utility;
4 6
 using System;
@@ -490,6 +492,7 @@ namespace RMYY_CallCenter_Api.Controllers
490 492
             return buttons;
491 493
         }
492 494
         private string FrontURL = ConfigHelper.GetValue("FrontURL");
495
+      
493 496
         /// <summary>
494 497
         /// 添加信息
495 498
         /// </summary>
@@ -542,15 +545,14 @@ namespace RMYY_CallCenter_Api.Controllers
542 545
                         if (!string.IsNullOrEmpty(usermoblie.F_Telephone))
543 546
                         {
544 547
                             var userid = web.DownloadString(FrontURL + $"Home/DingTalkGetUserIdByMobile?mobile={usermoblie.F_Telephone}");// DingTalkHelper.GetUserIdByMobile(usermoblie.F_Telephone);
545
-                            if (!string.IsNullOrEmpty(userid))
548
+                            JObject jo = (JObject)JsonConvert.DeserializeObject(userid);
549
+                            if (!string.IsNullOrEmpty(jo["message"].ToString ()))
546 550
                             {
547
-                                string task_id = web.DownloadString(FrontURL + $"Home/DingTalkSendMessageText?userid={userid}&content={content}"); //DingTalkHelper.SendMessageText(userid, "", content);
548
-                                if (!string.IsNullOrEmpty(task_id))
549
-                                {
550
-                                    model.SMS_Id = n;
551
-                                    model.F_Task_id = task_id;
552
-                                    bll.Update(model);
553
-                                }
551
+                                string task = web.DownloadString(FrontURL + $"Home/DingTalkSendMessageText?userid={userid}&content={content}"); //DingTalkHelper.SendMessageText(userid, "", content);
552
+                                JObject task_id = (JObject)JsonConvert.DeserializeObject(task);
553
+                                model.SMS_Id = n;
554
+                                model.F_Task_id = task_id["message"].ToString();
555
+                                bll.Update(model);
554 556
                             }
555 557
                         }
556 558
                     }

+ 464 - 14
RMYY_CallCenter_Api/Controllers/PatientController.cs

@@ -1,12 +1,15 @@
1 1
 using CHEER.PresentationLayer;
2 2
 using Microsoft.CodeDom.Providers.DotNetCompilerPlatform;
3 3
 using Newtonsoft.Json;
4
+using Newtonsoft.Json.Linq;
5
+using RMYY_CallCenter_Api.DB;
4 6
 using RMYY_CallCenter_Api.Utility;
5 7
 using System;
6 8
 using System.CodeDom;
7 9
 using System.CodeDom.Compiler;
8 10
 using System.Collections;
9 11
 using System.Collections.Generic;
12
+using System.Data;
10 13
 using System.IO;
11 14
 using System.Linq;
12 15
 using System.Net;
@@ -54,7 +57,7 @@ namespace RMYY_CallCenter_Api.Controllers
54 57
         public ActionResult GetModelList(string zsyh="",string hzxm="",string sfzh=""
55 58
             ,string zlkh="",string jzlx="",string jzh="",string lxdh="")
56 59
         {
57
-          return Content(MODELLIST);
60
+        return Content(MODELLIST);
58 61
             Dictionary<string, string> values = new Dictionary<string, string>();
59 62
             values.Add("zsyh", zsyh);//主索引号
60 63
             values.Add("hzxm", hzxm);//患者姓名
@@ -166,24 +169,416 @@ namespace RMYY_CallCenter_Api.Controllers
166 169
             "rdID\":\"0528\"},\"AdmitDateTime\":\"2019-11-14 09:29:45\",\"Diagnosis\":\"\"}]},\"patientPhones\":{\"PatientPhone\":{\"AddressTy" +
167 170
             "pe\":\"H\",\"EquipmentType\":\"PH\",\"CountryCode\":null,\"AreaCode\":null,\"PhoneNumber\":\"1383" +
168 171
             "8393405\",\"Extension\":null,\"Email\":null}}}}";
169
-        private string ic = "{\"QueryPatientVisitByIDResponse\":{\"Ack\":{\"ResultCode\":\"AA\"},\"VisitCount\":\"0\",\"GlobalPID\":\"00001" +
170
-            "15272\",\"PatientIDs\":{\"PatientID\":[{\"CardID\":\"0000092787\",\"DomainCode\":\"YNKH\",\"Facility\":\"41604745\"},{\"CardID\":\"105" +
171
-            "019092521499\",\"DomainCode\":\"YNKH\",\"Facility\":\"41604745\"},{\"CardID\":\"105019092521499\",\"DomainCode\":\"PATID_O\",\"Facilit" +
172
-            "y\":\"41604745\"},{\"CardID\":\"105019092521499\",\"DomainCode\":\"BLH_O\",\"Facility\":\"41604745\"},{\"CardID\":\"41138119830902202" +
173
-            "0\",\"DomainCode\":\"SN\",\"Facility\":\"41604745\"}]},\"SourcePatient\":{\"FamilyName\":\"阮静\",\"GivenName\":null,\"MiddleName\":nul" +
174
-            "l,\"DateTimeOfBirth\":\"1983-09-02\",\"Sex\":\"F\"},\"patientVisits\":\"\",\"patientPhones\":{\"PatientPhone\":{\"AddressTyp" +
175
-            "e\":\"H\",\"EquipmentType\":\"PH\",\"CountryCode\":null,\"AreaCode\":null,\"PhoneNumber\":\"13838393405\",\"Extension\":null,\"Email\":n" +
176
-            "ull}}}}";
172
+        private string ic = "{\"QueryPatientVisitByIDResponse\":{\"Ack\":{\"ResultCode\":\"AA\"},\"VisitCount\":\"1\",\"Glob" +
173
+            "alPID\":\"0000117036\",\"PatientIDs\":{\"PatientID\":[{\"CardID\":\"1012839\",\"DomainCode\":\"BLH_I\",\"Facili" +
174
+            "ty\":\"41604745\"},{\"CardID\":\"1012839\",\"DomainCode\":\"PATID_I\",\"Facility\":\"41604745\"},{\"CardID\":\"105" +
175
+            "019111710114\",\"DomainCode\":\"YNKH\",\"Facility\":\"41604745\"},{\"CardID\":\"105019111710114\",\"DomainC" +
176
+            "ode\":\"PATID_O\",\"Facility\":\"41604745\"},{\"CardID\":\"105019111710114\",\"DomainCode\":\"BLH_O\",\"Facili" +
177
+            "ty\":\"41604745\"},{\"CardID\":\"130203196206182417\",\"DomainCode\":\"SN\",\"Facility\":\"41604745\"}]},\"SourceP" +
178
+            "atient\":{\"FamilyName\":\"易安德\",\"GivenName\":null,\"MiddleName\":null,\"DateTimeOfBirth\":\"1962-06-18\",\"Se" +
179
+            "x\":\"M\"},\"patientVisits\":{\"patientVisit\":{\"VisitNumber\":{\"CardID\":\"113580531\",\"DomainCode\":\"JZH" +
180
+            "_E\",\"Facility\":\"41604745\",\"FacilityName\":\"郑州人民医院\"},\"PatientClass\":\"E\",\"AssignedPatientLocati" +
181
+            "on\":{\"PointOfCare\":\"11276\",\"Bed\":\"0\",\"PointOfCareName\":\"急诊科(东)\"},\"AttendingDoctor\":{\"Family" +
182
+            "Name\":\"刘文政\",\"CardID\":\"13189\"},\"AdmittingDoctor\":{\"FamilyName\":\"刘文政\",\"CardID\":\"13189\"},\"Adm" +
183
+            "itDateTime\":\"2019-11-17 00:00:00\",\"Diagnosis\":{\"Name\":\"腹痛待查\"}}},\"patientPhones\":{\"PatientPhon" +
184
+            "e\":{\"AddressType\":\"H\",\"EquipmentType\":\"PH\",\"CountryCode\":null,\"AreaCode\":null,\"PhoneNumb" +
185
+            "er\":\"-\",\"Extension\":null,\"Email\":null}}}}";
186
+        public string tc = "{\"QueryPatientVisitByIDResponse\":{\"Ack\":{\"ResultCode\":\"AA\"},\"VisitCount\":\"7\",\"Global" +
187
+            "PID\":\"0000118548\",\"PatientIDs\":{\"PatientID\":[{\"CardID\":\"105019092523123\",\"DomainCode\":\"YNKH\",\"Facility\":\"41" +
188
+            "604745\"},{\"CardID\":\"105019092523123\",\"DomainCode\":\"PATID_O\",\"Facility\":\"41604745\"},{\"CardID\":\"1050190925" +
189
+            "23123\",\"DomainCode\":\"BLH_O\",\"Facility\":\"41604745\"},{\"CardID\":\"0000090582\",\"DomainCode\":\"YNKH\",\"Facility\":\"4" +
190
+            "1604745\"},{\"CardID\":\"410122197402162021\",\"DomainCode\":\"SN\",\"Facility\":\"41604745\"}]},\"SourcePatient\":{\"Fami" +
191
+            "lyName\":\"道彦玲\",\"GivenName\":null,\"MiddleName\":null,\"DateTimeOfBirth\":\"1974-02-16\",\"Sex\":\"F\"},\"patientVis" +
192
+            "its\":{\"patientVisit\":[{\"VisitNumber\":{\"CardID\":\"119080743\",\"DomainCode\":\"JZH_O\",\"Facility\":\"41604745\",\"Fac" +
193
+            "ilityName\":\"郑州人民医院\"},\"PatientClass\":\"O\",\"AssignedPatientLocation\":{\"PointOfCare\":\"11218\",\"PointOfCareNa" +
194
+            "me\":\"医学美容中心整形门诊(东)\"},\"AttendingDoctor\":{\"FamilyName\":\"李正斌\",\"CardID\":\"0369\",\"DomainCode\":\"BL" +
195
+            "H_O\"},\"AdmittingDoctor\":\"\",\"AdmitDateTime\":\"2021-10-03 10:38:14\",\"Diagnosis\":\"\"},{\"VisitNumber\":{\"CardID\":\"1" +
196
+            "19079254\",\"DomainCode\":\"JZH_O\",\"Facility\":\"41604745\",\"FacilityName\":\"郑州人民医院\"},\"PatientClass\":\"O\",\"Assi" +
197
+            "gnedPatientLocation\":{\"PointOfCare\":\"11218\",\"PointOfCareName\":\"医学美容中心整形门诊(东)\"},\"AttendingDoctor\":{\"Fa" +
198
+            "milyName\":\"张会\",\"DomainCode\":\"BLH_O\"},\"AdmittingDoctor\":\"\",\"AdmitDateTime\":\"2021-10-03 00:00:00\",\"Diagno" +
199
+            "sis\":\"\"},{\"VisitNumber\":{\"CardID\":\"118939978\",\"DomainCode\":\"JZH_O\",\"Facility\":\"41604745\",\"FacilityName\":\"郑" +
200
+            "州人民医院\"},\"PatientClass\":\"O\",\"AssignedPatientLocation\":{\"PointOfCare\":\"11266\",\"PointOfCareName\":\"妇科门" +
201
+            "诊(东)\"},\"AttendingDoctor\":{\"FamilyName\":\"苏倩倩\",\"CardID\":\"3577\",\"DomainCode\":\"BLH_O\"},\"AdmittingDoct" +
202
+            "or\":\"\",\"AdmitDateTime\":\"2021-09-19 11:27:49\",\"Diagnosis\":{\"Code\":\"N92.603;N73.902;\",\"Name\":\"月经紊乱;盆腔炎;宫" +
203
+            "颈息肉\"}},{\"VisitNumber\":{\"CardID\":\"118939134\",\"DomainCode\":\"JZH_O\",\"Facility\":\"41604745\",\"FacilityN" +
204
+            "ame\":\"郑州人民医院\"},\"PatientClass\":\"O\",\"AssignedPatientLocation\":{\"PointOfCare\":\"11218\",\"PointOfCareName\":\"医" +
205
+            "学美容中心整形门诊(东)\"},\"AttendingDoctor\":{\"FamilyName\":\"李正斌\",\"CardID\":\"0369\",\"DomainCode\":\"BLH_O\"},\"Admit" +
206
+            "tingDoctor\":\"\",\"AdmitDateTime\":\"2021-09-19 09:32:02\",\"Diagnosis\":{\"Code\":\"R22.903\",\"Name\":\"皮肤肿物\"}},{\"Vis" +
207
+            "itNumber\":{\"CardID\":\"113582421\",\"DomainCode\":\"JZH_O\",\"Facility\":\"41604745\",\"FacilityName\":\"郑州人民医院\"},\"P" +
208
+            "atientClass\":\"O\",\"AssignedPatientLocation\":\"\",\"AttendingDoctor\":{\"FamilyName\":\"武永娟\",\"CardID\":\"2945\"},\"Adm" +
209
+            "ittingDoctor\":{\"FamilyName\":\"武永娟\",\"CardID\":\"2945\"},\"AdmitDateTime\":\"2019-11-20 15:00:08\",\"Diagnos" +
210
+            "is\":\"\"},{\"VisitNumber\":{\"CardID\":\"118938833\",\"DomainCode\":\"JZH_O\",\"Facility\":\"41604745\",\"Facil" +
211
+            "ityName\":\"郑州人民医院\"},\"PatientClass\":\"O\",\"AssignedPatientLocation\":{\"PointOfCare\":\"11258\",\"PointOfCareNa" +
212
+            "me\":\"普通外科门诊(东)\"},\"AttendingDoctor\":{\"FamilyName\":\"季节\",\"CardID\":\"12290\"},\"AdmittingDoctor\":\"\",\"Dia" +
213
+            "gnosis\":\"\"},{\"VisitNumber\":{\"CardID\":\"118938982\",\"DomainCode\":\"JZH_O\",\"Facility\":\"41604745\",\"FacilityNam" +
214
+            "e\":\"郑州人民医院\"},\"PatientClass\":\"O\",\"AssignedPatientLocation\":{\"PointOfCare\":\"11218\",\"PointOfCareName\":\"医学" +
215
+            "美容中心整形门诊(东)\"},\"AttendingDoctor\":{\"FamilyName\":\"李正斌\",\"CardID\":\"13549\"},\"AdmittingDoctor\":\"\",\"Diag" +
216
+            "nosis\":\"\"}]},\"patientPhones\":{\"PatientPhone\":{\"AddressType\":\"H\",\"EquipmentType\":\"PH\",\"CountryCode\":null,\"Are" +
217
+            "aCode\":null,\"PhoneNumber\":\"15838202349\",\"Extension\":null,\"Email\":null}}}}";
177 218
 
219
+       
178 220
 
221
+       public class QueryPatientVisitByIDResponse
222
+        {
223
+            //AA-成功,NF-不存在,AE-错误,AR-拒绝
224
+            public Ack Ack { set; get; }
225
+            //就诊记录总数
226
+            public string VisitCount { set; get; }
227
+            //患者主索引号
228
+            public string GlobalPID { set; get; }
229
+            public SourcePatient SourcePatient { set; get; }
230
+            public patientPhones patientPhones { set; get; }
231
+            public PatientIDs PatientIDs { set; get; }
232
+            public patientVisits patientVisits { set; get; }
233
+        }
234
+        public class PatientIDs
235
+        {
236
+            public List <PatientID> PatientID { set; get; }
237
+        }
238
+        public class PatientID
239
+        {
240
+            /// <summary>
241
+            /// 标识符
242
+            /// </summary>
243
+            public string CardID { set; get; }
244
+            /// <summary>
245
+            /// 标识符类型(SN身份证号)
246
+            /// </summary>
247
+            public string DomainCode { set; get; }
248
+            /// <summary>
249
+            /// 院区代码
250
+            /// </summary>
251
+            public string Facility { set; get; }
252
+        }
253
+        public class Ack
254
+        {
255
+            public string ResultCode { set; get; }
256
+        }
179 257
 
180
-        public  ActionResult GetRcord(string starttime, string endtime, string PatientClass, string GlobalPID, string Facility)
258
+        public class patientPhones
181 259
         {
260
+            public PatientPhone PatientPhone { set; get; }
261
+        }
262
+        public class patientlistPhones
263
+        {
264
+            public List <PatientPhone> PatientPhone { set; get; }
265
+        }
266
+        public class PatientPhone
267
+        {
268
+            /// <summary>
269
+            /// 电话号码
270
+            /// </summary>
271
+            public string PhoneNumber { set; get; }
272
+        }
273
+        public class patientVisits
274
+        {
275
+            public patientVisit  patientVisit { set; get;  }
276
+        }
277
+        public class patientlistVisits
278
+        {
279
+            public List<patientVisit> patientVisit { set; get; }
280
+        }
281
+        public class patientVisit
282
+        {
283
+            public VisitNumber VisitNumber { set; get; }
284
+            /// <summary>
285
+            /// I-入院,O-门诊,E-急诊
286
+            /// </summary>
287
+            public string PatientClass { set; get; }
288
+            /// <summary>
289
+            /// 医疗点
290
+            /// </summary>
291
+            public AssignedPatientLocation AssignedPatientLocation { set; get; }
292
+            /// <summary>
293
+            /// 接诊医生
294
+            /// </summary>
295
+            public AttendingDoctor AttendingDoctor { set; get; }
296
+            /// <summary>
297
+            /// 入院医生
298
+            /// </summary>
299
+            public AdmittingDoctor AdmittingDoctor { set; get; }
300
+            /// <summary>
301
+            /// 门诊就诊日期,入院日期
302
+            /// </summary>
303
+            public string AdmitDateTime { set; get; }
304
+            public Diagnosis Diagnosis { set; get; }
305
+        }
306
+        public class Diagnosis
307
+        {
308
+            /// <summary>
309
+            /// 诊断代码
310
+            /// </summary>
311
+            public string Code { set; get; }
312
+            /// <summary>
313
+            /// 诊断名称
314
+            /// </summary>
315
+            public string Name { set; get; }
316
+        }
317
+        public class AdmittingDoctor
318
+        {
319
+            /// <summary>
320
+            /// 入院医生姓名
321
+            /// </summary>
322
+            public string FamilyName { set; get; }
323
+            /// <summary>
324
+            /// 入院医生工号
325
+            /// </summary>
326
+            public string CardID { set; get; }
327
+        }
328
+        public class AttendingDoctor
329
+        {
330
+            /// <summary>
331
+            ///接诊医生姓名
332
+            /// </summary>
333
+            public string FamilyName { set; get; }
334
+            /// <summary>
335
+            /// 接诊医生工号
336
+            /// </summary>
337
+            public string CardID { set; get; }
338
+        }
339
+        public class AssignedPatientLocation
340
+        {
341
+            /// <summary>
342
+            /// 医疗点,科室代码
343
+            /// </summary>
344
+            public string  PointOfCare { set; get; }
345
+            /// <summary>
346
+            /// 科室名称
347
+            /// </summary>
348
+            public string PointOfCareName { set; get; }
349
+        }
350
+        public class VisitNumber
351
+        {
352
+            /// <summary>
353
+            /// 就诊号
354
+            /// </summary>
355
+            public string CardID { set; get; }
356
+            /// <summary>
357
+            /// 就诊号类型
358
+            /// </summary>
359
+            public string DomainCode { set; get; }
360
+            /// <summary>
361
+            /// 医疗机构代码
362
+            /// </summary>
363
+            public string Facility { set; get; }
364
+            /// <summary>
365
+            /// 医疗机构名称
366
+            /// </summary>
367
+            public string FacilityName { set; get; }
368
+        }
369
+        public class SourcePatient
370
+        {
371
+            public string FamilyName { set; get; }//姓名
372
+            public string DateTimeOfBirth { set; get; }//出生日期
373
+            public string Sex { set; get; }//性别F女性M男性U未知
374
+        }
182 375
 
183
-            if (PatientClass== "O")
184
-         return Content(rc );
376
+        public  ActionResult GetRcord(string starttime, string endtime, string PatientClass, string GlobalPID, string Facility)
377
+        {
378
+            string str = "";
379
+            if (PatientClass == "O")
380
+                str = rc;
381
+            else if (PatientClass == "I")
382
+                str = ic;
185 383
             else
186
-              return Content(ic);
384
+                str = tc;
385
+          
386
+            var jo = (JObject )JsonConvert.DeserializeObject(str ) ;
387
+            var QueryPatientVisitByIDResponse = (JObject)JsonConvert.DeserializeObject(jo["QueryPatientVisitByIDResponse"]
388
+                .ToString ());
389
+            var Ack= JsonConvert.DeserializeObject<Ack >(QueryPatientVisitByIDResponse["Ack"].ToString ());
390
+            if (Ack.ResultCode =="AA"&&int .Parse ( QueryPatientVisitByIDResponse["VisitCount"].ToString ())>0)
391
+            {
392
+                string F_GlobalPID = QueryPatientVisitByIDResponse["GlobalPID"].ToString ();//患者主索引号
393
+                string F_CardID = "";string F_PhoneNumber = "";
394
+                string F_FamilyName = "";string F_DateTimeOfBirth = "";string F_Sex = "";
395
+
396
+                if (QueryPatientVisitByIDResponse["patientVisits"].ToString() != "")
397
+                {
398
+                    if (QueryPatientVisitByIDResponse["PatientIDs"].ToString()  != "")
399
+                    {
400
+                        var PatientIDs= JsonConvert.DeserializeObject<PatientIDs>(QueryPatientVisitByIDResponse["PatientIDs"].ToString());
401
+                        if (PatientIDs.PatientID != null && PatientIDs.PatientID.Count > 0)
402
+                        {
403
+                            foreach (var it in PatientIDs.PatientID)
404
+                            {
405
+                                if (it.DomainCode == "SN")
406
+                                {
407
+                                    F_CardID = it.CardID;//患者身份证号
408
+                                }
409
+                            }
410
+                        }
411
+                        if (F_CardID != "")
412
+                        {
413
+                            if (QueryPatientVisitByIDResponse["patientPhones"].ToString() != "")
414
+                            {
415
+                                try
416
+                                {
417
+                                    var patientPhones = JsonConvert.DeserializeObject<patientPhones>(QueryPatientVisitByIDResponse["patientPhones"].ToString());
418
+                                    if (patientPhones.PatientPhone != null )
419
+                                    {
420
+                                        F_PhoneNumber = patientPhones.PatientPhone.PhoneNumber;//患者电话号码
421
+                                    }
422
+                                }catch
423
+                                {
424
+                                    var patientPhones = JsonConvert.DeserializeObject<patientlistPhones>(QueryPatientVisitByIDResponse["patientPhones"].ToString());
425
+                                    if (patientPhones.PatientPhone != null && patientPhones.PatientPhone.Count
426
+                                        > 0)
427
+                                    {
428
+                                        foreach (var it in patientPhones.PatientPhone)
429
+                                        {
430
+                                            if (!string.IsNullOrEmpty(it.PhoneNumber))
431
+                                            {
432
+                                                F_PhoneNumber = it.PhoneNumber;//患者电话号码
433
+                                                continue;
434
+                                            }
435
+                                        }
436
+                                    }
437
+                                }
438
+                               
439
+                            }
440
+                            if (QueryPatientVisitByIDResponse["SourcePatient"].ToString() != "")
441
+                            {
442
+                                var SourcePatient = JsonConvert.DeserializeObject<SourcePatient>(QueryPatientVisitByIDResponse["SourcePatient"].ToString());
443
+                                F_FamilyName = SourcePatient.FamilyName;//患者姓名
444
+                                F_DateTimeOfBirth = SourcePatient.DateTimeOfBirth;//患者出生日期
445
+                                                                                     //性别F女性M男性U未知
446
+                                if (SourcePatient.Sex == "M")//性别
447
+                                {
448
+                                    F_Sex = "男";
449
+                                }
450
+                                else if (SourcePatient.Sex == "F")
451
+                                {
452
+                                    F_Sex = "女";
453
+                                }
454
+                                else
455
+                                {
456
+                                    F_Sex = "未知";
457
+                                }
458
+
459
+                            }
460
+                          
461
+
462
+                            if (int.Parse(QueryPatientVisitByIDResponse["VisitCount"].ToString()) > 1)
463
+                            {
464
+                                var patientVisits = JsonConvert.DeserializeObject<patientlistVisits>(QueryPatientVisitByIDResponse["patientVisits"].ToString());
465
+                                foreach (var it in patientVisits.patientVisit)
466
+                                {
467
+                                    Model.T_Wo_MedicalRecord record = new Model.T_Wo_MedicalRecord();
468
+                                    var sql = $"select count(1) from T_Wo_MedicalRecord where F_JZH='{it.VisitNumber.CardID }'";
469
+                                    var  count=Int32 .Parse ( DbHelperSQL.GetSingle(sql).ToString());
470
+                                    if (count > 0)
471
+                                        continue;
472
+                                    else
473
+                                    {
474
+                                        record.F_GlobalPID = F_GlobalPID;//患者主索引号
475
+                                        record.F_CardID = F_CardID;//身份证号
476
+                                        record.F_PhoneNumber = F_PhoneNumber;//电话号码
477
+                                        record.F_FamilyName = F_FamilyName;//患者姓名
478
+                                        record.F_DateTimeOfBirth = F_DateTimeOfBirth;//出生日期
479
+                                        record.F_Sex = F_Sex;//性别
480
+                                        if (it.PatientClass == "I")//就诊类别
481
+                                            record.F_PatientClass = "入院";
482
+                                        else if (it.PatientClass == "O")
483
+                                            record.F_PatientClass = "门诊";
484
+                                        else if (it.PatientClass == "E")
485
+                                            record.F_PatientClass = "急诊";
486
+                                        else if (it.PatientClass == "P")
487
+                                            record.F_PatientClass = "体检";
488
+                                        record.F_FacilityName = it.VisitNumber.FacilityName;//院区
489
+                                        record.F_JZH = it.VisitNumber.CardID ;//就诊号
490
+                                        if (it.AssignedPatientLocation!=null && it.AssignedPatientLocation.ToString ()!="")
491
+                                        record.F_PointOfCareName = it.AssignedPatientLocation.PointOfCareName;//科室名称
492
+                                        if (it.AttendingDoctor  != null && it.AttendingDoctor.ToString() != "")
493
+                                        {
494
+                                            record.F_AttendingDoctor = it.AttendingDoctor.FamilyName;//接诊医生姓名
495
+                                            record.F_AttendingDoctorCode = it.AttendingDoctor.CardID ;//接诊医生工号
496
+                                        }
497
+                                        if (it.AdmittingDoctor   != null && it.AdmittingDoctor.ToString() != "")
498
+                                        {
499
+                                            record.F_AdmittingDoctor = it.AttendingDoctor.FamilyName;//接诊医生姓名
500
+                                            record.F_AdmittingDoctorCode = it.AttendingDoctor.CardID;//接诊医生工号
501
+                                        }
502
+                                        record.F_AdmitDateTime = it.AdmitDateTime;//门诊就诊日期,入院日期
503
+                                        if (it.Diagnosis  != null && it.Diagnosis.ToString() != "")
504
+                                        {
505
+                                            record.F_DiagnosisName = it.Diagnosis.Name;//诊断名称
506
+                                            record.F_DiagnosisCode = it.Diagnosis.Code;//诊断代码
507
+                                        }
508
+                                        new Bll.T_Wo_MedicalRecord().Add(record);
509
+                                    }
510
+                                    
511
+                                }
512
+                            }
513
+                            else
514
+                            {
515
+                                var patientVisits = JsonConvert.DeserializeObject<patientVisits>(QueryPatientVisitByIDResponse["patientVisits"].ToString());
516
+                                Model.T_Wo_MedicalRecord record = new Model.T_Wo_MedicalRecord();
517
+                               if  (patientVisits .patientVisit !=null )
518
+                                {
519
+                                    var it = patientVisits.patientVisit;
520
+                                          var sql = $"select count(1) from T_Wo_MedicalRecord where F_JZH='{it.VisitNumber.CardID }'";
521
+                                    var count = Int32.Parse(DbHelperSQL.GetSingle(sql).ToString());
522
+                                    if (count <=0)
523
+                                    {
524
+                                            record.F_GlobalPID = F_GlobalPID;//患者主索引号
525
+                                            record.F_CardID = F_CardID;//身份证号
526
+                                            record.F_PhoneNumber = F_PhoneNumber;//电话号码
527
+                                            record.F_FamilyName = F_FamilyName;//患者姓名
528
+                                            record.F_DateTimeOfBirth = F_DateTimeOfBirth;//出生日期
529
+                                            record.F_Sex = F_Sex;//性别
530
+                                            if (it.PatientClass == "I")//就诊类别
531
+                                                record.F_PatientClass = "入院";
532
+                                            else if (it.PatientClass == "O")
533
+                                                record.F_PatientClass = "门诊";
534
+                                            else if (it.PatientClass == "E")
535
+                                                record.F_PatientClass = "急诊";
536
+                                            else if (it.PatientClass == "P")
537
+                                                record.F_PatientClass = "体检";
538
+                                            record.F_FacilityName = it.VisitNumber.FacilityName;//院区
539
+                                            record.F_JZH = it.VisitNumber.CardID;//就诊号
540
+                                            if (it.AssignedPatientLocation != null && it.AssignedPatientLocation.ToString() != "")
541
+                                                record.F_PointOfCareName = it.AssignedPatientLocation.PointOfCareName;//科室名称
542
+                                            if (it.AttendingDoctor != null && it.AttendingDoctor.ToString() != "")
543
+                                            {
544
+                                                record.F_AttendingDoctor = it.AttendingDoctor.FamilyName;//接诊医生姓名
545
+                                                record.F_AttendingDoctorCode = it.AttendingDoctor.CardID;//接诊医生工号
546
+                                            }
547
+                                            if (it.AdmittingDoctor != null && it.AdmittingDoctor.ToString() != "")
548
+                                            {
549
+                                                record.F_AdmittingDoctor = it.AttendingDoctor.FamilyName;//接诊医生姓名
550
+                                                record.F_AdmittingDoctorCode = it.AttendingDoctor.CardID;//接诊医生工号
551
+                                            }
552
+                                            record.F_AdmitDateTime = it.AdmitDateTime;//门诊就诊日期,入院日期
553
+                                            if (it.Diagnosis != null && it.Diagnosis.ToString() != "")
554
+                                            {
555
+                                                record.F_DiagnosisName = it.Diagnosis.Name;//诊断名称
556
+                                                record.F_DiagnosisCode = it.Diagnosis.Code;//诊断代码
557
+                                            }
558
+                                            record.F_CreatTime = DateTime.Now;
559
+                                            new Bll.T_Wo_MedicalRecord().Add(record);
560
+                                        
561
+                                    }
562
+                                }
563
+                              
564
+
565
+                            }
566
+
567
+
568
+
569
+                        }
570
+                    }
571
+                }
572
+                
573
+            }
574
+            return Content(str);
575
+
576
+
577
+
578
+
579
+
580
+
581
+       
187 582
 
188 583
             HandlePatient service = new HandlePatient();
189 584
               string xmlText = LoadXmls(starttime, endtime, PatientClass, GlobalPID, Facility);
@@ -238,7 +633,62 @@ namespace RMYY_CallCenter_Api.Controllers
238 633
         }
239 634
 
240 635
     
241
-       
636
+       public ActionResult GetMedicalRecord()
637
+        {
638
+            DataTable dt = new DataTable();
639
+            string CardID = HttpUtility.UrlDecode(RequestString.GetQueryString("CardID"));
640
+            string strpageindex = RequestString.GetQueryString("page");
641
+            int pageindex = 1;
642
+            string strpagesize = RequestString.GetQueryString("pagesize");
643
+            int pagesize = 10;
644
+
645
+            string sql = string.Empty;
646
+          
647
+            if (CardID.Trim() != "")
648
+            {
649
+                sql += " and F_CardID = '" + CardID + "'";
650
+            }
651
+            else
652
+            {
653
+                var obj1 = new
654
+                {
655
+                    state = "success",
656
+                    message = "成功",
657
+                    rows = dt,
658
+                    total = 0
659
+                };
660
+                return Content(obj1.ToJson());
661
+            }
662
+            
663
+           
664
+            if (strpageindex.Trim() != "")
665
+            {
666
+                pageindex = Convert.ToInt32(strpageindex);
667
+            }
668
+            if (strpagesize.Trim() != "")
669
+            {
670
+                pagesize = Convert.ToInt32(strpagesize);
671
+            }
672
+            int recordCount = 0;
673
+            dt = Bll.PagerBll.GetListPager(
674
+                    "T_Wo_MedicalRecord",
675
+                    "F_ID",
676
+                    "*",
677
+                    sql,
678
+                    "ORDER BY F_ID desc",
679
+                    pagesize,
680
+                    pageindex,
681
+                    true,
682
+                    out recordCount);
683
+            var obj = new
684
+            {
685
+                state = "success",
686
+                message = "成功",
687
+                rows = dt,
688
+                total = recordCount
689
+            };
690
+            return Content(obj.ToJson());
691
+        }
242 692
         /// <summary>
243 693
         /// 实例化WebServices
244 694
         /// </summary>