Преглед изворни кода

Merge branch 'master' of http://git.shengws.com/csx/gdyb

陈少旭 пре 4 месеци
родитељ
комит
f041e3a883

+ 5 - 2
controllers/hb/hbyb_controller.go Прегледај датотеку

@@ -13,6 +13,7 @@ import (
13 13
 	"gdyb/utils"
14 14
 	"github.com/astaxie/beego"
15 15
 	"io/ioutil"
16
+
16 17
 )
17 18
 
18 19
 type HBybController struct {
@@ -992,8 +993,7 @@ func (c *HBybController) PostTen() {
992 993
 		SetlId:  setlId,
993 994
 	}
994 995
 	var result string
995
-	if mdtrtarea_admvs == "421182"{
996
-
996
+	if mdtrtarea_admvs == "421182" || mdtrtarea_admvs == "420902"{
997 997
 
998 998
 		result = service.Hbyb5203(baseParams, businessParams,med_type)
999 999
 
@@ -1056,3 +1056,6 @@ func saveJsLog(result string, request string, infno string, desc string, org_nam
1056 1056
 	}
1057 1057
 
1058 1058
 }
1059
+
1060
+
1061
+

Разлика између датотеке није приказан због своје велике величине
+ 1081 - 39
controllers/sg/his_api_controller.go


+ 0 - 1
controllers/zh/zh_his_api_controller.go Прегледај датотеку

@@ -4330,7 +4330,6 @@ func (c *ZHHisApiController) ZHRefund() {
4330 4330
 			respJSON = respJSON["data"].(map[string]interface{})["pre"].(map[string]interface{})
4331 4331
 			result_byte, _ := json.Marshal(respJSON)
4332 4332
 			result = string(result_byte)
4333
-			//saveLog(result, requestLog, "2404", "入院登记撤销")
4334 4333
 			saveLog(result, requestLog, "2305", "退费")
4335 4334
 
4336 4335
 		} else if miConfig.MdtrtareaAdmvs == "360399" {

+ 7 - 7
main.go Прегледај датотеку

@@ -26,13 +26,13 @@ import (
26 26
 func init() {
27 27
 	//service.ConnectNMMSDB()
28 28
 	service.ConnectDB()
29
-	//org_id, _ := beego.AppConfig.Int64("org_id")
30
-	//miConfig, _ := service.FindMedicalInsuranceInfo(org_id)
31
-	//////CreateLog(miConfig)
32
-	//////UploadLog(miConfig)31
33
-	//if org_id == 10191 {
34
-	//	service.GetFjAuthorizationInfo(miConfig.Code)
35
-	//}
29
+	org_id, _ := beego.AppConfig.Int64("org_id")
30
+	miConfig, _ := service.FindMedicalInsuranceInfo(org_id)
31
+	////CreateLog(miConfig)
32
+	////UploadLog(miConfig)31
33
+	if org_id == 10191 {
34
+		service.GetFjAuthorizationInfo(miConfig.Code)
35
+	}
36 36
 
37 37
 
38 38
 

+ 3 - 0
models/new_stock_models.go Прегледај датотеку

@@ -263,6 +263,9 @@ type NewDrugWarehouseInfo struct {
263 263
 
264 264
 	IsPc int64 `gorm:"column:is_pc" json:"is_pc" form:"is_pc"`
265 265
 	IsBg int64 `gorm:"column:is_bg" json:"is_bg" form:"is_bg"`
266
+	Bchno string `gorm:"column:bchno" json:"bchno" form:"bchno"`
267
+
268
+
266 269
 }
267 270
 
268 271
 func (NewDrugWarehouseInfo) TableName() string {

+ 4 - 14
service/fj_service.go Прегледај датотеку

@@ -1006,7 +1006,7 @@ func FJyb6201(org_name string, doctor string, fixmedins_code string, insuplc_adm
1006 1006
 }
1007 1007
 
1008 1008
 // 医药机构费用结算对总账 func Gdyb3201( org_name string, doctor string, secret_key string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string) string {
1009
-func FJyb3201(baseParams models.BaseParams, businessParams models.BusinessParams, med string, fund string) (string, string, string) {
1009
+func FJyb3201(baseParams models.BaseParams, businessParams models.BusinessParams, med string, fund string,acct string) (string, string, string) {
1010 1010
 
1011 1011
 	fmt.Println(baseParams)
1012 1012
 	fmt.Println(businessParams)
@@ -1040,7 +1040,7 @@ func FJyb3201(baseParams models.BaseParams, businessParams models.BusinessParams
1040 1040
 	inputData["stmt_enddate"] = businessParams.StmtEnddate            //对帐结束时间
1041 1041
 	inputData["medfee_sumamt"] = med                                  //医疗费总额
1042 1042
 	inputData["fund_pay_sumamt"] = fund                               //基金支付总额
1043
-	inputData["acct_pay"] = businessParams.AcctPay                    //个人账户支付金额
1043
+	inputData["acct_pay"] = acct                    //个人账户支付金额
1044 1044
 	inputData["fixmedins_setl_cnt"] = businessParams.FixmedinsSetlCnt //定点医药机构结算笔数
1045 1045
 	inputData["refd_setl_flag"] = "0"                                 // 就诊 ID(来自2201接口返回)
1046 1046
 
@@ -3037,7 +3037,7 @@ func FJyb3501(struct3501 models.Struct3501) (string, string, string) {
3037 3037
 	inputData["manu_date"] = struct3501.ManuDate                    // 人员编号 (来自1101接口返回)
3038 3038
 	inputData["expy_end"] = struct3501.ExpyEnd                      // 人员编号 (来自1101接口返回)
3039 3039
 	inputData["memo"] = struct3501.Memo                             // 人员编号 (来自1101接口返回)
3040
-	druginputData["drug_trac_codg"] = "123"
3040
+	druginputData["drug_trac_codg"] = "12345678912345678901"
3041 3041
 	//druginputData2["drugtracinfo"] = druginputData
3042 3042
 	inputData["drug_trac_info"] = druginputData
3043 3043
 	input["invinfo"] = inputData
@@ -3054,7 +3054,6 @@ func FJyb3501(struct3501 models.Struct3501) (string, string, string) {
3054 3054
 
3055 3055
 	enc := mahonia.NewEncoder("gbk")
3056 3056
 	output, err_msg := GetFjBusinessHandleInfo([]byte(enc.ConvertString(string(bytesData))))
3057
-
3058 3057
 	return output, requestLog, err_msg
3059 3058
 }
3060 3059
 
@@ -3070,31 +3069,23 @@ func FJyb3502(struct3502 models.Struct3502) (string, string, string) {
3070 3069
 	input := make(map[string]interface{})
3071 3070
 	inputData := make(map[string]interface{})
3072 3071
 	druginputData := make(map[string]interface{})
3073
-	//druginputData2 := make(map[string]interface{})
3074
-
3075 3072
 	inputMessage["infno"] = "3502"                      // 交易编码
3076 3073
 	inputData["med_list_codg"] = struct3502.MedListCodg // 定点医药机构目录编号
3077 3074
 	inputData["inv_chg_type"] = struct3502.InvChgType   // 定点医药机构目录编号
3078
-
3079 3075
 	inputData["fixmedins_hilist_id"] = struct3502.FixmedinsCode // 定点医药机构目录编号
3080 3076
 	inputData["fixmedins_hilist_name"] = struct3502.OrgName     // 定点医药机构目录名称
3081 3077
 	inputData["fixmedins_bchno"] = struct3502.FixmedinsBchno    // 人员编号 (来自1101接口返回)
3082 3078
 	inputData["pric"] = struct3502.Pric                         // 人员编号 (来自1101接口返回)
3083 3079
 	inputData["cnt"] = struct3502.Cnt                           // 人员编号 (来自1101接口返回)
3084 3080
 	inputData["rx_flag"] = struct3502.RxFlag                    //
3085
-
3086 3081
 	inputData["inv_chg_time"] = struct3502.InvChgTime // 人员编号 (来自1101接口返回)
3087 3082
 	inputData["inv_chg_opter_name"] = ""              // 人员编号 (来自1101接口返回)
3088 3083
 	inputData["memo"] = struct3502.Memo               // 人员编号 (来自1101接口返回)
3089 3084
 	inputData["trdn_flag"] = ""                       // 人员编号 (来自1101接口返回)
3090
-
3091
-	druginputData["drug_trac_codg"] = "123"
3092
-	//druginputData2["drugtracinfo"] = druginputData
3085
+	druginputData["drug_trac_codg"] = "12345678912345678901"
3093 3086
 	inputData["drug_trac_info"] = druginputData
3094
-
3095 3087
 	input["invinfo"] = inputData
3096 3088
 	inputMessage["input"] = input //交易输入
3097
-
3098 3089
 	bytesData, err := json.Marshal(inputMessage)
3099 3090
 	var requestLog string
3100 3091
 	//bytesData, err := json.Marshal(inputMessage)
@@ -3104,7 +3095,6 @@ func FJyb3502(struct3502 models.Struct3502) (string, string, string) {
3104 3095
 		fmt.Println(err.Error())
3105 3096
 		return err.Error(), "", ""
3106 3097
 	}
3107
-
3108 3098
 	enc := mahonia.NewEncoder("gbk")
3109 3099
 	output, err_msg := GetFjBusinessHandleInfo([]byte(enc.ConvertString(string(bytesData))))
3110 3100
 	return output, requestLog, err_msg

+ 145 - 88
service/hbyb_service.go Прегледај датотеку

@@ -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
+}