|
@@ -2637,31 +2637,17 @@ func (c *HisApiController) Refund() {
|
2637
|
2637
|
miConfig, _ := service.FindMedicalInsuranceInfo(adminUser.CurrentOrgId)
|
2638
|
2638
|
config, _ := service.GetMedicalInsuranceConfig(adminUser.CurrentOrgId)
|
2639
|
2639
|
if config.IsOpen == 1 { //对接了医保,走医保流程
|
2640
|
|
- api := "http://127.0.0.1:9532/" + "gdyb/nine?psn_no=" + order.PsnNo +
|
2641
|
|
- "&mdtrt_id=" + order.MdtrtId + "&doctor=" + roles.UserName + "&setl_id=" + order.SetlId + "&org_name=" + miConfig.OrgName + "&fixmedins_code=" + miConfig.Code +
|
2642
|
|
- "&insuplc_admdvs=" + miConfig.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey
|
2643
|
|
- resp, requestErr := http.Get(api)
|
2644
|
|
- if requestErr != nil {
|
2645
|
|
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
2646
|
|
- return
|
2647
|
|
- }
|
2648
|
|
- body, ioErr := ioutil.ReadAll(resp.Body)
|
2649
|
|
- if ioErr != nil {
|
2650
|
|
- utils.ErrorLog("接口返回数据读取失败: %v", ioErr)
|
2651
|
|
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
2652
|
|
- return
|
2653
|
|
- }
|
2654
|
|
- var respJSON map[string]interface{}
|
2655
|
|
- if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
|
2656
|
|
- utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
|
2657
|
|
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
2658
|
|
- return
|
|
2640
|
+
|
|
2641
|
+ result, src_resquest := service.Gdyb2208(order.PsnNo, order.MdtrtId, roles.UserName, order.SetlId, miConfig.OrgName, miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey)
|
|
2642
|
+
|
|
2643
|
+ var dat map[string]interface{}
|
|
2644
|
+ if err := json.Unmarshal([]byte(result), &dat); err == nil {
|
|
2645
|
+ fmt.Println(dat)
|
|
2646
|
+ } else {
|
|
2647
|
+ fmt.Println(err)
|
2659
|
2648
|
}
|
2660
|
|
- respJSON = respJSON["data"].(map[string]interface{})["pre"].(map[string]interface{})
|
2661
|
|
- userJSONBytes, _ := json.Marshal(respJSON)
|
2662
|
2649
|
|
2663
|
|
- respJSON2 := respJSON["data"].(map[string]interface{})["pre2"].(map[string]interface{})
|
2664
|
|
- userJSONBytes2, _ := json.Marshal(respJSON2)
|
|
2650
|
+ userJSONBytes, _ := json.Marshal(dat)
|
2665
|
2651
|
|
2666
|
2652
|
var res ResultSixteen
|
2667
|
2653
|
if err := json.Unmarshal(userJSONBytes, &res); err != nil {
|
|
@@ -2670,28 +2656,18 @@ func (c *HisApiController) Refund() {
|
2670
|
2656
|
return
|
2671
|
2657
|
}
|
2672
|
2658
|
if res.Infcode == 0 {
|
2673
|
|
- api2 := "http://127.0.0.1:9532/" + "gdyb/six?psn_no=" + order.PsnNo +
|
2674
|
|
- "&mdtrt_id=" + order.MdtrtId + "&chrg_bchno=" + order.Number + "&doctor=" + roles.UserName + "&org_name=" + miConfig.OrgName + "&fixmedins_code=" + miConfig.Code +
|
2675
|
|
- "&insuplc_admdvs=" + miConfig.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey
|
2676
|
|
- resp2, requestErr2 := http.Get(api2)
|
2677
|
|
- if requestErr2 != nil {
|
2678
|
|
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
2679
|
|
- return
|
2680
|
|
- }
|
2681
|
|
- body2, ioErr2 := ioutil.ReadAll(resp2.Body)
|
2682
|
|
- if ioErr2 != nil {
|
2683
|
|
- utils.ErrorLog("接口返回数据读取失败: %v", ioErr2)
|
2684
|
|
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
2685
|
|
- return
|
2686
|
|
- }
|
2687
|
|
- var respJSON2 map[string]interface{}
|
2688
|
|
- if err := json.Unmarshal([]byte(string(body2)), &respJSON2); err != nil {
|
2689
|
|
- utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
|
2690
|
|
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
2691
|
|
- return
|
|
2659
|
+
|
|
2660
|
+ result := service.Gdyb2205(order.PsnNo, order.MdtrtId, order.Number, miConfig.OrgName, roles.UserName, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, miConfig.Code)
|
|
2661
|
+
|
|
2662
|
+ var dat map[string]interface{}
|
|
2663
|
+ if err := json.Unmarshal([]byte(result), &dat); err == nil {
|
|
2664
|
+ fmt.Println(dat)
|
|
2665
|
+ } else {
|
|
2666
|
+ fmt.Println(err)
|
2692
|
2667
|
}
|
2693
|
|
- respJSON = respJSON["data"].(map[string]interface{})["pre"].(map[string]interface{})
|
2694
|
|
- userJSONBytes, _ := json.Marshal(respJSON)
|
|
2668
|
+
|
|
2669
|
+ userJSONBytes, _ := json.Marshal(dat)
|
|
2670
|
+
|
2695
|
2671
|
var res2 ResultSix
|
2696
|
2672
|
if err := json.Unmarshal(userJSONBytes, &res2); err != nil {
|
2697
|
2673
|
utils.ErrorLog("解析失败:%v", err)
|
|
@@ -2699,7 +2675,7 @@ func (c *HisApiController) Refund() {
|
2699
|
2675
|
return
|
2700
|
2676
|
}
|
2701
|
2677
|
if res2.Infcode == 0 {
|
2702
|
|
- err := service.UpdataOrderStatus(order_id, order.Number, adminUser.CurrentOrgId, string(userJSONBytes2))
|
|
2678
|
+ err := service.UpdataOrderStatus(order_id, order.Number, adminUser.CurrentOrgId, src_resquest)
|
2703
|
2679
|
if err == nil {
|
2704
|
2680
|
c.ServeSuccessJSON(map[string]interface{}{
|
2705
|
2681
|
"msg": "退费成功",
|