scrm-go

site_controller.go 170KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475
  1. package site
  2. import (
  3. "github.com/astaxie/beego"
  4. "SCRM/controllers"
  5. "fmt"
  6. "encoding/json"
  7. "SCRM/utils"
  8. "SCRM/enums"
  9. "strconv"
  10. "SCRM/service/site_service"
  11. "SCRM/models"
  12. "time"
  13. "strings"
  14. "github.com/jinzhu/gorm"
  15. )
  16. func siteRouters() {
  17. beego.Router("/api/site/addrotationchart",&Microwebsite{},"Post:AddRotaionChart")
  18. beego.Router("/api/site/savehispital",&Microwebsite{},"Post:SaveHispital")
  19. beego.Router("/api/site/addoffices",&Microwebsite{},"Post:AddOffices")
  20. beego.Router("/api/site/adddoctor",&Microwebsite{},"Post:AddDoctor")
  21. beego.Router("/api/site/adddoctorinfo",&Microwebsite{},"Post:AddDoctorInfo")
  22. beego.Router("/api/site/getrationimages",&Microwebsite{},"Get:GetRationImages")
  23. beego.Router("/api/site/gethospitalinfo",&Microwebsite{},"Get:GetHospitalinfo")
  24. beego.Router("/api/site/getofficeinfo",&Microwebsite{},"Get:GetOfficeInfo")
  25. beego.Router("/api/site/keenvironment",&Microwebsite{},"Post:AddKeEnvironment")
  26. beego.Router("/api/site/getOffEnvironment",&Microwebsite{},"Get:GetOffEnvironment")
  27. beego.Router("/api/site/addrotationupload",&Microwebsite{},"Post:AddRotationUpload")
  28. beego.Router("/api/site/addworktime",&Microwebsite{},"Post:AddWorkTime")
  29. beego.Router("/api/site/addrideway",&Microwebsite{},"Post:AddRideway")
  30. beego.Router("/api/site/addconnection",&Microwebsite{},"Post:AddConnection")
  31. beego.Router("/api/site/queryconnetion",&Microwebsite{},"Get:GetQueryConnection")
  32. beego.Router("/api/site/delete",&Microwebsite{},"Get:DeleteConnecWay")
  33. beego.Router("/api/site/editconnecway",&Microwebsite{},"Get:EditConnecWay")
  34. beego.Router("/api/site/saveconnection",&Microwebsite{},"Post:SaveConnection")
  35. beego.Router("/api/site/addcontract",&Microwebsite{},"Post:AddContract")
  36. beego.Router("/api/site/getuserdmodel",&Microwebsite{},"Post:GetUserdModel")
  37. beego.Router("/api/site/eidtmodel",&Microwebsite{},"Get:GetEditModel")
  38. beego.Router("/api/site/editrideway",&Microwebsite{},"Get:EditRideWay")
  39. beego.Router("/api/site/saveworktime",&Microwebsite{},"Post:SaveWorktTime")
  40. beego.Router("/api/site/saverideway",&Microwebsite{},"Post:Saverideway")
  41. beego.Router("/api/site/getquerynewmodel",&Microwebsite{},"Get:GetQueryNewModel")
  42. beego.Router("/api/site/getquerydocinfo",&Microwebsite{},"Post:GetQueryDocInfo")
  43. beego.Router("/api/site/change",&Microwebsite{},"Get:Change")
  44. beego.Router("/api/site/getquerydochead",&Microwebsite{},"Post:GetQueryDocHead")
  45. beego.Router("/api/site/deletedoctor",&Microwebsite{},"Get:DeleteDoctor")
  46. beego.Router("/api/site/edithospital",&Microwebsite{},"Get:EditHospital")
  47. beego.Router("/api/site/savehostpital",&Microwebsite{},"Post:SaveHospital")
  48. beego.Router("api/site/editoffice",&Microwebsite{},"Get:EditOffice")
  49. beego.Router("/api/site/deletemodlebyid",&Microwebsite{},"Get:Deletemodlebyid")
  50. beego.Router("/api/site/editdoctor",&Microwebsite{},"Get:EditDoctor")
  51. beego.Router("/api/site/saveoffice",&Microwebsite{},"Post:SaveOffice")
  52. beego.Router("/api/site/gethospital",&Microwebsite{},"Post:GetHospital")
  53. beego.Router("/api/site/getDefaultData",&Microwebsite{},"Get:GetDefaultData")
  54. beego.Router("/api/site/getdata",&Microwebsite{},"Get:GetData")
  55. beego.Router("/api/site/editdoc",&Microwebsite{},"Get:EditDoc")
  56. beego.Router("/api/site/savedocinfo",&Microwebsite{},"Post:SaveDocInfo")
  57. beego.Router("/api/site/editImages",&Microwebsite{},"Get:EditImages")
  58. beego.Router("/api/site/savedocdata",&Microwebsite{},"Post:Savedocdata")
  59. beego.Router("/api/site/editofficeenviroment",&Microwebsite{},"Get:EditOfficeEnviroment")
  60. beego.Router("/api/site/addimages",&Microwebsite{},"Post:AddImages")
  61. beego.Router("/api/site/saveofficeenvironment",&Microwebsite{},"Post:SaveOfficeEnvironment")
  62. beego.Router("/api/site/hispitalmore",&Microwebsite{},"Get:Hispitalmore")
  63. beego.Router("/api/site/officemore",&Microwebsite{},"Get:GetOfficeDetail")
  64. beego.Router("/api/site/docmore",&Microwebsite{},"Get:GetDoctorDetail")
  65. beego.Router("/api/site/kemore",&Microwebsite{},"Get:GetOfficEnviromentDetail")
  66. beego.Router("/api/site/articlemore",&Microwebsite{},"Get:GetArticlistDetail")
  67. beego.Router("/api/site/activitiesmore",&Microwebsite{},"Get:GetActivitesDetail")
  68. beego.Router("/api/site/addnavigation",&Microwebsite{},"Post:AddNavigation")
  69. beego.Router("/api/site/getnavigationlist",&Microwebsite{},"Post:GetNavigationList")
  70. beego.Router("/api/site/addshareinfo",&Microwebsite{},"Post:AddShareInfo")
  71. beego.Router("/api/site/getshareinfo",&Microwebsite{},"Post:GetShareInfo")
  72. beego.Router("/api/site/deletenavition",&Microwebsite{},"Get:DeleteNavition")
  73. beego.Router("/api/site/deletemodle",&Microwebsite{},"Get:DeleteModle")
  74. beego.Router("/api/site/getordermodel",&Microwebsite{},"Post:GetOrderModel")
  75. beego.Router("/api/site/addrotationpic",&Microwebsite{},"Post:AddRotationpic")
  76. beego.Router("/api/site/getrotationimages",&Microwebsite{},"Post:GetRotationimages")
  77. beego.Router("/api/site/addrotationimage",&Microwebsite{},"Post:AddrotationImage")
  78. beego.Router("/api/site/addimageslink",&Microwebsite{},"Post:AddImageslink")
  79. beego.Router("/api/site/geteditimages",&Microwebsite{},"Post:GetEditImages")
  80. beego.Router("/api/site/addmagicnavi",&Microwebsite{},"Post:AddMagicNavi")
  81. beego.Router("/api/site/getmagicimages",&Microwebsite{},"Post:GetMagicImages")
  82. beego.Router("/api/site/addmarginchart",&Microwebsite{},"Post:AddMarginChart")
  83. beego.Router("/api/site/deleteRotations",&Microwebsite{},"Post:DeleteRotations")
  84. beego.Router("/api/site/editRotationImages",&Microwebsite{},"Post:EditRotationImages")
  85. beego.Router("/api/site/updaterotaionimages",&Microwebsite{},"Post:SaveRotationImages")
  86. beego.Router("/api/site/editnavigation",&Microwebsite{},"Post:EditNavigation")
  87. beego.Router("/api/site/savenavigation",&Microwebsite{},"Post:SaveNavigation")
  88. beego.Router("/api/site/addhospital",&Microwebsite{},"Post:AddHospital")
  89. beego.Router("/api/site/deletimages",&Microwebsite{},"Post:DeleteImages")
  90. beego.Router("/api/site/addactive",&Microwebsite{},"Post:AddActive")
  91. beego.Router("/api/site/getactivity",&Microwebsite{},"Get:GetActivity")
  92. beego.Router("/api/site/saveactivit",&Microwebsite{},"Post:Saveactivit")
  93. beego.Router("api/site/deleMargin",&Microwebsite{},"Post:DeleteMargin")
  94. beego.Router("/api/site/editRotationImages",&Microwebsite{},"Get:GetRotationImages")
  95. beego.Router("/api/site/getrotationdetail",&Microwebsite{},"Get:GetRotationDetail")
  96. beego.Router("/api/site/editvisiblebyid",&Microwebsite{},"Get:EditVisibleById")
  97. beego.Router("/api/site/saveditpic",&Microwebsite{},"Post:SaveEditpic")
  98. beego.Router("/api/site/addeditpic",&Microwebsite{},"Post:AddEditpic")
  99. beego.Router("/api/site/addedialogvisible",&Microwebsite{},"Post:AddEdialogVisible")
  100. beego.Router("/api/site/geteditrotationimages",&Microwebsite{},"Get:GetEditRotationimages")
  101. beego.Router("/api/site/editsinglevisible",&Microwebsite{},"Get:GetEditSingleVisible")
  102. beego.Router("/api/site/updatesingleform",&Microwebsite{},"Post:UpdateSingleForm")
  103. beego.Router("/api/site/addeditpicform",&Microwebsite{},"Post:AddEditPicForm")
  104. beego.Router("/api/site/addrotationvisible",&Microwebsite{},"Post:AddRotationVisible")
  105. beego.Router("/api/site/geteditimagesdetail",&Microwebsite{},"Get:GetEditImagesDetail")
  106. beego.Router("/api/site/updateeditmacgin",&Microwebsite{},"Post:UpdateEditMacgin")
  107. beego.Router("/api/site/getactivities",&Microwebsite{},"Post:GetActivities")
  108. beego.Router("/api/site/getArticleType",&Microwebsite{},"Post:GetArticleType")
  109. beego.Router("/api/site/addarticelist",&Microwebsite{},"Post:AddArticelist")
  110. beego.Router("/api/site/getarticlelist",&Microwebsite{},"Post:GetArticlelist")
  111. beego.Router("/api/site/editgetarticlistdetail",&Microwebsite{},"Get:EditGetArticlistDetail")
  112. beego.Router("/api/site/updatearticedetail",&Microwebsite{},"Post:SaveArticeDetail")
  113. beego.Router("/api/site/getMacImages",&Microwebsite{},"Get:GetMacImages")
  114. beego.Router("/api/site/deletesingleimages",&Microwebsite{},"Post:DeleteSingleImages")
  115. beego.Router("/api/site/getenimages",&Microwebsite{},"Post:GetEnImages")
  116. beego.Router("/api/site/editenvirimages",&Microwebsite{},"Get:GetEditEnvirimages")
  117. beego.Router("/api/site/addtwoimages",&Microwebsite{},"Post:AddTwoImages")
  118. beego.Router("/api/site/addoffficethree",&Microwebsite{},"Post:AddOfficeThree")
  119. beego.Router("/api/site/offcietwovisible",&Microwebsite{},"Get:GetOfficeTwoVisible")
  120. beego.Router("/api/site/addofficetwo",&Microwebsite{},"Post:AddOfficeTwo")
  121. beego.Router("/api/site/deleteofficebyid",&Microwebsite{},"Post:DeleteOfficeById")
  122. beego.Router("/api/site/getarticlebyid",&Microwebsite{},"Get:GetArticleById")
  123. beego.Router("/api/site/getallactivity",&Microwebsite{},"Get:GetAllActivity")
  124. beego.Router("/api/site/addlinkaddresstwo",&Microwebsite{},"Post:AddData")
  125. beego.Router("/api/site/getlinkaddress",&Microwebsite{},"Get:Getlinkaddress")
  126. beego.Router("/api/site/getallconnecway",&Microwebsite{},"Get:GetAllConnecway")
  127. beego.Router("/api/site/getconnecway",&Microwebsite{},"Get:GetConnecway")
  128. beego.Router("/api/site/editconnecway",&Microwebsite{},"Get:GetConnecwayById")
  129. beego.Router("/api/site/updateconnectform",&Microwebsite{},"Post:UpdateConnectway")
  130. beego.Router("/api/site/updatecontactform",&Microwebsite{},"Post:UpdateContact")
  131. beego.Router("/api/site/addconnectways",&Microwebsite{},"Post:AddConnectways")
  132. beego.Router("/api/site/gethostpitalintroduction",&Microwebsite{},"Get:GetHostpitalIntroduction")
  133. beego.Router("/api/site/updatehospitaladdress",&Microwebsite{},"Post:UpdateHospitalAddress")
  134. beego.Router("/api/site/addpiclink",&Microwebsite{},"Post:AddPicLinkAddress")
  135. beego.Router("/api/site/getlinkaddressdetail",&Microwebsite{},"Get:GetLinkAddressDetail")
  136. beego.Router("/api/site/updatepicformthree",&Microwebsite{},"Post:UpdatePicFformThree")
  137. beego.Router("/api/site/getenimagestwo",&Microwebsite{},"Get:GetEnImagesTwo")
  138. beego.Router("/api/site/getenimagesthree",&Microwebsite{},"Get:GetEnImagesThree")
  139. beego.Router("/api/site/addmagiclinkdata",&Microwebsite{},"Post:AddMagiclinkData")
  140. beego.Router("/api/site/getmaclinkaddress",&Microwebsite{},"Get:GetMacLinkAddress")
  141. beego.Router("/api/site/addmacgicform",&Microwebsite{},"Post:AddMacgicform")
  142. beego.Router("/api/site/getmacimagesdetail",&Microwebsite{},"Get:GetMacImagesDetail")
  143. beego.Router("/api/site/deletemaciamgesdetail",&Microwebsite{},"Post:DeleteMacImagesDetail")
  144. beego.Router("/api/site/updatemacform",&Microwebsite{},"Post:UpdateMacForm")
  145. beego.Router("/api/site/geteditmacimagedetail",&Microwebsite{},"Get:GetEditMacImageDetail")
  146. beego.Router("/api/site/updateeditmacform",&Microwebsite{},"Post:UpdateEditMacForm")
  147. beego.Router("/api/site/getLikeMacAddressById",&Microwebsite{},"Get:GetLikeMacAddressById")
  148. beego.Router("/api/site/getarticlename",&Microwebsite{},"Get:GetArticleName")
  149. beego.Router("/api/site/getallarticelist",&Microwebsite{},"Get:GetAllArticeList")
  150. beego.Router("/api/site/updatelinkaddress",&Microwebsite{},"Post:UpdateLinkAddress")
  151. beego.Router("/api/site/addmaclinkaddress",&Microwebsite{},"Post:AddMacLinkAddress")
  152. beego.Router("/api/site/getlinkaddress",&Microwebsite{},"Get:GetLinkAddress")
  153. beego.Router("/api/site/getcountimages",&Microwebsite{},"Get:GetCountImages")
  154. beego.Router("/api/site/addNavigationlinkform",&Microwebsite{},"Post:AddNavigationLinkform")
  155. beego.Router("/api/site/getnavigationlinkaddress",&Microwebsite{},"Get:GetNavigationlinkaddress")
  156. beego.Router("/api/site/updateditnavigationlinkform",&Microwebsite{},"Post:UpdateditnavigationLink")
  157. beego.Router("/api/site/addoctorinfotwo",&Microwebsite{},"Post:AddDoctorInfoTwo")
  158. beego.Router("/api/site/getuserorgid",&Microwebsite{},"Get:GetUserOrgID")
  159. beego.Router("/api/site/navigationset",&Microwebsite{},"Get:GetNavigationset")
  160. beego.Router("/api/site/getnavigationdata",&Microwebsite{},"Get:GetNavigationData")
  161. beego.Router("/api/site/getallmodeltitle",&Microwebsite{},"Get:GetAllModelTitle")
  162. beego.Router("/api/site/getdoctordetail",&Microwebsite{},"Get:GetDoctorDetailInfo")
  163. beego.Router("/api/site/getArticlelistdetail",&Microwebsite{},"Get:GetArticleListDetail")
  164. beego.Router("/api/site/getActivitieslistinfo",&Microwebsite{},"Get:GetActivitiesListDetail")
  165. beego.Router("/api/site/addlinkaddressthree",&Microwebsite{},"Post:AddLinkAddressThree")
  166. beego.Router("/api/getlinkaddressbylinkid",&Microwebsite{},"Get:GetLinkAddressByLinkId")
  167. beego.Router("/api/site/addlinkaddressfour",&Microwebsite{},"Post:AddLinkAddressFour")
  168. beego.Router("/api/site/getmaginclinkaddressbyid",&Microwebsite{},"Get:GetMagicLinkAddressById")
  169. beego.Router("/api.site/getmagicclickbylinkid",&Microwebsite{},"Get:GetMagicClickByLinkID")
  170. beego.Router("/api/site/editrotationemages",&Microwebsite{},"Get:GeteditRotationEmages")
  171. beego.Router("/api/site/getoutrotationlink",&Microwebsite{},"Get:GetOutRotationLink")
  172. beego.Router("/api/site/updatedrolinkaddress",&Microwebsite{},"Post:UpdatedRolinkAddress")
  173. beego.Router("/api/site/updatedconrotation",&Microwebsite{},"Post:UpdatedConrotation")
  174. beego.Router("/api/site/getrotationvisiblebylinkid",&Microwebsite{},"Get:GetRotationVisibleByLinkId")
  175. beego.Router("/api/site/addrotationvisibleform",&Microwebsite{},"Post:AddRotationVisibleForm")
  176. }
  177. type Microwebsite struct {
  178. controllers.BaseAPIController
  179. }
  180. //轮播图
  181. func (this *Microwebsite) AddRotaionChart() {
  182. adminUserInfo := this.GetAdminUserInfo()
  183. userOrgID := int64(adminUserInfo.CurrentOrgId)
  184. dataBody := make(map[string]interface{}, 0)
  185. err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
  186. fmt.Println("错误是什么呢",err)
  187. fmt.Println("机构ID",userOrgID)
  188. if err != nil {
  189. utils.ErrorLog(err.Error())
  190. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "参数错误")
  191. return
  192. }
  193. title := dataBody["title"].(string)
  194. if len(title) == 0 {
  195. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "模块标题不能为空")
  196. return
  197. }
  198. fmt.Println("姓名:",title)
  199. sort := int64(dataBody["sort"].(float64))
  200. if sort <= 0 {
  201. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "排序值不能为空")
  202. return
  203. }
  204. rotationImages := dataBody["rotationImages"]
  205. //图片数组转为字符串保存到数据库
  206. images := strings.Replace(strings.Trim(fmt.Sprint(rotationImages), "[]"), " ", ",", -1)
  207. fmt.Println("姓名:",rotationImages)
  208. fmt.Println("字符串",images)
  209. model := models.SgjPatientModel{
  210. Title: title,
  211. Sort: sort,
  212. UserOrgId: userOrgID,
  213. Status: 1,
  214. Ctime: time.Now().Unix(),
  215. ModeType: 1,
  216. }
  217. //fmt.Println(model)
  218. site_service.AddPatientModel(&model)
  219. fmt.Println("rotation是什么",model)
  220. patientModel, err := site_service.QueryModel(userOrgID)
  221. fmt.Println("patientModel是什麽",patientModel)
  222. idsInters := dataBody["ids"].([]interface{})
  223. fmt.Println("id集合是",idsInters)
  224. if len(idsInters) == 0 {
  225. if err != nil {
  226. this.ServeFailJsonSend(enums.ErrorCodeDBDelete, "删除会员失败:(没有选择会员)")
  227. return
  228. }
  229. }
  230. ids := make([]int64, 0)
  231. for _, idsInter := range idsInters {
  232. id := int64(idsInter.(float64))
  233. ids = append(ids, id)
  234. }
  235. rotation := models.SgjPatientRotation{
  236. Title: title,
  237. Sort: sort,
  238. RotationImages: images,
  239. UserOrgId: userOrgID,
  240. Status: 1,
  241. Ctime: time.Now().Unix(),
  242. ModelId:patientModel.ID,
  243. }
  244. editpiclink := models.SgjPatientEditpiclink{
  245. Modeid: patientModel.ID,
  246. }
  247. err = site_service.UpdateEditpicLink(userOrgID, ids, editpiclink)
  248. fmt.Println("添加错误是设么",err)
  249. addRotation := site_service.AddRotation(rotation)
  250. fmt.Println("addRotation",addRotation)
  251. patientRotation, err := site_service.GetRotationByLastData(userOrgID)
  252. if err !=nil{
  253. this.ServeFailJsonSend(enums.ErrorCodeDataException, "添加医院失败")
  254. return
  255. }
  256. this.ServeSuccessJSON(map[string]interface{}{
  257. "rotation":rotation,
  258. "patientRotation":patientRotation,
  259. })
  260. }
  261. //医院介绍
  262. func (this *Microwebsite) SaveHispital() {
  263. adminUserInfo := this.GetAdminUserInfo()
  264. userOrgID := int64(adminUserInfo.CurrentOrgId)
  265. dataBody := make(map[string]interface{}, 0)
  266. err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
  267. fmt.Println("错误是什么呢",err)
  268. fmt.Println("机构ID",userOrgID)
  269. if err != nil {
  270. utils.ErrorLog(err.Error())
  271. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "参数错误")
  272. return
  273. }
  274. title := dataBody["title"].(string)
  275. if len(title) == 0 {
  276. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "模块标题不能为空")
  277. return
  278. }
  279. fmt.Println("姓名:",title)
  280. sort := dataBody["sort"].(string)
  281. if len(sort) == 0 {
  282. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "排序值不能为空")
  283. return
  284. }
  285. sortt, err := strconv.ParseInt(sort, 10, 64)
  286. fmt.Println("排序:",sortt)
  287. introduction := dataBody["introduction"].(string)
  288. if len(introduction) == 0 {
  289. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "医院介绍不能为空")
  290. return
  291. }
  292. fmt.Println("姓名是什么?",title,"排序是什么",sortt,"医院介绍不能为空",introduction)
  293. model := models.SgjPatientModel{
  294. Title: title,
  295. Sort: sortt,
  296. UserOrgId: userOrgID,
  297. Ctime: time.Now().Unix(),
  298. Status: 1,
  299. ModeType: 2,
  300. }
  301. site_service.AddPatientModel(&model)
  302. patientModel, err := site_service.QueryModel(userOrgID)
  303. hospital := models.SgjPatientHospital{
  304. Title: title,
  305. Sort: sortt,
  306. Introduction: introduction,
  307. UserOrgId: userOrgID,
  308. Ctime: time.Now().Unix(),
  309. Status: 1,
  310. Modleid: patientModel.ID,
  311. }
  312. err = site_service.AddHispital(hospital)
  313. if err !=nil{
  314. this.ServeFailJsonSend(enums.ErrorCodeDataException, "添加医院失败")
  315. return
  316. }
  317. this.ServeSuccessJSON(map[string]interface{}{
  318. "hospital":hospital,
  319. })
  320. }
  321. //添加科室
  322. func (this *Microwebsite) AddOffices() {
  323. adminUserInfo := this.GetAdminUserInfo()
  324. userOrgID := int64(adminUserInfo.CurrentOrgId)
  325. dataBody := make(map[string]interface{}, 0)
  326. err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
  327. fmt.Println("错误是什么呢",err)
  328. fmt.Println("机构ID",userOrgID)
  329. if err != nil {
  330. utils.ErrorLog(err.Error())
  331. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "参数错误")
  332. return
  333. }
  334. title := dataBody["title"].(string)
  335. if len(title) == 0 {
  336. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "模块标题不能为空")
  337. return
  338. }
  339. fmt.Println("姓名:",title)
  340. sort := dataBody["sort"].(string)
  341. if len(sort) == 0 {
  342. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "排序值不能为空")
  343. return
  344. }
  345. sortt, err := strconv.ParseInt(sort, 10, 64)
  346. fmt.Println("排序:",sortt)
  347. introduction := dataBody["introduction"].(string)
  348. if len(introduction) == 0 {
  349. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "医院介绍不能为空")
  350. return
  351. }
  352. fmt.Println("姓名是什么?",title,"排序是什么",sortt,"医院介绍不能为空",introduction)
  353. model := models.SgjPatientModel{
  354. Title: title,
  355. Sort: sortt,
  356. UserOrgId: userOrgID,
  357. Ctime: time.Now().Unix(),
  358. Status: 1,
  359. ModeType: 3,
  360. }
  361. site_service.AddPatientModel(&model)
  362. patientModel, err := site_service.QueryModel(userOrgID)
  363. offices := models.SgjPatientOffices{
  364. Title: title,
  365. Sort: sortt,
  366. Introduction: introduction,
  367. UserOrgId: userOrgID,
  368. Ctime: time.Now().Unix(),
  369. Status: 1,
  370. Modleid:patientModel.ID,
  371. }
  372. err = site_service.AddOffices(offices)
  373. if err !=nil{
  374. this.ServeFailJsonSend(enums.ErrorCodeDataException, "添加医院失败")
  375. return
  376. }
  377. this.ServeSuccessJSON(map[string]interface{}{
  378. "offices":offices,
  379. })
  380. }
  381. //添加名医
  382. func (this *Microwebsite) AddDoctor() {
  383. adminUserInfo := this.GetAdminUserInfo()
  384. userOrgID := int64(adminUserInfo.CurrentOrgId)
  385. dataBody := make(map[string]interface{}, 0)
  386. err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
  387. fmt.Println("错误是什么呢",err)
  388. fmt.Println("机构ID",userOrgID)
  389. if err != nil {
  390. utils.ErrorLog(err.Error())
  391. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "参数错误")
  392. return
  393. }
  394. title := dataBody["title"].(string)
  395. if len(title) == 0 {
  396. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "模块标题不能为空")
  397. return
  398. }
  399. fmt.Println("姓名:",title)
  400. sort := dataBody["sort"].(string)
  401. if len(sort) == 0 {
  402. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "排序值不能为空")
  403. return
  404. }
  405. sortt, err := strconv.ParseInt(sort, 10, 64)
  406. fmt.Println("排序:",sortt)
  407. images := dataBody["docimages"]
  408. replace := strings.Replace(strings.Trim(fmt.Sprint(images), "[]"), " ", ",", -1)
  409. //if len(image) == 0 {
  410. // this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "医院介绍不能为空")
  411. // return
  412. idsInters := dataBody["ids"].([]interface{})
  413. fmt.Println("id集合是",idsInters)
  414. if len(idsInters) == 0 {
  415. if err != nil {
  416. this.ServeFailJsonSend(enums.ErrorCodeDBDelete, "删除会员失败:(没有选择会员)")
  417. return
  418. }
  419. }
  420. ids := make([]int64, 0)
  421. for _, idsInter := range idsInters {
  422. id := int64(idsInter.(float64))
  423. ids = append(ids, id)
  424. }
  425. fmt.Println("姓名是什么?",title,"排序是什么",sortt,"图片",replace)
  426. model := models.SgjPatientModel{
  427. Title: title,
  428. Sort: sortt,
  429. UserOrgId: userOrgID,
  430. Ctime: time.Now().Unix(),
  431. Status: 1,
  432. ModeType: 4,
  433. }
  434. site_service.AddPatientModel(&model)
  435. patientModel, err := site_service.QueryModel(userOrgID)
  436. fmt.Println("模块ID",patientModel.ID)
  437. docinfo := models.SgjPatientDocinfo{
  438. Title: title,
  439. Sort: sortt,
  440. Docimages: replace,
  441. UserOrgId: userOrgID,
  442. Ctime: time.Now().Unix(),
  443. Status: 1,
  444. Modelid: patientModel.ID,
  445. }
  446. err = site_service.AddDoctor(docinfo)
  447. editdoctor := models.SgjPatientEditdoctor{
  448. Modleid:patientModel.ID,
  449. }
  450. err = site_service.UpdateDoctorsInfo(userOrgID, ids, editdoctor)
  451. if err !=nil{
  452. this.ServeFailJsonSend(enums.ErrorCodeDataException, "添加医院失败")
  453. return
  454. }
  455. this.ServeSuccessJSON(map[string]interface{}{
  456. "doctor":docinfo,
  457. })
  458. }
  459. //添加名医介绍
  460. func (this *Microwebsite) AddDoctorInfo() {
  461. adminUserInfo := this.GetAdminUserInfo()
  462. userOrgID := int64(adminUserInfo.CurrentOrgId)
  463. dataBody := make(map[string]interface{}, 0)
  464. err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
  465. fmt.Println("错误是什么呢",err)
  466. fmt.Println("机构ID",userOrgID)
  467. if err != nil {
  468. utils.ErrorLog(err.Error())
  469. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "参数错误")
  470. return
  471. }
  472. docname := dataBody["name"].(string)
  473. if len(docname) == 0 {
  474. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "医生姓名不能为空")
  475. return
  476. }
  477. fmt.Println("医生姓名:",docname)
  478. docHead := dataBody["dochead"].(string)
  479. if len(docHead) == 0 {
  480. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "医生头像不能为空")
  481. return
  482. }
  483. fmt.Println("医生头像:",docHead)
  484. sort := dataBody["sort"].(string)
  485. if len(sort) == 0 {
  486. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "排序值不能为空")
  487. return
  488. }
  489. sortt, err := strconv.ParseInt(sort, 10, 64)
  490. fmt.Println("排序:",sortt)
  491. docpositional := int64(dataBody["user_title"].(float64))
  492. if docpositional <= 0 {
  493. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "医生职位不能为空")
  494. return
  495. }
  496. fmt.Println("医生职位",docpositional)
  497. docintroduction := dataBody["content"].(string)
  498. fmt.Println("医生简介",docintroduction)
  499. if len(docintroduction) == 0 {
  500. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "医生简介不能为空")
  501. return
  502. }
  503. fmt.Println("医生姓名",docname,"医生职位",docpositional,"医生头像",docHead,"医生简介",docintroduction)
  504. editdoctor := models.SgjPatientEditdoctor{
  505. DocName: docname,
  506. Dochead: docHead,
  507. DocPostion: docpositional,
  508. Docintroduction: docintroduction,
  509. Ctime: time.Now().Unix(),
  510. UserOrgId: userOrgID,
  511. DocSort: sortt,
  512. Status: 1,
  513. ImgShow: 1,
  514. }
  515. err = site_service.AddDoctorInfo(editdoctor)
  516. if err !=nil{
  517. this.ServeFailJsonSend(enums.ErrorCodeDataException, "添加医生失败")
  518. return
  519. }
  520. this.ServeSuccessJSON(map[string]interface{}{
  521. "doctor":editdoctor,
  522. })
  523. }
  524. //新增科室环境
  525. func (this *Microwebsite) AddKeEnvironment() {
  526. adminUserInfo := this.GetAdminUserInfo()
  527. userOrgID := int64(adminUserInfo.CurrentOrgId)
  528. dataBody := make(map[string]interface{}, 0)
  529. err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
  530. fmt.Println("错误是什么呢",err)
  531. fmt.Println("机构ID",userOrgID)
  532. if err != nil {
  533. utils.ErrorLog(err.Error())
  534. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "参数错误")
  535. return
  536. }
  537. title := dataBody["title"].(string)
  538. if len(title) == 0 {
  539. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "模块标题不能为空")
  540. return
  541. }
  542. fmt.Println("标题:",title)
  543. sort := int64(dataBody["sort"].(float64))
  544. keImages := dataBody["keImages"]
  545. //图片数组转为字符串保存到数据库
  546. replace := strings.Replace(strings.Trim(fmt.Sprint(keImages), "[]"), " ", ",", -1)
  547. fmt.Println("图片:",keImages)
  548. fmt.Println("字符串",replace)
  549. idsInters := dataBody["ids"].([]interface{})
  550. fmt.Println("id集合是",idsInters)
  551. if len(idsInters) == 0 {
  552. if err != nil {
  553. this.ServeFailJsonSend(enums.ErrorCodeDBDelete, "删除会员失败:(没有选择会员)")
  554. return
  555. }
  556. }
  557. ids := make([]int64, 0)
  558. for _, idsInter := range idsInters {
  559. id := int64(idsInter.(float64))
  560. ids = append(ids, id)
  561. }
  562. fmt.Println("ids是什么",ids)
  563. model := models.SgjPatientModel{
  564. Title: title,
  565. Sort: sort,
  566. UserOrgId: userOrgID,
  567. Ctime: time.Now().Unix(),
  568. Status: 1,
  569. ModeType: 5,
  570. }
  571. site_service.AddPatientModel(&model)
  572. patientModel, err := site_service.QueryModel(userOrgID)
  573. enviroimages := models.SgjPatientEnviroimages{
  574. Modeid: patientModel.ID,
  575. }
  576. err = site_service.UpdateImages(userOrgID, ids, enviroimages)
  577. fmt.Println("错误",err)
  578. officenviroment := models.SgjPatientOffenvironment{
  579. Title: title,
  580. Sort: sort,
  581. Keimages: replace,
  582. Mtime: time.Now().Unix(),
  583. UserOrgId: userOrgID,
  584. Status: 1,
  585. Modelid:patientModel.ID,
  586. }
  587. err = site_service.AddOffEnvironment(officenviroment)
  588. if err !=nil{
  589. this.ServeFailJsonSend(enums.ErrorCodeDataException, "添加科室环境失败")
  590. return
  591. }
  592. this.ServeSuccessJSON(map[string]interface{}{
  593. "offenvironment":officenviroment,
  594. })
  595. }
  596. //获取轮播图
  597. func (this *Microwebsite) GetRationImages() {
  598. adminUserInfo := this.GetAdminUserInfo()
  599. userOrgID := int64(adminUserInfo.CurrentOrgId)
  600. rotation, err := site_service.GetRationImages(userOrgID)
  601. if err !=nil{
  602. this.ServeFailJsonSend(enums.ErrorCodeDataException, "获取轮播图失败")
  603. return
  604. }
  605. fmt.Println("错误是什么",err)
  606. fmt.Println("获取的数据",rotation)
  607. this.ServeSuccessJSON(map[string]interface{}{
  608. "rotationImages":rotation,
  609. })
  610. }
  611. //获取医院信息
  612. func (this * Microwebsite) GetHospitalinfo() {
  613. adminUserInfo := this.GetAdminUserInfo()
  614. userOrgID := int64(adminUserInfo.CurrentOrgId)
  615. hospital, err := site_service.GetHospitalInfo(userOrgID)
  616. fmt.Println("数据是什么",hospital)
  617. if err !=nil{
  618. this.ServeFailJsonSend(enums.ErrorCodeDataException, "获取轮播图失败")
  619. return
  620. }
  621. this.ServeSuccessJSON(map[string]interface{}{
  622. "hospital":hospital,
  623. })
  624. }
  625. //获取科室信息
  626. func (this * Microwebsite) GetOfficeInfo() {
  627. adminUserInfo := this.GetAdminUserInfo()
  628. userOrgID := int64(adminUserInfo.CurrentOrgId)
  629. offices, err := site_service.GetOfficeInfo(userOrgID)
  630. fmt.Println("科室介绍数据是什么",offices)
  631. if err !=nil{
  632. this.ServeFailJsonSend(enums.ErrorCodeDataException, "获取轮播图失败")
  633. return
  634. }
  635. this.ServeSuccessJSON(map[string]interface{}{
  636. "offices":offices,
  637. })
  638. }
  639. func (this * Microwebsite) GetQueryDocInfo(){
  640. adminUserInfo := this.GetAdminUserInfo()
  641. userOrgID := int64(adminUserInfo.CurrentOrgId)
  642. doc, err := site_service.GetQueryDocInfo(userOrgID)
  643. if err !=nil{
  644. this.ServeFailJsonSend(enums.ErrorCodeDataException, "获取名医介绍失败")
  645. return
  646. }
  647. this.ServeSuccessJSON(map[string]interface{}{
  648. "doctor":doc,
  649. })
  650. }
  651. func (this * Microwebsite) GetQueryDocHead() {
  652. adminUserInfo := this.GetAdminUserInfo()
  653. userOrgID := int64(adminUserInfo.CurrentOrgId)
  654. docHead, err := site_service.GetQueryDocHead(userOrgID)
  655. fmt.Println("错误是设么",err)
  656. fmt.Println("docHead是什么",docHead)
  657. if err !=nil{
  658. this.ServeFailJsonSend(enums.ErrorCodeDataException, "获取名医介绍失败")
  659. return
  660. }
  661. this.ServeSuccessJSON(map[string]interface{}{
  662. "docHead":docHead,
  663. })
  664. }
  665. //获取科室环境
  666. func (this * Microwebsite) GetOffEnvironment() {
  667. adminUserInfo := this.GetAdminUserInfo()
  668. userOrgID := int64(adminUserInfo.CurrentOrgId)
  669. offenvironment, err := site_service.GetOffEnvironment(userOrgID)
  670. fmt.Println("错误是什么",err)
  671. fmt.Println("科室环境数据",offenvironment)
  672. if err !=nil{
  673. this.ServeFailJsonSend(enums.ErrorCodeDataException, "获取名医介绍失败")
  674. return
  675. }
  676. this.ServeSuccessJSON(map[string]interface{}{
  677. "offenvironment":offenvironment,
  678. })
  679. }
  680. //添加联系我们的轮播图
  681. func (this * Microwebsite) AddRotationUpload() {
  682. adminUserInfo := this.GetAdminUserInfo()
  683. userOrgID := int64(adminUserInfo.CurrentOrgId)
  684. dataBody := make(map[string]interface{}, 0)
  685. err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
  686. fmt.Println("错误是什么呢",err)
  687. fmt.Println("机构ID",userOrgID)
  688. if err != nil {
  689. utils.ErrorLog(err.Error())
  690. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "参数错误")
  691. return
  692. }
  693. title := dataBody["title"].(string)
  694. if len(title) == 0 {
  695. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "模块标题不能为空")
  696. return
  697. }
  698. fmt.Println("姓名:",title)
  699. sort := dataBody["sort"].(string)
  700. if len(sort) == 0 {
  701. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "排序值不能为空")
  702. return
  703. }
  704. sortt, err := strconv.ParseInt(sort, 10, 64)
  705. fmt.Println("排序:",sortt)
  706. rotationImages := dataBody["rotationImages"]
  707. //图片数组转为字符串保存到数据库
  708. replace := strings.Replace(strings.Trim(fmt.Sprint(rotationImages), "[]"), " ", ",", -1)
  709. fmt.Println("姓名:",rotationImages)
  710. fmt.Println("字符串",replace)
  711. connecmodel := models.SgjPatientConnecmodel{
  712. Title: title,
  713. Sort: sortt,
  714. RotationImages: replace,
  715. UserOrgId: userOrgID,
  716. Status: 1,
  717. ModeType: 1,
  718. Ctime: time.Now().Unix(),
  719. }
  720. err = site_service.AddRotationUpload(&connecmodel)
  721. if err !=nil{
  722. this.ServeFailJsonSend(enums.ErrorCodeDataException, "获取名医介绍失败")
  723. return
  724. }
  725. this.ServeSuccessJSON(map[string]interface{}{
  726. "connecmodel":connecmodel,
  727. })
  728. }
  729. //添加工作时间
  730. func (this * Microwebsite) AddWorkTime() {
  731. adminUserInfo := this.GetAdminUserInfo()
  732. userOrgID := int64(adminUserInfo.CurrentOrgId)
  733. dataBody := make(map[string]interface{}, 0)
  734. err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
  735. fmt.Println("错误是什么呢", err)
  736. fmt.Println("机构ID", userOrgID)
  737. if err != nil {
  738. utils.ErrorLog(err.Error())
  739. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "参数错误")
  740. return
  741. }
  742. title := dataBody["title"].(string)
  743. if len(title) == 0 {
  744. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "模块标题不能为空")
  745. return
  746. }
  747. sort := int64(dataBody["sort"].(float64))
  748. if sort <= 0 {
  749. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "排序值不能为空")
  750. return
  751. }
  752. worktime := dataBody["worktime"].(string)
  753. if len(worktime) == 0 {
  754. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "工作时间不能为空")
  755. return
  756. }
  757. ordmodel := models.SgjPatientOrdmodel{
  758. Title: title,
  759. Sort: sort,
  760. Status: 1,
  761. UserOrgId: userOrgID,
  762. ModeType: 4,
  763. Ctime: time.Now().Unix(),
  764. }
  765. //添加模块
  766. err = site_service.AddOrdModel(&ordmodel);
  767. model, err := site_service.QueryOrdeModelByID(userOrgID)
  768. patientWorktime := models.SgjPatientWorktime{
  769. Title: title,
  770. Sort: sort,
  771. Worktime: worktime,
  772. UserOrgId: userOrgID,
  773. Status: 1,
  774. Ctime: time.Now().Unix(),
  775. ModeId: model.ID,
  776. }
  777. err = site_service.AddWorkTime(&patientWorktime)
  778. if err !=nil{
  779. this.ServeFailJsonSend(enums.ErrorCodeDataException, "添加乘车方式失败")
  780. return
  781. }
  782. this.ServeSuccessJSON(map[string]interface{}{
  783. "ordmodel":ordmodel,
  784. "patientWorktime":patientWorktime,
  785. })
  786. }
  787. //添加乘车方式
  788. func (this * Microwebsite) AddRideway() {
  789. adminUserInfo := this.GetAdminUserInfo()
  790. userOrgID := int64(adminUserInfo.CurrentOrgId)
  791. dataBody := make(map[string]interface{}, 0)
  792. err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
  793. fmt.Println("错误是什么呢", err)
  794. fmt.Println("机构ID", userOrgID)
  795. if err != nil {
  796. utils.ErrorLog(err.Error())
  797. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "参数错误")
  798. return
  799. }
  800. title := dataBody["title"].(string)
  801. if len(title) == 0 {
  802. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "模块标题不能为空")
  803. return
  804. }
  805. fmt.Println("姓名:", title)
  806. sort :=int64(dataBody["sort"].(float64))
  807. if sort <= 0 {
  808. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "排序值不能为空")
  809. return
  810. }
  811. fmt.Println("排序:", sort)
  812. content := dataBody["content"].(string)
  813. if len(content) == 0 {
  814. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "乘车方式不能为空")
  815. return
  816. }
  817. ordemodel := models.SgjPatientOrdmodel{
  818. Title: title,
  819. Sort: sort,
  820. UserOrgId: userOrgID,
  821. Status: 1,
  822. ModeType: 5,
  823. Ctime: time.Now().Unix(),
  824. }
  825. err = site_service.AddOrdModel(&ordemodel)
  826. model, err := site_service.QueryOrdeModelByID(userOrgID)
  827. rideway := models.SgjPatientRideway{
  828. Title: title,
  829. Sort: sort,
  830. RideWay: content,
  831. UserOrgId: userOrgID,
  832. Status: 1,
  833. ModeId: model.ID,
  834. Ctime: time.Now().Unix(),
  835. }
  836. err = site_service.AddRideWay(rideway)
  837. if err !=nil{
  838. this.ServeFailJsonSend(enums.ErrorCodeDataException, "添加乘车方式失败")
  839. return
  840. }
  841. this.ServeSuccessJSON(map[string]interface{}{
  842. "ordemodel":ordemodel,
  843. "rideway":rideway,
  844. })
  845. }
  846. //添加联系方式
  847. func (this * Microwebsite) AddConnection() {
  848. adminUserInfo := this.GetAdminUserInfo()
  849. userOrgID := int64(adminUserInfo.CurrentOrgId)
  850. dataBody := make(map[string]interface{}, 0)
  851. err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
  852. fmt.Println("错误是什么呢", err)
  853. if err != nil {
  854. utils.ErrorLog(err.Error())
  855. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "参数错误")
  856. return
  857. }
  858. title := dataBody["title"].(string)
  859. if len(title) == 0 {
  860. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "模块标题不能为空")
  861. return
  862. }
  863. fmt.Println("姓名:", title)
  864. connecway :=int64( dataBody["connecway"].(float64))
  865. if connecway < 0{
  866. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "联系方式不能为空")
  867. return
  868. }
  869. fmt.Println("联系方式",connecway)
  870. content := dataBody["content"].(string)
  871. if len(content) == 0 {
  872. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "模块标题不能为空")
  873. return
  874. }
  875. fmt.Println("内容",content)
  876. connection := models.SgjPatientConnection{
  877. Title: title,
  878. Connecway: connecway,
  879. Content: content,
  880. Status: 1,
  881. Ctime: time.Now().Unix(),
  882. UserOrgId:userOrgID,
  883. }
  884. err = site_service.AddConnetion(connection);
  885. if err !=nil{
  886. this.ServeFailJsonSend(enums.ErrorCodeDataException, "添加联系方式失败")
  887. return
  888. }
  889. this.ServeSuccessJSON(map[string]interface{}{
  890. "connection":connection,
  891. })
  892. }
  893. //获取联系方式
  894. func (this * Microwebsite) GetQueryConnection() {
  895. adminUserInfo := this.GetAdminUserInfo()
  896. userOrgID := int64(adminUserInfo.CurrentOrgId)
  897. conection, err := site_service.GetQueryConnection(userOrgID)
  898. fmt.Println("conections是啥",conection)
  899. if err !=nil{
  900. this.ServeFailJsonSend(enums.ErrorCodeDataException, "添加乘车方式失败")
  901. return
  902. }
  903. this.ServeSuccessJSON(map[string]interface{}{
  904. "conection":conection,
  905. })
  906. }
  907. //删除联系人
  908. func (this * Microwebsite) DeleteConnecWay() {
  909. adminUserInfo := this.GetAdminUserInfo()
  910. userOrgID := int64(adminUserInfo.CurrentOrgId)
  911. id, _ := this.GetInt64("id")
  912. fmt.Println("id是啥?",id)
  913. err := site_service.DeleteConnecWay(userOrgID, id)
  914. if err !=nil{
  915. this.ServeFailJsonSend(enums.ErrorCodeDataException, "删除回复成功")
  916. return
  917. }
  918. returnData := make(map[string]interface{}, 0)
  919. returnData["msg"] = "ok"
  920. this.ServeSuccessJSON(returnData)
  921. return
  922. }
  923. //编辑联系人
  924. func (this *Microwebsite) EditConnecWay() {
  925. adminUserInfo := this.GetAdminUserInfo()
  926. id, _ := this.GetInt64("id")
  927. fmt.Println("id是啥?",id)
  928. userOrgID := int64(adminUserInfo.CurrentOrgId)
  929. connection, err := site_service.EditConnecWay(userOrgID, id)
  930. if err !=nil{
  931. this.ServeFailJsonSend(enums.ErrorCodeDataException, "删除回复成功")
  932. return
  933. }
  934. this.ServeSuccessJSON(map[string]interface{}{
  935. "connection":connection,
  936. })
  937. }
  938. func (this *Microwebsite) SaveConnection() {
  939. adminUserInfo := this.GetAdminUserInfo()
  940. userOrgID := int64(adminUserInfo.CurrentOrgId)
  941. fmt.Println("机构ID",userOrgID)
  942. id, _ := this.GetInt64("id")
  943. fmt.Println("id是啥?",id)
  944. dataBody := make(map[string]interface{}, 0)
  945. err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
  946. if err != nil {
  947. utils.ErrorLog(err.Error())
  948. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "参数错误")
  949. return
  950. }
  951. title := dataBody["title"].(string)
  952. fmt.Println("title",title)
  953. if len(title) == 0 {
  954. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "模块标题不能为空")
  955. return
  956. }
  957. connecway := int64(dataBody["connecway"].(float64))
  958. fmt.Println("connecway",connecway)
  959. content := dataBody["content"].(string)
  960. fmt.Println("content",content)
  961. if len(content) == 0 {
  962. this.ServeFailJsonSend(enums.ErrorCodeParamWrong,"联系方式不能为空")
  963. return
  964. }
  965. connection := models.SgjPatientConnection{
  966. Title: title,
  967. Connecway: connecway,
  968. Content: content,
  969. }
  970. site_service.UpadateConnec(&connection,userOrgID,id)
  971. this.ServeSuccessJSON(map[string]interface{}{
  972. "connection":connection,
  973. })
  974. }
  975. //新增联系方式
  976. func (this *Microwebsite) AddContract() {
  977. adminUserInfo := this.GetAdminUserInfo()
  978. userOrgID := int64(adminUserInfo.CurrentOrgId)
  979. fmt.Println("机构ID",userOrgID)
  980. dataBody := make(map[string]interface{}, 0)
  981. err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
  982. if err != nil {
  983. utils.ErrorLog(err.Error())
  984. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "参数错误")
  985. return
  986. }
  987. title := dataBody["title"].(string)
  988. fmt.Println("联系模块标题",title)
  989. if len(title) == 0 {
  990. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "模块标题不能为空")
  991. return
  992. }
  993. sort := int64(dataBody["sort"].(float64))
  994. fmt.Println("联系模快排序",sort)
  995. if sort == 0 {
  996. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "模块标题不能为空")
  997. return
  998. }
  999. //ids := dataBody["connecWayId"]
  1000. //fmt.Println("联系方式",ids)
  1001. //connecwayId := strings.Replace(strings.Trim(fmt.Sprint(ids), "[]"), " ", ",", -1)
  1002. //tittles := dataBody["conectitle"]
  1003. //tittless := strings.Replace(strings.Trim(fmt.Sprint(tittles), "[]"), " ", ",", -1)
  1004. //fmt.Println("联系名称",tittless)
  1005. //conneccontent := dataBody["conneccontent"]
  1006. //conneccontents := strings.Replace(strings.Trim(fmt.Sprint(conneccontent), "[]"), " ", ",", -1)
  1007. ordmodel := models.SgjPatientOrdmodel{
  1008. Title: title,
  1009. UserOrgId: userOrgID,
  1010. Sort: sort,
  1011. Ctime: time.Now().Unix(),
  1012. ModeType: 3,
  1013. Status: 1,
  1014. }
  1015. err = site_service.AddOrdModel(&ordmodel)
  1016. patientOrdmodel, err := site_service.QueryOrdeModelByID(userOrgID)
  1017. connectway := models.SgjPatientConnectway{
  1018. Title: title,
  1019. Sort: sort,
  1020. UserOrgId: userOrgID,
  1021. Ctime: time.Now().Unix(),
  1022. Status: 1,
  1023. ModeId: patientOrdmodel.ID,
  1024. }
  1025. err = site_service.AddConnecWay(&connectway)
  1026. if err !=nil{
  1027. this.ServeFailJsonSend(enums.ErrorCodeDataException, "删除回复成功")
  1028. return
  1029. }
  1030. this.ServeSuccessJSON(map[string]interface{}{
  1031. "connectway":connectway,
  1032. "ordmodel":ordmodel,
  1033. })
  1034. }
  1035. func (this *Microwebsite) GetUserdModel() {
  1036. adminUserInfo := this.GetAdminUserInfo()
  1037. userOrgID := int64(adminUserInfo.CurrentOrgId)
  1038. model, err := site_service.GetUserModel(userOrgID)
  1039. if err !=nil{
  1040. this.ServeFailJsonSend(enums.ErrorCodeDataException, "删除回复成功")
  1041. return
  1042. }
  1043. fmt.Println("err")
  1044. fmt.Println("模型是什么",model)
  1045. this.ServeSuccessJSON(map[string]interface{}{
  1046. "model":model,
  1047. })
  1048. }
  1049. func (this *Microwebsite) GetQueryNewModel() {
  1050. adminUserInfo := this.GetAdminUserInfo()
  1051. userOrgID := int64(adminUserInfo.CurrentOrgId)
  1052. model, err := site_service.GetQueryNewModel(userOrgID)
  1053. fmt.Println("查询新增模块数据是什么?",model)
  1054. if err !=nil{
  1055. this.ServeFailJsonSend(enums.ErrorCodeDataException, "删除回复成功")
  1056. return
  1057. }
  1058. fmt.Println("err")
  1059. fmt.Println("返回新增模块模型是什么",model)
  1060. this.ServeSuccessJSON(map[string]interface{}{
  1061. "model":model,
  1062. })
  1063. }
  1064. func (this *Microwebsite) GetEditModel() {
  1065. adminUserInfo := this.GetAdminUserInfo()
  1066. id, _ := this.GetInt64("id")
  1067. fmt.Println("模块id是啥?",id)
  1068. userOrgID := int64(adminUserInfo.CurrentOrgId)
  1069. worktime, err := site_service.GetEditModel(userOrgID, id)
  1070. if err !=nil{
  1071. this.ServeFailJsonSend(enums.ErrorCodeDataException, "删除回复成功")
  1072. return
  1073. }
  1074. this.ServeSuccessJSON(map[string]interface{}{
  1075. "worktime":worktime,
  1076. })
  1077. }
  1078. func (this *Microwebsite) EditRideWay() {
  1079. adminUserInfo := this.GetAdminUserInfo()
  1080. id, _ := this.GetInt64("id")
  1081. fmt.Println("模块id是啥?",id)
  1082. userOrgID := int64(adminUserInfo.CurrentOrgId)
  1083. rideway, err := site_service.GetEditRideWay(userOrgID, id)
  1084. if err !=nil{
  1085. this.ServeFailJsonSend(enums.ErrorCodeDataException, "删除回复成功")
  1086. return
  1087. }
  1088. this.ServeSuccessJSON(map[string]interface{}{
  1089. "rideway":rideway,
  1090. })
  1091. }
  1092. //保存编辑后的工作时间
  1093. func (this *Microwebsite) SaveWorktTime() {
  1094. adminUserInfo := this.GetAdminUserInfo()
  1095. id, _ := this.GetInt64("id")
  1096. fmt.Println("模块id是啥?",id)
  1097. userOrgID := int64(adminUserInfo.CurrentOrgId)
  1098. dataBody := make(map[string]interface{}, 0)
  1099. err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
  1100. if err != nil {
  1101. utils.ErrorLog(err.Error())
  1102. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "参数错误")
  1103. return
  1104. }
  1105. title := dataBody["title"].(string)
  1106. if len(title) == 0 {
  1107. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "模块标题不能为空")
  1108. return
  1109. }
  1110. fmt.Println("姓名:", title)
  1111. sort := int64(dataBody["sort"].(float64))
  1112. if sort <= 0 {
  1113. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "排序值不能为空")
  1114. return
  1115. }
  1116. fmt.Println("排序:", sort)
  1117. worktime := dataBody["worktime"].(string)
  1118. fmt.Println("工作时间",worktime)
  1119. if len(worktime) == 0 {
  1120. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "模块标题不能为空")
  1121. return
  1122. }
  1123. modeid := int64(dataBody["mode_id"].(float64))
  1124. fmt.Println("模块ID",modeid)
  1125. ordmodel := models.SgjPatientOrdmodel{
  1126. Title: title,
  1127. Sort: sort,
  1128. }
  1129. err = site_service.UpdateOrdeModel(modeid, userOrgID,ordmodel)
  1130. patientWorktime := models.SgjPatientWorktime{
  1131. Title: title,
  1132. Sort: sort,
  1133. Worktime: worktime,
  1134. }
  1135. err = site_service.UpdateWorkTime(id, userOrgID, patientWorktime)
  1136. if err !=nil{
  1137. this.ServeFailJsonSend(enums.ErrorCodeDataException, "删除回复成功")
  1138. return
  1139. }
  1140. this.ServeSuccessJSON(map[string]interface{}{
  1141. "patientWorktime":patientWorktime,
  1142. })
  1143. }
  1144. //保存编辑后的乘车方式
  1145. func (this *Microwebsite) Saverideway() {
  1146. adminUserInfo := this.GetAdminUserInfo()
  1147. id, _ := this.GetInt64("id")
  1148. fmt.Println("模块id是啥?",id)
  1149. userOrgID := int64(adminUserInfo.CurrentOrgId)
  1150. dataBody := make(map[string]interface{}, 0)
  1151. err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
  1152. if err != nil {
  1153. utils.ErrorLog(err.Error())
  1154. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "参数错误")
  1155. return
  1156. }
  1157. title := dataBody["title"].(string)
  1158. if len(title) == 0 {
  1159. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "模块标题不能为空")
  1160. return
  1161. }
  1162. fmt.Println("标题:", title)
  1163. sort := int64(dataBody["sort"].(float64))
  1164. if sort <= 0 {
  1165. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "排序值不能为空")
  1166. return
  1167. }
  1168. fmt.Println("排序:", sort)
  1169. rideway := dataBody["ride_way"].(string)
  1170. fmt.Println("工作时间",rideway)
  1171. if len(rideway) == 0 {
  1172. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "模块标题不能为空")
  1173. return
  1174. }
  1175. modeid:= int64(dataBody["mode_id"].(float64))
  1176. fmt.Println("模块ID",modeid)
  1177. ridewaymodel := models.SgjPatientRideway{
  1178. Title: title,
  1179. Sort: sort,
  1180. RideWay: rideway,
  1181. }
  1182. ordmodel := models.SgjPatientOrdmodel{
  1183. Title: title,
  1184. Sort: sort,
  1185. }
  1186. err = site_service.UpdateRideWay(id, userOrgID, ridewaymodel)
  1187. fmt.Println("错误是设么",err)
  1188. err = site_service.UpdateOrdeModel(modeid, userOrgID, ordmodel)
  1189. fmt.Println("错误是什么?",err)
  1190. if err !=nil{
  1191. this.ServeFailJsonSend(enums.ErrorCodeDataException, "删除回复成功")
  1192. return
  1193. }
  1194. this.ServeSuccessJSON(map[string]interface{}{
  1195. "ridewaymodel":ridewaymodel,
  1196. })
  1197. }
  1198. func (this *Microwebsite) Change() {
  1199. adminUserInfo := this.GetAdminUserInfo()
  1200. id, _ := this.GetInt64("id")
  1201. fmt.Println("医生id是啥?",id)
  1202. userOrgID := int64(adminUserInfo.CurrentOrgId)
  1203. fmt.Println("机构id",userOrgID)
  1204. docinfo, err := site_service.QueryDocById(userOrgID, id)
  1205. if err !=nil{
  1206. this.ServeFailJsonSend(enums.ErrorCodeDataException, "删除回复成功")
  1207. return
  1208. }
  1209. this.ServeSuccessJSON(map[string]interface{}{
  1210. "docinfo":docinfo,
  1211. })
  1212. }
  1213. func (this *Microwebsite) DeleteDoctor() {
  1214. adminUserInfo := this.GetAdminUserInfo()
  1215. id, _ := this.GetInt64("id")
  1216. fmt.Println("保存id是啥?",id)
  1217. userOrgID := int64(adminUserInfo.CurrentOrgId)
  1218. err := site_service.DeleteDoctor(id, userOrgID)
  1219. if err !=nil{
  1220. this.ServeFailJsonSend(enums.ErrorCodeDataException, "删除成功")
  1221. return
  1222. }
  1223. returnData := make(map[string]interface{}, 0)
  1224. returnData["msg"] = "ok"
  1225. this.ServeSuccessJSON(returnData)
  1226. return
  1227. }
  1228. func (this *Microwebsite) EditHospital() {
  1229. adminUserInfo := this.GetAdminUserInfo()
  1230. id, _ := this.GetInt64("id")
  1231. fmt.Println("保存id是啥?",id)
  1232. userOrgID := int64(adminUserInfo.CurrentOrgId)
  1233. hospital, err := site_service.EditHospital(id, userOrgID)
  1234. fmt.Println("参训是什么",hospital)
  1235. fmt.Println(err)
  1236. if err !=nil{
  1237. this.ServeFailJsonSend(enums.ErrorCodeDataException, "删除回复成功")
  1238. return
  1239. }
  1240. this.ServeSuccessJSON(map[string]interface{}{
  1241. "hospital":hospital,
  1242. })
  1243. }
  1244. func (this *Microwebsite) SaveHospital() {
  1245. adminUserInfo := this.GetAdminUserInfo()
  1246. id, _ := this.GetInt64("id")
  1247. fmt.Println("保存id是啥?",id)
  1248. userOrgID := int64(adminUserInfo.CurrentOrgId)
  1249. fmt.Println(userOrgID)
  1250. dataBody := make(map[string]interface{}, 0)
  1251. err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
  1252. if err != nil {
  1253. utils.ErrorLog(err.Error())
  1254. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "参数错误")
  1255. return
  1256. }
  1257. title := dataBody["title"].(string)
  1258. if len(title) == 0 {
  1259. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "模块标题不能为空")
  1260. return
  1261. }
  1262. fmt.Println("标题:", title)
  1263. sort := int64(dataBody["sort"].(float64))
  1264. fmt.Println("sort是神",sort)
  1265. if sort <= 0 {
  1266. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "排序值不能为空")
  1267. return
  1268. }
  1269. fmt.Println("排序:", sort)
  1270. introduction := dataBody["introduction"].(string)
  1271. if len(introduction) == 0 {
  1272. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "模块标题不能为空")
  1273. return
  1274. }
  1275. modleid := int64(dataBody["modleid"].(float64))
  1276. if modleid <= 0 {
  1277. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "模块ID不能为空")
  1278. return
  1279. }
  1280. fmt.Println("模块id",modleid)
  1281. hospital := models.SgjPatientHospital{
  1282. Title: title,
  1283. Sort: sort,
  1284. Introduction: introduction,
  1285. }
  1286. err = site_service.UpdateHospital(id, userOrgID, hospital)
  1287. model := models.SgjPatientModel{
  1288. Title: title,
  1289. Sort: sort,
  1290. }
  1291. fmt.Println(hospital)
  1292. Modelerr := site_service.UpdateModel(modleid, userOrgID, model)
  1293. fmt.Println("错误是什么",Modelerr)
  1294. fmt.Println("错误是什么",err)
  1295. if err !=nil{
  1296. this.ServeFailJsonSend(enums.ErrorCodeDataException, "删除回复成功")
  1297. return
  1298. }
  1299. this.ServeSuccessJSON(map[string]interface{}{
  1300. "hospital":hospital,
  1301. "model":model,
  1302. })
  1303. }
  1304. func (this *Microwebsite) EditOffice() {
  1305. adminUserInfo := this.GetAdminUserInfo()
  1306. id, _ := this.GetInt64("id")
  1307. fmt.Println("保存id是啥?",id)
  1308. userOrgID := int64(adminUserInfo.CurrentOrgId)
  1309. offices, err := site_service.EditOffice(id, userOrgID)
  1310. if err !=nil{
  1311. this.ServeFailJsonSend(enums.ErrorCodeDataException, "删除回复成功")
  1312. return
  1313. }
  1314. this.ServeSuccessJSON(map[string]interface{}{
  1315. "offices":offices,
  1316. })
  1317. }
  1318. func (this *Microwebsite) Deletemodlebyid() {
  1319. adminUserInfo := this.GetAdminUserInfo()
  1320. id, _ := this.GetInt64("id")
  1321. fmt.Println("保存id是啥?",id)
  1322. userOrgID := int64(adminUserInfo.CurrentOrgId)
  1323. err := site_service.DeletemodleById(id, userOrgID)
  1324. modelid := site_service.DeleteHospitalByModelid(id, userOrgID)
  1325. byModelid := site_service.DeleteOfficeByModelid(id, userOrgID)
  1326. linkByModelid := site_service.DeleteEditPicLinkByModelid(id, userOrgID)
  1327. enviroments := site_service.DeleteEnviroments(id, userOrgID)
  1328. conrotation := site_service.DeleteConrotation(id, userOrgID)
  1329. margin := site_service.DeletePatentEditMargin(id, userOrgID)
  1330. fmt.Println("linkByModelid",linkByModelid)
  1331. fmt.Println("enviroments",enviroments)
  1332. fmt.Println("enviroments",conrotation)
  1333. fmt.Println("margin",margin)
  1334. fmt.Println(modelid,byModelid)
  1335. if err !=nil{
  1336. this.ServeFailJsonSend(enums.ErrorCodeDataException, "删除成功")
  1337. return
  1338. }
  1339. returnData := make(map[string]interface{}, 0)
  1340. returnData["msg"] = "ok"
  1341. this.ServeSuccessJSON(returnData)
  1342. return
  1343. }
  1344. func (this *Microwebsite) SaveOffice() {
  1345. adminUserInfo := this.GetAdminUserInfo()
  1346. id, _ := this.GetInt64("id")
  1347. fmt.Println("科室介绍id是啥?",id)
  1348. userOrgID := int64(adminUserInfo.CurrentOrgId)
  1349. fmt.Println(userOrgID)
  1350. dataBody := make(map[string]interface{}, 0)
  1351. err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
  1352. if err != nil {
  1353. utils.ErrorLog(err.Error())
  1354. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "参数错误")
  1355. return
  1356. }
  1357. title := dataBody["title"].(string)
  1358. if len(title) == 0 {
  1359. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "模块标题不能为空")
  1360. return
  1361. }
  1362. fmt.Println("标题:", title)
  1363. sort := int64(dataBody["sort"].(float64))
  1364. fmt.Println("sort是神",sort)
  1365. if sort <= 0 {
  1366. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "排序值不能为空")
  1367. return
  1368. }
  1369. fmt.Println("排序:", sort)
  1370. introduction := dataBody["introduction"].(string)
  1371. fmt.Println("内容",introduction)
  1372. if len(introduction) == 0 {
  1373. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "模块标题不能为空")
  1374. return
  1375. }
  1376. modelid := int64(dataBody["modelid"].(float64))
  1377. fmt.Println("模块ID",modelid)
  1378. if modelid <= 0 {
  1379. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "模块ID不能为空")
  1380. return
  1381. }
  1382. offices := models.SgjPatientOffices{
  1383. Title: title,
  1384. Sort: sort,
  1385. Introduction: introduction,
  1386. }
  1387. updateOffices := site_service.UpdateOffices(id, userOrgID, offices)
  1388. model := models.SgjPatientModel{
  1389. Title: title,
  1390. Sort: sort,
  1391. }
  1392. updateModel := site_service.UpdateModel(modelid, userOrgID, model)
  1393. fmt.Println(updateModel)
  1394. if updateOffices !=nil{
  1395. this.ServeFailJsonSend(enums.ErrorCodeDataException, "删除回复成功")
  1396. return
  1397. }
  1398. this.ServeSuccessJSON(map[string]interface{}{
  1399. "offices":offices,
  1400. "model":model,
  1401. })
  1402. }
  1403. func (this *Microwebsite) GetHospital() {
  1404. adminUserInfo := this.GetAdminUserInfo()
  1405. userOrgID := int64(adminUserInfo.CurrentOrgId)
  1406. hostital, err := site_service.GetHospital(userOrgID)
  1407. if err !=nil{
  1408. this.ServeFailJsonSend(enums.ErrorCodeDataException, "删除回复成功")
  1409. return
  1410. }
  1411. this.ServeSuccessJSON(map[string]interface{}{
  1412. "hostital":hostital,
  1413. })
  1414. }
  1415. func (this *Microwebsite) GetDefaultData() {
  1416. adminUserInfo := this.GetAdminUserInfo()
  1417. userOrgID := adminUserInfo.CurrentOrgId
  1418. fmt.Println("我爱我的机构id",userOrgID)
  1419. model, errcode := site_service.GetModel(userOrgID)
  1420. fmt.Println("model",model)
  1421. fmt.Println("我和我的祖国",errcode)
  1422. if errcode == gorm.ErrRecordNotFound {
  1423. patientModel := models.SgjPatientModel{
  1424. Title: "轮播图",
  1425. Sort: 1,
  1426. UserOrgId: userOrgID,
  1427. Ctime: time.Now().Unix(),
  1428. Status: 1,
  1429. ModeType: 1,
  1430. }
  1431. addPatientModel := site_service.AddPatientModelTwo(&patientModel)
  1432. fmt.Println("第一个模块id",addPatientModel)
  1433. sgjPatientModel, err := site_service.GetQueryModelByLastData(userOrgID)
  1434. fmt.Println("查询模块错误是设么",err)
  1435. editpiclink := models.SgjPatientEditpiclink{
  1436. Images: "https://images.shengws.com/2124_o_1570607834870.png",
  1437. Sort: 1,
  1438. UserOrgId: userOrgID,
  1439. Status: 1,
  1440. Ctime: time.Now().Unix(),
  1441. Modeid:sgjPatientModel.ID,
  1442. }
  1443. err = site_service.AddPatientEdit(&editpiclink)
  1444. fmt.Println("err",err)
  1445. patientmodefour := models.SgjPatientModel{
  1446. Title: "魔方导航",
  1447. Sort: 2,
  1448. UserOrgId: userOrgID,
  1449. Ctime: time.Now().Unix(),
  1450. Status: 1,
  1451. ModeType: 8,
  1452. }
  1453. addPatientModelTwo := site_service.AddPatientModelTwo(&patientmodefour)
  1454. fmt.Println(addPatientModelTwo)
  1455. sgjpatietnmodelfour, err := site_service.GetQueryModelByLastData(userOrgID)
  1456. fmt.Println("第二个模块id",sgjpatietnmodelfour)
  1457. fmt.Println(err)
  1458. editmargin := models.SgjPatientEditmargin{
  1459. Margtitle: "医院介绍",
  1460. Margimage: "https://images.shengws.com/2109_o_1569824063320.png",
  1461. UserOrgId: userOrgID,
  1462. Status: 1,
  1463. Ctime: time.Now().Unix(),
  1464. Modeid: sgjpatietnmodelfour.ID,
  1465. }
  1466. margin := site_service.AddEditMargin(&editmargin)
  1467. fmt.Println(margin)
  1468. patientEditmargin := models.SgjPatientEditmargin{
  1469. Margtitle: "医护团队",
  1470. Margimage: "https://images.shengws.com/2121_o_1569824193950.png",
  1471. UserOrgId: userOrgID,
  1472. Status: 1,
  1473. Ctime: time.Now().Unix(),
  1474. Modeid: sgjpatietnmodelfour.ID,
  1475. }
  1476. err = site_service.AddEditMargin(&patientEditmargin)
  1477. fmt.Println(err)
  1478. sgjPatientEditmargin := models.SgjPatientEditmargin{
  1479. Margtitle: "科室介绍",
  1480. Margimage: "https://images.shengws.com/2113_o_1569824421007.png",
  1481. UserOrgId: userOrgID,
  1482. Status: 1,
  1483. Ctime: time.Now().Unix(),
  1484. Modeid: sgjpatietnmodelfour.ID,
  1485. }
  1486. err = site_service.AddEditMargin(&sgjPatientEditmargin)
  1487. fmt.Println(err)
  1488. patienteditmarginfour := models.SgjPatientEditmargin{
  1489. Margtitle: "医院活动",
  1490. Margimage: "https://images.shengws.com/2131_o_1569824498886.png",
  1491. UserOrgId: userOrgID,
  1492. Status: 1,
  1493. Ctime: time.Now().Unix(),
  1494. Modeid: sgjpatietnmodelfour.ID,
  1495. }
  1496. err = site_service.AddEditMargin(&patienteditmarginfour)
  1497. fmt.Println(err)
  1498. patienteditmarginfive := models.SgjPatientEditmargin{
  1499. Margtitle: "医院环境",
  1500. Margimage: "https://images.shengws.com/2148_o_1569824574458.png",
  1501. UserOrgId: userOrgID,
  1502. Status: 1,
  1503. Ctime: time.Now().Unix(),
  1504. Modeid: sgjpatietnmodelfour.ID,
  1505. }
  1506. err = site_service.AddEditMargin(&patienteditmarginfive)
  1507. fmt.Println(err)
  1508. patienteditmarginsix := models.SgjPatientEditmargin{
  1509. Margtitle: "咨询服务",
  1510. Margimage: "https://images.shengws.com/2111_o_1569824596227.png",
  1511. UserOrgId: userOrgID,
  1512. Status: 1,
  1513. Ctime: time.Now().Unix(),
  1514. Modeid: sgjpatietnmodelfour.ID,
  1515. }
  1516. err = site_service.AddEditMargin(&patienteditmarginsix)
  1517. fmt.Println(err)
  1518. patienteditmarginserven := models.SgjPatientEditmargin{
  1519. Margtitle: "加入会员",
  1520. Margimage: "https://images.shengws.com/2126_o_1569824611892.png",
  1521. UserOrgId: userOrgID,
  1522. Status: 1,
  1523. Ctime: time.Now().Unix(),
  1524. Modeid: sgjpatietnmodelfour.ID,
  1525. }
  1526. err = site_service.AddEditMargin(&patienteditmarginserven)
  1527. fmt.Println(err)
  1528. patienteditmargineghit := models.SgjPatientEditmargin{
  1529. Margtitle: "联系我们",
  1530. Margimage: "https://images.shengws.com/2141_o_1569824626531.png",
  1531. UserOrgId: userOrgID,
  1532. Status: 1,
  1533. Ctime: time.Now().Unix(),
  1534. Modeid: sgjpatietnmodelfour.ID,
  1535. }
  1536. err = site_service.AddEditMargin(&patienteditmargineghit)
  1537. fmt.Println(err)
  1538. patientModelTwo := models.SgjPatientModel{
  1539. Title: "医院介绍",
  1540. Sort: 3,
  1541. UserOrgId: userOrgID,
  1542. Ctime: time.Now().Unix(),
  1543. Status: 1,
  1544. ModeType: 2,
  1545. }
  1546. two := site_service.AddPatientModelTwo(&patientModelTwo)
  1547. fmt.Println(two)
  1548. sgjPatientModelTwo, err := site_service.GetQueryModelByLastData(userOrgID)
  1549. hospital := models.SgjPatientHospital{
  1550. Title: "医院介绍",
  1551. Sort: 3,
  1552. Introduction: "暂无数据",
  1553. UserOrgId: userOrgID,
  1554. Modleid: sgjPatientModelTwo.ID,
  1555. Status: 1,
  1556. Ctime: time.Now().Unix(),
  1557. }
  1558. addHospital := site_service.AddHospital(&hospital)
  1559. fmt.Println(addHospital)
  1560. Sgjpatientmodelthree := models.SgjPatientModel{
  1561. Title: "科室介绍",
  1562. Sort: 4,
  1563. UserOrgId: userOrgID,
  1564. Ctime: time.Now().Unix(),
  1565. Status: 1,
  1566. ModeType: 3,
  1567. }
  1568. modelTwo := site_service.AddPatientModelTwo(&Sgjpatientmodelthree)
  1569. fmt.Println(modelTwo)
  1570. datathree, err := site_service.GetQueryModelByLastData(userOrgID)
  1571. offices := models.SgjPatientOffices{
  1572. Title: "科室介绍",
  1573. Sort: 4,
  1574. UserOrgId: userOrgID,
  1575. Ctime: time.Now().Unix(),
  1576. Status: 1,
  1577. Modleid: datathree.ID,
  1578. Introduction:"暂无数据",
  1579. }
  1580. err = site_service.AddPatientOffices(&offices)
  1581. fmt.Println(err)
  1582. patientModelFive := models.SgjPatientModel{
  1583. Title: "医护团队",
  1584. Sort: 5,
  1585. UserOrgId: userOrgID,
  1586. Ctime: time.Now().Unix(),
  1587. Status: 1,
  1588. ModeType: 4,
  1589. }
  1590. err = site_service.AddPatientModelTwo(&patientModelFive)
  1591. fmt.Println("err",err)
  1592. data, err := site_service.GetQueryModelByLastData(userOrgID)
  1593. fmt.Println(err)
  1594. editdoctor := models.SgjPatientEditdoctor{
  1595. Dochead: "https://images.shengws.com/2062_o_1570608303729.png",
  1596. DocSort: 1,
  1597. Docintroduction: "暂时无数据",
  1598. UserOrgId: userOrgID,
  1599. Modleid: data.ID,
  1600. Status:1,
  1601. Ctime:time.Now().Unix(),
  1602. DocPostion:1,
  1603. }
  1604. doctor := site_service.AddEditDoctor(&editdoctor)
  1605. fmt.Println("doctor",doctor)
  1606. modelserven := models.SgjPatientModel{
  1607. Title: "医院环境",
  1608. Sort: 6,
  1609. UserOrgId: userOrgID,
  1610. Ctime: time.Now().Unix(),
  1611. Status: 1,
  1612. ModeType: 5,
  1613. }
  1614. err = site_service.AddPatientModelTwo(&modelserven)
  1615. lastData, err := site_service.GetQueryModelByLastData(userOrgID)
  1616. enviroimages := models.SgjPatientEnviroimages{
  1617. Enviroimages: "https://images.shengws.com/2074_o_1570608492452.png",
  1618. Sort: 1,
  1619. UserOrgId: userOrgID,
  1620. Status: 1,
  1621. Modeid: lastData.ID,
  1622. Ctime: time.Now().Unix(),
  1623. }
  1624. err = site_service.AddImages(&enviroimages)
  1625. fmt.Println("err",err)
  1626. //modeleight := models.SgjPatientModel{
  1627. // Title: "文章列表",
  1628. // Sort: 7,
  1629. // UserOrgId: userOrgID,
  1630. // Ctime: time.Now().Unix(),
  1631. // Status: 1,
  1632. // ModeType: 6,
  1633. //}
  1634. //err = site_service.AddPatientModelTwo(&modeleight)
  1635. //fmt.Println("文章列表错误u",err)
  1636. //articles := models.Articles{
  1637. // Title: "暂无数据",
  1638. // Imgs: "https://images.shengws.com/2139_o_1566989829686.jpg",
  1639. // RealReadNum: 0,
  1640. // CommentNum: 0,
  1641. // StarNum: 0,
  1642. // UserOrgId:userOrgID,
  1643. // Ctime: time.Now().Unix(),
  1644. // Status:1,
  1645. // ArticleStatus:1,
  1646. //}
  1647. //err = site_service.AddActicles(&articles)
  1648. //fmt.Println("err",err)
  1649. }else if errcode == nil{
  1650. }else {
  1651. }
  1652. if errcode !=nil{
  1653. this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
  1654. return
  1655. }
  1656. this.ServeSuccessJSON(map[string]interface{}{
  1657. "model":model,
  1658. })
  1659. }
  1660. func (this *Microwebsite) GetData() {
  1661. fmt.Println("我和我的作古阿斯蒂芬地方地方阿道夫打发阿凡达阿范德萨发撒旦法阿斯蒂芬发送到法阿发法阿发法")
  1662. adminUserInfo := this.GetAdminUserInfo()
  1663. userOrgID := int64(adminUserInfo.CurrentOrgId)
  1664. fmt.Println("机构id",userOrgID)
  1665. model, err := site_service.GetData(userOrgID)
  1666. if err !=nil{
  1667. this.ServeFailJsonSend(enums.ErrorCodeDataException, "删除回复成功")
  1668. return
  1669. }
  1670. this.ServeSuccessJSON(map[string]interface{}{
  1671. "patientModels":model,
  1672. })
  1673. }
  1674. func (this *Microwebsite) EditDoctor() {
  1675. adminUserInfo := this.GetAdminUserInfo()
  1676. userOrgID := int64(adminUserInfo.CurrentOrgId)
  1677. fmt.Println("机构ID" ,userOrgID)
  1678. id, _ := this.GetInt64("id")
  1679. fmt.Println("编辑名医获取ID",id)
  1680. docinfo, err := site_service.QueryEditDoctor(id, userOrgID)
  1681. fmt.Println(docinfo)
  1682. fmt.Println("错误",err)
  1683. if err !=nil{
  1684. this.ServeFailJsonSend(enums.ErrorCodeDataException, "删除回复成功")
  1685. return
  1686. }
  1687. this.ServeSuccessJSON(map[string]interface{}{
  1688. "docinfo":docinfo,
  1689. })
  1690. }
  1691. func (this *Microwebsite) EditDoctorsInfo() {
  1692. adminUserInfo := this.GetAdminUserInfo()
  1693. OrgID := adminUserInfo.CurrentOrgId
  1694. dataBody := make(map[string]interface{}, 0)
  1695. err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
  1696. if err != nil {
  1697. utils.ErrorLog(err.Error())
  1698. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "参数错误")
  1699. return
  1700. }
  1701. idsInters := dataBody["ids"].([]interface{})
  1702. fmt.Println("id集合是",idsInters)
  1703. if len(idsInters) == 0 {
  1704. if err != nil {
  1705. this.ServeFailJsonSend(enums.ErrorCodeDBDelete, "删除会员失败:(没有选择会员)")
  1706. return
  1707. }
  1708. }
  1709. ids := make([]int64, 0)
  1710. for _, idsInter := range idsInters {
  1711. id := int64(idsInter.(float64))
  1712. ids = append(ids, id)
  1713. }
  1714. patientModel, err := site_service.QueryModel(OrgID)
  1715. fmt.Println("模块ID",patientModel.ID)
  1716. editdoctor := models.SgjPatientEditdoctor{
  1717. Modleid:patientModel.ID,
  1718. }
  1719. err = site_service.UpdateDoctorsInfo(OrgID, ids, editdoctor)
  1720. fmt.Println("更新数据错误",err)
  1721. if err !=nil{
  1722. this.ServeFailJsonSend(enums.ErrorCodeDataException, "更新数据成功")
  1723. return
  1724. }
  1725. this.ServeSuccessJSON(map[string]interface{}{
  1726. "editdoctor":editdoctor,
  1727. })
  1728. }
  1729. func (this *Microwebsite) EditDoc() {
  1730. adminUserInfo := this.GetAdminUserInfo()
  1731. id, _ := this.GetInt64("id")
  1732. fmt.Println("编辑名医id是啥?",id)
  1733. userOrgID := int64(adminUserInfo.CurrentOrgId)
  1734. fmt.Println(userOrgID)
  1735. //editdoctor, err := site_service.QueryEditDoc(id, userOrgID)
  1736. editdoctor, err := site_service.QueryModelByid(id, userOrgID)
  1737. //editdoctors, err := site_service.QuerEditDocByid(id, userOrgID)
  1738. editdoctors, err := site_service.QuerEditDocByModleid(id, userOrgID)
  1739. fmt.Println("错误",err)
  1740. fmt.Println("数据:",editdoctor)
  1741. fmt.Println("数据",editdoctors)
  1742. if err !=nil{
  1743. this.ServeFailJsonSend(enums.ErrorCodeDataException, "删除回复成功")
  1744. return
  1745. }
  1746. this.ServeSuccessJSON(map[string]interface{}{
  1747. "editdoctor":editdoctor,
  1748. "editdoctors":editdoctors,
  1749. })
  1750. }
  1751. func (this *Microwebsite) SaveDocInfo() {
  1752. adminUserInfo := this.GetAdminUserInfo()
  1753. id, _ := this.GetInt64("id")
  1754. fmt.Println("编辑名医id是啥?",id)
  1755. userOrgID := int64(adminUserInfo.CurrentOrgId)
  1756. fmt.Println(userOrgID)
  1757. dataBody := make(map[string]interface{}, 0)
  1758. err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
  1759. if err != nil {
  1760. utils.ErrorLog(err.Error())
  1761. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "参数错误")
  1762. return
  1763. }
  1764. title := dataBody["doc_name"].(string)
  1765. if len(title) == 0 {
  1766. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "模块标题不能为空")
  1767. return
  1768. }
  1769. fmt.Println("医生姓名",title)
  1770. docpostion := int64(dataBody["doc_postion"].(float64))
  1771. fmt.Println("医生职位",docpostion)
  1772. if docpostion <= 0{
  1773. this.ServeFailJsonSend(enums.ErrorCodeParamWrong,"医生职位不能为空")
  1774. return
  1775. }
  1776. dochead := dataBody["dochead"].(string)
  1777. if len(dochead) == 0 {
  1778. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "模块标题不能为空")
  1779. return
  1780. }
  1781. fmt.Println("医生头像",dochead)
  1782. docsort :=int64(dataBody["doc_sort"].(float64))
  1783. fmt.Println("排序",docsort)
  1784. docintroduction := dataBody["docintroduction"].(string)
  1785. fmt.Println("医生简介",docintroduction)
  1786. modleid := int64(dataBody["modleid"].(float64))
  1787. fmt.Println("模块idss",modleid)
  1788. editdoctor := models.SgjPatientEditdoctor{
  1789. DocName: title,
  1790. DocPostion: docpostion,
  1791. Dochead: dochead,
  1792. Docintroduction: docintroduction,
  1793. DocSort:docsort,
  1794. ImgShow:1,
  1795. Status:1,
  1796. Ctime:time.Now().Unix(),
  1797. }
  1798. err = site_service.UpDateEditdoctor(id, userOrgID, editdoctor)
  1799. editdoctors, err := site_service.QuerEditDoctorInfo(modleid, userOrgID)
  1800. fmt.Println("错误是",err)
  1801. if err !=nil{
  1802. this.ServeFailJsonSend(enums.ErrorCodeDataException, "删除回复成功")
  1803. return
  1804. }
  1805. this.ServeSuccessJSON(map[string]interface{}{
  1806. "editdoctor":editdoctor,
  1807. "editdoctors":editdoctors,
  1808. })
  1809. }
  1810. func (this *Microwebsite) EditImages() {
  1811. adminUserInfo := this.GetAdminUserInfo()
  1812. userOrgID := int64(adminUserInfo.CurrentOrgId)
  1813. //fmt.Println("机构ID",userOrgID)
  1814. id, _ := this.GetInt64("id")
  1815. fmt.Println("路径",id)
  1816. editdoctor, err := site_service.QueryEditImages(userOrgID, id)
  1817. fmt.Println(editdoctor)
  1818. fmt.Println("错误",err)
  1819. if err !=nil{
  1820. this.ServeFailJsonSend(enums.ErrorCodeDataException, "删除回复成功")
  1821. return
  1822. }
  1823. this.ServeSuccessJSON(map[string]interface{}{
  1824. "editdoctor":editdoctor,
  1825. })
  1826. }
  1827. func (this *Microwebsite) Savedocdata() {
  1828. adminUserInfo := this.GetAdminUserInfo()
  1829. userOrgID := int64(adminUserInfo.CurrentOrgId)
  1830. fmt.Println("机构ID",userOrgID)
  1831. id, _ := this.GetInt64("id")
  1832. fmt.Println("路径",id)
  1833. dataBody := make(map[string]interface{}, 0)
  1834. err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
  1835. if err != nil {
  1836. utils.ErrorLog(err.Error())
  1837. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "参数错误")
  1838. return
  1839. }
  1840. title := dataBody["title"].(string)
  1841. if len(title) == 0 {
  1842. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "模块标题不能为空")
  1843. return
  1844. }
  1845. fmt.Println("标题",title)
  1846. sort := int64(dataBody["sort"].(float64))
  1847. if sort <= 0 {
  1848. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "模块标题不能为空")
  1849. return
  1850. }
  1851. fmt.Println("排序",sort)
  1852. image := dataBody["image"]
  1853. replace := strings.Replace(strings.Trim(fmt.Sprint(image), "[]"), " ", ",", -1)
  1854. fmt.Println("图片练级",replace)
  1855. modleid := int64(dataBody["modleid"].(float64))
  1856. if modleid <= 0 {
  1857. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "模块ID不能为空")
  1858. return
  1859. }
  1860. fmt.Println("模块ID",modleid)
  1861. docinfo := models.SgjPatientDocinfo{
  1862. Title: title,
  1863. Sort: sort,
  1864. Docimages: replace,
  1865. Modelid:modleid,
  1866. }
  1867. err = site_service.Upadatedocdata(userOrgID, id, docinfo)
  1868. model := models.SgjPatientModel{
  1869. Title: title,
  1870. Sort: sort,
  1871. ID: modleid,
  1872. }
  1873. err = site_service.UpdateModel(modleid, userOrgID, model)
  1874. if err !=nil{
  1875. this.ServeFailJsonSend(enums.ErrorCodeDataException, "删除回复成功")
  1876. return
  1877. }
  1878. this.ServeSuccessJSON(map[string]interface{}{
  1879. "docinfo":docinfo,
  1880. "model":model,
  1881. })
  1882. }
  1883. func (this *Microwebsite) EditOfficeEnviroment() {
  1884. adminUserInfo := this.GetAdminUserInfo()
  1885. userOrgID := int64(adminUserInfo.CurrentOrgId)
  1886. fmt.Println("机构ID",userOrgID)
  1887. id, _ := this.GetInt64("id")
  1888. fmt.Println("科室环境路径",id)
  1889. model, err := site_service.GetQueryModel(id, userOrgID)
  1890. fmt.Println("model错误",err)
  1891. //offenvironment, err := site_service.QuerOfficeEnviroment(id, userOrgID)
  1892. patientenviroimages, err := site_service.QueryOfficeformById(id, userOrgID)
  1893. fmt.Println("错误",err)
  1894. fmt.Println("科室环境数据",patientenviroimages)
  1895. if err !=nil{
  1896. this.ServeFailJsonSend(enums.ErrorCodeDataException, "删除回复成功")
  1897. return
  1898. }
  1899. this.ServeSuccessJSON(map[string]interface{}{
  1900. "model":model,
  1901. "patientenviroimages":patientenviroimages,
  1902. })
  1903. }
  1904. func (this *Microwebsite) AddImages() {
  1905. adminUserInfo := this.GetAdminUserInfo()
  1906. userOrgID := int64(adminUserInfo.CurrentOrgId)
  1907. fmt.Println("机构ID",userOrgID)
  1908. dataBody := make(map[string]interface{}, 0)
  1909. err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
  1910. if err != nil {
  1911. utils.ErrorLog(err.Error())
  1912. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "参数错误")
  1913. return
  1914. }
  1915. enviroimages := dataBody["enviroimages"].(string)
  1916. fmt.Println("图片",enviroimages)
  1917. if len(enviroimages) == 0 {
  1918. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "模块标题不能为空")
  1919. return
  1920. }
  1921. sort := int64(dataBody["sort"].(float64))
  1922. fmt.Println("sort",sort)
  1923. patientEnviroimages := models.SgjPatientEnviroimages{
  1924. Enviroimages: enviroimages,
  1925. Sort: sort,
  1926. UserOrgId: userOrgID,
  1927. Ctime: time.Now().Unix(),
  1928. Status: 1,
  1929. Imgshow:1,
  1930. }
  1931. err = site_service.AddImages(&patientEnviroimages)
  1932. if err !=nil{
  1933. this.ServeFailJsonSend(enums.ErrorCodeDataException, "删除回复成功")
  1934. return
  1935. }
  1936. this.ServeSuccessJSON(map[string]interface{}{
  1937. "patientEnviroimages":patientEnviroimages,
  1938. })
  1939. }
  1940. func (this *Microwebsite) SaveOfficeEnvironment() {
  1941. adminUserInfo := this.GetAdminUserInfo()
  1942. userOrgID := int64(adminUserInfo.CurrentOrgId)
  1943. fmt.Println("机构ID",userOrgID)
  1944. id, _ := this.GetInt64("id")
  1945. fmt.Println("科室环境id",id)
  1946. dataBody := make(map[string]interface{}, 0)
  1947. err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
  1948. if err != nil {
  1949. utils.ErrorLog(err.Error())
  1950. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "参数错误")
  1951. return
  1952. }
  1953. title := dataBody["title"].(string)
  1954. if len(title) == 0 {
  1955. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "模块标题不能为空")
  1956. return
  1957. }
  1958. fmt.Println("模块标题",title)
  1959. sort := int64(dataBody["sort"].(float64))
  1960. if sort <= 0 {
  1961. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "模块标题不能为空")
  1962. return
  1963. }
  1964. fmt.Println("排序",sort)
  1965. keimages := dataBody["keImages"]
  1966. fmt.Println("图片",keimages)
  1967. replace := strings.Replace(strings.Trim(fmt.Sprint(keimages), "[]"), " ", ",", -1)
  1968. model := models.SgjPatientModel{
  1969. Title: title,
  1970. Sort: sort,
  1971. }
  1972. //offenvironment, err := site_service.GetOffENvironmentById(id, userOrgID)
  1973. err = site_service.UpdateModel(id, userOrgID, model)
  1974. fmt.Println("错误",err)
  1975. patientOffenvironment := models.SgjPatientOffenvironment{
  1976. Title: title,
  1977. Sort: sort,
  1978. Keimages: replace,
  1979. }
  1980. err = site_service.UpdatePatientOffenvironment(id, userOrgID, patientOffenvironment)
  1981. if err !=nil{
  1982. this.ServeFailJsonSend(enums.ErrorCodeDataException, "删除回复成功")
  1983. return
  1984. }
  1985. this.ServeSuccessJSON(map[string]interface{}{
  1986. "model":model,
  1987. "patientOffenvironment":patientOffenvironment,
  1988. })
  1989. //environment, err := site_service.UpdateOfficeEnvironment(id, userOrgID)
  1990. //if err !=nil{
  1991. // this.ServeFailJsonSend(enums.ErrorCodeDataException, "删除回复成功")
  1992. // return
  1993. //}
  1994. //this.ServeSuccessJSON(map[string]interface{}{
  1995. // "environment":environment,
  1996. //})
  1997. }
  1998. func (this *Microwebsite) Hispitalmore() {
  1999. adminUserInfo := this.GetAdminUserInfo()
  2000. userOrgID := int64(adminUserInfo.CurrentOrgId)
  2001. id, _ := this.GetInt64("id")
  2002. hospital, err := site_service.QueryHispitalDetail(userOrgID, id)
  2003. if err !=nil{
  2004. this.ServeFailJsonSend(enums.ErrorCodeDataException, "删除回复成功")
  2005. return
  2006. }
  2007. this.ServeSuccessJSON(map[string]interface{}{
  2008. "hospital":hospital,
  2009. })
  2010. }
  2011. func (this *Microwebsite) GetOfficeDetail() {
  2012. adminUserInfo := this.GetAdminUserInfo()
  2013. userOrgID := int64(adminUserInfo.CurrentOrgId)
  2014. id, _ := this.GetInt64("id")
  2015. fmt.Println("ID是多少",id)
  2016. offices, err := site_service.GetOfficeDetail(userOrgID, id)
  2017. if err !=nil{
  2018. this.ServeFailJsonSend(enums.ErrorCodeDataException, "删除回复成功")
  2019. return
  2020. }
  2021. this.ServeSuccessJSON(map[string]interface{}{
  2022. "offices":offices,
  2023. })
  2024. }
  2025. func (this *Microwebsite) GetDoctorDetail() {
  2026. adminUserInfo := this.GetAdminUserInfo()
  2027. userOrgID := int64(adminUserInfo.CurrentOrgId)
  2028. id, _ := this.GetInt64("id")
  2029. fmt.Println("米公益ID",id)
  2030. editdoctor, err := site_service.GetDoctorDetail(userOrgID, id)
  2031. if err !=nil{
  2032. this.ServeFailJsonSend(enums.ErrorCodeDataException, "删除回复成功")
  2033. return
  2034. }
  2035. this.ServeSuccessJSON(map[string]interface{}{
  2036. "editdoctor":editdoctor,
  2037. })
  2038. }
  2039. func (this *Microwebsite) GetOfficEnviromentDetail() {
  2040. adminUserInfo := this.GetAdminUserInfo()
  2041. userOrgID := int64(adminUserInfo.CurrentOrgId)
  2042. id, _ := this.GetInt64("id")
  2043. fmt.Println("科室环境id",id)
  2044. offenvironment, err := site_service.GetOfficEnviromentDetail(userOrgID, id)
  2045. fmt.Println("错误",err)
  2046. fmt.Println("offenvironment",offenvironment)
  2047. if err !=nil{
  2048. this.ServeFailJsonSend(enums.ErrorCodeDataException, "删除回复成功")
  2049. return
  2050. }
  2051. this.ServeSuccessJSON(map[string]interface{}{
  2052. "offenvironment":offenvironment,
  2053. })
  2054. }
  2055. func (this *Microwebsite) GetArticlistDetail() {
  2056. adminUserInfo := this.GetAdminUserInfo()
  2057. userOrgID := int64(adminUserInfo.CurrentOrgId)
  2058. fmt.Println("机构id",userOrgID)
  2059. id, _ := this.GetInt64("id")
  2060. fmt.Println("文章详情",id)
  2061. articlelist, err := site_service.GetArticlelistById(id, userOrgID)
  2062. fmt.Println(articlelist.Number,err)
  2063. //fmt.Println(err)
  2064. articlelists, err := site_service.GetAllArticles(userOrgID, articlelist.Number)
  2065. fmt.Println("articlelist",articlelist)
  2066. if err !=nil{
  2067. this.ServeFailJsonSend(enums.ErrorCodeDataException, "删除回复成功")
  2068. return
  2069. }
  2070. this.ServeSuccessJSON(map[string]interface{}{
  2071. "articlelists":articlelists,
  2072. })
  2073. }
  2074. func (this *Microwebsite) GetActivitesDetail() {
  2075. adminUserInfo := this.GetAdminUserInfo()
  2076. userOrgID := int64(adminUserInfo.CurrentOrgId)
  2077. fmt.Println("机构id",userOrgID)
  2078. id, _ := this.GetInt64("id")
  2079. fmt.Println("活动详情",id)
  2080. addactivity, err := site_service.GetAllActivitiById(id, userOrgID)
  2081. fmt.Println("err",err)
  2082. activity, err := site_service.GetAllActivities(userOrgID, addactivity.Number)
  2083. if err !=nil{
  2084. this.ServeFailJsonSend(enums.ErrorCodeDataException, "删除回复成功")
  2085. return
  2086. }
  2087. this.ServeSuccessJSON(map[string]interface{}{
  2088. "activity":activity,
  2089. })
  2090. }
  2091. func (this *Microwebsite) AddNavigation() {
  2092. adminUserInfo := this.GetAdminUserInfo()
  2093. userOrgID := int64(adminUserInfo.CurrentOrgId)
  2094. fmt.Println("机构ID",userOrgID)
  2095. dataBody := make(map[string]interface{}, 0)
  2096. err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
  2097. if err != nil {
  2098. utils.ErrorLog(err.Error())
  2099. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "参数错误")
  2100. return
  2101. }
  2102. navtitle := dataBody["navtitle"].(string)
  2103. if len(navtitle) == 0 {
  2104. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "导航标题不能为空")
  2105. return
  2106. }
  2107. fmt.Println("导航标题",navtitle)
  2108. navigationImages := dataBody["navigationImages"].(string)
  2109. if len(navigationImages) == 0 {
  2110. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "导航图片不能为空")
  2111. return
  2112. }
  2113. fmt.Println("导航图片",navigationImages)
  2114. nonavigationimages := dataBody["nonavigationImages"].(string)
  2115. jumpset := int64(dataBody["jumpset"].(float64))
  2116. if jumpset <= 0 {
  2117. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "跳转设置不能为空")
  2118. return
  2119. }
  2120. fmt.Println("调转设置",jumpset)
  2121. navigationaddress := dataBody["navigationaddress"].(string)
  2122. fmt.Println("链接地址",navigationaddress)
  2123. linkid := int64(dataBody["linkid"].(float64))
  2124. fmt.Println("linkID",linkid)
  2125. linktype := int64(dataBody["linktype"].(float64))
  2126. navigation := models.SgjPatientNavigation{
  2127. Navtitle: navtitle,
  2128. Navimages: navigationImages,
  2129. Nonavimages:nonavigationimages,
  2130. Jumpset: jumpset,
  2131. Navaddress: navigationaddress,
  2132. UserOrgId:userOrgID,
  2133. Status: 1,
  2134. Ctime:time.Now().Unix(),
  2135. Linkid:linkid,
  2136. Linktype:linktype,
  2137. }
  2138. err = site_service.AddNavigation(&navigation)
  2139. if err !=nil{
  2140. this.ServeFailJsonSend(enums.ErrorCodeDataException, "删除回复成功")
  2141. return
  2142. }
  2143. this.ServeSuccessJSON(map[string]interface{}{
  2144. "navigation":navigation,
  2145. })
  2146. }
  2147. func (this *Microwebsite) GetNavigationList() {
  2148. adminUserInfo := this.GetAdminUserInfo()
  2149. userOrgID := int64(adminUserInfo.CurrentOrgId)
  2150. navigation, err := site_service.GetNavigationList(userOrgID)
  2151. fmt.Println("导航错误是什么",err)
  2152. if err !=nil{
  2153. this.ServeFailJsonSend(enums.ErrorCodeDataException, "删除回复成功")
  2154. return
  2155. }
  2156. this.ServeSuccessJSON(map[string]interface{}{
  2157. "navigation":navigation,
  2158. })
  2159. }
  2160. func (this *Microwebsite) AddShareInfo() {
  2161. adminUserInfo := this.GetAdminUserInfo()
  2162. userOrgID := int64(adminUserInfo.CurrentOrgId)
  2163. fmt.Println("机构ID",userOrgID)
  2164. dataBody := make(map[string]interface{}, 0)
  2165. err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
  2166. if err != nil {
  2167. utils.ErrorLog(err.Error())
  2168. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "参数错误")
  2169. return
  2170. }
  2171. sharetitle := dataBody["sharetitle"].(string)
  2172. fmt.Println("比阿尼",sharetitle)
  2173. if len(sharetitle) == 0 {
  2174. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "分享标题不能为空")
  2175. return
  2176. }
  2177. shareintroduction := dataBody["shareintroduction"].(string)
  2178. fmt.Println("分享内容",sharetitle)
  2179. if len(shareintroduction) == 0 {
  2180. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "分享标题不能为空")
  2181. return
  2182. }
  2183. shareImages := dataBody["shareImages"].(string)
  2184. fmt.Println("分享图片",shareImages)
  2185. if len(shareImages) == 0 {
  2186. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "分享标题不能为空")
  2187. return
  2188. }
  2189. share := models.SgjPatientShare{
  2190. ShareTitle: sharetitle,
  2191. ShareIntroduction: shareintroduction,
  2192. ShareImages: shareImages,
  2193. Ctime: time.Now().Unix(),
  2194. UserOrgId:userOrgID,
  2195. Status: 1,
  2196. }
  2197. fmt.Println("share是设么",share)
  2198. err = site_service.AddShareInfo(&share)
  2199. if err !=nil{
  2200. this.ServeFailJsonSend(enums.ErrorCodeDataException, "删除回复成功")
  2201. return
  2202. }
  2203. this.ServeSuccessJSON(map[string]interface{}{
  2204. "share":share,
  2205. })
  2206. }
  2207. func (this *Microwebsite) GetShareInfo() {
  2208. adminUserInfo := this.GetAdminUserInfo()
  2209. userOrgID := int64(adminUserInfo.CurrentOrgId)
  2210. share, err := site_service.GetShareInfo(userOrgID)
  2211. if err !=nil{
  2212. this.ServeFailJsonSend(enums.ErrorCodeDataException, "删除回复成功")
  2213. return
  2214. }
  2215. fmt.Println("错误是什么?",err)
  2216. this.ServeSuccessJSON(map[string]interface{}{
  2217. "share":share,
  2218. })
  2219. fmt.Println("返回share是什么",share)
  2220. }
  2221. func (this *Microwebsite) DeleteNavition() {
  2222. adminUserInfo := this.GetAdminUserInfo()
  2223. userOrgID := int64(adminUserInfo.CurrentOrgId)
  2224. id, _ := this.GetInt64("id")
  2225. fmt.Println("id是什么呢",id)
  2226. err := site_service.DeleteNavitionById(userOrgID, id)
  2227. if err !=nil{
  2228. this.ServeFailJsonSend(enums.ErrorCodeDataException, "删除成功")
  2229. return
  2230. }
  2231. returnData := make(map[string]interface{}, 0)
  2232. returnData["msg"] = "ok"
  2233. this.ServeSuccessJSON(returnData)
  2234. return
  2235. }
  2236. func (this *Microwebsite) DeleteModle() {
  2237. adminUserInfo := this.GetAdminUserInfo()
  2238. userOrgID := int64(adminUserInfo.CurrentOrgId)
  2239. id, _ := this.GetInt64("id")
  2240. fmt.Println("模块ID",id)
  2241. err := site_service.DeleteModle(userOrgID, id)
  2242. fmt.Println("错误是什么",err)
  2243. errtw := site_service.DeleteModleByModeID(userOrgID, id)
  2244. way := site_service.DeleteRideWay(userOrgID, id)
  2245. workTime := site_service.DeleteWorkTime(userOrgID, id)
  2246. conrotation := site_service.DeleteConrotation(id, userOrgID)
  2247. fmt.Println("错误是什么",errtw,way,workTime)
  2248. fmt.Println(conrotation)
  2249. if err !=nil{
  2250. this.ServeFailJsonSend(enums.ErrorCodeDataException, "删除成功")
  2251. return
  2252. }
  2253. returnData := make(map[string]interface{}, 0)
  2254. returnData["msg"] = "ok"
  2255. this.ServeSuccessJSON(returnData)
  2256. return
  2257. }
  2258. func (this *Microwebsite) GetOrderModel() {
  2259. adminUserInfo := this.GetAdminUserInfo()
  2260. userOrgID := int64(adminUserInfo.CurrentOrgId)
  2261. ordmodel, err := site_service.GetOrederModel(userOrgID)
  2262. fmt.Println("ordemodel是社没什么",ordmodel)
  2263. if err !=nil{
  2264. this.ServeFailJsonSend(enums.ErrorCodeDataException, "删除回复成功")
  2265. return
  2266. }
  2267. this.ServeSuccessJSON(map[string]interface{}{
  2268. "ordmodel":ordmodel,
  2269. })
  2270. }
  2271. func (this *Microwebsite) AddRotationpic() {
  2272. fmt.Println("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
  2273. adminUserInfo := this.GetAdminUserInfo()
  2274. userOrgID := int64(adminUserInfo.CurrentOrgId)
  2275. fmt.Println("机构ID",userOrgID)
  2276. dataBody := make(map[string]interface{}, 0)
  2277. err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
  2278. if err != nil {
  2279. utils.ErrorLog(err.Error())
  2280. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "参数错误")
  2281. return
  2282. }
  2283. images := dataBody["Images"].(string)
  2284. fmt.Println("图片",images)
  2285. if len(images) == 0 {
  2286. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "图片不能为空")
  2287. return
  2288. }
  2289. sort := int64(dataBody["sort"].(float64))
  2290. if sort <= 0 {
  2291. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "排序不能为空")
  2292. return
  2293. }
  2294. fmt.Println("排序",sort)
  2295. piclink := int64(dataBody["piclink"].(float64))
  2296. if piclink <= 0 {
  2297. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "图片链接不能为空")
  2298. return
  2299. }
  2300. fmt.Println("图片链接",piclink)
  2301. linkaddress := dataBody["linkaddress"].(string)
  2302. fmt.Println("链接地址",linkaddress)
  2303. linkid := int64(dataBody["linkid"].(float64))
  2304. fmt.Println("linkid是什么",linkid)
  2305. conrotation := models.SgjPatientConrotation{
  2306. Images: images,
  2307. Sort: sort,
  2308. Piclink: piclink,
  2309. Linkaddress: linkaddress,
  2310. Status: 1,
  2311. Ctime: time.Now().Unix(),
  2312. UserOrgId: userOrgID,
  2313. Modeid:0,
  2314. ImgShow:1,
  2315. Linkid:linkid,
  2316. }
  2317. err = site_service.AddRotationpic(conrotation)
  2318. patientConrotation, err := site_service.GetPatientConrotationLast(userOrgID)
  2319. fmt.Println("patientConrotation是设么",patientConrotation.ID)
  2320. fmt.Println("err是什么",err)
  2321. conrotations, total, err := site_service.GetTotalCount(userOrgID)
  2322. fmt.Println("conrotations",conrotations)
  2323. //conlinkaddress := models.SgjPatientConlinkaddress{
  2324. // ConId:patientConrotation.ID,
  2325. //}
  2326. //err = site_service.UpdateConLinkAddress(userOrgID, 0, conlinkaddress)
  2327. if err !=nil{
  2328. this.ServeFailJsonSend(enums.ErrorCodeDataException, "删除回复成功")
  2329. return
  2330. }
  2331. this.ServeSuccessJSON(map[string]interface{}{
  2332. "total":total,
  2333. "conrotation":conrotation,
  2334. })
  2335. }
  2336. func (this *Microwebsite) GetRotationimages() {
  2337. adminUserInfo := this.GetAdminUserInfo()
  2338. userOrgID := int64(adminUserInfo.CurrentOrgId)
  2339. conrotations, err := site_service.GetRotationImages(userOrgID)
  2340. fmt.Println(conrotations)
  2341. fmt.Println("海克斯错误是什么",err)
  2342. if err !=nil{
  2343. this.ServeFailJsonSend(enums.ErrorCodeDataException, "删除回复成功")
  2344. return
  2345. }
  2346. this.ServeSuccessJSON(map[string]interface{}{
  2347. "conrotations":conrotations,
  2348. })
  2349. }
  2350. func (this *Microwebsite) AddrotationImage() {
  2351. adminUserInfo := this.GetAdminUserInfo()
  2352. userOrgID := int64(adminUserInfo.CurrentOrgId)
  2353. dataBody := make(map[string]interface{}, 0)
  2354. err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
  2355. if err != nil {
  2356. utils.ErrorLog(err.Error())
  2357. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "参数错误")
  2358. return
  2359. }
  2360. title := dataBody["title"].(string)
  2361. fmt.Println("模块标题",title)
  2362. if len(title) == 0 {
  2363. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "模块标题不能为空")
  2364. return
  2365. }
  2366. sort := int64(dataBody["sort"].(float64))
  2367. if sort<=0{
  2368. this.ServeFailJsonSend(enums.ErrorCodeParamWrong,"排序不能为空")
  2369. return
  2370. }
  2371. fmt.Println("排序",sort)
  2372. rotationImages := dataBody["rotationImages"]
  2373. fmt.Println("图片",rotationImages)
  2374. images := strings.Replace(strings.Trim(fmt.Sprint(rotationImages), "[]"), " ", ",", -1)
  2375. fmt.Println("images",images)
  2376. idsInters := dataBody["ids"].([]interface{})
  2377. fmt.Println("id集合是",idsInters)
  2378. if len(idsInters) == 0 {
  2379. if err != nil {
  2380. this.ServeFailJsonSend(enums.ErrorCodeDBDelete, "删除会员失败:(没有选择会员)")
  2381. return
  2382. }
  2383. }
  2384. ids := make([]int64, 0)
  2385. for _, idsInter := range idsInters {
  2386. id := int64(idsInter.(float64))
  2387. ids = append(ids, id)
  2388. }
  2389. ordmodel := models.SgjPatientOrdmodel{
  2390. Title: title,
  2391. Sort: sort,
  2392. ModeType: 1,
  2393. Ctime:time.Now().Unix(),
  2394. Status:1,
  2395. UserOrgId:userOrgID,
  2396. }
  2397. err = site_service.AddOrdModel(&ordmodel)
  2398. fmt.Println("错苏是设么",err)
  2399. patientOrdmodel, err := site_service.QueryOrdeModelByID(userOrgID)
  2400. conrotation := models.SgjPatientConrotation{
  2401. Modeid: patientOrdmodel.ID,
  2402. }
  2403. err = site_service.UpdateConrotaions(userOrgID, ids, conrotation)
  2404. fmt.Println("rongfeng",err)
  2405. oldrotation := models.SgjPatientOldrotation{
  2406. Title: title,
  2407. Sort: sort,
  2408. RotationImages: images,
  2409. ModeId: patientOrdmodel.ID,
  2410. Status: 1,
  2411. UserOrgId: userOrgID,
  2412. Ctime: time.Now().Unix(),
  2413. }
  2414. err = site_service.AddrotationImage(&oldrotation)
  2415. patientConrotation := models.SgjPatientConrotation{
  2416. Modeid: patientOrdmodel.ID,
  2417. }
  2418. err = site_service.UpdateConrotation(userOrgID, ids, patientConrotation)
  2419. fmt.Println("错误",err)
  2420. if err !=nil{
  2421. this.ServeFailJsonSend(enums.ErrorCodeDataException, "删除回复成功")
  2422. return
  2423. }
  2424. this.ServeSuccessJSON(map[string]interface{}{
  2425. "oldrotation":oldrotation,
  2426. })
  2427. }
  2428. func (this *Microwebsite) AddImageslink() {
  2429. adminUserInfo := this.GetAdminUserInfo()
  2430. userOrgID := int64(adminUserInfo.CurrentOrgId)
  2431. id, _ := this.GetInt64("id")
  2432. fmt.Println("id是多少",id)
  2433. dataBody := make(map[string]interface{}, 0)
  2434. err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
  2435. if err != nil {
  2436. utils.ErrorLog(err.Error())
  2437. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "参数错误")
  2438. return
  2439. }
  2440. imageUrl := dataBody["imageUrl"].(string)
  2441. fmt.Println("图片编辑",imageUrl)
  2442. if len(imageUrl) == 0 {
  2443. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "图片编辑不能为空")
  2444. return
  2445. }
  2446. sort := int64(dataBody["sort"].(float64))
  2447. fmt.Println("排序",sort)
  2448. if sort <= 0 {
  2449. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "排序不能为空")
  2450. return
  2451. }
  2452. imagelink :=int64(dataBody["imagelink"].(float64))
  2453. if imagelink <= 0 {
  2454. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "图片链接不能为空")
  2455. return
  2456. }
  2457. fmt.Println("图片链接",imagelink)
  2458. linkaddress := dataBody["linkaddress"].(string)
  2459. editpiclink := models.SgjPatientEditpiclink{
  2460. Images: imageUrl,
  2461. Sort: sort,
  2462. Piclink: imagelink,
  2463. Linkaddress: linkaddress,
  2464. Status: 1,
  2465. Ctime: time.Now().Unix(),
  2466. UserOrgId: userOrgID,
  2467. Modeid:0,
  2468. ImgShow:1,
  2469. Linkid:id,
  2470. }
  2471. err = site_service.AddImageslink(&editpiclink)
  2472. edipiclink, total, err := site_service.GetCountImages(userOrgID)
  2473. fmt.Println("错误是什么错误是什么错误是什么错误是什么错误是什么",err)
  2474. fmt.Println(total)
  2475. fmt.Println(edipiclink)
  2476. if err !=nil{
  2477. this.ServeFailJsonSend(enums.ErrorCodeDataException, "删除回复成功")
  2478. return
  2479. }
  2480. this.ServeSuccessJSON(map[string]interface{}{
  2481. "editpiclink":editpiclink,
  2482. "total":total,
  2483. })
  2484. }
  2485. func (this *Microwebsite) GetEditImages() {
  2486. adminUserInfo := this.GetAdminUserInfo()
  2487. userOrgID := int64(adminUserInfo.CurrentOrgId)
  2488. editpiclinks, err := site_service.GetEditImages(userOrgID)
  2489. fmt.Println("查询到的数据",editpiclinks,err)
  2490. if err !=nil{
  2491. this.ServeFailJsonSend(enums.ErrorCodeDataException, "删除回复成功")
  2492. return
  2493. }
  2494. this.ServeSuccessJSON(map[string]interface{}{
  2495. "editpiclinks":editpiclinks,
  2496. })
  2497. }
  2498. func (this *Microwebsite) AddMagicNavi() {
  2499. adminUserInfo := this.GetAdminUserInfo()
  2500. userOrgID := int64(adminUserInfo.CurrentOrgId)
  2501. fmt.Println("这个是",userOrgID)
  2502. dataBody := make(map[string]interface{}, 0)
  2503. err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
  2504. if err != nil {
  2505. utils.ErrorLog(err.Error())
  2506. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "参数错误")
  2507. return
  2508. }
  2509. linkid := int64(dataBody["linkid"].(float64))
  2510. fmt.Println("linkid是多少",linkid)
  2511. margtitle := dataBody["margtitle"].(string)
  2512. fmt.Println("导航标题",margtitle)
  2513. if len(margtitle) == 0 {
  2514. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "导航标题不能为空")
  2515. return
  2516. }
  2517. margImage := dataBody["margImage"].(string)
  2518. fmt.Println("导航图标",margImage)
  2519. if len(margtitle) == 0 {
  2520. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "导航图标不能为空")
  2521. return
  2522. }
  2523. jumpset := int64(dataBody["jumpset"].(float64))
  2524. fmt.Println("跳转设置",jumpset)
  2525. if len(margtitle) == 0 {
  2526. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "跳转设置不能为空")
  2527. return
  2528. }
  2529. marginaddress := dataBody["marginaddress"].(string)
  2530. fmt.Println("链接地址",marginaddress)
  2531. //if len(marginaddress) == 0 {
  2532. // this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "导航图标不能为空")
  2533. // return
  2534. //}
  2535. editmargin := models.SgjPatientEditmargin{
  2536. Margtitle: margtitle,
  2537. Margimage: margImage,
  2538. Jumpset: jumpset,
  2539. Marginaddress: marginaddress,
  2540. Status: 1,
  2541. Ctime: time.Now().Unix(),
  2542. UserOrgId: userOrgID,
  2543. ImgShow:1,
  2544. Modeid:0,
  2545. Linkid:linkid,
  2546. }
  2547. err = site_service.AddMagicNavi(&editmargin)
  2548. if err !=nil{
  2549. this.ServeFailJsonSend(enums.ErrorCodeDataException, "删除回复成功")
  2550. return
  2551. }
  2552. this.ServeSuccessJSON(map[string]interface{}{
  2553. "editmargin":editmargin,
  2554. })
  2555. }
  2556. func (this *Microwebsite) GetMagicImages() {
  2557. adminUserInfo := this.GetAdminUserInfo()
  2558. userOrgID := int64(adminUserInfo.CurrentOrgId)
  2559. editmargins, err := site_service.GetMagicImages(userOrgID)
  2560. fmt.Println("错误",err)
  2561. fmt.Println("editmargins",editmargins)
  2562. if err !=nil{
  2563. this.ServeFailJsonSend(enums.ErrorCodeDataException, "删除回复成功")
  2564. return
  2565. }
  2566. this.ServeSuccessJSON(map[string]interface{}{
  2567. "editmargins":editmargins,
  2568. })
  2569. }
  2570. func (this *Microwebsite) AddMarginChart() {
  2571. adminUserInfo := this.GetAdminUserInfo()
  2572. userOrgID := int64(adminUserInfo.CurrentOrgId)
  2573. fmt.Println(userOrgID)
  2574. dataBody := make(map[string]interface{}, 0)
  2575. err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
  2576. if err != nil {
  2577. utils.ErrorLog(err.Error())
  2578. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "参数错误")
  2579. return
  2580. }
  2581. title := dataBody["title"].(string)
  2582. fmt.Println("图片编辑",title)
  2583. if len(title) == 0 {
  2584. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "图片编辑不能为空")
  2585. return
  2586. }
  2587. sort := int64(dataBody["sort"].(float64))
  2588. fmt.Println("排序",sort)
  2589. if sort <= 0 {
  2590. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "图片编辑不能为空")
  2591. return
  2592. }
  2593. macimages := dataBody["marginImages"]
  2594. images := strings.Replace(strings.Trim(fmt.Sprint(macimages), "[]"), " ", ",", -1)
  2595. fmt.Println("images",images)
  2596. marginTitle := dataBody["margintTitle"]
  2597. fmt.Println("魔方导航标题",marginTitle)
  2598. margintitletwo := strings.Replace(strings.Trim(fmt.Sprint(marginTitle), "[]"), " ", ",", -1)
  2599. fmt.Println("margintitle",margintitletwo)
  2600. idsInters := dataBody["ids"].([]interface{})
  2601. fmt.Println("id集合是",idsInters)
  2602. if len(idsInters) == 0 {
  2603. if err != nil {
  2604. this.ServeFailJsonSend(enums.ErrorCodeDBDelete, "删除会员失败:(没有选择会员)")
  2605. return
  2606. }
  2607. }
  2608. ids := make([]int64, 0)
  2609. for _, idsInter := range idsInters {
  2610. id := int64(idsInter.(float64))
  2611. ids = append(ids, id)
  2612. }
  2613. model := models.SgjPatientModel{
  2614. Title: title,
  2615. Sort: sort,
  2616. UserOrgId: userOrgID,
  2617. Status: 1,
  2618. Ctime: time.Now().Unix(),
  2619. ModeType: 8,
  2620. }
  2621. site_service.AddPatientModel(&model)
  2622. fmt.Println("rotation是什么",model)
  2623. patientModel, err := site_service.QueryModel(userOrgID)
  2624. macnavigation := models.SgjPatientMacnavigation{
  2625. Title: title,
  2626. Sort: sort,
  2627. MacImages: images,
  2628. MacTitles:margintitletwo,
  2629. Modeid: patientModel.ID,
  2630. Status: 1,
  2631. Ctime: time.Now().Unix(),
  2632. UserOrgId: userOrgID,
  2633. }
  2634. err = site_service.AddMarginChart(&macnavigation)
  2635. editmargin := models.SgjPatientEditmargin{
  2636. Modeid: patientModel.ID,
  2637. }
  2638. err = site_service.UpdateEditMagin(userOrgID, ids, editmargin)
  2639. fmt.Println("错误是中秋",err)
  2640. if err !=nil{
  2641. this.ServeFailJsonSend(enums.ErrorCodeDataException, "删除回复成功")
  2642. return
  2643. }
  2644. this.ServeSuccessJSON(map[string]interface{}{
  2645. "macnavigation":macnavigation,
  2646. })
  2647. }
  2648. func (this *Microwebsite) DeleteRotations(){
  2649. adminUserInfo := this.GetAdminUserInfo()
  2650. userOrgID := int64(adminUserInfo.CurrentOrgId)
  2651. //fmt.Println("机构ID",userOrgID)
  2652. id, _ := this.GetInt64("id")
  2653. //fmt.Println("id是什么",id)
  2654. err := site_service.DeleteRotations(id, userOrgID)
  2655. if err !=nil{
  2656. this.ServeFailJsonSend(enums.ErrorCodeDataException, "删除图片失败")
  2657. return
  2658. }
  2659. edipiclink, total, err := site_service.GetCountImages(userOrgID)
  2660. fmt.Println("edipiclink",edipiclink)
  2661. if err !=nil{
  2662. this.ServeFailJsonSend(enums.ErrorCodeDataException, "删除回复成功")
  2663. return
  2664. }
  2665. this.ServeSuccessJSON(map[string]interface{}{
  2666. "total":total,
  2667. })
  2668. returnData := make(map[string]interface{}, 0)
  2669. returnData["msg"] = "ok"
  2670. this.ServeSuccessJSON(returnData)
  2671. return
  2672. }
  2673. func (this *Microwebsite) EditRotationImages() {
  2674. adminUserInfo := this.GetAdminUserInfo()
  2675. userOrgID := int64(adminUserInfo.CurrentOrgId)
  2676. fmt.Println(userOrgID)
  2677. id, _ := this.GetInt64("id")
  2678. //fmt.Println("id是什么",id)
  2679. editpiclink, err := site_service.UpdateRotationImages(userOrgID, id)
  2680. if err !=nil{
  2681. this.ServeFailJsonSend(enums.ErrorCodeDataException, "删除回复成功")
  2682. return
  2683. }
  2684. this.ServeSuccessJSON(map[string]interface{}{
  2685. "editpiclink":editpiclink,
  2686. })
  2687. }
  2688. func (this *Microwebsite) SaveRotationImages() {
  2689. adminUserInfo := this.GetAdminUserInfo()
  2690. userOrgID := int64(adminUserInfo.CurrentOrgId)
  2691. fmt.Println("",userOrgID)
  2692. id, _ := this.GetInt64("id")
  2693. fmt.Println("id是什么",id)
  2694. dataBody := make(map[string]interface{}, 0)
  2695. err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
  2696. if err != nil {
  2697. utils.ErrorLog(err.Error())
  2698. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "参数错误")
  2699. return
  2700. }
  2701. images := dataBody["images"].(string)
  2702. fmt.Println("图片编辑",images)
  2703. if len(images) == 0 {
  2704. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "图片编辑不能为空")
  2705. return
  2706. }
  2707. sort :=int64(dataBody["sort"].(float64))
  2708. fmt.Println("排序",sort)
  2709. if(sort<=0){
  2710. this.ServeFailJsonSend(enums.ErrorCodeParamWrong,"排序不能为空")
  2711. return
  2712. }
  2713. piclink :=int64(dataBody["piclink"].(float64))
  2714. fmt.Println("图片链接",piclink)
  2715. if (piclink <= 0) {
  2716. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "图片编辑不能为空")
  2717. return
  2718. }
  2719. linkaddress := dataBody["linkaddress"].(string)
  2720. fmt.Println("链接地址",linkaddress)
  2721. editpiclink := models.SgjPatientEditpiclink{
  2722. Images: images,
  2723. Sort: sort,
  2724. Piclink: piclink,
  2725. Linkaddress: linkaddress,
  2726. }
  2727. err = site_service.SaveRotationImages(id, userOrgID, editpiclink)
  2728. fmt.Println("错误",err)
  2729. if err !=nil{
  2730. this.ServeFailJsonSend(enums.ErrorCodeDataException, "删除回复成功")
  2731. return
  2732. }
  2733. this.ServeSuccessJSON(map[string]interface{}{
  2734. "editpiclink":editpiclink,
  2735. })
  2736. }
  2737. func (this *Microwebsite) EditNavigation() {
  2738. adminUserInfo := this.GetAdminUserInfo()
  2739. userOrgID := int64(adminUserInfo.CurrentOrgId)
  2740. fmt.Println("",userOrgID)
  2741. id, _ := this.GetInt64("id")
  2742. //fmt.Println("id是什么",id)
  2743. navigation, err := site_service.EditNavigation(userOrgID,id)
  2744. if err !=nil{
  2745. this.ServeFailJsonSend(enums.ErrorCodeDataException, "删除回复成功")
  2746. return
  2747. }
  2748. this.ServeSuccessJSON(map[string]interface{}{
  2749. "navigation":navigation,
  2750. })
  2751. }
  2752. func (this *Microwebsite) SaveNavigation() {
  2753. adminUserInfo := this.GetAdminUserInfo()
  2754. userOrgID := int64(adminUserInfo.CurrentOrgId)
  2755. fmt.Println("",userOrgID)
  2756. id, _ := this.GetInt64("id")
  2757. fmt.Println("id是多少呢",id)
  2758. dataBody := make(map[string]interface{}, 0)
  2759. err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
  2760. if err != nil {
  2761. utils.ErrorLog(err.Error())
  2762. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "参数错误")
  2763. return
  2764. }
  2765. navtitle := dataBody["navtitle"].(string)
  2766. fmt.Println("导航标题",navtitle)
  2767. if len(navtitle) == 0 {
  2768. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "图片编辑不能为空")
  2769. return
  2770. }
  2771. navimages := dataBody["navimages"].(string)
  2772. fmt.Println("导航图标选中",navimages)
  2773. if len(navimages) == 0 {
  2774. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "图片编辑不能为空")
  2775. return
  2776. }
  2777. noCheckImages := dataBody["nonavimages"].(string)
  2778. fmt.Println("导航图标未选中",noCheckImages)
  2779. if len(navimages) == 0 {
  2780. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "图片编辑不能为空")
  2781. return
  2782. }
  2783. jumpset := int64(dataBody["jumpset"].(float64))
  2784. fmt.Println("跳转设置",jumpset)
  2785. if jumpset <= 0 {
  2786. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "图片编辑不能为空")
  2787. return
  2788. }
  2789. navaddress := dataBody["navaddress"].(string)
  2790. fmt.Println("链接地址",navaddress)
  2791. linkid := int64(dataBody["linkid"].(float64))
  2792. fmt.Println("linkid是多少",linkid)
  2793. linktype := int64(dataBody["linktype"].(float64))
  2794. navigation := models.SgjPatientNavigation{
  2795. Navtitle: navtitle,
  2796. Navimages: navimages,
  2797. Nonavimages:noCheckImages,
  2798. Jumpset: jumpset,
  2799. Navaddress: navaddress,
  2800. Linkid:linkid,
  2801. Linktype:linktype,
  2802. }
  2803. err = site_service.UpdateNavtion(id, userOrgID, navigation)
  2804. navigations, err := site_service.GetDefaultNavigation(userOrgID)
  2805. fmt.Println("err是什么",err)
  2806. if err !=nil{
  2807. this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
  2808. return
  2809. }
  2810. this.ServeSuccessJSON(map[string]interface{}{
  2811. "navigation":navigation,
  2812. "navigations":navigations,
  2813. })
  2814. }
  2815. func (this *Microwebsite) AddHospital() {
  2816. adminUserInfo := this.GetAdminUserInfo()
  2817. userOrgID := int64(adminUserInfo.CurrentOrgId)
  2818. fmt.Println("机构ID",userOrgID)
  2819. dataBody := make(map[string]interface{}, 0)
  2820. err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
  2821. if err != nil {
  2822. utils.ErrorLog(err.Error())
  2823. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "参数错误")
  2824. return
  2825. }
  2826. title := dataBody["title"].(string)
  2827. fmt.Println("导航标题",title)
  2828. if len(title) == 0 {
  2829. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "标题不能为空")
  2830. return
  2831. }
  2832. sort := int64(dataBody["sort"].(float64))
  2833. if sort<=0{
  2834. this.ServeFailJsonSend(enums.ErrorCodeParamWrong,"排序不能为空")
  2835. return
  2836. }
  2837. fmt.Println("排序",sort)
  2838. address :=dataBody["address"].(string)
  2839. fmt.Println("医院地址",address)
  2840. if len(address) == 0 {
  2841. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "标题不能为空")
  2842. return
  2843. }
  2844. patientOrdmodel := models.SgjPatientOrdmodel{
  2845. Title: title,
  2846. Sort: sort,
  2847. UserOrgId: userOrgID,
  2848. Status: 1,
  2849. Ctime: time.Now().Unix(),
  2850. ModeType: 2,
  2851. }
  2852. site_service.AddOrdModel(&patientOrdmodel)
  2853. ordmodel, err := site_service.QueryOrdeModelByID(userOrgID)
  2854. hosaddress := models.SgjPatientHosaddress{
  2855. Title: title,
  2856. Sort: sort,
  2857. Address: address,
  2858. UserOrgId: userOrgID,
  2859. Status: 1,
  2860. Ctime: time.Now().Unix(),
  2861. Modeid: ordmodel.ID,
  2862. }
  2863. err = site_service.AddHosAddress(&hosaddress)
  2864. if err !=nil{
  2865. this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
  2866. return
  2867. }
  2868. this.ServeSuccessJSON(map[string]interface{}{
  2869. "hosaddress":hosaddress,
  2870. })
  2871. }
  2872. func (this *Microwebsite) DeleteImages() {
  2873. adminUserInfo := this.GetAdminUserInfo()
  2874. userOrgID := int64(adminUserInfo.CurrentOrgId)
  2875. fmt.Println("机构ID",userOrgID)
  2876. id, _:= this.GetInt64("id")
  2877. fmt.Println("id是神么",id)
  2878. err := site_service.DeleteImages(id, userOrgID)
  2879. if err !=nil{
  2880. this.ServeFailJsonSend(enums.ErrorCodeDataException, "删除回复成功")
  2881. return
  2882. }
  2883. conrotation, total, err := site_service.GetTotalCount(userOrgID)
  2884. fmt.Println("conrotation",conrotation)
  2885. if err !=nil{
  2886. this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
  2887. return
  2888. }
  2889. this.ServeSuccessJSON(map[string]interface{}{
  2890. "total":total,
  2891. })
  2892. returnData := make(map[string]interface{}, 0)
  2893. returnData["msg"] = "ok"
  2894. this.ServeSuccessJSON(returnData)
  2895. return
  2896. }
  2897. func (this *Microwebsite) DeleteSingleImages() {
  2898. adminUserInfo := this.GetAdminUserInfo()
  2899. userOrgID := adminUserInfo.CurrentOrgId
  2900. id, _:= this.GetInt64("id")
  2901. modeid, _ := this.GetInt64("modeid")
  2902. fmt.Println("机构id",userOrgID)
  2903. fmt.Println("编辑录播id",id)
  2904. fmt.Println("模块id",modeid)
  2905. err := site_service.DeleteSingleImages(id, userOrgID)
  2906. if err !=nil{
  2907. this.ServeFailJsonSend(enums.ErrorCodeDataException, "删除回复成功")
  2908. return
  2909. }
  2910. edipiclink, total, err := site_service.GetDeleteImages(userOrgID,modeid)
  2911. fmt.Println("total是什么",total)
  2912. fmt.Println(edipiclink)
  2913. if err !=nil{
  2914. this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
  2915. return
  2916. }
  2917. this.ServeSuccessJSON(map[string]interface{}{
  2918. "total":total,
  2919. })
  2920. returnData := make(map[string]interface{}, 0)
  2921. returnData["msg"] = "ok"
  2922. this.ServeSuccessJSON(returnData)
  2923. return
  2924. }
  2925. func (this *Microwebsite) AddActive() {
  2926. adminUserInfo := this.GetAdminUserInfo()
  2927. userOrgID := int64(adminUserInfo.CurrentOrgId)
  2928. fmt.Println("机构ID",userOrgID)
  2929. dataBody := make(map[string]interface{}, 0)
  2930. err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
  2931. if err != nil {
  2932. utils.ErrorLog(err.Error())
  2933. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "参数错误")
  2934. return
  2935. }
  2936. title := dataBody["title"].(string)
  2937. fmt.Println("活动标题",title)
  2938. if len(title) == 0 {
  2939. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "标题不能为空")
  2940. return
  2941. }
  2942. sort := int64(dataBody["sort"].(float64))
  2943. fmt.Println("排序",sort)
  2944. number := int64(dataBody["number"].(float64))
  2945. fmt.Println("条数",number)
  2946. model := models.SgjPatientModel{
  2947. Title: title,
  2948. Sort: sort,
  2949. Ctime: time.Now().Unix(),
  2950. UserOrgId: userOrgID,
  2951. ModeType: 7,
  2952. Status: 1,
  2953. }
  2954. site_service.AddPatientModel(&model)
  2955. patientModel, err := site_service.QueryModel(userOrgID)
  2956. addactivity := models.SgjPatientAddactivity{
  2957. Title: title,
  2958. Sort: sort,
  2959. Number: number,
  2960. Ctime: time.Now().Unix(),
  2961. UserOrgId: userOrgID,
  2962. Modeid: patientModel.ID,
  2963. Status: 1,
  2964. }
  2965. err = site_service.AddActivity(&addactivity)
  2966. if err !=nil{
  2967. this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
  2968. return
  2969. }
  2970. this.ServeSuccessJSON(map[string]interface{}{
  2971. "addactivity":addactivity,
  2972. })
  2973. }
  2974. func (this *Microwebsite) GetActivity() {
  2975. adminUserInfo := this.GetAdminUserInfo()
  2976. userOrgID := int64(adminUserInfo.CurrentOrgId)
  2977. fmt.Println("机构ID",userOrgID)
  2978. id, _ := this.GetInt64("id")
  2979. fmt.Println("id是多少",id)
  2980. addactivity, err := site_service.QueryActivity(id, userOrgID)
  2981. if err !=nil{
  2982. this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
  2983. return
  2984. }
  2985. this.ServeSuccessJSON(map[string]interface{}{
  2986. "addactivity":addactivity,
  2987. })
  2988. }
  2989. func (this *Microwebsite) Saveactivit() {
  2990. adminUserInfo := this.GetAdminUserInfo()
  2991. userOrgID := int64(adminUserInfo.CurrentOrgId)
  2992. fmt.Println("机构ID",userOrgID)
  2993. id, _ := this.GetInt64("id")
  2994. fmt.Println("id是多少",id)
  2995. dataBody := make(map[string]interface{}, 0)
  2996. err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
  2997. if err != nil {
  2998. utils.ErrorLog(err.Error())
  2999. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "参数错误")
  3000. return
  3001. }
  3002. title := dataBody["title"].(string)
  3003. fmt.Println("活动标题",title)
  3004. if len(title) == 0 {
  3005. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "标题不能为空")
  3006. return
  3007. }
  3008. sort := int64(dataBody["sort"].(float64))
  3009. fmt.Println("排序",sort)
  3010. number := int64(dataBody["number"].(float64))
  3011. fmt.Println("条数",number)
  3012. modeid := int64(dataBody["modeid"].(float64))
  3013. fmt.Println("模块ID",modeid)
  3014. addactivity := models.SgjPatientAddactivity{
  3015. Title: title,
  3016. Sort: sort,
  3017. Number: number,
  3018. }
  3019. model := models.SgjPatientModel{
  3020. Title: title,
  3021. Sort: sort,
  3022. }
  3023. err = site_service.UpdateModel(modeid, userOrgID, model)
  3024. fmt.Println("错误",err)
  3025. err = site_service.UpdateActivit(id, userOrgID, addactivity)
  3026. fmt.Println("错误",err)
  3027. if err !=nil{
  3028. this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
  3029. return
  3030. }
  3031. this.ServeSuccessJSON(map[string]interface{}{
  3032. "addactivity":addactivity,
  3033. })
  3034. }
  3035. func (this *Microwebsite) DeleteMargin() {
  3036. adminUserInfo := this.GetAdminUserInfo()
  3037. userOrgID := int64(adminUserInfo.CurrentOrgId)
  3038. fmt.Println("机构ID",userOrgID)
  3039. id, _ := this.GetInt64("id")
  3040. fmt.Println("id是什么",id)
  3041. err := site_service.DeleteMargin(id, userOrgID)
  3042. if err !=nil{
  3043. this.ServeFailJsonSend(enums.ErrorCodeDataException, "删除回复成功")
  3044. return
  3045. }
  3046. returnData := make(map[string]interface{}, 0)
  3047. returnData["msg"] = "ok"
  3048. this.ServeSuccessJSON(returnData)
  3049. return
  3050. }
  3051. func (this *Microwebsite) GetRotationImages() {
  3052. adminUserInfo := this.GetAdminUserInfo()
  3053. userOrgID := int64(adminUserInfo.CurrentOrgId)
  3054. fmt.Println("机构ID",userOrgID)
  3055. id, _ := this.GetInt64("id")
  3056. fmt.Println("id是什么",id)
  3057. //site_service.GetEditRotationImages(id)
  3058. }
  3059. func (this *Microwebsite) GetRotationDetail() {
  3060. adminUserInfo := this.GetAdminUserInfo()
  3061. userOrgID := int64(adminUserInfo.CurrentOrgId)
  3062. //fmt.Println("机构ID",userOrgID)
  3063. id, _ := this.GetInt64("id")
  3064. fmt.Println("海珍id是什么",id)
  3065. oldrotation, err := site_service.GetEditRotationImages(id, userOrgID)
  3066. conrotation, err := site_service.GetEditConrotion(id, userOrgID)
  3067. fmt.Println("错误",err)
  3068. fmt.Println(oldrotation)
  3069. if err !=nil{
  3070. this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
  3071. return
  3072. }
  3073. this.ServeSuccessJSON(map[string]interface{}{
  3074. "oldrotation":oldrotation,
  3075. "conrotation":conrotation,
  3076. })
  3077. }
  3078. func (this *Microwebsite) EditVisibleById() {
  3079. adminUserInfo := this.GetAdminUserInfo()
  3080. userOrgID := int64(adminUserInfo.CurrentOrgId)
  3081. fmt.Println("机构ID",userOrgID)
  3082. id, _ := this.GetInt64("id")
  3083. conrotation, err := site_service.EditVisibleById(id, userOrgID)
  3084. if err !=nil{
  3085. this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
  3086. return
  3087. }
  3088. this.ServeSuccessJSON(map[string]interface{}{
  3089. "conrotation":conrotation,
  3090. })
  3091. }
  3092. func (this *Microwebsite) SaveEditpic() {
  3093. adminUserInfo := this.GetAdminUserInfo()
  3094. userOrgID := int64(adminUserInfo.CurrentOrgId)
  3095. fmt.Println("机构ID",userOrgID)
  3096. id, _ := this.GetInt64("id")
  3097. fmt.Println("海珍id是什么",id)
  3098. dataBody := make(map[string]interface{}, 0)
  3099. err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
  3100. if err != nil {
  3101. utils.ErrorLog(err.Error())
  3102. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "参数错误")
  3103. return
  3104. }
  3105. images := dataBody["images"].(string)
  3106. fmt.Println("图片",images)
  3107. if len(images) == 0 {
  3108. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "标题不能为空")
  3109. return
  3110. }
  3111. sort := int64(dataBody["sort"].(float64))
  3112. fmt.Println("排序",sort)
  3113. piclink := int64(dataBody["piclink"].(float64))
  3114. fmt.Println("图片链接",piclink)
  3115. linkaddress := dataBody["linkaddress"].(string)
  3116. fmt.Println("链接地址",linkaddress)
  3117. modeid := int64(dataBody["modeid"].(float64))
  3118. fmt.Println("天梦中",modeid)
  3119. conrotation := models.SgjPatientConrotation{
  3120. Images: images,
  3121. Sort: sort,
  3122. Piclink: piclink,
  3123. Linkaddress: linkaddress,
  3124. }
  3125. err = site_service.UpdateEditpic(id, userOrgID,conrotation)
  3126. fmt.Println("err错误",err)
  3127. if err !=nil{
  3128. this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
  3129. return
  3130. }
  3131. conrotations, err := site_service.QueryConRotation(modeid, userOrgID)
  3132. fmt.Println("错误小小马",err)
  3133. fmt.Println(conrotations)
  3134. this.ServeSuccessJSON(map[string]interface{}{
  3135. "conrotation":conrotation,
  3136. "conrotations":conrotations,
  3137. })
  3138. }
  3139. func (this *Microwebsite) AddEditpic() {
  3140. adminUserInfo := this.GetAdminUserInfo()
  3141. userOrgID := int64(adminUserInfo.CurrentOrgId)
  3142. fmt.Println("机构ID",userOrgID)
  3143. dataBody := make(map[string]interface{}, 0)
  3144. err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
  3145. if err != nil {
  3146. utils.ErrorLog(err.Error())
  3147. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "参数错误")
  3148. return
  3149. }
  3150. images := dataBody["images"].(string)
  3151. fmt.Println("图片",images)
  3152. if len(images) == 0 {
  3153. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "标题不能为空")
  3154. return
  3155. }
  3156. sort := int64(dataBody["sort"].(float64))
  3157. fmt.Println("排序",sort)
  3158. piclink := int64(dataBody["piclink"].(float64))
  3159. fmt.Println("图片链接",piclink)
  3160. linkaddress := dataBody["linkaddress"].(string)
  3161. fmt.Println("链接地址",linkaddress)
  3162. id, _ := this.GetInt64("id")
  3163. fmt.Println("下孟子id",id)
  3164. oldrotation, err := site_service.QueryOldrotion(id, userOrgID)
  3165. fmt.Println("oldrotation",oldrotation)
  3166. conrotation := models.SgjPatientConrotation{
  3167. Images: images,
  3168. Sort: sort,
  3169. Piclink: piclink,
  3170. Linkaddress: linkaddress,
  3171. Status: 1,
  3172. Modeid: id,
  3173. UserOrgId: userOrgID,
  3174. Ctime:time.Now().Unix(),
  3175. ImgShow:1,
  3176. }
  3177. err = site_service.AddEditpic(&conrotation)
  3178. if err !=nil{
  3179. this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
  3180. return
  3181. }
  3182. conrotations, erros := site_service.QueryConRotation(id, userOrgID)
  3183. fmt.Println("门前错误",erros)
  3184. fmt.Println("conrotations是什么",conrotations)
  3185. this.ServeSuccessJSON(map[string]interface{}{
  3186. "conrotation":conrotation,
  3187. "conrotations":conrotations,
  3188. })
  3189. }
  3190. func (this *Microwebsite) AddEdialogVisible() {
  3191. adminUserInfo := this.GetAdminUserInfo()
  3192. userOrgID := int64(adminUserInfo.CurrentOrgId)
  3193. fmt.Println("机构ID",userOrgID)
  3194. id, _ := this.GetInt64("id")
  3195. fmt.Println("这个ID是",id)
  3196. dataBody := make(map[string]interface{}, 0)
  3197. err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
  3198. if err != nil {
  3199. utils.ErrorLog(err.Error())
  3200. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "参数错误")
  3201. return
  3202. }
  3203. title := dataBody["title"].(string)
  3204. fmt.Println("标题",title)
  3205. sort := int64(dataBody["sort"].(float64))
  3206. fmt.Println("排序",sort)
  3207. rotationImages := dataBody["rotationImages"]
  3208. images := strings.Replace(strings.Trim(fmt.Sprint(rotationImages), "[]"), " ", ",", -1)
  3209. fmt.Println("图片",images)
  3210. oldrotation := models.SgjPatientOldrotation{
  3211. Title: title,
  3212. Sort: sort,
  3213. RotationImages: images,
  3214. }
  3215. err = site_service.UpdateConrotaionById(id, userOrgID,oldrotation)
  3216. fmt.Println(err)
  3217. fmt.Println("马文强错错误是什么",err)
  3218. ordmodel := models.SgjPatientOrdmodel{
  3219. Title: title,
  3220. Sort: sort,
  3221. }
  3222. err = site_service.UpdateOrdeModel(id, userOrgID, ordmodel)
  3223. if err !=nil{
  3224. this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
  3225. return
  3226. }
  3227. this.ServeSuccessJSON(map[string]interface{}{
  3228. "oldrotation":oldrotation,
  3229. "ordmodel":ordmodel,
  3230. })
  3231. }
  3232. func (this *Microwebsite) GetEditRotationimages() {
  3233. adminUserInfo := this.GetAdminUserInfo()
  3234. userOrgID := int64(adminUserInfo.CurrentOrgId)
  3235. fmt.Println("编辑轮播图机构id",userOrgID)
  3236. id, _ := this.GetInt64("id")
  3237. fmt.Println("id是多少?",id)
  3238. model, err := site_service.GetPatientModel(id, userOrgID)
  3239. fmt.Println("patientEditpiclink",model)
  3240. fmt.Println("错误",err)
  3241. editpiclink, err := site_service.QueryEditpiclink(id, userOrgID)
  3242. fmt.Println("错误是多少",err)
  3243. fmt.Println("返回数据",editpiclink)
  3244. editpiclinks, total, err := site_service.QueryEditpiclinkCount(id, userOrgID)
  3245. fmt.Println(editpiclinks)
  3246. if err !=nil{
  3247. this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
  3248. return
  3249. }
  3250. this.ServeSuccessJSON(map[string]interface{}{
  3251. "model":model,
  3252. "editpiclink":editpiclink,
  3253. "total":total,
  3254. })
  3255. }
  3256. func (this *Microwebsite) GetEditSingleVisible() {
  3257. adminUserInfo := this.GetAdminUserInfo()
  3258. userOrgID := int64(adminUserInfo.CurrentOrgId)
  3259. fmt.Println("机构id",userOrgID)
  3260. id, _ := this.GetInt64("id")
  3261. fmt.Println("id是多少?",id)
  3262. editpiclink, err := site_service.GetEditSingleVisible(id, userOrgID)
  3263. fmt.Println("错误",err)
  3264. fmt.Println("editpiclink",editpiclink)
  3265. if err !=nil{
  3266. this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
  3267. return
  3268. }
  3269. this.ServeSuccessJSON(map[string]interface{}{
  3270. "editpiclink":editpiclink,
  3271. })
  3272. }
  3273. func (this *Microwebsite) UpdateSingleForm() {
  3274. adminUserInfo := this.GetAdminUserInfo()
  3275. userOrgID := int64(adminUserInfo.CurrentOrgId)
  3276. fmt.Println("机构id",userOrgID)
  3277. id, _ := this.GetInt64("id")
  3278. fmt.Println("id是多少",id)
  3279. dataBody := make(map[string]interface{}, 0)
  3280. err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
  3281. if err != nil {
  3282. utils.ErrorLog(err.Error())
  3283. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "参数错误")
  3284. return
  3285. }
  3286. images := dataBody["images"].(string)
  3287. fmt.Println("图片",images)
  3288. sort := int64(dataBody["sort"].(float64))
  3289. fmt.Println("排序",sort)
  3290. piclink := int64(dataBody["piclink"].(float64))
  3291. fmt.Println("图片链接",piclink)
  3292. linkaddress := dataBody["linkaddress"].(string)
  3293. fmt.Println("链接地址",linkaddress)
  3294. modelid := int64(dataBody["modeid"].(float64))
  3295. linkid := int64(dataBody["linkid"].(float64))
  3296. editpiclink := models.SgjPatientEditpiclink{
  3297. Images: images,
  3298. Sort: sort,
  3299. Piclink: piclink,
  3300. Linkaddress: linkaddress,
  3301. Linkid:linkid,
  3302. }
  3303. err = site_service.UpdateEditPatPicLink(id, userOrgID, editpiclink)
  3304. fmt.Println("第一个错误是设么",err)
  3305. patientEditpiclink, err := site_service.GetQueryEditpiclink(modelid, userOrgID)
  3306. fmt.Println("错误是多",err)
  3307. fmt.Println("pateientEditpiclink是多少",patientEditpiclink)
  3308. if err !=nil{
  3309. this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
  3310. return
  3311. }
  3312. this.ServeSuccessJSON(map[string]interface{}{
  3313. "editpiclink":editpiclink,
  3314. "patientEditpiclink":patientEditpiclink,
  3315. })
  3316. }
  3317. func (this *Microwebsite) AddEditPicForm() {
  3318. adminUserInfo := this.GetAdminUserInfo()
  3319. userOrgID := int64(adminUserInfo.CurrentOrgId)
  3320. fmt.Println("机构id",userOrgID)
  3321. id, _ := this.GetInt64("id")
  3322. fmt.Println("这个广告id是多少?",id)
  3323. dataBody := make(map[string]interface{}, 0)
  3324. err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
  3325. if err != nil {
  3326. utils.ErrorLog(err.Error())
  3327. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "参数错误")
  3328. return
  3329. }
  3330. images := dataBody["images"].(string)
  3331. fmt.Println("图片",images)
  3332. sort := int64(dataBody["sort"].(float64))
  3333. fmt.Println("排序",sort)
  3334. piclink := int64(dataBody["piclink"].(float64))
  3335. fmt.Println("图片链接",piclink)
  3336. linkaddress := dataBody["linkaddress"].(string)
  3337. fmt.Println("链接地址",linkaddress)
  3338. linkid := int64(dataBody["linkid"].(float64))
  3339. //patientRotation, err := site_service.GetPatientRotationById(id, userOrgID)
  3340. //fmt.Println("错误",err)
  3341. //fmt.Println("rotation数据",patientRotation)
  3342. editpiclink := models.SgjPatientEditpiclink{
  3343. Images: images,
  3344. Sort: sort,
  3345. Piclink: piclink,
  3346. Linkaddress: linkaddress,
  3347. UserOrgId: userOrgID,
  3348. Ctime: time.Now().Unix(),
  3349. Status: 1,
  3350. Modeid: id,
  3351. ImgShow:1,
  3352. Linkid:linkid,
  3353. }
  3354. err = site_service.AddImageslink(&editpiclink)
  3355. editpiclinks, err := site_service.GetPicImages(userOrgID, id)
  3356. fmt.Println("oooooooooooooooooooooooobbbbbbbbbbbbbb")
  3357. fmt.Println("err",err)
  3358. edipiclink, total, err := site_service.GetCountPicImages(userOrgID, id)
  3359. fmt.Println(edipiclink)
  3360. if err !=nil{
  3361. this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
  3362. return
  3363. }
  3364. this.ServeSuccessJSON(map[string]interface{}{
  3365. "editpiclinks":editpiclinks,
  3366. "editpiclink":editpiclink,
  3367. "total":total,
  3368. })
  3369. }
  3370. func (this *Microwebsite) AddRotationVisible() {
  3371. adminUserInfo := this.GetAdminUserInfo()
  3372. userOrgID := int64(adminUserInfo.CurrentOrgId)
  3373. fmt.Println("机构id",userOrgID)
  3374. id, _ := this.GetInt64("id")
  3375. fmt.Println("编辑轮播id是多少",id)
  3376. dataBody := make(map[string]interface{}, 0)
  3377. err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
  3378. if err != nil {
  3379. utils.ErrorLog(err.Error())
  3380. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "参数错误")
  3381. return
  3382. }
  3383. title := dataBody["title"].(string)
  3384. fmt.Println("编辑轮播标题",title)
  3385. sort:= int64(dataBody["sort"].(float64))
  3386. fmt.Println("编辑轮播排序",sort)
  3387. images := dataBody["images"]
  3388. fmt.Println("编辑轮播图片",images)
  3389. image:= strings.Replace(strings.Trim(fmt.Sprint(images), "[]"), " ", ",", -1)
  3390. //fmt.Println(image)
  3391. patientRotation := models.SgjPatientRotation{
  3392. Title: title,
  3393. Sort: sort,
  3394. RotationImages: image,
  3395. }
  3396. //err = site_service.UpdateRotationByid(id, userOrgID, patientRotation)
  3397. //fmt.Println("这个错误是设么",err)
  3398. two := site_service.UpdateEditPicLinkTwo(id, userOrgID)
  3399. fmt.Println("two",two)
  3400. model := models.SgjPatientModel{
  3401. Title: title,
  3402. Sort: sort,
  3403. }
  3404. //rotation, err := site_service.GetPatientRotationById(id, userOrgID)
  3405. //fmt.Println("错误",err)
  3406. err = site_service.UpdateModelById(id, userOrgID, model)
  3407. fmt.Println("这个错误",err)
  3408. if err !=nil{
  3409. this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
  3410. return
  3411. }
  3412. this.ServeSuccessJSON(map[string]interface{}{
  3413. "patientRotation":patientRotation,
  3414. "model":model,
  3415. })
  3416. }
  3417. func (this *Microwebsite) GetEditImagesDetail() {
  3418. adminUserInfo := this.GetAdminUserInfo()
  3419. userOrgID := int64(adminUserInfo.CurrentOrgId)
  3420. fmt.Println("机构id",userOrgID)
  3421. id, _ := this.GetInt64("id")
  3422. fmt.Println("海珍id是多少",id)
  3423. editmargin, err := site_service.QuerEditMarginById(id, userOrgID)
  3424. fmt.Println("错误",err)
  3425. fmt.Println("editmargin",editmargin)
  3426. if err !=nil{
  3427. this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
  3428. return
  3429. }
  3430. this.ServeSuccessJSON(map[string]interface{}{
  3431. "editmargin":editmargin,
  3432. })
  3433. }
  3434. func (this *Microwebsite) UpdateEditMacgin() {
  3435. adminUserInfo := this.GetAdminUserInfo()
  3436. userOrgID := int64(adminUserInfo.CurrentOrgId)
  3437. fmt.Println("机构id",userOrgID)
  3438. id, _ := this.GetInt64("id")
  3439. fmt.Println("id是",id)
  3440. dataBody := make(map[string]interface{}, 0)
  3441. err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
  3442. if err != nil {
  3443. utils.ErrorLog(err.Error())
  3444. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "参数错误")
  3445. return
  3446. }
  3447. margtitle := dataBody["margtitle"].(string)
  3448. fmt.Println("导航标题",margtitle)
  3449. margimage := dataBody["margimage"].(string)
  3450. fmt.Println("导航图标",margimage)
  3451. jumpset := int64(dataBody["jumpset"].(float64))
  3452. fmt.Println("跳转设置",jumpset)
  3453. marginaddress := dataBody["marginaddress"].(string)
  3454. fmt.Println("地址",marginaddress)
  3455. editmargin := models.SgjPatientEditmargin{
  3456. Margtitle: margtitle,
  3457. Margimage: margimage,
  3458. Jumpset: jumpset,
  3459. Marginaddress: marginaddress,
  3460. }
  3461. err = site_service.UpdateMarginById(id, userOrgID, editmargin)
  3462. fmt.Println("错误",err)
  3463. if err !=nil{
  3464. this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
  3465. return
  3466. }
  3467. this.ServeSuccessJSON(map[string]interface{}{
  3468. "editmargin":editmargin,
  3469. })
  3470. }
  3471. func (this *Microwebsite) GetActivities() {
  3472. adminUserInfo := this.GetAdminUserInfo()
  3473. userOrgID := int64(adminUserInfo.CurrentOrgId)
  3474. //fmt.Println("我爱你中国")
  3475. //fmt.Println("机构id",userOrgID)
  3476. addactivity, err := site_service.GetActivitiesById(userOrgID)
  3477. //fmt.Println("错误",err)
  3478. //fmt.Println("活动限制",addactivity.Number)
  3479. activity, err := site_service.GetAllActivities(userOrgID, addactivity.Number)
  3480. //fmt.Println("错误",err)
  3481. //fmt.Println("火气大",activity)
  3482. if err !=nil{
  3483. this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
  3484. return
  3485. }
  3486. this.ServeSuccessJSON(map[string]interface{}{
  3487. "activity":activity,
  3488. })
  3489. }
  3490. func (this *Microwebsite) GetArticleType() {
  3491. adminUserInfo := this.GetAdminUserInfo()
  3492. userOrgID := int64(adminUserInfo.CurrentOrgId)
  3493. category, err := site_service.GetArticleType(userOrgID)
  3494. fmt.Println("错误",err)
  3495. fmt.Println("文章分类",category)
  3496. if err !=nil{
  3497. this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
  3498. return
  3499. }
  3500. this.ServeSuccessJSON(map[string]interface{}{
  3501. "category":category,
  3502. })
  3503. }
  3504. func (this *Microwebsite) AddArticelist() {
  3505. adminUserInfo := this.GetAdminUserInfo()
  3506. userOrgID := int64(adminUserInfo.CurrentOrgId)
  3507. fmt.Println("机构id",userOrgID)
  3508. dataBody := make(map[string]interface{}, 0)
  3509. err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
  3510. if err != nil {
  3511. utils.ErrorLog(err.Error())
  3512. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "参数错误")
  3513. return
  3514. }
  3515. title := dataBody["title"].(string)
  3516. fmt.Println("标题",title)
  3517. if len(title)==0 {
  3518. title = "暂无数据"
  3519. }
  3520. //category := int64(dataBody["category"].(float64))
  3521. //fmt.Println("文章分类",category)
  3522. //categoryone := int64(dataBody["categoryone"].(float64))
  3523. //fmt.Println("文章分类2",categoryone)
  3524. number := int64(dataBody["number"].(float64))
  3525. fmt.Println("展示数据",number)
  3526. sort := int64(dataBody["sort"].(float64))
  3527. fmt.Println("排序",sort)
  3528. model := models.SgjPatientModel{
  3529. Title: title,
  3530. Sort: sort,
  3531. UserOrgId: userOrgID,
  3532. Status: 1,
  3533. Ctime: time.Now().Unix(),
  3534. ModeType:6,
  3535. }
  3536. site_service.AddPatientModel(&model)
  3537. patientModel, err := site_service.QueryModel(userOrgID)
  3538. articlelist := models.SgjPatientArticlelist{
  3539. Title: title,
  3540. Sort: sort,
  3541. UserOrgId: userOrgID,
  3542. Status: 1,
  3543. Ctime: time.Now().Unix(),
  3544. Number: number,
  3545. Modeid: patientModel.ID,
  3546. }
  3547. err = site_service.AddActiclelist(&articlelist)
  3548. if err !=nil{
  3549. this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
  3550. return
  3551. }
  3552. this.ServeSuccessJSON(map[string]interface{}{
  3553. "articlelist":articlelist,
  3554. })
  3555. }
  3556. func (this *Microwebsite) GetArticlelist() {
  3557. adminUserInfo := this.GetAdminUserInfo()
  3558. userOrgID := int64(adminUserInfo.CurrentOrgId)
  3559. fmt.Println("文章机构id",userOrgID)
  3560. articlelist, err := site_service.GetArticlelist(userOrgID)
  3561. fmt.Println("articlelist",articlelist)
  3562. fmt.Println("错误",err)
  3563. fmt.Println(articlelist.Number)
  3564. articlelists, err := site_service.GetAllArticles(userOrgID, articlelist.Number)
  3565. fmt.Println("文章列表",articlelists)
  3566. fmt.Println("错误",err)
  3567. if err !=nil{
  3568. this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
  3569. return
  3570. }
  3571. this.ServeSuccessJSON(map[string]interface{}{
  3572. "articlelists":articlelists,
  3573. })
  3574. }
  3575. func (this *Microwebsite) EditGetArticlistDetail() {
  3576. adminUserInfo := this.GetAdminUserInfo()
  3577. userOrgID := int64(adminUserInfo.CurrentOrgId)
  3578. fmt.Println("机构id",userOrgID)
  3579. id, _ := this.GetInt64("id")
  3580. fmt.Println("id是多少?",id)
  3581. articlelist, err := site_service.GetArticlelistById(id, userOrgID)
  3582. if err !=nil{
  3583. this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
  3584. return
  3585. }
  3586. this.ServeSuccessJSON(map[string]interface{}{
  3587. "articlelist":articlelist,
  3588. })
  3589. }
  3590. func (this *Microwebsite) SaveArticeDetail() {
  3591. adminUserInfo := this.GetAdminUserInfo()
  3592. userOrgID := int64(adminUserInfo.CurrentOrgId)
  3593. fmt.Println("机构id",userOrgID)
  3594. id, _ := this.GetInt64("id")
  3595. fmt.Println("获取id是多少?",id)
  3596. dataBody := make(map[string]interface{}, 0)
  3597. err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
  3598. if err != nil {
  3599. utils.ErrorLog(err.Error())
  3600. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "参数错误")
  3601. return
  3602. }
  3603. title := dataBody["title"].(string)
  3604. fmt.Println("活动标题",title)
  3605. if len(title) == 0 {
  3606. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "标题不能为空")
  3607. return
  3608. }
  3609. sort := int64(dataBody["sort"].(float64))
  3610. fmt.Println("排序",sort)
  3611. number := int64(dataBody["number"].(float64))
  3612. fmt.Println("条数",number)
  3613. modeid := int64(dataBody["modeid"].(float64))
  3614. fmt.Println("模块ID",modeid)
  3615. model := models.SgjPatientModel{
  3616. Title: title,
  3617. Sort: sort,
  3618. }
  3619. err = site_service.UpdateModel(modeid, userOrgID, model)
  3620. fmt.Println("错误",err)
  3621. articlelist := models.SgjPatientArticlelist{
  3622. Title: title,
  3623. Sort: sort,
  3624. Number: number,
  3625. }
  3626. err = site_service.UpdateArticeDetail(id, userOrgID, articlelist)
  3627. fmt.Println("错误",err)
  3628. if err !=nil{
  3629. this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
  3630. return
  3631. }
  3632. this.ServeSuccessJSON(map[string]interface{}{
  3633. "articlelist":articlelist,
  3634. "model":model,
  3635. })
  3636. }
  3637. func(this *Microwebsite) GetMacImages() {
  3638. adminUserInfo := this.GetAdminUserInfo()
  3639. userOrgID := adminUserInfo.CurrentOrgId
  3640. id, _:= this.GetInt64("id")
  3641. fmt.Println("机构id",userOrgID)
  3642. fmt.Println("导航图标",id)
  3643. model, err := site_service.GetModelById(id, userOrgID)
  3644. fmt.Println("错误是设么",err)
  3645. fmt.Println("model是什么",model)
  3646. macnavigation, err := site_service.GetMacImagesByModeid(id, userOrgID)
  3647. fmt.Println("中袖返回数据",macnavigation)
  3648. fmt.Println("错误",err)
  3649. if err !=nil{
  3650. this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
  3651. return
  3652. }
  3653. this.ServeSuccessJSON(map[string]interface{}{
  3654. "macnavigation":macnavigation,
  3655. "model":model,
  3656. })
  3657. }
  3658. func (this *Microwebsite) GetEnImages() {
  3659. adminUserInfo := this.GetAdminUserInfo()
  3660. userOrgID := adminUserInfo.CurrentOrgId
  3661. fmt.Println("机构id",userOrgID)
  3662. enviroimages, err := site_service.GetEnImages(userOrgID)
  3663. fmt.Println("错误",err)
  3664. fmt.Println("enviroimages",enviroimages)
  3665. if err !=nil{
  3666. this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
  3667. return
  3668. }
  3669. this.ServeSuccessJSON(map[string]interface{}{
  3670. "enviroimages":enviroimages,
  3671. })
  3672. }
  3673. func (this *Microwebsite) GetEditEnvirimages() {
  3674. adminUserInfo := this.GetAdminUserInfo()
  3675. userOrgID := adminUserInfo.CurrentOrgId
  3676. fmt.Println("机构id",userOrgID)
  3677. id,_ := this.GetInt64("id")
  3678. fmt.Println("id是",id)
  3679. enviroimages, err := site_service.GetEditEnvirimagesById(userOrgID, id)
  3680. if err !=nil{
  3681. this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
  3682. return
  3683. }
  3684. this.ServeSuccessJSON(map[string]interface{}{
  3685. "enviroimages":enviroimages,
  3686. })
  3687. }
  3688. func (this *Microwebsite) AddTwoImages() {
  3689. adminUserInfo := this.GetAdminUserInfo()
  3690. userOrgID := adminUserInfo.CurrentOrgId
  3691. fmt.Println("机构id",userOrgID)
  3692. id, _ := this.GetInt64("id")
  3693. fmt.Println("id是",id)
  3694. dataBody := make(map[string]interface{}, 0)
  3695. err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
  3696. if err != nil {
  3697. utils.ErrorLog(err.Error())
  3698. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "参数错误")
  3699. return
  3700. }
  3701. enviroimages := dataBody["enviroimages"].(string)
  3702. fmt.Println("活动标题",enviroimages)
  3703. if len(enviroimages) == 0 {
  3704. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "标题不能为空")
  3705. return
  3706. }
  3707. sort:= int64(dataBody["sort"].(float64))
  3708. fmt.Println("排序",sort)
  3709. patientEnviroimages := models.SgjPatientEnviroimages{
  3710. Enviroimages: enviroimages,
  3711. Sort: sort,
  3712. }
  3713. err = site_service.UpdateEnviroimages(id, userOrgID, patientEnviroimages)
  3714. fmt.Println("错误",err)
  3715. if err !=nil{
  3716. this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
  3717. return
  3718. }
  3719. this.ServeSuccessJSON(map[string]interface{}{
  3720. "patientEnviroimages":patientEnviroimages,
  3721. })
  3722. }
  3723. func (this *Microwebsite) AddOfficeThree() {
  3724. adminUserInfo := this.GetAdminUserInfo()
  3725. userOrgID := adminUserInfo.CurrentOrgId
  3726. fmt.Println("机构id",userOrgID)
  3727. id, _ := this.GetInt64("id")
  3728. fmt.Println("科室环境id是",id)
  3729. dataBody := make(map[string]interface{}, 0)
  3730. err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
  3731. if err != nil {
  3732. utils.ErrorLog(err.Error())
  3733. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "参数错误")
  3734. return
  3735. }
  3736. officeImages := dataBody["officeImages"].(string)
  3737. fmt.Println("活动标题",officeImages)
  3738. if len(officeImages) == 0 {
  3739. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "标题不能为空")
  3740. return
  3741. }
  3742. sort:= int64(dataBody["sort"].(float64))
  3743. fmt.Println("排序",sort)
  3744. offenvironment, err := site_service.GetOffENvironmentById(id, userOrgID)
  3745. fmt.Println("offenvironment",offenvironment)
  3746. enviroimages := models.SgjPatientEnviroimages{
  3747. Enviroimages: officeImages,
  3748. Sort: sort,
  3749. UserOrgId: userOrgID,
  3750. Status: 1,
  3751. Ctime: time.Now().Unix(),
  3752. Modeid: id,
  3753. }
  3754. err = site_service.AddOfficeThree(&enviroimages)
  3755. fmt.Println("err",err)
  3756. if err !=nil{
  3757. this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
  3758. return
  3759. }
  3760. patientEnviroimages, err := site_service.GetQueryImages(id, userOrgID)
  3761. this.ServeSuccessJSON(map[string]interface{}{
  3762. "enviroimages":enviroimages,
  3763. "patientEnviroimages":patientEnviroimages,
  3764. })
  3765. }
  3766. func (this *Microwebsite) GetOfficeTwoVisible() {
  3767. adminUserInfo := this.GetAdminUserInfo()
  3768. userOrgID := adminUserInfo.CurrentOrgId
  3769. fmt.Println("机构id",userOrgID)
  3770. id, _ := this.GetInt64("id")
  3771. fmt.Println("id是",id)
  3772. enviroimages, err := site_service.GetOfficeTwoVisible(userOrgID, id)
  3773. if err !=nil{
  3774. this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
  3775. return
  3776. }
  3777. this.ServeSuccessJSON(map[string]interface{}{
  3778. "enviroimages":enviroimages,
  3779. })
  3780. }
  3781. func (this *Microwebsite) AddOfficeTwo() {
  3782. adminUserInfo := this.GetAdminUserInfo()
  3783. userOrgID := adminUserInfo.CurrentOrgId
  3784. fmt.Println("机构id",userOrgID)
  3785. id, _ := this.GetInt64("id")
  3786. fmt.Println("id是",id)
  3787. dataBody := make(map[string]interface{}, 0)
  3788. err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
  3789. if err != nil {
  3790. utils.ErrorLog(err.Error())
  3791. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "参数错误")
  3792. return
  3793. }
  3794. officeImages := dataBody["officeImages"].(string)
  3795. fmt.Println("活动标题",officeImages)
  3796. if len(officeImages) == 0 {
  3797. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "标题不能为空")
  3798. return
  3799. }
  3800. sort:= int64(dataBody["sort"].(float64))
  3801. fmt.Println("排序",sort)
  3802. modelid := int64(dataBody["modelid"].(float64))
  3803. fmt.Println("小泽",modelid)
  3804. enviroimages := models.SgjPatientEnviroimages{
  3805. Enviroimages: officeImages,
  3806. Sort: sort,
  3807. }
  3808. err = site_service.UpdateOfficeTwo(userOrgID, id, enviroimages)
  3809. patientEnviroimages, err := site_service.GetQueryEnviroimage(userOrgID, modelid)
  3810. fmt.Println("错误是什么",err)
  3811. if err !=nil{
  3812. this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
  3813. return
  3814. }
  3815. this.ServeSuccessJSON(map[string]interface{}{
  3816. "enviroimages":enviroimages,
  3817. "patientEnviroimages":patientEnviroimages,
  3818. })
  3819. }
  3820. func (this *Microwebsite) DeleteOfficeById() {
  3821. adminUserInfo := this.GetAdminUserInfo()
  3822. userOrgID := adminUserInfo.CurrentOrgId
  3823. fmt.Println("机构id",userOrgID)
  3824. id, _ := this.GetInt64("id")
  3825. fmt.Println("id是",id)
  3826. err := site_service.DeleteOfficeById(id, userOrgID)
  3827. fmt.Println("错误",err)
  3828. returnData := make(map[string]interface{}, 0)
  3829. returnData["msg"] = "ok"
  3830. this.ServeSuccessJSON(returnData)
  3831. return
  3832. }
  3833. func (this *Microwebsite) GetArticleById() {
  3834. adminUserInfo := this.GetAdminUserInfo()
  3835. userOrgID := adminUserInfo.CurrentOrgId
  3836. fmt.Println("机构id",userOrgID)
  3837. articTypeid, _ := this.GetInt64("id")
  3838. fmt.Println("id是",articTypeid)
  3839. articlelist, err := site_service.GetArticleById(articTypeid, userOrgID)
  3840. fmt.Println("错误",err)
  3841. fmt.Println("articlelist",articlelist)
  3842. if err !=nil{
  3843. this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
  3844. return
  3845. }
  3846. this.ServeSuccessJSON(map[string]interface{}{
  3847. "articlelist":articlelist,
  3848. })
  3849. }
  3850. func (this *Microwebsite) GetAllActivity() {
  3851. adminUserInfo := this.GetAdminUserInfo()
  3852. userOrgID := adminUserInfo.CurrentOrgId
  3853. fmt.Println("机构id",userOrgID)
  3854. activtity, err := site_service.GetAllActivity(userOrgID)
  3855. fmt.Println("活动列表",activtity)
  3856. if err !=nil{
  3857. this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
  3858. return
  3859. }
  3860. this.ServeSuccessJSON(map[string]interface{}{
  3861. "activtity":activtity,
  3862. })
  3863. }
  3864. func (this *Microwebsite) AddData() {
  3865. adminUserInfo := this.GetAdminUserInfo()
  3866. userOrgID := adminUserInfo.CurrentOrgId
  3867. fmt.Println("机构id",userOrgID)
  3868. defineaddress := this.GetString("address")
  3869. fmt.Println("站位地址",defineaddress)
  3870. patientLinkaddress := models.SgjPatientLinkaddress{
  3871. Defineaddress: defineaddress,
  3872. UserOrgId: userOrgID,
  3873. Status: 1,
  3874. Ctime: time.Now().Unix(),
  3875. }
  3876. err := site_service.AddLinkAddress(&patientLinkaddress)
  3877. fmt.Println("错误是设么",err)
  3878. if err !=nil{
  3879. this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
  3880. return
  3881. }
  3882. this.ServeSuccessJSON(map[string]interface{}{
  3883. "patientLinkaddress":patientLinkaddress,
  3884. })
  3885. }
  3886. func (this *Microwebsite) Getlinkaddress() {
  3887. adminUserInfo := this.GetAdminUserInfo()
  3888. userOrgID := adminUserInfo.CurrentOrgId
  3889. fmt.Println("机构id",userOrgID)
  3890. id, _ := this.GetInt64("id")
  3891. fmt.Println("id",id)
  3892. linkaddress, err := site_service.GetLinkAddress(userOrgID,id)
  3893. fmt.Println("错误",err)
  3894. fmt.Println("地址",linkaddress)
  3895. if err !=nil{
  3896. this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
  3897. return
  3898. }
  3899. this.ServeSuccessJSON(map[string]interface{}{
  3900. "linkaddress":linkaddress,
  3901. })
  3902. }
  3903. func (this *Microwebsite) GetAllConnecway() {
  3904. adminUserInfo := this.GetAdminUserInfo()
  3905. userOrgID := adminUserInfo.CurrentOrgId
  3906. fmt.Println("机构id",userOrgID)
  3907. connect, err := site_service.GetAllConnecway(userOrgID)
  3908. fmt.Println("错误是什么",err)
  3909. fmt.Println("connect是设么",connect)
  3910. if err !=nil{
  3911. this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
  3912. return
  3913. }
  3914. this.ServeSuccessJSON(map[string]interface{}{
  3915. "connect":connect,
  3916. })
  3917. }
  3918. func (this *Microwebsite) GetConnecway() {
  3919. adminUserInfo := this.GetAdminUserInfo()
  3920. userOrgID := adminUserInfo.CurrentOrgId
  3921. fmt.Println("机构id",userOrgID)
  3922. id, _ := this.GetInt64("id")
  3923. fmt.Println("id是",id)
  3924. ordmodel, err:= site_service.GetConnecway(userOrgID, id)
  3925. if err !=nil{
  3926. this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
  3927. return
  3928. }
  3929. this.ServeSuccessJSON(map[string]interface{}{
  3930. "ordmodel":ordmodel,
  3931. })
  3932. }
  3933. func (this *Microwebsite) GetConnecwayById() {
  3934. adminUserInfo := this.GetAdminUserInfo()
  3935. userOrgID := adminUserInfo.CurrentOrgId
  3936. fmt.Println("机构id",userOrgID)
  3937. id, _ := this.GetInt64("id")
  3938. fmt.Println("id是",id)
  3939. connection, err := site_service.GetConnecwayById(userOrgID, id)
  3940. if err !=nil{
  3941. this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
  3942. return
  3943. }
  3944. this.ServeSuccessJSON(map[string]interface{}{
  3945. "connection":connection,
  3946. })
  3947. }
  3948. func (this *Microwebsite) UpdateConnectway() {
  3949. adminUserInfo := this.GetAdminUserInfo()
  3950. userOrgID := adminUserInfo.CurrentOrgId
  3951. fmt.Println("机构id", userOrgID)
  3952. id, _ := this.GetInt64("id")
  3953. fmt.Println("id是",id)
  3954. dataBody := make(map[string]interface{}, 0)
  3955. err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
  3956. if err != nil {
  3957. utils.ErrorLog(err.Error())
  3958. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "参数错误")
  3959. return
  3960. }
  3961. title := dataBody["title"].(string)
  3962. fmt.Println("标题",title)
  3963. connecway := int64(dataBody["connecway"].(float64))
  3964. fmt.Println("联系方式",connecway)
  3965. content := dataBody["content"].(string)
  3966. fmt.Println("内容",content)
  3967. connection := models.SgjPatientConnection{
  3968. Title: title,
  3969. Connecway: connecway,
  3970. Content: content,
  3971. }
  3972. err = site_service.UpdateConnectway(id, userOrgID, connection)
  3973. fmt.Println("错误",err)
  3974. if err !=nil{
  3975. this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
  3976. return
  3977. }
  3978. this.ServeSuccessJSON(map[string]interface{}{
  3979. "connection":connection,
  3980. })
  3981. }
  3982. func (this *Microwebsite) UpdateContact() {
  3983. adminUserInfo := this.GetAdminUserInfo()
  3984. userOrgID := adminUserInfo.CurrentOrgId
  3985. fmt.Println("机构id", userOrgID)
  3986. id, _ := this.GetInt64("id")
  3987. fmt.Println("id是",id)
  3988. dataBody := make(map[string]interface{}, 0)
  3989. err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
  3990. if err != nil {
  3991. utils.ErrorLog(err.Error())
  3992. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "参数错误")
  3993. return
  3994. }
  3995. title := dataBody["title"].(string)
  3996. fmt.Println("标题",title)
  3997. sort := int64(dataBody["sort"].(float64))
  3998. fmt.Println("排序",sort)
  3999. ordmodel := models.SgjPatientOrdmodel{
  4000. Title: title,
  4001. Sort: sort,
  4002. }
  4003. connectway := models.SgjPatientConnectway{
  4004. Title: title,
  4005. Sort: sort,
  4006. }
  4007. err = site_service.UpdateOrdeModel(id, userOrgID, ordmodel)
  4008. err = site_service.UpdateConnectways(id, userOrgID, connectway)
  4009. if err !=nil{
  4010. this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
  4011. return
  4012. }
  4013. this.ServeSuccessJSON(map[string]interface{}{
  4014. "ordmodel":ordmodel,
  4015. "connectway":connectway,
  4016. })
  4017. }
  4018. func (this *Microwebsite) AddConnectways() {
  4019. adminUserInfo := this.GetAdminUserInfo()
  4020. userOrgID := adminUserInfo.CurrentOrgId
  4021. fmt.Println("机构id", userOrgID)
  4022. dataBody := make(map[string]interface{}, 0)
  4023. err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
  4024. if err != nil {
  4025. utils.ErrorLog(err.Error())
  4026. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "参数错误")
  4027. return
  4028. }
  4029. title := dataBody["title"].(string)
  4030. fmt.Println("标题",title)
  4031. connecway := int64(dataBody["connecway"].(float64))
  4032. fmt.Println("联系方式",connecway)
  4033. content := dataBody["content"].(string)
  4034. connection := models.SgjPatientConnection{
  4035. Title: title,
  4036. Connecway: connecway,
  4037. Content: content,
  4038. UserOrgId: userOrgID,
  4039. Ctime: time.Now().Unix(),
  4040. Status: 1,
  4041. }
  4042. err = site_service.AddConnectways(&connection)
  4043. if err !=nil{
  4044. this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
  4045. return
  4046. }
  4047. this.ServeSuccessJSON(map[string]interface{}{
  4048. "connection":connection,
  4049. })
  4050. }
  4051. func (this *Microwebsite) GetHostpitalIntroduction() {
  4052. adminUserInfo := this.GetAdminUserInfo()
  4053. userOrgID := adminUserInfo.CurrentOrgId
  4054. fmt.Println("机构id", userOrgID)
  4055. id, _ := this.GetInt64("id")
  4056. fmt.Println("id是",id)
  4057. ordmodel, err := site_service.GetHostpitalIntroduction(userOrgID, id)
  4058. hosaddress, err := site_service.GetHostpitaAddress(userOrgID, id)
  4059. if err !=nil{
  4060. this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
  4061. return
  4062. }
  4063. this.ServeSuccessJSON(map[string]interface{}{
  4064. "ordmodel":ordmodel,
  4065. "hosaddress":hosaddress,
  4066. })
  4067. }
  4068. func (this *Microwebsite) UpdateHospitalAddress() {
  4069. adminUserInfo := this.GetAdminUserInfo()
  4070. userOrgID := adminUserInfo.CurrentOrgId
  4071. fmt.Println("机构id", userOrgID)
  4072. id, _ := this.GetInt64("id")
  4073. fmt.Println("id是",id)
  4074. dataBody := make(map[string]interface{}, 0)
  4075. err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
  4076. if err != nil {
  4077. utils.ErrorLog(err.Error())
  4078. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "参数错误")
  4079. return
  4080. }
  4081. title := dataBody["title"].(string)
  4082. fmt.Println("标题",title)
  4083. sort := int64(dataBody["sort"].(float64))
  4084. fmt.Println("排序",sort)
  4085. address := dataBody["hosaddress"].(string)
  4086. fmt.Println("地址",address)
  4087. ordmodel := models.SgjPatientOrdmodel{
  4088. Title: title,
  4089. Sort: sort,
  4090. }
  4091. hosaddress := models.SgjPatientHosaddress{
  4092. Title:title,
  4093. Sort:sort,
  4094. Address:address,
  4095. }
  4096. err = site_service.UpdateOrdeModel(id, userOrgID, ordmodel)
  4097. err = site_service.UpdateHosAddress(id, userOrgID, hosaddress)
  4098. if err !=nil{
  4099. this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
  4100. return
  4101. }
  4102. this.ServeSuccessJSON(map[string]interface{}{
  4103. "ordmodel":ordmodel,
  4104. "hosaddress":hosaddress,
  4105. })
  4106. }
  4107. func (this *Microwebsite) AddPicLinkAddress() {
  4108. adminUserInfo := this.GetAdminUserInfo()
  4109. userOrgID := adminUserInfo.CurrentOrgId
  4110. fmt.Println("机构id", userOrgID)
  4111. dataBody := make(map[string]interface{}, 0)
  4112. err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
  4113. if err != nil {
  4114. utils.ErrorLog(err.Error())
  4115. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "参数错误")
  4116. return
  4117. }
  4118. defineaddress := dataBody["defineaddress"].(string)
  4119. fmt.Println("defineaddress",defineaddress)
  4120. conlinkaddress := models.SgjPatientConlinkaddress{
  4121. Defineaddress: defineaddress,
  4122. UserOrgId: userOrgID,
  4123. Status: 1,
  4124. Ctime: time.Now().Unix(),
  4125. }
  4126. err = site_service.AddConlinkaddress(&conlinkaddress)
  4127. fmt.Println("错误",err)
  4128. if err !=nil{
  4129. this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
  4130. return
  4131. }
  4132. this.ServeSuccessJSON(map[string]interface{}{
  4133. "conlinkaddress":conlinkaddress,
  4134. })
  4135. }
  4136. func (this *Microwebsite) GetLinkAddressDetail() {
  4137. adminUserInfo := this.GetAdminUserInfo()
  4138. userOrgID := adminUserInfo.CurrentOrgId
  4139. fmt.Println("机构id", userOrgID)
  4140. id, _ := this.GetInt64("id")
  4141. fmt.Println("链接id",id)
  4142. conlinkaddress, err := site_service.GetLinkAddressDetail(userOrgID, id)
  4143. fmt.Println("错误",err)
  4144. fmt.Println("conlinkaddress",conlinkaddress)
  4145. if err !=nil{
  4146. this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
  4147. return
  4148. }
  4149. this.ServeSuccessJSON(map[string]interface{}{
  4150. "conlinkaddress":conlinkaddress,
  4151. })
  4152. }
  4153. func (this *Microwebsite) UpdatePicFformThree() {
  4154. adminUserInfo := this.GetAdminUserInfo()
  4155. userOrgID := adminUserInfo.CurrentOrgId
  4156. fmt.Println("机构id好", userOrgID)
  4157. id, _:= this.GetInt64("id")
  4158. fmt.Println("id",id)
  4159. dataBody := make(map[string]interface{}, 0)
  4160. err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
  4161. if err != nil {
  4162. utils.ErrorLog(err.Error())
  4163. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "参数错误")
  4164. return
  4165. }
  4166. defineaddress := dataBody["defineaddress"].(string)
  4167. fmt.Println("defineaddress",defineaddress)
  4168. conlinkaddress := models.SgjPatientConlinkaddress{
  4169. Defineaddress: defineaddress,
  4170. }
  4171. err = site_service.UpdatedConlinkAddress(id, userOrgID, conlinkaddress)
  4172. if err !=nil{
  4173. this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
  4174. return
  4175. }
  4176. this.ServeSuccessJSON(map[string]interface{}{
  4177. "conlinkaddress":conlinkaddress,
  4178. })
  4179. }
  4180. func (this *Microwebsite) GetEnImagesTwo() {
  4181. adminUserInfo := this.GetAdminUserInfo()
  4182. userOrgID := adminUserInfo.CurrentOrgId
  4183. editpiclink, err := site_service.GetEnImagesTwo(userOrgID)
  4184. fmt.Println("次哦啊",err)
  4185. fmt.Println("editpiclink是设么",editpiclink)
  4186. if err !=nil{
  4187. this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
  4188. return
  4189. }
  4190. this.ServeSuccessJSON(map[string]interface{}{
  4191. "editpiclink":editpiclink,
  4192. })
  4193. }
  4194. func (this *Microwebsite) GetEnImagesThree() {
  4195. adminUserInfo := this.GetAdminUserInfo()
  4196. userOrgID := adminUserInfo.CurrentOrgId
  4197. conrotation, err := site_service.GetEnImagesThree(userOrgID)
  4198. fmt.Println("conrotation是傻子",conrotation)
  4199. fmt.Println("cer",err)
  4200. if err !=nil{
  4201. this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
  4202. return
  4203. }
  4204. this.ServeSuccessJSON(map[string]interface{}{
  4205. "conrotation":conrotation,
  4206. })
  4207. }
  4208. func (this *Microwebsite) AddMagiclinkData() {
  4209. adminUserInfo := this.GetAdminUserInfo()
  4210. userOrgID := adminUserInfo.CurrentOrgId
  4211. fmt.Println("机构ID",userOrgID)
  4212. dataBody := make(map[string]interface{}, 0)
  4213. err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
  4214. if err != nil {
  4215. utils.ErrorLog(err.Error())
  4216. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "参数错误")
  4217. return
  4218. }
  4219. linkType := int64(dataBody["linkType"].(float64))
  4220. fmt.Println("链接类型",linkType)
  4221. Instationlink := int64(dataBody["instationlink"].(float64))
  4222. fmt.Println("站内链接",Instationlink)
  4223. //intstationlink, err := strconv.ParseInt(Instationlink, 10, 64)
  4224. //articeType := int64(dataBody["articeType"].(float64))
  4225. //fmt.Println("文章分类",articeType)
  4226. phone := dataBody["phone"].(string)
  4227. fmt.Println("电话号码",phone)
  4228. outstationlink := dataBody["outstationlink"].(string)
  4229. fmt.Println("站外链接",outstationlink)
  4230. magiclink := models.SgjPatientMagiclink{
  4231. Linktype: linkType,
  4232. Instationlink: Instationlink,
  4233. Phone: phone,
  4234. Outstationlink: outstationlink,
  4235. Ctime:time.Now().Unix(),
  4236. Status:1,
  4237. UserOrgId:userOrgID,
  4238. }
  4239. err = site_service.AddMagiclinkData(&magiclink)
  4240. fmt.Println("错误",err)
  4241. model, err := site_service.GetPatienModelByModelId(Instationlink, userOrgID)
  4242. fmt.Println("错误",err)
  4243. fmt.Println("model",model)
  4244. this.ServeSuccessJSON(map[string]interface{}{
  4245. "magiclink":magiclink,
  4246. "model":model,
  4247. })
  4248. }
  4249. func (this *Microwebsite) GetMacLinkAddress() {
  4250. adminUserInfo := this.GetAdminUserInfo()
  4251. userOrgID := adminUserInfo.CurrentOrgId
  4252. fmt.Println("机构ID",userOrgID)
  4253. magiclink, err := site_service.GetMacLinkAddress(userOrgID)
  4254. fmt.Println("magiclink",magiclink)
  4255. fmt.Println("中秋梦玲",err)
  4256. if err !=nil{
  4257. this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
  4258. return
  4259. }
  4260. this.ServeSuccessJSON(map[string]interface{}{
  4261. "magiclink":magiclink,
  4262. })
  4263. }
  4264. func (this *Microwebsite) AddMacgicform() {
  4265. adminUserInfo := this.GetAdminUserInfo()
  4266. userOrgID := adminUserInfo.CurrentOrgId
  4267. fmt.Println("机构ID", userOrgID)
  4268. id, _ := this.GetInt64("id")
  4269. fmt.Println("id是多少", id)
  4270. dataBody := make(map[string]interface{}, 0)
  4271. err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
  4272. if err != nil {
  4273. utils.ErrorLog(err.Error())
  4274. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "参数错误")
  4275. return
  4276. }
  4277. title := dataBody["title"].(string)
  4278. fmt.Println("导航标题", title)
  4279. macgicimages := dataBody["macgicimages"].(string)
  4280. fmt.Println("导航图标", macgicimages)
  4281. jumpset := int64(dataBody["jumpset"].(float64))
  4282. fmt.Println("跳转设置", jumpset)
  4283. linkaddress := dataBody["linkaddress"].(string)
  4284. fmt.Println("链接地址", linkaddress)
  4285. editmargin := models.SgjPatientEditmargin{
  4286. Margtitle: title,
  4287. Margimage: macgicimages,
  4288. Jumpset: jumpset,
  4289. Marginaddress: macgicimages,
  4290. UserOrgId:userOrgID,
  4291. Modeid: id,
  4292. Status: 1,
  4293. Ctime: time.Now().Unix(),
  4294. }
  4295. err = site_service.AddMacgicform(&editmargin)
  4296. if err !=nil{
  4297. this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
  4298. return
  4299. }
  4300. this.ServeSuccessJSON(map[string]interface{}{
  4301. "editmargin":editmargin,
  4302. })
  4303. }
  4304. func (this *Microwebsite) GetMacImagesDetail() {
  4305. adminUserInfo := this.GetAdminUserInfo()
  4306. userOrgID := adminUserInfo.CurrentOrgId
  4307. fmt.Println("机构ID", userOrgID)
  4308. id, _ := this.GetInt64("id")
  4309. fmt.Println("id是多少", id)
  4310. editmargin, err := site_service.GetMacImagesDetail(userOrgID, id)
  4311. if err !=nil{
  4312. this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
  4313. return
  4314. }
  4315. this.ServeSuccessJSON(map[string]interface{}{
  4316. "editmargin":editmargin,
  4317. })
  4318. }
  4319. func (this *Microwebsite) DeleteMacImagesDetail() {
  4320. adminUserInfo := this.GetAdminUserInfo()
  4321. userOrgID := adminUserInfo.CurrentOrgId
  4322. fmt.Println("机构ID", userOrgID)
  4323. id, _ := this.GetInt64("id")
  4324. fmt.Println("id是多少", id)
  4325. err := site_service.DeletMacImagesDetail(id, userOrgID)
  4326. if err !=nil{
  4327. this.ServeFailJsonSend(enums.ErrorCodeDataException, "删除回复成功")
  4328. return
  4329. }
  4330. returnData := make(map[string]interface{}, 0)
  4331. returnData["msg"] = "ok"
  4332. this.ServeSuccessJSON(returnData)
  4333. return
  4334. }
  4335. func (this*Microwebsite) UpdateMacForm() {
  4336. adminUserInfo := this.GetAdminUserInfo()
  4337. userOrgID := adminUserInfo.CurrentOrgId
  4338. fmt.Println("机构ID", userOrgID)
  4339. id, _ := this.GetInt64("id")
  4340. fmt.Println("id是多少", id)
  4341. dataBody := make(map[string]interface{}, 0)
  4342. err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
  4343. if err != nil {
  4344. utils.ErrorLog(err.Error())
  4345. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "参数错误")
  4346. return
  4347. }
  4348. title := dataBody["title"].(string)
  4349. fmt.Println("导航标题", title)
  4350. sort := int64(dataBody["sort"].(float64))
  4351. fmt.Println("排序",sort)
  4352. model := models.SgjPatientModel{
  4353. Title: title,
  4354. Sort: sort,
  4355. }
  4356. err = site_service.UpdateModel(id, userOrgID, model)
  4357. if err !=nil{
  4358. this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
  4359. return
  4360. }
  4361. this.ServeSuccessJSON(map[string]interface{}{
  4362. "model":model,
  4363. })
  4364. }
  4365. func (this*Microwebsite) GetEditMacImageDetail() {
  4366. adminUserInfo := this.GetAdminUserInfo()
  4367. userOrgID := adminUserInfo.CurrentOrgId
  4368. fmt.Println("机构中秋ID", userOrgID)
  4369. id, _ := this.GetInt64("id")
  4370. fmt.Println("机构宗秀id",id)
  4371. editmargin, err := site_service.GetEditMacImageDetailById(userOrgID, id)
  4372. fmt.Println("ditmargin",editmargin)
  4373. fmt.Println("错误",err)
  4374. if err !=nil{
  4375. this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
  4376. return
  4377. }
  4378. this.ServeSuccessJSON(map[string]interface{}{
  4379. "editmargin":editmargin,
  4380. })
  4381. }
  4382. func (this*Microwebsite) UpdateEditMacForm() {
  4383. adminUserInfo := this.GetAdminUserInfo()
  4384. userOrgID := adminUserInfo.CurrentOrgId
  4385. fmt.Println("机构中秋ID", userOrgID)
  4386. id, _ := this.GetInt64("id")
  4387. fmt.Println("中秋id",id)
  4388. dataBody := make(map[string]interface{}, 0)
  4389. err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
  4390. if err != nil {
  4391. utils.ErrorLog(err.Error())
  4392. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "参数错误")
  4393. return
  4394. }
  4395. margtitle := dataBody["margtitle"].(string)
  4396. fmt.Println("导航标题", margtitle)
  4397. margimage := dataBody["margimage"].(string)
  4398. fmt.Println("导航图片",margimage)
  4399. jumpset := int64(dataBody["jumpset"].(float64))
  4400. fmt.Println("导航设置",jumpset)
  4401. marginaddress := dataBody["marginaddress"].(string)
  4402. fmt.Println("导航图标链接地址",marginaddress)
  4403. editmargin := models.SgjPatientEditmargin{
  4404. Margtitle: margtitle,
  4405. Margimage: margimage,
  4406. Jumpset: jumpset,
  4407. Marginaddress: marginaddress,
  4408. }
  4409. err = site_service.UpdateEditMacFormById(id, userOrgID, editmargin)
  4410. fmt.Println("爆粗",err)
  4411. if err !=nil{
  4412. this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
  4413. return
  4414. }
  4415. this.ServeSuccessJSON(map[string]interface{}{
  4416. "editmargin":editmargin,
  4417. })
  4418. }
  4419. func (this*Microwebsite) GetLikeMacAddressById() {
  4420. adminUserInfo := this.GetAdminUserInfo()
  4421. userOrgID := adminUserInfo.CurrentOrgId
  4422. //fmt.Println("机构中秋ID", userOrgID)
  4423. id, _ := this.GetInt64("id")
  4424. fmt.Println("中秋id",id)
  4425. magiclink, err := site_service.GetLikeMacAddressById(userOrgID, id)
  4426. fmt.Println("中秋快乐",magiclink)
  4427. fmt.Println("错误",err)
  4428. if err !=nil{
  4429. this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
  4430. return
  4431. }
  4432. this.ServeSuccessJSON(map[string]interface{}{
  4433. "magiclink":magiclink,
  4434. })
  4435. }
  4436. func (this*Microwebsite) GetArticleName() {
  4437. adminUserInfo := this.GetAdminUserInfo()
  4438. userOrgID := adminUserInfo.CurrentOrgId
  4439. fmt.Println("ID", userOrgID)
  4440. id, _ := this.GetInt64("id")
  4441. articlelist, err := site_service.GetArticleById(id, userOrgID)
  4442. if err !=nil{
  4443. this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
  4444. return
  4445. }
  4446. this.ServeSuccessJSON(map[string]interface{}{
  4447. "articlelist":articlelist,
  4448. })
  4449. }
  4450. func (this*Microwebsite) GetAllArticeList() {
  4451. adminUserInfo := this.GetAdminUserInfo()
  4452. userOrgID := adminUserInfo.CurrentOrgId
  4453. articles, err := site_service.GetAllArticeList(userOrgID)
  4454. if err !=nil{
  4455. this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
  4456. return
  4457. }
  4458. this.ServeSuccessJSON(map[string]interface{}{
  4459. "articles":articles,
  4460. })
  4461. }
  4462. func (this*Microwebsite) UpdateLinkAddress() {
  4463. adminUserInfo := this.GetAdminUserInfo()
  4464. userOrgID := adminUserInfo.CurrentOrgId
  4465. fmt.Println("机构id", userOrgID)
  4466. id, _:= this.GetInt64("id")
  4467. fmt.Println("id",id)
  4468. dataBody := make(map[string]interface{}, 0)
  4469. err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
  4470. if err != nil {
  4471. utils.ErrorLog(err.Error())
  4472. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "参数错误")
  4473. return
  4474. }
  4475. linktype := int64(dataBody["linktype"].(float64))
  4476. fmt.Println("链接类型",linktype)
  4477. instationlink := int64(dataBody["instationlink"].(float64))
  4478. fmt.Println("站类李恩杰",instationlink)
  4479. //articetype := int64(dataBody["articetype"].(float64))
  4480. //fmt.Println("文章类型",articetype)
  4481. //title := int64(dataBody["title"].(float64))
  4482. //fmt.Println("文章標題",title)
  4483. phone := dataBody["phone"].(string)
  4484. fmt.Println("電話",phone)
  4485. outstationlink := dataBody["outstationlink"].(string)
  4486. fmt.Println("展望列哪家",outstationlink)
  4487. linkaddress := int64(dataBody["linkaddress"].(float64))
  4488. formatInt := strconv.FormatInt(linkaddress, 10)
  4489. fmt.Println("链接地址",linkaddress)
  4490. if(phone != ""){
  4491. formatInt = phone;
  4492. }
  4493. if(outstationlink != ""){
  4494. formatInt = outstationlink;
  4495. }
  4496. magiclink := models.SgjPatientMagiclink{
  4497. Linktype: linktype,
  4498. Instationlink: instationlink,
  4499. Phone: phone,
  4500. Outstationlink: outstationlink,
  4501. Linkaddress: formatInt,
  4502. UserOrgId:userOrgID,
  4503. Status:1,
  4504. }
  4505. model, err := site_service.GetPatienModelByModelId(linkaddress, userOrgID)
  4506. patientMagiclink, err := site_service.GetMacLinkAddressTwo(userOrgID)
  4507. fmt.Println("长度",len(patientMagiclink))
  4508. if(len(patientMagiclink)== 0){
  4509. err = site_service.AddMacLinkAddress(&magiclink)
  4510. fmt.Println("err",err)
  4511. }else {
  4512. fmt.Println(magiclink)
  4513. err = site_service.UpdateLinkAddress(id, userOrgID, magiclink)
  4514. }
  4515. fmt.Println("报错误",err)
  4516. if err !=nil{
  4517. this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
  4518. return
  4519. }
  4520. this.ServeSuccessJSON(map[string]interface{}{
  4521. "magiclink":magiclink,
  4522. "model":model,
  4523. })
  4524. }
  4525. func (this*Microwebsite) AddMacLinkAddress() {
  4526. adminUserInfo := this.GetAdminUserInfo()
  4527. userOrgID := adminUserInfo.CurrentOrgId
  4528. fmt.Println("机构id", userOrgID)
  4529. dataBody := make(map[string]interface{}, 0)
  4530. err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
  4531. if err != nil {
  4532. utils.ErrorLog(err.Error())
  4533. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "参数错误")
  4534. return
  4535. }
  4536. linktype := int64(dataBody["linktype"].(float64))
  4537. fmt.Println("linktype",linktype)
  4538. instationlink := int64(dataBody["instationlink"].(float64))
  4539. fmt.Println("instationlink",instationlink)
  4540. phone := dataBody["phone"].(string)
  4541. fmt.Println("phone",phone)
  4542. outstationlink := dataBody["outstationlink"].(string)
  4543. fmt.Println("outtationlink",outstationlink)
  4544. magiclink := models.SgjPatientMagiclink{
  4545. Linktype: linktype,
  4546. Instationlink: instationlink,
  4547. Phone: phone,
  4548. Outstationlink: outstationlink,
  4549. Ctime: time.Now().Unix(),
  4550. Status: 1,
  4551. }
  4552. fmt.Println("magiclink",magiclink)
  4553. err = site_service.AddMacLinkAddress(&magiclink)
  4554. model, err := site_service.GetPatienModelByModelId(instationlink, userOrgID)
  4555. fmt.Println(err)
  4556. //patientMagiclink, err := site_service.GetMacLinkAddress(userOrgID)
  4557. if err !=nil{
  4558. this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
  4559. return
  4560. }
  4561. this.ServeSuccessJSON(map[string]interface{}{
  4562. "magiclink":magiclink,
  4563. "model":model,
  4564. })
  4565. }
  4566. func (this*Microwebsite) GetLinkAddress() {
  4567. adminUserInfo := this.GetAdminUserInfo()
  4568. userOrgID := adminUserInfo.CurrentOrgId
  4569. fmt.Println("机构id", userOrgID)
  4570. id, _:= this.GetInt64("id")
  4571. fmt.Println("id",id)
  4572. linkaddress, err := site_service.GetPatientLinkAddress(id, userOrgID)
  4573. if err !=nil{
  4574. this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
  4575. return
  4576. }
  4577. this.ServeSuccessJSON(map[string]interface{}{
  4578. "linkaddress":linkaddress,
  4579. })
  4580. }
  4581. func (this*Microwebsite) GetCountImages() {
  4582. fmt.Println("")
  4583. adminUserInfo := this.GetAdminUserInfo()
  4584. userOrgID := adminUserInfo.CurrentOrgId
  4585. fmt.Println("机构id机构id记过id九宫UID", userOrgID)
  4586. edipiclink, total, err := site_service.GetCountImages(userOrgID)
  4587. fmt.Println("edipiclink是什么edipiclink是什么edipiclink是什么edipiclink是什么",edipiclink)
  4588. fmt.Println("total是什么",total)
  4589. fmt.Println("err是什么",err)
  4590. }
  4591. func (this*Microwebsite) AddNavigationLinkform() {
  4592. adminUserInfo := this.GetAdminUserInfo()
  4593. userOrgID := adminUserInfo.CurrentOrgId
  4594. fmt.Println("机构id", userOrgID)
  4595. dataBody := make(map[string]interface{}, 0)
  4596. err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
  4597. if err != nil {
  4598. utils.ErrorLog(err.Error())
  4599. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "参数错误")
  4600. return
  4601. }
  4602. linktype := int64(dataBody["linktype"].(float64))
  4603. fmt.Println("linktype",linktype)
  4604. navitionlinktype := int64(dataBody["navitionlinktype"].(float64))
  4605. fmt.Println("navitionlinktype",navitionlinktype)
  4606. phone := dataBody["phone"].(string)
  4607. if(phone == "0"){
  4608. phone = ""
  4609. }
  4610. fmt.Println("phone",phone)
  4611. outstationlink := dataBody["outstationlink"].(string)
  4612. if(outstationlink == "0"){
  4613. outstationlink = ""
  4614. }
  4615. fmt.Println("outstationlink",outstationlink)
  4616. linkaddress := dataBody["linkaddress"].(string)
  4617. fmt.Println("linkaddress",linkaddress)
  4618. navgationlink := models.PatientNavgationlink{
  4619. Linktype: linktype,
  4620. Navitionlinktype: navitionlinktype,
  4621. Phone: phone,
  4622. Outstationlink: outstationlink,
  4623. Status: 1,
  4624. Ctime: time.Now().Unix(),
  4625. Linkaddress:linkaddress,
  4626. UserOrgId:userOrgID,
  4627. }
  4628. err = site_service.AddNavitaionLinkAddress(&navgationlink)
  4629. if err !=nil{
  4630. this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
  4631. return
  4632. }
  4633. this.ServeSuccessJSON(map[string]interface{}{
  4634. "navgationlink":navgationlink,
  4635. })
  4636. }
  4637. func (this*Microwebsite) GetNavigationlinkaddress() {
  4638. adminUserInfo := this.GetAdminUserInfo()
  4639. userOrgID := adminUserInfo.CurrentOrgId
  4640. fmt.Println("机构id", userOrgID)
  4641. id,_ := this.GetInt64("id")
  4642. fmt.Println("id是什么",id)
  4643. navgationlink, err := site_service.GetNavgationlinkAddressBylinkId(userOrgID, id)
  4644. fmt.Println("大错误",err)
  4645. fmt.Println(navgationlink)
  4646. if err !=nil{
  4647. this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
  4648. return
  4649. }
  4650. this.ServeSuccessJSON(map[string]interface{}{
  4651. "navgationlink":navgationlink,
  4652. })
  4653. }
  4654. func (this*Microwebsite) UpdateditnavigationLink() {
  4655. adminUserInfo := this.GetAdminUserInfo()
  4656. userOrgID := adminUserInfo.CurrentOrgId
  4657. fmt.Println("机构id", userOrgID)
  4658. dataBody := make(map[string]interface{}, 0)
  4659. err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
  4660. if err != nil {
  4661. utils.ErrorLog(err.Error())
  4662. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "参数错误")
  4663. return
  4664. }
  4665. //id := int64(dataBody["id"].(float64))
  4666. //fmt.Println("id是什么",id)
  4667. id, _ := this.GetInt64("id")
  4668. fmt.Println("id是什么",id)
  4669. linktype := int64(dataBody["linktype"].(float64))
  4670. fmt.Println("linktype",linktype)
  4671. navitionlinktype := int64(dataBody["navitionlinktype"].(float64))
  4672. fmt.Println("navitionlinktype",navitionlinktype)
  4673. phone := dataBody["phone"].(string)
  4674. fmt.Println("phone",phone)
  4675. outstationlink := dataBody["outstationlink"].(string)
  4676. fmt.Println("outstationlink",outstationlink)
  4677. linkaddress := dataBody["linkaddress"].(string)
  4678. fmt.Println("linkaddress",linkaddress)
  4679. navgationlink := models.PatientNavgationlink{
  4680. Linktype: linktype,
  4681. Navitionlinktype: navitionlinktype,
  4682. Outstationlink: outstationlink,
  4683. Linkaddress: linkaddress,
  4684. Phone:phone,
  4685. UserOrgId:userOrgID,
  4686. Status:1,
  4687. }
  4688. patientNavgationlink, errcode := site_service.GetNavgationLinkById(id, userOrgID)
  4689. fmt.Println(patientNavgationlink,errcode)
  4690. if errcode == gorm.ErrRecordNotFound{
  4691. err = site_service.AddNavigationlink(&navgationlink)
  4692. fmt.Println("数据添加成功",err)
  4693. }else if errcode == nil {
  4694. err = site_service.UpdateditnavigationLink(id, userOrgID, navgationlink)
  4695. if err !=nil{
  4696. this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
  4697. return
  4698. }
  4699. }else {
  4700. err = site_service.UpdateditnavigationLink(id, userOrgID, navgationlink)
  4701. if err !=nil{
  4702. this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
  4703. return
  4704. }
  4705. }
  4706. this.ServeSuccessJSON(map[string]interface{}{
  4707. "navgationlink":navgationlink,
  4708. })
  4709. }
  4710. func (this*Microwebsite) AddDoctorInfoTwo() {
  4711. adminUserInfo := this.GetAdminUserInfo()
  4712. userOrgID := adminUserInfo.CurrentOrgId
  4713. fmt.Println("机构id", userOrgID)
  4714. id,_ := this.GetInt64("id")
  4715. fmt.Println("这个id",id)
  4716. dataBody := make(map[string]interface{}, 0)
  4717. err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
  4718. if err != nil {
  4719. utils.ErrorLog(err.Error())
  4720. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "参数错误")
  4721. return
  4722. }
  4723. name := dataBody["name"].(string)
  4724. fmt.Println("姓名",name)
  4725. usertitle := int64(dataBody["user_title"].(float64))
  4726. fmt.Println("职称",usertitle)
  4727. dochead := dataBody["dochead"].(string)
  4728. fmt.Println("医生头像",dochead)
  4729. sort := int64(dataBody["sort"].(float64))
  4730. fmt.Println("排序",sort)
  4731. content := dataBody["content"].(string)
  4732. fmt.Println("内容",content)
  4733. editdoctor := models.SgjPatientEditdoctor{
  4734. DocName: name,
  4735. DocPostion: usertitle,
  4736. Dochead: dochead,
  4737. DocSort: sort,
  4738. Docintroduction: content,
  4739. Modleid: id,
  4740. UserOrgId: userOrgID,
  4741. Status: 1,
  4742. Ctime: time.Now().Unix(),
  4743. ImgShow: 1,
  4744. }
  4745. err = site_service.AddEditDoctor(&editdoctor)
  4746. editdoctors, err := site_service.QuerEditDoctorInfo(id, userOrgID)
  4747. if err !=nil{
  4748. this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
  4749. return
  4750. }
  4751. this.ServeSuccessJSON(map[string]interface{}{
  4752. "editdoctor":editdoctor,
  4753. "editdoctors":editdoctors,
  4754. })
  4755. }
  4756. func (this*Microwebsite) GetUserOrgID(){
  4757. adminUserInfo := this.GetAdminUserInfo()
  4758. userOrgID := adminUserInfo.CurrentOrgId
  4759. fmt.Println("机构id", userOrgID)
  4760. this.ServeSuccessJSON(map[string]interface{}{
  4761. "usreOrgID":userOrgID,
  4762. })
  4763. }
  4764. func (this *Microwebsite) GetNavigationset() {
  4765. adminUserInfo := this.GetAdminUserInfo()
  4766. userOrgID := adminUserInfo.CurrentOrgId
  4767. fmt.Println("机构id", userOrgID)
  4768. //navigation, err := site_service.GetDefaultNavigation(userOrgID)
  4769. //fmt.Println("错误是设么",err)
  4770. //if (len(navigation) == 0) {
  4771. // sgjPatientNavigation := models.SgjPatientNavigation{
  4772. // Navtitle: "首页",
  4773. // Navimages: "https://images.shengws.com/2099_o_1570840397245.png",
  4774. // Nonavimages:"https://images.shengws.com/2099_o_1570840397245.png",
  4775. // Jumpset: 1,
  4776. // Navaddress: "",
  4777. // Ctime: time.Now().Unix(),
  4778. // Status: 1,
  4779. // UserOrgId: userOrgID,
  4780. // }
  4781. // err = site_service.AddDefaultData(&sgjPatientNavigation)
  4782. // patientNavigation := models.SgjPatientNavigation{
  4783. // Navtitle: "微商城",
  4784. // Navimages: "https://images.shengws.com/2122_o_1570840361702.png",
  4785. // Nonavimages:"https://images.shengws.com/2122_o_1570840361702.png",
  4786. // Jumpset: 1,
  4787. // Navaddress: "http://shop.kuyicloud.com/app/index.php?i=2&c=entry&m=ewei_shopv2&do=mobile&fxtoken=bdc5659cbd1bd67baa9af215b0d6ae4c&fxorgid=3877&timestamp=1571050598&fxadmin=185&wxref=mp.weixin.qq.com#wechat_redirect",
  4788. // Ctime: time.Now().Unix(),
  4789. // Status: 1,
  4790. // UserOrgId: userOrgID,
  4791. // }
  4792. // err = site_service.AddDefaultData(&patientNavigation)
  4793. // fmt.Println(err)
  4794. // fmt.Println(patientNavigation)
  4795. // sgjPatientNavigationtwo := models.SgjPatientNavigation{
  4796. // Navtitle: "联系我们",
  4797. // Navimages: "https://images.shengws.com/2138_o_1570840377129.png",
  4798. // Nonavimages:"https://images.shengws.com/2138_o_1570840377129.png",
  4799. // Jumpset: 1,
  4800. // Navaddress: "",
  4801. // Ctime: time.Now().Unix(),
  4802. // Status: 1,
  4803. // UserOrgId: userOrgID,
  4804. // }
  4805. // err = site_service.AddDefaultData(&sgjPatientNavigationtwo)
  4806. // fmt.Println(err)
  4807. // fmt.Println(sgjPatientNavigationtwo)
  4808. // sgjPatientNavigationthree := models.SgjPatientNavigation{
  4809. // Navtitle: "在线客服",
  4810. // Navimages: "https://images.shengws.com/2079_o_1570842501972.png",
  4811. // Nonavimages:"https://images.shengws.com/2079_o_1570842501972.png",
  4812. // Jumpset: 1,
  4813. // Navaddress: "0755-86526342",
  4814. // Ctime: time.Now().Unix(),
  4815. // Status: 1,
  4816. // UserOrgId: userOrgID,
  4817. // }
  4818. // err = site_service.AddDefaultData(&sgjPatientNavigationthree)
  4819. // fmt.Println(err)
  4820. // fmt.Println(sgjPatientNavigationthree)
  4821. //
  4822. // navigations, err := site_service.GetDefaultNavigation(userOrgID)
  4823. // fmt.Println(err)
  4824. // if err !=nil{
  4825. // this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
  4826. // return
  4827. // }
  4828. // this.ServeSuccessJSON(map[string]interface{}{
  4829. // "sgjPatientNavigation":sgjPatientNavigation,
  4830. // "navigations":navigations,
  4831. // })
  4832. //}
  4833. navigations, err := site_service.GetDefaultNavigation(userOrgID)
  4834. if err !=nil{
  4835. this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
  4836. return
  4837. }
  4838. this.ServeSuccessJSON(map[string]interface{}{
  4839. "navigations":navigations,
  4840. })
  4841. }
  4842. func (this *Microwebsite) GetNavigationData() {
  4843. adminUserInfo := this.GetAdminUserInfo()
  4844. userOrgID := adminUserInfo.CurrentOrgId
  4845. fmt.Println("机构id", userOrgID)
  4846. navigation, err := site_service.GetDefaultNavigation(userOrgID)
  4847. fmt.Println("navigation是什么呢",navigation)
  4848. if err !=nil{
  4849. this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
  4850. return
  4851. }
  4852. this.ServeSuccessJSON(map[string]interface{}{
  4853. "navigation":navigation,
  4854. })
  4855. }
  4856. func (this *Microwebsite) GetAllModelTitle(){
  4857. adminUserInfo := this.GetAdminUserInfo()
  4858. userOrgID := adminUserInfo.CurrentOrgId
  4859. fmt.Println("机构id", userOrgID)
  4860. patientModels, err := site_service.GetAllModelTitle(userOrgID)
  4861. if err !=nil{
  4862. this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
  4863. return
  4864. }
  4865. this.ServeSuccessJSON(map[string]interface{}{
  4866. "patientModels":patientModels,
  4867. })
  4868. }
  4869. func (this *Microwebsite) GetDoctorDetailInfo(){
  4870. id, _ := this.GetInt64("id")
  4871. fmt.Println("医生详情id",id)
  4872. adminUserInfo := this.GetAdminUserInfo()
  4873. userOrgID := adminUserInfo.CurrentOrgId
  4874. fmt.Println("机构id",userOrgID)
  4875. editdoctor, err := site_service.GetDoctorDetailInfo(id, userOrgID)
  4876. if err !=nil{
  4877. this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
  4878. return
  4879. }
  4880. this.ServeSuccessJSON(map[string]interface{}{
  4881. "editdoctor":editdoctor,
  4882. })
  4883. }
  4884. func (this *Microwebsite) GetArticleListDetail() {
  4885. id, _ := this.GetInt64("id")
  4886. fmt.Println("文章详情id",id)
  4887. adminUserInfo := this.GetAdminUserInfo()
  4888. userOrgID := adminUserInfo.CurrentOrgId
  4889. fmt.Println("机构id",userOrgID)
  4890. articles, err := site_service.GetArticleListDetail(id, userOrgID)
  4891. if err !=nil{
  4892. this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
  4893. return
  4894. }
  4895. this.ServeSuccessJSON(map[string]interface{}{
  4896. "articles":articles,
  4897. })
  4898. }
  4899. func (this *Microwebsite) GetActivitiesListDetail() {
  4900. id, _ := this.GetInt64("id")
  4901. fmt.Println("活动详情id",id)
  4902. adminUserInfo := this.GetAdminUserInfo()
  4903. userOrgID := adminUserInfo.CurrentOrgId
  4904. fmt.Println("机构id",userOrgID)
  4905. activity, err := site_service.GetActivitiesListDetail(id, userOrgID)
  4906. if err !=nil{
  4907. this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
  4908. return
  4909. }
  4910. this.ServeSuccessJSON(map[string]interface{}{
  4911. "activity":activity,
  4912. })
  4913. }
  4914. func (this *Microwebsite) AddLinkAddressThree() {
  4915. adminUserInfo := this.GetAdminUserInfo()
  4916. userOrgID := adminUserInfo.CurrentOrgId
  4917. fmt.Println("机构id",userOrgID)
  4918. defineaddress := this.GetString("address")
  4919. fmt.Println("自定义地址",defineaddress)
  4920. if len(defineaddress) == 0 {
  4921. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "自定义地址不能为空")
  4922. return
  4923. }
  4924. patientLinkaddress := models.SgjPatientLinkaddress{
  4925. Defineaddress: defineaddress,
  4926. UserOrgId:userOrgID,
  4927. Status:1,
  4928. Ctime:time.Now().Unix(),
  4929. }
  4930. err := site_service.AddLinkAddress(&patientLinkaddress)
  4931. if err !=nil{
  4932. this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
  4933. return
  4934. }
  4935. this.ServeSuccessJSON(map[string]interface{}{
  4936. "patientLinkaddress":patientLinkaddress,
  4937. })
  4938. }
  4939. func (this *Microwebsite) GetLinkAddressByLinkId() {
  4940. adminUserInfo := this.GetAdminUserInfo()
  4941. userOrgID := adminUserInfo.CurrentOrgId
  4942. fmt.Println("机构id",userOrgID)
  4943. linkid, _ := this.GetInt64("linkid")
  4944. fmt.Println("linkid是多少?",linkid)
  4945. linkaddress, err := site_service.GetLinkAddressByLinkId(userOrgID, linkid)
  4946. if err !=nil{
  4947. this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
  4948. return
  4949. }
  4950. this.ServeSuccessJSON(map[string]interface{}{
  4951. "linkaddress":linkaddress,
  4952. })
  4953. }
  4954. func (this *Microwebsite) AddLinkAddressFour() {
  4955. adminUserInfo := this.GetAdminUserInfo()
  4956. userOrgID := adminUserInfo.CurrentOrgId
  4957. fmt.Println("机构id",userOrgID)
  4958. address := this.GetString("address")
  4959. fmt.Println("linkid是多少?",address)
  4960. linkaddress := models.SgjPatientLinkaddress{
  4961. Defineaddress: address,
  4962. Status: 1,
  4963. Ctime: time.Now().Unix(),
  4964. UserOrgId: userOrgID,
  4965. }
  4966. err := site_service.AddLinkAddress(&linkaddress)
  4967. if err !=nil{
  4968. this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
  4969. return
  4970. }
  4971. this.ServeSuccessJSON(map[string]interface{}{
  4972. "linkaddress":linkaddress,
  4973. })
  4974. }
  4975. func (this *Microwebsite) GetMagicLinkAddressById() {
  4976. adminUserInfo := this.GetAdminUserInfo()
  4977. userOrgID := adminUserInfo.CurrentOrgId
  4978. fmt.Println("机构id",userOrgID)
  4979. id, _:= this.GetInt64("id")
  4980. fmt.Println("id是多少",id)
  4981. magiclink, err := site_service.GetMagicLinkAddressById(userOrgID, id)
  4982. fmt.Println("错误是什么",err)
  4983. if err !=nil{
  4984. this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
  4985. return
  4986. }
  4987. this.ServeSuccessJSON(map[string]interface{}{
  4988. "magiclink":magiclink,
  4989. })
  4990. }
  4991. func (this *Microwebsite) GetMagicClickByLinkID() {
  4992. adminUserInfo := this.GetAdminUserInfo()
  4993. userOrgID := adminUserInfo.CurrentOrgId
  4994. fmt.Println("机构id",userOrgID)
  4995. linkid, _:= this.GetInt64("linkid")
  4996. fmt.Println("id是多少",linkid)
  4997. magiclink, err := site_service.GetMagicClickByLinkID(userOrgID, linkid)
  4998. if err !=nil{
  4999. this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
  5000. return
  5001. }
  5002. this.ServeSuccessJSON(map[string]interface{}{
  5003. "magiclink":magiclink,
  5004. })
  5005. }
  5006. func (this *Microwebsite) GeteditRotationEmages() {
  5007. adminUserInfo := this.GetAdminUserInfo()
  5008. userOrgID := adminUserInfo.CurrentOrgId
  5009. fmt.Println("机构id",userOrgID)
  5010. id, _ := this.GetInt64("id")
  5011. fmt.Println("id",id)
  5012. conrotation, err := site_service.GetEditRotationEmages(id, userOrgID)
  5013. fmt.Println("错误",err)
  5014. if err !=nil{
  5015. this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
  5016. return
  5017. }
  5018. this.ServeSuccessJSON(map[string]interface{}{
  5019. "conrotation":conrotation,
  5020. })
  5021. }
  5022. func (this *Microwebsite) GetOutRotationLink() {
  5023. adminUserInfo := this.GetAdminUserInfo()
  5024. userOrgID := adminUserInfo.CurrentOrgId
  5025. fmt.Println("机构id",userOrgID)
  5026. linkid, _ := this.GetInt64("id")
  5027. fmt.Println("id",linkid)
  5028. conlinkaddress, err := site_service.GetOutRotationLink(userOrgID, linkid)
  5029. if err !=nil{
  5030. this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
  5031. return
  5032. }
  5033. this.ServeSuccessJSON(map[string]interface{}{
  5034. "conlinkaddress":conlinkaddress,
  5035. })
  5036. }
  5037. func (this *Microwebsite) UpdatedRolinkAddress() {
  5038. adminUserInfo := this.GetAdminUserInfo()
  5039. userOrgID := adminUserInfo.CurrentOrgId
  5040. fmt.Println("机构id",userOrgID)
  5041. dataBody := make(map[string]interface{}, 0)
  5042. err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
  5043. if err != nil {
  5044. utils.ErrorLog(err.Error())
  5045. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "参数错误")
  5046. return
  5047. }
  5048. //id := int64(dataBody["id"].(float64))
  5049. id,_ := this.GetInt64("id")
  5050. fmt.Println("id是什么",id)
  5051. defineaddress :=dataBody["defineaddress"].(string)
  5052. fmt.Println("defineaddress",defineaddress)
  5053. conlinkaddress := models.SgjPatientConlinkaddress{
  5054. Defineaddress: defineaddress,
  5055. }
  5056. err = site_service.UpdatedConlinkAddress(id, userOrgID, conlinkaddress)
  5057. if err !=nil{
  5058. this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
  5059. return
  5060. }
  5061. this.ServeSuccessJSON(map[string]interface{}{
  5062. "conlinkaddress":conlinkaddress,
  5063. })
  5064. }
  5065. func (this *Microwebsite) UpdatedConrotation(){
  5066. adminUserInfo := this.GetAdminUserInfo()
  5067. userOrgID := adminUserInfo.CurrentOrgId
  5068. fmt.Println("机构id",userOrgID)
  5069. dataBody := make(map[string]interface{}, 0)
  5070. err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
  5071. if err != nil {
  5072. utils.ErrorLog(err.Error())
  5073. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "参数错误")
  5074. return
  5075. }
  5076. id, _ := this.GetInt64("id")
  5077. fmt.Println("id是什么",id)
  5078. images := dataBody["images"].(string)
  5079. fmt.Println("images是什么",images)
  5080. sort := int64(dataBody["sort"].(float64))
  5081. fmt.Println("sort",sort)
  5082. piclink := int64(dataBody["piclink"].(float64))
  5083. fmt.Println("piclink",piclink)
  5084. linkaddress := dataBody["linkaddress"].(string)
  5085. fmt.Println("linkaddress",linkaddress)
  5086. conrotation := models.SgjPatientConrotation{
  5087. Images: images,
  5088. Sort: sort,
  5089. Piclink: piclink,
  5090. Linkaddress: linkaddress,
  5091. }
  5092. err = site_service.UpdatedConrotation(id, userOrgID, conrotation)
  5093. if err !=nil{
  5094. this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
  5095. return
  5096. }
  5097. this.ServeSuccessJSON(map[string]interface{}{
  5098. "conrotation":conrotation,
  5099. })
  5100. }
  5101. func (this *Microwebsite) GetRotationVisibleByLinkId() {
  5102. adminUserInfo := this.GetAdminUserInfo()
  5103. userOrgID := adminUserInfo.CurrentOrgId
  5104. fmt.Println("机构id",userOrgID)
  5105. id, _ := this.GetInt64("id")
  5106. fmt.Println("id是什么",id)
  5107. conlinkaddress, err := site_service.GetRotationVisibleByLinkId(id, userOrgID)
  5108. fmt.Println("错误",err)
  5109. fmt.Println("conlinkaddress",conlinkaddress)
  5110. if err !=nil{
  5111. this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
  5112. return
  5113. }
  5114. this.ServeSuccessJSON(map[string]interface{}{
  5115. "conlinkaddress":conlinkaddress,
  5116. })
  5117. }
  5118. func (this *Microwebsite) AddRotationVisibleForm(){
  5119. adminUserInfo := this.GetAdminUserInfo()
  5120. userOrgID := adminUserInfo.CurrentOrgId
  5121. fmt.Println("机构id",userOrgID)
  5122. id, _ := this.GetInt64("id")
  5123. fmt.Println("id是设么",id)
  5124. dataBody := make(map[string]interface{}, 0)
  5125. err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
  5126. if err != nil {
  5127. utils.ErrorLog(err.Error())
  5128. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "参数错误")
  5129. return
  5130. }
  5131. defineaddress := dataBody["defineaddress"].(string)
  5132. fmt.Println("defineaddrss",defineaddress)
  5133. linkaddress := models.SgjPatientLinkaddress{
  5134. Defineaddress: defineaddress,
  5135. }
  5136. err = site_service.UpdatedRotationVisble(id, userOrgID, linkaddress)
  5137. if err !=nil{
  5138. this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
  5139. return
  5140. }
  5141. this.ServeSuccessJSON(map[string]interface{}{
  5142. "linkaddress":linkaddress,
  5143. })
  5144. }