|
@@ -6,19 +6,18 @@ import (
|
6
|
6
|
"fmt"
|
7
|
7
|
"gdyb/models"
|
8
|
8
|
"io/ioutil"
|
9
|
|
- "math/rand"
|
10
|
9
|
"net/http"
|
11
|
10
|
"time"
|
12
|
11
|
_ "unsafe"
|
13
|
12
|
)
|
14
|
13
|
|
15
|
|
-func SzybMZ002(doctor string, doctor_code string, fixmedins_code string, dept_code string, account string, verify_code string, serial_number string) string {
|
|
14
|
+func SzybMZ002(doctor string, doctor_code string, fixmedins_code string, dept_code string, account string, verify_code string, serial_number string, other_number string) string {
|
16
|
15
|
// 生成输入报文
|
17
|
16
|
inputMessage := SetSZInputMessage(doctor, doctor_code, fixmedins_code, verify_code, serial_number)
|
18
|
17
|
inputData := make(map[string]interface{})
|
19
|
18
|
inputMessage["transType"] = "MZ002" // 交易编码
|
20
|
19
|
|
21
|
|
- inputData["akc190"] = serial_number
|
|
20
|
+ inputData["akc190"] = "202104080950121452"
|
22
|
21
|
inputData["aaz500"] = account
|
23
|
22
|
inputData["bzz269"] = "000000"
|
24
|
23
|
inputData["aka130"] = "11"
|
|
@@ -26,15 +25,17 @@ func SzybMZ002(doctor string, doctor_code string, fixmedins_code string, dept_co
|
26
|
25
|
inputData["bkc368"] = "2"
|
27
|
26
|
inputData["akc264"] = 10.00
|
28
|
27
|
inputData["listsize"] = 1
|
29
|
|
-
|
|
28
|
+ timestamp := time.Now().Unix()
|
|
29
|
+ tempTime := time.Unix(timestamp, 0)
|
|
30
|
+ timeFormat := tempTime.Format("20060102150405")
|
30
|
31
|
feedetail := make([]map[string]interface{}, 0)
|
31
|
32
|
feedetailInfo := make(map[string]interface{})
|
32
|
|
- feedetailInfo["aae072"] = "202123242526272829"
|
33
|
|
- feedetailInfo["bkf500"] = "202123242526272829"
|
|
33
|
+ feedetailInfo["aae072"] = timeFormat
|
|
34
|
+ feedetailInfo["bkf500"] = timeFormat
|
34
|
35
|
feedetailInfo["ake001"] = "110100002"
|
35
|
36
|
feedetailInfo["ake005"] = "110100002"
|
36
|
37
|
feedetailInfo["ake006"] = "普通门诊诊查费"
|
37
|
|
- feedetailInfo["aae019"] = "10.00"
|
|
38
|
+ feedetailInfo["aae019"] = 10.00
|
38
|
39
|
feedetail = append(feedetail, feedetailInfo)
|
39
|
40
|
inputData["inputlist"] = feedetail
|
40
|
41
|
|
|
@@ -79,7 +80,7 @@ func SzybFY001(doctor string, doctor_code string, fixmedins_code string, datas [
|
79
|
80
|
inputMessage["transChannel"] = "10" // 交易编码
|
80
|
81
|
|
81
|
82
|
inputData["akc190"] = "G554020210305"
|
82
|
|
- inputData["bke384"] = "G5540202103316180298"
|
|
83
|
+ inputData["bke384"] = serial_number
|
83
|
84
|
inputData["listsize"] = len(datas)
|
84
|
85
|
|
85
|
86
|
feedetail := make([]map[string]interface{}, 0)
|
|
@@ -196,9 +197,9 @@ func SzybFY002(doctor string, doctor_code string, fixmedins_code string, datas [
|
196
|
197
|
str := string(respBytes)
|
197
|
198
|
return str
|
198
|
199
|
}
|
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 {
|
|
200
|
+func SzybFY004(doctor string, doctor_code string, fixmedins_code string, total float64, verify_code string, serial_number string) string {
|
200
|
201
|
// 生成输入报文
|
201
|
|
- inputMessage := SetSZInputMessage(doctor, doctor_code, fixmedins_code, verify_code, number)
|
|
202
|
+ inputMessage := SetSZInputMessage(doctor, doctor_code, fixmedins_code, verify_code, serial_number)
|
202
|
203
|
inputData := make(map[string]interface{})
|
203
|
204
|
inputMessage["transType"] = "FY004" // 交易编码
|
204
|
205
|
|
|
@@ -253,7 +254,6 @@ func SzybFY005(doctor string, doctor_code string, fixmedins_code string, dept_co
|
253
|
254
|
inputData["aaz500"] = account
|
254
|
255
|
inputData["bzz269"] = "000000"
|
255
|
256
|
inputData["akc190"] = "G554020210305"
|
256
|
|
-
|
257
|
257
|
inputData["aka130"] = "11"
|
258
|
258
|
inputData["bkc320"] = doctor_code
|
259
|
259
|
inputData["ckc350"] = doctor
|
|
@@ -297,6 +297,58 @@ func SzybFY005(doctor string, doctor_code string, fixmedins_code string, dept_co
|
297
|
297
|
str := string(respBytes)
|
298
|
298
|
return str
|
299
|
299
|
}
|
|
300
|
+func SzybJY001(doctor string, doctor_code string, fixmedins_code string, setl_number string, mz_number string, verify_code string) string {
|
|
301
|
+ // 生成输入报文
|
|
302
|
+ inputMessage := SetSZInputMessage(doctor, doctor_code, fixmedins_code, verify_code, setl_number)
|
|
303
|
+ inputData := make(map[string]interface{})
|
|
304
|
+ inputMessage["transType"] = "JY001" // 交易编码
|
|
305
|
+
|
|
306
|
+ inputData["akc190"] = mz_number
|
|
307
|
+ inputData["bke384"] = setl_number
|
|
308
|
+
|
|
309
|
+ inputMessage["transBody"] = inputData
|
|
310
|
+ bytesData, err := json.Marshal(inputMessage)
|
|
311
|
+ fmt.Println(string(bytesData))
|
|
312
|
+ if err != nil {
|
|
313
|
+ fmt.Println(err.Error())
|
|
314
|
+ return err.Error()
|
|
315
|
+ }
|
|
316
|
+ reader := bytes.NewReader(bytesData)
|
|
317
|
+ //url := "http://192.168.1.99:10000"
|
|
318
|
+ url := "http://192.168.1.228:17001/szsi-portal/transData"
|
|
319
|
+
|
|
320
|
+ request, err := http.NewRequest("POST", url, reader)
|
|
321
|
+ if err != nil {
|
|
322
|
+ fmt.Println(err.Error())
|
|
323
|
+ return err.Error()
|
|
324
|
+ }
|
|
325
|
+
|
|
326
|
+ request.Header.Set("Content-Type", "application/json;charset=UTF-8")
|
|
327
|
+
|
|
328
|
+ client := http.Client{}
|
|
329
|
+ resp, err := client.Do(request)
|
|
330
|
+ if err != nil {
|
|
331
|
+ fmt.Println(err.Error())
|
|
332
|
+ return err.Error()
|
|
333
|
+ }
|
|
334
|
+ respBytes, err := ioutil.ReadAll(resp.Body)
|
|
335
|
+ if err != nil {
|
|
336
|
+ fmt.Println(err.Error())
|
|
337
|
+ return err.Error()
|
|
338
|
+ }
|
|
339
|
+ fmt.Println(string(respBytes))
|
|
340
|
+ str := string(respBytes)
|
|
341
|
+ return str
|
|
342
|
+}
|
|
343
|
+
|
|
344
|
+func SzybJY002(doctor string, doctor_code string, fixmedins_code string, setl_number string, mz_number string, verify_code string) string {
|
|
345
|
+ // 生成输入报文
|
|
346
|
+ inputMessage := SetSZInputMessage(doctor, doctor_code, fixmedins_code, verify_code, setl_number)
|
|
347
|
+ inputData := make(map[string]interface{})
|
|
348
|
+ inputMessage["transType"] = "JY002" // 交易编码
|
|
349
|
+
|
|
350
|
+ inputData["akc190"] = mz_number
|
|
351
|
+ inputData["bke384"] = setl_number
|
300
|
352
|
|
301
|
353
|
//func SzybJY002(doctor string, doctor_code string, fixmedins_code string, dept_code string, number string, verify_code string) string {
|
302
|
354
|
// // 生成输入报文
|
|
@@ -386,15 +438,40 @@ func SzybFY005(doctor string, doctor_code string, fixmedins_code string, dept_co
|
386
|
438
|
// return str
|
387
|
439
|
//}
|
388
|
440
|
|
|
441
|
+ request.Header.Set("Content-Type", "application/json;charset=UTF-8")
|
|
442
|
+
|
|
443
|
+ client := http.Client{}
|
|
444
|
+ resp, err := client.Do(request)
|
|
445
|
+ if err != nil {
|
|
446
|
+ fmt.Println(err.Error())
|
|
447
|
+ return err.Error()
|
|
448
|
+ }
|
|
449
|
+ respBytes, err := ioutil.ReadAll(resp.Body)
|
|
450
|
+ if err != nil {
|
|
451
|
+ fmt.Println(err.Error())
|
|
452
|
+ return err.Error()
|
|
453
|
+ }
|
|
454
|
+ fmt.Println(string(respBytes))
|
|
455
|
+ str := string(respBytes)
|
|
456
|
+ return str
|
|
457
|
+}
|
|
458
|
+func SzybJY003(doctor string, doctor_code string, fixmedins_code string, setl_number string, mz_number string, verify_code string) string {
|
|
459
|
+
|
|
460
|
+ // 生成输入报文
|
|
461
|
+ inputMessage := SetSZInputMessage(doctor, doctor_code, fixmedins_code, verify_code, setl_number)
|
|
462
|
+
|
389
|
463
|
func SzybML008(doctor string, doctor_code string, fixmedins_code string, datas []*models.DrugDetail) string {
|
390
|
464
|
//生成输入报文
|
391
|
465
|
inputMessage := SetSZDrugMessage(doctor, doctor_code, fixmedins_code)
|
392
|
466
|
|
393
|
467
|
inputData := make(map[string]interface{})
|
|
468
|
+ inputMessage["transType"] = "JY003" // 交易编码
|
394
|
469
|
|
395
|
470
|
inputData["listsize"] = len(datas)
|
396
|
471
|
inputMessage["transType"] = "ML008" // 交易编码
|
397
|
472
|
feedetail := make([]map[string]interface{}, 0)
|
|
473
|
+ inputData["akc190"] = mz_number
|
|
474
|
+ inputData["bke384"] = setl_number
|
398
|
475
|
|
399
|
476
|
for _, item := range datas {
|
400
|
477
|
fmt.Println("中国222222", item.DrugDosageName)
|
|
@@ -479,8 +556,6 @@ func SetSZInputMessage(doctor string, doctor_code string, fixmedins_code string,
|
479
|
556
|
inputMessage["operatorCode"] = doctor_code // 操作员编码
|
480
|
557
|
inputMessage["operatorName"] = doctor // 操作员名字
|
481
|
558
|
inputMessage["operatorPass"] = "" // 定点协议机构操作人员编码
|
482
|
|
- inputMessage["serialNumber"] = fixmedins_code + year + month + day +
|
483
|
|
- fmt.Sprintf("%07v", rand.New(rand.NewSource(time.Now().UnixNano())).Int31n(10000000)) // 定点协议机构编码(5位)+日期(8位)+流水号(7位)
|
484
|
559
|
inputMessage["serialNumber"] = number
|
485
|
560
|
|
486
|
561
|
inputMessage["transReturnCode"] = "" //
|