123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558 |
- package service
-
- import (
- "bytes"
- "encoding/json"
- "fmt"
- "gdyb/models"
- "gdyb/utils/csbhttp"
- "github.com/astaxie/beego"
- "io/ioutil"
- "net/http"
- "strconv"
- "strings"
- "time"
- )
-
- // 人员基本信息
- func AHyb1101(certNo string, org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, id_card_type int64, card_sn string, certificates string, request_url string, name string,token string) (string, string) {
- timestamp := time.Now().Unix()
- //生成输入报文
- inputMessage := SetAHInputMessage(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"] = card_sn // 卡识别码
- inputData["certno"] = certNo // 证件号码
- inputData["psn_cert_type"] = "01" // 人员证件类型
- inputData["mdtrt_cert_no"] = certNo // 就诊凭证编号
-
-
- } else if id_card_type == 4 {
- inputData["mdtrt_cert_type"] = "01" // 就诊凭证类型
- inputData["card_sn"] = card_sn // 卡识别码
- inputData["certno"] = certNo // 证件号码
- inputData["psn_cert_type"] = "01" // 人员证件类型
- inputData["mdtrt_cert_no"] = token // 就诊凭证编号
-
- }else {
- inputData["mdtrt_cert_type"] = "02" // 就诊凭证类型
- inputData["card_sn"] = "" // 卡识别码
- inputData["mdtrt_cert_no"] = certNo // 就诊凭证编号
- inputData["certno"] = certNo // 证件号码
- inputData["psn_cert_type"] = "01" // 人员证件类型
- }
- }
- month := time.Unix(1557042972, 0).Format("1")
- year := time.Now().Format("2006")
- month = time.Now().Format("01")
- day := time.Now().Format("02")
- inputData["begntime"] = year + "-" +month + "-" + day // 开始时间
- inputData["psn_name"] = name // 人员姓名
- input["data"] = inputData
- inputMessage["input"] = input //交易输入
- argInputMessage := make(map[string]interface{})
- argInputMessage["arg0"] = inputMessage
-
- bytesData, err := json.Marshal(argInputMessage)
- fmt.Println(string(bytesData))
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
-
- reader := bytes.NewReader(bytesData)
- request_url = request_url + "1101"
- fmt.Println(request_url)
-
- request, err := http.NewRequest("POST", request_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("_api_timestamp", strconv.FormatInt(timestamp, 10))
- //request.Header.Set("_api_name", "hssServives")
- //request.Header.Set("_api_version", "1.0.0")
- //request.Header.Set("_api_access_key", access_key)
- //request.Header.Set("_api_signature", "")
- //AHyb1901(request_url)
- client := http.Client{}
- resp, err := client.Do(request)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- respBytes, err := ioutil.ReadAll(resp.Body)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- str := string(respBytes)
- fmt.Println(str)
- return str, string(bytesData)
- }
-
- //人员基本信息版本2
- func AHyb1101A(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, request_url string, access_key string, id_card_no string, cainfo string) (string, string) {
- timestamp := time.Now().Unix()
- //生成输入报文
- inputMessage := SetAHInputMessage(timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, cainfo)
-
- 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"] = card_sn // 卡识别码
- inputData["certno"] = id_card_no // 证件号码
- inputData["psn_cert_type"] = "01" // 人员证件类型
-
- } else {
- inputData["mdtrt_cert_type"] = "02" // 就诊凭证类型
- inputData["card_sn"] = "" // 卡识别码
- inputData["certno"] = certNo // 证件号码
- inputData["psn_cert_type"] = "01" // 人员证件类型
- }
- }
-
- inputData["mdtrt_cert_no"] = certNo // 就诊凭证编号
- month := time.Unix(1557042972, 0).Format("1")
- year := time.Now().Format("2006")
- month = time.Now().Format("01")
- day := time.Now().Format("02")
- inputData["begntime"] = year + "-" +month + "-" + day // 开始时间 // 开始时间
- inputData["psn_name"] = "" // 人员姓名
- input["data"] = inputData
- inputMessage["input"] = input //交易输入
- argInputMessage := make(map[string]interface{})
- argInputMessage["arg0"] = inputMessage
-
- bytesData, err := json.Marshal(argInputMessage)
- fmt.Println(string(bytesData))
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
-
- reader := bytes.NewReader(bytesData)
- request_url = request_url + "1101"
- fmt.Println(request_url)
-
- request, err := http.NewRequest("POST", request_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("_api_timestamp", strconv.FormatInt(timestamp, 10))
- //request.Header.Set("_api_name", "hssServives")
- //request.Header.Set("_api_version", "1.0.0")
- //request.Header.Set("_api_access_key", access_key)
- //request.Header.Set("_api_signature", "")
-
- client := http.Client{}
- resp, err := client.Do(request)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- respBytes, err := ioutil.ReadAll(resp.Body)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- str := string(respBytes)
- fmt.Println(str)
- return str, string(bytesData)
- }
-
- func AHyb1101B(org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, request_url string, access_key string, Token string, cainfo string, id_card_no string) (string, string) {
- timestamp := time.Now().Unix()
- //生成输入报文
- inputMessage := SetAHInputMessage(timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, cainfo)
-
- input := make(map[string]interface{})
- inputData := make(map[string]interface{})
- inputMessage["infno"] = "1101" // 交易编码
-
- inputData["mdtrt_cert_type"] = "04" // 就诊凭证类型
- inputData["card_sn"] = "" // 卡识别码
- inputData["certno"] = "" // 证件号码
- inputData["psn_cert_type"] = "01" // 人员证件类型
-
- inputData["mdtrt_cert_no"] = id_card_no + "|" + Token // 就诊凭证编号
- inputData["begntime"] = "" // 开始时间
- inputData["psn_name"] = "" // 人员姓名
- input["data"] = inputData
- inputMessage["input"] = input //交易输入
- argInputMessage := make(map[string]interface{})
- argInputMessage["arg0"] = inputMessage
-
-
- bytesData, err := json.Marshal(argInputMessage)
- fmt.Println(string(bytesData))
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
-
- reader := bytes.NewReader(bytesData)
- request_url = request_url + "1101"
- fmt.Println(request_url)
-
- request, err := http.NewRequest("POST", request_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("_api_timestamp", strconv.FormatInt(timestamp, 10))
- //request.Header.Set("_api_name", "hssServives")
- //request.Header.Set("_api_version", "1.0.0")
- //request.Header.Set("_api_access_key", access_key)
- //request.Header.Set("_api_signature", "")
-
- client := http.Client{}
- resp, err := client.Do(request)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- respBytes, err := ioutil.ReadAll(resp.Body)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- str := string(respBytes)
- fmt.Println(str)
- return str, string(bytesData)
- }
-
- func AHyb1101ForEleCert(org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, request_url string, access_key string, Token string, cainfo string, id_card_no string, name string) (string, string) {
- timestamp := time.Now().Unix()
- //生成输入报文
- inputMessage := SetAHInputMessage(timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, cainfo)
-
- input := make(map[string]interface{})
- inputData := make(map[string]interface{})
- inputMessage["infno"] = "1101" // 交易编码
-
- inputData["mdtrt_cert_type"] = "01" // 就诊凭证类型
- inputData["card_sn"] = "" // 卡识别码
- inputData["certno"] = id_card_no // 证件号码
- inputData["psn_cert_type"] = "01" // 人员证件类型
- inputData["mdtrt_cert_no"] = Token // 就诊凭证编号
- month := time.Unix(1557042972, 0).Format("1")
- year := time.Now().Format("2006")
- month = time.Now().Format("01")
- day := time.Now().Format("02")
- inputData["begntime"] = year + "-" +month + "-" + day
- inputData["psn_name"] = name // 人员姓名
- input["data"] = inputData
- inputMessage["input"] = input //交易输入
- argInputMessage := make(map[string]interface{})
- argInputMessage["arg0"] = inputMessage
-
- bytesData, err := json.Marshal(argInputMessage)
- fmt.Println(string(bytesData))
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
-
- reader := bytes.NewReader(bytesData)
- request_url = request_url + "1101"
- fmt.Println(request_url)
-
- request, err := http.NewRequest("POST", request_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("_api_timestamp", strconv.FormatInt(timestamp, 10))
- //request.Header.Set("_api_name", "hssServives")
- //request.Header.Set("_api_version", "1.0.0")
- //request.Header.Set("_api_access_key", access_key)
- //request.Header.Set("_api_signature", "")
-
- client := http.Client{}
- resp, err := client.Do(request)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- respBytes, err := ioutil.ReadAll(resp.Body)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- str := string(respBytes)
- fmt.Println(str)
- return str, string(bytesData)
- }
-
- // 门诊挂号
- func AHyb2201(psnNo string, insutype string, certNo string, org_name string, opera string, ipt_otp_no string, dept string, fixmedins_code string, dept_code string, doctor_id string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, id_card_type int64, doctor_name string, request_url string, access_key string, verify_number string, cainfo string, card_sn string) (string, string) {
- fmt.Println(opera)
-
- // 生成签名
- timestamp := time.Now().Unix()
- tempTime := time.Unix(timestamp, 0)
- timeFormatOne := tempTime.Format("2006-01-02 15:04:05")
-
- // 生成输入报文
- inputMessage := SetAHInputMessage(timestamp, org_name, opera, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, cainfo)
- input := make(map[string]interface{})
- inputData := make(map[string]interface{})
- inputMessage["infno"] = "2201" // 交易编码
- inputData["psn_no"] = psnNo // 人员编号 (来自1101接口返回)
- inputData["insutype"] = insutype // 险种类型(来自1101接口返回)
- inputData["begntime"] = timeFormatOne // 开始时间
-
- if id_card_type == 1 {
- inputData["mdtrt_cert_type"] = "03" // 就诊凭证类型
- inputData["card_sn"] = card_sn // 卡识别码
- inputData["certno"] = certNo // 证件号码
- inputData["mdtrt_cert_no"] = verify_number // 就诊凭证编号
-
- } else if id_card_type == 3 {
- inputData["mdtrt_cert_type"] = "04" // 就诊凭证类型
- inputData["mdtrt_cert_no"] = verify_number // 就诊凭证编号
- } else if id_card_type == 4 {
- inputData["mdtrt_cert_type"] = "01" // 就诊凭证类型
- inputData["mdtrt_cert_no"] = verify_number // 就诊凭证编号
- } else {
- inputData["mdtrt_cert_type"] = "02" // 就诊凭证类型
- inputData["mdtrt_cert_no"] = verify_number // 就诊凭证编号
-
- }
-
- inputData["ipt_otp_no"] = ipt_otp_no // 住院/门诊号
- inputData["atddr_no"] = doctor_id // 医师编码
- inputData["dr_name"] = doctor_name // 医师姓名
- inputData["dept_code"] = dept_code // 科室编码
- inputData["dept_name"] = dept // 科室名称
- inputData["caty"] = "A03.06" // 科别
- inputData["exp_content"] = "" //
-
- input["data"] = inputData
- inputMessage["input"] = input //交易输入
- argInputMessage := make(map[string]interface{})
- argInputMessage["arg0"] = inputMessage
-
- bytesData, err := json.Marshal(argInputMessage)
- fmt.Println(string(bytesData))
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
-
- reader := bytes.NewReader(bytesData)
- request_url = request_url + "2201"
- fmt.Println(request_url)
-
- request, err := http.NewRequest("POST", request_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("_api_timestamp", strconv.FormatInt(timestamp, 10))
- //request.Header.Set("_api_name", "hssServives")
- //request.Header.Set("_api_version", "1.0.0")
- //request.Header.Set("_api_access_key", access_key)
- //request.Header.Set("_api_signature", "")
-
- client := http.Client{}
- resp, err := client.Do(request)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- respBytes, err := ioutil.ReadAll(resp.Body)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- str := string(respBytes)
- fmt.Println(str)
- return str, string(bytesData)
- }
-
- // 门诊挂号撤销
- func AHyb2202(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, request_url string, access_key string, cainfo string) (string, string) {
- // 生成签名
- timestamp := time.Now().Unix()
- // 生成输入报文
- inputMessage := SetAHInputMessage(timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, cainfo)
- input := make(map[string]interface{})
- inputData := make(map[string]interface{})
- inputMessage["infno"] = "2202" // 交易编码
- inputData["psn_no"] = psnNo // 人员编号 (来自1101接口返回)
- inputData["mdtrt_id"] = mdtrtId // 就诊 ID(来自2201接口返回)
- inputData["ipt_otp_no"] = ipt_otp_no // 住院/门诊号
- //inputData["exp_content"] = "" // 人员编号 (来自1101接口返回)
- inputData["exp_content"] = "" //
-
- input["data"] = inputData
- inputMessage["input"] = input //交易输入
- argInputMessage := make(map[string]interface{})
- argInputMessage["arg0"] = inputMessage
-
- bytesData, err := json.Marshal(argInputMessage)
- fmt.Println(string(bytesData))
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
-
- reader := bytes.NewReader(bytesData)
- request_url = request_url + "2202"
- fmt.Println(request_url)
-
- request, err := http.NewRequest("POST", request_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("_api_timestamp", strconv.FormatInt(timestamp, 10))
- //request.Header.Set("_api_name", "hssServives")
- //request.Header.Set("_api_version", "1.0.0")
- //request.Header.Set("_api_access_key", access_key)
- //request.Header.Set("_api_signature", "")
-
- client := http.Client{}
- resp, err := client.Do(request)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- respBytes, err := ioutil.ReadAll(resp.Body)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- str := string(respBytes)
- fmt.Println(str)
- return str, string(bytesData)
- }
-
- // 门诊就诊信息上传
- func AHyb2203(psnNo string, mdtrtId string, operator string, department string, org_name string, med_type string,fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, sick_code string, sick_name string,config []*models.HisXtDiagnoseConfig, request_url string ,begin_time string, cainfo string,doctor_name string,doctor_number string) (string, string) {
- // 生成签名
- timestamp := time.Now().Unix()
- tempTime := time.Unix(timestamp, 0)
- timeFormatOne := tempTime.Format("2006-01-02 15:04:05")
- // 生成输入报文
- inputMessage := SetAHInputMessage(timestamp, org_name, operator, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, cainfo)
- input := make(map[string]interface{})
- inputData := make(map[string]interface{})
- diseinfo := make([]map[string]interface{}, 0)
-
- if med_type == "1111" || med_type == "1112" {
- med_type = "11"
- }
-
- inputMessage["infno"] = "2203" // 交易编码
- inputData["mdtrt_id"] = mdtrtId // 就诊 ID(来自2201接口返回)
- inputData["psn_no"] = psnNo // 人员编号 (来自1101接口返回)
- inputData["med_type"] = med_type // 医疗类别 16门诊特殊病
- inputData["begntime"] = begin_time // 开始时间
- inputData["main_cond_dscr"] = "" // 主要病情描述
- inputData["dise_codg"] = sick_code // 病种编码
- inputData["dise_name"] = sick_name // 病种名称
- inputData["birctrl_type"] = "" // 计划生育手术类别
- //inputData["birctrl_matn_date"] = "" // 计划生育手术或生育日期
-
- for index, item := range config {
- diseinfo_sun := make(map[string]interface{})
- diseinfo_sun["diag_type"] = "1" // 诊断类别
- diseinfo_sun["diag_srt_no"] = index // 诊断排序号
- diseinfo_sun["diag_code"] = item.CountryCode // 诊断代码
- diseinfo_sun["diag_name"] = item.ClassName // 诊断名称
- diseinfo_sun["diag_dept"] = department // 诊断科室
- diseinfo_sun["dise_dor_no"] = doctor_number // 诊断医生编码
- diseinfo_sun["dise_dor_name"] = doctor_name // 诊断医生姓名
- diseinfo_sun["diag_time"] = timeFormatOne // 诊断时间
- diseinfo_sun["vali_flag"] = "1" // 有效标志
- diseinfo = append(diseinfo, diseinfo_sun)
- }
- //inputData["exp_content"] = "" // 人员编号 (来自1101接口返回)
- inputData["exp_content"] = "" //
-
- input["diseinfo"] = diseinfo
- input["mdtrtinfo"] = inputData
- inputMessage["input"] = input //交易输入
- argInputMessage := make(map[string]interface{})
- argInputMessage["arg0"] = inputMessage
-
- bytesData, err := json.Marshal(argInputMessage)
- fmt.Println(string(bytesData))
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
-
- reader := bytes.NewReader(bytesData)
- request_url = request_url + "2203"
- fmt.Println(request_url)
-
- request, err := http.NewRequest("POST", request_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("_api_timestamp", strconv.FormatInt(timestamp, 10))
- //request.Header.Set("_api_name", "hssServives")
- //request.Header.Set("_api_version", "1.0.0")
- //request.Header.Set("_api_access_key", access_key)
- //request.Header.Set("_api_signature", "")
-
- client := http.Client{}
- resp, err := client.Do(request)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- respBytes, err := ioutil.ReadAll(resp.Body)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- str := string(respBytes)
- fmt.Println(str)
- return str, string(bytesData)
- }
-
-
-
- func AHyb2406(psnNo string, mdtrtId string, cert_no string,psn_name string,operator string,ipt_otp_no string,ipt_psn_sp_flag_type string,ipt_psn_sp_flag string, org_name string,fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string,request_url string) (string, string) {
- // 生成签名
- timestamp := time.Now().Unix()
- // 生成输入报文
- inputMessage := SetAHInputMessage(timestamp, org_name, operator, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, "")
- input := make(map[string]interface{})
- inputData := make(map[string]interface{})
- inputMessage["infno"] = "2406" // 交易编码
- inputData["mdtrt_id"] = mdtrtId // 就诊 ID(来自2201接口返回)
- inputData["psn_no"] = psnNo // 人员编号 (来自1101接口返回)
- inputData["psn_cert_type"] = "01" // 人员编号 (来自1101接口返回)
- inputData["certno"] = cert_no // 人员编号 (来自1101接口返回)
- inputData["psn_name"] = psn_name // 人员编号 (来自1101接口返回)
- inputData["ipt_otp_no"] = ipt_otp_no // 人员编号 (来自1101接口返回)
- inputData["ipt_psn_sp_flag_type"] = ipt_psn_sp_flag_type // 人员编号 (来自1101接口返回)
- inputData["ipt_psn_sp_flag"] = ipt_psn_sp_flag // 人员编号 (来自1101接口返回)
- inputData["memo"] = "ZLFS00373" //
- inputData["admdvs"] = mdtrtarea_admvs //
- input["IptPsnSpFlagRegIn"] = inputData
- inputMessage["input"] = input //交易输入
- argInputMessage := make(map[string]interface{})
- argInputMessage["arg0"] = inputMessage
-
- bytesData, err := json.Marshal(argInputMessage)
- fmt.Println(string(bytesData))
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- reader := bytes.NewReader(bytesData)
- request_url = request_url + "2406"
- fmt.Println(request_url)
-
- request, err := http.NewRequest("POST", request_url, reader)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
-
- request.Header.Set("Content-Type", "application/json;charset=UTF-8")
- client := http.Client{}
- resp, err := client.Do(request)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- respBytes, err := ioutil.ReadAll(resp.Body)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- str := string(respBytes)
- fmt.Println(str)
- return str, string(bytesData)
- }
-
- func AHyb1901(url string) {
- // 生成签名
- timestamp := time.Now().Unix()
- // 生成输入报文
- inputMessage := SetAHInputMessage(timestamp, "阜阳经沃血液透析中心", "aaa", "H34120302409", "341200", "341200", "")
- input := make(map[string]interface{})
- inputData := make(map[string]interface{})
- inputMessage["infno"] = "1901" // 交易编码
- inputData["type"] = "ipt_psn_sp_flag_typ" // 就诊 ID(来自2201接口返回)
- inputData["parent_value"] = "" // 人员编号 (来自1101接口返回)
- inputData["admdvs"] = "341200" // 人员编号 (来自1101接口返回)
- inputData["date"] = "2024-02-22" // 人员编号 (来自1101接口返回)
- inputData["vali_flag"] = "1" // 人员编号 (来自1101接口返回)
- input["data"] = inputData
- inputMessage["input"] = input //交易输入
- argInputMessage := make(map[string]interface{})
- argInputMessage["arg0"] = inputMessage
- //var inputLog string
- bytesData, err := json.Marshal(argInputMessage)
- fmt.Println(string(bytesData))
- if err != nil {
- fmt.Println(err.Error())
- return
- }
- reader := bytes.NewReader(bytesData)
- url = url + "1901"
-
-
- 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")
- 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
- }
- str := string(respBytes)
- fmt.Println(str)
- return
- }
-
-
-
- // 门诊就诊信息上传
- func AHyb2203A(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, request_url string, access_key string, cainfo string) (string, string) {
- // 生成签名
- timestamp := time.Now().Unix()
- tempTime := time.Unix(timestamp, 0)
- timeFormatOne := tempTime.Format("2006-01-02 15:04:05")
-
- // 生成输入报文
- inputMessage := SetAHInputMessage(timestamp, org_name, dept, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, cainfo)
- input := make(map[string]interface{})
- inputData := make(map[string]interface{})
- diseinfo := make([]map[string]interface{}, 0)
-
- if med_type == "1111" || med_type == "1112" {
- med_type = "11"
- }
-
- inputMessage["infno"] = "2203A" // 交易编码
- inputData["mdtrt_id"] = mdtrtId // 就诊 ID(来自2201接口返回)
- inputData["psn_no"] = psnNo // 人员编号 (来自1101接口返回)
- inputData["med_type"] = med_type // 医疗类别 16门诊特殊病
- inputData["begntime"] = timeFormatOne // 开始时间
-
- inputData["main_cond_dscr"] = "" // 主要病情描述
- inputData["dise_codg"] = sick_code // 病种编码
- inputData["dise_name"] = sick_name // 病种名称
- inputData["birctrl_type"] = "" // 计划生育手术类别
- inputData["birctrl_matn_date"] = "" // 计划生育手术或生育日期
-
- inputData["matn_type"] = "" // 生育类别
- inputData["geso_val"] = "" // 孕周数
-
- for index, item := range config {
- diseinfo_sun := make(map[string]interface{})
- diseinfo_sun["diag_type"] = "1" // 诊断类别
- diseinfo_sun["diag_srt_no"] = index // 诊断排序号
- diseinfo_sun["diag_code"] = item.CountryCode // 诊断代码
- diseinfo_sun["diag_name"] = item.ClassName // 诊断名称
- diseinfo_sun["diag_dept"] = department // 诊断科室
- diseinfo_sun["dise_dor_no"] = doctor_id // 诊断医生编码
- diseinfo_sun["dise_dor_name"] = doctor // 诊断医生姓名
- diseinfo_sun["diag_time"] = timeFormatOne // 诊断时间
- diseinfo_sun["vali_flag"] = "1" // 有效标志
- diseinfo = append(diseinfo, diseinfo_sun)
- }
-
- input["diseinfo"] = diseinfo
- input["mdtrtinfo"] = inputData
- inputMessage["input"] = input //交易输入
- argInputMessage := make(map[string]interface{})
- argInputMessage["arg0"] = inputMessage
-
- bytesData, err := json.Marshal(argInputMessage)
- fmt.Println(string(bytesData))
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
-
- reader := bytes.NewReader(bytesData)
- request_url = request_url + "2203A"
- fmt.Println(request_url)
-
- request, err := http.NewRequest("POST", request_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("_api_timestamp", strconv.FormatInt(timestamp, 10))
- //request.Header.Set("_api_name", "hssServives")
- //request.Header.Set("_api_version", "1.0.0")
- //request.Header.Set("_api_access_key", access_key)
- //request.Header.Set("_api_signature", "")
-
- client := http.Client{}
- resp, err := client.Do(request)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- respBytes, err := ioutil.ReadAll(resp.Body)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- str := string(respBytes)
- fmt.Println(str)
- return str, string(bytesData)
- }
-
- // 门诊费用明细信息上传
- func AHyb2204(psnNo string, mdtrtId string, hisPrescription []*models.HisPrescription, chrg_bchno string, org_name string, doctor string, dept string, fixmedins_code string, dept_code string, doctor_id string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, balance_accounts_type string, diag_code string, request_url string, access_key string, new_doctor_name string, time_stamp_2203 string, cainfo string,opter string) (string, string) {
- // 生成签名
- //timestamp := time.Now().Unix()
-
-
- timestamp2 := time.Now().Unix()
-
- //tempTime := time.Unix(timestamp2, 0)
- //timeFormatOne := tempTime.Format("2006-01-02 15:04:05")
- 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("%.4f", subItem.Price*subItem.PrescribingNumber),
- Cut: fmt.Sprintf("%.4f", subItem.PrescribingNumber),
- FeedetlSn: subItem.FeedetlSn,
- Price: fmt.Sprintf("%.4f", subItem.Price),
- MedListCodg: subItem.BaseDrugLib.MedicalInsuranceNumber,
- HospApprFlag: subItem.HospApprFlag,
- DoctorNumber: doctor_id,
- DoctorName: new_doctor_name,
- ProvinceDrugMedListCodg: "",
- ProvinceGoodMedListCodg: "",
- FeeOcurTime: tm.Format("2006-01-02 15:04:05"),
- }
-
- if subItem.BaseDrugLib.DrugClassify == "2" {
- cus.ProvinceDrugMedListCodg = subItem.BaseDrugLib.ProvincesCode
- }
-
- customs = append(customs, cus)
- }
- }
- }
-
- if item.Type == 2 { //项目
- for _, subItem := range item.HisPrescriptionProject {
- //var randNum int
- //randNum = rand.Intn(10000) + 1000
- if subItem.Type == 2 {
- if len(subItem.HisProject.MedicalCode) > 0 {
- cnt, _ := strconv.ParseFloat(subItem.Count, 64)
- cus := &Custom{
- DetItemFeeSumamt: fmt.Sprintf("%.4f", subItem.Price*cnt),
- Cut: fmt.Sprintf("%.4f", cnt),
- FeedetlSn: subItem.FeedetlSn,
- Price: fmt.Sprintf("%.4f", float64(subItem.Price)),
- MedListCodg: subItem.HisProject.MedicalCode,
- DoctorNumber: doctor_id,
- DoctorName: new_doctor_name,
- HospApprFlag: -1,
- ProvinceDrugMedListCodg: "",
- ProvinceGoodMedListCodg: "",
- FeeOcurTime: tm.Format("2006-01-02 15:04:05"),
- }
- customs = append(customs, cus)
- }
-
- } else if subItem.Type == 3 {
- if len(subItem.GoodInfo.MedicalInsuranceNumber) > 0 {
- cnt, _ := strconv.ParseFloat(subItem.Count, 64)
-
- cus := &Custom{
- DetItemFeeSumamt: fmt.Sprintf("%.4f", subItem.Price*cnt),
- Cut: fmt.Sprintf("%.4f", cnt),
- FeedetlSn: subItem.FeedetlSn,
- Price: fmt.Sprintf("%.4f", float64(subItem.Price)),
- MedListCodg: subItem.GoodInfo.MedicalInsuranceNumber,
- HospApprFlag: -1,
- DoctorNumber: doctor_id,
- DoctorName: new_doctor_name,
- ProvinceDrugMedListCodg: "",
- ProvinceGoodMedListCodg: subItem.GoodInfo.ProvincesCode,
- FeeOcurTime: tm.Format("2006-01-02 15:04:05"),
- }
- customs = append(customs, cus)
- }
-
- }
-
- }
- }
-
- for _, subItem := range item.HisAdditionalCharge {
- if len(subItem.XtHisAddtionConfig.Code) > 0 {
- cus := &Custom{
- DetItemFeeSumamt: fmt.Sprintf("%.4f", subItem.Price*float64(subItem.Count)),
- Cut: fmt.Sprintf("%.4f", float64(subItem.Count)),
- FeedetlSn: subItem.FeedetlSn,
- Price: fmt.Sprintf("%.4f", float64(subItem.Price)),
- MedListCodg: subItem.XtHisAddtionConfig.Code,
- HospApprFlag: -1,
- DoctorNumber: doctor_id,
- DoctorName: new_doctor_name,
- }
- customs = append(customs, cus)
- }
- }
- }
-
- // 生成输入报文
- inputMessage := SetAHInputMessage(timestamp2, org_name, opter, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, cainfo)
- input := make(map[string]interface{})
- feedetail := make([]map[string]interface{}, 0)
- inputMessage["infno"] = "2204" // 交易编码
-
- //chrg_bchno := timeFormat + strconv.FormatInt(int64(chrgBchno), 10)
- for _, item := range customs {
- feedetailInfo := make(map[string]interface{})
- subfeedetailInfo := make(map[string]interface{})
-
- feedetailInfo["feedetl_sn"] = item.FeedetlSn
- feedetailInfo["mdtrt_id"] = mdtrtId // 就诊 ID(来自2201接口返回)
- feedetailInfo["psn_no"] = psnNo // 人员编号 (来自1101接口返回)
- feedetailInfo["chrg_bchno"] = chrg_bchno // 收费批次号
- feedetailInfo["dise_codg"] = diag_code // 病种编码
- feedetailInfo["rxno"] = "" // 处方号
- feedetailInfo["rx_circ_flag"] = "0" // 外购处方标志
- feedetailInfo["fee_ocur_time"] = item.FeeOcurTime // 费用发生时间
- feedetailInfo["med_list_codg"] = item.MedListCodg // 医疗目录编码
- feedetailInfo["medins_list_codg"] = item.FeedetlSn // 医药机构目录编码
- 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"] = item.DoctorNumber // 开单医生编码
- feedetailInfo["bilg_dr_name"] = item.DoctorName // 开单医师姓名
- 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"] = "1" // 医院审批标志
- } else if item.HospApprFlag == 2 {
- feedetailInfo["hosp_appr_flag"] = "2" // 医院审批标志
- } else if item.HospApprFlag == 3 {
- feedetailInfo["hosp_appr_flag"] = "0" // 医院审批标志
- } else {
- feedetailInfo["hosp_appr_flag"] = "1" // 医院审批标志
- }
- } else {
- feedetailInfo["hosp_appr_flag"] = "1" // 医院审批标志
- }
-
- }
-
- feedetailInfo["tcmdrug_used_way"] = "" // 中药使用方式
- feedetailInfo["etip_flag"] = "" // 外检标志
- feedetailInfo["etip_hosp_code"] = "" // 外检医院编码
- feedetailInfo["dscg_tkdrug_flag"] = "" // 出院带药标志
- feedetailInfo["matn_fee_flag"] = "" // 生育费用标志
- subfeedetailInfo["tcmherb_prov_code"] = item.ProvinceDrugMedListCodg
- subfeedetailInfo["mcs_prov_code"] = item.ProvinceGoodMedListCodg
- feedetailInfo["exp_content"] = subfeedetailInfo
- feedetail = append(feedetail, feedetailInfo)
- }
-
- input["feedetail"] = feedetail
- inputMessage["input"] = input //交易输入
- argInputMessage := make(map[string]interface{})
- argInputMessage["arg0"] = inputMessage
-
- bytesData, err := json.Marshal(argInputMessage)
- fmt.Println(string(bytesData))
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
-
- reader := bytes.NewReader(bytesData)
- request_url = request_url + "2204"
- fmt.Println(request_url)
-
- request, err := http.NewRequest("POST", request_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("_api_timestamp", strconv.FormatInt(timestamp, 10))
- //request.Header.Set("_api_name", "hssServives")
- //request.Header.Set("_api_version", "1.0.0")
- //request.Header.Set("_api_access_key", access_key)
- //request.Header.Set("_api_signature", "")
-
- client := http.Client{}
- resp, err := client.Do(request)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- respBytes, err := ioutil.ReadAll(resp.Body)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- str := string(respBytes)
- fmt.Println(str)
- return str, string(bytesData)
- }
-
- // 门诊费用明细信息撤销
- func AHyb2205(psnNo string, mdtrtId string, chrgBchno string, org_name string, doctor string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, fixmedins_code string, request_url string, access_key string, cainfo string) (string, string) {
- timestamp := time.Now().Unix()
- // 生成输入报文
- inputMessage := SetAHInputMessage(timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, cainfo)
- 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接口返回)
- inputData["exp_content"] = "" // 人员编号 (来自1101接口返回)
-
- input["data"] = inputData
- inputMessage["input"] = input //交易输入
- argInputMessage := make(map[string]interface{})
- argInputMessage["arg0"] = inputMessage
-
- bytesData, err := json.Marshal(argInputMessage)
- fmt.Println(string(bytesData))
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
-
- reader := bytes.NewReader(bytesData)
- request_url = request_url + "2205"
- fmt.Println(request_url)
-
- request, err := http.NewRequest("POST", request_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("_api_timestamp", strconv.FormatInt(timestamp, 10))
- //request.Header.Set("_api_name", "hssServives")
- //request.Header.Set("_api_version", "1.0.0")
- //request.Header.Set("_api_access_key", access_key)
- //request.Header.Set("_api_signature", "")
-
- client := http.Client{}
- resp, err := client.Do(request)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- respBytes, err := ioutil.ReadAll(resp.Body)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- str := string(respBytes)
- fmt.Println(str)
- return str, string(bytesData)
- }
-
- // 门诊预结算
- func AHyb2206(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,certificates int64, request_url string, access_key string, verify_number string, cainfo string,mdtrt_grp_type string) (string, string) {
-
- // 生成签名
- timestamp := time.Now().Unix() // inputData["mdtrt_cert_type"] = "03" // 就诊凭证类型
- // inputData["mdtrt_cert_no"] = certNo
- // 生成输入报文
- inputMessage := SetAHInputMessage(timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, cainfo)
- input := make(map[string]interface{})
- inputData := make(map[string]interface{})
- inputMessage["infno"] = "2206" // 交易编码
- inputData["psn_no"] = psnNo // 人员编号 (来自1101接口返回)
- if certificates == 3 {
- inputData["mdtrt_cert_type"] = "99" // 就诊凭证类型
- inputData["mdtrt_cert_no"] = certNo // 就诊凭证编号
- } else {
- if id_card_type == 1 {
- inputData["mdtrt_cert_type"] = "03" // 就诊凭证类型
- inputData["mdtrt_cert_no"] = verify_number // 就诊凭证编号
- } else if id_card_type == 3 {
- inputData["mdtrt_cert_type"] = "04" // 就诊凭证类型
- inputData["mdtrt_cert_no"] = verify_number // 就诊凭证编号
- } else if id_card_type == 4 {
- inputData["mdtrt_cert_type"] = "01" // 就诊凭证类型
- inputData["mdtrt_cert_no"] = verify_number // 就诊凭证编号
- } else {
- inputData["mdtrt_cert_type"] = "02" // 就诊凭证类型
- inputData["mdtrt_cert_no"] = certNo // 就诊凭证编号
- }
- }
- if insuplc_admdvs == "421300" {
- if med_type == "11" || med_type == "1112" || med_type == "1111" {
- inputData["med_type"] = "110104" // 医疗类别 11 普通门诊 12 门诊挂号
- } else if med_type == "14" {
- inputData["med_type"] = "140110" // 医疗类别 11 普通门诊 12 门诊挂号
- }
- } else {
- inputData["med_type"] = med_type // 医疗类别 11 普通门诊 12 门诊挂号
- }
-
- inputData["medfee_sumamt"] = total // 医疗费总额
- inputData["psn_setlway"] = "02" // 个人结算方式 01 按项目结 02 按定额结算
- inputData["mdtrt_id"] = mdtrtId // 就诊 ID(来自2201接口返回)
- inputData["chrg_bchno"] = chrgBchno // 收费批次号(来自2204生成的)
- inputData["acct_used_flag"] = "0" // 个人账户使用标志 0否 1是
- inputData["insutype"] = insutype // 险种类型
- inputData["invono"] = "" // 发票号
-
- inputData2 := make(map[string]interface{})
- inputData2["trum_flag"] = ""
- inputData2["rel_ttp_flag"] = ""
- inputData2["otp_er_refl_flag"] = ""
- inputData2["mdtrt_grp_type"] = ""
- inputData2["need_ipt_flag"] = ""
- inputData["exp_content"] = inputData2 // 发票号
-
- input["data"] = inputData
- inputMessage["input"] = input //交易输入
- argInputMessage := make(map[string]interface{})
- argInputMessage["arg0"] = inputMessage
-
- bytesData, err := json.Marshal(argInputMessage)
- fmt.Println(string(bytesData))
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
-
- reader := bytes.NewReader(bytesData)
- request_url = request_url + "2206"
- fmt.Println(request_url)
-
- request, err := http.NewRequest("POST", request_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("_api_timestamp", strconv.FormatInt(timestamp, 10))
- //request.Header.Set("_api_name", "hssServives")
- //request.Header.Set("_api_version", "1.0.0")
- //request.Header.Set("_api_access_key", access_key)
- //request.Header.Set("_api_signature", "")
-
- client := http.Client{}
- resp, err := client.Do(request)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- respBytes, err := ioutil.ReadAll(resp.Body)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- str := string(respBytes)
- fmt.Println(str)
- return str, string(bytesData)
- }
-
- // 门诊预结算
- func AHyb2206Two(psnNo string, mdtrtId string, chrgBchno string, certNo string, insutype string, total string, org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, med_type string, id_card_type int64, fulamt_ownpay_amt float64, overlmt_selfpay float64, preselfpay_amt float64, inscp_scp_amt float64, certificates int64, request_url string, access_key string, verify_number string, cainfo string, card_sn string) (string, string) {
-
- // 生成签名
- timestamp := time.Now().Unix() // inputData["mdtrt_cert_type"] = "03" // 就诊凭证类型
- // inputData["mdtrt_cert_no"] = certNo
- // 生成输入报文
- inputMessage := SetAHInputMessage(timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, cainfo)
- 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["card_sn"] = card_sn // 卡识别码
- inputData["mdtrt_cert_no"] = verify_number // 就诊凭证编号
- } else if id_card_type == 3 {
- inputData["mdtrt_cert_type"] = "04" // 就诊凭证类型
- inputData["mdtrt_cert_no"] = verify_number // 就诊凭证编号
- } else if id_card_type == 4 {
- inputData["mdtrt_cert_type"] = "01" // 就诊凭证类型
- inputData["mdtrt_cert_no"] = verify_number // 就诊凭证编号
- } else {
- inputData["mdtrt_cert_type"] = "02" // 就诊凭证类型
- inputData["mdtrt_cert_no"] = certNo // 就诊凭证编号
- }
- }
- if insuplc_admdvs == "421300" {
- if med_type == "11" || med_type == "1112" || med_type == "1111" {
- inputData["med_type"] = "110104" // 医疗类别 11 普通门诊 12 门诊挂号
- } else if med_type == "14" {
- inputData["med_type"] = "140110" // 医疗类别 11 普通门诊 12 门诊挂号
- }
- } else {
- inputData["med_type"] = med_type // 医疗类别 11 普通门诊 12 门诊挂号
- }
-
- inputData["medfee_sumamt"] = total // 医疗费总额
- inputData["psn_setlway"] = "01" // 个人结算方式 01 按项目结 02 按定额结算
- inputData["mdtrt_id"] = mdtrtId // 就诊 ID(来自2201接口返回)
- inputData["chrg_bchno"] = chrgBchno // 收费批次号(来自2204生成的)
- inputData["acct_used_flag"] = "0" // 个人账户使用标志 0否 1是
- inputData["insutype"] = insutype // 险种类型
- inputData["invono"] = "" // 发票号
- inputData["exp_content"] = "" // 人员编号 (来自1101接口返回)
-
- input["data"] = inputData
- inputMessage["input"] = input //交易输入
- argInputMessage := make(map[string]interface{})
- argInputMessage["arg0"] = inputMessage
- bytesData, err := json.Marshal(argInputMessage)
- fmt.Println(string(bytesData))
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
-
- reader := bytes.NewReader(bytesData)
- request_url = request_url + "2206"
- fmt.Println(request_url)
-
- request, err := http.NewRequest("POST", request_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("_api_timestamp", strconv.FormatInt(timestamp, 10))
- //request.Header.Set("_api_name", "hssServives")
- //request.Header.Set("_api_version", "1.0.0")
- //request.Header.Set("_api_access_key", access_key)
- //request.Header.Set("_api_signature", "")
-
- client := http.Client{}
- resp, err := client.Do(request)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- respBytes, err := ioutil.ReadAll(resp.Body)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- str := string(respBytes)
- fmt.Println(str)
- return str, string(bytesData)
- }
-
- // 门诊结算
- func AHyb2207(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, acct_used_flag string, request_url string, access_key string, verify_number string, cainfo string,mdtrt_grp_type string) (string, string) {
- // 生成签名
- timestamp := time.Now().Unix()
- // 生成输入报文
- inputMessage := SetAHInputMessage(timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, cainfo)
- input := make(map[string]interface{})
- inputData := make(map[string]interface{})
- inputMessage["infno"] = "2207" // 交易编码
- inputData["psn_no"] = psnNo // 人员编号 (来自1101接口返回)
-
- if id_card_type == 1 {
- inputData["mdtrt_cert_type"] = "03" // 就诊凭证类型
- inputData["mdtrt_cert_no"] = certNo // 就诊凭证编号
- } else if id_card_type == 3 {
- inputData["mdtrt_cert_type"] = "04" // 就诊凭证类型
- inputData["mdtrt_cert_no"] = verify_number // 就诊凭证编号
- } else if id_card_type == 4 {
- inputData["mdtrt_cert_type"] = "01" // 就诊凭证类型
- inputData["mdtrt_cert_no"] = verify_number // 就诊凭证编号
- } else {
- inputData["mdtrt_cert_type"] = "02" // 就诊凭证类型
- inputData["mdtrt_cert_no"] = certNo
- }
-
- if med_type == "1111" || med_type == "1112" {
- med_type = "11"
- }
- if insuplc_admdvs == "421300" {
- if med_type == "11" {
- inputData["med_type"] = "110104" // 医疗类别 11 普通门诊 12 门诊挂号
- } else if med_type == "14" {
- inputData["med_type"] = "140101" // 医疗类别 11 普通门诊 12 门诊挂号
- }
- } else {
- inputData["med_type"] = med_type // 医疗类别 11 普通门诊 12 门诊挂号
- }
- inputData["medfee_sumamt"] = total // 医疗费总额
- inputData["psn_setlway"] = "02" // 个人结算方式 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"] = 0 //
- inputData["overlmt_selfpay"] = 0 //
- inputData["preselfpay_amt"] = 0 //
- inputData["inscp_scp_amt"] = 0 //
-
- inputData2 := make(map[string]interface{})
- inputData2["trum_flag"] = ""
- inputData2["rel_ttp_flag"] = ""
- inputData2["otp_er_refl_flag"] = ""
- inputData2["mdtrt_grp_type"] = ""
- inputData2["need_ipt_flag"] = ""
- inputData["exp_content"] = inputData2
-
- input["data"] = inputData
- inputMessage["input"] = input //交易输入
- argInputMessage := make(map[string]interface{})
- argInputMessage["arg0"] = inputMessage
- var inputLog string
- bytesData, err := json.Marshal(argInputMessage)
- fmt.Println(string(bytesData))
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
-
- reader := bytes.NewReader(bytesData)
- request_url = request_url + "2207"
- fmt.Println(request_url)
-
- request, err := http.NewRequest("POST", request_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("_api_timestamp", strconv.FormatInt(timestamp, 10))
- //request.Header.Set("_api_name", "hssServives")
- //request.Header.Set("_api_version", "1.0.0")
- //request.Header.Set("_api_access_key", access_key)
- //request.Header.Set("_api_signature", "")
-
- 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, inputLog
- }
-
- // 门诊结算
- func AHyb2207Two(psnNo string, mdtrtId string, chrgBchno string, certNo string, insutype string, total string, org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, med_type string, id_card_type int64, fulamt_ownpay_amt float64, overlmt_selfpay float64, preselfpay_amt float64, inscp_scp_amt float64, certificates int64, acct_used_flag string, request_url string, access_key string, verify_number string, cainfo string, card_sn string) (string, string) {
- // 生成签名
- timestamp := time.Now().Unix()
- // 生成输入报文
- inputMessage := SetAHInputMessage(timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, cainfo)
- input := make(map[string]interface{})
- inputData := make(map[string]interface{})
- inputMessage["infno"] = "2207" // 交易编码
- inputData["psn_no"] = psnNo // 人员编号 (来自1101接口返回)
-
- if id_card_type == 1 {
- inputData["mdtrt_cert_type"] = "03" // 就诊凭证类型
- inputData["card_sn"] = card_sn // 卡识别码
- inputData["mdtrt_cert_no"] = verify_number // 就诊凭证编号
-
- } else if id_card_type == 3 {
- inputData["mdtrt_cert_type"] = "04" // 就诊凭证类型
- inputData["mdtrt_cert_no"] = verify_number // 就诊凭证编号
- } else if id_card_type == 4 {
- inputData["mdtrt_cert_type"] = "01" // 就诊凭证类型
- inputData["mdtrt_cert_no"] = verify_number // 就诊凭证编号
- } else {
- inputData["mdtrt_cert_type"] = "02" // 就诊凭证类型
- inputData["mdtrt_cert_no"] = certNo
- }
-
- if med_type == "1111" || med_type == "1112" {
- med_type = "11"
- }
- if insuplc_admdvs == "421300" {
- if med_type == "11" {
- inputData["med_type"] = "110104" // 医疗类别 11 普通门诊 12 门诊挂号
- } else if med_type == "14" {
- inputData["med_type"] = "140101" // 医疗类别 11 普通门诊 12 门诊挂号
- }
- } else {
- inputData["med_type"] = med_type // 医疗类别 11 普通门诊 12 门诊挂号
- }
- inputData["medfee_sumamt"] = total // 医疗费总额
- inputData["psn_setlway"] = "01" // 个人结算方式 01 按项目结 02 按定额结算
- inputData["mdtrt_id"] = mdtrtId // 就诊 ID(来自2201接口返回)
- inputData["chrg_bchno"] = chrgBchno // 收费批次号(来自2204生成的)
- inputData["acct_used_flag"] = acct_used_flag // 个人账户使用标志 0否 1是
- inputData["insutype"] = insutype // 险种类型
- inputData["invono"] = "" // 发票号
-
- inputData["fulamt_ownpay_amt"] = fulamt_ownpay_amt //
- inputData["overlmt_selfpay"] = overlmt_selfpay //
- inputData["preselfpay_amt"] = preselfpay_amt //
- inputData["inscp_scp_amt"] = inscp_scp_amt //
- inputData["exp_content"] = "" // 人员编号 (来自1101接口返回)
-
- input["data"] = inputData
- inputMessage["input"] = input //交易输入
- argInputMessage := make(map[string]interface{})
- argInputMessage["arg0"] = inputMessage
- var inputLog string
- bytesData, err := json.Marshal(argInputMessage)
- fmt.Println(string(bytesData))
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
-
- reader := bytes.NewReader(bytesData)
- request_url = request_url + "2207"
- fmt.Println(request_url)
-
- request, err := http.NewRequest("POST", request_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("_api_timestamp", strconv.FormatInt(timestamp, 10))
- //request.Header.Set("_api_name", "hssServives")
- //request.Header.Set("_api_version", "1.0.0")
- //request.Header.Set("_api_access_key", access_key)
- //request.Header.Set("_api_signature", "")
-
- 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, inputLog
- }
-
- func AHyb2207A(psnNo string, mdtrtId string, chrgBchno string, certNo string, insutype string, total string, org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, med_type string, id_card_type int64, fulamt_ownpay_amt float64, overlmt_selfpay float64, preselfpay_amt float64, inscp_scp_amt float64, certificates int64, acct_used_flag string, request_url string, access_key string, cainfo string) (string, string) {
- // 生成签名
- timestamp := time.Now().Unix()
-
- // 生成输入报文
- inputMessage := SetAHInputMessage(timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, cainfo)
- input := make(map[string]interface{})
- inputData := make(map[string]interface{})
- inputMessage["infno"] = "2207A" // 交易编码
- 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" {
- inputData["med_type"] = "110104" // 医疗类别 11 普通门诊 12 门诊挂号
- } else if med_type == "14" {
- inputData["med_type"] = "140101" // 医疗类别 11 普通门诊 12 门诊挂号
- }
- } else {
- inputData["med_type"] = med_type // 医疗类别 11 普通门诊 12 门诊挂号
- }
- inputData["medfee_sumamt"] = total // 医疗费总额
- inputData["psn_setlway"] = "01" // 个人结算方式 01 按项目结 02 按定额结算
- inputData["mdtrt_id"] = mdtrtId // 就诊 ID(来自2201接口返回)
- inputData["chrg_bchno"] = chrgBchno // 收费批次号(来自2204生成的)
- inputData["acct_used_flag"] = acct_used_flag // 个人账户使用标志 0否 1是
- inputData["insutype"] = insutype // 险种类型
- inputData["invono"] = "" // 发票号
-
- 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 //交易输入
- argInputMessage := make(map[string]interface{})
- argInputMessage["arg0"] = inputMessage
- var inputLog string
- bytesData, err := json.Marshal(argInputMessage)
- fmt.Println(string(bytesData))
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
-
- reader := bytes.NewReader(bytesData)
- request_url = request_url + "2207A"
- fmt.Println(request_url)
-
- request, err := http.NewRequest("POST", request_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("_api_timestamp", strconv.FormatInt(timestamp, 10))
- //request.Header.Set("_api_name", "hssServives")
- //request.Header.Set("_api_version", "1.0.0")
- //request.Header.Set("_api_access_key", access_key)
- //request.Header.Set("_api_signature", "")
-
- 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, inputLog
- }
-
- // 门诊结算撤销
- func AHyb2208(psnNo string, mdtrtId string, setlId string, org_name string, doctor string, secret_key string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, request_url string, access_key string, cainfo string) (string, string) {
- timestamp := time.Now().Unix()
- // 生成输入报文
- inputMessage := SetAHInputMessage(timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, cainfo)
- input := make(map[string]interface{})
- inputData := make(map[string]interface{})
- inputMessage["infno"] = "2208" // 交易编码
-
- inputData["psn_no"] = psnNo // 人员编号 (来自1101接口返回)
- inputData["mdtrt_id"] = mdtrtId // 就诊 ID(来自2201接口返回)
- inputData["setl_id"] = setlId // 结算 ID
- inputData["exp_content"] = "" // 人员编号 (来自1101接口返回)
-
- input["data"] = inputData
- inputMessage["input"] = input //交易输入
- argInputMessage := make(map[string]interface{})
- argInputMessage["arg0"] = inputMessage
- var inputLog string
- bytesData, err := json.Marshal(argInputMessage)
- fmt.Println(string(bytesData))
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
-
- reader := bytes.NewReader(bytesData)
- request_url = request_url + "2208"
- fmt.Println(request_url)
-
- request, err := http.NewRequest("POST", request_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("_api_timestamp", strconv.FormatInt(timestamp, 10))
- //request.Header.Set("_api_name", "hssServives")
- //request.Header.Set("_api_version", "1.0.0")
- //request.Header.Set("_api_access_key", access_key)
- //request.Header.Set("_api_signature", "")
-
- 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, inputLog
- }
-
- func AHyb5203(baseParams models.BaseParams, businessParams models.BusinessParams) (string, string) {
- timestamp := time.Now().Unix()
- // 生成输入报文
- inputMessage := SetAHInputMessage(timestamp, baseParams.OrgName, baseParams.Doctor, baseParams.FixmedinsCode, baseParams.InsuplcAdmdvs, baseParams.MdtrtareaAdmvs, baseParams.Cainfo)
- 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 //交易输入
- argInputMessage := make(map[string]interface{})
- argInputMessage["arg0"] = inputMessage
- var inputLog string
- bytesData, err := json.Marshal(argInputMessage)
- fmt.Println(string(bytesData))
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
-
- reader := bytes.NewReader(bytesData)
- baseParams.RequestUrl =baseParams.RequestUrl + "5203"
-
- request, err := http.NewRequest("POST", baseParams.RequestUrl, reader)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
-
- request.Header.Set("Content-Type", "application/json;charset=UTF-8")
- //request.Header.Set("_api_timestamp", strconv.FormatInt(timestamp, 10))
- //request.Header.Set("_api_name", "hssServives")
- //request.Header.Set("_api_version", "1.0.0")
- //request.Header.Set("_api_access_key", access_key)
- //request.Header.Set("_api_signature", "")
-
- 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, inputLog
- }
- func AHyb5202(baseParams models.BaseParams, businessParams models.BusinessParams) (string, string) {
- timestamp := time.Now().Unix()
- // 生成输入报文
- inputMessage := SetAHInputMessage(timestamp, baseParams.OrgName, baseParams.Doctor, baseParams.FixmedinsCode, baseParams.InsuplcAdmdvs, baseParams.MdtrtareaAdmvs, baseParams.Cainfo)
- input := make(map[string]interface{})
- inputData := make(map[string]interface{})
- inputMessage["infno"] = "5202" // 交易编码
- inputData["psn_no"] = businessParams.PsnNo
- inputData["mdtrt_id"] = businessParams.MdtrtId
- input["data"] = inputData
- inputMessage["input"] = input //交易输入
- argInputMessage := make(map[string]interface{})
- argInputMessage["arg0"] = inputMessage
- bytesData, err := json.Marshal(argInputMessage)
- fmt.Println(string(bytesData))
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- baseParams.RequestUrl = baseParams.RequestUrl + "5202"
- //fmt.Println(AHHttpRequest(baseParams.RequestUrl, baseParams.AccessKey, baseParams.SecretKey, timestamp, string(bytesData)))
-
- return AHHttpRequest(baseParams.RequestUrl, baseParams.AccessKey, baseParams.SecretKey, timestamp, string(bytesData), "5202"), string(bytesData)
- }
- func AHyb5201(baseParams models.BaseParams, businessParams models.BusinessParams) (string, string) {
- timestamp := time.Now().Unix()
- // 生成输入报文
- inputMessage := SetAHInputMessage(timestamp, baseParams.OrgName, baseParams.Doctor, baseParams.FixmedinsCode, baseParams.InsuplcAdmdvs, baseParams.MdtrtareaAdmvs, baseParams.Cainfo)
- input := make(map[string]interface{})
- inputData := make(map[string]interface{})
- inputMessage["infno"] = "5201" // 交易编码
- inputData["psn_no"] = businessParams.PsnNo
- inputData["begntime"] = "2023-06-01"
- inputData["endtime"] = "2023-07-30"
- inputData["med_type"] = "21"
- inputData["mdtrt_id"] = businessParams.MdtrtId
- input["data"] = inputData
- inputMessage["input"] = input //交易输入
- argInputMessage := make(map[string]interface{})
- argInputMessage["arg0"] = inputMessage
- bytesData, err := json.Marshal(argInputMessage)
- fmt.Println(string(bytesData))
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- baseParams.RequestUrl = baseParams.RequestUrl + "5201"
- //fmt.Println(AHHttpRequest(baseParams.RequestUrl, baseParams.AccessKey, baseParams.SecretKey, timestamp, string(bytesData)))
-
- return AHHttpRequest(baseParams.RequestUrl, baseParams.AccessKey, baseParams.SecretKey, timestamp, string(bytesData), "5201"), string(bytesData)
- }
-
- func AHybZY1101(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, request_url string, access_key string, pBusiCardInfo string, id_card_no string, cainfo string) (string, string) {
- timestamp := time.Now().Unix()
- //生成输入报文
- inputMessage := SetAHInputMessage(timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, cainfo)
-
- 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"] = card_sn // 卡识别码
- inputData["certno"] = id_card_no // 证件号码
- inputData["psn_cert_type"] = "01" // 人员证件类型
- inputData["mdtrt_cert_no"] = certNo + "|" + pBusiCardInfo // 就诊凭证编号
-
- } 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 //交易输入
- argInputMessage := make(map[string]interface{})
- argInputMessage["arg0"] = inputMessage
- var inputLog string
- bytesData, _ := json.Marshal(argInputMessage)
- inputLog = string(bytesData)
- fmt.Println(string(bytesData))
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- request_url = request_url + "1101"
- return AHHttpRequest(request_url, access_key, secret_key, timestamp, string(bytesData), "1101"), inputLog
-
- }
-
- // 住院登记
- func AHyb2401(struct2401 Struct2401, secret_key string, org_name string, fixmedins_code string, doctor string, insuplc_admdvs string, mdtrtarea_admvs string, request_url string, cainfo string, access_key string) (string, string) {
- // 生成签名
- timestamp := time.Now().Unix()
- //tempTime := time.Unix(timestamp, 0)
- //timeFormatOne := tempTime.Format("2006-01-02 15:04:05")
-
- // 生成输入报文
- inputMessage := SetAHInputMessage(timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, cainfo)
- //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"] = ""
- inputData["insuplc_admdvs"] = insuplc_admdvs
- inputData["mdtrtarea_admvs"] = mdtrtarea_admvs
-
- inputData["card_sn"] = struct2401.Cardsn
- inputData["psn_cert_type"] = struct2401.PsnCertType
- inputData["certno"] = struct2401.Certno
- inputData["psn_type"] = struct2401.PsnType
- inputData["psn_name"] = struct2401.PsnName
-
-
-
- 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 //交易输入
- argInputMessage := make(map[string]interface{})
- argInputMessage["arg0"] = inputMessage
- bytesData, err := json.Marshal(argInputMessage)
- fmt.Println(string(bytesData))
- requestLog := string(bytesData)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- request_url = request_url + "2401"
- return AHHttpRequest(request_url, access_key, secret_key, timestamp, string(bytesData), "2401"), requestLog
-
- }
-
- func AHyb2403(struct2401 Struct2401, secret_key string, org_name string, fixmedins_code string, doctor string, insuplc_admdvs string, mdtrtarea_admvs string, request_url string, cainfo string, access_key string) (string, string) {
- // 生成签名
- timestamp := time.Now().Unix()
- //tempTime := time.Unix(timestamp, 0)
- //timeFormatOne := tempTime.Format("2006-01-02 15:04:05")
-
- // 生成输入报文
- inputMessage := SetAHInputMessage(timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, cainfo)
- //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"] = "2403" // 交易编码
- inputData["mdtrt_id"] = struct2401.PsnNo // 人员编号 (来自1101接口返回)
- inputData["psn_no"] = struct2401.PsnNo // 人员编号 (来自1101接口返回)
- inputData["coner_name"] = struct2401
- inputData["tel"] = ""
- inputData["begntime"] = struct2401.Begntime // 开始时间
- inputData["endtime"] = struct2401.Begntime // 开始时间
- inputData["mdtrt_cert_type"] = struct2401.MdtrtCertType // 就诊凭证类型
- inputData["med_type"] = struct2401.MedType // 就诊凭证编号
- inputData["ipt_opt_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"] = ""
- inputData["expContent"] = ""
-
- inputDataArr := make([]map[string]interface{}, 0)
- for _, item := range struct2401.Diseinfo {
- inputDataTwo := make(map[string]interface{})
- inputDataTwo["mdtrt_id"] = item.PsnNo
-
- 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["adminfo"] = inputData
- input["diseinfo"] = inputDataArr
- inputMessage["input"] = input //交易输入
- argInputMessage := make(map[string]interface{})
- argInputMessage["arg0"] = inputMessage
- bytesData, err := json.Marshal(argInputMessage)
- fmt.Println(string(bytesData))
- requestLog := string(bytesData)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- request_url = request_url + "2403"
- return AHHttpRequest(request_url, access_key, secret_key, timestamp, string(bytesData), "2403"), requestLog
-
- }
-
- func AHyb2404(mdtrt_id string, psn_no string, secret_key string, org_name string, fixmedins_code string, doctor string, insuplc_admdvs string, mdtrtarea_admvs string, request_url string, cainfo string, access_key string) (string, string) {
- // 生成签名
- timestamp := time.Now().Unix()
- inputMessage := SetAHInputMessage(timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, cainfo)
- 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 //交易输入
- argInputMessage := make(map[string]interface{})
- argInputMessage["arg0"] = inputMessage
- bytesData, err := json.Marshal(argInputMessage)
- fmt.Println(string(bytesData))
- requestLog := string(bytesData)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
-
- request_url = request_url + "2404"
- return AHHttpRequest(request_url, access_key, secret_key, timestamp, string(bytesData), "2404"), requestLog
-
- }
- func AHyb2405(mdtrt_id string, psn_no string, secret_key string, org_name string, fixmedins_code string, doctor string, insuplc_admdvs string, mdtrtarea_admvs string, request_url string, cainfo string, access_key string) (string, string) {
- // 生成签名
- timestamp := time.Now().Unix()
- inputMessage := SetAHInputMessage(timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, cainfo)
- 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))
- requestLog := string(bytesData)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
-
- request_url = request_url + "2405"
- return AHHttpRequest(request_url, access_key, secret_key, timestamp, string(bytesData), "2405"), requestLog
-
- }
-
- func AHyb2402(struct2402 Struct2402, secret_key string, org_name string, fixmedins_code string, doctor string, insuplc_admdvs string, mdtrtarea_admvs string, request_url string, cainfo string, access_key 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"] = "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))
- requestLog := string(bytesData)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
-
- request_url = request_url + "2402"
- return AHHttpRequest(request_url, access_key, secret_key, timestamp, string(bytesData), "2402"), requestLog
-
- }
-
- func AHyb2301(psnNo string, mdtrtId string, hisPrescription []*models.NewCustom, med_type string, chrg_bchno string, dept_code string, dept string, doctor_id string, secret_key string, org_name string, fixmedins_code string, doctor string, insuplc_admdvs string, mdtrtarea_admvs string, request_url string, cainfo string, access_key string) (string, string) {
- // 生成签名
- timestamp := time.Now().Unix()
- inputMessage := SetAHInputMessage(timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, cainfo)
- var customs []*models.NewCustom
-
- customs = hisPrescription
- // 生成输入报文
- 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(string(bytesData))
- requestLog := string(bytesData)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
-
- request_url = request_url + "2301"
- return AHHttpRequest(request_url, access_key, secret_key, timestamp, string(bytesData), "2301"), requestLog
-
- }
-
- func AHyb2302(psnNo string, mdtrtId string, refund_type int64, number string, secret_key string, org_name string, fixmedins_code string, doctor string, insuplc_admdvs string, mdtrtarea_admvs string, request_url string, cainfo string, access_key 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"] = "2302" // 交易编码
- if refund_type == 1 {
- inputData["feedetl_sn"] = number //
-
- } else {
- inputData["feedetl_sn"] = "0000" //
- }
-
- inputData["mdtrt_id"] = mdtrtId // 就诊 ID
- inputData["psn_no"] = psnNo // 人员编号
-
- input["data"] = inputData
- inputMessage["input"] = input //交易输入
- bytesData, err := json.Marshal(inputMessage)
- fmt.Println(string(bytesData))
- requestLog := string(bytesData)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
-
- request_url = request_url + "2302"
- return AHHttpRequest(request_url, access_key, secret_key, timestamp, string(bytesData), "2302"), requestLog
-
- }
-
- func AHyb2303(psnNo string, mdtrtId string, certNo string, insutype string, total string, certificates int64, id_card_type int64, mid_setl_flag string, secret_key string, org_name string, fixmedins_code string, doctor string, insuplc_admdvs string, mdtrtarea_admvs string, request_url string, cainfo string, access_key string,card_sn string,psn_type int64,psn_cert_type string,certno string,psn_name 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"] = "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" // 发票号
-
- inputData["card_sn"] = card_sn // 发票号
- inputData["psn_cert_type"] = psn_cert_type // 发票号
- inputData["certno"] = certno // 发票号
- inputData["psn_type"] = psn_type // 发票号
- inputData["psn_name"] = psn_name // 发票号
-
-
-
-
-
- inputData["insuplc_admdvs"] = insuplc_admdvs // 发票号
- inputData["mdtrtarea_admvs"] = mdtrtarea_admvs // 发票号
-
- input["data"] = inputData
- inputMessage["input"] = input //交易输入
- bytesData, err := json.Marshal(inputMessage)
- fmt.Println(string(bytesData))
- requestLog := string(bytesData)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
-
- request_url = request_url + "2303"
- return AHHttpRequest(request_url, access_key, secret_key, timestamp, string(bytesData), "2303"), requestLog
-
- }
-
- func AHyb2304(psnNo string, mdtrtId string, certNo string, insutype string, total string, certificates int64, id_card_type int64, mid_setl_flag string, secret_key string, org_name string, fixmedins_code string, doctor string, insuplc_admdvs string, mdtrtarea_admvs string, request_url string, cainfo string, access_key string, 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["insuplc_admdvs"] = insuplc_admdvs
- inputData["mdtrtarea_admvs"] = mdtrtarea_admvs
-
- 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 // 险种类型
-
- input["data"] = inputData
- inputMessage["input"] = input //交易输入
-
- bytesData, err := json.Marshal(inputMessage)
- fmt.Println(string(bytesData))
- requestLog := string(bytesData)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
-
- request_url = request_url + "2304"
- return AHHttpRequest(request_url, access_key, secret_key, timestamp, string(bytesData), "2304"), requestLog
-
- }
- func AHyb2305(psnNo string, mdtrtId string, setlId string, secret_key string, org_name string, fixmedins_code string, doctor string, insuplc_admdvs string, mdtrtarea_admvs string, request_url string, cainfo string, access_key string) (string, string) {
- // 生成签名
- timestamp := time.Now().Unix()
-
-
- inputMessage := SetAHInputMessage(timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, cainfo)
- 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 //交易输入
- argInputMessage := make(map[string]interface{})
- argInputMessage["arg0"] = inputMessage
- bytesData, err := json.Marshal(argInputMessage)
- fmt.Println(string(bytesData))
- requestLog := string(bytesData)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
-
- request_url = request_url + "2305"
- return AHHttpRequest(request_url, access_key, secret_key, timestamp, string(bytesData), "2305"), requestLog
-
- }
-
- //CBS总线
- func AHHttpRequest(url string, ak string, sk string, timestamp int64, json string, infno string) string {
- fmt.Println(url)
- //step 1. 设置请求参数
- csbHP := csbhttp.NewHttpParams(url) //设置请求地址及url参数
- //设置调用方式 get 或者 post
- csbHP.SetMethod("post")
- //设置 调用的服务名和版本
- csbHP.SetApi("hsa-fsi-" + infno)
- csbHP.SetVersion("1.0.0")
-
- //添加附加的http请求头 (可以定义多条)
- //key := "_api_access_key=" + ak + "&_api_name=" + "hssServives" + "&_api_timestamp=" + strconv.FormatInt(timestamp, 10) + "&_api_version=" + "1.0.0"
- csbHP.AddHeader("_api_timestamp", strconv.FormatInt(timestamp, 10))
- csbHP.AddHeader("_api_name", "hsa-fsi-"+infno)
- csbHP.AddHeader("_api_version", "1.0.0")
- csbHP.AddHeader("_api_access_key", ak)
- csbHP.AddHeader("Content-Type", "application/json;charset=UTF-8")
-
- //request.Header.Set("Content-Type", "application/json;charset=UTF-8")
-
- //还可以,设置附加的byte[]或者json请求体
-
- csbHP.SetContentBody(json, nil)
- //设置请求的ak和sk
- csbHP.SetAK(ak)
- csbHP.SetSK(sk)
- //打印请求参数信息
- csbHP.Print()
- //进行调用, 返回的第二项为resonse http headers (map[string][]string类型)
- //res, _, err := csbhttp.Invoke(*csbHP, requestByte)
- res, _, err := csbhttp.Invoke(*csbHP, strconv.FormatInt(timestamp, 10))
- fmt.Println("err:")
- fmt.Println(err)
-
- //是否发成错误
- if err != nil {
- fmt.Println(err)
- return ""
- }
- fmt.Println(res)
- return res
- }
-
- // 生成基础报文
- func SetAHInputMessage(timestamp int64, org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, cainfo string) map[string]interface{} {
- // 生成签名
- tempTime := time.Unix(timestamp, 0)
- //timeFormat := tempTime.Format("20060102150405")
- timeFormatOne := tempTime.Format("2006-01-02 15:04:05")
- //randNum := rand.New(rand.NewSource(time.Now().UnixNano())).Int31n(10000)
-
- month := time.Unix(1557042972, 0).Format("1")
- year := time.Now().Format("2006")
- month = time.Now().Format("01")
- day := time.Now().Format("02")
-
- hour := time.Now().Format("15")
- min := time.Now().Format("04")
- sec := time.Now().Format("05")
-
- msec := time.Now().Format("000")
-
- // 生成输入报文
- inputMessage := make(map[string]interface{})
- inputMessage["msgid"] = fixmedins_code + year + month + day + hour + min + sec + msec + "0" // 发送方报文 ID
- inputMessage["mdtrtarea_admvs"] = mdtrtarea_admvs // 就医地医保区划
- inputMessage["insuplc_admdvs"] = insuplc_admdvs // 参保地医保区划
- inputMessage["recer_sys_code"] = "1" // 接收方系统代码
- inputMessage["dev_no"] = "1" // 设备编号
- inputMessage["dev_safe_info"] = "1" // 设备安全信息
- inputMessage["cainfo"] = cainfo // 数字签名信息
- inputMessage["signtype"] = "SM3" // 签名类型
- inputMessage["infver"] = "V1.0" // 接收方系统代码
- inputMessage["opter_type"] = "1" // 经办人类别
- inputMessage["opter"] = doctor // 经办人
- inputMessage["opter_name"] = doctor // 经办人姓名
- inputMessage["inf_time"] = timeFormatOne // 交易时间
- inputMessage["fixmedins_code"] = fixmedins_code // 定点医药机构编号
- inputMessage["fixmedins_name"] = org_name
- inputMessage["fixmedins_soft_fcty"] = "深圳市领透科技有限公司" //定点医药机构名称
- //定点医药机构名称
- inputMessage["sign_no"] = "" //交易签到流水号
- return inputMessage
- }
-
- func AHyb5301(psnNo string, org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, request_url string, access_key string, cainfo string) (string, string) {
- // 生成签名
- //nonce := GetRandomString(32)
- timestamp := time.Now().Unix()
- //signature := setSignature(timestamp, nonce, secret_key)
- //tempTime := time.Unix(timestamp, 0)
- //timeFormatOne := tempTime.Format("2006-01-02 15:04:05")
-
- //timeFormatTwo := tempTime.Format("2006-01-02")
-
- // 生成输入报文
- inputMessage := SetAHInputMessage(timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, cainfo)
- input := make(map[string]interface{})
- inputData := make(map[string]interface{})
- inputMessage["infno"] = "5301" // 交易编码
- inputData["psn_no"] = psnNo // 人员编号 (来自1101接口返回)
- input["data"] = inputData
- inputMessage["input"] = input //交易输入
-
- argInputMessage := make(map[string]interface{})
- argInputMessage["arg0"] = inputMessage
- bytesData, err := json.Marshal(argInputMessage)
- fmt.Println(string(bytesData))
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
-
- request_url = request_url + "5301"
- return AHHttpRequest(request_url, access_key, secret_key, timestamp, string(bytesData), "5301"), string(bytesData)
-
- }
-
- func AHyb2503(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, start_time string, end_time string, check_time string, request_url string, access_key string, cainfo string) (string, string) {
- timestamp := time.Now().Unix()
- // 生成输入报文
- inputMessage := SetAHInputMessage(timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, cainfo)
- 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"] = check_time // 险种类型(来自1101接口返回)
- inputData["diag_dr_codg"] = doctor_id // 开始时间
- inputData["diag_dr_name"] = doctor // 开始时间
- inputData["begndate"] = start_time // 医师编码
- inputData["tel"] = "" // 医师编码
- inputData["addr"] = "" // 医师编码
- inputData["enddate"] = end_time // 医师编码
-
- input["data"] = inputData
- inputMessage["input"] = input //交易输入
- argInputMessage := make(map[string]interface{})
- argInputMessage["arg0"] = inputMessage
- bytesData, err := json.Marshal(argInputMessage)
- fmt.Println(string(bytesData))
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- request_url = request_url + "2503"
- return AHHttpRequest(request_url, access_key, secret_key, timestamp, string(bytesData), "2503"), string(bytesData)
- }
-
- func AHyb3201(fixmedins_setl_cnt int64, acct_pay float64, fund_pay_sumamt float64, medfee_sumamt float64, stmt_begndate string, stmt_enddate string, setl_optins string, clr_type string, insutype string, org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, request_url string, access_key string, secret_key string, cainfo string) (string, string) {
- // 生成签名
- timestamp := time.Now().Unix()
- // 生成输入报文
- inputMessage := SetAHInputMessage(timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, cainfo)
- input := make(map[string]interface{})
- inputData := make(map[string]interface{})
- inputMessage["infno"] = "3201" // 交易编码
- inputData["insutype"] = insutype // 险种
- inputData["clr_type"] = clr_type // 就诊 ID(来自2201接口返回)
- inputData["setl_optins"] = setl_optins // 结算经办机构
- inputData["stmt_begndate"] = stmt_begndate // 对帐开始时间
- inputData["stmt_enddate"] = stmt_enddate //对帐结束时间
- inputData["medfee_sumamt"] = medfee_sumamt //医疗费总额
- inputData["fund_pay_sumamt"] = fund_pay_sumamt //基金支付总额
- inputData["acct_pay"] = acct_pay //个人账户支付金额
- inputData["fixmedins_setl_cnt"] = fixmedins_setl_cnt //定点医药机构结算笔数
- inputData["refd_setl_flag"] = 0 //
-
- input["data"] = inputData
- inputMessage["input"] = input //交易输入
- argInputMessage := make(map[string]interface{})
- argInputMessage["arg0"] = inputMessage
- bytesData, err := json.Marshal(argInputMessage)
- fmt.Println(string(bytesData))
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- //request_url = request_url + "3201"
- fmt.Println(request_url)
- reader := bytes.NewReader(bytesData)
- request_url = request_url + "3201"
- request, err := http.NewRequest("POST", request_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("_api_timestamp", strconv.FormatInt(timestamp, 10))
- //request.Header.Set("_api_name", "hssServives")
- //request.Header.Set("_api_version", "1.0.0")
- //request.Header.Set("_api_access_key", access_key)
- //request.Header.Set("_api_signature", "")
-
- client := http.Client{}
- resp, err := client.Do(request)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- respBytes, err := ioutil.ReadAll(resp.Body)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- str := string(respBytes)
- fmt.Println(str)
- return str, string(bytesData)
- }
-
- func AHyb9001(org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, admin_user_id string, request_url string, cainfo string, access_key string) (string, string) {
- fmt.Println(request_url)
-
- // 生成签名
- timestamp := time.Now().Unix()
- // 生成输入报文
- inputMessage := SetAHInputMessage(timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, cainfo)
- input := make(map[string]interface{})
- inputData := make(map[string]interface{})
- inputMessage["infno"] = "9001" // 交易编码
- inputData["opter_no"] = cainfo
- inputData["mac"] = GetMacTwo() // 开始时间
- inputData["ip"] = GetLocalIpTwo()
- input["signIn"] = inputData
-
- inputMessage["input"] = input //交易输入
- argInputMessage := make(map[string]interface{})
- argInputMessage["arg0"] = inputMessage
- bytesData, err := json.Marshal(argInputMessage)
- fmt.Println(string(bytesData))
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
-
- reader := bytes.NewReader(bytesData)
- request_url = request_url + "9001"
- fmt.Println(request_url)
-
- request, err := http.NewRequest("POST", request_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("_api_timestamp", strconv.FormatInt(timestamp, 10))
- //request.Header.Set("_api_name", "hssServives")
- //request.Header.Set("_api_version", "1.0.0")
- //request.Header.Set("_api_access_key", access_key)
- //request.Header.Set("_api_signature", "")
-
- client := http.Client{}
- resp, err := client.Do(request)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- respBytes, err := ioutil.ReadAll(resp.Body)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- str := string(respBytes)
- fmt.Println(str)
- return str, string(bytesData)
-
- }
-
- func AHyb3101(pd models.PatientDtos, fed models.FsiEncounterDtos, fdds []*models.FsiDiagnoseDtos, fods []*models.FsiOrderDtos, fopds []*models.FsiOperationDtosData, params models.PublicParams, trig_scen string) (string, string) {
- // 生成签名
- timestamp := time.Now().Unix()
- // 生成输入报文
- inputMessage := SetAHInputMessage(timestamp, params.FixmedinsName, params.OpterName, params.FixmedinsCode, params.InsuplcAdmdvs, params.MdtrtareaAdmvs, params.Cainfo)
- input := make(map[string]interface{})
- inputData := make(map[string]interface{})
- patientDtosinputData := make(map[string]interface{})
- fisEncounterDtosData := make(map[string]interface{})
- fsiDiagnoseDtosDatas := make([]map[string]interface{}, 0)
-
- fsiOrderDtosDatas := make([]map[string]interface{}, 0)
-
- fsiOperationDtosData := make(map[string]interface{})
- fsiOperationDtosDatas := make([]map[string]interface{}, 0)
-
- //就诊信息
- fisEncounterDtosData["mdtrt_id"] = fed.MdtrtID
- fisEncounterDtosData["medins_id"] = fed.MedinsID
- fisEncounterDtosData["medins_name"] = fed.MedinsName
- fisEncounterDtosData["medins_admdvs"] = fed.MedinsAdmdvs
- fisEncounterDtosData["medins_type"] = fed.MedinsType
- fisEncounterDtosData["medins_lv"] = fed.MedinsLv
- fisEncounterDtosData["wardarea_codg"] = fed.WardareaCodg
- fisEncounterDtosData["wardno"] = fed.Wardno
- fisEncounterDtosData["bedno"] = fed.Bedno
- fisEncounterDtosData["adm_date"] = fed.AdmDate
- fisEncounterDtosData["dscg_date"] = fed.DscgDate
- fisEncounterDtosData["dscg_main_dise_codg"] = fed.DscgMainDiseCodg
- fisEncounterDtosData["dscg_main_dise_name"] = fed.DscgMainDiseName
-
- for _, fdd := range fdds {
- fsiDiagnoseDtosData := make(map[string]interface{})
- //诊断集合
- fsiDiagnoseDtosData["dise_id"] = fdd.DiseID
- fsiDiagnoseDtosData["inout_dise_type"] = fdd.InoutDiseType
- fsiDiagnoseDtosData["maindise_flag"] = fdd.MaindiseFlag
- fsiDiagnoseDtosData["dias_srt_no"] = fdd.DiasSrtNo
- fsiDiagnoseDtosData["dise_codg"] = fdd.DiseCodg
- fsiDiagnoseDtosData["dise_name"] = fdd.DiseName
- fsiDiagnoseDtosData["dise_date"] = fdd.DiseDate
- fsiDiagnoseDtosDatas = append(fsiDiagnoseDtosDatas, fsiDiagnoseDtosData)
- }
-
- fisEncounterDtosData["fsi_diagnose_dtos"] = fsiDiagnoseDtosDatas
-
- fisEncounterDtosData["dr_codg"] = fed.DrCodg
- fisEncounterDtosData["adm_dept_codg"] = fed.AdmDeptCodg
- fisEncounterDtosData["adm_dept_name"] = fed.AdmDeptName
- fisEncounterDtosData["dscg_dept_codg"] = fed.DscgDeptCodg
- fisEncounterDtosData["dscg_dept_name"] = fed.DscgDeptName
- fisEncounterDtosData["med_mdtrt_type"] = fed.MedMdtrtType
- fisEncounterDtosData["med_type"] = fed.MedType
-
- for _, fod := range fods {
- fsiOrderDtosData := make(map[string]interface{})
- //医嘱集合
- fsiOrderDtosData["rx_id"] = fod.RxID
- fsiOrderDtosData["rxno"] = fod.Rxno
- fsiOrderDtosData["grpno"] = fod.Grpno
- fsiOrderDtosData["long_drord_flag"] = fod.LongDrordFlag
- fsiOrderDtosData["hilist_type"] = fod.HilistType
- fsiOrderDtosData["chrg_type"] = fod.ChrgType
- fsiOrderDtosData["drord_bhvr"] = fod.DrordBhvr
- fsiOrderDtosData["hilist_code"] = fod.HilistCode
- fsiOrderDtosData["hilist_name"] = fod.HilistName
- fsiOrderDtosData["hilist_dosform"] = fod.HilistDosform
- fsiOrderDtosData["hilist_lv"] = fod.HilistLv
- fsiOrderDtosData["hilist_pric"] = fod.HilistPric
- fsiOrderDtosData["lv1_hosp_item_pric"] = fod.Lv1HospItemPric
- fsiOrderDtosData["lv2_hosp_item_pric"] = fod.Lv2HospItemPric
- fsiOrderDtosData["lv3_hosp_item_pric"] = fod.Lv3HospItemPric
- fsiOrderDtosData["hilist_memo"] = fod.HilistMemo
- fsiOrderDtosData["hosplist_code"] = fod.HosplistCode
- fsiOrderDtosData["hosplist_name"] = fod.HosplistName
- fsiOrderDtosData["hosplist_dosform"] = fod.HosplistDosform
- fsiOrderDtosData["cnt"] = fod.Cnt
- fsiOrderDtosData["pric"] = fod.Pric
- fsiOrderDtosData["sumamt"] = fod.Sumamt
- fsiOrderDtosData["ownpay_amt"] = fod.OwnpayAmt
- fsiOrderDtosData["selfpay_amt"] = fod.SelfpayAmt
- fsiOrderDtosData["spec"] = fod.Spec
- fsiOrderDtosData["spec_unt"] = fod.SpecUnt
- fsiOrderDtosData["drord_begn_date"] = fod.DrordBegnDate
- fsiOrderDtosData["drord_stop_date"] = fod.DrordStopDate
- fsiOrderDtosData["drord_dept_codg"] = fod.DrordDeptCodg
- fsiOrderDtosData["drord_dept_name"] = fod.DrordDeptName
- fsiOrderDtosData["drord_dr_codg"] = fod.DrordDrCodg
- fsiOrderDtosData["drord_dr_name"] = fod.DrordDrName
- fsiOrderDtosData["drord_dr_profttl"] = fod.DrordDrProfttl
- fsiOrderDtosData["curr_drord_flag"] = fod.CurrDrordFlag
- fsiOrderDtosDatas = append(fsiOrderDtosDatas, fsiOrderDtosData)
- }
- fisEncounterDtosData["fsi_order_dtos"] = fsiOrderDtosDatas
-
- fisEncounterDtosData["matn_stas"] = fed.MatnStas
- fisEncounterDtosData["medfee_sumamt"] = fed.MedfeeSumamt
- fisEncounterDtosData["ownpay_amt"] = fed.OwnpayAmt
- fisEncounterDtosData["selfpay_amt"] = fed.SelfpayAmt
- fisEncounterDtosData["acct_payamt"] = fed.AcctPayamt
- fisEncounterDtosData["ma_amt"] = fed.MaAmt
- fisEncounterDtosData["hifp_payamt"] = fed.HifpPayamt
- fisEncounterDtosData["setl_totlnum"] = fed.SetlTotlnum
- fisEncounterDtosData["insutype"] = fed.Insutype
- fisEncounterDtosData["reim_flag"] = fed.ReimFlag
- fisEncounterDtosData["out_setl_flag"] = fed.OutSetlFlag
-
- //手术操作
- for _, fopd := range fopds {
- fsiOperationDtosData["setl_list_oprn_id"] = fopd.Setl_list_oprn_id
- fsiOperationDtosData["oprn_code"] = fopd.Oprn_code
- fsiOperationDtosData["oprn_name"] = fopd.Oprn_name
- fsiOperationDtosData["main_oprn_flag"] = fopd.Main_oprn_flag
- fsiOperationDtosData["oprn_date"] = fopd.Oprn_date
- fsiOperationDtosData["anst_way"] = fopd.Anst_way
- fsiOperationDtosData["oper_dr_name"] = fopd.Oper_dr_name
- fsiOperationDtosData["oper_dr_code"] = fopd.Oper_dr_code
- fsiOperationDtosData["anst_dr_name"] = fopd.Anst_dr_name
- fsiOperationDtosData["anst_dr_code"] = fopd.Anst_dr_code
- fsiOperationDtosDatas = append(fsiOperationDtosDatas, fsiOperationDtosData)
- }
- fisEncounterDtosData["fsi_operation_dtos"] = fsiOperationDtosDatas
-
- patientDtosinputData["patn_id"] = pd.PatnID
- patientDtosinputData["patn_name"] = pd.PatnName
- patientDtosinputData["gend"] = pd.Gend
- patientDtosinputData["brdy"] = pd.Brdy
- patientDtosinputData["poolarea"] = pd.Poolarea
- patientDtosinputData["curr_mdtrt_id"] = pd.CurrMdtrtID
- patientDtosinputData["fsi_his_data_dto"] = ""
- patientDtosinputData["fsi_encounter_dtos"] = fisEncounterDtosData
- inputData["syscode"] = "LinkDialysis"
- inputData["trig_scen"] = trig_scen
- inputData["rule_ids"] = ""
- inputData["task_id"] = ""
-
- inputData["patient_dtos"] = patientDtosinputData
- input["data"] = inputData
- inputMessage["infno"] = "3101"
- inputMessage["input"] = input //交易输入
- argInputMessage := make(map[string]interface{})
- argInputMessage["arg0"] = inputMessage
- bytesData, err := json.Marshal(argInputMessage)
- fmt.Println(string(bytesData))
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- params.RequestUrl = params.RequestUrl + "3101"
- return AHHttpRequest(params.RequestUrl, params.AccessKey, params.SecretKey, timestamp, string(bytesData), "3101"), string(bytesData)
-
- }
- func AHyb3102(pd models.PatientDtos, fed models.FsiEncounterDtos, fdds []*models.FsiDiagnoseDtos, fods []*models.FsiOrderDtos, fopds []*models.FsiOperationDtosData, params models.PublicParams, trig_scen string) (string, string) {
- // 生成签名
- timestamp := time.Now().Unix()
- // 生成输入报文
- inputMessage := SetAHInputMessage(timestamp, params.FixmedinsName, params.OpterName, params.FixmedinsCode, params.InsuplcAdmdvs, params.MdtrtareaAdmvs, params.Cainfo)
- input := make(map[string]interface{})
- inputData := make(map[string]interface{})
- patientDtosinputData := make(map[string]interface{})
- fisEncounterDtosData := make(map[string]interface{})
- fsiDiagnoseDtosDatas := make([]map[string]interface{}, 0)
-
- fsiOrderDtosDatas := make([]map[string]interface{}, 0)
-
- fsiOperationDtosData := make(map[string]interface{})
- fsiOperationDtosDatas := make([]map[string]interface{}, 0)
-
- //就诊信息
- fisEncounterDtosData["mdtrt_id"] = fed.MdtrtID
- fisEncounterDtosData["medins_id"] = fed.MedinsID
- fisEncounterDtosData["medins_name"] = fed.MedinsName
- fisEncounterDtosData["medins_admdvs"] = fed.MedinsAdmdvs
- fisEncounterDtosData["medins_type"] = fed.MedinsType
- fisEncounterDtosData["medins_lv"] = fed.MedinsLv
- fisEncounterDtosData["wardarea_codg"] = fed.WardareaCodg
- fisEncounterDtosData["wardno"] = fed.Wardno
- fisEncounterDtosData["bedno"] = fed.Bedno
- fisEncounterDtosData["adm_date"] = fed.AdmDate
- fisEncounterDtosData["dscg_date"] = fed.DscgDate
- fisEncounterDtosData["dscg_main_dise_codg"] = fed.DscgMainDiseCodg
- fisEncounterDtosData["dscg_main_dise_name"] = fed.DscgMainDiseName
-
- for _, fdd := range fdds {
- fsiDiagnoseDtosData := make(map[string]interface{})
- //诊断集合
- fsiDiagnoseDtosData["dise_id"] = fdd.DiseID
- fsiDiagnoseDtosData["inout_dise_type"] = fdd.InoutDiseType
- fsiDiagnoseDtosData["maindise_flag"] = fdd.MaindiseFlag
- fsiDiagnoseDtosData["dias_srt_no"] = fdd.DiasSrtNo
- fsiDiagnoseDtosData["dise_codg"] = fdd.DiseCodg
- fsiDiagnoseDtosData["dise_name"] = fdd.DiseName
- fsiDiagnoseDtosData["dise_date"] = fdd.DiseDate
- fsiDiagnoseDtosDatas = append(fsiDiagnoseDtosDatas, fsiDiagnoseDtosData)
- }
-
- fisEncounterDtosData["fsi_diagnose_dtos"] = fsiDiagnoseDtosDatas
-
- fisEncounterDtosData["dr_codg"] = fed.DrCodg
- fisEncounterDtosData["adm_dept_codg"] = fed.AdmDeptCodg
- fisEncounterDtosData["adm_dept_name"] = fed.AdmDeptName
- fisEncounterDtosData["dscg_dept_codg"] = fed.DscgDeptCodg
- fisEncounterDtosData["dscg_dept_name"] = fed.DscgDeptName
- fisEncounterDtosData["med_mdtrt_type"] = fed.MedMdtrtType
- fisEncounterDtosData["med_type"] = fed.MedType
-
- for _, fod := range fods {
- fsiOrderDtosData := make(map[string]interface{})
- //医嘱集合
- fsiOrderDtosData["rx_id"] = fod.RxID
- fsiOrderDtosData["rxno"] = fod.Rxno
- fsiOrderDtosData["grpno"] = fod.Grpno
- fsiOrderDtosData["long_drord_flag"] = fod.LongDrordFlag
- fsiOrderDtosData["hilist_type"] = fod.HilistType
- fsiOrderDtosData["chrg_type"] = fod.ChrgType
- fsiOrderDtosData["drord_bhvr"] = fod.DrordBhvr
- fsiOrderDtosData["hilist_code"] = fod.HilistCode
- fsiOrderDtosData["hilist_name"] = fod.HilistName
- fsiOrderDtosData["hilist_dosform"] = fod.HilistDosform
- fsiOrderDtosData["hilist_lv"] = fod.HilistLv
- fsiOrderDtosData["hilist_pric"] = fod.HilistPric
- fsiOrderDtosData["lv1_hosp_item_pric"] = fod.Lv1HospItemPric
- fsiOrderDtosData["lv2_hosp_item_pric"] = fod.Lv2HospItemPric
- fsiOrderDtosData["lv3_hosp_item_pric"] = fod.Lv3HospItemPric
- fsiOrderDtosData["hilist_memo"] = fod.HilistMemo
- fsiOrderDtosData["hosplist_code"] = fod.HosplistCode
- fsiOrderDtosData["hosplist_name"] = fod.HosplistName
- fsiOrderDtosData["hosplist_dosform"] = fod.HosplistDosform
- fsiOrderDtosData["cnt"] = fod.Cnt
- fsiOrderDtosData["pric"] = fod.Pric
- fsiOrderDtosData["sumamt"] = fod.Sumamt
- fsiOrderDtosData["ownpay_amt"] = fod.OwnpayAmt
- fsiOrderDtosData["selfpay_amt"] = fod.SelfpayAmt
- fsiOrderDtosData["spec"] = fod.Spec
- fsiOrderDtosData["spec_unt"] = fod.SpecUnt
- fsiOrderDtosData["drord_begn_date"] = fod.DrordBegnDate
- fsiOrderDtosData["drord_stop_date"] = fod.DrordStopDate
- fsiOrderDtosData["drord_dept_codg"] = fod.DrordDeptCodg
- fsiOrderDtosData["drord_dept_name"] = fod.DrordDeptName
- fsiOrderDtosData["drord_dr_codg"] = fod.DrordDrCodg
- fsiOrderDtosData["drord_dr_name"] = fod.DrordDrName
- fsiOrderDtosData["drord_dr_profttl"] = fod.DrordDrProfttl
- fsiOrderDtosData["curr_drord_flag"] = fod.CurrDrordFlag
- fsiOrderDtosDatas = append(fsiOrderDtosDatas, fsiOrderDtosData)
- }
-
- fisEncounterDtosData["fsi_order_dtos"] = fsiOrderDtosDatas
-
- fisEncounterDtosData["matn_stas"] = fed.MatnStas
- fisEncounterDtosData["medfee_sumamt"] = fed.MedfeeSumamt
- fisEncounterDtosData["ownpay_amt"] = fed.OwnpayAmt
- fisEncounterDtosData["selfpay_amt"] = fed.SelfpayAmt
- fisEncounterDtosData["acct_payamt"] = fed.AcctPayamt
- fisEncounterDtosData["ma_amt"] = fed.MaAmt
- fisEncounterDtosData["hifp_payamt"] = fed.HifpPayamt
- fisEncounterDtosData["setl_totlnum"] = fed.SetlTotlnum
- fisEncounterDtosData["insutype"] = fed.Insutype
- fisEncounterDtosData["reim_flag"] = fed.ReimFlag
- fisEncounterDtosData["out_setl_flag"] = fed.OutSetlFlag
-
- //手术操作
- for _, fopd := range fopds {
- fsiOperationDtosData["setl_list_oprn_id"] = fopd.Setl_list_oprn_id
- fsiOperationDtosData["oprn_code"] = fopd.Oprn_code
- fsiOperationDtosData["oprn_name"] = fopd.Oprn_name
- fsiOperationDtosData["main_oprn_flag"] = fopd.Main_oprn_flag
- fsiOperationDtosData["oprn_date"] = fopd.Oprn_date
- fsiOperationDtosData["anst_way"] = fopd.Anst_way
- fsiOperationDtosData["oper_dr_name"] = fopd.Oper_dr_name
- fsiOperationDtosData["oper_dr_code"] = fopd.Oper_dr_code
- fsiOperationDtosData["anst_dr_name"] = fopd.Anst_dr_name
- fsiOperationDtosData["anst_dr_code"] = fopd.Anst_dr_code
- fsiOperationDtosDatas = append(fsiOperationDtosDatas, fsiOperationDtosData)
- }
- fisEncounterDtosData["fsi_operation_dtos"] = fsiOperationDtosDatas
-
- patientDtosinputData["patn_id"] = pd.PatnID
- patientDtosinputData["patn_name"] = pd.PatnName
- patientDtosinputData["gend"] = pd.Gend
- patientDtosinputData["brdy"] = pd.Brdy
- patientDtosinputData["poolarea"] = pd.Poolarea
- patientDtosinputData["curr_mdtrt_id"] = pd.CurrMdtrtID
- patientDtosinputData["fsi_his_data_dto"] = ""
- patientDtosinputData["fsi_encounter_dtos"] = fisEncounterDtosData
- inputData["syscode"] = "LinkDialysis"
- inputData["trig_scen"] = trig_scen
- inputData["rule_ids"] = ""
- inputData["task_id"] = ""
- inputData["patient_dtos"] = patientDtosinputData
- input["data"] = inputData
- inputMessage["infno"] = "3102"
- inputMessage["input"] = input //交易输入
- argInputMessage := make(map[string]interface{})
- argInputMessage["arg0"] = inputMessage
- bytesData, err := json.Marshal(argInputMessage)
- fmt.Println(string(bytesData))
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- params.RequestUrl = params.RequestUrl + "3102"
- return AHHttpRequest(params.RequestUrl, params.AccessKey, params.SecretKey, timestamp, string(bytesData), "3102"), string(bytesData)
-
- }
-
- func AHyb4101(struct4101 Struct4101, params models.PublicParams) (string, string) {
- timestamp := time.Now().Unix()
- inputMessage := SetAHInputMessage(timestamp, params.FixmedinsName, params.OpterName, params.FixmedinsCode, params.InsuplcAdmdvs, params.MdtrtareaAdmvs, params.Cainfo)
- // 生成输入报文
- input := make(map[string]interface{})
- inputData := make(map[string]interface{})
- inputMessage["infno"] = "4101A" // 交易编码
- 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"] = params.FixmedinsName // 定点医药机构名称 必填
- inputData["fixmedins_code"] = params.FixmedinsCode // 定点医药机构编码 必填
- 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"] = params.FixmedinsName // 医保机构 必填
- inputData["hsorg_opter"] = struct4101.HsorgOpter // 医保机构经办人 必填
- inputData["medins_fill_dept"] = params.FixmedinsName // 医疗机构填报部门 必填
- 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 //交易输入
- argInputMessage := make(map[string]interface{})
- argInputMessage["arg0"] = inputMessage
- bytesData, _ := json.Marshal(argInputMessage)
- fmt.Println(string(bytesData))
-
- params.RequestUrl = params.RequestUrl + "4101"
- return AHHttpRequest(params.RequestUrl, params.AccessKey, params.SecretKey, timestamp, string(bytesData), "4101A"), string(bytesData)
-
- }
- func AHyb4102(psn_no string, setl_id string, params models.PublicParams, stas_type string) (string, string) {
- timestamp := time.Now().Unix()
- inputMessage := SetAHInputMessage(timestamp, params.FixmedinsName, params.OpterName, params.FixmedinsCode, params.InsuplcAdmdvs, params.MdtrtareaAdmvs, params.Cainfo)
- // 生成输入报文
- input := make(map[string]interface{})
- inputData := make(map[string]interface{})
- inputData2 := make(map[string]interface{})
-
- inputMessage["infno"] = "4102" // 交易编码
-
- inputData["setl_id"] = setl_id // 结算 ID 必填
- inputData["psn_no"] = psn_no // 结算 ID 必填
- inputData["stas_type"] = stas_type // 结算 ID 必填
- inputData2["stastinfo"] = inputData
- input["data"] = inputData2
- inputMessage["input"] = input //交易输入
- argInputMessage := make(map[string]interface{})
- argInputMessage["arg0"] = inputMessage
- bytesData, _ := json.Marshal(argInputMessage)
- fmt.Println(string(bytesData))
-
- params.RequestUrl = params.RequestUrl + "4102"
- return AHHttpRequest(params.RequestUrl, params.AccessKey, params.SecretKey, timestamp, string(bytesData), "4102"), string(bytesData)
-
- }
-
- func AHyb4103(psn_no string, setl_id string, params models.PublicParams) (string, string) {
- timestamp := time.Now().Unix()
- inputMessage := SetAHInputMessage(timestamp, params.FixmedinsName, params.OpterName, params.FixmedinsCode, params.InsuplcAdmdvs, params.MdtrtareaAdmvs, params.Cainfo)
- // 生成输入报文
- input := make(map[string]interface{})
- inputData := make(map[string]interface{})
- inputMessage["infno"] = "4103" // 交易编码
-
- inputData["setl_id"] = setl_id // 结算 ID 必填
- inputData["psn_no"] = psn_no // 结算 ID 必填
-
- input["data"] = inputData
- inputMessage["input"] = input //交易输入
- argInputMessage := make(map[string]interface{})
- argInputMessage["arg0"] = inputMessage
- bytesData, _ := json.Marshal(argInputMessage)
-
- params.RequestUrl = params.RequestUrl + "4103"
- return AHHttpRequest(params.RequestUrl, params.AccessKey, params.SecretKey, timestamp, string(bytesData), "4103"), string(bytesData)
-
- }
-
-
- func AHyb4105( params models.PublicParams) (string, string) {
- var meds []string
- meds = append(meds,"21")
-
- timestamp := time.Now().Unix()
- inputMessage := SetAHInputMessage(timestamp, params.FixmedinsName, params.OpterName, params.FixmedinsCode, params.InsuplcAdmdvs, params.MdtrtareaAdmvs, params.Cainfo)
- // 生成输入报文
- input := make(map[string]interface{})
- inputData := make(map[string]interface{})
- inputMessage["infno"] = "4105" // 交易编码
-
- inputData["fixmedins_code"] = params.FixmedinsCode // 结算 ID 必填
- inputData["medtype_list"] = meds // 结算 ID 必填
- inputData["stt_begntime"] = "2023-11-01"// 结算 ID 必填
- inputData["stt_endtime"] = "2023-11-31"// 结算 ID 必填
-
- input["data"] = inputData
- inputMessage["input"] = input //交易输入
- argInputMessage := make(map[string]interface{})
- argInputMessage["arg0"] = inputMessage
-
- bytesData, _ := json.Marshal(argInputMessage)
- fmt.Println(string(bytesData))
-
- params.RequestUrl = params.RequestUrl + "4105"
- return AHHttpRequest(params.RequestUrl, params.AccessKey, params.SecretKey, timestamp, string(bytesData), "4105"), string(bytesData)
-
- }
-
- func AHyb3501(struct3501 models.Struct3501) (string, string) {
- timestamp := time.Now().Unix()
- // 生成输入报文
- inputMessage := SetAHInputMessage(timestamp, struct3501.OrgName, struct3501.Opter, struct3501.FixmedinsCode, struct3501.InsuplcAdmdvs, struct3501.MdtrtareaAdmvs, struct3501.Cainfo)
- input := make(map[string]interface{})
- inputData := make(map[string]interface{})
- inputMessage["infno"] = "3501" // 交易编码
- inputData["med_list_codg"] = struct3501.MedListCodg // 定点医药机构目录编号
- inputData["fixmedins_hilist_id"] = struct3501.FixmedinsHilistId // 定点医药机构目录编号
- inputData["fixmedins_hilist_name"] = struct3501.OrgName // 定点医药机构目录名称
- inputData["rx_flag"] = struct3501.RxFlag //
- inputData["invdate"] = struct3501.Invdate // 人员编号 (来自1101接口返回)
- inputData["inv_cnt"] = struct3501.InvCnt // 人员编号 (来自1101接口返回)
- inputData["manu_lotnum"] = struct3501.ManuLotnum // 人员编号 (来自1101接口返回)
- inputData["fixmedins_bchno"] = struct3501.FixmedinsBchno // 人员编号 (来自1101接口返回)
- inputData["manu_date"] = struct3501.ManuDate // 人员编号 (来自1101接口返回)
- inputData["expy_end"] = struct3501.ExpyEnd // 人员编号 (来自1101接口返回)
- inputData["memo"] = "" // 人员编号 (来自1101接口返回)
- input["invinfo"] = inputData
- inputMessage["input"] = input //交易输入
- argInputMessage := make(map[string]interface{})
- argInputMessage["arg0"] = inputMessage
-
- bytesData, err := json.Marshal(argInputMessage)
- fmt.Println(string(bytesData))
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- struct3501.RequestUrl = struct3501.RequestUrl + "3501"
- return AHHttpRequest(struct3501.RequestUrl, struct3501.AccessKey, struct3501.SecretKey, timestamp, string(bytesData), "3501"), string(bytesData)
-
- }
- func AHyb3502(struct3502 models.Struct3502) (string, string) {
- timestamp := time.Now().Unix()
- // 生成输入报文
- inputMessage := SetAHInputMessage(timestamp, struct3502.OrgName, struct3502.Opter, struct3502.FixmedinsCode, struct3502.InsuplcAdmdvs, struct3502.MdtrtareaAdmvs, struct3502.Cainfo)
- input := make(map[string]interface{})
- inputData := make(map[string]interface{})
- inputMessage["infno"] = "3502" // 交易编码
- inputData["med_list_codg"] = struct3502.MedListCodg // 定点医药机构目录编号
- inputData["inv_chg_type"] = struct3502.InvChgType // 定点医药机构目录编号
-
- inputData["fixmedins_hilist_id"] = struct3502.FixmedinsCode // 定点医药机构目录编号
- inputData["fixmedins_hilist_name"] = struct3502.OrgName // 定点医药机构目录名称
- inputData["fixmedins_bchno"] = struct3502.FixmedinsBchno // 人员编号 (来自1101接口返回)
- inputData["pric"] = struct3502.Pric // 人员编号 (来自1101接口返回)
- inputData["cnt"] = struct3502.Cnt // 人员编号 (来自1101接口返回)
- inputData["rx_flag"] = struct3502.RxFlag //
-
- inputData["inv_chg_time"] = struct3502.InvChgTime // 人员编号 (来自1101接口返回)
- inputData["inv_chg_opter_name"] = "" // 人员编号 (来自1101接口返回)
- inputData["memo"] = struct3502.Memo // 人员编号 (来自1101接口返回)
- inputData["trdn_flag"] = "" // 人员编号 (来自1101接口返回)
-
- input["invinfo"] = inputData
- inputMessage["input"] = input //交易输入
- argInputMessage := make(map[string]interface{})
- argInputMessage["arg0"] = inputMessage
- bytesData, err := json.Marshal(argInputMessage)
- fmt.Println(string(bytesData))
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- struct3502.RequestUrl = struct3502.RequestUrl + "3502"
- return AHHttpRequest(struct3502.RequestUrl, struct3502.AccessKey, struct3502.SecretKey, timestamp, string(bytesData), "3502"), string(bytesData)
-
- }
-
- func AHyb3503(struct3503 models.Struct3503) (string, string) {
- timestamp := time.Now().Unix()
- // 生成输入报文
- inputMessage := SetAHInputMessage(timestamp, struct3503.OrgName, struct3503.Opter, struct3503.FixmedinsCode, struct3503.InsuplcAdmdvs, struct3503.MdtrtareaAdmvs, struct3503.Cainfo)
- input := make(map[string]interface{})
- inputData := make(map[string]interface{})
- inputMessage["infno"] = "3503"
- inputData["med_list_codg"] = struct3503.MedListCodg
- inputData["fixmedins_hilist_id"] = struct3503.FixmedinsCode
- inputData["fixmedins_hilist_name"] = struct3503.OrgName
-
- inputData["dynt_no"] = ""
- inputData["fixmedins_bchno"] = struct3503.FixmedinsBchno // 人员编号 (来自1101接口返回)
-
- inputData["spler_name"] = struct3503.SplerName // 人员编号 (来自1101接口返回)
- inputData["spler_pmtno"] = "" // 人员编号 (来自1101接口返回)
- inputData["manu_lotnum"] = struct3503.ManuLotnum // 人员编号 (来自1101接口返回)
- inputData["prodentp_name"] = struct3503.ProdentpName // 人员编号 (来自1101接口返回)
- inputData["aprvno"] = struct3503.Aprvno // 人员编号 (来自1101接口返回)
- inputData["manu_date"] = struct3503.ManuDate // 人员编号 (来自1101接口返回)
- inputData["expy_end"] = struct3503.ExpyEnd // 人员编号 (来自1101接口返回)
-
- inputData["finl_trns_pric"] = struct3503.FinlTrnsPric // 人员编号 (来自1101接口返回)
- inputData["purc_retn_cnt"] = struct3503.PurcRetnCnt // 人员编号 (来自1101接口返回)
- inputData["purc_invo_codg"] = struct3503.PurcInvoCodg // 人员编号 (来自1101接口返回)
- inputData["purc_invo_no"] = struct3503.PurcInvoNo // 人员编号 (来自1101接口返回)
-
- inputData["rx_flag"] = struct3503.RxFlag // 人员编号 (来自1101接口返回)
-
- inputData["purc_retn_stoin_time"] = struct3503.PurcRetnStoinTime // 人员编号 (来自1101接口返回)
- inputData["purc_retn_opter_name"] = struct3503.PurcRetnOpterName // 人员编号 (来自1101接口返回)
- inputData["prod_geay_flag"] = "" // 人员编号 (来自1101接口返回)
- inputData["memo"] = "" // 人员编号 (来自1101接口返回)
- input["purcinfo"] = inputData
- inputMessage["input"] = input //交易输入
- argInputMessage := make(map[string]interface{})
- argInputMessage["arg0"] = inputMessage
- bytesData, err := json.Marshal(argInputMessage)
- fmt.Println(string(bytesData))
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- struct3503.RequestUrl = struct3503.RequestUrl + "3503"
- return AHHttpRequest(struct3503.RequestUrl, struct3503.AccessKey, struct3503.SecretKey, timestamp, string(bytesData), "3503"), string(bytesData)
-
- }
- func AHyb3504(struct3504 models.Struct3504) (string, string) {
- timestamp := time.Now().Unix()
- // 生成输入报文
- inputMessage := SetAHInputMessage(timestamp, struct3504.OrgName, struct3504.Opter, struct3504.FixmedinsCode, struct3504.InsuplcAdmdvs, struct3504.MdtrtareaAdmvs, struct3504.Cainfo)
- input := make(map[string]interface{})
- inputData := make(map[string]interface{})
- inputMessage["infno"] = "3504" // 交易编码
- inputData["med_list_codg"] = struct3504.MedListCodg // 定点医药机构目录编号
- inputData["fixmedins_hilist_id"] = struct3504.FixmedinsHilistId // 定点医药机构目录编号
- inputData["fixmedins_hilist_name"] = struct3504.FixmedinsHilistName // 定点医药机构目录名称
- inputData["fixmedins_bchno"] = struct3504.FixmedinsBchno // 人员编号 (来自1101接口返回)
- inputData["spler_name"] = struct3504.SplerName // 人员编号 (来自1101接口返回)
- inputData["spler_pmtno"] = "" // 人员编号 (来自1101接口返回)
-
- inputData["manu_date"] = struct3504.ManuDate // 人员编号 (来自1101接口返回)
- inputData["expy_end"] = struct3504.ExpyEnd // 人员编号 (来自1101接口返回)
- inputData["finl_trns_pric"] = struct3504.FinlTrnsPric // 人员编号 (来自1101接口返回)
- inputData["purc_retn_cnt"] = struct3504.PurcRetnCnt // 人员编号 (来自1101接口返回)
- inputData["purc_invo_codg"] = struct3504.PurcInvoCodg // 人员编号 (来自1101接口返回)
- inputData["purc_invo_no"] = struct3504.PurcInvoNo // 人员编号 (来自1101接口返回)
- inputData["rx_flag"] = struct3504.RxFlag // 人员编号 (来自1101接口返回)
- inputData["purc_retn_stoin_time"] = struct3504.PurcRetnStoinTime // 人员编号 (来自1101接口返回)
- inputData["purc_retn_opter_name"] = struct3504.PurcRetnOpterName // 人员编号 (来自1101接口返回)
- inputData["medins_prod_purc_no"] = "" // 人员编号 (来自1101接口返回)
- inputData["memo"] = "" // 人员编号 (来自1101接口返回)
- input["purcinfo"] = inputData
- inputMessage["input"] = input //交易输入
- argInputMessage := make(map[string]interface{})
- argInputMessage["arg0"] = inputMessage
- bytesData, err := json.Marshal(argInputMessage)
- fmt.Println(string(bytesData))
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- struct3504.RequestUrl = struct3504.RequestUrl + "3504"
- return AHHttpRequest(struct3504.RequestUrl, struct3504.AccessKey, struct3504.SecretKey, timestamp, string(bytesData), "3504"), string(bytesData)
-
- }
-
- //func AHyb3505(struct3505 models.Struct3505) (string, string) {
- // timestamp := time.Now().Unix()
- // // 生成输入报文
- // inputMessage := SetAHInputMessage(timestamp, struct3505.OrgName, struct3505.Opter, struct3505.FixmedinsCode, struct3505.InsuplcAdmdvs, struct3505.MdtrtareaAdmvs, struct3505.Cainfo)
- // input := make(map[string]interface{})
- // inputData := make(map[string]interface{})
- // inputMessage["infno"] = "3505" // 交易编码
- // inputData["med_list_codg"] = struct3505.MedListCodg // 定点医药机构目录编号
- // inputData["fixmedins_hilist_id"] = struct3505.FixmedinsCode // 定点医药机构目录编号
- // inputData["fixmedins_hilist_name"] = struct3505.OrgName // 定点医药机构目录名称
- // inputData["fixmedins_bchno"] = struct3505.FixmedinsCode // 人员编号 (来自1101接口返回)
- //
- // inputData["prsc_dr_cert_type"] = struct3505.PrscDrCertType // 人员编号 (来自1101接口返回)
- // inputData["prsc_dr_certno"] = struct3505.PrscDrCertno // 人员编号 (来自1101接口返回)
- // inputData["prsc_dr_name"] = struct3505.PrscDrName // 人员编号 (来自1101接口返回)
- // inputData["phar_cert_type"] = struct3505.PharCertType // 人员编号 (来自1101接口返回)
- // inputData["phar_certno"] = struct3505.PharCertno // 人员编号 (来自1101接口返回)
- //
- // inputData["phar_name"] = struct3505.PharName // 人员编号 (来自1101接口返回)
- // inputData["phar_prac_cert_no"] = struct3505.PharPracCertNo // 人员编号 (来自1101接口返回)
- // inputData["hi_feesetl_type"] = struct3505.HiFeesetlType // 人员编号 (来自1101接口返回)
- // inputData["setl_id"] = struct3505.SetlId // 人员编号 (来自1101接口返回)
- // inputData["mdtrt_sn"] = struct3505.MdtrtSn // 人员编号 (来自1101接口返回)
- // inputData["psn_no"] = struct3505.PsnNo // 人员编号 (来自1101接口返回)
- // inputData["psn_cert_type"] = struct3505.PsnCertType // 人员编号 (来自1101接口返回)
- // inputData["certno"] = struct3505.CertNo // 人员编号 (来自1101接口返回)
- // inputData["psn_name"] = struct3505.PsnName // 人员编号 (来自1101接口返回)
- // inputData["manu_lotnum"] = struct3505.ManuLotnum // 人员编号 (来自1101接口返回)
- // inputData["manu_date"] = struct3505.ManuDate // 人员编号 (来自1101接口返回)
- // inputData["expy_end"] = struct3505.ExpyEnd // 人员编号 (来自1101接口返回)
- //
- // inputData["rx_flag"] = struct3505.RxFlag // 人员编号 (来自1101接口返回)
- // inputData["trdn_flag"] = struct3505.TrdnFlag // 人员编号 (来自1101接口返回)
- //
- // inputData["finl_trns_pric"] = struct3505.FinlTrnsPric // 人员编号 (来自1101接口返回)
- // inputData["rxno"] = struct3505.Rxno // 人员编号 (来自1101接口返回)
- // inputData["rx_circ_flag"] = struct3505.RxCircFlag // 人员编号 (来自1101接口返回)
- //
- // inputData["rtal_docno"] = struct3505.RtalDocno // 人员编号 (来自1101接口返回)
- // inputData["stoout_no"] = struct3505.StooutNo // 人员编号 (来自1101接口返回)
- //
- // inputData["bchno"] = struct3505.Bchno // 人员编号 (来自1101接口返回)
- // inputData["drug_trac_codg"] = struct3505.DrugTracCodg // 人员编号 (来自1101接口返回)
- // inputData["drug_prod_barc"] = struct3505.DrugProdBarc // 人员编号 (来自1101接口返回)
- // inputData["shelf_posi"] = struct3505.ShelfPosi // 人员编号 (来自1101接口返回)
- // inputData["sel_retn_cnt"] = struct3505.SelRetnCnt // 人员编号 (来自1101接口返回)
- // inputData["sel_retn_time"] = struct3505.SelRetnTime // 人员编号 (来自1101接口返回)
- // inputData["sel_retn_opter_name"] = struct3505.SelRetnOpterName // 人员编号 (来自1101接口返回)
- // inputData["memo"] = struct3505.Memo // 人员编号 (来自1101接口返回)
- // input["selinfo"] = inputData
- // inputMessage["input"] = input //交易输入
- // argInputMessage := make(map[string]interface{})
- // argInputMessage["arg0"] = inputMessage
- // bytesData, err := json.Marshal(argInputMessage)
- // fmt.Println(string(bytesData))
- // if err != nil {
- // fmt.Println(err.Error())
- // return err.Error(), ""
- // }
- // struct3505.RequestUrl = struct3505.RequestUrl + "3505"
- // return AHHttpRequest(struct3505.RequestUrl, struct3505.AccessKey, struct3505.SecretKey, timestamp, string(bytesData), "3505"), string(bytesData)
- //
- //}
- func AHyb3506(struct3506 models.Struct3506) (string, string) {
- timestamp := time.Now().Unix()
- // 生成输入报文
- inputMessage := SetAHInputMessage(timestamp, struct3506.OrgName, struct3506.Opter, struct3506.FixmedinsCode, struct3506.InsuplcAdmdvs, struct3506.MdtrtareaAdmvs, struct3506.Cainfo)
- input := make(map[string]interface{})
- inputData := make(map[string]interface{})
- inputMessage["infno"] = "3506" // 交易编码
- inputData["med_list_codg"] = struct3506.MedListCodg // 定点医药机构目录编号
- inputData["fixmedins_hilist_id"] = struct3506.FixmedinsHilistId // 定点医药机构目录编号
- inputData["fixmedins_hilist_name"] = struct3506.OrgName // 定点医药机构目录名称
- inputData["fixmedins_bchno"] = struct3506.FixmedinsBchno // 人员编号 (来自1101接口返回)
-
- inputData["setl_id"] = struct3506.SetlId // 人员编号 (来自1101接口返回)
- inputData["psn_no"] = struct3506.PsnNo // 人员编号 (来自1101接口返回)
- inputData["psn_cert_type"] = struct3506.PsnCertType // 人员编号 (来自1101接口返回)
- inputData["certno"] = struct3506.Certno // 人员编号 (来自1101接口返回)
- inputData["psn_name"] = struct3506.PsnName // 人员编号 (来自1101接口返回)
- inputData["manu_lotnum"] = struct3506.ManuLotnum // 人员编号 (来自1101接口返回)
- inputData["manu_date"] = struct3506.ManuDate // 人员编号 (来自1101接口返回)
- inputData["expy_end"] = struct3506.ExpyEnd // 人员编号 (来自1101接口返回)
- inputData["rx_flag"] = struct3506.RxFlag // 人员编号 (来自1101接口返回)
- inputData["trdn_flag"] = struct3506.TrdnFlag // 人员编号 (来自1101接口返回)
- inputData["finl_trns_pric"] = struct3506.FinlTrnsPric // 人员编号 (来自1101接口返回)
- inputData["sel_retn_cnt"] = struct3506.SelRetnCnt // 人员编号 (来自1101接口返回)
- inputData["sel_retn_time"] = struct3506.SelRetnTime // 人员编号 (来自1101接口返回)
- inputData["sel_retn_opter_name"] = struct3506.SelRetnOpterName // 人员编号 (来自1101接口返回)
- inputData["memo"] = "" // 人员编号 (来自1101接口返回)
- inputData["medins_prod_sel_no"] = "" // 人员编号 (来自1101接口返回)
-
- input["selinfo"] = inputData
- inputMessage["input"] = input //交易输入
- argInputMessage := make(map[string]interface{})
- argInputMessage["arg0"] = inputMessage
- bytesData, err := json.Marshal(argInputMessage)
- fmt.Println(string(bytesData))
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- struct3506.RequestUrl = struct3506.RequestUrl + "3506"
- return AHHttpRequest(struct3506.RequestUrl, struct3506.AccessKey, struct3506.SecretKey, timestamp, string(bytesData), "3506"), string(bytesData)
-
- }
-
- func AHyb3507(struct3507 models.Struct3507) (string, string) {
- timestamp := time.Now().Unix()
- // 生成输入报文
- inputMessage := SetAHInputMessage(timestamp, struct3507.OrgName, struct3507.Opter, struct3507.FixmedinsCode, struct3507.InsuplcAdmdvs, struct3507.MdtrtareaAdmvs, struct3507.Cainfo)
- input := make(map[string]interface{})
- inputData := make(map[string]interface{})
- inputMessage["infno"] = "3507" // 交易编码
- inputData["fixmedins_bchno"] = struct3507.FixmedinsCode // 人员编号 (来自1101接口返回)
- inputData["inv_data_type"] = struct3507.InvDataType // 人员编号 (来自1101接口返回)
-
- input["data"] = inputData
- inputMessage["input"] = input //交易输入
- argInputMessage := make(map[string]interface{})
- argInputMessage["arg0"] = inputMessage
- bytesData, err := json.Marshal(argInputMessage)
- fmt.Println(string(bytesData))
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- struct3507.RequestUrl = struct3507.RequestUrl + "3507"
- return AHHttpRequest(struct3507.RequestUrl, struct3507.AccessKey, struct3507.SecretKey, timestamp, string(bytesData), "3507"), string(bytesData)
-
- }
-
- func AHyb3203(fixmedins_setl_cnt int64, acct_pay float64, fund_pay_sumamt float64, medfee_sumamt float64, stmt_begndate string, stmt_enddate string, setl_optins string, clr_type string, insutype string, org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, request_url string, access_key string, secret_key string, cainfo string) (string, string) {
- // 生成签名
- timestamp := time.Now().Unix()
- // 生成输入报文
- inputMessage := SetAHInputMessage(timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, cainfo)
- input := make(map[string]interface{})
- inputData := make(map[string]interface{})
- inputMessage["infno"] = "3203" // 交易编码
- inputData["stmt_begndate"] = stmt_begndate // 对帐开始时间
- inputData["stmt_enddate"] = stmt_enddate //对帐结束时间
- inputData["medfee_sumamt"] = medfee_sumamt //医疗费总额
- inputData["fund_pay_sumamt"] = fund_pay_sumamt //基金支付总额
- inputData["acct_pay"] = acct_pay //个人账户支付金额
- inputData["fixmedins_setl_cnt"] = fixmedins_setl_cnt //定点医药机构结算笔数
- inputData["fixmedins_code"] = fixmedins_code //个人账户支付金额
-
- input["data"] = inputData
- inputMessage["input"] = input //交易输入
- argInputMessage := make(map[string]interface{})
- argInputMessage["arg0"] = inputMessage
- bytesData, err := json.Marshal(argInputMessage)
- fmt.Println(string(bytesData))
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- request_url = request_url + "3203"
- return AHHttpRequest(request_url, access_key, secret_key, timestamp, string(bytesData), "3203"), string(bytesData)
- }
-
-
-
-
-
-
- func AHyb3505(struct3505 models.Struct3505, secret_key string,request_url string) (string, string) {
- // 生成签名
- //nonce := GetRandomString(32)
- timestamp := time.Now().Unix()
- //signature := setSignature(timestamp, nonce, secret_key)
-
- // 生成输入报文
- inputMessage := SetAHInputMessage(timestamp, struct3505.OrgName, struct3505.Opter, struct3505.Code, struct3505.InsuplcAdmdvs, struct3505.MdtrtareaAdmvs, struct3505.Cainfo)
- input := make(map[string]interface{})
- inputData := make(map[string]interface{})
- inputMessage["infno"] = "3505" // 交易编码
- inputData["med_list_codg"] = struct3505.MedListCodg // 定点医药机构目录编号
- inputData["fixmedins_hilist_id"] = struct3505.FixmedinsHilistId // 定点医药机构目录编号
- inputData["fixmedins_hilist_name"] = struct3505.FixmedinsHilistName // 定点医药机构目录名称
- inputData["fixmedins_bchno"] = struct3505.FixmedinsBchno // 人员编号 (来自1101接口返回)
-
- inputData["prsc_dr_cert_type"] = struct3505.PrscDrCertType // 人员编号 (来自1101接口返回)
- inputData["prsc_dr_certno"] = struct3505.PrscDrCertno // 人员编号 (来自1101接口返回)
- inputData["prsc_dr_name"] = struct3505.PrscDrName // 人员编号 (来自1101接口返回)
- inputData["phar_cert_type"] = struct3505.PharCertType // 人员编号 (来自1101接口返回)
- inputData["phar_certno"] = struct3505.PharCertno // 人员编号 (来自1101接口返回)
-
- inputData["phar_name"] = struct3505.PharName // 人员编号 (来自1101接口返回)
- inputData["phar_prac_cert_no"] = struct3505.PharPracCertNo // 人员编号 (来自1101接口返回)
- inputData["hi_feesetl_type"] = "1" // 人员编号 (来自1101接口返回)
- inputData["setl_id"] = struct3505.SetlId // 人员编号 (来自1101接口返回)
- inputData["mdtrt_sn"] = struct3505.MdtrtSn // 人员编号 (来自1101接口返回)
- inputData["psn_no"] = struct3505.PsnNo // 人员编号 (来自1101接口返回)
- inputData["psn_cert_type"] = struct3505.PsnCertType // 人员编号 (来自1101接口返回)
- inputData["certno"] = struct3505.CertNo // 人员编号 (来自1101接口返回)
- inputData["psn_name"] = struct3505.PsnName // 人员编号 (来自1101接口返回)
- inputData["manu_lotnum"] = struct3505.ManuLotnum // 人员编号 (来自1101接口返回)
- inputData["manu_date"] = struct3505.ManuDate // 人员编号 (来自1101接口返回)
- inputData["expy_end"] = struct3505.ExpyEnd // 人员编号 (来自1101接口返回)
-
- inputData["rx_flag"] = struct3505.RxFlag // 人员编号 (来自1101接口返回)
- inputData["trdn_flag"] = struct3505.TrdnFlag // 人员编号 (来自1101接口返回)
-
- inputData["finl_trns_pric"] = struct3505.FinlTrnsPric // 人员编号 (来自1101接口返回)
- inputData["rxno"] = "---" // 人员编号 (来自1101接口返回)
- inputData["rx_circ_flag"] = "---" // 人员编号 (来自1101接口返回)
-
- inputData["rtal_docno"] = struct3505.RtalDocno // 人员编号 (来自1101接口返回)
- inputData["stoout_no"] = "---" // 人员编号 (来自1101接口返回)
-
- inputData["bchno"] = "---" // 人员编号 (来自1101接口返回)
- //inputData["drug_trac_codg"] = "" // 人员编号 (来自1101接口返回)
- inputData["drug_prod_barc"] = struct3505.DrugProdBarc // 人员编号 (来自1101接口返回)
- inputData["shelf_posi"] = struct3505.ShelfPosi // 人员编号 (来自1101接口返回)
- inputData["sel_retn_cnt"] = struct3505.SelRetnCnt // 人员编号 (来自1101接口返回)
- inputData["sel_retn_time"] = struct3505.SelRetnTime // 人员编号 (来自1101接口返回)
- inputData["sel_retn_opter_name"] = struct3505.SelRetnOpterName // 人员编号 (来自1101接口返回)
- inputData["mdtrt_setl_type"] = struct3505.MdtrtSetlType // 人员编号 (来自1101接口返回)
-
-
- inputData["memo"] = struct3505.Memo // 人员编号 (来自1101接口返回)
- //input["selinfo"] = inputData
- feedetail := make([]map[string]interface{}, 0)
-
- codes := strings.Split(struct3505.DrugTracCodg, ",")
- for _, item := range codes {
- if len(item) > 0 {
- druginputData := make(map[string]interface{})
- druginputData["drug_trac_codg"] = item
- feedetail = append(feedetail, druginputData)
- }
- }
- inputData["drugtracinfo"] = feedetail
- input["selinfo"] = inputData
- inputMessage["input"] = input //交易输入
- argInputMessage := make(map[string]interface{})
- argInputMessage["arg0"] = inputMessage
-
- bytesData, err := json.Marshal(argInputMessage)
- fmt.Println(string(bytesData))
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- reader := bytes.NewReader(bytesData)
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/5301"
- //gdyb_url := beego.AppConfig.String("gdyb_url")
- //gdyb_paasid := beego.AppConfig.String("gdyb_paasid")
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/1101"
- //url := gdyb_url + "3505"
- request_url = request_url + "3505"
-
- request, err := http.NewRequest("POST", request_url, reader)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
-
- request.Header.Set("Content-Type", "application/json;charset=UTF-8")
-
-
- client := http.Client{}
- resp, err := client.Do(request)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- respBytes, err := ioutil.ReadAll(resp.Body)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- str := string(respBytes)
- fmt.Println(str)
- return str , string(bytesData)
- }
|