Ver código fonte

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

csx 4 anos atrás
pai
commit
a0ce8ee364
1 arquivos alterados com 54 adições e 0 exclusões
  1. 54 0
      controllers/sg/his_api_controller.go

+ 54 - 0
controllers/sg/his_api_controller.go Ver arquivo

@@ -46,9 +46,63 @@ func HisManagerApiRegistRouters() {
46 46
 	beego.Router("/api/record/put", &HisApiController{}, "get:PutRecord")
47 47
 	beego.Router("/api/patient/info", &HisApiController{}, "get:GetHisPatientInfo")
48 48
 	beego.Router("/api/org/info", &HisApiController{}, "get:GetOrgInfo")
49
+	beego.Router("/api/testcard", &HisApiController{}, "get:TestGetBasBaseInfo")
49 50
 
50 51
 }
51 52
 
53
+var (
54
+	DllDef = syscall.MustLoadDLL("SSCard.dll")
55
+	Iinit = DllDef.MustFindProc("Init")
56
+	readCard = DllDef.MustFindProc("ReadCardBas")
57
+	str = make([]byte, 256)
58
+	str1 = make([]byte, 256)
59
+)
60
+
61
+func (c *HisApiController)TestGetBasBaseInfo() {
62
+	ret, _, err := Iinit.Call(StrPtr("http://igb.hsa.gdgov.cn/gdyb_inf/poc/api/card/initDll"), StrPtr("440200"))
63
+	if ret != 0 {
64
+		fmt.Println("SSCard的报错原因:", err)
65
+		fmt.Println("SSCard的运算结果为:", ret)
66
+		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeReadCardException)
67
+		return
68
+	}
69
+	
70
+	result := int(ret)
71
+	fmt.Println("SSCard的运算结果为1:", result)
72
+
73
+	
74
+	if readCard == nil {
75
+		fmt.Println("readcard is nil")
76
+		readCard = DllDef.MustFindProc("ReadCardBas")
77
+	}
78
+	if readCard == nil {
79
+		fmt.Println("readcard reload  is nil")
80
+		return
81
+	}
82
+
83
+	str = nil
84
+	str1 = nil 
85
+	str = make([]byte, 256)
86
+	str1 = make([]byte, 256)
87
+	ret2, _, err2 := readCard.Call((uintptr)(unsafe.Pointer(&str[0])), IntPtr(256), (uintptr)(unsafe.Pointer(&str1[0])), IntPtr(256))
88
+	fmt.Println(" Add(4,5)的结果为:", ret2)
89
+	fmt.Println(" str:", str)
90
+	fmt.Println(" str1:", str1)
91
+	str = nil
92
+	str1 = nil 
93
+	str = make([]byte, 256)
94
+	str1 = make([]byte, 256)
95
+	runtime.GC()
96
+	if err2 != nil {
97
+		fmt.Println("SSCard的运算结果为:", ret2)
98
+		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeReadCardException)
99
+		return
100
+	}
101
+
102
+	
103
+}
104
+
105
+
52 106
 func (c *HisApiController) GetOrgInfo() {
53 107
 	miConfig, _ := service.FindMedicalInsuranceInfo(9919)
54 108
 	service.Gdyb1201("", miConfig.OrgName, "1122", miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, 1, "")