1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535 |
- package service
-
- import (
- "bytes"
- //"crypto/md5"
- "crypto/sha256"
- "encoding/hex"
- "encoding/json"
- "fmt"
- "gdyb/models"
-
- "strings"
- //"gdyb/utils"
- "github.com/astaxie/beego"
- "github.com/axgle/mahonia"
- "io"
- "io/ioutil"
- "math/rand"
- "mime/multipart"
- "net"
- "net/http"
- "os"
- "os/exec"
- "path/filepath"
- "strconv"
- "syscall"
- "time"
- "unsafe"
- )
-
- const (
- SceretKey = "RhaDw4H0RUbWYyTxmRKM1eSeN0qyGLds" // secretKey 私钥
- )
-
- // 机构信息
- func Gdyb1201(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) string {
- // 生成签名
- nonce := GetRandomString(32)
- timestamp := time.Now().Unix()
- signature := setSignature(timestamp, nonce, secret_key)
- // 生成输入报文
- inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
- input := make(map[string]interface{})
- inputData := make(map[string]interface{})
- inputMessage["infno"] = "1201" // 交易编码
- inputData["fixmedins_type"] = "1"
- inputData["fixmedins_name"] = org_name
- inputData["fixmedins_code"] = fixmedins_code
- input["medinsinfo"] = inputData
- inputMessage["input"] = input //交易输入
- bytesData, err := json.Marshal(inputMessage)
- fmt.Println(string(bytesData))
- if err != nil {
- fmt.Println(err.Error())
- return err.Error()
- }
- reader := bytes.NewReader(bytesData)
- gdyb_url := beego.AppConfig.String("gdyb_url")
- gdyb_paasid := beego.AppConfig.String("gdyb_paasid")
- url := gdyb_url + "1201"
-
- request, err := http.NewRequest("POST", url, reader)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error()
- }
-
- request.Header.Set("Content-Type", "application/json;charset=UTF-8")
- request.Header.Set("x-tif-paasid", gdyb_paasid)
- request.Header.Set("x-tif-signature", signature)
- request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
- request.Header.Set("x-tif-nonce", nonce)
-
- client := http.Client{}
- resp, err := client.Do(request)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error()
- }
- respBytes, err := ioutil.ReadAll(resp.Body)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error()
- }
- fmt.Println(string(respBytes))
- str2 := string(respBytes)
- return str2
- }
-
- // 人员基本信息
- func Gdyb1101(certNo string, org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, id_card_type int64, card_sn string, certificates string, psn_name string) (string, string) {
- //生成签名
- nonce := GetRandomString(32)
- timestamp := time.Now().Unix()
- signature := setSignature(timestamp, nonce, secret_key)
- //生成输入报文
- inputMessage := SetInputMessagenosign(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
- input := make(map[string]interface{})
- inputData := make(map[string]interface{})
- inputMessage["infno"] = "1101" // 交易编码
-
- if certificates == "3" {
- inputData["mdtrt_cert_type"] = "02" // 就诊凭证类型
- inputData["certno"] = certNo // 证件号码
- inputData["psn_cert_type"] = "06" // 人员证件类型
- inputData["mdtrt_cert_no"] = certNo // 就诊凭证编号
-
- } else {
- if id_card_type == 1 {
- inputData["mdtrt_cert_type"] = "03" // 就诊凭证类型
- inputData["card_sn"] = card_sn // 卡识别码
- inputData["certno"] = certNo // 证件号码
- inputData["psn_cert_type"] = "" // 人员证件类型
- inputData["mdtrt_cert_no"] = certNo // 就诊凭证编号
-
- } else {
- inputData["mdtrt_cert_type"] = "02" // 就诊凭证类型
- inputData["card_sn"] = "" // 卡识别码
- inputData["certno"] = certNo // 证件号码
- inputData["psn_cert_type"] = "" // 人员证件类型
- inputData["mdtrt_cert_no"] = certNo // 就诊凭证编号
-
- }
- }
-
- inputData["begntime"] = "" // 开始时间
- inputData["psn_name"] = "" // 人员姓名
- input["data"] = inputData
- inputMessage["input"] = input //交易输入
-
- var inputLog string
- bytesData, err := json.Marshal(inputMessage)
- inputLog = string(bytesData)
- fmt.Println(string(bytesData))
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- reader := bytes.NewReader(bytesData)
- gdyb_url := beego.AppConfig.String("gdyb_url")
- gdyb_paasid := beego.AppConfig.String("gdyb_paasid")
-
- var url string
- if fixmedins_code == "H15049901371" || mdtrtarea_admvs == "450127" || mdtrtarea_admvs == "450721" {
- url = gdyb_url
- } else {
- url = gdyb_url + "1101"
- }
-
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/1101"
- request, err := http.NewRequest("POST", url, reader)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
-
- request.Header.Set("Content-Type", "application/json;charset=UTF-8")
- request.Header.Set("x-tif-paasid", gdyb_paasid)
- request.Header.Set("x-tif-signature", signature)
- request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
- request.Header.Set("x-tif-nonce", nonce)
-
- client := http.Client{}
- resp, err := client.Do(request)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- respBytes, err := ioutil.ReadAll(resp.Body)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- fmt.Println(string(respBytes))
- str := string(respBytes)
- return str, inputLog
-
- }
-
- func Gdyb1101A(certNo string, org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, name string) string {
- //生成签名
- nonce := GetRandomString(32)
- timestamp := time.Now().Unix()
- signature := setSignature(timestamp, nonce, secret_key)
- //生成输入报文
- inputMessage := SetInputMessagenosign(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
- input := make(map[string]interface{})
- inputData := make(map[string]interface{})
- inputMessage["infno"] = "1101" // 交易编码
- 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"] = name // 人员姓名
- input["data"] = inputData
- inputMessage["input"] = input //交易输入
-
- bytesData, err := json.Marshal(inputMessage)
- fmt.Println(string(bytesData))
- if err != nil {
- fmt.Println(err.Error())
- return err.Error()
- }
- reader := bytes.NewReader(bytesData)
- gdyb_url := beego.AppConfig.String("gdyb_url")
- gdyb_paasid := beego.AppConfig.String("gdyb_paasid")
- var url string
- if fixmedins_code == "H15049901371" || mdtrtarea_admvs == "450127" || mdtrtarea_admvs == "450721" {
- url = gdyb_url
- } else {
- url = gdyb_url + "1101"
- }
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/1101"
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/1101"
-
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/1101"
-
- if insuplc_admdvs == "421300" {
- var json2 string
- cmd := exec.Command("java", "-jar", "yh_hb_fat.jar", "1101A", string(bytesData), json2)
- out, err := cmd.Output()
- if err != nil {
- fmt.Println("error:", err.Error())
- }
- fmt.Println(string(out))
- return hex.EncodeToString(out)
- } else {
- request, err := http.NewRequest("POST", url, reader)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error()
- }
-
- request.Header.Set("Content-Type", "application/json;charset=UTF-8")
- request.Header.Set("x-tif-paasid", gdyb_paasid)
- request.Header.Set("x-tif-signature", signature)
- request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
- request.Header.Set("x-tif-nonce", nonce)
-
- client := http.Client{}
- resp, err := client.Do(request)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error()
- }
- respBytes, err := ioutil.ReadAll(resp.Body)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error()
- }
- fmt.Println(string(respBytes))
- str := string(respBytes)
- return str
- }
- }
-
- // 门诊挂号
- func Gdyb2201(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) (string, string) {
- fmt.Println(opera)
-
- // 生成签名
- nonce := GetRandomString(32)
- timestamp := time.Now().Unix()
- signature := setSignature(timestamp, nonce, secret_key)
- tempTime := time.Unix(timestamp, 0)
- timeFormatOne := tempTime.Format("2006-01-02 15:04:05")
-
- // 生成输入报文
- inputMessage := SetInputMessagenosign(nonce, timestamp, org_name, opera, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
- input := make(map[string]interface{})
- inputData := make(map[string]interface{})
- inputMessage["infno"] = "2201" // 交易编码
- inputData["psn_no"] = psnNo // 人员编号 (来自1101接口返回)
- inputData["insutype"] = insutype // 险种类型(来自1101接口返回)
- inputData["begntime"] = timeFormatOne // 开始时间
-
- if id_card_type == 1 {
- inputData["mdtrt_cert_type"] = "03" // 就诊凭证类型
- inputData["mdtrt_cert_no"] = certNo // 就诊凭证编号
- } else {
- inputData["mdtrt_cert_type"] = "02" // 就诊凭证类型
- inputData["mdtrt_cert_no"] = certNo // 就诊凭证编号
- }
-
- inputData["ipt_otp_no"] = ipt_otp_no // 住院/门诊号
- inputData["atddr_no"] = doctor_id // 医师编码
- inputData["dr_name"] = doctor_name // 医师姓名
- inputData["dept_code"] = dept_code // 科室编码
- inputData["dept_name"] = dept // 科室名称
- inputData["caty"] = "A03.06" // 科别
-
- input["data"] = inputData
- inputMessage["input"] = input //交易输入
-
- var requestLog string
- bytesData, err := json.Marshal(inputMessage)
- requestLog = string(bytesData)
- fmt.Println(string(bytesData))
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- reader := bytes.NewReader(bytesData)
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/2201"
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/2201"
-
- gdyb_url := beego.AppConfig.String("gdyb_url")
- gdyb_paasid := beego.AppConfig.String("gdyb_paasid")
-
- var url string
- if fixmedins_code == "H15049901371" || mdtrtarea_admvs == "450127" || mdtrtarea_admvs == "450721" {
- url = gdyb_url
- } else {
- url = gdyb_url + "2201"
- }
-
- if insuplc_admdvs == "421300" {
- var json2 string
- cmd := exec.Command("java", "-jar", "yh_hb_fat.jar", "2201", string(bytesData), json2)
- out, err := cmd.Output()
- if err != nil {
- fmt.Println("error:", err.Error())
- }
- fmt.Println(string(out))
-
- return hex.EncodeToString(out), requestLog
- } else {
- request, err := http.NewRequest("POST", url, reader)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
-
- request.Header.Set("Content-Type", "application/json;charset=UTF-8")
- request.Header.Set("x-tif-paasid", gdyb_paasid)
- request.Header.Set("x-tif-signature", signature)
- request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
- request.Header.Set("x-tif-nonce", nonce)
-
- client := http.Client{}
- resp, err := client.Do(request)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- respBytes, err := ioutil.ReadAll(resp.Body)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- str := string(respBytes)
- fmt.Println(str)
- return str, requestLog
-
- }
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/2201"
-
- }
-
- func Gdyb2201A(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, record_time string, token string, admin_user_id int64) (string, string) {
- fmt.Println(opera)
-
- // 生成签名
- nonce := GetRandomString(32)
- timestamp := time.Now().Unix()
- signature := setSignature(timestamp, nonce, secret_key)
- //tempTime := time.Unix(timestamp, 0)
- //timeFormatOne := tempTime.Format("2006-01-02 15:04:05")
- inputMessage := make(map[string]interface{})
-
- //tempTime := time.Unix(timestamp, 0)
- //timeFormatOne := tempTime.Format("2006-01-02 15:04:05")
- // 生成输入报文
- if mdtrtarea_admvs == "450721" || mdtrtarea_admvs == "450127" {
-
- inputMessage = SetInputMessage1111(nonce, timestamp, org_name, admin_user_id, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, opera)
- } else {
- inputMessage = SetInputMessage(nonce, timestamp, org_name, opera, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
- }
- // 生成输入报文
- //inputMessage := SetInputMessagenosign(nonce, timestamp, org_name, opera, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
- input := make(map[string]interface{})
- inputData := make(map[string]interface{})
- inputMessage["infno"] = "2201" // 交易编码
- inputData["psn_no"] = psnNo // 人员编号 (来自1101接口返回)
- inputData["insutype"] = insutype // 险种类型(来自1101接口返回)
- inputData["begntime"] = record_time // 开始时间
-
- 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"] = token // 就诊凭证编号
- } else {
- inputData["mdtrt_cert_type"] = "02" // 就诊凭证类型
- inputData["mdtrt_cert_no"] = certNo // 就诊凭证编号
- }
-
- inputData["ipt_otp_no"] = ipt_otp_no // 住院/门诊号
- inputData["atddr_no"] = doctor_id // 医师编码
- inputData["dr_name"] = doctor_name // 医师姓名
- inputData["dept_code"] = dept_code // 科室编码
- inputData["dept_name"] = dept // 科室名称
- inputData["caty"] = "A03.06" // 科别
-
- input["data"] = inputData
- inputMessage["input"] = input //交易输入
-
- var requestLog string
- bytesData, err := json.Marshal(inputMessage)
- requestLog = string(bytesData)
- fmt.Println(string(bytesData))
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- reader := bytes.NewReader(bytesData)
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/2201"
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/2201"
-
- gdyb_url := beego.AppConfig.String("gdyb_url")
- gdyb_paasid := beego.AppConfig.String("gdyb_paasid")
-
- var url string
- if fixmedins_code == "H15049901371" || mdtrtarea_admvs == "450127" || mdtrtarea_admvs == "450721" {
- url = gdyb_url
- } else {
- url = gdyb_url + "2201"
- }
-
- if insuplc_admdvs == "421300" {
- var json2 string
- cmd := exec.Command("java", "-jar", "yh_hb_fat.jar", "2201", string(bytesData), json2)
- out, err := cmd.Output()
- if err != nil {
- fmt.Println("error:", err.Error())
- }
- fmt.Println(string(out))
-
- return hex.EncodeToString(out), requestLog
- } else {
- fmt.Println(url)
- fmt.Println(gdyb_paasid)
- fmt.Println(secret_key)
-
- request, err := http.NewRequest("POST", url, reader)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
-
- request.Header.Set("Content-Type", "application/json;charset=UTF-8")
- request.Header.Set("x-tif-paasid", gdyb_paasid)
- request.Header.Set("x-tif-signature", signature)
- request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
- request.Header.Set("x-tif-nonce", nonce)
-
- client := http.Client{}
- resp, err := client.Do(request)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- respBytes, err := ioutil.ReadAll(resp.Body)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- str := string(respBytes)
- fmt.Println(str)
- return str, requestLog
-
- }
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/2201"
-
- }
-
- // 门诊挂号撤销
- func Gdyb2202(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, admin_user_id int64) (string, string) {
- // 生成签名
- nonce := GetRandomString(32)
- timestamp := time.Now().Unix()
- signature := setSignature(timestamp, nonce, secret_key)
-
- // 生成输入报文
- //inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
- inputMessage := make(map[string]interface{})
-
- //tempTime := time.Unix(timestamp, 0)
- //timeFormatOne := tempTime.Format("2006-01-02 15:04:05")
- // 生成输入报文
- if mdtrtarea_admvs == "450721" || mdtrtarea_admvs == "450127" {
-
- inputMessage = SetInputMessage1111(nonce, timestamp, org_name, admin_user_id, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, doctor)
- } else {
- inputMessage = SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
- }
- input := make(map[string]interface{})
- inputData := make(map[string]interface{})
- inputMessage["infno"] = "2202" // 交易编码
- inputData["psn_no"] = psnNo // 人员编号 (来自1101接口返回)
- inputData["mdtrt_id"] = mdtrtId // 就诊 ID(来自2201接口返回)
- inputData["ipt_otp_no"] = ipt_otp_no // 住院/门诊号
-
- input["data"] = inputData
- inputMessage["input"] = input //交易输入
-
- var requestLog string
-
- bytesData, err := json.Marshal(inputMessage)
- fmt.Println(string(bytesData))
- requestLog = string(bytesData)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- reader := bytes.NewReader(bytesData)
-
- gdyb_url := beego.AppConfig.String("gdyb_url")
- gdyb_paasid := beego.AppConfig.String("gdyb_paasid")
-
- var url string
- if fixmedins_code == "H15049901371" || mdtrtarea_admvs == "450127" || mdtrtarea_admvs == "450721" {
- url = gdyb_url
- } else {
- url = gdyb_url + "2202"
- }
-
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/2202"
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/2202"
-
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/2202"
- if insuplc_admdvs == "421300" {
- var json2 string
- cmd := exec.Command("java", "-jar", "yh_hb_fat.jar", "2202", string(bytesData), json2)
- out, err := cmd.Output()
- if err != nil {
- fmt.Println("error:", err.Error())
- }
- fmt.Println(string(out))
-
- return hex.EncodeToString(out), requestLog
- } else {
-
- request, err := http.NewRequest("POST", url, reader)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
-
- request.Header.Set("Content-Type", "application/json;charset=UTF-8")
- request.Header.Set("x-tif-paasid", gdyb_paasid)
- request.Header.Set("x-tif-signature", signature)
- request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
- request.Header.Set("x-tif-nonce", nonce)
-
- client := http.Client{}
- resp, err := client.Do(request)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- respBytes, err := ioutil.ReadAll(resp.Body)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- str := string(respBytes)
- fmt.Println(str)
- return str, requestLog
-
- }
-
- }
-
- // 门诊就诊信息上传
- func Gdyb2203(psnNo string, mdtrtId string, doctor string, department string, org_name string, med_type string, doctor_id string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, sick_code string, sick_name string, dept string, config []*models.HisXtDiagnoseConfig, begin_time string, doctor_name string, op_id int64, op_name string) (string, string) {
-
- // 生成签名
- nonce := GetRandomString(32)
- timestamp := time.Now().Unix()
- signature := setSignature(timestamp, nonce, secret_key)
- inputMessage := make(map[string]interface{})
-
- //tempTime := time.Unix(timestamp, 0)
- //timeFormatOne := tempTime.Format("2006-01-02 15:04:05")
- // 生成输入报文
- if mdtrtarea_admvs == "450721" || mdtrtarea_admvs == "450127" {
-
- inputMessage = SetInputMessage1111(nonce, timestamp, org_name, op_id, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, op_name)
- } else {
- inputMessage = SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
- }
- //inputMessage := SetInputMessage1111(nonce, timestamp, org_name, op_id, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs,op_name)
- 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"
-
- }
- if fixmedins_code == "H15049901371" || mdtrtarea_admvs == "450127" || mdtrtarea_admvs == "450721" {
-
- inputMessage["infno"] = "2203" // 交易编码
-
- } else {
- inputMessage["infno"] = "2203" // 交易编码
-
- }
-
- inputData["mdtrt_id"] = mdtrtId // 就诊 ID(来自2201接口返回)
- inputData["psn_no"] = psnNo // 人员编号 (来自1101接口返回)
- inputData["med_type"] = med_type // 医疗类别 16门诊特殊病
- inputData["begntime"] = begin_time // 开始时间
- //inputData["begntime"] = // 开始时间
- inputData["main_cond_dscr"] = "" // 主要病情描述
- inputData["dise_codg"] = sick_code // 病种编码
- inputData["dise_name"] = sick_name // 病种名称
- if med_type == "12" {
- inputData["dise_codg"] = "" // 病种编码
- inputData["dise_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 + 1 // 诊断排序号
- diseinfo_sun["diag_code"] = item.CountryCode // 诊断代码
- diseinfo_sun["diag_name"] = item.ClassName // 诊断名称
- diseinfo_sun["diag_dept"] = department // 诊断科室
- diseinfo_sun["dise_dor_no"] = doctor_id // 诊断医生编码
- diseinfo_sun["dise_dor_name"] = doctor_name // 诊断医生姓名
- diseinfo_sun["diag_time"] = begin_time // 诊断时间
- diseinfo_sun["vali_flag"] = "1" // 有效标志
- diseinfo = append(diseinfo, diseinfo_sun)
- }
-
- input["diseinfo"] = diseinfo
- input["mdtrtinfo"] = inputData
- inputMessage["input"] = input //交易输入
- var requestLog string
- bytesData, err := json.Marshal(inputMessage)
- fmt.Println(string(bytesData))
- requestLog = string(bytesData)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- reader := bytes.NewReader(bytesData)
-
- gdyb_url := beego.AppConfig.String("gdyb_url")
- gdyb_paasid := beego.AppConfig.String("gdyb_paasid")
-
- var url string
- if fixmedins_code == "H15049901371" || mdtrtarea_admvs == "450127" || mdtrtarea_admvs == "450721" {
- url = gdyb_url
- } else {
- url = gdyb_url + "2203"
- }
-
- if insuplc_admdvs == "421300" {
- var json2 string
- cmd := exec.Command("java", "-jar", "yh_hb_fat.jar", "2203", string(bytesData), json2)
- out, err := cmd.Output()
- if err != nil {
- fmt.Println("error:", err.Error())
- }
- fmt.Println(string(out))
-
- return hex.EncodeToString(out), requestLog
- } else {
- request, err := http.NewRequest("POST", url, reader)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
-
- request.Header.Set("Content-Type", "application/json;charset=UTF-8")
- request.Header.Set("x-tif-paasid", gdyb_paasid)
- request.Header.Set("x-tif-signature", signature)
- request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
- request.Header.Set("x-tif-nonce", nonce)
-
- client := http.Client{}
- resp, err := client.Do(request)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- respBytes, err := ioutil.ReadAll(resp.Body)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- str := string(respBytes)
- fmt.Println(str)
- return str, requestLog
-
- }
-
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/2203"
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/2203"
-
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/2203"
-
- }
-
- func Gdyb2203c(psnNo string, mdtrtId string, doctor string, department string, org_name string, med_type string, doctor_id string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, sick_code string, sick_name string, dept string, config []*models.HisXtDiagnoseConfig, begin_time string, doctor_name string) (string, string) {
-
- // 生成签名
- nonce := GetRandomString(32)
- timestamp := time.Now().Unix()
- signature := setSignature(timestamp, nonce, secret_key)
- //tempTime := time.Unix(timestamp, 0)
- //timeFormatOne := tempTime.Format("2006-01-02 15:04:05")
- // 生成输入报文
- inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
- input := make(map[string]interface{})
- inputData := make(map[string]interface{})
- diseinfo := make([]map[string]interface{}, 0)
-
- 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["begntime"] = // 开始时间
- inputData["main_cond_dscr"] = "" // 主要病情描述
- inputData["dise_codg"] = sick_code // 病种编码
- inputData["dise_name"] = sick_name // 病种名称
- if med_type == "12" {
- inputData["dise_codg"] = "" // 病种编码
- inputData["dise_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_id // 诊断医生编码
- diseinfo_sun["dise_dor_name"] = doctor_name // 诊断医生姓名
- diseinfo_sun["diag_time"] = begin_time // 诊断时间
- diseinfo_sun["vali_flag"] = "1" // 有效标志
- diseinfo = append(diseinfo, diseinfo_sun)
- }
-
- input["diseinfo"] = diseinfo
- input["mdtrtinfo"] = inputData
- inputMessage["input"] = input //交易输入
- var requestLog string
- bytesData, err := json.Marshal(inputMessage)
- fmt.Println(string(bytesData))
- requestLog = string(bytesData)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- reader := bytes.NewReader(bytesData)
-
- gdyb_url := beego.AppConfig.String("gdyb_url")
- gdyb_paasid := beego.AppConfig.String("gdyb_paasid")
-
- var url string
- if fixmedins_code == "H15049901371" || mdtrtarea_admvs == "450127" || mdtrtarea_admvs == "450721" {
- url = gdyb_url
- } else {
- url = gdyb_url + "2203"
- }
-
- if insuplc_admdvs == "421300" {
- var json2 string
- cmd := exec.Command("java", "-jar", "yh_hb_fat.jar", "2203", string(bytesData), json2)
- out, err := cmd.Output()
- if err != nil {
- fmt.Println("error:", err.Error())
- }
- fmt.Println(string(out))
-
- return hex.EncodeToString(out), requestLog
- } else {
- request, err := http.NewRequest("POST", url, reader)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
-
- request.Header.Set("Content-Type", "application/json;charset=UTF-8")
- request.Header.Set("x-tif-paasid", gdyb_paasid)
- request.Header.Set("x-tif-signature", signature)
- request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
- request.Header.Set("x-tif-nonce", nonce)
-
- client := http.Client{}
- resp, err := client.Do(request)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- respBytes, err := ioutil.ReadAll(resp.Body)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- str := string(respBytes)
- fmt.Println(str)
- return str, requestLog
-
- }
-
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/2203"
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/2203"
-
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/2203"
-
- }
-
- // 门诊就诊信息上传
- func Gdyb2203A(psnNo string, mdtrtId string, doctor string, department string, org_name string, med_type string, doctor_id string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, sick_code string, sick_name string, dept string, config []*models.HisXtDiagnoseConfig, begin_time string) (string, string) {
-
- // 生成签名
- nonce := GetRandomString(32)
- timestamp := time.Now().Unix()
- signature := setSignature(timestamp, nonce, secret_key)
- tempTime := time.Unix(timestamp, 0)
- timeFormatOne := tempTime.Format("2006-01-02 15:04:05")
-
- // 生成输入报文
- inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
- input := make(map[string]interface{})
- inputData := make(map[string]interface{})
- diseinfo := make([]map[string]interface{}, 0)
-
- 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"] = begin_time // 开始时间
-
- 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 //交易输入
- var requestLog string
- bytesData, err := json.Marshal(inputMessage)
- fmt.Println(string(bytesData))
- requestLog = string(bytesData)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- reader := bytes.NewReader(bytesData)
-
- gdyb_url := beego.AppConfig.String("gdyb_url")
- gdyb_paasid := beego.AppConfig.String("gdyb_paasid")
-
- var url string
- if fixmedins_code == "H15049901371" || mdtrtarea_admvs == "450127" || mdtrtarea_admvs == "450721" {
- url = gdyb_url
- } else {
- url = gdyb_url + "2203"
- }
-
- if insuplc_admdvs == "421300" {
- var json2 string
- cmd := exec.Command("java", "-jar", "yh_hb_fat.jar", "2203A", string(bytesData), json2)
- out, err := cmd.Output()
- if err != nil {
- fmt.Println("error:", err.Error())
- }
- fmt.Println(string(out))
-
- return hex.EncodeToString(out), requestLog
- } else {
-
- request, err := http.NewRequest("POST", url, reader)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
-
- request.Header.Set("Content-Type", "application/json;charset=UTF-8")
- request.Header.Set("x-tif-paasid", gdyb_paasid)
- request.Header.Set("x-tif-signature", signature)
- request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
- request.Header.Set("x-tif-nonce", nonce)
-
- client := http.Client{}
- resp, err := client.Do(request)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- respBytes, err := ioutil.ReadAll(resp.Body)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- str := string(respBytes)
- fmt.Println(str)
- return str, requestLog
-
- }
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/2203A"
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/2203"
-
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/2203"
-
- }
- func Gdyb2203d(psnNo string, mdtrtId string, doctor string, department string, org_name string, med_type string, doctor_id string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, sick_code string, sick_name string, dept string, config []*models.HisXtDiagnoseConfig, begin_time string) (string, string) {
-
- // 生成签名
- nonce := GetRandomString(32)
- timestamp := time.Now().Unix()
- signature := setSignature(timestamp, nonce, secret_key)
- tempTime := time.Unix(timestamp, 0)
- timeFormatOne := tempTime.Format("2006-01-02 15:04:05")
-
- // 生成输入报文
- inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
- input := make(map[string]interface{})
- inputData := make(map[string]interface{})
- diseinfo := make([]map[string]interface{}, 0)
-
- inputMessage["infno"] = "2203" // 交易编码
- inputData["mdtrt_id"] = mdtrtId // 就诊 ID(来自2201接口返回)
- inputData["psn_no"] = psnNo // 人员编号 (来自1101接口返回)
- inputData["med_type"] = "14" // 医疗类别 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"] = "" // 计划生育手术或生育日期
-
- 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 //交易输入
- var requestLog string
- bytesData, err := json.Marshal(inputMessage)
- fmt.Println(string(bytesData))
- requestLog = string(bytesData)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- reader := bytes.NewReader(bytesData)
-
- gdyb_url := beego.AppConfig.String("gdyb_url")
- gdyb_paasid := beego.AppConfig.String("gdyb_paasid")
-
- var url string
-
- url = gdyb_url + "2203"
-
- if insuplc_admdvs == "421300" {
- var json2 string
- cmd := exec.Command("java", "-jar", "yh_hb_fat.jar", "2203A", string(bytesData), json2)
- out, err := cmd.Output()
- if err != nil {
- fmt.Println("error:", err.Error())
- }
- fmt.Println(string(out))
-
- return hex.EncodeToString(out), requestLog
- } else {
-
- request, err := http.NewRequest("POST", url, reader)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
-
- request.Header.Set("Content-Type", "application/json;charset=UTF-8")
- request.Header.Set("x-tif-paasid", gdyb_paasid)
- request.Header.Set("x-tif-signature", signature)
- request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
- request.Header.Set("x-tif-nonce", nonce)
-
- client := http.Client{}
- resp, err := client.Do(request)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- respBytes, err := ioutil.ReadAll(resp.Body)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- str := string(respBytes)
- fmt.Println(str)
- return str, requestLog
-
- }
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/2203A"
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/2203"
-
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/2203"
-
- }
-
- type Custom struct {
- DetItemFeeSumamt string
- Cut string
- FeedetlSn string
- Price string
- MedListCodg string
- LmtUsedFlag int64
- HospApprFlag int64
- DoctorNumber string
- DoctorName string
- ProvinceDrugMedListCodg string
- ProvinceGoodMedListCodg string
- IsUser int64
- FeeOcurTime string
- Unit string
- }
-
- type RequestResult struct {
- Output Output `json:"output" form:"output"`
- Infcode int64 `gorm:"column:infcode" json:"infcode" form:"infcode"`
- WarnMsg string `gorm:"column:warn_msg" json:"warn_msg" form:"warn_msg"`
- Cainfo string `gorm:"column:cainfo" json:"cainfo" form:"cainfo"`
- ErrMsg string `gorm:"column:err_msg" json:"err_msg" form:"err_msg"`
- RespondTime string `gorm:"column:respond_time" json:"respond_time" form:"respond_time"`
- InfRefmsgid string `gorm:"column:inf_refmsgid" json:"inf_refmsgid" form:"inf_refmsgid"`
- }
- type Output struct {
- Result Result `json:"result" form:"result"`
- }
-
- type Result struct {
- BasMednFlag string `json:"bas_medn_flag" form:"bas_medn_flag"`
- MedChrgitmType string `json:"med_chrgitm_type" form:"med_chrgitm_type"`
- DetItemFeeSumamt int64 `json:"det_item_fee_sumamt" form:"det_item_fee_sumamt"`
- HiNegoDrugFlag string `json:"hi_nego_drug_flag" form:"hi_nego_drug_flag"`
- FulamtOwnpayAmt float64 `json:"fulamt_ownpay_amt" form:"fulamt_ownpay_amt"`
-
- FeedtlSn int64 `json:"feedtl_sn" form:"feedtl_sn"`
- UploadDate int64 `json:"upload_date" form:"upload_date"`
- AdviceId int64 `json:"advice_id" form:"advice_id"`
- Cnt int64 `json:"cnt" form:"cnt"`
- Pric float64 `json:"pric" form:"pric"`
- PatientId int64 `json:"patient_id" form:"patient_id"`
- PricUplmtAmt float64 `json:"pric_uplmt_amt" form:"pric_uplmt_amt"`
- SelfpayProp float64 `json:"selfpay_prop" form:"selfpay_prop"`
- OverlmtAmt float64 `json:"overlmt_amt" form:"overlmt_amt"`
- PreselfpayAmt float64 `json:"preselfpay_amt" form:"preselfpay_amt"`
- Status int64 `json:"status" form:"status"`
- Memo string `json:"memo" form:"memo"`
- FeedetlSn string `json:"feedetl_sn" form:"feedetl_sn"`
- Mtime int64 `json:"mtime" form:"mtime"`
- InscpScpAmt float64 `json:"inscp_scp_amt" form:"inscp_scp_amt"`
- DrtReimFlag string `json:"drt_reim_flag" form:"drt_reim_flag"`
- Ctime int64 `json:"ctime" form:"ctime"`
- ListSpItemFlag string `json:"list_sp_item_flag" form:"list_sp_item_flag"`
- ChldMedcFlag string `json:"chld_medc_flag" form:"chld_medc_flag"`
- LmtUsedFlag string `json:"lmt_used_flag" form:"lmt_used_flag"`
- ChrgitmLv string `json:"chrgitm_lv" form:"chrgitm_lv"`
- UserOrgId int64 `json:"user_org_id" form:"user_org_id"`
- HisPatientId int64 `json:"his_patient_id" form:"his_patient_id"`
- OrderId int64 `json:"order_id" form:"order_id"`
- }
-
- // 门诊费用明细信息上传
- func Gdyb2204(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, new_doctor_id int64, diag_code string, admin_user_id int64) (string, string) {
- // 生成签名
- nonce := GetRandomString(32)
- timestamp := time.Now().Unix()
- signature := setSignature(timestamp, nonce, secret_key)
- //tempTime := time.Unix(timestamp, 0)
- //timeFormat := tempTime.Format("20060102150405")
- //timeFormatOne := tempTime.Format("2006-01-02 15:04:05")
- //chrgBchno := rand.Intn(100000) + 10000
- var customs []*Custom
- inputMessage := make(map[string]interface{})
-
- if mdtrtarea_admvs == "450721" || mdtrtarea_admvs == "450127" {
-
- inputMessage = SetInputMessage1111(nonce, timestamp, org_name, admin_user_id, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, doctor)
- } else {
- inputMessage = SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
- }
-
- //inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
-
- for _, item := range hisPrescription {
- role, _ := GetAdminUserInfoByID(item.UserOrgId, new_doctor_id)
- tm := time.Unix(item.PreTime, 0)
- if item.Type == 1 { //药品
- for _, subItem := range item.HisDoctorAdviceInfo {
- if len(subItem.BaseDrugLib.MedicalInsuranceNumber) > 0 && subItem.BaseDrugLib.IsUser != 1 {
- //var randNum int
- //randNum = rand.Intn(10000) + 1000
- role, _ := GetAdminUserInfoByID(item.UserOrgId, new_doctor_id)
- cus := &Custom{
- DetItemFeeSumamt: fmt.Sprintf("%.2f", subItem.Price*subItem.PrescribingNumber),
- Cut: fmt.Sprintf("%.2f", subItem.PrescribingNumber),
- FeedetlSn: subItem.FeedetlSn,
- Price: fmt.Sprintf("%.2f", subItem.Price),
- MedListCodg: subItem.BaseDrugLib.MedicalInsuranceNumber,
- HospApprFlag: subItem.HospApprFlag,
- DoctorNumber: role.DoctorNumber,
- DoctorName: role.UserName,
- FeeOcurTime: tm.Format("2006-01-02 15:04:05"),
- }
-
- customs = append(customs, cus)
- }
- }
- }
-
- if item.Type == 2 { //项目
- for _, subItem := range item.HisPrescriptionProject {
- //var randNum int
- //randNum = rand.Intn(10000) + 1000
- if subItem.Type == 2 {
- if len(subItem.HisProject.MedicalCode) > 0 {
- cnt, _ := strconv.ParseFloat(subItem.Count, 64)
- cus := &Custom{
- DetItemFeeSumamt: fmt.Sprintf("%.4f", subItem.Price*cnt),
- Cut: fmt.Sprintf("%.4f", cnt),
- FeedetlSn: subItem.FeedetlSn,
- Price: fmt.Sprintf("%.4f", float64(subItem.Price)),
- MedListCodg: subItem.HisProject.MedicalCode,
- DoctorNumber: role.DoctorNumber,
- DoctorName: role.UserName,
- HospApprFlag: -1,
- FeeOcurTime: tm.Format("2006-01-02 15:04:05"),
- }
- customs = append(customs, cus)
- }
-
- } else if subItem.Type == 3 {
- if len(subItem.GoodInfo.MedicalInsuranceNumber) > 0 {
- cnt, _ := strconv.ParseFloat(subItem.Count, 64)
-
- cus := &Custom{
- DetItemFeeSumamt: fmt.Sprintf("%.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: role.DoctorNumber,
- DoctorName: role.UserName,
- 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: role.DoctorNumber,
- DoctorName: role.UserName,
- }
- customs = append(customs, cus)
- }
- }
- }
-
- // 生成输入报文
- input := make(map[string]interface{})
- feedetail := make([]map[string]interface{}, 0)
- inputMessage["infno"] = "2204" // 交易编码
-
- //chrg_bchno := timeFormat + strconv.FormatInt(int64(chrgBchno), 10)
-
- for _, item := range customs {
- feedetailInfo := make(map[string]interface{})
- feedetailInfo["feedetl_sn"] = item.FeedetlSn
- feedetailInfo["mdtrt_id"] = mdtrtId // 就诊 ID(来自2201接口返回)
- feedetailInfo["psn_no"] = psnNo // 人员编号 (来自1101接口返回)
- feedetailInfo["chrg_bchno"] = chrg_bchno // 收费批次号
- feedetailInfo["dise_codg"] = 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.MedListCodg // 医药机构目录编码
- feedetailInfo["det_item_fee_sumamt"] = item.DetItemFeeSumamt // 明细项目费用总额
- feedetailInfo["cnt"] = item.Cut // 数量
- feedetailInfo["pric"] = item.Price // 单价
- feedetailInfo["sin_dos_dscr"] = "1" // 单次剂量描述
- 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"] = item.DoctorNumber // 受单医生编码
- feedetailInfo["orders_dr_name"] = item.DoctorName // 受单医生姓名
- 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"] = "0" // 外检标志
- feedetailInfo["etip_hosp_code"] = "" // 外检医院编码
- feedetailInfo["dscg_tkdrug_flag"] = "" // 出院带药标志
- feedetailInfo["matn_fee_flag"] = "" // 生育费用标志
- feedetail = append(feedetail, feedetailInfo)
- }
- input["feedetail"] = feedetail
- inputMessage["input"] = input //交易输入
- var requestLog string
- bytesData, err := json.Marshal(inputMessage)
- fmt.Println("----------")
- fmt.Println(string(bytesData))
- fmt.Println("----------")
- requestLog = string(bytesData)
- if err != nil {
- fmt.Println(err.Error())
- return "", ""
- }
- reader := bytes.NewReader(bytesData)
-
- gdyb_url := beego.AppConfig.String("gdyb_url")
- gdyb_paasid := beego.AppConfig.String("gdyb_paasid")
-
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/1101"
-
- var url string
- if fixmedins_code == "H15049901371" || mdtrtarea_admvs == "450127" || mdtrtarea_admvs == "450721" {
- url = gdyb_url
- } else {
- url = gdyb_url + "2204"
- }
-
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/2204"
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/2204"
-
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/2204"
-
- if insuplc_admdvs == "421300" {
- var json2 string
- cmd := exec.Command("java", "-jar", "yh_hb_fat.jar", "2204", string(bytesData), json2)
- out, err := cmd.Output()
- if err != nil {
- fmt.Println("error:", err.Error())
- }
- fmt.Println(string(out))
-
- return hex.EncodeToString(out), requestLog
- } else {
-
- request, err := http.NewRequest("POST", url, reader)
- if err != nil {
- fmt.Println(err.Error())
- return "", ""
- }
-
- request.Header.Set("Content-Type", "application/json;charset=UTF-8")
- request.Header.Set("x-tif-paasid", gdyb_paasid)
- request.Header.Set("x-tif-signature", signature)
- request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
- request.Header.Set("x-tif-nonce", nonce)
-
- client := http.Client{}
- resp, err := client.Do(request)
- if err != nil {
- fmt.Println(err.Error())
- return "", ""
- }
- respBytes, err := ioutil.ReadAll(resp.Body)
- if err != nil {
- fmt.Println(err.Error())
- return "", ""
- }
- return string(respBytes), requestLog
-
- }
-
- //var result RequestResult
- //json.Unmarshal(respBytes, &result)
- //return &result
- }
-
- func Gdyb2204For441799(psnNo string, mdtrtId string, hisPrescription []*models.HisPrescription, chrg_bchno string, org_name string, doctor string, dept string, fixmedins_code string, dept_code string, new_doctor_name string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, balance_accounts_type string, new_doctor_id string, diag_code string) (string, string) {
- // 生成签名
- nonce := GetRandomString(32)
- timestamp := time.Now().Unix()
- signature := setSignature(timestamp, nonce, secret_key)
- //tempTime := time.Unix(timestamp, 0)
- //timeFormat := tempTime.Format("20060102150405")
- //timeFormatOne := tempTime.Format("2006-01-02 15:04:05")
- //chrgBchno := rand.Intn(100000) + 10000
- var customs []*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 && subItem.BaseDrugLib.IsUser != 1 {
- //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: new_doctor_id,
- DoctorName: new_doctor_name,
- FeeOcurTime: tm.Format("2006-01-02 15:04:05"),
- }
-
- customs = append(customs, cus)
- }
- }
- }
-
- if item.Type == 2 { //项目
- for _, subItem := range item.HisPrescriptionProject {
- //var randNum int
- //randNum = rand.Intn(10000) + 1000
- if subItem.Type == 2 {
- if len(subItem.HisProject.MedicalCode) > 0 {
- cnt, _ := strconv.ParseFloat(subItem.Count, 64)
- cus := &Custom{
- DetItemFeeSumamt: fmt.Sprintf("%.4f", subItem.Price*cnt),
- Cut: fmt.Sprintf("%.4f", cnt),
- FeedetlSn: subItem.FeedetlSn,
- Price: fmt.Sprintf("%.4f", float64(subItem.Price)),
- MedListCodg: subItem.HisProject.MedicalCode,
- DoctorNumber: new_doctor_id,
- DoctorName: new_doctor_name,
- HospApprFlag: -1,
- FeeOcurTime: tm.Format("2006-01-02 15:04:05"),
- }
- customs = append(customs, cus)
- }
-
- } else if subItem.Type == 3 {
- if len(subItem.GoodInfo.MedicalInsuranceNumber) > 0 {
- cnt, _ := strconv.ParseFloat(subItem.Count, 64)
-
- cus := &Custom{
- DetItemFeeSumamt: fmt.Sprintf("%.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: new_doctor_id,
- DoctorName: new_doctor_name,
- 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: new_doctor_id,
- DoctorName: new_doctor_name,
- }
- customs = append(customs, cus)
- }
- }
- }
-
- // 生成输入报文
- inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
- input := make(map[string]interface{})
- feedetail := make([]map[string]interface{}, 0)
- inputMessage["infno"] = "2204" // 交易编码
-
- //chrg_bchno := timeFormat + strconv.FormatInt(int64(chrgBchno), 10)
-
- for _, item := range customs {
- feedetailInfo := make(map[string]interface{})
- feedetailInfo["feedetl_sn"] = item.FeedetlSn
- feedetailInfo["mdtrt_id"] = mdtrtId // 就诊 ID(来自2201接口返回)
- feedetailInfo["psn_no"] = psnNo // 人员编号 (来自1101接口返回)
- feedetailInfo["chrg_bchno"] = chrg_bchno // 收费批次号
- feedetailInfo["dise_codg"] = 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"] = fixmedins_code // 医药机构目录编码
- feedetailInfo["det_item_fee_sumamt"] = item.DetItemFeeSumamt // 明细项目费用总额
- feedetailInfo["cnt"] = item.Cut // 数量
- feedetailInfo["pric"] = item.Price // 单价
- feedetailInfo["sin_dos_dscr"] = "" // 单次剂量描述
- feedetailInfo["used_frqu_dscr"] = "" // 使用频次描述
- feedetailInfo["prd_days"] = "0" // 周期天数
- feedetailInfo["medc_way_dscr"] = "" // 用药途径描述
- feedetailInfo["bilg_dept_codg"] = dept_code // 开单科室编码
- feedetailInfo["bilg_dept_name"] = dept // 开单科室名称
- feedetailInfo["bilg_dr_codg"] = item.DoctorNumber // 开单医生编码
- feedetailInfo["bilg_dr_name"] = item.DoctorName // 开单医师姓名
- feedetailInfo["acord_dept_codg"] = "" // 受单科室编码
- feedetailInfo["acord_dept_name"] = "" // 受单科室名称
- feedetailInfo["orders_dr_code"] = item.DoctorNumber // 受单医生编码
- feedetailInfo["orders_dr_name"] = item.DoctorName // 受单医生姓名
- 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"] = "" // 生育费用标志
- feedetail = append(feedetail, feedetailInfo)
- }
- input["feedetail"] = feedetail
- inputMessage["input"] = input //交易输入
- var requestLog string
- bytesData, err := json.Marshal(inputMessage)
- fmt.Println("----------")
- fmt.Println(string(bytesData))
- fmt.Println("----------")
- requestLog = string(bytesData)
- if err != nil {
- fmt.Println(err.Error())
- return "", ""
- }
- reader := bytes.NewReader(bytesData)
-
- gdyb_url := beego.AppConfig.String("gdyb_url")
- gdyb_paasid := beego.AppConfig.String("gdyb_paasid")
-
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/1101"
-
- var url string
- if fixmedins_code == "H15049901371" || mdtrtarea_admvs == "450127" || mdtrtarea_admvs == "450721" {
- url = gdyb_url
- } else {
- url = gdyb_url + "2204"
- }
-
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/2204"
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/2204"
-
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/2204"
-
- if insuplc_admdvs == "421300" {
- var json2 string
- cmd := exec.Command("java", "-jar", "yh_hb_fat.jar", "2204", string(bytesData), json2)
- out, err := cmd.Output()
- if err != nil {
- fmt.Println("error:", err.Error())
- }
- fmt.Println(string(out))
-
- return hex.EncodeToString(out), requestLog
- } else {
-
- request, err := http.NewRequest("POST", url, reader)
- if err != nil {
- fmt.Println(err.Error())
- return "", ""
- }
-
- request.Header.Set("Content-Type", "application/json;charset=UTF-8")
- request.Header.Set("x-tif-paasid", gdyb_paasid)
- request.Header.Set("x-tif-signature", signature)
- request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
- request.Header.Set("x-tif-nonce", nonce)
-
- client := http.Client{}
- resp, err := client.Do(request)
- if err != nil {
- fmt.Println(err.Error())
- return "", ""
- }
- respBytes, err := ioutil.ReadAll(resp.Body)
- if err != nil {
- fmt.Println(err.Error())
- return "", ""
- }
- return string(respBytes), requestLog
-
- }
-
- //var result RequestResult
- //json.Unmarshal(respBytes, &result)
- //return &result
- }
-
- // 门诊费用明细信息撤销
- func Gdyb2205(psnNo string, mdtrtId string, chrgBchno string, org_name string, doctor string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, fixmedins_code string, admin_user_id int64) (string, string) {
- // 生成签名
- nonce := GetRandomString(32)
- timestamp := time.Now().Unix()
- signature := setSignature(timestamp, nonce, secret_key)
- inputMessage := make(map[string]interface{})
-
- if mdtrtarea_admvs == "450721" || mdtrtarea_admvs == "450127" {
-
- inputMessage = SetInputMessage1111(nonce, timestamp, org_name, admin_user_id, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, doctor)
- } else {
- inputMessage = SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
- }
-
- // 生成输入报文
- //inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
- input := make(map[string]interface{})
- inputData := make(map[string]interface{})
- inputMessage["infno"] = "2205" // 交易编码
-
- inputData["mdtrt_id"] = mdtrtId // 就诊 ID(来自2201接口返回)
- inputData["chrg_bchno"] = chrgBchno // 收费批次号(来自2204生成的)
- inputData["psn_no"] = psnNo // 人员编号 (来自1101接口返回)
-
- input["data"] = inputData
- inputMessage["input"] = input //交易输入
-
- bytesData, err := json.Marshal(inputMessage)
- fmt.Println(string(bytesData))
-
- var requestLog string
- requestLog = string(bytesData)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- reader := bytes.NewReader(bytesData)
- gdyb_url := beego.AppConfig.String("gdyb_url")
- gdyb_paasid := beego.AppConfig.String("gdyb_paasid")
-
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/1101"
- //url := gdyb_url + "2205"
- var url string
- if fixmedins_code == "H15049901371" || mdtrtarea_admvs == "450127" || mdtrtarea_admvs == "450721" {
- url = gdyb_url
- } else {
- url = gdyb_url + "2205"
- }
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/2205"
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/2205"
-
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/2205"
-
- if insuplc_admdvs == "421300" {
- var json2 string
- cmd := exec.Command("java", "-jar", "yh_hb_fat.jar", "2205", string(bytesData), json2)
- out, err := cmd.Output()
- if err != nil {
- fmt.Println("error:", err.Error())
- }
- fmt.Println(string(out))
-
- return hex.EncodeToString(out), requestLog
- } else {
- request, err := http.NewRequest("POST", url, reader)
- fmt.Println(err)
-
- fmt.Println(request)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
-
- request.Header.Set("Content-Type", "application/json;charset=UTF-8")
- request.Header.Set("x-tif-paasid", gdyb_paasid)
- request.Header.Set("x-tif-signature", signature)
- request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
- request.Header.Set("x-tif-nonce", nonce)
-
- client := http.Client{}
- resp, err := client.Do(request)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- respBytes, err := ioutil.ReadAll(resp.Body)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- str := string(respBytes)
- fmt.Println(str)
- return str, requestLog
-
- }
-
- }
-
- // 门诊预结算
- //
- // func Gdyb2206(psnNo string, mdtrtId string, chrgBchno string, certNo string, insutype string, total string, org_name string, doctor string, secret_key string) string {
- func Gdyb2206(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, admin_user_id int64) (string, string) {
-
- // 生成签名
- nonce := GetRandomString(32)
- timestamp := time.Now().Unix()
- signature := setSignature(timestamp, nonce, secret_key)
-
- inputMessage := make(map[string]interface{})
-
- if mdtrtarea_admvs == "450721" || mdtrtarea_admvs == "450127" {
-
- inputMessage = SetInputMessage1111(nonce, timestamp, org_name, admin_user_id, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, doctor)
- } else {
- inputMessage = SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
- }
- // 生成输入报文
- //inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
-
- input := make(map[string]interface{})
- inputData := make(map[string]interface{})
- inputMessage["infno"] = "2206" // 交易编码
- inputData["psn_no"] = psnNo // 人员编号 (来自1101接口返回)
- if certificates == 3 {
- inputData["mdtrt_cert_type"] = "99" // 就诊凭证类型
- inputData["mdtrt_cert_no"] = certNo // 就诊凭证编号
- } else {
- if id_card_type == 1 {
- inputData["mdtrt_cert_type"] = "03" // 就诊凭证类型
- inputData["mdtrt_cert_no"] = certNo // 就诊凭证编号
- } else 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 // 就诊凭证编号
- }
- }
- 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"] = "" // 发票号
-
- input["data"] = inputData
- inputMessage["input"] = input //交易输入
-
- var requestLog string
-
- bytesData, err := json.Marshal(inputMessage)
-
- requestLog = string(bytesData)
- fmt.Println(string(bytesData))
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- reader := bytes.NewReader(bytesData)
-
- gdyb_url := beego.AppConfig.String("gdyb_url")
- gdyb_paasid := beego.AppConfig.String("gdyb_paasid")
-
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/1101"
- //url := gdyb_url + "2206"
-
- var url string
- if fixmedins_code == "H15049901371" || mdtrtarea_admvs == "450127" || mdtrtarea_admvs == "450721" {
- url = gdyb_url
- } else {
- url = gdyb_url + "2206"
- }
-
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/2206"
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/2206"
-
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/2206"
-
- if insuplc_admdvs == "421300" {
- var json2 string
- cmd := exec.Command("java", "-jar", "yh_hb_fat.jar", "2206", string(bytesData), json2)
- out, err := cmd.Output()
- if err != nil {
- fmt.Println("error:", err.Error())
- }
- fmt.Println(string(out))
-
- return hex.EncodeToString(out), requestLog
- } else {
- request, err := http.NewRequest("POST", url, reader)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
-
- request.Header.Set("Content-Type", "application/json;charset=UTF-8")
- request.Header.Set("x-tif-paasid", gdyb_paasid)
- request.Header.Set("x-tif-signature", signature)
- request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
- request.Header.Set("x-tif-nonce", nonce)
-
- client := http.Client{}
- resp, err := client.Do(request)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- respBytes, err := ioutil.ReadAll(resp.Body)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- str := string(respBytes)
- fmt.Println(str)
- return str, requestLog
-
- }
-
- }
-
- // 门诊结算
- func Gdyb2207(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, token string, admin_user_id int64) (string, string) {
- // 生成签名
- nonce := GetRandomString(32)
- timestamp := time.Now().Unix()
- signature := setSignature(timestamp, nonce, secret_key)
-
- // 生成输入报文
- inputMessage := make(map[string]interface{})
-
- if mdtrtarea_admvs == "450721" || mdtrtarea_admvs == "450127" {
-
- inputMessage = SetInputMessage1111(nonce, timestamp, org_name, admin_user_id, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, doctor)
- } else {
- inputMessage = SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
- }
- //inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
- input := make(map[string]interface{})
- inputData := make(map[string]interface{})
- inputMessage["infno"] = "2207" // 交易编码
- inputData["psn_no"] = psnNo // 人员编号 (来自1101接口返回)
- if certificates == 3 {
- inputData["mdtrt_cert_type"] = "99" // 就诊凭证类型
- inputData["mdtrt_cert_no"] = certNo // 就诊凭证编号
- } else {
- if id_card_type == 1 {
- inputData["mdtrt_cert_type"] = "03" // 就诊凭证类型
- inputData["mdtrt_cert_no"] = certNo // 就诊凭证编号
- } else if id_card_type == 4 {
- inputData["mdtrt_cert_type"] = "01" // 就诊凭证类型
- inputData["mdtrt_cert_no"] = token // 就诊凭证编号
- } 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 //交易输入
-
- bytesData, err := json.Marshal(inputMessage)
- fmt.Println(string(bytesData))
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- reader := bytes.NewReader(bytesData)
- gdyb_url := beego.AppConfig.String("gdyb_url")
- gdyb_paasid := beego.AppConfig.String("gdyb_paasid")
-
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/1101"
- //url := gdyb_url + "2207"
-
- var url string
- if fixmedins_code == "H15049901371" || mdtrtarea_admvs == "450127" || mdtrtarea_admvs == "450721" {
- url = gdyb_url
- } else {
- url = gdyb_url + "2207"
- }
-
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/2207"
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/2207"
-
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/2207"
-
- if insuplc_admdvs == "421300" {
- var json2 string
- cmd := exec.Command("java", "-jar", "yh_hb_fat.jar", "2207", string(bytesData), json2)
- out, err := cmd.Output()
- if err != nil {
- fmt.Println("error:", err.Error())
- }
- mjson, _ := json.Marshal(inputMessage)
- str2 := string(mjson)
- fmt.Println(string(out))
-
- return hex.EncodeToString(out), str2
- } else {
-
- request, err := http.NewRequest("POST", url, reader)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
-
- request.Header.Set("Content-Type", "application/json;charset=UTF-8")
- request.Header.Set("x-tif-paasid", gdyb_paasid)
- request.Header.Set("x-tif-signature", signature)
- request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
- request.Header.Set("x-tif-nonce", nonce)
-
- client := http.Client{}
- resp, err := client.Do(request)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- respBytes, err := ioutil.ReadAll(resp.Body)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- str := string(respBytes)
- fmt.Println(str)
- mjson, _ := json.Marshal(inputMessage)
- str2 := string(mjson)
-
- return str, str2
-
- }
-
- }
-
- func Gdyb2207A(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) (string, string) {
- // 生成签名
- nonce := GetRandomString(32)
- timestamp := time.Now().Unix()
- signature := setSignature(timestamp, nonce, secret_key)
-
- // 生成输入报文
- inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
- input := make(map[string]interface{})
- inputData := make(map[string]interface{})
- inputMessage["infno"] = "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 //交易输入
-
- bytesData, err := json.Marshal(inputMessage)
- fmt.Println(string(bytesData))
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- reader := bytes.NewReader(bytesData)
- gdyb_url := beego.AppConfig.String("gdyb_url")
- gdyb_paasid := beego.AppConfig.String("gdyb_paasid")
-
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/1101"
- //url := gdyb_url + "2207"
-
- var url string
- if fixmedins_code == "H15049901371" || mdtrtarea_admvs == "450127" || mdtrtarea_admvs == "450721" {
- url = gdyb_url
- } else {
- url = gdyb_url + "2207"
- }
-
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/2207"
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/2207"
-
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/2207"
-
- if insuplc_admdvs == "421300" {
- var json2 string
- cmd := exec.Command("java", "-jar", "yh_hb_fat.jar", "2207", string(bytesData), json2)
- out, err := cmd.Output()
- if err != nil {
- fmt.Println("error:", err.Error())
- }
- mjson, _ := json.Marshal(inputMessage)
- str2 := string(mjson)
- fmt.Println(string(out))
-
- return hex.EncodeToString(out), str2
- } else {
-
- request, err := http.NewRequest("POST", url, reader)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
-
- request.Header.Set("Content-Type", "application/json;charset=UTF-8")
- request.Header.Set("x-tif-paasid", gdyb_paasid)
- request.Header.Set("x-tif-signature", signature)
- request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
- request.Header.Set("x-tif-nonce", nonce)
-
- client := http.Client{}
- resp, err := client.Do(request)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- respBytes, err := ioutil.ReadAll(resp.Body)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- str := string(respBytes)
- fmt.Println(str)
- mjson, _ := json.Marshal(inputMessage)
- str2 := string(mjson)
-
- return str, str2
-
- }
-
- }
-
- // 门诊结算撤销
- func Gdyb2208(psnNo string, mdtrtId string, setlId string, org_name string, doctor string, secret_key string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, admin_user_id int64) (string, string) {
- // 生成签名
- nonce := GetRandomString(32)
- timestamp := time.Now().Unix()
- signature := setSignature(timestamp, nonce, secret_key)
-
- inputMessage := make(map[string]interface{})
-
- if mdtrtarea_admvs == "450721" || mdtrtarea_admvs == "450127" {
-
- inputMessage = SetInputMessage1111(nonce, timestamp, org_name, admin_user_id, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, doctor)
- } else {
- inputMessage = SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
- }
- // 生成输入报文
- //inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
- input := make(map[string]interface{})
- inputData := make(map[string]interface{})
- inputMessage["infno"] = "2208" // 交易编码
-
- inputData["psn_no"] = psnNo // 人员编号 (来自1101接口返回)
- inputData["mdtrt_id"] = mdtrtId // 就诊 ID(来自2201接口返回)
- inputData["setl_id"] = setlId // 结算 ID
-
- input["data"] = inputData
- inputMessage["input"] = input //交易输入
-
- bytesData, err := json.Marshal(inputMessage)
- fmt.Println(string(bytesData))
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- reader := bytes.NewReader(bytesData)
- gdyb_url := beego.AppConfig.String("gdyb_url")
- gdyb_paasid := beego.AppConfig.String("gdyb_paasid")
-
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/1101"
- //url := gdyb_url + "2208"
-
- var url string
- if fixmedins_code == "H15049901371" || mdtrtarea_admvs == "450127" || mdtrtarea_admvs == "450721" {
- url = gdyb_url
- } else {
- url = gdyb_url + "2208"
- }
-
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/2208"
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/2208"
-
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/2208"
-
- if insuplc_admdvs == "421300" {
- var json2 string
- cmd := exec.Command("java", "-jar", "yh_hb_fat.jar", "2208", string(bytesData), json2)
- out, err := cmd.Output()
- if err != nil {
- fmt.Println("error:", err.Error())
- }
- mjson, _ := json.Marshal(inputMessage)
- str2 := string(mjson)
- fmt.Println(string(out))
-
- return hex.EncodeToString(out), str2
- } else {
- request, err := http.NewRequest("POST", url, reader)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
-
- request.Header.Set("Content-Type", "application/json;charset=UTF-8")
- request.Header.Set("x-tif-paasid", gdyb_paasid)
- request.Header.Set("x-tif-signature", signature)
- request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
- request.Header.Set("x-tif-nonce", nonce)
-
- client := http.Client{}
- resp, err := client.Do(request)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- respBytes, err := ioutil.ReadAll(resp.Body)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- str := string(respBytes)
- fmt.Println(str)
- mjson, _ := json.Marshal(inputMessage)
- str2 := string(mjson)
- return str, str2
-
- }
-
- }
-
- // 确认订单
- func Gdyb6201(org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, order models.HisOrder) string {
- // 生成签名
- nonce := GetRandomString(32)
- timestamp := time.Now().Unix()
- signature := setSignature(timestamp, nonce, secret_key)
-
- // 生成输入报文
- inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
- input := make(map[string]interface{})
- inputData := make(map[string]interface{})
- inputMessage["infno"] = "6201" // 交易编码
-
- inputData["mdtrt_id"] = order.MdtrtId
- inputData["chrg_bchno"] = order.Number
- inputData["psn_no"] = order.PsnNo
- inputData["psn_name"] = order.PsnName
- inputData["psn_cert_type"] = order.PsnCertType
- inputData["certno"] = order.Certno
- inputData["insutype"] = order.Insutype
- inputData["med_type"] = order.MedType
- inputData["medfee_sumamt"] = order.MedfeeSumamt
- inputData["fulamt_ownpay_amt"] = order.FulamtOwnpayAmt
- inputData["overlmt_selfpay"] = order.OverlmtSelfPay
- inputData["preselfpay_amt"] = order.PreselfpayAmt
- inputData["inscp_scp_amt"] = order.InscpScpAmt
- inputData["act_pay_dedc"] = order.ActPayDedc
- inputData["hifp_pay"] = order.HifpPay
- inputData["pool_prop_selfpay"] = order.PoolPropSelfpay
- inputData["cvlserv_pay"] = order.CvlservPay
- inputData["hifes_pay"] = order.HifesPay
- inputData["hifmi_pay"] = order.HifmiPay
- inputData["hifob_pay"] = order.HifobPay
- inputData["maf_pay"] = order.MafPay
- inputData["oth_pay"] = order.OthPay
- inputData["fund_pay_sumamt"] = order.FundPaySumamt
- inputData["psn_part_amt"] = order.PsnPartAmt
- inputData["acct_pay"] = order.AcctPay
- inputData["psn_cash_pay"] = order.PsnCashPay
- inputData["hosp_part_amt"] = order.HospPartAmt
- inputData["acct_mulaid_pay"] = order.AcctMulaidPay
-
- input["data"] = inputData
- inputMessage["input"] = input //交易输入
-
- bytesData, err := json.Marshal(inputMessage)
- fmt.Println(string(bytesData))
- if err != nil {
- fmt.Println(err.Error())
- return err.Error()
- }
- reader := bytes.NewReader(bytesData)
- gdyb_url := beego.AppConfig.String("gdyb_url")
- gdyb_paasid := beego.AppConfig.String("gdyb_paasid")
-
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/1101"
- url := gdyb_url + "6201"
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/6201"
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/6201"
-
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/2207"
- request, err := http.NewRequest("POST", url, reader)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error()
- }
-
- request.Header.Set("Content-Type", "application/json;charset=UTF-8")
- request.Header.Set("x-tif-paasid", gdyb_paasid)
- request.Header.Set("x-tif-signature", signature)
- request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
- request.Header.Set("x-tif-nonce", nonce)
-
- client := http.Client{}
- resp, err := client.Do(request)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error()
- }
- respBytes, err := ioutil.ReadAll(resp.Body)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error()
- }
- str := string(respBytes)
- fmt.Println(str)
- return str
- }
-
- // 医药机构费用结算对总账 func Gdyb3201( org_name string, doctor string, secret_key string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string) string {
- func Gdyb3201(baseParams models.BaseParams, businessParams models.BusinessParams, admin_user_id int64) string {
- fmt.Println("11222333-----")
-
- fmt.Println(baseParams)
- fmt.Println(businessParams)
- // 生成签名
- nonce := GetRandomString(32)
- timestamp := time.Now().Unix()
- signature := setSignature(timestamp, nonce, baseParams.SecretKey)
- inputMessage := make(map[string]interface{})
-
- if baseParams.MdtrtareaAdmvs == "450721" || baseParams.MdtrtareaAdmvs == "450127" {
-
- inputMessage = SetInputMessage1111(nonce, timestamp, baseParams.OrgName, admin_user_id, baseParams.FixmedinsCode, baseParams.InsuplcAdmdvs, baseParams.MdtrtareaAdmvs, baseParams.Doctor)
- } else {
- inputMessage = SetInputMessage(nonce, timestamp, baseParams.OrgName, baseParams.Doctor, baseParams.FixmedinsCode, baseParams.InsuplcAdmdvs, baseParams.MdtrtareaAdmvs)
-
- //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"] = "3201" // 交易编码
- inputData["insutype"] = businessParams.Insutype // 险种
- if baseParams.MdtrtareaAdmvs == "450721" {
- if businessParams.Insutype == "390" {
- inputData["clr_type"] = "99971" // 就诊 ID(来自2201接口返回)
- } else {
- inputData["clr_type"] = "99970" // 就诊 ID(来自2201接口返回)
- }
- } else {
- inputData["clr_type"] = businessParams.ClrType // 就诊 ID(来自2201接口返回)
- }
- inputData["setl_optins"] = businessParams.SetlOptins // 结算经办机构
- inputData["stmt_begndate"] = businessParams.StmtBegndate // 对帐开始时间
- inputData["stmt_enddate"] = businessParams.StmtEnddate //对帐结束时间
- inputData["medfee_sumamt"] = businessParams.MedfeeSumamt //医疗费总额
- inputData["fund_pay_sumamt"] = businessParams.FundPaySumamt //基金支付总额
- inputData["acct_pay"] = businessParams.AcctPay //个人账户支付金额
- inputData["fixmedins_setl_cnt"] = businessParams.FixmedinsSetlCnt //定点医药机构结算笔数
- inputData["refd_setl_flag"] = 0 // 就诊 ID(来自2201接口返回)
-
- input["data"] = inputData
- inputMessage["input"] = input //交易输入
-
- bytesData, err := json.Marshal(inputMessage)
- fmt.Println(string(bytesData))
- if err != nil {
- fmt.Println(err.Error())
- return err.Error()
- }
- reader := bytes.NewReader(bytesData)
- gdyb_url := beego.AppConfig.String("gdyb_url")
- gdyb_paasid := beego.AppConfig.String("gdyb_paasid")
- var url string
- if baseParams.MdtrtareaAdmvs == "150499" || baseParams.MdtrtareaAdmvs == "450721" {
- url = gdyb_url
- } else {
- url = gdyb_url + "3201"
- }
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/1101"
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/3201"
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/3201"
-
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/3201"
- request, err := http.NewRequest("POST", url, reader)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error()
- }
-
- request.Header.Set("Content-Type", "application/json;charset=UTF-8")
- request.Header.Set("x-tif-paasid", gdyb_paasid)
- request.Header.Set("x-tif-signature", signature)
- request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
- request.Header.Set("x-tif-nonce", nonce)
-
- client := http.Client{}
- resp, err := client.Do(request)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error()
- }
- respBytes, err := ioutil.ReadAll(resp.Body)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error()
- }
- str := string(respBytes)
- fmt.Println(str)
- return str
- }
-
- type Params struct {
- FileName string `json:"file_name"` //产品ID
- In []byte `json:"in"` //
- FixmedinsCode string `json:"fixmedins_code"` //调用环境生产为1 沙盒2
- }
-
- // 文件上传
- func Gdyb9101(baseParams models.BaseParams, file_name string, file_byte []byte) string {
-
- // 生成签名
- nonce := GetRandomString(32)
- timestamp := time.Now().Unix()
- signature := setSignature(timestamp, nonce, baseParams.SecretKey)
-
- //buf := new(bytes.Buffer)
- //buf.ReadFrom(strings.NewReader(string(file_byte)))
-
- inputMessage := SetInputMessage(nonce, timestamp, baseParams.OrgName, baseParams.Doctor, baseParams.FixmedinsCode, baseParams.InsuplcAdmdvs, baseParams.MdtrtareaAdmvs)
- input := make(map[string]interface{})
- inputData := make(map[string]interface{})
-
- inputMessage["infno"] = "9101" // 交易编码
- inputData["file_name"] = file_name //文件名
- inputData["in"] = file_byte //文件数据
- inputData["fixmedins_code"] = baseParams.FixmedinsCode //编码
-
- input["fsUploadIn"] = inputData
- inputMessage["input"] = input //交易输入
-
- bytesData, err := json.Marshal(inputMessage)
- fmt.Println(string(bytesData))
- if err != nil {
- fmt.Println(err.Error())
- return err.Error()
- }
- reader := bytes.NewReader(bytesData)
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/9101"
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/9101"
-
- gdyb_url := beego.AppConfig.String("gdyb_url")
- gdyb_paasid := beego.AppConfig.String("gdyb_paasid")
-
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/1101"
- url := gdyb_url + "9101"
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/9101"
- request, err := http.NewRequest("POST", url, reader)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error()
- }
-
- request.Header.Set("Content-Type", "application/json;charset=UTF-8")
- request.Header.Set("x-tif-paasid", gdyb_paasid)
- request.Header.Set("x-tif-signature", signature)
- request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
- request.Header.Set("x-tif-nonce", nonce)
-
- client := http.Client{}
- resp, err := client.Do(request)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error()
- }
- respBytes, err := ioutil.ReadAll(resp.Body)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error()
- }
- str := string(respBytes)
- fmt.Println(str)
- return str
- }
-
- func Gdyb9102(baseParams models.BaseParams, file_name string, file_qury_no string) string {
-
- // 生成签名
- nonce := GetRandomString(32)
- timestamp := time.Now().Unix()
- signature := setSignature(timestamp, nonce, baseParams.SecretKey)
- inputMessage := SetInputMessage(nonce, timestamp, baseParams.OrgName, baseParams.Doctor, baseParams.FixmedinsCode, baseParams.InsuplcAdmdvs, baseParams.MdtrtareaAdmvs)
- input := make(map[string]interface{})
- inputData := make(map[string]interface{})
- inputMessage["infno"] = "9102" // 交易编码
- inputData["file_name"] = file_name //文件名
- inputData["file_qury_no"] = file_qury_no //文件数据
-
- inputData["fixmedins_code"] = baseParams.FixmedinsCode //编码
- input["fsDownloadIn"] = inputData
- inputMessage["input"] = input //交易输入
-
- bytesData, err := json.Marshal(inputMessage)
- fmt.Println(string(bytesData))
- if err != nil {
- fmt.Println(err.Error())
- return err.Error()
- }
- reader := bytes.NewReader(bytesData)
- gdyb_url := beego.AppConfig.String("gdyb_url")
- gdyb_paasid := beego.AppConfig.String("gdyb_paasid")
-
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/1101"
- url := gdyb_url + "9102"
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/9102"
-
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/9102"
-
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/9102"
- request, err := http.NewRequest("POST", url, reader)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error()
- }
-
- request.Header.Set("Content-Type", "application/json;charset=UTF-8")
- request.Header.Set("x-tif-paasid", gdyb_paasid)
- request.Header.Set("x-tif-signature", signature)
- request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
- request.Header.Set("x-tif-nonce", nonce)
-
- client := http.Client{}
- resp, err := client.Do(request)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error()
- }
- respBytes, err := ioutil.ReadAll(resp.Body)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error()
- }
- str := string(respBytes)
-
- enc := mahonia.NewEncoder("gbk")
- //output, err_msg := GetFjBusinessHandleInfo([]byte(enc.ConvertString(string(bytesData))))
-
- fmt.Println(enc.ConvertString(str))
- return str
- }
-
- func Gdyb3202(baseParams models.BaseParams, businessParams models.BusinessParams) string {
- // 生成签名
- nonce := GetRandomString(32)
- timestamp := time.Now().Unix()
- signature := setSignature(timestamp, nonce, baseParams.SecretKey)
-
- // 生成输入报文
- inputMessage := SetInputMessage(nonce, timestamp, baseParams.OrgName, baseParams.Doctor, baseParams.FixmedinsCode, baseParams.InsuplcAdmdvs, baseParams.MdtrtareaAdmvs)
- input := make(map[string]interface{})
- inputData := make(map[string]interface{})
- inputMessage["infno"] = "3202" // 交易编码
- inputData["file_qury_no"] = businessParams.FileQuryNo // 险种
- inputData["setl_optins"] = baseParams.InsuplcAdmdvs // 结算经办机构
- inputData["stmt_begndate"] = businessParams.StmtBegndate // 对帐开始时间
- inputData["stmt_enddate"] = businessParams.StmtEnddate //对帐结束时间
- inputData["medfee_sumamt"] = businessParams.MedfeeSumamt //医疗费总额
- inputData["fund_pay_sumamt"] = businessParams.FundPaySumamt //基金支付总额
- inputData["cash_payamt"] = businessParams.CashPayamt //现金支付金额
- inputData["fixmedins_setl_cnt"] = businessParams.FixmedinsSetlCnt //定点医药机构结算笔数
- inputData["clr_type"] = "11" // 就诊 ID(来自2201接口返回)
- inputData["refd_setl_flag"] = 1 // 就诊 ID(来自2201接口返回)
-
- input["data"] = inputData
- inputMessage["input"] = input //交易输入
- bytesData, err := json.Marshal(inputMessage)
- fmt.Println(string(bytesData))
- if err != nil {
- fmt.Println(err.Error())
- return err.Error()
- }
- reader := bytes.NewReader(bytesData)
- gdyb_url := beego.AppConfig.String("gdyb_url")
- gdyb_paasid := beego.AppConfig.String("gdyb_paasid")
-
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/1101"
- url := gdyb_url + "3202"
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/3202"
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/3202"
-
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/3202"
- request, err := http.NewRequest("POST", url, reader)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error()
- }
- request.Header.Set("Content-Type", "application/json;charset=UTF-8")
- request.Header.Set("x-tif-paasid", gdyb_paasid)
- request.Header.Set("x-tif-signature", signature)
- request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
- request.Header.Set("x-tif-nonce", nonce)
- client := http.Client{}
- resp, err := client.Do(request)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error()
- }
- respBytes, err := ioutil.ReadAll(resp.Body)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error()
- }
- str := string(respBytes)
- fmt.Println(str)
- return str
- }
-
- func Gdyb5203(baseParams models.BaseParams, businessParams models.BusinessParams) string {
- fmt.Println("~~~~~~1")
- fmt.Println(baseParams)
- fmt.Println(businessParams)
-
- // 生成签名
- nonce := GetRandomString(32)
- timestamp := time.Now().Unix()
- signature := setSignature(timestamp, nonce, baseParams.SecretKey)
- fmt.Println("~~~~~~2")
-
- // 生成输入报文
- inputMessage := SetInputMessage(nonce, timestamp, baseParams.OrgName, baseParams.Doctor, baseParams.FixmedinsCode, baseParams.InsuplcAdmdvs, baseParams.MdtrtareaAdmvs)
- input := make(map[string]interface{})
- inputData := make(map[string]interface{})
- inputMessage["infno"] = "5203" // 交易编码
- inputData["psn_no"] = businessParams.PsnNo
- inputData["setl_id"] = businessParams.SetlId
- inputData["mdtrt_id"] = businessParams.MdtrtId
- input["data"] = inputData
- inputMessage["input"] = input //交易输入
- bytesData, err := json.Marshal(inputMessage)
- fmt.Println(string(bytesData))
- fmt.Println("~~~~~~")
- fmt.Println("~~~~~~")
- fmt.Println(string(bytesData))
- if err != nil {
- fmt.Println(err.Error())
- return err.Error()
- }
- reader := bytes.NewReader(bytesData)
- gdyb_url := beego.AppConfig.String("gdyb_url")
- gdyb_paasid := beego.AppConfig.String("gdyb_paasid")
-
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/1101"
- //url := gdyb_url + "5203"
- var url string
- if baseParams.FixmedinsCode == "H15049901371" || baseParams.MdtrtareaAdmvs == "450127" || baseParams.MdtrtareaAdmvs == "450721" {
- url = gdyb_url
- } else {
- url = gdyb_url + "5203"
- }
-
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/5203"
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/5203"
-
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/5203"
- request, err := http.NewRequest("POST", url, reader)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error()
- }
- request.Header.Set("Content-Type", "application/json;charset=UTF-8")
- request.Header.Set("x-tif-paasid", gdyb_paasid)
- request.Header.Set("x-tif-signature", signature)
- request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
- request.Header.Set("x-tif-nonce", nonce)
- client := http.Client{}
- resp, err := client.Do(request)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error()
- }
- respBytes, err := ioutil.ReadAll(resp.Body)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error()
- }
- str := string(respBytes)
- fmt.Println(str)
- return str
- }
-
- func Gdyb5204(baseParams models.BaseParams, businessParams models.BusinessParams) string {
- // 生成签名
- nonce := GetRandomString(32)
- timestamp := time.Now().Unix()
- signature := setSignature(timestamp, nonce, baseParams.SecretKey)
-
- // 生成输入报文
- inputMessage := SetInputMessage(nonce, timestamp, baseParams.OrgName, baseParams.Doctor, baseParams.FixmedinsCode, baseParams.InsuplcAdmdvs, baseParams.MdtrtareaAdmvs)
- input := make(map[string]interface{})
- inputData := make(map[string]interface{})
- inputMessage["infno"] = "5204" // 交易编码
- inputData["psn_no"] = businessParams.PsnNo
- inputData["setl_id"] = businessParams.SetlId
- inputData["mdtrt_id"] = businessParams.MdtrtId
- input["data"] = inputData
- inputMessage["input"] = input //交易输入
- bytesData, err := json.Marshal(inputMessage)
- fmt.Println(string(bytesData))
- if err != nil {
- fmt.Println(err.Error())
- return err.Error()
- }
- reader := bytes.NewReader(bytesData)
- gdyb_url := beego.AppConfig.String("gdyb_url")
- gdyb_paasid := beego.AppConfig.String("gdyb_paasid")
-
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/1101"
- //url := gdyb_url + "5203"
- var url string
- if baseParams.FixmedinsCode == "H15049901371" || baseParams.MdtrtareaAdmvs == "450127" || baseParams.MdtrtareaAdmvs == "450721" {
- url = gdyb_url
- } else {
- url = gdyb_url + "5204"
- }
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/5203"
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/5203"
-
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/5203"
- request, err := http.NewRequest("POST", url, reader)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error()
- }
- request.Header.Set("Content-Type", "application/json;charset=UTF-8")
- request.Header.Set("x-tif-paasid", gdyb_paasid)
- request.Header.Set("x-tif-signature", signature)
- request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
- request.Header.Set("x-tif-nonce", nonce)
- client := http.Client{}
- resp, err := client.Do(request)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error()
- }
- respBytes, err := ioutil.ReadAll(resp.Body)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error()
- }
- str := string(respBytes)
- fmt.Println(str)
- return str
- }
-
- func Gdyb2001(baseParams models.BaseParams, psn_no string, insutype string, med_type string) string {
- if med_type == "1111" || med_type == "1112" {
- med_type = "11"
- }
-
- // 生成签名
- nonce := GetRandomString(32)
- timestamp := time.Now().Unix()
- signature := setSignature(timestamp, nonce, baseParams.SecretKey)
-
- // 生成输入报文
- inputMessage := SetInputMessage(nonce, timestamp, baseParams.OrgName, baseParams.Doctor, baseParams.FixmedinsCode, baseParams.InsuplcAdmdvs, baseParams.MdtrtareaAdmvs)
- input := make(map[string]interface{})
- inputData := make(map[string]interface{})
- inputMessage["infno"] = "2001" // 交易编码
- inputData["psn_no"] = psn_no
- inputData["insutype"] = insutype
- inputData["fixmedins_code"] = baseParams.FixmedinsCode
- inputData["med_type"] = med_type
- inputData["begntime"] = "2021-01-01 00:00:00"
- input["data"] = inputData
- inputMessage["input"] = input //交易输入
- bytesData, err := json.Marshal(inputMessage)
- fmt.Println(string(bytesData))
- if err != nil {
- fmt.Println(err.Error())
- return err.Error()
- }
- reader := bytes.NewReader(bytesData)
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/3301"
-
- gdyb_url := beego.AppConfig.String("gdyb_url")
- gdyb_paasid := beego.AppConfig.String("gdyb_paasid")
-
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/1101"
- url := gdyb_url
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/3301"
- request, err := http.NewRequest("POST", url, reader)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error()
- }
- request.Header.Set("Content-Type", "application/json;charset=UTF-8")
- request.Header.Set("x-tif-paasid", gdyb_paasid)
- request.Header.Set("x-tif-signature", signature)
- request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
- request.Header.Set("x-tif-nonce", nonce)
- client := http.Client{}
- resp, err := client.Do(request)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error()
- }
- respBytes, err := ioutil.ReadAll(resp.Body)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error()
- }
- str := string(respBytes)
- fmt.Println(str)
- return str
- }
-
- func Gdyb3301(baseParams models.BaseParams, name string, codg string, list_type_code string, start_time string, ent_time string, list_type string, admin_user_id int64) string {
- // 生成签名
- nonce := GetRandomString(32)
- timestamp := time.Now().Unix()
- signature := setSignature(timestamp, nonce, baseParams.SecretKey)
- inputMessage := make(map[string]interface{})
-
- if baseParams.MdtrtareaAdmvs == "450721" {
- inputMessage = SetInputMessage1111(nonce, timestamp, baseParams.OrgName, admin_user_id, baseParams.FixmedinsCode, baseParams.InsuplcAdmdvs, baseParams.MdtrtareaAdmvs, baseParams.Doctor)
- //inputMessage = SetInputMessage1111(nonce, timestamp, org_name, admin_user_id, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs,doctor)
- } else {
- inputMessage = SetInputMessage(nonce, timestamp, baseParams.OrgName, baseParams.Doctor, baseParams.FixmedinsCode, baseParams.InsuplcAdmdvs, baseParams.MdtrtareaAdmvs)
-
- //inputMessage = SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
- }
- // 生成输入报文
- input := make(map[string]interface{})
- //input2 := make([]map[string]interface{})
- feedetail := make([]map[string]interface{}, 0)
-
- inputData := make(map[string]interface{})
- inputMessage["infno"] = "3301A" // 交易编码
- inputData["fixmedins_hilist_id"] = codg
- inputData["fixmedins_hilist_name"] = name
- inputData["list_type"] = list_type
- inputData["med_list_codg"] = codg
- inputData["begndate"] = start_time
- inputData["enddate"] = ent_time
-
- inputData["aprvno"] = ""
- inputData["dosform"] = ""
- inputData["exct_cont"] = ""
- inputData["item_cont"] = ""
- inputData["prcunt"] = ""
- inputData["spec"] = ""
- inputData["pacspec"] = ""
- inputData["memo"] = ""
-
- feedetail = append(feedetail, inputData)
-
- input["data"] = feedetail
- inputMessage["input"] = input //交易输入
- bytesData, err := json.Marshal(inputMessage)
- fmt.Println(string(bytesData))
- if err != nil {
- fmt.Println(err.Error())
- return err.Error()
- }
- reader := bytes.NewReader(bytesData)
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/3301"
- //
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/3301"
- gdyb_url := beego.AppConfig.String("gdyb_url")
- gdyb_paasid := beego.AppConfig.String("gdyb_paasid")
-
- url := ""
- if baseParams.MdtrtareaAdmvs == "450721" {
- url = gdyb_url
- } else {
-
- url = gdyb_url + "3301"
- }
-
- request, err := http.NewRequest("POST", url, reader)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error()
- }
- request.Header.Set("Content-Type", "application/json;charset=UTF-8")
- request.Header.Set("x-tif-paasid", gdyb_paasid)
- request.Header.Set("x-tif-signature", signature)
- request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
- request.Header.Set("x-tif-nonce", nonce)
- client := http.Client{}
- resp, err := client.Do(request)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error()
- }
- respBytes, err := ioutil.ReadAll(resp.Body)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error()
- }
- str := string(respBytes)
- fmt.Println(str)
- return str
- }
- func Gdyb3302(baseParams *models.BaseParams, name string, codg string, list_type_code string) string {
- // 生成签名
- nonce := GetRandomString(32)
- timestamp := time.Now().Unix()
- signature := setSignature(timestamp, nonce, baseParams.SecretKey)
-
- // 生成输入报文
- inputMessage := SetInputMessage(nonce, timestamp, baseParams.OrgName, baseParams.Doctor, baseParams.FixmedinsCode, baseParams.InsuplcAdmdvs, baseParams.MdtrtareaAdmvs)
- input := make(map[string]interface{})
- inputData := make(map[string]interface{})
- inputMessage["infno"] = "3302" // 交易编码
- inputData["fixmedins_code"] = baseParams.FixmedinsCode
- inputData["fixmedins_hilist_id"] = codg
- inputData["list_type"] = list_type_code
- inputData["med_list_codg"] = codg
-
- input["data"] = inputData
- inputMessage["input"] = input //交易输入
- bytesData, err := json.Marshal(inputMessage)
- fmt.Println(string(bytesData))
- if err != nil {
- fmt.Println(err.Error())
- return err.Error()
- }
- reader := bytes.NewReader(bytesData)
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/3302"
-
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/3302"
- gdyb_url := beego.AppConfig.String("gdyb_url")
- gdyb_paasid := beego.AppConfig.String("gdyb_paasid")
-
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/1101"
- url := gdyb_url + "3302"
- request, err := http.NewRequest("POST", url, reader)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error()
- }
- request.Header.Set("Content-Type", "application/json;charset=UTF-8")
- request.Header.Set("x-tif-paasid", gdyb_paasid)
- request.Header.Set("x-tif-signature", signature)
- request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
- request.Header.Set("x-tif-nonce", nonce)
- client := http.Client{}
- resp, err := client.Do(request)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error()
- }
- respBytes, err := ioutil.ReadAll(resp.Body)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error()
- }
- str := string(respBytes)
- fmt.Println(str)
- return str
- }
- func Gdyb2505(psnNo string, doctor string, org_name string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, start_time string, end_time string, admin_user_id int64) string {
- // 生成签名
- nonce := GetRandomString(32)
- timestamp := time.Now().Unix()
- signature := setSignature(timestamp, nonce, secret_key)
- inputMessage := make(map[string]interface{})
-
- //tempTime := time.Unix(timestamp, 0)
- //timeFormatOne := tempTime.Format("2006-01-02 15:04:05")
- // 生成输入报文
- if mdtrtarea_admvs == "450721" || mdtrtarea_admvs == "450127" {
-
- inputMessage = SetInputMessage1111(nonce, timestamp, org_name, admin_user_id, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, doctor)
- } else {
- inputMessage = SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
- }
- // 生成输入报文
- //inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
- input := make(map[string]interface{})
- inputData := make(map[string]interface{})
- inputMessage["infno"] = "2505"
- inputData["psn_no"] = psnNo
- inputData["biz_appy_type"] = "01"
- inputData["begndate"] = start_time
- inputData["enddate"] = end_time
- inputData["fixmedins_code"] = fixmedins_code
- inputData["fixmedins_name"] = org_name
- inputData["tel"] = ""
- inputData["addr"] = ""
- inputData["agnter_name"] = ""
- inputData["agnter_cert_type"] = ""
- inputData["agnter_certno"] = ""
- inputData["agnter_tel"] = ""
- inputData["agnter_addr"] = ""
- inputData["agnter_rlts"] = ""
- inputData["fix_srt_no"] = "1"
- inputData["memo"] = ""
- input["data"] = inputData
- inputMessage["input"] = input //交易输入
- bytesData, err := json.Marshal(inputMessage)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error()
- }
- reader := bytes.NewReader(bytesData)
- //fmt.Println(String(bytesData))
- fmt.Println(string(bytesData))
-
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/2505"
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/2505"
- gdyb_url := beego.AppConfig.String("gdyb_url")
- gdyb_paasid := beego.AppConfig.String("gdyb_paasid")
- url := ""
- if mdtrtarea_admvs == "450721" || mdtrtarea_admvs == "450127" {
- url = gdyb_url
-
- } else {
-
- url = gdyb_url + "2505"
-
- }
-
- request, err := http.NewRequest("POST", url, reader)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error()
- }
- request.Header.Set("Content-Type", "application/json;charset=UTF-8")
- request.Header.Set("x-tif-paasid", gdyb_paasid)
- request.Header.Set("x-tif-signature", signature)
- request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
- request.Header.Set("x-tif-nonce", nonce)
- client := http.Client{}
- resp, err := client.Do(request)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error()
- }
- respBytes, err := ioutil.ReadAll(resp.Body)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error()
- }
- str := string(respBytes)
- fmt.Println(str)
- return str
- }
- func Gdyb2506(psnNo string, doctor string, org_name string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, trt_dcla_detl_sn string) string {
- // 生成签名
- nonce := GetRandomString(32)
- timestamp := time.Now().Unix()
- signature := setSignature(timestamp, nonce, secret_key)
- // 生成输入报文
- inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
- input := make(map[string]interface{})
- inputData := make(map[string]interface{})
- inputMessage["infno"] = "2506"
- inputData["psn_no"] = psnNo
- inputData["trt_dcla_detl_sn"] = trt_dcla_detl_sn
- inputData["memo"] = ""
- input["data"] = inputData
- inputMessage["input"] = input //交易输入
- bytesData, err := json.Marshal(inputMessage)
- fmt.Println(string(bytesData))
- if err != nil {
- fmt.Println(err.Error())
- return err.Error()
- }
- reader := bytes.NewReader(bytesData)
-
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/2506"
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/2506"
-
- gdyb_url := beego.AppConfig.String("gdyb_url")
- gdyb_paasid := beego.AppConfig.String("gdyb_paasid")
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/1101"
- url := gdyb_url + "2506"
-
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/2203"
- request, err := http.NewRequest("POST", url, reader)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error()
- }
-
- request.Header.Set("Content-Type", "application/json;charset=UTF-8")
- request.Header.Set("x-tif-paasid", gdyb_paasid)
- request.Header.Set("x-tif-signature", signature)
- request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
- request.Header.Set("x-tif-nonce", nonce)
-
- client := http.Client{}
- resp, err := client.Do(request)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error()
- }
- respBytes, err := ioutil.ReadAll(resp.Body)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error()
- }
- str := string(respBytes)
- fmt.Println(str)
- return str
- }
- func Gdyb2503(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, hospital_code string, hospital_name string) string {
- // 生成签名
- nonce := GetRandomString(32)
- timestamp := time.Now().Unix()
- signature := setSignature(timestamp, nonce, secret_key)
- //tempTime := time.Unix(timestamp, 0)
- //timeFormatOne := tempTime.Format("2006-01-02 15:04:05")
-
- //timeFormatTwo := tempTime.Format("2006-01-02")
-
- //t := time.Now()
- //last := time.Date(t.Year(), time.December, 31, 0, 0, 0, 0, time.UTC)
- //tm := time.Unix(last.Unix(), 0)
-
- // 生成输入报文
- inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
- input := make(map[string]interface{})
- inputData := make(map[string]interface{})
- inputMessage["infno"] = "2503" // 交易编码
- inputData["psn_no"] = psnNo // 人员编号 (来自1101接口返回)
- inputData["insutype"] = insutype // 险种类型(来自1101接口返回)
- inputData["opsp_dise_code"] = sick_code // 险种类型(来自1101接口返回)
- inputData["opsp_dise_name"] = sick_name // 险种类型(来自1101接口返回)
- inputData["insu_optins"] = insuplc_admdvs // 险种类型(来自1101接口返回)
- inputData["ide_fixmedins_no"] = hospital_code // 险种类型(来自1101接口返回)
- inputData["ide_fixmedins_name"] = hospital_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 //交易输入
- bytesData, err := json.Marshal(inputMessage)
- fmt.Println(string(bytesData))
- if err != nil {
- fmt.Println(err.Error())
- return err.Error()
- }
- reader := bytes.NewReader(bytesData)
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/2503"
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/2503"
- gdyb_url := beego.AppConfig.String("gdyb_url")
- gdyb_paasid := beego.AppConfig.String("gdyb_paasid")
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/1101"
- //url := gdyb_url + "2503"
-
- var url string
- if fixmedins_code == "H15049901371" || mdtrtarea_admvs == "450127" || mdtrtarea_admvs == "450721" {
- url = gdyb_url
- } else {
- url = gdyb_url + "2503"
- }
-
- request, err := http.NewRequest("POST", url, reader)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error()
- }
-
- request.Header.Set("Content-Type", "application/json;charset=UTF-8")
- request.Header.Set("x-tif-paasid", gdyb_paasid)
- request.Header.Set("x-tif-signature", signature)
- request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
- request.Header.Set("x-tif-nonce", nonce)
-
- client := http.Client{}
- resp, err := client.Do(request)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error()
- }
- respBytes, err := ioutil.ReadAll(resp.Body)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error()
- }
- str := string(respBytes)
- fmt.Println(str)
- return str
- }
- func Gdyb2504(psnNo string, org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, trt_dcla_detl_sn string) string {
- // 生成签名
- nonce := GetRandomString(32)
- timestamp := time.Now().Unix()
- signature := setSignature(timestamp, nonce, secret_key)
-
- // 生成输入报文
- inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
- input := make(map[string]interface{})
- inputData := make(map[string]interface{})
- inputMessage["infno"] = "2504" // 交易编码
- inputData["psn_no"] = psnNo // 人员编号 (来自1101接口返回)
- inputData["trt_dcla_detl_sn"] = trt_dcla_detl_sn // 人员编号 (来自1101接口返回)
- inputData["memo"] = "撤销备案" // 人员编号 (来自1101接口返回)
-
- input["data"] = inputData
- inputMessage["input"] = input //交易输入
- bytesData, err := json.Marshal(inputMessage)
- fmt.Println(string(bytesData))
- if err != nil {
- fmt.Println(err.Error())
- return err.Error()
- }
- reader := bytes.NewReader(bytesData)
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/2504"
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/2504"
- gdyb_url := beego.AppConfig.String("gdyb_url")
- gdyb_paasid := beego.AppConfig.String("gdyb_paasid")
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/1101"
- url := gdyb_url + "2504"
- request, err := http.NewRequest("POST", url, reader)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error()
- }
- request.Header.Set("Content-Type", "application/json;charset=UTF-8")
- request.Header.Set("x-tif-paasid", gdyb_paasid)
- request.Header.Set("x-tif-signature", signature)
- request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
- request.Header.Set("x-tif-nonce", nonce)
-
- client := http.Client{}
- resp, err := client.Do(request)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error()
- }
- respBytes, err := ioutil.ReadAll(resp.Body)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error()
- }
- str := string(respBytes)
- fmt.Println(str)
- return str
- }
-
- //func Gdyb2503(psnNo string, doctor string, department string, diag string, org_name string, med_type string, doctor_id int64, fixmedins_code string, diag_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, sick_code string, sick_name string) string {
- // // 生成签名
- // nonce := GetRandomString(32)
- // timestamp := time.Now().Unix()
- // signature := setSignature(timestamp, nonce, secret_key)
- // tempTime := time.Unix(timestamp, 0)
- // timeFormatOne := tempTime.Format("2006-01-02 15:04:05")
- //
- // // 生成输入报文
- // inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
- // input := make(map[string]interface{})
- // inputData := make(map[string]interface{})
- // diseinfo := make([]map[string]interface{}, 0)
- //
- // inputMessage["infno"] = "2203" // 交易编码
- // inputData["mdtrt_id"] = mdtrtId // 就诊 ID(来自2201接口返回)
- // inputData["psn_no"] = psnNo // 人员编号 (来自1101接口返回)
- // inputData["med_type"] = med_type // 医疗类别 16门诊特殊病
- // inputData["begntime"] = timeFormatOne // 开始时间
- // inputData["main_cond_dscr"] = "" // 主要病情描述
- // inputData["dise_codg"] = sick_code // 病种编码
- // inputData["dise_name"] = sick_name // 病种名称
- // inputData["birctrl_type"] = "" // 计划生育手术类别
- // inputData["birctrl_matn_date"] = "" // 计划生育手术或生育日期
- //
- // diseinfo_sun := make(map[string]interface{})
- // diseinfo_sun["diag_type"] = "1" // 诊断类别
- // diseinfo_sun["diag_srt_no"] = "1" // 诊断排序号
- // diseinfo_sun["diag_code"] = diag_code // 诊断代码
- // diseinfo_sun["diag_name"] = diag // 诊断名称
- // diseinfo_sun["diag_dept"] = department // 诊断科室
- // diseinfo_sun["dise_dor_no"] = doctor_id // 诊断医生编码
- // diseinfo_sun["dise_dor_name"] = doctor // 诊断医生姓名
- // diseinfo_sun["diag_time"] = timeFormatOne // 诊断时间
- // diseinfo_sun["vali_flag"] = "1" // 有效标志
- //
- // diseinfo = append(diseinfo, diseinfo_sun)
- // input["diseinfo"] = diseinfo
- // input["mdtrtinfo"] = inputData
- // inputMessage["input"] = input //交易输入
- //
- // bytesData, err := json.Marshal(inputMessage)
- // fmt.Println(string(bytesData))
- // if err != nil {
- // fmt.Println(err.Error())
- // return err.Error()
- // }
- // reader := bytes.NewReader(bytesData)
- //
- // url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/2203"
- //
- // //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/2203"
- // request, err := http.NewRequest("POST", url, reader)
- // if err != nil {
- // fmt.Println(err.Error())
- // return err.Error()
- // }
- //
- // request.Header.Set("Content-Type", "application/json;charset=UTF-8")
- // request.Header.Set("x-tif-paasid", "sg03_prd")
- // request.Header.Set("x-tif-signature", signature)
- // request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
- // request.Header.Set("x-tif-nonce", nonce)
- //
- // client := http.Client{}
- // resp, err := client.Do(request)
- // if err != nil {
- // fmt.Println(err.Error())
- // return err.Error()
- // }
- // respBytes, err := ioutil.ReadAll(resp.Body)
- // if err != nil {
- // fmt.Println(err.Error())
- // return err.Error()
- // }
- // str := string(respBytes)
- // fmt.Println(str)
- // return str
- //}
-
- func Gdyb5301(psnNo string, org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, admin_user_id int64) string {
- // 生成签名
- nonce := GetRandomString(32)
- timestamp := time.Now().Unix()
- //timestamp := time.Now().UnixNano() / 1e6
-
- 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 := make(map[string]interface{})
-
- //tempTime := time.Unix(timestamp, 0)
- //timeFormatOne := tempTime.Format("2006-01-02 15:04:05")
- // 生成输入报文
- if mdtrtarea_admvs == "450721" || mdtrtarea_admvs == "450127" {
-
- inputMessage = SetInputMessage1111(nonce, timestamp, org_name, admin_user_id, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, doctor)
- } else {
- inputMessage = SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
- }
- // 生成输入报文
- //inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
- input := make(map[string]interface{})
- inputData := make(map[string]interface{})
- inputMessage["infno"] = "5301" // 交易编码
- inputData["psn_no"] = psnNo // 人员编号 (来自1101接口返回)
- input["data"] = inputData
- inputMessage["input"] = input //交易输入
- bytesData, err := json.Marshal(inputMessage)
- 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"
- var url string
- if mdtrtarea_admvs == "450721" || mdtrtarea_admvs == "450127" {
- url = gdyb_url
-
- } else {
- url = gdyb_url + "5301"
-
- }
-
- request, err := http.NewRequest("POST", url, reader)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error()
- }
-
- request.Header.Set("Content-Type", "application/json;charset=UTF-8")
- request.Header.Set("x-tif-paasid", gdyb_paasid)
- request.Header.Set("x-tif-signature", signature)
- request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
- request.Header.Set("x-tif-nonce", nonce)
-
- client := http.Client{}
- resp, err := client.Do(request)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error()
- }
- respBytes, err := ioutil.ReadAll(resp.Body)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error()
- }
- str := string(respBytes)
- fmt.Println(str)
- return str
- }
-
- func Gdyb5301Two(psnNo string, org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string) string {
- // 生成签名
- nonce := GetRandomString(32)
- timestamp := time.Now().Unix()
- signature := setSignature(timestamp, nonce, secret_key)
- //tempTime := time.Unix(timestamp, 0)
- //timeFormatOne := tempTime.Format("2006-01-02 15:04:05")
-
- //timeFormatTwo := tempTime.Format("2006-01-02")
-
- // 生成输入报文
- inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
- input := make(map[string]interface{})
- inputData := make(map[string]interface{})
- inputMessage["infno"] = "5301" // 交易编码
- inputData["psn_no"] = psnNo // 人员编号 (来自1101接口返回)
- input["data"] = inputData
- inputMessage["input"] = input //交易输入
- bytesData, err := json.Marshal(inputMessage)
- 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
- request, err := http.NewRequest("POST", url, reader)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error()
- }
-
- request.Header.Set("Content-Type", "application/json;charset=UTF-8")
- request.Header.Set("x-tif-paasid", gdyb_paasid)
- request.Header.Set("x-tif-signature", signature)
- request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
- request.Header.Set("x-tif-nonce", nonce)
-
- client := http.Client{}
- resp, err := client.Do(request)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error()
- }
- respBytes, err := ioutil.ReadAll(resp.Body)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error()
- }
- str := string(respBytes)
- fmt.Println(str)
- return str
- }
-
- type CustomStruct struct {
- FundPayType string
- FundPayamt float64
- }
-
- type OpspdiseinfoStruct struct {
- DiagName string
- DiagCode string
- OprnOprtName string
- OprnOprtCode string
- }
-
- type DiaginfoStructTwo struct {
- DiagType string
- DiagCode string
- DiagName string
- MaindiagFlag string
- }
-
- type IteminfoStruct struct {
- MedChrgitm string
- Amt float64
- ClaaSumfee float64
- ClabAmt float64
- FulamtOwnpayAmt float64
- OthAmt float64
- }
-
- type Struct4101 struct {
- PsnNo string
- MdtrtId string
- SetlId string
- HiSetlLv string
- PsnName string
- Gend string
- Brdy string
- Ntly string
- Naty string
- PatnCertType string
- Certno string
- Prfs string
- ConerName string
- PatnRlts string
- ConerAddr string
- ConerTel string
- HiType string
- Insuplc string
- AdmCaty string
- DscgCaty string
- MaindiagFlag string
- BillCode string
- BillNo string
- BizSn string
- SetlBegnDate string
- SetlEndDate string
- PsnSelfPay float64
- PsnOwnPay float64
- AcctPay float64
- PsnCashpay float64
- HiPaymtd string
- Hsorg string
- HsorgOpter string
- MedinsFillDept string
- MedinsFillPsn string
- IptMedType string
- Age int64
- CustomStruct []CustomStruct
- OpspdiseinfoStruct []OpspdiseinfoStruct
- Diseinfo []DiaginfoStructTwo
-
- IteminfoStruct []IteminfoStruct
- AdmTime string
- AdmEndTime string
- HisNo string
- DoctorName string
- DoctorCode string
-
- CurAddr string
- }
-
- func Gdyb4101(struct4101 Struct4101, secret_key string, org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, org_id int64, admin_user_id int64) (string, string) {
- // 生成签名
- nonce := GetRandomString(32)
- timestamp := time.Now().Unix()
- signature := setSignature(timestamp, nonce, secret_key)
- inputMessage := make(map[string]interface{})
-
- //tempTime := time.Unix(timestamp, 0)
- //timeFormatOne := tempTime.Format("2006-01-02 15:04:05")
- // 生成输入报文
- if mdtrtarea_admvs == "450721" || mdtrtarea_admvs == "450127" {
-
- inputMessage = SetInputMessage1111(nonce, timestamp, org_name, admin_user_id, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, doctor)
- } else {
- inputMessage = SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
- }
- // 生成输入报文
- //inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
- input := make(map[string]interface{})
- inputData := make(map[string]interface{})
- if org_id == 10106 || org_id == 10215 || org_id == 10138 || org_id == 9504 {
- inputMessage["infno"] = "4101A" // 交易编码
-
- } else {
- 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"] = org_name // 定点医药机构名称 必填
- inputData["fixmedins_code"] = fixmedins_code // 定点医药机构编码 必填
- inputData["hi_setl_lv"] = "" // 医保结算等级
- inputData["hi_no"] = struct4101.PsnNo // 医保编号
- inputData["medcasno"] = struct4101.PsnNo // 病案号 必填
- inputData["dcla_time"] = year + "-" + month + "-" + day // 申报时间 必填
- inputData["psn_name"] = struct4101.PsnName // 人员姓名 必填
- inputData["gend"] = struct4101.Gend // 性别 必填
- inputData["brdy"] = struct4101.Brdy // 出生日期 必填
- inputData["age"] = struct4101.Age // 年龄 必填
- inputData["ntly"] = "CHN" // 国籍 必填
- inputData["nwb_age"] = "" // 年龄 必填
- inputData["naty"] = struct4101.Naty // 民族 必填
-
- inputData["dscg_way"] = "9" // 民族 必填
-
- //inputData["resp_nurs_code"] = "N441623001432" // 民族 必填
-
- 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"] = "" // 住院医疗类型 必填
- inputData["adm_way"] = "2" // 入院途径 必填
- inputData["trt_type"] = "1" // 治疗类别 必填
- inputData["adm_time"] = struct4101.SetlEndDate // 入院时间 必填
- inputData["adm_caty"] = "A03.06" // 入院科别 必填
- inputData["refldept_dept"] = "" // 转科科别 必填
- inputData["dscg_time"] = struct4101.SetlBegnDate // 出院时间 必填
- inputData["dscg_caty"] = "A03.06" // 出院科别 必填
- inputData["caty"] = "A03.06" // 出院科别 必填
- 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"] = "1" // 出院 31 天内再住院计划标志 必填
- inputData["days_rinp_pup_31"] = "1" // 出院 31 天内再住院目的 必填
- inputData["chfpdr_name"] = struct4101.DoctorName // 主诊医师姓名 必填
- inputData["chfpdr_code"] = struct4101.DoctorCode // 主诊医师代码 必填
- inputData["setl_begn_date"] = struct4101.SetlBegnDate // 结算开始日期 必填
- inputData["setl_end_date"] = struct4101.SetlEndDate // 结算结束日期 必填
- inputData["psn_selfpay"] = struct4101.PsnSelfPay // 个人自付 必填
- inputData["psn_ownpay"] = struct4101.PsnOwnPay // 个人自费 必填
- inputData["acct_pay"] = struct4101.AcctPay // 个人账户支出 必填
- inputData["hi_paymtd"] = struct4101.HiPaymtd // 医保支付方式 必填
- inputData["hsorg"] = struct4101.Hsorg // 医保机构 必填
- inputData["hsorg_opter"] = struct4101.HsorgOpter // 医保机构经办人 必填
- inputData["medins_fill_dept"] = struct4101.MedinsFillDept // 医疗机构填报部门 必填
- inputData["medins_fill_psn"] = struct4101.MedinsFillPsn // 医疗机构填报人 必填
- inputData["psn_cashpay"] = struct4101.PsnCashpay // 医疗机构填报人 必填
- inputData["resp_nurs_code"] = "N440307016120" // 民族 必填
-
- 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"] = "慢性肾功能不全(血透治疗)" // 诊断名称 必填
- opspdiseinfotemp["diag_code"] = "N18.904" // 诊断代码 必填
- opspdiseinfotemp["oprn_oprt_name"] = "血液透析" // 手术操作名称 必填
- opspdiseinfotemp["oprn_oprt_code"] = "39.9500" // 手术操作代码 必填
- 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)
- }
-
- 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
- inputMessage["input"] = input //交易输入
-
- bytesData, err := json.Marshal(inputMessage)
- fmt.Println(string(bytesData))
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- reader := bytes.NewReader(bytesData)
-
- gdyb_url := beego.AppConfig.String("gdyb_url")
- gdyb_paasid := beego.AppConfig.String("gdyb_paasid")
- //url := gdyb_url + "4101"
-
- var url string
- if mdtrtarea_admvs == "450721" || mdtrtarea_admvs == "450127" {
- url = gdyb_url
-
- //inputMessage = SetInputMessage1111(nonce, timestamp, org_name, admin_user_id, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs,doctor)
- } else {
- //inputMessage = SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
- url = gdyb_url + "4101A"
-
- }
-
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/4101"
- request, err := http.NewRequest("POST", url, reader)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
-
- request.Header.Set("Content-Type", "application/json;charset=UTF-8")
- request.Header.Set("x-tif-paasid", gdyb_paasid)
- request.Header.Set("x-tif-signature", signature)
- request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
- request.Header.Set("x-tif-nonce", nonce)
-
- client := http.Client{}
- resp, err := client.Do(request)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- respBytes, err := ioutil.ReadAll(resp.Body)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- str := string(respBytes)
- fmt.Println(str)
- return str, string(bytesData)
- }
-
- func Gdyb4101fornm(struct4101 Struct4101, secret_key string, org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, org_id int64, admin_user_id int64) (string, string) {
- // 生成签名
- nonce := GetRandomString(32)
- timestamp := time.Now().Unix()
- signature := setSignature(timestamp, nonce, secret_key)
- inputMessage := make(map[string]interface{})
-
- //tempTime := time.Unix(timestamp, 0)
- //timeFormatOne := tempTime.Format("2006-01-02 15:04:05")
- // 生成输入报文
- if mdtrtarea_admvs == "450721" || mdtrtarea_admvs == "450127" {
-
- inputMessage = SetInputMessage1111(nonce, timestamp, org_name, admin_user_id, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, doctor)
- } else {
- inputMessage = SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
- }
- // 生成输入报文
- //inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
- input := make(map[string]interface{})
- inputData := make(map[string]interface{})
- if org_id == 10106 || org_id == 10215 || org_id == 10138 || org_id == 9504 {
- inputMessage["infno"] = "4101A" // 交易编码
-
- } else {
- 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"] = org_name // 定点医药机构名称 必填
- inputData["fixmedins_code"] = fixmedins_code // 定点医药机构编码 必填
- inputData["hi_setl_lv"] = "" // 医保结算等级
- inputData["hi_no"] = struct4101.PsnNo // 医保编号
- inputData["medcasno"] = struct4101.PsnNo // 病案号 必填
- inputData["dcla_time"] = year + "-" + month + "-" + day // 申报时间 必填
- inputData["psn_name"] = struct4101.PsnName // 人员姓名 必填
- inputData["gend"] = struct4101.Gend // 性别 必填
- inputData["brdy"] = struct4101.Brdy // 出生日期 必填
- inputData["age"] = struct4101.Age // 年龄 必填
- inputData["ntly"] = struct4101.Ntly // 国籍 必填
- inputData["nwb_age"] = "" // 年龄 必填
- inputData["naty"] = struct4101.Naty // 民族 必填
-
- //inputData["dscg_way"] = "9" // 民族 必填
-
- //inputData["resp_nurs_code"] = "N441623001432" // 民族 必填
-
- 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"] = "" // 住院医疗类型 必填
- inputData["adm_way"] = "" // 入院途径 必填
- inputData["trt_type"] = "10" // 治疗类别 必填
- inputData["adm_time"] = "" // 入院时间 必填
- inputData["adm_caty"] = "A03.06" // 入院科别 必填
- inputData["refldept_dept"] = "" // 转科科别 必填
- inputData["dscg_time"] = "" // 出院时间 必填
- inputData["dscg_caty"] = "A03.06" // 出院科别 必填
- inputData["caty"] = "A03.06" // 出院科别 必填
- 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"] = struct4101.DoctorName // 主诊医师姓名 必填
- inputData["chfpdr_code"] = struct4101.DoctorCode // 主诊医师代码 必填
- inputData["setl_begn_date"] = struct4101.SetlBegnDate // 结算开始日期 必填
- inputData["setl_end_date"] = struct4101.SetlEndDate // 结算结束日期 必填
- inputData["psn_selfpay"] = struct4101.PsnSelfPay // 个人自付 必填
- inputData["psn_ownpay"] = struct4101.PsnOwnPay // 个人自费 必填
- inputData["acct_pay"] = struct4101.AcctPay // 个人账户支出 必填
- inputData["hi_paymtd"] = struct4101.HiPaymtd // 医保支付方式 必填
- inputData["hsorg"] = struct4101.Hsorg // 医保机构 必填
- inputData["hsorg_opter"] = struct4101.HsorgOpter // 医保机构经办人 必填
- inputData["medins_fill_dept"] = struct4101.MedinsFillDept // 医疗机构填报部门 必填
- inputData["medins_fill_psn"] = struct4101.MedinsFillPsn // 医疗机构填报人 必填
- inputData["psn_cashpay"] = struct4101.PsnCashpay // 医疗机构填报人 必填
- inputData["dscg_way"] = "1" // 医疗机构填报人 必填
-
- 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"] = "慢性肾功能不全(血透治疗)" // 诊断名称 必填
- opspdiseinfotemp["diag_code"] = "N18.904" // 诊断代码 必填
- opspdiseinfotemp["oprn_oprt_name"] = "血液透析" // 手术操作名称 必填
- opspdiseinfotemp["oprn_oprt_code"] = "39.9500" // 手术操作代码 必填
- 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)
- }
-
- 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
- inputMessage["input"] = input //交易输入
-
- bytesData, err := json.Marshal(inputMessage)
- fmt.Println(string(bytesData))
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- reader := bytes.NewReader(bytesData)
-
- gdyb_url := beego.AppConfig.String("gdyb_url")
- gdyb_paasid := beego.AppConfig.String("gdyb_paasid")
- //url := gdyb_url + "4101"
-
- var url string
- if mdtrtarea_admvs == "450721" || mdtrtarea_admvs == "450127" {
- url = gdyb_url
-
- //inputMessage = SetInputMessage1111(nonce, timestamp, org_name, admin_user_id, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs,doctor)
- } else {
- //inputMessage = SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
- url = gdyb_url
-
- }
-
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/4101"
- request, err := http.NewRequest("POST", url, reader)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
-
- request.Header.Set("Content-Type", "application/json;charset=UTF-8")
- request.Header.Set("x-tif-paasid", gdyb_paasid)
- request.Header.Set("x-tif-signature", signature)
- request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
- request.Header.Set("x-tif-nonce", nonce)
-
- client := http.Client{}
- resp, err := client.Do(request)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- respBytes, err := ioutil.ReadAll(resp.Body)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- str := string(respBytes)
- fmt.Println(str)
- return str, string(bytesData)
- }
-
- func Gdyb4101For10106(struct4101 Struct4101, secret_key string, org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, org_id int64) (string, string) {
- // 生成签名
- nonce := GetRandomString(32)
- timestamp := time.Now().Unix()
- signature := setSignature(timestamp, nonce, secret_key)
-
- // 生成输入报文
- inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
- input := make(map[string]interface{})
- inputData := make(map[string]interface{})
- inputMessage["infno"] = "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"] = org_name // 定点医药机构名称 必填
- inputData["fixmedins_code"] = fixmedins_code // 定点医药机构编码 必填
- inputData["hi_setl_lv"] = "" // 医保结算等级
- inputData["hi_no"] = struct4101.PsnNo // 医保编号
- inputData["medcasno"] = struct4101.PsnNo // 病案号 必填
- inputData["dcla_time"] = year + "-" + month + "-" + day // 申报时间 必填
- inputData["psn_name"] = struct4101.PsnName // 人员姓名 必填
- inputData["gend"] = struct4101.Gend // 性别 必填
- inputData["brdy"] = struct4101.Brdy // 出生日期 必填
- inputData["age"] = struct4101.Age // 年龄 必填
- inputData["ntly"] = struct4101.Ntly // 国籍 必填
- inputData["nwb_age"] = "" // 年龄 必填
- inputData["naty"] = struct4101.Naty // 民族 必填
- inputData["patn_cert_type"] = struct4101.PatnCertType // 患者证件类别 必填
- inputData["certno"] = struct4101.Certno // 证件号码 必填
- inputData["prfs"] = struct4101.Prfs // 职业 必填
- inputData["curr_addr"] = "" // 现住址 必填
- inputData["emp_name"] = "" // 单位名称 必填
- inputData["emp_addr"] = "" // 单位地址 必填
- inputData["emp_tel"] = "" // 单位电话 必填
- inputData["poscode"] = "" // 邮编 必填
- inputData["coner_name"] = struct4101.ConerName // 联系人姓名 必填
- inputData["patn_rlts"] = struct4101.PatnRlts // 与患者关系 必填
- inputData["coner_addr"] = struct4101.ConerAddr // 联系人地址 必填
- inputData["coner_tel"] = struct4101.ConerTel // 联系人电话 必填
- inputData["hi_type"] = struct4101.HiType // 医保类型 必填
- inputData["insuplc"] = struct4101.Insuplc // 参保地 必填
- inputData["sp_psn_type"] = "" // 特殊人员类型 必填
- inputData["nwb_adm_type"] = "" // 新生儿入院类型 必填
- inputData["nwb_bir_wt"] = "" // 新生儿出生体重 必填
- inputData["nwb_adm_wt"] = "" // 新生儿入院体重 必填
- inputData["opsp_diag_caty"] = "" // 门诊慢特病诊断 必填
- inputData["opsp_mdtrt_date"] = "" // 门诊慢特病就诊日期 必填
- inputData["ipt_med_type"] = "" // 住院医疗类型 必填
- inputData["adm_way"] = "" // 入院途径 必填
- inputData["trt_type"] = "10" // 治疗类别 必填
- inputData["adm_time"] = struct4101.AdmTime // 入院时间 必填
- inputData["adm_caty"] = struct4101.AdmCaty // 入院科别 必填
- inputData["refldept_dept"] = "" // 转科科别 必填
- inputData["dscg_time"] = struct4101.AdmEndTime // 出院时间 必填
- inputData["dscg_caty"] = struct4101.DscgCaty // 出院科别 必填
- 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"] = struct4101.DoctorName // 主诊医师姓名 必填
- inputData["chfpdr_code"] = struct4101.DoctorCode // 主诊医师代码 必填
- inputData["setl_begn_date"] = struct4101.SetlBegnDate // 结算开始日期 必填
- inputData["setl_end_date"] = struct4101.SetlEndDate // 结算结束日期 必填
- inputData["psn_selfpay"] = struct4101.PsnSelfPay // 个人自付 必填
- inputData["psn_ownpay"] = struct4101.PsnOwnPay // 个人自费 必填
- inputData["acct_pay"] = struct4101.AcctPay // 个人账户支出 必填
- inputData["hi_paymtd"] = struct4101.HiPaymtd // 医保支付方式 必填
- inputData["hsorg"] = struct4101.Hsorg // 医保机构 必填
- inputData["hsorg_opter"] = struct4101.HsorgOpter // 医保机构经办人 必填
- inputData["medins_fill_dept"] = struct4101.MedinsFillDept // 医疗机构填报部门 必填
- inputData["medins_fill_psn"] = struct4101.MedinsFillPsn // 医疗机构填报人 必填
- inputData["psn_cashpay"] = struct4101.PsnCashpay // 医疗机构填报人 必填
-
- payinfo := make([]map[string]interface{}, 0) // 基金支付信息
- for _, item := range struct4101.CustomStruct {
- payinfotemp := make(map[string]interface{})
- if item.FundPayType == "310100" || item.FundPayType == "310200" || item.FundPayType == "320100" || item.FundPayType == "330100" || item.FundPayType == "340100" || item.FundPayType == "350100" || item.FundPayType == "370100" || item.FundPayType == "390100" || item.FundPayType == "610100" || item.FundPayType == "640100" || item.FundPayType == "620100" {
- payinfotemp["fund_pay_type"] = item.FundPayType // 基金支付类型 必填
- payinfotemp["fund_payamt"] = item.FundPayamt // 基金支付金额
- payinfo = append(payinfo, payinfotemp)
- }
- }
- opspdiseinfo := make([]map[string]interface{}, 0) // 门诊慢特病诊断信息
-
- opspdiseinfotemp := make(map[string]interface{})
- opspdiseinfotemp["diag_name"] = struct4101.Diseinfo[len(struct4101.Diseinfo)-1].DiagName // 诊断名称 必填
- opspdiseinfotemp["diag_code"] = struct4101.Diseinfo[len(struct4101.Diseinfo)-1].DiagCode // 诊断代码 必填
- opspdiseinfotemp["oprn_oprt_name"] = "血液透析" // 手术操作名称 必填
- opspdiseinfotemp["oprn_oprt_code"] = "39.9500" // 手术操作代码 必填
- opspdiseinfo = append(opspdiseinfo, opspdiseinfotemp)
-
- diseinfo := make([]map[string]interface{}, 0) // 住院诊断信息
- for _, item := range struct4101.Diseinfo {
- diseinfotemp := make(map[string]interface{})
- diseinfotemp["maindiag_flag"] = item.MaindiagFlag // 手术操作代码 必填
- diseinfotemp["diag_type"] = item.DiagType // 诊断类别 必填
- diseinfotemp["diag_code"] = item.DiagCode // 诊断代码 必填
- diseinfotemp["diag_name"] = item.DiagName // 诊断名称 必填
- diseinfotemp["adm_cond_type"] = "3" // 入院病情类型 必填
- diseinfo = append(diseinfo, diseinfotemp)
- }
-
- iteminfo := make([]map[string]interface{}, 0)
- for _, item := range struct4101.IteminfoStruct {
- iteminfotemp := make(map[string]interface{})
- iteminfotemp["med_chrgitm"] = item.MedChrgitm // 医疗收费项目 必填
- iteminfotemp["amt"] = item.Amt // 金额 必填
- iteminfotemp["claa_sumfee"] = item.ClaaSumfee // 甲类费用合计 必填
- iteminfotemp["clab_amt"] = item.ClabAmt // 乙类金额 必填
- iteminfotemp["fulamt_ownpay_amt"] = item.FulamtOwnpayAmt // 全自费金额 必填
- iteminfotemp["oth_amt"] = item.OthAmt // 其他金额 必填
- iteminfo = append(iteminfo, iteminfotemp)
- }
-
- oprninfo := make([]map[string]interface{}, 0) // 手术操作信息
- oprninfotemp := make(map[string]interface{})
- oprninfotemp["oprn_oprt_type"] = "" // 手术操作类别 必填
- oprninfotemp["oprn_oprt_name"] = "" // 手术操作名称 必填
- oprninfotemp["oprn_oprt_code"] = "" // 手术操作代码 必填
- oprninfotemp["oprn_oprt_date"] = "" // 手术操作日期 必填
- oprninfotemp["anst_way"] = "" // 麻醉方式 必填
- oprninfotemp["oper_dr_name"] = "" // 术者医师姓名 必填
- oprninfotemp["oper_dr_code"] = "" // 术者医师代码 必填
- oprninfotemp["anst_dr_name"] = "" // 麻醉医师姓名 必填
- oprninfotemp["anst_dr_code"] = "" // 麻醉医师代码 必填
- oprninfo = append(oprninfo, oprninfotemp)
-
- icuinfo := make([]map[string]interface{}, 0) // 重症监护信息
- icuinfotemp := make(map[string]interface{})
- icuinfotemp["scs_cutd_ward_type"] = "" // 重症监护病房类型 必填
- icuinfotemp["scs_cutd_inpool_time"] = "" // 重症监护进入时间 必填
- icuinfotemp["scs_cutd_exit_time"] = "" // 重症监护退出时间 必填
- icuinfotemp["scs_cutd_sum_dura"] = "" // 重症监护合计时长 必填
- icuinfo = append(icuinfo, icuinfotemp)
-
- input["setlinfo"] = inputData
- input["payinfo"] = payinfo
- input["opspdiseinfo"] = opspdiseinfo
- input["diseinfo"] = diseinfo
- input["iteminfo"] = iteminfo
- inputMessage["input"] = input //交易输入
-
- bytesData, err := json.Marshal(inputMessage)
- fmt.Println(string(bytesData))
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- reader := bytes.NewReader(bytesData)
-
- gdyb_url := beego.AppConfig.String("gdyb_url")
- gdyb_paasid := beego.AppConfig.String("gdyb_paasid")
- //url := gdyb_url + "4101"
-
- var url string
- if fixmedins_code == "H15049901371" || mdtrtarea_admvs == "450721" || mdtrtarea_admvs == "450127" {
- url = gdyb_url
- } else {
-
- url = gdyb_url + "4101A"
-
- }
-
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/4101"
- request, err := http.NewRequest("POST", url, reader)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
-
- request.Header.Set("Content-Type", "application/json;charset=UTF-8")
- request.Header.Set("x-tif-paasid", gdyb_paasid)
- request.Header.Set("x-tif-signature", signature)
- request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
- request.Header.Set("x-tif-nonce", nonce)
-
- client := http.Client{}
- resp, err := client.Do(request)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- respBytes, err := ioutil.ReadAll(resp.Body)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- str := string(respBytes)
- fmt.Println(str)
- return str, string(bytesData)
- }
-
- func Gdyb4101For10138(struct4101 Struct4101, secret_key string, org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, org_id int64) (string, string) {
- // 生成签名
- nonce := GetRandomString(32)
- timestamp := time.Now().Unix()
- signature := setSignature(timestamp, nonce, secret_key)
-
- // 生成输入报文
- inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
- input := make(map[string]interface{})
- inputData := make(map[string]interface{})
- inputMessage["infno"] = "4101A" // 交易编码
-
- year := time.Now().Format("2006")
- month := time.Now().Format("01")
- day := time.Now().Format("02")
- inputData["psn_no"] = struct4101.PsnNo // 结算 ID 必填
- inputData["mdtrt_id"] = struct4101.MdtrtId // 就诊 ID 必填(来自2201接口返回)
- inputData["setl_id"] = struct4101.SetlId // 结算 ID 必填
- inputData["hi_no"] = struct4101.PsnNo // 医保编号
- inputData["medcasno"] = struct4101.PsnNo // 病案号 必填
- inputData["dcla_time"] = year + "-" + month + "-" + day // 申报时间 必填
- inputData["ntly"] = struct4101.Ntly // 国籍 必填
- inputData["prfs"] = struct4101.Prfs // 职业 必填
- inputData["curr_addr"] = struct4101.CurAddr // 现住址 必填
- inputData["emp_name"] = "" // 单位名称 必填
- inputData["emp_addr"] = "" // 单位地址 必填
- inputData["emp_tel"] = ""
- inputData["poscode"] = "" // 邮编 必填
- inputData["coner_name"] = "" // 联系人姓名 必填
- inputData["patn_rlts"] = "" // 与患者关系 必填
- inputData["coner_addr"] = "" // 联系人地址 必填
- inputData["coner_tel"] = ""
-
- inputData["nwb_adm_type"] = "" // 新生儿入院类型 必填
- inputData["nwb_bir_wt"] = "" // 新生儿出生体重 必填
- inputData["nwb_adm_wt"] = "" // 新生儿入院体重 必填
-
- inputData["mul_nwb_bir_wt"] = "" // 新生儿入院体重 必填
- inputData["mul_nwb_adm_wt"] = "" // 新生儿入院体重 必填
-
- inputData["opsp_diag_caty"] = "" // 门诊慢特病诊断 必填
- inputData["opsp_mdtrt_date"] = "" // 门诊慢特病就诊日期 必填
-
- inputData["adm_way"] = "" // 入院途径 必填
- inputData["trt_type"] = "" // 治疗类别 必填
- inputData["adm_time"] = "" // 入院时间 必填
-
- inputData["refldept_dept"] = "" // 转科科别 必填
- inputData["dscg_time"] = "" // 出院时间 必填
- inputData["dscg_caty"] = "" // 出院科别 必填
-
- inputData["otp_wm_dise"] = "" // 门(急) 诊西医诊断 必填
- inputData["wm_dise_code"] = "" // 门(急) 诊中医诊断 必填
- inputData["otp_tcm_dise"] = "" // 西医诊断疾病代码 必填
- inputData["tcm_dise_code"] = "" // 中医诊断代码 必填
-
- inputData["vent_used_dura"] = "" // 呼吸机使用时长 必填
- inputData["pwcry_bfadm_coma_dura"] = "" // 颅脑损伤患者入院前昏迷时长 必填
- inputData["pwcry_afadm_coma_dura"] = "" // 颅脑损伤患者入院后昏迷时长 必填
-
- 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["hi_paymtd"] = "1" // 业务流水号 必填
-
- inputData["days_rinp_flag_31"] = "" // 出院 31 天内再住院计划标志 必填
- inputData["days_rinp_pup_31"] = "" // 出院 31 天内再住院目的 必填
- //inputData["chfpdr_name"] = struct4101.DoctorName // 主诊医师姓名 必填
- //inputData["chfpdr_code"] = struct4101.DoctorCode // 主诊医师代码 必填
- inputData["setl_begn_date"] = struct4101.SetlBegnDate // 结算开始日期 必填
- inputData["setl_end_date"] = struct4101.SetlEndDate // 结算结束日期 必填
- inputData["medins_fill_dept"] = struct4101.MedinsFillDept // 医疗机构填报部门 必填
- inputData["medins_fill_psn"] = struct4101.MedinsFillPsn // 医疗机构填报人 必填
-
- //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"] = "慢性肾脏病5期" // 诊断名称 必填
- opspdiseinfotemp["diag_code"] = "N18.500" // 诊断代码 必填
- opspdiseinfotemp["oprn_oprt_name"] = "血液透析" // 手术操作名称 必填
- opspdiseinfotemp["oprn_oprt_code"] = "39.9500" // 手术操作代码 必填
- 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["opspdiseinfo"] = opspdiseinfo
- //input["diseinfo"] = diseinfo
- //input["oprninfo"] = payinfo
- //input["icuinfo"] = payinfo
- //input["bldinfo"] = payinfo
- inputMessage["input"] = input //交易输入
-
- bytesData, err := json.Marshal(inputMessage)
- fmt.Println(string(bytesData))
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- reader := bytes.NewReader(bytesData)
-
- gdyb_url := beego.AppConfig.String("gdyb_url")
- gdyb_paasid := beego.AppConfig.String("gdyb_paasid")
- //url := gdyb_url + "4101"
-
- var url string
- if fixmedins_code == "H15049901371" || mdtrtarea_admvs == "450721" || mdtrtarea_admvs == "450127" {
- url = gdyb_url
- } else {
-
- url = gdyb_url + "4101A"
-
- }
-
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/4101"
- request, err := http.NewRequest("POST", url, reader)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
-
- request.Header.Set("Content-Type", "application/json;charset=UTF-8")
- request.Header.Set("x-tif-paasid", gdyb_paasid)
- request.Header.Set("x-tif-signature", signature)
- request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
- request.Header.Set("x-tif-nonce", nonce)
-
- client := http.Client{}
- resp, err := client.Do(request)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- respBytes, err := ioutil.ReadAll(resp.Body)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- str := string(respBytes)
- fmt.Println(str)
- return str, string(bytesData)
- }
-
- //func Gdyb7101(psnNo string, insutype string, org_name string, doctor string, fixmedins_code string, doctor_id string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, sick_name string, sick_code string) string {
- // // 生成签名
- // nonce := GetRandomString(32)
- // timestamp := time.Now().Unix()
- // signature := setSignature(timestamp, nonce, secret_key)
- // tempTime := time.Unix(timestamp, 0)
- // //timeFormatOne := tempTime.Format("2006-01-02 15:04:05")
- //
- // timeFormatTwo := tempTime.Format("2006-01-02")
- //
- // t := time.Now()
- // last := time.Date(t.Year(), time.December, 31, 0, 0, 0, 0, time.UTC)
- // tm := time.Unix(last.Unix(), 0)
- //
- // // 生成输入报文
- // inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
- // input := make(map[string]interface{})
- // inputData := make(map[string]interface{})
- //
- // inputData2 := make(map[string]interface{})
- //
- // inputMessage["infno"] = "7101" // 交易编码
- // inputData["hosp_rxno"] = psnNo // 人员编号 (来自1101接口返回)
- // inputData["init_rxno"] = insutype // 险种类型(来自1101接口返回)
- // inputData["rx_type_code"] = sick_code // 险种类型(来自1101接口返回)
- // inputData["prsc_time"] = sick_name // 险种类型(来自1101接口返回)
- // inputData["rx_drug_nums"] = insuplc_admdvs // 险种类型(来自1101接口返回)
- // inputData["rx_way_codg"] = fixmedins_code // 险种类型(来自1101接口返回)
- // inputData["rx_way_name"] = org_name // 险种类型(来自1101接口返回)
- // inputData["rx_freq_codg"] = timeFormatTwo // 险种类型(来自1101接口返回)
- // inputData["rx_freq_name"] = doctor_id // 开始时间
- // inputData["rx_dosunt"] = doctor // 开始时间
- // inputData["rx_doscnt"] = timeFormatTwo // 医师编码
- // inputData["rx_drord_dscr"] = "" // 医师编码
- // inputData["valid_days"] = "" // 医师编码
- // inputData["valid_end_time"] = tm.Format("2006-01-02") // 医师编码
- // inputData["rept_flag"] = tm.Format("2006-01-02") // 医师编码
- // inputData["max_rept_cnt"] = tm.Format("2006-01-02") // 医师编码
- // inputData["reptd_cnt"] = tm.Format("2006-01-02") // 医师编码
- // inputData["min_inrv_days"] = tm.Format("2006-01-02") // 医师编码
- // inputData["dr_sign_info"] = tm.Format("2006-01-02") // 医师编码
- // inputData["phar_sign_info"] = tm.Format("2006-01-02") // 医师编码
- // inputData["fixmedins_sign_info"] = tm.Format("2006-01-02") // 医师编码
- // inputData["rx_cotn_flag"] = tm.Format("2006-01-02") // 医师编码
- // inputData["rx_file"] = tm.Format("2006-01-02") // 医师编码
- // input["data"] = inputData
- //
- //
- // inputData2["med_list_codg"] = psnNo // 人员编号 (来自1101接口返回)
- // inputData2["fixmedins_hilist_id"] = insutype // 险种类型(来自1101接口返回)
- // inputData["hosp_prep_flag"] = sick_code // 险种类型(来自1101接口返回)
- // inputData["rx_item_type_code"] = sick_name // 险种类型(来自1101接口返回)
- // inputData["rx_item_type_name"] = insuplc_admdvs // 险种类型(来自1101接口返回)
- // inputData["tcmdrug_type_name"] = fixmedins_code // 险种类型(来自1101接口返回)
- // inputData["tcmdrug_type_code"] = org_name // 险种类型(来自1101接口返回)
- // inputData["tcmherb_foote"] = timeFormatTwo // 险种类型(来自1101接口返回)
- // inputData["medn_type_code"] = doctor_id // 开始时间
- // inputData["medn_type_name"] = doctor // 开始时间
- // inputData["main_medc_flag"] = timeFormatTwo // 医师编码
- // inputData["urgt_flag"] = "" // 医师编码
- // inputData["bas_medn_flag"] = "" // 医师编码
- // inputData["imp_drug_flag"] = tm.Format("2006-01-02") // 医师编码
- // inputData["prod_barc"] = tm.Format("2006-01-02") // 医师编码
- // inputData["drug_prodname"] = tm.Format("2006-01-02") // 医师编码
- //
- // inputData["genname_codg"] = tm.Format("2006-01-02") // 医师编码
- // inputData["drug_genname"] = tm.Format("2006-01-02") // 医师编码
- // inputData["chemname"] = tm.Format("2006-01-02") // 医师编码
- //
- // inputData["drugstdcode"] = tm.Format("2006-01-02") // 医师编码
- // inputData["drug_dosform"] = tm.Format("2006-01-02") // 医师编码
- //
- //
- // inputData["drug_spec"] = tm.Format("2006-01-02") // 医师编码
- // inputData["prdr_name"] = tm.Format("2006-01-02") // 医师编码
- //
- //
- // inputData["drug_pric"] = tm.Format("2006-01-02") // 医师编码
- // inputData["drug_cnt"] = tm.Format("2006-01-02") // 医师编码
- // inputData["drug_cnt_unit"] = tm.Format("2006-01-02") // 医师编码
- // inputData["drug_sumamt"] = tm.Format("2006-01-02") // 医师编码
- // inputData["medc_way_codg"] = tm.Format("2006-01-02") // 医师编码
- // inputData["medc_way_dscr"] = tm.Format("2006-01-02") // 医师编码
- // inputData["medc_starttime"] = tm.Format("2006-01-02") // 医师编码
- //
- // inputData["medc_endtime"] = tm.Format("2006-01-02") // 医师编码
- //
- //
- // inputData["medc_days"] = tm.Format("2006-01-02") // 医师编码
- // inputData["drug_dosunt"] = tm.Format("2006-01-02") // 医师编码
- // inputData["sin_doscnt"] = tm.Format("2006-01-02") // 医师编码
- // inputData["sin_dosunt"] = tm.Format("2006-01-02") // 医师编码
- // inputData["used_frqu_codg"] = tm.Format("2006-01-02") // 医师编码
- //
- //
- // inputData["used_frqu_name"] = tm.Format("2006-01-02") // 医师编码
- // inputData["drug_totlnt"] = tm.Format("2006-01-02") // 医师编码
- //
- // inputData["drug_totlnt_emp"] = tm.Format("2006-01-02") // 医师编码
- // inputData["dise_codg"] = tm.Format("2006-01-02") // 医师编码
- // inputData["drug_res"] = tm.Format("2006-01-02") // 医师编码
- // inputData["drug_limit"] = tm.Format("2006-01-02") // 医师编码
- //
- //
- //
- //
- //
- //
- //
- //
- //
- // input["rxdrugdetail"] = inputData2
- //
- //
- //
- //
- // inputMessage["input"] = input //交易输入
- // bytesData, err := json.Marshal(inputMessage)
- // fmt.Println(string(bytesData))
- // if err != nil {
- // fmt.Println(err.Error())
- // return err.Error()
- // }
- // reader := bytes.NewReader(bytesData)
- // //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/2503"
- // //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/2503"
- // gdyb_url := beego.AppConfig.String("gdyb_url")
- // gdyb_paasid := beego.AppConfig.String("gdyb_paasid")
- // //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/1101"
- // url := gdyb_url + "2503"
- //
- // request, err := http.NewRequest("POST", url, reader)
- // if err != nil {
- // fmt.Println(err.Error())
- // return err.Error()
- // }
- //
- // request.Header.Set("Content-Type", "application/json;charset=UTF-8")
- // request.Header.Set("x-tif-paasid", gdyb_paasid)
- // request.Header.Set("x-tif-signature", signature)
- // request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
- // request.Header.Set("x-tif-nonce", nonce)
- //
- // client := http.Client{}
- // resp, err := client.Do(request)
- // if err != nil {
- // fmt.Println(err.Error())
- // return err.Error()
- // }
- // respBytes, err := ioutil.ReadAll(resp.Body)
- // if err != nil {
- // fmt.Println(err.Error())
- // return err.Error()
- // }
- // str := string(respBytes)
- // fmt.Println(str)
- // return str
- //}
-
- // 生成签名
- func setSignature(timestamp int64, nonce string, secret_key string) string {
- fmt.Println(timestamp)
- fmt.Println(nonce)
- fmt.Println(secret_key)
- fmt.Println(strconv.FormatInt(timestamp, 10))
- fmt.Println(time.Now().UnixNano() / 1e6)
-
- str := strconv.FormatInt(timestamp, 10) + secret_key + nonce + strconv.FormatInt(timestamp, 10)
- hash := sha256.New()
- //输入数据
- hash.Write([]byte(str))
- //计算哈希值
- bytes := hash.Sum(nil)
- //将字符串编码为16进制格式,返回字符串
- hashCode := hex.EncodeToString(bytes)
- //返回哈希值
- return hashCode
- }
-
- const charset = "abcdefghijklmnopqrstuvwxyz" +
- "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
-
- var seededRand *rand.Rand = rand.New(
- rand.NewSource(time.Now().UnixNano()))
-
- // 生成随机字符串
- func GetRandomString(l int) string {
-
- //str := "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
- //bytes := []byte(str)
- //result := []byte{}
- //r := rand.New(rand.NewSource(time.Now().UnixNano()))
- //for i := 0; i < l; i++ {
- // result = append(result, bytes[r.Intn(len(bytes))])
- //}
- return String(32)
- }
- func StringWithCharset(length int, charset string) string {
- b := make([]byte, length)
- for i := range b {
- b[i] = charset[seededRand.Intn(len(charset))]
- }
- return string(b)
- }
-
- func String(length int) string {
- return StringWithCharset(length, charset)
- }
-
- // 生成基础报文
- func SetInputMessage1111(nonce string, timestamp int64, org_name string, doctor int64, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, op_name 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"] = "" // 设备编号
- inputMessage["dev_safe_info"] = "" // 设备安全信息
- inputMessage["cainfo"] = "" // 数字签名信息
- inputMessage["signtype"] = "MOCK" // 签名类型
- inputMessage["infver"] = "V1.0" // 接收方系统代码
- inputMessage["opter_type"] = "1" // 经办人类别
- inputMessage["opter"] = doctor // 经办人
- inputMessage["opter_name"] = op_name // 经办人姓名
- inputMessage["inf_time"] = timeFormatOne // 交易时间
- inputMessage["fixmedins_code"] = fixmedins_code // 定点医药机构编号
- inputMessage["fixmedins_name"] = org_name //定点医药机构名称
- if mdtrtarea_admvs == "440100" {
- inputMessage["sign_no"] = GetSignInInfo(fixmedins_code) //交易签到流水号
- } else {
- inputMessage["sign_no"] = GetSignInInfo(fixmedins_code) //交易签到流水号 //交易签到流水号
- }
- return inputMessage
- }
-
- func SetInputMessage(nonce string, timestamp int64, org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs 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"] = "" // 设备编号
- inputMessage["dev_safe_info"] = "" // 设备安全信息
- inputMessage["cainfo"] = "" // 数字签名信息
- inputMessage["signtype"] = "MOCK" // 签名类型
- 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["sign_no"] = "489925883" //交易签到流水号
-
- //定点医药机构名称
- //if mdtrtarea_admvs == "440100" {
- // inputMessage["sign_no"] = GetSignInInfo(fixmedins_code) //交易签到流水号
- //} else {
- // inputMessage["sign_no"] = GetSignInInfo(fixmedins_code) //交易签到流水号 //交易签到流水号
- //}
- return inputMessage
- }
-
- func SetInputMessagenosign(nonce string, timestamp int64, org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs 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"] = "" // 设备编号
- inputMessage["dev_safe_info"] = "" // 设备安全信息
- inputMessage["cainfo"] = "" // 数字签名信息
- inputMessage["signtype"] = "MOCK" // 签名类型
- 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 //定点医药机构名称
- if mdtrtarea_admvs == "440100" {
- inputMessage["sign_no"] = GetSignInInfo(fixmedins_code) //交易签到流水号
- } else {
- inputMessage["sign_no"] = ""
- }
- return inputMessage
- }
-
- //func GetSignInInfo(code string) string {
- // var sign models.HisSignIn
- // err = readDb.Model(&models.HisSignIn{}).Where("fixmedins_code = ? AND status = 1", code).Last(&sign).Error
- // return sign.SignNo
- //}
-
- func SetInputMessageThree(nonce string, timestamp int64, org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, msg_id 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)
-
- // 生成输入报文
- inputMessage := make(map[string]interface{})
- inputMessage["msgid"] = msg_id // 发送方报文 ID
- inputMessage["mdtrtarea_admvs"] = mdtrtarea_admvs // 就医地医保区划
- inputMessage["insuplc_admdvs"] = insuplc_admdvs // 参保地医保区划
- inputMessage["recer_sys_code"] = "1" // 接收方系统代码
- inputMessage["dev_no"] = "" // 设备编号
- inputMessage["dev_safe_info"] = "" // 设备安全信息
- inputMessage["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 //定点医药机构名称
- if mdtrtarea_admvs == "440100" {
- inputMessage["sign_no"] = GetSignInInfo(fixmedins_code) //交易签到流水号
- } else {
- inputMessage["sign_no"] = "" //交易签到流水号
- }
- return inputMessage
- }
-
- func SetInputMessageTwo(nonce string, timestamp int64, org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, sign_no 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"] = "" // 设备编号
- inputMessage["dev_safe_info"] = "" // 设备安全信息
- inputMessage["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 //定点医药机构名称
- if mdtrtarea_admvs == "440100" {
- inputMessage["sign_no"] = GetSignInInfo(fixmedins_code) //交易签到流水号
- } else {
- inputMessage["sign_no"] = sign_no //交易签到流水号
- }
- return inputMessage
- }
-
- func postFile(filename string, target_url string) (*http.Response, error) {
- body_buf := bytes.NewBufferString("")
- body_writer := multipart.NewWriter(body_buf)
-
- // use the body_writer to write the Part headers to the buffer
- _, err := body_writer.CreateFormFile("userfile", filename)
- if err != nil {
- fmt.Println("error writing to buffer")
- return nil, err
- }
-
- // the file data will be the second part of the body
- fh, err := os.Open(filename)
- if err != nil {
- fmt.Println("error opening file")
- return nil, err
- }
- // need to know the boundary to properly close the part myself.
- boundary := body_writer.Boundary()
- //close_string := fmt.Sprintf("\r\n--%s--\r\n", boundary)
- close_buf := bytes.NewBufferString(fmt.Sprintf("\r\n--%s--\r\n", boundary))
-
- // use multi-reader to defer the reading of the file data until
- // writing to the socket buffer.
- request_reader := io.MultiReader(body_buf, fh, close_buf)
- fi, err := fh.Stat()
- if err != nil {
- fmt.Printf("Error Stating file: %s", filename)
- return nil, err
- }
- req, err := http.NewRequest("POST", target_url, request_reader)
- if err != nil {
- return nil, err
- }
-
- // Set headers for multipart, and Content Length
- req.Header.Add("Content-Type", "multipart/form-data; boundary="+boundary)
- req.ContentLength = fi.Size() + int64(body_buf.Len()) + int64(close_buf.Len())
-
- return http.DefaultClient.Do(req)
- }
-
- //func Gdyb1201(psnNo string, org_name string, doctor string) string {
- // // 生成签名
- // nonce := GetRandomString(32)
- // timestamp := time.Now().Unix()
- // signature := setSignature(timestamp, nonce)
- //
- // // 生成输入报文
- // inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, "")
- // input := make(map[string]interface{})
- // inputData := make(map[string]interface{})
- // inputMessage["infno"] = "1201" // 交易编码
- // inputData["fixmedins_type"] = psnNo // 人员编号 (来自1101接口返回)
- // inputData["fixmedins_name"] = org_name // 人员编号 (来自1101接口返回)
- // inputData["fixmedins_code"] = "" // 人员编号 (来自1101接口返回)
- //
- // input["medinsinfo"] = inputData
- // inputMessage["input"] = input //交易输入
- //
- // bytesData, err := json.Marshal(inputMessage)
- // fmt.Println(string(bytesData))
- // if err != nil {
- // fmt.Println(err.Error())
- // return err.Error()
- // }
- // reader := bytes.NewReader(bytesData)
- //
- // url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/1201"
- // request, err := http.NewRequest("POST", url, reader)
- // if err != nil {
- // fmt.Println(err.Error())
- // return err.Error()
- // }
- //
- // request.Header.Set("Content-Type", "application/json;charset=UTF-8")
- // request.Header.Set("x-tif-paasid", "test_hosp")
- // request.Header.Set("x-tif-signature", signature)
- // request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
- // request.Header.Set("x-tif-nonce", nonce)
- //
- // client := http.Client{}
- // resp, err := client.Do(request)
- // if err != nil {
- // fmt.Println(err.Error())
- // return err.Error()
- // }
- // respBytes, err := ioutil.ReadAll(resp.Body)
- // if err != nil {
- // fmt.Println(err.Error())
- // return err.Error()
- // }
- // str := string(respBytes)
- // fmt.Println(str)
- // return str
- //}
-
- func newfileUploadRequest(uri string, params map[string]string, paramName, path string) (*http.Request, error) {
- file, err := os.Open(path)
- if err != nil {
- return nil, err
- }
- defer file.Close()
-
- body := &bytes.Buffer{}
- writer := multipart.NewWriter(body)
- part, err := writer.CreateFormFile(paramName, filepath.Base(path))
- if err != nil {
- return nil, err
- }
- _, err = io.Copy(part, file)
-
- for key, val := range params {
- _ = writer.WriteField(key, val)
- }
- err = writer.Close()
- if err != nil {
- return nil, err
- }
-
- req, err := http.NewRequest("POST", uri, body)
- req.Header.Set("Content-Type", writer.FormDataContentType())
- return req, err
- }
-
- func CreateMedicalInsuranceCostCompareRecord(record *models.MedicalInsuranceCostCompare) error {
- err := writeDb.Save(&record).Error
- return err
- }
-
- //func Gdyb5203(certNo string, org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string) string {
- // // 生成签名
- // nonce := GetRandomString(32)
- // timestamp := time.Now().Unix()
- // signature := setSignature(timestamp, nonce, secret_key)
- //
- // // 生成输入报文
- // inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
- // input := make(map[string]interface{})
- // inputData := make(map[string]interface{})
- // inputMessage["infno"] = "5203" // 交易编码
- //
- // inputData["fixmedins_type"] = "1"
- // inputData["fixmedins_name"] = org_name
- // inputData["fixmedins_code"] = fixmedins_code
- // input["medinsinfo"] = inputData
- // inputMessage["input"] = input //交易输入
- //
- // bytesData, err := json.Marshal(inputMessage)
- // fmt.Println(string(bytesData))
- // if err != nil {
- // fmt.Println(err.Error())
- // return err.Error()
- // }
- // reader := bytes.NewReader(bytesData)
- // url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/1201"
- // //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/1201"
- // //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/1101"
- // request, err := http.NewRequest("POST", url, reader)
- // if err != nil {
- // fmt.Println(err.Error())
- // return err.Error()
- // }
- //
- // request.Header.Set("Content-Type", "application/json;charset=UTF-8")
- // request.Header.Set("x-tif-paasid", "sg03_prd")
- // request.Header.Set("x-tif-signature", signature)
- // request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
- // request.Header.Set("x-tif-nonce", nonce)
- //
- // client := http.Client{}
- // resp, err := client.Do(request)
- // if err != nil {
- // fmt.Println(err.Error())
- // return err.Error()
- // }
- // respBytes, err := ioutil.ReadAll(resp.Body)
- // if err != nil {
- // fmt.Println(err.Error())
- // return err.Error()
- // }
- // fmt.Println(string(respBytes))
- // str := string(respBytes)
- // return str
- //}
-
- func CreatePsnRecord(record *models.GdybPsnRecord) {
- writeDb.Save(&record)
- return
- }
-
- func GetPsnRecordById(id int64) (record models.GdybPsnRecord, err error) {
- err = readDb.Model(&models.GdybPsnRecord{}).Where("id = ?").First(&record).Error
- return
- }
-
- func CreatePsnNCDSRecord(record *models.GdybPsnNcdsRecord) {
- writeDb.Save(&record)
- return
- }
-
- func GetPsnNCDSRecordById(id int64) (record models.GdybPsnNcdsRecord, err error) {
- err = readDb.Model(&models.GdybPsnNcdsRecord{}).Where("id = ?", id).First(&record).Error
- return
- }
-
- func GetPatientsByIds(ids []string, current_org_id int64) (patients []*models.Patients, err error) {
- err = readDb.Model(&models.Patients{}).Where("id IN (?) AND user_org_id = ?", ids, current_org_id).Find(&patients).Error
- return
- }
-
- func Gdyb2601(psnNo string, omsgid string, oinfno string, org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string) string {
- // 生成签名
- nonce := GetRandomString(32)
- timestamp := time.Now().Unix()
- signature := setSignature(timestamp, nonce, secret_key)
-
- // 生成输入报文
- inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
- input := make(map[string]interface{})
- inputData := make(map[string]interface{})
- inputMessage["infno"] = "2601" // 交易编码
- inputData["psn_no"] = psnNo
- inputData["omsgid"] = omsgid
- inputData["oinfno"] = oinfno
-
- input["data"] = inputData
- inputMessage["input"] = input //交易输入
- bytesData, err := json.Marshal(inputMessage)
- fmt.Println(string(bytesData))
- if err != nil {
- fmt.Println(err.Error())
- return err.Error()
- }
- reader := bytes.NewReader(bytesData)
- gdyb_url := beego.AppConfig.String("gdyb_url")
- gdyb_paasid := beego.AppConfig.String("gdyb_paasid")
- url := gdyb_url + "2601"
- request, err := http.NewRequest("POST", url, reader)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error()
- }
- request.Header.Set("Content-Type", "application/json;charset=UTF-8")
- request.Header.Set("x-tif-paasid", gdyb_paasid)
- request.Header.Set("x-tif-signature", signature)
- request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
- request.Header.Set("x-tif-nonce", nonce)
-
- client := http.Client{}
- resp, err := client.Do(request)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error()
- }
- respBytes, err := ioutil.ReadAll(resp.Body)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error()
- }
- str := string(respBytes)
- fmt.Println(str)
- return str
- }
-
- // 人员信息版本3
- func Gdyb1101B(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, name string, cardNumber string, admin_user_id int64) string {
- //生成签名
- nonce := GetRandomString(32)
- timestamp := time.Now().Unix()
- signature := setSignature(timestamp, nonce, secret_key)
- //生成输入报文
- //inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
- inputMessage := make(map[string]interface{})
-
- //生成输入报文
- if mdtrtarea_admvs == "450721" || mdtrtarea_admvs == "450127" {
-
- inputMessage = SetInputMessage1111(nonce, timestamp, org_name, admin_user_id, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, doctor)
-
- } else {
- inputMessage = SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
-
- }
- input := make(map[string]interface{})
- inputData := make(map[string]interface{})
- inputMessage["infno"] = "1101" // 交易编码
-
- if certificates == 3 {
- inputData["mdtrt_cert_type"] = "99" // 就诊凭证类型
- inputData["certno"] = "01836483" // 证件号码
- inputData["psn_cert_type"] = "01" // 人员证件类型
- inputData["mdtrt_cert_no"] = "01836483" // 就诊凭证编号
-
- } else {
- if certificates == 1 {
- 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"] = cardNumber // 就诊凭证编号
-
- } else {
- inputData["mdtrt_cert_type"] = "02" // 就诊凭证类型
- inputData["card_sn"] = "" // 卡识别码
- inputData["certno"] = certNo // 证件号码
- inputData["psn_cert_type"] = "01" // 人员证件类型
- inputData["mdtrt_cert_no"] = certNo // 就诊凭证编号
-
- }
-
- } else if certificates == 6 {
- inputData["mdtrt_cert_type"] = "03" // 就诊凭证类型
- inputData["card_sn"] = "" // 卡识别码
- inputData["certno"] = certNo // 证件号码
- inputData["psn_cert_type"] = "17" // 人员证件类型
- inputData["mdtrt_cert_no"] = certNo // 就诊凭证编号
-
- }
-
- }
-
- inputData["begntime"] = "" // 开始时间
- inputData["psn_name"] = name // 人员姓名
- input["data"] = inputData
- inputMessage["input"] = input //交易输入
-
- bytesData, err := json.Marshal(inputMessage)
- fmt.Println(string(bytesData))
- if err != nil {
- fmt.Println(err.Error())
- return err.Error()
- }
- reader := bytes.NewReader(bytesData)
- gdyb_url := beego.AppConfig.String("gdyb_url")
- gdyb_paasid := beego.AppConfig.String("gdyb_paasid")
-
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/1101"
- //url := gdyb_url + "1101"
- var url string
- if fixmedins_code == "H15049901371" || mdtrtarea_admvs == "450721" || mdtrtarea_admvs == "450127" {
- url = gdyb_url
- } else {
- url = gdyb_url + "1101"
- }
-
- fmt.Println(url)
- fmt.Println(gdyb_paasid)
- fmt.Println(secret_key)
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/1101"
- request, err := http.NewRequest("POST", url, reader)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error()
- }
-
- request.Header.Set("Content-Type", "application/json;charset=UTF-8")
- request.Header.Set("x-tif-paasid", gdyb_paasid)
- request.Header.Set("x-tif-signature", signature)
- request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
- request.Header.Set("x-tif-nonce", nonce)
-
- client := http.Client{}
- resp, err := client.Do(request)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error()
- }
- respBytes, err := ioutil.ReadAll(resp.Body)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error()
- }
- fmt.Println(string(respBytes))
- str := string(respBytes)
- return str
- }
-
- func Gdyb1101d(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, name string, token string, admin_user_id int64) string {
- //生成签名
- nonce := GetRandomString(32)
- timestamp := time.Now().Unix()
- signature := setSignature(timestamp, nonce, secret_key)
- inputMessage := make(map[string]interface{})
-
- //生成输入报文
- if mdtrtarea_admvs == "450721" || mdtrtarea_admvs == "450127" {
-
- inputMessage = SetInputMessage1111(nonce, timestamp, org_name, admin_user_id, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, doctor)
-
- } else {
- inputMessage = SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
-
- }
- //inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
- input := make(map[string]interface{})
- inputData := make(map[string]interface{})
- inputMessage["infno"] = "1101" // 交易编码
-
- if certificates == 3 {
- inputData["mdtrt_cert_type"] = "99" // 就诊凭证类型
- inputData["certno"] = "01836483" // 证件号码
- inputData["psn_cert_type"] = "01" // 人员证件类型
- inputData["mdtrt_cert_no"] = "01836483" // 就诊凭证编号
-
- } else {
- if certificates == 1 {
- 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 if certificates == 6 {
- inputData["mdtrt_cert_type"] = "03" // 就诊凭证类型
- inputData["card_sn"] = "" // 卡识别码
- inputData["certno"] = certNo // 证件号码
- inputData["psn_cert_type"] = "17" // 人员证件类型
- inputData["mdtrt_cert_no"] = certNo // 就诊凭证编号
-
- }
-
- }
-
- inputData["begntime"] = "" // 开始时间
- inputData["psn_name"] = name // 人员姓名
- input["data"] = inputData
- inputMessage["input"] = input //交易输入
-
- bytesData, err := json.Marshal(inputMessage)
- fmt.Println(string(bytesData))
- if err != nil {
- fmt.Println(err.Error())
- return err.Error()
- }
- reader := bytes.NewReader(bytesData)
- gdyb_url := beego.AppConfig.String("gdyb_url")
- gdyb_paasid := beego.AppConfig.String("gdyb_paasid")
-
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/1101"
- //url := gdyb_url + "1101"
- var url string
- if fixmedins_code == "H15049901371" || mdtrtarea_admvs == "450721" || mdtrtarea_admvs == "450127" {
- url = gdyb_url
- } else {
- url = gdyb_url + "1101"
- }
-
- fmt.Println(url)
- fmt.Println(gdyb_paasid)
- fmt.Println(secret_key)
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/1101"
- request, err := http.NewRequest("POST", url, reader)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error()
- }
-
- request.Header.Set("Content-Type", "application/json;charset=UTF-8")
- request.Header.Set("x-tif-paasid", gdyb_paasid)
- request.Header.Set("x-tif-signature", signature)
- request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
- request.Header.Set("x-tif-nonce", nonce)
-
- client := http.Client{}
- resp, err := client.Do(request)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error()
- }
- respBytes, err := ioutil.ReadAll(resp.Body)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error()
- }
- fmt.Println(string(respBytes))
- str := string(respBytes)
- return str
- }
-
- func Gdyb1101f(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, name string, cardNumber string) string {
- //生成签名
- nonce := GetRandomString(32)
- timestamp := time.Now().Unix()
- signature := setSignature(timestamp, nonce, secret_key)
- //生成输入报文
- inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
- input := make(map[string]interface{})
- inputData := make(map[string]interface{})
- inputMessage["infno"] = "1101" // 交易编码
-
- if certificates == 3 {
- inputData["mdtrt_cert_type"] = "99" // 就诊凭证类型
- inputData["certno"] = "01836483" // 证件号码
- inputData["psn_cert_type"] = "01" // 人员证件类型
- inputData["mdtrt_cert_no"] = "01836483" // 就诊凭证编号
-
- } else {
- if certificates == 1 {
- if id_card_type == 1 {
- inputData["mdtrt_cert_type"] = "03" // 就诊凭证类型
- inputData["card_sn"] = "" // 卡识别码
- inputData["certno"] = certNo // 证件号码
- inputData["psn_cert_type"] = "01" // 人员证件类型
- inputData["mdtrt_cert_no"] = certNo // 就诊凭证编号
-
- } else {
- inputData["mdtrt_cert_type"] = "02" // 就诊凭证类型
- inputData["card_sn"] = "" // 卡识别码
- inputData["certno"] = certNo // 证件号码
- inputData["psn_cert_type"] = "" // 人员证件类型
- inputData["mdtrt_cert_no"] = certNo // 就诊凭证编号
-
- }
-
- } else if certificates == 6 {
- inputData["mdtrt_cert_type"] = "99" // 就诊凭证类型
- inputData["card_sn"] = "" // 卡识别码
- inputData["certno"] = certNo // 证件号码
- inputData["psn_cert_type"] = "" // 人员证件类型
- inputData["mdtrt_cert_no"] = certNo // 就诊凭证编号
-
- }
-
- }
-
- inputData["begntime"] = "" // 开始时间
- inputData["psn_name"] = "" // 人员姓名
- input["data"] = inputData
- inputMessage["input"] = input //交易输入
-
- bytesData, err := json.Marshal(inputMessage)
- fmt.Println(string(bytesData))
- if err != nil {
- fmt.Println(err.Error())
- return err.Error()
- }
- reader := bytes.NewReader(bytesData)
- gdyb_url := beego.AppConfig.String("gdyb_url")
- gdyb_paasid := beego.AppConfig.String("gdyb_paasid")
-
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/1101"
- //url := gdyb_url + "1101"
- var url string
- if fixmedins_code == "H15049901371" || mdtrtarea_admvs == "450721" || mdtrtarea_admvs == "450127" {
- url = gdyb_url
- } else {
- url = gdyb_url + "1101"
- }
-
- fmt.Println(url)
- fmt.Println(gdyb_paasid)
- fmt.Println(secret_key)
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/1101"
- request, err := http.NewRequest("POST", url, reader)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error()
- }
-
- request.Header.Set("Content-Type", "application/json;charset=UTF-8")
- request.Header.Set("x-tif-paasid", gdyb_paasid)
- request.Header.Set("x-tif-signature", signature)
- request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
- request.Header.Set("x-tif-nonce", nonce)
-
- client := http.Client{}
- resp, err := client.Do(request)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error()
- }
- respBytes, err := ioutil.ReadAll(resp.Body)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error()
- }
- fmt.Println(string(respBytes))
- str := string(respBytes)
- return str
- }
-
- func Gdyb1101G(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, name string, cardNumber string) string {
- //生成签名
- nonce := GetRandomString(32)
- timestamp := time.Now().Unix()
- signature := setSignature(timestamp, nonce, secret_key)
- //生成输入报文
- inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
- input := make(map[string]interface{})
- inputData := make(map[string]interface{})
- inputMessage["infno"] = "1101" // 交易编码
-
- inputData["mdtrt_cert_type"] = "03" // 就诊凭证类型
- inputData["card_sn"] = card_sn // 卡识别码
- inputData["certno"] = certNo // 证件号码
- inputData["psn_cert_type"] = "01" // 人员证件类型
- inputData["mdtrt_cert_no"] = cardNumber // 就诊凭证编号
- inputData["begntime"] = "" // 开始时间
- inputData["psn_name"] = name // 人员姓名
- input["data"] = inputData
- inputMessage["input"] = input //交易输入
-
- bytesData, err := json.Marshal(inputMessage)
- fmt.Println(string(bytesData))
- if err != nil {
- fmt.Println(err.Error())
- return err.Error()
- }
- reader := bytes.NewReader(bytesData)
- gdyb_url := beego.AppConfig.String("gdyb_url")
- gdyb_paasid := beego.AppConfig.String("gdyb_paasid")
-
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/1101"
- //url := gdyb_url + "1101"
- var url string
- if fixmedins_code == "H15049901371" || mdtrtarea_admvs == "450721" || mdtrtarea_admvs == "450127" {
- url = gdyb_url
- } else {
- url = gdyb_url + "1101"
- }
-
- fmt.Println(url)
- fmt.Println(gdyb_paasid)
- fmt.Println(secret_key)
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/1101"
- request, err := http.NewRequest("POST", url, reader)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error()
- }
-
- request.Header.Set("Content-Type", "application/json;charset=UTF-8")
- request.Header.Set("x-tif-paasid", gdyb_paasid)
- request.Header.Set("x-tif-signature", signature)
- request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
- request.Header.Set("x-tif-nonce", nonce)
-
- client := http.Client{}
- resp, err := client.Do(request)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error()
- }
- respBytes, err := ioutil.ReadAll(resp.Body)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error()
- }
- fmt.Println(string(respBytes))
- str := string(respBytes)
- return str
- }
-
- func Gdyb1101ForEleCert1111(org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, token string, user_name string, idNo string, certificates int64) (string, string) {
- //生成签名
- nonce := GetRandomString(32)
- timestamp := time.Now().Unix()
- signature := setSignature(timestamp, nonce, secret_key)
- //生成输入报文
- inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
- input := make(map[string]interface{})
- inputData := make(map[string]interface{})
- inputMessage["infno"] = "1101" // 交易编码
-
- if certificates == 6 {
- inputData["mdtrt_cert_type"] = "99" // 就诊凭证类型
- inputData["psn_cert_type"] = "" // 人员证件类型
- } else {
- inputData["mdtrt_cert_type"] = "01" // 就诊凭证类型
- inputData["psn_cert_type"] = "01" // 人员证件类型
- }
-
- inputData["card_sn"] = "" // 卡识别码
- inputData["certno"] = idNo // 证件号码
-
- inputData["mdtrt_cert_no"] = token // 就诊凭证编号
- inputData["begntime"] = "" // 开始时间
- inputData["psn_name"] = user_name // 人员姓名
- input["data"] = inputData
- inputMessage["input"] = input //交易输入
-
- bytesData, err := json.Marshal(inputMessage)
- fmt.Println(string(bytesData))
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- reader := bytes.NewReader(bytesData)
- gdyb_url := beego.AppConfig.String("gdyb_url")
- gdyb_paasid := beego.AppConfig.String("gdyb_paasid")
-
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/1101"
- //url := gdyb_url + "1101"
- var url string
- if fixmedins_code == "H15049901371" || mdtrtarea_admvs == "450721" || mdtrtarea_admvs == "450127" {
- url = gdyb_url
- } else {
- url = gdyb_url + "1101"
- }
-
- fmt.Println(url)
- fmt.Println(gdyb_paasid)
- fmt.Println(secret_key)
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/1101"
- request, err := http.NewRequest("POST", url, reader)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
-
- request.Header.Set("Content-Type", "application/json;charset=UTF-8")
- request.Header.Set("x-tif-paasid", gdyb_paasid)
- request.Header.Set("x-tif-signature", signature)
- request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
- request.Header.Set("x-tif-nonce", nonce)
-
- client := http.Client{}
- resp, err := client.Do(request)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- respBytes, err := ioutil.ReadAll(resp.Body)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- fmt.Println(string(respBytes))
- str := string(respBytes)
- return str, string(bytesData)
-
- }
-
- func Gdyb1101ForEleCert(org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, token string, user_name string, idNo string) (string, string) {
- //生成签名
- nonce := GetRandomString(32)
- timestamp := time.Now().Unix()
- signature := setSignature(timestamp, nonce, secret_key)
- //生成输入报文
- inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
- input := make(map[string]interface{})
- inputData := make(map[string]interface{})
- inputMessage["infno"] = "1101" // 交易编码
-
- inputData["mdtrt_cert_type"] = "01" // 就诊凭证类型
- inputData["psn_cert_type"] = "01" // 人员证件类型
-
- inputData["card_sn"] = "" // 卡识别码
- inputData["certno"] = idNo // 证件号码
-
- inputData["mdtrt_cert_no"] = token // 就诊凭证编号
- inputData["begntime"] = "" // 开始时间
- inputData["psn_name"] = user_name // 人员姓名
- input["data"] = inputData
- inputMessage["input"] = input //交易输入
-
- bytesData, err := json.Marshal(inputMessage)
- fmt.Println(string(bytesData))
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- reader := bytes.NewReader(bytesData)
- gdyb_url := beego.AppConfig.String("gdyb_url")
- gdyb_paasid := beego.AppConfig.String("gdyb_paasid")
-
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/1101"
- //url := gdyb_url + "1101"
- var url string
- if fixmedins_code == "H15049901371" || mdtrtarea_admvs == "450721" || mdtrtarea_admvs == "450127" {
- url = gdyb_url
- } else {
- url = gdyb_url + "1101"
- }
-
- fmt.Println(url)
- fmt.Println(gdyb_paasid)
- fmt.Println(secret_key)
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/1101"
- request, err := http.NewRequest("POST", url, reader)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
-
- request.Header.Set("Content-Type", "application/json;charset=UTF-8")
- request.Header.Set("x-tif-paasid", gdyb_paasid)
- request.Header.Set("x-tif-signature", signature)
- request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
- request.Header.Set("x-tif-nonce", nonce)
-
- client := http.Client{}
- resp, err := client.Do(request)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- respBytes, err := ioutil.ReadAll(resp.Body)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- fmt.Println(string(respBytes))
- str := string(respBytes)
- return str, string(bytesData)
-
- }
-
- func Gdyb1101ForEleCerttwo(org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, token string, user_name string, idNo string) (string, string) {
- //生成签名
- nonce := GetRandomString(32)
- timestamp := time.Now().Unix()
- signature := setSignature(timestamp, nonce, secret_key)
- //生成输入报文
- inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
- input := make(map[string]interface{})
- inputData := make(map[string]interface{})
- inputMessage["infno"] = "1101" // 交易编码
-
- inputData["mdtrt_cert_type"] = "01" // 就诊凭证类型
- inputData["card_sn"] = "" // 卡识别码
- inputData["certno"] = idNo // 证件号码
- inputData["psn_cert_type"] = "01" // 人员证件类型
-
- inputData["mdtrt_cert_no"] = token // 就诊凭证编号
- inputData["begntime"] = "" // 开始时间
- inputData["psn_name"] = user_name // 人员姓名
- input["data"] = inputData
- inputMessage["input"] = input //交易输入
-
- bytesData, err := json.Marshal(inputMessage)
- fmt.Println(string(bytesData))
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- reader := bytes.NewReader(bytesData)
- gdyb_url := beego.AppConfig.String("gdyb_url")
- gdyb_paasid := beego.AppConfig.String("gdyb_paasid")
-
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/1101"
- //url := gdyb_url + "1101"
- var url string
- if fixmedins_code == "H15049901371" || mdtrtarea_admvs == "450721" || mdtrtarea_admvs == "450127" {
- url = gdyb_url
- } else {
- url = gdyb_url + "1101"
- }
-
- fmt.Println(url)
- fmt.Println(gdyb_paasid)
- fmt.Println(secret_key)
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/1101"
- request, err := http.NewRequest("POST", url, reader)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
-
- request.Header.Set("Content-Type", "application/json;charset=UTF-8")
- request.Header.Set("x-tif-paasid", gdyb_paasid)
- request.Header.Set("x-tif-signature", signature)
- request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
- request.Header.Set("x-tif-nonce", nonce)
-
- client := http.Client{}
- resp, err := client.Do(request)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- respBytes, err := ioutil.ReadAll(resp.Body)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- fmt.Println(string(respBytes))
- str := string(respBytes)
- return str, string(bytesData)
-
- }
-
- func Gdyb6101(org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string) (string, string) {
- //生成签名
- nonce := GetRandomString(32)
- timestamp := time.Now().Unix()
- signature := setSignature(timestamp, nonce, secret_key)
- //生成输入报文
- inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
- input := make(map[string]interface{})
- inputData := make(map[string]interface{})
- inputMessage["infno"] = "6101" // 交易编码
-
- inputData["orgId"] = fixmedins_code // 就诊凭证类型
- inputData["businessType"] = "01101" // 卡识别码
- inputData["businessInfo"] = "" // 证件号码
- inputData["operateorId"] = "01" // 人员证件类型
- inputData["operateornName"] = doctor // 就诊凭证编号
- inputData["officeId"] = "01" // 开始时间
- inputData["officeName"] = "血透" // 人员姓名
- inputData["deviceType"] = "" // 人员姓名
- input["InData"] = inputData
- inputMessage["input"] = input //交易输入
-
- bytesData, err := json.Marshal(inputMessage)
- fmt.Println(string(bytesData))
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- reader := bytes.NewReader(bytesData)
- gdyb_url := beego.AppConfig.String("gdyb_url")
- gdyb_paasid := beego.AppConfig.String("gdyb_paasid")
-
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/1101"
- //url := gdyb_url + "1101"
- var url string
- if fixmedins_code == "H15049901371" || mdtrtarea_admvs == "450127" || mdtrtarea_admvs == "450127" {
- url = gdyb_url
- } else {
- url = gdyb_url + "1101"
- }
-
- fmt.Println(url)
- fmt.Println(gdyb_paasid)
- fmt.Println(secret_key)
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/1101"
- request, err := http.NewRequest("POST", url, reader)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
-
- request.Header.Set("Content-Type", "application/json;charset=UTF-8")
- request.Header.Set("x-tif-paasid", gdyb_paasid)
- request.Header.Set("x-tif-signature", signature)
- request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
- request.Header.Set("x-tif-nonce", nonce)
-
- client := http.Client{}
- resp, err := client.Do(request)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- respBytes, err := ioutil.ReadAll(resp.Body)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- fmt.Println(string(respBytes))
- str := string(respBytes)
- return str, string(bytesData)
-
- }
-
- // 人员信息版本4
- func Gdyb1101C(certNo string, org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, id_card_type int64, card_sn string, certificates int64) (string, string) {
- //生成签名
- nonce := GetRandomString(32)
- timestamp := time.Now().Unix()
- //signature := setSignature(timestamp, nonce, secret_key)
- //生成输入报文
- inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
- input := make(map[string]interface{})
- inputData := make(map[string]interface{})
- inputMessage["infno"] = "1101" // 交易编码
-
- if certificates == 3 {
- inputData["mdtrt_cert_type"] = "99" // 就诊凭证类型
- inputData["certno"] = certNo // 证件号码
- inputData["psn_cert_type"] = "99" // 人员证件类型
-
- } else {
- if id_card_type == 1 {
- inputData["mdtrt_cert_type"] = "03" // 就诊凭证类型
- inputData["card_sn"] = "" // 卡识别码
- inputData["certno"] = "" // 证件号码
- inputData["psn_cert_type"] = "" // 人员证件类型
-
- } else {
- inputData["mdtrt_cert_type"] = "02" // 就诊凭证类型
- inputData["card_sn"] = "" // 卡识别码
- inputData["certno"] = certNo // 证件号码
- inputData["psn_cert_type"] = "1" // 人员证件类型
- }
- }
-
- inputData["mdtrt_cert_no"] = "" // 就诊凭证编号
- inputData["begntime"] = "" // 开始时间
- inputData["psn_name"] = "" // 人员姓名
- input["data"] = inputData
- inputMessage["input"] = input //交易输入
- bytesData, err := json.Marshal(inputMessage)
- fmt.Println(string(bytesData))
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- var json2 string
- cmd := exec.Command("java", "-jar", "yh_hb_fat.jar", "1101", string(bytesData), json2)
- out, err := cmd.Output()
- if err != nil {
- fmt.Println("error:", err.Error())
- }
- fmt.Println(string(out))
- return string(out), string(bytesData)
- }
-
- func StrPtr(s string) uintptr {
- return uintptr(unsafe.Pointer(syscall.StringBytePtr(s)))
- }
-
- func Gdyb90991(psn_no string, org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, pwd string, card_number string) string {
- //生成签名
- nonce := GetRandomString(32)
- timestamp := time.Now().Unix()
- signature := setSignature(timestamp, nonce, secret_key)
- //生成输入报文
- inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
- input := make(map[string]interface{})
- inputData := make(map[string]interface{})
- inputMessage["infno"] = "90991" // 交易编码
-
- inputData["fixmedins_code"] = fixmedins_code // 就诊凭证编号
- inputData["psn_no"] = psn_no // 开始时间
- inputData["card_pwd"] = pwd // 人员姓名
- inputData["sscno"] = card_number // 人员姓名
-
- input["data"] = inputData
- inputMessage["input"] = input //交易输入
-
- bytesData, err := json.Marshal(inputMessage)
- fmt.Println(string(bytesData))
- if err != nil {
- fmt.Println(err.Error())
- return err.Error()
- }
- reader := bytes.NewReader(bytesData)
- gdyb_url := beego.AppConfig.String("gdyb_url")
- gdyb_paasid := beego.AppConfig.String("gdyb_paasid")
-
- url := gdyb_url + "90991"
- request, err := http.NewRequest("POST", url, reader)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error()
- }
-
- request.Header.Set("Content-Type", "application/json;charset=UTF-8")
- request.Header.Set("x-tif-paasid", gdyb_paasid)
- request.Header.Set("x-tif-signature", signature)
- request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
- request.Header.Set("x-tif-nonce", nonce)
-
- client := http.Client{}
- resp, err := client.Do(request)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error()
- }
- respBytes, err := ioutil.ReadAll(resp.Body)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error()
- }
- fmt.Println(string(respBytes))
- str := string(respBytes)
- return str
- }
- func Gdyb90100(psn_no string, org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string) string {
- //生成签名
- nonce := GetRandomString(32)
- timestamp := time.Now().Unix()
- signature := setSignature(timestamp, nonce, secret_key)
- //生成输入报文
- inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
- input := make(map[string]interface{})
- inputData := make(map[string]interface{})
- inputMessage["infno"] = "90100" // 交易编码
- inputData["psn_no"] = psn_no // 开始时间
- input["data"] = inputData
- inputMessage["input"] = input //交易输入
-
- bytesData, err := json.Marshal(inputMessage)
- fmt.Println(string(bytesData))
- if err != nil {
- fmt.Println(err.Error())
- return err.Error()
- }
-
- reader := bytes.NewReader(bytesData)
- gdyb_url := beego.AppConfig.String("gdyb_url")
- gdyb_paasid := beego.AppConfig.String("gdyb_paasid")
-
- url := gdyb_url + "90100"
- request, err := http.NewRequest("POST", url, reader)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error()
- }
-
- request.Header.Set("Content-Type", "application/json;charset=UTF-8")
- request.Header.Set("x-tif-paasid", gdyb_paasid)
- request.Header.Set("x-tif-signature", signature)
- request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
- request.Header.Set("x-tif-nonce", nonce)
-
- client := http.Client{}
- resp, err := client.Do(request)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error()
- }
- respBytes, err := ioutil.ReadAll(resp.Body)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error()
- }
- fmt.Println(string(respBytes))
- str := string(respBytes)
- return str
- }
-
- func Gdyb3260(org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, year string, month string, sign string, count int) (string, string) {
- //生成签名
- nonce := GetRandomString(32)
- timestamp := time.Now().Unix()
- signature := setSignature(timestamp, nonce, secret_key)
- //生成输入报文
- inputMessage := SetInputMessageTwo(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, sign)
- input := make(map[string]interface{})
- inputData := make(map[string]interface{})
- inputMessage["infno"] = "3260" // 交易编码
- inputData["sign"] = sign // 就诊凭证编号
- inputData["trt_year"] = year // 就诊凭证编号
- inputData["trt_month"] = month // 开始时间
- inputData["startrow"] = count // 人员姓名
- input["data"] = inputData
- inputMessage["input"] = input //交易输入
- var inputLog string
- bytesData, err := json.Marshal(inputMessage)
- inputLog = string(bytesData)
- fmt.Println(string(bytesData))
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- reader := bytes.NewReader(bytesData)
- gdyb_url := beego.AppConfig.String("gdyb_url")
- gdyb_paasid := beego.AppConfig.String("gdyb_paasid")
-
- var url string
- if fixmedins_code == "H15049901371" || mdtrtarea_admvs == "450721" || mdtrtarea_admvs == "450127" {
- url = gdyb_url
- } else {
- url = gdyb_url + "3260"
- }
-
- if insuplc_admdvs == "421300" {
- var json2 string
- cmd := exec.Command("java", "-jar", "yh_hb_fat.jar", "1101", string(bytesData), json2)
- out, err := cmd.Output()
- if err != nil {
- fmt.Println("error:", err.Error())
- }
- fmt.Println(string(out))
- return hex.EncodeToString(out), inputLog
- } else {
-
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/1101"
- request, err := http.NewRequest("POST", url, reader)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
-
- request.Header.Set("Content-Type", "application/json;charset=UTF-8")
- request.Header.Set("x-tif-paasid", gdyb_paasid)
- request.Header.Set("x-tif-signature", signature)
- request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
- request.Header.Set("x-tif-nonce", nonce)
-
- client := http.Client{}
- resp, err := client.Do(request)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- respBytes, err := ioutil.ReadAll(resp.Body)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- fmt.Println(string(respBytes))
- str := string(respBytes)
- return str, inputLog
-
- }
-
- }
- func Gdyb3261(org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, year string, month string, result3260 []models.Result3260, sign_no string) {
-
- //msg_month := time.Unix(1557042972, 0).Format("1")
- //msg_year := time.Now().Format("2006")
- //msg_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")
-
- //msg_id := fixmedins_code + msg_year + msg_month + day + hour + min + sec + msec + "0"
-
- feedetail := make([]map[string]interface{}, 0)
-
- for _, subitem := range result3260 {
- for _, item := range subitem.Output.Data {
- if item.MdtrtId != "out20230406681871" && item.MdtrtId != "out20230406681868" {
- feedetailInfo := make(map[string]interface{})
- feedetailInfo["certno"] = item.Certno
- feedetailInfo["mdtrt_id"] = item.MdtrtId // 就诊 ID(来自2201接口返回)
- feedetailInfo["mdtrt_setl_time"] = item.MdtrtSetlTime // 人员编号 (来自1101接口返回)
- feedetailInfo["setl_sn"] = item.SetlSn // 收费批次号
- feedetailInfo["medfee_sumamt"] = item.MedfeeSumamt // 病种编码
- feedetailInfo["optins_pay_sumamt"] = item.OptinsPaySumamt // 处方号
- feedetailInfo["cnfm_flag"] = "1" // 处方号
- feedetail = append(feedetail, feedetailInfo)
- }
- }
- }
- for _, subitem := range result3260 {
- for _, item := range subitem.Output.Data {
-
- if item.MdtrtId == "out20230406681871" {
- feedetailInfo := make(map[string]interface{})
- feedetailInfo["certno"] = item.Certno
- feedetailInfo["mdtrt_id"] = item.MdtrtId // 就诊 ID(来自2201接口返回)
- feedetailInfo["mdtrt_setl_time"] = item.MdtrtSetlTime // 人员编号 (来自1101接口返回)
- feedetailInfo["setl_sn"] = item.SetlSn // 收费批次号
- feedetailInfo["medfee_sumamt"] = item.MedfeeSumamt // 病种编码
- feedetailInfo["optins_pay_sumamt"] = item.OptinsPaySumamt // 处方号
- feedetailInfo["cnfm_flag"] = "0" // 处方号
- feedetail = append(feedetail, feedetailInfo)
- }
- }
- }
- for _, subitem := range result3260 {
- for _, item := range subitem.Output.Data {
-
- if item.MdtrtId == "out20230406681868" {
- feedetailInfo := make(map[string]interface{})
- feedetailInfo["certno"] = item.Certno
- feedetailInfo["mdtrt_id"] = item.MdtrtId // 就诊 ID(来自2201接口返回)
- feedetailInfo["mdtrt_setl_time"] = item.MdtrtSetlTime // 人员编号 (来自1101接口返回)
- feedetailInfo["setl_sn"] = item.SetlSn // 收费批次号
- feedetailInfo["medfee_sumamt"] = item.MedfeeSumamt // 病种编码
- feedetailInfo["optins_pay_sumamt"] = item.OptinsPaySumamt // 处方号
- feedetailInfo["cnfm_flag"] = "0" // 处方号
- feedetail = append(feedetail, feedetailInfo)
- }
- }
- }
-
- // 分页操作
- pageSize := 100
- pages := paginate(feedetail, pageSize)
- //aa := 0
- // 输出每一页的数据
- for _, page := range pages {
-
- nonce := GetRandomString(32)
- timestamp := time.Now().Unix()
- signature := setSignature(timestamp, nonce, secret_key)
- //生成输入报文
- //aa = aa + len(page)
- //nonce := GetRandomString(32)
- //timestamp := time.Now().Unix()
- inputMessage := SetInputMessageTwo(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, sign_no)
- input := make(map[string]interface{})
- inputData := make(map[string]interface{})
- inputMessage["infno"] = "3261" // 交易编码
- inputData["trt_year"] = year // 就诊凭证编号
- inputData["trt_month"] = month // 开始时间
-
- inputData["totalrow"] = len(feedetail) // 人员姓名
- input["data"] = inputData
- input["detail"] = page
- inputMessage["input"] = input //交易输入
- //var inputLog string
- bytesData, err := json.Marshal(inputMessage)
- //inputLog = string(bytesData)
- fmt.Println(string(bytesData))
- if err != nil {
- fmt.Println(err.Error())
- return
- }
- reader := bytes.NewReader(bytesData)
- gdyb_url := beego.AppConfig.String("gdyb_url")
- gdyb_paasid := beego.AppConfig.String("gdyb_paasid")
-
- var url string
- if fixmedins_code == "H15049901371" || mdtrtarea_admvs == "450721" || mdtrtarea_admvs == "450127" {
- url = gdyb_url
- } else {
- url = gdyb_url + "3261"
- }
-
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/1101"
- request, err := http.NewRequest("POST", url, reader)
- if err != nil {
- fmt.Println(err.Error())
- return
- }
-
- request.Header.Set("Content-Type", "application/json;charset=UTF-8")
- request.Header.Set("x-tif-paasid", gdyb_paasid)
- request.Header.Set("x-tif-signature", signature)
- request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
- request.Header.Set("x-tif-nonce", nonce)
-
- client := http.Client{}
- resp, err := client.Do(request)
- if err != nil {
- fmt.Println(err.Error())
- return
- }
- respBytes, err := ioutil.ReadAll(resp.Body)
- if err != nil {
- fmt.Println(err.Error())
- return
- }
- fmt.Println(string(respBytes))
- str := string(respBytes)
- fmt.Println(str)
- }
-
- //for _, item := range result3260.Output.Data[start-1 : stop] {
- // if item.MdtrtId != "out20230406681871" && item.MdtrtId != "out20230406681868" {
- // feedetailInfo := make(map[string]interface{})
- // feedetailInfo["certno"] = item.Certno
- // feedetailInfo["mdtrt_id"] = item.MdtrtId // 就诊 ID(来自2201接口返回)
- // feedetailInfo["mdtrt_setl_time"] = item.MdtrtSetlTime // 人员编号 (来自1101接口返回)
- // feedetailInfo["setl_sn"] = item.SetlSn // 收费批次号
- // feedetailInfo["medfee_sumamt"] = item.MedfeeSumamt // 病种编码
- // feedetailInfo["optins_pay_sumamt"] = item.OptinsPaySumamt // 处方号
- // feedetailInfo["cnfm_flag"] = "1" // 处方号
- // feedetail = append(feedetail, feedetailInfo)
- // }
- //}
- //for _, item := range result3260.Output.Data[start-1 : stop] {
- // if item.MdtrtId == "out20230406681871" {
- // feedetailInfo := make(map[string]interface{})
- // feedetailInfo["certno"] = item.Certno
- // feedetailInfo["mdtrt_id"] = item.MdtrtId // 就诊 ID(来自2201接口返回)
- // feedetailInfo["mdtrt_setl_time"] = item.MdtrtSetlTime // 人员编号 (来自1101接口返回)
- // feedetailInfo["setl_sn"] = item.SetlSn // 收费批次号
- // feedetailInfo["medfee_sumamt"] = item.MedfeeSumamt // 病种编码
- // feedetailInfo["optins_pay_sumamt"] = item.OptinsPaySumamt // 处方号
- // feedetailInfo["cnfm_flag"] = "0" // 处方号
- // feedetail = append(feedetail, feedetailInfo)
- // }
- //
- //}
- //for _, item := range result3260.Output.Data[start-1 : stop] {
- // if item.MdtrtId == "out20230406681868" {
- // feedetailInfo := make(map[string]interface{})
- // feedetailInfo["certno"] = item.Certno
- // feedetailInfo["mdtrt_id"] = item.MdtrtId // 就诊 ID(来自2201接口返回)
- // feedetailInfo["mdtrt_setl_time"] = item.MdtrtSetlTime // 人员编号 (来自1101接口返回)
- // feedetailInfo["setl_sn"] = item.SetlSn // 收费批次号
- // feedetailInfo["medfee_sumamt"] = item.MedfeeSumamt // 病种编码
- // feedetailInfo["optins_pay_sumamt"] = item.OptinsPaySumamt // 处方号
- // feedetailInfo["cnfm_flag"] = "0" // 处方号
- // feedetail = append(feedetail, feedetailInfo)
- // }
- //
- //}
-
- return
- }
-
- func Gdyb3263(org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, year string, month string, result3260 []models.Result3260, sign_no string) {
-
- //msg_month := time.Unix(1557042972, 0).Format("1")
- //msg_year := time.Now().Format("2006")
- //msg_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")
-
- //msg_id := fixmedins_code + msg_year + msg_month + day + hour + min + sec + msec + "0"
-
- feedetail := make([]map[string]interface{}, 0)
-
- for _, subitem := range result3260 {
- for _, item := range subitem.Output.Data {
- if item.MdtrtId != "out20230406681871" && item.MdtrtId != "out20230406681868" {
- feedetailInfo := make(map[string]interface{})
- feedetailInfo["certno"] = item.Certno
- feedetailInfo["mdtrt_id"] = item.MdtrtId // 就诊 ID(来自2201接口返回)
- feedetailInfo["mdtrt_setl_time"] = item.MdtrtSetlTime // 人员编号 (来自1101接口返回)
- feedetailInfo["setl_sn"] = item.SetlSn // 收费批次号
- feedetailInfo["medfee_sumamt"] = item.MedfeeSumamt // 病种编码
- feedetailInfo["optins_pay_sumamt"] = item.OptinsPaySumamt // 处方号
- feedetailInfo["cnfm_flag"] = "1" // 处方号
- feedetail = append(feedetail, feedetailInfo)
- }
- }
- }
- for _, subitem := range result3260 {
- for _, item := range subitem.Output.Data {
-
- if item.MdtrtId == "out20230406681871" {
- feedetailInfo := make(map[string]interface{})
- feedetailInfo["certno"] = item.Certno
- feedetailInfo["mdtrt_id"] = item.MdtrtId // 就诊 ID(来自2201接口返回)
- feedetailInfo["mdtrt_setl_time"] = item.MdtrtSetlTime // 人员编号 (来自1101接口返回)
- feedetailInfo["setl_sn"] = item.SetlSn // 收费批次号
- feedetailInfo["medfee_sumamt"] = item.MedfeeSumamt // 病种编码
- feedetailInfo["optins_pay_sumamt"] = item.OptinsPaySumamt // 处方号
- feedetailInfo["cnfm_flag"] = "0" // 处方号
- feedetail = append(feedetail, feedetailInfo)
- }
- }
- }
- for _, subitem := range result3260 {
- for _, item := range subitem.Output.Data {
-
- if item.MdtrtId == "out20230406681868" {
- feedetailInfo := make(map[string]interface{})
- feedetailInfo["certno"] = item.Certno
- feedetailInfo["mdtrt_id"] = item.MdtrtId // 就诊 ID(来自2201接口返回)
- feedetailInfo["mdtrt_setl_time"] = item.MdtrtSetlTime // 人员编号 (来自1101接口返回)
- feedetailInfo["setl_sn"] = item.SetlSn // 收费批次号
- feedetailInfo["medfee_sumamt"] = item.MedfeeSumamt // 病种编码
- feedetailInfo["optins_pay_sumamt"] = item.OptinsPaySumamt // 处方号
- feedetailInfo["cnfm_flag"] = "0" // 处方号
- feedetail = append(feedetail, feedetailInfo)
- }
- }
- }
-
- var firstSlice, secondSlice []map[string]interface{}
- if len(feedetail) > 500 {
- firstSlice = feedetail[:500]
- secondSlice = feedetail[500:]
- } else {
- firstSlice = feedetail
- secondSlice = []map[string]interface{}{}
- }
- fmt.Println(firstSlice)
-
- nonce := GetRandomString(32)
- timestamp := time.Now().Unix()
- signature := setSignature(timestamp, nonce, secret_key)
- //生成输入报文
- total := 0
- for _, item := range result3260 {
- total = total + len(item.Output.Data)
-
- }
-
- //nonce := GetRandomString(32)
- //timestamp := time.Now().Unix()
- inputMessage := SetInputMessageTwo(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, sign_no)
- input := make(map[string]interface{})
- inputData := make(map[string]interface{})
- inputMessage["infno"] = "3261" // 交易编码
- inputData["trt_year"] = year // 就诊凭证编号
- inputData["trt_month"] = month // 开始时间
-
- inputData["totalrow"] = len(secondSlice) // 人员姓名
- input["data"] = inputData
- input["detail"] = secondSlice
- inputMessage["input"] = input //交易输入
- //var inputLog string
- bytesData, err := json.Marshal(inputMessage)
- //inputLog = string(bytesData)
- fmt.Println(string(bytesData))
- if err != nil {
- fmt.Println(err.Error())
- return
- }
- reader := bytes.NewReader(bytesData)
- gdyb_url := beego.AppConfig.String("gdyb_url")
- gdyb_paasid := beego.AppConfig.String("gdyb_paasid")
-
- var url string
- if fixmedins_code == "H15049901371" || mdtrtarea_admvs == "450721" || mdtrtarea_admvs == "450127" {
- url = gdyb_url
- } else {
- url = gdyb_url + "3261"
- }
-
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/1101"
- request, err := http.NewRequest("POST", url, reader)
- if err != nil {
- fmt.Println(err.Error())
- return
- }
-
- request.Header.Set("Content-Type", "application/json;charset=UTF-8")
- request.Header.Set("x-tif-paasid", gdyb_paasid)
- request.Header.Set("x-tif-signature", signature)
- request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
- request.Header.Set("x-tif-nonce", nonce)
-
- client := http.Client{}
- resp, err := client.Do(request)
- if err != nil {
- fmt.Println(err.Error())
- return
- }
- respBytes, err := ioutil.ReadAll(resp.Body)
- if err != nil {
- fmt.Println(err.Error())
- return
- }
- fmt.Println(string(respBytes))
- str := string(respBytes)
- fmt.Println(str)
-
- //for _, item := range result3260.Output.Data[start-1 : stop] {
- // if item.MdtrtId != "out20230406681871" && item.MdtrtId != "out20230406681868" {
- // feedetailInfo := make(map[string]interface{})
- // feedetailInfo["certno"] = item.Certno
- // feedetailInfo["mdtrt_id"] = item.MdtrtId // 就诊 ID(来自2201接口返回)
- // feedetailInfo["mdtrt_setl_time"] = item.MdtrtSetlTime // 人员编号 (来自1101接口返回)
- // feedetailInfo["setl_sn"] = item.SetlSn // 收费批次号
- // feedetailInfo["medfee_sumamt"] = item.MedfeeSumamt // 病种编码
- // feedetailInfo["optins_pay_sumamt"] = item.OptinsPaySumamt // 处方号
- // feedetailInfo["cnfm_flag"] = "1" // 处方号
- // feedetail = append(feedetail, feedetailInfo)
- // }
- //}
- //for _, item := range result3260.Output.Data[start-1 : stop] {
- // if item.MdtrtId == "out20230406681871" {
- // feedetailInfo := make(map[string]interface{})
- // feedetailInfo["certno"] = item.Certno
- // feedetailInfo["mdtrt_id"] = item.MdtrtId // 就诊 ID(来自2201接口返回)
- // feedetailInfo["mdtrt_setl_time"] = item.MdtrtSetlTime // 人员编号 (来自1101接口返回)
- // feedetailInfo["setl_sn"] = item.SetlSn // 收费批次号
- // feedetailInfo["medfee_sumamt"] = item.MedfeeSumamt // 病种编码
- // feedetailInfo["optins_pay_sumamt"] = item.OptinsPaySumamt // 处方号
- // feedetailInfo["cnfm_flag"] = "0" // 处方号
- // feedetail = append(feedetail, feedetailInfo)
- // }
- //
- //}
- //for _, item := range result3260.Output.Data[start-1 : stop] {
- // if item.MdtrtId == "out20230406681868" {
- // feedetailInfo := make(map[string]interface{})
- // feedetailInfo["certno"] = item.Certno
- // feedetailInfo["mdtrt_id"] = item.MdtrtId // 就诊 ID(来自2201接口返回)
- // feedetailInfo["mdtrt_setl_time"] = item.MdtrtSetlTime // 人员编号 (来自1101接口返回)
- // feedetailInfo["setl_sn"] = item.SetlSn // 收费批次号
- // feedetailInfo["medfee_sumamt"] = item.MedfeeSumamt // 病种编码
- // feedetailInfo["optins_pay_sumamt"] = item.OptinsPaySumamt // 处方号
- // feedetailInfo["cnfm_flag"] = "0" // 处方号
- // feedetail = append(feedetail, feedetailInfo)
- // }
- //
- //}
-
- return
- }
-
- func Gdyb3262(org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, year string, month string, otransid string, sign_no string) (string, string) {
- //生成签名
- nonce := GetRandomString(32)
- timestamp := time.Now().Unix()
- signature := setSignature(timestamp, nonce, secret_key)
- //生成输入报文
- inputMessage := SetInputMessageTwo(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, sign_no)
- input := make(map[string]interface{})
- inputData := make(map[string]interface{})
- inputMessage["infno"] = "3262" // 交易编码
-
- inputData["trt_year"] = year // 就诊凭证编号
- inputData["trt_month"] = month // 开始时间
- inputData["otransid"] = "0" // 开始时间
-
- input["data"] = inputData
- inputMessage["input"] = input //交易输入
- var inputLog string
- bytesData, err := json.Marshal(inputMessage)
- inputLog = string(bytesData)
- fmt.Println(string(bytesData))
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- reader := bytes.NewReader(bytesData)
- gdyb_url := beego.AppConfig.String("gdyb_url")
- gdyb_paasid := beego.AppConfig.String("gdyb_paasid")
-
- var url string
- if fixmedins_code == "H15049901371" || mdtrtarea_admvs == "450721" || mdtrtarea_admvs == "450127" {
- url = gdyb_url
- } else {
- url = gdyb_url + "3262"
- }
-
- if insuplc_admdvs == "421300" {
- var json2 string
- cmd := exec.Command("java", "-jar", "yh_hb_fat.jar", "1101", string(bytesData), json2)
- out, err := cmd.Output()
- if err != nil {
- fmt.Println("error:", err.Error())
- }
- fmt.Println(string(out))
- return hex.EncodeToString(out), inputLog
- } else {
-
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/1101"
- request, err := http.NewRequest("POST", url, reader)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
-
- request.Header.Set("Content-Type", "application/json;charset=UTF-8")
- request.Header.Set("x-tif-paasid", gdyb_paasid)
- request.Header.Set("x-tif-signature", signature)
- request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
- request.Header.Set("x-tif-nonce", nonce)
-
- client := http.Client{}
- resp, err := client.Do(request)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- respBytes, err := ioutil.ReadAll(resp.Body)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- fmt.Println(string(respBytes))
- str := string(respBytes)
- return str, inputLog
-
- }
-
- }
- func Gdyb9001(org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, admin_user_id int64) (string, string) {
- //生成签名
- nonce := GetRandomString(32)
- timestamp := time.Now().Unix()
- signature := setSignature(timestamp, nonce, "d6Ad0P1B3z6Dsdst0gYAFPlz8YlIvFDx")
- inputMessage := make(map[string]interface{})
-
- //生成输入报文
- if mdtrtarea_admvs == "450721" || mdtrtarea_admvs == "450127" {
-
- inputMessage = SetInputMessage1111(nonce, timestamp, org_name, admin_user_id, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, doctor)
-
- } else {
- 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"] = "9001" // 交易编码
- inputData["opter_no"] = admin_user_id // 就诊凭证编号
- inputData["mac"] = "11-11-11-11-11" // 开始时间
- inputData["ip"] = "11.11.11.11"
- //inputData["userid"] = "H44010400081"
-
- //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")
- //custom_time := year + month + day + hour + min + sec
- //inputData["currenttime"] = custom_time
- //var psd string
- //psd = custom_time + "Gzyb$867"
- //h := md5.New()
- //h.Write([]byte(psd))
- //inputData["password"] = strings.ToUpper(hex.EncodeToString(h.Sum(nil)))
- input["data"] = inputData
- inputMessage["input"] = input //交易输入
- var inputLog string
- bytesData, err := json.Marshal(inputMessage)
- inputLog = string(bytesData)
- fmt.Println(string(bytesData))
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- reader := bytes.NewReader(bytesData)
- gdyb_url := beego.AppConfig.String("gdyb_url")
- gdyb_paasid := beego.AppConfig.String("gdyb_paasid")
-
- var url string
- if fixmedins_code == "H15049901371" || mdtrtarea_admvs == "450721" || mdtrtarea_admvs == "450127" {
- url = gdyb_url
- } else {
- url = gdyb_url + "9001"
- }
-
- if insuplc_admdvs == "421300" {
- var json2 string
- cmd := exec.Command("java", "-jar", "yh_hb_fat.jar", "1101", string(bytesData), json2)
- out, err := cmd.Output()
- if err != nil {
- fmt.Println("error:", err.Error())
- }
- fmt.Println(string(out))
- return hex.EncodeToString(out), inputLog
- } else {
-
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/1101"
-
- request, err := http.NewRequest("POST", url, reader)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
-
- request.Header.Set("Content-Type", "application/json;charset=UTF-8")
- request.Header.Set("x-tif-paasid", gdyb_paasid)
- request.Header.Set("x-tif-signature", signature)
- request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
- request.Header.Set("x-tif-nonce", nonce)
-
- fmt.Println(string(bytesData))
- fmt.Println(gdyb_url)
- fmt.Println(gdyb_paasid)
- fmt.Println(request.Header)
-
- client := http.Client{}
- resp, err := client.Do(request)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- respBytes, err := ioutil.ReadAll(resp.Body)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- fmt.Println(string(respBytes))
- str := string(respBytes)
- return str, inputLog
-
- }
-
- }
-
- func Gdyb9001Two(org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, admin_user_id int64) (string, string) {
- //生成签名
- nonce := GetRandomString(32)
- timestamp := time.Now().Unix()
- signature := setSignature(timestamp, nonce, secret_key)
- inputMessage := make(map[string]interface{})
-
- //生成输入报文
- //生成输入报文
- if mdtrtarea_admvs == "450721" || mdtrtarea_admvs == "450127" {
-
- inputMessage = SetInputMessage1111(nonce, timestamp, org_name, admin_user_id, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, doctor)
-
- } else {
- inputMessage = SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
-
- }
- //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"] = "9001" // 交易编码
- inputData["opter_no"] = admin_user_id // 就诊凭证编号
- inputData["mac"] = GetMac() // 开始时间
- inputData["ip"] = GetLocalIp()
- input["signIn"] = inputData
- inputMessage["input"] = input //交易输入
- var inputLog string
- bytesData, err := json.Marshal(inputMessage)
- inputLog = string(bytesData)
- fmt.Println(string(bytesData))
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- reader := bytes.NewReader(bytesData)
- gdyb_url := beego.AppConfig.String("gdyb_url")
- gdyb_paasid := beego.AppConfig.String("gdyb_paasid")
-
- var url string
- if fixmedins_code == "H15049901371" || mdtrtarea_admvs == "450721" || mdtrtarea_admvs == "450127" {
- url = gdyb_url
- } else {
- url = gdyb_url + "9001"
- }
-
- if insuplc_admdvs == "421300" {
- var json2 string
- cmd := exec.Command("java", "-jar", "yh_hb_fat.jar", "1101", string(bytesData), json2)
- out, err := cmd.Output()
- if err != nil {
- fmt.Println("error:", err.Error())
- }
- fmt.Println(string(out))
- return hex.EncodeToString(out), inputLog
- } else {
-
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/1101"
-
- request, err := http.NewRequest("POST", url, reader)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
-
- request.Header.Set("Content-Type", "application/json;charset=UTF-8")
- request.Header.Set("x-tif-paasid", gdyb_paasid)
- request.Header.Set("x-tif-signature", signature)
- request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
- request.Header.Set("x-tif-nonce", nonce)
-
- fmt.Println(string(bytesData))
- fmt.Println(gdyb_url)
- fmt.Println(gdyb_paasid)
- fmt.Println(request.Header)
-
- client := http.Client{}
- resp, err := client.Do(request)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- respBytes, err := ioutil.ReadAll(resp.Body)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- fmt.Println(string(respBytes))
- str := string(respBytes)
- return str, inputLog
-
- }
-
- }
-
- // 获取本机ip
- func GetLocalIp() string {
- addrs, err := net.InterfaceAddrs()
- if err != nil {
- fmt.Println("get local ip failed")
- }
- for _, address := range addrs {
- if ipnet, ok := address.(*net.IPNet); ok && !ipnet.IP.IsLoopback() {
- if ipnet.IP.To4() != nil {
- return ipnet.IP.String()
- }
- }
- }
- return ""
- }
-
- // 获取本机Mac
- func GetMac() string {
- interfaces, err := net.Interfaces()
- if err != nil {
- fmt.Println("Get loacl Mac failed")
- }
- for _, inter := range interfaces {
- mac := inter.HardwareAddr
- fmt.Println("+======" + mac.String())
- if mac.String() != "" {
- return mac.String()
- }
-
- }
- return ""
- }
-
- // 人员基本信息
- func Gdyb1101D(certNo string, org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, id_card_type int64, card_sn string, certificates string, psn_name string, record_date string, admin_user_id int64) (string, string) {
- //生成签名
- fmt.Println("DDDDD")
- nonce := GetRandomString(32)
- timestamp := time.Now().Unix()
- signature := setSignature(timestamp, nonce, secret_key)
- //生成输入报文
- inputMessage := make(map[string]interface{})
-
- //tempTime := time.Unix(timestamp, 0)
- //timeFormatOne := tempTime.Format("2006-01-02 15:04:05")
- // 生成输入报文
- if mdtrtarea_admvs == "450721" || mdtrtarea_admvs == "450127" {
-
- inputMessage = SetInputMessage1111(nonce, timestamp, org_name, admin_user_id, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, doctor)
- } else {
- inputMessage = SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
- }
- //inputMessage := SetInputMessagenosign(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
- input := make(map[string]interface{})
- inputData := make(map[string]interface{})
- inputMessage["infno"] = "1101" // 交易编码
-
- if certificates == "3" {
- inputData["mdtrt_cert_type"] = "02" // 就诊凭证类型
- inputData["certno"] = certNo // 证件号码
- inputData["psn_cert_type"] = "99" // 人员证件类型
-
- } else {
- if certificates == "1" {
- if id_card_type == 1 {
- inputData["mdtrt_cert_type"] = "03" // 就诊凭证类型
- inputData["card_sn"] = "" // 卡识别码
- inputData["certno"] = certNo // 证件号码
- inputData["psn_cert_type"] = "01" // 人员证件类型
-
- } else if id_card_type == 4 {
- inputData["mdtrt_cert_type"] = "01" // 就诊凭证类型
- inputData["certno"] = certNo // 证件号码
- inputData["psn_cert_type"] = "01" // 人员证件类型
-
- } else {
- inputData["mdtrt_cert_type"] = "02" // 就诊凭证类型
- inputData["card_sn"] = "" // 卡识别码
- inputData["certno"] = certNo // 证件号码
- inputData["psn_cert_type"] = "01" // 人员证件类型
- }
- } else if certificates == "6" {
- inputData["mdtrt_cert_type"] = "03" // 就诊凭证类型
- inputData["card_sn"] = "" // 卡识别码
- inputData["certno"] = certNo // 证件号码
- inputData["psn_cert_type"] = "17" // 人员证件类型
-
- }
-
- }
-
- inputData["mdtrt_cert_no"] = certNo // 就诊凭证编号
- inputData["begntime"] = "" // 开始时间
- inputData["psn_name"] = "" // 人员姓名
- input["data"] = inputData
- inputMessage["input"] = input //交易输入
-
- var inputLog string
- bytesData, err := json.Marshal(inputMessage)
- inputLog = string(bytesData)
- fmt.Println(string(bytesData))
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- reader := bytes.NewReader(bytesData)
- gdyb_url := beego.AppConfig.String("gdyb_url")
- gdyb_paasid := beego.AppConfig.String("gdyb_paasid")
-
- //DllDef := syscall.MustLoadDLL("yh_hb_sctrl.dll")
- //Iinit := DllDef.MustFindProc("yh_hb_call")
- //var str3 string
- //ret, _, _ := Iinit.Call(StrPtr("1101"), StrPtr(string(bytesData)), StrPtr(str3))
- //fmt.Println(ret)
- //fmt.Println(str3)
- //
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/1101"
- var url string
- if fixmedins_code == "H15049901371" || mdtrtarea_admvs == "450721" || mdtrtarea_admvs == "450127" {
- url = gdyb_url
- } else {
- url = gdyb_url + "1101"
- }
-
- if insuplc_admdvs == "421300" {
- var json2 string
- cmd := exec.Command("java", "-jar", "yh_hb_fat.jar", "1101", string(bytesData), json2)
- out, err := cmd.Output()
- if err != nil {
- fmt.Println("error:", err.Error())
- }
- fmt.Println(string(out))
- return hex.EncodeToString(out), inputLog
- } else {
-
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/1101"
- request, err := http.NewRequest("POST", url, reader)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
-
- request.Header.Set("Content-Type", "application/json;charset=UTF-8")
- request.Header.Set("x-tif-paasid", gdyb_paasid)
- request.Header.Set("x-tif-signature", signature)
- request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
- request.Header.Set("x-tif-nonce", nonce)
-
- client := http.Client{}
- resp, err := client.Do(request)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- respBytes, err := ioutil.ReadAll(resp.Body)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- fmt.Println(string(respBytes))
- str := string(respBytes)
- return str, inputLog
-
- }
-
- }
-
- //func SetInputMessageFour(nonce string, timestamp int64, org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs 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)
- //
- // msec := time.Now().Format("000")
- // fmt.Println(utils.GetNetTime())
- // // 生成输入报文
- // inputMessage := make(map[string]interface{})
- // inputMessage["msgid"] = fixmedins_code + utils.GetNetTime() + msec + "0" // 发送方报文 ID
- // inputMessage["mdtrtarea_admvs"] = mdtrtarea_admvs // 就医地医保区划
- // inputMessage["insuplc_admdvs"] = insuplc_admdvs // 参保地医保区划
- // inputMessage["recer_sys_code"] = "1" // 接收方系统代码
- // inputMessage["dev_no"] = "" // 设备编号
- // inputMessage["dev_safe_info"] = "" // 设备安全信息
- // inputMessage["cainfo"] = "" // 数字签名信息
- // inputMessage["signtype"] = "SM3" // 签名类型
- // inputMessage["infver"] = "V1.0" // 接收方系统代码
- // inputMessage["opter_type"] = "1" // 经办人类别
- // inputMessage["opter"] = doctor // 经办人
- // inputMessage["opter_name"] = doctor // 经办人姓名
- // inputMessage["inf_time"] = utils.GetNetTime() // 交易时间
- // inputMessage["fixmedins_code"] = fixmedins_code // 定点医药机构编号
- // inputMessage["fixmedins_name"] = org_name //定点医药机构名称
- // inputMessage["sign_no"] = "" //交易签到流水号
- // return inputMessage
- //}
-
- func Gdyb5302(psnNo string, org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string) string {
- // 生成签名
- nonce := GetRandomString(32)
- //timestamp := time.Now().Unix()
- timestamp := time.Now().UnixNano() / 1e6
-
- signature := setSignature(timestamp, nonce, secret_key)
-
- // 生成输入报文
- inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
- input := make(map[string]interface{})
- inputData := make(map[string]interface{})
- inputMessage["infno"] = "5302" // 交易编码
- inputData["psn_no"] = psnNo // 人员编号 (来自1101接口返回)
- inputData["biz_appy_type"] = "03" // 人员编号 (来自1101接口返回)
-
- input["data"] = inputData
- inputMessage["input"] = input //交易输入
- bytesData, err := json.Marshal(inputMessage)
- fmt.Println(string(bytesData))
- if err != nil {
- fmt.Println(err.Error())
- return err.Error()
- }
- reader := bytes.NewReader(bytesData)
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/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 + "5302"
- request, err := http.NewRequest("POST", url, reader)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error()
- }
-
- request.Header.Set("Content-Type", "application/json;charset=UTF-8")
- request.Header.Set("x-tif-paasid", gdyb_paasid)
- request.Header.Set("x-tif-signature", signature)
- request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
- request.Header.Set("x-tif-nonce", nonce)
-
- client := http.Client{}
- resp, err := client.Do(request)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error()
- }
- respBytes, err := ioutil.ReadAll(resp.Body)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error()
- }
- str := string(respBytes)
- fmt.Println(str)
- return str
- }
-
- func CreateSignIn(record *models.HisSignIn) (err error) {
- err = writeDb.Save(&record).Error
- return
- }
-
- func GetSignInInfo(code string) string {
- var sign models.HisSignIn
- err = readDb.Model(&models.HisSignIn{}).Where("fixmedins_code = ? AND status = 1", code).Last(&sign).Error
- return sign.SignNo
- }
-
- func Gdyb3501(struct3501 models.Struct3501, secret_key string) (string, string) {
- // 生成签名
- nonce := GetRandomString(32)
- timestamp := time.Now().Unix()
- signature := setSignature(timestamp, nonce, secret_key)
- // 生成输入报文
- inputMessage := SetGdInputMessage(timestamp, struct3501.OrgName, struct3501.Opter, struct3501.Code, 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.FixmedinsHilistName // 定点医药机构目录名称
- 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接口返回)
-
- feedetail := make([]map[string]interface{}, 0)
-
- codes := strings.Split(struct3501.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["invinfo"] = inputData
- inputMessage["input"] = input //交易输入
-
-
- bytesData, err := json.Marshal(inputMessage)
- fmt.Println(string(bytesData))
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- reader := bytes.NewReader(bytesData)
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/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 + "3501"
- request, err := http.NewRequest("POST", url, reader)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
-
- request.Header.Set("Content-Type", "application/json;charset=UTF-8")
- request.Header.Set("x-tif-paasid", gdyb_paasid)
- request.Header.Set("x-tif-signature", signature)
- request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
- request.Header.Set("x-tif-nonce", nonce)
-
- client := http.Client{}
- resp, err := client.Do(request)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- respBytes, err := ioutil.ReadAll(resp.Body)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- str := string(respBytes)
- fmt.Println(str)
- return str, string(bytesData)
- }
- func Gdyb3502(struct3502 models.Struct3502, secret_key string) (string, string) {
- // 生成签名
- nonce := GetRandomString(32)
- timestamp := time.Now().Unix()
- signature := setSignature(timestamp, nonce, secret_key)
-
- // 生成输入报文
- inputMessage := SetGdInputMessage(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.FixmedinsHilistName // 定点医药机构目录名称
- 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
- //feedetail := make([]map[string]interface{}, 0)
- //druginputData := make(map[string]interface{})
- //druginputData["drug_trac_codg"] = struct3502.DrugTracCodg
- //feedetail = append(feedetail, druginputData)
- //inputData["drugtracinfo"] = feedetail
- feedetail := make([]map[string]interface{}, 0)
- codes := strings.Split(struct3502.DrugTracCodg, ",")
- for _, item := range codes {
- druginputData := make(map[string]interface{})
- druginputData["drug_trac_codg"] = item
- feedetail = append(feedetail, druginputData)
- }
- inputData["drugtracinfo"] = feedetail
- input["invinfo"] = inputData
- inputMessage["input"] = input //交易输入
-
- bytesData, err := json.Marshal(inputMessage)
- fmt.Println(string(bytesData))
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- reader := bytes.NewReader(bytesData)
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/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 + "3502"
- request, err := http.NewRequest("POST", url, reader)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
-
- request.Header.Set("Content-Type", "application/json;charset=UTF-8")
- request.Header.Set("x-tif-paasid", gdyb_paasid)
- request.Header.Set("x-tif-signature", signature)
- request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
- request.Header.Set("x-tif-nonce", nonce)
-
- client := http.Client{}
- resp, err := client.Do(request)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- respBytes, err := ioutil.ReadAll(resp.Body)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- str := string(respBytes)
- fmt.Println(str)
- return str, string(bytesData)
- }
- func Gdyb3503(struct3503 models.Struct3503, secret_key string) (string, string) {
- // 生成签名
- nonce := GetRandomString(32)
- timestamp := time.Now().Unix()
- signature := setSignature(timestamp, nonce, secret_key)
-
- // 生成输入报文
- inputMessage := SetGdInputMessage(timestamp, struct3503.OrgName, struct3503.Opter, struct3503.FixmedinsHilistId, struct3503.InsuplcAdmdvs, struct3503.MdtrtareaAdmvs, struct3503.Cainfo)
-
- input := make(map[string]interface{})
-
- inputMessage["infno"] = "3503"
-
- item := struct3503
- feedetailInfo := make(map[string]interface{})
- feedetailInfo["med_list_codg"] = item.MedListCodg
- feedetailInfo["fixmedins_hilist_id"] = item.FixmedinsHilistId
- feedetailInfo["fixmedins_hilist_name"] = item.FixmedinsHilistName
- feedetailInfo["dynt_no"] = ""
- feedetailInfo["fixmedins_bchno"] = item.FixmedinsBchno // 人员编号 (来自1101接口返回)
- feedetailInfo["spler_name"] = item.SplerName // 人员编号 (来自1101接口返回)
- feedetailInfo["spler_pmtno"] = "" // 人员编号 (来自1101接口返回)
- feedetailInfo["manu_lotnum"] = item.ManuLotnum // 人员编号 (来自1101接口返回)
- feedetailInfo["prodentp_name"] = item.ProdentpName // 人员编号 (来自1101接口返回)
- feedetailInfo["aprvno"] = item.Aprvno // 人员编号 (来自1101接口返回)
- feedetailInfo["manu_date"] = item.ManuDate // 人员编号 (来自1101接口返回)
- feedetailInfo["expy_end"] = item.ExpyEnd // 人员编号 (来自1101接口返回)
- feedetailInfo["finl_trns_pric"] = item.FinlTrnsPric // 人员编号 (来自1101接口返回)
- feedetailInfo["purc_retn_cnt"] = item.PurcRetnCnt // 人员编号 (来自1101接口返回)
- feedetailInfo["purc_invo_codg"] = item.PurcInvoCodg // 人员编号 (来自1101接口返回)
- feedetailInfo["purc_invo_no"] = item.PurcInvoNo // 人员编号 (来自1101接口返回)
- feedetailInfo["rx_flag"] = item.RxFlag // 人员编号 (来自1101接口返回)
- feedetailInfo["purc_retn_stoin_time"] = item.PurcRetnStoinTime // 人员编号 (来自1101接口返回)
- feedetailInfo["purc_retn_opter_name"] = item.PurcRetnOpterName // 人员编号 (来自1101接口返回)
- feedetailInfo["prod_geay_flag"] = "" // 人员编号 (来自1101接口返回)
- feedetailInfo["memo"] = "" // 人员编号 (来自1101接口返回)
-
- input["purcinfo"] = feedetailInfo
- inputMessage["input"] = input //交易输入
-
- bytesData, err := json.Marshal(inputMessage)
- fmt.Println(string(bytesData))
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- reader := bytes.NewReader(bytesData)
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/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 + "3503"
- request, err := http.NewRequest("POST", url, reader)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
-
- request.Header.Set("Content-Type", "application/json;charset=UTF-8")
- request.Header.Set("x-tif-paasid", gdyb_paasid)
- request.Header.Set("x-tif-signature", signature)
- request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
- request.Header.Set("x-tif-nonce", nonce)
-
- client := http.Client{}
- resp, err := client.Do(request)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- respBytes, err := ioutil.ReadAll(resp.Body)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- str := string(respBytes)
- fmt.Println(str)
- return str, string(bytesData)
- }
- func Gdyb3504(struct3504 models.Struct3504, secret_key string) (string, string) {
- // 生成签名
- nonce := GetRandomString(32)
- timestamp := time.Now().Unix()
- signature := setSignature(timestamp, nonce, secret_key)
-
- // 生成输入报文
- inputMessage := SetGdInputMessage(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 //交易输入
-
- bytesData, err := json.Marshal(inputMessage)
- fmt.Println(string(bytesData))
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- reader := bytes.NewReader(bytesData)
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/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 + "3504"
- request, err := http.NewRequest("POST", url, reader)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
-
- request.Header.Set("Content-Type", "application/json;charset=UTF-8")
- request.Header.Set("x-tif-paasid", gdyb_paasid)
- request.Header.Set("x-tif-signature", signature)
- request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
- request.Header.Set("x-tif-nonce", nonce)
-
- client := http.Client{}
- resp, err := client.Do(request)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- respBytes, err := ioutil.ReadAll(resp.Body)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- str := string(respBytes)
- fmt.Println(str)
- return str, string(bytesData)
- }
- func Gdyb3505(struct3505 models.Struct3505, secret_key string) (string, string) {
- // 生成签名
- nonce := GetRandomString(32)
- timestamp := time.Now().Unix()
- signature := setSignature(timestamp, nonce, secret_key)
-
- // 生成输入报文
- inputMessage := SetGdInputMessage(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"] = 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["MDTRT_SETL_TYPE"] = struct3505.MdtrtSetlType // 人员编号 (来自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
- 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 //交易输入
-
- bytesData, err := json.Marshal(inputMessage)
- fmt.Println(string(bytesData))
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- reader := bytes.NewReader(bytesData)
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/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, err := http.NewRequest("POST", url, reader)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
-
- request.Header.Set("Content-Type", "application/json;charset=UTF-8")
- request.Header.Set("x-tif-paasid", gdyb_paasid)
- request.Header.Set("x-tif-signature", signature)
- request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
- request.Header.Set("x-tif-nonce", nonce)
-
- client := http.Client{}
- resp, err := client.Do(request)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- respBytes, err := ioutil.ReadAll(resp.Body)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- str := string(respBytes)
- fmt.Println(str)
- return str, ""
- }
- func Gdyb3506(struct3506 models.Struct3506, secret_key string) (string, string) {
- // 生成签名
- nonce := GetRandomString(32)
- timestamp := time.Now().Unix()
- signature := setSignature(timestamp, nonce, secret_key)
-
- // 生成输入报文
- inputMessage := SetGdInputMessage(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.FixmedinsHilistName // 定点医药机构目录名称
- 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 //交易输入
-
- bytesData, err := json.Marshal(inputMessage)
- fmt.Println(string(bytesData))
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- reader := bytes.NewReader(bytesData)
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/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 + "3506"
- request, err := http.NewRequest("POST", url, reader)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
-
- request.Header.Set("Content-Type", "application/json;charset=UTF-8")
- request.Header.Set("x-tif-paasid", gdyb_paasid)
- request.Header.Set("x-tif-signature", signature)
- request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
- request.Header.Set("x-tif-nonce", nonce)
-
- client := http.Client{}
- resp, err := client.Do(request)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- respBytes, err := ioutil.ReadAll(resp.Body)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- str := string(respBytes)
- fmt.Println(str)
- return str, string(bytesData)
- }
- func Gdyb3507(struct3507 models.Struct3507, secret_key string) (string, string) {
- // 生成签名
- nonce := GetRandomString(32)
- timestamp := time.Now().Unix()
- signature := setSignature(timestamp, nonce, secret_key)
-
- // 生成输入报文
- inputMessage := SetGdInputMessage(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 //交易输入
-
- bytesData, err := json.Marshal(inputMessage)
- fmt.Println(string(bytesData))
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- reader := bytes.NewReader(bytesData)
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/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 + "3507"
- request, err := http.NewRequest("POST", url, reader)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
-
- request.Header.Set("Content-Type", "application/json;charset=UTF-8")
- request.Header.Set("x-tif-paasid", gdyb_paasid)
- request.Header.Set("x-tif-signature", signature)
- request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
- request.Header.Set("x-tif-nonce", nonce)
-
- client := http.Client{}
- resp, err := client.Do(request)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- respBytes, err := ioutil.ReadAll(resp.Body)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- str := string(respBytes)
- fmt.Println(str)
- return str, string(bytesData)
- }
- func Gdyb3508(struct3508 models.Struct3508, secret_key string) (string, string) {
- // 生成签名
- nonce := GetRandomString(32)
- timestamp := time.Now().Unix()
- signature := setSignature(timestamp, nonce, secret_key)
-
- // 生成输入报文
- inputMessage := SetGdInputMessage(timestamp, struct3508.OrgName, struct3508.Opter, struct3508.FixmedinsCode, struct3508.InsuplcAdmdvs, struct3508.MdtrtareaAdmvs, struct3508.Cainfo)
- input := make(map[string]interface{})
- inputData := make(map[string]interface{})
- inputMessage["infno"] = "3508"
- inputData["fixmedins_code"] = struct3508.FixmedinsCode
- inputData["medins_list_codg"] = struct3508.MedListCodg
- inputData["fixmedins_bchno"] = ""
- inputData["begndate"] = struct3508.Begndate
- inputData["enddate"] = struct3508.Enddate
-
- inputData["medins_prod_inv_no"] = ""
- inputData["medins_list_name"] = ""
- inputData["rx_flag"] = ""
- inputData["list_sp_item_flag"] = ""
- inputData["trdn_flag"] = ""
- inputData["invdate"] = ""
- inputData["manu_lotnum"] = ""
- inputData["manu_date"] = ""
- inputData["expy_end"] = ""
- inputData["memo"] = ""
- inputData["vali_flag"] = ""
- inputData["rid"] = ""
- inputData["crter_id"] = ""
- inputData["crter_name"] = ""
- inputData["crte_optins_no"] = ""
- inputData["opter_id"] = ""
- inputData["opter_name"] = ""
- inputData["optins_no"] = ""
- inputData["poolarea_no"] = ""
- inputData["fixmedins_bchno"] = ""
- inputData["inv_data_type"] = ""
- input["data"] = inputData
- inputMessage["input"] = input //交易输入
-
- bytesData, err := json.Marshal(inputMessage)
- fmt.Println(string(bytesData))
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- 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 + "3508"
- request, err := http.NewRequest("POST", url, reader)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
-
- request.Header.Set("Content-Type", "application/json;charset=UTF-8")
- request.Header.Set("x-tif-paasid", gdyb_paasid)
- request.Header.Set("x-tif-signature", signature)
- request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
- request.Header.Set("x-tif-nonce", nonce)
-
- client := http.Client{}
- resp, err := client.Do(request)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- respBytes, err := ioutil.ReadAll(resp.Body)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- str := string(respBytes)
- fmt.Println(str)
- return str, string(bytesData)
- }
- func Gdyb3509(struct3509 models.Struct3509, secret_key string) (string, string) {
- // 生成签名
- nonce := GetRandomString(32)
- timestamp := time.Now().Unix()
- signature := setSignature(timestamp, nonce, secret_key)
-
- // 生成输入报文
- inputMessage := SetGdInputMessage(timestamp, struct3509.OrgName, struct3509.Opter, struct3509.FixmedinsCode, struct3509.InsuplcAdmdvs, struct3509.MdtrtareaAdmvs, struct3509.Cainfo)
- input := make(map[string]interface{})
- inputData := make(map[string]interface{})
- inputMessage["infno"] = "3509"
- inputData["fixmedins_code"] = struct3509.FixmedinsCode
- //inputData["med_list_codg"] = struct3509.MedinsListCodg
- inputData["medins_list_codg"] = struct3509.MedListCodg
-
- inputData["fixmedins_bchno"] = ""
- inputData["begndate"] = struct3509.Begndate
- inputData["enddate"] = struct3509.Enddate
- inputData["medins_prod_inv_no"] = ""
- inputData["medins_list_name"] = ""
- inputData["rx_flag"] = ""
- inputData["list_sp_item_flag"] = ""
- inputData["trdn_flag"] = ""
- inputData["invdate"] = ""
- inputData["manu_lotnum"] = ""
- inputData["manu_date"] = ""
- inputData["expy_end"] = ""
- inputData["memo"] = ""
- inputData["vali_flag"] = ""
- inputData["rid"] = ""
-
- inputData["crter_id"] = ""
- inputData["crter_name"] = ""
- inputData["crte_optins_no"] = ""
- inputData["opter_id"] = ""
- inputData["opter_name"] = ""
- inputData["optins_no"] = ""
- inputData["poolarea_no"] = ""
-
- inputData["fixmedins_bchno"] = ""
- inputData["inv_data_type"] = ""
-
- input["data"] = inputData
- inputMessage["input"] = input //交易输入
-
- bytesData, err := json.Marshal(inputMessage)
- fmt.Println(string(bytesData))
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- 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 + "3509"
- request, err := http.NewRequest("POST", url, reader)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
-
- request.Header.Set("Content-Type", "application/json;charset=UTF-8")
- request.Header.Set("x-tif-paasid", gdyb_paasid)
- request.Header.Set("x-tif-signature", signature)
- request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
- request.Header.Set("x-tif-nonce", nonce)
-
- client := http.Client{}
- resp, err := client.Do(request)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- respBytes, err := ioutil.ReadAll(resp.Body)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- str := string(respBytes)
- fmt.Println(str)
- return str, string(bytesData)
- }
- func Gdyb3510(struct3510 models.Struct3510, secret_key string) (string, string) {
- // 生成签名
- nonce := GetRandomString(32)
- timestamp := time.Now().Unix()
- signature := setSignature(timestamp, nonce, secret_key)
-
- // 生成输入报文
- inputMessage := SetGdInputMessage(timestamp, struct3510.OrgName, struct3510.Opter, struct3510.FixmedinsCode, struct3510.InsuplcAdmdvs, struct3510.MdtrtareaAdmvs, struct3510.Cainfo)
- input := make(map[string]interface{})
- inputData := make(map[string]interface{})
- inputMessage["infno"] = "3510"
- inputData["fixmedins_code"] = struct3510.FixmedinsCode
- //inputData["medins_list_codg"] = struct3510.MedinsListCodg
- inputData["medins_list_codg"] = struct3510.MedListCodg
-
- inputData["fixmedins_bchno"] = ""
- inputData["begndate"] = struct3510.Begndate
- inputData["enddate"] = struct3510.Enddate
- inputData["medins_prod_inv_no"] = ""
- inputData["medins_list_name"] = ""
- inputData["rx_flag"] = ""
- inputData["list_sp_item_flag"] = ""
- inputData["trdn_flag"] = ""
- inputData["invdate"] = ""
- inputData["manu_lotnum"] = ""
- inputData["manu_date"] = ""
- inputData["expy_end"] = ""
- inputData["memo"] = ""
- inputData["vali_flag"] = ""
- inputData["rid"] = ""
-
- inputData["crter_id"] = ""
- inputData["crter_name"] = ""
- inputData["crte_optins_no"] = ""
- inputData["opter_id"] = ""
- inputData["opter_name"] = ""
- inputData["optins_no"] = ""
- inputData["poolarea_no"] = ""
-
- inputData["fixmedins_bchno"] = ""
- inputData["inv_data_type"] = ""
-
- input["data"] = inputData
- inputMessage["input"] = input //交易输入
-
- bytesData, err := json.Marshal(inputMessage)
- fmt.Println(string(bytesData))
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- 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 + "3510"
- request, err := http.NewRequest("POST", url, reader)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
-
- request.Header.Set("Content-Type", "application/json;charset=UTF-8")
- request.Header.Set("x-tif-paasid", gdyb_paasid)
- request.Header.Set("x-tif-signature", signature)
- request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
- request.Header.Set("x-tif-nonce", nonce)
-
- client := http.Client{}
- resp, err := client.Do(request)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- respBytes, err := ioutil.ReadAll(resp.Body)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- str := string(respBytes)
- fmt.Println(str)
- return str, string(bytesData)
- }
- func Gdyb3511(struct3511 models.Struct3511, secret_key string) (string, string) {
- // 生成签名
- nonce := GetRandomString(32)
- timestamp := time.Now().Unix()
- signature := setSignature(timestamp, nonce, secret_key)
-
- // 生成输入报文
- inputMessage := SetGdInputMessage(timestamp, struct3511.OrgName, struct3511.Opter, struct3511.FixmedinsCode, struct3511.InsuplcAdmdvs, struct3511.MdtrtareaAdmvs, struct3511.Cainfo)
- input := make(map[string]interface{})
- inputData := make(map[string]interface{})
- inputMessage["infno"] = "3511"
- inputData["fixmedins_code"] = struct3511.FixmedinsCode
- //inputData["medins_list_codg"] = struct3511.MedinsListCodg
- inputData["medins_list_codg"] = struct3511.MedListCodg
-
- inputData["fixmedins_bchno"] = ""
- inputData["begndate"] = struct3511.Begndate
- inputData["enddate"] = struct3511.Enddate
- inputData["medins_prod_inv_no"] = ""
- inputData["medins_list_name"] = ""
- inputData["rx_flag"] = ""
- inputData["list_sp_item_flag"] = ""
- inputData["trdn_flag"] = ""
- inputData["invdate"] = ""
- inputData["manu_lotnum"] = ""
- inputData["manu_date"] = ""
- inputData["expy_end"] = ""
- inputData["memo"] = ""
- inputData["vali_flag"] = ""
- inputData["rid"] = ""
-
- inputData["crter_id"] = ""
- inputData["crter_name"] = ""
- inputData["crte_optins_no"] = ""
- inputData["opter_id"] = ""
- inputData["opter_name"] = ""
- inputData["optins_no"] = ""
- inputData["poolarea_no"] = ""
-
- inputData["fixmedins_bchno"] = ""
- inputData["inv_data_type"] = ""
-
- input["data"] = inputData
- inputMessage["input"] = input //交易输入
-
- bytesData, err := json.Marshal(inputMessage)
- fmt.Println(string(bytesData))
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- 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 + "3511"
- request, err := http.NewRequest("POST", url, reader)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
-
- request.Header.Set("Content-Type", "application/json;charset=UTF-8")
- request.Header.Set("x-tif-paasid", gdyb_paasid)
- request.Header.Set("x-tif-signature", signature)
- request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
- request.Header.Set("x-tif-nonce", nonce)
-
- client := http.Client{}
- resp, err := client.Do(request)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- respBytes, err := ioutil.ReadAll(resp.Body)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- str := string(respBytes)
- fmt.Println(str)
- return str, string(bytesData)
- }
- func Gdyb3512(struct3512 models.Struct3512, secret_key string) (string, string) {
- // 生成签名
- nonce := GetRandomString(32)
- timestamp := time.Now().Unix()
- signature := setSignature(timestamp, nonce, secret_key)
-
- // 生成输入报文
- inputMessage := SetGdInputMessage(timestamp, struct3512.OrgName, struct3512.Opter, struct3512.FixmedinsCode, struct3512.InsuplcAdmdvs, struct3512.MdtrtareaAdmvs, struct3512.Cainfo)
- input := make(map[string]interface{})
- inputData := make(map[string]interface{})
- inputMessage["infno"] = "3512"
- inputData["fixmedins_code"] = struct3512.FixmedinsCode
- //inputData["medins_list_codg"] = struct3512.MedinsListCodg
- inputData["medins_list_codg"] = struct3512.MedListCodg
- inputData["fixmedins_bchno"] = ""
- inputData["begndate"] = struct3512.Begndate
- inputData["enddate"] = struct3512.Enddate
- inputData["medins_prod_inv_no"] = ""
- inputData["medins_list_name"] = ""
- inputData["rx_flag"] = ""
- inputData["list_sp_item_flag"] = ""
- inputData["trdn_flag"] = ""
- inputData["invdate"] = ""
- inputData["manu_lotnum"] = ""
- inputData["manu_date"] = ""
- inputData["expy_end"] = ""
- inputData["memo"] = ""
- inputData["vali_flag"] = ""
- inputData["rid"] = ""
-
- inputData["crter_id"] = ""
- inputData["crter_name"] = ""
- inputData["crte_optins_no"] = ""
- inputData["opter_id"] = ""
- inputData["opter_name"] = ""
- inputData["optins_no"] = ""
- inputData["poolarea_no"] = ""
-
- inputData["fixmedins_bchno"] = ""
- inputData["inv_data_type"] = ""
-
- input["data"] = inputData
- inputMessage["input"] = input //交易输入
-
- bytesData, err := json.Marshal(inputMessage)
- fmt.Println(string(bytesData))
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- 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 + "3512"
- request, err := http.NewRequest("POST", url, reader)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
-
- request.Header.Set("Content-Type", "application/json;charset=UTF-8")
- request.Header.Set("x-tif-paasid", gdyb_paasid)
- request.Header.Set("x-tif-signature", signature)
- request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
- request.Header.Set("x-tif-nonce", nonce)
-
- client := http.Client{}
- resp, err := client.Do(request)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- respBytes, err := ioutil.ReadAll(resp.Body)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- str := string(respBytes)
- fmt.Println(str)
- return str, string(bytesData)
- }
- func Gdyb3513(struct3513 models.Struct3513, secret_key string) (string, string) {
- // 生成签名
- nonce := GetRandomString(32)
- timestamp := time.Now().Unix()
- signature := setSignature(timestamp, nonce, secret_key)
-
- // 生成输入报文
- inputMessage := SetGdInputMessage(timestamp, struct3513.OrgName, struct3513.Opter, struct3513.FixmedinsCode, struct3513.InsuplcAdmdvs, struct3513.MdtrtareaAdmvs, struct3513.Cainfo)
- input := make(map[string]interface{})
- inputData := make(map[string]interface{})
- inputMessage["infno"] = "3513"
- inputData["fixmedins_code"] = struct3513.FixmedinsCode
- //inputData["medins_list_codg"] = struct3513.MedinsListCodg
- inputData["medins_list_codg"] = struct3513.MedListCodg
-
- inputData["fixmedins_bchno"] = ""
- inputData["begndate"] = struct3513.Begndate
- inputData["enddate"] = struct3513.Enddate
- inputData["medins_prod_inv_no"] = ""
- inputData["med_list_codg"] = ""
- inputData["medins_list_name"] = ""
- inputData["rx_flag"] = ""
- inputData["list_sp_item_flag"] = ""
- inputData["trdn_flag"] = ""
- inputData["invdate"] = ""
- inputData["manu_lotnum"] = ""
- inputData["manu_date"] = ""
- inputData["expy_end"] = ""
- inputData["memo"] = ""
- inputData["vali_flag"] = ""
- inputData["rid"] = ""
-
- inputData["crter_id"] = ""
- inputData["crter_name"] = ""
- inputData["crte_optins_no"] = ""
- inputData["opter_id"] = ""
- inputData["opter_name"] = ""
- inputData["optins_no"] = ""
- inputData["poolarea_no"] = ""
-
- inputData["fixmedins_bchno"] = ""
- inputData["inv_data_type"] = ""
-
- input["data"] = inputData
- inputMessage["input"] = input //交易输入
-
- bytesData, err := json.Marshal(inputMessage)
- fmt.Println(string(bytesData))
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- 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 + "3513"
- request, err := http.NewRequest("POST", url, reader)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
-
- request.Header.Set("Content-Type", "application/json;charset=UTF-8")
- request.Header.Set("x-tif-paasid", gdyb_paasid)
- request.Header.Set("x-tif-signature", signature)
- request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
- request.Header.Set("x-tif-nonce", nonce)
-
- client := http.Client{}
- resp, err := client.Do(request)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- respBytes, err := ioutil.ReadAll(resp.Body)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- str := string(respBytes)
- fmt.Println(str)
- return str, string(bytesData)
- }
-
- // 生成基础报文
- func SetGdInputMessage(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"] = "MBS_LOCAL" // 接收方系统代码
- inputMessage["dev_no"] = "1" // 设备编号
- inputMessage["dev_safe_info"] = "1" // 设备安全信息
- inputMessage["cainfo"] = cainfo // 数字签名信息
- inputMessage["signtype"] = "SM3" // 签名类型
- inputMessage["infver"] = "1.0.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 Gdyb3101(pd models.PatientDtos, fed models.FsiEncounterDtos, fdds []*models.FsiDiagnoseDtos, fods []*models.FsiOrderDtos, fopds []*models.FsiOperationDtosData, params models.PublicParams, trig_scen string) (string, string) {
-
- nonce := GetRandomString(32)
- timestamp := time.Now().Unix()
- signature := setSignature(timestamp, nonce, params.SecretKey)
-
- // 生成输入报文
- inputMessage := SetGdInputMessage(timestamp, params.FixmedinsName, params.OpterName, params.FixmedinsCode, params.InsuplcAdmdvs, params.MdtrtareaAdmvs, params.Cainfo)
-
- //inputMessage := SetJSInputMessage(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.HosplistName
- 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 //交易输入
- bytesData, err := json.Marshal(inputMessage)
- fmt.Println(string(bytesData))
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- reader := bytes.NewReader(bytesData)
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/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 + "3101"
- request, err := http.NewRequest("POST", url, reader)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
-
- request.Header.Set("Content-Type", "application/json;charset=UTF-8")
- request.Header.Set("x-tif-paasid", gdyb_paasid)
- request.Header.Set("x-tif-signature", signature)
- request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
- request.Header.Set("x-tif-nonce", nonce)
-
- client := http.Client{}
- resp, err := client.Do(request)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- respBytes, err := ioutil.ReadAll(resp.Body)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- str := string(respBytes)
- fmt.Println(str)
- return str, string(bytesData)
- }
- func Gdyb3102(pd models.PatientDtos, fed models.FsiEncounterDtos, fdds []*models.FsiDiagnoseDtos, fods []*models.FsiOrderDtos, fopds []*models.FsiOperationDtosData, params models.PublicParams, trig_scen string) (string, string) {
- nonce := GetRandomString(32)
- timestamp := time.Now().Unix()
- signature := setSignature(timestamp, nonce, params.SecretKey)
-
- // 生成输入报文
- inputMessage := SetGdInputMessage(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.HosplistCode
- fsiOrderDtosData["hilist_name"] = fod.HosplistName
- 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 //交易输入
- bytesData, err := json.Marshal(inputMessage)
- fmt.Println(string(bytesData))
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- reader := bytes.NewReader(bytesData)
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/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 + "3102"
- request, err := http.NewRequest("POST", url, reader)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
-
- request.Header.Set("Content-Type", "application/json;charset=UTF-8")
- request.Header.Set("x-tif-paasid", gdyb_paasid)
- request.Header.Set("x-tif-signature", signature)
- request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
- request.Header.Set("x-tif-nonce", nonce)
-
- client := http.Client{}
- resp, err := client.Do(request)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- respBytes, err := ioutil.ReadAll(resp.Body)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- str := string(respBytes)
- fmt.Println(str)
- return str, string(bytesData)
- }
-
- // 分页函数
- func paginate(data []map[string]interface{}, pageSize int) [][]map[string]interface{} {
- var pages [][]map[string]interface{}
- totalItems := len(data)
- for i := 0; i < totalItems; i += pageSize {
- end := i + pageSize
- if end > totalItems {
- end = totalItems
- }
- pages = append(pages, data[i:end])
- }
- return pages
- }
-
- func Gzyb3501(struct3501 models.Struct3501, secret_key string) (string, string) {
- // 生成签名
- nonce := GetRandomString(32)
- timestamp := time.Now().Unix()
- signature := setSignature(timestamp, nonce, secret_key)
-
- // 生成输入报文
- //inputMessage := SetInputMessage(timestamp, struct3501.OrgName, struct3501.Opter, struct3501.FixmedinsHilistId, struct3501.InsuplcAdmdvs, struct3501.MdtrtareaAdmvs, struct3501.Cainfo,"")
- sign := GetSignInInfo(struct3501.FixmedinsCode)
- inputMessage := SetGZInputMessage(nonce, timestamp, struct3501.OrgName, struct3501.Opter, struct3501.FixmedinsCode, struct3501.InsuplcAdmdvs, struct3501.MdtrtareaAdmvs, sign)
-
- 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 //交易输入
-
- bytesData, err := json.Marshal(inputMessage)
- fmt.Println(string(bytesData))
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- reader := bytes.NewReader(bytesData)
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/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 + "3501"
- request, err := http.NewRequest("POST", url, reader)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
-
- request.Header.Set("Content-Type", "application/json;charset=UTF-8")
- request.Header.Set("x-tif-paasid", gdyb_paasid)
- request.Header.Set("x-tif-signature", signature)
- request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
- request.Header.Set("x-tif-nonce", nonce)
-
- client := http.Client{}
- resp, err := client.Do(request)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- respBytes, err := ioutil.ReadAll(resp.Body)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- str := string(respBytes)
- fmt.Println(str)
- return str, string(bytesData)
- }
-
- func Gzyb3502(struct3502 models.Struct3502, secret_key string) (string, string) {
- // 生成签名
- nonce := GetRandomString(32)
- timestamp := time.Now().Unix()
- signature := setSignature(timestamp, nonce, secret_key)
- sign := GetSignInInfo(struct3502.FixmedinsCode)
- inputMessage := SetGZInputMessage(nonce, timestamp, struct3502.OrgName, struct3502.Opter, struct3502.FixmedinsCode, struct3502.InsuplcAdmdvs, struct3502.MdtrtareaAdmvs, sign)
-
- // 生成输入报文
- //inputMessage := SetGdInputMessage(timestamp, struct3502.OrgName, struct3502.Opter, struct3502.FixmedinsCode, struct3502.InsuplcAdmdvs, struct3502.MdtrtareaAdmvs, struct3502.Cainfo,sign)
- 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.FixmedinsHilistId // 定点医药机构目录编号
- inputData["fixmedins_hilist_name"] = struct3502.FixmedinsHilistName // 定点医药机构目录名称
- 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接口返回)
-
- feedetail := make([]map[string]interface{}, 0)
- codes := strings.Split(struct3502.DrugTracCodg, ",")
- for _, item := range codes {
- druginputData := make(map[string]interface{})
- druginputData["drug_trac_codg"] = item
- feedetail = append(feedetail, druginputData)
- }
- inputData["drugtracinfo"] = feedetail
-
- input["invinfo"] = inputData
- inputMessage["input"] = input //交易输入
-
- bytesData, err := json.Marshal(inputMessage)
- fmt.Println(string(bytesData))
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- reader := bytes.NewReader(bytesData)
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/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 := "http://hosp-gz.gd.hsip.gov.cn/ebus/gdyb_api/prd/hsa/hgs/" + "3502"
- request, err := http.NewRequest("POST", url, reader)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
-
- request.Header.Set("Content-Type", "application/json;charset=UTF-8")
- request.Header.Set("x-tif-paasid", gdyb_paasid)
- request.Header.Set("x-tif-signature", signature)
- request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
- request.Header.Set("x-tif-nonce", nonce)
-
- client := http.Client{}
- resp, err := client.Do(request)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- respBytes, err := ioutil.ReadAll(resp.Body)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- str := string(respBytes)
- fmt.Println(str)
- return str, string(bytesData)
- }
- func Gzyb3503(struct3503 models.Struct3503, secret_key string) (string, string) {
- // 生成签名
- nonce := GetRandomString(32)
- timestamp := time.Now().Unix()
- signature := setSignature(timestamp, nonce, secret_key)
-
- // 生成输入报文
- sign := GetSignInInfo(struct3503.FixmedinsCode)
- inputMessage := SetGZInputMessage(nonce, timestamp, struct3503.OrgName, struct3503.Opter, struct3503.FixmedinsCode, struct3503.InsuplcAdmdvs, struct3503.MdtrtareaAdmvs, sign)
-
- input := make(map[string]interface{})
-
- inputMessage["infno"] = "3503"
-
- item := struct3503
- feedetailInfo := make(map[string]interface{})
- feedetailInfo["med_list_codg"] = item.MedListCodg
- feedetailInfo["fixmedins_hilist_id"] = item.FixmedinsHilistId
- feedetailInfo["fixmedins_hilist_name"] = item.FixmedinsHilistName
- feedetailInfo["dynt_no"] = ""
- feedetailInfo["fixmedins_bchno"] = item.FixmedinsBchno // 人员编号 (来自1101接口返回)
- feedetailInfo["spler_name"] = item.SplerName // 人员编号 (来自1101接口返回)
- feedetailInfo["spler_pmtno"] = "" // 人员编号 (来自1101接口返回)
- feedetailInfo["manu_lotnum"] = item.ManuLotnum // 人员编号 (来自1101接口返回)
- feedetailInfo["prodentp_name"] = item.ProdentpName // 人员编号 (来自1101接口返回)
- feedetailInfo["aprvno"] = item.Aprvno // 人员编号 (来自1101接口返回)
- feedetailInfo["manu_date"] = item.ManuDate // 人员编号 (来自1101接口返回)
- feedetailInfo["expy_end"] = item.ExpyEnd // 人员编号 (来自1101接口返回)
- feedetailInfo["finl_trns_pric"] = item.FinlTrnsPric // 人员编号 (来自1101接口返回)
- feedetailInfo["purc_retn_cnt"] = item.PurcRetnCnt // 人员编号 (来自1101接口返回)
- feedetailInfo["purc_invo_codg"] = item.PurcInvoCodg // 人员编号 (来自1101接口返回)
- feedetailInfo["purc_invo_no"] = item.PurcInvoNo // 人员编号 (来自1101接口返回)
- feedetailInfo["rx_flag"] = item.RxFlag // 人员编号 (来自1101接口返回)
- feedetailInfo["purc_retn_stoin_time"] = item.PurcRetnStoinTime // 人员编号 (来自1101接口返回)
- feedetailInfo["purc_retn_opter_name"] = item.PurcRetnOpterName // 人员编号 (来自1101接口返回)
- feedetailInfo["prod_geay_flag"] = "" // 人员编号 (来自1101接口返回)
- feedetailInfo["memo"] = "" // 人员编号 (来自1101接口返回)
- input["purcinfo"] = feedetailInfo
- inputMessage["input"] = input //交易输入
-
- bytesData, err := json.Marshal(inputMessage)
- fmt.Println(string(bytesData))
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- reader := bytes.NewReader(bytesData)
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/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 + "3503"
- request, err := http.NewRequest("POST", url, reader)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
-
- request.Header.Set("Content-Type", "application/json;charset=UTF-8")
- request.Header.Set("x-tif-paasid", gdyb_paasid)
- request.Header.Set("x-tif-signature", signature)
- request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
- request.Header.Set("x-tif-nonce", nonce)
-
- client := http.Client{}
- resp, err := client.Do(request)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- respBytes, err := ioutil.ReadAll(resp.Body)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- str := string(respBytes)
- fmt.Println(str)
- return str, string(bytesData)
- }
- func Gzyb3504(struct3504 models.Struct3504, secret_key string) (string, string) {
- // 生成签名
- nonce := GetRandomString(32)
- timestamp := time.Now().Unix()
- signature := setSignature(timestamp, nonce, secret_key)
-
- // 生成输入报文
- //inputMessage := SetGdInputMessage(timestamp, struct3504.OrgName, struct3504.Opter, struct3504.FixmedinsCode, struct3504.InsuplcAdmdvs, struct3504.MdtrtareaAdmvs, struct3504.Cainfo)
- sign := GetSignInInfo(struct3504.FixmedinsCode)
- inputMessage := SetGZInputMessage(nonce, timestamp, struct3504.OrgName, struct3504.Opter, struct3504.FixmedinsCode, struct3504.InsuplcAdmdvs, struct3504.MdtrtareaAdmvs, sign)
-
- 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
- inputData["purc_retn_stoin_time"] = struct3504.PurcRetnStoin
- inputData["purc_retn_opter_name"] = struct3504.PurcRetnStoin
- inputData["memo"] = "" // 人员编号 (来自1101接口返回)
- inputData["medins_prod_purc_no"] = "" // 人员编号 (来自1101接口返回)
- input["purcinfo"] = inputData
- inputMessage["input"] = input //交易输入
-
- bytesData, err := json.Marshal(inputMessage)
- fmt.Println(string(bytesData))
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- reader := bytes.NewReader(bytesData)
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/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 + "3504"
- request, err := http.NewRequest("POST", url, reader)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
-
- request.Header.Set("Content-Type", "application/json;charset=UTF-8")
- request.Header.Set("x-tif-paasid", gdyb_paasid)
- request.Header.Set("x-tif-signature", signature)
- request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
- request.Header.Set("x-tif-nonce", nonce)
-
- client := http.Client{}
- resp, err := client.Do(request)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- respBytes, err := ioutil.ReadAll(resp.Body)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- str := string(respBytes)
- fmt.Println(str)
- return str, string(bytesData)
- }
- func Gzyb3505(struct3505 models.Struct3505, secret_key string) (string, string) {
- // 生成签名
- nonce := GetRandomString(32)
- timestamp := time.Now().Unix()
- signature := setSignature(timestamp, nonce, secret_key)
-
- // 生成输入报文
- //inputMessage := SetGdInputMessage(timestamp, struct3505.OrgName, struct3505.Opter, struct3505.FixmedinsHilistId, struct3505.InsuplcAdmdvs, struct3505.MdtrtareaAdmvs, struct3505.Cainfo)
- sign := GetSignInInfo(struct3505.FixmedinsCode)
- inputMessage := SetGZInputMessage(nonce, timestamp, struct3505.OrgName, struct3505.Opter, struct3505.FixmedinsCode, struct3505.InsuplcAdmdvs, struct3505.MdtrtareaAdmvs, sign)
-
- 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"] = 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["MDTRT_SETL_TYPE"] = struct3505.MdtrtSetlType // 人员编号 (来自1101接口返回)
-
- inputData["bchno"] = struct3505.Bchno // 人员编号 (来自1101接口返回)
- codes := strings.Split(struct3505.DrugTracCodg, ",")
-
- inputData["drug_trac_codg"] = codes[0] // 人员编号 (来自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接口返回)
- //drug_trac_cod .g
- 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 //交易输入
-
- input["selinfo"] = inputData
- inputMessage["input"] = input //交易输入
-
- bytesData, err := json.Marshal(inputMessage)
- fmt.Println(string(bytesData))
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- reader := bytes.NewReader(bytesData)
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/5301"
- //gdyb_url := ""
- gdyb_paasid := beego.AppConfig.String("gdyb_paasid")
-
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/1101"
- //url := "" + "3505"
- url := "http://hosp-gz.gd.hsip.gov.cn/ebus/gdyb_api/prd/hsa/hgs/" + "3505"
-
- fmt.Println(gdyb_paasid)
- fmt.Println(url)
- request, err := http.NewRequest("POST", url, reader)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
-
- request.Header.Set("Content-Type", "application/json;charset=UTF-8")
- request.Header.Set("x-tif-paasid", gdyb_paasid)
- request.Header.Set("x-tif-signature", signature)
- request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
- request.Header.Set("x-tif-nonce", nonce)
-
- client := http.Client{}
- resp, err := client.Do(request)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- respBytes, err := ioutil.ReadAll(resp.Body)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- str := string(respBytes)
- fmt.Println(str)
- return str, string(bytesData)
- }
- func Gzyb3506(struct3506 models.Struct3506, secret_key string) (string, string) {
- // 生成签名
- nonce := GetRandomString(32)
- timestamp := time.Now().Unix()
- signature := setSignature(timestamp, nonce, secret_key)
-
- // 生成输入报文
- //inputMessage := SetGdInputMessage(timestamp, struct3506.OrgName, struct3506.Opter, struct3506.FixmedinsCode, struct3506.InsuplcAdmdvs, struct3506.MdtrtareaAdmvs, struct3506.Cainfo)
-
- sign := GetSignInInfo(struct3506.FixmedinsCode)
- inputMessage := SetGZInputMessage(nonce, timestamp, struct3506.OrgName, struct3506.Opter, struct3506.FixmedinsCode, struct3506.InsuplcAdmdvs, struct3506.MdtrtareaAdmvs, sign)
-
- 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 //交易输入
-
- bytesData, err := json.Marshal(inputMessage)
- fmt.Println(string(bytesData))
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- reader := bytes.NewReader(bytesData)
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/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 + "3506"
- request, err := http.NewRequest("POST", url, reader)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
-
- request.Header.Set("Content-Type", "application/json;charset=UTF-8")
- request.Header.Set("x-tif-paasid", gdyb_paasid)
- request.Header.Set("x-tif-signature", signature)
- request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
- request.Header.Set("x-tif-nonce", nonce)
-
- client := http.Client{}
- resp, err := client.Do(request)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- respBytes, err := ioutil.ReadAll(resp.Body)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- str := string(respBytes)
- fmt.Println(str)
- return str, string(bytesData)
- }
- func Gzyb3507(struct3507 models.Struct3507, secret_key string) (string, string) {
- // 生成签名
- nonce := GetRandomString(32)
- timestamp := time.Now().Unix()
- signature := setSignature(timestamp, nonce, secret_key)
-
- // 生成输入报文
- //inputMessage := SetGdInputMessage(timestamp, struct3507.OrgName, struct3507.Opter, struct3507.FixmedinsCode, struct3507.InsuplcAdmdvs, struct3507.MdtrtareaAdmvs, struct3507.Cainfo)
- sign := GetSignInInfo(struct3507.FixmedinsCode)
- inputMessage := SetGZInputMessage(nonce, timestamp, struct3507.OrgName, struct3507.Opter, struct3507.FixmedinsCode, struct3507.InsuplcAdmdvs, struct3507.MdtrtareaAdmvs, sign)
-
- 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 //交易输入
-
- bytesData, err := json.Marshal(inputMessage)
- fmt.Println(string(bytesData))
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- reader := bytes.NewReader(bytesData)
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/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 + "3507"
- request, err := http.NewRequest("POST", url, reader)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
-
- request.Header.Set("Content-Type", "application/json;charset=UTF-8")
- request.Header.Set("x-tif-paasid", gdyb_paasid)
- request.Header.Set("x-tif-signature", signature)
- request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
- request.Header.Set("x-tif-nonce", nonce)
-
- client := http.Client{}
- resp, err := client.Do(request)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- respBytes, err := ioutil.ReadAll(resp.Body)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- str := string(respBytes)
- fmt.Println(str)
- return str, string(bytesData)
- }
- func Gzyb3508(struct3508 models.Struct3508, secret_key string) (string, string) {
- // 生成签名
- nonce := GetRandomString(32)
- timestamp := time.Now().Unix()
- signature := setSignature(timestamp, nonce, secret_key)
-
- // 生成输入报文
- //inputMessage := SetGdInputMessage(timestamp, struct3508.OrgName, struct3508.Opter, struct3508.FixmedinsCode, struct3508.InsuplcAdmdvs, struct3508.MdtrtareaAdmvs, struct3508.Cainfo)
-
- sign := GetSignInInfo(struct3508.FixmedinsCode)
- inputMessage := SetGZInputMessage(nonce, timestamp, struct3508.OrgName, struct3508.Opter, struct3508.FixmedinsCode, struct3508.InsuplcAdmdvs, struct3508.MdtrtareaAdmvs, sign)
-
- input := make(map[string]interface{})
- inputData := make(map[string]interface{})
- inputMessage["infno"] = "3508"
- inputData["fixmedins_code"] = struct3508.FixmedinsCode
- inputData["medins_list_codg"] = struct3508.MedListCodg
- inputData["fixmedins_bchno"] = ""
- inputData["begndate"] = struct3508.Begndate
- inputData["enddate"] = struct3508.Enddate
-
- inputData["medins_prod_inv_no"] = ""
- inputData["medins_list_name"] = ""
- inputData["rx_flag"] = ""
- inputData["list_sp_item_flag"] = ""
- inputData["trdn_flag"] = ""
- inputData["invdate"] = ""
- inputData["manu_lotnum"] = ""
- inputData["manu_date"] = ""
- inputData["expy_end"] = ""
- inputData["memo"] = ""
- inputData["vali_flag"] = ""
- inputData["rid"] = ""
- inputData["crter_id"] = ""
- inputData["crter_name"] = ""
- inputData["crte_optins_no"] = ""
- inputData["opter_id"] = ""
- inputData["opter_name"] = ""
- inputData["optins_no"] = ""
- inputData["poolarea_no"] = ""
- inputData["fixmedins_bchno"] = ""
- inputData["inv_data_type"] = ""
- input["data"] = inputData
- inputMessage["input"] = input //交易输入
-
- bytesData, err := json.Marshal(inputMessage)
- fmt.Println(string(bytesData))
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- 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 + "3508"
- request, err := http.NewRequest("POST", url, reader)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
-
- request.Header.Set("Content-Type", "application/json;charset=UTF-8")
- request.Header.Set("x-tif-paasid", gdyb_paasid)
- request.Header.Set("x-tif-signature", signature)
- request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
- request.Header.Set("x-tif-nonce", nonce)
-
- client := http.Client{}
- resp, err := client.Do(request)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- respBytes, err := ioutil.ReadAll(resp.Body)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- str := string(respBytes)
- fmt.Println(str)
- return str, string(bytesData)
- }
- func Gzyb3509(struct3509 models.Struct3509, secret_key string) (string, string) {
- // 生成签名
- nonce := GetRandomString(32)
- timestamp := time.Now().Unix()
- signature := setSignature(timestamp, nonce, secret_key)
-
- // 生成输入报文
- //inputMessage := SetGdInputMessage(timestamp, struct3509.OrgName, struct3509.Opter, struct3509.FixmedinsCode, struct3509.InsuplcAdmdvs, struct3509.MdtrtareaAdmvs, struct3509.Cainfo)
-
- sign := GetSignInInfo(struct3509.FixmedinsCode)
- inputMessage := SetGZInputMessage(nonce, timestamp, struct3509.OrgName, struct3509.Opter, struct3509.FixmedinsCode, struct3509.InsuplcAdmdvs, struct3509.MdtrtareaAdmvs, sign)
-
- input := make(map[string]interface{})
- inputData := make(map[string]interface{})
- inputMessage["infno"] = "3509"
- inputData["fixmedins_code"] = struct3509.FixmedinsCode
- //inputData["med_list_codg"] = struct3509.MedinsListCodg
- inputData["medins_list_codg"] = struct3509.MedListCodg
-
- inputData["fixmedins_bchno"] = ""
- inputData["begndate"] = struct3509.Begndate
- inputData["enddate"] = struct3509.Enddate
- inputData["medins_prod_inv_no"] = ""
- inputData["medins_list_name"] = ""
- inputData["rx_flag"] = ""
- inputData["list_sp_item_flag"] = ""
- inputData["trdn_flag"] = ""
- inputData["invdate"] = ""
- inputData["manu_lotnum"] = ""
- inputData["manu_date"] = ""
- inputData["expy_end"] = ""
- inputData["memo"] = ""
- inputData["vali_flag"] = ""
- inputData["rid"] = ""
-
- inputData["crter_id"] = ""
- inputData["crter_name"] = ""
- inputData["crte_optins_no"] = ""
- inputData["opter_id"] = ""
- inputData["opter_name"] = ""
- inputData["optins_no"] = ""
- inputData["poolarea_no"] = ""
-
- inputData["fixmedins_bchno"] = ""
- inputData["inv_data_type"] = ""
-
- input["data"] = inputData
- inputMessage["input"] = input //交易输入
-
- bytesData, err := json.Marshal(inputMessage)
- fmt.Println(string(bytesData))
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- 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 + "3509"
- request, err := http.NewRequest("POST", url, reader)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
-
- request.Header.Set("Content-Type", "application/json;charset=UTF-8")
- request.Header.Set("x-tif-paasid", gdyb_paasid)
- request.Header.Set("x-tif-signature", signature)
- request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
- request.Header.Set("x-tif-nonce", nonce)
-
- client := http.Client{}
- resp, err := client.Do(request)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- respBytes, err := ioutil.ReadAll(resp.Body)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- str := string(respBytes)
- fmt.Println(str)
- return str, string(bytesData)
- }
- func Gzyb3510(struct3510 models.Struct3510, secret_key string) (string, string) {
- // 生成签名
- nonce := GetRandomString(32)
- timestamp := time.Now().Unix()
- signature := setSignature(timestamp, nonce, secret_key)
-
- // 生成输入报文
- //inputMessage := SetGdInputMessage(timestamp, struct3510.OrgName, struct3510.Opter, struct3510.FixmedinsCode, struct3510.InsuplcAdmdvs, struct3510.MdtrtareaAdmvs, struct3510.Cainfo)
-
- sign := GetSignInInfo(struct3510.FixmedinsCode)
- inputMessage := SetGZInputMessage(nonce, timestamp, struct3510.OrgName, struct3510.Opter, struct3510.FixmedinsCode, struct3510.InsuplcAdmdvs, struct3510.MdtrtareaAdmvs, sign)
-
- input := make(map[string]interface{})
- inputData := make(map[string]interface{})
- inputMessage["infno"] = "3510"
- inputData["fixmedins_code"] = struct3510.FixmedinsCode
- //inputData["medins_list_codg"] = struct3510.MedinsListCodg
- inputData["medins_list_codg"] = struct3510.MedListCodg
-
- inputData["fixmedins_bchno"] = ""
- inputData["begndate"] = struct3510.Begndate
- inputData["enddate"] = struct3510.Enddate
- inputData["medins_prod_inv_no"] = ""
- inputData["medins_list_name"] = ""
- inputData["rx_flag"] = ""
- inputData["list_sp_item_flag"] = ""
- inputData["trdn_flag"] = ""
- inputData["invdate"] = ""
- inputData["manu_lotnum"] = ""
- inputData["manu_date"] = ""
- inputData["expy_end"] = ""
- inputData["memo"] = ""
- inputData["vali_flag"] = ""
- inputData["rid"] = ""
-
- inputData["crter_id"] = ""
- inputData["crter_name"] = ""
- inputData["crte_optins_no"] = ""
- inputData["opter_id"] = ""
- inputData["opter_name"] = ""
- inputData["optins_no"] = ""
- inputData["poolarea_no"] = ""
-
- inputData["fixmedins_bchno"] = ""
- inputData["inv_data_type"] = ""
-
- input["data"] = inputData
- inputMessage["input"] = input //交易输入
-
- bytesData, err := json.Marshal(inputMessage)
- fmt.Println(string(bytesData))
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- 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 + "3510"
- request, err := http.NewRequest("POST", url, reader)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
-
- request.Header.Set("Content-Type", "application/json;charset=UTF-8")
- request.Header.Set("x-tif-paasid", gdyb_paasid)
- request.Header.Set("x-tif-signature", signature)
- request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
- request.Header.Set("x-tif-nonce", nonce)
-
- client := http.Client{}
- resp, err := client.Do(request)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- respBytes, err := ioutil.ReadAll(resp.Body)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- str := string(respBytes)
- fmt.Println(str)
- return str, string(bytesData)
- }
- func Gzyb3511(struct3511 models.Struct3511, secret_key string) (string, string) {
- // 生成签名
- nonce := GetRandomString(32)
- timestamp := time.Now().Unix()
- signature := setSignature(timestamp, nonce, secret_key)
-
- // 生成输入报文
- //inputMessage := SetGdInputMessage(timestamp, struct3511.OrgName, struct3511.Opter, struct3511.FixmedinsCode, struct3511.InsuplcAdmdvs, struct3511.MdtrtareaAdmvs, struct3511.Cainfo)
-
- sign := GetSignInInfo(struct3511.FixmedinsCode)
- inputMessage := SetGZInputMessage(nonce, timestamp, struct3511.OrgName, struct3511.Opter, struct3511.FixmedinsCode, struct3511.InsuplcAdmdvs, struct3511.MdtrtareaAdmvs, sign)
-
- input := make(map[string]interface{})
- inputData := make(map[string]interface{})
- inputMessage["infno"] = "3511"
- inputData["fixmedins_code"] = struct3511.FixmedinsCode
- //inputData["medins_list_codg"] = struct3511.MedinsListCodg
- inputData["medins_list_codg"] = struct3511.MedListCodg
-
- inputData["fixmedins_bchno"] = ""
- inputData["begndate"] = struct3511.Begndate
- inputData["enddate"] = struct3511.Enddate
- inputData["medins_prod_inv_no"] = ""
- inputData["medins_list_name"] = ""
- inputData["rx_flag"] = ""
- inputData["list_sp_item_flag"] = ""
- inputData["trdn_flag"] = ""
- inputData["invdate"] = ""
- inputData["manu_lotnum"] = ""
- inputData["manu_date"] = ""
- inputData["expy_end"] = ""
- inputData["memo"] = ""
- inputData["vali_flag"] = ""
- inputData["rid"] = ""
-
- inputData["crter_id"] = ""
- inputData["crter_name"] = ""
- inputData["crte_optins_no"] = ""
- inputData["opter_id"] = ""
- inputData["opter_name"] = ""
- inputData["optins_no"] = ""
- inputData["poolarea_no"] = ""
-
- inputData["fixmedins_bchno"] = ""
- inputData["inv_data_type"] = ""
-
- input["data"] = inputData
- inputMessage["input"] = input //交易输入
-
- bytesData, err := json.Marshal(inputMessage)
- fmt.Println(string(bytesData))
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- 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 + "3511"
- request, err := http.NewRequest("POST", url, reader)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
-
- request.Header.Set("Content-Type", "application/json;charset=UTF-8")
- request.Header.Set("x-tif-paasid", gdyb_paasid)
- request.Header.Set("x-tif-signature", signature)
- request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
- request.Header.Set("x-tif-nonce", nonce)
-
- client := http.Client{}
- resp, err := client.Do(request)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- respBytes, err := ioutil.ReadAll(resp.Body)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- str := string(respBytes)
- fmt.Println(str)
- return str, string(bytesData)
- }
- func Gzyb3512(struct3512 models.Struct3512, secret_key string) (string, string) {
- // 生成签名
- nonce := GetRandomString(32)
- timestamp := time.Now().Unix()
- signature := setSignature(timestamp, nonce, secret_key)
-
- // 生成输入报文
- //inputMessage := SetGdInputMessage(timestamp, struct3512.OrgName, struct3512.Opter, struct3512.FixmedinsCode, struct3512.InsuplcAdmdvs, struct3512.MdtrtareaAdmvs, struct3512.Cainfo)
-
- sign := GetSignInInfo(struct3512.FixmedinsCode)
- inputMessage := SetGZInputMessage(nonce, timestamp, struct3512.OrgName, struct3512.Opter, struct3512.FixmedinsCode, struct3512.InsuplcAdmdvs, struct3512.MdtrtareaAdmvs, sign)
-
- input := make(map[string]interface{})
- inputData := make(map[string]interface{})
- inputMessage["infno"] = "3512"
- inputData["fixmedins_code"] = struct3512.FixmedinsCode
- //inputData["medins_list_codg"] = struct3512.MedinsListCodg
- inputData["medins_list_codg"] = struct3512.MedListCodg
- inputData["fixmedins_bchno"] = ""
- inputData["begndate"] = struct3512.Begndate
- inputData["enddate"] = struct3512.Enddate
- inputData["medins_prod_inv_no"] = ""
- inputData["medins_list_name"] = ""
- inputData["rx_flag"] = ""
- inputData["list_sp_item_flag"] = ""
- inputData["trdn_flag"] = ""
- inputData["invdate"] = ""
- inputData["manu_lotnum"] = ""
- inputData["manu_date"] = ""
- inputData["expy_end"] = ""
- inputData["memo"] = ""
- inputData["vali_flag"] = ""
- inputData["rid"] = ""
-
- inputData["crter_id"] = ""
- inputData["crter_name"] = ""
- inputData["crte_optins_no"] = ""
- inputData["opter_id"] = ""
- inputData["opter_name"] = ""
- inputData["optins_no"] = ""
- inputData["poolarea_no"] = ""
-
- inputData["fixmedins_bchno"] = ""
- inputData["inv_data_type"] = ""
-
- input["data"] = inputData
- inputMessage["input"] = input //交易输入
-
- bytesData, err := json.Marshal(inputMessage)
- fmt.Println(string(bytesData))
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- 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 + "3512"
- request, err := http.NewRequest("POST", url, reader)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
-
- request.Header.Set("Content-Type", "application/json;charset=UTF-8")
- request.Header.Set("x-tif-paasid", gdyb_paasid)
- request.Header.Set("x-tif-signature", signature)
- request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
- request.Header.Set("x-tif-nonce", nonce)
-
- client := http.Client{}
- resp, err := client.Do(request)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- respBytes, err := ioutil.ReadAll(resp.Body)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- str := string(respBytes)
- fmt.Println(str)
- return str, string(bytesData)
- }
- func Gzyb3513(struct3513 models.Struct3513, secret_key string) (string, string) {
- // 生成签名
- nonce := GetRandomString(32)
- timestamp := time.Now().Unix()
- signature := setSignature(timestamp, nonce, secret_key)
-
- // 生成输入报文
- //inputMessage := SetGdInputMessage(timestamp, struct3513.OrgName, struct3513.Opter, struct3513.FixmedinsCode, struct3513.InsuplcAdmdvs, struct3513.MdtrtareaAdmvs, struct3513.Cainfo)
- sign := GetSignInInfo(struct3513.FixmedinsCode)
- inputMessage := SetGZInputMessage(nonce, timestamp, struct3513.OrgName, struct3513.Opter, struct3513.FixmedinsCode, struct3513.InsuplcAdmdvs, struct3513.MdtrtareaAdmvs, sign)
-
- input := make(map[string]interface{})
- inputData := make(map[string]interface{})
- inputMessage["infno"] = "3513"
- inputData["fixmedins_code"] = struct3513.FixmedinsCode
- //inputData["medins_list_codg"] = struct3513.MedinsListCodg
- inputData["medins_list_codg"] = struct3513.MedListCodg
-
- inputData["fixmedins_bchno"] = ""
- inputData["begndate"] = struct3513.Begndate
- inputData["enddate"] = struct3513.Enddate
- inputData["medins_prod_inv_no"] = ""
- inputData["med_list_codg"] = ""
- inputData["medins_list_name"] = ""
- inputData["rx_flag"] = ""
- inputData["list_sp_item_flag"] = ""
- inputData["trdn_flag"] = ""
- inputData["invdate"] = ""
- inputData["manu_lotnum"] = ""
- inputData["manu_date"] = ""
- inputData["expy_end"] = ""
- inputData["memo"] = ""
- inputData["vali_flag"] = ""
- inputData["rid"] = ""
-
- inputData["crter_id"] = ""
- inputData["crter_name"] = ""
- inputData["crte_optins_no"] = ""
- inputData["opter_id"] = ""
- inputData["opter_name"] = ""
- inputData["optins_no"] = ""
- inputData["poolarea_no"] = ""
-
- inputData["fixmedins_bchno"] = ""
- inputData["inv_data_type"] = ""
-
- input["data"] = inputData
- inputMessage["input"] = input //交易输入
-
- bytesData, err := json.Marshal(inputMessage)
- fmt.Println(string(bytesData))
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- 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 + "3513"
- request, err := http.NewRequest("POST", url, reader)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
-
- request.Header.Set("Content-Type", "application/json;charset=UTF-8")
- request.Header.Set("x-tif-paasid", gdyb_paasid)
- request.Header.Set("x-tif-signature", signature)
- request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
- request.Header.Set("x-tif-nonce", nonce)
-
- client := http.Client{}
- resp, err := client.Do(request)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- respBytes, err := ioutil.ReadAll(resp.Body)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- str := string(respBytes)
- fmt.Println(str)
- return str, string(bytesData)
- }
-
- // 生成基础报文
- func SetGZInputMessage(nonce string, timestamp int64, org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, sign 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"] = "" // 设备编号
- inputMessage["dev_safe_info"] = "" // 设备安全信息
- inputMessage["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["sign_no"] = GetSignInInfo(fixmedins_code) //交易签到流水号
-
- //inputMessage["sign_no"] = "GZYBCS4101A20220202"
- return inputMessage
- }
|