scrm-go

site_controller.go 180KB

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