Browse Source

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

csx 3 years ago
parent
commit
4d8cf2152f
1 changed files with 514 additions and 56 deletions
  1. 514 56
      controllers/sg/his_api_controller.go

+ 514 - 56
controllers/sg/his_api_controller.go View File

2110
 	Signtype    string `json:"signtype"`
2110
 	Signtype    string `json:"signtype"`
2111
 	WarnMsg     string `json:"warn_msg"`
2111
 	WarnMsg     string `json:"warn_msg"`
2112
 }
2112
 }
2113
+type ResultFour10265 struct {
2114
+	Cainfo      string `json:"cainfo"`
2115
+	ErrMsg      string `json:"err_msg"`
2116
+	InfRefmsgid string `json:"inf_refmsgid"`
2117
+	Infcode     string `json:"infcode"`
2118
+	Output      struct {
2119
+		Result []struct {
2120
+			BasMednFlag      string  `json:"bas_medn_flag"`
2121
+			ChldMedcFlag     string  `json:"chld_medc_flag"`
2122
+			ChrgitmLv        string  `json:"chrgitm_lv"`
2123
+			Cnt              float64 `json:"cnt"`
2124
+			DetItemFeeSumamt float64 `json:"det_item_fee_sumamt"`
2125
+			DrtReimFlag      string  `json:"drt_reim_flag"`
2126
+			FeedetlSn        string  `json:"feedetl_sn"`
2127
+			FulamtOwnpayAmt  float64 `json:"fulamt_ownpay_amt"`
2128
+			HiNegoDrugFlag   string  `json:"hi_nego_drug_flag"`
2129
+			InscpScpAmt      float64 `json:"inscp_scp_amt"`
2130
+			ListSpItemFlag   string  `json:"list_sp_item_flag"`
2131
+			LmtUsedFlag      string  `json:"lmt_used_flag"`
2132
+			MedChrgitmType   string  `json:"med_chrgitm_type"`
2133
+			Memo             string  `json:"memo"`
2134
+			OverlmtAmt       float64 `json:"overlmt_amt"`
2135
+			PreselfpayAmt    float64 `json:"preselfpay_amt"`
2136
+			Pric             float64 `json:"pric"`
2137
+			PricUplmtAmt     float64 `json:"pric_uplmt_amt"`
2138
+			SelfpayProp      float64 `json:"selfpay_prop"`
2139
+		} `json:"result"`
2140
+	} `json:"output"`
2141
+	RefmsgTime  string `json:"refmsg_time"`
2142
+	RespondTime string `json:"respond_time"`
2143
+	Signtype    string `json:"signtype"`
2144
+	WarnMsg     string `json:"warn_msg"`
2145
+}
2146
+
2113
 type ResultFive struct {
2147
 type ResultFive struct {
2114
 	Balc                   float64 `json:"balc"`
2148
 	Balc                   float64 `json:"balc"`
2115
 	CvlservFlag            string  `json:"cvlserv_flag"`
2149
 	CvlservFlag            string  `json:"cvlserv_flag"`
2134
 	Signtype    interface{} `json:"signtype"`
2168
 	Signtype    interface{} `json:"signtype"`
2135
 	WarnMsg     interface{} `json:"warn_msg"`
2169
 	WarnMsg     interface{} `json:"warn_msg"`
2136
 }
2170
 }
2171
+
2172
+type ResultSix10265 struct {
2173
+	Cainfo      interface{} `json:"cainfo"`
2174
+	ErrMsg      string      `json:"err_msg"`
2175
+	InfRefmsgid string      `json:"inf_refmsgid"`
2176
+	Infcode     string      `json:"infcode"`
2177
+	Output      struct {
2178
+	} `json:"output"`
2179
+	RefmsgTime  string      `json:"refmsg_time"`
2180
+	RespondTime string      `json:"respond_time"`
2181
+	Signtype    interface{} `json:"signtype"`
2182
+	WarnMsg     interface{} `json:"warn_msg"`
2183
+}
2184
+
2137
 type ResultSeven struct {
2185
 type ResultSeven struct {
2138
 	Cainfo      string `json:"cainfo"`
2186
 	Cainfo      string `json:"cainfo"`
2139
 	ErrMsg      string `json:"err_msg"`
2187
 	ErrMsg      string `json:"err_msg"`
2191
 	Signtype    interface{} `json:"signtype"`
2239
 	Signtype    interface{} `json:"signtype"`
2192
 	WarnMsg     interface{} `json:"warn_msg"`
2240
 	WarnMsg     interface{} `json:"warn_msg"`
2193
 }
2241
 }
2242
+type ResultSeven10265 struct {
2243
+	Cainfo      string `json:"cainfo"`
2244
+	ErrMsg      string `json:"err_msg"`
2245
+	InfRefmsgid string `json:"inf_refmsgid"`
2246
+	Infcode     string `json:"infcode"`
2247
+	Output      struct {
2248
+		Setldetail []interface{} `json:"setldetail"`
2249
+		Setlinfo   struct {
2250
+			AcctMulaidPay   float64 `json:"acct_mulaid_pay"`
2251
+			AcctPay         float64 `json:"acct_pay"`
2252
+			ActPayDedc      float64 `json:"act_pay_dedc"`
2253
+			Age             float64 `json:"age"`
2254
+			Balc            float64 `json:"balc"`
2255
+			Brdy            string  `json:"brdy"`
2256
+			Certno          string  `json:"certno"`
2257
+			ClrOptins       string  `json:"clr_optins"`
2258
+			ClrType         string  `json:"clr_type"`
2259
+			ClrWay          string  `json:"clr_way"`
2260
+			CvlservFlag     string  `json:"cvlserv_flag"`
2261
+			CvlservPay      float64 `json:"cvlserv_pay"`
2262
+			FulamtOwnpayAmt float64 `json:"fulamt_ownpay_amt"`
2263
+			FundPaySumamt   float64 `json:"fund_pay_sumamt"`
2264
+			Gend            string  `json:"gend"`
2265
+			HifesPay        float64 `json:"hifes_pay"`
2266
+			HifmiPay        float64 `json:"hifmi_pay"`
2267
+			HifpPay         float64 `json:"hifp_pay"`
2268
+			HospPartAmt     float64 `json:"hosp_part_amt"`
2269
+			InscpScpAmt     float64 `json:"inscp_scp_amt"`
2270
+			Insutype        string  `json:"insutype"`
2271
+			MafPay          float64 `json:"maf_pay"`
2272
+			MdtrtCertType   string  `json:"mdtrt_cert_type"`
2273
+			HifobPay        float64 `json:"hifob_pay"`
2274
+
2275
+			MdtrtID         string  `json:"mdtrt_id"`
2276
+			MedType         string  `json:"med_type"`
2277
+			MedfeeSumamt    float64 `json:"medfee_sumamt"`
2278
+			MedinsSetlID    string  `json:"medins_setl_id"`
2279
+			Naty            string  `json:"naty"`
2280
+			OthPay          float64 `json:"oth_pay"`
2281
+			OverlmtSelfpay  float64 `json:"overlmt_selfpay"`
2282
+			PoolPropSelfpay float64 `json:"pool_prop_selfpay"`
2283
+			PreselfpayAmt   float64 `json:"preselfpay_amt"`
2284
+			PsnCashPay      float64 `json:"psn_cash_pay"`
2285
+			PsnCertType     string  `json:"psn_cert_type"`
2286
+			PsnName         string  `json:"psn_name"`
2287
+			PsnNo           string  `json:"psn_no"`
2288
+			PsnPartAmt      float64 `json:"psn_part_amt"`
2289
+			PsnType         string  `json:"psn_type"`
2290
+			SetlID          string  `json:"setl_id"`
2291
+			SetlTime        string  `json:"setl_time"`
2292
+		} `json:"setlinfo"`
2293
+	} `json:"output"`
2294
+	RefmsgTime  string      `json:"refmsg_time"`
2295
+	RespondTime string      `json:"respond_time"`
2296
+	Signtype    interface{} `json:"signtype"`
2297
+	WarnMsg     interface{} `json:"warn_msg"`
2298
+}
2299
+
2194
 type ResultEight struct {
2300
 type ResultEight struct {
2195
 	Cainfo      string `json:"cainfo"`
2301
 	Cainfo      string `json:"cainfo"`
2196
 	ErrMsg      string `json:"err_msg"`
2302
 	ErrMsg      string `json:"err_msg"`
2399
 	Signtype    interface{} `json:"signtype"`
2505
 	Signtype    interface{} `json:"signtype"`
2400
 	WarnMsg     interface{} `json:"warn_msg"`
2506
 	WarnMsg     interface{} `json:"warn_msg"`
2401
 }
2507
 }
2508
+type ResultEleven10265 struct {
2509
+	Cainfo      string `json:"cainfo"`
2510
+	ErrMsg      string `json:"err_msg"`
2511
+	InfRefmsgid string `json:"inf_refmsgid"`
2512
+	Infcode     string `json:"infcode"`
2513
+	Output      struct {
2514
+		Setlinfo struct {
2515
+			SetlTime          string      `json:"setl_time"`
2516
+			CvlservPay        float64     `json:"cvlserv_pay"`
2517
+			Year              string      `json:"year"`
2518
+			MedType           string      `json:"med_type"`
2519
+			PsnPay            float64     `json:"psn_pay"`
2520
+			OpterID           string      `json:"opter_id"`
2521
+			Begndate          string      `json:"begndate"`
2522
+			FlxempeFlag       string      `json:"flxempe_flag"`
2523
+			HifmiPay          float64     `json:"hifmi_pay"`
2524
+			PsnNo             string      `json:"psn_no"`
2525
+			ActPayDedc        float64     `json:"act_pay_dedc"`
2526
+			MedinsSetlID      interface{} `json:"medins_setl_id"`
2527
+			AcctMulaidPay     interface{} `json:"acct_mulaid_pay"`
2528
+			ClrWay            string      `json:"clr_way"`
2529
+			OthPay            float64     `json:"oth_pay"`
2530
+			Gend              string      `json:"gend"`
2531
+			MdtrtID           string      `json:"mdtrt_id"`
2532
+			AcctPay           float64     `json:"acct_pay"`
2533
+			InscpScpAmt       float64     `json:"inscp_scp_amt"`
2534
+			Insutype          string      `json:"insutype"`
2535
+			Invono            interface{} `json:"invono"`
2536
+			Enddate           string      `json:"enddate"`
2537
+			CashPayamt        float64     `json:"cash_payamt"`
2538
+			PsnType           string      `json:"psn_type"`
2539
+			FixmedinsName     string      `json:"fixmedins_name"`
2540
+			HifpPay           float64     `json:"hifp_pay"`
2541
+			NewFlag           interface{} `json:"new_flag"`
2542
+			OverlmtSelfpay    float64     `json:"overlmt_selfpay"`
2543
+			PreselfpayAmt     float64     `json:"preselfpay_amt"`
2544
+			PayLoc            string      `json:"pay_loc"`
2545
+			ClrType           string      `json:"clr_type"`
2546
+			RefdSetlFlag      string      `json:"refd_setl_flag"`
2547
+			CvlservFlag       string      `json:"cvlserv_flag"`
2548
+			EmpName           string      `json:"emp_name"`
2549
+			Brdy              string      `json:"brdy"`
2550
+			Naty              string      `json:"naty"`
2551
+			Certno            string      `json:"certno"`
2552
+			DiseCode          string      `json:"dise_code"`
2553
+			FixmedinsCode     string      `json:"fixmedins_code"`
2554
+			DedcHospLv        string      `json:"dedc_hosp_lv"`
2555
+			OpterName         string      `json:"opter_name"`
2556
+			Balc              float64     `json:"balc"`
2557
+			FixmedinsPoolarea string      `json:"fixmedins_poolarea"`
2558
+			PsnCertType       string      `json:"psn_cert_type"`
2559
+			HifobPay          float64     `json:"hifob_pay"`
2560
+			MedfeeSumamt      float64     `json:"medfee_sumamt"`
2561
+			HifesPay          float64     `json:"hifes_pay"`
2562
+			FundPaySumamt     float64     `json:"fund_pay_sumamt"`
2563
+			OptTime           string      `json:"opt_time"`
2564
+			FulamtOwnpayAmt   float64     `json:"fulamt_ownpay_amt"`
2565
+			SetlID            string      `json:"setl_id"`
2566
+			MafPay            float64     `json:"maf_pay"`
2567
+			PsnName           string      `json:"psn_name"`
2568
+			InsuOptins        interface{} `json:"insu_optins"`
2569
+			PrefFundPay       interface{} `json:"pref_fund_pay"`
2570
+			ClrOptins         string      `json:"clr_optins"`
2571
+			PoolPropSelfpay   float64     `json:"pool_prop_selfpay"`
2572
+			DiseName          string      `json:"dise_name"`
2573
+			LmtpricHospLv     string      `json:"lmtpric_hosp_lv"`
2574
+			Age               float64     `json:"age"`
2575
+			DtrtCertType      string      `json:"dtrt_cert_type"`
2576
+			HospLv            string      `json:"hosp_lv"`
2577
+		} `json:"setlinfo"`
2578
+	} `json:"output"`
2579
+	RefmsgTime  string      `json:"refmsg_time"`
2580
+	RespondTime string      `json:"respond_time"`
2581
+	Signtype    interface{} `json:"signtype"`
2582
+	WarnMsg     interface{} `json:"warn_msg"`
2583
+}
2402
 
2584
 
2403
 type ResultTwelve struct {
2585
 type ResultTwelve struct {
2404
 	Cainfo      string `json:"cainfo"`
2586
 	Cainfo      string `json:"cainfo"`
2485
 	Signtype    interface{} `json:"signtype"`
2667
 	Signtype    interface{} `json:"signtype"`
2486
 	WarnMsg     interface{} `json:"warn_msg"`
2668
 	WarnMsg     interface{} `json:"warn_msg"`
2487
 }
2669
 }
2670
+type ResultSixteen10265 struct {
2671
+	Cainfo      string `json:"cainfo"`
2672
+	ErrMsg      string `json:"err_msg"`
2673
+	InfRefmsgid string `json:"inf_refmsgid"`
2674
+	Infcode     string `json:"infcode"`
2675
+	Output      struct {
2676
+		Setldetail []interface{} `json:"setldetail"`
2677
+		Setlinfo   struct {
2678
+			MdtrtID         string  `json:"mdtrt_id"`
2679
+			SetlID          string  `json:"setl_id"`
2680
+			ClrOptins       string  `json:"clr_optins"`
2681
+			SetlTime        string  `json:"setl_time"`
2682
+			MedfeeSumamt    float64 `json:"medfee_sumamt"`
2683
+			FulamtOwnpayAmt float64 `json:"fulamt_ownpay_amt"`
2684
+			OverlmtSelfpay  float64 `json:"overlmt_selfpay"`
2685
+			PreselfpayAmt   float64 `json:"preselfpay_amt"`
2686
+			InscpScpAmt     float64 `json:"inscp_scp_amt"`
2687
+			ActPayDedc      float64 `json:"act_pay_dedc"`
2688
+			HifpPay         float64 `json:"hifp_pay"`
2689
+			PoolPropSe      float64 `json:"pool_prop_selfpay"`
2690
+			Lfpay           float64 `json:"selfpay"`
2691
+			CvlservPay      float64 `json:"cvlserv_pay"`
2692
+			HifesPay        float64 `json:"hifes_pay"`
2693
+			HifmiPay        float64 `json:"hifmi_pay"`
2694
+			HifobPay        float64 `json:"hifob_pay"`
2695
+			MafPay          float64 `json:"maf_pay"`
2696
+			OthPay          float64 `json:"oth_pay"`
2697
+			FundPaySumamt   float64 `json:"fund_pay_sumamt"`
2698
+			PsnPartAmt      float64 `json:"psn_part_amt"`
2699
+			AcctPay         float64 `json:"acct_pay"`
2700
+			Balc            float64 `json:"balc"`
2701
+			AcctMulaidPay   float64 `json:"acct_mulaid_pay"`
2702
+			HospPartAmt     float64 `json:"hosp_part_amt"`
2703
+			MedinsSetlID    string  `json:"medins_setl_id"`
2704
+			PdnCashPay      string  `json:"pdn_cash_pay"`
2705
+		} `json:"setlinfo"`
2706
+	} `json:"output"`
2707
+	RefmsgTime  string      `json:"refmsg_time"`
2708
+	RespondTime string      `json:"respond_time"`
2709
+	Signtype    interface{} `json:"signtype"`
2710
+	WarnMsg     interface{} `json:"warn_msg"`
2711
+}
2488
 
2712
 
2489
 type ResultSeventeen struct {
2713
 type ResultSeventeen struct {
2490
 	ErrMsg      string `json:"err_msg"`
2714
 	ErrMsg      string `json:"err_msg"`
3043
 		var result string
3267
 		var result string
3044
 		var requestLog string
3268
 		var requestLog string
3045
 		var res2 ResultSix
3269
 		var res2 ResultSix
3270
+		var ressix10265 ResultSix10265
3046
 
3271
 
3047
 		if miConfig.InsuplcAdmdvs == "421300" {
3272
 		if miConfig.InsuplcAdmdvs == "421300" {
3048
 
3273
 
3097
 			} else {
3322
 			} else {
3098
 				result, requestLog = service.Gdyb2203(his.PsnNo, his.Number, doctor_info.UserName, department.Name, miConfig.OrgName, strconv.FormatInt(reg_type, 10), doctor_info.DoctorNumber, miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, sickConfig.ContentCode, sickConfig.ClassName, roles.UserName, config)
3323
 				result, requestLog = service.Gdyb2203(his.PsnNo, his.Number, doctor_info.UserName, department.Name, miConfig.OrgName, strconv.FormatInt(reg_type, 10), doctor_info.DoctorNumber, miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, sickConfig.ContentCode, sickConfig.ClassName, roles.UserName, config)
3099
 			}
3324
 			}
3325
+
3100
 			saveLog(result, requestLog, "2203", "上传就诊信息")
3326
 			saveLog(result, requestLog, "2203", "上传就诊信息")
3101
 			var respJSON2 map[string]interface{}
3327
 			var respJSON2 map[string]interface{}
3102
 			if err := json.Unmarshal([]byte(string(result)), &respJSON2); err != nil {
3328
 			if err := json.Unmarshal([]byte(string(result)), &respJSON2); err != nil {
3105
 				return
3331
 				return
3106
 			}
3332
 			}
3107
 			userJSONBytes2, _ := json.Marshal(respJSON2)
3333
 			userJSONBytes2, _ := json.Marshal(respJSON2)
3108
-
3109
-			if err := json.Unmarshal(userJSONBytes2, &res2); err != nil {
3110
-				utils.ErrorLog("解析失败:%v", err)
3111
-				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
3112
-				return
3334
+			if miConfig.Code == "H15049901371" {
3335
+				if err := json.Unmarshal(userJSONBytes2, &ressix10265); err != nil {
3336
+					utils.ErrorLog("解析失败:%v", err)
3337
+					c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
3338
+					return
3339
+				}
3340
+				res2.InfRefmsgid = ressix10265.InfRefmsgid
3341
+				res2.Output = ressix10265.Output
3342
+				res2.ErrMsg = ressix10265.ErrMsg
3343
+				res2.Cainfo = ressix10265.Cainfo
3344
+				res2.WarnMsg = ressix10265.WarnMsg
3345
+				infocode, _ := strconv.ParseInt(ressix10265.Infcode, 10, 64)
3346
+				res2.Infcode = infocode
3347
+			} else {
3348
+				if err := json.Unmarshal(userJSONBytes2, &res2); err != nil {
3349
+					utils.ErrorLog("解析失败:%v", err)
3350
+					c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
3351
+					return
3352
+				}
3113
 			}
3353
 			}
3114
-
3115
 		}
3354
 		}
3116
 
3355
 
3117
 		if res2.Infcode != 0 {
3356
 		if res2.Infcode != 0 {
3214
 			config, _ := service.GetMedicalInsuranceConfig(adminUser.CurrentOrgId)
3453
 			config, _ := service.GetMedicalInsuranceConfig(adminUser.CurrentOrgId)
3215
 			if config.IsOpen == 1 { //对接了医保,走医保流程
3454
 			if config.IsOpen == 1 { //对接了医保,走医保流程
3216
 				var res ResultFour
3455
 				var res ResultFour
3456
+				var resFour10265 ResultFour10265
3457
+
3217
 				if miConfig.MdtrtareaAdmvs == "421300" {
3458
 				if miConfig.MdtrtareaAdmvs == "421300" {
3218
 
3459
 
3219
 					bytesData, _ := json.Marshal(data)
3460
 					bytesData, _ := json.Marshal(data)
3254
 					saveLog(result, request_log, "2204", "上传费用明细")
3495
 					saveLog(result, request_log, "2204", "上传费用明细")
3255
 					userJSONBytes, _ := json.Marshal(dat)
3496
 					userJSONBytes, _ := json.Marshal(dat)
3256
 
3497
 
3257
-					if err := json.Unmarshal(userJSONBytes, &res); err != nil {
3258
-						utils.ErrorLog("解析失败:%v", err)
3259
-						c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
3260
-						return
3498
+					if miConfig.Code == "H15049901371" {
3499
+						if err := json.Unmarshal(userJSONBytes, &resFour10265); err != nil {
3500
+							utils.ErrorLog("解析失败:%v", err)
3501
+							c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
3502
+							return
3503
+						}
3504
+
3505
+						res.InfRefmsgid = resFour10265.InfRefmsgid
3506
+						res.Output = resFour10265.Output
3507
+						res.ErrMsg = resFour10265.ErrMsg
3508
+						res.Cainfo = resFour10265.Cainfo
3509
+						res.WarnMsg = resFour10265.WarnMsg
3510
+						infocode, _ := strconv.ParseInt(resFour10265.Infcode, 10, 64)
3511
+						res.Infcode = infocode
3512
+
3513
+					} else {
3514
+
3515
+						if err := json.Unmarshal(userJSONBytes, &res); err != nil {
3516
+							utils.ErrorLog("解析失败:%v", err)
3517
+							c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
3518
+							return
3519
+						}
3520
+
3261
 					}
3521
 					}
3522
+
3262
 				}
3523
 				}
3263
 
3524
 
3264
 				if res.Infcode == 0 {
3525
 				if res.Infcode == 0 {
3450
 
3711
 
3451
 						}
3712
 						}
3452
 						var res ResultSeven
3713
 						var res ResultSeven
3714
+						var resSeven10265 ResultSeven10265
3715
+
3453
 						var src_resquest string
3716
 						var src_resquest string
3454
 						var result2 string
3717
 						var result2 string
3455
 						var acct_used_flag string
3718
 						var acct_used_flag string
3494
 							respJSON = respJSON["data"].(map[string]interface{})["pre"].(map[string]interface{})
3757
 							respJSON = respJSON["data"].(map[string]interface{})["pre"].(map[string]interface{})
3495
 							result, _ := json.Marshal(respJSON)
3758
 							result, _ := json.Marshal(respJSON)
3496
 
3759
 
3497
-							if err := json.Unmarshal([]byte(result), &res); err != nil {
3498
-								utils.ErrorLog("解析失败:%v", err)
3499
-								c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
3500
-								return
3760
+							if miConfig.Code == "H15049901371" {
3761
+								if err := json.Unmarshal([]byte(result), &resSeven10265); err != nil {
3762
+									utils.ErrorLog("解析失败:%v", err)
3763
+									c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
3764
+									return
3765
+								}
3766
+
3767
+								res.InfRefmsgid = resSeven10265.InfRefmsgid
3768
+								res.Output = resSeven10265.Output
3769
+								res.ErrMsg = resSeven10265.ErrMsg
3770
+								res.Cainfo = resSeven10265.Cainfo
3771
+								res.WarnMsg = resSeven10265.WarnMsg
3772
+								infocode, _ := strconv.ParseInt(resSeven10265.Infcode, 10, 64)
3773
+								res.Infcode = infocode
3774
+
3775
+							} else {
3776
+
3777
+								if err := json.Unmarshal([]byte(result), &res); err != nil {
3778
+									utils.ErrorLog("解析失败:%v", err)
3779
+									c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
3780
+									return
3781
+								}
3782
+
3501
 							}
3783
 							}
3502
 
3784
 
3503
 						} else {
3785
 						} else {
3512
 							saveLog(result2, src_resquest, "2207", "结算")
3794
 							saveLog(result2, src_resquest, "2207", "结算")
3513
 
3795
 
3514
 							userJSONBytes, _ := json.Marshal(dat)
3796
 							userJSONBytes, _ := json.Marshal(dat)
3797
+							if miConfig.Code == "H15049901371" {
3798
+
3799
+								if err := json.Unmarshal(userJSONBytes, &resSeven10265); err != nil {
3800
+									utils.ErrorLog("解析失败:%v", err)
3801
+									c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
3802
+									return
3803
+								}
3804
+
3805
+								res.InfRefmsgid = resSeven10265.InfRefmsgid
3806
+								res.Output = resSeven10265.Output
3807
+								res.ErrMsg = resSeven10265.ErrMsg
3808
+								res.Cainfo = resSeven10265.Cainfo
3809
+								res.WarnMsg = resSeven10265.WarnMsg
3810
+								infocode, _ := strconv.ParseInt(resSeven10265.Infcode, 10, 64)
3811
+								res.Infcode = infocode
3812
+
3813
+							} else {
3814
+
3815
+								if err := json.Unmarshal(userJSONBytes, &res); err != nil {
3816
+									utils.ErrorLog("解析失败:%v", err)
3817
+									c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
3818
+									return
3819
+								}
3515
 
3820
 
3516
-							if err := json.Unmarshal(userJSONBytes, &res); err != nil {
3517
-								utils.ErrorLog("解析失败:%v", err)
3518
-								c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
3519
-								return
3520
 							}
3821
 							}
3521
 
3822
 
3522
 						}
3823
 						}
3706
 
4007
 
3707
 			}
4008
 			}
3708
 			var res ResultSeven
4009
 			var res ResultSeven
4010
+			var resSeven10265 ResultSeven10265
3709
 			var src_resquest string
4011
 			var src_resquest string
3710
 			var result2 string
4012
 			var result2 string
3711
 			var acct_used_flag string
4013
 			var acct_used_flag string
3757
 				}
4059
 				}
3758
 
4060
 
3759
 			} else {
4061
 			} else {
3760
-
3761
 				result2, src_resquest = service.Gdyb2207(his.PsnNo, his.Number, chrg_bchno, cert_no, insutype, allTotal, miConfig.OrgName, roles.UserName, miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, strconv.FormatInt(reg_type, 10), his.IdCardType, tempOrder.FulamtOwnpayAmt, tempOrder.OverlmtSelfPay, tempOrder.PreselfpayAmt, tempOrder.InscpScpAmt, his.IdType, acct_used_flag)
4062
 				result2, src_resquest = service.Gdyb2207(his.PsnNo, his.Number, chrg_bchno, cert_no, insutype, allTotal, miConfig.OrgName, roles.UserName, miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, strconv.FormatInt(reg_type, 10), his.IdCardType, tempOrder.FulamtOwnpayAmt, tempOrder.OverlmtSelfPay, tempOrder.PreselfpayAmt, tempOrder.InscpScpAmt, his.IdType, acct_used_flag)
3762
 				var dat map[string]interface{}
4063
 				var dat map[string]interface{}
3763
 				if err := json.Unmarshal([]byte(result2), &dat); err == nil {
4064
 				if err := json.Unmarshal([]byte(result2), &dat); err == nil {
3765
 				} else {
4066
 				} else {
3766
 					fmt.Println(err)
4067
 					fmt.Println(err)
3767
 				}
4068
 				}
3768
-
3769
 				saveLog(result2, src_resquest, "2207", "结算")
4069
 				saveLog(result2, src_resquest, "2207", "结算")
3770
-
3771
 				userJSONBytes, _ := json.Marshal(dat)
4070
 				userJSONBytes, _ := json.Marshal(dat)
4071
+				if miConfig.Code == "H15049901371" {
3772
 
4072
 
3773
-				if err := json.Unmarshal(userJSONBytes, &res); err != nil {
3774
-					utils.ErrorLog("解析失败:%v", err)
3775
-					c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
3776
-					return
3777
-				}
4073
+					if err := json.Unmarshal(userJSONBytes, &resSeven10265); err != nil {
4074
+						utils.ErrorLog("解析失败:%v", err)
4075
+						c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
4076
+						return
4077
+					}
4078
+					res.InfRefmsgid = resSeven10265.InfRefmsgid
4079
+					res.Output = resSeven10265.Output
4080
+					res.ErrMsg = resSeven10265.ErrMsg
4081
+					res.Cainfo = resSeven10265.Cainfo
4082
+					res.WarnMsg = resSeven10265.WarnMsg
4083
+					infocode, _ := strconv.ParseInt(resSeven10265.Infcode, 10, 64)
4084
+					res.Infcode = infocode
3778
 
4085
 
4086
+				} else {
4087
+
4088
+					if err := json.Unmarshal(userJSONBytes, &res); err != nil {
4089
+						utils.ErrorLog("解析失败:%v", err)
4090
+						c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
4091
+						return
4092
+					}
4093
+
4094
+				}
3779
 			}
4095
 			}
3780
 
4096
 
3781
 			if res.Infcode != 0 {
4097
 			if res.Infcode != 0 {
4450
 	strconv.FormatInt(his.PatientId, 10)
4766
 	strconv.FormatInt(his.PatientId, 10)
4451
 
4767
 
4452
 	var res2 ResultSix
4768
 	var res2 ResultSix
4769
+	var resSix10265 ResultSix10265
4770
+
4453
 	if miConfig.InsuplcAdmdvs == "421300" {
4771
 	if miConfig.InsuplcAdmdvs == "421300" {
4454
 		data := make(map[string]interface{})
4772
 		data := make(map[string]interface{})
4455
 		client := &http.Client{}
4773
 		client := &http.Client{}
4512
 				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
4830
 				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
4513
 				return
4831
 				return
4514
 			}
4832
 			}
4833
+			//userJSONBytes2, _ := json.Marshal(respJSON2)
4834
+			//if err := json.Unmarshal(userJSONBytes2, &res2); err != nil {
4835
+			//	utils.ErrorLog("解析失败:%v", err)
4836
+			//	c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
4837
+			//	return
4838
+			//}
4839
+
4515
 			userJSONBytes2, _ := json.Marshal(respJSON2)
4840
 			userJSONBytes2, _ := json.Marshal(respJSON2)
4516
-			if err := json.Unmarshal(userJSONBytes2, &res2); err != nil {
4517
-				utils.ErrorLog("解析失败:%v", err)
4518
-				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
4519
-				return
4841
+			if miConfig.Code == "H15049901371" {
4842
+				if err := json.Unmarshal(userJSONBytes2, &resSix10265); err != nil {
4843
+					utils.ErrorLog("解析失败:%v", err)
4844
+					c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
4845
+					return
4846
+				}
4847
+				res2.InfRefmsgid = resSix10265.InfRefmsgid
4848
+				res2.Output = resSix10265.Output
4849
+				res2.ErrMsg = resSix10265.ErrMsg
4850
+				res2.Cainfo = resSix10265.Cainfo
4851
+				res2.WarnMsg = resSix10265.WarnMsg
4852
+				infocode, _ := strconv.ParseInt(resSix10265.Infcode, 10, 64)
4853
+				res2.Infcode = infocode
4854
+			} else {
4855
+				if err := json.Unmarshal(userJSONBytes2, &res2); err != nil {
4856
+					utils.ErrorLog("解析失败:%v", err)
4857
+					c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
4858
+					return
4859
+				}
4520
 			}
4860
 			}
4521
 		}
4861
 		}
4522
 
4862
 
4606
 		config, _ := service.GetMedicalInsuranceConfig(adminUser.CurrentOrgId)
4946
 		config, _ := service.GetMedicalInsuranceConfig(adminUser.CurrentOrgId)
4607
 		if config.IsOpen == 1 { //对接了医保,走医保流程
4947
 		if config.IsOpen == 1 { //对接了医保,走医保流程
4608
 			var res ResultFour
4948
 			var res ResultFour
4949
+			var resFour10265 ResultFour10265
4950
+
4609
 			if miConfig.MdtrtareaAdmvs == "421300" {
4951
 			if miConfig.MdtrtareaAdmvs == "421300" {
4610
 				bytesData, _ := json.Marshal(data)
4952
 				bytesData, _ := json.Marshal(data)
4611
 				req, _ := http.NewRequest("POST", "http://192.168.124.4:9532/"+"hbyb/2204", bytes.NewReader(bytesData))
4953
 				req, _ := http.NewRequest("POST", "http://192.168.124.4:9532/"+"hbyb/2204", bytes.NewReader(bytesData))
4644
 					fmt.Println(err)
4986
 					fmt.Println(err)
4645
 				}
4987
 				}
4646
 				saveLog(result, request_log, "2204", "上传费用明细")
4988
 				saveLog(result, request_log, "2204", "上传费用明细")
4989
+
4647
 				userJSONBytes, _ := json.Marshal(dat)
4990
 				userJSONBytes, _ := json.Marshal(dat)
4648
-				if err := json.Unmarshal(userJSONBytes, &res); err != nil {
4649
-					utils.ErrorLog("解析失败:%v", err)
4650
-					c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
4651
-					return
4991
+
4992
+				if miConfig.Code == "H15049901371" {
4993
+					if err := json.Unmarshal(userJSONBytes, &resFour10265); err != nil {
4994
+						utils.ErrorLog("解析失败:%v", err)
4995
+						c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
4996
+						return
4997
+					}
4998
+
4999
+					res.InfRefmsgid = resFour10265.InfRefmsgid
5000
+					res.Output = resFour10265.Output
5001
+					res.ErrMsg = resFour10265.ErrMsg
5002
+					res.Cainfo = resFour10265.Cainfo
5003
+					res.WarnMsg = resFour10265.WarnMsg
5004
+					infocode, _ := strconv.ParseInt(resFour10265.Infcode, 10, 64)
5005
+					res.Infcode = infocode
5006
+
5007
+				} else {
5008
+
5009
+					if err := json.Unmarshal(userJSONBytes, &res); err != nil {
5010
+						utils.ErrorLog("解析失败:%v", err)
5011
+						c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
5012
+						return
5013
+					}
5014
+
4652
 				}
5015
 				}
5016
+
4653
 			}
5017
 			}
4654
 
5018
 
4655
 			if res.Infcode == 0 {
5019
 			if res.Infcode == 0 {
4821
 
5185
 
4822
 					}
5186
 					}
4823
 					var res ResultSeven
5187
 					var res ResultSeven
5188
+					var resSeven10265 ResultSeven10265
4824
 
5189
 
4825
 					if miConfig.MdtrtareaAdmvs == "421300" {
5190
 					if miConfig.MdtrtareaAdmvs == "421300" {
4826
 
5191
 
4870
 							fmt.Println(err)
5235
 							fmt.Println(err)
4871
 						}
5236
 						}
4872
 						saveLog(result, request_log, "2206", "预结算")
5237
 						saveLog(result, request_log, "2206", "预结算")
4873
-						userJSONBytes, _ := json.Marshal(dat)
5238
+						//userJSONBytes, _ := json.Marshal(dat)
5239
+						//
5240
+						//if err := json.Unmarshal(userJSONBytes, &res); err != nil {
5241
+						//	utils.ErrorLog("解析失败:%v", err)
5242
+						//	c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
5243
+						//	return
5244
+						//}
4874
 
5245
 
4875
-						if err := json.Unmarshal(userJSONBytes, &res); err != nil {
4876
-							utils.ErrorLog("解析失败:%v", err)
4877
-							c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
4878
-							return
5246
+						userJSONBytes, _ := json.Marshal(dat)
5247
+						if miConfig.Code == "H15049901371" {
5248
+							if err := json.Unmarshal(userJSONBytes, &resSeven10265); err != nil {
5249
+								utils.ErrorLog("解析失败:%v", err)
5250
+								c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
5251
+								return
5252
+							}
5253
+							res.InfRefmsgid = resSeven10265.InfRefmsgid
5254
+							res.Output = resSeven10265.Output
5255
+							res.ErrMsg = resSeven10265.ErrMsg
5256
+							res.Cainfo = resSeven10265.Cainfo
5257
+							res.WarnMsg = resSeven10265.WarnMsg
5258
+							infocode, _ := strconv.ParseInt(resSeven10265.Infcode, 10, 64)
5259
+							res.Infcode = infocode
5260
+						} else {
5261
+							if err := json.Unmarshal(userJSONBytes, &res); err != nil {
5262
+								utils.ErrorLog("解析失败:%v", err)
5263
+								c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
5264
+								return
5265
+							}
4879
 						}
5266
 						}
4880
 					}
5267
 					}
4881
 
5268
 
5237
 	config, _ := service.GetMedicalInsuranceConfig(adminUser.CurrentOrgId)
5624
 	config, _ := service.GetMedicalInsuranceConfig(adminUser.CurrentOrgId)
5238
 	if config.IsOpen == 1 { //对接了医保,走医保流程
5625
 	if config.IsOpen == 1 { //对接了医保,走医保流程
5239
 		var res ResultSixteen
5626
 		var res ResultSixteen
5627
+		var resSixteen10265 ResultSixteen10265
5240
 		var src_resquest string
5628
 		var src_resquest string
5241
 		var result string
5629
 		var result string
5242
 
5630
 
5281
 				fmt.Println(err)
5669
 				fmt.Println(err)
5282
 			}
5670
 			}
5283
 			saveLog(result, src_resquest, "2208", "退费")
5671
 			saveLog(result, src_resquest, "2208", "退费")
5672
+
5284
 			userJSONBytes, _ := json.Marshal(dat)
5673
 			userJSONBytes, _ := json.Marshal(dat)
5285
-			if err := json.Unmarshal(userJSONBytes, &res); err != nil {
5286
-				utils.ErrorLog("解析失败:%v", err)
5287
-				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
5288
-				return
5674
+			if miConfig.Code == "H15049901371" {
5675
+				if err := json.Unmarshal(userJSONBytes, &resSixteen10265); err != nil {
5676
+					utils.ErrorLog("解析失败:%v", err)
5677
+					c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
5678
+					return
5679
+				}
5680
+				res.InfRefmsgid = resSixteen10265.InfRefmsgid
5681
+				res.Output = resSixteen10265.Output
5682
+				res.ErrMsg = resSixteen10265.ErrMsg
5683
+				res.Cainfo = resSixteen10265.Cainfo
5684
+				res.WarnMsg = resSixteen10265.WarnMsg
5685
+				infocode, _ := strconv.ParseInt(resSixteen10265.Infcode, 10, 64)
5686
+				res.Infcode = infocode
5687
+			} else {
5688
+				if err := json.Unmarshal(userJSONBytes, &res); err != nil {
5689
+					utils.ErrorLog("解析失败:%v", err)
5690
+					c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
5691
+					return
5692
+				}
5693
+
5289
 			}
5694
 			}
5695
+
5290
 		}
5696
 		}
5291
 
5697
 
5292
 		if res.Infcode == 0 {
5698
 		if res.Infcode == 0 {
5293
 			var res2 ResultSix
5699
 			var res2 ResultSix
5700
+			var resSix10265 ResultSix10265
5294
 
5701
 
5295
 			if miConfig.MdtrtareaAdmvs == "421300" {
5702
 			if miConfig.MdtrtareaAdmvs == "421300" {
5296
 
5703
 
5336
 				}
5743
 				}
5337
 
5744
 
5338
 				saveLog(result2, src_request, "2205", "撤销明细")
5745
 				saveLog(result2, src_request, "2205", "撤销明细")
5339
-
5340
 				userJSONBytes, _ := json.Marshal(dat)
5746
 				userJSONBytes, _ := json.Marshal(dat)
5747
+				if miConfig.Code == "H15049901371" {
5748
+					if err := json.Unmarshal(userJSONBytes, &resSix10265); err != nil {
5749
+						utils.ErrorLog("解析失败:%v", err)
5750
+						c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
5751
+						return
5752
+					}
5753
+					res2.InfRefmsgid = resSix10265.InfRefmsgid
5754
+					res2.Output = resSix10265.Output
5755
+					res2.ErrMsg = resSix10265.ErrMsg
5756
+					res2.Cainfo = resSix10265.Cainfo
5757
+					res2.WarnMsg = resSix10265.WarnMsg
5758
+					infocode, _ := strconv.ParseInt(resSix10265.Infcode, 10, 64)
5759
+					res2.Infcode = infocode
5760
+				} else {
5761
+					if err := json.Unmarshal(userJSONBytes, &res2); err != nil {
5762
+						utils.ErrorLog("解析失败:%v", err)
5763
+						c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
5764
+						return
5765
+					}
5341
 
5766
 
5342
-				if err := json.Unmarshal(userJSONBytes, &res2); err != nil {
5343
-					utils.ErrorLog("解析失败:%v", err)
5344
-					c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
5345
-					return
5346
 				}
5767
 				}
5347
 
5768
 
5348
 			}
5769
 			}
5406
 
5827
 
5407
 	if config.IsOpen == 1 { //对接了医保,走医保流程
5828
 	if config.IsOpen == 1 { //对接了医保,走医保流程
5408
 		var res2 ResultSix
5829
 		var res2 ResultSix
5830
+		var resSix10265 ResultSix10265
5831
+
5409
 		if miConfig.MdtrtareaAdmvs == "421300" {
5832
 		if miConfig.MdtrtareaAdmvs == "421300" {
5410
 
5833
 
5411
 			api3 := "http://192.168.124.4:9532/" + "hbyb/2202?psn_no=" + his.PsnNo +
5834
 			api3 := "http://192.168.124.4:9532/" + "hbyb/2202?psn_no=" + his.PsnNo +
5467
 			respJSON3 = respJSON3["data"].(map[string]interface{})["pre"].(map[string]interface{})
5890
 			respJSON3 = respJSON3["data"].(map[string]interface{})["pre"].(map[string]interface{})
5468
 			userJSONBytes3, _ := json.Marshal(respJSON3)
5891
 			userJSONBytes3, _ := json.Marshal(respJSON3)
5469
 
5892
 
5470
-			if err := json.Unmarshal(userJSONBytes3, &res2); err != nil {
5471
-				utils.ErrorLog("解析失败:%v", err)
5472
-				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
5473
-				return
5893
+			if miConfig.Code == "H15049901371" {
5894
+				if err := json.Unmarshal(userJSONBytes3, &resSix10265); err != nil {
5895
+					utils.ErrorLog("解析失败:%v", err)
5896
+					c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
5897
+					return
5898
+				}
5899
+				res2.InfRefmsgid = resSix10265.InfRefmsgid
5900
+				res2.Output = resSix10265.Output
5901
+				res2.ErrMsg = resSix10265.ErrMsg
5902
+				res2.Cainfo = resSix10265.Cainfo
5903
+				res2.WarnMsg = resSix10265.WarnMsg
5904
+				infocode, _ := strconv.ParseInt(resSix10265.Infcode, 10, 64)
5905
+				res2.Infcode = infocode
5906
+			} else {
5907
+
5908
+				if err := json.Unmarshal(userJSONBytes3, &res2); err != nil {
5909
+					utils.ErrorLog("解析失败:%v", err)
5910
+					c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
5911
+					return
5912
+				}
5474
 			}
5913
 			}
5475
 
5914
 
5476
 		}
5915
 		}
6186
 		SetlId:  order.SetlId,
6625
 		SetlId:  order.SetlId,
6187
 	}
6626
 	}
6188
 	var res ResultEleven
6627
 	var res ResultEleven
6628
+	var resEleven10265 ResultEleven10265
6629
+
6189
 	if config.IsOpen == 1 {
6630
 	if config.IsOpen == 1 {
6190
 		if miConfig.MdtrtareaAdmvs == "421300" {
6631
 		if miConfig.MdtrtareaAdmvs == "421300" {
6191
 
6632
 
6230
 				fmt.Println(err)
6671
 				fmt.Println(err)
6231
 			}
6672
 			}
6232
 			userJSONBytes, _ := json.Marshal(dat)
6673
 			userJSONBytes, _ := json.Marshal(dat)
6233
-			if err := json.Unmarshal(userJSONBytes, &res); err != nil {
6234
-				utils.ErrorLog("解析失败:%v", err)
6235
-				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
6236
-				return
6674
+
6675
+			if miConfig.Code == "H15049901371" {
6676
+				if err := json.Unmarshal(userJSONBytes, &resEleven10265); err != nil {
6677
+					utils.ErrorLog("解析失败:%v", err)
6678
+					c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
6679
+					return
6680
+				}
6681
+				res.InfRefmsgid = resEleven10265.InfRefmsgid
6682
+				res.Output = resEleven10265.Output
6683
+				res.ErrMsg = resEleven10265.ErrMsg
6684
+				res.Cainfo = resEleven10265.Cainfo
6685
+				res.WarnMsg = resEleven10265.WarnMsg
6686
+				infocode, _ := strconv.ParseInt(resEleven10265.Infcode, 10, 64)
6687
+				res.Infcode = infocode
6688
+			} else {
6689
+				if err := json.Unmarshal(userJSONBytes, &res); err != nil {
6690
+					utils.ErrorLog("解析失败:%v", err)
6691
+					c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
6692
+					return
6693
+				}
6694
+
6237
 			}
6695
 			}
6238
 		}
6696
 		}
6239
 
6697