scrm-go

site_controller.go 171KB

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