csx 4 years ago
parent
commit
3bed60e159
2 changed files with 287 additions and 267 deletions
  1. 286 264
      controllers/sg/his_api_controller.go
  2. 1 3
      routers/router.go

+ 286 - 264
controllers/sg/his_api_controller.go View File

@@ -15,10 +15,12 @@ import (
15 15
 	"github.com/shopspring/decimal"
16 16
 	"io"
17 17
 	"io/ioutil"
18
+	"log"
18 19
 	"math/rand"
19 20
 	"net/http"
20 21
 	"os"
21 22
 	"path/filepath"
23
+	"runtime"
22 24
 	"strconv"
23 25
 	"strings"
24 26
 	"syscall"
@@ -39,7 +41,7 @@ func HisManagerApiRegistRouters() {
39 41
 	beego.Router("/api/checkaccount/get", &HisApiController{}, "get:GetCheckAccount")
40 42
 	beego.Router("/api/checkdetailaccount/get", &HisApiController{}, "get:GetCheckDetailAccount")
41 43
 	beego.Router("/api/refund/post", &HisApiController{}, "get:Refund")
42
-	beego.Router("/api/sscard", &HisApiController{}, "get:Sscard")
44
+	//beego.Router("/api/sscard", &HisApiController{}, "get:Sscard")
43 45
 	beego.Router("/api/refundnumber/post", &HisApiController{}, "get:RefundNumber")
44 46
 	beego.Router("/api/refunddetail/post", &HisApiController{}, "get:RefundDetail")
45 47
 	beego.Router("/api/treatment/check", &HisApiController{}, "get:CheckTreatment")
@@ -51,14 +53,37 @@ func HisManagerApiRegistRouters() {
51 53
 }
52 54
 
53 55
 var (
54
-	DllDef = syscall.MustLoadDLL("SSCard.dll")
55
-	Iinit = DllDef.MustFindProc("Init")
56
+	DllDef   = syscall.MustLoadDLL("SSCard.dll")
57
+	Iinit    = DllDef.MustFindProc("Init")
56 58
 	readCard = DllDef.MustFindProc("ReadCardBas")
57
-	str = make([]byte, 256)
58
-	str1 = make([]byte, 256)
59
+	str      = make([]byte, 256)
60
+	str1     = make([]byte, 256)
59 61
 )
60 62
 
61
-func (c *HisApiController)TestGetBasBaseInfo() {
63
+func PrintErr() {
64
+	if err := recover(); err != nil {
65
+		file, ferr := os.Create("panic.log")
66
+		if ferr != nil {
67
+			fmt.Println("无法输出panic.log文件", ferr.Error())
68
+			return
69
+		}
70
+		defer file.Close()
71
+		g := log.New(file, "panic:", 0)
72
+		g.Printf("panic at %v", time.Now())
73
+		g.Printf("%v", err)
74
+		fmt.Printf("%v\r\n", err)
75
+		for i := 0; i < 10; i++ {
76
+			funcName, file, line, ok := runtime.Caller(i)
77
+			if ok {
78
+				fmt.Printf("[func:%v,file:%v,line:%v]\n", runtime.FuncForPC(funcName).Name(), file, line)
79
+				g.Printf("[func:%v,file:%v,line:%v]\n", runtime.FuncForPC(funcName).Name(), file, line)
80
+			}
81
+		}
82
+	}
83
+}
84
+
85
+func (c *HisApiController) TestGetBasBaseInfo() {
86
+	defer PrintErr()
62 87
 	ret, _, err := Iinit.Call(StrPtr("http://igb.hsa.gdgov.cn/gdyb_inf/poc/api/card/initDll"), StrPtr("440200"))
63 88
 	if ret != 0 {
64 89
 		fmt.Println("SSCard的报错原因:", err)
@@ -66,11 +91,10 @@ func (c *HisApiController)TestGetBasBaseInfo() {
66 91
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeReadCardException)
67 92
 		return
68 93
 	}
69
-	
94
+
70 95
 	result := int(ret)
71 96
 	fmt.Println("SSCard的运算结果为1:", result)
72 97
 
73
-	
74 98
 	if readCard == nil {
75 99
 		fmt.Println("readcard is nil")
76 100
 		readCard = DllDef.MustFindProc("ReadCardBas")
@@ -81,7 +105,7 @@ func (c *HisApiController)TestGetBasBaseInfo() {
81 105
 	}
82 106
 
83 107
 	str = nil
84
-	str1 = nil 
108
+	str1 = nil
85 109
 	str = make([]byte, 256)
86 110
 	str1 = make([]byte, 256)
87 111
 	ret2, _, err2 := readCard.Call((uintptr)(unsafe.Pointer(&str[0])), IntPtr(256), (uintptr)(unsafe.Pointer(&str1[0])), IntPtr(256))
@@ -89,7 +113,7 @@ func (c *HisApiController)TestGetBasBaseInfo() {
89 113
 	fmt.Println(" str:", str)
90 114
 	fmt.Println(" str1:", str1)
91 115
 	str = nil
92
-	str1 = nil 
116
+	str1 = nil
93 117
 	str = make([]byte, 256)
94 118
 	str1 = make([]byte, 256)
95 119
 	runtime.GC()
@@ -99,10 +123,8 @@ func (c *HisApiController)TestGetBasBaseInfo() {
99 123
 		return
100 124
 	}
101 125
 
102
-	
103 126
 }
104 127
 
105
-
106 128
 func (c *HisApiController) GetOrgInfo() {
107 129
 	miConfig, _ := service.FindMedicalInsuranceInfo(9919)
108 130
 	service.Gdyb1201("", miConfig.OrgName, "1122", miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, 1, "")
@@ -194,256 +216,256 @@ func (c *HisApiController) GetHisPatientInfo() {
194 216
 
195 217
 }
196 218
 
197
-func (c *HisApiController) Sscard() {
198
-	id_card_type, _ := c.GetInt64("id_card_type")
199
-	adminUser := c.GetAdminUserInfo()
200
-	miConfig, _ := service.FindMedicalInsuranceInfo(adminUser.CurrentOrgId)
201
-
202
-	r := CardInit()
203
-	fmt.Println(r)
204
-	//if r == 0 {
205
-	switch id_card_type {
206
-	case 1:
207
-		basStr, err := GetBasBaseInfo()
208
-
209
-		if err != nil {
210
-			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeReadCardException)
211
-			return
212
-
213
-		} else {
214
-			fmt.Println(basStr)
215
-
216
-			bas := strings.Split(basStr, "|")
217
-
218
-			basNumber := bas[1]
219
-
220
-			//basNumber := bas[2]
221
-			card_sn := bas[3]
222
-
223
-			appRole, _ := service.GetAppRole(adminUser.CurrentOrgId)
224
-
225
-			api := "http://127.0.0.1:9532/" + "gdyb/one?cert_no=" + basNumber + "&org_name=" + miConfig.OrgName + "&doctor=" + appRole.UserName + "&fixmedins_code=" + miConfig.Code + "&insuplc_admdvs=" + miConfig.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey + "&id_card_type=" + strconv.FormatInt(int64(id_card_type), 10) + "&card_sn=" + card_sn
226
-			resp, requestErr := http.Get(api)
227
-			if requestErr != nil {
228
-				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
229
-				return
230
-			}
231
-			defer resp.Body.Close()
232
-			body, ioErr := ioutil.ReadAll(resp.Body)
233
-			if ioErr != nil {
234
-				utils.ErrorLog("接口返回数据读取失败: %v", ioErr)
235
-				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
236
-				return
237
-			}
238
-			var respJSON map[string]interface{}
239
-
240
-			if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
241
-				utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
242
-				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
243
-				return
244
-			}
245
-
246
-			userJSON := respJSON["data"].(map[string]interface{})["pre"].(map[string]interface{})
247
-			userJSONBytes, _ := json.Marshal(userJSON)
248
-			var res ResultTwo
249
-			if err := json.Unmarshal(userJSONBytes, &res); err != nil {
250
-				utils.ErrorLog("解析失败:%v", err)
251
-				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
252
-				return
253
-			}
254
-			Iinfos, _ := json.Marshal(res.Output.Iinfo)
255
-			Idetinfos, _ := json.Marshal(res.Output.Idetinfo)
256
-			infoStr := string(Iinfos)
257
-			idetinfoStr := string(Idetinfos)
258
-
259
-			if res.Infcode == 0 {
260
-				his := models.VMHisPatient{
261
-					Status:      1,
262
-					Ctime:       time.Now().Unix(),
263
-					Mtime:       time.Now().Unix(),
264
-					PsnNo:       res.Output.Baseinfo.PsnNo,
265
-					PsnCertType: res.Output.Baseinfo.PsnCertType,
266
-					Certno:      res.Output.Baseinfo.Certno,
267
-					PsnName:     res.Output.Baseinfo.PsnName,
268
-					Gend:        res.Output.Baseinfo.Gend,
269
-					Naty:        res.Output.Baseinfo.Naty,
270
-					Brdy:        res.Output.Baseinfo.Brdy,
271
-					Age:         res.Output.Baseinfo.Age,
272
-					Iinfo:       infoStr,
273
-					Idetinfo:    idetinfoStr,
274
-					UserOrgId:   adminUser.CurrentOrgId,
275
-					IsReturn:    1,
276
-					IdCardType:  id_card_type,
277
-				}
278
-
279
-				patient, err := service.GetPatientByNumber(basNumber, adminUser.CurrentOrgId)
280
-				if err == gorm.ErrRecordNotFound {
281
-					c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeNoPateintException)
282
-					return
283
-
284
-				} else if err != nil {
285
-					c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
286
-					return
287
-
288
-				} else {
289
-					c.ServeSuccessJSON(map[string]interface{}{
290
-						"patient": patient,
291
-						"his":     his,
292
-						"number":  basNumber,
293
-					})
294
-				}
295
-			} else {
296
-				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeHisFailedException)
297
-				return
298
-			}
299
-
300
-		}
301
-
302
-		break
303
-	case 2:
304
-		////SFZStr, err := GetSFZBaseInfo()
305
-		//if err != nil {
306
-		//	c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeReadCardException)
307
-		//	return
308
-		//
309
-		//} else {
310
-		//
311
-		//	id_card_str := strings.Split(SFZStr, "^")
312
-		//	id_card_number := id_card_str[0]
313
-		//appRole, _ := service.GetAppRole(adminUser.CurrentOrgId)
314
-		//
315
-		//api := "http://127.0.0.1:9532/" + "gdyb/one?cert_no=" + id_card_number + "&org_name=" + miConfig.OrgName + "&doctor=" + appRole.UserName + "&fixmedins_code=" + miConfig.Code + "&insuplc_admdvs=" + miConfig.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey + "&id_card_type=" + strconv.FormatInt(int64(id_card_type), 10)
316
-		//resp, requestErr := http.Get(api)
317
-		//if requestErr != nil {
318
-		//	c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
319
-		//	return
320
-		//}
321
-		//defer resp.Body.Close()
322
-		//body, ioErr := ioutil.ReadAll(resp.Body)
323
-		//if ioErr != nil {
324
-		//	utils.ErrorLog("接口返回数据读取失败: %v", ioErr)
325
-		//	c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
326
-		//	return
327
-		//}
328
-		//var respJSON map[string]interface{}
329
-		//
330
-		//if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
331
-		//	utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
332
-		//	c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
333
-		//	return
334
-		//}
335
-		//
336
-		//userJSON := respJSON["data"].(map[string]interface{})["pre"].(map[string]interface{})
337
-		//userJSONBytes, _ := json.Marshal(userJSON)
338
-		//var res ResultTwo
339
-		//if err := json.Unmarshal(userJSONBytes, &res); err != nil {
340
-		//	utils.ErrorLog("解析失败:%v", err)
341
-		//	c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
342
-		//	return
343
-		//}
344
-		//Iinfos, _ := json.Marshal(res.Output.Iinfo)
345
-		//Idetinfos, _ := json.Marshal(res.Output.Idetinfo)
346
-		//infoStr := string(Iinfos)
347
-		//idetinfoStr := string(Idetinfos)
348
-		//
349
-		//if res.Infcode == 0 {
350
-		//	his := models.VMHisPatient{
351
-		//		Status:      1,
352
-		//		Ctime:       time.Now().Unix(),
353
-		//		Mtime:       time.Now().Unix(),
354
-		//		PsnNo:       res.Output.Baseinfo.PsnNo,
355
-		//		PsnCertType: res.Output.Baseinfo.PsnCertType,
356
-		//		Certno:      res.Output.Baseinfo.Certno,
357
-		//		PsnName:     res.Output.Baseinfo.PsnName,
358
-		//		Gend:        res.Output.Baseinfo.Gend,
359
-		//		Naty:        res.Output.Baseinfo.Naty,
360
-		//		Brdy:        res.Output.Baseinfo.Brdy,
361
-		//		Age:         res.Output.Baseinfo.Age,
362
-		//		Iinfo:       infoStr,
363
-		//		Idetinfo:    idetinfoStr,
364
-		//		UserOrgId:   adminUser.CurrentOrgId,
365
-		//		IsReturn:    1,
366
-		//		IdCardType:  id_card_type,
367
-		//	}
368
-
369
-		//	patient, err := service.GetPatientByNumber(id_card_number, adminUser.CurrentOrgId)
370
-		//	if err == gorm.ErrRecordNotFound {
371
-		//		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeNoPateintException)
372
-		//		return
373
-		//
374
-		//	} else if err != nil {
375
-		//		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
376
-		//		return
377
-		//
378
-		//	} else {
379
-		//		c.ServeSuccessJSON(map[string]interface{}{
380
-		//			"patient": patient,
381
-		//			"number":  id_card_number,
382
-		//		})
383
-		//	}
384
-		//}
385
-		break
386
-	case 3:
387
-
388
-		break
389
-
390
-	}
391
-}
392
-
393
-func GetBasBaseInfo() (jsonStr string, err error) {
394
-
395
-	handle, err := syscall.LoadLibrary("SSCard.dll")
396
-	if err != nil {
397
-		fmt.Printf("Error: %s\n", err)
398
-		return "", err
399
-	}
400
-	defer syscall.FreeLibrary(handle)
401
-	str := make([]byte, 256)
402
-	str1 := make([]byte, 256)
403
-	add, err := syscall.GetProcAddress(handle, "ReadCardBas")
404
-	if err != nil {
405
-		fmt.Printf("Error: %s\n", err)
406
-		return "", err
407
-	}
408
-	ret, _, _ := syscall.Syscall(add, (uintptr)(unsafe.Pointer(&str[0])), IntPtr(1024), (uintptr)(unsafe.Pointer(&str1[0])), IntPtr(1024))
409
-	if err != nil {
410
-		fmt.Printf("Error: %s\n", err)
411
-	}
412
-	fmt.Println("> Add(4,5)的结果为:", ret)
413
-	//return nil
414
-
415
-	//
416
-	//handle := syscall.NewLazyDLL("SSCard.dll")
417
-	//ReadCardBas := handle.NewProc("ReadCardBas")
418
-	//
419
-	//var str2 [1024]C.char
420
-	//var str3 [1024]C.char
421
-	//
422
-	//
423
-	//
424
-	////sssssswwwww
425
-	////a := 256
426
-	//
427
-	//r, _, _ := ReadCardBas.Call(&str2, 1024, &str3, 1024)
428
-	//fmt.Println(r)
429
-	////p := (*byte)(unsafe.Pointer(r))
430
-	// define a slice to fill with the p string
431
-	//data := make([]byte, 0)
432
-
433
-	// loop until find '\0'
434
-	//if *p != 0 {
435
-	//
436
-	//	//data = append(data, *p)        // append 1 byte
437
-	//	//r += unsafe.Sizeof(byte(0))    // move r to next byte
438
-	//	//p = (*byte)(unsafe.Pointer(r)) // get the byte value
439
-	//} else {
440
-	//	return "", nil
441
-	//
442
-	//}
443
-
444
-	return "", nil
219
+//func (c *HisApiController) Sscard() {
220
+//	id_card_type, _ := c.GetInt64("id_card_type")
221
+//	adminUser := c.GetAdminUserInfo()
222
+//	miConfig, _ := service.FindMedicalInsuranceInfo(adminUser.CurrentOrgId)
223
+//
224
+//	r := CardInit()
225
+//	fmt.Println(r)
226
+//	//if r == 0 {
227
+//	switch id_card_type {
228
+//	case 1:
229
+//		basStr, err := GetBasBaseInfo()
230
+//
231
+//		if err != nil {
232
+//			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeReadCardException)
233
+//			return
234
+//
235
+//		} else {
236
+//			fmt.Println(basStr)
237
+//
238
+//			bas := strings.Split(basStr, "|")
239
+//
240
+//			basNumber := bas[1]
241
+//
242
+//			//basNumber := bas[2]
243
+//			card_sn := bas[3]
244
+//
245
+//			appRole, _ := service.GetAppRole(adminUser.CurrentOrgId)
246
+//
247
+//			api := "http://127.0.0.1:9532/" + "gdyb/one?cert_no=" + basNumber + "&org_name=" + miConfig.OrgName + "&doctor=" + appRole.UserName + "&fixmedins_code=" + miConfig.Code + "&insuplc_admdvs=" + miConfig.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey + "&id_card_type=" + strconv.FormatInt(int64(id_card_type), 10) + "&card_sn=" + card_sn
248
+//			resp, requestErr := http.Get(api)
249
+//			if requestErr != nil {
250
+//				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
251
+//				return
252
+//			}
253
+//			defer resp.Body.Close()
254
+//			body, ioErr := ioutil.ReadAll(resp.Body)
255
+//			if ioErr != nil {
256
+//				utils.ErrorLog("接口返回数据读取失败: %v", ioErr)
257
+//				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
258
+//				return
259
+//			}
260
+//			var respJSON map[string]interface{}
261
+//
262
+//			if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
263
+//				utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
264
+//				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
265
+//				return
266
+//			}
267
+//
268
+//			userJSON := respJSON["data"].(map[string]interface{})["pre"].(map[string]interface{})
269
+//			userJSONBytes, _ := json.Marshal(userJSON)
270
+//			var res ResultTwo
271
+//			if err := json.Unmarshal(userJSONBytes, &res); err != nil {
272
+//				utils.ErrorLog("解析失败:%v", err)
273
+//				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
274
+//				return
275
+//			}
276
+//			Iinfos, _ := json.Marshal(res.Output.Iinfo)
277
+//			Idetinfos, _ := json.Marshal(res.Output.Idetinfo)
278
+//			infoStr := string(Iinfos)
279
+//			idetinfoStr := string(Idetinfos)
280
+//
281
+//			if res.Infcode == 0 {
282
+//				his := models.VMHisPatient{
283
+//					Status:      1,
284
+//					Ctime:       time.Now().Unix(),
285
+//					Mtime:       time.Now().Unix(),
286
+//					PsnNo:       res.Output.Baseinfo.PsnNo,
287
+//					PsnCertType: res.Output.Baseinfo.PsnCertType,
288
+//					Certno:      res.Output.Baseinfo.Certno,
289
+//					PsnName:     res.Output.Baseinfo.PsnName,
290
+//					Gend:        res.Output.Baseinfo.Gend,
291
+//					Naty:        res.Output.Baseinfo.Naty,
292
+//					Brdy:        res.Output.Baseinfo.Brdy,
293
+//					Age:         res.Output.Baseinfo.Age,
294
+//					Iinfo:       infoStr,
295
+//					Idetinfo:    idetinfoStr,
296
+//					UserOrgId:   adminUser.CurrentOrgId,
297
+//					IsReturn:    1,
298
+//					IdCardType:  id_card_type,
299
+//				}
300
+//
301
+//				patient, err := service.GetPatientByNumber(basNumber, adminUser.CurrentOrgId)
302
+//				if err == gorm.ErrRecordNotFound {
303
+//					c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeNoPateintException)
304
+//					return
305
+//
306
+//				} else if err != nil {
307
+//					c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
308
+//					return
309
+//
310
+//				} else {
311
+//					c.ServeSuccessJSON(map[string]interface{}{
312
+//						"patient": patient,
313
+//						"his":     his,
314
+//						"number":  basNumber,
315
+//					})
316
+//				}
317
+//			} else {
318
+//				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeHisFailedException)
319
+//				return
320
+//			}
321
+//
322
+//		}
323
+//
324
+//		break
325
+//	case 2:
326
+//		////SFZStr, err := GetSFZBaseInfo()
327
+//		//if err != nil {
328
+//		//	c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeReadCardException)
329
+//		//	return
330
+//		//
331
+//		//} else {
332
+//		//
333
+//		//	id_card_str := strings.Split(SFZStr, "^")
334
+//		//	id_card_number := id_card_str[0]
335
+//		//appRole, _ := service.GetAppRole(adminUser.CurrentOrgId)
336
+//		//
337
+//		//api := "http://127.0.0.1:9532/" + "gdyb/one?cert_no=" + id_card_number + "&org_name=" + miConfig.OrgName + "&doctor=" + appRole.UserName + "&fixmedins_code=" + miConfig.Code + "&insuplc_admdvs=" + miConfig.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey + "&id_card_type=" + strconv.FormatInt(int64(id_card_type), 10)
338
+//		//resp, requestErr := http.Get(api)
339
+//		//if requestErr != nil {
340
+//		//	c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
341
+//		//	return
342
+//		//}
343
+//		//defer resp.Body.Close()
344
+//		//body, ioErr := ioutil.ReadAll(resp.Body)
345
+//		//if ioErr != nil {
346
+//		//	utils.ErrorLog("接口返回数据读取失败: %v", ioErr)
347
+//		//	c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
348
+//		//	return
349
+//		//}
350
+//		//var respJSON map[string]interface{}
351
+//		//
352
+//		//if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
353
+//		//	utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
354
+//		//	c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
355
+//		//	return
356
+//		//}
357
+//		//
358
+//		//userJSON := respJSON["data"].(map[string]interface{})["pre"].(map[string]interface{})
359
+//		//userJSONBytes, _ := json.Marshal(userJSON)
360
+//		//var res ResultTwo
361
+//		//if err := json.Unmarshal(userJSONBytes, &res); err != nil {
362
+//		//	utils.ErrorLog("解析失败:%v", err)
363
+//		//	c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
364
+//		//	return
365
+//		//}
366
+//		//Iinfos, _ := json.Marshal(res.Output.Iinfo)
367
+//		//Idetinfos, _ := json.Marshal(res.Output.Idetinfo)
368
+//		//infoStr := string(Iinfos)
369
+//		//idetinfoStr := string(Idetinfos)
370
+//		//
371
+//		//if res.Infcode == 0 {
372
+//		//	his := models.VMHisPatient{
373
+//		//		Status:      1,
374
+//		//		Ctime:       time.Now().Unix(),
375
+//		//		Mtime:       time.Now().Unix(),
376
+//		//		PsnNo:       res.Output.Baseinfo.PsnNo,
377
+//		//		PsnCertType: res.Output.Baseinfo.PsnCertType,
378
+//		//		Certno:      res.Output.Baseinfo.Certno,
379
+//		//		PsnName:     res.Output.Baseinfo.PsnName,
380
+//		//		Gend:        res.Output.Baseinfo.Gend,
381
+//		//		Naty:        res.Output.Baseinfo.Naty,
382
+//		//		Brdy:        res.Output.Baseinfo.Brdy,
383
+//		//		Age:         res.Output.Baseinfo.Age,
384
+//		//		Iinfo:       infoStr,
385
+//		//		Idetinfo:    idetinfoStr,
386
+//		//		UserOrgId:   adminUser.CurrentOrgId,
387
+//		//		IsReturn:    1,
388
+//		//		IdCardType:  id_card_type,
389
+//		//	}
390
+//
391
+//		//	patient, err := service.GetPatientByNumber(id_card_number, adminUser.CurrentOrgId)
392
+//		//	if err == gorm.ErrRecordNotFound {
393
+//		//		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeNoPateintException)
394
+//		//		return
395
+//		//
396
+//		//	} else if err != nil {
397
+//		//		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
398
+//		//		return
399
+//		//
400
+//		//	} else {
401
+//		//		c.ServeSuccessJSON(map[string]interface{}{
402
+//		//			"patient": patient,
403
+//		//			"number":  id_card_number,
404
+//		//		})
405
+//		//	}
406
+//		//}
407
+//		break
408
+//	case 3:
409
+//
410
+//		break
411
+//
412
+//	}
413
+//}
445 414
 
446
-}
415
+//func GetBasBaseInfo() (jsonStr string, err error) {
416
+//
417
+//	handle, err := syscall.LoadLibrary("SSCard.dll")
418
+//	if err != nil {
419
+//		fmt.Printf("Error: %s\n", err)
420
+//		return "", err
421
+//	}
422
+//	defer syscall.FreeLibrary(handle)
423
+//	str := make([]byte, 256)
424
+//	str1 := make([]byte, 256)
425
+//	add, err := syscall.GetProcAddress(handle, "ReadCardBas")
426
+//	if err != nil {
427
+//		fmt.Printf("Error: %s\n", err)
428
+//		return "", err
429
+//	}
430
+//	ret, _, _ := syscall.Syscall(add, (uintptr)(unsafe.Pointer(&str[0])), IntPtr(1024), (uintptr)(unsafe.Pointer(&str1[0])), IntPtr(1024))
431
+//	if err != nil {
432
+//		fmt.Printf("Error: %s\n", err)
433
+//	}
434
+//	fmt.Println("> Add(4,5)的结果为:", ret)
435
+//	//return nil
436
+//
437
+//	//
438
+//	//handle := syscall.NewLazyDLL("SSCard.dll")
439
+//	//ReadCardBas := handle.NewProc("ReadCardBas")
440
+//	//
441
+//	//var str2 [1024]C.char
442
+//	//var str3 [1024]C.char
443
+//	//
444
+//	//
445
+//	//
446
+//	////sssssswwwww
447
+//	////a := 256
448
+//	//
449
+//	//r, _, _ := ReadCardBas.Call(&str2, 1024, &str3, 1024)
450
+//	//fmt.Println(r)
451
+//	////p := (*byte)(unsafe.Pointer(r))
452
+//	// define a slice to fill with the p string
453
+//	//data := make([]byte, 0)
454
+//
455
+//	// loop until find '\0'
456
+//	//if *p != 0 {
457
+//	//
458
+//	//	//data = append(data, *p)        // append 1 byte
459
+//	//	//r += unsafe.Sizeof(byte(0))    // move r to next byte
460
+//	//	//p = (*byte)(unsafe.Pointer(r)) // get the byte value
461
+//	//} else {
462
+//	//	return "", nil
463
+//	//
464
+//	//}
465
+//
466
+//	return "", nil
467
+//
468
+//}
447 469
 
448 470
 //func GetSFZBaseInfo() (jsonStr string, err error) {
449 471
 //	//handle := syscall.MustLoadDLL("SSCard.dll")
@@ -2921,6 +2943,6 @@ func RemoveRepeatedCode(arr []string) (newArr []string) {
2921 2943
 //	return
2922 2944
 //}
2923 2945
 
2924
-func StrPtr3(s string) uintptr {
2925
-	return uintptr(unsafe.Pointer(syscall.StringToUTF16Ptr(s)))
2926
-}
2946
+//func StrPtr3(s string) uintptr {
2947
+//	return uintptr(unsafe.Pointer(syscall.StringToUTF16Ptr(s)))
2948
+//}

+ 1 - 3
routers/router.go View File

@@ -2,8 +2,6 @@ package routers
2 2
 
3 3
 import (
4 4
 	"gdyb/controllers/sg"
5
-	"gdyb/controllers/sz"
6
-
7 5
 	//admin_api "XT_New/controllers/admin_api_controllers"
8 6
 	"github.com/astaxie/beego"
9 7
 	"github.com/astaxie/beego/plugins/cors"
@@ -22,6 +20,6 @@ func init() {
22 20
 
23 21
 	sg.HisManagerApiRegistRouters()
24 22
 	sg.GdybRegistRouters()
25
-	sz.SZHisManagerApiRegistRouters()
23
+	//sz.SZHisManagerApiRegistRouters()
26 24
 
27 25
 }