|
@@ -6,6 +6,7 @@ import (
|
6
|
6
|
"fmt"
|
7
|
7
|
"gdyb/models"
|
8
|
8
|
"github.com/astaxie/beego"
|
|
9
|
+ "github.com/axgle/mahonia"
|
9
|
10
|
"io/ioutil"
|
10
|
11
|
"net/http"
|
11
|
12
|
"os/exec"
|
|
@@ -14,6 +15,22 @@ import (
|
14
|
15
|
"time"
|
15
|
16
|
)
|
16
|
17
|
|
|
18
|
+type Charset string
|
|
19
|
+
|
|
20
|
+const (
|
|
21
|
+ UTF8 = Charset("UTF-8")
|
|
22
|
+ GB18030 = Charset("GB18030")
|
|
23
|
+)
|
|
24
|
+
|
|
25
|
+func ConvertToString(src string, srcCode string, tagCode string) string {
|
|
26
|
+ srcCoder := mahonia.NewDecoder(srcCode)
|
|
27
|
+ srcResult := srcCoder.ConvertString(src)
|
|
28
|
+ tagCoder := mahonia.NewDecoder(tagCode)
|
|
29
|
+ _, cdata, _ := tagCoder.Translate([]byte(srcResult), true)
|
|
30
|
+ result := string(cdata)
|
|
31
|
+ return result
|
|
32
|
+}
|
|
33
|
+
|
17
|
34
|
// 人员基本信息
|
18
|
35
|
func Hbyb1101(certNo string, org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, id_card_type int64, card_sn string, certificates string) (string, string) {
|
19
|
36
|
//生成签名
|
|
@@ -66,8 +83,9 @@ func Hbyb1101(certNo string, org_name string, doctor string, fixmedins_code stri
|
66
|
83
|
if err != nil {
|
67
|
84
|
fmt.Println("error:", err.Error())
|
68
|
85
|
}
|
|
86
|
+
|
69
|
87
|
fmt.Println(string(out))
|
70
|
|
- return string(out), inputLog
|
|
88
|
+ return ConvertToString(string(out), "gbk", "utf-8"), inputLog
|
71
|
89
|
|
72
|
90
|
}
|
73
|
91
|
|
|
@@ -124,7 +142,7 @@ func Hbyb2201(psnNo string, insutype string, certNo string, org_name string, doc
|
124
|
142
|
}
|
125
|
143
|
fmt.Println(string(out))
|
126
|
144
|
|
127
|
|
- return string(out), requestLog
|
|
145
|
+ return ConvertToString(string(out), "gbk", "utf-8"), requestLog
|
128
|
146
|
|
129
|
147
|
}
|
130
|
148
|
|
|
@@ -164,7 +182,7 @@ func Hbyb2202(psnNo string, mdtrtId string, ipt_otp_no string, org_name string,
|
164
|
182
|
}
|
165
|
183
|
fmt.Println(string(out))
|
166
|
184
|
|
167
|
|
- return string(out), requestLog
|
|
185
|
+ return ConvertToString(string(out), "gbk", "utf-8"), requestLog
|
168
|
186
|
|
169
|
187
|
}
|
170
|
188
|
|
|
@@ -228,7 +246,7 @@ func Hbyb2203(psnNo string, mdtrtId string, doctor string, department string, or
|
228
|
246
|
}
|
229
|
247
|
fmt.Println(string(out))
|
230
|
248
|
|
231
|
|
- return string(out), requestLog
|
|
249
|
+ return ConvertToString(string(out), "gbk", "utf-8"), requestLog
|
232
|
250
|
|
233
|
251
|
}
|
234
|
252
|
|
|
@@ -397,7 +415,7 @@ func Hbyb2204(psnNo string, mdtrtId string, hisPrescription []*models.HisPrescri
|
397
|
415
|
}
|
398
|
416
|
fmt.Println(string(out))
|
399
|
417
|
|
400
|
|
- return string(out), requestLog
|
|
418
|
+ return ConvertToString(string(out), "gbk", "utf-8"), requestLog
|
401
|
419
|
|
402
|
420
|
}
|
403
|
421
|
|
|
@@ -437,7 +455,7 @@ func Hbyb2205(psnNo string, mdtrtId string, chrgBchno string, org_name string, d
|
437
|
455
|
}
|
438
|
456
|
fmt.Println(string(out))
|
439
|
457
|
|
440
|
|
- return string(out), requestLog
|
|
458
|
+ return ConvertToString(string(out), "gbk", "utf-8"), requestLog
|
441
|
459
|
|
442
|
460
|
}
|
443
|
461
|
|
|
@@ -507,7 +525,7 @@ func Hbyb2206(psnNo string, mdtrtId string, chrgBchno string, certNo string, ins
|
507
|
525
|
}
|
508
|
526
|
fmt.Println(string(out))
|
509
|
527
|
|
510
|
|
- return string(out), requestLog
|
|
528
|
+ return ConvertToString(string(out), "gbk", "utf-8"), requestLog
|
511
|
529
|
|
512
|
530
|
}
|
513
|
531
|
|
|
@@ -577,7 +595,7 @@ func Hbyb2207(psnNo string, mdtrtId string, chrgBchno string, certNo string, ins
|
577
|
595
|
str2 := string(mjson)
|
578
|
596
|
fmt.Println(string(out))
|
579
|
597
|
|
580
|
|
- return string(out), str2
|
|
598
|
+ return ConvertToString(string(out), "gbk", "utf-8"), str2
|
581
|
599
|
|
582
|
600
|
}
|
583
|
601
|
|
|
@@ -617,7 +635,7 @@ func Hbyb2208(psnNo string, mdtrtId string, setlId string, org_name string, doct
|
617
|
635
|
str2 := string(mjson)
|
618
|
636
|
fmt.Println(string(out))
|
619
|
637
|
|
620
|
|
- return string(out), str2
|
|
638
|
+ return ConvertToString(string(out), "gbk", "utf-8"), str2
|
621
|
639
|
|
622
|
640
|
}
|
623
|
641
|
|
|
@@ -655,7 +673,7 @@ func Hbyb5203(baseParams models.BaseParams, businessParams models.BusinessParams
|
655
|
673
|
//str2 := string(mjson)
|
656
|
674
|
fmt.Println(string(out))
|
657
|
675
|
|
658
|
|
- return string(out)
|
|
676
|
+ return ConvertToString(string(out), "gbk", "utf-8")
|
659
|
677
|
}
|
660
|
678
|
|
661
|
679
|
//确认订单
|