manage_api_controller.go 139KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133
  1. package controllers
  2. import (
  3. "Xcx_New/enums"
  4. "Xcx_New/models"
  5. "Xcx_New/service"
  6. "Xcx_New/utils"
  7. "encoding/json"
  8. "fmt"
  9. "github.com/astaxie/beego"
  10. "github.com/jinzhu/gorm"
  11. "strconv"
  12. "time"
  13. "unsafe"
  14. )
  15. type MachineApiController struct {
  16. BaseAuthAPIController
  17. }
  18. func ManageRouters() {
  19. beego.Router("/api/management/savemanageinfo", &MachineApiController{}, "post:SaveManageInfo")
  20. beego.Router("/api/management/updatemachineinfo", &MachineApiController{}, "post:UpdateMachineInfo")
  21. beego.Router("/api/manage/updatemacheinettwo", &MachineApiController{}, "post:Updatemacheinetwo")
  22. beego.Router("/api/management/getallequimentname", &MachineApiController{}, "get:GetAllEquimentName")
  23. beego.Router("/api/management/saveplan", &MachineApiController{}, "post:SavePlan")
  24. beego.Router("/api/management/getallplan", &MachineApiController{}, "get:GetAllPlan")
  25. beego.Router("/api/management/getallplandetail", &MachineApiController{}, "get:GetAllPlanDetail")
  26. beego.Router("/api/management/geteditmachine", &MachineApiController{}, "get:GetEditMahchine")
  27. beego.Router("/api/staff/deleteplans", &MachineApiController{}, "delete:DeletePlans")
  28. beego.Router("/api/manage/editplandetail", &MachineApiController{}, "get:EditPlanDetail")
  29. beego.Router("/api/manage/updateplaninfo", &MachineApiController{}, "post:UpdatePlanInfo")
  30. beego.Router("/api/manage/getcomprehensive", &MachineApiController{}, "get:GetComprehensive")
  31. beego.Router("/api/manage/saveinformation", &MachineApiController{}, "Post:SaveInformation")
  32. beego.Router("/api/manage/getpatientinfo", &MachineApiController{}, "Get:GetPatientInfo")
  33. beego.Router("/api/manage/changeclass", &MachineApiController{}, "Get:GetPatient")
  34. beego.Router("/api/manage/changepatient", &MachineApiController{}, "Get:ChangePatient")
  35. beego.Router("/api/manage/getallorganization", &MachineApiController{}, "Get:GetAllOrganization")
  36. beego.Router("/api/manage/getregisterinfo", &MachineApiController{}, "Get:GetRegisterInfo")
  37. beego.Router("/api/manage/getinformationdata", &MachineApiController{}, "Get:GetInformationData")
  38. beego.Router("/api/manage/getorgname", &MachineApiController{}, "Get:GetOrgName")
  39. beego.Router("/api/manage/savebacteria", &MachineApiController{}, "Post:SaveBacteria")
  40. beego.Router("/api/manage/savelincomycin", &MachineApiController{}, "Post:SaveLinconmycin")
  41. beego.Router("/api/manage/savequalitycontrol", &MachineApiController{}, "Post:SaveQualityControl")
  42. beego.Router("/api/manage/getallqulityinfo", &MachineApiController{}, "Get:GetAllQulityInfo")
  43. beego.Router("/api/manage/editculture", &MachineApiController{}, "Get:EditCulture")
  44. beego.Router("/api/manage/updateculture", &MachineApiController{}, "Post:UpdateCulture")
  45. beego.Router("/api/manage/deletecultrue", &MachineApiController{}, "delete:DeleteCultrue")
  46. beego.Router("/api/manage/editdialystate", &MachineApiController{}, "Get:EditDialystate")
  47. beego.Router("/api/manage/updatedialystate", &MachineApiController{}, "Post:Updatedialystate")
  48. beego.Router("/api/manage/deletedialystate", &MachineApiController{}, "delete:DeleteDialystate")
  49. beego.Router("/api/manage/edition", &MachineApiController{}, "Get:Edition")
  50. beego.Router("/api/manage/updateion", &MachineApiController{}, "Post:UpdateIon")
  51. beego.Router("/api/manage/deleteion", &MachineApiController{}, "delete:DeleteIon")
  52. beego.Router("/api/manage/query", &MachineApiController{}, "Get:GetQuery")
  53. beego.Router("/api/manage/saverepair", &MachineApiController{}, "Post:SaveRepair")
  54. beego.Router("/api/manage/getallrepair", &MachineApiController{}, "Get:GetAllRepair")
  55. beego.Router("/api/manage/editrepair", &MachineApiController{}, "Get:EditRepair")
  56. beego.Router("/api/manage/updaterepair", &MachineApiController{}, "Post:UpdateRepair")
  57. beego.Router("/api/manage/deleterepair", &MachineApiController{}, "delete:DeleteRepair")
  58. beego.Router("/api/manage/queryrepair", &MachineApiController{}, "Get:GetRepair")
  59. beego.Router("/api/manage/edituser", &MachineApiController{}, "Get:EditUser")
  60. beego.Router("/api/manage/deleteform", &MachineApiController{}, "delete:DeleteForm")
  61. beego.Router("/api/manage/updateform", &MachineApiController{}, "Post:UpdateForm")
  62. beego.Router("/api/manage/queryinfo", &MachineApiController{}, "Get:QueryInfo")
  63. beego.Router("/api/manage/insertautodata", &MachineApiController{}, "Get:InsertAutoData")
  64. beego.Router("/api/manage/getallequittype", &MachineApiController{}, "Get:GetAllEquitType")
  65. beego.Router("/api/manage/getuserform", &MachineApiController{}, "Get:GetUserForm")
  66. beego.Router("/api/manage/getbedform", &MachineApiController{}, "Get:GetBedForm")
  67. beego.Router("/api/manage/gettotalcount", &MachineApiController{}, "Get:GetTotalCount")
  68. beego.Router("/api/manage/getotalnumber", &MachineApiController{}, "Get:GetTotalNumber")
  69. beego.Router("/api/manage/gettimewarning", &MachineApiController{}, "Get:GetTimeWarning")
  70. beego.Router("/api/manage/savemanageinfotwo", &MachineApiController{}, "post:SaveManageinfoTwo")
  71. beego.Router("/api/management/updatemachineinfotwo", &MachineApiController{}, "post:UpdateMachinetwo")
  72. beego.Router("/api/manage/getallpatient", &MachineApiController{}, "get:GetAllpatient")
  73. beego.Router("/api/manage/changebed", &MachineApiController{}, "get:ChangeBed")
  74. beego.Router("/api/manage/getpatientdetail", &MachineApiController{}, "get:GetPatientDetail")
  75. beego.Router("/api/manage/changrun", &MachineApiController{}, "post:SaveReminder")
  76. beego.Router("/api/manage/getremanderdata", &MachineApiController{}, "get:GetRemanderData")
  77. beego.Router("/api/manage/opendelete", &MachineApiController{}, "delete:OpenDelete")
  78. beego.Router("/api/manage/deleteuserlogin", &MachineApiController{}, "delete:DeleteUserLogin")
  79. beego.Router("/api/manage/deletecultrues", &MachineApiController{}, "delete:DeleteCultrues")
  80. beego.Router("/api/manage/deletedialystates", &MachineApiController{}, "delete:DeleteDialystates")
  81. beego.Router("/api/manage/deleteions", &MachineApiController{}, "delete:Deleteions")
  82. beego.Router("/api/manage/deleterepairs", &MachineApiController{}, "delete:DeleteRepairs")
  83. beego.Router("/api/manage/savemode", &MachineApiController{}, "post:SaveMode")
  84. beego.Router("/api/manage/getallmode", &MachineApiController{}, "get:GetAllMode")
  85. beego.Router("/api/manage/editmode", &MachineApiController{}, "get:EditMode")
  86. beego.Router("/api/manage/updatemode", &MachineApiController{}, "post:UpdateMode")
  87. beego.Router("/api/manage/deletemode", &MachineApiController{}, "delete:DeleteMode")
  88. beego.Router("/api/manage/selectchange", &MachineApiController{}, "Get:SelectChange")
  89. beego.Router("/api/manage/selectbed", &MachineApiController{}, "get:SelectBed")
  90. beego.Router("/api/manage/getime", &MachineApiController{}, "get:GetTimeData")
  91. beego.Router("/api/manage/deleteimages", &MachineApiController{}, "delete:DeleteImages")
  92. beego.Router("/api/manage/getusermachtotalcount", &MachineApiController{}, "Get:GetUserMachTotalCount")
  93. beego.Router("/api/manage/getusertotalcount", &MachineApiController{}, "Get:GetUserTotalCount")
  94. beego.Router("/api/manage/deletemanagement", &MachineApiController{}, "Get:DeleteManagement")
  95. beego.Router("/api/manage/saveoxygenates", &MachineApiController{}, "Post:SaveOxygenates")
  96. beego.Router("/api/manage/savehardwater", &MachineApiController{}, "Post:SaveHardWater")
  97. beego.Router("/api/manage/savewater", &MachineApiController{}, "Post:SaveWater")
  98. beego.Router("/api/manage/savedeviceph", &MachineApiController{}, "Post:SaveDevicePH")
  99. beego.Router("/api/manage/editoxygenates", &MachineApiController{}, "Get:EditOxygenates")
  100. beego.Router("/api/manage/updateoxygenates", &MachineApiController{}, "Post:UpdateOxygenates")
  101. beego.Router("/api/manage/edithardwater", &MachineApiController{}, "Get:EditHardWater")
  102. beego.Router("/api/manage/editwater", &MachineApiController{}, "Get:EditWater")
  103. beego.Router("/api/manage/editdeviceph", &MachineApiController{}, "Get:EditDevicePh")
  104. beego.Router("/api/manage/getalldoctlist", &MachineApiController{}, "Get:GetAllDoctorList")
  105. beego.Router("/api/manage/saveairdisinfect", &MachineApiController{}, "Get:SaveAirDisinfect")
  106. beego.Router("/api/manage/getairlist", &MachineApiController{}, "Get:GetAirList")
  107. beego.Router("/api/manage/getairdisinfctdetal", &MachineApiController{}, "Get:GetAirDisinfetDetail")
  108. beego.Router("/api/manage/updateairdisinfect", &MachineApiController{}, "Get:UpdateAirDisinfect")
  109. beego.Router("/api/manage/deleteairdisinfect", &MachineApiController{}, "Get:DeleteAirDisinfect")
  110. beego.Router("/api/manage/savebodydisinfect", &MachineApiController{}, "Get:SaveBodyDisinfect")
  111. beego.Router("/api/manage/getbodylist", &MachineApiController{}, "Get:GetBodyList")
  112. beego.Router("/api/manage/getbodydisinfectdetal", &MachineApiController{}, "Get:GetBodyDisinfetDetail")
  113. beego.Router("/api/manage/updatebodydisinfect", &MachineApiController{}, "Get:UpdateBodyDisinfect")
  114. beego.Router("/api/manage/deletebodydisinfect", &MachineApiController{}, "Get:DeleteBodyDisInfect")
  115. beego.Router("/api/manage/updatehadwater", &MachineApiController{}, "Post:UpdateHadWater")
  116. beego.Router("/api/manage/updatewater", &MachineApiController{}, "Post:UpdateWater")
  117. beego.Router("/api/manage/updatedeviceph", &MachineApiController{}, "Post:UpdateDevicePh")
  118. beego.Router("/api/manage/deleteoxygenates", &MachineApiController{}, "Get:DeleteOxygenates")
  119. beego.Router("/api/manage/deletehadwater", &MachineApiController{}, "Get:DeleteHadWater")
  120. beego.Router("/api/manage/deletewater", &MachineApiController{}, "Get:DeleteWater")
  121. beego.Router("/api/manage/deletedeviceph", &MachineApiController{}, "Get:DeleteDevicePh")
  122. }
  123. func (this *MachineApiController) SaveManageInfo() {
  124. adminUserInfo := this.GetAdminUserInfo()
  125. orgid := adminUserInfo.CurrentOrgId
  126. //fmt.Println("机构id", orgid)
  127. dataBody := make(map[string]interface{}, 0)
  128. err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
  129. //fmt.Println("err", err)
  130. //serial_numbe := int64(dataBody["serial_number"].(float64))
  131. serial_numbe := dataBody["serial_number"].(string)
  132. //fmt.Println("序列号", serial_numbe)
  133. device_type := int64(dataBody["device_type"].(float64))
  134. //fmt.Println("设备类型", device_type)
  135. bed_number := int64(dataBody["bed_number"].(float64))
  136. // fmt.Println("床位号", bed_number)
  137. //通过床位id获取区号id
  138. number, err := service.GetZoneId(bed_number, orgid)
  139. //fmt.Println("number", number)
  140. // fmt.Println("获取分区id错误", err)
  141. device_name := dataBody["device_name"].(string)
  142. // fmt.Println("设备名称", device_name)
  143. manufacture_factory := dataBody["manufacture_factory"].(string)
  144. //fmt.Println("生产厂家", manufacture_factory)
  145. service_manufacturer := dataBody["service_manufacturer"].(string)
  146. // fmt.Println("维修厂家", service_manufacturer)
  147. unittype := int64(dataBody["unit_type"].(float64))
  148. unit_type := strconv.FormatInt(unittype, 10)
  149. // fmt.Println("设备型号", unit_type)
  150. use_section := dataBody["use_section"].(string)
  151. //fmt.Println("使用科室", use_section)
  152. section_number := dataBody["section_number"].(string)
  153. // fmt.Println("科室编号", section_number)
  154. buy_date := dataBody["buy_date"].(string)
  155. // fmt.Println("buy_date", buy_date)
  156. timeLayout := "2006-01-02 15:04:05"
  157. theTime, err := utils.ParseTimeStringToTime(timeLayout, buy_date+" 00:00:00")
  158. buydate := theTime.Unix()
  159. int_num := *(*int)(unsafe.Pointer(&buydate))
  160. if int_num < 0 {
  161. buydate = 0
  162. }
  163. // fmt.Println("购买日期", buydate)
  164. install_date := dataBody["install_date"].(string)
  165. toTime, err := utils.ParseTimeStringToTime(timeLayout, install_date+" 00:00:00")
  166. installdate := toTime.Unix()
  167. buy_num := *(*int)(unsafe.Pointer(&installdate))
  168. if buy_num < 0 {
  169. installdate = 0
  170. }
  171. //fmt.Println("安装日期", installdate)
  172. start_date := dataBody["start_date"].(string)
  173. stringToTime, err := utils.ParseTimeStringToTime(timeLayout, start_date+" 00:00:00")
  174. startdate := stringToTime.Unix()
  175. start_num := *(*int)(unsafe.Pointer(&startdate))
  176. if start_num < 0 {
  177. startdate = 0
  178. }
  179. // fmt.Println("启用日期", startdate)
  180. maintenance_engineer := dataBody["maintenance_engineer"].(string)
  181. //fmt.Println("维修工程", maintenance_engineer)
  182. telephone := dataBody["telephone"].(string)
  183. //fmt.Println("telephone", telephone)
  184. guarantee_date := dataBody["guarantee_date"].(string)
  185. // fmt.Println("保修期限", guarantee_date)
  186. machine_status := int64(dataBody["machine_status"].(float64))
  187. //fmt.Println("机器状态", machine_status)
  188. user_total := dataBody["user_total"].(string)
  189. //fmt.Println("初次使用次数", user_total)
  190. disinfection_mode := int64(dataBody["Disinfection_mode"].(float64))
  191. //fmt.Println("消毒方式", disinfection_mode)
  192. remarks := dataBody["remarks"].(string)
  193. //fmt.Println("备注", remarks)
  194. rubbish_date := dataBody["rubbish_date"].(string)
  195. timeStringToTime, err := utils.ParseTimeStringToTime(timeLayout, rubbish_date+" 00:00:00")
  196. rubbishdate := timeStringToTime.Unix()
  197. rubb_num := *(*int)(unsafe.Pointer(&rubbishdate))
  198. if rubb_num < 0 {
  199. rubbishdate = 0
  200. }
  201. //fmt.Println("报废日期", rubbishdate)
  202. rubbish_reason := int64(dataBody["rubbish_reason"].(float64))
  203. //fmt.Println("报废原因", rubbish_reason)
  204. user_year := dataBody["user_year"].(string)
  205. // fmt.Println("使用年限", user_year)
  206. work_time := dataBody["work_time"].(string)
  207. //fmt.Println("工作时长", work_time)
  208. treat_types := dataBody["treat_type"].([]interface{})
  209. revers := int64(dataBody["revers_mode"].(float64))
  210. //fmt.Println("反渗模式", revers)
  211. ids := make([]int64, 0)
  212. for _, treat := range treat_types {
  213. id := int64(treat.(float64))
  214. ids = append(ids, id)
  215. }
  216. //查询机位号是否绑定设备
  217. thisAddmacher, err := service.GetEquitmentByBedID(bed_number, orgid)
  218. if thisAddmacher.ID > 0 {
  219. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeEquitNoExist)
  220. return
  221. }
  222. addmacher := &models.DeviceAddmacher{
  223. SerialNumber: serial_numbe,
  224. DeviceType: device_type,
  225. BedNumber: number.Number,
  226. BedId: bed_number,
  227. //ZoneId: number.ZoneID,
  228. DeviceName: device_name,
  229. ManufactureFactory: manufacture_factory,
  230. ServiceManufacturer: service_manufacturer,
  231. UnitType: unittype,
  232. UseSection: use_section,
  233. SectionNumber: section_number,
  234. BuyDate: buydate,
  235. InstallDate: installdate,
  236. StartDate: startdate,
  237. MaintenaceEngineer: maintenance_engineer,
  238. Telephone: telephone,
  239. GuaranteeDate: guarantee_date,
  240. MachineStatus: machine_status,
  241. UserTotal: user_total,
  242. DisinfectionMode: disinfection_mode,
  243. Remarks: remarks,
  244. RubbishDate: rubbishdate,
  245. RubbishReason: rubbish_reason,
  246. UserYear: user_year,
  247. WorkTime: work_time,
  248. ReversMode: revers,
  249. Status: 1,
  250. Ctime: time.Now().Unix(),
  251. UserOrgId: orgid,
  252. }
  253. err = service.CreateMacher(addmacher)
  254. //fmt.Println("什么原因啊", err)
  255. if err != nil {
  256. this.ServeFailJsonSend(enums.ErrorCodeDataException, "添加设备失败")
  257. return
  258. }
  259. deviceAddmacher, err := service.GetLastMacherData(orgid)
  260. // fmt.Println("错误是什么", err)
  261. equimentname := models.DeviceEquimentname{
  262. EquitmentName: unit_type,
  263. Status: 1,
  264. UserOrgId: orgid,
  265. Ctime: time.Now().Unix(),
  266. EquitmentId: deviceAddmacher.ID,
  267. BedId: bed_number,
  268. }
  269. error := service.AddTreatMode(deviceAddmacher.ID, orgid, ids)
  270. fmt.Println("error:", error)
  271. name, errcode := service.GetEquitmentName(unit_type, orgid)
  272. fmt.Print("错误", errcode)
  273. fmt.Print("name", name)
  274. err = service.CreateEquimentName(equimentname)
  275. //if errcode == gorm.ErrRecordNotFound {
  276. // err = service.CreateEquimentName(equimentname)
  277. //} else if errcode == nil {
  278. // fmt.Print("设备类型已经存在")
  279. //} else {
  280. // fmt.Print("设备类型已经存在")
  281. //}
  282. fmt.Println("添加设备型号失败", err)
  283. this.ServeSuccessJSON(map[string]interface{}{
  284. "addmacher": addmacher,
  285. })
  286. }
  287. func (this *MachineApiController) UpdateMachineInfo() {
  288. adminUserInfo := this.GetAdminUserInfo()
  289. orgid := adminUserInfo.CurrentOrgId
  290. //fmt.Println("机构id", orgid)
  291. dataBody := make(map[string]interface{}, 0)
  292. err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
  293. //fmt.Println("错误是", err)
  294. id := int64(dataBody["id"].(float64))
  295. fmt.Println("id是什么", id)
  296. //serial_number := int64(dataBody["serial_number"].(float64))
  297. serial_number := dataBody["serial_number"].(string)
  298. fmt.Println("序列号", serial_number)
  299. device_type := int64(dataBody["devicetype"].(float64))
  300. fmt.Println("设备类型", device_type)
  301. bed_number := int64(dataBody["bed_number"].(float64))
  302. fmt.Println("机位号", bed_number)
  303. number, err := service.GetZoneId(bed_number, orgid)
  304. //fmt.Println("number是多少", number)
  305. device_name := dataBody["device_name"].(string)
  306. //fmt.Println("设备名称", device_name)
  307. manufacture_factory := dataBody["manufacture_factory"].(string)
  308. //fmt.Println("生产厂家", manufacture_factory)
  309. service_manufacturer := dataBody["service_manufacturer"].(string)
  310. //fmt.Println("维修厂家", service_manufacturer)
  311. unit_type := int64(dataBody["unit_type"].(float64))
  312. //unit_type := strconv.FormatInt(unittype, 10)
  313. fmt.Println("设备型号", unit_type)
  314. use_section := dataBody["use_section"].(string)
  315. //fmt.Println("使用科室", use_section)
  316. section_number := dataBody["section_number"].(string)
  317. //fmt.Println("科室编号", section_number)
  318. buy_date := dataBody["buy_date"].(string)
  319. // fmt.Println("buy_date", buy_date)
  320. timeLayout := "2006-01-02 15:04:05"
  321. theTime, err := utils.ParseTimeStringToTime(timeLayout, buy_date+" 00:00:00")
  322. buydate := theTime.Unix()
  323. int_num := *(*int)(unsafe.Pointer(&buydate))
  324. if int_num < 0 {
  325. buydate = 0
  326. }
  327. fmt.Println("购买日期", buydate)
  328. install_date := dataBody["install_date"].(string)
  329. toTime, err := utils.ParseTimeStringToTime(timeLayout, install_date+" 00:00:00")
  330. installdate := toTime.Unix()
  331. buy_num := *(*int)(unsafe.Pointer(&installdate))
  332. if buy_num < 0 {
  333. installdate = 0
  334. }
  335. //fmt.Println("安装日期", installdate)
  336. start_date := dataBody["start_date"].(string)
  337. stringToTime, err := utils.ParseTimeStringToTime(timeLayout, start_date+" 00:00:00")
  338. startdate := stringToTime.Unix()
  339. start_num := *(*int)(unsafe.Pointer(&startdate))
  340. if start_num < 0 {
  341. startdate = 0
  342. }
  343. //fmt.Println("启用日期", startdate)
  344. maintenance_engineer := dataBody["maintenance_engineer"].(string)
  345. //fmt.Println("维修工程", maintenance_engineer)
  346. telephone := dataBody["telephone"].(string)
  347. //fmt.Println("telephone", telephone)
  348. guarantee_date := dataBody["guarantee_date"].(string)
  349. //fmt.Println("保修期限", guarantee_date)
  350. machine_status := int64(dataBody["machine_status"].(float64))
  351. //fmt.Println("机器状态", machine_status)
  352. user_total := dataBody["user_total"].(string)
  353. //fmt.Println("初次使用次数", user_total)
  354. remarks := dataBody["remarks"].(string)
  355. //fmt.Println("备注", remarks)
  356. rubbish_date := dataBody["rubbish_date"].(string)
  357. timeStringToTime, err := utils.ParseTimeStringToTime(timeLayout, rubbish_date+" 00:00:00")
  358. rubbishdate := timeStringToTime.Unix()
  359. rubb_num := *(*int)(unsafe.Pointer(&rubbishdate))
  360. if rubb_num < 0 {
  361. rubbishdate = 0
  362. }
  363. //fmt.Println("报废日期", rubbishdate)
  364. rubbish_reason := int64(dataBody["rubbish_reason"].(float64))
  365. //fmt.Println("报废原因", rubbish_reason)
  366. user_year := dataBody["user_year"].(string)
  367. //fmt.Println("使用年限", user_year)
  368. work_time := dataBody["work_time"].(string)
  369. //fmt.Println("工作时长", work_time)
  370. treat_types := dataBody["treat_type"].([]interface{})
  371. ids := make([]int64, 0)
  372. for _, treat := range treat_types {
  373. id := int64(treat.(float64))
  374. ids = append(ids, id)
  375. }
  376. fmt.Println("ids", ids)
  377. //service.GetModeName(unit_type)
  378. thisAddmacher, err := service.GetEquitmentByBedID(bed_number, orgid)
  379. if thisAddmacher.ID > 0 && thisAddmacher.ID != id {
  380. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDialysisNoExist)
  381. return
  382. }
  383. addmacher := models.DeviceAddmacher{
  384. ID: id,
  385. SerialNumber: serial_number,
  386. DeviceType: device_type,
  387. BedNumber: number.Number,
  388. BedId: bed_number,
  389. DeviceName: device_name,
  390. ManufactureFactory: manufacture_factory,
  391. ServiceManufacturer: service_manufacturer,
  392. UnitType: unit_type,
  393. UseSection: use_section,
  394. SectionNumber: section_number,
  395. BuyDate: buydate,
  396. InstallDate: installdate,
  397. StartDate: startdate,
  398. MaintenaceEngineer: maintenance_engineer,
  399. Telephone: telephone,
  400. GuaranteeDate: guarantee_date,
  401. MachineStatus: machine_status,
  402. UserTotal: user_total,
  403. Remarks: remarks,
  404. RubbishDate: rubbishdate,
  405. RubbishReason: rubbish_reason,
  406. UserYear: user_year,
  407. WorkTime: work_time,
  408. }
  409. //fmt.Println("addmacher", addmacher)
  410. err = service.UpdateMachine(id, orgid, &addmacher)
  411. //mt.Println("报错", err)
  412. //zone, err := service.GetZoneName(number.ZoneID, orgid)
  413. //fmt.Println("zoneerr",err)
  414. errors := service.UpdateTreatMode(id, orgid, ids)
  415. fmt.Println("更新透析模式失败", errors)
  416. if err != nil {
  417. this.ServeFailJsonSend(enums.ErrorCodeDataException, "更新设备失败")
  418. return
  419. }
  420. this.ServeSuccessJSON(map[string]interface{}{
  421. "addmacher": addmacher,
  422. })
  423. }
  424. func (this *MachineApiController) UpdateMachinetwo() {
  425. adminUserInfo := this.GetAdminUserInfo()
  426. orgid := adminUserInfo.CurrentOrgId
  427. //fmt.Println("机构id", orgid)
  428. dataBody := make(map[string]interface{}, 0)
  429. err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
  430. //fmt.Println("错误是", err)
  431. id := int64(dataBody["id"].(float64))
  432. //fmt.Println("id是什么", id)
  433. //serial_number := int64(dataBody["serial_number"].(float64))
  434. bed_nunmber := dataBody["beds"].(string)
  435. //fmt.Print("机位号z", bes)
  436. // bed_nunmber := strconv.FormatInt(bes,10)
  437. serial_number := dataBody["serial_number"].(string)
  438. //fmt.Println("序列号", serial_number)
  439. device_type := int64(dataBody["devicetype"].(float64))
  440. //fmt.Println("设备类型", device_type)
  441. // bed_nunmber := dataBody["bed_number"].(string)
  442. //fmt.Println("床位好", bed_nunmber)
  443. device_name := dataBody["device_name"].(string)
  444. //fmt.Println("设备名称", device_name)
  445. manufacture_factory := dataBody["manufacture_factory"].(string)
  446. //fmt.Println("生产厂家", manufacture_factory)
  447. service_manufacturer := dataBody["service_manufacturer"].(string)
  448. //fmt.Println("维修厂家", service_manufacturer)
  449. unit_type := int64(dataBody["unit_type"].(float64))
  450. //unit_type := strconv.FormatInt(unittype, 10)
  451. //fmt.Println("设备型号", unit_type)
  452. use_section := dataBody["use_section"].(string)
  453. //fmt.Println("使用科室", use_section)
  454. section_number := dataBody["section_number"].(string)
  455. //fmt.Println("科室编号", section_number)
  456. buy_date := dataBody["buy_date"].(string)
  457. //fmt.Println("buy_date", buy_date)
  458. timeLayout := "2006-01-02 15:04:05"
  459. theTime, err := utils.ParseTimeStringToTime(timeLayout, buy_date+" 00:00:00")
  460. buydate := theTime.Unix()
  461. int_num := *(*int)(unsafe.Pointer(&buydate))
  462. if int_num < 0 {
  463. buydate = 0
  464. }
  465. //fmt.Println("购买日期", buydate)
  466. install_date := dataBody["install_date"].(string)
  467. toTime, err := utils.ParseTimeStringToTime(timeLayout, install_date+" 00:00:00")
  468. installdate := toTime.Unix()
  469. buy_num := *(*int)(unsafe.Pointer(&installdate))
  470. if buy_num < 0 {
  471. installdate = 0
  472. }
  473. //fmt.Println("安装日期", installdate)
  474. start_date := dataBody["start_date"].(string)
  475. stringToTime, err := utils.ParseTimeStringToTime(timeLayout, start_date+" 00:00:00")
  476. startdate := stringToTime.Unix()
  477. start_num := *(*int)(unsafe.Pointer(&startdate))
  478. if start_num < 0 {
  479. startdate = 0
  480. }
  481. //fmt.Println("启用日期", startdate)
  482. maintenance_engineer := dataBody["maintenance_engineer"].(string)
  483. //fmt.Println("维修工程", maintenance_engineer)
  484. telephone := dataBody["telephone"].(string)
  485. //fmt.Println("telephone", telephone)
  486. guarantee_date := dataBody["guarantee_date"].(string)
  487. //fmt.Println("保修期限", guarantee_date)
  488. machine_status := int64(dataBody["machine_status"].(float64))
  489. //fmt.Println("机器状态", machine_status)
  490. user_total := dataBody["user_total"].(string)
  491. //fmt.Println("初次使用次数", user_total)
  492. remarks := dataBody["remarks"].(string)
  493. //fmt.Println("备注", remarks)
  494. rubbish_date := dataBody["rubbish_date"].(string)
  495. timeStringToTime, err := utils.ParseTimeStringToTime(timeLayout, rubbish_date+" 00:00:00")
  496. rubbishdate := timeStringToTime.Unix()
  497. rubb_num := *(*int)(unsafe.Pointer(&rubbishdate))
  498. if rubb_num < 0 {
  499. rubbishdate = 0
  500. }
  501. //fmt.Println("报废日期", rubbishdate)
  502. rubbish_reason := int64(dataBody["rubbish_reason"].(float64))
  503. //fmt.Println("报废原因", rubbish_reason)
  504. user_year := dataBody["user_year"].(string)
  505. //fmt.Println("使用年限", user_year)
  506. work_time := dataBody["work_time"].(string)
  507. //fmt.Println("工作时长", work_time)
  508. disinfection_mode := int64(dataBody["Disinfection_mode"].(float64))
  509. revers_modes := int64(dataBody["revers_mode"].(float64))
  510. addmacher := models.DeviceAddmacher{
  511. ID: id,
  512. SerialNumber: serial_number,
  513. DeviceType: device_type,
  514. BedNumber: bed_nunmber,
  515. DeviceName: device_name,
  516. ManufactureFactory: manufacture_factory,
  517. ServiceManufacturer: service_manufacturer,
  518. UnitType: unit_type,
  519. UseSection: use_section,
  520. SectionNumber: section_number,
  521. BuyDate: buydate,
  522. InstallDate: installdate,
  523. StartDate: startdate,
  524. MaintenaceEngineer: maintenance_engineer,
  525. Telephone: telephone,
  526. GuaranteeDate: guarantee_date,
  527. MachineStatus: machine_status,
  528. UserTotal: user_total,
  529. Remarks: remarks,
  530. RubbishDate: rubbishdate,
  531. RubbishReason: rubbish_reason,
  532. UserYear: user_year,
  533. WorkTime: work_time,
  534. DisinfectionMode: disinfection_mode,
  535. ReversMode: revers_modes,
  536. }
  537. fmt.Println("addmacher", addmacher)
  538. err = service.UpdateMachine(id, orgid, &addmacher)
  539. fmt.Println("报错", err)
  540. if err != nil {
  541. this.ServeFailJsonSend(enums.ErrorCodeDataException, "更新设备失败")
  542. return
  543. }
  544. this.ServeSuccessJSON(map[string]interface{}{
  545. "addmacher": addmacher,
  546. })
  547. }
  548. func (this *MachineApiController) Updatemacheinetwo() {
  549. adminUserInfo := this.GetAdminUserInfo()
  550. orgid := adminUserInfo.CurrentOrgId
  551. //fmt.Println("机构id", orgid)
  552. dataBody := make(map[string]interface{}, 0)
  553. err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
  554. //fmt.Println("错误是", err)
  555. id := int64(dataBody["id"].(float64))
  556. //fmt.Println("id是什么", id)
  557. //serial_number := int64(dataBody["serial_number"].(float64))
  558. serial_number := dataBody["serial_number"].(string)
  559. //fmt.Println("序列号", serial_number)
  560. device_type := int64(dataBody["devicetype"].(float64))
  561. //fmt.Println("设备类型", device_type)
  562. //bed_number := int64(dataBody["bed_number"].(float64))
  563. //fmt.Println("机位号", bed_number)
  564. bednumber := dataBody["bed_numbers"].(string)
  565. //fmt.Println("机位号", bednumber)
  566. //number, err := service.GetZoneId(bed_number, orgid)
  567. //fmt.Println("number是多少", number)
  568. device_name := dataBody["device_name"].(string)
  569. //fmt.Println("设备名称", device_name)
  570. manufacture_factory := dataBody["manufacture_factory"].(string)
  571. //fmt.Println("生产厂家", manufacture_factory)
  572. service_manufacturer := dataBody["service_manufacturer"].(string)
  573. //fmt.Println("维修厂家", service_manufacturer)
  574. unittype := int64(dataBody["unit_type"].(float64))
  575. //unit_type := strconv.FormatInt(unittype, 10)
  576. //fmt.Println("设备型号", unit_type)
  577. use_section := dataBody["use_section"].(string)
  578. //fmt.Println("使用科室", use_section)
  579. section_number := dataBody["section_number"].(string)
  580. //fmt.Println("科室编号", section_number)
  581. buy_date := dataBody["buy_date"].(string)
  582. //fmt.Println("buy_date", buy_date)
  583. timeLayout := "2006-01-02 15:04:05"
  584. theTime, err := utils.ParseTimeStringToTime(timeLayout, buy_date+" 00:00:00")
  585. buydate := theTime.Unix()
  586. int_num := *(*int)(unsafe.Pointer(&buydate))
  587. if int_num < 0 {
  588. buydate = 0
  589. }
  590. //fmt.Println("购买日期", buydate)
  591. install_date := dataBody["install_date"].(string)
  592. toTime, err := utils.ParseTimeStringToTime(timeLayout, install_date+" 00:00:00")
  593. installdate := toTime.Unix()
  594. buy_num := *(*int)(unsafe.Pointer(&installdate))
  595. if buy_num < 0 {
  596. installdate = 0
  597. }
  598. //fmt.Println("安装日期", installdate)
  599. start_date := dataBody["start_date"].(string)
  600. stringToTime, err := utils.ParseTimeStringToTime(timeLayout, start_date+" 00:00:00")
  601. startdate := stringToTime.Unix()
  602. start_num := *(*int)(unsafe.Pointer(&startdate))
  603. if start_num < 0 {
  604. startdate = 0
  605. }
  606. //fmt.Println("启用日期", startdate)
  607. maintenance_engineer := dataBody["maintenance_engineer"].(string)
  608. //fmt.Println("维修工程", maintenance_engineer)
  609. telephone := dataBody["telephone"].(string)
  610. //fmt.Println("telephone", telephone)
  611. guarantee_date := dataBody["guarantee_date"].(string)
  612. //fmt.Println("保修期限", guarantee_date)
  613. machine_status := int64(dataBody["machine_status"].(float64))
  614. //fmt.Println("机器状态", machine_status)
  615. user_total := dataBody["user_total"].(string)
  616. //fmt.Println("初次使用次数", user_total)
  617. remarks := dataBody["remarks"].(string)
  618. //fmt.Println("备注", remarks)
  619. rubbish_date := dataBody["rubbish_date"].(string)
  620. timeStringToTime, err := utils.ParseTimeStringToTime(timeLayout, rubbish_date+" 00:00:00")
  621. rubbishdate := timeStringToTime.Unix()
  622. rubb_num := *(*int)(unsafe.Pointer(&rubbishdate))
  623. if rubb_num < 0 {
  624. rubbishdate = 0
  625. }
  626. //fmt.Println("报废日期", rubbishdate)
  627. rubbish_reason := int64(dataBody["rubbish_reason"].(float64))
  628. //fmt.Println("报废原因", rubbish_reason)
  629. user_year := dataBody["user_year"].(string)
  630. //fmt.Println("使用年限", user_year)
  631. work_time := dataBody["work_time"].(string)
  632. //fmt.Println("工作时长", work_time)
  633. addmacher := models.DeviceAddmacher{
  634. ID: id,
  635. SerialNumber: serial_number,
  636. DeviceType: device_type,
  637. BedNumber: bednumber,
  638. DeviceName: device_name,
  639. ManufactureFactory: manufacture_factory,
  640. ServiceManufacturer: service_manufacturer,
  641. UnitType: unittype,
  642. UseSection: use_section,
  643. SectionNumber: section_number,
  644. BuyDate: buydate,
  645. InstallDate: installdate,
  646. StartDate: startdate,
  647. MaintenaceEngineer: maintenance_engineer,
  648. Telephone: telephone,
  649. GuaranteeDate: guarantee_date,
  650. MachineStatus: machine_status,
  651. UserTotal: user_total,
  652. Remarks: remarks,
  653. RubbishDate: rubbishdate,
  654. RubbishReason: rubbish_reason,
  655. UserYear: user_year,
  656. WorkTime: work_time,
  657. }
  658. //fmt.Println("addmacher", addmacher)
  659. err = service.UpdateMachine(id, orgid, &addmacher)
  660. //fmt.Println("报错", err)
  661. if err != nil {
  662. this.ServeFailJsonSend(enums.ErrorCodeDataException, "更新设备失败")
  663. return
  664. }
  665. this.ServeSuccessJSON(map[string]interface{}{
  666. "addmacher": addmacher,
  667. })
  668. }
  669. func (this *MachineApiController) GetAllEquimentName() {
  670. adminUser := this.GetAdminUserInfo()
  671. orgid := adminUser.CurrentOrgId
  672. equit, err := service.GetAllEquimentName(orgid)
  673. if err != nil {
  674. this.ServeFailJsonSend(enums.ErrorCodeDataException, "更新设备失败")
  675. return
  676. }
  677. this.ServeSuccessJSON(map[string]interface{}{
  678. "equit": equit,
  679. })
  680. }
  681. func (this *MachineApiController) SavePlan() {
  682. id, _ := this.GetInt64("id")
  683. //fmt.Println("设备id", id)
  684. adminUserInfo := this.GetAdminUserInfo()
  685. orgid := adminUserInfo.CurrentOrgId
  686. //fmt.Println("机构id", orgid)
  687. dataBody := make(map[string]interface{}, 0)
  688. err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
  689. //fmt.Println("错误是", err)
  690. device_type := int64(dataBody["device_type"].(float64))
  691. //fmt.Println("设备型号", device_type)
  692. disinfec_time := dataBody["disinfec_time"].(string)
  693. //fmt.Println("消毒时长", disinfec_time)
  694. time := dataBody["time"].([]interface{})
  695. //fmt.Println("时间", time)
  696. ids := make([]int64, 0)
  697. for _, t := range time {
  698. id := int64(t.(float64))
  699. ids = append(ids, id)
  700. }
  701. //fmt.Println("ids", ids)
  702. classtime := dataBody["class_time"].([]interface{})
  703. //fmt.Println("班次", classtime)
  704. classids := make([]int64, 0)
  705. for _, class := range classtime {
  706. id := int64(class.(float64))
  707. classids = append(classids, id)
  708. }
  709. //fmt.Println("classids", classids)
  710. way := int64(dataBody["way"].(float64))
  711. //fmt.Println("基表消毒方式", way)
  712. machinedisinfectant := int64(dataBody["machine_disinfectant"].(float64))
  713. //fmt.Println("基表消毒液", machinedisinfectant)
  714. disinfectantway := int64(dataBody["disinfectant_way"].(float64))
  715. //fmt.Println("液路消毒方式", disinfectantway)
  716. disinfectant := int64(dataBody["disinfectant"].(float64))
  717. //fmt.Println("液路消毒液", disinfectant)
  718. bed, err := service.GetBed(id)
  719. _, errcode := service.QueryPlan(orgid, device_type, ids, classids, id)
  720. fmt.Print("errcode ---------", errcode)
  721. if errcode == gorm.ErrRecordNotFound {
  722. err = service.AddPlan(orgid, device_type, disinfec_time, ids, classids, way, machinedisinfectant, disinfectantway, disinfectant, id, bed.BedId)
  723. if err != nil {
  724. this.ServeFailJsonSend(enums.ErrorCodeDataException, "添加计划失败")
  725. return
  726. }
  727. this.ServeSuccessJSON(map[string]interface{}{
  728. "msg": "msg",
  729. })
  730. } else if errcode == nil {
  731. this.ServeFailJsonSend(enums.ErrorCodeDataException, "已存在")
  732. return
  733. } else {
  734. this.ServeFailJsonSend(enums.ErrorCodeDataException, "已存在")
  735. return
  736. }
  737. }
  738. func (this *MachineApiController) GetAllPlan() {
  739. adminUserin := this.GetAdminUserInfo()
  740. orgid := adminUserin.CurrentOrgId
  741. plan, err := service.GetAllPlan(orgid)
  742. if err != nil {
  743. this.ServeFailJsonSend(enums.ErrorCodeDataException, "更新设备失败")
  744. return
  745. }
  746. this.ServeSuccessJSON(map[string]interface{}{
  747. "plan": plan,
  748. })
  749. }
  750. func (this *MachineApiController) GetAllPlanDetail() {
  751. //id, _ := this.GetInt64("id")
  752. //更据设备ID获取设备型号
  753. //fmt.Print("=================失败ID",id)
  754. unitype := this.GetString("unitype")
  755. deviceType, err2 := service.GetDeviceType(unitype)
  756. fmt.Print("eer2", err2)
  757. adminUserInfo := this.GetAdminUserInfo()
  758. orgid := adminUserInfo.CurrentOrgId
  759. //fmt.Println("orgid", orgid)
  760. plandetail, err := service.GetAllPlanDetail(deviceType.ID, orgid)
  761. if err != nil {
  762. this.ServeFailJsonSend(enums.ErrorCodeDataException, "更新设备失败")
  763. return
  764. }
  765. this.ServeSuccessJSON(map[string]interface{}{
  766. "plandetail": plandetail,
  767. })
  768. }
  769. func (this *MachineApiController) GetEditMahchine() {
  770. id, _ := this.GetInt64("id")
  771. fmt.Print("id", id)
  772. }
  773. func (this *MachineApiController) DeletePlans() {
  774. adminUserInfo := this.GetAdminUserInfo()
  775. OrgID := adminUserInfo.CurrentOrgId
  776. dataBody := make(map[string]interface{}, 0)
  777. err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
  778. if err != nil {
  779. utils.ErrorLog(err.Error())
  780. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "参数错误")
  781. return
  782. }
  783. idsInters := dataBody["ids"].([]interface{})
  784. if len(idsInters) == 0 {
  785. if err != nil {
  786. this.ServeFailJsonSend(enums.ErrorCodeDBDelete, "删除会员失败:(没有选择会员)")
  787. return
  788. }
  789. }
  790. ids := make([]int64, 0)
  791. for _, idsInter := range idsInters {
  792. id := int64(idsInter.(float64))
  793. ids = append(ids, id)
  794. }
  795. err = service.DeletePlans(OrgID, ids)
  796. if err != nil {
  797. this.ServeFailJsonSend(enums.ErrorCodeDBDelete, "删除失败:("+err.Error()+")")
  798. return
  799. }
  800. returnData := make(map[string]interface{}, 0)
  801. returnData["msg"] = "ok"
  802. this.ServeSuccessJSON(returnData)
  803. return
  804. }
  805. func (this *MachineApiController) EditPlanDetail() {
  806. id, _ := this.GetInt64("id")
  807. adminUserInfo := this.GetAdminUserInfo()
  808. orgId := adminUserInfo.CurrentOrgId
  809. plan, err := service.GetPlanDetailById(id, orgId)
  810. fmt.Println("err", err)
  811. if err != nil {
  812. this.ServeFailJsonSend(enums.ErrorCodeDBDelete, "删除失败:("+err.Error()+")")
  813. return
  814. }
  815. this.ServeSuccessJSON(map[string]interface{}{
  816. "plan": plan,
  817. })
  818. }
  819. func (this *MachineApiController) UpdatePlanInfo() {
  820. dataBody := make(map[string]interface{}, 0)
  821. err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
  822. //fmt.Println("错误是", err)
  823. id := int64(dataBody["id"].(float64))
  824. //fmt.Println("id", id)
  825. device_type := int64(dataBody["device_type"].(float64))
  826. //fmt.Println("设备型号", device_type)
  827. disinfec_time := int64(dataBody["disinfec_time"].(float64))
  828. //fmt.Println("消毒时长", disinfec_time)
  829. time := int64(dataBody["time"].(float64))
  830. //fmt.Println("时间", time)
  831. classtime := int64(dataBody["class_time"].(float64))
  832. //fmt.Println("班次", classtime)
  833. way := int64(dataBody["way"].(float64))
  834. //fmt.Println("基表消毒方式", way)
  835. machinedisinfectant := int64(dataBody["machine_disinfectant"].(float64))
  836. //fmt.Println("基表消毒液", machinedisinfectant)
  837. disinfectantway := int64(dataBody["disinfectant_way"].(float64))
  838. fmt.Println("液路消毒方式", disinfectantway)
  839. disinfectant := int64(dataBody["disinfectant"].(float64))
  840. //fmt.Println("液路消毒液", disinfectant)
  841. adminUserInfo := this.GetAdminUserInfo()
  842. orgid := adminUserInfo.CurrentOrgId
  843. //fmt.Println("orgid", orgid)
  844. plan := models.DevicePlan{
  845. DeviceType: device_type,
  846. DisinfecTime: disinfec_time,
  847. Time: time,
  848. Classtime: classtime,
  849. Way: way,
  850. MachineDisinfectant: machinedisinfectant,
  851. DisinfectanWay: disinfectantway,
  852. Disinfectant: disinfectant,
  853. }
  854. err = service.UpdatePlanInfo(id, orgid, plan)
  855. fmt.Println("err", err)
  856. if err != nil {
  857. this.ServeFailJsonSend(enums.ErrorCodeDBDelete, "删除失败:("+err.Error()+")")
  858. return
  859. }
  860. this.ServeSuccessJSON(map[string]interface{}{
  861. "plan": plan,
  862. })
  863. }
  864. func (this *MachineApiController) GetComprehensive() {
  865. zone, _ := this.GetInt64("zone")
  866. //fmt.Println("分区", zone)
  867. number, _ := this.GetInt64("number")
  868. //fmt.Println("机号", number)
  869. devicetype, _ := this.GetInt64("devicetype")
  870. //fmt.Println("type", devicetype)
  871. year, _ := this.GetInt64("year")
  872. //fmt.Println("year", year)
  873. startTime := this.GetString("starttime")
  874. //fmt.Println("开始时间", startTime)
  875. timeLayout := "2006-01-02"
  876. loc, _ := time.LoadLocation("Local")
  877. theTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", startTime+" 00:00:00", loc)
  878. starts := theTime.Unix()
  879. //fmt.Println("开始日期", starts)
  880. endtime := this.GetString("endtime")
  881. location, _ := time.ParseInLocation(timeLayout+" 15:04:05", endtime+" 00:00:00", loc)
  882. end := location.Unix()
  883. //fmt.Println("endtime", end)
  884. adminUserInfo := this.GetAdminUserInfo()
  885. orgid := adminUserInfo.CurrentOrgId
  886. macher, err := service.GetComprehensive(zone, number, devicetype, year, starts, end, orgid)
  887. if err != nil {
  888. this.ServeFailJsonSend(enums.ErrorCodeDBDelete, "删除失败:("+err.Error()+")")
  889. return
  890. }
  891. this.ServeSuccessJSON(map[string]interface{}{
  892. "macher": macher,
  893. })
  894. }
  895. func (this *MachineApiController) GetPatientInfo() {
  896. adminUser := this.GetAdminUserInfo()
  897. orgid := adminUser.CurrentOrgId
  898. //fmt.Println("机构id", orgid)
  899. id, _ := this.GetInt64("id")
  900. //fmt.Println("设备id", id)
  901. addmacher, _ := service.GetBedId(id)
  902. //fmt.Println("addmacher", addmacher.BedId)
  903. timeStr := time.Now().Format("2006-01-02")
  904. timeLayout := "2006-01-02 15:04:05"
  905. //fmt.Println("timeStr:", timeStr)
  906. timeStringToTime, _ := utils.ParseTimeStringToTime(timeLayout, timeStr+" 00:00:00")
  907. timenow := timeStringToTime.Unix()
  908. //fmt.Println("timenow是什么", timenow)
  909. //fmt.Println("时间搓", timeStringToTime.Unix())
  910. //获取当天床位号排班的所有病人
  911. schedules, err := service.GetPatientInfo(addmacher.BedId, timenow, orgid)
  912. //fmt.Println("错误", err)
  913. if err != nil {
  914. this.ServeFailJsonSend(enums.ErrorCodeDBDelete, "删除失败:("+err.Error()+")")
  915. return
  916. }
  917. this.ServeSuccessJSON(map[string]interface{}{
  918. "schedules": schedules,
  919. })
  920. }
  921. func (this *MachineApiController) GetPatient() {
  922. adminUser := this.GetAdminUserInfo()
  923. orgid := adminUser.CurrentOrgId
  924. //fmt.Println("机构id", orgid)
  925. equitid, _ := this.GetInt64("equitid")
  926. //fmt.Println("设备id", equitid)
  927. addmacher, _ := service.GetBedId(equitid)
  928. id, _ := this.GetInt64("id")
  929. //fmt.Println("班次id", id)
  930. timeStr := time.Now().Format("2006-01-02")
  931. timeLayout := "2006-01-02 15:04:05"
  932. //fmt.Println("timeStr:", timeStr)
  933. timeStringToTime, _ := utils.ParseTimeStringToTime(timeLayout, timeStr+" 00:00:00")
  934. timenow := timeStringToTime.Unix()
  935. //fmt.Println("timenow是什么", timenow)
  936. schedules, err := service.GetPatient(addmacher.BedId, orgid, id, timenow)
  937. //fmt.Println("schedules", schedules.PartitionId)
  938. //获取区号姓名
  939. zone, _ := service.GetPartitionName(schedules.PartitionId)
  940. //获取机位号
  941. number, _ := service.GetPatientNumber(schedules.BedId)
  942. //获取上机时间和下机时间
  943. order, _ := service.GetDialysisOrder(timenow, schedules.PatientId, orgid)
  944. //获取透析方式
  945. prescription, _ := service.GetDialysisWay(timenow, schedules.PatientId, orgid)
  946. //获取透析时长
  947. dislysis, _ := service.GetDialysisTime(timenow, schedules.PatientId, orgid)
  948. if err != nil {
  949. this.ServeFailJsonSend(enums.ErrorCodeDBDelete, "删除失败:("+err.Error()+")")
  950. return
  951. }
  952. this.ServeSuccessJSON(map[string]interface{}{
  953. "patients": schedules,
  954. "zone": zone,
  955. "number": number,
  956. "order": order,
  957. "prescription": prescription,
  958. "dislysis": dislysis,
  959. })
  960. }
  961. func (this *MachineApiController) GetAllOrganization() {
  962. adminUserInfo := this.GetAdminUserInfo()
  963. orgid := adminUserInfo.CurrentOrgId
  964. //fmt.Println("orgid", orgid)
  965. appid := adminUserInfo.CurrentAppId
  966. //fmt.Println("appid", appid)
  967. approle, err := service.GetAllOrganization(orgid, appid)
  968. if err != nil {
  969. this.ServeFailJsonSend(enums.ErrorCodeDBDelete, "查询失败:("+err.Error()+")")
  970. return
  971. }
  972. this.ServeSuccessJSON(map[string]interface{}{
  973. "approle": approle,
  974. })
  975. }
  976. func (this *MachineApiController) SaveInformation() {
  977. eid, _ := this.GetInt64("eid")
  978. dataBody := make(map[string]interface{}, 0)
  979. err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
  980. //fmt.Println("错误是", err)
  981. adminUserInfo := this.GetAdminUserInfo()
  982. orgid := adminUserInfo.CurrentOrgId
  983. id := int64(dataBody["id"].(float64))
  984. fmt.Println("id", id)
  985. date := dataBody["date"].(string)
  986. timeLayout := "2006-01-02"
  987. loc, _ := time.LoadLocation("Local")
  988. theTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", date+" 00:00:00", loc)
  989. startdate := theTime.Unix()
  990. //fmt.Println("日期", startdate)
  991. classtype := int64(dataBody["classtype"].(float64))
  992. //fmt.Println("班次", classtype)
  993. zone := int64(dataBody["zone"].(float64))
  994. //fmt.Println("分区", zone)
  995. bednumber := int64(dataBody["bed_number"].(float64))
  996. //fmt.Println("床位号", bednumber)
  997. number, err := service.GetNumbers(bednumber, orgid)
  998. patient_time := int64(dataBody["patient_id"].(float64))
  999. //fmt.Println("患者", patient_time)
  1000. contagion := dataBody["contagion"].(string)
  1001. //fmt.Println("传染病", contagion)
  1002. dialysis_mode := int64(dataBody["dialysis_mode"].(float64))
  1003. //fmt.Println("透析方式", dialysis_mode)
  1004. startDateStr := dataBody["start_time"].(string)
  1005. //fmt.Println("上机时间", startDateStr)
  1006. startDate, _ := utils.ParseTimeStringToTime("2006-01-02 15:04", startDateStr)
  1007. //fmt.Println("上机时间", startDate.Unix())
  1008. endDateStr := dataBody["end_time"].(string)
  1009. endDate, _ := utils.ParseTimeStringToTime("2006-01-02 15:04", endDateStr)
  1010. //fmt.Println("下机时间", endDate.Unix())
  1011. dialysis_time := dataBody["dialysis_time"].(string)
  1012. //fmt.Println("透析时长", dialysis_time)
  1013. //hyperfiletration := dataBody["hyperfiltratio"].(string)
  1014. hyperfiletration := dataBody["hyperfiltratio"].(float64)
  1015. //hyperfiletration := strconv.FormatInt(hyperfiltratios, 10)
  1016. fmt.Println("实际超滤量", hyperfiletration)
  1017. //weight_loss := dataBody["weight_loss"].(string)
  1018. weight_loss := dataBody["weight_loss"].(float64)
  1019. //weight_loss := strconv.FormatInt(weightloss, 10)
  1020. fmt.Println("体重减少", weight_loss)
  1021. warining_value := dataBody["warning_value"].(string)
  1022. fmt.Println("预警值", warining_value)
  1023. //user_total := dataBody["user_total"].(string)
  1024. //fmt.Println("使用次数",user_total)
  1025. usertotal := int64(dataBody["user_total"].(float64))
  1026. user_total := strconv.FormatInt(usertotal, 10)
  1027. run := int64(dataBody["run"].(float64))
  1028. //fmt.Println("运行", run)
  1029. failure_stage := int64(dataBody["failure_stage"].(float64))
  1030. //fmt.Println("故事发生阶段", failure_stage)
  1031. falult_desciription := dataBody["fault_description"].(string)
  1032. //fmt.Println("故障描述", falult_desciription)
  1033. code_information := dataBody["code_information"].(string)
  1034. //fmt.Println("故障提示及代码", code_information)
  1035. //机器消毒
  1036. disinfect_type := int64(dataBody["disinfect_type"].(float64))
  1037. //fmt.Println("消毒方式", disinfect_type)
  1038. disinfectant_type := int64(dataBody["disinfectant_type"].(float64))
  1039. //fmt.Println("消毒液", disinfectant_type)
  1040. disinfection := int64(dataBody["disinfection"].(float64))
  1041. //fmt.Println("消毒状态", disinfection)
  1042. machine_run := int64(dataBody["machine_run"].(float64))
  1043. //fmt.Println("运行", machine_run)
  1044. //液路
  1045. fluid_path := int64(dataBody["fluid_path"].(float64))
  1046. //fmt.Println("液路消毒方式", fluid_path)
  1047. disinfectant := int64(dataBody["disinfectant"].(float64))
  1048. //fmt.Println("消毒液", disinfectant)
  1049. disinfection_status := int64(dataBody["disinfection_status"].(float64))
  1050. //fmt.Println("消毒状态", disinfection_status)
  1051. disinfection_residue := int64(dataBody["disinfection_residue"].(float64))
  1052. //fmt.Println("消毒液残留", disinfection_residue)
  1053. longtime := dataBody["longtime"].(string)
  1054. //fmt.Println("消毒时长", longtime)
  1055. start_DateStr := dataBody["starttime"].(string)
  1056. //fmt.Println("出发时间", startDateStr)
  1057. start_Date, _ := utils.ParseTimeStringToTime("2006-01-02 15:04", start_DateStr)
  1058. //fmt.Println("触发事件", start_Date.Unix())
  1059. end_DateStr := dataBody["endtime"].(string)
  1060. //fmt.Println("出发时间", startDateStr)
  1061. end_Date, _ := utils.ParseTimeStringToTime("2006-01-02 15:04", end_DateStr)
  1062. //fmt.Println("触发事件", end_Date.Unix())
  1063. dialysis_checked := int64(dataBody["dialysis_checked"].(float64))
  1064. //fmt.Println("更换", dialysis_checked)
  1065. dialysis_name := int64(dataBody["dialysis_name"].(float64))
  1066. //fmt.Println("名称", dialysis_name)
  1067. norms := dataBody["norms"].(string)
  1068. //fmt.Println("规格", norms)
  1069. dialysis_concentration := int64(dataBody["dialysis_concentration"].(float64))
  1070. //fmt.Println("浓度", dialysis_concentration)
  1071. germ_checked := int64(dataBody["germ_checked"].(float64))
  1072. //fmt.Println("更换", germ_checked)
  1073. germ_name := int64(dataBody["germ_name"].(float64))
  1074. //fmt.Println("名称", germ_name)
  1075. germ_number := dataBody["germ_number"].(string)
  1076. //fmt.Println("数量", germ_number)
  1077. clean := int64(dataBody["clean"].(float64))
  1078. //fmt.Println("清洁", clean)
  1079. sign_name := int64(dataBody["sign_name"].(float64))
  1080. //fmt.Println("签名", sign_name)
  1081. information, errinfor := service.GetInformation(eid, startdate, orgid)
  1082. fmt.Print("errinfor", errinfor)
  1083. fmt.Print("information", information)
  1084. if errinfor == gorm.ErrRecordNotFound {
  1085. infor := models.DeviceInformation{
  1086. Date: startdate,
  1087. Class: classtype,
  1088. // Zone: zone,
  1089. BedNumber: bednumber,
  1090. PatientId: patient_time,
  1091. Contagion: contagion,
  1092. DialysisMode: dialysis_mode,
  1093. StartTime: startDate.Unix(),
  1094. EndTime: endDate.Unix(),
  1095. DialysisHour: dialysis_time,
  1096. Hyperfiltratio: hyperfiletration,
  1097. WeightLoss: weight_loss,
  1098. WarningValue: warining_value,
  1099. UserTotal: user_total,
  1100. Move: run,
  1101. FailureStage: failure_stage,
  1102. FaultDescription: falult_desciription,
  1103. CodeInformation: code_information,
  1104. DisinfectantType: disinfectant_type,
  1105. DisinfectType: disinfect_type,
  1106. Disinfection: disinfection,
  1107. MachineRun: machine_run,
  1108. FluidPath: fluid_path,
  1109. Disinfectant: disinfectant,
  1110. DisinfectionStatus: disinfection_status,
  1111. DisinfectionResidue: disinfection_residue,
  1112. LongTime: longtime,
  1113. DisinfecStartime: start_Date.Unix(),
  1114. DisinfecEndtime: end_Date.Unix(),
  1115. DialysisChecked: dialysis_checked,
  1116. DialysisName: dialysis_name,
  1117. Norms: norms,
  1118. DialysisConcentration: dialysis_concentration,
  1119. GermChecked: germ_checked,
  1120. GermName: germ_name,
  1121. GermNumber: germ_number,
  1122. Clean: clean,
  1123. SignName: sign_name,
  1124. Ctime: time.Now().Unix(),
  1125. Status: 1,
  1126. UserOrgId: orgid,
  1127. EquimentId: eid,
  1128. Bed: number.Number,
  1129. Stime: startdate,
  1130. }
  1131. err = service.CreateUserInformation(&infor)
  1132. fmt.Println("使用登记错误是什么", err)
  1133. this.ServeSuccessJSON(map[string]interface{}{
  1134. "information": infor,
  1135. })
  1136. } else if errinfor == nil {
  1137. infor := models.DeviceInformation{
  1138. Date: startdate,
  1139. Class: classtype,
  1140. Zone: zone,
  1141. BedNumber: bednumber,
  1142. PatientId: patient_time,
  1143. Contagion: contagion,
  1144. DialysisMode: dialysis_mode,
  1145. StartTime: startDate.Unix(),
  1146. EndTime: endDate.Unix(),
  1147. DialysisHour: dialysis_time,
  1148. Hyperfiltratio: hyperfiletration,
  1149. WeightLoss: weight_loss,
  1150. WarningValue: warining_value,
  1151. UserTotal: user_total,
  1152. Move: run,
  1153. FailureStage: failure_stage,
  1154. FaultDescription: falult_desciription,
  1155. CodeInformation: code_information,
  1156. DisinfectantType: disinfectant_type,
  1157. DisinfectType: disinfect_type,
  1158. Disinfection: disinfection,
  1159. MachineRun: machine_run,
  1160. FluidPath: fluid_path,
  1161. Disinfectant: disinfectant,
  1162. DisinfectionStatus: disinfection_status,
  1163. DisinfectionResidue: disinfection_residue,
  1164. LongTime: longtime,
  1165. DisinfecStartime: start_Date.Unix(),
  1166. DisinfecEndtime: end_Date.Unix(),
  1167. DialysisChecked: dialysis_checked,
  1168. DialysisName: dialysis_name,
  1169. Norms: norms,
  1170. DialysisConcentration: dialysis_concentration,
  1171. GermChecked: germ_checked,
  1172. GermName: germ_name,
  1173. GermNumber: germ_number,
  1174. Clean: clean,
  1175. SignName: sign_name,
  1176. Ctime: time.Now().Unix(),
  1177. Status: 1,
  1178. UserOrgId: orgid,
  1179. EquimentId: eid,
  1180. Bed: number.Number,
  1181. }
  1182. informationdata, err := service.GetLastInformationdata(eid, startdate, orgid)
  1183. fmt.Print("informationdata----", informationdata.ID)
  1184. errors := service.UpadateForm(informationdata.ID, orgid, &infor)
  1185. //fmt.Print("报错", errors)
  1186. if errors != nil {
  1187. this.ServeFailJsonSend(enums.ErrorCodeDBDelete, "查询失败:("+err.Error()+")")
  1188. return
  1189. }
  1190. this.ServeSuccessJSON(map[string]interface{}{
  1191. "infor": infor,
  1192. })
  1193. } else {
  1194. }
  1195. }
  1196. func (this *MachineApiController) ChangePatient() {
  1197. adminUser := this.GetAdminUserInfo()
  1198. orgid := adminUser.CurrentOrgId
  1199. fmt.Println("机构id", orgid)
  1200. equitid, _ := this.GetInt64("equitid")
  1201. fmt.Println("equitid", equitid)
  1202. id, _ := this.GetInt64("id")
  1203. fmt.Println("id", id)
  1204. }
  1205. func (this *MachineApiController) GetRegisterInfo() {
  1206. timeStr := time.Now().Format("2006-01-02")
  1207. timeLayout := "2006-01-02 15:04:05"
  1208. //fmt.Println("timeStr:", timeStr)
  1209. timeStringToTime, _ := utils.ParseTimeStringToTime(timeLayout, timeStr+" 00:00:00")
  1210. timenow := timeStringToTime.Unix()
  1211. //fmt.Println("timenow是什么", timenow)
  1212. adminUser := this.GetAdminUserInfo()
  1213. orgid := adminUser.CurrentOrgId
  1214. appid := adminUser.CurrentAppId
  1215. id, _ := this.GetInt64("id")
  1216. //fmt.Println("设备id", id)
  1217. information, err := service.GetRegisterInfo(orgid, id, timenow)
  1218. fmt.Print("错误", err)
  1219. role, err := service.GetSignName(information.SignName, orgid, appid)
  1220. dislysis, _ := service.GetDialysisTime(timenow, information.PatientId, orgid)
  1221. //if err != nil {
  1222. // // this.ServeFailJsonSend(enums.ErrorCodeDBDelete, "查询失败:("+err.Error()+")")
  1223. // // return
  1224. // //}
  1225. this.ServeSuccessJSON(map[string]interface{}{
  1226. "information": information,
  1227. "role": role,
  1228. "dislysis": dislysis,
  1229. })
  1230. }
  1231. func (this *MachineApiController) GetInformationData() {
  1232. limit, _ := this.GetInt64("limit")
  1233. //fmt.Println("limit2", limit)
  1234. page, _ := this.GetInt64("page")
  1235. //fmt.Println("page", page)
  1236. adminUser := this.GetAdminUserInfo()
  1237. orgId := adminUser.CurrentOrgId
  1238. information, total, err := service.GetInformationData(limit, page, orgId)
  1239. if err != nil {
  1240. this.ServeFailJsonSend(enums.ErrorCodeDBDelete, "查询失败:("+err.Error()+")")
  1241. return
  1242. }
  1243. this.ServeSuccessJSON(map[string]interface{}{
  1244. "information": information,
  1245. "total": total,
  1246. })
  1247. }
  1248. func (this *MachineApiController) GetOrgName() {
  1249. adminUser := this.GetAdminUserInfo()
  1250. orgid := adminUser.CurrentOrgId
  1251. org, err := service.GetOrgName(orgid)
  1252. if err != nil {
  1253. this.ServeFailJsonSend(enums.ErrorCodeDBDelete, "查询失败:("+err.Error()+")")
  1254. return
  1255. }
  1256. this.ServeSuccessJSON(map[string]interface{}{
  1257. "org": org,
  1258. })
  1259. }
  1260. func (this *MachineApiController) SaveBacteria() {
  1261. id, _ := this.GetInt64("id")
  1262. addmacher, _ := service.GetBedId(id)
  1263. adminUserInfo := this.GetAdminUserInfo()
  1264. orgid := adminUserInfo.CurrentOrgId
  1265. dataBody := make(map[string]interface{}, 0)
  1266. err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
  1267. date := dataBody["date"].(string)
  1268. timeLayout := "2006-01-02"
  1269. loc, _ := time.LoadLocation("Local")
  1270. theTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", date+" 00:00:00", loc)
  1271. state_date := theTime.Unix()
  1272. specimen := int64(dataBody["specimen"].(float64))
  1273. cona := dataBody["concentrate_noa"].(string)
  1274. conb := dataBody["concentrate_nob"].(string)
  1275. samplingLoactiona := int64(dataBody["sampling_locationa"].(float64))
  1276. detectionUnit := dataBody["detection_unit"].(string)
  1277. sampler := int64(dataBody["sampler"].(float64))
  1278. reportDate := dataBody["reporting_date"].(string)
  1279. reportTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", reportDate+" 00:00:00", loc)
  1280. repDate := reportTime.Unix()
  1281. detectionResult := dataBody["detection_result"].(string)
  1282. sort := dataBody["sort"].(string)
  1283. examination := dataBody["pass_examination"].(string)
  1284. pass_examination, err := strconv.ParseInt(examination, 10, 64)
  1285. modifications := int64(dataBody["modifications"].(float64))
  1286. culture := models.DeviceCulture{
  1287. BedId: addmacher.BedId,
  1288. SpelingDate: state_date,
  1289. Specimen: specimen,
  1290. ConcentrateNoa: cona,
  1291. ConcentrateNob: conb,
  1292. SamplingLocationa: samplingLoactiona,
  1293. DetectionUnit: detectionUnit,
  1294. Sampler: sampler,
  1295. ReportingDate: repDate,
  1296. DetectionResult: detectionResult,
  1297. Ctime: time.Now().Unix(),
  1298. Status: 1,
  1299. UserOrgId: orgid,
  1300. EquitmentId: id,
  1301. Bed: addmacher.BedNumber,
  1302. Sort: sort,
  1303. PassExamination: pass_examination,
  1304. Modifications: modifications,
  1305. }
  1306. err = service.CreateCulture(&culture)
  1307. //fmt.Println("创建细菌检测", err)
  1308. if err != nil {
  1309. this.ServeFailJsonSend(enums.ErrorCodeDBDelete, "添加失败:("+err.Error()+")")
  1310. return
  1311. }
  1312. this.ServeSuccessJSON(map[string]interface{}{
  1313. "culture": culture,
  1314. })
  1315. }
  1316. func (this *MachineApiController) SaveLinconmycin() {
  1317. timeLayout := "2006-01-02"
  1318. loc, _ := time.LoadLocation("Local")
  1319. id, _ := this.GetInt64("id")
  1320. addmacher, _ := service.GetBedId(id)
  1321. adminUserInfo := this.GetAdminUserInfo()
  1322. orgid := adminUserInfo.CurrentOrgId
  1323. dataBody := make(map[string]interface{}, 0)
  1324. err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
  1325. date := dataBody["sampling_date"].(string)
  1326. theTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", date+" 00:00:00", loc)
  1327. samp_date := theTime.Unix()
  1328. specimen := int64(dataBody["specimenb"].(float64))
  1329. cona := dataBody["concentrate_noc"].(string)
  1330. conb := dataBody["concentrateb_nod"].(string)
  1331. samplinglocationb := int64(dataBody["sampling_locationb"].(float64))
  1332. detectionUnit := dataBody["detection_unit"].(string)
  1333. samplerb := int64(dataBody["samplerb"].(float64))
  1334. reportDate := dataBody["reporting_dateb"].(string)
  1335. reportTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", reportDate+" 00:00:00", loc)
  1336. repDate := reportTime.Unix()
  1337. detectionResult := dataBody["detection_resultb"].(string)
  1338. sort := dataBody["sort"].(string)
  1339. modifications := int64(dataBody["modifications"].(float64))
  1340. examination := dataBody["pass_examination"].(string)
  1341. pass_examination, _ := strconv.ParseInt(examination, 10, 64)
  1342. dialysate := models.DeviceDialysate{
  1343. SamplingDate: samp_date,
  1344. Specimenb: specimen,
  1345. ConcentrateNoc: cona,
  1346. ConcentratebNod: conb,
  1347. SamplingLocationb: samplinglocationb,
  1348. DetectionUnit: detectionUnit,
  1349. Samplerb: samplerb,
  1350. ReportingDateb: repDate,
  1351. DetectionResultb: detectionResult,
  1352. Ctime: time.Now().Unix(),
  1353. Status: 1,
  1354. UserOrgId: orgid,
  1355. BedId: addmacher.BedId,
  1356. EquitmentId: id,
  1357. Bed: addmacher.BedNumber,
  1358. Sort: sort,
  1359. PassExamination: pass_examination,
  1360. Modifications: modifications,
  1361. }
  1362. err = service.CreateDialysate(&dialysate)
  1363. //fmt.Println("报错", err)
  1364. if err != nil {
  1365. this.ServeFailJsonSend(enums.ErrorCodeDBDelete, "添加失败:("+err.Error()+")")
  1366. return
  1367. }
  1368. this.ServeSuccessJSON(map[string]interface{}{
  1369. "dialysate": dialysate,
  1370. })
  1371. }
  1372. func (this *MachineApiController) SaveQualityControl() {
  1373. id, _ := this.GetInt64("id")
  1374. addmacher, _ := service.GetBedId(id)
  1375. adminUserInfo := this.GetAdminUserInfo()
  1376. orgid := adminUserInfo.CurrentOrgId
  1377. dataBody := make(map[string]interface{}, 0)
  1378. err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
  1379. timeLayout := "2006-01-02"
  1380. loc, _ := time.LoadLocation("Local")
  1381. // 透析液离子浓度检测
  1382. dateb := dataBody["dateb"].(string)
  1383. inLocation, _ := time.ParseInLocation(timeLayout+" 15:04:05", dateb+" 00:00:00", loc)
  1384. dateB := inLocation.Unix()
  1385. samplerc := int64(dataBody["samplerc"].(float64))
  1386. concentratenof := dataBody["concentrate_nof"].(string)
  1387. concentrateonog := dataBody["concentrate_nog"].(string)
  1388. dateReportc := dataBody["date_reportc"].(string)
  1389. parseInLocation, _ := time.ParseInLocation(timeLayout+" 15:04:05", dateReportc+" 00:00:00", loc)
  1390. datec := parseInLocation.Unix()
  1391. actualNa := dataBody["actual_na"].(string)
  1392. actualPna := dataBody["actual_pna"].(string)
  1393. actualK := dataBody["actual_k"].(string)
  1394. actualCa := dataBody["actual_ca"].(string)
  1395. actualCi := dataBody["actual_ci"].(string)
  1396. actualHco := dataBody["actual_hco"].(string)
  1397. actualMg := dataBody["actual_mg"].(string)
  1398. actulaPH := dataBody["actual_ph"].(string)
  1399. remakes := dataBody["remakes"].(string)
  1400. detectionUnit := dataBody["detection_unit"].(string)
  1401. sort := dataBody["sort"].(string)
  1402. modifications := int64(dataBody["modifications"].(float64))
  1403. examination := dataBody["pass_examination"].(string)
  1404. pass_examination, _ := strconv.ParseInt(examination, 10, 64)
  1405. ion := models.DeviceIon{
  1406. SamplingDate: dateB,
  1407. Samplerc: samplerc,
  1408. DetectionUnit: detectionUnit,
  1409. ConcentrateNof: concentratenof,
  1410. ConcentrateNog: concentrateonog,
  1411. DateReportc: datec,
  1412. ActualNa: actualNa,
  1413. ActualPna: actualPna,
  1414. ActualK: actualK,
  1415. ActualCa: actualCa,
  1416. ActualCi: actualCi,
  1417. ActualHco: actualHco,
  1418. ActualMg: actualMg,
  1419. ActualPh: actulaPH,
  1420. Remakes: remakes,
  1421. EquitmentId: id,
  1422. Status: 1,
  1423. UserOrgId: orgid,
  1424. Ctime: time.Now().Unix(),
  1425. BedId: addmacher.BedId,
  1426. Bed: addmacher.BedNumber,
  1427. Sort: sort,
  1428. PassExamination: pass_examination,
  1429. Modifications: modifications,
  1430. }
  1431. createIon := service.CreateIon(&ion)
  1432. fmt.Println("报错", createIon)
  1433. if err != nil {
  1434. this.ServeFailJsonSend(enums.ErrorCodeDBDelete, "添加失败:("+err.Error()+")")
  1435. return
  1436. }
  1437. this.ServeSuccessJSON(map[string]interface{}{
  1438. "ion": ion,
  1439. })
  1440. }
  1441. func (this *MachineApiController) GetAllQulityInfo() {
  1442. adminUser := this.GetAdminUserInfo()
  1443. orgID := adminUser.CurrentOrgId
  1444. cultures, err := service.GetAllCulture(orgID)
  1445. dialysate, _ := service.GetAllDialysate(orgID)
  1446. ions, _ := service.GetAllDeviceIon(orgID)
  1447. oxygenates, _ := service.GetAllDeviceOxygenates(orgID)
  1448. water, err := service.GetAllHadWater(orgID)
  1449. deviceWater, err := service.GetDeviceWater(orgID)
  1450. devicePh, err := service.GetDevicePH(orgID)
  1451. if err != nil {
  1452. this.ServeFailJsonSend(enums.ErrorCodeDBDelete, "添加失败:("+err.Error()+")")
  1453. return
  1454. }
  1455. this.ServeSuccessJSON(map[string]interface{}{
  1456. "cultures": cultures,
  1457. "dialysate": dialysate,
  1458. "ions": ions,
  1459. "oxygenates": oxygenates,
  1460. "hadwater": water,
  1461. "deviceWater": deviceWater,
  1462. "devicePh": devicePh,
  1463. })
  1464. }
  1465. func (this *MachineApiController) EditCulture() {
  1466. id, _ := this.GetInt64("id")
  1467. //fmt.Println("id", id)
  1468. userid, _ := this.GetInt64("userid")
  1469. //fmt.Println("userid", userid)
  1470. role, _ := service.GetSampler(userid)
  1471. culture, err := service.GetCultureById(id)
  1472. if err != nil {
  1473. this.ServeFailJsonSend(enums.ErrorCodeDBDelete, "查询失败:("+err.Error()+")")
  1474. return
  1475. }
  1476. this.ServeSuccessJSON(map[string]interface{}{
  1477. "culture": culture,
  1478. "role": role,
  1479. })
  1480. }
  1481. func (this *MachineApiController) UpdateCulture() {
  1482. dataBody := make(map[string]interface{}, 0)
  1483. err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
  1484. id := int64(dataBody["id"].(float64))
  1485. date := dataBody["date"].(string)
  1486. timeLayout := "2006-01-02"
  1487. loc, _ := time.LoadLocation("Local")
  1488. theTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", date+" 00:00:00", loc)
  1489. state_date := theTime.Unix()
  1490. specimen := int64(dataBody["specimen"].(float64))
  1491. cona := dataBody["concentrate_noa"].(string)
  1492. conb := dataBody["concentrate_nob"].(string)
  1493. samplingLoactiona := int64(dataBody["sampling_locationa"].(float64))
  1494. detectionUnit := dataBody["detection_unit"].(string)
  1495. sampler := int64(dataBody["sampler"].(float64))
  1496. reportDate := dataBody["reporting_date"].(string)
  1497. reportTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", reportDate+" 00:00:00", loc)
  1498. repDate := reportTime.Unix()
  1499. detectionResult := dataBody["detection_result"].(string)
  1500. sort := dataBody["sort"].(string)
  1501. pass_examination := int64(dataBody["pass_examination"].(float64))
  1502. modifications := int64(dataBody["modifications"].(float64))
  1503. adminUser := this.GetAdminUserInfo()
  1504. orgId := adminUser.CurrentOrgId
  1505. culture := models.DeviceCulture{
  1506. SpelingDate: state_date,
  1507. Specimen: specimen,
  1508. ConcentrateNoa: cona,
  1509. ConcentrateNob: conb,
  1510. SamplingLocationa: samplingLoactiona,
  1511. DetectionUnit: detectionUnit,
  1512. Sampler: sampler,
  1513. ReportingDate: repDate,
  1514. DetectionResult: detectionResult,
  1515. Sort: sort,
  1516. PassExamination: pass_examination,
  1517. Modifications: modifications,
  1518. }
  1519. err = service.UpdateCulture(id, orgId, &culture)
  1520. if err != nil {
  1521. this.ServeFailJsonSend(enums.ErrorCodeDBDelete, "查询失败:("+err.Error()+")")
  1522. return
  1523. }
  1524. this.ServeSuccessJSON(map[string]interface{}{
  1525. "culture": culture,
  1526. })
  1527. }
  1528. func (this *MachineApiController) DeleteCultrue() {
  1529. adminUserInfo := this.GetAdminUserInfo()
  1530. OrgID := adminUserInfo.CurrentOrgId
  1531. dataBody := make(map[string]interface{}, 0)
  1532. err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
  1533. if err != nil {
  1534. utils.ErrorLog(err.Error())
  1535. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "参数错误")
  1536. return
  1537. }
  1538. idsInters := dataBody["ids"].([]interface{})
  1539. if len(idsInters) == 0 {
  1540. if err != nil {
  1541. this.ServeFailJsonSend(enums.ErrorCodeDBDelete, "删除会员失败:(没有选择会员)")
  1542. return
  1543. }
  1544. }
  1545. ids := make([]int64, 0)
  1546. for _, idsInter := range idsInters {
  1547. id := int64(idsInter.(float64))
  1548. ids = append(ids, id)
  1549. }
  1550. fmt.Println("ids", ids)
  1551. err = service.DeleteCultrue(OrgID, ids)
  1552. fmt.Println("err", err)
  1553. if err != nil {
  1554. this.ServeFailJsonSend(enums.ErrorCodeDBDelete, "删除失败:("+err.Error()+")")
  1555. return
  1556. }
  1557. returnData := make(map[string]interface{}, 0)
  1558. returnData["msg"] = "ok"
  1559. this.ServeSuccessJSON(returnData)
  1560. return
  1561. }
  1562. func (this *MachineApiController) EditDialystate() {
  1563. id, _ := this.GetInt64("id")
  1564. fmt.Println("id是什么", id)
  1565. dialysate, err := service.GetDialystate(id)
  1566. if err != nil {
  1567. this.ServeFailJsonSend(enums.ErrorCodeDBDelete, "查询失败:("+err.Error()+")")
  1568. return
  1569. }
  1570. this.ServeSuccessJSON(map[string]interface{}{
  1571. "dialysate": dialysate,
  1572. })
  1573. }
  1574. func (this *MachineApiController) Updatedialystate() {
  1575. timeLayout := "2006-01-02"
  1576. loc, _ := time.LoadLocation("Local")
  1577. dataBody := make(map[string]interface{}, 0)
  1578. err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
  1579. fmt.Println("err", err)
  1580. id := int64(dataBody["id"].(float64))
  1581. fmt.Println("id", id)
  1582. samplingDate := dataBody["sampling_date"].(string)
  1583. sampdate, _ := time.ParseInLocation(timeLayout+" 15:04:05", samplingDate+" 00:00:00", loc)
  1584. samp_date := sampdate.Unix()
  1585. fmt.Println("取样日期", samp_date)
  1586. specimentb := int64(dataBody["specimenb"].(float64))
  1587. fmt.Println("取样标本", specimentb)
  1588. concentratec := dataBody["concentrate_noc"].(string)
  1589. fmt.Println("A浓缩液批号", concentratec)
  1590. concentraeb := dataBody["concentrateb_nod"].(string)
  1591. fmt.Println("B浓缩", concentraeb)
  1592. samplinglocationb := int64(dataBody["sampling_locationb"].(float64))
  1593. fmt.Println("采样部位", samplinglocationb)
  1594. samplerb := int64(dataBody["samplerb"].(float64))
  1595. fmt.Println("取样者", samplerb)
  1596. reportDateb := dataBody["reporting_dateb"].(string)
  1597. //fmt.Println("日期", reportDateb)
  1598. location, _ := time.ParseInLocation(timeLayout+" 15:04:05", reportDateb+" 00:00:00", loc)
  1599. report_date := location.Unix()
  1600. fmt.Println("出报告2日期", report_date)
  1601. detectionResultb := dataBody["detection_resultb"].(string)
  1602. fmt.Println("检测结果", detectionResultb)
  1603. detectionUnit := dataBody["detection_unit"].(string)
  1604. fmt.Println("检测单位", detectionUnit)
  1605. sort := dataBody["sort"].(string)
  1606. pass_examination := int64(dataBody["pass_examination"].(float64))
  1607. modifications := int64(dataBody["modifications"].(float64))
  1608. adminUser := this.GetAdminUserInfo()
  1609. orgid := adminUser.CurrentOrgId
  1610. dialysate := models.DeviceDialysate{
  1611. SamplingDate: samp_date,
  1612. Specimenb: specimentb,
  1613. ConcentrateNoc: concentratec,
  1614. ConcentratebNod: concentraeb,
  1615. SamplingLocationb: samplinglocationb,
  1616. DetectionUnit: detectionUnit,
  1617. Samplerb: samplerb,
  1618. ReportingDateb: report_date,
  1619. DetectionResultb: detectionResultb,
  1620. Sort: sort,
  1621. PassExamination: pass_examination,
  1622. Modifications: modifications,
  1623. }
  1624. err = service.Updatedialystate(id, orgid, &dialysate)
  1625. if err != nil {
  1626. this.ServeFailJsonSend(enums.ErrorCodeDBDelete, "查询失败:("+err.Error()+")")
  1627. return
  1628. }
  1629. this.ServeSuccessJSON(map[string]interface{}{
  1630. "dialysate": dialysate,
  1631. })
  1632. }
  1633. func (this *MachineApiController) DeleteDialystate() {
  1634. adminUserInfo := this.GetAdminUserInfo()
  1635. OrgID := adminUserInfo.CurrentOrgId
  1636. dataBody := make(map[string]interface{}, 0)
  1637. err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
  1638. if err != nil {
  1639. utils.ErrorLog(err.Error())
  1640. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "参数错误")
  1641. return
  1642. }
  1643. idsInters := dataBody["ids"].([]interface{})
  1644. if len(idsInters) == 0 {
  1645. if err != nil {
  1646. this.ServeFailJsonSend(enums.ErrorCodeDBDelete, "删除会员失败:(没有选择会员)")
  1647. return
  1648. }
  1649. }
  1650. ids := make([]int64, 0)
  1651. for _, idsInter := range idsInters {
  1652. id := int64(idsInter.(float64))
  1653. ids = append(ids, id)
  1654. }
  1655. fmt.Println("ids", ids)
  1656. err = service.DeleteDialystate(OrgID, ids)
  1657. fmt.Println("err", err)
  1658. if err != nil {
  1659. this.ServeFailJsonSend(enums.ErrorCodeDBDelete, "删除失败:("+err.Error()+")")
  1660. return
  1661. }
  1662. returnData := make(map[string]interface{}, 0)
  1663. returnData["msg"] = "ok"
  1664. this.ServeSuccessJSON(returnData)
  1665. return
  1666. }
  1667. func (this *MachineApiController) Edition() {
  1668. id, _ := this.GetInt64("id")
  1669. fmt.Println("id", id)
  1670. ion, err := service.GetIon(id)
  1671. if err != nil {
  1672. this.ServeFailJsonSend(enums.ErrorCodeDBDelete, "查询失败:("+err.Error()+")")
  1673. return
  1674. }
  1675. this.ServeSuccessJSON(map[string]interface{}{
  1676. "ion": ion,
  1677. })
  1678. }
  1679. func (this *MachineApiController) UpdateIon() {
  1680. timeLayout := "2006-01-02"
  1681. loc, _ := time.LoadLocation("Local")
  1682. dataBody := make(map[string]interface{}, 0)
  1683. err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
  1684. fmt.Println("err", err)
  1685. id := int64(dataBody["id"].(float64))
  1686. fmt.Println("id", id)
  1687. dateb := dataBody["dateb"].(string)
  1688. inLocation, _ := time.ParseInLocation(timeLayout+" 15:04:05", dateb+" 00:00:00", loc)
  1689. dateB := inLocation.Unix()
  1690. samplerc := int64(dataBody["samplerc"].(float64))
  1691. concentratenof := dataBody["concentrate_nof"].(string)
  1692. concentrateonog := dataBody["concentrate_nog"].(string)
  1693. dateReportc := dataBody["date_reportc"].(string)
  1694. parseInLocation, _ := time.ParseInLocation(timeLayout+" 15:04:05", dateReportc+" 00:00:00", loc)
  1695. datec := parseInLocation.Unix()
  1696. actualNa := dataBody["actual_na"].(string)
  1697. actualPna := dataBody["actual_pna"].(string)
  1698. actualK := dataBody["actual_k"].(string)
  1699. actualCa := dataBody["actual_ca"].(string)
  1700. actualCi := dataBody["actual_ci"].(string)
  1701. actualHco := dataBody["actual_hco"].(string)
  1702. actualMg := dataBody["actual_mg"].(string)
  1703. actulaPH := dataBody["actual_ph"].(string)
  1704. remakes := dataBody["remakes"].(string)
  1705. detectionUnit := dataBody["detection_unit"].(string)
  1706. sort := dataBody["sort"].(string)
  1707. pass_examination := int64(dataBody["pass_examination"].(float64))
  1708. modifications := int64(dataBody["modifications"].(float64))
  1709. ion := models.DeviceIon{
  1710. SamplingDate: dateB,
  1711. Samplerc: samplerc,
  1712. DetectionUnit: detectionUnit,
  1713. ConcentrateNof: concentratenof,
  1714. ConcentrateNog: concentrateonog,
  1715. DateReportc: datec,
  1716. ActualNa: actualNa,
  1717. ActualPna: actualPna,
  1718. ActualK: actualK,
  1719. ActualCa: actualCa,
  1720. ActualCi: actualCi,
  1721. ActualHco: actualHco,
  1722. ActualMg: actualMg,
  1723. ActualPh: actulaPH,
  1724. Remakes: remakes,
  1725. Sort: sort,
  1726. PassExamination: pass_examination,
  1727. Modifications: modifications,
  1728. }
  1729. adminUser := this.GetAdminUserInfo()
  1730. orgId := adminUser.CurrentOrgId
  1731. err = service.UpdateIon(id, orgId, &ion)
  1732. if err != nil {
  1733. this.ServeFailJsonSend(enums.ErrorCodeDBDelete, "查询失败:("+err.Error()+")")
  1734. return
  1735. }
  1736. this.ServeSuccessJSON(map[string]interface{}{
  1737. "ion": ion,
  1738. })
  1739. }
  1740. func (this *MachineApiController) DeleteIon() {
  1741. adminUserInfo := this.GetAdminUserInfo()
  1742. OrgID := adminUserInfo.CurrentOrgId
  1743. dataBody := make(map[string]interface{}, 0)
  1744. err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
  1745. if err != nil {
  1746. utils.ErrorLog(err.Error())
  1747. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "参数错误")
  1748. return
  1749. }
  1750. idsInters := dataBody["ids"].([]interface{})
  1751. if len(idsInters) == 0 {
  1752. if err != nil {
  1753. this.ServeFailJsonSend(enums.ErrorCodeDBDelete, "删除会员失败:(没有选择会员)")
  1754. return
  1755. }
  1756. }
  1757. ids := make([]int64, 0)
  1758. for _, idsInter := range idsInters {
  1759. id := int64(idsInter.(float64))
  1760. ids = append(ids, id)
  1761. }
  1762. fmt.Println("ids", ids)
  1763. err = service.DeleteIon(OrgID, ids)
  1764. if err != nil {
  1765. this.ServeFailJsonSend(enums.ErrorCodeDBDelete, "删除失败:("+err.Error()+")")
  1766. return
  1767. }
  1768. returnData := make(map[string]interface{}, 0)
  1769. returnData["msg"] = "ok"
  1770. this.ServeSuccessJSON(returnData)
  1771. return
  1772. }
  1773. func (this *MachineApiController) GetQuery() {
  1774. timeLayout := "2006-01-02"
  1775. loc, _ := time.LoadLocation("Local")
  1776. adminUserInfo := this.GetAdminUserInfo()
  1777. OrgID := adminUserInfo.CurrentOrgId
  1778. fmt.Println("orgid", OrgID)
  1779. bedid, _ := this.GetInt64("bedid")
  1780. fmt.Println("bedid", bedid)
  1781. startime := this.GetString("startime")
  1782. fmt.Println("starttime", startime)
  1783. inLocation, _ := time.ParseInLocation(timeLayout+" 15:04:05", startime+" 00:00:00", loc)
  1784. start := inLocation.Unix()
  1785. fmt.Println("start", start)
  1786. endtime := this.GetString("endtime")
  1787. fmt.Println("endtime", endtime)
  1788. endLocation, _ := time.ParseInLocation(timeLayout+" 15:04:05", endtime+" 00:00:00", loc)
  1789. end := endLocation.Unix()
  1790. fmt.Println("end", end)
  1791. cultures, err := service.GetCultureData(bedid, start, end, OrgID)
  1792. fmt.Print(err)
  1793. dialysate, err := service.GetDialysateData(bedid, start, end, OrgID)
  1794. ions, err := service.GetDeviceIonData(bedid, start, end, OrgID)
  1795. oxygenates, err := service.GetOxygenates(bedid, start, end, OrgID)
  1796. hadwater, err := service.GetHardWater(bedid, start, end, OrgID)
  1797. water, err := service.GetWater(bedid, start, end, OrgID)
  1798. deviceph, err := service.GetDevicePh(bedid, start, end, OrgID)
  1799. if err != nil {
  1800. this.ServeFailJsonSend(enums.ErrorCodeDBDelete, "查询失败:("+err.Error()+")")
  1801. return
  1802. }
  1803. this.ServeSuccessJSON(map[string]interface{}{
  1804. "cultures": cultures,
  1805. "dialysate": dialysate,
  1806. "ions": ions,
  1807. "oxygenates": oxygenates,
  1808. "hadwater": hadwater,
  1809. "water": water,
  1810. "deviceph": deviceph,
  1811. })
  1812. }
  1813. func (this *MachineApiController) SaveRepair() {
  1814. timeLayout := "2006-01-02"
  1815. loc, _ := time.LoadLocation("Local")
  1816. adminUserInfo := this.GetAdminUserInfo()
  1817. id, _ := this.GetInt64("id")
  1818. fmt.Println("id", id)
  1819. addmacher, _ := service.GetBedId(id)
  1820. OrgID := adminUserInfo.CurrentOrgId
  1821. fmt.Println("orgid", OrgID)
  1822. dataBody := make(map[string]interface{}, 0)
  1823. err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
  1824. fmt.Println("err", err)
  1825. gua_date := dataBody["guarantee_date"].(string)
  1826. fmt.Println("保修日期", gua_date)
  1827. inLocation, _ := time.ParseInLocation(timeLayout+" 15:04:05", gua_date+" 00:00:00", loc)
  1828. guaDate := inLocation.Unix()
  1829. fmt.Println("保修日期", guaDate)
  1830. startDateStr := dataBody["start_time"].(string)
  1831. fmt.Println("出发时间", startDateStr)
  1832. startDate, _ := utils.ParseTimeStringToTime("2006-01-02 15:04", startDateStr)
  1833. fmt.Println("触发事件", startDate.Unix())
  1834. arriveDateStr := dataBody["arrive_time"].(string)
  1835. fmt.Println("到达时间", arriveDateStr)
  1836. arriveDate, _ := utils.ParseTimeStringToTime("2006-01-02 15:04", arriveDateStr)
  1837. fmt.Println("到达时间", arriveDate.Unix())
  1838. finishDateStr := dataBody["finish_time"].(string)
  1839. fmt.Println("完成时间", finishDateStr)
  1840. finishDate, _ := utils.ParseTimeStringToTime("2006-01-02 15:04", finishDateStr)
  1841. fmt.Println("完成时间", finishDate.Unix())
  1842. totaldistance := dataBody["total_distance"].(string)
  1843. fmt.Println("总公里输", totaldistance)
  1844. failurestate := int64(dataBody["failure_stage"].(float64))
  1845. fmt.Println("故事范式阶段", failurestate)
  1846. codeInformation := dataBody["code_information"].(string)
  1847. fmt.Println("故事提示信息及代码", codeInformation)
  1848. faultdescription := dataBody["fault_description"].(string)
  1849. fmt.Println("故障描述", faultdescription)
  1850. causeAnalysis := dataBody["cause_analysis"].(string)
  1851. fmt.Println("原因分析", causeAnalysis)
  1852. treatmentprocess := dataBody["treatment_process"].(string)
  1853. fmt.Println("处理过程", treatmentprocess)
  1854. images := dataBody["images"].(string)
  1855. fmt.Println("上传图片", images)
  1856. exclude := int64(dataBody["exclude"].(float64))
  1857. fmt.Println("故障是否排除", exclude)
  1858. reason := dataBody["reason"].(string)
  1859. fmt.Println("原因", reason)
  1860. imageName := dataBody["imageName"].(string)
  1861. repair := models.DeviceRepair{
  1862. BedId: addmacher.BedId,
  1863. EquitmentId: id,
  1864. GuaranteeDate: guaDate,
  1865. StartTime: startDate.Unix(),
  1866. ArriveTime: arriveDate.Unix(),
  1867. FinishTime: finishDate.Unix(),
  1868. TotalDistance: totaldistance,
  1869. FailureStage: failurestate,
  1870. FaultDescription: faultdescription,
  1871. CauseAnalysis: causeAnalysis,
  1872. TreatmentProcess: treatmentprocess,
  1873. Images: images,
  1874. Exclude: exclude,
  1875. Reason: reason,
  1876. Status: 1,
  1877. UserOrgId: OrgID,
  1878. Ctime: time.Now().Unix(),
  1879. CodeInformation: codeInformation,
  1880. ImageName: imageName,
  1881. }
  1882. err = service.CreateRepair(&repair)
  1883. if err != nil {
  1884. this.ServeFailJsonSend(enums.ErrorCodeDBDelete, "查询失败:("+err.Error()+")")
  1885. return
  1886. }
  1887. this.ServeSuccessJSON(map[string]interface{}{
  1888. "repair": repair,
  1889. })
  1890. }
  1891. func (this *MachineApiController) GetAllRepair() {
  1892. limit, _ := this.GetInt64("limit")
  1893. page, _ := this.GetInt64("page")
  1894. adminUser := this.GetAdminUserInfo()
  1895. orgID := adminUser.CurrentOrgId
  1896. repair, total, err := service.GetAllRepair(orgID, limit, page)
  1897. if err != nil {
  1898. this.ServeFailJsonSend(enums.ErrorCodeDBDelete, "查询失败:("+err.Error()+")")
  1899. return
  1900. }
  1901. this.ServeSuccessJSON(map[string]interface{}{
  1902. "repair": repair,
  1903. "total": total,
  1904. })
  1905. }
  1906. func (this *MachineApiController) EditRepair() {
  1907. id, _ := this.GetInt64("id")
  1908. fmt.Println("id", id)
  1909. repair, err := service.EditRepair(id)
  1910. if err != nil {
  1911. this.ServeFailJsonSend(enums.ErrorCodeDBDelete, "查询失败:("+err.Error()+")")
  1912. return
  1913. }
  1914. this.ServeSuccessJSON(map[string]interface{}{
  1915. "repair": repair,
  1916. })
  1917. }
  1918. func (this *MachineApiController) UpdateRepair() {
  1919. timeLayout := "2006-01-02"
  1920. loc, _ := time.LoadLocation("Local")
  1921. adminUserInfo := this.GetAdminUserInfo()
  1922. OrgID := adminUserInfo.CurrentOrgId
  1923. fmt.Println("orgid", OrgID)
  1924. dataBody := make(map[string]interface{}, 0)
  1925. err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
  1926. fmt.Println("err", err)
  1927. id := int64(dataBody["id"].(float64))
  1928. gua_date := dataBody["guarantee_date"].(string)
  1929. fmt.Println("保修日期", gua_date)
  1930. inLocation, _ := time.ParseInLocation(timeLayout+" 15:04:05", gua_date+" 00:00:00", loc)
  1931. guaDate := inLocation.Unix()
  1932. fmt.Println("保修日期", guaDate)
  1933. startDateStr := dataBody["start_time"].(string)
  1934. fmt.Println("出发时间", startDateStr)
  1935. startDate, _ := utils.ParseTimeStringToTime("2006-01-02 15:04", startDateStr)
  1936. fmt.Println("触发事件", startDate.Unix())
  1937. arriveDateStr := dataBody["arrive_time"].(string)
  1938. fmt.Println("到达时间", arriveDateStr)
  1939. arriveDate, _ := utils.ParseTimeStringToTime("2006-01-02 15:04", arriveDateStr)
  1940. fmt.Println("到达时间", arriveDate.Unix())
  1941. finishDateStr := dataBody["finish_time"].(string)
  1942. fmt.Println("完成时间", finishDateStr)
  1943. finishDate, _ := utils.ParseTimeStringToTime("2006-01-02 15:04", finishDateStr)
  1944. fmt.Println("完成时间", finishDate.Unix())
  1945. totaldistance := dataBody["total_distance"].(string)
  1946. fmt.Println("总公里输", totaldistance)
  1947. failurestate := int64(dataBody["failure_stage"].(float64))
  1948. fmt.Println("故事范式阶段", failurestate)
  1949. codeInformation := dataBody["code_information"].(string)
  1950. fmt.Println("故事提示信息及代码", codeInformation)
  1951. faultdescription := dataBody["fault_description"].(string)
  1952. fmt.Println("故障描述", faultdescription)
  1953. causeAnalysis := dataBody["cause_analysis"].(string)
  1954. fmt.Println("原因分析", causeAnalysis)
  1955. treatmentprocess := dataBody["treatment_process"].(string)
  1956. fmt.Println("处理过程", treatmentprocess)
  1957. images := dataBody["images"].(string)
  1958. fmt.Println("上传图片", images)
  1959. exclude := int64(dataBody["exclude"].(float64))
  1960. fmt.Println("故障是否排除", exclude)
  1961. reason := dataBody["reason"].(string)
  1962. fmt.Println("原因", reason)
  1963. imageName := dataBody["image_name"].(string)
  1964. deviceRepair := models.DeviceRepair{
  1965. GuaranteeDate: guaDate,
  1966. StartTime: startDate.Unix(),
  1967. ArriveTime: arriveDate.Unix(),
  1968. FinishTime: finishDate.Unix(),
  1969. TotalDistance: totaldistance,
  1970. FailureStage: failurestate,
  1971. FaultDescription: faultdescription,
  1972. CauseAnalysis: causeAnalysis,
  1973. TreatmentProcess: treatmentprocess,
  1974. Images: images,
  1975. Exclude: exclude,
  1976. Reason: reason,
  1977. CodeInformation: codeInformation,
  1978. ImageName: imageName,
  1979. }
  1980. err = service.UpdateRepair(id, OrgID, &deviceRepair)
  1981. if err != nil {
  1982. this.ServeFailJsonSend(enums.ErrorCodeDBDelete, "查询失败:("+err.Error()+")")
  1983. return
  1984. }
  1985. this.ServeSuccessJSON(map[string]interface{}{
  1986. "repair": deviceRepair,
  1987. })
  1988. }
  1989. func (this *MachineApiController) DeleteRepair() {
  1990. adminUserInfo := this.GetAdminUserInfo()
  1991. OrgID := adminUserInfo.CurrentOrgId
  1992. dataBody := make(map[string]interface{}, 0)
  1993. err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
  1994. if err != nil {
  1995. utils.ErrorLog(err.Error())
  1996. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "参数错误")
  1997. return
  1998. }
  1999. idsInters := dataBody["ids"].([]interface{})
  2000. if len(idsInters) == 0 {
  2001. if err != nil {
  2002. this.ServeFailJsonSend(enums.ErrorCodeDBDelete, "删除会员失败:(没有选择会员)")
  2003. return
  2004. }
  2005. }
  2006. ids := make([]int64, 0)
  2007. for _, idsInter := range idsInters {
  2008. id := int64(idsInter.(float64))
  2009. ids = append(ids, id)
  2010. }
  2011. fmt.Println("ids", ids)
  2012. err = service.DeleteRepair(OrgID, ids)
  2013. if err != nil {
  2014. this.ServeFailJsonSend(enums.ErrorCodeDBDelete, "删除失败:("+err.Error()+")")
  2015. return
  2016. }
  2017. returnData := make(map[string]interface{}, 0)
  2018. returnData["msg"] = "ok"
  2019. this.ServeSuccessJSON(returnData)
  2020. return
  2021. }
  2022. func (this *MachineApiController) GetRepair() {
  2023. timeLayout := "2006-01-02"
  2024. loc, _ := time.LoadLocation("Local")
  2025. adminUserInfo := this.GetAdminUserInfo()
  2026. OrgID := adminUserInfo.CurrentOrgId
  2027. fmt.Println("orgid", OrgID)
  2028. bedid, _ := this.GetInt64("bedid")
  2029. fmt.Println("bedid", bedid)
  2030. startime := this.GetString("startime")
  2031. fmt.Println("starttime", startime)
  2032. inLocation, _ := time.ParseInLocation(timeLayout+" 15:04:05", startime+" 00:00:00", loc)
  2033. start := inLocation.Unix()
  2034. fmt.Println("start", start)
  2035. endtime := this.GetString("endtime")
  2036. fmt.Println("endtime", endtime)
  2037. endLocation, _ := time.ParseInLocation(timeLayout+" 15:04:05", endtime+" 00:00:00", loc)
  2038. end := endLocation.Unix()
  2039. fmt.Println("end", end)
  2040. repair, err := service.GetRepair(bedid, start, end, OrgID)
  2041. if err != nil {
  2042. this.ServeFailJsonSend(enums.ErrorCodeDBDelete, "查询失败:("+err.Error()+")")
  2043. return
  2044. }
  2045. this.ServeSuccessJSON(map[string]interface{}{
  2046. "repair": repair,
  2047. })
  2048. }
  2049. func (this *MachineApiController) EditUser() {
  2050. adminUser := this.GetAdminUserInfo()
  2051. orgId := adminUser.CurrentOrgId
  2052. id, _ := this.GetInt64("id")
  2053. fmt.Println("id", id)
  2054. patientid, _ := this.GetInt64("patientid")
  2055. device, err := service.GetUserInformation(id)
  2056. //获取初次使用记录
  2057. macher, err := service.GetUserTotalByMacher(device.EquimentId)
  2058. count, err := service.GetUserTotalCount(orgId, device.BedNumber)
  2059. patients, err := service.GetPatientInfoMation(patientid)
  2060. if err != nil {
  2061. this.ServeFailJsonSend(enums.ErrorCodeDBDelete, "查询失败:("+err.Error()+")")
  2062. return
  2063. }
  2064. this.ServeSuccessJSON(map[string]interface{}{
  2065. "device": device,
  2066. "patients": patients,
  2067. "count": count,
  2068. "macher": macher,
  2069. })
  2070. }
  2071. func (this *MachineApiController) DeleteForm() {
  2072. adminUserInfo := this.GetAdminUserInfo()
  2073. OrgID := adminUserInfo.CurrentOrgId
  2074. dataBody := make(map[string]interface{}, 0)
  2075. err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
  2076. if err != nil {
  2077. utils.ErrorLog(err.Error())
  2078. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "参数错误")
  2079. return
  2080. }
  2081. idsInters := dataBody["ids"].([]interface{})
  2082. if len(idsInters) == 0 {
  2083. if err != nil {
  2084. this.ServeFailJsonSend(enums.ErrorCodeDBDelete, "删除会员失败:(没有选择会员)")
  2085. return
  2086. }
  2087. }
  2088. ids := make([]int64, 0)
  2089. for _, idsInter := range idsInters {
  2090. id := int64(idsInter.(float64))
  2091. ids = append(ids, id)
  2092. }
  2093. fmt.Println("ids", ids)
  2094. err = service.DeleteForm(OrgID, ids)
  2095. if err != nil {
  2096. this.ServeFailJsonSend(enums.ErrorCodeDBDelete, "删除失败:("+err.Error()+")")
  2097. return
  2098. }
  2099. returnData := make(map[string]interface{}, 0)
  2100. returnData["msg"] = "ok"
  2101. this.ServeSuccessJSON(returnData)
  2102. return
  2103. }
  2104. func (this *MachineApiController) UpdateForm() {
  2105. dataBody := make(map[string]interface{}, 0)
  2106. err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
  2107. fmt.Println("错误是", err)
  2108. adminUserInfo := this.GetAdminUserInfo()
  2109. orgid := adminUserInfo.CurrentOrgId
  2110. date := dataBody["spling_date"].(string)
  2111. timeLayout := "2006-01-02"
  2112. loc, _ := time.LoadLocation("Local")
  2113. theTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", date+" 00:00:00", loc)
  2114. startdate := theTime.Unix()
  2115. fmt.Println("日期", startdate)
  2116. id := int64(dataBody["id"].(float64))
  2117. fmt.Println("id", id)
  2118. classtype := int64(dataBody["classtype"].(float64))
  2119. fmt.Println("班次", classtype)
  2120. zone := int64(dataBody["zone"].(float64))
  2121. fmt.Println("分区", zone)
  2122. bednumber := int64(dataBody["bed_number"].(float64))
  2123. fmt.Println("床位号", bednumber)
  2124. number, _ := service.GetNumbers(bednumber, orgid)
  2125. patient_id := int64(dataBody["patient_id"].(float64))
  2126. fmt.Println("患者", patient_id)
  2127. contagion := dataBody["contagion"].(string)
  2128. fmt.Println("传染病", contagion)
  2129. dialysis_mode := int64(dataBody["dialysis_mode"].(float64))
  2130. fmt.Println("透析方式", dialysis_mode)
  2131. startDateStr := dataBody["start_time"].(string)
  2132. fmt.Println("上机时间", startDateStr)
  2133. startDate, _ := utils.ParseTimeStringToTime("2006-01-02 15:04", startDateStr)
  2134. fmt.Println("上机时间", startDate.Unix())
  2135. endDateStr := dataBody["end_time"].(string)
  2136. fmt.Println("上机时间", startDateStr)
  2137. endDate, _ := utils.ParseTimeStringToTime("2006-01-02 15:04", endDateStr)
  2138. fmt.Println("上机时间", endDate.Unix())
  2139. dialysis_time := dataBody["dialysis_time"].(string)
  2140. fmt.Println("透析时长", dialysis_time)
  2141. hyperfiletration := dataBody["hyperfiltratio"].(float64)
  2142. fmt.Println("实际超滤量", hyperfiletration)
  2143. weight_loss := dataBody["weight_loss"].(float64)
  2144. fmt.Println("体重减少", weight_loss)
  2145. warining_value := dataBody["warning_value"].(string)
  2146. fmt.Println("预警值", warining_value)
  2147. //user_total := int64(dataBody["user_total"].(float64))
  2148. user_total := dataBody["user_total"].(string)
  2149. fmt.Println("使用次数", user_total)
  2150. run := int64(dataBody["run"].(float64))
  2151. fmt.Println("运行", run)
  2152. failure_stage := int64(dataBody["failure_stage"].(float64))
  2153. fmt.Println("故事发生阶段", failure_stage)
  2154. falult_desciription := dataBody["fault_description"].(string)
  2155. fmt.Println("故障描述", falult_desciription)
  2156. code_information := dataBody["code_information"].(string)
  2157. fmt.Println("故障提示及代码", code_information)
  2158. //机器消毒
  2159. disinfect_type := int64(dataBody["disinfect_type"].(float64))
  2160. fmt.Println("消毒方式", disinfect_type)
  2161. disinfectant_type := int64(dataBody["disinfectant_type"].(float64))
  2162. fmt.Println("消毒液", disinfectant_type)
  2163. disinfection := int64(dataBody["disinfection"].(float64))
  2164. fmt.Println("消毒状态", disinfection)
  2165. machine_run := int64(dataBody["machine_run"].(float64))
  2166. fmt.Println("运行", machine_run)
  2167. //液路
  2168. fluid_path := int64(dataBody["fluid_path"].(float64))
  2169. fmt.Println("液路消毒方式", fluid_path)
  2170. disinfectant := int64(dataBody["disinfectant"].(float64))
  2171. fmt.Println("消毒液", disinfectant)
  2172. disinfection_status := int64(dataBody["disinfection_status"].(float64))
  2173. fmt.Println("消毒状态", disinfection_status)
  2174. disinfection_residue := int64(dataBody["disinfection_residue"].(float64))
  2175. fmt.Println("消毒液残留", disinfection_residue)
  2176. longtime := dataBody["longtime"].(string)
  2177. fmt.Println("消毒时长", longtime)
  2178. starttime := dataBody["starttime"].(string)
  2179. disstarttime, _ := utils.ParseTimeStringToTime("2006-01-02 15:04", starttime)
  2180. distartime := disstarttime.Unix()
  2181. if distartime < 0 {
  2182. distartime = 0
  2183. }
  2184. //fmt.Println("开始消毒时间====", distartime)
  2185. entime := dataBody["endtime"].(string)
  2186. disendtime, _ := utils.ParseTimeStringToTime("2006-01-02 15:04", entime)
  2187. diendtime := disendtime.Unix()
  2188. fmt.Println("结束消毒时间", diendtime)
  2189. if diendtime < 0 {
  2190. diendtime = 0
  2191. }
  2192. dialysis_checked := int64(dataBody["dialysis_checked"].(float64))
  2193. //fmt.Println("更换", dialysis_checked)
  2194. dialysis_name := int64(dataBody["dialysis_name"].(float64))
  2195. fmt.Println("名称", dialysis_name)
  2196. norms := dataBody["norms"].(string)
  2197. fmt.Println("规格", norms)
  2198. dialysis_concentration := int64(dataBody["dialysis_concentration"].(float64))
  2199. fmt.Println("浓度", dialysis_concentration)
  2200. germ_checked := int64(dataBody["germ_checked"].(float64))
  2201. fmt.Println("更换", germ_checked)
  2202. germ_name := int64(dataBody["germ_name"].(float64))
  2203. fmt.Println("名称", germ_name)
  2204. //germ_number := int64(dataBody["germ_number"].(float64))
  2205. germ_number := dataBody["germ_number"].(string)
  2206. fmt.Println("数量", germ_number)
  2207. clean := int64(dataBody["clean"].(float64))
  2208. fmt.Println("清洁", clean)
  2209. sign_name := int64(dataBody["sign_name"].(float64))
  2210. fmt.Println("签名", sign_name)
  2211. equitment_id := int64(dataBody["equiment_id"].(float64))
  2212. fmt.Println("设备ID", equitment_id)
  2213. addmacher := models.DeviceAddmacher{
  2214. BedId: bednumber,
  2215. }
  2216. //更新床位号
  2217. err = service.UpdateAddMacherBedID(equitment_id, orgid, &addmacher)
  2218. fmt.Println("更新设备失败", err)
  2219. //更新区号
  2220. deviceNumber := models.DeviceNumber{
  2221. ZoneID: zone,
  2222. }
  2223. err = service.UpdatedZoneID(bednumber, orgid, &deviceNumber)
  2224. fmt.Println("更新区号失败", err)
  2225. information := models.DeviceInformation{
  2226. Date: startdate,
  2227. Class: classtype,
  2228. Zone: zone,
  2229. BedNumber: bednumber,
  2230. Contagion: contagion,
  2231. DialysisMode: dialysis_mode,
  2232. StartTime: startDate.Unix(),
  2233. EndTime: endDate.Unix(),
  2234. DialysisHour: dialysis_time,
  2235. Hyperfiltratio: hyperfiletration,
  2236. WeightLoss: weight_loss,
  2237. WarningValue: warining_value,
  2238. UserTotal: user_total,
  2239. Move: run,
  2240. FailureStage: failure_stage,
  2241. FaultDescription: falult_desciription,
  2242. CodeInformation: code_information,
  2243. DisinfectantType: disinfectant_type,
  2244. DisinfectType: disinfect_type,
  2245. Disinfection: disinfection,
  2246. MachineRun: machine_run,
  2247. FluidPath: fluid_path,
  2248. Disinfectant: disinfectant,
  2249. DisinfectionStatus: disinfection_status,
  2250. DisinfectionResidue: disinfection_residue,
  2251. LongTime: longtime,
  2252. DisinfecStartime: distartime,
  2253. DisinfecEndtime: diendtime,
  2254. DialysisChecked: dialysis_checked,
  2255. DialysisName: dialysis_name,
  2256. Norms: norms,
  2257. DialysisConcentration: dialysis_concentration,
  2258. GermChecked: germ_checked,
  2259. GermName: germ_name,
  2260. GermNumber: germ_number,
  2261. Clean: clean,
  2262. SignName: sign_name,
  2263. Ctime: time.Now().Unix(),
  2264. Status: 1,
  2265. UserOrgId: orgid,
  2266. EquimentId: id,
  2267. Bed: number.Number,
  2268. PatientId: patient_id,
  2269. }
  2270. err = service.UpadateForm(id, orgid, &information)
  2271. fmt.Println("报错", err)
  2272. if err != nil {
  2273. this.ServeFailJsonSend(enums.ErrorCodeDBDelete, "修改失败:("+err.Error()+")")
  2274. return
  2275. }
  2276. this.ServeSuccessJSON(map[string]interface{}{
  2277. "information": information,
  2278. })
  2279. }
  2280. func (this *MachineApiController) QueryInfo() {
  2281. zone, _ := this.GetInt64("zone")
  2282. fmt.Println("zone", zone)
  2283. //bed, _ := this.GetInt64("bed")
  2284. //fmt.Println("bed", bed)
  2285. bed, _ := this.GetInt64("bed")
  2286. startime := this.GetString("startime")
  2287. timeLayout := "2006-01-02"
  2288. loc, _ := time.LoadLocation("Local")
  2289. theTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", startime+" 00:00:00", loc)
  2290. startdate := theTime.Unix()
  2291. fmt.Println("开始时间", startdate)
  2292. endtime := this.GetString("endtime")
  2293. theTimes, _ := time.ParseInLocation(timeLayout+" 15:04:05", endtime+" 00:00:00", loc)
  2294. endtimes := theTimes.Unix()
  2295. fmt.Println("结束", endtimes)
  2296. limit, _ := this.GetInt64("limit")
  2297. fmt.Println("limit", limit)
  2298. page, _ := this.GetInt64("page")
  2299. fmt.Println("page", page)
  2300. adminUser := this.GetAdminUserInfo()
  2301. orgId := adminUser.CurrentOrgId
  2302. infor, total, err := service.QueryInfo(bed, startdate, endtimes, orgId, limit, page)
  2303. if err != nil {
  2304. this.ServeFailJsonSend(enums.ErrorCodeDBDelete, "查询:("+err.Error()+")")
  2305. return
  2306. }
  2307. this.ServeSuccessJSON(map[string]interface{}{
  2308. "infor": infor,
  2309. "total": total,
  2310. })
  2311. }
  2312. func (this *MachineApiController) InsertAutoData() {
  2313. id, _ := this.GetInt64("id")
  2314. addmacher, _ := service.GetBedId(id)
  2315. fmt.Println("床位号", addmacher.BedId)
  2316. adminUser := this.GetAdminUserInfo()
  2317. timeStr := time.Now().Format("2006-01-02")
  2318. timeLayout := "2006-01-02 15:04:05"
  2319. fmt.Println("timeStr:", timeStr)
  2320. timeStringToTime, _ := utils.ParseTimeStringToTime(timeLayout, timeStr+" 00:00:00")
  2321. timenow := timeStringToTime.Unix()
  2322. fmt.Println("timenow是什么", timenow)
  2323. orgId := adminUser.CurrentOrgId
  2324. dialysis, err := service.GetPatientID(id, orgId, timenow)
  2325. if err != nil {
  2326. this.ServeFailJsonSend(enums.ErrorCodeDBDelete, "查询:("+err.Error()+")")
  2327. return
  2328. }
  2329. this.ServeSuccessJSON(map[string]interface{}{
  2330. "dialysis": dialysis,
  2331. })
  2332. }
  2333. func (this *MachineApiController) GetAllEquitType() {
  2334. adminUserInfo := this.GetAdminUserInfo()
  2335. orgID := adminUserInfo.CurrentOrgId
  2336. fmt.Println("orgId", orgID)
  2337. //equitname, err := service.GetAllEquitType(orgID)
  2338. //name, err := service.GetAllEquitName(orgID)
  2339. mode, err := service.GetAllMode(orgID)
  2340. fmt.Print(err)
  2341. if err != nil {
  2342. this.ServeFailJsonSend(enums.ErrorCodeDBDelete, "查询:("+err.Error()+")")
  2343. return
  2344. }
  2345. this.ServeSuccessJSON(map[string]interface{}{
  2346. "mode": mode,
  2347. })
  2348. }
  2349. func (this *MachineApiController) GetUserForm() {
  2350. id, _ := this.GetInt64("id")
  2351. fmt.Println("id是什么", id)
  2352. limit, _ := this.GetInt64("limit")
  2353. fmt.Println("limit", limit)
  2354. page, _ := this.GetInt64("page")
  2355. fmt.Println("page", page)
  2356. adminUserInfo := this.GetAdminUserInfo()
  2357. orgID := adminUserInfo.CurrentOrgId
  2358. fmt.Println("orgId", orgID)
  2359. information, total, err := service.GetUserForm(id, orgID, limit, page)
  2360. fmt.Print("information", information)
  2361. fmt.Println("错误", err)
  2362. addmacher, _ := service.GetBedNumber(id, orgID)
  2363. fmt.Println("addmacher", addmacher)
  2364. if err != nil {
  2365. this.ServeFailJsonSend(enums.ErrorCodeDBDelete, "查询:("+err.Error()+")")
  2366. return
  2367. }
  2368. this.ServeSuccessJSON(map[string]interface{}{
  2369. "information": information,
  2370. "total": total,
  2371. "addmacher": addmacher,
  2372. })
  2373. }
  2374. func (this *MachineApiController) GetBedForm() {
  2375. adminUser := this.GetAdminUserInfo()
  2376. orgId := adminUser.CurrentOrgId
  2377. id, _ := this.GetInt64("id")
  2378. fmt.Println("id", id)
  2379. addmacher, err := service.GetZoneForm(id)
  2380. bed, err := service.GetZoneId(addmacher.BedId, orgId)
  2381. fmt.Println("bed--------------------", bed.ZoneID)
  2382. number, err := service.GetBedForm(bed.ZoneID)
  2383. if err != nil {
  2384. this.ServeFailJsonSend(enums.ErrorCodeDBDelete, "查询:("+err.Error()+")")
  2385. return
  2386. }
  2387. this.ServeSuccessJSON(map[string]interface{}{
  2388. "addmacher": addmacher,
  2389. "number": number,
  2390. })
  2391. }
  2392. func (this *MachineApiController) GetTotalCount() {
  2393. info := this.GetAdminUserInfo()
  2394. orgid := info.CurrentOrgId
  2395. _, total, err := service.GetTotalCount(orgid)
  2396. fmt.Print("------------------------------声优", err)
  2397. if err != nil {
  2398. this.ServeFailJsonSend(enums.ErrorCodeDBDelete, "查询:("+err.Error()+")")
  2399. return
  2400. }
  2401. this.ServeSuccessJSON(map[string]interface{}{
  2402. "total": total,
  2403. })
  2404. }
  2405. func (this *MachineApiController) GetTotalNumber() {
  2406. id, _ := this.GetInt64("id")
  2407. fmt.Println("id", id)
  2408. info := this.GetAdminUserInfo()
  2409. orgId := info.CurrentOrgId
  2410. total, _ := service.GetTotalNumber(id, orgId)
  2411. //fmt.Println("total",total)
  2412. //fmt.Println("====================真的",err)
  2413. //if err != nil {
  2414. // this.ServeFailJsonSend(enums.ErrorCodeDBDelete, "查询:("+err.Error()+")")
  2415. // return
  2416. //}
  2417. this.ServeSuccessJSON(map[string]interface{}{
  2418. "total": total,
  2419. })
  2420. }
  2421. func (this *MachineApiController) GetTimeWarning() {
  2422. id, _ := this.GetInt64("id")
  2423. fmt.Println("设备id", id)
  2424. adminUserInfo := this.GetAdminUserInfo()
  2425. orgId := adminUserInfo.CurrentOrgId
  2426. //获取透析机消毒液更换的最后一次更换日期
  2427. information, err := service.GetTimeWarning(id, orgId)
  2428. //获取透析机消毒液细菌过滤器的最后一次更换日期
  2429. deviceInformation, err := service.GetTimeLast(id, orgId)
  2430. //获取空气滤网清洁最后一次更换日期
  2431. clean, err := service.GetTimeLastData(id, orgId)
  2432. if err != nil {
  2433. this.ServeFailJsonSend(enums.ErrorCodeDBDelete, "查询:("+err.Error()+")")
  2434. return
  2435. }
  2436. this.ServeSuccessJSON(map[string]interface{}{
  2437. "informations": information,
  2438. "deviceInformation": deviceInformation,
  2439. "clean": clean,
  2440. })
  2441. }
  2442. func (this *MachineApiController) SaveManageinfoTwo() {
  2443. adminUserInfo := this.GetAdminUserInfo()
  2444. orgid := adminUserInfo.CurrentOrgId
  2445. fmt.Println("机构id", orgid)
  2446. dataBody := make(map[string]interface{}, 0)
  2447. err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
  2448. fmt.Println("err", err)
  2449. serial_numbe := dataBody["serial_number"].(string)
  2450. fmt.Println("序列号", serial_numbe)
  2451. device_type := int64(dataBody["device_type"].(float64))
  2452. fmt.Println("设备类型", device_type)
  2453. //bed_number := dataBody["beds"].(string)
  2454. //fmt.Println("床位号", bed_number)
  2455. bed_number := this.GetString("beds")
  2456. device_name := dataBody["device_name"].(string)
  2457. fmt.Println("设备名称", device_name)
  2458. manufacture_factory := dataBody["manufacture_factory"].(string)
  2459. fmt.Println("生产厂家", manufacture_factory)
  2460. service_manufacturer := dataBody["service_manufacturer"].(string)
  2461. fmt.Println("维修厂家", service_manufacturer)
  2462. unit_type := int64(dataBody["unit_type"].(float64))
  2463. //unit_type := strconv.FormatInt(unittype, 10)
  2464. //fmt.Println("设备型号", unit_type)
  2465. use_section := dataBody["use_section"].(string)
  2466. fmt.Println("使用科室", use_section)
  2467. section_number := dataBody["section_number"].(string)
  2468. fmt.Println("科室编号", section_number)
  2469. buy_date := dataBody["buy_date"].(string)
  2470. fmt.Println("buy_date", buy_date)
  2471. timeLayout := "2006-01-02 15:04:05"
  2472. theTime, err := utils.ParseTimeStringToTime(timeLayout, buy_date+" 00:00:00")
  2473. buydate := theTime.Unix()
  2474. int_num := *(*int)(unsafe.Pointer(&buydate))
  2475. if int_num < 0 {
  2476. buydate = 0
  2477. }
  2478. fmt.Println("购买日期", buydate)
  2479. install_date := dataBody["install_date"].(string)
  2480. toTime, err := utils.ParseTimeStringToTime(timeLayout, install_date+" 00:00:00")
  2481. installdate := toTime.Unix()
  2482. buy_num := *(*int)(unsafe.Pointer(&installdate))
  2483. if buy_num < 0 {
  2484. installdate = 0
  2485. }
  2486. fmt.Println("安装日期", installdate)
  2487. start_date := dataBody["start_date"].(string)
  2488. stringToTime, err := utils.ParseTimeStringToTime(timeLayout, start_date+" 00:00:00")
  2489. startdate := stringToTime.Unix()
  2490. start_num := *(*int)(unsafe.Pointer(&startdate))
  2491. if start_num < 0 {
  2492. startdate = 0
  2493. }
  2494. fmt.Println("启用日期", startdate)
  2495. maintenance_engineer := dataBody["maintenance_engineer"].(string)
  2496. fmt.Println("维修工程", maintenance_engineer)
  2497. telephone := dataBody["telephone"].(string)
  2498. fmt.Println("telephone", telephone)
  2499. guarantee_date := dataBody["guarantee_date"].(string)
  2500. fmt.Println("保修期限", guarantee_date)
  2501. machine_status := int64(dataBody["machine_status"].(float64))
  2502. fmt.Println("机器状态", machine_status)
  2503. disinfection_mode := int64(dataBody["Disinfection_mode"].(float64))
  2504. fmt.Println("消毒方式", disinfection_mode)
  2505. remarks := dataBody["remarks"].(string)
  2506. fmt.Println("备注", remarks)
  2507. rubbish_date := dataBody["rubbish_date"].(string)
  2508. timeStringToTime, err := utils.ParseTimeStringToTime(timeLayout, rubbish_date+" 00:00:00")
  2509. rubbishdate := timeStringToTime.Unix()
  2510. rubb_num := *(*int)(unsafe.Pointer(&rubbishdate))
  2511. if rubb_num < 0 {
  2512. rubbishdate = 0
  2513. }
  2514. fmt.Println("报废日期", rubbishdate)
  2515. rubbish_reason := int64(dataBody["rubbish_reason"].(float64))
  2516. fmt.Println("报废原因", rubbish_reason)
  2517. user_year := dataBody["user_year"].(string)
  2518. fmt.Println("使用年限", user_year)
  2519. work_time := dataBody["work_time"].(string)
  2520. fmt.Println("工作时长", work_time)
  2521. revers := int64(dataBody["revers_mode"].(float64))
  2522. fmt.Println("反渗模式", revers)
  2523. addmacher := &models.DeviceAddmacher{
  2524. SerialNumber: serial_numbe,
  2525. DeviceType: device_type,
  2526. BedNumber: bed_number,
  2527. DeviceName: device_name,
  2528. ManufactureFactory: manufacture_factory,
  2529. ServiceManufacturer: service_manufacturer,
  2530. UnitType: unit_type,
  2531. UseSection: use_section,
  2532. SectionNumber: section_number,
  2533. BuyDate: buydate,
  2534. InstallDate: installdate,
  2535. StartDate: startdate,
  2536. MaintenaceEngineer: maintenance_engineer,
  2537. Telephone: telephone,
  2538. GuaranteeDate: guarantee_date,
  2539. MachineStatus: machine_status,
  2540. DisinfectionMode: disinfection_mode,
  2541. Remarks: remarks,
  2542. RubbishDate: rubbishdate,
  2543. RubbishReason: rubbish_reason,
  2544. UserYear: user_year,
  2545. WorkTime: work_time,
  2546. ReversMode: revers,
  2547. Status: 1,
  2548. Ctime: time.Now().Unix(),
  2549. UserOrgId: orgid,
  2550. }
  2551. err = service.CreateMacher(addmacher)
  2552. fmt.Println("什么原因啊", err)
  2553. if err != nil {
  2554. this.ServeFailJsonSend(enums.ErrorCodeDataException, "添加设备失败")
  2555. return
  2556. }
  2557. this.ServeSuccessJSON(map[string]interface{}{
  2558. "addmacher": addmacher,
  2559. })
  2560. }
  2561. func (this *MachineApiController) GetAllpatient() {
  2562. adminUserInfo := this.GetAdminUserInfo()
  2563. orgid := adminUserInfo.CurrentOrgId
  2564. allpatient, err := service.GetAllpatient(orgid)
  2565. fmt.Print(err)
  2566. if err != nil {
  2567. this.ServeFailJsonSend(enums.ErrorCodeDataException, "添加设备失败")
  2568. return
  2569. }
  2570. this.ServeSuccessJSON(map[string]interface{}{
  2571. "allpatient": allpatient,
  2572. })
  2573. }
  2574. func (this *MachineApiController) ChangeBed() {
  2575. id, _ := this.GetInt64("id")
  2576. fmt.Print("id", id)
  2577. info := this.GetAdminUserInfo()
  2578. orgId := info.CurrentOrgId
  2579. bed, err := service.ChangeBed(id, orgId)
  2580. if err != nil {
  2581. this.ServeFailJsonSend(enums.ErrorCodeDataException, "添加设备失败")
  2582. return
  2583. }
  2584. this.ServeSuccessJSON(map[string]interface{}{
  2585. "bed": bed,
  2586. })
  2587. }
  2588. func (this *MachineApiController) GetPatientDetail() {
  2589. id, _ := this.GetInt64("id")
  2590. fmt.Print("id", id)
  2591. info := this.GetAdminUserInfo()
  2592. orgid := info.CurrentOrgId
  2593. patient, err := service.GetPatientDetail(id, orgid)
  2594. if err != nil {
  2595. this.ServeFailJsonSend(enums.ErrorCodeDataException, "添加设备失败")
  2596. return
  2597. }
  2598. this.ServeSuccessJSON(map[string]interface{}{
  2599. "patient": patient,
  2600. })
  2601. }
  2602. func (this *MachineApiController) SaveReminder() {
  2603. id, _ := this.GetInt64("id")
  2604. fmt.Print("码字", id)
  2605. info := this.GetAdminUserInfo()
  2606. orgId := info.CurrentOrgId
  2607. remander := models.DeviceRemander{
  2608. IsRun: id,
  2609. Status: 1,
  2610. UserOrgId: orgId,
  2611. Ctime: time.Now().Unix(),
  2612. }
  2613. data, errs := service.GetRemanderData(orgId)
  2614. if errs == gorm.ErrRecordNotFound {
  2615. err := service.CreateRemander(&remander).Error()
  2616. fmt.Print(err)
  2617. } else if errs == nil {
  2618. deviceRemander := models.DeviceRemander{
  2619. ID: data.ID,
  2620. IsRun: id,
  2621. Status: 1,
  2622. UserOrgId: orgId,
  2623. Mtime: time.Now().Unix(),
  2624. }
  2625. err := service.UpdateRemander(&deviceRemander)
  2626. if err != nil {
  2627. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCreateConfig)
  2628. return
  2629. }
  2630. }
  2631. this.ServeSuccessJSON(map[string]interface{}{
  2632. "id": id,
  2633. })
  2634. return
  2635. }
  2636. func (this *MachineApiController) GetRemanderData() {
  2637. info := this.GetAdminUserInfo()
  2638. orgid := info.CurrentOrgId
  2639. data, err := service.GetRemanderData(orgid)
  2640. if err != nil {
  2641. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCreateConfig)
  2642. return
  2643. }
  2644. this.ServeSuccessJSON(map[string]interface{}{
  2645. "remander": data,
  2646. })
  2647. }
  2648. func (this *MachineApiController) OpenDelete() {
  2649. id, _ := this.GetInt64("id")
  2650. err := service.DeletePlan(id)
  2651. if err != nil {
  2652. this.ServeFailJsonSend(enums.ErrorCodeDBDelete, "删除失败")
  2653. return
  2654. }
  2655. returnData := make(map[string]interface{}, 0)
  2656. returnData["msg"] = "ok"
  2657. this.ServeSuccessJSON(returnData)
  2658. return
  2659. }
  2660. func (this *MachineApiController) DeleteUserLogin() {
  2661. id, _ := this.GetInt64("id")
  2662. err := service.DeleteUserLogin(id)
  2663. if err != nil {
  2664. this.ServeFailJsonSend(enums.ErrorCodeDBDelete, "删除失败")
  2665. return
  2666. }
  2667. returnData := make(map[string]interface{}, 0)
  2668. returnData["msg"] = "ok"
  2669. this.ServeSuccessJSON(returnData)
  2670. return
  2671. }
  2672. func (this *MachineApiController) DeleteCultrues() {
  2673. id, _ := this.GetInt64("id")
  2674. err := service.DeleteCultrues(id)
  2675. if err != nil {
  2676. this.ServeFailJsonSend(enums.ErrorCodeDBDelete, "删除失败")
  2677. return
  2678. }
  2679. returnData := make(map[string]interface{}, 0)
  2680. returnData["msg"] = "ok"
  2681. this.ServeSuccessJSON(returnData)
  2682. return
  2683. }
  2684. func (this *MachineApiController) DeleteDialystates() {
  2685. id, _ := this.GetInt64("id")
  2686. err := service.DeleteDialystates(id)
  2687. if err != nil {
  2688. this.ServeFailJsonSend(enums.ErrorCodeDBDelete, "删除失败")
  2689. return
  2690. }
  2691. returnData := make(map[string]interface{}, 0)
  2692. returnData["msg"] = "ok"
  2693. this.ServeSuccessJSON(returnData)
  2694. return
  2695. }
  2696. func (this *MachineApiController) Deleteions() {
  2697. id, _ := this.GetInt64("id")
  2698. err := service.DeleteIons(id)
  2699. if err != nil {
  2700. this.ServeFailJsonSend(enums.ErrorCodeDBDelete, "删除失败")
  2701. return
  2702. }
  2703. returnData := make(map[string]interface{}, 0)
  2704. returnData["msg"] = "ok"
  2705. this.ServeSuccessJSON(returnData)
  2706. return
  2707. }
  2708. func (this *MachineApiController) DeleteRepairs() {
  2709. id, _ := this.GetInt64("id")
  2710. err := service.DeleteRepairs(id)
  2711. if err != nil {
  2712. this.ServeFailJsonSend(enums.ErrorCodeDBDelete, "删除失败")
  2713. return
  2714. }
  2715. returnData := make(map[string]interface{}, 0)
  2716. returnData["msg"] = "ok"
  2717. this.ServeSuccessJSON(returnData)
  2718. return
  2719. }
  2720. func (this *MachineApiController) SaveMode() {
  2721. adminUserInfo := this.GetAdminUserInfo()
  2722. orgid := adminUserInfo.CurrentOrgId
  2723. fmt.Println("机构id", orgid)
  2724. dataBody := make(map[string]interface{}, 0)
  2725. err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
  2726. fmt.Println("err", err)
  2727. device_mode := dataBody["device_mode"].(string)
  2728. mode := models.DeviceMode{
  2729. DeviceMode: device_mode,
  2730. UserOrgId: orgid,
  2731. Status: 1,
  2732. Ctime: time.Now().Unix(),
  2733. }
  2734. _, errcode := service.GetMode(device_mode, orgid)
  2735. if errcode == gorm.ErrRecordNotFound {
  2736. err = service.SaveMode(&mode)
  2737. } else if errcode == nil {
  2738. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCreateConfig)
  2739. return
  2740. } else {
  2741. }
  2742. if err != nil {
  2743. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCreateConfig)
  2744. return
  2745. }
  2746. this.ServeSuccessJSON(map[string]interface{}{
  2747. "mode": mode,
  2748. })
  2749. }
  2750. func (this *MachineApiController) GetAllMode() {
  2751. fmt.Println("进来了没哟")
  2752. adminUserInfo := this.GetAdminUserInfo()
  2753. orgid := adminUserInfo.CurrentOrgId
  2754. mode, err := service.GetAllMode(orgid)
  2755. if err != nil {
  2756. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCreateConfig)
  2757. return
  2758. }
  2759. this.ServeSuccessJSON(map[string]interface{}{
  2760. "mode": mode,
  2761. })
  2762. }
  2763. func (this *MachineApiController) EditMode() {
  2764. id, _ := this.GetInt64("id")
  2765. mode, err := service.GetModeById(id)
  2766. if err != nil {
  2767. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCreateConfig)
  2768. return
  2769. }
  2770. this.ServeSuccessJSON(map[string]interface{}{
  2771. "mode": mode,
  2772. })
  2773. }
  2774. func (this *MachineApiController) UpdateMode() {
  2775. id, _ := this.GetInt64("id")
  2776. dataBody := make(map[string]interface{}, 0)
  2777. err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
  2778. fmt.Println("err", err)
  2779. device_mode := dataBody["device_mode"].(string)
  2780. mode := models.DeviceMode{DeviceMode: device_mode}
  2781. err = service.UpdateMode(id, mode)
  2782. if err != nil {
  2783. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCreateConfig)
  2784. return
  2785. }
  2786. this.ServeSuccessJSON(map[string]interface{}{
  2787. "mode": mode,
  2788. })
  2789. }
  2790. func (this *MachineApiController) DeleteMode() {
  2791. id, _ := this.GetInt64("id")
  2792. adminUserInfo := this.GetAdminUserInfo()
  2793. orgid := adminUserInfo.CurrentOrgId
  2794. _, errcode := service.QueryDeviceMode(id, orgid)
  2795. if errcode == gorm.ErrRecordNotFound {
  2796. service.DeleteMode(id)
  2797. returnData := make(map[string]interface{}, 0)
  2798. returnData["msg"] = "ok"
  2799. this.ServeSuccessJSON(returnData)
  2800. return
  2801. } else if errcode == nil {
  2802. return
  2803. } else {
  2804. fmt.Print("设备型号已存在")
  2805. }
  2806. }
  2807. func (this *MachineApiController) SelectChange() {
  2808. id, _ := this.GetInt64("id")
  2809. adminUserInfo := this.GetAdminUserInfo()
  2810. orgid := adminUserInfo.CurrentOrgId
  2811. change, err := service.SelectChange(id, orgid)
  2812. //fmt.Print("---------------------------", err)
  2813. if err != nil {
  2814. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCreateConfig)
  2815. return
  2816. }
  2817. this.ServeSuccessJSON(map[string]interface{}{
  2818. "change": change,
  2819. })
  2820. }
  2821. func (this *MachineApiController) SelectBed() {
  2822. id, _ := this.GetInt64("id")
  2823. adminUserInfo := this.GetAdminUserInfo()
  2824. orgid := adminUserInfo.CurrentOrgId
  2825. bed, err := service.SelectBed(id, orgid)
  2826. if err != nil {
  2827. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCreateConfig)
  2828. return
  2829. }
  2830. this.ServeSuccessJSON(map[string]interface{}{
  2831. "zone": bed,
  2832. })
  2833. }
  2834. func (this *MachineApiController) GetTimeData() {
  2835. equitid, _ := this.GetInt64("equitid")
  2836. fmt.Print("equitid", equitid)
  2837. timeLayout := "2006-01-02 15:04:05"
  2838. todaytime := this.GetString("todaytime")
  2839. theTime, _ := utils.ParseTimeStringToTime(timeLayout, todaytime+" 00:00:00")
  2840. fmt.Print("时间", theTime.Unix())
  2841. adminUserInfo := this.GetAdminUserInfo()
  2842. orgid := adminUserInfo.CurrentOrgId
  2843. timeData, err := service.GetTimeData(equitid, orgid, theTime.Unix())
  2844. fmt.Print("报错", err)
  2845. timeDataTwo, err := service.GetTimeTwo(equitid, orgid, theTime.Unix())
  2846. timeDataThree, err := service.GetTimeThree(equitid, orgid, theTime.Unix())
  2847. fmt.Print("err报错了没有", err)
  2848. if err != nil {
  2849. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCreateConfig)
  2850. return
  2851. }
  2852. this.ServeSuccessJSON(map[string]interface{}{
  2853. "timeData": timeData,
  2854. "timeDataTwo": timeDataTwo,
  2855. "timeDataThree": timeDataThree,
  2856. })
  2857. }
  2858. func (this *MachineApiController) DeleteImages() {
  2859. id, _ := this.GetInt64("id")
  2860. err := service.DeleteImages(id)
  2861. fmt.Print("err", err)
  2862. if err != nil {
  2863. this.ServeFailJsonSend(enums.ErrorCodeDBDelete, "删除失败")
  2864. return
  2865. }
  2866. returnData := make(map[string]interface{}, 0)
  2867. returnData["msg"] = "ok"
  2868. this.ServeSuccessJSON(returnData)
  2869. return
  2870. }
  2871. func (this *MachineApiController) GetUserMachTotalCount() {
  2872. adminUserInfo := this.GetAdminUserInfo()
  2873. orgid := adminUserInfo.CurrentOrgId
  2874. count, err := service.GetUserMachTotalCount(orgid)
  2875. if err != nil {
  2876. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCreateConfig)
  2877. return
  2878. }
  2879. this.ServeSuccessJSON(map[string]interface{}{
  2880. "count": count,
  2881. })
  2882. }
  2883. func (this *MachineApiController) GetUserTotalCount() {
  2884. adminUserInfo := this.GetAdminUserInfo()
  2885. orgid := adminUserInfo.CurrentOrgId
  2886. id, _ := this.GetInt64("id")
  2887. count, err := service.GetUserTotalCount(orgid, id)
  2888. addmacher, err := service.GetUserTotal(orgid, id)
  2889. if err != nil {
  2890. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCreateConfig)
  2891. return
  2892. }
  2893. this.ServeSuccessJSON(map[string]interface{}{
  2894. "count": count,
  2895. "addmacher": addmacher,
  2896. })
  2897. }
  2898. func (this *MachineApiController) DeleteManagement() {
  2899. id, _ := this.GetInt64("id")
  2900. _, err := service.DeleteEquit(id)
  2901. if err != nil {
  2902. this.ServeFailJsonSend(enums.ErrorCodeDBDelete, "删除失败")
  2903. return
  2904. }
  2905. returnData := make(map[string]interface{}, 0)
  2906. returnData["msg"] = "ok"
  2907. this.ServeSuccessJSON(returnData)
  2908. return
  2909. }
  2910. func (this *MachineApiController) SaveOxygenates() {
  2911. timeLayout := "2006-01-02"
  2912. loc, _ := time.LoadLocation("Local")
  2913. id, _ := this.GetInt64("id")
  2914. addmacher, _ := service.GetBedId(id)
  2915. adminUserInfo := this.GetAdminUserInfo()
  2916. orgid := adminUserInfo.CurrentOrgId
  2917. dataBody := make(map[string]interface{}, 0)
  2918. err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
  2919. date := dataBody["sampling_date"].(string)
  2920. theTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", date+" 00:00:00", loc)
  2921. samp_date := theTime.Unix()
  2922. specimen := int64(dataBody["specimenb"].(float64))
  2923. cona := dataBody["concentrate_noc"].(string)
  2924. conb := dataBody["concentrateb_nod"].(string)
  2925. samplinglocationb := int64(dataBody["sampling_locationb"].(float64))
  2926. detectionUnit := dataBody["detection_unit"].(string)
  2927. samplerb := int64(dataBody["samplerb"].(float64))
  2928. reportDate := dataBody["reporting_dateb"].(string)
  2929. reportTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", reportDate+" 00:00:00", loc)
  2930. repDate := reportTime.Unix()
  2931. detectionResult := dataBody["detection_resultb"].(string)
  2932. sort := dataBody["sort"].(string)
  2933. modifications := int64(dataBody["modifications"].(float64))
  2934. examination := dataBody["pass_examination"].(string)
  2935. pass_examination, _ := strconv.ParseInt(examination, 10, 64)
  2936. oxygenates := models.XtDeviceOxygenates{
  2937. SamplingDate: samp_date,
  2938. Specimenb: specimen,
  2939. ConcentrateNoc: cona,
  2940. ConcentratebNod: conb,
  2941. SamplingLocationb: samplinglocationb,
  2942. DetectionUnit: detectionUnit,
  2943. Samplerb: samplerb,
  2944. ReportingDateb: repDate,
  2945. DetectionResultb: detectionResult,
  2946. Ctime: time.Now().Unix(),
  2947. Status: 1,
  2948. UserOrgId: orgid,
  2949. BedId: addmacher.BedId,
  2950. EquitmentId: id,
  2951. Bed: addmacher.BedNumber,
  2952. Sort: sort,
  2953. PassExamination: pass_examination,
  2954. Modifications: modifications,
  2955. }
  2956. err = service.CreateOxygenates(&oxygenates)
  2957. if err != nil {
  2958. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCreateConfig)
  2959. return
  2960. }
  2961. this.ServeSuccessJSON(map[string]interface{}{
  2962. "oxygenates": oxygenates,
  2963. })
  2964. }
  2965. func (this *MachineApiController) SaveHardWater() {
  2966. timeLayout := "2006-01-02"
  2967. loc, _ := time.LoadLocation("Local")
  2968. id, _ := this.GetInt64("id")
  2969. addmacher, _ := service.GetBedId(id)
  2970. adminUserInfo := this.GetAdminUserInfo()
  2971. orgid := adminUserInfo.CurrentOrgId
  2972. dataBody := make(map[string]interface{}, 0)
  2973. err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
  2974. date := dataBody["sampling_date"].(string)
  2975. theTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", date+" 00:00:00", loc)
  2976. samp_date := theTime.Unix()
  2977. specimen := int64(dataBody["specimenb"].(float64))
  2978. cona := dataBody["concentrate_noc"].(string)
  2979. conb := dataBody["concentrateb_nod"].(string)
  2980. samplinglocationb := int64(dataBody["sampling_locationb"].(float64))
  2981. detectionUnit := dataBody["detection_unit"].(string)
  2982. samplerb := int64(dataBody["samplerb"].(float64))
  2983. reportDate := dataBody["reporting_dateb"].(string)
  2984. reportTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", reportDate+" 00:00:00", loc)
  2985. repDate := reportTime.Unix()
  2986. detectionResult := dataBody["detection_resultb"].(string)
  2987. sort := dataBody["sort"].(string)
  2988. modifications := int64(dataBody["modifications"].(float64))
  2989. examination := dataBody["pass_examination"].(string)
  2990. pass_examination, _ := strconv.ParseInt(examination, 10, 64)
  2991. hadwater := models.XtDeviceHadwater{
  2992. SamplingDate: samp_date,
  2993. Specimenb: specimen,
  2994. ConcentrateNoc: cona,
  2995. ConcentratebNod: conb,
  2996. SamplingLocationb: samplinglocationb,
  2997. DetectionUnit: detectionUnit,
  2998. Samplerb: samplerb,
  2999. ReportingDateb: repDate,
  3000. DetectionResultb: detectionResult,
  3001. Ctime: time.Now().Unix(),
  3002. Status: 1,
  3003. UserOrgId: orgid,
  3004. BedId: addmacher.BedId,
  3005. EquitmentId: id,
  3006. Bed: addmacher.BedNumber,
  3007. Sort: sort,
  3008. PassExamination: pass_examination,
  3009. Modifications: modifications,
  3010. }
  3011. err = service.CreateHadWater(&hadwater)
  3012. if err != nil {
  3013. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCreateConfig)
  3014. return
  3015. }
  3016. this.ServeSuccessJSON(map[string]interface{}{
  3017. "hadwater": hadwater,
  3018. })
  3019. }
  3020. func (this *MachineApiController) SaveWater() {
  3021. timeLayout := "2006-01-02"
  3022. loc, _ := time.LoadLocation("Local")
  3023. id, _ := this.GetInt64("id")
  3024. addmacher, _ := service.GetBedId(id)
  3025. adminUserInfo := this.GetAdminUserInfo()
  3026. orgid := adminUserInfo.CurrentOrgId
  3027. dataBody := make(map[string]interface{}, 0)
  3028. err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
  3029. date := dataBody["sampling_date"].(string)
  3030. theTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", date+" 00:00:00", loc)
  3031. samp_date := theTime.Unix()
  3032. specimen := int64(dataBody["specimenb"].(float64))
  3033. cona := dataBody["concentrate_noc"].(string)
  3034. conb := dataBody["concentrateb_nod"].(string)
  3035. samplinglocationb := int64(dataBody["sampling_locationb"].(float64))
  3036. detectionUnit := dataBody["detection_unit"].(string)
  3037. samplerb := int64(dataBody["samplerb"].(float64))
  3038. reportDate := dataBody["reporting_dateb"].(string)
  3039. reportTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", reportDate+" 00:00:00", loc)
  3040. repDate := reportTime.Unix()
  3041. detectionResult := dataBody["detection_resultb"].(string)
  3042. sort := dataBody["sort"].(string)
  3043. modifications := int64(dataBody["modifications"].(float64))
  3044. examination := dataBody["pass_examination"].(string)
  3045. pass_examination, _ := strconv.ParseInt(examination, 10, 64)
  3046. deviceWater := models.XtDeviceWater{
  3047. SamplingDate: samp_date,
  3048. Specimenb: specimen,
  3049. ConcentrateNoc: cona,
  3050. ConcentratebNod: conb,
  3051. SamplingLocationb: samplinglocationb,
  3052. DetectionUnit: detectionUnit,
  3053. Samplerb: samplerb,
  3054. ReportingDateb: repDate,
  3055. DetectionResultb: detectionResult,
  3056. Ctime: time.Now().Unix(),
  3057. Status: 1,
  3058. UserOrgId: orgid,
  3059. BedId: addmacher.BedId,
  3060. EquitmentId: id,
  3061. Bed: addmacher.BedNumber,
  3062. Sort: sort,
  3063. PassExamination: pass_examination,
  3064. Modifications: modifications,
  3065. }
  3066. err = service.CreateWater(&deviceWater)
  3067. if err != nil {
  3068. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCreateConfig)
  3069. return
  3070. }
  3071. this.ServeSuccessJSON(map[string]interface{}{
  3072. "deviceWater": deviceWater,
  3073. })
  3074. }
  3075. func (this *MachineApiController) SaveDevicePH() {
  3076. timeLayout := "2006-01-02"
  3077. loc, _ := time.LoadLocation("Local")
  3078. id, _ := this.GetInt64("id")
  3079. addmacher, _ := service.GetBedId(id)
  3080. adminUserInfo := this.GetAdminUserInfo()
  3081. orgid := adminUserInfo.CurrentOrgId
  3082. dataBody := make(map[string]interface{}, 0)
  3083. err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
  3084. date := dataBody["sampling_date"].(string)
  3085. theTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", date+" 00:00:00", loc)
  3086. samp_date := theTime.Unix()
  3087. specimen := int64(dataBody["specimenb"].(float64))
  3088. cona := dataBody["concentrate_noc"].(string)
  3089. conb := dataBody["concentrateb_nod"].(string)
  3090. samplinglocationb := int64(dataBody["sampling_locationb"].(float64))
  3091. detectionUnit := dataBody["detection_unit"].(string)
  3092. samplerb := int64(dataBody["samplerb"].(float64))
  3093. reportDate := dataBody["reporting_dateb"].(string)
  3094. reportTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", reportDate+" 00:00:00", loc)
  3095. repDate := reportTime.Unix()
  3096. detectionResult := dataBody["detection_resultb"].(string)
  3097. sort := dataBody["sort"].(string)
  3098. modifications := int64(dataBody["modifications"].(float64))
  3099. examination := dataBody["pass_examination"].(string)
  3100. pass_examination, _ := strconv.ParseInt(examination, 10, 64)
  3101. devicePh := models.XtDevicePh{
  3102. SamplingDate: samp_date,
  3103. Specimenb: specimen,
  3104. ConcentrateNoc: cona,
  3105. ConcentratebNod: conb,
  3106. SamplingLocationb: samplinglocationb,
  3107. DetectionUnit: detectionUnit,
  3108. Samplerb: samplerb,
  3109. ReportingDateb: repDate,
  3110. DetectionResultb: detectionResult,
  3111. Ctime: time.Now().Unix(),
  3112. Status: 1,
  3113. UserOrgId: orgid,
  3114. BedId: addmacher.BedId,
  3115. EquitmentId: id,
  3116. Bed: addmacher.BedNumber,
  3117. Sort: sort,
  3118. PassExamination: pass_examination,
  3119. Modifications: modifications,
  3120. }
  3121. err = service.CreateDevicePh(&devicePh)
  3122. if err != nil {
  3123. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCreateConfig)
  3124. return
  3125. }
  3126. this.ServeSuccessJSON(map[string]interface{}{
  3127. "devicePh": devicePh,
  3128. })
  3129. }
  3130. func (this *MachineApiController) EditOxygenates() {
  3131. id, _ := this.GetInt64("id")
  3132. oxygenates, err := service.GetOxygenatesById(id)
  3133. if err != nil {
  3134. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCreateConfig)
  3135. return
  3136. }
  3137. this.ServeSuccessJSON(map[string]interface{}{
  3138. "oxygenates": oxygenates,
  3139. })
  3140. }
  3141. func (this *MachineApiController) UpdateOxygenates() {
  3142. timeLayout := "2006-01-02"
  3143. loc, _ := time.LoadLocation("Local")
  3144. dataBody := make(map[string]interface{}, 0)
  3145. err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
  3146. fmt.Println("err", err)
  3147. id := int64(dataBody["id"].(float64))
  3148. fmt.Println("id", id)
  3149. samplingDate := dataBody["sampling_date"].(string)
  3150. sampdate, _ := time.ParseInLocation(timeLayout+" 15:04:05", samplingDate+" 00:00:00", loc)
  3151. samp_date := sampdate.Unix()
  3152. specimentb := int64(dataBody["specimenb"].(float64))
  3153. concentratec := dataBody["concentrate_noc"].(string)
  3154. concentraeb := dataBody["concentrateb_nod"].(string)
  3155. samplinglocationb := int64(dataBody["sampling_locationb"].(float64))
  3156. samplerb := int64(dataBody["samplerb"].(float64))
  3157. reportDateb := dataBody["reporting_dateb"].(string)
  3158. location, _ := time.ParseInLocation(timeLayout+" 15:04:05", reportDateb+" 00:00:00", loc)
  3159. report_date := location.Unix()
  3160. detectionResultb := dataBody["detection_resultb"].(string)
  3161. detectionUnit := dataBody["detection_unit"].(string)
  3162. sort := dataBody["sort"].(string)
  3163. pass_examination := int64(dataBody["pass_examination"].(float64))
  3164. modifications := int64(dataBody["modifications"].(float64))
  3165. adminUserInfo := this.GetAdminUserInfo()
  3166. orgId := adminUserInfo.CurrentOrgId
  3167. oxygenates := models.XtDeviceOxygenates{
  3168. SamplingDate: samp_date,
  3169. Specimenb: specimentb,
  3170. ConcentrateNoc: concentratec,
  3171. ConcentratebNod: concentraeb,
  3172. SamplingLocationb: samplinglocationb,
  3173. DetectionUnit: detectionUnit,
  3174. Samplerb: samplerb,
  3175. ReportingDateb: report_date,
  3176. DetectionResultb: detectionResultb,
  3177. Sort: sort,
  3178. PassExamination: pass_examination,
  3179. Modifications: modifications,
  3180. }
  3181. err = service.UpdateOxygenates(id, orgId, &oxygenates)
  3182. if err != nil {
  3183. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCreateConfig)
  3184. return
  3185. }
  3186. this.ServeSuccessJSON(map[string]interface{}{
  3187. "oxygenates": oxygenates,
  3188. })
  3189. }
  3190. func (this *MachineApiController) EditHardWater() {
  3191. id, _ := this.GetInt64("id")
  3192. hardWater, err := service.GetHardWaterById(id)
  3193. if err != nil {
  3194. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCreateConfig)
  3195. return
  3196. }
  3197. this.ServeSuccessJSON(map[string]interface{}{
  3198. "hardWater": hardWater,
  3199. })
  3200. }
  3201. func (this *MachineApiController) EditWater() {
  3202. id, _ := this.GetInt64("id")
  3203. water, err := service.GetWaterById(id)
  3204. if err != nil {
  3205. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCreateConfig)
  3206. return
  3207. }
  3208. this.ServeSuccessJSON(map[string]interface{}{
  3209. "water": water,
  3210. })
  3211. }
  3212. func (this *MachineApiController) EditDevicePh() {
  3213. id, _ := this.GetInt64("id")
  3214. deviceph, err := service.GetDevicePhById(id)
  3215. if err != nil {
  3216. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCreateConfig)
  3217. return
  3218. }
  3219. this.ServeSuccessJSON(map[string]interface{}{
  3220. "deviceph": deviceph,
  3221. })
  3222. }
  3223. func (this *MachineApiController) GetAllDoctorList() {
  3224. adminUserInfo := this.GetAdminUserInfo()
  3225. orgId := adminUserInfo.CurrentOrgId
  3226. appId := this.GetAdminUserInfo().CurrentAppId
  3227. list, err := service.GetAllDoctorTwo(orgId, appId)
  3228. if err != nil {
  3229. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCreateConfig)
  3230. return
  3231. }
  3232. this.ServeSuccessJSON(map[string]interface{}{
  3233. "list": list,
  3234. })
  3235. }
  3236. func (this *MachineApiController) SaveAirDisinfect() {
  3237. timeLayout := "2006-01-02"
  3238. loc, _ := time.LoadLocation("Local")
  3239. check_out, err := this.GetInt64("check_out")
  3240. class, err := this.GetInt64("class")
  3241. create_time := this.GetString("created_time")
  3242. createTime, err := time.ParseInLocation(timeLayout+" 15:04:05", create_time+" 00:00:00", loc)
  3243. creator, err := this.GetInt64("creator")
  3244. detection_result := this.GetString("detection_result")
  3245. detection_time := this.GetString("detection_time")
  3246. detectionTime, err := time.ParseInLocation(timeLayout+" 15:04:05", detection_time+" 00:00:00", loc)
  3247. disinfection_fluid := this.GetString("disinfection_fluid")
  3248. disinfection_methods := this.GetString("disinfection_methods")
  3249. modifications, _ := this.GetInt64("modifications")
  3250. sort := this.GetString("sort")
  3251. upload_time := this.GetString("upload_time")
  3252. uploadTime, err := time.ParseInLocation(timeLayout+" 15:04:05", upload_time+" 00:00:00", loc)
  3253. start_time := this.GetString("start_time")
  3254. startTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
  3255. adminUserInfo := this.GetAdminUserInfo()
  3256. orgId := adminUserInfo.CurrentOrgId
  3257. detection := models.XtAerialDetection{
  3258. CheckOut: check_out,
  3259. Class: class,
  3260. CreatedTime: createTime.Unix(),
  3261. Creator: creator,
  3262. DetectionResult: detection_result,
  3263. DetectionTime: detectionTime.Unix(),
  3264. DisinfectionFluid: disinfection_fluid,
  3265. DisinfectionMethods: disinfection_methods,
  3266. Modifications: modifications,
  3267. Sort: sort,
  3268. UploadTime: uploadTime.Unix(),
  3269. StartTime: startTime.Unix(),
  3270. UserOrgId: orgId,
  3271. Ctime: time.Now().Unix(),
  3272. Status: 1,
  3273. }
  3274. err = service.CreateAerialDetection(&detection)
  3275. if err != nil {
  3276. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCreateConfig)
  3277. return
  3278. }
  3279. this.ServeSuccessJSON(map[string]interface{}{
  3280. "list": detection,
  3281. })
  3282. }
  3283. func (this *MachineApiController) GetAirList() {
  3284. limit, _ := this.GetInt64("limit")
  3285. page, _ := this.GetInt64("page")
  3286. adminUserInfo := this.GetAdminUserInfo()
  3287. orgId := adminUserInfo.CurrentOrgId
  3288. list, total, err := service.GetAirList(limit, page, orgId)
  3289. if err != nil {
  3290. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCreateConfig)
  3291. return
  3292. }
  3293. this.ServeSuccessJSON(map[string]interface{}{
  3294. "list": list,
  3295. "total": total,
  3296. })
  3297. }
  3298. func (this *MachineApiController) GetAirDisinfetDetail() {
  3299. id, _ := this.GetInt64("id")
  3300. detail, err := service.GetAirDisinfectDetail(id)
  3301. if err != nil {
  3302. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCreateConfig)
  3303. return
  3304. }
  3305. this.ServeSuccessJSON(map[string]interface{}{
  3306. "detail": detail,
  3307. })
  3308. }
  3309. func (this *MachineApiController) UpdateAirDisinfect() {
  3310. timeLayout := "2006-01-02"
  3311. loc, _ := time.LoadLocation("Local")
  3312. check_out, err := this.GetInt64("check_out")
  3313. class, err := this.GetInt64("class")
  3314. create_time := this.GetString("created_time")
  3315. createTime, err := time.ParseInLocation(timeLayout+" 15:04:05", create_time+" 00:00:00", loc)
  3316. creator, err := this.GetInt64("creator")
  3317. detection_result := this.GetString("detection_result")
  3318. detection_time := this.GetString("detection_time")
  3319. detectionTime, err := time.ParseInLocation(timeLayout+" 15:04:05", detection_time+" 00:00:00", loc)
  3320. disinfection_fluid := this.GetString("disinfection_fluid")
  3321. disinfection_methods := this.GetString("disinfection_methods")
  3322. modifications, _ := this.GetInt64("modifications")
  3323. sort := this.GetString("sort")
  3324. upload_time := this.GetString("upload_time")
  3325. uploadTime, err := time.ParseInLocation(timeLayout+" 15:04:05", upload_time+" 00:00:00", loc)
  3326. start_time := this.GetString("start_time")
  3327. startTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
  3328. id, _ := this.GetInt64("id")
  3329. adminUserInfo := this.GetAdminUserInfo()
  3330. orgId := adminUserInfo.CurrentOrgId
  3331. detection := models.XtAerialDetection{
  3332. CheckOut: check_out,
  3333. Class: class,
  3334. CreatedTime: createTime.Unix(),
  3335. Creator: creator,
  3336. DetectionResult: detection_result,
  3337. DetectionTime: detectionTime.Unix(),
  3338. DisinfectionFluid: disinfection_fluid,
  3339. DisinfectionMethods: disinfection_methods,
  3340. Modifications: modifications,
  3341. Sort: sort,
  3342. UploadTime: uploadTime.Unix(),
  3343. StartTime: startTime.Unix(),
  3344. UserOrgId: orgId,
  3345. Ctime: time.Now().Unix(),
  3346. Status: 1,
  3347. }
  3348. err = service.UpdateAeriaDetection(&detection, id)
  3349. if err != nil {
  3350. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCreateConfig)
  3351. return
  3352. }
  3353. this.ServeSuccessJSON(map[string]interface{}{
  3354. "detection": detection,
  3355. })
  3356. }
  3357. func (this *MachineApiController) DeleteAirDisinfect() {
  3358. id, _ := this.GetInt64("id")
  3359. err := service.DeleteAirDisinfect(id)
  3360. fmt.Println(err)
  3361. returnData := make(map[string]interface{}, 0)
  3362. returnData["msg"] = "ok"
  3363. this.ServeSuccessJSON(returnData)
  3364. return
  3365. }
  3366. func (this *MachineApiController) SaveBodyDisinfect() {
  3367. timeLayout := "2006-01-02"
  3368. loc, _ := time.LoadLocation("Local")
  3369. check_out, err := this.GetInt64("check_out")
  3370. class, err := this.GetInt64("class")
  3371. create_time := this.GetString("created_time")
  3372. createTime, err := time.ParseInLocation(timeLayout+" 15:04:05", create_time+" 00:00:00", loc)
  3373. creator, err := this.GetInt64("creator")
  3374. detection_result := this.GetString("detection_result")
  3375. detection_time := this.GetString("detection_time")
  3376. detectionTime, err := time.ParseInLocation(timeLayout+" 15:04:05", detection_time+" 00:00:00", loc)
  3377. disinfection_fluid := this.GetString("disinfection_fluid")
  3378. disinfection_methods := this.GetString("disinfection_methods")
  3379. modifications, _ := this.GetInt64("modifications")
  3380. sort := this.GetString("sort")
  3381. upload_time := this.GetString("upload_time")
  3382. uploadTime, err := time.ParseInLocation(timeLayout+" 15:04:05", upload_time+" 00:00:00", loc)
  3383. start_time := this.GetString("start_time")
  3384. startTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
  3385. adminUserInfo := this.GetAdminUserInfo()
  3386. orgId := adminUserInfo.CurrentOrgId
  3387. detection := models.XtBodyDetection{
  3388. CheckOut: check_out,
  3389. Class: class,
  3390. CreatedTime: createTime.Unix(),
  3391. Creator: creator,
  3392. DetectionResult: detection_result,
  3393. DetectionTime: detectionTime.Unix(),
  3394. DisinfectionFluid: disinfection_fluid,
  3395. DisinfectionMethods: disinfection_methods,
  3396. Modifications: modifications,
  3397. Sort: sort,
  3398. UploadTime: uploadTime.Unix(),
  3399. StartTime: startTime.Unix(),
  3400. UserOrgId: orgId,
  3401. Ctime: time.Now().Unix(),
  3402. Status: 1,
  3403. }
  3404. err = service.SaveBodyDetection(&detection)
  3405. if err != nil {
  3406. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCreateConfig)
  3407. return
  3408. }
  3409. this.ServeSuccessJSON(map[string]interface{}{
  3410. "detection": detection,
  3411. })
  3412. }
  3413. func (this *MachineApiController) GetBodyList() {
  3414. limit, _ := this.GetInt64("limit")
  3415. page, _ := this.GetInt64("page")
  3416. adminUserInfo := this.GetAdminUserInfo()
  3417. orgId := adminUserInfo.CurrentOrgId
  3418. list, total, err := service.GetBodyList(limit, page, orgId)
  3419. if err != nil {
  3420. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCreateConfig)
  3421. return
  3422. }
  3423. this.ServeSuccessJSON(map[string]interface{}{
  3424. "list": list,
  3425. "total": total,
  3426. })
  3427. }
  3428. func (this *MachineApiController) GetBodyDisinfetDetail() {
  3429. id, _ := this.GetInt64("id")
  3430. detail, err := service.GetBodyDisinfectDetail(id)
  3431. if err != nil {
  3432. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCreateConfig)
  3433. return
  3434. }
  3435. this.ServeSuccessJSON(map[string]interface{}{
  3436. "detail": detail,
  3437. })
  3438. }
  3439. func (this *MachineApiController) UpdateBodyDisinfect() {
  3440. timeLayout := "2006-01-02"
  3441. loc, _ := time.LoadLocation("Local")
  3442. check_out, _ := this.GetInt64("check_out")
  3443. class, _ := this.GetInt64("class")
  3444. create_time := this.GetString("created_time")
  3445. createTime, err := time.ParseInLocation(timeLayout+" 15:04:05", create_time+" 00:00:00", loc)
  3446. creator, err := this.GetInt64("creator")
  3447. detection_result := this.GetString("detection_result")
  3448. detection_time := this.GetString("detection_time")
  3449. detectionTime, err := time.ParseInLocation(timeLayout+" 15:04:05", detection_time+" 00:00:00", loc)
  3450. disinfection_fluid := this.GetString("disinfection_fluid")
  3451. disinfection_methods := this.GetString("disinfection_methods")
  3452. modifications, _ := this.GetInt64("modifications")
  3453. sort := this.GetString("sort")
  3454. upload_time := this.GetString("upload_time")
  3455. uploadTime, err := time.ParseInLocation(timeLayout+" 15:04:05", upload_time+" 00:00:00", loc)
  3456. start_time := this.GetString("start_time")
  3457. startTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
  3458. id, _ := this.GetInt64("id")
  3459. adminUserInfo := this.GetAdminUserInfo()
  3460. orgId := adminUserInfo.CurrentOrgId
  3461. detection := models.XtBodyDetection{
  3462. CheckOut: check_out,
  3463. Class: class,
  3464. CreatedTime: createTime.Unix(),
  3465. Creator: creator,
  3466. DetectionResult: detection_result,
  3467. DetectionTime: detectionTime.Unix(),
  3468. DisinfectionFluid: disinfection_fluid,
  3469. DisinfectionMethods: disinfection_methods,
  3470. Modifications: modifications,
  3471. Sort: sort,
  3472. UploadTime: uploadTime.Unix(),
  3473. StartTime: startTime.Unix(),
  3474. UserOrgId: orgId,
  3475. Ctime: time.Now().Unix(),
  3476. Status: 1,
  3477. }
  3478. err = service.UpdateBodyDetection(&detection, id)
  3479. if err != nil {
  3480. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCreateConfig)
  3481. return
  3482. }
  3483. this.ServeSuccessJSON(map[string]interface{}{
  3484. "detection": detection,
  3485. })
  3486. }
  3487. func (this *MachineApiController) DeleteBodyDisInfect() {
  3488. id, _ := this.GetInt64("id")
  3489. err := service.DeleteBodyDisInfect(id)
  3490. fmt.Println(err)
  3491. returnData := make(map[string]interface{}, 0)
  3492. returnData["msg"] = "ok"
  3493. this.ServeSuccessJSON(returnData)
  3494. return
  3495. }
  3496. func (this *MachineApiController) UpdateHadWater() {
  3497. timeLayout := "2006-01-02"
  3498. loc, _ := time.LoadLocation("Local")
  3499. dataBody := make(map[string]interface{}, 0)
  3500. err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
  3501. fmt.Println("err", err)
  3502. id := int64(dataBody["id"].(float64))
  3503. fmt.Println("id", id)
  3504. samplingDate := dataBody["sampling_date"].(string)
  3505. sampdate, _ := time.ParseInLocation(timeLayout+" 15:04:05", samplingDate+" 00:00:00", loc)
  3506. samp_date := sampdate.Unix()
  3507. specimentb := int64(dataBody["specimenb"].(float64))
  3508. concentratec := dataBody["concentrate_noc"].(string)
  3509. concentraeb := dataBody["concentrateb_nod"].(string)
  3510. samplinglocationb := int64(dataBody["sampling_locationb"].(float64))
  3511. samplerb := int64(dataBody["samplerb"].(float64))
  3512. reportDateb := dataBody["reporting_dateb"].(string)
  3513. location, _ := time.ParseInLocation(timeLayout+" 15:04:05", reportDateb+" 00:00:00", loc)
  3514. report_date := location.Unix()
  3515. detectionResultb := dataBody["detection_resultb"].(string)
  3516. detectionUnit := dataBody["detection_unit"].(string)
  3517. sort := dataBody["sort"].(string)
  3518. pass_examination := int64(dataBody["pass_examination"].(float64))
  3519. modifications := int64(dataBody["modifications"].(float64))
  3520. adminUserInfo := this.GetAdminUserInfo()
  3521. orgId := adminUserInfo.CurrentOrgId
  3522. hadWater := models.XtDeviceHadwater{
  3523. SamplingDate: samp_date,
  3524. Specimenb: specimentb,
  3525. ConcentrateNoc: concentratec,
  3526. ConcentratebNod: concentraeb,
  3527. SamplingLocationb: samplinglocationb,
  3528. DetectionUnit: detectionUnit,
  3529. Samplerb: samplerb,
  3530. ReportingDateb: report_date,
  3531. DetectionResultb: detectionResultb,
  3532. Sort: sort,
  3533. PassExamination: pass_examination,
  3534. Modifications: modifications,
  3535. }
  3536. err = service.UpdateHadWater(id, orgId, &hadWater)
  3537. if err != nil {
  3538. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCreateConfig)
  3539. return
  3540. }
  3541. this.ServeSuccessJSON(map[string]interface{}{
  3542. "hadWater": hadWater,
  3543. })
  3544. }
  3545. func (this *MachineApiController) UpdateWater() {
  3546. timeLayout := "2006-01-02"
  3547. loc, _ := time.LoadLocation("Local")
  3548. dataBody := make(map[string]interface{}, 0)
  3549. err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
  3550. fmt.Println("err", err)
  3551. id := int64(dataBody["id"].(float64))
  3552. fmt.Println("id", id)
  3553. samplingDate := dataBody["sampling_date"].(string)
  3554. sampdate, _ := time.ParseInLocation(timeLayout+" 15:04:05", samplingDate+" 00:00:00", loc)
  3555. samp_date := sampdate.Unix()
  3556. specimentb := int64(dataBody["specimenb"].(float64))
  3557. concentratec := dataBody["concentrate_noc"].(string)
  3558. concentraeb := dataBody["concentrateb_nod"].(string)
  3559. samplinglocationb := int64(dataBody["sampling_locationb"].(float64))
  3560. samplerb := int64(dataBody["samplerb"].(float64))
  3561. reportDateb := dataBody["reporting_dateb"].(string)
  3562. location, _ := time.ParseInLocation(timeLayout+" 15:04:05", reportDateb+" 00:00:00", loc)
  3563. report_date := location.Unix()
  3564. detectionResultb := dataBody["detection_resultb"].(string)
  3565. detectionUnit := dataBody["detection_unit"].(string)
  3566. sort := dataBody["sort"].(string)
  3567. pass_examination := int64(dataBody["pass_examination"].(float64))
  3568. modifications := int64(dataBody["modifications"].(float64))
  3569. adminUserInfo := this.GetAdminUserInfo()
  3570. orgId := adminUserInfo.CurrentOrgId
  3571. hadWater := models.XtDeviceWater{
  3572. SamplingDate: samp_date,
  3573. Specimenb: specimentb,
  3574. ConcentrateNoc: concentratec,
  3575. ConcentratebNod: concentraeb,
  3576. SamplingLocationb: samplinglocationb,
  3577. DetectionUnit: detectionUnit,
  3578. Samplerb: samplerb,
  3579. ReportingDateb: report_date,
  3580. DetectionResultb: detectionResultb,
  3581. Sort: sort,
  3582. PassExamination: pass_examination,
  3583. Modifications: modifications,
  3584. }
  3585. err = service.UpdateDeviceWater(id, orgId, &hadWater)
  3586. if err != nil {
  3587. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCreateConfig)
  3588. return
  3589. }
  3590. this.ServeSuccessJSON(map[string]interface{}{
  3591. "hadWater": hadWater,
  3592. })
  3593. }
  3594. func (this *MachineApiController) UpdateDevicePh() {
  3595. timeLayout := "2006-01-02"
  3596. loc, _ := time.LoadLocation("Local")
  3597. dataBody := make(map[string]interface{}, 0)
  3598. err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
  3599. fmt.Println("err", err)
  3600. id := int64(dataBody["id"].(float64))
  3601. fmt.Println("id", id)
  3602. samplingDate := dataBody["sampling_date"].(string)
  3603. sampdate, _ := time.ParseInLocation(timeLayout+" 15:04:05", samplingDate+" 00:00:00", loc)
  3604. samp_date := sampdate.Unix()
  3605. specimentb := int64(dataBody["specimenb"].(float64))
  3606. concentratec := dataBody["concentrate_noc"].(string)
  3607. concentraeb := dataBody["concentrateb_nod"].(string)
  3608. samplinglocationb := int64(dataBody["sampling_locationb"].(float64))
  3609. samplerb := int64(dataBody["samplerb"].(float64))
  3610. reportDateb := dataBody["reporting_dateb"].(string)
  3611. location, _ := time.ParseInLocation(timeLayout+" 15:04:05", reportDateb+" 00:00:00", loc)
  3612. report_date := location.Unix()
  3613. detectionResultb := dataBody["detection_resultb"].(string)
  3614. detectionUnit := dataBody["detection_unit"].(string)
  3615. sort := dataBody["sort"].(string)
  3616. pass_examination := int64(dataBody["pass_examination"].(float64))
  3617. modifications := int64(dataBody["modifications"].(float64))
  3618. adminUserInfo := this.GetAdminUserInfo()
  3619. orgId := adminUserInfo.CurrentOrgId
  3620. hadWater := models.XtDevicePh{
  3621. SamplingDate: samp_date,
  3622. Specimenb: specimentb,
  3623. ConcentrateNoc: concentratec,
  3624. ConcentratebNod: concentraeb,
  3625. SamplingLocationb: samplinglocationb,
  3626. DetectionUnit: detectionUnit,
  3627. Samplerb: samplerb,
  3628. ReportingDateb: report_date,
  3629. DetectionResultb: detectionResultb,
  3630. Sort: sort,
  3631. PassExamination: pass_examination,
  3632. Modifications: modifications,
  3633. }
  3634. err = service.UpdateDivicePh(id, orgId, &hadWater)
  3635. if err != nil {
  3636. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCreateConfig)
  3637. return
  3638. }
  3639. this.ServeSuccessJSON(map[string]interface{}{
  3640. "hadWater": hadWater,
  3641. })
  3642. }
  3643. func (this *MachineApiController) DeleteOxygenates() {
  3644. id, _ := this.GetInt64("id")
  3645. err := service.DeleteOxygenates(id)
  3646. fmt.Println(err)
  3647. returnData := make(map[string]interface{}, 0)
  3648. returnData["msg"] = "ok"
  3649. this.ServeSuccessJSON(returnData)
  3650. return
  3651. }
  3652. func (this *MachineApiController) DeleteHadWater() {
  3653. id, _ := this.GetInt64("id")
  3654. err := service.DeleteHadWater(id)
  3655. fmt.Println(err)
  3656. returnData := make(map[string]interface{}, 0)
  3657. returnData["msg"] = "ok"
  3658. this.ServeSuccessJSON(returnData)
  3659. return
  3660. }
  3661. func (this *MachineApiController) DeleteWater() {
  3662. id, _ := this.GetInt64("id")
  3663. err := service.DeleteWater(id)
  3664. fmt.Println(err)
  3665. returnData := make(map[string]interface{}, 0)
  3666. returnData["msg"] = "ok"
  3667. this.ServeSuccessJSON(returnData)
  3668. return
  3669. }
  3670. func (this *MachineApiController) DeleteDevicePh() {
  3671. id, _ := this.GetInt64("id")
  3672. err := service.DeleteDevicePh(id)
  3673. fmt.Println(err)
  3674. returnData := make(map[string]interface{}, 0)
  3675. returnData["msg"] = "ok"
  3676. this.ServeSuccessJSON(returnData)
  3677. return
  3678. }