new_his_api_controller.go 468KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158
  1. package sg
  2. //
  3. //import (
  4. // "archive/zip"
  5. // "bytes"
  6. // "encoding/json"
  7. // "fmt"
  8. // "gdyb/controllers"
  9. // "gdyb/enums"
  10. // "gdyb/models"
  11. // "gdyb/service"
  12. // "gdyb/utils"
  13. // "github.com/astaxie/beego"
  14. // "github.com/axgle/mahonia"
  15. // "github.com/shopspring/decimal"
  16. // "io"
  17. // "io/ioutil"
  18. // "math/rand"
  19. // "net/http"
  20. // "os"
  21. // "path/filepath"
  22. // "strconv"
  23. // "strings"
  24. // "syscall"
  25. // "time"
  26. // "unsafe"
  27. //)
  28. //
  29. //type HisApiController struct {
  30. // controllers.BaseAuthAPIController
  31. //}
  32. //
  33. //func NewHisManagerApiRegistRouters() {
  34. // //挂号
  35. // beego.Router("/api/register/get", &HisApiController{}, "get:GetRegisterInfo")
  36. // //上传就诊信息-上传明细-结算
  37. // beego.Router("/api/upload/get", &HisApiController{}, "get:GetUploadInfo")
  38. // //查询
  39. // beego.Router("/api/settle/query", &HisApiController{}, "get:GetSettleAccounts")
  40. // //对总账
  41. // beego.Router("/api/checkaccount/get", &HisApiController{}, "get:GetCheckAccount")
  42. // //对明细
  43. // beego.Router("/api/checkdetailaccount/get", &HisApiController{}, "get:GetCheckDetailAccount")
  44. // //退费,退明细
  45. // beego.Router("/api/refund/post", &HisApiController{}, "get:Refund")
  46. // //退号
  47. // beego.Router("/api/refundnumber/post", &HisApiController{}, "get:RefundNumber")
  48. // //退明细
  49. // beego.Router("/api/refunddetail/post", &HisApiController{}, "get:RefundDetail")
  50. //
  51. // beego.Router("/api/treatment/check", &HisApiController{}, "get:CheckTreatment")
  52. // beego.Router("/api/org/info", &HisApiController{}, "get:GetOrgInfo")
  53. // //beego.Router("/api/readcard", &HisApiController{}, "get:ReadCard")
  54. // beego.Router("/api/presettle/get", &HisApiController{}, "get:GetPreUploadInfo")
  55. // beego.Router("/api/310", &HisApiController{}, "get:Check310")
  56. // beego.Router("/api/390", &HisApiController{}, "get:Check390")
  57. // beego.Router("/api/patient/info", &HisApiController{}, "get:GetPatientInfo")
  58. // beego.Router("/api/checkcode/get", &HisApiController{}, "get:GetCheckCode")
  59. // beego.Router("/api/uncheckcode/get", &HisApiController{}, "get:UnCheckCode")
  60. // beego.Router("/api/psn/putonrecord", &HisApiController{}, "get:PsnPutOnRecord")
  61. // beego.Router("/api/psn/unputonrecord", &HisApiController{}, "get:PsnUnPutOnRecord")
  62. // beego.Router("/api/psn/ncds/putonrecord", &HisApiController{}, "get:PsnPutNCDSOnRecord")
  63. // beego.Router("/api/psn/ncds/unputonrecord", &HisApiController{}, "get:PsnPutUnNCDSOnRecord")
  64. // beego.Router("/api/reversal", &HisApiController{}, "get:ReversalData")
  65. // beego.Router("/api/reversal/other", &HisApiController{}, "get:ReversalOtherData")
  66. // beego.Router("/api/settlelist/get", &HisApiController{}, "get:GetSettleList")
  67. // beego.Router("/api/settlelisthosptial/get", &HisApiController{}, "get:GetSettleListHospital")
  68. //
  69. // beego.Router("/api/pwd/check", &HisApiController{}, "get:CheckCardPWD")
  70. // beego.Router("/api/insutype/check", &HisApiController{}, "get:CheckInsutype")
  71. // beego.Router("/api/batchsettlelist/get", &HisApiController{}, "get:GetBatchSettleList")
  72. // beego.Router("/api/psn/info", &HisApiController{}, "get:GetPsnNcdsInfo")
  73. //
  74. // beego.Router("/api/allopatry/get", &HisApiController{}, "get:GetAllopatry")
  75. // beego.Router("/api/comfirmallopatry/post", &HisApiController{}, "post:ComfirmAllopatry")
  76. // beego.Router("/api/allopatry/refund", &HisApiController{}, "post:RefundAllopatry")
  77. //
  78. // beego.Router("/api/check", &HisApiController{}, "get:Check")
  79. // beego.Router("/api/check3101", &HisApiController{}, "get:Check3101")
  80. // beego.Router("/api/check3102", &HisApiController{}, "get:Check3102")
  81. //
  82. // beego.Router("/90990", &HisApiController{}, "get:CheckCardPWDTwo")
  83. // beego.Router("/9001", &HisApiController{}, "get:Get9001")
  84. //
  85. // beego.Router("/api/readelecard", &HisApiController{}, "get:ReadEleCard")
  86. //
  87. //}
  88. //
  89. //func (c *HisApiController) Get9001() {
  90. // adminUser := c.GetAdminUserInfo()
  91. // miConfig, _ := service.FindMedicalInsuranceInfo(adminUser.CurrentOrgId)
  92. // roles, _ := service.GetAdminUserInfoByID(adminUser.CurrentOrgId, 185)
  93. // result, inputLog := service.Gdyb9001(miConfig.OrgName, roles.UserName, miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, 1669)
  94. // var dat map[string]interface{}
  95. // if err := json.Unmarshal([]byte(result), &dat); err == nil {
  96. // fmt.Println(dat)
  97. // } else {
  98. // fmt.Println(err)
  99. // }
  100. // userJSONBytes, _ := json.Marshal(dat)
  101. // var res models.Result9001
  102. // if err := json.Unmarshal(userJSONBytes, &res); err != nil {
  103. // utils.ErrorLog("解析失败:%v", err)
  104. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  105. // return
  106. // }
  107. // if res.Infcode == 0 {
  108. // sign := models.HisSignIn{
  109. // UserOrgId: c.GetAdminUserInfo().CurrentOrgId,
  110. // SignNo: res.Output.Result.SignNo,
  111. // SignTime: res.Output.Result.SignTime,
  112. // Ctime: time.Now().Unix(),
  113. // Mtime: time.Now().Unix(),
  114. // Status: 1,
  115. // InputLog: inputLog,
  116. // OutputLog: result,
  117. // FixmedinsCode: miConfig.Code,
  118. // }
  119. // err := service.CreateSignIn(&sign)
  120. // if err == nil {
  121. // c.ServeSuccessJSON(map[string]interface{}{
  122. // "msg": "签到成功",
  123. // })
  124. // }
  125. // }
  126. //}
  127. //func (c *HisApiController) Check3101() {
  128. // patient_id, _ := c.GetInt64("patient_id")
  129. // his_patient_id, _ := c.GetInt64("his_patient_id")
  130. // admin_user_id, _ := c.GetInt64("admin_user_id")
  131. // adminUser := c.GetAdminUserInfo()
  132. // roles, _ := service.GetAdminUserInfoByID(c.GetAdminUserInfo().CurrentOrgId, admin_user_id)
  133. // his, _ := service.GetNewHisPatientInfoFour(c.GetAdminUserInfo().CurrentOrgId, his_patient_id)
  134. // miConfig, _ := service.FindMedicalInsuranceInfo(c.GetAdminUserInfo().CurrentOrgId)
  135. // record_time := c.GetString("record_time")
  136. // trig_scen := c.GetString("trig_scen")
  137. //
  138. // timeLayout := "2006-01-02"
  139. // loc, _ := time.LoadLocation("Local")
  140. // theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", record_time+" 00:00:00", loc)
  141. // if err != nil {
  142. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
  143. // return
  144. // }
  145. // recordDateTime := theTime.Unix()
  146. //
  147. // var patientPrescription models.HisPrescriptionInfo
  148. // patientPrescription, _ = service.FindHisPatientPrescriptionInfo(adminUser.CurrentOrgId, his_patient_id, recordDateTime)
  149. // if patientPrescription.ID == 0 {
  150. // patientPrescription, _ = service.FindLastPatientPrescriptionInfo(adminUser.CurrentOrgId, patient_id, recordDateTime)
  151. // }
  152. // department, _ := service.GetDepartMentDetail(patientPrescription.Departments)
  153. // doctor_info, _ := service.GetAdminUserInfoByID(adminUser.CurrentOrgId, patientPrescription.DoctorId)
  154. // //
  155. // diagnosis_ids := strings.Split(patientPrescription.Diagnosis, ",")
  156. //
  157. // prescriptions, _ := service.GetNewHisPrescriptionTen(adminUser.CurrentOrgId, his_patient_id, recordDateTime)
  158. //
  159. // var pp models.PublicParams
  160. // pp.InsuplcAdmdvs = miConfig.InsuplcAdmdvs
  161. // pp.MdtrtareaAdmvs = miConfig.MdtrtareaAdmvs
  162. // pp.FixmedinsName = miConfig.OrgName
  163. // pp.FixmedinsCode = miConfig.Code
  164. //
  165. // pp.RequestUrl = miConfig.Url
  166. // pp.Cainfo = miConfig.Cainfo
  167. // pp.SecretKey = miConfig.SecretKey
  168. // pp.AccessKey = miConfig.AccessKey
  169. // pp.OpterName = roles.UserName
  170. //
  171. // var config []*models.HisXtDiagnoseConfig
  172. // for _, item := range diagnosis_ids {
  173. // id, _ := strconv.ParseInt(item, 10, 64)
  174. // diagnosisConfig, _ := service.FindDiagnoseById(id)
  175. // config = append(config, &diagnosisConfig)
  176. // }
  177. //
  178. // var pd models.PatientDtos
  179. // pd.PatnID = his.PsnNo
  180. // pd.PatnName = his.Name
  181. // pd.Gend = his.Gend
  182. // pd.Brdy = his.Brdy
  183. // pd.Poolarea = his.InsuplcAdmdvs
  184. // pd.CurrMdtrtID = his.Number
  185. //
  186. // var fed models.FsiEncounterDtos
  187. // fed.MdtrtID = his.Number
  188. // fed.MedinsID = miConfig.Code
  189. // fed.MedinsName = miConfig.OrgName
  190. // fed.MedinsAdmdvs = miConfig.MdtrtareaAdmvs
  191. // fed.MedMdtrtType = "1"
  192. // fed.MedinsType = "1"
  193. // fed.MedinsLv = "11"
  194. // tm := time.Unix(his.RecordDate, 0)
  195. // s_tm := tm.Format("2006-01-02 15:04:05")
  196. // fed.AdmDate = s_tm
  197. // fed.DscgDate = s_tm
  198. // fed.DscgMainDiseCodg = config[0].CountryCode
  199. // fed.DscgMainDiseName = config[0].CountryContentName
  200. // //诊断信息
  201. // var fdds []*models.FsiDiagnoseDtos
  202. // for index, item := range config {
  203. // if index == 0 {
  204. // var fdd models.FsiDiagnoseDtos
  205. // fdd.DiseID = strconv.FormatInt(item.ID, 10)
  206. // fdd.InoutDiseType = "1"
  207. // fdd.MaindiseFlag = "1"
  208. // fdd.DiseDate = s_tm
  209. // fdd.DiasSrtNo = "1"
  210. // fdd.DiseName = item.CountryContentName
  211. // fdd.DiseCodg = item.CountryCode
  212. // fdds = append(fdds, &fdd)
  213. //
  214. // } else {
  215. // var fdd models.FsiDiagnoseDtos
  216. // fdd.DiseID = strconv.FormatInt(item.ID, 10)
  217. // fdd.InoutDiseType = "1"
  218. // fdd.MaindiseFlag = "1"
  219. // fdd.DiseDate = s_tm
  220. // fdd.DiasSrtNo = strconv.FormatInt(int64(index), 10)
  221. // fdd.DiseName = item.CountryContentName
  222. // fdd.DiseCodg = item.CountryCode
  223. // fdds = append(fdds, &fdd)
  224. // }
  225. // }
  226. // fed.DrCodg = strconv.FormatInt(doctor_info.ID, 10)
  227. // fed.AdmDeptCodg = strconv.FormatInt(department.ID, 10)
  228. // fed.AdmDeptName = department.Name
  229. // fed.DscgDeptCodg = strconv.FormatInt(department.ID, 10)
  230. // fed.DscgDeptName = department.Name
  231. // fed.MedMdtrtType = "1"
  232. // fed.MedType = "11"
  233. // //if his.Insutype == "390" {
  234. // // fed.MedType = "1402"
  235. // //} else {
  236. // // fed.MedType = "9933"
  237. // //}
  238. // var orders []*models.FsiOrderDtos
  239. //
  240. // if trig_scen == "2" {
  241. // //处方医嘱信息
  242. // for _, item := range prescriptions {
  243. // for _, subItem := range item.HisDoctorAdviceInfo {
  244. // var order models.FsiOrderDtos
  245. // order.RxID = strconv.FormatInt(item.ID, 10)
  246. // order.Rxno = strconv.FormatInt(item.ID, 10)
  247. // order.LongDrordFlag = "0"
  248. // order.HilistType = "1"
  249. // order.ChrgType = "1"
  250. // order.DrordBhvr = "-"
  251. // order.HilistCode = subItem.BaseDrugLib.MedicalInsuranceNumber
  252. // order.HosplistName = subItem.BaseDrugLib.DrugName
  253. // order.HilistLv = "1"
  254. // order.HilistPric = fmt.Sprintf("%.2f", subItem.Price)
  255. // order.HosplistCode = subItem.BaseDrugLib.MedicalInsuranceNumber
  256. // order.HosplistName = subItem.BaseDrugLib.DrugName
  257. // order.Cnt = fmt.Sprintf("%.2f", subItem.PrescribingNumber)
  258. // order.Pric = fmt.Sprintf("%.2f", subItem.Price)
  259. // order.Sumamt = fmt.Sprintf("%.2f", (subItem.PrescribingNumber * subItem.Price))
  260. // order.OwnpayAmt = ""
  261. // order.SelfpayAmt = ""
  262. // order.Spec = ""
  263. // order.SpecUnt = ""
  264. // order.DrordBegnDate = s_tm
  265. // order.DrordStopDate = ""
  266. // order.DrordDrCodg = "1"
  267. // order.DrordDeptName = department.Name
  268. // order.DrordDrCodg = "1"
  269. // order.DrordDrName = doctor_info.UserName
  270. // order.DrordDrProfttl = ""
  271. // order.CurrDrordFlag = "1"
  272. // orders = append(orders, &order)
  273. // }
  274. // for _, subItem := range item.HisPrescriptionProject {
  275. // if subItem.Type == 2 {
  276. // var order models.FsiOrderDtos
  277. // order.RxID = strconv.FormatInt(item.ID, 10)
  278. // order.Rxno = strconv.FormatInt(item.ID, 10)
  279. // order.LongDrordFlag = "0"
  280. // order.HilistType = "1"
  281. // order.ChrgType = "1"
  282. // order.DrordBhvr = "-"
  283. // order.HilistCode = subItem.HisProject.MedicalCode
  284. // order.HosplistName = subItem.HisProject.ProjectName
  285. // order.HilistLv = "1"
  286. // order.HilistPric = fmt.Sprintf("%.2f", subItem.Price)
  287. // order.HosplistCode = subItem.HisProject.MedicalCode
  288. // order.HosplistName = subItem.HisProject.ProjectName
  289. // order.Cnt = subItem.Count
  290. // cnt, _ := strconv.ParseFloat(subItem.Count, 64)
  291. // order.Pric = fmt.Sprintf("%.2f", subItem.Price)
  292. // order.Sumamt = fmt.Sprintf("%.2f", subItem.Price*cnt)
  293. // order.OwnpayAmt = ""
  294. // order.SelfpayAmt = ""
  295. // order.Spec = ""
  296. // order.SpecUnt = ""
  297. // order.DrordBegnDate = s_tm
  298. // order.DrordStopDate = ""
  299. // order.DrordDrCodg = "1"
  300. // order.DrordDeptName = department.Name
  301. // order.DrordDrCodg = "1"
  302. // order.DrordDrName = doctor_info.UserName
  303. // order.DrordDrProfttl = ""
  304. // order.CurrDrordFlag = "1"
  305. // orders = append(orders, &order)
  306. //
  307. // }
  308. // if subItem.Type == 3 {
  309. //
  310. // var order models.FsiOrderDtos
  311. // order.RxID = strconv.FormatInt(item.ID, 10)
  312. // order.Rxno = strconv.FormatInt(item.ID, 10)
  313. // order.LongDrordFlag = "0"
  314. // order.HilistType = "1"
  315. // order.ChrgType = "1"
  316. // order.DrordBhvr = "-"
  317. // order.HilistCode = subItem.GoodInfo.MedicalInsuranceNumber
  318. // order.HosplistName = subItem.GoodInfo.GoodName
  319. // order.HilistLv = "1"
  320. // order.HilistPric = fmt.Sprintf("%.2f", subItem.Price)
  321. // order.HosplistCode = subItem.GoodInfo.MedicalInsuranceNumber
  322. // order.HosplistName = subItem.GoodInfo.GoodName
  323. // order.Cnt = subItem.Count
  324. // cnt, _ := strconv.ParseFloat(subItem.Count, 64)
  325. // order.Pric = fmt.Sprintf("%.2f", subItem.Price)
  326. // order.Sumamt = fmt.Sprintf("%.2f", subItem.Price*cnt)
  327. // order.OwnpayAmt = ""
  328. // order.SelfpayAmt = ""
  329. // order.Spec = ""
  330. // order.SpecUnt = ""
  331. // order.DrordBegnDate = s_tm
  332. // order.DrordStopDate = ""
  333. // order.DrordDrCodg = "1"
  334. // order.DrordDeptName = department.Name
  335. // order.DrordDrCodg = "1"
  336. // order.DrordDrName = doctor_info.UserName
  337. // order.DrordDrProfttl = ""
  338. // order.CurrDrordFlag = "1"
  339. // orders = append(orders, &order)
  340. //
  341. // }
  342. // }
  343. // }
  344. // //处方医嘱信息
  345. // }
  346. // fed.MatnStas = "0"
  347. // fed.MedfeeSumamt = "0"
  348. // fed.OwnpayAmt = "0"
  349. // fed.SelfpayAmt = "0"
  350. // fed.AcctPayamt = "0"
  351. // fed.MaAmt = "0"
  352. // fed.HifpPayamt = "0"
  353. // fed.SetlTotlnum = "1"
  354. // fed.Insutype = his.Insutype
  355. // fed.ReimFlag = "0"
  356. // fed.OutSetlFlag = "0"
  357. //
  358. // var fopd []*models.FsiOperationDtosData
  359. // data := make(map[string]interface{})
  360. // data["fed"] = fed
  361. // data["fdd"] = fdds
  362. // data["fod"] = orders
  363. // data["pd"] = pd
  364. // data["pp"] = pp
  365. // data["fopd"] = fopd
  366. // data["trig_scen"] = trig_scen
  367. // fmt.Println(data)
  368. // fmt.Println(fed)
  369. // fmt.Println(fdds)
  370. // fmt.Println(orders)
  371. // fmt.Println(pd)
  372. // fmt.Println(pp)
  373. // fmt.Println(fopd)
  374. //
  375. // client := &http.Client{}
  376. // bytesData, _ := json.Marshal(data)
  377. // var req *http.Request
  378. //
  379. // if miConfig.MdtrtareaAdmvs == "320921" {
  380. // req, _ = http.NewRequest("POST", "http://192.168.2.110:9532/"+"jsyb/3101", bytes.NewReader(bytesData))
  381. // } else {
  382. // req, _ = http.NewRequest("POST", "http://192.168.5.251:9532/"+"jsyb/3101", bytes.NewReader(bytesData))
  383. // }
  384. //
  385. // resp, _ := client.Do(req)
  386. // defer resp.Body.Close()
  387. // body, ioErr := ioutil.ReadAll(resp.Body)
  388. // if ioErr != nil {
  389. // utils.ErrorLog("接口返回数据读取失败: %v", ioErr)
  390. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  391. // return
  392. // }
  393. // var respJSON map[string]interface{}
  394. // if err := json.Unmarshal([]byte(body), &respJSON); err != nil {
  395. // utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
  396. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  397. // return
  398. // }
  399. //
  400. // //手术操作集合
  401. // //手术操作集合
  402. //
  403. //}
  404. //
  405. //func (c *HisApiController) Check3102() {
  406. // patient_id, _ := c.GetInt64("patient_id")
  407. // order_id, _ := c.GetInt64("order_id")
  408. // his_patient_id, _ := c.GetInt64("his_patient_id")
  409. // admin_user_id, _ := c.GetInt64("admin_user_id")
  410. // trig_scen := c.GetString("trig_scen")
  411. //
  412. // adminUser := c.GetAdminUserInfo()
  413. // roles, _ := service.GetAdminUserInfoByID(c.GetAdminUserInfo().CurrentOrgId, admin_user_id)
  414. // his, _ := service.GetNewHisPatientInfoFour(c.GetAdminUserInfo().CurrentOrgId, his_patient_id)
  415. // miConfig, _ := service.FindMedicalInsuranceInfo(c.GetAdminUserInfo().CurrentOrgId)
  416. // record_time := c.GetString("record_time")
  417. // order, _ := service.GetHisOrderByID(order_id)
  418. //
  419. // timeLayout := "2006-01-02"
  420. // loc, _ := time.LoadLocation("Local")
  421. // theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", record_time+" 00:00:00", loc)
  422. // if err != nil {
  423. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
  424. // return
  425. // }
  426. // recordDateTime := theTime.Unix()
  427. //
  428. // var patientPrescription models.HisPrescriptionInfo
  429. // patientPrescription, _ = service.FindHisPatientPrescriptionInfo(adminUser.CurrentOrgId, his_patient_id, recordDateTime)
  430. // if patientPrescription.ID == 0 {
  431. // patientPrescription, _ = service.FindLastPatientPrescriptionInfo(adminUser.CurrentOrgId, patient_id, recordDateTime)
  432. // }
  433. // department, _ := service.GetDepartMentDetail(patientPrescription.Departments)
  434. // doctor_info, _ := service.GetAdminUserInfoByID(adminUser.CurrentOrgId, patientPrescription.DoctorId)
  435. // //
  436. // diagnosis_ids := strings.Split(his.Diagnosis, ",")
  437. //
  438. // prescriptions, _ := service.GetNewHisPrescriptionTen(adminUser.CurrentOrgId, his_patient_id, recordDateTime)
  439. //
  440. // var pp models.PublicParams
  441. // pp.InsuplcAdmdvs = miConfig.InsuplcAdmdvs
  442. // pp.MdtrtareaAdmvs = miConfig.MdtrtareaAdmvs
  443. // pp.FixmedinsName = miConfig.OrgName
  444. // pp.FixmedinsCode = miConfig.Code
  445. // pp.RequestUrl = miConfig.Url
  446. // pp.Cainfo = miConfig.Cainfo
  447. // pp.SecretKey = miConfig.SecretKey
  448. // pp.AccessKey = miConfig.AccessKey
  449. // pp.OpterName = roles.UserName
  450. //
  451. // var config []*models.HisXtDiagnoseConfig
  452. // for _, item := range diagnosis_ids {
  453. // id, _ := strconv.ParseInt(item, 10, 64)
  454. // diagnosisConfig, _ := service.FindDiagnoseById(id)
  455. // config = append(config, &diagnosisConfig)
  456. // }
  457. //
  458. // var pd models.PatientDtos
  459. // pd.PatnID = his.PsnNo
  460. // pd.PatnName = his.Name
  461. // pd.Gend = his.Gend
  462. // pd.Brdy = his.Brdy
  463. // pd.Poolarea = his.InsuplcAdmdvs
  464. // pd.CurrMdtrtID = his.Number
  465. //
  466. // var fed models.FsiEncounterDtos
  467. // fed.MdtrtID = his.Number
  468. // fed.MedinsID = miConfig.Code
  469. // fed.MedinsName = miConfig.OrgName
  470. // fed.MedinsAdmdvs = miConfig.MdtrtareaAdmvs
  471. // fed.MedMdtrtType = "1"
  472. // fed.MedinsType = "1"
  473. // fed.MedinsLv = "11"
  474. // tm := time.Unix(his.RecordDate, 0)
  475. // s_tm := tm.Format("2006-01-02 15:04:05")
  476. // fed.AdmDate = s_tm
  477. // fed.DscgDate = s_tm
  478. // fed.DscgMainDiseCodg = config[0].CountryCode
  479. // fed.DscgMainDiseName = config[0].CountryContentName
  480. // //诊断信息
  481. // var fdds []*models.FsiDiagnoseDtos
  482. // for index, item := range config {
  483. // if index == 0 {
  484. // var fdd models.FsiDiagnoseDtos
  485. // fdd.DiseID = strconv.FormatInt(item.ID, 10)
  486. // fdd.InoutDiseType = "1"
  487. // fdd.MaindiseFlag = "1"
  488. // fdd.DiseDate = s_tm
  489. // fdd.DiasSrtNo = "1"
  490. // fdd.DiseName = item.CountryContentName
  491. // fdd.DiseCodg = item.CountryCode
  492. // fdds = append(fdds, &fdd)
  493. //
  494. // } else {
  495. // var fdd models.FsiDiagnoseDtos
  496. // fdd.DiseID = strconv.FormatInt(item.ID, 10)
  497. // fdd.InoutDiseType = "1"
  498. // fdd.MaindiseFlag = "1"
  499. // fdd.DiseDate = s_tm
  500. // fdd.DiasSrtNo = strconv.FormatInt(int64(index), 10)
  501. // fdd.DiseName = item.CountryContentName
  502. // fdd.DiseCodg = item.CountryCode
  503. // fdds = append(fdds, &fdd)
  504. // }
  505. // }
  506. // fed.DrCodg = strconv.FormatInt(doctor_info.ID, 10)
  507. // fed.AdmDeptCodg = strconv.FormatInt(department.ID, 10)
  508. // fed.AdmDeptName = department.Name
  509. // fed.DscgDeptCodg = strconv.FormatInt(department.ID, 10)
  510. // fed.DscgDeptName = department.Name
  511. //
  512. // fed.MedType = order.MedType
  513. // //处方医嘱信息
  514. // var orders []*models.FsiOrderDtos
  515. // //for _, item := range prescriptions {
  516. // // for _, subItem := range item.HisDoctorAdviceInfo {
  517. // // var order models.FsiOrderDtos
  518. // // order.RxID = strconv.FormatInt(item.ID, 10)
  519. // // order.Rxno = strconv.FormatInt(item.ID, 10)
  520. // // order.LongDrordFlag = "0"
  521. // // order.HilistType = "1"
  522. // // order.ChrgType = "1"
  523. // // order.DrordBhvr = "-"
  524. // // order.HilistCode = subItem.BaseDrugLib.MedicalInsuranceNumber
  525. // // order.HosplistName = subItem.BaseDrugLib.DrugName
  526. // // order.HilistLv = "1"
  527. // // order.HilistPric = strconv.FormatFloat(subItem.Price, 'E', -1, 64)
  528. // // order.HosplistCode = subItem.BaseDrugLib.MedicalInsuranceNumber
  529. // // order.HosplistName = subItem.BaseDrugLib.DrugName
  530. // // order.Cnt = strconv.FormatFloat(subItem.PrescribingNumber, 'E', -1, 64)
  531. // // order.Pric = strconv.FormatFloat(subItem.Price, 'E', -1, 64)
  532. // // order.Sumamt = strconv.FormatFloat((subItem.Price * subItem.PrescribingNumber), 'E', -1, 64)
  533. // // order.OwnpayAmt = ""
  534. // // order.SelfpayAmt = ""
  535. // // order.Spec = ""
  536. // // order.SpecUnt = ""
  537. // // order.DrordBegnDate = s_tm
  538. // // order.DrordStopDate = ""
  539. // // order.DrordDrCodg = "1"
  540. // // order.DrordDeptName = department.Name
  541. // // order.DrordDrCodg = "1"
  542. // // order.DrordDrName = doctor_info.UserName
  543. // // order.DrordDrProfttl = ""
  544. // // order.CurrDrordFlag = "1"
  545. // // orders = append(orders, &order)
  546. // // }
  547. // // for _, subItem := range item.HisPrescriptionProject {
  548. // // if subItem.Type == 2 {
  549. // // var order models.FsiOrderDtos
  550. // // order.RxID = strconv.FormatInt(item.ID, 10)
  551. // // order.Rxno = strconv.FormatInt(item.ID, 10)
  552. // // order.LongDrordFlag = "0"
  553. // // order.HilistType = "1"
  554. // // order.ChrgType = "1"
  555. // // order.DrordBhvr = "-"
  556. // // order.HilistCode = subItem.HisProject.MedicalCode
  557. // // order.HosplistName = subItem.HisProject.ProjectName
  558. // // order.HilistLv = "1"
  559. // // order.HilistPric = strconv.FormatFloat(subItem.Price, 'E', -1, 64)
  560. // // order.HosplistCode = subItem.HisProject.MedicalCode
  561. // // order.HosplistName = subItem.HisProject.ProjectName
  562. // // order.Cnt = subItem.Count
  563. // // cnt, _ := strconv.ParseFloat(subItem.Count, 64)
  564. // //
  565. // // order.Pric = strconv.FormatFloat(subItem.Price, 'E', -1, 64)
  566. // // order.Sumamt = strconv.FormatFloat((subItem.Price * cnt), 'E', -1, 64)
  567. // // order.OwnpayAmt = ""
  568. // // order.SelfpayAmt = ""
  569. // // order.Spec = ""
  570. // // order.SpecUnt = ""
  571. // // order.DrordBegnDate = s_tm
  572. // // order.DrordStopDate = ""
  573. // // order.DrordDrCodg = "1"
  574. // // order.DrordDeptName = department.Name
  575. // // order.DrordDrCodg = "1"
  576. // // order.DrordDrName = doctor_info.UserName
  577. // // order.DrordDrProfttl = ""
  578. // // order.CurrDrordFlag = "1"
  579. // // orders = append(orders, &order)
  580. // //
  581. // // }
  582. // // if subItem.Type == 3 {
  583. // //
  584. // // var order models.FsiOrderDtos
  585. // // order.RxID = strconv.FormatInt(item.ID, 10)
  586. // // order.Rxno = strconv.FormatInt(item.ID, 10)
  587. // // order.LongDrordFlag = "0"
  588. // // order.HilistType = "1"
  589. // // order.ChrgType = "1"
  590. // // order.DrordBhvr = "-"
  591. // // order.HilistCode = subItem.GoodInfo.MedicalInsuranceNumber
  592. // // order.HosplistName = subItem.GoodInfo.GoodName
  593. // // order.HilistLv = "1"
  594. // // order.HilistPric = strconv.FormatFloat(subItem.Price, 'E', -1, 64)
  595. // // order.HosplistCode = subItem.GoodInfo.MedicalInsuranceNumber
  596. // // order.HosplistName = subItem.GoodInfo.GoodName
  597. // // order.Cnt = subItem.Count
  598. // // cnt, _ := strconv.ParseFloat(subItem.Count, 64)
  599. // // order.Pric = strconv.FormatFloat(subItem.Price, 'E', -1, 64)
  600. // // order.Sumamt = strconv.FormatFloat((subItem.Price * cnt), 'E', -1, 64)
  601. // // order.OwnpayAmt = ""
  602. // // order.SelfpayAmt = ""
  603. // // order.Spec = ""
  604. // // order.SpecUnt = ""
  605. // // order.DrordBegnDate = s_tm
  606. // // order.DrordStopDate = ""
  607. // // order.DrordDrCodg = "1"
  608. // // order.DrordDeptName = department.Name
  609. // // order.DrordDrCodg = "1"
  610. // // order.DrordDrName = doctor_info.UserName
  611. // // order.DrordDrProfttl = ""
  612. // // order.CurrDrordFlag = "1"
  613. // // orders = append(orders, &order)
  614. // //
  615. // // }
  616. // // }
  617. // //}
  618. // for _, item := range prescriptions {
  619. // for _, subItem := range item.HisDoctorAdviceInfo {
  620. // var order models.FsiOrderDtos
  621. // order.RxID = strconv.FormatInt(item.ID, 10)
  622. // order.Rxno = strconv.FormatInt(item.ID, 10)
  623. // order.LongDrordFlag = "0"
  624. // order.HilistType = "1"
  625. // order.ChrgType = "1"
  626. // order.DrordBhvr = "-"
  627. // order.HilistCode = subItem.BaseDrugLib.MedicalInsuranceNumber
  628. // order.HosplistName = subItem.BaseDrugLib.DrugName
  629. // order.HilistLv = "1"
  630. // order.HilistPric = fmt.Sprintf("%.2f", subItem.Price)
  631. // order.HosplistCode = subItem.BaseDrugLib.MedicalInsuranceNumber
  632. // order.HosplistName = subItem.BaseDrugLib.DrugName
  633. // order.Cnt = fmt.Sprintf("%.2f", subItem.PrescribingNumber)
  634. // order.Pric = fmt.Sprintf("%.2f", subItem.Price)
  635. // order.Sumamt = fmt.Sprintf("%.2f", (subItem.PrescribingNumber * subItem.Price))
  636. // order.OwnpayAmt = ""
  637. // order.SelfpayAmt = ""
  638. // order.Spec = ""
  639. // order.SpecUnt = ""
  640. // order.DrordBegnDate = s_tm
  641. // order.DrordStopDate = ""
  642. // order.DrordDrCodg = "1"
  643. // order.DrordDeptName = department.Name
  644. // order.DrordDrCodg = "1"
  645. // order.DrordDrName = doctor_info.UserName
  646. // order.DrordDrProfttl = ""
  647. // order.CurrDrordFlag = "1"
  648. // orders = append(orders, &order)
  649. // }
  650. // for _, subItem := range item.HisPrescriptionProject {
  651. // if subItem.Type == 2 {
  652. // var order models.FsiOrderDtos
  653. // order.RxID = strconv.FormatInt(item.ID, 10)
  654. // order.Rxno = strconv.FormatInt(item.ID, 10)
  655. // order.LongDrordFlag = "0"
  656. // order.HilistType = "1"
  657. // order.ChrgType = "1"
  658. // order.DrordBhvr = "-"
  659. // order.HilistCode = subItem.HisProject.MedicalCode
  660. // order.HosplistName = subItem.HisProject.ProjectName
  661. // order.HilistLv = "1"
  662. // order.HilistPric = fmt.Sprintf("%.2f", subItem.Price)
  663. // order.HosplistCode = subItem.HisProject.MedicalCode
  664. // order.HosplistName = subItem.HisProject.ProjectName
  665. // order.Cnt = subItem.Count
  666. // cnt, _ := strconv.ParseFloat(subItem.Count, 64)
  667. // order.Pric = fmt.Sprintf("%.2f", subItem.Price)
  668. // order.Sumamt = fmt.Sprintf("%.2f", subItem.Price*cnt)
  669. // order.OwnpayAmt = ""
  670. // order.SelfpayAmt = ""
  671. // order.Spec = ""
  672. // order.SpecUnt = ""
  673. // order.DrordBegnDate = s_tm
  674. // order.DrordStopDate = ""
  675. // order.DrordDrCodg = "1"
  676. // order.DrordDeptName = department.Name
  677. // order.DrordDrCodg = "1"
  678. // order.DrordDrName = doctor_info.UserName
  679. // order.DrordDrProfttl = ""
  680. // order.CurrDrordFlag = "1"
  681. // orders = append(orders, &order)
  682. //
  683. // }
  684. // if subItem.Type == 3 {
  685. //
  686. // var order models.FsiOrderDtos
  687. // order.RxID = strconv.FormatInt(item.ID, 10)
  688. // order.Rxno = strconv.FormatInt(item.ID, 10)
  689. // order.LongDrordFlag = "0"
  690. // order.HilistType = "1"
  691. // order.ChrgType = "1"
  692. // order.DrordBhvr = "-"
  693. // order.HilistCode = subItem.GoodInfo.MedicalInsuranceNumber
  694. // order.HosplistName = subItem.GoodInfo.GoodName
  695. // order.HilistLv = "1"
  696. // order.HilistPric = fmt.Sprintf("%.2f", subItem.Price)
  697. // order.HosplistCode = subItem.GoodInfo.MedicalInsuranceNumber
  698. // order.HosplistName = subItem.GoodInfo.GoodName
  699. // order.Cnt = subItem.Count
  700. // cnt, _ := strconv.ParseFloat(subItem.Count, 64)
  701. // order.Pric = fmt.Sprintf("%.2f", subItem.Price)
  702. // order.Sumamt = fmt.Sprintf("%.2f", subItem.Price*cnt)
  703. // order.OwnpayAmt = ""
  704. // order.SelfpayAmt = ""
  705. // order.Spec = ""
  706. // order.SpecUnt = ""
  707. // order.DrordBegnDate = s_tm
  708. // order.DrordStopDate = ""
  709. // order.DrordDrCodg = "1"
  710. // order.DrordDeptName = department.Name
  711. // order.DrordDrCodg = "1"
  712. // order.DrordDrName = doctor_info.UserName
  713. // order.DrordDrProfttl = ""
  714. // order.CurrDrordFlag = "1"
  715. // orders = append(orders, &order)
  716. //
  717. // }
  718. // }
  719. // }
  720. // //处方医嘱信息
  721. // fed.MatnStas = "0"
  722. // fed.MedfeeSumamt = fmt.Sprintf("%.2f", order.MedfeeSumamt)
  723. // fed.OwnpayAmt = fmt.Sprintf("%.2f", order.FulamtOwnpayAmt)
  724. // fed.SelfpayAmt = fmt.Sprintf("%.2f", order.PreselfpayAmt)
  725. // fed.AcctPayamt = fmt.Sprintf("%.2f", order.AcctPay)
  726. // fed.MaAmt = fmt.Sprintf("%.2f", order.MafPay)
  727. // fed.HifpPayamt = fmt.Sprintf("%.2f", order.HifpPay)
  728. // fed.SetlTotlnum = "1"
  729. // fed.Insutype = his.Insutype
  730. // fed.ReimFlag = "0"
  731. // fed.OutSetlFlag = "0"
  732. //
  733. // var fopd []*models.FsiOperationDtosData
  734. // data := make(map[string]interface{})
  735. // data["fed"] = fed
  736. // data["fdd"] = fdds
  737. // data["fod"] = orders
  738. // data["pd"] = pd
  739. // data["pp"] = pp
  740. // data["fopd"] = fopd
  741. // data["trig_scen"] = trig_scen
  742. //
  743. // client := &http.Client{}
  744. // bytesData, _ := json.Marshal(data)
  745. // var req *http.Request
  746. // if miConfig.MdtrtareaAdmvs == "320921" {
  747. // req, _ = http.NewRequest("POST", "http://192.168.2.110:9532/"+"jsyb/3102", bytes.NewReader(bytesData))
  748. // } else {
  749. // req, _ = http.NewRequest("POST", "http://192.168.5.251:9532/"+"jsyb/3102", bytes.NewReader(bytesData))
  750. // }
  751. //
  752. // resp, _ := client.Do(req)
  753. // defer resp.Body.Close()
  754. // body, ioErr := ioutil.ReadAll(resp.Body)
  755. // if ioErr != nil {
  756. // utils.ErrorLog("接口返回数据读取失败: %v", ioErr)
  757. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  758. // return
  759. // }
  760. // var respJSON map[string]interface{}
  761. // if err := json.Unmarshal([]byte(body), &respJSON); err != nil {
  762. // utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
  763. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  764. // return
  765. // }
  766. // //手术操作集合
  767. //
  768. // //手术操作集合
  769. //
  770. //}
  771. //
  772. //func (c *HisApiController) Check() {
  773. // psn_no := c.GetString("psn_no")
  774. // in := c.GetString("in")
  775. // mt := c.GetString("mt")
  776. //
  777. // baseParams := models.BaseParams{
  778. // SecretKey: "MSDBYGxXm1Mtyi3PtOUB7n1ktcxwyW57",
  779. // FixmedinsCode: "H15049901371",
  780. // InsuplcAdmdvs: "150499",
  781. // MdtrtareaAdmvs: "150499",
  782. // OrgName: "赤峰费森血液透析中心",
  783. // Doctor: "1111",
  784. // }
  785. // service.Gdyb2001(baseParams, psn_no, in, mt)
  786. //
  787. //}
  788. //func (c *HisApiController) GetPsnNcdsInfo() {
  789. // admin_user_id, _ := c.GetInt64("admin_user_id")
  790. // patient_id, _ := c.GetInt64("patient_id")
  791. //
  792. // id, _ := c.GetInt64("id")
  793. // adminUser := c.GetAdminUserInfo()
  794. // miConfig, _ := service.FindMedicalInsuranceInfo(adminUser.CurrentOrgId)
  795. // //config, _ := service.GetMedicalInsuranceConfig(adminUser.CurrentOrgId)
  796. // //patient, _ := service.GetPatientByID(c.GetAdminUserInfo().CurrentOrgId, id)
  797. // role, _ := service.GetAdminUserInfoByID(adminUser.CurrentOrgId, admin_user_id)
  798. // psn_record, _ := service.GetPsnNCDSRecordById(id)
  799. // //
  800. // //if psn_record.ID == 0 {
  801. // // c.ServeFailJSONWithSGJErrorCode(enums.ErrorPsnRecordNoExistWrong)
  802. // // return
  803. // //}
  804. //
  805. // var res Result5301
  806. // var res10265 Result5301For10265
  807. //
  808. // if miConfig.MdtrtareaAdmvs == "320921" || miConfig.MdtrtareaAdmvs == "320982" {
  809. //
  810. // psn_info, _ := service.GetPsnByPatientId(patient_id)
  811. // var api string
  812. // if miConfig.MdtrtareaAdmvs == "320921" {
  813. // api = "http://192.168.2.110:9532/" + "jsyb/5301?" + "fixmedins_code=" + miConfig.Code + "&secret_key=" + miConfig.SecretKey + "&ak=" + miConfig.AccessKey + "&org_name=" + miConfig.OrgName + "&doctor=" + role.UserName +
  814. // "&insuplc_admdvs=" + miConfig.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey + "&url=" + miConfig.Url + "&psn_no=" + psn_info.PsnNo + "&cainfo=" + miConfig.Cainfo
  815. //
  816. // } else {
  817. // 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 +
  818. // "&insuplc_admdvs=" + miConfig.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey + "&url=" + miConfig.Url + "&psn_no=" + psn_info.PsnNo + "&cainfo=" + miConfig.Cainfo
  819. //
  820. // }
  821. //
  822. // resp, requestErr := http.Get(api)
  823. // if requestErr != nil {
  824. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  825. // return
  826. // }
  827. //
  828. // body, ioErr := ioutil.ReadAll(resp.Body)
  829. // if ioErr != nil {
  830. // utils.ErrorLog("接口返回数据读取失败: %v", ioErr)
  831. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  832. // return
  833. // }
  834. // var respJSON map[string]interface{}
  835. // if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
  836. // utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
  837. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  838. // return
  839. // }
  840. // respJSON = respJSON["data"].(map[string]interface{})["pre"].(map[string]interface{})
  841. // result, _ := json.Marshal(respJSON)
  842. // if err := json.Unmarshal([]byte(result), &res10265); err != nil {
  843. // utils.ErrorLog("解析失败:%v", err)
  844. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  845. // return
  846. // }
  847. // res.ErrMsg = res10265.ErrMsg
  848. // res.Output = res10265.Output
  849. // res.InfRefmsgid = res10265.InfRefmsgid
  850. // infocode, _ := strconv.ParseInt(res10265.Infcode, 10, 64)
  851. // res.Infcode = infocode
  852. //
  853. // } else {
  854. //
  855. // result := service.Gdyb5301(psn_record.PsnNo, miConfig.OrgName, role.UserName, miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey)
  856. //
  857. // var dat map[string]interface{}
  858. // if err := json.Unmarshal([]byte(result), &dat); err == nil {
  859. // fmt.Println(dat)
  860. // } else {
  861. // fmt.Println(err)
  862. // }
  863. //
  864. // userJSONBytes, _ := json.Marshal(dat)
  865. //
  866. // if miConfig.Code == "H15049901371" {
  867. // if err := json.Unmarshal(userJSONBytes, &res10265); err != nil {
  868. // utils.ErrorLog("解析失败:%v", err)
  869. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  870. // return
  871. // }
  872. // res.InfRefmsgid = res10265.InfRefmsgid
  873. // res.Output = res10265.Output
  874. // res.ErrMsg = res10265.ErrMsg
  875. // infocode, _ := strconv.ParseInt(res10265.Infcode, 10, 64)
  876. // res.Infcode = infocode
  877. // } else {
  878. // if err := json.Unmarshal(userJSONBytes, &res); err != nil {
  879. // utils.ErrorLog("解析失败:%v", err)
  880. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  881. // return
  882. // }
  883. //
  884. // }
  885. //
  886. // }
  887. //
  888. // if res.Infcode == 0 {
  889. // c.ServeSuccessJSON(map[string]interface{}{
  890. // "result": res.Output.Result,
  891. // })
  892. // }
  893. //
  894. //}
  895. //func (c *HisApiController) CheckInsutype() {
  896. // his_patient_id, _ := c.GetInt64("his_patient_id")
  897. // admin_user_id, _ := c.GetInt64("admin_user_id")
  898. // roles, _ := service.GetAdminUserInfoByID(c.GetAdminUserInfo().CurrentOrgId, admin_user_id)
  899. // his, _ := service.GetNewHisPatientInfoFour(c.GetAdminUserInfo().CurrentOrgId, his_patient_id)
  900. // miConfig, _ := service.FindMedicalInsuranceInfo(c.GetAdminUserInfo().CurrentOrgId)
  901. // result := service.Gdyb90100(his.PsnNo, miConfig.OrgName, roles.UserName, miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey)
  902. //
  903. // var dat map[string]interface{}
  904. // if err := json.Unmarshal([]byte(result), &dat); err == nil {
  905. // fmt.Println(dat)
  906. // } else {
  907. // fmt.Println(err)
  908. // }
  909. //
  910. // userJSONBytes, _ := json.Marshal(dat)
  911. // var res Result90100
  912. // if err := json.Unmarshal(userJSONBytes, &res); err != nil {
  913. // utils.ErrorLog("解析失败:%v", err)
  914. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  915. // return
  916. // }
  917. //
  918. // if res.Infcode != 0 {
  919. // c.ServeSuccessJSON(map[string]interface{}{
  920. // "failed_code": -10,
  921. // "msg": res.ErrMsg,
  922. // })
  923. // return
  924. // } else {
  925. // fmt.Println(res)
  926. //
  927. // }
  928. //
  929. //}
  930. //func (c *HisApiController) CheckCardPWD() {
  931. // card_pwd := c.GetString("card_pwd")
  932. // his_patient_id, _ := c.GetInt64("his_patient_id")
  933. // admin_user_id, _ := c.GetInt64("admin_user_id")
  934. // roles, _ := service.GetAdminUserInfoByID(c.GetAdminUserInfo().CurrentOrgId, admin_user_id)
  935. // miConfig, _ := service.FindMedicalInsuranceInfo(c.GetAdminUserInfo().CurrentOrgId)
  936. // his, _ := service.GetNewHisPatientInfoFour(c.GetAdminUserInfo().CurrentOrgId, his_patient_id)
  937. // psn, _ := service.GetPsnByPatientId(his.PatientId)
  938. // bas := strings.Split(psn.CardInfo, "|")
  939. // basNumber := bas[2]
  940. // result := service.Gdyb90991(his.PsnNo, miConfig.OrgName, roles.UserName, miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, card_pwd, basNumber)
  941. //
  942. // var dat map[string]interface{}
  943. // if err := json.Unmarshal([]byte(result), &dat); err == nil {
  944. // fmt.Println(dat)
  945. // } else {
  946. // fmt.Println(err)
  947. // }
  948. //
  949. // userJSONBytes, _ := json.Marshal(dat)
  950. // var res Result90991
  951. // if err := json.Unmarshal(userJSONBytes, &res); err != nil {
  952. // utils.ErrorLog("解析失败:%v", err)
  953. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  954. // return
  955. // }
  956. //
  957. // if res.Infcode != 0 {
  958. // c.ServeSuccessJSON(map[string]interface{}{
  959. // "failed_code": -10,
  960. // "msg": res.ErrMsg,
  961. // })
  962. // return
  963. // } else {
  964. // if res.Output.Result.SscnoCheckStat == "0" {
  965. // var msg string
  966. // switch res.Output.Result.CardStat {
  967. // case "00":
  968. // msg = "未激活"
  969. // break
  970. // case "10":
  971. // msg = "激活"
  972. // break
  973. // case "20":
  974. // msg = "窗口挂失"
  975. // break
  976. // case "21":
  977. // msg = "电话挂失"
  978. // break
  979. // case "22":
  980. // msg = "单位网上申报挂失"
  981. // break
  982. // case "23":
  983. // msg = "保健办挂失"
  984. //
  985. // break
  986. // case "24":
  987. // msg = "个人网上挂失"
  988. //
  989. // break
  990. // case "25":
  991. // msg = "网上服务大厅挂失"
  992. // break
  993. // case "30":
  994. // msg = "注销"
  995. // break
  996. // case "40":
  997. // msg = "回收"
  998. // break
  999. // case "99":
  1000. // msg = "制卡中(无效卡)"
  1001. // break
  1002. // }
  1003. // c.ServeSuccessJSON(map[string]interface{}{
  1004. // "failed_code": -10,
  1005. // "msg": msg,
  1006. // })
  1007. // return
  1008. //
  1009. // } else {
  1010. // c.ServeSuccessJSON(map[string]interface{}{
  1011. // "msg": "校验成功",
  1012. // })
  1013. // return
  1014. // }
  1015. // }
  1016. //
  1017. //}
  1018. //
  1019. //func (c *HisApiController) CheckCardPWDTwo() {
  1020. // //card_pwd := c.GetString("card_pwd")
  1021. // //his_patient_id, _ := c.GetInt64("his_patient_id")
  1022. // admin_user_id, _ := c.GetInt64("admin_user_id")
  1023. // roles, _ := service.GetAdminUserInfoByID(c.GetAdminUserInfo().CurrentOrgId, admin_user_id)
  1024. // miConfig, _ := service.FindMedicalInsuranceInfo(c.GetAdminUserInfo().CurrentOrgId)
  1025. //
  1026. // result := service.Gdyb90991("44030000000629690364", miConfig.OrgName, roles.UserName, miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, "000000", "BDM421363")
  1027. //
  1028. // var dat map[string]interface{}
  1029. // if err := json.Unmarshal([]byte(result), &dat); err == nil {
  1030. // fmt.Println(dat)
  1031. // } else {
  1032. // fmt.Println(err)
  1033. // }
  1034. //
  1035. // userJSONBytes, _ := json.Marshal(dat)
  1036. // var res Result90991
  1037. // if err := json.Unmarshal(userJSONBytes, &res); err != nil {
  1038. // utils.ErrorLog("解析失败:%v", err)
  1039. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  1040. // return
  1041. // }
  1042. //
  1043. // if res.Infcode != 0 {
  1044. // c.ServeSuccessJSON(map[string]interface{}{
  1045. // "failed_code": -10,
  1046. // "msg": res.ErrMsg,
  1047. // })
  1048. // return
  1049. // } else {
  1050. // if res.Output.Result.SscnoCheckStat == "0" {
  1051. // var msg string
  1052. // switch res.Output.Result.CardStat {
  1053. // case "00":
  1054. // msg = "未激活"
  1055. // break
  1056. // case "10":
  1057. // msg = "激活"
  1058. // break
  1059. // case "20":
  1060. // msg = "窗口挂失"
  1061. // break
  1062. // case "21":
  1063. // msg = "电话挂失"
  1064. // break
  1065. // case "22":
  1066. // msg = "单位网上申报挂失"
  1067. // break
  1068. // case "23":
  1069. // msg = "保健办挂失"
  1070. //
  1071. // break
  1072. // case "24":
  1073. // msg = "个人网上挂失"
  1074. //
  1075. // break
  1076. // case "25":
  1077. // msg = "网上服务大厅挂失"
  1078. // break
  1079. // case "30":
  1080. // msg = "注销"
  1081. // break
  1082. // case "40":
  1083. // msg = "回收"
  1084. // break
  1085. // case "99":
  1086. // msg = "制卡中(无效卡)"
  1087. // break
  1088. // }
  1089. // c.ServeSuccessJSON(map[string]interface{}{
  1090. // "failed_code": -10,
  1091. // "msg": msg,
  1092. // })
  1093. // return
  1094. //
  1095. // } else {
  1096. // c.ServeSuccessJSON(map[string]interface{}{
  1097. // "msg": "校验成功",
  1098. // })
  1099. // return
  1100. // }
  1101. // }
  1102. //
  1103. //}
  1104. //
  1105. ////func (c *HisApiController) ReadCard() {
  1106. //// id_card_type, _ := c.GetInt64("id_card_type")
  1107. //// admin_user_id, _ := c.GetInt64("admin_user_id")
  1108. //// certificates, _ := c.GetInt64("certificates")
  1109. //// fmt.Println(c.GetAdminUserInfo().CurrentOrgId)
  1110. //// roles, _ := service.GetAdminUserInfoByID(c.GetAdminUserInfo().CurrentOrgId, admin_user_id)
  1111. //// miConfig, _ := service.FindMedicalInsuranceInfo(c.GetAdminUserInfo().CurrentOrgId)
  1112. ////
  1113. //// switch id_card_type {
  1114. //// case 1:
  1115. //// if miConfig.MdtrtareaAdmvs == "421300" {
  1116. //// var res ResultTwo
  1117. //// api := "http://192.168.124.4:9532/" + "hbyb/1101?cert_no=" + "" +
  1118. //// "&org_name=" + miConfig.OrgName + "&doctor=" + roles.UserName + "&fixmedins_code=" + miConfig.Code +
  1119. //// "&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)
  1120. ////
  1121. //// resp, requestErr := http.Get(api)
  1122. //// if requestErr != nil {
  1123. //// c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  1124. //// return
  1125. //// }
  1126. ////
  1127. //// body, ioErr := ioutil.ReadAll(resp.Body)
  1128. //// if ioErr != nil {
  1129. //// utils.ErrorLog("接口返回数据读取失败: %v", ioErr)
  1130. //// c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  1131. //// return
  1132. //// }
  1133. //// var respJSON map[string]interface{}
  1134. //// if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
  1135. //// utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
  1136. //// c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  1137. //// return
  1138. //// }
  1139. ////
  1140. //// respJSON = respJSON["data"].(map[string]interface{})["pre"].(map[string]interface{})
  1141. //// result, _ := json.Marshal(respJSON)
  1142. //// fmt.Println("log")
  1143. //// fmt.Println(string(result))
  1144. ////
  1145. //// if err := json.Unmarshal([]byte(result), &res); err != nil {
  1146. //// utils.ErrorLog("解析失败:%v", err)
  1147. //// c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  1148. //// return
  1149. //// }
  1150. ////
  1151. //// if res.Infcode == 0 {
  1152. //// patient, err := service.GetPatientByIDCard(res.Output.Baseinfo.Certno, c.GetAdminUserInfo().CurrentOrgId)
  1153. //// if err == gorm.ErrRecordNotFound {
  1154. //// c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeNoPateintException)
  1155. //// return
  1156. //// } else if err != nil {
  1157. //// c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
  1158. //// return
  1159. ////
  1160. //// } else {
  1161. ////
  1162. //// Iinfos, _ := json.Marshal(res.Output.Iinfo)
  1163. //// Idetinfos, _ := json.Marshal(res.Output.Idetinfo)
  1164. //// infoStr := string(Iinfos)
  1165. //// idetinfoStr := string(Idetinfos)
  1166. //// psn := &models.HisPsn{
  1167. //// PsnNo: res.Output.Baseinfo.PsnNo,
  1168. //// Age: res.Output.Baseinfo.Age,
  1169. //// PatientId: patient.ID,
  1170. //// Certno: res.Output.Baseinfo.Certno,
  1171. //// Brdy: res.Output.Baseinfo.Brdy,
  1172. //// Gend: res.Output.Baseinfo.Gend,
  1173. //// Naty: res.Output.Baseinfo.Naty,
  1174. //// PsnCertType: res.Output.Baseinfo.PsnCertType,
  1175. //// PsnName: res.Output.Baseinfo.PsnName,
  1176. //// Idetinfo: idetinfoStr,
  1177. //// Insuinfo: infoStr,
  1178. //// UserOrgId: c.GetAdminUserInfo().CurrentOrgId,
  1179. //// }
  1180. //// service.CreateHisPsn(psn)
  1181. ////
  1182. //// c.ServeSuccessJSON(map[string]interface{}{
  1183. //// "patient": patient,
  1184. //// "number": res.Output.Baseinfo.Certno,
  1185. //// })
  1186. //// }
  1187. //// } else {
  1188. //// c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeHisFailedException)
  1189. //// return
  1190. //// }
  1191. ////
  1192. //// } else if miConfig.MdtrtareaAdmvs == "320921" || miConfig.MdtrtareaAdmvs == "320982" {
  1193. //// var api string
  1194. //// if miConfig.MdtrtareaAdmvs == "320921" {
  1195. //// api = "http://192.168.2.110:9532/" + "jsyb/readcard?" + "fixmedins_code=" + miConfig.Code + "&secret_key=" + miConfig.SecretKey + "&ak=" + miConfig.AccessKey + "&org_name=" + miConfig.OrgName + "&doctor=" + roles.UserName +
  1196. //// "&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
  1197. //// fmt.Println(api)
  1198. //// } else {
  1199. //// 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 +
  1200. //// "&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)
  1201. //// }
  1202. ////
  1203. //// resp, requestErr := http.Get(api)
  1204. //// if requestErr != nil {
  1205. //// c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  1206. //// return
  1207. //// }
  1208. ////
  1209. //// body, ioErr := ioutil.ReadAll(resp.Body)
  1210. //// if ioErr != nil {
  1211. //// utils.ErrorLog("接口返回数据读取失败: %v", ioErr)
  1212. //// c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  1213. //// return
  1214. //// }
  1215. //// var respJSON map[string]interface{}
  1216. //// if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
  1217. //// utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
  1218. //// c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  1219. //// return
  1220. //// }
  1221. //// var status string
  1222. //// status = respJSON["data"].(map[string]interface{})["status"].(string)
  1223. //// card_type := respJSON["data"].(map[string]interface{})["type"].(string)
  1224. //// //console.log()
  1225. //// fmt.Println("type===")
  1226. ////
  1227. //// fmt.Println(card_type)
  1228. ////
  1229. //// var token string
  1230. //// var res ResultTwo //1101结果
  1231. //// var res10265 ResultTwo10265 //1101结果
  1232. //// var card_info string //卡信息
  1233. //// var busi_card_info string
  1234. ////
  1235. //// card_info = respJSON["data"].(map[string]interface{})["card_info"].(string)
  1236. //// busi_card_info = respJSON["data"].(map[string]interface{})["busi_card_info"].(string)
  1237. ////
  1238. //// if status == "0" { //读卡成功
  1239. //// if card_type == "1" {
  1240. ////
  1241. //// respJSON = respJSON["data"].(map[string]interface{})["result"].(map[string]interface{})
  1242. //// result, _ := json.Marshal(respJSON)
  1243. ////
  1244. //// if err := json.Unmarshal([]byte(result), &res10265); err != nil {
  1245. //// utils.ErrorLog("解析失败:%v", err)
  1246. //// c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  1247. //// return
  1248. //// }
  1249. //// res.ErrMsg = res10265.ErrMsg
  1250. //// infocode, _ := strconv.ParseInt(res10265.Infcode, 10, 64)
  1251. //// res.Infcode = infocode
  1252. //// res.Output = res10265.Output
  1253. //// res.InfRefmsgid = res10265.InfRefmsgid
  1254. ////
  1255. //// } else {
  1256. //// //var card_info string //卡信息
  1257. //// //var busi_card_info string
  1258. ////
  1259. //// token = respJSON["data"].(map[string]interface{})["token"].(string)
  1260. //// //busi_card_info = respJSON["data"].(map[string]interface{})["busi_card_info"].(string)
  1261. ////
  1262. //// //fmt.Println(card_info)
  1263. //// //fmt.Println(busi_card_info)
  1264. ////
  1265. //// respJSON = respJSON["data"].(map[string]interface{})["result"].(map[string]interface{})
  1266. //// result, _ := json.Marshal(respJSON)
  1267. ////
  1268. //// if err := json.Unmarshal([]byte(result), &res10265); err != nil {
  1269. //// utils.ErrorLog("解析失败:%v", err)
  1270. //// c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  1271. //// return
  1272. //// }
  1273. //// res.ErrMsg = res10265.ErrMsg
  1274. //// infocode, _ := strconv.ParseInt(res10265.Infcode, 10, 64)
  1275. //// res.Infcode = infocode
  1276. //// res.Output = res10265.Output
  1277. //// res.InfRefmsgid = res10265.InfRefmsgid
  1278. ////
  1279. //// }
  1280. ////
  1281. //// if res.Infcode == 0 {
  1282. //// patient, err := service.GetPatientByIDCard(res.Output.Baseinfo.Certno, c.GetAdminUserInfo().CurrentOrgId)
  1283. //// if err == gorm.ErrRecordNotFound {
  1284. //// c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeNoPateintException)
  1285. //// return
  1286. //// } else if err != nil {
  1287. //// c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
  1288. //// return
  1289. ////
  1290. //// } else {
  1291. ////
  1292. //// if card_type == "1" {
  1293. //// bas := strings.Split(card_info, "|")
  1294. //// basNumber := bas[2]
  1295. //// Iinfos, _ := json.Marshal(res.Output.Iinfo)
  1296. //// Idetinfos, _ := json.Marshal(res.Output.Idetinfo)
  1297. //// infoStr := string(Iinfos)
  1298. //// idetinfoStr := string(Idetinfos)
  1299. //// psn := &models.HisPsn{
  1300. //// PsnNo: res.Output.Baseinfo.PsnNo,
  1301. //// Age: res.Output.Baseinfo.Age,
  1302. //// PatientId: patient.ID,
  1303. //// Certno: res.Output.Baseinfo.Certno,
  1304. //// Brdy: res.Output.Baseinfo.Brdy,
  1305. //// Gend: res.Output.Baseinfo.Gend,
  1306. //// Naty: res.Output.Baseinfo.Naty,
  1307. //// PsnCertType: res.Output.Baseinfo.PsnCertType,
  1308. //// PsnName: res.Output.Baseinfo.PsnName,
  1309. //// Idetinfo: idetinfoStr,
  1310. //// Insuinfo: infoStr,
  1311. //// UserOrgId: c.GetAdminUserInfo().CurrentOrgId,
  1312. //// CardInfo: card_info,
  1313. //// VerifyNumber: busi_card_info,
  1314. //// }
  1315. //// service.CreateHisPsn(psn)
  1316. ////
  1317. //// var rf []*ResultFive
  1318. //// json.Unmarshal([]byte(infoStr), &rf)
  1319. ////
  1320. //// var insutypes []*ResultFive
  1321. //// var insutype string
  1322. //// var is390 int = 0
  1323. //// var is310 int = 0
  1324. ////
  1325. //// for _, item := range rf {
  1326. //// if (item.Insutype == "390" && item.PsnInsuStas == "1") || (item.Insutype == "310" && item.PsnInsuStas == "1") {
  1327. //// insutypes = append(insutypes, item)
  1328. //// }
  1329. //// }
  1330. ////
  1331. //// if len(insutypes) == 1 {
  1332. //// insutype = insutypes[0].Insutype
  1333. //// //insuplc_admdvs = insutypes[0].InsuplcAdmdvs
  1334. //// } else {
  1335. //// for _, i := range insutypes {
  1336. //// if i.Insutype == "390" {
  1337. //// is390 = 1
  1338. //// }
  1339. ////
  1340. //// if i.Insutype == "310" {
  1341. //// is310 = 1
  1342. //// }
  1343. //// }
  1344. //// }
  1345. //// if is390 == 1 {
  1346. //// insutype = "390"
  1347. //// }
  1348. ////
  1349. //// if is310 == 1 {
  1350. //// insutype = "310"
  1351. //// }
  1352. ////
  1353. //// if len(insutypes) == 0 {
  1354. //// insutype = "310"
  1355. //// }
  1356. ////
  1357. //// c.ServeSuccessJSON(map[string]interface{}{
  1358. //// "patient": patient,
  1359. //// "number": basNumber,
  1360. //// "insutype": insutype,
  1361. //// })
  1362. //// } else {
  1363. //// Iinfos, _ := json.Marshal(res.Output.Iinfo)
  1364. //// Idetinfos, _ := json.Marshal(res.Output.Idetinfo)
  1365. //// infoStr := string(Iinfos)
  1366. //// idetinfoStr := string(Idetinfos)
  1367. //// psn := &models.HisPsn{
  1368. //// PsnNo: res.Output.Baseinfo.PsnNo,
  1369. //// Age: res.Output.Baseinfo.Age,
  1370. //// PatientId: patient.ID,
  1371. //// Certno: res.Output.Baseinfo.Certno,
  1372. //// Brdy: res.Output.Baseinfo.Brdy,
  1373. //// Gend: res.Output.Baseinfo.Gend,
  1374. //// Naty: res.Output.Baseinfo.Naty,
  1375. //// PsnCertType: res.Output.Baseinfo.PsnCertType,
  1376. //// PsnName: res.Output.Baseinfo.PsnName,
  1377. //// Idetinfo: idetinfoStr,
  1378. //// Insuinfo: infoStr,
  1379. //// UserOrgId: c.GetAdminUserInfo().CurrentOrgId,
  1380. //// CardInfo: card_info,
  1381. //// VerifyNumber: token,
  1382. //// }
  1383. //// service.CreateHisPsn(psn)
  1384. //// c.ServeSuccessJSON(map[string]interface{}{
  1385. //// "patient": patient,
  1386. //// "number": token,
  1387. //// })
  1388. //// }
  1389. //// }
  1390. //// } else {
  1391. //// c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeHisFailedException)
  1392. //// return
  1393. //// }
  1394. //// } else { //读卡失败
  1395. //// c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeHisFailedException)
  1396. //// return
  1397. ////
  1398. //// }
  1399. ////
  1400. //// } else {
  1401. //// if initFlag == 0 {
  1402. //// c.TestGetBasBaseInit()
  1403. //// }
  1404. //// basStr := c.GetBasBaseInfo()
  1405. //// if len(basStr) == 0 {
  1406. //// c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeReadCardException)
  1407. //// return
  1408. //// }
  1409. //// fmt.Println(basStr)
  1410. //// bas := strings.Split(basStr, "|")
  1411. //// basNumber := bas[1]
  1412. //// fmt.Println(basNumber)
  1413. //// card_sn := bas[3]
  1414. //// fmt.Println(card_sn)
  1415. //// result := service.Gdyb1101B(basNumber, miConfig.OrgName, roles.UserName, miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, id_card_type, card_sn, certificates)
  1416. //// var dat map[string]interface{}
  1417. //// if err := json.Unmarshal([]byte(result), &dat); err == nil {
  1418. //// fmt.Println(dat)
  1419. //// } else {
  1420. //// fmt.Println(err)
  1421. //// }
  1422. ////
  1423. //// userJSONBytes, _ := json.Marshal(dat)
  1424. //// var res ResultTwo
  1425. //// if err := json.Unmarshal(userJSONBytes, &res); err != nil {
  1426. //// utils.ErrorLog("解析失败:%v", err)
  1427. //// c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  1428. //// return
  1429. //// }
  1430. ////
  1431. //// if res.Infcode == 0 {
  1432. //// patient, err := service.GetPatientByNumber(basNumber, c.GetAdminUserInfo().CurrentOrgId)
  1433. //// if err == gorm.ErrRecordNotFound {
  1434. //// c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeNoPateintException)
  1435. //// return
  1436. //// } else if err != nil {
  1437. //// c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
  1438. //// return
  1439. ////
  1440. //// } else {
  1441. //// Iinfos, _ := json.Marshal(res.Output.Iinfo)
  1442. //// Idetinfos, _ := json.Marshal(res.Output.Idetinfo)
  1443. //// infoStr := string(Iinfos)
  1444. //// idetinfoStr := string(Idetinfos)
  1445. //// psn := &models.HisPsn{
  1446. //// PsnNo: res.Output.Baseinfo.PsnNo,
  1447. //// Age: res.Output.Baseinfo.Age,
  1448. //// PatientId: patient.ID,
  1449. //// Certno: res.Output.Baseinfo.Certno,
  1450. //// Brdy: res.Output.Baseinfo.Brdy,
  1451. //// Gend: res.Output.Baseinfo.Gend,
  1452. //// Naty: res.Output.Baseinfo.Naty,
  1453. //// PsnCertType: res.Output.Baseinfo.PsnCertType,
  1454. //// PsnName: res.Output.Baseinfo.PsnName,
  1455. //// Idetinfo: idetinfoStr,
  1456. //// Insuinfo: infoStr,
  1457. //// UserOrgId: c.GetAdminUserInfo().CurrentOrgId,
  1458. //// CardInfo: basStr,
  1459. //// VerifyNumber: "",
  1460. //// }
  1461. //// service.CreateHisPsn(psn)
  1462. ////
  1463. //// c.ServeSuccessJSON(map[string]interface{}{
  1464. //// "patient": patient,
  1465. //// "number": basNumber,
  1466. //// })
  1467. //// }
  1468. //// } else {
  1469. //// c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeHisFailedException)
  1470. //// return
  1471. //// }
  1472. //// break
  1473. //// }
  1474. //// case 2:
  1475. //// SFZStr := c.GetSFZBaseInfo()
  1476. //// id_card_str := strings.Split(SFZStr, "^")
  1477. //// id_card_number := id_card_str[0]
  1478. //// card_sn := ""
  1479. //// result := service.Gdyb1101B(id_card_number, miConfig.OrgName, roles.UserName, miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, id_card_type, card_sn, certificates)
  1480. //// var dat map[string]interface{}
  1481. //// if err := json.Unmarshal([]byte(result), &dat); err == nil {
  1482. //// fmt.Println(dat)
  1483. //// } else {
  1484. //// fmt.Println(err)
  1485. //// }
  1486. ////
  1487. //// userJSONBytes, _ := json.Marshal(dat)
  1488. //// var res ResultTwo
  1489. //// if err := json.Unmarshal(userJSONBytes, &res); err != nil {
  1490. //// utils.ErrorLog("解析失败:%v", err)
  1491. //// c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  1492. //// return
  1493. //// }
  1494. ////
  1495. //// if res.Infcode == 0 {
  1496. //// patient, err := service.GetPatientByNumber(id_card_number, c.GetAdminUserInfo().CurrentOrgId)
  1497. //// if err == gorm.ErrRecordNotFound {
  1498. //// c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeNoPateintException)
  1499. //// return
  1500. //// } else if err != nil {
  1501. //// c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
  1502. //// return
  1503. ////
  1504. //// } else {
  1505. //// c.ServeSuccessJSON(map[string]interface{}{
  1506. //// "patient": patient,
  1507. //// "number": id_card_number,
  1508. //// })
  1509. //// }
  1510. //// } else {
  1511. //// c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeHisFailedException)
  1512. //// return
  1513. //// }
  1514. ////
  1515. //// break
  1516. //// case 3:
  1517. //// if miConfig.MdtrtareaAdmvs == "320921" || miConfig.MdtrtareaAdmvs == "320982" {
  1518. //// var api string
  1519. //// if miConfig.MdtrtareaAdmvs == "320921" {
  1520. //// api = "http://192.168.2.110:9532/" + "jsyb/readcard?" + "fixmedins_code=" + miConfig.Code + "&secret_key=" + miConfig.SecretKey + "&ak=" + miConfig.AccessKey + "&org_name=" + miConfig.OrgName + "&doctor=" + roles.UserName +
  1521. //// "&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
  1522. //// fmt.Println(api)
  1523. ////
  1524. //// } else {
  1525. //// 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 +
  1526. //// "&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)
  1527. //// }
  1528. ////
  1529. //// resp, requestErr := http.Get(api)
  1530. //// if requestErr != nil {
  1531. //// c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  1532. //// return
  1533. //// }
  1534. ////
  1535. //// body, ioErr := ioutil.ReadAll(resp.Body)
  1536. //// if ioErr != nil {
  1537. //// utils.ErrorLog("接口返回数据读取失败: %v", ioErr)
  1538. //// c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  1539. //// return
  1540. //// }
  1541. //// var respJSON map[string]interface{}
  1542. //// if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
  1543. //// utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
  1544. //// c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  1545. //// return
  1546. //// }
  1547. //// var status string
  1548. //// status = respJSON["data"].(map[string]interface{})["status"].(string)
  1549. //// card_type := respJSON["data"].(map[string]interface{})["type"].(string)
  1550. ////
  1551. //// var token string
  1552. //// var res ResultTwo //1101结果
  1553. //// var res10265 ResultTwo10265 //1101结果
  1554. //// var card_info string //卡信息
  1555. //// var busi_card_info string
  1556. ////
  1557. //// //card_info = respJSON["data"].(map[string]interface{})["card_info"].(string)
  1558. //// busi_card_info = respJSON["data"].(map[string]interface{})["busi_card_info"].(string)
  1559. ////
  1560. //// if status == "0" { //读卡成功
  1561. //// if card_type == "1" {
  1562. ////
  1563. //// respJSON = respJSON["data"].(map[string]interface{})["result"].(map[string]interface{})
  1564. //// result, _ := json.Marshal(respJSON)
  1565. ////
  1566. //// if err := json.Unmarshal([]byte(result), &res10265); err != nil {
  1567. //// utils.ErrorLog("解析失败:%v", err)
  1568. //// c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  1569. //// return
  1570. //// }
  1571. //// res.ErrMsg = res10265.ErrMsg
  1572. //// infocode, _ := strconv.ParseInt(res10265.Infcode, 10, 64)
  1573. //// res.Infcode = infocode
  1574. //// res.Output = res10265.Output
  1575. //// res.InfRefmsgid = res10265.InfRefmsgid
  1576. ////
  1577. //// } else {
  1578. //// //var card_info string //卡信息
  1579. //// //var busi_card_info string
  1580. ////
  1581. //// token = respJSON["data"].(map[string]interface{})["token"].(string)
  1582. //// //busi_card_info = respJSON["data"].(map[string]interface{})["busi_card_info"].(string)
  1583. ////
  1584. //// //fmt.Println(card_info)
  1585. //// //fmt.Println(busi_card_info)
  1586. ////
  1587. //// respJSON = respJSON["data"].(map[string]interface{})["result"].(map[string]interface{})
  1588. //// result, _ := json.Marshal(respJSON)
  1589. ////
  1590. //// if err := json.Unmarshal([]byte(result), &res10265); err != nil {
  1591. //// utils.ErrorLog("解析失败:%v", err)
  1592. //// c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  1593. //// return
  1594. //// }
  1595. //// res.ErrMsg = res10265.ErrMsg
  1596. //// infocode, _ := strconv.ParseInt(res10265.Infcode, 10, 64)
  1597. //// res.Infcode = infocode
  1598. //// res.Output = res10265.Output
  1599. //// res.InfRefmsgid = res10265.InfRefmsgid
  1600. ////
  1601. //// }
  1602. ////
  1603. //// if res.Infcode == 0 {
  1604. //// patient, err := service.GetPatientByIDCard(res.Output.Baseinfo.Certno, c.GetAdminUserInfo().CurrentOrgId)
  1605. //// if err == gorm.ErrRecordNotFound {
  1606. //// c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeNoPateintException)
  1607. //// return
  1608. //// } else if err != nil {
  1609. //// c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
  1610. //// return
  1611. ////
  1612. //// } else {
  1613. ////
  1614. //// if card_type == "1" {
  1615. //// bas := strings.Split(card_info, "|")
  1616. //// basNumber := bas[2]
  1617. //// Iinfos, _ := json.Marshal(res.Output.Iinfo)
  1618. //// Idetinfos, _ := json.Marshal(res.Output.Idetinfo)
  1619. //// infoStr := string(Iinfos)
  1620. //// idetinfoStr := string(Idetinfos)
  1621. //// psn := &models.HisPsn{
  1622. //// PsnNo: res.Output.Baseinfo.PsnNo,
  1623. //// Age: res.Output.Baseinfo.Age,
  1624. //// PatientId: patient.ID,
  1625. //// Certno: res.Output.Baseinfo.Certno,
  1626. //// Brdy: res.Output.Baseinfo.Brdy,
  1627. //// Gend: res.Output.Baseinfo.Gend,
  1628. //// Naty: res.Output.Baseinfo.Naty,
  1629. //// PsnCertType: res.Output.Baseinfo.PsnCertType,
  1630. //// PsnName: res.Output.Baseinfo.PsnName,
  1631. //// Idetinfo: idetinfoStr,
  1632. //// Insuinfo: infoStr,
  1633. //// UserOrgId: c.GetAdminUserInfo().CurrentOrgId,
  1634. //// CardInfo: card_info,
  1635. //// VerifyNumber: busi_card_info,
  1636. //// }
  1637. ////
  1638. //// service.CreateHisPsn(psn)
  1639. //// c.ServeSuccessJSON(map[string]interface{}{
  1640. //// "patient": patient,
  1641. //// "number": basNumber,
  1642. //// })
  1643. //// } else {
  1644. //// Iinfos, _ := json.Marshal(res.Output.Iinfo)
  1645. //// Idetinfos, _ := json.Marshal(res.Output.Idetinfo)
  1646. //// infoStr := string(Iinfos)
  1647. //// idetinfoStr := string(Idetinfos)
  1648. //// psn := &models.HisPsn{
  1649. //// PsnNo: res.Output.Baseinfo.PsnNo,
  1650. //// Age: res.Output.Baseinfo.Age,
  1651. //// PatientId: patient.ID,
  1652. //// Certno: res.Output.Baseinfo.Certno,
  1653. //// Brdy: res.Output.Baseinfo.Brdy,
  1654. //// Gend: res.Output.Baseinfo.Gend,
  1655. //// Naty: res.Output.Baseinfo.Naty,
  1656. //// PsnCertType: res.Output.Baseinfo.PsnCertType,
  1657. //// PsnName: res.Output.Baseinfo.PsnName,
  1658. //// Idetinfo: idetinfoStr,
  1659. //// Insuinfo: infoStr,
  1660. //// UserOrgId: c.GetAdminUserInfo().CurrentOrgId,
  1661. //// CardInfo: card_info,
  1662. //// VerifyNumber: token,
  1663. //// }
  1664. //// service.CreateHisPsn(psn)
  1665. //// var rf []*ResultFive
  1666. //// json.Unmarshal([]byte(infoStr), &rf)
  1667. //// var insutypes []*ResultFive
  1668. //// var insutype string
  1669. //// var is390 int = 0
  1670. //// var is310 int = 0
  1671. ////
  1672. //// for _, item := range rf {
  1673. //// if (item.Insutype == "390" && item.PsnInsuStas == "1") || (item.Insutype == "310" && item.PsnInsuStas == "1") {
  1674. //// insutypes = append(insutypes, item)
  1675. //// }
  1676. //// }
  1677. ////
  1678. //// if len(insutypes) == 1 {
  1679. //// insutype = insutypes[0].Insutype
  1680. //// //insuplc_admdvs = insutypes[0].InsuplcAdmdvs
  1681. //// } else {
  1682. //// for _, i := range insutypes {
  1683. //// if i.Insutype == "390" {
  1684. //// is390 = 1
  1685. //// }
  1686. ////
  1687. //// if i.Insutype == "310" {
  1688. //// is310 = 1
  1689. //// }
  1690. //// }
  1691. //// }
  1692. ////
  1693. //// if is390 == 1 {
  1694. //// insutype = "390"
  1695. //// }
  1696. ////
  1697. //// if is310 == 1 {
  1698. //// insutype = "310"
  1699. //// }
  1700. ////
  1701. //// if len(insutypes) == 0 {
  1702. //// insutype = "310"
  1703. //// }
  1704. //// c.ServeSuccessJSON(map[string]interface{}{
  1705. //// "patient": patient,
  1706. //// "number": token,
  1707. //// "insutype": insutype,
  1708. //// })
  1709. //// }
  1710. //// }
  1711. //// } else {
  1712. //// c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeHisFailedException)
  1713. //// return
  1714. //// }
  1715. //// } else { //读卡失败
  1716. //// c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeHisFailedException)
  1717. //// return
  1718. ////
  1719. //// }
  1720. ////
  1721. //// }
  1722. ////
  1723. //// break
  1724. //// case 4:
  1725. //// if miConfig.MdtrtareaAdmvs == "320921" || miConfig.MdtrtareaAdmvs == "320982" {
  1726. //// var api string
  1727. //// if miConfig.MdtrtareaAdmvs == "320921" {
  1728. //// api = "http://192.168.2.110:9532/" + "jsyb/readcard?" + "fixmedins_code=" + miConfig.Code + "&secret_key=" + miConfig.SecretKey + "&ak=" + miConfig.AccessKey + "&org_name=" + miConfig.OrgName + "&doctor=" + roles.UserName +
  1729. //// "&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
  1730. //// fmt.Println(api)
  1731. ////
  1732. //// } else {
  1733. //// 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 +
  1734. //// "&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)
  1735. //// }
  1736. ////
  1737. //// resp, requestErr := http.Get(api)
  1738. //// if requestErr != nil {
  1739. //// c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  1740. //// return
  1741. //// }
  1742. ////
  1743. //// body, ioErr := ioutil.ReadAll(resp.Body)
  1744. //// if ioErr != nil {
  1745. //// utils.ErrorLog("接口返回数据读取失败: %v", ioErr)
  1746. //// c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  1747. //// return
  1748. //// }
  1749. //// var respJSON map[string]interface{}
  1750. //// if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
  1751. //// utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
  1752. //// c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  1753. //// return
  1754. //// }
  1755. //// var status string
  1756. //// status = respJSON["data"].(map[string]interface{})["status"].(string)
  1757. //// //card_type := respJSON["data"].(map[string]interface{})["type"].(string)
  1758. ////
  1759. //// var token string
  1760. //// var res ResultTwo //1101结果
  1761. //// var res10265 ResultTwo10265 //1101结果
  1762. ////
  1763. //// if status == "0" { //读卡成功
  1764. //// var card_info string //卡信息
  1765. //// var busi_card_info string
  1766. ////
  1767. //// token = respJSON["data"].(map[string]interface{})["token"].(string)
  1768. //// busi_card_info = respJSON["data"].(map[string]interface{})["busi_card_info"].(string)
  1769. //// card_info = respJSON["data"].(map[string]interface{})["card_info"].(string)
  1770. ////
  1771. //// fmt.Println(card_info)
  1772. //// fmt.Println(busi_card_info)
  1773. ////
  1774. //// respJSON = respJSON["data"].(map[string]interface{})["result"].(map[string]interface{})
  1775. //// result, _ := json.Marshal(respJSON)
  1776. ////
  1777. //// if err := json.Unmarshal([]byte(result), &res10265); err != nil {
  1778. //// utils.ErrorLog("解析失败:%v", err)
  1779. //// c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  1780. //// return
  1781. //// }
  1782. //// res.ErrMsg = res10265.ErrMsg
  1783. //// infocode, _ := strconv.ParseInt(res10265.Infcode, 10, 64)
  1784. //// res.Infcode = infocode
  1785. //// res.Output = res10265.Output
  1786. //// res.InfRefmsgid = res10265.InfRefmsgid
  1787. ////
  1788. //// if res.Infcode == 0 {
  1789. //// patient, err := service.GetPatientByIDCard(res.Output.Baseinfo.Certno, c.GetAdminUserInfo().CurrentOrgId)
  1790. //// if err == gorm.ErrRecordNotFound {
  1791. //// c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeNoPateintException)
  1792. //// return
  1793. //// } else if err != nil {
  1794. //// c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
  1795. //// return
  1796. ////
  1797. //// } else {
  1798. //// Iinfos, _ := json.Marshal(res.Output.Iinfo)
  1799. //// Idetinfos, _ := json.Marshal(res.Output.Idetinfo)
  1800. //// infoStr := string(Iinfos)
  1801. //// idetinfoStr := string(Idetinfos)
  1802. //// psn := &models.HisPsn{
  1803. //// PsnNo: res.Output.Baseinfo.PsnNo,
  1804. //// Age: res.Output.Baseinfo.Age,
  1805. //// PatientId: patient.ID,
  1806. //// Certno: res.Output.Baseinfo.Certno,
  1807. //// Brdy: res.Output.Baseinfo.Brdy,
  1808. //// Gend: res.Output.Baseinfo.Gend,
  1809. //// Naty: res.Output.Baseinfo.Naty,
  1810. //// PsnCertType: res.Output.Baseinfo.PsnCertType,
  1811. //// PsnName: res.Output.Baseinfo.PsnName,
  1812. //// Idetinfo: idetinfoStr,
  1813. //// Insuinfo: infoStr,
  1814. //// UserOrgId: c.GetAdminUserInfo().CurrentOrgId,
  1815. //// CardInfo: card_info,
  1816. //// VerifyNumber: token,
  1817. //// }
  1818. //// service.CreateHisPsn(psn)
  1819. //// c.ServeSuccessJSON(map[string]interface{}{
  1820. //// "patient": patient,
  1821. //// "number": token,
  1822. //// })
  1823. //// }
  1824. //// } else {
  1825. //// c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeHisFailedException)
  1826. //// return
  1827. //// }
  1828. //// } else { //读卡失败
  1829. //// c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeHisFailedException)
  1830. //// return
  1831. //// }
  1832. //// }
  1833. //// break
  1834. //// }
  1835. ////}
  1836. //
  1837. //var initFlag int64 = 0
  1838. //
  1839. ////func (c *HisApiController) TestGetBasBaseInit() {
  1840. //// DllDef := syscall.MustLoadDLL("SSCard.dll")
  1841. //// Iinit := DllDef.MustFindProc("Init")
  1842. //// miConfig, _ := service.FindMedicalInsuranceInfo(c.GetAdminUserInfo().CurrentOrgId)
  1843. ////
  1844. //// ret, _, err := Iinit.Call(StrPtr("http://igb.hsa.gdgov.cn/gdyb_api/prd/api/card/initDll"), StrPtr(miConfig.InsuplcAdmdvs))
  1845. //// if ret != 0 {
  1846. //// fmt.Println("SSCard的报错原因:", err)
  1847. //// fmt.Println("SSCard的运算结果为:", ret)
  1848. //// c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeReadCardException)
  1849. //// return
  1850. //// }
  1851. ////
  1852. //// result := int(ret)
  1853. //// fmt.Println("SSCard的运算结果为1:", result)
  1854. //// initFlag = 1
  1855. //// return
  1856. ////}
  1857. //
  1858. ////func (c *HisApiController) GetSFZBaseInfo() string {
  1859. //// DllDef := syscall.MustLoadDLL("SSCard.dll")
  1860. //// readCard := DllDef.MustFindProc("ReadSFZ")
  1861. //// if readCard == nil {
  1862. //// fmt.Println("readcard is nil")
  1863. //// readCard = DllDef.MustFindProc("ReadSFZ")
  1864. //// }
  1865. ////
  1866. //// str := make([]byte, 256)
  1867. //// str1 := make([]byte, 256)
  1868. //// r, _, _ := readCard.Call((uintptr)(unsafe.Pointer(&str[0])), IntPtr(1024), (uintptr)(unsafe.Pointer(&str1[0])), IntPtr(1024))
  1869. ////
  1870. //// fmt.Println(r)
  1871. //// return string(str)
  1872. ////}
  1873. //
  1874. ////func (c *HisApiController) GetBasBaseInfo() string {
  1875. //// DllDef := syscall.MustLoadDLL("SSCard.dll")
  1876. //// readCard := DllDef.MustFindProc("ReadCardBas")
  1877. //// if readCard == nil {
  1878. //// fmt.Println("readcard is nil")
  1879. //// readCard = DllDef.MustFindProc("ReadCardBas")
  1880. //// }
  1881. //// str := make([]byte, 1024)
  1882. //// str1 := make([]byte, 1024)
  1883. //// ret2, _, _ := readCard.Call((uintptr)(unsafe.Pointer(&str[0])), uintptr(1024), (uintptr)(unsafe.Pointer(&str1[0])), uintptr(1024))
  1884. //// fmt.Println(string(str1))
  1885. //// fmt.Println(string(str))
  1886. //// fmt.Println(":", ConvertToString(string(str1), "gbk", "utf-8"))
  1887. //// fmt.Println(":", ConvertToString(string(str), "gbk", "utf-8"))
  1888. //// if ret2 != 0 {
  1889. //// return ""
  1890. //// }
  1891. //// return string(str)
  1892. ////}
  1893. //
  1894. //type CustomFundPay struct {
  1895. // FundPayType string `json:"fund_pay_type"`
  1896. // FundPayamt float64 `json:"fund_payamt"`
  1897. //}
  1898. //
  1899. //func (c *HisApiController) GetSettleList() {
  1900. //
  1901. // order_id, _ := c.GetInt64("order_id")
  1902. // admin_user_id, _ := c.GetInt64("admin_user_id")
  1903. //
  1904. // order, _ := service.GetHisOrderByIDTwo(order_id)
  1905. // roles, _ := service.GetDoctorListTwo(c.GetAdminUserInfo().CurrentOrgId)
  1906. // his, _ := service.GetHisPatientByNumber(order.MdtrtId)
  1907. // admin, _ := service.GetAdminUserByUserID(roles[0].AdminUserId)
  1908. // curRoles, _ := service.GetAdminUserInfoByID(c.GetAdminUserInfo().CurrentOrgId, admin_user_id)
  1909. // depart, _ := service.GetDepartMentDetail(curRoles.DepartmentId)
  1910. // miConfig, _ := service.FindMedicalInsuranceInfo(c.GetAdminUserInfo().CurrentOrgId)
  1911. //
  1912. // if order.ID == 0 {
  1913. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeHisOrderNoExistParamWrong)
  1914. // return
  1915. // }
  1916. //
  1917. // last_order, _ := service.GetLastHisOrder(c.GetAdminUserInfo().CurrentOrgId)
  1918. // max_order, _ := service.GetLastHisOrderTwo(c.GetAdminUserInfo().CurrentOrgId)
  1919. // count, _ := strconv.ParseInt(max_order.FaPiaoNumber, 10, 64)
  1920. // fmt.Println(count)
  1921. // var zero string
  1922. // number := count + 1
  1923. // if number >= 1000 {
  1924. // zero = "0000" + strconv.FormatInt(number, 10)
  1925. // } else if number >= 10000 {
  1926. // zero = "000" + strconv.FormatInt(number, 10)
  1927. // } else if number >= 100000 {
  1928. // zero = "00" + strconv.FormatInt(number, 10)
  1929. // } else if number >= 1000000 {
  1930. // zero = "0" + strconv.FormatInt(number, 10)
  1931. // } else {
  1932. // zero = strconv.FormatInt(number, 10)
  1933. // }
  1934. // fmt.Println(zero)
  1935. //
  1936. // struct4101 := service.Struct4101{
  1937. // PsnNo: order.PsnNo,
  1938. // MdtrtId: order.MdtrtId,
  1939. // SetlId: order.SetlId,
  1940. // PsnName: order.PsnName,
  1941. // Gend: order.Gend,
  1942. // Brdy: his.Brdy,
  1943. // Age: his.Age,
  1944. // Naty: order.Naty,
  1945. // PatnCertType: "01",
  1946. // Certno: order.Certno,
  1947. // Prfs: "90",
  1948. // ConerName: roles[0].UserName,
  1949. // PatnRlts: "99",
  1950. // ConerAddr: miConfig.OrgName,
  1951. // ConerTel: admin.Mobile,
  1952. // HiType: order.Insutype,
  1953. // Insuplc: miConfig.InsuplcAdmdvs,
  1954. // MaindiagFlag: "1",
  1955. // BillCode: last_order.FaPiaoCode,
  1956. // BillNo: zero,
  1957. // BizSn: order.Number,
  1958. // PsnSelfPay: order.PsnPartAmt,
  1959. // PsnOwnPay: order.PsnPartAmt,
  1960. // AcctPay: order.AcctPay,
  1961. // PsnCashpay: order.PsnCashPay,
  1962. // HiPaymtd: "1",
  1963. // Hsorg: miConfig.InsuplcAdmdvs,
  1964. // HsorgOpter: miConfig.InsuplcAdmdvs,
  1965. // MedinsFillPsn: curRoles.UserName,
  1966. // MedinsFillDept: depart.Name,
  1967. // IptMedType: "2",
  1968. // }
  1969. // struct4101.SetlBegnDate = order.SetlTime
  1970. // struct4101.SetlEndDate = order.SetlTime
  1971. // time_arr := strings.Split(order.SetlTime, " ")
  1972. // struct4101.AdmTime = time_arr[0]
  1973. // struct4101.AdmEndTime = time_arr[0]
  1974. //
  1975. // var rf []CustomFundPay
  1976. // json.Unmarshal([]byte(order.SetlDetail), &rf)
  1977. //
  1978. // var tempFunPays []service.CustomStruct
  1979. // for _, item := range rf {
  1980. // var tempFunPay service.CustomStruct
  1981. // tempFunPay.FundPayamt = item.FundPayamt
  1982. // tempFunPay.FundPayType = item.FundPayType
  1983. // tempFunPays = append(tempFunPays, tempFunPay)
  1984. // }
  1985. // struct4101.CustomStruct = tempFunPays
  1986. //
  1987. // var tempDiaginfos []service.DiaginfoStructTwo
  1988. // var tempOpspdiseinfo2 service.OpspdiseinfoStruct
  1989. // var tempOpspdiseinfos []service.OpspdiseinfoStruct
  1990. //
  1991. // diagnosis_ids := strings.Split(order.Diagnosis, ",")
  1992. // var config []*models.HisXtDiagnoseConfig
  1993. // for _, item := range diagnosis_ids {
  1994. // id, _ := strconv.ParseInt(item, 10, 64)
  1995. // diagnosisConfig, _ := service.FindDiagnoseById(id)
  1996. // config = append(config, &diagnosisConfig)
  1997. // }
  1998. //
  1999. // for index, item := range config {
  2000. // if index == 0 {
  2001. // var tempDiaginfo service.DiaginfoStructTwo
  2002. // tempDiaginfo.DiagCode = item.CountryCode
  2003. // tempDiaginfo.DiagName = item.CountryContentName
  2004. // tempDiaginfo.DiagType = "1"
  2005. // tempDiaginfo.MaindiagFlag = "1"
  2006. // tempDiaginfos = append(tempDiaginfos, tempDiaginfo)
  2007. // } else {
  2008. //
  2009. // var tempDiaginfo service.DiaginfoStructTwo
  2010. // tempDiaginfo.DiagCode = item.CountryCode
  2011. // tempDiaginfo.DiagName = item.CountryContentName
  2012. // tempDiaginfo.DiagType = "2"
  2013. // tempDiaginfo.MaindiagFlag = "0"
  2014. // tempDiaginfos = append(tempDiaginfos, tempDiaginfo)
  2015. // }
  2016. // }
  2017. // struct4101.Diseinfo = tempDiaginfos
  2018. //
  2019. // sickConfigTwo, _ := service.FindSickById(his.SickType)
  2020. // tempOpspdiseinfo2.DiagCode = sickConfigTwo.ContentCode
  2021. // tempOpspdiseinfo2.DiagName = sickConfigTwo.CountryContentName
  2022. // tempOpspdiseinfo2.OprnOprtCode = sickConfigTwo.ContentCode
  2023. // tempOpspdiseinfo2.OprnOprtName = sickConfigTwo.CountryContentName
  2024. // tempOpspdiseinfos = append(tempOpspdiseinfos, tempOpspdiseinfo2)
  2025. // struct4101.OpspdiseinfoStruct = tempOpspdiseinfos
  2026. //
  2027. // var iteminfo service.IteminfoStruct
  2028. //
  2029. // var bedCostTotal float64 = 0 //床位总费
  2030. // var bedCostSelfTotal float64 = 0 //床位自费
  2031. // var bedCostPartSelfTotal float64 = 0 //床位部分项目自费
  2032. //
  2033. // var operationCostTotal float64 = 0 //手术费
  2034. // var operationCostSelfTotal float64 = 0 //手术费
  2035. // var operationCostPartSelfTotal float64 = 0 //手术费
  2036. //
  2037. // var otherCostTotal float64 = 0 //其他费用
  2038. // var otherCostSelfTotal float64 = 0 //其他费用
  2039. // var otherCostPartSelfTotal float64 = 0 //其他费用
  2040. //
  2041. // var materialCostTotal float64 = 0 //材料费
  2042. // var materialCostSelfTotal float64 = 0 //材料费
  2043. // var materialCostPartSelfTotal float64 = 0 //材料费
  2044. //
  2045. // var westernMedicineCostTotal float64 = 0 //西药费
  2046. // var westernMedicineCostSelfTotal float64 = 0 //西药费
  2047. // var westernMedicineCostPartSelfTotal float64 = 0 //西药费
  2048. //
  2049. // var chineseTraditionalMedicineCostTotal float64 = 0 //中成药
  2050. // var chineseTraditionalMedicineCostSelfTotal float64 = 0 //中成药
  2051. // var chineseTraditionalMedicineCostPartSelfTotal float64 = 0 //中成药
  2052. //
  2053. // var checkCostTotal float64 = 0 //检查费
  2054. // var checkCostSelfTotal float64 = 0 //检查费
  2055. // var checkCostPartSelfTotal float64 = 0 //检查费
  2056. //
  2057. // var laboratoryCostTotal float64 = 0 //化验费
  2058. // var laboratoryCostSelfTotal float64 = 0 //化验费
  2059. // var laboratoryCostPartSelfTotal float64 = 0 //化验费
  2060. //
  2061. // var treatCostTotal float64 = 0 //治疗费用
  2062. // var treatCostSelfTotal float64 = 0 //治疗费用
  2063. // var treatCostPartSelfTotal float64 = 0 //治疗费用
  2064. //
  2065. // decimal.DivisionPrecision = 2
  2066. //
  2067. // var bed_fulamt_ownpay_amt float64 = 0
  2068. // var operation_fulamt_ownpay_amt float64 = 0
  2069. // var other_fulamt_ownpay_amt float64 = 0
  2070. // var westernMedicine_fulamt_ownpay_amt float64 = 0
  2071. // var chineseTraditional_fulamt_ownpay_amt float64 = 0
  2072. // var check_fulamt_ownpay_amt float64 = 0
  2073. // var material_fulamt_ownpay_amt float64 = 0
  2074. // var laboratory_fulamt_ownpay_amt float64 = 0
  2075. // var treat_fulamt_ownpay_amt float64 = 0
  2076. //
  2077. // var bed_claa_sunmfee float64 = 0
  2078. // var bed_clab_amt float64 = 0
  2079. // var bed_other_amt float64 = 0
  2080. //
  2081. // var operation_claa_sunmfee float64 = 0
  2082. // var operation_clab_amt float64 = 0
  2083. // var operation_other_amt float64 = 0
  2084. //
  2085. // var other_claa_sunmfee float64 = 0
  2086. // var other_clab_amt float64 = 0
  2087. // var other_other_amt float64 = 0
  2088. //
  2089. // var westernMedicine_claa_sunmfee float64 = 0
  2090. // var westernMedicine_clab_amt float64 = 0
  2091. // var westernMedicine_other_amt float64 = 0
  2092. //
  2093. // var chineseTraditional_claa_sunmfee float64 = 0
  2094. // var chineseTraditional_clab_amt float64 = 0
  2095. // var chineseTraditional_other_amt float64 = 0
  2096. //
  2097. // var check_claa_sunmfee float64 = 0
  2098. // var check_clab_amt float64 = 0
  2099. // var check_other_amt float64 = 0
  2100. //
  2101. // var material_claa_sunmfee float64 = 0
  2102. // var material_clab_amt float64 = 0
  2103. // var material_other_amt float64 = 0
  2104. //
  2105. // var laboratory_claa_sunmfee float64 = 0
  2106. // var laboratory_clab_amt float64 = 0
  2107. // var laboratory_other_amt float64 = 0
  2108. //
  2109. // var treat_claa_sunmfee float64 = 0
  2110. // var treat_clab_amt float64 = 0
  2111. // var treat_other_amt float64 = 0
  2112. //
  2113. // for _, item := range order.HisOrderInfo {
  2114. // if item.MedChrgitmType == "01" { //床位费
  2115. // bedCostTotal, _ = decimal.NewFromFloat(bedCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  2116. // bedCostSelfTotal, _ = decimal.NewFromFloat(bedCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  2117. // bedCostPartSelfTotal, _ = decimal.NewFromFloat(bedCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  2118. // bed_fulamt_ownpay_amt, _ = decimal.NewFromFloat(bed_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  2119. // if item.ChrgitmLv == "1" {
  2120. // bed_claa_sunmfee, _ = decimal.NewFromFloat(bed_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  2121. // }
  2122. // if item.ChrgitmLv == "2" {
  2123. // bed_clab_amt, _ = decimal.NewFromFloat(bed_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  2124. //
  2125. // }
  2126. // if item.ChrgitmLv == "3" {
  2127. // bed_other_amt, _ = decimal.NewFromFloat(bed_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  2128. // }
  2129. //
  2130. // }
  2131. //
  2132. // if item.MedChrgitmType == "03" { //检查费
  2133. // checkCostTotal, _ = decimal.NewFromFloat(checkCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  2134. // checkCostSelfTotal, _ = decimal.NewFromFloat(checkCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  2135. // checkCostPartSelfTotal, _ = decimal.NewFromFloat(checkCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  2136. // check_fulamt_ownpay_amt, _ = decimal.NewFromFloat(check_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  2137. // if item.ChrgitmLv == "1" {
  2138. //
  2139. // check_claa_sunmfee, _ = decimal.NewFromFloat(check_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  2140. //
  2141. // }
  2142. // if item.ChrgitmLv == "2" {
  2143. // check_clab_amt, _ = decimal.NewFromFloat(check_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  2144. //
  2145. // }
  2146. // if item.ChrgitmLv == "3" {
  2147. // check_other_amt, _ = decimal.NewFromFloat(check_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  2148. // }
  2149. // }
  2150. //
  2151. // if item.MedChrgitmType == "04" { //化验费
  2152. // laboratoryCostTotal, _ = decimal.NewFromFloat(laboratoryCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  2153. // laboratoryCostSelfTotal, _ = decimal.NewFromFloat(laboratoryCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  2154. // laboratoryCostPartSelfTotal, _ = decimal.NewFromFloat(laboratoryCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  2155. // laboratory_fulamt_ownpay_amt, _ = decimal.NewFromFloat(laboratory_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  2156. // if item.ChrgitmLv == "1" {
  2157. //
  2158. // laboratory_claa_sunmfee, _ = decimal.NewFromFloat(laboratory_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  2159. //
  2160. // }
  2161. // if item.ChrgitmLv == "2" {
  2162. // laboratory_clab_amt, _ = decimal.NewFromFloat(laboratory_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  2163. //
  2164. // }
  2165. // if item.ChrgitmLv == "3" {
  2166. // laboratory_other_amt, _ = decimal.NewFromFloat(laboratory_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  2167. // }
  2168. // }
  2169. //
  2170. // if item.MedChrgitmType == "05" { //治疗费
  2171. // treatCostTotal, _ = decimal.NewFromFloat(treatCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  2172. // treatCostSelfTotal, _ = decimal.NewFromFloat(treatCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  2173. // treatCostPartSelfTotal, _ = decimal.NewFromFloat(treatCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  2174. // treat_fulamt_ownpay_amt, _ = decimal.NewFromFloat(treat_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  2175. // if item.ChrgitmLv == "1" {
  2176. //
  2177. // treat_claa_sunmfee, _ = decimal.NewFromFloat(treat_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  2178. //
  2179. // }
  2180. // if item.ChrgitmLv == "2" {
  2181. // treat_clab_amt, _ = decimal.NewFromFloat(treat_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  2182. //
  2183. // }
  2184. // if item.ChrgitmLv == "3" {
  2185. // treat_other_amt, _ = decimal.NewFromFloat(treat_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  2186. // }
  2187. // }
  2188. //
  2189. // if item.MedChrgitmType == "06" { //手术费
  2190. // operationCostTotal, _ = decimal.NewFromFloat(operationCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  2191. // operationCostSelfTotal, _ = decimal.NewFromFloat(operationCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  2192. // operationCostPartSelfTotal, _ = decimal.NewFromFloat(operationCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  2193. // operation_fulamt_ownpay_amt, _ = decimal.NewFromFloat(operation_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  2194. //
  2195. // if item.ChrgitmLv == "1" {
  2196. //
  2197. // operation_claa_sunmfee, _ = decimal.NewFromFloat(operation_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  2198. //
  2199. // }
  2200. // if item.ChrgitmLv == "2" {
  2201. // operation_clab_amt, _ = decimal.NewFromFloat(operation_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  2202. //
  2203. // }
  2204. // if item.ChrgitmLv == "3" {
  2205. // operation_other_amt, _ = decimal.NewFromFloat(operation_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  2206. // }
  2207. // }
  2208. //
  2209. // if item.MedChrgitmType == "08" { //材料费
  2210. // materialCostTotal, _ = decimal.NewFromFloat(materialCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  2211. // materialCostSelfTotal, _ = decimal.NewFromFloat(materialCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  2212. // materialCostPartSelfTotal, _ = decimal.NewFromFloat(materialCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  2213. // material_fulamt_ownpay_amt, _ = decimal.NewFromFloat(material_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  2214. // if item.ChrgitmLv == "1" {
  2215. //
  2216. // material_claa_sunmfee, _ = decimal.NewFromFloat(material_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  2217. //
  2218. // }
  2219. // if item.ChrgitmLv == "2" {
  2220. // material_clab_amt, _ = decimal.NewFromFloat(material_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  2221. //
  2222. // }
  2223. // if item.ChrgitmLv == "3" {
  2224. // material_other_amt, _ = decimal.NewFromFloat(material_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  2225. // }
  2226. // }
  2227. //
  2228. // if item.MedChrgitmType == "09" { //西药费
  2229. // westernMedicineCostTotal, _ = decimal.NewFromFloat(westernMedicineCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  2230. // westernMedicineCostSelfTotal, _ = decimal.NewFromFloat(westernMedicineCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  2231. // westernMedicineCostPartSelfTotal, _ = decimal.NewFromFloat(westernMedicineCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  2232. // westernMedicine_fulamt_ownpay_amt, _ = decimal.NewFromFloat(westernMedicine_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  2233. // if item.ChrgitmLv == "1" {
  2234. //
  2235. // westernMedicine_claa_sunmfee, _ = decimal.NewFromFloat(westernMedicine_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  2236. //
  2237. // }
  2238. // if item.ChrgitmLv == "2" {
  2239. // westernMedicine_clab_amt, _ = decimal.NewFromFloat(westernMedicine_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  2240. //
  2241. // }
  2242. // if item.ChrgitmLv == "3" {
  2243. // westernMedicine_other_amt, _ = decimal.NewFromFloat(westernMedicine_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  2244. // }
  2245. // }
  2246. //
  2247. // if item.MedChrgitmType == "11" { //中成费
  2248. // chineseTraditionalMedicineCostTotal, _ = decimal.NewFromFloat(chineseTraditionalMedicineCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  2249. // chineseTraditionalMedicineCostSelfTotal, _ = decimal.NewFromFloat(chineseTraditionalMedicineCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  2250. // chineseTraditionalMedicineCostPartSelfTotal, _ = decimal.NewFromFloat(chineseTraditionalMedicineCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  2251. // chineseTraditional_fulamt_ownpay_amt, _ = decimal.NewFromFloat(chineseTraditional_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  2252. // if item.ChrgitmLv == "1" {
  2253. //
  2254. // chineseTraditional_claa_sunmfee, _ = decimal.NewFromFloat(chineseTraditional_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  2255. //
  2256. // }
  2257. // if item.ChrgitmLv == "2" {
  2258. // chineseTraditional_clab_amt, _ = decimal.NewFromFloat(chineseTraditional_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  2259. //
  2260. // }
  2261. // if item.ChrgitmLv == "3" {
  2262. // chineseTraditional_other_amt, _ = decimal.NewFromFloat(chineseTraditional_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  2263. // }
  2264. // }
  2265. //
  2266. // if item.MedChrgitmType == "14" { //其他费
  2267. // otherCostTotal, _ = decimal.NewFromFloat(otherCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  2268. // otherCostSelfTotal, _ = decimal.NewFromFloat(otherCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  2269. // otherCostPartSelfTotal, _ = decimal.NewFromFloat(otherCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  2270. // other_fulamt_ownpay_amt, _ = decimal.NewFromFloat(other_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  2271. // if item.ChrgitmLv == "1" {
  2272. // other_claa_sunmfee, _ = decimal.NewFromFloat(other_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  2273. //
  2274. // }
  2275. // if item.ChrgitmLv == "2" {
  2276. // other_clab_amt, _ = decimal.NewFromFloat(other_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  2277. //
  2278. // }
  2279. // if item.ChrgitmLv == "3" {
  2280. // other_other_amt, _ = decimal.NewFromFloat(other_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  2281. // }
  2282. // }
  2283. //
  2284. // }
  2285. //
  2286. // var iteminfoStructs []service.IteminfoStruct
  2287. //
  2288. // if bedCostTotal != 0 {
  2289. // iteminfo.MedChrgitm = "01"
  2290. // iteminfo.FulamtOwnpayAmt = bed_fulamt_ownpay_amt
  2291. // iteminfo.Amt = bedCostTotal
  2292. // iteminfo.ClaaSumfee = bed_claa_sunmfee
  2293. // iteminfo.ClabAmt = bed_clab_amt
  2294. // iteminfo.OthAmt = bed_other_amt
  2295. // iteminfoStructs = append(iteminfoStructs, iteminfo)
  2296. // }
  2297. //
  2298. // if checkCostTotal != 0 {
  2299. // iteminfo.MedChrgitm = "03"
  2300. // iteminfo.FulamtOwnpayAmt = check_fulamt_ownpay_amt
  2301. // iteminfo.Amt = checkCostTotal
  2302. // iteminfo.ClaaSumfee = check_claa_sunmfee
  2303. // iteminfo.ClabAmt = check_clab_amt
  2304. // iteminfo.OthAmt = check_other_amt
  2305. // iteminfoStructs = append(iteminfoStructs, iteminfo)
  2306. //
  2307. // }
  2308. //
  2309. // if laboratoryCostTotal != 0 {
  2310. // iteminfo.MedChrgitm = "04"
  2311. // iteminfo.FulamtOwnpayAmt = laboratory_fulamt_ownpay_amt
  2312. // iteminfo.Amt = laboratoryCostTotal
  2313. // iteminfo.ClaaSumfee = laboratory_claa_sunmfee
  2314. // iteminfo.ClabAmt = laboratory_clab_amt
  2315. // iteminfo.OthAmt = laboratory_other_amt
  2316. // iteminfoStructs = append(iteminfoStructs, iteminfo)
  2317. //
  2318. // //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
  2319. //
  2320. // }
  2321. //
  2322. // if treatCostTotal != 0 {
  2323. // iteminfo.MedChrgitm = "05"
  2324. // iteminfo.FulamtOwnpayAmt = treat_fulamt_ownpay_amt
  2325. // iteminfo.Amt = treatCostTotal
  2326. // iteminfo.ClaaSumfee = treat_claa_sunmfee
  2327. // iteminfo.ClabAmt = treat_clab_amt
  2328. // iteminfo.OthAmt = treat_other_amt
  2329. // iteminfoStructs = append(iteminfoStructs, iteminfo)
  2330. // //(struct4101.IteminfoStruct, iteminfo)
  2331. // //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
  2332. // }
  2333. //
  2334. // if operationCostTotal != 0 {
  2335. // iteminfo.MedChrgitm = "06"
  2336. // iteminfo.FulamtOwnpayAmt = bed_fulamt_ownpay_amt
  2337. // iteminfo.Amt = operationCostTotal
  2338. // iteminfo.ClaaSumfee = operation_claa_sunmfee
  2339. // iteminfo.ClabAmt = operation_clab_amt
  2340. // iteminfo.OthAmt = operation_other_amt
  2341. // //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
  2342. // iteminfoStructs = append(iteminfoStructs, iteminfo)
  2343. // }
  2344. //
  2345. // if materialCostTotal != 0 {
  2346. // iteminfo.MedChrgitm = "08"
  2347. // iteminfo.FulamtOwnpayAmt = material_fulamt_ownpay_amt
  2348. // iteminfo.Amt = materialCostTotal
  2349. // iteminfo.ClaaSumfee = material_claa_sunmfee
  2350. // iteminfo.ClabAmt = material_clab_amt
  2351. // iteminfo.OthAmt = material_other_amt
  2352. // //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
  2353. // iteminfoStructs = append(iteminfoStructs, iteminfo)
  2354. // }
  2355. //
  2356. // if westernMedicineCostTotal != 0 {
  2357. // iteminfo.MedChrgitm = "09"
  2358. // iteminfo.FulamtOwnpayAmt = westernMedicine_fulamt_ownpay_amt
  2359. // iteminfo.Amt = westernMedicineCostTotal
  2360. // iteminfo.ClaaSumfee = westernMedicine_claa_sunmfee
  2361. // iteminfo.ClabAmt = westernMedicine_clab_amt
  2362. // iteminfo.OthAmt = westernMedicine_other_amt
  2363. // //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
  2364. // iteminfoStructs = append(iteminfoStructs, iteminfo)
  2365. //
  2366. // }
  2367. // if chineseTraditionalMedicineCostTotal != 0 {
  2368. // iteminfo.MedChrgitm = "11"
  2369. // iteminfo.FulamtOwnpayAmt = westernMedicine_fulamt_ownpay_amt
  2370. // iteminfo.Amt = westernMedicineCostTotal
  2371. // iteminfo.ClaaSumfee = westernMedicine_claa_sunmfee
  2372. // iteminfo.ClabAmt = westernMedicine_clab_amt
  2373. // iteminfo.OthAmt = westernMedicine_other_amt
  2374. // //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
  2375. // iteminfoStructs = append(iteminfoStructs, iteminfo)
  2376. //
  2377. // }
  2378. // if otherCostTotal != 0 {
  2379. // iteminfo.MedChrgitm = "14"
  2380. // iteminfo.FulamtOwnpayAmt = other_fulamt_ownpay_amt
  2381. // iteminfo.Amt = otherCostTotal
  2382. // iteminfo.ClaaSumfee = other_claa_sunmfee
  2383. // iteminfo.ClabAmt = other_clab_amt
  2384. // iteminfo.OthAmt = other_other_amt
  2385. // //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
  2386. // iteminfoStructs = append(iteminfoStructs, iteminfo)
  2387. //
  2388. // }
  2389. // struct4101.IteminfoStruct = iteminfoStructs
  2390. // struct4101.Ntly = "中国"
  2391. // struct4101.AdmCaty = "A03.06"
  2392. //
  2393. // var res ResultSeventeen
  2394. //
  2395. // if miConfig.MdtrtareaAdmvs == "320921" || miConfig.MdtrtareaAdmvs == "320982" {
  2396. // var resOther ResultSeventeenOther
  2397. // var pp models.PublicParams
  2398. // pp.InsuplcAdmdvs = miConfig.InsuplcAdmdvs
  2399. // pp.MdtrtareaAdmvs = miConfig.MdtrtareaAdmvs
  2400. // pp.FixmedinsName = miConfig.OrgName
  2401. // pp.FixmedinsCode = miConfig.Code
  2402. // pp.RequestUrl = miConfig.Url
  2403. // pp.Cainfo = miConfig.Cainfo
  2404. // pp.SecretKey = miConfig.SecretKey
  2405. // pp.AccessKey = miConfig.AccessKey
  2406. // pp.OpterName = curRoles.UserName
  2407. //
  2408. // client := &http.Client{}
  2409. // var req *http.Request
  2410. // data := make(map[string]interface{})
  2411. // data["struct4101"] = struct4101
  2412. // data["pp"] = pp
  2413. // bytesData, _ := json.Marshal(data)
  2414. // if miConfig.MdtrtareaAdmvs == "320921" {
  2415. // req, _ = http.NewRequest("POST", "http://192.168.2.110:9532/"+"jsyb/4101", bytes.NewReader(bytesData))
  2416. // } else {
  2417. // req, _ = http.NewRequest("POST", "http://192.168.5.251:9532/"+"jsyb/4101", bytes.NewReader(bytesData))
  2418. // }
  2419. // resp, _ := client.Do(req)
  2420. // defer resp.Body.Close()
  2421. // body, ioErr := ioutil.ReadAll(resp.Body)
  2422. // if ioErr != nil {
  2423. // utils.ErrorLog("接口返回数据读取失败: %v", ioErr)
  2424. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  2425. // return
  2426. // }
  2427. // var respJSON map[string]interface{}
  2428. // if err := json.Unmarshal([]byte(body), &respJSON); err != nil {
  2429. // utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
  2430. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  2431. // return
  2432. // }
  2433. //
  2434. // respJSON = respJSON["data"].(map[string]interface{})["pre"].(map[string]interface{})
  2435. // userJSONBytes, _ := json.Marshal(respJSON)
  2436. // fmt.Println("log")
  2437. // fmt.Println(string(userJSONBytes))
  2438. // if err := json.Unmarshal(userJSONBytes, &resOther); err != nil {
  2439. // utils.ErrorLog("解析失败:%v", err)
  2440. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  2441. // return
  2442. // }
  2443. // res.InfRefmsgid = resOther.InfRefmsgid
  2444. // res.Output = resOther.Output
  2445. // res.ErrMsg = resOther.ErrMsg
  2446. // infocode, _ := strconv.ParseInt(resOther.Infcode, 10, 64)
  2447. // res.Infcode = infocode
  2448. // } else {
  2449. //
  2450. // result := service.Gdyb4101(struct4101, miConfig.SecretKey, miConfig.OrgName, curRoles.UserName, miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.UserOrgId)
  2451. // var dat map[string]interface{}
  2452. // if err := json.Unmarshal([]byte(result), &dat); err == nil {
  2453. // fmt.Println(dat)
  2454. // } else {
  2455. // fmt.Println(err)
  2456. // }
  2457. // userJSONBytes, _ := json.Marshal(dat)
  2458. // if err := json.Unmarshal(userJSONBytes, &res); err != nil {
  2459. // utils.ErrorLog("解析失败:%v", err)
  2460. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  2461. // return
  2462. // }
  2463. // }
  2464. //
  2465. // if res.Infcode != 0 {
  2466. //
  2467. // c.ServeSuccessJSON(map[string]interface{}{
  2468. // "failed_code": -10,
  2469. // "msg": res.ErrMsg,
  2470. // })
  2471. // return
  2472. // } else {
  2473. // order.FaPiaoNumber = zero
  2474. // order.FaPiaoCode = last_order.FaPiaoCode
  2475. // service.UpdateOrder(order)
  2476. // hisFundSettleListResult := &models.HisFundSettleListResult{
  2477. // Number: res.Output.SetlListId,
  2478. // Status: 1,
  2479. // Ctime: time.Now().Unix(),
  2480. // Mtime: time.Now().Unix(),
  2481. // UserOrgId: c.GetAdminUserInfo().CurrentOrgId,
  2482. // IsUpload: 1,
  2483. // OrderId: order_id,
  2484. // }
  2485. // service.CreateUploadRecord(hisFundSettleListResult)
  2486. // c.ServeSuccessJSON(map[string]interface{}{
  2487. // "msg": "上传成功",
  2488. // "result": hisFundSettleListResult,
  2489. // })
  2490. // return
  2491. // }
  2492. //}
  2493. //
  2494. //func (c *HisApiController) GetSettleListHospital() {
  2495. //
  2496. // order_id, _ := c.GetInt64("order_id")
  2497. // admin_user_id, _ := c.GetInt64("admin_user_id")
  2498. //
  2499. // order, _ := service.GetHisOrderByIDTwo(order_id)
  2500. // roles, _ := service.GetDoctorListTwo(c.GetAdminUserInfo().CurrentOrgId)
  2501. // his, _ := service.GetInHospitalRecordByNumber(order.MdtrtId)
  2502. // admin, _ := service.GetAdminUserByUserID(roles[0].AdminUserId)
  2503. // curRoles, _ := service.GetAdminUserInfoByID(c.GetAdminUserInfo().CurrentOrgId, admin_user_id)
  2504. // depart, _ := service.GetDepartMentDetail(curRoles.DepartmentId)
  2505. // miConfig, _ := service.FindMedicalInsuranceInfo(c.GetAdminUserInfo().CurrentOrgId)
  2506. //
  2507. // if order.ID == 0 {
  2508. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeHisOrderNoExistParamWrong)
  2509. // return
  2510. // }
  2511. //
  2512. // last_order, _ := service.GetLastHisOrder(c.GetAdminUserInfo().CurrentOrgId)
  2513. // max_order, _ := service.GetLastHisOrderTwo(c.GetAdminUserInfo().CurrentOrgId)
  2514. // count, _ := strconv.ParseInt(max_order.FaPiaoNumber, 10, 64)
  2515. // fmt.Println(count)
  2516. // var zero string
  2517. // number := count + 1
  2518. // if number >= 1000 {
  2519. // zero = "0000" + strconv.FormatInt(number, 10)
  2520. // } else if number >= 10000 {
  2521. // zero = "000" + strconv.FormatInt(number, 10)
  2522. // } else if number >= 100000 {
  2523. // zero = "00" + strconv.FormatInt(number, 10)
  2524. // } else if number >= 1000000 {
  2525. // zero = "0" + strconv.FormatInt(number, 10)
  2526. // } else {
  2527. // zero = strconv.FormatInt(number, 10)
  2528. // }
  2529. // fmt.Println(zero)
  2530. //
  2531. // struct4101 := service.Struct4101{
  2532. // PsnNo: order.PsnNo,
  2533. // MdtrtId: order.MdtrtId,
  2534. // SetlId: order.SetlId,
  2535. // PsnName: order.PsnName,
  2536. // Gend: order.Gend,
  2537. // Brdy: his.Brdy,
  2538. // Age: int64(order.Age),
  2539. // Naty: order.Naty,
  2540. // PatnCertType: "01",
  2541. // Certno: order.Certno,
  2542. // Prfs: "90",
  2543. // ConerName: roles[0].UserName,
  2544. // PatnRlts: "99",
  2545. // ConerAddr: miConfig.OrgName,
  2546. // ConerTel: admin.Mobile,
  2547. // HiType: order.Insutype,
  2548. // Insuplc: miConfig.InsuplcAdmdvs,
  2549. // MaindiagFlag: "1",
  2550. // BillCode: last_order.FaPiaoCode,
  2551. // BillNo: zero,
  2552. // BizSn: order.Number,
  2553. // PsnSelfPay: order.PsnPartAmt,
  2554. // PsnOwnPay: order.PsnPartAmt,
  2555. // AcctPay: order.AcctPay,
  2556. // PsnCashpay: order.PsnCashPay,
  2557. // HiPaymtd: "1",
  2558. // Hsorg: miConfig.InsuplcAdmdvs,
  2559. // HsorgOpter: miConfig.InsuplcAdmdvs,
  2560. // MedinsFillPsn: curRoles.UserName,
  2561. // MedinsFillDept: depart.Name,
  2562. // IptMedType: "2",
  2563. // AdmTime: his.InHosptialTime,
  2564. // AdmEndTime: his.OutHosptialTime,
  2565. // }
  2566. // struct4101.SetlBegnDate = order.SetlTime
  2567. // struct4101.SetlEndDate = order.SetlTime
  2568. //
  2569. // var rf []CustomFundPay
  2570. // json.Unmarshal([]byte(order.SetlDetail), &rf)
  2571. //
  2572. // var tempFunPays []service.CustomStruct
  2573. // for _, item := range rf {
  2574. // var tempFunPay service.CustomStruct
  2575. // tempFunPay.FundPayamt = item.FundPayamt
  2576. // tempFunPay.FundPayType = item.FundPayType
  2577. // tempFunPays = append(tempFunPays, tempFunPay)
  2578. // }
  2579. // struct4101.CustomStruct = tempFunPays
  2580. //
  2581. // var tempDiaginfos []service.DiaginfoStructTwo
  2582. // var tempOpspdiseinfo2 service.OpspdiseinfoStruct
  2583. // var tempOpspdiseinfos []service.OpspdiseinfoStruct
  2584. // diagnosis_ids := strings.Split(his.Diagnosis, ",")
  2585. // var config []*models.HisXtDiagnoseConfig
  2586. // for _, item := range diagnosis_ids {
  2587. // id, _ := strconv.ParseInt(item, 10, 64)
  2588. // diagnosisConfig, _ := service.FindDiagnoseById(id)
  2589. // config = append(config, &diagnosisConfig)
  2590. // }
  2591. //
  2592. // for index, item := range config {
  2593. // if index == 0 {
  2594. // var tempDiaginfo service.DiaginfoStructTwo
  2595. // tempDiaginfo.DiagCode = item.CountryCode
  2596. // tempDiaginfo.DiagName = item.CountryContentName
  2597. // tempDiaginfo.DiagType = "1"
  2598. // tempDiaginfo.MaindiagFlag = "1"
  2599. // tempDiaginfos = append(tempDiaginfos, tempDiaginfo)
  2600. // } else {
  2601. //
  2602. // var tempDiaginfo service.DiaginfoStructTwo
  2603. // tempDiaginfo.DiagCode = item.CountryCode
  2604. // tempDiaginfo.DiagName = item.CountryContentName
  2605. // tempDiaginfo.DiagType = "2"
  2606. // tempDiaginfo.MaindiagFlag = "0"
  2607. // tempDiaginfos = append(tempDiaginfos, tempDiaginfo)
  2608. // }
  2609. // }
  2610. // struct4101.Diseinfo = tempDiaginfos
  2611. //
  2612. // sickConfigTwo, _ := service.FindSickById(his.SickType)
  2613. // tempOpspdiseinfo2.DiagCode = sickConfigTwo.ContentCode
  2614. // tempOpspdiseinfo2.DiagName = sickConfigTwo.CountryContentName
  2615. // tempOpspdiseinfo2.OprnOprtCode = ""
  2616. // tempOpspdiseinfo2.OprnOprtName = ""
  2617. // tempOpspdiseinfos = append(tempOpspdiseinfos, tempOpspdiseinfo2)
  2618. // struct4101.OpspdiseinfoStruct = tempOpspdiseinfos
  2619. //
  2620. // var iteminfo service.IteminfoStruct
  2621. //
  2622. // var bedCostTotal float64 = 0 //床位总费
  2623. // var bedCostSelfTotal float64 = 0 //床位自费
  2624. // var bedCostPartSelfTotal float64 = 0 //床位部分项目自费
  2625. //
  2626. // var operationCostTotal float64 = 0 //手术费
  2627. // var operationCostSelfTotal float64 = 0 //手术费
  2628. // var operationCostPartSelfTotal float64 = 0 //手术费
  2629. //
  2630. // var otherCostTotal float64 = 0 //其他费用
  2631. // var otherCostSelfTotal float64 = 0 //其他费用
  2632. // var otherCostPartSelfTotal float64 = 0 //其他费用
  2633. //
  2634. // var materialCostTotal float64 = 0 //材料费
  2635. // var materialCostSelfTotal float64 = 0 //材料费
  2636. // var materialCostPartSelfTotal float64 = 0 //材料费
  2637. //
  2638. // var westernMedicineCostTotal float64 = 0 //西药费
  2639. // var westernMedicineCostSelfTotal float64 = 0 //西药费
  2640. // var westernMedicineCostPartSelfTotal float64 = 0 //西药费
  2641. //
  2642. // var chineseTraditionalMedicineCostTotal float64 = 0 //中成药
  2643. // var chineseTraditionalMedicineCostSelfTotal float64 = 0 //中成药
  2644. // var chineseTraditionalMedicineCostPartSelfTotal float64 = 0 //中成药
  2645. //
  2646. // var checkCostTotal float64 = 0 //检查费
  2647. // var checkCostSelfTotal float64 = 0 //检查费
  2648. // var checkCostPartSelfTotal float64 = 0 //检查费
  2649. //
  2650. // var laboratoryCostTotal float64 = 0 //化验费
  2651. // var laboratoryCostSelfTotal float64 = 0 //化验费
  2652. // var laboratoryCostPartSelfTotal float64 = 0 //化验费
  2653. //
  2654. // var treatCostTotal float64 = 0 //治疗费用
  2655. // var treatCostSelfTotal float64 = 0 //治疗费用
  2656. // var treatCostPartSelfTotal float64 = 0 //治疗费用
  2657. //
  2658. // decimal.DivisionPrecision = 2
  2659. //
  2660. // var bed_fulamt_ownpay_amt float64 = 0
  2661. // var operation_fulamt_ownpay_amt float64 = 0
  2662. // var other_fulamt_ownpay_amt float64 = 0
  2663. // var westernMedicine_fulamt_ownpay_amt float64 = 0
  2664. // var chineseTraditional_fulamt_ownpay_amt float64 = 0
  2665. // var check_fulamt_ownpay_amt float64 = 0
  2666. // var material_fulamt_ownpay_amt float64 = 0
  2667. // var laboratory_fulamt_ownpay_amt float64 = 0
  2668. // var treat_fulamt_ownpay_amt float64 = 0
  2669. //
  2670. // var bed_claa_sunmfee float64 = 0
  2671. // var bed_clab_amt float64 = 0
  2672. // var bed_other_amt float64 = 0
  2673. //
  2674. // var operation_claa_sunmfee float64 = 0
  2675. // var operation_clab_amt float64 = 0
  2676. // var operation_other_amt float64 = 0
  2677. //
  2678. // var other_claa_sunmfee float64 = 0
  2679. // var other_clab_amt float64 = 0
  2680. // var other_other_amt float64 = 0
  2681. //
  2682. // var westernMedicine_claa_sunmfee float64 = 0
  2683. // var westernMedicine_clab_amt float64 = 0
  2684. // var westernMedicine_other_amt float64 = 0
  2685. //
  2686. // var chineseTraditional_claa_sunmfee float64 = 0
  2687. // var chineseTraditional_clab_amt float64 = 0
  2688. // var chineseTraditional_other_amt float64 = 0
  2689. //
  2690. // var check_claa_sunmfee float64 = 0
  2691. // var check_clab_amt float64 = 0
  2692. // var check_other_amt float64 = 0
  2693. //
  2694. // var material_claa_sunmfee float64 = 0
  2695. // var material_clab_amt float64 = 0
  2696. // var material_other_amt float64 = 0
  2697. //
  2698. // var laboratory_claa_sunmfee float64 = 0
  2699. // var laboratory_clab_amt float64 = 0
  2700. // var laboratory_other_amt float64 = 0
  2701. //
  2702. // var treat_claa_sunmfee float64 = 0
  2703. // var treat_clab_amt float64 = 0
  2704. // var treat_other_amt float64 = 0
  2705. //
  2706. // for _, item := range order.HisOrderInfo {
  2707. // if item.MedChrgitmType == "01" { //床位费
  2708. // bedCostTotal, _ = decimal.NewFromFloat(bedCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  2709. // bedCostSelfTotal, _ = decimal.NewFromFloat(bedCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  2710. // bedCostPartSelfTotal, _ = decimal.NewFromFloat(bedCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  2711. // bed_fulamt_ownpay_amt, _ = decimal.NewFromFloat(bed_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  2712. // if item.ChrgitmLv == "1" {
  2713. // bed_claa_sunmfee, _ = decimal.NewFromFloat(bed_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  2714. // }
  2715. // if item.ChrgitmLv == "2" {
  2716. // bed_clab_amt, _ = decimal.NewFromFloat(bed_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  2717. //
  2718. // }
  2719. // if item.ChrgitmLv == "3" {
  2720. // bed_other_amt, _ = decimal.NewFromFloat(bed_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  2721. // }
  2722. //
  2723. // }
  2724. //
  2725. // if item.MedChrgitmType == "03" { //检查费
  2726. // checkCostTotal, _ = decimal.NewFromFloat(checkCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  2727. // checkCostSelfTotal, _ = decimal.NewFromFloat(checkCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  2728. // checkCostPartSelfTotal, _ = decimal.NewFromFloat(checkCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  2729. // check_fulamt_ownpay_amt, _ = decimal.NewFromFloat(check_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  2730. // if item.ChrgitmLv == "1" {
  2731. //
  2732. // check_claa_sunmfee, _ = decimal.NewFromFloat(check_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  2733. //
  2734. // }
  2735. // if item.ChrgitmLv == "2" {
  2736. // check_clab_amt, _ = decimal.NewFromFloat(check_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  2737. //
  2738. // }
  2739. // if item.ChrgitmLv == "3" {
  2740. // check_other_amt, _ = decimal.NewFromFloat(check_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  2741. // }
  2742. // }
  2743. //
  2744. // if item.MedChrgitmType == "04" { //化验费
  2745. // laboratoryCostTotal, _ = decimal.NewFromFloat(laboratoryCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  2746. // laboratoryCostSelfTotal, _ = decimal.NewFromFloat(laboratoryCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  2747. // laboratoryCostPartSelfTotal, _ = decimal.NewFromFloat(laboratoryCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  2748. // laboratory_fulamt_ownpay_amt, _ = decimal.NewFromFloat(laboratory_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  2749. // if item.ChrgitmLv == "1" {
  2750. //
  2751. // laboratory_claa_sunmfee, _ = decimal.NewFromFloat(laboratory_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  2752. //
  2753. // }
  2754. // if item.ChrgitmLv == "2" {
  2755. // laboratory_clab_amt, _ = decimal.NewFromFloat(laboratory_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  2756. //
  2757. // }
  2758. // if item.ChrgitmLv == "3" {
  2759. // laboratory_other_amt, _ = decimal.NewFromFloat(laboratory_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  2760. // }
  2761. // }
  2762. //
  2763. // if item.MedChrgitmType == "05" { //治疗费
  2764. // treatCostTotal, _ = decimal.NewFromFloat(treatCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  2765. // treatCostSelfTotal, _ = decimal.NewFromFloat(treatCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  2766. // treatCostPartSelfTotal, _ = decimal.NewFromFloat(treatCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  2767. // treat_fulamt_ownpay_amt, _ = decimal.NewFromFloat(treat_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  2768. // if item.ChrgitmLv == "1" {
  2769. //
  2770. // treat_claa_sunmfee, _ = decimal.NewFromFloat(treat_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  2771. //
  2772. // }
  2773. // if item.ChrgitmLv == "2" {
  2774. // treat_clab_amt, _ = decimal.NewFromFloat(treat_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  2775. //
  2776. // }
  2777. // if item.ChrgitmLv == "3" {
  2778. // treat_other_amt, _ = decimal.NewFromFloat(treat_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  2779. // }
  2780. // }
  2781. //
  2782. // if item.MedChrgitmType == "06" { //手术费
  2783. // operationCostTotal, _ = decimal.NewFromFloat(operationCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  2784. // operationCostSelfTotal, _ = decimal.NewFromFloat(operationCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  2785. // operationCostPartSelfTotal, _ = decimal.NewFromFloat(operationCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  2786. // operation_fulamt_ownpay_amt, _ = decimal.NewFromFloat(operation_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  2787. //
  2788. // if item.ChrgitmLv == "1" {
  2789. //
  2790. // operation_claa_sunmfee, _ = decimal.NewFromFloat(operation_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  2791. //
  2792. // }
  2793. // if item.ChrgitmLv == "2" {
  2794. // operation_clab_amt, _ = decimal.NewFromFloat(operation_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  2795. //
  2796. // }
  2797. // if item.ChrgitmLv == "3" {
  2798. // operation_other_amt, _ = decimal.NewFromFloat(operation_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  2799. // }
  2800. // }
  2801. //
  2802. // if item.MedChrgitmType == "08" { //材料费
  2803. // materialCostTotal, _ = decimal.NewFromFloat(materialCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  2804. // materialCostSelfTotal, _ = decimal.NewFromFloat(materialCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  2805. // materialCostPartSelfTotal, _ = decimal.NewFromFloat(materialCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  2806. // material_fulamt_ownpay_amt, _ = decimal.NewFromFloat(material_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  2807. // if item.ChrgitmLv == "1" {
  2808. //
  2809. // material_claa_sunmfee, _ = decimal.NewFromFloat(material_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  2810. //
  2811. // }
  2812. // if item.ChrgitmLv == "2" {
  2813. // material_clab_amt, _ = decimal.NewFromFloat(material_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  2814. //
  2815. // }
  2816. // if item.ChrgitmLv == "3" {
  2817. // material_other_amt, _ = decimal.NewFromFloat(material_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  2818. // }
  2819. // }
  2820. //
  2821. // if item.MedChrgitmType == "09" { //西药费
  2822. // westernMedicineCostTotal, _ = decimal.NewFromFloat(westernMedicineCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  2823. // westernMedicineCostSelfTotal, _ = decimal.NewFromFloat(westernMedicineCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  2824. // westernMedicineCostPartSelfTotal, _ = decimal.NewFromFloat(westernMedicineCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  2825. // westernMedicine_fulamt_ownpay_amt, _ = decimal.NewFromFloat(westernMedicine_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  2826. // if item.ChrgitmLv == "1" {
  2827. //
  2828. // westernMedicine_claa_sunmfee, _ = decimal.NewFromFloat(westernMedicine_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  2829. //
  2830. // }
  2831. // if item.ChrgitmLv == "2" {
  2832. // westernMedicine_clab_amt, _ = decimal.NewFromFloat(westernMedicine_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  2833. //
  2834. // }
  2835. // if item.ChrgitmLv == "3" {
  2836. // westernMedicine_other_amt, _ = decimal.NewFromFloat(westernMedicine_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  2837. // }
  2838. // }
  2839. //
  2840. // if item.MedChrgitmType == "11" { //中成费
  2841. // chineseTraditionalMedicineCostTotal, _ = decimal.NewFromFloat(chineseTraditionalMedicineCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  2842. // chineseTraditionalMedicineCostSelfTotal, _ = decimal.NewFromFloat(chineseTraditionalMedicineCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  2843. // chineseTraditionalMedicineCostPartSelfTotal, _ = decimal.NewFromFloat(chineseTraditionalMedicineCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  2844. // chineseTraditional_fulamt_ownpay_amt, _ = decimal.NewFromFloat(chineseTraditional_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  2845. // if item.ChrgitmLv == "1" {
  2846. //
  2847. // chineseTraditional_claa_sunmfee, _ = decimal.NewFromFloat(chineseTraditional_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  2848. //
  2849. // }
  2850. // if item.ChrgitmLv == "2" {
  2851. // chineseTraditional_clab_amt, _ = decimal.NewFromFloat(chineseTraditional_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  2852. //
  2853. // }
  2854. // if item.ChrgitmLv == "3" {
  2855. // chineseTraditional_other_amt, _ = decimal.NewFromFloat(chineseTraditional_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  2856. // }
  2857. // }
  2858. //
  2859. // if item.MedChrgitmType == "14" { //其他费
  2860. // otherCostTotal, _ = decimal.NewFromFloat(otherCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  2861. // otherCostSelfTotal, _ = decimal.NewFromFloat(otherCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  2862. // otherCostPartSelfTotal, _ = decimal.NewFromFloat(otherCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  2863. // other_fulamt_ownpay_amt, _ = decimal.NewFromFloat(other_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  2864. // if item.ChrgitmLv == "1" {
  2865. // other_claa_sunmfee, _ = decimal.NewFromFloat(other_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  2866. //
  2867. // }
  2868. // if item.ChrgitmLv == "2" {
  2869. // other_clab_amt, _ = decimal.NewFromFloat(other_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  2870. //
  2871. // }
  2872. // if item.ChrgitmLv == "3" {
  2873. // other_other_amt, _ = decimal.NewFromFloat(other_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  2874. // }
  2875. // }
  2876. //
  2877. // }
  2878. //
  2879. // var iteminfoStructs []service.IteminfoStruct
  2880. //
  2881. // if bedCostTotal != 0 {
  2882. // iteminfo.MedChrgitm = "01"
  2883. // iteminfo.FulamtOwnpayAmt = bed_fulamt_ownpay_amt
  2884. // iteminfo.Amt = bedCostTotal
  2885. // iteminfo.ClaaSumfee = bed_claa_sunmfee
  2886. // iteminfo.ClabAmt = bed_clab_amt
  2887. // iteminfo.OthAmt = bed_other_amt
  2888. // iteminfoStructs = append(iteminfoStructs, iteminfo)
  2889. // }
  2890. //
  2891. // if checkCostTotal != 0 {
  2892. // iteminfo.MedChrgitm = "03"
  2893. // iteminfo.FulamtOwnpayAmt = check_fulamt_ownpay_amt
  2894. // iteminfo.Amt = checkCostTotal
  2895. // iteminfo.ClaaSumfee = check_claa_sunmfee
  2896. // iteminfo.ClabAmt = check_clab_amt
  2897. // iteminfo.OthAmt = check_other_amt
  2898. // iteminfoStructs = append(iteminfoStructs, iteminfo)
  2899. //
  2900. // }
  2901. //
  2902. // if laboratoryCostTotal != 0 {
  2903. // iteminfo.MedChrgitm = "04"
  2904. // iteminfo.FulamtOwnpayAmt = laboratory_fulamt_ownpay_amt
  2905. // iteminfo.Amt = laboratoryCostTotal
  2906. // iteminfo.ClaaSumfee = laboratory_claa_sunmfee
  2907. // iteminfo.ClabAmt = laboratory_clab_amt
  2908. // iteminfo.OthAmt = laboratory_other_amt
  2909. // iteminfoStructs = append(iteminfoStructs, iteminfo)
  2910. //
  2911. // //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
  2912. //
  2913. // }
  2914. //
  2915. // if treatCostTotal != 0 {
  2916. // iteminfo.MedChrgitm = "05"
  2917. // iteminfo.FulamtOwnpayAmt = treat_fulamt_ownpay_amt
  2918. // iteminfo.Amt = treatCostTotal
  2919. // iteminfo.ClaaSumfee = treat_claa_sunmfee
  2920. // iteminfo.ClabAmt = treat_clab_amt
  2921. // iteminfo.OthAmt = treat_other_amt
  2922. // iteminfoStructs = append(iteminfoStructs, iteminfo)
  2923. // //(struct4101.IteminfoStruct, iteminfo)
  2924. // //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
  2925. // }
  2926. //
  2927. // if operationCostTotal != 0 {
  2928. // iteminfo.MedChrgitm = "06"
  2929. // iteminfo.FulamtOwnpayAmt = bed_fulamt_ownpay_amt
  2930. // iteminfo.Amt = operationCostTotal
  2931. // iteminfo.ClaaSumfee = operation_claa_sunmfee
  2932. // iteminfo.ClabAmt = operation_clab_amt
  2933. // iteminfo.OthAmt = operation_other_amt
  2934. // //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
  2935. // iteminfoStructs = append(iteminfoStructs, iteminfo)
  2936. // }
  2937. //
  2938. // if materialCostTotal != 0 {
  2939. // iteminfo.MedChrgitm = "08"
  2940. // iteminfo.FulamtOwnpayAmt = material_fulamt_ownpay_amt
  2941. // iteminfo.Amt = materialCostTotal
  2942. // iteminfo.ClaaSumfee = material_claa_sunmfee
  2943. // iteminfo.ClabAmt = material_clab_amt
  2944. // iteminfo.OthAmt = material_other_amt
  2945. // //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
  2946. // iteminfoStructs = append(iteminfoStructs, iteminfo)
  2947. // }
  2948. //
  2949. // if westernMedicineCostTotal != 0 {
  2950. // iteminfo.MedChrgitm = "09"
  2951. // iteminfo.FulamtOwnpayAmt = westernMedicine_fulamt_ownpay_amt
  2952. // iteminfo.Amt = westernMedicineCostTotal
  2953. // iteminfo.ClaaSumfee = westernMedicine_claa_sunmfee
  2954. // iteminfo.ClabAmt = westernMedicine_clab_amt
  2955. // iteminfo.OthAmt = westernMedicine_other_amt
  2956. // //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
  2957. // iteminfoStructs = append(iteminfoStructs, iteminfo)
  2958. //
  2959. // }
  2960. // if chineseTraditionalMedicineCostTotal != 0 {
  2961. // iteminfo.MedChrgitm = "11"
  2962. // iteminfo.FulamtOwnpayAmt = westernMedicine_fulamt_ownpay_amt
  2963. // iteminfo.Amt = westernMedicineCostTotal
  2964. // iteminfo.ClaaSumfee = westernMedicine_claa_sunmfee
  2965. // iteminfo.ClabAmt = westernMedicine_clab_amt
  2966. // iteminfo.OthAmt = westernMedicine_other_amt
  2967. // //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
  2968. // iteminfoStructs = append(iteminfoStructs, iteminfo)
  2969. //
  2970. // }
  2971. // if otherCostTotal != 0 {
  2972. // iteminfo.MedChrgitm = "14"
  2973. // iteminfo.FulamtOwnpayAmt = other_fulamt_ownpay_amt
  2974. // iteminfo.Amt = otherCostTotal
  2975. // iteminfo.ClaaSumfee = other_claa_sunmfee
  2976. // iteminfo.ClabAmt = other_clab_amt
  2977. // iteminfo.OthAmt = other_other_amt
  2978. // //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
  2979. // iteminfoStructs = append(iteminfoStructs, iteminfo)
  2980. //
  2981. // }
  2982. // struct4101.IteminfoStruct = iteminfoStructs
  2983. // struct4101.Ntly = "中国"
  2984. // struct4101.AdmCaty = "A03.06"
  2985. // result := service.Gdyb4101(struct4101, miConfig.SecretKey, miConfig.OrgName, curRoles.UserName, miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.UserOrgId)
  2986. // fmt.Println(result)
  2987. //
  2988. // var dat map[string]interface{}
  2989. // if err := json.Unmarshal([]byte(result), &dat); err == nil {
  2990. // fmt.Println(dat)
  2991. // } else {
  2992. // fmt.Println(err)
  2993. // }
  2994. // userJSONBytes, _ := json.Marshal(dat)
  2995. // var res ResultSeventeen
  2996. // if err := json.Unmarshal(userJSONBytes, &res); err != nil {
  2997. // utils.ErrorLog("解析失败:%v", err)
  2998. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  2999. // return
  3000. // }
  3001. // if res.Infcode != 0 {
  3002. //
  3003. // c.ServeSuccessJSON(map[string]interface{}{
  3004. // "failed_code": -10,
  3005. // "msg": res.ErrMsg,
  3006. // })
  3007. // return
  3008. // } else {
  3009. // order.FaPiaoNumber = zero
  3010. // order.FaPiaoCode = last_order.FaPiaoCode
  3011. // service.UpdateOrder(order)
  3012. // hisFundSettleListResult := &models.HisFundSettleListResult{
  3013. // Number: res.Output.SetlListId,
  3014. // Status: 1,
  3015. // Ctime: time.Now().Unix(),
  3016. // Mtime: time.Now().Unix(),
  3017. // UserOrgId: c.GetAdminUserInfo().CurrentOrgId,
  3018. // IsUpload: 1,
  3019. // OrderId: order_id,
  3020. // }
  3021. // service.CreateUploadRecord(hisFundSettleListResult)
  3022. // c.ServeSuccessJSON(map[string]interface{}{
  3023. // "msg": "上传成功",
  3024. // "result": hisFundSettleListResult,
  3025. // })
  3026. // return
  3027. // }
  3028. //}
  3029. //
  3030. //func (c *HisApiController) GetBatchSettleList() {
  3031. // orders, _ := service.GetAllHisOrder(10106)
  3032. // for _, item := range orders {
  3033. // order_id := item.ID
  3034. // order, _ := service.GetHisOrderByIDTwo(order_id)
  3035. // roles, _ := service.GetDoctorListTwo(c.GetAdminUserInfo().CurrentOrgId)
  3036. // his, _ := service.GetHisPatientByNumber(order.MdtrtId)
  3037. // admin, _ := service.GetAdminUserByUserID(roles[0].AdminUserId)
  3038. // curRoles, _ := service.GetAdminUserInfoByID(c.GetAdminUserInfo().CurrentOrgId, 2495)
  3039. // depart, _ := service.GetDepartMentDetail(curRoles.DepartmentId)
  3040. // miConfig, _ := service.FindMedicalInsuranceInfo(c.GetAdminUserInfo().CurrentOrgId)
  3041. //
  3042. // if order.ID == 0 {
  3043. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeHisOrderNoExistParamWrong)
  3044. // return
  3045. // }
  3046. // if his.BalanceAccountsType == 2 {
  3047. // continue
  3048. // }
  3049. // struct4101 := service.Struct4101{
  3050. // PsnNo: order.PsnNo,
  3051. // MdtrtId: order.MdtrtId,
  3052. // SetlId: order.SetlId,
  3053. // PsnName: order.PsnName,
  3054. // Gend: order.Gend,
  3055. // Brdy: his.Brdy,
  3056. // Age: his.Age,
  3057. // Naty: order.Naty,
  3058. // PatnCertType: "01",
  3059. // Certno: order.Certno,
  3060. // Prfs: "90",
  3061. // ConerName: roles[0].UserName,
  3062. // PatnRlts: "99",
  3063. // ConerAddr: miConfig.OrgName,
  3064. // ConerTel: admin.Mobile,
  3065. // HiType: order.Insutype,
  3066. // Insuplc: his.InsuplcAdmdvs,
  3067. // MaindiagFlag: "1",
  3068. // BillCode: order.FaPiaoCode,
  3069. // BillNo: order.FaPiaoNumber,
  3070. // BizSn: order.Number,
  3071. // PsnSelfPay: order.PsnPartAmt,
  3072. // PsnOwnPay: order.PsnPartAmt,
  3073. // AcctPay: order.AcctPay,
  3074. // PsnCashpay: order.PsnCashPay,
  3075. // HiPaymtd: "1",
  3076. // Hsorg: his.InsuplcAdmdvs,
  3077. // HsorgOpter: his.InsuplcAdmdvs,
  3078. // MedinsFillPsn: curRoles.UserName,
  3079. // MedinsFillDept: depart.Name,
  3080. // IptMedType: "2",
  3081. // }
  3082. // struct4101.SetlBegnDate = order.SetlTime
  3083. // struct4101.SetlEndDate = order.SetlTime
  3084. // //if order.SettleType == 1 {
  3085. // // t := time.Unix(int64(order.SettleAccountsDate), 0)
  3086. // // dateStr := t.Format("2006-01-02")
  3087. // // struct4101.SetlBegnDate = dateStr
  3088. // // struct4101.SetlEndDate = dateStr
  3089. // //} else {
  3090. // // t := time.Unix(int64(order.SettleStartTime), 0)
  3091. // // t2 := time.Unix(int64(order.SettleEndTime), 0)
  3092. // // dateStartStr := t.Format("2006-01-02")
  3093. // // dateEndStr := t2.Format("2006-01-02")
  3094. // // struct4101.SetlBegnDate = dateStartStr
  3095. // // struct4101.SetlEndDate = dateEndStr
  3096. // //}
  3097. //
  3098. // var rf []CustomFundPay
  3099. // json.Unmarshal([]byte(order.SetlDetail), &rf)
  3100. //
  3101. // var tempFunPays []service.CustomStruct
  3102. // var tempFunPay610100 service.CustomStruct
  3103. //
  3104. // for _, item := range rf {
  3105. // if item.FundPayType == "610100" {
  3106. // tempFunPay610100.FundPayamt, _ = decimal.NewFromFloat(tempFunPay610100.FundPayamt).Add(decimal.NewFromFloat(item.FundPayamt)).Float64()
  3107. // tempFunPay610100.FundPayType = item.FundPayType
  3108. // } else {
  3109. // var tempFunPay service.CustomStruct
  3110. // tempFunPay.FundPayamt = item.FundPayamt
  3111. // tempFunPay.FundPayType = item.FundPayType
  3112. // tempFunPays = append(tempFunPays, tempFunPay)
  3113. // }
  3114. // }
  3115. // tempFunPays = append(tempFunPays, tempFunPay610100)
  3116. // struct4101.CustomStruct = tempFunPays
  3117. //
  3118. // var tempDiaginfos []service.DiaginfoStructTwo
  3119. // var tempOpspdiseinfo2 service.OpspdiseinfoStruct
  3120. // var tempOpspdiseinfos []service.OpspdiseinfoStruct
  3121. //
  3122. // diagnosis_ids := strings.Split(his.Diagnosis, ",")
  3123. // var config []*models.HisXtDiagnoseConfig
  3124. // for _, item := range diagnosis_ids {
  3125. // id, _ := strconv.ParseInt(item, 10, 64)
  3126. // diagnosisConfig, _ := service.FindDiagnoseById(id)
  3127. // config = append(config, &diagnosisConfig)
  3128. // }
  3129. //
  3130. // for index, item := range config {
  3131. // if index == 0 {
  3132. // var tempDiaginfo service.DiaginfoStructTwo
  3133. // tempDiaginfo.DiagCode = item.CountryCode
  3134. // tempDiaginfo.DiagName = item.CountryContentName
  3135. // tempDiaginfo.DiagType = "1"
  3136. // tempDiaginfo.MaindiagFlag = "1"
  3137. // tempDiaginfos = append(tempDiaginfos, tempDiaginfo)
  3138. // } else {
  3139. //
  3140. // var tempDiaginfo service.DiaginfoStructTwo
  3141. // tempDiaginfo.DiagCode = item.CountryCode
  3142. // tempDiaginfo.DiagName = item.CountryContentName
  3143. // tempDiaginfo.DiagType = "2"
  3144. // tempDiaginfo.MaindiagFlag = "0"
  3145. // tempDiaginfos = append(tempDiaginfos, tempDiaginfo)
  3146. // }
  3147. // }
  3148. // struct4101.Diseinfo = tempDiaginfos
  3149. //
  3150. // sickConfigTwo, _ := service.FindSickById(his.SickType)
  3151. // tempOpspdiseinfo2.DiagCode = sickConfigTwo.ContentCode
  3152. // tempOpspdiseinfo2.DiagName = sickConfigTwo.CountryContentName
  3153. // tempOpspdiseinfo2.OprnOprtCode = ""
  3154. // tempOpspdiseinfo2.OprnOprtName = ""
  3155. // tempOpspdiseinfos = append(tempOpspdiseinfos, tempOpspdiseinfo2)
  3156. // struct4101.OpspdiseinfoStruct = tempOpspdiseinfos
  3157. //
  3158. // var iteminfo service.IteminfoStruct
  3159. //
  3160. // var bedCostTotal float64 = 0 //床位总费
  3161. // var bedCostSelfTotal float64 = 0 //床位自费
  3162. // var bedCostPartSelfTotal float64 = 0 //床位部分项目自费
  3163. //
  3164. // var examineCostTotal float64 = 0 //诊查总费
  3165. // var examineCostSelfTotal float64 = 0 //诊查自费
  3166. // var examineCostPartSelfTotal float64 = 0 //诊查部分项目自费
  3167. //
  3168. // var nursingCostTotal float64 = 0 //护理总费
  3169. // var nursingCostSelfTotal float64 = 0 //护理自费
  3170. // var nursingCostPartSelfTotal float64 = 0 //护理部分项目自费
  3171. //
  3172. // var chineseMedicineCostTotal float64 = 0 //中成药
  3173. // var chineseMedicineCostSelfTotal float64 = 0 //中成药
  3174. // var chineseMedicineCostPartSelfTotal float64 = 0 //中成药
  3175. //
  3176. // var commonlyTreatmentCostTotal float64 = 0 //一般诊疗费
  3177. // var commonlyTreatmentCostSelfTotal float64 = 0 //一般诊疗费
  3178. // var commonlyTreatmentCostPartSelfTotal float64 = 0 //一般诊疗费
  3179. //
  3180. // var registerCostTotal float64 = 0 //一般诊疗费
  3181. // var registerCostSelfTotal float64 = 0 //一般诊疗费
  3182. // var registerPartSelfTotal float64 = 0 //一般诊疗费
  3183. //
  3184. // var operationCostTotal float64 = 0 //手术费
  3185. // var operationCostSelfTotal float64 = 0 //手术费
  3186. // var operationCostPartSelfTotal float64 = 0 //手术费
  3187. //
  3188. // var otherCostTotal float64 = 0 //其他费用
  3189. // var otherCostSelfTotal float64 = 0 //其他费用
  3190. // var otherCostPartSelfTotal float64 = 0 //其他费用
  3191. //
  3192. // var materialCostTotal float64 = 0 //材料费
  3193. // var materialCostSelfTotal float64 = 0 //材料费
  3194. // var materialCostPartSelfTotal float64 = 0 //材料费
  3195. //
  3196. // var westernMedicineCostTotal float64 = 0 //西药费
  3197. // var westernMedicineCostSelfTotal float64 = 0 //西药费
  3198. // var westernMedicineCostPartSelfTotal float64 = 0 //西药费
  3199. //
  3200. // var chineseTraditionalMedicineCostTotal float64 = 0 //中成药
  3201. // var chineseTraditionalMedicineCostSelfTotal float64 = 0 //中成药
  3202. // var chineseTraditionalMedicineCostPartSelfTotal float64 = 0 //中成药
  3203. //
  3204. // var checkCostTotal float64 = 0 //检查费
  3205. // var checkCostSelfTotal float64 = 0 //检查费
  3206. // var checkCostPartSelfTotal float64 = 0 //检查费
  3207. //
  3208. // var laboratoryCostTotal float64 = 0 //化验费
  3209. // var laboratoryCostSelfTotal float64 = 0 //化验费
  3210. // var laboratoryCostPartSelfTotal float64 = 0 //化验费
  3211. //
  3212. // var treatCostTotal float64 = 0 //治疗费用
  3213. // var treatCostSelfTotal float64 = 0 //治疗费用
  3214. // var treatCostPartSelfTotal float64 = 0 //治疗费用
  3215. //
  3216. // decimal.DivisionPrecision = 2
  3217. //
  3218. // var bed_fulamt_ownpay_amt float64 = 0
  3219. //
  3220. // var examine_fulamt_ownpay_amt float64 = 0
  3221. //
  3222. // var nursing_fulamt_ownpay_amt float64 = 0
  3223. //
  3224. // var chinese_medicine_fulamt_ownpay_amt float64 = 0
  3225. //
  3226. // var commonly_treatment_fulamt_ownpay_amt float64 = 0
  3227. //
  3228. // var register_fulamt_ownpay_amt float64 = 0
  3229. //
  3230. // var operation_fulamt_ownpay_amt float64 = 0
  3231. // var other_fulamt_ownpay_amt float64 = 0
  3232. // var westernMedicine_fulamt_ownpay_amt float64 = 0
  3233. // var chineseTraditional_fulamt_ownpay_amt float64 = 0
  3234. // var check_fulamt_ownpay_amt float64 = 0
  3235. // var material_fulamt_ownpay_amt float64 = 0
  3236. // var laboratory_fulamt_ownpay_amt float64 = 0
  3237. // var treat_fulamt_ownpay_amt float64 = 0
  3238. //
  3239. // var bed_claa_sunmfee float64 = 0
  3240. // var bed_clab_amt float64 = 0
  3241. // var bed_other_amt float64 = 0
  3242. //
  3243. // var examine_claa_sunmfee float64 = 0
  3244. // var examine_clab_amt float64 = 0
  3245. // var examine_other_amt float64 = 0
  3246. //
  3247. // var nursing_claa_sunmfee float64 = 0
  3248. // var nursing_clab_amt float64 = 0
  3249. // var nursing_other_amt float64 = 0
  3250. //
  3251. // var chinese_medicine_claa_sunmfee float64 = 0
  3252. // var chinese_medicine_clab_amt float64 = 0
  3253. // var chinese_medicine_other_amt float64 = 0
  3254. //
  3255. // var commonly_treatment_claa_sunmfee float64 = 0
  3256. // var commonly_treatment_clab_amt float64 = 0
  3257. // var commonly_treatment_other_amt float64 = 0
  3258. //
  3259. // var operation_claa_sunmfee float64 = 0
  3260. // var operation_clab_amt float64 = 0
  3261. // var operation_other_amt float64 = 0
  3262. //
  3263. // var other_claa_sunmfee float64 = 0
  3264. // var other_clab_amt float64 = 0
  3265. // var other_other_amt float64 = 0
  3266. //
  3267. // var westernMedicine_claa_sunmfee float64 = 0
  3268. // var westernMedicine_clab_amt float64 = 0
  3269. // var westernMedicine_other_amt float64 = 0
  3270. //
  3271. // var chineseTraditional_claa_sunmfee float64 = 0
  3272. // var chineseTraditional_clab_amt float64 = 0
  3273. // var chineseTraditional_other_amt float64 = 0
  3274. //
  3275. // var check_claa_sunmfee float64 = 0
  3276. // var check_clab_amt float64 = 0
  3277. // var check_other_amt float64 = 0
  3278. //
  3279. // var material_claa_sunmfee float64 = 0
  3280. // var material_clab_amt float64 = 0
  3281. // var material_other_amt float64 = 0
  3282. //
  3283. // var laboratory_claa_sunmfee float64 = 0
  3284. // var laboratory_clab_amt float64 = 0
  3285. // var laboratory_other_amt float64 = 0
  3286. //
  3287. // var treat_claa_sunmfee float64 = 0
  3288. // var treat_clab_amt float64 = 0
  3289. // var treat_other_amt float64 = 0
  3290. //
  3291. // var register_claa_sunmfee float64 = 0
  3292. // var register_clab_amt float64 = 0
  3293. // var register_other_amt float64 = 0
  3294. //
  3295. // for _, item := range order.HisOrderInfo {
  3296. // if item.MedChrgitmType == "01" { //床位费
  3297. // bedCostTotal, _ = decimal.NewFromFloat(bedCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  3298. // bedCostSelfTotal, _ = decimal.NewFromFloat(bedCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  3299. // bedCostPartSelfTotal, _ = decimal.NewFromFloat(bedCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  3300. // bed_fulamt_ownpay_amt, _ = decimal.NewFromFloat(bed_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  3301. // if item.ChrgitmLv == "1" {
  3302. // bed_claa_sunmfee, _ = decimal.NewFromFloat(bed_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  3303. // }
  3304. // if item.ChrgitmLv == "2" {
  3305. // bed_clab_amt, _ = decimal.NewFromFloat(bed_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  3306. //
  3307. // }
  3308. // if item.ChrgitmLv == "3" {
  3309. // bed_other_amt, _ = decimal.NewFromFloat(bed_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  3310. // }
  3311. //
  3312. // }
  3313. //
  3314. // if item.MedChrgitmType == "02" { //诊查
  3315. // examineCostTotal, _ = decimal.NewFromFloat(examineCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  3316. // examineCostSelfTotal, _ = decimal.NewFromFloat(examineCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  3317. // examineCostPartSelfTotal, _ = decimal.NewFromFloat(examineCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  3318. // examine_fulamt_ownpay_amt, _ = decimal.NewFromFloat(examine_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  3319. // if item.ChrgitmLv == "1" {
  3320. // examine_claa_sunmfee, _ = decimal.NewFromFloat(examine_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  3321. // }
  3322. // if item.ChrgitmLv == "2" {
  3323. // examine_clab_amt, _ = decimal.NewFromFloat(examine_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  3324. //
  3325. // }
  3326. // if item.ChrgitmLv == "3" {
  3327. // examine_other_amt, _ = decimal.NewFromFloat(examine_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  3328. // }
  3329. //
  3330. // }
  3331. //
  3332. // if item.MedChrgitmType == "03" { //检查费
  3333. // checkCostTotal, _ = decimal.NewFromFloat(checkCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  3334. // checkCostSelfTotal, _ = decimal.NewFromFloat(checkCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  3335. // checkCostPartSelfTotal, _ = decimal.NewFromFloat(checkCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  3336. // check_fulamt_ownpay_amt, _ = decimal.NewFromFloat(check_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  3337. // if item.ChrgitmLv == "1" {
  3338. //
  3339. // check_claa_sunmfee, _ = decimal.NewFromFloat(check_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  3340. //
  3341. // }
  3342. // if item.ChrgitmLv == "2" {
  3343. // check_clab_amt, _ = decimal.NewFromFloat(check_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  3344. //
  3345. // }
  3346. // if item.ChrgitmLv == "3" {
  3347. // check_other_amt, _ = decimal.NewFromFloat(check_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  3348. // }
  3349. // }
  3350. //
  3351. // if item.MedChrgitmType == "04" { //化验费
  3352. // laboratoryCostTotal, _ = decimal.NewFromFloat(laboratoryCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  3353. // laboratoryCostSelfTotal, _ = decimal.NewFromFloat(laboratoryCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  3354. // laboratoryCostPartSelfTotal, _ = decimal.NewFromFloat(laboratoryCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  3355. // laboratory_fulamt_ownpay_amt, _ = decimal.NewFromFloat(laboratory_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  3356. // if item.ChrgitmLv == "1" {
  3357. //
  3358. // laboratory_claa_sunmfee, _ = decimal.NewFromFloat(laboratory_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  3359. //
  3360. // }
  3361. // if item.ChrgitmLv == "2" {
  3362. // laboratory_clab_amt, _ = decimal.NewFromFloat(laboratory_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  3363. //
  3364. // }
  3365. // if item.ChrgitmLv == "3" {
  3366. // laboratory_other_amt, _ = decimal.NewFromFloat(laboratory_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  3367. // }
  3368. // }
  3369. //
  3370. // if item.MedChrgitmType == "05" { //治疗费
  3371. // treatCostTotal, _ = decimal.NewFromFloat(treatCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  3372. // treatCostSelfTotal, _ = decimal.NewFromFloat(treatCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  3373. // treatCostPartSelfTotal, _ = decimal.NewFromFloat(treatCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  3374. // treat_fulamt_ownpay_amt, _ = decimal.NewFromFloat(treat_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  3375. // if item.ChrgitmLv == "1" {
  3376. //
  3377. // treat_claa_sunmfee, _ = decimal.NewFromFloat(treat_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  3378. //
  3379. // }
  3380. // if item.ChrgitmLv == "2" {
  3381. // treat_clab_amt, _ = decimal.NewFromFloat(treat_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  3382. //
  3383. // }
  3384. // if item.ChrgitmLv == "3" {
  3385. // treat_other_amt, _ = decimal.NewFromFloat(treat_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  3386. // }
  3387. // }
  3388. //
  3389. // if item.MedChrgitmType == "06" { //手术费
  3390. // operationCostTotal, _ = decimal.NewFromFloat(operationCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  3391. // operationCostSelfTotal, _ = decimal.NewFromFloat(operationCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  3392. // operationCostPartSelfTotal, _ = decimal.NewFromFloat(operationCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  3393. // operation_fulamt_ownpay_amt, _ = decimal.NewFromFloat(operation_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  3394. //
  3395. // if item.ChrgitmLv == "1" {
  3396. //
  3397. // operation_claa_sunmfee, _ = decimal.NewFromFloat(operation_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  3398. //
  3399. // }
  3400. // if item.ChrgitmLv == "2" {
  3401. // operation_clab_amt, _ = decimal.NewFromFloat(operation_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  3402. //
  3403. // }
  3404. // if item.ChrgitmLv == "3" {
  3405. // operation_other_amt, _ = decimal.NewFromFloat(operation_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  3406. // }
  3407. // }
  3408. //
  3409. // if item.MedChrgitmType == "07" { //手术费
  3410. // nursingCostTotal, _ = decimal.NewFromFloat(nursingCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  3411. // nursingCostSelfTotal, _ = decimal.NewFromFloat(nursingCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  3412. // nursingCostPartSelfTotal, _ = decimal.NewFromFloat(nursingCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  3413. // nursing_fulamt_ownpay_amt, _ = decimal.NewFromFloat(nursing_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  3414. //
  3415. // if item.ChrgitmLv == "1" {
  3416. //
  3417. // nursing_claa_sunmfee, _ = decimal.NewFromFloat(nursing_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  3418. //
  3419. // }
  3420. // if item.ChrgitmLv == "2" {
  3421. // nursing_clab_amt, _ = decimal.NewFromFloat(nursing_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  3422. //
  3423. // }
  3424. // if item.ChrgitmLv == "3" {
  3425. // nursing_other_amt, _ = decimal.NewFromFloat(nursing_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  3426. // }
  3427. // }
  3428. //
  3429. // if item.MedChrgitmType == "08" { //材料费
  3430. // materialCostTotal, _ = decimal.NewFromFloat(materialCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  3431. // materialCostSelfTotal, _ = decimal.NewFromFloat(materialCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  3432. // materialCostPartSelfTotal, _ = decimal.NewFromFloat(materialCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  3433. // material_fulamt_ownpay_amt, _ = decimal.NewFromFloat(material_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  3434. // if item.ChrgitmLv == "1" {
  3435. //
  3436. // material_claa_sunmfee, _ = decimal.NewFromFloat(material_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  3437. //
  3438. // }
  3439. // if item.ChrgitmLv == "2" {
  3440. // material_clab_amt, _ = decimal.NewFromFloat(material_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  3441. //
  3442. // }
  3443. // if item.ChrgitmLv == "3" {
  3444. // material_other_amt, _ = decimal.NewFromFloat(material_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  3445. // }
  3446. // }
  3447. // if item.MedChrgitmType == "09" { //西药费
  3448. // westernMedicineCostTotal, _ = decimal.NewFromFloat(westernMedicineCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  3449. // westernMedicineCostSelfTotal, _ = decimal.NewFromFloat(westernMedicineCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  3450. // westernMedicineCostPartSelfTotal, _ = decimal.NewFromFloat(westernMedicineCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  3451. // westernMedicine_fulamt_ownpay_amt, _ = decimal.NewFromFloat(westernMedicine_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  3452. // if item.ChrgitmLv == "1" {
  3453. // westernMedicine_claa_sunmfee, _ = decimal.NewFromFloat(westernMedicine_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  3454. // }
  3455. // if item.ChrgitmLv == "2" {
  3456. // westernMedicine_clab_amt, _ = decimal.NewFromFloat(westernMedicine_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  3457. // }
  3458. // if item.ChrgitmLv == "3" {
  3459. // westernMedicine_other_amt, _ = decimal.NewFromFloat(westernMedicine_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  3460. // }
  3461. // }
  3462. // if item.MedChrgitmType == "10" { //中药饮片
  3463. // chineseMedicineCostTotal, _ = decimal.NewFromFloat(chineseMedicineCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  3464. // chineseMedicineCostSelfTotal, _ = decimal.NewFromFloat(chineseMedicineCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  3465. // chineseMedicineCostPartSelfTotal, _ = decimal.NewFromFloat(chineseMedicineCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  3466. // chinese_medicine_fulamt_ownpay_amt, _ = decimal.NewFromFloat(chinese_medicine_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  3467. // if item.ChrgitmLv == "1" {
  3468. // chinese_medicine_claa_sunmfee, _ = decimal.NewFromFloat(chinese_medicine_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  3469. // }
  3470. // if item.ChrgitmLv == "2" {
  3471. // chinese_medicine_clab_amt, _ = decimal.NewFromFloat(chinese_medicine_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  3472. // }
  3473. // if item.ChrgitmLv == "3" {
  3474. // chinese_medicine_other_amt, _ = decimal.NewFromFloat(chinese_medicine_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  3475. // }
  3476. // }
  3477. //
  3478. // if item.MedChrgitmType == "11" { //中成费
  3479. // chineseTraditionalMedicineCostTotal, _ = decimal.NewFromFloat(chineseTraditionalMedicineCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  3480. // chineseTraditionalMedicineCostSelfTotal, _ = decimal.NewFromFloat(chineseTraditionalMedicineCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  3481. // chineseTraditionalMedicineCostPartSelfTotal, _ = decimal.NewFromFloat(chineseTraditionalMedicineCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  3482. // chineseTraditional_fulamt_ownpay_amt, _ = decimal.NewFromFloat(chineseTraditional_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  3483. // if item.ChrgitmLv == "1" {
  3484. //
  3485. // chineseTraditional_claa_sunmfee, _ = decimal.NewFromFloat(chineseTraditional_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  3486. //
  3487. // }
  3488. // if item.ChrgitmLv == "2" {
  3489. // chineseTraditional_clab_amt, _ = decimal.NewFromFloat(chineseTraditional_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  3490. //
  3491. // }
  3492. // if item.ChrgitmLv == "3" {
  3493. // chineseTraditional_other_amt, _ = decimal.NewFromFloat(chineseTraditional_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  3494. // }
  3495. // }
  3496. //
  3497. // if item.MedChrgitmType == "12" { //中成费
  3498. // commonlyTreatmentCostTotal, _ = decimal.NewFromFloat(commonlyTreatmentCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  3499. // commonlyTreatmentCostSelfTotal, _ = decimal.NewFromFloat(commonlyTreatmentCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  3500. // commonlyTreatmentCostPartSelfTotal, _ = decimal.NewFromFloat(commonlyTreatmentCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  3501. // commonly_treatment_fulamt_ownpay_amt, _ = decimal.NewFromFloat(commonly_treatment_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  3502. // if item.ChrgitmLv == "1" {
  3503. //
  3504. // commonly_treatment_claa_sunmfee, _ = decimal.NewFromFloat(commonly_treatment_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  3505. //
  3506. // }
  3507. // if item.ChrgitmLv == "2" {
  3508. // commonly_treatment_clab_amt, _ = decimal.NewFromFloat(commonly_treatment_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  3509. //
  3510. // }
  3511. // if item.ChrgitmLv == "3" {
  3512. // commonly_treatment_other_amt, _ = decimal.NewFromFloat(commonly_treatment_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  3513. // }
  3514. // }
  3515. //
  3516. // if item.MedChrgitmType == "13" { //中成费
  3517. // registerCostTotal, _ = decimal.NewFromFloat(registerCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  3518. // registerCostSelfTotal, _ = decimal.NewFromFloat(registerCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  3519. // registerPartSelfTotal, _ = decimal.NewFromFloat(registerPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  3520. // register_fulamt_ownpay_amt, _ = decimal.NewFromFloat(register_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  3521. // if item.ChrgitmLv == "1" {
  3522. //
  3523. // register_claa_sunmfee, _ = decimal.NewFromFloat(register_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  3524. //
  3525. // }
  3526. // if item.ChrgitmLv == "2" {
  3527. // register_clab_amt, _ = decimal.NewFromFloat(register_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  3528. //
  3529. // }
  3530. // if item.ChrgitmLv == "3" {
  3531. // register_other_amt, _ = decimal.NewFromFloat(register_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  3532. // }
  3533. // }
  3534. //
  3535. // if item.MedChrgitmType == "14" { //其他费
  3536. // otherCostTotal, _ = decimal.NewFromFloat(otherCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  3537. // otherCostSelfTotal, _ = decimal.NewFromFloat(otherCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  3538. // otherCostPartSelfTotal, _ = decimal.NewFromFloat(otherCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  3539. // other_fulamt_ownpay_amt, _ = decimal.NewFromFloat(other_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  3540. // if item.ChrgitmLv == "1" {
  3541. // other_claa_sunmfee, _ = decimal.NewFromFloat(other_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  3542. //
  3543. // }
  3544. // if item.ChrgitmLv == "2" {
  3545. // other_clab_amt, _ = decimal.NewFromFloat(other_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  3546. //
  3547. // }
  3548. // if item.ChrgitmLv == "3" {
  3549. // other_other_amt, _ = decimal.NewFromFloat(other_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  3550. // }
  3551. // }
  3552. //
  3553. // }
  3554. //
  3555. // var iteminfoStructs []service.IteminfoStruct
  3556. //
  3557. // if bedCostTotal != 0 {
  3558. // iteminfo.MedChrgitm = "01"
  3559. // iteminfo.FulamtOwnpayAmt = bed_fulamt_ownpay_amt
  3560. // iteminfo.Amt = bedCostTotal
  3561. // iteminfo.ClaaSumfee = bed_claa_sunmfee
  3562. // iteminfo.ClabAmt = bed_clab_amt
  3563. // iteminfo.OthAmt = bed_other_amt
  3564. // iteminfoStructs = append(iteminfoStructs, iteminfo)
  3565. // }
  3566. //
  3567. // if examineCostTotal != 0 {
  3568. // iteminfo.MedChrgitm = "02"
  3569. // iteminfo.FulamtOwnpayAmt = examine_fulamt_ownpay_amt
  3570. // iteminfo.Amt = examineCostTotal
  3571. // iteminfo.ClaaSumfee = examine_claa_sunmfee
  3572. // iteminfo.ClabAmt = examine_clab_amt
  3573. // iteminfo.OthAmt = examine_other_amt
  3574. // //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
  3575. // iteminfoStructs = append(iteminfoStructs, iteminfo)
  3576. // }
  3577. //
  3578. // if checkCostTotal != 0 {
  3579. // iteminfo.MedChrgitm = "03"
  3580. // iteminfo.FulamtOwnpayAmt = check_fulamt_ownpay_amt
  3581. // iteminfo.Amt = checkCostTotal
  3582. // iteminfo.ClaaSumfee = check_claa_sunmfee
  3583. // iteminfo.ClabAmt = check_clab_amt
  3584. // iteminfo.OthAmt = check_other_amt
  3585. // iteminfoStructs = append(iteminfoStructs, iteminfo)
  3586. //
  3587. // }
  3588. //
  3589. // if laboratoryCostTotal != 0 {
  3590. // iteminfo.MedChrgitm = "04"
  3591. // iteminfo.FulamtOwnpayAmt = laboratory_fulamt_ownpay_amt
  3592. // iteminfo.Amt = laboratoryCostTotal
  3593. // iteminfo.ClaaSumfee = laboratory_claa_sunmfee
  3594. // iteminfo.ClabAmt = laboratory_clab_amt
  3595. // iteminfo.OthAmt = laboratory_other_amt
  3596. // iteminfoStructs = append(iteminfoStructs, iteminfo)
  3597. //
  3598. // //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
  3599. //
  3600. // }
  3601. //
  3602. // if treatCostTotal != 0 {
  3603. // iteminfo.MedChrgitm = "05"
  3604. // iteminfo.FulamtOwnpayAmt = treat_fulamt_ownpay_amt
  3605. // iteminfo.Amt = treatCostTotal
  3606. // iteminfo.ClaaSumfee = treat_claa_sunmfee
  3607. // iteminfo.ClabAmt = treat_clab_amt
  3608. // iteminfo.OthAmt = treat_other_amt
  3609. // iteminfoStructs = append(iteminfoStructs, iteminfo)
  3610. // //(struct4101.IteminfoStruct, iteminfo)
  3611. // //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
  3612. // }
  3613. //
  3614. // if operationCostTotal != 0 {
  3615. // iteminfo.MedChrgitm = "06"
  3616. // iteminfo.FulamtOwnpayAmt = bed_fulamt_ownpay_amt
  3617. // iteminfo.Amt = operationCostTotal
  3618. // iteminfo.ClaaSumfee = operation_claa_sunmfee
  3619. // iteminfo.ClabAmt = operation_clab_amt
  3620. // iteminfo.OthAmt = operation_other_amt
  3621. // //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
  3622. // iteminfoStructs = append(iteminfoStructs, iteminfo)
  3623. // }
  3624. //
  3625. // if nursingCostTotal != 0 {
  3626. // iteminfo.MedChrgitm = "07"
  3627. // iteminfo.FulamtOwnpayAmt = nursing_fulamt_ownpay_amt
  3628. // iteminfo.Amt = nursingCostTotal
  3629. // iteminfo.ClaaSumfee = nursing_claa_sunmfee
  3630. // iteminfo.ClabAmt = nursing_clab_amt
  3631. // iteminfo.OthAmt = nursing_other_amt
  3632. // iteminfoStructs = append(iteminfoStructs, iteminfo)
  3633. // }
  3634. //
  3635. // if materialCostTotal != 0 {
  3636. // iteminfo.MedChrgitm = "08"
  3637. // iteminfo.FulamtOwnpayAmt = material_fulamt_ownpay_amt
  3638. // iteminfo.Amt = materialCostTotal
  3639. // iteminfo.ClaaSumfee = material_claa_sunmfee
  3640. // iteminfo.ClabAmt = material_clab_amt
  3641. // iteminfo.OthAmt = material_other_amt
  3642. // //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
  3643. // iteminfoStructs = append(iteminfoStructs, iteminfo)
  3644. // }
  3645. //
  3646. // if westernMedicineCostTotal != 0 {
  3647. // iteminfo.MedChrgitm = "09"
  3648. // iteminfo.FulamtOwnpayAmt = westernMedicine_fulamt_ownpay_amt
  3649. // iteminfo.Amt = westernMedicineCostTotal
  3650. // iteminfo.ClaaSumfee = westernMedicine_claa_sunmfee
  3651. // iteminfo.ClabAmt = westernMedicine_clab_amt
  3652. // iteminfo.OthAmt = westernMedicine_other_amt
  3653. // //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
  3654. // iteminfoStructs = append(iteminfoStructs, iteminfo)
  3655. //
  3656. // }
  3657. //
  3658. // if chineseMedicineCostTotal != 0 {
  3659. // iteminfo.MedChrgitm = "10"
  3660. // iteminfo.FulamtOwnpayAmt = chinese_medicine_fulamt_ownpay_amt
  3661. // iteminfo.Amt = chineseMedicineCostTotal
  3662. // iteminfo.ClaaSumfee = chinese_medicine_claa_sunmfee
  3663. // iteminfo.ClabAmt = chinese_medicine_clab_amt
  3664. // iteminfo.OthAmt = chinese_medicine_other_amt
  3665. // //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
  3666. // iteminfoStructs = append(iteminfoStructs, iteminfo)
  3667. //
  3668. // }
  3669. //
  3670. // if chineseTraditionalMedicineCostTotal != 0 {
  3671. // iteminfo.MedChrgitm = "11"
  3672. // iteminfo.FulamtOwnpayAmt = westernMedicine_fulamt_ownpay_amt
  3673. // iteminfo.Amt = westernMedicineCostTotal
  3674. // iteminfo.ClaaSumfee = westernMedicine_claa_sunmfee
  3675. // iteminfo.ClabAmt = westernMedicine_clab_amt
  3676. // iteminfo.OthAmt = westernMedicine_other_amt
  3677. // //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
  3678. // iteminfoStructs = append(iteminfoStructs, iteminfo)
  3679. //
  3680. // }
  3681. //
  3682. // if commonlyTreatmentCostTotal != 0 {
  3683. // iteminfo.MedChrgitm = "12"
  3684. // iteminfo.FulamtOwnpayAmt = commonly_treatment_fulamt_ownpay_amt
  3685. // iteminfo.Amt = commonlyTreatmentCostTotal
  3686. // iteminfo.ClaaSumfee = commonly_treatment_claa_sunmfee
  3687. // iteminfo.ClabAmt = commonly_treatment_clab_amt
  3688. // iteminfo.OthAmt = commonly_treatment_other_amt
  3689. // //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
  3690. // iteminfoStructs = append(iteminfoStructs, iteminfo)
  3691. //
  3692. // }
  3693. //
  3694. // if registerCostTotal != 0 {
  3695. // iteminfo.MedChrgitm = "13"
  3696. // iteminfo.FulamtOwnpayAmt = register_fulamt_ownpay_amt
  3697. // iteminfo.Amt = registerCostTotal
  3698. // iteminfo.ClaaSumfee = register_claa_sunmfee
  3699. // iteminfo.ClabAmt = register_clab_amt
  3700. // iteminfo.OthAmt = register_other_amt
  3701. // //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
  3702. // iteminfoStructs = append(iteminfoStructs, iteminfo)
  3703. //
  3704. // }
  3705. //
  3706. // if otherCostTotal != 0 {
  3707. // iteminfo.MedChrgitm = "14"
  3708. // iteminfo.FulamtOwnpayAmt = other_fulamt_ownpay_amt
  3709. // iteminfo.Amt = otherCostTotal
  3710. // iteminfo.ClaaSumfee = other_claa_sunmfee
  3711. // iteminfo.ClabAmt = other_clab_amt
  3712. // iteminfo.OthAmt = other_other_amt
  3713. // //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
  3714. // iteminfoStructs = append(iteminfoStructs, iteminfo)
  3715. //
  3716. // }
  3717. // struct4101.IteminfoStruct = iteminfoStructs
  3718. //
  3719. // struct4101.Ntly = "中国"
  3720. // struct4101.AdmCaty = "A03.06"
  3721. // result := service.Gdyb4101(struct4101, miConfig.SecretKey, miConfig.OrgName, curRoles.UserName, miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, c.GetAdminUserInfo().CurrentOrgId)
  3722. // fmt.Println(result)
  3723. //
  3724. // var dat map[string]interface{}
  3725. // if err := json.Unmarshal([]byte(result), &dat); err == nil {
  3726. // fmt.Println(dat)
  3727. // } else {
  3728. // fmt.Println(err)
  3729. // }
  3730. // userJSONBytes, _ := json.Marshal(dat)
  3731. // var res ResultSeventeen
  3732. // if err := json.Unmarshal(userJSONBytes, &res); err != nil {
  3733. // utils.ErrorLog("解析失败:%v", err)
  3734. // //c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  3735. // adminUser := c.GetAdminUserInfo()
  3736. // errlog := &models.HisOrderError{
  3737. // UserOrgId: adminUser.CurrentOrgId,
  3738. // Ctime: time.Now().Unix(),
  3739. // Mtime: time.Now().Unix(),
  3740. // ErrMsg: res.ErrMsg + "解析失败",
  3741. // Status: 1,
  3742. // PatientId: order_id,
  3743. // Stage: 10106,
  3744. // }
  3745. // service.CreateErrMsgLog(errlog)
  3746. // continue
  3747. // }
  3748. //
  3749. // if res.Infcode != 0 {
  3750. // adminUser := c.GetAdminUserInfo()
  3751. // errlog := &models.HisOrderError{
  3752. // UserOrgId: adminUser.CurrentOrgId,
  3753. // Ctime: time.Now().Unix(),
  3754. // Mtime: time.Now().Unix(),
  3755. // ErrMsg: res.ErrMsg,
  3756. // Status: 1,
  3757. // PatientId: order_id,
  3758. // Stage: 10106,
  3759. // }
  3760. // service.CreateErrMsgLog(errlog)
  3761. // continue
  3762. // } else {
  3763. // hisFundSettleListResult := &models.HisFundSettleListResult{
  3764. // Number: res.Output.SetlListId,
  3765. // Status: 1,
  3766. // Ctime: time.Now().Unix(),
  3767. // Mtime: time.Now().Unix(),
  3768. // UserOrgId: c.GetAdminUserInfo().CurrentOrgId,
  3769. // IsUpload: 1,
  3770. // OrderId: order_id,
  3771. // }
  3772. // service.CreateUploadRecord(hisFundSettleListResult)
  3773. // continue
  3774. // }
  3775. // }
  3776. //}
  3777. //
  3778. //func (c *HisApiController) GetOrgInfo() {
  3779. // miConfig, _ := service.FindMedicalInsuranceInfo(4)
  3780. // service.Gdyb1201("", miConfig.OrgName, "1122", miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, 1, "")
  3781. //
  3782. //}
  3783. //
  3784. //func (c *HisApiController) GetHisPatientInfo() {
  3785. //
  3786. // medical_insurance_card := c.GetString("medical_insurance_card")
  3787. // id_card_type, _ := c.GetInt64("id_card_type")
  3788. // id_card := c.GetString("id_card")
  3789. //
  3790. // adminInfo := c.GetAdminUserInfo()
  3791. // config, _ := service.GetMedicalInsuranceConfig(adminInfo.CurrentOrgId)
  3792. // miConfig, _ := service.FindMedicalInsuranceInfo(adminInfo.CurrentOrgId)
  3793. //
  3794. // appRole, _ := service.GetAppRole(adminInfo.CurrentOrgId)
  3795. //
  3796. // IdCardNo := ""
  3797. //
  3798. // if id_card_type == 1 {
  3799. // IdCardNo = medical_insurance_card
  3800. // } else if id_card_type == 2 {
  3801. // IdCardNo = id_card
  3802. // }
  3803. //
  3804. // if config.IsOpen == 1 {
  3805. // 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
  3806. // resp, requestErr := http.Get(api)
  3807. // if requestErr != nil {
  3808. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  3809. // return
  3810. // }
  3811. //
  3812. // defer resp.Body.Close()
  3813. // body, ioErr := ioutil.ReadAll(resp.Body)
  3814. // if ioErr != nil {
  3815. // utils.ErrorLog("接口返回数据读取失败: %v", ioErr)
  3816. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  3817. // return
  3818. // }
  3819. // var respJSON map[string]interface{}
  3820. //
  3821. // if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
  3822. // utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
  3823. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  3824. // return
  3825. // }
  3826. //
  3827. // userJSON := respJSON["data"].(map[string]interface{})["pre"].(map[string]interface{})
  3828. // userJSONBytes, _ := json.Marshal(userJSON)
  3829. // var res ResultTwo
  3830. // if err := json.Unmarshal(userJSONBytes, &res); err != nil {
  3831. // utils.ErrorLog("解析失败:%v", err)
  3832. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  3833. // return
  3834. // }
  3835. // Iinfos, _ := json.Marshal(res.Output[0].Iinfo)
  3836. // Idetinfos, _ := json.Marshal(res.Output[0].Idetinfo)
  3837. // infoStr := string(Iinfos)
  3838. // idetinfoStr := string(Idetinfos)
  3839. // if res.Infcode == 0 {
  3840. // his := models.VMHisPatient{
  3841. // Status: 1,
  3842. // Ctime: time.Now().Unix(),
  3843. // Mtime: time.Now().Unix(),
  3844. // PsnNo: res.Output[0].Baseinfo.PsnNo,
  3845. // PsnCertType: res.Output[0].Baseinfo.PsnCertType,
  3846. // Certno: res.Output[0].Baseinfo.Certno,
  3847. // PsnName: res.Output[0].Baseinfo.PsnName,
  3848. // Gend: res.Output[0].Baseinfo.Gend,
  3849. // Naty: res.Output[0].Baseinfo.Naty,
  3850. // Brdy: res.Output[0].Baseinfo.Brdy,
  3851. // Age: res.Output[0].Baseinfo.Age,
  3852. // Iinfo: infoStr,
  3853. // Idetinfo: idetinfoStr,
  3854. // UserOrgId: adminInfo.CurrentOrgId,
  3855. // IsReturn: 1,
  3856. // IdCardType: id_card_type,
  3857. // }
  3858. // c.ServeSuccessJSON(map[string]interface{}{
  3859. // "info": his,
  3860. // })
  3861. // } else {
  3862. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeHisFailedException)
  3863. // return
  3864. // }
  3865. // }
  3866. //}
  3867. //
  3868. ////func GetBasBaseInfo() (jsonStr string, err error) {
  3869. ////
  3870. //// handle := syscall.NewLazyDLL("SSCard.dll")
  3871. //// add := handle.NewProc("ReadCardBas")
  3872. //// str := make([]byte, 1024)
  3873. //// str1 := make([]byte, 1024)
  3874. //// ret, _, _ := add.Call((uintptr)(unsafe.Pointer(&str[0])), IntPtr(1024), (uintptr)(unsafe.Pointer(&str1[0])), IntPtr(1024))
  3875. //// fmt.Println(ConvertToString(string(str), "gbk", "utf-8"))
  3876. ////
  3877. //// fmt.Println(ConvertToString(string(str1), "gbk", "utf-8"))
  3878. ////
  3879. //// fmt.Println("> Add(4,5)的结果为:", ret)
  3880. //// handle.Release()
  3881. ////
  3882. //// return "", nil
  3883. ////
  3884. ////}
  3885. //
  3886. ////func GetQRBaseInfo() (jsonStr string, err error) {
  3887. //// handle := syscall.LoadDLL("SSCard.dll")
  3888. //// ReadCardBas := handle.FindProc("GetQRBase")
  3889. ////
  3890. //// str := make([]byte, 256)
  3891. //// str1 := make([]byte, 256)
  3892. //// r, _, _ := ReadCardBas.Call((uintptr)(unsafe.Pointer(&str[0])), IntPtr(1024), (uintptr)(unsafe.Pointer(&str1[0])), IntPtr(1024))
  3893. ////
  3894. //// fmt.Println(string(str))
  3895. //// fmt.Println(r)
  3896. //// return string(str), nil
  3897. ////}
  3898. //
  3899. ////func CardInit() int {
  3900. //// DllTestDef := syscall.MustLoadDLL("SSCard.dll")
  3901. //// add := DllTestDef.MustFindProc("Init")
  3902. //// ret, _, err := add.Call(StrPtr("http://igb.hsa.gdgov.cn/gdyb_inf/poc/api/card/initDll"), StrPtr("440200"))
  3903. //// if err != nil {
  3904. //// fmt.Println("SSCard的运算结果为:", ret)
  3905. //// }
  3906. //// result := int(ret)
  3907. //// return result
  3908. ////}
  3909. //
  3910. ////func CardInit() int {
  3911. //// ret, _, err := add.Call(StrPtr("http://igb.hsa.gdgov.cn/gdyb_inf/poc/api/card/initDll"), StrPtr("440200"))
  3912. //// if err != nil {
  3913. //// fmt.Println("SSCard的运算结果为:", ret)
  3914. //// }
  3915. //// fmt.Println(err)
  3916. //// result := int(ret)
  3917. //// return result
  3918. ////}
  3919. //
  3920. //func IntPtr(n int) uintptr {
  3921. // return uintptr(n)
  3922. //}
  3923. //
  3924. //func StrPtr(s string) uintptr {
  3925. // return uintptr(unsafe.Pointer(syscall.StringBytePtr(s)))
  3926. //}
  3927. //
  3928. //type Result2001 struct {
  3929. // Cainfo interface{} `json:"cainfo"`
  3930. // ErrMsg string `json:"err_msg"`
  3931. // InfRefmsgid string `json:"inf_refmsgid"`
  3932. // Infcode int64 `json:"infcode"`
  3933. // Output struct {
  3934. // Trtinfo struct {
  3935. // PsnNo string `json:"psn_no"`
  3936. // TrtChkType string `json:"trt_chk_type"`
  3937. // FundPayType string `json:"fund_pay_type"`
  3938. // TrtEnjymntFlag string `json:"trt_enjymnt_flag"`
  3939. // Begndate string `json:"begndate"`
  3940. // Enddate string `json:"enddate"`
  3941. // TrtChkRslt string `json:"trt_chk_rslt"`
  3942. // } `json:"trtinfo"`
  3943. // } `json:"output"`
  3944. // RefmsgTime string `json:"refmsg_time"`
  3945. // RespondTime string `json:"respond_time"`
  3946. // Signtype interface{} `json:"signtype"`
  3947. // WarnMsg interface{} `json:"warn_msg"`
  3948. //}
  3949. //type Result2001Org10265 struct {
  3950. // Cainfo interface{} `json:"cainfo"`
  3951. // ErrMsg string `json:"err_msg"`
  3952. // InfRefmsgid string `json:"inf_refmsgid"`
  3953. // Infcode string `json:"infcode"`
  3954. // Output struct {
  3955. // Trtinfo struct {
  3956. // PsnNo string `json:"psn_no"`
  3957. // TrtChkType string `json:"trt_chk_type"`
  3958. // FundPayType string `json:"fund_pay_type"`
  3959. // TrtEnjymntFlag string `json:"trt_enjymnt_flag"`
  3960. // Begndate string `json:"begndate"`
  3961. // Enddate string `json:"enddate"`
  3962. // TrtChkRslt string `json:"trt_chk_rslt"`
  3963. // } `json:"trtinfo"`
  3964. // } `json:"output"`
  3965. // RefmsgTime string `json:"refmsg_time"`
  3966. // RespondTime string `json:"respond_time"`
  3967. // Signtype interface{} `json:"signtype"`
  3968. // WarnMsg interface{} `json:"warn_msg"`
  3969. //}
  3970. //
  3971. //type ResultTwo struct {
  3972. // ErrMsg string `json:"err_msg"`
  3973. // InfRefmsgid string `json:"inf_refmsgid"`
  3974. // Infcode int64 `json:"infcode"`
  3975. // Output []struct {
  3976. // Baseinfo struct {
  3977. // Age float64 `json:"age"`
  3978. // Brdy string `json:"brdy"`
  3979. // Certno string `json:"certno"`
  3980. // Gend string `json:"gend"`
  3981. // Naty string `json:"naty"`
  3982. // PsnCertType string `json:"psn_cert_type"`
  3983. // PsnName string `json:"psn_name"`
  3984. // PsnNo string `json:"psn_no"`
  3985. // } `json:"baseinfo"`
  3986. // Idetinfo []interface{} `json:"idetinfo"`
  3987. // Iinfo []struct {
  3988. // Balc float64 `json:"balc"`
  3989. // CvlservFlag string `json:"cvlserv_flag"`
  3990. // EmpName string `json:"emp_name"`
  3991. // InsuplcAdmdvs string `json:"insuplc_admdvs"`
  3992. // Insutype string `json:"insutype"`
  3993. // PausInsuDansuplcAdmdvs string `json:"paus_insu_dansuplc_admdvs"`
  3994. // PausInsuDate string `json:"paus_insu_date"`
  3995. // PsnInsuDate string `json:"psn_insu_date"`
  3996. // PsnInsuStas string `json:"psn_insu_stas"`
  3997. // PsnType string `json:"psn_type"`
  3998. // } `json:"insuinfo"`
  3999. // } `json:"output"`
  4000. // RefmsgTime string `json:"refmsg_time"`
  4001. // RespondTime string `json:"respond_time"`
  4002. // Signtype interface{} `json:"signtype"`
  4003. // WarnInfo interface{} `json:"warn_info"`
  4004. //}
  4005. //
  4006. //type ResultTwo10265 struct {
  4007. // ErrMsg string `json:"err_msg"`
  4008. // InfRefmsgid string `json:"inf_refmsgid"`
  4009. // Infcode string `json:"infcode"`
  4010. // Output struct {
  4011. // Baseinfo struct {
  4012. // Age float64 `json:"age"`
  4013. // Brdy string `json:"brdy"`
  4014. // Certno string `json:"certno"`
  4015. // Gend string `json:"gend"`
  4016. // Naty string `json:"naty"`
  4017. // PsnCertType string `json:"psn_cert_type"`
  4018. // PsnName string `json:"psn_name"`
  4019. // PsnNo string `json:"psn_no"`
  4020. // } `json:"baseinfo"`
  4021. // Idetinfo []interface{} `json:"idetinfo"`
  4022. // Iinfo []struct {
  4023. // Balc float64 `json:"balc"`
  4024. // CvlservFlag string `json:"cvlserv_flag"`
  4025. // EmpName string `json:"emp_name"`
  4026. // InsuplcAdmdvs string `json:"insuplc_admdvs"`
  4027. // Insutype string `json:"insutype"`
  4028. // PausInsuDansuplcAdmdvs string `json:"paus_insu_dansuplc_admdvs"`
  4029. // PausInsuDate string `json:"paus_insu_date"`
  4030. // PsnInsuDate string `json:"psn_insu_date"`
  4031. // PsnInsuStas string `json:"psn_insu_stas"`
  4032. // PsnType string `json:"psn_type"`
  4033. // } `json:"insuinfo"`
  4034. // } `json:"output"`
  4035. // RefmsgTime string `json:"refmsg_time"`
  4036. // RespondTime string `json:"respond_time"`
  4037. // Signtype interface{} `json:"signtype"`
  4038. // WarnInfo interface{} `json:"warn_info"`
  4039. //}
  4040. //
  4041. //type ResultThree struct {
  4042. // Cainfo interface{} `json:"cainfo"`
  4043. // ErrMsg string `json:"err_msg"`
  4044. // InfRefmsgid string `json:"inf_refmsgid"`
  4045. // Infcode int64 `json:"infcode"`
  4046. // Output struct {
  4047. // Data struct {
  4048. // IptOtpNo string `json:"ipt_otp_no"`
  4049. // MdtrtID string `json:"mdtrt_id"`
  4050. // PsnNo string `json:"psn_no"`
  4051. // } `json:"data"`
  4052. // } `json:"output"`
  4053. // RefmsgTime string `json:"refmsg_time"`
  4054. // RespondTime string `json:"respond_time"`
  4055. // Signtype interface{} `json:"signtype"`
  4056. // WarnMsg interface{} `json:"warn_msg"`
  4057. //}
  4058. //
  4059. //type ResultThree10265 struct {
  4060. // Cainfo interface{} `json:"cainfo"`
  4061. // ErrMsg string `json:"err_msg"`
  4062. // InfRefmsgid string `json:"inf_refmsgid"`
  4063. // Infcode string `json:"infcode"`
  4064. // Output struct {
  4065. // Data struct {
  4066. // IptOtpNo string `json:"ipt_otp_no"`
  4067. // MdtrtID string `json:"mdtrt_id"`
  4068. // PsnNo string `json:"psn_no"`
  4069. // } `json:"data"`
  4070. // } `json:"output"`
  4071. // RefmsgTime string `json:"refmsg_time"`
  4072. // RespondTime string `json:"respond_time"`
  4073. // Signtype interface{} `json:"signtype"`
  4074. // WarnMsg interface{} `json:"warn_msg"`
  4075. //}
  4076. //
  4077. //type ResultFour struct {
  4078. // Cainfo string `json:"cainfo"`
  4079. // ErrMsg string `json:"err_msg"`
  4080. // InfRefmsgid string `json:"inf_refmsgid"`
  4081. // Infcode int64 `json:"infcode"`
  4082. // Output struct {
  4083. // Result []struct {
  4084. // BasMednFlag string `json:"bas_medn_flag"`
  4085. // ChldMedcFlag string `json:"chld_medc_flag"`
  4086. // ChrgitmLv string `json:"chrgitm_lv"`
  4087. // Cnt float64 `json:"cnt"`
  4088. // DetItemFeeSumamt float64 `json:"det_item_fee_sumamt"`
  4089. // DrtReimFlag string `json:"drt_reim_flag"`
  4090. // FeedetlSn string `json:"feedetl_sn"`
  4091. // FulamtOwnpayAmt float64 `json:"fulamt_ownpay_amt"`
  4092. // HiNegoDrugFlag string `json:"hi_nego_drug_flag"`
  4093. // InscpScpAmt float64 `json:"inscp_scp_amt"`
  4094. // ListSpItemFlag string `json:"list_sp_item_flag"`
  4095. // LmtUsedFlag string `json:"lmt_used_flag"`
  4096. // MedChrgitmType string `json:"med_chrgitm_type"`
  4097. // Memo string `json:"memo"`
  4098. // OverlmtAmt float64 `json:"overlmt_amt"`
  4099. // PreselfpayAmt float64 `json:"preselfpay_amt"`
  4100. // Pric float64 `json:"pric"`
  4101. // PricUplmtAmt float64 `json:"pric_uplmt_amt"`
  4102. // SelfpayProp float64 `json:"selfpay_prop"`
  4103. // } `json:"result"`
  4104. // } `json:"output"`
  4105. // RefmsgTime string `json:"refmsg_time"`
  4106. // RespondTime string `json:"respond_time"`
  4107. // Signtype string `json:"signtype"`
  4108. // WarnMsg string `json:"warn_msg"`
  4109. //}
  4110. //type ResultFour10265 struct {
  4111. // Cainfo string `json:"cainfo"`
  4112. // ErrMsg string `json:"err_msg"`
  4113. // InfRefmsgid string `json:"inf_refmsgid"`
  4114. // Infcode string `json:"infcode"`
  4115. // Output struct {
  4116. // Result []struct {
  4117. // BasMednFlag string `json:"bas_medn_flag"`
  4118. // ChldMedcFlag string `json:"chld_medc_flag"`
  4119. // ChrgitmLv string `json:"chrgitm_lv"`
  4120. // Cnt float64 `json:"cnt"`
  4121. // DetItemFeeSumamt float64 `json:"det_item_fee_sumamt"`
  4122. // DrtReimFlag string `json:"drt_reim_flag"`
  4123. // FeedetlSn string `json:"feedetl_sn"`
  4124. // FulamtOwnpayAmt float64 `json:"fulamt_ownpay_amt"`
  4125. // HiNegoDrugFlag string `json:"hi_nego_drug_flag"`
  4126. // InscpScpAmt float64 `json:"inscp_scp_amt"`
  4127. // ListSpItemFlag string `json:"list_sp_item_flag"`
  4128. // LmtUsedFlag string `json:"lmt_used_flag"`
  4129. // MedChrgitmType string `json:"med_chrgitm_type"`
  4130. // Memo string `json:"memo"`
  4131. // OverlmtAmt float64 `json:"overlmt_amt"`
  4132. // PreselfpayAmt float64 `json:"preselfpay_amt"`
  4133. // Pric float64 `json:"pric"`
  4134. // PricUplmtAmt float64 `json:"pric_uplmt_amt"`
  4135. // SelfpayProp float64 `json:"selfpay_prop"`
  4136. // } `json:"result"`
  4137. // } `json:"output"`
  4138. // RefmsgTime string `json:"refmsg_time"`
  4139. // RespondTime string `json:"respond_time"`
  4140. // Signtype string `json:"signtype"`
  4141. // WarnMsg string `json:"warn_msg"`
  4142. //}
  4143. //
  4144. //type ResultFive struct {
  4145. // Balc float64 `json:"balc"`
  4146. // CvlservFlag string `json:"cvlserv_flag"`
  4147. // EmpName string `json:"emp_name"`
  4148. // InsuplcAdmdvs string `json:"insuplc_admdvs"`
  4149. // Insutype string `json:"insutype"`
  4150. // PausInsuDansuplcAdmdvs string `json:"paus_insu_dansuplc_admdvs"`
  4151. // PausInsuDate string `json:"paus_insu_date"`
  4152. // PsnInsuDate string `json:"psn_insu_date"`
  4153. // PsnInsuStas string `json:"psn_insu_stas"`
  4154. // PsnType string `json:"psn_type"`
  4155. //}
  4156. //type ResultSix struct {
  4157. // Cainfo interface{} `json:"cainfo"`
  4158. // ErrMsg string `json:"err_msg"`
  4159. // InfRefmsgid string `json:"inf_refmsgid"`
  4160. // Infcode int64 `json:"infcode"`
  4161. // Output struct {
  4162. // } `json:"output"`
  4163. // RefmsgTime string `json:"refmsg_time"`
  4164. // RespondTime string `json:"respond_time"`
  4165. // Signtype interface{} `json:"signtype"`
  4166. // WarnMsg interface{} `json:"warn_msg"`
  4167. //}
  4168. //
  4169. //type ResultSix10265 struct {
  4170. // Cainfo interface{} `json:"cainfo"`
  4171. // ErrMsg string `json:"err_msg"`
  4172. // InfRefmsgid string `json:"inf_refmsgid"`
  4173. // Infcode string `json:"infcode"`
  4174. // Output struct {
  4175. // } `json:"output"`
  4176. // RefmsgTime string `json:"refmsg_time"`
  4177. // RespondTime string `json:"respond_time"`
  4178. // Signtype interface{} `json:"signtype"`
  4179. // WarnMsg interface{} `json:"warn_msg"`
  4180. //}
  4181. //
  4182. //type ResultSeven struct {
  4183. // Cainfo string `json:"cainfo"`
  4184. // ErrMsg string `json:"err_msg"`
  4185. // InfRefmsgid string `json:"inf_refmsgid"`
  4186. // Infcode int64 `json:"infcode"`
  4187. // Output struct {
  4188. // Setldetail []interface{} `json:"setldetail"`
  4189. // Setlinfo struct {
  4190. // AcctMulaidPay float64 `json:"acct_mulaid_pay"`
  4191. // AcctPay float64 `json:"acct_pay"`
  4192. // ActPayDedc float64 `json:"act_pay_dedc"`
  4193. // Age float64 `json:"age"`
  4194. // Balc float64 `json:"balc"`
  4195. // Brdy string `json:"brdy"`
  4196. // Certno string `json:"certno"`
  4197. // ClrOptins string `json:"clr_optins"`
  4198. // ClrType string `json:"clr_type"`
  4199. // ClrWay string `json:"clr_way"`
  4200. // CvlservFlag string `json:"cvlserv_flag"`
  4201. // CvlservPay float64 `json:"cvlserv_pay"`
  4202. // FulamtOwnpayAmt float64 `json:"fulamt_ownpay_amt"`
  4203. // FundPaySumamt float64 `json:"fund_pay_sumamt"`
  4204. // Gend string `json:"gend"`
  4205. // HifesPay float64 `json:"hifes_pay"`
  4206. // HifmiPay float64 `json:"hifmi_pay"`
  4207. // HifpPay float64 `json:"hifp_pay"`
  4208. // HospPartAmt float64 `json:"hosp_part_amt"`
  4209. // InscpScpAmt float64 `json:"inscp_scp_amt"`
  4210. // Insutype string `json:"insutype"`
  4211. // MafPay float64 `json:"maf_pay"`
  4212. // MdtrtCertType string `json:"mdtrt_cert_type"`
  4213. // HifobPay float64 `json:"hifob_pay"`
  4214. //
  4215. // MdtrtID string `json:"mdtrt_id"`
  4216. // MedType string `json:"med_type"`
  4217. // MedfeeSumamt float64 `json:"medfee_sumamt"`
  4218. // MedinsSetlID string `json:"medins_setl_id"`
  4219. // Naty string `json:"naty"`
  4220. // OthPay float64 `json:"oth_pay"`
  4221. // OverlmtSelfpay float64 `json:"overlmt_selfpay"`
  4222. // PoolPropSelfpay float64 `json:"pool_prop_selfpay"`
  4223. // PreselfpayAmt float64 `json:"preselfpay_amt"`
  4224. // PsnCashPay float64 `json:"psn_cash_pay"`
  4225. // PsnCertType string `json:"psn_cert_type"`
  4226. // PsnName string `json:"psn_name"`
  4227. // PsnNo string `json:"psn_no"`
  4228. // PsnPartAmt float64 `json:"psn_part_amt"`
  4229. // PsnType string `json:"psn_type"`
  4230. // SetlID string `json:"setl_id"`
  4231. // SetlTime string `json:"setl_time"`
  4232. // } `json:"setlinfo"`
  4233. // } `json:"output"`
  4234. // RefmsgTime string `json:"refmsg_time"`
  4235. // RespondTime string `json:"respond_time"`
  4236. // Signtype interface{} `json:"signtype"`
  4237. // WarnMsg interface{} `json:"warn_msg"`
  4238. //}
  4239. //type ResultSeven10265 struct {
  4240. // Cainfo string `json:"cainfo"`
  4241. // ErrMsg string `json:"err_msg"`
  4242. // InfRefmsgid string `json:"inf_refmsgid"`
  4243. // Infcode string `json:"infcode"`
  4244. // Output struct {
  4245. // Setldetail []interface{} `json:"setldetail"`
  4246. // Setlinfo struct {
  4247. // AcctMulaidPay float64 `json:"acct_mulaid_pay"`
  4248. // AcctPay float64 `json:"acct_pay"`
  4249. // ActPayDedc float64 `json:"act_pay_dedc"`
  4250. // Age float64 `json:"age"`
  4251. // Balc float64 `json:"balc"`
  4252. // Brdy string `json:"brdy"`
  4253. // Certno string `json:"certno"`
  4254. // ClrOptins string `json:"clr_optins"`
  4255. // ClrType string `json:"clr_type"`
  4256. // ClrWay string `json:"clr_way"`
  4257. // CvlservFlag string `json:"cvlserv_flag"`
  4258. // CvlservPay float64 `json:"cvlserv_pay"`
  4259. // FulamtOwnpayAmt float64 `json:"fulamt_ownpay_amt"`
  4260. // FundPaySumamt float64 `json:"fund_pay_sumamt"`
  4261. // Gend string `json:"gend"`
  4262. // HifesPay float64 `json:"hifes_pay"`
  4263. // HifmiPay float64 `json:"hifmi_pay"`
  4264. // HifpPay float64 `json:"hifp_pay"`
  4265. // HospPartAmt float64 `json:"hosp_part_amt"`
  4266. // InscpScpAmt float64 `json:"inscp_scp_amt"`
  4267. // Insutype string `json:"insutype"`
  4268. // MafPay float64 `json:"maf_pay"`
  4269. // MdtrtCertType string `json:"mdtrt_cert_type"`
  4270. // HifobPay float64 `json:"hifob_pay"`
  4271. //
  4272. // MdtrtID string `json:"mdtrt_id"`
  4273. // MedType string `json:"med_type"`
  4274. // MedfeeSumamt float64 `json:"medfee_sumamt"`
  4275. // MedinsSetlID string `json:"medins_setl_id"`
  4276. // Naty string `json:"naty"`
  4277. // OthPay float64 `json:"oth_pay"`
  4278. // OverlmtSelfpay float64 `json:"overlmt_selfpay"`
  4279. // PoolPropSelfpay float64 `json:"pool_prop_selfpay"`
  4280. // PreselfpayAmt float64 `json:"preselfpay_amt"`
  4281. // PsnCashPay float64 `json:"psn_cash_pay"`
  4282. // PsnCertType string `json:"psn_cert_type"`
  4283. // PsnName string `json:"psn_name"`
  4284. // PsnNo string `json:"psn_no"`
  4285. // PsnPartAmt float64 `json:"psn_part_amt"`
  4286. // PsnType string `json:"psn_type"`
  4287. // SetlID string `json:"setl_id"`
  4288. // SetlTime string `json:"setl_time"`
  4289. // } `json:"setlinfo"`
  4290. // } `json:"output"`
  4291. // RefmsgTime string `json:"refmsg_time"`
  4292. // RespondTime string `json:"respond_time"`
  4293. // Signtype interface{} `json:"signtype"`
  4294. // WarnMsg interface{} `json:"warn_msg"`
  4295. //}
  4296. //
  4297. //type ResultEight struct {
  4298. // Cainfo string `json:"cainfo"`
  4299. // ErrMsg string `json:"err_msg"`
  4300. // InfRefmsgid string `json:"inf_refmsgid"`
  4301. // Infcode int64 `json:"infcode"`
  4302. // Output struct {
  4303. // Stmtinfo struct {
  4304. // SetlOptins string `json:"setl_optins"`
  4305. // StmtRslt string `json:"stmt_rslt"`
  4306. // StmtRsltDscr string `json:"stmt_rslt_dscr"`
  4307. // } `json:"stmtinfo"`
  4308. // } `json:"output"`
  4309. // RefmsgTime string `json:"refmsg_time"`
  4310. // RespondTime string `json:"respond_time"`
  4311. // Signtype interface{} `json:"signtype"`
  4312. // WarnMsg interface{} `json:"warn_msg"`
  4313. //}
  4314. //
  4315. //type ResultEightFor10188 struct {
  4316. // Cainfo string `json:"cainfo"`
  4317. // ErrMsg string `json:"err_msg"`
  4318. // InfRefmsgid string `json:"inf_refmsgid"`
  4319. // Infcode string `json:"infcode"`
  4320. // Output struct {
  4321. // Stmtinfo struct {
  4322. // SetlOptins string `json:"setl_optins"`
  4323. // StmtRslt string `json:"stmt_rslt"`
  4324. // StmtRsltDscr string `json:"stmt_rslt_dscr"`
  4325. // } `json:"stmtinfo"`
  4326. // } `json:"output"`
  4327. // RefmsgTime string `json:"refmsg_time"`
  4328. // RespondTime string `json:"respond_time"`
  4329. // Signtype interface{} `json:"signtype"`
  4330. // WarnMsg interface{} `json:"warn_msg"`
  4331. //}
  4332. //type ResultNine struct {
  4333. // Cainfo string `json:"cainfo"`
  4334. // ErrMsg string `json:"err_msg"`
  4335. // InfRefmsgid string `json:"inf_refmsgid"`
  4336. // Infcode int64 `json:"infcode"`
  4337. // Output struct {
  4338. // FileQuryNo string `json:"file_qury_no"`
  4339. // } `json:"output"`
  4340. // RefmsgTime string `json:"refmsg_time"`
  4341. // RespondTime string `json:"respond_time"`
  4342. // Signtype interface{} `json:"signtype"`
  4343. // WarnMsg interface{} `json:"warn_msg"`
  4344. //}
  4345. //type ResultTen struct {
  4346. // Cainfo string `json:"cainfo"`
  4347. // ErrMsg string `json:"err_msg"`
  4348. // InfRefmsgid string `json:"inf_refmsgid"`
  4349. // Infcode int64 `json:"infcode"`
  4350. // Output struct {
  4351. // DldEndtime string `json:"dld_endtime"`
  4352. // FileQuryNo string `json:"file_qury_no"`
  4353. // Filename string `json:"filename"`
  4354. // } `json:"output"`
  4355. // RefmsgTime string `json:"refmsg_time"`
  4356. // RespondTime string `json:"respond_time"`
  4357. // Signtype interface{} `json:"signtype"`
  4358. // WarnMsg interface{} `json:"warn_msg"`
  4359. //}
  4360. //
  4361. ////type Autogenerated struct {
  4362. //// Output struct {
  4363. //// Setlinfo struct {
  4364. //// SetlTime string `json:"setl_time"`
  4365. //// CvlservPay float64 `json:"cvlserv_pay"`
  4366. //// Year string `json:"year"`
  4367. //// MedType string `json:"med_type"`
  4368. //// PsnPay float64 `json:"psn_pay"`
  4369. //// OpterID string `json:"opter_id"`
  4370. //// Begndate string `json:"begndate"`
  4371. //// FlxempeFlag string `json:"flxempe_flag"`
  4372. //// HifmiPay float64 `json:"hifmi_pay"`
  4373. //// PsnNo string `json:"psn_no"`
  4374. //// ActPayDedc float64 `json:"act_pay_dedc"`
  4375. //// MedinsSetlID interface{} `json:"medins_setl_id"`
  4376. //// AcctMulaidPay interface{} `json:"acct_mulaid_pay"`
  4377. //// ClrWay string `json:"clr_way"`
  4378. //// OthPay float64 `json:"oth_pay"`
  4379. //// Gend string `json:"gend"`
  4380. //// MdtrtID string `json:"mdtrt_id"`
  4381. //// AcctPay float64 `json:"acct_pay"`
  4382. //// InscpScpAmt float64 `json:"inscp_scp_amt"`
  4383. //// Insutype string `json:"insutype"`
  4384. //// Invono interface{} `json:"invono"`
  4385. //// Enddate string `json:"enddate"`
  4386. //// CashPayamt float64 `json:"cash_payamt"`
  4387. //// PsnType string `json:"psn_type"`
  4388. //// FixmedinsName string `json:"fixmedins_name"`
  4389. //// HifpPay float64 `json:"hifp_pay"`
  4390. //// NewFlag interface{} `json:"new_flag"`
  4391. //// OverlmtSelfpay float64 `json:"overlmt_selfpay"`
  4392. //// PreselfpayAmt float64 `json:"preselfpay_amt"`
  4393. //// PayLoc string `json:"pay_loc"`
  4394. //// ClrType string `json:"clr_type"`
  4395. //// RefdSetlFlag string `json:"refd_setl_flag"`
  4396. //// CvlservFlag string `json:"cvlserv_flag"`
  4397. //// EmpName string `json:"emp_name"`
  4398. //// Brdy string `json:"brdy"`
  4399. //// Naty string `json:"naty"`
  4400. //// Certno string `json:"certno"`
  4401. //// DiseCode string `json:"dise_code"`
  4402. //// FixmedinsCode string `json:"fixmedins_code"`
  4403. //// DedcHospLv string `json:"dedc_hosp_lv"`
  4404. //// OpterName string `json:"opter_name"`
  4405. //// Balc float64 `json:"balc"`
  4406. //// FixmedinsPoolarea string `json:"fixmedins_poolarea"`
  4407. //// PsnCertType string `json:"psn_cert_type"`
  4408. //// HifobPay float64 `json:"hifob_pay"`
  4409. //// MedfeeSumamt float64 `json:"medfee_sumamt"`
  4410. //// HifesPay float64 `json:"hifes_pay"`
  4411. //// FundPaySumamt float64 `json:"fund_pay_sumamt"`
  4412. //// OptTime string `json:"opt_time"`
  4413. //// FulamtOwnpayAmt float64 `json:"fulamt_ownpay_amt"`
  4414. //// SetlID string `json:"setl_id"`
  4415. //// MafPay float64 `json:"maf_pay"`
  4416. //// PsnName string `json:"psn_name"`
  4417. //// InsuOptins interface{} `json:"insu_optins"`
  4418. //// PrefFundPay interface{} `json:"pref_fund_pay"`
  4419. //// ClrOptins string `json:"clr_optins"`
  4420. //// PoolPropSelfpay float64 `json:"pool_prop_selfpay"`
  4421. //// DiseName string `json:"dise_name"`
  4422. //// LmtpricHospLv string `json:"lmtpric_hosp_lv"`
  4423. //// Age float64 `json:"age"`
  4424. //// DtrtCertType string `json:"dtrt_cert_type"`
  4425. //// HospLv string `json:"hosp_lv"`
  4426. //// } `json:"setlinfo"`
  4427. //// Setldetail []struct {
  4428. //// FundPayType string `json:"fund_pay_type"`
  4429. //// FundPayamt float64 `json:"fund_payamt"`
  4430. //// SetlProcInfo interface{} `json:"setl_proc_info"`
  4431. //// CrtPaybLmtAmt interface{} `json:"crt_payb_lmt_amt"`
  4432. //// InscpScpAmt interface{} `json:"inscp_scp_amt"`
  4433. //// FundPayTypeName interface{} `json:"fund_pay_type_name"`
  4434. //// PrefFundPay interface{} `json:"pref_fund_pay"`
  4435. //// } `json:"setldetail"`
  4436. //// } `json:"output"`
  4437. //// Infcode int `json:"infcode"`
  4438. //// WarnMsg interface{} `json:"warn_msg"`
  4439. //// Cainfo interface{} `json:"cainfo"`
  4440. //// ErrMsg interface{} `json:"err_msg"`
  4441. //// RefmsgTime string `json:"refmsg_time"`
  4442. //// Signtype interface{} `json:"signtype"`
  4443. //// RespondTime string `json:"respond_time"`
  4444. //// InfRefmsgid string `json:"inf_refmsgid"`
  4445. ////}
  4446. //
  4447. //type ResultEleven struct {
  4448. // Cainfo string `json:"cainfo"`
  4449. // ErrMsg string `json:"err_msg"`
  4450. // InfRefmsgid string `json:"inf_refmsgid"`
  4451. // Infcode int64 `json:"infcode"`
  4452. // Output struct {
  4453. // Setlinfo struct {
  4454. // SetlTime string `json:"setl_time"`
  4455. // CvlservPay float64 `json:"cvlserv_pay"`
  4456. // Year string `json:"year"`
  4457. // MedType string `json:"med_type"`
  4458. // PsnPay float64 `json:"psn_pay"`
  4459. // OpterID string `json:"opter_id"`
  4460. // Begndate string `json:"begndate"`
  4461. // FlxempeFlag string `json:"flxempe_flag"`
  4462. // HifmiPay float64 `json:"hifmi_pay"`
  4463. // PsnNo string `json:"psn_no"`
  4464. // ActPayDedc float64 `json:"act_pay_dedc"`
  4465. // MedinsSetlID interface{} `json:"medins_setl_id"`
  4466. // AcctMulaidPay interface{} `json:"acct_mulaid_pay"`
  4467. // ClrWay string `json:"clr_way"`
  4468. // OthPay float64 `json:"oth_pay"`
  4469. // Gend string `json:"gend"`
  4470. // MdtrtID string `json:"mdtrt_id"`
  4471. // AcctPay float64 `json:"acct_pay"`
  4472. // InscpScpAmt float64 `json:"inscp_scp_amt"`
  4473. // Insutype string `json:"insutype"`
  4474. // Invono interface{} `json:"invono"`
  4475. // Enddate string `json:"enddate"`
  4476. // CashPayamt float64 `json:"cash_payamt"`
  4477. // PsnType string `json:"psn_type"`
  4478. // FixmedinsName string `json:"fixmedins_name"`
  4479. // HifpPay float64 `json:"hifp_pay"`
  4480. // NewFlag interface{} `json:"new_flag"`
  4481. // OverlmtSelfpay float64 `json:"overlmt_selfpay"`
  4482. // PreselfpayAmt float64 `json:"preselfpay_amt"`
  4483. // PayLoc string `json:"pay_loc"`
  4484. // ClrType string `json:"clr_type"`
  4485. // RefdSetlFlag string `json:"refd_setl_flag"`
  4486. // CvlservFlag string `json:"cvlserv_flag"`
  4487. // EmpName string `json:"emp_name"`
  4488. // Brdy string `json:"brdy"`
  4489. // Naty string `json:"naty"`
  4490. // Certno string `json:"certno"`
  4491. // DiseCode string `json:"dise_code"`
  4492. // FixmedinsCode string `json:"fixmedins_code"`
  4493. // DedcHospLv string `json:"dedc_hosp_lv"`
  4494. // OpterName string `json:"opter_name"`
  4495. // Balc float64 `json:"balc"`
  4496. // FixmedinsPoolarea string `json:"fixmedins_poolarea"`
  4497. // PsnCertType string `json:"psn_cert_type"`
  4498. // HifobPay float64 `json:"hifob_pay"`
  4499. // MedfeeSumamt float64 `json:"medfee_sumamt"`
  4500. // HifesPay float64 `json:"hifes_pay"`
  4501. // FundPaySumamt float64 `json:"fund_pay_sumamt"`
  4502. // OptTime string `json:"opt_time"`
  4503. // FulamtOwnpayAmt float64 `json:"fulamt_ownpay_amt"`
  4504. // SetlID string `json:"setl_id"`
  4505. // MafPay float64 `json:"maf_pay"`
  4506. // PsnName string `json:"psn_name"`
  4507. // InsuOptins interface{} `json:"insu_optins"`
  4508. // PrefFundPay interface{} `json:"pref_fund_pay"`
  4509. // ClrOptins string `json:"clr_optins"`
  4510. // PoolPropSelfpay float64 `json:"pool_prop_selfpay"`
  4511. // DiseName string `json:"dise_name"`
  4512. // LmtpricHospLv string `json:"lmtpric_hosp_lv"`
  4513. // Age float64 `json:"age"`
  4514. // DtrtCertType string `json:"dtrt_cert_type"`
  4515. // HospLv string `json:"hosp_lv"`
  4516. // } `json:"setlinfo"`
  4517. // } `json:"output"`
  4518. // RefmsgTime string `json:"refmsg_time"`
  4519. // RespondTime string `json:"respond_time"`
  4520. // Signtype interface{} `json:"signtype"`
  4521. // WarnMsg interface{} `json:"warn_msg"`
  4522. //}
  4523. //type ResultEleven10265 struct {
  4524. // Cainfo string `json:"cainfo"`
  4525. // ErrMsg string `json:"err_msg"`
  4526. // InfRefmsgid string `json:"inf_refmsgid"`
  4527. // Infcode string `json:"infcode"`
  4528. // Output struct {
  4529. // Setlinfo struct {
  4530. // SetlTime string `json:"setl_time"`
  4531. // CvlservPay float64 `json:"cvlserv_pay"`
  4532. // Year string `json:"year"`
  4533. // MedType string `json:"med_type"`
  4534. // PsnPay float64 `json:"psn_pay"`
  4535. // OpterID string `json:"opter_id"`
  4536. // Begndate string `json:"begndate"`
  4537. // FlxempeFlag string `json:"flxempe_flag"`
  4538. // HifmiPay float64 `json:"hifmi_pay"`
  4539. // PsnNo string `json:"psn_no"`
  4540. // ActPayDedc float64 `json:"act_pay_dedc"`
  4541. // MedinsSetlID interface{} `json:"medins_setl_id"`
  4542. // AcctMulaidPay interface{} `json:"acct_mulaid_pay"`
  4543. // ClrWay string `json:"clr_way"`
  4544. // OthPay float64 `json:"oth_pay"`
  4545. // Gend string `json:"gend"`
  4546. // MdtrtID string `json:"mdtrt_id"`
  4547. // AcctPay float64 `json:"acct_pay"`
  4548. // InscpScpAmt float64 `json:"inscp_scp_amt"`
  4549. // Insutype string `json:"insutype"`
  4550. // Invono interface{} `json:"invono"`
  4551. // Enddate string `json:"enddate"`
  4552. // CashPayamt float64 `json:"cash_payamt"`
  4553. // PsnType string `json:"psn_type"`
  4554. // FixmedinsName string `json:"fixmedins_name"`
  4555. // HifpPay float64 `json:"hifp_pay"`
  4556. // NewFlag interface{} `json:"new_flag"`
  4557. // OverlmtSelfpay float64 `json:"overlmt_selfpay"`
  4558. // PreselfpayAmt float64 `json:"preselfpay_amt"`
  4559. // PayLoc string `json:"pay_loc"`
  4560. // ClrType string `json:"clr_type"`
  4561. // RefdSetlFlag string `json:"refd_setl_flag"`
  4562. // CvlservFlag string `json:"cvlserv_flag"`
  4563. // EmpName string `json:"emp_name"`
  4564. // Brdy string `json:"brdy"`
  4565. // Naty string `json:"naty"`
  4566. // Certno string `json:"certno"`
  4567. // DiseCode string `json:"dise_code"`
  4568. // FixmedinsCode string `json:"fixmedins_code"`
  4569. // DedcHospLv string `json:"dedc_hosp_lv"`
  4570. // OpterName string `json:"opter_name"`
  4571. // Balc float64 `json:"balc"`
  4572. // FixmedinsPoolarea string `json:"fixmedins_poolarea"`
  4573. // PsnCertType string `json:"psn_cert_type"`
  4574. // HifobPay float64 `json:"hifob_pay"`
  4575. // MedfeeSumamt float64 `json:"medfee_sumamt"`
  4576. // HifesPay float64 `json:"hifes_pay"`
  4577. // FundPaySumamt float64 `json:"fund_pay_sumamt"`
  4578. // OptTime string `json:"opt_time"`
  4579. // FulamtOwnpayAmt float64 `json:"fulamt_ownpay_amt"`
  4580. // SetlID string `json:"setl_id"`
  4581. // MafPay float64 `json:"maf_pay"`
  4582. // PsnName string `json:"psn_name"`
  4583. // InsuOptins interface{} `json:"insu_optins"`
  4584. // PrefFundPay interface{} `json:"pref_fund_pay"`
  4585. // ClrOptins string `json:"clr_optins"`
  4586. // PoolPropSelfpay float64 `json:"pool_prop_selfpay"`
  4587. // DiseName string `json:"dise_name"`
  4588. // LmtpricHospLv string `json:"lmtpric_hosp_lv"`
  4589. // Age float64 `json:"age"`
  4590. // DtrtCertType string `json:"dtrt_cert_type"`
  4591. // HospLv string `json:"hosp_lv"`
  4592. // } `json:"setlinfo"`
  4593. // } `json:"output"`
  4594. // RefmsgTime string `json:"refmsg_time"`
  4595. // RespondTime string `json:"respond_time"`
  4596. // Signtype interface{} `json:"signtype"`
  4597. // WarnMsg interface{} `json:"warn_msg"`
  4598. //}
  4599. //
  4600. //type ResultTwelve struct {
  4601. // Cainfo string `json:"cainfo"`
  4602. // ErrMsg string `json:"err_msg"`
  4603. // InfRefmsgid string `json:"inf_refmsgid"`
  4604. // Infcode int64 `json:"infcode"`
  4605. // Output struct {
  4606. // MdtrtId string `json:"mdtrt_id"`
  4607. // ChrgBchno string `json:"chrg_bchno"`
  4608. // PsnNo string `json:"psn_no"`
  4609. // } `json:"output"`
  4610. // RefmsgTime string `json:"refmsg_time"`
  4611. // RespondTime string `json:"respond_time"`
  4612. // Signtype interface{} `json:"signtype"`
  4613. // WarnMsg interface{} `json:"warn_msg"`
  4614. //}
  4615. //
  4616. //type ResultThirteen struct {
  4617. // ErrMsg string `json:"err_msg"`
  4618. // InfRefmsgid string `json:"inf_refmsgid"`
  4619. // Infcode int64 `json:"infcode"`
  4620. // Output struct {
  4621. // Result struct {
  4622. // TrtDclaDetlSn string `json:"trt_dcla_detl_sn"`
  4623. // } `json:"result"`
  4624. // } `json:"output"`
  4625. // RefmsgTime string `json:"refmsg_time"`
  4626. // RespondTime string `json:"respond_time"`
  4627. // Signtype interface{} `json:"signtype"`
  4628. // WarnInfo interface{} `json:"warn_info"`
  4629. //}
  4630. //
  4631. //type ResultThirteen10265 struct {
  4632. // ErrMsg string `json:"err_msg"`
  4633. // InfRefmsgid string `json:"inf_refmsgid"`
  4634. // Infcode string `json:"infcode"`
  4635. // Output struct {
  4636. // Result struct {
  4637. // TrtDclaDetlSn string `json:"trt_dcla_detl_sn"`
  4638. // } `json:"result"`
  4639. // } `json:"output"`
  4640. // RefmsgTime string `json:"refmsg_time"`
  4641. // RespondTime string `json:"respond_time"`
  4642. // Signtype interface{} `json:"signtype"`
  4643. // WarnInfo interface{} `json:"warn_info"`
  4644. //}
  4645. //
  4646. //type ResultFourteen struct {
  4647. // ErrMsg string `json:"err_msg"`
  4648. // InfRefmsgid string `json:"inf_refmsgid"`
  4649. // Infcode int64 `json:"infcode"`
  4650. // Output struct {
  4651. // } `json:"output"`
  4652. // RefmsgTime string `json:"refmsg_time"`
  4653. // RespondTime string `json:"respond_time"`
  4654. // Signtype interface{} `json:"signtype"`
  4655. // WarnInfo interface{} `json:"warn_info"`
  4656. //}
  4657. //
  4658. //type ResultFourteen10265 struct {
  4659. // ErrMsg string `json:"err_msg"`
  4660. // InfRefmsgid string `json:"inf_refmsgid"`
  4661. // Infcode string `json:"infcode"`
  4662. // Output struct {
  4663. // } `json:"output"`
  4664. // RefmsgTime string `json:"refmsg_time"`
  4665. // RespondTime string `json:"respond_time"`
  4666. // Signtype interface{} `json:"signtype"`
  4667. // WarnInfo interface{} `json:"warn_info"`
  4668. //}
  4669. //
  4670. //type ResultSixteen struct {
  4671. // Cainfo string `json:"cainfo"`
  4672. // ErrMsg string `json:"err_msg"`
  4673. // InfRefmsgid string `json:"inf_refmsgid"`
  4674. // Infcode int64 `json:"infcode"`
  4675. // Output struct {
  4676. // Setldetail []interface{} `json:"setldetail"`
  4677. // Setlinfo struct {
  4678. // MdtrtID string `json:"mdtrt_id"`
  4679. // SetlID string `json:"setl_id"`
  4680. // ClrOptins string `json:"clr_optins"`
  4681. // SetlTime string `json:"setl_time"`
  4682. // MedfeeSumamt float64 `json:"medfee_sumamt"`
  4683. // FulamtOwnpayAmt float64 `json:"fulamt_ownpay_amt"`
  4684. // OverlmtSelfpay float64 `json:"overlmt_selfpay"`
  4685. // PreselfpayAmt float64 `json:"preselfpay_amt"`
  4686. // InscpScpAmt float64 `json:"inscp_scp_amt"`
  4687. // ActPayDedc float64 `json:"act_pay_dedc"`
  4688. // HifpPay float64 `json:"hifp_pay"`
  4689. // PoolPropSe float64 `json:"pool_prop_selfpay"`
  4690. // Lfpay float64 `json:"selfpay"`
  4691. // CvlservPay float64 `json:"cvlserv_pay"`
  4692. // HifesPay float64 `json:"hifes_pay"`
  4693. // HifmiPay float64 `json:"hifmi_pay"`
  4694. // HifobPay float64 `json:"hifob_pay"`
  4695. // MafPay float64 `json:"maf_pay"`
  4696. // OthPay float64 `json:"oth_pay"`
  4697. // FundPaySumamt float64 `json:"fund_pay_sumamt"`
  4698. // PsnPartAmt float64 `json:"psn_part_amt"`
  4699. // AcctPay float64 `json:"acct_pay"`
  4700. // Balc float64 `json:"balc"`
  4701. // AcctMulaidPay float64 `json:"acct_mulaid_pay"`
  4702. // HospPartAmt float64 `json:"hosp_part_amt"`
  4703. // MedinsSetlID string `json:"medins_setl_id"`
  4704. // PdnCashPay string `json:"pdn_cash_pay"`
  4705. // } `json:"setlinfo"`
  4706. // } `json:"output"`
  4707. // RefmsgTime string `json:"refmsg_time"`
  4708. // RespondTime string `json:"respond_time"`
  4709. // Signtype interface{} `json:"signtype"`
  4710. // WarnMsg interface{} `json:"warn_msg"`
  4711. //}
  4712. //type ResultSixteen10265 struct {
  4713. // Cainfo string `json:"cainfo"`
  4714. // ErrMsg string `json:"err_msg"`
  4715. // InfRefmsgid string `json:"inf_refmsgid"`
  4716. // Infcode string `json:"infcode"`
  4717. // Output struct {
  4718. // Setldetail []interface{} `json:"setldetail"`
  4719. // Setlinfo struct {
  4720. // MdtrtID string `json:"mdtrt_id"`
  4721. // SetlID string `json:"setl_id"`
  4722. // ClrOptins string `json:"clr_optins"`
  4723. // SetlTime string `json:"setl_time"`
  4724. // MedfeeSumamt float64 `json:"medfee_sumamt"`
  4725. // FulamtOwnpayAmt float64 `json:"fulamt_ownpay_amt"`
  4726. // OverlmtSelfpay float64 `json:"overlmt_selfpay"`
  4727. // PreselfpayAmt float64 `json:"preselfpay_amt"`
  4728. // InscpScpAmt float64 `json:"inscp_scp_amt"`
  4729. // ActPayDedc float64 `json:"act_pay_dedc"`
  4730. // HifpPay float64 `json:"hifp_pay"`
  4731. // PoolPropSe float64 `json:"pool_prop_selfpay"`
  4732. // Lfpay float64 `json:"selfpay"`
  4733. // CvlservPay float64 `json:"cvlserv_pay"`
  4734. // HifesPay float64 `json:"hifes_pay"`
  4735. // HifmiPay float64 `json:"hifmi_pay"`
  4736. // HifobPay float64 `json:"hifob_pay"`
  4737. // MafPay float64 `json:"maf_pay"`
  4738. // OthPay float64 `json:"oth_pay"`
  4739. // FundPaySumamt float64 `json:"fund_pay_sumamt"`
  4740. // PsnPartAmt float64 `json:"psn_part_amt"`
  4741. // AcctPay float64 `json:"acct_pay"`
  4742. // Balc float64 `json:"balc"`
  4743. // AcctMulaidPay float64 `json:"acct_mulaid_pay"`
  4744. // HospPartAmt float64 `json:"hosp_part_amt"`
  4745. // MedinsSetlID string `json:"medins_setl_id"`
  4746. // PdnCashPay string `json:"pdn_cash_pay"`
  4747. // } `json:"setlinfo"`
  4748. // } `json:"output"`
  4749. // RefmsgTime string `json:"refmsg_time"`
  4750. // RespondTime string `json:"respond_time"`
  4751. // Signtype interface{} `json:"signtype"`
  4752. // WarnMsg interface{} `json:"warn_msg"`
  4753. //}
  4754. //
  4755. //type ResultSeventeen struct {
  4756. // ErrMsg string `json:"err_msg"`
  4757. // InfRefmsgid string `json:"inf_refmsgid"`
  4758. // Infcode int64 `json:"infcode"`
  4759. // Output struct {
  4760. // SetlListId string `json:"setl_list_id"`
  4761. // } `json:"output"`
  4762. // RefmsgTime string `json:"refmsg_time"`
  4763. // RespondTime string `json:"respond_time"`
  4764. // Signtype string `json:"signtype"`
  4765. // WarnInfo string `json:"warn_info"`
  4766. //}
  4767. //
  4768. //type ResultSeventeenOther struct {
  4769. // ErrMsg string `json:"err_msg"`
  4770. // InfRefmsgid string `json:"inf_refmsgid"`
  4771. // Infcode string `json:"infcode"`
  4772. // Output struct {
  4773. // SetlListId string `json:"setl_list_id"`
  4774. // } `json:"output"`
  4775. // RefmsgTime string `json:"refmsg_time"`
  4776. // RespondTime string `json:"respond_time"`
  4777. // Signtype string `json:"signtype"`
  4778. // WarnInfo string `json:"warn_info"`
  4779. //}
  4780. //
  4781. //type Result90991 struct {
  4782. // ErrMsg string `json:"err_msg"`
  4783. // InfRefmsgid string `json:"inf_refmsgid"`
  4784. // Infcode int64 `json:"infcode"`
  4785. // Output struct {
  4786. // Result struct {
  4787. // PsnNo string `json:"psn_no"`
  4788. // CardStat string `json:"card_stat"`
  4789. // Certno string `json:"certno"`
  4790. // PsnName string `json:"psn_name"`
  4791. // CheckStat string `json:"check_stat"`
  4792. // SscnoCheckStat string `json:"sscno_check_stat"`
  4793. // } `json:"result"`
  4794. // } `json:"output"`
  4795. // RefmsgTime string `json:"refmsg_time"`
  4796. // RespondTime string `json:"respond_time"`
  4797. // Signtype interface{} `json:"signtype"`
  4798. // WarnInfo interface{} `json:"warn_info"`
  4799. //}
  4800. //
  4801. //type Result90100 struct {
  4802. // ErrMsg string `json:"err_msg"`
  4803. // InfRefmsgid string `json:"inf_refmsgid"`
  4804. // Infcode int64 `json:"infcode"`
  4805. // Output struct {
  4806. // PoolareaNo string `json:"poolarea_no"`
  4807. // PoolareaNoName string `json:"poolarea_no_name"`
  4808. // Insutype string `json:"insutype"`
  4809. // InsutypeName string `json:"insutype_name"`
  4810. // ClctType string `json:"clct_type"`
  4811. // ClctTypeName string `json:"clct_type_name"`
  4812. // ClctFlag string `json:"clct_flag"`
  4813. // ClctFlagName string `json:"clct_flag_name"`
  4814. // AccrymBegn string `json:"accrym_begn"`
  4815. // AccrymEnd string `json:"accrym_end"`
  4816. // ClctTime string `json:"clct_time"`
  4817. // ClctstdCrtfRuleCodg string `json:"clctstd_crtf_rule_codg"`
  4818. // } `json:"output"`
  4819. // RefmsgTime string `json:"refmsg_time"`
  4820. // RespondTime string `json:"respond_time"`
  4821. // Signtype interface{} `json:"signtype"`
  4822. // WarnInfo interface{} `json:"warn_info"`
  4823. //}
  4824. //
  4825. //type Custom struct {
  4826. // DetItemFeeSumamt string
  4827. // Cut string
  4828. // FeedetlSn string
  4829. // Price string
  4830. // MedListCodg string
  4831. // Type int64
  4832. // AdviceId int64
  4833. // ProjectId int64
  4834. // ItemId int64
  4835. //}
  4836. //
  4837. //type Result5301 struct {
  4838. // ErrMsg string `json:"err_msg"`
  4839. // InfRefmsgid string `json:"inf_refmsgid"`
  4840. // Infcode int64 `json:"infcode"`
  4841. // Output struct {
  4842. // Result []struct {
  4843. // OpspDiseCode string `json:"opsp_dise_code"`
  4844. // OpspDiseName string `json:"opsp_dise_name"`
  4845. // Begndate string `json:"begndate"`
  4846. // Enddate string `json:"enddate"`
  4847. // } `json:"feedetail"`
  4848. // } `json:"output"`
  4849. // RefmsgTime string `json:"refmsg_time"`
  4850. // RespondTime string `json:"respond_time"`
  4851. // Signtype interface{} `json:"signtype"`
  4852. // WarnInfo interface{} `json:"warn_info"`
  4853. //}
  4854. //
  4855. //type Result5301For10265 struct {
  4856. // ErrMsg string `json:"err_msg"`
  4857. // InfRefmsgid string `json:"inf_refmsgid"`
  4858. // Infcode string `json:"infcode"`
  4859. // Output struct {
  4860. // Result []struct {
  4861. // OpspDiseCode string `json:"opsp_dise_code"`
  4862. // OpspDiseName string `json:"opsp_dise_name"`
  4863. // Begndate string `json:"begndate"`
  4864. // Enddate string `json:"enddate"`
  4865. // } `json:"feedetail"`
  4866. // } `json:"output"`
  4867. // RefmsgTime string `json:"refmsg_time"`
  4868. // RespondTime string `json:"respond_time"`
  4869. // Signtype interface{} `json:"signtype"`
  4870. // WarnInfo interface{} `json:"warn_info"`
  4871. //}
  4872. //
  4873. ////获取个人信息----挂号-----上传就诊信息
  4874. //func (c *HisApiController) GetRegisterInfo() {
  4875. // id, _ := c.GetInt64("id")
  4876. // record_time := c.GetString("record_time")
  4877. // settlementValue, _ := c.GetInt64("settlement_value")
  4878. // medical_insurance_card := c.GetString("medical_insurance_card")
  4879. // name := c.GetString("name")
  4880. // id_card_type, _ := c.GetInt64("id_card_type")
  4881. // certificates, _ := c.GetInt64("certificates")
  4882. // medical_care, _ := c.GetInt64("medical_care")
  4883. // birthday := c.GetString("birthday")
  4884. // id_card := c.GetString("id_card")
  4885. // register_type, _ := c.GetInt64("register")
  4886. // doctor, _ := c.GetInt64("doctor")
  4887. // department, _ := c.GetInt64("department")
  4888. // gender, _ := c.GetInt64("sex")
  4889. // registration_fee, _ := c.GetFloat("registration_fee")
  4890. // medical_expenses, _ := c.GetFloat("medical_expenses")
  4891. // social_type, _ := c.GetInt64("social_type")
  4892. // med_type := c.GetString("social_type")
  4893. // admin_user_id, _ := c.GetInt64("admin_user_id")
  4894. // insuplc_admdvs := c.GetString("insuplc_admdvs")
  4895. //
  4896. // timeLayout := "2006-01-02"
  4897. // loc, _ := time.LoadLocation("Local")
  4898. // birthdays, _ := time.ParseInLocation(timeLayout+" 15:04:05", birthday+" 00:00:00", loc)
  4899. // birthUnix := birthdays.Unix()
  4900. //
  4901. // theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", record_time+" 00:00:00", loc)
  4902. // if err != nil {
  4903. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
  4904. // return
  4905. // }
  4906. // recordDateTime := theTime.Unix()
  4907. //
  4908. // adminInfo := c.GetAdminUserInfo()
  4909. // var patient service.Patients
  4910. // if id == 0 {
  4911. // patient, _ = service.GetPatientByIDCard(id_card, adminInfo.CurrentOrgId)
  4912. // } else {
  4913. // patient, _ = service.GetPatientByIDTwo(adminInfo.CurrentOrgId, id)
  4914. // }
  4915. // patientPrescription, _ := service.FindPatientPrescriptionInfo(adminInfo.CurrentOrgId, id, recordDateTime)
  4916. // if patientPrescription.ID == 0 {
  4917. // patientPrescription, _ = service.FindLastPatientPrescriptionInfo(adminInfo.CurrentOrgId, id, recordDateTime)
  4918. // }
  4919. //
  4920. // miConfig, _ := service.FindMedicalInsuranceInfo(adminInfo.CurrentOrgId)
  4921. // if patient.ID == 0 {
  4922. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodePatientNoExist)
  4923. // return
  4924. // }
  4925. // if len(patient.IdCardNo) == 0 {
  4926. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeIDCartNo)
  4927. // return
  4928. // }
  4929. // config, _ := service.GetMedicalInsuranceConfig(adminInfo.CurrentOrgId)
  4930. // roles, _ := service.GetAdminUserInfoByID(adminInfo.CurrentOrgId, admin_user_id)
  4931. //
  4932. // doctor_info, _ := service.GetAdminUserInfoByID(adminInfo.CurrentOrgId, doctor)
  4933. //
  4934. // //就诊结算未完成,不能进行二次挂号
  4935. // his, _ := service.GetHisPatientInfoTwo(adminInfo.CurrentOrgId, patient.ID, recordDateTime)
  4936. // if len(his) >= 1 {
  4937. // order, _ := service.GetNewHisOrderTwo(adminInfo.CurrentOrgId, his[len(his)-1].Number, his[len(his)-1].PatientId, recordDateTime)
  4938. // if len(his) >= 1 && order.ID == 0 {
  4939. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeHisPatientParamWrong)
  4940. // return
  4941. // }
  4942. // }
  4943. //
  4944. // //var register_log string
  4945. //
  4946. // if config.IsOpen == 1 {
  4947. // var res ResultTwo
  4948. // var res10265 ResultTwo10265
  4949. // var PsnNo string
  4950. // var PsnCertType string
  4951. // var Certno string
  4952. // var PsnName string
  4953. // var Gend string
  4954. // var Naty string
  4955. // var Brdy string
  4956. // var Age float64
  4957. // var infoStr string
  4958. // var idetinfoStr string
  4959. // var infocode int64
  4960. // var verify_number string
  4961. // fmt.Println(verify_number)
  4962. // if miConfig.MdtrtareaAdmvs == "421300" {
  4963. // psn_info, _ := service.GetPsnByPatientId(id)
  4964. // PsnNo = psn_info.PsnNo
  4965. // PsnCertType = psn_info.PsnCertType
  4966. // Certno = psn_info.Certno
  4967. // PsnName = psn_info.PsnName
  4968. // Gend = psn_info.Gend
  4969. // Naty = psn_info.Naty
  4970. // Brdy = psn_info.Brdy
  4971. // Age = psn_info.Age
  4972. // infoStr = psn_info.Insuinfo
  4973. // idetinfoStr = psn_info.Idetinfo
  4974. // infocode = 0
  4975. //
  4976. // } else if miConfig.MdtrtareaAdmvs == "320921" || miConfig.MdtrtareaAdmvs == "320982" {
  4977. // psn_info, _ := service.GetPsnByPatientId(id)
  4978. // PsnNo = psn_info.PsnNo
  4979. // PsnCertType = psn_info.PsnCertType
  4980. // Certno = psn_info.Certno
  4981. // PsnName = psn_info.PsnName
  4982. // Gend = psn_info.Gend
  4983. // Naty = psn_info.Naty
  4984. // Brdy = psn_info.Brdy
  4985. // Age = psn_info.Age
  4986. // infoStr = psn_info.Insuinfo
  4987. // idetinfoStr = psn_info.Idetinfo
  4988. // infocode = 0
  4989. // verify_number = psn_info.VerifyNumber
  4990. //
  4991. // } else {
  4992. // var result string
  4993. // var requestLog string
  4994. // if miConfig.UserOrgId == 10138 {
  4995. // 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)
  4996. // } else {
  4997. // 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)
  4998. // }
  4999. // saveLog(result, requestLog, "1101", "人员基本信息获取")
  5000. // if miConfig.Code == "H15049901371" {
  5001. //
  5002. // if err := json.Unmarshal([]byte(result), &res10265); err != nil {
  5003. // utils.ErrorLog("解析失败:%v", err)
  5004. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  5005. // return
  5006. // }
  5007. // res.ErrMsg = res10265.ErrMsg
  5008. // //res.Output = res10265.Output
  5009. // res.InfRefmsgid = res10265.InfRefmsgid
  5010. //
  5011. // } else {
  5012. // if err := json.Unmarshal([]byte(result), &res); err != nil {
  5013. // utils.ErrorLog("解析失败:%v", err)
  5014. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  5015. // return
  5016. // }
  5017. // }
  5018. //
  5019. // PsnNo = res.Output[0].Baseinfo.PsnNo
  5020. // PsnCertType = res.Output[0].Baseinfo.PsnCertType
  5021. // Certno = res.Output[0].Baseinfo.Certno
  5022. // PsnName = res.Output[0].Baseinfo.PsnName
  5023. // Gend = res.Output[0].Baseinfo.Gend
  5024. // Naty = res.Output[0].Baseinfo.Naty
  5025. // Brdy = res.Output[0].Baseinfo.Brdy
  5026. // Age = res.Output[0].Baseinfo.Age
  5027. // Iinfos, _ := json.Marshal(res.Output[0].Iinfo)
  5028. // Idetinfos, _ := json.Marshal(res.Output[0].Idetinfo)
  5029. // infoStr = string(Iinfos)
  5030. // idetinfoStr = string(Idetinfos)
  5031. // if miConfig.Code == "H15049901371" {
  5032. // infocode, _ = strconv.ParseInt(res10265.Infcode, 10, 64)
  5033. // } else {
  5034. // infocode = res.Infcode
  5035. // }
  5036. // }
  5037. // if infocode == 0 {
  5038. // his := models.VMHisPatient{
  5039. // Name: name,
  5040. // Gender: gender,
  5041. // Birthday: birthUnix,
  5042. // MedicalTreatmentType: medical_care,
  5043. // IdType: certificates,
  5044. // IdCardNo: id_card,
  5045. // BalanceAccountsType: settlementValue,
  5046. // SocialType: social_type,
  5047. // MedicalInsuranceNumber: medical_insurance_card,
  5048. // RegisterType: register_type,
  5049. // RegisterCost: registration_fee,
  5050. // TreatmentCost: medical_expenses,
  5051. // Status: 1,
  5052. // Ctime: time.Now().Unix(),
  5053. // Mtime: time.Now().Unix(),
  5054. // PsnNo: PsnNo,
  5055. // PsnCertType: PsnCertType,
  5056. // Certno: Certno,
  5057. // PsnName: PsnName,
  5058. // Gend: Gend,
  5059. // Naty: Naty,
  5060. // Brdy: Brdy,
  5061. // Age: Age,
  5062. // Iinfo: infoStr,
  5063. // Idetinfo: idetinfoStr,
  5064. // PatientId: patient.ID,
  5065. // RecordDate: theTime.Unix(),
  5066. // UserOrgId: adminInfo.CurrentOrgId,
  5067. // AdminUserId: admin_user_id,
  5068. // IsReturn: 1,
  5069. // IdCardType: id_card_type,
  5070. // Doctor: doctor,
  5071. // Departments: department,
  5072. // }
  5073. //
  5074. // timestamp := time.Now().Unix()
  5075. // tempTime := time.Unix(timestamp, 0)
  5076. // timeFormat := tempTime.Format("20060102150405")
  5077. // chrgBchno := rand.Intn(100000) + 10000
  5078. // ipt_otp_no := timeFormat + strconv.FormatInt(int64(chrgBchno), 10) + strconv.FormatInt(his.PatientId, 10)
  5079. // //count, _ := service.FindHisRegisterRecord(theTime.Unix(), patient.ID, adminInfo.CurrentOrgId)
  5080. // department, _ := service.GetDepartMentDetail(department)
  5081. // doctor_id := strconv.FormatInt(patientPrescription.DoctorId, 10)
  5082. //
  5083. // IdCardNo := ""
  5084. // if id_card_type == 1 {
  5085. // // IdCardNo = medical_insurance_card
  5086. // IdCardNo = patient.IdCardNo
  5087. // } else {
  5088. // IdCardNo = patient.IdCardNo
  5089. // }
  5090. //
  5091. // var rf []*ResultFive
  5092. // json.Unmarshal([]byte(his.Iinfo), &rf)
  5093. // var insutypes []*ResultFive
  5094. // var insutype string
  5095. // var insuplc_admdvs_temp string
  5096. // var is390 int = 0
  5097. // var is310 int = 0
  5098. //
  5099. // for _, item := range rf {
  5100. // if (item.Insutype == "390" && item.PsnInsuStas == "1") || (item.Insutype == "310" && item.PsnInsuStas == "1") {
  5101. // insutypes = append(insutypes, item)
  5102. // }
  5103. // }
  5104. //
  5105. // if len(insutypes) == 1 {
  5106. // insutype = insutypes[0].Insutype
  5107. // //insuplc_admdvs = insutypes[0].InsuplcAdmdvs
  5108. // } else {
  5109. // for _, i := range insutypes {
  5110. // if i.Insutype == "390" {
  5111. // is390 = 1
  5112. // }
  5113. //
  5114. // if i.Insutype == "310" {
  5115. // is310 = 1
  5116. // }
  5117. // }
  5118. // }
  5119. // if is390 == 1 {
  5120. // insutype = "390"
  5121. // }
  5122. //
  5123. // if is310 == 1 {
  5124. // insutype = "310"
  5125. // }
  5126. //
  5127. // if len(insutypes) == 0 {
  5128. // insutype = "310"
  5129. // }
  5130. //
  5131. // if len(insutypes) == 2 {
  5132. // insutype = med_type
  5133. // }
  5134. //
  5135. // if len(med_type) > 0 {
  5136. //
  5137. // insutype = med_type
  5138. // }
  5139. //
  5140. // //for _, item := range rf {
  5141. // // if item.Insutype == insutype {
  5142. // // insuplc_admdvs = item.InsuplcAdmdvs
  5143. // // }
  5144. // //}
  5145. // var infocode int64
  5146. // var resThree ResultThree
  5147. // var resThree10265 ResultThree10265
  5148. //
  5149. // if len(insuplc_admdvs) == 0 {
  5150. // insuplc_admdvs_temp = miConfig.InsuplcAdmdvs
  5151. // } else {
  5152. //
  5153. // insuplc_admdvs_temp = insuplc_admdvs
  5154. //
  5155. // }
  5156. //
  5157. // if miConfig.MdtrtareaAdmvs == "421300" {
  5158. // api := "http://192.168.124.4:9532/" + "hbyb/2201?psn_no=" + PsnNo + "&insutype=" + insutype + "&cert_no=" + Certno + "&ipt_otp_no=" + ipt_otp_no +
  5159. // "&org_name=" + miConfig.OrgName + "&doctor=" + doctor_info.UserName + "&fixmedins_code=" + miConfig.Code +
  5160. // "&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
  5161. // resp, requestErr := http.Get(api)
  5162. // if requestErr != nil {
  5163. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  5164. // return
  5165. // }
  5166. //
  5167. // body, ioErr := ioutil.ReadAll(resp.Body)
  5168. // if ioErr != nil {
  5169. // utils.ErrorLog("接口返回数据读取失败: %v", ioErr)
  5170. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  5171. // return
  5172. // }
  5173. // var respJSON map[string]interface{}
  5174. // if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
  5175. // utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
  5176. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  5177. // return
  5178. // }
  5179. //
  5180. // respJSON = respJSON["data"].(map[string]interface{})["pre"].(map[string]interface{})
  5181. // result, _ := json.Marshal(respJSON)
  5182. //
  5183. // if err := json.Unmarshal([]byte(result), &resThree); err != nil {
  5184. // utils.ErrorLog("解析失败:%v", err)
  5185. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  5186. // return
  5187. // }
  5188. // infocode = resThree.Infcode
  5189. //
  5190. // } else if miConfig.MdtrtareaAdmvs == "320921" || miConfig.MdtrtareaAdmvs == "320982" {
  5191. // psn_info, _ := service.GetPsnByPatientId(id)
  5192. //
  5193. // psn_info.VerifyNumber = strings.Replace(psn_info.VerifyNumber, "+", "%2B", -1)
  5194. // var cert_no string
  5195. // if id_card_type == 3 {
  5196. // psn_info.VerifyNumber = IdCardNo + "|" + psn_info.VerifyNumber
  5197. // cert_no = IdCardNo
  5198. // } else if id_card_type == 4 {
  5199. // cert_no = IdCardNo
  5200. // psn_info.VerifyNumber = psn_info.VerifyNumber
  5201. // } else {
  5202. //
  5203. // bas := strings.Split(psn_info.CardInfo, "|")
  5204. // cert_no = bas[2]
  5205. // }
  5206. //
  5207. // var api string
  5208. // if miConfig.MdtrtareaAdmvs == "320921" {
  5209. //
  5210. // api = "http://192.168.2.110:9532/" + "jsyb/2201?psn_no=" + PsnNo + "&insutype=" + insutype + "&cert_no=" + cert_no + "&ipt_otp_no=" + ipt_otp_no +
  5211. // "&org_name=" + miConfig.OrgName + "&doctor=" + roles.UserName + "&doctor_name=" + doctor_info.UserName + "&fixmedins_code=" + miConfig.Code +
  5212. // "&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
  5213. //
  5214. // } else {
  5215. // api = "http://192.168.5.251:9532/" + "jsyb/2201?psn_no=" + PsnNo + "&insutype=" + insutype + "&cert_no=" + cert_no + "&ipt_otp_no=" + ipt_otp_no +
  5216. // "&org_name=" + miConfig.OrgName + "&doctor=" + roles.UserName + "&doctor_name=" + doctor_info.UserName + "&fixmedins_code=" + miConfig.Code +
  5217. // "&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
  5218. //
  5219. // }
  5220. //
  5221. // resp, requestErr := http.Get(api)
  5222. // if requestErr != nil {
  5223. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  5224. // return
  5225. // }
  5226. //
  5227. // body, ioErr := ioutil.ReadAll(resp.Body)
  5228. //
  5229. // if ioErr != nil {
  5230. // utils.ErrorLog("接口返回数据读取失败: %v", ioErr)
  5231. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  5232. // return
  5233. // }
  5234. //
  5235. // var respJSON map[string]interface{}
  5236. //
  5237. // if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
  5238. // utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
  5239. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  5240. // return
  5241. // }
  5242. //
  5243. // respJSON = respJSON["data"].(map[string]interface{})["pre"].(map[string]interface{})
  5244. //
  5245. // result, _ := json.Marshal(respJSON)
  5246. //
  5247. // if err := json.Unmarshal([]byte(result), &resThree10265); err != nil {
  5248. // utils.ErrorLog("解析失败:%v", err)
  5249. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  5250. // return
  5251. // }
  5252. //
  5253. // resThree.ErrMsg = resThree10265.ErrMsg
  5254. //
  5255. // resThree.Output = resThree10265.Output
  5256. //
  5257. // resThree.InfRefmsgid = resThree10265.InfRefmsgid
  5258. //
  5259. // infocode, _ = strconv.ParseInt(resThree10265.Infcode, 10, 64)
  5260. // } else {
  5261. // result, requestLog := service.Gdyb2201A(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)
  5262. // saveLog(result, requestLog, "2201A", "挂号")
  5263. // if miConfig.Code == "H15049901371" {
  5264. //
  5265. // if err := json.Unmarshal([]byte(result), &resThree10265); err != nil {
  5266. // utils.ErrorLog("解析失败:%v", err)
  5267. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  5268. // return
  5269. // }
  5270. // resThree.ErrMsg = resThree10265.ErrMsg
  5271. // resThree.Output = resThree10265.Output
  5272. // resThree.InfRefmsgid = resThree10265.InfRefmsgid
  5273. // } else {
  5274. // if err := json.Unmarshal([]byte(result), &resThree); err != nil {
  5275. // utils.ErrorLog("解析失败:%v", err)
  5276. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  5277. // return
  5278. // }
  5279. // }
  5280. //
  5281. // if miConfig.Code == "H15049901371" {
  5282. // infocode, _ = strconv.ParseInt(resThree10265.Infcode, 10, 64)
  5283. // } else {
  5284. // infocode = resThree.Infcode
  5285. //
  5286. // }
  5287. //
  5288. // }
  5289. //
  5290. // if infocode != 0 {
  5291. //
  5292. // adminUser := c.GetAdminUserInfo()
  5293. // errlog := &models.HisOrderError{
  5294. // UserOrgId: adminUser.CurrentOrgId,
  5295. // Ctime: time.Now().Unix(),
  5296. // Mtime: time.Now().Unix(),
  5297. // ErrMsg: resThree.ErrMsg,
  5298. // Status: 1,
  5299. // PatientId: id,
  5300. // RecordTime: recordDateTime,
  5301. // Stage: 2,
  5302. // }
  5303. // service.CreateErrMsgLog(errlog)
  5304. // c.ServeSuccessJSON(map[string]interface{}{
  5305. // "failed_code": -10,
  5306. // "msg": resThree.ErrMsg,
  5307. // })
  5308. // return
  5309. // }
  5310. //
  5311. // his.Number = resThree.Output.Data.MdtrtID
  5312. // his.PsnNo = resThree.Output.Data.PsnNo
  5313. // his.IptOtpNo = resThree.Output.Data.IptOtpNo
  5314. // his.IdCardNo = patient.IdCardNo
  5315. // his.PhoneNumber = patient.Phone
  5316. // his.UserOrgId = adminInfo.CurrentOrgId
  5317. // his.Insutype = insutype
  5318. // his.Ctime = time.Now().Unix()
  5319. // his.Mtime = time.Now().Unix()
  5320. // his.InsuplcAdmdvs = insuplc_admdvs_temp
  5321. // his.Status = 1
  5322. // service.UpdateHisPatientStatus(&his)
  5323. // service.UpdateHisPrescriptionHisID(his.ID, patient.ID, recordDateTime, adminInfo.CurrentOrgId)
  5324. //
  5325. // c.ServeSuccessJSON(map[string]interface{}{
  5326. // "his_info": his,
  5327. // })
  5328. //
  5329. // } else {
  5330. // adminUser := c.GetAdminUserInfo()
  5331. // errlog := &models.HisOrderError{
  5332. // UserOrgId: adminUser.CurrentOrgId,
  5333. // Ctime: time.Now().Unix(),
  5334. // Mtime: time.Now().Unix(),
  5335. // ErrMsg: res.ErrMsg,
  5336. // Status: 1,
  5337. // PatientId: id,
  5338. // RecordTime: recordDateTime,
  5339. // Stage: 1,
  5340. // }
  5341. // service.CreateErrMsgLog(errlog)
  5342. //
  5343. // c.ServeSuccessJSON(map[string]interface{}{
  5344. // "failed_code": -10,
  5345. // "msg": res.ErrMsg,
  5346. // })
  5347. // return
  5348. //
  5349. // //c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeGdybOneException)
  5350. // }
  5351. // }
  5352. //}
  5353. //
  5354. ////上传明细----预结算----确认订单
  5355. //func (c *HisApiController) GetUploadInfo() {
  5356. // id, _ := c.GetInt64("id")
  5357. // record_time := c.GetString("record_time")
  5358. // his_patient_id, _ := c.GetInt64("his_patient_id")
  5359. //
  5360. // order_id, _ := c.GetInt64("order_id")
  5361. //
  5362. // pay_way, _ := c.GetInt64("pay_way")
  5363. // pay_price, _ := c.GetFloat("pay_price")
  5364. // pay_card_no := c.GetString("pay_card_no")
  5365. // token := c.GetString("token")
  5366. //
  5367. // discount_price, _ := c.GetFloat("discount_price")
  5368. // preferential_price, _ := c.GetFloat("preferential_price")
  5369. // reality_price, _ := c.GetFloat("reality_price")
  5370. // found_price, _ := c.GetFloat("found_price")
  5371. // medical_insurance_price, _ := c.GetFloat("medical_insurance_price")
  5372. // private_price, _ := c.GetFloat("private_price")
  5373. // settle_accounts_type, _ := c.GetInt64("settle_accounts_type")
  5374. // admin_user_id, _ := c.GetInt64("admin_user_id")
  5375. //
  5376. // fapiao_code := c.GetString("fapiao_code")
  5377. // fapiao_number := c.GetString("fapiao_number")
  5378. //
  5379. // diagnosis_id := c.GetString("diagnosis")
  5380. // sick_type, _ := c.GetInt64("sick_type")
  5381. // reg_type, _ := c.GetInt64("p_type")
  5382. // begin_time := c.GetString("begin_time")
  5383. //
  5384. // id_str := c.GetString("ids")
  5385. // ids_arr := strings.Split(id_str, ",")
  5386. //
  5387. // timeLayout := "2006-01-02"
  5388. // loc, _ := time.LoadLocation("Local")
  5389. // theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", record_time+" 00:00:00", loc)
  5390. // if err != nil {
  5391. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
  5392. // return
  5393. // }
  5394. // recordDateTime := theTime.Unix()
  5395. // adminUser := c.GetAdminUserInfo()
  5396. // var tempOrder models.HisOrder
  5397. // tempOrder, _ = service.GetHisOrderByID(order_id)
  5398. //
  5399. // var prescriptions []*models.HisPrescription
  5400. //
  5401. // var start_time int64
  5402. // var end_time int64
  5403. //
  5404. // //押金模块
  5405. // dec_way := c.GetString("dec_way") //是否使用押金支付bool类型
  5406. // tmp_decimal := c.GetString("tmp_decimal")
  5407. // var decimal float64 //本次使用的押金
  5408. // var errmsg error
  5409. //
  5410. // if dec_way == "true" && tmp_decimal == "0" || dec_way == "true" && tmp_decimal == "" {
  5411. // c.ServeFailJsonSend(enums.ErrorCodeParamWrong, "押金不能为0")
  5412. // return
  5413. // }
  5414. // if len(tmp_decimal) > 0 {
  5415. // if tmp_decimal[0] == 45 {
  5416. // c.ServeFailJsonSend(enums.ErrorCodeParamWrong, "押金不能为负数")
  5417. // return
  5418. // }
  5419. // }
  5420. // tt, errs := strconv.ParseFloat(tmp_decimal, 64)
  5421. // fmt.Println(errs)
  5422. // decimal = tt
  5423. //
  5424. // //if adminUser.CurrentOrgId == 10106{
  5425. // // if len(fapiao_code) == 0{
  5426. // // fapiao_code = "144072080589"
  5427. // // }
  5428. // // if len(fapiao_number) == 0{
  5429. // // order, _ := service.GetLastHisOrder(adminUser.CurrentOrgId)
  5430. // // if order.ID == 0{
  5431. // // fapiao_number = "00001520"
  5432. // // }else{
  5433. // // //fapiao_code = "00001520"
  5434. // // fpNumber, _ := strconv.Atoi(order.FaPiaoNumber)
  5435. // // var zero string
  5436. // // if fpNumber >= 1000{
  5437. // // zero = "0000" + strconv.Itoa(fpNumber)
  5438. // // }else if fpNumber >= 10000{
  5439. // // zero = "000" + strconv.Itoa(fpNumber)
  5440. // // } else if fpNumber >= 100000{
  5441. // // zero = "00" + strconv.Itoa(fpNumber)
  5442. // // } else if fpNumber >= 1000000{
  5443. // // zero = "0" + strconv.Itoa(fpNumber)
  5444. // // }else {
  5445. // // zero = strconv.Itoa(fpNumber)
  5446. // // }
  5447. // // fapiao_number = zero
  5448. // // }
  5449. // // }
  5450. // //}
  5451. //
  5452. // roles, _ := service.GetAdminUserInfoByID(adminUser.CurrentOrgId, admin_user_id)
  5453. // his, _ := service.GetNewHisPatientInfo(adminUser.CurrentOrgId, his_patient_id, recordDateTime)
  5454. // var patientPrescription models.HisPrescriptionInfo
  5455. // patientPrescription, _ = service.FindHisPatientPrescriptionInfo(adminUser.CurrentOrgId, his_patient_id, recordDateTime)
  5456. // if patientPrescription.ID == 0 {
  5457. // patientPrescription, _ = service.FindLastPatientPrescriptionInfo(adminUser.CurrentOrgId, id, recordDateTime)
  5458. // }
  5459. // miConfig, _ := service.FindMedicalInsuranceInfo(adminUser.CurrentOrgId)
  5460. // department, _ := service.GetDepartMentDetail(patientPrescription.Departments)
  5461. //
  5462. // doctor_info, _ := service.GetAdminUserInfoByID(adminUser.CurrentOrgId, patientPrescription.DoctorId)
  5463. //
  5464. // diagnosis_ids := strings.Split(diagnosis_id, ",")
  5465. //
  5466. // var config []*models.HisXtDiagnoseConfig
  5467. // for _, item := range diagnosis_ids {
  5468. // id, _ := strconv.ParseInt(item, 10, 64)
  5469. // diagnosisConfig, _ := service.FindDiagnoseById(id)
  5470. // config = append(config, &diagnosisConfig)
  5471. // }
  5472. //
  5473. // sickConfig, _ := service.FindSickById(sick_type)
  5474. //
  5475. // //if tempOrder.ID == 0 {
  5476. // // tempOrder, _ = service.GetTodayHisOrder(adminUser.CurrentOrgId, id, recordDateTime, his.Number)
  5477. // //}
  5478. //
  5479. // if tempOrder.ID == 0 {
  5480. // var result string
  5481. // var requestLog string
  5482. // var res2 ResultSix
  5483. // var ressix10265 ResultSix10265
  5484. //
  5485. // if miConfig.MdtrtareaAdmvs == "421300" {
  5486. //
  5487. // data := make(map[string]interface{})
  5488. // client := &http.Client{}
  5489. // data["psn_no"] = his.PsnNo
  5490. // data["mdtrt_id"] = his.Number
  5491. // data["doctor"] = roles.UserName
  5492. // data["department"] = department.Name
  5493. // data["org_name"] = miConfig.OrgName
  5494. // data["med_type"] = strconv.FormatInt(reg_type, 10)
  5495. // data["doctor_id"] = strconv.FormatInt(doctor_info.AdminUserId, 10)
  5496. // data["fixmedins_code"] = miConfig.Code
  5497. // data["insuplc_admdvs"] = his.InsuplcAdmdvs
  5498. // data["mdtrtarea_admvs"] = miConfig.MdtrtareaAdmvs
  5499. // data["secret_key"] = miConfig.SecretKey
  5500. // data["sick_code"] = sickConfig.CountryCode
  5501. // data["sick_name"] = sickConfig.ClassName
  5502. // data["dept"] = strconv.FormatInt(department.ID, 10)
  5503. // data["config"] = config
  5504. // data["begin_time"] = begin_time
  5505. //
  5506. // bytesData, _ := json.Marshal(data)
  5507. // req, _ := http.NewRequest("POST", "http://192.168.124.4:9532/"+"hbyb/2203", bytes.NewReader(bytesData))
  5508. // resp, _ := client.Do(req)
  5509. // defer resp.Body.Close()
  5510. // body, ioErr := ioutil.ReadAll(resp.Body)
  5511. // if ioErr != nil {
  5512. // utils.ErrorLog("接口返回数据读取失败: %v", ioErr)
  5513. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  5514. // return
  5515. // }
  5516. // var respJSON map[string]interface{}
  5517. // if err := json.Unmarshal([]byte(body), &respJSON); err != nil {
  5518. // utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
  5519. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  5520. // return
  5521. // }
  5522. //
  5523. // respJSON = respJSON["data"].(map[string]interface{})["pre"].(map[string]interface{})
  5524. // userJSONBytes, _ := json.Marshal(respJSON)
  5525. // fmt.Println("log")
  5526. // fmt.Println(string(userJSONBytes))
  5527. //
  5528. // if err := json.Unmarshal(userJSONBytes, &res2); err != nil {
  5529. // utils.ErrorLog("解析失败:%v", err)
  5530. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  5531. // return
  5532. // }
  5533. //
  5534. // } else if miConfig.MdtrtareaAdmvs == "320921" || miConfig.MdtrtareaAdmvs == "320982" {
  5535. //
  5536. // //江苏地区国家医保医疗类别
  5537. // //职工透析:医疗类别选特殊情况门诊9933
  5538. // //居民血透门慢: 医疗类别选门诊慢病1402
  5539. // //var med_type string
  5540. // //if his.Insutype == "310" {
  5541. // // if reg_type == 14 {
  5542. // // med_type = "9933"
  5543. // // } else if reg_type == 11 {
  5544. // // med_type = "11"
  5545. // //
  5546. // // }
  5547. // //} else if his.Insutype == "390" {
  5548. // // if reg_type == 14 {
  5549. // // med_type = "1402"
  5550. // // } else if reg_type == 11 {
  5551. // // med_type = "11"
  5552. // // }
  5553. // //}
  5554. //
  5555. // data := make(map[string]interface{})
  5556. // client := &http.Client{}
  5557. // data["psn_no"] = his.PsnNo
  5558. // data["mdtrt_id"] = his.Number
  5559. // data["doctor"] = roles.UserName
  5560. // data["department"] = department.Name
  5561. // data["org_name"] = miConfig.OrgName
  5562. // data["med_type"] = strconv.FormatInt(reg_type, 10)
  5563. // data["doctor_id"] = strconv.FormatInt(doctor_info.AdminUserId, 10)
  5564. // data["fixmedins_code"] = miConfig.Code
  5565. // data["insuplc_admdvs"] = his.InsuplcAdmdvs
  5566. // data["mdtrtarea_admvs"] = miConfig.MdtrtareaAdmvs
  5567. // data["secret_key"] = miConfig.SecretKey
  5568. // data["sick_code"] = sickConfig.CountryCode
  5569. // data["sick_name"] = sickConfig.ClassName
  5570. // data["url"] = miConfig.Url
  5571. // data["ak"] = miConfig.AccessKey
  5572. // data["begin_time"] = begin_time
  5573. // data["cainfo"] = miConfig.Cainfo
  5574. //
  5575. // data["dept"] = strconv.FormatInt(department.ID, 10)
  5576. // data["config"] = config
  5577. // bytesData, _ := json.Marshal(data)
  5578. //
  5579. // var req *http.Request
  5580. // if miConfig.MdtrtareaAdmvs == "320921" {
  5581. // req, _ = http.NewRequest("POST", "http://192.168.2.110:9532/"+"jsyb/2203", bytes.NewReader(bytesData))
  5582. //
  5583. // //api = "http://192.168.2.110:9532/" + "jsyb/readcard?" + "fixmedins_code=" + miConfig.Code + "&secret_key=" + miConfig.SecretKey + "&ak=" + miConfig.AccessKey + "&org_name=" + miConfig.OrgName + "&doctor=" + roles.UserName +
  5584. // // "&insuplc_admdvs=" + miConfig.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey + "&url=" + miConfig.Url + "&cainfo=" + miConfig.Cainfo
  5585. //
  5586. // } else {
  5587. // req, _ = http.NewRequest("POST", "http://192.168.5.251:9532/"+"jsyb/2203", bytes.NewReader(bytesData))
  5588. //
  5589. // }
  5590. //
  5591. // resp, _ := client.Do(req)
  5592. // defer resp.Body.Close()
  5593. // body, ioErr := ioutil.ReadAll(resp.Body)
  5594. // if ioErr != nil {
  5595. // utils.ErrorLog("接口返回数据读取失败: %v", ioErr)
  5596. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  5597. // return
  5598. // }
  5599. // var respJSON map[string]interface{}
  5600. // if err := json.Unmarshal([]byte(body), &respJSON); err != nil {
  5601. // utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
  5602. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  5603. // return
  5604. // }
  5605. //
  5606. // respJSON = respJSON["data"].(map[string]interface{})["pre"].(map[string]interface{})
  5607. // userJSONBytes, _ := json.Marshal(respJSON)
  5608. // fmt.Println("log")
  5609. // fmt.Println(string(userJSONBytes))
  5610. //
  5611. // if err := json.Unmarshal(userJSONBytes, &ressix10265); err != nil {
  5612. // utils.ErrorLog("解析失败:%v", err)
  5613. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  5614. // return
  5615. // }
  5616. // res2.InfRefmsgid = ressix10265.InfRefmsgid
  5617. // res2.Output = ressix10265.Output
  5618. // res2.ErrMsg = ressix10265.ErrMsg
  5619. // res2.Cainfo = ressix10265.Cainfo
  5620. // res2.WarnMsg = ressix10265.WarnMsg
  5621. // infocode, _ := strconv.ParseInt(ressix10265.Infcode, 10, 64)
  5622. // res2.Infcode = infocode
  5623. //
  5624. // } else {
  5625. // if miConfig.MdtrtareaAdmvs == "440781" { //
  5626. // 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, his.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, sickConfig.ContentCode, sickConfig.ClassName, roles.UserName, config, begin_time)
  5627. // } else {
  5628. // if miConfig.Code == "H15049901371" {
  5629. // //赤峰地区国家医保医疗类别
  5630. // //职工透析:医疗类别选特殊情况门诊990502
  5631. // //居民定额血透门慢: 医疗类别选门诊慢病140104
  5632. // var med_type string
  5633. // if his.Insutype == "390" {
  5634. // if reg_type == 14 {
  5635. // med_type = "9933"
  5636. // } else if reg_type == 11 {
  5637. // med_type = "11"
  5638. //
  5639. // }
  5640. // } else if his.Insutype == "310" {
  5641. // if reg_type == 14 {
  5642. // med_type = "990502"
  5643. // } else if reg_type == 11 {
  5644. // med_type = "11"
  5645. // }
  5646. // }
  5647. // result, requestLog = service.Gdyb2203A(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)
  5648. //
  5649. // } else {
  5650. // result, requestLog = service.Gdyb2203(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)
  5651. //
  5652. // }
  5653. // }
  5654. //
  5655. // saveLog(result, requestLog, "2203", "上传就诊信息")
  5656. // var respJSON2 map[string]interface{}
  5657. // if err := json.Unmarshal([]byte(string(result)), &respJSON2); err != nil {
  5658. // utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
  5659. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  5660. // return
  5661. // }
  5662. // userJSONBytes2, _ := json.Marshal(respJSON2)
  5663. // if miConfig.Code == "H15049901371" {
  5664. // if err := json.Unmarshal(userJSONBytes2, &ressix10265); err != nil {
  5665. // utils.ErrorLog("解析失败:%v", err)
  5666. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  5667. // return
  5668. // }
  5669. // res2.InfRefmsgid = ressix10265.InfRefmsgid
  5670. // res2.Output = ressix10265.Output
  5671. // res2.ErrMsg = ressix10265.ErrMsg
  5672. // res2.Cainfo = ressix10265.Cainfo
  5673. // res2.WarnMsg = ressix10265.WarnMsg
  5674. // infocode, _ := strconv.ParseInt(ressix10265.Infcode, 10, 64)
  5675. // res2.Infcode = infocode
  5676. // } else {
  5677. // if err := json.Unmarshal(userJSONBytes2, &res2); err != nil {
  5678. // utils.ErrorLog("解析失败:%v", err)
  5679. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  5680. // return
  5681. // }
  5682. // }
  5683. // }
  5684. //
  5685. // if res2.Infcode != 0 {
  5686. // adminUser := c.GetAdminUserInfo()
  5687. // errlog := &models.HisOrderError{
  5688. // UserOrgId: adminUser.CurrentOrgId,
  5689. // Ctime: time.Now().Unix(),
  5690. // Mtime: time.Now().Unix(),
  5691. // ErrMsg: res2.ErrMsg,
  5692. // Status: 1,
  5693. // PatientId: id,
  5694. // RecordTime: recordDateTime,
  5695. // Stage: 3,
  5696. // }
  5697. // service.CreateErrMsgLog(errlog)
  5698. // c.ServeSuccessJSON(map[string]interface{}{
  5699. // "failed_code": -10,
  5700. // "msg": res2.ErrMsg,
  5701. // })
  5702. // return
  5703. //
  5704. // } else {
  5705. // his.Diagnosis = diagnosis_id
  5706. // his.SickType = sickConfig.ID
  5707. // //var p_type int64
  5708. // //if reg_type == 1111 || reg_type == 1112 {
  5709. // // p_type = 11
  5710. // //
  5711. // //}
  5712. // his.PType = fmt.Sprintf("%d", reg_type)
  5713. // service.UpdateHisPatientThree(&his)
  5714. //
  5715. // data := make(map[string]interface{})
  5716. // if settle_accounts_type == 1 { //日结
  5717. //
  5718. // if reg_type == 11 || reg_type == 1111 || reg_type == 1112 {
  5719. // prescriptions, _ = service.GetPrescriptionByIds(ids_arr, adminUser.CurrentOrgId)
  5720. // } else {
  5721. // prescriptions, _ = service.GetNewHisPrescription(adminUser.CurrentOrgId, his_patient_id, recordDateTime, strconv.Itoa(int(reg_type)))
  5722. // }
  5723. // //prescriptions, _ = service.GetNewHisPrescriptionTwo(adminUser.CurrentOrgId, his_patient_id, recordDateTime, reg_type)
  5724. // data["pre"] = prescriptions
  5725. //
  5726. // } else { //月结
  5727. // start_time_str := c.GetString("start_time")
  5728. // end_time_str := c.GetString("end_time")
  5729. // timeLayout := "2006-01-02"
  5730. // loc, _ := time.LoadLocation("Local")
  5731. // theStartTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time_str+" 00:00:00", loc)
  5732. // if err != nil {
  5733. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
  5734. // return
  5735. // }
  5736. // recordStartTime := theStartTime.Unix()
  5737. // start_time = recordStartTime
  5738. // theEndTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time_str+" 00:00:00", loc)
  5739. // if err != nil {
  5740. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
  5741. // return
  5742. // }
  5743. // recordEndTime := theEndTime.Unix()
  5744. // end_time = recordEndTime
  5745. // prescriptions, _ = service.GetMonthHisPrescriptionTwo(adminUser.CurrentOrgId, id, recordStartTime, recordEndTime, reg_type)
  5746. // data["pre"] = prescriptions
  5747. //
  5748. // }
  5749. //
  5750. // timestamp := time.Now().Unix()
  5751. // tempTime := time.Unix(timestamp, 0)
  5752. // timeFormat := tempTime.Format("20060102150405")
  5753. // chrgBchno := rand.Intn(100000) + 10000
  5754. // chrg_bchno := timeFormat + strconv.FormatInt(int64(chrgBchno), 10) + strconv.FormatInt(his.PatientId, 10)
  5755. // strconv.FormatInt(his.PatientId, 10)
  5756. // client := &http.Client{}
  5757. //
  5758. // data["psn_no"] = his.PsnNo
  5759. // data["mdtrt_id"] = his.Number
  5760. // data["chrg_bchno"] = chrg_bchno
  5761. // data["org_name"] = miConfig.OrgName
  5762. // data["doctor"] = roles.UserName
  5763. // data["doctor_id"] = strconv.FormatInt(roles.AdminUserId, 10)
  5764. // data["dept"] = strconv.FormatInt(patientPrescription.Departments, 10)
  5765. // data["fixmedins_code"] = miConfig.Code
  5766. // //if (department.ID == 0 && adminUser.CurrentOrgId == 9919) || (department.ID == 0 && adminUser.CurrentOrgId == 10106) {
  5767. // // data["dept_code"] = "15"
  5768. // //} else {
  5769. // data["dept_code"] = department.Number
  5770. // //}
  5771. // data["insuplc_admdvs"] = his.InsuplcAdmdvs
  5772. // data["mdtrtarea_admvs"] = miConfig.MdtrtareaAdmvs
  5773. // data["secret_key"] = miConfig.SecretKey
  5774. // data["balance_accounts_type"] = strconv.FormatInt(his.BalanceAccountsType, 10)
  5775. // data["url"] = miConfig.Url
  5776. // data["ak"] = miConfig.AccessKey
  5777. // data["new_doctor_name"] = patientPrescription.Doctor
  5778. // data["diag_code"] = sickConfig.CountryCode
  5779. // data["cainfo"] = miConfig.Cainfo
  5780. //
  5781. // var ids []int64
  5782. //
  5783. // for _, item := range prescriptions {
  5784. // ids = append(ids, item.ID)
  5785. // }
  5786. // config, _ := service.GetMedicalInsuranceConfig(adminUser.CurrentOrgId)
  5787. // if config.IsOpen == 1 { //对接了医保,走医保流程
  5788. // var res ResultFour
  5789. // var resFour10265 ResultFour10265
  5790. //
  5791. // if miConfig.MdtrtareaAdmvs == "421300" {
  5792. //
  5793. // bytesData, _ := json.Marshal(data)
  5794. // req, _ := http.NewRequest("POST", "http://192.168.124.4:9532/"+"hbyb/2204", bytes.NewReader(bytesData))
  5795. // resp, _ := client.Do(req)
  5796. // defer resp.Body.Close()
  5797. // body, ioErr := ioutil.ReadAll(resp.Body)
  5798. // if ioErr != nil {
  5799. // utils.ErrorLog("接口返回数据读取失败: %v", ioErr)
  5800. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  5801. // return
  5802. // }
  5803. // var respJSON map[string]interface{}
  5804. // if err := json.Unmarshal([]byte(body), &respJSON); err != nil {
  5805. // utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
  5806. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  5807. // return
  5808. // }
  5809. //
  5810. // respJSON = respJSON["data"].(map[string]interface{})["pre"].(map[string]interface{})
  5811. // userJSONBytes, _ := json.Marshal(respJSON)
  5812. // fmt.Println("log")
  5813. // fmt.Println(string(userJSONBytes))
  5814. // if err := json.Unmarshal(userJSONBytes, &res); err != nil {
  5815. // utils.ErrorLog("解析失败:%v", err)
  5816. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  5817. // return
  5818. // }
  5819. //
  5820. // } else if miConfig.MdtrtareaAdmvs == "320921" || miConfig.MdtrtareaAdmvs == "320982" {
  5821. // bytesData, _ := json.Marshal(data)
  5822. //
  5823. // var req *http.Request
  5824. // if miConfig.MdtrtareaAdmvs == "320921" {
  5825. // req, _ = http.NewRequest("POST", "http://192.168.2.110:9532/"+"jsyb/2204", bytes.NewReader(bytesData))
  5826. //
  5827. // } else {
  5828. // req, _ = http.NewRequest("POST", "http://192.168.5.251:9532/"+"jsyb/2204", bytes.NewReader(bytesData))
  5829. // }
  5830. //
  5831. // resp, _ := client.Do(req)
  5832. // defer resp.Body.Close()
  5833. // body, ioErr := ioutil.ReadAll(resp.Body)
  5834. // if ioErr != nil {
  5835. // utils.ErrorLog("接口返回数据读取失败: %v", ioErr)
  5836. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  5837. // return
  5838. // }
  5839. // var respJSON map[string]interface{}
  5840. // if err := json.Unmarshal([]byte(body), &respJSON); err != nil {
  5841. // utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
  5842. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  5843. // return
  5844. // }
  5845. //
  5846. // respJSON = respJSON["data"].(map[string]interface{})["pre"].(map[string]interface{})
  5847. // userJSONBytes, _ := json.Marshal(respJSON)
  5848. // fmt.Println("log")
  5849. // fmt.Println(string(userJSONBytes))
  5850. // if err := json.Unmarshal(userJSONBytes, &resFour10265); err != nil {
  5851. // utils.ErrorLog("解析失败:%v", err)
  5852. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  5853. // return
  5854. // }
  5855. // res.InfRefmsgid = resFour10265.InfRefmsgid
  5856. // res.Output = resFour10265.Output
  5857. // res.ErrMsg = resFour10265.ErrMsg
  5858. // res.Cainfo = resFour10265.Cainfo
  5859. // res.WarnMsg = resFour10265.WarnMsg
  5860. // infocode, _ := strconv.ParseInt(resFour10265.Infcode, 10, 64)
  5861. // res.Infcode = infocode
  5862. //
  5863. // } else {
  5864. //
  5865. // if miConfig.Code == "H15049901371" {
  5866. // 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)
  5867. // var dat map[string]interface{}
  5868. // if err := json.Unmarshal([]byte(result), &dat); err == nil {
  5869. // fmt.Println(dat)
  5870. // } else {
  5871. // fmt.Println(err)
  5872. // }
  5873. // saveLog(result, request_log, "2204", "上传费用明细")
  5874. // userJSONBytes, _ := json.Marshal(dat)
  5875. //
  5876. // if err := json.Unmarshal(userJSONBytes, &resFour10265); err != nil {
  5877. // utils.ErrorLog("解析失败:%v", err)
  5878. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  5879. // return
  5880. // }
  5881. //
  5882. // res.InfRefmsgid = resFour10265.InfRefmsgid
  5883. // res.Output = resFour10265.Output
  5884. // res.ErrMsg = resFour10265.ErrMsg
  5885. // res.Cainfo = resFour10265.Cainfo
  5886. // res.WarnMsg = resFour10265.WarnMsg
  5887. // infocode, _ := strconv.ParseInt(resFour10265.Infcode, 10, 64)
  5888. // res.Infcode = infocode
  5889. //
  5890. // } else {
  5891. // 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)
  5892. // var dat map[string]interface{}
  5893. // if err := json.Unmarshal([]byte(result), &dat); err == nil {
  5894. // fmt.Println(dat)
  5895. // } else {
  5896. // fmt.Println(err)
  5897. // }
  5898. // saveLog(result, request_log, "2204", "上传费用明细")
  5899. // userJSONBytes, _ := json.Marshal(dat)
  5900. //
  5901. // if err := json.Unmarshal(userJSONBytes, &res); err != nil {
  5902. // utils.ErrorLog("解析失败:%v", err)
  5903. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  5904. // return
  5905. // }
  5906. //
  5907. // }
  5908. //
  5909. // }
  5910. //
  5911. // if res.Infcode == 0 {
  5912. // order := &models.HisOrder{
  5913. // UserOrgId: adminUser.CurrentOrgId,
  5914. // HisPatientId: his.ID,
  5915. // PatientId: his.PatientId,
  5916. // SettleAccountsDate: recordDateTime,
  5917. // MdtrtId: his.Number,
  5918. // PsnNo: his.PsnNo,
  5919. // MedType: strconv.FormatInt(reg_type, 10),
  5920. // Ctime: time.Now().Unix(),
  5921. // Mtime: time.Now().Unix(),
  5922. // Status: 1,
  5923. // Number: chrg_bchno,
  5924. // Infcode: res.Infcode,
  5925. // WarnMsg: res.WarnMsg,
  5926. // Cainfo: res.Cainfo,
  5927. // ErrMsg: res.ErrMsg,
  5928. // RespondTime: res.RefmsgTime,
  5929. // InfRefmsgid: res.InfRefmsgid,
  5930. // OrderStatus: 1,
  5931. // PayWay: pay_way,
  5932. // PayPrice: pay_price,
  5933. // PayCardNo: pay_card_no,
  5934. // DiscountPrice: discount_price,
  5935. // PreferentialPrice: preferential_price,
  5936. // RealityPrice: reality_price,
  5937. // FoundPrice: found_price,
  5938. // MedicalInsurancePrice: medical_insurance_price,
  5939. // PrivatePrice: private_price,
  5940. // IsMedicineInsurance: 1,
  5941. // SettleType: settle_accounts_type,
  5942. // SettleStartTime: start_time,
  5943. // SettleEndTime: end_time,
  5944. // Creator: roles.AdminUserId,
  5945. // Modify: roles.AdminUserId,
  5946. // FaPiaoNumber: fapiao_number,
  5947. // FaPiaoCode: fapiao_code,
  5948. // PType: 2,
  5949. // Diagnosis: diagnosis_id,
  5950. // }
  5951. // err = service.CreateOrder(order)
  5952. // if err != nil {
  5953. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCreatePreOrderException)
  5954. // return
  5955. // }
  5956. //
  5957. // for _, item := range res.Output.Result {
  5958. // temp := strings.Split(item.FeedetlSn, "-")
  5959. // var advice_id int64 = 0
  5960. // var project_id int64 = 0
  5961. // var types int64 = 0
  5962. //
  5963. // id, _ := strconv.ParseInt(temp[2], 10, 64)
  5964. // types, _ = strconv.ParseInt(temp[1], 10, 64)
  5965. //
  5966. // if temp[1] == "1" {
  5967. // advice_id = id
  5968. // project_id = 0
  5969. // } else if temp[1] == "2" {
  5970. // advice_id = 0
  5971. // project_id = id
  5972. // }
  5973. //
  5974. // info := &models.HisOrderInfo{
  5975. // OrderNumber: order.Number,
  5976. // FeedetlSn: item.FeedetlSn,
  5977. // UploadDate: time.Now().Unix(),
  5978. // AdviceId: advice_id,
  5979. // DetItemFeeSumamt: item.DetItemFeeSumamt,
  5980. // Cnt: item.Cnt,
  5981. // Pric: float64(item.Pric),
  5982. // PatientId: his.PatientId,
  5983. // PricUplmtAmt: item.PricUplmtAmt,
  5984. // SelfpayProp: item.SelfpayProp,
  5985. // FulamtOwnpayAmt: item.FulamtOwnpayAmt,
  5986. // OverlmtAmt: item.OverlmtAmt,
  5987. // PreselfpayAmt: item.PreselfpayAmt,
  5988. // BasMednFlag: item.BasMednFlag,
  5989. // MedChrgitmType: item.MedChrgitmType,
  5990. // HiNegoDrugFlag: item.HiNegoDrugFlag,
  5991. // Status: 1,
  5992. // Memo: item.Memo,
  5993. // Mtime: time.Now().Unix(),
  5994. // InscpScpAmt: item.InscpScpAmt,
  5995. // DrtReimFlag: item.DrtReimFlag,
  5996. // Ctime: time.Now().Unix(),
  5997. // ListSpItemFlag: item.ListSpItemFlag,
  5998. // ChldMedcFlag: item.ChldMedcFlag,
  5999. // LmtUsedFlag: item.LmtUsedFlag,
  6000. // ChrgitmLv: item.ChrgitmLv,
  6001. // UserOrgId: adminUser.CurrentOrgId,
  6002. // HisPatientId: his.ID,
  6003. // OrderId: order.ID,
  6004. // ProjectId: project_id,
  6005. // Type: types,
  6006. // }
  6007. // service.CreateOrderInfo(info)
  6008. //
  6009. // }
  6010. // service.UpDatePrescriptionNumber(adminUser.CurrentOrgId, ids, chrg_bchno)
  6011. // service.UpDateHisPrescriptionInfoNumber(adminUser.CurrentOrgId, his_patient_id, chrg_bchno, recordDateTime)
  6012. //
  6013. // var total float64
  6014. // for _, item := range prescriptions {
  6015. // if item.Type == 1 { //药品
  6016. // for _, subItem := range item.HisDoctorAdviceInfo {
  6017. // total = total + (subItem.Price * subItem.PrescribingNumber)
  6018. // }
  6019. // }
  6020. // if item.Type == 2 { //项目
  6021. // for _, subItem := range item.HisPrescriptionProject {
  6022. // cnt, _ := strconv.ParseFloat(subItem.Count, 64)
  6023. //
  6024. // total = total + (subItem.Price * cnt)
  6025. // }
  6026. // }
  6027. // }
  6028. //
  6029. // for _, item := range prescriptions {
  6030. // for _, subItem := range item.HisAdditionalCharge {
  6031. // total = total + (subItem.Price * float64(subItem.Count))
  6032. // }
  6033. // }
  6034. // var allTotal string
  6035. // if adminUser.CurrentOrgId == 9919 {
  6036. //
  6037. // allTotal = fmt.Sprintf("%.4f", total)
  6038. //
  6039. // } else {
  6040. //
  6041. // allTotal = fmt.Sprintf("%.4f", total)
  6042. //
  6043. // }
  6044. //
  6045. // if res.Infcode == 0 {
  6046. // var rf []*ResultFive
  6047. // json.Unmarshal([]byte(his.Iinfo), &rf)
  6048. // chrg_bchno := chrg_bchno
  6049. // cert_no := his.Certno
  6050. //
  6051. // var insutypes []string
  6052. //
  6053. // var insutype string
  6054. // var is390 int = 0
  6055. // var is310 int = 0
  6056. //
  6057. // for _, item := range rf {
  6058. // if (item.Insutype == "390" && item.PsnInsuStas == "1") || (item.Insutype == "310" && item.PsnInsuStas == "1") {
  6059. // insutypes = append(insutypes, item.Insutype)
  6060. // }
  6061. // }
  6062. //
  6063. // if len(insutypes) == 1 {
  6064. // insutype = insutypes[0]
  6065. // } else {
  6066. // for _, i := range insutypes {
  6067. // if i == "390" {
  6068. // is390 = 1
  6069. // }
  6070. //
  6071. // if i == "310" {
  6072. // is310 = 1
  6073. // }
  6074. // }
  6075. // }
  6076. // if is390 == 1 {
  6077. // insutype = "390"
  6078. // }
  6079. //
  6080. // if is310 == 1 {
  6081. // insutype = "310"
  6082. // }
  6083. //
  6084. // if len(insutypes) == 0 {
  6085. // insutype = "310"
  6086. // }
  6087. //
  6088. // if len(insutypes) == 2 {
  6089. // insutype = strconv.FormatInt(his.SocialType, 10)
  6090. // }
  6091. //
  6092. // insutype = strconv.FormatInt(his.SocialType, 10)
  6093. // //insutype = "390"
  6094. // if his.IdCardType == 1 {
  6095. // // cert_no = his.MedicalInsuranceNumber
  6096. // cert_no = his.Certno
  6097. //
  6098. // } else {
  6099. //
  6100. // cert_no = his.Certno
  6101. //
  6102. // }
  6103. // var res ResultSeven
  6104. // var resSeven10265 ResultSeven10265
  6105. //
  6106. // var src_resquest string
  6107. // var result2 string
  6108. // var acct_used_flag string
  6109. // fmt.Println("pay_way")
  6110. // fmt.Println(pay_way)
  6111. // fmt.Println("pay_way")
  6112. //
  6113. // if pay_way == 5 {
  6114. // acct_used_flag = "1"
  6115. // } else {
  6116. // acct_used_flag = "0"
  6117. // }
  6118. // if miConfig.MdtrtareaAdmvs == "421300" {
  6119. //
  6120. // api := "http://192.168.124.4:9532/" + "hbyb/2207?psn_no=" + his.PsnNo + "&mdtrt_id=" +
  6121. // his.Number + "&chrg_bchno=" + chrg_bchno + "&org_name=" + miConfig.OrgName +
  6122. // "&doctor=" + roles.UserName + "&fixmedins_code=" + miConfig.Code +
  6123. // "&insuplc_admdvs=" + his.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs +
  6124. // "&secret_key=" + miConfig.SecretKey + "&id_card_type=" + strconv.FormatInt(his.IdCardType, 10) +
  6125. // "&certificates=" + strconv.FormatInt(his.IdType, 10) + "&cert_no=" + cert_no +
  6126. // "&insutype=" + insutype + "&total=" + allTotal + "&med_type=" + strconv.FormatInt(reg_type, 10) + "&acct_used_flag=" + acct_used_flag
  6127. //
  6128. // resp, requestErr := http.Get(api)
  6129. // if requestErr != nil {
  6130. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  6131. // return
  6132. // }
  6133. //
  6134. // body, ioErr := ioutil.ReadAll(resp.Body)
  6135. // if ioErr != nil {
  6136. // utils.ErrorLog("接口返回数据读取失败: %v", ioErr)
  6137. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  6138. // return
  6139. // }
  6140. // var respJSON map[string]interface{}
  6141. // if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
  6142. // utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
  6143. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  6144. // return
  6145. // }
  6146. //
  6147. // respJSON = respJSON["data"].(map[string]interface{})["pre"].(map[string]interface{})
  6148. // result, _ := json.Marshal(respJSON)
  6149. //
  6150. // if miConfig.Code == "H15049901371" {
  6151. // if err := json.Unmarshal([]byte(result), &resSeven10265); err != nil {
  6152. // utils.ErrorLog("解析失败:%v", err)
  6153. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  6154. // return
  6155. // }
  6156. //
  6157. // res.InfRefmsgid = resSeven10265.InfRefmsgid
  6158. // res.Output = resSeven10265.Output
  6159. // res.ErrMsg = resSeven10265.ErrMsg
  6160. // res.Cainfo = resSeven10265.Cainfo
  6161. // res.WarnMsg = resSeven10265.WarnMsg
  6162. // infocode, _ := strconv.ParseInt(resSeven10265.Infcode, 10, 64)
  6163. // res.Infcode = infocode
  6164. //
  6165. // } else {
  6166. //
  6167. // if err := json.Unmarshal([]byte(result), &res); err != nil {
  6168. // utils.ErrorLog("解析失败:%v", err)
  6169. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  6170. // return
  6171. // }
  6172. //
  6173. // }
  6174. //
  6175. // } else if miConfig.MdtrtareaAdmvs == "320921" || miConfig.MdtrtareaAdmvs == "320982" {
  6176. // psn_info, _ := service.GetPsnByPatientId(his.PatientId)
  6177. // psn_info.VerifyNumber = strings.Replace(psn_info.VerifyNumber, "+", "%2B", -1)
  6178. // bas := strings.Split(psn_info.CardInfo, "|")
  6179. // if his.IdCardType == 1 {
  6180. // cert_no = bas[2]
  6181. // } else if his.IdCardType == 3 {
  6182. // cert_no = his.Certno
  6183. // psn_info.VerifyNumber = his.Certno + "|" + psn_info.VerifyNumber
  6184. // } else if his.IdCardType == 4 {
  6185. // cert_no = his.Certno
  6186. // psn_info.VerifyNumber = token
  6187. // }
  6188. // var api string
  6189. // if miConfig.MdtrtareaAdmvs == "320921" {
  6190. // api = "http://192.168.2.110:9532/" + "jsyb/2207?psn_no=" + his.PsnNo + "&mdtrt_id=" +
  6191. // his.Number + "&chrg_bchno=" + chrg_bchno + "&org_name=" + miConfig.OrgName +
  6192. // "&doctor=" + roles.UserName + "&fixmedins_code=" + miConfig.Code +
  6193. // "&insuplc_admdvs=" + his.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs +
  6194. // "&secret_key=" + miConfig.SecretKey + "&id_card_type=" + strconv.FormatInt(his.IdCardType, 10) +
  6195. // "&certificates=" + strconv.FormatInt(his.IdType, 10) + "&cert_no=" + cert_no +
  6196. // "&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
  6197. // } else {
  6198. // api = "http://192.168.5.251:9532/" + "jsyb/2207?psn_no=" + his.PsnNo + "&mdtrt_id=" +
  6199. // his.Number + "&chrg_bchno=" + chrg_bchno + "&org_name=" + miConfig.OrgName +
  6200. // "&doctor=" + roles.UserName + "&fixmedins_code=" + miConfig.Code +
  6201. // "&insuplc_admdvs=" + his.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs +
  6202. // "&secret_key=" + miConfig.SecretKey + "&id_card_type=" + strconv.FormatInt(his.IdCardType, 10) +
  6203. // "&certificates=" + strconv.FormatInt(his.IdType, 10) + "&cert_no=" + cert_no +
  6204. // "&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
  6205. //
  6206. // }
  6207. //
  6208. // resp, requestErr := http.Get(api)
  6209. // if requestErr != nil {
  6210. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  6211. // return
  6212. // }
  6213. // body, ioErr := ioutil.ReadAll(resp.Body)
  6214. // if ioErr != nil {
  6215. // utils.ErrorLog("接口返回数据读取失败: %v", ioErr)
  6216. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  6217. // return
  6218. // }
  6219. // var respJSON map[string]interface{}
  6220. // if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
  6221. // utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
  6222. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  6223. // return
  6224. // }
  6225. //
  6226. // respJSON = respJSON["data"].(map[string]interface{})["pre"].(map[string]interface{})
  6227. // result, _ := json.Marshal(respJSON)
  6228. //
  6229. // if err := json.Unmarshal([]byte(result), &resSeven10265); err != nil {
  6230. // utils.ErrorLog("解析失败:%v", err)
  6231. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  6232. // return
  6233. // }
  6234. //
  6235. // res.InfRefmsgid = resSeven10265.InfRefmsgid
  6236. // res.Output = resSeven10265.Output
  6237. // res.ErrMsg = resSeven10265.ErrMsg
  6238. // res.Cainfo = resSeven10265.Cainfo
  6239. // res.WarnMsg = resSeven10265.WarnMsg
  6240. // infocode, _ := strconv.ParseInt(resSeven10265.Infcode, 10, 64)
  6241. // res.Infcode = infocode
  6242. //
  6243. // } else {
  6244. // if miConfig.Code == "H15049901371" {
  6245. // //赤峰地区国家医保医疗类别
  6246. // //职工透析:医疗类别选特殊情况门诊990502
  6247. // //居民定额血透门慢: 医疗类别选门诊慢病140104
  6248. // var med_type string
  6249. // if his.Insutype == "390" {
  6250. // if reg_type == 14 {
  6251. // med_type = "9933"
  6252. // } else if reg_type == 11 {
  6253. // med_type = "11"
  6254. // }
  6255. // } else if his.Insutype == "310" {
  6256. // if reg_type == 14 {
  6257. // med_type = "990502"
  6258. // } else if reg_type == 11 {
  6259. // med_type = "11"
  6260. // }
  6261. // }
  6262. // 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)
  6263. // } else {
  6264. // 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, strconv.FormatInt(reg_type, 10), his.IdCardType, tempOrder.FulamtOwnpayAmt, tempOrder.OverlmtSelfPay, tempOrder.PreselfpayAmt, tempOrder.InscpScpAmt, his.IdType, acct_used_flag)
  6265. // }
  6266. //
  6267. // //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)
  6268. // var dat map[string]interface{}
  6269. // if err := json.Unmarshal([]byte(result2), &dat); err == nil {
  6270. // fmt.Println(dat)
  6271. // } else {
  6272. // fmt.Println(err)
  6273. // }
  6274. //
  6275. // saveLog(result2, src_resquest, "2207", "结算")
  6276. //
  6277. // userJSONBytes, _ := json.Marshal(dat)
  6278. // if miConfig.Code == "H15049901371" {
  6279. //
  6280. // if err := json.Unmarshal(userJSONBytes, &resSeven10265); err != nil {
  6281. // utils.ErrorLog("解析失败:%v", err)
  6282. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  6283. // return
  6284. // }
  6285. //
  6286. // res.InfRefmsgid = resSeven10265.InfRefmsgid
  6287. // res.Output = resSeven10265.Output
  6288. // res.ErrMsg = resSeven10265.ErrMsg
  6289. // res.Cainfo = resSeven10265.Cainfo
  6290. // res.WarnMsg = resSeven10265.WarnMsg
  6291. // infocode, _ := strconv.ParseInt(resSeven10265.Infcode, 10, 64)
  6292. // res.Infcode = infocode
  6293. //
  6294. // } else {
  6295. //
  6296. // if err := json.Unmarshal(userJSONBytes, &res); err != nil {
  6297. // utils.ErrorLog("解析失败:%v", err)
  6298. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  6299. // return
  6300. // }
  6301. //
  6302. // }
  6303. //
  6304. // }
  6305. //
  6306. // if res.Infcode != 0 {
  6307. // errlog := &models.HisOrderError{
  6308. // UserOrgId: adminUser.CurrentOrgId,
  6309. // Ctime: time.Now().Unix(),
  6310. // Mtime: time.Now().Unix(),
  6311. // Number: chrg_bchno,
  6312. // ErrMsg: res.ErrMsg,
  6313. // Status: 1,
  6314. // PatientId: id,
  6315. // RecordTime: recordDateTime,
  6316. // Stage: 6,
  6317. // }
  6318. // service.CreateErrMsgLog(errlog)
  6319. // c.ServeSuccessJSON(map[string]interface{}{
  6320. // "failed_code": -10,
  6321. // "msg": res.ErrMsg,
  6322. // })
  6323. // return
  6324. // } else {
  6325. // order, _ := service.GetHisOrderTwo(adminUser.CurrentOrgId, chrg_bchno, id)
  6326. // order.OrderStatus = 2
  6327. // order.Status = 1
  6328. // order.MdtrtId = res.Output.Setlinfo.MdtrtID
  6329. // order.SetlId = res.Output.Setlinfo.SetlID
  6330. // order.PsnNo = res.Output.Setlinfo.PsnNo
  6331. // order.PsnName = res.Output.Setlinfo.PsnName
  6332. // order.PsnCertType = res.Output.Setlinfo.PsnCertType
  6333. // order.Certno = res.Output.Setlinfo.Certno
  6334. // order.Gend = res.Output.Setlinfo.Gend
  6335. // order.Naty = res.Output.Setlinfo.Naty
  6336. // order.Age = res.Output.Setlinfo.Age
  6337. // order.Insutype = res.Output.Setlinfo.Insutype
  6338. // order.PsnType = res.Output.Setlinfo.PsnType
  6339. // order.CvlservFlag = res.Output.Setlinfo.CvlservFlag
  6340. // order.SetlTime = res.Output.Setlinfo.SetlTime
  6341. // order.MdtrtCertType = res.Output.Setlinfo.MdtrtCertType
  6342. // if res.Output.Setlinfo.MedType == "140101" {
  6343. // order.MedType = "14"
  6344. //
  6345. // } else {
  6346. // order.MedType = res.Output.Setlinfo.MedType
  6347. // }
  6348. // if reg_type == 1112 {
  6349. // order.MedType = "1112"
  6350. // }
  6351. // if reg_type == 1111 {
  6352. // order.MedType = "1111"
  6353. // }
  6354. // order.MedfeeSumamt = res.Output.Setlinfo.MedfeeSumamt
  6355. // order.FulamtOwnpayAmt = res.Output.Setlinfo.FulamtOwnpayAmt
  6356. // order.OverlmtSelfPay = res.Output.Setlinfo.OverlmtSelfpay
  6357. // order.PreselfpayAmt = res.Output.Setlinfo.PreselfpayAmt
  6358. // order.InscpScpAmt = res.Output.Setlinfo.InscpScpAmt
  6359. // order.ActPayDedc = res.Output.Setlinfo.ActPayDedc
  6360. // order.HifpPay = res.Output.Setlinfo.HifpPay
  6361. // order.CvlservPay = res.Output.Setlinfo.CvlservPay
  6362. // order.PoolPropSelfpay = res.Output.Setlinfo.PoolPropSelfpay
  6363. // order.HifesPay = res.Output.Setlinfo.HifesPay
  6364. // order.HifobPay = res.Output.Setlinfo.HifobPay
  6365. // order.MafPay = res.Output.Setlinfo.MafPay
  6366. // order.HifmiPay = res.Output.Setlinfo.HifmiPay
  6367. // order.OthPay = res.Output.Setlinfo.OthPay
  6368. // order.FundPaySumamt = res.Output.Setlinfo.FundPaySumamt
  6369. // order.PsnPartAmt = res.Output.Setlinfo.PsnPartAmt
  6370. // order.AcctPay = res.Output.Setlinfo.AcctPay
  6371. // order.PsnCashPay = res.Output.Setlinfo.PsnCashPay
  6372. // order.HospPartAmt = res.Output.Setlinfo.HospPartAmt
  6373. // order.Balc = res.Output.Setlinfo.Balc
  6374. // order.AcctMulaidPay = res.Output.Setlinfo.AcctMulaidPay
  6375. // order.MedinsSetlId = res.Output.Setlinfo.MedinsSetlID
  6376. // order.ClrOptins = res.Output.Setlinfo.ClrOptins
  6377. // order.ClrType = res.Output.Setlinfo.ClrType
  6378. // order.ClrWay = res.Output.Setlinfo.ClrWay
  6379. // order.Creator = order.Creator
  6380. // order.Modify = roles.AdminUserId
  6381. // order.RequestLog = src_resquest
  6382. // setlDetail, _ := json.Marshal(res.Output.Setldetail)
  6383. // detailStr := string(setlDetail)
  6384. // order.SetlDetail = detailStr
  6385. // err := service.UpdataOrderStatusTwo(chrg_bchno, adminUser.CurrentOrgId)
  6386. // err = service.UpDateOrder(order)
  6387. // if err == nil {
  6388. // //判断是否使用了押金
  6389. // if dec_way == "true" {
  6390. // tmpstring := strconv.FormatInt(order.ID, 10)
  6391. // order.Decimal = decimal
  6392. // service.UpDateOrder(order)
  6393. // //扣押金
  6394. // errmsg = service.SpendDeposit(c.GetAdminUserInfo().CurrentOrgId, id, c.GetAdminUserInfo().AdminUser.Id, tmpstring, decimal)
  6395. // if errmsg != nil {
  6396. // c.ServeFailJsonSend(enums.ErrorCodeParamWrong, errmsg.Error())
  6397. // return
  6398. // }
  6399. // }
  6400. //
  6401. // c.ServeSuccessJSON(map[string]interface{}{
  6402. // "msg": "结算成功",
  6403. // })
  6404. // } else {
  6405. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeAmountAccountException)
  6406. // return
  6407. // }
  6408. // }
  6409. // } else {
  6410. // adminUser := c.GetAdminUserInfo()
  6411. // errlog := &models.HisOrderError{
  6412. // UserOrgId: adminUser.CurrentOrgId,
  6413. // Ctime: time.Now().Unix(),
  6414. // Mtime: time.Now().Unix(),
  6415. // ErrMsg: res.ErrMsg,
  6416. // Status: 1,
  6417. // PatientId: id,
  6418. // RecordTime: recordDateTime,
  6419. // Stage: 4,
  6420. // }
  6421. // service.CreateErrMsgLog(errlog)
  6422. //
  6423. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeRegisterRepeatException)
  6424. // return
  6425. // }
  6426. // } else {
  6427. // adminUser := c.GetAdminUserInfo()
  6428. // errlog := &models.HisOrderError{
  6429. // UserOrgId: adminUser.CurrentOrgId,
  6430. // Ctime: time.Now().Unix(),
  6431. // Mtime: time.Now().Unix(),
  6432. // ErrMsg: res.ErrMsg,
  6433. // Status: 1,
  6434. // PatientId: id,
  6435. // RecordTime: recordDateTime,
  6436. // Stage: 4,
  6437. // }
  6438. // service.CreateErrMsgLog(errlog)
  6439. // c.ServeSuccessJSON(map[string]interface{}{
  6440. // "failed_code": -10,
  6441. // "msg": res.ErrMsg,
  6442. // })
  6443. // return
  6444. // //c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCalOrderException)
  6445. // //return
  6446. // }
  6447. // }
  6448. //
  6449. // }
  6450. //
  6451. // } else if tempOrder.ID > 0 {
  6452. // if tempOrder.IsPre == 1 {
  6453. // allTotal := fmt.Sprintf("%.4f", tempOrder.MedfeeSumamt)
  6454. // var rf []*ResultFive
  6455. // json.Unmarshal([]byte(his.Iinfo), &rf)
  6456. // chrg_bchno := tempOrder.Number
  6457. // cert_no := his.Certno
  6458. //
  6459. // var insutypes []string
  6460. //
  6461. // var insutype string
  6462. // var is390 int = 0
  6463. // var is310 int = 0
  6464. //
  6465. // for _, item := range rf {
  6466. // if (item.Insutype == "390" && item.PsnInsuStas == "1") || (item.Insutype == "310" && item.PsnInsuStas == "1") {
  6467. // insutypes = append(insutypes, item.Insutype)
  6468. // }
  6469. // }
  6470. //
  6471. // if len(insutypes) == 1 {
  6472. // insutype = insutypes[0]
  6473. // } else {
  6474. // for _, i := range insutypes {
  6475. // if i == "390" {
  6476. // is390 = 1
  6477. // }
  6478. //
  6479. // if i == "310" {
  6480. // is310 = 1
  6481. // }
  6482. // }
  6483. // }
  6484. // if is390 == 1 {
  6485. // insutype = "390"
  6486. // }
  6487. //
  6488. // if is310 == 1 {
  6489. // insutype = "310"
  6490. // }
  6491. //
  6492. // if len(insutypes) == 0 {
  6493. // insutype = "310"
  6494. // }
  6495. //
  6496. // if len(insutypes) == 2 {
  6497. // insutype = strconv.FormatInt(his.SocialType, 64)
  6498. // }
  6499. //
  6500. // //insutype = "390"
  6501. // if his.IdCardType == 1 {
  6502. // // cert_no = his.MedicalInsuranceNumber
  6503. // cert_no = his.Certno
  6504. //
  6505. // } else {
  6506. //
  6507. // cert_no = his.Certno
  6508. //
  6509. // }
  6510. // var res ResultSeven
  6511. // var resSeven10265 ResultSeven10265
  6512. // var src_resquest string
  6513. // var result2 string
  6514. // var acct_used_flag string
  6515. // fmt.Println("pay_way")
  6516. // fmt.Println(pay_way)
  6517. // fmt.Println("pay_way")
  6518. // if pay_way == 5 {
  6519. // acct_used_flag = "1"
  6520. // } else {
  6521. // acct_used_flag = "0"
  6522. // }
  6523. //
  6524. // if miConfig.MdtrtareaAdmvs == "421300" {
  6525. // api := "http://192.168.124.4:9532/" + "hbyb/2207?psn_no=" + his.PsnNo + "&mdtrt_id=" +
  6526. // his.Number + "&chrg_bchno=" + chrg_bchno + "&org_name=" + miConfig.OrgName +
  6527. // "&doctor=" + roles.UserName + "&fixmedins_code=" + miConfig.Code +
  6528. // "&insuplc_admdvs=" + his.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs +
  6529. // "&secret_key=" + miConfig.SecretKey + "&id_card_type=" + strconv.FormatInt(his.IdCardType, 10) +
  6530. // "&certificates=" + strconv.FormatInt(his.IdType, 10) + "&cert_no=" + cert_no +
  6531. // "&insutype=" + insutype + "&total=" + allTotal + "&med_type=" + strconv.FormatInt(reg_type, 10) + "&acct_used_flag=" + acct_used_flag
  6532. //
  6533. // resp, requestErr := http.Get(api)
  6534. // if requestErr != nil {
  6535. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  6536. // return
  6537. // }
  6538. //
  6539. // body, ioErr := ioutil.ReadAll(resp.Body)
  6540. // if ioErr != nil {
  6541. // utils.ErrorLog("接口返回数据读取失败: %v", ioErr)
  6542. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  6543. // return
  6544. // }
  6545. // var respJSON map[string]interface{}
  6546. // if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
  6547. // utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
  6548. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  6549. // return
  6550. // }
  6551. //
  6552. // respJSON = respJSON["data"].(map[string]interface{})["pre"].(map[string]interface{})
  6553. // result, _ := json.Marshal(respJSON)
  6554. // fmt.Println("log")
  6555. // fmt.Println(string(result))
  6556. // if err := json.Unmarshal([]byte(result), &res); err != nil {
  6557. // utils.ErrorLog("解析失败:%v", err)
  6558. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  6559. // return
  6560. // }
  6561. //
  6562. // } else if miConfig.MdtrtareaAdmvs == "320921" || miConfig.MdtrtareaAdmvs == "320982" {
  6563. // psn_info, _ := service.GetPsnByPatientId(his.PatientId)
  6564. // psn_info.VerifyNumber = strings.Replace(psn_info.VerifyNumber, "+", "%2B", -1)
  6565. //
  6566. // //psn_info, _ := service.GetPsnByPatientId(id)
  6567. // bas := strings.Split(psn_info.CardInfo, "|")
  6568. //
  6569. // if his.IdCardType == 1 {
  6570. // cert_no = bas[2]
  6571. // } else {
  6572. // cert_no = bas[1]
  6573. // }
  6574. //
  6575. // //江苏地区国家医保医疗类别
  6576. // //职工透析:医疗类别选特殊情况门诊9933
  6577. // //居民血透门慢: 医疗类别选门诊慢病1402
  6578. // //var med_type string
  6579. // //if his.Insutype == "310" {
  6580. // // if reg_type == 14 {
  6581. // // med_type = "9933"
  6582. // // } else if reg_type == 11 {
  6583. // // med_type = "11"
  6584. // //
  6585. // // }
  6586. // //} else if his.Insutype == "390" {
  6587. // // if reg_type == 14 {
  6588. // // med_type = "1402"
  6589. // // } else if reg_type == 11 {
  6590. // // med_type = "11"
  6591. // // }
  6592. // //}
  6593. //
  6594. // var api string
  6595. // if miConfig.MdtrtareaAdmvs == "320921" {
  6596. // api = "http://192.168.2.110:9532/" + "jsyb/2207?psn_no=" + his.PsnNo + "&mdtrt_id=" +
  6597. // his.Number + "&chrg_bchno=" + chrg_bchno + "&org_name=" + miConfig.OrgName +
  6598. // "&doctor=" + roles.UserName + "&fixmedins_code=" + miConfig.Code +
  6599. // "&insuplc_admdvs=" + his.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs +
  6600. // "&secret_key=" + miConfig.SecretKey + "&id_card_type=" + strconv.FormatInt(his.IdCardType, 10) +
  6601. // "&certificates=" + strconv.FormatInt(his.IdType, 10) + "&cert_no=" + cert_no +
  6602. // "&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
  6603. //
  6604. // //req, _ = http.NewRequest("POST", "http://192.168.2.110:9532/"+"jsyb/2204", bytes.NewReader(bytesData))
  6605. //
  6606. // } else {
  6607. // //req, _ = http.NewRequest("POST", "http://192.168.5.251:9532/"+"jsyb/2204", bytes.NewReader(bytesData))
  6608. // api = "http://192.168.5.251:9532/" + "jsyb/2207?psn_no=" + his.PsnNo + "&mdtrt_id=" +
  6609. // his.Number + "&chrg_bchno=" + chrg_bchno + "&org_name=" + miConfig.OrgName +
  6610. // "&doctor=" + roles.UserName + "&fixmedins_code=" + miConfig.Code +
  6611. // "&insuplc_admdvs=" + his.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs +
  6612. // "&secret_key=" + miConfig.SecretKey + "&id_card_type=" + strconv.FormatInt(his.IdCardType, 10) +
  6613. // "&certificates=" + strconv.FormatInt(his.IdType, 10) + "&cert_no=" + cert_no +
  6614. // "&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
  6615. //
  6616. // }
  6617. //
  6618. // resp, requestErr := http.Get(api)
  6619. // if requestErr != nil {
  6620. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  6621. // return
  6622. // }
  6623. //
  6624. // body, ioErr := ioutil.ReadAll(resp.Body)
  6625. // if ioErr != nil {
  6626. // utils.ErrorLog("接口返回数据读取失败: %v", ioErr)
  6627. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  6628. // return
  6629. // }
  6630. // var respJSON map[string]interface{}
  6631. // if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
  6632. // utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
  6633. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  6634. // return
  6635. // }
  6636. //
  6637. // respJSON = respJSON["data"].(map[string]interface{})["pre"].(map[string]interface{})
  6638. // result, _ := json.Marshal(respJSON)
  6639. // fmt.Println("log")
  6640. // fmt.Println(string(result))
  6641. // if err := json.Unmarshal([]byte(result), &resSeven10265); err != nil {
  6642. // utils.ErrorLog("解析失败:%v", err)
  6643. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  6644. // return
  6645. // }
  6646. //
  6647. // res.InfRefmsgid = resSeven10265.InfRefmsgid
  6648. // res.Output = resSeven10265.Output
  6649. // res.ErrMsg = resSeven10265.ErrMsg
  6650. // res.Cainfo = resSeven10265.Cainfo
  6651. // res.WarnMsg = resSeven10265.WarnMsg
  6652. // infocode, _ := strconv.ParseInt(resSeven10265.Infcode, 10, 64)
  6653. // res.Infcode = infocode
  6654. //
  6655. // } else {
  6656. //
  6657. // var src_resquest string
  6658. // if miConfig.Code == "H15049901371" {
  6659. // //赤峰地区国家医保医疗类别
  6660. // //职工透析:医疗类别选特殊情况门诊990502
  6661. // //居民定额血透门慢: 医疗类别选门诊慢病140104
  6662. // var med_type string
  6663. // if his.Insutype == "390" {
  6664. // if reg_type == 14 {
  6665. // med_type = "9933"
  6666. // } else if reg_type == 11 {
  6667. // med_type = "11"
  6668. // }
  6669. // } else if his.Insutype == "310" {
  6670. // if reg_type == 14 {
  6671. // med_type = "990502"
  6672. // } else if reg_type == 11 {
  6673. // med_type = "11"
  6674. // }
  6675. // }
  6676. // 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)
  6677. // } else {
  6678. // 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, strconv.FormatInt(reg_type, 10), his.IdCardType, tempOrder.FulamtOwnpayAmt, tempOrder.OverlmtSelfPay, tempOrder.PreselfpayAmt, tempOrder.InscpScpAmt, his.IdType, acct_used_flag)
  6679. // }
  6680. //
  6681. // var dat map[string]interface{}
  6682. // if err := json.Unmarshal([]byte(result2), &dat); err == nil {
  6683. // fmt.Println(dat)
  6684. // } else {
  6685. // fmt.Println(err)
  6686. // }
  6687. // saveLog(result2, src_resquest, "2207", "结算")
  6688. // userJSONBytes, _ := json.Marshal(dat)
  6689. // if miConfig.Code == "H15049901371" {
  6690. //
  6691. // if err := json.Unmarshal(userJSONBytes, &resSeven10265); err != nil {
  6692. // utils.ErrorLog("解析失败:%v", err)
  6693. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  6694. // return
  6695. // }
  6696. // res.InfRefmsgid = resSeven10265.InfRefmsgid
  6697. // res.Output = resSeven10265.Output
  6698. // res.ErrMsg = resSeven10265.ErrMsg
  6699. // res.Cainfo = resSeven10265.Cainfo
  6700. // res.WarnMsg = resSeven10265.WarnMsg
  6701. // infocode, _ := strconv.ParseInt(resSeven10265.Infcode, 10, 64)
  6702. // res.Infcode = infocode
  6703. //
  6704. // } else {
  6705. //
  6706. // if err := json.Unmarshal(userJSONBytes, &res); err != nil {
  6707. // utils.ErrorLog("解析失败:%v", err)
  6708. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  6709. // return
  6710. // }
  6711. //
  6712. // }
  6713. // }
  6714. //
  6715. // if res.Infcode != 0 {
  6716. // errlog := &models.HisOrderError{
  6717. // UserOrgId: adminUser.CurrentOrgId,
  6718. // Ctime: time.Now().Unix(),
  6719. // Mtime: time.Now().Unix(),
  6720. // Number: chrg_bchno,
  6721. // ErrMsg: res.ErrMsg,
  6722. // Status: 1,
  6723. // PatientId: id,
  6724. // RecordTime: recordDateTime,
  6725. // Stage: 6,
  6726. // }
  6727. // service.CreateErrMsgLog(errlog)
  6728. // c.ServeSuccessJSON(map[string]interface{}{
  6729. // "failed_code": -10,
  6730. // "msg": res.ErrMsg,
  6731. // })
  6732. // return
  6733. // } else {
  6734. //
  6735. // order, _ := service.GetHisOrderTwo(adminUser.CurrentOrgId, chrg_bchno, id)
  6736. // order.OrderStatus = 2
  6737. // order.MdtrtId = res.Output.Setlinfo.MdtrtID
  6738. // order.SetlId = res.Output.Setlinfo.SetlID
  6739. // order.PsnNo = res.Output.Setlinfo.PsnNo
  6740. // order.PsnName = res.Output.Setlinfo.PsnName
  6741. // order.PsnCertType = res.Output.Setlinfo.PsnCertType
  6742. // order.Certno = res.Output.Setlinfo.Certno
  6743. // order.Gend = res.Output.Setlinfo.Gend
  6744. // order.Naty = res.Output.Setlinfo.Naty
  6745. // order.Age = res.Output.Setlinfo.Age
  6746. // order.Insutype = res.Output.Setlinfo.Insutype
  6747. // order.PsnType = res.Output.Setlinfo.PsnType
  6748. // order.CvlservFlag = res.Output.Setlinfo.CvlservFlag
  6749. // order.SetlTime = res.Output.Setlinfo.SetlTime
  6750. // order.MdtrtCertType = res.Output.Setlinfo.MdtrtCertType
  6751. // //order.MedType = res.Output.Setlinfo.MedType
  6752. // if reg_type == 1112 {
  6753. // order.MedType = "1112"
  6754. // }
  6755. // if reg_type == 1111 {
  6756. // order.MedType = "1111"
  6757. // }
  6758. // order.MedfeeSumamt = res.Output.Setlinfo.MedfeeSumamt
  6759. // order.FulamtOwnpayAmt = res.Output.Setlinfo.FulamtOwnpayAmt
  6760. // order.OverlmtSelfPay = res.Output.Setlinfo.OverlmtSelfpay
  6761. // order.PreselfpayAmt = res.Output.Setlinfo.PreselfpayAmt
  6762. // order.InscpScpAmt = res.Output.Setlinfo.InscpScpAmt
  6763. // order.ActPayDedc = res.Output.Setlinfo.ActPayDedc
  6764. // order.HifpPay = res.Output.Setlinfo.HifpPay
  6765. // order.CvlservPay = res.Output.Setlinfo.CvlservPay
  6766. // order.PoolPropSelfpay = res.Output.Setlinfo.PoolPropSelfpay
  6767. // order.HifesPay = res.Output.Setlinfo.HifesPay
  6768. // order.HifobPay = res.Output.Setlinfo.HifobPay
  6769. // order.MafPay = res.Output.Setlinfo.MafPay
  6770. // order.HifmiPay = res.Output.Setlinfo.HifmiPay
  6771. // order.OthPay = res.Output.Setlinfo.OthPay
  6772. // order.FundPaySumamt = res.Output.Setlinfo.FundPaySumamt
  6773. // order.PsnPartAmt = res.Output.Setlinfo.PsnPartAmt
  6774. // order.AcctPay = res.Output.Setlinfo.AcctPay
  6775. // order.PsnCashPay = res.Output.Setlinfo.PsnCashPay
  6776. // order.HospPartAmt = res.Output.Setlinfo.HospPartAmt
  6777. // order.Balc = res.Output.Setlinfo.Balc
  6778. // order.AcctMulaidPay = res.Output.Setlinfo.AcctMulaidPay
  6779. // order.MedinsSetlId = res.Output.Setlinfo.MedinsSetlID
  6780. // order.ClrOptins = res.Output.Setlinfo.ClrOptins
  6781. // order.ClrWay = res.Output.Setlinfo.ClrWay
  6782. // order.Creator = order.Creator
  6783. // order.Modify = roles.AdminUserId
  6784. // order.RequestLog = src_resquest
  6785. // order.Diagnosis = diagnosis_id
  6786. // setlDetail, _ := json.Marshal(res.Output.Setldetail)
  6787. // detailStr := string(setlDetail)
  6788. // order.SetlDetail = detailStr
  6789. //
  6790. // err := service.UpdataOrderStatusTwo(chrg_bchno, adminUser.CurrentOrgId)
  6791. // err = service.UpDateOrder(order)
  6792. // if err == nil {
  6793. // //判断是否使用了押金
  6794. // if dec_way == "true" {
  6795. // tmpstring := strconv.FormatInt(order.ID, 10)
  6796. // //扣押金
  6797. // order.Decimal = decimal
  6798. // service.UpDateOrder(order)
  6799. //
  6800. // errmsg = service.SpendDeposit(c.GetAdminUserInfo().CurrentOrgId, id, c.GetAdminUserInfo().AdminUser.Id, tmpstring, decimal)
  6801. // if errmsg != nil {
  6802. // c.ServeFailJsonSend(enums.ErrorCodeParamWrong, errmsg.Error())
  6803. // return
  6804. // }
  6805. // }
  6806. //
  6807. // c.ServeSuccessJSON(map[string]interface{}{
  6808. // "msg": "结算成功",
  6809. // })
  6810. // } else {
  6811. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeAmountAccountException)
  6812. // return
  6813. // }
  6814. // }
  6815. // }
  6816. // }
  6817. //}
  6818. //
  6819. ////func (c *HisApiController) GetPreUploadInfo() {
  6820. //// id, _ := c.GetInt64("id")
  6821. //// record_time := c.GetString("record_time")
  6822. //// settle_accounts_type, _ := c.GetInt64("settle_accounts_type")
  6823. //// admin_user_id, _ := c.GetInt64("admin_user_id")
  6824. ////
  6825. //// timeLayout := "2006-01-02"
  6826. //// loc, _ := time.LoadLocation("Local")
  6827. //// theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", record_time+" 00:00:00", loc)
  6828. //// if err != nil {
  6829. //// c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
  6830. //// return
  6831. //// }
  6832. //// recordDateTime := theTime.Unix()
  6833. //// adminUser := c.GetAdminUserInfo()
  6834. ////
  6835. //// var prescriptions []*models.HisPrescription
  6836. ////
  6837. //// var start_time int64
  6838. //// var end_time int64
  6839. ////
  6840. //// data := make(map[string]interface{})
  6841. //// if settle_accounts_type == 1 { //日结
  6842. //// prescriptions, _ = service.GetHisPrescription(adminUser.CurrentOrgId, id, recordDateTime)
  6843. //// data["pre"] = prescriptions
  6844. ////
  6845. //// } else { //月结
  6846. //// start_time_str := c.GetString("start_time")
  6847. //// end_time_str := c.GetString("end_time")
  6848. //// timeLayout := "2006-01-02"
  6849. //// loc, _ := time.LoadLocation("Local")
  6850. //// theStartTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time_str+" 00:00:00", loc)
  6851. //// if err != nil {
  6852. //// c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
  6853. //// return
  6854. //// }
  6855. //// recordStartTime := theStartTime.Unix()
  6856. //// start_time = recordStartTime
  6857. //// theEndTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time_str+" 00:00:00", loc)
  6858. //// if err != nil {
  6859. //// c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
  6860. //// return
  6861. //// }
  6862. //// recordEndTime := theEndTime.Unix()
  6863. //// end_time = recordEndTime
  6864. //// prescriptions, _ = service.GetMonthHisPrescription(adminUser.CurrentOrgId, id, recordStartTime, recordEndTime)
  6865. //// data["pre"] = prescriptions
  6866. ////
  6867. //// }
  6868. ////
  6869. //// roles, _ := service.GetAdminUserInfoByID(adminUser.CurrentOrgId, admin_user_id)
  6870. ////
  6871. //// his, _ := service.GetVMHisPatientInfo(adminUser.CurrentOrgId, id, recordDateTime)
  6872. //// timestamp := time.Now().Unix()
  6873. //// tempTime := time.Unix(timestamp, 0)
  6874. //// timeFormat := tempTime.Format("20060102150405")
  6875. //// chrgBchno := rand.Intn(100000) + 10000
  6876. //// chrg_bchno := timeFormat + strconv.FormatInt(int64(chrgBchno), 10) + strconv.FormatInt(his.PatientId, 10)
  6877. //// miConfig, _ := service.FindMedicalInsuranceInfo(adminUser.CurrentOrgId)
  6878. //// patientPrescription, _ := service.FindPatientPrescriptionInfo(adminUser.CurrentOrgId, id, recordDateTime)
  6879. //// department, _ := service.GetDepartMentDetail(patientPrescription.Departments)
  6880. //// strconv.FormatInt(his.PatientId, 10)
  6881. //// client := &http.Client{}
  6882. //// data["psn_no"] = his.PsnNo
  6883. //// data["mdtrt_id"] = his.Number
  6884. //// data["chrg_bchno"] = chrg_bchno
  6885. //// data["org_name"] = miConfig.OrgName
  6886. //// data["doctor"] = roles.UserName
  6887. //// data["doctor_id"] = strconv.FormatInt(roles.AdminUserId, 10)
  6888. //// data["dept"] = strconv.FormatInt(patientPrescription.Departments, 10)
  6889. //// data["fixmedins_code"] = miConfig.Code
  6890. //// data["dept_code"] = department.Number
  6891. //// data["insuplc_admdvs"] = miConfig.InsuplcAdmdvs
  6892. //// data["mdtrtarea_admvs"] = miConfig.MdtrtareaAdmvs
  6893. //// data["secret_key"] = miConfig.SecretKey
  6894. //// var ids []int64
  6895. ////
  6896. //// for _, item := range prescriptions {
  6897. //// ids = append(ids, item.ID)
  6898. //// }
  6899. //// config, _ := service.GetMedicalInsuranceConfig(adminUser.CurrentOrgId)
  6900. //// if config.IsOpen == 1 { //对接了医保,走医保流程
  6901. //// bytesData, _ := json.Marshal(data)
  6902. //// req, _ := http.NewRequest("POST", "http://127.0.0.1:9532/"+"gdyb/five", bytes.NewReader(bytesData))
  6903. //// resp, _ := client.Do(req)
  6904. //// defer resp.Body.Close()
  6905. //// body, ioErr := ioutil.ReadAll(resp.Body)
  6906. //// if ioErr != nil {
  6907. //// utils.ErrorLog("接口返回数据读取失败: %v", ioErr)
  6908. //// c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  6909. //// return
  6910. //// }
  6911. //// var respJSON map[string]interface{}
  6912. //// if err := json.Unmarshal([]byte(body), &respJSON); err != nil {
  6913. //// utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
  6914. //// c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  6915. //// return
  6916. //// }
  6917. ////
  6918. //// respJSON = respJSON["data"].(map[string]interface{})["pre"].(map[string]interface{})
  6919. //// userJSONBytes, _ := json.Marshal(respJSON)
  6920. //// var res ResultFour
  6921. //// if err := json.Unmarshal(userJSONBytes, &res); err != nil {
  6922. //// utils.ErrorLog("解析失败:%v", err)
  6923. //// c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  6924. //// return
  6925. //// }
  6926. ////
  6927. //// if res.Infcode == 0 {
  6928. //// order := &models.HisOrder{
  6929. //// UserOrgId: adminUser.CurrentOrgId,
  6930. //// HisPatientId: his.ID,
  6931. //// PatientId: his.PatientId,
  6932. //// SettleAccountsDate: recordDateTime,
  6933. //// Ctime: time.Now().Unix(),
  6934. //// Mtime: time.Now().Unix(),
  6935. //// Status: 1,
  6936. //// Number: chrg_bchno,
  6937. //// Infcode: res.Infcode,
  6938. //// WarnMsg: res.WarnMsg,
  6939. //// Cainfo: res.Cainfo,
  6940. //// ErrMsg: res.ErrMsg,
  6941. //// RespondTime: res.RefmsgTime,
  6942. //// InfRefmsgid: res.InfRefmsgid,
  6943. //// OrderStatus: 1,
  6944. //// IsMedicineInsurance: 1,
  6945. //// SettleType: settle_accounts_type,
  6946. //// SettleStartTime: start_time,
  6947. //// SettleEndTime: end_time,
  6948. //// Creator: roles.ID,
  6949. //// Modify: roles.ID,
  6950. //// PType: 2,
  6951. //// }
  6952. //// err = service.CreateOrder(order)
  6953. //// if err != nil {
  6954. //// c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCreatePreOrderException)
  6955. //// return
  6956. //// }
  6957. ////
  6958. //// for _, item := range res.Output.Result {
  6959. //// temp := strings.Split(item.FeedetlSn, "-")
  6960. //// var advice_id int64 = 0
  6961. //// var project_id int64 = 0
  6962. //// var types int64 = 0
  6963. ////
  6964. //// id, _ := strconv.ParseInt(temp[2], 10, 64)
  6965. //// types, _ = strconv.ParseInt(temp[1], 10, 64)
  6966. ////
  6967. //// if temp[1] == "1" {
  6968. //// advice_id = id
  6969. //// project_id = 0
  6970. //// } else if temp[1] == "2" {
  6971. //// advice_id = 0
  6972. //// project_id = id
  6973. //// }
  6974. ////
  6975. //// info := &models.HisOrderInfo{
  6976. //// OrderNumber: order.Number,
  6977. //// FeedetlSn: item.FeedetlSn,
  6978. //// UploadDate: time.Now().Unix(),
  6979. //// AdviceId: advice_id,
  6980. //// DetItemFeeSumamt: item.DetItemFeeSumamt,
  6981. //// Cnt: item.Cnt,
  6982. //// Pric: float64(item.Pric),
  6983. //// PatientId: his.PatientId,
  6984. //// PricUplmtAmt: item.PricUplmtAmt,
  6985. //// SelfpayProp: item.SelfpayProp,
  6986. //// FulamtOwnpayAmt: item.FulamtOwnpayAmt,
  6987. //// OverlmtAmt: item.OverlmtAmt,
  6988. //// PreselfpayAmt: item.PreselfpayAmt,
  6989. //// BasMednFlag: item.BasMednFlag,
  6990. //// MedChrgitmType: item.MedChrgitmType,
  6991. //// HiNegoDrugFlag: item.HiNegoDrugFlag,
  6992. //// Status: 1,
  6993. //// Memo: item.Memo,
  6994. //// Mtime: time.Now().Unix(),
  6995. //// InscpScpAmt: item.InscpScpAmt,
  6996. //// DrtReimFlag: item.DrtReimFlag,
  6997. //// Ctime: time.Now().Unix(),
  6998. //// ListSpItemFlag: item.ListSpItemFlag,
  6999. //// ChldMedcFlag: item.ChldMedcFlag,
  7000. //// LmtUsedFlag: item.LmtUsedFlag,
  7001. //// ChrgitmLv: item.ChrgitmLv,
  7002. //// UserOrgId: adminUser.CurrentOrgId,
  7003. //// HisPatientId: his.ID,
  7004. //// OrderId: order.ID,
  7005. //// ProjectId: project_id,
  7006. //// Type: types,
  7007. //// }
  7008. //// service.CreateOrderInfo(info)
  7009. ////
  7010. //// }
  7011. //// service.UpDatePrescriptionNumber(adminUser.CurrentOrgId, ids, chrg_bchno)
  7012. //// service.UpDatePrescriptionInfoNumber(adminUser.CurrentOrgId, patientPrescription.PatientId, chrg_bchno, recordDateTime)
  7013. ////
  7014. //// var total float64
  7015. //// for _, item := range prescriptions {
  7016. //// if item.Type == 1 { //药品
  7017. //// for _, subItem := range item.HisDoctorAdviceInfo {
  7018. //// total = total + (subItem.Price * subItem.PrescribingNumber)
  7019. //// }
  7020. //// }
  7021. //// if item.Type == 2 { //项目
  7022. //// for _, subItem := range item.HisPrescriptionProject {
  7023. //// total = total + (subItem.Price * float64(subItem.Count))
  7024. //// }
  7025. //// }
  7026. //// }
  7027. ////
  7028. //// for _, item := range prescriptions {
  7029. //// for _, subItem := range item.HisAdditionalCharge {
  7030. //// total = total + (subItem.Price * float64(subItem.Count))
  7031. //// }
  7032. //// }
  7033. ////
  7034. //// allTotal := fmt.Sprintf("%.2f", total)
  7035. //// if res.Infcode == 0 {
  7036. //// var rf []*ResultFive
  7037. //// json.Unmarshal([]byte(his.Iinfo), &rf)
  7038. //// psn_no := his.PsnNo
  7039. //// mdtrt_id := his.Number
  7040. //// chrg_bchno := chrg_bchno
  7041. //// cert_no := his.Certno
  7042. //// insutype := rf[0].Insutype
  7043. ////
  7044. //// if his.IdCardType == 1 {
  7045. //// cert_no = his.MedicalInsuranceNumber
  7046. ////
  7047. //// } else {
  7048. ////
  7049. //// cert_no = his.Certno
  7050. ////
  7051. //// }
  7052. ////
  7053. //// api := "http://127.0.0.1:9532/" + "gdyb/seven?cert_no=" + cert_no + "&insutype=" +
  7054. //// insutype + "&psn_no=" + psn_no + "&chrg_bchno=" + chrg_bchno + "&mdtrt_id=" + mdtrt_id +
  7055. //// "&total=" + allTotal + "&org_name=" + miConfig.OrgName + "&doctor=" + roles.UserName + "&fixmedins_code=" + miConfig.Code + "&insuplc_admdvs=" + miConfig.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" +
  7056. //// miConfig.SecretKey + "&med_type=" + strconv.FormatInt(patientPrescription.RegisterType, 10) + "&id_card_type=" + strconv.FormatInt(int64(his.IdCardType), 10)
  7057. //// resp, requestErr := http.Get(api)
  7058. //// if requestErr != nil {
  7059. //// c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  7060. //// return
  7061. //// }
  7062. //// defer resp.Body.Close()
  7063. //// body, ioErr := ioutil.ReadAll(resp.Body)
  7064. //// if ioErr != nil {
  7065. //// utils.ErrorLog("接口返回数据读取失败: %v", ioErr)
  7066. //// c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  7067. //// return
  7068. //// }
  7069. //// var respJSON map[string]interface{}
  7070. //// if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
  7071. //// utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
  7072. //// c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  7073. //// return
  7074. //// }
  7075. //// fmt.Println(respJSON)
  7076. //// respJSON = respJSON["data"].(map[string]interface{})["pre"].(map[string]interface{})
  7077. //// userJSONBytes, _ := json.Marshal(respJSON)
  7078. //// var res ResultSeven
  7079. //// if err := json.Unmarshal(userJSONBytes, &res); err != nil {
  7080. //// utils.ErrorLog("解析失败:%v", err)
  7081. //// c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  7082. //// return
  7083. //// }
  7084. //// if res.Infcode != 0 {
  7085. //// errlog := &models.HisOrderError{
  7086. //// UserOrgId: adminUser.CurrentOrgId,
  7087. //// Ctime: time.Now().Unix(),
  7088. //// Mtime: time.Now().Unix(),
  7089. //// Number: chrg_bchno,
  7090. //// ErrMsg: res.ErrMsg,
  7091. //// Status: 1,
  7092. //// PatientId: id,
  7093. //// RecordTime: recordDateTime,
  7094. //// Stage: 7,
  7095. //// }
  7096. //// service.CreateErrMsgLog(errlog)
  7097. //// c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeRegisterRepeatException)
  7098. //// return
  7099. //// } else {
  7100. //// order, _ := service.GetHisOrderTwo(adminUser.CurrentOrgId, chrg_bchno, id)
  7101. //// order.OrderStatus = 1
  7102. //// order.MdtrtId = res.Output.Setlinfo.MdtrtID
  7103. //// order.SetlId = res.Output.Setlinfo.SetlID
  7104. //// order.PsnNo = res.Output.Setlinfo.PsnNo
  7105. //// order.PsnName = res.Output.Setlinfo.PsnName
  7106. //// order.PsnCertType = res.Output.Setlinfo.PsnCertType
  7107. //// order.Certno = res.Output.Setlinfo.Certno
  7108. //// order.Gend = res.Output.Setlinfo.Gend
  7109. //// order.Naty = res.Output.Setlinfo.Naty
  7110. //// order.Age = res.Output.Setlinfo.Age
  7111. //// order.Insutype = res.Output.Setlinfo.Insutype
  7112. //// order.PsnType = res.Output.Setlinfo.PsnType
  7113. //// order.CvlservFlag = res.Output.Setlinfo.CvlservFlag
  7114. //// order.SetlTime = res.Output.Setlinfo.SetlTime
  7115. //// order.MdtrtCertType = res.Output.Setlinfo.MdtrtCertType
  7116. //// order.MedType = res.Output.Setlinfo.MedType
  7117. //// order.MedfeeSumamt = res.Output.Setlinfo.MedfeeSumamt
  7118. //// order.FulamtOwnpayAmt = res.Output.Setlinfo.FulamtOwnpayAmt
  7119. //// order.OverlmtSelfPay = res.Output.Setlinfo.OverlmtSelfpay
  7120. //// order.PreselfpayAmt = res.Output.Setlinfo.PreselfpayAmt
  7121. //// order.InscpScpAmt = res.Output.Setlinfo.InscpScpAmt
  7122. //// order.ActPayDedc = res.Output.Setlinfo.ActPayDedc
  7123. //// order.HifpPay = res.Output.Setlinfo.HifpPay
  7124. //// order.CvlservPay = res.Output.Setlinfo.CvlservPay
  7125. //// order.PoolPropSelfpay = res.Output.Setlinfo.PoolPropSelfpay
  7126. //// order.HifesPay = res.Output.Setlinfo.HifesPay
  7127. //// order.HifobPay = res.Output.Setlinfo.HifobPay
  7128. //// order.MafPay = res.Output.Setlinfo.MafPay
  7129. //// order.OthPay = res.Output.Setlinfo.OthPay
  7130. //// order.FundPaySumamt = res.Output.Setlinfo.FundPaySumamt
  7131. //// order.PsnPartAmt = res.Output.Setlinfo.PsnPartAmt
  7132. //// order.AcctPay = res.Output.Setlinfo.AcctPay
  7133. //// order.PsnCashPay = res.Output.Setlinfo.PsnCashPay
  7134. //// order.HospPartAmt = res.Output.Setlinfo.HospPartAmt
  7135. //// order.Balc = res.Output.Setlinfo.Balc
  7136. //// order.AcctMulaidPay = res.Output.Setlinfo.AcctMulaidPay
  7137. //// order.MedinsSetlId = res.Output.Setlinfo.MedinsSetlID
  7138. //// order.ClrOptins = res.Output.Setlinfo.ClrOptins
  7139. //// order.ClrWay = res.Output.Setlinfo.ClrWay
  7140. //// order.Creator = order.Creator
  7141. //// order.Modify = roles.ID
  7142. //// setlDetail, _ := json.Marshal(res.Output.Setldetail)
  7143. //// detailStr := string(setlDetail)
  7144. //// order.SetlDetail = detailStr
  7145. //// //err := service.UpdataOrderStatusTwo(chrg_bchno, adminUser.CurrentOrgId)
  7146. //// err = service.UpDateOrder(order)
  7147. //// if err == nil {
  7148. //// c.ServeSuccessJSON(map[string]interface{}{
  7149. //// "msg": "预结算成功",
  7150. //// })
  7151. //// } else {
  7152. //// c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeAmountAccountException)
  7153. //// return
  7154. //// }
  7155. //// }
  7156. //// } else {
  7157. //// adminUser := c.GetAdminUserInfo()
  7158. //// errlog := &models.HisOrderError{
  7159. //// UserOrgId: adminUser.CurrentOrgId,
  7160. //// Ctime: time.Now().Unix(),
  7161. //// Mtime: time.Now().Unix(),
  7162. //// ErrMsg: res.ErrMsg,
  7163. //// Status: 1,
  7164. //// PatientId: id,
  7165. //// RecordTime: recordDateTime,
  7166. //// Stage: 4,
  7167. //// }
  7168. //// service.CreateErrMsgLog(errlog)
  7169. ////
  7170. //// c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeRegisterRepeatException)
  7171. //// return
  7172. //// }
  7173. //// } else {
  7174. //// adminUser := c.GetAdminUserInfo()
  7175. //// errlog := &models.HisOrderError{
  7176. //// UserOrgId: adminUser.CurrentOrgId,
  7177. //// Ctime: time.Now().Unix(),
  7178. //// Mtime: time.Now().Unix(),
  7179. //// ErrMsg: res.ErrMsg,
  7180. //// Status: 1,
  7181. //// PatientId: id,
  7182. //// RecordTime: recordDateTime,
  7183. //// Stage: 4,
  7184. //// }
  7185. //// service.CreateErrMsgLog(errlog)
  7186. //// c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCalOrderException)
  7187. //// return
  7188. //// }
  7189. ////
  7190. //// } else {
  7191. //// var total float64
  7192. //// for _, item := range prescriptions {
  7193. //// if item.Type == 1 { //药品
  7194. //// for _, subItem := range item.HisDoctorAdviceInfo {
  7195. //// total = total + (subItem.Price * subItem.PrescribingNumber)
  7196. //// }
  7197. //// }
  7198. //// if item.Type == 2 { //项目
  7199. //// for _, subItem := range item.HisPrescriptionProject {
  7200. //// total = total + (subItem.Price * float64(subItem.Count))
  7201. //// }
  7202. //// }
  7203. ////
  7204. //// for _, subItem := range item.HisAdditionalCharge {
  7205. //// total = total + (subItem.Price * float64(subItem.Count))
  7206. //// }
  7207. //// }
  7208. ////
  7209. //// allTotal := fmt.Sprintf("%.2f", total)
  7210. //// totals, _ := strconv.ParseFloat(allTotal, 64)
  7211. //// order := &models.HisOrder{
  7212. //// UserOrgId: adminUser.CurrentOrgId,
  7213. //// HisPatientId: his.ID,
  7214. //// PatientId: id,
  7215. //// SettleAccountsDate: recordDateTime,
  7216. //// Ctime: time.Now().Unix(),
  7217. //// Mtime: time.Now().Unix(),
  7218. //// Status: 1,
  7219. //// OrderStatus: 2,
  7220. //// Number: chrg_bchno,
  7221. //// MedfeeSumamt: totals,
  7222. //// }
  7223. //// err = service.CreateOrder(order)
  7224. //// if err != nil {
  7225. //// c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCreatePreOrderException)
  7226. //// return
  7227. //// }
  7228. ////
  7229. //// var customs []*Custom
  7230. //// for _, item := range prescriptions {
  7231. ////
  7232. //// if item.Type == 1 { //药品
  7233. //// for _, subItem := range item.HisDoctorAdviceInfo {
  7234. //// cus := &Custom{
  7235. //// AdviceId: subItem.ID,
  7236. //// ProjectId: 0,
  7237. //// DetItemFeeSumamt: fmt.Sprintf("%.2f", subItem.Price*subItem.PrescribingNumber),
  7238. //// Cut: fmt.Sprintf("%.2f", subItem.PrescribingNumber),
  7239. //// FeedetlSn: subItem.FeedetlSn,
  7240. //// Price: fmt.Sprintf("%.2f", subItem.Price),
  7241. //// MedListCodg: subItem.MedListCodg,
  7242. //// Type: 1,
  7243. //// }
  7244. //// customs = append(customs, cus)
  7245. //// }
  7246. //// }
  7247. ////
  7248. //// if item.Type == 2 { //项目
  7249. //// for _, subItem := range item.HisPrescriptionProject {
  7250. ////
  7251. //// cus := &Custom{
  7252. //// AdviceId: 0,
  7253. //// ProjectId: subItem.ID,
  7254. //// DetItemFeeSumamt: fmt.Sprintf("%.2f", subItem.Price*float64(subItem.Count)),
  7255. //// Cut: fmt.Sprintf("%.2f", float64(subItem.Count)),
  7256. //// FeedetlSn: subItem.FeedetlSn,
  7257. //// Price: fmt.Sprintf("%.2f", float64(subItem.Price)),
  7258. //// MedListCodg: subItem.MedListCodg,
  7259. //// Type: 2,
  7260. //// }
  7261. ////
  7262. //// customs = append(customs, cus)
  7263. //// }
  7264. //// }
  7265. ////
  7266. //// for _, item := range item.HisAdditionalCharge {
  7267. //// cus := &Custom{
  7268. //// ItemId: item.ID,
  7269. //// AdviceId: 0,
  7270. //// ProjectId: 0,
  7271. //// DetItemFeeSumamt: fmt.Sprintf("%.2f", item.Price),
  7272. //// Cut: fmt.Sprintf("%.2f", float64(item.Count)),
  7273. //// FeedetlSn: item.FeedetlSn,
  7274. //// Price: fmt.Sprintf("%.2f", float64(item.Price)),
  7275. //// MedListCodg: item.XtHisAddtionConfig.Code,
  7276. //// Type: 3,
  7277. //// }
  7278. ////
  7279. //// customs = append(customs, cus)
  7280. //// }
  7281. ////
  7282. //// }
  7283. ////
  7284. //// for _, item := range customs {
  7285. //// var advice_id int64 = 0
  7286. //// var project_id int64 = 0
  7287. //// var item_id int64 = 0
  7288. ////
  7289. //// var types int64 = 0
  7290. ////
  7291. //// if item.Type == 1 {
  7292. //// advice_id = item.AdviceId
  7293. //// project_id = 0
  7294. //// item_id = 0
  7295. //// } else if item.Type == 2 {
  7296. //// advice_id = 0
  7297. //// item_id = 0
  7298. ////
  7299. //// project_id = item.ProjectId
  7300. //// } else if item.Type == 3 {
  7301. //// advice_id = 0
  7302. //// item_id = item.ItemId
  7303. //// project_id = 0
  7304. //// }
  7305. ////
  7306. //// detItemFeeSumamt, _ := strconv.ParseFloat(item.DetItemFeeSumamt, 32)
  7307. //// cut, _ := strconv.ParseFloat(item.Cut, 32)
  7308. //// pric, _ := strconv.ParseFloat(item.Price, 32)
  7309. ////
  7310. //// info := &models.HisOrderInfo{
  7311. //// OrderNumber: order.Number,
  7312. //// UploadDate: time.Now().Unix(),
  7313. //// AdviceId: advice_id,
  7314. //// DetItemFeeSumamt: detItemFeeSumamt,
  7315. //// Cnt: cut,
  7316. //// Pric: pric,
  7317. //// PatientId: id,
  7318. //// Status: 1,
  7319. //// Mtime: time.Now().Unix(),
  7320. //// Ctime: time.Now().Unix(),
  7321. //// UserOrgId: adminUser.CurrentOrgId,
  7322. //// HisPatientId: his.ID,
  7323. //// OrderId: order.ID,
  7324. //// ProjectId: project_id,
  7325. //// Type: types,
  7326. //// ItemId: item_id,
  7327. //// }
  7328. //// service.CreateOrderInfo(info)
  7329. //// }
  7330. //// //err := service.UpDateAddtionNumber(adminUser.CurrentOrgId, ids, chrg_bchno)
  7331. //// err = service.UpDatePrescriptionNumber(adminUser.CurrentOrgId, ids, chrg_bchno)
  7332. //// err = service.UpDatePrescriptionInfoNumber(adminUser.CurrentOrgId, id, chrg_bchno, recordDateTime)
  7333. //// err = service.UpdataOrderStatusTwo(chrg_bchno, adminUser.CurrentOrgId)
  7334. //// if err == nil {
  7335. //// c.ServeSuccessJSON(map[string]interface{}{
  7336. //// "msg": "结算成功",
  7337. //// })
  7338. //// } else {
  7339. //// c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeAmountAccountException)
  7340. //// return
  7341. //// }
  7342. //// }
  7343. ////}
  7344. //
  7345. ////上传明细-预结算-
  7346. //func (c *HisApiController) GetPreUploadInfo() {
  7347. // id, _ := c.GetInt64("id")
  7348. // record_time := c.GetString("record_time")
  7349. // his_patient_id, _ := c.GetInt64("his_patient_id")
  7350. // settle_accounts_type, _ := c.GetInt64("settle_accounts_type")
  7351. // admin_user_id, _ := c.GetInt64("admin_user_id")
  7352. //
  7353. // diagnosis_id := c.GetString("diagnosis")
  7354. // sick_type, _ := c.GetInt64("sick_type")
  7355. // reg_type, _ := c.GetInt64("p_type")
  7356. // begin_time := c.GetString("begin_time")
  7357. //
  7358. // id_str := c.GetString("ids")
  7359. // ids_arr := strings.Split(id_str, ",")
  7360. //
  7361. // timeLayout := "2006-01-02"
  7362. // loc, _ := time.LoadLocation("Local")
  7363. // theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", record_time+" 00:00:00", loc)
  7364. // if err != nil {
  7365. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
  7366. // return
  7367. // }
  7368. // recordDateTime := theTime.Unix()
  7369. // adminUser := c.GetAdminUserInfo()
  7370. //
  7371. // diagnosis_ids := strings.Split(diagnosis_id, ",")
  7372. //
  7373. // var config []*models.HisXtDiagnoseConfig
  7374. // for _, item := range diagnosis_ids {
  7375. // id, _ := strconv.ParseInt(item, 10, 64)
  7376. // diagnosisConfig, _ := service.FindDiagnoseById(id)
  7377. // config = append(config, &diagnosisConfig)
  7378. // }
  7379. // //diagnosisConfig, _ := service.FindDiagnoseById(diagnosis_id)
  7380. //
  7381. // sickConfig, _ := service.FindSickById(sick_type)
  7382. //
  7383. // var prescriptions []*models.HisPrescription
  7384. //
  7385. // var start_time int64
  7386. // var end_time int64
  7387. //
  7388. // roles, _ := service.GetAdminUserInfoByID(adminUser.CurrentOrgId, admin_user_id)
  7389. // fmt.Println(his_patient_id)
  7390. // his, _ := service.GetNewHisPatientInfo(adminUser.CurrentOrgId, his_patient_id, recordDateTime)
  7391. // timestamp := time.Now().Unix()
  7392. // tempTime := time.Unix(timestamp, 0)
  7393. // timeFormat := tempTime.Format("20060102150405")
  7394. // chrgBchno := rand.Intn(100000) + 10000
  7395. // chrg_bchno := timeFormat + strconv.FormatInt(int64(chrgBchno), 10) + strconv.FormatInt(his.PatientId, 10)
  7396. // miConfig, _ := service.FindMedicalInsuranceInfo(adminUser.CurrentOrgId)
  7397. // var patientPrescription models.HisPrescriptionInfo
  7398. // patientPrescription, _ = service.FindHisPatientPrescriptionInfo(adminUser.CurrentOrgId, his_patient_id, recordDateTime)
  7399. // if patientPrescription.ID == 0 {
  7400. // patientPrescription, _ = service.FindLastPatientPrescriptionInfo(adminUser.CurrentOrgId, id, recordDateTime)
  7401. // }
  7402. // //miConfig, _ := service.FindMedicalInsuranceInfo(adminUser.CurrentOrgId)
  7403. // department, _ := service.GetDepartMentDetail(patientPrescription.Departments)
  7404. //
  7405. // doctor_info, _ := service.GetAdminUserInfoByID(adminUser.CurrentOrgId, patientPrescription.DoctorId)
  7406. //
  7407. // strconv.FormatInt(his.PatientId, 10)
  7408. //
  7409. // var res2 ResultSix
  7410. // var resSix10265 ResultSix10265
  7411. // var time_stamp string
  7412. // if miConfig.MdtrtareaAdmvs == "421300" {
  7413. // data := make(map[string]interface{})
  7414. // client := &http.Client{}
  7415. // data["psn_no"] = his.PsnNo
  7416. // data["mdtrt_id"] = his.Number
  7417. // data["doctor"] = roles.UserName
  7418. // data["department"] = department.Name
  7419. // data["org_name"] = miConfig.OrgName
  7420. // data["med_type"] = strconv.FormatInt(reg_type, 10)
  7421. // data["doctor_id"] = strconv.FormatInt(doctor_info.AdminUserId, 10)
  7422. // data["fixmedins_code"] = miConfig.Code
  7423. // data["insuplc_admdvs"] = miConfig.InsuplcAdmdvs
  7424. // data["mdtrtarea_admvs"] = miConfig.MdtrtareaAdmvs
  7425. // data["secret_key"] = miConfig.SecretKey
  7426. // data["sick_code"] = sickConfig.CountryCode
  7427. // data["sick_name"] = sickConfig.ClassName
  7428. // data["begin_time"] = begin_time
  7429. // data["dept"] = strconv.FormatInt(department.ID, 10)
  7430. // data["config"] = config
  7431. //
  7432. // fmt.Println(data)
  7433. //
  7434. // bytesData, _ := json.Marshal(data)
  7435. // req, _ := http.NewRequest("POST", "http://192.168.124.4:9532/"+"hbyb/2203", bytes.NewReader(bytesData))
  7436. // resp, _ := client.Do(req)
  7437. // defer resp.Body.Close()
  7438. // body, ioErr := ioutil.ReadAll(resp.Body)
  7439. // if ioErr != nil {
  7440. // utils.ErrorLog("接口返回数据读取失败: %v", ioErr)
  7441. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  7442. // return
  7443. // }
  7444. // var respJSON map[string]interface{}
  7445. // if err := json.Unmarshal([]byte(body), &respJSON); err != nil {
  7446. // utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
  7447. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  7448. // return
  7449. // }
  7450. //
  7451. // respJSON = respJSON["data"].(map[string]interface{})["pre"].(map[string]interface{})
  7452. // userJSONBytes, _ := json.Marshal(respJSON)
  7453. // fmt.Println("log")
  7454. // fmt.Println(string(userJSONBytes))
  7455. // if err := json.Unmarshal(userJSONBytes, &res2); err != nil {
  7456. // utils.ErrorLog("解析失败:%v", err)
  7457. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  7458. // return
  7459. // }
  7460. //
  7461. // } else if miConfig.MdtrtareaAdmvs == "320921" || miConfig.MdtrtareaAdmvs == "320982" {
  7462. // //江苏地区国家医保医疗类别
  7463. // //职工透析:医疗类别选特殊情况门诊9933
  7464. // //居民血透门慢: 医疗类别选门诊慢病1402
  7465. // //var med_type string
  7466. // //if his.Insutype == "310" {
  7467. // // if reg_type == 14 {
  7468. // // med_type = "9933"
  7469. // // } else if reg_type == 11 {
  7470. // // med_type = "11"
  7471. // //
  7472. // // }
  7473. // //} else if his.Insutype == "390" {
  7474. // // if reg_type == 14 {
  7475. // // med_type = "1402"
  7476. // // } else if reg_type == 11 {
  7477. // // med_type = "11"
  7478. // // }
  7479. // //}
  7480. //
  7481. // data := make(map[string]interface{})
  7482. // client := &http.Client{}
  7483. // data["psn_no"] = his.PsnNo
  7484. // data["mdtrt_id"] = his.Number
  7485. // data["doctor"] = roles.UserName
  7486. // data["department"] = department.Name
  7487. // data["org_name"] = miConfig.OrgName
  7488. // data["med_type"] = strconv.FormatInt(reg_type, 10)
  7489. // data["doctor_id"] = strconv.FormatInt(doctor_info.AdminUserId, 10)
  7490. // data["fixmedins_code"] = miConfig.Code
  7491. // data["insuplc_admdvs"] = his.InsuplcAdmdvs
  7492. // data["mdtrtarea_admvs"] = miConfig.MdtrtareaAdmvs
  7493. // data["secret_key"] = miConfig.SecretKey
  7494. // data["sick_code"] = sickConfig.CountryCode
  7495. // data["sick_name"] = sickConfig.ClassName
  7496. // data["begin_time"] = begin_time
  7497. // data["dept"] = strconv.FormatInt(department.ID, 10)
  7498. // data["config"] = config
  7499. // data["url"] = miConfig.Url
  7500. // data["ak"] = miConfig.AccessKey
  7501. // data["cainfo"] = miConfig.Cainfo
  7502. //
  7503. // bytesData, _ := json.Marshal(data)
  7504. //
  7505. // var req *http.Request
  7506. // if miConfig.MdtrtareaAdmvs == "320921" {
  7507. // req, _ = http.NewRequest("POST", "http://192.168.2.110:9532/"+"jsyb/2203", bytes.NewReader(bytesData))
  7508. //
  7509. // //api = "http://192.168.2.110:9532/" + "jsyb/readcard?" + "fixmedins_code=" + miConfig.Code + "&secret_key=" + miConfig.SecretKey + "&ak=" + miConfig.AccessKey + "&org_name=" + miConfig.OrgName + "&doctor=" + roles.UserName +
  7510. // // "&insuplc_admdvs=" + miConfig.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey + "&url=" + miConfig.Url + "&cainfo=" + miConfig.Cainfo
  7511. //
  7512. // } else {
  7513. // req, _ = http.NewRequest("POST", "http://192.168.5.251:9532/"+"jsyb/2203", bytes.NewReader(bytesData))
  7514. //
  7515. // }
  7516. //
  7517. // resp, _ := client.Do(req)
  7518. // defer resp.Body.Close()
  7519. // body, ioErr := ioutil.ReadAll(resp.Body)
  7520. // if ioErr != nil {
  7521. // utils.ErrorLog("接口返回数据读取失败: %v", ioErr)
  7522. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  7523. // return
  7524. // }
  7525. // var respJSON map[string]interface{}
  7526. // if err := json.Unmarshal([]byte(body), &respJSON); err != nil {
  7527. // utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
  7528. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  7529. // return
  7530. // }
  7531. //
  7532. // time_stamp = strconv.FormatInt(int64(respJSON["data"].(map[string]interface{})["time_stamp"].(float64)), 10)
  7533. //
  7534. // //fmt.Println(respJSON["data"].(map[string]interface{})["time_stamp"].(string))
  7535. // //time_stamp = respJSON["data"].(map[string]interface{})["time_stamp"].(string)
  7536. // respJSON = respJSON["data"].(map[string]interface{})["pre"].(map[string]interface{})
  7537. // userJSONBytes, _ := json.Marshal(respJSON)
  7538. // fmt.Println("log")
  7539. // fmt.Println(string(userJSONBytes))
  7540. // if err := json.Unmarshal(userJSONBytes, &resSix10265); err != nil {
  7541. // utils.ErrorLog("解析失败:%v", err)
  7542. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  7543. // return
  7544. // }
  7545. //
  7546. // res2.InfRefmsgid = resSix10265.InfRefmsgid
  7547. // res2.Output = resSix10265.Output
  7548. // res2.ErrMsg = resSix10265.ErrMsg
  7549. // res2.Cainfo = resSix10265.Cainfo
  7550. // res2.WarnMsg = resSix10265.WarnMsg
  7551. // infocode, _ := strconv.ParseInt(resSix10265.Infcode, 10, 64)
  7552. // res2.Infcode = infocode
  7553. //
  7554. // } else {
  7555. // var result string
  7556. // var requestLog string
  7557. // if miConfig.MdtrtareaAdmvs == "440781" { //
  7558. // 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)
  7559. // } else {
  7560. // if miConfig.Code == "H15049901371" {
  7561. // //赤峰地区国家医保医疗类别
  7562. // //职工透析:医疗类别选特殊情况门诊990502
  7563. // //居民定额血透门慢: 医疗类别选门诊慢病140104
  7564. // var med_type string
  7565. // if his.Insutype == "390" {
  7566. // if reg_type == 14 {
  7567. // med_type = "9933"
  7568. // } else if reg_type == 11 {
  7569. // med_type = "11"
  7570. // }
  7571. // } else if his.Insutype == "310" {
  7572. // if reg_type == 14 {
  7573. // med_type = "990502"
  7574. // } else if reg_type == 11 {
  7575. // med_type = "11"
  7576. // }
  7577. // }
  7578. // result, requestLog = service.Gdyb2203A(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)
  7579. // } else {
  7580. // result, requestLog = service.Gdyb2203(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)
  7581. //
  7582. // }
  7583. // saveLog(result, requestLog, "2203", "上传就诊信息")
  7584. // var respJSON2 map[string]interface{}
  7585. // if err := json.Unmarshal([]byte(string(result)), &respJSON2); err != nil {
  7586. // utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
  7587. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  7588. // return
  7589. // }
  7590. // userJSONBytes2, _ := json.Marshal(respJSON2)
  7591. // if miConfig.Code == "H15049901371" {
  7592. // if err := json.Unmarshal(userJSONBytes2, &resSix10265); err != nil {
  7593. // utils.ErrorLog("解析失败:%v", err)
  7594. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  7595. // return
  7596. // }
  7597. // res2.InfRefmsgid = resSix10265.InfRefmsgid
  7598. // res2.Output = resSix10265.Output
  7599. // res2.ErrMsg = resSix10265.ErrMsg
  7600. // res2.Cainfo = resSix10265.Cainfo
  7601. // res2.WarnMsg = resSix10265.WarnMsg
  7602. // infocode, _ := strconv.ParseInt(resSix10265.Infcode, 10, 64)
  7603. // res2.Infcode = infocode
  7604. // } else {
  7605. // if err := json.Unmarshal(userJSONBytes2, &res2); err != nil {
  7606. // utils.ErrorLog("解析失败:%v", err)
  7607. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  7608. // return
  7609. // }
  7610. // }
  7611. // }
  7612. //
  7613. // }
  7614. //
  7615. // if res2.Infcode != 0 {
  7616. // adminUser := c.GetAdminUserInfo()
  7617. // errlog := &models.HisOrderError{
  7618. // UserOrgId: adminUser.CurrentOrgId,
  7619. // Ctime: time.Now().Unix(),
  7620. // Mtime: time.Now().Unix(),
  7621. // ErrMsg: res2.ErrMsg,
  7622. // Status: 1,
  7623. // PatientId: id,
  7624. // RecordTime: recordDateTime,
  7625. // Stage: 3,
  7626. // }
  7627. // service.CreateErrMsgLog(errlog)
  7628. // c.ServeSuccessJSON(map[string]interface{}{
  7629. // "failed_code": -10,
  7630. // "msg": res2.ErrMsg,
  7631. // })
  7632. // return
  7633. //
  7634. // } else {
  7635. // his.Diagnosis = diagnosis_id
  7636. // his.SickType = sickConfig.ID
  7637. // his.PType = fmt.Sprintf("%d", reg_type)
  7638. // service.UpdateHisPatientThree(&his)
  7639. //
  7640. // data := make(map[string]interface{})
  7641. // if settle_accounts_type == 1 { //日结
  7642. // if reg_type == 11 || reg_type == 1111 || reg_type == 1112 {
  7643. // prescriptions, _ = service.GetPrescriptionByIds(ids_arr, adminUser.CurrentOrgId)
  7644. // } else {
  7645. // prescriptions, _ = service.GetNewHisPrescription(adminUser.CurrentOrgId, his_patient_id, recordDateTime, strconv.Itoa(int(reg_type)))
  7646. // }
  7647. // data["pre"] = prescriptions
  7648. // } else { //月结
  7649. // start_time_str := c.GetString("start_time")
  7650. // end_time_str := c.GetString("end_time")
  7651. // timeLayout := "2006-01-02"
  7652. // loc, _ := time.LoadLocation("Local")
  7653. // theStartTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time_str+" 00:00:00", loc)
  7654. // if err != nil {
  7655. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
  7656. // return
  7657. // }
  7658. // recordStartTime := theStartTime.Unix()
  7659. // start_time = recordStartTime
  7660. // theEndTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time_str+" 00:00:00", loc)
  7661. // if err != nil {
  7662. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
  7663. // return
  7664. // }
  7665. // recordEndTime := theEndTime.Unix()
  7666. // end_time = recordEndTime
  7667. // prescriptions, _ = service.GetMonthHisPrescriptionTwo(adminUser.CurrentOrgId, id, recordStartTime, recordEndTime, reg_type)
  7668. // data["pre"] = prescriptions
  7669. // }
  7670. //
  7671. // client := &http.Client{}
  7672. // data["psn_no"] = his.PsnNo
  7673. // data["mdtrt_id"] = his.Number
  7674. // data["chrg_bchno"] = chrg_bchno
  7675. // data["org_name"] = miConfig.OrgName
  7676. // data["doctor"] = roles.UserName
  7677. // data["doctor_id"] = strconv.FormatInt(roles.AdminUserId, 10)
  7678. // data["dept"] = strconv.FormatInt(patientPrescription.Departments, 10)
  7679. // data["fixmedins_code"] = miConfig.Code
  7680. // data["balance_accounts_type"] = strconv.FormatInt(his.BalanceAccountsType, 10)
  7681. //
  7682. // if (department.ID == 0 && adminUser.CurrentOrgId == 9919) || (department.ID == 0 && adminUser.CurrentOrgId == 10106) {
  7683. // data["dept_code"] = "15"
  7684. // } else {
  7685. // data["dept_code"] = department.Number
  7686. // }
  7687. //
  7688. // data["insuplc_admdvs"] = his.InsuplcAdmdvs
  7689. // data["mdtrtarea_admvs"] = miConfig.MdtrtareaAdmvs
  7690. // data["secret_key"] = miConfig.SecretKey
  7691. // data["url"] = miConfig.Url
  7692. // data["ak"] = miConfig.AccessKey
  7693. // data["new_doctor_name"] = patientPrescription.Doctor
  7694. // data["diag_code"] = sickConfig.CountryCode
  7695. // data["time_stamp"] = time_stamp
  7696. // data["cainfo"] = miConfig.Cainfo
  7697. //
  7698. // var ids []int64
  7699. //
  7700. // for _, item := range prescriptions {
  7701. // ids = append(ids, item.ID)
  7702. // }
  7703. // config, _ := service.GetMedicalInsuranceConfig(adminUser.CurrentOrgId)
  7704. // if config.IsOpen == 1 { //对接了医保,走医保流程
  7705. // var res ResultFour
  7706. // var resFour10265 ResultFour10265
  7707. //
  7708. // if miConfig.MdtrtareaAdmvs == "421300" {
  7709. // bytesData, _ := json.Marshal(data)
  7710. // req, _ := http.NewRequest("POST", "http://192.168.124.4:9532/"+"hbyb/2204", bytes.NewReader(bytesData))
  7711. // resp, _ := client.Do(req)
  7712. // defer resp.Body.Close()
  7713. // body, ioErr := ioutil.ReadAll(resp.Body)
  7714. // if ioErr != nil {
  7715. // utils.ErrorLog("接口返回数据读取失败: %v", ioErr)
  7716. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  7717. // return
  7718. // }
  7719. // var respJSON map[string]interface{}
  7720. // if err := json.Unmarshal([]byte(body), &respJSON); err != nil {
  7721. // utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
  7722. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  7723. // return
  7724. // }
  7725. //
  7726. // respJSON = respJSON["data"].(map[string]interface{})["pre"].(map[string]interface{})
  7727. // userJSONBytes, _ := json.Marshal(respJSON)
  7728. // fmt.Println("log")
  7729. // fmt.Println(string(userJSONBytes))
  7730. // if err := json.Unmarshal(userJSONBytes, &res); err != nil {
  7731. // utils.ErrorLog("解析失败:%v", err)
  7732. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  7733. // return
  7734. // }
  7735. //
  7736. // } else if miConfig.MdtrtareaAdmvs == "320921" || miConfig.MdtrtareaAdmvs == "320982" {
  7737. // bytesData, _ := json.Marshal(data)
  7738. // var req *http.Request
  7739. // if miConfig.MdtrtareaAdmvs == "320921" {
  7740. // req, _ = http.NewRequest("POST", "http://192.168.2.110:9532/"+"jsyb/2204", bytes.NewReader(bytesData))
  7741. //
  7742. // } else {
  7743. // req, _ = http.NewRequest("POST", "http://192.168.5.251:9532/"+"jsyb/2204", bytes.NewReader(bytesData))
  7744. // }
  7745. //
  7746. // resp, _ := client.Do(req)
  7747. // defer resp.Body.Close()
  7748. // body, ioErr := ioutil.ReadAll(resp.Body)
  7749. // if ioErr != nil {
  7750. // utils.ErrorLog("接口返回数据读取失败: %v", ioErr)
  7751. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  7752. // return
  7753. // }
  7754. // var respJSON map[string]interface{}
  7755. // if err := json.Unmarshal([]byte(body), &respJSON); err != nil {
  7756. // utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
  7757. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  7758. // return
  7759. // }
  7760. //
  7761. // respJSON = respJSON["data"].(map[string]interface{})["pre"].(map[string]interface{})
  7762. // userJSONBytes, _ := json.Marshal(respJSON)
  7763. // fmt.Println("log")
  7764. // fmt.Println(string(userJSONBytes))
  7765. // if err := json.Unmarshal(userJSONBytes, &resFour10265); err != nil {
  7766. // utils.ErrorLog("解析失败:%v", err)
  7767. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  7768. // return
  7769. // }
  7770. //
  7771. // res.InfRefmsgid = resFour10265.InfRefmsgid
  7772. // res.Output = resFour10265.Output
  7773. // res.ErrMsg = resFour10265.ErrMsg
  7774. // res.Cainfo = resFour10265.Cainfo
  7775. // res.WarnMsg = resFour10265.WarnMsg
  7776. // infocode, _ := strconv.ParseInt(resFour10265.Infcode, 10, 64)
  7777. // res.Infcode = infocode
  7778. //
  7779. // } else {
  7780. //
  7781. // if miConfig.Code == "H15049901371" {
  7782. // 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)
  7783. // var dat map[string]interface{}
  7784. // if err := json.Unmarshal([]byte(result), &dat); err == nil {
  7785. // fmt.Println(dat)
  7786. // } else {
  7787. // fmt.Println(err)
  7788. // }
  7789. // saveLog(result, request_log, "2204", "上传费用明细")
  7790. //
  7791. // userJSONBytes, _ := json.Marshal(dat)
  7792. //
  7793. // if err := json.Unmarshal(userJSONBytes, &resFour10265); err != nil {
  7794. // utils.ErrorLog("解析失败:%v", err)
  7795. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  7796. // return
  7797. // }
  7798. //
  7799. // res.InfRefmsgid = resFour10265.InfRefmsgid
  7800. // res.Output = resFour10265.Output
  7801. // res.ErrMsg = resFour10265.ErrMsg
  7802. // res.Cainfo = resFour10265.Cainfo
  7803. // res.WarnMsg = resFour10265.WarnMsg
  7804. // infocode, _ := strconv.ParseInt(resFour10265.Infcode, 10, 64)
  7805. // res.Infcode = infocode
  7806. //
  7807. // } else {
  7808. // 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)
  7809. // var dat map[string]interface{}
  7810. // if err := json.Unmarshal([]byte(result), &dat); err == nil {
  7811. // fmt.Println(dat)
  7812. // } else {
  7813. // fmt.Println(err)
  7814. // }
  7815. // saveLog(result, request_log, "2204", "上传费用明细")
  7816. //
  7817. // userJSONBytes, _ := json.Marshal(dat)
  7818. //
  7819. // if err := json.Unmarshal(userJSONBytes, &res); err != nil {
  7820. // utils.ErrorLog("解析失败:%v", err)
  7821. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  7822. // return
  7823. // }
  7824. //
  7825. // }
  7826. //
  7827. // }
  7828. //
  7829. // if res.Infcode == 0 {
  7830. // order := &models.HisOrder{
  7831. // UserOrgId: adminUser.CurrentOrgId,
  7832. // HisPatientId: his.ID,
  7833. // PatientId: his.PatientId,
  7834. // SettleAccountsDate: recordDateTime,
  7835. // Ctime: time.Now().Unix(),
  7836. // Mtime: time.Now().Unix(),
  7837. // MdtrtId: his.Number,
  7838. // PsnNo: his.PsnNo,
  7839. // MedType: strconv.FormatInt(reg_type, 10),
  7840. // Status: 1,
  7841. // Number: chrg_bchno,
  7842. // Infcode: res.Infcode,
  7843. // WarnMsg: res.WarnMsg,
  7844. // Cainfo: res.Cainfo,
  7845. // ErrMsg: res.ErrMsg,
  7846. // RespondTime: res.RefmsgTime,
  7847. // InfRefmsgid: res.InfRefmsgid,
  7848. // OrderStatus: 1,
  7849. // IsMedicineInsurance: 1,
  7850. // SettleType: settle_accounts_type,
  7851. // SettleStartTime: start_time,
  7852. // SettleEndTime: end_time,
  7853. // Creator: roles.AdminUserId,
  7854. // Modify: roles.AdminUserId,
  7855. // PType: 2,
  7856. // Diagnosis: diagnosis_id,
  7857. // }
  7858. //
  7859. // err = service.CreateOrder(order)
  7860. // if err != nil {
  7861. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCreatePreOrderException)
  7862. // return
  7863. // }
  7864. //
  7865. // for _, item := range res.Output.Result {
  7866. // temp := strings.Split(item.FeedetlSn, "-")
  7867. // var advice_id int64 = 0
  7868. // var project_id int64 = 0
  7869. // var types int64 = 0
  7870. //
  7871. // id, _ := strconv.ParseInt(temp[2], 10, 64)
  7872. // types, _ = strconv.ParseInt(temp[1], 10, 64)
  7873. //
  7874. // if temp[1] == "1" {
  7875. // advice_id = id
  7876. // project_id = 0
  7877. // } else if temp[1] == "2" {
  7878. // advice_id = 0
  7879. // project_id = id
  7880. // }
  7881. //
  7882. // info := &models.HisOrderInfo{
  7883. // OrderNumber: order.Number,
  7884. // FeedetlSn: item.FeedetlSn,
  7885. // UploadDate: time.Now().Unix(),
  7886. // AdviceId: advice_id,
  7887. // DetItemFeeSumamt: item.DetItemFeeSumamt,
  7888. // Cnt: item.Cnt,
  7889. // Pric: float64(item.Pric),
  7890. // PatientId: his.PatientId,
  7891. // PricUplmtAmt: item.PricUplmtAmt,
  7892. // SelfpayProp: item.SelfpayProp,
  7893. // FulamtOwnpayAmt: item.FulamtOwnpayAmt,
  7894. // OverlmtAmt: item.OverlmtAmt,
  7895. // PreselfpayAmt: item.PreselfpayAmt,
  7896. // BasMednFlag: item.BasMednFlag,
  7897. // MedChrgitmType: item.MedChrgitmType,
  7898. // HiNegoDrugFlag: item.HiNegoDrugFlag,
  7899. // Status: 1,
  7900. // Memo: item.Memo,
  7901. // Mtime: time.Now().Unix(),
  7902. // InscpScpAmt: item.InscpScpAmt,
  7903. // DrtReimFlag: item.DrtReimFlag,
  7904. // Ctime: time.Now().Unix(),
  7905. // ListSpItemFlag: item.ListSpItemFlag,
  7906. // ChldMedcFlag: item.ChldMedcFlag,
  7907. // LmtUsedFlag: item.LmtUsedFlag,
  7908. // ChrgitmLv: item.ChrgitmLv,
  7909. // UserOrgId: adminUser.CurrentOrgId,
  7910. // HisPatientId: his.ID,
  7911. // OrderId: order.ID,
  7912. // ProjectId: project_id,
  7913. // Type: types,
  7914. // }
  7915. // service.CreateOrderInfo(info)
  7916. //
  7917. // }
  7918. // service.UpDatePrescriptionNumber(adminUser.CurrentOrgId, ids, chrg_bchno)
  7919. // service.UpDateHisPrescriptionInfoNumber(adminUser.CurrentOrgId, his_patient_id, chrg_bchno, recordDateTime)
  7920. //
  7921. // var total float64
  7922. // for _, item := range prescriptions {
  7923. // if item.Type == 1 { //药品
  7924. // for _, subItem := range item.HisDoctorAdviceInfo {
  7925. // total = total + (subItem.Price * subItem.PrescribingNumber)
  7926. // }
  7927. // }
  7928. // if item.Type == 2 { //项目
  7929. //
  7930. // for _, subItem := range item.HisPrescriptionProject {
  7931. // cnt, _ := strconv.ParseFloat(subItem.Count, 64)
  7932. //
  7933. // total = total + (subItem.Price * cnt)
  7934. // }
  7935. // }
  7936. // }
  7937. //
  7938. // for _, item := range prescriptions {
  7939. // for _, subItem := range item.HisAdditionalCharge {
  7940. // total = total + (subItem.Price * float64(subItem.Count))
  7941. // }
  7942. // }
  7943. //
  7944. // allTotal := fmt.Sprintf("%.4f", total)
  7945. // if res.Infcode == 0 {
  7946. // var rf []*ResultFive
  7947. // json.Unmarshal([]byte(his.Iinfo), &rf)
  7948. // chrg_bchno := chrg_bchno
  7949. // cert_no := his.Certno
  7950. //
  7951. // var insutypes []string
  7952. //
  7953. // var insutype string
  7954. // var is390 int = 0
  7955. // var is310 int = 0
  7956. //
  7957. // for _, item := range rf {
  7958. // if (item.Insutype == "390" && item.PsnInsuStas == "1") || (item.Insutype == "310" && item.PsnInsuStas == "1") {
  7959. // insutypes = append(insutypes, item.Insutype)
  7960. // }
  7961. // }
  7962. //
  7963. // if len(insutypes) == 1 {
  7964. // insutype = insutypes[0]
  7965. // } else {
  7966. // for _, i := range insutypes {
  7967. // if i == "390" {
  7968. // is390 = 1
  7969. // }
  7970. //
  7971. // if i == "310" {
  7972. // is310 = 1
  7973. // }
  7974. // }
  7975. // }
  7976. // if is390 == 1 {
  7977. // insutype = "390"
  7978. // }
  7979. //
  7980. // if is310 == 1 {
  7981. // insutype = "310"
  7982. // }
  7983. //
  7984. // if len(insutypes) == 0 {
  7985. // insutype = "310"
  7986. // }
  7987. // if len(insutypes) == 2 {
  7988. // insutype = strconv.FormatInt(his.SocialType, 64)
  7989. // }
  7990. //
  7991. // //insutype = "390"
  7992. // if his.IdCardType == 1 {
  7993. // cert_no = his.MedicalInsuranceNumber
  7994. //
  7995. // } else {
  7996. //
  7997. // cert_no = his.Certno
  7998. //
  7999. // }
  8000. // var res ResultSeven
  8001. // var resSeven10265 ResultSeven10265
  8002. //
  8003. // if miConfig.MdtrtareaAdmvs == "421300" {
  8004. //
  8005. // api := "http://192.168.124.4:9532/" + "hbyb/2206?psn_no=" + his.PsnNo + "&mdtrt_id=" +
  8006. // his.Number + "&chrg_bchno=" + chrg_bchno + "&org_name=" + miConfig.OrgName +
  8007. // "&doctor=" + roles.UserName + "&fixmedins_code=" + miConfig.Code +
  8008. // "&insuplc_admdvs=" + his.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs +
  8009. // "&secret_key=" + miConfig.SecretKey + "&id_card_type=" + strconv.FormatInt(his.IdCardType, 10) +
  8010. // "&certificates=" + strconv.FormatInt(his.IdType, 10) + "&cert_no=" + cert_no +
  8011. // "&insutype=" + insutype + "&total=" + allTotal + "&med_type=" + strconv.FormatInt(reg_type, 10)
  8012. // resp, requestErr := http.Get(api)
  8013. // if requestErr != nil {
  8014. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  8015. // return
  8016. // }
  8017. //
  8018. // body, ioErr := ioutil.ReadAll(resp.Body)
  8019. // if ioErr != nil {
  8020. // utils.ErrorLog("接口返回数据读取失败: %v", ioErr)
  8021. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  8022. // return
  8023. // }
  8024. // var respJSON map[string]interface{}
  8025. // if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
  8026. // utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
  8027. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  8028. // return
  8029. // }
  8030. //
  8031. // respJSON = respJSON["data"].(map[string]interface{})["pre"].(map[string]interface{})
  8032. // result, _ := json.Marshal(respJSON)
  8033. // fmt.Println("log")
  8034. // fmt.Println(string(result))
  8035. // if err := json.Unmarshal([]byte(result), &res); err != nil {
  8036. // utils.ErrorLog("解析失败:%v", err)
  8037. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  8038. // return
  8039. // }
  8040. //
  8041. // } else if miConfig.MdtrtareaAdmvs == "320921" || miConfig.MdtrtareaAdmvs == "320982" {
  8042. // psn_info, _ := service.GetPsnByPatientId(his.PatientId)
  8043. // psn_info.VerifyNumber = strings.Replace(psn_info.VerifyNumber, "+", "%2B", -1)
  8044. //
  8045. // bas := strings.Split(psn_info.CardInfo, "|")
  8046. //
  8047. // if his.IdCardType == 1 {
  8048. // cert_no = bas[2]
  8049. // } else {
  8050. // cert_no = bas[1]
  8051. // }
  8052. // //江苏地区国家医保医疗类别
  8053. // //职工透析:医疗类别选特殊情况门诊9933
  8054. // //居民血透门慢: 医疗类别选门诊慢病1402
  8055. // //var med_type string
  8056. // //if his.Insutype == "310" {
  8057. // // if reg_type == 14 {
  8058. // // med_type = "9933"
  8059. // // } else if reg_type == 11 {
  8060. // // med_type = "11"
  8061. // //
  8062. // // }
  8063. // //} else if his.Insutype == "390" {
  8064. // // if reg_type == 14 {
  8065. // // med_type = "1402"
  8066. // // } else if reg_type == 11 {
  8067. // // med_type = "11"
  8068. // // }
  8069. // //}
  8070. //
  8071. // var api string
  8072. //
  8073. // if miConfig.MdtrtareaAdmvs == "320921" {
  8074. // api = "http://192.168.2.110:9532/" + "jsyb/2206?psn_no=" + his.PsnNo + "&mdtrt_id=" +
  8075. // his.Number + "&chrg_bchno=" + chrg_bchno + "&org_name=" + miConfig.OrgName +
  8076. // "&doctor=" + roles.UserName + "&fixmedins_code=" + miConfig.Code +
  8077. // "&insuplc_admdvs=" + his.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs +
  8078. // "&secret_key=" + miConfig.SecretKey + "&id_card_type=" + strconv.FormatInt(his.IdCardType, 10) +
  8079. // "&certificates=" + strconv.FormatInt(his.IdType, 10) + "&cert_no=" + cert_no +
  8080. // "&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
  8081. //
  8082. // //req, _ = http.NewRequest("POST", "http://192.168.2.110:9532/"+"jsyb/2204", bytes.NewReader(bytesData))
  8083. //
  8084. // } else {
  8085. // //req, _ = http.NewRequest("POST", "http://192.168.5.251:9532/"+"jsyb/2204", bytes.NewReader(bytesData))
  8086. // api = "http://192.168.5.251:9532/" + "jsyb/2206?psn_no=" + his.PsnNo + "&mdtrt_id=" +
  8087. // his.Number + "&chrg_bchno=" + chrg_bchno + "&org_name=" + miConfig.OrgName +
  8088. // "&doctor=" + roles.UserName + "&fixmedins_code=" + miConfig.Code +
  8089. // "&insuplc_admdvs=" + his.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs +
  8090. // "&secret_key=" + miConfig.SecretKey + "&id_card_type=" + strconv.FormatInt(his.IdCardType, 10) +
  8091. // "&certificates=" + strconv.FormatInt(his.IdType, 10) + "&cert_no=" + cert_no +
  8092. // "&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
  8093. //
  8094. // }
  8095. //
  8096. // resp, requestErr := http.Get(api)
  8097. // if requestErr != nil {
  8098. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  8099. // return
  8100. // }
  8101. //
  8102. // body, ioErr := ioutil.ReadAll(resp.Body)
  8103. // if ioErr != nil {
  8104. // utils.ErrorLog("接口返回数据读取失败: %v", ioErr)
  8105. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  8106. // return
  8107. // }
  8108. // var respJSON map[string]interface{}
  8109. // if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
  8110. // utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
  8111. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  8112. // return
  8113. // }
  8114. //
  8115. // respJSON = respJSON["data"].(map[string]interface{})["pre"].(map[string]interface{})
  8116. // result, _ := json.Marshal(respJSON)
  8117. // fmt.Println("log")
  8118. // fmt.Println(string(result))
  8119. // if err := json.Unmarshal([]byte(result), &resSeven10265); err != nil {
  8120. // utils.ErrorLog("解析失败:%v", err)
  8121. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  8122. // return
  8123. // }
  8124. //
  8125. // res.InfRefmsgid = resSeven10265.InfRefmsgid
  8126. // res.Output = resSeven10265.Output
  8127. // res.ErrMsg = resSeven10265.ErrMsg
  8128. // res.Cainfo = resSeven10265.Cainfo
  8129. // res.WarnMsg = resSeven10265.WarnMsg
  8130. // infocode, _ := strconv.ParseInt(resSeven10265.Infcode, 10, 64)
  8131. // res.Infcode = infocode
  8132. //
  8133. // } else {
  8134. //
  8135. // var result string
  8136. // var request_log string
  8137. // if miConfig.Code == "H15049901371" {
  8138. // //赤峰地区国家医保医疗类别
  8139. // //职工透析:医疗类别选特殊情况门诊990502
  8140. // //居民定额血透门慢: 医疗类别选门诊慢病140104
  8141. // var med_type string
  8142. // if his.Insutype == "390" {
  8143. // if reg_type == 14 {
  8144. // med_type = "9933"
  8145. // } else if reg_type == 11 {
  8146. // med_type = "11"
  8147. // }
  8148. // } else if his.Insutype == "310" {
  8149. // if reg_type == 14 {
  8150. // med_type = "990502"
  8151. // } else if reg_type == 11 {
  8152. // med_type = "11"
  8153. // }
  8154. // }
  8155. // 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)
  8156. // } else {
  8157. // 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, strconv.FormatInt(reg_type, 10), his.IdCardType, 0, 0, 0, 0, his.IdType)
  8158. // }
  8159. //
  8160. // var dat map[string]interface{}
  8161. // if err := json.Unmarshal([]byte(result), &dat); err == nil {
  8162. // fmt.Println(dat)
  8163. // } else {
  8164. // fmt.Println(err)
  8165. // }
  8166. // saveLog(result, request_log, "2206", "预结算")
  8167. // //userJSONBytes, _ := json.Marshal(dat)
  8168. // //
  8169. // //if err := json.Unmarshal(userJSONBytes, &res); err != nil {
  8170. // // utils.ErrorLog("解析失败:%v", err)
  8171. // // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  8172. // // return
  8173. // //}
  8174. //
  8175. // userJSONBytes, _ := json.Marshal(dat)
  8176. // if miConfig.Code == "H15049901371" {
  8177. // if err := json.Unmarshal(userJSONBytes, &resSeven10265); err != nil {
  8178. // utils.ErrorLog("解析失败:%v", err)
  8179. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  8180. // return
  8181. // }
  8182. // res.InfRefmsgid = resSeven10265.InfRefmsgid
  8183. // res.Output = resSeven10265.Output
  8184. // res.ErrMsg = resSeven10265.ErrMsg
  8185. // res.Cainfo = resSeven10265.Cainfo
  8186. // res.WarnMsg = resSeven10265.WarnMsg
  8187. // infocode, _ := strconv.ParseInt(resSeven10265.Infcode, 10, 64)
  8188. // res.Infcode = infocode
  8189. // } else {
  8190. // if err := json.Unmarshal(userJSONBytes, &res); err != nil {
  8191. // utils.ErrorLog("解析失败:%v", err)
  8192. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  8193. // return
  8194. // }
  8195. // }
  8196. // }
  8197. //
  8198. // if res.Infcode != 0 {
  8199. // errlog := &models.HisOrderError{
  8200. // UserOrgId: adminUser.CurrentOrgId,
  8201. // Ctime: time.Now().Unix(),
  8202. // Mtime: time.Now().Unix(),
  8203. // Number: chrg_bchno,
  8204. // ErrMsg: res.ErrMsg,
  8205. // Status: 1,
  8206. // PatientId: id,
  8207. // RecordTime: recordDateTime,
  8208. // Stage: 20,
  8209. // }
  8210. // service.CreateErrMsgLog(errlog)
  8211. // c.ServeSuccessJSON(map[string]interface{}{
  8212. // "failed_code": -10,
  8213. // "msg": res.ErrMsg,
  8214. // })
  8215. // return
  8216. // } else {
  8217. // order, _ := service.GetHisOrderTwo(adminUser.CurrentOrgId, chrg_bchno, id)
  8218. // order.OrderStatus = 1
  8219. // order.IsPre = 1
  8220. // order.Status = 1
  8221. // order.MdtrtId = res.Output.Setlinfo.MdtrtID
  8222. // order.SetlId = res.Output.Setlinfo.SetlID
  8223. // order.PsnNo = res.Output.Setlinfo.PsnNo
  8224. // order.PsnName = res.Output.Setlinfo.PsnName
  8225. // order.PsnCertType = res.Output.Setlinfo.PsnCertType
  8226. // order.Certno = res.Output.Setlinfo.Certno
  8227. // order.Gend = res.Output.Setlinfo.Gend
  8228. // order.Naty = res.Output.Setlinfo.Naty
  8229. // order.Age = res.Output.Setlinfo.Age
  8230. // order.Insutype = res.Output.Setlinfo.Insutype
  8231. // order.PsnType = res.Output.Setlinfo.PsnType
  8232. // order.CvlservFlag = res.Output.Setlinfo.CvlservFlag
  8233. // order.SetlTime = res.Output.Setlinfo.SetlTime
  8234. // order.MdtrtCertType = res.Output.Setlinfo.MdtrtCertType
  8235. // if res.Output.Setlinfo.MedType == "140101" {
  8236. // order.MedType = "14"
  8237. //
  8238. // } else {
  8239. // order.MedType = res.Output.Setlinfo.MedType
  8240. // }
  8241. // if reg_type == 1112 {
  8242. // order.MedType = "1112"
  8243. // }
  8244. // if reg_type == 1111 {
  8245. // order.MedType = "1111"
  8246. // }
  8247. // order.MedfeeSumamt = res.Output.Setlinfo.MedfeeSumamt
  8248. // order.FulamtOwnpayAmt = res.Output.Setlinfo.FulamtOwnpayAmt
  8249. // order.OverlmtSelfPay = res.Output.Setlinfo.OverlmtSelfpay
  8250. // order.PreselfpayAmt = res.Output.Setlinfo.PreselfpayAmt
  8251. // order.InscpScpAmt = res.Output.Setlinfo.InscpScpAmt
  8252. // order.ActPayDedc = res.Output.Setlinfo.ActPayDedc
  8253. // order.HifpPay = res.Output.Setlinfo.HifpPay
  8254. // order.CvlservPay = res.Output.Setlinfo.CvlservPay
  8255. // order.PoolPropSelfpay = res.Output.Setlinfo.PoolPropSelfpay
  8256. // order.HifesPay = res.Output.Setlinfo.HifesPay
  8257. // order.HifobPay = res.Output.Setlinfo.HifobPay
  8258. // order.MafPay = res.Output.Setlinfo.MafPay
  8259. // order.HifmiPay = res.Output.Setlinfo.HifmiPay
  8260. // order.OthPay = res.Output.Setlinfo.OthPay
  8261. // order.FundPaySumamt = res.Output.Setlinfo.FundPaySumamt
  8262. // order.PsnPartAmt = res.Output.Setlinfo.PsnPartAmt
  8263. // order.AcctPay = res.Output.Setlinfo.AcctPay
  8264. // order.PsnCashPay = res.Output.Setlinfo.PsnCashPay
  8265. // order.HospPartAmt = res.Output.Setlinfo.HospPartAmt
  8266. // order.Balc = res.Output.Setlinfo.Balc
  8267. // order.AcctMulaidPay = res.Output.Setlinfo.AcctMulaidPay
  8268. // order.MedinsSetlId = res.Output.Setlinfo.MedinsSetlID
  8269. // order.ClrOptins = res.Output.Setlinfo.ClrOptins
  8270. // order.ClrWay = res.Output.Setlinfo.ClrWay
  8271. // order.Creator = order.Creator
  8272. // order.Modify = roles.AdminUserId
  8273. // setlDetail, _ := json.Marshal(res.Output.Setldetail)
  8274. // detailStr := string(setlDetail)
  8275. // order.SetlDetail = detailStr
  8276. // //err := service.UpdataOrderStatusTwo(chrg_bchno, adminUser.CurrentOrgId)
  8277. // err = service.UpDateOrder(order)
  8278. // if err == nil {
  8279. // c.ServeSuccessJSON(map[string]interface{}{
  8280. // "msg": "预结算成功",
  8281. // })
  8282. // } else {
  8283. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeAmountAccountException)
  8284. // return
  8285. // }
  8286. // }
  8287. // } else {
  8288. // adminUser := c.GetAdminUserInfo()
  8289. // errlog := &models.HisOrderError{
  8290. // UserOrgId: adminUser.CurrentOrgId,
  8291. // Ctime: time.Now().Unix(),
  8292. // Mtime: time.Now().Unix(),
  8293. // ErrMsg: res.ErrMsg,
  8294. // Status: 1,
  8295. // PatientId: id,
  8296. // RecordTime: recordDateTime,
  8297. // Stage: 4,
  8298. // }
  8299. // service.CreateErrMsgLog(errlog)
  8300. //
  8301. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeRegisterRepeatException)
  8302. // return
  8303. // }
  8304. // } else {
  8305. // adminUser := c.GetAdminUserInfo()
  8306. // errlog := &models.HisOrderError{
  8307. // UserOrgId: adminUser.CurrentOrgId,
  8308. // Ctime: time.Now().Unix(),
  8309. // Mtime: time.Now().Unix(),
  8310. // ErrMsg: res.ErrMsg,
  8311. // Status: 1,
  8312. // PatientId: id,
  8313. // RecordTime: recordDateTime,
  8314. // Stage: 4,
  8315. // }
  8316. // service.CreateErrMsgLog(errlog)
  8317. // c.ServeSuccessJSON(map[string]interface{}{
  8318. // "failed_code": -10,
  8319. // "msg": res.ErrMsg,
  8320. // })
  8321. // return
  8322. // }
  8323. // }
  8324. // }
  8325. //}
  8326. //
  8327. ////func (c *HisApiController) GetSettleInfo() {
  8328. //// id, _ := c.GetInt64("id")
  8329. //// order_id, _ := c.GetInt64("order_id")
  8330. ////
  8331. //// record_time := c.GetString("record_time")
  8332. //// pay_way, _ := c.GetInt64("pay_way")
  8333. //// pay_price, _ := c.GetFloat("pay_price")
  8334. //// pay_card_no := c.GetString("pay_card_no")
  8335. //// discount_price, _ := c.GetFloat("discount_price")
  8336. //// preferential_price, _ := c.GetFloat("preferential_price")
  8337. //// reality_price, _ := c.GetFloat("reality_price")
  8338. //// found_price, _ := c.GetFloat("found_price")
  8339. //// medical_insurance_price, _ := c.GetFloat("medical_insurance_price")
  8340. //// private_price, _ := c.GetFloat("private_price")
  8341. //// settle_accounts_type, _ := c.GetInt64("settle_accounts_type")
  8342. //// admin_user_id, _ := c.GetInt64("admin_user_id")
  8343. ////
  8344. //// timeLayout := "2006-01-02"
  8345. //// loc, _ := time.LoadLocation("Local")
  8346. //// theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", record_time+" 00:00:00", loc)
  8347. //// if err != nil {
  8348. //// c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
  8349. //// return
  8350. //// }
  8351. //// recordDateTime := theTime.Unix()
  8352. //// adminUser := c.GetAdminUserInfo()
  8353. ////
  8354. //// var prescriptions []*models.HisPrescription
  8355. ////
  8356. //// data := make(map[string]interface{})
  8357. //// if settle_accounts_type == 1 { //日结
  8358. //// prescriptions, _ = service.GetHisPrescription(adminUser.CurrentOrgId, id, recordDateTime)
  8359. //// data["pre"] = prescriptions
  8360. ////
  8361. //// } else { //月结
  8362. //// start_time_str := c.GetString("start_time")
  8363. //// end_time_str := c.GetString("end_time")
  8364. //// timeLayout := "2006-01-02"
  8365. //// loc, _ := time.LoadLocation("Local")
  8366. //// theStartTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time_str+" 00:00:00", loc)
  8367. //// if err != nil {
  8368. //// c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
  8369. //// return
  8370. //// }
  8371. //// recordStartTime := theStartTime.Unix()
  8372. //// theEndTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time_str+" 00:00:00", loc)
  8373. //// if err != nil {
  8374. //// c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
  8375. //// return
  8376. //// }
  8377. //// recordEndTime := theEndTime.Unix()
  8378. //// prescriptions, _ = service.GetMonthHisPrescription(adminUser.CurrentOrgId, id, recordStartTime, recordEndTime)
  8379. //// data["pre"] = prescriptions
  8380. ////
  8381. //// }
  8382. ////
  8383. //// roles, _ := service.GetAdminUserInfoByID(adminUser.CurrentOrgId, admin_user_id)
  8384. ////
  8385. //// his, _ := service.GetVMHisPatientInfo(adminUser.CurrentOrgId, id, recordDateTime)
  8386. //// miConfig, _ := service.FindMedicalInsuranceInfo(adminUser.CurrentOrgId)
  8387. //// patientPrescription, _ := service.FindPatientPrescriptionInfo(adminUser.CurrentOrgId, id, recordDateTime)
  8388. //// strconv.FormatInt(his.PatientId, 10)
  8389. ////
  8390. //// order_src, _ := service.GetHisOrderByID(order_id)
  8391. ////
  8392. //// config, _ := service.GetMedicalInsuranceConfig(adminUser.CurrentOrgId)
  8393. //// if config.IsOpen == 1 { //对接了医保,走医保流程
  8394. ////
  8395. //// var total float64
  8396. //// for _, item := range prescriptions {
  8397. //// if item.Type == 1 { //药品
  8398. //// for _, subItem := range item.HisDoctorAdviceInfo {
  8399. //// total = total + (subItem.Price * subItem.PrescribingNumber)
  8400. //// }
  8401. //// }
  8402. //// if item.Type == 2 { //项目
  8403. //// for _, subItem := range item.HisPrescriptionProject {
  8404. //// total = total + (subItem.Price * float64(subItem.Count))
  8405. //// }
  8406. //// }
  8407. //// }
  8408. ////
  8409. //// for _, item := range prescriptions {
  8410. //// for _, subItem := range item.HisAdditionalCharge {
  8411. //// total = total + (subItem.Price * float64(subItem.Count))
  8412. //// }
  8413. //// }
  8414. ////
  8415. //// allTotal := fmt.Sprintf("%.2f", total)
  8416. //// var rf []*ResultFive
  8417. //// json.Unmarshal([]byte(his.Iinfo), &rf)
  8418. //// psn_no := order_src.PsnNo
  8419. //// mdtrt_id := order_src.MdtrtId
  8420. //// chrg_bchno := order_src.Number
  8421. //// cert_no := order_src.Certno
  8422. //// insutype := rf[0].Insutype
  8423. ////
  8424. //// if his.IdCardType == 1 {
  8425. //// cert_no = his.MedicalInsuranceNumber
  8426. //// } else {
  8427. //// cert_no = his.Certno
  8428. //// }
  8429. ////
  8430. //// 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)
  8431. //// var dat map[string]interface{}
  8432. //// if err := json.Unmarshal([]byte(result), &dat); err == nil {
  8433. //// fmt.Println(dat)
  8434. //// } else {
  8435. //// fmt.Println(err)
  8436. //// }
  8437. ////
  8438. //// userJSONBytes, _ := json.Marshal(dat)
  8439. ////
  8440. ////
  8441. ////
  8442. //// var res ResultSeven
  8443. //// if err := json.Unmarshal(userJSONBytes, &res); err != nil {
  8444. //// utils.ErrorLog("解析失败:%v", err)
  8445. //// c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  8446. //// return
  8447. //// }
  8448. //// if res.Infcode == -1 {
  8449. //// errlog := &models.HisOrderError{
  8450. //// UserOrgId: adminUser.CurrentOrgId,
  8451. //// Ctime: time.Now().Unix(),
  8452. //// Mtime: time.Now().Unix(),
  8453. //// Number: chrg_bchno,
  8454. //// ErrMsg: res.ErrMsg,
  8455. //// Status: 1,
  8456. //// PatientId: id,
  8457. //// RecordTime: recordDateTime,
  8458. //// Stage: 6,
  8459. //// }
  8460. //// service.CreateErrMsgLog(errlog)
  8461. //// c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeRegisterRepeatException)
  8462. //// return
  8463. //// } else {
  8464. //// order_src.OrderStatus = 2
  8465. //// order_src.PayWay = pay_way
  8466. //// order_src.PayPrice = pay_price
  8467. //// order_src.PayCardNo = pay_card_no
  8468. //// order_src.DiscountPrice = discount_price
  8469. //// order_src.PreferentialPrice = preferential_price
  8470. //// order_src.RealityPrice = reality_price
  8471. //// order_src.FoundPrice = found_price
  8472. //// order_src.MedicalInsurancePrice = medical_insurance_price
  8473. //// order_src.PrivatePrice = private_price
  8474. //// order_src.MdtrtId = res.Output.Setlinfo.MdtrtID
  8475. //// order_src.SetlId = res.Output.Setlinfo.SetlID
  8476. //// order_src.PsnNo = res.Output.Setlinfo.PsnNo
  8477. //// order_src.PsnName = res.Output.Setlinfo.PsnName
  8478. //// order_src.PsnCertType = res.Output.Setlinfo.PsnCertType
  8479. //// order_src.Certno = res.Output.Setlinfo.Certno
  8480. //// order_src.Gend = res.Output.Setlinfo.Gend
  8481. //// order_src.Naty = res.Output.Setlinfo.Naty
  8482. //// order_src.Age = res.Output.Setlinfo.Age
  8483. //// order_src.Insutype = res.Output.Setlinfo.Insutype
  8484. //// order_src.PsnType = res.Output.Setlinfo.PsnType
  8485. //// order_src.CvlservFlag = res.Output.Setlinfo.CvlservFlag
  8486. //// order_src.SetlTime = res.Output.Setlinfo.SetlTime
  8487. //// order_src.MdtrtCertType = res.Output.Setlinfo.MdtrtCertType
  8488. //// order_src.MedType = res.Output.Setlinfo.MedType
  8489. //// order_src.MedfeeSumamt = res.Output.Setlinfo.MedfeeSumamt
  8490. //// order_src.FulamtOwnpayAmt = res.Output.Setlinfo.FulamtOwnpayAmt
  8491. //// order_src.OverlmtSelfPay = res.Output.Setlinfo.OverlmtSelfpay
  8492. //// order_src.PreselfpayAmt = res.Output.Setlinfo.PreselfpayAmt
  8493. //// order_src.InscpScpAmt = res.Output.Setlinfo.InscpScpAmt
  8494. //// order_src.ActPayDedc = res.Output.Setlinfo.ActPayDedc
  8495. //// order_src.HifpPay = res.Output.Setlinfo.HifpPay
  8496. //// order_src.CvlservPay = res.Output.Setlinfo.CvlservPay
  8497. //// order_src.PoolPropSelfpay = res.Output.Setlinfo.PoolPropSelfpay
  8498. //// order_src.HifesPay = res.Output.Setlinfo.HifesPay
  8499. //// order_src.HifobPay = res.Output.Setlinfo.HifobPay
  8500. //// order_src.MafPay = res.Output.Setlinfo.MafPay
  8501. //// order_src.OthPay = res.Output.Setlinfo.OthPay
  8502. //// order_src.FundPaySumamt = res.Output.Setlinfo.FundPaySumamt
  8503. //// order_src.PsnPartAmt = res.Output.Setlinfo.PsnPartAmt
  8504. //// order_src.AcctPay = res.Output.Setlinfo.AcctPay
  8505. //// order_src.PsnCashPay = res.Output.Setlinfo.PsnCashPay
  8506. //// order_src.HospPartAmt = res.Output.Setlinfo.HospPartAmt
  8507. //// order_src.Balc = res.Output.Setlinfo.Balc
  8508. //// order_src.AcctMulaidPay = res.Output.Setlinfo.AcctMulaidPay
  8509. //// order_src.MedinsSetlId = res.Output.Setlinfo.MedinsSetlID
  8510. //// order_src.ClrOptins = res.Output.Setlinfo.ClrOptins
  8511. //// order_src.ClrWay = res.Output.Setlinfo.ClrWay
  8512. //// order_src.Creator = order_src.Creator
  8513. //// order_src.Modify = roles.ID
  8514. //// order_src.RequestLog = src_resquest
  8515. //// setlDetail, _ := json.Marshal(res.Output.Setldetail)
  8516. //// detailStr := string(setlDetail)
  8517. //// order_src.SetlDetail = detailStr
  8518. //// err = service.UpdataOrderStatusTwo(chrg_bchno, adminUser.CurrentOrgId)
  8519. //// err = service.UpDateOrder(order_src)
  8520. ////
  8521. //// if err == nil {
  8522. //// c.ServeSuccessJSON(map[string]interface{}{
  8523. //// "msg": "结算成功",
  8524. //// })
  8525. //// } else {
  8526. //// c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeAmountAccountException)
  8527. //// return
  8528. //// }
  8529. //// }
  8530. //// }
  8531. ////}
  8532. //
  8533. ////退款
  8534. //func (c *HisApiController) Refund() {
  8535. // order_id, _ := c.GetInt64("order_id")
  8536. // admin_user_id, _ := c.GetInt64("admin_user_id")
  8537. // adminUser := c.GetAdminUserInfo()
  8538. // var order models.HisOrder
  8539. // order, _ = service.GetHisOrderByID(order_id)
  8540. // roles, _ := service.GetAdminUserInfoByID(adminUser.CurrentOrgId, admin_user_id)
  8541. // if order.ID == 0 {
  8542. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
  8543. // return
  8544. // }
  8545. // his, _ := service.GetHisPatientByNumber(order.MdtrtId)
  8546. //
  8547. // miConfig, _ := service.FindMedicalInsuranceInfo(adminUser.CurrentOrgId)
  8548. // config, _ := service.GetMedicalInsuranceConfig(adminUser.CurrentOrgId)
  8549. // if config.IsOpen == 1 { //对接了医保,走医保流程
  8550. // var res ResultSixteen
  8551. // var resSixteen10265 ResultSixteen10265
  8552. // var src_resquest string
  8553. // var result string
  8554. //
  8555. // if miConfig.MdtrtareaAdmvs == "421300" {
  8556. // api3 := "http://192.168.124.4:9532/" + "hbyb/2208?psn_no=" + order.PsnNo +
  8557. // "&mdtrt_id=" + order.MdtrtId + "&setl_id=" + order.SetlId + "&doctor=" + roles.UserName + "&org_name=" + miConfig.OrgName + "&fixmedins_code=" + miConfig.Code +
  8558. // "&insuplc_admdvs=" + miConfig.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey
  8559. // resp3, requestErr3 := http.Get(api3)
  8560. // if requestErr3 != nil {
  8561. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  8562. // return
  8563. // }
  8564. // body3, ioErr3 := ioutil.ReadAll(resp3.Body)
  8565. // if ioErr3 != nil {
  8566. // utils.ErrorLog("接口返回数据读取失败: %v", ioErr3)
  8567. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  8568. // return
  8569. // }
  8570. // var respJSON3 map[string]interface{}
  8571. // if err := json.Unmarshal([]byte(string(body3)), &respJSON3); err != nil {
  8572. // utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
  8573. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  8574. // return
  8575. // }
  8576. //
  8577. // respJSON3 = respJSON3["data"].(map[string]interface{})["pre"].(map[string]interface{})
  8578. // userJSONBytes3, _ := json.Marshal(respJSON3)
  8579. // fmt.Println("log")
  8580. // fmt.Println(string(userJSONBytes3))
  8581. // if err := json.Unmarshal(userJSONBytes3, &res); err != nil {
  8582. // utils.ErrorLog("解析失败:%v", err)
  8583. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  8584. // return
  8585. // }
  8586. //
  8587. // } else if miConfig.MdtrtareaAdmvs == "320921" || miConfig.MdtrtareaAdmvs == "320982" {
  8588. //
  8589. // var api3 string
  8590. // if miConfig.MdtrtareaAdmvs == "320921" {
  8591. // api3 = "http://192.168.2.110:9532/" + "jsyb/2208?psn_no=" + order.PsnNo +
  8592. // "&mdtrt_id=" + order.MdtrtId + "&setl_id=" + order.SetlId + "&doctor=" + roles.UserName + "&org_name=" + miConfig.OrgName + "&fixmedins_code=" + miConfig.Code +
  8593. // "&insuplc_admdvs=" + miConfig.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey + "&url=" + miConfig.Url + "&ak=" + miConfig.AccessKey + "&cainfo=" + miConfig.Cainfo
  8594. //
  8595. // //req, _ = http.NewRequest("POST", "http://192.168.2.110:9532/"+"jsyb/2204", bytes.NewReader(bytesData))
  8596. //
  8597. // } else {
  8598. // //req, _ = http.NewRequest("POST", "http://192.168.5.251:9532/"+"jsyb/2204", bytes.NewReader(bytesData))
  8599. // api3 = "http://192.168.5.251:9532/" + "jsyb/2208?psn_no=" + order.PsnNo +
  8600. // "&mdtrt_id=" + order.MdtrtId + "&setl_id=" + order.SetlId + "&doctor=" + roles.UserName + "&org_name=" + miConfig.OrgName + "&fixmedins_code=" + miConfig.Code +
  8601. // "&insuplc_admdvs=" + miConfig.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey + "&url=" + miConfig.Url + "&ak=" + miConfig.AccessKey + "&cainfo=" + miConfig.Cainfo
  8602. //
  8603. // }
  8604. //
  8605. // resp3, requestErr3 := http.Get(api3)
  8606. // if requestErr3 != nil {
  8607. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  8608. // return
  8609. // }
  8610. // body3, ioErr3 := ioutil.ReadAll(resp3.Body)
  8611. // if ioErr3 != nil {
  8612. // utils.ErrorLog("接口返回数据读取失败: %v", ioErr3)
  8613. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  8614. // return
  8615. // }
  8616. // var respJSON3 map[string]interface{}
  8617. // if err := json.Unmarshal([]byte(string(body3)), &respJSON3); err != nil {
  8618. // utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
  8619. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  8620. // return
  8621. // }
  8622. //
  8623. // respJSON3 = respJSON3["data"].(map[string]interface{})["pre"].(map[string]interface{})
  8624. // userJSONBytes3, _ := json.Marshal(respJSON3)
  8625. // if err := json.Unmarshal(userJSONBytes3, &resSixteen10265); err != nil {
  8626. // utils.ErrorLog("解析失败:%v", err)
  8627. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  8628. // return
  8629. // }
  8630. //
  8631. // res.InfRefmsgid = resSixteen10265.InfRefmsgid
  8632. // res.Output = resSixteen10265.Output
  8633. // res.ErrMsg = resSixteen10265.ErrMsg
  8634. // res.Cainfo = resSixteen10265.Cainfo
  8635. // res.WarnMsg = resSixteen10265.WarnMsg
  8636. // infocode, _ := strconv.ParseInt(resSixteen10265.Infcode, 10, 64)
  8637. // res.Infcode = infocode
  8638. //
  8639. // } else {
  8640. //
  8641. // if miConfig.Code == "H15049901371" {
  8642. // result, src_resquest = service.Gdyb2208(order.PsnNo, order.MdtrtId, order.SetlId, miConfig.OrgName, roles.UserName, miConfig.SecretKey, miConfig.Code, his.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs)
  8643. // var dat map[string]interface{}
  8644. // if err := json.Unmarshal([]byte(result), &dat); err == nil {
  8645. // fmt.Println(dat)
  8646. // } else {
  8647. // fmt.Println(err)
  8648. // }
  8649. // saveLog(result, src_resquest, "2208", "退费")
  8650. //
  8651. // userJSONBytes, _ := json.Marshal(dat)
  8652. //
  8653. // if err := json.Unmarshal(userJSONBytes, &resSixteen10265); err != nil {
  8654. // utils.ErrorLog("解析失败:%v", err)
  8655. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  8656. // return
  8657. // }
  8658. // res.InfRefmsgid = resSixteen10265.InfRefmsgid
  8659. // res.Output = resSixteen10265.Output
  8660. // res.ErrMsg = resSixteen10265.ErrMsg
  8661. // res.Cainfo = resSixteen10265.Cainfo
  8662. // res.WarnMsg = resSixteen10265.WarnMsg
  8663. // infocode, _ := strconv.ParseInt(resSixteen10265.Infcode, 10, 64)
  8664. // res.Infcode = infocode
  8665. // } else {
  8666. // result, src_resquest = service.Gdyb2208(order.PsnNo, order.MdtrtId, order.SetlId, miConfig.OrgName, roles.UserName, miConfig.SecretKey, miConfig.Code, his.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs)
  8667. // var dat map[string]interface{}
  8668. // if err := json.Unmarshal([]byte(result), &dat); err == nil {
  8669. // fmt.Println(dat)
  8670. // } else {
  8671. // fmt.Println(err)
  8672. // }
  8673. // saveLog(result, src_resquest, "2208", "退费")
  8674. //
  8675. // userJSONBytes, _ := json.Marshal(dat)
  8676. // if err := json.Unmarshal(userJSONBytes, &res); err != nil {
  8677. // utils.ErrorLog("解析失败:%v", err)
  8678. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  8679. // return
  8680. // }
  8681. //
  8682. // }
  8683. //
  8684. // }
  8685. //
  8686. // if res.Infcode == 0 {
  8687. // var res2 ResultSix
  8688. // var resSix10265 ResultSix10265
  8689. //
  8690. // if miConfig.MdtrtareaAdmvs == "421300" {
  8691. //
  8692. // api3 := "http://192.168.124.4:9532/" + "hbyb/2205?psn_no=" + order.PsnNo +
  8693. // "&mdtrt_id=" + order.MdtrtId + "&chrg_bchno=" + order.Number + "&doctor=" + roles.UserName + "&org_name=" + miConfig.OrgName + "&fixmedins_code=" + miConfig.Code +
  8694. // "&insuplc_admdvs=" + his.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey
  8695. // resp3, requestErr3 := http.Get(api3)
  8696. // if requestErr3 != nil {
  8697. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  8698. // return
  8699. // }
  8700. // body3, ioErr3 := ioutil.ReadAll(resp3.Body)
  8701. // if ioErr3 != nil {
  8702. // utils.ErrorLog("接口返回数据读取失败: %v", ioErr3)
  8703. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  8704. // return
  8705. // }
  8706. // var respJSON3 map[string]interface{}
  8707. // if err := json.Unmarshal([]byte(string(body3)), &respJSON3); err != nil {
  8708. // utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
  8709. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  8710. // return
  8711. // }
  8712. //
  8713. // respJSON3 = respJSON3["data"].(map[string]interface{})["pre"].(map[string]interface{})
  8714. // userJSONBytes3, _ := json.Marshal(respJSON3)
  8715. // fmt.Println("log")
  8716. // fmt.Println(string(userJSONBytes3))
  8717. // if err := json.Unmarshal(userJSONBytes3, &res2); err != nil {
  8718. // utils.ErrorLog("解析失败:%v", err)
  8719. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  8720. // return
  8721. // }
  8722. //
  8723. // } else if miConfig.MdtrtareaAdmvs == "320921" || miConfig.MdtrtareaAdmvs == "320982" {
  8724. // var api3 string
  8725. // if miConfig.MdtrtareaAdmvs == "320921" {
  8726. // api3 = "http://192.168.2.110:9532/" + "jsyb/2205?psn_no=" + order.PsnNo +
  8727. // "&mdtrt_id=" + order.MdtrtId + "&chrg_bchno=" + order.Number + "&doctor=" + roles.UserName + "&org_name=" + miConfig.OrgName + "&fixmedins_code=" + miConfig.Code +
  8728. // "&insuplc_admdvs=" + his.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey + "&url=" + miConfig.Url + "&ak=" + miConfig.AccessKey + "&cainfo=" + miConfig.Cainfo
  8729. //
  8730. // //req, _ = http.NewRequest("POST", "http://192.168.2.110:9532/"+"jsyb/2204", bytes.NewReader(bytesData))
  8731. //
  8732. // } else {
  8733. // //req, _ = http.NewRequest("POST", "http://192.168.5.251:9532/"+"jsyb/2204", bytes.NewReader(bytesData))
  8734. // api3 = "http://192.168.5.251:9532/" + "jsyb/2205?psn_no=" + order.PsnNo +
  8735. // "&mdtrt_id=" + order.MdtrtId + "&chrg_bchno=" + order.Number + "&doctor=" + roles.UserName + "&org_name=" + miConfig.OrgName + "&fixmedins_code=" + miConfig.Code +
  8736. // "&insuplc_admdvs=" + his.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey + "&url=" + miConfig.Url + "&ak=" + miConfig.AccessKey + "&cainfo=" + miConfig.Cainfo
  8737. //
  8738. // }
  8739. //
  8740. // resp3, requestErr3 := http.Get(api3)
  8741. // if requestErr3 != nil {
  8742. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  8743. // return
  8744. // }
  8745. // body3, ioErr3 := ioutil.ReadAll(resp3.Body)
  8746. // if ioErr3 != nil {
  8747. // utils.ErrorLog("接口返回数据读取失败: %v", ioErr3)
  8748. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  8749. // return
  8750. // }
  8751. // var respJSON3 map[string]interface{}
  8752. // if err := json.Unmarshal([]byte(string(body3)), &respJSON3); err != nil {
  8753. // utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
  8754. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  8755. // return
  8756. // }
  8757. //
  8758. // respJSON3 = respJSON3["data"].(map[string]interface{})["pre"].(map[string]interface{})
  8759. // userJSONBytes3, _ := json.Marshal(respJSON3)
  8760. // fmt.Println("log")
  8761. // fmt.Println(string(userJSONBytes3))
  8762. // if err := json.Unmarshal(userJSONBytes3, &resSix10265); err != nil {
  8763. // utils.ErrorLog("解析失败:%v", err)
  8764. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  8765. // return
  8766. // }
  8767. //
  8768. // res2.InfRefmsgid = resSix10265.InfRefmsgid
  8769. // res2.Output = resSix10265.Output
  8770. // res2.ErrMsg = resSix10265.ErrMsg
  8771. // res2.Cainfo = resSix10265.Cainfo
  8772. // res2.WarnMsg = resSix10265.WarnMsg
  8773. // infocode, _ := strconv.ParseInt(resSix10265.Infcode, 10, 64)
  8774. // res2.Infcode = infocode
  8775. //
  8776. // } else {
  8777. //
  8778. // if miConfig.Code == "H15049901371" {
  8779. // result2, src_request := service.Gdyb2205(order.PsnNo, order.MdtrtId, order.Number, miConfig.OrgName, roles.UserName, his.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, miConfig.Code)
  8780. // var dat map[string]interface{}
  8781. // if err := json.Unmarshal([]byte(result2), &dat); err == nil {
  8782. // fmt.Println(dat)
  8783. // } else {
  8784. // fmt.Println(err)
  8785. // }
  8786. //
  8787. // saveLog(result2, src_request, "2205", "撤销明细")
  8788. // userJSONBytes, _ := json.Marshal(dat)
  8789. // if err := json.Unmarshal(userJSONBytes, &resSix10265); err != nil {
  8790. // utils.ErrorLog("解析失败:%v", err)
  8791. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  8792. // return
  8793. // }
  8794. // res2.InfRefmsgid = resSix10265.InfRefmsgid
  8795. // res2.Output = resSix10265.Output
  8796. // res2.ErrMsg = resSix10265.ErrMsg
  8797. // res2.Cainfo = resSix10265.Cainfo
  8798. // res2.WarnMsg = resSix10265.WarnMsg
  8799. // infocode, _ := strconv.ParseInt(resSix10265.Infcode, 10, 64)
  8800. // res2.Infcode = infocode
  8801. // } else {
  8802. // result2, src_request := service.Gdyb2205(order.PsnNo, order.MdtrtId, order.Number, miConfig.OrgName, roles.UserName, his.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, miConfig.Code)
  8803. // var dat map[string]interface{}
  8804. // if err := json.Unmarshal([]byte(result2), &dat); err == nil {
  8805. // fmt.Println(dat)
  8806. // } else {
  8807. // fmt.Println(err)
  8808. // }
  8809. //
  8810. // saveLog(result2, src_request, "2205", "撤销明细")
  8811. // userJSONBytes, _ := json.Marshal(dat)
  8812. // if err := json.Unmarshal(userJSONBytes, &res2); err != nil {
  8813. // utils.ErrorLog("解析失败:%v", err)
  8814. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  8815. // return
  8816. // }
  8817. //
  8818. // }
  8819. //
  8820. // }
  8821. //
  8822. // if res2.Infcode == 0 {
  8823. // err := service.UpdataOrderStatus(order_id, order.Number, adminUser.CurrentOrgId, src_resquest, result)
  8824. // if err == nil {
  8825. // //当押金不为零时产生退费记录
  8826. // if order.Decimal != 0 {
  8827. // tmp := strconv.FormatInt(order.ID, 10)
  8828. // err = service.MoneyIncrease(adminUser.CurrentOrgId, order.PatientId, tmp, order.Decimal)
  8829. // if err != nil {
  8830. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  8831. // return
  8832. // }
  8833. // }
  8834. // c.ServeSuccessJSON(map[string]interface{}{
  8835. // "msg": "退费成功",
  8836. // })
  8837. // } else {
  8838. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  8839. // return
  8840. // }
  8841. // } else {
  8842. // c.ServeSuccessJSON(map[string]interface{}{
  8843. // "code": -10,
  8844. // "msg": res2.ErrMsg,
  8845. // })
  8846. // }
  8847. // } else {
  8848. // c.ServeSuccessJSON(map[string]interface{}{
  8849. // "code": -10,
  8850. // "msg": res.ErrMsg,
  8851. // })
  8852. // }
  8853. // }
  8854. //}
  8855. //
  8856. //func (c *HisApiController) RefundNumber() {
  8857. // record_time := c.GetString("record_time")
  8858. // //patient_id, _ := c.GetInt64("patient_id")
  8859. // admin_user_id, _ := c.GetInt64("admin_user_id")
  8860. // his_patient_id, _ := c.GetInt64("id")
  8861. //
  8862. // timeLayout := "2006-01-02"
  8863. // loc, _ := time.LoadLocation("Local")
  8864. // adminUser := c.GetAdminUserInfo()
  8865. // theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", record_time+" 00:00:00", loc)
  8866. // fmt.Println(err)
  8867. // if err != nil {
  8868. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
  8869. // return
  8870. // }
  8871. // recordDateTime := theTime.Unix()
  8872. // //his, _ := service.GetVMHisPatientInfo(adminUser.CurrentOrgId, patient_id, recordDateTime)
  8873. //
  8874. // his, _ := service.GetHisPatientRecord(adminUser.CurrentOrgId, his_patient_id)
  8875. // //patientPrescription, _ := service.FindPatientPrescriptionInfo(adminUser.CurrentOrgId, patient_id, recordDateTime)
  8876. // //order, _ := service.GetHisOrderByID(order_id)
  8877. // miConfig, _ := service.FindMedicalInsuranceInfo(adminUser.CurrentOrgId)
  8878. // config, _ := service.GetMedicalInsuranceConfig(adminUser.CurrentOrgId)
  8879. // roles, _ := service.GetAdminUserInfoByID(adminUser.CurrentOrgId, admin_user_id)
  8880. //
  8881. // count, _ := service.GetOrderCountByNumber(adminUser.CurrentOrgId, his.PatientId, recordDateTime, his.Number)
  8882. //
  8883. // if count > 0 {
  8884. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeOrderParamWrong)
  8885. // return
  8886. // }
  8887. //
  8888. // if config.IsOpen == 1 { //对接了医保,走医保流程
  8889. // var res2 ResultSix
  8890. // var resSix10265 ResultSix10265
  8891. //
  8892. // if miConfig.MdtrtareaAdmvs == "421300" {
  8893. //
  8894. // api3 := "http://192.168.124.4:9532/" + "hbyb/2202?psn_no=" + his.PsnNo +
  8895. // "&mdtrt_id=" + his.Number + "&ipt_otp_no=" + his.IptOtpNo + "&doctor=" + roles.UserName + "&org_name=" + miConfig.OrgName + "&fixmedins_code=" + miConfig.Code +
  8896. // "&insuplc_admdvs=" + his.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey
  8897. // resp3, requestErr3 := http.Get(api3)
  8898. // if requestErr3 != nil {
  8899. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  8900. // return
  8901. // }
  8902. //
  8903. // body3, ioErr3 := ioutil.ReadAll(resp3.Body)
  8904. // if ioErr3 != nil {
  8905. // utils.ErrorLog("接口返回数据读取失败: %v", ioErr3)
  8906. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  8907. // return
  8908. // }
  8909. // var respJSON3 map[string]interface{}
  8910. // if err := json.Unmarshal([]byte(string(body3)), &respJSON3); err != nil {
  8911. // utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
  8912. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  8913. // return
  8914. // }
  8915. //
  8916. // respJSON3 = respJSON3["data"].(map[string]interface{})["pre"].(map[string]interface{})
  8917. // userJSONBytes3, _ := json.Marshal(respJSON3)
  8918. // fmt.Println("log")
  8919. // fmt.Println(string(userJSONBytes3))
  8920. // if err := json.Unmarshal(userJSONBytes3, &res2); err != nil {
  8921. // utils.ErrorLog("解析失败:%v", err)
  8922. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  8923. // return
  8924. // }
  8925. //
  8926. // } else if miConfig.MdtrtareaAdmvs == "320921" || miConfig.MdtrtareaAdmvs == "320982" {
  8927. // var api3 string
  8928. // if miConfig.MdtrtareaAdmvs == "320921" {
  8929. // api3 = "http://192.168.2.110:9532/" + "jsyb/2202?psn_no=" + his.PsnNo +
  8930. // "&mdtrt_id=" + his.Number + "&ipt_otp_no=" + his.IptOtpNo + "&doctor=" + roles.UserName + "&org_name=" + miConfig.OrgName + "&fixmedins_code=" + miConfig.Code +
  8931. // "&insuplc_admdvs=" + his.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey + "&url=" + miConfig.Url + "&ak=" + miConfig.AccessKey + "&cainfo=" + miConfig.Cainfo
  8932. //
  8933. // //req, _ = http.NewRequest("POST", "http://192.168.2.110:9532/"+"jsyb/2204", bytes.NewReader(bytesData))
  8934. //
  8935. // } else {
  8936. // //req, _ = http.NewRequest("POST", "http://192.168.5.251:9532/"+"jsyb/2204", bytes.NewReader(bytesData))
  8937. // api3 = "http://192.168.5.251:9532/" + "jsyb/2202?psn_no=" + his.PsnNo +
  8938. // "&mdtrt_id=" + his.Number + "&ipt_otp_no=" + his.IptOtpNo + "&doctor=" + roles.UserName + "&org_name=" + miConfig.OrgName + "&fixmedins_code=" + miConfig.Code +
  8939. // "&insuplc_admdvs=" + his.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey + "&url=" + miConfig.Url + "&ak=" + miConfig.AccessKey + "&cainfo=" + miConfig.Cainfo
  8940. // }
  8941. //
  8942. // resp3, requestErr3 := http.Get(api3)
  8943. // if requestErr3 != nil {
  8944. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  8945. // return
  8946. // }
  8947. //
  8948. // body3, ioErr3 := ioutil.ReadAll(resp3.Body)
  8949. // if ioErr3 != nil {
  8950. // utils.ErrorLog("接口返回数据读取失败: %v", ioErr3)
  8951. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  8952. // return
  8953. // }
  8954. // var respJSON3 map[string]interface{}
  8955. // if err := json.Unmarshal([]byte(string(body3)), &respJSON3); err != nil {
  8956. // utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
  8957. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  8958. // return
  8959. // }
  8960. //
  8961. // respJSON3 = respJSON3["data"].(map[string]interface{})["pre"].(map[string]interface{})
  8962. // userJSONBytes3, _ := json.Marshal(respJSON3)
  8963. // if err := json.Unmarshal(userJSONBytes3, &resSix10265); err != nil {
  8964. // utils.ErrorLog("解析失败:%v", err)
  8965. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  8966. // return
  8967. // }
  8968. //
  8969. // res2.InfRefmsgid = resSix10265.InfRefmsgid
  8970. // res2.Output = resSix10265.Output
  8971. // res2.ErrMsg = resSix10265.ErrMsg
  8972. // res2.Cainfo = resSix10265.Cainfo
  8973. // res2.WarnMsg = resSix10265.WarnMsg
  8974. // infocode, _ := strconv.ParseInt(resSix10265.Infcode, 10, 64)
  8975. // res2.Infcode = infocode
  8976. //
  8977. // } else {
  8978. // var api3 string
  8979. //
  8980. // if miConfig.Code == "H15049901371" {
  8981. //
  8982. // api3 = "http://127.0.0.1:9532/" + "gdyb/three?psn_no=" + his.PsnNo +
  8983. // "&mdtrt_id=" + his.Number + "&ipt_otp_no=" + his.IptOtpNo + "&doctor=" + roles.UserName + "&org_name=" + miConfig.OrgName + "&fixmedins_code=" + miConfig.Code +
  8984. // "&insuplc_admdvs=" + his.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey
  8985. // } else {
  8986. // api3 = "http://127.0.0.1:9532/" + "gdyb/three?psn_no=" + his.PsnNo +
  8987. // "&mdtrt_id=" + his.Number + "&ipt_otp_no=" + his.IptOtpNo + "&doctor=" + roles.UserName + "&org_name=" + miConfig.OrgName + "&fixmedins_code=" + miConfig.Code +
  8988. // "&insuplc_admdvs=" + his.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey
  8989. //
  8990. // }
  8991. //
  8992. // resp3, requestErr3 := http.Get(api3)
  8993. // if requestErr3 != nil {
  8994. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  8995. // return
  8996. // }
  8997. //
  8998. // body3, ioErr3 := ioutil.ReadAll(resp3.Body)
  8999. // if ioErr3 != nil {
  9000. // utils.ErrorLog("接口返回数据读取失败: %v", ioErr3)
  9001. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  9002. // return
  9003. // }
  9004. // var respJSON3 map[string]interface{}
  9005. // if err := json.Unmarshal([]byte(string(body3)), &respJSON3); err != nil {
  9006. // utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
  9007. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  9008. // return
  9009. // }
  9010. //
  9011. // respJSON3 = respJSON3["data"].(map[string]interface{})["pre"].(map[string]interface{})
  9012. // userJSONBytes3, _ := json.Marshal(respJSON3)
  9013. //
  9014. // if miConfig.Code == "H15049901371" {
  9015. // if err := json.Unmarshal(userJSONBytes3, &resSix10265); err != nil {
  9016. // utils.ErrorLog("解析失败:%v", err)
  9017. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  9018. // return
  9019. // }
  9020. // res2.InfRefmsgid = resSix10265.InfRefmsgid
  9021. // res2.Output = resSix10265.Output
  9022. // res2.ErrMsg = resSix10265.ErrMsg
  9023. // res2.Cainfo = resSix10265.Cainfo
  9024. // res2.WarnMsg = resSix10265.WarnMsg
  9025. // infocode, _ := strconv.ParseInt(resSix10265.Infcode, 10, 64)
  9026. // res2.Infcode = infocode
  9027. // } else {
  9028. //
  9029. // if err := json.Unmarshal(userJSONBytes3, &res2); err != nil {
  9030. // utils.ErrorLog("解析失败:%v", err)
  9031. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  9032. // return
  9033. // }
  9034. // }
  9035. //
  9036. // }
  9037. //
  9038. // if res2.Infcode == 0 {
  9039. // if err == nil {
  9040. // c.ServeSuccessJSON(map[string]interface{}{
  9041. // "msg": "退号成功",
  9042. // })
  9043. // service.UpdataRegStatusTwo(his_patient_id, recordDateTime, adminUser.CurrentOrgId)
  9044. //
  9045. // } else {
  9046. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  9047. // return
  9048. // }
  9049. //
  9050. // } else {
  9051. // c.ServeSuccessJSON(map[string]interface{}{
  9052. // "code": -10,
  9053. // "msg": res2.ErrMsg,
  9054. // })
  9055. //
  9056. // }
  9057. //
  9058. // } else {
  9059. // //err := service.UpdataOrderStatus(order_id, number, adminUser.CurrentOrgId)
  9060. // //if err == nil {
  9061. // // c.ServeSuccessJSON(map[string]interface{}{
  9062. // // "msg": "退费成功",
  9063. // // })
  9064. // //} else {
  9065. // // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  9066. // // return
  9067. // //}
  9068. // }
  9069. //}
  9070. //func (c *HisApiController) RefundDetail() {
  9071. // order_id, _ := c.GetInt64("order_id")
  9072. // //admin_user_id, _ := c.GetInt64("admin_user_id")
  9073. //
  9074. // //his_patient_id, _ := c.GetInt64("his_patient_id")
  9075. //
  9076. // number := c.GetString("number")
  9077. // record_time := c.GetString("record_time")
  9078. // patient_id, _ := c.GetInt64("patient_id")
  9079. // //med_type, _ := c.GetInt64("med_type")
  9080. //
  9081. // timeLayout := "2006-01-02"
  9082. // loc, _ := time.LoadLocation("Local")
  9083. // adminUser := c.GetAdminUserInfo()
  9084. // //roles, _ := service.GetAdminUserInfoByID(adminUser.CurrentOrgId, admin_user_id)
  9085. // theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", record_time+" 00:00:00", loc)
  9086. // fmt.Println(err)
  9087. // if err != nil {
  9088. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
  9089. // return
  9090. // }
  9091. // recordDateTime := theTime.Unix()
  9092. // //his, _ := service.GetNewVMHisPatientInfo(adminUser.CurrentOrgId, his_patient_id, recordDateTime)
  9093. //
  9094. // patientPrescription, _ := service.FindPatientPrescriptionInfo(adminUser.CurrentOrgId, patient_id, recordDateTime)
  9095. // miConfig, _ := service.FindMedicalInsuranceInfo(adminUser.CurrentOrgId)
  9096. // config, _ := service.GetMedicalInsuranceConfig(adminUser.CurrentOrgId)
  9097. //
  9098. // var order models.HisOrder
  9099. // order, _ = service.GetHisOrderByID(order_id)
  9100. // his, _ := service.GetHisPatientByNumber(order.MdtrtId)
  9101. // if config.IsOpen == 1 { //对接了医保,走医保流程
  9102. // var res2 ResultSix
  9103. //
  9104. // if miConfig.MdtrtareaAdmvs == "421300" {
  9105. // api3 := "http://192.168.124.4:9532/" + "hbyb/2205?psn_no=" + order.PsnNo +
  9106. // "&mdtrt_id=" + order.MdtrtId + "&chrg_bchno=" + order.Number + "&doctor=" + patientPrescription.Doctor + "&org_name=" + miConfig.OrgName + "&fixmedins_code=" + miConfig.Code +
  9107. // "&insuplc_admdvs=" + his.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey
  9108. // resp3, requestErr3 := http.Get(api3)
  9109. // if requestErr3 != nil {
  9110. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  9111. // return
  9112. // }
  9113. // body3, ioErr3 := ioutil.ReadAll(resp3.Body)
  9114. // if ioErr3 != nil {
  9115. // utils.ErrorLog("接口返回数据读取失败: %v", ioErr3)
  9116. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  9117. // return
  9118. // }
  9119. // var respJSON3 map[string]interface{}
  9120. // if err := json.Unmarshal([]byte(string(body3)), &respJSON3); err != nil {
  9121. // utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
  9122. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  9123. // return
  9124. // }
  9125. //
  9126. // respJSON3 = respJSON3["data"].(map[string]interface{})["pre"].(map[string]interface{})
  9127. // userJSONBytes3, _ := json.Marshal(respJSON3)
  9128. // fmt.Println("log")
  9129. // fmt.Println(string(userJSONBytes3))
  9130. // if err := json.Unmarshal(userJSONBytes3, &res2); err != nil {
  9131. // utils.ErrorLog("解析失败:%v", err)
  9132. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  9133. // return
  9134. // }
  9135. //
  9136. // err := service.UpdataOrderStatus(order_id, number, adminUser.CurrentOrgId, "", "")
  9137. // if err == nil {
  9138. // c.ServeSuccessJSON(map[string]interface{}{
  9139. // "msg": "撤销明细成功",
  9140. // })
  9141. // return
  9142. // } else {
  9143. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  9144. // return
  9145. // }
  9146. // } else if miConfig.MdtrtareaAdmvs == "320921" || miConfig.MdtrtareaAdmvs == "320982" {
  9147. // var resSix10265 ResultSix10265
  9148. //
  9149. // var api3 string
  9150. // if miConfig.MdtrtareaAdmvs == "320921" {
  9151. // api3 = "http://192.168.2.110:9532/" + "jsyb/2205?psn_no=" + order.PsnNo +
  9152. // "&mdtrt_id=" + order.MdtrtId + "&chrg_bchno=" + order.Number + "&doctor=" + patientPrescription.Doctor + "&org_name=" + miConfig.OrgName + "&fixmedins_code=" + miConfig.Code +
  9153. // "&insuplc_admdvs=" + his.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey + "&url=" + miConfig.Url + "&ak=" + miConfig.AccessKey + "&cainfo=" + miConfig.Cainfo
  9154. //
  9155. // //req, _ = http.NewRequest("POST", "http://192.168.2.110:9532/"+"jsyb/2204", bytes.NewReader(bytesData))
  9156. //
  9157. // } else {
  9158. // //req, _ = http.NewRequest("POST", "http://192.168.5.251:9532/"+"jsyb/2204", bytes.NewReader(bytesData))
  9159. // api3 = "http://192.168.5.251:9532/" + "jsyb/2205?psn_no=" + order.PsnNo +
  9160. // "&mdtrt_id=" + order.MdtrtId + "&chrg_bchno=" + order.Number + "&doctor=" + patientPrescription.Doctor + "&org_name=" + miConfig.OrgName + "&fixmedins_code=" + miConfig.Code +
  9161. // "&insuplc_admdvs=" + his.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey + "&url=" + miConfig.Url + "&ak=" + miConfig.AccessKey + "&cainfo=" + miConfig.Cainfo
  9162. //
  9163. // }
  9164. //
  9165. // resp3, requestErr3 := http.Get(api3)
  9166. // if requestErr3 != nil {
  9167. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  9168. // return
  9169. // }
  9170. // body3, ioErr3 := ioutil.ReadAll(resp3.Body)
  9171. // if ioErr3 != nil {
  9172. // utils.ErrorLog("接口返回数据读取失败: %v", ioErr3)
  9173. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  9174. // return
  9175. // }
  9176. // var respJSON3 map[string]interface{}
  9177. // if err := json.Unmarshal([]byte(string(body3)), &respJSON3); err != nil {
  9178. // utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
  9179. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  9180. // return
  9181. // }
  9182. //
  9183. // respJSON3 = respJSON3["data"].(map[string]interface{})["pre"].(map[string]interface{})
  9184. // userJSONBytes3, _ := json.Marshal(respJSON3)
  9185. // fmt.Println("log")
  9186. // fmt.Println(string(userJSONBytes3))
  9187. // if err := json.Unmarshal(userJSONBytes3, &resSix10265); err != nil {
  9188. // utils.ErrorLog("解析失败:%v", err)
  9189. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  9190. // return
  9191. // }
  9192. //
  9193. // res2.InfRefmsgid = resSix10265.InfRefmsgid
  9194. // res2.Output = resSix10265.Output
  9195. // res2.ErrMsg = resSix10265.ErrMsg
  9196. // res2.Cainfo = resSix10265.Cainfo
  9197. // res2.WarnMsg = resSix10265.WarnMsg
  9198. // infocode, _ := strconv.ParseInt(resSix10265.Infcode, 10, 64)
  9199. // res2.Infcode = infocode
  9200. //
  9201. // err := service.UpdataOrderStatus(order_id, number, adminUser.CurrentOrgId, "", "")
  9202. // if err == nil {
  9203. // c.ServeSuccessJSON(map[string]interface{}{
  9204. // "msg": "撤销明细成功",
  9205. // })
  9206. // return
  9207. // } else {
  9208. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  9209. // return
  9210. // }
  9211. // } else {
  9212. // api2 := "http://127.0.0.1:9532/" + "gdyb/six?psn_no=" + his.PsnNo +
  9213. // "&mdtrt_id=" + his.Number + "&chrg_bchno=" + order.Number + "&doctor=" + patientPrescription.Doctor + "&org_name=" + miConfig.OrgName + "&fixmedins_code=" + miConfig.Code +
  9214. // "&insuplc_admdvs=" + his.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey
  9215. // resp2, requestErr2 := http.Get(api2)
  9216. // if requestErr2 != nil {
  9217. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  9218. // return
  9219. // }
  9220. //
  9221. // body2, ioErr2 := ioutil.ReadAll(resp2.Body)
  9222. // if ioErr2 != nil {
  9223. // utils.ErrorLog("接口返回数据读取失败: %v", ioErr2)
  9224. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  9225. // return
  9226. // }
  9227. // var respJSON2 map[string]interface{}
  9228. // if err := json.Unmarshal([]byte(string(body2)), &respJSON2); err != nil {
  9229. // utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
  9230. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  9231. // return
  9232. // }
  9233. //
  9234. // err := service.UpdataOrderStatus(order_id, number, adminUser.CurrentOrgId, "", "")
  9235. // if err == nil {
  9236. // c.ServeSuccessJSON(map[string]interface{}{
  9237. // "msg": "撤销明细成功",
  9238. // })
  9239. // return
  9240. //
  9241. // } else {
  9242. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  9243. // return
  9244. // }
  9245. //
  9246. // }
  9247. // } else {
  9248. // err := service.UpdataOrderStatus(order_id, number, adminUser.CurrentOrgId, "", "")
  9249. // if err == nil {
  9250. // c.ServeSuccessJSON(map[string]interface{}{
  9251. // "msg": "退费成功",
  9252. // })
  9253. // } else {
  9254. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  9255. // return
  9256. // }
  9257. // }
  9258. //}
  9259. //
  9260. ////对账
  9261. //func (c *HisApiController) GetCheckAccount() {
  9262. // start_time := c.GetString("start_time")
  9263. // end_time := c.GetString("end_time")
  9264. // insutype := c.GetString("insutype")
  9265. // clr_type := c.GetString("clr_type")
  9266. // clr_org := c.GetString("clr_optins")
  9267. //
  9268. // admin_user_id, _ := c.GetInt64("admin_user_id")
  9269. //
  9270. // adminUser := c.GetAdminUserInfo()
  9271. // miConfig, _ := service.FindMedicalInsuranceInfo(adminUser.CurrentOrgId)
  9272. // config, _ := service.GetMedicalInsuranceConfig(adminUser.CurrentOrgId)
  9273. // if len(clr_org) == 0 {
  9274. // clr_org = miConfig.MdtrtareaAdmvs
  9275. // }
  9276. // timeLayout := "2006-01-02"
  9277. // loc, _ := time.LoadLocation("Local")
  9278. // startime, _ := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
  9279. // endtime, _ := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
  9280. // orders, _ := service.GetOrderByTime(startime.Unix(), endtime.Unix(), adminUser.CurrentOrgId, insutype, "", clr_type)
  9281. // fixmedins_setl_cnt := int64(len(orders))
  9282. // var medfee_sumamt float64
  9283. // var acct_pay float64
  9284. // var fund_pay_sumamt float64
  9285. // for _, item := range orders {
  9286. // medfee_sumamt = medfee_sumamt + item.MedfeeSumamt
  9287. // acct_pay = acct_pay + item.AcctPay
  9288. // fund_pay_sumamt = fund_pay_sumamt + item.FundPaySumamt
  9289. // }
  9290. // var user_name string
  9291. // role, _ := service.GetAdminUserInfoByID(adminUser.CurrentOrgId, admin_user_id)
  9292. // if role.ID == 0 {
  9293. // user_name = "xxx"
  9294. // } else {
  9295. // user_name = role.UserName
  9296. // }
  9297. // var res ResultEight
  9298. // var res10188 ResultEightFor10188
  9299. // if config.IsOpen == 1 {
  9300. // if miConfig.MdtrtareaAdmvs == "320921" || miConfig.MdtrtareaAdmvs == "320982" {
  9301. // api := "http://192.168.2.110:9532/" + "jsyb/3201?" +
  9302. // "insutype=" + insutype +
  9303. // "&clr_type=" + "11" +
  9304. // "&setl_optins=" + clr_org +
  9305. // "&stmt_begndate=" + start_time +
  9306. // "&stm_enddate=" + end_time +
  9307. // "&medfee_sumamt=" + fmt.Sprintf("%.4f", medfee_sumamt) +
  9308. // "&fund_pay_sumamt=" + fmt.Sprintf("%.4f", fund_pay_sumamt) +
  9309. // "&acct_pay=" + fmt.Sprintf("%.4f", acct_pay) +
  9310. // "&fixmedins_setl_cnt=" + strconv.FormatInt(fixmedins_setl_cnt, 10) +
  9311. // "&fixmedins_code=" + miConfig.Code +
  9312. // "&insuplc_admdvs=" + miConfig.InsuplcAdmdvs +
  9313. // "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs +
  9314. // "&secret_key=" + miConfig.SecretKey +
  9315. // "&org_name=" + miConfig.OrgName +
  9316. // "&doctor=" + user_name +
  9317. // "&url=" + miConfig.Url + "&ak=" + miConfig.AccessKey + "&cainfo=" + miConfig.Cainfo
  9318. //
  9319. // fmt.Println(api)
  9320. // resp, requestErr := http.Get(api)
  9321. // if requestErr != nil {
  9322. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  9323. // return
  9324. // }
  9325. // body, ioErr := ioutil.ReadAll(resp.Body)
  9326. // fmt.Println(body)
  9327. // if ioErr != nil {
  9328. // utils.ErrorLog("接口返回数据读取失败: %v", ioErr)
  9329. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  9330. // return
  9331. // }
  9332. // var respJSON map[string]interface{}
  9333. // if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
  9334. // utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
  9335. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  9336. // return
  9337. // }
  9338. // respJSON = respJSON["data"].(map[string]interface{})["pre"].(map[string]interface{})
  9339. // userJSONBytes, _ := json.Marshal(respJSON)
  9340. // if err := json.Unmarshal(userJSONBytes, &res); err != nil {
  9341. // utils.ErrorLog("解析失败:%v", err)
  9342. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  9343. // return
  9344. // }
  9345. //
  9346. // res.InfRefmsgid = res10188.InfRefmsgid
  9347. // res.Output = res10188.Output
  9348. // res.ErrMsg = res10188.ErrMsg
  9349. // res.Cainfo = res10188.Cainfo
  9350. // res.WarnMsg = res10188.WarnMsg
  9351. // infocode, _ := strconv.ParseInt(res10188.Infcode, 10, 64)
  9352. // res.Infcode = infocode
  9353. //
  9354. // } else if miConfig.MdtrtareaAdmvs == "150499" {
  9355. //
  9356. // api := "http://172.16.13.254:9532/" + "nmyb/3201?" +
  9357. // "insutype=" + insutype +
  9358. // "&clr_type=" + "21" +
  9359. // "&setl_optins=" + clr_org +
  9360. // "&stmt_begndate=" + start_time +
  9361. // "&stm_enddate=" + end_time +
  9362. // "&medfee_sumamt=" + fmt.Sprintf("%.4f", medfee_sumamt) +
  9363. // "&fund_pay_sumamt=" + fmt.Sprintf("%.4f", fund_pay_sumamt) +
  9364. // "&acct_pay=" + fmt.Sprintf("%.4f", acct_pay) +
  9365. // "&fixmedins_setl_cnt=" + strconv.FormatInt(fixmedins_setl_cnt, 10) +
  9366. // "&fixmedins_code=" + miConfig.Code +
  9367. // "&insuplc_admdvs=" + miConfig.InsuplcAdmdvs +
  9368. // "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs +
  9369. // "&secret_key=" + miConfig.SecretKey +
  9370. // "&org_name=" + miConfig.OrgName +
  9371. // "&doctor=" + user_name
  9372. // resp, requestErr := http.Get(api)
  9373. // if requestErr != nil {
  9374. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  9375. // return
  9376. // }
  9377. // body, ioErr := ioutil.ReadAll(resp.Body)
  9378. // if ioErr != nil {
  9379. // utils.ErrorLog("接口返回数据读取失败: %v", ioErr)
  9380. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  9381. // return
  9382. // }
  9383. // var respJSON map[string]interface{}
  9384. // if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
  9385. // utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
  9386. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  9387. // return
  9388. // }
  9389. //
  9390. // respJSON = respJSON["data"].(map[string]interface{})["pre"].(map[string]interface{})
  9391. // result, _ := json.Marshal(respJSON)
  9392. // fmt.Println("log")
  9393. // fmt.Println(string(result))
  9394. // if err := json.Unmarshal([]byte(result), &res10188); err != nil {
  9395. // utils.ErrorLog("解析失败:%v", err)
  9396. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  9397. // return
  9398. // }
  9399. //
  9400. // res.InfRefmsgid = res10188.InfRefmsgid
  9401. // res.Output = res10188.Output
  9402. // res.ErrMsg = res10188.ErrMsg
  9403. // res.Cainfo = res10188.Cainfo
  9404. // res.WarnMsg = res10188.WarnMsg
  9405. // infocode, _ := strconv.ParseInt(res10188.Infcode, 10, 64)
  9406. // res.Infcode = infocode
  9407. //
  9408. // } else {
  9409. // api := "http://127.0.0.1:9532/" + "gdyb/ten?" +
  9410. // "insutype=" + insutype +
  9411. // "&clr_type=" + clr_type +
  9412. // "&setl_optins=" + clr_org +
  9413. // "&stmt_begndate=" + start_time +
  9414. // "&stm_enddate=" + end_time +
  9415. // "&medfee_sumamt=" + fmt.Sprintf("%.4f", medfee_sumamt) +
  9416. // "&fund_pay_sumamt=" + fmt.Sprintf("%.4f", fund_pay_sumamt) +
  9417. // "&acct_pay=" + fmt.Sprintf("%.4f", acct_pay) +
  9418. // "&fixmedins_setl_cnt=" + strconv.FormatInt(fixmedins_setl_cnt, 10) +
  9419. // "&fixmedins_code=" + miConfig.Code +
  9420. // "&insuplc_admdvs=" + miConfig.InsuplcAdmdvs +
  9421. // "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs +
  9422. // "&secret_key=" + miConfig.SecretKey +
  9423. // "&org_name=" + miConfig.OrgName +
  9424. // "&doctor=" + user_name
  9425. //
  9426. // fmt.Println(api)
  9427. // resp, requestErr := http.Get(api)
  9428. // if requestErr != nil {
  9429. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  9430. // return
  9431. // }
  9432. // body, ioErr := ioutil.ReadAll(resp.Body)
  9433. // fmt.Println(body)
  9434. // if ioErr != nil {
  9435. // utils.ErrorLog("接口返回数据读取失败: %v", ioErr)
  9436. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  9437. // return
  9438. // }
  9439. // var respJSON map[string]interface{}
  9440. // if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
  9441. // utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
  9442. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  9443. // return
  9444. // }
  9445. // respJSON = respJSON["data"].(map[string]interface{})["pre"].(map[string]interface{})
  9446. // userJSONBytes, _ := json.Marshal(respJSON)
  9447. // if err := json.Unmarshal(userJSONBytes, &res); err != nil {
  9448. // utils.ErrorLog("解析失败:%v", err)
  9449. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  9450. // return
  9451. // }
  9452. // }
  9453. //
  9454. // if res.Infcode == 0 {
  9455. // if res.Output.Stmtinfo.StmtRslt == "0" {
  9456. // micc := &models.MedicalInsuranceCostCompare{
  9457. // StartTime: startime.Unix(),
  9458. // EndTime: endtime.Unix(),
  9459. // Insutype: insutype,
  9460. // CheckType: 1,
  9461. // Num: fixmedins_setl_cnt,
  9462. // Mtime: time.Now().Unix(),
  9463. // Status: 1,
  9464. // UserOrgId: adminUser.CurrentOrgId,
  9465. // CostTotal: medfee_sumamt,
  9466. // FuncTotal: fund_pay_sumamt,
  9467. // PsnPay: acct_pay,
  9468. // Creator: admin_user_id,
  9469. // Ctime: time.Now().Unix(),
  9470. // ClrType: clr_type,
  9471. // }
  9472. // err := service.CreateMedicalInsuranceCostCompareRecord(micc)
  9473. // if err == nil {
  9474. // c.ServeSuccessJSON(map[string]interface{}{
  9475. // "stmt_rslt": res.Output.Stmtinfo.StmtRslt,
  9476. // "stmt_rslt_dscr": res.Output.Stmtinfo.StmtRsltDscr,
  9477. // })
  9478. // } else {
  9479. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  9480. // }
  9481. // } else {
  9482. // c.ServeSuccessJSON(map[string]interface{}{
  9483. // "stmt_rslt": res.Output.Stmtinfo.StmtRslt,
  9484. // "stmt_rslt_dscr": res.Output.Stmtinfo.StmtRsltDscr,
  9485. // })
  9486. // }
  9487. // } else {
  9488. // c.ServeSuccessJSON(map[string]interface{}{
  9489. // "code": -10,
  9490. // "msg": res.ErrMsg,
  9491. // })
  9492. //
  9493. // }
  9494. // }
  9495. //}
  9496. //
  9497. //func (c *HisApiController) Check310() {
  9498. //
  9499. // adminUser := c.GetAdminUserInfo()
  9500. // miConfig, _ := service.FindMedicalInsuranceInfo(adminUser.CurrentOrgId)
  9501. //
  9502. // var user_name string
  9503. // user_name = "高慧裕"
  9504. // api := "http://127.0.0.1:9532/" + "gdyb/ten?" +
  9505. // "insutype=" + "310" +
  9506. // "&clr_type=" + "" +
  9507. // "&setl_optins=" + "441202" +
  9508. // "&stmt_begndate=" + "2022-03-01" +
  9509. // "&stm_enddate=" + "2022-03-31" +
  9510. // "&medfee_sumamt=" + "194930.12" +
  9511. // "&fund_pay_sumamt=" + "188741.46" +
  9512. // "&acct_pay=" + "0" +
  9513. // "&fixmedins_setl_cnt=" + "452" +
  9514. // "&fixmedins_code=" + miConfig.Code +
  9515. // "&insuplc_admdvs=" + miConfig.InsuplcAdmdvs +
  9516. // "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs +
  9517. // "&secret_key=" + miConfig.SecretKey +
  9518. // "&org_name=" + miConfig.OrgName +
  9519. // "&doctor=" + user_name
  9520. //
  9521. // fmt.Println(api)
  9522. // resp, requestErr := http.Get(api)
  9523. // if requestErr != nil {
  9524. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  9525. // return
  9526. // }
  9527. // body, ioErr := ioutil.ReadAll(resp.Body)
  9528. // fmt.Println(body)
  9529. // if ioErr != nil {
  9530. // utils.ErrorLog("接口返回数据读取失败: %v", ioErr)
  9531. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  9532. // return
  9533. // }
  9534. // var respJSON map[string]interface{}
  9535. // if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
  9536. // utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
  9537. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  9538. // return
  9539. // }
  9540. //
  9541. // respJSON = respJSON["data"].(map[string]interface{})["pre"].(map[string]interface{})
  9542. // userJSONBytes, _ := json.Marshal(respJSON)
  9543. //
  9544. // var res ResultEight
  9545. // if err := json.Unmarshal(userJSONBytes, &res); err != nil {
  9546. // utils.ErrorLog("解析失败:%v", err)
  9547. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  9548. // return
  9549. // }
  9550. //
  9551. //}
  9552. //func (c *HisApiController) Check390() {
  9553. //
  9554. // adminUser := c.GetAdminUserInfo()
  9555. // miConfig, _ := service.FindMedicalInsuranceInfo(adminUser.CurrentOrgId)
  9556. //
  9557. // var user_name string
  9558. // user_name = "高慧裕"
  9559. // api := "http://127.0.0.1:9532/" + "gdyb/ten?" +
  9560. // "insutype=" + "390" +
  9561. // "&clr_type=" + "" +
  9562. // "&setl_optins=" + "441202" +
  9563. // "&stmt_begndate=" + "2022-03-01" +
  9564. // "&stm_enddate=" + "2022-03-31" +
  9565. // "&medfee_sumamt=" + "1068448.89" +
  9566. // "&fund_pay_sumamt=" + "1014677.62" +
  9567. // "&acct_pay=" + "0" +
  9568. // "&fixmedins_setl_cnt=" + "1950" +
  9569. // "&fixmedins_code=" + miConfig.Code +
  9570. // "&insuplc_admdvs=" + miConfig.InsuplcAdmdvs +
  9571. // "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs +
  9572. // "&secret_key=" + miConfig.SecretKey +
  9573. // "&org_name=" + miConfig.OrgName +
  9574. // "&doctor=" + user_name
  9575. //
  9576. // fmt.Println(api)
  9577. // resp, requestErr := http.Get(api)
  9578. // if requestErr != nil {
  9579. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  9580. // return
  9581. // }
  9582. // body, ioErr := ioutil.ReadAll(resp.Body)
  9583. // fmt.Println(body)
  9584. // if ioErr != nil {
  9585. // utils.ErrorLog("接口返回数据读取失败: %v", ioErr)
  9586. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  9587. // return
  9588. // }
  9589. // var respJSON map[string]interface{}
  9590. // if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
  9591. // utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
  9592. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  9593. // return
  9594. // }
  9595. //
  9596. // respJSON = respJSON["data"].(map[string]interface{})["pre"].(map[string]interface{})
  9597. // userJSONBytes, _ := json.Marshal(respJSON)
  9598. //
  9599. // var res ResultEight
  9600. // if err := json.Unmarshal(userJSONBytes, &res); err != nil {
  9601. // utils.ErrorLog("解析失败:%v", err)
  9602. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  9603. // return
  9604. // }
  9605. //
  9606. //}
  9607. //
  9608. ////对账明细
  9609. //func (c *HisApiController) GetCheckDetailAccount() {
  9610. // start_time := c.GetString("start_time")
  9611. // end_time := c.GetString("end_time")
  9612. // admin_user_id, _ := c.GetInt64("admin_user_id")
  9613. //
  9614. // adminUser := c.GetAdminUserInfo()
  9615. // miConfig, _ := service.FindMedicalInsuranceInfo(adminUser.CurrentOrgId)
  9616. // config, _ := service.GetMedicalInsuranceConfig(adminUser.CurrentOrgId)
  9617. //
  9618. // timeLayout := "2006-01-02"
  9619. // loc, _ := time.LoadLocation("Local")
  9620. // startime, _ := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
  9621. // endtime, _ := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
  9622. // orders, _ := service.GetOrderByTimeTwo(startime.Unix(), endtime.Unix(), adminUser.CurrentOrgId)
  9623. //
  9624. // rand.Seed(time.Now().UnixNano())
  9625. //
  9626. // num := rand.Intn(30000)
  9627. // Mkdir(miConfig.OrgName)
  9628. // file := strconv.FormatInt(int64(num), 10)
  9629. // file_name := file + ".txt"
  9630. // zip_name := file + ".zip"
  9631. // zip_path := miConfig.OrgName + "/" + zip_name
  9632. // file_path := miConfig.OrgName + "/" + file_name
  9633. //
  9634. // decimal.DivisionPrecision = 2
  9635. // var medfee_sumamt float64
  9636. // var psn_cash_pay float64
  9637. // var fund_pay_sumamt float64
  9638. // fixmedins_setl_cnt := int64(len(orders))
  9639. //
  9640. // for _, item := range orders {
  9641. // medfee_sumamt = medfee_sumamt + item.MedfeeSumamt
  9642. // psn_cash_pay = psn_cash_pay + item.PsnCashPay
  9643. // fund_pay_sumamt = fund_pay_sumamt + item.FundPaySumamt
  9644. // }
  9645. //
  9646. // f, err := os.Create(miConfig.OrgName + "/" + file_name)
  9647. // defer f.Close()
  9648. // if err != nil {
  9649. // fmt.Println(err.Error())
  9650. // } else {
  9651. // for _, item := range orders {
  9652. // var refd_setl_flag string
  9653. // if item.OrderStatus == 2 {
  9654. // refd_setl_flag = "0"
  9655. // var str string
  9656. // str = item.SetlId + " " +
  9657. // item.MdtrtId + " " +
  9658. // item.PsnNo + " " +
  9659. // fmt.Sprintf("%.4f", item.MedfeeSumamt) + " " +
  9660. // fmt.Sprintf("%.4f", item.FundPaySumamt) + " " +
  9661. // fmt.Sprintf("%.4f", item.AcctPay) + " " + refd_setl_flag + "\r\n"
  9662. // _, err = f.Write([]byte(str))
  9663. // }
  9664. // if item.OrderStatus == 3 {
  9665. //
  9666. // var str string
  9667. // str = item.SetlId + " " +
  9668. // item.MdtrtId + " " +
  9669. // item.PsnNo + " " +
  9670. // fmt.Sprintf("%.4f", item.MedfeeSumamt) + " " +
  9671. // fmt.Sprintf("%.4f", item.FundPaySumamt) + " " +
  9672. // fmt.Sprintf("%.4f", item.AcctPay) + " " + "1" + "\r\n"
  9673. // _, err = f.Write([]byte(str))
  9674. //
  9675. // var str2 string
  9676. // str2 = item.SetlId + " " +
  9677. // item.MdtrtId + " " +
  9678. // item.PsnNo + " " +
  9679. // fmt.Sprintf("%.4f", 0-item.MedfeeSumamt) + " " +
  9680. // fmt.Sprintf("%.4f", 0-item.FundPaySumamt) + " " +
  9681. // fmt.Sprintf("%.4f", 0-item.AcctPay) + " " + "1" + "\r\n"
  9682. // _, err = f.Write([]byte(str2))
  9683. // }
  9684. //
  9685. // }
  9686. //
  9687. // }
  9688. // Zip(file_path, zip_path)
  9689. // fmt.Println(ReadFile(zip_path))
  9690. // fmt.Println(string(ReadFile(zip_path)))
  9691. //
  9692. // if config.IsOpen == 1 {
  9693. //
  9694. // var user_name string
  9695. // role, _ := service.GetAdminUserInfoByID(adminUser.CurrentOrgId, admin_user_id)
  9696. // if role.ID == 0 {
  9697. // user_name = "管理员"
  9698. // } else {
  9699. // user_name = role.UserName
  9700. // }
  9701. //
  9702. // baseParams := models.BaseParams{
  9703. // SecretKey: miConfig.SecretKey,
  9704. // FixmedinsCode: miConfig.Code,
  9705. // InsuplcAdmdvs: miConfig.InsuplcAdmdvs,
  9706. // MdtrtareaAdmvs: miConfig.MdtrtareaAdmvs,
  9707. // OrgName: miConfig.OrgName,
  9708. // Doctor: user_name,
  9709. // }
  9710. //
  9711. // result := service.Gdyb9101(baseParams, file_name, ReadFile(file_path))
  9712. //
  9713. // var dat map[string]interface{}
  9714. // if err := json.Unmarshal([]byte(result), &dat); err == nil {
  9715. // fmt.Println(dat)
  9716. // } else {
  9717. // fmt.Println(err)
  9718. // }
  9719. //
  9720. // userJSONBytes, _ := json.Marshal(dat)
  9721. //
  9722. // var res ResultNine
  9723. // if err := json.Unmarshal(userJSONBytes, &res); err != nil {
  9724. // utils.ErrorLog("解析失败:%v", err)
  9725. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  9726. // return
  9727. // }
  9728. //
  9729. // if res.Infcode == 0 {
  9730. // fileNo := res.Output.FileQuryNo
  9731. // api := "http://127.0.0.1:9532/" + "gdyb/twelve?" +
  9732. // "file_qury_no=" + fileNo +
  9733. // "&setl_optins=" + "定点医保中心" +
  9734. // "&stmt_begndate=" + start_time +
  9735. // "&stm_enddate=" + end_time +
  9736. // "&medfee_sumamt=" + fmt.Sprintf("%.4f", medfee_sumamt) +
  9737. // "&fund_pay_sumamt=" + fmt.Sprintf("%.4f", fund_pay_sumamt) +
  9738. // "&cash_payamt=" + fmt.Sprintf("%.4f", psn_cash_pay) +
  9739. // "&fixmedins_setl_cnt=" + strconv.FormatInt(fixmedins_setl_cnt, 10) +
  9740. // "&fixmedins_code=" + miConfig.Code +
  9741. // "&insuplc_admdvs=" + miConfig.InsuplcAdmdvs +
  9742. // "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs +
  9743. // "&secret_key=" + miConfig.SecretKey +
  9744. // "&org_name=" + miConfig.OrgName +
  9745. // "&doctor=" + user_name
  9746. // resp, requestErr := http.Get(api)
  9747. // if requestErr != nil {
  9748. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  9749. // return
  9750. // }
  9751. // body, ioErr := ioutil.ReadAll(resp.Body)
  9752. // if ioErr != nil {
  9753. // utils.ErrorLog("接口返回数据读取失败: %v", ioErr)
  9754. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  9755. // return
  9756. // }
  9757. // var respJSON map[string]interface{}
  9758. // if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
  9759. // utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
  9760. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  9761. // return
  9762. // }
  9763. // respJSON = respJSON["data"].(map[string]interface{})["pre"].(map[string]interface{})
  9764. //
  9765. // userJSONBytes, _ := json.Marshal(respJSON)
  9766. // var res ResultTen
  9767. // if err := json.Unmarshal(userJSONBytes, &res); err != nil {
  9768. // utils.ErrorLog("解析失败:%v", err)
  9769. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  9770. // return
  9771. // }
  9772. //
  9773. // if res.Infcode == 0 {
  9774. // service.Gdyb9102(baseParams, zip_name, fileNo)
  9775. //
  9776. // micc := &models.MedicalInsuranceCostCompare{
  9777. // StartTime: startime.Unix(),
  9778. // EndTime: endtime.Unix(),
  9779. // Insutype: "0",
  9780. // CheckType: 2,
  9781. // Num: fixmedins_setl_cnt,
  9782. // Mtime: time.Now().Unix(),
  9783. // Status: 1,
  9784. // UserOrgId: adminUser.CurrentOrgId,
  9785. // CostTotal: medfee_sumamt,
  9786. // FuncTotal: fund_pay_sumamt,
  9787. // PsnPay: psn_cash_pay,
  9788. // Creator: admin_user_id,
  9789. // Ctime: time.Now().Unix(),
  9790. // }
  9791. //
  9792. // service.CreateMedicalInsuranceCostCompareRecord(micc)
  9793. //
  9794. // c.ServeSuccessJSON(map[string]interface{}{
  9795. // "msg": "明细对账成功",
  9796. // })
  9797. // }
  9798. //
  9799. // } else {
  9800. //
  9801. // }
  9802. // }
  9803. //}
  9804. //
  9805. //type CustomOrderInfo struct {
  9806. // Name string
  9807. // Spec string
  9808. // Unit string
  9809. // Count float64
  9810. // Price float64
  9811. // Total float64
  9812. //}
  9813. //
  9814. //func (c *HisApiController) GetSettleAccounts() {
  9815. // //id, _ := c.GetInt64("id")
  9816. // //record_time := c.GetString("record_time")
  9817. // order_id, _ := c.GetInt64("order_id")
  9818. // admin_user_id, _ := c.GetInt64("admin_user_id")
  9819. //
  9820. // //timeLayout := "2006-01-02"
  9821. // //loc, _ := time.LoadLocation("Local")
  9822. // //
  9823. // //theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", record_time+" 00:00:00", loc)
  9824. // //if err != nil {
  9825. // // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
  9826. // // return
  9827. // //}
  9828. // //recordDateTime := theTime.Unix()
  9829. // adminUser := c.GetAdminUserInfo()
  9830. // order, _ := service.GetHisOrderByID(order_id)
  9831. // his, _ := service.GetHisPatientByNumber(order.MdtrtId)
  9832. // orderInfos, _ := service.GetHisOrderInfoByNumber(order.Number)
  9833. // orderInfos_two, _ := service.GetHisOrderInfoByNumberTwo(order.Number)
  9834. // orderInfos = append(orderInfos, orderInfos_two...)
  9835. // his_hospital, _ := service.GetInHospitalRecordByNumber(order.MdtrtId)
  9836. // //diagnosisConfig, _ := service.FindDiagnoseById(his.Diagnosis)
  9837. // var diagnosis_ids []string
  9838. // if his.ID > 0 {
  9839. // diagnosis_ids = strings.Split(his.Diagnosis, ",")
  9840. //
  9841. // } else {
  9842. // diagnosis_ids = strings.Split(his_hospital.Diagnosis, ",")
  9843. //
  9844. // }
  9845. // patient, _ := service.GetPatientByIDTwo(adminUser.CurrentOrgId, order.PatientId)
  9846. // var dia_config []*models.HisXtDiagnoseConfig
  9847. // var name string
  9848. // for _, item := range diagnosis_ids {
  9849. // id, _ := strconv.ParseInt(item, 10, 64)
  9850. // diagnosisConfig, _ := service.FindDiagnoseById(id)
  9851. // dia_config = append(dia_config, &diagnosisConfig)
  9852. // if len(name) == 0 {
  9853. // name = diagnosisConfig.ClassName
  9854. //
  9855. // } else {
  9856. // name = name + "," + diagnosisConfig.ClassName
  9857. // }
  9858. // }
  9859. //
  9860. // var bedCostTotal float64 = 0 //床位总费
  9861. // var bedCostSelfTotal float64 = 0 //床位自费
  9862. // var bedCostPartSelfTotal float64 = 0 //床位部分项目自费
  9863. //
  9864. // var operationCostTotal float64 = 0 //手术费
  9865. // var operationCostSelfTotal float64 = 0 //手术费
  9866. // var operationCostPartSelfTotal float64 = 0 //手术费
  9867. //
  9868. // var otherCostTotal float64 = 0 //其他费用
  9869. // var otherCostSelfTotal float64 = 0 //其他费用
  9870. // var otherCostPartSelfTotal float64 = 0 //其他费用
  9871. //
  9872. // var materialCostTotal float64 = 0 //材料费
  9873. // var materialCostSelfTotal float64 = 0 //材料费
  9874. // var materialCostPartSelfTotal float64 = 0 //材料费
  9875. //
  9876. // var westernMedicineCostTotal float64 = 0 //西药费
  9877. // var westernMedicineCostSelfTotal float64 = 0 //西药费
  9878. // var westernMedicineCostPartSelfTotal float64 = 0 //西药费
  9879. //
  9880. // var chineseTraditionalMedicineCostTotal float64 = 0 //中成药
  9881. // var chineseTraditionalMedicineCostSelfTotal float64 = 0 //中成药
  9882. // var chineseTraditionalMedicineCostPartSelfTotal float64 = 0 //中成药
  9883. //
  9884. // var checkCostTotal float64 = 0 //检查费
  9885. // var checkCostSelfTotal float64 = 0 //检查费
  9886. // var checkCostPartSelfTotal float64 = 0 //检查费
  9887. //
  9888. // var laboratoryCostTotal float64 = 0 //化验费
  9889. // var laboratoryCostSelfTotal float64 = 0 //化验费
  9890. // var laboratoryCostPartSelfTotal float64 = 0 //化验费
  9891. //
  9892. // var treatCostTotal float64 = 0 //治疗费用
  9893. // var treatCostSelfTotal float64 = 0 //治疗费用
  9894. // var treatCostPartSelfTotal float64 = 0 //治疗费用
  9895. //
  9896. // decimal.DivisionPrecision = 2
  9897. //
  9898. // for _, item := range orderInfos {
  9899. // if item.MedChrgitmType == "01" { //床位费
  9900. // bedCostTotal, _ = decimal.NewFromFloat(bedCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  9901. // bedCostSelfTotal, _ = decimal.NewFromFloat(bedCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  9902. // bedCostPartSelfTotal, _ = decimal.NewFromFloat(bedCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  9903. // }
  9904. //
  9905. // if c.GetAdminUserInfo().CurrentOrgId == 10188 || c.GetAdminUserInfo().CurrentOrgId == 10217 {
  9906. // if item.MedChrgitmType == "03" { //检查费
  9907. // laboratoryCostTotal, _ = decimal.NewFromFloat(laboratoryCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  9908. // laboratoryCostSelfTotal, _ = decimal.NewFromFloat(laboratoryCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  9909. // laboratoryCostPartSelfTotal, _ = decimal.NewFromFloat(laboratoryCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  9910. // }
  9911. // } else {
  9912. //
  9913. // if item.MedChrgitmType == "03" { //检查费
  9914. // checkCostTotal, _ = decimal.NewFromFloat(checkCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  9915. // checkCostSelfTotal, _ = decimal.NewFromFloat(checkCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  9916. // checkCostPartSelfTotal, _ = decimal.NewFromFloat(checkCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  9917. // }
  9918. //
  9919. // }
  9920. //
  9921. // if item.MedChrgitmType == "04" { //化验费
  9922. // laboratoryCostTotal, _ = decimal.NewFromFloat(laboratoryCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  9923. // laboratoryCostSelfTotal, _ = decimal.NewFromFloat(laboratoryCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  9924. // laboratoryCostPartSelfTotal, _ = decimal.NewFromFloat(laboratoryCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  9925. //
  9926. // }
  9927. //
  9928. // if item.MedChrgitmType == "05" || item.MedChrgitmType == "1402" || item.MedChrgitmType == "1403" { //治疗费
  9929. //
  9930. // treatCostTotal, _ = decimal.NewFromFloat(treatCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  9931. // treatCostSelfTotal, _ = decimal.NewFromFloat(treatCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  9932. // treatCostPartSelfTotal, _ = decimal.NewFromFloat(treatCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  9933. //
  9934. // }
  9935. //
  9936. // if item.MedChrgitmType == "06" { //手术费
  9937. // operationCostTotal, _ = decimal.NewFromFloat(operationCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  9938. // operationCostSelfTotal, _ = decimal.NewFromFloat(operationCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  9939. // operationCostPartSelfTotal, _ = decimal.NewFromFloat(operationCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  9940. // }
  9941. //
  9942. // if item.MedChrgitmType == "08" { //材料费
  9943. // materialCostTotal, _ = decimal.NewFromFloat(materialCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  9944. // materialCostSelfTotal, _ = decimal.NewFromFloat(materialCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  9945. // materialCostPartSelfTotal, _ = decimal.NewFromFloat(materialCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  9946. // }
  9947. //
  9948. // if item.MedChrgitmType == "09" { //西药费
  9949. // westernMedicineCostTotal, _ = decimal.NewFromFloat(westernMedicineCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  9950. // westernMedicineCostSelfTotal, _ = decimal.NewFromFloat(westernMedicineCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  9951. // westernMedicineCostPartSelfTotal, _ = decimal.NewFromFloat(westernMedicineCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  9952. // }
  9953. //
  9954. // if item.MedChrgitmType == "11" { //中成费
  9955. // chineseTraditionalMedicineCostTotal, _ = decimal.NewFromFloat(chineseTraditionalMedicineCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  9956. // chineseTraditionalMedicineCostSelfTotal, _ = decimal.NewFromFloat(chineseTraditionalMedicineCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  9957. // chineseTraditionalMedicineCostPartSelfTotal, _ = decimal.NewFromFloat(chineseTraditionalMedicineCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  9958. // }
  9959. //
  9960. // if item.MedChrgitmType == "14" || item.MedChrgitmType == "0" || item.MedChrgitmType == "12" || item.MedChrgitmType == "02" { //其他费
  9961. // otherCostTotal, _ = decimal.NewFromFloat(otherCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  9962. // otherCostSelfTotal, _ = decimal.NewFromFloat(otherCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  9963. // otherCostPartSelfTotal, _ = decimal.NewFromFloat(otherCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  9964. // }
  9965. // }
  9966. //
  9967. // miConfig, _ := service.FindMedicalInsuranceInfo(adminUser.CurrentOrgId)
  9968. // config, _ := service.GetMedicalInsuranceConfig(adminUser.CurrentOrgId)
  9969. //
  9970. // var user_name string
  9971. // role, _ := service.GetAdminUserInfoByID(adminUser.CurrentOrgId, admin_user_id)
  9972. // if role.ID == 0 {
  9973. // user_name = "管理员"
  9974. // } else {
  9975. // user_name = role.UserName
  9976. // }
  9977. //
  9978. // baseParams := models.BaseParams{
  9979. // SecretKey: miConfig.SecretKey,
  9980. // FixmedinsCode: miConfig.Code,
  9981. // InsuplcAdmdvs: miConfig.InsuplcAdmdvs,
  9982. // MdtrtareaAdmvs: miConfig.MdtrtareaAdmvs,
  9983. // OrgName: miConfig.OrgName,
  9984. // Doctor: user_name,
  9985. // }
  9986. //
  9987. // businessParams := models.BusinessParams{
  9988. // PsnNo: order.PsnNo,
  9989. // MdtrtId: order.MdtrtId,
  9990. // SetlId: order.SetlId,
  9991. // }
  9992. // var res ResultEleven
  9993. // var resEleven10265 ResultEleven10265
  9994. //
  9995. // if config.IsOpen == 1 {
  9996. // if miConfig.MdtrtareaAdmvs == "421300" {
  9997. //
  9998. // api := "http://192.168.124.4:9532/" + "hbyb/5203?psn_no=" + businessParams.PsnNo + "&mdtrt_id=" + businessParams.MdtrtId + "&setl_id=" + businessParams.SetlId +
  9999. // "&org_name=" + miConfig.OrgName + "&doctor=" + baseParams.Doctor + "&fixmedins_code=" + miConfig.Code +
  10000. // "&insuplc_admdvs=" + miConfig.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey
  10001. // resp, requestErr := http.Get(api)
  10002. // if requestErr != nil {
  10003. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  10004. // return
  10005. // }
  10006. //
  10007. // body, ioErr := ioutil.ReadAll(resp.Body)
  10008. // if ioErr != nil {
  10009. // utils.ErrorLog("接口返回数据读取失败: %v", ioErr)
  10010. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  10011. // return
  10012. // }
  10013. // var respJSON map[string]interface{}
  10014. // if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
  10015. // utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
  10016. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  10017. // return
  10018. // }
  10019. //
  10020. // respJSON = respJSON["data"].(map[string]interface{})["pre"].(map[string]interface{})
  10021. // result, _ := json.Marshal(respJSON)
  10022. // fmt.Println("log")
  10023. // fmt.Println(string(result))
  10024. // if err := json.Unmarshal([]byte(result), &res); err != nil {
  10025. // utils.ErrorLog("解析失败:%v", err)
  10026. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  10027. // return
  10028. // }
  10029. //
  10030. // } else if miConfig.MdtrtareaAdmvs == "320921" || miConfig.MdtrtareaAdmvs == "320982" {
  10031. //
  10032. // var api string
  10033. // if miConfig.MdtrtareaAdmvs == "320921" {
  10034. // api = "http://192.168.2.110:9532/" + "jsyb/5203?psn_no=" + businessParams.PsnNo + "&mdtrt_id=" + businessParams.MdtrtId + "&setl_id=" + businessParams.SetlId +
  10035. // "&org_name=" + miConfig.OrgName + "&doctor=" + baseParams.Doctor + "&fixmedins_code=" + miConfig.Code +
  10036. // "&insuplc_admdvs=" + miConfig.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey + "&url=" + miConfig.Url + "&ak=" + miConfig.AccessKey + "&cainfo=" + miConfig.Cainfo
  10037. //
  10038. // //req, _ = http.NewRequest("POST", "http://192.168.2.110:9532/"+"jsyb/2204", bytes.NewReader(bytesData))
  10039. //
  10040. // } else {
  10041. // //req, _ = http.NewRequest("POST", "http://192.168.5.251:9532/"+"jsyb/2204", bytes.NewReader(bytesData))
  10042. // api = "http://192.168.5.251:9532/" + "jsyb/5203?psn_no=" + businessParams.PsnNo + "&mdtrt_id=" + businessParams.MdtrtId + "&setl_id=" + businessParams.SetlId +
  10043. // "&org_name=" + miConfig.OrgName + "&doctor=" + baseParams.Doctor + "&fixmedins_code=" + miConfig.Code +
  10044. // "&insuplc_admdvs=" + miConfig.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey + "&url=" + miConfig.Url + "&ak=" + miConfig.AccessKey + "&cainfo=" + miConfig.Cainfo
  10045. //
  10046. // }
  10047. //
  10048. // resp, requestErr := http.Get(api)
  10049. // if requestErr != nil {
  10050. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  10051. // return
  10052. // }
  10053. //
  10054. // body, ioErr := ioutil.ReadAll(resp.Body)
  10055. // if ioErr != nil {
  10056. // utils.ErrorLog("接口返回数据读取失败: %v", ioErr)
  10057. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  10058. // return
  10059. // }
  10060. // var respJSON map[string]interface{}
  10061. // if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
  10062. // utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
  10063. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  10064. // return
  10065. // }
  10066. //
  10067. // respJSON = respJSON["data"].(map[string]interface{})["pre"].(map[string]interface{})
  10068. // result, _ := json.Marshal(respJSON)
  10069. // fmt.Println("log")
  10070. // fmt.Println(string(result))
  10071. // if err := json.Unmarshal([]byte(result), &resEleven10265); err != nil {
  10072. // utils.ErrorLog("解析失败:%v", err)
  10073. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  10074. // return
  10075. // }
  10076. //
  10077. // res.InfRefmsgid = resEleven10265.InfRefmsgid
  10078. // res.Output = resEleven10265.Output
  10079. // res.ErrMsg = resEleven10265.ErrMsg
  10080. // res.Cainfo = resEleven10265.Cainfo
  10081. // res.WarnMsg = resEleven10265.WarnMsg
  10082. // infocode, _ := strconv.ParseInt(resEleven10265.Infcode, 10, 64)
  10083. // res.Infcode = infocode
  10084. //
  10085. // } else if miConfig.MdtrtareaAdmvs == "150499" {
  10086. // fmt.Println("~~~~~~~")
  10087. //
  10088. // api := "http://172.16.13.254:9532/" + "nmyb/5203?psn_no=" + businessParams.PsnNo + "&mdtrt_id=" + businessParams.MdtrtId + "&setl_id=" + businessParams.SetlId +
  10089. // "&org_name=" + miConfig.OrgName + "&doctor=" + baseParams.Doctor + "&fixmedins_code=" + miConfig.Code +
  10090. // "&insuplc_admdvs=" + miConfig.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey
  10091. //
  10092. // resp, requestErr := http.Get(api)
  10093. // if requestErr != nil {
  10094. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  10095. // return
  10096. // }
  10097. // body, ioErr := ioutil.ReadAll(resp.Body)
  10098. // if ioErr != nil {
  10099. // utils.ErrorLog("接口返回数据读取失败: %v", ioErr)
  10100. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  10101. // return
  10102. // }
  10103. // var respJSON map[string]interface{}
  10104. // if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
  10105. // utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
  10106. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  10107. // return
  10108. // }
  10109. //
  10110. // respJSON = respJSON["data"].(map[string]interface{})["pre"].(map[string]interface{})
  10111. // result, _ := json.Marshal(respJSON)
  10112. // fmt.Println("log")
  10113. // fmt.Println(string(result))
  10114. // if err := json.Unmarshal([]byte(result), &resEleven10265); err != nil {
  10115. // utils.ErrorLog("解析失败:%v", err)
  10116. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  10117. // return
  10118. // }
  10119. //
  10120. // res.InfRefmsgid = resEleven10265.InfRefmsgid
  10121. // res.Output = resEleven10265.Output
  10122. // res.ErrMsg = resEleven10265.ErrMsg
  10123. // res.Cainfo = resEleven10265.Cainfo
  10124. // res.WarnMsg = resEleven10265.WarnMsg
  10125. // infocode, _ := strconv.ParseInt(resEleven10265.Infcode, 10, 64)
  10126. // res.Infcode = infocode
  10127. //
  10128. // } else {
  10129. // result := service.Gdyb5203(baseParams, businessParams)
  10130. // //service.Gdyb5204(baseParams, businessParams)
  10131. // //service.Gdyb5302(businessParams.PsnNo, baseParams.OrgName, baseParams.Doctor, baseParams.FixmedinsCode, baseParams.InsuplcAdmdvs, baseParams.MdtrtareaAdmvs, baseParams.SecretKey)
  10132. //
  10133. // var dat map[string]interface{}
  10134. // if err := json.Unmarshal([]byte(result), &dat); err == nil {
  10135. // fmt.Println(dat)
  10136. // } else {
  10137. // fmt.Println(err)
  10138. // }
  10139. // userJSONBytes, _ := json.Marshal(dat)
  10140. //
  10141. // if miConfig.Code == "H15049901371" {
  10142. // if err := json.Unmarshal(userJSONBytes, &resEleven10265); err != nil {
  10143. // utils.ErrorLog("解析失败:%v", err)
  10144. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  10145. // return
  10146. // }
  10147. // res.InfRefmsgid = resEleven10265.InfRefmsgid
  10148. // res.Output = resEleven10265.Output
  10149. // res.ErrMsg = resEleven10265.ErrMsg
  10150. // res.Cainfo = resEleven10265.Cainfo
  10151. // res.WarnMsg = resEleven10265.WarnMsg
  10152. // infocode, _ := strconv.ParseInt(resEleven10265.Infcode, 10, 64)
  10153. // res.Infcode = infocode
  10154. // } else {
  10155. // if err := json.Unmarshal(userJSONBytes, &res); err != nil {
  10156. // utils.ErrorLog("解析失败:%v", err)
  10157. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  10158. // return
  10159. // }
  10160. //
  10161. // }
  10162. // }
  10163. //
  10164. // printor_admin, _ := service.GetAdminUserInfoByID(adminUser.CurrentOrgId, admin_user_id)
  10165. // charge_admin, _ := service.GetAdminUserInfoByID(adminUser.CurrentOrgId, order.Creator)
  10166. //
  10167. // patientPrescription, _ := service.FindPatientPrescriptionInfo(adminUser.CurrentOrgId, order.PatientId, order.SettleAccountsDate)
  10168. // adminRole_two, _ := service.GetAdminUserInfoByID(adminUser.CurrentOrgId, patientPrescription.DoctorId)
  10169. //
  10170. // doctor_info, _ := service.GetAdminUserInfoByID(adminUser.CurrentOrgId, his_hospital.Doctor)
  10171. //
  10172. // roles, _ := service.GetAdminUserInfoByID(adminUser.CurrentOrgId, admin_user_id)
  10173. //
  10174. // var doctor_name string
  10175. // if roles.ID == 0 {
  10176. // doctor_name = "管理员"
  10177. // } else {
  10178. // doctor_name = roles.UserName
  10179. // }
  10180. //
  10181. // yiliao_leibie := ""
  10182. //
  10183. // switch order.MedType {
  10184. // case "11":
  10185. // yiliao_leibie = "普通门诊"
  10186. // break
  10187. // case "12":
  10188. // yiliao_leibie = "门诊挂号"
  10189. // break
  10190. // case "13":
  10191. // yiliao_leibie = "急诊"
  10192. // break
  10193. // case "14":
  10194. // yiliao_leibie = "门诊特殊病"
  10195. // break
  10196. // case "15":
  10197. // yiliao_leibie = "门诊统筹"
  10198. // break
  10199. // case "16":
  10200. // yiliao_leibie = "门诊慢性病"
  10201. // break
  10202. // case "21":
  10203. // yiliao_leibie = "普通住院"
  10204. // break
  10205. // }
  10206. // departments, _ := service.GetDepartMentDetail(patientPrescription.Departments)
  10207. //
  10208. // if res.Infcode == 0 {
  10209. // c.ServeSuccessJSON(map[string]interface{}{
  10210. // "diagnosis": name,
  10211. // "order_infos": orderInfos,
  10212. // "number": order.MdtrtId,
  10213. // "date": order.SettleAccountsDate,
  10214. // "charge_admin": charge_admin,
  10215. // "printor_admin": printor_admin,
  10216. // "info": res.Output.Setlinfo,
  10217. // "order": order,
  10218. // "bedCostTotal": bedCostTotal,
  10219. // "bedCostSelfTotal": bedCostSelfTotal,
  10220. // "bedCostPartSelfTotal": bedCostPartSelfTotal,
  10221. // "operationCostTotal": operationCostTotal,
  10222. // "operationCostSelfTotal": operationCostSelfTotal,
  10223. // "operationCostPartSelfTotal": operationCostPartSelfTotal,
  10224. // "otherCostTotal": otherCostTotal,
  10225. // "otherCostSelfTotal": otherCostSelfTotal,
  10226. // "otherCostPartSelfTotal": otherCostPartSelfTotal,
  10227. // "materialCostTotal": materialCostTotal,
  10228. // "materialCostSelfTotal": materialCostSelfTotal,
  10229. // "materialCostPartSelfTotal": materialCostPartSelfTotal,
  10230. // "westernMedicineCostTotal": westernMedicineCostTotal,
  10231. // "westernMedicineCostSelfTotal": westernMedicineCostSelfTotal,
  10232. // "westernMedicineCostPartSelfTotal": westernMedicineCostPartSelfTotal,
  10233. // "chineseTraditionalMedicineCostTotal": chineseTraditionalMedicineCostTotal,
  10234. // "chineseTraditionalMedicineCostSelfTotal": chineseTraditionalMedicineCostSelfTotal,
  10235. // "chineseTraditionalMedicineCostPartSelfTotal": chineseTraditionalMedicineCostPartSelfTotal,
  10236. // "checkCostTotal": checkCostTotal,
  10237. // "checkCostSelfTotal": checkCostSelfTotal,
  10238. // "checkCostPartSelfTotal": checkCostPartSelfTotal,
  10239. // "laboratoryCostTotal": laboratoryCostTotal,
  10240. // "laboratoryCostSelfTotal": laboratoryCostSelfTotal,
  10241. // "laboratoryCostPartSelfTotal": laboratoryCostPartSelfTotal,
  10242. // "treatCostTotal": treatCostTotal,
  10243. // "treatCostSelfTotal": treatCostSelfTotal,
  10244. // "treatCostPartSelfTotal": treatCostPartSelfTotal,
  10245. // "doctor_info": doctor_info,
  10246. // "doctor_code": adminRole_two.DoctorCode,
  10247. // "doctor_name": doctor_name,
  10248. // "health_card_no": order.PsnNo,
  10249. // "department": departments.Name,
  10250. // "yiliao_leibie": yiliao_leibie,
  10251. // "after_money": order.AccountPrice,
  10252. // "patient": patient,
  10253. // "org_name": miConfig.OrgName,
  10254. // "org_code": miConfig.Code,
  10255. // "order_number": order.Number,
  10256. // "his_hospital": his_hospital,
  10257. // "his": his,
  10258. // "dia_config": dia_config,
  10259. //
  10260. // //"check_order_info": cus_slice,
  10261. // })
  10262. // }
  10263. // }
  10264. //
  10265. //}
  10266. //
  10267. //func (c *HisApiController) CheckTreatment() {
  10268. // patient_id, _ := c.GetInt64("patient_id")
  10269. // id_card_no := c.GetString("id_card_no")
  10270. // insutype := c.GetString("insutype")
  10271. // med_type := c.GetString("med_type")
  10272. // admin_user_id, _ := c.GetInt64("admin_user_id")
  10273. //
  10274. // adminUser := c.GetAdminUserInfo()
  10275. // patient, _ := service.GetPatientByID(adminUser.CurrentOrgId, patient_id)
  10276. //
  10277. // miConfig, _ := service.FindMedicalInsuranceInfo(adminUser.CurrentOrgId)
  10278. // config, _ := service.GetMedicalInsuranceConfig(adminUser.CurrentOrgId)
  10279. // roles, _ := service.GetAdminUserInfoByID(adminUser.CurrentOrgId, admin_user_id)
  10280. //
  10281. // if miConfig.MdtrtareaAdmvs == "421300" {
  10282. // var res ResultTwo
  10283. // api := "http://192.168.124.4:9532/" + "hbyb/1101?cert_no=" + "" +
  10284. // "&org_name=" + miConfig.OrgName + "&doctor=" + roles.UserName + "&fixmedins_code=" + miConfig.Code +
  10285. // "&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)
  10286. // resp, requestErr := http.Get(api)
  10287. // if requestErr != nil {
  10288. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  10289. // return
  10290. // }
  10291. //
  10292. // body, ioErr := ioutil.ReadAll(resp.Body)
  10293. // if ioErr != nil {
  10294. // utils.ErrorLog("接口返回数据读取失败: %v", ioErr)
  10295. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  10296. // return
  10297. // }
  10298. // var respJSON map[string]interface{}
  10299. // if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
  10300. // utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
  10301. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  10302. // return
  10303. // }
  10304. //
  10305. // respJSON = respJSON["data"].(map[string]interface{})["pre"].(map[string]interface{})
  10306. // result, _ := json.Marshal(respJSON)
  10307. //
  10308. // if err := json.Unmarshal([]byte(result), &res); err != nil {
  10309. // utils.ErrorLog("解析失败:%v", err)
  10310. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  10311. // return
  10312. // }
  10313. //
  10314. // if res.Infcode == 0 {
  10315. //
  10316. // api := "http://192.168.124.4:9532/" + "hbyb/2001?cert_no=" + "" +
  10317. // "&org_name=" + miConfig.OrgName + "&doctor=" + roles.UserName + "&fixmedins_code=" + miConfig.Code +
  10318. // "&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
  10319. // resp, requestErr := http.Get(api)
  10320. // if requestErr != nil {
  10321. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  10322. // return
  10323. // }
  10324. //
  10325. // body, ioErr := ioutil.ReadAll(resp.Body)
  10326. // if ioErr != nil {
  10327. // utils.ErrorLog("接口返回数据读取失败: %v", ioErr)
  10328. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  10329. // return
  10330. // }
  10331. // var respJSON map[string]interface{}
  10332. // if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
  10333. // utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
  10334. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  10335. // return
  10336. // }
  10337. // var res Result2001
  10338. //
  10339. // respJSON = respJSON["data"].(map[string]interface{})["pre"].(map[string]interface{})
  10340. // result2, _ := json.Marshal(respJSON)
  10341. //
  10342. // if err := json.Unmarshal([]byte(result2), &res); err != nil {
  10343. // utils.ErrorLog("解析失败:%v", err)
  10344. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  10345. // return
  10346. // }
  10347. //
  10348. // if res.Infcode == 0 {
  10349. // c.ServeSuccessJSON(map[string]interface{}{
  10350. // "msg": res.Output.Trtinfo,
  10351. // })
  10352. // }
  10353. //
  10354. // } else {
  10355. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeHisFailedException)
  10356. // return
  10357. // }
  10358. //
  10359. // } else {
  10360. //
  10361. // result := service.Gdyb1101A(id_card_no, miConfig.OrgName, roles.UserName, miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, patient.Name)
  10362. // var dat map[string]interface{}
  10363. // if err := json.Unmarshal([]byte(result), &dat); err == nil {
  10364. // fmt.Println(dat)
  10365. // } else {
  10366. // fmt.Println(err)
  10367. // }
  10368. // userJSONBytes, _ := json.Marshal(dat)
  10369. // var res ResultTwo
  10370. // var res10265 ResultTwo10265
  10371. // if miConfig.Code == "H15049901371" {
  10372. // if err := json.Unmarshal(userJSONBytes, &res10265); err != nil {
  10373. // utils.ErrorLog("解析失败:%v", err)
  10374. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  10375. // return
  10376. // }
  10377. // res.ErrMsg = res10265.ErrMsg
  10378. // infocode, _ := strconv.ParseInt(res10265.Infcode, 10, 64)
  10379. // res.Infcode = infocode
  10380. // //res.Output = res10265.Output
  10381. // res.InfRefmsgid = res10265.InfRefmsgid
  10382. // } else {
  10383. // if err := json.Unmarshal(userJSONBytes, &res); err != nil {
  10384. // utils.ErrorLog("解析失败:%v", err)
  10385. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  10386. // return
  10387. // }
  10388. // }
  10389. //
  10390. // var user_name string
  10391. // role, _ := service.GetAdminUserInfoByID(adminUser.CurrentOrgId, adminUser.AdminUser.Id)
  10392. // if role.ID == 0 {
  10393. // user_name = "xxx"
  10394. // } else {
  10395. // user_name = role.UserName
  10396. // }
  10397. //
  10398. // baseParams := models.BaseParams{
  10399. // SecretKey: miConfig.SecretKey,
  10400. // FixmedinsCode: miConfig.Code,
  10401. // InsuplcAdmdvs: miConfig.InsuplcAdmdvs,
  10402. // MdtrtareaAdmvs: miConfig.MdtrtareaAdmvs,
  10403. // OrgName: miConfig.OrgName,
  10404. // Doctor: user_name,
  10405. // }
  10406. //
  10407. // if config.IsOpen == 1 {
  10408. // if miConfig.Code == "H15049901371" {
  10409. // if med_type == "14" {
  10410. // if insutype == "390" {
  10411. // med_type = "9933"
  10412. // } else if insutype == "310" {
  10413. // med_type = "990502"
  10414. // }
  10415. // } else if med_type == "11" {
  10416. // med_type = "11"
  10417. // }
  10418. // }
  10419. // result := service.Gdyb2001(baseParams, res.Output[0].Baseinfo.PsnNo, insutype, med_type)
  10420. // var dat map[string]interface{}
  10421. // if err := json.Unmarshal([]byte(result), &dat); err == nil {
  10422. // fmt.Println(dat)
  10423. // } else {
  10424. // fmt.Println(err)
  10425. // }
  10426. // var res Result2001
  10427. // var res10265 Result2001Org10265
  10428. // if miConfig.Code == "H15049901371" {
  10429. // if err := json.Unmarshal([]byte(result), &res10265); err != nil {
  10430. // utils.ErrorLog("解析失败:%v", err)
  10431. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  10432. // return
  10433. // }
  10434. // res.ErrMsg = res10265.ErrMsg
  10435. // res.Output = res10265.Output
  10436. // res.InfRefmsgid = res10265.InfRefmsgid
  10437. // infocode, _ := strconv.ParseInt(res10265.Infcode, 10, 64)
  10438. // res.Infcode = infocode
  10439. // } else {
  10440. // if err := json.Unmarshal([]byte(result), &res); err != nil {
  10441. // utils.ErrorLog("解析失败:%v", err)
  10442. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  10443. // return
  10444. // }
  10445. // }
  10446. // if res.Infcode == 0 {
  10447. // c.ServeSuccessJSON(map[string]interface{}{
  10448. // "msg": res.Output.Trtinfo,
  10449. // })
  10450. // }
  10451. // }
  10452. // }
  10453. //}
  10454. //
  10455. ////func (c *HisApiController) PutRecord() {
  10456. //// id, _ := c.GetInt64("id")
  10457. //// record_time := c.GetString("record_time")
  10458. //// timeLayout := "2006-01-02"
  10459. //// loc, _ := time.LoadLocation("Local")
  10460. //// theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", record_time+" 00:00:00", loc)
  10461. //// if err != nil {
  10462. //// c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
  10463. //// return
  10464. //// }
  10465. //// recordDateTime := theTime.Unix()
  10466. ////
  10467. //// adminInfo := c.GetAdminUserInfo()
  10468. //// patient, _ := service.GetPatientByID(adminInfo.CurrentOrgId, id)
  10469. //// patientPrescription, _ := service.FindPatientPrescriptionInfo(adminInfo.CurrentOrgId, id, recordDateTime)
  10470. ////
  10471. //// miConfig, _ := service.FindMedicalInsuranceInfo(adminInfo.CurrentOrgId)
  10472. ////
  10473. //// fmt.Println(miConfig.SecretKey)
  10474. ////
  10475. //// if patient == nil {
  10476. //// c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodePatientNoExist)
  10477. //// return
  10478. //// }
  10479. //// if len(patient.IdCardNo) == 0 {
  10480. //// c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeIDCartNo)
  10481. //// return
  10482. //// }
  10483. //// config, _ := service.GetMedicalInsuranceConfig(adminInfo.CurrentOrgId)
  10484. //// if config.IsOpen == 1 {
  10485. //// 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
  10486. //// resp, requestErr := http.Get(api)
  10487. //// if requestErr != nil {
  10488. //// c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  10489. //// return
  10490. //// }
  10491. //// defer resp.Body.Close()
  10492. //// body, ioErr := ioutil.ReadAll(resp.Body)
  10493. //// if ioErr != nil {
  10494. //// utils.ErrorLog("接口返回数据读取失败: %v", ioErr)
  10495. //// c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  10496. //// return
  10497. //// }
  10498. //// var respJSON map[string]interface{}
  10499. ////
  10500. //// if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
  10501. //// utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
  10502. //// c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  10503. //// return
  10504. //// }
  10505. ////
  10506. //// userJSON := respJSON["data"].(map[string]interface{})["pre"].(map[string]interface{})
  10507. //// userJSONBytes, _ := json.Marshal(userJSON)
  10508. //// var res ResultTwo
  10509. //// if err := json.Unmarshal(userJSONBytes, &res); err != nil {
  10510. //// utils.ErrorLog("解析失败:%v", err)
  10511. //// c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  10512. //// return
  10513. //// }
  10514. //// Iinfos, _ := json.Marshal(res.Output.Iinfo)
  10515. //// Idetinfos, _ := json.Marshal(res.Output.Idetinfo)
  10516. //// infoStr := string(Iinfos)
  10517. //// idetinfoStr := string(Idetinfos)
  10518. ////
  10519. //// if res.Infcode == 0 {
  10520. //// his := models.VMHisPatient{
  10521. //// Status: 1,
  10522. //// Ctime: time.Now().Unix(),
  10523. //// Mtime: time.Now().Unix(),
  10524. //// PsnNo: res.Output.Baseinfo.PsnNo,
  10525. //// PsnCertType: res.Output.Baseinfo.PsnCertType,
  10526. //// Certno: res.Output.Baseinfo.Certno,
  10527. //// PsnName: res.Output.Baseinfo.PsnName,
  10528. //// Gend: res.Output.Baseinfo.Gend,
  10529. //// Naty: res.Output.Baseinfo.Naty,
  10530. //// Brdy: res.Output.Baseinfo.Brdy,
  10531. //// Age: res.Output.Baseinfo.Age,
  10532. //// Iinfo: infoStr,
  10533. //// Idetinfo: idetinfoStr,
  10534. //// PatientId: patient.ID,
  10535. //// RecordDate: theTime.Unix(),
  10536. //// UserOrgId: adminInfo.CurrentOrgId,
  10537. //// AdminUserId: adminInfo.AdminUser.Id,
  10538. //// IsReturn: 1,
  10539. //// }
  10540. ////
  10541. //// //doctor_id := strconv.FormatInt(patientPrescription.DoctorId, 10)
  10542. //// //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")
  10543. //// //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")
  10544. ////
  10545. //// //var dat map[string]interface{}
  10546. //// //if err := json.Unmarshal([]byte(result), &dat); err == nil {
  10547. //// // fmt.Println(dat)
  10548. //// //} else {
  10549. //// // fmt.Println(err)
  10550. //// //}
  10551. ////
  10552. //// var dat2 map[string]interface{}
  10553. //// if err := json.Unmarshal([]byte(result2), &dat2); err == nil {
  10554. //// fmt.Println(dat2)
  10555. //// } else {
  10556. //// fmt.Println(err)
  10557. //// }
  10558. ////
  10559. //// } else {
  10560. //// adminUser := c.GetAdminUserInfo()
  10561. //// errlog := &models.HisOrderError{
  10562. //// UserOrgId: adminUser.CurrentOrgId,
  10563. //// Ctime: time.Now().Unix(),
  10564. //// Mtime: time.Now().Unix(),
  10565. //// ErrMsg: res.ErrMsg,
  10566. //// Status: 1,
  10567. //// PatientId: id,
  10568. //// RecordTime: recordDateTime,
  10569. //// Stage: 1,
  10570. //// }
  10571. //// service.CreateErrMsgLog(errlog)
  10572. //// c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeGdybOneException)
  10573. //// return
  10574. //// }
  10575. //// }
  10576. ////
  10577. ////}
  10578. //
  10579. ////func (c *HisApiController) GetUploadDiag() {
  10580. //// id, _ := c.GetInt64("id")
  10581. //// record_time := c.GetString("record_time")
  10582. ////
  10583. //// diagnosis_id, _ := c.GetInt64("diagnosis")
  10584. //// sick_type, _ := c.GetInt64("sick_type")
  10585. //// reg_type, _ := c.GetInt64("reg_type")
  10586. ////
  10587. //// timeLayout := "2006-01-02"
  10588. //// loc, _ := time.LoadLocation("Local")
  10589. //// theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", record_time+" 00:00:00", loc)
  10590. //// if err != nil {
  10591. //// c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
  10592. //// return
  10593. //// }
  10594. ////
  10595. //// var patientPrescription models.HisPrescriptionInfo
  10596. //// recordDateTime := theTime.Unix()
  10597. //// adminInfo := c.GetAdminUserInfo()
  10598. //// patientPrescription, _ = service.FindPatientPrescriptionInfo(adminInfo.CurrentOrgId, id, recordDateTime)
  10599. ////
  10600. //// if patientPrescription.ID == 0 {
  10601. //// patientPrescription, _ = service.FindLastPatientPrescriptionInfo(adminInfo.CurrentOrgId, id, recordDateTime)
  10602. //// }
  10603. ////
  10604. //// miConfig, _ := service.FindMedicalInsuranceInfo(adminInfo.CurrentOrgId)
  10605. //// diagnosisConfig, _ := service.FindDiagnoseById(diagnosis_id)
  10606. //// his, _ := service.GetVMHisPatientInfo(adminInfo.CurrentOrgId, id, recordDateTime)
  10607. //// sickConfig, _ := service.FindSickById(sick_type)
  10608. //// department, _ := service.GetDepartMentDetail(patientPrescription.Departments)
  10609. ////
  10610. //// api2 := "http://127.0.0.1:9532/" + "gdyb/four?psn_no=" + his.PsnNo +
  10611. //// "&mdtrt_id=" + his.Number + "&doctor=" + patientPrescription.Doctor + "&department=" + department.Name +
  10612. //// "&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 +
  10613. //// "&insuplc_admdvs=" + miConfig.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey + "&sick_code=" + sickConfig.ContentCode + "&sick_name=" + sickConfig.ClassName
  10614. //// resp2, requestErr2 := http.Get(api2)
  10615. //// if requestErr2 != nil {
  10616. //// c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  10617. //// return
  10618. //// }
  10619. //// body2, ioErr2 := ioutil.ReadAll(resp2.Body)
  10620. //// if ioErr2 != nil {
  10621. //// utils.ErrorLog("接口返回数据读取失败: %v", ioErr2)
  10622. //// c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  10623. //// return
  10624. //// }
  10625. //// var respJSON2 map[string]interface{}
  10626. //// if err := json.Unmarshal([]byte(string(body2)), &respJSON2); err != nil {
  10627. //// utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
  10628. //// c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  10629. //// return
  10630. //// }
  10631. //// respJSON2 = respJSON2["data"].(map[string]interface{})["pre"].(map[string]interface{})
  10632. //// userJSONBytes2, _ := json.Marshal(respJSON2)
  10633. ////
  10634. //// var res2 ResultSix
  10635. //// if err := json.Unmarshal(userJSONBytes2, &res2); err != nil {
  10636. //// utils.ErrorLog("解析失败:%v", err)
  10637. //// c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  10638. //// return
  10639. //// }
  10640. //// if res2.Infcode != 0 {
  10641. //// adminUser := c.GetAdminUserInfo()
  10642. //// errlog := &models.HisOrderError{
  10643. //// UserOrgId: adminUser.CurrentOrgId,
  10644. //// Ctime: time.Now().Unix(),
  10645. //// Mtime: time.Now().Unix(),
  10646. //// ErrMsg: res2.ErrMsg,
  10647. //// Status: 1,
  10648. //// PatientId: id,
  10649. //// RecordTime: recordDateTime,
  10650. //// Stage: 3,
  10651. //// }
  10652. //// service.CreateErrMsgLog(errlog)
  10653. ////
  10654. //// c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeRegisterThreeException)
  10655. //// return
  10656. //// }
  10657. ////
  10658. //// c.ServeSuccessJSON(map[string]interface{}{
  10659. //// "msg": "上传成功",
  10660. //// })
  10661. ////
  10662. ////}
  10663. //
  10664. //type QueryResult struct {
  10665. // ID int64
  10666. // Name string
  10667. // Code string
  10668. // List_type_code string
  10669. //}
  10670. //
  10671. //func (c *HisApiController) GetCheckCode() {
  10672. // ids_str := c.GetString("ids")
  10673. // record_type, _ := c.GetInt64("record_type") //1.药品 2.耗材 3.项目
  10674. //
  10675. // ids_arr := strings.Split(ids_str, ",")
  10676. // var queryResult []QueryResult
  10677. // ids := make([]int64, 0)
  10678. // for _, item := range ids_arr {
  10679. // id, _ := strconv.ParseInt(item, 10, 64)
  10680. // ids = append(ids, id)
  10681. // }
  10682. // if record_type == 1 {
  10683. // drugs, _ := service.GetBatchDrugList(ids)
  10684. // for _, item := range drugs {
  10685. // result := QueryResult{
  10686. // ID: item.ID,
  10687. // Name: item.DrugName,
  10688. // Code: item.MedicalInsuranceNumber,
  10689. // List_type_code: "101",
  10690. // }
  10691. // queryResult = append(queryResult, result)
  10692. // }
  10693. //
  10694. // } else if record_type == 2 {
  10695. // goods, _ := service.GetBatchGoodInformationList(ids)
  10696. //
  10697. // for _, item := range goods {
  10698. // result := QueryResult{
  10699. // ID: item.ID,
  10700. // Name: item.GoodName,
  10701. // Code: item.MedicalInsuranceNumber,
  10702. // List_type_code: "301",
  10703. // }
  10704. // queryResult = append(queryResult, result)
  10705. // }
  10706. // } else if record_type == 3 {
  10707. // projects, _ := service.GetBathchMyPorjecgList(ids)
  10708. // for _, item := range projects {
  10709. // result := QueryResult{
  10710. // ID: item.ID,
  10711. // Name: item.ProjectName,
  10712. // Code: item.MedicalCode,
  10713. // List_type_code: "201",
  10714. // }
  10715. // queryResult = append(queryResult, result)
  10716. // }
  10717. // }
  10718. //
  10719. // admin_user_id, _ := c.GetInt64("admin_user_id")
  10720. // adminUser := c.GetAdminUserInfo()
  10721. // miConfig, _ := service.FindMedicalInsuranceInfo(adminUser.CurrentOrgId)
  10722. // config, _ := service.GetMedicalInsuranceConfig(adminUser.CurrentOrgId)
  10723. //
  10724. // var user_name string
  10725. // role, _ := service.GetAdminUserInfoByID(adminUser.CurrentOrgId, admin_user_id)
  10726. // if role.ID == 0 {
  10727. // user_name = "xxx"
  10728. // } else {
  10729. // user_name = role.UserName
  10730. // }
  10731. //
  10732. // baseParams := &models.BaseParams{
  10733. // SecretKey: miConfig.SecretKey,
  10734. // FixmedinsCode: miConfig.Code,
  10735. // InsuplcAdmdvs: miConfig.InsuplcAdmdvs,
  10736. // MdtrtareaAdmvs: miConfig.MdtrtareaAdmvs,
  10737. // OrgName: miConfig.OrgName,
  10738. // Doctor: user_name,
  10739. // }
  10740. //
  10741. // if config.IsOpen == 1 {
  10742. // for _, item := range queryResult {
  10743. // var result string
  10744. // if record_type == 1 {
  10745. // result = service.Gdyb3301(baseParams, item.Name, item.Code, item.List_type_code, "2021-04-26", "", item.List_type_code)
  10746. // } else if record_type == 2 {
  10747. // result = service.Gdyb3301(baseParams, item.Name, item.Code, item.List_type_code, "2021-04-26", "", item.List_type_code)
  10748. // } else if record_type == 3 {
  10749. // result = service.Gdyb3301(baseParams, item.Name, item.Code, item.List_type_code, "2021-04-26", "", item.List_type_code)
  10750. // }
  10751. // var dat map[string]interface{}
  10752. // if err := json.Unmarshal([]byte(result), &dat); err == nil {
  10753. // fmt.Println(dat)
  10754. // } else {
  10755. // fmt.Println(err)
  10756. // }
  10757. // userJSONBytes, _ := json.Marshal(dat)
  10758. // var res ResultSix
  10759. // if err := json.Unmarshal(userJSONBytes, &res); err != nil {
  10760. // utils.ErrorLog("解析失败:%v", err)
  10761. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  10762. // return
  10763. // }
  10764. // if res.Infcode == 0 {
  10765. // if record_type == 1 {
  10766. // service.UpdateBaseDrugById(item.ID)
  10767. // } else if record_type == 2 {
  10768. // service.UpdateGoodInformaitonByDetail(item.ID)
  10769. // } else if record_type == 3 {
  10770. // service.UpdateProjectById(item.ID)
  10771. // }
  10772. // c.ServeSuccessJSON(map[string]interface{}{
  10773. // "failed_code": 0,
  10774. // "msg": "目录对照成功",
  10775. // })
  10776. // } else {
  10777. // c.ServeSuccessJSON(map[string]interface{}{
  10778. // "failed_code": -10,
  10779. // "msg": res.ErrMsg,
  10780. // })
  10781. //
  10782. // }
  10783. // }
  10784. // }
  10785. //}
  10786. //func (c *HisApiController) UnCheckCode() {
  10787. // ids_str := c.GetString("ids")
  10788. // record_type, _ := c.GetInt64("record_type") //1.药品 2.耗材 3.项目
  10789. // admin_user_id, _ := c.GetInt64("admin_user_id")
  10790. // ids_arr := strings.Split(ids_str, ",")
  10791. // var queryResult []QueryResult
  10792. // ids := make([]int64, 0)
  10793. // for _, item := range ids_arr {
  10794. // id, _ := strconv.ParseInt(item, 10, 64)
  10795. // ids = append(ids, id)
  10796. // }
  10797. // if record_type == 1 {
  10798. // drugs, _ := service.GetBatchDrugList(ids)
  10799. // for _, item := range drugs {
  10800. // result := QueryResult{
  10801. // ID: item.ID,
  10802. // Name: item.DrugName,
  10803. // Code: item.MedicalInsuranceNumber,
  10804. // List_type_code: "101",
  10805. // }
  10806. // queryResult = append(queryResult, result)
  10807. // }
  10808. //
  10809. // } else if record_type == 2 {
  10810. // goods, _ := service.GetBatchGoodInformationList(ids)
  10811. //
  10812. // for _, item := range goods {
  10813. // result := QueryResult{
  10814. // ID: item.ID,
  10815. // Name: item.GoodName,
  10816. // Code: item.MedicalInsuranceNumber,
  10817. // List_type_code: "301",
  10818. // }
  10819. // queryResult = append(queryResult, result)
  10820. // }
  10821. // } else if record_type == 3 {
  10822. // projects, _ := service.GetBathchMyPorjecgList(ids)
  10823. // for _, item := range projects {
  10824. // result := QueryResult{
  10825. // ID: item.ID,
  10826. // Name: item.ProjectName,
  10827. // Code: item.MedicalCode,
  10828. // List_type_code: "201",
  10829. // }
  10830. // queryResult = append(queryResult, result)
  10831. // }
  10832. // }
  10833. //
  10834. // adminUser := c.GetAdminUserInfo()
  10835. //
  10836. // miConfig, _ := service.FindMedicalInsuranceInfo(adminUser.CurrentOrgId)
  10837. // config, _ := service.GetMedicalInsuranceConfig(adminUser.CurrentOrgId)
  10838. //
  10839. // var user_name string
  10840. // role, _ := service.GetAdminUserInfoByID(adminUser.CurrentOrgId, admin_user_id)
  10841. // if role.ID == 0 {
  10842. // user_name = "xxx"
  10843. // } else {
  10844. // user_name = role.UserName
  10845. // }
  10846. //
  10847. // baseParams := &models.BaseParams{
  10848. // SecretKey: miConfig.SecretKey,
  10849. // FixmedinsCode: miConfig.Code,
  10850. // InsuplcAdmdvs: miConfig.InsuplcAdmdvs,
  10851. // MdtrtareaAdmvs: miConfig.MdtrtareaAdmvs,
  10852. // OrgName: miConfig.OrgName,
  10853. // Doctor: user_name,
  10854. // }
  10855. //
  10856. // if config.IsOpen == 1 {
  10857. // for _, item := range queryResult {
  10858. // var result string
  10859. // if record_type == 1 {
  10860. // result = service.Gdyb3302(baseParams, item.Name, item.Code, item.List_type_code)
  10861. // } else if record_type == 2 {
  10862. // result = service.Gdyb3302(baseParams, item.Name, item.Code, item.List_type_code)
  10863. // } else if record_type == 3 {
  10864. // result = service.Gdyb3302(baseParams, item.Name, item.Code, item.List_type_code)
  10865. // }
  10866. // var dat2 map[string]interface{}
  10867. // if err := json.Unmarshal([]byte(result), &dat2); err == nil {
  10868. // fmt.Println(dat2)
  10869. // } else {
  10870. // fmt.Println(err)
  10871. // }
  10872. // userJSONBytes, _ := json.Marshal(dat2)
  10873. // var res ResultSix
  10874. // if err := json.Unmarshal(userJSONBytes, &res); err != nil {
  10875. // utils.ErrorLog("解析失败:%v", err)
  10876. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  10877. // return
  10878. // }
  10879. // if res.Infcode == 0 {
  10880. // if record_type == 1 {
  10881. // service.UpdateDrugByIdDetail(item.ID)
  10882. // } else if record_type == 2 {
  10883. // service.UpdateGoodInfoById(item.ID)
  10884. // } else if record_type == 3 {
  10885. // service.UpdateMyProjectById(item.ID)
  10886. // }
  10887. // c.ServeSuccessJSON(map[string]interface{}{
  10888. // "failed_code": 0,
  10889. // "msg": "撤销目录对照成功",
  10890. // })
  10891. // } else {
  10892. // c.ServeSuccessJSON(map[string]interface{}{
  10893. // "failed_code": -10,
  10894. // "msg": res.ErrMsg,
  10895. // })
  10896. // }
  10897. // }
  10898. // }
  10899. //}
  10900. //func (c *HisApiController) GetPatientInfo() {
  10901. // id_card_no := c.GetString("id_card_no")
  10902. // admin_user_id, _ := c.GetInt64("admin_user_id")
  10903. //
  10904. // patient, _ := service.GetPatientByIDCard(id_card_no, c.GetAdminUserInfo().CurrentOrgId)
  10905. //
  10906. // if patient.ID == 0 {
  10907. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodePatientNoExist)
  10908. // return
  10909. // }
  10910. //
  10911. // role, _ := service.GetAdminUserInfoByID(c.GetAdminUserInfo().CurrentOrgId, admin_user_id)
  10912. // miConfig, _ := service.FindMedicalInsuranceInfo(c.GetAdminUserInfo().CurrentOrgId)
  10913. // config, _ := service.GetMedicalInsuranceConfig(c.GetAdminUserInfo().CurrentOrgId)
  10914. // if config.IsOpen == 1 {
  10915. //
  10916. // result := service.Gdyb1101A(id_card_no, miConfig.OrgName, role.UserName, miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, patient.Name)
  10917. // var dat map[string]interface{}
  10918. // if err := json.Unmarshal([]byte(result), &dat); err == nil {
  10919. // fmt.Println(dat)
  10920. // } else {
  10921. // fmt.Println(err)
  10922. // }
  10923. //
  10924. // userJSONBytes, _ := json.Marshal(dat)
  10925. // var res ResultTwo
  10926. // var res10265 ResultTwo10265
  10927. //
  10928. // if miConfig.Code == "H15049901371" {
  10929. // if err := json.Unmarshal(userJSONBytes, &res10265); err != nil {
  10930. // utils.ErrorLog("解析失败:%v", err)
  10931. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  10932. // return
  10933. // }
  10934. // res.ErrMsg = res10265.ErrMsg
  10935. // infocode, _ := strconv.ParseInt(res10265.Infcode, 10, 64)
  10936. // res.Infcode = infocode
  10937. // //res.Output = res10265.Output
  10938. // res.InfRefmsgid = res10265.InfRefmsgid
  10939. //
  10940. // } else {
  10941. // if err := json.Unmarshal(userJSONBytes, &res); err != nil {
  10942. // utils.ErrorLog("解析失败:%v", err)
  10943. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  10944. // return
  10945. // }
  10946. // }
  10947. //
  10948. // //if err := json.Unmarshal(userJSONBytes, &res); err != nil {
  10949. // // utils.ErrorLog("解析失败:%v", err)
  10950. // // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  10951. // // return
  10952. // //}
  10953. //
  10954. // if res.Infcode != 0 {
  10955. // c.ServeSuccessJSON(map[string]interface{}{
  10956. // "failed_code": -10,
  10957. // "msg": res.ErrMsg,
  10958. // })
  10959. // } else {
  10960. // c.ServeSuccessJSON(map[string]interface{}{
  10961. // "failed_code": 0,
  10962. // "info": res,
  10963. // })
  10964. // }
  10965. //
  10966. // }
  10967. //}
  10968. //func (c *HisApiController) PsnPutOnRecord() {
  10969. // record_type, _ := c.GetInt64("type")
  10970. // patient_id, _ := c.GetInt64("patient_id")
  10971. // admin_user_id, _ := c.GetInt64("admin_user_id")
  10972. // start_time := c.GetString("start_time")
  10973. // end_time := c.GetString("end_time")
  10974. //
  10975. // adminUser := c.GetAdminUserInfo()
  10976. // miConfig, _ := service.FindMedicalInsuranceInfo(adminUser.CurrentOrgId)
  10977. // config, _ := service.GetMedicalInsuranceConfig(adminUser.CurrentOrgId)
  10978. //
  10979. // var patients []*models.Patients
  10980. // if record_type == 1 { //全部备案
  10981. //
  10982. // patient, _ := service.GetAllPatient(adminUser.CurrentOrgId)
  10983. // patients = append(patients, patient...)
  10984. //
  10985. // } else { //单个备案
  10986. // patient, _ := service.GetPatientByID(adminUser.CurrentOrgId, patient_id)
  10987. // patients = append(patients, patient)
  10988. //
  10989. // }
  10990. //
  10991. // var user_name string
  10992. // role, _ := service.GetAdminUserInfoByID(adminUser.CurrentOrgId, admin_user_id)
  10993. // if role.ID == 0 {
  10994. // user_name = "xxx"
  10995. // } else {
  10996. // user_name = role.UserName
  10997. // }
  10998. //
  10999. // if config.IsOpen == 1 {
  11000. // for _, item := range patients {
  11001. // 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
  11002. // resp, requestErr := http.Get(api)
  11003. // if requestErr != nil {
  11004. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  11005. // return
  11006. // }
  11007. // defer resp.Body.Close()
  11008. // body, ioErr := ioutil.ReadAll(resp.Body)
  11009. // if ioErr != nil {
  11010. // utils.ErrorLog("接口返回数据读取失败: %v", ioErr)
  11011. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  11012. // return
  11013. // }
  11014. // var respJSON map[string]interface{}
  11015. //
  11016. // if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
  11017. // utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
  11018. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  11019. // return
  11020. // }
  11021. //
  11022. // userJSON := respJSON["data"].(map[string]interface{})["pre"].(map[string]interface{})
  11023. // userJSONBytes, _ := json.Marshal(userJSON)
  11024. // var res ResultTwo
  11025. // if err := json.Unmarshal(userJSONBytes, &res); err != nil {
  11026. // utils.ErrorLog("解析失败:%v", err)
  11027. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  11028. // return
  11029. // }
  11030. //
  11031. // if res.Infcode == 0 {
  11032. // result := service.Gdyb2505(res.Output[0].Baseinfo.PsnNo, user_name, miConfig.OrgName, miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, start_time, end_time)
  11033. // var dat map[string]interface{}
  11034. // if err := json.Unmarshal([]byte(result), &dat); err == nil {
  11035. // fmt.Println(dat)
  11036. // } else {
  11037. // fmt.Println(err)
  11038. // }
  11039. //
  11040. // userJSONBytes, _ := json.Marshal(dat)
  11041. //
  11042. // var res2 ResultThirteen
  11043. // if err := json.Unmarshal(userJSONBytes, &res2); err != nil {
  11044. // utils.ErrorLog("解析失败:%v", err)
  11045. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  11046. // return
  11047. // }
  11048. // if res2.Infcode == 0 {
  11049. // psnResult := &models.GdybPsnRecord{
  11050. // UserOrgId: adminUser.CurrentOrgId,
  11051. // PatientId: item.ID,
  11052. // PsnNo: res.Output[0].Baseinfo.PsnNo,
  11053. // Ctime: time.Now().Unix(),
  11054. // Mtime: time.Now().Unix(),
  11055. // Status: 1,
  11056. // IsCancel: 1,
  11057. // TrtDclaDetlSn: res2.Output.Result.TrtDclaDetlSn,
  11058. // }
  11059. // service.CreatePsnRecord(psnResult)
  11060. //
  11061. // } else {
  11062. // c.ServeSuccessJSON(map[string]interface{}{
  11063. // "failed_code": -10,
  11064. // "msg": res2.ErrMsg,
  11065. // })
  11066. // return
  11067. // }
  11068. //
  11069. // }
  11070. //
  11071. // }
  11072. // }
  11073. //
  11074. //}
  11075. //func (c *HisApiController) PsnUnPutOnRecord() {
  11076. // id, _ := c.GetInt64("id")
  11077. // //record_type, _ := c.GetInt64("type")
  11078. // admin_user_id, _ := c.GetInt64("admin_user_id")
  11079. //
  11080. // adminUser := c.GetAdminUserInfo()
  11081. // miConfig, _ := service.FindMedicalInsuranceInfo(adminUser.CurrentOrgId)
  11082. // config, _ := service.GetMedicalInsuranceConfig(adminUser.CurrentOrgId)
  11083. //
  11084. // var user_name string
  11085. // role, _ := service.GetAdminUserInfoByID(adminUser.CurrentOrgId, admin_user_id)
  11086. // if role.ID == 0 {
  11087. // user_name = "xxx"
  11088. // } else {
  11089. // user_name = role.UserName
  11090. // }
  11091. //
  11092. // psn_record, _ := service.GetPsnRecordById(id)
  11093. // if psn_record.ID == 0 {
  11094. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorPsnRecordNoExistWrong)
  11095. // return
  11096. // }
  11097. // if config.IsOpen == 1 {
  11098. // result := service.Gdyb2506(psn_record.PsnNo, user_name, miConfig.OrgName, miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, psn_record.TrtDclaDetlSn)
  11099. // var dat map[string]interface{}
  11100. // if err := json.Unmarshal([]byte(result), &dat); err == nil {
  11101. // fmt.Println(dat)
  11102. // } else {
  11103. // fmt.Println(err)
  11104. // }
  11105. //
  11106. // userJSONBytes, _ := json.Marshal(dat)
  11107. // var res ResultFourteen
  11108. // if err := json.Unmarshal(userJSONBytes, &res); err != nil {
  11109. // utils.ErrorLog("解析失败:%v", err)
  11110. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  11111. // return
  11112. // }
  11113. // if res.Infcode == 0 {
  11114. // psn_record.IsCancel = 2
  11115. // service.CreatePsnRecord(&psn_record)
  11116. // } else {
  11117. // c.ServeSuccessJSON(map[string]interface{}{
  11118. // "failed_code": -10,
  11119. // "msg": res.ErrMsg,
  11120. // })
  11121. // return
  11122. // }
  11123. // }
  11124. //
  11125. //}
  11126. //func (c *HisApiController) PsnPutNCDSOnRecord() {
  11127. // patient_id, _ := c.GetInt64("patient_id")
  11128. // insutype_two := c.GetString("insutype")
  11129. // psn_no := c.GetString("psn_no")
  11130. // doctor_id, _ := c.GetInt64("doctor_id")
  11131. // sick_id, _ := c.GetInt64("sick_id")
  11132. // department_id, _ := c.GetInt64("department_id")
  11133. // start_time := c.GetString("start_time")
  11134. // end_time := c.GetString("end_time")
  11135. // check_time := c.GetString("check_time")
  11136. //
  11137. // adminUser := c.GetAdminUserInfo()
  11138. // patient, _ := service.GetPatientByID(adminUser.CurrentOrgId, patient_id)
  11139. // miConfig, _ := service.FindMedicalInsuranceInfo(adminUser.CurrentOrgId)
  11140. // config, _ := service.GetMedicalInsuranceConfig(adminUser.CurrentOrgId)
  11141. // sick, _ := service.FindSickById(sick_id)
  11142. // doctor, _ := service.GetAdminUserInfoByID(adminUser.CurrentOrgId, doctor_id)
  11143. //
  11144. // role, _ := service.GetAdminUserInfoByID(adminUser.CurrentOrgId, doctor_id)
  11145. // var res ResultTwo
  11146. // var res10265 ResultTwo10265
  11147. // if miConfig.MdtrtareaAdmvs == "320921" || miConfig.MdtrtareaAdmvs == "320982" {
  11148. // psn_info, _ := service.GetPsnByPatientId(patient.ID)
  11149. // api := "http://192.168.2.110:9532/" + "hbyb/1101?cert_no=" + "" +
  11150. // "&org_name=" + miConfig.OrgName + "&doctor=" + role.UserName + "&fixmedins_code=" + miConfig.Code +
  11151. // "&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
  11152. // resp, requestErr := http.Get(api)
  11153. // if requestErr != nil {
  11154. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  11155. // return
  11156. // }
  11157. //
  11158. // body, ioErr := ioutil.ReadAll(resp.Body)
  11159. // if ioErr != nil {
  11160. // utils.ErrorLog("接口返回数据读取失败: %v", ioErr)
  11161. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  11162. // return
  11163. // }
  11164. // var respJSON map[string]interface{}
  11165. // if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
  11166. // utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
  11167. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  11168. // return
  11169. // }
  11170. //
  11171. // respJSON = respJSON["data"].(map[string]interface{})["pre"].(map[string]interface{})
  11172. // result, _ := json.Marshal(respJSON)
  11173. // fmt.Println("log")
  11174. // fmt.Println(string(result))
  11175. //
  11176. // if err := json.Unmarshal([]byte(result), &res10265); err != nil {
  11177. // utils.ErrorLog("解析失败:%v", err)
  11178. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  11179. // return
  11180. // }
  11181. // res.ErrMsg = res10265.ErrMsg
  11182. // infocode, _ := strconv.ParseInt(res10265.Infcode, 10, 64)
  11183. // res.Infcode = infocode
  11184. // //res.Output = res10265.Output
  11185. // res.InfRefmsgid = res10265.InfRefmsgid
  11186. //
  11187. // } else {
  11188. // result, _ := service.Gdyb1101(patient.IdCardNo, miConfig.OrgName, role.UserName, miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, 2, "", "0", patient.Name)
  11189. // if miConfig.Code == "H15049901371" {
  11190. // if err := json.Unmarshal([]byte(result), &res10265); err != nil {
  11191. // utils.ErrorLog("解析失败:%v", err)
  11192. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  11193. // return
  11194. // }
  11195. // res.ErrMsg = res10265.ErrMsg
  11196. // infocode, _ := strconv.ParseInt(res10265.Infcode, 10, 64)
  11197. // res.Infcode = infocode
  11198. // //res.Output = res10265.Output
  11199. // res.InfRefmsgid = res10265.InfRefmsgid
  11200. // } else {
  11201. // if err := json.Unmarshal([]byte(result), &res); err != nil {
  11202. // utils.ErrorLog("解析失败:%v", err)
  11203. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  11204. // return
  11205. // }
  11206. // }
  11207. //
  11208. // }
  11209. //
  11210. // Iinfos, _ := json.Marshal(res.Output[0].Iinfo)
  11211. // infoStr := string(Iinfos)
  11212. // var rf []*ResultFive
  11213. // json.Unmarshal([]byte(infoStr), &rf)
  11214. //
  11215. // var insuplc_admdvs string
  11216. // var insutype string
  11217. // var is390 int = 0
  11218. // var is310 int = 0
  11219. // var insutypes []*ResultFive
  11220. //
  11221. // for _, item := range rf {
  11222. // if (item.Insutype == "390" && item.PsnInsuStas == "1") || (item.Insutype == "310" && item.PsnInsuStas == "1") {
  11223. // insutypes = append(insutypes, item)
  11224. // }
  11225. // }
  11226. //
  11227. // if len(insutypes) == 1 {
  11228. // insutype = insutypes[0].Insutype
  11229. // //insuplc_admdvs = insutypes[0].InsuplcAdmdvs
  11230. // } else {
  11231. // for _, i := range insutypes {
  11232. // if i.Insutype == "390" {
  11233. // is390 = 1
  11234. // }
  11235. //
  11236. // if i.Insutype == "310" {
  11237. // is310 = 1
  11238. // }
  11239. // }
  11240. // }
  11241. // if is390 == 1 {
  11242. // insutype = "390"
  11243. // }
  11244. //
  11245. // if is310 == 1 {
  11246. // insutype = "310"
  11247. // }
  11248. //
  11249. // if len(insutypes) == 2 {
  11250. // insutype = insutype_two
  11251. // }
  11252. //
  11253. // if len(insutypes) == 0 {
  11254. // insutype = "310"
  11255. // }
  11256. //
  11257. // insutype = insutype_two
  11258. //
  11259. // fmt.Println(insutype)
  11260. // for _, item := range rf {
  11261. // fmt.Println(item.Insutype)
  11262. // fmt.Println(insutype)
  11263. // if item.Insutype == insutype {
  11264. // fmt.Println(item.Insutype)
  11265. // fmt.Println(insutype)
  11266. // insuplc_admdvs = item.InsuplcAdmdvs
  11267. // }
  11268. // }
  11269. // fmt.Println(insuplc_admdvs)
  11270. // var res2 ResultThirteen
  11271. // var res10265_2 ResultThirteen10265
  11272. // if config.IsOpen == 1 {
  11273. // if miConfig.MdtrtareaAdmvs == "320921" || miConfig.MdtrtareaAdmvs == "320982" {
  11274. //
  11275. // } else {
  11276. // 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)
  11277. // var dat map[string]interface{}
  11278. // if err := json.Unmarshal([]byte(result), &dat); err == nil {
  11279. // fmt.Println(dat)
  11280. // } else {
  11281. // fmt.Println(err)
  11282. // }
  11283. // userJSONBytes, _ := json.Marshal(dat)
  11284. // if miConfig.Code == "H15049901371" {
  11285. // if err := json.Unmarshal(userJSONBytes, &res10265_2); err != nil {
  11286. // utils.ErrorLog("解析失败:%v", err)
  11287. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  11288. // return
  11289. // }
  11290. // res2.ErrMsg = res10265_2.ErrMsg
  11291. // infocode, _ := strconv.ParseInt(res10265_2.Infcode, 10, 64)
  11292. // res2.Infcode = infocode
  11293. // res2.Output = res10265_2.Output
  11294. // res2.InfRefmsgid = res10265_2.InfRefmsgid
  11295. // } else {
  11296. // if err := json.Unmarshal(userJSONBytes, &res2); err != nil {
  11297. // utils.ErrorLog("解析失败:%v", err)
  11298. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  11299. // return
  11300. // }
  11301. // }
  11302. // }
  11303. //
  11304. // if res2.Infcode == 0 {
  11305. // psnResult := &models.GdybPsnNcdsRecord{
  11306. // UserOrgId: adminUser.CurrentOrgId,
  11307. // PatientId: patient.ID,
  11308. // PsnNo: psn_no,
  11309. // DoctorId: doctor.AdminUserId,
  11310. // DepartmentId: department_id,
  11311. // SickType: sick_id,
  11312. // Insutype: insutype,
  11313. // Ctime: time.Now().Unix(),
  11314. // Mtime: time.Now().Unix(),
  11315. // Status: 1,
  11316. // IsCancel: 1,
  11317. // TrtDclaDetlSn: res2.Output.Result.TrtDclaDetlSn,
  11318. // }
  11319. // service.CreatePsnNCDSRecord(psnResult)
  11320. // c.ServeSuccessJSON(map[string]interface{}{
  11321. // "failed_code": 0,
  11322. // "msg": "备案成功",
  11323. // "result": psnResult,
  11324. // })
  11325. //
  11326. // } else {
  11327. // c.ServeSuccessJSON(map[string]interface{}{
  11328. // "failed_code": -10,
  11329. // "msg": res2.ErrMsg,
  11330. // })
  11331. // return
  11332. // }
  11333. // }
  11334. //}
  11335. //func (c *HisApiController) PsnPutUnNCDSOnRecord() {
  11336. // id, _ := c.GetInt64("id")
  11337. // admin_user_id, _ := c.GetInt64("admin_user_id")
  11338. // adminUser := c.GetAdminUserInfo()
  11339. // miConfig, _ := service.FindMedicalInsuranceInfo(adminUser.CurrentOrgId)
  11340. // config, _ := service.GetMedicalInsuranceConfig(adminUser.CurrentOrgId)
  11341. //
  11342. // //config, _ := service.Ge(adminUser.CurrentOrgId)
  11343. // patient, _ := service.GetPatientByID(c.GetAdminUserInfo().CurrentOrgId, id)
  11344. // //role, _ := service.GetAdminUserInfoByID(adminUser.CurrentOrgId, admin_user_id)
  11345. // //var user_name string
  11346. // role, _ := service.GetAdminUserInfoByID(adminUser.CurrentOrgId, admin_user_id)
  11347. // //if role.ID == 0 {
  11348. // // user_name = "xxx"
  11349. // //} else {
  11350. // // user_name = role.UserName
  11351. // //}
  11352. // psn_record, _ := service.GetPsnNCDSRecordById(id)
  11353. // if psn_record.ID == 0 {
  11354. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorPsnRecordNoExistWrong)
  11355. // return
  11356. // }
  11357. // result, _ := service.Gdyb1101(patient.IdCardNo, miConfig.OrgName, role.UserName, miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, 2, "", "0", patient.Name)
  11358. // var res ResultTwo
  11359. // var res10265 ResultTwo10265
  11360. //
  11361. // if miConfig.Code == "H15049901371" {
  11362. // if err := json.Unmarshal([]byte(result), &res10265); err != nil {
  11363. // utils.ErrorLog("解析失败:%v", err)
  11364. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  11365. // return
  11366. // }
  11367. // res.ErrMsg = res10265.ErrMsg
  11368. // infocode, _ := strconv.ParseInt(res10265.Infcode, 10, 64)
  11369. // res.Infcode = infocode
  11370. // //res.Output = res10265.Output
  11371. // res.InfRefmsgid = res10265.InfRefmsgid
  11372. //
  11373. // } else {
  11374. // if err := json.Unmarshal([]byte(result), &res); err != nil {
  11375. // utils.ErrorLog("解析失败:%v", err)
  11376. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  11377. // return
  11378. // }
  11379. // }
  11380. // Iinfos, _ := json.Marshal(res.Output[0].Iinfo)
  11381. // infoStr := string(Iinfos)
  11382. // var rf []*ResultFive
  11383. // json.Unmarshal([]byte(infoStr), &rf)
  11384. //
  11385. // var insuplc_admdvs string
  11386. // var insutype string
  11387. // var is390 int = 0
  11388. // var is310 int = 0
  11389. // var insutypes []*ResultFive
  11390. //
  11391. // for _, item := range rf {
  11392. // if (item.Insutype == "390" && item.PsnInsuStas == "1") || (item.Insutype == "310" && item.PsnInsuStas == "1") {
  11393. // insutypes = append(insutypes, item)
  11394. // }
  11395. // }
  11396. //
  11397. // if len(insutypes) == 1 {
  11398. // insutype = insutypes[0].Insutype
  11399. // //insuplc_admdvs = insutypes[0].InsuplcAdmdvs
  11400. // } else {
  11401. // for _, i := range insutypes {
  11402. // if i.Insutype == "390" {
  11403. // is390 = 1
  11404. // }
  11405. //
  11406. // if i.Insutype == "310" {
  11407. // is310 = 1
  11408. // }
  11409. // }
  11410. // }
  11411. // if is390 == 1 {
  11412. // insutype = "390"
  11413. // }
  11414. //
  11415. // if is310 == 1 {
  11416. // insutype = "310"
  11417. // }
  11418. //
  11419. // if len(insutypes) == 0 {
  11420. // insutype = "310"
  11421. // }
  11422. // insutype = psn_record.Insutype
  11423. //
  11424. // for _, item := range rf {
  11425. // if item.Insutype == insutype {
  11426. // insuplc_admdvs = item.InsuplcAdmdvs
  11427. // }
  11428. // }
  11429. //
  11430. // if config.IsOpen == 1 {
  11431. // result := service.Gdyb2504(psn_record.PsnNo, miConfig.OrgName, role.UserName, miConfig.Code, insuplc_admdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, psn_record.TrtDclaDetlSn)
  11432. // var dat map[string]interface{}
  11433. // if err := json.Unmarshal([]byte(result), &dat); err == nil {
  11434. // fmt.Println(dat)
  11435. // } else {
  11436. // fmt.Println(err)
  11437. // }
  11438. //
  11439. // userJSONBytes, _ := json.Marshal(dat)
  11440. // var res ResultFourteen
  11441. // var res10265 ResultFourteen10265
  11442. //
  11443. // if miConfig.Code == "H15049901371" {
  11444. // if err := json.Unmarshal(userJSONBytes, &res10265); err != nil {
  11445. // utils.ErrorLog("解析失败:%v", err)
  11446. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  11447. // return
  11448. // }
  11449. // res.ErrMsg = res10265.ErrMsg
  11450. // infocode, _ := strconv.ParseInt(res10265.Infcode, 10, 64)
  11451. // res.Infcode = infocode
  11452. // res.Output = res10265.Output
  11453. // res.InfRefmsgid = res10265.InfRefmsgid
  11454. //
  11455. // } else {
  11456. // if err := json.Unmarshal([]byte(result), &res); err != nil {
  11457. // utils.ErrorLog("解析失败:%v", err)
  11458. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  11459. // return
  11460. // }
  11461. // }
  11462. //
  11463. // //if err := json.Unmarshal(userJSONBytes, &res); err != nil {
  11464. // // utils.ErrorLog("解析失败:%v", err)
  11465. // // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  11466. // // return
  11467. // //}
  11468. // if res.Infcode == 0 {
  11469. // psn_record.IsCancel = 2
  11470. // service.CreatePsnNCDSRecord(&psn_record)
  11471. // c.ServeSuccessJSON(map[string]interface{}{
  11472. // "failed_code": 0,
  11473. // "msg": "撤销备案成功",
  11474. // })
  11475. // } else {
  11476. // c.ServeSuccessJSON(map[string]interface{}{
  11477. // "failed_code": -10,
  11478. // "msg": res.ErrMsg,
  11479. // })
  11480. // return
  11481. // }
  11482. // }
  11483. //
  11484. //}
  11485. //
  11486. //func (c *HisApiController) TestTest() {
  11487. // patient, _ := service.GetHisPatientInfo(4, 456, 1619712000)
  11488. // fmt.Println(patient.Iinfo)
  11489. //
  11490. //}
  11491. //
  11492. //type CustomData struct {
  11493. // MsgId string
  11494. // PsnNo string
  11495. // Info string
  11496. //}
  11497. //
  11498. //func (c *HisApiController) ReversalData() {
  11499. // var customData []*CustomData
  11500. //
  11501. // custom := &CustomData{
  11502. // MsgId: "H44022900158202103301714472004",
  11503. // PsnNo: "44020000001101329945",
  11504. // Info: "2207",
  11505. // }
  11506. // customData = append(customData, custom)
  11507. //
  11508. // custom1 := &CustomData{
  11509. // MsgId: "H4402290015820210330172057803",
  11510. // PsnNo: "44020000001101161813",
  11511. // Info: "2207",
  11512. // }
  11513. // customData = append(customData, custom1)
  11514. // custom2 := &CustomData{
  11515. // MsgId: "H44022900158202103301705198813",
  11516. // PsnNo: "44190000133097375417",
  11517. // Info: "2207",
  11518. // }
  11519. // customData = append(customData, custom2)
  11520. // custom3 := &CustomData{
  11521. // MsgId: "H44022900158202103301715524756",
  11522. // PsnNo: "44020000001100187221",
  11523. // Info: "2207",
  11524. // }
  11525. // customData = append(customData, custom3)
  11526. // custom4 := &CustomData{
  11527. // MsgId: "H44022900158202103301730376224",
  11528. // PsnNo: "44020000001101959155",
  11529. // Info: "2207",
  11530. // }
  11531. // customData = append(customData, custom4)
  11532. // custom5 := &CustomData{
  11533. // MsgId: "H44022900158202103301748008725",
  11534. // PsnNo: "44020000001104246641",
  11535. // Info: "2207",
  11536. // }
  11537. // customData = append(customData, custom5)
  11538. // custom6 := &CustomData{
  11539. // MsgId: "H44022900158202103301718096755",
  11540. // PsnNo: "44020000001102211860",
  11541. // Info: "2207",
  11542. // }
  11543. // customData = append(customData, custom6)
  11544. // custom7 := &CustomData{
  11545. // MsgId: "H44022900158202103301736551640",
  11546. // PsnNo: "44020000001102687718",
  11547. // Info: "2207",
  11548. // }
  11549. //
  11550. // customData = append(customData, custom7)
  11551. //
  11552. // custom8 := &CustomData{
  11553. // MsgId: "H44022900158202103301743097676",
  11554. // PsnNo: "44020000001102127785",
  11555. // Info: "2207",
  11556. // }
  11557. // customData = append(customData, custom8)
  11558. // custom9 := &CustomData{
  11559. // MsgId: "H44022900158202103301712304203",
  11560. // PsnNo: "44020000001101518097",
  11561. // Info: "2207",
  11562. // }
  11563. // customData = append(customData, custom9)
  11564. // custom10 := &CustomData{
  11565. // MsgId: "H44022900158202103301738448785",
  11566. // PsnNo: "44020000001100500813",
  11567. // Info: "2207",
  11568. // }
  11569. // customData = append(customData, custom10)
  11570. //
  11571. // custom11 := &CustomData{
  11572. // MsgId: "H44022900158202103301732455843",
  11573. // PsnNo: "44020000001102690557",
  11574. // Info: "2207",
  11575. // }
  11576. //
  11577. // customData = append(customData, custom11)
  11578. //
  11579. // custom12 := &CustomData{
  11580. // MsgId: "H44022900158202103301745421708",
  11581. // PsnNo: "44020000001102211928",
  11582. // Info: "2207",
  11583. // }
  11584. // customData = append(customData, custom12)
  11585. //
  11586. // custom1212 := &CustomData{
  11587. // MsgId: "H440229001582021033017351627",
  11588. // PsnNo: "44020000001102481733",
  11589. // Info: "2207",
  11590. // }
  11591. // customData = append(customData, custom1212)
  11592. //
  11593. // custom13 := &CustomData{
  11594. // MsgId: "H44022900158202103301740327951",
  11595. // PsnNo: "44020000001103174866",
  11596. // Info: "2207",
  11597. // }
  11598. // customData = append(customData, custom13)
  11599. // custom14 := &CustomData{
  11600. // MsgId: "H4402290015820210330174922668",
  11601. // PsnNo: "44020000001102927272",
  11602. // Info: "2207",
  11603. // }
  11604. // customData = append(customData, custom14)
  11605. // custom15 := &CustomData{
  11606. // MsgId: "H44022900158202103301752362273",
  11607. // PsnNo: "44020000001102942890",
  11608. // Info: "2207",
  11609. // }
  11610. // customData = append(customData, custom15)
  11611. //
  11612. // custom16 := &CustomData{
  11613. // MsgId: "H44022900158202103301751082917",
  11614. // PsnNo: "44020000001101662162",
  11615. // Info: "2207",
  11616. // }
  11617. // customData = append(customData, custom16)
  11618. //
  11619. // custom17 := &CustomData{
  11620. // MsgId: "H44022900158202103301754147728",
  11621. // PsnNo: "44020000000229014511",
  11622. // Info: "2207",
  11623. // }
  11624. // customData = append(customData, custom17)
  11625. //
  11626. // adminUser := c.GetAdminUserInfo()
  11627. // miConfig, _ := service.FindMedicalInsuranceInfo(adminUser.CurrentOrgId)
  11628. //
  11629. // for _, item := range customData {
  11630. // result := service.Gdyb2601(item.PsnNo, item.MsgId, item.Info, miConfig.OrgName, "张俊杰", miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey)
  11631. // fmt.Println(result)
  11632. // }
  11633. //}
  11634. //
  11635. //func (c *HisApiController) GetAllopatry() {
  11636. // year := c.GetString("year")
  11637. // month := c.GetString("month")
  11638. // admin_user_id, _ := c.GetInt64("admin_user_id")
  11639. // adminUser := c.GetAdminUserInfo()
  11640. // miConfig, _ := service.FindMedicalInsuranceInfo(adminUser.CurrentOrgId)
  11641. // roles, _ := service.GetAdminUserInfoByID(adminUser.CurrentOrgId, admin_user_id)
  11642. // result, _ := service.Gdyb9001(miConfig.OrgName, roles.UserName, miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, 1669)
  11643. //
  11644. // var dat map[string]interface{}
  11645. // if err := json.Unmarshal([]byte(result), &dat); err == nil {
  11646. // fmt.Println(dat)
  11647. // } else {
  11648. // fmt.Println(err)
  11649. // }
  11650. // userJSONBytes, _ := json.Marshal(dat)
  11651. // var res models.Result9001
  11652. // if err := json.Unmarshal(userJSONBytes, &res); err != nil {
  11653. // utils.ErrorLog("解析失败:%v", err)
  11654. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  11655. // return
  11656. // }
  11657. //
  11658. // result2, _ := service.Gdyb3260(miConfig.OrgName, roles.UserName, miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, year, month, "")
  11659. // var dat2 map[string]interface{}
  11660. // if err := json.Unmarshal([]byte(result2), &dat2); err == nil {
  11661. // fmt.Println(dat)
  11662. // } else {
  11663. // fmt.Println(err)
  11664. // }
  11665. // userJSONBytes2, _ := json.Marshal(dat2)
  11666. // var res2 models.Result3260
  11667. // if err := json.Unmarshal(userJSONBytes2, &res2); err != nil {
  11668. // utils.ErrorLog("解析失败:%v", err)
  11669. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  11670. // return
  11671. // }
  11672. // if res2.Infcode == 0 {
  11673. // c.ServeSuccessJSON(map[string]interface{}{
  11674. // "list": res2.Output.Data,
  11675. // })
  11676. // return
  11677. // } else {
  11678. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  11679. // return
  11680. // }
  11681. //
  11682. //}
  11683. //
  11684. //func (c *HisApiController) ComfirmAllopatry() {
  11685. // year := c.GetString("year")
  11686. // month := c.GetString("month")
  11687. // admin_user_id, _ := c.GetInt64("admin_user_id")
  11688. // adminUser := c.GetAdminUserInfo()
  11689. // miConfig, _ := service.FindMedicalInsuranceInfo(adminUser.CurrentOrgId)
  11690. // roles, _ := service.GetAdminUserInfoByID(adminUser.CurrentOrgId, admin_user_id)
  11691. // result, _ := service.Gdyb9001(miConfig.OrgName, roles.UserName, miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, 1669)
  11692. // var dat map[string]interface{}
  11693. // if err := json.Unmarshal([]byte(result), &dat); err == nil {
  11694. // fmt.Println(dat)
  11695. // } else {
  11696. // fmt.Println(err)
  11697. // }
  11698. // userJSONBytes, _ := json.Marshal(dat)
  11699. // var res models.Result9001
  11700. // if err := json.Unmarshal(userJSONBytes, &res); err != nil {
  11701. // utils.ErrorLog("解析失败:%v", err)
  11702. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  11703. // return
  11704. // }
  11705. //
  11706. // result2, _ := service.Gdyb3260(miConfig.OrgName, roles.UserName, miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, year, month, "")
  11707. // var dat2 map[string]interface{}
  11708. // if err := json.Unmarshal([]byte(result2), &dat2); err == nil {
  11709. // fmt.Println(dat)
  11710. // } else {
  11711. // fmt.Println(err)
  11712. // }
  11713. // userJSONBytes2, _ := json.Marshal(dat2)
  11714. // var res2 models.Result3260
  11715. // if err := json.Unmarshal(userJSONBytes2, &res2); err != nil {
  11716. // utils.ErrorLog("解析失败:%v", err)
  11717. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  11718. // return
  11719. // }
  11720. //
  11721. // if res2.Infcode == 0 {
  11722. // result, _, msgId := service.Gdyb3261(miConfig.OrgName, roles.UserName, miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, year, month, res2)
  11723. // var dat map[string]interface{}
  11724. // if err := json.Unmarshal([]byte(result), &dat); err == nil {
  11725. // fmt.Println(dat)
  11726. // } else {
  11727. // fmt.Println(err)
  11728. // }
  11729. // userJSONBytes, _ := json.Marshal(dat)
  11730. // var res3 models.Result3261
  11731. // if err := json.Unmarshal(userJSONBytes, &res3); err != nil {
  11732. // utils.ErrorLog("解析失败:%v", err)
  11733. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  11734. // return
  11735. // }
  11736. //
  11737. // if res3.Infcode == 0 {
  11738. // record := &models.HisYidiClearRecord{
  11739. // UserOrgId: c.GetAdminUserInfo().CurrentOrgId,
  11740. // Ctime: time.Now().Unix(),
  11741. // Mtime: time.Now().Unix(),
  11742. // Status: 1,
  11743. // MsgId: msgId,
  11744. // }
  11745. // service.SaveClearRecord(record)
  11746. // c.ServeSuccessJSON(map[string]interface{}{
  11747. // "msg": "提取成功",
  11748. // })
  11749. // }
  11750. // }
  11751. //}
  11752. //
  11753. //func (c *HisApiController) RefundAllopatry() {
  11754. // year := c.GetString("year")
  11755. // month := c.GetString("month")
  11756. // id, _ := c.GetInt64("id")
  11757. // admin_user_id, _ := c.GetInt64("admin_user_id")
  11758. // adminUser := c.GetAdminUserInfo()
  11759. // miConfig, _ := service.FindMedicalInsuranceInfo(adminUser.CurrentOrgId)
  11760. // roles, _ := service.GetAdminUserInfoByID(adminUser.CurrentOrgId, admin_user_id)
  11761. // record, _ := service.GetClearRecordById(id)
  11762. // result, _ := service.Gdyb3262(miConfig.OrgName, roles.UserName, miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, year, month, record.MsgId)
  11763. //
  11764. // var dat map[string]interface{}
  11765. // if err := json.Unmarshal([]byte(result), &dat); err == nil {
  11766. // fmt.Println(dat)
  11767. // } else {
  11768. // fmt.Println(err)
  11769. // }
  11770. // userJSONBytes, _ := json.Marshal(dat)
  11771. // var empty ResultFourteen
  11772. // if err := json.Unmarshal(userJSONBytes, &empty); err != nil {
  11773. // utils.ErrorLog("解析失败:%v", err)
  11774. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  11775. // return
  11776. // }
  11777. // if empty.Infcode == 0 {
  11778. // c.ServeSuccessJSON(map[string]interface{}{
  11779. // "msg": "撤销成功",
  11780. // })
  11781. // return
  11782. // }
  11783. //}
  11784. //
  11785. //func (c *HisApiController) ReversalOtherData() {
  11786. // var customData []*CustomData
  11787. //
  11788. // custom := &CustomData{
  11789. // MsgId: "H44022900158202103301714472004",
  11790. // PsnNo: "44020000001101329945",
  11791. // Info: "2208",
  11792. // }
  11793. // customData = append(customData, custom)
  11794. //
  11795. // custom1 := &CustomData{
  11796. // MsgId: "H4402290015820210330172057803",
  11797. // PsnNo: "44020000001101161813",
  11798. // Info: "2208",
  11799. // }
  11800. // customData = append(customData, custom1)
  11801. // custom2 := &CustomData{
  11802. // MsgId: "H44022900158202103301705198813",
  11803. // PsnNo: "44190000133097375417",
  11804. // Info: "2208",
  11805. // }
  11806. // customData = append(customData, custom2)
  11807. // custom3 := &CustomData{
  11808. // MsgId: "H44022900158202103301715524756",
  11809. // PsnNo: "44020000001100187221",
  11810. // Info: "2208",
  11811. // }
  11812. // customData = append(customData, custom3)
  11813. // custom4 := &CustomData{
  11814. // MsgId: "H44022900158202103301730376224",
  11815. // PsnNo: "44020000001101959155",
  11816. // Info: "2208",
  11817. // }
  11818. // customData = append(customData, custom4)
  11819. // custom5 := &CustomData{
  11820. // MsgId: "H44022900158202103301748008725",
  11821. // PsnNo: "44020000001104246641",
  11822. // Info: "2208",
  11823. // }
  11824. // customData = append(customData, custom5)
  11825. // custom6 := &CustomData{
  11826. // MsgId: "H44022900158202103301718096755",
  11827. // PsnNo: "44020000001102211860",
  11828. // Info: "2208",
  11829. // }
  11830. // customData = append(customData, custom6)
  11831. // custom7 := &CustomData{
  11832. // MsgId: "H44022900158202103301736551640",
  11833. // PsnNo: "44020000001102687718",
  11834. // Info: "2208",
  11835. // }
  11836. //
  11837. // customData = append(customData, custom7)
  11838. //
  11839. // custom8 := &CustomData{
  11840. // MsgId: "H44022900158202103301743097676",
  11841. // PsnNo: "44020000001102127785",
  11842. // Info: "2208",
  11843. // }
  11844. // customData = append(customData, custom8)
  11845. // custom9 := &CustomData{
  11846. // MsgId: "H44022900158202103301712304203",
  11847. // PsnNo: "44020000001101518097",
  11848. // Info: "2208",
  11849. // }
  11850. // customData = append(customData, custom9)
  11851. // custom10 := &CustomData{
  11852. // MsgId: "H44022900158202103301738448785",
  11853. // PsnNo: "44020000001100500813",
  11854. // Info: "2208",
  11855. // }
  11856. // customData = append(customData, custom10)
  11857. //
  11858. // custom11 := &CustomData{
  11859. // MsgId: "H44022900158202103301732455843",
  11860. // PsnNo: "44020000001102690557",
  11861. // Info: "2208",
  11862. // }
  11863. //
  11864. // customData = append(customData, custom11)
  11865. //
  11866. // custom12 := &CustomData{
  11867. // MsgId: "H44022900158202103301745421708",
  11868. // PsnNo: "44020000001102211928",
  11869. // Info: "2208",
  11870. // }
  11871. // customData = append(customData, custom12)
  11872. //
  11873. // custom1212 := &CustomData{
  11874. // MsgId: "H440229001582021033017351627",
  11875. // PsnNo: "44020000001102481733",
  11876. // Info: "2208",
  11877. // }
  11878. // customData = append(customData, custom1212)
  11879. //
  11880. // custom13 := &CustomData{
  11881. // MsgId: "H44022900158202103301740327951",
  11882. // PsnNo: "44020000001103174866",
  11883. // Info: "2208",
  11884. // }
  11885. // customData = append(customData, custom13)
  11886. // custom14 := &CustomData{
  11887. // MsgId: "H4402290015820210330174922668",
  11888. // PsnNo: "44020000001102927272",
  11889. // Info: "2208",
  11890. // }
  11891. // customData = append(customData, custom14)
  11892. // custom15 := &CustomData{
  11893. // MsgId: "H44022900158202103301752362273",
  11894. // PsnNo: "44020000001102942890",
  11895. // Info: "2208",
  11896. // }
  11897. // customData = append(customData, custom15)
  11898. //
  11899. // custom16 := &CustomData{
  11900. // MsgId: "H44022900158202103301751082917",
  11901. // PsnNo: "44020000001101662162",
  11902. // Info: "2208",
  11903. // }
  11904. // customData = append(customData, custom16)
  11905. //
  11906. // custom17 := &CustomData{
  11907. // MsgId: "H44022900158202103301754147728",
  11908. // PsnNo: "44020000000229014511",
  11909. // Info: "2208",
  11910. // }
  11911. // customData = append(customData, custom17)
  11912. //
  11913. // adminUser := c.GetAdminUserInfo()
  11914. // miConfig, _ := service.FindMedicalInsuranceInfo(adminUser.CurrentOrgId)
  11915. //
  11916. // for _, item := range customData {
  11917. // result := service.Gdyb2601(item.PsnNo, item.MsgId, item.Info, miConfig.OrgName, "张俊杰", miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey)
  11918. // fmt.Println(result)
  11919. // }
  11920. //}
  11921. //
  11922. //func PathExists(path string) (bool, error) {
  11923. // _, err := os.Stat(path)
  11924. // if err == nil {
  11925. // return true, nil
  11926. // }
  11927. // if os.IsNotExist(err) {
  11928. // return false, nil
  11929. // }
  11930. // return false, err
  11931. //}
  11932. //
  11933. ////创建文件夹
  11934. //func Mkdir(dir string) {
  11935. // // 创建文件夹
  11936. // exist, err := PathExists(dir)
  11937. // if err != nil {
  11938. // fmt.Println(err.Error())
  11939. // } else {
  11940. // if exist {
  11941. // fmt.Println(dir + "文件夹已存在!")
  11942. // } else {
  11943. // // 文件夹名称,权限
  11944. // err := os.Mkdir(dir, os.ModePerm)
  11945. // if err != nil {
  11946. // fmt.Println(dir+"文件夹创建失败:", err.Error())
  11947. // } else {
  11948. // fmt.Println(dir + "文件夹创建成功!")
  11949. // }
  11950. // }
  11951. // }
  11952. //}
  11953. //
  11954. ////压缩文件
  11955. //func Zip(srcFile string, destZip string) error {
  11956. // zipfile, err := os.Create(destZip)
  11957. // if err != nil {
  11958. // return err
  11959. // }
  11960. // defer zipfile.Close()
  11961. //
  11962. // archive := zip.NewWriter(zipfile)
  11963. // defer archive.Close()
  11964. //
  11965. // filepath.Walk(srcFile, func(path string, info os.FileInfo, err error) error {
  11966. // if err != nil {
  11967. // return err
  11968. // }
  11969. //
  11970. // header, err := zip.FileInfoHeader(info)
  11971. // if err != nil {
  11972. // return err
  11973. // }
  11974. //
  11975. // header.Name = strings.TrimPrefix(path, filepath.Dir(srcFile)+"/")
  11976. // // header.Name = path
  11977. // if info.IsDir() {
  11978. // header.Name += "/"
  11979. // } else {
  11980. // header.Method = zip.Deflate
  11981. // }
  11982. //
  11983. // writer, err := archive.CreateHeader(header)
  11984. // if err != nil {
  11985. // return err
  11986. // }
  11987. //
  11988. // if !info.IsDir() {
  11989. // file, err := os.Open(path)
  11990. // if err != nil {
  11991. // return err
  11992. // }
  11993. // defer file.Close()
  11994. // _, err = io.Copy(writer, file)
  11995. // }
  11996. // return err
  11997. // })
  11998. //
  11999. // return err
  12000. //}
  12001. //
  12002. //func ReadFile(filePath string) []byte {
  12003. // f, err := os.Open(filePath)
  12004. // if err != nil {
  12005. // fmt.Println("read file fail", err)
  12006. // return nil
  12007. // }
  12008. // defer f.Close()
  12009. //
  12010. // fd, err := ioutil.ReadAll(f)
  12011. // if err != nil {
  12012. // fmt.Println("read to fd fail", err)
  12013. // return nil
  12014. // }
  12015. //
  12016. // return fd
  12017. //}
  12018. //
  12019. //func saveLog(result string, request string, infno string, desc string) {
  12020. //
  12021. // org_id, _ := beego.AppConfig.Int64("org_id")
  12022. // miConfig, _ := service.FindMedicalInsuranceInfo(org_id)
  12023. // dir := miConfig.OrgName + "日志"
  12024. // utils.Mkdir(dir)
  12025. // month := time.Unix(1557042972, 0).Format("1")
  12026. // year := time.Now().Format("2006")
  12027. // month = time.Now().Format("01")
  12028. // day := time.Now().Format("02")
  12029. // hour := time.Now().Format("15")
  12030. // min := time.Now().Format("04")
  12031. // sec := time.Now().Format("05")
  12032. //
  12033. // result_time := year + "-" + month + "-" + day + " " + hour + ":" + min + ":" + sec
  12034. //
  12035. // file := strconv.FormatInt(org_id, 10) + "_" + year + month + day + "_log"
  12036. // file_name := file + ".txt"
  12037. // file_path := miConfig.OrgName + "日志" + "/" + file_name
  12038. // exist, _ := utils.PathExists(file_path)
  12039. // if exist { //存在
  12040. // fmt.Println("存在")
  12041. // f, err := os.OpenFile(file_path, os.O_WRONLY, 0644)
  12042. // if err != nil {
  12043. // fmt.Println("read fail")
  12044. // }
  12045. // content := "\r\n" + "\r\n" + "\r\n" + result_time + " " + "【 " + desc + infno + "入参" + " 】:" + "\r\n" + request + "\r\n" + result_time + " " + "【 " + desc + infno + "出参" + " 】:" + "\r\n" + result
  12046. // n, _ := f.Seek(0, 2)
  12047. // _, err = f.WriteAt([]byte(content), n)
  12048. //
  12049. // } else { //不存在
  12050. // fmt.Println("文件不存在,创建文件")
  12051. // f, err := os.Create(miConfig.OrgName + "日志" + "/" + file_name)
  12052. // defer f.Close()
  12053. // if err != nil {
  12054. // } else {
  12055. // _, err = f.Write([]byte("记录日志"))
  12056. // }
  12057. // }
  12058. //
  12059. //}
  12060. //
  12061. //type Charset string
  12062. //
  12063. //const (
  12064. // UTF8 = Charset("UTF-8")
  12065. // GB18030 = Charset("GB18030")
  12066. //)
  12067. //
  12068. //func ConvertToString(src string, srcCode string, tagCode string) string {
  12069. // srcCoder := mahonia.NewDecoder(srcCode)
  12070. // srcResult := srcCoder.ConvertString(src)
  12071. // tagCoder := mahonia.NewDecoder(tagCode)
  12072. // _, cdata, _ := tagCoder.Translate([]byte(srcResult), true)
  12073. // result := string(cdata)
  12074. // return result
  12075. //}
  12076. //
  12077. //func (c *HisApiController) ReadEleCard() {
  12078. // id_card_type, _ := c.GetInt64("id_card_type")
  12079. // admin_user_id, _ := c.GetInt64("admin_user_id")
  12080. // fmt.Println(c.GetAdminUserInfo().CurrentOrgId)
  12081. // roles, _ := service.GetAdminUserInfoByID(c.GetAdminUserInfo().CurrentOrgId, admin_user_id)
  12082. // miConfig, _ := service.FindMedicalInsuranceInfo(c.GetAdminUserInfo().CurrentOrgId)
  12083. //
  12084. // if miConfig.MdtrtareaAdmvs == "320921" || miConfig.MdtrtareaAdmvs == "320982" {
  12085. // var api string
  12086. // if miConfig.MdtrtareaAdmvs == "320921" {
  12087. // api = "http://192.168.2.110:9532/" + "jsyb/readcard?" + "fixmedins_code=" + miConfig.Code + "&secret_key=" + miConfig.SecretKey + "&ak=" + miConfig.AccessKey + "&org_name=" + miConfig.OrgName + "&doctor=" + roles.UserName +
  12088. // "&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
  12089. // fmt.Println(api)
  12090. //
  12091. // } else {
  12092. // 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 +
  12093. // "&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)
  12094. // }
  12095. //
  12096. // resp, requestErr := http.Get(api)
  12097. // if requestErr != nil {
  12098. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  12099. // return
  12100. // }
  12101. //
  12102. // body, ioErr := ioutil.ReadAll(resp.Body)
  12103. // if ioErr != nil {
  12104. // utils.ErrorLog("接口返回数据读取失败: %v", ioErr)
  12105. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  12106. // return
  12107. // }
  12108. // var respJSON map[string]interface{}
  12109. // if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
  12110. // utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
  12111. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  12112. // return
  12113. // }
  12114. // var status string
  12115. // status = respJSON["data"].(map[string]interface{})["status"].(string)
  12116. // //card_type := respJSON["data"].(map[string]interface{})["type"].(string)
  12117. // var token string
  12118. // var res ResultTwo //1101结果
  12119. // var res10265 ResultTwo10265 //1101结果
  12120. // if status == "0" { //读卡成功
  12121. // var card_info string //卡信息
  12122. // var busi_card_info string
  12123. // token = respJSON["data"].(map[string]interface{})["token"].(string)
  12124. // busi_card_info = respJSON["data"].(map[string]interface{})["busi_card_info"].(string)
  12125. // card_info = respJSON["data"].(map[string]interface{})["card_info"].(string)
  12126. //
  12127. // fmt.Println(card_info)
  12128. // fmt.Println(busi_card_info)
  12129. //
  12130. // respJSON = respJSON["data"].(map[string]interface{})["result"].(map[string]interface{})
  12131. // result, _ := json.Marshal(respJSON)
  12132. //
  12133. // if err := json.Unmarshal([]byte(result), &res10265); err != nil {
  12134. // utils.ErrorLog("解析失败:%v", err)
  12135. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  12136. // return
  12137. // }
  12138. // res.ErrMsg = res10265.ErrMsg
  12139. // infocode, _ := strconv.ParseInt(res10265.Infcode, 10, 64)
  12140. // res.Infcode = infocode
  12141. // //res.Output = res10265.Output
  12142. // res.InfRefmsgid = res10265.InfRefmsgid
  12143. // if res.Infcode == 0 {
  12144. // c.ServeSuccessJSON(map[string]interface{}{
  12145. // "number": token,
  12146. // })
  12147. // }
  12148. // } else {
  12149. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeHisFailedException)
  12150. // return
  12151. // }
  12152. // } else { //读卡失败
  12153. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeHisFailedException)
  12154. // return
  12155. // }
  12156. //}