manage_api_controller.go 139KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134
  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. fmt.Print("eid-------", eid)
  979. dataBody := make(map[string]interface{}, 0)
  980. err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
  981. //fmt.Println("错误是", err)
  982. adminUserInfo := this.GetAdminUserInfo()
  983. orgid := adminUserInfo.CurrentOrgId
  984. id := int64(dataBody["id"].(float64))
  985. fmt.Println("id", id)
  986. date := dataBody["date"].(string)
  987. timeLayout := "2006-01-02"
  988. loc, _ := time.LoadLocation("Local")
  989. theTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", date+" 00:00:00", loc)
  990. startdate := theTime.Unix()
  991. //fmt.Println("日期", startdate)
  992. classtype := int64(dataBody["classtype"].(float64))
  993. //fmt.Println("班次", classtype)
  994. zone := int64(dataBody["zone"].(float64))
  995. //fmt.Println("分区", zone)
  996. bednumber := int64(dataBody["bed_number"].(float64))
  997. //fmt.Println("床位号", bednumber)
  998. number, err := service.GetNumbers(bednumber, orgid)
  999. patient_time := int64(dataBody["patient_id"].(float64))
  1000. //fmt.Println("患者", patient_time)
  1001. contagion := dataBody["contagion"].(string)
  1002. //fmt.Println("传染病", contagion)
  1003. dialysis_mode := int64(dataBody["dialysis_mode"].(float64))
  1004. //fmt.Println("透析方式", dialysis_mode)
  1005. startDateStr := dataBody["start_time"].(string)
  1006. //fmt.Println("上机时间", startDateStr)
  1007. startDate, _ := utils.ParseTimeStringToTime("2006-01-02 15:04", startDateStr)
  1008. //fmt.Println("上机时间", startDate.Unix())
  1009. endDateStr := dataBody["end_time"].(string)
  1010. endDate, _ := utils.ParseTimeStringToTime("2006-01-02 15:04", endDateStr)
  1011. //fmt.Println("下机时间", endDate.Unix())
  1012. dialysis_time := dataBody["dialysis_time"].(string)
  1013. //fmt.Println("透析时长", dialysis_time)
  1014. //hyperfiletration := dataBody["hyperfiltratio"].(string)
  1015. hyperfiletration := dataBody["hyperfiltratio"].(float64)
  1016. //hyperfiletration := strconv.FormatInt(hyperfiltratios, 10)
  1017. fmt.Println("实际超滤量", hyperfiletration)
  1018. //weight_loss := dataBody["weight_loss"].(string)
  1019. weight_loss := dataBody["weight_loss"].(float64)
  1020. //weight_loss := strconv.FormatInt(weightloss, 10)
  1021. fmt.Println("体重减少", weight_loss)
  1022. warining_value := dataBody["warning_value"].(string)
  1023. fmt.Println("预警值", warining_value)
  1024. //user_total := dataBody["user_total"].(string)
  1025. //fmt.Println("使用次数",user_total)
  1026. usertotal := int64(dataBody["user_total"].(float64))
  1027. user_total := strconv.FormatInt(usertotal, 10)
  1028. run := int64(dataBody["run"].(float64))
  1029. //fmt.Println("运行", run)
  1030. failure_stage := int64(dataBody["failure_stage"].(float64))
  1031. //fmt.Println("故事发生阶段", failure_stage)
  1032. falult_desciription := dataBody["fault_description"].(string)
  1033. //fmt.Println("故障描述", falult_desciription)
  1034. code_information := dataBody["code_information"].(string)
  1035. //fmt.Println("故障提示及代码", code_information)
  1036. //机器消毒
  1037. disinfect_type := int64(dataBody["disinfect_type"].(float64))
  1038. //fmt.Println("消毒方式", disinfect_type)
  1039. disinfectant_type := int64(dataBody["disinfectant_type"].(float64))
  1040. //fmt.Println("消毒液", disinfectant_type)
  1041. disinfection := int64(dataBody["disinfection"].(float64))
  1042. //fmt.Println("消毒状态", disinfection)
  1043. machine_run := int64(dataBody["machine_run"].(float64))
  1044. //fmt.Println("运行", machine_run)
  1045. //液路
  1046. fluid_path := int64(dataBody["fluid_path"].(float64))
  1047. //fmt.Println("液路消毒方式", fluid_path)
  1048. disinfectant := int64(dataBody["disinfectant"].(float64))
  1049. //fmt.Println("消毒液", disinfectant)
  1050. disinfection_status := int64(dataBody["disinfection_status"].(float64))
  1051. //fmt.Println("消毒状态", disinfection_status)
  1052. disinfection_residue := int64(dataBody["disinfection_residue"].(float64))
  1053. //fmt.Println("消毒液残留", disinfection_residue)
  1054. longtime := dataBody["longtime"].(string)
  1055. //fmt.Println("消毒时长", longtime)
  1056. start_DateStr := dataBody["starttime"].(string)
  1057. //fmt.Println("出发时间", startDateStr)
  1058. start_Date, _ := utils.ParseTimeStringToTime("2006-01-02 15:04", start_DateStr)
  1059. //fmt.Println("触发事件", start_Date.Unix())
  1060. end_DateStr := dataBody["endtime"].(string)
  1061. //fmt.Println("出发时间", startDateStr)
  1062. end_Date, _ := utils.ParseTimeStringToTime("2006-01-02 15:04", end_DateStr)
  1063. //fmt.Println("触发事件", end_Date.Unix())
  1064. dialysis_checked := int64(dataBody["dialysis_checked"].(float64))
  1065. //fmt.Println("更换", dialysis_checked)
  1066. dialysis_name := int64(dataBody["dialysis_name"].(float64))
  1067. //fmt.Println("名称", dialysis_name)
  1068. norms := dataBody["norms"].(string)
  1069. //fmt.Println("规格", norms)
  1070. dialysis_concentration := int64(dataBody["dialysis_concentration"].(float64))
  1071. //fmt.Println("浓度", dialysis_concentration)
  1072. germ_checked := int64(dataBody["germ_checked"].(float64))
  1073. //fmt.Println("更换", germ_checked)
  1074. germ_name := int64(dataBody["germ_name"].(float64))
  1075. //fmt.Println("名称", germ_name)
  1076. germ_number := dataBody["germ_number"].(string)
  1077. //fmt.Println("数量", germ_number)
  1078. clean := int64(dataBody["clean"].(float64))
  1079. //fmt.Println("清洁", clean)
  1080. sign_name := int64(dataBody["sign_name"].(float64))
  1081. //fmt.Println("签名", sign_name)
  1082. information, errinfor := service.GetInformation(eid, startdate, orgid)
  1083. fmt.Print("errinfor", errinfor)
  1084. fmt.Print("information", information)
  1085. if errinfor == gorm.ErrRecordNotFound {
  1086. infor := models.DeviceInformation{
  1087. Date: startdate,
  1088. Class: classtype,
  1089. // Zone: zone,
  1090. BedNumber: bednumber,
  1091. PatientId: patient_time,
  1092. Contagion: contagion,
  1093. DialysisMode: dialysis_mode,
  1094. StartTime: startDate.Unix(),
  1095. EndTime: endDate.Unix(),
  1096. DialysisHour: dialysis_time,
  1097. Hyperfiltratio: hyperfiletration,
  1098. WeightLoss: weight_loss,
  1099. WarningValue: warining_value,
  1100. UserTotal: user_total,
  1101. Move: run,
  1102. FailureStage: failure_stage,
  1103. FaultDescription: falult_desciription,
  1104. CodeInformation: code_information,
  1105. DisinfectantType: disinfectant_type,
  1106. DisinfectType: disinfect_type,
  1107. Disinfection: disinfection,
  1108. MachineRun: machine_run,
  1109. FluidPath: fluid_path,
  1110. Disinfectant: disinfectant,
  1111. DisinfectionStatus: disinfection_status,
  1112. DisinfectionResidue: disinfection_residue,
  1113. LongTime: longtime,
  1114. DisinfecStartime: start_Date.Unix(),
  1115. DisinfecEndtime: end_Date.Unix(),
  1116. DialysisChecked: dialysis_checked,
  1117. DialysisName: dialysis_name,
  1118. Norms: norms,
  1119. DialysisConcentration: dialysis_concentration,
  1120. GermChecked: germ_checked,
  1121. GermName: germ_name,
  1122. GermNumber: germ_number,
  1123. Clean: clean,
  1124. SignName: sign_name,
  1125. Ctime: time.Now().Unix(),
  1126. Status: 1,
  1127. UserOrgId: orgid,
  1128. EquimentId: eid,
  1129. Bed: number.Number,
  1130. Stime: startdate,
  1131. }
  1132. err = service.CreateUserInformation(&infor)
  1133. fmt.Println("使用登记错误是什么", err)
  1134. this.ServeSuccessJSON(map[string]interface{}{
  1135. "information": infor,
  1136. })
  1137. } else if errinfor == nil {
  1138. infor := models.DeviceInformation{
  1139. Date: startdate,
  1140. Class: classtype,
  1141. Zone: zone,
  1142. BedNumber: bednumber,
  1143. PatientId: patient_time,
  1144. Contagion: contagion,
  1145. DialysisMode: dialysis_mode,
  1146. StartTime: startDate.Unix(),
  1147. EndTime: endDate.Unix(),
  1148. DialysisHour: dialysis_time,
  1149. Hyperfiltratio: hyperfiletration,
  1150. WeightLoss: weight_loss,
  1151. WarningValue: warining_value,
  1152. UserTotal: user_total,
  1153. Move: run,
  1154. FailureStage: failure_stage,
  1155. FaultDescription: falult_desciription,
  1156. CodeInformation: code_information,
  1157. DisinfectantType: disinfectant_type,
  1158. DisinfectType: disinfect_type,
  1159. Disinfection: disinfection,
  1160. MachineRun: machine_run,
  1161. FluidPath: fluid_path,
  1162. Disinfectant: disinfectant,
  1163. DisinfectionStatus: disinfection_status,
  1164. DisinfectionResidue: disinfection_residue,
  1165. LongTime: longtime,
  1166. DisinfecStartime: start_Date.Unix(),
  1167. DisinfecEndtime: end_Date.Unix(),
  1168. DialysisChecked: dialysis_checked,
  1169. DialysisName: dialysis_name,
  1170. Norms: norms,
  1171. DialysisConcentration: dialysis_concentration,
  1172. GermChecked: germ_checked,
  1173. GermName: germ_name,
  1174. GermNumber: germ_number,
  1175. Clean: clean,
  1176. SignName: sign_name,
  1177. Ctime: time.Now().Unix(),
  1178. Status: 1,
  1179. UserOrgId: orgid,
  1180. EquimentId: eid,
  1181. Bed: number.Number,
  1182. }
  1183. informationdata, err := service.GetLastInformationdata(eid, startdate, orgid)
  1184. fmt.Print("informationdata----", informationdata.ID)
  1185. errors := service.UpadateForm(informationdata.ID, orgid, &infor)
  1186. //fmt.Print("报错", errors)
  1187. if errors != nil {
  1188. this.ServeFailJsonSend(enums.ErrorCodeDBDelete, "查询失败:("+err.Error()+")")
  1189. return
  1190. }
  1191. this.ServeSuccessJSON(map[string]interface{}{
  1192. "infor": infor,
  1193. })
  1194. } else {
  1195. }
  1196. }
  1197. func (this *MachineApiController) ChangePatient() {
  1198. adminUser := this.GetAdminUserInfo()
  1199. orgid := adminUser.CurrentOrgId
  1200. fmt.Println("机构id", orgid)
  1201. equitid, _ := this.GetInt64("equitid")
  1202. fmt.Println("equitid", equitid)
  1203. id, _ := this.GetInt64("id")
  1204. fmt.Println("id", id)
  1205. }
  1206. func (this *MachineApiController) GetRegisterInfo() {
  1207. timeStr := time.Now().Format("2006-01-02")
  1208. timeLayout := "2006-01-02 15:04:05"
  1209. //fmt.Println("timeStr:", timeStr)
  1210. timeStringToTime, _ := utils.ParseTimeStringToTime(timeLayout, timeStr+" 00:00:00")
  1211. timenow := timeStringToTime.Unix()
  1212. //fmt.Println("timenow是什么", timenow)
  1213. adminUser := this.GetAdminUserInfo()
  1214. orgid := adminUser.CurrentOrgId
  1215. appid := adminUser.CurrentAppId
  1216. id, _ := this.GetInt64("id")
  1217. //fmt.Println("设备id", id)
  1218. information, err := service.GetRegisterInfo(orgid, id, timenow)
  1219. fmt.Print("错误", err)
  1220. role, err := service.GetSignName(information.SignName, orgid, appid)
  1221. dislysis, _ := service.GetDialysisTime(timenow, information.PatientId, orgid)
  1222. //if err != nil {
  1223. // // this.ServeFailJsonSend(enums.ErrorCodeDBDelete, "查询失败:("+err.Error()+")")
  1224. // // return
  1225. // //}
  1226. this.ServeSuccessJSON(map[string]interface{}{
  1227. "information": information,
  1228. "role": role,
  1229. "dislysis": dislysis,
  1230. })
  1231. }
  1232. func (this *MachineApiController) GetInformationData() {
  1233. limit, _ := this.GetInt64("limit")
  1234. //fmt.Println("limit2", limit)
  1235. page, _ := this.GetInt64("page")
  1236. //fmt.Println("page", page)
  1237. adminUser := this.GetAdminUserInfo()
  1238. orgId := adminUser.CurrentOrgId
  1239. information, total, err := service.GetInformationData(limit, page, orgId)
  1240. if err != nil {
  1241. this.ServeFailJsonSend(enums.ErrorCodeDBDelete, "查询失败:("+err.Error()+")")
  1242. return
  1243. }
  1244. this.ServeSuccessJSON(map[string]interface{}{
  1245. "information": information,
  1246. "total": total,
  1247. })
  1248. }
  1249. func (this *MachineApiController) GetOrgName() {
  1250. adminUser := this.GetAdminUserInfo()
  1251. orgid := adminUser.CurrentOrgId
  1252. org, err := service.GetOrgName(orgid)
  1253. if err != nil {
  1254. this.ServeFailJsonSend(enums.ErrorCodeDBDelete, "查询失败:("+err.Error()+")")
  1255. return
  1256. }
  1257. this.ServeSuccessJSON(map[string]interface{}{
  1258. "org": org,
  1259. })
  1260. }
  1261. func (this *MachineApiController) SaveBacteria() {
  1262. id, _ := this.GetInt64("id")
  1263. addmacher, _ := service.GetBedId(id)
  1264. adminUserInfo := this.GetAdminUserInfo()
  1265. orgid := adminUserInfo.CurrentOrgId
  1266. dataBody := make(map[string]interface{}, 0)
  1267. err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
  1268. date := dataBody["date"].(string)
  1269. timeLayout := "2006-01-02"
  1270. loc, _ := time.LoadLocation("Local")
  1271. theTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", date+" 00:00:00", loc)
  1272. state_date := theTime.Unix()
  1273. specimen := int64(dataBody["specimen"].(float64))
  1274. cona := dataBody["concentrate_noa"].(string)
  1275. conb := dataBody["concentrate_nob"].(string)
  1276. samplingLoactiona := int64(dataBody["sampling_locationa"].(float64))
  1277. detectionUnit := dataBody["detection_unit"].(string)
  1278. sampler := int64(dataBody["sampler"].(float64))
  1279. reportDate := dataBody["reporting_date"].(string)
  1280. reportTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", reportDate+" 00:00:00", loc)
  1281. repDate := reportTime.Unix()
  1282. detectionResult := dataBody["detection_result"].(string)
  1283. sort := dataBody["sort"].(string)
  1284. examination := dataBody["pass_examination"].(string)
  1285. pass_examination, err := strconv.ParseInt(examination, 10, 64)
  1286. modifications := int64(dataBody["modifications"].(float64))
  1287. culture := models.DeviceCulture{
  1288. BedId: addmacher.BedId,
  1289. SpelingDate: state_date,
  1290. Specimen: specimen,
  1291. ConcentrateNoa: cona,
  1292. ConcentrateNob: conb,
  1293. SamplingLocationa: samplingLoactiona,
  1294. DetectionUnit: detectionUnit,
  1295. Sampler: sampler,
  1296. ReportingDate: repDate,
  1297. DetectionResult: detectionResult,
  1298. Ctime: time.Now().Unix(),
  1299. Status: 1,
  1300. UserOrgId: orgid,
  1301. EquitmentId: id,
  1302. Bed: addmacher.BedNumber,
  1303. Sort: sort,
  1304. PassExamination: pass_examination,
  1305. Modifications: modifications,
  1306. }
  1307. err = service.CreateCulture(&culture)
  1308. //fmt.Println("创建细菌检测", err)
  1309. if err != nil {
  1310. this.ServeFailJsonSend(enums.ErrorCodeDBDelete, "添加失败:("+err.Error()+")")
  1311. return
  1312. }
  1313. this.ServeSuccessJSON(map[string]interface{}{
  1314. "culture": culture,
  1315. })
  1316. }
  1317. func (this *MachineApiController) SaveLinconmycin() {
  1318. timeLayout := "2006-01-02"
  1319. loc, _ := time.LoadLocation("Local")
  1320. id, _ := this.GetInt64("id")
  1321. addmacher, _ := service.GetBedId(id)
  1322. adminUserInfo := this.GetAdminUserInfo()
  1323. orgid := adminUserInfo.CurrentOrgId
  1324. dataBody := make(map[string]interface{}, 0)
  1325. err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
  1326. date := dataBody["sampling_date"].(string)
  1327. theTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", date+" 00:00:00", loc)
  1328. samp_date := theTime.Unix()
  1329. specimen := int64(dataBody["specimenb"].(float64))
  1330. cona := dataBody["concentrate_noc"].(string)
  1331. conb := dataBody["concentrateb_nod"].(string)
  1332. samplinglocationb := int64(dataBody["sampling_locationb"].(float64))
  1333. detectionUnit := dataBody["detection_unit"].(string)
  1334. samplerb := int64(dataBody["samplerb"].(float64))
  1335. reportDate := dataBody["reporting_dateb"].(string)
  1336. reportTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", reportDate+" 00:00:00", loc)
  1337. repDate := reportTime.Unix()
  1338. detectionResult := dataBody["detection_resultb"].(string)
  1339. sort := dataBody["sort"].(string)
  1340. modifications := int64(dataBody["modifications"].(float64))
  1341. examination := dataBody["pass_examination"].(string)
  1342. pass_examination, _ := strconv.ParseInt(examination, 10, 64)
  1343. dialysate := models.DeviceDialysate{
  1344. SamplingDate: samp_date,
  1345. Specimenb: specimen,
  1346. ConcentrateNoc: cona,
  1347. ConcentratebNod: conb,
  1348. SamplingLocationb: samplinglocationb,
  1349. DetectionUnit: detectionUnit,
  1350. Samplerb: samplerb,
  1351. ReportingDateb: repDate,
  1352. DetectionResultb: detectionResult,
  1353. Ctime: time.Now().Unix(),
  1354. Status: 1,
  1355. UserOrgId: orgid,
  1356. BedId: addmacher.BedId,
  1357. EquitmentId: id,
  1358. Bed: addmacher.BedNumber,
  1359. Sort: sort,
  1360. PassExamination: pass_examination,
  1361. Modifications: modifications,
  1362. }
  1363. err = service.CreateDialysate(&dialysate)
  1364. //fmt.Println("报错", err)
  1365. if err != nil {
  1366. this.ServeFailJsonSend(enums.ErrorCodeDBDelete, "添加失败:("+err.Error()+")")
  1367. return
  1368. }
  1369. this.ServeSuccessJSON(map[string]interface{}{
  1370. "dialysate": dialysate,
  1371. })
  1372. }
  1373. func (this *MachineApiController) SaveQualityControl() {
  1374. id, _ := this.GetInt64("id")
  1375. addmacher, _ := service.GetBedId(id)
  1376. adminUserInfo := this.GetAdminUserInfo()
  1377. orgid := adminUserInfo.CurrentOrgId
  1378. dataBody := make(map[string]interface{}, 0)
  1379. err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
  1380. timeLayout := "2006-01-02"
  1381. loc, _ := time.LoadLocation("Local")
  1382. // 透析液离子浓度检测
  1383. dateb := dataBody["dateb"].(string)
  1384. inLocation, _ := time.ParseInLocation(timeLayout+" 15:04:05", dateb+" 00:00:00", loc)
  1385. dateB := inLocation.Unix()
  1386. samplerc := int64(dataBody["samplerc"].(float64))
  1387. concentratenof := dataBody["concentrate_nof"].(string)
  1388. concentrateonog := dataBody["concentrate_nog"].(string)
  1389. dateReportc := dataBody["date_reportc"].(string)
  1390. parseInLocation, _ := time.ParseInLocation(timeLayout+" 15:04:05", dateReportc+" 00:00:00", loc)
  1391. datec := parseInLocation.Unix()
  1392. actualNa := dataBody["actual_na"].(string)
  1393. actualPna := dataBody["actual_pna"].(string)
  1394. actualK := dataBody["actual_k"].(string)
  1395. actualCa := dataBody["actual_ca"].(string)
  1396. actualCi := dataBody["actual_ci"].(string)
  1397. actualHco := dataBody["actual_hco"].(string)
  1398. actualMg := dataBody["actual_mg"].(string)
  1399. actulaPH := dataBody["actual_ph"].(string)
  1400. remakes := dataBody["remakes"].(string)
  1401. detectionUnit := dataBody["detection_unit"].(string)
  1402. sort := dataBody["sort"].(string)
  1403. modifications := int64(dataBody["modifications"].(float64))
  1404. examination := dataBody["pass_examination"].(string)
  1405. pass_examination, _ := strconv.ParseInt(examination, 10, 64)
  1406. ion := models.DeviceIon{
  1407. SamplingDate: dateB,
  1408. Samplerc: samplerc,
  1409. DetectionUnit: detectionUnit,
  1410. ConcentrateNof: concentratenof,
  1411. ConcentrateNog: concentrateonog,
  1412. DateReportc: datec,
  1413. ActualNa: actualNa,
  1414. ActualPna: actualPna,
  1415. ActualK: actualK,
  1416. ActualCa: actualCa,
  1417. ActualCi: actualCi,
  1418. ActualHco: actualHco,
  1419. ActualMg: actualMg,
  1420. ActualPh: actulaPH,
  1421. Remakes: remakes,
  1422. EquitmentId: id,
  1423. Status: 1,
  1424. UserOrgId: orgid,
  1425. Ctime: time.Now().Unix(),
  1426. BedId: addmacher.BedId,
  1427. Bed: addmacher.BedNumber,
  1428. Sort: sort,
  1429. PassExamination: pass_examination,
  1430. Modifications: modifications,
  1431. }
  1432. createIon := service.CreateIon(&ion)
  1433. fmt.Println("报错", createIon)
  1434. if err != nil {
  1435. this.ServeFailJsonSend(enums.ErrorCodeDBDelete, "添加失败:("+err.Error()+")")
  1436. return
  1437. }
  1438. this.ServeSuccessJSON(map[string]interface{}{
  1439. "ion": ion,
  1440. })
  1441. }
  1442. func (this *MachineApiController) GetAllQulityInfo() {
  1443. adminUser := this.GetAdminUserInfo()
  1444. orgID := adminUser.CurrentOrgId
  1445. cultures, err := service.GetAllCulture(orgID)
  1446. dialysate, _ := service.GetAllDialysate(orgID)
  1447. ions, _ := service.GetAllDeviceIon(orgID)
  1448. oxygenates, _ := service.GetAllDeviceOxygenates(orgID)
  1449. water, err := service.GetAllHadWater(orgID)
  1450. deviceWater, err := service.GetDeviceWater(orgID)
  1451. devicePh, err := service.GetDevicePH(orgID)
  1452. if err != nil {
  1453. this.ServeFailJsonSend(enums.ErrorCodeDBDelete, "添加失败:("+err.Error()+")")
  1454. return
  1455. }
  1456. this.ServeSuccessJSON(map[string]interface{}{
  1457. "cultures": cultures,
  1458. "dialysate": dialysate,
  1459. "ions": ions,
  1460. "oxygenates": oxygenates,
  1461. "hadwater": water,
  1462. "deviceWater": deviceWater,
  1463. "devicePh": devicePh,
  1464. })
  1465. }
  1466. func (this *MachineApiController) EditCulture() {
  1467. id, _ := this.GetInt64("id")
  1468. //fmt.Println("id", id)
  1469. userid, _ := this.GetInt64("userid")
  1470. //fmt.Println("userid", userid)
  1471. role, _ := service.GetSampler(userid)
  1472. culture, err := service.GetCultureById(id)
  1473. if err != nil {
  1474. this.ServeFailJsonSend(enums.ErrorCodeDBDelete, "查询失败:("+err.Error()+")")
  1475. return
  1476. }
  1477. this.ServeSuccessJSON(map[string]interface{}{
  1478. "culture": culture,
  1479. "role": role,
  1480. })
  1481. }
  1482. func (this *MachineApiController) UpdateCulture() {
  1483. dataBody := make(map[string]interface{}, 0)
  1484. err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
  1485. id := int64(dataBody["id"].(float64))
  1486. date := dataBody["date"].(string)
  1487. timeLayout := "2006-01-02"
  1488. loc, _ := time.LoadLocation("Local")
  1489. theTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", date+" 00:00:00", loc)
  1490. state_date := theTime.Unix()
  1491. specimen := int64(dataBody["specimen"].(float64))
  1492. cona := dataBody["concentrate_noa"].(string)
  1493. conb := dataBody["concentrate_nob"].(string)
  1494. samplingLoactiona := int64(dataBody["sampling_locationa"].(float64))
  1495. detectionUnit := dataBody["detection_unit"].(string)
  1496. sampler := int64(dataBody["sampler"].(float64))
  1497. reportDate := dataBody["reporting_date"].(string)
  1498. reportTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", reportDate+" 00:00:00", loc)
  1499. repDate := reportTime.Unix()
  1500. detectionResult := dataBody["detection_result"].(string)
  1501. sort := dataBody["sort"].(string)
  1502. pass_examination := int64(dataBody["pass_examination"].(float64))
  1503. modifications := int64(dataBody["modifications"].(float64))
  1504. adminUser := this.GetAdminUserInfo()
  1505. orgId := adminUser.CurrentOrgId
  1506. culture := models.DeviceCulture{
  1507. SpelingDate: state_date,
  1508. Specimen: specimen,
  1509. ConcentrateNoa: cona,
  1510. ConcentrateNob: conb,
  1511. SamplingLocationa: samplingLoactiona,
  1512. DetectionUnit: detectionUnit,
  1513. Sampler: sampler,
  1514. ReportingDate: repDate,
  1515. DetectionResult: detectionResult,
  1516. Sort: sort,
  1517. PassExamination: pass_examination,
  1518. Modifications: modifications,
  1519. }
  1520. err = service.UpdateCulture(id, orgId, &culture)
  1521. if err != nil {
  1522. this.ServeFailJsonSend(enums.ErrorCodeDBDelete, "查询失败:("+err.Error()+")")
  1523. return
  1524. }
  1525. this.ServeSuccessJSON(map[string]interface{}{
  1526. "culture": culture,
  1527. })
  1528. }
  1529. func (this *MachineApiController) DeleteCultrue() {
  1530. adminUserInfo := this.GetAdminUserInfo()
  1531. OrgID := adminUserInfo.CurrentOrgId
  1532. dataBody := make(map[string]interface{}, 0)
  1533. err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
  1534. if err != nil {
  1535. utils.ErrorLog(err.Error())
  1536. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "参数错误")
  1537. return
  1538. }
  1539. idsInters := dataBody["ids"].([]interface{})
  1540. if len(idsInters) == 0 {
  1541. if err != nil {
  1542. this.ServeFailJsonSend(enums.ErrorCodeDBDelete, "删除会员失败:(没有选择会员)")
  1543. return
  1544. }
  1545. }
  1546. ids := make([]int64, 0)
  1547. for _, idsInter := range idsInters {
  1548. id := int64(idsInter.(float64))
  1549. ids = append(ids, id)
  1550. }
  1551. fmt.Println("ids", ids)
  1552. err = service.DeleteCultrue(OrgID, ids)
  1553. fmt.Println("err", err)
  1554. if err != nil {
  1555. this.ServeFailJsonSend(enums.ErrorCodeDBDelete, "删除失败:("+err.Error()+")")
  1556. return
  1557. }
  1558. returnData := make(map[string]interface{}, 0)
  1559. returnData["msg"] = "ok"
  1560. this.ServeSuccessJSON(returnData)
  1561. return
  1562. }
  1563. func (this *MachineApiController) EditDialystate() {
  1564. id, _ := this.GetInt64("id")
  1565. fmt.Println("id是什么", id)
  1566. dialysate, err := service.GetDialystate(id)
  1567. if err != nil {
  1568. this.ServeFailJsonSend(enums.ErrorCodeDBDelete, "查询失败:("+err.Error()+")")
  1569. return
  1570. }
  1571. this.ServeSuccessJSON(map[string]interface{}{
  1572. "dialysate": dialysate,
  1573. })
  1574. }
  1575. func (this *MachineApiController) Updatedialystate() {
  1576. timeLayout := "2006-01-02"
  1577. loc, _ := time.LoadLocation("Local")
  1578. dataBody := make(map[string]interface{}, 0)
  1579. err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
  1580. fmt.Println("err", err)
  1581. id := int64(dataBody["id"].(float64))
  1582. fmt.Println("id", id)
  1583. samplingDate := dataBody["sampling_date"].(string)
  1584. sampdate, _ := time.ParseInLocation(timeLayout+" 15:04:05", samplingDate+" 00:00:00", loc)
  1585. samp_date := sampdate.Unix()
  1586. fmt.Println("取样日期", samp_date)
  1587. specimentb := int64(dataBody["specimenb"].(float64))
  1588. fmt.Println("取样标本", specimentb)
  1589. concentratec := dataBody["concentrate_noc"].(string)
  1590. fmt.Println("A浓缩液批号", concentratec)
  1591. concentraeb := dataBody["concentrateb_nod"].(string)
  1592. fmt.Println("B浓缩", concentraeb)
  1593. samplinglocationb := int64(dataBody["sampling_locationb"].(float64))
  1594. fmt.Println("采样部位", samplinglocationb)
  1595. samplerb := int64(dataBody["samplerb"].(float64))
  1596. fmt.Println("取样者", samplerb)
  1597. reportDateb := dataBody["reporting_dateb"].(string)
  1598. //fmt.Println("日期", reportDateb)
  1599. location, _ := time.ParseInLocation(timeLayout+" 15:04:05", reportDateb+" 00:00:00", loc)
  1600. report_date := location.Unix()
  1601. fmt.Println("出报告2日期", report_date)
  1602. detectionResultb := dataBody["detection_resultb"].(string)
  1603. fmt.Println("检测结果", detectionResultb)
  1604. detectionUnit := dataBody["detection_unit"].(string)
  1605. fmt.Println("检测单位", detectionUnit)
  1606. sort := dataBody["sort"].(string)
  1607. pass_examination := int64(dataBody["pass_examination"].(float64))
  1608. modifications := int64(dataBody["modifications"].(float64))
  1609. adminUser := this.GetAdminUserInfo()
  1610. orgid := adminUser.CurrentOrgId
  1611. dialysate := models.DeviceDialysate{
  1612. SamplingDate: samp_date,
  1613. Specimenb: specimentb,
  1614. ConcentrateNoc: concentratec,
  1615. ConcentratebNod: concentraeb,
  1616. SamplingLocationb: samplinglocationb,
  1617. DetectionUnit: detectionUnit,
  1618. Samplerb: samplerb,
  1619. ReportingDateb: report_date,
  1620. DetectionResultb: detectionResultb,
  1621. Sort: sort,
  1622. PassExamination: pass_examination,
  1623. Modifications: modifications,
  1624. }
  1625. err = service.Updatedialystate(id, orgid, &dialysate)
  1626. if err != nil {
  1627. this.ServeFailJsonSend(enums.ErrorCodeDBDelete, "查询失败:("+err.Error()+")")
  1628. return
  1629. }
  1630. this.ServeSuccessJSON(map[string]interface{}{
  1631. "dialysate": dialysate,
  1632. })
  1633. }
  1634. func (this *MachineApiController) DeleteDialystate() {
  1635. adminUserInfo := this.GetAdminUserInfo()
  1636. OrgID := adminUserInfo.CurrentOrgId
  1637. dataBody := make(map[string]interface{}, 0)
  1638. err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
  1639. if err != nil {
  1640. utils.ErrorLog(err.Error())
  1641. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "参数错误")
  1642. return
  1643. }
  1644. idsInters := dataBody["ids"].([]interface{})
  1645. if len(idsInters) == 0 {
  1646. if err != nil {
  1647. this.ServeFailJsonSend(enums.ErrorCodeDBDelete, "删除会员失败:(没有选择会员)")
  1648. return
  1649. }
  1650. }
  1651. ids := make([]int64, 0)
  1652. for _, idsInter := range idsInters {
  1653. id := int64(idsInter.(float64))
  1654. ids = append(ids, id)
  1655. }
  1656. fmt.Println("ids", ids)
  1657. err = service.DeleteDialystate(OrgID, ids)
  1658. fmt.Println("err", err)
  1659. if err != nil {
  1660. this.ServeFailJsonSend(enums.ErrorCodeDBDelete, "删除失败:("+err.Error()+")")
  1661. return
  1662. }
  1663. returnData := make(map[string]interface{}, 0)
  1664. returnData["msg"] = "ok"
  1665. this.ServeSuccessJSON(returnData)
  1666. return
  1667. }
  1668. func (this *MachineApiController) Edition() {
  1669. id, _ := this.GetInt64("id")
  1670. fmt.Println("id", id)
  1671. ion, err := service.GetIon(id)
  1672. if err != nil {
  1673. this.ServeFailJsonSend(enums.ErrorCodeDBDelete, "查询失败:("+err.Error()+")")
  1674. return
  1675. }
  1676. this.ServeSuccessJSON(map[string]interface{}{
  1677. "ion": ion,
  1678. })
  1679. }
  1680. func (this *MachineApiController) UpdateIon() {
  1681. timeLayout := "2006-01-02"
  1682. loc, _ := time.LoadLocation("Local")
  1683. dataBody := make(map[string]interface{}, 0)
  1684. err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
  1685. fmt.Println("err", err)
  1686. id := int64(dataBody["id"].(float64))
  1687. fmt.Println("id", id)
  1688. dateb := dataBody["dateb"].(string)
  1689. inLocation, _ := time.ParseInLocation(timeLayout+" 15:04:05", dateb+" 00:00:00", loc)
  1690. dateB := inLocation.Unix()
  1691. samplerc := int64(dataBody["samplerc"].(float64))
  1692. concentratenof := dataBody["concentrate_nof"].(string)
  1693. concentrateonog := dataBody["concentrate_nog"].(string)
  1694. dateReportc := dataBody["date_reportc"].(string)
  1695. parseInLocation, _ := time.ParseInLocation(timeLayout+" 15:04:05", dateReportc+" 00:00:00", loc)
  1696. datec := parseInLocation.Unix()
  1697. actualNa := dataBody["actual_na"].(string)
  1698. actualPna := dataBody["actual_pna"].(string)
  1699. actualK := dataBody["actual_k"].(string)
  1700. actualCa := dataBody["actual_ca"].(string)
  1701. actualCi := dataBody["actual_ci"].(string)
  1702. actualHco := dataBody["actual_hco"].(string)
  1703. actualMg := dataBody["actual_mg"].(string)
  1704. actulaPH := dataBody["actual_ph"].(string)
  1705. remakes := dataBody["remakes"].(string)
  1706. detectionUnit := dataBody["detection_unit"].(string)
  1707. sort := dataBody["sort"].(string)
  1708. pass_examination := int64(dataBody["pass_examination"].(float64))
  1709. modifications := int64(dataBody["modifications"].(float64))
  1710. ion := models.DeviceIon{
  1711. SamplingDate: dateB,
  1712. Samplerc: samplerc,
  1713. DetectionUnit: detectionUnit,
  1714. ConcentrateNof: concentratenof,
  1715. ConcentrateNog: concentrateonog,
  1716. DateReportc: datec,
  1717. ActualNa: actualNa,
  1718. ActualPna: actualPna,
  1719. ActualK: actualK,
  1720. ActualCa: actualCa,
  1721. ActualCi: actualCi,
  1722. ActualHco: actualHco,
  1723. ActualMg: actualMg,
  1724. ActualPh: actulaPH,
  1725. Remakes: remakes,
  1726. Sort: sort,
  1727. PassExamination: pass_examination,
  1728. Modifications: modifications,
  1729. }
  1730. adminUser := this.GetAdminUserInfo()
  1731. orgId := adminUser.CurrentOrgId
  1732. err = service.UpdateIon(id, orgId, &ion)
  1733. if err != nil {
  1734. this.ServeFailJsonSend(enums.ErrorCodeDBDelete, "查询失败:("+err.Error()+")")
  1735. return
  1736. }
  1737. this.ServeSuccessJSON(map[string]interface{}{
  1738. "ion": ion,
  1739. })
  1740. }
  1741. func (this *MachineApiController) DeleteIon() {
  1742. adminUserInfo := this.GetAdminUserInfo()
  1743. OrgID := adminUserInfo.CurrentOrgId
  1744. dataBody := make(map[string]interface{}, 0)
  1745. err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
  1746. if err != nil {
  1747. utils.ErrorLog(err.Error())
  1748. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "参数错误")
  1749. return
  1750. }
  1751. idsInters := dataBody["ids"].([]interface{})
  1752. if len(idsInters) == 0 {
  1753. if err != nil {
  1754. this.ServeFailJsonSend(enums.ErrorCodeDBDelete, "删除会员失败:(没有选择会员)")
  1755. return
  1756. }
  1757. }
  1758. ids := make([]int64, 0)
  1759. for _, idsInter := range idsInters {
  1760. id := int64(idsInter.(float64))
  1761. ids = append(ids, id)
  1762. }
  1763. fmt.Println("ids", ids)
  1764. err = service.DeleteIon(OrgID, ids)
  1765. if err != nil {
  1766. this.ServeFailJsonSend(enums.ErrorCodeDBDelete, "删除失败:("+err.Error()+")")
  1767. return
  1768. }
  1769. returnData := make(map[string]interface{}, 0)
  1770. returnData["msg"] = "ok"
  1771. this.ServeSuccessJSON(returnData)
  1772. return
  1773. }
  1774. func (this *MachineApiController) GetQuery() {
  1775. timeLayout := "2006-01-02"
  1776. loc, _ := time.LoadLocation("Local")
  1777. adminUserInfo := this.GetAdminUserInfo()
  1778. OrgID := adminUserInfo.CurrentOrgId
  1779. fmt.Println("orgid", OrgID)
  1780. bedid, _ := this.GetInt64("bedid")
  1781. fmt.Println("bedid", bedid)
  1782. startime := this.GetString("startime")
  1783. fmt.Println("starttime", startime)
  1784. inLocation, _ := time.ParseInLocation(timeLayout+" 15:04:05", startime+" 00:00:00", loc)
  1785. start := inLocation.Unix()
  1786. fmt.Println("start", start)
  1787. endtime := this.GetString("endtime")
  1788. fmt.Println("endtime", endtime)
  1789. endLocation, _ := time.ParseInLocation(timeLayout+" 15:04:05", endtime+" 00:00:00", loc)
  1790. end := endLocation.Unix()
  1791. fmt.Println("end", end)
  1792. cultures, err := service.GetCultureData(bedid, start, end, OrgID)
  1793. fmt.Print(err)
  1794. dialysate, err := service.GetDialysateData(bedid, start, end, OrgID)
  1795. ions, err := service.GetDeviceIonData(bedid, start, end, OrgID)
  1796. oxygenates, err := service.GetOxygenates(bedid, start, end, OrgID)
  1797. hadwater, err := service.GetHardWater(bedid, start, end, OrgID)
  1798. water, err := service.GetWater(bedid, start, end, OrgID)
  1799. deviceph, err := service.GetDevicePh(bedid, start, end, OrgID)
  1800. if err != nil {
  1801. this.ServeFailJsonSend(enums.ErrorCodeDBDelete, "查询失败:("+err.Error()+")")
  1802. return
  1803. }
  1804. this.ServeSuccessJSON(map[string]interface{}{
  1805. "cultures": cultures,
  1806. "dialysate": dialysate,
  1807. "ions": ions,
  1808. "oxygenates": oxygenates,
  1809. "hadwater": hadwater,
  1810. "water": water,
  1811. "deviceph": deviceph,
  1812. })
  1813. }
  1814. func (this *MachineApiController) SaveRepair() {
  1815. timeLayout := "2006-01-02"
  1816. loc, _ := time.LoadLocation("Local")
  1817. adminUserInfo := this.GetAdminUserInfo()
  1818. id, _ := this.GetInt64("id")
  1819. fmt.Println("id", id)
  1820. addmacher, _ := service.GetBedId(id)
  1821. OrgID := adminUserInfo.CurrentOrgId
  1822. fmt.Println("orgid", OrgID)
  1823. dataBody := make(map[string]interface{}, 0)
  1824. err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
  1825. fmt.Println("err", err)
  1826. gua_date := dataBody["guarantee_date"].(string)
  1827. fmt.Println("保修日期", gua_date)
  1828. inLocation, _ := time.ParseInLocation(timeLayout+" 15:04:05", gua_date+" 00:00:00", loc)
  1829. guaDate := inLocation.Unix()
  1830. fmt.Println("保修日期", guaDate)
  1831. startDateStr := dataBody["start_time"].(string)
  1832. fmt.Println("出发时间", startDateStr)
  1833. startDate, _ := utils.ParseTimeStringToTime("2006-01-02 15:04", startDateStr)
  1834. fmt.Println("触发事件", startDate.Unix())
  1835. arriveDateStr := dataBody["arrive_time"].(string)
  1836. fmt.Println("到达时间", arriveDateStr)
  1837. arriveDate, _ := utils.ParseTimeStringToTime("2006-01-02 15:04", arriveDateStr)
  1838. fmt.Println("到达时间", arriveDate.Unix())
  1839. finishDateStr := dataBody["finish_time"].(string)
  1840. fmt.Println("完成时间", finishDateStr)
  1841. finishDate, _ := utils.ParseTimeStringToTime("2006-01-02 15:04", finishDateStr)
  1842. fmt.Println("完成时间", finishDate.Unix())
  1843. totaldistance := dataBody["total_distance"].(string)
  1844. fmt.Println("总公里输", totaldistance)
  1845. failurestate := int64(dataBody["failure_stage"].(float64))
  1846. fmt.Println("故事范式阶段", failurestate)
  1847. codeInformation := dataBody["code_information"].(string)
  1848. fmt.Println("故事提示信息及代码", codeInformation)
  1849. faultdescription := dataBody["fault_description"].(string)
  1850. fmt.Println("故障描述", faultdescription)
  1851. causeAnalysis := dataBody["cause_analysis"].(string)
  1852. fmt.Println("原因分析", causeAnalysis)
  1853. treatmentprocess := dataBody["treatment_process"].(string)
  1854. fmt.Println("处理过程", treatmentprocess)
  1855. images := dataBody["images"].(string)
  1856. fmt.Println("上传图片", images)
  1857. exclude := int64(dataBody["exclude"].(float64))
  1858. fmt.Println("故障是否排除", exclude)
  1859. reason := dataBody["reason"].(string)
  1860. fmt.Println("原因", reason)
  1861. imageName := dataBody["imageName"].(string)
  1862. repair := models.DeviceRepair{
  1863. BedId: addmacher.BedId,
  1864. EquitmentId: id,
  1865. GuaranteeDate: guaDate,
  1866. StartTime: startDate.Unix(),
  1867. ArriveTime: arriveDate.Unix(),
  1868. FinishTime: finishDate.Unix(),
  1869. TotalDistance: totaldistance,
  1870. FailureStage: failurestate,
  1871. FaultDescription: faultdescription,
  1872. CauseAnalysis: causeAnalysis,
  1873. TreatmentProcess: treatmentprocess,
  1874. Images: images,
  1875. Exclude: exclude,
  1876. Reason: reason,
  1877. Status: 1,
  1878. UserOrgId: OrgID,
  1879. Ctime: time.Now().Unix(),
  1880. CodeInformation: codeInformation,
  1881. ImageName: imageName,
  1882. }
  1883. err = service.CreateRepair(&repair)
  1884. if err != nil {
  1885. this.ServeFailJsonSend(enums.ErrorCodeDBDelete, "查询失败:("+err.Error()+")")
  1886. return
  1887. }
  1888. this.ServeSuccessJSON(map[string]interface{}{
  1889. "repair": repair,
  1890. })
  1891. }
  1892. func (this *MachineApiController) GetAllRepair() {
  1893. limit, _ := this.GetInt64("limit")
  1894. page, _ := this.GetInt64("page")
  1895. adminUser := this.GetAdminUserInfo()
  1896. orgID := adminUser.CurrentOrgId
  1897. repair, total, err := service.GetAllRepair(orgID, limit, page)
  1898. if err != nil {
  1899. this.ServeFailJsonSend(enums.ErrorCodeDBDelete, "查询失败:("+err.Error()+")")
  1900. return
  1901. }
  1902. this.ServeSuccessJSON(map[string]interface{}{
  1903. "repair": repair,
  1904. "total": total,
  1905. })
  1906. }
  1907. func (this *MachineApiController) EditRepair() {
  1908. id, _ := this.GetInt64("id")
  1909. fmt.Println("id", id)
  1910. repair, err := service.EditRepair(id)
  1911. if err != nil {
  1912. this.ServeFailJsonSend(enums.ErrorCodeDBDelete, "查询失败:("+err.Error()+")")
  1913. return
  1914. }
  1915. this.ServeSuccessJSON(map[string]interface{}{
  1916. "repair": repair,
  1917. })
  1918. }
  1919. func (this *MachineApiController) UpdateRepair() {
  1920. timeLayout := "2006-01-02"
  1921. loc, _ := time.LoadLocation("Local")
  1922. adminUserInfo := this.GetAdminUserInfo()
  1923. OrgID := adminUserInfo.CurrentOrgId
  1924. fmt.Println("orgid", OrgID)
  1925. dataBody := make(map[string]interface{}, 0)
  1926. err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
  1927. fmt.Println("err", err)
  1928. id := int64(dataBody["id"].(float64))
  1929. gua_date := dataBody["guarantee_date"].(string)
  1930. fmt.Println("保修日期", gua_date)
  1931. inLocation, _ := time.ParseInLocation(timeLayout+" 15:04:05", gua_date+" 00:00:00", loc)
  1932. guaDate := inLocation.Unix()
  1933. fmt.Println("保修日期", guaDate)
  1934. startDateStr := dataBody["start_time"].(string)
  1935. fmt.Println("出发时间", startDateStr)
  1936. startDate, _ := utils.ParseTimeStringToTime("2006-01-02 15:04", startDateStr)
  1937. fmt.Println("触发事件", startDate.Unix())
  1938. arriveDateStr := dataBody["arrive_time"].(string)
  1939. fmt.Println("到达时间", arriveDateStr)
  1940. arriveDate, _ := utils.ParseTimeStringToTime("2006-01-02 15:04", arriveDateStr)
  1941. fmt.Println("到达时间", arriveDate.Unix())
  1942. finishDateStr := dataBody["finish_time"].(string)
  1943. fmt.Println("完成时间", finishDateStr)
  1944. finishDate, _ := utils.ParseTimeStringToTime("2006-01-02 15:04", finishDateStr)
  1945. fmt.Println("完成时间", finishDate.Unix())
  1946. totaldistance := dataBody["total_distance"].(string)
  1947. fmt.Println("总公里输", totaldistance)
  1948. failurestate := int64(dataBody["failure_stage"].(float64))
  1949. fmt.Println("故事范式阶段", failurestate)
  1950. codeInformation := dataBody["code_information"].(string)
  1951. fmt.Println("故事提示信息及代码", codeInformation)
  1952. faultdescription := dataBody["fault_description"].(string)
  1953. fmt.Println("故障描述", faultdescription)
  1954. causeAnalysis := dataBody["cause_analysis"].(string)
  1955. fmt.Println("原因分析", causeAnalysis)
  1956. treatmentprocess := dataBody["treatment_process"].(string)
  1957. fmt.Println("处理过程", treatmentprocess)
  1958. images := dataBody["images"].(string)
  1959. fmt.Println("上传图片", images)
  1960. exclude := int64(dataBody["exclude"].(float64))
  1961. fmt.Println("故障是否排除", exclude)
  1962. reason := dataBody["reason"].(string)
  1963. fmt.Println("原因", reason)
  1964. imageName := dataBody["image_name"].(string)
  1965. deviceRepair := models.DeviceRepair{
  1966. GuaranteeDate: guaDate,
  1967. StartTime: startDate.Unix(),
  1968. ArriveTime: arriveDate.Unix(),
  1969. FinishTime: finishDate.Unix(),
  1970. TotalDistance: totaldistance,
  1971. FailureStage: failurestate,
  1972. FaultDescription: faultdescription,
  1973. CauseAnalysis: causeAnalysis,
  1974. TreatmentProcess: treatmentprocess,
  1975. Images: images,
  1976. Exclude: exclude,
  1977. Reason: reason,
  1978. CodeInformation: codeInformation,
  1979. ImageName: imageName,
  1980. }
  1981. err = service.UpdateRepair(id, OrgID, &deviceRepair)
  1982. if err != nil {
  1983. this.ServeFailJsonSend(enums.ErrorCodeDBDelete, "查询失败:("+err.Error()+")")
  1984. return
  1985. }
  1986. this.ServeSuccessJSON(map[string]interface{}{
  1987. "repair": deviceRepair,
  1988. })
  1989. }
  1990. func (this *MachineApiController) DeleteRepair() {
  1991. adminUserInfo := this.GetAdminUserInfo()
  1992. OrgID := adminUserInfo.CurrentOrgId
  1993. dataBody := make(map[string]interface{}, 0)
  1994. err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
  1995. if err != nil {
  1996. utils.ErrorLog(err.Error())
  1997. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "参数错误")
  1998. return
  1999. }
  2000. idsInters := dataBody["ids"].([]interface{})
  2001. if len(idsInters) == 0 {
  2002. if err != nil {
  2003. this.ServeFailJsonSend(enums.ErrorCodeDBDelete, "删除会员失败:(没有选择会员)")
  2004. return
  2005. }
  2006. }
  2007. ids := make([]int64, 0)
  2008. for _, idsInter := range idsInters {
  2009. id := int64(idsInter.(float64))
  2010. ids = append(ids, id)
  2011. }
  2012. fmt.Println("ids", ids)
  2013. err = service.DeleteRepair(OrgID, ids)
  2014. if err != nil {
  2015. this.ServeFailJsonSend(enums.ErrorCodeDBDelete, "删除失败:("+err.Error()+")")
  2016. return
  2017. }
  2018. returnData := make(map[string]interface{}, 0)
  2019. returnData["msg"] = "ok"
  2020. this.ServeSuccessJSON(returnData)
  2021. return
  2022. }
  2023. func (this *MachineApiController) GetRepair() {
  2024. timeLayout := "2006-01-02"
  2025. loc, _ := time.LoadLocation("Local")
  2026. adminUserInfo := this.GetAdminUserInfo()
  2027. OrgID := adminUserInfo.CurrentOrgId
  2028. fmt.Println("orgid", OrgID)
  2029. bedid, _ := this.GetInt64("bedid")
  2030. fmt.Println("bedid", bedid)
  2031. startime := this.GetString("startime")
  2032. fmt.Println("starttime", startime)
  2033. inLocation, _ := time.ParseInLocation(timeLayout+" 15:04:05", startime+" 00:00:00", loc)
  2034. start := inLocation.Unix()
  2035. fmt.Println("start", start)
  2036. endtime := this.GetString("endtime")
  2037. fmt.Println("endtime", endtime)
  2038. endLocation, _ := time.ParseInLocation(timeLayout+" 15:04:05", endtime+" 00:00:00", loc)
  2039. end := endLocation.Unix()
  2040. fmt.Println("end", end)
  2041. repair, err := service.GetRepair(bedid, start, end, OrgID)
  2042. if err != nil {
  2043. this.ServeFailJsonSend(enums.ErrorCodeDBDelete, "查询失败:("+err.Error()+")")
  2044. return
  2045. }
  2046. this.ServeSuccessJSON(map[string]interface{}{
  2047. "repair": repair,
  2048. })
  2049. }
  2050. func (this *MachineApiController) EditUser() {
  2051. adminUser := this.GetAdminUserInfo()
  2052. orgId := adminUser.CurrentOrgId
  2053. id, _ := this.GetInt64("id")
  2054. fmt.Println("id", id)
  2055. patientid, _ := this.GetInt64("patientid")
  2056. device, err := service.GetUserInformation(id)
  2057. //获取初次使用记录
  2058. macher, err := service.GetUserTotalByMacher(device.EquimentId)
  2059. count, err := service.GetUserTotalCount(orgId, device.BedNumber)
  2060. patients, err := service.GetPatientInfoMation(patientid)
  2061. if err != nil {
  2062. this.ServeFailJsonSend(enums.ErrorCodeDBDelete, "查询失败:("+err.Error()+")")
  2063. return
  2064. }
  2065. this.ServeSuccessJSON(map[string]interface{}{
  2066. "device": device,
  2067. "patients": patients,
  2068. "count": count,
  2069. "macher": macher,
  2070. })
  2071. }
  2072. func (this *MachineApiController) DeleteForm() {
  2073. adminUserInfo := this.GetAdminUserInfo()
  2074. OrgID := adminUserInfo.CurrentOrgId
  2075. dataBody := make(map[string]interface{}, 0)
  2076. err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
  2077. if err != nil {
  2078. utils.ErrorLog(err.Error())
  2079. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "参数错误")
  2080. return
  2081. }
  2082. idsInters := dataBody["ids"].([]interface{})
  2083. if len(idsInters) == 0 {
  2084. if err != nil {
  2085. this.ServeFailJsonSend(enums.ErrorCodeDBDelete, "删除会员失败:(没有选择会员)")
  2086. return
  2087. }
  2088. }
  2089. ids := make([]int64, 0)
  2090. for _, idsInter := range idsInters {
  2091. id := int64(idsInter.(float64))
  2092. ids = append(ids, id)
  2093. }
  2094. fmt.Println("ids", ids)
  2095. err = service.DeleteForm(OrgID, ids)
  2096. if err != nil {
  2097. this.ServeFailJsonSend(enums.ErrorCodeDBDelete, "删除失败:("+err.Error()+")")
  2098. return
  2099. }
  2100. returnData := make(map[string]interface{}, 0)
  2101. returnData["msg"] = "ok"
  2102. this.ServeSuccessJSON(returnData)
  2103. return
  2104. }
  2105. func (this *MachineApiController) UpdateForm() {
  2106. dataBody := make(map[string]interface{}, 0)
  2107. err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
  2108. fmt.Println("错误是", err)
  2109. adminUserInfo := this.GetAdminUserInfo()
  2110. orgid := adminUserInfo.CurrentOrgId
  2111. date := dataBody["spling_date"].(string)
  2112. timeLayout := "2006-01-02"
  2113. loc, _ := time.LoadLocation("Local")
  2114. theTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", date+" 00:00:00", loc)
  2115. startdate := theTime.Unix()
  2116. fmt.Println("日期", startdate)
  2117. id := int64(dataBody["id"].(float64))
  2118. fmt.Println("id", id)
  2119. classtype := int64(dataBody["classtype"].(float64))
  2120. fmt.Println("班次", classtype)
  2121. zone := int64(dataBody["zone"].(float64))
  2122. fmt.Println("分区", zone)
  2123. bednumber := int64(dataBody["bed_number"].(float64))
  2124. fmt.Println("床位号", bednumber)
  2125. number, _ := service.GetNumbers(bednumber, orgid)
  2126. patient_id := int64(dataBody["patient_id"].(float64))
  2127. fmt.Println("患者", patient_id)
  2128. contagion := dataBody["contagion"].(string)
  2129. fmt.Println("传染病", contagion)
  2130. dialysis_mode := int64(dataBody["dialysis_mode"].(float64))
  2131. fmt.Println("透析方式", dialysis_mode)
  2132. startDateStr := dataBody["start_time"].(string)
  2133. fmt.Println("上机时间", startDateStr)
  2134. startDate, _ := utils.ParseTimeStringToTime("2006-01-02 15:04", startDateStr)
  2135. fmt.Println("上机时间", startDate.Unix())
  2136. endDateStr := dataBody["end_time"].(string)
  2137. fmt.Println("上机时间", startDateStr)
  2138. endDate, _ := utils.ParseTimeStringToTime("2006-01-02 15:04", endDateStr)
  2139. fmt.Println("上机时间", endDate.Unix())
  2140. dialysis_time := dataBody["dialysis_time"].(string)
  2141. fmt.Println("透析时长", dialysis_time)
  2142. hyperfiletration := dataBody["hyperfiltratio"].(float64)
  2143. fmt.Println("实际超滤量", hyperfiletration)
  2144. weight_loss := dataBody["weight_loss"].(float64)
  2145. fmt.Println("体重减少", weight_loss)
  2146. warining_value := dataBody["warning_value"].(string)
  2147. fmt.Println("预警值", warining_value)
  2148. //user_total := int64(dataBody["user_total"].(float64))
  2149. user_total := dataBody["user_total"].(string)
  2150. fmt.Println("使用次数", user_total)
  2151. run := int64(dataBody["run"].(float64))
  2152. fmt.Println("运行", run)
  2153. failure_stage := int64(dataBody["failure_stage"].(float64))
  2154. fmt.Println("故事发生阶段", failure_stage)
  2155. falult_desciription := dataBody["fault_description"].(string)
  2156. fmt.Println("故障描述", falult_desciription)
  2157. code_information := dataBody["code_information"].(string)
  2158. fmt.Println("故障提示及代码", code_information)
  2159. //机器消毒
  2160. disinfect_type := int64(dataBody["disinfect_type"].(float64))
  2161. fmt.Println("消毒方式", disinfect_type)
  2162. disinfectant_type := int64(dataBody["disinfectant_type"].(float64))
  2163. fmt.Println("消毒液", disinfectant_type)
  2164. disinfection := int64(dataBody["disinfection"].(float64))
  2165. fmt.Println("消毒状态", disinfection)
  2166. machine_run := int64(dataBody["machine_run"].(float64))
  2167. fmt.Println("运行", machine_run)
  2168. //液路
  2169. fluid_path := int64(dataBody["fluid_path"].(float64))
  2170. fmt.Println("液路消毒方式", fluid_path)
  2171. disinfectant := int64(dataBody["disinfectant"].(float64))
  2172. fmt.Println("消毒液", disinfectant)
  2173. disinfection_status := int64(dataBody["disinfection_status"].(float64))
  2174. fmt.Println("消毒状态", disinfection_status)
  2175. disinfection_residue := int64(dataBody["disinfection_residue"].(float64))
  2176. fmt.Println("消毒液残留", disinfection_residue)
  2177. longtime := dataBody["longtime"].(string)
  2178. fmt.Println("消毒时长", longtime)
  2179. starttime := dataBody["starttime"].(string)
  2180. disstarttime, _ := utils.ParseTimeStringToTime("2006-01-02 15:04", starttime)
  2181. distartime := disstarttime.Unix()
  2182. if distartime < 0 {
  2183. distartime = 0
  2184. }
  2185. //fmt.Println("开始消毒时间====", distartime)
  2186. entime := dataBody["endtime"].(string)
  2187. disendtime, _ := utils.ParseTimeStringToTime("2006-01-02 15:04", entime)
  2188. diendtime := disendtime.Unix()
  2189. fmt.Println("结束消毒时间", diendtime)
  2190. if diendtime < 0 {
  2191. diendtime = 0
  2192. }
  2193. dialysis_checked := int64(dataBody["dialysis_checked"].(float64))
  2194. //fmt.Println("更换", dialysis_checked)
  2195. dialysis_name := int64(dataBody["dialysis_name"].(float64))
  2196. fmt.Println("名称", dialysis_name)
  2197. norms := dataBody["norms"].(string)
  2198. fmt.Println("规格", norms)
  2199. dialysis_concentration := int64(dataBody["dialysis_concentration"].(float64))
  2200. fmt.Println("浓度", dialysis_concentration)
  2201. germ_checked := int64(dataBody["germ_checked"].(float64))
  2202. fmt.Println("更换", germ_checked)
  2203. germ_name := int64(dataBody["germ_name"].(float64))
  2204. fmt.Println("名称", germ_name)
  2205. //germ_number := int64(dataBody["germ_number"].(float64))
  2206. germ_number := dataBody["germ_number"].(string)
  2207. fmt.Println("数量", germ_number)
  2208. clean := int64(dataBody["clean"].(float64))
  2209. fmt.Println("清洁", clean)
  2210. sign_name := int64(dataBody["sign_name"].(float64))
  2211. fmt.Println("签名", sign_name)
  2212. equitment_id := int64(dataBody["equiment_id"].(float64))
  2213. fmt.Println("设备ID", equitment_id)
  2214. addmacher := models.DeviceAddmacher{
  2215. BedId: bednumber,
  2216. }
  2217. //更新床位号
  2218. err = service.UpdateAddMacherBedID(equitment_id, orgid, &addmacher)
  2219. fmt.Println("更新设备失败", err)
  2220. //更新区号
  2221. deviceNumber := models.DeviceNumber{
  2222. ZoneID: zone,
  2223. }
  2224. err = service.UpdatedZoneID(bednumber, orgid, &deviceNumber)
  2225. fmt.Println("更新区号失败", err)
  2226. information := models.DeviceInformation{
  2227. Date: startdate,
  2228. Class: classtype,
  2229. Zone: zone,
  2230. BedNumber: bednumber,
  2231. Contagion: contagion,
  2232. DialysisMode: dialysis_mode,
  2233. StartTime: startDate.Unix(),
  2234. EndTime: endDate.Unix(),
  2235. DialysisHour: dialysis_time,
  2236. Hyperfiltratio: hyperfiletration,
  2237. WeightLoss: weight_loss,
  2238. WarningValue: warining_value,
  2239. UserTotal: user_total,
  2240. Move: run,
  2241. FailureStage: failure_stage,
  2242. FaultDescription: falult_desciription,
  2243. CodeInformation: code_information,
  2244. DisinfectantType: disinfectant_type,
  2245. DisinfectType: disinfect_type,
  2246. Disinfection: disinfection,
  2247. MachineRun: machine_run,
  2248. FluidPath: fluid_path,
  2249. Disinfectant: disinfectant,
  2250. DisinfectionStatus: disinfection_status,
  2251. DisinfectionResidue: disinfection_residue,
  2252. LongTime: longtime,
  2253. DisinfecStartime: distartime,
  2254. DisinfecEndtime: diendtime,
  2255. DialysisChecked: dialysis_checked,
  2256. DialysisName: dialysis_name,
  2257. Norms: norms,
  2258. DialysisConcentration: dialysis_concentration,
  2259. GermChecked: germ_checked,
  2260. GermName: germ_name,
  2261. GermNumber: germ_number,
  2262. Clean: clean,
  2263. SignName: sign_name,
  2264. Ctime: time.Now().Unix(),
  2265. Status: 1,
  2266. UserOrgId: orgid,
  2267. EquimentId: id,
  2268. Bed: number.Number,
  2269. PatientId: patient_id,
  2270. }
  2271. err = service.UpadateForm(id, orgid, &information)
  2272. fmt.Println("报错", err)
  2273. if err != nil {
  2274. this.ServeFailJsonSend(enums.ErrorCodeDBDelete, "修改失败:("+err.Error()+")")
  2275. return
  2276. }
  2277. this.ServeSuccessJSON(map[string]interface{}{
  2278. "information": information,
  2279. })
  2280. }
  2281. func (this *MachineApiController) QueryInfo() {
  2282. zone, _ := this.GetInt64("zone")
  2283. fmt.Println("zone", zone)
  2284. //bed, _ := this.GetInt64("bed")
  2285. //fmt.Println("bed", bed)
  2286. bed, _ := this.GetInt64("bed")
  2287. startime := this.GetString("startime")
  2288. timeLayout := "2006-01-02"
  2289. loc, _ := time.LoadLocation("Local")
  2290. theTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", startime+" 00:00:00", loc)
  2291. startdate := theTime.Unix()
  2292. fmt.Println("开始时间", startdate)
  2293. endtime := this.GetString("endtime")
  2294. theTimes, _ := time.ParseInLocation(timeLayout+" 15:04:05", endtime+" 00:00:00", loc)
  2295. endtimes := theTimes.Unix()
  2296. fmt.Println("结束", endtimes)
  2297. limit, _ := this.GetInt64("limit")
  2298. fmt.Println("limit", limit)
  2299. page, _ := this.GetInt64("page")
  2300. fmt.Println("page", page)
  2301. adminUser := this.GetAdminUserInfo()
  2302. orgId := adminUser.CurrentOrgId
  2303. infor, total, err := service.QueryInfo(bed, startdate, endtimes, orgId, limit, page)
  2304. if err != nil {
  2305. this.ServeFailJsonSend(enums.ErrorCodeDBDelete, "查询:("+err.Error()+")")
  2306. return
  2307. }
  2308. this.ServeSuccessJSON(map[string]interface{}{
  2309. "infor": infor,
  2310. "total": total,
  2311. })
  2312. }
  2313. func (this *MachineApiController) InsertAutoData() {
  2314. id, _ := this.GetInt64("id")
  2315. addmacher, _ := service.GetBedId(id)
  2316. fmt.Println("床位号", addmacher.BedId)
  2317. adminUser := this.GetAdminUserInfo()
  2318. timeStr := time.Now().Format("2006-01-02")
  2319. timeLayout := "2006-01-02 15:04:05"
  2320. fmt.Println("timeStr:", timeStr)
  2321. timeStringToTime, _ := utils.ParseTimeStringToTime(timeLayout, timeStr+" 00:00:00")
  2322. timenow := timeStringToTime.Unix()
  2323. fmt.Println("timenow是什么", timenow)
  2324. orgId := adminUser.CurrentOrgId
  2325. dialysis, err := service.GetPatientID(id, orgId, timenow)
  2326. if err != nil {
  2327. this.ServeFailJsonSend(enums.ErrorCodeDBDelete, "查询:("+err.Error()+")")
  2328. return
  2329. }
  2330. this.ServeSuccessJSON(map[string]interface{}{
  2331. "dialysis": dialysis,
  2332. })
  2333. }
  2334. func (this *MachineApiController) GetAllEquitType() {
  2335. adminUserInfo := this.GetAdminUserInfo()
  2336. orgID := adminUserInfo.CurrentOrgId
  2337. fmt.Println("orgId", orgID)
  2338. //equitname, err := service.GetAllEquitType(orgID)
  2339. //name, err := service.GetAllEquitName(orgID)
  2340. mode, err := service.GetAllMode(orgID)
  2341. fmt.Print(err)
  2342. if err != nil {
  2343. this.ServeFailJsonSend(enums.ErrorCodeDBDelete, "查询:("+err.Error()+")")
  2344. return
  2345. }
  2346. this.ServeSuccessJSON(map[string]interface{}{
  2347. "mode": mode,
  2348. })
  2349. }
  2350. func (this *MachineApiController) GetUserForm() {
  2351. id, _ := this.GetInt64("id")
  2352. fmt.Println("id是什么", id)
  2353. limit, _ := this.GetInt64("limit")
  2354. fmt.Println("limit", limit)
  2355. page, _ := this.GetInt64("page")
  2356. fmt.Println("page", page)
  2357. adminUserInfo := this.GetAdminUserInfo()
  2358. orgID := adminUserInfo.CurrentOrgId
  2359. fmt.Println("orgId", orgID)
  2360. information, total, err := service.GetUserForm(id, orgID, limit, page)
  2361. fmt.Print("information", information)
  2362. fmt.Println("错误", err)
  2363. addmacher, _ := service.GetBedNumber(id, orgID)
  2364. fmt.Println("addmacher", addmacher)
  2365. if err != nil {
  2366. this.ServeFailJsonSend(enums.ErrorCodeDBDelete, "查询:("+err.Error()+")")
  2367. return
  2368. }
  2369. this.ServeSuccessJSON(map[string]interface{}{
  2370. "information": information,
  2371. "total": total,
  2372. "addmacher": addmacher,
  2373. })
  2374. }
  2375. func (this *MachineApiController) GetBedForm() {
  2376. adminUser := this.GetAdminUserInfo()
  2377. orgId := adminUser.CurrentOrgId
  2378. id, _ := this.GetInt64("id")
  2379. fmt.Println("id", id)
  2380. addmacher, err := service.GetZoneForm(id)
  2381. bed, err := service.GetZoneId(addmacher.BedId, orgId)
  2382. fmt.Println("bed--------------------", bed.ZoneID)
  2383. number, err := service.GetBedForm(bed.ZoneID)
  2384. if err != nil {
  2385. this.ServeFailJsonSend(enums.ErrorCodeDBDelete, "查询:("+err.Error()+")")
  2386. return
  2387. }
  2388. this.ServeSuccessJSON(map[string]interface{}{
  2389. "addmacher": addmacher,
  2390. "number": number,
  2391. })
  2392. }
  2393. func (this *MachineApiController) GetTotalCount() {
  2394. info := this.GetAdminUserInfo()
  2395. orgid := info.CurrentOrgId
  2396. _, total, err := service.GetTotalCount(orgid)
  2397. fmt.Print("------------------------------声优", err)
  2398. if err != nil {
  2399. this.ServeFailJsonSend(enums.ErrorCodeDBDelete, "查询:("+err.Error()+")")
  2400. return
  2401. }
  2402. this.ServeSuccessJSON(map[string]interface{}{
  2403. "total": total,
  2404. })
  2405. }
  2406. func (this *MachineApiController) GetTotalNumber() {
  2407. id, _ := this.GetInt64("id")
  2408. fmt.Println("id", id)
  2409. info := this.GetAdminUserInfo()
  2410. orgId := info.CurrentOrgId
  2411. total, _ := service.GetTotalNumber(id, orgId)
  2412. //fmt.Println("total",total)
  2413. //fmt.Println("====================真的",err)
  2414. //if err != nil {
  2415. // this.ServeFailJsonSend(enums.ErrorCodeDBDelete, "查询:("+err.Error()+")")
  2416. // return
  2417. //}
  2418. this.ServeSuccessJSON(map[string]interface{}{
  2419. "total": total,
  2420. })
  2421. }
  2422. func (this *MachineApiController) GetTimeWarning() {
  2423. id, _ := this.GetInt64("id")
  2424. fmt.Println("设备id", id)
  2425. adminUserInfo := this.GetAdminUserInfo()
  2426. orgId := adminUserInfo.CurrentOrgId
  2427. //获取透析机消毒液更换的最后一次更换日期
  2428. information, err := service.GetTimeWarning(id, orgId)
  2429. //获取透析机消毒液细菌过滤器的最后一次更换日期
  2430. deviceInformation, err := service.GetTimeLast(id, orgId)
  2431. //获取空气滤网清洁最后一次更换日期
  2432. clean, err := service.GetTimeLastData(id, orgId)
  2433. if err != nil {
  2434. this.ServeFailJsonSend(enums.ErrorCodeDBDelete, "查询:("+err.Error()+")")
  2435. return
  2436. }
  2437. this.ServeSuccessJSON(map[string]interface{}{
  2438. "informations": information,
  2439. "deviceInformation": deviceInformation,
  2440. "clean": clean,
  2441. })
  2442. }
  2443. func (this *MachineApiController) SaveManageinfoTwo() {
  2444. adminUserInfo := this.GetAdminUserInfo()
  2445. orgid := adminUserInfo.CurrentOrgId
  2446. fmt.Println("机构id", orgid)
  2447. dataBody := make(map[string]interface{}, 0)
  2448. err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
  2449. fmt.Println("err", err)
  2450. serial_numbe := dataBody["serial_number"].(string)
  2451. fmt.Println("序列号", serial_numbe)
  2452. device_type := int64(dataBody["device_type"].(float64))
  2453. fmt.Println("设备类型", device_type)
  2454. //bed_number := dataBody["beds"].(string)
  2455. //fmt.Println("床位号", bed_number)
  2456. bed_number := this.GetString("beds")
  2457. device_name := dataBody["device_name"].(string)
  2458. fmt.Println("设备名称", device_name)
  2459. manufacture_factory := dataBody["manufacture_factory"].(string)
  2460. fmt.Println("生产厂家", manufacture_factory)
  2461. service_manufacturer := dataBody["service_manufacturer"].(string)
  2462. fmt.Println("维修厂家", service_manufacturer)
  2463. unit_type := int64(dataBody["unit_type"].(float64))
  2464. //unit_type := strconv.FormatInt(unittype, 10)
  2465. //fmt.Println("设备型号", unit_type)
  2466. use_section := dataBody["use_section"].(string)
  2467. fmt.Println("使用科室", use_section)
  2468. section_number := dataBody["section_number"].(string)
  2469. fmt.Println("科室编号", section_number)
  2470. buy_date := dataBody["buy_date"].(string)
  2471. fmt.Println("buy_date", buy_date)
  2472. timeLayout := "2006-01-02 15:04:05"
  2473. theTime, err := utils.ParseTimeStringToTime(timeLayout, buy_date+" 00:00:00")
  2474. buydate := theTime.Unix()
  2475. int_num := *(*int)(unsafe.Pointer(&buydate))
  2476. if int_num < 0 {
  2477. buydate = 0
  2478. }
  2479. fmt.Println("购买日期", buydate)
  2480. install_date := dataBody["install_date"].(string)
  2481. toTime, err := utils.ParseTimeStringToTime(timeLayout, install_date+" 00:00:00")
  2482. installdate := toTime.Unix()
  2483. buy_num := *(*int)(unsafe.Pointer(&installdate))
  2484. if buy_num < 0 {
  2485. installdate = 0
  2486. }
  2487. fmt.Println("安装日期", installdate)
  2488. start_date := dataBody["start_date"].(string)
  2489. stringToTime, err := utils.ParseTimeStringToTime(timeLayout, start_date+" 00:00:00")
  2490. startdate := stringToTime.Unix()
  2491. start_num := *(*int)(unsafe.Pointer(&startdate))
  2492. if start_num < 0 {
  2493. startdate = 0
  2494. }
  2495. fmt.Println("启用日期", startdate)
  2496. maintenance_engineer := dataBody["maintenance_engineer"].(string)
  2497. fmt.Println("维修工程", maintenance_engineer)
  2498. telephone := dataBody["telephone"].(string)
  2499. fmt.Println("telephone", telephone)
  2500. guarantee_date := dataBody["guarantee_date"].(string)
  2501. fmt.Println("保修期限", guarantee_date)
  2502. machine_status := int64(dataBody["machine_status"].(float64))
  2503. fmt.Println("机器状态", machine_status)
  2504. disinfection_mode := int64(dataBody["Disinfection_mode"].(float64))
  2505. fmt.Println("消毒方式", disinfection_mode)
  2506. remarks := dataBody["remarks"].(string)
  2507. fmt.Println("备注", remarks)
  2508. rubbish_date := dataBody["rubbish_date"].(string)
  2509. timeStringToTime, err := utils.ParseTimeStringToTime(timeLayout, rubbish_date+" 00:00:00")
  2510. rubbishdate := timeStringToTime.Unix()
  2511. rubb_num := *(*int)(unsafe.Pointer(&rubbishdate))
  2512. if rubb_num < 0 {
  2513. rubbishdate = 0
  2514. }
  2515. fmt.Println("报废日期", rubbishdate)
  2516. rubbish_reason := int64(dataBody["rubbish_reason"].(float64))
  2517. fmt.Println("报废原因", rubbish_reason)
  2518. user_year := dataBody["user_year"].(string)
  2519. fmt.Println("使用年限", user_year)
  2520. work_time := dataBody["work_time"].(string)
  2521. fmt.Println("工作时长", work_time)
  2522. revers := int64(dataBody["revers_mode"].(float64))
  2523. fmt.Println("反渗模式", revers)
  2524. addmacher := &models.DeviceAddmacher{
  2525. SerialNumber: serial_numbe,
  2526. DeviceType: device_type,
  2527. BedNumber: bed_number,
  2528. DeviceName: device_name,
  2529. ManufactureFactory: manufacture_factory,
  2530. ServiceManufacturer: service_manufacturer,
  2531. UnitType: unit_type,
  2532. UseSection: use_section,
  2533. SectionNumber: section_number,
  2534. BuyDate: buydate,
  2535. InstallDate: installdate,
  2536. StartDate: startdate,
  2537. MaintenaceEngineer: maintenance_engineer,
  2538. Telephone: telephone,
  2539. GuaranteeDate: guarantee_date,
  2540. MachineStatus: machine_status,
  2541. DisinfectionMode: disinfection_mode,
  2542. Remarks: remarks,
  2543. RubbishDate: rubbishdate,
  2544. RubbishReason: rubbish_reason,
  2545. UserYear: user_year,
  2546. WorkTime: work_time,
  2547. ReversMode: revers,
  2548. Status: 1,
  2549. Ctime: time.Now().Unix(),
  2550. UserOrgId: orgid,
  2551. }
  2552. err = service.CreateMacher(addmacher)
  2553. fmt.Println("什么原因啊", err)
  2554. if err != nil {
  2555. this.ServeFailJsonSend(enums.ErrorCodeDataException, "添加设备失败")
  2556. return
  2557. }
  2558. this.ServeSuccessJSON(map[string]interface{}{
  2559. "addmacher": addmacher,
  2560. })
  2561. }
  2562. func (this *MachineApiController) GetAllpatient() {
  2563. adminUserInfo := this.GetAdminUserInfo()
  2564. orgid := adminUserInfo.CurrentOrgId
  2565. allpatient, err := service.GetAllpatient(orgid)
  2566. fmt.Print(err)
  2567. if err != nil {
  2568. this.ServeFailJsonSend(enums.ErrorCodeDataException, "添加设备失败")
  2569. return
  2570. }
  2571. this.ServeSuccessJSON(map[string]interface{}{
  2572. "allpatient": allpatient,
  2573. })
  2574. }
  2575. func (this *MachineApiController) ChangeBed() {
  2576. id, _ := this.GetInt64("id")
  2577. fmt.Print("id", id)
  2578. info := this.GetAdminUserInfo()
  2579. orgId := info.CurrentOrgId
  2580. bed, err := service.ChangeBed(id, orgId)
  2581. if err != nil {
  2582. this.ServeFailJsonSend(enums.ErrorCodeDataException, "添加设备失败")
  2583. return
  2584. }
  2585. this.ServeSuccessJSON(map[string]interface{}{
  2586. "bed": bed,
  2587. })
  2588. }
  2589. func (this *MachineApiController) GetPatientDetail() {
  2590. id, _ := this.GetInt64("id")
  2591. fmt.Print("id", id)
  2592. info := this.GetAdminUserInfo()
  2593. orgid := info.CurrentOrgId
  2594. patient, err := service.GetPatientDetail(id, orgid)
  2595. if err != nil {
  2596. this.ServeFailJsonSend(enums.ErrorCodeDataException, "添加设备失败")
  2597. return
  2598. }
  2599. this.ServeSuccessJSON(map[string]interface{}{
  2600. "patient": patient,
  2601. })
  2602. }
  2603. func (this *MachineApiController) SaveReminder() {
  2604. id, _ := this.GetInt64("id")
  2605. fmt.Print("码字", id)
  2606. info := this.GetAdminUserInfo()
  2607. orgId := info.CurrentOrgId
  2608. remander := models.DeviceRemander{
  2609. IsRun: id,
  2610. Status: 1,
  2611. UserOrgId: orgId,
  2612. Ctime: time.Now().Unix(),
  2613. }
  2614. data, errs := service.GetRemanderData(orgId)
  2615. if errs == gorm.ErrRecordNotFound {
  2616. err := service.CreateRemander(&remander).Error()
  2617. fmt.Print(err)
  2618. } else if errs == nil {
  2619. deviceRemander := models.DeviceRemander{
  2620. ID: data.ID,
  2621. IsRun: id,
  2622. Status: 1,
  2623. UserOrgId: orgId,
  2624. Mtime: time.Now().Unix(),
  2625. }
  2626. err := service.UpdateRemander(&deviceRemander)
  2627. if err != nil {
  2628. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCreateConfig)
  2629. return
  2630. }
  2631. }
  2632. this.ServeSuccessJSON(map[string]interface{}{
  2633. "id": id,
  2634. })
  2635. return
  2636. }
  2637. func (this *MachineApiController) GetRemanderData() {
  2638. info := this.GetAdminUserInfo()
  2639. orgid := info.CurrentOrgId
  2640. data, err := service.GetRemanderData(orgid)
  2641. if err != nil {
  2642. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCreateConfig)
  2643. return
  2644. }
  2645. this.ServeSuccessJSON(map[string]interface{}{
  2646. "remander": data,
  2647. })
  2648. }
  2649. func (this *MachineApiController) OpenDelete() {
  2650. id, _ := this.GetInt64("id")
  2651. err := service.DeletePlan(id)
  2652. if err != nil {
  2653. this.ServeFailJsonSend(enums.ErrorCodeDBDelete, "删除失败")
  2654. return
  2655. }
  2656. returnData := make(map[string]interface{}, 0)
  2657. returnData["msg"] = "ok"
  2658. this.ServeSuccessJSON(returnData)
  2659. return
  2660. }
  2661. func (this *MachineApiController) DeleteUserLogin() {
  2662. id, _ := this.GetInt64("id")
  2663. err := service.DeleteUserLogin(id)
  2664. if err != nil {
  2665. this.ServeFailJsonSend(enums.ErrorCodeDBDelete, "删除失败")
  2666. return
  2667. }
  2668. returnData := make(map[string]interface{}, 0)
  2669. returnData["msg"] = "ok"
  2670. this.ServeSuccessJSON(returnData)
  2671. return
  2672. }
  2673. func (this *MachineApiController) DeleteCultrues() {
  2674. id, _ := this.GetInt64("id")
  2675. err := service.DeleteCultrues(id)
  2676. if err != nil {
  2677. this.ServeFailJsonSend(enums.ErrorCodeDBDelete, "删除失败")
  2678. return
  2679. }
  2680. returnData := make(map[string]interface{}, 0)
  2681. returnData["msg"] = "ok"
  2682. this.ServeSuccessJSON(returnData)
  2683. return
  2684. }
  2685. func (this *MachineApiController) DeleteDialystates() {
  2686. id, _ := this.GetInt64("id")
  2687. err := service.DeleteDialystates(id)
  2688. if err != nil {
  2689. this.ServeFailJsonSend(enums.ErrorCodeDBDelete, "删除失败")
  2690. return
  2691. }
  2692. returnData := make(map[string]interface{}, 0)
  2693. returnData["msg"] = "ok"
  2694. this.ServeSuccessJSON(returnData)
  2695. return
  2696. }
  2697. func (this *MachineApiController) Deleteions() {
  2698. id, _ := this.GetInt64("id")
  2699. err := service.DeleteIons(id)
  2700. if err != nil {
  2701. this.ServeFailJsonSend(enums.ErrorCodeDBDelete, "删除失败")
  2702. return
  2703. }
  2704. returnData := make(map[string]interface{}, 0)
  2705. returnData["msg"] = "ok"
  2706. this.ServeSuccessJSON(returnData)
  2707. return
  2708. }
  2709. func (this *MachineApiController) DeleteRepairs() {
  2710. id, _ := this.GetInt64("id")
  2711. err := service.DeleteRepairs(id)
  2712. if err != nil {
  2713. this.ServeFailJsonSend(enums.ErrorCodeDBDelete, "删除失败")
  2714. return
  2715. }
  2716. returnData := make(map[string]interface{}, 0)
  2717. returnData["msg"] = "ok"
  2718. this.ServeSuccessJSON(returnData)
  2719. return
  2720. }
  2721. func (this *MachineApiController) SaveMode() {
  2722. adminUserInfo := this.GetAdminUserInfo()
  2723. orgid := adminUserInfo.CurrentOrgId
  2724. fmt.Println("机构id", orgid)
  2725. dataBody := make(map[string]interface{}, 0)
  2726. err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
  2727. fmt.Println("err", err)
  2728. device_mode := dataBody["device_mode"].(string)
  2729. mode := models.DeviceMode{
  2730. DeviceMode: device_mode,
  2731. UserOrgId: orgid,
  2732. Status: 1,
  2733. Ctime: time.Now().Unix(),
  2734. }
  2735. _, errcode := service.GetMode(device_mode, orgid)
  2736. if errcode == gorm.ErrRecordNotFound {
  2737. err = service.SaveMode(&mode)
  2738. } else if errcode == nil {
  2739. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCreateConfig)
  2740. return
  2741. } else {
  2742. }
  2743. if err != nil {
  2744. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCreateConfig)
  2745. return
  2746. }
  2747. this.ServeSuccessJSON(map[string]interface{}{
  2748. "mode": mode,
  2749. })
  2750. }
  2751. func (this *MachineApiController) GetAllMode() {
  2752. fmt.Println("进来了没哟")
  2753. adminUserInfo := this.GetAdminUserInfo()
  2754. orgid := adminUserInfo.CurrentOrgId
  2755. mode, err := service.GetAllMode(orgid)
  2756. if err != nil {
  2757. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCreateConfig)
  2758. return
  2759. }
  2760. this.ServeSuccessJSON(map[string]interface{}{
  2761. "mode": mode,
  2762. })
  2763. }
  2764. func (this *MachineApiController) EditMode() {
  2765. id, _ := this.GetInt64("id")
  2766. mode, err := service.GetModeById(id)
  2767. if err != nil {
  2768. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCreateConfig)
  2769. return
  2770. }
  2771. this.ServeSuccessJSON(map[string]interface{}{
  2772. "mode": mode,
  2773. })
  2774. }
  2775. func (this *MachineApiController) UpdateMode() {
  2776. id, _ := this.GetInt64("id")
  2777. dataBody := make(map[string]interface{}, 0)
  2778. err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
  2779. fmt.Println("err", err)
  2780. device_mode := dataBody["device_mode"].(string)
  2781. mode := models.DeviceMode{DeviceMode: device_mode}
  2782. err = service.UpdateMode(id, mode)
  2783. if err != nil {
  2784. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCreateConfig)
  2785. return
  2786. }
  2787. this.ServeSuccessJSON(map[string]interface{}{
  2788. "mode": mode,
  2789. })
  2790. }
  2791. func (this *MachineApiController) DeleteMode() {
  2792. id, _ := this.GetInt64("id")
  2793. adminUserInfo := this.GetAdminUserInfo()
  2794. orgid := adminUserInfo.CurrentOrgId
  2795. _, errcode := service.QueryDeviceMode(id, orgid)
  2796. if errcode == gorm.ErrRecordNotFound {
  2797. service.DeleteMode(id)
  2798. returnData := make(map[string]interface{}, 0)
  2799. returnData["msg"] = "ok"
  2800. this.ServeSuccessJSON(returnData)
  2801. return
  2802. } else if errcode == nil {
  2803. return
  2804. } else {
  2805. fmt.Print("设备型号已存在")
  2806. }
  2807. }
  2808. func (this *MachineApiController) SelectChange() {
  2809. id, _ := this.GetInt64("id")
  2810. adminUserInfo := this.GetAdminUserInfo()
  2811. orgid := adminUserInfo.CurrentOrgId
  2812. change, err := service.SelectChange(id, orgid)
  2813. //fmt.Print("---------------------------", err)
  2814. if err != nil {
  2815. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCreateConfig)
  2816. return
  2817. }
  2818. this.ServeSuccessJSON(map[string]interface{}{
  2819. "change": change,
  2820. })
  2821. }
  2822. func (this *MachineApiController) SelectBed() {
  2823. id, _ := this.GetInt64("id")
  2824. adminUserInfo := this.GetAdminUserInfo()
  2825. orgid := adminUserInfo.CurrentOrgId
  2826. bed, err := service.SelectBed(id, orgid)
  2827. if err != nil {
  2828. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCreateConfig)
  2829. return
  2830. }
  2831. this.ServeSuccessJSON(map[string]interface{}{
  2832. "zone": bed,
  2833. })
  2834. }
  2835. func (this *MachineApiController) GetTimeData() {
  2836. equitid, _ := this.GetInt64("equitid")
  2837. fmt.Print("equitid", equitid)
  2838. timeLayout := "2006-01-02 15:04:05"
  2839. todaytime := this.GetString("todaytime")
  2840. theTime, _ := utils.ParseTimeStringToTime(timeLayout, todaytime+" 00:00:00")
  2841. fmt.Print("时间", theTime.Unix())
  2842. adminUserInfo := this.GetAdminUserInfo()
  2843. orgid := adminUserInfo.CurrentOrgId
  2844. timeData, err := service.GetTimeData(equitid, orgid, theTime.Unix())
  2845. fmt.Print("报错", err)
  2846. timeDataTwo, err := service.GetTimeTwo(equitid, orgid, theTime.Unix())
  2847. timeDataThree, err := service.GetTimeThree(equitid, orgid, theTime.Unix())
  2848. fmt.Print("err报错了没有", err)
  2849. if err != nil {
  2850. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCreateConfig)
  2851. return
  2852. }
  2853. this.ServeSuccessJSON(map[string]interface{}{
  2854. "timeData": timeData,
  2855. "timeDataTwo": timeDataTwo,
  2856. "timeDataThree": timeDataThree,
  2857. })
  2858. }
  2859. func (this *MachineApiController) DeleteImages() {
  2860. id, _ := this.GetInt64("id")
  2861. err := service.DeleteImages(id)
  2862. fmt.Print("err", err)
  2863. if err != nil {
  2864. this.ServeFailJsonSend(enums.ErrorCodeDBDelete, "删除失败")
  2865. return
  2866. }
  2867. returnData := make(map[string]interface{}, 0)
  2868. returnData["msg"] = "ok"
  2869. this.ServeSuccessJSON(returnData)
  2870. return
  2871. }
  2872. func (this *MachineApiController) GetUserMachTotalCount() {
  2873. adminUserInfo := this.GetAdminUserInfo()
  2874. orgid := adminUserInfo.CurrentOrgId
  2875. count, err := service.GetUserMachTotalCount(orgid)
  2876. if err != nil {
  2877. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCreateConfig)
  2878. return
  2879. }
  2880. this.ServeSuccessJSON(map[string]interface{}{
  2881. "count": count,
  2882. })
  2883. }
  2884. func (this *MachineApiController) GetUserTotalCount() {
  2885. adminUserInfo := this.GetAdminUserInfo()
  2886. orgid := adminUserInfo.CurrentOrgId
  2887. id, _ := this.GetInt64("id")
  2888. count, err := service.GetUserTotalCount(orgid, id)
  2889. addmacher, err := service.GetUserTotal(orgid, id)
  2890. if err != nil {
  2891. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCreateConfig)
  2892. return
  2893. }
  2894. this.ServeSuccessJSON(map[string]interface{}{
  2895. "count": count,
  2896. "addmacher": addmacher,
  2897. })
  2898. }
  2899. func (this *MachineApiController) DeleteManagement() {
  2900. id, _ := this.GetInt64("id")
  2901. _, err := service.DeleteEquit(id)
  2902. if err != nil {
  2903. this.ServeFailJsonSend(enums.ErrorCodeDBDelete, "删除失败")
  2904. return
  2905. }
  2906. returnData := make(map[string]interface{}, 0)
  2907. returnData["msg"] = "ok"
  2908. this.ServeSuccessJSON(returnData)
  2909. return
  2910. }
  2911. func (this *MachineApiController) SaveOxygenates() {
  2912. timeLayout := "2006-01-02"
  2913. loc, _ := time.LoadLocation("Local")
  2914. id, _ := this.GetInt64("id")
  2915. addmacher, _ := service.GetBedId(id)
  2916. adminUserInfo := this.GetAdminUserInfo()
  2917. orgid := adminUserInfo.CurrentOrgId
  2918. dataBody := make(map[string]interface{}, 0)
  2919. err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
  2920. date := dataBody["sampling_date"].(string)
  2921. theTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", date+" 00:00:00", loc)
  2922. samp_date := theTime.Unix()
  2923. specimen := int64(dataBody["specimenb"].(float64))
  2924. cona := dataBody["concentrate_noc"].(string)
  2925. conb := dataBody["concentrateb_nod"].(string)
  2926. samplinglocationb := int64(dataBody["sampling_locationb"].(float64))
  2927. detectionUnit := dataBody["detection_unit"].(string)
  2928. samplerb := int64(dataBody["samplerb"].(float64))
  2929. reportDate := dataBody["reporting_dateb"].(string)
  2930. reportTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", reportDate+" 00:00:00", loc)
  2931. repDate := reportTime.Unix()
  2932. detectionResult := dataBody["detection_resultb"].(string)
  2933. sort := dataBody["sort"].(string)
  2934. modifications := int64(dataBody["modifications"].(float64))
  2935. examination := dataBody["pass_examination"].(string)
  2936. pass_examination, _ := strconv.ParseInt(examination, 10, 64)
  2937. oxygenates := models.XtDeviceOxygenates{
  2938. SamplingDate: samp_date,
  2939. Specimenb: specimen,
  2940. ConcentrateNoc: cona,
  2941. ConcentratebNod: conb,
  2942. SamplingLocationb: samplinglocationb,
  2943. DetectionUnit: detectionUnit,
  2944. Samplerb: samplerb,
  2945. ReportingDateb: repDate,
  2946. DetectionResultb: detectionResult,
  2947. Ctime: time.Now().Unix(),
  2948. Status: 1,
  2949. UserOrgId: orgid,
  2950. BedId: addmacher.BedId,
  2951. EquitmentId: id,
  2952. Bed: addmacher.BedNumber,
  2953. Sort: sort,
  2954. PassExamination: pass_examination,
  2955. Modifications: modifications,
  2956. }
  2957. err = service.CreateOxygenates(&oxygenates)
  2958. if err != nil {
  2959. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCreateConfig)
  2960. return
  2961. }
  2962. this.ServeSuccessJSON(map[string]interface{}{
  2963. "oxygenates": oxygenates,
  2964. })
  2965. }
  2966. func (this *MachineApiController) SaveHardWater() {
  2967. timeLayout := "2006-01-02"
  2968. loc, _ := time.LoadLocation("Local")
  2969. id, _ := this.GetInt64("id")
  2970. addmacher, _ := service.GetBedId(id)
  2971. adminUserInfo := this.GetAdminUserInfo()
  2972. orgid := adminUserInfo.CurrentOrgId
  2973. dataBody := make(map[string]interface{}, 0)
  2974. err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
  2975. date := dataBody["sampling_date"].(string)
  2976. theTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", date+" 00:00:00", loc)
  2977. samp_date := theTime.Unix()
  2978. specimen := int64(dataBody["specimenb"].(float64))
  2979. cona := dataBody["concentrate_noc"].(string)
  2980. conb := dataBody["concentrateb_nod"].(string)
  2981. samplinglocationb := int64(dataBody["sampling_locationb"].(float64))
  2982. detectionUnit := dataBody["detection_unit"].(string)
  2983. samplerb := int64(dataBody["samplerb"].(float64))
  2984. reportDate := dataBody["reporting_dateb"].(string)
  2985. reportTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", reportDate+" 00:00:00", loc)
  2986. repDate := reportTime.Unix()
  2987. detectionResult := dataBody["detection_resultb"].(string)
  2988. sort := dataBody["sort"].(string)
  2989. modifications := int64(dataBody["modifications"].(float64))
  2990. examination := dataBody["pass_examination"].(string)
  2991. pass_examination, _ := strconv.ParseInt(examination, 10, 64)
  2992. hadwater := models.XtDeviceHadwater{
  2993. SamplingDate: samp_date,
  2994. Specimenb: specimen,
  2995. ConcentrateNoc: cona,
  2996. ConcentratebNod: conb,
  2997. SamplingLocationb: samplinglocationb,
  2998. DetectionUnit: detectionUnit,
  2999. Samplerb: samplerb,
  3000. ReportingDateb: repDate,
  3001. DetectionResultb: detectionResult,
  3002. Ctime: time.Now().Unix(),
  3003. Status: 1,
  3004. UserOrgId: orgid,
  3005. BedId: addmacher.BedId,
  3006. EquitmentId: id,
  3007. Bed: addmacher.BedNumber,
  3008. Sort: sort,
  3009. PassExamination: pass_examination,
  3010. Modifications: modifications,
  3011. }
  3012. err = service.CreateHadWater(&hadwater)
  3013. if err != nil {
  3014. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCreateConfig)
  3015. return
  3016. }
  3017. this.ServeSuccessJSON(map[string]interface{}{
  3018. "hadwater": hadwater,
  3019. })
  3020. }
  3021. func (this *MachineApiController) SaveWater() {
  3022. timeLayout := "2006-01-02"
  3023. loc, _ := time.LoadLocation("Local")
  3024. id, _ := this.GetInt64("id")
  3025. addmacher, _ := service.GetBedId(id)
  3026. adminUserInfo := this.GetAdminUserInfo()
  3027. orgid := adminUserInfo.CurrentOrgId
  3028. dataBody := make(map[string]interface{}, 0)
  3029. err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
  3030. date := dataBody["sampling_date"].(string)
  3031. theTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", date+" 00:00:00", loc)
  3032. samp_date := theTime.Unix()
  3033. specimen := int64(dataBody["specimenb"].(float64))
  3034. cona := dataBody["concentrate_noc"].(string)
  3035. conb := dataBody["concentrateb_nod"].(string)
  3036. samplinglocationb := int64(dataBody["sampling_locationb"].(float64))
  3037. detectionUnit := dataBody["detection_unit"].(string)
  3038. samplerb := int64(dataBody["samplerb"].(float64))
  3039. reportDate := dataBody["reporting_dateb"].(string)
  3040. reportTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", reportDate+" 00:00:00", loc)
  3041. repDate := reportTime.Unix()
  3042. detectionResult := dataBody["detection_resultb"].(string)
  3043. sort := dataBody["sort"].(string)
  3044. modifications := int64(dataBody["modifications"].(float64))
  3045. examination := dataBody["pass_examination"].(string)
  3046. pass_examination, _ := strconv.ParseInt(examination, 10, 64)
  3047. deviceWater := models.XtDeviceWater{
  3048. SamplingDate: samp_date,
  3049. Specimenb: specimen,
  3050. ConcentrateNoc: cona,
  3051. ConcentratebNod: conb,
  3052. SamplingLocationb: samplinglocationb,
  3053. DetectionUnit: detectionUnit,
  3054. Samplerb: samplerb,
  3055. ReportingDateb: repDate,
  3056. DetectionResultb: detectionResult,
  3057. Ctime: time.Now().Unix(),
  3058. Status: 1,
  3059. UserOrgId: orgid,
  3060. BedId: addmacher.BedId,
  3061. EquitmentId: id,
  3062. Bed: addmacher.BedNumber,
  3063. Sort: sort,
  3064. PassExamination: pass_examination,
  3065. Modifications: modifications,
  3066. }
  3067. err = service.CreateWater(&deviceWater)
  3068. if err != nil {
  3069. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCreateConfig)
  3070. return
  3071. }
  3072. this.ServeSuccessJSON(map[string]interface{}{
  3073. "deviceWater": deviceWater,
  3074. })
  3075. }
  3076. func (this *MachineApiController) SaveDevicePH() {
  3077. timeLayout := "2006-01-02"
  3078. loc, _ := time.LoadLocation("Local")
  3079. id, _ := this.GetInt64("id")
  3080. addmacher, _ := service.GetBedId(id)
  3081. adminUserInfo := this.GetAdminUserInfo()
  3082. orgid := adminUserInfo.CurrentOrgId
  3083. dataBody := make(map[string]interface{}, 0)
  3084. err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
  3085. date := dataBody["sampling_date"].(string)
  3086. theTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", date+" 00:00:00", loc)
  3087. samp_date := theTime.Unix()
  3088. specimen := int64(dataBody["specimenb"].(float64))
  3089. cona := dataBody["concentrate_noc"].(string)
  3090. conb := dataBody["concentrateb_nod"].(string)
  3091. samplinglocationb := int64(dataBody["sampling_locationb"].(float64))
  3092. detectionUnit := dataBody["detection_unit"].(string)
  3093. samplerb := int64(dataBody["samplerb"].(float64))
  3094. reportDate := dataBody["reporting_dateb"].(string)
  3095. reportTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", reportDate+" 00:00:00", loc)
  3096. repDate := reportTime.Unix()
  3097. detectionResult := dataBody["detection_resultb"].(string)
  3098. sort := dataBody["sort"].(string)
  3099. modifications := int64(dataBody["modifications"].(float64))
  3100. examination := dataBody["pass_examination"].(string)
  3101. pass_examination, _ := strconv.ParseInt(examination, 10, 64)
  3102. devicePh := models.XtDevicePh{
  3103. SamplingDate: samp_date,
  3104. Specimenb: specimen,
  3105. ConcentrateNoc: cona,
  3106. ConcentratebNod: conb,
  3107. SamplingLocationb: samplinglocationb,
  3108. DetectionUnit: detectionUnit,
  3109. Samplerb: samplerb,
  3110. ReportingDateb: repDate,
  3111. DetectionResultb: detectionResult,
  3112. Ctime: time.Now().Unix(),
  3113. Status: 1,
  3114. UserOrgId: orgid,
  3115. BedId: addmacher.BedId,
  3116. EquitmentId: id,
  3117. Bed: addmacher.BedNumber,
  3118. Sort: sort,
  3119. PassExamination: pass_examination,
  3120. Modifications: modifications,
  3121. }
  3122. err = service.CreateDevicePh(&devicePh)
  3123. if err != nil {
  3124. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCreateConfig)
  3125. return
  3126. }
  3127. this.ServeSuccessJSON(map[string]interface{}{
  3128. "devicePh": devicePh,
  3129. })
  3130. }
  3131. func (this *MachineApiController) EditOxygenates() {
  3132. id, _ := this.GetInt64("id")
  3133. oxygenates, err := service.GetOxygenatesById(id)
  3134. if err != nil {
  3135. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCreateConfig)
  3136. return
  3137. }
  3138. this.ServeSuccessJSON(map[string]interface{}{
  3139. "oxygenates": oxygenates,
  3140. })
  3141. }
  3142. func (this *MachineApiController) UpdateOxygenates() {
  3143. timeLayout := "2006-01-02"
  3144. loc, _ := time.LoadLocation("Local")
  3145. dataBody := make(map[string]interface{}, 0)
  3146. err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
  3147. fmt.Println("err", err)
  3148. id := int64(dataBody["id"].(float64))
  3149. fmt.Println("id", id)
  3150. samplingDate := dataBody["sampling_date"].(string)
  3151. sampdate, _ := time.ParseInLocation(timeLayout+" 15:04:05", samplingDate+" 00:00:00", loc)
  3152. samp_date := sampdate.Unix()
  3153. specimentb := int64(dataBody["specimenb"].(float64))
  3154. concentratec := dataBody["concentrate_noc"].(string)
  3155. concentraeb := dataBody["concentrateb_nod"].(string)
  3156. samplinglocationb := int64(dataBody["sampling_locationb"].(float64))
  3157. samplerb := int64(dataBody["samplerb"].(float64))
  3158. reportDateb := dataBody["reporting_dateb"].(string)
  3159. location, _ := time.ParseInLocation(timeLayout+" 15:04:05", reportDateb+" 00:00:00", loc)
  3160. report_date := location.Unix()
  3161. detectionResultb := dataBody["detection_resultb"].(string)
  3162. detectionUnit := dataBody["detection_unit"].(string)
  3163. sort := dataBody["sort"].(string)
  3164. pass_examination := int64(dataBody["pass_examination"].(float64))
  3165. modifications := int64(dataBody["modifications"].(float64))
  3166. adminUserInfo := this.GetAdminUserInfo()
  3167. orgId := adminUserInfo.CurrentOrgId
  3168. oxygenates := models.XtDeviceOxygenates{
  3169. SamplingDate: samp_date,
  3170. Specimenb: specimentb,
  3171. ConcentrateNoc: concentratec,
  3172. ConcentratebNod: concentraeb,
  3173. SamplingLocationb: samplinglocationb,
  3174. DetectionUnit: detectionUnit,
  3175. Samplerb: samplerb,
  3176. ReportingDateb: report_date,
  3177. DetectionResultb: detectionResultb,
  3178. Sort: sort,
  3179. PassExamination: pass_examination,
  3180. Modifications: modifications,
  3181. }
  3182. err = service.UpdateOxygenates(id, orgId, &oxygenates)
  3183. if err != nil {
  3184. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCreateConfig)
  3185. return
  3186. }
  3187. this.ServeSuccessJSON(map[string]interface{}{
  3188. "oxygenates": oxygenates,
  3189. })
  3190. }
  3191. func (this *MachineApiController) EditHardWater() {
  3192. id, _ := this.GetInt64("id")
  3193. hardWater, err := service.GetHardWaterById(id)
  3194. if err != nil {
  3195. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCreateConfig)
  3196. return
  3197. }
  3198. this.ServeSuccessJSON(map[string]interface{}{
  3199. "hardWater": hardWater,
  3200. })
  3201. }
  3202. func (this *MachineApiController) EditWater() {
  3203. id, _ := this.GetInt64("id")
  3204. water, err := service.GetWaterById(id)
  3205. if err != nil {
  3206. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCreateConfig)
  3207. return
  3208. }
  3209. this.ServeSuccessJSON(map[string]interface{}{
  3210. "water": water,
  3211. })
  3212. }
  3213. func (this *MachineApiController) EditDevicePh() {
  3214. id, _ := this.GetInt64("id")
  3215. deviceph, err := service.GetDevicePhById(id)
  3216. if err != nil {
  3217. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCreateConfig)
  3218. return
  3219. }
  3220. this.ServeSuccessJSON(map[string]interface{}{
  3221. "deviceph": deviceph,
  3222. })
  3223. }
  3224. func (this *MachineApiController) GetAllDoctorList() {
  3225. adminUserInfo := this.GetAdminUserInfo()
  3226. orgId := adminUserInfo.CurrentOrgId
  3227. appId := this.GetAdminUserInfo().CurrentAppId
  3228. list, err := service.GetAllDoctorTwo(orgId, appId)
  3229. if err != nil {
  3230. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCreateConfig)
  3231. return
  3232. }
  3233. this.ServeSuccessJSON(map[string]interface{}{
  3234. "list": list,
  3235. })
  3236. }
  3237. func (this *MachineApiController) SaveAirDisinfect() {
  3238. timeLayout := "2006-01-02"
  3239. loc, _ := time.LoadLocation("Local")
  3240. check_out, err := this.GetInt64("check_out")
  3241. class, err := this.GetInt64("class")
  3242. create_time := this.GetString("created_time")
  3243. createTime, err := time.ParseInLocation(timeLayout+" 15:04:05", create_time+" 00:00:00", loc)
  3244. creator, err := this.GetInt64("creator")
  3245. detection_result := this.GetString("detection_result")
  3246. detection_time := this.GetString("detection_time")
  3247. detectionTime, err := time.ParseInLocation(timeLayout+" 15:04:05", detection_time+" 00:00:00", loc)
  3248. disinfection_fluid := this.GetString("disinfection_fluid")
  3249. disinfection_methods := this.GetString("disinfection_methods")
  3250. modifications, _ := this.GetInt64("modifications")
  3251. sort := this.GetString("sort")
  3252. upload_time := this.GetString("upload_time")
  3253. uploadTime, err := time.ParseInLocation(timeLayout+" 15:04:05", upload_time+" 00:00:00", loc)
  3254. start_time := this.GetString("start_time")
  3255. startTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
  3256. adminUserInfo := this.GetAdminUserInfo()
  3257. orgId := adminUserInfo.CurrentOrgId
  3258. detection := models.XtAerialDetection{
  3259. CheckOut: check_out,
  3260. Class: class,
  3261. CreatedTime: createTime.Unix(),
  3262. Creator: creator,
  3263. DetectionResult: detection_result,
  3264. DetectionTime: detectionTime.Unix(),
  3265. DisinfectionFluid: disinfection_fluid,
  3266. DisinfectionMethods: disinfection_methods,
  3267. Modifications: modifications,
  3268. Sort: sort,
  3269. UploadTime: uploadTime.Unix(),
  3270. StartTime: startTime.Unix(),
  3271. UserOrgId: orgId,
  3272. Ctime: time.Now().Unix(),
  3273. Status: 1,
  3274. }
  3275. err = service.CreateAerialDetection(&detection)
  3276. if err != nil {
  3277. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCreateConfig)
  3278. return
  3279. }
  3280. this.ServeSuccessJSON(map[string]interface{}{
  3281. "list": detection,
  3282. })
  3283. }
  3284. func (this *MachineApiController) GetAirList() {
  3285. limit, _ := this.GetInt64("limit")
  3286. page, _ := this.GetInt64("page")
  3287. adminUserInfo := this.GetAdminUserInfo()
  3288. orgId := adminUserInfo.CurrentOrgId
  3289. list, total, err := service.GetAirList(limit, page, orgId)
  3290. if err != nil {
  3291. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCreateConfig)
  3292. return
  3293. }
  3294. this.ServeSuccessJSON(map[string]interface{}{
  3295. "list": list,
  3296. "total": total,
  3297. })
  3298. }
  3299. func (this *MachineApiController) GetAirDisinfetDetail() {
  3300. id, _ := this.GetInt64("id")
  3301. detail, err := service.GetAirDisinfectDetail(id)
  3302. if err != nil {
  3303. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCreateConfig)
  3304. return
  3305. }
  3306. this.ServeSuccessJSON(map[string]interface{}{
  3307. "detail": detail,
  3308. })
  3309. }
  3310. func (this *MachineApiController) UpdateAirDisinfect() {
  3311. timeLayout := "2006-01-02"
  3312. loc, _ := time.LoadLocation("Local")
  3313. check_out, err := this.GetInt64("check_out")
  3314. class, err := this.GetInt64("class")
  3315. create_time := this.GetString("created_time")
  3316. createTime, err := time.ParseInLocation(timeLayout+" 15:04:05", create_time+" 00:00:00", loc)
  3317. creator, err := this.GetInt64("creator")
  3318. detection_result := this.GetString("detection_result")
  3319. detection_time := this.GetString("detection_time")
  3320. detectionTime, err := time.ParseInLocation(timeLayout+" 15:04:05", detection_time+" 00:00:00", loc)
  3321. disinfection_fluid := this.GetString("disinfection_fluid")
  3322. disinfection_methods := this.GetString("disinfection_methods")
  3323. modifications, _ := this.GetInt64("modifications")
  3324. sort := this.GetString("sort")
  3325. upload_time := this.GetString("upload_time")
  3326. uploadTime, err := time.ParseInLocation(timeLayout+" 15:04:05", upload_time+" 00:00:00", loc)
  3327. start_time := this.GetString("start_time")
  3328. startTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
  3329. id, _ := this.GetInt64("id")
  3330. adminUserInfo := this.GetAdminUserInfo()
  3331. orgId := adminUserInfo.CurrentOrgId
  3332. detection := models.XtAerialDetection{
  3333. CheckOut: check_out,
  3334. Class: class,
  3335. CreatedTime: createTime.Unix(),
  3336. Creator: creator,
  3337. DetectionResult: detection_result,
  3338. DetectionTime: detectionTime.Unix(),
  3339. DisinfectionFluid: disinfection_fluid,
  3340. DisinfectionMethods: disinfection_methods,
  3341. Modifications: modifications,
  3342. Sort: sort,
  3343. UploadTime: uploadTime.Unix(),
  3344. StartTime: startTime.Unix(),
  3345. UserOrgId: orgId,
  3346. Ctime: time.Now().Unix(),
  3347. Status: 1,
  3348. }
  3349. err = service.UpdateAeriaDetection(&detection, id)
  3350. if err != nil {
  3351. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCreateConfig)
  3352. return
  3353. }
  3354. this.ServeSuccessJSON(map[string]interface{}{
  3355. "detection": detection,
  3356. })
  3357. }
  3358. func (this *MachineApiController) DeleteAirDisinfect() {
  3359. id, _ := this.GetInt64("id")
  3360. err := service.DeleteAirDisinfect(id)
  3361. fmt.Println(err)
  3362. returnData := make(map[string]interface{}, 0)
  3363. returnData["msg"] = "ok"
  3364. this.ServeSuccessJSON(returnData)
  3365. return
  3366. }
  3367. func (this *MachineApiController) SaveBodyDisinfect() {
  3368. timeLayout := "2006-01-02"
  3369. loc, _ := time.LoadLocation("Local")
  3370. check_out, err := this.GetInt64("check_out")
  3371. class, err := this.GetInt64("class")
  3372. create_time := this.GetString("created_time")
  3373. createTime, err := time.ParseInLocation(timeLayout+" 15:04:05", create_time+" 00:00:00", loc)
  3374. creator, err := this.GetInt64("creator")
  3375. detection_result := this.GetString("detection_result")
  3376. detection_time := this.GetString("detection_time")
  3377. detectionTime, err := time.ParseInLocation(timeLayout+" 15:04:05", detection_time+" 00:00:00", loc)
  3378. disinfection_fluid := this.GetString("disinfection_fluid")
  3379. disinfection_methods := this.GetString("disinfection_methods")
  3380. modifications, _ := this.GetInt64("modifications")
  3381. sort := this.GetString("sort")
  3382. upload_time := this.GetString("upload_time")
  3383. uploadTime, err := time.ParseInLocation(timeLayout+" 15:04:05", upload_time+" 00:00:00", loc)
  3384. start_time := this.GetString("start_time")
  3385. startTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
  3386. adminUserInfo := this.GetAdminUserInfo()
  3387. orgId := adminUserInfo.CurrentOrgId
  3388. detection := models.XtBodyDetection{
  3389. CheckOut: check_out,
  3390. Class: class,
  3391. CreatedTime: createTime.Unix(),
  3392. Creator: creator,
  3393. DetectionResult: detection_result,
  3394. DetectionTime: detectionTime.Unix(),
  3395. DisinfectionFluid: disinfection_fluid,
  3396. DisinfectionMethods: disinfection_methods,
  3397. Modifications: modifications,
  3398. Sort: sort,
  3399. UploadTime: uploadTime.Unix(),
  3400. StartTime: startTime.Unix(),
  3401. UserOrgId: orgId,
  3402. Ctime: time.Now().Unix(),
  3403. Status: 1,
  3404. }
  3405. err = service.SaveBodyDetection(&detection)
  3406. if err != nil {
  3407. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCreateConfig)
  3408. return
  3409. }
  3410. this.ServeSuccessJSON(map[string]interface{}{
  3411. "detection": detection,
  3412. })
  3413. }
  3414. func (this *MachineApiController) GetBodyList() {
  3415. limit, _ := this.GetInt64("limit")
  3416. page, _ := this.GetInt64("page")
  3417. adminUserInfo := this.GetAdminUserInfo()
  3418. orgId := adminUserInfo.CurrentOrgId
  3419. list, total, err := service.GetBodyList(limit, page, orgId)
  3420. if err != nil {
  3421. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCreateConfig)
  3422. return
  3423. }
  3424. this.ServeSuccessJSON(map[string]interface{}{
  3425. "list": list,
  3426. "total": total,
  3427. })
  3428. }
  3429. func (this *MachineApiController) GetBodyDisinfetDetail() {
  3430. id, _ := this.GetInt64("id")
  3431. detail, err := service.GetBodyDisinfectDetail(id)
  3432. if err != nil {
  3433. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCreateConfig)
  3434. return
  3435. }
  3436. this.ServeSuccessJSON(map[string]interface{}{
  3437. "detail": detail,
  3438. })
  3439. }
  3440. func (this *MachineApiController) UpdateBodyDisinfect() {
  3441. timeLayout := "2006-01-02"
  3442. loc, _ := time.LoadLocation("Local")
  3443. check_out, _ := this.GetInt64("check_out")
  3444. class, _ := this.GetInt64("class")
  3445. create_time := this.GetString("created_time")
  3446. createTime, err := time.ParseInLocation(timeLayout+" 15:04:05", create_time+" 00:00:00", loc)
  3447. creator, err := this.GetInt64("creator")
  3448. detection_result := this.GetString("detection_result")
  3449. detection_time := this.GetString("detection_time")
  3450. detectionTime, err := time.ParseInLocation(timeLayout+" 15:04:05", detection_time+" 00:00:00", loc)
  3451. disinfection_fluid := this.GetString("disinfection_fluid")
  3452. disinfection_methods := this.GetString("disinfection_methods")
  3453. modifications, _ := this.GetInt64("modifications")
  3454. sort := this.GetString("sort")
  3455. upload_time := this.GetString("upload_time")
  3456. uploadTime, err := time.ParseInLocation(timeLayout+" 15:04:05", upload_time+" 00:00:00", loc)
  3457. start_time := this.GetString("start_time")
  3458. startTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
  3459. id, _ := this.GetInt64("id")
  3460. adminUserInfo := this.GetAdminUserInfo()
  3461. orgId := adminUserInfo.CurrentOrgId
  3462. detection := models.XtBodyDetection{
  3463. CheckOut: check_out,
  3464. Class: class,
  3465. CreatedTime: createTime.Unix(),
  3466. Creator: creator,
  3467. DetectionResult: detection_result,
  3468. DetectionTime: detectionTime.Unix(),
  3469. DisinfectionFluid: disinfection_fluid,
  3470. DisinfectionMethods: disinfection_methods,
  3471. Modifications: modifications,
  3472. Sort: sort,
  3473. UploadTime: uploadTime.Unix(),
  3474. StartTime: startTime.Unix(),
  3475. UserOrgId: orgId,
  3476. Ctime: time.Now().Unix(),
  3477. Status: 1,
  3478. }
  3479. err = service.UpdateBodyDetection(&detection, id)
  3480. if err != nil {
  3481. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCreateConfig)
  3482. return
  3483. }
  3484. this.ServeSuccessJSON(map[string]interface{}{
  3485. "detection": detection,
  3486. })
  3487. }
  3488. func (this *MachineApiController) DeleteBodyDisInfect() {
  3489. id, _ := this.GetInt64("id")
  3490. err := service.DeleteBodyDisInfect(id)
  3491. fmt.Println(err)
  3492. returnData := make(map[string]interface{}, 0)
  3493. returnData["msg"] = "ok"
  3494. this.ServeSuccessJSON(returnData)
  3495. return
  3496. }
  3497. func (this *MachineApiController) UpdateHadWater() {
  3498. timeLayout := "2006-01-02"
  3499. loc, _ := time.LoadLocation("Local")
  3500. dataBody := make(map[string]interface{}, 0)
  3501. err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
  3502. fmt.Println("err", err)
  3503. id := int64(dataBody["id"].(float64))
  3504. fmt.Println("id", id)
  3505. samplingDate := dataBody["sampling_date"].(string)
  3506. sampdate, _ := time.ParseInLocation(timeLayout+" 15:04:05", samplingDate+" 00:00:00", loc)
  3507. samp_date := sampdate.Unix()
  3508. specimentb := int64(dataBody["specimenb"].(float64))
  3509. concentratec := dataBody["concentrate_noc"].(string)
  3510. concentraeb := dataBody["concentrateb_nod"].(string)
  3511. samplinglocationb := int64(dataBody["sampling_locationb"].(float64))
  3512. samplerb := int64(dataBody["samplerb"].(float64))
  3513. reportDateb := dataBody["reporting_dateb"].(string)
  3514. location, _ := time.ParseInLocation(timeLayout+" 15:04:05", reportDateb+" 00:00:00", loc)
  3515. report_date := location.Unix()
  3516. detectionResultb := dataBody["detection_resultb"].(string)
  3517. detectionUnit := dataBody["detection_unit"].(string)
  3518. sort := dataBody["sort"].(string)
  3519. pass_examination := int64(dataBody["pass_examination"].(float64))
  3520. modifications := int64(dataBody["modifications"].(float64))
  3521. adminUserInfo := this.GetAdminUserInfo()
  3522. orgId := adminUserInfo.CurrentOrgId
  3523. hadWater := models.XtDeviceHadwater{
  3524. SamplingDate: samp_date,
  3525. Specimenb: specimentb,
  3526. ConcentrateNoc: concentratec,
  3527. ConcentratebNod: concentraeb,
  3528. SamplingLocationb: samplinglocationb,
  3529. DetectionUnit: detectionUnit,
  3530. Samplerb: samplerb,
  3531. ReportingDateb: report_date,
  3532. DetectionResultb: detectionResultb,
  3533. Sort: sort,
  3534. PassExamination: pass_examination,
  3535. Modifications: modifications,
  3536. }
  3537. err = service.UpdateHadWater(id, orgId, &hadWater)
  3538. if err != nil {
  3539. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCreateConfig)
  3540. return
  3541. }
  3542. this.ServeSuccessJSON(map[string]interface{}{
  3543. "hadWater": hadWater,
  3544. })
  3545. }
  3546. func (this *MachineApiController) UpdateWater() {
  3547. timeLayout := "2006-01-02"
  3548. loc, _ := time.LoadLocation("Local")
  3549. dataBody := make(map[string]interface{}, 0)
  3550. err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
  3551. fmt.Println("err", err)
  3552. id := int64(dataBody["id"].(float64))
  3553. fmt.Println("id", id)
  3554. samplingDate := dataBody["sampling_date"].(string)
  3555. sampdate, _ := time.ParseInLocation(timeLayout+" 15:04:05", samplingDate+" 00:00:00", loc)
  3556. samp_date := sampdate.Unix()
  3557. specimentb := int64(dataBody["specimenb"].(float64))
  3558. concentratec := dataBody["concentrate_noc"].(string)
  3559. concentraeb := dataBody["concentrateb_nod"].(string)
  3560. samplinglocationb := int64(dataBody["sampling_locationb"].(float64))
  3561. samplerb := int64(dataBody["samplerb"].(float64))
  3562. reportDateb := dataBody["reporting_dateb"].(string)
  3563. location, _ := time.ParseInLocation(timeLayout+" 15:04:05", reportDateb+" 00:00:00", loc)
  3564. report_date := location.Unix()
  3565. detectionResultb := dataBody["detection_resultb"].(string)
  3566. detectionUnit := dataBody["detection_unit"].(string)
  3567. sort := dataBody["sort"].(string)
  3568. pass_examination := int64(dataBody["pass_examination"].(float64))
  3569. modifications := int64(dataBody["modifications"].(float64))
  3570. adminUserInfo := this.GetAdminUserInfo()
  3571. orgId := adminUserInfo.CurrentOrgId
  3572. hadWater := models.XtDeviceWater{
  3573. SamplingDate: samp_date,
  3574. Specimenb: specimentb,
  3575. ConcentrateNoc: concentratec,
  3576. ConcentratebNod: concentraeb,
  3577. SamplingLocationb: samplinglocationb,
  3578. DetectionUnit: detectionUnit,
  3579. Samplerb: samplerb,
  3580. ReportingDateb: report_date,
  3581. DetectionResultb: detectionResultb,
  3582. Sort: sort,
  3583. PassExamination: pass_examination,
  3584. Modifications: modifications,
  3585. }
  3586. err = service.UpdateDeviceWater(id, orgId, &hadWater)
  3587. if err != nil {
  3588. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCreateConfig)
  3589. return
  3590. }
  3591. this.ServeSuccessJSON(map[string]interface{}{
  3592. "hadWater": hadWater,
  3593. })
  3594. }
  3595. func (this *MachineApiController) UpdateDevicePh() {
  3596. timeLayout := "2006-01-02"
  3597. loc, _ := time.LoadLocation("Local")
  3598. dataBody := make(map[string]interface{}, 0)
  3599. err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
  3600. fmt.Println("err", err)
  3601. id := int64(dataBody["id"].(float64))
  3602. fmt.Println("id", id)
  3603. samplingDate := dataBody["sampling_date"].(string)
  3604. sampdate, _ := time.ParseInLocation(timeLayout+" 15:04:05", samplingDate+" 00:00:00", loc)
  3605. samp_date := sampdate.Unix()
  3606. specimentb := int64(dataBody["specimenb"].(float64))
  3607. concentratec := dataBody["concentrate_noc"].(string)
  3608. concentraeb := dataBody["concentrateb_nod"].(string)
  3609. samplinglocationb := int64(dataBody["sampling_locationb"].(float64))
  3610. samplerb := int64(dataBody["samplerb"].(float64))
  3611. reportDateb := dataBody["reporting_dateb"].(string)
  3612. location, _ := time.ParseInLocation(timeLayout+" 15:04:05", reportDateb+" 00:00:00", loc)
  3613. report_date := location.Unix()
  3614. detectionResultb := dataBody["detection_resultb"].(string)
  3615. detectionUnit := dataBody["detection_unit"].(string)
  3616. sort := dataBody["sort"].(string)
  3617. pass_examination := int64(dataBody["pass_examination"].(float64))
  3618. modifications := int64(dataBody["modifications"].(float64))
  3619. adminUserInfo := this.GetAdminUserInfo()
  3620. orgId := adminUserInfo.CurrentOrgId
  3621. hadWater := models.XtDevicePh{
  3622. SamplingDate: samp_date,
  3623. Specimenb: specimentb,
  3624. ConcentrateNoc: concentratec,
  3625. ConcentratebNod: concentraeb,
  3626. SamplingLocationb: samplinglocationb,
  3627. DetectionUnit: detectionUnit,
  3628. Samplerb: samplerb,
  3629. ReportingDateb: report_date,
  3630. DetectionResultb: detectionResultb,
  3631. Sort: sort,
  3632. PassExamination: pass_examination,
  3633. Modifications: modifications,
  3634. }
  3635. err = service.UpdateDivicePh(id, orgId, &hadWater)
  3636. if err != nil {
  3637. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCreateConfig)
  3638. return
  3639. }
  3640. this.ServeSuccessJSON(map[string]interface{}{
  3641. "hadWater": hadWater,
  3642. })
  3643. }
  3644. func (this *MachineApiController) DeleteOxygenates() {
  3645. id, _ := this.GetInt64("id")
  3646. err := service.DeleteOxygenates(id)
  3647. fmt.Println(err)
  3648. returnData := make(map[string]interface{}, 0)
  3649. returnData["msg"] = "ok"
  3650. this.ServeSuccessJSON(returnData)
  3651. return
  3652. }
  3653. func (this *MachineApiController) DeleteHadWater() {
  3654. id, _ := this.GetInt64("id")
  3655. err := service.DeleteHadWater(id)
  3656. fmt.Println(err)
  3657. returnData := make(map[string]interface{}, 0)
  3658. returnData["msg"] = "ok"
  3659. this.ServeSuccessJSON(returnData)
  3660. return
  3661. }
  3662. func (this *MachineApiController) DeleteWater() {
  3663. id, _ := this.GetInt64("id")
  3664. err := service.DeleteWater(id)
  3665. fmt.Println(err)
  3666. returnData := make(map[string]interface{}, 0)
  3667. returnData["msg"] = "ok"
  3668. this.ServeSuccessJSON(returnData)
  3669. return
  3670. }
  3671. func (this *MachineApiController) DeleteDevicePh() {
  3672. id, _ := this.GetInt64("id")
  3673. err := service.DeleteDevicePh(id)
  3674. fmt.Println(err)
  3675. returnData := make(map[string]interface{}, 0)
  3676. returnData["msg"] = "ok"
  3677. this.ServeSuccessJSON(returnData)
  3678. return
  3679. }