|
@@ -22,6 +22,8 @@ import (
|
22
|
22
|
"strconv"
|
23
|
23
|
"strings"
|
24
|
24
|
"time"
|
|
25
|
+ "syscall"
|
|
26
|
+ "unsafe"
|
25
|
27
|
)
|
26
|
28
|
|
27
|
29
|
type HisApiController struct {
|
|
@@ -72,9 +74,59 @@ func HisManagerApiRegistRouters() {
|
72
|
74
|
beego.Router("/api/hisprescription/get", &DialysisApiController{}, "Get:GetLastOrNextHisPrescription")
|
73
|
75
|
|
74
|
76
|
beego.Router("/api/callhisprescription/get", &DialysisApiController{}, "Get:GetCallHisPrescription")
|
|
77
|
+ beego.Router("/api/sscard", &HisApiController{}, "get:Sscard")
|
75
|
78
|
|
76
|
79
|
}
|
77
|
80
|
|
|
81
|
+func (c *HisApiController) Sscard() {
|
|
82
|
+ r := CardInit()
|
|
83
|
+ if (r==0) {
|
|
84
|
+ GetBaseInfo()
|
|
85
|
+ }
|
|
86
|
+ c.ServeSuccessJSON(map[string]interface{}{
|
|
87
|
+ "list": "11",
|
|
88
|
+ })
|
|
89
|
+
|
|
90
|
+}
|
|
91
|
+
|
|
92
|
+func GetBaseInfo() (error) {
|
|
93
|
+ handle := syscall.MustLoadDLL("SSCard.dll")
|
|
94
|
+ ReadCardBas := handle.MustFindProc("ReadCardBas")
|
|
95
|
+
|
|
96
|
+ str := make([]byte,256)
|
|
97
|
+ str1 := make([]byte,256)
|
|
98
|
+ r,_,ferr := ReadCardBas.Call((uintptr)(unsafe.Pointer(&str[0])),IntPtr(1024),(uintptr)(unsafe.Pointer(&str1[0])),IntPtr(1024))
|
|
99
|
+ if ferr != nil {
|
|
100
|
+ fmt.Println("ReadCardBas 报错", ferr.Error())
|
|
101
|
+ return ferr
|
|
102
|
+ }
|
|
103
|
+
|
|
104
|
+ fmt.Println(string(str))
|
|
105
|
+
|
|
106
|
+ fmt.Println(r)
|
|
107
|
+ return nil
|
|
108
|
+}
|
|
109
|
+
|
|
110
|
+func CardInit() int{
|
|
111
|
+ DllTestDef := syscall.MustLoadDLL("SSCard.dll")
|
|
112
|
+ add := DllTestDef.MustFindProc("Init")
|
|
113
|
+ ret, _, err := add.Call(StrPtr("http://igb.hsa.gdgov.cn/gdyb_inf/poc/api/card/initDll"),StrPtr("440200"))
|
|
114
|
+ if err != nil {
|
|
115
|
+ fmt.Println("SSCard的运算结果为:", ret)
|
|
116
|
+ }
|
|
117
|
+ result := int(ret)
|
|
118
|
+ return result
|
|
119
|
+}
|
|
120
|
+
|
|
121
|
+func IntPtr(n int) uintptr {
|
|
122
|
+ return uintptr(n)
|
|
123
|
+}
|
|
124
|
+
|
|
125
|
+func StrPtr(s string) uintptr {
|
|
126
|
+ return uintptr(unsafe.Pointer(syscall.StringBytePtr(s)))
|
|
127
|
+}
|
|
128
|
+
|
|
129
|
+
|
78
|
130
|
func (c *HisApiController) GetHisPatientList() {
|
79
|
131
|
types, _ := c.GetInt64("type", 0)
|
80
|
132
|
record_date := c.GetString("record_date")
|