package sg import ( "encoding/json" "fmt" "gdyb/controllers" "gdyb/models" "gdyb/service" "gdyb/utils" "github.com/astaxie/beego" "io/ioutil" ) type GdybController struct { controllers.BaseAuthAPIController } func GdybRegistRouters() { beego.Router("/gdyb/one", &GdybController{}, "get:PostOne") beego.Router("/gdyb/two", &GdybController{}, "get:PostTwo") beego.Router("/gdyb/three", &GdybController{}, "get:PostThree") //beego.Router("/gdyb/four", &GdybController{}, "get:PostFour") //beego.Router("/gdyb/five", &GdybController{}, "post:PostFive") beego.Router("/gdyb/six", &GdybController{}, "get:PostSix") //beego.Router("/gdyb/seven", &GdybController{}, "get:PostSeven") beego.Router("/gdyb/eight", &GdybController{}, "get:PostEight") //beego.Router("/gdyb/nine", &GdybController{}, "get:PostNine") beego.Router("/gdyb/ten", &GdybController{}, "get:PostTen") beego.Router("/gdyb/eleven", &GdybController{}, "get:PostEleven") beego.Router("/gdyb/twelve", &GdybController{}, "get:PostTwelve") beego.Router("/gdyb/zh/five", &GdybController{}, "post:PostZHFive") } type Result struct { ErrMsg interface{} `json:"err_msg"` InfRefmsgid string `json:"inf_refmsgid"` Infcode int64 `json:"infcode"` Output struct { Baseinfo struct { Age float64 `json:"age"` Brdy string `json:"brdy"` Certno string `json:"certno"` Gend string `json:"gend"` Naty string `json:"naty"` PsnCertType string `json:"psn_cert_type"` PsnName string `json:"psn_name"` PsnNo string `json:"psn_no"` } `json:"baseinfo"` Idetinfo []interface{} `json:"idetinfo"` Iinfo []struct { Balc int64 `json:"balc"` CvlservFlag string `json:"cvlserv_flag"` EmpName string `json:"emp_name"` InsuplcAdmdvs string `json:"insuplc_admdvs"` Insutype string `json:"insutype"` PausInsuDansuplcAdmdvs string `json:"paus_insu_dansuplc_admdvs"` PausInsuDate interface{} `json:"paus_insu_date"` PsnInsuDate string `json:"psn_insu_date"` PsnInsuStas string `json:"psn_insu_stas"` PsnType string `json:"psn_type"` } `json:"iinfo"` } `json:"output"` RefmsgTime string `json:"refmsg_time"` RespondTime string `json:"respond_time"` Signtype interface{} `json:"signtype"` WarnInfo interface{} `json:"warn_info"` } func (c *GdybController) 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") psn_name := c.GetString("name") result, inputLog := service.Gdyb1101(certNo, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, secret_key, id_card_type, card_sn, certificates, psn_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(inputLog), &dat2); err == nil { } else { } c.ServeSuccessJSON(map[string]interface{}{ "pre": dat, "log": dat2, }) } func (c *GdybController) 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") dept_code := c.GetString("dept_code") doctor_id := c.GetString("doctor_id") 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.Gdyb2201(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, "") var dat map[string]interface{} if err := json.Unmarshal([]byte(result), &dat); err == nil { } else { } c.ServeSuccessJSON(map[string]interface{}{ "pre": dat, }) } func (c *GdybController) 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.Gdyb2202(psnNo, mdtrtId, iptOtpNo, org_name, doctor, insuplc_admdvs, mdtrtarea_admvs, secret_key, fixmedins_code) saveLog(result, requestLog, "2202", "退号") var dat map[string]interface{} if err := json.Unmarshal([]byte(result), &dat); err == nil { } else { } c.ServeSuccessJSON(map[string]interface{}{ "pre": dat, }) } //func (c *GdybController) PostFour() { // psnNo := c.GetString("psn_no") // mdtrtId := c.GetString("mdtrt_id") // doctor := c.GetString("doctor") // department := c.GetString("department") // diag := c.GetString("diag") // org_name := c.GetString("org_name") // med_type := c.GetString("med_type") // doctor_id, _ := c.GetInt64("doctor_id", 0) // fixmedins_code := c.GetString("fixmedins_code") // diag_code := c.GetString("diag_code") // sick_code := c.GetString("sick_code") // sick_name := c.GetString("sick_name") // dept := c.GetString("dept") // // insuplc_admdvs := c.GetString("insuplc_admdvs") // mdtrtarea_admvs := c.GetString("mdtrtarea_admvs") // secret_key := c.GetString("secret_key") // // var result string // if insuplc_admdvs == "440781" { // // result = service.Gdyb2203A(psnNo, mdtrtId, doctor, department, diag, org_name, med_type, doctor_id, fixmedins_code, diag_code, insuplc_admdvs, mdtrtarea_admvs, secret_key, sick_code, sick_name, dept) // } else { // result = service.Gdyb2203(psnNo, mdtrtId, doctor, department, diag, org_name, med_type, doctor_id, fixmedins_code, diag_code, insuplc_admdvs, mdtrtarea_admvs, secret_key, sick_code, sick_name, dept) // } // 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 *GdybController) 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["dept"].(string)) // // fmt.Println(respJSON["fixmedins_code"].(string)) // fmt.Println(respJSON["dept_code"].(string)) // fmt.Println(respJSON["doctor_id"].(string)) // // fmt.Println(respJSON["insuplc_admdvs"].(string)) // fmt.Println(respJSON["mdtrtarea_admvs"].(string)) // fmt.Println(respJSON["secret_key"].(string)) // // result, requestLog := service.Gdyb2204(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)) // // 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 *GdybController) 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.Gdyb2205(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": result, }) } //func (c *GdybController) 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") // // //result := service.Gdyb2206(psnNo/**/, mdtrtId, chrgBchno, certNo, insutype, total, org_name, doctor, secret_key) // // result := service.Gdyb2206(psnNo, mdtrtId, chrgBchno, certNo, insutype, total, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, secret_key, med_type, id_card_type) // // 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 *GdybController) 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") 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") result, srcRequest := service.Gdyb2207(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, 1, "0", "") 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 *GdybController) 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.Gdyb2208(psnNo, mdtrtId, setlId, org_name, doctor, secret_key, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs) // //} func (c *GdybController) PostTen() { fmt.Println("11222333-----") insutype := c.GetString("insutype") clrType := c.GetString("clr_type") setlOptins := c.GetString("setl_optins") stmtBegndate := c.GetString("stmt_begndate") stmtEnddate := c.GetString("stm_enddate") medfeeSumamt, _ := c.GetFloat("medfee_sumamt", 0) fundPaySumamt, _ := c.GetFloat("fund_pay_sumamt", 0) acctPay, _ := c.GetFloat("acct_pay", 0) fixmedinsSetlCnt, _ := c.GetInt64("fixmedins_setl_cnt", 0) 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") doctor := c.GetString("doctor") fmt.Println(insutype) fmt.Println(clrType) fmt.Println(setlOptins) fmt.Println(stmtBegndate) fmt.Println(stmtEnddate) fmt.Println(medfeeSumamt) baseParams := models.BaseParams{ SecretKey: secret_key, FixmedinsCode: fixmedins_code, InsuplcAdmdvs: insuplc_admdvs, MdtrtareaAdmvs: mdtrtarea_admvs, OrgName: org_name, Doctor: doctor, } businessParams := models.BusinessParams{ Insutype: insutype, ClrType: clrType, SetlOptins: setlOptins, StmtBegndate: stmtBegndate, StmtEnddate: stmtEnddate, MedfeeSumamt: medfeeSumamt, FundPaySumamt: fundPaySumamt, AcctPay: acctPay, FixmedinsSetlCnt: fixmedinsSetlCnt, } fmt.Println(baseParams) fmt.Println(businessParams) result := service.Gdyb3201(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 (c *GdybController) PostEleven() { //fmt.Println("777777666666-----") // //file_byte := c.GetString("file_byte") //file_name := c.GetString("file_name") //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") //doctor := c.GetString("doctor") // //baseParams := models.BaseParams{ // SecretKey: secret_key, // FixmedinsCode: fixmedins_code, // InsuplcAdmdvs: insuplc_admdvs, // MdtrtareaAdmvs: mdtrtarea_admvs, // OrgName: org_name, // Doctor: doctor, //} //x := (*[2]uintptr)(unsafe.Pointer(&file_byte)) //h := [3]uintptr{x[0], x[1], x[1]} //bytes := *(*[]byte)(unsafe.Pointer(&h)) //result := service.Gdyb9101(baseParams, file_name, []byte(file_byte)) //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 *GdybController) PostTwelve() { fileQuryNo := c.GetString("file_qury_no") setlOptins := c.GetString("setl_optins") stmtBegndate := c.GetString("stmt_begndate") stmtEnddate := c.GetString("stm_enddate") medfeeSumamt, _ := c.GetFloat("medfee_sumamt", 0) fundPaySumamt, _ := c.GetFloat("fund_pay_sumamt", 0) fixmedinsSetlCnt, _ := c.GetInt64("fixmedins_setl_cnt", 0) 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") doctor := c.GetString("doctor") cashPayamt, _ := c.GetFloat("cash_payamt", 0) baseParams := models.BaseParams{ SecretKey: secret_key, FixmedinsCode: fixmedins_code, InsuplcAdmdvs: insuplc_admdvs, MdtrtareaAdmvs: mdtrtarea_admvs, OrgName: org_name, Doctor: doctor, } businessParams := models.BusinessParams{ FileQuryNo: fileQuryNo, SetlOptins: setlOptins, StmtBegndate: stmtBegndate, StmtEnddate: stmtEnddate, MedfeeSumamt: medfeeSumamt, FundPaySumamt: fundPaySumamt, FixmedinsSetlCnt: fixmedinsSetlCnt, CashPayamt: cashPayamt, } result := service.Gdyb3202(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 (c *GdybController) PostZHFive() { 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.NewCustom 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["dept"].(string)) fmt.Println(respJSON["fixmedins_code"].(string)) fmt.Println(respJSON["dept_code"].(string)) fmt.Println(respJSON["doctor_id"].(string)) fmt.Println(respJSON["insuplc_admdvs"].(string)) fmt.Println(respJSON["mdtrtarea_admvs"].(string)) fmt.Println(respJSON["secret_key"].(string)) //result := service.ZHGdyb2301(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["med_type"].(string)) //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": "", }) }