site_controller.go 173KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485
  1. package site
  2. import (
  3. "SCRM/controllers"
  4. "SCRM/enums"
  5. "SCRM/models"
  6. "SCRM/service/site_service"
  7. "SCRM/utils"
  8. "encoding/json"
  9. "fmt"
  10. "github.com/astaxie/beego"
  11. "github.com/jinzhu/gorm"
  12. "strconv"
  13. "strings"
  14. "time"
  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. beego.Router("/api/site/getOrgName", &Microwebsite{}, "Get:GetOrgName")
  177. }
  178. type Microwebsite struct {
  179. controllers.BaseAPIController
  180. }
  181. //轮播图
  182. func (this *Microwebsite) AddRotaionChart() {
  183. adminUserInfo := this.GetAdminUserInfo()
  184. userOrgID := int64(adminUserInfo.CurrentOrgId)
  185. dataBody := make(map[string]interface{}, 0)
  186. err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
  187. fmt.Println("错误是什么呢", err)
  188. fmt.Println("机构ID", userOrgID)
  189. if err != nil {
  190. utils.ErrorLog(err.Error())
  191. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "参数错误")
  192. return
  193. }
  194. title := dataBody["title"].(string)
  195. if len(title) == 0 {
  196. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "模块标题不能为空")
  197. return
  198. }
  199. fmt.Println("姓名:", title)
  200. sort := int64(dataBody["sort"].(float64))
  201. if sort <= 0 {
  202. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "排序值不能为空")
  203. return
  204. }
  205. rotationImages := dataBody["rotationImages"]
  206. //图片数组转为字符串保存到数据库
  207. images := strings.Replace(strings.Trim(fmt.Sprint(rotationImages), "[]"), " ", ",", -1)
  208. fmt.Println("姓名:", rotationImages)
  209. fmt.Println("字符串", images)
  210. model := models.SgjPatientModel{
  211. Title: title,
  212. Sort: sort,
  213. UserOrgId: userOrgID,
  214. Status: 1,
  215. Ctime: time.Now().Unix(),
  216. ModeType: 1,
  217. }
  218. //fmt.Println(model)
  219. site_service.AddPatientModel(&model)
  220. fmt.Println("rotation是什么", model)
  221. patientModel, err := site_service.QueryModel(userOrgID)
  222. fmt.Println("patientModel是什麽", patientModel)
  223. idsInters := dataBody["ids"].([]interface{})
  224. fmt.Println("id集合是", idsInters)
  225. if len(idsInters) == 0 {
  226. if err != nil {
  227. this.ServeFailJsonSend(enums.ErrorCodeDBDelete, "删除会员失败:(没有选择会员)")
  228. return
  229. }
  230. }
  231. ids := make([]int64, 0)
  232. for _, idsInter := range idsInters {
  233. id := int64(idsInter.(float64))
  234. ids = append(ids, id)
  235. }
  236. rotation := models.SgjPatientRotation{
  237. Title: title,
  238. Sort: sort,
  239. RotationImages: images,
  240. UserOrgId: userOrgID,
  241. Status: 1,
  242. Ctime: time.Now().Unix(),
  243. ModelId: patientModel.ID,
  244. }
  245. editpiclink := models.SgjPatientEditpiclink{
  246. Modeid: patientModel.ID,
  247. }
  248. err = site_service.UpdateEditpicLink(userOrgID, ids, editpiclink)
  249. fmt.Println("添加错误是设么", err)
  250. addRotation := site_service.AddRotation(rotation)
  251. fmt.Println("addRotation", addRotation)
  252. patientRotation, err := site_service.GetRotationByLastData(userOrgID)
  253. if err != nil {
  254. this.ServeFailJsonSend(enums.ErrorCodeDataException, "添加医院失败")
  255. return
  256. }
  257. this.ServeSuccessJSON(map[string]interface{}{
  258. "rotation": rotation,
  259. "patientRotation": patientRotation,
  260. })
  261. }
  262. //医院介绍
  263. func (this *Microwebsite) SaveHispital() {
  264. adminUserInfo := this.GetAdminUserInfo()
  265. userOrgID := int64(adminUserInfo.CurrentOrgId)
  266. dataBody := make(map[string]interface{}, 0)
  267. err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
  268. fmt.Println("错误是什么呢", err)
  269. fmt.Println("机构ID", userOrgID)
  270. if err != nil {
  271. utils.ErrorLog(err.Error())
  272. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "参数错误")
  273. return
  274. }
  275. title := dataBody["title"].(string)
  276. if len(title) == 0 {
  277. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "模块标题不能为空")
  278. return
  279. }
  280. fmt.Println("姓名:", title)
  281. sort := dataBody["sort"].(string)
  282. if len(sort) == 0 {
  283. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "排序值不能为空")
  284. return
  285. }
  286. sortt, err := strconv.ParseInt(sort, 10, 64)
  287. fmt.Println("排序:", sortt)
  288. introduction := dataBody["introduction"].(string)
  289. if len(introduction) == 0 {
  290. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "医院介绍不能为空")
  291. return
  292. }
  293. fmt.Println("姓名是什么?", title, "排序是什么", sortt, "医院介绍不能为空", introduction)
  294. model := models.SgjPatientModel{
  295. Title: title,
  296. Sort: sortt,
  297. UserOrgId: userOrgID,
  298. Ctime: time.Now().Unix(),
  299. Status: 1,
  300. ModeType: 2,
  301. }
  302. site_service.AddPatientModel(&model)
  303. patientModel, err := site_service.QueryModel(userOrgID)
  304. hospital := models.SgjPatientHospital{
  305. Title: title,
  306. Sort: sortt,
  307. Introduction: introduction,
  308. UserOrgId: userOrgID,
  309. Ctime: time.Now().Unix(),
  310. Status: 1,
  311. Modleid: patientModel.ID,
  312. }
  313. err = site_service.AddHispital(hospital)
  314. if err != nil {
  315. this.ServeFailJsonSend(enums.ErrorCodeDataException, "添加医院失败")
  316. return
  317. }
  318. this.ServeSuccessJSON(map[string]interface{}{
  319. "hospital": hospital,
  320. })
  321. }
  322. //添加科室
  323. func (this *Microwebsite) AddOffices() {
  324. adminUserInfo := this.GetAdminUserInfo()
  325. userOrgID := int64(adminUserInfo.CurrentOrgId)
  326. dataBody := make(map[string]interface{}, 0)
  327. err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
  328. fmt.Println("错误是什么呢", err)
  329. fmt.Println("机构ID", userOrgID)
  330. if err != nil {
  331. utils.ErrorLog(err.Error())
  332. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "参数错误")
  333. return
  334. }
  335. title := dataBody["title"].(string)
  336. if len(title) == 0 {
  337. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "模块标题不能为空")
  338. return
  339. }
  340. fmt.Println("姓名:", title)
  341. sort := dataBody["sort"].(string)
  342. if len(sort) == 0 {
  343. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "排序值不能为空")
  344. return
  345. }
  346. sortt, err := strconv.ParseInt(sort, 10, 64)
  347. fmt.Println("排序:", sortt)
  348. introduction := dataBody["introduction"].(string)
  349. if len(introduction) == 0 {
  350. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "医院介绍不能为空")
  351. return
  352. }
  353. fmt.Println("姓名是什么?", title, "排序是什么", sortt, "医院介绍不能为空", introduction)
  354. model := models.SgjPatientModel{
  355. Title: title,
  356. Sort: sortt,
  357. UserOrgId: userOrgID,
  358. Ctime: time.Now().Unix(),
  359. Status: 1,
  360. ModeType: 3,
  361. }
  362. site_service.AddPatientModel(&model)
  363. patientModel, err := site_service.QueryModel(userOrgID)
  364. offices := models.SgjPatientOffices{
  365. Title: title,
  366. Sort: sortt,
  367. Introduction: introduction,
  368. UserOrgId: userOrgID,
  369. Ctime: time.Now().Unix(),
  370. Status: 1,
  371. Modleid: patientModel.ID,
  372. }
  373. err = site_service.AddOffices(offices)
  374. if err != nil {
  375. this.ServeFailJsonSend(enums.ErrorCodeDataException, "添加医院失败")
  376. return
  377. }
  378. this.ServeSuccessJSON(map[string]interface{}{
  379. "offices": offices,
  380. })
  381. }
  382. //添加名医
  383. func (this *Microwebsite) AddDoctor() {
  384. adminUserInfo := this.GetAdminUserInfo()
  385. userOrgID := int64(adminUserInfo.CurrentOrgId)
  386. dataBody := make(map[string]interface{}, 0)
  387. err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
  388. fmt.Println("错误是什么呢", err)
  389. fmt.Println("机构ID", userOrgID)
  390. if err != nil {
  391. utils.ErrorLog(err.Error())
  392. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "参数错误")
  393. return
  394. }
  395. title := dataBody["title"].(string)
  396. if len(title) == 0 {
  397. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "模块标题不能为空")
  398. return
  399. }
  400. fmt.Println("姓名:", title)
  401. sort := dataBody["sort"].(string)
  402. if len(sort) == 0 {
  403. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "排序值不能为空")
  404. return
  405. }
  406. sortt, err := strconv.ParseInt(sort, 10, 64)
  407. fmt.Println("排序:", sortt)
  408. images := dataBody["docimages"]
  409. replace := strings.Replace(strings.Trim(fmt.Sprint(images), "[]"), " ", ",", -1)
  410. //if len(image) == 0 {
  411. // this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "医院介绍不能为空")
  412. // return
  413. idsInters := dataBody["ids"].([]interface{})
  414. fmt.Println("id集合是", idsInters)
  415. if len(idsInters) == 0 {
  416. if err != nil {
  417. this.ServeFailJsonSend(enums.ErrorCodeDBDelete, "删除会员失败:(没有选择会员)")
  418. return
  419. }
  420. }
  421. ids := make([]int64, 0)
  422. for _, idsInter := range idsInters {
  423. id := int64(idsInter.(float64))
  424. ids = append(ids, id)
  425. }
  426. fmt.Println("姓名是什么?", title, "排序是什么", sortt, "图片", replace)
  427. model := models.SgjPatientModel{
  428. Title: title,
  429. Sort: sortt,
  430. UserOrgId: userOrgID,
  431. Ctime: time.Now().Unix(),
  432. Status: 1,
  433. ModeType: 4,
  434. }
  435. site_service.AddPatientModel(&model)
  436. patientModel, err := site_service.QueryModel(userOrgID)
  437. fmt.Println("模块ID", patientModel.ID)
  438. docinfo := models.SgjPatientDocinfo{
  439. Title: title,
  440. Sort: sortt,
  441. Docimages: replace,
  442. UserOrgId: userOrgID,
  443. Ctime: time.Now().Unix(),
  444. Status: 1,
  445. Modelid: patientModel.ID,
  446. }
  447. err = site_service.AddDoctor(docinfo)
  448. editdoctor := models.SgjPatientEditdoctor{
  449. Modleid: patientModel.ID,
  450. }
  451. err = site_service.UpdateDoctorsInfo(userOrgID, ids, editdoctor)
  452. if err != nil {
  453. this.ServeFailJsonSend(enums.ErrorCodeDataException, "添加医院失败")
  454. return
  455. }
  456. this.ServeSuccessJSON(map[string]interface{}{
  457. "doctor": docinfo,
  458. })
  459. }
  460. //添加名医介绍
  461. func (this *Microwebsite) AddDoctorInfo() {
  462. adminUserInfo := this.GetAdminUserInfo()
  463. userOrgID := int64(adminUserInfo.CurrentOrgId)
  464. dataBody := make(map[string]interface{}, 0)
  465. err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
  466. fmt.Println("错误是什么呢", err)
  467. fmt.Println("机构ID", userOrgID)
  468. if err != nil {
  469. utils.ErrorLog(err.Error())
  470. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "参数错误")
  471. return
  472. }
  473. docname := dataBody["name"].(string)
  474. if len(docname) == 0 {
  475. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "医生姓名不能为空")
  476. return
  477. }
  478. fmt.Println("医生姓名:", docname)
  479. docHead := dataBody["dochead"].(string)
  480. if len(docHead) == 0 {
  481. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "医生头像不能为空")
  482. return
  483. }
  484. fmt.Println("医生头像:", docHead)
  485. sort := dataBody["sort"].(string)
  486. if len(sort) == 0 {
  487. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "排序值不能为空")
  488. return
  489. }
  490. sortt, err := strconv.ParseInt(sort, 10, 64)
  491. fmt.Println("排序:", sortt)
  492. docpositional := int64(dataBody["user_title"].(float64))
  493. if docpositional <= 0 {
  494. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "医生职位不能为空")
  495. return
  496. }
  497. fmt.Println("医生职位", docpositional)
  498. docintroduction := dataBody["content"].(string)
  499. fmt.Println("医生简介", docintroduction)
  500. if len(docintroduction) == 0 {
  501. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "医生简介不能为空")
  502. return
  503. }
  504. fmt.Println("医生姓名", docname, "医生职位", docpositional, "医生头像", docHead, "医生简介", docintroduction)
  505. editdoctor := models.SgjPatientEditdoctor{
  506. DocName: docname,
  507. Dochead: docHead,
  508. DocPostion: docpositional,
  509. Docintroduction: docintroduction,
  510. Ctime: time.Now().Unix(),
  511. UserOrgId: userOrgID,
  512. DocSort: sortt,
  513. Status: 1,
  514. ImgShow: 1,
  515. }
  516. err = site_service.AddDoctorInfo(editdoctor)
  517. if err != nil {
  518. this.ServeFailJsonSend(enums.ErrorCodeDataException, "添加医生失败")
  519. return
  520. }
  521. this.ServeSuccessJSON(map[string]interface{}{
  522. "doctor": editdoctor,
  523. })
  524. }
  525. //新增科室环境
  526. func (this *Microwebsite) AddKeEnvironment() {
  527. adminUserInfo := this.GetAdminUserInfo()
  528. userOrgID := int64(adminUserInfo.CurrentOrgId)
  529. dataBody := make(map[string]interface{}, 0)
  530. err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
  531. fmt.Println("错误是什么呢", err)
  532. fmt.Println("机构ID", userOrgID)
  533. if err != nil {
  534. utils.ErrorLog(err.Error())
  535. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "参数错误")
  536. return
  537. }
  538. title := dataBody["title"].(string)
  539. if len(title) == 0 {
  540. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "模块标题不能为空")
  541. return
  542. }
  543. fmt.Println("标题:", title)
  544. sort := int64(dataBody["sort"].(float64))
  545. keImages := dataBody["keImages"]
  546. //图片数组转为字符串保存到数据库
  547. replace := strings.Replace(strings.Trim(fmt.Sprint(keImages), "[]"), " ", ",", -1)
  548. fmt.Println("图片:", keImages)
  549. fmt.Println("字符串", replace)
  550. idsInters := dataBody["ids"].([]interface{})
  551. fmt.Println("id集合是", idsInters)
  552. if len(idsInters) == 0 {
  553. if err != nil {
  554. this.ServeFailJsonSend(enums.ErrorCodeDBDelete, "删除会员失败:(没有选择会员)")
  555. return
  556. }
  557. }
  558. ids := make([]int64, 0)
  559. for _, idsInter := range idsInters {
  560. id := int64(idsInter.(float64))
  561. ids = append(ids, id)
  562. }
  563. fmt.Println("ids是什么", ids)
  564. model := models.SgjPatientModel{
  565. Title: title,
  566. Sort: sort,
  567. UserOrgId: userOrgID,
  568. Ctime: time.Now().Unix(),
  569. Status: 1,
  570. ModeType: 5,
  571. }
  572. site_service.AddPatientModel(&model)
  573. patientModel, err := site_service.QueryModel(userOrgID)
  574. enviroimages := models.SgjPatientEnviroimages{
  575. Modeid: patientModel.ID,
  576. }
  577. err = site_service.UpdateImages(userOrgID, ids, enviroimages)
  578. fmt.Println("错误", err)
  579. officenviroment := models.SgjPatientOffenvironment{
  580. Title: title,
  581. Sort: sort,
  582. Keimages: replace,
  583. Mtime: time.Now().Unix(),
  584. UserOrgId: userOrgID,
  585. Status: 1,
  586. Modelid: patientModel.ID,
  587. }
  588. err = site_service.AddOffEnvironment(officenviroment)
  589. if err != nil {
  590. this.ServeFailJsonSend(enums.ErrorCodeDataException, "添加科室环境失败")
  591. return
  592. }
  593. this.ServeSuccessJSON(map[string]interface{}{
  594. "offenvironment": officenviroment,
  595. })
  596. }
  597. //获取轮播图
  598. func (this *Microwebsite) GetRationImages() {
  599. adminUserInfo := this.GetAdminUserInfo()
  600. userOrgID := int64(adminUserInfo.CurrentOrgId)
  601. rotation, err := site_service.GetRationImages(userOrgID)
  602. if err != nil {
  603. this.ServeFailJsonSend(enums.ErrorCodeDataException, "获取轮播图失败")
  604. return
  605. }
  606. fmt.Println("错误是什么", err)
  607. fmt.Println("获取的数据", rotation)
  608. this.ServeSuccessJSON(map[string]interface{}{
  609. "rotationImages": rotation,
  610. })
  611. }
  612. //获取医院信息
  613. func (this *Microwebsite) GetHospitalinfo() {
  614. adminUserInfo := this.GetAdminUserInfo()
  615. userOrgID := int64(adminUserInfo.CurrentOrgId)
  616. hospital, err := site_service.GetHospitalInfo(userOrgID)
  617. fmt.Println("数据是什么", hospital)
  618. if err != nil {
  619. this.ServeFailJsonSend(enums.ErrorCodeDataException, "获取轮播图失败")
  620. return
  621. }
  622. this.ServeSuccessJSON(map[string]interface{}{
  623. "hospital": hospital,
  624. })
  625. }
  626. //获取科室信息
  627. func (this *Microwebsite) GetOfficeInfo() {
  628. adminUserInfo := this.GetAdminUserInfo()
  629. userOrgID := int64(adminUserInfo.CurrentOrgId)
  630. offices, err := site_service.GetOfficeInfo(userOrgID)
  631. fmt.Println("科室介绍数据是什么", offices)
  632. if err != nil {
  633. this.ServeFailJsonSend(enums.ErrorCodeDataException, "获取轮播图失败")
  634. return
  635. }
  636. this.ServeSuccessJSON(map[string]interface{}{
  637. "offices": offices,
  638. })
  639. }
  640. func (this *Microwebsite) GetQueryDocInfo() {
  641. adminUserInfo := this.GetAdminUserInfo()
  642. userOrgID := int64(adminUserInfo.CurrentOrgId)
  643. doc, err := site_service.GetQueryDocInfo(userOrgID)
  644. if err != nil {
  645. this.ServeFailJsonSend(enums.ErrorCodeDataException, "获取名医介绍失败")
  646. return
  647. }
  648. this.ServeSuccessJSON(map[string]interface{}{
  649. "doctor": doc,
  650. })
  651. }
  652. func (this *Microwebsite) GetQueryDocHead() {
  653. adminUserInfo := this.GetAdminUserInfo()
  654. userOrgID := int64(adminUserInfo.CurrentOrgId)
  655. docHead, err := site_service.GetQueryDocHead(userOrgID)
  656. fmt.Println("错误是设么", err)
  657. fmt.Println("docHead是什么", docHead)
  658. if err != nil {
  659. this.ServeFailJsonSend(enums.ErrorCodeDataException, "获取名医介绍失败")
  660. return
  661. }
  662. this.ServeSuccessJSON(map[string]interface{}{
  663. "docHead": docHead,
  664. })
  665. }
  666. //获取科室环境
  667. func (this *Microwebsite) GetOffEnvironment() {
  668. adminUserInfo := this.GetAdminUserInfo()
  669. userOrgID := int64(adminUserInfo.CurrentOrgId)
  670. offenvironment, err := site_service.GetOffEnvironment(userOrgID)
  671. fmt.Println("错误是什么", err)
  672. fmt.Println("科室环境数据", offenvironment)
  673. if err != nil {
  674. this.ServeFailJsonSend(enums.ErrorCodeDataException, "获取名医介绍失败")
  675. return
  676. }
  677. this.ServeSuccessJSON(map[string]interface{}{
  678. "offenvironment": offenvironment,
  679. })
  680. }
  681. //添加联系我们的轮播图
  682. func (this *Microwebsite) AddRotationUpload() {
  683. adminUserInfo := this.GetAdminUserInfo()
  684. userOrgID := int64(adminUserInfo.CurrentOrgId)
  685. dataBody := make(map[string]interface{}, 0)
  686. err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
  687. fmt.Println("错误是什么呢", err)
  688. fmt.Println("机构ID", userOrgID)
  689. if err != nil {
  690. utils.ErrorLog(err.Error())
  691. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "参数错误")
  692. return
  693. }
  694. title := dataBody["title"].(string)
  695. if len(title) == 0 {
  696. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "模块标题不能为空")
  697. return
  698. }
  699. fmt.Println("姓名:", title)
  700. sort := dataBody["sort"].(string)
  701. if len(sort) == 0 {
  702. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "排序值不能为空")
  703. return
  704. }
  705. sortt, err := strconv.ParseInt(sort, 10, 64)
  706. fmt.Println("排序:", sortt)
  707. rotationImages := dataBody["rotationImages"]
  708. //图片数组转为字符串保存到数据库
  709. replace := strings.Replace(strings.Trim(fmt.Sprint(rotationImages), "[]"), " ", ",", -1)
  710. fmt.Println("姓名:", rotationImages)
  711. fmt.Println("字符串", replace)
  712. connecmodel := models.SgjPatientConnecmodel{
  713. Title: title,
  714. Sort: sortt,
  715. RotationImages: replace,
  716. UserOrgId: userOrgID,
  717. Status: 1,
  718. ModeType: 1,
  719. Ctime: time.Now().Unix(),
  720. }
  721. err = site_service.AddRotationUpload(&connecmodel)
  722. if err != nil {
  723. this.ServeFailJsonSend(enums.ErrorCodeDataException, "获取名医介绍失败")
  724. return
  725. }
  726. this.ServeSuccessJSON(map[string]interface{}{
  727. "connecmodel": connecmodel,
  728. })
  729. }
  730. //添加工作时间
  731. func (this *Microwebsite) AddWorkTime() {
  732. adminUserInfo := this.GetAdminUserInfo()
  733. userOrgID := int64(adminUserInfo.CurrentOrgId)
  734. dataBody := make(map[string]interface{}, 0)
  735. err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
  736. fmt.Println("错误是什么呢", err)
  737. fmt.Println("机构ID", userOrgID)
  738. if err != nil {
  739. utils.ErrorLog(err.Error())
  740. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "参数错误")
  741. return
  742. }
  743. title := dataBody["title"].(string)
  744. if len(title) == 0 {
  745. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "模块标题不能为空")
  746. return
  747. }
  748. sort := int64(dataBody["sort"].(float64))
  749. if sort <= 0 {
  750. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "排序值不能为空")
  751. return
  752. }
  753. worktime := dataBody["worktime"].(string)
  754. if len(worktime) == 0 {
  755. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "工作时间不能为空")
  756. return
  757. }
  758. ordmodel := models.SgjPatientOrdmodel{
  759. Title: title,
  760. Sort: sort,
  761. Status: 1,
  762. UserOrgId: userOrgID,
  763. ModeType: 4,
  764. Ctime: time.Now().Unix(),
  765. }
  766. //添加模块
  767. err = site_service.AddOrdModel(&ordmodel)
  768. model, err := site_service.QueryOrdeModelByID(userOrgID)
  769. patientWorktime := models.SgjPatientWorktime{
  770. Title: title,
  771. Sort: sort,
  772. Worktime: worktime,
  773. UserOrgId: userOrgID,
  774. Status: 1,
  775. Ctime: time.Now().Unix(),
  776. ModeId: model.ID,
  777. }
  778. err = site_service.AddWorkTime(&patientWorktime)
  779. if err != nil {
  780. this.ServeFailJsonSend(enums.ErrorCodeDataException, "添加乘车方式失败")
  781. return
  782. }
  783. this.ServeSuccessJSON(map[string]interface{}{
  784. "ordmodel": ordmodel,
  785. "patientWorktime": patientWorktime,
  786. })
  787. }
  788. //添加乘车方式
  789. func (this *Microwebsite) AddRideway() {
  790. adminUserInfo := this.GetAdminUserInfo()
  791. userOrgID := int64(adminUserInfo.CurrentOrgId)
  792. dataBody := make(map[string]interface{}, 0)
  793. err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
  794. fmt.Println("错误是什么呢", err)
  795. fmt.Println("机构ID", userOrgID)
  796. if err != nil {
  797. utils.ErrorLog(err.Error())
  798. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "参数错误")
  799. return
  800. }
  801. title := dataBody["title"].(string)
  802. if len(title) == 0 {
  803. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "模块标题不能为空")
  804. return
  805. }
  806. fmt.Println("姓名:", title)
  807. sort := int64(dataBody["sort"].(float64))
  808. if sort <= 0 {
  809. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "排序值不能为空")
  810. return
  811. }
  812. fmt.Println("排序:", sort)
  813. content := dataBody["content"].(string)
  814. if len(content) == 0 {
  815. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "乘车方式不能为空")
  816. return
  817. }
  818. ordemodel := models.SgjPatientOrdmodel{
  819. Title: title,
  820. Sort: sort,
  821. UserOrgId: userOrgID,
  822. Status: 1,
  823. ModeType: 5,
  824. Ctime: time.Now().Unix(),
  825. }
  826. err = site_service.AddOrdModel(&ordemodel)
  827. model, err := site_service.QueryOrdeModelByID(userOrgID)
  828. rideway := models.SgjPatientRideway{
  829. Title: title,
  830. Sort: sort,
  831. RideWay: content,
  832. UserOrgId: userOrgID,
  833. Status: 1,
  834. ModeId: model.ID,
  835. Ctime: time.Now().Unix(),
  836. }
  837. err = site_service.AddRideWay(rideway)
  838. if err != nil {
  839. this.ServeFailJsonSend(enums.ErrorCodeDataException, "添加乘车方式失败")
  840. return
  841. }
  842. this.ServeSuccessJSON(map[string]interface{}{
  843. "ordemodel": ordemodel,
  844. "rideway": rideway,
  845. })
  846. }
  847. //添加联系方式
  848. func (this *Microwebsite) AddConnection() {
  849. adminUserInfo := this.GetAdminUserInfo()
  850. userOrgID := int64(adminUserInfo.CurrentOrgId)
  851. dataBody := make(map[string]interface{}, 0)
  852. err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
  853. fmt.Println("错误是什么呢", err)
  854. if err != nil {
  855. utils.ErrorLog(err.Error())
  856. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "参数错误")
  857. return
  858. }
  859. title := dataBody["title"].(string)
  860. if len(title) == 0 {
  861. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "模块标题不能为空")
  862. return
  863. }
  864. fmt.Println("姓名:", title)
  865. connecway := int64(dataBody["connecway"].(float64))
  866. if connecway < 0 {
  867. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "联系方式不能为空")
  868. return
  869. }
  870. fmt.Println("联系方式", connecway)
  871. content := dataBody["content"].(string)
  872. if len(content) == 0 {
  873. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "模块标题不能为空")
  874. return
  875. }
  876. fmt.Println("内容", content)
  877. connection := models.SgjPatientConnection{
  878. Title: title,
  879. Connecway: connecway,
  880. Content: content,
  881. Status: 1,
  882. Ctime: time.Now().Unix(),
  883. UserOrgId: userOrgID,
  884. }
  885. err = site_service.AddConnetion(connection)
  886. if err != nil {
  887. this.ServeFailJsonSend(enums.ErrorCodeDataException, "添加联系方式失败")
  888. return
  889. }
  890. this.ServeSuccessJSON(map[string]interface{}{
  891. "connection": connection,
  892. })
  893. }
  894. //获取联系方式
  895. func (this *Microwebsite) GetQueryConnection() {
  896. adminUserInfo := this.GetAdminUserInfo()
  897. userOrgID := int64(adminUserInfo.CurrentOrgId)
  898. conection, err := site_service.GetQueryConnection(userOrgID)
  899. fmt.Println("conections是啥", conection)
  900. if err != nil {
  901. this.ServeFailJsonSend(enums.ErrorCodeDataException, "添加乘车方式失败")
  902. return
  903. }
  904. this.ServeSuccessJSON(map[string]interface{}{
  905. "conection": conection,
  906. })
  907. }
  908. //删除联系人
  909. func (this *Microwebsite) DeleteConnecWay() {
  910. adminUserInfo := this.GetAdminUserInfo()
  911. userOrgID := int64(adminUserInfo.CurrentOrgId)
  912. id, _ := this.GetInt64("id")
  913. fmt.Println("id是啥?", id)
  914. err := site_service.DeleteConnecWay(userOrgID, id)
  915. if err != nil {
  916. this.ServeFailJsonSend(enums.ErrorCodeDataException, "删除回复成功")
  917. return
  918. }
  919. returnData := make(map[string]interface{}, 0)
  920. returnData["msg"] = "ok"
  921. this.ServeSuccessJSON(returnData)
  922. return
  923. }
  924. //编辑联系人
  925. func (this *Microwebsite) EditConnecWay() {
  926. adminUserInfo := this.GetAdminUserInfo()
  927. id, _ := this.GetInt64("id")
  928. fmt.Println("id是啥?", id)
  929. userOrgID := int64(adminUserInfo.CurrentOrgId)
  930. connection, err := site_service.EditConnecWay(userOrgID, id)
  931. if err != nil {
  932. this.ServeFailJsonSend(enums.ErrorCodeDataException, "删除回复成功")
  933. return
  934. }
  935. this.ServeSuccessJSON(map[string]interface{}{
  936. "connection": connection,
  937. })
  938. }
  939. func (this *Microwebsite) SaveConnection() {
  940. adminUserInfo := this.GetAdminUserInfo()
  941. userOrgID := int64(adminUserInfo.CurrentOrgId)
  942. fmt.Println("机构ID", userOrgID)
  943. id, _ := this.GetInt64("id")
  944. fmt.Println("id是啥?", id)
  945. dataBody := make(map[string]interface{}, 0)
  946. err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
  947. if err != nil {
  948. utils.ErrorLog(err.Error())
  949. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "参数错误")
  950. return
  951. }
  952. title := dataBody["title"].(string)
  953. fmt.Println("title", title)
  954. if len(title) == 0 {
  955. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "模块标题不能为空")
  956. return
  957. }
  958. connecway := int64(dataBody["connecway"].(float64))
  959. fmt.Println("connecway", connecway)
  960. content := dataBody["content"].(string)
  961. fmt.Println("content", content)
  962. if len(content) == 0 {
  963. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "联系方式不能为空")
  964. return
  965. }
  966. connection := models.SgjPatientConnection{
  967. Title: title,
  968. Connecway: connecway,
  969. Content: content,
  970. }
  971. site_service.UpadateConnec(&connection, userOrgID, id)
  972. this.ServeSuccessJSON(map[string]interface{}{
  973. "connection": connection,
  974. })
  975. }
  976. //新增联系方式
  977. func (this *Microwebsite) AddContract() {
  978. adminUserInfo := this.GetAdminUserInfo()
  979. userOrgID := int64(adminUserInfo.CurrentOrgId)
  980. fmt.Println("机构ID", userOrgID)
  981. dataBody := make(map[string]interface{}, 0)
  982. err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
  983. if err != nil {
  984. utils.ErrorLog(err.Error())
  985. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "参数错误")
  986. return
  987. }
  988. title := dataBody["title"].(string)
  989. fmt.Println("联系模块标题", title)
  990. if len(title) == 0 {
  991. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "模块标题不能为空")
  992. return
  993. }
  994. sort := int64(dataBody["sort"].(float64))
  995. fmt.Println("联系模快排序", sort)
  996. if sort == 0 {
  997. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "模块标题不能为空")
  998. return
  999. }
  1000. //ids := dataBody["connecWayId"]
  1001. //fmt.Println("联系方式",ids)
  1002. //connecwayId := strings.Replace(strings.Trim(fmt.Sprint(ids), "[]"), " ", ",", -1)
  1003. //tittles := dataBody["conectitle"]
  1004. //tittless := strings.Replace(strings.Trim(fmt.Sprint(tittles), "[]"), " ", ",", -1)
  1005. //fmt.Println("联系名称",tittless)
  1006. //conneccontent := dataBody["conneccontent"]
  1007. //conneccontents := strings.Replace(strings.Trim(fmt.Sprint(conneccontent), "[]"), " ", ",", -1)
  1008. ordmodel := models.SgjPatientOrdmodel{
  1009. Title: title,
  1010. UserOrgId: userOrgID,
  1011. Sort: sort,
  1012. Ctime: time.Now().Unix(),
  1013. ModeType: 3,
  1014. Status: 1,
  1015. }
  1016. err = site_service.AddOrdModel(&ordmodel)
  1017. patientOrdmodel, err := site_service.QueryOrdeModelByID(userOrgID)
  1018. connectway := models.SgjPatientConnectway{
  1019. Title: title,
  1020. Sort: sort,
  1021. UserOrgId: userOrgID,
  1022. Ctime: time.Now().Unix(),
  1023. Status: 1,
  1024. ModeId: patientOrdmodel.ID,
  1025. }
  1026. err = site_service.AddConnecWay(&connectway)
  1027. if err != nil {
  1028. this.ServeFailJsonSend(enums.ErrorCodeDataException, "删除回复成功")
  1029. return
  1030. }
  1031. this.ServeSuccessJSON(map[string]interface{}{
  1032. "connectway": connectway,
  1033. "ordmodel": ordmodel,
  1034. })
  1035. }
  1036. func (this *Microwebsite) GetUserdModel() {
  1037. adminUserInfo := this.GetAdminUserInfo()
  1038. userOrgID := int64(adminUserInfo.CurrentOrgId)
  1039. model, err := site_service.GetUserModel(userOrgID)
  1040. if err != nil {
  1041. this.ServeFailJsonSend(enums.ErrorCodeDataException, "删除回复成功")
  1042. return
  1043. }
  1044. fmt.Println("err")
  1045. fmt.Println("模型是什么", model)
  1046. this.ServeSuccessJSON(map[string]interface{}{
  1047. "model": model,
  1048. })
  1049. }
  1050. func (this *Microwebsite) GetQueryNewModel() {
  1051. adminUserInfo := this.GetAdminUserInfo()
  1052. userOrgID := int64(adminUserInfo.CurrentOrgId)
  1053. model, err := site_service.GetQueryNewModel(userOrgID)
  1054. fmt.Println("查询新增模块数据是什么?", model)
  1055. if err != nil {
  1056. this.ServeFailJsonSend(enums.ErrorCodeDataException, "删除回复成功")
  1057. return
  1058. }
  1059. fmt.Println("err")
  1060. fmt.Println("返回新增模块模型是什么", model)
  1061. this.ServeSuccessJSON(map[string]interface{}{
  1062. "model": model,
  1063. })
  1064. }
  1065. func (this *Microwebsite) GetEditModel() {
  1066. adminUserInfo := this.GetAdminUserInfo()
  1067. id, _ := this.GetInt64("id")
  1068. fmt.Println("模块id是啥?", id)
  1069. userOrgID := int64(adminUserInfo.CurrentOrgId)
  1070. worktime, err := site_service.GetEditModel(userOrgID, id)
  1071. if err != nil {
  1072. this.ServeFailJsonSend(enums.ErrorCodeDataException, "删除回复成功")
  1073. return
  1074. }
  1075. this.ServeSuccessJSON(map[string]interface{}{
  1076. "worktime": worktime,
  1077. })
  1078. }
  1079. func (this *Microwebsite) EditRideWay() {
  1080. adminUserInfo := this.GetAdminUserInfo()
  1081. id, _ := this.GetInt64("id")
  1082. fmt.Println("模块id是啥?", id)
  1083. userOrgID := int64(adminUserInfo.CurrentOrgId)
  1084. rideway, err := site_service.GetEditRideWay(userOrgID, id)
  1085. if err != nil {
  1086. this.ServeFailJsonSend(enums.ErrorCodeDataException, "删除回复成功")
  1087. return
  1088. }
  1089. this.ServeSuccessJSON(map[string]interface{}{
  1090. "rideway": rideway,
  1091. })
  1092. }
  1093. //保存编辑后的工作时间
  1094. func (this *Microwebsite) SaveWorktTime() {
  1095. adminUserInfo := this.GetAdminUserInfo()
  1096. id, _ := this.GetInt64("id")
  1097. fmt.Println("模块id是啥?", id)
  1098. userOrgID := int64(adminUserInfo.CurrentOrgId)
  1099. dataBody := make(map[string]interface{}, 0)
  1100. err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
  1101. if err != nil {
  1102. utils.ErrorLog(err.Error())
  1103. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "参数错误")
  1104. return
  1105. }
  1106. title := dataBody["title"].(string)
  1107. if len(title) == 0 {
  1108. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "模块标题不能为空")
  1109. return
  1110. }
  1111. fmt.Println("姓名:", title)
  1112. sort := int64(dataBody["sort"].(float64))
  1113. if sort <= 0 {
  1114. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "排序值不能为空")
  1115. return
  1116. }
  1117. fmt.Println("排序:", sort)
  1118. worktime := dataBody["worktime"].(string)
  1119. fmt.Println("工作时间", worktime)
  1120. if len(worktime) == 0 {
  1121. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "模块标题不能为空")
  1122. return
  1123. }
  1124. modeid := int64(dataBody["mode_id"].(float64))
  1125. fmt.Println("模块ID", modeid)
  1126. ordmodel := models.SgjPatientOrdmodel{
  1127. Title: title,
  1128. Sort: sort,
  1129. }
  1130. err = site_service.UpdateOrdeModel(modeid, userOrgID, ordmodel)
  1131. patientWorktime := models.SgjPatientWorktime{
  1132. Title: title,
  1133. Sort: sort,
  1134. Worktime: worktime,
  1135. }
  1136. err = site_service.UpdateWorkTime(id, userOrgID, patientWorktime)
  1137. if err != nil {
  1138. this.ServeFailJsonSend(enums.ErrorCodeDataException, "删除回复成功")
  1139. return
  1140. }
  1141. this.ServeSuccessJSON(map[string]interface{}{
  1142. "patientWorktime": patientWorktime,
  1143. })
  1144. }
  1145. //保存编辑后的乘车方式
  1146. func (this *Microwebsite) Saverideway() {
  1147. adminUserInfo := this.GetAdminUserInfo()
  1148. id, _ := this.GetInt64("id")
  1149. fmt.Println("模块id是啥?", id)
  1150. userOrgID := int64(adminUserInfo.CurrentOrgId)
  1151. dataBody := make(map[string]interface{}, 0)
  1152. err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
  1153. if err != nil {
  1154. utils.ErrorLog(err.Error())
  1155. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "参数错误")
  1156. return
  1157. }
  1158. title := dataBody["title"].(string)
  1159. if len(title) == 0 {
  1160. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "模块标题不能为空")
  1161. return
  1162. }
  1163. fmt.Println("标题:", title)
  1164. sort := int64(dataBody["sort"].(float64))
  1165. if sort <= 0 {
  1166. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "排序值不能为空")
  1167. return
  1168. }
  1169. fmt.Println("排序:", sort)
  1170. rideway := dataBody["ride_way"].(string)
  1171. fmt.Println("工作时间", rideway)
  1172. if len(rideway) == 0 {
  1173. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "模块标题不能为空")
  1174. return
  1175. }
  1176. modeid := int64(dataBody["mode_id"].(float64))
  1177. fmt.Println("模块ID", modeid)
  1178. ridewaymodel := models.SgjPatientRideway{
  1179. Title: title,
  1180. Sort: sort,
  1181. RideWay: rideway,
  1182. }
  1183. ordmodel := models.SgjPatientOrdmodel{
  1184. Title: title,
  1185. Sort: sort,
  1186. }
  1187. err = site_service.UpdateRideWay(id, userOrgID, ridewaymodel)
  1188. fmt.Println("错误是设么", err)
  1189. err = site_service.UpdateOrdeModel(modeid, userOrgID, ordmodel)
  1190. fmt.Println("错误是什么?", err)
  1191. if err != nil {
  1192. this.ServeFailJsonSend(enums.ErrorCodeDataException, "删除回复成功")
  1193. return
  1194. }
  1195. this.ServeSuccessJSON(map[string]interface{}{
  1196. "ridewaymodel": ridewaymodel,
  1197. })
  1198. }
  1199. func (this *Microwebsite) Change() {
  1200. adminUserInfo := this.GetAdminUserInfo()
  1201. id, _ := this.GetInt64("id")
  1202. fmt.Println("医生id是啥?", id)
  1203. userOrgID := int64(adminUserInfo.CurrentOrgId)
  1204. fmt.Println("机构id", userOrgID)
  1205. docinfo, err := site_service.QueryDocById(userOrgID, id)
  1206. if err != nil {
  1207. this.ServeFailJsonSend(enums.ErrorCodeDataException, "删除回复成功")
  1208. return
  1209. }
  1210. this.ServeSuccessJSON(map[string]interface{}{
  1211. "docinfo": docinfo,
  1212. })
  1213. }
  1214. func (this *Microwebsite) DeleteDoctor() {
  1215. adminUserInfo := this.GetAdminUserInfo()
  1216. id, _ := this.GetInt64("id")
  1217. fmt.Println("保存id是啥?", id)
  1218. userOrgID := int64(adminUserInfo.CurrentOrgId)
  1219. err := site_service.DeleteDoctor(id, userOrgID)
  1220. if err != nil {
  1221. this.ServeFailJsonSend(enums.ErrorCodeDataException, "删除成功")
  1222. return
  1223. }
  1224. returnData := make(map[string]interface{}, 0)
  1225. returnData["msg"] = "ok"
  1226. this.ServeSuccessJSON(returnData)
  1227. return
  1228. }
  1229. func (this *Microwebsite) EditHospital() {
  1230. adminUserInfo := this.GetAdminUserInfo()
  1231. id, _ := this.GetInt64("id")
  1232. fmt.Println("保存id是啥?", id)
  1233. userOrgID := int64(adminUserInfo.CurrentOrgId)
  1234. hospital, err := site_service.EditHospital(id, userOrgID)
  1235. fmt.Println("参训是什么", hospital)
  1236. fmt.Println(err)
  1237. if err != nil {
  1238. this.ServeFailJsonSend(enums.ErrorCodeDataException, "删除回复成功")
  1239. return
  1240. }
  1241. this.ServeSuccessJSON(map[string]interface{}{
  1242. "hospital": hospital,
  1243. })
  1244. }
  1245. func (this *Microwebsite) SaveHospital() {
  1246. adminUserInfo := this.GetAdminUserInfo()
  1247. id, _ := this.GetInt64("id")
  1248. fmt.Println("保存id是啥?", id)
  1249. userOrgID := int64(adminUserInfo.CurrentOrgId)
  1250. fmt.Println(userOrgID)
  1251. dataBody := make(map[string]interface{}, 0)
  1252. err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
  1253. if err != nil {
  1254. utils.ErrorLog(err.Error())
  1255. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "参数错误")
  1256. return
  1257. }
  1258. title := dataBody["title"].(string)
  1259. if len(title) == 0 {
  1260. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "模块标题不能为空")
  1261. return
  1262. }
  1263. fmt.Println("标题:", title)
  1264. sort := int64(dataBody["sort"].(float64))
  1265. fmt.Println("sort是神", sort)
  1266. if sort <= 0 {
  1267. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "排序值不能为空")
  1268. return
  1269. }
  1270. fmt.Println("排序:", sort)
  1271. introduction := dataBody["introduction"].(string)
  1272. if len(introduction) == 0 {
  1273. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "模块标题不能为空")
  1274. return
  1275. }
  1276. modleid := int64(dataBody["modleid"].(float64))
  1277. if modleid <= 0 {
  1278. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "模块ID不能为空")
  1279. return
  1280. }
  1281. fmt.Println("模块id", modleid)
  1282. hospital := models.SgjPatientHospital{
  1283. Title: title,
  1284. Sort: sort,
  1285. Introduction: introduction,
  1286. }
  1287. err = site_service.UpdateHospital(id, userOrgID, hospital)
  1288. model := models.SgjPatientModel{
  1289. Title: title,
  1290. Sort: sort,
  1291. }
  1292. fmt.Println(hospital)
  1293. Modelerr := site_service.UpdateModel(modleid, userOrgID, model)
  1294. fmt.Println("错误是什么", Modelerr)
  1295. fmt.Println("错误是什么", err)
  1296. if err != nil {
  1297. this.ServeFailJsonSend(enums.ErrorCodeDataException, "删除回复成功")
  1298. return
  1299. }
  1300. this.ServeSuccessJSON(map[string]interface{}{
  1301. "hospital": hospital,
  1302. "model": model,
  1303. })
  1304. }
  1305. func (this *Microwebsite) EditOffice() {
  1306. adminUserInfo := this.GetAdminUserInfo()
  1307. id, _ := this.GetInt64("id")
  1308. fmt.Println("保存id是啥?", id)
  1309. userOrgID := int64(adminUserInfo.CurrentOrgId)
  1310. offices, err := site_service.EditOffice(id, userOrgID)
  1311. if err != nil {
  1312. this.ServeFailJsonSend(enums.ErrorCodeDataException, "删除回复成功")
  1313. return
  1314. }
  1315. this.ServeSuccessJSON(map[string]interface{}{
  1316. "offices": offices,
  1317. })
  1318. }
  1319. func (this *Microwebsite) Deletemodlebyid() {
  1320. adminUserInfo := this.GetAdminUserInfo()
  1321. id, _ := this.GetInt64("id")
  1322. fmt.Println("保存id是啥?", id)
  1323. userOrgID := int64(adminUserInfo.CurrentOrgId)
  1324. err := site_service.DeletemodleById(id, userOrgID)
  1325. modelid := site_service.DeleteHospitalByModelid(id, userOrgID)
  1326. byModelid := site_service.DeleteOfficeByModelid(id, userOrgID)
  1327. linkByModelid := site_service.DeleteEditPicLinkByModelid(id, userOrgID)
  1328. enviroments := site_service.DeleteEnviroments(id, userOrgID)
  1329. conrotation := site_service.DeleteConrotation(id, userOrgID)
  1330. margin := site_service.DeletePatentEditMargin(id, userOrgID)
  1331. fmt.Println("linkByModelid", linkByModelid)
  1332. fmt.Println("enviroments", enviroments)
  1333. fmt.Println("enviroments", conrotation)
  1334. fmt.Println("margin", margin)
  1335. fmt.Println(modelid, byModelid)
  1336. if err != nil {
  1337. this.ServeFailJsonSend(enums.ErrorCodeDataException, "删除成功")
  1338. return
  1339. }
  1340. returnData := make(map[string]interface{}, 0)
  1341. returnData["msg"] = "ok"
  1342. this.ServeSuccessJSON(returnData)
  1343. return
  1344. }
  1345. func (this *Microwebsite) SaveOffice() {
  1346. adminUserInfo := this.GetAdminUserInfo()
  1347. id, _ := this.GetInt64("id")
  1348. fmt.Println("科室介绍id是啥?", id)
  1349. userOrgID := int64(adminUserInfo.CurrentOrgId)
  1350. fmt.Println(userOrgID)
  1351. dataBody := make(map[string]interface{}, 0)
  1352. err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
  1353. if err != nil {
  1354. utils.ErrorLog(err.Error())
  1355. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "参数错误")
  1356. return
  1357. }
  1358. title := dataBody["title"].(string)
  1359. if len(title) == 0 {
  1360. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "模块标题不能为空")
  1361. return
  1362. }
  1363. fmt.Println("标题:", title)
  1364. sort := int64(dataBody["sort"].(float64))
  1365. fmt.Println("sort是神", sort)
  1366. if sort <= 0 {
  1367. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "排序值不能为空")
  1368. return
  1369. }
  1370. fmt.Println("排序:", sort)
  1371. introduction := dataBody["introduction"].(string)
  1372. fmt.Println("内容", introduction)
  1373. if len(introduction) == 0 {
  1374. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "模块标题不能为空")
  1375. return
  1376. }
  1377. modelid := int64(dataBody["modelid"].(float64))
  1378. fmt.Println("模块ID", modelid)
  1379. if modelid <= 0 {
  1380. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "模块ID不能为空")
  1381. return
  1382. }
  1383. offices := models.SgjPatientOffices{
  1384. Title: title,
  1385. Sort: sort,
  1386. Introduction: introduction,
  1387. }
  1388. updateOffices := site_service.UpdateOffices(id, userOrgID, offices)
  1389. model := models.SgjPatientModel{
  1390. Title: title,
  1391. Sort: sort,
  1392. }
  1393. updateModel := site_service.UpdateModel(modelid, userOrgID, model)
  1394. fmt.Println(updateModel)
  1395. if updateOffices != nil {
  1396. this.ServeFailJsonSend(enums.ErrorCodeDataException, "删除回复成功")
  1397. return
  1398. }
  1399. this.ServeSuccessJSON(map[string]interface{}{
  1400. "offices": offices,
  1401. "model": model,
  1402. })
  1403. }
  1404. func (this *Microwebsite) GetHospital() {
  1405. adminUserInfo := this.GetAdminUserInfo()
  1406. userOrgID := int64(adminUserInfo.CurrentOrgId)
  1407. hostital, err := site_service.GetHospital(userOrgID)
  1408. if err != nil {
  1409. this.ServeFailJsonSend(enums.ErrorCodeDataException, "删除回复成功")
  1410. return
  1411. }
  1412. this.ServeSuccessJSON(map[string]interface{}{
  1413. "hostital": hostital,
  1414. })
  1415. }
  1416. func (this *Microwebsite) GetDefaultData() {
  1417. adminUserInfo := this.GetAdminUserInfo()
  1418. userOrgID := adminUserInfo.CurrentOrgId
  1419. fmt.Println("我爱我的机构id", userOrgID)
  1420. model, errcode := site_service.GetModel(userOrgID)
  1421. fmt.Println("model", model)
  1422. fmt.Println("我和我的祖国", errcode)
  1423. if errcode == gorm.ErrRecordNotFound {
  1424. patientModel := models.SgjPatientModel{
  1425. Title: "轮播图",
  1426. Sort: 1,
  1427. UserOrgId: userOrgID,
  1428. Ctime: time.Now().Unix(),
  1429. Status: 1,
  1430. ModeType: 1,
  1431. }
  1432. addPatientModel := site_service.AddPatientModelTwo(&patientModel)
  1433. fmt.Println("第一个模块id", addPatientModel)
  1434. sgjPatientModel, err := site_service.GetQueryModelByLastData(userOrgID)
  1435. fmt.Println("查询模块错误是设么", err)
  1436. editpiclink := models.SgjPatientEditpiclink{
  1437. Images: "https://images.shengws.com/2124_o_1570607834870.png",
  1438. Sort: 1,
  1439. UserOrgId: userOrgID,
  1440. Status: 1,
  1441. Ctime: time.Now().Unix(),
  1442. Modeid: sgjPatientModel.ID,
  1443. }
  1444. err = site_service.AddPatientEdit(&editpiclink)
  1445. fmt.Println("err", err)
  1446. patientmodefour := models.SgjPatientModel{
  1447. Title: "魔方导航",
  1448. Sort: 2,
  1449. UserOrgId: userOrgID,
  1450. Ctime: time.Now().Unix(),
  1451. Status: 1,
  1452. ModeType: 8,
  1453. }
  1454. addPatientModelTwo := site_service.AddPatientModelTwo(&patientmodefour)
  1455. fmt.Println(addPatientModelTwo)
  1456. sgjpatietnmodelfour, err := site_service.GetQueryModelByLastData(userOrgID)
  1457. fmt.Println("第二个模块id", sgjpatietnmodelfour)
  1458. fmt.Println(err)
  1459. editmargin := models.SgjPatientEditmargin{
  1460. Margtitle: "医院介绍",
  1461. Margimage: "https://images.shengws.com/2109_o_1569824063320.png",
  1462. UserOrgId: userOrgID,
  1463. Status: 1,
  1464. Ctime: time.Now().Unix(),
  1465. Modeid: sgjpatietnmodelfour.ID,
  1466. }
  1467. margin := site_service.AddEditMargin(&editmargin)
  1468. fmt.Println(margin)
  1469. patientEditmargin := models.SgjPatientEditmargin{
  1470. Margtitle: "医护团队",
  1471. Margimage: "https://images.shengws.com/2121_o_1569824193950.png",
  1472. UserOrgId: userOrgID,
  1473. Status: 1,
  1474. Ctime: time.Now().Unix(),
  1475. Modeid: sgjpatietnmodelfour.ID,
  1476. }
  1477. err = site_service.AddEditMargin(&patientEditmargin)
  1478. fmt.Println(err)
  1479. sgjPatientEditmargin := models.SgjPatientEditmargin{
  1480. Margtitle: "科室介绍",
  1481. Margimage: "https://images.shengws.com/2113_o_1569824421007.png",
  1482. UserOrgId: userOrgID,
  1483. Status: 1,
  1484. Ctime: time.Now().Unix(),
  1485. Modeid: sgjpatietnmodelfour.ID,
  1486. }
  1487. err = site_service.AddEditMargin(&sgjPatientEditmargin)
  1488. fmt.Println(err)
  1489. patienteditmarginfour := models.SgjPatientEditmargin{
  1490. Margtitle: "医院活动",
  1491. Margimage: "https://images.shengws.com/2131_o_1569824498886.png",
  1492. UserOrgId: userOrgID,
  1493. Status: 1,
  1494. Ctime: time.Now().Unix(),
  1495. Modeid: sgjpatietnmodelfour.ID,
  1496. }
  1497. err = site_service.AddEditMargin(&patienteditmarginfour)
  1498. fmt.Println(err)
  1499. patienteditmarginfive := models.SgjPatientEditmargin{
  1500. Margtitle: "医院环境",
  1501. Margimage: "https://images.shengws.com/2148_o_1569824574458.png",
  1502. UserOrgId: userOrgID,
  1503. Status: 1,
  1504. Ctime: time.Now().Unix(),
  1505. Modeid: sgjpatietnmodelfour.ID,
  1506. }
  1507. err = site_service.AddEditMargin(&patienteditmarginfive)
  1508. fmt.Println(err)
  1509. patienteditmarginsix := models.SgjPatientEditmargin{
  1510. Margtitle: "咨询服务",
  1511. Margimage: "https://images.shengws.com/2111_o_1569824596227.png",
  1512. UserOrgId: userOrgID,
  1513. Status: 1,
  1514. Ctime: time.Now().Unix(),
  1515. Modeid: sgjpatietnmodelfour.ID,
  1516. }
  1517. err = site_service.AddEditMargin(&patienteditmarginsix)
  1518. fmt.Println(err)
  1519. patienteditmarginserven := models.SgjPatientEditmargin{
  1520. Margtitle: "加入会员",
  1521. Margimage: "https://images.shengws.com/2126_o_1569824611892.png",
  1522. UserOrgId: userOrgID,
  1523. Status: 1,
  1524. Ctime: time.Now().Unix(),
  1525. Modeid: sgjpatietnmodelfour.ID,
  1526. }
  1527. err = site_service.AddEditMargin(&patienteditmarginserven)
  1528. fmt.Println(err)
  1529. patienteditmargineghit := models.SgjPatientEditmargin{
  1530. Margtitle: "联系我们",
  1531. Margimage: "https://images.shengws.com/2141_o_1569824626531.png",
  1532. UserOrgId: userOrgID,
  1533. Status: 1,
  1534. Ctime: time.Now().Unix(),
  1535. Modeid: sgjpatietnmodelfour.ID,
  1536. }
  1537. err = site_service.AddEditMargin(&patienteditmargineghit)
  1538. fmt.Println(err)
  1539. patientModelTwo := models.SgjPatientModel{
  1540. Title: "医院介绍",
  1541. Sort: 3,
  1542. UserOrgId: userOrgID,
  1543. Ctime: time.Now().Unix(),
  1544. Status: 1,
  1545. ModeType: 2,
  1546. }
  1547. two := site_service.AddPatientModelTwo(&patientModelTwo)
  1548. fmt.Println(two)
  1549. sgjPatientModelTwo, err := site_service.GetQueryModelByLastData(userOrgID)
  1550. hospital := models.SgjPatientHospital{
  1551. Title: "医院介绍",
  1552. Sort: 3,
  1553. Introduction: "暂无数据",
  1554. UserOrgId: userOrgID,
  1555. Modleid: sgjPatientModelTwo.ID,
  1556. Status: 1,
  1557. Ctime: time.Now().Unix(),
  1558. }
  1559. addHospital := site_service.AddHospital(&hospital)
  1560. fmt.Println(addHospital)
  1561. Sgjpatientmodelthree := models.SgjPatientModel{
  1562. Title: "科室介绍",
  1563. Sort: 4,
  1564. UserOrgId: userOrgID,
  1565. Ctime: time.Now().Unix(),
  1566. Status: 1,
  1567. ModeType: 3,
  1568. }
  1569. modelTwo := site_service.AddPatientModelTwo(&Sgjpatientmodelthree)
  1570. fmt.Println(modelTwo)
  1571. datathree, err := site_service.GetQueryModelByLastData(userOrgID)
  1572. offices := models.SgjPatientOffices{
  1573. Title: "科室介绍",
  1574. Sort: 4,
  1575. UserOrgId: userOrgID,
  1576. Ctime: time.Now().Unix(),
  1577. Status: 1,
  1578. Modleid: datathree.ID,
  1579. Introduction: "暂无数据",
  1580. }
  1581. err = site_service.AddPatientOffices(&offices)
  1582. fmt.Println(err)
  1583. patientModelFive := models.SgjPatientModel{
  1584. Title: "医护团队",
  1585. Sort: 5,
  1586. UserOrgId: userOrgID,
  1587. Ctime: time.Now().Unix(),
  1588. Status: 1,
  1589. ModeType: 4,
  1590. }
  1591. err = site_service.AddPatientModelTwo(&patientModelFive)
  1592. fmt.Println("err", err)
  1593. data, err := site_service.GetQueryModelByLastData(userOrgID)
  1594. fmt.Println(err)
  1595. editdoctor := models.SgjPatientEditdoctor{
  1596. Dochead: "https://images.shengws.com/2062_o_1570608303729.png",
  1597. DocSort: 1,
  1598. Docintroduction: "暂时无数据",
  1599. UserOrgId: userOrgID,
  1600. Modleid: data.ID,
  1601. Status: 1,
  1602. Ctime: time.Now().Unix(),
  1603. DocPostion: 1,
  1604. }
  1605. doctor := site_service.AddEditDoctor(&editdoctor)
  1606. fmt.Println("doctor", doctor)
  1607. modelserven := models.SgjPatientModel{
  1608. Title: "医院环境",
  1609. Sort: 6,
  1610. UserOrgId: userOrgID,
  1611. Ctime: time.Now().Unix(),
  1612. Status: 1,
  1613. ModeType: 5,
  1614. }
  1615. err = site_service.AddPatientModelTwo(&modelserven)
  1616. lastData, err := site_service.GetQueryModelByLastData(userOrgID)
  1617. enviroimages := models.SgjPatientEnviroimages{
  1618. Enviroimages: "https://images.shengws.com/2074_o_1570608492452.png",
  1619. Sort: 1,
  1620. UserOrgId: userOrgID,
  1621. Status: 1,
  1622. Modeid: lastData.ID,
  1623. Ctime: time.Now().Unix(),
  1624. }
  1625. err = site_service.AddImages(&enviroimages)
  1626. fmt.Println("err", err)
  1627. //modeleight := models.SgjPatientModel{
  1628. // Title: "文章列表",
  1629. // Sort: 7,
  1630. // UserOrgId: userOrgID,
  1631. // Ctime: time.Now().Unix(),
  1632. // Status: 1,
  1633. // ModeType: 6,
  1634. //}
  1635. //err = site_service.AddPatientModelTwo(&modeleight)
  1636. //fmt.Println("文章列表错误u",err)
  1637. //articles := models.Articles{
  1638. // Title: "暂无数据",
  1639. // Imgs: "https://images.shengws.com/2139_o_1566989829686.jpg",
  1640. // RealReadNum: 0,
  1641. // CommentNum: 0,
  1642. // StarNum: 0,
  1643. // UserOrgId:userOrgID,
  1644. // Ctime: time.Now().Unix(),
  1645. // Status:1,
  1646. // ArticleStatus:1,
  1647. //}
  1648. //err = site_service.AddActicles(&articles)
  1649. //fmt.Println("err",err)
  1650. } else if errcode == nil {
  1651. } else {
  1652. }
  1653. if errcode != nil {
  1654. this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
  1655. return
  1656. }
  1657. this.ServeSuccessJSON(map[string]interface{}{
  1658. "model": model,
  1659. })
  1660. }
  1661. func (this *Microwebsite) GetData() {
  1662. //fmt.Println("我和我的作古阿斯蒂芬地方地方阿道夫打发阿凡达阿范德萨发撒旦法阿斯蒂芬发送到法阿发法阿发法")
  1663. adminUserInfo := this.GetAdminUserInfo()
  1664. userOrgID := int64(adminUserInfo.CurrentOrgId)
  1665. fmt.Println("机构id", userOrgID)
  1666. model, err := site_service.GetData(userOrgID)
  1667. if err != nil {
  1668. this.ServeFailJsonSend(enums.ErrorCodeDataException, "删除回复成功")
  1669. return
  1670. }
  1671. this.ServeSuccessJSON(map[string]interface{}{
  1672. "patientModels": model,
  1673. })
  1674. }
  1675. func (this *Microwebsite) EditDoctor() {
  1676. adminUserInfo := this.GetAdminUserInfo()
  1677. userOrgID := int64(adminUserInfo.CurrentOrgId)
  1678. fmt.Println("机构ID", userOrgID)
  1679. id, _ := this.GetInt64("id")
  1680. fmt.Println("编辑名医获取ID", id)
  1681. docinfo, err := site_service.QueryEditDoctor(id, userOrgID)
  1682. fmt.Println(docinfo)
  1683. fmt.Println("错误", err)
  1684. if err != nil {
  1685. this.ServeFailJsonSend(enums.ErrorCodeDataException, "删除回复成功")
  1686. return
  1687. }
  1688. this.ServeSuccessJSON(map[string]interface{}{
  1689. "docinfo": docinfo,
  1690. })
  1691. }
  1692. func (this *Microwebsite) EditDoctorsInfo() {
  1693. adminUserInfo := this.GetAdminUserInfo()
  1694. OrgID := adminUserInfo.CurrentOrgId
  1695. dataBody := make(map[string]interface{}, 0)
  1696. err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
  1697. if err != nil {
  1698. utils.ErrorLog(err.Error())
  1699. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "参数错误")
  1700. return
  1701. }
  1702. idsInters := dataBody["ids"].([]interface{})
  1703. fmt.Println("id集合是", idsInters)
  1704. if len(idsInters) == 0 {
  1705. if err != nil {
  1706. this.ServeFailJsonSend(enums.ErrorCodeDBDelete, "删除会员失败:(没有选择会员)")
  1707. return
  1708. }
  1709. }
  1710. ids := make([]int64, 0)
  1711. for _, idsInter := range idsInters {
  1712. id := int64(idsInter.(float64))
  1713. ids = append(ids, id)
  1714. }
  1715. patientModel, err := site_service.QueryModel(OrgID)
  1716. fmt.Println("模块ID", patientModel.ID)
  1717. editdoctor := models.SgjPatientEditdoctor{
  1718. Modleid: patientModel.ID,
  1719. }
  1720. err = site_service.UpdateDoctorsInfo(OrgID, ids, editdoctor)
  1721. fmt.Println("更新数据错误", err)
  1722. if err != nil {
  1723. this.ServeFailJsonSend(enums.ErrorCodeDataException, "更新数据成功")
  1724. return
  1725. }
  1726. this.ServeSuccessJSON(map[string]interface{}{
  1727. "editdoctor": editdoctor,
  1728. })
  1729. }
  1730. func (this *Microwebsite) EditDoc() {
  1731. adminUserInfo := this.GetAdminUserInfo()
  1732. id, _ := this.GetInt64("id")
  1733. fmt.Println("编辑名医id是啥?", id)
  1734. userOrgID := int64(adminUserInfo.CurrentOrgId)
  1735. fmt.Println(userOrgID)
  1736. //editdoctor, err := site_service.QueryEditDoc(id, userOrgID)
  1737. editdoctor, err := site_service.QueryModelByid(id, userOrgID)
  1738. //editdoctors, err := site_service.QuerEditDocByid(id, userOrgID)
  1739. editdoctors, err := site_service.QuerEditDocByModleid(id, userOrgID)
  1740. fmt.Println("错误", err)
  1741. fmt.Println("数据:", editdoctor)
  1742. fmt.Println("数据", editdoctors)
  1743. if err != nil {
  1744. this.ServeFailJsonSend(enums.ErrorCodeDataException, "删除回复成功")
  1745. return
  1746. }
  1747. this.ServeSuccessJSON(map[string]interface{}{
  1748. "editdoctor": editdoctor,
  1749. "editdoctors": editdoctors,
  1750. })
  1751. }
  1752. func (this *Microwebsite) SaveDocInfo() {
  1753. adminUserInfo := this.GetAdminUserInfo()
  1754. id, _ := this.GetInt64("id")
  1755. fmt.Println("编辑名医id是啥?", id)
  1756. userOrgID := int64(adminUserInfo.CurrentOrgId)
  1757. fmt.Println(userOrgID)
  1758. dataBody := make(map[string]interface{}, 0)
  1759. err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
  1760. if err != nil {
  1761. utils.ErrorLog(err.Error())
  1762. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "参数错误")
  1763. return
  1764. }
  1765. title := dataBody["doc_name"].(string)
  1766. if len(title) == 0 {
  1767. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "模块标题不能为空")
  1768. return
  1769. }
  1770. fmt.Println("医生姓名", title)
  1771. docpostion := int64(dataBody["doc_postion"].(float64))
  1772. fmt.Println("医生职位", docpostion)
  1773. if docpostion <= 0 {
  1774. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "医生职位不能为空")
  1775. return
  1776. }
  1777. dochead := dataBody["dochead"].(string)
  1778. if len(dochead) == 0 {
  1779. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "模块标题不能为空")
  1780. return
  1781. }
  1782. fmt.Println("医生头像", dochead)
  1783. docsort := int64(dataBody["doc_sort"].(float64))
  1784. fmt.Println("排序", docsort)
  1785. docintroduction := dataBody["docintroduction"].(string)
  1786. fmt.Println("医生简介", docintroduction)
  1787. modleid := int64(dataBody["modleid"].(float64))
  1788. fmt.Println("模块idss", modleid)
  1789. editdoctor := models.SgjPatientEditdoctor{
  1790. DocName: title,
  1791. DocPostion: docpostion,
  1792. Dochead: dochead,
  1793. Docintroduction: docintroduction,
  1794. DocSort: docsort,
  1795. ImgShow: 1,
  1796. Status: 1,
  1797. Ctime: time.Now().Unix(),
  1798. }
  1799. err = site_service.UpDateEditdoctor(id, userOrgID, editdoctor)
  1800. editdoctors, err := site_service.QuerEditDoctorInfo(modleid, userOrgID)
  1801. fmt.Println("错误是", err)
  1802. if err != nil {
  1803. this.ServeFailJsonSend(enums.ErrorCodeDataException, "删除回复成功")
  1804. return
  1805. }
  1806. this.ServeSuccessJSON(map[string]interface{}{
  1807. "editdoctor": editdoctor,
  1808. "editdoctors": editdoctors,
  1809. })
  1810. }
  1811. func (this *Microwebsite) EditImages() {
  1812. adminUserInfo := this.GetAdminUserInfo()
  1813. userOrgID := int64(adminUserInfo.CurrentOrgId)
  1814. //fmt.Println("机构ID",userOrgID)
  1815. id, _ := this.GetInt64("id")
  1816. fmt.Println("路径", id)
  1817. editdoctor, err := site_service.QueryEditImages(userOrgID, id)
  1818. fmt.Println(editdoctor)
  1819. fmt.Println("错误", err)
  1820. if err != nil {
  1821. this.ServeFailJsonSend(enums.ErrorCodeDataException, "删除回复成功")
  1822. return
  1823. }
  1824. this.ServeSuccessJSON(map[string]interface{}{
  1825. "editdoctor": editdoctor,
  1826. })
  1827. }
  1828. func (this *Microwebsite) Savedocdata() {
  1829. adminUserInfo := this.GetAdminUserInfo()
  1830. userOrgID := int64(adminUserInfo.CurrentOrgId)
  1831. fmt.Println("机构ID", userOrgID)
  1832. id, _ := this.GetInt64("id")
  1833. fmt.Println("路径", id)
  1834. dataBody := make(map[string]interface{}, 0)
  1835. err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
  1836. if err != nil {
  1837. utils.ErrorLog(err.Error())
  1838. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "参数错误")
  1839. return
  1840. }
  1841. title := dataBody["title"].(string)
  1842. if len(title) == 0 {
  1843. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "模块标题不能为空")
  1844. return
  1845. }
  1846. fmt.Println("标题", title)
  1847. sort := int64(dataBody["sort"].(float64))
  1848. if sort <= 0 {
  1849. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "模块标题不能为空")
  1850. return
  1851. }
  1852. fmt.Println("排序", sort)
  1853. image := dataBody["image"]
  1854. replace := strings.Replace(strings.Trim(fmt.Sprint(image), "[]"), " ", ",", -1)
  1855. fmt.Println("图片练级", replace)
  1856. modleid := int64(dataBody["modleid"].(float64))
  1857. if modleid <= 0 {
  1858. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "模块ID不能为空")
  1859. return
  1860. }
  1861. fmt.Println("模块ID", modleid)
  1862. docinfo := models.SgjPatientDocinfo{
  1863. Title: title,
  1864. Sort: sort,
  1865. Docimages: replace,
  1866. Modelid: modleid,
  1867. }
  1868. err = site_service.Upadatedocdata(userOrgID, id, docinfo)
  1869. model := models.SgjPatientModel{
  1870. Title: title,
  1871. Sort: sort,
  1872. ID: modleid,
  1873. }
  1874. err = site_service.UpdateModel(modleid, userOrgID, model)
  1875. if err != nil {
  1876. this.ServeFailJsonSend(enums.ErrorCodeDataException, "删除回复成功")
  1877. return
  1878. }
  1879. this.ServeSuccessJSON(map[string]interface{}{
  1880. "docinfo": docinfo,
  1881. "model": model,
  1882. })
  1883. }
  1884. func (this *Microwebsite) EditOfficeEnviroment() {
  1885. adminUserInfo := this.GetAdminUserInfo()
  1886. userOrgID := int64(adminUserInfo.CurrentOrgId)
  1887. fmt.Println("机构ID", userOrgID)
  1888. id, _ := this.GetInt64("id")
  1889. fmt.Println("科室环境路径", id)
  1890. model, err := site_service.GetQueryModel(id, userOrgID)
  1891. fmt.Println("model错误", err)
  1892. //offenvironment, err := site_service.QuerOfficeEnviroment(id, userOrgID)
  1893. patientenviroimages, err := site_service.QueryOfficeformById(id, userOrgID)
  1894. fmt.Println("错误", err)
  1895. fmt.Println("科室环境数据", patientenviroimages)
  1896. if err != nil {
  1897. this.ServeFailJsonSend(enums.ErrorCodeDataException, "删除回复成功")
  1898. return
  1899. }
  1900. this.ServeSuccessJSON(map[string]interface{}{
  1901. "model": model,
  1902. "patientenviroimages": patientenviroimages,
  1903. })
  1904. }
  1905. func (this *Microwebsite) AddImages() {
  1906. adminUserInfo := this.GetAdminUserInfo()
  1907. userOrgID := int64(adminUserInfo.CurrentOrgId)
  1908. fmt.Println("机构ID", userOrgID)
  1909. dataBody := make(map[string]interface{}, 0)
  1910. err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
  1911. if err != nil {
  1912. utils.ErrorLog(err.Error())
  1913. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "参数错误")
  1914. return
  1915. }
  1916. enviroimages := dataBody["enviroimages"].(string)
  1917. fmt.Println("图片", enviroimages)
  1918. if len(enviroimages) == 0 {
  1919. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "模块标题不能为空")
  1920. return
  1921. }
  1922. sort := int64(dataBody["sort"].(float64))
  1923. fmt.Println("sort", sort)
  1924. patientEnviroimages := models.SgjPatientEnviroimages{
  1925. Enviroimages: enviroimages,
  1926. Sort: sort,
  1927. UserOrgId: userOrgID,
  1928. Ctime: time.Now().Unix(),
  1929. Status: 1,
  1930. Imgshow: 1,
  1931. }
  1932. err = site_service.AddImages(&patientEnviroimages)
  1933. if err != nil {
  1934. this.ServeFailJsonSend(enums.ErrorCodeDataException, "删除回复成功")
  1935. return
  1936. }
  1937. this.ServeSuccessJSON(map[string]interface{}{
  1938. "patientEnviroimages": patientEnviroimages,
  1939. })
  1940. }
  1941. func (this *Microwebsite) SaveOfficeEnvironment() {
  1942. adminUserInfo := this.GetAdminUserInfo()
  1943. userOrgID := int64(adminUserInfo.CurrentOrgId)
  1944. fmt.Println("机构ID", userOrgID)
  1945. id, _ := this.GetInt64("id")
  1946. fmt.Println("科室环境id", id)
  1947. dataBody := make(map[string]interface{}, 0)
  1948. err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
  1949. if err != nil {
  1950. utils.ErrorLog(err.Error())
  1951. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "参数错误")
  1952. return
  1953. }
  1954. title := dataBody["title"].(string)
  1955. if len(title) == 0 {
  1956. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "模块标题不能为空")
  1957. return
  1958. }
  1959. fmt.Println("模块标题", title)
  1960. sort := int64(dataBody["sort"].(float64))
  1961. if sort <= 0 {
  1962. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "模块标题不能为空")
  1963. return
  1964. }
  1965. fmt.Println("排序", sort)
  1966. keimages := dataBody["keImages"]
  1967. fmt.Println("图片", keimages)
  1968. replace := strings.Replace(strings.Trim(fmt.Sprint(keimages), "[]"), " ", ",", -1)
  1969. model := models.SgjPatientModel{
  1970. Title: title,
  1971. Sort: sort,
  1972. }
  1973. //offenvironment, err := site_service.GetOffENvironmentById(id, userOrgID)
  1974. err = site_service.UpdateModel(id, userOrgID, model)
  1975. fmt.Println("错误", err)
  1976. patientOffenvironment := models.SgjPatientOffenvironment{
  1977. Title: title,
  1978. Sort: sort,
  1979. Keimages: replace,
  1980. }
  1981. err = site_service.UpdatePatientOffenvironment(id, userOrgID, patientOffenvironment)
  1982. if err != nil {
  1983. this.ServeFailJsonSend(enums.ErrorCodeDataException, "删除回复成功")
  1984. return
  1985. }
  1986. this.ServeSuccessJSON(map[string]interface{}{
  1987. "model": model,
  1988. "patientOffenvironment": patientOffenvironment,
  1989. })
  1990. //environment, err := site_service.UpdateOfficeEnvironment(id, userOrgID)
  1991. //if err !=nil{
  1992. // this.ServeFailJsonSend(enums.ErrorCodeDataException, "删除回复成功")
  1993. // return
  1994. //}
  1995. //this.ServeSuccessJSON(map[string]interface{}{
  1996. // "environment":environment,
  1997. //})
  1998. }
  1999. func (this *Microwebsite) Hispitalmore() {
  2000. adminUserInfo := this.GetAdminUserInfo()
  2001. userOrgID := int64(adminUserInfo.CurrentOrgId)
  2002. id, _ := this.GetInt64("id")
  2003. hospital, err := site_service.QueryHispitalDetail(userOrgID, id)
  2004. if err != nil {
  2005. this.ServeFailJsonSend(enums.ErrorCodeDataException, "删除回复成功")
  2006. return
  2007. }
  2008. this.ServeSuccessJSON(map[string]interface{}{
  2009. "hospital": hospital,
  2010. })
  2011. }
  2012. func (this *Microwebsite) GetOfficeDetail() {
  2013. adminUserInfo := this.GetAdminUserInfo()
  2014. userOrgID := int64(adminUserInfo.CurrentOrgId)
  2015. id, _ := this.GetInt64("id")
  2016. fmt.Println("ID是多少", id)
  2017. offices, err := site_service.GetOfficeDetail(userOrgID, id)
  2018. if err != nil {
  2019. this.ServeFailJsonSend(enums.ErrorCodeDataException, "删除回复成功")
  2020. return
  2021. }
  2022. this.ServeSuccessJSON(map[string]interface{}{
  2023. "offices": offices,
  2024. })
  2025. }
  2026. func (this *Microwebsite) GetDoctorDetail() {
  2027. adminUserInfo := this.GetAdminUserInfo()
  2028. userOrgID := int64(adminUserInfo.CurrentOrgId)
  2029. id, _ := this.GetInt64("id")
  2030. fmt.Println("米公益ID", id)
  2031. editdoctor, err := site_service.GetDoctorDetail(userOrgID, id)
  2032. if err != nil {
  2033. this.ServeFailJsonSend(enums.ErrorCodeDataException, "删除回复成功")
  2034. return
  2035. }
  2036. this.ServeSuccessJSON(map[string]interface{}{
  2037. "editdoctor": editdoctor,
  2038. })
  2039. }
  2040. func (this *Microwebsite) GetOfficEnviromentDetail() {
  2041. adminUserInfo := this.GetAdminUserInfo()
  2042. userOrgID := int64(adminUserInfo.CurrentOrgId)
  2043. id, _ := this.GetInt64("id")
  2044. fmt.Println("科室环境id", id)
  2045. offenvironment, err := site_service.GetOfficEnviromentDetail(userOrgID, id)
  2046. fmt.Println("错误", err)
  2047. fmt.Println("offenvironment", offenvironment)
  2048. if err != nil {
  2049. this.ServeFailJsonSend(enums.ErrorCodeDataException, "删除回复成功")
  2050. return
  2051. }
  2052. this.ServeSuccessJSON(map[string]interface{}{
  2053. "offenvironment": offenvironment,
  2054. })
  2055. }
  2056. func (this *Microwebsite) GetArticlistDetail() {
  2057. adminUserInfo := this.GetAdminUserInfo()
  2058. userOrgID := int64(adminUserInfo.CurrentOrgId)
  2059. fmt.Println("机构id", userOrgID)
  2060. id, _ := this.GetInt64("id")
  2061. fmt.Println("文章详情", id)
  2062. articlelist, err := site_service.GetArticlelistById(id, userOrgID)
  2063. fmt.Println(articlelist.Number, err)
  2064. //fmt.Println(err)
  2065. articlelists, err := site_service.GetAllArticles(userOrgID, articlelist.Number)
  2066. fmt.Println("articlelist", articlelist)
  2067. if err != nil {
  2068. this.ServeFailJsonSend(enums.ErrorCodeDataException, "删除回复成功")
  2069. return
  2070. }
  2071. this.ServeSuccessJSON(map[string]interface{}{
  2072. "articlelists": articlelists,
  2073. })
  2074. }
  2075. func (this *Microwebsite) GetActivitesDetail() {
  2076. adminUserInfo := this.GetAdminUserInfo()
  2077. userOrgID := int64(adminUserInfo.CurrentOrgId)
  2078. fmt.Println("机构id", userOrgID)
  2079. id, _ := this.GetInt64("id")
  2080. fmt.Println("活动详情", id)
  2081. addactivity, err := site_service.GetAllActivitiById(id, userOrgID)
  2082. fmt.Println("err", err)
  2083. activity, err := site_service.GetAllActivities(userOrgID, addactivity.Number)
  2084. if err != nil {
  2085. this.ServeFailJsonSend(enums.ErrorCodeDataException, "删除回复成功")
  2086. return
  2087. }
  2088. this.ServeSuccessJSON(map[string]interface{}{
  2089. "activity": activity,
  2090. })
  2091. }
  2092. func (this *Microwebsite) AddNavigation() {
  2093. adminUserInfo := this.GetAdminUserInfo()
  2094. userOrgID := int64(adminUserInfo.CurrentOrgId)
  2095. fmt.Println("机构ID", userOrgID)
  2096. dataBody := make(map[string]interface{}, 0)
  2097. err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
  2098. if err != nil {
  2099. utils.ErrorLog(err.Error())
  2100. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "参数错误")
  2101. return
  2102. }
  2103. navtitle := dataBody["navtitle"].(string)
  2104. if len(navtitle) == 0 {
  2105. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "导航标题不能为空")
  2106. return
  2107. }
  2108. fmt.Println("导航标题", navtitle)
  2109. navigationImages := dataBody["navigationImages"].(string)
  2110. if len(navigationImages) == 0 {
  2111. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "导航图片不能为空")
  2112. return
  2113. }
  2114. fmt.Println("导航图片", navigationImages)
  2115. nonavigationimages := dataBody["nonavigationImages"].(string)
  2116. jumpset := int64(dataBody["jumpset"].(float64))
  2117. if jumpset <= 0 {
  2118. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "跳转设置不能为空")
  2119. return
  2120. }
  2121. fmt.Println("调转设置", jumpset)
  2122. navigationaddress := dataBody["navigationaddress"].(string)
  2123. fmt.Println("链接地址", navigationaddress)
  2124. linkid := int64(dataBody["linkid"].(float64))
  2125. fmt.Println("linkID", linkid)
  2126. linktype := int64(dataBody["linktype"].(float64))
  2127. navigation := models.SgjPatientNavigation{
  2128. Navtitle: navtitle,
  2129. Navimages: navigationImages,
  2130. Nonavimages: nonavigationimages,
  2131. Jumpset: jumpset,
  2132. Navaddress: navigationaddress,
  2133. UserOrgId: userOrgID,
  2134. Status: 1,
  2135. Ctime: time.Now().Unix(),
  2136. Linkid: linkid,
  2137. Linktype: linktype,
  2138. }
  2139. err = site_service.AddNavigation(&navigation)
  2140. if err != nil {
  2141. this.ServeFailJsonSend(enums.ErrorCodeDataException, "删除回复成功")
  2142. return
  2143. }
  2144. this.ServeSuccessJSON(map[string]interface{}{
  2145. "navigation": navigation,
  2146. })
  2147. }
  2148. func (this *Microwebsite) GetNavigationList() {
  2149. adminUserInfo := this.GetAdminUserInfo()
  2150. userOrgID := int64(adminUserInfo.CurrentOrgId)
  2151. navigation, err := site_service.GetNavigationList(userOrgID)
  2152. fmt.Println("导航错误是什么", err)
  2153. if err != nil {
  2154. this.ServeFailJsonSend(enums.ErrorCodeDataException, "删除回复成功")
  2155. return
  2156. }
  2157. this.ServeSuccessJSON(map[string]interface{}{
  2158. "navigation": navigation,
  2159. })
  2160. }
  2161. func (this *Microwebsite) AddShareInfo() {
  2162. adminUserInfo := this.GetAdminUserInfo()
  2163. userOrgID := int64(adminUserInfo.CurrentOrgId)
  2164. fmt.Println("机构ID", userOrgID)
  2165. dataBody := make(map[string]interface{}, 0)
  2166. err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
  2167. if err != nil {
  2168. utils.ErrorLog(err.Error())
  2169. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "参数错误")
  2170. return
  2171. }
  2172. sharetitle := dataBody["sharetitle"].(string)
  2173. fmt.Println("比阿尼", sharetitle)
  2174. if len(sharetitle) == 0 {
  2175. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "分享标题不能为空")
  2176. return
  2177. }
  2178. shareintroduction := dataBody["shareintroduction"].(string)
  2179. fmt.Println("分享内容", sharetitle)
  2180. if len(shareintroduction) == 0 {
  2181. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "分享标题不能为空")
  2182. return
  2183. }
  2184. shareImages := dataBody["shareImages"].(string)
  2185. fmt.Println("分享图片", shareImages)
  2186. if len(shareImages) == 0 {
  2187. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "分享标题不能为空")
  2188. return
  2189. }
  2190. share := models.SgjPatientShare{
  2191. ShareTitle: sharetitle,
  2192. ShareIntroduction: shareintroduction,
  2193. ShareImages: shareImages,
  2194. Ctime: time.Now().Unix(),
  2195. UserOrgId: userOrgID,
  2196. Status: 1,
  2197. }
  2198. fmt.Println("share是设么", share)
  2199. err = site_service.AddShareInfo(&share)
  2200. if err != nil {
  2201. this.ServeFailJsonSend(enums.ErrorCodeDataException, "删除回复成功")
  2202. return
  2203. }
  2204. this.ServeSuccessJSON(map[string]interface{}{
  2205. "share": share,
  2206. })
  2207. }
  2208. func (this *Microwebsite) GetShareInfo() {
  2209. adminUserInfo := this.GetAdminUserInfo()
  2210. userOrgID := int64(adminUserInfo.CurrentOrgId)
  2211. share, err := site_service.GetShareInfo(userOrgID)
  2212. if err != nil {
  2213. this.ServeFailJsonSend(enums.ErrorCodeDataException, "删除回复成功")
  2214. return
  2215. }
  2216. fmt.Println("错误是什么?", err)
  2217. this.ServeSuccessJSON(map[string]interface{}{
  2218. "share": share,
  2219. })
  2220. fmt.Println("返回share是什么", share)
  2221. }
  2222. func (this *Microwebsite) DeleteNavition() {
  2223. adminUserInfo := this.GetAdminUserInfo()
  2224. userOrgID := int64(adminUserInfo.CurrentOrgId)
  2225. id, _ := this.GetInt64("id")
  2226. fmt.Println("id是什么呢", id)
  2227. err := site_service.DeleteNavitionById(userOrgID, id)
  2228. if err != nil {
  2229. this.ServeFailJsonSend(enums.ErrorCodeDataException, "删除成功")
  2230. return
  2231. }
  2232. returnData := make(map[string]interface{}, 0)
  2233. returnData["msg"] = "ok"
  2234. this.ServeSuccessJSON(returnData)
  2235. return
  2236. }
  2237. func (this *Microwebsite) DeleteModle() {
  2238. adminUserInfo := this.GetAdminUserInfo()
  2239. userOrgID := int64(adminUserInfo.CurrentOrgId)
  2240. id, _ := this.GetInt64("id")
  2241. fmt.Println("模块ID", id)
  2242. err := site_service.DeleteModle(userOrgID, id)
  2243. fmt.Println("错误是什么", err)
  2244. errtw := site_service.DeleteModleByModeID(userOrgID, id)
  2245. way := site_service.DeleteRideWay(userOrgID, id)
  2246. workTime := site_service.DeleteWorkTime(userOrgID, id)
  2247. conrotation := site_service.DeleteConrotation(id, userOrgID)
  2248. fmt.Println("错误是什么", errtw, way, workTime)
  2249. fmt.Println(conrotation)
  2250. if err != nil {
  2251. this.ServeFailJsonSend(enums.ErrorCodeDataException, "删除成功")
  2252. return
  2253. }
  2254. returnData := make(map[string]interface{}, 0)
  2255. returnData["msg"] = "ok"
  2256. this.ServeSuccessJSON(returnData)
  2257. return
  2258. }
  2259. func (this *Microwebsite) GetOrderModel() {
  2260. adminUserInfo := this.GetAdminUserInfo()
  2261. userOrgID := int64(adminUserInfo.CurrentOrgId)
  2262. ordmodel, err := site_service.GetOrederModel(userOrgID)
  2263. fmt.Println("ordemodel是社没什么", ordmodel)
  2264. if err != nil {
  2265. this.ServeFailJsonSend(enums.ErrorCodeDataException, "删除回复成功")
  2266. return
  2267. }
  2268. this.ServeSuccessJSON(map[string]interface{}{
  2269. "ordmodel": ordmodel,
  2270. })
  2271. }
  2272. func (this *Microwebsite) AddRotationpic() {
  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. linkid := int64(dataBody["linkid"].(float64))
  3120. fmt.Println("linkid", linkid)
  3121. if piclink == 1 {
  3122. conlinkaddress, err := site_service.UpdatedConAddress(linkid, userOrgID)
  3123. fmt.Println("错误", err)
  3124. fmt.Println("conlinkaddress", conlinkaddress)
  3125. }
  3126. conrotation := models.SgjPatientConrotation{
  3127. Images: images,
  3128. Sort: sort,
  3129. Piclink: piclink,
  3130. Linkaddress: linkaddress,
  3131. Linkid: linkid,
  3132. }
  3133. err = site_service.UpdateEditpic(id, userOrgID, conrotation)
  3134. fmt.Println("err错误", err)
  3135. if err != nil {
  3136. this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
  3137. return
  3138. }
  3139. conrotations, err := site_service.QueryConRotation(modeid, userOrgID)
  3140. fmt.Println("错误小小马", err)
  3141. fmt.Println(conrotations)
  3142. this.ServeSuccessJSON(map[string]interface{}{
  3143. "conrotation": conrotation,
  3144. "conrotations": conrotations,
  3145. })
  3146. }
  3147. func (this *Microwebsite) AddEditpic() {
  3148. adminUserInfo := this.GetAdminUserInfo()
  3149. userOrgID := int64(adminUserInfo.CurrentOrgId)
  3150. fmt.Println("机构ID", userOrgID)
  3151. dataBody := make(map[string]interface{}, 0)
  3152. err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
  3153. if err != nil {
  3154. utils.ErrorLog(err.Error())
  3155. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "参数错误")
  3156. return
  3157. }
  3158. images := dataBody["images"].(string)
  3159. fmt.Println("图片", images)
  3160. if len(images) == 0 {
  3161. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "标题不能为空")
  3162. return
  3163. }
  3164. sort := int64(dataBody["sort"].(float64))
  3165. fmt.Println("排序", sort)
  3166. piclink := int64(dataBody["piclink"].(float64))
  3167. fmt.Println("图片链接", piclink)
  3168. linkaddress := dataBody["linkaddress"].(string)
  3169. fmt.Println("链接地址", linkaddress)
  3170. id, _ := this.GetInt64("id")
  3171. fmt.Println("下孟子id", id)
  3172. oldrotation, err := site_service.QueryOldrotion(id, userOrgID)
  3173. fmt.Println("oldrotation", oldrotation)
  3174. conrotation := models.SgjPatientConrotation{
  3175. Images: images,
  3176. Sort: sort,
  3177. Piclink: piclink,
  3178. Linkaddress: linkaddress,
  3179. Status: 1,
  3180. Modeid: id,
  3181. UserOrgId: userOrgID,
  3182. Ctime: time.Now().Unix(),
  3183. ImgShow: 1,
  3184. }
  3185. err = site_service.AddEditpic(&conrotation)
  3186. if err != nil {
  3187. this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
  3188. return
  3189. }
  3190. conrotations, erros := site_service.QueryConRotation(id, userOrgID)
  3191. fmt.Println("门前错误", erros)
  3192. fmt.Println("conrotations是什么", conrotations)
  3193. this.ServeSuccessJSON(map[string]interface{}{
  3194. "conrotation": conrotation,
  3195. "conrotations": conrotations,
  3196. })
  3197. }
  3198. func (this *Microwebsite) AddEdialogVisible() {
  3199. adminUserInfo := this.GetAdminUserInfo()
  3200. userOrgID := int64(adminUserInfo.CurrentOrgId)
  3201. fmt.Println("机构ID", userOrgID)
  3202. id, _ := this.GetInt64("id")
  3203. fmt.Println("这个ID是", id)
  3204. dataBody := make(map[string]interface{}, 0)
  3205. err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
  3206. if err != nil {
  3207. utils.ErrorLog(err.Error())
  3208. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "参数错误")
  3209. return
  3210. }
  3211. title := dataBody["title"].(string)
  3212. fmt.Println("标题", title)
  3213. sort := int64(dataBody["sort"].(float64))
  3214. fmt.Println("排序", sort)
  3215. rotationImages := dataBody["rotationImages"]
  3216. images := strings.Replace(strings.Trim(fmt.Sprint(rotationImages), "[]"), " ", ",", -1)
  3217. fmt.Println("图片", images)
  3218. oldrotation := models.SgjPatientOldrotation{
  3219. Title: title,
  3220. Sort: sort,
  3221. RotationImages: images,
  3222. }
  3223. err = site_service.UpdateConrotaionById(id, userOrgID, oldrotation)
  3224. fmt.Println(err)
  3225. fmt.Println("马文强错错误是什么", err)
  3226. ordmodel := models.SgjPatientOrdmodel{
  3227. Title: title,
  3228. Sort: sort,
  3229. }
  3230. err = site_service.UpdateOrdeModel(id, userOrgID, ordmodel)
  3231. if err != nil {
  3232. this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
  3233. return
  3234. }
  3235. this.ServeSuccessJSON(map[string]interface{}{
  3236. "oldrotation": oldrotation,
  3237. "ordmodel": ordmodel,
  3238. })
  3239. }
  3240. func (this *Microwebsite) GetEditRotationimages() {
  3241. adminUserInfo := this.GetAdminUserInfo()
  3242. userOrgID := int64(adminUserInfo.CurrentOrgId)
  3243. fmt.Println("编辑轮播图机构id", userOrgID)
  3244. id, _ := this.GetInt64("id")
  3245. fmt.Println("id是多少?", id)
  3246. model, err := site_service.GetPatientModel(id, userOrgID)
  3247. fmt.Println("patientEditpiclink", model)
  3248. fmt.Println("错误", err)
  3249. editpiclink, err := site_service.QueryEditpiclink(id, userOrgID)
  3250. fmt.Println("错误是多少", err)
  3251. fmt.Println("返回数据", editpiclink)
  3252. editpiclinks, total, err := site_service.QueryEditpiclinkCount(id, userOrgID)
  3253. fmt.Println(editpiclinks)
  3254. if err != nil {
  3255. this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
  3256. return
  3257. }
  3258. this.ServeSuccessJSON(map[string]interface{}{
  3259. "model": model,
  3260. "editpiclink": editpiclink,
  3261. "total": total,
  3262. })
  3263. }
  3264. func (this *Microwebsite) GetEditSingleVisible() {
  3265. adminUserInfo := this.GetAdminUserInfo()
  3266. userOrgID := int64(adminUserInfo.CurrentOrgId)
  3267. fmt.Println("机构id", userOrgID)
  3268. id, _ := this.GetInt64("id")
  3269. fmt.Println("id是多少?", id)
  3270. editpiclink, err := site_service.GetEditSingleVisible(id, userOrgID)
  3271. fmt.Println("错误", err)
  3272. fmt.Println("editpiclink", editpiclink)
  3273. if err != nil {
  3274. this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
  3275. return
  3276. }
  3277. this.ServeSuccessJSON(map[string]interface{}{
  3278. "editpiclink": editpiclink,
  3279. })
  3280. }
  3281. func (this *Microwebsite) UpdateSingleForm() {
  3282. adminUserInfo := this.GetAdminUserInfo()
  3283. userOrgID := int64(adminUserInfo.CurrentOrgId)
  3284. fmt.Println("机构id", userOrgID)
  3285. id, _ := this.GetInt64("id")
  3286. fmt.Println("id是多少", id)
  3287. dataBody := make(map[string]interface{}, 0)
  3288. err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
  3289. if err != nil {
  3290. utils.ErrorLog(err.Error())
  3291. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "参数错误")
  3292. return
  3293. }
  3294. images := dataBody["images"].(string)
  3295. fmt.Println("图片", images)
  3296. sort := int64(dataBody["sort"].(float64))
  3297. fmt.Println("排序", sort)
  3298. piclink := int64(dataBody["piclink"].(float64))
  3299. fmt.Println("图片链接", piclink)
  3300. linkaddress := dataBody["linkaddress"].(string)
  3301. fmt.Println("链接地址", linkaddress)
  3302. modelid := int64(dataBody["modeid"].(float64))
  3303. linkid := int64(dataBody["linkid"].(float64))
  3304. if piclink == 1 {
  3305. patientLinkaddress, err := site_service.UpdatedPatientLinkAddress(linkid, userOrgID)
  3306. fmt.Println("hhhhhhhhhhhhhhhhhhherr错误", err)
  3307. fmt.Println("patientlinkaddress", patientLinkaddress)
  3308. }
  3309. editpiclink := models.SgjPatientEditpiclink{
  3310. Images: images,
  3311. Sort: sort,
  3312. Piclink: piclink,
  3313. Linkaddress: linkaddress,
  3314. Linkid: linkid,
  3315. }
  3316. err = site_service.UpdateEditPatPicLink(id, userOrgID, editpiclink)
  3317. fmt.Println("第一个错误是设么", err)
  3318. patientEditpiclink, err := site_service.GetQueryEditpiclink(modelid, userOrgID)
  3319. fmt.Println("错误是多", err)
  3320. fmt.Println("pateientEditpiclink是多少", patientEditpiclink)
  3321. if err != nil {
  3322. this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
  3323. return
  3324. }
  3325. this.ServeSuccessJSON(map[string]interface{}{
  3326. "editpiclink": editpiclink,
  3327. "patientEditpiclink": patientEditpiclink,
  3328. })
  3329. }
  3330. func (this *Microwebsite) AddEditPicForm() {
  3331. adminUserInfo := this.GetAdminUserInfo()
  3332. userOrgID := int64(adminUserInfo.CurrentOrgId)
  3333. fmt.Println("机构id", userOrgID)
  3334. id, _ := this.GetInt64("id")
  3335. fmt.Println("这个广告id是多少?", id)
  3336. dataBody := make(map[string]interface{}, 0)
  3337. err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
  3338. if err != nil {
  3339. utils.ErrorLog(err.Error())
  3340. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "参数错误")
  3341. return
  3342. }
  3343. images := dataBody["images"].(string)
  3344. fmt.Println("图片", images)
  3345. sort := int64(dataBody["sort"].(float64))
  3346. fmt.Println("排序", sort)
  3347. piclink := int64(dataBody["piclink"].(float64))
  3348. fmt.Println("图片链接", piclink)
  3349. linkaddress := dataBody["linkaddress"].(string)
  3350. fmt.Println("链接地址", linkaddress)
  3351. linkid := int64(dataBody["linkid"].(float64))
  3352. //patientRotation, err := site_service.GetPatientRotationById(id, userOrgID)
  3353. //fmt.Println("错误",err)
  3354. //fmt.Println("rotation数据",patientRotation)
  3355. editpiclink := models.SgjPatientEditpiclink{
  3356. Images: images,
  3357. Sort: sort,
  3358. Piclink: piclink,
  3359. Linkaddress: linkaddress,
  3360. UserOrgId: userOrgID,
  3361. Ctime: time.Now().Unix(),
  3362. Status: 1,
  3363. Modeid: id,
  3364. ImgShow: 1,
  3365. Linkid: linkid,
  3366. }
  3367. err = site_service.AddImageslink(&editpiclink)
  3368. editpiclinks, err := site_service.GetPicImages(userOrgID, id)
  3369. fmt.Println("oooooooooooooooooooooooobbbbbbbbbbbbbb")
  3370. fmt.Println("err", err)
  3371. edipiclink, total, err := site_service.GetCountPicImages(userOrgID, id)
  3372. fmt.Println(edipiclink)
  3373. if err != nil {
  3374. this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
  3375. return
  3376. }
  3377. this.ServeSuccessJSON(map[string]interface{}{
  3378. "editpiclinks": editpiclinks,
  3379. "editpiclink": editpiclink,
  3380. "total": total,
  3381. })
  3382. }
  3383. func (this *Microwebsite) AddRotationVisible() {
  3384. adminUserInfo := this.GetAdminUserInfo()
  3385. userOrgID := int64(adminUserInfo.CurrentOrgId)
  3386. fmt.Println("机构id", userOrgID)
  3387. id, _ := this.GetInt64("id")
  3388. fmt.Println("编辑轮播id是多少", id)
  3389. dataBody := make(map[string]interface{}, 0)
  3390. err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
  3391. if err != nil {
  3392. utils.ErrorLog(err.Error())
  3393. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "参数错误")
  3394. return
  3395. }
  3396. title := dataBody["title"].(string)
  3397. fmt.Println("编辑轮播标题", title)
  3398. sort := int64(dataBody["sort"].(float64))
  3399. fmt.Println("编辑轮播排序", sort)
  3400. images := dataBody["images"]
  3401. fmt.Println("编辑轮播图片", images)
  3402. image := strings.Replace(strings.Trim(fmt.Sprint(images), "[]"), " ", ",", -1)
  3403. //fmt.Println(image)
  3404. patientRotation := models.SgjPatientRotation{
  3405. Title: title,
  3406. Sort: sort,
  3407. RotationImages: image,
  3408. }
  3409. //err = site_service.UpdateRotationByid(id, userOrgID, patientRotation)
  3410. //fmt.Println("这个错误是设么",err)
  3411. two := site_service.UpdateEditPicLinkTwo(id, userOrgID)
  3412. fmt.Println("two", two)
  3413. model := models.SgjPatientModel{
  3414. Title: title,
  3415. Sort: sort,
  3416. }
  3417. //rotation, err := site_service.GetPatientRotationById(id, userOrgID)
  3418. //fmt.Println("错误",err)
  3419. err = site_service.UpdateModelById(id, userOrgID, model)
  3420. fmt.Println("这个错误", err)
  3421. if err != nil {
  3422. this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
  3423. return
  3424. }
  3425. this.ServeSuccessJSON(map[string]interface{}{
  3426. "patientRotation": patientRotation,
  3427. "model": model,
  3428. })
  3429. }
  3430. func (this *Microwebsite) GetEditImagesDetail() {
  3431. adminUserInfo := this.GetAdminUserInfo()
  3432. userOrgID := int64(adminUserInfo.CurrentOrgId)
  3433. fmt.Println("机构id", userOrgID)
  3434. id, _ := this.GetInt64("id")
  3435. fmt.Println("海珍id是多少", id)
  3436. editmargin, err := site_service.QuerEditMarginById(id, userOrgID)
  3437. fmt.Println("错误", err)
  3438. fmt.Println("editmargin", editmargin)
  3439. if err != nil {
  3440. this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
  3441. return
  3442. }
  3443. this.ServeSuccessJSON(map[string]interface{}{
  3444. "editmargin": editmargin,
  3445. })
  3446. }
  3447. func (this *Microwebsite) UpdateEditMacgin() {
  3448. adminUserInfo := this.GetAdminUserInfo()
  3449. userOrgID := int64(adminUserInfo.CurrentOrgId)
  3450. fmt.Println("机构id", userOrgID)
  3451. id, _ := this.GetInt64("id")
  3452. fmt.Println("id是", id)
  3453. dataBody := make(map[string]interface{}, 0)
  3454. err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
  3455. if err != nil {
  3456. utils.ErrorLog(err.Error())
  3457. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "参数错误")
  3458. return
  3459. }
  3460. margtitle := dataBody["margtitle"].(string)
  3461. fmt.Println("导航标题", margtitle)
  3462. margimage := dataBody["margimage"].(string)
  3463. fmt.Println("导航图标", margimage)
  3464. jumpset := int64(dataBody["jumpset"].(float64))
  3465. fmt.Println("跳转设置", jumpset)
  3466. marginaddress := dataBody["marginaddress"].(string)
  3467. fmt.Println("地址", marginaddress)
  3468. editmargin := models.SgjPatientEditmargin{
  3469. Margtitle: margtitle,
  3470. Margimage: margimage,
  3471. Jumpset: jumpset,
  3472. Marginaddress: marginaddress,
  3473. }
  3474. err = site_service.UpdateMarginById(id, userOrgID, editmargin)
  3475. fmt.Println("错误", err)
  3476. if err != nil {
  3477. this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
  3478. return
  3479. }
  3480. this.ServeSuccessJSON(map[string]interface{}{
  3481. "editmargin": editmargin,
  3482. })
  3483. }
  3484. func (this *Microwebsite) GetActivities() {
  3485. adminUserInfo := this.GetAdminUserInfo()
  3486. userOrgID := int64(adminUserInfo.CurrentOrgId)
  3487. //fmt.Println("我爱你中国")
  3488. //fmt.Println("机构id",userOrgID)
  3489. addactivity, err := site_service.GetActivitiesById(userOrgID)
  3490. //fmt.Println("错误",err)
  3491. //fmt.Println("活动限制",addactivity.Number)
  3492. activity, err := site_service.GetAllActivities(userOrgID, addactivity.Number)
  3493. //fmt.Println("错误",err)
  3494. //fmt.Println("火气大",activity)
  3495. if err != nil {
  3496. this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
  3497. return
  3498. }
  3499. this.ServeSuccessJSON(map[string]interface{}{
  3500. "activity": activity,
  3501. })
  3502. }
  3503. func (this *Microwebsite) GetArticleType() {
  3504. adminUserInfo := this.GetAdminUserInfo()
  3505. userOrgID := int64(adminUserInfo.CurrentOrgId)
  3506. category, err := site_service.GetArticleType(userOrgID)
  3507. fmt.Println("错误", err)
  3508. fmt.Println("文章分类", category)
  3509. if err != nil {
  3510. this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
  3511. return
  3512. }
  3513. this.ServeSuccessJSON(map[string]interface{}{
  3514. "category": category,
  3515. })
  3516. }
  3517. func (this *Microwebsite) AddArticelist() {
  3518. adminUserInfo := this.GetAdminUserInfo()
  3519. userOrgID := int64(adminUserInfo.CurrentOrgId)
  3520. fmt.Println("机构id", userOrgID)
  3521. dataBody := make(map[string]interface{}, 0)
  3522. err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
  3523. if err != nil {
  3524. utils.ErrorLog(err.Error())
  3525. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "参数错误")
  3526. return
  3527. }
  3528. title := dataBody["title"].(string)
  3529. fmt.Println("标题", title)
  3530. if len(title) == 0 {
  3531. title = "暂无数据"
  3532. }
  3533. //category := int64(dataBody["category"].(float64))
  3534. //fmt.Println("文章分类",category)
  3535. //categoryone := int64(dataBody["categoryone"].(float64))
  3536. //fmt.Println("文章分类2",categoryone)
  3537. number := int64(dataBody["number"].(float64))
  3538. fmt.Println("展示数据", number)
  3539. sort := int64(dataBody["sort"].(float64))
  3540. fmt.Println("排序", sort)
  3541. model := models.SgjPatientModel{
  3542. Title: title,
  3543. Sort: sort,
  3544. UserOrgId: userOrgID,
  3545. Status: 1,
  3546. Ctime: time.Now().Unix(),
  3547. ModeType: 6,
  3548. }
  3549. site_service.AddPatientModel(&model)
  3550. patientModel, err := site_service.QueryModel(userOrgID)
  3551. articlelist := models.SgjPatientArticlelist{
  3552. Title: title,
  3553. Sort: sort,
  3554. UserOrgId: userOrgID,
  3555. Status: 1,
  3556. Ctime: time.Now().Unix(),
  3557. Number: number,
  3558. Modeid: patientModel.ID,
  3559. }
  3560. err = site_service.AddActiclelist(&articlelist)
  3561. if err != nil {
  3562. this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
  3563. return
  3564. }
  3565. this.ServeSuccessJSON(map[string]interface{}{
  3566. "articlelist": articlelist,
  3567. })
  3568. }
  3569. func (this *Microwebsite) GetArticlelist() {
  3570. adminUserInfo := this.GetAdminUserInfo()
  3571. userOrgID := int64(adminUserInfo.CurrentOrgId)
  3572. fmt.Println("文章机构id", userOrgID)
  3573. articlelist, err := site_service.GetArticlelist(userOrgID)
  3574. fmt.Println("articlelist", articlelist)
  3575. fmt.Println("错误", err)
  3576. fmt.Println(articlelist.Number)
  3577. articlelists, err := site_service.GetAllArticles(userOrgID, articlelist.Number)
  3578. fmt.Println("文章列表", articlelists)
  3579. fmt.Println("错误", err)
  3580. if err != nil {
  3581. this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
  3582. return
  3583. }
  3584. this.ServeSuccessJSON(map[string]interface{}{
  3585. "articlelists": articlelists,
  3586. })
  3587. }
  3588. func (this *Microwebsite) EditGetArticlistDetail() {
  3589. adminUserInfo := this.GetAdminUserInfo()
  3590. userOrgID := int64(adminUserInfo.CurrentOrgId)
  3591. fmt.Println("机构id", userOrgID)
  3592. id, _ := this.GetInt64("id")
  3593. fmt.Println("id是多少?", id)
  3594. articlelist, err := site_service.GetArticlelistById(id, userOrgID)
  3595. if err != nil {
  3596. this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
  3597. return
  3598. }
  3599. this.ServeSuccessJSON(map[string]interface{}{
  3600. "articlelist": articlelist,
  3601. })
  3602. }
  3603. func (this *Microwebsite) SaveArticeDetail() {
  3604. adminUserInfo := this.GetAdminUserInfo()
  3605. userOrgID := int64(adminUserInfo.CurrentOrgId)
  3606. fmt.Println("机构id", userOrgID)
  3607. id, _ := this.GetInt64("id")
  3608. fmt.Println("获取id是多少?", id)
  3609. dataBody := make(map[string]interface{}, 0)
  3610. err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
  3611. if err != nil {
  3612. utils.ErrorLog(err.Error())
  3613. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "参数错误")
  3614. return
  3615. }
  3616. title := dataBody["title"].(string)
  3617. fmt.Println("活动标题", title)
  3618. if len(title) == 0 {
  3619. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "标题不能为空")
  3620. return
  3621. }
  3622. sort := int64(dataBody["sort"].(float64))
  3623. fmt.Println("排序", sort)
  3624. number := int64(dataBody["number"].(float64))
  3625. fmt.Println("条数", number)
  3626. modeid := int64(dataBody["modeid"].(float64))
  3627. fmt.Println("模块ID", modeid)
  3628. model := models.SgjPatientModel{
  3629. Title: title,
  3630. Sort: sort,
  3631. }
  3632. err = site_service.UpdateModel(modeid, userOrgID, model)
  3633. fmt.Println("错误", err)
  3634. articlelist := models.SgjPatientArticlelist{
  3635. Title: title,
  3636. Sort: sort,
  3637. Number: number,
  3638. }
  3639. err = site_service.UpdateArticeDetail(id, userOrgID, articlelist)
  3640. fmt.Println("错误", err)
  3641. if err != nil {
  3642. this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
  3643. return
  3644. }
  3645. this.ServeSuccessJSON(map[string]interface{}{
  3646. "articlelist": articlelist,
  3647. "model": model,
  3648. })
  3649. }
  3650. func (this *Microwebsite) GetMacImages() {
  3651. adminUserInfo := this.GetAdminUserInfo()
  3652. userOrgID := adminUserInfo.CurrentOrgId
  3653. id, _ := this.GetInt64("id")
  3654. fmt.Println("机构id", userOrgID)
  3655. fmt.Println("导航图标", id)
  3656. model, err := site_service.GetModelById(id, userOrgID)
  3657. fmt.Println("错误是设么", err)
  3658. fmt.Println("model是什么", model)
  3659. macnavigation, err := site_service.GetMacImagesByModeid(id, userOrgID)
  3660. fmt.Println("中袖返回数据", macnavigation)
  3661. fmt.Println("错误", err)
  3662. if err != nil {
  3663. this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
  3664. return
  3665. }
  3666. this.ServeSuccessJSON(map[string]interface{}{
  3667. "macnavigation": macnavigation,
  3668. "model": model,
  3669. })
  3670. }
  3671. func (this *Microwebsite) GetEnImages() {
  3672. adminUserInfo := this.GetAdminUserInfo()
  3673. userOrgID := adminUserInfo.CurrentOrgId
  3674. fmt.Println("机构id", userOrgID)
  3675. enviroimages, err := site_service.GetEnImages(userOrgID)
  3676. fmt.Println("错误", err)
  3677. fmt.Println("enviroimages", enviroimages)
  3678. if err != nil {
  3679. this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
  3680. return
  3681. }
  3682. this.ServeSuccessJSON(map[string]interface{}{
  3683. "enviroimages": enviroimages,
  3684. })
  3685. }
  3686. func (this *Microwebsite) GetEditEnvirimages() {
  3687. adminUserInfo := this.GetAdminUserInfo()
  3688. userOrgID := adminUserInfo.CurrentOrgId
  3689. fmt.Println("机构id", userOrgID)
  3690. id, _ := this.GetInt64("id")
  3691. fmt.Println("id是", id)
  3692. enviroimages, err := site_service.GetEditEnvirimagesById(userOrgID, id)
  3693. if err != nil {
  3694. this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
  3695. return
  3696. }
  3697. this.ServeSuccessJSON(map[string]interface{}{
  3698. "enviroimages": enviroimages,
  3699. })
  3700. }
  3701. func (this *Microwebsite) AddTwoImages() {
  3702. adminUserInfo := this.GetAdminUserInfo()
  3703. userOrgID := adminUserInfo.CurrentOrgId
  3704. fmt.Println("机构id", userOrgID)
  3705. id, _ := this.GetInt64("id")
  3706. fmt.Println("id是", id)
  3707. dataBody := make(map[string]interface{}, 0)
  3708. err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
  3709. if err != nil {
  3710. utils.ErrorLog(err.Error())
  3711. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "参数错误")
  3712. return
  3713. }
  3714. enviroimages := dataBody["enviroimages"].(string)
  3715. fmt.Println("活动标题", enviroimages)
  3716. if len(enviroimages) == 0 {
  3717. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "标题不能为空")
  3718. return
  3719. }
  3720. sort := int64(dataBody["sort"].(float64))
  3721. fmt.Println("排序", sort)
  3722. patientEnviroimages := models.SgjPatientEnviroimages{
  3723. Enviroimages: enviroimages,
  3724. Sort: sort,
  3725. }
  3726. err = site_service.UpdateEnviroimages(id, userOrgID, patientEnviroimages)
  3727. fmt.Println("错误", err)
  3728. if err != nil {
  3729. this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
  3730. return
  3731. }
  3732. this.ServeSuccessJSON(map[string]interface{}{
  3733. "patientEnviroimages": patientEnviroimages,
  3734. })
  3735. }
  3736. func (this *Microwebsite) AddOfficeThree() {
  3737. adminUserInfo := this.GetAdminUserInfo()
  3738. userOrgID := adminUserInfo.CurrentOrgId
  3739. fmt.Println("机构id", userOrgID)
  3740. id, _ := this.GetInt64("id")
  3741. fmt.Println("科室环境id是", id)
  3742. dataBody := make(map[string]interface{}, 0)
  3743. err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
  3744. if err != nil {
  3745. utils.ErrorLog(err.Error())
  3746. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "参数错误")
  3747. return
  3748. }
  3749. officeImages := dataBody["officeImages"].(string)
  3750. fmt.Println("活动标题", officeImages)
  3751. if len(officeImages) == 0 {
  3752. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "标题不能为空")
  3753. return
  3754. }
  3755. sort := int64(dataBody["sort"].(float64))
  3756. fmt.Println("排序", sort)
  3757. offenvironment, err := site_service.GetOffENvironmentById(id, userOrgID)
  3758. fmt.Println("offenvironment", offenvironment)
  3759. enviroimages := models.SgjPatientEnviroimages{
  3760. Enviroimages: officeImages,
  3761. Sort: sort,
  3762. UserOrgId: userOrgID,
  3763. Status: 1,
  3764. Ctime: time.Now().Unix(),
  3765. Modeid: id,
  3766. }
  3767. err = site_service.AddOfficeThree(&enviroimages)
  3768. fmt.Println("err", err)
  3769. if err != nil {
  3770. this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
  3771. return
  3772. }
  3773. patientEnviroimages, err := site_service.GetQueryImages(id, userOrgID)
  3774. this.ServeSuccessJSON(map[string]interface{}{
  3775. "enviroimages": enviroimages,
  3776. "patientEnviroimages": patientEnviroimages,
  3777. })
  3778. }
  3779. func (this *Microwebsite) GetOfficeTwoVisible() {
  3780. adminUserInfo := this.GetAdminUserInfo()
  3781. userOrgID := adminUserInfo.CurrentOrgId
  3782. fmt.Println("机构id", userOrgID)
  3783. id, _ := this.GetInt64("id")
  3784. fmt.Println("id是", id)
  3785. enviroimages, err := site_service.GetOfficeTwoVisible(userOrgID, id)
  3786. if err != nil {
  3787. this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
  3788. return
  3789. }
  3790. this.ServeSuccessJSON(map[string]interface{}{
  3791. "enviroimages": enviroimages,
  3792. })
  3793. }
  3794. func (this *Microwebsite) AddOfficeTwo() {
  3795. adminUserInfo := this.GetAdminUserInfo()
  3796. userOrgID := adminUserInfo.CurrentOrgId
  3797. fmt.Println("机构id", userOrgID)
  3798. id, _ := this.GetInt64("id")
  3799. fmt.Println("id是", id)
  3800. dataBody := make(map[string]interface{}, 0)
  3801. err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
  3802. if err != nil {
  3803. utils.ErrorLog(err.Error())
  3804. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "参数错误")
  3805. return
  3806. }
  3807. officeImages := dataBody["officeImages"].(string)
  3808. fmt.Println("活动标题", officeImages)
  3809. if len(officeImages) == 0 {
  3810. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "标题不能为空")
  3811. return
  3812. }
  3813. sort := int64(dataBody["sort"].(float64))
  3814. fmt.Println("排序", sort)
  3815. modelid := int64(dataBody["modelid"].(float64))
  3816. fmt.Println("小泽", modelid)
  3817. enviroimages := models.SgjPatientEnviroimages{
  3818. Enviroimages: officeImages,
  3819. Sort: sort,
  3820. }
  3821. err = site_service.UpdateOfficeTwo(userOrgID, id, enviroimages)
  3822. patientEnviroimages, err := site_service.GetQueryEnviroimage(userOrgID, modelid)
  3823. fmt.Println("错误是什么", err)
  3824. if err != nil {
  3825. this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
  3826. return
  3827. }
  3828. this.ServeSuccessJSON(map[string]interface{}{
  3829. "enviroimages": enviroimages,
  3830. "patientEnviroimages": patientEnviroimages,
  3831. })
  3832. }
  3833. func (this *Microwebsite) DeleteOfficeById() {
  3834. adminUserInfo := this.GetAdminUserInfo()
  3835. userOrgID := adminUserInfo.CurrentOrgId
  3836. fmt.Println("机构id", userOrgID)
  3837. id, _ := this.GetInt64("id")
  3838. fmt.Println("id是", id)
  3839. err := site_service.DeleteOfficeById(id, userOrgID)
  3840. fmt.Println("错误", err)
  3841. returnData := make(map[string]interface{}, 0)
  3842. returnData["msg"] = "ok"
  3843. this.ServeSuccessJSON(returnData)
  3844. return
  3845. }
  3846. func (this *Microwebsite) GetArticleById() {
  3847. adminUserInfo := this.GetAdminUserInfo()
  3848. userOrgID := adminUserInfo.CurrentOrgId
  3849. fmt.Println("机构id", userOrgID)
  3850. articTypeid, _ := this.GetInt64("id")
  3851. fmt.Println("id是", articTypeid)
  3852. articlelist, err := site_service.GetArticleById(articTypeid, userOrgID)
  3853. fmt.Println("错误", err)
  3854. fmt.Println("articlelist", articlelist)
  3855. if err != nil {
  3856. this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
  3857. return
  3858. }
  3859. this.ServeSuccessJSON(map[string]interface{}{
  3860. "articlelist": articlelist,
  3861. })
  3862. }
  3863. func (this *Microwebsite) GetAllActivity() {
  3864. adminUserInfo := this.GetAdminUserInfo()
  3865. userOrgID := adminUserInfo.CurrentOrgId
  3866. fmt.Println("机构id", userOrgID)
  3867. activtity, err := site_service.GetAllActivity(userOrgID)
  3868. fmt.Println("活动列表", activtity)
  3869. if err != nil {
  3870. this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
  3871. return
  3872. }
  3873. this.ServeSuccessJSON(map[string]interface{}{
  3874. "activtity": activtity,
  3875. })
  3876. }
  3877. func (this *Microwebsite) AddData() {
  3878. adminUserInfo := this.GetAdminUserInfo()
  3879. userOrgID := adminUserInfo.CurrentOrgId
  3880. fmt.Println("机构id", userOrgID)
  3881. defineaddress := this.GetString("address")
  3882. fmt.Println("站位地址", defineaddress)
  3883. patientLinkaddress := models.SgjPatientLinkaddress{
  3884. Defineaddress: defineaddress,
  3885. UserOrgId: userOrgID,
  3886. Status: 1,
  3887. Ctime: time.Now().Unix(),
  3888. }
  3889. err := site_service.AddLinkAddress(&patientLinkaddress)
  3890. fmt.Println("错误是设么", err)
  3891. if err != nil {
  3892. this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
  3893. return
  3894. }
  3895. this.ServeSuccessJSON(map[string]interface{}{
  3896. "patientLinkaddress": patientLinkaddress,
  3897. })
  3898. }
  3899. func (this *Microwebsite) Getlinkaddress() {
  3900. adminUserInfo := this.GetAdminUserInfo()
  3901. userOrgID := adminUserInfo.CurrentOrgId
  3902. fmt.Println("机构id", userOrgID)
  3903. id, _ := this.GetInt64("id")
  3904. fmt.Println("id", id)
  3905. linkaddress, err := site_service.GetLinkAddress(userOrgID, id)
  3906. fmt.Println("错误", err)
  3907. fmt.Println("地址", linkaddress)
  3908. if err != nil {
  3909. this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
  3910. return
  3911. }
  3912. this.ServeSuccessJSON(map[string]interface{}{
  3913. "linkaddress": linkaddress,
  3914. })
  3915. }
  3916. func (this *Microwebsite) GetAllConnecway() {
  3917. adminUserInfo := this.GetAdminUserInfo()
  3918. userOrgID := adminUserInfo.CurrentOrgId
  3919. fmt.Println("机构id", userOrgID)
  3920. connect, err := site_service.GetAllConnecway(userOrgID)
  3921. fmt.Println("错误是什么", err)
  3922. fmt.Println("connect是设么", connect)
  3923. if err != nil {
  3924. this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
  3925. return
  3926. }
  3927. this.ServeSuccessJSON(map[string]interface{}{
  3928. "connect": connect,
  3929. })
  3930. }
  3931. func (this *Microwebsite) GetConnecway() {
  3932. adminUserInfo := this.GetAdminUserInfo()
  3933. userOrgID := adminUserInfo.CurrentOrgId
  3934. fmt.Println("机构id", userOrgID)
  3935. id, _ := this.GetInt64("id")
  3936. fmt.Println("id是", id)
  3937. ordmodel, err := site_service.GetConnecway(userOrgID, id)
  3938. if err != nil {
  3939. this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
  3940. return
  3941. }
  3942. this.ServeSuccessJSON(map[string]interface{}{
  3943. "ordmodel": ordmodel,
  3944. })
  3945. }
  3946. func (this *Microwebsite) GetConnecwayById() {
  3947. adminUserInfo := this.GetAdminUserInfo()
  3948. userOrgID := adminUserInfo.CurrentOrgId
  3949. fmt.Println("机构id", userOrgID)
  3950. id, _ := this.GetInt64("id")
  3951. fmt.Println("id是", id)
  3952. connection, err := site_service.GetConnecwayById(userOrgID, id)
  3953. if err != nil {
  3954. this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
  3955. return
  3956. }
  3957. this.ServeSuccessJSON(map[string]interface{}{
  3958. "connection": connection,
  3959. })
  3960. }
  3961. func (this *Microwebsite) UpdateConnectway() {
  3962. adminUserInfo := this.GetAdminUserInfo()
  3963. userOrgID := adminUserInfo.CurrentOrgId
  3964. fmt.Println("机构id", userOrgID)
  3965. id, _ := this.GetInt64("id")
  3966. fmt.Println("id是", id)
  3967. dataBody := make(map[string]interface{}, 0)
  3968. err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
  3969. if err != nil {
  3970. utils.ErrorLog(err.Error())
  3971. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "参数错误")
  3972. return
  3973. }
  3974. title := dataBody["title"].(string)
  3975. fmt.Println("标题", title)
  3976. connecway := int64(dataBody["connecway"].(float64))
  3977. fmt.Println("联系方式", connecway)
  3978. content := dataBody["content"].(string)
  3979. fmt.Println("内容", content)
  3980. connection := models.SgjPatientConnection{
  3981. Title: title,
  3982. Connecway: connecway,
  3983. Content: content,
  3984. }
  3985. err = site_service.UpdateConnectway(id, userOrgID, connection)
  3986. fmt.Println("错误", err)
  3987. if err != nil {
  3988. this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
  3989. return
  3990. }
  3991. this.ServeSuccessJSON(map[string]interface{}{
  3992. "connection": connection,
  3993. })
  3994. }
  3995. func (this *Microwebsite) UpdateContact() {
  3996. adminUserInfo := this.GetAdminUserInfo()
  3997. userOrgID := adminUserInfo.CurrentOrgId
  3998. fmt.Println("机构id", userOrgID)
  3999. id, _ := this.GetInt64("id")
  4000. fmt.Println("id是", id)
  4001. dataBody := make(map[string]interface{}, 0)
  4002. err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
  4003. if err != nil {
  4004. utils.ErrorLog(err.Error())
  4005. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "参数错误")
  4006. return
  4007. }
  4008. title := dataBody["title"].(string)
  4009. fmt.Println("标题", title)
  4010. sort := int64(dataBody["sort"].(float64))
  4011. fmt.Println("排序", sort)
  4012. ordmodel := models.SgjPatientOrdmodel{
  4013. Title: title,
  4014. Sort: sort,
  4015. }
  4016. connectway := models.SgjPatientConnectway{
  4017. Title: title,
  4018. Sort: sort,
  4019. }
  4020. err = site_service.UpdateOrdeModel(id, userOrgID, ordmodel)
  4021. err = site_service.UpdateConnectways(id, userOrgID, connectway)
  4022. if err != nil {
  4023. this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
  4024. return
  4025. }
  4026. this.ServeSuccessJSON(map[string]interface{}{
  4027. "ordmodel": ordmodel,
  4028. "connectway": connectway,
  4029. })
  4030. }
  4031. func (this *Microwebsite) AddConnectways() {
  4032. adminUserInfo := this.GetAdminUserInfo()
  4033. userOrgID := adminUserInfo.CurrentOrgId
  4034. fmt.Println("机构id", userOrgID)
  4035. dataBody := make(map[string]interface{}, 0)
  4036. err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
  4037. if err != nil {
  4038. utils.ErrorLog(err.Error())
  4039. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "参数错误")
  4040. return
  4041. }
  4042. title := dataBody["title"].(string)
  4043. fmt.Println("标题", title)
  4044. connecway := int64(dataBody["connecway"].(float64))
  4045. fmt.Println("联系方式", connecway)
  4046. content := dataBody["content"].(string)
  4047. connection := models.SgjPatientConnection{
  4048. Title: title,
  4049. Connecway: connecway,
  4050. Content: content,
  4051. UserOrgId: userOrgID,
  4052. Ctime: time.Now().Unix(),
  4053. Status: 1,
  4054. }
  4055. err = site_service.AddConnectways(&connection)
  4056. if err != nil {
  4057. this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
  4058. return
  4059. }
  4060. this.ServeSuccessJSON(map[string]interface{}{
  4061. "connection": connection,
  4062. })
  4063. }
  4064. func (this *Microwebsite) GetHostpitalIntroduction() {
  4065. adminUserInfo := this.GetAdminUserInfo()
  4066. userOrgID := adminUserInfo.CurrentOrgId
  4067. fmt.Println("机构id", userOrgID)
  4068. id, _ := this.GetInt64("id")
  4069. fmt.Println("id是", id)
  4070. ordmodel, err := site_service.GetHostpitalIntroduction(userOrgID, id)
  4071. hosaddress, err := site_service.GetHostpitaAddress(userOrgID, id)
  4072. if err != nil {
  4073. this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
  4074. return
  4075. }
  4076. this.ServeSuccessJSON(map[string]interface{}{
  4077. "ordmodel": ordmodel,
  4078. "hosaddress": hosaddress,
  4079. })
  4080. }
  4081. func (this *Microwebsite) UpdateHospitalAddress() {
  4082. adminUserInfo := this.GetAdminUserInfo()
  4083. userOrgID := adminUserInfo.CurrentOrgId
  4084. fmt.Println("机构id", userOrgID)
  4085. id, _ := this.GetInt64("id")
  4086. fmt.Println("id是", id)
  4087. dataBody := make(map[string]interface{}, 0)
  4088. err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
  4089. if err != nil {
  4090. utils.ErrorLog(err.Error())
  4091. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "参数错误")
  4092. return
  4093. }
  4094. title := dataBody["title"].(string)
  4095. fmt.Println("标题", title)
  4096. sort := int64(dataBody["sort"].(float64))
  4097. fmt.Println("排序", sort)
  4098. address := dataBody["hosaddress"].(string)
  4099. fmt.Println("地址", address)
  4100. ordmodel := models.SgjPatientOrdmodel{
  4101. Title: title,
  4102. Sort: sort,
  4103. }
  4104. hosaddress := models.SgjPatientHosaddress{
  4105. Title: title,
  4106. Sort: sort,
  4107. Address: address,
  4108. }
  4109. err = site_service.UpdateOrdeModel(id, userOrgID, ordmodel)
  4110. err = site_service.UpdateHosAddress(id, userOrgID, hosaddress)
  4111. if err != nil {
  4112. this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
  4113. return
  4114. }
  4115. this.ServeSuccessJSON(map[string]interface{}{
  4116. "ordmodel": ordmodel,
  4117. "hosaddress": hosaddress,
  4118. })
  4119. }
  4120. func (this *Microwebsite) AddPicLinkAddress() {
  4121. adminUserInfo := this.GetAdminUserInfo()
  4122. userOrgID := adminUserInfo.CurrentOrgId
  4123. fmt.Println("机构id", userOrgID)
  4124. dataBody := make(map[string]interface{}, 0)
  4125. err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
  4126. if err != nil {
  4127. utils.ErrorLog(err.Error())
  4128. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "参数错误")
  4129. return
  4130. }
  4131. defineaddress := dataBody["defineaddress"].(string)
  4132. fmt.Println("defineaddress", defineaddress)
  4133. conlinkaddress := models.SgjPatientConlinkaddress{
  4134. Defineaddress: defineaddress,
  4135. UserOrgId: userOrgID,
  4136. Status: 1,
  4137. Ctime: time.Now().Unix(),
  4138. }
  4139. err = site_service.AddConlinkaddress(&conlinkaddress)
  4140. fmt.Println("错误", err)
  4141. if err != nil {
  4142. this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
  4143. return
  4144. }
  4145. this.ServeSuccessJSON(map[string]interface{}{
  4146. "conlinkaddress": conlinkaddress,
  4147. })
  4148. }
  4149. func (this *Microwebsite) GetLinkAddressDetail() {
  4150. adminUserInfo := this.GetAdminUserInfo()
  4151. userOrgID := adminUserInfo.CurrentOrgId
  4152. fmt.Println("机构id", userOrgID)
  4153. id, _ := this.GetInt64("id")
  4154. fmt.Println("链接id", id)
  4155. conlinkaddress, err := site_service.GetLinkAddressDetail(userOrgID, id)
  4156. fmt.Println("错误", err)
  4157. fmt.Println("conlinkaddress", conlinkaddress)
  4158. if err != nil {
  4159. this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
  4160. return
  4161. }
  4162. this.ServeSuccessJSON(map[string]interface{}{
  4163. "conlinkaddress": conlinkaddress,
  4164. })
  4165. }
  4166. func (this *Microwebsite) UpdatePicFformThree() {
  4167. adminUserInfo := this.GetAdminUserInfo()
  4168. userOrgID := adminUserInfo.CurrentOrgId
  4169. fmt.Println("机构id好", userOrgID)
  4170. id, _ := this.GetInt64("id")
  4171. fmt.Println("id", id)
  4172. dataBody := make(map[string]interface{}, 0)
  4173. err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
  4174. if err != nil {
  4175. utils.ErrorLog(err.Error())
  4176. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "参数错误")
  4177. return
  4178. }
  4179. defineaddress := dataBody["defineaddress"].(string)
  4180. fmt.Println("defineaddress", defineaddress)
  4181. conlinkaddress := models.SgjPatientConlinkaddress{
  4182. Defineaddress: defineaddress,
  4183. UserOrgId: userOrgID,
  4184. Status: 1,
  4185. Ctime: time.Now().Unix(),
  4186. }
  4187. //err = site_service.UpdatedConlinkAddress(id, userOrgID, conlinkaddress)
  4188. err = site_service.AddConlinkAddress(&conlinkaddress)
  4189. if err != nil {
  4190. this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
  4191. return
  4192. }
  4193. this.ServeSuccessJSON(map[string]interface{}{
  4194. "conlinkaddress": conlinkaddress,
  4195. })
  4196. }
  4197. func (this *Microwebsite) GetEnImagesTwo() {
  4198. adminUserInfo := this.GetAdminUserInfo()
  4199. userOrgID := adminUserInfo.CurrentOrgId
  4200. editpiclink, err := site_service.GetEnImagesTwo(userOrgID)
  4201. fmt.Println("次哦啊", err)
  4202. fmt.Println("editpiclink是设么", editpiclink)
  4203. if err != nil {
  4204. this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
  4205. return
  4206. }
  4207. this.ServeSuccessJSON(map[string]interface{}{
  4208. "editpiclink": editpiclink,
  4209. })
  4210. }
  4211. func (this *Microwebsite) GetEnImagesThree() {
  4212. adminUserInfo := this.GetAdminUserInfo()
  4213. userOrgID := adminUserInfo.CurrentOrgId
  4214. conrotation, err := site_service.GetEnImagesThree(userOrgID)
  4215. fmt.Println("conrotation是傻子", conrotation)
  4216. fmt.Println("cer", err)
  4217. if err != nil {
  4218. this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
  4219. return
  4220. }
  4221. this.ServeSuccessJSON(map[string]interface{}{
  4222. "conrotation": conrotation,
  4223. })
  4224. }
  4225. func (this *Microwebsite) AddMagiclinkData() {
  4226. adminUserInfo := this.GetAdminUserInfo()
  4227. userOrgID := adminUserInfo.CurrentOrgId
  4228. fmt.Println("机构ID", userOrgID)
  4229. dataBody := make(map[string]interface{}, 0)
  4230. err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
  4231. if err != nil {
  4232. utils.ErrorLog(err.Error())
  4233. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "参数错误")
  4234. return
  4235. }
  4236. linkType := int64(dataBody["linkType"].(float64))
  4237. fmt.Println("链接类型", linkType)
  4238. Instationlink := int64(dataBody["instationlink"].(float64))
  4239. fmt.Println("站内链接", Instationlink)
  4240. //intstationlink, err := strconv.ParseInt(Instationlink, 10, 64)
  4241. //articeType := int64(dataBody["articeType"].(float64))
  4242. //fmt.Println("文章分类",articeType)
  4243. phone := dataBody["phone"].(string)
  4244. fmt.Println("电话号码", phone)
  4245. outstationlink := dataBody["outstationlink"].(string)
  4246. fmt.Println("站外链接", outstationlink)
  4247. magiclink := models.SgjPatientMagiclink{
  4248. Linktype: linkType,
  4249. Instationlink: Instationlink,
  4250. Phone: phone,
  4251. Outstationlink: outstationlink,
  4252. Ctime: time.Now().Unix(),
  4253. Status: 1,
  4254. UserOrgId: userOrgID,
  4255. }
  4256. err = site_service.AddMagiclinkData(&magiclink)
  4257. fmt.Println("错误", err)
  4258. model, err := site_service.GetPatienModelByModelId(Instationlink, userOrgID)
  4259. fmt.Println("错误", err)
  4260. fmt.Println("model", model)
  4261. this.ServeSuccessJSON(map[string]interface{}{
  4262. "magiclink": magiclink,
  4263. "model": model,
  4264. })
  4265. }
  4266. func (this *Microwebsite) GetMacLinkAddress() {
  4267. adminUserInfo := this.GetAdminUserInfo()
  4268. userOrgID := adminUserInfo.CurrentOrgId
  4269. fmt.Println("机构ID", userOrgID)
  4270. magiclink, err := site_service.GetMacLinkAddress(userOrgID)
  4271. fmt.Println("magiclink", magiclink)
  4272. fmt.Println("中秋梦玲", err)
  4273. if err != nil {
  4274. this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
  4275. return
  4276. }
  4277. this.ServeSuccessJSON(map[string]interface{}{
  4278. "magiclink": magiclink,
  4279. })
  4280. }
  4281. func (this *Microwebsite) AddMacgicform() {
  4282. adminUserInfo := this.GetAdminUserInfo()
  4283. userOrgID := adminUserInfo.CurrentOrgId
  4284. fmt.Println("机构ID", userOrgID)
  4285. id, _ := this.GetInt64("id")
  4286. fmt.Println("id是多少", id)
  4287. dataBody := make(map[string]interface{}, 0)
  4288. err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
  4289. if err != nil {
  4290. utils.ErrorLog(err.Error())
  4291. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "参数错误")
  4292. return
  4293. }
  4294. title := dataBody["title"].(string)
  4295. fmt.Println("导航标题", title)
  4296. macgicimages := dataBody["macgicimages"].(string)
  4297. fmt.Println("导航图标", macgicimages)
  4298. jumpset := int64(dataBody["jumpset"].(float64))
  4299. fmt.Println("跳转设置", jumpset)
  4300. linkaddress := dataBody["linkaddress"].(string)
  4301. fmt.Println("链接地址", linkaddress)
  4302. editmargin := models.SgjPatientEditmargin{
  4303. Margtitle: title,
  4304. Margimage: macgicimages,
  4305. Jumpset: jumpset,
  4306. Marginaddress: macgicimages,
  4307. UserOrgId: userOrgID,
  4308. Modeid: id,
  4309. Status: 1,
  4310. Ctime: time.Now().Unix(),
  4311. }
  4312. err = site_service.AddMacgicform(&editmargin)
  4313. if err != nil {
  4314. this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
  4315. return
  4316. }
  4317. this.ServeSuccessJSON(map[string]interface{}{
  4318. "editmargin": editmargin,
  4319. })
  4320. }
  4321. func (this *Microwebsite) GetMacImagesDetail() {
  4322. adminUserInfo := this.GetAdminUserInfo()
  4323. userOrgID := adminUserInfo.CurrentOrgId
  4324. fmt.Println("机构ID", userOrgID)
  4325. id, _ := this.GetInt64("id")
  4326. fmt.Println("id是多少", id)
  4327. editmargin, err := site_service.GetMacImagesDetail(userOrgID, id)
  4328. if err != nil {
  4329. this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
  4330. return
  4331. }
  4332. this.ServeSuccessJSON(map[string]interface{}{
  4333. "editmargin": editmargin,
  4334. })
  4335. }
  4336. func (this *Microwebsite) DeleteMacImagesDetail() {
  4337. adminUserInfo := this.GetAdminUserInfo()
  4338. userOrgID := adminUserInfo.CurrentOrgId
  4339. fmt.Println("机构ID", userOrgID)
  4340. id, _ := this.GetInt64("id")
  4341. fmt.Println("id是多少", id)
  4342. err := site_service.DeletMacImagesDetail(id, userOrgID)
  4343. if err != nil {
  4344. this.ServeFailJsonSend(enums.ErrorCodeDataException, "删除回复成功")
  4345. return
  4346. }
  4347. returnData := make(map[string]interface{}, 0)
  4348. returnData["msg"] = "ok"
  4349. this.ServeSuccessJSON(returnData)
  4350. return
  4351. }
  4352. func (this *Microwebsite) UpdateMacForm() {
  4353. adminUserInfo := this.GetAdminUserInfo()
  4354. userOrgID := adminUserInfo.CurrentOrgId
  4355. fmt.Println("机构ID", userOrgID)
  4356. id, _ := this.GetInt64("id")
  4357. fmt.Println("id是多少", id)
  4358. dataBody := make(map[string]interface{}, 0)
  4359. err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
  4360. if err != nil {
  4361. utils.ErrorLog(err.Error())
  4362. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "参数错误")
  4363. return
  4364. }
  4365. title := dataBody["title"].(string)
  4366. fmt.Println("导航标题", title)
  4367. sort := int64(dataBody["sort"].(float64))
  4368. fmt.Println("排序", sort)
  4369. model := models.SgjPatientModel{
  4370. Title: title,
  4371. Sort: sort,
  4372. }
  4373. err = site_service.UpdateModel(id, userOrgID, model)
  4374. if err != nil {
  4375. this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
  4376. return
  4377. }
  4378. this.ServeSuccessJSON(map[string]interface{}{
  4379. "model": model,
  4380. })
  4381. }
  4382. func (this *Microwebsite) GetEditMacImageDetail() {
  4383. adminUserInfo := this.GetAdminUserInfo()
  4384. userOrgID := adminUserInfo.CurrentOrgId
  4385. fmt.Println("机构中秋ID", userOrgID)
  4386. id, _ := this.GetInt64("id")
  4387. fmt.Println("机构宗秀id", id)
  4388. editmargin, err := site_service.GetEditMacImageDetailById(userOrgID, id)
  4389. fmt.Println("ditmargin", editmargin)
  4390. fmt.Println("错误", err)
  4391. if err != nil {
  4392. this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
  4393. return
  4394. }
  4395. this.ServeSuccessJSON(map[string]interface{}{
  4396. "editmargin": editmargin,
  4397. })
  4398. }
  4399. func (this *Microwebsite) UpdateEditMacForm() {
  4400. adminUserInfo := this.GetAdminUserInfo()
  4401. userOrgID := adminUserInfo.CurrentOrgId
  4402. fmt.Println("机构中秋ID", userOrgID)
  4403. id, _ := this.GetInt64("id")
  4404. fmt.Println("中秋id", id)
  4405. dataBody := make(map[string]interface{}, 0)
  4406. err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
  4407. if err != nil {
  4408. utils.ErrorLog(err.Error())
  4409. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "参数错误")
  4410. return
  4411. }
  4412. margtitle := dataBody["margtitle"].(string)
  4413. fmt.Println("导航标题", margtitle)
  4414. margimage := dataBody["margimage"].(string)
  4415. fmt.Println("导航图片", margimage)
  4416. jumpset := int64(dataBody["jumpset"].(float64))
  4417. fmt.Println("导航设置", jumpset)
  4418. marginaddress := dataBody["marginaddress"].(string)
  4419. fmt.Println("导航图标链接地址", marginaddress)
  4420. editmargin := models.SgjPatientEditmargin{
  4421. Margtitle: margtitle,
  4422. Margimage: margimage,
  4423. Jumpset: jumpset,
  4424. Marginaddress: marginaddress,
  4425. }
  4426. err = site_service.UpdateEditMacFormById(id, userOrgID, editmargin)
  4427. fmt.Println("爆粗", err)
  4428. if err != nil {
  4429. this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
  4430. return
  4431. }
  4432. this.ServeSuccessJSON(map[string]interface{}{
  4433. "editmargin": editmargin,
  4434. })
  4435. }
  4436. func (this *Microwebsite) GetLikeMacAddressById() {
  4437. adminUserInfo := this.GetAdminUserInfo()
  4438. userOrgID := adminUserInfo.CurrentOrgId
  4439. //fmt.Println("机构中秋ID", userOrgID)
  4440. id, _ := this.GetInt64("id")
  4441. fmt.Println("中秋id", id)
  4442. magiclink, err := site_service.GetLikeMacAddressById(userOrgID, id)
  4443. fmt.Println("中秋快乐", magiclink)
  4444. fmt.Println("错误", err)
  4445. if err != nil {
  4446. this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
  4447. return
  4448. }
  4449. this.ServeSuccessJSON(map[string]interface{}{
  4450. "magiclink": magiclink,
  4451. })
  4452. }
  4453. func (this *Microwebsite) GetArticleName() {
  4454. adminUserInfo := this.GetAdminUserInfo()
  4455. userOrgID := adminUserInfo.CurrentOrgId
  4456. fmt.Println("ID", userOrgID)
  4457. id, _ := this.GetInt64("id")
  4458. articlelist, err := site_service.GetArticleById(id, userOrgID)
  4459. if err != nil {
  4460. this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
  4461. return
  4462. }
  4463. this.ServeSuccessJSON(map[string]interface{}{
  4464. "articlelist": articlelist,
  4465. })
  4466. }
  4467. func (this *Microwebsite) GetAllArticeList() {
  4468. adminUserInfo := this.GetAdminUserInfo()
  4469. userOrgID := adminUserInfo.CurrentOrgId
  4470. articles, err := site_service.GetAllArticeList(userOrgID)
  4471. if err != nil {
  4472. this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
  4473. return
  4474. }
  4475. this.ServeSuccessJSON(map[string]interface{}{
  4476. "articles": articles,
  4477. })
  4478. }
  4479. func (this *Microwebsite) UpdateLinkAddress() {
  4480. adminUserInfo := this.GetAdminUserInfo()
  4481. userOrgID := adminUserInfo.CurrentOrgId
  4482. fmt.Println("机构id", userOrgID)
  4483. id, _ := this.GetInt64("id")
  4484. fmt.Println("id", id)
  4485. dataBody := make(map[string]interface{}, 0)
  4486. err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
  4487. if err != nil {
  4488. utils.ErrorLog(err.Error())
  4489. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "参数错误")
  4490. return
  4491. }
  4492. linktype := int64(dataBody["linktype"].(float64))
  4493. fmt.Println("链接类型", linktype)
  4494. instationlink := int64(dataBody["instationlink"].(float64))
  4495. fmt.Println("站类李恩杰", instationlink)
  4496. //articetype := int64(dataBody["articetype"].(float64))
  4497. //fmt.Println("文章类型",articetype)
  4498. //title := int64(dataBody["title"].(float64))
  4499. //fmt.Println("文章標題",title)
  4500. phone := dataBody["phone"].(string)
  4501. fmt.Println("電話", phone)
  4502. outstationlink := dataBody["outstationlink"].(string)
  4503. fmt.Println("展望列哪家", outstationlink)
  4504. linkaddress := int64(dataBody["linkaddress"].(float64))
  4505. formatInt := strconv.FormatInt(linkaddress, 10)
  4506. fmt.Println("链接地址", linkaddress)
  4507. if phone != "" {
  4508. formatInt = phone
  4509. }
  4510. if outstationlink != "" {
  4511. formatInt = outstationlink
  4512. }
  4513. magiclink := models.SgjPatientMagiclink{
  4514. Linktype: linktype,
  4515. Instationlink: instationlink,
  4516. Phone: phone,
  4517. Outstationlink: outstationlink,
  4518. Linkaddress: formatInt,
  4519. UserOrgId: userOrgID,
  4520. Status: 1,
  4521. }
  4522. model, err := site_service.GetPatienModelByModelId(linkaddress, userOrgID)
  4523. patientMagiclink, err := site_service.GetMacLinkAddressTwo(userOrgID)
  4524. fmt.Println("长度", len(patientMagiclink))
  4525. if len(patientMagiclink) == 0 {
  4526. err = site_service.AddMacLinkAddress(&magiclink)
  4527. fmt.Println("err", err)
  4528. } else {
  4529. fmt.Println(magiclink)
  4530. err = site_service.UpdateLinkAddress(id, userOrgID, magiclink)
  4531. }
  4532. fmt.Println("报错误", err)
  4533. if err != nil {
  4534. this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
  4535. return
  4536. }
  4537. this.ServeSuccessJSON(map[string]interface{}{
  4538. "magiclink": magiclink,
  4539. "model": model,
  4540. })
  4541. }
  4542. func (this *Microwebsite) AddMacLinkAddress() {
  4543. adminUserInfo := this.GetAdminUserInfo()
  4544. userOrgID := adminUserInfo.CurrentOrgId
  4545. fmt.Println("机构id", userOrgID)
  4546. dataBody := make(map[string]interface{}, 0)
  4547. err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
  4548. if err != nil {
  4549. utils.ErrorLog(err.Error())
  4550. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "参数错误")
  4551. return
  4552. }
  4553. linktype := int64(dataBody["linktype"].(float64))
  4554. fmt.Println("linktype", linktype)
  4555. instationlink := int64(dataBody["instationlink"].(float64))
  4556. fmt.Println("instationlink", instationlink)
  4557. phone := dataBody["phone"].(string)
  4558. fmt.Println("phone", phone)
  4559. outstationlink := dataBody["outstationlink"].(string)
  4560. fmt.Println("outtationlink", outstationlink)
  4561. magiclink := models.SgjPatientMagiclink{
  4562. Linktype: linktype,
  4563. Instationlink: instationlink,
  4564. Phone: phone,
  4565. Outstationlink: outstationlink,
  4566. Ctime: time.Now().Unix(),
  4567. Status: 1,
  4568. }
  4569. fmt.Println("magiclink", magiclink)
  4570. err = site_service.AddMacLinkAddress(&magiclink)
  4571. model, err := site_service.GetPatienModelByModelId(instationlink, userOrgID)
  4572. fmt.Println(err)
  4573. //patientMagiclink, err := site_service.GetMacLinkAddress(userOrgID)
  4574. if err != nil {
  4575. this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
  4576. return
  4577. }
  4578. this.ServeSuccessJSON(map[string]interface{}{
  4579. "magiclink": magiclink,
  4580. "model": model,
  4581. })
  4582. }
  4583. func (this *Microwebsite) GetLinkAddress() {
  4584. adminUserInfo := this.GetAdminUserInfo()
  4585. userOrgID := adminUserInfo.CurrentOrgId
  4586. fmt.Println("机构id", userOrgID)
  4587. id, _ := this.GetInt64("id")
  4588. fmt.Println("id", id)
  4589. linkaddress, err := site_service.GetPatientLinkAddress(id, userOrgID)
  4590. if err != nil {
  4591. this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
  4592. return
  4593. }
  4594. this.ServeSuccessJSON(map[string]interface{}{
  4595. "linkaddress": linkaddress,
  4596. })
  4597. }
  4598. func (this *Microwebsite) GetCountImages() {
  4599. fmt.Println("")
  4600. adminUserInfo := this.GetAdminUserInfo()
  4601. userOrgID := adminUserInfo.CurrentOrgId
  4602. fmt.Println("机构id机构id记过id九宫UID", userOrgID)
  4603. edipiclink, total, err := site_service.GetCountImages(userOrgID)
  4604. fmt.Println("edipiclink是什么edipiclink是什么edipiclink是什么edipiclink是什么", edipiclink)
  4605. fmt.Println("total是什么", total)
  4606. fmt.Println("err是什么", err)
  4607. }
  4608. func (this *Microwebsite) AddNavigationLinkform() {
  4609. adminUserInfo := this.GetAdminUserInfo()
  4610. userOrgID := adminUserInfo.CurrentOrgId
  4611. fmt.Println("机构id", userOrgID)
  4612. dataBody := make(map[string]interface{}, 0)
  4613. err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
  4614. if err != nil {
  4615. utils.ErrorLog(err.Error())
  4616. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "参数错误")
  4617. return
  4618. }
  4619. linktype := int64(dataBody["linktype"].(float64))
  4620. fmt.Println("linktype", linktype)
  4621. navitionlinktype := int64(dataBody["navitionlinktype"].(float64))
  4622. fmt.Println("navitionlinktype", navitionlinktype)
  4623. phone := dataBody["phone"].(string)
  4624. if phone == "0" {
  4625. phone = ""
  4626. }
  4627. fmt.Println("phone", phone)
  4628. outstationlink := dataBody["outstationlink"].(string)
  4629. if outstationlink == "0" {
  4630. outstationlink = ""
  4631. }
  4632. fmt.Println("outstationlink", outstationlink)
  4633. linkaddress := dataBody["linkaddress"].(string)
  4634. fmt.Println("linkaddress", linkaddress)
  4635. navgationlink := models.PatientNavgationlink{
  4636. Linktype: linktype,
  4637. Navitionlinktype: navitionlinktype,
  4638. Phone: phone,
  4639. Outstationlink: outstationlink,
  4640. Status: 1,
  4641. Ctime: time.Now().Unix(),
  4642. Linkaddress: linkaddress,
  4643. UserOrgId: userOrgID,
  4644. }
  4645. err = site_service.AddNavitaionLinkAddress(&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) GetNavigationlinkaddress() {
  4655. adminUserInfo := this.GetAdminUserInfo()
  4656. userOrgID := adminUserInfo.CurrentOrgId
  4657. fmt.Println("机构id", userOrgID)
  4658. id, _ := this.GetInt64("id")
  4659. fmt.Println("id是什么", id)
  4660. navgationlink, err := site_service.GetNavgationlinkAddressBylinkId(userOrgID, id)
  4661. fmt.Println("大错误", err)
  4662. fmt.Println(navgationlink)
  4663. if err != nil {
  4664. this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
  4665. return
  4666. }
  4667. this.ServeSuccessJSON(map[string]interface{}{
  4668. "navgationlink": navgationlink,
  4669. })
  4670. }
  4671. func (this *Microwebsite) UpdateditnavigationLink() {
  4672. adminUserInfo := this.GetAdminUserInfo()
  4673. userOrgID := adminUserInfo.CurrentOrgId
  4674. fmt.Println("机构id", userOrgID)
  4675. dataBody := make(map[string]interface{}, 0)
  4676. err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
  4677. if err != nil {
  4678. utils.ErrorLog(err.Error())
  4679. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "参数错误")
  4680. return
  4681. }
  4682. //id := int64(dataBody["id"].(float64))
  4683. //fmt.Println("id是什么",id)
  4684. id, _ := this.GetInt64("id")
  4685. fmt.Println("id是什么", id)
  4686. linktype := int64(dataBody["linktype"].(float64))
  4687. fmt.Println("linktype", linktype)
  4688. navitionlinktype := int64(dataBody["navitionlinktype"].(float64))
  4689. fmt.Println("navitionlinktype", navitionlinktype)
  4690. phone := dataBody["phone"].(string)
  4691. fmt.Println("phone", phone)
  4692. outstationlink := dataBody["outstationlink"].(string)
  4693. fmt.Println("outstationlink", outstationlink)
  4694. linkaddress := dataBody["linkaddress"].(string)
  4695. fmt.Println("linkaddress", linkaddress)
  4696. navgationlink := models.PatientNavgationlink{
  4697. Linktype: linktype,
  4698. Navitionlinktype: navitionlinktype,
  4699. Outstationlink: outstationlink,
  4700. Linkaddress: linkaddress,
  4701. Phone: phone,
  4702. UserOrgId: userOrgID,
  4703. Status: 1,
  4704. }
  4705. patientNavgationlink, errcode := site_service.GetNavgationLinkById(id, userOrgID)
  4706. fmt.Println(patientNavgationlink, errcode)
  4707. if errcode == gorm.ErrRecordNotFound {
  4708. err = site_service.AddNavigationlink(&navgationlink)
  4709. fmt.Println("数据添加成功", err)
  4710. } else if errcode == nil {
  4711. err = site_service.UpdateditnavigationLink(id, userOrgID, navgationlink)
  4712. if err != nil {
  4713. this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
  4714. return
  4715. }
  4716. } else {
  4717. err = site_service.UpdateditnavigationLink(id, userOrgID, navgationlink)
  4718. if err != nil {
  4719. this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
  4720. return
  4721. }
  4722. }
  4723. this.ServeSuccessJSON(map[string]interface{}{
  4724. "navgationlink": navgationlink,
  4725. })
  4726. }
  4727. func (this *Microwebsite) AddDoctorInfoTwo() {
  4728. adminUserInfo := this.GetAdminUserInfo()
  4729. userOrgID := adminUserInfo.CurrentOrgId
  4730. fmt.Println("机构id", userOrgID)
  4731. id, _ := this.GetInt64("id")
  4732. fmt.Println("这个id", id)
  4733. dataBody := make(map[string]interface{}, 0)
  4734. err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
  4735. if err != nil {
  4736. utils.ErrorLog(err.Error())
  4737. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "参数错误")
  4738. return
  4739. }
  4740. name := dataBody["name"].(string)
  4741. fmt.Println("姓名", name)
  4742. usertitle := int64(dataBody["user_title"].(float64))
  4743. fmt.Println("职称", usertitle)
  4744. dochead := dataBody["dochead"].(string)
  4745. fmt.Println("医生头像", dochead)
  4746. sort := int64(dataBody["sort"].(float64))
  4747. fmt.Println("排序", sort)
  4748. content := dataBody["content"].(string)
  4749. fmt.Println("内容", content)
  4750. editdoctor := models.SgjPatientEditdoctor{
  4751. DocName: name,
  4752. DocPostion: usertitle,
  4753. Dochead: dochead,
  4754. DocSort: sort,
  4755. Docintroduction: content,
  4756. Modleid: id,
  4757. UserOrgId: userOrgID,
  4758. Status: 1,
  4759. Ctime: time.Now().Unix(),
  4760. ImgShow: 1,
  4761. }
  4762. err = site_service.AddEditDoctor(&editdoctor)
  4763. editdoctors, err := site_service.QuerEditDoctorInfo(id, userOrgID)
  4764. if err != nil {
  4765. this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
  4766. return
  4767. }
  4768. this.ServeSuccessJSON(map[string]interface{}{
  4769. "editdoctor": editdoctor,
  4770. "editdoctors": editdoctors,
  4771. })
  4772. }
  4773. func (this *Microwebsite) GetUserOrgID() {
  4774. adminUserInfo := this.GetAdminUserInfo()
  4775. userOrgID := adminUserInfo.CurrentOrgId
  4776. fmt.Println("机构id", userOrgID)
  4777. this.ServeSuccessJSON(map[string]interface{}{
  4778. "usreOrgID": userOrgID,
  4779. })
  4780. }
  4781. func (this *Microwebsite) GetNavigationset() {
  4782. adminUserInfo := this.GetAdminUserInfo()
  4783. userOrgID := adminUserInfo.CurrentOrgId
  4784. fmt.Println("机构id", userOrgID)
  4785. //navigation, err := site_service.GetDefaultNavigation(userOrgID)
  4786. //fmt.Println("错误是设么",err)
  4787. //if (len(navigation) == 0) {
  4788. // sgjPatientNavigation := models.SgjPatientNavigation{
  4789. // Navtitle: "首页",
  4790. // Navimages: "https://images.shengws.com/2099_o_1570840397245.png",
  4791. // Nonavimages:"https://images.shengws.com/2099_o_1570840397245.png",
  4792. // Jumpset: 1,
  4793. // Navaddress: "",
  4794. // Ctime: time.Now().Unix(),
  4795. // Status: 1,
  4796. // UserOrgId: userOrgID,
  4797. // }
  4798. // err = site_service.AddDefaultData(&sgjPatientNavigation)
  4799. // patientNavigation := models.SgjPatientNavigation{
  4800. // Navtitle: "微商城",
  4801. // Navimages: "https://images.shengws.com/2122_o_1570840361702.png",
  4802. // Nonavimages:"https://images.shengws.com/2122_o_1570840361702.png",
  4803. // Jumpset: 1,
  4804. // 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",
  4805. // Ctime: time.Now().Unix(),
  4806. // Status: 1,
  4807. // UserOrgId: userOrgID,
  4808. // }
  4809. // err = site_service.AddDefaultData(&patientNavigation)
  4810. // fmt.Println(err)
  4811. // fmt.Println(patientNavigation)
  4812. // sgjPatientNavigationtwo := models.SgjPatientNavigation{
  4813. // Navtitle: "联系我们",
  4814. // Navimages: "https://images.shengws.com/2138_o_1570840377129.png",
  4815. // Nonavimages:"https://images.shengws.com/2138_o_1570840377129.png",
  4816. // Jumpset: 1,
  4817. // Navaddress: "",
  4818. // Ctime: time.Now().Unix(),
  4819. // Status: 1,
  4820. // UserOrgId: userOrgID,
  4821. // }
  4822. // err = site_service.AddDefaultData(&sgjPatientNavigationtwo)
  4823. // fmt.Println(err)
  4824. // fmt.Println(sgjPatientNavigationtwo)
  4825. // sgjPatientNavigationthree := models.SgjPatientNavigation{
  4826. // Navtitle: "在线客服",
  4827. // Navimages: "https://images.shengws.com/2079_o_1570842501972.png",
  4828. // Nonavimages:"https://images.shengws.com/2079_o_1570842501972.png",
  4829. // Jumpset: 1,
  4830. // Navaddress: "0755-86526342",
  4831. // Ctime: time.Now().Unix(),
  4832. // Status: 1,
  4833. // UserOrgId: userOrgID,
  4834. // }
  4835. // err = site_service.AddDefaultData(&sgjPatientNavigationthree)
  4836. // fmt.Println(err)
  4837. // fmt.Println(sgjPatientNavigationthree)
  4838. //
  4839. // navigations, err := site_service.GetDefaultNavigation(userOrgID)
  4840. // fmt.Println(err)
  4841. // if err !=nil{
  4842. // this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
  4843. // return
  4844. // }
  4845. // this.ServeSuccessJSON(map[string]interface{}{
  4846. // "sgjPatientNavigation":sgjPatientNavigation,
  4847. // "navigations":navigations,
  4848. // })
  4849. //}
  4850. navigations, err := site_service.GetDefaultNavigation(userOrgID)
  4851. if err != nil {
  4852. this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
  4853. return
  4854. }
  4855. this.ServeSuccessJSON(map[string]interface{}{
  4856. "navigations": navigations,
  4857. })
  4858. }
  4859. func (this *Microwebsite) GetNavigationData() {
  4860. adminUserInfo := this.GetAdminUserInfo()
  4861. userOrgID := adminUserInfo.CurrentOrgId
  4862. fmt.Println("机构id", userOrgID)
  4863. navigation, err := site_service.GetDefaultNavigation(userOrgID)
  4864. fmt.Println("navigation是什么呢", navigation)
  4865. if err != nil {
  4866. this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
  4867. return
  4868. }
  4869. this.ServeSuccessJSON(map[string]interface{}{
  4870. "navigation": navigation,
  4871. })
  4872. }
  4873. func (this *Microwebsite) GetAllModelTitle() {
  4874. adminUserInfo := this.GetAdminUserInfo()
  4875. userOrgID := adminUserInfo.CurrentOrgId
  4876. fmt.Println("机构id", userOrgID)
  4877. patientModels, err := site_service.GetAllModelTitle(userOrgID)
  4878. if err != nil {
  4879. this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
  4880. return
  4881. }
  4882. this.ServeSuccessJSON(map[string]interface{}{
  4883. "patientModels": patientModels,
  4884. })
  4885. }
  4886. func (this *Microwebsite) GetDoctorDetailInfo() {
  4887. id, _ := this.GetInt64("id")
  4888. fmt.Println("医生详情id", id)
  4889. adminUserInfo := this.GetAdminUserInfo()
  4890. userOrgID := adminUserInfo.CurrentOrgId
  4891. fmt.Println("机构id", userOrgID)
  4892. editdoctor, err := site_service.GetDoctorDetailInfo(id, userOrgID)
  4893. if err != nil {
  4894. this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
  4895. return
  4896. }
  4897. this.ServeSuccessJSON(map[string]interface{}{
  4898. "editdoctor": editdoctor,
  4899. })
  4900. }
  4901. func (this *Microwebsite) GetArticleListDetail() {
  4902. id, _ := this.GetInt64("id")
  4903. fmt.Println("文章详情id", id)
  4904. adminUserInfo := this.GetAdminUserInfo()
  4905. userOrgID := adminUserInfo.CurrentOrgId
  4906. fmt.Println("机构id", userOrgID)
  4907. articles, err := site_service.GetArticleListDetail(id, userOrgID)
  4908. if err != nil {
  4909. this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
  4910. return
  4911. }
  4912. this.ServeSuccessJSON(map[string]interface{}{
  4913. "articles": articles,
  4914. })
  4915. }
  4916. func (this *Microwebsite) GetActivitiesListDetail() {
  4917. id, _ := this.GetInt64("id")
  4918. fmt.Println("活动详情id", id)
  4919. adminUserInfo := this.GetAdminUserInfo()
  4920. userOrgID := adminUserInfo.CurrentOrgId
  4921. fmt.Println("机构id", userOrgID)
  4922. activity, err := site_service.GetActivitiesListDetail(id, userOrgID)
  4923. if err != nil {
  4924. this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
  4925. return
  4926. }
  4927. this.ServeSuccessJSON(map[string]interface{}{
  4928. "activity": activity,
  4929. })
  4930. }
  4931. func (this *Microwebsite) AddLinkAddressThree() {
  4932. adminUserInfo := this.GetAdminUserInfo()
  4933. userOrgID := adminUserInfo.CurrentOrgId
  4934. fmt.Println("机构id", userOrgID)
  4935. defineaddress := this.GetString("address")
  4936. fmt.Println("自定义地址", defineaddress)
  4937. if len(defineaddress) == 0 {
  4938. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "自定义地址不能为空")
  4939. return
  4940. }
  4941. patientLinkaddress := models.SgjPatientLinkaddress{
  4942. Defineaddress: defineaddress,
  4943. UserOrgId: userOrgID,
  4944. Status: 1,
  4945. Ctime: time.Now().Unix(),
  4946. }
  4947. err := site_service.AddLinkAddress(&patientLinkaddress)
  4948. if err != nil {
  4949. this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
  4950. return
  4951. }
  4952. this.ServeSuccessJSON(map[string]interface{}{
  4953. "patientLinkaddress": patientLinkaddress,
  4954. })
  4955. }
  4956. func (this *Microwebsite) GetLinkAddressByLinkId() {
  4957. adminUserInfo := this.GetAdminUserInfo()
  4958. userOrgID := adminUserInfo.CurrentOrgId
  4959. fmt.Println("机构id", userOrgID)
  4960. linkid, _ := this.GetInt64("linkid")
  4961. fmt.Println("linkid是多少?", linkid)
  4962. linkaddress, err := site_service.GetLinkAddressByLinkId(userOrgID, linkid)
  4963. if err != nil {
  4964. this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
  4965. return
  4966. }
  4967. this.ServeSuccessJSON(map[string]interface{}{
  4968. "linkaddress": linkaddress,
  4969. })
  4970. }
  4971. func (this *Microwebsite) AddLinkAddressFour() {
  4972. adminUserInfo := this.GetAdminUserInfo()
  4973. userOrgID := adminUserInfo.CurrentOrgId
  4974. fmt.Println("机构id", userOrgID)
  4975. address := this.GetString("address")
  4976. fmt.Println("linkid是多少?", address)
  4977. linkaddress := models.SgjPatientLinkaddress{
  4978. Defineaddress: address,
  4979. Status: 1,
  4980. Ctime: time.Now().Unix(),
  4981. UserOrgId: userOrgID,
  4982. }
  4983. err := site_service.AddLinkAddress(&linkaddress)
  4984. if err != nil {
  4985. this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
  4986. return
  4987. }
  4988. this.ServeSuccessJSON(map[string]interface{}{
  4989. "linkaddress": linkaddress,
  4990. })
  4991. }
  4992. func (this *Microwebsite) GetMagicLinkAddressById() {
  4993. adminUserInfo := this.GetAdminUserInfo()
  4994. userOrgID := adminUserInfo.CurrentOrgId
  4995. fmt.Println("机构id", userOrgID)
  4996. id, _ := this.GetInt64("id")
  4997. fmt.Println("id是多少", id)
  4998. magiclink, err := site_service.GetMagicLinkAddressById(userOrgID, id)
  4999. fmt.Println("错误是什么", err)
  5000. if err != nil {
  5001. this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
  5002. return
  5003. }
  5004. this.ServeSuccessJSON(map[string]interface{}{
  5005. "magiclink": magiclink,
  5006. })
  5007. }
  5008. func (this *Microwebsite) GetMagicClickByLinkID() {
  5009. adminUserInfo := this.GetAdminUserInfo()
  5010. userOrgID := adminUserInfo.CurrentOrgId
  5011. fmt.Println("机构id", userOrgID)
  5012. linkid, _ := this.GetInt64("linkid")
  5013. fmt.Println("id是多少", linkid)
  5014. magiclink, err := site_service.GetMagicClickByLinkID(userOrgID, linkid)
  5015. if err != nil {
  5016. this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
  5017. return
  5018. }
  5019. this.ServeSuccessJSON(map[string]interface{}{
  5020. "magiclink": magiclink,
  5021. })
  5022. }
  5023. func (this *Microwebsite) GeteditRotationEmages() {
  5024. adminUserInfo := this.GetAdminUserInfo()
  5025. userOrgID := adminUserInfo.CurrentOrgId
  5026. fmt.Println("机构id", userOrgID)
  5027. id, _ := this.GetInt64("id")
  5028. fmt.Println("id", id)
  5029. conrotation, err := site_service.GetEditRotationEmages(id, userOrgID)
  5030. fmt.Println("错误", err)
  5031. if err != nil {
  5032. this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
  5033. return
  5034. }
  5035. this.ServeSuccessJSON(map[string]interface{}{
  5036. "conrotation": conrotation,
  5037. })
  5038. }
  5039. func (this *Microwebsite) GetOutRotationLink() {
  5040. adminUserInfo := this.GetAdminUserInfo()
  5041. userOrgID := adminUserInfo.CurrentOrgId
  5042. fmt.Println("机构id", userOrgID)
  5043. linkid, _ := this.GetInt64("id")
  5044. fmt.Println("id", linkid)
  5045. conlinkaddress, err := site_service.GetOutRotationLink(userOrgID, linkid)
  5046. if err != nil {
  5047. this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
  5048. return
  5049. }
  5050. this.ServeSuccessJSON(map[string]interface{}{
  5051. "conlinkaddress": conlinkaddress,
  5052. })
  5053. }
  5054. func (this *Microwebsite) UpdatedRolinkAddress() {
  5055. adminUserInfo := this.GetAdminUserInfo()
  5056. userOrgID := adminUserInfo.CurrentOrgId
  5057. fmt.Println("机构id", userOrgID)
  5058. dataBody := make(map[string]interface{}, 0)
  5059. err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
  5060. if err != nil {
  5061. utils.ErrorLog(err.Error())
  5062. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "参数错误")
  5063. return
  5064. }
  5065. //id := int64(dataBody["id"].(float64))
  5066. id, _ := this.GetInt64("id")
  5067. fmt.Println("id是什么", id)
  5068. defineaddress := dataBody["defineaddress"].(string)
  5069. fmt.Println("defineaddress", defineaddress)
  5070. conlinkaddress := models.SgjPatientConlinkaddress{
  5071. Defineaddress: defineaddress,
  5072. }
  5073. err = site_service.UpdatedConlinkAddress(id, userOrgID, conlinkaddress)
  5074. if err != nil {
  5075. this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
  5076. return
  5077. }
  5078. this.ServeSuccessJSON(map[string]interface{}{
  5079. "conlinkaddress": conlinkaddress,
  5080. })
  5081. }
  5082. func (this *Microwebsite) UpdatedConrotation() {
  5083. adminUserInfo := this.GetAdminUserInfo()
  5084. userOrgID := adminUserInfo.CurrentOrgId
  5085. fmt.Println("机构id", userOrgID)
  5086. dataBody := make(map[string]interface{}, 0)
  5087. err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
  5088. if err != nil {
  5089. utils.ErrorLog(err.Error())
  5090. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "参数错误")
  5091. return
  5092. }
  5093. id, _ := this.GetInt64("id")
  5094. fmt.Println("id是什么", id)
  5095. images := dataBody["images"].(string)
  5096. fmt.Println("images是什么", images)
  5097. sort := int64(dataBody["sort"].(float64))
  5098. fmt.Println("sort", sort)
  5099. piclink := int64(dataBody["piclink"].(float64))
  5100. fmt.Println("piclink", piclink)
  5101. linkaddress := dataBody["linkaddress"].(string)
  5102. fmt.Println("linkaddress", linkaddress)
  5103. conrotation := models.SgjPatientConrotation{
  5104. Images: images,
  5105. Sort: sort,
  5106. Piclink: piclink,
  5107. Linkaddress: linkaddress,
  5108. }
  5109. err = site_service.UpdatedConrotation(id, userOrgID, conrotation)
  5110. if err != nil {
  5111. this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
  5112. return
  5113. }
  5114. this.ServeSuccessJSON(map[string]interface{}{
  5115. "conrotation": conrotation,
  5116. })
  5117. }
  5118. func (this *Microwebsite) GetRotationVisibleByLinkId() {
  5119. adminUserInfo := this.GetAdminUserInfo()
  5120. userOrgID := adminUserInfo.CurrentOrgId
  5121. fmt.Println("机构id", userOrgID)
  5122. id, _ := this.GetInt64("id")
  5123. fmt.Println("id是什么", id)
  5124. conlinkaddress, err := site_service.GetRotationVisibleByLinkId(id, userOrgID)
  5125. fmt.Println("错误", err)
  5126. fmt.Println("conlinkaddress", conlinkaddress)
  5127. if err != nil {
  5128. this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
  5129. return
  5130. }
  5131. this.ServeSuccessJSON(map[string]interface{}{
  5132. "conlinkaddress": conlinkaddress,
  5133. })
  5134. }
  5135. func (this *Microwebsite) AddRotationVisibleForm() {
  5136. adminUserInfo := this.GetAdminUserInfo()
  5137. userOrgID := adminUserInfo.CurrentOrgId
  5138. fmt.Println("机构id", userOrgID)
  5139. id, _ := this.GetInt64("id")
  5140. fmt.Println("id是设么", id)
  5141. dataBody := make(map[string]interface{}, 0)
  5142. err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
  5143. if err != nil {
  5144. utils.ErrorLog(err.Error())
  5145. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "参数错误")
  5146. return
  5147. }
  5148. defineaddress := dataBody["defineaddress"].(string)
  5149. fmt.Println("defineaddrss", defineaddress)
  5150. linkaddress := models.SgjPatientLinkaddress{
  5151. Defineaddress: defineaddress,
  5152. }
  5153. err = site_service.UpdatedRotationVisble(id, userOrgID, linkaddress)
  5154. if err != nil {
  5155. this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
  5156. return
  5157. }
  5158. this.ServeSuccessJSON(map[string]interface{}{
  5159. "linkaddress": linkaddress,
  5160. })
  5161. }
  5162. func (this *Microwebsite) GetOrgName() {
  5163. orgid, _ := this.GetInt64("orgid")
  5164. name, err := site_service.GetOrgName(orgid)
  5165. if err != nil {
  5166. this.ServeFailJsonSend(enums.ErrorCodeDataException, "更改数据失败")
  5167. return
  5168. }
  5169. this.ServeSuccessJSON(map[string]interface{}{
  5170. "name": name,
  5171. })
  5172. }