|
@@ -14,7 +14,8 @@ import (
|
14
|
14
|
"strings"
|
15
|
15
|
"time"
|
16
|
16
|
"encoding/xml"
|
17
|
|
-
|
|
17
|
+ "github.com/go-ole/go-ole/oleutil"
|
|
18
|
+ "github.com/go-ole/go-ole"
|
18
|
19
|
|
19
|
20
|
)
|
20
|
21
|
|
|
@@ -86,15 +87,16 @@ func Hbyb1101(certNo string, org_name string, doctor string, fixmedins_code stri
|
86
|
87
|
return err.Error(), ""
|
87
|
88
|
}
|
88
|
89
|
|
89
|
|
- var json2 string
|
90
|
|
- cmd := exec.Command("java", "-jar", "yh_hb_fat.jar", "1101", string(bytesData), json2)
|
91
|
|
- out, err := cmd.Output()
|
92
|
|
- if err != nil {
|
93
|
|
- fmt.Println("error:", err.Error())
|
94
|
|
- }
|
|
90
|
+ //var json2 string
|
95
|
91
|
|
96
|
|
- fmt.Println(string(out))
|
97
|
|
- return ConvertToString(string(out), "gbk", "utf-8"), inputLog
|
|
92
|
+ out := GetoleInfo("1101",string(bytesData))
|
|
93
|
+
|
|
94
|
+ //cmd := exec.Command("java", "-jar", "yh_hb_fat.jar", "1101", string(bytesData), json2)
|
|
95
|
+ //out, err := cmd.CombinedOutput()
|
|
96
|
+ //if err != nil {
|
|
97
|
+ // fmt.Println("error:", err.Error())
|
|
98
|
+ //}
|
|
99
|
+ return out, inputLog
|
98
|
100
|
|
99
|
101
|
}
|
100
|
102
|
|
|
@@ -145,16 +147,18 @@ func Hbyb2201(psnNo string, insutype string, certNo string, org_name string, doc
|
145
|
147
|
fmt.Println(err.Error())
|
146
|
148
|
return err.Error(), ""
|
147
|
149
|
}
|
|
150
|
+ out := GetoleInfo("2201",string(bytesData))
|
148
|
151
|
|
149
|
|
- var json2 string
|
150
|
|
- cmd := exec.Command("java", "-jar", "yh_hb_fat.jar", "2201", string(bytesData), json2)
|
151
|
|
- out, err := cmd.Output()
|
152
|
|
- if err != nil {
|
153
|
|
- fmt.Println("error:", err.Error())
|
154
|
|
- }
|
|
152
|
+ //var json2 string
|
|
153
|
+ //cmd := exec.Command("java", "-jar", "yh_hb_fat.jar", "2201", string(bytesData), json2)
|
|
154
|
+ //out, err := cmd.Output()
|
|
155
|
+ //if err != nil {
|
|
156
|
+ // fmt.Println("error:", err.Error())
|
|
157
|
+ //}
|
155
|
158
|
fmt.Println(string(out))
|
156
|
159
|
|
157
|
|
- return ConvertToString(string(out), "gbk", "utf-8"), requestLog
|
|
160
|
+
|
|
161
|
+ return string(out), requestLog
|
158
|
162
|
|
159
|
163
|
}
|
160
|
164
|
|
|
@@ -185,16 +189,17 @@ func Hbyb2202(psnNo string, mdtrtId string, ipt_otp_no string, org_name string,
|
185
|
189
|
fmt.Println(err.Error())
|
186
|
190
|
return err.Error(), ""
|
187
|
191
|
}
|
|
192
|
+ out := GetoleInfo("2202",string(bytesData))
|
188
|
193
|
|
189
|
|
- var json2 string
|
190
|
|
- cmd := exec.Command("java", "-jar", "yh_hb_fat.jar", "2202", string(bytesData), json2)
|
191
|
|
- out, err := cmd.Output()
|
192
|
|
- if err != nil {
|
193
|
|
- fmt.Println("error:", err.Error())
|
194
|
|
- }
|
195
|
|
- fmt.Println(string(out))
|
|
194
|
+ //var json2 string
|
|
195
|
+ //cmd := exec.Command("java", "-jar", "yh_hb_fat.jar", "2202", string(bytesData), json2)
|
|
196
|
+ //out, err := cmd.Output()
|
|
197
|
+ //if err != nil {
|
|
198
|
+ // fmt.Println("error:", err.Error())
|
|
199
|
+ //}
|
|
200
|
+ //fmt.Println(string(out))
|
196
|
201
|
|
197
|
|
- return ConvertToString(string(out), "gbk", "utf-8"), requestLog
|
|
202
|
+ return string(out), requestLog
|
198
|
203
|
|
199
|
204
|
}
|
200
|
205
|
|
|
@@ -260,15 +265,16 @@ func Hbyb2203(psnNo string, mdtrtId string, doctor string, department string, or
|
260
|
265
|
return err.Error(), ""
|
261
|
266
|
}
|
262
|
267
|
|
263
|
|
- var json2 string
|
264
|
|
- cmd := exec.Command("java", "-jar", "yh_hb_fat.jar", "2203", string(bytesData), json2)
|
265
|
|
- out, err := cmd.Output()
|
266
|
|
- if err != nil {
|
267
|
|
- fmt.Println("error:", err.Error())
|
268
|
|
- }
|
269
|
|
- fmt.Println(string(out))
|
|
268
|
+ //var json2 string
|
|
269
|
+ //cmd := exec.Command("java", "-jar", "yh_hb_fat.jar", "2203", string(bytesData), json2)
|
|
270
|
+ //out, err := cmd.Output()
|
|
271
|
+ //if err != nil {
|
|
272
|
+ // fmt.Println("error:", err.Error())
|
|
273
|
+ //}
|
|
274
|
+ //fmt.Println(string(out))
|
|
275
|
+ out := GetoleInfo("2203",string(bytesData))
|
270
|
276
|
|
271
|
|
- return ConvertToString(string(out), "gbk", "utf-8"), requestLog
|
|
277
|
+ return out, requestLog
|
272
|
278
|
|
273
|
279
|
}
|
274
|
280
|
|
|
@@ -438,15 +444,17 @@ func Hbyb2204(psnNo string, mdtrtId string, hisPrescription []*models.HisPrescri
|
438
|
444
|
return "", ""
|
439
|
445
|
}
|
440
|
446
|
|
441
|
|
- var json2 string
|
442
|
|
- cmd := exec.Command("java", "-jar", "yh_hb_fat.jar", "2204", string(bytesData), json2)
|
443
|
|
- out, err := cmd.Output()
|
444
|
|
- if err != nil {
|
445
|
|
- fmt.Println("error:", err.Error())
|
446
|
|
- }
|
447
|
|
- fmt.Println(string(out))
|
|
447
|
+ //var json2 string
|
|
448
|
+ //cmd := exec.Command("java", "-jar", "yh_hb_fat.jar", "2204", string(bytesData), json2)
|
|
449
|
+ //out, err := cmd.Output()
|
|
450
|
+ //if err != nil {
|
|
451
|
+ // fmt.Println("error:", err.Error())
|
|
452
|
+ //}
|
|
453
|
+ //fmt.Println(string(out))
|
|
454
|
+ out := GetoleInfo("2204",string(bytesData))
|
|
455
|
+
|
|
456
|
+ return out, requestLog
|
448
|
457
|
|
449
|
|
- return ConvertToString(string(out), "gbk", "utf-8"), requestLog
|
450
|
458
|
|
451
|
459
|
}
|
452
|
460
|
|
|
@@ -478,15 +486,17 @@ func Hbyb2205(psnNo string, mdtrtId string, chrgBchno string, org_name string, d
|
478
|
486
|
return err.Error(), ""
|
479
|
487
|
}
|
480
|
488
|
|
481
|
|
- var json2 string
|
482
|
|
- cmd := exec.Command("java", "-jar", "yh_hb_fat.jar", "2205", string(bytesData), json2)
|
483
|
|
- out, err := cmd.Output()
|
484
|
|
- if err != nil {
|
485
|
|
- fmt.Println("error:", err.Error())
|
486
|
|
- }
|
487
|
|
- fmt.Println(string(out))
|
|
489
|
+ //var json2 string
|
|
490
|
+ //cmd := exec.Command("java", "-jar", "yh_hb_fat.jar", "2205", string(bytesData), json2)
|
|
491
|
+ //out, err := cmd.Output()
|
|
492
|
+ //if err != nil {
|
|
493
|
+ // fmt.Println("error:", err.Error())
|
|
494
|
+ //}
|
|
495
|
+ //fmt.Println(string(out))
|
|
496
|
+
|
|
497
|
+ out := GetoleInfo("2205",string(bytesData))
|
488
|
498
|
|
489
|
|
- return ConvertToString(string(out), "gbk", "utf-8"), requestLog
|
|
499
|
+ return out, requestLog
|
490
|
500
|
|
491
|
501
|
}
|
492
|
502
|
|
|
@@ -553,15 +563,16 @@ func Hbyb2206(psnNo string, mdtrtId string, chrgBchno string, certNo string, ins
|
553
|
563
|
return err.Error(), ""
|
554
|
564
|
}
|
555
|
565
|
|
556
|
|
- var json2 string
|
557
|
|
- cmd := exec.Command("java", "-jar", "yh_hb_fat.jar", "2206", string(bytesData), json2)
|
558
|
|
- out, err := cmd.Output()
|
559
|
|
- if err != nil {
|
560
|
|
- fmt.Println("error:", err.Error())
|
561
|
|
- }
|
562
|
|
- fmt.Println(string(out))
|
|
566
|
+ //var json2 string
|
|
567
|
+ //cmd := exec.Command("java", "-jar", "yh_hb_fat.jar", "2206", string(bytesData), json2)
|
|
568
|
+ //out, err := cmd.Output()
|
|
569
|
+ //if err != nil {
|
|
570
|
+ // fmt.Println("error:", err.Error())
|
|
571
|
+ //}
|
|
572
|
+ //fmt.Println(string(out))
|
|
573
|
+ out := GetoleInfo("2206",string(bytesData))
|
563
|
574
|
|
564
|
|
- return ConvertToString(string(out), "gbk", "utf-8"), requestLog
|
|
575
|
+ return out, requestLog
|
565
|
576
|
|
566
|
577
|
}
|
567
|
578
|
|
|
@@ -624,17 +635,19 @@ func Hbyb2207(psnNo string, mdtrtId string, chrgBchno string, certNo string, ins
|
624
|
635
|
return err.Error(), ""
|
625
|
636
|
}
|
626
|
637
|
|
627
|
|
- var json2 string
|
628
|
|
- cmd := exec.Command("java", "-jar", "yh_hb_fat.jar", "2207", string(bytesData), json2)
|
629
|
|
- out, err := cmd.Output()
|
630
|
|
- if err != nil {
|
631
|
|
- fmt.Println("error:", err.Error())
|
632
|
|
- }
|
|
638
|
+ //var json2 string
|
|
639
|
+ //cmd := exec.Command("java", "-jar", "yh_hb_fat.jar", "2207", string(bytesData), json2)
|
|
640
|
+ //out, err := cmd.Output()
|
|
641
|
+ //if err != nil {
|
|
642
|
+ // fmt.Println("error:", err.Error())
|
|
643
|
+ //}
|
633
|
644
|
mjson, _ := json.Marshal(inputMessage)
|
634
|
645
|
str2 := string(mjson)
|
635
|
|
- fmt.Println(string(out))
|
636
|
646
|
|
637
|
|
- return ConvertToString(string(out), "gbk", "utf-8"), str2
|
|
647
|
+ out := GetoleInfo("2207",string(bytesData))
|
|
648
|
+
|
|
649
|
+
|
|
650
|
+ return out, str2
|
638
|
651
|
|
639
|
652
|
}
|
640
|
653
|
|
|
@@ -664,17 +677,17 @@ func Hbyb2208(psnNo string, mdtrtId string, setlId string, org_name string, doct
|
664
|
677
|
return err.Error(), ""
|
665
|
678
|
}
|
666
|
679
|
|
667
|
|
- var json2 string
|
668
|
|
- cmd := exec.Command("java", "-jar", "yh_hb_fat.jar", "2208", string(bytesData), json2)
|
669
|
|
- out, err := cmd.Output()
|
670
|
|
- if err != nil {
|
671
|
|
- fmt.Println("error:", err.Error())
|
672
|
|
- }
|
|
680
|
+ //var json2 string
|
|
681
|
+ //cmd := exec.Command("java", "-jar", "yh_hb_fat.jar", "2208", string(bytesData), json2)
|
|
682
|
+ //out, err := cmd.Output()
|
|
683
|
+ //if err != nil {
|
|
684
|
+ // fmt.Println("error:", err.Error())
|
|
685
|
+ //}
|
673
|
686
|
mjson, _ := json.Marshal(inputMessage)
|
674
|
687
|
str2 := string(mjson)
|
675
|
|
- fmt.Println(string(out))
|
676
|
|
-
|
677
|
|
- return ConvertToString(string(out), "gbk", "utf-8"), str2
|
|
688
|
+ //fmt.Println(string(out))
|
|
689
|
+ out := GetoleInfo("2208",string(bytesData))
|
|
690
|
+ return out, str2
|
678
|
691
|
|
679
|
692
|
}
|
680
|
693
|
|
|
@@ -702,17 +715,19 @@ func Hbyb5203(baseParams models.BaseParams, businessParams models.BusinessParams
|
702
|
715
|
return err.Error()
|
703
|
716
|
}
|
704
|
717
|
|
705
|
|
- var json2 string
|
706
|
|
- cmd := exec.Command("java", "-jar", "yh_hb_fat.jar", "YH03", string(bytesData), json2)
|
707
|
|
- out, err := cmd.Output()
|
708
|
|
- if err != nil {
|
709
|
|
- fmt.Println("error:", err.Error())
|
710
|
|
- }
|
|
718
|
+ //var json2 string
|
|
719
|
+ //cmd := exec.Command("java", "-jar", "yh_hb_fat.jar", "YH03", string(bytesData), json2)
|
|
720
|
+ //out, err := cmd.Output()
|
|
721
|
+ //if err != nil {
|
|
722
|
+ // fmt.Println("error:", err.Error())
|
|
723
|
+ //}
|
|
724
|
+ out := GetoleInfo("YH03",string(bytesData))
|
|
725
|
+
|
711
|
726
|
//mjson, _ := json.Marshal(inputMessage)
|
712
|
727
|
//str2 := string(mjson)
|
713
|
728
|
fmt.Println(string(out))
|
714
|
729
|
|
715
|
|
- return ConvertToString(string(out), "gbk", "utf-8")
|
|
730
|
+ return out
|
716
|
731
|
}
|
717
|
732
|
|
718
|
733
|
func Hbyb5203aa(baseParams models.BaseParams, businessParams models.BusinessParams) string {
|
|
@@ -1910,14 +1925,9 @@ func Hbyb5301(psnNo string, insutype string, org_name string, doctor string, fix
|
1910
|
1925
|
return err.Error()
|
1911
|
1926
|
}
|
1912
|
1927
|
|
1913
|
|
- var json2 string
|
1914
|
|
- cmd := exec.Command("java", "-jar", "yh_hb_fat.jar", "5301", string(bytesData), json2)
|
1915
|
|
- out, err := cmd.Output()
|
1916
|
|
- if err != nil {
|
1917
|
|
- fmt.Println("error:", err.Error())
|
1918
|
|
- }
|
1919
|
|
- fmt.Println(string(out))
|
1920
|
|
- return ConvertToString(string(out), "gbk", "utf-8")
|
|
1928
|
+ out := GetoleInfo("5301",string(bytesData))
|
|
1929
|
+ return out
|
|
1930
|
+ //return ConvertToString(string(out), "gbk", "utf-8")
|
1921
|
1931
|
|
1922
|
1932
|
}
|
1923
|
1933
|
|
|
@@ -3199,3 +3209,50 @@ func Hb2305(psnNo string, mdtrtId string, setlId string, org_name string, doctor
|
3199
|
3209
|
|
3200
|
3210
|
//return string(out), string(bytesData)
|
3201
|
3211
|
}
|
|
3212
|
+
|
|
3213
|
+
|
|
3214
|
+func GetoleInfo(code string,data string) string {
|
|
3215
|
+ ole.CoInitializeEx(0, ole.COINIT_MULTITHREADED)
|
|
3216
|
+ defer ole.CoUninitialize()
|
|
3217
|
+
|
|
3218
|
+ // Replace with the ProgID or CLSID of your COM object
|
|
3219
|
+ progID := "yinhai.yh_hb_sctr"
|
|
3220
|
+
|
|
3221
|
+ // Create COM object
|
|
3222
|
+ unknown, err := oleutil.CreateObject(progID)
|
|
3223
|
+ if err != nil {
|
|
3224
|
+ fmt.Println("Unable to create COM object:", err)
|
|
3225
|
+ }
|
|
3226
|
+ defer unknown.Release()
|
|
3227
|
+
|
|
3228
|
+ // Query for the IDispatch interface
|
|
3229
|
+ dispatch, err := unknown.QueryInterface(ole.IID_IDispatch)
|
|
3230
|
+ if err != nil {
|
|
3231
|
+ fmt.Println("Unable to get IDispatch interface:", err)
|
|
3232
|
+ }
|
|
3233
|
+ defer dispatch.Release()
|
|
3234
|
+
|
|
3235
|
+ // Prepare parameters
|
|
3236
|
+ //transNo := "1401"
|
|
3237
|
+ //transType := "passwordCheck"
|
|
3238
|
+ //timestamp := time.Now().Unix()
|
|
3239
|
+ //fixmedinsCode := "H45072101171"
|
|
3240
|
+ //psnNo := ""
|
|
3241
|
+ //data := fmt.Sprintf(`{"transNo":"%s","transType":"%s","timestamp":"%s","data":{"fixmedinsCode":"%s","psnNo":"%s"}}`, transNo, transType, timestamp, fixmedinsCode, psnNo)
|
|
3242
|
+ result2 := ""
|
|
3243
|
+ // Call COM object's method using the IDispatch interface
|
|
3244
|
+ resulr, err := oleutil.CallMethod(dispatch, "yh_hb_call", code, data, &result2)
|
|
3245
|
+ fmt.Println(resulr)
|
|
3246
|
+ fmt.Println(result2)
|
|
3247
|
+
|
|
3248
|
+ if err != nil {
|
|
3249
|
+ fmt.Println("调用COM对象方法失败:", err)
|
|
3250
|
+ }
|
|
3251
|
+
|
|
3252
|
+ //var response Response
|
|
3253
|
+ //err2 := json.Unmarshal([]byte(result2), &response)
|
|
3254
|
+ //if err2 != nil {
|
|
3255
|
+ // fmt.Println("解析JSON失败:", err)
|
|
3256
|
+ //}
|
|
3257
|
+ return result2
|
|
3258
|
+}
|