Browse Source

Merge branch 'master' of http://git.shengws.com/csx/gdyb

test_user 1 week ago
parent
commit
37a15c34d8
2 changed files with 257 additions and 353 deletions
  1. 204 265
      controllers/ah/ahyb_controller.go
  2. 53 88
      controllers/sg/his_api_controller.go

+ 204 - 265
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")
304
 	doctor_name := c.GetString("doctor_name")
290
 	doctor_name := c.GetString("doctor_name")
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
-	fmt.Println("Error decoding JSON:", verify_number)
308
-	fmt.Println("Error decoding JSON:", certNo)
309
-
310
-
311
 
293
 
312
-
313
-	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)
314
 	var response Response
295
 	var response Response
315
 	if err := json.Unmarshal([]byte(result), &response); err != nil {
296
 	if err := json.Unmarshal([]byte(result), &response); err != nil {
316
 		fmt.Println("Error decoding JSON:", err)
297
 		fmt.Println("Error decoding JSON:", err)
317
 		return
298
 		return
318
 	}
299
 	}
319
 
300
 
320
-
321
-	if  response.Code == 200{
301
+	if response.Code == 200 {
322
 
302
 
323
 		var dat2 map[string]interface{}
303
 		var dat2 map[string]interface{}
324
 		if err := json.Unmarshal([]byte(inputLog), &dat2); err == nil {
304
 		if err := json.Unmarshal([]byte(inputLog), &dat2); err == nil {
326
 
306
 
327
 		}
307
 		}
328
 		c.ServeSuccessJSON(map[string]interface{}{
308
 		c.ServeSuccessJSON(map[string]interface{}{
329
-			"pre": response.Body,
330
-			"log": dat2,
331
-			"status":"1",
332
-			"msg":"",
309
+			"pre":    response.Body,
310
+			"log":    dat2,
311
+			"status": "1",
312
+			"msg":    "",
333
 		})
313
 		})
334
 
314
 
335
-
336
-	}else{
315
+	} else {
337
 
316
 
338
 		c.ServeSuccessJSON(map[string]interface{}{
317
 		c.ServeSuccessJSON(map[string]interface{}{
339
-			"status":"0",
340
-			"msg":response.Message,
318
+			"status": "0",
319
+			"msg":    response.Message,
341
 		})
320
 		})
342
 
321
 
343
 	}
322
 	}
365
 		return
344
 		return
366
 	}
345
 	}
367
 
346
 
368
-
369
-	if  response.Code == 200{
347
+	if response.Code == 200 {
370
 
348
 
371
 		var dat2 map[string]interface{}
349
 		var dat2 map[string]interface{}
372
 		if err := json.Unmarshal([]byte(inputLog), &dat2); err == nil {
350
 		if err := json.Unmarshal([]byte(inputLog), &dat2); err == nil {
374
 
352
 
375
 		}
353
 		}
376
 		c.ServeSuccessJSON(map[string]interface{}{
354
 		c.ServeSuccessJSON(map[string]interface{}{
377
-			"pre": response.Body,
378
-			"log": dat2,
379
-			"status":"1",
380
-			"msg":"",
355
+			"pre":    response.Body,
356
+			"log":    dat2,
357
+			"status": "1",
358
+			"msg":    "",
381
 		})
359
 		})
382
 
360
 
383
-
384
-	}else{
361
+	} else {
385
 
362
 
386
 		c.ServeSuccessJSON(map[string]interface{}{
363
 		c.ServeSuccessJSON(map[string]interface{}{
387
-			"status":"0",
388
-			"msg":response.Message,
364
+			"status": "0",
365
+			"msg":    response.Message,
389
 		})
366
 		})
390
 
367
 
391
 	}
368
 	}
428
 	doctor_name := respJSON["doctor_name"].(string)
405
 	doctor_name := respJSON["doctor_name"].(string)
429
 	doctor_number := respJSON["doctor_number"].(string)
406
 	doctor_number := respJSON["doctor_number"].(string)
430
 
407
 
431
-
432
-
433
 	//cainfo := c.GetString("cainfo")
408
 	//cainfo := c.GetString("cainfo")
434
 
409
 
435
-	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)
436
 	saveJsLog(result, inputLog, "2203", "上传就诊信息", org_name)
411
 	saveJsLog(result, inputLog, "2203", "上传就诊信息", org_name)
437
 
412
 
438
 	var response Response
413
 	var response Response
441
 		return
416
 		return
442
 	}
417
 	}
443
 
418
 
444
-
445
-	if  response.Code == 200{
419
+	if response.Code == 200 {
446
 
420
 
447
 		var dat2 map[string]interface{}
421
 		var dat2 map[string]interface{}
448
 		if err := json.Unmarshal([]byte(inputLog), &dat2); err == nil {
422
 		if err := json.Unmarshal([]byte(inputLog), &dat2); err == nil {
450
 
424
 
451
 		}
425
 		}
452
 		c.ServeSuccessJSON(map[string]interface{}{
426
 		c.ServeSuccessJSON(map[string]interface{}{
453
-			"pre": response.Body,
454
-			"log": dat2,
455
-			"status":"1",
456
-			"msg":"",
427
+			"pre":    response.Body,
428
+			"log":    dat2,
429
+			"status": "1",
430
+			"msg":    "",
457
 		})
431
 		})
458
 
432
 
459
-
460
-	}else{
433
+	} else {
461
 
434
 
462
 		c.ServeSuccessJSON(map[string]interface{}{
435
 		c.ServeSuccessJSON(map[string]interface{}{
463
-			"status":"0",
464
-			"msg":response.Message,
436
+			"status": "0",
437
+			"msg":    response.Message,
465
 		})
438
 		})
466
 
439
 
467
 	}
440
 	}
468
 
441
 
469
 }
442
 }
470
 
443
 
471
-
472
 func (c *AHybController) Get2406() {
444
 func (c *AHybController) Get2406() {
473
 	body, _ := ioutil.ReadAll(c.Ctx.Request.Body)
445
 	body, _ := ioutil.ReadAll(c.Ctx.Request.Body)
474
 	var respJSON map[string]interface{}
446
 	var respJSON map[string]interface{}
490
 	mdtrtarea_admvs := respJSON["mdtrtarea_admvs"].(string)
462
 	mdtrtarea_admvs := respJSON["mdtrtarea_admvs"].(string)
491
 	url := respJSON["url"].(string)
463
 	url := respJSON["url"].(string)
492
 
464
 
493
-	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)
494
 	saveJsLog(result, inputLog, "2406", "上传2406信息", org_name)
466
 	saveJsLog(result, inputLog, "2406", "上传2406信息", org_name)
495
 	var response Response
467
 	var response Response
496
 	if err := json.Unmarshal([]byte(result), &response); err != nil {
468
 	if err := json.Unmarshal([]byte(result), &response); err != nil {
498
 		return
470
 		return
499
 	}
471
 	}
500
 
472
 
501
-
502
-	if  response.Code == 200{
473
+	if response.Code == 200 {
503
 
474
 
504
 		var dat2 map[string]interface{}
475
 		var dat2 map[string]interface{}
505
 		if err := json.Unmarshal([]byte(inputLog), &dat2); err == nil {
476
 		if err := json.Unmarshal([]byte(inputLog), &dat2); err == nil {
507
 
478
 
508
 		}
479
 		}
509
 		c.ServeSuccessJSON(map[string]interface{}{
480
 		c.ServeSuccessJSON(map[string]interface{}{
510
-			"pre": response.Body,
511
-			"log": dat2,
512
-			"status":"1",
513
-			"msg":"",
481
+			"pre":    response.Body,
482
+			"log":    dat2,
483
+			"status": "1",
484
+			"msg":    "",
514
 		})
485
 		})
515
 
486
 
516
-
517
-	}else{
487
+	} else {
518
 
488
 
519
 		c.ServeSuccessJSON(map[string]interface{}{
489
 		c.ServeSuccessJSON(map[string]interface{}{
520
-			"status":"0",
521
-			"msg":response.Message,
490
+			"status": "0",
491
+			"msg":    response.Message,
522
 		})
492
 		})
523
 
493
 
524
 	}
494
 	}
525
 
495
 
526
 }
496
 }
527
 
497
 
528
-
529
 type All struct {
498
 type All struct {
530
 	HisPrescription HisPrescription
499
 	HisPrescription HisPrescription
531
 	mdtrt_id        string
500
 	mdtrt_id        string
566
 	result, inputLog := service.AHyb2204(respJSON["psn_no"].(string), respJSON["mdtrt_id"].(string), hp, respJSON["chrg_bchno"].(string), respJSON["org_name"].(string),
535
 	result, inputLog := service.AHyb2204(respJSON["psn_no"].(string), respJSON["mdtrt_id"].(string), hp, respJSON["chrg_bchno"].(string), respJSON["org_name"].(string),
567
 		respJSON["doctor"].(string), respJSON["dept"].(string), respJSON["fixmedins_code"].(string), respJSON["dept_code"].(string), respJSON["doctor_id"].(string), respJSON["insuplc_admdvs"].(string), respJSON["mdtrtarea_admvs"].(string), respJSON["secret_key"].(string), respJSON["balance_accounts_type"].(string), respJSON["diag_code"].(string), respJSON["url"].(string), respJSON["ak"].(string), respJSON["new_doctor_name"].(string), "", respJSON["cainfo"].(string), respJSON["opter"].(string))
536
 		respJSON["doctor"].(string), respJSON["dept"].(string), respJSON["fixmedins_code"].(string), respJSON["dept_code"].(string), respJSON["doctor_id"].(string), respJSON["insuplc_admdvs"].(string), respJSON["mdtrtarea_admvs"].(string), respJSON["secret_key"].(string), respJSON["balance_accounts_type"].(string), respJSON["diag_code"].(string), respJSON["url"].(string), respJSON["ak"].(string), respJSON["new_doctor_name"].(string), "", respJSON["cainfo"].(string), respJSON["opter"].(string))
568
 
537
 
569
-
570
 	saveJsLog(result, inputLog, "2204", "上传明细", respJSON["org_name"].(string))
538
 	saveJsLog(result, inputLog, "2204", "上传明细", respJSON["org_name"].(string))
571
 	var response Response
539
 	var response Response
572
 	if err := json.Unmarshal([]byte(result), &response); err != nil {
540
 	if err := json.Unmarshal([]byte(result), &response); err != nil {
574
 		return
542
 		return
575
 	}
543
 	}
576
 
544
 
577
-
578
-	if  response.Code == 200{
545
+	if response.Code == 200 {
579
 
546
 
580
 		var dat2 map[string]interface{}
547
 		var dat2 map[string]interface{}
581
 		if err := json.Unmarshal([]byte(inputLog), &dat2); err == nil {
548
 		if err := json.Unmarshal([]byte(inputLog), &dat2); err == nil {
583
 
550
 
584
 		}
551
 		}
585
 		c.ServeSuccessJSON(map[string]interface{}{
552
 		c.ServeSuccessJSON(map[string]interface{}{
586
-			"pre": response.Body,
587
-			"log": dat2,
588
-			"status":"1",
589
-			"msg":"",
553
+			"pre":    response.Body,
554
+			"log":    dat2,
555
+			"status": "1",
556
+			"msg":    "",
590
 		})
557
 		})
591
 
558
 
592
-
593
-	}else{
559
+	} else {
594
 
560
 
595
 		c.ServeSuccessJSON(map[string]interface{}{
561
 		c.ServeSuccessJSON(map[string]interface{}{
596
-			"status":"0",
597
-			"msg":response.Message,
562
+			"status": "0",
563
+			"msg":    response.Message,
598
 		})
564
 		})
599
 
565
 
600
 	}
566
 	}
624
 		return
590
 		return
625
 	}
591
 	}
626
 
592
 
627
-
628
-	if  response.Code == 200{
593
+	if response.Code == 200 {
629
 
594
 
630
 		var dat2 map[string]interface{}
595
 		var dat2 map[string]interface{}
631
 		if err := json.Unmarshal([]byte(inputLog), &dat2); err == nil {
596
 		if err := json.Unmarshal([]byte(inputLog), &dat2); err == nil {
633
 
598
 
634
 		}
599
 		}
635
 		c.ServeSuccessJSON(map[string]interface{}{
600
 		c.ServeSuccessJSON(map[string]interface{}{
636
-			"pre": response.Body,
637
-			"log": dat2,
638
-			"status":"1",
639
-			"msg":"",
601
+			"pre":    response.Body,
602
+			"log":    dat2,
603
+			"status": "1",
604
+			"msg":    "",
640
 		})
605
 		})
641
 
606
 
642
-
643
-	}else{
607
+	} else {
644
 
608
 
645
 		c.ServeSuccessJSON(map[string]interface{}{
609
 		c.ServeSuccessJSON(map[string]interface{}{
646
-			"status":"0",
647
-			"msg":response.Message,
610
+			"status": "0",
611
+			"msg":    response.Message,
648
 		})
612
 		})
649
 
613
 
650
 	}
614
 	}
684
 		return
648
 		return
685
 	}
649
 	}
686
 
650
 
687
-
688
-	if  response.Code == 200{
651
+	if response.Code == 200 {
689
 
652
 
690
 		var dat2 map[string]interface{}
653
 		var dat2 map[string]interface{}
691
 		if err := json.Unmarshal([]byte(inputLog), &dat2); err == nil {
654
 		if err := json.Unmarshal([]byte(inputLog), &dat2); err == nil {
693
 
656
 
694
 		}
657
 		}
695
 		c.ServeSuccessJSON(map[string]interface{}{
658
 		c.ServeSuccessJSON(map[string]interface{}{
696
-			"pre": response.Body,
697
-			"log": dat2,
698
-			"status":"1",
699
-			"msg":"",
659
+			"pre":    response.Body,
660
+			"log":    dat2,
661
+			"status": "1",
662
+			"msg":    "",
700
 		})
663
 		})
701
 
664
 
702
-
703
-	}else{
665
+	} else {
704
 
666
 
705
 		c.ServeSuccessJSON(map[string]interface{}{
667
 		c.ServeSuccessJSON(map[string]interface{}{
706
-			"status":"0",
707
-			"msg":response.Message,
668
+			"status": "0",
669
+			"msg":    response.Message,
708
 		})
670
 		})
709
 
671
 
710
 	}
672
 	}
736
 	var result string
698
 	var result string
737
 	var inputLog string
699
 	var inputLog string
738
 
700
 
739
-
740
 	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)
741
 
702
 
742
 	saveJsLog(result, inputLog, "2207", "结算", org_name)
703
 	saveJsLog(result, inputLog, "2207", "结算", org_name)
746
 		return
707
 		return
747
 	}
708
 	}
748
 
709
 
749
-
750
-	if  response.Code == 200{
710
+	if response.Code == 200 {
751
 
711
 
752
 		var dat2 map[string]interface{}
712
 		var dat2 map[string]interface{}
753
 		if err := json.Unmarshal([]byte(inputLog), &dat2); err == nil {
713
 		if err := json.Unmarshal([]byte(inputLog), &dat2); err == nil {
755
 
715
 
756
 		}
716
 		}
757
 		c.ServeSuccessJSON(map[string]interface{}{
717
 		c.ServeSuccessJSON(map[string]interface{}{
758
-			"pre": response.Body,
759
-			"log": dat2,
760
-			"status":"1",
761
-			"msg":"",
718
+			"pre":    response.Body,
719
+			"log":    dat2,
720
+			"status": "1",
721
+			"msg":    "",
762
 		})
722
 		})
763
 
723
 
764
-
765
-	}else{
724
+	} else {
766
 
725
 
767
 		c.ServeSuccessJSON(map[string]interface{}{
726
 		c.ServeSuccessJSON(map[string]interface{}{
768
-			"status":"0",
769
-			"msg":response.Message,
727
+			"status": "0",
728
+			"msg":    response.Message,
770
 		})
729
 		})
771
 
730
 
772
 	}
731
 	}
793
 		return
752
 		return
794
 	}
753
 	}
795
 
754
 
796
-
797
-	if  response.Code == 200{
755
+	if response.Code == 200 {
798
 		var dat2 map[string]interface{}
756
 		var dat2 map[string]interface{}
799
 		if err := json.Unmarshal([]byte(inputLog), &dat2); err == nil {
757
 		if err := json.Unmarshal([]byte(inputLog), &dat2); err == nil {
800
 		} else {
758
 		} else {
801
 
759
 
802
 		}
760
 		}
803
 		c.ServeSuccessJSON(map[string]interface{}{
761
 		c.ServeSuccessJSON(map[string]interface{}{
804
-			"pre": response.Body,
805
-			"log": dat2,
806
-			"status":"1",
807
-			"msg":"",
762
+			"pre":    response.Body,
763
+			"log":    dat2,
764
+			"status": "1",
765
+			"msg":    "",
808
 		})
766
 		})
809
 
767
 
810
-	}else{
768
+	} else {
811
 
769
 
812
 		c.ServeSuccessJSON(map[string]interface{}{
770
 		c.ServeSuccessJSON(map[string]interface{}{
813
-			"status":"0",
814
-			"msg":response.Message,
771
+			"status": "0",
772
+			"msg":    response.Message,
815
 		})
773
 		})
816
 
774
 
817
 	}
775
 	}
856
 		return
814
 		return
857
 	}
815
 	}
858
 
816
 
859
-
860
-	if  response.Code == 200{
817
+	if response.Code == 200 {
861
 
818
 
862
 		var dat2 map[string]interface{}
819
 		var dat2 map[string]interface{}
863
 		if err := json.Unmarshal([]byte(inputLog), &dat2); err == nil {
820
 		if err := json.Unmarshal([]byte(inputLog), &dat2); err == nil {
865
 
822
 
866
 		}
823
 		}
867
 		c.ServeSuccessJSON(map[string]interface{}{
824
 		c.ServeSuccessJSON(map[string]interface{}{
868
-			"pre": response.Body,
869
-			"log": dat2,
870
-			"status":"1",
871
-			"msg":"",
825
+			"pre":    response.Body,
826
+			"log":    dat2,
827
+			"status": "1",
828
+			"msg":    "",
872
 		})
829
 		})
873
 
830
 
874
-
875
-	}else{
831
+	} else {
876
 
832
 
877
 		c.ServeSuccessJSON(map[string]interface{}{
833
 		c.ServeSuccessJSON(map[string]interface{}{
878
-			"status":"0",
879
-			"msg":response.Message,
834
+			"status": "0",
835
+			"msg":    response.Message,
880
 		})
836
 		})
881
 
837
 
882
 	}
838
 	}
932
 		return
888
 		return
933
 	}
889
 	}
934
 
890
 
935
-
936
-	if  response.Code == 200{
891
+	if response.Code == 200 {
937
 
892
 
938
 		var dat2 map[string]interface{}
893
 		var dat2 map[string]interface{}
939
 		if err := json.Unmarshal([]byte(inputLog), &dat2); err == nil {
894
 		if err := json.Unmarshal([]byte(inputLog), &dat2); err == nil {
941
 
896
 
942
 		}
897
 		}
943
 		c.ServeSuccessJSON(map[string]interface{}{
898
 		c.ServeSuccessJSON(map[string]interface{}{
944
-			"pre": response.Body,
945
-			"log": dat2,
946
-			"status":"1",
947
-			"msg":"",
899
+			"pre":    response.Body,
900
+			"log":    dat2,
901
+			"status": "1",
902
+			"msg":    "",
948
 		})
903
 		})
949
 
904
 
950
-
951
-	}else{
905
+	} else {
952
 
906
 
953
 		c.ServeSuccessJSON(map[string]interface{}{
907
 		c.ServeSuccessJSON(map[string]interface{}{
954
-			"status":"0",
955
-			"msg":response.Message,
908
+			"status": "0",
909
+			"msg":    response.Message,
956
 		})
910
 		})
957
 
911
 
958
 	}
912
 	}
991
 	Message string `json:"message"`
945
 	Message string `json:"message"`
992
 }
946
 }
993
 
947
 
994
-
995
-
996
 func (c *AHybController) ReadCard() {
948
 func (c *AHybController) ReadCard() {
997
 	fixmedins_code := c.GetString("fixmedins_code")
949
 	fixmedins_code := c.GetString("fixmedins_code")
998
 	secret_key := c.GetString("secret_key")
950
 	secret_key := c.GetString("secret_key")
1027
 		if len(pCardInfo) > 0 {
979
 		if len(pCardInfo) > 0 {
1028
 			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)
1029
 
981
 
1030
-
1031
 			var response Response
982
 			var response Response
1032
 			if err := json.Unmarshal([]byte(result), &response); err != nil {
983
 			if err := json.Unmarshal([]byte(result), &response); err != nil {
1033
 				fmt.Println("Error decoding JSON:", err)
984
 				fmt.Println("Error decoding JSON:", err)
1034
 				return
985
 				return
1035
 			}
986
 			}
1036
-			if  response.Code == 200{
987
+			if response.Code == 200 {
988
+
1037
 				c.ServeSuccessJSON(map[string]interface{}{
989
 				c.ServeSuccessJSON(map[string]interface{}{
1038
-					"status":         "0",
1039
-					"card_info":      pCardInfo,
1040
-					"result":         response.Body,
1041
-					"type":           "1",
990
+					"status":    "0",
991
+					"card_info": pCardInfo,
992
+					"result":    response.Body,
993
+					"type":      "1",
1042
 				})
994
 				})
1043
-			}else{
1044
-
995
+			} else {
1045
 				c.ServeSuccessJSON(map[string]interface{}{
996
 				c.ServeSuccessJSON(map[string]interface{}{
1046
-					"status":"0",
1047
-					"msg":response.Message,
997
+					"status": "0",
998
+					"msg":    response.Message,
1048
 				})
999
 				})
1049
 
1000
 
1050
 			}
1001
 			}
1114
 			fmt.Println(enc.ConvertString(userName))
1065
 			fmt.Println(enc.ConvertString(userName))
1115
 			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)
1116
 
1067
 
1117
-
1118
 			var response Response
1068
 			var response Response
1119
 			if err := json.Unmarshal([]byte(result), &response); err != nil {
1069
 			if err := json.Unmarshal([]byte(result), &response); err != nil {
1120
 				fmt.Println("Error decoding JSON:", err)
1070
 				fmt.Println("Error decoding JSON:", err)
1121
 				return
1071
 				return
1122
 			}
1072
 			}
1123
 
1073
 
1124
-
1125
-			if  response.Code == 200{
1074
+			if response.Code == 200 {
1126
 
1075
 
1127
 				c.ServeSuccessJSON(map[string]interface{}{
1076
 				c.ServeSuccessJSON(map[string]interface{}{
1128
-					"status":"1",
1077
+					"status":         "1",
1129
 					"card_info":      "",
1078
 					"card_info":      "",
1130
 					"busi_card_info": pBusiCardInfo,
1079
 					"busi_card_info": pBusiCardInfo,
1131
 					"token":          token,
1080
 					"token":          token,
1132
 					"result":         response.Body,
1081
 					"result":         response.Body,
1133
 				})
1082
 				})
1134
 
1083
 
1135
-			}else{
1084
+			} else {
1136
 
1085
 
1137
 				c.ServeSuccessJSON(map[string]interface{}{
1086
 				c.ServeSuccessJSON(map[string]interface{}{
1138
-					"status":"0",
1139
-					"msg":response.Message,
1087
+					"status": "0",
1088
+					"msg":    response.Message,
1140
 				})
1089
 				})
1141
 
1090
 
1142
 			}
1091
 			}
1143
 
1092
 
1144
-
1145
 		} else {
1093
 		} else {
1146
 			c.ServeSuccessJSON(map[string]interface{}{
1094
 			c.ServeSuccessJSON(map[string]interface{}{
1147
 				"status": "-1",
1095
 				"status": "-1",
1195
 	//initFlag = 1
1143
 	//initFlag = 1
1196
 	return
1144
 	return
1197
 }
1145
 }
1198
-func (c *AHybController) GetBasBaseInfo() (string) {
1146
+func (c *AHybController) GetBasBaseInfo() string {
1199
 	DllDef := syscall.MustLoadDLL("SSCardDriver.dll")
1147
 	DllDef := syscall.MustLoadDLL("SSCardDriver.dll")
1200
 	readCard := DllDef.MustFindProc("iReadCardBas")
1148
 	readCard := DllDef.MustFindProc("iReadCardBas")
1201
 	fmt.Println(readCard)
1149
 	fmt.Println(readCard)
1436
 	return "", string(receivedMessage)
1384
 	return "", string(receivedMessage)
1437
 }
1385
 }
1438
 
1386
 
1439
-
1440
-
1441
-
1442
-
1443
 func IntPtr(n int) uintptr {
1387
 func IntPtr(n int) uintptr {
1444
 	return uintptr(n)
1388
 	return uintptr(n)
1445
 }
1389
 }
1586
 		return
1530
 		return
1587
 	}
1531
 	}
1588
 
1532
 
1589
-
1590
-	if  response.Code == 200{
1533
+	if response.Code == 200 {
1591
 
1534
 
1592
 		var dat2 map[string]interface{}
1535
 		var dat2 map[string]interface{}
1593
 		if err := json.Unmarshal([]byte(inputLog), &dat2); err == nil {
1536
 		if err := json.Unmarshal([]byte(inputLog), &dat2); err == nil {
1595
 
1538
 
1596
 		}
1539
 		}
1597
 		c.ServeSuccessJSON(map[string]interface{}{
1540
 		c.ServeSuccessJSON(map[string]interface{}{
1598
-			"pre": response.Body,
1599
-			"log": dat2,
1600
-			"status":1,
1601
-			"msg":"",
1541
+			"pre":    response.Body,
1542
+			"log":    dat2,
1543
+			"status": 1,
1544
+			"msg":    "",
1602
 		})
1545
 		})
1603
 
1546
 
1604
-
1605
-	}else{
1547
+	} else {
1606
 
1548
 
1607
 		c.ServeSuccessJSON(map[string]interface{}{
1549
 		c.ServeSuccessJSON(map[string]interface{}{
1608
-			"status":0,
1609
-			"msg":response.Message,
1550
+			"status": 0,
1551
+			"msg":    response.Message,
1610
 		})
1552
 		})
1611
 
1553
 
1612
 	}
1554
 	}
1665
 		return
1607
 		return
1666
 	}
1608
 	}
1667
 
1609
 
1668
-	if  response.Code == 200{
1610
+	if response.Code == 200 {
1669
 		c.ServeSuccessJSON(map[string]interface{}{
1611
 		c.ServeSuccessJSON(map[string]interface{}{
1670
-			"pre": response.Body,
1671
-			"status":1,
1672
-			"msg":"",
1612
+			"pre":    response.Body,
1613
+			"status": 1,
1614
+			"msg":    "",
1673
 		})
1615
 		})
1674
 
1616
 
1675
-
1676
-	}else{
1617
+	} else {
1677
 
1618
 
1678
 		c.ServeSuccessJSON(map[string]interface{}{
1619
 		c.ServeSuccessJSON(map[string]interface{}{
1679
-			"status":0,
1680
-			"msg":response.Message,
1620
+			"status": 0,
1621
+			"msg":    response.Message,
1681
 		})
1622
 		})
1682
 
1623
 
1683
 	}
1624
 	}
1711
 		return
1652
 		return
1712
 	}
1653
 	}
1713
 
1654
 
1714
-
1715
-	if  response.Code == 200{
1655
+	if response.Code == 200 {
1716
 
1656
 
1717
 		var dat2 map[string]interface{}
1657
 		var dat2 map[string]interface{}
1718
 		if err := json.Unmarshal([]byte(inputLog), &dat2); err == nil {
1658
 		if err := json.Unmarshal([]byte(inputLog), &dat2); err == nil {
1720
 
1660
 
1721
 		}
1661
 		}
1722
 		c.ServeSuccessJSON(map[string]interface{}{
1662
 		c.ServeSuccessJSON(map[string]interface{}{
1723
-			"pre": response.Body,
1724
-			"log": dat2,
1725
-			"status":1,
1726
-			"msg":"",
1663
+			"pre":    response.Body,
1664
+			"log":    dat2,
1665
+			"status": 1,
1666
+			"msg":    "",
1727
 		})
1667
 		})
1728
 
1668
 
1729
-
1730
-	}else{
1669
+	} else {
1731
 
1670
 
1732
 		c.ServeSuccessJSON(map[string]interface{}{
1671
 		c.ServeSuccessJSON(map[string]interface{}{
1733
-			"status":0,
1734
-			"msg":response.Message,
1672
+			"status": 0,
1673
+			"msg":    response.Message,
1735
 		})
1674
 		})
1736
 
1675
 
1737
 	}
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")
4653
 	recordEndTime := theEndTime.Unix()
4646
 	recordEndTime := theEndTime.Unix()
4654
 
4647
 
4655
 	//timestamp := int64(1729612800)
4648
 	//timestamp := int64(1729612800)
4656
-	flows, _ := service.GetNewDrugFlowInforTenone(recordStartTime,recordEndTime,c.GetAdminUserInfo().CurrentOrgId)
4649
+	flows, _ := service.GetNewDrugFlowInforTenone(recordStartTime, recordEndTime, c.GetAdminUserInfo().CurrentOrgId)
4657
 	admin_user_id, _ := c.GetInt64("admin_user_id")
4650
 	admin_user_id, _ := c.GetInt64("admin_user_id")
4658
 	roles, _ := service.GetAdminUserInfoByID(c.GetAdminUserInfo().CurrentOrgId, admin_user_id)
4651
 	roles, _ := service.GetAdminUserInfoByID(c.GetAdminUserInfo().CurrentOrgId, admin_user_id)
4659
 	miConfig, _ := service.FindMedicalInsuranceInfo(c.GetAdminUserInfo().CurrentOrgId)
4652
 	miConfig, _ := service.FindMedicalInsuranceInfo(c.GetAdminUserInfo().CurrentOrgId)
4673
 				//已经结算
4666
 				//已经结算
4674
 				//判断 是否已经销售
4667
 				//判断 是否已经销售
4675
 				//if item.IsSale == 1 { //是否已经销售,1是   0否
4668
 				//if item.IsSale == 1 { //是否已经销售,1是   0否
4676
-					////是否已经变更 1是  0否
4677
-					//if item.IsChange == 0 { //没变更,进行变更操作
4678
-					//	bg_number := strconv.FormatInt(time.Now().Unix(), 10) + "-" + strconv.FormatInt(item.ID, 10) + "-" + "3502"
4679
-					//
4680
-					//	result, result2 := ChangeStock(item.Count, item, miConfig, "102", roles, bg_number)
4681
-					//	saveLog(result, result2, "3502", "自动出库,已经销售,未变更3502")
4682
-					//	var respJSON3 map[string]interface{}
4683
-					//	if err := json.Unmarshal([]byte(string(result)), &respJSON3); err != nil {
4684
-					//		utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
4685
-					//		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
4686
-					//		return
4687
-					//	}
4688
-					//	userJSONBytes3, _ := json.Marshal(respJSON3)
4689
-					//	if err := json.Unmarshal(userJSONBytes3, &res3); err != nil {
4690
-					//		utils.ErrorLog("解析失败:%v", err)
4691
-					//		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
4692
-					//		return
4693
-					//	}
4694
-					//	if res3.Infcode == 0 {
4695
-					//		item.IsChange = 1
4696
-					//		item.BgBchno = bg_number
4697
-					//		service.SaveDF2(item)
4698
-					//	} else {
4699
-					//		err = append(err, item.HisDoctorAdviceInfo.AdviceName+",销售变更失败:"+res3.ErrMsg)
4700
-					//	}
4701
-					//}
4669
+				////是否已经变更 1是  0否
4670
+				//if item.IsChange == 0 { //没变更,进行变更操作
4671
+				//	bg_number := strconv.FormatInt(time.Now().Unix(), 10) + "-" + strconv.FormatInt(item.ID, 10) + "-" + "3502"
4672
+				//
4673
+				//	result, result2 := ChangeStock(item.Count, item, miConfig, "102", roles, bg_number)
4674
+				//	saveLog(result, result2, "3502", "自动出库,已经销售,未变更3502")
4675
+				//	var respJSON3 map[string]interface{}
4676
+				//	if err := json.Unmarshal([]byte(string(result)), &respJSON3); err != nil {
4677
+				//		utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
4678
+				//		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
4679
+				//		return
4680
+				//	}
4681
+				//	userJSONBytes3, _ := json.Marshal(respJSON3)
4682
+				//	if err := json.Unmarshal(userJSONBytes3, &res3); err != nil {
4683
+				//		utils.ErrorLog("解析失败:%v", err)
4684
+				//		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
4685
+				//		return
4686
+				//	}
4687
+				//	if res3.Infcode == 0 {
4688
+				//		item.IsChange = 1
4689
+				//		item.BgBchno = bg_number
4690
+				//		service.SaveDF2(item)
4691
+				//	} else {
4692
+				//		err = append(err, item.HisDoctorAdviceInfo.AdviceName+",销售变更失败:"+res3.ErrMsg)
4693
+				//	}
4694
+				//}
4702
 
4695
 
4703
 				//} else
4696
 				//} else
4704
-				if item.IsSale == 0{ //没销售,
4697
+				if item.IsSale == 0 { //没销售,
4705
 					var res FJ3507Result
4698
 					var res FJ3507Result
4706
 					var res3507for10188 FJ3507ResultFor10188
4699
 					var res3507for10188 FJ3507ResultFor10188
4707
 					number := strconv.FormatInt(time.Now().Unix(), 10) + "-" + strconv.FormatInt(item.ID, 10) + "-" + "3505"
4700
 					number := strconv.FormatInt(time.Now().Unix(), 10) + "-" + strconv.FormatInt(item.ID, 10) + "-" + "3505"
5037
 	}
5030
 	}
5038
 }
5031
 }
5039
 
5032
 
5040
-
5041
-func  ChangeDrugTenone() {
5033
+func ChangeDrugTenone() {
5042
 
5034
 
5043
 	//ids := c.GetString("ids")
5035
 	//ids := c.GetString("ids")
5044
 	//id_arr := strings.Split(ids, ",")
5036
 	//id_arr := strings.Split(ids, ",")
5045
 	now := time.Now()
5037
 	now := time.Now()
5046
 	timestamp := time.Date(now.Year(), now.Month(), now.Day(), 0, 0, 0, 0, time.Local).Unix()
5038
 	timestamp := time.Date(now.Year(), now.Month(), now.Day(), 0, 0, 0, 0, time.Local).Unix()
5047
 	//timestamp := int64(1729612800)
5039
 	//timestamp := int64(1729612800)
5048
-	flows, _ := service.GetNewDrugFlowInforTen(timestamp,10188)
5040
+	flows, _ := service.GetNewDrugFlowInforTen(timestamp, 10188)
5049
 
5041
 
5050
 	admin_user_id := int64(2463)
5042
 	admin_user_id := int64(2463)
5051
 	roles, _ := service.GetAdminUserInfoByID(10188, admin_user_id)
5043
 	roles, _ := service.GetAdminUserInfoByID(10188, admin_user_id)
5107
 						return
5099
 						return
5108
 					}
5100
 					}
5109
 					userJSONBytes3, _ := json.Marshal(respJSON3)
5101
 					userJSONBytes3, _ := json.Marshal(respJSON3)
5110
-					 {
5102
+					{
5111
 						if err := json.Unmarshal(userJSONBytes3, &res3507for10188); err != nil {
5103
 						if err := json.Unmarshal(userJSONBytes3, &res3507for10188); err != nil {
5112
 							utils.ErrorLog("解析失败:%v", err)
5104
 							utils.ErrorLog("解析失败:%v", err)
5113
 							return
5105
 							return
5142
 									return
5134
 									return
5143
 								}
5135
 								}
5144
 
5136
 
5145
-							  {
5137
+								{
5146
 									if err := json.Unmarshal(userJSONBytes3, &res3507for10188); err != nil {
5138
 									if err := json.Unmarshal(userJSONBytes3, &res3507for10188); err != nil {
5147
 										utils.ErrorLog("解析失败:%v", err)
5139
 										utils.ErrorLog("解析失败:%v", err)
5148
 										return
5140
 										return
5179
 
5171
 
5180
 }
5172
 }
5181
 
5173
 
5182
-
5183
 func ChangeStock(count int64, drug *models.DrugFlow, miConfig models.MedicalInsuranceOrgConfig, chgType string, role models.UserAdminRole, number string) (string, string) {
5174
 func ChangeStock(count int64, drug *models.DrugFlow, miConfig models.MedicalInsuranceOrgConfig, chgType string, role models.UserAdminRole, number string) (string, string) {
5184
 	var struct3502 models.Struct3502
5175
 	var struct3502 models.Struct3502
5185
 	struct3502.MedListCodg = drug.HisDoctorAdviceInfo.BaseDrugLib.MedicalInsuranceNumber
5176
 	struct3502.MedListCodg = drug.HisDoctorAdviceInfo.BaseDrugLib.MedicalInsuranceNumber
5438
 		struct3505.PharPracCertNo = "2015026440262015440501001198"
5429
 		struct3505.PharPracCertNo = "2015026440262015440501001198"
5439
 	}
5430
 	}
5440
 
5431
 
5441
-
5442
-
5443
 	if org_id == 9919 {
5432
 	if org_id == 9919 {
5444
 		struct3505.PharName = "周君权"
5433
 		struct3505.PharName = "周君权"
5445
 		struct3505.PharPracCertNo = "089644396094401375"
5434
 		struct3505.PharPracCertNo = "089644396094401375"
5446
 	}
5435
 	}
5447
 
5436
 
5448
-
5449
 	if org_id == 10644 {
5437
 	if org_id == 10644 {
5450
 		struct3505.PharName = "陈金娣"
5438
 		struct3505.PharName = "陈金娣"
5451
 		struct3505.PharPracCertNo = "20181441500320100066"
5439
 		struct3505.PharPracCertNo = "20181441500320100066"
5511
 	} else if strings.HasPrefix(miConfig.MdtrtareaAdmvs[0:3], "440") {
5499
 	} else if strings.HasPrefix(miConfig.MdtrtareaAdmvs[0:3], "440") {
5512
 		result1, result2 := service.Gdyb3505(struct3505, struct3505.SecretKey)
5500
 		result1, result2 := service.Gdyb3505(struct3505, struct3505.SecretKey)
5513
 		return result1, result2
5501
 		return result1, result2
5514
-	}else if strings.HasPrefix(miConfig.MdtrtareaAdmvs[0:3], "361") {
5515
-		result1, result2 := service.JXyb3505(struct3505, struct3505.SecretKey,struct3505.AccessKey,struct3505.RequestUrl)
5502
+	} else if strings.HasPrefix(miConfig.MdtrtareaAdmvs[0:3], "361") {
5503
+		result1, result2 := service.JXyb3505(struct3505, struct3505.SecretKey, struct3505.AccessKey, struct3505.RequestUrl)
5516
 		return result1, result2
5504
 		return result1, result2
5517
-	}else if miConfig.MdtrtareaAdmvs == "340699" {
5518
-		result1, result2 := service.AHyb3505(struct3505, struct3505.SecretKey,struct3505.RequestUrl)
5505
+	} else if miConfig.MdtrtareaAdmvs == "340699" {
5506
+		result1, result2 := service.AHyb3505(struct3505, struct3505.SecretKey, struct3505.RequestUrl)
5519
 		return result1, result2
5507
 		return result1, result2
5520
 	} else {
5508
 	} else {
5521
 		data := make(map[string]interface{})
5509
 		data := make(map[string]interface{})
14532
 
14520
 
14533
 		} else if miConfig.MdtrtareaAdmvs == "361025" {
14521
 		} else if miConfig.MdtrtareaAdmvs == "361025" {
14534
 
14522
 
14535
-
14536
 			basStr := c.GetBasBaseInfo1111()
14523
 			basStr := c.GetBasBaseInfo1111()
14537
 			fmt.Println(basStr)
14524
 			fmt.Println(basStr)
14538
 
14525
 
15293
 
15280
 
15294
 					respJSON = respJSON["data"].(map[string]interface{})["result"].(map[string]interface{})
15281
 					respJSON = respJSON["data"].(map[string]interface{})["result"].(map[string]interface{})
15295
 					result, _ := json.Marshal(respJSON)
15282
 					result, _ := json.Marshal(respJSON)
15296
-
15283
+					fmt.Println(result)
15297
 					if err := json.Unmarshal([]byte(result), &res); err != nil {
15284
 					if err := json.Unmarshal([]byte(result), &res); err != nil {
15298
 						utils.ErrorLog("解析失败:%v", err)
15285
 						utils.ErrorLog("解析失败:%v", err)
15299
 						c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
15286
 						c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
15300
 						return
15287
 						return
15301
 					}
15288
 					}
15302
-
15289
+					fmt.Println(res)
15303
 				} else {
15290
 				} else {
15304
 					token = respJSON["data"].(map[string]interface{})["token"].(string)
15291
 					token = respJSON["data"].(map[string]interface{})["token"].(string)
15305
 					respJSON = respJSON["data"].(map[string]interface{})["result"].(map[string]interface{})
15292
 					respJSON = respJSON["data"].(map[string]interface{})["result"].(map[string]interface{})
15337
 								PatientId: patient.ID,
15324
 								PatientId: patient.ID,
15338
 								Certno:    res.Output.Baseinfo.Certno,
15325
 								Certno:    res.Output.Baseinfo.Certno,
15339
 
15326
 
15340
-								Gend:         res.Output.Baseinfo.Gend,
15341
-								Naty:         res.Output.Baseinfo.Naty,
15342
-								PsnCertType:  res.Output.Baseinfo.PsnCertType,
15343
-								PsnName:      res.Output.Baseinfo.PsnName,
15344
-								Idetinfo:     idetinfoStr,
15345
-								Insuinfo:     infoStr,
15346
-								UserOrgId:    c.GetAdminUserInfo().CurrentOrgId,
15347
-								CardInfo:     card_info,
15327
+								Gend:        res.Output.Baseinfo.Gend,
15328
+								Naty:        res.Output.Baseinfo.Naty,
15329
+								PsnCertType: res.Output.Baseinfo.PsnCertType,
15330
+								PsnName:     res.Output.Baseinfo.PsnName,
15331
+								Idetinfo:    idetinfoStr,
15332
+								Insuinfo:    infoStr,
15333
+								UserOrgId:   c.GetAdminUserInfo().CurrentOrgId,
15334
+								CardInfo:    card_info,
15348
 								//VerifyNumber: busi_card_info,
15335
 								//VerifyNumber: busi_card_info,
15349
 							}
15336
 							}
15350
 							service.CreateHisPsn(psn)
15337
 							service.CreateHisPsn(psn)
15430
 				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeHisFailedException)
15417
 				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeHisFailedException)
15431
 				return
15418
 				return
15432
 			}
15419
 			}
15433
-		}  else {
15420
+		} else {
15434
 			if initFlag == 0 {
15421
 			if initFlag == 0 {
15435
 				c.TestGetBasBaseInit()
15422
 				c.TestGetBasBaseInit()
15436
 			}
15423
 			}
18759
 	str1 := make([]byte, 1024)
18746
 	str1 := make([]byte, 1024)
18760
 	ret2, _, _ := readCard.Call((uintptr)(unsafe.Pointer(&str[0])), uintptr(1024), (uintptr)(unsafe.Pointer(&str1[0])), uintptr(1024))
18747
 	ret2, _, _ := readCard.Call((uintptr)(unsafe.Pointer(&str[0])), uintptr(1024), (uintptr)(unsafe.Pointer(&str1[0])), uintptr(1024))
18761
 
18748
 
18762
-
18763
-
18764
 	fmt.Println(string(str1))
18749
 	fmt.Println(string(str1))
18765
 	fmt.Println(string(str))
18750
 	fmt.Println(string(str))
18766
 	fmt.Println(":", ConvertToString(string(str1), "gbk", "utf-8"))
18751
 	fmt.Println(":", ConvertToString(string(str1), "gbk", "utf-8"))
18769
 		return ""
18754
 		return ""
18770
 	}
18755
 	}
18771
 
18756
 
18772
-
18773
-
18774
-
18775
-
18776
 	return string(str)
18757
 	return string(str)
18777
 }
18758
 }
18778
 
18759
 
18779
-
18780
 type Program struct {
18760
 type Program struct {
18781
 	FunctionID string `xml:"function_id"`
18761
 	FunctionID string `xml:"function_id"`
18782
 	CardInfo   string `xml:"cardinfo"`
18762
 	CardInfo   string `xml:"cardinfo"`
18798
 		readCard2 = DllDef.MustFindProc("ReadCardInfo")
18778
 		readCard2 = DllDef.MustFindProc("ReadCardInfo")
18799
 	}
18779
 	}
18800
 
18780
 
18801
-
18802
 	str := make([]byte, 1024)
18781
 	str := make([]byte, 1024)
18803
 	str1 := make([]byte, 1024)
18782
 	str1 := make([]byte, 1024)
18804
-	 readCard.Call((uintptr)(unsafe.Pointer(&str[0])), (uintptr)(unsafe.Pointer(&str1[0])))
18805
-
18783
+	readCard.Call((uintptr)(unsafe.Pointer(&str[0])), (uintptr)(unsafe.Pointer(&str1[0])))
18806
 
18784
 
18807
 	str3 := make([]byte, 1024)
18785
 	str3 := make([]byte, 1024)
18808
 	str4 := make([]byte, 1024)
18786
 	str4 := make([]byte, 1024)
18853
 	//fmt.Printf("  <user>%s</user>\n", lastProgram.User)
18831
 	//fmt.Printf("  <user>%s</user>\n", lastProgram.User)
18854
 	//fmt.Printf("</program>\n")
18832
 	//fmt.Printf("</program>\n")
18855
 
18833
 
18856
-
18857
-
18858
 	fmt.Println(":", ConvertToString(string(str1), "gbk", "utf-8"))
18834
 	fmt.Println(":", ConvertToString(string(str1), "gbk", "utf-8"))
18859
 	fmt.Println(":", ConvertToString(string(str), "gbk", "utf-8"))
18835
 	fmt.Println(":", ConvertToString(string(str), "gbk", "utf-8"))
18860
 	fmt.Println(":", ConvertToString(string(str3), "gbk", "utf-8"))
18836
 	fmt.Println(":", ConvertToString(string(str3), "gbk", "utf-8"))
18861
 	fmt.Println(":", ConvertToString(string(str4), "gbk", "utf-8"))
18837
 	fmt.Println(":", ConvertToString(string(str4), "gbk", "utf-8"))
18862
 
18838
 
18863
-
18864
-
18865
 	return ConvertToString(string(str), "gbk", "utf-8")
18839
 	return ConvertToString(string(str), "gbk", "utf-8")
18866
 }
18840
 }
18867
 
18841
 
18868
-
18869
-
18870
-
18871
 func (c *HisApiController) GetahBasBaseInfo() string {
18842
 func (c *HisApiController) GetahBasBaseInfo() string {
18872
 	DllDef := syscall.MustLoadDLL("SSCardDriver.dll")
18843
 	DllDef := syscall.MustLoadDLL("SSCardDriver.dll")
18873
 	readCard := DllDef.MustFindProc("iReadCardBas")
18844
 	readCard := DllDef.MustFindProc("iReadCardBas")
18880
 	str1 := make([]byte, 1024)
18851
 	str1 := make([]byte, 1024)
18881
 	ret2, _, _ := readCard.Call(uintptr(3), (uintptr)(unsafe.Pointer(&str1[0])))
18852
 	ret2, _, _ := readCard.Call(uintptr(3), (uintptr)(unsafe.Pointer(&str1[0])))
18882
 
18853
 
18883
-
18884
-
18885
 	//file, err := os.Open("C:\\Users\\Administrator\\Desktop\\11\\Power-Card\\SSCardDriver\\api.log")
18854
 	//file, err := os.Open("C:\\Users\\Administrator\\Desktop\\11\\Power-Card\\SSCardDriver\\api.log")
18886
 	//if err != nil {
18855
 	//if err != nil {
18887
 	//	fmt.Println("Error opening file:", err)
18856
 	//	fmt.Println("Error opening file:", err)
18927
 	//fmt.Printf("  <user>%s</user>\n", lastProgram.User)
18896
 	//fmt.Printf("  <user>%s</user>\n", lastProgram.User)
18928
 	//fmt.Printf("</program>\n")
18897
 	//fmt.Printf("</program>\n")
18929
 
18898
 
18930
-
18931
 	fmt.Println(string(str1))
18899
 	fmt.Println(string(str1))
18932
 	fmt.Println(":", ConvertToString(string(str1), "gbk", "utf-8"))
18900
 	fmt.Println(":", ConvertToString(string(str1), "gbk", "utf-8"))
18933
 
18901
 
18935
 		return ""
18903
 		return ""
18936
 	}
18904
 	}
18937
 
18905
 
18938
-
18939
 	return string(str1)
18906
 	return string(str1)
18940
 }
18907
 }
18941
 
18908
 
18942
-
18943
-
18944
 func (c *HisApiController) GetFjBasBaseInfo() (string, string, string, string, string) {
18909
 func (c *HisApiController) GetFjBasBaseInfo() (string, string, string, string, string) {
18945
 	DllDef := syscall.MustLoadDLL("chs_fjs_standard.dll")
18910
 	DllDef := syscall.MustLoadDLL("chs_fjs_standard.dll")
18946
 	readCard := DllDef.MustFindProc("read_cardinfo")
18911
 	readCard := DllDef.MustFindProc("read_cardinfo")
25194
 
25159
 
25195
 			}
25160
 			}
25196
 
25161
 
25197
-		} else if miConfig.MdtrtareaAdmvs == "341203" ||  miConfig.MdtrtareaAdmvs == "340699" {
25162
+		} else if miConfig.MdtrtareaAdmvs == "341203" || miConfig.MdtrtareaAdmvs == "340699" {
25198
 			psn_info, _ := service.GetPsnByPatientId(id)
25163
 			psn_info, _ := service.GetPsnByPatientId(id)
25199
 			PsnNo = psn_info.PsnNo
25164
 			PsnNo = psn_info.PsnNo
25200
 			PsnCertType = psn_info.PsnCertType
25165
 			PsnCertType = psn_info.PsnCertType
25977
 				if id_card_type == 1 {
25942
 				if id_card_type == 1 {
25978
 					bas := strings.Split(psn_info.CardInfo, "|")
25943
 					bas := strings.Split(psn_info.CardInfo, "|")
25979
 					basNumber := bas[2]
25944
 					basNumber := bas[2]
25980
-					card_sn :=""
25945
+					card_sn := ""
25981
 
25946
 
25982
 					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)
25947
 					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)
25983
 					saveLog(result, requestLog, "2201A", "挂号")
25948
 					saveLog(result, requestLog, "2201A", "挂号")