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

+ 21 - 19
service/sz_his_service.go View File

@@ -12,9 +12,9 @@ import (
12 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 18
 	inputData := make(map[string]interface{})
19 19
 	inputMessage["transType"] = "MZ002" // 交易编码
20 20
 
@@ -58,9 +58,9 @@ func SzybMZ002(doctor string, doctor_code string, fixmedins_code string, dept_co
58 58
 	str := string(respBytes)
59 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 64
 	inputData := make(map[string]interface{})
65 65
 	inputMessage["transType"] = "FY002" // 交易编码
66 66
 
@@ -120,9 +120,9 @@ func SzybFY001(doctor string, doctor_code string, fixmedins_code string, dept_co
120 120
 	str := string(respBytes)
121 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 126
 	inputData := make(map[string]interface{})
127 127
 	inputMessage["transType"] = "FY002" // 交易编码
128 128
 
@@ -172,9 +172,10 @@ func SzybFY002(doctor string, doctor_code string, fixmedins_code string, datas [
172 172
 	str := string(respBytes)
173 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 179
 	inputData := make(map[string]interface{})
179 180
 	inputMessage["transType"] = "FY001" // 交易编码
180 181
 
@@ -219,9 +220,9 @@ func SzybFY004(doctor string, doctor_code string, fixmedins_code string, dept_co
219 220
 	str := string(respBytes)
220 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 226
 	inputData := make(map[string]interface{})
226 227
 	inputMessage["transType"] = "FY005" // 交易编码
227 228
 
@@ -270,9 +271,10 @@ func SzybFY005(doctor string, doctor_code string, fixmedins_code string, dept_co
270 271
 	str := string(respBytes)
271 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 278
 	inputData := make(map[string]interface{})
277 279
 	inputMessage["transType"] = "JY002" // 交易编码
278 280
 
@@ -313,7 +315,7 @@ func SzybJY002(doctor string, doctor_code string, fixmedins_code string, dept_co
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 319
 	month := time.Unix(1557042972, 0).Format("1")
318 320
 	year := time.Now().Format("2006")
319 321
 	month = time.Now().Format("01")
@@ -330,12 +332,12 @@ func SetSZInputMessage(doctor string, doctor_code string, fixmedins_code string)
330 332
 	inputMessage["operatorPass"] = ""             // 定点协议机构操作人员编码
331 333
 	inputMessage["serialNumber"] = fixmedins_code + year + month + day +
332 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 341
 	return inputMessage
340 342
 }
341 343
 func msToTime(ms int64) string {