陈少旭 3 weeks ago
parent
commit
19c045dcff
2 changed files with 83 additions and 43 deletions
  1. 50 29
      controllers/ah/ahyb_controller.go
  2. 33 14
      controllers/sg/his_api_controller.go

+ 50 - 29
controllers/ah/ahyb_controller.go View File

64
 	beego.Router("/ahyb/2406", &AHybController{}, "post:Get2406")
64
 	beego.Router("/ahyb/2406", &AHybController{}, "post:Get2406")
65
 	beego.Router("/ahyb/readcardcharge", &AHybController{}, "get:Readcardcharge")
65
 	beego.Router("/ahyb/readcardcharge", &AHybController{}, "get:Readcardcharge")
66
 
66
 
67
-
68
-
67
+	beego.Router("/ahyb/3501", &AHybController{}, "post:Get3501")
68
+	beego.Router("/ahyb/3502", &AHybController{}, "post:Get3502")
69
+	beego.Router("/ahyb/3503", &AHybController{}, "post:Get3503")
70
+	beego.Router("/ahyb/3504", &AHybController{}, "post:Get3504")
71
+	beego.Router("/ahyb/3505", &AHybController{}, "post:Get3505")
72
+	beego.Router("/ahyb/3506", &AHybController{}, "post:Get3506")
73
+	beego.Router("/ahyb/3507", &AHybController{}, "post:Get3507")
74
+	beego.Router("/ahyb/3508", &AHybController{}, "post:Get3508")
75
+	beego.Router("/ahyb/3509", &AHybController{}, "post:Get3509")
76
+	beego.Router("/ahyb/3510", &AHybController{}, "post:Get3510")
77
+	beego.Router("/ahyb/3511", &AHybController{}, "post:Get3511")
78
+	beego.Router("/ahyb/3512", &AHybController{}, "post:Get3512")
79
+	beego.Router("/ahyb/3513", &AHybController{}, "post:Get3513")
69
 
80
 
70
 	beego.Router("/ahyb/2406", &AHybController{}, "post:Get2406")
81
 	beego.Router("/ahyb/2406", &AHybController{}, "post:Get2406")
71
 	beego.Router("/ahyb/2406", &AHybController{}, "post:Get2406")
82
 	beego.Router("/ahyb/2406", &AHybController{}, "post:Get2406")
72
 
83
 
73
-
74
 }
84
 }
75
-func (c *JSybController) Get3501() {
85
+func (c *AHybController) Get3501() {
76
 	body, _ := ioutil.ReadAll(c.Ctx.Request.Body)
86
 	body, _ := ioutil.ReadAll(c.Ctx.Request.Body)
77
 	var respJSON map[string]interface{}
87
 	var respJSON map[string]interface{}
78
 	if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
88
 	if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
104
 	})
114
 	})
105
 
115
 
106
 }
116
 }
107
-func (c *JSybController) Get3502() {
117
+func (c *AHybController) Get3502() {
108
 	body, _ := ioutil.ReadAll(c.Ctx.Request.Body)
118
 	body, _ := ioutil.ReadAll(c.Ctx.Request.Body)
109
 	var respJSON map[string]interface{}
119
 	var respJSON map[string]interface{}
110
 	if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
120
 	if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
136
 	})
146
 	})
137
 
147
 
138
 }
148
 }
139
-func (c *JSybController) Get3503() {
149
+func (c *AHybController) Get3503() {
140
 	body, _ := ioutil.ReadAll(c.Ctx.Request.Body)
150
 	body, _ := ioutil.ReadAll(c.Ctx.Request.Body)
141
 	var respJSON map[string]interface{}
151
 	var respJSON map[string]interface{}
142
 	if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
152
 	if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
169
 	})
179
 	})
170
 
180
 
171
 }
181
 }
172
-func (c *JSybController) Get3504() {
182
+func (c *AHybController) Get3504() {
173
 	body, _ := ioutil.ReadAll(c.Ctx.Request.Body)
183
 	body, _ := ioutil.ReadAll(c.Ctx.Request.Body)
174
 	var respJSON map[string]interface{}
184
 	var respJSON map[string]interface{}
175
 	if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
185
 	if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
201
 	})
211
 	})
202
 
212
 
203
 }
213
 }
204
-func (c *JSybController) Get3505() {
214
+func (c *AHybController) Get3505() {
205
 	body, _ := ioutil.ReadAll(c.Ctx.Request.Body)
215
 	body, _ := ioutil.ReadAll(c.Ctx.Request.Body)
206
 	var respJSON map[string]interface{}
216
 	var respJSON map[string]interface{}
207
 	if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
217
 	if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
215
 		utils.ErrorLog("解析失败:%v", err)
225
 		utils.ErrorLog("解析失败:%v", err)
216
 		return
226
 		return
217
 	}
227
 	}
218
-
219
-	result, request_log := service.Jsyb3505(struct3505)
220
-	saveJsLog(result, request_log, "3505", "销售", struct3505.OrgName)
221
-	var dat2 map[string]interface{}
222
-	if err := json.Unmarshal([]byte(request_log), &dat2); err == nil {
223
-	} else {
228
+	result, inputLog := service.AHyb3505(struct3505, struct3505.SecretKey, struct3505.RequestUrl)
229
+	saveJsLog(result, inputLog, "3505", "销售上传", struct3505.OrgName)
230
+	var response Response
231
+	if err := json.Unmarshal([]byte(result), &response); err != nil {
232
+		fmt.Println("Error decoding JSON:", err)
233
+		return
224
 	}
234
 	}
225
-	var dat map[string]interface{}
226
-	if err := json.Unmarshal([]byte(result), &dat); err == nil {
235
+
236
+	if response.Code == 200 {
237
+		var dat2 map[string]interface{}
238
+		if err := json.Unmarshal([]byte(inputLog), &dat2); err == nil {
239
+		} else {
240
+
241
+		}
242
+		c.ServeSuccessJSON(map[string]interface{}{
243
+			"pre":    response.Body,
244
+			"log":    dat2,
245
+			"status": "1",
246
+			"msg":    "",
247
+		})
248
+
227
 	} else {
249
 	} else {
250
+		c.ServeSuccessJSON(map[string]interface{}{
251
+			"status": "0",
252
+			"msg":    response.Message,
253
+		})
228
 
254
 
229
 	}
255
 	}
230
-	c.ServeSuccessJSON(map[string]interface{}{
231
-		"pre":         dat,
232
-		"request_log": dat2,
233
-	})
234
-
235
 }
256
 }
236
-func (c *JSybController) Get3506() {
257
+func (c *AHybController) Get3506() {
237
 	body, _ := ioutil.ReadAll(c.Ctx.Request.Body)
258
 	body, _ := ioutil.ReadAll(c.Ctx.Request.Body)
238
 	var respJSON map[string]interface{}
259
 	var respJSON map[string]interface{}
239
 	if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
260
 	if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
265
 	})
286
 	})
266
 
287
 
267
 }
288
 }
268
-func (c *JSybController) Get3507() {
289
+func (c *AHybController) Get3507() {
269
 	body, _ := ioutil.ReadAll(c.Ctx.Request.Body)
290
 	body, _ := ioutil.ReadAll(c.Ctx.Request.Body)
270
 	var respJSON map[string]interface{}
291
 	var respJSON map[string]interface{}
271
 	if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
292
 	if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
297
 	})
318
 	})
298
 
319
 
299
 }
320
 }
300
-func (c *JSybController) Get3508() {
321
+func (c *AHybController) Get3508() {
301
 	body, _ := ioutil.ReadAll(c.Ctx.Request.Body)
322
 	body, _ := ioutil.ReadAll(c.Ctx.Request.Body)
302
 	var respJSON map[string]interface{}
323
 	var respJSON map[string]interface{}
303
 	if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
324
 	if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
329
 	})
350
 	})
330
 
351
 
331
 }
352
 }
332
-func (c *JSybController) Get3509() {
353
+func (c *AHybController) Get3509() {
333
 	body, _ := ioutil.ReadAll(c.Ctx.Request.Body)
354
 	body, _ := ioutil.ReadAll(c.Ctx.Request.Body)
334
 	var respJSON map[string]interface{}
355
 	var respJSON map[string]interface{}
335
 	if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
356
 	if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
361
 	})
382
 	})
362
 
383
 
363
 }
384
 }
364
-func (c *JSybController) Get3510() {
385
+func (c *AHybController) Get3510() {
365
 	body, _ := ioutil.ReadAll(c.Ctx.Request.Body)
386
 	body, _ := ioutil.ReadAll(c.Ctx.Request.Body)
366
 	var respJSON map[string]interface{}
387
 	var respJSON map[string]interface{}
367
 	if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
388
 	if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
393
 	})
414
 	})
394
 
415
 
395
 }
416
 }
396
-func (c *JSybController) Get3511() {
417
+func (c *AHybController) Get3511() {
397
 	body, _ := ioutil.ReadAll(c.Ctx.Request.Body)
418
 	body, _ := ioutil.ReadAll(c.Ctx.Request.Body)
398
 	var respJSON map[string]interface{}
419
 	var respJSON map[string]interface{}
399
 	if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
420
 	if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
425
 	})
446
 	})
426
 
447
 
427
 }
448
 }
428
-func (c *JSybController) Get3512() {
449
+func (c *AHybController) Get3512() {
429
 	body, _ := ioutil.ReadAll(c.Ctx.Request.Body)
450
 	body, _ := ioutil.ReadAll(c.Ctx.Request.Body)
430
 	var respJSON map[string]interface{}
451
 	var respJSON map[string]interface{}
431
 	if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
452
 	if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
457
 	})
478
 	})
458
 
479
 
459
 }
480
 }
460
-func (c *JSybController) Get3513() {
481
+func (c *AHybController) Get3513() {
461
 	body, _ := ioutil.ReadAll(c.Ctx.Request.Body)
482
 	body, _ := ioutil.ReadAll(c.Ctx.Request.Body)
462
 	var respJSON map[string]interface{}
483
 	var respJSON map[string]interface{}
463
 	if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
484
 	if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {

+ 33 - 14
controllers/sg/his_api_controller.go View File

34
 	"syscall"
34
 	"syscall"
35
 	"time"
35
 	"time"
36
 	"unsafe"
36
 	"unsafe"
37
-	"github.com/go-ole/go-ole"
38
-
39
 )
37
 )
40
 
38
 
41
 type HisApiController struct {
39
 type HisApiController struct {
4847
 						res.WarnMsg = res3507for10188.WarnMsg
4845
 						res.WarnMsg = res3507for10188.WarnMsg
4848
 						infocode, _ := strconv.ParseInt(res3507for10188.Infcode, 10, 64)
4846
 						infocode, _ := strconv.ParseInt(res3507for10188.Infcode, 10, 64)
4849
 						res.Infcode = infocode
4847
 						res.Infcode = infocode
4848
+					} else if c.GetAdminUserInfo().CurrentOrgId == 10480 {
4849
+
4850
 					} else {
4850
 					} else {
4851
 
4851
 
4852
 						if err := json.Unmarshal(userJSONBytes3, &res); err != nil {
4852
 						if err := json.Unmarshal(userJSONBytes3, &res); err != nil {
5534
 	} else if strings.HasPrefix(miConfig.MdtrtareaAdmvs[0:3], "361") {
5534
 	} else if strings.HasPrefix(miConfig.MdtrtareaAdmvs[0:3], "361") {
5535
 		result1, result2 := service.JXyb3505(struct3505, struct3505.SecretKey, struct3505.AccessKey, struct3505.RequestUrl)
5535
 		result1, result2 := service.JXyb3505(struct3505, struct3505.SecretKey, struct3505.AccessKey, struct3505.RequestUrl)
5536
 		return result1, result2
5536
 		return result1, result2
5537
-	} else if miConfig.MdtrtareaAdmvs == "341203" {
5538
-		result1, result2 := service.AHyb3505(struct3505, struct3505.SecretKey, struct3505.RequestUrl)
5539
-		return result1, result2
5540
 	} else if miConfig.MdtrtareaAdmvs == "340699" {
5537
 	} else if miConfig.MdtrtareaAdmvs == "340699" {
5541
 		result1, result2 := service.AHyb3505(struct3505, struct3505.SecretKey, struct3505.RequestUrl)
5538
 		result1, result2 := service.AHyb3505(struct3505, struct3505.SecretKey, struct3505.RequestUrl)
5542
 		return result1, result2
5539
 		return result1, result2
5564
 		result, _ := json.Marshal(respJSON)
5561
 		result, _ := json.Marshal(respJSON)
5565
 		return string(result), ""
5562
 		return string(result), ""
5566
 
5563
 
5564
+	} else if miConfig.MdtrtareaAdmvs == "341203" {
5565
+		data := make(map[string]interface{})
5566
+		data["struct_3505s"] = struct3505
5567
+		client := &http.Client{}
5568
+		bytesData, _ := json.Marshal(data)
5569
+		var req *http.Request
5570
+
5571
+		req, _ = http.NewRequest("POST", miConfig.SecretKey+"ahyb/3505", bytes.NewReader(bytesData))
5572
+
5573
+		resp, _ := client.Do(req)
5574
+		defer resp.Body.Close()
5575
+		body, ioErr := ioutil.ReadAll(resp.Body)
5576
+		if ioErr != nil {
5577
+			utils.ErrorLog("接口返回数据读取失败: %v", ioErr)
5578
+		}
5579
+		var respJSON map[string]interface{}
5580
+		if err := json.Unmarshal([]byte(body), &respJSON); err != nil {
5581
+			utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
5582
+		}
5583
+		status := respJSON["data"].(map[string]interface{})["status"].(string)
5584
+		if status == "0" {
5585
+			err_msg := respJSON["data"].(map[string]interface{})["msg"].(string)
5586
+			utils.ErrorLog("接口返回数据读取失败: %v", err_msg)
5587
+		}
5588
+
5589
+		respJSON = respJSON["data"].(map[string]interface{})["pre"].(map[string]interface{})
5590
+		result, _ := json.Marshal(respJSON)
5591
+		return string(result), ""
5592
+
5567
 	} else {
5593
 	} else {
5568
 		data := make(map[string]interface{})
5594
 		data := make(map[string]interface{})
5569
 		data["struct_3505s"] = struct3505
5595
 		data["struct_3505s"] = struct3505
26962
 
26988
 
26963
 								fmt.Println(record_time_two)
26989
 								fmt.Println(record_time_two)
26964
 
26990
 
26965
-
26966
 								if his.IdCardType == 2 {
26991
 								if his.IdCardType == 2 {
26967
 									IdCardNo = psn_info.Certno
26992
 									IdCardNo = psn_info.Certno
26968
 									psn_info.VerifyNumber = psn_info.Certno
26993
 									psn_info.VerifyNumber = psn_info.Certno
26969
 								} else if his.IdCardType == 4 {
26994
 								} else if his.IdCardType == 4 {
26970
 									IdCardNo = psn_info.Certno
26995
 									IdCardNo = psn_info.Certno
26971
-								}else{
26996
+								} else {
26972
 									bas := strings.Split(psn_info.CardInfo, "|")
26997
 									bas := strings.Split(psn_info.CardInfo, "|")
26973
 									IdCardNo = bas[2]
26998
 									IdCardNo = bas[2]
26974
 
26999
 
26975
 								}
27000
 								}
26976
 
27001
 
26977
-
26978
 								result, requestLog = service.Gdyb2201A(psn_info.PsnNo, insutype, IdCardNo, miConfig.OrgName, roles.UserName, ipt_otp_no, department.Name, miConfig.Code, department.Number, doctor_info.DoctorNumber, insuplc_admdvs_temp, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, id_card_type, doctor_info.UserName, record_time_two, psn_info.VerifyNumber, admin_user_id)
27002
 								result, requestLog = service.Gdyb2201A(psn_info.PsnNo, insutype, IdCardNo, miConfig.OrgName, roles.UserName, ipt_otp_no, department.Name, miConfig.Code, department.Number, doctor_info.DoctorNumber, insuplc_admdvs_temp, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, id_card_type, doctor_info.UserName, record_time_two, psn_info.VerifyNumber, admin_user_id)
26979
 								saveLog(result, requestLog, "2201A", "挂号")
27003
 								saveLog(result, requestLog, "2201A", "挂号")
26980
 								if miConfig.Code == "H15049901371" {
27004
 								if miConfig.Code == "H15049901371" {
27020
 						//var insutypes []*ResultFive
27044
 						//var insutypes []*ResultFive
27021
 						var insutype string
27045
 						var insutype string
27022
 
27046
 
27023
-
27024
-
27025
 						var insutypes []*ResultFive
27047
 						var insutypes []*ResultFive
27026
 
27048
 
27027
 						var is390 int = 0
27049
 						var is390 int = 0
27059
 							insutype = "310"
27081
 							insutype = "310"
27060
 						}
27082
 						}
27061
 
27083
 
27062
-
27063
-
27064
-
27065
 						if social_type > 0 {
27084
 						if social_type > 0 {
27066
 							insutype = strconv.FormatInt(social_type, 10)
27085
 							insutype = strconv.FormatInt(social_type, 10)
27067
 						}
27086
 						}
33181
 						if his.IdCardType == 2 {
33200
 						if his.IdCardType == 2 {
33182
 							insutype = strconv.FormatInt(his.SocialType, 10)
33201
 							insutype = strconv.FormatInt(his.SocialType, 10)
33183
 
33202
 
33184
-							result, request_log = service.Jxyb2206(his.PsnNo, his.Number, chrg_bchno, his.IdCardNo,insutype, allTotal, miConfig.OrgName, roles.UserName, miConfig.Code, his.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, strconv.FormatInt(reg_type, 10), his.IdCardType, 0, 0, 0, 0, his.IdType, miConfig.Url, miConfig.AccessKey, his.IdCardNo, "")
33203
+							result, request_log = service.Jxyb2206(his.PsnNo, his.Number, chrg_bchno, his.IdCardNo, insutype, allTotal, miConfig.OrgName, roles.UserName, miConfig.Code, his.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, strconv.FormatInt(reg_type, 10), his.IdCardType, 0, 0, 0, 0, his.IdType, miConfig.Url, miConfig.AccessKey, his.IdCardNo, "")
33185
 
33204
 
33186
 						} else if his.IdCardType == 1 {
33205
 						} else if his.IdCardType == 1 {
33187
 							psn_info, _ := service.GetPsnByPatientId(his.PatientId)
33206
 							psn_info, _ := service.GetPsnByPatientId(his.PatientId)