123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748 |
- 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
- }
|