csx 4 years ago
parent
commit
e55dbbb840
2 changed files with 21 additions and 5 deletions
  1. 18 3
      controllers/sg/his_api_controller.go
  2. 3 2
      service/sz_his_service.go

+ 18 - 3
controllers/sg/his_api_controller.go View File

21
 	"os"
21
 	"os"
22
 	"path/filepath"
22
 	"path/filepath"
23
 	"runtime"
23
 	"runtime"
24
+	_ "runtime/cgo"
24
 	"strconv"
25
 	"strconv"
25
 	"strings"
26
 	"strings"
26
 	"syscall"
27
 	"syscall"
50
 	beego.Router("/api/org/info", &HisApiController{}, "get:GetOrgInfo")
51
 	beego.Router("/api/org/info", &HisApiController{}, "get:GetOrgInfo")
51
 	beego.Router("/api/testcard", &HisApiController{}, "get:TestGetBasBaseInfo")
52
 	beego.Router("/api/testcard", &HisApiController{}, "get:TestGetBasBaseInfo")
52
 
53
 
54
+	beego.Router("/api/testpay", &HisApiController{}, "get:TestPay")
55
+
53
 }
56
 }
54
 
57
 
55
-var ()
58
+func (c *HisApiController) TestPay() {
59
+	runtime.GC()
60
+	DllDef := syscall.MustLoadDLL("SSSE32.dll")
61
+	readCard := DllDef.MustFindProc("ReadCardBas")
62
+	str := make([]byte, 256)
63
+	str1 := make([]byte, 256)
64
+	ret2, _, err2 := readCard.Call((uintptr)(unsafe.Pointer(&str[0])), IntPtr(1024), (uintptr)(unsafe.Pointer(&str1[0])), IntPtr(1024))
65
+	runtime.GC()
66
+	if err2 != nil {
67
+		fmt.Println("SSCard的运算结果为:", ret2)
68
+		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeReadCardException)
69
+		return
70
+	}
71
+
72
+}
56
 
73
 
57
 func (c *HisApiController) TestGetBasBaseInfo() {
74
 func (c *HisApiController) TestGetBasBaseInfo() {
58
-	runtime.GC()
59
 
75
 
60
 	DllDef := syscall.MustLoadDLL("SSCard.dll")
76
 	DllDef := syscall.MustLoadDLL("SSCard.dll")
61
 	Iinit := DllDef.MustFindProc("Init")
77
 	Iinit := DllDef.MustFindProc("Init")
86
 	fmt.Println(" Add(4,5)的结果为:", ret2)
102
 	fmt.Println(" Add(4,5)的结果为:", ret2)
87
 	fmt.Println(" str:", str)
103
 	fmt.Println(" str:", str)
88
 	fmt.Println(" str1:", str1)
104
 	fmt.Println(" str1:", str1)
89
-	runtime.GC()
90
 	if err2 != nil {
105
 	if err2 != nil {
91
 		fmt.Println("SSCard的运算结果为:", ret2)
106
 		fmt.Println("SSCard的运算结果为:", ret2)
92
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeReadCardException)
107
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeReadCardException)

+ 3 - 2
service/sz_his_service.go View File

12
 	_ "unsafe"
12
 	_ "unsafe"
13
 )
13
 )
14
 
14
 
15
-func SzybMZ002(doctor string, doctor_code string, fixmedins_code string, dept_code string) string {
15
+func SzybMZ002(doctor string, doctor_code string, fixmedins_code string, dept_code string, account string) string {
16
 	// 生成输入报文
16
 	// 生成输入报文
17
 	inputMessage := SetSZInputMessage(doctor, doctor_code, fixmedins_code)
17
 	inputMessage := SetSZInputMessage(doctor, doctor_code, fixmedins_code)
18
 	inputData := make(map[string]interface{})
18
 	inputData := make(map[string]interface{})
19
 	inputMessage["transType"] = "MZ002" // 交易编码
19
 	inputMessage["transType"] = "MZ002" // 交易编码
20
 
20
 
21
 	inputData["akc190"] = inputMessage["serialNumber"]
21
 	inputData["akc190"] = inputMessage["serialNumber"]
22
-	inputData["aaz500"] = "%GAAFSAKSXSUKKWDKHDAD?;07734724145330238292?"
22
+	inputData["aaz500"] = account
23
 	inputData["bzz269"] = "000000"
23
 	inputData["bzz269"] = "000000"
24
 	inputData["aka130"] = "11"
24
 	inputData["aka130"] = "11"
25
 	inputData["akf001"] = dept_code
25
 	inputData["akf001"] = dept_code
58
 	str := string(respBytes)
58
 	str := string(respBytes)
59
 	return str
59
 	return str
60
 }
60
 }
61
+
61
 func SzybFY001(doctor string, doctor_code string, fixmedins_code string, dept_code string, datas []*models.CustomDetail) string {
62
 func SzybFY001(doctor string, doctor_code string, fixmedins_code string, dept_code string, datas []*models.CustomDetail) string {
62
 	// 生成输入报文
63
 	// 生成输入报文
63
 	inputMessage := SetSZInputMessage(doctor, doctor_code, fixmedins_code)
64
 	inputMessage := SetSZInputMessage(doctor, doctor_code, fixmedins_code)