package hb import ( "encoding/json" "fmt" "time" "os" "gdyb/controllers" "gdyb/models" "gdyb/service" "gdyb/utils" "github.com/astaxie/beego" "io/ioutil" ) type HBybController struct { controllers.BaseAuthAPIController } func HbybRegistRouters() { beego.Router("/hbyb/1101", &HBybController{}, "get:PostOne") beego.Router("/hbyb/2201", &HBybController{}, "get:PostTwo") beego.Router("/hbyb/2202", &HBybController{}, "get:PostThree") beego.Router("/hbyb/2203", &HBybController{}, "post:PostFour") beego.Router("/hbyb/2204", &HBybController{}, "post:PostFive") beego.Router("/hbyb/2205", &HBybController{}, "get:PostSix") beego.Router("/hbyb/2206", &HBybController{}, "get:PostSeven") beego.Router("/hbyb/2207", &HBybController{}, "get:PostEight") beego.Router("/hbyb/2208", &HBybController{}, "get:PostNine") beego.Router("/hbyb/5203", &HBybController{}, "get:PostTen") beego.Router("/hbyb/2001", &HBybController{}, "get:Post2001") beego.Router("/hbyb/3202", &HBybController{}, "post:Post3202a") beego.Router("/hbyb/1608", &HBybController{}, "post:Post1608") beego.Router("/hbyb/3202b", &HBybController{}, "post:Post3202b") //beego.Router("/hbyb/3202c", &HBybController{}, "post:Post3202") beego.Router("/hbyb/4101", &HBybController{}, "post:Post4101") beego.Router("/hbyb/5262", &HBybController{}, "post:Post5262") beego.Router("/hbyb/5267", &HBybController{}, "post:Post5267") beego.Router("/hbyb/5301", &HBybController{}, "get:Post5301") beego.Router("/hbyb/2401", &HBybController{}, "post:Post2401") beego.Router("/hbyb/2402", &HBybController{}, "post:Post2402") beego.Router("/hbyb/2404", &HBybController{}, "get:Post2404") beego.Router("/hbyb/2405", &HBybController{}, "get:Post2405") beego.Router("/hbyb/2301", &HBybController{}, "post:Post2301") beego.Router("/hbyb/2302", &HBybController{}, "get:Post2302") beego.Router("/hbyb/2303", &HBybController{}, "get:Post2303") beego.Router("/hbyb/2304", &HBybController{}, "get:Post2304") beego.Router("/hbyb/2305", &HBybController{}, "get:Post2305") } func (c *HBybController) Post2401() { body, _ := ioutil.ReadAll(c.Ctx.Request.Body) var respJSON map[string]interface{} if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil { utils.ErrorLog("接口返回数据解析JSON失败: %v", err) return } userJSONBytes, _ := json.Marshal(respJSON["struct_2401"]) var struct2401 service.Struct2401 if err := json.Unmarshal(userJSONBytes, &struct2401); err != nil { utils.ErrorLog("解析失败:%v", err) return } org_name := respJSON["org_name"].(string) fixmedins_code := respJSON["fixmedins_code"].(string) doctor := respJSON["doctor"].(string) insuplc_admdvs := respJSON["insuplc_admdvs"].(string) mdtrtarea_admvs := respJSON["mdtrtarea_admvs"].(string) secret_key := respJSON["secret_key"].(string) result, request_log := service.Hbyb2401(struct2401, secret_key, org_name, fixmedins_code, doctor, insuplc_admdvs, mdtrtarea_admvs) saveJsLog(result, request_log, "2401", "入院登记", org_name) var dat2 map[string]interface{} if err := json.Unmarshal([]byte(request_log), &dat2); err == nil { } else { } var dat map[string]interface{} if err := json.Unmarshal([]byte(result), &dat); err == nil { } else { } c.ServeSuccessJSON(map[string]interface{}{ "pre": dat, "request_log": dat2, }) } func (c *HBybController) Post2404() { mdtrt_id := c.GetString("mdtrt_id") psn_no := c.GetString("psn_no") doctor := c.GetString("doctor") fixmedins_code := c.GetString("fixmedins_code") insuplc_admdvs := c.GetString("insuplc_admdvs") mdtrtarea_admvs := c.GetString("mdtrtarea_admvs") secret_key := c.GetString("secret_key") org_name := c.GetString("org_name") result, requestLog := service.Hbyb2404(mdtrt_id, psn_no, secret_key, org_name, fixmedins_code, doctor, insuplc_admdvs, mdtrtarea_admvs) saveJsLog(result, requestLog, "2404", "入院登记撤销", org_name) var dat map[string]interface{} if err := json.Unmarshal([]byte(result), &dat); err == nil { } else { } var dat2 map[string]interface{} if err := json.Unmarshal([]byte(requestLog), &dat2); err == nil { } else { } c.ServeSuccessJSON(map[string]interface{}{ "pre": dat, "log": dat2, }) } func (c *HBybController) Post2405() { mdtrt_id := c.GetString("mdtrt_id") psn_no := c.GetString("psn_no") doctor := c.GetString("doctor") fixmedins_code := c.GetString("fixmedins_code") insuplc_admdvs := c.GetString("insuplc_admdvs") mdtrtarea_admvs := c.GetString("mdtrtarea_admvs") secret_key := c.GetString("secret_key") org_name := c.GetString("org_name") result, requestLog := service.Hb2405(mdtrt_id, psn_no, secret_key, org_name, fixmedins_code, doctor, insuplc_admdvs, mdtrtarea_admvs) saveJsLog(result, requestLog, "2405", "出院登记撤销", org_name) var dat map[string]interface{} if err := json.Unmarshal([]byte(result), &dat); err == nil { } else { } var dat2 map[string]interface{} if err := json.Unmarshal([]byte(requestLog), &dat2); err == nil { } else { } c.ServeSuccessJSON(map[string]interface{}{ "pre": dat, "log": dat2, }) } func (c *HBybController) Post2402() { body, _ := ioutil.ReadAll(c.Ctx.Request.Body) var respJSON map[string]interface{} if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil { utils.ErrorLog("接口返回数据解析JSON失败: %v", err) return } userJSONBytes, _ := json.Marshal(respJSON["struct_2402"]) var struct2402 service.Struct2402 if err := json.Unmarshal(userJSONBytes, &struct2402); err != nil { utils.ErrorLog("解析失败:%v", err) return } org_name := respJSON["org_name"].(string) fixmedins_code := respJSON["fixmedins_code"].(string) doctor := respJSON["doctor"].(string) insuplc_admdvs := respJSON["insuplc_admdvs"].(string) mdtrtarea_admvs := respJSON["mdtrtarea_admvs"].(string) secret_key := respJSON["secret_key"].(string) result, request_log := service.Hb2402(struct2402, org_name, doctor, insuplc_admdvs, mdtrtarea_admvs, secret_key, fixmedins_code) saveJsLog(result, request_log, "2402", "出院", org_name) var dat2 map[string]interface{} if err := json.Unmarshal([]byte(request_log), &dat2); err == nil { } else { } var dat map[string]interface{} if err := json.Unmarshal([]byte(result), &dat); err == nil { } else { } c.ServeSuccessJSON(map[string]interface{}{ "pre": dat, "request_log": dat2, }) } func (c *HBybController) Post2301() { body, _ := ioutil.ReadAll(c.Ctx.Request.Body) var respJSON map[string]interface{} if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil { utils.ErrorLog("接口返回数据解析JSON失败: %v", err) return } userJSONBytes, _ := json.Marshal(respJSON["customs"]) var customs []*models.NewCustom if err := json.Unmarshal(userJSONBytes, &customs); err != nil { utils.ErrorLog("解析失败:%v", err) return } number := respJSON["number"].(string) chrg_bchno := respJSON["chrg_bchno"].(string) dept := respJSON["dept"].(string) dept_code := respJSON["dept_code"].(string) doctor_code := respJSON["doctor_code"].(string) doctor_name := respJSON["doctor_name"].(string) opertor := respJSON["opertor"].(string) org_name := respJSON["org_name"].(string) fixmedins_code := respJSON["fixmedins_code"].(string) insuplc_admdvs := respJSON["insuplc_admdvs"].(string) mdtrtarea_admvs := respJSON["mdtrtarea_admvs"].(string) secret_key := respJSON["secret_key"].(string) med_type := respJSON["med_type"].(string) //med_type := strconv.FormatInt(int64(respJSON["med_type"].(float64)), 10) psn_no := respJSON["psn_no"].(string) result, requestLog := service.Hb2301A(psn_no, number, customs, chrg_bchno, org_name, doctor_name, dept, fixmedins_code, dept_code, doctor_code, insuplc_admdvs, mdtrtarea_admvs, secret_key, med_type, opertor) saveJsLog(result, requestLog, "2301", "上传明细", org_name) var dat2 map[string]interface{} if err := json.Unmarshal([]byte(requestLog), &dat2); err == nil { } else { } var dat map[string]interface{} if err := json.Unmarshal([]byte(result), &dat); err == nil { } else { } c.ServeSuccessJSON(map[string]interface{}{ "pre": dat, "request_log": dat2, }) } func (c *HBybController) Post2302() { mdtrt_id := c.GetString("mdtrtId") psn_no := c.GetString("psn_no") number := c.GetString("feedetl_sn") doctor := c.GetString("doctor") fixmedins_code := c.GetString("fixmedins_code") insuplc_admdvs := c.GetString("insuplc_admdvs") mdtrtarea_admvs := c.GetString("mdtrtarea_admvs") secret_key := c.GetString("secret_key") org_name := c.GetString("org_name") refund_type, _ := c.GetInt64("refund_type") result, requestLog := service.Hb2302(psn_no, mdtrt_id, org_name, doctor, insuplc_admdvs, mdtrtarea_admvs, secret_key, fixmedins_code, number, refund_type) saveJsLog(result, requestLog, "2302", "退明细", org_name) var dat2 map[string]interface{} if err := json.Unmarshal([]byte(requestLog), &dat2); err == nil { } else { } var dat map[string]interface{} if err := json.Unmarshal([]byte(result), &dat); err == nil { } else { } c.ServeSuccessJSON(map[string]interface{}{ "pre": dat, "request_log": dat2, }) } func (c *HBybController) Post2303() { mdtrt_id := c.GetString("mdtrt_id") psn_no := c.GetString("psn_no") chrg_bchno := c.GetString("chrg_bchno") cert_no := c.GetString("cert_no") insutype_type := c.GetString("insutype_type") allTotal := c.GetString("total") id_card_type, _ := c.GetInt64("id_card_type") doctor := c.GetString("doctor") certificates, _ := c.GetInt64("certificates") fixmedins_code := c.GetString("fixmedins_code") insuplc_admdvs := c.GetString("insuplc_admdvs") mdtrtarea_admvs := c.GetString("mdtrtarea_admvs") secret_key := c.GetString("secret_key") org_name := c.GetString("org_name") result, src_resquest := service.Hb2303(psn_no, mdtrt_id, chrg_bchno, cert_no, insutype_type, allTotal, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, secret_key, "0", id_card_type, 0, 0, 0, 0, certificates) saveJsLog(result, src_resquest, "2303", "预结算", org_name) var dat2 map[string]interface{} if err := json.Unmarshal([]byte(src_resquest), &dat2); err == nil { } else { } var dat map[string]interface{} if err := json.Unmarshal([]byte(result), &dat); err == nil { } else { } c.ServeSuccessJSON(map[string]interface{}{ "pre": dat, "request_log": dat2, }) } func (c *HBybController) Post2304() { mdtrt_id := c.GetString("mdtrt_id") psn_no := c.GetString("psn_no") chrg_bchno := c.GetString("chrg_bchno") cert_no := c.GetString("cert_no") insutype_type := c.GetString("insutype_type") allTotal := c.GetString("total") id_card_type, _ := c.GetInt64("id_card_type") doctor := c.GetString("doctor") certificates, _ := c.GetInt64("certificates") fixmedins_code := c.GetString("fixmedins_code") insuplc_admdvs := c.GetString("insuplc_admdvs") mdtrtarea_admvs := c.GetString("mdtrtarea_admvs") secret_key := c.GetString("secret_key") org_name := c.GetString("org_name") fapiao_number := c.GetString("fapiao_number") acct_used_flag := c.GetString("acct_used_flag") result, src_resquest := service.Hb2304(psn_no, mdtrt_id, chrg_bchno, cert_no, insutype_type, allTotal, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, secret_key, "0", id_card_type, 0, 0, 0, 0, certificates, fapiao_number, acct_used_flag) saveJsLog(result, src_resquest, "2304", "住院结算", org_name) var dat2 map[string]interface{} if err := json.Unmarshal([]byte(src_resquest), &dat2); err == nil { } else { } var dat map[string]interface{} if err := json.Unmarshal([]byte(result), &dat); err == nil { } else { } c.ServeSuccessJSON(map[string]interface{}{ "pre": dat, "request_log": dat2, }) } func (c *HBybController) Post2305() { mdtrt_id := c.GetString("mdtrt_id") psn_no := c.GetString("psn_no") doctor := c.GetString("doctor") setl_id := c.GetString("setl_id") fixmedins_code := c.GetString("fixmedins_code") insuplc_admdvs := c.GetString("insuplc_admdvs") mdtrtarea_admvs := c.GetString("mdtrtarea_admvs") secret_key := c.GetString("secret_key") org_name := c.GetString("org_name") result, requestLog := service.Hb2305(psn_no, mdtrt_id, setl_id, org_name, doctor, secret_key, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs) saveJsLog(result, requestLog, "2305", "退费", org_name) var dat2 map[string]interface{} if err := json.Unmarshal([]byte(requestLog), &dat2); err == nil { } else { } var dat map[string]interface{} if err := json.Unmarshal([]byte(result), &dat); err == nil { } else { } c.ServeSuccessJSON(map[string]interface{}{ "pre": dat, "request_log": dat2, }) } func (c *HBybController)Post5301(){ org_name := c.GetString("org_name") doctor := c.GetString("doctor") fixmedins_code := c.GetString("fixmedins_code") insuplc_admdvs := c.GetString("insuplc_admdvs") mdtrtarea_admvs := c.GetString("mdtrtarea_admvs") secret_key := c.GetString("secret_key") psn_no := c.GetString("psn_no") result := service.Hbyb5301(psn_no,"",org_name, doctor,fixmedins_code,"",insuplc_admdvs,mdtrtarea_admvs,secret_key,"","") var dat map[string]interface{} if err := json.Unmarshal([]byte(result), &dat); err == nil { fmt.Println(dat) } else { fmt.Println(err) } c.ServeSuccessJSON(map[string]interface{}{ "pre": dat, }) } func (c *HBybController)Post5262(){ body, _ := ioutil.ReadAll(c.Ctx.Request.Body) var respJSON map[string]interface{} if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil { utils.ErrorLog("接口返回数据解析JSON失败: %v", err) return } userJSONBytes, _ := json.Marshal(respJSON["bps"]) var bps models.BusinessParams5262 if err := json.Unmarshal(userJSONBytes, &bps); err != nil { utils.ErrorLog("解析失败:%v", err) return } var baseParams models.BaseParams baseParams.InsuplcAdmdvs = respJSON["insuplc_admdvs"].(string) baseParams.MdtrtareaAdmvs = respJSON["mdtrtarea_admvs"].(string) baseParams.OrgName = respJSON["org_name"].(string) baseParams.Doctor = respJSON["doctor"].(string) baseParams.FixmedinsCode = respJSON["fixmedins_code"].(string) page := respJSON["page"].(string) limit := respJSON["limit"].(string) result := service.Hbyb5262(baseParams, bps,page,limit) var dat map[string]interface{} if err := json.Unmarshal([]byte(result), &dat); err == nil { fmt.Println(dat) } else { fmt.Println(err) } c.ServeSuccessJSON(map[string]interface{}{ "pre": dat, }) } func (c *HBybController)Post5267(){ body, _ := ioutil.ReadAll(c.Ctx.Request.Body) var respJSON map[string]interface{} if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil { utils.ErrorLog("接口返回数据解析JSON失败: %v", err) return } userJSONBytes, _ := json.Marshal(respJSON["bps"]) var bps models.BusinessParams5262 if err := json.Unmarshal(userJSONBytes, &bps); err != nil { utils.ErrorLog("解析失败:%v", err) return } var baseParams models.BaseParams baseParams.InsuplcAdmdvs = respJSON["insuplc_admdvs"].(string) baseParams.MdtrtareaAdmvs = respJSON["mdtrtarea_admvs"].(string) baseParams.OrgName = respJSON["org_name"].(string) baseParams.Doctor = respJSON["doctor"].(string) baseParams.FixmedinsCode = respJSON["fixmedins_code"].(string) page := respJSON["page"].(string) limit := respJSON["limit"].(string) result := service.Hbyb5267(baseParams, bps,page,limit) var dat map[string]interface{} if err := json.Unmarshal([]byte(result), &dat); err == nil { fmt.Println(dat) } else { fmt.Println(err) } c.ServeSuccessJSON(map[string]interface{}{ "pre": dat, }) } func (c *HBybController) Post3202a() { body, _ := ioutil.ReadAll(c.Ctx.Request.Body) var respJSON map[string]interface{} if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil { utils.ErrorLog("接口返回数据解析JSON失败: %v", err) return } userJSONBytes, _ := json.Marshal(respJSON["bps"]) var bps []*models.BusinessParamsTwo if err := json.Unmarshal(userJSONBytes, &bps); err != nil { utils.ErrorLog("解析失败:%v", err) return } var baseParams models.BaseParams baseParams.InsuplcAdmdvs = respJSON["insuplc_admdvs"].(string) baseParams.MdtrtareaAdmvs = respJSON["mdtrtarea_admvs"].(string) baseParams.OrgName = respJSON["org_name"].(string) baseParams.Doctor = respJSON["doctor"].(string) baseParams.FixmedinsCode = respJSON["fixmedins_code"].(string) result := service.Hbyb3202a(baseParams, bps) var dat map[string]interface{} if err := json.Unmarshal([]byte(result), &dat); err == nil { fmt.Println(dat) } else { fmt.Println(err) } c.ServeSuccessJSON(map[string]interface{}{ "pre": dat, }) } func (c *HBybController) Post1608() { body, _ := ioutil.ReadAll(c.Ctx.Request.Body) var respJSON map[string]interface{} if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil { utils.ErrorLog("接口返回数据解析JSON失败: %v", err) return } var baseParams models.BaseParams baseParams.InsuplcAdmdvs = respJSON["insuplc_admdvs"].(string) baseParams.MdtrtareaAdmvs = respJSON["mdtrtarea_admvs"].(string) baseParams.OrgName = respJSON["org_name"].(string) baseParams.Doctor = respJSON["doctor"].(string) baseParams.FixmedinsCode = respJSON["fixmedins_code"].(string) cnt := respJSON["cnt"].(string) medfee_sumamt := respJSON["medfee_sumamt"].(string) func_smamt := respJSON["func_smamt"].(string) start_time := respJSON["start_time"].(string) end_time := respJSON["end_time"].(string) result := service.Hbyb1608(baseParams,cnt,medfee_sumamt,start_time,end_time,func_smamt) var dat map[string]interface{} if err := json.Unmarshal([]byte(result), &dat); err == nil { fmt.Println(dat) } else { fmt.Println(err) } c.ServeSuccessJSON(map[string]interface{}{ "pre": dat, }) } func (c *HBybController) Post3202b() { body, _ := ioutil.ReadAll(c.Ctx.Request.Body) var respJSON map[string]interface{} if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil { utils.ErrorLog("接口返回数据解析JSON失败: %v", err) return } userJSONBytes, _ := json.Marshal(respJSON["bps"]) var bps []*models.BusinessParamsTwo if err := json.Unmarshal(userJSONBytes, &bps); err != nil { utils.ErrorLog("解析失败:%v", err) return } var baseParams models.BaseParams baseParams.InsuplcAdmdvs = respJSON["insuplc_admdvs"].(string) baseParams.MdtrtareaAdmvs = respJSON["mdtrtarea_admvs"].(string) baseParams.OrgName = respJSON["org_name"].(string) baseParams.Doctor = respJSON["doctor"].(string) baseParams.FixmedinsCode = respJSON["fixmedins_code"].(string) result := service.Hbyb3202b(baseParams, bps) var dat map[string]interface{} if err := json.Unmarshal([]byte(result), &dat); err == nil { fmt.Println(dat) } else { fmt.Println(err) } c.ServeSuccessJSON(map[string]interface{}{ "pre": dat, }) } func (c *HBybController) Post4101() { body, _ := ioutil.ReadAll(c.Ctx.Request.Body) var respJSON map[string]interface{} if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil { utils.ErrorLog("接口返回数据解析JSON失败: %v", err) return } userJSONBytes, _ := json.Marshal(respJSON["struct4101"]) var struct4101 service.Struct4101 if err := json.Unmarshal(userJSONBytes, &struct4101); err != nil { utils.ErrorLog("解析失败:%v", err) return } result, inputLog := service.Hbyb4101(struct4101, respJSON["secret_key"].(string), respJSON["org_name"].(string), respJSON["opera"].(string), respJSON["code"].(string), respJSON["insuplc_admdvs"].(string), respJSON["mdtrtarea_admvs"].(string)) var dat map[string]interface{} if err := json.Unmarshal([]byte(result), &dat); err == nil { } else { } var dat2 map[string]interface{} if err := json.Unmarshal([]byte(inputLog), &dat2); err == nil { } else { } c.ServeSuccessJSON(map[string]interface{}{ "pre": dat, "log": dat2, }) } func (c *HBybController) Post2001() { org_name := c.GetString("org_name") doctor := c.GetString("doctor") fixmedins_code := c.GetString("fixmedins_code") insuplc_admdvs := c.GetString("insuplc_admdvs") mdtrtarea_admvs := c.GetString("mdtrtarea_admvs") secret_key := c.GetString("secret_key") psn_no := c.GetString("psn_no") insutype := c.GetString("insutype") med_type := c.GetString("med_type") result, inputLog := service.Hbyb2001(secret_key, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, psn_no, insutype, med_type) fmt.Println(result) fmt.Println(inputLog) var dat map[string]interface{} if err := json.Unmarshal([]byte(result), &dat); err == nil { } else { } var dat2 map[string]interface{} if err := json.Unmarshal([]byte(inputLog), &dat2); err == nil { } else { } c.ServeSuccessJSON(map[string]interface{}{ "pre": dat, "log": dat2, }) } func (c *HBybController) PostOne() { certNo := c.GetString("cert_no") org_name := c.GetString("org_name") doctor := c.GetString("doctor") fixmedins_code := c.GetString("fixmedins_code") insuplc_admdvs := c.GetString("insuplc_admdvs") mdtrtarea_admvs := c.GetString("mdtrtarea_admvs") secret_key := c.GetString("secret_key") id_card_type, _ := c.GetInt64("id_card_type") card_sn := c.GetString("card_sn") certificates := c.GetString("certificates") fmt.Println(certNo) fmt.Println(org_name) fmt.Println(doctor) fmt.Println(fixmedins_code) fmt.Println(insuplc_admdvs) fmt.Println(mdtrtarea_admvs) fmt.Println(secret_key) fmt.Println(id_card_type) fmt.Println(card_sn) fmt.Println(certificates) result, inputLog := service.Hbyb1101(certNo, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, secret_key, id_card_type, card_sn, certificates) fmt.Println(result) fmt.Println(inputLog) var dat map[string]interface{} if err := json.Unmarshal([]byte(result), &dat); err == nil { } else { } var dat2 map[string]interface{} if err := json.Unmarshal([]byte(inputLog), &dat2); err == nil { } else { } c.ServeSuccessJSON(map[string]interface{}{ "pre": dat, "log": dat2, }) } func (c *HBybController) PostTwo() { psnNo := c.GetString("psn_no") insutype := c.GetString("insutype") certNo := c.GetString("cert_no") org_name := c.GetString("org_name") doctor := c.GetString("doctor") ipt_otp_no := c.GetString("ipt_otp_no") dept := c.GetString("dept") fixmedins_code := c.GetString("fixmedins_code") opter := c.GetString("opter") dept_code := c.GetString("dept_code") doctor_id := c.GetString("doctor_id") doctor_name := c.GetString("doctor_name") insuplc_admdvs := c.GetString("insuplc_admdvs") mdtrtarea_admvs := c.GetString("mdtrtarea_admvs") secret_key := c.GetString("secret_key") id_card_type, _ := c.GetInt64("id_card_type") result, _ := service.Hbyb2201(psnNo, insutype, certNo, org_name, doctor, ipt_otp_no, dept, fixmedins_code, dept_code, doctor_id, insuplc_admdvs, mdtrtarea_admvs, secret_key, id_card_type, opter, doctor_name) var dat map[string]interface{} if err := json.Unmarshal([]byte(result), &dat); err == nil { //fmt.Println(dat["status"]) } else { } c.ServeSuccessJSON(map[string]interface{}{ "pre": dat, }) } func (c *HBybController) PostThree() { psnNo := c.GetString("psn_no") mdtrtId := c.GetString("mdtrt_id") iptOtpNo := c.GetString("ipt_otp_no") org_name := c.GetString("org_name") doctor := c.GetString("doctor") insuplc_admdvs := c.GetString("insuplc_admdvs") mdtrtarea_admvs := c.GetString("mdtrtarea_admvs") secret_key := c.GetString("secret_key") fixmedins_code := c.GetString("fixmedins_code") result, requestLog := service.Hbyb2202(psnNo, mdtrtId, iptOtpNo, org_name, doctor, insuplc_admdvs, mdtrtarea_admvs, secret_key, fixmedins_code) var dat map[string]interface{} if err := json.Unmarshal([]byte(result), &dat); err == nil { } else { } c.ServeSuccessJSON(map[string]interface{}{ "pre": dat, "request_log": requestLog, }) } func (c *HBybController) PostFour() { body, _ := ioutil.ReadAll(c.Ctx.Request.Body) var respJSON map[string]interface{} if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil { utils.ErrorLog("接口返回数据解析JSON失败: %v", err) return } userJSONBytes, _ := json.Marshal(respJSON["config"]) var config []*models.HisXtDiagnoseConfig if err := json.Unmarshal(userJSONBytes, &config); err != nil { utils.ErrorLog("解析失败:%v", err) return } psnNo := respJSON["psn_no"].(string) mdtrtId := respJSON["mdtrt_id"].(string) opter := respJSON["opter"].(string) org_name := respJSON["org_name"].(string) med_type := respJSON["med_type"].(string) doctor_id := respJSON["doctor_id"].(string) doctor_name := respJSON["doctor_name"].(string) department := respJSON["department"].(string) fixmedins_code := respJSON["fixmedins_code"].(string) insuplc_admdvs := respJSON["insuplc_admdvs"].(string) mdtrtarea_admvs := respJSON["mdtrtarea_admvs"].(string) secret_key := respJSON["secret_key"].(string) sick_code := respJSON["sick_code"].(string) sick_name := respJSON["sick_name"].(string) dept := respJSON["dept"].(string) begin_time := respJSON["begin_time"].(string) result, request_log := service.Hbyb2203(psnNo, mdtrtId, dept, department, org_name, med_type, doctor_id, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, secret_key, sick_code, sick_name, dept, config, begin_time, doctor_name, opter) fmt.Println(request_log) var dat map[string]interface{} if err := json.Unmarshal([]byte(result), &dat); err == nil { } else { } c.ServeSuccessJSON(map[string]interface{}{ "pre": dat, }) } type All struct { HisPrescription HisPrescription mdtrt_id string psn_no string } type HisPrescription struct { ID int64 `gorm:"column:id" json:"id" form:"id"` UserOrgId int64 `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"` RecordDate int64 `gorm:"column:record_date" json:"record_date" form:"record_date"` PatientId int64 `gorm:"column:patient_id" json:"patient_id" form:"patient_id"` HisPatientId int64 `gorm:"column:his_patient_id" json:"his_patient_id" form:"his_patient_id"` Status int64 `gorm:"column:status" json:"status" form:"status"` Ctime int64 `gorm:"column:ctime" json:"ctime" form:"ctime"` Mtime int64 `gorm:"column:mtime" json:"mtime" form:"mtime"` Number string `gorm:"column:number" json:"number" form:"number"` Type int64 `gorm:"column:type" json:"type" form:"type"` Doctor int64 `gorm:"column:doctor" json:"doctor" form:"doctor"` Creator int64 `gorm:"column:creator" json:"creator" form:"creator"` Modifier int64 `gorm:"column:modifier" json:"modifier" form:"modifier"` HisDoctorAdviceInfo []*models.HisDoctorAdviceInfo `gorm:"ForeignKey:PatientId,RecordDate,PrescriptionId;AssociationForeignKey:PatientId,RecordDate,ID" json:"advices"` HisPrescriptionProject []*models.HisPrescriptionProject `gorm:"ForeignKey:PatientId,RecordDate,PrescriptionId;AssociationForeignKey:PatientId,RecordDate,ID" json:"project"` } func (c *HBybController) PostFive() { body, _ := ioutil.ReadAll(c.Ctx.Request.Body) var respJSON map[string]interface{} if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil { utils.ErrorLog("接口返回数据解析JSON失败: %v", err) return } userJSONBytes, _ := json.Marshal(respJSON["pre"]) var hp []*models.HisPrescription if err := json.Unmarshal(userJSONBytes, &hp); err != nil { utils.ErrorLog("解析失败:%v", err) return } fmt.Println(respJSON["psn_no"].(string)) fmt.Println(respJSON["mdtrt_id"].(string)) fmt.Println(respJSON["chrg_bchno"].(string)) fmt.Println(respJSON["org_name"].(string)) fmt.Println(respJSON["doctor"].(string)) fmt.Println(respJSON["doctor_id"].(string)) fmt.Println(respJSON["dept"].(string)) fmt.Println(respJSON["fixmedins_code"].(string)) fmt.Println(respJSON["dept_code"].(string)) fmt.Println(respJSON["balance_accounts_type"].(string)) fmt.Println("1111111") fmt.Println(respJSON["opter"].(string)) fmt.Println(respJSON["insuplc_admdvs"].(string)) fmt.Println(respJSON["mdtrtarea_admvs"].(string)) fmt.Println(respJSON["secret_key"].(string)) result, requestLog := service.Hbyb2204(respJSON["psn_no"].(string), respJSON["mdtrt_id"].(string), hp, respJSON["chrg_bchno"].(string), respJSON["org_name"].(string), respJSON["doctor"].(string), respJSON["dept"].(string), respJSON["fixmedins_code"].(string), respJSON["dept_code"].(string), respJSON["doctor_id"].(string), respJSON["insuplc_admdvs"].(string), respJSON["mdtrtarea_admvs"].(string), respJSON["secret_key"].(string), respJSON["balance_accounts_type"].(string), respJSON["opter"].(string)) var dat map[string]interface{} if err := json.Unmarshal([]byte(result), &dat); err == nil { fmt.Println(dat) } else { fmt.Println(err) } var dat2 map[string]interface{} if err := json.Unmarshal([]byte(requestLog), &dat2); err == nil { fmt.Println(dat2) } else { fmt.Println(err) } c.ServeSuccessJSON(map[string]interface{}{ "pre": dat, "request_log": requestLog, }) } func (c *HBybController) PostSix() { psnNo := c.GetString("psn_no") mdtrtId := c.GetString("mdtrt_id") chrgBchno := c.GetString("chrg_bchno") org_name := c.GetString("org_name") doctor := c.GetString("doctor") insuplc_admdvs := c.GetString("insuplc_admdvs") mdtrtarea_admvs := c.GetString("mdtrtarea_admvs") secret_key := c.GetString("secret_key") fixmedins_code := c.GetString("fixmedins_code") result, requestlog := service.Hbyb2205(psnNo, mdtrtId, chrgBchno, org_name, doctor, insuplc_admdvs, mdtrtarea_admvs, secret_key, fixmedins_code) fmt.Println(requestlog) var dat map[string]interface{} if err := json.Unmarshal([]byte(result), &dat); err == nil { fmt.Println(dat) } else { fmt.Println(err) } c.ServeSuccessJSON(map[string]interface{}{ "pre": dat, }) } func (c *HBybController) PostSeven() { psnNo := c.GetString("psn_no") mdtrtId := c.GetString("mdtrt_id") chrgBchno := c.GetString("chrg_bchno") certNo := c.GetString("cert_no") insutype := c.GetString("insutype") total := c.GetString("total") org_name := c.GetString("org_name") doctor := c.GetString("doctor") fixmedins_code := c.GetString("fixmedins_code") insuplc_admdvs := c.GetString("insuplc_admdvs") mdtrtarea_admvs := c.GetString("mdtrtarea_admvs") secret_key := c.GetString("secret_key") med_type := c.GetString("med_type") id_card_type, _ := c.GetInt64("id_card_type") certificates, _ := c.GetInt64("certificates") result, requestlog := service.Hbyb2206(psnNo, mdtrtId, chrgBchno, certNo, insutype, total, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, secret_key, med_type, id_card_type, 0, 0, 0, 0, certificates) fmt.Println(requestlog) var dat map[string]interface{} if err := json.Unmarshal([]byte(result), &dat); err == nil { fmt.Println(dat) } else { fmt.Println(err) } c.ServeSuccessJSON(map[string]interface{}{ "pre": dat, }) } func (c *HBybController) PostEight() { psnNo := c.GetString("psn_no") mdtrtId := c.GetString("mdtrt_id") chrgBchno := c.GetString("chrg_bchno") certNo := c.GetString("cert_no") insutype := c.GetString("insutype") total := c.GetString("total") org_name := c.GetString("org_name") doctor := c.GetString("doctor") fixmedins_code := c.GetString("fixmedins_code") insuplc_admdvs := c.GetString("insuplc_admdvs") mdtrtarea_admvs := c.GetString("mdtrtarea_admvs") secret_key := c.GetString("secret_key") med_type := c.GetString("med_type") id_card_type, _ := c.GetInt64("id_card_type") certificates, _ := c.GetInt64("certificates") fulamt_ownpay_amt, _ := c.GetFloat("fulamt_ownpay_amt") overlmt_selfpay, _ := c.GetFloat("overlmt_selfpay") preselfpay_amt, _ := c.GetFloat("preselfpay_amt") inscp_scp_amt, _ := c.GetFloat("inscp_scp_amt") acct_used_flag, _ := c.GetInt64("acct_used_flag") result, srcRequest := service.Hbyb2207(psnNo, mdtrtId, chrgBchno, certNo, insutype, total, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, secret_key, med_type, id_card_type, fulamt_ownpay_amt, overlmt_selfpay, preselfpay_amt, inscp_scp_amt, certificates, acct_used_flag) var dat map[string]interface{} if err := json.Unmarshal([]byte(result), &dat); err == nil { fmt.Println(dat) } else { fmt.Println(err) } var dat2 map[string]interface{} if err := json.Unmarshal([]byte(srcRequest), &dat2); err == nil { fmt.Println(dat2) } else { fmt.Println(err) } c.ServeSuccessJSON(map[string]interface{}{ "pre": dat, "pre2": dat2, }) } func (c *HBybController) PostNine() { psnNo := c.GetString("psn_no") mdtrtId := c.GetString("mdtrt_id") setlId := c.GetString("setl_id") org_name := c.GetString("org_name") doctor := c.GetString("doctor") secret_key := c.GetString("secret_key") fixmedins_code := c.GetString("fixmedins_code") insuplc_admdvs := c.GetString("insuplc_admdvs") mdtrtarea_admvs := c.GetString("mdtrtarea_admvs") result, src_request := service.Hbyb2208(psnNo, mdtrtId, setlId, org_name, doctor, secret_key, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs) fmt.Println(src_request) var dat map[string]interface{} if err := json.Unmarshal([]byte(result), &dat); err == nil { fmt.Println(dat) } else { fmt.Println(err) } c.ServeSuccessJSON(map[string]interface{}{ "pre": dat, }) } func (c *HBybController) PostTen() { psnNo := c.GetString("psn_no") mdtrtId := c.GetString("mdtrt_id") setlId := c.GetString("setl_id") org_name := c.GetString("org_name") doctor := c.GetString("doctor") med_type := c.GetString("med_type") secret_key := c.GetString("secret_key") fixmedins_code := c.GetString("fixmedins_code") insuplc_admdvs := c.GetString("insuplc_admdvs") mdtrtarea_admvs := c.GetString("mdtrtarea_admvs") baseParams := models.BaseParams{ SecretKey: secret_key, FixmedinsCode: fixmedins_code, InsuplcAdmdvs: insuplc_admdvs, MdtrtareaAdmvs: mdtrtarea_admvs, OrgName: org_name, Doctor: doctor, } businessParams := models.BusinessParams{ PsnNo: psnNo, MdtrtId: mdtrtId, SetlId: setlId, } var result string if mdtrtarea_admvs == "421182" || mdtrtarea_admvs == "420902"{ result = service.Hbyb5203(baseParams, businessParams,med_type) }else{ result = service.Hbyb5203aa(baseParams, businessParams) } var dat map[string]interface{} if err := json.Unmarshal([]byte(result), &dat); err == nil { fmt.Println(dat) } else { fmt.Println(err) } c.ServeSuccessJSON(map[string]interface{}{ "pre": dat, }) } func saveJsLog(result string, request string, infno string, desc string, org_name string) { //org_id, _ := beego.AppConfig.Int64("org_id") //miConfig, _ := service.FindMedicalInsuranceInfo(org_id) dir := org_name + "日志" utils.Mkdir(dir) month := time.Unix(1557042972, 0).Format("1") year := time.Now().Format("2006") month = time.Now().Format("01") day := time.Now().Format("02") hour := time.Now().Format("15") min := time.Now().Format("04") sec := time.Now().Format("05") result_time := year + "-" + month + "-" + day + " " + hour + ":" + min + ":" + sec file := org_name + "_" + year + month + day + "_log" file_name := file + ".txt" file_path := org_name + "日志" + "/" + file_name exist, _ := utils.PathExists(file_path) if exist { //存在 fmt.Println("存在") f, err := os.OpenFile(file_path, os.O_WRONLY, 0644) if err != nil { fmt.Println("read fail") } content := "\r\n" + "\r\n" + "\r\n" + result_time + " " + "【 " + desc + infno + "入参" + " 】:" + "\r\n" + request + "\r\n" + result_time + " " + "【 " + desc + infno + "出参" + " 】:" + "\r\n" + result n, _ := f.Seek(0, 2) _, err = f.WriteAt([]byte(content), n) } else { //不存在 fmt.Println("文件不存在,创建文件") f, err := os.Create(org_name + "日志" + "/" + file_name) defer f.Close() if err != nil { } else { _, err = f.Write([]byte("记录日志")) } } }