陈少旭 3 weeks ago
parent
commit
0994beb7cf
2 changed files with 268 additions and 348 deletions
  1. 215 260
      controllers/ah/ahyb_controller.go
  2. 53 88
      controllers/sg/his_api_controller.go

+ 215 - 260
controllers/ah/ahyb_controller.go View File

29
 }
29
 }
30
 
30
 
31
 type Body struct {
31
 type Body struct {
32
-	ErrMsg   string  `json:"err_msg"`
33
-	InfRefMsgID string `json:"inf_refmsgid"`
34
-	InfCode  int     `json:"infcode"`
32
+	ErrMsg      string                 `json:"err_msg"`
33
+	InfRefMsgID string                 `json:"inf_refmsgid"`
34
+	InfCode     int                    `json:"infcode"`
35
 	Output      map[string]interface{} `json:"output"`
35
 	Output      map[string]interface{} `json:"output"`
36
 }
36
 }
37
 
37
 
38
 type Response struct {
38
 type Response struct {
39
-	Body     Body `json:"body"`
40
-	Code     int  `json:"code"`
41
-	CSBCode  int  `json:"csbCode"`
42
-	Message  string `json:"message"`
43
-	RequestID string `json:"requestId"`
44
-	State    struct{} `json:"state"`
39
+	Body      Body     `json:"body"`
40
+	Code      int      `json:"code"`
41
+	CSBCode   int      `json:"csbCode"`
42
+	Message   string   `json:"message"`
43
+	RequestID string   `json:"requestId"`
44
+	State     struct{} `json:"state"`
45
 }
45
 }
46
 
46
 
47
 func AHybRegistRouters() {
47
 func AHybRegistRouters() {
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
 }
69
 
68
 
70
 func (c *AHybController) Readcardcharge() {
69
 func (c *AHybController) Readcardcharge() {
79
 	cainfo := c.GetString("cainfo")
78
 	cainfo := c.GetString("cainfo")
80
 	operator_id := c.GetString("operator_id")
79
 	operator_id := c.GetString("operator_id")
81
 	operator := c.GetString("operator")
80
 	operator := c.GetString("operator")
82
-		_, pBusiCardInfo := c.GetELeCertInfoThree(fixmedins_code, operator_id, operator)
83
-		fmt.Println(pBusiCardInfo)
84
-		pBusiCardInfo = Remove0000(pBusiCardInfo)
85
-		var ele ELeCertData
86
-		err := json.Unmarshal([]byte(pBusiCardInfo), &ele)
87
-		if err != nil {
88
-			utils.ErrorLog("解析失败:%v", err)
81
+	_, pBusiCardInfo := c.GetELeCertInfoThree(fixmedins_code, operator_id, operator)
82
+	fmt.Println(pBusiCardInfo)
83
+	pBusiCardInfo = Remove0000(pBusiCardInfo)
84
+	var ele ELeCertData
85
+	err := json.Unmarshal([]byte(pBusiCardInfo), &ele)
86
+	if err != nil {
87
+		utils.ErrorLog("解析失败:%v", err)
88
+	}
89
+	token := ele.Data.EcToken
90
+	fmt.Println(token)
91
+	if len(token) > 0 {
92
+		userName := ele.Data.UserName
93
+		fmt.Println(userName)
94
+		userName = Remove0000(userName)
95
+		userName = DeleteExtraSpace(userName)
96
+		fmt.Println(userName)
97
+		enc := mahonia.NewEncoder("gbk")
98
+		fmt.Println(enc.ConvertString(userName))
99
+		result, _ := service.AHyb1101ForEleCert(org_name, doctor, fixmedins_code, ele.Data.InsuOrg, mdtrtarea_admvs, secret_key, url, ak, token, cainfo, ele.Data.IDNo, userName)
100
+
101
+		var response Response
102
+		if err := json.Unmarshal([]byte(result), &response); err != nil {
103
+			fmt.Println("Error decoding JSON:", err)
104
+			return
89
 		}
105
 		}
90
-		token := ele.Data.EcToken
91
-		fmt.Println(token)
92
-		if len(token) > 0 {
93
-			userName := ele.Data.UserName
94
-			fmt.Println(userName)
95
-			userName = Remove0000(userName)
96
-			userName = DeleteExtraSpace(userName)
97
-			fmt.Println(userName)
98
-			enc := mahonia.NewEncoder("gbk")
99
-			fmt.Println(enc.ConvertString(userName))
100
-			result, _ := service.AHyb1101ForEleCert(org_name, doctor, fixmedins_code, ele.Data.InsuOrg, mdtrtarea_admvs, secret_key, url, ak, token, cainfo, ele.Data.IDNo, userName)
101
-
102
-
103
-			var response Response
104
-			if err := json.Unmarshal([]byte(result), &response); err != nil {
105
-				fmt.Println("Error decoding JSON:", err)
106
-				return
107
-			}
108
-
109
-			if  response.Code == 200{
110
-				c.ServeSuccessJSON(map[string]interface{}{
111
-					"status":"1",
112
-					"card_info":      "",
113
-					"busi_card_info": pBusiCardInfo,
114
-					"token":          token,
115
-					"result":         response.Body,
116
-				})
117
-			}else{
118
-				c.ServeSuccessJSON(map[string]interface{}{
119
-					"status":"0",
120
-					"msg":response.Message,
121
-				})
122
-			}
123
-
124
 
106
 
107
+		if response.Code == 200 {
108
+			c.ServeSuccessJSON(map[string]interface{}{
109
+				"status":         "1",
110
+				"card_info":      "",
111
+				"busi_card_info": pBusiCardInfo,
112
+				"token":          token,
113
+				"result":         response.Body,
114
+			})
125
 		} else {
115
 		} else {
126
 			c.ServeSuccessJSON(map[string]interface{}{
116
 			c.ServeSuccessJSON(map[string]interface{}{
127
-				"status": "-1",
117
+				"status": "0",
118
+				"msg":    response.Message,
128
 			})
119
 			})
129
-
130
 		}
120
 		}
131
-}
132
-
133
 
121
 
122
+	} else {
123
+		c.ServeSuccessJSON(map[string]interface{}{
124
+			"status": "-1",
125
+		})
134
 
126
 
127
+	}
128
+}
135
 
129
 
136
 func (c *AHybController) Get9001() {
130
 func (c *AHybController) Get9001() {
137
 	url := c.GetString("url")
131
 	url := c.GetString("url")
143
 	mdtrtarea_admvs := c.GetString("mdtrtarea_admvs")
137
 	mdtrtarea_admvs := c.GetString("mdtrtarea_admvs")
144
 	secret_key := c.GetString("secret_key")
138
 	secret_key := c.GetString("secret_key")
145
 	cainfo := c.GetString("cainfo")
139
 	cainfo := c.GetString("cainfo")
146
-	result, inputLog := service.AHyb9001(org_name, opera_name,fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, secret_key, opera_id,url,cainfo,"")
140
+	result, inputLog := service.AHyb9001(org_name, opera_name, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, secret_key, opera_id, url, cainfo, "")
147
 	fmt.Println(result)
141
 	fmt.Println(result)
148
 	fmt.Println(inputLog)
142
 	fmt.Println(inputLog)
149
 	saveJsLog(result, inputLog, "9001", "签到", org_name)
143
 	saveJsLog(result, inputLog, "9001", "签到", org_name)
153
 		fmt.Println("Error decoding JSON:", err)
147
 		fmt.Println("Error decoding JSON:", err)
154
 		return
148
 		return
155
 	}
149
 	}
156
-	if  response.Code == 200{
150
+	if response.Code == 200 {
157
 		var dat2 map[string]interface{}
151
 		var dat2 map[string]interface{}
158
 		if err := json.Unmarshal([]byte(inputLog), &dat2); err == nil {
152
 		if err := json.Unmarshal([]byte(inputLog), &dat2); err == nil {
159
 		} else {
153
 		} else {
160
 
154
 
161
 		}
155
 		}
162
 		c.ServeSuccessJSON(map[string]interface{}{
156
 		c.ServeSuccessJSON(map[string]interface{}{
163
-			"pre": response.Body,
164
-			"log": dat2,
165
-			"status":"1",
166
-			"msg":"",
157
+			"pre":    response.Body,
158
+			"log":    dat2,
159
+			"status": "1",
160
+			"msg":    "",
167
 		})
161
 		})
168
-	}else{
162
+	} else {
169
 		c.ServeSuccessJSON(map[string]interface{}{
163
 		c.ServeSuccessJSON(map[string]interface{}{
170
-			"status":"0",
171
-			"msg":response.Message,
164
+			"status": "0",
165
+			"msg":    response.Message,
172
 		})
166
 		})
173
 	}
167
 	}
174
 
168
 
175
-
176
 }
169
 }
177
 
170
 
178
-
179
 func (c *AHybController) Get5301() {
171
 func (c *AHybController) Get5301() {
180
 	psn_no := c.GetString("psn_no")
172
 	psn_no := c.GetString("psn_no")
181
 	org_name := c.GetString("org_name")
173
 	org_name := c.GetString("org_name")
198
 		return
190
 		return
199
 	}
191
 	}
200
 
192
 
201
-
202
-	if  response.Code == 200{
193
+	if response.Code == 200 {
203
 
194
 
204
 		var dat2 map[string]interface{}
195
 		var dat2 map[string]interface{}
205
 		if err := json.Unmarshal([]byte(inputLog), &dat2); err == nil {
196
 		if err := json.Unmarshal([]byte(inputLog), &dat2); err == nil {
207
 
198
 
208
 		}
199
 		}
209
 		c.ServeSuccessJSON(map[string]interface{}{
200
 		c.ServeSuccessJSON(map[string]interface{}{
210
-			"pre": response.Body,
211
-			"log": dat2,
212
-			"status":"1",
213
-			"msg":"",
201
+			"pre":    response.Body,
202
+			"log":    dat2,
203
+			"status": "1",
204
+			"msg":    "",
214
 		})
205
 		})
215
 
206
 
216
-
217
-	}else{
207
+	} else {
218
 
208
 
219
 		c.ServeSuccessJSON(map[string]interface{}{
209
 		c.ServeSuccessJSON(map[string]interface{}{
220
-			"status":"0",
221
-			"msg":response.Message,
210
+			"status": "0",
211
+			"msg":    response.Message,
222
 		})
212
 		})
223
 
213
 
224
 	}
214
 	}
238
 	token := c.GetString("token")
228
 	token := c.GetString("token")
239
 	name := c.GetString("name")
229
 	name := c.GetString("name")
240
 
230
 
241
-
242
-	result, inputLog := service.AHyb1101(certNo, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, id_card_type, card_sn, certificates, url, name,token)
231
+	result, inputLog := service.AHyb1101(certNo, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, id_card_type, card_sn, certificates, url, name, token)
243
 	fmt.Println(result)
232
 	fmt.Println(result)
244
 	fmt.Println(inputLog)
233
 	fmt.Println(inputLog)
245
 	saveJsLog(result, inputLog, "1101", "查询个人信息", org_name)
234
 	saveJsLog(result, inputLog, "1101", "查询个人信息", org_name)
250
 		return
239
 		return
251
 	}
240
 	}
252
 
241
 
253
-
254
-	if  response.Code == 200{
242
+	if response.Code == 200 {
255
 
243
 
256
 		var dat2 map[string]interface{}
244
 		var dat2 map[string]interface{}
257
 		if err := json.Unmarshal([]byte(inputLog), &dat2); err == nil {
245
 		if err := json.Unmarshal([]byte(inputLog), &dat2); err == nil {
259
 
247
 
260
 		}
248
 		}
261
 		c.ServeSuccessJSON(map[string]interface{}{
249
 		c.ServeSuccessJSON(map[string]interface{}{
262
-			"pre": response.Body,
263
-			"log": dat2,
264
-			"status":"1",
265
-			"msg":"",
250
+			"pre":    response.Body,
251
+			"log":    dat2,
252
+			"status": "1",
253
+			"msg":    "",
266
 		})
254
 		})
267
 
255
 
268
-
269
-	}else{
256
+	} else {
270
 
257
 
271
 		c.ServeSuccessJSON(map[string]interface{}{
258
 		c.ServeSuccessJSON(map[string]interface{}{
272
-			"status":"0",
273
-			"msg":response.Message,
259
+			"status": "0",
260
+			"msg":    response.Message,
274
 		})
261
 		})
275
 
262
 
276
 	}
263
 	}
277
 
264
 
278
 }
265
 }
279
 
266
 
280
-
281
 func (c *AHybController) PostTwo() {
267
 func (c *AHybController) PostTwo() {
282
 	psnNo := c.GetString("psn_no")
268
 	psnNo := c.GetString("psn_no")
283
 	insutype := c.GetString("insutype")
269
 	insutype := c.GetString("insutype")
305
 	cainfo := c.GetString("cainfo")
291
 	cainfo := c.GetString("cainfo")
306
 	card_sn := c.GetString("card_sn")
292
 	card_sn := c.GetString("card_sn")
307
 
293
 
308
-
309
-	result, inputLog := service.AHyb2201(psnNo, insutype, certNo, org_name, opera, ipt_otp_no, dept, fixmedins_code, dept_code, doctor_id, insuplc_admdvs, mdtrtarea_admvs, secret_key, id_card_type, doctor_name, url, ak, verify_number, cainfo,card_sn)
294
+	result, inputLog := service.AHyb2201(psnNo, insutype, certNo, org_name, opera, ipt_otp_no, dept, fixmedins_code, dept_code, doctor_id, insuplc_admdvs, mdtrtarea_admvs, secret_key, id_card_type, doctor_name, url, ak, verify_number, cainfo, card_sn)
310
 	var response Response
295
 	var response Response
311
 	if err := json.Unmarshal([]byte(result), &response); err != nil {
296
 	if err := json.Unmarshal([]byte(result), &response); err != nil {
312
 		fmt.Println("Error decoding JSON:", err)
297
 		fmt.Println("Error decoding JSON:", err)
313
 		return
298
 		return
314
 	}
299
 	}
315
 
300
 
316
-
317
-	if  response.Code == 200{
301
+	if response.Code == 200 {
318
 
302
 
319
 		var dat2 map[string]interface{}
303
 		var dat2 map[string]interface{}
320
 		if err := json.Unmarshal([]byte(inputLog), &dat2); err == nil {
304
 		if err := json.Unmarshal([]byte(inputLog), &dat2); err == nil {
322
 
306
 
323
 		}
307
 		}
324
 		c.ServeSuccessJSON(map[string]interface{}{
308
 		c.ServeSuccessJSON(map[string]interface{}{
325
-			"pre": response.Body,
326
-			"log": dat2,
327
-			"status":"1",
328
-			"msg":"",
309
+			"pre":    response.Body,
310
+			"log":    dat2,
311
+			"status": "1",
312
+			"msg":    "",
329
 		})
313
 		})
330
 
314
 
331
-
332
-	}else{
315
+	} else {
333
 
316
 
334
 		c.ServeSuccessJSON(map[string]interface{}{
317
 		c.ServeSuccessJSON(map[string]interface{}{
335
-			"status":"0",
336
-			"msg":response.Message,
318
+			"status": "0",
319
+			"msg":    response.Message,
337
 		})
320
 		})
338
 
321
 
339
 	}
322
 	}
361
 		return
344
 		return
362
 	}
345
 	}
363
 
346
 
364
-
365
-	if  response.Code == 200{
347
+	if response.Code == 200 {
366
 
348
 
367
 		var dat2 map[string]interface{}
349
 		var dat2 map[string]interface{}
368
 		if err := json.Unmarshal([]byte(inputLog), &dat2); err == nil {
350
 		if err := json.Unmarshal([]byte(inputLog), &dat2); err == nil {
370
 
352
 
371
 		}
353
 		}
372
 		c.ServeSuccessJSON(map[string]interface{}{
354
 		c.ServeSuccessJSON(map[string]interface{}{
373
-			"pre": response.Body,
374
-			"log": dat2,
375
-			"status":"1",
376
-			"msg":"",
355
+			"pre":    response.Body,
356
+			"log":    dat2,
357
+			"status": "1",
358
+			"msg":    "",
377
 		})
359
 		})
378
 
360
 
379
-
380
-	}else{
361
+	} else {
381
 
362
 
382
 		c.ServeSuccessJSON(map[string]interface{}{
363
 		c.ServeSuccessJSON(map[string]interface{}{
383
-			"status":"0",
384
-			"msg":response.Message,
364
+			"status": "0",
365
+			"msg":    response.Message,
385
 		})
366
 		})
386
 
367
 
387
 	}
368
 	}
424
 	doctor_name := respJSON["doctor_name"].(string)
405
 	doctor_name := respJSON["doctor_name"].(string)
425
 	doctor_number := respJSON["doctor_number"].(string)
406
 	doctor_number := respJSON["doctor_number"].(string)
426
 
407
 
427
-
428
-
429
 	//cainfo := c.GetString("cainfo")
408
 	//cainfo := c.GetString("cainfo")
430
 
409
 
431
-	result, inputLog := service.AHyb2203(psnNo, mdtrtId, operator, department, org_name, med_type, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, sick_code, sick_name, config, url, begin_time, cainfo,doctor_name, doctor_number)
410
+	result, inputLog := service.AHyb2203(psnNo, mdtrtId, operator, department, org_name, med_type, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, sick_code, sick_name, config, url, begin_time, cainfo, doctor_name, doctor_number)
432
 	saveJsLog(result, inputLog, "2203", "上传就诊信息", org_name)
411
 	saveJsLog(result, inputLog, "2203", "上传就诊信息", org_name)
433
 
412
 
434
 	var response Response
413
 	var response Response
437
 		return
416
 		return
438
 	}
417
 	}
439
 
418
 
440
-
441
-	if  response.Code == 200{
419
+	if response.Code == 200 {
442
 
420
 
443
 		var dat2 map[string]interface{}
421
 		var dat2 map[string]interface{}
444
 		if err := json.Unmarshal([]byte(inputLog), &dat2); err == nil {
422
 		if err := json.Unmarshal([]byte(inputLog), &dat2); err == nil {
446
 
424
 
447
 		}
425
 		}
448
 		c.ServeSuccessJSON(map[string]interface{}{
426
 		c.ServeSuccessJSON(map[string]interface{}{
449
-			"pre": response.Body,
450
-			"log": dat2,
451
-			"status":"1",
452
-			"msg":"",
427
+			"pre":    response.Body,
428
+			"log":    dat2,
429
+			"status": "1",
430
+			"msg":    "",
453
 		})
431
 		})
454
 
432
 
455
-
456
-	}else{
433
+	} else {
457
 
434
 
458
 		c.ServeSuccessJSON(map[string]interface{}{
435
 		c.ServeSuccessJSON(map[string]interface{}{
459
-			"status":"0",
460
-			"msg":response.Message,
436
+			"status": "0",
437
+			"msg":    response.Message,
461
 		})
438
 		})
462
 
439
 
463
 	}
440
 	}
464
 
441
 
465
 }
442
 }
466
 
443
 
467
-
468
 func (c *AHybController) Get2406() {
444
 func (c *AHybController) Get2406() {
469
 	body, _ := ioutil.ReadAll(c.Ctx.Request.Body)
445
 	body, _ := ioutil.ReadAll(c.Ctx.Request.Body)
470
 	var respJSON map[string]interface{}
446
 	var respJSON map[string]interface{}
486
 	mdtrtarea_admvs := respJSON["mdtrtarea_admvs"].(string)
462
 	mdtrtarea_admvs := respJSON["mdtrtarea_admvs"].(string)
487
 	url := respJSON["url"].(string)
463
 	url := respJSON["url"].(string)
488
 
464
 
489
-	result, inputLog := service.AHyb2406(psnNo, mdtrtId, cert_no, psn_name, operator, ipt_otp_no,ipt_psn_sp_flag_type, ipt_psn_sp_flag,org_name,fixmedins_code, insuplc_admdvs, mdtrtarea_admvs,url)
465
+	result, inputLog := service.AHyb2406(psnNo, mdtrtId, cert_no, psn_name, operator, ipt_otp_no, ipt_psn_sp_flag_type, ipt_psn_sp_flag, org_name, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, url)
490
 	saveJsLog(result, inputLog, "2406", "上传2406信息", org_name)
466
 	saveJsLog(result, inputLog, "2406", "上传2406信息", org_name)
491
 	var response Response
467
 	var response Response
492
 	if err := json.Unmarshal([]byte(result), &response); err != nil {
468
 	if err := json.Unmarshal([]byte(result), &response); err != nil {
494
 		return
470
 		return
495
 	}
471
 	}
496
 
472
 
497
-
498
-	if  response.Code == 200{
473
+	if response.Code == 200 {
499
 
474
 
500
 		var dat2 map[string]interface{}
475
 		var dat2 map[string]interface{}
501
 		if err := json.Unmarshal([]byte(inputLog), &dat2); err == nil {
476
 		if err := json.Unmarshal([]byte(inputLog), &dat2); err == nil {
503
 
478
 
504
 		}
479
 		}
505
 		c.ServeSuccessJSON(map[string]interface{}{
480
 		c.ServeSuccessJSON(map[string]interface{}{
506
-			"pre": response.Body,
507
-			"log": dat2,
508
-			"status":"1",
509
-			"msg":"",
481
+			"pre":    response.Body,
482
+			"log":    dat2,
483
+			"status": "1",
484
+			"msg":    "",
510
 		})
485
 		})
511
 
486
 
512
-
513
-	}else{
487
+	} else {
514
 
488
 
515
 		c.ServeSuccessJSON(map[string]interface{}{
489
 		c.ServeSuccessJSON(map[string]interface{}{
516
-			"status":"0",
517
-			"msg":response.Message,
490
+			"status": "0",
491
+			"msg":    response.Message,
518
 		})
492
 		})
519
 
493
 
520
 	}
494
 	}
521
 
495
 
522
 }
496
 }
523
 
497
 
524
-
525
 type All struct {
498
 type All struct {
526
 	HisPrescription HisPrescription
499
 	HisPrescription HisPrescription
527
 	mdtrt_id        string
500
 	mdtrt_id        string
569
 		return
542
 		return
570
 	}
543
 	}
571
 
544
 
572
-
573
-	if  response.Code == 200{
545
+	if response.Code == 200 {
574
 
546
 
575
 		var dat2 map[string]interface{}
547
 		var dat2 map[string]interface{}
576
 		if err := json.Unmarshal([]byte(inputLog), &dat2); err == nil {
548
 		if err := json.Unmarshal([]byte(inputLog), &dat2); err == nil {
578
 
550
 
579
 		}
551
 		}
580
 		c.ServeSuccessJSON(map[string]interface{}{
552
 		c.ServeSuccessJSON(map[string]interface{}{
581
-			"pre": response.Body,
582
-			"log": dat2,
583
-			"status":"1",
584
-			"msg":"",
553
+			"pre":    response.Body,
554
+			"log":    dat2,
555
+			"status": "1",
556
+			"msg":    "",
585
 		})
557
 		})
586
 
558
 
587
-
588
-	}else{
559
+	} else {
589
 
560
 
590
 		c.ServeSuccessJSON(map[string]interface{}{
561
 		c.ServeSuccessJSON(map[string]interface{}{
591
-			"status":"0",
592
-			"msg":response.Message,
562
+			"status": "0",
563
+			"msg":    response.Message,
593
 		})
564
 		})
594
 
565
 
595
 	}
566
 	}
619
 		return
590
 		return
620
 	}
591
 	}
621
 
592
 
622
-
623
-	if  response.Code == 200{
593
+	if response.Code == 200 {
624
 
594
 
625
 		var dat2 map[string]interface{}
595
 		var dat2 map[string]interface{}
626
 		if err := json.Unmarshal([]byte(inputLog), &dat2); err == nil {
596
 		if err := json.Unmarshal([]byte(inputLog), &dat2); err == nil {
628
 
598
 
629
 		}
599
 		}
630
 		c.ServeSuccessJSON(map[string]interface{}{
600
 		c.ServeSuccessJSON(map[string]interface{}{
631
-			"pre": response.Body,
632
-			"log": dat2,
633
-			"status":"1",
634
-			"msg":"",
601
+			"pre":    response.Body,
602
+			"log":    dat2,
603
+			"status": "1",
604
+			"msg":    "",
635
 		})
605
 		})
636
 
606
 
637
-
638
-	}else{
607
+	} else {
639
 
608
 
640
 		c.ServeSuccessJSON(map[string]interface{}{
609
 		c.ServeSuccessJSON(map[string]interface{}{
641
-			"status":"0",
642
-			"msg":response.Message,
610
+			"status": "0",
611
+			"msg":    response.Message,
643
 		})
612
 		})
644
 
613
 
645
 	}
614
 	}
679
 		return
648
 		return
680
 	}
649
 	}
681
 
650
 
682
-
683
-	if  response.Code == 200{
651
+	if response.Code == 200 {
684
 
652
 
685
 		var dat2 map[string]interface{}
653
 		var dat2 map[string]interface{}
686
 		if err := json.Unmarshal([]byte(inputLog), &dat2); err == nil {
654
 		if err := json.Unmarshal([]byte(inputLog), &dat2); err == nil {
688
 
656
 
689
 		}
657
 		}
690
 		c.ServeSuccessJSON(map[string]interface{}{
658
 		c.ServeSuccessJSON(map[string]interface{}{
691
-			"pre": response.Body,
692
-			"log": dat2,
693
-			"status":"1",
694
-			"msg":"",
659
+			"pre":    response.Body,
660
+			"log":    dat2,
661
+			"status": "1",
662
+			"msg":    "",
695
 		})
663
 		})
696
 
664
 
697
-
698
-	}else{
665
+	} else {
699
 
666
 
700
 		c.ServeSuccessJSON(map[string]interface{}{
667
 		c.ServeSuccessJSON(map[string]interface{}{
701
-			"status":"0",
702
-			"msg":response.Message,
668
+			"status": "0",
669
+			"msg":    response.Message,
703
 		})
670
 		})
704
 
671
 
705
 	}
672
 	}
731
 	var result string
698
 	var result string
732
 	var inputLog string
699
 	var inputLog string
733
 
700
 
734
-
735
 	result, inputLog = service.AHyb2207(psnNo, mdtrtId, chrgBchno, certNo, insutype, total, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, secret_key, med_type, id_card_type, acct_used_flag, url, ak, verify_number, cainfo, mdtrt_grp_type)
701
 	result, inputLog = service.AHyb2207(psnNo, mdtrtId, chrgBchno, certNo, insutype, total, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, secret_key, med_type, id_card_type, acct_used_flag, url, ak, verify_number, cainfo, mdtrt_grp_type)
736
 
702
 
737
 	saveJsLog(result, inputLog, "2207", "结算", org_name)
703
 	saveJsLog(result, inputLog, "2207", "结算", org_name)
741
 		return
707
 		return
742
 	}
708
 	}
743
 
709
 
744
-
745
-	if  response.Code == 200{
710
+	if response.Code == 200 {
746
 
711
 
747
 		var dat2 map[string]interface{}
712
 		var dat2 map[string]interface{}
748
 		if err := json.Unmarshal([]byte(inputLog), &dat2); err == nil {
713
 		if err := json.Unmarshal([]byte(inputLog), &dat2); err == nil {
750
 
715
 
751
 		}
716
 		}
752
 		c.ServeSuccessJSON(map[string]interface{}{
717
 		c.ServeSuccessJSON(map[string]interface{}{
753
-			"pre": response.Body,
754
-			"log": dat2,
755
-			"status":"1",
756
-			"msg":"",
718
+			"pre":    response.Body,
719
+			"log":    dat2,
720
+			"status": "1",
721
+			"msg":    "",
757
 		})
722
 		})
758
 
723
 
759
-
760
-	}else{
724
+	} else {
761
 
725
 
762
 		c.ServeSuccessJSON(map[string]interface{}{
726
 		c.ServeSuccessJSON(map[string]interface{}{
763
-			"status":"0",
764
-			"msg":response.Message,
727
+			"status": "0",
728
+			"msg":    response.Message,
765
 		})
729
 		})
766
 
730
 
767
 	}
731
 	}
788
 		return
752
 		return
789
 	}
753
 	}
790
 
754
 
791
-
792
-	if  response.Code == 200{
755
+	if response.Code == 200 {
793
 		var dat2 map[string]interface{}
756
 		var dat2 map[string]interface{}
794
 		if err := json.Unmarshal([]byte(inputLog), &dat2); err == nil {
757
 		if err := json.Unmarshal([]byte(inputLog), &dat2); err == nil {
795
 		} else {
758
 		} else {
796
 
759
 
797
 		}
760
 		}
798
 		c.ServeSuccessJSON(map[string]interface{}{
761
 		c.ServeSuccessJSON(map[string]interface{}{
799
-			"pre": response.Body,
800
-			"log": dat2,
801
-			"status":"1",
802
-			"msg":"",
762
+			"pre":    response.Body,
763
+			"log":    dat2,
764
+			"status": "1",
765
+			"msg":    "",
803
 		})
766
 		})
804
 
767
 
805
-	}else{
768
+	} else {
806
 
769
 
807
 		c.ServeSuccessJSON(map[string]interface{}{
770
 		c.ServeSuccessJSON(map[string]interface{}{
808
-			"status":"0",
809
-			"msg":response.Message,
771
+			"status": "0",
772
+			"msg":    response.Message,
810
 		})
773
 		})
811
 
774
 
812
 	}
775
 	}
851
 		return
814
 		return
852
 	}
815
 	}
853
 
816
 
854
-
855
-	if  response.Code == 200{
817
+	if response.Code == 200 {
856
 
818
 
857
 		var dat2 map[string]interface{}
819
 		var dat2 map[string]interface{}
858
 		if err := json.Unmarshal([]byte(inputLog), &dat2); err == nil {
820
 		if err := json.Unmarshal([]byte(inputLog), &dat2); err == nil {
860
 
822
 
861
 		}
823
 		}
862
 		c.ServeSuccessJSON(map[string]interface{}{
824
 		c.ServeSuccessJSON(map[string]interface{}{
863
-			"pre": response.Body,
864
-			"log": dat2,
865
-			"status":"1",
866
-			"msg":"",
825
+			"pre":    response.Body,
826
+			"log":    dat2,
827
+			"status": "1",
828
+			"msg":    "",
867
 		})
829
 		})
868
 
830
 
869
-
870
-	}else{
831
+	} else {
871
 
832
 
872
 		c.ServeSuccessJSON(map[string]interface{}{
833
 		c.ServeSuccessJSON(map[string]interface{}{
873
-			"status":"0",
874
-			"msg":response.Message,
834
+			"status": "0",
835
+			"msg":    response.Message,
875
 		})
836
 		})
876
 
837
 
877
 	}
838
 	}
927
 		return
888
 		return
928
 	}
889
 	}
929
 
890
 
930
-
931
-	if  response.Code == 200{
891
+	if response.Code == 200 {
932
 
892
 
933
 		var dat2 map[string]interface{}
893
 		var dat2 map[string]interface{}
934
 		if err := json.Unmarshal([]byte(inputLog), &dat2); err == nil {
894
 		if err := json.Unmarshal([]byte(inputLog), &dat2); err == nil {
936
 
896
 
937
 		}
897
 		}
938
 		c.ServeSuccessJSON(map[string]interface{}{
898
 		c.ServeSuccessJSON(map[string]interface{}{
939
-			"pre": response.Body,
940
-			"log": dat2,
941
-			"status":"1",
942
-			"msg":"",
899
+			"pre":    response.Body,
900
+			"log":    dat2,
901
+			"status": "1",
902
+			"msg":    "",
943
 		})
903
 		})
944
 
904
 
945
-
946
-	}else{
905
+	} else {
947
 
906
 
948
 		c.ServeSuccessJSON(map[string]interface{}{
907
 		c.ServeSuccessJSON(map[string]interface{}{
949
-			"status":"0",
950
-			"msg":response.Message,
908
+			"status": "0",
909
+			"msg":    response.Message,
951
 		})
910
 		})
952
 
911
 
953
 	}
912
 	}
986
 	Message string `json:"message"`
945
 	Message string `json:"message"`
987
 }
946
 }
988
 
947
 
989
-
990
-
991
 func (c *AHybController) ReadCard() {
948
 func (c *AHybController) ReadCard() {
992
 	fixmedins_code := c.GetString("fixmedins_code")
949
 	fixmedins_code := c.GetString("fixmedins_code")
993
 	secret_key := c.GetString("secret_key")
950
 	secret_key := c.GetString("secret_key")
1021
 
978
 
1022
 		if len(pCardInfo) > 0 {
979
 		if len(pCardInfo) > 0 {
1023
 			result, _ := service.AHyb1101A(basNumber, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, secret_key, id_card_type_int, card_sn, "1", url, ak, id_card_no, cainfo)
980
 			result, _ := service.AHyb1101A(basNumber, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, secret_key, id_card_type_int, card_sn, "1", url, ak, id_card_no, cainfo)
1024
-			var dat map[string]interface{}
1025
-			if err := json.Unmarshal([]byte(result), &dat); err == nil {
1026
-				fmt.Println(dat)
981
+
982
+			var response Response
983
+			if err := json.Unmarshal([]byte(result), &response); err != nil {
984
+				fmt.Println("Error decoding JSON:", err)
985
+				return
986
+			}
987
+			if response.Code == 200 {
988
+
989
+				c.ServeSuccessJSON(map[string]interface{}{
990
+					"status":    "0",
991
+					"card_info": pCardInfo,
992
+					"result":    response.Body,
993
+					"type":      "1",
994
+				})
1027
 			} else {
995
 			} else {
1028
-				fmt.Println(err)
996
+				c.ServeSuccessJSON(map[string]interface{}{
997
+					"status": "0",
998
+					"msg":    response.Message,
999
+				})
1000
+
1029
 			}
1001
 			}
1030
-			c.ServeSuccessJSON(map[string]interface{}{
1031
-				"status":         "0",
1032
-				"card_info":      pCardInfo,
1033
-				"result":         dat,
1034
-				"type":           "1",
1035
-			})
1002
+
1036
 		} else {
1003
 		} else {
1037
 			c.ServeSuccessJSON(map[string]interface{}{
1004
 			c.ServeSuccessJSON(map[string]interface{}{
1038
 				"status": "-1",
1005
 				"status": "-1",
1098
 			fmt.Println(enc.ConvertString(userName))
1065
 			fmt.Println(enc.ConvertString(userName))
1099
 			result, _ := service.AHyb1101ForEleCert(org_name, doctor, fixmedins_code, ele.Data.InsuOrg, mdtrtarea_admvs, secret_key, url, ak, token, cainfo, ele.Data.IDNo, userName)
1066
 			result, _ := service.AHyb1101ForEleCert(org_name, doctor, fixmedins_code, ele.Data.InsuOrg, mdtrtarea_admvs, secret_key, url, ak, token, cainfo, ele.Data.IDNo, userName)
1100
 
1067
 
1101
-
1102
 			var response Response
1068
 			var response Response
1103
 			if err := json.Unmarshal([]byte(result), &response); err != nil {
1069
 			if err := json.Unmarshal([]byte(result), &response); err != nil {
1104
 				fmt.Println("Error decoding JSON:", err)
1070
 				fmt.Println("Error decoding JSON:", err)
1105
 				return
1071
 				return
1106
 			}
1072
 			}
1107
 
1073
 
1108
-
1109
-			if  response.Code == 200{
1074
+			if response.Code == 200 {
1110
 
1075
 
1111
 				c.ServeSuccessJSON(map[string]interface{}{
1076
 				c.ServeSuccessJSON(map[string]interface{}{
1112
-					"status":"1",
1077
+					"status":         "1",
1113
 					"card_info":      "",
1078
 					"card_info":      "",
1114
 					"busi_card_info": pBusiCardInfo,
1079
 					"busi_card_info": pBusiCardInfo,
1115
 					"token":          token,
1080
 					"token":          token,
1116
 					"result":         response.Body,
1081
 					"result":         response.Body,
1117
 				})
1082
 				})
1118
 
1083
 
1119
-			}else{
1084
+			} else {
1120
 
1085
 
1121
 				c.ServeSuccessJSON(map[string]interface{}{
1086
 				c.ServeSuccessJSON(map[string]interface{}{
1122
-					"status":"0",
1123
-					"msg":response.Message,
1087
+					"status": "0",
1088
+					"msg":    response.Message,
1124
 				})
1089
 				})
1125
 
1090
 
1126
 			}
1091
 			}
1127
 
1092
 
1128
-
1129
 		} else {
1093
 		} else {
1130
 			c.ServeSuccessJSON(map[string]interface{}{
1094
 			c.ServeSuccessJSON(map[string]interface{}{
1131
 				"status": "-1",
1095
 				"status": "-1",
1179
 	//initFlag = 1
1143
 	//initFlag = 1
1180
 	return
1144
 	return
1181
 }
1145
 }
1182
-func (c *AHybController) GetBasBaseInfo() (string) {
1146
+func (c *AHybController) GetBasBaseInfo() string {
1183
 	DllDef := syscall.MustLoadDLL("SSCardDriver.dll")
1147
 	DllDef := syscall.MustLoadDLL("SSCardDriver.dll")
1184
 	readCard := DllDef.MustFindProc("iReadCardBas")
1148
 	readCard := DllDef.MustFindProc("iReadCardBas")
1185
 	fmt.Println(readCard)
1149
 	fmt.Println(readCard)
1420
 	return "", string(receivedMessage)
1384
 	return "", string(receivedMessage)
1421
 }
1385
 }
1422
 
1386
 
1423
-
1424
-
1425
-
1426
-
1427
 func IntPtr(n int) uintptr {
1387
 func IntPtr(n int) uintptr {
1428
 	return uintptr(n)
1388
 	return uintptr(n)
1429
 }
1389
 }
1570
 		return
1530
 		return
1571
 	}
1531
 	}
1572
 
1532
 
1573
-
1574
-	if  response.Code == 200{
1533
+	if response.Code == 200 {
1575
 
1534
 
1576
 		var dat2 map[string]interface{}
1535
 		var dat2 map[string]interface{}
1577
 		if err := json.Unmarshal([]byte(inputLog), &dat2); err == nil {
1536
 		if err := json.Unmarshal([]byte(inputLog), &dat2); err == nil {
1579
 
1538
 
1580
 		}
1539
 		}
1581
 		c.ServeSuccessJSON(map[string]interface{}{
1540
 		c.ServeSuccessJSON(map[string]interface{}{
1582
-			"pre": response.Body,
1583
-			"log": dat2,
1584
-			"status":1,
1585
-			"msg":"",
1541
+			"pre":    response.Body,
1542
+			"log":    dat2,
1543
+			"status": 1,
1544
+			"msg":    "",
1586
 		})
1545
 		})
1587
 
1546
 
1588
-
1589
-	}else{
1547
+	} else {
1590
 
1548
 
1591
 		c.ServeSuccessJSON(map[string]interface{}{
1549
 		c.ServeSuccessJSON(map[string]interface{}{
1592
-			"status":0,
1593
-			"msg":response.Message,
1550
+			"status": 0,
1551
+			"msg":    response.Message,
1594
 		})
1552
 		})
1595
 
1553
 
1596
 	}
1554
 	}
1649
 		return
1607
 		return
1650
 	}
1608
 	}
1651
 
1609
 
1652
-	if  response.Code == 200{
1610
+	if response.Code == 200 {
1653
 		c.ServeSuccessJSON(map[string]interface{}{
1611
 		c.ServeSuccessJSON(map[string]interface{}{
1654
-			"pre": response.Body,
1655
-			"status":1,
1656
-			"msg":"",
1612
+			"pre":    response.Body,
1613
+			"status": 1,
1614
+			"msg":    "",
1657
 		})
1615
 		})
1658
 
1616
 
1659
-
1660
-	}else{
1617
+	} else {
1661
 
1618
 
1662
 		c.ServeSuccessJSON(map[string]interface{}{
1619
 		c.ServeSuccessJSON(map[string]interface{}{
1663
-			"status":0,
1664
-			"msg":response.Message,
1620
+			"status": 0,
1621
+			"msg":    response.Message,
1665
 		})
1622
 		})
1666
 
1623
 
1667
 	}
1624
 	}
1695
 		return
1652
 		return
1696
 	}
1653
 	}
1697
 
1654
 
1698
-
1699
-	if  response.Code == 200{
1655
+	if response.Code == 200 {
1700
 
1656
 
1701
 		var dat2 map[string]interface{}
1657
 		var dat2 map[string]interface{}
1702
 		if err := json.Unmarshal([]byte(inputLog), &dat2); err == nil {
1658
 		if err := json.Unmarshal([]byte(inputLog), &dat2); err == nil {
1704
 
1660
 
1705
 		}
1661
 		}
1706
 		c.ServeSuccessJSON(map[string]interface{}{
1662
 		c.ServeSuccessJSON(map[string]interface{}{
1707
-			"pre": response.Body,
1708
-			"log": dat2,
1709
-			"status":1,
1710
-			"msg":"",
1663
+			"pre":    response.Body,
1664
+			"log":    dat2,
1665
+			"status": 1,
1666
+			"msg":    "",
1711
 		})
1667
 		})
1712
 
1668
 
1713
-
1714
-	}else{
1669
+	} else {
1715
 
1670
 
1716
 		c.ServeSuccessJSON(map[string]interface{}{
1671
 		c.ServeSuccessJSON(map[string]interface{}{
1717
-			"status":0,
1718
-			"msg":response.Message,
1672
+			"status": 0,
1673
+			"msg":    response.Message,
1719
 		})
1674
 		})
1720
 
1675
 
1721
 	}
1676
 	}

+ 53 - 88
controllers/sg/his_api_controller.go View File

9
 	//"github.com/tjfoc/gmsm/sm3"
9
 	//"github.com/tjfoc/gmsm/sm3"
10
 	"math"
10
 	"math"
11
 
11
 
12
-
13
-
14
 	"strings"
12
 	"strings"
15
 	//"crypto/x509/pkix"
13
 	//"crypto/x509/pkix"
16
 	"encoding/json"
14
 	"encoding/json"
41
 	"syscall"
39
 	"syscall"
42
 	"time"
40
 	"time"
43
 	"unsafe"
41
 	"unsafe"
44
-	"github.com/go-ole/go-ole"
45
-
46
 )
42
 )
47
 
43
 
48
 type HisApiController struct {
44
 type HisApiController struct {
217
 	beego.Router("/api/3201", &HisApiController{}, "get:Get3201")
213
 	beego.Router("/api/3201", &HisApiController{}, "get:Get3201")
218
 
214
 
219
 }
215
 }
220
-func (c *HisApiController)Get3201(){
216
+func (c *HisApiController) Get3201() {
221
 	adminUser := c.GetAdminUserInfo()
217
 	adminUser := c.GetAdminUserInfo()
222
 
218
 
223
 	miConfig, _ := service.FindMedicalInsuranceInfo(adminUser.CurrentOrgId)
219
 	miConfig, _ := service.FindMedicalInsuranceInfo(adminUser.CurrentOrgId)
224
 
220
 
225
-	result, _ := service.AHyb3201(932, 0, 571536.19, 543283.9, "2024-10-01", "2024-10-31", "340699", "11", "390", miConfig.OrgName, "王幸子",  miConfig.Code,"360399", "360399",  miConfig.Url,  miConfig.AccessKey,  miConfig.SecretKey, miConfig.Cainfo)
221
+	result, _ := service.AHyb3201(932, 0, 571536.19, 543283.9, "2024-10-01", "2024-10-31", "340699", "11", "390", miConfig.OrgName, "王幸子", miConfig.Code, "340399", "340399", miConfig.Url, miConfig.AccessKey, miConfig.SecretKey, miConfig.Cainfo)
226
 
222
 
227
 	var response Response
223
 	var response Response
228
 	if err := json.Unmarshal([]byte(result), &response); err != nil {
224
 	if err := json.Unmarshal([]byte(result), &response); err != nil {
230
 		return
226
 		return
231
 	}
227
 	}
232
 
228
 
233
-
234
-
235
 }
229
 }
236
 
230
 
237
-
238
-
239
 func (c *HisApiController) TestNet() {
231
 func (c *HisApiController) TestNet() {
240
 	c.ServeSuccessJSON(map[string]interface{}{
232
 	c.ServeSuccessJSON(map[string]interface{}{
241
 		"msg": "成功",
233
 		"msg": "成功",
3199
 		})
3191
 		})
3200
 	}
3192
 	}
3201
 }
3193
 }
3194
+
3202
 //func (c *HisApiController) ChangeDrugfour() {
3195
 //func (c *HisApiController) ChangeDrugfour() {
3203
 //	patient_id, _ := c.GetInt64("patient_id")
3196
 //	patient_id, _ := c.GetInt64("patient_id")
3204
 //	admin_user_id, _ := c.GetInt64("admin_user_id")
3197
 //	admin_user_id, _ := c.GetInt64("admin_user_id")
4649
 	recordEndTime := theEndTime.Unix()
4642
 	recordEndTime := theEndTime.Unix()
4650
 
4643
 
4651
 	//timestamp := int64(1729612800)
4644
 	//timestamp := int64(1729612800)
4652
-	flows, _ := service.GetNewDrugFlowInforTenone(recordStartTime,recordEndTime,c.GetAdminUserInfo().CurrentOrgId)
4645
+	flows, _ := service.GetNewDrugFlowInforTenone(recordStartTime, recordEndTime, c.GetAdminUserInfo().CurrentOrgId)
4653
 	admin_user_id, _ := c.GetInt64("admin_user_id")
4646
 	admin_user_id, _ := c.GetInt64("admin_user_id")
4654
 	roles, _ := service.GetAdminUserInfoByID(c.GetAdminUserInfo().CurrentOrgId, admin_user_id)
4647
 	roles, _ := service.GetAdminUserInfoByID(c.GetAdminUserInfo().CurrentOrgId, admin_user_id)
4655
 	miConfig, _ := service.FindMedicalInsuranceInfo(c.GetAdminUserInfo().CurrentOrgId)
4648
 	miConfig, _ := service.FindMedicalInsuranceInfo(c.GetAdminUserInfo().CurrentOrgId)
4669
 				//已经结算
4662
 				//已经结算
4670
 				//判断 是否已经销售
4663
 				//判断 是否已经销售
4671
 				//if item.IsSale == 1 { //是否已经销售,1是   0否
4664
 				//if item.IsSale == 1 { //是否已经销售,1是   0否
4672
-					////是否已经变更 1是  0否
4673
-					//if item.IsChange == 0 { //没变更,进行变更操作
4674
-					//	bg_number := strconv.FormatInt(time.Now().Unix(), 10) + "-" + strconv.FormatInt(item.ID, 10) + "-" + "3502"
4675
-					//
4676
-					//	result, result2 := ChangeStock(item.Count, item, miConfig, "102", roles, bg_number)
4677
-					//	saveLog(result, result2, "3502", "自动出库,已经销售,未变更3502")
4678
-					//	var respJSON3 map[string]interface{}
4679
-					//	if err := json.Unmarshal([]byte(string(result)), &respJSON3); err != nil {
4680
-					//		utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
4681
-					//		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
4682
-					//		return
4683
-					//	}
4684
-					//	userJSONBytes3, _ := json.Marshal(respJSON3)
4685
-					//	if err := json.Unmarshal(userJSONBytes3, &res3); err != nil {
4686
-					//		utils.ErrorLog("解析失败:%v", err)
4687
-					//		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
4688
-					//		return
4689
-					//	}
4690
-					//	if res3.Infcode == 0 {
4691
-					//		item.IsChange = 1
4692
-					//		item.BgBchno = bg_number
4693
-					//		service.SaveDF2(item)
4694
-					//	} else {
4695
-					//		err = append(err, item.HisDoctorAdviceInfo.AdviceName+",销售变更失败:"+res3.ErrMsg)
4696
-					//	}
4697
-					//}
4665
+				////是否已经变更 1是  0否
4666
+				//if item.IsChange == 0 { //没变更,进行变更操作
4667
+				//	bg_number := strconv.FormatInt(time.Now().Unix(), 10) + "-" + strconv.FormatInt(item.ID, 10) + "-" + "3502"
4668
+				//
4669
+				//	result, result2 := ChangeStock(item.Count, item, miConfig, "102", roles, bg_number)
4670
+				//	saveLog(result, result2, "3502", "自动出库,已经销售,未变更3502")
4671
+				//	var respJSON3 map[string]interface{}
4672
+				//	if err := json.Unmarshal([]byte(string(result)), &respJSON3); err != nil {
4673
+				//		utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
4674
+				//		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
4675
+				//		return
4676
+				//	}
4677
+				//	userJSONBytes3, _ := json.Marshal(respJSON3)
4678
+				//	if err := json.Unmarshal(userJSONBytes3, &res3); err != nil {
4679
+				//		utils.ErrorLog("解析失败:%v", err)
4680
+				//		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
4681
+				//		return
4682
+				//	}
4683
+				//	if res3.Infcode == 0 {
4684
+				//		item.IsChange = 1
4685
+				//		item.BgBchno = bg_number
4686
+				//		service.SaveDF2(item)
4687
+				//	} else {
4688
+				//		err = append(err, item.HisDoctorAdviceInfo.AdviceName+",销售变更失败:"+res3.ErrMsg)
4689
+				//	}
4690
+				//}
4698
 
4691
 
4699
 				//} else
4692
 				//} else
4700
-				if item.IsSale == 0{ //没销售,
4693
+				if item.IsSale == 0 { //没销售,
4701
 					var res FJ3507Result
4694
 					var res FJ3507Result
4702
 					var res3507for10188 FJ3507ResultFor10188
4695
 					var res3507for10188 FJ3507ResultFor10188
4703
 					number := strconv.FormatInt(time.Now().Unix(), 10) + "-" + strconv.FormatInt(item.ID, 10) + "-" + "3505"
4696
 					number := strconv.FormatInt(time.Now().Unix(), 10) + "-" + strconv.FormatInt(item.ID, 10) + "-" + "3505"
5033
 	}
5026
 	}
5034
 }
5027
 }
5035
 
5028
 
5036
-
5037
-func  ChangeDrugTenone() {
5029
+func ChangeDrugTenone() {
5038
 
5030
 
5039
 	//ids := c.GetString("ids")
5031
 	//ids := c.GetString("ids")
5040
 	//id_arr := strings.Split(ids, ",")
5032
 	//id_arr := strings.Split(ids, ",")
5041
 	now := time.Now()
5033
 	now := time.Now()
5042
 	timestamp := time.Date(now.Year(), now.Month(), now.Day(), 0, 0, 0, 0, time.Local).Unix()
5034
 	timestamp := time.Date(now.Year(), now.Month(), now.Day(), 0, 0, 0, 0, time.Local).Unix()
5043
 	//timestamp := int64(1729612800)
5035
 	//timestamp := int64(1729612800)
5044
-	flows, _ := service.GetNewDrugFlowInforTen(timestamp,10188)
5036
+	flows, _ := service.GetNewDrugFlowInforTen(timestamp, 10188)
5045
 
5037
 
5046
 	admin_user_id := int64(2463)
5038
 	admin_user_id := int64(2463)
5047
 	roles, _ := service.GetAdminUserInfoByID(10188, admin_user_id)
5039
 	roles, _ := service.GetAdminUserInfoByID(10188, admin_user_id)
5103
 						return
5095
 						return
5104
 					}
5096
 					}
5105
 					userJSONBytes3, _ := json.Marshal(respJSON3)
5097
 					userJSONBytes3, _ := json.Marshal(respJSON3)
5106
-					 {
5098
+					{
5107
 						if err := json.Unmarshal(userJSONBytes3, &res3507for10188); err != nil {
5099
 						if err := json.Unmarshal(userJSONBytes3, &res3507for10188); err != nil {
5108
 							utils.ErrorLog("解析失败:%v", err)
5100
 							utils.ErrorLog("解析失败:%v", err)
5109
 							return
5101
 							return
5138
 									return
5130
 									return
5139
 								}
5131
 								}
5140
 
5132
 
5141
-							  {
5133
+								{
5142
 									if err := json.Unmarshal(userJSONBytes3, &res3507for10188); err != nil {
5134
 									if err := json.Unmarshal(userJSONBytes3, &res3507for10188); err != nil {
5143
 										utils.ErrorLog("解析失败:%v", err)
5135
 										utils.ErrorLog("解析失败:%v", err)
5144
 										return
5136
 										return
5175
 
5167
 
5176
 }
5168
 }
5177
 
5169
 
5178
-
5179
 func ChangeStock(count int64, drug *models.DrugFlow, miConfig models.MedicalInsuranceOrgConfig, chgType string, role models.UserAdminRole, number string) (string, string) {
5170
 func ChangeStock(count int64, drug *models.DrugFlow, miConfig models.MedicalInsuranceOrgConfig, chgType string, role models.UserAdminRole, number string) (string, string) {
5180
 	var struct3502 models.Struct3502
5171
 	var struct3502 models.Struct3502
5181
 	struct3502.MedListCodg = drug.HisDoctorAdviceInfo.BaseDrugLib.MedicalInsuranceNumber
5172
 	struct3502.MedListCodg = drug.HisDoctorAdviceInfo.BaseDrugLib.MedicalInsuranceNumber
5285
 		struct3505.PharPracCertNo = "2015026440262015440501001198"
5276
 		struct3505.PharPracCertNo = "2015026440262015440501001198"
5286
 	}
5277
 	}
5287
 
5278
 
5288
-
5289
-
5290
 	if org_id == 9919 {
5279
 	if org_id == 9919 {
5291
 		struct3505.PharName = "周君权"
5280
 		struct3505.PharName = "周君权"
5292
 		struct3505.PharPracCertNo = "089644396094401375"
5281
 		struct3505.PharPracCertNo = "089644396094401375"
5293
 	}
5282
 	}
5294
 
5283
 
5295
-
5296
 	if org_id == 10644 {
5284
 	if org_id == 10644 {
5297
 		struct3505.PharName = "陈金娣"
5285
 		struct3505.PharName = "陈金娣"
5298
 		struct3505.PharPracCertNo = "20181441500320100066"
5286
 		struct3505.PharPracCertNo = "20181441500320100066"
5358
 	} else if strings.HasPrefix(miConfig.MdtrtareaAdmvs[0:3], "440") {
5346
 	} else if strings.HasPrefix(miConfig.MdtrtareaAdmvs[0:3], "440") {
5359
 		result1, result2 := service.Gdyb3505(struct3505, struct3505.SecretKey)
5347
 		result1, result2 := service.Gdyb3505(struct3505, struct3505.SecretKey)
5360
 		return result1, result2
5348
 		return result1, result2
5361
-	}else if strings.HasPrefix(miConfig.MdtrtareaAdmvs[0:3], "361") {
5362
-		result1, result2 := service.JXyb3505(struct3505, struct3505.SecretKey,struct3505.AccessKey,struct3505.RequestUrl)
5349
+	} else if strings.HasPrefix(miConfig.MdtrtareaAdmvs[0:3], "361") {
5350
+		result1, result2 := service.JXyb3505(struct3505, struct3505.SecretKey, struct3505.AccessKey, struct3505.RequestUrl)
5363
 		return result1, result2
5351
 		return result1, result2
5364
-	}else if miConfig.MdtrtareaAdmvs == "340699" {
5365
-		result1, result2 := service.AHyb3505(struct3505, struct3505.SecretKey,struct3505.RequestUrl)
5352
+	} else if miConfig.MdtrtareaAdmvs == "340699" {
5353
+		result1, result2 := service.AHyb3505(struct3505, struct3505.SecretKey, struct3505.RequestUrl)
5366
 		return result1, result2
5354
 		return result1, result2
5367
 	} else {
5355
 	} else {
5368
 		data := make(map[string]interface{})
5356
 		data := make(map[string]interface{})
14379
 
14367
 
14380
 		} else if miConfig.MdtrtareaAdmvs == "361025" {
14368
 		} else if miConfig.MdtrtareaAdmvs == "361025" {
14381
 
14369
 
14382
-
14383
 			basStr := c.GetBasBaseInfo1111()
14370
 			basStr := c.GetBasBaseInfo1111()
14384
 			fmt.Println(basStr)
14371
 			fmt.Println(basStr)
14385
 
14372
 
15140
 
15127
 
15141
 					respJSON = respJSON["data"].(map[string]interface{})["result"].(map[string]interface{})
15128
 					respJSON = respJSON["data"].(map[string]interface{})["result"].(map[string]interface{})
15142
 					result, _ := json.Marshal(respJSON)
15129
 					result, _ := json.Marshal(respJSON)
15143
-
15130
+					fmt.Println(result)
15144
 					if err := json.Unmarshal([]byte(result), &res); err != nil {
15131
 					if err := json.Unmarshal([]byte(result), &res); err != nil {
15145
 						utils.ErrorLog("解析失败:%v", err)
15132
 						utils.ErrorLog("解析失败:%v", err)
15146
 						c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
15133
 						c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
15147
 						return
15134
 						return
15148
 					}
15135
 					}
15149
-
15136
+					fmt.Println(res)
15150
 				} else {
15137
 				} else {
15151
 					token = respJSON["data"].(map[string]interface{})["token"].(string)
15138
 					token = respJSON["data"].(map[string]interface{})["token"].(string)
15152
 					respJSON = respJSON["data"].(map[string]interface{})["result"].(map[string]interface{})
15139
 					respJSON = respJSON["data"].(map[string]interface{})["result"].(map[string]interface{})
15184
 								PatientId: patient.ID,
15171
 								PatientId: patient.ID,
15185
 								Certno:    res.Output.Baseinfo.Certno,
15172
 								Certno:    res.Output.Baseinfo.Certno,
15186
 
15173
 
15187
-								Gend:         res.Output.Baseinfo.Gend,
15188
-								Naty:         res.Output.Baseinfo.Naty,
15189
-								PsnCertType:  res.Output.Baseinfo.PsnCertType,
15190
-								PsnName:      res.Output.Baseinfo.PsnName,
15191
-								Idetinfo:     idetinfoStr,
15192
-								Insuinfo:     infoStr,
15193
-								UserOrgId:    c.GetAdminUserInfo().CurrentOrgId,
15194
-								CardInfo:     card_info,
15174
+								Gend:        res.Output.Baseinfo.Gend,
15175
+								Naty:        res.Output.Baseinfo.Naty,
15176
+								PsnCertType: res.Output.Baseinfo.PsnCertType,
15177
+								PsnName:     res.Output.Baseinfo.PsnName,
15178
+								Idetinfo:    idetinfoStr,
15179
+								Insuinfo:    infoStr,
15180
+								UserOrgId:   c.GetAdminUserInfo().CurrentOrgId,
15181
+								CardInfo:    card_info,
15195
 								//VerifyNumber: busi_card_info,
15182
 								//VerifyNumber: busi_card_info,
15196
 							}
15183
 							}
15197
 							service.CreateHisPsn(psn)
15184
 							service.CreateHisPsn(psn)
15277
 				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeHisFailedException)
15264
 				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeHisFailedException)
15278
 				return
15265
 				return
15279
 			}
15266
 			}
15280
-		}  else {
15267
+		} else {
15281
 			if initFlag == 0 {
15268
 			if initFlag == 0 {
15282
 				c.TestGetBasBaseInit()
15269
 				c.TestGetBasBaseInit()
15283
 			}
15270
 			}
18606
 	str1 := make([]byte, 1024)
18593
 	str1 := make([]byte, 1024)
18607
 	ret2, _, _ := readCard.Call((uintptr)(unsafe.Pointer(&str[0])), uintptr(1024), (uintptr)(unsafe.Pointer(&str1[0])), uintptr(1024))
18594
 	ret2, _, _ := readCard.Call((uintptr)(unsafe.Pointer(&str[0])), uintptr(1024), (uintptr)(unsafe.Pointer(&str1[0])), uintptr(1024))
18608
 
18595
 
18609
-
18610
-
18611
 	fmt.Println(string(str1))
18596
 	fmt.Println(string(str1))
18612
 	fmt.Println(string(str))
18597
 	fmt.Println(string(str))
18613
 	fmt.Println(":", ConvertToString(string(str1), "gbk", "utf-8"))
18598
 	fmt.Println(":", ConvertToString(string(str1), "gbk", "utf-8"))
18616
 		return ""
18601
 		return ""
18617
 	}
18602
 	}
18618
 
18603
 
18619
-
18620
-
18621
-
18622
-
18623
 	return string(str)
18604
 	return string(str)
18624
 }
18605
 }
18625
 
18606
 
18626
-
18627
 type Program struct {
18607
 type Program struct {
18628
 	FunctionID string `xml:"function_id"`
18608
 	FunctionID string `xml:"function_id"`
18629
 	CardInfo   string `xml:"cardinfo"`
18609
 	CardInfo   string `xml:"cardinfo"`
18645
 		readCard2 = DllDef.MustFindProc("ReadCardInfo")
18625
 		readCard2 = DllDef.MustFindProc("ReadCardInfo")
18646
 	}
18626
 	}
18647
 
18627
 
18648
-
18649
 	str := make([]byte, 1024)
18628
 	str := make([]byte, 1024)
18650
 	str1 := make([]byte, 1024)
18629
 	str1 := make([]byte, 1024)
18651
-	 readCard.Call((uintptr)(unsafe.Pointer(&str[0])), (uintptr)(unsafe.Pointer(&str1[0])))
18652
-
18630
+	readCard.Call((uintptr)(unsafe.Pointer(&str[0])), (uintptr)(unsafe.Pointer(&str1[0])))
18653
 
18631
 
18654
 	str3 := make([]byte, 1024)
18632
 	str3 := make([]byte, 1024)
18655
 	str4 := make([]byte, 1024)
18633
 	str4 := make([]byte, 1024)
18700
 	//fmt.Printf("  <user>%s</user>\n", lastProgram.User)
18678
 	//fmt.Printf("  <user>%s</user>\n", lastProgram.User)
18701
 	//fmt.Printf("</program>\n")
18679
 	//fmt.Printf("</program>\n")
18702
 
18680
 
18703
-
18704
-
18705
 	fmt.Println(":", ConvertToString(string(str1), "gbk", "utf-8"))
18681
 	fmt.Println(":", ConvertToString(string(str1), "gbk", "utf-8"))
18706
 	fmt.Println(":", ConvertToString(string(str), "gbk", "utf-8"))
18682
 	fmt.Println(":", ConvertToString(string(str), "gbk", "utf-8"))
18707
 	fmt.Println(":", ConvertToString(string(str3), "gbk", "utf-8"))
18683
 	fmt.Println(":", ConvertToString(string(str3), "gbk", "utf-8"))
18708
 	fmt.Println(":", ConvertToString(string(str4), "gbk", "utf-8"))
18684
 	fmt.Println(":", ConvertToString(string(str4), "gbk", "utf-8"))
18709
 
18685
 
18710
-
18711
-
18712
 	return ConvertToString(string(str), "gbk", "utf-8")
18686
 	return ConvertToString(string(str), "gbk", "utf-8")
18713
 }
18687
 }
18714
 
18688
 
18715
-
18716
-
18717
-
18718
 func (c *HisApiController) GetahBasBaseInfo() string {
18689
 func (c *HisApiController) GetahBasBaseInfo() string {
18719
 	DllDef := syscall.MustLoadDLL("SSCardDriver.dll")
18690
 	DllDef := syscall.MustLoadDLL("SSCardDriver.dll")
18720
 	readCard := DllDef.MustFindProc("iReadCardBas")
18691
 	readCard := DllDef.MustFindProc("iReadCardBas")
18727
 	str1 := make([]byte, 1024)
18698
 	str1 := make([]byte, 1024)
18728
 	ret2, _, _ := readCard.Call(uintptr(3), (uintptr)(unsafe.Pointer(&str1[0])))
18699
 	ret2, _, _ := readCard.Call(uintptr(3), (uintptr)(unsafe.Pointer(&str1[0])))
18729
 
18700
 
18730
-
18731
-
18732
 	//file, err := os.Open("C:\\Users\\Administrator\\Desktop\\11\\Power-Card\\SSCardDriver\\api.log")
18701
 	//file, err := os.Open("C:\\Users\\Administrator\\Desktop\\11\\Power-Card\\SSCardDriver\\api.log")
18733
 	//if err != nil {
18702
 	//if err != nil {
18734
 	//	fmt.Println("Error opening file:", err)
18703
 	//	fmt.Println("Error opening file:", err)
18774
 	//fmt.Printf("  <user>%s</user>\n", lastProgram.User)
18743
 	//fmt.Printf("  <user>%s</user>\n", lastProgram.User)
18775
 	//fmt.Printf("</program>\n")
18744
 	//fmt.Printf("</program>\n")
18776
 
18745
 
18777
-
18778
 	fmt.Println(string(str1))
18746
 	fmt.Println(string(str1))
18779
 	fmt.Println(":", ConvertToString(string(str1), "gbk", "utf-8"))
18747
 	fmt.Println(":", ConvertToString(string(str1), "gbk", "utf-8"))
18780
 
18748
 
18782
 		return ""
18750
 		return ""
18783
 	}
18751
 	}
18784
 
18752
 
18785
-
18786
 	return string(str1)
18753
 	return string(str1)
18787
 }
18754
 }
18788
 
18755
 
18789
-
18790
-
18791
 func (c *HisApiController) GetFjBasBaseInfo() (string, string, string, string, string) {
18756
 func (c *HisApiController) GetFjBasBaseInfo() (string, string, string, string, string) {
18792
 	DllDef := syscall.MustLoadDLL("chs_fjs_standard.dll")
18757
 	DllDef := syscall.MustLoadDLL("chs_fjs_standard.dll")
18793
 	readCard := DllDef.MustFindProc("read_cardinfo")
18758
 	readCard := DllDef.MustFindProc("read_cardinfo")
25041
 
25006
 
25042
 			}
25007
 			}
25043
 
25008
 
25044
-		} else if miConfig.MdtrtareaAdmvs == "341203" ||  miConfig.MdtrtareaAdmvs == "340699" {
25009
+		} else if miConfig.MdtrtareaAdmvs == "341203" || miConfig.MdtrtareaAdmvs == "340699" {
25045
 			psn_info, _ := service.GetPsnByPatientId(id)
25010
 			psn_info, _ := service.GetPsnByPatientId(id)
25046
 			PsnNo = psn_info.PsnNo
25011
 			PsnNo = psn_info.PsnNo
25047
 			PsnCertType = psn_info.PsnCertType
25012
 			PsnCertType = psn_info.PsnCertType
25824
 				if id_card_type == 1 {
25789
 				if id_card_type == 1 {
25825
 					bas := strings.Split(psn_info.CardInfo, "|")
25790
 					bas := strings.Split(psn_info.CardInfo, "|")
25826
 					basNumber := bas[2]
25791
 					basNumber := bas[2]
25827
-					card_sn :=""
25792
+					card_sn := ""
25828
 
25793
 
25829
 					result, requestLog = service.Jxyb2201(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, miConfig.Url, miConfig.AccessKey, basNumber, "", card_sn, "01", IdCardNo, "15", psn_info.PsnName)
25794
 					result, requestLog = service.Jxyb2201(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, miConfig.Url, miConfig.AccessKey, basNumber, "", card_sn, "01", IdCardNo, "15", psn_info.PsnName)
25830
 					saveLog(result, requestLog, "2201A", "挂号")
25795
 					saveLog(result, requestLog, "2201A", "挂号")