123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831 |
- package service
-
- import (
- "bytes"
- "encoding/json"
- "fmt"
- "gdyb/models"
-
- "github.com/astaxie/beego"
- "io/ioutil"
- "net/http"
- "strconv"
- "time"
- )
-
- // 人员基本信息
- func Gdyb4201A(org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, struct4201A models.Struct4201A) (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"] = "4201A" // 交易编码
-
- for _, item := range struct4201A.Fopfd {
-
- }
-
- inputData["fixmedins_mdtrt_id"] = ""
- inputData["med_type"] = ""
- inputData["bkkp_sn"] = ""
- inputData["fee_ocur_time"] = ""
- inputData["fixmedins_code"] = ""
- inputData["fixmedins_name"] = ""
- inputData["cnt"] = ""
- inputData["pric"] = ""
- inputData["det_item_fee_sumamt"] = ""
- inputData["med_list_codg"] = ""
- inputData["medins_list_name"] = ""
- inputData["medins_list_code"] = ""
-
- inputData["med_chrgitm_type"] = ""
- inputData["prodname"] = ""
- inputData["bilg_dept_codg"] = ""
- inputData["bilg_dept_name"] = ""
- inputData["bilg_dr_code"] = ""
- inputData["bilg_dr_name"] = ""
- inputData["acord_dept_codg"] = ""
- inputData["acord_dept_name"] = ""
- inputData["acord_dr_code"] = ""
- inputData["acord_dr_name"] = ""
- inputData["tcmdrug_used_way"] = ""
- inputData["etip_flag"] = ""
- inputData["etip_hosp_code"] = ""
- inputData["dscg_tkdrug_flag"] = ""
- inputData["sin_dos_dscr"] = ""
- inputData["used_frqu_dscr"] = ""
- inputData["prd_days"] = ""
- inputData["medc_way_dscr"] = ""
- inputData["memo"] = ""
- inputData["fulamt_ownpay_amt"] = ""
- inputData["overlmt_selfpay"] = ""
- inputData["preselfpay_amt"] = ""
- inputData["inscp_amt"] = ""
-
- input["data"] = inputData
- inputMessage["input"] = input //交易输入
-
- 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 + "1101"
- }
-
- //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 Gdyb4202(org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, struct4202 models.Struct4202) (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"] = "4202" // 交易编码
-
- feedetail := make([]map[string]interface{}, 0)
-
- inputData["fixmedins_mdtrt_id"] = struct4202.OwnPayPatnMdtrtD.FixmedinsMdtrtID
- inputData["fixmedins_code"] = struct4202.OwnPayPatnMdtrtD.FixmedinsCode
- inputData["fixmedins_name"] = struct4202.OwnPayPatnMdtrtD.FixmedinsName
-
- inputData["psn_cert_type"] = struct4202.OwnPayPatnMdtrtD.PsnCertType
-
- inputData["certno"] = struct4202.OwnPayPatnMdtrtD.Certno
- inputData["psn_name"] = struct4202.OwnPayPatnMdtrtD.PsnName
-
- inputData["gend"] = ""
- inputData["naty"] = ""
- inputData["brdy"] = ""
- inputData["age"] = ""
- inputData["coner_name"] = ""
- inputData["tel"] = ""
-
- inputData["addr"] = ""
- inputData["begntime"] = struct4202.OwnPayPatnMdtrtD.Begntime
- inputData["endtime"] = ""
- inputData["med_type"] = struct4202.OwnPayPatnMdtrtD.MedType
- inputData["ipt_otp_no"] = ""
- inputData["medrcdno"] = ""
- inputData["chfpdr_code"] = ""
- inputData["adm_dept_dscr"] = ""
- inputData["adm_dept_codg"] = ""
- inputData["adm_dept_name"] = ""
- inputData["adm_bed"] = ""
- inputData["wardarea_bed"] = ""
- inputData["traf_dept_flag"] = ""
- inputData["dscg_maindiag_code"] = ""
- inputData["dscg_dept_codg"] = ""
- inputData["dscg_dept_name"] = ""
- inputData["dscg_bed"] = ""
- inputData["dscg_way"] = ""
- inputData["main_cond_dscr"] = ""
- inputData["dise_no"] = ""
- inputData["dise_name"] = ""
- inputData["oprn_oprt_code"] = ""
- inputData["oprn_oprt_name"] = ""
-
- inputData["otp_diag_info"] = ""
- inputData["inhosp_stas"] = ""
- inputData["die_date"] = ""
- inputData["ipt_days"] = ""
- inputData["fpsc_no"] = ""
-
- inputData["matn_type"] = ""
- inputData["birctrl_type"] = ""
- inputData["latechb_flag"] = ""
- inputData["geso_val"] = ""
- inputData["fetts"] = ""
-
- inputData["fetus_cnt"] = ""
- inputData["pret_flag"] = ""
- inputData["prey_time"] = ""
- inputData["birctrl_matn_date"] = ""
- inputData["cop_flag"] = ""
- inputData["vali_flag"] = "1"
- inputData["memo"] = ""
- inputData["opter_id"] = ""
- inputData["opter_name"] = ""
- inputData["opt_time"] = ""
- inputData["chfpdr_name"] = ""
- inputData["dscg_maindiag_name"] = ""
- inputData["medfee_sumamt"] = struct4202.OwnPayPatnMdtrtD.MedfeeSumamt
- inputData["elec_bill_code"] = ""
- inputData["elec_billno_code"] = ""
- inputData["exp_content"] = ""
-
- for index, item := range struct4202.ODiagListD {
- feedetailInfo := make(map[string]interface{})
- feedetailInfo["inout_diag_type"] = item.InoutDiagType
- feedetailInfo["diag_type"] = item.DiagType // 就诊 ID(来自2201接口返回)
- feedetailInfo["maindiag_flag"] = item.MaindiagFlag // 人员编号 (来自1101接口返回)
- feedetailInfo["diag_srt_no"] = index // 收费批次号
- feedetailInfo["diag_code"] = item.DiagCode // 病种编码
- feedetailInfo["diag_name"] = "" // 处方号
- feedetailInfo["diag_dept"] = ""
- feedetailInfo["diag_dr_code"] = ""
- feedetailInfo["diag_dr_name"] = ""
- feedetailInfo["diag_time"] = ""
- feedetailInfo["vali_flag"] = "1"
- feedetail = append(feedetail, feedetailInfo)
- }
-
- inputData["ownPayPatnDiagListD"] = feedetail
-
- input["data"] = inputData
- inputMessage["input"] = input //交易输入
-
- 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 + "4202"
- }
-
- //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 Gdyb4203(org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, fixmedins_mdtrt_id 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"] = "4203" // 交易编码
- inputData["fixmedins_mdtrt_id"] = fixmedins_mdtrt_id // 开始时间
- inputData["fixmedins_code"] = fixmedins_code // 开始时间
- inputData["cplt_flag"] = "1" // 人员姓名
- 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 + "4203"
- }
-
- //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 Gdyb4204(certNo string, org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, id_card_type int64, card_sn string, certificates string, psn_name 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{})
- feedetail := make([]map[string]interface{}, 0)
-
- inputMessage["infno"] = "4204" // 交易编码
- inputData["fixmedins_mdtrt_id"] = ""
- inputData["fixmedins_code"] = ""
-
- feedetailInfo := make(map[string]interface{})
- feedetailInfo["bkkp_sn"] = ""
- feedetail = append(feedetail, feedetailInfo)
- input["feedetl"] = feedetail
- input["feedetail"] = inputData
- inputMessage["input"] = input //交易输入
-
- 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 + "1101"
- }
-
- //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 Gdyb4205(certNo string, org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, id_card_type int64, card_sn string, certificates string, psn_name 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"] = "4205" // 交易编码
-
- inputData["fixmedins_mdtrt_id"] = ""
- inputData["fixmedins_code"] = ""
- inputData["fixmedins_name"] = ""
-
- inputData["psn_cert_type"] = ""
-
- inputData["certno"] = ""
- inputData["psn_name"] = ""
-
- inputData["gend"] = ""
- inputData["naty"] = ""
- inputData["brdy"] = ""
- inputData["age"] = ""
- inputData["coner_name"] = ""
- inputData["tel"] = ""
-
- inputData["addr"] = ""
- inputData["begntime"] = ""
- inputData["endtime"] = ""
- inputData["med_type"] = ""
- inputData["main_cond_dscr"] = ""
- inputData["dise_codg"] = ""
- inputData["dise_name"] = ""
- inputData["birctrl_type"] = ""
- inputData["birctrl_matn_date"] = ""
- inputData["matn_type"] = ""
- inputData["geso_val"] = ""
- inputData["elec_bill_code"] = ""
- inputData["elec_billno_code"] = ""
-
- inputData["elec_bill_chkcode"] = ""
-
- inputData["exp_content"] = ""
-
- diagInfos := make([]map[string]interface{}, 0)
-
- diagInfo := make(map[string]interface{})
- diagInfo["diag_type"] = "" // 就诊 ID(来自2201接口返回)
- diagInfo["diag_srt_no"] = "" // 收费批次号
- diagInfo["diag_code"] = "" // 病种编码
- diagInfo["diag_name"] = "" // 处方号
- diagInfo["diag_dept"] = ""
- diagInfo["diag_dr_code"] = ""
- diagInfo["diag_dr_name"] = ""
- diagInfo["diag_time"] = ""
- diagInfo["vali_flag"] = ""
- diagInfos = append(diagInfos, diagInfo)
- inputData["diseinfo"] = diagInfos
-
- feedetail := make([]map[string]interface{}, 0)
- feedetailInfo := make(map[string]interface{})
- feedetailInfo["fixmedins_mdtrt_id"] = "" // 就诊 ID(来自2201接口返回)
- feedetailInfo["med_type"] = "" // 收费批次号
- feedetailInfo["bkkp_sn"] = "" // 病种编码
- feedetailInfo["fee_ocur_time"] = "" // 处方号
- feedetailInfo["fixmedins_code"] = ""
- feedetailInfo["fixmedins_name"] = ""
- feedetailInfo["cnt"] = ""
- feedetailInfo["pric"] = ""
- feedetailInfo["det_item_fee_sumamt"] = ""
- feedetailInfo["medins_list_codg"] = ""
- feedetailInfo["medins_list_name"] = ""
- feedetailInfo["med_chrgitm_type"] = ""
- feedetailInfo["prodname"] = ""
- feedetailInfo["bilg_dept_codg"] = ""
- feedetailInfo["bilg_dept_name"] = ""
-
- feedetailInfo["bilg_dr_code"] = ""
- feedetailInfo["bilg_dr_name"] = ""
- feedetailInfo["acord_dept_codg"] = ""
- feedetailInfo["acord_dept_name"] = ""
- feedetailInfo["acord_dr_code"] = ""
- feedetailInfo["acord_dr_name"] = ""
-
- feedetailInfo["tcmdrug_used_way"] = ""
- feedetailInfo["etip_flag"] = ""
- feedetailInfo["etip_hosp_code"] = ""
-
- feedetailInfo["dscg_tkdrug_flag"] = ""
- feedetailInfo["sin_dos_dscr"] = ""
- feedetailInfo["used_frqu_dscr"] = ""
- feedetailInfo["prd_days"] = ""
- feedetailInfo["medc_way_dscr"] = ""
- feedetailInfo["memo"] = ""
-
- feedetailInfo["fulamt_ownpay_amt"] = ""
- feedetailInfo["overlmt_selfpay"] = ""
- feedetailInfo["preselfpay_amt"] = ""
- feedetailInfo["inscp_amt"] = ""
- feedetailInfo["rxno"] = ""
-
- feedetail = append(feedetail, feedetailInfo)
- inputData["feedetail"] = feedetail
-
- input["data"] = inputData
- inputMessage["input"] = input //交易输入
-
- 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 + "1101"
- }
-
- //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 Gdyb4206(certNo string, org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, id_card_type int64, card_sn string, certificates string, psn_name 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"] = "4206" // 交易编码
- inputData["fixmedins_mdtrt_id"] = "" // 开始时间
- inputData["fixmedins_code"] = "" // 开始时间
- input["input"] = inputData // 开始时间
- inputMessage["input"] = input //交易输入
-
- 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 + "1101"
- }
-
- //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 Gdyb4207(certNo string, org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, id_card_type int64, card_sn string, certificates string, psn_name 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"] = "4207" // 交易编码
-
- inputData["fixmedins_mdtrt_id"] = "" // 开始时间
- inputData["fixmedins_code"] = "" // 人员姓名
- inputData["page_num"] = "" // 人员姓名
- inputData["page_size"] = "" // 人员姓名
-
- input["input"] = inputData
- inputMessage["input"] = input //交易输入
-
- 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 + "1101"
- }
-
- //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 Gdyb4208(certNo string, org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, id_card_type int64, card_sn string, certificates string, psn_name 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"] = "4208" // 交易编码
-
- inputData["psn_cert_type"] = "" // 开始时间
- inputData["certno"] = "" // 人员姓名
- inputData["psn_name"] = "" // 人员姓名
- inputData["begintime"] = "" // 人员姓名
- inputData["endtime"] = "" // 人员姓名
- inputData["med_type"] = "" // 人员姓名
- inputData["medfee_sumamt"] = "" // 人员姓名
- inputData["elec_billno_code"] = "" // 人员姓名
- inputData["page_num"] = "" // 人员姓名
- inputData["page_size"] = "" // 人员姓名
-
- input["input"] = inputData
- inputMessage["input"] = input //交易输入
-
- 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 + "1101"
- }
-
- //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 Gdyb4209(certNo string, org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, id_card_type int64, card_sn string, certificates string, psn_name 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"] = "4209" // 交易编码
-
- inputData["fixmedins_mdtrt_id"] = "" // 开始时间
- inputData["fixmedins_code"] = "" // 人员姓名
- inputData["page_num"] = "" // 人员姓名
- inputData["page_size"] = "" // 人员姓名
-
- input["input"] = inputData
- inputMessage["input"] = input //交易输入
-
- 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 + "1101"
- }
-
- //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
-
- }
|