|
@@ -83,6 +83,8 @@ func HisManagerApiRegistRouters() {
|
83
|
83
|
|
84
|
84
|
beego.Router("/api/readelecard", &HisApiController{}, "get:ReadEleCard")
|
85
|
85
|
|
|
86
|
+ beego.Router("/api/3202", &HisApiController{}, "get:Post3202")
|
|
87
|
+
|
86
|
88
|
}
|
87
|
89
|
|
88
|
90
|
type Result3101 struct {
|
|
@@ -13053,3 +13055,102 @@ func DeleteExtraSpace(s string) string {
|
13053
|
13055
|
}
|
13054
|
13056
|
return string(s2)
|
13055
|
13057
|
}
|
|
13058
|
+
|
|
13059
|
+//对账
|
|
13060
|
+func (c *HisApiController) Post3202() {
|
|
13061
|
+ start_time := c.GetString("start_time")
|
|
13062
|
+ end_time := c.GetString("end_time")
|
|
13063
|
+ insutype := c.GetString("insutype")
|
|
13064
|
+ clr_type := c.GetString("clr_type")
|
|
13065
|
+ clr_org := c.GetString("clr_optins")
|
|
13066
|
+
|
|
13067
|
+ admin_user_id, _ := c.GetInt64("admin_user_id")
|
|
13068
|
+
|
|
13069
|
+ adminUser := c.GetAdminUserInfo()
|
|
13070
|
+ miConfig, _ := service.FindMedicalInsuranceInfo(adminUser.CurrentOrgId)
|
|
13071
|
+ config, _ := service.GetMedicalInsuranceConfig(adminUser.CurrentOrgId)
|
|
13072
|
+ if len(clr_org) == 0 {
|
|
13073
|
+ clr_org = miConfig.MdtrtareaAdmvs
|
|
13074
|
+ }
|
|
13075
|
+ timeLayout := "2006-01-02"
|
|
13076
|
+ loc, _ := time.LoadLocation("Local")
|
|
13077
|
+ startime, _ := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
|
|
13078
|
+ endtime, _ := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
|
|
13079
|
+ orders, _ := service.GetOrderByTimeFour(startime.Unix(), endtime.Unix(), adminUser.CurrentOrgId, insutype, "", clr_type)
|
|
13080
|
+ fixmedins_setl_cnt := int64(len(orders))
|
|
13081
|
+ var medfee_sumamt float64
|
|
13082
|
+ var acct_pay float64
|
|
13083
|
+ var fund_pay_sumamt float64
|
|
13084
|
+ for _, item := range orders {
|
|
13085
|
+ medfee_sumamt = medfee_sumamt + item.MedfeeSumamt
|
|
13086
|
+ acct_pay = acct_pay + item.AcctPay
|
|
13087
|
+ fund_pay_sumamt = fund_pay_sumamt + item.FundPaySumamt
|
|
13088
|
+ }
|
|
13089
|
+ var user_name string
|
|
13090
|
+ role, _ := service.GetAdminUserInfoByID(adminUser.CurrentOrgId, admin_user_id)
|
|
13091
|
+ if role.ID == 0 {
|
|
13092
|
+ user_name = "xxx"
|
|
13093
|
+ } else {
|
|
13094
|
+ user_name = role.UserName
|
|
13095
|
+ }
|
|
13096
|
+ var res ResultSix
|
|
13097
|
+ if config.IsOpen == 1 {
|
|
13098
|
+ if miConfig.MdtrtareaAdmvs == "421300" {
|
|
13099
|
+ api := "http://192.168.124.4:9532/" + "hbyb/3202?" +
|
|
13100
|
+ "insutype=" + insutype +
|
|
13101
|
+ "&clr_type=" + clr_type +
|
|
13102
|
+ "&setl_optins=" + clr_org +
|
|
13103
|
+ "&stmt_begndate=" + start_time +
|
|
13104
|
+ "&stm_enddate=" + end_time +
|
|
13105
|
+ "&fund_pay_sumamt=" + fmt.Sprintf("%.4f", fund_pay_sumamt) +
|
|
13106
|
+ "&acct_pay=" + fmt.Sprintf("%.4f", acct_pay) +
|
|
13107
|
+ "&fixmedins_setl_cnt=" + strconv.FormatInt(fixmedins_setl_cnt, 10) +
|
|
13108
|
+ "&fixmedins_code=" + miConfig.Code +
|
|
13109
|
+ "&insuplc_admdvs=" + miConfig.InsuplcAdmdvs +
|
|
13110
|
+ "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs +
|
|
13111
|
+ "&secret_key=" + miConfig.SecretKey +
|
|
13112
|
+ "&org_name=" + miConfig.OrgName +
|
|
13113
|
+ "&doctor=" + user_name
|
|
13114
|
+ resp, requestErr := http.Get(api)
|
|
13115
|
+ if requestErr != nil {
|
|
13116
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
|
13117
|
+ return
|
|
13118
|
+ }
|
|
13119
|
+ body, ioErr := ioutil.ReadAll(resp.Body)
|
|
13120
|
+ if ioErr != nil {
|
|
13121
|
+ utils.ErrorLog("接口返回数据读取失败: %v", ioErr)
|
|
13122
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
|
13123
|
+ return
|
|
13124
|
+ }
|
|
13125
|
+ var respJSON map[string]interface{}
|
|
13126
|
+ if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
|
|
13127
|
+ utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
|
|
13128
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
|
13129
|
+ return
|
|
13130
|
+ }
|
|
13131
|
+
|
|
13132
|
+ respJSON = respJSON["data"].(map[string]interface{})["pre"].(map[string]interface{})
|
|
13133
|
+ result, _ := json.Marshal(respJSON)
|
|
13134
|
+ fmt.Println("log")
|
|
13135
|
+ fmt.Println(string(result))
|
|
13136
|
+ if err := json.Unmarshal([]byte(result), &res); err != nil {
|
|
13137
|
+ utils.ErrorLog("解析失败:%v", err)
|
|
13138
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
|
13139
|
+ return
|
|
13140
|
+ }
|
|
13141
|
+
|
|
13142
|
+ }
|
|
13143
|
+
|
|
13144
|
+ if res.Infcode == 0 {
|
|
13145
|
+ c.ServeSuccessJSON(map[string]interface{}{
|
|
13146
|
+ "msg": "发起成功",
|
|
13147
|
+ })
|
|
13148
|
+ } else {
|
|
13149
|
+ c.ServeSuccessJSON(map[string]interface{}{
|
|
13150
|
+ "code": -10,
|
|
13151
|
+ "msg": res.ErrMsg,
|
|
13152
|
+ })
|
|
13153
|
+
|
|
13154
|
+ }
|
|
13155
|
+ }
|
|
13156
|
+}
|