package service import ( "bytes" "encoding/json" "fmt" "gdyb/models" "github.com/astaxie/beego" "io/ioutil" "net/http" "strconv" "strings" "time" ) // 门诊挂号 func Nmyb2201(psnNo string, insutype string, certNo string, org_name string, opera string, ipt_otp_no string, dept string, fixmedins_code string, dept_code string, doctor_id string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, id_card_type int64, doctor_name string, verify_number string, cainfo string) (string, string) { // 生成签名 // 生成签名 nonce := GetRandomString(32) timestamp := time.Now().Unix() signature := setSignature(timestamp, nonce, secret_key) tempTime := time.Unix(timestamp, 0) timeFormatOne := tempTime.Format("2006-01-02 15:04:05") inputMessage := SetInputMessage(nonce, timestamp, org_name, opera, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs) // 生成输入报文 //inputMessage := SetInputMessage(timestamp, org_name, opera, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, cainfo) input := make(map[string]interface{}) inputData := make(map[string]interface{}) inputMessage["infno"] = "2201" // 交易编码 inputData["psn_no"] = psnNo // 人员编号 (来自1101接口返回) inputData["insutype"] = insutype // 险种类型(来自1101接口返回) inputData["begntime"] = timeFormatOne // 开始时间 if id_card_type == 1 { inputData["mdtrt_cert_type"] = "03" // 就诊凭证类型 inputData["mdtrt_cert_no"] = verify_number // 就诊凭证编号 } else if id_card_type == 3 { inputData["mdtrt_cert_type"] = "04" // 就诊凭证类型 inputData["mdtrt_cert_no"] = verify_number // 就诊凭证编号 } else if id_card_type == 4 { inputData["mdtrt_cert_type"] = "01" // 就诊凭证类型 inputData["mdtrt_cert_no"] = verify_number // 就诊凭证编号 } else { inputData["mdtrt_cert_type"] = "02" // 就诊凭证类型 inputData["mdtrt_cert_no"] = certNo // 就诊凭证编号 } inputData["ipt_otp_no"] = ipt_otp_no // 住院/门诊号 inputData["atddr_no"] = doctor_id // 医师编码 inputData["dr_name"] = doctor_name // 医师姓名 inputData["dept_code"] = dept_code // 科室编码 inputData["dept_name"] = dept // 科室名称 inputData["caty"] = "A03.06" // 科别 inputData["exp_content"] = "" // input["data"] = inputData inputMessage["input"] = input //交易输入 var requestLog string bytesData, err := json.Marshal(inputMessage) requestLog = string(bytesData) fmt.Println(string(bytesData)) if err != nil { fmt.Println(err.Error()) return err.Error(), "" } reader := bytes.NewReader(bytesData) gdyb_url := beego.AppConfig.String("gdyb_url") gdyb_paasid := beego.AppConfig.String("gdyb_paasid") request, err := http.NewRequest("POST", gdyb_url, reader) if err != nil { fmt.Println(err.Error()) return err.Error(), "" } request.Header.Set("Content-Type", "application/json;charset=UTF-8") request.Header.Set("x-tif-paasid", gdyb_paasid) request.Header.Set("x-tif-signature", signature) request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10)) request.Header.Set("x-tif-nonce", nonce) client := http.Client{} resp, err := client.Do(request) if err != nil { fmt.Println(err.Error()) return err.Error(), "" } respBytes, err := ioutil.ReadAll(resp.Body) if err != nil { fmt.Println(err.Error()) return err.Error(), "" } str := string(respBytes) fmt.Println(str) return str, requestLog } // 门诊挂号撤销 func Nmyb2202(psnNo string, mdtrtId string, ipt_otp_no string, org_name string, doctor string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, fixmedins_code string, cainfo string) (string, string) { // 生成签名 // 生成签名 nonce := GetRandomString(32) timestamp := time.Now().Unix() signature := setSignature(timestamp, nonce, secret_key) // 生成输入报文 inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs) //inputMessage := SetInputMessage(timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, cainfo) input := make(map[string]interface{}) inputData := make(map[string]interface{}) inputMessage["infno"] = "2202" // 交易编码 inputData["psn_no"] = psnNo // 人员编号 (来自1101接口返回) inputData["mdtrt_id"] = mdtrtId // 就诊 ID(来自2201接口返回) inputData["ipt_otp_no"] = ipt_otp_no // 住院/门诊号 inputData["exp_content"] = "" // input["data"] = inputData inputMessage["input"] = input //交易输入 var requestLog string bytesData, err := json.Marshal(inputMessage) fmt.Println(string(bytesData)) requestLog = string(bytesData) if err != nil { fmt.Println(err.Error()) return err.Error(), "" } reader := bytes.NewReader(bytesData) gdyb_url := beego.AppConfig.String("gdyb_url") gdyb_paasid := beego.AppConfig.String("gdyb_paasid") request, err := http.NewRequest("POST", gdyb_url, reader) if err != nil { fmt.Println(err.Error()) return err.Error(), "" } request.Header.Set("Content-Type", "application/json;charset=UTF-8") request.Header.Set("x-tif-paasid", gdyb_paasid) request.Header.Set("x-tif-signature", signature) request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10)) request.Header.Set("x-tif-nonce", nonce) client := http.Client{} resp, err := client.Do(request) if err != nil { fmt.Println(err.Error()) return err.Error(), "" } respBytes, err := ioutil.ReadAll(resp.Body) if err != nil { fmt.Println(err.Error()) return err.Error(), "" } str := string(respBytes) fmt.Println(str) return str, requestLog } // 门诊就诊信息上传 func Nmyb2203(psnNo string, mdtrtId string, doctor string, department string, org_name string, med_type string, doctor_id string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, sick_code string, sick_name string, dept string, config []*models.HisXtDiagnoseConfig, begin_time string, cainfo string) (string, string) { // 生成签名 // 生成签名 nonce := GetRandomString(32) timestamp := time.Now().Unix() signature := setSignature(timestamp, nonce, secret_key) //tempTime := time.Unix(timestamp, 0) //timeFormatOne := tempTime.Format("2006-01-02 15:04:05") // 生成输入报文 tempTime := time.Unix(timestamp, 0) timeFormatOne := tempTime.Format("2006-01-02 15:04:05") // 生成输入报文 inputMessage := SetJSInputMessage(timestamp, org_name, dept, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, cainfo) input := make(map[string]interface{}) inputData := make(map[string]interface{}) diseinfo := make([]map[string]interface{}, 0) if med_type == "1111" || med_type == "1112" { med_type = "11" } inputMessage["infno"] = "2203A" // 交易编码 inputData["mdtrt_id"] = mdtrtId // 就诊 ID(来自2201接口返回) inputData["psn_no"] = psnNo // 人员编号 (来自1101接口返回) inputData["med_type"] = med_type // 医疗类别 16门诊特殊病 inputData["begntime"] = begin_time // 开始时间 inputData["main_cond_dscr"] = "" // 主要病情描述 inputData["dise_codg"] = sick_code // 病种编码 inputData["dise_name"] = sick_name // 病种名称 inputData["birctrl_type"] = "" // 计划生育手术类别 inputData["birctrl_matn_date"] = "" // 计划生育手术或生育日期 for index, item := range config { diseinfo_sun := make(map[string]interface{}) diseinfo_sun["diag_type"] = "1" // 诊断类别 diseinfo_sun["diag_srt_no"] = index // 诊断排序号 diseinfo_sun["diag_code"] = item.CountryCode // 诊断代码 diseinfo_sun["diag_name"] = item.ClassName // 诊断名称 diseinfo_sun["diag_dept"] = department // 诊断科室 diseinfo_sun["dise_dor_no"] = doctor_id // 诊断医生编码 diseinfo_sun["dise_dor_name"] = doctor // 诊断医生姓名 diseinfo_sun["diag_time"] = timeFormatOne // 诊断时间 diseinfo_sun["vali_flag"] = "1" // 有效标志 diseinfo = append(diseinfo, diseinfo_sun) } //inputData["exp_content"] = "" // 人员编号 (来自1101接口返回) inputData["exp_content"] = "" // input["diseinfo"] = diseinfo input["mdtrtinfo"] = inputData inputMessage["input"] = input //交易输入 var requestLog string bytesData, err := json.Marshal(inputMessage) fmt.Println(string(bytesData)) requestLog = string(bytesData) if err != nil { fmt.Println(err.Error()) return err.Error(), "" } reader := bytes.NewReader(bytesData) gdyb_url := beego.AppConfig.String("gdyb_url") gdyb_paasid := beego.AppConfig.String("gdyb_paasid") request, err := http.NewRequest("POST", gdyb_url, reader) if err != nil { fmt.Println(err.Error()) return err.Error(), "" } request.Header.Set("Content-Type", "application/json;charset=UTF-8") request.Header.Set("x-tif-paasid", gdyb_paasid) request.Header.Set("x-tif-signature", signature) request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10)) request.Header.Set("x-tif-nonce", nonce) client := http.Client{} resp, err := client.Do(request) if err != nil { fmt.Println(err.Error()) return err.Error(), "" } respBytes, err := ioutil.ReadAll(resp.Body) if err != nil { fmt.Println(err.Error()) return err.Error(), "" } str := string(respBytes) fmt.Println(str) return str, requestLog } func Nmyb2203C(psnNo string, mdtrtId string, doctor string, department string, org_name string, med_type string, doctor_id string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, sick_code string, sick_name string, dept string, config []*models.HisXtDiagnoseConfig, begin_time string, cainfo string) (string, string) { // 生成签名 // 生成签名 nonce := GetRandomString(32) timestamp := time.Now().Unix() signature := setSignature(timestamp, nonce, secret_key) //tempTime := time.Unix(timestamp, 0) //timeFormatOne := tempTime.Format("2006-01-02 15:04:05") // 生成输入报文 tempTime := time.Unix(timestamp, 0) timeFormatOne := tempTime.Format("2006-01-02 15:04:05") // 生成输入报文 inputMessage := SetJSInputMessage(timestamp, org_name, dept, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, cainfo) input := make(map[string]interface{}) inputData := make(map[string]interface{}) diseinfo := make([]map[string]interface{}, 0) if med_type == "1111" || med_type == "1112" { med_type = "11" } inputMessage["infno"] = "2203A" // 交易编码 inputData["mdtrt_id"] = mdtrtId // 就诊 ID(来自2201接口返回) inputData["psn_no"] = psnNo // 人员编号 (来自1101接口返回) inputData["med_type"] = med_type // 医疗类别 16门诊特殊病 inputData["begntime"] = begin_time // 开始时间 inputData["main_cond_dscr"] = "" // 主要病情描述 inputData["dise_codg"] = sick_code // 病种编码 inputData["dise_name"] = sick_name // 病种名称 inputData["birctrl_type"] = "" // 计划生育手术类别 inputData["birctrl_matn_date"] = "" // 计划生育手术或生育日期 for index, item := range config { diseinfo_sun := make(map[string]interface{}) diseinfo_sun["diag_type"] = "1" // 诊断类别 diseinfo_sun["diag_srt_no"] = index // 诊断排序号 diseinfo_sun["diag_code"] = item.CountryCode // 诊断代码 diseinfo_sun["diag_name"] = item.ClassName // 诊断名称 diseinfo_sun["diag_dept"] = department // 诊断科室 diseinfo_sun["dise_dor_no"] = doctor_id // 诊断医生编码 diseinfo_sun["dise_dor_name"] = doctor // 诊断医生姓名 diseinfo_sun["diag_time"] = timeFormatOne // 诊断时间 diseinfo_sun["vali_flag"] = "0" // 有效标志 diseinfo = append(diseinfo, diseinfo_sun) } //inputData["exp_content"] = "" // 人员编号 (来自1101接口返回) inputData["exp_content"] = "" // input["diseinfo"] = diseinfo input["mdtrtinfo"] = inputData inputMessage["input"] = input //交易输入 var requestLog string bytesData, err := json.Marshal(inputMessage) fmt.Println(string(bytesData)) requestLog = string(bytesData) if err != nil { fmt.Println(err.Error()) return err.Error(), "" } reader := bytes.NewReader(bytesData) gdyb_url := beego.AppConfig.String("gdyb_url") gdyb_paasid := beego.AppConfig.String("gdyb_paasid") request, err := http.NewRequest("POST", gdyb_url, reader) if err != nil { fmt.Println(err.Error()) return err.Error(), "" } request.Header.Set("Content-Type", "application/json;charset=UTF-8") request.Header.Set("x-tif-paasid", gdyb_paasid) request.Header.Set("x-tif-signature", signature) request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10)) request.Header.Set("x-tif-nonce", nonce) client := http.Client{} resp, err := client.Do(request) if err != nil { fmt.Println(err.Error()) return err.Error(), "" } respBytes, err := ioutil.ReadAll(resp.Body) if err != nil { fmt.Println(err.Error()) return err.Error(), "" } str := string(respBytes) fmt.Println(str) return str, requestLog } // 门诊费用明细信息上传 func Nmyb2204(psnNo string, mdtrtId string, hisPrescription []*models.HisPrescription, chrg_bchno string, org_name string, doctor string, dept string, fixmedins_code string, dept_code string, doctor_id string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, balance_accounts_type string, diag_code string, request_url string, access_key string, new_doctor_name string, time_stamp_2203 string, cainfo string) (string, string) { // 生成签名 timestamp := time.Now().Unix() // 生成签名 nonce := GetRandomString(32) signature := setSignature(timestamp, nonce, secret_key) var customs []*Custom for _, item := range hisPrescription { tm := time.Now() if item.Type == 1 { //药品 for _, subItem := range item.HisDoctorAdviceInfo { if len(subItem.BaseDrugLib.MedicalInsuranceNumber) > 0 { //var randNum int //randNum = rand.Intn(10000) + 1000 cus := &Custom{ DetItemFeeSumamt: fmt.Sprintf("%.4f", subItem.Price*subItem.PrescribingNumber), Cut: fmt.Sprintf("%.4f", subItem.PrescribingNumber), FeedetlSn: subItem.FeedetlSn, Price: fmt.Sprintf("%.4f", subItem.Price), MedListCodg: subItem.BaseDrugLib.MedicalInsuranceNumber, HospApprFlag: subItem.HospApprFlag, DoctorNumber: doctor_id, DoctorName: new_doctor_name, ProvinceDrugMedListCodg: "", ProvinceGoodMedListCodg: "", FeeOcurTime: tm.Format("2006-01-02 15:04:05"), } if subItem.BaseDrugLib.DrugClassify == "2" { cus.ProvinceDrugMedListCodg = subItem.BaseDrugLib.ProvincesCode } customs = append(customs, cus) } } } if item.Type == 2 { //项目 for _, subItem := range item.HisPrescriptionProject { //var randNum int //randNum = rand.Intn(10000) + 1000 if subItem.Type == 2 { if len(subItem.HisProject.MedicalCode) > 0 { cnt, _ := strconv.ParseFloat(subItem.Count, 64) cus := &Custom{ DetItemFeeSumamt: fmt.Sprintf("%.4f", subItem.Price*cnt), Cut: fmt.Sprintf("%.4f", cnt), FeedetlSn: subItem.FeedetlSn, Price: fmt.Sprintf("%.4f", float64(subItem.Price)), MedListCodg: subItem.HisProject.MedicalCode, DoctorNumber: doctor_id, DoctorName: new_doctor_name, HospApprFlag: -1, ProvinceDrugMedListCodg: "", ProvinceGoodMedListCodg: "", FeeOcurTime: tm.Format("2006-01-02 15:04:05"), } customs = append(customs, cus) } } else if subItem.Type == 3 { if len(subItem.GoodInfo.MedicalInsuranceNumber) > 0 { cnt, _ := strconv.ParseFloat(subItem.Count, 64) cus := &Custom{ DetItemFeeSumamt: fmt.Sprintf("%.4f", subItem.Price*cnt), Cut: fmt.Sprintf("%.4f", cnt), FeedetlSn: subItem.FeedetlSn, Price: fmt.Sprintf("%.4f", float64(subItem.Price)), MedListCodg: subItem.GoodInfo.MedicalInsuranceNumber, HospApprFlag: -1, DoctorNumber: doctor_id, DoctorName: new_doctor_name, ProvinceDrugMedListCodg: "", ProvinceGoodMedListCodg: subItem.GoodInfo.ProvincesCode, FeeOcurTime: tm.Format("2006-01-02 15:04:05"), } customs = append(customs, cus) } } } } for _, subItem := range item.HisAdditionalCharge { if len(subItem.XtHisAddtionConfig.Code) > 0 { cus := &Custom{ DetItemFeeSumamt: fmt.Sprintf("%.4f", subItem.Price*float64(subItem.Count)), Cut: fmt.Sprintf("%.4f", float64(subItem.Count)), FeedetlSn: subItem.FeedetlSn, Price: fmt.Sprintf("%.4f", float64(subItem.Price)), MedListCodg: subItem.XtHisAddtionConfig.Code, HospApprFlag: -1, DoctorNumber: doctor_id, DoctorName: new_doctor_name, } customs = append(customs, cus) } } } // 生成输入报文 inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs) input := make(map[string]interface{}) feedetail := make([]map[string]interface{}, 0) inputMessage["infno"] = "2204" // 交易编码 //chrg_bchno := timeFormat + strconv.FormatInt(int64(chrgBchno), 10) for _, item := range customs { feedetailInfo := make(map[string]interface{}) subfeedetailInfo := make(map[string]interface{}) feedetailInfo["feedetl_sn"] = item.FeedetlSn feedetailInfo["mdtrt_id"] = mdtrtId // 就诊 ID(来自2201接口返回) feedetailInfo["psn_no"] = psnNo // 人员编号 (来自1101接口返回) feedetailInfo["chrg_bchno"] = chrg_bchno // 收费批次号 feedetailInfo["dise_codg"] = diag_code // 病种编码 feedetailInfo["rxno"] = "" // 处方号 feedetailInfo["rx_circ_flag"] = "0" // 外购处方标志 feedetailInfo["fee_ocur_time"] = item.FeeOcurTime // 费用发生时间 feedetailInfo["med_list_codg"] = item.MedListCodg // 医疗目录编码 feedetailInfo["medins_list_codg"] = fixmedins_code // 医药机构目录编码 feedetailInfo["det_item_fee_sumamt"] = item.DetItemFeeSumamt // 明细项目费用总额 feedetailInfo["cnt"] = item.Cut // 数量 feedetailInfo["pric"] = item.Price // 单价 feedetailInfo["sin_dos_dscr"] = "" // 单次剂量描述 feedetailInfo["used_frqu_dscr"] = "" // 使用频次描述 feedetailInfo["prd_days"] = "0" // 周期天数 feedetailInfo["medc_way_dscr"] = "" // 用药途径描述 feedetailInfo["bilg_dept_codg"] = dept_code // 开单科室编码 feedetailInfo["bilg_dept_name"] = dept // 开单科室名称 feedetailInfo["bilg_dr_codg"] = doctor_id // 开单医生编码 feedetailInfo["bilg_dr_name"] = new_doctor_name // 开单医师姓名 feedetailInfo["acord_dept_codg"] = dept_code // 受单科室编码 feedetailInfo["acord_dept_name"] = dept // 受单科室名称 feedetailInfo["orders_dr_code"] = doctor_id // 受单医生编码 feedetailInfo["orders_dr_name"] = new_doctor_name // 受单医生姓名 if balance_accounts_type == "8" { feedetailInfo["hosp_appr_flag"] = "2" // 医院审批标志 } else { if item.HospApprFlag != -1 { if item.HospApprFlag == 1 { feedetailInfo["hosp_appr_flag"] = "1" // 医院审批标志 } else if item.HospApprFlag == 2 { feedetailInfo["hosp_appr_flag"] = "2" // 医院审批标志 } else if item.HospApprFlag == 3 { feedetailInfo["hosp_appr_flag"] = "0" // 医院审批标志 } else { feedetailInfo["hosp_appr_flag"] = "1" // 医院审批标志 } } else { feedetailInfo["hosp_appr_flag"] = "1" // 医院审批标志 } } feedetailInfo["tcmdrug_used_way"] = "" // 中药使用方式 feedetailInfo["etip_flag"] = "" // 外检标志 feedetailInfo["etip_hosp_code"] = "" // 外检医院编码 feedetailInfo["dscg_tkdrug_flag"] = "" // 出院带药标志 feedetailInfo["matn_fee_flag"] = "" // 生育费用标志 subfeedetailInfo["tcmherb_prov_code"] = item.ProvinceDrugMedListCodg subfeedetailInfo["mcs_prov_code"] = item.ProvinceGoodMedListCodg feedetailInfo["exp_content"] = subfeedetailInfo feedetail = append(feedetail, feedetailInfo) } input["feedetail"] = feedetail inputMessage["input"] = input //交易输入 var requestLog string bytesData, err := json.Marshal(inputMessage) requestLog = string(bytesData) fmt.Println(string(bytesData)) if err != nil { fmt.Println(err.Error()) return "", "" } reader := bytes.NewReader(bytesData) gdyb_url := beego.AppConfig.String("gdyb_url") gdyb_paasid := beego.AppConfig.String("gdyb_paasid") request, err := http.NewRequest("POST", gdyb_url, reader) if err != nil { fmt.Println(err.Error()) return "", "" } request.Header.Set("Content-Type", "application/json;charset=UTF-8") request.Header.Set("x-tif-paasid", gdyb_paasid) request.Header.Set("x-tif-signature", signature) request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10)) request.Header.Set("x-tif-nonce", nonce) client := http.Client{} resp, err := client.Do(request) if err != nil { fmt.Println(err.Error()) return "", "" } respBytes, err := ioutil.ReadAll(resp.Body) if err != nil { fmt.Println(err.Error()) return "", "" } return string(respBytes), requestLog } // 门诊费用明细信息撤销 func Nmyb2205(psnNo string, mdtrtId string, chrgBchno string, org_name string, doctor string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, fixmedins_code string, request_url string, access_key string, cainfo string) (string, string) { // 生成签名 nonce := GetRandomString(32) timestamp := time.Now().Unix() signature := setSignature(timestamp, nonce, secret_key) inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs) input := make(map[string]interface{}) inputData := make(map[string]interface{}) inputMessage["infno"] = "2205" // 交易编码 inputData["mdtrt_id"] = mdtrtId // 就诊 ID(来自2201接口返回) inputData["chrg_bchno"] = "0000" // 收费批次号(来自2204生成的) inputData["psn_no"] = psnNo // 人员编号 (来自1101接口返回) inputData["exp_content"] = "" // 人员编号 (来自1101接口返回) input["data"] = inputData inputMessage["input"] = input //交易输入 bytesData, err := json.Marshal(inputMessage) fmt.Println(string(bytesData)) var requestLog string requestLog = string(bytesData) if err != nil { fmt.Println(err.Error()) return err.Error(), "" } reader := bytes.NewReader(bytesData) gdyb_url := beego.AppConfig.String("gdyb_url") gdyb_paasid := beego.AppConfig.String("gdyb_paasid") request, err := http.NewRequest("POST", gdyb_url, reader) fmt.Println(err) fmt.Println(request) if err != nil { fmt.Println(err.Error()) return err.Error(), "" } request.Header.Set("Content-Type", "application/json;charset=UTF-8") request.Header.Set("x-tif-paasid", gdyb_paasid) request.Header.Set("x-tif-signature", signature) request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10)) request.Header.Set("x-tif-nonce", nonce) client := http.Client{} resp, err := client.Do(request) if err != nil { fmt.Println(err.Error()) return err.Error(), "" } respBytes, err := ioutil.ReadAll(resp.Body) if err != nil { fmt.Println(err.Error()) return err.Error(), "" } str := string(respBytes) fmt.Println(str) return str, requestLog } // 门诊预结算 func Nmyb2206(psnNo string, mdtrtId string, chrgBchno string, certNo string, insutype string, total string, org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, med_type string, id_card_type int64, fulamt_ownpay_amt float64, overlmt_selfpay float64, preselfpay_amt float64, inscp_scp_amt float64, certificates int64, request_url string, access_key string, verify_number string, cainfo string, mdtrt_grp_type string) (string, string) { if !strings.Contains(insuplc_admdvs, "150") { chrgBchno = "0000" } // 生成签名 nonce := GetRandomString(32) timestamp := time.Now().Unix() signature := setSignature(timestamp, nonce, secret_key) // 生成输入报文 inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs) input := make(map[string]interface{}) inputData := make(map[string]interface{}) inputMessage["infno"] = "2206" // 交易编码 inputData["psn_no"] = psnNo // 人员编号 (来自1101接口返回) if certificates == 3 { inputData["mdtrt_cert_type"] = "99" // 就诊凭证类型 inputData["mdtrt_cert_no"] = certNo // 就诊凭证编号 } else { if id_card_type == 1 { inputData["mdtrt_cert_type"] = "03" // 就诊凭证类型 inputData["mdtrt_cert_no"] = verify_number // 就诊凭证编号 } else if id_card_type == 3 { inputData["mdtrt_cert_type"] = "04" // 就诊凭证类型 inputData["mdtrt_cert_no"] = verify_number // 就诊凭证编号 } else if id_card_type == 4 { inputData["mdtrt_cert_type"] = "01" // 就诊凭证类型 inputData["mdtrt_cert_no"] = verify_number // 就诊凭证编号 } else { inputData["mdtrt_cert_type"] = "02" // 就诊凭证类型 inputData["mdtrt_cert_no"] = certNo // 就诊凭证编号 } } if insuplc_admdvs == "421300" { if med_type == "11" || med_type == "1112" || med_type == "1111" { inputData["med_type"] = "110104" // 医疗类别 11 普通门诊 12 门诊挂号 } else if med_type == "14" { inputData["med_type"] = "140110" // 医疗类别 11 普通门诊 12 门诊挂号 } } else { inputData["med_type"] = med_type // 医疗类别 11 普通门诊 12 门诊挂号 } inputData["medfee_sumamt"] = total // 医疗费总额 inputData["psn_setlway"] = "01" // 个人结算方式 01 按项目结 02 按定额结算 inputData["mdtrt_id"] = mdtrtId // 就诊 ID(来自2201接口返回) inputData["chrg_bchno"] = chrgBchno // 收费批次号(来自2204生成的) inputData["acct_used_flag"] = "0" // 个人账户使用标志 0否 1是 inputData["insutype"] = insutype // 险种类型 inputData["invono"] = "" // 发票号 inputData2 := make(map[string]interface{}) inputData2["trum_flag"] = "" inputData2["rel_ttp_flag"] = "" inputData2["otp_er_refl_flag"] = "" inputData2["mdtrt_grp_type"] = mdtrt_grp_type inputData2["need_ipt_flag"] = "" inputData["exp_content"] = inputData2 input["data"] = inputData inputMessage["input"] = input //交易输入 var requestLog string bytesData, err := json.Marshal(inputMessage) requestLog = string(bytesData) fmt.Println(string(bytesData)) if err != nil { fmt.Println(err.Error()) return err.Error(), "" } reader := bytes.NewReader(bytesData) gdyb_url := beego.AppConfig.String("gdyb_url") gdyb_paasid := beego.AppConfig.String("gdyb_paasid") request, err := http.NewRequest("POST", gdyb_url, reader) if err != nil { fmt.Println(err.Error()) return err.Error(), "" } request.Header.Set("Content-Type", "application/json;charset=UTF-8") request.Header.Set("x-tif-paasid", gdyb_paasid) request.Header.Set("x-tif-signature", signature) request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10)) request.Header.Set("x-tif-nonce", nonce) client := http.Client{} resp, err := client.Do(request) if err != nil { fmt.Println(err.Error()) return err.Error(), "" } respBytes, err := ioutil.ReadAll(resp.Body) if err != nil { fmt.Println(err.Error()) return err.Error(), "" } str := string(respBytes) fmt.Println(str) return str, requestLog } // 门诊结算 func Nmyb2207(psnNo string, mdtrtId string, chrgBchno string, certNo string, insutype string, total string, org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, med_type string, id_card_type int64, fulamt_ownpay_amt float64, overlmt_selfpay float64, preselfpay_amt float64, inscp_scp_amt float64, certificates int64, acct_used_flag string, request_url string, access_key string, verify_number string, cainfo string, mdtrt_grp_type string) (string, string) { if !strings.Contains(insuplc_admdvs, "150") { chrgBchno = "0000" } // 生成签名 nonce := GetRandomString(32) timestamp := time.Now().Unix() signature := setSignature(timestamp, nonce, secret_key) inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs) input := make(map[string]interface{}) inputData := make(map[string]interface{}) inputMessage["infno"] = "2207" // 交易编码 inputData["psn_no"] = psnNo // 人员编号 (来自1101接口返回) if certificates == 3 { inputData["mdtrt_cert_type"] = "99" // 就诊凭证类型 inputData["mdtrt_cert_no"] = verify_number // 就诊凭证编号 } else { if id_card_type == 1 { inputData["mdtrt_cert_type"] = "03" // 就诊凭证类型 inputData["mdtrt_cert_no"] = verify_number // 就诊凭证编号 } else if id_card_type == 3 { inputData["mdtrt_cert_type"] = "04" // 就诊凭证类型 inputData["mdtrt_cert_no"] = verify_number // 就诊凭证编号 } else if id_card_type == 4 { inputData["mdtrt_cert_type"] = "01" // 就诊凭证类型 inputData["mdtrt_cert_no"] = verify_number // 就诊凭证编号 } else { inputData["mdtrt_cert_type"] = "02" // 就诊凭证类型 inputData["mdtrt_cert_no"] = certNo // 就诊凭证编号 } } if med_type == "1111" || med_type == "1112" { med_type = "11" } if insuplc_admdvs == "421300" { if med_type == "11" { inputData["med_type"] = "110104" // 医疗类别 11 普通门诊 12 门诊挂号 } else if med_type == "14" { inputData["med_type"] = "140101" // 医疗类别 11 普通门诊 12 门诊挂号 } } else { inputData["med_type"] = med_type // 医疗类别 11 普通门诊 12 门诊挂号 } inputData["medfee_sumamt"] = total // 医疗费总额 inputData["psn_setlway"] = "01" // 个人结算方式 01 按项目结 02 按定额结算 inputData["mdtrt_id"] = mdtrtId // 就诊 ID(来自2201接口返回) inputData["chrg_bchno"] = chrgBchno // 收费批次号(来自2204生成的) inputData["acct_used_flag"] = acct_used_flag // 个人账户使用标志 0否 1是 inputData["insutype"] = insutype // 险种类型 inputData["invono"] = "12345" // 发票号 inputData["fulamt_ownpay_amt"] = fulamt_ownpay_amt // inputData["overlmt_selfpay"] = overlmt_selfpay // inputData["preselfpay_amt"] = preselfpay_amt // inputData["inscp_scp_amt"] = inscp_scp_amt // inputData2 := make(map[string]interface{}) inputData2["trum_flag"] = "" inputData2["rel_ttp_flag"] = "" inputData2["otp_er_refl_flag"] = "" inputData2["mdtrt_grp_type"] = mdtrt_grp_type inputData2["need_ipt_flag"] = "" inputData["exp_content"] = inputData2 input["data"] = inputData inputMessage["input"] = input //交易输入 bytesData, err := json.Marshal(inputMessage) fmt.Println(string(bytesData)) if err != nil { fmt.Println(err.Error()) return err.Error(), "" } reader := bytes.NewReader(bytesData) gdyb_url := beego.AppConfig.String("gdyb_url") gdyb_paasid := beego.AppConfig.String("gdyb_paasid") request, err := http.NewRequest("POST", gdyb_url, reader) if err != nil { fmt.Println(err.Error()) return err.Error(), "" } request.Header.Set("Content-Type", "application/json;charset=UTF-8") request.Header.Set("x-tif-paasid", gdyb_paasid) request.Header.Set("x-tif-signature", signature) request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10)) request.Header.Set("x-tif-nonce", nonce) client := http.Client{} resp, err := client.Do(request) if err != nil { fmt.Println(err.Error()) return err.Error(), "" } respBytes, err := ioutil.ReadAll(resp.Body) if err != nil { fmt.Println(err.Error()) return err.Error(), "" } str := string(respBytes) fmt.Println(str) mjson, _ := json.Marshal(inputMessage) str2 := string(mjson) return str, str2 } // 门诊结算撤销 func Nmyb2208(psnNo string, mdtrtId string, setlId string, org_name string, doctor string, secret_key string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, request_url string, access_key string, cainfo string) (string, string) { // 生成签名 nonce := GetRandomString(32) timestamp := time.Now().Unix() signature := setSignature(timestamp, nonce, secret_key) // 生成输入报文 inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs) input := make(map[string]interface{}) inputData := make(map[string]interface{}) inputMessage["infno"] = "2208" // 交易编码 inputData["psn_no"] = psnNo // 人员编号 (来自1101接口返回) inputData["mdtrt_id"] = mdtrtId // 就诊 ID(来自2201接口返回) inputData["setl_id"] = setlId // 结算 ID inputData["exp_content"] = "" // 人员编号 (来自1101接口返回) input["data"] = inputData inputMessage["input"] = input //交易输入 bytesData, err := json.Marshal(inputMessage) fmt.Println(string(bytesData)) if err != nil { fmt.Println(err.Error()) return err.Error(), "" } reader := bytes.NewReader(bytesData) gdyb_url := beego.AppConfig.String("gdyb_url") gdyb_paasid := beego.AppConfig.String("gdyb_paasid") request, err := http.NewRequest("POST", gdyb_url, reader) if err != nil { fmt.Println(err.Error()) return err.Error(), "" } request.Header.Set("Content-Type", "application/json;charset=UTF-8") request.Header.Set("x-tif-paasid", gdyb_paasid) request.Header.Set("x-tif-signature", signature) request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10)) request.Header.Set("x-tif-nonce", nonce) client := http.Client{} resp, err := client.Do(request) if err != nil { fmt.Println(err.Error()) return err.Error(), "" } respBytes, err := ioutil.ReadAll(resp.Body) if err != nil { fmt.Println(err.Error()) return err.Error(), "" } str := string(respBytes) fmt.Println(str) mjson, _ := json.Marshal(inputMessage) str2 := string(mjson) return str, str2 } func Nmyb2503(psnNo string, insutype string, org_name string, op string, doctor string, fixmedins_code string, doctor_id string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, sick_name string, sick_code string, start_time string, end_time string, check_time string, hospital_code string, hospital_name string) string { // 生成签名 nonce := GetRandomString(32) timestamp := time.Now().Unix() signature := setSignature(timestamp, nonce, secret_key) //tempTime := time.Unix(timestamp, 0) //timeFormatOne := tempTime.Format("2006-01-02 15:04:05") //timeFormatTwo := tempTime.Format("2006-01-02") //t := time.Now() //last := time.Date(t.Year(), time.December, 31, 0, 0, 0, 0, time.UTC) //tm := time.Unix(last.Unix(), 0) // 生成输入报文 inputMessage := SetInputMessage(nonce, timestamp, org_name, op, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs) input := make(map[string]interface{}) inputData := make(map[string]interface{}) inputMessage["infno"] = "2503" // 交易编码 inputData["psn_no"] = psnNo // 人员编号 (来自1101接口返回) inputData["insutype"] = insutype // 险种类型(来自1101接口返回) inputData["opsp_dise_code"] = sick_code // 险种类型(来自1101接口返回) inputData["opsp_dise_name"] = sick_name // 险种类型(来自1101接口返回) inputData["insu_optins"] = insuplc_admdvs // 险种类型(来自1101接口返回) inputData["ide_fixmedins_no"] = hospital_code // 险种类型(来自1101接口返回) inputData["ide_fixmedins_name"] = hospital_name // 险种类型(来自1101接口返回) inputData["hosp_ide_date"] = check_time // 险种类型(来自1101接口返回) inputData["diag_dr_codg"] = doctor_id // 开始时间 inputData["diag_dr_name"] = doctor // 开始时间 inputData["begndate"] = start_time // 医师编码 inputData["tel"] = "" // 医师编码 inputData["addr"] = "" // 医师编码 inputData["enddate"] = end_time // 医师编码 input["data"] = inputData inputMessage["input"] = input //交易输入 bytesData, err := json.Marshal(inputMessage) fmt.Println(string(bytesData)) if err != nil { fmt.Println(err.Error()) return err.Error() } reader := bytes.NewReader(bytesData) //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/2503" //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/2503" gdyb_url := beego.AppConfig.String("gdyb_url") gdyb_paasid := beego.AppConfig.String("gdyb_paasid") //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/1101" //url := gdyb_url + "2503" var url string if fixmedins_code == "H15049901371" { url = gdyb_url } else { url = gdyb_url + "2503" } request, err := http.NewRequest("POST", url, reader) if err != nil { fmt.Println(err.Error()) return err.Error() } request.Header.Set("Content-Type", "application/json;charset=UTF-8") request.Header.Set("x-tif-paasid", gdyb_paasid) request.Header.Set("x-tif-signature", signature) request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10)) request.Header.Set("x-tif-nonce", nonce) client := http.Client{} resp, err := client.Do(request) if err != nil { fmt.Println(err.Error()) return err.Error() } respBytes, err := ioutil.ReadAll(resp.Body) if err != nil { fmt.Println(err.Error()) return err.Error() } str := string(respBytes) fmt.Println(str) return str } func NMyb3501(struct3501 models.Struct3501, secret_key string) (string, string) { // 生成签名 nonce := GetRandomString(32) timestamp := time.Now().Unix() signature := setSignature(timestamp, nonce, secret_key) // 生成输入报文 inputMessage := SetGdInputMessage(timestamp, struct3501.OrgName, struct3501.Opter, struct3501.FixmedinsHilistId, struct3501.InsuplcAdmdvs, struct3501.MdtrtareaAdmvs, struct3501.Cainfo) input := make(map[string]interface{}) inputData := make(map[string]interface{}) inputMessage["infno"] = "3501" // 交易编码 inputData["med_list_codg"] = struct3501.MedListCodg // 定点医药机构目录编号 inputData["fixmedins_hilist_id"] = struct3501.FixmedinsHilistId // 定点医药机构目录编号 inputData["fixmedins_hilist_name"] = struct3501.OrgName // 定点医药机构目录名称 inputData["rx_flag"] = struct3501.RxFlag // inputData["invdate"] = struct3501.Invdate // 人员编号 (来自1101接口返回) inputData["inv_cnt"] = struct3501.InvCnt // 人员编号 (来自1101接口返回) inputData["manu_lotnum"] = struct3501.ManuLotnum // 人员编号 (来自1101接口返回) inputData["fixmedins_bchno"] = struct3501.FixmedinsBchno // 人员编号 (来自1101接口返回) inputData["manu_date"] = struct3501.ManuDate // 人员编号 (来自1101接口返回) inputData["expy_end"] = struct3501.ExpyEnd // 人员编号 (来自1101接口返回) inputData["memo"] = "" // 人员编号 (来自1101接口返回) input["invinfo"] = inputData inputMessage["input"] = input //交易输入 bytesData, err := json.Marshal(inputMessage) fmt.Println(string(bytesData)) if err != nil { fmt.Println(err.Error()) return err.Error(),"" } reader := bytes.NewReader(bytesData) //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/5301" gdyb_url := beego.AppConfig.String("gdyb_url") gdyb_paasid := beego.AppConfig.String("gdyb_paasid") //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/1101" //url := gdyb_url + "3501" var url string url = gdyb_url request, err := http.NewRequest("POST", url, reader) if err != nil { fmt.Println(err.Error()) return err.Error(), "" } request.Header.Set("Content-Type", "application/json;charset=UTF-8") request.Header.Set("x-tif-paasid", gdyb_paasid) request.Header.Set("x-tif-signature", signature) request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10)) request.Header.Set("x-tif-nonce", nonce) client := http.Client{} resp, err := client.Do(request) if err != nil { fmt.Println(err.Error()) return err.Error(), "" } respBytes, err := ioutil.ReadAll(resp.Body) if err != nil { fmt.Println(err.Error()) return err.Error(), "" } str := string(respBytes) fmt.Println(str) return str, string(bytesData) } func NMyb3502(struct3502 models.Struct3502, secret_key string) (string, string) { // 生成签名 nonce := GetRandomString(32) timestamp := time.Now().Unix() signature := setSignature(timestamp, nonce, secret_key) // 生成输入报文 inputMessage := SetGdInputMessage(timestamp, struct3502.OrgName, struct3502.Opter, struct3502.FixmedinsCode, struct3502.InsuplcAdmdvs, struct3502.MdtrtareaAdmvs, struct3502.Cainfo) input := make(map[string]interface{}) inputData := make(map[string]interface{}) inputMessage["infno"] = "3502" // 交易编码 inputData["med_list_codg"] = struct3502.MedListCodg // 定点医药机构目录编号 inputData["inv_chg_type"] = struct3502.InvChgType // 定点医药机构目录编号 inputData["fixmedins_hilist_id"] = struct3502.FixmedinsCode // 定点医药机构目录编号 inputData["fixmedins_hilist_name"] = struct3502.FixmedinsHilistName // 定点医药机构目录名称 inputData["fixmedins_bchno"] = struct3502.FixmedinsBchno // 人员编号 (来自1101接口返回) inputData["pric"] = struct3502.Pric // 人员编号 (来自1101接口返回) inputData["cnt"] = struct3502.Cnt // 人员编号 (来自1101接口返回) inputData["rx_flag"] = struct3502.RxFlag // inputData["inv_chg_time"] = struct3502.InvChgTime // 人员编号 (来自1101接口返回) inputData["inv_chg_opter_name"] = "" // 人员编号 (来自1101接口返回) inputData["memo"] = struct3502.Memo // 人员编号 (来自1101接口返回) inputData["trdn_flag"] = "" // 人员编号 (来自1101接口返回) input["invinfo"] = inputData inputMessage["input"] = input //交易输入 bytesData, err := json.Marshal(inputMessage) fmt.Println(string(bytesData)) if err != nil { fmt.Println(err.Error()) return err.Error(),"" } reader := bytes.NewReader(bytesData) //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/5301" gdyb_url := beego.AppConfig.String("gdyb_url") gdyb_paasid := beego.AppConfig.String("gdyb_paasid") //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/1101" var url string url = gdyb_url request, err := http.NewRequest("POST", url, reader) if err != nil { fmt.Println(err.Error()) return err.Error(),"" } request.Header.Set("Content-Type", "application/json;charset=UTF-8") request.Header.Set("x-tif-paasid", gdyb_paasid) request.Header.Set("x-tif-signature", signature) request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10)) request.Header.Set("x-tif-nonce", nonce) client := http.Client{} resp, err := client.Do(request) if err != nil { fmt.Println(err.Error()) return err.Error(),"" } respBytes, err := ioutil.ReadAll(resp.Body) if err != nil { fmt.Println(err.Error()) return err.Error(),"" } str := string(respBytes) fmt.Println(str) return str,string(bytesData) } func NMyb3503(struct3503 models.Struct3503, secret_key string) (string,string) { // 生成签名 nonce := GetRandomString(32) timestamp := time.Now().Unix() signature := setSignature(timestamp, nonce, secret_key) // 生成输入报文 inputMessage := SetGdInputMessage(timestamp, struct3503.OrgName, struct3503.Opter, struct3503.FixmedinsHilistId, struct3503.InsuplcAdmdvs, struct3503.MdtrtareaAdmvs, struct3503.Cainfo) input := make(map[string]interface{}) inputMessage["infno"] = "3503" item := struct3503 feedetailInfo := make(map[string]interface{}) feedetailInfo["med_list_codg"] = item.MedListCodg feedetailInfo["fixmedins_hilist_id"] = item.FixmedinsHilistId feedetailInfo["fixmedins_hilist_name"] = item.FixmedinsHilistName feedetailInfo["dynt_no"] = "" feedetailInfo["fixmedins_bchno"] = item.FixmedinsBchno // 人员编号 (来自1101接口返回) feedetailInfo["spler_name"] = item.SplerName // 人员编号 (来自1101接口返回) feedetailInfo["spler_pmtno"] = "" // 人员编号 (来自1101接口返回) feedetailInfo["manu_lotnum"] = item.ManuLotnum // 人员编号 (来自1101接口返回) feedetailInfo["prodentp_name"] = item.ProdentpName // 人员编号 (来自1101接口返回) feedetailInfo["aprvno"] = item.Aprvno // 人员编号 (来自1101接口返回) feedetailInfo["manu_date"] = item.ManuDate // 人员编号 (来自1101接口返回) feedetailInfo["expy_end"] = item.ExpyEnd // 人员编号 (来自1101接口返回) feedetailInfo["finl_trns_pric"] = item.FinlTrnsPric // 人员编号 (来自1101接口返回) feedetailInfo["purc_retn_cnt"] = item.PurcRetnCnt // 人员编号 (来自1101接口返回) feedetailInfo["purc_invo_codg"] = item.PurcInvoCodg // 人员编号 (来自1101接口返回) feedetailInfo["purc_invo_no"] = item.PurcInvoNo // 人员编号 (来自1101接口返回) feedetailInfo["rx_flag"] = item.RxFlag // 人员编号 (来自1101接口返回) feedetailInfo["purc_retn_stoin_time"] = item.PurcRetnStoinTime // 人员编号 (来自1101接口返回) feedetailInfo["purc_retn_opter_name"] = item.PurcRetnOpterName // 人员编号 (来自1101接口返回) feedetailInfo["prod_geay_flag"] = "" // 人员编号 (来自1101接口返回) feedetailInfo["memo"] = "" // 人员编号 (来自1101接口返回) input["purcinfo"] = feedetailInfo inputMessage["input"] = input //交易输入 bytesData, err := json.Marshal(inputMessage) fmt.Println(string(bytesData)) if err != nil { fmt.Println(err.Error()) return err.Error(),"" } reader := bytes.NewReader(bytesData) //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/5301" gdyb_url := beego.AppConfig.String("gdyb_url") gdyb_paasid := beego.AppConfig.String("gdyb_paasid") //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/1101" url := gdyb_url request, err := http.NewRequest("POST", url, reader) if err != nil { fmt.Println(err.Error()) return err.Error(),"" } request.Header.Set("Content-Type", "application/json;charset=UTF-8") request.Header.Set("x-tif-paasid", gdyb_paasid) request.Header.Set("x-tif-signature", signature) request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10)) request.Header.Set("x-tif-nonce", nonce) client := http.Client{} resp, err := client.Do(request) if err != nil { fmt.Println(err.Error()) return err.Error(),"" } respBytes, err := ioutil.ReadAll(resp.Body) if err != nil { fmt.Println(err.Error()) return err.Error(),"" } str := string(respBytes) fmt.Println(str) return str,string(bytesData) } func NMyb3504(struct3504 models.Struct3504, secret_key string) (string,string) { // 生成签名 nonce := GetRandomString(32) timestamp := time.Now().Unix() signature := setSignature(timestamp, nonce, secret_key) // 生成输入报文 inputMessage := SetGdInputMessage(timestamp, struct3504.OrgName, struct3504.Opter, struct3504.FixmedinsCode, struct3504.InsuplcAdmdvs, struct3504.MdtrtareaAdmvs, struct3504.Cainfo) input := make(map[string]interface{}) inputData := make(map[string]interface{}) inputMessage["infno"] = "3504" // 交易编码 inputData["med_list_codg"] = struct3504.MedListCodg // 定点医药机构目录编号 inputData["fixmedins_hilist_id"] = struct3504.FixmedinsHilistId // 定点医药机构目录编号 inputData["fixmedins_hilist_name"] = struct3504.FixmedinsHilistName // 定点医药机构目录名称 inputData["fixmedins_bchno"] = struct3504.FixmedinsBchno // 人员编号 (来自1101接口返回) inputData["spler_name"] = struct3504.SplerName // 人员编号 (来自1101接口返回) inputData["spler_pmtno"] = "" // 人员编号 (来自1101接口返回) inputData["manu_date"] = struct3504.ManuDate // 人员编号 (来自1101接口返回) inputData["expy_end"] = struct3504.ExpyEnd // 人员编号 (来自1101接口返回) inputData["finl_trns_pric"] = struct3504.FinlTrnsPric // 人员编号 (来自1101接口返回) inputData["purc_retn_cnt"] = struct3504.PurcRetnCnt // 人员编号 (来自1101接口返回) inputData["purc_invo_codg"] = struct3504.PurcInvoCodg // 人员编号 (来自1101接口返回) inputData["purc_invo_no"] = struct3504.PurcInvoNo // 人员编号 (来自1101接口返回) inputData["rx_flag"] = struct3504.RxFlag inputData["purc_retn_stoin_time"] = struct3504.PurcRetnStoin inputData["purc_retn_opter_name"] = struct3504.PurcRetnStoin inputData["memo"] = "" // 人员编号 (来自1101接口返回) inputData["medins_prod_purc_no"] = "" // 人员编号 (来自1101接口返回) input["purcinfo"] = inputData inputMessage["input"] = input //交易输入 bytesData, err := json.Marshal(inputMessage) fmt.Println(string(bytesData)) if err != nil { fmt.Println(err.Error()) return err.Error(),"" } reader := bytes.NewReader(bytesData) //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/5301" gdyb_url := beego.AppConfig.String("gdyb_url") gdyb_paasid := beego.AppConfig.String("gdyb_paasid") //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/1101" url := gdyb_url request, err := http.NewRequest("POST", url, reader) if err != nil { fmt.Println(err.Error()) return err.Error(),"" } request.Header.Set("Content-Type", "application/json;charset=UTF-8") request.Header.Set("x-tif-paasid", gdyb_paasid) request.Header.Set("x-tif-signature", signature) request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10)) request.Header.Set("x-tif-nonce", nonce) client := http.Client{} resp, err := client.Do(request) if err != nil { fmt.Println(err.Error()) return err.Error(),"" } respBytes, err := ioutil.ReadAll(resp.Body) if err != nil { fmt.Println(err.Error()) return err.Error(),"" } str := string(respBytes) fmt.Println(str) return str,string(bytesData) } func NMyb3505(struct3505 models.Struct3505, secret_key string) (string,string) { // 生成签名 nonce := GetRandomString(32) timestamp := time.Now().Unix() signature := setSignature(timestamp, nonce, secret_key) // 生成输入报文 inputMessage := SetGdInputMessage(timestamp, struct3505.OrgName, struct3505.Opter, struct3505.Code, struct3505.InsuplcAdmdvs, struct3505.MdtrtareaAdmvs, struct3505.Cainfo) input := make(map[string]interface{}) inputData := make(map[string]interface{}) inputMessage["infno"] = "3505" // 交易编码 inputData["med_list_codg"] = struct3505.MedListCodg // 定点医药机构目录编号 inputData["fixmedins_hilist_id"] = struct3505.FixmedinsHilistId // 定点医药机构目录编号 inputData["fixmedins_hilist_name"] = struct3505.FixmedinsHilistName // 定点医药机构目录名称 inputData["fixmedins_bchno"] = struct3505.FixmedinsBchno // 人员编号 (来自1101接口返回) inputData["prsc_dr_cert_type"] = struct3505.PrscDrCertType // 人员编号 (来自1101接口返回) inputData["prsc_dr_certno"] = struct3505.PrscDrCertno // 人员编号 (来自1101接口返回) inputData["prsc_dr_name"] = struct3505.PrscDrName // 人员编号 (来自1101接口返回) inputData["phar_cert_type"] = struct3505.PharCertType // 人员编号 (来自1101接口返回) inputData["phar_certno"] = struct3505.PharCertno // 人员编号 (来自1101接口返回) inputData["phar_name"] = struct3505.PharName // 人员编号 (来自1101接口返回) inputData["phar_prac_cert_no"] = struct3505.PharPracCertNo // 人员编号 (来自1101接口返回) inputData["hi_feesetl_type"] = struct3505.HiFeesetlType // 人员编号 (来自1101接口返回) inputData["setl_id"] = struct3505.SetlId // 人员编号 (来自1101接口返回) inputData["mdtrt_sn"] = struct3505.MdtrtSn // 人员编号 (来自1101接口返回) inputData["psn_no"] = struct3505.PsnNo // 人员编号 (来自1101接口返回) inputData["psn_cert_type"] = struct3505.PsnCertType // 人员编号 (来自1101接口返回) inputData["certno"] = struct3505.CertNo // 人员编号 (来自1101接口返回) inputData["psn_name"] = struct3505.PsnName // 人员编号 (来自1101接口返回) inputData["manu_lotnum"] = struct3505.ManuLotnum // 人员编号 (来自1101接口返回) inputData["manu_date"] = struct3505.ManuDate // 人员编号 (来自1101接口返回) inputData["expy_end"] = struct3505.ExpyEnd // 人员编号 (来自1101接口返回) inputData["rx_flag"] = struct3505.RxFlag // 人员编号 (来自1101接口返回) inputData["trdn_flag"] = struct3505.TrdnFlag // 人员编号 (来自1101接口返回) inputData["finl_trns_pric"] = struct3505.FinlTrnsPric // 人员编号 (来自1101接口返回) inputData["rxno"] = struct3505.Rxno // 人员编号 (来自1101接口返回) inputData["rx_circ_flag"] = struct3505.RxCircFlag // 人员编号 (来自1101接口返回) inputData["rtal_docno"] = struct3505.RtalDocno // 人员编号 (来自1101接口返回) inputData["stoout_no"] = struct3505.StooutNo // 人员编号 (来自1101接口返回) inputData["bchno"] = struct3505.Bchno // 人员编号 (来自1101接口返回) inputData["drug_trac_codg"] = "---" // 人员编号 (来自1101接口返回) inputData["drug_prod_barc"] = struct3505.DrugProdBarc // 人员编号 (来自1101接口返回) inputData["shelf_posi"] = struct3505.ShelfPosi // 人员编号 (来自1101接口返回) inputData["sel_retn_cnt"] = struct3505.SelRetnCnt // 人员编号 (来自1101接口返回) inputData["sel_retn_time"] = struct3505.SelRetnTime // 人员编号 (来自1101接口返回) inputData["sel_retn_opter_name"] = struct3505.SelRetnOpterName // 人员编号 (来自1101接口返回) inputData["memo"] = struct3505.Memo // 人员编号 (来自1101接口返回) feedetail := make([]map[string]interface{}, 0) codes := strings.Split(struct3505.DrugTracCodg, ",") for _, item := range codes { if len(item) > 0 { druginputData := make(map[string]interface{}) druginputData["drug_trac_codg"] = item feedetail = append(feedetail, druginputData) } } inputData["drugtracinfo"] = feedetail input["selinfo"] = inputData inputMessage["input"] = input //交易输入 bytesData, err := json.Marshal(inputMessage) fmt.Println(string(bytesData)) if err != nil { fmt.Println(err.Error()) return err.Error(),"" } reader := bytes.NewReader(bytesData) //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/5301" gdyb_url := beego.AppConfig.String("gdyb_url") gdyb_paasid := beego.AppConfig.String("gdyb_paasid") //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/1101" url := gdyb_url request, err := http.NewRequest("POST", url, reader) if err != nil { fmt.Println(err.Error()) return err.Error(),"" } request.Header.Set("Content-Type", "application/json;charset=UTF-8") request.Header.Set("x-tif-paasid", gdyb_paasid) request.Header.Set("x-tif-signature", signature) request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10)) request.Header.Set("x-tif-nonce", nonce) client := http.Client{} resp, err := client.Do(request) if err != nil { fmt.Println(err.Error()) return err.Error(),"" } respBytes, err := ioutil.ReadAll(resp.Body) if err != nil { fmt.Println(err.Error()) return err.Error(),"" } str := string(respBytes) fmt.Println(str) return str,string(bytesData) } func NMyb3506(struct3506 models.Struct3506, secret_key string) (string,string) { // 生成签名 nonce := GetRandomString(32) timestamp := time.Now().Unix() signature := setSignature(timestamp, nonce, secret_key) // 生成输入报文 inputMessage := SetGdInputMessage(timestamp, struct3506.OrgName, struct3506.Opter, struct3506.FixmedinsCode, struct3506.InsuplcAdmdvs, struct3506.MdtrtareaAdmvs, struct3506.Cainfo) input := make(map[string]interface{}) inputData := make(map[string]interface{}) inputMessage["infno"] = "3506" // 交易编码 inputData["med_list_codg"] = struct3506.MedListCodg // 定点医药机构目录编号 inputData["fixmedins_hilist_id"] = struct3506.FixmedinsHilistId // 定点医药机构目录编号 inputData["fixmedins_hilist_name"] = struct3506.OrgName // 定点医药机构目录名称 inputData["fixmedins_bchno"] = struct3506.FixmedinsBchno // 人员编号 (来自1101接口返回) inputData["setl_id"] = struct3506.SetlId // 人员编号 (来自1101接口返回) inputData["psn_no"] = struct3506.PsnNo // 人员编号 (来自1101接口返回) inputData["psn_cert_type"] = struct3506.PsnCertType // 人员编号 (来自1101接口返回) inputData["certno"] = struct3506.Certno // 人员编号 (来自1101接口返回) inputData["psn_name"] = struct3506.PsnName // 人员编号 (来自1101接口返回) inputData["manu_lotnum"] = struct3506.ManuLotnum // 人员编号 (来自1101接口返回) inputData["manu_date"] = struct3506.ManuDate // 人员编号 (来自1101接口返回) inputData["expy_end"] = struct3506.ExpyEnd // 人员编号 (来自1101接口返回) inputData["rx_flag"] = struct3506.RxFlag // 人员编号 (来自1101接口返回) inputData["trdn_flag"] = struct3506.TrdnFlag // 人员编号 (来自1101接口返回) inputData["finl_trns_pric"] = struct3506.FinlTrnsPric // 人员编号 (来自1101接口返回) inputData["sel_retn_cnt"] = struct3506.SelRetnCnt // 人员编号 (来自1101接口返回) inputData["sel_retn_time"] = struct3506.SelRetnTime // 人员编号 (来自1101接口返回) inputData["sel_retn_opter_name"] = struct3506.SelRetnOpterName // 人员编号 (来自1101接口返回) inputData["memo"] = "" // 人员编号 (来自1101接口返回) inputData["medins_prod_sel_no"] = "" // 人员编号 (来自1101接口返回) input["selinfo"] = inputData inputMessage["input"] = input //交易输入 bytesData, err := json.Marshal(inputMessage) fmt.Println(string(bytesData)) if err != nil { fmt.Println(err.Error()) return err.Error(),"" } reader := bytes.NewReader(bytesData) //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/5301" gdyb_url := beego.AppConfig.String("gdyb_url") gdyb_paasid := beego.AppConfig.String("gdyb_paasid") //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/1101" url := gdyb_url request, err := http.NewRequest("POST", url, reader) if err != nil { fmt.Println(err.Error()) return err.Error(),"" } request.Header.Set("Content-Type", "application/json;charset=UTF-8") request.Header.Set("x-tif-paasid", gdyb_paasid) request.Header.Set("x-tif-signature", signature) request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10)) request.Header.Set("x-tif-nonce", nonce) client := http.Client{} resp, err := client.Do(request) if err != nil { fmt.Println(err.Error()) return err.Error(),"" } respBytes, err := ioutil.ReadAll(resp.Body) if err != nil { fmt.Println(err.Error()) return err.Error(),"" } str := string(respBytes) fmt.Println(str) return str,string(bytesData) } func NMyb3507(struct3507 models.Struct3507, secret_key string) (string,string) { // 生成签名 nonce := GetRandomString(32) timestamp := time.Now().Unix() signature := setSignature(timestamp, nonce, secret_key) // 生成输入报文 inputMessage := SetGdInputMessage(timestamp, struct3507.OrgName, struct3507.Opter, struct3507.FixmedinsCode, struct3507.InsuplcAdmdvs, struct3507.MdtrtareaAdmvs, struct3507.Cainfo) input := make(map[string]interface{}) inputData := make(map[string]interface{}) inputMessage["infno"] = "3507" // 交易编码 inputData["fixmedins_bchno"] = struct3507.FixmedinsCode // 人员编号 (来自1101接口返回) inputData["inv_data_type"] = struct3507.InvDataType // 人员编号 (来自1101接口返回) input["data"] = inputData inputMessage["input"] = input //交易输入 bytesData, err := json.Marshal(inputMessage) fmt.Println(string(bytesData)) if err != nil { fmt.Println(err.Error()) return err.Error(),"" } reader := bytes.NewReader(bytesData) //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/5301" gdyb_url := beego.AppConfig.String("gdyb_url") gdyb_paasid := beego.AppConfig.String("gdyb_paasid") //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/1101" url := gdyb_url request, err := http.NewRequest("POST", url, reader) if err != nil { fmt.Println(err.Error()) return err.Error(),"" } request.Header.Set("Content-Type", "application/json;charset=UTF-8") request.Header.Set("x-tif-paasid", gdyb_paasid) request.Header.Set("x-tif-signature", signature) request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10)) request.Header.Set("x-tif-nonce", nonce) client := http.Client{} resp, err := client.Do(request) if err != nil { fmt.Println(err.Error()) return err.Error(),"" } respBytes, err := ioutil.ReadAll(resp.Body) if err != nil { fmt.Println(err.Error()) return err.Error(),"" } str := string(respBytes) fmt.Println(str) return str,string(bytesData) } func NMyb3508(struct3508 models.Struct3508, secret_key string) (string,string) { // 生成签名 nonce := GetRandomString(32) timestamp := time.Now().Unix() signature := setSignature(timestamp, nonce, secret_key) // 生成输入报文 inputMessage := SetGdInputMessage(timestamp, struct3508.OrgName, struct3508.Opter, struct3508.FixmedinsCode, struct3508.InsuplcAdmdvs, struct3508.MdtrtareaAdmvs, struct3508.Cainfo) input := make(map[string]interface{}) inputData := make(map[string]interface{}) inputMessage["infno"] = "3508" inputData["fixmedins_code"] = struct3508.FixmedinsCode inputData["medins_list_codg"] = struct3508.MedListCodg inputData["fixmedins_bchno"] = "" inputData["begndate"] = struct3508.Begndate inputData["enddate"] = struct3508.Enddate inputData["medins_prod_inv_no"] = "" inputData["medins_list_name"] = "" inputData["rx_flag"] = "" inputData["list_sp_item_flag"] = "" inputData["trdn_flag"] = "" inputData["invdate"] = "" inputData["manu_lotnum"] = "" inputData["manu_date"] = "" inputData["expy_end"] = "" inputData["memo"] = "" inputData["vali_flag"] = "" inputData["rid"] = "" inputData["crter_id"] = "" inputData["crter_name"] = "" inputData["crte_optins_no"] = "" inputData["opter_id"] = "" inputData["opter_name"] = "" inputData["optins_no"] = "" inputData["poolarea_no"] = "" inputData["fixmedins_bchno"] = "" inputData["inv_data_type"] = "" input["data"] = inputData inputMessage["input"] = input //交易输入 bytesData, err := json.Marshal(inputMessage) fmt.Println(string(bytesData)) if err != nil { fmt.Println(err.Error()) return err.Error(),"" } reader := bytes.NewReader(bytesData) //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/5301" gdyb_url := beego.AppConfig.String("gdyb_url") gdyb_paasid := beego.AppConfig.String("gdyb_paasid") //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/1101" url := gdyb_url request, err := http.NewRequest("POST", url, reader) if err != nil { fmt.Println(err.Error()) return err.Error(),"" } request.Header.Set("Content-Type", "application/json;charset=UTF-8") request.Header.Set("x-tif-paasid", gdyb_paasid) request.Header.Set("x-tif-signature", signature) request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10)) request.Header.Set("x-tif-nonce", nonce) client := http.Client{} resp, err := client.Do(request) if err != nil { fmt.Println(err.Error()) return err.Error(),"" } respBytes, err := ioutil.ReadAll(resp.Body) if err != nil { fmt.Println(err.Error()) return err.Error(),"" } str := string(respBytes) fmt.Println(str) return str,string(bytesData) } func NMyb3509(struct3509 models.Struct3509, secret_key string) (string,string) { // 生成签名 nonce := GetRandomString(32) timestamp := time.Now().Unix() signature := setSignature(timestamp, nonce, secret_key) // 生成输入报文 inputMessage := SetGdInputMessage(timestamp, struct3509.OrgName, struct3509.Opter, struct3509.FixmedinsCode, struct3509.InsuplcAdmdvs, struct3509.MdtrtareaAdmvs, struct3509.Cainfo) input := make(map[string]interface{}) inputData := make(map[string]interface{}) inputMessage["infno"] = "3509" inputData["fixmedins_code"] = struct3509.FixmedinsCode //inputData["med_list_codg"] = struct3509.MedinsListCodg inputData["medins_list_codg"] = struct3509.MedListCodg inputData["fixmedins_bchno"] = "" inputData["begndate"] = struct3509.Begndate inputData["enddate"] = struct3509.Enddate inputData["medins_prod_inv_no"] = "" inputData["medins_list_name"] = "" inputData["rx_flag"] = "" inputData["list_sp_item_flag"] = "" inputData["trdn_flag"] = "" inputData["invdate"] = "" inputData["manu_lotnum"] = "" inputData["manu_date"] = "" inputData["expy_end"] = "" inputData["memo"] = "" inputData["vali_flag"] = "" inputData["rid"] = "" inputData["crter_id"] = "" inputData["crter_name"] = "" inputData["crte_optins_no"] = "" inputData["opter_id"] = "" inputData["opter_name"] = "" inputData["optins_no"] = "" inputData["poolarea_no"] = "" inputData["fixmedins_bchno"] = "" inputData["inv_data_type"] = "" input["data"] = inputData inputMessage["input"] = input //交易输入 bytesData, err := json.Marshal(inputMessage) fmt.Println(string(bytesData)) if err != nil { fmt.Println(err.Error()) return err.Error(),"" } reader := bytes.NewReader(bytesData) //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/5301" gdyb_url := beego.AppConfig.String("gdyb_url") gdyb_paasid := beego.AppConfig.String("gdyb_paasid") //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/1101" url := gdyb_url request, err := http.NewRequest("POST", url, reader) if err != nil { fmt.Println(err.Error()) return err.Error(),"" } request.Header.Set("Content-Type", "application/json;charset=UTF-8") request.Header.Set("x-tif-paasid", gdyb_paasid) request.Header.Set("x-tif-signature", signature) request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10)) request.Header.Set("x-tif-nonce", nonce) client := http.Client{} resp, err := client.Do(request) if err != nil { fmt.Println(err.Error()) return err.Error(),"" } respBytes, err := ioutil.ReadAll(resp.Body) if err != nil { fmt.Println(err.Error()) return err.Error(),"" } str := string(respBytes) fmt.Println(str) return str,string(bytesData) } func NMyb3510(struct3510 models.Struct3510, secret_key string) (string,string) { // 生成签名 nonce := GetRandomString(32) timestamp := time.Now().Unix() signature := setSignature(timestamp, nonce, secret_key) // 生成输入报文 inputMessage := SetGdInputMessage(timestamp, struct3510.OrgName, struct3510.Opter, struct3510.FixmedinsCode, struct3510.InsuplcAdmdvs, struct3510.MdtrtareaAdmvs, struct3510.Cainfo) input := make(map[string]interface{}) inputData := make(map[string]interface{}) inputMessage["infno"] = "3510" inputData["fixmedins_code"] = struct3510.FixmedinsCode //inputData["medins_list_codg"] = struct3510.MedinsListCodg inputData["medins_list_codg"] = struct3510.MedListCodg inputData["fixmedins_bchno"] = "" inputData["begndate"] = struct3510.Begndate inputData["enddate"] = struct3510.Enddate inputData["medins_prod_inv_no"] = "" inputData["medins_list_name"] = "" inputData["rx_flag"] = "" inputData["list_sp_item_flag"] = "" inputData["trdn_flag"] = "" inputData["invdate"] = "" inputData["manu_lotnum"] = "" inputData["manu_date"] = "" inputData["expy_end"] = "" inputData["memo"] = "" inputData["vali_flag"] = "" inputData["rid"] = "" inputData["crter_id"] = "" inputData["crter_name"] = "" inputData["crte_optins_no"] = "" inputData["opter_id"] = "" inputData["opter_name"] = "" inputData["optins_no"] = "" inputData["poolarea_no"] = "" inputData["fixmedins_bchno"] = "" inputData["inv_data_type"] = "" input["data"] = inputData inputMessage["input"] = input //交易输入 bytesData, err := json.Marshal(inputMessage) fmt.Println(string(bytesData)) if err != nil { fmt.Println(err.Error()) return err.Error(),"" } reader := bytes.NewReader(bytesData) //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/5301" gdyb_url := beego.AppConfig.String("gdyb_url") gdyb_paasid := beego.AppConfig.String("gdyb_paasid") //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/1101" url := gdyb_url request, err := http.NewRequest("POST", url, reader) if err != nil { fmt.Println(err.Error()) return err.Error(),"" } request.Header.Set("Content-Type", "application/json;charset=UTF-8") request.Header.Set("x-tif-paasid", gdyb_paasid) request.Header.Set("x-tif-signature", signature) request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10)) request.Header.Set("x-tif-nonce", nonce) client := http.Client{} resp, err := client.Do(request) if err != nil { fmt.Println(err.Error()) return err.Error(),"" } respBytes, err := ioutil.ReadAll(resp.Body) if err != nil { fmt.Println(err.Error()) return err.Error(),"" } str := string(respBytes) fmt.Println(str) return str,string(bytesData) } func NMyb3511(struct3511 models.Struct3511, secret_key string) (string,string) { // 生成签名 nonce := GetRandomString(32) timestamp := time.Now().Unix() signature := setSignature(timestamp, nonce, secret_key) // 生成输入报文 inputMessage := SetGdInputMessage(timestamp, struct3511.OrgName, struct3511.Opter, struct3511.FixmedinsCode, struct3511.InsuplcAdmdvs, struct3511.MdtrtareaAdmvs, struct3511.Cainfo) input := make(map[string]interface{}) inputData := make(map[string]interface{}) inputMessage["infno"] = "3511" inputData["fixmedins_code"] = struct3511.FixmedinsCode //inputData["medins_list_codg"] = struct3511.MedinsListCodg inputData["medins_list_codg"] = struct3511.MedListCodg inputData["fixmedins_bchno"] = "" inputData["begndate"] = struct3511.Begndate inputData["enddate"] = struct3511.Enddate inputData["medins_prod_inv_no"] = "" inputData["medins_list_name"] = "" inputData["rx_flag"] = "" inputData["list_sp_item_flag"] = "" inputData["trdn_flag"] = "" inputData["invdate"] = "" inputData["manu_lotnum"] = "" inputData["manu_date"] = "" inputData["expy_end"] = "" inputData["memo"] = "" inputData["vali_flag"] = "" inputData["rid"] = "" inputData["crter_id"] = "" inputData["crter_name"] = "" inputData["crte_optins_no"] = "" inputData["opter_id"] = "" inputData["opter_name"] = "" inputData["optins_no"] = "" inputData["poolarea_no"] = "" inputData["fixmedins_bchno"] = "" inputData["inv_data_type"] = "" input["data"] = inputData inputMessage["input"] = input //交易输入 bytesData, err := json.Marshal(inputMessage) fmt.Println(string(bytesData)) if err != nil { fmt.Println(err.Error()) return err.Error(),"" } reader := bytes.NewReader(bytesData) //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/5301" gdyb_url := beego.AppConfig.String("gdyb_url") gdyb_paasid := beego.AppConfig.String("gdyb_paasid") //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/1101" url := gdyb_url request, err := http.NewRequest("POST", url, reader) if err != nil { fmt.Println(err.Error()) return err.Error(),"" } request.Header.Set("Content-Type", "application/json;charset=UTF-8") request.Header.Set("x-tif-paasid", gdyb_paasid) request.Header.Set("x-tif-signature", signature) request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10)) request.Header.Set("x-tif-nonce", nonce) client := http.Client{} resp, err := client.Do(request) if err != nil { fmt.Println(err.Error()) return err.Error(),"" } respBytes, err := ioutil.ReadAll(resp.Body) if err != nil { fmt.Println(err.Error()) return err.Error(),"" } str := string(respBytes) fmt.Println(str) return str,string(bytesData) } func NMyb3512(struct3512 models.Struct3512, secret_key string) (string,string) { // 生成签名 nonce := GetRandomString(32) timestamp := time.Now().Unix() signature := setSignature(timestamp, nonce, secret_key) // 生成输入报文 inputMessage := SetGdInputMessage(timestamp, struct3512.OrgName, struct3512.Opter, struct3512.FixmedinsCode, struct3512.InsuplcAdmdvs, struct3512.MdtrtareaAdmvs, struct3512.Cainfo) input := make(map[string]interface{}) inputData := make(map[string]interface{}) inputMessage["infno"] = "3512" inputData["fixmedins_code"] = struct3512.FixmedinsCode //inputData["medins_list_codg"] = struct3512.MedinsListCodg inputData["medins_list_codg"] = struct3512.MedListCodg inputData["fixmedins_bchno"] = "" inputData["begndate"] = struct3512.Begndate inputData["enddate"] = struct3512.Enddate inputData["medins_prod_inv_no"] = "" inputData["medins_list_name"] = "" inputData["rx_flag"] = "" inputData["list_sp_item_flag"] = "" inputData["trdn_flag"] = "" inputData["invdate"] = "" inputData["manu_lotnum"] = "" inputData["manu_date"] = "" inputData["expy_end"] = "" inputData["memo"] = "" inputData["vali_flag"] = "" inputData["rid"] = "" inputData["crter_id"] = "" inputData["crter_name"] = "" inputData["crte_optins_no"] = "" inputData["opter_id"] = "" inputData["opter_name"] = "" inputData["optins_no"] = "" inputData["poolarea_no"] = "" inputData["fixmedins_bchno"] = "" inputData["inv_data_type"] = "" input["data"] = inputData inputMessage["input"] = input //交易输入 bytesData, err := json.Marshal(inputMessage) fmt.Println(string(bytesData)) if err != nil { fmt.Println(err.Error()) return err.Error(),"" } reader := bytes.NewReader(bytesData) //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/5301" gdyb_url := beego.AppConfig.String("gdyb_url") gdyb_paasid := beego.AppConfig.String("gdyb_paasid") //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/1101" url := gdyb_url request, err := http.NewRequest("POST", url, reader) if err != nil { fmt.Println(err.Error()) return err.Error(),"" } request.Header.Set("Content-Type", "application/json;charset=UTF-8") request.Header.Set("x-tif-paasid", gdyb_paasid) request.Header.Set("x-tif-signature", signature) request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10)) request.Header.Set("x-tif-nonce", nonce) client := http.Client{} resp, err := client.Do(request) if err != nil { fmt.Println(err.Error()) return err.Error(),"" } respBytes, err := ioutil.ReadAll(resp.Body) if err != nil { fmt.Println(err.Error()) return err.Error(),"" } str := string(respBytes) fmt.Println(str) return str,string(bytesData) } func NMyb3513(struct3513 models.Struct3513, secret_key string) (string,string) { // 生成签名 nonce := GetRandomString(32) timestamp := time.Now().Unix() signature := setSignature(timestamp, nonce, secret_key) // 生成输入报文 inputMessage := SetGdInputMessage(timestamp, struct3513.OrgName, struct3513.Opter, struct3513.FixmedinsCode, struct3513.InsuplcAdmdvs, struct3513.MdtrtareaAdmvs, struct3513.Cainfo) input := make(map[string]interface{}) inputData := make(map[string]interface{}) inputMessage["infno"] = "3513" inputData["fixmedins_code"] = struct3513.FixmedinsCode //inputData["medins_list_codg"] = struct3513.MedinsListCodg inputData["medins_list_codg"] = struct3513.MedListCodg inputData["fixmedins_bchno"] = "" inputData["begndate"] = struct3513.Begndate inputData["enddate"] = struct3513.Enddate inputData["medins_prod_inv_no"] = "" inputData["med_list_codg"] = "" inputData["medins_list_name"] = "" inputData["rx_flag"] = "" inputData["list_sp_item_flag"] = "" inputData["trdn_flag"] = "" inputData["invdate"] = "" inputData["manu_lotnum"] = "" inputData["manu_date"] = "" inputData["expy_end"] = "" inputData["memo"] = "" inputData["vali_flag"] = "" inputData["rid"] = "" inputData["crter_id"] = "" inputData["crter_name"] = "" inputData["crte_optins_no"] = "" inputData["opter_id"] = "" inputData["opter_name"] = "" inputData["optins_no"] = "" inputData["poolarea_no"] = "" inputData["fixmedins_bchno"] = "" inputData["inv_data_type"] = "" input["data"] = inputData inputMessage["input"] = input //交易输入 bytesData, err := json.Marshal(inputMessage) fmt.Println(string(bytesData)) if err != nil { fmt.Println(err.Error()) return err.Error(),"" } reader := bytes.NewReader(bytesData) //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/5301" gdyb_url := beego.AppConfig.String("gdyb_url") gdyb_paasid := beego.AppConfig.String("gdyb_paasid") //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/1101" url := gdyb_url request, err := http.NewRequest("POST", url, reader) if err != nil { fmt.Println(err.Error()) return err.Error(),"" } request.Header.Set("Content-Type", "application/json;charset=UTF-8") request.Header.Set("x-tif-paasid", gdyb_paasid) request.Header.Set("x-tif-signature", signature) request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10)) request.Header.Set("x-tif-nonce", nonce) client := http.Client{} resp, err := client.Do(request) if err != nil { fmt.Println(err.Error()) return err.Error(),"" } respBytes, err := ioutil.ReadAll(resp.Body) if err != nil { fmt.Println(err.Error()) return err.Error(),"" } str := string(respBytes) fmt.Println(str) return str,string(bytesData) }