package service import ( "bytes" "encoding/json" "fmt" "gdyb/models" "github.com/astaxie/beego" "io/ioutil" "net/http" "strconv" "time" ) func GetCFYLJG001(org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, cFYLJG001 models.CFYLJG001,isu 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{}, 0) inputMessage["infno"] = "CFYLJG001" inputData["mdtrt_cert_type"] = cFYLJG001.MdtrtCertType inputData["mdtrt_cert_no"] = cFYLJG001.MdtrtCertNo inputData["card_sn"] = cFYLJG001.CardSn inputData["ec_token"] = cFYLJG001.EcToken inputData["auth_no"] = cFYLJG001.AuthNo inputData["biz_type_code"] = cFYLJG001.BizTypeCode inputData["insu_admdvs"] = cFYLJG001.InsuAdmdvs inputData["hosp_rxno"] = cFYLJG001.HospRxno inputData["init_rxno"] = cFYLJG001.InitRxno inputData["rx_type_code"] = cFYLJG001.RxTypeCode inputData["prsc_time"] = cFYLJG001.PrscTime inputData["rx_drug_cnt"] = cFYLJG001.RxDrugCnt inputData["rx_used_way_codg"] = cFYLJG001.RxUsedWayCodg inputData["rx_used_way_name"] = cFYLJG001.RxUsedWayName inputData["rx_frqu_codg"] = cFYLJG001.RxFrquCodg inputData["rx_frqu_name"] = cFYLJG001.RxFrquName inputData["rx_dosunt"] = cFYLJG001.RxDosunt inputData["rx_doscnt"] = cFYLJG001.RxDoscnt inputData["rx_drord_dscr"] = cFYLJG001.RxDrordDscr inputData["vali_days"] = cFYLJG001.ValiDays inputData["vali_end_time"] = cFYLJG001.ValiEndTime inputData["rept_flag"] = cFYLJG001.ReptFlag inputData["max_rept_cnt"] = cFYLJG001.MaxReptCnt inputData["reptd_cnt"] = cFYLJG001.ReptdCnt inputData["min_inrv_days"] = cFYLJG001.MinInrvDays inputData["rx_cotn_flag"] = cFYLJG001.RxCotnFlag inputData["long_rx_flag"] = cFYLJG001.LongRxFlag inputData["mdtrtareaNo"] = cFYLJG001.MdtrtareaNo rxdrugdetail := make([]map[string]interface{}, 0) rxdrug := make(map[string]interface{}) for _, item := range cFYLJG001.List { rxdrug["med_list_codg"] = item.MedListCodg rxdrug["medins_list_codg"] = item.MedinsListCodg rxdrug["hosp_prep_flag"] = item.HospPrepFlag rxdrug["rx_item_type_code"] = item.RxItemTypeCode rxdrug["rx_item_type_name"] = item.RxItemTypeName rxdrug["tcmdrug_type_name"] = item.TcmdrugTypeName rxdrug["tcmdrug_type_code"] = item.TcmdrugTypeCode rxdrug["tcmherb_foote"] = item.TcmherbFoote rxdrug["medn_type_code"] = item.MednTypeCode rxdrug["medn_type_name"] = item.MednTypeName rxdrug["main_medc_flag"] = item.MainMedcFlag rxdrug["urgt_flag"] = item.UrgtFlag rxdrug["bas_medn_flag"] = item.BasMednFlag rxdrug["imp_drug_flag"] = item.ImpDrugFlag rxdrug["drug_prodname"] = item.DrugProdname rxdrug["genname_codg"] = item.GennameCodg rxdrug["drug_genname"] = item.DrugGenname rxdrug["drug_dosform"] = item.DrugDosform rxdrug["drug_spec"] = item.DrugSpec rxdrug["prdr_name"] = item.PrdrName rxdrug["medc_way_codg"] = item.MedcWayCodg rxdrug["medc_way_dscr"] = item.MedcWayDscr rxdrug["medc_begntime"] = item.MedcBegntime rxdrug["medc_endtime"] = item.MedcEndtime rxdrug["medc_days"] = item.MedcDays rxdrug["drug_pric"] = item.DrugPric rxdrug["drug_sumamt"] = item.DrugSumamt rxdrug["drug_cnt"] = item.DrugCnt rxdrug["drug_dosunt"] = item.DrugDosunt rxdrug["sin_doscnt"] = item.SinDoscnt rxdrug["sin_dosunt"] = item.SinDosunt rxdrug["used_frqu_codg"] = item.UsedFrquCodg rxdrug["used_frqu_name"] = item.UsedFrquName rxdrug["drug_totlcnt"] = item.DrugTotlcnt rxdrug["drug_totlcnt_emp"] = item.DrugTotlcntEmp rxdrug["hosp_appr_flag"] = item.HospApprFlag //rxdrug["extras"] = "" rxdrugdetail = append(rxdrugdetail, rxdrug) } inputData["rxdrugdetail"] = rxdrugdetail mdtrtinfo := make(map[string]interface{}) mdtrtinfo["fixmedins_code"] = cFYLJG001.Mdtrtinfo.FixmedinsCode mdtrtinfo["fixmedins_name"] = cFYLJG001.Mdtrtinfo.FixmedinsName mdtrtinfo["mdtrt_id"] = cFYLJG001.Mdtrtinfo.MdtrtID mdtrtinfo["med_type"] = cFYLJG001.Mdtrtinfo.MedType mdtrtinfo["ipt_otp_no"] = cFYLJG001.Mdtrtinfo.IptOtpNo mdtrtinfo["otp_ipt_flag"] = cFYLJG001.Mdtrtinfo.OtpIptFlag mdtrtinfo["psn_no"] = cFYLJG001.Mdtrtinfo.PsnNo mdtrtinfo["patn_name"] = cFYLJG001.Mdtrtinfo.PatnName mdtrtinfo["psn_cert_type"] = cFYLJG001.Mdtrtinfo.PsnCertType mdtrtinfo["certno"] = cFYLJG001.Mdtrtinfo.Certno mdtrtinfo["patn_age"] = cFYLJG001.Mdtrtinfo.PatnAge mdtrtinfo["patn_hgt"] = cFYLJG001.Mdtrtinfo.PatnHgt mdtrtinfo["patn_wt"] = cFYLJG001.Mdtrtinfo.PatnWt mdtrtinfo["gend"] = cFYLJG001.Mdtrtinfo.Gend mdtrtinfo["birctrlType"] = cFYLJG001.Mdtrtinfo.BirctrlType mdtrtinfo["birctrlMatnDate"] = cFYLJG001.Mdtrtinfo.BirctrlMatnDate mdtrtinfo["matnType"] = cFYLJG001.Mdtrtinfo.MatnType mdtrtinfo["geso_val"] = cFYLJG001.Mdtrtinfo.GesoVal mdtrtinfo["nwb_flag"] = cFYLJG001.Mdtrtinfo.NwbFlag mdtrtinfo["nwb_age"] = cFYLJG001.Mdtrtinfo.NwbAge mdtrtinfo["suck_prd_flag"] = cFYLJG001.Mdtrtinfo.SuckPrdFlag mdtrtinfo["algs_his"] = cFYLJG001.Mdtrtinfo.AlgsHis mdtrtinfo["prsc_dept_name"] = cFYLJG001.Mdtrtinfo.PrscDeptName mdtrtinfo["prsc_dept_code"] = cFYLJG001.Mdtrtinfo.PrscDeptCode mdtrtinfo["dr_code"] = cFYLJG001.Mdtrtinfo.DrCode mdtrtinfo["prsc_dr_name"] = cFYLJG001.Mdtrtinfo.PrscDrName mdtrtinfo["prsc_dr_cert_type"] = cFYLJG001.Mdtrtinfo.PrscDrCertType mdtrtinfo["prsc_dr_certno"] = cFYLJG001.Mdtrtinfo.PrscDrCertno mdtrtinfo["dr_profttl_codg"] = cFYLJG001.Mdtrtinfo.DrProfttlCodg mdtrtinfo["dr_profttl_name"] = cFYLJG001.Mdtrtinfo.DrProfttlName mdtrtinfo["dr_dept_code"] = cFYLJG001.Mdtrtinfo.DrDeptCode mdtrtinfo["dr_dept_name"] = cFYLJG001.Mdtrtinfo.DrDeptName mdtrtinfo["caty"] = cFYLJG001.Mdtrtinfo.Caty mdtrtinfo["mdtrt_time"] = cFYLJG001.Mdtrtinfo.MdtrtTime mdtrtinfo["dise_codg"] = cFYLJG001.Mdtrtinfo.DiseCodg mdtrtinfo["dise_name"] = cFYLJG001.Mdtrtinfo.DiseName mdtrtinfo["sp_dise_flag"] = cFYLJG001.Mdtrtinfo.SpDiseFlag mdtrtinfo["maindiag_code"] = cFYLJG001.Mdtrtinfo.MaindiagCode mdtrtinfo["maindiag_name"] = cFYLJG001.Mdtrtinfo.MaindiagName mdtrtinfo["dise_cond_dscr"] = cFYLJG001.Mdtrtinfo.DiseCondDscr mdtrtinfo["hi_feesetl_flag"] = cFYLJG001.Mdtrtinfo.HiFeesetlFlag mdtrtinfo["hi_feesetl_name"] = cFYLJG001.Mdtrtinfo.HiFeesetlName mdtrtinfo["rgst_fee"] = cFYLJG001.Mdtrtinfo.RgstFee mdtrtinfo["medfee_sumamt"] = cFYLJG001.Mdtrtinfo.MedfeeSumamt mdtrtinfo["fstdiag_flag"] = cFYLJG001.Mdtrtinfo.FstdiagFlag type MyData struct { Insutype string `json:"insutype"` } data := MyData{ Insutype: isu, } mdtrtinfo["extras"] = data inputData["mdtrtinfo"] = mdtrtinfo diseinfos := make([]map[string]interface{}, 0) for _, item := range cFYLJG001.Diseinfo { diseinfo := make(map[string]interface{}) diseinfo["diag_type"] = item.DiagType diseinfo["maindiag_flag"] = item.MaindiagFlag diseinfo["diag_srt_no"] = item.DiagSrtNo diseinfo["diag_code"] = item.DiagCode diseinfo["diag_name"] = item.DiagName diseinfo["diag_dept"] = item.DiagDept diseinfo["diag_dr_no"] = item.DiagDrNo diseinfo["diag_dr_name"] = item.DiagDrName diseinfo["diag_time"] = item.DiagTime diseinfo["tcm_dise_code"] = item.TcmDiseCode diseinfo["tcm_dise_name"] = item.TcmDiseName diseinfo["tcmsymp_code"] = item.TcmsympCode diseinfo["tcmsymp"] = item.Tcmsymp diseinfos = append(diseinfos, diseinfo) } inputData["diseinfo"] = diseinfos inputMessage["input"] = inputData var inputLog string bytesData, err := json.Marshal(inputMessage) inputLog = 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") var url string if fixmedins_code == "H15049901371" { url = gdyb_url } else { url = gdyb_url + "CFYLJG001" } //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/1101" 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(), "" } fmt.Println(string(respBytes)) str := string(respBytes) return str, inputLog } func GetCFYLJG002(org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, original_value string, original_rx_file string, extras 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) inputData := make(map[string]interface{}) inputDatas := make(map[string]interface{}) inputMessage["infno"] = "CFYLJG002" inputData["fixmedins_code"] = fixmedins_code inputData["original_value"] = original_value inputData["original_rx_file"] = original_rx_file inputData["extras"] = extras inputDatas["rx_sign_info"] = inputData inputMessage["input"] = inputDatas var inputLog string bytesData, err := json.Marshal(inputMessage) inputLog = 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") var url string if fixmedins_code == "H15049901371" { url = gdyb_url } else { url = gdyb_url + "CFYLJG002" } //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/1101" 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(), "" } fmt.Println(string(respBytes)) str := string(respBytes) return str, inputLog } func GetCFYLJG003(org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, cFYLJG003 models.CFYLJG003) (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{}) inputData2 := make(map[string]interface{}) inputMessage["infno"] = "CFYLJG003" inputData["rx_trace_code"] = cFYLJG003.RxTraceCode inputData["hi_rxno"] = cFYLJG003.HiRxno inputData["mdtrt_id"] = cFYLJG003.MdtrtID inputData["patn_name"] = cFYLJG003.PatnName inputData["psn_cert_type"] = cFYLJG003.PsnCertType inputData["certno"] = cFYLJG003.Certno inputData["fixmedins_name"] = cFYLJG003.FixmedinsName inputData["fixmedins_code"] = cFYLJG003.FixmedinsCode inputData["dr_code"] = cFYLJG003.DrCode inputData["prsc_dr_name"] = cFYLJG003.PrscDrName inputData["phar_dept_name"] = cFYLJG003.PharDeptName inputData["phar_dept_code"] = cFYLJG003.PharDeptCode inputData["phar_profttl_codg"] = cFYLJG003.PharProfttlCodg inputData["phar_profttl_name"] = cFYLJG003.PharProfttlName inputData["phar_code"] = cFYLJG003.PharCode inputData["rx_frqu_name"] = cFYLJG003.RxFrquName inputData["phar_cert_type"] = cFYLJG003.PsnCertType inputData["phar_certno"] = cFYLJG003.PharCertno inputData["phar_name"] = cFYLJG003.PharName inputData["phar_prac_cert_no"] = cFYLJG003.PharPracCertNo inputData["phar_chk_time"] = cFYLJG003.PharChkTime inputData["rx_file"] = cFYLJG003.RxFile inputData["sign_digest"] = cFYLJG003.SignDigest inputData2["rx_upload_info"] = inputData inputMessage["input"] = inputData2 var inputLog string bytesData, err := json.Marshal(inputMessage) inputLog = 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") var url string if fixmedins_code == "H15049901371" { url = gdyb_url } else { url = gdyb_url + "CFYLJG003" } //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/1101" 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(), "" } fmt.Println(string(respBytes)) str := string(respBytes) return str, inputLog } func GetCFYLJG004(org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, cFYLJG004 models.CFYLJG004) (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) inputData := make(map[string]interface{}) inputData1 := make(map[string]interface{}) //inputDatas := make([]map[string]interface{}, 0) inputMessage["infno"] = "CFYLJG004" inputData["hi_rxno"] = cFYLJG004.HiRxno inputData["undo_dr_code"] = cFYLJG004.UndoDrCode inputData["undo_dr_name"] = cFYLJG004.UndoDrName inputData["undo_dr_cert_type"] = cFYLJG004.UndoDrCertType inputData["undo_dr_certno"] = cFYLJG004.UndoDrCertno inputData["undo_rea"] = cFYLJG004.UndoRea inputData["undo_time"] = cFYLJG004.UndoTime inputData["fixmedins_code"] = cFYLJG004.FixmedinsCode inputData1["rx_cancel_info"] = inputData inputMessage["input"] = inputData1 var inputLog string bytesData, err := json.Marshal(inputMessage) inputLog = 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") var url string if fixmedins_code == "H15049901371" { url = gdyb_url } else { url = gdyb_url + "CFYLJG004" } //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/1101" 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(), "" } fmt.Println(string(respBytes)) str := string(respBytes) return str, inputLog } func GetCFYLJG005(org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, cFYLJG005 models.CFYLJG005) (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) inputData := make(map[string]interface{}) inputData2 := make(map[string]interface{}) //inputDatas := make([]map[string]interface{}, 0) inputMessage["infno"] = "CFYLJG005" inputData["fixmedins_code"] = fixmedins_code inputData["hi_rxno"] = cFYLJG005.HiRxno inputData["mdtrt_id"] = cFYLJG005.MdtrtID inputData["ec_token"] = cFYLJG005.EcToken inputData["psn_name"] = cFYLJG005.PsnName inputData["psn_cert_type"] = cFYLJG005.PsnCertType inputData["certno"] = cFYLJG005.Certno inputData2["rx_detl_query"] = inputData inputMessage["input"] = inputData2 var inputLog string bytesData, err := json.Marshal(inputMessage) inputLog = 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") var url string if fixmedins_code == "H15049901371" { url = gdyb_url } else { url = gdyb_url + "CFYLJG005" } //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/1101" 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(), "" } fmt.Println(string(respBytes)) str := string(respBytes) return str, inputLog } func GetCFYLJG006(org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, cFYLJG006 models.CFYLJG006) (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) inputData := make(map[string]interface{}) //inputDatas := make([]map[string]interface{}, 0) inputData2 := make(map[string]interface{}) inputMessage["infno"] = "CFYLJG006" inputData["fixmedins_code"] = fixmedins_code inputData["hi_rxno"] = cFYLJG006.HiRxno inputData["mdtrt_id"] = cFYLJG006.MdtrtID inputData["psn_cert_type"] = cFYLJG006.PsnCertType inputData["certno"] = cFYLJG006.Certno inputData["psn_name"] = cFYLJG006.PsnName inputData2["rx_chk_info"] =inputData inputMessage["input"] = inputData2 var inputLog string bytesData, err := json.Marshal(inputMessage) inputLog = 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") var url string if fixmedins_code == "H15049901371" { url = gdyb_url } else { url = gdyb_url + "CFYLJG006" } //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/1101" 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(), "" } fmt.Println(string(respBytes)) str := string(respBytes) return str, inputLog } func GetCFYLJG007(org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, cFYLJG007 models.CFYLJG007) (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) inputData := make(map[string]interface{}) inputData2 := make(map[string]interface{}) //inputDatas := make([]map[string]interface{}, 0) inputMessage["infno"] = "CFYLJG007" inputData["fixmedins_code"] = fixmedins_code inputData["hi_rxno"] = cFYLJG007.HiRxno inputData["mdtrt_id"] = cFYLJG007.MdtrtID inputData["psn_no"] = cFYLJG007.PsnNo inputData["psn_cert_type"] = cFYLJG007.PsnCertType inputData["certno"] = cFYLJG007.Certno inputData["psn_name"] = cFYLJG007.PsnName inputData2["rx_setl_query"] = inputData inputMessage["input"] = inputData2 var inputLog string bytesData, err := json.Marshal(inputMessage) inputLog = 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") var url string if fixmedins_code == "H15049901371" { url = gdyb_url } else { url = gdyb_url + "CFYLJG007" } //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/1101" 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(), "" } fmt.Println(string(respBytes)) str := string(respBytes) return str, inputLog } func GetCFYLJG008(org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, cFYLJG008 models.CFYLJG008) (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) inputData := make(map[string]interface{}) //inputData2 := make(map[string]interface{}) //inputDatas := make([]map[string]interface{}, 0) inputMessage["infno"] = "CFYLJG008" inputData["pageNum"] = cFYLJG008.PageNum inputData["pageSize"] = cFYLJG008.PageSize inputData["orderType"] = cFYLJG008.OrderType inputData["poolareaNo"] = cFYLJG008.PoolareaNo inputData["fixmedinsName"] = cFYLJG008.FixmedinsName inputData["lng"] = cFYLJG008.Lng inputData["lat"] = cFYLJG008.Lat inputData["medinsProdInvChgDDTOList"] = cFYLJG008.MedList inputMessage["input"] = inputData var inputLog string bytesData, err := json.Marshal(inputMessage) inputLog = 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") var url string if fixmedins_code == "H15049901371" { url = gdyb_url } else { url = gdyb_url + "CFYLJG007" } //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/1101" 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(), "" } fmt.Println(string(respBytes)) str := string(respBytes) return str, inputLog } func Getflow(id int64) (flow models.HisPrescriptionFlow, err error) { err = readDb.Model(&models.HisPrescriptionFlow{}).Where("id = ?", id).First(&flow).Error return }