1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350 |
- package sg
-
- import (
- "archive/zip"
- "bytes"
- "encoding/json"
- "fmt"
- "gdyb/controllers"
- "gdyb/enums"
- "gdyb/models"
- "gdyb/service"
- "gdyb/utils"
- "github.com/astaxie/beego"
- "github.com/axgle/mahonia"
- "github.com/shopspring/decimal"
- "io"
- "io/ioutil"
- "math/rand"
- "net/http"
- "os"
- "path/filepath"
- "strconv"
- "strings"
- "syscall"
- "time"
- "unsafe"
- )
-
- type HisApiController struct {
- controllers.BaseAuthAPIController
- }
-
- func NewHisManagerApiRegistRouters() {
- //挂号
- beego.Router("/api/register/get", &HisApiController{}, "get:GetRegisterInfo")
- //上传就诊信息-上传明细-结算
- beego.Router("/api/upload/get", &HisApiController{}, "get:GetUploadInfo")
- //查询
- beego.Router("/api/settle/query", &HisApiController{}, "get:GetSettleAccounts")
- //对总账
- beego.Router("/api/checkaccount/get", &HisApiController{}, "get:GetCheckAccount")
- //对明细
- beego.Router("/api/checkdetailaccount/get", &HisApiController{}, "get:GetCheckDetailAccount")
- //退费,退明细
- beego.Router("/api/refund/post", &HisApiController{}, "get:Refund")
- //退号
- beego.Router("/api/refundnumber/post", &HisApiController{}, "get:RefundNumber")
- //退明细
- beego.Router("/api/refunddetail/post", &HisApiController{}, "get:RefundDetail")
-
- beego.Router("/api/treatment/check", &HisApiController{}, "get:CheckTreatment")
- beego.Router("/api/org/info", &HisApiController{}, "get:GetOrgInfo")
- //beego.Router("/api/readcard", &HisApiController{}, "get:ReadCard")
- beego.Router("/api/presettle/get", &HisApiController{}, "get:GetPreUploadInfo")
- beego.Router("/api/310", &HisApiController{}, "get:Check310")
- beego.Router("/api/390", &HisApiController{}, "get:Check390")
- beego.Router("/api/patient/info", &HisApiController{}, "get:GetPatientInfo")
- beego.Router("/api/checkcode/get", &HisApiController{}, "get:GetCheckCode")
- beego.Router("/api/uncheckcode/get", &HisApiController{}, "get:UnCheckCode")
- beego.Router("/api/psn/putonrecord", &HisApiController{}, "get:PsnPutOnRecord")
- beego.Router("/api/psn/unputonrecord", &HisApiController{}, "get:PsnUnPutOnRecord")
- beego.Router("/api/psn/ncds/putonrecord", &HisApiController{}, "get:PsnPutNCDSOnRecord")
- beego.Router("/api/psn/ncds/unputonrecord", &HisApiController{}, "get:PsnPutUnNCDSOnRecord")
- beego.Router("/api/reversal", &HisApiController{}, "get:ReversalData")
- beego.Router("/api/reversal/other", &HisApiController{}, "get:ReversalOtherData")
- beego.Router("/api/settlelist/get", &HisApiController{}, "get:GetSettleList")
- beego.Router("/api/settlelisthosptial/get", &HisApiController{}, "get:GetSettleListHospital")
-
- beego.Router("/api/pwd/check", &HisApiController{}, "get:CheckCardPWD")
- beego.Router("/api/insutype/check", &HisApiController{}, "get:CheckInsutype")
- beego.Router("/api/batchsettlelist/get", &HisApiController{}, "get:GetBatchSettleList")
- beego.Router("/api/psn/info", &HisApiController{}, "get:GetPsnNcdsInfo")
-
- beego.Router("/api/check", &HisApiController{}, "get:Check")
- beego.Router("/api/check3101", &HisApiController{}, "get:Check3101")
- beego.Router("/api/check3102", &HisApiController{}, "get:Check3102")
-
- beego.Router("/90990", &HisApiController{}, "get:CheckCardPWDTwo")
- beego.Router("/9001", &HisApiController{}, "get:Get9001")
- beego.Router("/9002", &HisApiController{}, "get:Get9002")
- beego.Router("/2505", &HisApiController{}, "get:Get2505")
- beego.Router("/2503", &HisApiController{}, "get:Get2503")
- beego.Router("/5301", &HisApiController{}, "get:Get5301")
- beego.Router("/2504", &HisApiController{}, "get:Get2504")
- beego.Router("/1160", &HisApiController{}, "get:Get1160")
- beego.Router("/2001", &HisApiController{}, "get:Get2001")
-
- // beego.Router("/api/gzpatient/get", &HisApiController{}, "get:GetGZPatientInfo")
-
- beego.Router("/api/readelecard", &HisApiController{}, "get:ReadEleCard")
-
- }
-
- // func (c *HisApiController) GetGZPatientInfo() {
- // id_card_no := c.GetString("id_card_no")
- // admin_user_id, _ := c.GetInt64("admin_user_id")
-
- // patient, _ := service.GetPatientByIDCard(id_card_no, c.GetAdminUserInfo().CurrentOrgId)
-
- // if patient.ID == 0 {
- // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodePatientNoExist)
- // return
- // }
- // role, _ := service.GetAdminUserInfoByID(c.GetAdminUserInfo().CurrentOrgId, admin_user_id)
- // miConfig, _ := service.FindMedicalInsuranceInfo(c.GetAdminUserInfo().CurrentOrgId)
- // config, _ := service.GetMedicalInsuranceConfig(c.GetAdminUserInfo().CurrentOrgId)
-
- // var result string
- // var request_log string
- // var result_log string
- // result, request_log, result_log = service.ZHGdyb1101(patient.IdCardNo, miConfig.OrgName, role.UserName, miConfig.Code, miConfig.InsuplcAdmdvs, miConfig. MdtrtareaAdmvs, miConfig.SecretKey, 2, "", 1, patient.Name)
- // var dat map[string]interface{}
- // if err := json.Unmarshal([]byte(result), &dat); err == nil {
- // fmt.Println(dat)
- // } else {
- // fmt.Println(err)
- // }
-
- // userJSONBytes, _ := json.Marshal(dat)
- // var res ResultTwo
- // var resTwo10265 ResultTwo10265
-
- // if miConfig.Code == "H15049901371" {
- // if err := json.Unmarshal(userJSONBytes, &resTwo10265); err != nil {
- // utils.ErrorLog("解析失败:%v", err)
- // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- // return
- // }
-
- // Infcode, _ := strconv.ParseInt(resTwo10265.Infcode, 10, 64)
- // res.Infcode = Infcode
- // res.ErrMsg = resTwo10265.ErrMsg
- // res.Output = resTwo10265.Output
- // res.InfRefmsgid = resTwo10265.InfRefmsgid
- // res.RespondTime = resTwo10265.RespondTime
- // res.WarnInfo = resTwo10265.WarnInfo
-
- // } else {
- // if err := json.Unmarshal(userJSONBytes, &res); err != nil {
- // utils.ErrorLog("解析失败:%v", err)
- // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- // return
- // }
-
- // }
-
- // var insutypes []string
- // var insutype string
- // var is390 int = 0
- // var is310 int = 0
- // for _, item := range res.Output.Iinfo {
- // if (item.Insutype == "390" && item.PsnInsuStas == "1") || (item.Insutype == "310" && item.PsnInsuStas == "1") {
- // insutypes = append(insutypes, item.Insutype)
- // }
- // }
- // if len(insutypes) == 1 {
- // insutype = insutypes[0]
- // } else {
- // for _, i := range insutypes {
- // if i == "390" {
- // is390 = 1
- // }
-
- // if i == "310" {
- // is310 = 1
- // }
- // }
- // }
- // if is390 == 1 {
- // insutype = "390"
- // }
- // if is310 == 1 {
- // insutype = "310"
- // }
- // if len(insutypes) == 0 {
- // insutype = "310"
- // }
- // if res.Infcode != 0 {
- // c.ServeSuccessJSON(map[string]interface{}{
- // "failed_code": -10,
- // "msg": res.ErrMsg,
- // })
- // } else {
- // c.ServeSuccessJSON(map[string]interface{}{
- // "failed_code": 0,
- // "info": res,
- // "insutype": insutype,
- // })
- // }
-
- // }
- func (c *HisApiController) Get9002() {
- adminUser := c.GetAdminUserInfo()
- miConfig, _ := service.FindMedicalInsuranceInfo(adminUser.CurrentOrgId)
- roles, _ := service.GetAdminUserInfoByID(adminUser.CurrentOrgId, 185)
- service.Gdyb9002(miConfig.OrgName, roles.UserName, miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, 1669)
-
- }
- func (c *HisApiController) Get2001() {
-
- adminUser := c.GetAdminUserInfo()
- miConfig, _ := service.FindMedicalInsuranceInfo(adminUser.CurrentOrgId)
-
- baseParams := models.BaseParams{
- SecretKey: "h1hEqxQm12ryULCgPKolkid8S9hZFu6M",
- FixmedinsCode: miConfig.Code,
- InsuplcAdmdvs: "441599",
- MdtrtareaAdmvs: "440100",
- OrgName: miConfig.OrgName,
- Doctor: "1111",
- }
- service.Gdyb2001(baseParams, "441500CS000000301426", "310", "11")
- }
- func (c *HisApiController) Get1160() {
-
- adminUser := c.GetAdminUserInfo()
- miConfig, _ := service.FindMedicalInsuranceInfo(adminUser.CurrentOrgId)
-
- baseParams := models.BaseParams{
- SecretKey: "h1hEqxQm12ryULCgPKolkid8S9hZFu6M",
- FixmedinsCode: miConfig.Code,
- InsuplcAdmdvs: "440100",
- MdtrtareaAdmvs: "440100",
- OrgName: miConfig.OrgName,
- Doctor: "1111",
- }
- service.Gdyb1160(baseParams, "441500CS000000301426", "310", "14")
- }
-
- func (c *HisApiController) Get2504() {
- adminUser := c.GetAdminUserInfo()
- miConfig, _ := service.FindMedicalInsuranceInfo(adminUser.CurrentOrgId)
- result := service.Gdyb2504("441500CS000000301426", miConfig.OrgName, "admin", miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, "20220629626617")
- fmt.Println(result)
-
- }
-
- func (c *HisApiController) Get5301() {
- adminUser := c.GetAdminUserInfo()
- miConfig, _ := service.FindMedicalInsuranceInfo(adminUser.CurrentOrgId)
- result := service.Gdyb5301("44010000003501822495", miConfig.OrgName, "admin", miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey)
- fmt.Println(result)
-
- }
- func (c *HisApiController) Get2505() {
- adminUser := c.GetAdminUserInfo()
- miConfig, _ := service.FindMedicalInsuranceInfo(adminUser.CurrentOrgId)
- result := service.Gdyb2505("44010000003501822495", "admin", miConfig.OrgName, miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, "2022-01-01 12:35:39", "2022-12-30 12:35:39")
- fmt.Println(result)
- }
-
- func (c *HisApiController) Get2503() {
-
- adminUser := c.GetAdminUserInfo()
- miConfig, _ := service.FindMedicalInsuranceInfo(adminUser.CurrentOrgId)
- result := service.Gdyb2503ForGz("441500CS000000301426", "310", miConfig.OrgName, "方军", miConfig.Code, "1", "441599", miConfig.MdtrtareaAdmvs, miConfig.SecretKey, "慢性肾功能不全(血液治疗)", "M07803", "2022-01-01 12:35:39", "2022-12-30 12:35:39", "2022-06-28 00:00:00")
- fmt.Println(result)
- }
-
- func (c *HisApiController) Get9001() {
- adminUser := c.GetAdminUserInfo()
- miConfig, _ := service.FindMedicalInsuranceInfo(adminUser.CurrentOrgId)
- roles, _ := service.GetAdminUserInfoByID(adminUser.CurrentOrgId, 185)
- result, inputLog := service.Gdyb9001(miConfig.OrgName, roles.UserName, miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, 1669)
- var dat map[string]interface{}
- if err := json.Unmarshal([]byte(result), &dat); err == nil {
- fmt.Println(dat)
- } else {
- fmt.Println(err)
- }
- userJSONBytes, _ := json.Marshal(dat)
- var res models.Result9001
- if err := json.Unmarshal(userJSONBytes, &res); err != nil {
- utils.ErrorLog("解析失败:%v", err)
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
- if res.Infcode == 0 {
- sign := models.HisSignIn{
- UserOrgId: c.GetAdminUserInfo().CurrentOrgId,
- SignNo: res.Output.Result.SignNo,
- SignTime: res.Output.Result.SignTime,
- Ctime: time.Now().Unix(),
- Mtime: time.Now().Unix(),
- Status: 1,
- InputLog: inputLog,
- OutputLog: result,
- FixmedinsCode: miConfig.Code,
- }
- err := service.CreateSignIn(&sign)
- if err == nil {
- c.ServeSuccessJSON(map[string]interface{}{
- "msg": "签到成功",
- })
- }
- }
- }
- func (c *HisApiController) Check3101() {
- patient_id, _ := c.GetInt64("patient_id")
- his_patient_id, _ := c.GetInt64("his_patient_id")
- admin_user_id, _ := c.GetInt64("admin_user_id")
- adminUser := c.GetAdminUserInfo()
- roles, _ := service.GetAdminUserInfoByID(c.GetAdminUserInfo().CurrentOrgId, admin_user_id)
- his, _ := service.GetNewHisPatientInfoFour(c.GetAdminUserInfo().CurrentOrgId, his_patient_id)
- miConfig, _ := service.FindMedicalInsuranceInfo(c.GetAdminUserInfo().CurrentOrgId)
- record_time := c.GetString("record_time")
- trig_scen := c.GetString("trig_scen")
-
- timeLayout := "2006-01-02"
- loc, _ := time.LoadLocation("Local")
- theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", record_time+" 00:00:00", loc)
- if err != nil {
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
- return
- }
- recordDateTime := theTime.Unix()
-
- var patientPrescription models.HisPrescriptionInfo
- patientPrescription, _ = service.FindHisPatientPrescriptionInfo(adminUser.CurrentOrgId, his_patient_id, recordDateTime)
- if patientPrescription.ID == 0 {
- patientPrescription, _ = service.FindLastPatientPrescriptionInfo(adminUser.CurrentOrgId, patient_id, recordDateTime)
- }
- department, _ := service.GetDepartMentDetail(patientPrescription.Departments)
- doctor_info, _ := service.GetAdminUserInfoByID(adminUser.CurrentOrgId, patientPrescription.DoctorId)
- //
- diagnosis_ids := strings.Split(patientPrescription.Diagnosis, ",")
-
- prescriptions, _ := service.GetNewHisPrescriptionTen(adminUser.CurrentOrgId, his_patient_id, recordDateTime)
-
- var pp models.PublicParams
- pp.InsuplcAdmdvs = miConfig.InsuplcAdmdvs
- pp.MdtrtareaAdmvs = miConfig.MdtrtareaAdmvs
- pp.FixmedinsName = miConfig.OrgName
- pp.FixmedinsCode = miConfig.Code
-
- pp.RequestUrl = miConfig.Url
- pp.Cainfo = miConfig.Cainfo
- pp.SecretKey = miConfig.SecretKey
- pp.AccessKey = miConfig.AccessKey
- pp.OpterName = roles.UserName
-
- var config []*models.HisXtDiagnoseConfig
- for _, item := range diagnosis_ids {
- id, _ := strconv.ParseInt(item, 10, 64)
- diagnosisConfig, _ := service.FindDiagnoseById(id)
- config = append(config, &diagnosisConfig)
- }
-
- var pd models.PatientDtos
- pd.PatnID = his.PsnNo
- pd.PatnName = his.Name
- pd.Gend = his.Gend
- pd.Brdy = his.Brdy
- pd.Poolarea = his.InsuplcAdmdvs
- pd.CurrMdtrtID = his.Number
-
- var fed models.FsiEncounterDtos
- fed.MdtrtID = his.Number
- fed.MedinsID = miConfig.Code
- fed.MedinsName = miConfig.OrgName
- fed.MedinsAdmdvs = miConfig.MdtrtareaAdmvs
- fed.MedMdtrtType = "1"
- fed.MedinsType = "1"
- fed.MedinsLv = "11"
- tm := time.Unix(his.RecordDate, 0)
- s_tm := tm.Format("2006-01-02 15:04:05")
- fed.AdmDate = s_tm
- fed.DscgDate = s_tm
- fed.DscgMainDiseCodg = config[0].CountryCode
- fed.DscgMainDiseName = config[0].CountryContentName
- //诊断信息
- var fdds []*models.FsiDiagnoseDtos
- for index, item := range config {
- if index == 0 {
- var fdd models.FsiDiagnoseDtos
- fdd.DiseID = strconv.FormatInt(item.ID, 10)
- fdd.InoutDiseType = "1"
- fdd.MaindiseFlag = "1"
- fdd.DiseDate = s_tm
- fdd.DiasSrtNo = "1"
- fdd.DiseName = item.CountryContentName
- fdd.DiseCodg = item.CountryCode
- fdds = append(fdds, &fdd)
-
- } else {
- var fdd models.FsiDiagnoseDtos
- fdd.DiseID = strconv.FormatInt(item.ID, 10)
- fdd.InoutDiseType = "1"
- fdd.MaindiseFlag = "1"
- fdd.DiseDate = s_tm
- fdd.DiasSrtNo = strconv.FormatInt(int64(index), 10)
- fdd.DiseName = item.CountryContentName
- fdd.DiseCodg = item.CountryCode
- fdds = append(fdds, &fdd)
- }
- }
- fed.DrCodg = strconv.FormatInt(doctor_info.ID, 10)
- fed.AdmDeptCodg = strconv.FormatInt(department.ID, 10)
- fed.AdmDeptName = department.Name
- fed.DscgDeptCodg = strconv.FormatInt(department.ID, 10)
- fed.DscgDeptName = department.Name
- fed.MedMdtrtType = "1"
- fed.MedType = "11"
- //if his.Insutype == "390" {
- // fed.MedType = "1402"
- //} else {
- // fed.MedType = "9933"
- //}
- var orders []*models.FsiOrderDtos
-
- if trig_scen == "2" {
- //处方医嘱信息
- for _, item := range prescriptions {
- for _, subItem := range item.HisDoctorAdviceInfo {
- var order models.FsiOrderDtos
- order.RxID = strconv.FormatInt(item.ID, 10)
- order.Rxno = strconv.FormatInt(item.ID, 10)
- order.LongDrordFlag = "0"
- order.HilistType = "1"
- order.ChrgType = "1"
- order.DrordBhvr = "-"
- order.HilistCode = subItem.BaseDrugLib.MedicalInsuranceNumber
- order.HosplistName = subItem.BaseDrugLib.DrugName
- order.HilistLv = "1"
- order.HilistPric = fmt.Sprintf("%.2f", subItem.Price)
- order.HosplistCode = subItem.BaseDrugLib.MedicalInsuranceNumber
- order.HosplistName = subItem.BaseDrugLib.DrugName
- order.Cnt = fmt.Sprintf("%.2f", subItem.PrescribingNumber)
- order.Pric = fmt.Sprintf("%.2f", subItem.Price)
- order.Sumamt = fmt.Sprintf("%.2f", (subItem.PrescribingNumber * subItem.Price))
- order.OwnpayAmt = ""
- order.SelfpayAmt = ""
- order.Spec = ""
- order.SpecUnt = ""
- order.DrordBegnDate = s_tm
- order.DrordStopDate = ""
- order.DrordDrCodg = "1"
- order.DrordDeptName = department.Name
- order.DrordDrCodg = "1"
- order.DrordDrName = doctor_info.UserName
- order.DrordDrProfttl = ""
- order.CurrDrordFlag = "1"
- orders = append(orders, &order)
- }
- for _, subItem := range item.HisPrescriptionProject {
- if subItem.Type == 2 {
- var order models.FsiOrderDtos
- order.RxID = strconv.FormatInt(item.ID, 10)
- order.Rxno = strconv.FormatInt(item.ID, 10)
- order.LongDrordFlag = "0"
- order.HilistType = "1"
- order.ChrgType = "1"
- order.DrordBhvr = "-"
- order.HilistCode = subItem.HisProject.MedicalCode
- order.HosplistName = subItem.HisProject.ProjectName
- order.HilistLv = "1"
- order.HilistPric = fmt.Sprintf("%.2f", subItem.Price)
- order.HosplistCode = subItem.HisProject.MedicalCode
- order.HosplistName = subItem.HisProject.ProjectName
- order.Cnt = subItem.Count
- cnt, _ := strconv.ParseFloat(subItem.Count, 64)
- order.Pric = fmt.Sprintf("%.2f", subItem.Price)
- order.Sumamt = fmt.Sprintf("%.2f", subItem.Price*cnt)
- order.OwnpayAmt = ""
- order.SelfpayAmt = ""
- order.Spec = ""
- order.SpecUnt = ""
- order.DrordBegnDate = s_tm
- order.DrordStopDate = ""
- order.DrordDrCodg = "1"
- order.DrordDeptName = department.Name
- order.DrordDrCodg = "1"
- order.DrordDrName = doctor_info.UserName
- order.DrordDrProfttl = ""
- order.CurrDrordFlag = "1"
- orders = append(orders, &order)
-
- }
- if subItem.Type == 3 {
-
- var order models.FsiOrderDtos
- order.RxID = strconv.FormatInt(item.ID, 10)
- order.Rxno = strconv.FormatInt(item.ID, 10)
- order.LongDrordFlag = "0"
- order.HilistType = "1"
- order.ChrgType = "1"
- order.DrordBhvr = "-"
- order.HilistCode = subItem.GoodInfo.MedicalInsuranceNumber
- order.HosplistName = subItem.GoodInfo.GoodName
- order.HilistLv = "1"
- order.HilistPric = fmt.Sprintf("%.2f", subItem.Price)
- order.HosplistCode = subItem.GoodInfo.MedicalInsuranceNumber
- order.HosplistName = subItem.GoodInfo.GoodName
- order.Cnt = subItem.Count
- cnt, _ := strconv.ParseFloat(subItem.Count, 64)
- order.Pric = fmt.Sprintf("%.2f", subItem.Price)
- order.Sumamt = fmt.Sprintf("%.2f", subItem.Price*cnt)
- order.OwnpayAmt = ""
- order.SelfpayAmt = ""
- order.Spec = ""
- order.SpecUnt = ""
- order.DrordBegnDate = s_tm
- order.DrordStopDate = ""
- order.DrordDrCodg = "1"
- order.DrordDeptName = department.Name
- order.DrordDrCodg = "1"
- order.DrordDrName = doctor_info.UserName
- order.DrordDrProfttl = ""
- order.CurrDrordFlag = "1"
- orders = append(orders, &order)
-
- }
- }
- }
- //处方医嘱信息
- }
- fed.MatnStas = "0"
- fed.MedfeeSumamt = "0"
- fed.OwnpayAmt = "0"
- fed.SelfpayAmt = "0"
- fed.AcctPayamt = "0"
- fed.MaAmt = "0"
- fed.HifpPayamt = "0"
- fed.SetlTotlnum = "1"
- fed.Insutype = his.Insutype
- fed.ReimFlag = "0"
- fed.OutSetlFlag = "0"
-
- var fopd []*models.FsiOperationDtosData
- data := make(map[string]interface{})
- data["fed"] = fed
- data["fdd"] = fdds
- data["fod"] = orders
- data["pd"] = pd
- data["pp"] = pp
- data["fopd"] = fopd
- data["trig_scen"] = trig_scen
- fmt.Println(data)
- fmt.Println(fed)
- fmt.Println(fdds)
- fmt.Println(orders)
- fmt.Println(pd)
- fmt.Println(pp)
- fmt.Println(fopd)
-
- client := &http.Client{}
- bytesData, _ := json.Marshal(data)
- var req *http.Request
-
- if miConfig.MdtrtareaAdmvs == "320921" {
- req, _ = http.NewRequest("POST", "http://192.168.3.111:9532/"+"jsyb/3101", bytes.NewReader(bytesData))
- } else {
- req, _ = http.NewRequest("POST", "http://192.168.5.251:9532/"+"jsyb/3101", bytes.NewReader(bytesData))
- }
-
- resp, _ := client.Do(req)
- defer resp.Body.Close()
- body, ioErr := ioutil.ReadAll(resp.Body)
- if ioErr != nil {
- utils.ErrorLog("接口返回数据读取失败: %v", ioErr)
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
- var respJSON map[string]interface{}
- if err := json.Unmarshal([]byte(body), &respJSON); err != nil {
- utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
-
- //手术操作集合
- //手术操作集合
-
- }
-
- func (c *HisApiController) Check3102() {
- patient_id, _ := c.GetInt64("patient_id")
- order_id, _ := c.GetInt64("order_id")
- his_patient_id, _ := c.GetInt64("his_patient_id")
- admin_user_id, _ := c.GetInt64("admin_user_id")
- trig_scen := c.GetString("trig_scen")
-
- adminUser := c.GetAdminUserInfo()
- roles, _ := service.GetAdminUserInfoByID(c.GetAdminUserInfo().CurrentOrgId, admin_user_id)
- his, _ := service.GetNewHisPatientInfoFour(c.GetAdminUserInfo().CurrentOrgId, his_patient_id)
- miConfig, _ := service.FindMedicalInsuranceInfo(c.GetAdminUserInfo().CurrentOrgId)
- record_time := c.GetString("record_time")
- order, _ := service.GetHisOrderByID(order_id)
-
- timeLayout := "2006-01-02"
- loc, _ := time.LoadLocation("Local")
- theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", record_time+" 00:00:00", loc)
- if err != nil {
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
- return
- }
- recordDateTime := theTime.Unix()
-
- var patientPrescription models.HisPrescriptionInfo
- patientPrescription, _ = service.FindHisPatientPrescriptionInfo(adminUser.CurrentOrgId, his_patient_id, recordDateTime)
- if patientPrescription.ID == 0 {
- patientPrescription, _ = service.FindLastPatientPrescriptionInfo(adminUser.CurrentOrgId, patient_id, recordDateTime)
- }
- department, _ := service.GetDepartMentDetail(patientPrescription.Departments)
- doctor_info, _ := service.GetAdminUserInfoByID(adminUser.CurrentOrgId, patientPrescription.DoctorId)
- //
- diagnosis_ids := strings.Split(his.Diagnosis, ",")
-
- prescriptions, _ := service.GetNewHisPrescriptionTen(adminUser.CurrentOrgId, his_patient_id, recordDateTime)
-
- var pp models.PublicParams
- pp.InsuplcAdmdvs = miConfig.InsuplcAdmdvs
- pp.MdtrtareaAdmvs = miConfig.MdtrtareaAdmvs
- pp.FixmedinsName = miConfig.OrgName
- pp.FixmedinsCode = miConfig.Code
- pp.RequestUrl = miConfig.Url
- pp.Cainfo = miConfig.Cainfo
- pp.SecretKey = miConfig.SecretKey
- pp.AccessKey = miConfig.AccessKey
- pp.OpterName = roles.UserName
-
- var config []*models.HisXtDiagnoseConfig
- for _, item := range diagnosis_ids {
- id, _ := strconv.ParseInt(item, 10, 64)
- diagnosisConfig, _ := service.FindDiagnoseById(id)
- config = append(config, &diagnosisConfig)
- }
-
- var pd models.PatientDtos
- pd.PatnID = his.PsnNo
- pd.PatnName = his.Name
- pd.Gend = his.Gend
- pd.Brdy = his.Brdy
- pd.Poolarea = his.InsuplcAdmdvs
- pd.CurrMdtrtID = his.Number
-
- var fed models.FsiEncounterDtos
- fed.MdtrtID = his.Number
- fed.MedinsID = miConfig.Code
- fed.MedinsName = miConfig.OrgName
- fed.MedinsAdmdvs = miConfig.MdtrtareaAdmvs
- fed.MedMdtrtType = "1"
- fed.MedinsType = "1"
- fed.MedinsLv = "11"
- tm := time.Unix(his.RecordDate, 0)
- s_tm := tm.Format("2006-01-02 15:04:05")
- fed.AdmDate = s_tm
- fed.DscgDate = s_tm
- fed.DscgMainDiseCodg = config[0].CountryCode
- fed.DscgMainDiseName = config[0].CountryContentName
- //诊断信息
- var fdds []*models.FsiDiagnoseDtos
- for index, item := range config {
- if index == 0 {
- var fdd models.FsiDiagnoseDtos
- fdd.DiseID = strconv.FormatInt(item.ID, 10)
- fdd.InoutDiseType = "1"
- fdd.MaindiseFlag = "1"
- fdd.DiseDate = s_tm
- fdd.DiasSrtNo = "1"
- fdd.DiseName = item.CountryContentName
- fdd.DiseCodg = item.CountryCode
- fdds = append(fdds, &fdd)
-
- } else {
- var fdd models.FsiDiagnoseDtos
- fdd.DiseID = strconv.FormatInt(item.ID, 10)
- fdd.InoutDiseType = "1"
- fdd.MaindiseFlag = "1"
- fdd.DiseDate = s_tm
- fdd.DiasSrtNo = strconv.FormatInt(int64(index), 10)
- fdd.DiseName = item.CountryContentName
- fdd.DiseCodg = item.CountryCode
- fdds = append(fdds, &fdd)
- }
- }
- fed.DrCodg = strconv.FormatInt(doctor_info.ID, 10)
- fed.AdmDeptCodg = strconv.FormatInt(department.ID, 10)
- fed.AdmDeptName = department.Name
- fed.DscgDeptCodg = strconv.FormatInt(department.ID, 10)
- fed.DscgDeptName = department.Name
-
- fed.MedType = order.MedType
- //处方医嘱信息
- var orders []*models.FsiOrderDtos
- //for _, item := range prescriptions {
- // for _, subItem := range item.HisDoctorAdviceInfo {
- // var order models.FsiOrderDtos
- // order.RxID = strconv.FormatInt(item.ID, 10)
- // order.Rxno = strconv.FormatInt(item.ID, 10)
- // order.LongDrordFlag = "0"
- // order.HilistType = "1"
- // order.ChrgType = "1"
- // order.DrordBhvr = "-"
- // order.HilistCode = subItem.BaseDrugLib.MedicalInsuranceNumber
- // order.HosplistName = subItem.BaseDrugLib.DrugName
- // order.HilistLv = "1"
- // order.HilistPric = strconv.FormatFloat(subItem.Price, 'E', -1, 64)
- // order.HosplistCode = subItem.BaseDrugLib.MedicalInsuranceNumber
- // order.HosplistName = subItem.BaseDrugLib.DrugName
- // order.Cnt = strconv.FormatFloat(subItem.PrescribingNumber, 'E', -1, 64)
- // order.Pric = strconv.FormatFloat(subItem.Price, 'E', -1, 64)
- // order.Sumamt = strconv.FormatFloat((subItem.Price * subItem.PrescribingNumber), 'E', -1, 64)
- // order.OwnpayAmt = ""
- // order.SelfpayAmt = ""
- // order.Spec = ""
- // order.SpecUnt = ""
- // order.DrordBegnDate = s_tm
- // order.DrordStopDate = ""
- // order.DrordDrCodg = "1"
- // order.DrordDeptName = department.Name
- // order.DrordDrCodg = "1"
- // order.DrordDrName = doctor_info.UserName
- // order.DrordDrProfttl = ""
- // order.CurrDrordFlag = "1"
- // orders = append(orders, &order)
- // }
- // for _, subItem := range item.HisPrescriptionProject {
- // if subItem.Type == 2 {
- // var order models.FsiOrderDtos
- // order.RxID = strconv.FormatInt(item.ID, 10)
- // order.Rxno = strconv.FormatInt(item.ID, 10)
- // order.LongDrordFlag = "0"
- // order.HilistType = "1"
- // order.ChrgType = "1"
- // order.DrordBhvr = "-"
- // order.HilistCode = subItem.HisProject.MedicalCode
- // order.HosplistName = subItem.HisProject.ProjectName
- // order.HilistLv = "1"
- // order.HilistPric = strconv.FormatFloat(subItem.Price, 'E', -1, 64)
- // order.HosplistCode = subItem.HisProject.MedicalCode
- // order.HosplistName = subItem.HisProject.ProjectName
- // order.Cnt = subItem.Count
- // cnt, _ := strconv.ParseFloat(subItem.Count, 64)
- //
- // order.Pric = strconv.FormatFloat(subItem.Price, 'E', -1, 64)
- // order.Sumamt = strconv.FormatFloat((subItem.Price * cnt), 'E', -1, 64)
- // order.OwnpayAmt = ""
- // order.SelfpayAmt = ""
- // order.Spec = ""
- // order.SpecUnt = ""
- // order.DrordBegnDate = s_tm
- // order.DrordStopDate = ""
- // order.DrordDrCodg = "1"
- // order.DrordDeptName = department.Name
- // order.DrordDrCodg = "1"
- // order.DrordDrName = doctor_info.UserName
- // order.DrordDrProfttl = ""
- // order.CurrDrordFlag = "1"
- // orders = append(orders, &order)
- //
- // }
- // if subItem.Type == 3 {
- //
- // var order models.FsiOrderDtos
- // order.RxID = strconv.FormatInt(item.ID, 10)
- // order.Rxno = strconv.FormatInt(item.ID, 10)
- // order.LongDrordFlag = "0"
- // order.HilistType = "1"
- // order.ChrgType = "1"
- // order.DrordBhvr = "-"
- // order.HilistCode = subItem.GoodInfo.MedicalInsuranceNumber
- // order.HosplistName = subItem.GoodInfo.GoodName
- // order.HilistLv = "1"
- // order.HilistPric = strconv.FormatFloat(subItem.Price, 'E', -1, 64)
- // order.HosplistCode = subItem.GoodInfo.MedicalInsuranceNumber
- // order.HosplistName = subItem.GoodInfo.GoodName
- // order.Cnt = subItem.Count
- // cnt, _ := strconv.ParseFloat(subItem.Count, 64)
- // order.Pric = strconv.FormatFloat(subItem.Price, 'E', -1, 64)
- // order.Sumamt = strconv.FormatFloat((subItem.Price * cnt), 'E', -1, 64)
- // order.OwnpayAmt = ""
- // order.SelfpayAmt = ""
- // order.Spec = ""
- // order.SpecUnt = ""
- // order.DrordBegnDate = s_tm
- // order.DrordStopDate = ""
- // order.DrordDrCodg = "1"
- // order.DrordDeptName = department.Name
- // order.DrordDrCodg = "1"
- // order.DrordDrName = doctor_info.UserName
- // order.DrordDrProfttl = ""
- // order.CurrDrordFlag = "1"
- // orders = append(orders, &order)
- //
- // }
- // }
- //}
- for _, item := range prescriptions {
- for _, subItem := range item.HisDoctorAdviceInfo {
- var order models.FsiOrderDtos
- order.RxID = strconv.FormatInt(item.ID, 10)
- order.Rxno = strconv.FormatInt(item.ID, 10)
- order.LongDrordFlag = "0"
- order.HilistType = "1"
- order.ChrgType = "1"
- order.DrordBhvr = "-"
- order.HilistCode = subItem.BaseDrugLib.MedicalInsuranceNumber
- order.HosplistName = subItem.BaseDrugLib.DrugName
- order.HilistLv = "1"
- order.HilistPric = fmt.Sprintf("%.2f", subItem.Price)
- order.HosplistCode = subItem.BaseDrugLib.MedicalInsuranceNumber
- order.HosplistName = subItem.BaseDrugLib.DrugName
- order.Cnt = fmt.Sprintf("%.2f", subItem.PrescribingNumber)
- order.Pric = fmt.Sprintf("%.2f", subItem.Price)
- order.Sumamt = fmt.Sprintf("%.2f", (subItem.PrescribingNumber * subItem.Price))
- order.OwnpayAmt = ""
- order.SelfpayAmt = ""
- order.Spec = ""
- order.SpecUnt = ""
- order.DrordBegnDate = s_tm
- order.DrordStopDate = ""
- order.DrordDrCodg = "1"
- order.DrordDeptName = department.Name
- order.DrordDrCodg = "1"
- order.DrordDrName = doctor_info.UserName
- order.DrordDrProfttl = ""
- order.CurrDrordFlag = "1"
- orders = append(orders, &order)
- }
- for _, subItem := range item.HisPrescriptionProject {
- if subItem.Type == 2 {
- var order models.FsiOrderDtos
- order.RxID = strconv.FormatInt(item.ID, 10)
- order.Rxno = strconv.FormatInt(item.ID, 10)
- order.LongDrordFlag = "0"
- order.HilistType = "1"
- order.ChrgType = "1"
- order.DrordBhvr = "-"
- order.HilistCode = subItem.HisProject.MedicalCode
- order.HosplistName = subItem.HisProject.ProjectName
- order.HilistLv = "1"
- order.HilistPric = fmt.Sprintf("%.2f", subItem.Price)
- order.HosplistCode = subItem.HisProject.MedicalCode
- order.HosplistName = subItem.HisProject.ProjectName
- order.Cnt = subItem.Count
- cnt, _ := strconv.ParseFloat(subItem.Count, 64)
- order.Pric = fmt.Sprintf("%.2f", subItem.Price)
- order.Sumamt = fmt.Sprintf("%.2f", subItem.Price*cnt)
- order.OwnpayAmt = ""
- order.SelfpayAmt = ""
- order.Spec = ""
- order.SpecUnt = ""
- order.DrordBegnDate = s_tm
- order.DrordStopDate = ""
- order.DrordDrCodg = "1"
- order.DrordDeptName = department.Name
- order.DrordDrCodg = "1"
- order.DrordDrName = doctor_info.UserName
- order.DrordDrProfttl = ""
- order.CurrDrordFlag = "1"
- orders = append(orders, &order)
-
- }
- if subItem.Type == 3 {
-
- var order models.FsiOrderDtos
- order.RxID = strconv.FormatInt(item.ID, 10)
- order.Rxno = strconv.FormatInt(item.ID, 10)
- order.LongDrordFlag = "0"
- order.HilistType = "1"
- order.ChrgType = "1"
- order.DrordBhvr = "-"
- order.HilistCode = subItem.GoodInfo.MedicalInsuranceNumber
- order.HosplistName = subItem.GoodInfo.GoodName
- order.HilistLv = "1"
- order.HilistPric = fmt.Sprintf("%.2f", subItem.Price)
- order.HosplistCode = subItem.GoodInfo.MedicalInsuranceNumber
- order.HosplistName = subItem.GoodInfo.GoodName
- order.Cnt = subItem.Count
- cnt, _ := strconv.ParseFloat(subItem.Count, 64)
- order.Pric = fmt.Sprintf("%.2f", subItem.Price)
- order.Sumamt = fmt.Sprintf("%.2f", subItem.Price*cnt)
- order.OwnpayAmt = ""
- order.SelfpayAmt = ""
- order.Spec = ""
- order.SpecUnt = ""
- order.DrordBegnDate = s_tm
- order.DrordStopDate = ""
- order.DrordDrCodg = "1"
- order.DrordDeptName = department.Name
- order.DrordDrCodg = "1"
- order.DrordDrName = doctor_info.UserName
- order.DrordDrProfttl = ""
- order.CurrDrordFlag = "1"
- orders = append(orders, &order)
-
- }
- }
- }
- //处方医嘱信息
- fed.MatnStas = "0"
- fed.MedfeeSumamt = fmt.Sprintf("%.2f", order.MedfeeSumamt)
- fed.OwnpayAmt = fmt.Sprintf("%.2f", order.FulamtOwnpayAmt)
- fed.SelfpayAmt = fmt.Sprintf("%.2f", order.PreselfpayAmt)
- fed.AcctPayamt = fmt.Sprintf("%.2f", order.AcctPay)
- fed.MaAmt = fmt.Sprintf("%.2f", order.MafPay)
- fed.HifpPayamt = fmt.Sprintf("%.2f", order.HifpPay)
- fed.SetlTotlnum = "1"
- fed.Insutype = his.Insutype
- fed.ReimFlag = "0"
- fed.OutSetlFlag = "0"
-
- var fopd []*models.FsiOperationDtosData
- data := make(map[string]interface{})
- data["fed"] = fed
- data["fdd"] = fdds
- data["fod"] = orders
- data["pd"] = pd
- data["pp"] = pp
- data["fopd"] = fopd
- data["trig_scen"] = trig_scen
-
- client := &http.Client{}
- bytesData, _ := json.Marshal(data)
- var req *http.Request
- if miConfig.MdtrtareaAdmvs == "320921" {
- req, _ = http.NewRequest("POST", "http://192.168.3.111:9532/"+"jsyb/3102", bytes.NewReader(bytesData))
- } else {
- req, _ = http.NewRequest("POST", "http://192.168.5.251:9532/"+"jsyb/3102", bytes.NewReader(bytesData))
- }
-
- resp, _ := client.Do(req)
- defer resp.Body.Close()
- body, ioErr := ioutil.ReadAll(resp.Body)
- if ioErr != nil {
- utils.ErrorLog("接口返回数据读取失败: %v", ioErr)
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
- var respJSON map[string]interface{}
- if err := json.Unmarshal([]byte(body), &respJSON); err != nil {
- utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
- //手术操作集合
-
- //手术操作集合
-
- }
-
- func (c *HisApiController) Check() {
- psn_no := c.GetString("psn_no")
- in := c.GetString("in")
- mt := c.GetString("mt")
-
- baseParams := models.BaseParams{
- SecretKey: "MSDBYGxXm1Mtyi3PtOUB7n1ktcxwyW57",
- FixmedinsCode: "H15049901371",
- InsuplcAdmdvs: "150499",
- MdtrtareaAdmvs: "150499",
- OrgName: "赤峰费森血液透析中心",
- Doctor: "1111",
- }
- service.Gdyb2001(baseParams, psn_no, in, mt)
-
- }
- func (c *HisApiController) GetPsnNcdsInfo() {
- admin_user_id, _ := c.GetInt64("admin_user_id")
- patient_id, _ := c.GetInt64("patient_id")
-
- id, _ := c.GetInt64("id")
- adminUser := c.GetAdminUserInfo()
- miConfig, _ := service.FindMedicalInsuranceInfo(adminUser.CurrentOrgId)
- //config, _ := service.GetMedicalInsuranceConfig(adminUser.CurrentOrgId)
- //patient, _ := service.GetPatientByID(c.GetAdminUserInfo().CurrentOrgId, id)
- role, _ := service.GetAdminUserInfoByID(adminUser.CurrentOrgId, admin_user_id)
- psn_record, _ := service.GetPsnNCDSRecordById(id)
- //
- //if psn_record.ID == 0 {
- // c.ServeFailJSONWithSGJErrorCode(enums.ErrorPsnRecordNoExistWrong)
- // return
- //}
-
- var res Result5301
- var res10265 Result5301For10265
-
- if miConfig.MdtrtareaAdmvs == "320921" || miConfig.MdtrtareaAdmvs == "320982" {
-
- psn_info, _ := service.GetPsnByPatientId(patient_id)
- var api string
- if miConfig.MdtrtareaAdmvs == "320921" {
- api = "http://192.168.3.111:9532/" + "jsyb/5301?" + "fixmedins_code=" + miConfig.Code + "&secret_key=" + miConfig.SecretKey + "&ak=" + miConfig.AccessKey + "&org_name=" + miConfig.OrgName + "&doctor=" + role.UserName +
- "&insuplc_admdvs=" + miConfig.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey + "&url=" + miConfig.Url + "&psn_no=" + psn_info.PsnNo + "&cainfo=" + miConfig.Cainfo
-
- } else {
- api = "http://192.168.5.251:9532/" + "jsyb/5301?" + "fixmedins_code=" + miConfig.Code + "&secret_key=" + miConfig.SecretKey + "&ak=" + miConfig.AccessKey + "&org_name=" + miConfig.OrgName + "&doctor=" + role.UserName +
- "&insuplc_admdvs=" + miConfig.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey + "&url=" + miConfig.Url + "&psn_no=" + psn_info.PsnNo + "&cainfo=" + miConfig.Cainfo
-
- }
-
- resp, requestErr := http.Get(api)
- if requestErr != nil {
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
-
- body, ioErr := ioutil.ReadAll(resp.Body)
- if ioErr != nil {
- utils.ErrorLog("接口返回数据读取失败: %v", ioErr)
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
- var respJSON map[string]interface{}
- if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
- utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
- respJSON = respJSON["data"].(map[string]interface{})["pre"].(map[string]interface{})
- result, _ := json.Marshal(respJSON)
- if err := json.Unmarshal([]byte(result), &res10265); err != nil {
- utils.ErrorLog("解析失败:%v", err)
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
- res.ErrMsg = res10265.ErrMsg
- res.Output = res10265.Output
- res.InfRefmsgid = res10265.InfRefmsgid
- infocode, _ := strconv.ParseInt(res10265.Infcode, 10, 64)
- res.Infcode = infocode
-
- } else {
-
- result := service.Gdyb5301(psn_record.PsnNo, miConfig.OrgName, role.UserName, miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey)
-
- var dat map[string]interface{}
- if err := json.Unmarshal([]byte(result), &dat); err == nil {
- fmt.Println(dat)
- } else {
- fmt.Println(err)
- }
-
- userJSONBytes, _ := json.Marshal(dat)
-
- if miConfig.Code == "H15049901371" {
- if err := json.Unmarshal(userJSONBytes, &res10265); err != nil {
- utils.ErrorLog("解析失败:%v", err)
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
- res.InfRefmsgid = res10265.InfRefmsgid
- res.Output = res10265.Output
- res.ErrMsg = res10265.ErrMsg
- infocode, _ := strconv.ParseInt(res10265.Infcode, 10, 64)
- res.Infcode = infocode
- } else {
- if err := json.Unmarshal(userJSONBytes, &res); err != nil {
- utils.ErrorLog("解析失败:%v", err)
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
-
- }
-
- }
-
- if res.Infcode == 0 {
- c.ServeSuccessJSON(map[string]interface{}{
- "result": res.Output.Result,
- })
- }
-
- }
- func (c *HisApiController) CheckInsutype() {
- his_patient_id, _ := c.GetInt64("his_patient_id")
- admin_user_id, _ := c.GetInt64("admin_user_id")
- roles, _ := service.GetAdminUserInfoByID(c.GetAdminUserInfo().CurrentOrgId, admin_user_id)
- his, _ := service.GetNewHisPatientInfoFour(c.GetAdminUserInfo().CurrentOrgId, his_patient_id)
- miConfig, _ := service.FindMedicalInsuranceInfo(c.GetAdminUserInfo().CurrentOrgId)
- result := service.Gdyb90100(his.PsnNo, miConfig.OrgName, roles.UserName, miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey)
-
- var dat map[string]interface{}
- if err := json.Unmarshal([]byte(result), &dat); err == nil {
- fmt.Println(dat)
- } else {
- fmt.Println(err)
- }
-
- userJSONBytes, _ := json.Marshal(dat)
- var res Result90100
- if err := json.Unmarshal(userJSONBytes, &res); err != nil {
- utils.ErrorLog("解析失败:%v", err)
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
-
- if res.Infcode != 0 {
- c.ServeSuccessJSON(map[string]interface{}{
- "failed_code": -10,
- "msg": res.ErrMsg,
- })
- return
- } else {
- fmt.Println(res)
-
- }
-
- }
- func (c *HisApiController) CheckCardPWD() {
- card_pwd := c.GetString("card_pwd")
- his_patient_id, _ := c.GetInt64("his_patient_id")
- admin_user_id, _ := c.GetInt64("admin_user_id")
- roles, _ := service.GetAdminUserInfoByID(c.GetAdminUserInfo().CurrentOrgId, admin_user_id)
- miConfig, _ := service.FindMedicalInsuranceInfo(c.GetAdminUserInfo().CurrentOrgId)
- his, _ := service.GetNewHisPatientInfoFour(c.GetAdminUserInfo().CurrentOrgId, his_patient_id)
- psn, _ := service.GetPsnByPatientId(his.PatientId)
- bas := strings.Split(psn.CardInfo, "|")
- basNumber := bas[2]
- result := service.Gdyb90991(his.PsnNo, miConfig.OrgName, roles.UserName, miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, card_pwd, basNumber)
-
- var dat map[string]interface{}
- if err := json.Unmarshal([]byte(result), &dat); err == nil {
- fmt.Println(dat)
- } else {
- fmt.Println(err)
- }
-
- userJSONBytes, _ := json.Marshal(dat)
- var res Result90991
- if err := json.Unmarshal(userJSONBytes, &res); err != nil {
- utils.ErrorLog("解析失败:%v", err)
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
-
- if res.Infcode != 0 {
- c.ServeSuccessJSON(map[string]interface{}{
- "failed_code": -10,
- "msg": res.ErrMsg,
- })
- return
- } else {
- fmt.Println(res.Output.Result.CardStat)
- if res.Output.Result.SscnoCheckStat == "0" && res.Output.Result.CardStat != "10" {
- var msg string
- switch res.Output.Result.CardStat {
- case "00":
- msg = "未激活"
- break
- case "10":
- msg = "激活"
- break
- case "20":
- msg = "窗口挂失"
- break
- case "21":
- msg = "电话挂失"
- break
- case "22":
- msg = "单位网上申报挂失"
- break
- case "23":
- msg = "保健办挂失"
-
- break
- case "24":
- msg = "个人网上挂失"
-
- break
- case "25":
- msg = "网上服务大厅挂失"
- break
- case "30":
- msg = "注销"
- break
- case "40":
- msg = "回收"
- break
- case "99":
- msg = "制卡中(无效卡)"
- break
- }
- c.ServeSuccessJSON(map[string]interface{}{
- "failed_code": -10,
- "msg": msg,
- })
- return
-
- } else {
- c.ServeSuccessJSON(map[string]interface{}{
- "msg": "校验成功",
- })
- return
- }
- }
-
- }
-
- func (c *HisApiController) CheckCardPWDTwo() {
- //card_pwd := c.GetString("card_pwd")
- //his_patient_id, _ := c.GetInt64("his_patient_id")
- admin_user_id, _ := c.GetInt64("admin_user_id")
- roles, _ := service.GetAdminUserInfoByID(c.GetAdminUserInfo().CurrentOrgId, admin_user_id)
- miConfig, _ := service.FindMedicalInsuranceInfo(c.GetAdminUserInfo().CurrentOrgId)
-
- result := service.Gdyb90991("44030000000629690364", miConfig.OrgName, roles.UserName, miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, "000000", "BDM421363")
-
- var dat map[string]interface{}
- if err := json.Unmarshal([]byte(result), &dat); err == nil {
- fmt.Println(dat)
- } else {
- fmt.Println(err)
- }
-
- userJSONBytes, _ := json.Marshal(dat)
- var res Result90991
- if err := json.Unmarshal(userJSONBytes, &res); err != nil {
- utils.ErrorLog("解析失败:%v", err)
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
-
- if res.Infcode != 0 {
- c.ServeSuccessJSON(map[string]interface{}{
- "failed_code": -10,
- "msg": res.ErrMsg,
- })
- return
- } else {
- if res.Output.Result.SscnoCheckStat == "0" {
- var msg string
- switch res.Output.Result.CardStat {
- case "00":
- msg = "未激活"
- break
- case "10":
- msg = "激活"
- break
- case "20":
- msg = "窗口挂失"
- break
- case "21":
- msg = "电话挂失"
- break
- case "22":
- msg = "单位网上申报挂失"
- break
- case "23":
- msg = "保健办挂失"
-
- break
- case "24":
- msg = "个人网上挂失"
-
- break
- case "25":
- msg = "网上服务大厅挂失"
- break
- case "30":
- msg = "注销"
- break
- case "40":
- msg = "回收"
- break
- case "99":
- msg = "制卡中(无效卡)"
- break
- }
- c.ServeSuccessJSON(map[string]interface{}{
- "failed_code": -10,
- "msg": msg,
- })
- return
-
- } else {
- c.ServeSuccessJSON(map[string]interface{}{
- "msg": "校验成功",
- })
- return
- }
- }
-
- }
-
- //func (c *HisApiController) ReadCard() {
- // id_card_type, _ := c.GetInt64("id_card_type")
- // admin_user_id, _ := c.GetInt64("admin_user_id")
- // certificates, _ := c.GetInt64("certificates")
- // fmt.Println(c.GetAdminUserInfo().CurrentOrgId)
- // roles, _ := service.GetAdminUserInfoByID(c.GetAdminUserInfo().CurrentOrgId, admin_user_id)
- // miConfig, _ := service.FindMedicalInsuranceInfo(c.GetAdminUserInfo().CurrentOrgId)
- //
- // switch id_card_type {
- // case 1:
- // if miConfig.MdtrtareaAdmvs == "421300" {
- // var res ResultTwo
- // api := "http://192.168.124.4:9532/" + "hbyb/1101?cert_no=" + "" +
- // "&org_name=" + miConfig.OrgName + "&doctor=" + roles.UserName + "&fixmedins_code=" + miConfig.Code +
- // "&insuplc_admdvs=" + miConfig.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey + "&id_card_type=" + strconv.FormatInt(id_card_type, 10) + "&card_sn=" + "" + "&certificates=" + strconv.FormatInt(certificates, 10)
- //
- // resp, requestErr := http.Get(api)
- // if requestErr != nil {
- // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- // return
- // }
- //
- // body, ioErr := ioutil.ReadAll(resp.Body)
- // if ioErr != nil {
- // utils.ErrorLog("接口返回数据读取失败: %v", ioErr)
- // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- // return
- // }
- // var respJSON map[string]interface{}
- // if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
- // utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
- // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- // return
- // }
- //
- // respJSON = respJSON["data"].(map[string]interface{})["pre"].(map[string]interface{})
- // result, _ := json.Marshal(respJSON)
- // fmt.Println("log")
- // fmt.Println(string(result))
- //
- // if err := json.Unmarshal([]byte(result), &res); err != nil {
- // utils.ErrorLog("解析失败:%v", err)
- // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- // return
- // }
- //
- // if res.Infcode == 0 {
- // patient, err := service.GetPatientByIDCard(res.Output.Baseinfo.Certno, c.GetAdminUserInfo().CurrentOrgId)
- // if err == gorm.ErrRecordNotFound {
- // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeNoPateintException)
- // return
- // } else if err != nil {
- // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
- // return
- //
- // } else {
- //
- // Iinfos, _ := json.Marshal(res.Output.Iinfo)
- // Idetinfos, _ := json.Marshal(res.Output.Idetinfo)
- // infoStr := string(Iinfos)
- // idetinfoStr := string(Idetinfos)
- // psn := &models.HisPsn{
- // PsnNo: res.Output.Baseinfo.PsnNo,
- // Age: res.Output.Baseinfo.Age,
- // PatientId: patient.ID,
- // Certno: res.Output.Baseinfo.Certno,
- // Brdy: res.Output.Baseinfo.Brdy,
- // Gend: res.Output.Baseinfo.Gend,
- // Naty: res.Output.Baseinfo.Naty,
- // PsnCertType: res.Output.Baseinfo.PsnCertType,
- // PsnName: res.Output.Baseinfo.PsnName,
- // Idetinfo: idetinfoStr,
- // Insuinfo: infoStr,
- // UserOrgId: c.GetAdminUserInfo().CurrentOrgId,
- // }
- // service.CreateHisPsn(psn)
- //
- // c.ServeSuccessJSON(map[string]interface{}{
- // "patient": patient,
- // "number": res.Output.Baseinfo.Certno,
- // })
- // }
- // } else {
- // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeHisFailedException)
- // return
- // }
- //
- // } else if miConfig.MdtrtareaAdmvs == "320921" || miConfig.MdtrtareaAdmvs == "320982" {
- // var api string
- // if miConfig.MdtrtareaAdmvs == "320921" {
- // api = "http://192.168.3.111:9532/" + "jsyb/readcard?" + "fixmedins_code=" + miConfig.Code + "&secret_key=" + miConfig.SecretKey + "&ak=" + miConfig.AccessKey + "&org_name=" + miConfig.OrgName + "&doctor=" + roles.UserName +
- // "&insuplc_admdvs=" + miConfig.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey + "&url=" + miConfig.Url + "&cainfo=" + miConfig.Cainfo + "&id_card_type=" + strconv.FormatInt(id_card_type, 10) + "&operator_id=" + strconv.FormatInt(admin_user_id, 10) + "&operator=" + roles.UserName
- // fmt.Println(api)
- // } else {
- // api = "http://192.168.5.251:9532/" + "jsyb/readcard?" + "fixmedins_code=" + miConfig.Code + "&secret_key=" + miConfig.SecretKey + "&ak=" + miConfig.AccessKey + "&org_name=" + miConfig.OrgName + "&doctor=" + roles.UserName +
- // "&insuplc_admdvs=" + miConfig.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey + "&url=" + miConfig.Url + "&cainfo=" + miConfig.Cainfo + "&id_card_type=" + strconv.FormatInt(id_card_type, 10)
- // }
- //
- // resp, requestErr := http.Get(api)
- // if requestErr != nil {
- // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- // return
- // }
- //
- // body, ioErr := ioutil.ReadAll(resp.Body)
- // if ioErr != nil {
- // utils.ErrorLog("接口返回数据读取失败: %v", ioErr)
- // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- // return
- // }
- // var respJSON map[string]interface{}
- // if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
- // utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
- // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- // return
- // }
- // var status string
- // status = respJSON["data"].(map[string]interface{})["status"].(string)
- // card_type := respJSON["data"].(map[string]interface{})["type"].(string)
- // //console.log()
- // fmt.Println("type===")
- //
- // fmt.Println(card_type)
- //
- // var token string
- // var res ResultTwo //1101结果
- // var res10265 ResultTwo10265 //1101结果
- // var card_info string //卡信息
- // var busi_card_info string
- //
- // card_info = respJSON["data"].(map[string]interface{})["card_info"].(string)
- // busi_card_info = respJSON["data"].(map[string]interface{})["busi_card_info"].(string)
- //
- // if status == "0" { //读卡成功
- // if card_type == "1" {
- //
- // respJSON = respJSON["data"].(map[string]interface{})["result"].(map[string]interface{})
- // result, _ := json.Marshal(respJSON)
- //
- // if err := json.Unmarshal([]byte(result), &res10265); err != nil {
- // utils.ErrorLog("解析失败:%v", err)
- // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- // return
- // }
- // res.ErrMsg = res10265.ErrMsg
- // infocode, _ := strconv.ParseInt(res10265.Infcode, 10, 64)
- // res.Infcode = infocode
- // res.Output = res10265.Output
- // res.InfRefmsgid = res10265.InfRefmsgid
- //
- // } else {
- // //var card_info string //卡信息
- // //var busi_card_info string
- //
- // token = respJSON["data"].(map[string]interface{})["token"].(string)
- // //busi_card_info = respJSON["data"].(map[string]interface{})["busi_card_info"].(string)
- //
- // //fmt.Println(card_info)
- // //fmt.Println(busi_card_info)
- //
- // respJSON = respJSON["data"].(map[string]interface{})["result"].(map[string]interface{})
- // result, _ := json.Marshal(respJSON)
- //
- // if err := json.Unmarshal([]byte(result), &res10265); err != nil {
- // utils.ErrorLog("解析失败:%v", err)
- // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- // return
- // }
- // res.ErrMsg = res10265.ErrMsg
- // infocode, _ := strconv.ParseInt(res10265.Infcode, 10, 64)
- // res.Infcode = infocode
- // res.Output = res10265.Output
- // res.InfRefmsgid = res10265.InfRefmsgid
- //
- // }
- //
- // if res.Infcode == 0 {
- // patient, err := service.GetPatientByIDCard(res.Output.Baseinfo.Certno, c.GetAdminUserInfo().CurrentOrgId)
- // if err == gorm.ErrRecordNotFound {
- // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeNoPateintException)
- // return
- // } else if err != nil {
- // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
- // return
- //
- // } else {
- //
- // if card_type == "1" {
- // bas := strings.Split(card_info, "|")
- // basNumber := bas[2]
- // Iinfos, _ := json.Marshal(res.Output.Iinfo)
- // Idetinfos, _ := json.Marshal(res.Output.Idetinfo)
- // infoStr := string(Iinfos)
- // idetinfoStr := string(Idetinfos)
- // psn := &models.HisPsn{
- // PsnNo: res.Output.Baseinfo.PsnNo,
- // Age: res.Output.Baseinfo.Age,
- // PatientId: patient.ID,
- // Certno: res.Output.Baseinfo.Certno,
- // Brdy: res.Output.Baseinfo.Brdy,
- // Gend: res.Output.Baseinfo.Gend,
- // Naty: res.Output.Baseinfo.Naty,
- // PsnCertType: res.Output.Baseinfo.PsnCertType,
- // PsnName: res.Output.Baseinfo.PsnName,
- // Idetinfo: idetinfoStr,
- // Insuinfo: infoStr,
- // UserOrgId: c.GetAdminUserInfo().CurrentOrgId,
- // CardInfo: card_info,
- // VerifyNumber: busi_card_info,
- // }
- // service.CreateHisPsn(psn)
- //
- // var rf []*ResultFive
- // json.Unmarshal([]byte(infoStr), &rf)
- //
- // var insutypes []*ResultFive
- // var insutype string
- // var is390 int = 0
- // var is310 int = 0
- //
- // for _, item := range rf {
- // if (item.Insutype == "390" && item.PsnInsuStas == "1") || (item.Insutype == "310" && item.PsnInsuStas == "1") {
- // insutypes = append(insutypes, item)
- // }
- // }
- //
- // if len(insutypes) == 1 {
- // insutype = insutypes[0].Insutype
- // //insuplc_admdvs = insutypes[0].InsuplcAdmdvs
- // } else {
- // for _, i := range insutypes {
- // if i.Insutype == "390" {
- // is390 = 1
- // }
- //
- // if i.Insutype == "310" {
- // is310 = 1
- // }
- // }
- // }
- // if is390 == 1 {
- // insutype = "390"
- // }
- //
- // if is310 == 1 {
- // insutype = "310"
- // }
- //
- // if len(insutypes) == 0 {
- // insutype = "310"
- // }
- //
- // c.ServeSuccessJSON(map[string]interface{}{
- // "patient": patient,
- // "number": basNumber,
- // "insutype": insutype,
- // })
- // } else {
- // Iinfos, _ := json.Marshal(res.Output.Iinfo)
- // Idetinfos, _ := json.Marshal(res.Output.Idetinfo)
- // infoStr := string(Iinfos)
- // idetinfoStr := string(Idetinfos)
- // psn := &models.HisPsn{
- // PsnNo: res.Output.Baseinfo.PsnNo,
- // Age: res.Output.Baseinfo.Age,
- // PatientId: patient.ID,
- // Certno: res.Output.Baseinfo.Certno,
- // Brdy: res.Output.Baseinfo.Brdy,
- // Gend: res.Output.Baseinfo.Gend,
- // Naty: res.Output.Baseinfo.Naty,
- // PsnCertType: res.Output.Baseinfo.PsnCertType,
- // PsnName: res.Output.Baseinfo.PsnName,
- // Idetinfo: idetinfoStr,
- // Insuinfo: infoStr,
- // UserOrgId: c.GetAdminUserInfo().CurrentOrgId,
- // CardInfo: card_info,
- // VerifyNumber: token,
- // }
- // service.CreateHisPsn(psn)
- // c.ServeSuccessJSON(map[string]interface{}{
- // "patient": patient,
- // "number": token,
- // })
- // }
- // }
- // } else {
- // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeHisFailedException)
- // return
- // }
- // } else { //读卡失败
- // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeHisFailedException)
- // return
- //
- // }
- //
- // } else {
- // if initFlag == 0 {
- // c.TestGetBasBaseInit()
- // }
- // basStr := c.GetBasBaseInfo()
- // if len(basStr) == 0 {
- // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeReadCardException)
- // return
- // }
- // fmt.Println(basStr)
- // bas := strings.Split(basStr, "|")
- // basNumber := bas[1]
- // fmt.Println(basNumber)
- // card_sn := bas[3]
- // fmt.Println(card_sn)
- // result := service.Gdyb1101B(basNumber, miConfig.OrgName, roles.UserName, miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, id_card_type, card_sn, certificates)
- // var dat map[string]interface{}
- // if err := json.Unmarshal([]byte(result), &dat); err == nil {
- // fmt.Println(dat)
- // } else {
- // fmt.Println(err)
- // }
- //
- // userJSONBytes, _ := json.Marshal(dat)
- // var res ResultTwo
- // if err := json.Unmarshal(userJSONBytes, &res); err != nil {
- // utils.ErrorLog("解析失败:%v", err)
- // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- // return
- // }
- //
- // if res.Infcode == 0 {
- // patient, err := service.GetPatientByNumber(basNumber, c.GetAdminUserInfo().CurrentOrgId)
- // if err == gorm.ErrRecordNotFound {
- // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeNoPateintException)
- // return
- // } else if err != nil {
- // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
- // return
- //
- // } else {
- // Iinfos, _ := json.Marshal(res.Output.Iinfo)
- // Idetinfos, _ := json.Marshal(res.Output.Idetinfo)
- // infoStr := string(Iinfos)
- // idetinfoStr := string(Idetinfos)
- // psn := &models.HisPsn{
- // PsnNo: res.Output.Baseinfo.PsnNo,
- // Age: res.Output.Baseinfo.Age,
- // PatientId: patient.ID,
- // Certno: res.Output.Baseinfo.Certno,
- // Brdy: res.Output.Baseinfo.Brdy,
- // Gend: res.Output.Baseinfo.Gend,
- // Naty: res.Output.Baseinfo.Naty,
- // PsnCertType: res.Output.Baseinfo.PsnCertType,
- // PsnName: res.Output.Baseinfo.PsnName,
- // Idetinfo: idetinfoStr,
- // Insuinfo: infoStr,
- // UserOrgId: c.GetAdminUserInfo().CurrentOrgId,
- // CardInfo: basStr,
- // VerifyNumber: "",
- // }
- // service.CreateHisPsn(psn)
- //
- // c.ServeSuccessJSON(map[string]interface{}{
- // "patient": patient,
- // "number": basNumber,
- // })
- // }
- // } else {
- // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeHisFailedException)
- // return
- // }
- // break
- // }
- // case 2:
- // SFZStr := c.GetSFZBaseInfo()
- // id_card_str := strings.Split(SFZStr, "^")
- // id_card_number := id_card_str[0]
- // card_sn := ""
- // result := service.Gdyb1101B(id_card_number, miConfig.OrgName, roles.UserName, miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, id_card_type, card_sn, certificates)
- // var dat map[string]interface{}
- // if err := json.Unmarshal([]byte(result), &dat); err == nil {
- // fmt.Println(dat)
- // } else {
- // fmt.Println(err)
- // }
- //
- // userJSONBytes, _ := json.Marshal(dat)
- // var res ResultTwo
- // if err := json.Unmarshal(userJSONBytes, &res); err != nil {
- // utils.ErrorLog("解析失败:%v", err)
- // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- // return
- // }
- //
- // if res.Infcode == 0 {
- // patient, err := service.GetPatientByNumber(id_card_number, c.GetAdminUserInfo().CurrentOrgId)
- // if err == gorm.ErrRecordNotFound {
- // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeNoPateintException)
- // return
- // } else if err != nil {
- // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
- // return
- //
- // } else {
- // c.ServeSuccessJSON(map[string]interface{}{
- // "patient": patient,
- // "number": id_card_number,
- // })
- // }
- // } else {
- // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeHisFailedException)
- // return
- // }
- //
- // break
- // case 3:
- // if miConfig.MdtrtareaAdmvs == "320921" || miConfig.MdtrtareaAdmvs == "320982" {
- // var api string
- // if miConfig.MdtrtareaAdmvs == "320921" {
- // api = "http://192.168.3.111:9532/" + "jsyb/readcard?" + "fixmedins_code=" + miConfig.Code + "&secret_key=" + miConfig.SecretKey + "&ak=" + miConfig.AccessKey + "&org_name=" + miConfig.OrgName + "&doctor=" + roles.UserName +
- // "&insuplc_admdvs=" + miConfig.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey + "&url=" + miConfig.Url + "&cainfo=" + miConfig.Cainfo + "&id_card_type=" + strconv.FormatInt(id_card_type, 10) + "&operator_id=" + strconv.FormatInt(admin_user_id, 10) + "&operator=" + roles.UserName
- // fmt.Println(api)
- //
- // } else {
- // api = "http://192.168.5.251:9532/" + "jsyb/readcard?" + "fixmedins_code=" + miConfig.Code + "&secret_key=" + miConfig.SecretKey + "&ak=" + miConfig.AccessKey + "&org_name=" + miConfig.OrgName + "&doctor=" + roles.UserName +
- // "&insuplc_admdvs=" + miConfig.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey + "&url=" + miConfig.Url + "&cainfo=" + miConfig.Cainfo + "&id_card_type=" + strconv.FormatInt(id_card_type, 10)
- // }
- //
- // resp, requestErr := http.Get(api)
- // if requestErr != nil {
- // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- // return
- // }
- //
- // body, ioErr := ioutil.ReadAll(resp.Body)
- // if ioErr != nil {
- // utils.ErrorLog("接口返回数据读取失败: %v", ioErr)
- // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- // return
- // }
- // var respJSON map[string]interface{}
- // if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
- // utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
- // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- // return
- // }
- // var status string
- // status = respJSON["data"].(map[string]interface{})["status"].(string)
- // card_type := respJSON["data"].(map[string]interface{})["type"].(string)
- //
- // var token string
- // var res ResultTwo //1101结果
- // var res10265 ResultTwo10265 //1101结果
- // var card_info string //卡信息
- // var busi_card_info string
- //
- // //card_info = respJSON["data"].(map[string]interface{})["card_info"].(string)
- // busi_card_info = respJSON["data"].(map[string]interface{})["busi_card_info"].(string)
- //
- // if status == "0" { //读卡成功
- // if card_type == "1" {
- //
- // respJSON = respJSON["data"].(map[string]interface{})["result"].(map[string]interface{})
- // result, _ := json.Marshal(respJSON)
- //
- // if err := json.Unmarshal([]byte(result), &res10265); err != nil {
- // utils.ErrorLog("解析失败:%v", err)
- // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- // return
- // }
- // res.ErrMsg = res10265.ErrMsg
- // infocode, _ := strconv.ParseInt(res10265.Infcode, 10, 64)
- // res.Infcode = infocode
- // res.Output = res10265.Output
- // res.InfRefmsgid = res10265.InfRefmsgid
- //
- // } else {
- // //var card_info string //卡信息
- // //var busi_card_info string
- //
- // token = respJSON["data"].(map[string]interface{})["token"].(string)
- // //busi_card_info = respJSON["data"].(map[string]interface{})["busi_card_info"].(string)
- //
- // //fmt.Println(card_info)
- // //fmt.Println(busi_card_info)
- //
- // respJSON = respJSON["data"].(map[string]interface{})["result"].(map[string]interface{})
- // result, _ := json.Marshal(respJSON)
- //
- // if err := json.Unmarshal([]byte(result), &res10265); err != nil {
- // utils.ErrorLog("解析失败:%v", err)
- // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- // return
- // }
- // res.ErrMsg = res10265.ErrMsg
- // infocode, _ := strconv.ParseInt(res10265.Infcode, 10, 64)
- // res.Infcode = infocode
- // res.Output = res10265.Output
- // res.InfRefmsgid = res10265.InfRefmsgid
- //
- // }
- //
- // if res.Infcode == 0 {
- // patient, err := service.GetPatientByIDCard(res.Output.Baseinfo.Certno, c.GetAdminUserInfo().CurrentOrgId)
- // if err == gorm.ErrRecordNotFound {
- // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeNoPateintException)
- // return
- // } else if err != nil {
- // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
- // return
- //
- // } else {
- //
- // if card_type == "1" {
- // bas := strings.Split(card_info, "|")
- // basNumber := bas[2]
- // Iinfos, _ := json.Marshal(res.Output.Iinfo)
- // Idetinfos, _ := json.Marshal(res.Output.Idetinfo)
- // infoStr := string(Iinfos)
- // idetinfoStr := string(Idetinfos)
- // psn := &models.HisPsn{
- // PsnNo: res.Output.Baseinfo.PsnNo,
- // Age: res.Output.Baseinfo.Age,
- // PatientId: patient.ID,
- // Certno: res.Output.Baseinfo.Certno,
- // Brdy: res.Output.Baseinfo.Brdy,
- // Gend: res.Output.Baseinfo.Gend,
- // Naty: res.Output.Baseinfo.Naty,
- // PsnCertType: res.Output.Baseinfo.PsnCertType,
- // PsnName: res.Output.Baseinfo.PsnName,
- // Idetinfo: idetinfoStr,
- // Insuinfo: infoStr,
- // UserOrgId: c.GetAdminUserInfo().CurrentOrgId,
- // CardInfo: card_info,
- // VerifyNumber: busi_card_info,
- // }
- //
- // service.CreateHisPsn(psn)
- // c.ServeSuccessJSON(map[string]interface{}{
- // "patient": patient,
- // "number": basNumber,
- // })
- // } else {
- // Iinfos, _ := json.Marshal(res.Output.Iinfo)
- // Idetinfos, _ := json.Marshal(res.Output.Idetinfo)
- // infoStr := string(Iinfos)
- // idetinfoStr := string(Idetinfos)
- // psn := &models.HisPsn{
- // PsnNo: res.Output.Baseinfo.PsnNo,
- // Age: res.Output.Baseinfo.Age,
- // PatientId: patient.ID,
- // Certno: res.Output.Baseinfo.Certno,
- // Brdy: res.Output.Baseinfo.Brdy,
- // Gend: res.Output.Baseinfo.Gend,
- // Naty: res.Output.Baseinfo.Naty,
- // PsnCertType: res.Output.Baseinfo.PsnCertType,
- // PsnName: res.Output.Baseinfo.PsnName,
- // Idetinfo: idetinfoStr,
- // Insuinfo: infoStr,
- // UserOrgId: c.GetAdminUserInfo().CurrentOrgId,
- // CardInfo: card_info,
- // VerifyNumber: token,
- // }
- // service.CreateHisPsn(psn)
- // var rf []*ResultFive
- // json.Unmarshal([]byte(infoStr), &rf)
- // var insutypes []*ResultFive
- // var insutype string
- // var is390 int = 0
- // var is310 int = 0
- //
- // for _, item := range rf {
- // if (item.Insutype == "390" && item.PsnInsuStas == "1") || (item.Insutype == "310" && item.PsnInsuStas == "1") {
- // insutypes = append(insutypes, item)
- // }
- // }
- //
- // if len(insutypes) == 1 {
- // insutype = insutypes[0].Insutype
- // //insuplc_admdvs = insutypes[0].InsuplcAdmdvs
- // } else {
- // for _, i := range insutypes {
- // if i.Insutype == "390" {
- // is390 = 1
- // }
- //
- // if i.Insutype == "310" {
- // is310 = 1
- // }
- // }
- // }
- //
- // if is390 == 1 {
- // insutype = "390"
- // }
- //
- // if is310 == 1 {
- // insutype = "310"
- // }
- //
- // if len(insutypes) == 0 {
- // insutype = "310"
- // }
- // c.ServeSuccessJSON(map[string]interface{}{
- // "patient": patient,
- // "number": token,
- // "insutype": insutype,
- // })
- // }
- // }
- // } else {
- // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeHisFailedException)
- // return
- // }
- // } else { //读卡失败
- // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeHisFailedException)
- // return
- //
- // }
- //
- // }
- //
- // break
- // case 4:
- // if miConfig.MdtrtareaAdmvs == "320921" || miConfig.MdtrtareaAdmvs == "320982" {
- // var api string
- // if miConfig.MdtrtareaAdmvs == "320921" {
- // api = "http://192.168.3.111:9532/" + "jsyb/readcard?" + "fixmedins_code=" + miConfig.Code + "&secret_key=" + miConfig.SecretKey + "&ak=" + miConfig.AccessKey + "&org_name=" + miConfig.OrgName + "&doctor=" + roles.UserName +
- // "&insuplc_admdvs=" + miConfig.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey + "&url=" + miConfig.Url + "&cainfo=" + miConfig.Cainfo + "&id_card_type=" + strconv.FormatInt(id_card_type, 10) + "&operator_id=" + strconv.FormatInt(admin_user_id, 10) + "&operator=" + roles.UserName
- // fmt.Println(api)
- //
- // } else {
- // api = "http://192.168.5.251:9532/" + "jsyb/readcard?" + "fixmedins_code=" + miConfig.Code + "&secret_key=" + miConfig.SecretKey + "&ak=" + miConfig.AccessKey + "&org_name=" + miConfig.OrgName + "&doctor=" + roles.UserName +
- // "&insuplc_admdvs=" + miConfig.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey + "&url=" + miConfig.Url + "&cainfo=" + miConfig.Cainfo + "&id_card_type=" + strconv.FormatInt(id_card_type, 10)
- // }
- //
- // resp, requestErr := http.Get(api)
- // if requestErr != nil {
- // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- // return
- // }
- //
- // body, ioErr := ioutil.ReadAll(resp.Body)
- // if ioErr != nil {
- // utils.ErrorLog("接口返回数据读取失败: %v", ioErr)
- // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- // return
- // }
- // var respJSON map[string]interface{}
- // if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
- // utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
- // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- // return
- // }
- // var status string
- // status = respJSON["data"].(map[string]interface{})["status"].(string)
- // //card_type := respJSON["data"].(map[string]interface{})["type"].(string)
- //
- // var token string
- // var res ResultTwo //1101结果
- // var res10265 ResultTwo10265 //1101结果
- //
- // if status == "0" { //读卡成功
- // var card_info string //卡信息
- // var busi_card_info string
- //
- // token = respJSON["data"].(map[string]interface{})["token"].(string)
- // busi_card_info = respJSON["data"].(map[string]interface{})["busi_card_info"].(string)
- // card_info = respJSON["data"].(map[string]interface{})["card_info"].(string)
- //
- // fmt.Println(card_info)
- // fmt.Println(busi_card_info)
- //
- // respJSON = respJSON["data"].(map[string]interface{})["result"].(map[string]interface{})
- // result, _ := json.Marshal(respJSON)
- //
- // if err := json.Unmarshal([]byte(result), &res10265); err != nil {
- // utils.ErrorLog("解析失败:%v", err)
- // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- // return
- // }
- // res.ErrMsg = res10265.ErrMsg
- // infocode, _ := strconv.ParseInt(res10265.Infcode, 10, 64)
- // res.Infcode = infocode
- // res.Output = res10265.Output
- // res.InfRefmsgid = res10265.InfRefmsgid
- //
- // if res.Infcode == 0 {
- // patient, err := service.GetPatientByIDCard(res.Output.Baseinfo.Certno, c.GetAdminUserInfo().CurrentOrgId)
- // if err == gorm.ErrRecordNotFound {
- // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeNoPateintException)
- // return
- // } else if err != nil {
- // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
- // return
- //
- // } else {
- // Iinfos, _ := json.Marshal(res.Output.Iinfo)
- // Idetinfos, _ := json.Marshal(res.Output.Idetinfo)
- // infoStr := string(Iinfos)
- // idetinfoStr := string(Idetinfos)
- // psn := &models.HisPsn{
- // PsnNo: res.Output.Baseinfo.PsnNo,
- // Age: res.Output.Baseinfo.Age,
- // PatientId: patient.ID,
- // Certno: res.Output.Baseinfo.Certno,
- // Brdy: res.Output.Baseinfo.Brdy,
- // Gend: res.Output.Baseinfo.Gend,
- // Naty: res.Output.Baseinfo.Naty,
- // PsnCertType: res.Output.Baseinfo.PsnCertType,
- // PsnName: res.Output.Baseinfo.PsnName,
- // Idetinfo: idetinfoStr,
- // Insuinfo: infoStr,
- // UserOrgId: c.GetAdminUserInfo().CurrentOrgId,
- // CardInfo: card_info,
- // VerifyNumber: token,
- // }
- // service.CreateHisPsn(psn)
- // c.ServeSuccessJSON(map[string]interface{}{
- // "patient": patient,
- // "number": token,
- // })
- // }
- // } else {
- // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeHisFailedException)
- // return
- // }
- // } else { //读卡失败
- // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeHisFailedException)
- // return
- // }
- // }
- // break
- // }
- //}
-
- var initFlag int64 = 0
-
- //func (c *HisApiController) TestGetBasBaseInit() {
- // DllDef := syscall.MustLoadDLL("SSCard.dll")
- // Iinit := DllDef.MustFindProc("Init")
- // miConfig, _ := service.FindMedicalInsuranceInfo(c.GetAdminUserInfo().CurrentOrgId)
- //
- // ret, _, err := Iinit.Call(StrPtr("http://igb.hsa.gdgov.cn/gdyb_api/prd/api/card/initDll"), StrPtr(miConfig.InsuplcAdmdvs))
- // if ret != 0 {
- // fmt.Println("SSCard的报错原因:", err)
- // fmt.Println("SSCard的运算结果为:", ret)
- // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeReadCardException)
- // return
- // }
- //
- // result := int(ret)
- // fmt.Println("SSCard的运算结果为1:", result)
- // initFlag = 1
- // return
- //}
-
- //func (c *HisApiController) GetSFZBaseInfo() string {
- // DllDef := syscall.MustLoadDLL("SSCard.dll")
- // readCard := DllDef.MustFindProc("ReadSFZ")
- // if readCard == nil {
- // fmt.Println("readcard is nil")
- // readCard = DllDef.MustFindProc("ReadSFZ")
- // }
- //
- // str := make([]byte, 256)
- // str1 := make([]byte, 256)
- // r, _, _ := readCard.Call((uintptr)(unsafe.Pointer(&str[0])), IntPtr(1024), (uintptr)(unsafe.Pointer(&str1[0])), IntPtr(1024))
- //
- // fmt.Println(r)
- // return string(str)
- //}
-
- //func (c *HisApiController) GetBasBaseInfo() string {
- // DllDef := syscall.MustLoadDLL("SSCard.dll")
- // readCard := DllDef.MustFindProc("ReadCardBas")
- // if readCard == nil {
- // fmt.Println("readcard is nil")
- // readCard = DllDef.MustFindProc("ReadCardBas")
- // }
- // str := make([]byte, 1024)
- // str1 := make([]byte, 1024)
- // ret2, _, _ := readCard.Call((uintptr)(unsafe.Pointer(&str[0])), uintptr(1024), (uintptr)(unsafe.Pointer(&str1[0])), uintptr(1024))
- // fmt.Println(string(str1))
- // fmt.Println(string(str))
- // fmt.Println(":", ConvertToString(string(str1), "gbk", "utf-8"))
- // fmt.Println(":", ConvertToString(string(str), "gbk", "utf-8"))
- // if ret2 != 0 {
- // return ""
- // }
- // return string(str)
- //}
-
- type CustomFundPay struct {
- FundPayType string `json:"fund_pay_type"`
- FundPayamt float64 `json:"fund_payamt"`
- }
-
- func (c *HisApiController) GetSettleList() {
-
- order_id, _ := c.GetInt64("order_id")
- admin_user_id, _ := c.GetInt64("admin_user_id")
-
- order, _ := service.GetHisOrderByIDTwo(order_id)
- roles, _ := service.GetDoctorListTwo(c.GetAdminUserInfo().CurrentOrgId)
- his, _ := service.GetHisPatientByNumber(order.MdtrtId)
- admin, _ := service.GetAdminUserByUserID(roles[0].AdminUserId)
- curRoles, _ := service.GetAdminUserInfoByID(c.GetAdminUserInfo().CurrentOrgId, admin_user_id)
- depart, _ := service.GetDepartMentDetail(curRoles.DepartmentId)
- miConfig, _ := service.FindMedicalInsuranceInfo(c.GetAdminUserInfo().CurrentOrgId)
-
- if order.ID == 0 {
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeHisOrderNoExistParamWrong)
- return
- }
-
- last_order, _ := service.GetLastHisOrder(c.GetAdminUserInfo().CurrentOrgId)
- max_order, _ := service.GetLastHisOrderTwo(c.GetAdminUserInfo().CurrentOrgId)
- count, _ := strconv.ParseInt(max_order.FaPiaoNumber, 10, 64)
- fmt.Println(count)
- var zero string
- number := count + 1
- if number >= 1000 {
- zero = "0000" + strconv.FormatInt(number, 10)
- } else if number >= 10000 {
- zero = "000" + strconv.FormatInt(number, 10)
- } else if number >= 100000 {
- zero = "00" + strconv.FormatInt(number, 10)
- } else if number >= 1000000 {
- zero = "0" + strconv.FormatInt(number, 10)
- } else {
- zero = strconv.FormatInt(number, 10)
- }
- fmt.Println(zero)
-
- struct4101 := service.Struct4101{
- PsnNo: order.PsnNo,
- MdtrtId: order.MdtrtId,
- SetlId: order.SetlId,
- PsnName: order.PsnName,
- Gend: order.Gend,
- Brdy: his.Brdy,
- Age: his.Age,
- Naty: order.Naty,
- PatnCertType: "01",
- Certno: order.Certno,
- Prfs: "90",
- ConerName: roles[0].UserName,
- PatnRlts: "99",
- ConerAddr: miConfig.OrgName,
- ConerTel: admin.Mobile,
- HiType: order.Insutype,
- Insuplc: miConfig.InsuplcAdmdvs,
- MaindiagFlag: "1",
- BillCode: last_order.FaPiaoCode,
- BillNo: zero,
- BizSn: order.Number,
- PsnSelfPay: order.PsnPartAmt,
- PsnOwnPay: order.PsnPartAmt,
- AcctPay: order.AcctPay,
- PsnCashpay: order.PsnCashPay,
- HiPaymtd: "1",
- Hsorg: miConfig.InsuplcAdmdvs,
- HsorgOpter: miConfig.InsuplcAdmdvs,
- MedinsFillPsn: curRoles.UserName,
- MedinsFillDept: depart.Name,
- IptMedType: "2",
- }
- struct4101.SetlBegnDate = order.SetlTime
- struct4101.SetlEndDate = order.SetlTime
- time_arr := strings.Split(order.SetlTime, " ")
- struct4101.AdmTime = time_arr[0]
- struct4101.AdmEndTime = time_arr[0]
-
- var rf []CustomFundPay
- json.Unmarshal([]byte(order.SetlDetail), &rf)
-
- var tempFunPays []service.CustomStruct
- for _, item := range rf {
- var tempFunPay service.CustomStruct
- // v1, _ := strconv.ParseFloat(item.FundPayamt, 64)
- tempFunPay.FundPayamt = item.FundPayamt
- tempFunPay.FundPayType = item.FundPayType
- tempFunPays = append(tempFunPays, tempFunPay)
- }
- struct4101.CustomStruct = tempFunPays
- fmt.Println("111111111")
- fmt.Println(tempFunPays)
- fmt.Println(struct4101.CustomStruct)
- var tempDiaginfos []service.DiaginfoStructTwo
- var tempOpspdiseinfo2 service.OpspdiseinfoStruct
- var tempOpspdiseinfos []service.OpspdiseinfoStruct
-
- diagnosis_ids := strings.Split(order.Diagnosis, ",")
- var config []*models.HisXtDiagnoseConfig
- for _, item := range diagnosis_ids {
- id, _ := strconv.ParseInt(item, 10, 64)
- diagnosisConfig, _ := service.FindDiagnoseById(id)
- config = append(config, &diagnosisConfig)
- }
-
- for index, item := range config {
- if index == 0 {
- var tempDiaginfo service.DiaginfoStructTwo
- tempDiaginfo.DiagCode = item.CountryCode
- tempDiaginfo.DiagName = item.CountryContentName
- tempDiaginfo.DiagType = "1"
- tempDiaginfo.MaindiagFlag = "1"
- tempDiaginfos = append(tempDiaginfos, tempDiaginfo)
- } else {
-
- var tempDiaginfo service.DiaginfoStructTwo
- tempDiaginfo.DiagCode = item.CountryCode
- tempDiaginfo.DiagName = item.CountryContentName
- tempDiaginfo.DiagType = "2"
- tempDiaginfo.MaindiagFlag = "0"
- tempDiaginfos = append(tempDiaginfos, tempDiaginfo)
- }
- }
- struct4101.Diseinfo = tempDiaginfos
-
- sickConfigTwo, _ := service.FindSickById(his.SickType)
- tempOpspdiseinfo2.DiagCode = sickConfigTwo.ContentCode
- tempOpspdiseinfo2.DiagName = sickConfigTwo.CountryContentName
- tempOpspdiseinfo2.OprnOprtCode = sickConfigTwo.ContentCode
- tempOpspdiseinfo2.OprnOprtName = sickConfigTwo.CountryContentName
- tempOpspdiseinfos = append(tempOpspdiseinfos, tempOpspdiseinfo2)
- struct4101.OpspdiseinfoStruct = tempOpspdiseinfos
-
- var iteminfo service.IteminfoStruct
-
- var bedCostTotal float64 = 0 //床位总费
- var bedCostSelfTotal float64 = 0 //床位自费
- var bedCostPartSelfTotal float64 = 0 //床位部分项目自费
-
- var operationCostTotal float64 = 0 //手术费
- var operationCostSelfTotal float64 = 0 //手术费
- var operationCostPartSelfTotal float64 = 0 //手术费
-
- var otherCostTotal float64 = 0 //其他费用
- var otherCostSelfTotal float64 = 0 //其他费用
- var otherCostPartSelfTotal float64 = 0 //其他费用
-
- var materialCostTotal float64 = 0 //材料费
- var materialCostSelfTotal float64 = 0 //材料费
- var materialCostPartSelfTotal float64 = 0 //材料费
-
- var westernMedicineCostTotal float64 = 0 //西药费
- var westernMedicineCostSelfTotal float64 = 0 //西药费
- var westernMedicineCostPartSelfTotal float64 = 0 //西药费
-
- var chineseTraditionalMedicineCostTotal float64 = 0 //中成药
- var chineseTraditionalMedicineCostSelfTotal float64 = 0 //中成药
- var chineseTraditionalMedicineCostPartSelfTotal float64 = 0 //中成药
-
- var checkCostTotal float64 = 0 //检查费
- var checkCostSelfTotal float64 = 0 //检查费
- var checkCostPartSelfTotal float64 = 0 //检查费
-
- var laboratoryCostTotal float64 = 0 //化验费
- var laboratoryCostSelfTotal float64 = 0 //化验费
- var laboratoryCostPartSelfTotal float64 = 0 //化验费
-
- var treatCostTotal float64 = 0 //治疗费用
- var treatCostSelfTotal float64 = 0 //治疗费用
- var treatCostPartSelfTotal float64 = 0 //治疗费用
-
- decimal.DivisionPrecision = 2
-
- var bed_fulamt_ownpay_amt float64 = 0
- var operation_fulamt_ownpay_amt float64 = 0
- var other_fulamt_ownpay_amt float64 = 0
- var westernMedicine_fulamt_ownpay_amt float64 = 0
- var chineseTraditional_fulamt_ownpay_amt float64 = 0
- var check_fulamt_ownpay_amt float64 = 0
- var material_fulamt_ownpay_amt float64 = 0
- var laboratory_fulamt_ownpay_amt float64 = 0
- var treat_fulamt_ownpay_amt float64 = 0
-
- var bed_claa_sunmfee float64 = 0
- var bed_clab_amt float64 = 0
- var bed_other_amt float64 = 0
-
- var operation_claa_sunmfee float64 = 0
- var operation_clab_amt float64 = 0
- var operation_other_amt float64 = 0
-
- var other_claa_sunmfee float64 = 0
- var other_clab_amt float64 = 0
- var other_other_amt float64 = 0
-
- var westernMedicine_claa_sunmfee float64 = 0
- var westernMedicine_clab_amt float64 = 0
- var westernMedicine_other_amt float64 = 0
-
- var chineseTraditional_claa_sunmfee float64 = 0
- var chineseTraditional_clab_amt float64 = 0
- var chineseTraditional_other_amt float64 = 0
-
- var check_claa_sunmfee float64 = 0
- var check_clab_amt float64 = 0
- var check_other_amt float64 = 0
-
- var material_claa_sunmfee float64 = 0
- var material_clab_amt float64 = 0
- var material_other_amt float64 = 0
-
- var laboratory_claa_sunmfee float64 = 0
- var laboratory_clab_amt float64 = 0
- var laboratory_other_amt float64 = 0
-
- var treat_claa_sunmfee float64 = 0
- var treat_clab_amt float64 = 0
- var treat_other_amt float64 = 0
-
- for _, item := range order.HisOrderInfo {
- if item.MedChrgitmType == "01" { //床位费
- bedCostTotal, _ = decimal.NewFromFloat(bedCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
- bedCostSelfTotal, _ = decimal.NewFromFloat(bedCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
- bedCostPartSelfTotal, _ = decimal.NewFromFloat(bedCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
- bed_fulamt_ownpay_amt, _ = decimal.NewFromFloat(bed_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
- if item.ChrgitmLv == "1" {
- bed_claa_sunmfee, _ = decimal.NewFromFloat(bed_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
- }
- if item.ChrgitmLv == "2" {
- bed_clab_amt, _ = decimal.NewFromFloat(bed_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
-
- }
- if item.ChrgitmLv == "3" {
- bed_other_amt, _ = decimal.NewFromFloat(bed_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
- }
-
- }
-
- if item.MedChrgitmType == "03" { //检查费
- checkCostTotal, _ = decimal.NewFromFloat(checkCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
- checkCostSelfTotal, _ = decimal.NewFromFloat(checkCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
- checkCostPartSelfTotal, _ = decimal.NewFromFloat(checkCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
- check_fulamt_ownpay_amt, _ = decimal.NewFromFloat(check_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
- if item.ChrgitmLv == "1" {
-
- check_claa_sunmfee, _ = decimal.NewFromFloat(check_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
-
- }
- if item.ChrgitmLv == "2" {
- check_clab_amt, _ = decimal.NewFromFloat(check_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
-
- }
- if item.ChrgitmLv == "3" {
- check_other_amt, _ = decimal.NewFromFloat(check_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
- }
- }
-
- if item.MedChrgitmType == "04" { //化验费
- laboratoryCostTotal, _ = decimal.NewFromFloat(laboratoryCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
- laboratoryCostSelfTotal, _ = decimal.NewFromFloat(laboratoryCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
- laboratoryCostPartSelfTotal, _ = decimal.NewFromFloat(laboratoryCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
- laboratory_fulamt_ownpay_amt, _ = decimal.NewFromFloat(laboratory_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
- if item.ChrgitmLv == "1" {
-
- laboratory_claa_sunmfee, _ = decimal.NewFromFloat(laboratory_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
-
- }
- if item.ChrgitmLv == "2" {
- laboratory_clab_amt, _ = decimal.NewFromFloat(laboratory_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
-
- }
- if item.ChrgitmLv == "3" {
- laboratory_other_amt, _ = decimal.NewFromFloat(laboratory_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
- }
- }
-
- if item.MedChrgitmType == "05" { //治疗费
- treatCostTotal, _ = decimal.NewFromFloat(treatCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
- treatCostSelfTotal, _ = decimal.NewFromFloat(treatCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
- treatCostPartSelfTotal, _ = decimal.NewFromFloat(treatCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
- treat_fulamt_ownpay_amt, _ = decimal.NewFromFloat(treat_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
- if item.ChrgitmLv == "1" {
-
- treat_claa_sunmfee, _ = decimal.NewFromFloat(treat_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
-
- }
- if item.ChrgitmLv == "2" {
- treat_clab_amt, _ = decimal.NewFromFloat(treat_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
-
- }
- if item.ChrgitmLv == "3" {
- treat_other_amt, _ = decimal.NewFromFloat(treat_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
- }
- }
-
- if item.MedChrgitmType == "06" { //手术费
- operationCostTotal, _ = decimal.NewFromFloat(operationCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
- operationCostSelfTotal, _ = decimal.NewFromFloat(operationCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
- operationCostPartSelfTotal, _ = decimal.NewFromFloat(operationCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
- operation_fulamt_ownpay_amt, _ = decimal.NewFromFloat(operation_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
-
- if item.ChrgitmLv == "1" {
-
- operation_claa_sunmfee, _ = decimal.NewFromFloat(operation_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
-
- }
- if item.ChrgitmLv == "2" {
- operation_clab_amt, _ = decimal.NewFromFloat(operation_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
-
- }
- if item.ChrgitmLv == "3" {
- operation_other_amt, _ = decimal.NewFromFloat(operation_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
- }
- }
-
- if item.MedChrgitmType == "08" { //材料费
- materialCostTotal, _ = decimal.NewFromFloat(materialCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
- materialCostSelfTotal, _ = decimal.NewFromFloat(materialCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
- materialCostPartSelfTotal, _ = decimal.NewFromFloat(materialCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
- material_fulamt_ownpay_amt, _ = decimal.NewFromFloat(material_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
- if item.ChrgitmLv == "1" {
-
- material_claa_sunmfee, _ = decimal.NewFromFloat(material_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
-
- }
- if item.ChrgitmLv == "2" {
- material_clab_amt, _ = decimal.NewFromFloat(material_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
-
- }
- if item.ChrgitmLv == "3" {
- material_other_amt, _ = decimal.NewFromFloat(material_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
- }
- }
-
- if item.MedChrgitmType == "09" { //西药费
- westernMedicineCostTotal, _ = decimal.NewFromFloat(westernMedicineCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
- westernMedicineCostSelfTotal, _ = decimal.NewFromFloat(westernMedicineCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
- westernMedicineCostPartSelfTotal, _ = decimal.NewFromFloat(westernMedicineCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
- westernMedicine_fulamt_ownpay_amt, _ = decimal.NewFromFloat(westernMedicine_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
- if item.ChrgitmLv == "1" {
-
- westernMedicine_claa_sunmfee, _ = decimal.NewFromFloat(westernMedicine_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
-
- }
- if item.ChrgitmLv == "2" {
- westernMedicine_clab_amt, _ = decimal.NewFromFloat(westernMedicine_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
-
- }
- if item.ChrgitmLv == "3" {
- westernMedicine_other_amt, _ = decimal.NewFromFloat(westernMedicine_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
- }
- }
-
- if item.MedChrgitmType == "11" { //中成费
- chineseTraditionalMedicineCostTotal, _ = decimal.NewFromFloat(chineseTraditionalMedicineCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
- chineseTraditionalMedicineCostSelfTotal, _ = decimal.NewFromFloat(chineseTraditionalMedicineCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
- chineseTraditionalMedicineCostPartSelfTotal, _ = decimal.NewFromFloat(chineseTraditionalMedicineCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
- chineseTraditional_fulamt_ownpay_amt, _ = decimal.NewFromFloat(chineseTraditional_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
- if item.ChrgitmLv == "1" {
-
- chineseTraditional_claa_sunmfee, _ = decimal.NewFromFloat(chineseTraditional_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
-
- }
- if item.ChrgitmLv == "2" {
- chineseTraditional_clab_amt, _ = decimal.NewFromFloat(chineseTraditional_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
-
- }
- if item.ChrgitmLv == "3" {
- chineseTraditional_other_amt, _ = decimal.NewFromFloat(chineseTraditional_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
- }
- }
-
- if item.MedChrgitmType == "14" { //其他费
- otherCostTotal, _ = decimal.NewFromFloat(otherCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
- otherCostSelfTotal, _ = decimal.NewFromFloat(otherCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
- otherCostPartSelfTotal, _ = decimal.NewFromFloat(otherCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
- other_fulamt_ownpay_amt, _ = decimal.NewFromFloat(other_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
- if item.ChrgitmLv == "1" {
- other_claa_sunmfee, _ = decimal.NewFromFloat(other_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
-
- }
- if item.ChrgitmLv == "2" {
- other_clab_amt, _ = decimal.NewFromFloat(other_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
-
- }
- if item.ChrgitmLv == "3" {
- other_other_amt, _ = decimal.NewFromFloat(other_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
- }
- }
-
- }
-
- var iteminfoStructs []service.IteminfoStruct
-
- if bedCostTotal != 0 {
- iteminfo.MedChrgitm = "01"
- iteminfo.FulamtOwnpayAmt = bed_fulamt_ownpay_amt
- iteminfo.Amt = bedCostTotal
- iteminfo.ClaaSumfee = bed_claa_sunmfee
- iteminfo.ClabAmt = bed_clab_amt
- iteminfo.OthAmt = bed_other_amt
- iteminfoStructs = append(iteminfoStructs, iteminfo)
- }
-
- if checkCostTotal != 0 {
- iteminfo.MedChrgitm = "03"
- iteminfo.FulamtOwnpayAmt = check_fulamt_ownpay_amt
- iteminfo.Amt = checkCostTotal
- iteminfo.ClaaSumfee = check_claa_sunmfee
- iteminfo.ClabAmt = check_clab_amt
- iteminfo.OthAmt = check_other_amt
- iteminfoStructs = append(iteminfoStructs, iteminfo)
-
- }
-
- if laboratoryCostTotal != 0 {
- iteminfo.MedChrgitm = "04"
- iteminfo.FulamtOwnpayAmt = laboratory_fulamt_ownpay_amt
- iteminfo.Amt = laboratoryCostTotal
- iteminfo.ClaaSumfee = laboratory_claa_sunmfee
- iteminfo.ClabAmt = laboratory_clab_amt
- iteminfo.OthAmt = laboratory_other_amt
- iteminfoStructs = append(iteminfoStructs, iteminfo)
-
- //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
-
- }
-
- if treatCostTotal != 0 {
- iteminfo.MedChrgitm = "05"
- iteminfo.FulamtOwnpayAmt = treat_fulamt_ownpay_amt
- iteminfo.Amt = treatCostTotal
- iteminfo.ClaaSumfee = treat_claa_sunmfee
- iteminfo.ClabAmt = treat_clab_amt
- iteminfo.OthAmt = treat_other_amt
- iteminfoStructs = append(iteminfoStructs, iteminfo)
- //(struct4101.IteminfoStruct, iteminfo)
- //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
- }
-
- if operationCostTotal != 0 {
- iteminfo.MedChrgitm = "06"
- iteminfo.FulamtOwnpayAmt = bed_fulamt_ownpay_amt
- iteminfo.Amt = operationCostTotal
- iteminfo.ClaaSumfee = operation_claa_sunmfee
- iteminfo.ClabAmt = operation_clab_amt
- iteminfo.OthAmt = operation_other_amt
- //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
- iteminfoStructs = append(iteminfoStructs, iteminfo)
- }
-
- if materialCostTotal != 0 {
- iteminfo.MedChrgitm = "08"
- iteminfo.FulamtOwnpayAmt = material_fulamt_ownpay_amt
- iteminfo.Amt = materialCostTotal
- iteminfo.ClaaSumfee = material_claa_sunmfee
- iteminfo.ClabAmt = material_clab_amt
- iteminfo.OthAmt = material_other_amt
- //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
- iteminfoStructs = append(iteminfoStructs, iteminfo)
- }
-
- if westernMedicineCostTotal != 0 {
- iteminfo.MedChrgitm = "09"
- iteminfo.FulamtOwnpayAmt = westernMedicine_fulamt_ownpay_amt
- iteminfo.Amt = westernMedicineCostTotal
- iteminfo.ClaaSumfee = westernMedicine_claa_sunmfee
- iteminfo.ClabAmt = westernMedicine_clab_amt
- iteminfo.OthAmt = westernMedicine_other_amt
- //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
- iteminfoStructs = append(iteminfoStructs, iteminfo)
-
- }
- if chineseTraditionalMedicineCostTotal != 0 {
- iteminfo.MedChrgitm = "11"
- iteminfo.FulamtOwnpayAmt = westernMedicine_fulamt_ownpay_amt
- iteminfo.Amt = westernMedicineCostTotal
- iteminfo.ClaaSumfee = westernMedicine_claa_sunmfee
- iteminfo.ClabAmt = westernMedicine_clab_amt
- iteminfo.OthAmt = westernMedicine_other_amt
- //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
- iteminfoStructs = append(iteminfoStructs, iteminfo)
-
- }
- if otherCostTotal != 0 {
- iteminfo.MedChrgitm = "14"
- iteminfo.FulamtOwnpayAmt = other_fulamt_ownpay_amt
- iteminfo.Amt = otherCostTotal
- iteminfo.ClaaSumfee = other_claa_sunmfee
- iteminfo.ClabAmt = other_clab_amt
- iteminfo.OthAmt = other_other_amt
- //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
- iteminfoStructs = append(iteminfoStructs, iteminfo)
-
- }
- struct4101.IteminfoStruct = iteminfoStructs
- struct4101.Ntly = "中国"
- struct4101.AdmCaty = "A03.06"
-
- var res ResultSeventeen
-
- if miConfig.MdtrtareaAdmvs == "320921" || miConfig.MdtrtareaAdmvs == "320982" {
- var resOther ResultSeventeenOther
- var pp models.PublicParams
- pp.InsuplcAdmdvs = miConfig.InsuplcAdmdvs
- pp.MdtrtareaAdmvs = miConfig.MdtrtareaAdmvs
- pp.FixmedinsName = miConfig.OrgName
- pp.FixmedinsCode = miConfig.Code
- pp.RequestUrl = miConfig.Url
- pp.Cainfo = miConfig.Cainfo
- pp.SecretKey = miConfig.SecretKey
- pp.AccessKey = miConfig.AccessKey
- pp.OpterName = curRoles.UserName
-
- client := &http.Client{}
- var req *http.Request
- data := make(map[string]interface{})
- data["struct4101"] = struct4101
- data["pp"] = pp
- bytesData, _ := json.Marshal(data)
- if miConfig.MdtrtareaAdmvs == "320921" {
- req, _ = http.NewRequest("POST", "http://192.168.3.111:9532/"+"jsyb/4101", bytes.NewReader(bytesData))
- } else {
- req, _ = http.NewRequest("POST", "http://192.168.5.251:9532/"+"jsyb/4101", bytes.NewReader(bytesData))
- }
- resp, _ := client.Do(req)
- defer resp.Body.Close()
- body, ioErr := ioutil.ReadAll(resp.Body)
- if ioErr != nil {
- utils.ErrorLog("接口返回数据读取失败: %v", ioErr)
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
- var respJSON map[string]interface{}
- if err := json.Unmarshal([]byte(body), &respJSON); err != nil {
- utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
-
- respJSON = respJSON["data"].(map[string]interface{})["pre"].(map[string]interface{})
- userJSONBytes, _ := json.Marshal(respJSON)
- fmt.Println("log")
- fmt.Println(string(userJSONBytes))
- if err := json.Unmarshal(userJSONBytes, &resOther); err != nil {
- utils.ErrorLog("解析失败:%v", err)
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
- res.InfRefmsgid = resOther.InfRefmsgid
- res.Output = resOther.Output
- res.ErrMsg = resOther.ErrMsg
- infocode, _ := strconv.ParseInt(resOther.Infcode, 10, 64)
- res.Infcode = infocode
- } else {
-
- result := service.Gdyb4101ForGZ(struct4101, miConfig.SecretKey, miConfig.OrgName, curRoles.UserName, miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.UserOrgId)
- var dat map[string]interface{}
- if err := json.Unmarshal([]byte(result), &dat); err == nil {
- fmt.Println(dat)
- } else {
- fmt.Println(err)
- }
- userJSONBytes, _ := json.Marshal(dat)
- if err := json.Unmarshal(userJSONBytes, &res); err != nil {
- utils.ErrorLog("解析失败:%v", err)
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
- }
-
- if res.Infcode != 0 {
-
- c.ServeSuccessJSON(map[string]interface{}{
- "failed_code": -10,
- "msg": res.ErrMsg,
- })
- return
- } else {
- order.FaPiaoNumber = zero
- order.FaPiaoCode = last_order.FaPiaoCode
- service.UpdateOrder(order)
- hisFundSettleListResult := &models.HisFundSettleListResult{
- Number: res.Output.SetlListId,
- Status: 1,
- Ctime: time.Now().Unix(),
- Mtime: time.Now().Unix(),
- UserOrgId: c.GetAdminUserInfo().CurrentOrgId,
- IsUpload: 1,
- OrderId: order_id,
- }
- service.CreateUploadRecord(hisFundSettleListResult)
- c.ServeSuccessJSON(map[string]interface{}{
- "msg": "上传成功",
- "result": hisFundSettleListResult,
- })
- return
- }
- }
-
- func (c *HisApiController) GetSettleListHospital() {
-
- order_id, _ := c.GetInt64("order_id")
- admin_user_id, _ := c.GetInt64("admin_user_id")
-
- order, _ := service.GetHisOrderByIDTwo(order_id)
- roles, _ := service.GetDoctorListTwo(c.GetAdminUserInfo().CurrentOrgId)
- his, _ := service.GetInHospitalRecordByNumber(order.MdtrtId)
- admin, _ := service.GetAdminUserByUserID(roles[0].AdminUserId)
- curRoles, _ := service.GetAdminUserInfoByID(c.GetAdminUserInfo().CurrentOrgId, admin_user_id)
- depart, _ := service.GetDepartMentDetail(curRoles.DepartmentId)
- miConfig, _ := service.FindMedicalInsuranceInfo(c.GetAdminUserInfo().CurrentOrgId)
-
- if order.ID == 0 {
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeHisOrderNoExistParamWrong)
- return
- }
-
- last_order, _ := service.GetLastHisOrder(c.GetAdminUserInfo().CurrentOrgId)
- max_order, _ := service.GetLastHisOrderTwo(c.GetAdminUserInfo().CurrentOrgId)
- count, _ := strconv.ParseInt(max_order.FaPiaoNumber, 10, 64)
- fmt.Println(count)
- var zero string
- number := count + 1
- if number >= 1000 {
- zero = "0000" + strconv.FormatInt(number, 10)
- } else if number >= 10000 {
- zero = "000" + strconv.FormatInt(number, 10)
- } else if number >= 100000 {
- zero = "00" + strconv.FormatInt(number, 10)
- } else if number >= 1000000 {
- zero = "0" + strconv.FormatInt(number, 10)
- } else {
- zero = strconv.FormatInt(number, 10)
- }
- fmt.Println(zero)
-
- struct4101 := service.Struct4101{
- PsnNo: order.PsnNo,
- MdtrtId: order.MdtrtId,
- SetlId: order.SetlId,
- PsnName: order.PsnName,
- Gend: order.Gend,
- Brdy: his.Brdy,
- Age: int64(order.Age),
- Naty: order.Naty,
- PatnCertType: "01",
- Certno: order.Certno,
- Prfs: "90",
- ConerName: roles[0].UserName,
- PatnRlts: "99",
- ConerAddr: miConfig.OrgName,
- ConerTel: admin.Mobile,
- HiType: order.Insutype,
- Insuplc: miConfig.InsuplcAdmdvs,
- MaindiagFlag: "1",
- BillCode: last_order.FaPiaoCode,
- BillNo: zero,
- BizSn: order.Number,
- PsnSelfPay: order.PsnPartAmt,
- PsnOwnPay: order.PsnPartAmt,
- AcctPay: order.AcctPay,
- PsnCashpay: order.PsnCashPay,
- HiPaymtd: "1",
- Hsorg: miConfig.InsuplcAdmdvs,
- HsorgOpter: miConfig.InsuplcAdmdvs,
- MedinsFillPsn: curRoles.UserName,
- MedinsFillDept: depart.Name,
- IptMedType: "2",
- AdmTime: his.InHosptialTime,
- AdmEndTime: his.OutHosptialTime,
- }
- struct4101.SetlBegnDate = order.SetlTime
- struct4101.SetlEndDate = order.SetlTime
-
- var rf []CustomFundPay
- json.Unmarshal([]byte(order.SetlDetail), &rf)
-
- var tempFunPays []service.CustomStruct
- for _, item := range rf {
- var tempFunPay service.CustomStruct
- tempFunPay.FundPayamt = item.FundPayamt
- tempFunPay.FundPayType = item.FundPayType
- tempFunPays = append(tempFunPays, tempFunPay)
- }
- fmt.Println("111111111")
- fmt.Println(tempFunPays)
- struct4101.CustomStruct = tempFunPays
- fmt.Println(struct4101.CustomStruct)
- var tempDiaginfos []service.DiaginfoStructTwo
- var tempOpspdiseinfo2 service.OpspdiseinfoStruct
- var tempOpspdiseinfos []service.OpspdiseinfoStruct
- diagnosis_ids := strings.Split(his.Diagnosis, ",")
- var config []*models.HisXtDiagnoseConfig
- for _, item := range diagnosis_ids {
- id, _ := strconv.ParseInt(item, 10, 64)
- diagnosisConfig, _ := service.FindDiagnoseById(id)
- config = append(config, &diagnosisConfig)
- }
-
- for index, item := range config {
- if index == 0 {
- var tempDiaginfo service.DiaginfoStructTwo
- tempDiaginfo.DiagCode = item.CountryCode
- tempDiaginfo.DiagName = item.CountryContentName
- tempDiaginfo.DiagType = "1"
- tempDiaginfo.MaindiagFlag = "1"
- tempDiaginfos = append(tempDiaginfos, tempDiaginfo)
- } else {
-
- var tempDiaginfo service.DiaginfoStructTwo
- tempDiaginfo.DiagCode = item.CountryCode
- tempDiaginfo.DiagName = item.CountryContentName
- tempDiaginfo.DiagType = "2"
- tempDiaginfo.MaindiagFlag = "0"
- tempDiaginfos = append(tempDiaginfos, tempDiaginfo)
- }
- }
- struct4101.Diseinfo = tempDiaginfos
-
- sickConfigTwo, _ := service.FindSickById(his.SickType)
- tempOpspdiseinfo2.DiagCode = sickConfigTwo.ContentCode
- tempOpspdiseinfo2.DiagName = sickConfigTwo.CountryContentName
- tempOpspdiseinfo2.OprnOprtCode = ""
- tempOpspdiseinfo2.OprnOprtName = ""
- tempOpspdiseinfos = append(tempOpspdiseinfos, tempOpspdiseinfo2)
- struct4101.OpspdiseinfoStruct = tempOpspdiseinfos
-
- var iteminfo service.IteminfoStruct
-
- var bedCostTotal float64 = 0 //床位总费
- var bedCostSelfTotal float64 = 0 //床位自费
- var bedCostPartSelfTotal float64 = 0 //床位部分项目自费
-
- var operationCostTotal float64 = 0 //手术费
- var operationCostSelfTotal float64 = 0 //手术费
- var operationCostPartSelfTotal float64 = 0 //手术费
-
- var otherCostTotal float64 = 0 //其他费用
- var otherCostSelfTotal float64 = 0 //其他费用
- var otherCostPartSelfTotal float64 = 0 //其他费用
-
- var materialCostTotal float64 = 0 //材料费
- var materialCostSelfTotal float64 = 0 //材料费
- var materialCostPartSelfTotal float64 = 0 //材料费
-
- var westernMedicineCostTotal float64 = 0 //西药费
- var westernMedicineCostSelfTotal float64 = 0 //西药费
- var westernMedicineCostPartSelfTotal float64 = 0 //西药费
-
- var chineseTraditionalMedicineCostTotal float64 = 0 //中成药
- var chineseTraditionalMedicineCostSelfTotal float64 = 0 //中成药
- var chineseTraditionalMedicineCostPartSelfTotal float64 = 0 //中成药
-
- var checkCostTotal float64 = 0 //检查费
- var checkCostSelfTotal float64 = 0 //检查费
- var checkCostPartSelfTotal float64 = 0 //检查费
-
- var laboratoryCostTotal float64 = 0 //化验费
- var laboratoryCostSelfTotal float64 = 0 //化验费
- var laboratoryCostPartSelfTotal float64 = 0 //化验费
-
- var treatCostTotal float64 = 0 //治疗费用
- var treatCostSelfTotal float64 = 0 //治疗费用
- var treatCostPartSelfTotal float64 = 0 //治疗费用
-
- decimal.DivisionPrecision = 2
-
- var bed_fulamt_ownpay_amt float64 = 0
- var operation_fulamt_ownpay_amt float64 = 0
- var other_fulamt_ownpay_amt float64 = 0
- var westernMedicine_fulamt_ownpay_amt float64 = 0
- var chineseTraditional_fulamt_ownpay_amt float64 = 0
- var check_fulamt_ownpay_amt float64 = 0
- var material_fulamt_ownpay_amt float64 = 0
- var laboratory_fulamt_ownpay_amt float64 = 0
- var treat_fulamt_ownpay_amt float64 = 0
-
- var bed_claa_sunmfee float64 = 0
- var bed_clab_amt float64 = 0
- var bed_other_amt float64 = 0
-
- var operation_claa_sunmfee float64 = 0
- var operation_clab_amt float64 = 0
- var operation_other_amt float64 = 0
-
- var other_claa_sunmfee float64 = 0
- var other_clab_amt float64 = 0
- var other_other_amt float64 = 0
-
- var westernMedicine_claa_sunmfee float64 = 0
- var westernMedicine_clab_amt float64 = 0
- var westernMedicine_other_amt float64 = 0
-
- var chineseTraditional_claa_sunmfee float64 = 0
- var chineseTraditional_clab_amt float64 = 0
- var chineseTraditional_other_amt float64 = 0
-
- var check_claa_sunmfee float64 = 0
- var check_clab_amt float64 = 0
- var check_other_amt float64 = 0
-
- var material_claa_sunmfee float64 = 0
- var material_clab_amt float64 = 0
- var material_other_amt float64 = 0
-
- var laboratory_claa_sunmfee float64 = 0
- var laboratory_clab_amt float64 = 0
- var laboratory_other_amt float64 = 0
-
- var treat_claa_sunmfee float64 = 0
- var treat_clab_amt float64 = 0
- var treat_other_amt float64 = 0
-
- for _, item := range order.HisOrderInfo {
- if item.MedChrgitmType == "01" { //床位费
- bedCostTotal, _ = decimal.NewFromFloat(bedCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
- bedCostSelfTotal, _ = decimal.NewFromFloat(bedCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
- bedCostPartSelfTotal, _ = decimal.NewFromFloat(bedCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
- bed_fulamt_ownpay_amt, _ = decimal.NewFromFloat(bed_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
- if item.ChrgitmLv == "1" {
- bed_claa_sunmfee, _ = decimal.NewFromFloat(bed_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
- }
- if item.ChrgitmLv == "2" {
- bed_clab_amt, _ = decimal.NewFromFloat(bed_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
-
- }
- if item.ChrgitmLv == "3" {
- bed_other_amt, _ = decimal.NewFromFloat(bed_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
- }
-
- }
-
- if item.MedChrgitmType == "03" { //检查费
- checkCostTotal, _ = decimal.NewFromFloat(checkCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
- checkCostSelfTotal, _ = decimal.NewFromFloat(checkCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
- checkCostPartSelfTotal, _ = decimal.NewFromFloat(checkCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
- check_fulamt_ownpay_amt, _ = decimal.NewFromFloat(check_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
- if item.ChrgitmLv == "1" {
-
- check_claa_sunmfee, _ = decimal.NewFromFloat(check_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
-
- }
- if item.ChrgitmLv == "2" {
- check_clab_amt, _ = decimal.NewFromFloat(check_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
-
- }
- if item.ChrgitmLv == "3" {
- check_other_amt, _ = decimal.NewFromFloat(check_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
- }
- }
-
- if item.MedChrgitmType == "04" { //化验费
- laboratoryCostTotal, _ = decimal.NewFromFloat(laboratoryCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
- laboratoryCostSelfTotal, _ = decimal.NewFromFloat(laboratoryCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
- laboratoryCostPartSelfTotal, _ = decimal.NewFromFloat(laboratoryCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
- laboratory_fulamt_ownpay_amt, _ = decimal.NewFromFloat(laboratory_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
- if item.ChrgitmLv == "1" {
-
- laboratory_claa_sunmfee, _ = decimal.NewFromFloat(laboratory_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
-
- }
- if item.ChrgitmLv == "2" {
- laboratory_clab_amt, _ = decimal.NewFromFloat(laboratory_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
-
- }
- if item.ChrgitmLv == "3" {
- laboratory_other_amt, _ = decimal.NewFromFloat(laboratory_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
- }
- }
-
- if item.MedChrgitmType == "05" { //治疗费
- treatCostTotal, _ = decimal.NewFromFloat(treatCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
- treatCostSelfTotal, _ = decimal.NewFromFloat(treatCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
- treatCostPartSelfTotal, _ = decimal.NewFromFloat(treatCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
- treat_fulamt_ownpay_amt, _ = decimal.NewFromFloat(treat_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
- if item.ChrgitmLv == "1" {
-
- treat_claa_sunmfee, _ = decimal.NewFromFloat(treat_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
-
- }
- if item.ChrgitmLv == "2" {
- treat_clab_amt, _ = decimal.NewFromFloat(treat_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
-
- }
- if item.ChrgitmLv == "3" {
- treat_other_amt, _ = decimal.NewFromFloat(treat_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
- }
- }
-
- if item.MedChrgitmType == "06" { //手术费
- operationCostTotal, _ = decimal.NewFromFloat(operationCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
- operationCostSelfTotal, _ = decimal.NewFromFloat(operationCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
- operationCostPartSelfTotal, _ = decimal.NewFromFloat(operationCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
- operation_fulamt_ownpay_amt, _ = decimal.NewFromFloat(operation_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
-
- if item.ChrgitmLv == "1" {
-
- operation_claa_sunmfee, _ = decimal.NewFromFloat(operation_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
-
- }
- if item.ChrgitmLv == "2" {
- operation_clab_amt, _ = decimal.NewFromFloat(operation_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
-
- }
- if item.ChrgitmLv == "3" {
- operation_other_amt, _ = decimal.NewFromFloat(operation_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
- }
- }
-
- if item.MedChrgitmType == "08" { //材料费
- materialCostTotal, _ = decimal.NewFromFloat(materialCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
- materialCostSelfTotal, _ = decimal.NewFromFloat(materialCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
- materialCostPartSelfTotal, _ = decimal.NewFromFloat(materialCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
- material_fulamt_ownpay_amt, _ = decimal.NewFromFloat(material_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
- if item.ChrgitmLv == "1" {
-
- material_claa_sunmfee, _ = decimal.NewFromFloat(material_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
-
- }
- if item.ChrgitmLv == "2" {
- material_clab_amt, _ = decimal.NewFromFloat(material_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
-
- }
- if item.ChrgitmLv == "3" {
- material_other_amt, _ = decimal.NewFromFloat(material_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
- }
- }
-
- if item.MedChrgitmType == "09" { //西药费
- westernMedicineCostTotal, _ = decimal.NewFromFloat(westernMedicineCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
- westernMedicineCostSelfTotal, _ = decimal.NewFromFloat(westernMedicineCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
- westernMedicineCostPartSelfTotal, _ = decimal.NewFromFloat(westernMedicineCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
- westernMedicine_fulamt_ownpay_amt, _ = decimal.NewFromFloat(westernMedicine_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
- if item.ChrgitmLv == "1" {
-
- westernMedicine_claa_sunmfee, _ = decimal.NewFromFloat(westernMedicine_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
-
- }
- if item.ChrgitmLv == "2" {
- westernMedicine_clab_amt, _ = decimal.NewFromFloat(westernMedicine_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
-
- }
- if item.ChrgitmLv == "3" {
- westernMedicine_other_amt, _ = decimal.NewFromFloat(westernMedicine_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
- }
- }
-
- if item.MedChrgitmType == "11" { //中成费
- chineseTraditionalMedicineCostTotal, _ = decimal.NewFromFloat(chineseTraditionalMedicineCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
- chineseTraditionalMedicineCostSelfTotal, _ = decimal.NewFromFloat(chineseTraditionalMedicineCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
- chineseTraditionalMedicineCostPartSelfTotal, _ = decimal.NewFromFloat(chineseTraditionalMedicineCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
- chineseTraditional_fulamt_ownpay_amt, _ = decimal.NewFromFloat(chineseTraditional_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
- if item.ChrgitmLv == "1" {
-
- chineseTraditional_claa_sunmfee, _ = decimal.NewFromFloat(chineseTraditional_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
-
- }
- if item.ChrgitmLv == "2" {
- chineseTraditional_clab_amt, _ = decimal.NewFromFloat(chineseTraditional_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
-
- }
- if item.ChrgitmLv == "3" {
- chineseTraditional_other_amt, _ = decimal.NewFromFloat(chineseTraditional_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
- }
- }
-
- if item.MedChrgitmType == "14" { //其他费
- otherCostTotal, _ = decimal.NewFromFloat(otherCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
- otherCostSelfTotal, _ = decimal.NewFromFloat(otherCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
- otherCostPartSelfTotal, _ = decimal.NewFromFloat(otherCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
- other_fulamt_ownpay_amt, _ = decimal.NewFromFloat(other_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
- if item.ChrgitmLv == "1" {
- other_claa_sunmfee, _ = decimal.NewFromFloat(other_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
-
- }
- if item.ChrgitmLv == "2" {
- other_clab_amt, _ = decimal.NewFromFloat(other_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
-
- }
- if item.ChrgitmLv == "3" {
- other_other_amt, _ = decimal.NewFromFloat(other_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
- }
- }
-
- }
-
- var iteminfoStructs []service.IteminfoStruct
-
- if bedCostTotal != 0 {
- iteminfo.MedChrgitm = "01"
- iteminfo.FulamtOwnpayAmt = bed_fulamt_ownpay_amt
- iteminfo.Amt = bedCostTotal
- iteminfo.ClaaSumfee = bed_claa_sunmfee
- iteminfo.ClabAmt = bed_clab_amt
- iteminfo.OthAmt = bed_other_amt
- iteminfoStructs = append(iteminfoStructs, iteminfo)
- }
-
- if checkCostTotal != 0 {
- iteminfo.MedChrgitm = "03"
- iteminfo.FulamtOwnpayAmt = check_fulamt_ownpay_amt
- iteminfo.Amt = checkCostTotal
- iteminfo.ClaaSumfee = check_claa_sunmfee
- iteminfo.ClabAmt = check_clab_amt
- iteminfo.OthAmt = check_other_amt
- iteminfoStructs = append(iteminfoStructs, iteminfo)
-
- }
-
- if laboratoryCostTotal != 0 {
- iteminfo.MedChrgitm = "04"
- iteminfo.FulamtOwnpayAmt = laboratory_fulamt_ownpay_amt
- iteminfo.Amt = laboratoryCostTotal
- iteminfo.ClaaSumfee = laboratory_claa_sunmfee
- iteminfo.ClabAmt = laboratory_clab_amt
- iteminfo.OthAmt = laboratory_other_amt
- iteminfoStructs = append(iteminfoStructs, iteminfo)
-
- //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
-
- }
-
- if treatCostTotal != 0 {
- iteminfo.MedChrgitm = "05"
- iteminfo.FulamtOwnpayAmt = treat_fulamt_ownpay_amt
- iteminfo.Amt = treatCostTotal
- iteminfo.ClaaSumfee = treat_claa_sunmfee
- iteminfo.ClabAmt = treat_clab_amt
- iteminfo.OthAmt = treat_other_amt
- iteminfoStructs = append(iteminfoStructs, iteminfo)
- //(struct4101.IteminfoStruct, iteminfo)
- //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
- }
-
- if operationCostTotal != 0 {
- iteminfo.MedChrgitm = "06"
- iteminfo.FulamtOwnpayAmt = bed_fulamt_ownpay_amt
- iteminfo.Amt = operationCostTotal
- iteminfo.ClaaSumfee = operation_claa_sunmfee
- iteminfo.ClabAmt = operation_clab_amt
- iteminfo.OthAmt = operation_other_amt
- //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
- iteminfoStructs = append(iteminfoStructs, iteminfo)
- }
-
- if materialCostTotal != 0 {
- iteminfo.MedChrgitm = "08"
- iteminfo.FulamtOwnpayAmt = material_fulamt_ownpay_amt
- iteminfo.Amt = materialCostTotal
- iteminfo.ClaaSumfee = material_claa_sunmfee
- iteminfo.ClabAmt = material_clab_amt
- iteminfo.OthAmt = material_other_amt
- //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
- iteminfoStructs = append(iteminfoStructs, iteminfo)
- }
-
- if westernMedicineCostTotal != 0 {
- iteminfo.MedChrgitm = "09"
- iteminfo.FulamtOwnpayAmt = westernMedicine_fulamt_ownpay_amt
- iteminfo.Amt = westernMedicineCostTotal
- iteminfo.ClaaSumfee = westernMedicine_claa_sunmfee
- iteminfo.ClabAmt = westernMedicine_clab_amt
- iteminfo.OthAmt = westernMedicine_other_amt
- //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
- iteminfoStructs = append(iteminfoStructs, iteminfo)
-
- }
- if chineseTraditionalMedicineCostTotal != 0 {
- iteminfo.MedChrgitm = "11"
- iteminfo.FulamtOwnpayAmt = westernMedicine_fulamt_ownpay_amt
- iteminfo.Amt = westernMedicineCostTotal
- iteminfo.ClaaSumfee = westernMedicine_claa_sunmfee
- iteminfo.ClabAmt = westernMedicine_clab_amt
- iteminfo.OthAmt = westernMedicine_other_amt
- //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
- iteminfoStructs = append(iteminfoStructs, iteminfo)
-
- }
- if otherCostTotal != 0 {
- iteminfo.MedChrgitm = "14"
- iteminfo.FulamtOwnpayAmt = other_fulamt_ownpay_amt
- iteminfo.Amt = otherCostTotal
- iteminfo.ClaaSumfee = other_claa_sunmfee
- iteminfo.ClabAmt = other_clab_amt
- iteminfo.OthAmt = other_other_amt
- //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
- iteminfoStructs = append(iteminfoStructs, iteminfo)
-
- }
- struct4101.IteminfoStruct = iteminfoStructs
- struct4101.Ntly = "中国"
- struct4101.AdmCaty = "A03.06"
- fmt.Println("111111111")
- fmt.Println(tempFunPays)
- struct4101.CustomStruct = tempFunPays
- fmt.Println(struct4101.CustomStruct)
- result := service.Gdyb4101ForGZ(struct4101, miConfig.SecretKey, miConfig.OrgName, curRoles.UserName, miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.UserOrgId)
- fmt.Println(result)
-
- var dat map[string]interface{}
- if err := json.Unmarshal([]byte(result), &dat); err == nil {
- fmt.Println(dat)
- } else {
- fmt.Println(err)
- }
- userJSONBytes, _ := json.Marshal(dat)
- var res ResultSeventeen
- if err := json.Unmarshal(userJSONBytes, &res); err != nil {
- utils.ErrorLog("解析失败:%v", err)
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
- if res.Infcode != 0 {
-
- c.ServeSuccessJSON(map[string]interface{}{
- "failed_code": -10,
- "msg": res.ErrMsg,
- })
- return
- } else {
- order.FaPiaoNumber = zero
- order.FaPiaoCode = last_order.FaPiaoCode
- service.UpdateOrder(order)
- hisFundSettleListResult := &models.HisFundSettleListResult{
- Number: res.Output.SetlListId,
- Status: 1,
- Ctime: time.Now().Unix(),
- Mtime: time.Now().Unix(),
- UserOrgId: c.GetAdminUserInfo().CurrentOrgId,
- IsUpload: 1,
- OrderId: order_id,
- }
- service.CreateUploadRecord(hisFundSettleListResult)
- c.ServeSuccessJSON(map[string]interface{}{
- "msg": "上传成功",
- "result": hisFundSettleListResult,
- })
- return
- }
- }
-
- func (c *HisApiController) GetBatchSettleList() {
- orders, _ := service.GetAllHisOrder(10106)
- for _, item := range orders {
- order_id := item.ID
- order, _ := service.GetHisOrderByIDTwo(order_id)
- roles, _ := service.GetDoctorListTwo(c.GetAdminUserInfo().CurrentOrgId)
- his, _ := service.GetHisPatientByNumber(order.MdtrtId)
- admin, _ := service.GetAdminUserByUserID(roles[0].AdminUserId)
- curRoles, _ := service.GetAdminUserInfoByID(c.GetAdminUserInfo().CurrentOrgId, 2495)
- depart, _ := service.GetDepartMentDetail(curRoles.DepartmentId)
- miConfig, _ := service.FindMedicalInsuranceInfo(c.GetAdminUserInfo().CurrentOrgId)
-
- if order.ID == 0 {
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeHisOrderNoExistParamWrong)
- return
- }
- if his.BalanceAccountsType == 2 {
- continue
- }
- struct4101 := service.Struct4101{
- PsnNo: order.PsnNo,
- MdtrtId: order.MdtrtId,
- SetlId: order.SetlId,
- PsnName: order.PsnName,
- Gend: order.Gend,
- Brdy: his.Brdy,
- Age: his.Age,
- Naty: order.Naty,
- PatnCertType: "01",
- Certno: order.Certno,
- Prfs: "90",
- ConerName: roles[0].UserName,
- PatnRlts: "99",
- ConerAddr: miConfig.OrgName,
- ConerTel: admin.Mobile,
- HiType: order.Insutype,
- Insuplc: his.InsuplcAdmdvs,
- MaindiagFlag: "1",
- BillCode: order.FaPiaoCode,
- BillNo: order.FaPiaoNumber,
- BizSn: order.Number,
- PsnSelfPay: order.PsnPartAmt,
- PsnOwnPay: order.PsnPartAmt,
- AcctPay: order.AcctPay,
- PsnCashpay: order.PsnCashPay,
- HiPaymtd: "1",
- Hsorg: his.InsuplcAdmdvs,
- HsorgOpter: his.InsuplcAdmdvs,
- MedinsFillPsn: curRoles.UserName,
- MedinsFillDept: depart.Name,
- IptMedType: "2",
- }
- struct4101.SetlBegnDate = order.SetlTime
- struct4101.SetlEndDate = order.SetlTime
- //if order.SettleType == 1 {
- // t := time.Unix(int64(order.SettleAccountsDate), 0)
- // dateStr := t.Format("2006-01-02")
- // struct4101.SetlBegnDate = dateStr
- // struct4101.SetlEndDate = dateStr
- //} else {
- // t := time.Unix(int64(order.SettleStartTime), 0)
- // t2 := time.Unix(int64(order.SettleEndTime), 0)
- // dateStartStr := t.Format("2006-01-02")
- // dateEndStr := t2.Format("2006-01-02")
- // struct4101.SetlBegnDate = dateStartStr
- // struct4101.SetlEndDate = dateEndStr
- //}
-
- var rf []CustomFundPay
- json.Unmarshal([]byte(order.SetlDetail), &rf)
-
- var tempFunPays []service.CustomStruct
- var tempFunPay610100 service.CustomStruct
-
- for _, item := range rf {
- if item.FundPayType == "610100" {
- tempFunPay610100.FundPayamt, _ = decimal.NewFromFloat(tempFunPay610100.FundPayamt).Add(decimal.NewFromFloat(item.FundPayamt)).Float64()
- tempFunPay610100.FundPayType = item.FundPayType
- } else {
- var tempFunPay service.CustomStruct
- tempFunPay.FundPayamt = item.FundPayamt
- tempFunPay.FundPayType = item.FundPayType
- tempFunPays = append(tempFunPays, tempFunPay)
- }
- }
- tempFunPays = append(tempFunPays, tempFunPay610100)
- struct4101.CustomStruct = tempFunPays
-
- var tempDiaginfos []service.DiaginfoStructTwo
- var tempOpspdiseinfo2 service.OpspdiseinfoStruct
- var tempOpspdiseinfos []service.OpspdiseinfoStruct
-
- diagnosis_ids := strings.Split(his.Diagnosis, ",")
- var config []*models.HisXtDiagnoseConfig
- for _, item := range diagnosis_ids {
- id, _ := strconv.ParseInt(item, 10, 64)
- diagnosisConfig, _ := service.FindDiagnoseById(id)
- config = append(config, &diagnosisConfig)
- }
-
- for index, item := range config {
- if index == 0 {
- var tempDiaginfo service.DiaginfoStructTwo
- tempDiaginfo.DiagCode = item.CountryCode
- tempDiaginfo.DiagName = item.CountryContentName
- tempDiaginfo.DiagType = "1"
- tempDiaginfo.MaindiagFlag = "1"
- tempDiaginfos = append(tempDiaginfos, tempDiaginfo)
- } else {
-
- var tempDiaginfo service.DiaginfoStructTwo
- tempDiaginfo.DiagCode = item.CountryCode
- tempDiaginfo.DiagName = item.CountryContentName
- tempDiaginfo.DiagType = "2"
- tempDiaginfo.MaindiagFlag = "0"
- tempDiaginfos = append(tempDiaginfos, tempDiaginfo)
- }
- }
- struct4101.Diseinfo = tempDiaginfos
-
- sickConfigTwo, _ := service.FindSickById(his.SickType)
- tempOpspdiseinfo2.DiagCode = sickConfigTwo.ContentCode
- tempOpspdiseinfo2.DiagName = sickConfigTwo.CountryContentName
- tempOpspdiseinfo2.OprnOprtCode = ""
- tempOpspdiseinfo2.OprnOprtName = ""
- tempOpspdiseinfos = append(tempOpspdiseinfos, tempOpspdiseinfo2)
- struct4101.OpspdiseinfoStruct = tempOpspdiseinfos
-
- var iteminfo service.IteminfoStruct
-
- var bedCostTotal float64 = 0 //床位总费
- var bedCostSelfTotal float64 = 0 //床位自费
- var bedCostPartSelfTotal float64 = 0 //床位部分项目自费
-
- var examineCostTotal float64 = 0 //诊查总费
- var examineCostSelfTotal float64 = 0 //诊查自费
- var examineCostPartSelfTotal float64 = 0 //诊查部分项目自费
-
- var nursingCostTotal float64 = 0 //护理总费
- var nursingCostSelfTotal float64 = 0 //护理自费
- var nursingCostPartSelfTotal float64 = 0 //护理部分项目自费
-
- var chineseMedicineCostTotal float64 = 0 //中成药
- var chineseMedicineCostSelfTotal float64 = 0 //中成药
- var chineseMedicineCostPartSelfTotal float64 = 0 //中成药
-
- var commonlyTreatmentCostTotal float64 = 0 //一般诊疗费
- var commonlyTreatmentCostSelfTotal float64 = 0 //一般诊疗费
- var commonlyTreatmentCostPartSelfTotal float64 = 0 //一般诊疗费
-
- var registerCostTotal float64 = 0 //一般诊疗费
- var registerCostSelfTotal float64 = 0 //一般诊疗费
- var registerPartSelfTotal float64 = 0 //一般诊疗费
-
- var operationCostTotal float64 = 0 //手术费
- var operationCostSelfTotal float64 = 0 //手术费
- var operationCostPartSelfTotal float64 = 0 //手术费
-
- var otherCostTotal float64 = 0 //其他费用
- var otherCostSelfTotal float64 = 0 //其他费用
- var otherCostPartSelfTotal float64 = 0 //其他费用
-
- var materialCostTotal float64 = 0 //材料费
- var materialCostSelfTotal float64 = 0 //材料费
- var materialCostPartSelfTotal float64 = 0 //材料费
-
- var westernMedicineCostTotal float64 = 0 //西药费
- var westernMedicineCostSelfTotal float64 = 0 //西药费
- var westernMedicineCostPartSelfTotal float64 = 0 //西药费
-
- var chineseTraditionalMedicineCostTotal float64 = 0 //中成药
- var chineseTraditionalMedicineCostSelfTotal float64 = 0 //中成药
- var chineseTraditionalMedicineCostPartSelfTotal float64 = 0 //中成药
-
- var checkCostTotal float64 = 0 //检查费
- var checkCostSelfTotal float64 = 0 //检查费
- var checkCostPartSelfTotal float64 = 0 //检查费
-
- var laboratoryCostTotal float64 = 0 //化验费
- var laboratoryCostSelfTotal float64 = 0 //化验费
- var laboratoryCostPartSelfTotal float64 = 0 //化验费
-
- var treatCostTotal float64 = 0 //治疗费用
- var treatCostSelfTotal float64 = 0 //治疗费用
- var treatCostPartSelfTotal float64 = 0 //治疗费用
-
- decimal.DivisionPrecision = 2
-
- var bed_fulamt_ownpay_amt float64 = 0
-
- var examine_fulamt_ownpay_amt float64 = 0
-
- var nursing_fulamt_ownpay_amt float64 = 0
-
- var chinese_medicine_fulamt_ownpay_amt float64 = 0
-
- var commonly_treatment_fulamt_ownpay_amt float64 = 0
-
- var register_fulamt_ownpay_amt float64 = 0
-
- var operation_fulamt_ownpay_amt float64 = 0
- var other_fulamt_ownpay_amt float64 = 0
- var westernMedicine_fulamt_ownpay_amt float64 = 0
- var chineseTraditional_fulamt_ownpay_amt float64 = 0
- var check_fulamt_ownpay_amt float64 = 0
- var material_fulamt_ownpay_amt float64 = 0
- var laboratory_fulamt_ownpay_amt float64 = 0
- var treat_fulamt_ownpay_amt float64 = 0
-
- var bed_claa_sunmfee float64 = 0
- var bed_clab_amt float64 = 0
- var bed_other_amt float64 = 0
-
- var examine_claa_sunmfee float64 = 0
- var examine_clab_amt float64 = 0
- var examine_other_amt float64 = 0
-
- var nursing_claa_sunmfee float64 = 0
- var nursing_clab_amt float64 = 0
- var nursing_other_amt float64 = 0
-
- var chinese_medicine_claa_sunmfee float64 = 0
- var chinese_medicine_clab_amt float64 = 0
- var chinese_medicine_other_amt float64 = 0
-
- var commonly_treatment_claa_sunmfee float64 = 0
- var commonly_treatment_clab_amt float64 = 0
- var commonly_treatment_other_amt float64 = 0
-
- var operation_claa_sunmfee float64 = 0
- var operation_clab_amt float64 = 0
- var operation_other_amt float64 = 0
-
- var other_claa_sunmfee float64 = 0
- var other_clab_amt float64 = 0
- var other_other_amt float64 = 0
-
- var westernMedicine_claa_sunmfee float64 = 0
- var westernMedicine_clab_amt float64 = 0
- var westernMedicine_other_amt float64 = 0
-
- var chineseTraditional_claa_sunmfee float64 = 0
- var chineseTraditional_clab_amt float64 = 0
- var chineseTraditional_other_amt float64 = 0
-
- var check_claa_sunmfee float64 = 0
- var check_clab_amt float64 = 0
- var check_other_amt float64 = 0
-
- var material_claa_sunmfee float64 = 0
- var material_clab_amt float64 = 0
- var material_other_amt float64 = 0
-
- var laboratory_claa_sunmfee float64 = 0
- var laboratory_clab_amt float64 = 0
- var laboratory_other_amt float64 = 0
-
- var treat_claa_sunmfee float64 = 0
- var treat_clab_amt float64 = 0
- var treat_other_amt float64 = 0
-
- var register_claa_sunmfee float64 = 0
- var register_clab_amt float64 = 0
- var register_other_amt float64 = 0
-
- for _, item := range order.HisOrderInfo {
- if item.MedChrgitmType == "01" { //床位费
- bedCostTotal, _ = decimal.NewFromFloat(bedCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
- bedCostSelfTotal, _ = decimal.NewFromFloat(bedCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
- bedCostPartSelfTotal, _ = decimal.NewFromFloat(bedCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
- bed_fulamt_ownpay_amt, _ = decimal.NewFromFloat(bed_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
- if item.ChrgitmLv == "1" {
- bed_claa_sunmfee, _ = decimal.NewFromFloat(bed_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
- }
- if item.ChrgitmLv == "2" {
- bed_clab_amt, _ = decimal.NewFromFloat(bed_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
-
- }
- if item.ChrgitmLv == "3" {
- bed_other_amt, _ = decimal.NewFromFloat(bed_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
- }
-
- }
-
- if item.MedChrgitmType == "02" { //诊查
- examineCostTotal, _ = decimal.NewFromFloat(examineCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
- examineCostSelfTotal, _ = decimal.NewFromFloat(examineCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
- examineCostPartSelfTotal, _ = decimal.NewFromFloat(examineCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
- examine_fulamt_ownpay_amt, _ = decimal.NewFromFloat(examine_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
- if item.ChrgitmLv == "1" {
- examine_claa_sunmfee, _ = decimal.NewFromFloat(examine_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
- }
- if item.ChrgitmLv == "2" {
- examine_clab_amt, _ = decimal.NewFromFloat(examine_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
-
- }
- if item.ChrgitmLv == "3" {
- examine_other_amt, _ = decimal.NewFromFloat(examine_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
- }
-
- }
-
- if item.MedChrgitmType == "03" { //检查费
- checkCostTotal, _ = decimal.NewFromFloat(checkCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
- checkCostSelfTotal, _ = decimal.NewFromFloat(checkCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
- checkCostPartSelfTotal, _ = decimal.NewFromFloat(checkCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
- check_fulamt_ownpay_amt, _ = decimal.NewFromFloat(check_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
- if item.ChrgitmLv == "1" {
-
- check_claa_sunmfee, _ = decimal.NewFromFloat(check_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
-
- }
- if item.ChrgitmLv == "2" {
- check_clab_amt, _ = decimal.NewFromFloat(check_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
-
- }
- if item.ChrgitmLv == "3" {
- check_other_amt, _ = decimal.NewFromFloat(check_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
- }
- }
-
- if item.MedChrgitmType == "04" { //化验费
- laboratoryCostTotal, _ = decimal.NewFromFloat(laboratoryCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
- laboratoryCostSelfTotal, _ = decimal.NewFromFloat(laboratoryCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
- laboratoryCostPartSelfTotal, _ = decimal.NewFromFloat(laboratoryCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
- laboratory_fulamt_ownpay_amt, _ = decimal.NewFromFloat(laboratory_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
- if item.ChrgitmLv == "1" {
-
- laboratory_claa_sunmfee, _ = decimal.NewFromFloat(laboratory_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
-
- }
- if item.ChrgitmLv == "2" {
- laboratory_clab_amt, _ = decimal.NewFromFloat(laboratory_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
-
- }
- if item.ChrgitmLv == "3" {
- laboratory_other_amt, _ = decimal.NewFromFloat(laboratory_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
- }
- }
-
- if item.MedChrgitmType == "05" { //治疗费
- treatCostTotal, _ = decimal.NewFromFloat(treatCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
- treatCostSelfTotal, _ = decimal.NewFromFloat(treatCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
- treatCostPartSelfTotal, _ = decimal.NewFromFloat(treatCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
- treat_fulamt_ownpay_amt, _ = decimal.NewFromFloat(treat_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
- if item.ChrgitmLv == "1" {
-
- treat_claa_sunmfee, _ = decimal.NewFromFloat(treat_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
-
- }
- if item.ChrgitmLv == "2" {
- treat_clab_amt, _ = decimal.NewFromFloat(treat_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
-
- }
- if item.ChrgitmLv == "3" {
- treat_other_amt, _ = decimal.NewFromFloat(treat_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
- }
- }
-
- if item.MedChrgitmType == "06" { //手术费
- operationCostTotal, _ = decimal.NewFromFloat(operationCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
- operationCostSelfTotal, _ = decimal.NewFromFloat(operationCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
- operationCostPartSelfTotal, _ = decimal.NewFromFloat(operationCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
- operation_fulamt_ownpay_amt, _ = decimal.NewFromFloat(operation_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
-
- if item.ChrgitmLv == "1" {
-
- operation_claa_sunmfee, _ = decimal.NewFromFloat(operation_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
-
- }
- if item.ChrgitmLv == "2" {
- operation_clab_amt, _ = decimal.NewFromFloat(operation_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
-
- }
- if item.ChrgitmLv == "3" {
- operation_other_amt, _ = decimal.NewFromFloat(operation_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
- }
- }
-
- if item.MedChrgitmType == "07" { //手术费
- nursingCostTotal, _ = decimal.NewFromFloat(nursingCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
- nursingCostSelfTotal, _ = decimal.NewFromFloat(nursingCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
- nursingCostPartSelfTotal, _ = decimal.NewFromFloat(nursingCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
- nursing_fulamt_ownpay_amt, _ = decimal.NewFromFloat(nursing_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
-
- if item.ChrgitmLv == "1" {
-
- nursing_claa_sunmfee, _ = decimal.NewFromFloat(nursing_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
-
- }
- if item.ChrgitmLv == "2" {
- nursing_clab_amt, _ = decimal.NewFromFloat(nursing_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
-
- }
- if item.ChrgitmLv == "3" {
- nursing_other_amt, _ = decimal.NewFromFloat(nursing_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
- }
- }
-
- if item.MedChrgitmType == "08" { //材料费
- materialCostTotal, _ = decimal.NewFromFloat(materialCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
- materialCostSelfTotal, _ = decimal.NewFromFloat(materialCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
- materialCostPartSelfTotal, _ = decimal.NewFromFloat(materialCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
- material_fulamt_ownpay_amt, _ = decimal.NewFromFloat(material_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
- if item.ChrgitmLv == "1" {
-
- material_claa_sunmfee, _ = decimal.NewFromFloat(material_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
-
- }
- if item.ChrgitmLv == "2" {
- material_clab_amt, _ = decimal.NewFromFloat(material_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
-
- }
- if item.ChrgitmLv == "3" {
- material_other_amt, _ = decimal.NewFromFloat(material_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
- }
- }
- if item.MedChrgitmType == "09" { //西药费
- westernMedicineCostTotal, _ = decimal.NewFromFloat(westernMedicineCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
- westernMedicineCostSelfTotal, _ = decimal.NewFromFloat(westernMedicineCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
- westernMedicineCostPartSelfTotal, _ = decimal.NewFromFloat(westernMedicineCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
- westernMedicine_fulamt_ownpay_amt, _ = decimal.NewFromFloat(westernMedicine_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
- if item.ChrgitmLv == "1" {
- westernMedicine_claa_sunmfee, _ = decimal.NewFromFloat(westernMedicine_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
- }
- if item.ChrgitmLv == "2" {
- westernMedicine_clab_amt, _ = decimal.NewFromFloat(westernMedicine_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
- }
- if item.ChrgitmLv == "3" {
- westernMedicine_other_amt, _ = decimal.NewFromFloat(westernMedicine_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
- }
- }
- if item.MedChrgitmType == "10" { //中药饮片
- chineseMedicineCostTotal, _ = decimal.NewFromFloat(chineseMedicineCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
- chineseMedicineCostSelfTotal, _ = decimal.NewFromFloat(chineseMedicineCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
- chineseMedicineCostPartSelfTotal, _ = decimal.NewFromFloat(chineseMedicineCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
- chinese_medicine_fulamt_ownpay_amt, _ = decimal.NewFromFloat(chinese_medicine_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
- if item.ChrgitmLv == "1" {
- chinese_medicine_claa_sunmfee, _ = decimal.NewFromFloat(chinese_medicine_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
- }
- if item.ChrgitmLv == "2" {
- chinese_medicine_clab_amt, _ = decimal.NewFromFloat(chinese_medicine_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
- }
- if item.ChrgitmLv == "3" {
- chinese_medicine_other_amt, _ = decimal.NewFromFloat(chinese_medicine_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
- }
- }
-
- if item.MedChrgitmType == "11" { //中成费
- chineseTraditionalMedicineCostTotal, _ = decimal.NewFromFloat(chineseTraditionalMedicineCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
- chineseTraditionalMedicineCostSelfTotal, _ = decimal.NewFromFloat(chineseTraditionalMedicineCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
- chineseTraditionalMedicineCostPartSelfTotal, _ = decimal.NewFromFloat(chineseTraditionalMedicineCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
- chineseTraditional_fulamt_ownpay_amt, _ = decimal.NewFromFloat(chineseTraditional_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
- if item.ChrgitmLv == "1" {
-
- chineseTraditional_claa_sunmfee, _ = decimal.NewFromFloat(chineseTraditional_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
-
- }
- if item.ChrgitmLv == "2" {
- chineseTraditional_clab_amt, _ = decimal.NewFromFloat(chineseTraditional_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
-
- }
- if item.ChrgitmLv == "3" {
- chineseTraditional_other_amt, _ = decimal.NewFromFloat(chineseTraditional_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
- }
- }
-
- if item.MedChrgitmType == "12" { //中成费
- commonlyTreatmentCostTotal, _ = decimal.NewFromFloat(commonlyTreatmentCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
- commonlyTreatmentCostSelfTotal, _ = decimal.NewFromFloat(commonlyTreatmentCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
- commonlyTreatmentCostPartSelfTotal, _ = decimal.NewFromFloat(commonlyTreatmentCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
- commonly_treatment_fulamt_ownpay_amt, _ = decimal.NewFromFloat(commonly_treatment_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
- if item.ChrgitmLv == "1" {
-
- commonly_treatment_claa_sunmfee, _ = decimal.NewFromFloat(commonly_treatment_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
-
- }
- if item.ChrgitmLv == "2" {
- commonly_treatment_clab_amt, _ = decimal.NewFromFloat(commonly_treatment_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
-
- }
- if item.ChrgitmLv == "3" {
- commonly_treatment_other_amt, _ = decimal.NewFromFloat(commonly_treatment_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
- }
- }
-
- if item.MedChrgitmType == "13" { //中成费
- registerCostTotal, _ = decimal.NewFromFloat(registerCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
- registerCostSelfTotal, _ = decimal.NewFromFloat(registerCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
- registerPartSelfTotal, _ = decimal.NewFromFloat(registerPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
- register_fulamt_ownpay_amt, _ = decimal.NewFromFloat(register_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
- if item.ChrgitmLv == "1" {
-
- register_claa_sunmfee, _ = decimal.NewFromFloat(register_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
-
- }
- if item.ChrgitmLv == "2" {
- register_clab_amt, _ = decimal.NewFromFloat(register_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
-
- }
- if item.ChrgitmLv == "3" {
- register_other_amt, _ = decimal.NewFromFloat(register_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
- }
- }
-
- if item.MedChrgitmType == "14" { //其他费
- otherCostTotal, _ = decimal.NewFromFloat(otherCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
- otherCostSelfTotal, _ = decimal.NewFromFloat(otherCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
- otherCostPartSelfTotal, _ = decimal.NewFromFloat(otherCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
- other_fulamt_ownpay_amt, _ = decimal.NewFromFloat(other_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
- if item.ChrgitmLv == "1" {
- other_claa_sunmfee, _ = decimal.NewFromFloat(other_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
-
- }
- if item.ChrgitmLv == "2" {
- other_clab_amt, _ = decimal.NewFromFloat(other_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
-
- }
- if item.ChrgitmLv == "3" {
- other_other_amt, _ = decimal.NewFromFloat(other_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
- }
- }
-
- }
-
- var iteminfoStructs []service.IteminfoStruct
-
- if bedCostTotal != 0 {
- iteminfo.MedChrgitm = "01"
- iteminfo.FulamtOwnpayAmt = bed_fulamt_ownpay_amt
- iteminfo.Amt = bedCostTotal
- iteminfo.ClaaSumfee = bed_claa_sunmfee
- iteminfo.ClabAmt = bed_clab_amt
- iteminfo.OthAmt = bed_other_amt
- iteminfoStructs = append(iteminfoStructs, iteminfo)
- }
-
- if examineCostTotal != 0 {
- iteminfo.MedChrgitm = "02"
- iteminfo.FulamtOwnpayAmt = examine_fulamt_ownpay_amt
- iteminfo.Amt = examineCostTotal
- iteminfo.ClaaSumfee = examine_claa_sunmfee
- iteminfo.ClabAmt = examine_clab_amt
- iteminfo.OthAmt = examine_other_amt
- //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
- iteminfoStructs = append(iteminfoStructs, iteminfo)
- }
-
- if checkCostTotal != 0 {
- iteminfo.MedChrgitm = "03"
- iteminfo.FulamtOwnpayAmt = check_fulamt_ownpay_amt
- iteminfo.Amt = checkCostTotal
- iteminfo.ClaaSumfee = check_claa_sunmfee
- iteminfo.ClabAmt = check_clab_amt
- iteminfo.OthAmt = check_other_amt
- iteminfoStructs = append(iteminfoStructs, iteminfo)
-
- }
-
- if laboratoryCostTotal != 0 {
- iteminfo.MedChrgitm = "04"
- iteminfo.FulamtOwnpayAmt = laboratory_fulamt_ownpay_amt
- iteminfo.Amt = laboratoryCostTotal
- iteminfo.ClaaSumfee = laboratory_claa_sunmfee
- iteminfo.ClabAmt = laboratory_clab_amt
- iteminfo.OthAmt = laboratory_other_amt
- iteminfoStructs = append(iteminfoStructs, iteminfo)
-
- //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
-
- }
-
- if treatCostTotal != 0 {
- iteminfo.MedChrgitm = "05"
- iteminfo.FulamtOwnpayAmt = treat_fulamt_ownpay_amt
- iteminfo.Amt = treatCostTotal
- iteminfo.ClaaSumfee = treat_claa_sunmfee
- iteminfo.ClabAmt = treat_clab_amt
- iteminfo.OthAmt = treat_other_amt
- iteminfoStructs = append(iteminfoStructs, iteminfo)
- //(struct4101.IteminfoStruct, iteminfo)
- //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
- }
-
- if operationCostTotal != 0 {
- iteminfo.MedChrgitm = "06"
- iteminfo.FulamtOwnpayAmt = bed_fulamt_ownpay_amt
- iteminfo.Amt = operationCostTotal
- iteminfo.ClaaSumfee = operation_claa_sunmfee
- iteminfo.ClabAmt = operation_clab_amt
- iteminfo.OthAmt = operation_other_amt
- //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
- iteminfoStructs = append(iteminfoStructs, iteminfo)
- }
-
- if nursingCostTotal != 0 {
- iteminfo.MedChrgitm = "07"
- iteminfo.FulamtOwnpayAmt = nursing_fulamt_ownpay_amt
- iteminfo.Amt = nursingCostTotal
- iteminfo.ClaaSumfee = nursing_claa_sunmfee
- iteminfo.ClabAmt = nursing_clab_amt
- iteminfo.OthAmt = nursing_other_amt
- iteminfoStructs = append(iteminfoStructs, iteminfo)
- }
-
- if materialCostTotal != 0 {
- iteminfo.MedChrgitm = "08"
- iteminfo.FulamtOwnpayAmt = material_fulamt_ownpay_amt
- iteminfo.Amt = materialCostTotal
- iteminfo.ClaaSumfee = material_claa_sunmfee
- iteminfo.ClabAmt = material_clab_amt
- iteminfo.OthAmt = material_other_amt
- //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
- iteminfoStructs = append(iteminfoStructs, iteminfo)
- }
-
- if westernMedicineCostTotal != 0 {
- iteminfo.MedChrgitm = "09"
- iteminfo.FulamtOwnpayAmt = westernMedicine_fulamt_ownpay_amt
- iteminfo.Amt = westernMedicineCostTotal
- iteminfo.ClaaSumfee = westernMedicine_claa_sunmfee
- iteminfo.ClabAmt = westernMedicine_clab_amt
- iteminfo.OthAmt = westernMedicine_other_amt
- //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
- iteminfoStructs = append(iteminfoStructs, iteminfo)
-
- }
-
- if chineseMedicineCostTotal != 0 {
- iteminfo.MedChrgitm = "10"
- iteminfo.FulamtOwnpayAmt = chinese_medicine_fulamt_ownpay_amt
- iteminfo.Amt = chineseMedicineCostTotal
- iteminfo.ClaaSumfee = chinese_medicine_claa_sunmfee
- iteminfo.ClabAmt = chinese_medicine_clab_amt
- iteminfo.OthAmt = chinese_medicine_other_amt
- //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
- iteminfoStructs = append(iteminfoStructs, iteminfo)
-
- }
-
- if chineseTraditionalMedicineCostTotal != 0 {
- iteminfo.MedChrgitm = "11"
- iteminfo.FulamtOwnpayAmt = westernMedicine_fulamt_ownpay_amt
- iteminfo.Amt = westernMedicineCostTotal
- iteminfo.ClaaSumfee = westernMedicine_claa_sunmfee
- iteminfo.ClabAmt = westernMedicine_clab_amt
- iteminfo.OthAmt = westernMedicine_other_amt
- //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
- iteminfoStructs = append(iteminfoStructs, iteminfo)
-
- }
-
- if commonlyTreatmentCostTotal != 0 {
- iteminfo.MedChrgitm = "12"
- iteminfo.FulamtOwnpayAmt = commonly_treatment_fulamt_ownpay_amt
- iteminfo.Amt = commonlyTreatmentCostTotal
- iteminfo.ClaaSumfee = commonly_treatment_claa_sunmfee
- iteminfo.ClabAmt = commonly_treatment_clab_amt
- iteminfo.OthAmt = commonly_treatment_other_amt
- //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
- iteminfoStructs = append(iteminfoStructs, iteminfo)
-
- }
-
- if registerCostTotal != 0 {
- iteminfo.MedChrgitm = "13"
- iteminfo.FulamtOwnpayAmt = register_fulamt_ownpay_amt
- iteminfo.Amt = registerCostTotal
- iteminfo.ClaaSumfee = register_claa_sunmfee
- iteminfo.ClabAmt = register_clab_amt
- iteminfo.OthAmt = register_other_amt
- //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
- iteminfoStructs = append(iteminfoStructs, iteminfo)
-
- }
-
- if otherCostTotal != 0 {
- iteminfo.MedChrgitm = "14"
- iteminfo.FulamtOwnpayAmt = other_fulamt_ownpay_amt
- iteminfo.Amt = otherCostTotal
- iteminfo.ClaaSumfee = other_claa_sunmfee
- iteminfo.ClabAmt = other_clab_amt
- iteminfo.OthAmt = other_other_amt
- //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
- iteminfoStructs = append(iteminfoStructs, iteminfo)
-
- }
- struct4101.IteminfoStruct = iteminfoStructs
-
- struct4101.Ntly = "中国"
- struct4101.AdmCaty = "A03.06"
- result := service.Gdyb4101ForGZ(struct4101, miConfig.SecretKey, miConfig.OrgName, curRoles.UserName, miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, c.GetAdminUserInfo().CurrentOrgId)
- fmt.Println(result)
-
- var dat map[string]interface{}
- if err := json.Unmarshal([]byte(result), &dat); err == nil {
- fmt.Println(dat)
- } else {
- fmt.Println(err)
- }
- userJSONBytes, _ := json.Marshal(dat)
- var res ResultSeventeen
- if err := json.Unmarshal(userJSONBytes, &res); err != nil {
- utils.ErrorLog("解析失败:%v", err)
- //c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- adminUser := c.GetAdminUserInfo()
- errlog := &models.HisOrderError{
- UserOrgId: adminUser.CurrentOrgId,
- Ctime: time.Now().Unix(),
- Mtime: time.Now().Unix(),
- ErrMsg: res.ErrMsg + "解析失败",
- Status: 1,
- PatientId: order_id,
- Stage: 10106,
- }
- service.CreateErrMsgLog(errlog)
- continue
- }
-
- if res.Infcode != 0 {
- adminUser := c.GetAdminUserInfo()
- errlog := &models.HisOrderError{
- UserOrgId: adminUser.CurrentOrgId,
- Ctime: time.Now().Unix(),
- Mtime: time.Now().Unix(),
- ErrMsg: res.ErrMsg,
- Status: 1,
- PatientId: order_id,
- Stage: 10106,
- }
- service.CreateErrMsgLog(errlog)
- continue
- } else {
- hisFundSettleListResult := &models.HisFundSettleListResult{
- Number: res.Output.SetlListId,
- Status: 1,
- Ctime: time.Now().Unix(),
- Mtime: time.Now().Unix(),
- UserOrgId: c.GetAdminUserInfo().CurrentOrgId,
- IsUpload: 1,
- OrderId: order_id,
- }
- service.CreateUploadRecord(hisFundSettleListResult)
- continue
- }
- }
- }
-
- func (c *HisApiController) GetOrgInfo() {
- miConfig, _ := service.FindMedicalInsuranceInfo(4)
- service.Gdyb1201("", miConfig.OrgName, "1122", miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, 1, "")
-
- }
-
- func (c *HisApiController) GetHisPatientInfo() {
-
- medical_insurance_card := c.GetString("medical_insurance_card")
- id_card_type, _ := c.GetInt64("id_card_type")
- id_card := c.GetString("id_card")
-
- adminInfo := c.GetAdminUserInfo()
- config, _ := service.GetMedicalInsuranceConfig(adminInfo.CurrentOrgId)
- miConfig, _ := service.FindMedicalInsuranceInfo(adminInfo.CurrentOrgId)
-
- appRole, _ := service.GetAppRole(adminInfo.CurrentOrgId)
-
- IdCardNo := ""
-
- if id_card_type == 1 {
- IdCardNo = medical_insurance_card
- } else if id_card_type == 2 {
- IdCardNo = id_card
- }
-
- if config.IsOpen == 1 {
- api := "http://127.0.0.1:9532/" + "gdyb/one?cert_no=" + IdCardNo + "&org_name=" + miConfig.OrgName + "&doctor=" + appRole.UserName + "&fixmedins_code=" + miConfig.Code + "&insuplc_admdvs=" + miConfig.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey
- resp, requestErr := http.Get(api)
- if requestErr != nil {
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
-
- defer resp.Body.Close()
- body, ioErr := ioutil.ReadAll(resp.Body)
- if ioErr != nil {
- utils.ErrorLog("接口返回数据读取失败: %v", ioErr)
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
- var respJSON map[string]interface{}
-
- if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
- utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
-
- userJSON := respJSON["data"].(map[string]interface{})["pre"].(map[string]interface{})
- userJSONBytes, _ := json.Marshal(userJSON)
- var res ResultTwo
- if err := json.Unmarshal(userJSONBytes, &res); err != nil {
- utils.ErrorLog("解析失败:%v", err)
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
- Iinfos, _ := json.Marshal(res.Output[0].Iinfo)
- Idetinfos, _ := json.Marshal(res.Output[0].Idetinfo)
- infoStr := string(Iinfos)
- idetinfoStr := string(Idetinfos)
- if res.Infcode == 0 {
- his := models.VMHisPatient{
- Status: 1,
- Ctime: time.Now().Unix(),
- Mtime: time.Now().Unix(),
- PsnNo: res.Output[0].Baseinfo.PsnNo,
- PsnCertType: res.Output[0].Baseinfo.PsnCertType,
- Certno: res.Output[0].Baseinfo.Certno,
- PsnName: res.Output[0].Baseinfo.PsnName,
- Gend: res.Output[0].Baseinfo.Gend,
- Naty: res.Output[0].Baseinfo.Naty,
- Brdy: res.Output[0].Baseinfo.Brdy,
- Age: res.Output[0].Baseinfo.Age,
- Iinfo: infoStr,
- Idetinfo: idetinfoStr,
- UserOrgId: adminInfo.CurrentOrgId,
- IsReturn: 1,
- IdCardType: id_card_type,
- }
- c.ServeSuccessJSON(map[string]interface{}{
- "info": his,
- })
- } else {
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeHisFailedException)
- return
- }
- }
- }
-
- //func GetBasBaseInfo() (jsonStr string, err error) {
- //
- // handle := syscall.NewLazyDLL("SSCard.dll")
- // add := handle.NewProc("ReadCardBas")
- // str := make([]byte, 1024)
- // str1 := make([]byte, 1024)
- // ret, _, _ := add.Call((uintptr)(unsafe.Pointer(&str[0])), IntPtr(1024), (uintptr)(unsafe.Pointer(&str1[0])), IntPtr(1024))
- // fmt.Println(ConvertToString(string(str), "gbk", "utf-8"))
- //
- // fmt.Println(ConvertToString(string(str1), "gbk", "utf-8"))
- //
- // fmt.Println("> Add(4,5)的结果为:", ret)
- // handle.Release()
- //
- // return "", nil
- //
- //}
-
- //func GetQRBaseInfo() (jsonStr string, err error) {
- // handle := syscall.LoadDLL("SSCard.dll")
- // ReadCardBas := handle.FindProc("GetQRBase")
- //
- // str := make([]byte, 256)
- // str1 := make([]byte, 256)
- // r, _, _ := ReadCardBas.Call((uintptr)(unsafe.Pointer(&str[0])), IntPtr(1024), (uintptr)(unsafe.Pointer(&str1[0])), IntPtr(1024))
- //
- // fmt.Println(string(str))
- // fmt.Println(r)
- // return string(str), nil
- //}
-
- //func CardInit() int {
- // DllTestDef := syscall.MustLoadDLL("SSCard.dll")
- // add := DllTestDef.MustFindProc("Init")
- // ret, _, err := add.Call(StrPtr("http://igb.hsa.gdgov.cn/gdyb_inf/poc/api/card/initDll"), StrPtr("440200"))
- // if err != nil {
- // fmt.Println("SSCard的运算结果为:", ret)
- // }
- // result := int(ret)
- // return result
- //}
-
- //func CardInit() int {
- // ret, _, err := add.Call(StrPtr("http://igb.hsa.gdgov.cn/gdyb_inf/poc/api/card/initDll"), StrPtr("440200"))
- // if err != nil {
- // fmt.Println("SSCard的运算结果为:", ret)
- // }
- // fmt.Println(err)
- // result := int(ret)
- // return result
- //}
-
- func IntPtr(n int) uintptr {
- return uintptr(n)
- }
-
- func StrPtr(s string) uintptr {
- return uintptr(unsafe.Pointer(syscall.StringBytePtr(s)))
- }
-
- type Result2001 struct {
- Cainfo interface{} `json:"cainfo"`
- ErrMsg string `json:"err_msg"`
- InfRefmsgid string `json:"inf_refmsgid"`
- Infcode int64 `json:"infcode"`
- Output struct {
- Trtinfo struct {
- PsnNo string `json:"psn_no"`
- TrtChkType string `json:"trt_chk_type"`
- FundPayType string `json:"fund_pay_type"`
- TrtEnjymntFlag string `json:"trt_enjymnt_flag"`
- Begndate string `json:"begndate"`
- Enddate string `json:"enddate"`
- TrtChkRslt string `json:"trt_chk_rslt"`
- } `json:"trtinfo"`
- } `json:"output"`
- RefmsgTime string `json:"refmsg_time"`
- RespondTime string `json:"respond_time"`
- Signtype interface{} `json:"signtype"`
- WarnMsg interface{} `json:"warn_msg"`
- }
- type Result2001Org10265 struct {
- Cainfo interface{} `json:"cainfo"`
- ErrMsg string `json:"err_msg"`
- InfRefmsgid string `json:"inf_refmsgid"`
- Infcode string `json:"infcode"`
- Output struct {
- Trtinfo struct {
- PsnNo string `json:"psn_no"`
- TrtChkType string `json:"trt_chk_type"`
- FundPayType string `json:"fund_pay_type"`
- TrtEnjymntFlag string `json:"trt_enjymnt_flag"`
- Begndate string `json:"begndate"`
- Enddate string `json:"enddate"`
- TrtChkRslt string `json:"trt_chk_rslt"`
- } `json:"trtinfo"`
- } `json:"output"`
- RefmsgTime string `json:"refmsg_time"`
- RespondTime string `json:"respond_time"`
- Signtype interface{} `json:"signtype"`
- WarnMsg interface{} `json:"warn_msg"`
- }
-
- type ResultTwo struct {
- ErrMsg string `json:"err_msg"`
- InfRefmsgid string `json:"inf_refmsgid"`
- Infcode int64 `json:"infcode"`
- Output []struct {
- Baseinfo struct {
- Age float64 `json:"age"`
- Brdy string `json:"brdy"`
- Certno string `json:"certno"`
- Gend string `json:"gend"`
- Naty string `json:"naty"`
- PsnCertType string `json:"psn_cert_type"`
- PsnName string `json:"psn_name"`
- PsnNo string `json:"psn_no"`
- } `json:"baseinfo"`
- Idetinfo []interface{} `json:"idetinfo"`
- Iinfo []struct {
- Balc float64 `json:"balc"`
- CvlservFlag string `json:"cvlserv_flag"`
- EmpName string `json:"emp_name"`
- InsuplcAdmdvs string `json:"insuplc_admdvs"`
- Insutype string `json:"insutype"`
- PausInsuDansuplcAdmdvs string `json:"paus_insu_dansuplc_admdvs"`
- PausInsuDate string `json:"paus_insu_date"`
- PsnInsuDate string `json:"psn_insu_date"`
- PsnInsuStas string `json:"psn_insu_stas"`
- PsnType string `json:"psn_type"`
- } `json:"insuinfo"`
- } `json:"output"`
- RefmsgTime string `json:"refmsg_time"`
- RespondTime string `json:"respond_time"`
- Signtype interface{} `json:"signtype"`
- WarnInfo interface{} `json:"warn_info"`
- }
-
- type ResultTwo10265 struct {
- ErrMsg string `json:"err_msg"`
- InfRefmsgid string `json:"inf_refmsgid"`
- Infcode string `json:"infcode"`
- Output struct {
- Baseinfo struct {
- Age float64 `json:"age"`
- Brdy string `json:"brdy"`
- Certno string `json:"certno"`
- Gend string `json:"gend"`
- Naty string `json:"naty"`
- PsnCertType string `json:"psn_cert_type"`
- PsnName string `json:"psn_name"`
- PsnNo string `json:"psn_no"`
- } `json:"baseinfo"`
- Idetinfo []interface{} `json:"idetinfo"`
- Iinfo []struct {
- Balc float64 `json:"balc"`
- CvlservFlag string `json:"cvlserv_flag"`
- EmpName string `json:"emp_name"`
- InsuplcAdmdvs string `json:"insuplc_admdvs"`
- Insutype string `json:"insutype"`
- PausInsuDansuplcAdmdvs string `json:"paus_insu_dansuplc_admdvs"`
- PausInsuDate string `json:"paus_insu_date"`
- PsnInsuDate string `json:"psn_insu_date"`
- PsnInsuStas string `json:"psn_insu_stas"`
- PsnType string `json:"psn_type"`
- } `json:"insuinfo"`
- } `json:"output"`
- RefmsgTime string `json:"refmsg_time"`
- RespondTime string `json:"respond_time"`
- Signtype interface{} `json:"signtype"`
- WarnInfo interface{} `json:"warn_info"`
- }
-
- type ResultThree struct {
- Cainfo interface{} `json:"cainfo"`
- ErrMsg string `json:"err_msg"`
- InfRefmsgid string `json:"inf_refmsgid"`
- Infcode int64 `json:"infcode"`
- Output struct {
- Data struct {
- IptOtpNo string `json:"ipt_otp_no"`
- MdtrtID string `json:"mdtrt_id"`
- PsnNo string `json:"psn_no"`
- } `json:"data"`
- } `json:"output"`
- RefmsgTime string `json:"refmsg_time"`
- RespondTime string `json:"respond_time"`
- Signtype interface{} `json:"signtype"`
- WarnMsg interface{} `json:"warn_msg"`
- }
-
- type ResultThree10265 struct {
- Cainfo interface{} `json:"cainfo"`
- ErrMsg string `json:"err_msg"`
- InfRefmsgid string `json:"inf_refmsgid"`
- Infcode string `json:"infcode"`
- Output struct {
- Data struct {
- IptOtpNo string `json:"ipt_otp_no"`
- MdtrtID string `json:"mdtrt_id"`
- PsnNo string `json:"psn_no"`
- } `json:"data"`
- } `json:"output"`
- RefmsgTime string `json:"refmsg_time"`
- RespondTime string `json:"respond_time"`
- Signtype interface{} `json:"signtype"`
- WarnMsg interface{} `json:"warn_msg"`
- }
-
- type ResultFour struct {
- Cainfo string `json:"cainfo"`
- ErrMsg string `json:"err_msg"`
- InfRefmsgid string `json:"inf_refmsgid"`
- Infcode int64 `json:"infcode"`
- Output struct {
- Result []struct {
- BasMednFlag string `json:"bas_medn_flag"`
- ChldMedcFlag string `json:"chld_medc_flag"`
- ChrgitmLv string `json:"chrgitm_lv"`
- Cnt float64 `json:"cnt"`
- DetItemFeeSumamt float64 `json:"det_item_fee_sumamt"`
- DrtReimFlag string `json:"drt_reim_flag"`
- FeedetlSn string `json:"feedetl_sn"`
- FulamtOwnpayAmt float64 `json:"fulamt_ownpay_amt"`
- HiNegoDrugFlag string `json:"hi_nego_drug_flag"`
- InscpScpAmt float64 `json:"inscp_scp_amt"`
- ListSpItemFlag string `json:"list_sp_item_flag"`
- LmtUsedFlag string `json:"lmt_used_flag"`
- MedChrgitmType string `json:"med_chrgitm_type"`
- Memo string `json:"memo"`
- OverlmtAmt float64 `json:"overlmt_amt"`
- PreselfpayAmt float64 `json:"preselfpay_amt"`
- Pric float64 `json:"pric"`
- PricUplmtAmt float64 `json:"pric_uplmt_amt"`
- SelfpayProp float64 `json:"selfpay_prop"`
- } `json:"result"`
- } `json:"output"`
- RefmsgTime string `json:"refmsg_time"`
- RespondTime string `json:"respond_time"`
- Signtype string `json:"signtype"`
- WarnMsg string `json:"warn_msg"`
- }
- type ResultFour10265 struct {
- Cainfo string `json:"cainfo"`
- ErrMsg string `json:"err_msg"`
- InfRefmsgid string `json:"inf_refmsgid"`
- Infcode string `json:"infcode"`
- Output struct {
- Result []struct {
- BasMednFlag string `json:"bas_medn_flag"`
- ChldMedcFlag string `json:"chld_medc_flag"`
- ChrgitmLv string `json:"chrgitm_lv"`
- Cnt float64 `json:"cnt"`
- DetItemFeeSumamt float64 `json:"det_item_fee_sumamt"`
- DrtReimFlag string `json:"drt_reim_flag"`
- FeedetlSn string `json:"feedetl_sn"`
- FulamtOwnpayAmt float64 `json:"fulamt_ownpay_amt"`
- HiNegoDrugFlag string `json:"hi_nego_drug_flag"`
- InscpScpAmt float64 `json:"inscp_scp_amt"`
- ListSpItemFlag string `json:"list_sp_item_flag"`
- LmtUsedFlag string `json:"lmt_used_flag"`
- MedChrgitmType string `json:"med_chrgitm_type"`
- Memo string `json:"memo"`
- OverlmtAmt float64 `json:"overlmt_amt"`
- PreselfpayAmt float64 `json:"preselfpay_amt"`
- Pric float64 `json:"pric"`
- PricUplmtAmt float64 `json:"pric_uplmt_amt"`
- SelfpayProp float64 `json:"selfpay_prop"`
- } `json:"result"`
- } `json:"output"`
- RefmsgTime string `json:"refmsg_time"`
- RespondTime string `json:"respond_time"`
- Signtype string `json:"signtype"`
- WarnMsg string `json:"warn_msg"`
- }
-
- type ResultFive struct {
- Balc float64 `json:"balc"`
- CvlservFlag string `json:"cvlserv_flag"`
- EmpName string `json:"emp_name"`
- InsuplcAdmdvs string `json:"insuplc_admdvs"`
- Insutype string `json:"insutype"`
- PausInsuDansuplcAdmdvs string `json:"paus_insu_dansuplc_admdvs"`
- PausInsuDate string `json:"paus_insu_date"`
- PsnInsuDate string `json:"psn_insu_date"`
- PsnInsuStas string `json:"psn_insu_stas"`
- PsnType string `json:"psn_type"`
- }
- type ResultSix struct {
- Cainfo interface{} `json:"cainfo"`
- ErrMsg string `json:"err_msg"`
- InfRefmsgid string `json:"inf_refmsgid"`
- Infcode int64 `json:"infcode"`
- RefmsgTime string `json:"refmsg_time"`
- RespondTime string `json:"respond_time"`
- Signtype interface{} `json:"signtype"`
- WarnMsg interface{} `json:"warn_msg"`
- }
-
- type ResultSix10265 struct {
- Cainfo interface{} `json:"cainfo"`
- ErrMsg string `json:"err_msg"`
- InfRefmsgid string `json:"inf_refmsgid"`
- Infcode string `json:"infcode"`
- Output struct {
- } `json:"output"`
- RefmsgTime string `json:"refmsg_time"`
- RespondTime string `json:"respond_time"`
- Signtype interface{} `json:"signtype"`
- WarnMsg interface{} `json:"warn_msg"`
- }
-
- type ResultSeven struct {
- Cainfo string `json:"cainfo"`
- ErrMsg string `json:"err_msg"`
- InfRefmsgid string `json:"inf_refmsgid"`
- Infcode int64 `json:"infcode"`
- Output struct {
- Setldetail []interface{} `json:"setldetail"`
- Setlinfo struct {
- AcctMulaidPay float64 `json:"acct_mulaid_pay"`
- AcctPay float64 `json:"acct_pay"`
- ActPayDedc float64 `json:"act_pay_dedc"`
- Age float64 `json:"age"`
- Balc float64 `json:"balc"`
- Brdy string `json:"brdy"`
- Certno string `json:"certno"`
- ClrOptins string `json:"clr_optins"`
- ClrType string `json:"clr_type"`
- ClrWay string `json:"clr_way"`
- CvlservFlag string `json:"cvlserv_flag"`
- CvlservPay float64 `json:"cvlserv_pay"`
- FulamtOwnpayAmt float64 `json:"fulamt_ownpay_amt"`
- FundPaySumamt float64 `json:"fund_pay_sumamt"`
- Gend string `json:"gend"`
- HifesPay float64 `json:"hifes_pay"`
- HifmiPay float64 `json:"hifmi_pay"`
- HifpPay float64 `json:"hifp_pay"`
- HospPartAmt float64 `json:"hosp_part_amt"`
- InscpScpAmt float64 `json:"inscp_scp_amt"`
- Insutype string `json:"insutype"`
- MafPay float64 `json:"maf_pay"`
- MdtrtCertType string `json:"mdtrt_cert_type"`
- HifobPay float64 `json:"hifob_pay"`
-
- MdtrtID string `json:"mdtrt_id"`
- MedType string `json:"med_type"`
- MedfeeSumamt float64 `json:"medfee_sumamt"`
- MedinsSetlID string `json:"medins_setl_id"`
- Naty string `json:"naty"`
- OthPay float64 `json:"oth_pay"`
- OverlmtSelfpay float64 `json:"overlmt_selfpay"`
- PreselfpayAmt float64 `json:"preselfpay_amt"`
- PsnCashPay float64 `json:"psn_cash_pay"`
- PsnCertType string `json:"psn_cert_type"`
- PsnName string `json:"psn_name"`
- PsnNo string `json:"psn_no"`
- PsnPartAmt float64 `json:"psn_part_amt"`
- PsnType string `json:"psn_type"`
- SetlID string `json:"setl_id"`
- SetlTime string `json:"setl_time"`
- } `json:"setlinfo"`
- } `json:"output"`
- RefmsgTime string `json:"refmsg_time"`
- RespondTime string `json:"respond_time"`
- Signtype interface{} `json:"signtype"`
- WarnMsg interface{} `json:"warn_msg"`
- }
- type ResultSeven10265 struct {
- Cainfo string `json:"cainfo"`
- ErrMsg string `json:"err_msg"`
- InfRefmsgid string `json:"inf_refmsgid"`
- Infcode string `json:"infcode"`
- Output struct {
- Setldetail []interface{} `json:"setldetail"`
- Setlinfo struct {
- AcctMulaidPay float64 `json:"acct_mulaid_pay"`
- AcctPay float64 `json:"acct_pay"`
- ActPayDedc float64 `json:"act_pay_dedc"`
- Age float64 `json:"age"`
- Balc float64 `json:"balc"`
- Brdy string `json:"brdy"`
- Certno string `json:"certno"`
- ClrOptins string `json:"clr_optins"`
- ClrType string `json:"clr_type"`
- ClrWay string `json:"clr_way"`
- CvlservFlag string `json:"cvlserv_flag"`
- CvlservPay float64 `json:"cvlserv_pay"`
- FulamtOwnpayAmt float64 `json:"fulamt_ownpay_amt"`
- FundPaySumamt float64 `json:"fund_pay_sumamt"`
- Gend string `json:"gend"`
- HifesPay float64 `json:"hifes_pay"`
- HifmiPay float64 `json:"hifmi_pay"`
- HifpPay float64 `json:"hifp_pay"`
- HospPartAmt float64 `json:"hosp_part_amt"`
- InscpScpAmt float64 `json:"inscp_scp_amt"`
- Insutype string `json:"insutype"`
- MafPay float64 `json:"maf_pay"`
- MdtrtCertType string `json:"mdtrt_cert_type"`
- HifobPay float64 `json:"hifob_pay"`
-
- MdtrtID string `json:"mdtrt_id"`
- MedType string `json:"med_type"`
- MedfeeSumamt float64 `json:"medfee_sumamt"`
- MedinsSetlID string `json:"medins_setl_id"`
- Naty string `json:"naty"`
- OthPay float64 `json:"oth_pay"`
- OverlmtSelfpay float64 `json:"overlmt_selfpay"`
- PreselfpayAmt float64 `json:"preselfpay_amt"`
- PsnCashPay float64 `json:"psn_cash_pay"`
- PsnCertType string `json:"psn_cert_type"`
- PsnName string `json:"psn_name"`
- PsnNo string `json:"psn_no"`
- PsnPartAmt float64 `json:"psn_part_amt"`
- PsnType string `json:"psn_type"`
- SetlID string `json:"setl_id"`
- SetlTime string `json:"setl_time"`
- } `json:"setlinfo"`
- } `json:"output"`
- RefmsgTime string `json:"refmsg_time"`
- RespondTime string `json:"respond_time"`
- Signtype interface{} `json:"signtype"`
- WarnMsg interface{} `json:"warn_msg"`
- }
-
- type ResultEight struct {
- Cainfo string `json:"cainfo"`
- ErrMsg string `json:"err_msg"`
- InfRefmsgid string `json:"inf_refmsgid"`
- Infcode int64 `json:"infcode"`
- Output struct {
- Stmtinfo struct {
- SetlOptins string `json:"setl_optins"`
- StmtRslt string `json:"stmt_rslt"`
- StmtRsltDscr string `json:"stmt_rslt_dscr"`
- } `json:"stmtinfo"`
- } `json:"output"`
- RefmsgTime string `json:"refmsg_time"`
- RespondTime string `json:"respond_time"`
- Signtype interface{} `json:"signtype"`
- WarnMsg interface{} `json:"warn_msg"`
- }
-
- type ResultEightFor10188 struct {
- Cainfo string `json:"cainfo"`
- ErrMsg string `json:"err_msg"`
- InfRefmsgid string `json:"inf_refmsgid"`
- Infcode string `json:"infcode"`
- Output struct {
- Stmtinfo struct {
- SetlOptins string `json:"setl_optins"`
- StmtRslt string `json:"stmt_rslt"`
- StmtRsltDscr string `json:"stmt_rslt_dscr"`
- } `json:"stmtinfo"`
- } `json:"output"`
- RefmsgTime string `json:"refmsg_time"`
- RespondTime string `json:"respond_time"`
- Signtype interface{} `json:"signtype"`
- WarnMsg interface{} `json:"warn_msg"`
- }
- type ResultNine struct {
- Cainfo string `json:"cainfo"`
- ErrMsg string `json:"err_msg"`
- InfRefmsgid string `json:"inf_refmsgid"`
- Infcode int64 `json:"infcode"`
- Output struct {
- FileQuryNo string `json:"file_qury_no"`
- } `json:"output"`
- RefmsgTime string `json:"refmsg_time"`
- RespondTime string `json:"respond_time"`
- Signtype interface{} `json:"signtype"`
- WarnMsg interface{} `json:"warn_msg"`
- }
- type ResultTen struct {
- Cainfo string `json:"cainfo"`
- ErrMsg string `json:"err_msg"`
- InfRefmsgid string `json:"inf_refmsgid"`
- Infcode int64 `json:"infcode"`
- Output struct {
- DldEndtime string `json:"dld_endtime"`
- FileQuryNo string `json:"file_qury_no"`
- Filename string `json:"filename"`
- } `json:"output"`
- RefmsgTime string `json:"refmsg_time"`
- RespondTime string `json:"respond_time"`
- Signtype interface{} `json:"signtype"`
- WarnMsg interface{} `json:"warn_msg"`
- }
-
- //type Autogenerated struct {
- // Output struct {
- // Setlinfo struct {
- // SetlTime string `json:"setl_time"`
- // CvlservPay float64 `json:"cvlserv_pay"`
- // Year string `json:"year"`
- // MedType string `json:"med_type"`
- // PsnPay float64 `json:"psn_pay"`
- // OpterID string `json:"opter_id"`
- // Begndate string `json:"begndate"`
- // FlxempeFlag string `json:"flxempe_flag"`
- // HifmiPay float64 `json:"hifmi_pay"`
- // PsnNo string `json:"psn_no"`
- // ActPayDedc float64 `json:"act_pay_dedc"`
- // MedinsSetlID interface{} `json:"medins_setl_id"`
- // AcctMulaidPay interface{} `json:"acct_mulaid_pay"`
- // ClrWay string `json:"clr_way"`
- // OthPay float64 `json:"oth_pay"`
- // Gend string `json:"gend"`
- // MdtrtID string `json:"mdtrt_id"`
- // AcctPay float64 `json:"acct_pay"`
- // InscpScpAmt float64 `json:"inscp_scp_amt"`
- // Insutype string `json:"insutype"`
- // Invono interface{} `json:"invono"`
- // Enddate string `json:"enddate"`
- // CashPayamt float64 `json:"cash_payamt"`
- // PsnType string `json:"psn_type"`
- // FixmedinsName string `json:"fixmedins_name"`
- // HifpPay float64 `json:"hifp_pay"`
- // NewFlag interface{} `json:"new_flag"`
- // OverlmtSelfpay float64 `json:"overlmt_selfpay"`
- // PreselfpayAmt float64 `json:"preselfpay_amt"`
- // PayLoc string `json:"pay_loc"`
- // ClrType string `json:"clr_type"`
- // RefdSetlFlag string `json:"refd_setl_flag"`
- // CvlservFlag string `json:"cvlserv_flag"`
- // EmpName string `json:"emp_name"`
- // Brdy string `json:"brdy"`
- // Naty string `json:"naty"`
- // Certno string `json:"certno"`
- // DiseCode string `json:"dise_code"`
- // FixmedinsCode string `json:"fixmedins_code"`
- // DedcHospLv string `json:"dedc_hosp_lv"`
- // OpterName string `json:"opter_name"`
- // Balc float64 `json:"balc"`
- // FixmedinsPoolarea string `json:"fixmedins_poolarea"`
- // PsnCertType string `json:"psn_cert_type"`
- // HifobPay float64 `json:"hifob_pay"`
- // MedfeeSumamt float64 `json:"medfee_sumamt"`
- // HifesPay float64 `json:"hifes_pay"`
- // FundPaySumamt float64 `json:"fund_pay_sumamt"`
- // OptTime string `json:"opt_time"`
- // FulamtOwnpayAmt float64 `json:"fulamt_ownpay_amt"`
- // SetlID string `json:"setl_id"`
- // MafPay float64 `json:"maf_pay"`
- // PsnName string `json:"psn_name"`
- // InsuOptins interface{} `json:"insu_optins"`
- // PrefFundPay interface{} `json:"pref_fund_pay"`
- // ClrOptins string `json:"clr_optins"`
- // PoolPropSelfpay float64 `json:"pool_prop_selfpay"`
- // DiseName string `json:"dise_name"`
- // LmtpricHospLv string `json:"lmtpric_hosp_lv"`
- // Age float64 `json:"age"`
- // DtrtCertType string `json:"dtrt_cert_type"`
- // HospLv string `json:"hosp_lv"`
- // } `json:"setlinfo"`
- // Setldetail []struct {
- // FundPayType string `json:"fund_pay_type"`
- // FundPayamt float64 `json:"fund_payamt"`
- // SetlProcInfo interface{} `json:"setl_proc_info"`
- // CrtPaybLmtAmt interface{} `json:"crt_payb_lmt_amt"`
- // InscpScpAmt interface{} `json:"inscp_scp_amt"`
- // FundPayTypeName interface{} `json:"fund_pay_type_name"`
- // PrefFundPay interface{} `json:"pref_fund_pay"`
- // } `json:"setldetail"`
- // } `json:"output"`
- // Infcode int `json:"infcode"`
- // WarnMsg interface{} `json:"warn_msg"`
- // Cainfo interface{} `json:"cainfo"`
- // ErrMsg interface{} `json:"err_msg"`
- // RefmsgTime string `json:"refmsg_time"`
- // Signtype interface{} `json:"signtype"`
- // RespondTime string `json:"respond_time"`
- // InfRefmsgid string `json:"inf_refmsgid"`
- //}
-
- type ResultEleven struct {
- Cainfo string `json:"cainfo"`
- ErrMsg string `json:"err_msg"`
- InfRefmsgid string `json:"inf_refmsgid"`
- Infcode int64 `json:"infcode"`
- Output struct {
- Setlinfo struct {
- SetlTime string `json:"setl_time"`
- CvlservPay float64 `json:"cvlserv_pay"`
- Year string `json:"year"`
- MedType string `json:"med_type"`
- PsnPay float64 `json:"psn_pay"`
- OpterID string `json:"opter_id"`
- Begndate string `json:"begndate"`
- FlxempeFlag string `json:"flxempe_flag"`
- HifmiPay float64 `json:"hifmi_pay"`
- PsnNo string `json:"psn_no"`
- ActPayDedc float64 `json:"act_pay_dedc"`
- MedinsSetlID interface{} `json:"medins_setl_id"`
- AcctMulaidPay interface{} `json:"acct_mulaid_pay"`
- ClrWay string `json:"clr_way"`
- OthPay float64 `json:"oth_pay"`
- Gend string `json:"gend"`
- MdtrtID string `json:"mdtrt_id"`
- AcctPay float64 `json:"acct_pay"`
- InscpScpAmt float64 `json:"inscp_scp_amt"`
- Insutype string `json:"insutype"`
- Invono interface{} `json:"invono"`
- Enddate string `json:"enddate"`
- CashPayamt float64 `json:"cash_payamt"`
- PsnType string `json:"psn_type"`
- FixmedinsName string `json:"fixmedins_name"`
- HifpPay float64 `json:"hifp_pay"`
- NewFlag interface{} `json:"new_flag"`
- OverlmtSelfpay float64 `json:"overlmt_selfpay"`
- PreselfpayAmt float64 `json:"preselfpay_amt"`
- PayLoc string `json:"pay_loc"`
- ClrType string `json:"clr_type"`
- RefdSetlFlag string `json:"refd_setl_flag"`
- CvlservFlag string `json:"cvlserv_flag"`
- EmpName string `json:"emp_name"`
- Brdy string `json:"brdy"`
- Naty string `json:"naty"`
- Certno string `json:"certno"`
- DiseCode string `json:"dise_code"`
- FixmedinsCode string `json:"fixmedins_code"`
- DedcHospLv string `json:"dedc_hosp_lv"`
- OpterName string `json:"opter_name"`
- Balc float64 `json:"balc"`
- FixmedinsPoolarea string `json:"fixmedins_poolarea"`
- PsnCertType string `json:"psn_cert_type"`
- HifobPay float64 `json:"hifob_pay"`
- MedfeeSumamt float64 `json:"medfee_sumamt"`
- HifesPay float64 `json:"hifes_pay"`
- FundPaySumamt float64 `json:"fund_pay_sumamt"`
- OptTime string `json:"opt_time"`
- FulamtOwnpayAmt float64 `json:"fulamt_ownpay_amt"`
- SetlID string `json:"setl_id"`
- MafPay float64 `json:"maf_pay"`
- PsnName string `json:"psn_name"`
- InsuOptins interface{} `json:"insu_optins"`
- PrefFundPay interface{} `json:"pref_fund_pay"`
- ClrOptins string `json:"clr_optins"`
- DiseName string `json:"dise_name"`
- LmtpricHospLv string `json:"lmtpric_hosp_lv"`
- Age float64 `json:"age"`
- DtrtCertType string `json:"dtrt_cert_type"`
- HospLv string `json:"hosp_lv"`
- } `json:"setlinfo"`
- } `json:"output"`
- RefmsgTime string `json:"refmsg_time"`
- RespondTime string `json:"respond_time"`
- Signtype interface{} `json:"signtype"`
- WarnMsg interface{} `json:"warn_msg"`
- }
- type ResultEleven10265 struct {
- Cainfo string `json:"cainfo"`
- ErrMsg string `json:"err_msg"`
- InfRefmsgid string `json:"inf_refmsgid"`
- Infcode string `json:"infcode"`
- Output struct {
- Setlinfo struct {
- SetlTime string `json:"setl_time"`
- CvlservPay float64 `json:"cvlserv_pay"`
- Year string `json:"year"`
- MedType string `json:"med_type"`
- PsnPay float64 `json:"psn_pay"`
- OpterID string `json:"opter_id"`
- Begndate string `json:"begndate"`
- FlxempeFlag string `json:"flxempe_flag"`
- HifmiPay float64 `json:"hifmi_pay"`
- PsnNo string `json:"psn_no"`
- ActPayDedc float64 `json:"act_pay_dedc"`
- MedinsSetlID interface{} `json:"medins_setl_id"`
- AcctMulaidPay interface{} `json:"acct_mulaid_pay"`
- ClrWay string `json:"clr_way"`
- OthPay float64 `json:"oth_pay"`
- Gend string `json:"gend"`
- MdtrtID string `json:"mdtrt_id"`
- AcctPay float64 `json:"acct_pay"`
- InscpScpAmt float64 `json:"inscp_scp_amt"`
- Insutype string `json:"insutype"`
- Invono interface{} `json:"invono"`
- Enddate string `json:"enddate"`
- CashPayamt float64 `json:"cash_payamt"`
- PsnType string `json:"psn_type"`
- FixmedinsName string `json:"fixmedins_name"`
- HifpPay float64 `json:"hifp_pay"`
- NewFlag interface{} `json:"new_flag"`
- OverlmtSelfpay float64 `json:"overlmt_selfpay"`
- PreselfpayAmt float64 `json:"preselfpay_amt"`
- PayLoc string `json:"pay_loc"`
- ClrType string `json:"clr_type"`
- RefdSetlFlag string `json:"refd_setl_flag"`
- CvlservFlag string `json:"cvlserv_flag"`
- EmpName string `json:"emp_name"`
- Brdy string `json:"brdy"`
- Naty string `json:"naty"`
- Certno string `json:"certno"`
- DiseCode string `json:"dise_code"`
- FixmedinsCode string `json:"fixmedins_code"`
- DedcHospLv string `json:"dedc_hosp_lv"`
- OpterName string `json:"opter_name"`
- Balc float64 `json:"balc"`
- FixmedinsPoolarea string `json:"fixmedins_poolarea"`
- PsnCertType string `json:"psn_cert_type"`
- HifobPay float64 `json:"hifob_pay"`
- MedfeeSumamt float64 `json:"medfee_sumamt"`
- HifesPay float64 `json:"hifes_pay"`
- FundPaySumamt float64 `json:"fund_pay_sumamt"`
- OptTime string `json:"opt_time"`
- FulamtOwnpayAmt float64 `json:"fulamt_ownpay_amt"`
- SetlID string `json:"setl_id"`
- MafPay float64 `json:"maf_pay"`
- PsnName string `json:"psn_name"`
- InsuOptins interface{} `json:"insu_optins"`
- PrefFundPay interface{} `json:"pref_fund_pay"`
- ClrOptins string `json:"clr_optins"`
- DiseName string `json:"dise_name"`
- LmtpricHospLv string `json:"lmtpric_hosp_lv"`
- Age float64 `json:"age"`
- DtrtCertType string `json:"dtrt_cert_type"`
- HospLv string `json:"hosp_lv"`
- } `json:"setlinfo"`
- } `json:"output"`
- RefmsgTime string `json:"refmsg_time"`
- RespondTime string `json:"respond_time"`
- Signtype interface{} `json:"signtype"`
- WarnMsg interface{} `json:"warn_msg"`
- }
-
- type ResultTwelve struct {
- Cainfo string `json:"cainfo"`
- ErrMsg string `json:"err_msg"`
- InfRefmsgid string `json:"inf_refmsgid"`
- Infcode int64 `json:"infcode"`
- Output struct {
- MdtrtId string `json:"mdtrt_id"`
- ChrgBchno string `json:"chrg_bchno"`
- PsnNo string `json:"psn_no"`
- } `json:"output"`
- RefmsgTime string `json:"refmsg_time"`
- RespondTime string `json:"respond_time"`
- Signtype interface{} `json:"signtype"`
- WarnMsg interface{} `json:"warn_msg"`
- }
-
- type ResultThirteen struct {
- ErrMsg string `json:"err_msg"`
- InfRefmsgid string `json:"inf_refmsgid"`
- Infcode int64 `json:"infcode"`
- Output struct {
- Result struct {
- TrtDclaDetlSn string `json:"trt_dcla_detl_sn"`
- } `json:"result"`
- } `json:"output"`
- RefmsgTime string `json:"refmsg_time"`
- RespondTime string `json:"respond_time"`
- Signtype interface{} `json:"signtype"`
- WarnInfo interface{} `json:"warn_info"`
- }
-
- type ResultThirteen10265 struct {
- ErrMsg string `json:"err_msg"`
- InfRefmsgid string `json:"inf_refmsgid"`
- Infcode string `json:"infcode"`
- Output struct {
- Result struct {
- TrtDclaDetlSn string `json:"trt_dcla_detl_sn"`
- } `json:"result"`
- } `json:"output"`
- RefmsgTime string `json:"refmsg_time"`
- RespondTime string `json:"respond_time"`
- Signtype interface{} `json:"signtype"`
- WarnInfo interface{} `json:"warn_info"`
- }
-
- type ResultFourteen struct {
- ErrMsg string `json:"err_msg"`
- InfRefmsgid string `json:"inf_refmsgid"`
- Infcode int64 `json:"infcode"`
- Output struct {
- } `json:"output"`
- RefmsgTime string `json:"refmsg_time"`
- RespondTime string `json:"respond_time"`
- Signtype interface{} `json:"signtype"`
- WarnInfo interface{} `json:"warn_info"`
- }
-
- type ResultFourteen10265 struct {
- ErrMsg string `json:"err_msg"`
- InfRefmsgid string `json:"inf_refmsgid"`
- Infcode string `json:"infcode"`
- Output struct {
- } `json:"output"`
- RefmsgTime string `json:"refmsg_time"`
- RespondTime string `json:"respond_time"`
- Signtype interface{} `json:"signtype"`
- WarnInfo interface{} `json:"warn_info"`
- }
-
- type ResultSixteen struct {
- Cainfo string `json:"cainfo"`
- ErrMsg string `json:"err_msg"`
- InfRefmsgid string `json:"inf_refmsgid"`
- Infcode int64 `json:"infcode"`
- Output struct {
- Setldetail []interface{} `json:"setldetail"`
- Setlinfo struct {
- MdtrtID string `json:"mdtrt_id"`
- SetlID string `json:"setl_id"`
- ClrOptins string `json:"clr_optins"`
- SetlTime string `json:"setl_time"`
- MedfeeSumamt float64 `json:"medfee_sumamt"`
- FulamtOwnpayAmt float64 `json:"fulamt_ownpay_amt"`
- OverlmtSelfpay float64 `json:"overlmt_selfpay"`
- PreselfpayAmt float64 `json:"preselfpay_amt"`
- InscpScpAmt float64 `json:"inscp_scp_amt"`
- ActPayDedc float64 `json:"act_pay_dedc"`
- HifpPay float64 `json:"hifp_pay"`
- Lfpay float64 `json:"selfpay"`
- CvlservPay float64 `json:"cvlserv_pay"`
- HifesPay float64 `json:"hifes_pay"`
- HifmiPay float64 `json:"hifmi_pay"`
- HifobPay float64 `json:"hifob_pay"`
- MafPay float64 `json:"maf_pay"`
- OthPay float64 `json:"oth_pay"`
- FundPaySumamt float64 `json:"fund_pay_sumamt"`
- PsnPartAmt float64 `json:"psn_part_amt"`
- AcctPay float64 `json:"acct_pay"`
- Balc float64 `json:"balc"`
- AcctMulaidPay float64 `json:"acct_mulaid_pay"`
- HospPartAmt float64 `json:"hosp_part_amt"`
- MedinsSetlID string `json:"medins_setl_id"`
- PdnCashPay string `json:"pdn_cash_pay"`
- } `json:"setlinfo"`
- } `json:"output"`
- RefmsgTime string `json:"refmsg_time"`
- RespondTime string `json:"respond_time"`
- Signtype interface{} `json:"signtype"`
- WarnMsg interface{} `json:"warn_msg"`
- }
- type ResultSixteen10265 struct {
- Cainfo string `json:"cainfo"`
- ErrMsg string `json:"err_msg"`
- InfRefmsgid string `json:"inf_refmsgid"`
- Infcode string `json:"infcode"`
- Output struct {
- Setldetail []interface{} `json:"setldetail"`
- Setlinfo struct {
- MdtrtID string `json:"mdtrt_id"`
- SetlID string `json:"setl_id"`
- ClrOptins string `json:"clr_optins"`
- SetlTime string `json:"setl_time"`
- MedfeeSumamt float64 `json:"medfee_sumamt"`
- FulamtOwnpayAmt float64 `json:"fulamt_ownpay_amt"`
- OverlmtSelfpay float64 `json:"overlmt_selfpay"`
- PreselfpayAmt float64 `json:"preselfpay_amt"`
- InscpScpAmt float64 `json:"inscp_scp_amt"`
- ActPayDedc float64 `json:"act_pay_dedc"`
- HifpPay float64 `json:"hifp_pay"`
- Lfpay float64 `json:"selfpay"`
- CvlservPay float64 `json:"cvlserv_pay"`
- HifesPay float64 `json:"hifes_pay"`
- HifmiPay float64 `json:"hifmi_pay"`
- HifobPay float64 `json:"hifob_pay"`
- MafPay float64 `json:"maf_pay"`
- OthPay float64 `json:"oth_pay"`
- FundPaySumamt float64 `json:"fund_pay_sumamt"`
- PsnPartAmt float64 `json:"psn_part_amt"`
- AcctPay float64 `json:"acct_pay"`
- Balc float64 `json:"balc"`
- AcctMulaidPay float64 `json:"acct_mulaid_pay"`
- HospPartAmt float64 `json:"hosp_part_amt"`
- MedinsSetlID string `json:"medins_setl_id"`
- PdnCashPay string `json:"pdn_cash_pay"`
- } `json:"setlinfo"`
- } `json:"output"`
- RefmsgTime string `json:"refmsg_time"`
- RespondTime string `json:"respond_time"`
- Signtype interface{} `json:"signtype"`
- WarnMsg interface{} `json:"warn_msg"`
- }
-
- type ResultSeventeen struct {
- ErrMsg string `json:"err_msg"`
- InfRefmsgid string `json:"inf_refmsgid"`
- Infcode int64 `json:"infcode"`
- Output struct {
- SetlListId string `json:"setl_list_id"`
- } `json:"output"`
- RefmsgTime string `json:"refmsg_time"`
- RespondTime string `json:"respond_time"`
- Signtype string `json:"signtype"`
- WarnInfo string `json:"warn_info"`
- }
-
- type ResultSeventeenOther struct {
- ErrMsg string `json:"err_msg"`
- InfRefmsgid string `json:"inf_refmsgid"`
- Infcode string `json:"infcode"`
- Output struct {
- SetlListId string `json:"setl_list_id"`
- } `json:"output"`
- RefmsgTime string `json:"refmsg_time"`
- RespondTime string `json:"respond_time"`
- Signtype string `json:"signtype"`
- WarnInfo string `json:"warn_info"`
- }
-
- type Result90991 struct {
- ErrMsg string `json:"err_msg"`
- InfRefmsgid string `json:"inf_refmsgid"`
- Infcode int64 `json:"infcode"`
- Output struct {
- Result struct {
- PsnNo string `json:"psn_no"`
- CardStat string `json:"card_stat"`
- Certno string `json:"certno"`
- PsnName string `json:"psn_name"`
- CheckStat string `json:"check_stat"`
- SscnoCheckStat string `json:"sscno_check_stat"`
- } `json:"result"`
- } `json:"output"`
- RefmsgTime string `json:"refmsg_time"`
- RespondTime string `json:"respond_time"`
- Signtype interface{} `json:"signtype"`
- WarnInfo interface{} `json:"warn_info"`
- }
-
- type Result90100 struct {
- ErrMsg string `json:"err_msg"`
- InfRefmsgid string `json:"inf_refmsgid"`
- Infcode int64 `json:"infcode"`
- Output struct {
- PoolareaNo string `json:"poolarea_no"`
- PoolareaNoName string `json:"poolarea_no_name"`
- Insutype string `json:"insutype"`
- InsutypeName string `json:"insutype_name"`
- ClctType string `json:"clct_type"`
- ClctTypeName string `json:"clct_type_name"`
- ClctFlag string `json:"clct_flag"`
- ClctFlagName string `json:"clct_flag_name"`
- AccrymBegn string `json:"accrym_begn"`
- AccrymEnd string `json:"accrym_end"`
- ClctTime string `json:"clct_time"`
- ClctstdCrtfRuleCodg string `json:"clctstd_crtf_rule_codg"`
- } `json:"output"`
- RefmsgTime string `json:"refmsg_time"`
- RespondTime string `json:"respond_time"`
- Signtype interface{} `json:"signtype"`
- WarnInfo interface{} `json:"warn_info"`
- }
-
- type Custom struct {
- DetItemFeeSumamt string
- Cut string
- FeedetlSn string
- Price string
- MedListCodg string
- Type int64
- AdviceId int64
- ProjectId int64
- ItemId int64
- }
-
- type Result5301 struct {
- ErrMsg string `json:"err_msg"`
- InfRefmsgid string `json:"inf_refmsgid"`
- Infcode int64 `json:"infcode"`
- Output struct {
- Result []struct {
- OpspDiseCode string `json:"opsp_dise_code"`
- OpspDiseName string `json:"opsp_dise_name"`
- Begndate string `json:"begndate"`
- Enddate string `json:"enddate"`
- } `json:"feedetail"`
- } `json:"output"`
- RefmsgTime string `json:"refmsg_time"`
- RespondTime string `json:"respond_time"`
- Signtype interface{} `json:"signtype"`
- WarnInfo interface{} `json:"warn_info"`
- }
-
- type Result5301For10265 struct {
- ErrMsg string `json:"err_msg"`
- InfRefmsgid string `json:"inf_refmsgid"`
- Infcode string `json:"infcode"`
- Output struct {
- Result []struct {
- OpspDiseCode string `json:"opsp_dise_code"`
- OpspDiseName string `json:"opsp_dise_name"`
- Begndate string `json:"begndate"`
- Enddate string `json:"enddate"`
- } `json:"feedetail"`
- } `json:"output"`
- RefmsgTime string `json:"refmsg_time"`
- RespondTime string `json:"respond_time"`
- Signtype interface{} `json:"signtype"`
- WarnInfo interface{} `json:"warn_info"`
- }
-
- //获取个人信息----挂号-----上传就诊信息
- func (c *HisApiController) GetRegisterInfo() {
- id, _ := c.GetInt64("id")
- record_time := c.GetString("record_time")
- settlementValue, _ := c.GetInt64("settlement_value")
- medical_insurance_card := c.GetString("medical_insurance_card")
- name := c.GetString("name")
- id_card_type, _ := c.GetInt64("id_card_type")
- certificates, _ := c.GetInt64("certificates")
- medical_care, _ := c.GetInt64("medical_care")
- birthday := c.GetString("birthday")
- id_card := c.GetString("id_card")
- register_type, _ := c.GetInt64("register")
- doctor, _ := c.GetInt64("doctor")
- department, _ := c.GetInt64("department")
- gender, _ := c.GetInt64("sex")
- registration_fee, _ := c.GetFloat("registration_fee")
- medical_expenses, _ := c.GetFloat("medical_expenses")
- social_type, _ := c.GetInt64("social_type")
- med_type := c.GetString("social_type")
- admin_user_id, _ := c.GetInt64("admin_user_id")
- insuplc_admdvs := c.GetString("insuplc_admdvs")
-
- timeLayout := "2006-01-02"
- loc, _ := time.LoadLocation("Local")
- birthdays, _ := time.ParseInLocation(timeLayout+" 15:04:05", birthday+" 00:00:00", loc)
- birthUnix := birthdays.Unix()
-
- theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", record_time+" 00:00:00", loc)
- if err != nil {
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
- return
- }
- recordDateTime := theTime.Unix()
-
- adminInfo := c.GetAdminUserInfo()
- var patient service.Patients
- if id == 0 {
- patient, _ = service.GetPatientByIDCard(id_card, adminInfo.CurrentOrgId)
- } else {
- patient, _ = service.GetPatientByIDTwo(adminInfo.CurrentOrgId, id)
- }
- patientPrescription, _ := service.FindPatientPrescriptionInfo(adminInfo.CurrentOrgId, id, recordDateTime)
- if patientPrescription.ID == 0 {
- patientPrescription, _ = service.FindLastPatientPrescriptionInfo(adminInfo.CurrentOrgId, id, recordDateTime)
- }
-
- miConfig, _ := service.FindMedicalInsuranceInfo(adminInfo.CurrentOrgId)
- if patient.ID == 0 {
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodePatientNoExist)
- return
- }
- if len(patient.IdCardNo) == 0 {
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeIDCartNo)
- return
- }
- config, _ := service.GetMedicalInsuranceConfig(adminInfo.CurrentOrgId)
- roles, _ := service.GetAdminUserInfoByID(adminInfo.CurrentOrgId, admin_user_id)
-
- doctor_info, _ := service.GetAdminUserInfoByID(adminInfo.CurrentOrgId, doctor)
-
- //就诊结算未完成,不能进行二次挂号
- his, _ := service.GetHisPatientInfoTwo(adminInfo.CurrentOrgId, patient.ID, recordDateTime)
- if len(his) >= 1 {
- order, _ := service.GetNewHisOrderTwo(adminInfo.CurrentOrgId, his[len(his)-1].Number, his[len(his)-1].PatientId, recordDateTime)
- if len(his) >= 1 && order.ID == 0 {
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeHisPatientParamWrong)
- return
- }
- }
-
- //var register_log string
-
- if config.IsOpen == 1 {
- var res ResultTwo
- var res10265 ResultTwo10265
- var PsnNo string
- var PsnCertType string
- var Certno string
- var PsnName string
- var Gend string
- var Naty string
- var Brdy string
- var Age float64
- var infoStr string
- var idetinfoStr string
- var infocode int64
- var verify_number string
- fmt.Println(verify_number)
- if miConfig.MdtrtareaAdmvs == "421300" {
- psn_info, _ := service.GetPsnByPatientId(id)
- PsnNo = psn_info.PsnNo
- PsnCertType = psn_info.PsnCertType
- Certno = psn_info.Certno
- PsnName = psn_info.PsnName
- Gend = psn_info.Gend
- Naty = psn_info.Naty
- Brdy = psn_info.Brdy
- Age = psn_info.Age
- infoStr = psn_info.Insuinfo
- idetinfoStr = psn_info.Idetinfo
- infocode = 0
-
- } else if miConfig.MdtrtareaAdmvs == "320921" || miConfig.MdtrtareaAdmvs == "320982" {
- psn_info, _ := service.GetPsnByPatientId(id)
- PsnNo = psn_info.PsnNo
- PsnCertType = psn_info.PsnCertType
- Certno = psn_info.Certno
- PsnName = psn_info.PsnName
- Gend = psn_info.Gend
- Naty = psn_info.Naty
- Brdy = psn_info.Brdy
- Age = psn_info.Age
- infoStr = psn_info.Insuinfo
- idetinfoStr = psn_info.Idetinfo
- infocode = 0
- verify_number = psn_info.VerifyNumber
-
- } else {
- var result string
- var requestLog string
- if miConfig.UserOrgId == 10138 {
- result, requestLog = service.Gdyb1101D(patient.IdCardNo, miConfig.OrgName, roles.UserName, miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, id_card_type, "", strconv.FormatInt(certificates, 10), name, record_time)
- } else {
- result, requestLog = service.Gdyb1101(patient.IdCardNo, miConfig.OrgName, roles.UserName, miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, id_card_type, "", strconv.FormatInt(certificates, 10), name)
- }
- saveLog(result, requestLog, "1101", "人员基本信息获取")
- if miConfig.Code == "H15049901371" {
-
- if err := json.Unmarshal([]byte(result), &res10265); err != nil {
- utils.ErrorLog("解析失败:%v", err)
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
- res.ErrMsg = res10265.ErrMsg
- //res.Output = res10265.Output
- res.InfRefmsgid = res10265.InfRefmsgid
-
- } else {
- if err := json.Unmarshal([]byte(result), &res); err != nil {
- utils.ErrorLog("解析失败:%v", err)
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
- }
-
- PsnNo = res.Output[0].Baseinfo.PsnNo
- PsnCertType = res.Output[0].Baseinfo.PsnCertType
- Certno = res.Output[0].Baseinfo.Certno
- PsnName = res.Output[0].Baseinfo.PsnName
- Gend = res.Output[0].Baseinfo.Gend
- Naty = res.Output[0].Baseinfo.Naty
- Brdy = res.Output[0].Baseinfo.Brdy
- Age = res.Output[0].Baseinfo.Age
- Iinfos, _ := json.Marshal(res.Output[0].Iinfo)
- Idetinfos, _ := json.Marshal(res.Output[0].Idetinfo)
- infoStr = string(Iinfos)
- idetinfoStr = string(Idetinfos)
- if miConfig.Code == "H15049901371" {
- infocode, _ = strconv.ParseInt(res10265.Infcode, 10, 64)
- } else {
- infocode = res.Infcode
- }
- }
- if infocode == 0 {
- his := models.VMHisPatient{
- Name: name,
- Gender: gender,
- Birthday: birthUnix,
- MedicalTreatmentType: medical_care,
- IdType: certificates,
- IdCardNo: id_card,
- BalanceAccountsType: settlementValue,
- SocialType: social_type,
- MedicalInsuranceNumber: medical_insurance_card,
- RegisterType: register_type,
- RegisterCost: registration_fee,
- TreatmentCost: medical_expenses,
- Status: 1,
- Ctime: time.Now().Unix(),
- Mtime: time.Now().Unix(),
- PsnNo: PsnNo,
- PsnCertType: PsnCertType,
- Certno: Certno,
- PsnName: PsnName,
- Gend: Gend,
- Naty: Naty,
- Brdy: Brdy,
- Age: Age,
- Iinfo: infoStr,
- Idetinfo: idetinfoStr,
- PatientId: patient.ID,
- RecordDate: theTime.Unix(),
- UserOrgId: adminInfo.CurrentOrgId,
- AdminUserId: admin_user_id,
- IsReturn: 1,
- IdCardType: id_card_type,
- Doctor: doctor,
- Departments: department,
- }
-
- timestamp := time.Now().Unix()
- tempTime := time.Unix(timestamp, 0)
- timeFormat := tempTime.Format("20060102150405")
- chrgBchno := rand.Intn(100000) + 10000
- ipt_otp_no := timeFormat + strconv.FormatInt(int64(chrgBchno), 10) + strconv.FormatInt(his.PatientId, 10)
- //count, _ := service.FindHisRegisterRecord(theTime.Unix(), patient.ID, adminInfo.CurrentOrgId)
- department, _ := service.GetDepartMentDetail(department)
- doctor_id := strconv.FormatInt(patientPrescription.DoctorId, 10)
-
- IdCardNo := ""
- if id_card_type == 1 {
- // IdCardNo = medical_insurance_card
- IdCardNo = patient.IdCardNo
- } else {
- IdCardNo = patient.IdCardNo
- }
-
- var rf []*ResultFive
- json.Unmarshal([]byte(his.Iinfo), &rf)
- var insutypes []*ResultFive
- var insutype string
- var insuplc_admdvs_temp string
- var is390 int = 0
- var is310 int = 0
-
- for _, item := range rf {
- if (item.Insutype == "390" && item.PsnInsuStas == "1") || (item.Insutype == "310" && item.PsnInsuStas == "1") {
- insutypes = append(insutypes, item)
- }
- }
-
- if len(insutypes) == 1 {
- insutype = insutypes[0].Insutype
- //insuplc_admdvs = insutypes[0].InsuplcAdmdvs
- } else {
- for _, i := range insutypes {
- if i.Insutype == "390" {
- is390 = 1
- }
-
- if i.Insutype == "310" {
- is310 = 1
- }
- }
- }
- if is390 == 1 {
- insutype = "390"
- }
-
- if is310 == 1 {
- insutype = "310"
- }
-
- if len(insutypes) == 0 {
- insutype = "310"
- }
-
- if len(insutypes) == 2 {
- insutype = med_type
- }
-
- if len(med_type) > 0 {
-
- insutype = med_type
- }
-
- //for _, item := range rf {
- // if item.Insutype == insutype {
- // insuplc_admdvs = item.InsuplcAdmdvs
- // }
- //}
- var infocode int64
- var resThree ResultThree
- var resThree10265 ResultThree10265
-
- if len(insuplc_admdvs) == 0 {
- insuplc_admdvs_temp = miConfig.InsuplcAdmdvs
- } else {
-
- insuplc_admdvs_temp = insuplc_admdvs
-
- }
-
- if miConfig.MdtrtareaAdmvs == "421300" {
- api := "http://192.168.124.4:9532/" + "hbyb/2201?psn_no=" + PsnNo + "&insutype=" + insutype + "&cert_no=" + Certno + "&ipt_otp_no=" + ipt_otp_no +
- "&org_name=" + miConfig.OrgName + "&doctor=" + doctor_info.UserName + "&fixmedins_code=" + miConfig.Code +
- "&insuplc_admdvs=" + insuplc_admdvs_temp + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey + "&id_card_type=" + strconv.FormatInt(id_card_type, 10) + "&dept_code=" + department.Number + "&dept=" + department.Name + "&doctor_id=" + doctor_id + "&doctor_name=" + doctor_info.UserName
- resp, requestErr := http.Get(api)
- if requestErr != nil {
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
-
- body, ioErr := ioutil.ReadAll(resp.Body)
- if ioErr != nil {
- utils.ErrorLog("接口返回数据读取失败: %v", ioErr)
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
- var respJSON map[string]interface{}
- if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
- utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
-
- respJSON = respJSON["data"].(map[string]interface{})["pre"].(map[string]interface{})
- result, _ := json.Marshal(respJSON)
-
- if err := json.Unmarshal([]byte(result), &resThree); err != nil {
- utils.ErrorLog("解析失败:%v", err)
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
- infocode = resThree.Infcode
-
- } else if miConfig.MdtrtareaAdmvs == "320921" || miConfig.MdtrtareaAdmvs == "320982" {
- psn_info, _ := service.GetPsnByPatientId(id)
-
- psn_info.VerifyNumber = strings.Replace(psn_info.VerifyNumber, "+", "%2B", -1)
- var cert_no string
- if id_card_type == 3 {
- psn_info.VerifyNumber = IdCardNo + "|" + psn_info.VerifyNumber
- cert_no = IdCardNo
- } else if id_card_type == 4 {
- cert_no = IdCardNo
- psn_info.VerifyNumber = psn_info.VerifyNumber
- } else {
-
- bas := strings.Split(psn_info.CardInfo, "|")
- cert_no = bas[2]
- }
-
- var api string
- if miConfig.MdtrtareaAdmvs == "320921" {
-
- api = "http://192.168.3.111:9532/" + "jsyb/2201?psn_no=" + PsnNo + "&insutype=" + insutype + "&cert_no=" + cert_no + "&ipt_otp_no=" + ipt_otp_no +
- "&org_name=" + miConfig.OrgName + "&doctor=" + roles.UserName + "&doctor_name=" + doctor_info.UserName + "&fixmedins_code=" + miConfig.Code +
- "&insuplc_admdvs=" + insuplc_admdvs_temp + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey + "&id_card_type=" + strconv.FormatInt(id_card_type, 10) + "&dept_code=" + department.Number + "&dept=" + department.Name + "&doctor_id=" + doctor_id + "&url=" + miConfig.Url + "&ak=" + miConfig.AccessKey + "&verify_number=" + psn_info.VerifyNumber + "&cainfo=" + miConfig.Cainfo
-
- } else {
- api = "http://192.168.5.251:9532/" + "jsyb/2201?psn_no=" + PsnNo + "&insutype=" + insutype + "&cert_no=" + cert_no + "&ipt_otp_no=" + ipt_otp_no +
- "&org_name=" + miConfig.OrgName + "&doctor=" + roles.UserName + "&doctor_name=" + doctor_info.UserName + "&fixmedins_code=" + miConfig.Code +
- "&insuplc_admdvs=" + insuplc_admdvs_temp + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey + "&id_card_type=" + strconv.FormatInt(id_card_type, 10) + "&dept_code=" + department.Number + "&dept=" + department.Name + "&doctor_id=" + doctor_id + "&url=" + miConfig.Url + "&ak=" + miConfig.AccessKey + "&verify_number=" + psn_info.VerifyNumber + "&cainfo=" + miConfig.Cainfo
-
- }
-
- resp, requestErr := http.Get(api)
- if requestErr != nil {
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
-
- body, ioErr := ioutil.ReadAll(resp.Body)
-
- if ioErr != nil {
- utils.ErrorLog("接口返回数据读取失败: %v", ioErr)
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
-
- var respJSON map[string]interface{}
-
- if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
- utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
-
- respJSON = respJSON["data"].(map[string]interface{})["pre"].(map[string]interface{})
-
- result, _ := json.Marshal(respJSON)
-
- if err := json.Unmarshal([]byte(result), &resThree10265); err != nil {
- utils.ErrorLog("解析失败:%v", err)
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
-
- resThree.ErrMsg = resThree10265.ErrMsg
-
- resThree.Output = resThree10265.Output
-
- resThree.InfRefmsgid = resThree10265.InfRefmsgid
-
- infocode, _ = strconv.ParseInt(resThree10265.Infcode, 10, 64)
- } else {
- result, requestLog := service.Gdyb2201ForGz(res.Output[0].Baseinfo.PsnNo, insutype, IdCardNo, miConfig.OrgName, roles.UserName, ipt_otp_no, department.Name, miConfig.Code, department.Number, doctor_id, insuplc_admdvs_temp, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, id_card_type, doctor_info.UserName, record_time)
- saveLog(result, requestLog, "2201A", "挂号")
- if miConfig.Code == "H15049901371" {
-
- if err := json.Unmarshal([]byte(result), &resThree10265); err != nil {
- utils.ErrorLog("解析失败:%v", err)
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
- resThree.ErrMsg = resThree10265.ErrMsg
- resThree.Output = resThree10265.Output
- resThree.InfRefmsgid = resThree10265.InfRefmsgid
- } else {
- if err := json.Unmarshal([]byte(result), &resThree); err != nil {
- utils.ErrorLog("解析失败:%v", err)
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
- }
-
- if miConfig.Code == "H15049901371" {
- infocode, _ = strconv.ParseInt(resThree10265.Infcode, 10, 64)
- } else {
- infocode = resThree.Infcode
-
- }
-
- }
-
- if infocode != 0 {
-
- adminUser := c.GetAdminUserInfo()
- errlog := &models.HisOrderError{
- UserOrgId: adminUser.CurrentOrgId,
- Ctime: time.Now().Unix(),
- Mtime: time.Now().Unix(),
- ErrMsg: resThree.ErrMsg,
- Status: 1,
- PatientId: id,
- RecordTime: recordDateTime,
- Stage: 2,
- }
- service.CreateErrMsgLog(errlog)
- c.ServeSuccessJSON(map[string]interface{}{
- "failed_code": -10,
- "msg": resThree.ErrMsg,
- })
- return
- }
-
- his.Number = resThree.Output.Data.MdtrtID
- his.PsnNo = resThree.Output.Data.PsnNo
- his.IptOtpNo = resThree.Output.Data.IptOtpNo
- his.IdCardNo = patient.IdCardNo
- his.PhoneNumber = patient.Phone
- his.UserOrgId = adminInfo.CurrentOrgId
- his.Insutype = insutype
- his.Ctime = time.Now().Unix()
- his.Mtime = time.Now().Unix()
- his.InsuplcAdmdvs = insuplc_admdvs_temp
- his.Status = 1
- service.UpdateHisPatientStatus(&his)
- service.UpdateHisPrescriptionHisID(his.ID, patient.ID, recordDateTime, adminInfo.CurrentOrgId)
-
- c.ServeSuccessJSON(map[string]interface{}{
- "his_info": his,
- })
-
- } else {
- adminUser := c.GetAdminUserInfo()
- errlog := &models.HisOrderError{
- UserOrgId: adminUser.CurrentOrgId,
- Ctime: time.Now().Unix(),
- Mtime: time.Now().Unix(),
- ErrMsg: res.ErrMsg,
- Status: 1,
- PatientId: id,
- RecordTime: recordDateTime,
- Stage: 1,
- }
- service.CreateErrMsgLog(errlog)
-
- c.ServeSuccessJSON(map[string]interface{}{
- "failed_code": -10,
- "msg": res.ErrMsg,
- })
- return
-
- //c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeGdybOneException)
- }
- }
- }
-
- //上传明细----预结算----确认订单
- func (c *HisApiController) GetUploadInfo() {
- id, _ := c.GetInt64("id")
- record_time := c.GetString("record_time")
- his_patient_id, _ := c.GetInt64("his_patient_id")
-
- order_id, _ := c.GetInt64("order_id")
-
- pay_way, _ := c.GetInt64("pay_way")
- pay_price, _ := c.GetFloat("pay_price")
- pay_card_no := c.GetString("pay_card_no")
- token := c.GetString("token")
-
- discount_price, _ := c.GetFloat("discount_price")
- preferential_price, _ := c.GetFloat("preferential_price")
- reality_price, _ := c.GetFloat("reality_price")
- found_price, _ := c.GetFloat("found_price")
- medical_insurance_price, _ := c.GetFloat("medical_insurance_price")
- private_price, _ := c.GetFloat("private_price")
- settle_accounts_type, _ := c.GetInt64("settle_accounts_type")
- admin_user_id, _ := c.GetInt64("admin_user_id")
-
- fapiao_code := c.GetString("fapiao_code")
- fapiao_number := c.GetString("fapiao_number")
-
- diagnosis_id := c.GetString("diagnosis")
- sick_type, _ := c.GetInt64("sick_type")
- reg_type, _ := c.GetInt64("p_type")
- begin_time := c.GetString("begin_time")
-
- id_str := c.GetString("ids")
- ids_arr := strings.Split(id_str, ",")
-
- timeLayout := "2006-01-02"
- loc, _ := time.LoadLocation("Local")
- theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", record_time+" 00:00:00", loc)
- if err != nil {
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
- return
- }
- recordDateTime := theTime.Unix()
- adminUser := c.GetAdminUserInfo()
- var tempOrder models.HisOrder
- tempOrder, _ = service.GetHisOrderByID(order_id)
-
- var prescriptions []*models.HisPrescription
-
- var start_time int64
- var end_time int64
-
- //押金模块
- dec_way := c.GetString("dec_way") //是否使用押金支付bool类型
- tmp_decimal := c.GetString("tmp_decimal")
- var decimal float64 //本次使用的押金
- var errmsg error
-
- if dec_way == "true" && tmp_decimal == "0" || dec_way == "true" && tmp_decimal == "" {
- c.ServeFailJsonSend(enums.ErrorCodeParamWrong, "押金不能为0")
- return
- }
- if len(tmp_decimal) > 0 {
- if tmp_decimal[0] == 45 {
- c.ServeFailJsonSend(enums.ErrorCodeParamWrong, "押金不能为负数")
- return
- }
- }
- tt, errs := strconv.ParseFloat(tmp_decimal, 64)
- fmt.Println(errs)
- decimal = tt
-
- //if adminUser.CurrentOrgId == 10106{
- // if len(fapiao_code) == 0{
- // fapiao_code = "144072080589"
- // }
- // if len(fapiao_number) == 0{
- // order, _ := service.GetLastHisOrder(adminUser.CurrentOrgId)
- // if order.ID == 0{
- // fapiao_number = "00001520"
- // }else{
- // //fapiao_code = "00001520"
- // fpNumber, _ := strconv.Atoi(order.FaPiaoNumber)
- // var zero string
- // if fpNumber >= 1000{
- // zero = "0000" + strconv.Itoa(fpNumber)
- // }else if fpNumber >= 10000{
- // zero = "000" + strconv.Itoa(fpNumber)
- // } else if fpNumber >= 100000{
- // zero = "00" + strconv.Itoa(fpNumber)
- // } else if fpNumber >= 1000000{
- // zero = "0" + strconv.Itoa(fpNumber)
- // }else {
- // zero = strconv.Itoa(fpNumber)
- // }
- // fapiao_number = zero
- // }
- // }
- //}
-
- roles, _ := service.GetAdminUserInfoByID(adminUser.CurrentOrgId, admin_user_id)
- his, _ := service.GetNewHisPatientInfo(adminUser.CurrentOrgId, his_patient_id, recordDateTime)
- var patientPrescription models.HisPrescriptionInfo
- patientPrescription, _ = service.FindHisPatientPrescriptionInfo(adminUser.CurrentOrgId, his_patient_id, recordDateTime)
- if patientPrescription.ID == 0 {
- patientPrescription, _ = service.FindLastPatientPrescriptionInfo(adminUser.CurrentOrgId, id, recordDateTime)
- }
- miConfig, _ := service.FindMedicalInsuranceInfo(adminUser.CurrentOrgId)
- department, _ := service.GetDepartMentDetail(patientPrescription.Departments)
-
- doctor_info, _ := service.GetAdminUserInfoByID(adminUser.CurrentOrgId, patientPrescription.DoctorId)
-
- diagnosis_ids := strings.Split(diagnosis_id, ",")
-
- var config []*models.HisXtDiagnoseConfig
- for _, item := range diagnosis_ids {
- id, _ := strconv.ParseInt(item, 10, 64)
- diagnosisConfig, _ := service.FindDiagnoseById(id)
- config = append(config, &diagnosisConfig)
- }
-
- sickConfig, _ := service.FindSickById(sick_type)
-
- //if tempOrder.ID == 0 {
- // tempOrder, _ = service.GetTodayHisOrder(adminUser.CurrentOrgId, id, recordDateTime, his.Number)
- //}
-
- if tempOrder.ID == 0 {
- var result string
- var requestLog string
- var res2 ResultSix
- var ressix10265 ResultSix10265
-
- if miConfig.MdtrtareaAdmvs == "421300" {
-
- data := make(map[string]interface{})
- client := &http.Client{}
- data["psn_no"] = his.PsnNo
- data["mdtrt_id"] = his.Number
- data["doctor"] = roles.UserName
- data["department"] = department.Name
- data["org_name"] = miConfig.OrgName
- data["med_type"] = strconv.FormatInt(reg_type, 10)
- data["doctor_id"] = strconv.FormatInt(doctor_info.AdminUserId, 10)
- data["fixmedins_code"] = miConfig.Code
- data["insuplc_admdvs"] = his.InsuplcAdmdvs
- data["mdtrtarea_admvs"] = miConfig.MdtrtareaAdmvs
- data["secret_key"] = miConfig.SecretKey
- data["sick_code"] = sickConfig.CountryCode
- data["sick_name"] = sickConfig.ClassName
- data["dept"] = strconv.FormatInt(department.ID, 10)
- data["config"] = config
- data["begin_time"] = begin_time
-
- bytesData, _ := json.Marshal(data)
- req, _ := http.NewRequest("POST", "http://192.168.124.4:9532/"+"hbyb/2203", bytes.NewReader(bytesData))
- resp, _ := client.Do(req)
- defer resp.Body.Close()
- body, ioErr := ioutil.ReadAll(resp.Body)
- if ioErr != nil {
- utils.ErrorLog("接口返回数据读取失败: %v", ioErr)
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
- var respJSON map[string]interface{}
- if err := json.Unmarshal([]byte(body), &respJSON); err != nil {
- utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
-
- respJSON = respJSON["data"].(map[string]interface{})["pre"].(map[string]interface{})
- userJSONBytes, _ := json.Marshal(respJSON)
- fmt.Println("log")
- fmt.Println(string(userJSONBytes))
-
- if err := json.Unmarshal(userJSONBytes, &res2); err != nil {
- utils.ErrorLog("解析失败:%v", err)
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
-
- } else if miConfig.MdtrtareaAdmvs == "320921" || miConfig.MdtrtareaAdmvs == "320982" {
-
- //江苏地区国家医保医疗类别
- //职工透析:医疗类别选特殊情况门诊9933
- //居民血透门慢: 医疗类别选门诊慢病1402
- //var med_type string
- //if his.Insutype == "310" {
- // if reg_type == 14 {
- // med_type = "9933"
- // } else if reg_type == 11 {
- // med_type = "11"
- //
- // }
- //} else if his.Insutype == "390" {
- // if reg_type == 14 {
- // med_type = "1402"
- // } else if reg_type == 11 {
- // med_type = "11"
- // }
- //}
-
- data := make(map[string]interface{})
- client := &http.Client{}
- data["psn_no"] = his.PsnNo
- data["mdtrt_id"] = his.Number
- data["doctor"] = roles.UserName
- data["department"] = department.Name
- data["org_name"] = miConfig.OrgName
- data["med_type"] = strconv.FormatInt(reg_type, 10)
- data["doctor_id"] = strconv.FormatInt(doctor_info.AdminUserId, 10)
- data["fixmedins_code"] = miConfig.Code
- data["insuplc_admdvs"] = his.InsuplcAdmdvs
- data["mdtrtarea_admvs"] = miConfig.MdtrtareaAdmvs
- data["secret_key"] = miConfig.SecretKey
- data["sick_code"] = sickConfig.CountryCode
- data["sick_name"] = sickConfig.ClassName
- data["url"] = miConfig.Url
- data["ak"] = miConfig.AccessKey
- data["begin_time"] = begin_time
- data["cainfo"] = miConfig.Cainfo
-
- data["dept"] = strconv.FormatInt(department.ID, 10)
- data["config"] = config
- bytesData, _ := json.Marshal(data)
-
- var req *http.Request
- if miConfig.MdtrtareaAdmvs == "320921" {
- req, _ = http.NewRequest("POST", "http://192.168.3.111:9532/"+"jsyb/2203", bytes.NewReader(bytesData))
-
- //api = "http://192.168.3.111:9532/" + "jsyb/readcard?" + "fixmedins_code=" + miConfig.Code + "&secret_key=" + miConfig.SecretKey + "&ak=" + miConfig.AccessKey + "&org_name=" + miConfig.OrgName + "&doctor=" + roles.UserName +
- // "&insuplc_admdvs=" + miConfig.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey + "&url=" + miConfig.Url + "&cainfo=" + miConfig.Cainfo
-
- } else {
- req, _ = http.NewRequest("POST", "http://192.168.5.251:9532/"+"jsyb/2203", bytes.NewReader(bytesData))
-
- }
-
- resp, _ := client.Do(req)
- defer resp.Body.Close()
- body, ioErr := ioutil.ReadAll(resp.Body)
- if ioErr != nil {
- utils.ErrorLog("接口返回数据读取失败: %v", ioErr)
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
- var respJSON map[string]interface{}
- if err := json.Unmarshal([]byte(body), &respJSON); err != nil {
- utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
-
- respJSON = respJSON["data"].(map[string]interface{})["pre"].(map[string]interface{})
- userJSONBytes, _ := json.Marshal(respJSON)
- fmt.Println("log")
- fmt.Println(string(userJSONBytes))
-
- if err := json.Unmarshal(userJSONBytes, &ressix10265); err != nil {
- utils.ErrorLog("解析失败:%v", err)
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
- res2.InfRefmsgid = ressix10265.InfRefmsgid
- // res2.Output = ressix10265.Output
- res2.ErrMsg = ressix10265.ErrMsg
- res2.Cainfo = ressix10265.Cainfo
- res2.WarnMsg = ressix10265.WarnMsg
- infocode, _ := strconv.ParseInt(ressix10265.Infcode, 10, 64)
- res2.Infcode = infocode
-
- } else {
- if miConfig.MdtrtareaAdmvs == "440781" { //
- result, requestLog = service.Gdyb2203ForGz(his.PsnNo, his.Number, doctor_info.UserName, department.Name, miConfig.OrgName, strconv.FormatInt(reg_type, 10), doctor_info.DoctorNumber, miConfig.Code, his.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, sickConfig.ContentCode, sickConfig.ClassName, roles.UserName, config, begin_time)
- } else {
- if miConfig.Code == "H15049901371" {
- //赤峰地区国家医保医疗类别
- //职工透析:医疗类别选特殊情况门诊990502
- //居民定额血透门慢: 医疗类别选门诊慢病140104
- var med_type string
- if his.Insutype == "390" {
- if reg_type == 14 {
- med_type = "9933"
- } else if reg_type == 11 {
- med_type = "11"
-
- }
- } else if his.Insutype == "310" {
- if reg_type == 14 {
- med_type = "990502"
- } else if reg_type == 11 {
- med_type = "11"
- }
- }
- result, requestLog = service.Gdyb2203ForGz(his.PsnNo, his.Number, doctor_info.UserName, department.Name, miConfig.OrgName, med_type, doctor_info.DoctorNumber, miConfig.Code, his.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, sickConfig.ContentCode, sickConfig.ClassName, roles.UserName, config, begin_time)
-
- } else {
- var med_type string
-
- if reg_type == 14 {
- med_type = "141009"
- result, requestLog = service.Gdyb2203ForGz(his.PsnNo, his.Number, doctor_info.UserName, department.Name, miConfig.OrgName, med_type, doctor_info.DoctorNumber, miConfig.Code, his.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, sickConfig.ContentCode, sickConfig.ClassName, roles.UserName, config, begin_time)
-
- } else if reg_type == 11 {
- med_type = "11"
- // sickConfig.ClassName = sic
- // sickConfig.ContentCode = ""
- result, requestLog = service.Gdyb2203ForGz(his.PsnNo, his.Number, doctor_info.UserName, department.Name, miConfig.OrgName, med_type, doctor_info.DoctorNumber, miConfig.Code, his.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, sickConfig.ContentCode, "", roles.UserName, config, begin_time)
-
- }
-
- }
- }
-
- saveLog(result, requestLog, "2203", "上传就诊信息")
- var respJSON2 map[string]interface{}
- if err := json.Unmarshal([]byte(string(result)), &respJSON2); err != nil {
- utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
- userJSONBytes2, _ := json.Marshal(respJSON2)
- if miConfig.Code == "H15049901371" {
- if err := json.Unmarshal(userJSONBytes2, &ressix10265); err != nil {
- utils.ErrorLog("解析失败:%v", err)
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
- res2.InfRefmsgid = ressix10265.InfRefmsgid
- // res2.Output = ressix10265.Output
- res2.ErrMsg = ressix10265.ErrMsg
- res2.Cainfo = ressix10265.Cainfo
- res2.WarnMsg = ressix10265.WarnMsg
- infocode, _ := strconv.ParseInt(ressix10265.Infcode, 10, 64)
- res2.Infcode = infocode
- } else {
- if err := json.Unmarshal(userJSONBytes2, &res2); err != nil {
- utils.ErrorLog("解析失败:%v", err)
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
- }
- }
-
- if res2.Infcode != 0 {
- adminUser := c.GetAdminUserInfo()
- errlog := &models.HisOrderError{
- UserOrgId: adminUser.CurrentOrgId,
- Ctime: time.Now().Unix(),
- Mtime: time.Now().Unix(),
- ErrMsg: res2.ErrMsg,
- Status: 1,
- PatientId: id,
- RecordTime: recordDateTime,
- Stage: 3,
- }
- service.CreateErrMsgLog(errlog)
- c.ServeSuccessJSON(map[string]interface{}{
- "failed_code": -10,
- "msg": res2.ErrMsg,
- })
- return
-
- } else {
- his.Diagnosis = diagnosis_id
- his.SickType = sickConfig.ID
- //var p_type int64
- //if reg_type == 1111 || reg_type == 1112 {
- // p_type = 11
- //
- //}
- his.PType = fmt.Sprintf("%d", reg_type)
- service.UpdateHisPatientThree(&his)
-
- data := make(map[string]interface{})
- if settle_accounts_type == 1 { //日结
-
- if reg_type == 11 || reg_type == 1111 || reg_type == 1112 {
- prescriptions, _ = service.GetPrescriptionByIds(ids_arr, adminUser.CurrentOrgId)
- } else {
- prescriptions, _ = service.GetNewHisPrescription(adminUser.CurrentOrgId, his_patient_id, recordDateTime, strconv.Itoa(int(reg_type)))
- }
- //prescriptions, _ = service.GetNewHisPrescriptionTwo(adminUser.CurrentOrgId, his_patient_id, recordDateTime, reg_type)
- data["pre"] = prescriptions
-
- } else { //月结
- start_time_str := c.GetString("start_time")
- end_time_str := c.GetString("end_time")
- timeLayout := "2006-01-02"
- loc, _ := time.LoadLocation("Local")
- theStartTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time_str+" 00:00:00", loc)
- if err != nil {
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
- return
- }
- recordStartTime := theStartTime.Unix()
- start_time = recordStartTime
- theEndTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time_str+" 00:00:00", loc)
- if err != nil {
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
- return
- }
- recordEndTime := theEndTime.Unix()
- end_time = recordEndTime
- prescriptions, _ = service.GetMonthHisPrescriptionTwo(adminUser.CurrentOrgId, id, recordStartTime, recordEndTime, reg_type)
- data["pre"] = prescriptions
-
- }
-
- timestamp := time.Now().Unix()
- tempTime := time.Unix(timestamp, 0)
- timeFormat := tempTime.Format("20060102150405")
- chrgBchno := rand.Intn(100000) + 10000
- chrg_bchno := timeFormat + strconv.FormatInt(int64(chrgBchno), 10) + strconv.FormatInt(his.PatientId, 10)
- strconv.FormatInt(his.PatientId, 10)
- client := &http.Client{}
-
- data["psn_no"] = his.PsnNo
- data["mdtrt_id"] = his.Number
- data["chrg_bchno"] = chrg_bchno
- data["org_name"] = miConfig.OrgName
- data["doctor"] = roles.UserName
- data["doctor_id"] = strconv.FormatInt(roles.AdminUserId, 10)
- data["dept"] = strconv.FormatInt(patientPrescription.Departments, 10)
- data["fixmedins_code"] = miConfig.Code
- //if (department.ID == 0 && adminUser.CurrentOrgId == 9919) || (department.ID == 0 && adminUser.CurrentOrgId == 10106) {
- // data["dept_code"] = "15"
- //} else {
- data["dept_code"] = department.Number
- //}
- data["insuplc_admdvs"] = his.InsuplcAdmdvs
- data["mdtrtarea_admvs"] = miConfig.MdtrtareaAdmvs
- data["secret_key"] = miConfig.SecretKey
- data["balance_accounts_type"] = strconv.FormatInt(his.BalanceAccountsType, 10)
- data["url"] = miConfig.Url
- data["ak"] = miConfig.AccessKey
- data["new_doctor_name"] = patientPrescription.Doctor
- data["diag_code"] = sickConfig.CountryCode
- data["cainfo"] = miConfig.Cainfo
-
- var ids []int64
-
- for _, item := range prescriptions {
- ids = append(ids, item.ID)
- }
- config, _ := service.GetMedicalInsuranceConfig(adminUser.CurrentOrgId)
- if config.IsOpen == 1 { //对接了医保,走医保流程
- var res ResultFour
- var resFour10265 ResultFour10265
-
- if miConfig.MdtrtareaAdmvs == "421300" {
-
- bytesData, _ := json.Marshal(data)
- req, _ := http.NewRequest("POST", "http://192.168.124.4:9532/"+"hbyb/2204", bytes.NewReader(bytesData))
- resp, _ := client.Do(req)
- defer resp.Body.Close()
- body, ioErr := ioutil.ReadAll(resp.Body)
- if ioErr != nil {
- utils.ErrorLog("接口返回数据读取失败: %v", ioErr)
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
- var respJSON map[string]interface{}
- if err := json.Unmarshal([]byte(body), &respJSON); err != nil {
- utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
-
- respJSON = respJSON["data"].(map[string]interface{})["pre"].(map[string]interface{})
- userJSONBytes, _ := json.Marshal(respJSON)
- fmt.Println("log")
- fmt.Println(string(userJSONBytes))
- if err := json.Unmarshal(userJSONBytes, &res); err != nil {
- utils.ErrorLog("解析失败:%v", err)
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
-
- } else if miConfig.MdtrtareaAdmvs == "320921" || miConfig.MdtrtareaAdmvs == "320982" {
- bytesData, _ := json.Marshal(data)
-
- var req *http.Request
- if miConfig.MdtrtareaAdmvs == "320921" {
- req, _ = http.NewRequest("POST", "http://192.168.3.111:9532/"+"jsyb/2204", bytes.NewReader(bytesData))
-
- } else {
- req, _ = http.NewRequest("POST", "http://192.168.5.251:9532/"+"jsyb/2204", bytes.NewReader(bytesData))
- }
-
- resp, _ := client.Do(req)
- defer resp.Body.Close()
- body, ioErr := ioutil.ReadAll(resp.Body)
- if ioErr != nil {
- utils.ErrorLog("接口返回数据读取失败: %v", ioErr)
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
- var respJSON map[string]interface{}
- if err := json.Unmarshal([]byte(body), &respJSON); err != nil {
- utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
-
- respJSON = respJSON["data"].(map[string]interface{})["pre"].(map[string]interface{})
- userJSONBytes, _ := json.Marshal(respJSON)
- fmt.Println("log")
- fmt.Println(string(userJSONBytes))
- if err := json.Unmarshal(userJSONBytes, &resFour10265); err != nil {
- utils.ErrorLog("解析失败:%v", err)
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
- res.InfRefmsgid = resFour10265.InfRefmsgid
- res.Output = resFour10265.Output
- res.ErrMsg = resFour10265.ErrMsg
- res.Cainfo = resFour10265.Cainfo
- res.WarnMsg = resFour10265.WarnMsg
- infocode, _ := strconv.ParseInt(resFour10265.Infcode, 10, 64)
- res.Infcode = infocode
-
- } else {
-
- if miConfig.Code == "H15049901371" {
- result, request_log := service.Gdyb2204(his.PsnNo, his.Number, prescriptions, chrg_bchno, miConfig.OrgName, roles.UserName, strconv.FormatInt(patientPrescription.Departments, 10), miConfig.Code, department.Number, strconv.FormatInt(roles.AdminUserId, 10), his.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, strconv.FormatInt(his.BalanceAccountsType, 10), patientPrescription.DoctorId, sickConfig.CountryCode)
- var dat map[string]interface{}
- if err := json.Unmarshal([]byte(result), &dat); err == nil {
- fmt.Println(dat)
- } else {
- fmt.Println(err)
- }
- saveLog(result, request_log, "2204", "上传费用明细")
- userJSONBytes, _ := json.Marshal(dat)
-
- if err := json.Unmarshal(userJSONBytes, &resFour10265); err != nil {
- utils.ErrorLog("解析失败:%v", err)
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
-
- res.InfRefmsgid = resFour10265.InfRefmsgid
- res.Output = resFour10265.Output
- res.ErrMsg = resFour10265.ErrMsg
- res.Cainfo = resFour10265.Cainfo
- res.WarnMsg = resFour10265.WarnMsg
- infocode, _ := strconv.ParseInt(resFour10265.Infcode, 10, 64)
- res.Infcode = infocode
-
- } else {
- result, request_log := service.Gdyb2204(his.PsnNo, his.Number, prescriptions, chrg_bchno, miConfig.OrgName, roles.UserName, strconv.FormatInt(patientPrescription.Departments, 10), miConfig.Code, department.Number, strconv.FormatInt(roles.AdminUserId, 10), his.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, strconv.FormatInt(his.BalanceAccountsType, 10), patientPrescription.DoctorId, sickConfig.CountryCode)
- var dat map[string]interface{}
- if err := json.Unmarshal([]byte(result), &dat); err == nil {
- fmt.Println(dat)
- } else {
- fmt.Println(err)
- }
- saveLog(result, request_log, "2204", "上传费用明细")
- userJSONBytes, _ := json.Marshal(dat)
-
- if err := json.Unmarshal(userJSONBytes, &res); err != nil {
- utils.ErrorLog("解析失败:%v", err)
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
-
- }
-
- }
-
- if res.Infcode == 0 {
- order := &models.HisOrder{
- UserOrgId: adminUser.CurrentOrgId,
- HisPatientId: his.ID,
- PatientId: his.PatientId,
- SettleAccountsDate: recordDateTime,
- MdtrtId: his.Number,
- PsnNo: his.PsnNo,
- MedType: strconv.FormatInt(reg_type, 10),
- Ctime: time.Now().Unix(),
- Mtime: time.Now().Unix(),
- Status: 1,
- Number: chrg_bchno,
- Infcode: res.Infcode,
- WarnMsg: res.WarnMsg,
- Cainfo: res.Cainfo,
- ErrMsg: res.ErrMsg,
- RespondTime: res.RefmsgTime,
- InfRefmsgid: res.InfRefmsgid,
- OrderStatus: 1,
- PayWay: pay_way,
- PayPrice: pay_price,
- PayCardNo: pay_card_no,
- DiscountPrice: discount_price,
- PreferentialPrice: preferential_price,
- RealityPrice: reality_price,
- FoundPrice: found_price,
- MedicalInsurancePrice: medical_insurance_price,
- PrivatePrice: private_price,
- IsMedicineInsurance: 1,
- SettleType: settle_accounts_type,
- SettleStartTime: start_time,
- SettleEndTime: end_time,
- Creator: roles.AdminUserId,
- Modify: roles.AdminUserId,
- FaPiaoNumber: fapiao_number,
- FaPiaoCode: fapiao_code,
- PType: 2,
- Diagnosis: diagnosis_id,
- }
- err = service.CreateOrder(order)
- if err != nil {
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCreatePreOrderException)
- return
- }
-
- for _, item := range res.Output.Result {
- temp := strings.Split(item.FeedetlSn, "-")
- var advice_id int64 = 0
- var project_id int64 = 0
- var types int64 = 0
-
- id, _ := strconv.ParseInt(temp[2], 10, 64)
- types, _ = strconv.ParseInt(temp[1], 10, 64)
-
- if temp[1] == "1" {
- advice_id = id
- project_id = 0
- } else if temp[1] == "2" {
- advice_id = 0
- project_id = id
- }
-
- info := &models.HisOrderInfo{
- OrderNumber: order.Number,
- FeedetlSn: item.FeedetlSn,
- UploadDate: time.Now().Unix(),
- AdviceId: advice_id,
- DetItemFeeSumamt: item.DetItemFeeSumamt,
- Cnt: item.Cnt,
- Pric: float64(item.Pric),
- PatientId: his.PatientId,
- PricUplmtAmt: item.PricUplmtAmt,
- SelfpayProp: item.SelfpayProp,
- FulamtOwnpayAmt: item.FulamtOwnpayAmt,
- OverlmtAmt: item.OverlmtAmt,
- PreselfpayAmt: item.PreselfpayAmt,
- BasMednFlag: item.BasMednFlag,
- MedChrgitmType: item.MedChrgitmType,
- HiNegoDrugFlag: item.HiNegoDrugFlag,
- Status: 1,
- Memo: item.Memo,
- Mtime: time.Now().Unix(),
- InscpScpAmt: item.InscpScpAmt,
- DrtReimFlag: item.DrtReimFlag,
- Ctime: time.Now().Unix(),
- ListSpItemFlag: item.ListSpItemFlag,
- ChldMedcFlag: item.ChldMedcFlag,
- LmtUsedFlag: item.LmtUsedFlag,
- ChrgitmLv: item.ChrgitmLv,
- UserOrgId: adminUser.CurrentOrgId,
- HisPatientId: his.ID,
- OrderId: order.ID,
- ProjectId: project_id,
- Type: types,
- }
- service.CreateOrderInfo(info)
-
- }
- service.UpDatePrescriptionNumber(adminUser.CurrentOrgId, ids, chrg_bchno)
- service.UpDateHisPrescriptionInfoNumber(adminUser.CurrentOrgId, his_patient_id, chrg_bchno, recordDateTime)
-
- var total float64
- for _, item := range prescriptions {
- if item.Type == 1 { //药品
- for _, subItem := range item.HisDoctorAdviceInfo {
- total = total + (subItem.Price * subItem.PrescribingNumber)
- }
- }
- if item.Type == 2 { //项目
- for _, subItem := range item.HisPrescriptionProject {
- cnt, _ := strconv.ParseFloat(subItem.Count, 64)
-
- total = total + (subItem.Price * cnt)
- }
- }
- }
-
- for _, item := range prescriptions {
- for _, subItem := range item.HisAdditionalCharge {
- total = total + (subItem.Price * float64(subItem.Count))
- }
- }
- var allTotal string
- if adminUser.CurrentOrgId == 9919 {
-
- allTotal = fmt.Sprintf("%.4f", total)
-
- } else {
-
- allTotal = fmt.Sprintf("%.4f", total)
-
- }
-
- if res.Infcode == 0 {
- var rf []*ResultFive
- json.Unmarshal([]byte(his.Iinfo), &rf)
- chrg_bchno := chrg_bchno
- cert_no := his.Certno
-
- var insutypes []string
-
- var insutype string
- var is390 int = 0
- var is310 int = 0
-
- for _, item := range rf {
- if (item.Insutype == "390" && item.PsnInsuStas == "1") || (item.Insutype == "310" && item.PsnInsuStas == "1") {
- insutypes = append(insutypes, item.Insutype)
- }
- }
-
- if len(insutypes) == 1 {
- insutype = insutypes[0]
- } else {
- for _, i := range insutypes {
- if i == "390" {
- is390 = 1
- }
-
- if i == "310" {
- is310 = 1
- }
- }
- }
- if is390 == 1 {
- insutype = "390"
- }
-
- if is310 == 1 {
- insutype = "310"
- }
-
- if len(insutypes) == 0 {
- insutype = "310"
- }
-
- if len(insutypes) == 2 {
- insutype = strconv.FormatInt(his.SocialType, 10)
- }
-
- insutype = strconv.FormatInt(his.SocialType, 10)
- //insutype = "390"
- if his.IdCardType == 1 {
- // cert_no = his.MedicalInsuranceNumber
- cert_no = his.Certno
-
- } else {
-
- cert_no = his.Certno
-
- }
- var res models.GZResult2207
- var resSeven10265 ResultSeven10265
-
- var src_resquest string
- var result2 string
- var acct_used_flag string
- fmt.Println("pay_way")
- fmt.Println(pay_way)
- fmt.Println("pay_way")
-
- if pay_way == 5 {
- acct_used_flag = "1"
- } else {
- acct_used_flag = "0"
- }
- if miConfig.MdtrtareaAdmvs == "421300" {
-
- api := "http://192.168.124.4:9532/" + "hbyb/2207?psn_no=" + his.PsnNo + "&mdtrt_id=" +
- his.Number + "&chrg_bchno=" + chrg_bchno + "&org_name=" + miConfig.OrgName +
- "&doctor=" + roles.UserName + "&fixmedins_code=" + miConfig.Code +
- "&insuplc_admdvs=" + his.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs +
- "&secret_key=" + miConfig.SecretKey + "&id_card_type=" + strconv.FormatInt(his.IdCardType, 10) +
- "&certificates=" + strconv.FormatInt(his.IdType, 10) + "&cert_no=" + cert_no +
- "&insutype=" + insutype + "&total=" + allTotal + "&med_type=" + strconv.FormatInt(reg_type, 10) + "&acct_used_flag=" + acct_used_flag
-
- resp, requestErr := http.Get(api)
- if requestErr != nil {
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
-
- body, ioErr := ioutil.ReadAll(resp.Body)
- if ioErr != nil {
- utils.ErrorLog("接口返回数据读取失败: %v", ioErr)
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
- var respJSON map[string]interface{}
- if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
- utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
-
- respJSON = respJSON["data"].(map[string]interface{})["pre"].(map[string]interface{})
- result, _ := json.Marshal(respJSON)
-
- if miConfig.Code == "H15049901371" {
- if err := json.Unmarshal([]byte(result), &resSeven10265); err != nil {
- utils.ErrorLog("解析失败:%v", err)
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
-
- res.InfRefmsgid = resSeven10265.InfRefmsgid
- // res.Output = resSeven10265.Output
- res.ErrMsg = resSeven10265.ErrMsg
- res.Cainfo = resSeven10265.Cainfo
- // res.WarnMsg = resSeven10265.WarnMsg
- // infocode, _ := strconv.ParseInt(resSeven10265.Infcode, 10, 64)
- // res.Infcode = infocode
-
- } else {
-
- if err := json.Unmarshal([]byte(result), &res); err != nil {
- utils.ErrorLog("解析失败:%v", err)
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
-
- }
-
- } else if miConfig.MdtrtareaAdmvs == "320921" || miConfig.MdtrtareaAdmvs == "320982" {
- psn_info, _ := service.GetPsnByPatientId(his.PatientId)
- psn_info.VerifyNumber = strings.Replace(psn_info.VerifyNumber, "+", "%2B", -1)
- bas := strings.Split(psn_info.CardInfo, "|")
- if his.IdCardType == 1 {
- cert_no = bas[2]
- } else if his.IdCardType == 3 {
- cert_no = his.Certno
- psn_info.VerifyNumber = his.Certno + "|" + psn_info.VerifyNumber
- } else if his.IdCardType == 4 {
- cert_no = his.Certno
- psn_info.VerifyNumber = token
- }
- var api string
- if miConfig.MdtrtareaAdmvs == "320921" {
- api = "http://192.168.3.111:9532/" + "jsyb/2207?psn_no=" + his.PsnNo + "&mdtrt_id=" +
- his.Number + "&chrg_bchno=" + chrg_bchno + "&org_name=" + miConfig.OrgName +
- "&doctor=" + roles.UserName + "&fixmedins_code=" + miConfig.Code +
- "&insuplc_admdvs=" + his.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs +
- "&secret_key=" + miConfig.SecretKey + "&id_card_type=" + strconv.FormatInt(his.IdCardType, 10) +
- "&certificates=" + strconv.FormatInt(his.IdType, 10) + "&cert_no=" + cert_no +
- "&insutype=" + insutype + "&total=" + allTotal + "&med_type=" + strconv.FormatInt(reg_type, 10) + "&acct_used_flag=" + acct_used_flag + "&url=" + miConfig.Url + "&ak=" + miConfig.AccessKey + "&verify_number=" + psn_info.VerifyNumber + "&cainfo=" + miConfig.Cainfo
- } else {
- api = "http://192.168.5.251:9532/" + "jsyb/2207?psn_no=" + his.PsnNo + "&mdtrt_id=" +
- his.Number + "&chrg_bchno=" + chrg_bchno + "&org_name=" + miConfig.OrgName +
- "&doctor=" + roles.UserName + "&fixmedins_code=" + miConfig.Code +
- "&insuplc_admdvs=" + his.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs +
- "&secret_key=" + miConfig.SecretKey + "&id_card_type=" + strconv.FormatInt(his.IdCardType, 10) +
- "&certificates=" + strconv.FormatInt(his.IdType, 10) + "&cert_no=" + cert_no +
- "&insutype=" + insutype + "&total=" + allTotal + "&med_type=" + strconv.FormatInt(reg_type, 10) + "&acct_used_flag=" + acct_used_flag + "&url=" + miConfig.Url + "&ak=" + miConfig.AccessKey + "&verify_number=" + psn_info.VerifyNumber + "&cainfo=" + miConfig.Cainfo
-
- }
-
- resp, requestErr := http.Get(api)
- if requestErr != nil {
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
- body, ioErr := ioutil.ReadAll(resp.Body)
- if ioErr != nil {
- utils.ErrorLog("接口返回数据读取失败: %v", ioErr)
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
- var respJSON map[string]interface{}
- if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
- utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
-
- respJSON = respJSON["data"].(map[string]interface{})["pre"].(map[string]interface{})
- result, _ := json.Marshal(respJSON)
-
- if err := json.Unmarshal([]byte(result), &resSeven10265); err != nil {
- utils.ErrorLog("解析失败:%v", err)
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
-
- res.InfRefmsgid = resSeven10265.InfRefmsgid
- // res.Output = resSeven10265.Output
- res.ErrMsg = resSeven10265.ErrMsg
- res.Cainfo = resSeven10265.Cainfo
- // res.WarnMsg = resSeven10265.WarnMsg
- // infocode, _ := strconv.ParseInt(resSeven10265.Infcode, 10, 64)
- // res.Infcode = infocode
-
- } else {
- if miConfig.Code == "H15049901371" {
- //赤峰地区国家医保医疗类别
- //职工透析:医疗类别选特殊情况门诊990502
- //居民定额血透门慢: 医疗类别选门诊慢病140104
- var med_type string
- if his.Insutype == "390" {
- if reg_type == 14 {
- med_type = "9933"
- } else if reg_type == 11 {
- med_type = "11"
- }
- } else if his.Insutype == "310" {
- if reg_type == 14 {
- med_type = "990502"
- } else if reg_type == 11 {
- med_type = "11"
- }
- }
- result2, src_resquest = service.Gdyb2207(his.PsnNo, his.Number, chrg_bchno, cert_no, insutype, allTotal, miConfig.OrgName, roles.UserName, miConfig.Code, his.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, med_type, his.IdCardType, tempOrder.FulamtOwnpayAmt, tempOrder.OverlmtSelfPay, tempOrder.PreselfpayAmt, tempOrder.InscpScpAmt, his.IdType, acct_used_flag)
- } else {
- var med_type string
- if reg_type == 14 {
- med_type = "141009"
- } else if reg_type == 11 {
- med_type = "11"
- }
- result2, src_resquest = service.Gdyb2207(his.PsnNo, his.Number, chrg_bchno, cert_no, insutype, allTotal, miConfig.OrgName, roles.UserName, miConfig.Code, his.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, med_type, his.IdCardType, tempOrder.FulamtOwnpayAmt, tempOrder.OverlmtSelfPay, tempOrder.PreselfpayAmt, tempOrder.InscpScpAmt, his.IdType, acct_used_flag)
- }
-
- //result2, src_resquest = service.Gdyb2207(his.PsnNo, his.Number, chrg_bchno, cert_no, insutype, allTotal, miConfig.OrgName, roles.UserName, miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, strconv.FormatInt(reg_type, 10), his.IdCardType, 0, 0, 0, 0, his.IdType, acct_used_flag)
- var dat map[string]interface{}
- if err := json.Unmarshal([]byte(result2), &dat); err == nil {
- fmt.Println(dat)
- } else {
- fmt.Println(err)
- }
-
- saveLog(result2, src_resquest, "2207", "结算")
-
- userJSONBytes, _ := json.Marshal(dat)
- if miConfig.Code == "H15049901371" {
-
- if err := json.Unmarshal(userJSONBytes, &resSeven10265); err != nil {
- utils.ErrorLog("解析失败:%v", err)
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
-
- res.InfRefmsgid = resSeven10265.InfRefmsgid
- // res.Output = resSeven10265.Output
- res.ErrMsg = resSeven10265.ErrMsg
- res.Cainfo = resSeven10265.Cainfo
- // res.WarnMsg = resSeven10265.WarnMsg
- // infocode, _ := strconv.ParseInt(resSeven10265.Infcode, 10, 64)
- // res.Infcode = infocode
-
- } else {
-
- if err := json.Unmarshal(userJSONBytes, &res); err != nil {
- utils.ErrorLog("解析失败:%v", err)
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
-
- }
-
- }
-
- if res.Infcode != 0 {
- errlog := &models.HisOrderError{
- UserOrgId: adminUser.CurrentOrgId,
- Ctime: time.Now().Unix(),
- Mtime: time.Now().Unix(),
- Number: chrg_bchno,
- ErrMsg: res.ErrMsg,
- Status: 1,
- PatientId: id,
- RecordTime: recordDateTime,
- Stage: 6,
- }
- service.CreateErrMsgLog(errlog)
- c.ServeSuccessJSON(map[string]interface{}{
- "failed_code": -10,
- "msg": res.ErrMsg,
- })
- return
- } else {
- order, _ := service.GetHisOrderTwo(adminUser.CurrentOrgId, chrg_bchno, id)
- order.OrderStatus = 2
- order.Status = 1
- order.MdtrtId = res.Output.Setlinfo.MdtrtID
- order.SetlId = res.Output.Setlinfo.SetlID
- order.PsnNo = res.Output.Setlinfo.PsnNo
- order.PsnName = res.Output.Setlinfo.PsnName
- order.PsnCertType = res.Output.Setlinfo.PsnCertType
- order.Certno = res.Output.Setlinfo.Certno
- order.Gend = res.Output.Setlinfo.Gend
- order.Naty = res.Output.Setlinfo.Naty
- order.Age = res.Output.Setlinfo.Age
- order.Insutype = res.Output.Setlinfo.Insutype
- order.PsnType = res.Output.Setlinfo.PsnType
- order.CvlservFlag = res.Output.Setlinfo.CvlservFlag
- order.SetlTime = res.Output.Setlinfo.SetlTime
- order.MdtrtCertType = res.Output.Setlinfo.MdtrtCertType
- if res.Output.Setlinfo.MedType == "140101" {
- order.MedType = "14"
-
- } else {
- order.MedType = res.Output.Setlinfo.MedType
- }
- if reg_type == 1112 {
- order.MedType = "1112"
- }
- if reg_type == 1111 {
- order.MedType = "1111"
- }
- order.MedfeeSumamt = res.Output.Setlinfo.MedfeeSumamt
- order.FulamtOwnpayAmt = res.Output.Setlinfo.FulamtOwnpayAmt
- order.OverlmtSelfPay = res.Output.Setlinfo.OverlmtSelfpay
- order.PreselfpayAmt = res.Output.Setlinfo.PreselfpayAmt
- order.InscpScpAmt = res.Output.Setlinfo.InscpScpAmt
- order.ActPayDedc = res.Output.Setlinfo.ActPayDedc
- order.HifpPay = res.Output.Setlinfo.HifpPay
- order.CvlservPay = res.Output.Setlinfo.CvlservPay
- // order.PoolPropSelfpay = res.Output.Setlinfo.PoolPropSelfpay
- order.HifesPay = res.Output.Setlinfo.HifesPay
- order.HifobPay = res.Output.Setlinfo.HifobPay
- order.MafPay = res.Output.Setlinfo.MafPay
- order.HifmiPay = res.Output.Setlinfo.HifmiPay
- order.OthPay = res.Output.Setlinfo.OthPay
- order.FundPaySumamt = res.Output.Setlinfo.FundPaySumamt
- // order.PsnPartAmt = res.Output.Setlinfo.PsnPartAmt
- order.AcctPay = res.Output.Setlinfo.AcctPay
- order.PsnCashPay = res.Output.Setlinfo.PsnCashPay
- order.HospPartAmt = res.Output.Setlinfo.HospPartAmt
- order.Balc = res.Output.Setlinfo.Balc
- order.AcctMulaidPay = res.Output.Setlinfo.AcctMulaidPay
- order.MedinsSetlId = res.Output.Setlinfo.MedinsSetlID
- order.ClrOptins = res.Output.Setlinfo.ClrOptins
- order.ClrType = res.Output.Setlinfo.ClrType
- order.ClrWay = res.Output.Setlinfo.ClrWay
- order.Creator = order.Creator
- order.Modify = roles.AdminUserId
- order.RequestLog = src_resquest
- setlDetail, _ := json.Marshal(res.Output.Setldetail)
- detailStr := string(setlDetail)
- order.SetlDetail = detailStr
- err := service.UpdataOrderStatusTwo(chrg_bchno, adminUser.CurrentOrgId)
- err = service.UpDateOrder(order)
- if err == nil {
- //判断是否使用了押金
- if dec_way == "true" {
- tmpstring := strconv.FormatInt(order.ID, 10)
- order.Decimal = decimal
- service.UpDateOrder(order)
- //扣押金
- errmsg = service.SpendDeposit(c.GetAdminUserInfo().CurrentOrgId, id, c.GetAdminUserInfo().AdminUser.Id, tmpstring, decimal)
- if errmsg != nil {
- c.ServeFailJsonSend(enums.ErrorCodeParamWrong, errmsg.Error())
- return
- }
- }
-
- c.ServeSuccessJSON(map[string]interface{}{
- "msg": "结算成功",
- })
- } else {
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeAmountAccountException)
- return
- }
- }
- } else {
- adminUser := c.GetAdminUserInfo()
- errlog := &models.HisOrderError{
- UserOrgId: adminUser.CurrentOrgId,
- Ctime: time.Now().Unix(),
- Mtime: time.Now().Unix(),
- ErrMsg: res.ErrMsg,
- Status: 1,
- PatientId: id,
- RecordTime: recordDateTime,
- Stage: 4,
- }
- service.CreateErrMsgLog(errlog)
-
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeRegisterRepeatException)
- return
- }
- } else {
- adminUser := c.GetAdminUserInfo()
- errlog := &models.HisOrderError{
- UserOrgId: adminUser.CurrentOrgId,
- Ctime: time.Now().Unix(),
- Mtime: time.Now().Unix(),
- ErrMsg: res.ErrMsg,
- Status: 1,
- PatientId: id,
- RecordTime: recordDateTime,
- Stage: 4,
- }
- service.CreateErrMsgLog(errlog)
- c.ServeSuccessJSON(map[string]interface{}{
- "failed_code": -10,
- "msg": res.ErrMsg,
- })
- return
- //c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCalOrderException)
- //return
- }
- }
-
- }
-
- } else if tempOrder.ID > 0 {
- if tempOrder.IsPre == 1 {
- allTotal := fmt.Sprintf("%.4f", tempOrder.MedfeeSumamt)
- var rf []*ResultFive
- json.Unmarshal([]byte(his.Iinfo), &rf)
- chrg_bchno := tempOrder.Number
- cert_no := his.Certno
-
- var insutypes []string
-
- var insutype string
- var is390 int = 0
- var is310 int = 0
-
- for _, item := range rf {
- if (item.Insutype == "390" && item.PsnInsuStas == "1") || (item.Insutype == "310" && item.PsnInsuStas == "1") {
- insutypes = append(insutypes, item.Insutype)
- }
- }
-
- if len(insutypes) == 1 {
- insutype = insutypes[0]
- } else {
- for _, i := range insutypes {
- if i == "390" {
- is390 = 1
- }
-
- if i == "310" {
- is310 = 1
- }
- }
- }
- if is390 == 1 {
- insutype = "390"
- }
-
- if is310 == 1 {
- insutype = "310"
- }
-
- if len(insutypes) == 0 {
- insutype = "310"
- }
-
- if len(insutypes) == 2 {
- insutype = strconv.FormatInt(his.SocialType, 64)
- }
-
- //insutype = "390"
- if his.IdCardType == 1 {
- // cert_no = his.MedicalInsuranceNumber
- cert_no = his.Certno
-
- } else {
-
- cert_no = his.Certno
-
- }
- var res ResultSeven
- var resSeven10265 ResultSeven10265
- var src_resquest string
- var result2 string
- var acct_used_flag string
- fmt.Println("pay_way")
- fmt.Println(pay_way)
- fmt.Println("pay_way")
- if pay_way == 5 {
- acct_used_flag = "1"
- } else {
- acct_used_flag = "0"
- }
-
- if miConfig.MdtrtareaAdmvs == "421300" {
- api := "http://192.168.124.4:9532/" + "hbyb/2207?psn_no=" + his.PsnNo + "&mdtrt_id=" +
- his.Number + "&chrg_bchno=" + chrg_bchno + "&org_name=" + miConfig.OrgName +
- "&doctor=" + roles.UserName + "&fixmedins_code=" + miConfig.Code +
- "&insuplc_admdvs=" + his.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs +
- "&secret_key=" + miConfig.SecretKey + "&id_card_type=" + strconv.FormatInt(his.IdCardType, 10) +
- "&certificates=" + strconv.FormatInt(his.IdType, 10) + "&cert_no=" + cert_no +
- "&insutype=" + insutype + "&total=" + allTotal + "&med_type=" + strconv.FormatInt(reg_type, 10) + "&acct_used_flag=" + acct_used_flag
-
- resp, requestErr := http.Get(api)
- if requestErr != nil {
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
-
- body, ioErr := ioutil.ReadAll(resp.Body)
- if ioErr != nil {
- utils.ErrorLog("接口返回数据读取失败: %v", ioErr)
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
- var respJSON map[string]interface{}
- if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
- utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
-
- respJSON = respJSON["data"].(map[string]interface{})["pre"].(map[string]interface{})
- result, _ := json.Marshal(respJSON)
- fmt.Println("log")
- fmt.Println(string(result))
- if err := json.Unmarshal([]byte(result), &res); err != nil {
- utils.ErrorLog("解析失败:%v", err)
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
-
- } else if miConfig.MdtrtareaAdmvs == "320921" || miConfig.MdtrtareaAdmvs == "320982" {
- psn_info, _ := service.GetPsnByPatientId(his.PatientId)
- psn_info.VerifyNumber = strings.Replace(psn_info.VerifyNumber, "+", "%2B", -1)
-
- //psn_info, _ := service.GetPsnByPatientId(id)
- bas := strings.Split(psn_info.CardInfo, "|")
-
- if his.IdCardType == 1 {
- cert_no = bas[2]
- } else {
- cert_no = bas[1]
- }
-
- //江苏地区国家医保医疗类别
- //职工透析:医疗类别选特殊情况门诊9933
- //居民血透门慢: 医疗类别选门诊慢病1402
- //var med_type string
- //if his.Insutype == "310" {
- // if reg_type == 14 {
- // med_type = "9933"
- // } else if reg_type == 11 {
- // med_type = "11"
- //
- // }
- //} else if his.Insutype == "390" {
- // if reg_type == 14 {
- // med_type = "1402"
- // } else if reg_type == 11 {
- // med_type = "11"
- // }
- //}
-
- var api string
- if miConfig.MdtrtareaAdmvs == "320921" {
- api = "http://192.168.3.111:9532/" + "jsyb/2207?psn_no=" + his.PsnNo + "&mdtrt_id=" +
- his.Number + "&chrg_bchno=" + chrg_bchno + "&org_name=" + miConfig.OrgName +
- "&doctor=" + roles.UserName + "&fixmedins_code=" + miConfig.Code +
- "&insuplc_admdvs=" + his.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs +
- "&secret_key=" + miConfig.SecretKey + "&id_card_type=" + strconv.FormatInt(his.IdCardType, 10) +
- "&certificates=" + strconv.FormatInt(his.IdType, 10) + "&cert_no=" + cert_no +
- "&insutype=" + insutype + "&total=" + allTotal + "&med_type=" + tempOrder.MedType + "&acct_used_flag=" + acct_used_flag + "&url=" + miConfig.Url + "&ak=" + miConfig.AccessKey + "&verify_number=" + psn_info.VerifyNumber + "&cainfo=" + miConfig.Cainfo
-
- //req, _ = http.NewRequest("POST", "http://192.168.3.111:9532/"+"jsyb/2204", bytes.NewReader(bytesData))
-
- } else {
- //req, _ = http.NewRequest("POST", "http://192.168.5.251:9532/"+"jsyb/2204", bytes.NewReader(bytesData))
- api = "http://192.168.5.251:9532/" + "jsyb/2207?psn_no=" + his.PsnNo + "&mdtrt_id=" +
- his.Number + "&chrg_bchno=" + chrg_bchno + "&org_name=" + miConfig.OrgName +
- "&doctor=" + roles.UserName + "&fixmedins_code=" + miConfig.Code +
- "&insuplc_admdvs=" + his.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs +
- "&secret_key=" + miConfig.SecretKey + "&id_card_type=" + strconv.FormatInt(his.IdCardType, 10) +
- "&certificates=" + strconv.FormatInt(his.IdType, 10) + "&cert_no=" + cert_no +
- "&insutype=" + insutype + "&total=" + allTotal + "&med_type=" + tempOrder.MedType + "&acct_used_flag=" + acct_used_flag + "&url=" + miConfig.Url + "&ak=" + miConfig.AccessKey + "&verify_number=" + psn_info.VerifyNumber + "&cainfo=" + miConfig.Cainfo
-
- }
-
- resp, requestErr := http.Get(api)
- if requestErr != nil {
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
-
- body, ioErr := ioutil.ReadAll(resp.Body)
- if ioErr != nil {
- utils.ErrorLog("接口返回数据读取失败: %v", ioErr)
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
- var respJSON map[string]interface{}
- if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
- utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
-
- respJSON = respJSON["data"].(map[string]interface{})["pre"].(map[string]interface{})
- result, _ := json.Marshal(respJSON)
- fmt.Println("log")
- fmt.Println(string(result))
- if err := json.Unmarshal([]byte(result), &resSeven10265); err != nil {
- utils.ErrorLog("解析失败:%v", err)
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
-
- res.InfRefmsgid = resSeven10265.InfRefmsgid
- res.Output = resSeven10265.Output
- res.ErrMsg = resSeven10265.ErrMsg
- res.Cainfo = resSeven10265.Cainfo
- res.WarnMsg = resSeven10265.WarnMsg
- infocode, _ := strconv.ParseInt(resSeven10265.Infcode, 10, 64)
- res.Infcode = infocode
-
- } else {
-
- var src_resquest string
- if miConfig.Code == "H15049901371" {
- //赤峰地区国家医保医疗类别
- //职工透析:医疗类别选特殊情况门诊990502
- //居民定额血透门慢: 医疗类别选门诊慢病140104
- var med_type string
- if his.Insutype == "390" {
- if reg_type == 14 {
- med_type = "9933"
- } else if reg_type == 11 {
- med_type = "11"
- }
- } else if his.Insutype == "310" {
- if reg_type == 14 {
- med_type = "990502"
- } else if reg_type == 11 {
- med_type = "11"
- }
- }
- result2, src_resquest = service.Gdyb2207(his.PsnNo, his.Number, chrg_bchno, cert_no, insutype, allTotal, miConfig.OrgName, roles.UserName, miConfig.Code, his.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, med_type, his.IdCardType, tempOrder.FulamtOwnpayAmt, tempOrder.OverlmtSelfPay, tempOrder.PreselfpayAmt, tempOrder.InscpScpAmt, his.IdType, acct_used_flag)
- } else {
- var med_type string
- if reg_type == 14 {
- med_type = "14"
- } else if reg_type == 11 {
- med_type = "11"
- }
- result2, src_resquest = service.Gdyb2207ForGz(his.PsnNo, his.Number, chrg_bchno, cert_no, insutype, allTotal, miConfig.OrgName, roles.UserName, miConfig.Code, his.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, med_type, his.IdCardType, tempOrder.FulamtOwnpayAmt, tempOrder.OverlmtSelfPay, tempOrder.PreselfpayAmt, tempOrder.InscpScpAmt, his.IdType, acct_used_flag)
- }
-
- var dat map[string]interface{}
- if err := json.Unmarshal([]byte(result2), &dat); err == nil {
- fmt.Println(dat)
- } else {
- fmt.Println(err)
- }
- saveLog(result2, src_resquest, "2207", "结算")
- userJSONBytes, _ := json.Marshal(dat)
- if miConfig.Code == "H15049901371" {
-
- if err := json.Unmarshal(userJSONBytes, &resSeven10265); err != nil {
- utils.ErrorLog("解析失败:%v", err)
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
- res.InfRefmsgid = resSeven10265.InfRefmsgid
- res.Output = resSeven10265.Output
- res.ErrMsg = resSeven10265.ErrMsg
- res.Cainfo = resSeven10265.Cainfo
- res.WarnMsg = resSeven10265.WarnMsg
- infocode, _ := strconv.ParseInt(resSeven10265.Infcode, 10, 64)
- res.Infcode = infocode
-
- } else {
-
- if err := json.Unmarshal(userJSONBytes, &res); err != nil {
- utils.ErrorLog("解析失败:%v", err)
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
-
- }
- }
-
- if res.Infcode != 0 {
- errlog := &models.HisOrderError{
- UserOrgId: adminUser.CurrentOrgId,
- Ctime: time.Now().Unix(),
- Mtime: time.Now().Unix(),
- Number: chrg_bchno,
- ErrMsg: res.ErrMsg,
- Status: 1,
- PatientId: id,
- RecordTime: recordDateTime,
- Stage: 6,
- }
- service.CreateErrMsgLog(errlog)
- c.ServeSuccessJSON(map[string]interface{}{
- "failed_code": -10,
- "msg": res.ErrMsg,
- })
- return
- } else {
-
- order, _ := service.GetHisOrderTwo(adminUser.CurrentOrgId, chrg_bchno, id)
- order.OrderStatus = 2
- order.MdtrtId = res.Output.Setlinfo.MdtrtID
- order.SetlId = res.Output.Setlinfo.SetlID
- order.PsnNo = res.Output.Setlinfo.PsnNo
- order.PsnName = res.Output.Setlinfo.PsnName
- order.PsnCertType = res.Output.Setlinfo.PsnCertType
- order.Certno = res.Output.Setlinfo.Certno
- order.Gend = res.Output.Setlinfo.Gend
- order.Naty = res.Output.Setlinfo.Naty
- order.Age = res.Output.Setlinfo.Age
- order.Insutype = res.Output.Setlinfo.Insutype
- order.PsnType = res.Output.Setlinfo.PsnType
- order.CvlservFlag = res.Output.Setlinfo.CvlservFlag
- order.SetlTime = res.Output.Setlinfo.SetlTime
- order.MdtrtCertType = res.Output.Setlinfo.MdtrtCertType
- //order.MedType = res.Output.Setlinfo.MedType
- if reg_type == 1112 {
- order.MedType = "1112"
- }
- if reg_type == 1111 {
- order.MedType = "1111"
- }
- order.MedfeeSumamt = res.Output.Setlinfo.MedfeeSumamt
- order.FulamtOwnpayAmt = res.Output.Setlinfo.FulamtOwnpayAmt
- order.OverlmtSelfPay = res.Output.Setlinfo.OverlmtSelfpay
- order.PreselfpayAmt = res.Output.Setlinfo.PreselfpayAmt
- order.InscpScpAmt = res.Output.Setlinfo.InscpScpAmt
- order.ActPayDedc = res.Output.Setlinfo.ActPayDedc
- order.HifpPay = res.Output.Setlinfo.HifpPay
- order.CvlservPay = res.Output.Setlinfo.CvlservPay
- // order.PoolPropSelfpay = res.Output.Setlinfo.PoolPropSelfpay
- order.HifesPay = res.Output.Setlinfo.HifesPay
- order.HifobPay = res.Output.Setlinfo.HifobPay
- order.MafPay = res.Output.Setlinfo.MafPay
- order.HifmiPay = res.Output.Setlinfo.HifmiPay
- order.OthPay = res.Output.Setlinfo.OthPay
- order.FundPaySumamt = res.Output.Setlinfo.FundPaySumamt
- order.PsnPartAmt = res.Output.Setlinfo.PsnPartAmt
- order.AcctPay = res.Output.Setlinfo.AcctPay
- order.PsnCashPay = res.Output.Setlinfo.PsnCashPay
- order.HospPartAmt = res.Output.Setlinfo.HospPartAmt
- order.Balc = res.Output.Setlinfo.Balc
- order.AcctMulaidPay = res.Output.Setlinfo.AcctMulaidPay
- order.MedinsSetlId = res.Output.Setlinfo.MedinsSetlID
- order.ClrOptins = res.Output.Setlinfo.ClrOptins
- order.ClrWay = res.Output.Setlinfo.ClrWay
- order.Creator = order.Creator
- order.Modify = roles.AdminUserId
- order.RequestLog = src_resquest
- order.Diagnosis = diagnosis_id
- setlDetail, _ := json.Marshal(res.Output.Setldetail)
- detailStr := string(setlDetail)
- order.SetlDetail = detailStr
-
- err := service.UpdataOrderStatusTwo(chrg_bchno, adminUser.CurrentOrgId)
- err = service.UpDateOrder(order)
- if err == nil {
- //判断是否使用了押金
- if dec_way == "true" {
- tmpstring := strconv.FormatInt(order.ID, 10)
- //扣押金
- order.Decimal = decimal
- service.UpDateOrder(order)
-
- errmsg = service.SpendDeposit(c.GetAdminUserInfo().CurrentOrgId, id, c.GetAdminUserInfo().AdminUser.Id, tmpstring, decimal)
- if errmsg != nil {
- c.ServeFailJsonSend(enums.ErrorCodeParamWrong, errmsg.Error())
- return
- }
- }
-
- c.ServeSuccessJSON(map[string]interface{}{
- "msg": "结算成功",
- })
- } else {
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeAmountAccountException)
- return
- }
- }
- }
- }
- }
-
- //func (c *HisApiController) GetPreUploadInfo() {
- // id, _ := c.GetInt64("id")
- // record_time := c.GetString("record_time")
- // settle_accounts_type, _ := c.GetInt64("settle_accounts_type")
- // admin_user_id, _ := c.GetInt64("admin_user_id")
- //
- // timeLayout := "2006-01-02"
- // loc, _ := time.LoadLocation("Local")
- // theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", record_time+" 00:00:00", loc)
- // if err != nil {
- // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
- // return
- // }
- // recordDateTime := theTime.Unix()
- // adminUser := c.GetAdminUserInfo()
- //
- // var prescriptions []*models.HisPrescription
- //
- // var start_time int64
- // var end_time int64
- //
- // data := make(map[string]interface{})
- // if settle_accounts_type == 1 { //日结
- // prescriptions, _ = service.GetHisPrescription(adminUser.CurrentOrgId, id, recordDateTime)
- // data["pre"] = prescriptions
- //
- // } else { //月结
- // start_time_str := c.GetString("start_time")
- // end_time_str := c.GetString("end_time")
- // timeLayout := "2006-01-02"
- // loc, _ := time.LoadLocation("Local")
- // theStartTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time_str+" 00:00:00", loc)
- // if err != nil {
- // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
- // return
- // }
- // recordStartTime := theStartTime.Unix()
- // start_time = recordStartTime
- // theEndTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time_str+" 00:00:00", loc)
- // if err != nil {
- // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
- // return
- // }
- // recordEndTime := theEndTime.Unix()
- // end_time = recordEndTime
- // prescriptions, _ = service.GetMonthHisPrescription(adminUser.CurrentOrgId, id, recordStartTime, recordEndTime)
- // data["pre"] = prescriptions
- //
- // }
- //
- // roles, _ := service.GetAdminUserInfoByID(adminUser.CurrentOrgId, admin_user_id)
- //
- // his, _ := service.GetVMHisPatientInfo(adminUser.CurrentOrgId, id, recordDateTime)
- // timestamp := time.Now().Unix()
- // tempTime := time.Unix(timestamp, 0)
- // timeFormat := tempTime.Format("20060102150405")
- // chrgBchno := rand.Intn(100000) + 10000
- // chrg_bchno := timeFormat + strconv.FormatInt(int64(chrgBchno), 10) + strconv.FormatInt(his.PatientId, 10)
- // miConfig, _ := service.FindMedicalInsuranceInfo(adminUser.CurrentOrgId)
- // patientPrescription, _ := service.FindPatientPrescriptionInfo(adminUser.CurrentOrgId, id, recordDateTime)
- // department, _ := service.GetDepartMentDetail(patientPrescription.Departments)
- // strconv.FormatInt(his.PatientId, 10)
- // client := &http.Client{}
- // data["psn_no"] = his.PsnNo
- // data["mdtrt_id"] = his.Number
- // data["chrg_bchno"] = chrg_bchno
- // data["org_name"] = miConfig.OrgName
- // data["doctor"] = roles.UserName
- // data["doctor_id"] = strconv.FormatInt(roles.AdminUserId, 10)
- // data["dept"] = strconv.FormatInt(patientPrescription.Departments, 10)
- // data["fixmedins_code"] = miConfig.Code
- // data["dept_code"] = department.Number
- // data["insuplc_admdvs"] = miConfig.InsuplcAdmdvs
- // data["mdtrtarea_admvs"] = miConfig.MdtrtareaAdmvs
- // data["secret_key"] = miConfig.SecretKey
- // var ids []int64
- //
- // for _, item := range prescriptions {
- // ids = append(ids, item.ID)
- // }
- // config, _ := service.GetMedicalInsuranceConfig(adminUser.CurrentOrgId)
- // if config.IsOpen == 1 { //对接了医保,走医保流程
- // bytesData, _ := json.Marshal(data)
- // req, _ := http.NewRequest("POST", "http://127.0.0.1:9532/"+"gdyb/five", bytes.NewReader(bytesData))
- // resp, _ := client.Do(req)
- // defer resp.Body.Close()
- // body, ioErr := ioutil.ReadAll(resp.Body)
- // if ioErr != nil {
- // utils.ErrorLog("接口返回数据读取失败: %v", ioErr)
- // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- // return
- // }
- // var respJSON map[string]interface{}
- // if err := json.Unmarshal([]byte(body), &respJSON); err != nil {
- // utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
- // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- // return
- // }
- //
- // respJSON = respJSON["data"].(map[string]interface{})["pre"].(map[string]interface{})
- // userJSONBytes, _ := json.Marshal(respJSON)
- // var res ResultFour
- // if err := json.Unmarshal(userJSONBytes, &res); err != nil {
- // utils.ErrorLog("解析失败:%v", err)
- // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- // return
- // }
- //
- // if res.Infcode == 0 {
- // order := &models.HisOrder{
- // UserOrgId: adminUser.CurrentOrgId,
- // HisPatientId: his.ID,
- // PatientId: his.PatientId,
- // SettleAccountsDate: recordDateTime,
- // Ctime: time.Now().Unix(),
- // Mtime: time.Now().Unix(),
- // Status: 1,
- // Number: chrg_bchno,
- // Infcode: res.Infcode,
- // WarnMsg: res.WarnMsg,
- // Cainfo: res.Cainfo,
- // ErrMsg: res.ErrMsg,
- // RespondTime: res.RefmsgTime,
- // InfRefmsgid: res.InfRefmsgid,
- // OrderStatus: 1,
- // IsMedicineInsurance: 1,
- // SettleType: settle_accounts_type,
- // SettleStartTime: start_time,
- // SettleEndTime: end_time,
- // Creator: roles.ID,
- // Modify: roles.ID,
- // PType: 2,
- // }
- // err = service.CreateOrder(order)
- // if err != nil {
- // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCreatePreOrderException)
- // return
- // }
- //
- // for _, item := range res.Output.Result {
- // temp := strings.Split(item.FeedetlSn, "-")
- // var advice_id int64 = 0
- // var project_id int64 = 0
- // var types int64 = 0
- //
- // id, _ := strconv.ParseInt(temp[2], 10, 64)
- // types, _ = strconv.ParseInt(temp[1], 10, 64)
- //
- // if temp[1] == "1" {
- // advice_id = id
- // project_id = 0
- // } else if temp[1] == "2" {
- // advice_id = 0
- // project_id = id
- // }
- //
- // info := &models.HisOrderInfo{
- // OrderNumber: order.Number,
- // FeedetlSn: item.FeedetlSn,
- // UploadDate: time.Now().Unix(),
- // AdviceId: advice_id,
- // DetItemFeeSumamt: item.DetItemFeeSumamt,
- // Cnt: item.Cnt,
- // Pric: float64(item.Pric),
- // PatientId: his.PatientId,
- // PricUplmtAmt: item.PricUplmtAmt,
- // SelfpayProp: item.SelfpayProp,
- // FulamtOwnpayAmt: item.FulamtOwnpayAmt,
- // OverlmtAmt: item.OverlmtAmt,
- // PreselfpayAmt: item.PreselfpayAmt,
- // BasMednFlag: item.BasMednFlag,
- // MedChrgitmType: item.MedChrgitmType,
- // HiNegoDrugFlag: item.HiNegoDrugFlag,
- // Status: 1,
- // Memo: item.Memo,
- // Mtime: time.Now().Unix(),
- // InscpScpAmt: item.InscpScpAmt,
- // DrtReimFlag: item.DrtReimFlag,
- // Ctime: time.Now().Unix(),
- // ListSpItemFlag: item.ListSpItemFlag,
- // ChldMedcFlag: item.ChldMedcFlag,
- // LmtUsedFlag: item.LmtUsedFlag,
- // ChrgitmLv: item.ChrgitmLv,
- // UserOrgId: adminUser.CurrentOrgId,
- // HisPatientId: his.ID,
- // OrderId: order.ID,
- // ProjectId: project_id,
- // Type: types,
- // }
- // service.CreateOrderInfo(info)
- //
- // }
- // service.UpDatePrescriptionNumber(adminUser.CurrentOrgId, ids, chrg_bchno)
- // service.UpDatePrescriptionInfoNumber(adminUser.CurrentOrgId, patientPrescription.PatientId, chrg_bchno, recordDateTime)
- //
- // var total float64
- // for _, item := range prescriptions {
- // if item.Type == 1 { //药品
- // for _, subItem := range item.HisDoctorAdviceInfo {
- // total = total + (subItem.Price * subItem.PrescribingNumber)
- // }
- // }
- // if item.Type == 2 { //项目
- // for _, subItem := range item.HisPrescriptionProject {
- // total = total + (subItem.Price * float64(subItem.Count))
- // }
- // }
- // }
- //
- // for _, item := range prescriptions {
- // for _, subItem := range item.HisAdditionalCharge {
- // total = total + (subItem.Price * float64(subItem.Count))
- // }
- // }
- //
- // allTotal := fmt.Sprintf("%.2f", total)
- // if res.Infcode == 0 {
- // var rf []*ResultFive
- // json.Unmarshal([]byte(his.Iinfo), &rf)
- // psn_no := his.PsnNo
- // mdtrt_id := his.Number
- // chrg_bchno := chrg_bchno
- // cert_no := his.Certno
- // insutype := rf[0].Insutype
- //
- // if his.IdCardType == 1 {
- // cert_no = his.MedicalInsuranceNumber
- //
- // } else {
- //
- // cert_no = his.Certno
- //
- // }
- //
- // api := "http://127.0.0.1:9532/" + "gdyb/seven?cert_no=" + cert_no + "&insutype=" +
- // insutype + "&psn_no=" + psn_no + "&chrg_bchno=" + chrg_bchno + "&mdtrt_id=" + mdtrt_id +
- // "&total=" + allTotal + "&org_name=" + miConfig.OrgName + "&doctor=" + roles.UserName + "&fixmedins_code=" + miConfig.Code + "&insuplc_admdvs=" + miConfig.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" +
- // miConfig.SecretKey + "&med_type=" + strconv.FormatInt(patientPrescription.RegisterType, 10) + "&id_card_type=" + strconv.FormatInt(int64(his.IdCardType), 10)
- // resp, requestErr := http.Get(api)
- // if requestErr != nil {
- // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- // return
- // }
- // defer resp.Body.Close()
- // body, ioErr := ioutil.ReadAll(resp.Body)
- // if ioErr != nil {
- // utils.ErrorLog("接口返回数据读取失败: %v", ioErr)
- // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- // return
- // }
- // var respJSON map[string]interface{}
- // if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
- // utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
- // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- // return
- // }
- // fmt.Println(respJSON)
- // respJSON = respJSON["data"].(map[string]interface{})["pre"].(map[string]interface{})
- // userJSONBytes, _ := json.Marshal(respJSON)
- // var res ResultSeven
- // if err := json.Unmarshal(userJSONBytes, &res); err != nil {
- // utils.ErrorLog("解析失败:%v", err)
- // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- // return
- // }
- // if res.Infcode != 0 {
- // errlog := &models.HisOrderError{
- // UserOrgId: adminUser.CurrentOrgId,
- // Ctime: time.Now().Unix(),
- // Mtime: time.Now().Unix(),
- // Number: chrg_bchno,
- // ErrMsg: res.ErrMsg,
- // Status: 1,
- // PatientId: id,
- // RecordTime: recordDateTime,
- // Stage: 7,
- // }
- // service.CreateErrMsgLog(errlog)
- // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeRegisterRepeatException)
- // return
- // } else {
- // order, _ := service.GetHisOrderTwo(adminUser.CurrentOrgId, chrg_bchno, id)
- // order.OrderStatus = 1
- // order.MdtrtId = res.Output.Setlinfo.MdtrtID
- // order.SetlId = res.Output.Setlinfo.SetlID
- // order.PsnNo = res.Output.Setlinfo.PsnNo
- // order.PsnName = res.Output.Setlinfo.PsnName
- // order.PsnCertType = res.Output.Setlinfo.PsnCertType
- // order.Certno = res.Output.Setlinfo.Certno
- // order.Gend = res.Output.Setlinfo.Gend
- // order.Naty = res.Output.Setlinfo.Naty
- // order.Age = res.Output.Setlinfo.Age
- // order.Insutype = res.Output.Setlinfo.Insutype
- // order.PsnType = res.Output.Setlinfo.PsnType
- // order.CvlservFlag = res.Output.Setlinfo.CvlservFlag
- // order.SetlTime = res.Output.Setlinfo.SetlTime
- // order.MdtrtCertType = res.Output.Setlinfo.MdtrtCertType
- // order.MedType = res.Output.Setlinfo.MedType
- // order.MedfeeSumamt = res.Output.Setlinfo.MedfeeSumamt
- // order.FulamtOwnpayAmt = res.Output.Setlinfo.FulamtOwnpayAmt
- // order.OverlmtSelfPay = res.Output.Setlinfo.OverlmtSelfpay
- // order.PreselfpayAmt = res.Output.Setlinfo.PreselfpayAmt
- // order.InscpScpAmt = res.Output.Setlinfo.InscpScpAmt
- // order.ActPayDedc = res.Output.Setlinfo.ActPayDedc
- // order.HifpPay = res.Output.Setlinfo.HifpPay
- // order.CvlservPay = res.Output.Setlinfo.CvlservPay
- // order.PoolPropSelfpay = res.Output.Setlinfo.PoolPropSelfpay
- // order.HifesPay = res.Output.Setlinfo.HifesPay
- // order.HifobPay = res.Output.Setlinfo.HifobPay
- // order.MafPay = res.Output.Setlinfo.MafPay
- // order.OthPay = res.Output.Setlinfo.OthPay
- // order.FundPaySumamt = res.Output.Setlinfo.FundPaySumamt
- // order.PsnPartAmt = res.Output.Setlinfo.PsnPartAmt
- // order.AcctPay = res.Output.Setlinfo.AcctPay
- // order.PsnCashPay = res.Output.Setlinfo.PsnCashPay
- // order.HospPartAmt = res.Output.Setlinfo.HospPartAmt
- // order.Balc = res.Output.Setlinfo.Balc
- // order.AcctMulaidPay = res.Output.Setlinfo.AcctMulaidPay
- // order.MedinsSetlId = res.Output.Setlinfo.MedinsSetlID
- // order.ClrOptins = res.Output.Setlinfo.ClrOptins
- // order.ClrWay = res.Output.Setlinfo.ClrWay
- // order.Creator = order.Creator
- // order.Modify = roles.ID
- // setlDetail, _ := json.Marshal(res.Output.Setldetail)
- // detailStr := string(setlDetail)
- // order.SetlDetail = detailStr
- // //err := service.UpdataOrderStatusTwo(chrg_bchno, adminUser.CurrentOrgId)
- // err = service.UpDateOrder(order)
- // if err == nil {
- // c.ServeSuccessJSON(map[string]interface{}{
- // "msg": "预结算成功",
- // })
- // } else {
- // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeAmountAccountException)
- // return
- // }
- // }
- // } else {
- // adminUser := c.GetAdminUserInfo()
- // errlog := &models.HisOrderError{
- // UserOrgId: adminUser.CurrentOrgId,
- // Ctime: time.Now().Unix(),
- // Mtime: time.Now().Unix(),
- // ErrMsg: res.ErrMsg,
- // Status: 1,
- // PatientId: id,
- // RecordTime: recordDateTime,
- // Stage: 4,
- // }
- // service.CreateErrMsgLog(errlog)
- //
- // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeRegisterRepeatException)
- // return
- // }
- // } else {
- // adminUser := c.GetAdminUserInfo()
- // errlog := &models.HisOrderError{
- // UserOrgId: adminUser.CurrentOrgId,
- // Ctime: time.Now().Unix(),
- // Mtime: time.Now().Unix(),
- // ErrMsg: res.ErrMsg,
- // Status: 1,
- // PatientId: id,
- // RecordTime: recordDateTime,
- // Stage: 4,
- // }
- // service.CreateErrMsgLog(errlog)
- // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCalOrderException)
- // return
- // }
- //
- // } else {
- // var total float64
- // for _, item := range prescriptions {
- // if item.Type == 1 { //药品
- // for _, subItem := range item.HisDoctorAdviceInfo {
- // total = total + (subItem.Price * subItem.PrescribingNumber)
- // }
- // }
- // if item.Type == 2 { //项目
- // for _, subItem := range item.HisPrescriptionProject {
- // total = total + (subItem.Price * float64(subItem.Count))
- // }
- // }
- //
- // for _, subItem := range item.HisAdditionalCharge {
- // total = total + (subItem.Price * float64(subItem.Count))
- // }
- // }
- //
- // allTotal := fmt.Sprintf("%.2f", total)
- // totals, _ := strconv.ParseFloat(allTotal, 64)
- // order := &models.HisOrder{
- // UserOrgId: adminUser.CurrentOrgId,
- // HisPatientId: his.ID,
- // PatientId: id,
- // SettleAccountsDate: recordDateTime,
- // Ctime: time.Now().Unix(),
- // Mtime: time.Now().Unix(),
- // Status: 1,
- // OrderStatus: 2,
- // Number: chrg_bchno,
- // MedfeeSumamt: totals,
- // }
- // err = service.CreateOrder(order)
- // if err != nil {
- // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCreatePreOrderException)
- // return
- // }
- //
- // var customs []*Custom
- // for _, item := range prescriptions {
- //
- // if item.Type == 1 { //药品
- // for _, subItem := range item.HisDoctorAdviceInfo {
- // cus := &Custom{
- // AdviceId: subItem.ID,
- // ProjectId: 0,
- // 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.MedListCodg,
- // Type: 1,
- // }
- // customs = append(customs, cus)
- // }
- // }
- //
- // if item.Type == 2 { //项目
- // for _, subItem := range item.HisPrescriptionProject {
- //
- // cus := &Custom{
- // AdviceId: 0,
- // ProjectId: subItem.ID,
- // DetItemFeeSumamt: fmt.Sprintf("%.2f", subItem.Price*float64(subItem.Count)),
- // Cut: fmt.Sprintf("%.2f", float64(subItem.Count)),
- // FeedetlSn: subItem.FeedetlSn,
- // Price: fmt.Sprintf("%.2f", float64(subItem.Price)),
- // MedListCodg: subItem.MedListCodg,
- // Type: 2,
- // }
- //
- // customs = append(customs, cus)
- // }
- // }
- //
- // for _, item := range item.HisAdditionalCharge {
- // cus := &Custom{
- // ItemId: item.ID,
- // AdviceId: 0,
- // ProjectId: 0,
- // DetItemFeeSumamt: fmt.Sprintf("%.2f", item.Price),
- // Cut: fmt.Sprintf("%.2f", float64(item.Count)),
- // FeedetlSn: item.FeedetlSn,
- // Price: fmt.Sprintf("%.2f", float64(item.Price)),
- // MedListCodg: item.XtHisAddtionConfig.Code,
- // Type: 3,
- // }
- //
- // customs = append(customs, cus)
- // }
- //
- // }
- //
- // for _, item := range customs {
- // var advice_id int64 = 0
- // var project_id int64 = 0
- // var item_id int64 = 0
- //
- // var types int64 = 0
- //
- // if item.Type == 1 {
- // advice_id = item.AdviceId
- // project_id = 0
- // item_id = 0
- // } else if item.Type == 2 {
- // advice_id = 0
- // item_id = 0
- //
- // project_id = item.ProjectId
- // } else if item.Type == 3 {
- // advice_id = 0
- // item_id = item.ItemId
- // project_id = 0
- // }
- //
- // detItemFeeSumamt, _ := strconv.ParseFloat(item.DetItemFeeSumamt, 32)
- // cut, _ := strconv.ParseFloat(item.Cut, 32)
- // pric, _ := strconv.ParseFloat(item.Price, 32)
- //
- // info := &models.HisOrderInfo{
- // OrderNumber: order.Number,
- // UploadDate: time.Now().Unix(),
- // AdviceId: advice_id,
- // DetItemFeeSumamt: detItemFeeSumamt,
- // Cnt: cut,
- // Pric: pric,
- // PatientId: id,
- // Status: 1,
- // Mtime: time.Now().Unix(),
- // Ctime: time.Now().Unix(),
- // UserOrgId: adminUser.CurrentOrgId,
- // HisPatientId: his.ID,
- // OrderId: order.ID,
- // ProjectId: project_id,
- // Type: types,
- // ItemId: item_id,
- // }
- // service.CreateOrderInfo(info)
- // }
- // //err := service.UpDateAddtionNumber(adminUser.CurrentOrgId, ids, chrg_bchno)
- // err = service.UpDatePrescriptionNumber(adminUser.CurrentOrgId, ids, chrg_bchno)
- // err = service.UpDatePrescriptionInfoNumber(adminUser.CurrentOrgId, id, chrg_bchno, recordDateTime)
- // err = service.UpdataOrderStatusTwo(chrg_bchno, adminUser.CurrentOrgId)
- // if err == nil {
- // c.ServeSuccessJSON(map[string]interface{}{
- // "msg": "结算成功",
- // })
- // } else {
- // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeAmountAccountException)
- // return
- // }
- // }
- //}
-
- //上传明细-预结算-
- func (c *HisApiController) GetPreUploadInfo() {
- id, _ := c.GetInt64("id")
- record_time := c.GetString("record_time")
- his_patient_id, _ := c.GetInt64("his_patient_id")
- settle_accounts_type, _ := c.GetInt64("settle_accounts_type")
- admin_user_id, _ := c.GetInt64("admin_user_id")
-
- diagnosis_id := c.GetString("diagnosis")
- sick_type, _ := c.GetInt64("sick_type")
- reg_type, _ := c.GetInt64("p_type")
- begin_time := c.GetString("begin_time")
-
- id_str := c.GetString("ids")
- ids_arr := strings.Split(id_str, ",")
-
- timeLayout := "2006-01-02"
- loc, _ := time.LoadLocation("Local")
- theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", record_time+" 00:00:00", loc)
- if err != nil {
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
- return
- }
- recordDateTime := theTime.Unix()
- adminUser := c.GetAdminUserInfo()
-
- diagnosis_ids := strings.Split(diagnosis_id, ",")
-
- var config []*models.HisXtDiagnoseConfig
- for _, item := range diagnosis_ids {
- id, _ := strconv.ParseInt(item, 10, 64)
- diagnosisConfig, _ := service.FindDiagnoseById(id)
- config = append(config, &diagnosisConfig)
- }
- //diagnosisConfig, _ := service.FindDiagnoseById(diagnosis_id)
-
- sickConfig, _ := service.FindSickById(sick_type)
-
- var prescriptions []*models.HisPrescription
-
- var start_time int64
- var end_time int64
-
- roles, _ := service.GetAdminUserInfoByID(adminUser.CurrentOrgId, admin_user_id)
- fmt.Println(his_patient_id)
- his, _ := service.GetNewHisPatientInfo(adminUser.CurrentOrgId, his_patient_id, recordDateTime)
- timestamp := time.Now().Unix()
- tempTime := time.Unix(timestamp, 0)
- timeFormat := tempTime.Format("20060102150405")
- chrgBchno := rand.Intn(100000) + 10000
- chrg_bchno := timeFormat + strconv.FormatInt(int64(chrgBchno), 10) + strconv.FormatInt(his.PatientId, 10)
- miConfig, _ := service.FindMedicalInsuranceInfo(adminUser.CurrentOrgId)
- var patientPrescription models.HisPrescriptionInfo
- patientPrescription, _ = service.FindHisPatientPrescriptionInfo(adminUser.CurrentOrgId, his_patient_id, recordDateTime)
- if patientPrescription.ID == 0 {
- patientPrescription, _ = service.FindLastPatientPrescriptionInfo(adminUser.CurrentOrgId, id, recordDateTime)
- }
- //miConfig, _ := service.FindMedicalInsuranceInfo(adminUser.CurrentOrgId)
- department, _ := service.GetDepartMentDetail(patientPrescription.Departments)
-
- doctor_info, _ := service.GetAdminUserInfoByID(adminUser.CurrentOrgId, patientPrescription.DoctorId)
-
- strconv.FormatInt(his.PatientId, 10)
-
- var res2 ResultSix
- var resSix10265 ResultSix10265
- var time_stamp string
- if miConfig.MdtrtareaAdmvs == "421300" {
- data := make(map[string]interface{})
- client := &http.Client{}
- data["psn_no"] = his.PsnNo
- data["mdtrt_id"] = his.Number
- data["doctor"] = roles.UserName
- data["department"] = department.Name
- data["org_name"] = miConfig.OrgName
- data["med_type"] = strconv.FormatInt(reg_type, 10)
- data["doctor_id"] = strconv.FormatInt(doctor_info.AdminUserId, 10)
- data["fixmedins_code"] = miConfig.Code
- data["insuplc_admdvs"] = miConfig.InsuplcAdmdvs
- data["mdtrtarea_admvs"] = miConfig.MdtrtareaAdmvs
- data["secret_key"] = miConfig.SecretKey
- data["sick_code"] = sickConfig.CountryCode
- data["sick_name"] = sickConfig.ClassName
- data["begin_time"] = begin_time
- data["dept"] = strconv.FormatInt(department.ID, 10)
- data["config"] = config
-
- fmt.Println(data)
-
- bytesData, _ := json.Marshal(data)
- req, _ := http.NewRequest("POST", "http://192.168.124.4:9532/"+"hbyb/2203", bytes.NewReader(bytesData))
- resp, _ := client.Do(req)
- defer resp.Body.Close()
- body, ioErr := ioutil.ReadAll(resp.Body)
- if ioErr != nil {
- utils.ErrorLog("接口返回数据读取失败: %v", ioErr)
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
- var respJSON map[string]interface{}
- if err := json.Unmarshal([]byte(body), &respJSON); err != nil {
- utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
-
- respJSON = respJSON["data"].(map[string]interface{})["pre"].(map[string]interface{})
- userJSONBytes, _ := json.Marshal(respJSON)
- fmt.Println("log")
- fmt.Println(string(userJSONBytes))
- if err := json.Unmarshal(userJSONBytes, &res2); err != nil {
- utils.ErrorLog("解析失败:%v", err)
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
-
- } else if miConfig.MdtrtareaAdmvs == "320921" || miConfig.MdtrtareaAdmvs == "320982" {
- //江苏地区国家医保医疗类别
- //职工透析:医疗类别选特殊情况门诊9933
- //居民血透门慢: 医疗类别选门诊慢病1402
- //var med_type string
- //if his.Insutype == "310" {
- // if reg_type == 14 {
- // med_type = "9933"
- // } else if reg_type == 11 {
- // med_type = "11"
- //
- // }
- //} else if his.Insutype == "390" {
- // if reg_type == 14 {
- // med_type = "1402"
- // } else if reg_type == 11 {
- // med_type = "11"
- // }
- //}
-
- data := make(map[string]interface{})
- client := &http.Client{}
- data["psn_no"] = his.PsnNo
- data["mdtrt_id"] = his.Number
- data["doctor"] = roles.UserName
- data["department"] = department.Name
- data["org_name"] = miConfig.OrgName
- data["med_type"] = strconv.FormatInt(reg_type, 10)
- data["doctor_id"] = strconv.FormatInt(doctor_info.AdminUserId, 10)
- data["fixmedins_code"] = miConfig.Code
- data["insuplc_admdvs"] = his.InsuplcAdmdvs
- data["mdtrtarea_admvs"] = miConfig.MdtrtareaAdmvs
- data["secret_key"] = miConfig.SecretKey
- data["sick_code"] = sickConfig.CountryCode
- data["sick_name"] = sickConfig.ClassName
- data["begin_time"] = begin_time
- data["dept"] = strconv.FormatInt(department.ID, 10)
- data["config"] = config
- data["url"] = miConfig.Url
- data["ak"] = miConfig.AccessKey
- data["cainfo"] = miConfig.Cainfo
-
- bytesData, _ := json.Marshal(data)
-
- var req *http.Request
- if miConfig.MdtrtareaAdmvs == "320921" {
- req, _ = http.NewRequest("POST", "http://192.168.3.111:9532/"+"jsyb/2203", bytes.NewReader(bytesData))
-
- //api = "http://192.168.3.111:9532/" + "jsyb/readcard?" + "fixmedins_code=" + miConfig.Code + "&secret_key=" + miConfig.SecretKey + "&ak=" + miConfig.AccessKey + "&org_name=" + miConfig.OrgName + "&doctor=" + roles.UserName +
- // "&insuplc_admdvs=" + miConfig.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey + "&url=" + miConfig.Url + "&cainfo=" + miConfig.Cainfo
-
- } else {
- req, _ = http.NewRequest("POST", "http://192.168.5.251:9532/"+"jsyb/2203", bytes.NewReader(bytesData))
-
- }
-
- resp, _ := client.Do(req)
- defer resp.Body.Close()
- body, ioErr := ioutil.ReadAll(resp.Body)
- if ioErr != nil {
- utils.ErrorLog("接口返回数据读取失败: %v", ioErr)
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
- var respJSON map[string]interface{}
- if err := json.Unmarshal([]byte(body), &respJSON); err != nil {
- utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
-
- time_stamp = strconv.FormatInt(int64(respJSON["data"].(map[string]interface{})["time_stamp"].(float64)), 10)
-
- //fmt.Println(respJSON["data"].(map[string]interface{})["time_stamp"].(string))
- //time_stamp = respJSON["data"].(map[string]interface{})["time_stamp"].(string)
- respJSON = respJSON["data"].(map[string]interface{})["pre"].(map[string]interface{})
- userJSONBytes, _ := json.Marshal(respJSON)
- fmt.Println("log")
- fmt.Println(string(userJSONBytes))
- if err := json.Unmarshal(userJSONBytes, &resSix10265); err != nil {
- utils.ErrorLog("解析失败:%v", err)
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
-
- res2.InfRefmsgid = resSix10265.InfRefmsgid
- // res2.Output = resSix10265.Output
- res2.ErrMsg = resSix10265.ErrMsg
- res2.Cainfo = resSix10265.Cainfo
- res2.WarnMsg = resSix10265.WarnMsg
- infocode, _ := strconv.ParseInt(resSix10265.Infcode, 10, 64)
- res2.Infcode = infocode
-
- } else {
- var result string
- var requestLog string
- if miConfig.MdtrtareaAdmvs == "440781" { //
- result, requestLog = service.Gdyb2203A(his.PsnNo, his.Number, doctor_info.UserName, department.Name, miConfig.OrgName, strconv.FormatInt(reg_type, 10), doctor_info.DoctorNumber, miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, sickConfig.ContentCode, sickConfig.ClassName, roles.UserName, config, begin_time)
- } else {
- if miConfig.Code == "H15049901371" {
- //赤峰地区国家医保医疗类别
- //职工透析:医疗类别选特殊情况门诊990502
- //居民定额血透门慢: 医疗类别选门诊慢病140104
- var med_type string
- if his.Insutype == "390" {
- if reg_type == 14 {
- med_type = "9933"
- } else if reg_type == 11 {
- med_type = "11"
- }
- } else if his.Insutype == "310" {
- if reg_type == 14 {
- med_type = "990502"
- } else if reg_type == 11 {
- med_type = "11"
- }
- }
- result, requestLog = service.Gdyb2203ForGz(his.PsnNo, his.Number, doctor_info.UserName, department.Name, miConfig.OrgName, med_type, doctor_info.DoctorNumber, miConfig.Code, his.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, sickConfig.ContentCode, sickConfig.ClassName, roles.UserName, config, begin_time)
- } else {
- var med_type string
- if reg_type == 14 {
- med_type = "14"
- result, requestLog = service.Gdyb2203ForGz(his.PsnNo, his.Number, doctor_info.UserName, department.Name, miConfig.OrgName, med_type, doctor_info.DoctorNumber, miConfig.Code, his.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, sickConfig.ContentCode, sickConfig.ClassName, roles.UserName, config, begin_time)
-
- } else if reg_type == 11 {
- med_type = "11"
- // sickConfig.ClassName = "普通门诊"
- // sickConfig.ContentCode = "11"
- result, requestLog = service.Gdyb2203ForGz(his.PsnNo, his.Number, doctor_info.UserName, department.Name, miConfig.OrgName, med_type, doctor_info.DoctorNumber, miConfig.Code, his.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, sickConfig.ContentCode, sickConfig.ClassName, roles.UserName, config, begin_time)
-
- }
-
- }
- saveLog(result, requestLog, "2203", "上传就诊信息")
- var respJSON2 map[string]interface{}
- if err := json.Unmarshal([]byte(string(result)), &respJSON2); err != nil {
- utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
- userJSONBytes2, _ := json.Marshal(respJSON2)
- if miConfig.Code == "H15049901371" {
- if err := json.Unmarshal(userJSONBytes2, &resSix10265); err != nil {
- utils.ErrorLog("解析失败:%v", err)
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
- res2.InfRefmsgid = resSix10265.InfRefmsgid
- // res2.Output = resSix10265.Output
- res2.ErrMsg = resSix10265.ErrMsg
- res2.Cainfo = resSix10265.Cainfo
- res2.WarnMsg = resSix10265.WarnMsg
- infocode, _ := strconv.ParseInt(resSix10265.Infcode, 10, 64)
- res2.Infcode = infocode
- } else {
- if err := json.Unmarshal(userJSONBytes2, &res2); err != nil {
- utils.ErrorLog("解析失败:%v", err)
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
- }
- }
-
- }
-
- if res2.Infcode != 0 {
- adminUser := c.GetAdminUserInfo()
- errlog := &models.HisOrderError{
- UserOrgId: adminUser.CurrentOrgId,
- Ctime: time.Now().Unix(),
- Mtime: time.Now().Unix(),
- ErrMsg: res2.ErrMsg,
- Status: 1,
- PatientId: id,
- RecordTime: recordDateTime,
- Stage: 3,
- }
- service.CreateErrMsgLog(errlog)
- c.ServeSuccessJSON(map[string]interface{}{
- "failed_code": -10,
- "msg": res2.ErrMsg,
- })
- return
-
- } else {
- his.Diagnosis = diagnosis_id
- his.SickType = sickConfig.ID
- his.PType = fmt.Sprintf("%d", reg_type)
- service.UpdateHisPatientThree(&his)
-
- data := make(map[string]interface{})
- if settle_accounts_type == 1 { //日结
- if reg_type == 11 || reg_type == 1111 || reg_type == 1112 {
- prescriptions, _ = service.GetPrescriptionByIds(ids_arr, adminUser.CurrentOrgId)
- } else {
- prescriptions, _ = service.GetNewHisPrescription(adminUser.CurrentOrgId, his_patient_id, recordDateTime, strconv.Itoa(int(reg_type)))
- }
- data["pre"] = prescriptions
- } else { //月结
- start_time_str := c.GetString("start_time")
- end_time_str := c.GetString("end_time")
- timeLayout := "2006-01-02"
- loc, _ := time.LoadLocation("Local")
- theStartTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time_str+" 00:00:00", loc)
- if err != nil {
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
- return
- }
- recordStartTime := theStartTime.Unix()
- start_time = recordStartTime
- theEndTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time_str+" 00:00:00", loc)
- if err != nil {
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
- return
- }
- recordEndTime := theEndTime.Unix()
- end_time = recordEndTime
- prescriptions, _ = service.GetMonthHisPrescriptionTwo(adminUser.CurrentOrgId, id, recordStartTime, recordEndTime, reg_type)
- data["pre"] = prescriptions
- }
-
- client := &http.Client{}
- data["psn_no"] = his.PsnNo
- data["mdtrt_id"] = his.Number
- data["chrg_bchno"] = chrg_bchno
- data["org_name"] = miConfig.OrgName
- data["doctor"] = roles.UserName
- data["doctor_id"] = strconv.FormatInt(roles.AdminUserId, 10)
- data["dept"] = strconv.FormatInt(patientPrescription.Departments, 10)
- data["fixmedins_code"] = miConfig.Code
- data["balance_accounts_type"] = strconv.FormatInt(his.BalanceAccountsType, 10)
-
- if (department.ID == 0 && adminUser.CurrentOrgId == 9919) || (department.ID == 0 && adminUser.CurrentOrgId == 10106) {
- data["dept_code"] = "15"
- } else {
- data["dept_code"] = department.Number
- }
-
- data["insuplc_admdvs"] = his.InsuplcAdmdvs
- data["mdtrtarea_admvs"] = miConfig.MdtrtareaAdmvs
- data["secret_key"] = miConfig.SecretKey
- data["url"] = miConfig.Url
- data["ak"] = miConfig.AccessKey
- data["new_doctor_name"] = patientPrescription.Doctor
- data["diag_code"] = sickConfig.CountryCode
- data["time_stamp"] = time_stamp
- data["cainfo"] = miConfig.Cainfo
-
- var ids []int64
-
- for _, item := range prescriptions {
- ids = append(ids, item.ID)
- }
- config, _ := service.GetMedicalInsuranceConfig(adminUser.CurrentOrgId)
- if config.IsOpen == 1 { //对接了医保,走医保流程
- var res ResultFour
- var resFour10265 ResultFour10265
-
- if miConfig.MdtrtareaAdmvs == "421300" {
- bytesData, _ := json.Marshal(data)
- req, _ := http.NewRequest("POST", "http://192.168.124.4:9532/"+"hbyb/2204", bytes.NewReader(bytesData))
- resp, _ := client.Do(req)
- defer resp.Body.Close()
- body, ioErr := ioutil.ReadAll(resp.Body)
- if ioErr != nil {
- utils.ErrorLog("接口返回数据读取失败: %v", ioErr)
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
- var respJSON map[string]interface{}
- if err := json.Unmarshal([]byte(body), &respJSON); err != nil {
- utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
-
- respJSON = respJSON["data"].(map[string]interface{})["pre"].(map[string]interface{})
- userJSONBytes, _ := json.Marshal(respJSON)
- fmt.Println("log")
- fmt.Println(string(userJSONBytes))
- if err := json.Unmarshal(userJSONBytes, &res); err != nil {
- utils.ErrorLog("解析失败:%v", err)
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
-
- } else if miConfig.MdtrtareaAdmvs == "320921" || miConfig.MdtrtareaAdmvs == "320982" {
- bytesData, _ := json.Marshal(data)
- var req *http.Request
- if miConfig.MdtrtareaAdmvs == "320921" {
- req, _ = http.NewRequest("POST", "http://192.168.3.111:9532/"+"jsyb/2204", bytes.NewReader(bytesData))
-
- } else {
- req, _ = http.NewRequest("POST", "http://192.168.5.251:9532/"+"jsyb/2204", bytes.NewReader(bytesData))
- }
-
- resp, _ := client.Do(req)
- defer resp.Body.Close()
- body, ioErr := ioutil.ReadAll(resp.Body)
- if ioErr != nil {
- utils.ErrorLog("接口返回数据读取失败: %v", ioErr)
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
- var respJSON map[string]interface{}
- if err := json.Unmarshal([]byte(body), &respJSON); err != nil {
- utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
-
- respJSON = respJSON["data"].(map[string]interface{})["pre"].(map[string]interface{})
- userJSONBytes, _ := json.Marshal(respJSON)
- fmt.Println("log")
- fmt.Println(string(userJSONBytes))
- if err := json.Unmarshal(userJSONBytes, &resFour10265); err != nil {
- utils.ErrorLog("解析失败:%v", err)
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
-
- res.InfRefmsgid = resFour10265.InfRefmsgid
- res.Output = resFour10265.Output
- res.ErrMsg = resFour10265.ErrMsg
- res.Cainfo = resFour10265.Cainfo
- res.WarnMsg = resFour10265.WarnMsg
- infocode, _ := strconv.ParseInt(resFour10265.Infcode, 10, 64)
- res.Infcode = infocode
-
- } else {
-
- if miConfig.Code == "H15049901371" {
- result, request_log := service.Gdyb2204(his.PsnNo, his.Number, prescriptions, chrg_bchno, miConfig.OrgName, roles.UserName, data["dept"].(string), data["fixmedins_code"].(string), data["dept_code"].(string), data["doctor_id"].(string), his.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, data["balance_accounts_type"].(string), patientPrescription.DoctorId, sickConfig.CountryCode)
- var dat map[string]interface{}
- if err := json.Unmarshal([]byte(result), &dat); err == nil {
- fmt.Println(dat)
- } else {
- fmt.Println(err)
- }
- saveLog(result, request_log, "2204", "上传费用明细")
-
- userJSONBytes, _ := json.Marshal(dat)
-
- if err := json.Unmarshal(userJSONBytes, &resFour10265); err != nil {
- utils.ErrorLog("解析失败:%v", err)
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
-
- res.InfRefmsgid = resFour10265.InfRefmsgid
- res.Output = resFour10265.Output
- res.ErrMsg = resFour10265.ErrMsg
- res.Cainfo = resFour10265.Cainfo
- res.WarnMsg = resFour10265.WarnMsg
- infocode, _ := strconv.ParseInt(resFour10265.Infcode, 10, 64)
- res.Infcode = infocode
-
- } else {
- result, request_log := service.Gdyb2204(his.PsnNo, his.Number, prescriptions, chrg_bchno, miConfig.OrgName, roles.UserName, data["dept"].(string), data["fixmedins_code"].(string), data["dept_code"].(string), data["doctor_id"].(string), miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, data["balance_accounts_type"].(string), patientPrescription.DoctorId, sickConfig.CountryCode)
- var dat map[string]interface{}
- if err := json.Unmarshal([]byte(result), &dat); err == nil {
- fmt.Println(dat)
- } else {
- fmt.Println(err)
- }
- saveLog(result, request_log, "2204", "上传费用明细")
-
- userJSONBytes, _ := json.Marshal(dat)
-
- if err := json.Unmarshal(userJSONBytes, &res); err != nil {
- utils.ErrorLog("解析失败:%v", err)
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
-
- }
-
- }
-
- if res.Infcode == 0 {
- order := &models.HisOrder{
- UserOrgId: adminUser.CurrentOrgId,
- HisPatientId: his.ID,
- PatientId: his.PatientId,
- SettleAccountsDate: recordDateTime,
- Ctime: time.Now().Unix(),
- Mtime: time.Now().Unix(),
- MdtrtId: his.Number,
- PsnNo: his.PsnNo,
- MedType: strconv.FormatInt(reg_type, 10),
- Status: 1,
- Number: chrg_bchno,
- Infcode: res.Infcode,
- WarnMsg: res.WarnMsg,
- Cainfo: res.Cainfo,
- ErrMsg: res.ErrMsg,
- RespondTime: res.RefmsgTime,
- InfRefmsgid: res.InfRefmsgid,
- OrderStatus: 1,
- IsMedicineInsurance: 1,
- SettleType: settle_accounts_type,
- SettleStartTime: start_time,
- SettleEndTime: end_time,
- Creator: roles.AdminUserId,
- Modify: roles.AdminUserId,
- PType: 2,
- Diagnosis: diagnosis_id,
- }
-
- err = service.CreateOrder(order)
- if err != nil {
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCreatePreOrderException)
- return
- }
-
- for _, item := range res.Output.Result {
- temp := strings.Split(item.FeedetlSn, "-")
- var advice_id int64 = 0
- var project_id int64 = 0
- var types int64 = 0
-
- id, _ := strconv.ParseInt(temp[2], 10, 64)
- types, _ = strconv.ParseInt(temp[1], 10, 64)
-
- if temp[1] == "1" {
- advice_id = id
- project_id = 0
- } else if temp[1] == "2" {
- advice_id = 0
- project_id = id
- }
-
- info := &models.HisOrderInfo{
- OrderNumber: order.Number,
- FeedetlSn: item.FeedetlSn,
- UploadDate: time.Now().Unix(),
- AdviceId: advice_id,
- DetItemFeeSumamt: item.DetItemFeeSumamt,
- Cnt: item.Cnt,
- Pric: float64(item.Pric),
- PatientId: his.PatientId,
- PricUplmtAmt: item.PricUplmtAmt,
- SelfpayProp: item.SelfpayProp,
- FulamtOwnpayAmt: item.FulamtOwnpayAmt,
- OverlmtAmt: item.OverlmtAmt,
- PreselfpayAmt: item.PreselfpayAmt,
- BasMednFlag: item.BasMednFlag,
- MedChrgitmType: item.MedChrgitmType,
- HiNegoDrugFlag: item.HiNegoDrugFlag,
- Status: 1,
- Memo: item.Memo,
- Mtime: time.Now().Unix(),
- InscpScpAmt: item.InscpScpAmt,
- DrtReimFlag: item.DrtReimFlag,
- Ctime: time.Now().Unix(),
- ListSpItemFlag: item.ListSpItemFlag,
- ChldMedcFlag: item.ChldMedcFlag,
- LmtUsedFlag: item.LmtUsedFlag,
- ChrgitmLv: item.ChrgitmLv,
- UserOrgId: adminUser.CurrentOrgId,
- HisPatientId: his.ID,
- OrderId: order.ID,
- ProjectId: project_id,
- Type: types,
- }
- service.CreateOrderInfo(info)
-
- }
- service.UpDatePrescriptionNumber(adminUser.CurrentOrgId, ids, chrg_bchno)
- service.UpDateHisPrescriptionInfoNumber(adminUser.CurrentOrgId, his_patient_id, chrg_bchno, recordDateTime)
-
- var total float64
- for _, item := range prescriptions {
- if item.Type == 1 { //药品
- for _, subItem := range item.HisDoctorAdviceInfo {
- total = total + (subItem.Price * subItem.PrescribingNumber)
- }
- }
- if item.Type == 2 { //项目
-
- for _, subItem := range item.HisPrescriptionProject {
- cnt, _ := strconv.ParseFloat(subItem.Count, 64)
-
- total = total + (subItem.Price * cnt)
- }
- }
- }
-
- for _, item := range prescriptions {
- for _, subItem := range item.HisAdditionalCharge {
- total = total + (subItem.Price * float64(subItem.Count))
- }
- }
-
- allTotal := fmt.Sprintf("%.4f", total)
- if res.Infcode == 0 {
- var rf []*ResultFive
- json.Unmarshal([]byte(his.Iinfo), &rf)
- chrg_bchno := chrg_bchno
- cert_no := his.Certno
-
- var insutypes []string
-
- var insutype string
- var is390 int = 0
- var is310 int = 0
-
- for _, item := range rf {
- if (item.Insutype == "390" && item.PsnInsuStas == "1") || (item.Insutype == "310" && item.PsnInsuStas == "1") {
- insutypes = append(insutypes, item.Insutype)
- }
- }
-
- if len(insutypes) == 1 {
- insutype = insutypes[0]
- } else {
- for _, i := range insutypes {
- if i == "390" {
- is390 = 1
- }
-
- if i == "310" {
- is310 = 1
- }
- }
- }
- if is390 == 1 {
- insutype = "390"
- }
-
- if is310 == 1 {
- insutype = "310"
- }
-
- if len(insutypes) == 0 {
- insutype = "310"
- }
- if len(insutypes) == 2 {
- insutype = strconv.FormatInt(his.SocialType, 64)
- }
-
- //insutype = "390"
- if his.IdCardType == 1 {
- cert_no = his.MedicalInsuranceNumber
-
- } else {
-
- cert_no = his.Certno
-
- }
- var res models.GZResult2206
- var resSeven10265 ResultSeven10265
-
- if miConfig.MdtrtareaAdmvs == "421300" {
-
- api := "http://192.168.124.4:9532/" + "hbyb/2206?psn_no=" + his.PsnNo + "&mdtrt_id=" +
- his.Number + "&chrg_bchno=" + chrg_bchno + "&org_name=" + miConfig.OrgName +
- "&doctor=" + roles.UserName + "&fixmedins_code=" + miConfig.Code +
- "&insuplc_admdvs=" + his.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs +
- "&secret_key=" + miConfig.SecretKey + "&id_card_type=" + strconv.FormatInt(his.IdCardType, 10) +
- "&certificates=" + strconv.FormatInt(his.IdType, 10) + "&cert_no=" + cert_no +
- "&insutype=" + insutype + "&total=" + allTotal + "&med_type=" + strconv.FormatInt(reg_type, 10)
- resp, requestErr := http.Get(api)
- if requestErr != nil {
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
-
- body, ioErr := ioutil.ReadAll(resp.Body)
- if ioErr != nil {
- utils.ErrorLog("接口返回数据读取失败: %v", ioErr)
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
- var respJSON map[string]interface{}
- if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
- utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
-
- respJSON = respJSON["data"].(map[string]interface{})["pre"].(map[string]interface{})
- result, _ := json.Marshal(respJSON)
- fmt.Println("log")
- fmt.Println(string(result))
- if err := json.Unmarshal([]byte(result), &res); err != nil {
- utils.ErrorLog("解析失败:%v", err)
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
-
- } else if miConfig.MdtrtareaAdmvs == "320921" || miConfig.MdtrtareaAdmvs == "320982" {
- psn_info, _ := service.GetPsnByPatientId(his.PatientId)
- psn_info.VerifyNumber = strings.Replace(psn_info.VerifyNumber, "+", "%2B", -1)
-
- bas := strings.Split(psn_info.CardInfo, "|")
-
- if his.IdCardType == 1 {
- cert_no = bas[2]
- } else {
- cert_no = bas[1]
- }
- //江苏地区国家医保医疗类别
- //职工透析:医疗类别选特殊情况门诊9933
- //居民血透门慢: 医疗类别选门诊慢病1402
- //var med_type string
- //if his.Insutype == "310" {
- // if reg_type == 14 {
- // med_type = "9933"
- // } else if reg_type == 11 {
- // med_type = "11"
- //
- // }
- //} else if his.Insutype == "390" {
- // if reg_type == 14 {
- // med_type = "1402"
- // } else if reg_type == 11 {
- // med_type = "11"
- // }
- //}
-
- var api string
-
- if miConfig.MdtrtareaAdmvs == "320921" {
- api = "http://192.168.3.111:9532/" + "jsyb/2206?psn_no=" + his.PsnNo + "&mdtrt_id=" +
- his.Number + "&chrg_bchno=" + chrg_bchno + "&org_name=" + miConfig.OrgName +
- "&doctor=" + roles.UserName + "&fixmedins_code=" + miConfig.Code +
- "&insuplc_admdvs=" + his.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs +
- "&secret_key=" + miConfig.SecretKey + "&id_card_type=" + strconv.FormatInt(his.IdCardType, 10) +
- "&certificates=" + strconv.FormatInt(his.IdType, 10) + "&cert_no=" + cert_no +
- "&insutype=" + insutype + "&total=" + allTotal + "&med_type=" + strconv.FormatInt(reg_type, 10) + "&verify_number=" + psn_info.VerifyNumber + "&url=" + miConfig.Url + "&ak=" + miConfig.AccessKey + "&cainfo=" + miConfig.Cainfo
-
- //req, _ = http.NewRequest("POST", "http://192.168.3.111:9532/"+"jsyb/2204", bytes.NewReader(bytesData))
-
- } else {
- //req, _ = http.NewRequest("POST", "http://192.168.5.251:9532/"+"jsyb/2204", bytes.NewReader(bytesData))
- api = "http://192.168.5.251:9532/" + "jsyb/2206?psn_no=" + his.PsnNo + "&mdtrt_id=" +
- his.Number + "&chrg_bchno=" + chrg_bchno + "&org_name=" + miConfig.OrgName +
- "&doctor=" + roles.UserName + "&fixmedins_code=" + miConfig.Code +
- "&insuplc_admdvs=" + his.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs +
- "&secret_key=" + miConfig.SecretKey + "&id_card_type=" + strconv.FormatInt(his.IdCardType, 10) +
- "&certificates=" + strconv.FormatInt(his.IdType, 10) + "&cert_no=" + cert_no +
- "&insutype=" + insutype + "&total=" + allTotal + "&med_type=" + strconv.FormatInt(reg_type, 10) + "&verify_number=" + psn_info.VerifyNumber + "&url=" + miConfig.Url + "&ak=" + miConfig.AccessKey + "&cainfo=" + miConfig.Cainfo
-
- }
-
- resp, requestErr := http.Get(api)
- if requestErr != nil {
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
-
- body, ioErr := ioutil.ReadAll(resp.Body)
- if ioErr != nil {
- utils.ErrorLog("接口返回数据读取失败: %v", ioErr)
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
- var respJSON map[string]interface{}
- if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
- utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
-
- respJSON = respJSON["data"].(map[string]interface{})["pre"].(map[string]interface{})
- result, _ := json.Marshal(respJSON)
- fmt.Println("log")
- fmt.Println(string(result))
- if err := json.Unmarshal([]byte(result), &resSeven10265); err != nil {
- utils.ErrorLog("解析失败:%v", err)
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
-
- res.InfRefmsgid = resSeven10265.InfRefmsgid
- // res.Output = resSeven10265.Output
- res.ErrMsg = resSeven10265.ErrMsg
- res.Cainfo = resSeven10265.Cainfo
- // res.WarnMsg = resSeven10265.WarnMsg
- // infocode, _ := strconv.ParseInt(resSeven10265.Infcode, 10, 64)
- // res.Infcode = infocode
-
- } else {
-
- var result string
- var request_log string
- if miConfig.Code == "H15049901371" {
- //赤峰地区国家医保医疗类别
- //职工透析:医疗类别选特殊情况门诊990502
- //居民定额血透门慢: 医疗类别选门诊慢病140104
- var med_type string
- if his.Insutype == "390" {
- if reg_type == 14 {
- med_type = "9933"
- } else if reg_type == 11 {
- med_type = "11"
- }
- } else if his.Insutype == "310" {
- if reg_type == 14 {
- med_type = "990502"
- } else if reg_type == 11 {
- med_type = "11"
- }
- }
- result, request_log = service.Gdyb2206(his.PsnNo, his.Number, chrg_bchno, cert_no, insutype, allTotal, miConfig.OrgName, roles.UserName, miConfig.Code, his.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, med_type, his.IdCardType, 0, 0, 0, 0, his.IdType)
- } else {
- var med_type string
-
- if reg_type == 14 {
- med_type = "141009"
- } else if reg_type == 11 {
- med_type = "11"
- }
- result, request_log = service.Gdyb2206(his.PsnNo, his.Number, chrg_bchno, cert_no, insutype, allTotal, miConfig.OrgName, roles.UserName, miConfig.Code, his.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, med_type, his.IdCardType, 0, 0, 0, 0, his.IdType)
- }
-
- var dat map[string]interface{}
- if err := json.Unmarshal([]byte(result), &dat); err == nil {
- fmt.Println(dat)
- } else {
- fmt.Println(err)
- }
- saveLog(result, request_log, "2206", "预结算")
- //userJSONBytes, _ := json.Marshal(dat)
- //
- //if err := json.Unmarshal(userJSONBytes, &res); err != nil {
- // utils.ErrorLog("解析失败:%v", err)
- // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- // return
- //}
-
- userJSONBytes, _ := json.Marshal(dat)
- if miConfig.Code == "H15049901371" {
- if err := json.Unmarshal(userJSONBytes, &resSeven10265); err != nil {
- utils.ErrorLog("解析失败:%v", err)
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
- res.InfRefmsgid = resSeven10265.InfRefmsgid
- // res.Output = resSeven10265.Output
- res.ErrMsg = resSeven10265.ErrMsg
- res.Cainfo = resSeven10265.Cainfo
- // res.WarnMsg = resSeven10265.WarnMsg
- // infocode, _ := strconv.ParseInt(resSeven10265.Infcode, 10, 64)
- // res.Infcode = infocode
- } else {
- if err := json.Unmarshal(userJSONBytes, &res); err != nil {
- utils.ErrorLog("解析失败:%v", err)
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
- }
- }
-
- if res.Infcode != 0 {
- errlog := &models.HisOrderError{
- UserOrgId: adminUser.CurrentOrgId,
- Ctime: time.Now().Unix(),
- Mtime: time.Now().Unix(),
- Number: chrg_bchno,
- ErrMsg: res.ErrMsg,
- Status: 1,
- PatientId: id,
- RecordTime: recordDateTime,
- Stage: 20,
- }
- service.CreateErrMsgLog(errlog)
- c.ServeSuccessJSON(map[string]interface{}{
- "failed_code": -10,
- "msg": res.ErrMsg,
- })
- return
- } else {
- order, _ := service.GetHisOrderTwo(adminUser.CurrentOrgId, chrg_bchno, id)
- order.OrderStatus = 1
- order.IsPre = 1
- order.Status = 1
- order.MdtrtId = res.Output.Setlinfo.MdtrtID
- // order.SetlId = res.Output.Setlinfo.SetlID
- order.PsnNo = res.Output.Setlinfo.PsnNo
- order.PsnName = res.Output.Setlinfo.PsnName
- order.PsnCertType = res.Output.Setlinfo.PsnCertType
- order.Certno = res.Output.Setlinfo.Certno
- order.Gend = res.Output.Setlinfo.Gend
- order.Naty = res.Output.Setlinfo.Naty
- order.Age = res.Output.Setlinfo.Age
- order.Insutype = res.Output.Setlinfo.Insutype
- order.PsnType = res.Output.Setlinfo.PsnType
- order.CvlservFlag = res.Output.Setlinfo.CvlservFlag
- order.SetlTime = res.Output.Setlinfo.SetlTime
- order.MdtrtCertType = res.Output.Setlinfo.MdtrtCertType
- if res.Output.Setlinfo.MedType == "140101" {
- order.MedType = "14"
-
- } else {
- order.MedType = res.Output.Setlinfo.MedType
- }
- if reg_type == 1112 {
- order.MedType = "1112"
- }
- if reg_type == 1111 {
- order.MedType = "1111"
- }
- order.MedfeeSumamt = res.Output.Setlinfo.MedfeeSumamt
- order.FulamtOwnpayAmt = res.Output.Setlinfo.FulamtOwnpayAmt
- order.OverlmtSelfPay = res.Output.Setlinfo.OverlmtSelfpay
- order.PreselfpayAmt = res.Output.Setlinfo.PreselfpayAmt
- order.InscpScpAmt = res.Output.Setlinfo.InscpScpAmt
- order.ActPayDedc = res.Output.Setlinfo.ActPayDedc
- order.HifpPay = res.Output.Setlinfo.HifpPay
- order.CvlservPay = res.Output.Setlinfo.CvlservPay
- // order.PoolPropSelfpay = res.Output.Setlinfo.PoolPropSelfpay
- order.HifesPay = res.Output.Setlinfo.HifesPay
- order.HifobPay = res.Output.Setlinfo.HifobPay
- order.MafPay = res.Output.Setlinfo.MafPay
- order.HifmiPay = res.Output.Setlinfo.HifmiPay
- order.OthPay = res.Output.Setlinfo.OthPay
- order.FundPaySumamt = res.Output.Setlinfo.FundPaySumamt
- // order.PsnPartAmt = res.Output.Setlinfo.PsnPartAmt
- order.AcctPay = res.Output.Setlinfo.AcctPay
- order.PsnCashPay = res.Output.Setlinfo.PsnCashPay
- order.HospPartAmt = res.Output.Setlinfo.HospPartAmt
- order.Balc = res.Output.Setlinfo.Balc
- order.AcctMulaidPay = res.Output.Setlinfo.AcctMulaidPay
- order.MedinsSetlId = res.Output.Setlinfo.MedinsSetlID
- order.ClrOptins = res.Output.Setlinfo.ClrOptins
- order.ClrWay = res.Output.Setlinfo.ClrWay
- order.Creator = order.Creator
- order.Modify = roles.AdminUserId
- setlDetail, _ := json.Marshal(res.Output.Setldetail)
- detailStr := string(setlDetail)
- order.SetlDetail = detailStr
- //err := service.UpdataOrderStatusTwo(chrg_bchno, adminUser.CurrentOrgId)
- err = service.UpDateOrder(order)
- if err == nil {
- c.ServeSuccessJSON(map[string]interface{}{
- "msg": "预结算成功",
- })
- } else {
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeAmountAccountException)
- return
- }
- }
- } else {
- adminUser := c.GetAdminUserInfo()
- errlog := &models.HisOrderError{
- UserOrgId: adminUser.CurrentOrgId,
- Ctime: time.Now().Unix(),
- Mtime: time.Now().Unix(),
- ErrMsg: res.ErrMsg,
- Status: 1,
- PatientId: id,
- RecordTime: recordDateTime,
- Stage: 4,
- }
- service.CreateErrMsgLog(errlog)
-
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeRegisterRepeatException)
- return
- }
- } else {
- adminUser := c.GetAdminUserInfo()
- errlog := &models.HisOrderError{
- UserOrgId: adminUser.CurrentOrgId,
- Ctime: time.Now().Unix(),
- Mtime: time.Now().Unix(),
- ErrMsg: res.ErrMsg,
- Status: 1,
- PatientId: id,
- RecordTime: recordDateTime,
- Stage: 4,
- }
- service.CreateErrMsgLog(errlog)
- c.ServeSuccessJSON(map[string]interface{}{
- "failed_code": -10,
- "msg": res.ErrMsg,
- })
- return
- }
- }
- }
- }
-
- //func (c *HisApiController) GetSettleInfo() {
- // id, _ := c.GetInt64("id")
- // order_id, _ := c.GetInt64("order_id")
- //
- // record_time := c.GetString("record_time")
- // pay_way, _ := c.GetInt64("pay_way")
- // pay_price, _ := c.GetFloat("pay_price")
- // pay_card_no := c.GetString("pay_card_no")
- // discount_price, _ := c.GetFloat("discount_price")
- // preferential_price, _ := c.GetFloat("preferential_price")
- // reality_price, _ := c.GetFloat("reality_price")
- // found_price, _ := c.GetFloat("found_price")
- // medical_insurance_price, _ := c.GetFloat("medical_insurance_price")
- // private_price, _ := c.GetFloat("private_price")
- // settle_accounts_type, _ := c.GetInt64("settle_accounts_type")
- // admin_user_id, _ := c.GetInt64("admin_user_id")
- //
- // timeLayout := "2006-01-02"
- // loc, _ := time.LoadLocation("Local")
- // theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", record_time+" 00:00:00", loc)
- // if err != nil {
- // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
- // return
- // }
- // recordDateTime := theTime.Unix()
- // adminUser := c.GetAdminUserInfo()
- //
- // var prescriptions []*models.HisPrescription
- //
- // data := make(map[string]interface{})
- // if settle_accounts_type == 1 { //日结
- // prescriptions, _ = service.GetHisPrescription(adminUser.CurrentOrgId, id, recordDateTime)
- // data["pre"] = prescriptions
- //
- // } else { //月结
- // start_time_str := c.GetString("start_time")
- // end_time_str := c.GetString("end_time")
- // timeLayout := "2006-01-02"
- // loc, _ := time.LoadLocation("Local")
- // theStartTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time_str+" 00:00:00", loc)
- // if err != nil {
- // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
- // return
- // }
- // recordStartTime := theStartTime.Unix()
- // theEndTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time_str+" 00:00:00", loc)
- // if err != nil {
- // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
- // return
- // }
- // recordEndTime := theEndTime.Unix()
- // prescriptions, _ = service.GetMonthHisPrescription(adminUser.CurrentOrgId, id, recordStartTime, recordEndTime)
- // data["pre"] = prescriptions
- //
- // }
- //
- // roles, _ := service.GetAdminUserInfoByID(adminUser.CurrentOrgId, admin_user_id)
- //
- // his, _ := service.GetVMHisPatientInfo(adminUser.CurrentOrgId, id, recordDateTime)
- // miConfig, _ := service.FindMedicalInsuranceInfo(adminUser.CurrentOrgId)
- // patientPrescription, _ := service.FindPatientPrescriptionInfo(adminUser.CurrentOrgId, id, recordDateTime)
- // strconv.FormatInt(his.PatientId, 10)
- //
- // order_src, _ := service.GetHisOrderByID(order_id)
- //
- // config, _ := service.GetMedicalInsuranceConfig(adminUser.CurrentOrgId)
- // if config.IsOpen == 1 { //对接了医保,走医保流程
- //
- // var total float64
- // for _, item := range prescriptions {
- // if item.Type == 1 { //药品
- // for _, subItem := range item.HisDoctorAdviceInfo {
- // total = total + (subItem.Price * subItem.PrescribingNumber)
- // }
- // }
- // if item.Type == 2 { //项目
- // for _, subItem := range item.HisPrescriptionProject {
- // total = total + (subItem.Price * float64(subItem.Count))
- // }
- // }
- // }
- //
- // for _, item := range prescriptions {
- // for _, subItem := range item.HisAdditionalCharge {
- // total = total + (subItem.Price * float64(subItem.Count))
- // }
- // }
- //
- // allTotal := fmt.Sprintf("%.2f", total)
- // var rf []*ResultFive
- // json.Unmarshal([]byte(his.Iinfo), &rf)
- // psn_no := order_src.PsnNo
- // mdtrt_id := order_src.MdtrtId
- // chrg_bchno := order_src.Number
- // cert_no := order_src.Certno
- // insutype := rf[0].Insutype
- //
- // if his.IdCardType == 1 {
- // cert_no = his.MedicalInsuranceNumber
- // } else {
- // cert_no = his.Certno
- // }
- //
- // result, src_resquest := service.Gdyb2207(his.PsnNo, his.Number, chrg_bchno, cert_no, insutype, strconv.FormatFloat(total, 'E', -1, 64) ,miConfig.OrgName,roles.UserName,miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, strconv.FormatInt(patientPrescription.RegisterType, 10),his.IdCardType, order_src.FulamtOwnpayAmt,order_src.OverlmtSelfPay,order_src.PreselfpayAmt,order_src.InscpScpAmt)
- // var dat map[string]interface{}
- // if err := json.Unmarshal([]byte(result), &dat); err == nil {
- // fmt.Println(dat)
- // } else {
- // fmt.Println(err)
- // }
- //
- // userJSONBytes, _ := json.Marshal(dat)
- //
- //
- //
- // var res ResultSeven
- // if err := json.Unmarshal(userJSONBytes, &res); err != nil {
- // utils.ErrorLog("解析失败:%v", err)
- // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- // return
- // }
- // if res.Infcode == -1 {
- // errlog := &models.HisOrderError{
- // UserOrgId: adminUser.CurrentOrgId,
- // Ctime: time.Now().Unix(),
- // Mtime: time.Now().Unix(),
- // Number: chrg_bchno,
- // ErrMsg: res.ErrMsg,
- // Status: 1,
- // PatientId: id,
- // RecordTime: recordDateTime,
- // Stage: 6,
- // }
- // service.CreateErrMsgLog(errlog)
- // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeRegisterRepeatException)
- // return
- // } else {
- // order_src.OrderStatus = 2
- // order_src.PayWay = pay_way
- // order_src.PayPrice = pay_price
- // order_src.PayCardNo = pay_card_no
- // order_src.DiscountPrice = discount_price
- // order_src.PreferentialPrice = preferential_price
- // order_src.RealityPrice = reality_price
- // order_src.FoundPrice = found_price
- // order_src.MedicalInsurancePrice = medical_insurance_price
- // order_src.PrivatePrice = private_price
- // order_src.MdtrtId = res.Output.Setlinfo.MdtrtID
- // order_src.SetlId = res.Output.Setlinfo.SetlID
- // order_src.PsnNo = res.Output.Setlinfo.PsnNo
- // order_src.PsnName = res.Output.Setlinfo.PsnName
- // order_src.PsnCertType = res.Output.Setlinfo.PsnCertType
- // order_src.Certno = res.Output.Setlinfo.Certno
- // order_src.Gend = res.Output.Setlinfo.Gend
- // order_src.Naty = res.Output.Setlinfo.Naty
- // order_src.Age = res.Output.Setlinfo.Age
- // order_src.Insutype = res.Output.Setlinfo.Insutype
- // order_src.PsnType = res.Output.Setlinfo.PsnType
- // order_src.CvlservFlag = res.Output.Setlinfo.CvlservFlag
- // order_src.SetlTime = res.Output.Setlinfo.SetlTime
- // order_src.MdtrtCertType = res.Output.Setlinfo.MdtrtCertType
- // order_src.MedType = res.Output.Setlinfo.MedType
- // order_src.MedfeeSumamt = res.Output.Setlinfo.MedfeeSumamt
- // order_src.FulamtOwnpayAmt = res.Output.Setlinfo.FulamtOwnpayAmt
- // order_src.OverlmtSelfPay = res.Output.Setlinfo.OverlmtSelfpay
- // order_src.PreselfpayAmt = res.Output.Setlinfo.PreselfpayAmt
- // order_src.InscpScpAmt = res.Output.Setlinfo.InscpScpAmt
- // order_src.ActPayDedc = res.Output.Setlinfo.ActPayDedc
- // order_src.HifpPay = res.Output.Setlinfo.HifpPay
- // order_src.CvlservPay = res.Output.Setlinfo.CvlservPay
- // order_src.PoolPropSelfpay = res.Output.Setlinfo.PoolPropSelfpay
- // order_src.HifesPay = res.Output.Setlinfo.HifesPay
- // order_src.HifobPay = res.Output.Setlinfo.HifobPay
- // order_src.MafPay = res.Output.Setlinfo.MafPay
- // order_src.OthPay = res.Output.Setlinfo.OthPay
- // order_src.FundPaySumamt = res.Output.Setlinfo.FundPaySumamt
- // order_src.PsnPartAmt = res.Output.Setlinfo.PsnPartAmt
- // order_src.AcctPay = res.Output.Setlinfo.AcctPay
- // order_src.PsnCashPay = res.Output.Setlinfo.PsnCashPay
- // order_src.HospPartAmt = res.Output.Setlinfo.HospPartAmt
- // order_src.Balc = res.Output.Setlinfo.Balc
- // order_src.AcctMulaidPay = res.Output.Setlinfo.AcctMulaidPay
- // order_src.MedinsSetlId = res.Output.Setlinfo.MedinsSetlID
- // order_src.ClrOptins = res.Output.Setlinfo.ClrOptins
- // order_src.ClrWay = res.Output.Setlinfo.ClrWay
- // order_src.Creator = order_src.Creator
- // order_src.Modify = roles.ID
- // order_src.RequestLog = src_resquest
- // setlDetail, _ := json.Marshal(res.Output.Setldetail)
- // detailStr := string(setlDetail)
- // order_src.SetlDetail = detailStr
- // err = service.UpdataOrderStatusTwo(chrg_bchno, adminUser.CurrentOrgId)
- // err = service.UpDateOrder(order_src)
- //
- // if err == nil {
- // c.ServeSuccessJSON(map[string]interface{}{
- // "msg": "结算成功",
- // })
- // } else {
- // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeAmountAccountException)
- // return
- // }
- // }
- // }
- //}
-
- //退款
- func (c *HisApiController) Refund() {
- order_id, _ := c.GetInt64("order_id")
- admin_user_id, _ := c.GetInt64("admin_user_id")
- adminUser := c.GetAdminUserInfo()
- var order models.HisOrder
- order, _ = service.GetHisOrderByID(order_id)
- roles, _ := service.GetAdminUserInfoByID(adminUser.CurrentOrgId, admin_user_id)
- if order.ID == 0 {
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
- return
- }
- his, _ := service.GetHisPatientByNumber(order.MdtrtId)
-
- miConfig, _ := service.FindMedicalInsuranceInfo(adminUser.CurrentOrgId)
- config, _ := service.GetMedicalInsuranceConfig(adminUser.CurrentOrgId)
- if config.IsOpen == 1 { //对接了医保,走医保流程
- var res ResultFourteen
- var resSixteen10265 ResultSixteen10265
- var src_resquest string
- var result string
-
- if miConfig.MdtrtareaAdmvs == "421300" {
- api3 := "http://192.168.124.4:9532/" + "hbyb/2208?psn_no=" + order.PsnNo +
- "&mdtrt_id=" + order.MdtrtId + "&setl_id=" + order.SetlId + "&doctor=" + roles.UserName + "&org_name=" + miConfig.OrgName + "&fixmedins_code=" + miConfig.Code +
- "&insuplc_admdvs=" + miConfig.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey
- resp3, requestErr3 := http.Get(api3)
- if requestErr3 != nil {
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
- body3, ioErr3 := ioutil.ReadAll(resp3.Body)
- if ioErr3 != nil {
- utils.ErrorLog("接口返回数据读取失败: %v", ioErr3)
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
- var respJSON3 map[string]interface{}
- if err := json.Unmarshal([]byte(string(body3)), &respJSON3); err != nil {
- utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
-
- respJSON3 = respJSON3["data"].(map[string]interface{})["pre"].(map[string]interface{})
- userJSONBytes3, _ := json.Marshal(respJSON3)
- fmt.Println("log")
- fmt.Println(string(userJSONBytes3))
- if err := json.Unmarshal(userJSONBytes3, &res); err != nil {
- utils.ErrorLog("解析失败:%v", err)
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
-
- } else if miConfig.MdtrtareaAdmvs == "320921" || miConfig.MdtrtareaAdmvs == "320982" {
-
- var api3 string
- if miConfig.MdtrtareaAdmvs == "320921" {
- api3 = "http://192.168.3.111:9532/" + "jsyb/2208?psn_no=" + order.PsnNo +
- "&mdtrt_id=" + order.MdtrtId + "&setl_id=" + order.SetlId + "&doctor=" + roles.UserName + "&org_name=" + miConfig.OrgName + "&fixmedins_code=" + miConfig.Code +
- "&insuplc_admdvs=" + miConfig.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey + "&url=" + miConfig.Url + "&ak=" + miConfig.AccessKey + "&cainfo=" + miConfig.Cainfo
-
- //req, _ = http.NewRequest("POST", "http://192.168.3.111:9532/"+"jsyb/2204", bytes.NewReader(bytesData))
-
- } else {
- //req, _ = http.NewRequest("POST", "http://192.168.5.251:9532/"+"jsyb/2204", bytes.NewReader(bytesData))
- api3 = "http://192.168.5.251:9532/" + "jsyb/2208?psn_no=" + order.PsnNo +
- "&mdtrt_id=" + order.MdtrtId + "&setl_id=" + order.SetlId + "&doctor=" + roles.UserName + "&org_name=" + miConfig.OrgName + "&fixmedins_code=" + miConfig.Code +
- "&insuplc_admdvs=" + miConfig.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey + "&url=" + miConfig.Url + "&ak=" + miConfig.AccessKey + "&cainfo=" + miConfig.Cainfo
-
- }
-
- resp3, requestErr3 := http.Get(api3)
- if requestErr3 != nil {
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
- body3, ioErr3 := ioutil.ReadAll(resp3.Body)
- if ioErr3 != nil {
- utils.ErrorLog("接口返回数据读取失败: %v", ioErr3)
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
- var respJSON3 map[string]interface{}
- if err := json.Unmarshal([]byte(string(body3)), &respJSON3); err != nil {
- utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
-
- respJSON3 = respJSON3["data"].(map[string]interface{})["pre"].(map[string]interface{})
- userJSONBytes3, _ := json.Marshal(respJSON3)
- if err := json.Unmarshal(userJSONBytes3, &resSixteen10265); err != nil {
- utils.ErrorLog("解析失败:%v", err)
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
-
- res.InfRefmsgid = resSixteen10265.InfRefmsgid
- // res.Output = resSixteen10265.Output
- res.ErrMsg = resSixteen10265.ErrMsg
- // res.Cainfo = resSixteen10265.Cainfo
- // res.WarnMsg = resSixteen10265.WarnMsg
- // infocode, _ := strconv.ParseInt(resSixteen10265.Infcode, 10, 64)
- // res.Infcode = infocode
-
- } else {
-
- if miConfig.Code == "H15049901371" {
- result, src_resquest = service.Gdyb2208(order.PsnNo, order.MdtrtId, order.SetlId, miConfig.OrgName, roles.UserName, miConfig.SecretKey, miConfig.Code, his.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs)
- var dat map[string]interface{}
- if err := json.Unmarshal([]byte(result), &dat); err == nil {
- fmt.Println(dat)
- } else {
- fmt.Println(err)
- }
- saveLog(result, src_resquest, "2208", "退费")
-
- userJSONBytes, _ := json.Marshal(dat)
-
- if err := json.Unmarshal(userJSONBytes, &resSixteen10265); err != nil {
- utils.ErrorLog("解析失败:%v", err)
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
- res.InfRefmsgid = resSixteen10265.InfRefmsgid
- // res.Output = resSixteen10265.Output
- res.ErrMsg = resSixteen10265.ErrMsg
- // res.Cainfo = resSixteen10265.Cainfo
- // res.WarnMsg = resSixteen10265.WarnMsg
- infocode, _ := strconv.ParseInt(resSixteen10265.Infcode, 10, 64)
- res.Infcode = infocode
- } else {
- result, src_resquest = service.Gdyb2208(order.PsnNo, order.MdtrtId, order.SetlId, miConfig.OrgName, roles.UserName, miConfig.SecretKey, miConfig.Code, his.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs)
- var dat map[string]interface{}
- if err := json.Unmarshal([]byte(result), &dat); err == nil {
- fmt.Println(dat)
- } else {
- fmt.Println(err)
- }
- saveLog(result, src_resquest, "2208", "退费")
-
- userJSONBytes, _ := json.Marshal(dat)
- if err := json.Unmarshal(userJSONBytes, &res); err != nil {
- utils.ErrorLog("解析失败:%v", err)
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
-
- }
-
- }
-
- if res.Infcode == 0 {
- var res2 ResultSix
- var resSix10265 ResultSix10265
-
- if miConfig.MdtrtareaAdmvs == "421300" {
-
- api3 := "http://192.168.124.4:9532/" + "hbyb/2205?psn_no=" + order.PsnNo +
- "&mdtrt_id=" + order.MdtrtId + "&chrg_bchno=" + order.Number + "&doctor=" + roles.UserName + "&org_name=" + miConfig.OrgName + "&fixmedins_code=" + miConfig.Code +
- "&insuplc_admdvs=" + his.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey
- resp3, requestErr3 := http.Get(api3)
- if requestErr3 != nil {
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
- body3, ioErr3 := ioutil.ReadAll(resp3.Body)
- if ioErr3 != nil {
- utils.ErrorLog("接口返回数据读取失败: %v", ioErr3)
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
- var respJSON3 map[string]interface{}
- if err := json.Unmarshal([]byte(string(body3)), &respJSON3); err != nil {
- utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
-
- respJSON3 = respJSON3["data"].(map[string]interface{})["pre"].(map[string]interface{})
- userJSONBytes3, _ := json.Marshal(respJSON3)
- fmt.Println("log")
- fmt.Println(string(userJSONBytes3))
- if err := json.Unmarshal(userJSONBytes3, &res2); err != nil {
- utils.ErrorLog("解析失败:%v", err)
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
-
- } else if miConfig.MdtrtareaAdmvs == "320921" || miConfig.MdtrtareaAdmvs == "320982" {
- var api3 string
- if miConfig.MdtrtareaAdmvs == "320921" {
- api3 = "http://192.168.3.111:9532/" + "jsyb/2205?psn_no=" + order.PsnNo +
- "&mdtrt_id=" + order.MdtrtId + "&chrg_bchno=" + order.Number + "&doctor=" + roles.UserName + "&org_name=" + miConfig.OrgName + "&fixmedins_code=" + miConfig.Code +
- "&insuplc_admdvs=" + his.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey + "&url=" + miConfig.Url + "&ak=" + miConfig.AccessKey + "&cainfo=" + miConfig.Cainfo
-
- //req, _ = http.NewRequest("POST", "http://192.168.3.111:9532/"+"jsyb/2204", bytes.NewReader(bytesData))
-
- } else {
- //req, _ = http.NewRequest("POST", "http://192.168.5.251:9532/"+"jsyb/2204", bytes.NewReader(bytesData))
- api3 = "http://192.168.5.251:9532/" + "jsyb/2205?psn_no=" + order.PsnNo +
- "&mdtrt_id=" + order.MdtrtId + "&chrg_bchno=" + order.Number + "&doctor=" + roles.UserName + "&org_name=" + miConfig.OrgName + "&fixmedins_code=" + miConfig.Code +
- "&insuplc_admdvs=" + his.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey + "&url=" + miConfig.Url + "&ak=" + miConfig.AccessKey + "&cainfo=" + miConfig.Cainfo
-
- }
-
- resp3, requestErr3 := http.Get(api3)
- if requestErr3 != nil {
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
- body3, ioErr3 := ioutil.ReadAll(resp3.Body)
- if ioErr3 != nil {
- utils.ErrorLog("接口返回数据读取失败: %v", ioErr3)
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
- var respJSON3 map[string]interface{}
- if err := json.Unmarshal([]byte(string(body3)), &respJSON3); err != nil {
- utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
-
- respJSON3 = respJSON3["data"].(map[string]interface{})["pre"].(map[string]interface{})
- userJSONBytes3, _ := json.Marshal(respJSON3)
- fmt.Println("log")
- fmt.Println(string(userJSONBytes3))
- if err := json.Unmarshal(userJSONBytes3, &resSix10265); err != nil {
- utils.ErrorLog("解析失败:%v", err)
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
-
- res2.InfRefmsgid = resSix10265.InfRefmsgid
- // res2.Output = resSix10265.Output
- res2.ErrMsg = resSix10265.ErrMsg
- res2.Cainfo = resSix10265.Cainfo
- res2.WarnMsg = resSix10265.WarnMsg
- infocode, _ := strconv.ParseInt(resSix10265.Infcode, 10, 64)
- res2.Infcode = infocode
-
- } else {
-
- if miConfig.Code == "H15049901371" {
- result2, src_request := service.Gdyb2205(order.PsnNo, order.MdtrtId, order.Number, miConfig.OrgName, roles.UserName, his.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, miConfig.Code)
- var dat map[string]interface{}
- if err := json.Unmarshal([]byte(result2), &dat); err == nil {
- fmt.Println(dat)
- } else {
- fmt.Println(err)
- }
-
- saveLog(result2, src_request, "2205", "撤销明细")
- userJSONBytes, _ := json.Marshal(dat)
- if err := json.Unmarshal(userJSONBytes, &resSix10265); err != nil {
- utils.ErrorLog("解析失败:%v", err)
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
- res2.InfRefmsgid = resSix10265.InfRefmsgid
- // res2.Output = resSix10265.Output
- res2.ErrMsg = resSix10265.ErrMsg
- res2.Cainfo = resSix10265.Cainfo
- res2.WarnMsg = resSix10265.WarnMsg
- infocode, _ := strconv.ParseInt(resSix10265.Infcode, 10, 64)
- res2.Infcode = infocode
- } else {
- order_infos, _ := service.GetHisOrderInfoByNumberFour(order.Number)
- for _, item := range order_infos {
- result2, src_request := service.Gdyb2205ForGz(order.PsnNo, order.MdtrtId, item.FeedetlSn, miConfig.OrgName, roles.UserName, his.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, miConfig.Code)
- var dat map[string]interface{}
- if err := json.Unmarshal([]byte(result2), &dat); err == nil {
- fmt.Println(dat)
- } else {
- fmt.Println(err)
- }
-
- saveLog(result2, src_request, "2205", "撤销明细")
- userJSONBytes, _ := json.Marshal(dat)
- if err := json.Unmarshal(userJSONBytes, &res2); err != nil {
- utils.ErrorLog("解析失败:%v", err)
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
- }
-
- }
-
- }
-
- if res2.Infcode == 0 {
- err := service.UpdataOrderStatus(order_id, order.Number, adminUser.CurrentOrgId, src_resquest, result)
- if err == nil {
- //当押金不为零时产生退费记录
- if order.Decimal != 0 {
- tmp := strconv.FormatInt(order.ID, 10)
- err = service.MoneyIncrease(adminUser.CurrentOrgId, order.PatientId, tmp, order.Decimal)
- if err != nil {
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
- }
- c.ServeSuccessJSON(map[string]interface{}{
- "msg": "退费成功",
- })
- } else {
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
- } else {
- c.ServeSuccessJSON(map[string]interface{}{
- "code": -10,
- "msg": res2.ErrMsg,
- })
- }
- } else {
- c.ServeSuccessJSON(map[string]interface{}{
- "code": -10,
- "msg": res.ErrMsg,
- })
- }
- }
- }
-
- func (c *HisApiController) RefundNumber() {
- record_time := c.GetString("record_time")
- //patient_id, _ := c.GetInt64("patient_id")
- admin_user_id, _ := c.GetInt64("admin_user_id")
- his_patient_id, _ := c.GetInt64("id")
-
- timeLayout := "2006-01-02"
- loc, _ := time.LoadLocation("Local")
- adminUser := c.GetAdminUserInfo()
- theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", record_time+" 00:00:00", loc)
- fmt.Println(err)
- if err != nil {
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
- return
- }
- recordDateTime := theTime.Unix()
- //his, _ := service.GetVMHisPatientInfo(adminUser.CurrentOrgId, patient_id, recordDateTime)
-
- his, _ := service.GetHisPatientRecord(adminUser.CurrentOrgId, his_patient_id)
- //patientPrescription, _ := service.FindPatientPrescriptionInfo(adminUser.CurrentOrgId, patient_id, recordDateTime)
- //order, _ := service.GetHisOrderByID(order_id)
- miConfig, _ := service.FindMedicalInsuranceInfo(adminUser.CurrentOrgId)
- config, _ := service.GetMedicalInsuranceConfig(adminUser.CurrentOrgId)
- roles, _ := service.GetAdminUserInfoByID(adminUser.CurrentOrgId, admin_user_id)
-
- count, _ := service.GetOrderCountByNumber(adminUser.CurrentOrgId, his.PatientId, recordDateTime, his.Number)
-
- if count > 0 {
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeOrderParamWrong)
- return
- }
-
- if config.IsOpen == 1 { //对接了医保,走医保流程
- var res2 ResultSix
- var resSix10265 ResultSix10265
-
- if miConfig.MdtrtareaAdmvs == "421300" {
-
- api3 := "http://192.168.124.4:9532/" + "hbyb/2202?psn_no=" + his.PsnNo +
- "&mdtrt_id=" + his.Number + "&ipt_otp_no=" + his.IptOtpNo + "&doctor=" + roles.UserName + "&org_name=" + miConfig.OrgName + "&fixmedins_code=" + miConfig.Code +
- "&insuplc_admdvs=" + his.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey
- resp3, requestErr3 := http.Get(api3)
- if requestErr3 != nil {
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
-
- body3, ioErr3 := ioutil.ReadAll(resp3.Body)
- if ioErr3 != nil {
- utils.ErrorLog("接口返回数据读取失败: %v", ioErr3)
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
- var respJSON3 map[string]interface{}
- if err := json.Unmarshal([]byte(string(body3)), &respJSON3); err != nil {
- utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
-
- respJSON3 = respJSON3["data"].(map[string]interface{})["pre"].(map[string]interface{})
- userJSONBytes3, _ := json.Marshal(respJSON3)
- fmt.Println("log")
- fmt.Println(string(userJSONBytes3))
- if err := json.Unmarshal(userJSONBytes3, &res2); err != nil {
- utils.ErrorLog("解析失败:%v", err)
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
-
- } else if miConfig.MdtrtareaAdmvs == "320921" || miConfig.MdtrtareaAdmvs == "320982" {
- var api3 string
- if miConfig.MdtrtareaAdmvs == "320921" {
- api3 = "http://192.168.3.111:9532/" + "jsyb/2202?psn_no=" + his.PsnNo +
- "&mdtrt_id=" + his.Number + "&ipt_otp_no=" + his.IptOtpNo + "&doctor=" + roles.UserName + "&org_name=" + miConfig.OrgName + "&fixmedins_code=" + miConfig.Code +
- "&insuplc_admdvs=" + his.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey + "&url=" + miConfig.Url + "&ak=" + miConfig.AccessKey + "&cainfo=" + miConfig.Cainfo
-
- //req, _ = http.NewRequest("POST", "http://192.168.3.111:9532/"+"jsyb/2204", bytes.NewReader(bytesData))
-
- } else {
- //req, _ = http.NewRequest("POST", "http://192.168.5.251:9532/"+"jsyb/2204", bytes.NewReader(bytesData))
- api3 = "http://192.168.5.251:9532/" + "jsyb/2202?psn_no=" + his.PsnNo +
- "&mdtrt_id=" + his.Number + "&ipt_otp_no=" + his.IptOtpNo + "&doctor=" + roles.UserName + "&org_name=" + miConfig.OrgName + "&fixmedins_code=" + miConfig.Code +
- "&insuplc_admdvs=" + his.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey + "&url=" + miConfig.Url + "&ak=" + miConfig.AccessKey + "&cainfo=" + miConfig.Cainfo
- }
-
- resp3, requestErr3 := http.Get(api3)
- if requestErr3 != nil {
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
-
- body3, ioErr3 := ioutil.ReadAll(resp3.Body)
- if ioErr3 != nil {
- utils.ErrorLog("接口返回数据读取失败: %v", ioErr3)
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
- var respJSON3 map[string]interface{}
- if err := json.Unmarshal([]byte(string(body3)), &respJSON3); err != nil {
- utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
-
- respJSON3 = respJSON3["data"].(map[string]interface{})["pre"].(map[string]interface{})
- userJSONBytes3, _ := json.Marshal(respJSON3)
- if err := json.Unmarshal(userJSONBytes3, &resSix10265); err != nil {
- utils.ErrorLog("解析失败:%v", err)
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
-
- res2.InfRefmsgid = resSix10265.InfRefmsgid
- // res2.Output = resSix10265.Output
- res2.ErrMsg = resSix10265.ErrMsg
- res2.Cainfo = resSix10265.Cainfo
- res2.WarnMsg = resSix10265.WarnMsg
- infocode, _ := strconv.ParseInt(resSix10265.Infcode, 10, 64)
- res2.Infcode = infocode
-
- } else {
- var api3 string
-
- if miConfig.Code == "H15049901371" {
-
- api3 = "http://127.0.0.1:9532/" + "gdyb/three?psn_no=" + his.PsnNo +
- "&mdtrt_id=" + his.Number + "&ipt_otp_no=" + his.IptOtpNo + "&doctor=" + roles.UserName + "&org_name=" + miConfig.OrgName + "&fixmedins_code=" + miConfig.Code +
- "&insuplc_admdvs=" + his.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey
- } else {
- api3 = "http://127.0.0.1:9532/" + "gdyb/three?psn_no=" + his.PsnNo +
- "&mdtrt_id=" + his.Number + "&ipt_otp_no=" + his.IptOtpNo + "&doctor=" + roles.UserName + "&org_name=" + miConfig.OrgName + "&fixmedins_code=" + miConfig.Code +
- "&insuplc_admdvs=" + his.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey
-
- }
-
- resp3, requestErr3 := http.Get(api3)
- if requestErr3 != nil {
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
-
- body3, ioErr3 := ioutil.ReadAll(resp3.Body)
- if ioErr3 != nil {
- utils.ErrorLog("接口返回数据读取失败: %v", ioErr3)
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
- var respJSON3 map[string]interface{}
- if err := json.Unmarshal([]byte(string(body3)), &respJSON3); err != nil {
- utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
-
- respJSON3 = respJSON3["data"].(map[string]interface{})["pre"].(map[string]interface{})
- userJSONBytes3, _ := json.Marshal(respJSON3)
-
- if miConfig.Code == "H15049901371" {
- if err := json.Unmarshal(userJSONBytes3, &resSix10265); err != nil {
- utils.ErrorLog("解析失败:%v", err)
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
- res2.InfRefmsgid = resSix10265.InfRefmsgid
- // res2.Output = resSix10265.Output
- res2.ErrMsg = resSix10265.ErrMsg
- res2.Cainfo = resSix10265.Cainfo
- res2.WarnMsg = resSix10265.WarnMsg
- infocode, _ := strconv.ParseInt(resSix10265.Infcode, 10, 64)
- res2.Infcode = infocode
- } else {
-
- if err := json.Unmarshal(userJSONBytes3, &res2); err != nil {
- utils.ErrorLog("解析失败:%v", err)
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
- }
-
- }
-
- if res2.Infcode == 0 {
- if err == nil {
- c.ServeSuccessJSON(map[string]interface{}{
- "msg": "退号成功",
- })
- service.UpdataRegStatusTwo(his_patient_id, recordDateTime, adminUser.CurrentOrgId)
-
- } else {
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
-
- } else {
- c.ServeSuccessJSON(map[string]interface{}{
- "code": -10,
- "msg": res2.ErrMsg,
- })
-
- }
-
- } else {
- //err := service.UpdataOrderStatus(order_id, number, adminUser.CurrentOrgId)
- //if err == nil {
- // c.ServeSuccessJSON(map[string]interface{}{
- // "msg": "退费成功",
- // })
- //} else {
- // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- // return
- //}
- }
- }
- func (c *HisApiController) RefundDetail() {
- order_id, _ := c.GetInt64("order_id")
- admin_user_id, _ := c.GetInt64("admin_user_id")
-
- //his_patient_id, _ := c.GetInt64("his_patient_id")
-
- number := c.GetString("number")
- record_time := c.GetString("record_time")
- patient_id, _ := c.GetInt64("patient_id")
- //med_type, _ := c.GetInt64("med_type")
-
- timeLayout := "2006-01-02"
- loc, _ := time.LoadLocation("Local")
- adminUser := c.GetAdminUserInfo()
- roles, _ := service.GetAdminUserInfoByID(adminUser.CurrentOrgId, admin_user_id)
- theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", record_time+" 00:00:00", loc)
- fmt.Println(err)
- if err != nil {
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
- return
- }
- recordDateTime := theTime.Unix()
- //his, _ := service.GetNewVMHisPatientInfo(adminUser.CurrentOrgId, his_patient_id, recordDateTime)
-
- patientPrescription, _ := service.FindPatientPrescriptionInfo(adminUser.CurrentOrgId, patient_id, recordDateTime)
- miConfig, _ := service.FindMedicalInsuranceInfo(adminUser.CurrentOrgId)
- config, _ := service.GetMedicalInsuranceConfig(adminUser.CurrentOrgId)
-
- var order models.HisOrder
- order, _ = service.GetHisOrderByID(order_id)
- his, _ := service.GetHisPatientByNumber(order.MdtrtId)
- if config.IsOpen == 1 { //对接了医保,走医保流程
- var res2 ResultSix
-
- if miConfig.MdtrtareaAdmvs == "421300" {
- api3 := "http://192.168.124.4:9532/" + "hbyb/2205?psn_no=" + order.PsnNo +
- "&mdtrt_id=" + order.MdtrtId + "&chrg_bchno=" + order.Number + "&doctor=" + patientPrescription.Doctor + "&org_name=" + miConfig.OrgName + "&fixmedins_code=" + miConfig.Code +
- "&insuplc_admdvs=" + his.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey
- resp3, requestErr3 := http.Get(api3)
- if requestErr3 != nil {
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
- body3, ioErr3 := ioutil.ReadAll(resp3.Body)
- if ioErr3 != nil {
- utils.ErrorLog("接口返回数据读取失败: %v", ioErr3)
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
- var respJSON3 map[string]interface{}
- if err := json.Unmarshal([]byte(string(body3)), &respJSON3); err != nil {
- utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
-
- respJSON3 = respJSON3["data"].(map[string]interface{})["pre"].(map[string]interface{})
- userJSONBytes3, _ := json.Marshal(respJSON3)
- fmt.Println("log")
- fmt.Println(string(userJSONBytes3))
- if err := json.Unmarshal(userJSONBytes3, &res2); err != nil {
- utils.ErrorLog("解析失败:%v", err)
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
-
- err := service.UpdataOrderStatus(order_id, number, adminUser.CurrentOrgId, "", "")
- if err == nil {
- c.ServeSuccessJSON(map[string]interface{}{
- "msg": "撤销明细成功",
- })
- return
- } else {
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
- } else if miConfig.MdtrtareaAdmvs == "320921" || miConfig.MdtrtareaAdmvs == "320982" {
- var resSix10265 ResultSix10265
-
- var api3 string
- if miConfig.MdtrtareaAdmvs == "320921" {
- api3 = "http://192.168.3.111:9532/" + "jsyb/2205?psn_no=" + order.PsnNo +
- "&mdtrt_id=" + order.MdtrtId + "&chrg_bchno=" + order.Number + "&doctor=" + patientPrescription.Doctor + "&org_name=" + miConfig.OrgName + "&fixmedins_code=" + miConfig.Code +
- "&insuplc_admdvs=" + his.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey + "&url=" + miConfig.Url + "&ak=" + miConfig.AccessKey + "&cainfo=" + miConfig.Cainfo
-
- //req, _ = http.NewRequest("POST", "http://192.168.3.111:9532/"+"jsyb/2204", bytes.NewReader(bytesData))
-
- } else {
- //req, _ = http.NewRequest("POST", "http://192.168.5.251:9532/"+"jsyb/2204", bytes.NewReader(bytesData))
- api3 = "http://192.168.5.251:9532/" + "jsyb/2205?psn_no=" + order.PsnNo +
- "&mdtrt_id=" + order.MdtrtId + "&chrg_bchno=" + order.Number + "&doctor=" + patientPrescription.Doctor + "&org_name=" + miConfig.OrgName + "&fixmedins_code=" + miConfig.Code +
- "&insuplc_admdvs=" + his.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey + "&url=" + miConfig.Url + "&ak=" + miConfig.AccessKey + "&cainfo=" + miConfig.Cainfo
-
- }
-
- resp3, requestErr3 := http.Get(api3)
- if requestErr3 != nil {
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
- body3, ioErr3 := ioutil.ReadAll(resp3.Body)
- if ioErr3 != nil {
- utils.ErrorLog("接口返回数据读取失败: %v", ioErr3)
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
- var respJSON3 map[string]interface{}
- if err := json.Unmarshal([]byte(string(body3)), &respJSON3); err != nil {
- utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
-
- respJSON3 = respJSON3["data"].(map[string]interface{})["pre"].(map[string]interface{})
- userJSONBytes3, _ := json.Marshal(respJSON3)
- fmt.Println("log")
- fmt.Println(string(userJSONBytes3))
- if err := json.Unmarshal(userJSONBytes3, &resSix10265); err != nil {
- utils.ErrorLog("解析失败:%v", err)
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
-
- res2.InfRefmsgid = resSix10265.InfRefmsgid
- // res2.Output = resSix10265.Output
- res2.ErrMsg = resSix10265.ErrMsg
- res2.Cainfo = resSix10265.Cainfo
- res2.WarnMsg = resSix10265.WarnMsg
- infocode, _ := strconv.ParseInt(resSix10265.Infcode, 10, 64)
- res2.Infcode = infocode
-
- err := service.UpdataOrderStatus(order_id, number, adminUser.CurrentOrgId, "", "")
- if err == nil {
- c.ServeSuccessJSON(map[string]interface{}{
- "msg": "撤销明细成功",
- })
- return
- } else {
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
- } else {
- order_infos, _ := service.GetHisOrderInfoByNumberFour(order.Number)
- for _, item := range order_infos {
- result2, src_request := service.Gdyb2205ForGz(order.PsnNo, order.MdtrtId, item.FeedetlSn, miConfig.OrgName, roles.UserName, his.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, miConfig.Code)
- var dat map[string]interface{}
- if err := json.Unmarshal([]byte(result2), &dat); err == nil {
- fmt.Println(dat)
- } else {
- fmt.Println(err)
- }
-
- saveLog(result2, src_request, "2205", "撤销明细")
- userJSONBytes, _ := json.Marshal(dat)
- if err := json.Unmarshal(userJSONBytes, &res2); err != nil {
- utils.ErrorLog("解析失败:%v", err)
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
- }
- }
-
- }
- }
-
- //对账
- func (c *HisApiController) GetCheckAccount() {
- start_time := c.GetString("start_time")
- end_time := c.GetString("end_time")
- insutype := c.GetString("insutype")
- clr_type := c.GetString("clr_type")
- clr_org := c.GetString("clr_optins")
-
- admin_user_id, _ := c.GetInt64("admin_user_id")
-
- adminUser := c.GetAdminUserInfo()
- miConfig, _ := service.FindMedicalInsuranceInfo(adminUser.CurrentOrgId)
- config, _ := service.GetMedicalInsuranceConfig(adminUser.CurrentOrgId)
- if len(clr_org) == 0 {
- clr_org = miConfig.MdtrtareaAdmvs
- }
- timeLayout := "2006-01-02"
- loc, _ := time.LoadLocation("Local")
- startime, _ := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
- endtime, _ := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
- orders, _ := service.GetOrderByTime(startime.Unix(), endtime.Unix(), adminUser.CurrentOrgId, insutype, "", clr_type)
- fixmedins_setl_cnt := int64(len(orders))
- var medfee_sumamt float64
- var acct_pay float64
- var fund_pay_sumamt float64
- for _, item := range orders {
- medfee_sumamt = medfee_sumamt + item.MedfeeSumamt
- acct_pay = acct_pay + item.AcctPay
- fund_pay_sumamt = fund_pay_sumamt + item.FundPaySumamt
- }
- var user_name string
- role, _ := service.GetAdminUserInfoByID(adminUser.CurrentOrgId, admin_user_id)
- if role.ID == 0 {
- user_name = "xxx"
- } else {
- user_name = role.UserName
- }
- var res ResultEight
- var res10188 ResultEightFor10188
- if config.IsOpen == 1 {
- if miConfig.MdtrtareaAdmvs == "320921" || miConfig.MdtrtareaAdmvs == "320982" {
- api := "http://192.168.3.111:9532/" + "jsyb/3201?" +
- "insutype=" + insutype +
- "&clr_type=" + "11" +
- "&setl_optins=" + clr_org +
- "&stmt_begndate=" + start_time +
- "&stm_enddate=" + end_time +
- "&medfee_sumamt=" + fmt.Sprintf("%.4f", medfee_sumamt) +
- "&fund_pay_sumamt=" + fmt.Sprintf("%.4f", fund_pay_sumamt) +
- "&acct_pay=" + fmt.Sprintf("%.4f", acct_pay) +
- "&fixmedins_setl_cnt=" + strconv.FormatInt(fixmedins_setl_cnt, 10) +
- "&fixmedins_code=" + miConfig.Code +
- "&insuplc_admdvs=" + miConfig.InsuplcAdmdvs +
- "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs +
- "&secret_key=" + miConfig.SecretKey +
- "&org_name=" + miConfig.OrgName +
- "&doctor=" + user_name +
- "&url=" + miConfig.Url + "&ak=" + miConfig.AccessKey + "&cainfo=" + miConfig.Cainfo
-
- fmt.Println(api)
- resp, requestErr := http.Get(api)
- if requestErr != nil {
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
- body, ioErr := ioutil.ReadAll(resp.Body)
- fmt.Println(body)
- if ioErr != nil {
- utils.ErrorLog("接口返回数据读取失败: %v", ioErr)
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
- var respJSON map[string]interface{}
- if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
- utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
- respJSON = respJSON["data"].(map[string]interface{})["pre"].(map[string]interface{})
- userJSONBytes, _ := json.Marshal(respJSON)
- if err := json.Unmarshal(userJSONBytes, &res); err != nil {
- utils.ErrorLog("解析失败:%v", err)
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
-
- res.InfRefmsgid = res10188.InfRefmsgid
- res.Output = res10188.Output
- res.ErrMsg = res10188.ErrMsg
- res.Cainfo = res10188.Cainfo
- res.WarnMsg = res10188.WarnMsg
- infocode, _ := strconv.ParseInt(res10188.Infcode, 10, 64)
- res.Infcode = infocode
-
- } else if miConfig.MdtrtareaAdmvs == "150499" {
-
- api := "http://172.16.13.254:9532/" + "nmyb/3201?" +
- "insutype=" + insutype +
- "&clr_type=" + "21" +
- "&setl_optins=" + clr_org +
- "&stmt_begndate=" + start_time +
- "&stm_enddate=" + end_time +
- "&medfee_sumamt=" + fmt.Sprintf("%.4f", medfee_sumamt) +
- "&fund_pay_sumamt=" + fmt.Sprintf("%.4f", fund_pay_sumamt) +
- "&acct_pay=" + fmt.Sprintf("%.4f", acct_pay) +
- "&fixmedins_setl_cnt=" + strconv.FormatInt(fixmedins_setl_cnt, 10) +
- "&fixmedins_code=" + miConfig.Code +
- "&insuplc_admdvs=" + miConfig.InsuplcAdmdvs +
- "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs +
- "&secret_key=" + miConfig.SecretKey +
- "&org_name=" + miConfig.OrgName +
- "&doctor=" + user_name
- resp, requestErr := http.Get(api)
- if requestErr != nil {
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
- body, ioErr := ioutil.ReadAll(resp.Body)
- if ioErr != nil {
- utils.ErrorLog("接口返回数据读取失败: %v", ioErr)
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
- var respJSON map[string]interface{}
- if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
- utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
-
- respJSON = respJSON["data"].(map[string]interface{})["pre"].(map[string]interface{})
- result, _ := json.Marshal(respJSON)
- fmt.Println("log")
- fmt.Println(string(result))
- if err := json.Unmarshal([]byte(result), &res10188); err != nil {
- utils.ErrorLog("解析失败:%v", err)
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
-
- res.InfRefmsgid = res10188.InfRefmsgid
- res.Output = res10188.Output
- res.ErrMsg = res10188.ErrMsg
- res.Cainfo = res10188.Cainfo
- res.WarnMsg = res10188.WarnMsg
- infocode, _ := strconv.ParseInt(res10188.Infcode, 10, 64)
- res.Infcode = infocode
-
- } else {
- api := "http://127.0.0.1:9532/" + "gdyb/ten?" +
- "insutype=" + insutype +
- "&clr_type=" + clr_type +
- "&setl_optins=" + "440104" +
- "&stmt_begndate=" + start_time +
- "&stm_enddate=" + end_time +
- "&medfee_sumamt=" + fmt.Sprintf("%.4f", medfee_sumamt) +
- "&fund_pay_sumamt=" + fmt.Sprintf("%.4f", fund_pay_sumamt) +
- "&acct_pay=" + fmt.Sprintf("%.4f", acct_pay) +
- "&fixmedins_setl_cnt=" + strconv.FormatInt(fixmedins_setl_cnt, 10) +
- "&fixmedins_code=" + miConfig.Code +
- "&insuplc_admdvs=" + miConfig.InsuplcAdmdvs +
- "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs +
- "&secret_key=" + miConfig.SecretKey +
- "&org_name=" + miConfig.OrgName +
- "&doctor=" + user_name
-
- fmt.Println(api)
- resp, requestErr := http.Get(api)
- if requestErr != nil {
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
- body, ioErr := ioutil.ReadAll(resp.Body)
- fmt.Println(body)
- if ioErr != nil {
- utils.ErrorLog("接口返回数据读取失败: %v", ioErr)
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
- var respJSON map[string]interface{}
- if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
- utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
- respJSON = respJSON["data"].(map[string]interface{})["pre"].(map[string]interface{})
- userJSONBytes, _ := json.Marshal(respJSON)
- if err := json.Unmarshal(userJSONBytes, &res); err != nil {
- utils.ErrorLog("解析失败:%v", err)
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
- }
-
- if res.Infcode == 0 {
- if res.Output.Stmtinfo.StmtRslt == "0" {
- micc := &models.MedicalInsuranceCostCompare{
- StartTime: startime.Unix(),
- EndTime: endtime.Unix(),
- Insutype: insutype,
- CheckType: 1,
- Num: fixmedins_setl_cnt,
- Mtime: time.Now().Unix(),
- Status: 1,
- UserOrgId: adminUser.CurrentOrgId,
- CostTotal: medfee_sumamt,
- FuncTotal: fund_pay_sumamt,
- PsnPay: acct_pay,
- Creator: admin_user_id,
- Ctime: time.Now().Unix(),
- ClrType: clr_type,
- }
- err := service.CreateMedicalInsuranceCostCompareRecord(micc)
- if err == nil {
- c.ServeSuccessJSON(map[string]interface{}{
- "stmt_rslt": res.Output.Stmtinfo.StmtRslt,
- "stmt_rslt_dscr": res.Output.Stmtinfo.StmtRsltDscr,
- })
- } else {
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- }
- } else {
- c.ServeSuccessJSON(map[string]interface{}{
- "stmt_rslt": res.Output.Stmtinfo.StmtRslt,
- "stmt_rslt_dscr": res.Output.Stmtinfo.StmtRsltDscr,
- })
- }
- } else {
- c.ServeSuccessJSON(map[string]interface{}{
- "code": -10,
- "msg": res.ErrMsg,
- })
-
- }
- }
- }
-
- func (c *HisApiController) Check310() {
-
- adminUser := c.GetAdminUserInfo()
- miConfig, _ := service.FindMedicalInsuranceInfo(adminUser.CurrentOrgId)
-
- var user_name string
- user_name = "高慧裕"
- api := "http://127.0.0.1:9532/" + "gdyb/ten?" +
- "insutype=" + "310" +
- "&clr_type=" + "" +
- "&setl_optins=" + "441202" +
- "&stmt_begndate=" + "2022-03-01" +
- "&stm_enddate=" + "2022-03-31" +
- "&medfee_sumamt=" + "194930.12" +
- "&fund_pay_sumamt=" + "188741.46" +
- "&acct_pay=" + "0" +
- "&fixmedins_setl_cnt=" + "452" +
- "&fixmedins_code=" + miConfig.Code +
- "&insuplc_admdvs=" + miConfig.InsuplcAdmdvs +
- "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs +
- "&secret_key=" + miConfig.SecretKey +
- "&org_name=" + miConfig.OrgName +
- "&doctor=" + user_name
-
- fmt.Println(api)
- resp, requestErr := http.Get(api)
- if requestErr != nil {
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
- body, ioErr := ioutil.ReadAll(resp.Body)
- fmt.Println(body)
- if ioErr != nil {
- utils.ErrorLog("接口返回数据读取失败: %v", ioErr)
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
- var respJSON map[string]interface{}
- if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
- utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
-
- respJSON = respJSON["data"].(map[string]interface{})["pre"].(map[string]interface{})
- userJSONBytes, _ := json.Marshal(respJSON)
-
- var res ResultEight
- if err := json.Unmarshal(userJSONBytes, &res); err != nil {
- utils.ErrorLog("解析失败:%v", err)
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
-
- }
- func (c *HisApiController) Check390() {
-
- adminUser := c.GetAdminUserInfo()
- miConfig, _ := service.FindMedicalInsuranceInfo(adminUser.CurrentOrgId)
-
- var user_name string
- user_name = "高慧裕"
- api := "http://127.0.0.1:9532/" + "gdyb/ten?" +
- "insutype=" + "390" +
- "&clr_type=" + "" +
- "&setl_optins=" + "441202" +
- "&stmt_begndate=" + "2022-03-01" +
- "&stm_enddate=" + "2022-03-31" +
- "&medfee_sumamt=" + "1068448.89" +
- "&fund_pay_sumamt=" + "1014677.62" +
- "&acct_pay=" + "0" +
- "&fixmedins_setl_cnt=" + "1950" +
- "&fixmedins_code=" + miConfig.Code +
- "&insuplc_admdvs=" + miConfig.InsuplcAdmdvs +
- "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs +
- "&secret_key=" + miConfig.SecretKey +
- "&org_name=" + miConfig.OrgName +
- "&doctor=" + user_name
-
- fmt.Println(api)
- resp, requestErr := http.Get(api)
- if requestErr != nil {
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
- body, ioErr := ioutil.ReadAll(resp.Body)
- fmt.Println(body)
- if ioErr != nil {
- utils.ErrorLog("接口返回数据读取失败: %v", ioErr)
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
- var respJSON map[string]interface{}
- if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
- utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
-
- respJSON = respJSON["data"].(map[string]interface{})["pre"].(map[string]interface{})
- userJSONBytes, _ := json.Marshal(respJSON)
-
- var res ResultEight
- if err := json.Unmarshal(userJSONBytes, &res); err != nil {
- utils.ErrorLog("解析失败:%v", err)
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
-
- }
-
- //对账明细
- func (c *HisApiController) GetCheckDetailAccount() {
- start_time := c.GetString("start_time")
- end_time := c.GetString("end_time")
- admin_user_id, _ := c.GetInt64("admin_user_id")
-
- adminUser := c.GetAdminUserInfo()
- miConfig, _ := service.FindMedicalInsuranceInfo(adminUser.CurrentOrgId)
- config, _ := service.GetMedicalInsuranceConfig(adminUser.CurrentOrgId)
-
- timeLayout := "2006-01-02"
- loc, _ := time.LoadLocation("Local")
- startime, _ := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
- endtime, _ := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
- orders, _ := service.GetOrderByTimeTwo(startime.Unix(), endtime.Unix(), adminUser.CurrentOrgId)
-
- rand.Seed(time.Now().UnixNano())
-
- num := rand.Intn(30000)
- Mkdir(miConfig.OrgName)
- file := strconv.FormatInt(int64(num), 10)
- file_name := file + ".txt"
- zip_name := file + ".zip"
- zip_path := miConfig.OrgName + "/" + zip_name
- file_path := miConfig.OrgName + "/" + file_name
-
- decimal.DivisionPrecision = 2
- var medfee_sumamt float64
- var psn_cash_pay float64
- var fund_pay_sumamt float64
- fixmedins_setl_cnt := int64(len(orders))
-
- for _, item := range orders {
- medfee_sumamt = medfee_sumamt + item.MedfeeSumamt
- psn_cash_pay = psn_cash_pay + item.PsnCashPay
- fund_pay_sumamt = fund_pay_sumamt + item.FundPaySumamt
- }
-
- f, err := os.Create(miConfig.OrgName + "/" + file_name)
- defer f.Close()
- if err != nil {
- fmt.Println(err.Error())
- } else {
- for _, item := range orders {
- var refd_setl_flag string
- if item.OrderStatus == 2 {
- refd_setl_flag = "0"
- var str string
- str = item.SetlId + " " +
- item.MdtrtId + " " +
- item.PsnNo + " " +
- fmt.Sprintf("%.4f", item.MedfeeSumamt) + " " +
- fmt.Sprintf("%.4f", item.FundPaySumamt) + " " +
- fmt.Sprintf("%.4f", item.AcctPay) + " " + refd_setl_flag + "\r\n"
- _, err = f.Write([]byte(str))
- }
- if item.OrderStatus == 3 {
-
- var str string
- str = item.SetlId + " " +
- item.MdtrtId + " " +
- item.PsnNo + " " +
- fmt.Sprintf("%.4f", item.MedfeeSumamt) + " " +
- fmt.Sprintf("%.4f", item.FundPaySumamt) + " " +
- fmt.Sprintf("%.4f", item.AcctPay) + " " + "1" + "\r\n"
- _, err = f.Write([]byte(str))
-
- var str2 string
- str2 = item.SetlId + " " +
- item.MdtrtId + " " +
- item.PsnNo + " " +
- fmt.Sprintf("%.4f", 0-item.MedfeeSumamt) + " " +
- fmt.Sprintf("%.4f", 0-item.FundPaySumamt) + " " +
- fmt.Sprintf("%.4f", 0-item.AcctPay) + " " + "1" + "\r\n"
- _, err = f.Write([]byte(str2))
- }
-
- }
-
- }
- Zip(file_path, zip_path)
- fmt.Println(ReadFile(zip_path))
- fmt.Println(string(ReadFile(zip_path)))
-
- if config.IsOpen == 1 {
-
- var user_name string
- role, _ := service.GetAdminUserInfoByID(adminUser.CurrentOrgId, admin_user_id)
- if role.ID == 0 {
- user_name = "管理员"
- } else {
- user_name = role.UserName
- }
-
- baseParams := models.BaseParams{
- SecretKey: miConfig.SecretKey,
- FixmedinsCode: miConfig.Code,
- InsuplcAdmdvs: miConfig.InsuplcAdmdvs,
- MdtrtareaAdmvs: miConfig.MdtrtareaAdmvs,
- OrgName: miConfig.OrgName,
- Doctor: user_name,
- }
-
- result := service.Gdyb9101(baseParams, file_name, ReadFile(file_path))
-
- var dat map[string]interface{}
- if err := json.Unmarshal([]byte(result), &dat); err == nil {
- fmt.Println(dat)
- } else {
- fmt.Println(err)
- }
-
- userJSONBytes, _ := json.Marshal(dat)
-
- var res ResultNine
- if err := json.Unmarshal(userJSONBytes, &res); err != nil {
- utils.ErrorLog("解析失败:%v", err)
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
-
- if res.Infcode == 0 {
- fileNo := res.Output.FileQuryNo
- api := "http://127.0.0.1:9532/" + "gdyb/twelve?" +
- "file_qury_no=" + fileNo +
- "&setl_optins=" + "定点医保中心" +
- "&stmt_begndate=" + start_time +
- "&stm_enddate=" + end_time +
- "&medfee_sumamt=" + fmt.Sprintf("%.4f", medfee_sumamt) +
- "&fund_pay_sumamt=" + fmt.Sprintf("%.4f", fund_pay_sumamt) +
- "&cash_payamt=" + fmt.Sprintf("%.4f", psn_cash_pay) +
- "&fixmedins_setl_cnt=" + strconv.FormatInt(fixmedins_setl_cnt, 10) +
- "&fixmedins_code=" + miConfig.Code +
- "&insuplc_admdvs=" + miConfig.InsuplcAdmdvs +
- "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs +
- "&secret_key=" + miConfig.SecretKey +
- "&org_name=" + miConfig.OrgName +
- "&doctor=" + user_name
- resp, requestErr := http.Get(api)
- if requestErr != nil {
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
- body, ioErr := ioutil.ReadAll(resp.Body)
- if ioErr != nil {
- utils.ErrorLog("接口返回数据读取失败: %v", ioErr)
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
- var respJSON map[string]interface{}
- if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
- utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
- respJSON = respJSON["data"].(map[string]interface{})["pre"].(map[string]interface{})
-
- userJSONBytes, _ := json.Marshal(respJSON)
- var res ResultTen
- if err := json.Unmarshal(userJSONBytes, &res); err != nil {
- utils.ErrorLog("解析失败:%v", err)
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
-
- if res.Infcode == 0 {
- service.Gdyb9102(baseParams, zip_name, fileNo)
-
- micc := &models.MedicalInsuranceCostCompare{
- StartTime: startime.Unix(),
- EndTime: endtime.Unix(),
- Insutype: "0",
- CheckType: 2,
- Num: fixmedins_setl_cnt,
- Mtime: time.Now().Unix(),
- Status: 1,
- UserOrgId: adminUser.CurrentOrgId,
- CostTotal: medfee_sumamt,
- FuncTotal: fund_pay_sumamt,
- PsnPay: psn_cash_pay,
- Creator: admin_user_id,
- Ctime: time.Now().Unix(),
- }
-
- service.CreateMedicalInsuranceCostCompareRecord(micc)
-
- c.ServeSuccessJSON(map[string]interface{}{
- "msg": "明细对账成功",
- })
- }
-
- } else {
-
- }
- }
- }
-
- type CustomOrderInfo struct {
- Name string
- Spec string
- Unit string
- Count float64
- Price float64
- Total float64
- }
-
- func (c *HisApiController) GetSettleAccounts() {
- //id, _ := c.GetInt64("id")
- //record_time := c.GetString("record_time")
- order_id, _ := c.GetInt64("order_id")
- admin_user_id, _ := c.GetInt64("admin_user_id")
-
- //timeLayout := "2006-01-02"
- //loc, _ := time.LoadLocation("Local")
- //
- //theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", record_time+" 00:00:00", loc)
- //if err != nil {
- // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
- // return
- //}
- //recordDateTime := theTime.Unix()
- adminUser := c.GetAdminUserInfo()
- order, _ := service.GetHisOrderByID(order_id)
- his, _ := service.GetHisPatientByNumber(order.MdtrtId)
- orderInfos, _ := service.GetHisOrderInfoByNumber(order.Number)
- orderInfos_two, _ := service.GetHisOrderInfoByNumberTwo(order.Number)
- orderInfos = append(orderInfos, orderInfos_two...)
- his_hospital, _ := service.GetInHospitalRecordByNumber(order.MdtrtId)
- //diagnosisConfig, _ := service.FindDiagnoseById(his.Diagnosis)
- var diagnosis_ids []string
- if his.ID > 0 {
- diagnosis_ids = strings.Split(his.Diagnosis, ",")
-
- } else {
- diagnosis_ids = strings.Split(his_hospital.Diagnosis, ",")
-
- }
- patient, _ := service.GetPatientByIDTwo(adminUser.CurrentOrgId, order.PatientId)
- var dia_config []*models.HisXtDiagnoseConfig
- var name string
- for _, item := range diagnosis_ids {
- id, _ := strconv.ParseInt(item, 10, 64)
- diagnosisConfig, _ := service.FindDiagnoseById(id)
- dia_config = append(dia_config, &diagnosisConfig)
- if len(name) == 0 {
- name = diagnosisConfig.ClassName
-
- } else {
- name = name + "," + diagnosisConfig.ClassName
- }
- }
-
- var bedCostTotal float64 = 0 //床位总费
- var bedCostSelfTotal float64 = 0 //床位自费
- var bedCostPartSelfTotal float64 = 0 //床位部分项目自费
-
- var operationCostTotal float64 = 0 //手术费
- var operationCostSelfTotal float64 = 0 //手术费
- var operationCostPartSelfTotal float64 = 0 //手术费
-
- var otherCostTotal float64 = 0 //其他费用
- var otherCostSelfTotal float64 = 0 //其他费用
- var otherCostPartSelfTotal float64 = 0 //其他费用
-
- var materialCostTotal float64 = 0 //材料费
- var materialCostSelfTotal float64 = 0 //材料费
- var materialCostPartSelfTotal float64 = 0 //材料费
-
- var westernMedicineCostTotal float64 = 0 //西药费
- var westernMedicineCostSelfTotal float64 = 0 //西药费
- var westernMedicineCostPartSelfTotal float64 = 0 //西药费
-
- var chineseTraditionalMedicineCostTotal float64 = 0 //中成药
- var chineseTraditionalMedicineCostSelfTotal float64 = 0 //中成药
- var chineseTraditionalMedicineCostPartSelfTotal float64 = 0 //中成药
-
- var checkCostTotal float64 = 0 //检查费
- var checkCostSelfTotal float64 = 0 //检查费
- var checkCostPartSelfTotal float64 = 0 //检查费
-
- var laboratoryCostTotal float64 = 0 //化验费
- var laboratoryCostSelfTotal float64 = 0 //化验费
- var laboratoryCostPartSelfTotal float64 = 0 //化验费
-
- var treatCostTotal float64 = 0 //治疗费用
- var treatCostSelfTotal float64 = 0 //治疗费用
- var treatCostPartSelfTotal float64 = 0 //治疗费用
-
- decimal.DivisionPrecision = 2
-
- for _, item := range orderInfos {
- if item.MedChrgitmType == "01" { //床位费
- bedCostTotal, _ = decimal.NewFromFloat(bedCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
- bedCostSelfTotal, _ = decimal.NewFromFloat(bedCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
- bedCostPartSelfTotal, _ = decimal.NewFromFloat(bedCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
- }
-
- if c.GetAdminUserInfo().CurrentOrgId == 10188 || c.GetAdminUserInfo().CurrentOrgId == 10217 {
- if item.MedChrgitmType == "03" { //检查费
- laboratoryCostTotal, _ = decimal.NewFromFloat(laboratoryCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
- laboratoryCostSelfTotal, _ = decimal.NewFromFloat(laboratoryCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
- laboratoryCostPartSelfTotal, _ = decimal.NewFromFloat(laboratoryCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
- }
- } else {
-
- if item.MedChrgitmType == "03" { //检查费
- checkCostTotal, _ = decimal.NewFromFloat(checkCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
- checkCostSelfTotal, _ = decimal.NewFromFloat(checkCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
- checkCostPartSelfTotal, _ = decimal.NewFromFloat(checkCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
- }
-
- }
-
- if item.MedChrgitmType == "04" { //化验费
- laboratoryCostTotal, _ = decimal.NewFromFloat(laboratoryCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
- laboratoryCostSelfTotal, _ = decimal.NewFromFloat(laboratoryCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
- laboratoryCostPartSelfTotal, _ = decimal.NewFromFloat(laboratoryCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
-
- }
-
- if item.MedChrgitmType == "05" || item.MedChrgitmType == "1402" || item.MedChrgitmType == "1403" { //治疗费
-
- treatCostTotal, _ = decimal.NewFromFloat(treatCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
- treatCostSelfTotal, _ = decimal.NewFromFloat(treatCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
- treatCostPartSelfTotal, _ = decimal.NewFromFloat(treatCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
-
- }
-
- if item.MedChrgitmType == "06" { //手术费
- operationCostTotal, _ = decimal.NewFromFloat(operationCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
- operationCostSelfTotal, _ = decimal.NewFromFloat(operationCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
- operationCostPartSelfTotal, _ = decimal.NewFromFloat(operationCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
- }
-
- if item.MedChrgitmType == "08" { //材料费
- materialCostTotal, _ = decimal.NewFromFloat(materialCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
- materialCostSelfTotal, _ = decimal.NewFromFloat(materialCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
- materialCostPartSelfTotal, _ = decimal.NewFromFloat(materialCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
- }
-
- if item.MedChrgitmType == "09" { //西药费
- westernMedicineCostTotal, _ = decimal.NewFromFloat(westernMedicineCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
- westernMedicineCostSelfTotal, _ = decimal.NewFromFloat(westernMedicineCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
- westernMedicineCostPartSelfTotal, _ = decimal.NewFromFloat(westernMedicineCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
- }
-
- if item.MedChrgitmType == "11" { //中成费
- chineseTraditionalMedicineCostTotal, _ = decimal.NewFromFloat(chineseTraditionalMedicineCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
- chineseTraditionalMedicineCostSelfTotal, _ = decimal.NewFromFloat(chineseTraditionalMedicineCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
- chineseTraditionalMedicineCostPartSelfTotal, _ = decimal.NewFromFloat(chineseTraditionalMedicineCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
- }
-
- if item.MedChrgitmType == "14" || item.MedChrgitmType == "0" || item.MedChrgitmType == "12" || item.MedChrgitmType == "02" { //其他费
- otherCostTotal, _ = decimal.NewFromFloat(otherCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
- otherCostSelfTotal, _ = decimal.NewFromFloat(otherCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
- otherCostPartSelfTotal, _ = decimal.NewFromFloat(otherCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
- }
- }
-
- miConfig, _ := service.FindMedicalInsuranceInfo(adminUser.CurrentOrgId)
- config, _ := service.GetMedicalInsuranceConfig(adminUser.CurrentOrgId)
-
- var user_name string
- role, _ := service.GetAdminUserInfoByID(adminUser.CurrentOrgId, admin_user_id)
- if role.ID == 0 {
- user_name = "管理员"
- } else {
- user_name = role.UserName
- }
-
- baseParams := models.BaseParams{
- SecretKey: miConfig.SecretKey,
- FixmedinsCode: miConfig.Code,
- InsuplcAdmdvs: miConfig.InsuplcAdmdvs,
- MdtrtareaAdmvs: miConfig.MdtrtareaAdmvs,
- OrgName: miConfig.OrgName,
- Doctor: user_name,
- }
-
- businessParams := models.BusinessParams{
- PsnNo: order.PsnNo,
- MdtrtId: order.MdtrtId,
- SetlId: order.SetlId,
- }
- var res ResultEleven
- var resEleven10265 ResultEleven10265
-
- if config.IsOpen == 1 {
- if miConfig.MdtrtareaAdmvs == "421300" {
-
- api := "http://192.168.124.4:9532/" + "hbyb/5203?psn_no=" + businessParams.PsnNo + "&mdtrt_id=" + businessParams.MdtrtId + "&setl_id=" + businessParams.SetlId +
- "&org_name=" + miConfig.OrgName + "&doctor=" + baseParams.Doctor + "&fixmedins_code=" + miConfig.Code +
- "&insuplc_admdvs=" + miConfig.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey
- resp, requestErr := http.Get(api)
- if requestErr != nil {
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
-
- body, ioErr := ioutil.ReadAll(resp.Body)
- if ioErr != nil {
- utils.ErrorLog("接口返回数据读取失败: %v", ioErr)
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
- var respJSON map[string]interface{}
- if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
- utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
-
- respJSON = respJSON["data"].(map[string]interface{})["pre"].(map[string]interface{})
- result, _ := json.Marshal(respJSON)
- fmt.Println("log")
- fmt.Println(string(result))
- if err := json.Unmarshal([]byte(result), &res); err != nil {
- utils.ErrorLog("解析失败:%v", err)
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
-
- } else if miConfig.MdtrtareaAdmvs == "320921" || miConfig.MdtrtareaAdmvs == "320982" {
-
- var api string
- if miConfig.MdtrtareaAdmvs == "320921" {
- api = "http://192.168.3.111:9532/" + "jsyb/5203?psn_no=" + businessParams.PsnNo + "&mdtrt_id=" + businessParams.MdtrtId + "&setl_id=" + businessParams.SetlId +
- "&org_name=" + miConfig.OrgName + "&doctor=" + baseParams.Doctor + "&fixmedins_code=" + miConfig.Code +
- "&insuplc_admdvs=" + miConfig.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey + "&url=" + miConfig.Url + "&ak=" + miConfig.AccessKey + "&cainfo=" + miConfig.Cainfo
-
- //req, _ = http.NewRequest("POST", "http://192.168.3.111:9532/"+"jsyb/2204", bytes.NewReader(bytesData))
-
- } else {
- //req, _ = http.NewRequest("POST", "http://192.168.5.251:9532/"+"jsyb/2204", bytes.NewReader(bytesData))
- api = "http://192.168.5.251:9532/" + "jsyb/5203?psn_no=" + businessParams.PsnNo + "&mdtrt_id=" + businessParams.MdtrtId + "&setl_id=" + businessParams.SetlId +
- "&org_name=" + miConfig.OrgName + "&doctor=" + baseParams.Doctor + "&fixmedins_code=" + miConfig.Code +
- "&insuplc_admdvs=" + miConfig.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey + "&url=" + miConfig.Url + "&ak=" + miConfig.AccessKey + "&cainfo=" + miConfig.Cainfo
-
- }
-
- resp, requestErr := http.Get(api)
- if requestErr != nil {
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
-
- body, ioErr := ioutil.ReadAll(resp.Body)
- if ioErr != nil {
- utils.ErrorLog("接口返回数据读取失败: %v", ioErr)
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
- var respJSON map[string]interface{}
- if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
- utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
-
- respJSON = respJSON["data"].(map[string]interface{})["pre"].(map[string]interface{})
- result, _ := json.Marshal(respJSON)
- fmt.Println("log")
- fmt.Println(string(result))
- if err := json.Unmarshal([]byte(result), &resEleven10265); err != nil {
- utils.ErrorLog("解析失败:%v", err)
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
-
- res.InfRefmsgid = resEleven10265.InfRefmsgid
- res.Output = resEleven10265.Output
- res.ErrMsg = resEleven10265.ErrMsg
- res.Cainfo = resEleven10265.Cainfo
- res.WarnMsg = resEleven10265.WarnMsg
- infocode, _ := strconv.ParseInt(resEleven10265.Infcode, 10, 64)
- res.Infcode = infocode
-
- } else if miConfig.MdtrtareaAdmvs == "150499" {
- fmt.Println("~~~~~~~")
-
- api := "http://172.16.13.254:9532/" + "nmyb/5203?psn_no=" + businessParams.PsnNo + "&mdtrt_id=" + businessParams.MdtrtId + "&setl_id=" + businessParams.SetlId +
- "&org_name=" + miConfig.OrgName + "&doctor=" + baseParams.Doctor + "&fixmedins_code=" + miConfig.Code +
- "&insuplc_admdvs=" + miConfig.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey
-
- resp, requestErr := http.Get(api)
- if requestErr != nil {
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
- body, ioErr := ioutil.ReadAll(resp.Body)
- if ioErr != nil {
- utils.ErrorLog("接口返回数据读取失败: %v", ioErr)
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
- var respJSON map[string]interface{}
- if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
- utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
-
- respJSON = respJSON["data"].(map[string]interface{})["pre"].(map[string]interface{})
- result, _ := json.Marshal(respJSON)
- fmt.Println("log")
- fmt.Println(string(result))
- if err := json.Unmarshal([]byte(result), &resEleven10265); err != nil {
- utils.ErrorLog("解析失败:%v", err)
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
-
- res.InfRefmsgid = resEleven10265.InfRefmsgid
- res.Output = resEleven10265.Output
- res.ErrMsg = resEleven10265.ErrMsg
- res.Cainfo = resEleven10265.Cainfo
- res.WarnMsg = resEleven10265.WarnMsg
- infocode, _ := strconv.ParseInt(resEleven10265.Infcode, 10, 64)
- res.Infcode = infocode
-
- } else {
- result := service.Gdyb5203(baseParams, businessParams)
- //service.Gdyb5204(baseParams, businessParams)
- //service.Gdyb5302(businessParams.PsnNo, baseParams.OrgName, baseParams.Doctor, baseParams.FixmedinsCode, baseParams.InsuplcAdmdvs, baseParams.MdtrtareaAdmvs, baseParams.SecretKey)
-
- var dat map[string]interface{}
- if err := json.Unmarshal([]byte(result), &dat); err == nil {
- fmt.Println(dat)
- } else {
- fmt.Println(err)
- }
- userJSONBytes, _ := json.Marshal(dat)
-
- if miConfig.Code == "H15049901371" {
- if err := json.Unmarshal(userJSONBytes, &resEleven10265); err != nil {
- utils.ErrorLog("解析失败:%v", err)
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
- res.InfRefmsgid = resEleven10265.InfRefmsgid
- res.Output = resEleven10265.Output
- res.ErrMsg = resEleven10265.ErrMsg
- res.Cainfo = resEleven10265.Cainfo
- res.WarnMsg = resEleven10265.WarnMsg
- infocode, _ := strconv.ParseInt(resEleven10265.Infcode, 10, 64)
- res.Infcode = infocode
- } else {
- if err := json.Unmarshal(userJSONBytes, &res); err != nil {
- utils.ErrorLog("解析失败:%v", err)
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
-
- }
- }
-
- printor_admin, _ := service.GetAdminUserInfoByID(adminUser.CurrentOrgId, admin_user_id)
- charge_admin, _ := service.GetAdminUserInfoByID(adminUser.CurrentOrgId, order.Creator)
-
- patientPrescription, _ := service.FindPatientPrescriptionInfo(adminUser.CurrentOrgId, order.PatientId, order.SettleAccountsDate)
- adminRole_two, _ := service.GetAdminUserInfoByID(adminUser.CurrentOrgId, patientPrescription.DoctorId)
-
- doctor_info, _ := service.GetAdminUserInfoByID(adminUser.CurrentOrgId, his_hospital.Doctor)
-
- roles, _ := service.GetAdminUserInfoByID(adminUser.CurrentOrgId, admin_user_id)
-
- var doctor_name string
- if roles.ID == 0 {
- doctor_name = "管理员"
- } else {
- doctor_name = roles.UserName
- }
-
- yiliao_leibie := ""
-
- switch order.MedType {
- case "11":
- yiliao_leibie = "普通门诊"
- break
- case "12":
- yiliao_leibie = "门诊挂号"
- break
- case "13":
- yiliao_leibie = "急诊"
- break
- case "14":
- yiliao_leibie = "门诊特殊病"
- break
- case "15":
- yiliao_leibie = "门诊统筹"
- break
- case "16":
- yiliao_leibie = "门诊慢性病"
- break
- case "21":
- yiliao_leibie = "普通住院"
- break
- }
- departments, _ := service.GetDepartMentDetail(patientPrescription.Departments)
-
- if res.Infcode == 0 {
- c.ServeSuccessJSON(map[string]interface{}{
- "diagnosis": name,
- "order_infos": orderInfos,
- "number": order.MdtrtId,
- "date": order.SettleAccountsDate,
- "charge_admin": charge_admin,
- "printor_admin": printor_admin,
- "info": res.Output.Setlinfo,
- "order": order,
- "bedCostTotal": bedCostTotal,
- "bedCostSelfTotal": bedCostSelfTotal,
- "bedCostPartSelfTotal": bedCostPartSelfTotal,
- "operationCostTotal": operationCostTotal,
- "operationCostSelfTotal": operationCostSelfTotal,
- "operationCostPartSelfTotal": operationCostPartSelfTotal,
- "otherCostTotal": otherCostTotal,
- "otherCostSelfTotal": otherCostSelfTotal,
- "otherCostPartSelfTotal": otherCostPartSelfTotal,
- "materialCostTotal": materialCostTotal,
- "materialCostSelfTotal": materialCostSelfTotal,
- "materialCostPartSelfTotal": materialCostPartSelfTotal,
- "westernMedicineCostTotal": westernMedicineCostTotal,
- "westernMedicineCostSelfTotal": westernMedicineCostSelfTotal,
- "westernMedicineCostPartSelfTotal": westernMedicineCostPartSelfTotal,
- "chineseTraditionalMedicineCostTotal": chineseTraditionalMedicineCostTotal,
- "chineseTraditionalMedicineCostSelfTotal": chineseTraditionalMedicineCostSelfTotal,
- "chineseTraditionalMedicineCostPartSelfTotal": chineseTraditionalMedicineCostPartSelfTotal,
- "checkCostTotal": checkCostTotal,
- "checkCostSelfTotal": checkCostSelfTotal,
- "checkCostPartSelfTotal": checkCostPartSelfTotal,
- "laboratoryCostTotal": laboratoryCostTotal,
- "laboratoryCostSelfTotal": laboratoryCostSelfTotal,
- "laboratoryCostPartSelfTotal": laboratoryCostPartSelfTotal,
- "treatCostTotal": treatCostTotal,
- "treatCostSelfTotal": treatCostSelfTotal,
- "treatCostPartSelfTotal": treatCostPartSelfTotal,
- "doctor_info": doctor_info,
- "doctor_code": adminRole_two.DoctorCode,
- "doctor_name": doctor_name,
- "health_card_no": order.PsnNo,
- "department": departments.Name,
- "yiliao_leibie": yiliao_leibie,
- "after_money": order.AccountPrice,
- "patient": patient,
- "org_name": miConfig.OrgName,
- "org_code": miConfig.Code,
- "order_number": order.Number,
- "his_hospital": his_hospital,
- "his": his,
- "dia_config": dia_config,
-
- //"check_order_info": cus_slice,
- })
- }
- }
-
- }
-
- func (c *HisApiController) CheckTreatment() {
- patient_id, _ := c.GetInt64("patient_id")
- id_card_no := c.GetString("id_card_no")
- insutype := c.GetString("insutype")
- med_type := c.GetString("med_type")
- admin_user_id, _ := c.GetInt64("admin_user_id")
-
- adminUser := c.GetAdminUserInfo()
- patient, _ := service.GetPatientByID(adminUser.CurrentOrgId, patient_id)
-
- miConfig, _ := service.FindMedicalInsuranceInfo(adminUser.CurrentOrgId)
- config, _ := service.GetMedicalInsuranceConfig(adminUser.CurrentOrgId)
- roles, _ := service.GetAdminUserInfoByID(adminUser.CurrentOrgId, admin_user_id)
-
- if miConfig.MdtrtareaAdmvs == "421300" {
- var res ResultTwo
- api := "http://192.168.124.4:9532/" + "hbyb/1101?cert_no=" + "" +
- "&org_name=" + miConfig.OrgName + "&doctor=" + roles.UserName + "&fixmedins_code=" + miConfig.Code +
- "&insuplc_admdvs=" + miConfig.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey + "&id_card_type=" + strconv.FormatInt(2, 10) + "&card_sn=" + "" + "&certificates=" + strconv.FormatInt(2, 10)
- resp, requestErr := http.Get(api)
- if requestErr != nil {
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
-
- body, ioErr := ioutil.ReadAll(resp.Body)
- if ioErr != nil {
- utils.ErrorLog("接口返回数据读取失败: %v", ioErr)
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
- var respJSON map[string]interface{}
- if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
- utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
-
- respJSON = respJSON["data"].(map[string]interface{})["pre"].(map[string]interface{})
- result, _ := json.Marshal(respJSON)
-
- if err := json.Unmarshal([]byte(result), &res); err != nil {
- utils.ErrorLog("解析失败:%v", err)
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
-
- if res.Infcode == 0 {
-
- api := "http://192.168.124.4:9532/" + "hbyb/2001?cert_no=" + "" +
- "&org_name=" + miConfig.OrgName + "&doctor=" + roles.UserName + "&fixmedins_code=" + miConfig.Code +
- "&insuplc_admdvs=" + miConfig.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey + "&psn_no=" + res.Output[0].Baseinfo.PsnNo + "&insutype=" + insutype + "&med_type=" + med_type
- resp, requestErr := http.Get(api)
- if requestErr != nil {
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
-
- body, ioErr := ioutil.ReadAll(resp.Body)
- if ioErr != nil {
- utils.ErrorLog("接口返回数据读取失败: %v", ioErr)
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
- var respJSON map[string]interface{}
- if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
- utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
- var res Result2001
-
- respJSON = respJSON["data"].(map[string]interface{})["pre"].(map[string]interface{})
- result2, _ := json.Marshal(respJSON)
-
- if err := json.Unmarshal([]byte(result2), &res); err != nil {
- utils.ErrorLog("解析失败:%v", err)
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
-
- if res.Infcode == 0 {
- c.ServeSuccessJSON(map[string]interface{}{
- "msg": res.Output.Trtinfo,
- })
- }
-
- } else {
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeHisFailedException)
- return
- }
-
- } else {
-
- result := service.Gdyb1101A(id_card_no, miConfig.OrgName, roles.UserName, miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, patient.Name)
- var dat map[string]interface{}
- if err := json.Unmarshal([]byte(result), &dat); err == nil {
- fmt.Println(dat)
- } else {
- fmt.Println(err)
- }
- userJSONBytes, _ := json.Marshal(dat)
- var res ResultTwo
- var res10265 ResultTwo10265
- if miConfig.Code == "H15049901371" {
- if err := json.Unmarshal(userJSONBytes, &res10265); err != nil {
- utils.ErrorLog("解析失败:%v", err)
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
- res.ErrMsg = res10265.ErrMsg
- infocode, _ := strconv.ParseInt(res10265.Infcode, 10, 64)
- res.Infcode = infocode
- //res.Output = res10265.Output
- res.InfRefmsgid = res10265.InfRefmsgid
- } else {
- if err := json.Unmarshal(userJSONBytes, &res); err != nil {
- utils.ErrorLog("解析失败:%v", err)
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
- }
-
- var user_name string
- role, _ := service.GetAdminUserInfoByID(adminUser.CurrentOrgId, adminUser.AdminUser.Id)
- if role.ID == 0 {
- user_name = "xxx"
- } else {
- user_name = role.UserName
- }
-
- baseParams := models.BaseParams{
- SecretKey: miConfig.SecretKey,
- FixmedinsCode: miConfig.Code,
- InsuplcAdmdvs: miConfig.InsuplcAdmdvs,
- MdtrtareaAdmvs: miConfig.MdtrtareaAdmvs,
- OrgName: miConfig.OrgName,
- Doctor: user_name,
- }
-
- if config.IsOpen == 1 {
- if miConfig.Code == "H15049901371" {
- if med_type == "14" {
- if insutype == "390" {
- med_type = "9933"
- } else if insutype == "310" {
- med_type = "990502"
- }
- } else if med_type == "11" {
- med_type = "11"
- }
- }
- result := service.Gdyb2001(baseParams, res.Output[0].Baseinfo.PsnNo, insutype, med_type)
- var dat map[string]interface{}
- if err := json.Unmarshal([]byte(result), &dat); err == nil {
- fmt.Println(dat)
- } else {
- fmt.Println(err)
- }
- var res Result2001
- var res10265 Result2001Org10265
- if miConfig.Code == "H15049901371" {
- if err := json.Unmarshal([]byte(result), &res10265); err != nil {
- utils.ErrorLog("解析失败:%v", err)
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
- res.ErrMsg = res10265.ErrMsg
- res.Output = res10265.Output
- res.InfRefmsgid = res10265.InfRefmsgid
- infocode, _ := strconv.ParseInt(res10265.Infcode, 10, 64)
- res.Infcode = infocode
- } else {
- if err := json.Unmarshal([]byte(result), &res); err != nil {
- utils.ErrorLog("解析失败:%v", err)
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
- }
- if res.Infcode == 0 {
- c.ServeSuccessJSON(map[string]interface{}{
- "msg": res.Output.Trtinfo,
- })
- }
- }
- }
- }
-
- //func (c *HisApiController) PutRecord() {
- // id, _ := c.GetInt64("id")
- // record_time := c.GetString("record_time")
- // timeLayout := "2006-01-02"
- // loc, _ := time.LoadLocation("Local")
- // theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", record_time+" 00:00:00", loc)
- // if err != nil {
- // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
- // return
- // }
- // recordDateTime := theTime.Unix()
- //
- // adminInfo := c.GetAdminUserInfo()
- // patient, _ := service.GetPatientByID(adminInfo.CurrentOrgId, id)
- // patientPrescription, _ := service.FindPatientPrescriptionInfo(adminInfo.CurrentOrgId, id, recordDateTime)
- //
- // miConfig, _ := service.FindMedicalInsuranceInfo(adminInfo.CurrentOrgId)
- //
- // fmt.Println(miConfig.SecretKey)
- //
- // if patient == nil {
- // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodePatientNoExist)
- // return
- // }
- // if len(patient.IdCardNo) == 0 {
- // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeIDCartNo)
- // return
- // }
- // config, _ := service.GetMedicalInsuranceConfig(adminInfo.CurrentOrgId)
- // if config.IsOpen == 1 {
- // api := "http://127.0.0.1:9532/" + "gdyb/one?cert_no=" + patient.IdCardNo + "&org_name=" + miConfig.OrgName + "&doctor=" + patientPrescription.Doctor + "&fixmedins_code=" + miConfig.Code + "&insuplc_admdvs=" + miConfig.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey
- // resp, requestErr := http.Get(api)
- // if requestErr != nil {
- // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- // return
- // }
- // defer resp.Body.Close()
- // body, ioErr := ioutil.ReadAll(resp.Body)
- // if ioErr != nil {
- // utils.ErrorLog("接口返回数据读取失败: %v", ioErr)
- // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- // return
- // }
- // var respJSON map[string]interface{}
- //
- // if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
- // utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
- // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- // return
- // }
- //
- // userJSON := respJSON["data"].(map[string]interface{})["pre"].(map[string]interface{})
- // userJSONBytes, _ := json.Marshal(userJSON)
- // var res ResultTwo
- // if err := json.Unmarshal(userJSONBytes, &res); err != nil {
- // utils.ErrorLog("解析失败:%v", err)
- // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- // return
- // }
- // Iinfos, _ := json.Marshal(res.Output.Iinfo)
- // Idetinfos, _ := json.Marshal(res.Output.Idetinfo)
- // infoStr := string(Iinfos)
- // idetinfoStr := string(Idetinfos)
- //
- // if res.Infcode == 0 {
- // his := models.VMHisPatient{
- // Status: 1,
- // Ctime: time.Now().Unix(),
- // Mtime: time.Now().Unix(),
- // PsnNo: res.Output.Baseinfo.PsnNo,
- // PsnCertType: res.Output.Baseinfo.PsnCertType,
- // Certno: res.Output.Baseinfo.Certno,
- // PsnName: res.Output.Baseinfo.PsnName,
- // Gend: res.Output.Baseinfo.Gend,
- // Naty: res.Output.Baseinfo.Naty,
- // Brdy: res.Output.Baseinfo.Brdy,
- // Age: res.Output.Baseinfo.Age,
- // Iinfo: infoStr,
- // Idetinfo: idetinfoStr,
- // PatientId: patient.ID,
- // RecordDate: theTime.Unix(),
- // UserOrgId: adminInfo.CurrentOrgId,
- // AdminUserId: adminInfo.AdminUser.Id,
- // IsReturn: 1,
- // }
- //
- // //doctor_id := strconv.FormatInt(patientPrescription.DoctorId, 10)
- // //result := service.Gdyb2503(his.PsnNo, res.Output.Iinfo[0].Insutype, miConfig.OrgName, patientPrescription.Doctor, miConfig.Code, doctor_id, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, "重症尿毒症透析(血透)", "M07801")
- // //result2 := service.Gdyb5301(his.PsnNo, res.Output.Iinfo[0].Insutype, miConfig.OrgName, patientPrescription.Doctor, miConfig.Code, doctor_id, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, "重症尿毒症透析(血透)", "M07801")
- //
- // //var dat map[string]interface{}
- // //if err := json.Unmarshal([]byte(result), &dat); err == nil {
- // // fmt.Println(dat)
- // //} else {
- // // fmt.Println(err)
- // //}
- //
- // var dat2 map[string]interface{}
- // if err := json.Unmarshal([]byte(result2), &dat2); err == nil {
- // fmt.Println(dat2)
- // } else {
- // fmt.Println(err)
- // }
- //
- // } else {
- // adminUser := c.GetAdminUserInfo()
- // errlog := &models.HisOrderError{
- // UserOrgId: adminUser.CurrentOrgId,
- // Ctime: time.Now().Unix(),
- // Mtime: time.Now().Unix(),
- // ErrMsg: res.ErrMsg,
- // Status: 1,
- // PatientId: id,
- // RecordTime: recordDateTime,
- // Stage: 1,
- // }
- // service.CreateErrMsgLog(errlog)
- // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeGdybOneException)
- // return
- // }
- // }
- //
- //}
-
- //func (c *HisApiController) GetUploadDiag() {
- // id, _ := c.GetInt64("id")
- // record_time := c.GetString("record_time")
- //
- // diagnosis_id, _ := c.GetInt64("diagnosis")
- // sick_type, _ := c.GetInt64("sick_type")
- // reg_type, _ := c.GetInt64("reg_type")
- //
- // timeLayout := "2006-01-02"
- // loc, _ := time.LoadLocation("Local")
- // theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", record_time+" 00:00:00", loc)
- // if err != nil {
- // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
- // return
- // }
- //
- // var patientPrescription models.HisPrescriptionInfo
- // recordDateTime := theTime.Unix()
- // adminInfo := c.GetAdminUserInfo()
- // patientPrescription, _ = service.FindPatientPrescriptionInfo(adminInfo.CurrentOrgId, id, recordDateTime)
- //
- // if patientPrescription.ID == 0 {
- // patientPrescription, _ = service.FindLastPatientPrescriptionInfo(adminInfo.CurrentOrgId, id, recordDateTime)
- // }
- //
- // miConfig, _ := service.FindMedicalInsuranceInfo(adminInfo.CurrentOrgId)
- // diagnosisConfig, _ := service.FindDiagnoseById(diagnosis_id)
- // his, _ := service.GetVMHisPatientInfo(adminInfo.CurrentOrgId, id, recordDateTime)
- // sickConfig, _ := service.FindSickById(sick_type)
- // department, _ := service.GetDepartMentDetail(patientPrescription.Departments)
- //
- // api2 := "http://127.0.0.1:9532/" + "gdyb/four?psn_no=" + his.PsnNo +
- // "&mdtrt_id=" + his.Number + "&doctor=" + patientPrescription.Doctor + "&department=" + department.Name +
- // "&diag=" + diagnosisConfig.ClassName + "&org_name=" + miConfig.OrgName + "&med_type=" + strconv.FormatInt(reg_type, 10) + "&doctor_id=" + strconv.FormatInt(patientPrescription.DoctorId, 10) + "&fixmedins_code=" + miConfig.Code + "&diag_code=" + diagnosisConfig.CountryCode +
- // "&insuplc_admdvs=" + miConfig.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey + "&sick_code=" + sickConfig.ContentCode + "&sick_name=" + sickConfig.ClassName
- // resp2, requestErr2 := http.Get(api2)
- // if requestErr2 != nil {
- // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- // return
- // }
- // body2, ioErr2 := ioutil.ReadAll(resp2.Body)
- // if ioErr2 != nil {
- // utils.ErrorLog("接口返回数据读取失败: %v", ioErr2)
- // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- // return
- // }
- // var respJSON2 map[string]interface{}
- // if err := json.Unmarshal([]byte(string(body2)), &respJSON2); err != nil {
- // utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
- // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- // return
- // }
- // respJSON2 = respJSON2["data"].(map[string]interface{})["pre"].(map[string]interface{})
- // userJSONBytes2, _ := json.Marshal(respJSON2)
- //
- // var res2 ResultSix
- // if err := json.Unmarshal(userJSONBytes2, &res2); err != nil {
- // utils.ErrorLog("解析失败:%v", err)
- // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- // return
- // }
- // if res2.Infcode != 0 {
- // adminUser := c.GetAdminUserInfo()
- // errlog := &models.HisOrderError{
- // UserOrgId: adminUser.CurrentOrgId,
- // Ctime: time.Now().Unix(),
- // Mtime: time.Now().Unix(),
- // ErrMsg: res2.ErrMsg,
- // Status: 1,
- // PatientId: id,
- // RecordTime: recordDateTime,
- // Stage: 3,
- // }
- // service.CreateErrMsgLog(errlog)
- //
- // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeRegisterThreeException)
- // return
- // }
- //
- // c.ServeSuccessJSON(map[string]interface{}{
- // "msg": "上传成功",
- // })
- //
- //}
-
- type QueryResult struct {
- ID int64
- Name string
- Code string
- List_type_code string
- }
-
- func (c *HisApiController) GetCheckCode() {
- ids_str := c.GetString("ids")
- record_type, _ := c.GetInt64("record_type") //1.药品 2.耗材 3.项目
-
- ids_arr := strings.Split(ids_str, ",")
- var queryResult []QueryResult
- ids := make([]int64, 0)
- for _, item := range ids_arr {
- id, _ := strconv.ParseInt(item, 10, 64)
- ids = append(ids, id)
- }
- if record_type == 1 {
- drugs, _ := service.GetBatchDrugList(ids)
- for _, item := range drugs {
- result := QueryResult{
- ID: item.ID,
- Name: item.DrugName,
- Code: item.MedicalInsuranceNumber,
- List_type_code: "101",
- }
- queryResult = append(queryResult, result)
- }
-
- } else if record_type == 2 {
- goods, _ := service.GetBatchGoodInformationList(ids)
-
- for _, item := range goods {
- result := QueryResult{
- ID: item.ID,
- Name: item.GoodName,
- Code: item.MedicalInsuranceNumber,
- List_type_code: "301",
- }
- queryResult = append(queryResult, result)
- }
- } else if record_type == 3 {
- projects, _ := service.GetBathchMyPorjecgList(ids)
- for _, item := range projects {
- result := QueryResult{
- ID: item.ID,
- Name: item.ProjectName,
- Code: item.MedicalCode,
- List_type_code: "201",
- }
- queryResult = append(queryResult, result)
- }
- }
-
- admin_user_id, _ := c.GetInt64("admin_user_id")
- adminUser := c.GetAdminUserInfo()
- miConfig, _ := service.FindMedicalInsuranceInfo(adminUser.CurrentOrgId)
- config, _ := service.GetMedicalInsuranceConfig(adminUser.CurrentOrgId)
-
- var user_name string
- role, _ := service.GetAdminUserInfoByID(adminUser.CurrentOrgId, admin_user_id)
- if role.ID == 0 {
- user_name = "xxx"
- } else {
- user_name = role.UserName
- }
-
- baseParams := &models.BaseParams{
- SecretKey: miConfig.SecretKey,
- FixmedinsCode: miConfig.Code,
- InsuplcAdmdvs: miConfig.InsuplcAdmdvs,
- MdtrtareaAdmvs: miConfig.MdtrtareaAdmvs,
- OrgName: miConfig.OrgName,
- Doctor: user_name,
- }
-
- if config.IsOpen == 1 {
- for _, item := range queryResult {
- var result string
- if record_type == 1 {
- result = service.Gdyb3301(baseParams, item.Name, item.Code, item.List_type_code, "2021-04-26", "", item.List_type_code)
- } else if record_type == 2 {
- result = service.Gdyb3301(baseParams, item.Name, item.Code, item.List_type_code, "2021-04-26", "", item.List_type_code)
- } else if record_type == 3 {
- result = service.Gdyb3301(baseParams, item.Name, item.Code, item.List_type_code, "2021-04-26", "", item.List_type_code)
- }
- var dat map[string]interface{}
- if err := json.Unmarshal([]byte(result), &dat); err == nil {
- fmt.Println(dat)
- } else {
- fmt.Println(err)
- }
- userJSONBytes, _ := json.Marshal(dat)
- var res ResultSix
- if err := json.Unmarshal(userJSONBytes, &res); err != nil {
- utils.ErrorLog("解析失败:%v", err)
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
- if res.Infcode == 0 {
- if record_type == 1 {
- service.UpdateBaseDrugById(item.ID)
- } else if record_type == 2 {
- service.UpdateGoodInformaitonByDetail(item.ID)
- } else if record_type == 3 {
- service.UpdateProjectById(item.ID)
- }
- c.ServeSuccessJSON(map[string]interface{}{
- "failed_code": 0,
- "msg": "目录对照成功",
- })
- } else {
- c.ServeSuccessJSON(map[string]interface{}{
- "failed_code": -10,
- "msg": res.ErrMsg,
- })
-
- }
- }
- }
- }
- func (c *HisApiController) UnCheckCode() {
- ids_str := c.GetString("ids")
- record_type, _ := c.GetInt64("record_type") //1.药品 2.耗材 3.项目
- admin_user_id, _ := c.GetInt64("admin_user_id")
- ids_arr := strings.Split(ids_str, ",")
- var queryResult []QueryResult
- ids := make([]int64, 0)
- for _, item := range ids_arr {
- id, _ := strconv.ParseInt(item, 10, 64)
- ids = append(ids, id)
- }
- if record_type == 1 {
- drugs, _ := service.GetBatchDrugList(ids)
- for _, item := range drugs {
- result := QueryResult{
- ID: item.ID,
- Name: item.DrugName,
- Code: item.MedicalInsuranceNumber,
- List_type_code: "101",
- }
- queryResult = append(queryResult, result)
- }
-
- } else if record_type == 2 {
- goods, _ := service.GetBatchGoodInformationList(ids)
-
- for _, item := range goods {
- result := QueryResult{
- ID: item.ID,
- Name: item.GoodName,
- Code: item.MedicalInsuranceNumber,
- List_type_code: "301",
- }
- queryResult = append(queryResult, result)
- }
- } else if record_type == 3 {
- projects, _ := service.GetBathchMyPorjecgList(ids)
- for _, item := range projects {
- result := QueryResult{
- ID: item.ID,
- Name: item.ProjectName,
- Code: item.MedicalCode,
- List_type_code: "201",
- }
- queryResult = append(queryResult, result)
- }
- }
-
- adminUser := c.GetAdminUserInfo()
-
- miConfig, _ := service.FindMedicalInsuranceInfo(adminUser.CurrentOrgId)
- config, _ := service.GetMedicalInsuranceConfig(adminUser.CurrentOrgId)
-
- var user_name string
- role, _ := service.GetAdminUserInfoByID(adminUser.CurrentOrgId, admin_user_id)
- if role.ID == 0 {
- user_name = "xxx"
- } else {
- user_name = role.UserName
- }
-
- baseParams := &models.BaseParams{
- SecretKey: miConfig.SecretKey,
- FixmedinsCode: miConfig.Code,
- InsuplcAdmdvs: miConfig.InsuplcAdmdvs,
- MdtrtareaAdmvs: miConfig.MdtrtareaAdmvs,
- OrgName: miConfig.OrgName,
- Doctor: user_name,
- }
-
- if config.IsOpen == 1 {
- for _, item := range queryResult {
- var result string
- if record_type == 1 {
- result = service.Gdyb3302(baseParams, item.Name, item.Code, item.List_type_code)
- } else if record_type == 2 {
- result = service.Gdyb3302(baseParams, item.Name, item.Code, item.List_type_code)
- } else if record_type == 3 {
- result = service.Gdyb3302(baseParams, item.Name, item.Code, item.List_type_code)
- }
- var dat2 map[string]interface{}
- if err := json.Unmarshal([]byte(result), &dat2); err == nil {
- fmt.Println(dat2)
- } else {
- fmt.Println(err)
- }
- userJSONBytes, _ := json.Marshal(dat2)
- var res ResultSix
- if err := json.Unmarshal(userJSONBytes, &res); err != nil {
- utils.ErrorLog("解析失败:%v", err)
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
- if res.Infcode == 0 {
- if record_type == 1 {
- service.UpdateDrugByIdDetail(item.ID)
- } else if record_type == 2 {
- service.UpdateGoodInfoById(item.ID)
- } else if record_type == 3 {
- service.UpdateMyProjectById(item.ID)
- }
- c.ServeSuccessJSON(map[string]interface{}{
- "failed_code": 0,
- "msg": "撤销目录对照成功",
- })
- } else {
- c.ServeSuccessJSON(map[string]interface{}{
- "failed_code": -10,
- "msg": res.ErrMsg,
- })
- }
- }
- }
- }
- func (c *HisApiController) GetPatientInfo() {
- id_card_no := c.GetString("id_card_no")
- admin_user_id, _ := c.GetInt64("admin_user_id")
-
- patient, _ := service.GetPatientByIDCard(id_card_no, c.GetAdminUserInfo().CurrentOrgId)
-
- if patient.ID == 0 {
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodePatientNoExist)
- return
- }
-
- role, _ := service.GetAdminUserInfoByID(c.GetAdminUserInfo().CurrentOrgId, admin_user_id)
- miConfig, _ := service.FindMedicalInsuranceInfo(c.GetAdminUserInfo().CurrentOrgId)
- config, _ := service.GetMedicalInsuranceConfig(c.GetAdminUserInfo().CurrentOrgId)
- if config.IsOpen == 1 {
-
- result := service.Gdyb1101A(id_card_no, miConfig.OrgName, role.UserName, miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, patient.Name)
- var dat map[string]interface{}
- if err := json.Unmarshal([]byte(result), &dat); err == nil {
- fmt.Println(dat)
- } else {
- fmt.Println(err)
- }
-
- userJSONBytes, _ := json.Marshal(dat)
- var res ResultTwo
- var res10265 ResultTwo10265
-
- if miConfig.Code == "H15049901371" {
- if err := json.Unmarshal(userJSONBytes, &res10265); err != nil {
- utils.ErrorLog("解析失败:%v", err)
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
- res.ErrMsg = res10265.ErrMsg
- infocode, _ := strconv.ParseInt(res10265.Infcode, 10, 64)
- res.Infcode = infocode
- //res.Output = res10265.Output
- res.InfRefmsgid = res10265.InfRefmsgid
-
- } else {
- if err := json.Unmarshal(userJSONBytes, &res); err != nil {
- utils.ErrorLog("解析失败:%v", err)
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
- }
-
- //if err := json.Unmarshal(userJSONBytes, &res); err != nil {
- // utils.ErrorLog("解析失败:%v", err)
- // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- // return
- //}
-
- if res.Infcode != 0 {
- c.ServeSuccessJSON(map[string]interface{}{
- "failed_code": -10,
- "msg": res.ErrMsg,
- })
- } else {
- c.ServeSuccessJSON(map[string]interface{}{
- "failed_code": 0,
- "info": res,
- })
- }
-
- }
- }
- func (c *HisApiController) PsnPutOnRecord() {
- record_type, _ := c.GetInt64("type")
- patient_id, _ := c.GetInt64("patient_id")
- admin_user_id, _ := c.GetInt64("admin_user_id")
- start_time := c.GetString("start_time")
- end_time := c.GetString("end_time")
-
- adminUser := c.GetAdminUserInfo()
- miConfig, _ := service.FindMedicalInsuranceInfo(adminUser.CurrentOrgId)
- config, _ := service.GetMedicalInsuranceConfig(adminUser.CurrentOrgId)
-
- var patients []*models.Patients
- if record_type == 1 { //全部备案
-
- patient, _ := service.GetAllPatient(adminUser.CurrentOrgId)
- patients = append(patients, patient...)
-
- } else { //单个备案
- patient, _ := service.GetPatientByID(adminUser.CurrentOrgId, patient_id)
- patients = append(patients, patient)
-
- }
-
- var user_name string
- role, _ := service.GetAdminUserInfoByID(adminUser.CurrentOrgId, admin_user_id)
- if role.ID == 0 {
- user_name = "xxx"
- } else {
- user_name = role.UserName
- }
-
- if config.IsOpen == 1 {
- for _, item := range patients {
- api := "http://127.0.0.1:9532/" + "gdyb/one?cert_no=" + item.IdCardNo + "&org_name=" + miConfig.OrgName + "&doctor=" + user_name + "&fixmedins_code=" + miConfig.Code + "&insuplc_admdvs=" + miConfig.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey
- resp, requestErr := http.Get(api)
- if requestErr != nil {
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
- defer resp.Body.Close()
- body, ioErr := ioutil.ReadAll(resp.Body)
- if ioErr != nil {
- utils.ErrorLog("接口返回数据读取失败: %v", ioErr)
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
- var respJSON map[string]interface{}
-
- if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
- utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
-
- userJSON := respJSON["data"].(map[string]interface{})["pre"].(map[string]interface{})
- userJSONBytes, _ := json.Marshal(userJSON)
- var res ResultTwo
- if err := json.Unmarshal(userJSONBytes, &res); err != nil {
- utils.ErrorLog("解析失败:%v", err)
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
-
- if res.Infcode == 0 {
- result := service.Gdyb2505(res.Output[0].Baseinfo.PsnNo, user_name, miConfig.OrgName, miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, start_time, end_time)
- var dat map[string]interface{}
- if err := json.Unmarshal([]byte(result), &dat); err == nil {
- fmt.Println(dat)
- } else {
- fmt.Println(err)
- }
-
- userJSONBytes, _ := json.Marshal(dat)
-
- var res2 ResultThirteen
- if err := json.Unmarshal(userJSONBytes, &res2); err != nil {
- utils.ErrorLog("解析失败:%v", err)
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
- if res2.Infcode == 0 {
- psnResult := &models.GdybPsnRecord{
- UserOrgId: adminUser.CurrentOrgId,
- PatientId: item.ID,
- PsnNo: res.Output[0].Baseinfo.PsnNo,
- Ctime: time.Now().Unix(),
- Mtime: time.Now().Unix(),
- Status: 1,
- IsCancel: 1,
- TrtDclaDetlSn: res2.Output.Result.TrtDclaDetlSn,
- }
- service.CreatePsnRecord(psnResult)
-
- } else {
- c.ServeSuccessJSON(map[string]interface{}{
- "failed_code": -10,
- "msg": res2.ErrMsg,
- })
- return
- }
-
- }
-
- }
- }
-
- }
- func (c *HisApiController) PsnUnPutOnRecord() {
- id, _ := c.GetInt64("id")
- //record_type, _ := c.GetInt64("type")
- admin_user_id, _ := c.GetInt64("admin_user_id")
-
- adminUser := c.GetAdminUserInfo()
- miConfig, _ := service.FindMedicalInsuranceInfo(adminUser.CurrentOrgId)
- config, _ := service.GetMedicalInsuranceConfig(adminUser.CurrentOrgId)
-
- var user_name string
- role, _ := service.GetAdminUserInfoByID(adminUser.CurrentOrgId, admin_user_id)
- if role.ID == 0 {
- user_name = "xxx"
- } else {
- user_name = role.UserName
- }
-
- psn_record, _ := service.GetPsnRecordById(id)
- if psn_record.ID == 0 {
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorPsnRecordNoExistWrong)
- return
- }
- if config.IsOpen == 1 {
- result := service.Gdyb2506(psn_record.PsnNo, user_name, miConfig.OrgName, miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, psn_record.TrtDclaDetlSn)
- var dat map[string]interface{}
- if err := json.Unmarshal([]byte(result), &dat); err == nil {
- fmt.Println(dat)
- } else {
- fmt.Println(err)
- }
-
- userJSONBytes, _ := json.Marshal(dat)
- var res ResultFourteen
- if err := json.Unmarshal(userJSONBytes, &res); err != nil {
- utils.ErrorLog("解析失败:%v", err)
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
- if res.Infcode == 0 {
- psn_record.IsCancel = 2
- service.CreatePsnRecord(&psn_record)
- } else {
- c.ServeSuccessJSON(map[string]interface{}{
- "failed_code": -10,
- "msg": res.ErrMsg,
- })
- return
- }
- }
-
- }
- func (c *HisApiController) PsnPutNCDSOnRecord() {
- patient_id, _ := c.GetInt64("patient_id")
- insutype_two := c.GetString("insutype")
- psn_no := c.GetString("psn_no")
- doctor_id, _ := c.GetInt64("doctor_id")
- sick_id, _ := c.GetInt64("sick_id")
- department_id, _ := c.GetInt64("department_id")
- start_time := c.GetString("start_time")
- end_time := c.GetString("end_time")
- check_time := c.GetString("check_time")
-
- adminUser := c.GetAdminUserInfo()
- patient, _ := service.GetPatientByID(adminUser.CurrentOrgId, patient_id)
- miConfig, _ := service.FindMedicalInsuranceInfo(adminUser.CurrentOrgId)
- config, _ := service.GetMedicalInsuranceConfig(adminUser.CurrentOrgId)
- sick, _ := service.FindSickById(sick_id)
- doctor, _ := service.GetAdminUserInfoByID(adminUser.CurrentOrgId, doctor_id)
-
- role, _ := service.GetAdminUserInfoByID(adminUser.CurrentOrgId, doctor_id)
- var res ResultTwo
- var res10265 ResultTwo10265
- if miConfig.MdtrtareaAdmvs == "320921" || miConfig.MdtrtareaAdmvs == "320982" {
- psn_info, _ := service.GetPsnByPatientId(patient.ID)
- api := "http://192.168.3.111:9532/" + "hbyb/1101?cert_no=" + "" +
- "&org_name=" + miConfig.OrgName + "&doctor=" + role.UserName + "&fixmedins_code=" + miConfig.Code +
- "&insuplc_admdvs=" + miConfig.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey + "&id_card_type=" + strconv.FormatInt(3, 10) + "&card_sn=" + "" + "&certificates=" + strconv.FormatInt(1, 10) + "&url=" + miConfig.Url + "&ak=" + miConfig.AccessKey + "&verify_number=" + psn_info.VerifyNumber + "&cainfo=" + miConfig.Cainfo
- resp, requestErr := http.Get(api)
- if requestErr != nil {
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
-
- body, ioErr := ioutil.ReadAll(resp.Body)
- if ioErr != nil {
- utils.ErrorLog("接口返回数据读取失败: %v", ioErr)
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
- var respJSON map[string]interface{}
- if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
- utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
-
- respJSON = respJSON["data"].(map[string]interface{})["pre"].(map[string]interface{})
- result, _ := json.Marshal(respJSON)
- fmt.Println("log")
- fmt.Println(string(result))
-
- if err := json.Unmarshal([]byte(result), &res10265); err != nil {
- utils.ErrorLog("解析失败:%v", err)
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
- res.ErrMsg = res10265.ErrMsg
- infocode, _ := strconv.ParseInt(res10265.Infcode, 10, 64)
- res.Infcode = infocode
- //res.Output = res10265.Output
- res.InfRefmsgid = res10265.InfRefmsgid
-
- } else {
- result, _ := service.Gdyb1101(patient.IdCardNo, miConfig.OrgName, role.UserName, miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, 2, "", "0", patient.Name)
- if miConfig.Code == "H15049901371" {
- if err := json.Unmarshal([]byte(result), &res10265); err != nil {
- utils.ErrorLog("解析失败:%v", err)
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
- res.ErrMsg = res10265.ErrMsg
- infocode, _ := strconv.ParseInt(res10265.Infcode, 10, 64)
- res.Infcode = infocode
- //res.Output = res10265.Output
- res.InfRefmsgid = res10265.InfRefmsgid
- } else {
- if err := json.Unmarshal([]byte(result), &res); err != nil {
- utils.ErrorLog("解析失败:%v", err)
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
- }
-
- }
-
- Iinfos, _ := json.Marshal(res.Output[0].Iinfo)
- infoStr := string(Iinfos)
- var rf []*ResultFive
- json.Unmarshal([]byte(infoStr), &rf)
-
- var insuplc_admdvs string
- var insutype string
- var is390 int = 0
- var is310 int = 0
- var insutypes []*ResultFive
-
- for _, item := range rf {
- if (item.Insutype == "390" && item.PsnInsuStas == "1") || (item.Insutype == "310" && item.PsnInsuStas == "1") {
- insutypes = append(insutypes, item)
- }
- }
-
- if len(insutypes) == 1 {
- insutype = insutypes[0].Insutype
- //insuplc_admdvs = insutypes[0].InsuplcAdmdvs
- } else {
- for _, i := range insutypes {
- if i.Insutype == "390" {
- is390 = 1
- }
-
- if i.Insutype == "310" {
- is310 = 1
- }
- }
- }
- if is390 == 1 {
- insutype = "390"
- }
-
- if is310 == 1 {
- insutype = "310"
- }
-
- if len(insutypes) == 2 {
- insutype = insutype_two
- }
-
- if len(insutypes) == 0 {
- insutype = "310"
- }
-
- insutype = insutype_two
-
- fmt.Println(insutype)
- for _, item := range rf {
- fmt.Println(item.Insutype)
- fmt.Println(insutype)
- if item.Insutype == insutype {
- fmt.Println(item.Insutype)
- fmt.Println(insutype)
- insuplc_admdvs = item.InsuplcAdmdvs
- }
- }
- fmt.Println(insuplc_admdvs)
- var res2 ResultThirteen
- var res10265_2 ResultThirteen10265
- if config.IsOpen == 1 {
- if miConfig.MdtrtareaAdmvs == "320921" || miConfig.MdtrtareaAdmvs == "320982" {
-
- } else {
- result := service.Gdyb2503(psn_no, insutype, miConfig.OrgName, doctor.UserName, miConfig.Code, strconv.FormatInt(doctor.ID, 10), insuplc_admdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, sick.ClassName, sick.ContentCode, start_time, end_time, check_time)
- var dat map[string]interface{}
- if err := json.Unmarshal([]byte(result), &dat); err == nil {
- fmt.Println(dat)
- } else {
- fmt.Println(err)
- }
- userJSONBytes, _ := json.Marshal(dat)
- if miConfig.Code == "H15049901371" {
- if err := json.Unmarshal(userJSONBytes, &res10265_2); err != nil {
- utils.ErrorLog("解析失败:%v", err)
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
- res2.ErrMsg = res10265_2.ErrMsg
- infocode, _ := strconv.ParseInt(res10265_2.Infcode, 10, 64)
- res2.Infcode = infocode
- res2.Output = res10265_2.Output
- res2.InfRefmsgid = res10265_2.InfRefmsgid
- } else {
- if err := json.Unmarshal(userJSONBytes, &res2); err != nil {
- utils.ErrorLog("解析失败:%v", err)
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
- }
- }
-
- if res2.Infcode == 0 {
- psnResult := &models.GdybPsnNcdsRecord{
- UserOrgId: adminUser.CurrentOrgId,
- PatientId: patient.ID,
- PsnNo: psn_no,
- DoctorId: doctor.AdminUserId,
- DepartmentId: department_id,
- SickType: sick_id,
- Insutype: insutype,
- Ctime: time.Now().Unix(),
- Mtime: time.Now().Unix(),
- Status: 1,
- IsCancel: 1,
- TrtDclaDetlSn: res2.Output.Result.TrtDclaDetlSn,
- }
- service.CreatePsnNCDSRecord(psnResult)
- c.ServeSuccessJSON(map[string]interface{}{
- "failed_code": 0,
- "msg": "备案成功",
- "result": psnResult,
- })
-
- } else {
- c.ServeSuccessJSON(map[string]interface{}{
- "failed_code": -10,
- "msg": res2.ErrMsg,
- })
- return
- }
- }
- }
- func (c *HisApiController) PsnPutUnNCDSOnRecord() {
- id, _ := c.GetInt64("id")
- admin_user_id, _ := c.GetInt64("admin_user_id")
- adminUser := c.GetAdminUserInfo()
- miConfig, _ := service.FindMedicalInsuranceInfo(adminUser.CurrentOrgId)
- config, _ := service.GetMedicalInsuranceConfig(adminUser.CurrentOrgId)
-
- //config, _ := service.Ge(adminUser.CurrentOrgId)
- patient, _ := service.GetPatientByID(c.GetAdminUserInfo().CurrentOrgId, id)
- //role, _ := service.GetAdminUserInfoByID(adminUser.CurrentOrgId, admin_user_id)
- //var user_name string
- role, _ := service.GetAdminUserInfoByID(adminUser.CurrentOrgId, admin_user_id)
- //if role.ID == 0 {
- // user_name = "xxx"
- //} else {
- // user_name = role.UserName
- //}
- psn_record, _ := service.GetPsnNCDSRecordById(id)
- if psn_record.ID == 0 {
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorPsnRecordNoExistWrong)
- return
- }
- result, _ := service.Gdyb1101(patient.IdCardNo, miConfig.OrgName, role.UserName, miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, 2, "", "0", patient.Name)
- var res ResultTwo
- var res10265 ResultTwo10265
-
- if miConfig.Code == "H15049901371" {
- if err := json.Unmarshal([]byte(result), &res10265); err != nil {
- utils.ErrorLog("解析失败:%v", err)
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
- res.ErrMsg = res10265.ErrMsg
- infocode, _ := strconv.ParseInt(res10265.Infcode, 10, 64)
- res.Infcode = infocode
- //res.Output = res10265.Output
- res.InfRefmsgid = res10265.InfRefmsgid
-
- } else {
- if err := json.Unmarshal([]byte(result), &res); err != nil {
- utils.ErrorLog("解析失败:%v", err)
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
- }
- Iinfos, _ := json.Marshal(res.Output[0].Iinfo)
- infoStr := string(Iinfos)
- var rf []*ResultFive
- json.Unmarshal([]byte(infoStr), &rf)
-
- var insuplc_admdvs string
- var insutype string
- var is390 int = 0
- var is310 int = 0
- var insutypes []*ResultFive
-
- for _, item := range rf {
- if (item.Insutype == "390" && item.PsnInsuStas == "1") || (item.Insutype == "310" && item.PsnInsuStas == "1") {
- insutypes = append(insutypes, item)
- }
- }
-
- if len(insutypes) == 1 {
- insutype = insutypes[0].Insutype
- //insuplc_admdvs = insutypes[0].InsuplcAdmdvs
- } else {
- for _, i := range insutypes {
- if i.Insutype == "390" {
- is390 = 1
- }
-
- if i.Insutype == "310" {
- is310 = 1
- }
- }
- }
- if is390 == 1 {
- insutype = "390"
- }
-
- if is310 == 1 {
- insutype = "310"
- }
-
- if len(insutypes) == 0 {
- insutype = "310"
- }
- insutype = psn_record.Insutype
-
- for _, item := range rf {
- if item.Insutype == insutype {
- insuplc_admdvs = item.InsuplcAdmdvs
- }
- }
-
- if config.IsOpen == 1 {
- result := service.Gdyb2504(psn_record.PsnNo, miConfig.OrgName, role.UserName, miConfig.Code, insuplc_admdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, psn_record.TrtDclaDetlSn)
- var dat map[string]interface{}
- if err := json.Unmarshal([]byte(result), &dat); err == nil {
- fmt.Println(dat)
- } else {
- fmt.Println(err)
- }
-
- userJSONBytes, _ := json.Marshal(dat)
- var res ResultFourteen
- var res10265 ResultFourteen10265
-
- if miConfig.Code == "H15049901371" {
- if err := json.Unmarshal(userJSONBytes, &res10265); err != nil {
- utils.ErrorLog("解析失败:%v", err)
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
- res.ErrMsg = res10265.ErrMsg
- infocode, _ := strconv.ParseInt(res10265.Infcode, 10, 64)
- res.Infcode = infocode
- res.Output = res10265.Output
- res.InfRefmsgid = res10265.InfRefmsgid
-
- } else {
- if err := json.Unmarshal([]byte(result), &res); err != nil {
- utils.ErrorLog("解析失败:%v", err)
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
- }
-
- //if err := json.Unmarshal(userJSONBytes, &res); err != nil {
- // utils.ErrorLog("解析失败:%v", err)
- // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- // return
- //}
- if res.Infcode == 0 {
- psn_record.IsCancel = 2
- service.CreatePsnNCDSRecord(&psn_record)
- c.ServeSuccessJSON(map[string]interface{}{
- "failed_code": 0,
- "msg": "撤销备案成功",
- })
- } else {
- c.ServeSuccessJSON(map[string]interface{}{
- "failed_code": -10,
- "msg": res.ErrMsg,
- })
- return
- }
- }
-
- }
-
- func (c *HisApiController) TestTest() {
- patient, _ := service.GetHisPatientInfo(4, 456, 1619712000)
- fmt.Println(patient.Iinfo)
-
- }
-
- type CustomData struct {
- MsgId string
- PsnNo string
- Info string
- }
-
- func (c *HisApiController) ReversalData() {
- var customData []*CustomData
-
- custom := &CustomData{
- MsgId: "H44022900158202103301714472004",
- PsnNo: "44020000001101329945",
- Info: "2207",
- }
- customData = append(customData, custom)
-
- custom1 := &CustomData{
- MsgId: "H4402290015820210330172057803",
- PsnNo: "44020000001101161813",
- Info: "2207",
- }
- customData = append(customData, custom1)
- custom2 := &CustomData{
- MsgId: "H44022900158202103301705198813",
- PsnNo: "44190000133097375417",
- Info: "2207",
- }
- customData = append(customData, custom2)
- custom3 := &CustomData{
- MsgId: "H44022900158202103301715524756",
- PsnNo: "44020000001100187221",
- Info: "2207",
- }
- customData = append(customData, custom3)
- custom4 := &CustomData{
- MsgId: "H44022900158202103301730376224",
- PsnNo: "44020000001101959155",
- Info: "2207",
- }
- customData = append(customData, custom4)
- custom5 := &CustomData{
- MsgId: "H44022900158202103301748008725",
- PsnNo: "44020000001104246641",
- Info: "2207",
- }
- customData = append(customData, custom5)
- custom6 := &CustomData{
- MsgId: "H44022900158202103301718096755",
- PsnNo: "44020000001102211860",
- Info: "2207",
- }
- customData = append(customData, custom6)
- custom7 := &CustomData{
- MsgId: "H44022900158202103301736551640",
- PsnNo: "44020000001102687718",
- Info: "2207",
- }
-
- customData = append(customData, custom7)
-
- custom8 := &CustomData{
- MsgId: "H44022900158202103301743097676",
- PsnNo: "44020000001102127785",
- Info: "2207",
- }
- customData = append(customData, custom8)
- custom9 := &CustomData{
- MsgId: "H44022900158202103301712304203",
- PsnNo: "44020000001101518097",
- Info: "2207",
- }
- customData = append(customData, custom9)
- custom10 := &CustomData{
- MsgId: "H44022900158202103301738448785",
- PsnNo: "44020000001100500813",
- Info: "2207",
- }
- customData = append(customData, custom10)
-
- custom11 := &CustomData{
- MsgId: "H44022900158202103301732455843",
- PsnNo: "44020000001102690557",
- Info: "2207",
- }
-
- customData = append(customData, custom11)
-
- custom12 := &CustomData{
- MsgId: "H44022900158202103301745421708",
- PsnNo: "44020000001102211928",
- Info: "2207",
- }
- customData = append(customData, custom12)
-
- custom1212 := &CustomData{
- MsgId: "H440229001582021033017351627",
- PsnNo: "44020000001102481733",
- Info: "2207",
- }
- customData = append(customData, custom1212)
-
- custom13 := &CustomData{
- MsgId: "H44022900158202103301740327951",
- PsnNo: "44020000001103174866",
- Info: "2207",
- }
- customData = append(customData, custom13)
- custom14 := &CustomData{
- MsgId: "H4402290015820210330174922668",
- PsnNo: "44020000001102927272",
- Info: "2207",
- }
- customData = append(customData, custom14)
- custom15 := &CustomData{
- MsgId: "H44022900158202103301752362273",
- PsnNo: "44020000001102942890",
- Info: "2207",
- }
- customData = append(customData, custom15)
-
- custom16 := &CustomData{
- MsgId: "H44022900158202103301751082917",
- PsnNo: "44020000001101662162",
- Info: "2207",
- }
- customData = append(customData, custom16)
-
- custom17 := &CustomData{
- MsgId: "H44022900158202103301754147728",
- PsnNo: "44020000000229014511",
- Info: "2207",
- }
- customData = append(customData, custom17)
-
- adminUser := c.GetAdminUserInfo()
- miConfig, _ := service.FindMedicalInsuranceInfo(adminUser.CurrentOrgId)
-
- for _, item := range customData {
- result := service.Gdyb2601(item.PsnNo, item.MsgId, item.Info, miConfig.OrgName, "张俊杰", miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey)
- fmt.Println(result)
- }
- }
-
- //func (c *HisApiController) GetAllopatry() {
- // year := c.GetString("year")
- // month := c.GetString("month")
- // admin_user_id, _ := c.GetInt64("admin_user_id")
- // adminUser := c.GetAdminUserInfo()
- // miConfig, _ := service.FindMedicalInsuranceInfo(adminUser.CurrentOrgId)
- // roles, _ := service.GetAdminUserInfoByID(adminUser.CurrentOrgId, admin_user_id)
- // result, _ := service.Gdyb9001(miConfig.OrgName, roles.UserName, miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, 1669)
- //
- // var dat map[string]interface{}
- // if err := json.Unmarshal([]byte(result), &dat); err == nil {
- // fmt.Println(dat)
- // } else {
- // fmt.Println(err)
- // }
- // userJSONBytes, _ := json.Marshal(dat)
- // var res models.Result9001
- // if err := json.Unmarshal(userJSONBytes, &res); err != nil {
- // utils.ErrorLog("解析失败:%v", err)
- // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- // return
- // }
- //
- // result2, _ := service.Gdyb3260(miConfig.OrgName, roles.UserName, miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, year, month, "")
- // var dat2 map[string]interface{}
- // if err := json.Unmarshal([]byte(result2), &dat2); err == nil {
- // fmt.Println(dat)
- // } else {
- // fmt.Println(err)
- // }
- // userJSONBytes2, _ := json.Marshal(dat2)
- // var res2 models.Result3260
- // if err := json.Unmarshal(userJSONBytes2, &res2); err != nil {
- // utils.ErrorLog("解析失败:%v", err)
- // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- // return
- // }
- // if res2.Infcode == 0 {
- // c.ServeSuccessJSON(map[string]interface{}{
- // "list": res2.Output.Data,
- // })
- // return
- // } else {
- // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- // return
- // }
- //
- //}
-
- //func (c *HisApiController) ComfirmAllopatry() {
- // year := c.GetString("year")
- // month := c.GetString("month")
- // admin_user_id, _ := c.GetInt64("admin_user_id")
- // adminUser := c.GetAdminUserInfo()
- // miConfig, _ := service.FindMedicalInsuranceInfo(adminUser.CurrentOrgId)
- // roles, _ := service.GetAdminUserInfoByID(adminUser.CurrentOrgId, admin_user_id)
- // result, _ := service.Gdyb9001(miConfig.OrgName, roles.UserName, miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, 1669)
- // var dat map[string]interface{}
- // if err := json.Unmarshal([]byte(result), &dat); err == nil {
- // fmt.Println(dat)
- // } else {
- // fmt.Println(err)
- // }
- // userJSONBytes, _ := json.Marshal(dat)
- // var res models.Result9001
- // if err := json.Unmarshal(userJSONBytes, &res); err != nil {
- // utils.ErrorLog("解析失败:%v", err)
- // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- // return
- // }
- //
- // result2, _ := service.Gdyb3260(miConfig.OrgName, roles.UserName, miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, year, month, "")
- // var dat2 map[string]interface{}
- // if err := json.Unmarshal([]byte(result2), &dat2); err == nil {
- // fmt.Println(dat)
- // } else {
- // fmt.Println(err)
- // }
- // userJSONBytes2, _ := json.Marshal(dat2)
- // var res2 models.Result3260
- // if err := json.Unmarshal(userJSONBytes2, &res2); err != nil {
- // utils.ErrorLog("解析失败:%v", err)
- // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- // return
- // }
- //
- // if res2.Infcode == 0 {
- // result, _, msgId := service.Gdyb3261(miConfig.OrgName, roles.UserName, miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, year, month, res2)
- // var dat map[string]interface{}
- // if err := json.Unmarshal([]byte(result), &dat); err == nil {
- // fmt.Println(dat)
- // } else {
- // fmt.Println(err)
- // }
- // userJSONBytes, _ := json.Marshal(dat)
- // var res3 models.Result3261
- // if err := json.Unmarshal(userJSONBytes, &res3); err != nil {
- // utils.ErrorLog("解析失败:%v", err)
- // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- // return
- // }
- //
- // if res3.Infcode == 0 {
- // record := &models.HisYidiClearRecord{
- // UserOrgId: c.GetAdminUserInfo().CurrentOrgId,
- // Ctime: time.Now().Unix(),
- // Mtime: time.Now().Unix(),
- // Status: 1,
- // MsgId: msgId,
- // }
- // service.SaveClearRecord(record)
- // c.ServeSuccessJSON(map[string]interface{}{
- // "msg": "提取成功",
- // })
- // }
- // }
- //}
- //
- //func (c *HisApiController) RefundAllopatry() {
- // year := c.GetString("year")
- // month := c.GetString("month")
- // id, _ := c.GetInt64("id")
- // admin_user_id, _ := c.GetInt64("admin_user_id")
- // adminUser := c.GetAdminUserInfo()
- // miConfig, _ := service.FindMedicalInsuranceInfo(adminUser.CurrentOrgId)
- // roles, _ := service.GetAdminUserInfoByID(adminUser.CurrentOrgId, admin_user_id)
- // record, _ := service.GetClearRecordById(id)
- // result, _ := service.Gdyb3262(miConfig.OrgName, roles.UserName, miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, year, month, record.MsgId)
- //
- // var dat map[string]interface{}
- // if err := json.Unmarshal([]byte(result), &dat); err == nil {
- // fmt.Println(dat)
- // } else {
- // fmt.Println(err)
- // }
- // userJSONBytes, _ := json.Marshal(dat)
- // var empty ResultFourteen
- // if err := json.Unmarshal(userJSONBytes, &empty); err != nil {
- // utils.ErrorLog("解析失败:%v", err)
- // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- // return
- // }
- // if empty.Infcode == 0 {
- // c.ServeSuccessJSON(map[string]interface{}{
- // "msg": "撤销成功",
- // })
- // return
- // }
- //}
-
- func (c *HisApiController) ReversalOtherData() {
- var customData []*CustomData
-
- custom := &CustomData{
- MsgId: "H44022900158202103301714472004",
- PsnNo: "44020000001101329945",
- Info: "2208",
- }
- customData = append(customData, custom)
-
- custom1 := &CustomData{
- MsgId: "H4402290015820210330172057803",
- PsnNo: "44020000001101161813",
- Info: "2208",
- }
- customData = append(customData, custom1)
- custom2 := &CustomData{
- MsgId: "H44022900158202103301705198813",
- PsnNo: "44190000133097375417",
- Info: "2208",
- }
- customData = append(customData, custom2)
- custom3 := &CustomData{
- MsgId: "H44022900158202103301715524756",
- PsnNo: "44020000001100187221",
- Info: "2208",
- }
- customData = append(customData, custom3)
- custom4 := &CustomData{
- MsgId: "H44022900158202103301730376224",
- PsnNo: "44020000001101959155",
- Info: "2208",
- }
- customData = append(customData, custom4)
- custom5 := &CustomData{
- MsgId: "H44022900158202103301748008725",
- PsnNo: "44020000001104246641",
- Info: "2208",
- }
- customData = append(customData, custom5)
- custom6 := &CustomData{
- MsgId: "H44022900158202103301718096755",
- PsnNo: "44020000001102211860",
- Info: "2208",
- }
- customData = append(customData, custom6)
- custom7 := &CustomData{
- MsgId: "H44022900158202103301736551640",
- PsnNo: "44020000001102687718",
- Info: "2208",
- }
-
- customData = append(customData, custom7)
-
- custom8 := &CustomData{
- MsgId: "H44022900158202103301743097676",
- PsnNo: "44020000001102127785",
- Info: "2208",
- }
- customData = append(customData, custom8)
- custom9 := &CustomData{
- MsgId: "H44022900158202103301712304203",
- PsnNo: "44020000001101518097",
- Info: "2208",
- }
- customData = append(customData, custom9)
- custom10 := &CustomData{
- MsgId: "H44022900158202103301738448785",
- PsnNo: "44020000001100500813",
- Info: "2208",
- }
- customData = append(customData, custom10)
-
- custom11 := &CustomData{
- MsgId: "H44022900158202103301732455843",
- PsnNo: "44020000001102690557",
- Info: "2208",
- }
-
- customData = append(customData, custom11)
-
- custom12 := &CustomData{
- MsgId: "H44022900158202103301745421708",
- PsnNo: "44020000001102211928",
- Info: "2208",
- }
- customData = append(customData, custom12)
-
- custom1212 := &CustomData{
- MsgId: "H440229001582021033017351627",
- PsnNo: "44020000001102481733",
- Info: "2208",
- }
- customData = append(customData, custom1212)
-
- custom13 := &CustomData{
- MsgId: "H44022900158202103301740327951",
- PsnNo: "44020000001103174866",
- Info: "2208",
- }
- customData = append(customData, custom13)
- custom14 := &CustomData{
- MsgId: "H4402290015820210330174922668",
- PsnNo: "44020000001102927272",
- Info: "2208",
- }
- customData = append(customData, custom14)
- custom15 := &CustomData{
- MsgId: "H44022900158202103301752362273",
- PsnNo: "44020000001102942890",
- Info: "2208",
- }
- customData = append(customData, custom15)
-
- custom16 := &CustomData{
- MsgId: "H44022900158202103301751082917",
- PsnNo: "44020000001101662162",
- Info: "2208",
- }
- customData = append(customData, custom16)
-
- custom17 := &CustomData{
- MsgId: "H44022900158202103301754147728",
- PsnNo: "44020000000229014511",
- Info: "2208",
- }
- customData = append(customData, custom17)
-
- adminUser := c.GetAdminUserInfo()
- miConfig, _ := service.FindMedicalInsuranceInfo(adminUser.CurrentOrgId)
-
- for _, item := range customData {
- result := service.Gdyb2601(item.PsnNo, item.MsgId, item.Info, miConfig.OrgName, "张俊杰", miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey)
- fmt.Println(result)
- }
- }
-
- func PathExists(path string) (bool, error) {
- _, err := os.Stat(path)
- if err == nil {
- return true, nil
- }
- if os.IsNotExist(err) {
- return false, nil
- }
- return false, err
- }
-
- //创建文件夹
- func Mkdir(dir string) {
- // 创建文件夹
- exist, err := PathExists(dir)
- if err != nil {
- fmt.Println(err.Error())
- } else {
- if exist {
- fmt.Println(dir + "文件夹已存在!")
- } else {
- // 文件夹名称,权限
- err := os.Mkdir(dir, os.ModePerm)
- if err != nil {
- fmt.Println(dir+"文件夹创建失败:", err.Error())
- } else {
- fmt.Println(dir + "文件夹创建成功!")
- }
- }
- }
- }
-
- //压缩文件
- func Zip(srcFile string, destZip string) error {
- zipfile, err := os.Create(destZip)
- if err != nil {
- return err
- }
- defer zipfile.Close()
-
- archive := zip.NewWriter(zipfile)
- defer archive.Close()
-
- filepath.Walk(srcFile, func(path string, info os.FileInfo, err error) error {
- if err != nil {
- return err
- }
-
- header, err := zip.FileInfoHeader(info)
- if err != nil {
- return err
- }
-
- header.Name = strings.TrimPrefix(path, filepath.Dir(srcFile)+"/")
- // header.Name = path
- if info.IsDir() {
- header.Name += "/"
- } else {
- header.Method = zip.Deflate
- }
-
- writer, err := archive.CreateHeader(header)
- if err != nil {
- return err
- }
-
- if !info.IsDir() {
- file, err := os.Open(path)
- if err != nil {
- return err
- }
- defer file.Close()
- _, err = io.Copy(writer, file)
- }
- return err
- })
-
- return err
- }
-
- func ReadFile(filePath string) []byte {
- f, err := os.Open(filePath)
- if err != nil {
- fmt.Println("read file fail", err)
- return nil
- }
- defer f.Close()
-
- fd, err := ioutil.ReadAll(f)
- if err != nil {
- fmt.Println("read to fd fail", err)
- return nil
- }
-
- return fd
- }
-
- func saveLog(result string, request string, infno string, desc string) {
-
- org_id, _ := beego.AppConfig.Int64("org_id")
- miConfig, _ := service.FindMedicalInsuranceInfo(org_id)
- dir := miConfig.OrgName + "日志"
- utils.Mkdir(dir)
- 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")
-
- result_time := year + "-" + month + "-" + day + " " + hour + ":" + min + ":" + sec
-
- file := strconv.FormatInt(org_id, 10) + "_" + year + month + day + "_log"
- file_name := file + ".txt"
- file_path := miConfig.OrgName + "日志" + "/" + file_name
- exist, _ := utils.PathExists(file_path)
- if exist { //存在
- fmt.Println("存在")
- f, err := os.OpenFile(file_path, os.O_WRONLY, 0644)
- if err != nil {
- fmt.Println("read fail")
- }
- content := "\r\n" + "\r\n" + "\r\n" + result_time + " " + "【 " + desc + infno + "入参" + " 】:" + "\r\n" + request + "\r\n" + result_time + " " + "【 " + desc + infno + "出参" + " 】:" + "\r\n" + result
- n, _ := f.Seek(0, 2)
- _, err = f.WriteAt([]byte(content), n)
-
- } else { //不存在
- fmt.Println("文件不存在,创建文件")
- f, err := os.Create(miConfig.OrgName + "日志" + "/" + file_name)
- defer f.Close()
- if err != nil {
- } else {
- _, err = f.Write([]byte("记录日志"))
- }
- }
-
- }
-
- type Charset string
-
- const (
- UTF8 = Charset("UTF-8")
- GB18030 = Charset("GB18030")
- )
-
- func ConvertToString(src string, srcCode string, tagCode string) string {
- srcCoder := mahonia.NewDecoder(srcCode)
- srcResult := srcCoder.ConvertString(src)
- tagCoder := mahonia.NewDecoder(tagCode)
- _, cdata, _ := tagCoder.Translate([]byte(srcResult), true)
- result := string(cdata)
- return result
- }
-
- func (c *HisApiController) ReadEleCard() {
- id_card_type, _ := c.GetInt64("id_card_type")
- admin_user_id, _ := c.GetInt64("admin_user_id")
- fmt.Println(c.GetAdminUserInfo().CurrentOrgId)
- roles, _ := service.GetAdminUserInfoByID(c.GetAdminUserInfo().CurrentOrgId, admin_user_id)
- miConfig, _ := service.FindMedicalInsuranceInfo(c.GetAdminUserInfo().CurrentOrgId)
-
- if miConfig.MdtrtareaAdmvs == "320921" || miConfig.MdtrtareaAdmvs == "320982" {
- var api string
- if miConfig.MdtrtareaAdmvs == "320921" {
- api = "http://192.168.3.111:9532/" + "jsyb/readcard?" + "fixmedins_code=" + miConfig.Code + "&secret_key=" + miConfig.SecretKey + "&ak=" + miConfig.AccessKey + "&org_name=" + miConfig.OrgName + "&doctor=" + roles.UserName +
- "&insuplc_admdvs=" + miConfig.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey + "&url=" + miConfig.Url + "&cainfo=" + miConfig.Cainfo + "&id_card_type=" + strconv.FormatInt(id_card_type, 10) + "&operator_id=" + strconv.FormatInt(admin_user_id, 10) + "&operator=" + roles.UserName
- fmt.Println(api)
-
- } else {
- api = "http://192.168.5.251:9532/" + "jsyb/readcard?" + "fixmedins_code=" + miConfig.Code + "&secret_key=" + miConfig.SecretKey + "&ak=" + miConfig.AccessKey + "&org_name=" + miConfig.OrgName + "&doctor=" + roles.UserName +
- "&insuplc_admdvs=" + miConfig.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey + "&url=" + miConfig.Url + "&cainfo=" + miConfig.Cainfo + "&id_card_type=" + strconv.FormatInt(id_card_type, 10)
- }
-
- resp, requestErr := http.Get(api)
- if requestErr != nil {
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
-
- body, ioErr := ioutil.ReadAll(resp.Body)
- if ioErr != nil {
- utils.ErrorLog("接口返回数据读取失败: %v", ioErr)
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
- var respJSON map[string]interface{}
- if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
- utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
- var status string
- status = respJSON["data"].(map[string]interface{})["status"].(string)
- //card_type := respJSON["data"].(map[string]interface{})["type"].(string)
- var token string
- var res ResultTwo //1101结果
- var res10265 ResultTwo10265 //1101结果
- if status == "0" { //读卡成功
- var card_info string //卡信息
- var busi_card_info string
- token = respJSON["data"].(map[string]interface{})["token"].(string)
- busi_card_info = respJSON["data"].(map[string]interface{})["busi_card_info"].(string)
- card_info = respJSON["data"].(map[string]interface{})["card_info"].(string)
-
- fmt.Println(card_info)
- fmt.Println(busi_card_info)
-
- respJSON = respJSON["data"].(map[string]interface{})["result"].(map[string]interface{})
- result, _ := json.Marshal(respJSON)
-
- if err := json.Unmarshal([]byte(result), &res10265); err != nil {
- utils.ErrorLog("解析失败:%v", err)
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
- res.ErrMsg = res10265.ErrMsg
- infocode, _ := strconv.ParseInt(res10265.Infcode, 10, 64)
- res.Infcode = infocode
- //res.Output = res10265.Output
- res.InfRefmsgid = res10265.InfRefmsgid
- if res.Infcode == 0 {
- c.ServeSuccessJSON(map[string]interface{}{
- "number": token,
- })
- }
- } else {
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeHisFailedException)
- return
- }
- } else { //读卡失败
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeHisFailedException)
- return
- }
- }
|