|
@@ -12,13 +12,13 @@ import (
|
12
|
12
|
_ "unsafe"
|
13
|
13
|
)
|
14
|
14
|
|
15
|
|
-func SzybMZ002(doctor string, doctor_code string, fixmedins_code string, dept_code string, account string, verify_code string) string {
|
|
15
|
+func SzybMZ002(doctor string, doctor_code string, fixmedins_code string, dept_code string, account string, verify_code string, serial_number string) string {
|
16
|
16
|
// 生成输入报文
|
17
|
|
- inputMessage := SetSZInputMessage(doctor, doctor_code, fixmedins_code, verify_code)
|
|
17
|
+ inputMessage := SetSZInputMessage(doctor, doctor_code, fixmedins_code, verify_code, serial_number)
|
18
|
18
|
inputData := make(map[string]interface{})
|
19
|
19
|
inputMessage["transType"] = "MZ002" // 交易编码
|
20
|
20
|
|
21
|
|
- inputData["akc190"] = "G554020210305"
|
|
21
|
+ inputData["akc190"] = serial_number
|
22
|
22
|
inputData["aaz500"] = account
|
23
|
23
|
inputData["bzz269"] = "000000"
|
24
|
24
|
inputData["aka130"] = "11"
|
|
@@ -71,9 +71,9 @@ func SzybMZ002(doctor string, doctor_code string, fixmedins_code string, dept_co
|
71
|
71
|
str := string(respBytes)
|
72
|
72
|
return str
|
73
|
73
|
}
|
74
|
|
-func SzybFY001(doctor string, doctor_code string, fixmedins_code string, datas []*models.CustomDetail, verify_code string) string {
|
|
74
|
+func SzybFY001(doctor string, doctor_code string, fixmedins_code string, datas []*models.CustomDetail, verify_code string, serial_number string) string {
|
75
|
75
|
// 生成输入报文
|
76
|
|
- inputMessage := SetSZInputMessage(doctor, doctor_code, fixmedins_code, verify_code)
|
|
76
|
+ inputMessage := SetSZInputMessage(doctor, doctor_code, fixmedins_code, verify_code, serial_number)
|
77
|
77
|
inputData := make(map[string]interface{})
|
78
|
78
|
inputMessage["transType"] = "FY001" // 交易编码
|
79
|
79
|
inputMessage["transChannel"] = "10" // 交易编码
|
|
@@ -92,9 +92,8 @@ func SzybFY001(doctor string, doctor_code string, fixmedins_code string, datas [
|
92
|
92
|
feedetailInfo["ake001"] = item.Code
|
93
|
93
|
feedetailInfo["ake002"] = item.CodeName
|
94
|
94
|
feedetailInfo["bkm017"] = item.Code
|
95
|
|
- feedetailInfo["aka070"] = "E001"
|
96
|
|
- feedetailInfo["aka074"] = "75mg"
|
97
|
|
-
|
|
95
|
+ feedetailInfo["aka070"] = item.DoseCode
|
|
96
|
+ feedetailInfo["aka074"] = item.Spec
|
98
|
97
|
feedetailInfo["aka064"] = 0
|
99
|
98
|
feedetailInfo["ake005"] = item.Code
|
100
|
99
|
feedetailInfo["ake006"] = item.CodeName
|
|
@@ -119,9 +118,7 @@ func SzybFY001(doctor string, doctor_code string, fixmedins_code string, datas [
|
119
|
118
|
return err.Error()
|
120
|
119
|
}
|
121
|
120
|
reader := bytes.NewReader(bytesData)
|
122
|
|
- //url := "http://192.168.1.99:10000"
|
123
|
121
|
url := "http://192.168.1.228:17001/szsi-portal/transData"
|
124
|
|
-
|
125
|
122
|
request, err := http.NewRequest("POST", url, reader)
|
126
|
123
|
if err != nil {
|
127
|
124
|
fmt.Println(err.Error())
|
|
@@ -145,14 +142,14 @@ func SzybFY001(doctor string, doctor_code string, fixmedins_code string, datas [
|
145
|
142
|
str := string(respBytes)
|
146
|
143
|
return str
|
147
|
144
|
}
|
148
|
|
-func SzybFY002(doctor string, doctor_code string, fixmedins_code string, datas []*models.CustomDetail, verify_code string) string {
|
|
145
|
+func SzybFY002(doctor string, doctor_code string, fixmedins_code string, datas []*models.CustomDetail, verify_code string, serial_number string) string {
|
149
|
146
|
// 生成输入报文
|
150
|
|
- inputMessage := SetSZInputMessage(doctor, doctor_code, fixmedins_code, verify_code)
|
|
147
|
+ inputMessage := SetSZInputMessage(doctor, doctor_code, fixmedins_code, verify_code, serial_number)
|
151
|
148
|
inputData := make(map[string]interface{})
|
152
|
149
|
inputMessage["transType"] = "FY002" // 交易编码
|
153
|
150
|
|
154
|
151
|
inputData["akc190"] = "G554020210305"
|
155
|
|
- inputData["bke384"] = "G5540202103316180298"
|
|
152
|
+ inputData["bke384"] = serial_number
|
156
|
153
|
inputData["listsize"] = len(datas)
|
157
|
154
|
|
158
|
155
|
feedetail := make([]map[string]interface{}, 0)
|
|
@@ -199,11 +196,11 @@ func SzybFY002(doctor string, doctor_code string, fixmedins_code string, datas [
|
199
|
196
|
str := string(respBytes)
|
200
|
197
|
return str
|
201
|
198
|
}
|
202
|
|
-func SzybFY004(doctor string, doctor_code string, fixmedins_code string, dept_code string, total float64, number string, verify_code string) string {
|
|
199
|
+func SzybFY004(doctor string, doctor_code string, fixmedins_code string, dept_code string, total float64, number string, verify_code string, serial_number string) string {
|
203
|
200
|
// 生成输入报文
|
204
|
|
- inputMessage := SetSZInputMessage(doctor, doctor_code, fixmedins_code, verify_code)
|
|
201
|
+ inputMessage := SetSZInputMessage(doctor, doctor_code, fixmedins_code, verify_code, number)
|
205
|
202
|
inputData := make(map[string]interface{})
|
206
|
|
- inputMessage["transType"] = "2021033012131415" // 交易编码
|
|
203
|
+ inputMessage["transType"] = "FY004" // 交易编码
|
207
|
204
|
|
208
|
205
|
inputData["akc190"] = "G554020210305"
|
209
|
206
|
inputData["aka130"] = "11"
|
|
@@ -212,7 +209,7 @@ func SzybFY004(doctor string, doctor_code string, fixmedins_code string, dept_co
|
212
|
209
|
inputData["aka030"] = "12"
|
213
|
210
|
inputData["akc264"] = total
|
214
|
211
|
inputData["ckc601"] = "0"
|
215
|
|
- inputData["bke384"] = "G5540202103316180298"
|
|
212
|
+ inputData["bke384"] = serial_number
|
216
|
213
|
inputMessage["transBody"] = inputData
|
217
|
214
|
bytesData, err := json.Marshal(inputMessage)
|
218
|
215
|
fmt.Println(string(bytesData))
|
|
@@ -247,15 +244,15 @@ func SzybFY004(doctor string, doctor_code string, fixmedins_code string, dept_co
|
247
|
244
|
str := string(respBytes)
|
248
|
245
|
return str
|
249
|
246
|
}
|
250
|
|
-func SzybFY005(doctor string, doctor_code string, fixmedins_code string, dept_code string, total float64, number string, verify_code string) string {
|
|
247
|
+func SzybFY005(doctor string, doctor_code string, fixmedins_code string, dept_code string, total float64, account string, verify_code string, serial_number string) string {
|
251
|
248
|
// 生成输入报文
|
252
|
|
- inputMessage := SetSZInputMessage(doctor, doctor_code, fixmedins_code, verify_code)
|
|
249
|
+ inputMessage := SetSZInputMessage(doctor, doctor_code, fixmedins_code, verify_code, serial_number)
|
253
|
250
|
inputData := make(map[string]interface{})
|
254
|
251
|
inputMessage["transType"] = "FY005" // 交易编码
|
255
|
252
|
|
256
|
|
- inputData["aaz500"] = "%GAAFSAKSXSUKKWDKHDAD?;07734724145330238292?"
|
|
253
|
+ inputData["aaz500"] = account
|
257
|
254
|
inputData["bzz269"] = "000000"
|
258
|
|
- inputData["akc190"] = "2021033012131415"
|
|
255
|
+ inputData["akc190"] = "G554020210305"
|
259
|
256
|
|
260
|
257
|
inputData["aka130"] = "11"
|
261
|
258
|
inputData["bkc320"] = doctor_code
|
|
@@ -263,7 +260,7 @@ func SzybFY005(doctor string, doctor_code string, fixmedins_code string, dept_co
|
263
|
260
|
inputData["aka030"] = "12"
|
264
|
261
|
inputData["akc264"] = total
|
265
|
262
|
inputData["ckc601"] = "0"
|
266
|
|
- inputData["bke384"] = "G5540202103316180298"
|
|
263
|
+ inputData["bke384"] = serial_number
|
267
|
264
|
|
268
|
265
|
inputMessage["transBody"] = inputData
|
269
|
266
|
|
|
@@ -344,8 +341,52 @@ func SzybJY002(doctor string, doctor_code string, fixmedins_code string, dept_co
|
344
|
341
|
return str
|
345
|
342
|
}
|
346
|
343
|
|
|
344
|
+func SzybJY003(doctor string, doctor_code string, fixmedins_code string, dept_code string, number string, verify_code string) string {
|
|
345
|
+ // 生成输入报文
|
|
346
|
+ inputMessage := SetSZInputMessage(doctor, doctor_code, fixmedins_code, verify_code)
|
|
347
|
+ inputData := make(map[string]interface{})
|
|
348
|
+ inputMessage["transType"] = "JY002" // 交易编码
|
|
349
|
+
|
|
350
|
+ inputData["akc190"] = "2021033012131415"
|
|
351
|
+ inputData["bke384"] = number
|
|
352
|
+
|
|
353
|
+ inputMessage["transBody"] = inputData
|
|
354
|
+ bytesData, err := json.Marshal(inputMessage)
|
|
355
|
+ fmt.Println(string(bytesData))
|
|
356
|
+ if err != nil {
|
|
357
|
+ fmt.Println(err.Error())
|
|
358
|
+ return err.Error()
|
|
359
|
+ }
|
|
360
|
+ reader := bytes.NewReader(bytesData)
|
|
361
|
+ //url := "http://192.168.1.99:10000"
|
|
362
|
+ url := "http://192.168.1.228:17001/szsi-portal/transData"
|
|
363
|
+
|
|
364
|
+ request, err := http.NewRequest("POST", url, reader)
|
|
365
|
+ if err != nil {
|
|
366
|
+ fmt.Println(err.Error())
|
|
367
|
+ return err.Error()
|
|
368
|
+ }
|
|
369
|
+
|
|
370
|
+ request.Header.Set("Content-Type", "application/json;charset=UTF-8")
|
|
371
|
+
|
|
372
|
+ client := http.Client{}
|
|
373
|
+ resp, err := client.Do(request)
|
|
374
|
+ if err != nil {
|
|
375
|
+ fmt.Println(err.Error())
|
|
376
|
+ return err.Error()
|
|
377
|
+ }
|
|
378
|
+ respBytes, err := ioutil.ReadAll(resp.Body)
|
|
379
|
+ if err != nil {
|
|
380
|
+ fmt.Println(err.Error())
|
|
381
|
+ return err.Error()
|
|
382
|
+ }
|
|
383
|
+ fmt.Println(string(respBytes))
|
|
384
|
+ str := string(respBytes)
|
|
385
|
+ return str
|
|
386
|
+}
|
|
387
|
+
|
347
|
388
|
// 生成基础报文
|
348
|
|
-func SetSZInputMessage(doctor string, doctor_code string, fixmedins_code string, verify_code string) map[string]interface{} {
|
|
389
|
+func SetSZInputMessage(doctor string, doctor_code string, fixmedins_code string, verify_code string, number string) map[string]interface{} {
|
349
|
390
|
month := time.Unix(1557042972, 0).Format("1")
|
350
|
391
|
year := time.Now().Format("2006")
|
351
|
392
|
month = time.Now().Format("01")
|
|
@@ -371,7 +412,7 @@ func SetSZInputMessage(doctor string, doctor_code string, fixmedins_code string,
|
371
|
412
|
inputMessage["operatorPass"] = "" // 定点协议机构操作人员编码
|
372
|
413
|
inputMessage["serialNumber"] = fixmedins_code + year + month + day +
|
373
|
414
|
fmt.Sprintf("%07v", rand.New(rand.NewSource(time.Now().UnixNano())).Int31n(10000000)) // 定点协议机构编码(5位)+日期(8位)+流水号(7位)
|
374
|
|
- inputMessage["serialNumber"] = "G5540202103316180298"
|
|
415
|
+ inputMessage["serialNumber"] = number
|
375
|
416
|
|
376
|
417
|
inputMessage["transReturnCode"] = "" //
|
377
|
418
|
inputMessage["transReturnMessage"] = "" //
|