1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334 |
- package service
-
- import (
- "bytes"
- "encoding/json"
- "fmt"
- "gdyb/models"
- "github.com/astaxie/beego"
- "github.com/axgle/mahonia"
- "io/ioutil"
- "net/http"
- "os/exec"
- "strconv"
- "strings"
- "time"
- "encoding/xml"
- "github.com/go-ole/go-ole/oleutil"
- "github.com/go-ole/go-ole"
- "regexp"
-
- )
-
- type Charset string
-
- const (
- UTF8 = Charset("UTF-8")
- GB18030 = Charset("GB18030")
- )
-
- func ConvertToString(src string, srcCode string, tagCode string) string {
- srcCoder := mahonia.NewDecoder(srcCode)
- srcResult := srcCoder.ConvertString(src)
- tagCoder := mahonia.NewDecoder(tagCode)
- _, cdata, _ := tagCoder.Translate([]byte(srcResult), true)
- result := string(cdata)
- return result
- }
-
- // 人员基本信息
- func Hbyb1101(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) (string, string) {
- //生成签名
- nonce := GetRandomString(32)
- timestamp := time.Now().Unix()
- //生成输入报文
- 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"] = "1101" // 交易编码
-
- if certificates == "3" {
- inputData["mdtrt_cert_type"] = "99" // 就诊凭证类型
- inputData["certno"] = certNo // 证件号码
- inputData["psn_cert_type"] = "99" // 人员证件类型
-
- } else {
- if id_card_type == 1 {
- inputData["mdtrt_cert_type"] = "03" // 就诊凭证类型
- inputData["card_sn"] = "" // 卡识别码
- inputData["certno"] = "" // 证件号码
- inputData["psn_cert_type"] = "" // 人员证件类型
-
- } else if id_card_type == 4 {
- inputData["mdtrt_cert_type"] = "01" // 就诊凭证类型
- inputData["card_sn"] = "" // 卡识别码
- inputData["certno"] = "" // 证件号码
- inputData["psn_cert_type"] = "" // 人员证件类型
-
- } else {
- inputData["mdtrt_cert_type"] = "02" // 就诊凭证类型
- inputData["card_sn"] = "" // 卡识别码
- inputData["certno"] = certNo // 证件号码
- inputData["psn_cert_type"] = "01" // 人员证件类型
- }
- }
-
- inputData["mdtrt_cert_no"] = certNo // 就诊凭证编号
- inputData["begntime"] = "" // 开始时间
- inputData["psn_name"] = "" // 人员姓名
- 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(), ""
- }
-
-
- out := GetoleInfo("1101",string(bytesData))
- aa := ""
- // Regular expression to find JSON part
- re := regexp.MustCompile(`\{.*\}`)
-
- // Find the first match
- match := re.Find([]byte(ConvertToString(string(out), "gbk", "utf-8")))
-
- if match != nil {
- // Convert bytes to string
- jsonStr := string(match)
-
- // Parse JSON
- var jsonData interface{}
- err := json.Unmarshal([]byte(jsonStr), &jsonData)
- if err != nil {
- fmt.Println("Error parsing JSON:", err)
- } else {
- // Print formatted JSON
- jsonBytes, err := json.MarshalIndent(jsonData, "", " ")
- if err != nil {
- fmt.Println("Error formatting JSON:", err)
- } else {
- aa = string(jsonBytes)
- //fmt.Println(string(jsonBytes))
- }
- }
- } else {
- fmt.Println("No valid JSON found in the input string.")
- }
- return aa, ConvertToString(string(bytesData), "gbk", "utf-8")
-
- }
-
- // 门诊挂号
- func Hbyb2201(psnNo string, insutype string, certNo string, org_name string, doctor 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, opter string, doctor_name string) (string, string) {
- // 生成签名
- nonce := GetRandomString(32)
- timestamp := time.Now().Unix()
-
- tempTime := time.Unix(timestamp, 0)
- timeFormatOne := tempTime.Format("2006-01-02 15:04:05")
-
- // 生成输入报文
- inputMessage := SetInputMessage(nonce, timestamp, org_name, opter, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
- 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"] = certNo // 就诊凭证编号
- } else if id_card_type == 4 {
- inputData["mdtrt_cert_type"] = "01" // 就诊凭证类型
- inputData["mdtrt_cert_no"] = certNo // 就诊凭证编号
- } else {
- inputData["mdtrt_cert_type"] = "03" // 就诊凭证类型
- 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" // 科别
-
- 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(), ""
- }
- out := GetoleInfo("2201",string(bytesData))
-
- //var json2 string
- //cmd := exec.Command("java", "-jar", "yh_hb_fat.jar", "2201", string(bytesData), json2)
- //out, err := cmd.Output()
- //if err != nil {
- // fmt.Println("error:", err.Error())
- //}
- fmt.Println(string(out))
-
-
- return string(out), requestLog
-
- }
-
- // 门诊挂号撤销
- func Hbyb2202(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) (string, string) {
- // 生成签名
- nonce := GetRandomString(32)
- timestamp := time.Now().Unix()
-
- // 生成输入报文
- 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"] = "2202" // 交易编码
- inputData["psn_no"] = psnNo // 人员编号 (来自1101接口返回)
- inputData["mdtrt_id"] = mdtrtId // 就诊 ID(来自2201接口返回)
- inputData["ipt_otp_no"] = ipt_otp_no // 住院/门诊号
-
- 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(), ""
- }
- out := GetoleInfo("2202",string(bytesData))
-
- //var json2 string
- //cmd := exec.Command("java", "-jar", "yh_hb_fat.jar", "2202", string(bytesData), json2)
- //out, err := cmd.Output()
- //if err != nil {
- // fmt.Println("error:", err.Error())
- //}
- //fmt.Println(string(out))
-
- return string(out), requestLog
-
- }
-
- // 门诊就诊信息上传
- func Hbyb2203(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, doctor_name string, opter string) (string, string) {
- // 生成签名
- nonce := GetRandomString(32)
- timestamp := time.Now().Unix()
- tempTime := time.Unix(timestamp, 0)
- timeFormatOne := tempTime.Format("2006-01-02 15:04:05")
-
- // 生成输入报文
- inputMessage := SetInputMessage(nonce, timestamp, org_name, opter, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
- input := make(map[string]interface{})
- inputData := make(map[string]interface{})
- diseinfo := make([]map[string]interface{}, 0)
-
- inputMessage["infno"] = "2203" // 交易编码
- inputData["mdtrt_id"] = mdtrtId // 就诊 ID(来自2201接口返回)
- inputData["psn_no"] = psnNo // 人员编号 (来自1101接口返回)
- //inputData["med_type"] = med_type // 医疗类别 16门诊特殊病
- inputData["begntime"] = begin_time // 开始时间
- //inputData["begntime"] = // 开始时间
- inputData["main_cond_dscr"] = "" // 主要病情描述
- inputData["dise_codg"] = sick_code // 病种编码
- inputData["dise_name"] = sick_name // 病种名称
- inputData["birctrl_type"] = "" // 计划生育手术类别
- inputData["birctrl_matn_date"] = "" // 计划生育手术或生育日期
-
- if insuplc_admdvs == "421300" {
- if med_type == "11" || med_type == "1111" || med_type == "1112" {
- inputData["med_type"] = "110104" // 医疗类别 11 普通门诊 12 门诊挂号
- } else if med_type == "14" {
- inputData["med_type"] = "14" // 医疗类别 11 普通门诊 12 门诊挂号
- }
- } else {
- inputData["med_type"] = med_type // 医疗类别 11 普通门诊 12 门诊挂号
- }
-
- 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_name // 诊断医生姓名
- diseinfo_sun["diag_time"] = timeFormatOne // 诊断时间
- diseinfo_sun["vali_flag"] = "1" // 有效标志
- diseinfo = append(diseinfo, diseinfo_sun)
- }
-
- 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(), ""
- }
- //
- //var json2 string
- //cmd := exec.Command("java", "-jar", "yh_hb_fat.jar", "2203", string(bytesData), json2)
- //out, err := cmd.Output()
- //if err != nil {
- // fmt.Println("error:", err.Error())
- //}
- //fmt.Println(string(out))
- out := GetoleInfo("2203",string(bytesData))
-
- return out, requestLog
-
- }
-
- // 门诊费用明细信息上传
- func Hbyb2204(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, opter string) (string, string) {
- // 生成签名
- nonce := GetRandomString(32)
- timestamp := time.Now().Unix()
- //tempTime := time.Unix(timestamp, 0)
- //timeFormat := tempTime.Format("20060102150405")
- //timeFormatOne := tempTime.Format("2006-01-02 15:04:05")
- //chrgBchno := rand.Intn(100000) + 10000
-
- var customs []*Custom
-
- for _, item := range hisPrescription {
- tm := time.Unix(item.PreTime, 0)
-
- 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("%.2f", subItem.Price*subItem.PrescribingNumber),
- Cut: fmt.Sprintf("%.2f", subItem.PrescribingNumber),
- FeedetlSn: subItem.FeedetlSn,
- Price: fmt.Sprintf("%.2f", subItem.Price),
- MedListCodg: subItem.BaseDrugLib.MedicalInsuranceNumber,
- HospApprFlag: subItem.BaseDrugLib.HospApprFlag,
- FeeOcurTime: tm.Format("2006-01-02 15:04:05"),
- }
-
- 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("%.2f", subItem.Price*cnt),
- Cut: fmt.Sprintf("%.2f", cnt),
- FeedetlSn: subItem.FeedetlSn,
- Price: fmt.Sprintf("%.2f", float64(subItem.Price)),
- MedListCodg: subItem.HisProject.MedicalCode,
- HospApprFlag: -1,
- 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("%.2f", subItem.Price*cnt),
- Cut: fmt.Sprintf("%.2f", cnt),
- FeedetlSn: subItem.FeedetlSn,
- Price: fmt.Sprintf("%.2f", float64(subItem.Price)),
- MedListCodg: subItem.GoodInfo.MedicalInsuranceNumber,
- HospApprFlag: -1,
- 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("%.2f", subItem.Price*float64(subItem.Count)),
- Cut: fmt.Sprintf("%.2f", float64(subItem.Count)),
- FeedetlSn: subItem.FeedetlSn,
- Price: fmt.Sprintf("%.2f", float64(subItem.Price)),
- MedListCodg: subItem.XtHisAddtionConfig.Code,
- HospApprFlag: -1,
- }
- customs = append(customs, cus)
- }
- }
- }
-
- // 生成输入报文
- inputMessage := SetInputMessage(nonce, timestamp, org_name, opter, 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{})
- feedetailInfo["feedetl_sn"] = item.FeedetlSn
- feedetailInfo["mdtrt_id"] = mdtrtId // 就诊 ID(来自2201接口返回)
- feedetailInfo["psn_no"] = psnNo // 人员编号 (来自1101接口返回)
- feedetailInfo["chrg_bchno"] = chrg_bchno // 收费批次号
- feedetailInfo["dise_codg"] = "" // 病种编码
- 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"] = doctor // 开单医师姓名
- feedetailInfo["acord_dept_codg"] = "" // 受单科室编码
- feedetailInfo["acord_dept_name"] = "" // 受单科室名称
- feedetailInfo["orders_dr_code"] = "" // 受单医生编码
- feedetailInfo["orders_dr_name"] = "" // 受单医生姓名
- if balance_accounts_type == "8" {
- feedetailInfo["hosp_appr_flag"] = "2" // 医院审批标志
- } else {
-
- if item.HospApprFlag != -1 {
- if item.HospApprFlag == 1 {
- feedetailInfo["hosp_appr_flag"] = "0" // 医院审批标志
- } else if item.HospApprFlag == 2 {
- feedetailInfo["hosp_appr_flag"] = "1" // 医院审批标志
- } else if item.HospApprFlag == 3 {
- feedetailInfo["hosp_appr_flag"] = "2" // 医院审批标志
- } 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"] = "" // 生育费用标志
- feedetail = append(feedetail, feedetailInfo)
- }
- input["feedetail"] = feedetail
- inputMessage["input"] = input //交易输入
- var requestLog string
- bytesData, err := json.Marshal(inputMessage)
- fmt.Println("----------")
- fmt.Println(string(bytesData))
- fmt.Println("----------")
- requestLog = string(bytesData)
- if err != nil {
- fmt.Println(err.Error())
- return "", ""
- }
-
- //var json2 string
- //cmd := exec.Command("java", "-jar", "yh_hb_fat.jar", "2204", string(bytesData), json2)
- //out, err := cmd.Output()
- //if err != nil {
- // fmt.Println("error:", err.Error())
- //}
- //fmt.Println(string(out))
- out := GetoleInfo("2204",string(bytesData))
-
- return out, requestLog
-
-
- }
-
- // 门诊费用明细信息撤销
- func Hbyb2205(psnNo string, mdtrtId string, chrgBchno string, org_name string, doctor string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, fixmedins_code string) (string, string) {
- // 生成签名
- nonce := GetRandomString(32)
- timestamp := time.Now().Unix()
-
- 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"] = chrgBchno // 收费批次号(来自2204生成的)
- inputData["psn_no"] = psnNo // 人员编号 (来自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(), ""
- }
-
- //var json2 string
- //cmd := exec.Command("java", "-jar", "yh_hb_fat.jar", "2205", string(bytesData), json2)
- //out, err := cmd.Output()
- //if err != nil {
- // fmt.Println("error:", err.Error())
- //}
- //fmt.Println(string(out))
-
- out := GetoleInfo("2205",string(bytesData))
-
- return out, requestLog
-
- }
-
- // 门诊预结算
- //func Hbyb2206(psnNo string, mdtrtId string, chrgBchno string, certNo string, insutype string, total string, org_name string, doctor string, secret_key string) string {
- func Hbyb2206(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) (string, string) {
-
- // 生成签名
- nonce := GetRandomString(32)
- timestamp := time.Now().Unix()
-
- // 生成输入报文
- 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"] = certNo // 就诊凭证编号
- } 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" || med_type == "1111" || med_type == "1112" {
- inputData["med_type"] = "110104" // 医疗类别 11 普通门诊 12 门诊挂号
- } else if med_type == "14" {
- inputData["med_type"] = "14" // 医疗类别 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"] = "" // 发票号
-
- 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(), ""
- }
-
- //var json2 string
- //cmd := exec.Command("java", "-jar", "yh_hb_fat.jar", "2206", string(bytesData), json2)
- //out, err := cmd.Output()
- //if err != nil {
- // fmt.Println("error:", err.Error())
- //}
- //fmt.Println(string(out))
- out := GetoleInfo("2206",string(bytesData))
-
- return out, requestLog
-
- }
-
- // 门诊结算
- func Hbyb2207(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 int64) (string, string) {
- // 生成签名
- nonce := GetRandomString(32)
- timestamp := time.Now().Unix()
- // 生成输入报文
- 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"] = certNo // 就诊凭证编号
- } else {
- if id_card_type == 1 {
- inputData["mdtrt_cert_type"] = "" // 就诊凭证类型
- inputData["mdtrt_cert_no"] = "" // 就诊凭证编号
- } 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" || med_type == "1111" || med_type == "1112" {
- inputData["med_type"] = "110104" // 医疗类别 11 普通门诊 12 门诊挂号
- } else if med_type == "14" {
- inputData["med_type"] = "14" // 医疗类别 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"] = "" // 发票号
-
- inputData["fulamt_ownpay_amt"] = fulamt_ownpay_amt //
- inputData["overlmt_selfpay"] = overlmt_selfpay //
- inputData["preselfpay_amt"] = preselfpay_amt //
- inputData["inscp_scp_amt"] = inscp_scp_amt //
-
- 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(), ""
- }
-
- //var json2 string
- //cmd := exec.Command("java", "-jar", "yh_hb_fat.jar", "2207", string(bytesData), json2)
- //out, err := cmd.Output()
- //if err != nil {
- // fmt.Println("error:", err.Error())
- //}
- mjson, _ := json.Marshal(inputMessage)
- str2 := string(mjson)
-
- out := GetoleInfo("2207",string(bytesData))
-
-
- return out, str2
-
- }
-
- // 门诊结算撤销
- func Hbyb2208(psnNo string, mdtrtId string, setlId string, org_name string, doctor string, secret_key string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string) (string, string) {
- // 生成签名
- nonce := GetRandomString(32)
- timestamp := time.Now().Unix()
-
- // 生成输入报文
- 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
-
- 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(), ""
- }
-
- //var json2 string
- //cmd := exec.Command("java", "-jar", "yh_hb_fat.jar", "2208", string(bytesData), json2)
- //out, err := cmd.Output()
- //if err != nil {
- // fmt.Println("error:", err.Error())
- //}
- mjson, _ := json.Marshal(inputMessage)
- str2 := string(mjson)
- //fmt.Println(string(out))
- out := GetoleInfo("2208",string(bytesData))
- return out, str2
-
- }
-
- func Hbyb5203(baseParams models.BaseParams, businessParams models.BusinessParams, med_type string) string {
- // 生成签名
- nonce := GetRandomString(32)
- timestamp := time.Now().Unix()
-
- // 生成输入报文
- inputMessage := SetInputMessage(nonce, timestamp, baseParams.OrgName, baseParams.Doctor, baseParams.FixmedinsCode, baseParams.InsuplcAdmdvs, baseParams.MdtrtareaAdmvs)
- input := make(map[string]interface{})
- inputData := make(map[string]interface{})
- inputMessage["infno"] = "YH03" // 交易编码
- inputData["psn_no"] = businessParams.PsnNo
- inputData["setl_id"] = businessParams.SetlId
- inputData["mdtrt_id"] = businessParams.MdtrtId
- inputData["med_type"] = med_type
- fmt.Println(med_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()
- }
-
- //var json2 string
- //cmd := exec.Command("java", "-jar", "yh_hb_fat.jar", "YH03", string(bytesData), json2)
- //out, err := cmd.Output()
- //if err != nil {
- // fmt.Println("error:", err.Error())
- //}
- out := GetoleInfo("YH03",string(bytesData))
-
- //mjson, _ := json.Marshal(inputMessage)
- //str2 := string(mjson)
- fmt.Println(string(out))
-
- return out
- }
-
- func Hbyb5203aa(baseParams models.BaseParams, businessParams models.BusinessParams) string {
- // 生成签名
- nonce := GetRandomString(32)
- timestamp := time.Now().Unix()
- // 生成输入报文
- inputMessage := SetInputMessage(nonce, timestamp, baseParams.OrgName, baseParams.Doctor, baseParams.FixmedinsCode, baseParams.InsuplcAdmdvs, baseParams.MdtrtareaAdmvs)
- input := make(map[string]interface{})
- inputData := make(map[string]interface{})
- inputMessage["infno"] = "5203" // 交易编码
- inputData["psn_no"] = businessParams.PsnNo
- inputData["setl_id"] = businessParams.SetlId
- inputData["mdtrt_id"] = businessParams.MdtrtId
- 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()
- }
-
- var json2 string
- cmd := exec.Command("java", "-jar", "yh_hb_fat.jar", "5203", string(bytesData), json2)
- out, err := cmd.Output()
- if err != nil {
- fmt.Println("error:", err.Error())
- }
- //mjson, _ := json.Marshal(inputMessage)
- //str2 := string(mjson)
- fmt.Println(string(out))
-
- return ConvertToString(string(out), "gbk", "utf-8")
- }
-
- //确认订单
- func Hbyb6201(org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, order models.HisOrder) 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"] = "6201" // 交易编码
-
- inputData["mdtrt_id"] = order.MdtrtId
- inputData["chrg_bchno"] = order.Number
- inputData["psn_no"] = order.PsnNo
- inputData["psn_name"] = order.PsnName
- inputData["psn_cert_type"] = order.PsnCertType
- inputData["certno"] = order.Certno
- inputData["insutype"] = order.Insutype
- inputData["med_type"] = order.MedType
- inputData["medfee_sumamt"] = order.MedfeeSumamt
- inputData["fulamt_ownpay_amt"] = order.FulamtOwnpayAmt
- inputData["overlmt_selfpay"] = order.OverlmtSelfPay
- inputData["preselfpay_amt"] = order.PreselfpayAmt
- inputData["inscp_scp_amt"] = order.InscpScpAmt
- inputData["act_pay_dedc"] = order.ActPayDedc
- inputData["hifp_pay"] = order.HifpPay
- inputData["pool_prop_selfpay"] = order.PoolPropSelfpay
- inputData["cvlserv_pay"] = order.CvlservPay
- inputData["hifes_pay"] = order.HifesPay
- inputData["hifmi_pay"] = order.HifmiPay
- inputData["hifob_pay"] = order.HifobPay
- inputData["maf_pay"] = order.MafPay
- inputData["oth_pay"] = order.OthPay
- inputData["fund_pay_sumamt"] = order.FundPaySumamt
- inputData["psn_part_amt"] = order.PsnPartAmt
- inputData["acct_pay"] = order.AcctPay
- inputData["psn_cash_pay"] = order.PsnCashPay
- inputData["hosp_part_amt"] = order.HospPartAmt
- inputData["acct_mulaid_pay"] = order.AcctMulaidPay
-
- 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")
-
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/1101"
- url := gdyb_url + "6201"
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/6201"
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/6201"
-
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/2207"
- 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 Gdyb3201( org_name string, doctor string, secret_key string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string) string {
- func Hbyb3201(baseParams models.BaseParams, businessParams models.BusinessParams) string {
- fmt.Println("11222333-----")
-
- fmt.Println(baseParams)
- fmt.Println(businessParams)
- // 生成签名
- nonce := GetRandomString(32)
- timestamp := time.Now().Unix()
- signature := setSignature(timestamp, nonce, baseParams.SecretKey)
-
- // 生成输入报文
- inputMessage := SetInputMessage(nonce, timestamp, baseParams.OrgName, baseParams.Doctor, baseParams.FixmedinsCode, baseParams.InsuplcAdmdvs, baseParams.MdtrtareaAdmvs)
- input := make(map[string]interface{})
- inputData := make(map[string]interface{})
- inputMessage["infno"] = "3201" // 交易编码
- inputData["insutype"] = businessParams.Insutype // 险种
- inputData["clr_type"] = businessParams.ClrType // 就诊 ID(来自2201接口返回)
- inputData["setl_optins"] = baseParams.InsuplcAdmdvs // 结算经办机构
- inputData["stmt_begndate"] = businessParams.StmtBegndate // 对帐开始时间
- inputData["stmt_enddate"] = businessParams.StmtEnddate //对帐结束时间
- inputData["medfee_sumamt"] = businessParams.MedfeeSumamt //医疗费总额
- inputData["fund_pay_sumamt"] = businessParams.FundPaySumamt //基金支付总额
- inputData["acct_pay"] = businessParams.AcctPay //个人账户支付金额
- inputData["fixmedins_setl_cnt"] = businessParams.FixmedinsSetlCnt //定点医药机构结算笔数
- inputData["refd_setl_flag"] = 0 // 就诊 ID(来自2201接口返回)
-
- 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")
-
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/1101"
- url := gdyb_url + "3201"
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/3201"
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/3201"
-
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/3201"
- 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
- }
-
- type Input struct {
- MonSetlAppyID string `xml:"MON_SETL_APPY_ID"`
- FixmedinsNo string `xml:"FIXMEDINS_NO"`
- ClrCnt string `xml:"CLR_CNT"`
- MedfeeSumAmt string `xml:"MEDFEE_SUMAMT"`
- OptinsPaySumAmt string `xml:"OPTINS_PAY_SUMAMT"`
- Begndate string `xml:"BEGNDATE"`
- Enddate string `xml:"ENDDATE"`
- OpterName string `xml:"OPTER_NAME"`
- }
-
- type Inputs struct {
- XMLName xml.Name `xml:"INPUTS"`
- Input Input `xml:"INPUT"`
- }
-
- type Data struct {
- XMLName xml.Name `xml:"DATA"`
- Inputs Inputs `xml:"INPUTS"`
- }
-
-
- func Hbyb1608(baseParams models.BaseParams,cnt string,medfee_sumamt string,start_time string,end_time string,func_t string) string {
-
- // 生成签名
- nonce := GetRandomString(32)
- timestamp := time.Now().Unix()
-
- // 生成输入报文
- inputMessage := SetInputMessage(nonce, timestamp, baseParams.OrgName, baseParams.Doctor, baseParams.FixmedinsCode, baseParams.InsuplcAdmdvs, baseParams.MdtrtareaAdmvs)
- //input := make(map[string]interface{})
- //inputDatas := []make(map[string]interface{})
- //inputDatas := make([]map[string]interface{}, 0)
- data := Data{
- Inputs: Inputs{
- Input: Input{
- MonSetlAppyID: strconv.FormatInt(timestamp, 10) ,
- FixmedinsNo: baseParams.FixmedinsCode,
- ClrCnt: cnt,
- MedfeeSumAmt: medfee_sumamt,
- OptinsPaySumAmt: func_t,
- Begndate: start_time,
- Enddate: end_time,
- OpterName: baseParams.Doctor,
- },
- },
- }
- // 将结构体变量转换为 XML 字符串
- xmlData, err := xml.MarshalIndent(data, "", " ")
- if err != nil {
- fmt.Println("转换为XML失败:", err)
- }
-
- inputMessage["infno"] = "1608" // 交易编码
- inputMessage["input"] = string(xmlData) //交易输入
- bytesData, err := json.Marshal(inputMessage)
- fmt.Println(string(bytesData))
- if err != nil {
- fmt.Println(err.Error())
- return err.Error()
- }
- var json2 string
- cmd := exec.Command("java", "-jar", "yh_hb_fat.jar", "1608", string(bytesData), json2)
- out, err := cmd.Output()
- if err != nil {
- fmt.Println("error:", err.Error())
- }
- fmt.Println(string(out))
- return ConvertToString(string(out), "gbk", "utf-8")
- }
-
-
- func Hbyb3204(baseParams models.BaseParams, id string) string {
- // 生成签名
- nonce := GetRandomString(32)
- timestamp := time.Now().Unix()
-
- // 生成输入报文
- inputMessage := SetInputMessage(nonce, timestamp, baseParams.OrgName, baseParams.Doctor, baseParams.FixmedinsCode, baseParams.InsuplcAdmdvs, baseParams.MdtrtareaAdmvs)
- input := make(map[string]interface{})
- inputData := make(map[string]interface{})
-
- inputMessage["infno"] = "3204" // 交易编码
- inputData["clr_appy_evt_id"] = id // 险种
- input["data"] = inputData
- inputMessage["input"] = input //交易输入
- bytesData, _ := json.Marshal(inputMessage)
- fmt.Println(string(bytesData))
- out := GetoleInfo("3204",string(bytesData))
- fmt.Println(string(out))
- return out
- }
-
-
- func Hbyb8404(baseParams models.BaseParams, month string) string {
- // 生成签名
- nonce := GetRandomString(32)
- timestamp := time.Now().Unix()
-
- // 生成输入报文
- inputMessage := SetInputMessage(nonce, timestamp, baseParams.OrgName, baseParams.Doctor, baseParams.FixmedinsCode, baseParams.InsuplcAdmdvs, baseParams.MdtrtareaAdmvs)
- input := make(map[string]interface{})
- inputData := make(map[string]interface{})
- inputMessage["infno"] = "8404" // 交易编码
- inputData["nurscare_org_no"] = baseParams.FixmedinsCode
- inputData["setl_mon"] = month
- inputData["page_num"] = "1"
- inputData["page_size"] = "10"
- inputData["Longterm_dcla_rea"] = "查询"
- // 险种
- input["data"] = inputData
- inputMessage["input"] = input //交易输入
- bytesData, _ := json.Marshal(inputMessage)
- fmt.Println(string(bytesData))
- out := GetoleInfo("8404",string(bytesData))
- fmt.Println(string(out))
- return out
- }
-
-
-
-
-
-
- func Hbyb3202a(baseParams models.BaseParams, businessParams []*models.BusinessParamsTwo) string {
-
- fmt.Println(baseParams)
- fmt.Println(businessParams)
- // 生成签名
- nonce := GetRandomString(32)
- timestamp := time.Now().Unix()
-
- // 生成输入报文
- inputMessage := SetInputMessage(nonce, timestamp, baseParams.OrgName, baseParams.Doctor, baseParams.FixmedinsCode, baseParams.InsuplcAdmdvs, baseParams.MdtrtareaAdmvs)
- input := make(map[string]interface{})
- //inputDatas := []make(map[string]interface{})
- inputDatas := make([]map[string]interface{}, 0)
-
- inputMessage["infno"] = "3202a" // 交易编码
- for _, item := range businessParams {
- inputData := make(map[string]interface{})
- inputData["insutype"] = "" // 险种
- inputData["clr_type"] = "" // 就诊 ID(来自2201接口返回)
- inputData["setl_optins"] = "420922" // 结算经办机构
- inputData["stmt_begndate"] = item.StmtBegndate // 对帐开始时间
- inputData["stmt_enddate"] = item.StmtEnddate //对帐结束时间
- inputData["fund_pay_sumamt"] = item.FundPaySumamt //基金支付总额
- inputData["acct_pay"] = item.AcctPay //个人账户支付金额
- inputData["med_type"] = "14" //个人账户支付金额
- inputDatas = append(inputDatas, inputData)
- }
- input["clrdata"] = inputDatas
- inputMessage["input"] = input //交易输入
-
- //bytesData, err := json.Marshal(inputMessage)
- bytesData, _ := json.Marshal(inputMessage)
- fmt.Println(string(bytesData))
- out := GetoleInfo("3202a",string(bytesData))
- return out
- }
-
-
- func Hbyb3204a(baseParams models.BaseParams, businessParams []*models.BusinessParamsTwo) string {
-
- fmt.Println(baseParams)
- fmt.Println(businessParams)
- // 生成签名
- nonce := GetRandomString(32)
- timestamp := time.Now().Unix()
-
- // 生成输入报文
- inputMessage := SetInputMessage(nonce, timestamp, baseParams.OrgName, baseParams.Doctor, baseParams.FixmedinsCode, baseParams.InsuplcAdmdvs, baseParams.MdtrtareaAdmvs)
- input := make(map[string]interface{})
- //inputDatas := []make(map[string]interface{})
- inputDatas := make([]map[string]interface{}, 0)
-
- inputMessage["infno"] = "3204a" // 交易编码
- for _, item := range businessParams {
- inputData := make(map[string]interface{})
- inputData["insutype"] = "" // 险种
- inputData["clr_type"] = "" // 就诊 ID(来自2201接口返回)
- inputData["setl_optins"] = "" // 结算经办机构
- inputData["stmt_begndate"] = item.StmtBegndate // 对帐开始时间
- inputData["stmt_enddate"] = item.StmtEnddate //对帐结束时间
- inputData["fund_pay_sumamt"] = item.FundPaySumamt //基金支付总额
- inputData["acct_pay"] = item.AcctPay //个人账户支付金额
- inputData["med_type"] = "14" //个人账户支付金额
- inputDatas = append(inputDatas, inputData)
- }
- input["clrdata"] = inputDatas
- inputMessage["input"] = input //交易输入
-
- //bytesData, err := json.Marshal(inputMessage)
- bytesData, _ := json.Marshal(inputMessage)
- out := GetoleInfo("3204a",string(bytesData))
- fmt.Println(out)
- return out
- }
-
-
-
- func Hbyb3202b(baseParams models.BaseParams, businessParams []*models.BusinessParamsTwo) string {
-
- fmt.Println(baseParams)
- fmt.Println(businessParams)
- // 生成签名
- nonce := GetRandomString(32)
- timestamp := time.Now().Unix()
-
- // 生成输入报文
- inputMessage := SetInputMessage(nonce, timestamp, baseParams.OrgName, baseParams.Doctor, baseParams.FixmedinsCode, baseParams.InsuplcAdmdvs, baseParams.MdtrtareaAdmvs)
- input := make(map[string]interface{})
- //inputDatas := []make(map[string]interface{})
- inputDatas := make([]map[string]interface{}, 0)
-
- inputMessage["infno"] = "3202a" // 交易编码
- for _, item := range businessParams {
- inputData := make(map[string]interface{})
- inputData["insutype"] = "" // 险种
- inputData["clr_type"] = "" // 就诊 ID(来自2201接口返回)
- inputData["setl_optins"] = "" // 结算经办机构
- inputData["stmt_begndate"] = item.StmtBegndate // 对帐开始时间
- inputData["stmt_enddate"] = item.StmtEnddate //对帐结束时间
- inputData["fund_pay_sumamt"] = item.FundPaySumamt //基金支付总额
- inputData["acct_pay"] = item.AcctPay //个人账户支付金额
- inputData["med_type"] = "110104" //个人账户支付金额
- inputDatas = append(inputDatas, inputData)
- }
- input["clrdata"] = inputDatas
- inputMessage["input"] = input //交易输入
-
- bytesData, _ := json.Marshal(inputMessage)
- out := GetoleInfo("3202a",string(bytesData))
- return out
- }
-
-
- func Hbyb5262(baseParams models.BaseParams, businessParams models.BusinessParams5262, page string , limit string) string {
-
- fmt.Println(baseParams)
- fmt.Println(businessParams)
- // 生成签名
- nonce := GetRandomString(32)
- timestamp := time.Now().Unix()
-
- // 生成输入报文
- inputMessage := SetInputMessage(nonce, timestamp, baseParams.OrgName, baseParams.Doctor, baseParams.FixmedinsCode, baseParams.InsuplcAdmdvs, baseParams.MdtrtareaAdmvs)
- input := make(map[string]interface{})
- //inputDatas := []make(map[string]interface{})
-
- inputMessage["infno"] = "5262" // 交易编码
- inputData := make(map[string]interface{})
- inputData["refd_setl_flag"] = businessParams.RefdSetlFlag
- inputData["q_begntime"] = businessParams.QBegntime
- inputData["q_endtime"] = businessParams.QEndtime
- inputData["med_type"] = businessParams.MedType
- inputData["page_num"] = page
- inputData["page_size"] = limit
- inputData["certno"] = businessParams.Certno
- inputData["psnno"] = businessParams.Psnno
- input["data"] = inputData
- inputMessage["input"] = input //交易输入
-
- //bytesData, err := json.Marshal(inputMessage)
- bytesData, _ := json.Marshal(inputMessage)
- out := GetoleInfo("5262",string(bytesData))
- return out
- }
-
- func Hbyb5267(baseParams models.BaseParams, businessParams models.BusinessParams5262, page string , limit string) string {
-
- fmt.Println(baseParams)
- fmt.Println(businessParams)
- // 生成签名
- nonce := GetRandomString(32)
- timestamp := time.Now().Unix()
-
- // 生成输入报文
- inputMessage := SetInputMessage(nonce, timestamp, baseParams.OrgName, baseParams.Doctor, baseParams.FixmedinsCode, baseParams.InsuplcAdmdvs, baseParams.MdtrtareaAdmvs)
- input := make(map[string]interface{})
- //inputDatas := []make(map[string]interface{})
-
- inputMessage["infno"] = "5267" // 交易编码
- inputData := make(map[string]interface{})
- inputData["refd_setl_flag"] = businessParams.RefdSetlFlag
- inputData["q_begntime"] = businessParams.QBegntime
- inputData["q_endtime"] = businessParams.QEndtime
- inputData["med_type"] = businessParams.MedType
- inputData["page_num"] = page
- inputData["page_size"] = limit
- input["data"] = inputData
- inputMessage["input"] = input //交易输入
-
- //bytesData, err := json.Marshal(inputMessage)
-
- //bytesData, err := json.Marshal(inputMessage)
- bytesData, _ := json.Marshal(inputMessage)
- out := GetoleInfo("5267",string(bytesData))
- return out
- }
-
- //文件上传
-
- //文件上传
- func Hbyb9101(baseParams models.BaseParams, file_name string, file_byte []byte) string {
-
- // 生成签名
- nonce := GetRandomString(32)
- timestamp := time.Now().Unix()
- signature := setSignature(timestamp, nonce, baseParams.SecretKey)
-
- buf := new(bytes.Buffer)
- buf.ReadFrom(strings.NewReader(string(file_byte)))
-
- inputMessage := SetInputMessage(nonce, timestamp, baseParams.OrgName, baseParams.Doctor, baseParams.FixmedinsCode, baseParams.InsuplcAdmdvs, baseParams.MdtrtareaAdmvs)
- input := make(map[string]interface{})
- inputData := make(map[string]interface{})
-
- inputMessage["infno"] = "9101" // 交易编码
- inputData["file_name"] = file_name //文件名
- inputData["in"] = file_byte //文件数据
- inputData["fixmedins_code"] = baseParams.FixmedinsCode //编码
-
- input["fsUploadIn"] = 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/9101"
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/9101"
-
- 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 + "9101"
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/9101"
- 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 Hbyb9102(baseParams models.BaseParams, file_name string, file_qury_no string) string {
-
- // 生成签名
- nonce := GetRandomString(32)
- timestamp := time.Now().Unix()
- signature := setSignature(timestamp, nonce, baseParams.SecretKey)
- inputMessage := SetInputMessage(nonce, timestamp, baseParams.OrgName, baseParams.Doctor, baseParams.FixmedinsCode, baseParams.InsuplcAdmdvs, baseParams.MdtrtareaAdmvs)
- input := make(map[string]interface{})
- inputData := make(map[string]interface{})
- inputMessage["infno"] = "9102" // 交易编码
- inputData["file_name"] = file_name //文件名
- inputData["file_qury_no"] = file_qury_no //文件数据
-
- inputData["fixmedins_code"] = baseParams.FixmedinsCode //编码
- input["fsDownloadIn"] = 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")
-
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/1101"
- url := gdyb_url + "9102"
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/9102"
-
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/9102"
-
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/9102"
- 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 Hbyb3202(baseParams models.BaseParams, businessParams models.BusinessParams) string {
- // 生成签名
- nonce := GetRandomString(32)
- timestamp := time.Now().Unix()
- //signature := setSignature(timestamp, nonce, baseParams.SecretKey)
-
- // 生成输入报文
- inputMessage := SetInputMessage(nonce, timestamp, baseParams.OrgName, baseParams.Doctor, baseParams.FixmedinsCode, baseParams.InsuplcAdmdvs, baseParams.MdtrtareaAdmvs)
- input := make(map[string]interface{})
- inputData := make(map[string]interface{})
- inputMessage["infno"] = "3202" // 交易编码
- inputData["file_qury_no"] = businessParams.FileQuryNo // 险种
- inputData["setl_optins"] = "" // 结算经办机构
- inputData["stmt_begndate"] = businessParams.StmtBegndate // 对帐开始时间
- inputData["stmt_enddate"] = businessParams.StmtEnddate //对帐结束时间
- inputData["medfee_sumamt"] = businessParams.MedfeeSumamt //医疗费总额
- inputData["fund_pay_sumamt"] = businessParams.FundPaySumamt //基金支付总额
- inputData["cash_payamt"] = businessParams.CashPayamt //现金支付金额
- inputData["fixmedins_setl_cnt"] = businessParams.FixmedinsSetlCnt //定点医药机构结算笔数
- inputData["clr_type"] = "11" // 就诊 ID(来自2201接口返回)
- inputData["refd_setl_flag"] = 1 // 就诊 ID(来自2201接口返回)
-
- input["data"] = inputData
- inputMessage["input"] = input //交易输入
- //mjson, _ := json.Marshal(inputMessage)
- //str2 := string(mjson)
- bytesData, _ := json.Marshal(inputMessage)
- fmt.Println(string(bytesData))
- out := GetoleInfo("3202",string(bytesData))
- return out
- }
-
- //func Hbyb2001(baseParams models.BaseParams, psn_no string, insutype string, med_type string) string {
- // // 生成签名
- // nonce := GetRandomString(32)
- // timestamp := time.Now().Unix()
- // signature := setSignature(timestamp, nonce, baseParams.SecretKey)
- //
- // // 生成输入报文
- // inputMessage := SetInputMessage(nonce, timestamp, baseParams.OrgName, baseParams.Doctor, baseParams.FixmedinsCode, baseParams.InsuplcAdmdvs, baseParams.MdtrtareaAdmvs)
- // input := make(map[string]interface{})
- // inputData := make(map[string]interface{})
- // inputMessage["infno"] = "2001" // 交易编码
- // inputData["psn_no"] = psn_no
- // inputData["insutype"] = insutype
- // inputData["med_type"] = med_type
- // inputData["begntime"] = "2021-01-01 00:00:00"
- // 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/3301"
- //
- // 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 + "2001"
- // //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/3301"
- // 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 Hbyb3301(baseParams *models.BaseParams, name string, codg string, list_type_code string, start_time string, ent_time string, list_type string) string {
- // 生成签名
- nonce := GetRandomString(32)
- timestamp := time.Now().Unix()
- signature := setSignature(timestamp, nonce, baseParams.SecretKey)
-
- // 生成输入报文
- inputMessage := SetInputMessage(nonce, timestamp, baseParams.OrgName, baseParams.Doctor, baseParams.FixmedinsCode, baseParams.InsuplcAdmdvs, baseParams.MdtrtareaAdmvs)
- input := make(map[string]interface{})
- inputData := make(map[string]interface{})
- inputMessage["infno"] = "3301" // 交易编码
- inputData["fixmedins_hilist_id"] = codg
- inputData["fixmedins_hilist_name"] = name
- inputData["list_type"] = list_type
- inputData["med_list_codg"] = codg
- inputData["begndate"] = start_time
- inputData["enddate"] = ent_time
-
- inputData["aprvno"] = ""
- inputData["dosform"] = ""
- inputData["exct_cont"] = ""
- inputData["item_cont"] = ""
- inputData["prcunt"] = ""
- inputData["spec"] = ""
- inputData["pacspec"] = ""
- inputData["memo"] = ""
-
- 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/3301"
- //
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/3301"
- 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 + "3301"
- 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 Hbyb3302(baseParams *models.BaseParams, name string, codg string, list_type_code string) string {
- // 生成签名
- nonce := GetRandomString(32)
- timestamp := time.Now().Unix()
- signature := setSignature(timestamp, nonce, baseParams.SecretKey)
-
- // 生成输入报文
- inputMessage := SetInputMessage(nonce, timestamp, baseParams.OrgName, baseParams.Doctor, baseParams.FixmedinsCode, baseParams.InsuplcAdmdvs, baseParams.MdtrtareaAdmvs)
- input := make(map[string]interface{})
- inputData := make(map[string]interface{})
- inputMessage["infno"] = "3302" // 交易编码
- inputData["fixmedins_code"] = baseParams.FixmedinsCode
- inputData["fixmedins_hilist_id"] = codg
- inputData["list_type"] = list_type_code
- inputData["med_list_codg"] = codg
-
- 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/3302"
-
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/3302"
- 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 + "3302"
- 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 Hbyb2505(psnNo string, doctor string, org_name string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, start_time string, end_time 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"] = "2505"
- inputData["psn_no"] = psnNo
- inputData["biz_appy_type"] = "03"
- inputData["begndate"] = start_time
- inputData["enddate"] = end_time
- inputData["fixmedins_code"] = fixmedins_code
- inputData["fixmedins_name"] = org_name
- inputData["tel"] = ""
- inputData["addr"] = ""
- inputData["agnter_name"] = ""
- inputData["agnter_cert_type"] = ""
- inputData["agnter_certno"] = ""
- inputData["agnter_tel"] = ""
- inputData["agnter_addr"] = ""
- inputData["agnter_rlts"] = ""
- inputData["fix_srt_no"] = ""
- inputData["memo"] = ""
- input["data"] = inputData
- inputMessage["input"] = input //交易输入
- bytesData, err := json.Marshal(inputMessage)
- 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/2505"
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/2505"
- 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 + "2505"
-
- 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 Hbyb2506(psnNo string, doctor string, org_name string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, trt_dcla_detl_sn 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"] = "2506"
- inputData["psn_no"] = psnNo
- inputData["trt_dcla_detl_sn"] = trt_dcla_detl_sn
- inputData["memo"] = ""
- 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/2506"
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/2506"
-
- 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 + "2506"
-
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/2203"
- 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 Hbyb2503(psnNo string, insutype string, org_name string, doctor string, fixmedins_code string, doctor_id string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, sick_name string, sick_code 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, doctor, 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"] = fixmedins_code // 险种类型(来自1101接口返回)
- inputData["ide_fixmedins_name"] = org_name // 险种类型(来自1101接口返回)
- inputData["hosp_ide_date"] = timeFormatTwo // 险种类型(来自1101接口返回)
- inputData["diag_dr_codg"] = doctor_id // 开始时间
- inputData["diag_dr_name"] = doctor // 开始时间
- inputData["begndate"] = timeFormatTwo // 医师编码
- inputData["tel"] = "" // 医师编码
- inputData["addr"] = "" // 医师编码
- inputData["enddate"] = tm.Format("2006-01-02") // 医师编码
-
- 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"
-
- 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 Hbyb2504(psnNo string, org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, trt_dcla_detl_sn 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"] = "2504" // 交易编码
- inputData["psn_no"] = psnNo // 人员编号 (来自1101接口返回)
- inputData["trt_dcla_detl_sn"] = trt_dcla_detl_sn // 人员编号 (来自1101接口返回)
- inputData["memo"] = "撤销备案" // 人员编号 (来自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/2504"
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/2504"
- 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 + "2504"
- 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 Gdyb2503(psnNo string, doctor string, department string, diag string, org_name string, med_type string, doctor_id int64, fixmedins_code string, diag_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, sick_code string, sick_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")
- //
- // // 生成输入报文
- // inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
- // input := make(map[string]interface{})
- // inputData := make(map[string]interface{})
- // diseinfo := make([]map[string]interface{}, 0)
- //
- // inputMessage["infno"] = "2203" // 交易编码
- // inputData["mdtrt_id"] = mdtrtId // 就诊 ID(来自2201接口返回)
- // inputData["psn_no"] = psnNo // 人员编号 (来自1101接口返回)
- // inputData["med_type"] = med_type // 医疗类别 16门诊特殊病
- // inputData["begntime"] = timeFormatOne // 开始时间
- // inputData["main_cond_dscr"] = "" // 主要病情描述
- // inputData["dise_codg"] = sick_code // 病种编码
- // inputData["dise_name"] = sick_name // 病种名称
- // inputData["birctrl_type"] = "" // 计划生育手术类别
- // inputData["birctrl_matn_date"] = "" // 计划生育手术或生育日期
- //
- // diseinfo_sun := make(map[string]interface{})
- // diseinfo_sun["diag_type"] = "1" // 诊断类别
- // diseinfo_sun["diag_srt_no"] = "1" // 诊断排序号
- // diseinfo_sun["diag_code"] = diag_code // 诊断代码
- // diseinfo_sun["diag_name"] = diag // 诊断名称
- // 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)
- // input["diseinfo"] = diseinfo
- // input["mdtrtinfo"] = 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/2203"
- //
- // //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/2203"
- // 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", "sg03_prd")
- // 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 Hbyb5301(psnNo string, insutype string, org_name string, doctor string, fixmedins_code string, doctor_id string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, sick_name string, sick_code string) string {
- // 生成签名
- nonce := GetRandomString(32)
- timestamp := time.Now().Unix()
-
- //tempTime := time.Unix(timestamp, 0)
- //timeFormatOne := tempTime.Format("2006-01-02 15:04:05")
-
- //timeFormatTwo := tempTime.Format("2006-01-02")
-
- // 生成输入报文
- 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"] = "5301" // 交易编码
- inputData["psn_no"] = psnNo // 人员编号 (来自1101接口返回)
- input["data"] = inputData
- inputMessage["input"] = input //交易输入
-
-
- bytesData, err := json.Marshal(inputMessage)
- //inputLog = string(bytesData)
- fmt.Println(string(bytesData))
- if err != nil {
- fmt.Println(err.Error())
- return err.Error()
- }
-
- out := GetoleInfo("5301",string(bytesData))
- return out
- //return ConvertToString(string(out), "gbk", "utf-8")
-
- }
-
- //
- func Hbyb4101(struct4101 Struct4101, secret_key string, org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string) (string, string) {
- // 生成签名
- nonce := GetRandomString(32)
- timestamp := time.Now().Unix()
-
- // 生成输入报文
- 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"] = "4101" // 交易编码
-
- year := time.Now().Format("2006")
- month := time.Now().Format("01")
- day := time.Now().Format("02")
-
- inputData["mdtrt_id"] = struct4101.MdtrtId // 就诊 ID 必填(来自2201接口返回)
- inputData["setl_id"] = struct4101.SetlId // 结算 ID 必填
- inputData["psn_no"] = struct4101.PsnNo // 结算 ID 必填
-
- inputData["fixmedins_name"] = org_name // 定点医药机构名称 必填
- inputData["fixmedins_code"] = fixmedins_code // 定点医药机构编码 必填
- inputData["hi_setl_lv"] = "" // 医保结算等级
- inputData["hi_no"] = struct4101.PsnNo // 医保编号
- inputData["medcasno"] = struct4101.PsnNo // 病案号 必填
- inputData["dcla_time"] = year + "-" + month + "-" + day // 申报时间 必填
- inputData["psn_name"] = struct4101.PsnName // 人员姓名 必填
- inputData["gend"] = struct4101.Gend // 性别 必填
- inputData["brdy"] = struct4101.Brdy // 出生日期 必填
- inputData["age"] = struct4101.Age // 年龄 必填
- inputData["ntly"] = struct4101.Ntly // 国籍 必填
- inputData["nwb_age"] = "" // 年龄 必填
- inputData["naty"] = struct4101.Naty // 民族 必填
- inputData["patn_cert_type"] = struct4101.PatnCertType // 患者证件类别 必填
- inputData["certno"] = struct4101.Certno // 证件号码 必填
- inputData["prfs"] = struct4101.Prfs // 职业 必填
- inputData["curr_addr"] = "" // 现住址 必填
- inputData["emp_name"] = "" // 单位名称 必填
- inputData["emp_addr"] = "" // 单位地址 必填
- inputData["emp_tel"] = "" // 单位电话 必填
- inputData["poscode"] = "" // 邮编 必填
- inputData["coner_name"] = struct4101.ConerName // 联系人姓名 必填
- inputData["patn_rlts"] = struct4101.PatnRlts // 与患者关系 必填
- inputData["coner_addr"] = struct4101.ConerAddr // 联系人地址 必填
- inputData["coner_tel"] = struct4101.ConerTel // 联系人电话 必填
- inputData["hi_type"] = struct4101.HiType // 医保类型 必填
- inputData["insuplc"] = struct4101.Insuplc // 参保地 必填
- inputData["sp_psn_type"] = "" // 特殊人员类型 必填
- inputData["nwb_adm_type"] = "" // 新生儿入院类型 必填
- inputData["nwb_bir_wt"] = "" // 新生儿出生体重 必填
- inputData["nwb_adm_wt"] = "" // 新生儿入院体重 必填
- inputData["opsp_diag_caty"] = "" // 门诊慢特病诊断 必填
- inputData["opsp_mdtrt_date"] = "" // 门诊慢特病就诊日期 必填
- inputData["ipt_med_type"] = struct4101.IptMedType // 住院医疗类型 必填
- inputData["adm_way"] = "" // 入院途径 必填
- inputData["trt_type"] = "" // 治疗类别 必填
- inputData["adm_time"] = struct4101.AdmTime // 入院时间 必填
- inputData["adm_caty"] = struct4101.AdmCaty // 入院科别 必填
- inputData["refldept_dept"] = "" // 转科科别 必填
- inputData["dscg_time"] = struct4101.AdmEndTime // 出院时间 必填
- inputData["dscg_caty"] = struct4101.AdmCaty // 出院科别 必填
- inputData["act_ipt_days"] = "" // 实际住院天数 必填
- inputData["otp_wm_dise"] = "" // 门(急) 诊西医诊断 必填
- inputData["wm_dise_code"] = "" // 门(急) 诊中医诊断 必填
- inputData["otp_tcm_dise"] = "" // 西医诊断疾病代码 必填
- inputData["tcm_dise_code"] = "" // 中医诊断代码 必填
- inputData["oprn_oprt_code_cnt"] = "" // 手术操作代码计数 必填
- inputData["vent_used_dura"] = "" // 呼吸机使用时长 必填
- inputData["pwcry_bfadm_coma_dura"] = "" // 颅脑损伤患者入院前昏迷时长 必填
- inputData["pwcry_afadm_coma_dura"] = "" // 颅脑损伤患者入院后昏迷时长 必填
- inputData["bld_cat"] = "" // 输血品种 必填
- inputData["bld_amt"] = "" // 输血量 必填
- inputData["bld_unt"] = "" // 输血计量单位 必填
- inputData["spga_nurscare_days"] = "" // 特级护理天数 必填
- inputData["lv1_nurscare_days"] = "" // 一级护理天数 必填
- inputData["scd_nurscare_days"] = "" // 二级护理天数 必填
- inputData["lv3_nurscare_days"] = "" // 三级护理天数 必填
- inputData["acp_medins_name"] = "" // 拟接收机构名称 必填
- inputData["acp_optins_code"] = "" // 拟接收机构代码 必填
- inputData["bill_code"] = struct4101.BillCode // 票据代码 必填
- inputData["bill_no"] = struct4101.BillNo // 票据号码 必填
- inputData["biz_sn"] = struct4101.BizSn // 业务流水号 必填
- inputData["days_rinp_flag_31"] = "" // 出院 31 天内再住院计划标志 必填
- inputData["days_rinp_pup_31"] = "" // 出院 31 天内再住院目的 必填
- inputData["chfpdr_name"] = "" // 主诊医师姓名 必填
- inputData["chfpdr_code"] = "" // 主诊医师代码 必填
- inputData["setl_begn_date"] = struct4101.SetlBegnDate // 结算开始日期 必填
- inputData["setl_end_date"] = struct4101.SetlEndDate // 结算结束日期 必填
- inputData["psn_selfpay"] = struct4101.PsnSelfPay // 个人自付 必填
- inputData["psn_ownpay"] = struct4101.PsnOwnPay // 个人自费 必填
- inputData["acct_pay"] = struct4101.AcctPay // 个人账户支出 必填
- inputData["hi_paymtd"] = struct4101.HiPaymtd // 医保支付方式 必填
- inputData["hsorg"] = struct4101.Hsorg // 医保机构 必填
- inputData["hsorg_opter"] = struct4101.HsorgOpter // 医保机构经办人 必填
- inputData["medins_fill_dept"] = struct4101.MedinsFillDept // 医疗机构填报部门 必填
- inputData["medins_fill_psn"] = struct4101.MedinsFillPsn // 医疗机构填报人 必填
- inputData["psn_cashpay"] = struct4101.PsnCashpay // 医疗机构填报人 必填
-
- payinfo := make([]map[string]interface{}, 0) // 基金支付信息
- for _, item := range struct4101.CustomStruct {
- payinfotemp := make(map[string]interface{})
- if item.FundPayType == "310100" || item.FundPayType == "310200" || item.FundPayType == "320100" || item.FundPayType == "330100" || item.FundPayType == "340100" || item.FundPayType == "350100" || item.FundPayType == "370100" || item.FundPayType == "390100" || item.FundPayType == "610100" || item.FundPayType == "640100" || item.FundPayType == "620100" {
- payinfotemp["fund_pay_type"] = item.FundPayType // 基金支付类型 必填
- payinfotemp["fund_payamt"] = item.FundPayamt // 基金支付金额
- payinfo = append(payinfo, payinfotemp)
- }
- }
- opspdiseinfo := make([]map[string]interface{}, 0) // 门诊慢特病诊断信息
-
- opspdiseinfotemp := make(map[string]interface{})
- opspdiseinfotemp["diag_name"] = struct4101.OpspdiseinfoStruct[len(struct4101.OpspdiseinfoStruct)-1].DiagName // 诊断名称 必填
- opspdiseinfotemp["diag_code"] = struct4101.OpspdiseinfoStruct[len(struct4101.OpspdiseinfoStruct)-1].DiagCode // 诊断代码 必填
- opspdiseinfotemp["oprn_oprt_name"] = struct4101.OpspdiseinfoStruct[len(struct4101.OpspdiseinfoStruct)-1].DiagName // 手术操作名称 必填
- opspdiseinfotemp["oprn_oprt_code"] = struct4101.OpspdiseinfoStruct[len(struct4101.OpspdiseinfoStruct)-1].DiagCode // 手术操作代码 必填
- opspdiseinfo = append(opspdiseinfo, opspdiseinfotemp)
-
- diseinfo := make([]map[string]interface{}, 0) // 住院诊断信息
- for _, item := range struct4101.Diseinfo {
- diseinfotemp := make(map[string]interface{})
- diseinfotemp["maindiag_flag"] = item.MaindiagFlag // 手术操作代码 必填
- diseinfotemp["diag_type"] = item.DiagType // 诊断类别 必填
- diseinfotemp["diag_code"] = item.DiagCode // 诊断代码 必填
- diseinfotemp["diag_name"] = item.DiagName // 诊断名称 必填
- diseinfotemp["adm_cond_type"] = "3" // 入院病情类型 必填
- diseinfo = append(diseinfo, diseinfotemp)
- }
-
- iteminfo := make([]map[string]interface{}, 0)
- for _, item := range struct4101.IteminfoStruct {
- iteminfotemp := make(map[string]interface{})
- iteminfotemp["med_chrgitm"] = item.MedChrgitm // 医疗收费项目 必填
- iteminfotemp["amt"] = item.Amt // 金额 必填
- iteminfotemp["claa_sumfee"] = item.ClaaSumfee // 甲类费用合计 必填
- iteminfotemp["clab_amt"] = item.ClabAmt // 乙类金额 必填
- iteminfotemp["fulamt_ownpay_amt"] = item.FulamtOwnpayAmt // 全自费金额 必填
- iteminfotemp["oth_amt"] = item.OthAmt // 其他金额 必填
- iteminfo = append(iteminfo, iteminfotemp)
- }
-
- oprninfo := make([]map[string]interface{}, 0) // 手术操作信息
- oprninfotemp := make(map[string]interface{})
- oprninfotemp["oprn_oprt_type"] = "" // 手术操作类别 必填
- oprninfotemp["oprn_oprt_name"] = "" // 手术操作名称 必填
- oprninfotemp["oprn_oprt_code"] = "" // 手术操作代码 必填
- oprninfotemp["oprn_oprt_date"] = "" // 手术操作日期 必填
- oprninfotemp["anst_way"] = "" // 麻醉方式 必填
- oprninfotemp["oper_dr_name"] = "" // 术者医师姓名 必填
- oprninfotemp["oper_dr_code"] = "" // 术者医师代码 必填
- oprninfotemp["anst_dr_name"] = "" // 麻醉医师姓名 必填
- oprninfotemp["anst_dr_code"] = "" // 麻醉医师代码 必填
- oprninfo = append(oprninfo, oprninfotemp)
-
- icuinfo := make([]map[string]interface{}, 0) // 重症监护信息
- icuinfotemp := make(map[string]interface{})
- icuinfotemp["scs_cutd_ward_type"] = "" // 重症监护病房类型 必填
- icuinfotemp["scs_cutd_inpool_time"] = "" // 重症监护进入时间 必填
- icuinfotemp["scs_cutd_exit_time"] = "" // 重症监护退出时间 必填
- icuinfotemp["scs_cutd_sum_dura"] = "" // 重症监护合计时长 必填
- icuinfo = append(icuinfo, icuinfotemp)
-
- input["setlinfo"] = inputData
- input["payinfo"] = payinfo
- input["opspdiseinfo"] = opspdiseinfo
- input["diseinfo"] = diseinfo
- input["iteminfo"] = iteminfo
- inputMessage["input"] = input //交易输入
-
- bytesData, err := json.Marshal(inputMessage)
- fmt.Println(string(bytesData))
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- var json2 string
- cmd := exec.Command("java", "-jar", "yh_hb_fat.jar", "4101A", string(bytesData), json2)
- out, err := cmd.Output()
- if err != nil {
- fmt.Println("error:", err.Error())
- }
-
- fmt.Println(string(out))
- return ConvertToString(string(out), "gbk", "utf-8"), string(bytesData)
- }
-
- //func Gdyb1201(psnNo string, org_name string, doctor string) string {
- // // 生成签名
- // nonce := GetRandomString(32)
- // timestamp := time.Now().Unix()
- // signature := setSignature(timestamp, nonce)
- //
- // // 生成输入报文
- // inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, "")
- // input := make(map[string]interface{})
- // inputData := make(map[string]interface{})
- // inputMessage["infno"] = "1201" // 交易编码
- // inputData["fixmedins_type"] = psnNo // 人员编号 (来自1101接口返回)
- // inputData["fixmedins_name"] = org_name // 人员编号 (来自1101接口返回)
- // inputData["fixmedins_code"] = "" // 人员编号 (来自1101接口返回)
- //
- // input["medinsinfo"] = 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_inf/poc/hsa/hgs/1201"
- // 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", "test_hosp")
- // 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 Gdyb5203(certNo string, org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key 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"] = "5203" // 交易编码
- //
- // inputData["fixmedins_type"] = "1"
- // inputData["fixmedins_name"] = org_name
- // inputData["fixmedins_code"] = fixmedins_code
- // input["medinsinfo"] = 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/1201"
- // //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/1201"
- // //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", "sg03_prd")
- // 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
- //}
-
- func Hbyb2601(psnNo string, omsgid string, oinfno string, org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key 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"] = "2601" // 交易编码
- inputData["psn_no"] = psnNo
- inputData["omsgid"] = omsgid
- inputData["oinfno"] = oinfno
-
- 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")
- url := gdyb_url + "2601"
- 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
- }
-
- //人员信息版本3
- func Hbyb1101B(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 int64) 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"] = "1101" // 交易编码
-
- if certificates == 3 {
- inputData["mdtrt_cert_type"] = "99" // 就诊凭证类型
- inputData["certno"] = certNo // 证件号码
- inputData["psn_cert_type"] = "99" // 人员证件类型
-
- } else {
- if id_card_type == 1 {
- inputData["mdtrt_cert_type"] = "03" // 就诊凭证类型
- inputData["card_sn"] = "" // 卡识别码
- inputData["certno"] = certNo // 证件号码
- inputData["psn_cert_type"] = "01" // 人员证件类型
-
- } else {
- inputData["mdtrt_cert_type"] = "02" // 就诊凭证类型
- inputData["card_sn"] = "" // 卡识别码
- inputData["certno"] = certNo // 证件号码
- inputData["psn_cert_type"] = "1" // 人员证件类型
- }
- }
-
- inputData["mdtrt_cert_no"] = certNo // 就诊凭证编号
- inputData["begntime"] = "" // 开始时间
- inputData["psn_name"] = "" // 人员姓名
- 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")
-
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/1101"
- url := gdyb_url + "1101"
- fmt.Println(url)
- fmt.Println(gdyb_paasid)
- fmt.Println(secret_key)
- //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
- }
-
- //人员信息版本4
- func Hbyb1101C(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 int64) (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"] = "1101" // 交易编码
-
- if certificates == 3 {
- inputData["mdtrt_cert_type"] = "99" // 就诊凭证类型
- inputData["certno"] = certNo // 证件号码
- inputData["psn_cert_type"] = "99" // 人员证件类型
-
- } else {
- if id_card_type == 1 {
- inputData["mdtrt_cert_type"] = "03" // 就诊凭证类型
- inputData["card_sn"] = "" // 卡识别码
- inputData["certno"] = "" // 证件号码
- inputData["psn_cert_type"] = "" // 人员证件类型
-
- } else {
- inputData["mdtrt_cert_type"] = "02" // 就诊凭证类型
- inputData["card_sn"] = "" // 卡识别码
- inputData["certno"] = certNo // 证件号码
- inputData["psn_cert_type"] = "1" // 人员证件类型
- }
- }
-
- inputData["mdtrt_cert_no"] = "" // 就诊凭证编号
- inputData["begntime"] = "" // 开始时间
- inputData["psn_name"] = "" // 人员姓名
- 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(), ""
- }
- var json2 string
- cmd := exec.Command("java", "-jar", "yh_hb_fat.jar", "1101", string(bytesData), json2)
- out, err := cmd.Output()
- if err != nil {
- fmt.Println("error:", err.Error())
- }
- fmt.Println(string(out))
- return string(out), string(bytesData)
- }
-
- func Hbyb90991(psn_no string, org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, pwd 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"] = "90991" // 交易编码
-
- inputData["fixmedins_code"] = fixmedins_code // 就诊凭证编号
- inputData["psn_no"] = psn_no // 开始时间
- inputData["card_pwd"] = pwd // 人员姓名
- 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")
-
- url := gdyb_url + "90991"
- 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
- }
- func Hbyb90100(psn_no string, org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key 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"] = "90100" // 交易编码
- inputData["psn_no"] = psn_no // 开始时间
- 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")
-
- url := gdyb_url + "90100"
- 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
- }
-
- //func StrPtr(s string) uintptr {
- // return uintptr(unsafe.Pointer(syscall.StringBytePtr(s)))
- //}
-
- func Hbyb2001(secret_key string, org_name string, doctor_name string, code string, insuplcAdmdvs string, mdtrtareaAdmvs string, psn_no string, insutype string, med_type string) (string, string) {
- if med_type == "1111" || med_type == "1112" {
- med_type = "11"
- }
-
- // 生成签名
- 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, doctor_name, code, insuplcAdmdvs, mdtrtareaAdmvs)
- input := make(map[string]interface{})
- inputData := make(map[string]interface{})
- inputMessage["infno"] = "2001" // 交易编码
- inputData["psn_no"] = psn_no
- inputData["insutype"] = insutype
- inputData["med_type"] = med_type
- inputData["begntime"] = timeFormatOne
- 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(), ""
- }
- var json2 string
- cmd := exec.Command("java", "-jar", "yh_hb_fat.jar", "1101", string(bytesData), json2)
- out, err := cmd.Output()
- if err != nil {
- fmt.Println("error:", err.Error())
- }
-
- return string(out), string(bytesData)
- }
-
-
- // 住院登记
- func Hbyb2401(struct2401 Struct2401, secret_key string, org_name string, fixmedins_code string, doctor string, insuplc_admdvs string, mdtrtarea_admvs 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, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
- input := make(map[string]interface{})
- inputData := make(map[string]interface{})
- inputMessage["infno"] = "2401" // 交易编码
- inputData["psn_no"] = struct2401.PsnNo // 人员编号 (来自1101接口返回)
- inputData["insutype"] = struct2401.Insutype // 险种类型(来自1101接口返回)
- inputData["tel"] = ""
- inputData["coner_name"] = ""
- inputData["begntime"] = struct2401.Begntime // 开始时间
- inputData["mdtrt_cert_type"] = struct2401.MdtrtCertType // 就诊凭证类型
- inputData["mdtrt_cert_no"] = struct2401.MdtrtCertNo // 就诊凭证编号
- inputData["med_type"] = struct2401.MedType // 就诊凭证编号
- inputData["ipt_no"] = struct2401.IptNo // 住院/门诊号
- inputData["medrcdno"] = ""
- inputData["atddr_no"] = struct2401.AtddrNo
- inputData["chfpdr_name"] = struct2401.ChfpdrName
- inputData["adm_diag_dscr"] = struct2401.AdmDiagDscr
- inputData["adm_dept_codg"] = struct2401.AdmDeptCodg
- inputData["adm_dept_name"] = struct2401.AdmDeptName
- inputData["adm_bed"] = struct2401.AdmBed
- inputData["dscg_maindiag_code"] = struct2401.DscgMaindiagCode
- inputData["dscg_maindiag_name"] = struct2401.DscgMaindiagName
- inputData["main_cond_dscr"] = ""
- inputData["dise_codg"] = struct2401.DiseCodg
- inputData["dise_name"] = struct2401.DiseName
- inputData["oprn_oprt_code"] = ""
- inputData["oprn_oprt_name"] = ""
- inputData["fpsc_no"] = ""
- inputData["matn_type"] = ""
- inputData["birctrl_type"] = ""
- inputData["latechb_flag"] = ""
- inputData["geso_val"] = ""
- inputData["fetts"] = ""
- inputData["fetus_cnt"] = ""
- inputData["pret_flag"] = ""
- inputData["birctrl_matn_date"] = ""
- inputData["dise_type_code"] = ""
-
- inputDataArr := make([]map[string]interface{}, 0)
- for _, item := range struct2401.Diseinfo {
- inputDataTwo := make(map[string]interface{})
- inputDataTwo["psn_no"] = item.PsnNo
- inputDataTwo["diag_type"] = item.DiagType
- inputDataTwo["maindiag_flag"] = item.MaindiagFlag
- inputDataTwo["diag_srt_no"] = item.DiagSrtNo
- inputDataTwo["diag_code"] = item.DiagCode
- inputDataTwo["diag_name"] = item.DiagName
- inputDataTwo["adm_cond"] = ""
- inputDataTwo["diag_dept"] = item.DiagDept
- inputDataTwo["dise_dor_no"] = item.DiseDorNo
- inputDataTwo["dise_dor_name"] = item.DiseDorName
- inputDataTwo["diag_time"] = item.DiagTime
- inputDataArr = append(inputDataArr, inputDataTwo)
- }
- input["mdtrtinfo"] = inputData
- input["diseinfo"] = inputDataArr
- inputMessage["input"] = input //交易输入
-
- bytesData, err := json.Marshal(inputMessage)
- fmt.Println(string(bytesData))
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- var json2 string
- cmd := exec.Command("java", "-jar", "yh_hb_fat.jar", "2401", string(bytesData), json2)
- out, err := cmd.Output()
-
- //decoder := simplifiedchinese.GBK.NewDecoder()
- //utf8Bytes, _ := decoder.Bytes([]byte(string(out)))
- //fmt.Println(string(utf8Bytes)) // 输出:中文
-
- if err != nil {
- fmt.Println("error:", err.Error())
- }
-
- return ConvertToString(string(out), "gbk", "utf-8"), ConvertToString(string(bytesData), "gbk", "utf-8")
- }
-
-
- //住院撤销
- func Hbyb2404(mdtrt_id string, psn_no string, secret_key string, org_name string, fixmedins_code string, doctor string, insuplc_admdvs string, mdtrtarea_admvs string) (string, string) {
- // 生成签名
- nonce := GetRandomString(32)
- timestamp := time.Now().Unix()
-
- // 生成输入报文
- 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"] = "2404" // 交易编码
- inputData["mdtrt_id"] = mdtrt_id // 人员编号 (来自1101接口返回)
- inputData["psn_no"] = psn_no // 人员编号 (来自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(), ""
- }
- var json2 string
- cmd := exec.Command("java", "-jar", "yh_hb_fat.jar", "2404", string(bytesData), json2)
- out, err := cmd.Output()
- if err != nil {
- fmt.Println("error:", err.Error())
- }
- return ConvertToString(string(out), "gbk", "utf-8"), ConvertToString(string(bytesData), "gbk", "utf-8")
-
- //return string(out), string(bytesData)
- }
-
- //出院撤销
- func Hb2405(mdtrt_id string, psn_no string, secret_key string, org_name string, fixmedins_code string, doctor string, insuplc_admdvs string, mdtrtarea_admvs string) (string, string) {
- // 生成签名
- nonce := GetRandomString(32)
- timestamp := time.Now().Unix()
-
-
- // 生成输入报文
- 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"] = "2405" // 交易编码
- inputData["mdtrt_id"] = mdtrt_id // 人员编号 (来自1101接口返回)
- inputData["psn_no"] = psn_no // 人员编号 (来自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(), ""
- }
- var json2 string
- cmd := exec.Command("java", "-jar", "yh_hb_fat.jar", "2405", string(bytesData), json2)
- out, err := cmd.Output()
- if err != nil {
- fmt.Println("error:", err.Error())
- }
- return ConvertToString(string(out), "gbk", "utf-8"), ConvertToString(string(bytesData), "gbk", "utf-8")
-
- //return string(out), string(bytesData)
- }
-
- // 出院
- func Hb2402(struct2402 Struct2402, org_name string, doctor string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, fixmedins_code string) (string, string) {
-
- // 生成签名
- nonce := GetRandomString(32)
- timestamp := time.Now().Unix()
- //tempTime := time.Unix(timestamp, 0)
- //timeFormatOne := tempTime.Format("2006-01-02 15:04:05")
-
- // 生成输入报文
- 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"] = "2402" // 交易编码
- inputData["mdtrt_id"] = struct2402.MdtrtId // 人员编号 (来自1101接口返回)
- inputData["psn_no"] = struct2402.PsnNo // 人员编号 (来自1101接口返回)
- inputData["insutype"] = struct2402.Insutype // 险种类型(来自1101接口返回)
- inputData["endtime"] = struct2402.Endtime // 结束时间
- inputData["dise_codg"] = struct2402.DiseCode // 就诊凭证类型
-
- inputData["dise_name"] = struct2402.DiseName // 就诊凭证类型
- inputData["oprn_oprt_code"] = "" // 就诊凭证类型
- inputData["oprn_oprt_name"] = "" // 就诊凭证类型
- inputData["fpsc_no"] = "" // 就诊凭证类型
-
- inputData["matn_type"] = "" // 就诊凭证类型
- inputData["birctrl_type"] = "" // 就诊凭证类型
- inputData["latechb_flag"] = "" // 就诊凭证类型
- inputData["geso_val"] = ""
- inputData["fetts"] = ""
- inputData["fetus_cnt"] = ""
- inputData["pret_flag"] = ""
- inputData["birctrl_matn_date"] = ""
- inputData["cop_flag"] = ""
-
- inputData["dscg_dept_codg"] = struct2402.DscgDeptCodg
- inputData["dscg_dept_name"] = struct2402.DscgDeptName
- inputData["dscg_bed"] = "待定"
- inputData["dscg_way"] = struct2402.DscgWay
- inputData["die_date"] = ""
-
- inputDataArr := make([]map[string]interface{}, 0)
- for _, item := range struct2402.Diseinfo {
- inputDataTwo := make(map[string]interface{})
- inputDataTwo["psn_no"] = item.PsnNo
- inputDataTwo["mdtrt_id"] = item.MdtrtId
- inputDataTwo["diag_type"] = item.DiagType
- inputDataTwo["maindiag_flag"] = item.MaindiagFlag
- inputDataTwo["diag_srt_no"] = item.DiagSrtNo
- inputDataTwo["diag_code"] = item.DiagCode
- inputDataTwo["diag_name"] = item.DiagName
- inputDataTwo["diag_dept"] = item.DiagDept
- inputDataTwo["dise_dor_no"] = item.DiseDorNo
- inputDataTwo["dise_dor_name"] = item.DiseDorName
- inputDataTwo["diag_time"] = item.DiagTime
- inputDataArr = append(inputDataArr, inputDataTwo)
- }
-
- input["dscginfo"] = inputData
- input["diseinfo"] = inputDataArr
-
- inputMessage["input"] = input //交易输入
-
- bytesData, err := json.Marshal(inputMessage)
- fmt.Println(string(bytesData))
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- var json2 string
- cmd := exec.Command("java", "-jar", "yh_hb_fat.jar", "2402", string(bytesData), json2)
- out, err := cmd.Output()
- if err != nil {
- fmt.Println("error:", err.Error())
- }
- return ConvertToString(string(out), "gbk", "utf-8"), ConvertToString(string(bytesData), "gbk", "utf-8")
-
- //return string(out), string(bytesData)
- }
-
-
- // 住院费用明细信息上传
- func Hb2301(psnNo string, mdtrtId string, hisPrescription []*models.NewCustom, 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, med_type string, doctor_name string, doctor_number string) (string, string) {
- // 生成签名
- nonce := GetRandomString(32)
- timestamp := time.Now().Unix()
- signature := setSignature(timestamp, nonce, secret_key)
- //tempTime := time.Unix(timestamp, 0)
- //timeFormat := tempTime.Format("20060102150405")
- //timeFormatOne := tempTime.Format("2006-01-02 15:04:05")
- //chrgBchno := rand.Intn(100000) + 10000
-
- var customs []*models.NewCustom
-
- customs = hisPrescription
- // 生成输入报文
- 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"] = "2301" // 交易编码
-
- //chrg_bchno := timeFormat + strconv.FormatInt(int64(chrgBchno), 10)
- for _, item := range customs {
- org_id, _ := beego.AppConfig.Int64("org_id")
- doctor_info, _ := GetAdminUserInfoByID(org_id, item.DoctorId)
-
- feedetailInfo := make(map[string]interface{})
- feedetailInfo["feedetl_sn"] = item.FeedetlSn
- feedetailInfo["mdtrt_id"] = mdtrtId // 就诊 ID(来自2201接口返回)
- feedetailInfo["psn_no"] = psnNo // 人员编号 (来自1101接口返回)
- feedetailInfo["med_type"] = med_type
- 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["bilg_dept_codg"] = dept_code // 开单科室编码
- feedetailInfo["bilg_dept_name"] = dept // 开单科室名称
- feedetailInfo["bilg_dr_codg"] = doctor_info.DoctorNumber // 开单医生编码
- feedetailInfo["bilg_dr_name"] = doctor_info.UserName
- feedetailInfo["acord_dept_codg"] = dept_code // 受单科室编码
- feedetailInfo["acord_dept_name"] = dept // 受单科室名称
- feedetailInfo["orders_dr_code"] = doctor_info.DoctorNumber // 受单医生编码
- feedetailInfo["orders_dr_name"] = doctor_info.UserName // 受单医生姓名
- feedetailInfo["chrg_bchno"] = chrg_bchno // 收费批次号
- feedetailInfo["dise_codg"] = "" // 病种编码
- feedetailInfo["rxno"] = "" // 处方号
- feedetailInfo["rx_circ_flag"] = "0" // 外购处方标志
- feedetailInfo["sin_dos_dscr"] = "" // 单次剂量描述
- feedetailInfo["used_frqu_dscr"] = "" // 使用频次描述
- feedetailInfo["prd_days"] = "0" // 周期天数
- feedetailInfo["medc_way_dscr"] = "" // 用药途径描述
- // 开单医师姓名
-
- if item.HospApprFlag != -1 {
- if item.HospApprFlag == 1 {
- feedetailInfo["hosp_appr_flag"] = "0" // 医院审批标志
- } else if item.HospApprFlag == 2 {
- feedetailInfo["hosp_appr_flag"] = "1" // 医院审批标志
- } else if item.HospApprFlag == 3 {
- feedetailInfo["hosp_appr_flag"] = "2" // 医院审批标志
- } 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"] = "" // 生育费用标志
- feedetail = append(feedetail, feedetailInfo)
- }
- input["feedetail"] = feedetail
- inputMessage["input"] = input //交易输入
-
- bytesData, err := json.Marshal(inputMessage)
- fmt.Println("----------")
- fmt.Println(string(bytesData))
- fmt.Println("----------")
- //requestLog := 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")
- url := gdyb_url + "2301"
- if mdtrtarea_admvs == "150499" {
- url = gdyb_url
- }
- request, err := http.NewRequest("POST", 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 ConvertToString(string(respBytes), "gbk", "utf-8"), ConvertToString(string(bytesData), "gbk", "utf-8")
-
- }
- func Hb2301A(psnNo string, mdtrtId string, hisPrescription []*models.NewCustom, 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, med_type string, opertor string) (string, string) {
- // 生成签名
- nonce := GetRandomString(32)
- timestamp := time.Now().Unix()
-
- //tempTime := time.Unix(timestamp, 0)
- //timeFormat := tempTime.Format("20060102150405")
- //timeFormatOne := tempTime.Format("2006-01-02 15:04:05")
- //chrgBchno := rand.Intn(100000) + 10000
-
- var customs []*models.NewCustom
-
- customs = hisPrescription
- // 生成输入报文
- inputMessage := SetInputMessage(nonce, timestamp, org_name, opertor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
- input := make(map[string]interface{})
- feedetail := make([]map[string]interface{}, 0)
- inputMessage["infno"] = "2301" // 交易编码
-
- //chrg_bchno := timeFormat + strconv.FormatInt(int64(chrgBchno), 10)
- for _, item := range customs {
- feedetailInfo := make(map[string]interface{})
- feedetailInfo["feedetl_sn"] = item.FeedetlSn
- feedetailInfo["mdtrt_id"] = mdtrtId // 就诊 ID(来自2201接口返回)
- feedetailInfo["psn_no"] = psnNo // 人员编号 (来自1101接口返回)
- feedetailInfo["med_type"] = med_type
-
- 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["bilg_dept_codg"] = dept_code // 开单科室编码
- feedetailInfo["bilg_dept_name"] = dept // 开单科室名称
- feedetailInfo["bilg_dr_codg"] = doctor_id // 开单医生编码
- feedetailInfo["bilg_dr_name"] = doctor
- feedetailInfo["acord_dept_codg"] = dept_code // 受单科室编码
- feedetailInfo["acord_dept_name"] = dept // 受单科室名称
- feedetailInfo["orders_dr_code"] = doctor_id // 受单医生编码
- feedetailInfo["orders_dr_name"] = doctor // 受单医生姓名
- feedetailInfo["chrg_bchno"] = chrg_bchno // 收费批次号
- feedetailInfo["dise_codg"] = "" // 病种编码
- feedetailInfo["rxno"] = "" // 处方号
- feedetailInfo["rx_circ_flag"] = "0" // 外购处方标志
- feedetailInfo["sin_dos_dscr"] = "" // 单次剂量描述
- feedetailInfo["used_frqu_dscr"] = "" // 使用频次描述
- feedetailInfo["prd_days"] = "0" // 周期天数
- feedetailInfo["medc_way_dscr"] = "" // 用药途径描述
- // 开单医师姓名
-
- if item.HospApprFlag != -1 {
- if item.HospApprFlag == 1 {
- feedetailInfo["hosp_appr_flag"] = "0" // 医院审批标志
- } else if item.HospApprFlag == 2 {
- feedetailInfo["hosp_appr_flag"] = "1" // 医院审批标志
- } else if item.HospApprFlag == 3 {
- feedetailInfo["hosp_appr_flag"] = "2" // 医院审批标志
- } 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"] = "" // 生育费用标志
- feedetail = append(feedetail, feedetailInfo)
- }
- input["feedetail"] = feedetail
- inputMessage["input"] = input //交易输入
-
- bytesData, err := json.Marshal(inputMessage)
- fmt.Println(string(bytesData))
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- var json2 string
- cmd := exec.Command("java", "-jar", "yh_hb_fat.jar", "2301", string(bytesData), json2)
- out, err := cmd.Output()
- if err != nil {
- fmt.Println("error:", err.Error())
- }
- fmt.Println(string(out))
- return ConvertToString(string(out), "gbk", "utf-8"), ConvertToString(string(bytesData), "gbk", "utf-8")
-
- //return string(out), string(bytesData)
-
- }
- // 住院费用明细信息撤销
- func Hb2302(psnNo string, mdtrtId string, org_name string, doctor string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, fixmedins_code string, number string, refund_type int64) (string, string) {
- // 生成签名
- nonce := GetRandomString(32)
- timestamp := time.Now().Unix()
-
-
- // 生成输入报文
- inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
- input := make(map[string]interface{})
- inputData := make(map[string]interface{})
-
- //inputData := make(map[string]interface{})
- feedetail := make([]map[string]interface{}, 0)
-
- inputMessage["infno"] = "2302" // 交易编码
- if refund_type == 1 {
- inputData["feedetl_sn"] = number //
-
- } else {
- inputData["feedetl_sn"] = "0000" //
- }
-
- inputData["mdtrt_id"] = mdtrtId // 就诊 ID
- inputData["psn_no"] = psnNo // 人员编号
- feedetail = append(feedetail,inputData)
- input["data"] = feedetail
- inputMessage["input"] = input //交易输入
-
- bytesData, err := json.Marshal(inputMessage)
- fmt.Println(string(bytesData))
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- var json2 string
- cmd := exec.Command("java", "-jar", "yh_hb_fat.jar", "2302", string(bytesData), json2)
- out, err := cmd.Output()
- if err != nil {
- fmt.Println("error:", err.Error())
- }
- return ConvertToString(string(out), "gbk", "utf-8"), ConvertToString(string(bytesData), "gbk", "utf-8")
-
- //return string(out), string(bytesData)
- }
- func Hb2303(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, mid_setl_flag string, id_card_type int64, fulamt_ownpay_amt float64, overlmt_selfpay float64, preselfpay_amt float64, inscp_scp_amt float64, certificates int64) (string, string) {
- // 生成签名
- nonce := GetRandomString(32)
- timestamp := time.Now().Unix()
-
- // 生成输入报文
- 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"] = "2303" // 交易编码
- 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"] = certNo // 就诊凭证编号
- } else {
- inputData["mdtrt_cert_type"] = "02" // 就诊凭证类型
- inputData["mdtrt_cert_no"] = certNo // 就诊凭证编号
- }
- }
- inputData["mdtrt_cert_sn"] = ""
- inputData["mid_setl_flag"] = mid_setl_flag // 中途退费标志
- inputData["medfee_sumamt"] = total // 医疗费总额
- inputData["psn_setlway"] = "02" // 个人结算方式 01 按项目结 02 按定额结算
- inputData["mdtrt_id"] = mdtrtId // 就诊 ID(来自2201接口返回)
- inputData["acct_used_flag"] = "1" // 个人账户使用标志 0否 1是
- inputData["insutype"] = insutype // 险种类型
- inputData["invono"] = "" // 发票号
- inputData["dise_codg"] = "M07803" // 发票号
-
- 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(), ""
- }
- var json2 string
- cmd := exec.Command("java", "-jar", "yh_hb_fat.jar", "2303", string(bytesData), json2)
- out, err := cmd.Output()
- if err != nil {
- fmt.Println("error:", err.Error())
- }
-
- return ConvertToString(string(out), "gbk", "utf-8"), ConvertToString(string(bytesData), "gbk", "utf-8")
- }
- // 住院结算
- func Hb2304(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, mid_setl_flag string, id_card_type int64, fulamt_ownpay_amt float64, overlmt_selfpay float64, preselfpay_amt float64, inscp_scp_amt float64, certificates int64, fapiao_number string, acct_used_flag string) (string, string) {
- // 生成签名
- nonce := GetRandomString(32)
- timestamp := time.Now().Unix()
-
- // 生成输入报文
- 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"] = "2304" // 交易编码
- 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"] = certNo // 就诊凭证编号
- } else if id_card_type == 4 {
-
- inputData["mdtrt_cert_type"] = "01" // 就诊凭证类型
- inputData["mdtrt_cert_no"] = certNo // 就诊凭证编号
-
- } else {
- inputData["mdtrt_cert_type"] = "02" // 就诊凭证类型
- inputData["mdtrt_cert_no"] = certNo // 就诊凭证编号
- }
- }
- inputData["mdtrt_cert_sn"] = ""
- inputData["mid_setl_flag"] = mid_setl_flag // 中途退费标志
- inputData["medfee_sumamt"] = total // 医疗费总额
- inputData["psn_setlway"] = "01" // 个人结算方式 01 按项目结 02 按定额结算
- inputData["mdtrt_id"] = mdtrtId // 就诊 ID(来自2201接口返回)
- inputData["acct_used_flag"] = acct_used_flag // 个人账户使用标志 0否 1是
- inputData["insutype"] = insutype // 险种类型
- inputData["invono"] = fapiao_number // 发票号
-
- 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(), ""
- }
- var json2 string
- cmd := exec.Command("java", "-jar", "yh_hb_fat.jar", "2304", string(bytesData), json2)
- out, err := cmd.Output()
- if err != nil {
- fmt.Println("error:", err.Error())
- }
- //if id_card_type == 4 {
- aa := ""
- // Regular expression to find JSON part
- re := regexp.MustCompile(`\{.*\}`)
-
- // Find the first match
- match := re.Find([]byte(ConvertToString(string(out), "gbk", "utf-8")))
-
- if match != nil {
- // Convert bytes to string
- jsonStr := string(match)
-
- // Parse JSON
- var jsonData interface{}
- err := json.Unmarshal([]byte(jsonStr), &jsonData)
- if err != nil {
- fmt.Println("Error parsing JSON:", err)
- } else {
- // Print formatted JSON
- jsonBytes, err := json.MarshalIndent(jsonData, "", " ")
- if err != nil {
- fmt.Println("Error formatting JSON:", err)
- } else {
- aa = string(jsonBytes)
- //fmt.Println(string(jsonBytes))
- }
- }
- } else {
- fmt.Println("No valid JSON found in the input string.")
- }
- return aa, ConvertToString(string(bytesData), "gbk", "utf-8")
- //}else{
-
- //return ConvertToString(string(out), "gbk", "utf-8"), ConvertToString(string(bytesData), "gbk", "utf-8")
- //}
- //return string(out), string(bytesData)
- }
-
- // 住院结算撤销
- func Hb2305(psnNo string, mdtrtId string, setlId string, org_name string, doctor string, secret_key string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs 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"] = "2305" // 交易编码
-
- inputData["psn_no"] = psnNo // 人员编号 (来自1101接口返回)
- inputData["mdtrt_id"] = mdtrtId // 就诊 ID(来自2201接口返回)
- inputData["setl_id"] = setlId // 结算 ID
-
- 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(), ""
- }
- var json2 string
- cmd := exec.Command("java", "-jar", "yh_hb_fat.jar", "2305", string(bytesData), json2)
- out, err := cmd.Output()
- if err != nil {
- fmt.Println("error:", err.Error())
- }
- return ConvertToString(string(out), "gbk", "utf-8"), ConvertToString(string(bytesData), "gbk", "utf-8")
-
- //return string(out), string(bytesData)
- }
-
-
- func GetoleInfo(code string,data string) string {
- ole.CoInitializeEx(0, ole.COINIT_MULTITHREADED)
- defer ole.CoUninitialize()
-
- // Replace with the ProgID or CLSID of your COM object
- progID := "yinhai.yh_hb_sctr"
-
- // Create COM object
- unknown, err := oleutil.CreateObject(progID)
- if err != nil {
- fmt.Println("Unable to create COM object:", err)
- }
- defer unknown.Release()
-
- // Query for the IDispatch interface
- dispatch, err := unknown.QueryInterface(ole.IID_IDispatch)
- if err != nil {
- fmt.Println("Unable to get IDispatch interface:", err)
- }
- defer dispatch.Release()
-
- // Prepare parameters
- //transNo := "1401"
- //transType := "passwordCheck"
- //timestamp := time.Now().Unix()
- //fixmedinsCode := "H45072101171"
- //psnNo := ""
- //data := fmt.Sprintf(`{"transNo":"%s","transType":"%s","timestamp":"%s","data":{"fixmedinsCode":"%s","psnNo":"%s"}}`, transNo, transType, timestamp, fixmedinsCode, psnNo)
- result2 := ""
- // Call COM object's method using the IDispatch interface
- resulr, err := oleutil.CallMethod(dispatch, "yh_hb_call", code, data, &result2)
- fmt.Println(resulr)
- fmt.Println(result2)
-
- if err != nil {
- fmt.Println("调用COM对象方法失败:", err)
- }
-
- //var response Response
- //err2 := json.Unmarshal([]byte(result2), &response)
- //if err2 != nil {
- // fmt.Println("解析JSON失败:", err)
- //}
- return result2
- }
|