csx 4 years ago
parent
commit
6ef941383a
2 changed files with 23 additions and 23 deletions
  1. 2 4
      controllers/sg/his_api_controller.go
  2. 21 19
      service/sz_his_service.go

+ 2 - 4
controllers/sg/his_api_controller.go View File

1
 package sg
1
 package sg
2
 
2
 
3
 import (
3
 import (
4
-	//"C"
4
+	"C"
5
 	"archive/zip"
5
 	"archive/zip"
6
 	"bytes"
6
 	"bytes"
7
 	"encoding/json"
7
 	"encoding/json"
20
 	"net/http"
20
 	"net/http"
21
 	"os"
21
 	"os"
22
 	"path/filepath"
22
 	"path/filepath"
23
-	"runtime"
23
+	//"runtime/cgo"
24
 	"strconv"
24
 	"strconv"
25
 	"strings"
25
 	"strings"
26
 	"syscall"
26
 	"syscall"
60
 )
60
 )
61
 
61
 
62
 func (c *HisApiController) TestPay() {
62
 func (c *HisApiController) TestPay() {
63
-	runtime.GC()
64
 	DllDef := syscall.MustLoadDLL("SSSE32.dll")
63
 	DllDef := syscall.MustLoadDLL("SSSE32.dll")
65
 	readCard := DllDef.MustFindProc("ReadCardBas")
64
 	readCard := DllDef.MustFindProc("ReadCardBas")
66
 	str := make([]byte, 256)
65
 	str := make([]byte, 256)
67
 	str1 := make([]byte, 256)
66
 	str1 := make([]byte, 256)
68
 	ret2, _, err2 := readCard.Call((uintptr)(unsafe.Pointer(&str[0])), IntPtr(1024), (uintptr)(unsafe.Pointer(&str1[0])), IntPtr(1024))
67
 	ret2, _, err2 := readCard.Call((uintptr)(unsafe.Pointer(&str[0])), IntPtr(1024), (uintptr)(unsafe.Pointer(&str1[0])), IntPtr(1024))
69
-	runtime.GC()
70
 	if err2 != nil {
68
 	if err2 != nil {
71
 		fmt.Println("SSCard的运算结果为:", ret2)
69
 		fmt.Println("SSCard的运算结果为:", ret2)
72
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeReadCardException)
70
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeReadCardException)

+ 21 - 19
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, account string) string {
15
+func SzybMZ002(doctor string, doctor_code string, fixmedins_code string, dept_code string, account string, verify_code string) string {
16
 	// 生成输入报文
16
 	// 生成输入报文
17
-	inputMessage := SetSZInputMessage(doctor, doctor_code, fixmedins_code)
17
+	inputMessage := SetSZInputMessage(doctor, doctor_code, fixmedins_code, verify_code)
18
 	inputData := make(map[string]interface{})
18
 	inputData := make(map[string]interface{})
19
 	inputMessage["transType"] = "MZ002" // 交易编码
19
 	inputMessage["transType"] = "MZ002" // 交易编码
20
 
20
 
58
 	str := string(respBytes)
58
 	str := string(respBytes)
59
 	return str
59
 	return str
60
 }
60
 }
61
-func SzybFY001(doctor string, doctor_code string, fixmedins_code string, dept_code string, datas []*models.CustomDetail) string {
61
+func SzybFY001(doctor string, doctor_code string, fixmedins_code string, datas []*models.CustomDetail, verify_code string) string {
62
 	// 生成输入报文
62
 	// 生成输入报文
63
-	inputMessage := SetSZInputMessage(doctor, doctor_code, fixmedins_code)
63
+	inputMessage := SetSZInputMessage(doctor, doctor_code, fixmedins_code, verify_code)
64
 	inputData := make(map[string]interface{})
64
 	inputData := make(map[string]interface{})
65
 	inputMessage["transType"] = "FY002" // 交易编码
65
 	inputMessage["transType"] = "FY002" // 交易编码
66
 
66
 
120
 	str := string(respBytes)
120
 	str := string(respBytes)
121
 	return str
121
 	return str
122
 }
122
 }
123
-func SzybFY002(doctor string, doctor_code string, fixmedins_code string, datas []*models.CustomDetail) string {
123
+func SzybFY002(doctor string, doctor_code string, fixmedins_code string, datas []*models.CustomDetail, verify_code string) string {
124
 	// 生成输入报文
124
 	// 生成输入报文
125
-	inputMessage := SetSZInputMessage(doctor, doctor_code, fixmedins_code)
125
+	inputMessage := SetSZInputMessage(doctor, doctor_code, fixmedins_code, verify_code)
126
 	inputData := make(map[string]interface{})
126
 	inputData := make(map[string]interface{})
127
 	inputMessage["transType"] = "FY002" // 交易编码
127
 	inputMessage["transType"] = "FY002" // 交易编码
128
 
128
 
172
 	str := string(respBytes)
172
 	str := string(respBytes)
173
 	return str
173
 	return str
174
 }
174
 }
175
-func SzybFY004(doctor string, doctor_code string, fixmedins_code string, dept_code string, total float64, number string) string {
175
+
176
+func SzybFY004(doctor string, doctor_code string, fixmedins_code string, dept_code string, total float64, number string, verify_code string) string {
176
 	// 生成输入报文
177
 	// 生成输入报文
177
-	inputMessage := SetSZInputMessage(doctor, doctor_code, fixmedins_code)
178
+	inputMessage := SetSZInputMessage(doctor, doctor_code, fixmedins_code, verify_code)
178
 	inputData := make(map[string]interface{})
179
 	inputData := make(map[string]interface{})
179
 	inputMessage["transType"] = "FY001" // 交易编码
180
 	inputMessage["transType"] = "FY001" // 交易编码
180
 
181
 
219
 	str := string(respBytes)
220
 	str := string(respBytes)
220
 	return str
221
 	return str
221
 }
222
 }
222
-func SzybFY005(doctor string, doctor_code string, fixmedins_code string, dept_code string, total float64, number string) string {
223
+func SzybFY005(doctor string, doctor_code string, fixmedins_code string, dept_code string, total float64, number string, verify_code string) string {
223
 	// 生成输入报文
224
 	// 生成输入报文
224
-	inputMessage := SetSZInputMessage(doctor, doctor_code, fixmedins_code)
225
+	inputMessage := SetSZInputMessage(doctor, doctor_code, fixmedins_code, verify_code)
225
 	inputData := make(map[string]interface{})
226
 	inputData := make(map[string]interface{})
226
 	inputMessage["transType"] = "FY005" // 交易编码
227
 	inputMessage["transType"] = "FY005" // 交易编码
227
 
228
 
270
 	str := string(respBytes)
271
 	str := string(respBytes)
271
 	return str
272
 	return str
272
 }
273
 }
273
-func SzybJY002(doctor string, doctor_code string, fixmedins_code string, dept_code string, number string) string {
274
+
275
+func SzybJY002(doctor string, doctor_code string, fixmedins_code string, dept_code string, number string, verify_code string) string {
274
 	// 生成输入报文
276
 	// 生成输入报文
275
-	inputMessage := SetSZInputMessage(doctor, doctor_code, fixmedins_code)
277
+	inputMessage := SetSZInputMessage(doctor, doctor_code, fixmedins_code, verify_code)
276
 	inputData := make(map[string]interface{})
278
 	inputData := make(map[string]interface{})
277
 	inputMessage["transType"] = "JY002" // 交易编码
279
 	inputMessage["transType"] = "JY002" // 交易编码
278
 
280
 
313
 }
315
 }
314
 
316
 
315
 // 生成基础报文
317
 // 生成基础报文
316
-func SetSZInputMessage(doctor string, doctor_code string, fixmedins_code string) map[string]interface{} {
318
+func SetSZInputMessage(doctor string, doctor_code string, fixmedins_code string, verify_code string) map[string]interface{} {
317
 	month := time.Unix(1557042972, 0).Format("1")
319
 	month := time.Unix(1557042972, 0).Format("1")
318
 	year := time.Now().Format("2006")
320
 	year := time.Now().Format("2006")
319
 	month = time.Now().Format("01")
321
 	month = time.Now().Format("01")
330
 	inputMessage["operatorPass"] = ""             // 定点协议机构操作人员编码
332
 	inputMessage["operatorPass"] = ""             // 定点协议机构操作人员编码
331
 	inputMessage["serialNumber"] = fixmedins_code + year + month + day +
333
 	inputMessage["serialNumber"] = fixmedins_code + year + month + day +
332
 		fmt.Sprintf("%07v", rand.New(rand.NewSource(time.Now().UnixNano())).Int31n(10000000)) // 定点协议机构编码(5位)+日期(8位)+流水号(7位)
334
 		fmt.Sprintf("%07v", rand.New(rand.NewSource(time.Now().UnixNano())).Int31n(10000000)) // 定点协议机构编码(5位)+日期(8位)+流水号(7位)
333
-	inputMessage["transChannel"] = "10"                         // 交易渠道
334
-	inputMessage["transReturnCode"] = ""                        // 交易返回码
335
-	inputMessage["transReturnMessage"] = ""                     // 交易返回信息
336
-	inputMessage["transTime"] = msToTime(time.Now().UnixNano()) // 经办人姓名
337
-	inputMessage["transVersion"] = "V0.3"                       // 定点医药机构编号
338
-	inputMessage["verifyCode"] = "000000|ABC243DDESF"           //定点医药机构名称
335
+	inputMessage["transChannel"] = "10"                         //
336
+	inputMessage["transReturnCode"] = ""                        //
337
+	inputMessage["transReturnMessage"] = ""                     //
338
+	inputMessage["transTime"] = msToTime(time.Now().UnixNano()) //
339
+	inputMessage["transVersion"] = "V0.3"                       //
340
+	inputMessage["verifyCode"] = verify_code                    //
339
 	return inputMessage
341
 	return inputMessage
340
 }
342
 }
341
 func msToTime(ms int64) string {
343
 func msToTime(ms int64) string {