Bladeren bron

Merge branch '20201014_xt_api_new_branch' of http://git.shengws.com/csx/XT_New into 20201014_xt_api_new_branch

XMLWAN 4 jaren geleden
bovenliggende
commit
bee4a71d90
3 gewijzigde bestanden met toevoegingen van 50 en 24 verwijderingen
  1. 17 0
      controllers/gdyb_controller.go
  2. 23 18
      controllers/his_api_controller.go
  3. 10 6
      service/gdyb_service.go

+ 17 - 0
controllers/gdyb_controller.go Bestand weergeven

@@ -328,6 +328,8 @@ func (c *GdybController) PostNine() {
328 328
 }
329 329
 
330 330
 func (c *GdybController) PostTen() {
331
+	fmt.Println("11222333-----")
332
+
331 333
 	insutype := c.GetString("insutype")
332 334
 	clrType := c.GetString("clr_type")
333 335
 	setlOptins := c.GetString("setl_optins")
@@ -344,6 +346,13 @@ func (c *GdybController) PostTen() {
344 346
 	org_name := c.GetString("org_name")
345 347
 	doctor := c.GetString("doctor")
346 348
 
349
+	fmt.Println(insutype)
350
+	fmt.Println(clrType)
351
+	fmt.Println(setlOptins)
352
+	fmt.Println(stmtBegndate)
353
+	fmt.Println(stmtEnddate)
354
+	fmt.Println(medfeeSumamt)
355
+
347 356
 	baseParams := models.BaseParams{
348 357
 		SecretKey:      secret_key,
349 358
 		FixmedinsCode:  fixmedins_code,
@@ -363,8 +372,14 @@ func (c *GdybController) PostTen() {
363 372
 		AcctPay:          acctPay,
364 373
 		FixmedinsSetlCnt: fixmedinsSetlCnt,
365 374
 	}
375
+	fmt.Println(baseParams)
376
+	fmt.Println(businessParams)
377
+
378
+	fmt.Println("11222333--33333---")
366 379
 
367 380
 	result := service.Gdyb3201(baseParams, businessParams)
381
+	fmt.Println("11222333--33333---555555")
382
+
368 383
 	var dat map[string]interface{}
369 384
 	if err := json.Unmarshal([]byte(result), &dat); err == nil {
370 385
 		fmt.Println(dat)
@@ -377,6 +392,8 @@ func (c *GdybController) PostTen() {
377 392
 }
378 393
 
379 394
 func (c *GdybController) PostEleven() {
395
+	fmt.Println("777777666666-----")
396
+
380 397
 	file_byte := c.GetString("file_byte")
381 398
 	file_name := c.GetString("file_name")
382 399
 	fixmedins_code := c.GetString("fixmedins_code")

+ 23 - 18
controllers/his_api_controller.go Bestand weergeven

@@ -1621,7 +1621,7 @@ func (c *HisApiController) GetUploadInfo() {
1621 1621
 	data["chrg_bchno"] = chrg_bchno
1622 1622
 	data["org_name"] = miConfig.OrgName
1623 1623
 	data["doctor"] = patientPrescription.Doctor
1624
-	data["doctor_id"] = patientPrescription.DoctorId
1624
+	data["doctor_id"] = strconv.FormatInt(patientPrescription.DoctorId, 10)
1625 1625
 
1626 1626
 	data["dept"] = strconv.FormatInt(patientPrescription.Departments, 10)
1627 1627
 
@@ -1783,7 +1783,7 @@ func (c *HisApiController) GetUploadInfo() {
1783 1783
 					}
1784 1784
 				}
1785 1785
 			}
1786
-			org, _ := service.GetOrgById(adminUser.CurrentOrgId)
1786
+			//org, _ := service.GetOrgById(adminUser.CurrentOrgId)
1787 1787
 			patientPrescription, _ := service.FindPatientPrescriptionInfo(adminUser.CurrentOrgId, id, recordDateTime)
1788 1788
 			allTotal := fmt.Sprintf("%.2f", total)
1789 1789
 			if res.Infcode == 0 {
@@ -1794,9 +1794,9 @@ func (c *HisApiController) GetUploadInfo() {
1794 1794
 				chrg_bchno := chrg_bchno
1795 1795
 				cert_no := his.Certno
1796 1796
 				insutype := rf[0].Insutype
1797
-				api := "http://127.0.0.1:9531/" + "gdyb/eight?cert_no=" + cert_no + "&insutype=" +
1797
+				api := "http://127.0.0.1:9532/" + "gdyb/eight?cert_no=" + cert_no + "&insutype=" +
1798 1798
 					insutype + "&psn_no=" + psn_no + "&chrg_bchno=" + chrg_bchno + "&mdtrt_id=" + mdtrt_id +
1799
-					"&total=" + allTotal + "&org_name=" + org.OrgName + "&doctor=" + patientPrescription.Doctor + "&fixmedins_code=" + miConfig.Code + "&insuplc_admdvs=" + miConfig.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey
1799
+					"&total=" + allTotal + "&org_name=" + miConfig.OrgName + "&doctor=" + patientPrescription.Doctor + "&fixmedins_code=" + miConfig.Code + "&insuplc_admdvs=" + miConfig.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey
1800 1800
 				resp, requestErr := http.Get(api)
1801 1801
 
1802 1802
 				if requestErr != nil {
@@ -2073,6 +2073,7 @@ func (c *HisApiController) Refund() {
2073 2073
 
2074 2074
 	adminUser := c.GetAdminUserInfo()
2075 2075
 	theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", record_time+" 00:00:00", loc)
2076
+	fmt.Println(err)
2076 2077
 	if err != nil {
2077 2078
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
2078 2079
 		return
@@ -2086,7 +2087,7 @@ func (c *HisApiController) Refund() {
2086 2087
 	miConfig, _ := service.FindMedicalInsuranceInfo(adminUser.CurrentOrgId)
2087 2088
 	config, _ := service.GetMedicalInsuranceConfig(adminUser.CurrentOrgId)
2088 2089
 	if config.IsOpen == 1 { //对接了医保,走医保流程
2089
-		api := "http://127.0.0.1:9531/" + "gdyb/nine?psn_no=" + his.PsnNo +
2090
+		api := "http://127.0.0.1:9532/" + "gdyb/nine?psn_no=" + his.PsnNo +
2090 2091
 			"&mdtrt_id=" + his.Number + "&doctor=" + patientPrescription.Doctor + "&setl_id=" + order.SetlId + "&org_name=" + miConfig.OrgName + "&fixmedins_code=" + miConfig.Code +
2091 2092
 			"&insuplc_admdvs=" + miConfig.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey
2092 2093
 		resp, requestErr := http.Get(api)
@@ -2111,7 +2112,7 @@ func (c *HisApiController) Refund() {
2111 2112
 		fmt.Println(respJSON)
2112 2113
 		fmt.Println(userJSONBytes)
2113 2114
 
2114
-		api2 := "http://127.0.0.1:9531/" + "gdyb/six?psn_no=" + his.PsnNo +
2115
+		api2 := "http://127.0.0.1:9532/" + "gdyb/six?psn_no=" + his.PsnNo +
2115 2116
 			"&mdtrt_id=" + his.Number + "&chrg_bchno=" + order.Number + "&doctor=" + patientPrescription.Doctor + "&org_name=" + miConfig.OrgName + "&fixmedins_code=" + miConfig.Code +
2116 2117
 			"&insuplc_admdvs=" + miConfig.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey
2117 2118
 		resp2, requestErr2 := http.Get(api2)
@@ -2183,28 +2184,31 @@ func (c *HisApiController) GetCheckAccount() {
2183 2184
 	}
2184 2185
 
2185 2186
 	if config.IsOpen == 1 {
2186
-		api := "http://127.0.0.1:9532/" + "gdyb/ten?insutype=" + insutype +
2187
+		api := "http://127.0.0.1:9532/" + "gdyb/ten?" +
2188
+			"insutype=" + insutype +
2187 2189
 			"&clr_type=" + clr_type +
2188 2190
 			"&setl_optins=" + miConfig.OrgName +
2189 2191
 			"&stmt_begndate=" + start_time +
2190 2192
 			"&stm_enddate=" + end_time +
2191
-			"&medfee_sumamt=" + fmt.Sprintf("%2f", medfee_sumamt) +
2192
-			"&fund_pay_sumamt=" + fmt.Sprintf("%2f", fund_pay_sumamt) +
2193
-			"&acct_pay=" + fmt.Sprintf("%2f", acct_pay) +
2193
+			"&medfee_sumamt=" + fmt.Sprintf("%.2f", medfee_sumamt) +
2194
+			"&fund_pay_sumamt=" + fmt.Sprintf("%.2f", fund_pay_sumamt) +
2195
+			"&acct_pay=" + fmt.Sprintf("%.2f", acct_pay) +
2194 2196
 			"&fixmedins_setl_cnt=" + strconv.FormatInt(fixmedins_setl_cnt, 10) +
2195 2197
 			"&fixmedins_code=" + miConfig.Code +
2196 2198
 			"&insuplc_admdvs=" + miConfig.InsuplcAdmdvs +
2197 2199
 			"&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs +
2198 2200
 			"&secret_key=" + miConfig.SecretKey +
2199 2201
 			"&org_name=" + miConfig.OrgName +
2200
-			"&doctor="
2202
+			"&doctor=某人"
2201 2203
 
2204
+		fmt.Println(api)
2202 2205
 		resp, requestErr := http.Get(api)
2203 2206
 		if requestErr != nil {
2204 2207
 			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
2205 2208
 			return
2206 2209
 		}
2207 2210
 		body, ioErr := ioutil.ReadAll(resp.Body)
2211
+		fmt.Println(body)
2208 2212
 		if ioErr != nil {
2209 2213
 			utils.ErrorLog("接口返回数据读取失败: %v", ioErr)
2210 2214
 			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
@@ -2216,6 +2220,7 @@ func (c *HisApiController) GetCheckAccount() {
2216 2220
 			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
2217 2221
 			return
2218 2222
 		}
2223
+
2219 2224
 		respJSON = respJSON["data"].(map[string]interface{})["pre"].(map[string]interface{})
2220 2225
 		userJSONBytes, _ := json.Marshal(respJSON)
2221 2226
 
@@ -2285,9 +2290,9 @@ func (c *HisApiController) GetCheckDetailAccount() {
2285 2290
 			str = item.SetlId + "	" +
2286 2291
 				item.MdtrtId + "	" +
2287 2292
 				item.PsnNo + "	" +
2288
-				fmt.Sprintf("%2f", item.MedfeeSumamt) + "	" +
2289
-				fmt.Sprintf("%2f", item.FundPaySumamt) + "	" +
2290
-				fmt.Sprintf("%2f", item.AcctPay) + "	" + refd_setl_flag + "\n"
2293
+				fmt.Sprintf("%.2f", item.MedfeeSumamt) + "	" +
2294
+				fmt.Sprintf("%.2f", item.FundPaySumamt) + "	" +
2295
+				fmt.Sprintf("%.2f", item.AcctPay) + "	" + refd_setl_flag + "\n"
2291 2296
 			_, err = f.Write([]byte(str))
2292 2297
 		}
2293 2298
 
@@ -2302,7 +2307,7 @@ func (c *HisApiController) GetCheckDetailAccount() {
2302 2307
 			"&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs +
2303 2308
 			"&secret_key=" + miConfig.SecretKey +
2304 2309
 			"&org_name=" + miConfig.OrgName +
2305
-			"&doctor="
2310
+			"&doctor=某人"
2306 2311
 
2307 2312
 		resp, requestErr := http.Get(api)
2308 2313
 		if requestErr != nil {
@@ -2337,9 +2342,9 @@ func (c *HisApiController) GetCheckDetailAccount() {
2337 2342
 				"&setl_optins=" + miConfig.OrgName +
2338 2343
 				"&stmt_begndate=" + start_time +
2339 2344
 				"&stm_enddate=" + end_time +
2340
-				"&medfee_sumamt=" + fmt.Sprintf("%2f", medfee_sumamt) +
2341
-				"&fund_pay_sumamt=" + fmt.Sprintf("%2f", fund_pay_sumamt) +
2342
-				"&cash_payamt=" + fmt.Sprintf("%2f", psn_cash_pay) +
2345
+				"&medfee_sumamt=" + fmt.Sprintf("%.2f", medfee_sumamt) +
2346
+				"&fund_pay_sumamt=" + fmt.Sprintf("%.2f", fund_pay_sumamt) +
2347
+				"&cash_payamt=" + fmt.Sprintf("%.2f", psn_cash_pay) +
2343 2348
 				"&fixmedins_setl_cnt=" + strconv.FormatInt(fixmedins_setl_cnt, 10) +
2344 2349
 				"&fixmedins_code=" + miConfig.Code +
2345 2350
 				"&insuplc_admdvs=" + miConfig.InsuplcAdmdvs +

+ 10 - 6
service/gdyb_service.go Bestand weergeven

@@ -622,7 +622,7 @@ func Gdyb2207(psnNo string, mdtrtId string, chrgBchno string, certNo string, ins
622 622
 
623 623
 	inputData["psn_no"] = psnNo         // 人员编号 (来自1101接口返回)
624 624
 	inputData["mdtrt_cert_type"] = "02" // 就诊凭证类型
625
-	inputData["mdtrt_cert_no"] = ""     // 就诊凭证编号
625
+	inputData["mdtrt_cert_no"] = certNo // 就诊凭证编号
626 626
 	inputData["med_type"] = "11"        // 医疗类别 11 普通门诊  12 门诊挂号
627 627
 	inputData["medfee_sumamt"] = total  // 医疗费总额
628 628
 	inputData["psn_setlway"] = "01"     // 个人结算方式 01 按项目结 02 按定额结算
@@ -731,6 +731,10 @@ func Gdyb2208(psnNo string, mdtrtId string, setlId string, org_name string, doct
731 731
 
732 732
 //  医药机构费用结算对总账 func Gdyb3201( org_name string, doctor string, secret_key string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string) string {
733 733
 func Gdyb3201(baseParams models.BaseParams, businessParams models.BusinessParams) string {
734
+	fmt.Println("11222333-----")
735
+
736
+	fmt.Println(baseParams)
737
+	fmt.Println(businessParams)
734 738
 	// 生成签名
735 739
 	nonce := GetRandomString(32)
736 740
 	timestamp := time.Now().Unix()
@@ -746,8 +750,8 @@ func Gdyb3201(baseParams models.BaseParams, businessParams models.BusinessParams
746 750
 	inputData["setl_optins"] = baseParams.OrgName                     // 结算经办机构
747 751
 	inputData["stmt_begndate"] = businessParams.StmtBegndate          // 对帐开始时间
748 752
 	inputData["stmt_enddate"] = businessParams.StmtEnddate            //对帐结束时间
749
-	inputData["medfee_sumamt"] = businessParams.StmtEnddate           //医疗费总额
750
-	inputData["fund_pay_sumamt"] = businessParams.StmtEnddate         //基金支付总额
753
+	inputData["medfee_sumamt"] = businessParams.MedfeeSumamt          //医疗费总额
754
+	inputData["fund_pay_sumamt"] = businessParams.FundPaySumamt       //基金支付总额
751 755
 	inputData["acct_pay"] = businessParams.AcctPay                    //个人账户支付金额
752 756
 	inputData["fixmedins_setl_cnt"] = businessParams.FixmedinsSetlCnt //定点医药机构结算笔数
753 757
 
@@ -762,7 +766,7 @@ func Gdyb3201(baseParams models.BaseParams, businessParams models.BusinessParams
762 766
 	}
763 767
 	reader := bytes.NewReader(bytesData)
764 768
 
765
-	url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/3102"
769
+	url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/3201"
766 770
 	request, err := http.NewRequest("POST", url, reader)
767 771
 	if err != nil {
768 772
 		fmt.Println(err.Error())
@@ -802,7 +806,7 @@ func Gdyb9101(baseParams models.BaseParams, file_name string, file_byte []byte)
802 806
 	inputMessage := SetInputMessage(nonce, timestamp, baseParams.OrgName, baseParams.Doctor, baseParams.FixmedinsCode, baseParams.InsuplcAdmdvs, baseParams.MdtrtareaAdmvs)
803 807
 	input := make(map[string]interface{})
804 808
 	inputData := make(map[string]interface{})
805
-	inputMessage["in"] = "3201"                            // 交易编码
809
+	inputMessage["infno"] = "9101"                         // 交易编码
806 810
 	inputData["file_name"] = file_name                     //文件名
807 811
 	inputData["in"] = file_byte                            //文件数据
808 812
 	inputData["fixmedins_code"] = baseParams.FixmedinsCode //编码
@@ -857,7 +861,7 @@ func Gdyb3202(baseParams models.BaseParams, businessParams models.BusinessParams
857 861
 	inputMessage := SetInputMessage(nonce, timestamp, baseParams.OrgName, baseParams.Doctor, baseParams.FixmedinsCode, baseParams.InsuplcAdmdvs, baseParams.MdtrtareaAdmvs)
858 862
 	input := make(map[string]interface{})
859 863
 	inputData := make(map[string]interface{})
860
-	inputMessage["infno"] = "3201"                                    // 交易编码
864
+	inputMessage["infno"] = "3202"                                    // 交易编码
861 865
 	inputData["file_qury_no"] = businessParams.FileQuryNo             // 险种
862 866
 	inputData["setl_optins"] = baseParams.OrgName                     // 结算经办机构
863 867
 	inputData["stmt_begndate"] = businessParams.StmtBegndate          // 对帐开始时间