fuwutai.component.ts 197 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932
  1. import {
  2. Component,
  3. OnInit,
  4. TemplateRef,
  5. ViewChild,
  6. ElementRef,
  7. HostListener,
  8. } from "@angular/core";
  9. import { FormBuilder, FormGroup, Validators } from "@angular/forms";
  10. import { Router, ActivatedRoute } from "@angular/router";
  11. import { MainService } from "../../services/main.service";
  12. import { WebsocketPhoneService } from "../../services/websocket-phone.service";
  13. import { WebsocketSerService } from "../../services/websocket-ser.service";
  14. import http from "../../../assets/js/http";
  15. import { NzMessageService } from "ng-zorro-antd/message";
  16. import { NzNotificationService } from "ng-zorro-antd/notification";
  17. import { OverlayScrollbarsComponent } from "overlayscrollbars-ngx";
  18. import { Subject, forkJoin } from "rxjs";
  19. import { debounceTime, filter, map } from "rxjs/operators";
  20. import { SourceId } from "src/app/type/types";
  21. import { ToolService } from 'src/app/services/tool.service';
  22. import { addDays, differenceInCalendarDays, getHours, getMinutes, setMinutes, parse, format, addHours, startOfDay, endOfDay } from 'date-fns';
  23. import { UploadFile } from 'ng-zorro-antd';
  24. import { HttpRequest, HttpClient, HttpResponse } from '@angular/common/http';
  25. import cloneDeep from 'lodash-es/cloneDeep'
  26. import { WebsocketIncomingService } from 'src/app/services/websocket-incoming.service';
  27. declare const tlwsa: any;
  28. declare const TLWSA: any;
  29. // 日期禁用
  30. function range(start: number, end: number): number[] {
  31. const result: number[] = [];
  32. for (let i = start; i < end; i++) {
  33. result.push(i);
  34. }
  35. return result;
  36. }
  37. @Component({
  38. selector: "app-fuwutai",
  39. templateUrl: "./fuwutai.component.html",
  40. styleUrls: ["./fuwutai.component.less"],
  41. })
  42. export class FuwutaiComponent implements OnInit {
  43. @ViewChild('printBtn', { static: false }) printBtn: ElementRef<HTMLElement>;
  44. @ViewChild("remarksEle", { static: false }) remarksEle: ElementRef;
  45. @ViewChild("tabs", { static: false }) tabs: ElementRef;
  46. @ViewChild("tab", { static: false }) elementView: ElementRef;
  47. @ViewChild("osComponentRef7", {
  48. read: OverlayScrollbarsComponent,
  49. static: false,
  50. })
  51. osComponentRef7: OverlayScrollbarsComponent;
  52. @ViewChild("osComponentRef8", {
  53. read: OverlayScrollbarsComponent,
  54. static: false,
  55. })
  56. osComponentRef8: OverlayScrollbarsComponent;
  57. @ViewChild("osComponentRef9", {
  58. read: OverlayScrollbarsComponent,
  59. static: false,
  60. })
  61. osComponentRef9: OverlayScrollbarsComponent;
  62. @ViewChild("osComponentRef10", {
  63. read: OverlayScrollbarsComponent,
  64. static: false,
  65. })
  66. osComponentRef10: OverlayScrollbarsComponent;
  67. @ViewChild("osComponentRef11", {
  68. read: OverlayScrollbarsComponent,
  69. static: false,
  70. })
  71. osComponentRef11: OverlayScrollbarsComponent;
  72. @ViewChild("osComponentRef12", {
  73. read: OverlayScrollbarsComponent,
  74. static: false,
  75. })
  76. osComponentRef12: OverlayScrollbarsComponent;
  77. @ViewChild("osComponentRef13", {
  78. read: OverlayScrollbarsComponent,
  79. static: false,
  80. })
  81. osComponentRef13: OverlayScrollbarsComponent;
  82. @ViewChild("osComponentRef14", {
  83. read: OverlayScrollbarsComponent,
  84. static: false,
  85. })
  86. osComponentRef14: OverlayScrollbarsComponent;
  87. @ViewChild("osComponentRef15", {
  88. read: OverlayScrollbarsComponent,
  89. static: false,
  90. })
  91. osComponentRef15: OverlayScrollbarsComponent;
  92. @ViewChild("osComponentRef16", {
  93. read: OverlayScrollbarsComponent,
  94. static: false,
  95. })
  96. osComponentRef16: OverlayScrollbarsComponent;
  97. @ViewChild("osComponentRef17", {
  98. read: OverlayScrollbarsComponent,
  99. static: false,
  100. })
  101. osComponentRef17: OverlayScrollbarsComponent;
  102. constructor(
  103. private fb: FormBuilder,
  104. public router: Router,
  105. private mainService: MainService,
  106. private msg: NzMessageService,
  107. private notification: NzNotificationService,
  108. private phones: WebsocketPhoneService,
  109. private sers: WebsocketSerService,
  110. private tool: ToolService,
  111. private http: HttpClient,
  112. public route: ActivatedRoute,
  113. public incomingService: WebsocketIncomingService,
  114. ) {
  115. // 在组件中订阅服务的Observable
  116. this.phones.getDataUpdate().subscribe(data => {
  117. this.websocketLoading = data;
  118. });
  119. }
  120. validateFormZy!: FormGroup;
  121. validateFormQt!: FormGroup;
  122. // ---------------------------------------
  123. noWorkerPhone = false; //请求是否携带来电号码
  124. patientList; //患者信息列表
  125. isLoading: Boolean = false; //下拉框loading
  126. disX = 0; //移动的距离
  127. disStep = 0; //移动的步长
  128. applicationDepartmentList = []; //新建工单->申请科室列表(搜索)
  129. callNumber = ""; //来电号码
  130. workTypes = []; //任务类型
  131. workTypesArrange = []; //整理后的任务类型
  132. workTypesFlag = false; //任务类型是否显示操作项
  133. currentTabIndex = ""; //获取任务类型的key
  134. radioValueZy: any = ""; //转运->类型
  135. radioValueZyPre: any = ""; //转运->类型
  136. deptZyList: any = {}; //转运->请求结果
  137. startDeptZy = ""; //转运->选中起点科室
  138. endDeptZy = ""; //转运->选中终点科室
  139. patientZy = ""; //转运->选中患者编码
  140. radioValueQt: any = ""; //转运->类型
  141. deptQtList: any = {}; //其他->请求结果
  142. startDeptQt = ""; //其他->选中起点科室
  143. endDeptQt = ""; //其他->选中终点科室
  144. workOrderRemark = ""; //工单备注
  145. workOrderRemarkZy = ""; //工单备注
  146. // 新建工单弹框
  147. newOrderShow = false; //展示/隐藏新建工单弹框
  148. newOrderShowOpen = false; //展示/隐藏新建工单弹框(辅助项)
  149. isOkLoading = false; //确认按钮loading状态
  150. applyDept; //申请科室
  151. applyDeptMiddle; //申请科室(中间传递)
  152. taskBuild; //任务类型选择
  153. residenceNo; //住院号
  154. targetDept; //目标科室
  155. noArrives = []; //未到达列表
  156. newLoading = false; //loading
  157. //防抖
  158. changeInpSubject = new Subject();
  159. changeCommonInpSubject = new Subject();
  160. onSearchTaskBuildSubject = new Subject();
  161. searchHosDepartmentSubject = new Subject();
  162. searchHosDepartmentQtSubject = new Subject();
  163. searchPatientListSubject = new Subject();
  164. inspectSubject = new Subject();
  165. // 运维相关
  166. incidentModel:any = {};
  167. incidentMsg:any = {};
  168. // 初始化增删改按钮
  169. coopBtns: any = {};
  170. // 获取院区配置配置,是否核酸打印
  171. isShowNucleicAcidPrinting = false;
  172. getHospitalConfigList(key) {
  173. if(!this.hsmsData.hsmsSwitch){
  174. return;
  175. }
  176. let postData = { idx: 0, sum: 1, hospitalConfig: { hosId: this.checkedHos, key } };
  177. this.mainService.getFetchDataList("simple/data", "hospitalConfig", postData).subscribe(result=>{
  178. if(result.status == 200){
  179. this.isShowNucleicAcidPrinting = result.list[0].value == 1;
  180. }else{
  181. this.isShowNucleicAcidPrinting = false;
  182. }
  183. });
  184. }
  185. // 打开选择楼栋多选框
  186. openChangeUnassignedBuilding(e) {
  187. if (e) {
  188. this.getUnassignedBuilding();
  189. }
  190. }
  191. // 获取楼栋-未派单
  192. unassignedBuildings = [];
  193. unassignedBuilding = [];
  194. bLoading = false;
  195. getUnassignedBuilding() {
  196. if(!this.hsmsData.hsmsSwitch){
  197. return;
  198. }
  199. let postData: any = {
  200. hosId: this.checkedHos,
  201. unassignedOder: 1, //未派单
  202. };
  203. if (this.allUnassignedOrders) {
  204. postData.wokerIds = this.allUnassignedOrders;
  205. }
  206. this.bLoading = true;
  207. this.mainService
  208. .coopData("getBuildingOrFloor", "building", postData)
  209. .subscribe((result) => {
  210. this.bLoading = false;
  211. if (result.status == 200) {
  212. this.unassignedBuildings = result.data;
  213. }
  214. });
  215. }
  216. allUnassignedOrders = "";
  217. b2Loading = false;
  218. getUnassignedBuilding2() {
  219. if (this.user.user.scope) {
  220. this.user.user.scope.typeIds = this.user.user.scope.typeIds || [];
  221. } else {
  222. return;
  223. }
  224. let types = "";
  225. this.user.user.scope.typeIds.forEach((e) => {
  226. types += e.id + ",";
  227. });
  228. types = types.slice(0, types.length - 1);
  229. let postData = {
  230. workOrder: {
  231. serTaskTypes: types || undefined,
  232. serGdState: 1,
  233. range: this.orderScopeRadio,
  234. platform: 3,
  235. searchDays: 1,
  236. keyWord: "",
  237. },
  238. idx: 0,
  239. sum: 9999,
  240. };
  241. this.b2Loading = true;
  242. this.mainService
  243. .getFetchDataList("ser", "workOrder", postData)
  244. .subscribe((result) => {
  245. this.b2Loading = false;
  246. if (result.status == 200) {
  247. this.allUnassignedOrders = result.list
  248. .map((item) => item.id)
  249. .toString();
  250. }
  251. });
  252. // -----------------------
  253. }
  254. // 选中未派单列表-全选
  255. changeAllUnassignedList(e) {
  256. this.unassignedList.forEach((v) => (v.checked = e));
  257. this.unassignedList.forEach((item1) => {
  258. this.unassignedListClone.forEach((item2) => {
  259. if (item1.data.id == item2.data.id) {
  260. item2.checked = item1.checked;
  261. }
  262. });
  263. });
  264. this.batchType = this.unassignedListClone.some((item) => item.checked);
  265. }
  266. // 选中待到达列表-全选
  267. changeAllArriveList(e) {
  268. this.arriveList.forEach((v) => (v.checked = e));
  269. this.arriveList.forEach((item1) => {
  270. this.arriveListClone.forEach((item2) => {
  271. if (item1.data.id == item2.data.id) {
  272. item2.checked = item1.checked;
  273. }
  274. });
  275. });
  276. this.batchType1 = this.arriveListClone.some((item) => item.checked);
  277. }
  278. // 添加备注
  279. addRemarks(item) {
  280. this.remarksEle.nativeElement.focus();
  281. this.workOrderRemark += item;
  282. }
  283. // 批量分派
  284. batchType = false; //是否开启批量派单
  285. batchDispatch() {
  286. let ids_types = [];
  287. let stateIds = [];
  288. this.unassignedList.forEach((item) => {
  289. if (item.checked) {
  290. if (item.data.gdState.value == 2) {
  291. //普通派单
  292. ids_types.push(`${item.data.id}_assign`);
  293. } else if (!item.data.worker && item.data.gdState.value != 2) {
  294. ids_types.push(`${item.data.id}_reassign`);
  295. }
  296. stateIds.push(item.data.gdState.id);
  297. }
  298. });
  299. this.router.navigateByUrl(
  300. "dispatchingDesk/allotWorker/" +
  301. ids_types.join("-") +
  302. "/" +
  303. stateIds.join("-") +
  304. "/2/" +
  305. this.checkedHos
  306. );
  307. }
  308. // 批量撤回
  309. batchType1 = false; //是否开启批量撤回
  310. batchClickType1 = false; //是否点击批量撤回
  311. batchWithdrawal() {
  312. this.batchClickType1 = true;
  313. let ids = [];
  314. this.arriveList.forEach((item) => {
  315. if (item.checked) {
  316. ids.push(item.data.id);
  317. }
  318. });
  319. this.openRecallModal(ids.join("-"));
  320. }
  321. // 批量分派选中
  322. allUnassignedList = false;
  323. batchDispatchSelect(e, id, event?) {
  324. event && event.stopPropagation();
  325. this.unassignedList.forEach((item) => {
  326. if (item.data.id == id) {
  327. item.checked = e;
  328. }
  329. });
  330. this.unassignedList.forEach((item1) => {
  331. this.unassignedListClone.forEach((item2) => {
  332. if (item1.data.id == item2.data.id) {
  333. item2.checked = item1.checked;
  334. }
  335. });
  336. });
  337. this.batchType = this.unassignedListClone.some((item) => item.checked);
  338. if (this.unassignedListClone.length) {
  339. this.allUnassignedList = this.unassignedListClone.every(
  340. (item) => item.checked
  341. );
  342. } else {
  343. this.allUnassignedList = false;
  344. }
  345. }
  346. // 批量撤回选中
  347. allArriveList = false;
  348. batchWithdrawalSelect(e, id, event?) {
  349. event && event.stopPropagation();
  350. this.arriveList.forEach((item) => {
  351. if (item.data.id == id) {
  352. item.checked = e;
  353. }
  354. });
  355. this.arriveList.forEach((item1) => {
  356. this.arriveListClone.forEach((item2) => {
  357. if (item1.data.id == item2.data.id) {
  358. item2.checked = item1.checked;
  359. }
  360. });
  361. });
  362. this.batchType1 = this.arriveListClone.some((item) => item.checked);
  363. if (this.arriveListClone.length) {
  364. this.allArriveList = this.arriveListClone.every((item) => item.checked);
  365. } else {
  366. this.allArriveList = false;
  367. }
  368. }
  369. // 获取科室
  370. applyStartDept;
  371. // 患者转运表单提交
  372. submitFormZy(go?): void {
  373. let newOrderShowFlag = true; //是否可以关闭弹窗
  374. for (const i in this.validateFormZy.controls) {
  375. this.validateFormZy.controls[i].markAsDirty();
  376. this.validateFormZy.controls[i].updateValueAndValidity();
  377. if (this.validateFormZy.controls[i].valid === false && i !== "goods") {
  378. //携带设备非必填
  379. // if (this.validateFormZy.controls[i].valid === false && i !== 'goods' && i !== 'patient') {//携带设备非必填
  380. newOrderShowFlag = false;
  381. }
  382. if (!this.validateFormZy.controls[i].valid) {
  383. this.isOkLoading = false;
  384. this.isGoLoading = false;
  385. }
  386. }
  387. if (newOrderShowFlag) {
  388. let goods = this.validateFormZy.controls.goods.value
  389. ? this.validateFormZy.controls.goods.value.filter(
  390. (item) => item.checked === true
  391. )
  392. : [];
  393. goods = goods.map((current) => current.value).join();
  394. // 预约日期
  395. let yyTime1;
  396. if(this.isYyInspect && this.currentTabIndex == '患者转运'){
  397. let yyDateZy = (typeof this.yyDateZy === 'object') ? new Date(this.yyDateZy) : parse(this.yyDateZy, 'yyyy-MM-dd HH:mm:ss', new Date());
  398. let yyTimeZy = (typeof this.yyTimeZy === 'object') ? new Date(this.yyTimeZy) : parse(this.yyTimeZy, 'yyyy-MM-dd HH:mm:ss', new Date());
  399. yyTime1 = format(yyDateZy, "yyyy-MM-dd") + " " + format(yyTimeZy, "HH:mm") + ":00";
  400. }
  401. let postData = {
  402. workOrder: {
  403. yyTime: yyTime1,
  404. sourceId: SourceId.fuwutai,
  405. taskType: {
  406. id: this.validateFormZy.controls.taskType.value,
  407. },
  408. startDept: {
  409. id: this.validateFormZy.controls.startDept.value,
  410. },
  411. createDept: this.applyDept,
  412. endDepts: [
  413. {
  414. id: this.validateFormZy.controls.endDepts.value,
  415. },
  416. ],
  417. patient: {
  418. patientCode: this.validateFormZy.controls.patient.value,
  419. },
  420. goods: goods,
  421. workOrderRemark: this.validateFormZy.controls.workOrderRemarkZy.value,
  422. },
  423. };
  424. if (!this.noWorkerPhone) {
  425. postData.workOrder["workOrderPhone"] = this.callNumber;
  426. }
  427. this.mainService.buildOrder(postData).subscribe((data) => {
  428. console.log(data);
  429. this.isOkLoading = false;
  430. this.isGoLoading = false;
  431. if (data["status"] == 200) {
  432. this.newOrderShow = false; //关闭弹窗
  433. if (go === "&go&") {
  434. this.applyDept = data["startDept"].id;
  435. this.applyStartDept = data["startDept"];
  436. this.incidentModel.incomingPhone = this.callNumber = this.incidentModel.contactsInformation = data["phone"];
  437. this.showPromptModal("建单", true, "", "closeGo");
  438. } else {
  439. if(this.incomingService.getSign() === 'callCenter' && this.incomingService.getPhoneNumber()){
  440. this.jry_shixian();
  441. }
  442. this.showPromptModal("建单", true, "", "close");
  443. }
  444. } else {
  445. this.showPromptModal("建单", false, data["msg"]);
  446. }
  447. });
  448. }
  449. }
  450. // 患者陪检表单提交
  451. submitFormInspect(go?): void {
  452. let newOrderShowFlag = true; //是否可以关闭弹窗
  453. for (const i in this.validateFormZy.controls) {
  454. this.validateFormZy.controls[i].markAsDirty();
  455. this.validateFormZy.controls[i].updateValueAndValidity();
  456. if (this.validateFormZy.controls[i].valid === false && i !== "goods") {
  457. //携带设备非必填
  458. // if (this.validateFormZy.controls[i].valid === false && i !== 'goods' && i !== 'patient') {//携带设备非必填
  459. newOrderShowFlag = false;
  460. }
  461. if (!this.validateFormZy.controls[i].valid) {
  462. this.isOkLoading = false;
  463. this.isGoLoading = false;
  464. }
  465. }
  466. if (newOrderShowFlag) {
  467. let goods = this.validateFormZy.controls.goods.value ? this.validateFormZy.controls.goods.value.filter((item) => item.checked === true) : [];
  468. goods = goods.map((current) => current.value).join();
  469. // 预约日期
  470. let yyTime1;
  471. if(this.isYyInspect && this.currentTabIndex == '患者转运'){
  472. let yyDateZy = (typeof this.yyDateZy === 'object') ? new Date(this.yyDateZy) : parse(this.yyDateZy, 'yyyy-MM-dd HH:mm:ss', new Date());
  473. let yyTimeZy = (typeof this.yyTimeZy === 'object') ? new Date(this.yyTimeZy) : parse(this.yyTimeZy, 'yyyy-MM-dd HH:mm:ss', new Date());
  474. yyTime1 = format(yyDateZy, "yyyy-MM-dd") + " " + format(yyTimeZy, "HH:mm") + ":00";
  475. }
  476. let postData: any = {
  477. workOrder: {
  478. yyTime: yyTime1,
  479. sourceId: SourceId.fuwutai,
  480. taskType: { id: this.validateFormZy.controls.taskType.value },
  481. startDept: { id: this.applyDept },
  482. // endDepts: [{ id: this.deptZyList.data.endDept }],
  483. createDept: this.applyDept,
  484. patient: {
  485. patientCode: this.validateFormZy.controls.patient.value,
  486. },
  487. goods,
  488. workOrderRemark: this.validateFormZy.controls.workOrderRemarkZy.value,
  489. },
  490. };
  491. postData.workOrder.taskType.isHalfInspect = this.currentTasktype.isHalfInspect === 1 ? 1 : 0; //半程陪检
  492. let checkedArr = [];
  493. if (this.linkCheckLis && this.linkCheckLis.length) {
  494. this.linkCheckLis.forEach((e) => {
  495. if (e.checked) {
  496. checkedArr.push({ id: e.value });
  497. }
  498. });
  499. }
  500. postData.workOrder["checkList"] = checkedArr;
  501. postData.workOrder.isAccompany = 0; //是否需要医护陪同检查
  502. if (!this.noWorkerPhone) {
  503. postData.workOrder["workOrderPhone"] = this.callNumber;
  504. }
  505. this.mainService.buildOrder(postData).subscribe((data) => {
  506. console.log(data);
  507. this.isOkLoading = false;
  508. this.isGoLoading = false;
  509. if (data["status"] == 200) {
  510. this.newOrderShow = false; //关闭弹窗
  511. if (go === "&go&") {
  512. this.applyDept = data["startDept"].id;
  513. this.applyStartDept = data["startDept"];
  514. this.incidentModel.incomingPhone = this.callNumber = this.incidentModel.contactsInformation = data["phone"];
  515. this.showPromptModal("建单", true, "", "closeGo");
  516. } else {
  517. if(this.incomingService.getSign() === 'callCenter' && this.incomingService.getPhoneNumber()){
  518. this.jry_shixian();
  519. }
  520. this.showPromptModal("建单", true, "", "close");
  521. }
  522. } else if(data["status"] == 100042){
  523. this.newOrderShow = false; //关闭弹窗
  524. this.showPromptModal("建单", false, data["msg"]);
  525. } else {
  526. this.showPromptModal("建单", false, data["msg"]);
  527. }
  528. });
  529. }
  530. }
  531. // 标本配送表单提交
  532. submitFormBbps(go?) {
  533. let postData = {
  534. workOrder: {
  535. workOrderRemark: this.validateFormQt.controls.workOrderRemark.value,
  536. sourceId: SourceId.fuwutai,
  537. taskType: {
  538. id: this.validateFormQt.controls.taskTypeQt.value,
  539. },
  540. startDept: {
  541. id: this.applyDept,
  542. },
  543. },
  544. };
  545. if (!this.noWorkerPhone) {
  546. postData.workOrder["workOrderPhone"] = this.callNumber;
  547. }
  548. this.mainService.buildOrder(postData).subscribe((data) => {
  549. this.isOkLoading = false;
  550. this.isGoLoading = false;
  551. if (data["status"] == 200) {
  552. this.newOrderShow = false; //关闭弹窗
  553. if (go === "&go&") {
  554. this.applyDept = data["startDept"].id;
  555. this.applyStartDept = data["startDept"];
  556. this.incidentModel.incomingPhone = this.callNumber = this.incidentModel.contactsInformation = data["phone"];
  557. this.showPromptModal("建单", true, "", "closeGo");
  558. } else {
  559. if(this.incomingService.getSign() === 'callCenter' && this.incomingService.getPhoneNumber()){
  560. this.jry_shixian();
  561. }
  562. this.showPromptModal("建单", true, "", "close");
  563. }
  564. } else {
  565. this.showPromptModal("建单", false, data["msg"]);
  566. }
  567. });
  568. }
  569. // 其他表单提交
  570. submitFormQt(go?) {
  571. for (const i in this.validateFormQt.controls) {
  572. this.validateFormQt.controls[i].markAsDirty();
  573. this.validateFormQt.controls[i].updateValueAndValidity();
  574. if (!this.validateFormQt.controls[i].valid) {
  575. this.isOkLoading = false;
  576. this.isGoLoading = false;
  577. return;
  578. }
  579. }
  580. // 预约日期
  581. let yyTime1;
  582. if(this.isYyInspect && this.currentTabIndex == '物品配送'){
  583. let yyDate = (typeof this.yyDate === 'object') ? new Date(this.yyDate) : parse(this.yyDate, 'yyyy-MM-dd HH:mm:ss', new Date());
  584. let yyTime = (typeof this.yyTime === 'object') ? new Date(this.yyTime) : parse(this.yyTime, 'yyyy-MM-dd HH:mm:ss', new Date());
  585. yyTime1 = format(yyDate, "yyyy-MM-dd") + " " + format(yyTime, "HH:mm") + ":00";
  586. }
  587. let postData = {
  588. workOrder: {
  589. yyTime: yyTime1,
  590. sourceId: SourceId.fuwutai,
  591. workOrderRemark: this.validateFormQt.controls.workOrderRemark.value,
  592. taskType: {
  593. id: this.validateFormQt.controls.taskTypeQt.value,
  594. },
  595. startDept: {
  596. id: this.validateFormQt.controls.startDeptQt.value,
  597. },
  598. createDept: this.applyDept,
  599. endDepts: [
  600. {
  601. id: this.validateFormQt.controls.endDeptsQt.value,
  602. },
  603. ],
  604. },
  605. };
  606. if (!this.noWorkerPhone) {
  607. postData.workOrder["workOrderPhone"] = this.callNumber;
  608. }
  609. this.mainService.buildOrder(postData).subscribe((data) => {
  610. this.isOkLoading = false;
  611. this.isGoLoading = false;
  612. if (data["status"] == 200) {
  613. this.newOrderShow = false; //关闭弹窗
  614. if (go === "&go&") {
  615. this.applyDept = data["startDept"].id;
  616. this.applyStartDept = data["startDept"];
  617. this.incidentModel.incomingPhone = this.callNumber = this.incidentModel.contactsInformation = data["phone"];
  618. this.showPromptModal("建单", true, "", "closeGo");
  619. } else {
  620. if(this.incomingService.getSign() === 'callCenter' && this.incomingService.getPhoneNumber()){
  621. this.jry_shixian();
  622. }
  623. this.showPromptModal("建单", true, "", "close");
  624. }
  625. } else {
  626. this.showPromptModal("建单", false, data["msg"]);
  627. }
  628. });
  629. }
  630. // 万能交接表单提交
  631. submitFormOrdinary(go?) {
  632. for (const i in this.validateFormQt.controls) {
  633. this.validateFormQt.controls[i].markAsDirty();
  634. this.validateFormQt.controls[i].updateValueAndValidity();
  635. if (!this.validateFormQt.controls[i].valid) {
  636. this.isOkLoading = false;
  637. this.isGoLoading = false;
  638. return;
  639. }
  640. }
  641. let postData = {
  642. workOrder: {
  643. sourceId: SourceId.fuwutai,
  644. workOrderRemark: this.validateFormQt.controls.workOrderRemark.value,
  645. taskType: {
  646. id: this.validateFormQt.controls.taskTypeQt.value,
  647. },
  648. startDept: {
  649. id: this.validateFormQt.controls.startDeptQt.value,
  650. },
  651. createDept: this.applyDept,
  652. endDepts: [
  653. {
  654. id: this.validateFormQt.controls.endDeptsQt.value,
  655. },
  656. ],
  657. },
  658. };
  659. if (!this.noWorkerPhone) {
  660. postData.workOrder["workOrderPhone"] = this.callNumber;
  661. }
  662. this.mainService.buildOrder(postData).subscribe((data) => {
  663. this.isOkLoading = false;
  664. this.isGoLoading = false;
  665. if (data["status"] == 200) {
  666. this.newOrderShow = false; //关闭弹窗
  667. if (go === "&go&") {
  668. this.applyDept = data["startDept"].id;
  669. this.applyStartDept = data["startDept"];
  670. this.incidentModel.incomingPhone = this.callNumber = this.incidentModel.contactsInformation = data["phone"];
  671. this.showPromptModal("建单", true, "", "closeGo");
  672. } else {
  673. if(this.incomingService.getSign() === 'callCenter' && this.incomingService.getPhoneNumber()){
  674. this.jry_shixian();
  675. }
  676. this.showPromptModal("建单", true, "", "close");
  677. }
  678. } else {
  679. this.showPromptModal("建单", false, data["msg"]);
  680. }
  681. });
  682. }
  683. // 核酸打印
  684. nucleicAcidLoading = false;
  685. nucleicAcidList: any = [];
  686. // nucleicAcidListPageIndex: number = 1;//表格当前页码
  687. // nucleicAcidListPageSize: number = 5;//表格每页展示条数
  688. // nucleicAcidListLength: number = 10;//表格总数据量
  689. // 获取列表数据
  690. getNucleicAcidBuildingSummary(idx?) {
  691. // if (idx) {
  692. // this.nucleicAcidListPageIndex = 1;
  693. // }
  694. this.nucleicAcidLoading = true;
  695. this.mainService.getNucleicAcidBuildingSummary({}).subscribe((data:any) => {
  696. this.nucleicAcidLoading = false;
  697. let nucleicAcidList = data.data || [];
  698. for (let i = 0; i < nucleicAcidList.length; i++) {
  699. if(nucleicAcidList[i].deptData && Array.isArray(nucleicAcidList[i].deptData)){
  700. nucleicAcidList[i].deptNames = nucleicAcidList[i].deptData.map(v=>v.deptName).toString();
  701. }else{
  702. nucleicAcidList[i].deptData = [];
  703. nucleicAcidList[i].deptNames = '';
  704. }
  705. }
  706. this.nucleicAcidList = nucleicAcidList;
  707. console.log(this.nucleicAcidList)
  708. // this.nucleicAcidListLength = data.totalNum || 0;
  709. })
  710. }
  711. // 打印
  712. mapQrcodes:any = {};
  713. printDate:number = Date.now();
  714. printAucleicAcid(){
  715. this.isOkLoading = true;
  716. this.mainService.printNucleicAcid({}).subscribe((data:any) => {
  717. this.isOkLoading = false;
  718. if(data.state == 200){
  719. let mapQrcodes = {};
  720. data.data.forEach(v=>{
  721. mapQrcodes[v.buildId] = v.qrcode;
  722. })
  723. this.mapQrcodes = mapQrcodes;
  724. this.nucleicAcidPrintingCancel();
  725. setTimeout(()=>{
  726. this.printBtn.nativeElement.click();
  727. },0)
  728. }else{
  729. this.msg.create('error', `操作失败!`);
  730. }
  731. })
  732. }
  733. //获取检查页面任务类型
  734. getInspectAndPatientTransportConfigTasktype() {
  735. if(!this.hsmsData.hsmsSwitch){
  736. return;
  737. }
  738. let postData = {
  739. idx: 0,
  740. sum: 10,
  741. taskType: {
  742. simpleQuery: true,
  743. hosId: {
  744. id: this.checkedHos
  745. },
  746. associationType: {
  747. key:"association_types",
  748. value: 'inspect'
  749. }
  750. }
  751. };
  752. this.mainService
  753. .getFetchDataList("simple/data", "taskType", postData)
  754. .subscribe((result) => {
  755. if (result.status == 200) {
  756. let tasktype:any = result.list[0] || {};
  757. this.getInspectAndPatientTransportConfig(tasktype);
  758. }
  759. });
  760. }
  761. // 获取检查页面信息配置
  762. getInspectAndPatientTransportConfig(tasktype) {
  763. if(!this.hsmsData.hsmsSwitch){
  764. return;
  765. }
  766. let postData = {
  767. idx: 0,
  768. sum: 10,
  769. taskTypeConfig: {
  770. taskTypeDTO: {
  771. hosId: {
  772. id: this.checkedHos
  773. },
  774. associationType: tasktype.associationType
  775. }
  776. }
  777. };
  778. this.mainService
  779. .getFetchDataList("simple/data", "taskTypeConfig", postData)
  780. .subscribe((result) => {
  781. if (result.status == 200) {
  782. let inspectAndPatientTransportConfig = result.list[0] || {};
  783. this.inspectAndPatientTransportConfig = {...this.inspectAndPatientTransportConfig, ...inspectAndPatientTransportConfig};
  784. }
  785. });
  786. }
  787. ngOnInit() {
  788. this.websocketLoading = true;
  789. this.coopBtns = this.tool.initCoopBtns(this.route);
  790. // console.log(8989899,this.coopBtns)
  791. //防抖
  792. this.changeInpSubject.pipe(debounceTime(500)).subscribe((v) => {
  793. this.searchApplicationDepartment(v[0], v[1]);
  794. });
  795. this.inspectSubject.pipe(debounceTime(500)).subscribe((v) => {
  796. this.refreshInspectList();
  797. });
  798. this.changeCommonInpSubject.pipe(debounceTime(500)).subscribe((v) => {
  799. if(v[0] === 'requester'){
  800. this.searchApplicationRequester(v[1]);
  801. }else if(v[0] === 'category'){
  802. this.searchApplicationCategory(v[1]);
  803. }else if(v[0] === 'group'){
  804. this.searchApplicationGroup(v[1]);
  805. }else if(v[0] === 'user'){
  806. this.searchApplicationUser(v[1]);
  807. }else if(v[0] === 'patient'){
  808. this.getPatientByResidenceNo(v[1]);
  809. }
  810. });
  811. this.onSearchTaskBuildSubject.pipe(debounceTime(500)).subscribe((v) => {
  812. this.getTasktypeByPhone(v);
  813. });
  814. this.searchHosDepartmentSubject.pipe(debounceTime(500)).subscribe((v) => {
  815. this.getHosDepartment(v[0], v[1], v[2]);
  816. });
  817. this.searchHosDepartmentQtSubject.pipe(debounceTime(500)).subscribe((v) => {
  818. this.getHosDepartmentQt(v[0], v[1], v[2]);
  819. });
  820. this.searchPatientListSubject.pipe(debounceTime(500)).subscribe((v) => {
  821. this.getPatientList(v[0], v[1]);
  822. });
  823. //患者转运
  824. this.validateFormZy = this.fb.group({
  825. taskType: [null, [Validators.required]], //类型
  826. linkCheck: [null, []],
  827. startDept: [null, [Validators.required]], //起点科室
  828. endDepts: [null, [Validators.required]], //终点科室
  829. patient: [null, [Validators.required]], //患者信息
  830. // patient: [null],//患者信息ca
  831. goods: [null], //携带设备
  832. workOrderRemarkZy: [null], //工单备注
  833. });
  834. //其他
  835. this.validateFormQt = this.fb.group({
  836. taskTypeQt: [null, [Validators.required]], //类型
  837. startDeptQt: [null, [Validators.required]], //起点科室
  838. endDeptsQt: [null, [Validators.required]], //终点科室
  839. workOrderRemark: [null], //工单备注
  840. });
  841. this.getWebsocketSer();
  842. this.initRole();
  843. this.initLogin();
  844. this.retract();
  845. this.refresh();
  846. this.initOrderScope();
  847. this.getVisitList();
  848. this.getMessageList();
  849. this.initControlView();
  850. this.moveMenu("fixedMenu");
  851. this.moveMenu("fixedMenuLeft");
  852. this.moveMenuAll("fixedMenuAll");
  853. if(this.incomingService.getSign() === 'box'){
  854. this.getPhoneNum();
  855. }else if(this.incomingService.getSign() === 'callCenter'){
  856. setTimeout(this.getPhoneNum.bind(this), 2000)
  857. }else{
  858. this.websocketLoading = false;
  859. }
  860. this.getUnassignedBuilding2();
  861. this.getInspectAndPatientTransportConfigTasktype();
  862. this.initCallCenter();
  863. }
  864. ngOnDestroy() {
  865. document.removeEventListener("keydown", this.quickShowNewOrder.bind(this));
  866. this.quickShowNewOrder = null;
  867. clearTimeout(this.refreshTimerId);
  868. this.incomingService.closeWs(true);
  869. this.sers.closeWs(true);
  870. }
  871. ngAfterViewInit() {
  872. // 快捷键打开新建工单
  873. document.addEventListener("keydown", this.quickShowNewOrder.bind(this));
  874. }
  875. requiredConfigChange(form: string, name: string, required: boolean): void {
  876. if (!required) {
  877. this[form].get(name)!.clearValidators();
  878. this[form].get(name)!.markAsPristine();
  879. } else {
  880. this[form].get(name)!.setValidators(Validators.required);
  881. this[form].get(name)!.markAsDirty();
  882. }
  883. this[form].get(name)!.updateValueAndValidity();
  884. }
  885. // 初始化呼叫中心方法
  886. initCallCenter(){
  887. let _this = this;
  888. // 状态回调函数
  889. // TLWSA.onStatechange = onstatechange;
  890. // function onstatechange() {
  891. // console.log('事件:状态变化----------------------------------------------------');
  892. // _this.getState();
  893. // }
  894. //连接呼叫中心回调函数
  895. TLWSA.onOpenreturn = (err) => {
  896. err = Number(err);
  897. if (!err) {
  898. _this.incomingService.setPhoneNumber(TLWSA.phoneNumber);
  899. _this.websocketLoading = false;
  900. _this.cancelBindExtensionNumber();
  901. console.log('呼叫中心连接成功-----seimin');
  902. _this.getState(0);
  903. _this.msg.success('呼叫中心连接成功')
  904. //如果设置过话机
  905. if (_this.incomingService.getPhoneNumberPre()) {
  906. //强制签出,然后签入
  907. tlwsa.tlaKillworkid(+_this.incomingService.getPhoneNumberPre());
  908. }else{
  909. // 签入并绑定分机
  910. tlwsa.tlaLogin(_this.user.user.id, 1, -1);
  911. }
  912. } else {
  913. console.log('呼叫中心连接失败-----seimin');
  914. _this.getState(0);
  915. _this.msg.error('呼叫中心连接失败')
  916. }
  917. }
  918. //绑定分机回调函数
  919. TLWSA.onSetphonenumberreturn = function (err) {
  920. err = Number(err);
  921. if (!err) {
  922. console.log('绑定分机成功-----seimin');
  923. _this.msg.success('绑定分机成功')
  924. _this.incomingService.setPhoneNumberPre(_this.user.user.id);
  925. _this.qShimang(1);
  926. } else {
  927. console.log('绑定分机失败-----seimin');
  928. _this.getState(0);
  929. _this.msg.error('绑定分机失败')
  930. }
  931. }
  932. //强制示忙回调函数
  933. // TLWSA.onAcw = onacw;
  934. // function onacw(err) {
  935. // err = Number(err);
  936. // if (!err) {
  937. // console.log('强制示忙成功-----seimin');
  938. // _this.getState(2);
  939. // $.toaster({
  940. // priority: 'info',
  941. // title: '操作',
  942. // message: '示忙成功'
  943. // });
  944. // } else {
  945. // console.log('强制示忙失败-----seimin');
  946. // $.toaster({
  947. // priority: 'info',
  948. // title: '操作',
  949. // message: '示忙失败'
  950. // });
  951. // }
  952. // }
  953. // //强制示闲回调函数
  954. // TLWSA.onWca = onwca;
  955. // function onwca(err) {
  956. // console.log(err)
  957. // err = Number(err);
  958. // if (!err) {
  959. // console.log('强制示闲成功-----seimin');
  960. // _this.getState(1);
  961. // $.toaster({
  962. // priority: 'info',
  963. // title: '操作',
  964. // message: '示闲成功'
  965. // });
  966. // } else {
  967. // console.log('强制示闲失败-----seimin');
  968. // $.toaster({
  969. // priority: 'info',
  970. // title: '操作',
  971. // message: '示闲失败'
  972. // });
  973. // }
  974. // }
  975. //与服务器网络连接中断回调函数
  976. let timer = null;
  977. TLWSA.onClosed = () => {
  978. _this.getState(0);
  979. clearTimeout(timer);
  980. if(location.hash === '#/dispatchingDesk'){
  981. console.log('与服务器网络连接中断-----seimin');
  982. if(this.incomingService.getPhoneNumber()){
  983. _this.msg.info('与服务器网络连接中断,2分钟后重连')
  984. console.log('2分钟后自动重连-----seimin')
  985. timer = setTimeout(function () {
  986. //连接
  987. TLWSA.phoneNumber = _this.incomingService.getPhoneNumber();
  988. tlwsa.tlaOpen(_this.incomingService.getSocketUrl());
  989. }, 120000)
  990. }else{
  991. _this.websocketLoading = false;
  992. }
  993. }
  994. }
  995. //签入回调函数
  996. TLWSA.onLoginreturn = function (err) {
  997. err = Number(err);
  998. if (!err) {
  999. console.log('签入成功-----seimin');
  1000. _this.msg.success('签入成功')
  1001. setTimeout(function () {
  1002. console.log(_this.incomingService.getPhoneNumber(), 1111)
  1003. var phoneNumber = _this.incomingService.getPhoneNumber();
  1004. console.log('开始绑定分机【' + phoneNumber + '】-----seimin');
  1005. tlwsa.tlaSetphonenumber(phoneNumber);
  1006. }, 0)
  1007. } else if (err == 9011) {
  1008. console.log('签入失败,该分机已登录-----seimin');
  1009. _this.msg.error('签入失败,该分机已登录')
  1010. } else {
  1011. console.log('签入失败-----seimin');
  1012. _this.msg.error('签入失败')
  1013. }
  1014. }
  1015. // 强制签出回调函数
  1016. TLWSA.onKillreturn = function (err) {
  1017. err = Number(err);
  1018. if (!err) {
  1019. console.log('强制签出成功-----seimin');
  1020. _this.getState(0);
  1021. // $.toaster({
  1022. // priority: 'info',
  1023. // title: '操作',
  1024. // message: '强制签出成功'
  1025. // });
  1026. } else {
  1027. console.log('强制签出失败,该分机不是签入状态-----seimin');
  1028. // $.toaster({
  1029. // priority: 'info',
  1030. // title: '操作',
  1031. // message: '强制签出失败'
  1032. // });
  1033. }
  1034. //如果设置过话机
  1035. if (_this.incomingService.getPhoneNumberPre()) {
  1036. // 签入并绑定分机
  1037. tlwsa.tlaLogin(+_this.incomingService.getPhoneNumberPre(), 1, -1);
  1038. }
  1039. }
  1040. // 签出回调函数
  1041. TLWSA.onLogoffreturn = function (err) {
  1042. err = Number(err);
  1043. if (!err) {
  1044. console.log('签出成功-----seimin');
  1045. _this.getState(0);
  1046. _this.msg.success('签出成功')
  1047. _this.incomingService.removePhoneNumberPre();
  1048. _this.incomingService.removePhoneNumber();
  1049. } else {
  1050. console.log('签出失败-----seimin');
  1051. _this.msg.error('签出失败')
  1052. }
  1053. }
  1054. //示忙回调函数
  1055. TLWSA.onAcwreturn = function (err) {
  1056. err = Number(err);
  1057. if (!err) {
  1058. console.log('示忙成功-----seimin');
  1059. if (location.href.includes('app/incident/editor') || location.href.includes('app/incident/chart')) {
  1060. _this.isShixian = false;
  1061. } else {
  1062. _this.isShixian = true;
  1063. }
  1064. _this.getState(2);
  1065. _this.preState = 2;
  1066. _this.msg.success('示忙成功')
  1067. } else {
  1068. console.log('示忙失败-----seimin');
  1069. // $.toaster({
  1070. // priority: 'info',
  1071. // title: '操作',
  1072. // message: '示忙失败'
  1073. // });
  1074. }
  1075. }
  1076. //示闲回调函数
  1077. TLWSA.onWcareturn = function (err) {
  1078. err = Number(err);
  1079. if (!err) {
  1080. console.log('示闲成功-----seimin');
  1081. _this.getState(1);
  1082. _this.preState = 1;
  1083. _this.msg.success('示闲成功')
  1084. } else {
  1085. console.log('示闲失败-----seimin');
  1086. _this.msg.error('示闲失败')
  1087. }
  1088. }
  1089. //呼叫坐席回调函数
  1090. TLWSA.onCallreturn = function (err) {
  1091. err = Number(err);
  1092. if (!err) {
  1093. console.log('呼叫成功,请摘机-----seimin');
  1094. _this.getState(6);
  1095. _this.msg.success('呼叫成功,请摘机')
  1096. } else {
  1097. console.log('呼叫失败-----seimin');
  1098. _this.msg.error('呼叫失败')
  1099. }
  1100. }
  1101. //呼叫坐席被接听回调函数
  1102. TLWSA.onCallresult = function (jso) {
  1103. console.log(jso);
  1104. var err = Number(jso.err);
  1105. if (!err) {
  1106. console.log('呼叫被接听成功-----seimin');
  1107. _this.getState(5);
  1108. _this.msg.success('呼叫被接听成功')
  1109. } else {
  1110. console.log('呼叫被接听失败-----seimin');
  1111. _this.qShimang(1);
  1112. _this.msg.error('呼叫被接听失败')
  1113. }
  1114. }
  1115. //挂断回调函数
  1116. TLWSA.onCallend = function (jso) {
  1117. console.log(jso);//lmm
  1118. if (jso) {
  1119. console.log('挂断成功-----seimin');
  1120. console.log('最近一次话机状态', _this.preState);
  1121. _this.qShimang(_this.preState);
  1122. _this.msg.success('挂断成功')
  1123. } else {
  1124. console.log('挂断失败-----seimin');
  1125. _this.msg.error('挂断失败')
  1126. }
  1127. }
  1128. //呼入回调函数
  1129. TLWSA.onCallin = function (jso) {
  1130. console.log(jso);
  1131. _this.incidentModel = { repairIncidentType: 'dept' };
  1132. _this.callNumber = _this.incidentModel.incomingPhone = jso.caller;//来电的电话
  1133. _this.incidentModel.callID = jso.crs;//来电的话机id
  1134. if (jso) {
  1135. console.log('呼入坐席成功,请摘机-----seimin');
  1136. _this.getState(3);
  1137. _this.msg.success('呼入坐席成功,请摘机')
  1138. console.log('来电了!电话号码是【' + _this.incidentModel.incomingPhone + '】');
  1139. } else {
  1140. console.log('呼入坐席失败-----seimin');
  1141. _this.msg.error('呼入坐席失败')
  1142. }
  1143. }
  1144. // 测试代码start
  1145. // searchBxDept();
  1146. // 测试代码end
  1147. // 查报修科室
  1148. // function searchBxDept() {
  1149. // var postData = { "idx": 0, "sum": 10, "department": { phone: _this.callNumber = _this.incidentModel.incomingPhone } };//hjzxPhone
  1150. // api_user_data.fetchDataList('department', postData).then(function (result) {
  1151. // if (result.status == 200) {
  1152. // console.log(result.list);
  1153. // var requesters = result.list;
  1154. // if (requesters.length === 0) {
  1155. // //未匹配到报修科室
  1156. // $rootScope.newOrder({
  1157. // incident: {
  1158. // sockid: _this.incidentModel.callID,
  1159. // incomingPhone: _this.callNumber = _this.incidentModel.incomingPhone,
  1160. // source: { id: 1547, name: '电话' }
  1161. // },
  1162. // }, 'incomingCall')
  1163. // } else if (requesters.length === 1) {
  1164. // //匹配到一个报修科室
  1165. // $rootScope.newOrder({
  1166. // incident: {
  1167. // department: requesters[0],
  1168. // phone: requesters[0].phone,
  1169. // sockid: _this.incidentModel.callID,
  1170. // incomingPhone: _this.callNumber = _this.incidentModel.incomingPhone,
  1171. // source: { id: 1547, name: '电话' }
  1172. // },
  1173. // }, 'incomingCall')
  1174. // } else {
  1175. // //匹配到多个报修科室
  1176. // $modal.open({
  1177. // templateUrl: 'assets/views/incident/tpl/tel.html',
  1178. // controller: function ($scope, $modalInstance, $timeout, SweetAlert) {
  1179. // $scope.list = requesters;
  1180. // $scope.selected = {
  1181. // selectedItem: 0
  1182. // };
  1183. // $scope.cancel = function () {
  1184. // $modalInstance.dismiss('cancel');
  1185. // };
  1186. // $scope.changeBxr = function (id) {
  1187. // $scope.selected.selectedItem = id;
  1188. // }
  1189. // $scope.save = function () {
  1190. // var item = $scope.list.find(v => v.id == $scope.selected.selectedItem);
  1191. // if (item) {
  1192. // $scope.cancel();
  1193. // $rootScope.newOrder({
  1194. // incident: {
  1195. // department: item,
  1196. // phone: item.phone,
  1197. // sockid: _this.incidentModel.callID,
  1198. // incomingPhone: _this.callNumber = _this.incidentModel.incomingPhone,
  1199. // source: { id: 1547, name: '电话' }
  1200. // },
  1201. // }, 'incomingCall')
  1202. // } else {
  1203. // SweetAlert.swal({
  1204. // title: "请选择报修科室!",
  1205. // type: "error"
  1206. // })
  1207. // }
  1208. // }
  1209. // }
  1210. // });
  1211. // }
  1212. // }
  1213. // })
  1214. // }
  1215. //呼入摘机应答回调函数
  1216. TLWSA.onAnswer = function (err) {
  1217. err = Number(err);
  1218. if (!err) {
  1219. console.log('呼入摘机应答成功-----seimin');
  1220. _this.getState(5);
  1221. _this.msg.success('呼入摘机应答成功')
  1222. // 查报修科室
  1223. _this.searchBxDept();
  1224. } else {
  1225. console.log('呼入摘机应答失败-----seimin');
  1226. _this.msg.error('呼入摘机应答失败')
  1227. }
  1228. }
  1229. //呼入未摘机应答回调函数
  1230. TLWSA.onMisscall = function (err) {
  1231. err = Number(err);
  1232. if (!err) {
  1233. console.log('呼入未摘机应答成功-----seimin');
  1234. _this.getState(1);
  1235. _this.msg.success('呼入未摘机应答成功')
  1236. } else {
  1237. console.log('呼入未摘机应答失败-----seimin');
  1238. _this.msg.error('呼入未摘机应答失败')
  1239. }
  1240. }
  1241. //转接开始回调函数
  1242. //调用转移方法之后,返回该事件 如果错误码为0,仅仅表示开始转移,不代表转移目标已经接听或已经拒绝
  1243. TLWSA.onTransferreturn = function (err) {
  1244. err = Number(err);
  1245. if (!err) {
  1246. console.log('转接坐席开始成功-----seimin');
  1247. _this.getState(7);
  1248. _this.msg.success('转接坐席开始成功')
  1249. } else {
  1250. console.log('转接坐席开始失败-----seimin');
  1251. _this.msg.error('转接坐席开始失败')
  1252. }
  1253. }
  1254. //转接结果回调函数
  1255. TLWSA.onTransferresult = function (err) {
  1256. err = Number(err);
  1257. if (!err) {
  1258. console.log('转接坐席结果成功-----seimin');
  1259. _this.getState(1);
  1260. _this.msg.success('转接坐席结果成功')
  1261. } else {
  1262. console.log('转接坐席结果失败-----seimin');
  1263. _this.msg.error('转接坐席结果失败')
  1264. }
  1265. }
  1266. // 呼叫中心----end
  1267. }
  1268. // 快捷键打开新建工单
  1269. quickShowNewOrder(e){
  1270. if (e.ctrlKey && e.key == "s") {
  1271. this.showNewOrder();
  1272. e.preventDefault();
  1273. }
  1274. }
  1275. unassignedSearchCon: string = ""; //未分派搜索框内容
  1276. arriveSearchCon: string = ""; //待到达搜索框内容
  1277. executionSearchCon: string = ""; //执行中搜索框内容
  1278. workerMessage: any = []; //顶部全部工单
  1279. // 展示形式
  1280. patientCareCol: number = 7; //顶部工单列数(4列-8人,7列-14人,6列-单排 )
  1281. hurseInfoHiding = 1; //护工信息隐藏
  1282. txtLabelCol: number = 1; //工单信息列数
  1283. workerInfoTime: number = 60; //配送人员刷新时间
  1284. orderInfoTime: number = 60; //工单刷新时间
  1285. audioNotDispatched: boolean = true; //是否开启定时播报未派出工单提示音
  1286. cotHeight: number; //工单初始化高度
  1287. unassignedList: any = []; //未分派数据
  1288. arriveList: any = []; //待到达数据
  1289. executionList: any = []; //执行中数据
  1290. unassignedListClone: any = null; //未分派数据clone
  1291. arriveListClone: any = null; //待到达数据clone
  1292. executionListClone: any = null; //执行中数据clone
  1293. workerRefreshTime: number = 30; //配送人员刷新倒计时
  1294. orderRefreshTime: number = 30; //工单刷新倒计时
  1295. recallOrderShow: boolean = false; //撤回模态框
  1296. delOrderShow: boolean = false; //删除模态框
  1297. logoutModal: boolean = false; //退出模态框
  1298. user = JSON.parse(localStorage.getItem("user")); //用户信息
  1299. promptContent: string; //操作提示框提示信息
  1300. ifSuccess: boolean; //操作成功/失败
  1301. promptInfo: string; //操作结果提示信息
  1302. promptModalShow: boolean; //是否展示提示框
  1303. back = ""; //标识符
  1304. btnLoading: boolean = false; //确认按钮loading状态
  1305. recDelLoading: boolean = false; //撤回并删除loading状态
  1306. saveLoading: boolean = false; //保存按钮loading状态
  1307. flagList:any = {
  1308. itsmFlag1: false,
  1309. hsmsFlag1: false,
  1310. itsmFlag2: false,
  1311. hsmsFlag2: false,
  1312. itsmFlag3: false,
  1313. hsmsFlag3: false,
  1314. }
  1315. mainRole: boolean = false; //回到系统管理权限
  1316. initRole() {
  1317. // let roles = JSON.parse(localStorage.getItem('user')).user.role;
  1318. let menus = JSON.parse(localStorage.getItem("menu"));
  1319. let that = this;
  1320. console.log("菜单数量" + menus.length);
  1321. if (menus.length >= 2) {
  1322. that.mainRole = true;
  1323. return;
  1324. }
  1325. }
  1326. // 判断登录是否已失效
  1327. initLogin() {
  1328. let that = this;
  1329. if (!localStorage.getItem("user")) {
  1330. that.msg.error("您的登录已失效,请重新登录!", {
  1331. nzDuration: 3000,
  1332. });
  1333. setTimeout(() => {
  1334. that.router.navigateByUrl("login");
  1335. }, 2000);
  1336. return;
  1337. }
  1338. }
  1339. // 工单范围设置回显
  1340. checkedHos;// 配送-院区选择
  1341. checkedHosDTO;// 配送-院区选择
  1342. scopeGroups = []; //配送-当前所属人员分组
  1343. orderScopeRadio;// 配送-工单范围
  1344. itsmCheckedHos;// 运维-院区选择
  1345. itsmScopeGroups = []; //运维-当前所属人员分组
  1346. itsmOrderScopeRadio;// 运维-工单范围
  1347. hsmsData: any = {
  1348. checkedHos: undefined,
  1349. scopeGroups: [],
  1350. orderScopeRadio: '0',
  1351. }; //转运工单范围相关信息
  1352. itsmData: any = {
  1353. checkedHos: [],
  1354. scopeGroups: [],
  1355. orderScopeRadio: '0',
  1356. }; //运维工单范围相关信息
  1357. initOrderScope() {
  1358. if (!this.user || !this.user.user || !this.user.user.scope){
  1359. this.showOrderScope();
  1360. return;
  1361. }
  1362. let scopeInfo = this.user.user.scope;
  1363. this.checkedHos = scopeInfo.hospitalId ? scopeInfo.hospitalId.id : undefined;
  1364. this.checkedHosDTO = scopeInfo.hospitalId || undefined;
  1365. this.orderScopeRadio = scopeInfo.range + "";
  1366. let groupIds = scopeInfo.groupIds || [];
  1367. let dutyGroupList = scopeInfo.dutyGroupList || [];
  1368. this.scopeGroups = dutyGroupList.concat(groupIds);
  1369. if(this.scopeGroups.length){
  1370. this.typeId = this.scopeGroups[0].id;
  1371. }
  1372. this.hsmsData = {
  1373. checkedHos: this.checkedHos,
  1374. checkedHosDTO: this.checkedHosDTO,
  1375. scopeGroups: this.scopeGroups,
  1376. orderScopeRadio: this.orderScopeRadio || '0',
  1377. hsmsSwitch: scopeInfo.hsmsSwitch === 1,
  1378. }
  1379. this.flagList.hsmsFlag1 = this.hsmsData.hsmsSwitch;
  1380. this.flagList.hsmsFlag2 = this.hsmsData.hsmsSwitch;
  1381. this.flagList.hsmsFlag3 = this.hsmsData.hsmsSwitch;
  1382. this.itsmCheckedHos = scopeInfo.dutyList || [];
  1383. this.itsmOrderScopeRadio = scopeInfo.dutyRange + "";
  1384. this.itsmScopeGroups = scopeInfo.dutyGroupList || [];
  1385. this.itsmData = {
  1386. checkedHos: this.itsmCheckedHos,
  1387. scopeGroups: this.itsmScopeGroups,
  1388. orderScopeRadio: this.itsmOrderScopeRadio || '0',
  1389. mdv2Switch: scopeInfo.mdv2Switch === 1,
  1390. allDuty: scopeInfo.allDuty === undefined ? 1 : scopeInfo.allDuty,
  1391. showReassign: scopeInfo.showReassign == null || scopeInfo.showReassign == 0 ? 0 : 1,
  1392. }
  1393. this.flagList.itsmFlag1 = this.itsmData.mdv2Switch;
  1394. this.flagList.itsmFlag2 = this.itsmData.mdv2Switch;
  1395. this.flagList.itsmFlag3 = this.itsmData.mdv2Switch;
  1396. this.getHospitalConfigList('allowNucleicAcidPrinting');
  1397. this.getConfigTasktype();
  1398. this.patientLogTasktype();
  1399. }
  1400. // 保存工单信息
  1401. confirmOrderScope(data){
  1402. if (data.status == 200) {
  1403. // this.websocketLoading = true;
  1404. this.cancelOrderScope();
  1405. this.showPromptModal("保存", true, "");
  1406. // 关闭phone的websocket
  1407. // this.incomingService.closeWs(true);
  1408. // this.getPhoneNum(false);
  1409. this.user.user.scope = data.data;
  1410. localStorage.setItem("user", JSON.stringify(this.user));
  1411. this.initOrderScope();
  1412. } else {
  1413. this.showPromptModal("保存", false, data.msg);
  1414. }
  1415. }
  1416. // 第一次打开调度台页面初始化范围设置
  1417. showInitModal: boolean = false;
  1418. cancelOrderScope() {
  1419. this.showInitModal = false;
  1420. }
  1421. showOrderScope() {
  1422. console.log(1111,this.itsmData)
  1423. this.showInitModal = true;
  1424. }
  1425. // 展示形式
  1426. showDisplayFormModal: boolean = false;
  1427. cancelDisplayForm() {
  1428. this.showDisplayFormModal = false;
  1429. }
  1430. showDisplayForm() {
  1431. this.showDisplayFormModal = true;
  1432. }
  1433. confirmDisplayForm(data){
  1434. if (data.status == 200) {
  1435. this.cancelDisplayForm();
  1436. this.msg.success('保存成功');
  1437. this.initControlView();
  1438. } else {
  1439. this.msg.error(data.msg || '保存失败');
  1440. }
  1441. }
  1442. // 绑定分机
  1443. showBindExtensionNumberModal: boolean = false;
  1444. cancelBindExtensionNumber() {
  1445. this.showBindExtensionNumberModal = false;
  1446. }
  1447. showBindExtensionNumber() {
  1448. this.showBindExtensionNumberModal = true;
  1449. this.websocketLoading = false;
  1450. }
  1451. // 保存绑定分机-签入
  1452. checkIn(phoneNumber){
  1453. this.websocketLoading = true;
  1454. // this.incomingService.setPhoneNumber(phoneNumber);
  1455. this.incomingService.closeWs(true);
  1456. this.getWebsocketPhone(phoneNumber);
  1457. }
  1458. // 签出
  1459. checkOut(){
  1460. this.showDelModal(undefined, undefined,'您确认要签出吗?','签出','checkout');
  1461. }
  1462. // 连接websocket
  1463. getWebsocketSer() {
  1464. this.sers
  1465. .connectWs(http.fwtWs, { userCount: this.user.user.account })
  1466. .subscribe((result) => {
  1467. console.log(result);
  1468. if (result && result.content) {
  1469. this.createBasicNotification(result);
  1470. }
  1471. });
  1472. }
  1473. // 连接websocket
  1474. websocketLoading:boolean = false; //websocket连接状态
  1475. preState:any = '';//最近一次示忙还是示闲的状态
  1476. isShixian = false;//是否示闲
  1477. jry_state = '';//话机状态
  1478. jry_extnNumberObj = {
  1479. // tel1: '',//目的号码对象
  1480. // tel2: '',//转接坐席对象
  1481. }
  1482. getWebsocketPhone(phoneNumber) {
  1483. const sign = this.incomingService.getSign();
  1484. if(sign === 'box'){
  1485. // 录音盒
  1486. this.incomingService.connectWs(phoneNumber).subscribe((data) => {
  1487. // data = { status: 201, phone: '013581394341' };//ceshi
  1488. console.log(data);
  1489. console.log(this.incidentModel);
  1490. this.websocketLoading = false;
  1491. // 200签入 201摘机 202来电
  1492. if (data.status == 200 && data.phone) {
  1493. this.incomingService.setPhoneNumber(phoneNumber);
  1494. this.incidentModel = { repairIncidentType: 'dept' };
  1495. this.incidentMsg = {};
  1496. this.incidentModel.callID = data.callId || undefined;
  1497. this.msg.info('签入成功');
  1498. this.cancelBindExtensionNumber();
  1499. } else if (data.status == 201 && data.phone) {
  1500. this.incidentModel = { repairIncidentType: 'dept' };
  1501. this.incidentMsg = {};
  1502. this.incidentModel.callID = data.callId || undefined;
  1503. this.incidentModel.incomingPhone = this.callNumber = this.incidentModel.contactsInformation = data.phone;
  1504. this.searchBxDept();
  1505. } else if (data.status == 201 && data.phone === "") {
  1506. this.incidentModel = { repairIncidentType: 'dept' };
  1507. this.incidentMsg = {};
  1508. this.incidentModel.callID = data.callId || undefined;
  1509. //没绑定科室
  1510. if (!this.newOrderShow && !this.newOrderShowOpen) {
  1511. this.applyDept = null;
  1512. this.showNewOrder("no", data.phone, true, '来电弹屏');
  1513. }
  1514. } else if (data.status == 202) {
  1515. this.msg.warning(data.msg);
  1516. }
  1517. });
  1518. }else if(sign === 'callCenter'){
  1519. // 呼叫中心----start
  1520. this.preState = '';
  1521. //连接
  1522. TLWSA.phoneNumber = phoneNumber;
  1523. tlwsa.tlaOpen(this.incomingService.getSocketUrl());
  1524. }else{
  1525. this.websocketLoading = false;
  1526. }
  1527. }
  1528. // 呼叫中心---start
  1529. searchBxDept(){
  1530. let dataObj = {
  1531. hosId: this.tool.getCurrentHospital().id,
  1532. phone: this.incidentModel.incomingPhone,
  1533. };
  1534. this.mainService
  1535. .findPhoneDept(dataObj)
  1536. .subscribe((result:any) => {
  1537. if (result.state == 200) {
  1538. console.log(result);
  1539. if (result.data.length > 0) {
  1540. let deptDTO;
  1541. if(result.type === 'qrCode'){
  1542. deptDTO = result.data[0].deptDTO;
  1543. deptDTO.address = result.data[0].name;
  1544. }else if(result.type === 'dept'){
  1545. deptDTO = result.data[0];
  1546. }
  1547. //绑定了科室
  1548. // if (!this.newOrderShow && !this.newOrderShowOpen) {
  1549. let incidentModel:any = Object.assign({}, this.incidentModel);
  1550. let incidentMsg:any = Object.assign({}, this.incidentMsg);
  1551. incidentModel.department = deptDTO;
  1552. incidentModel.department && incidentModel.department.hospital && (incidentModel.hosId = incidentModel.department.hospital.parent ? incidentModel.department.hospital.parent.id : incidentModel.department.hospital.id);
  1553. incidentModel.department && incidentModel.department.building && (incidentModel.area = incidentModel.department.building.id);
  1554. incidentModel.department && incidentModel.department.floor && (incidentModel.place = incidentModel.department.floor.id);
  1555. incidentModel.department && incidentModel.department.address && (incidentModel.houseNumber = incidentModel.department.address);
  1556. incidentModel.department && (incidentMsg.deptManyPhone = incidentModel.department.manyPhone);
  1557. incidentModel.department && (incidentMsg.deptName = incidentModel.department.dept);
  1558. incidentModel.department && (incidentModel.department = incidentModel.department.id);
  1559. this.incidentModel = incidentModel;
  1560. this.incidentMsg = incidentMsg;
  1561. this.searchApplicationRequester();
  1562. this.applyDeptMiddle = deptDTO;
  1563. this.showNewOrder("yes", this.incidentModel.incomingPhone, true, '来电弹屏');
  1564. // }
  1565. } else {
  1566. //没绑定科室
  1567. console.log(this.newOrderShow);
  1568. console.log(this.incidentModel);
  1569. console.log(this.incidentMsg);
  1570. this.incidentMsg = {};
  1571. if (!this.newOrderShow && !this.newOrderShowOpen) {
  1572. this.applyDept = null;
  1573. this.showNewOrder("no", this.incidentModel.incomingPhone, true, '来电弹屏');
  1574. }
  1575. }
  1576. }
  1577. });
  1578. }
  1579. // 强制示忙
  1580. qShimang(state) {
  1581. if (location.href.includes('app/incident/editor') || location.href.includes('app/incident/chart')) {
  1582. //进入页面,强制示忙
  1583. // tlwsa.tlaForceacw(this.user.user.id);
  1584. setTimeout(() => {
  1585. tlwsa.tlaAcw();
  1586. }, 0)
  1587. } else {
  1588. this.getState(state);
  1589. }
  1590. }
  1591. // 获取状态
  1592. getState(state) {
  1593. switch (state) {
  1594. case 0:
  1595. this.jry_state = 'weiqianru';
  1596. break;
  1597. case 1:
  1598. this.jry_state = 'shixian';
  1599. break;
  1600. case 2:
  1601. this.jry_state = 'shimang';
  1602. break;
  1603. case 3:
  1604. this.jry_state = 'laidian';
  1605. break;
  1606. case 5:
  1607. this.jry_state = 'tonghuazhong';
  1608. break;
  1609. case 6:
  1610. this.jry_state = 'zhengzaiwaihu';
  1611. break;
  1612. case 7:
  1613. this.jry_state = 'zhengzaizhuanyi';
  1614. break;
  1615. }
  1616. }
  1617. // 签入
  1618. jry_qianru = function () {
  1619. if (!this.incomingService.getPhoneNumber()) {
  1620. this.msg.warning('绑定分机不能为空')
  1621. return;
  1622. }
  1623. // 签入并绑定分机
  1624. // this.incomingService.getPhoneNumber() 分机号
  1625. // this.user.user.id 坐席号(用户id)
  1626. tlwsa.tlaLogin(this.user.user.id, 1, -1);
  1627. }
  1628. // 示闲
  1629. jry_shixian = function () {
  1630. tlwsa.tlaWca();
  1631. }
  1632. // 示忙
  1633. jry_shimang = function () {
  1634. tlwsa.tlaAcw();
  1635. }
  1636. // 签出
  1637. jry_qianchu = function () {
  1638. tlwsa.tlaLogoff();
  1639. }
  1640. // 呼叫坐席
  1641. // tlaCallagc = function () {
  1642. // tlwsa.tlaCallagc(this.jry_extnNumberObj.tel1)
  1643. // }
  1644. // 呼叫外线
  1645. tlaCallout = function () {
  1646. // 选择目的号码
  1647. var reg1 = /^[0][1-9]{2,3}-[0-9]{5,10}$/;
  1648. var reg2 = /^(0|9|90|86|17951)?(13[0-9]|15[012356789]|166|17[3678]|18[0-9]|14[57])[0-9]{8}$/;
  1649. if (!reg1.test(this.jry_extnNumberObj.tel1) && !reg2.test(this.jry_extnNumberObj.tel1)) {
  1650. this.msg.warning('请输入正确的手机号或座机号')
  1651. return;
  1652. }
  1653. // tlwsa.tlaCallout(this.jry_extnNumberObj.tel1,this.incomingService.getPhoneNumber(),0)
  1654. tlwsa.tlaCallout(this.jry_extnNumberObj.tel1, '3558177', 1);//襄阳主叫号码写死
  1655. }
  1656. // // 转移坐席
  1657. // tlaTransfertoagc = function () {
  1658. // tlwsa.tlaTransfertoagc(this.jry_extnNumberObj.tel2)
  1659. // }
  1660. // 转移外线
  1661. tlaTransferout = function () {
  1662. // 选择转接号码
  1663. var reg1 = /^[0][1-9]{2,3}-[0-9]{5,10}$/;
  1664. var reg2 = /^(0|9|90|86|17951)?(13[0-9]|15[012356789]|166|17[3678]|18[0-9]|14[57])[0-9]{8}$/;
  1665. if (!reg1.test(this.jry_extnNumberObj.tel2) && !reg2.test(this.jry_extnNumberObj.tel2)) {
  1666. this.msg.warning('请输入正确的手机号或座机号')
  1667. return;
  1668. }
  1669. tlwsa.tlaTransferout(this.jry_extnNumberObj.tel2, '3558177', 1);//襄阳主叫号码写死
  1670. }
  1671. // 呼叫中心---end
  1672. onChange(value: number): void {
  1673. console.log(`onChange: ${value}`);
  1674. }
  1675. onAfterChange(value: number): void {
  1676. console.log(`onAfterChange: ${value}`);
  1677. }
  1678. // 来电咨询右侧的tab页
  1679. // 服务台新建工单—根据申请科室id来查询转入院记录(科室id)
  1680. rightTitle_tab:any[] = [
  1681. // { id: 0, name: '近期配送' },
  1682. // { id: 1, name: '转出院记录' },
  1683. // { id: 2, name: '近期维修' },
  1684. // { id: 3, name: '知识库' },
  1685. ]
  1686. currentRTab:any; //当前选中的
  1687. loading5 = false;
  1688. patientLogList = [];
  1689. getPatientLog(id) {
  1690. if(!this.hsmsData.hsmsSwitch){
  1691. return;
  1692. }
  1693. if (id == -1 || id === null || id === undefined) {
  1694. this.patientLogList = [];
  1695. return;
  1696. }
  1697. let postData = {
  1698. patientLog: {
  1699. sqDept: { id },
  1700. hosId: this.checkedHos,
  1701. },
  1702. idx: 0,
  1703. sum: 10000,
  1704. };
  1705. this.loading5 = true;
  1706. this.mainService
  1707. .getFetchDataList("api", "patientLog", postData)
  1708. .subscribe((result) => {
  1709. this.loading5 = false;
  1710. if (result.status == 200) {
  1711. this.patientLogList = result.list;
  1712. }
  1713. });
  1714. }
  1715. rightTitleHandler(i) {
  1716. this.currentRTab = i;
  1717. if (i === 0) {
  1718. this.getWorkOrders(this.applyDept);
  1719. } else if (i === 1) {
  1720. this.getPatientLog(this.applyDept);
  1721. } else if (i === 2) {
  1722. this.getItsmOrders(this.incidentModel.department);
  1723. } else if (i === 3) {
  1724. this.getDictionaryList();
  1725. }
  1726. }
  1727. // 服务台新建工单—根据申请科室id来查询未到达工单(科室id)
  1728. loading4 = false;
  1729. getWorkOrders(id) {
  1730. if(!this.hsmsData.hsmsSwitch){
  1731. return;
  1732. }
  1733. if (id == -1 || id === null || id === undefined) {
  1734. this.noArrives = [];
  1735. return;
  1736. }
  1737. let types = "";
  1738. this.user.user.scope.typeIds.forEach((e) => {
  1739. types += e.id + ",";
  1740. });
  1741. types = types.slice(0, types.length - 1);
  1742. let dataObj = {
  1743. workOrder: {
  1744. serTaskTypes: types,
  1745. serGdState: 4,
  1746. range: "0",
  1747. platform: 3,
  1748. searchDays: 100,
  1749. startDept: {
  1750. id: id,
  1751. },
  1752. },
  1753. idx: 0,
  1754. sum: 5,
  1755. };
  1756. this.loading4 = true;
  1757. this.mainService
  1758. .getFetchDataList("data", "workOrder", dataObj)
  1759. .subscribe((data) => {
  1760. this.loading4 = false;
  1761. if (data.status == 200) {
  1762. this.noArrives = data.list;
  1763. }
  1764. });
  1765. }
  1766. // 服务台新建工单—根据申请科室id来查询
  1767. loading6 = false;
  1768. itsmOrders:any[] = [];
  1769. getItsmOrders(id) {
  1770. if(!this.itsmData.mdv2Switch){
  1771. return;
  1772. }
  1773. if (id == -1 || id === null || id === undefined) {
  1774. this.itsmOrders = [];
  1775. return;
  1776. }
  1777. let postData = {
  1778. incident: {
  1779. "deleteFlag": 0,
  1780. queryTask: 'all',
  1781. department: {
  1782. id,
  1783. },
  1784. },
  1785. idx: 0,
  1786. sum: 6,
  1787. };
  1788. this.loading6 = true;
  1789. this.mainService
  1790. .getFetchDataList("simple/data", "incident", postData)
  1791. .subscribe((data) => {
  1792. this.loading6 = false;
  1793. if (data.status == 200) {
  1794. this.itsmOrders = data.list;
  1795. }
  1796. });
  1797. }
  1798. //获取知识库状态/类型
  1799. getDictionaryList() {
  1800. let solutionStatus$ = this.mainService.getDictionary('list', 'solution_status', true);
  1801. let solutionType$ = this.mainService.getDictionary('list', 'solution_type', true);
  1802. forkJoin(solutionStatus$, solutionType$).subscribe((data:any[]) => {
  1803. let solutionStatusList = data[0] || [];
  1804. let solutionTypeList = data[1] || [];
  1805. this.solutionStatus = solutionStatusList.find(item => item.value == 3);
  1806. console.log('this.solutionStatus:', this.solutionStatus)
  1807. this.solutionType = solutionTypeList.find(item => item.value == 1);
  1808. console.log('this.solutionType:', this.solutionType)
  1809. this.getKnowageList();
  1810. })
  1811. }
  1812. solutionStatus;//知识库状态
  1813. solutionType;//知识库类型
  1814. // 服务台新建工单—知识库
  1815. loading7 = false;
  1816. knowageList:any[] = [];
  1817. getKnowageList() {
  1818. if(!this.itsmData.mdv2Switch){
  1819. return;
  1820. }
  1821. if(!(this.incidentModel.category && this.solutionStatus && this.solutionType)){
  1822. this.loading7 = false;
  1823. this.knowageList = [];
  1824. return;
  1825. }
  1826. this.loading7 = true;
  1827. let postData:any = {
  1828. idx: 0,
  1829. sum: 9999,
  1830. solution: {
  1831. categoryId: this.incidentModel.category,
  1832. status: this.solutionStatus,
  1833. type: this.solutionType,
  1834. },
  1835. };
  1836. this.mainService
  1837. .getFetchDataList('simple/data', 'solution', postData)
  1838. .subscribe((result) => {
  1839. this.loading7 = false;
  1840. if(result.status == 200){
  1841. this.knowageList = result.list || [];
  1842. }else{
  1843. this.msg.error(result.msg || '请求数据失败!');
  1844. }
  1845. });
  1846. }
  1847. // 引入知识库
  1848. solutionId;//引用的知识库Id
  1849. importKnowage(item){
  1850. console.log(item)
  1851. this.incidentModel = {...this.incidentModel, description: `引用知识库解决,知识库编号:${item.solutionNumber}`};
  1852. this.solutionId = item.id;
  1853. }
  1854. // 知识库查看-知道了
  1855. coopData:any = {};
  1856. isShowKnowledge:boolean = false;
  1857. showKnowledgeModal(data) {
  1858. this.coopData = data || {};
  1859. this.isShowKnowledge = true;
  1860. }
  1861. cancelKnowledgeModal(flag) {
  1862. this.isShowKnowledge = false;
  1863. }
  1864. // 定时刷新数据
  1865. refreshTimerId; //定时刷新定时器
  1866. refresh() {
  1867. clearTimeout(this.refreshTimerId);
  1868. this.refreshTimerId = setTimeout(() => {
  1869. this.refresh()
  1870. // 如果没选择复选框
  1871. if (!this.batchType && !this.batchType1) {
  1872. this.orderRefreshTime--;
  1873. }
  1874. this.workerRefreshTime--;
  1875. if (this.orderRefreshTime == 0) {
  1876. this.getUnassignedBuilding2();
  1877. this.getOrderList(1, true);
  1878. this.getOrderList(2);
  1879. this.getOrderList(3);
  1880. this.getVisitList();
  1881. this.getMessageList();
  1882. if (this.currentRTab === 0) {
  1883. this.getWorkOrders(this.applyDept);
  1884. } else if (this.currentRTab === 1) {
  1885. this.getPatientLog(this.applyDept);
  1886. } else if (this.currentRTab === 2) {
  1887. this.getItsmOrders(this.incidentModel.department);
  1888. } else if (this.currentRTab === 3) {
  1889. this.getDictionaryList();
  1890. }
  1891. this.orderRefreshTime = this.orderInfoTime;
  1892. }
  1893. if (this.workerRefreshTime == 0) {
  1894. this.checkTab(this.typeId);
  1895. this.workerRefreshTime = this.workerInfoTime;
  1896. }
  1897. }, 1000);
  1898. }
  1899. resetList() {
  1900. this.unassignedListClone = null;
  1901. this.arriveListClone = null;
  1902. this.batchType = false;
  1903. this.batchType1 = false;
  1904. }
  1905. // 刷新工单列表
  1906. refreshList(e) {
  1907. if (!e.promptContent) {
  1908. return;
  1909. }
  1910. this.getUnassignedBuilding2();
  1911. this.resetList();
  1912. this.getOrderList(1);
  1913. this.getOrderList(2);
  1914. this.getOrderList(3);
  1915. this.getVisitList();
  1916. this.getMessageList();
  1917. if (this.currentRTab === 0) {
  1918. this.getWorkOrders(this.applyDept);
  1919. } else if (this.currentRTab === 1) {
  1920. this.getPatientLog(this.applyDept);
  1921. } else if (this.currentRTab === 2) {
  1922. this.getItsmOrders(this.incidentModel.department);
  1923. } else if (this.currentRTab === 3) {
  1924. this.getDictionaryList();
  1925. }
  1926. }
  1927. // 切换顶部tab栏
  1928. // typeId = -1; //当前选中tab ID
  1929. typeId; //当前选中tab ID
  1930. typeData; //当前选中tab
  1931. wLoading:boolean = false;
  1932. checkTab(typeId) {
  1933. if(!this.hsmsData.hsmsSwitch){
  1934. return;
  1935. }
  1936. let that = this;
  1937. that.typeId = typeId;
  1938. this.typeData = this.scopeGroups.find(v => v.id === typeId);
  1939. if(this.typeData){
  1940. let type = this.typeData.type;
  1941. // 配送
  1942. if(type === 1 || type === 2){
  1943. let postData = {
  1944. groups: [typeId],
  1945. idx: 0,
  1946. sum: 100,
  1947. hosId: this.checkedHos,
  1948. };
  1949. // if (typeId == -1) {
  1950. // let groups = [];
  1951. // that.scopeGroups.forEach((e) => {
  1952. // groups.push(e.id);
  1953. // });
  1954. // postData.groups = groups;
  1955. // }
  1956. if (this.hurseInfoHiding == 1){
  1957. that.workerMessage = [];
  1958. that.initTopCount();
  1959. return;
  1960. }
  1961. this.wLoading = true;
  1962. that.mainService.getSerInfo("getWorkInfo", postData).subscribe((data) => {
  1963. this.wLoading = false;
  1964. that.workerMessage = data.data ? data.data : [];
  1965. that.initTopCount();
  1966. });
  1967. }
  1968. // 运维
  1969. if(type === 3){
  1970. let postData = {
  1971. groups: [typeId],
  1972. };
  1973. if (this.hurseInfoHiding == 1){
  1974. that.workerMessage = [];
  1975. that.initTopCount();
  1976. return;
  1977. }
  1978. this.wLoading = true;
  1979. that.mainService.incidentUserTaskCount(postData).subscribe((data:any) => {
  1980. this.wLoading = false;
  1981. that.workerMessage = data.data ? data.data : [];
  1982. that.initTopCount();
  1983. });
  1984. }
  1985. }
  1986. }
  1987. // 获取回访列表
  1988. visitNum:any;
  1989. getVisitList(){
  1990. if(!this.itsmData.mdv2Switch){
  1991. return;
  1992. }
  1993. let postData: any = {
  1994. idx: 0,
  1995. sum: 1,
  1996. incident: {
  1997. // "groupIds": this.itsmData.allDuty == 1 ? undefined : (this.itsmData.scopeGroups.map(v => v.id).toString() || undefined),
  1998. "dutyIds": this.itsmData.allDuty == 1 ? undefined : (this.itsmData.checkedHos.map(v => v.id).toString() || undefined),
  1999. "urgentType": +this.itsmData.orderScopeRadio + 1,
  2000. "queryTask": "callback",
  2001. "assignee": this.tool.getCurrentUserId(),
  2002. "deleteFlag": 0,
  2003. },
  2004. };
  2005. this.mainService
  2006. .getFetchDataList("simple/data", "incident", postData)
  2007. .subscribe((result) => {
  2008. this.visitNum = result.totalNum;
  2009. });
  2010. }
  2011. // 获取留言列表
  2012. messageNum:any;
  2013. getMessageList(){
  2014. if(!this.itsmData.mdv2Switch){
  2015. return;
  2016. }
  2017. let postData: any = {
  2018. idx: 0,
  2019. sum: 1,
  2020. hjzxRecord: {
  2021. isExcute: 0,
  2022. },
  2023. };
  2024. this.mainService
  2025. .getFetchDataList("simple/data", "hjzxRecord", postData)
  2026. .subscribe((result) => {
  2027. this.messageNum = result.totalNum;
  2028. });
  2029. }
  2030. //trackBy
  2031. trackById(index, item) {
  2032. return item.type + item.data.id;
  2033. }
  2034. // 获取三个状态数据数据
  2035. loading1 = true;
  2036. loading2 = true;
  2037. loading3 = true;
  2038. getOrderList(stateId, isAudio?) {
  2039. this[`loading${stateId}`] = true;
  2040. let keyWords = "";
  2041. let types = "";
  2042. let postData:any = {
  2043. orderType: this.orderType,
  2044. };
  2045. // 配送
  2046. if(this.flagList['hsmsFlag' + stateId]){
  2047. if (stateId == 1) {
  2048. keyWords = this.unassignedSearchCon || "";
  2049. } else if (stateId == 2) {
  2050. keyWords = this.arriveSearchCon || "";
  2051. } else if (stateId == 3) {
  2052. keyWords = this.executionSearchCon || "";
  2053. }
  2054. if (this.user.user.scope) {
  2055. this.user.user.scope.typeIds = this.user.user.scope.typeIds || [];
  2056. }
  2057. if (!this.user.user.scope || !this.user.user.scope.typeIds) {
  2058. this.loading1 = this.loading2 = this.loading3 = false;
  2059. }else{
  2060. this.user.user.scope.typeIds.forEach((e) => {
  2061. types += e.id + ",";
  2062. });
  2063. types = types.slice(0, types.length - 1);
  2064. postData.workOrderQuery = {
  2065. workOrder: {
  2066. serTaskTypes: types || undefined,
  2067. serGdState: stateId,
  2068. range: this.orderScopeRadio,
  2069. platform: 3,
  2070. searchDays: 1,
  2071. keyWord: keyWords
  2072. },
  2073. idx: 0,
  2074. sum: 1
  2075. }
  2076. if (this.unassignedBuilding.length && stateId == 1) {
  2077. postData.workOrderQuery.workOrder["deptIds"] = this.unassignedBuilding.toString();
  2078. }
  2079. }
  2080. }
  2081. // 运维
  2082. if(this.flagList['itsmFlag' + stateId]){
  2083. postData.incidentQuery = {
  2084. idx: 0,
  2085. sum: 1,
  2086. }
  2087. if(stateId == 1){
  2088. postData.incidentQuery.incident = {
  2089. // "groupIds": this.itsmData.allDuty == 1 ? undefined : (this.itsmData.scopeGroups.map(v => v.id).toString() || undefined),
  2090. "acceptDutyIds": this.itsmData.allDuty == 1 ? undefined : (this.itsmData.checkedHos.map(v => v.id).toString() || undefined),
  2091. "urgentType": +this.itsmData.orderScopeRadio + 1,
  2092. "queryTask": "storageAcceptReassign",
  2093. "assignee": this.tool.getCurrentUserId(),
  2094. "deleteFlag": 0,
  2095. "showReassign":null
  2096. }
  2097. postData.incidentQuery.incident.showReassign = this.user.user.scope.showReassign==0 || !this.user.user.scope.showReassign ? undefined : this.user.user.scope.showReassign
  2098. }else if(stateId == 2){
  2099. postData.incidentQuery.incident = {
  2100. // "groupIds": this.itsmData.allDuty == 1 ? undefined : (this.itsmData.scopeGroups.map(v => v.id).toString() || undefined),
  2101. "dutyIds": this.itsmData.allDuty == 1 ? undefined : (this.itsmData.checkedHos.map(v => v.id).toString() || undefined),
  2102. "urgentType": +this.itsmData.orderScopeRadio + 1,
  2103. "queryTask": "todoState",
  2104. "deleteFlag": 0,
  2105. }
  2106. }else if(stateId == 3){
  2107. postData.incidentQuery.incident = {
  2108. // "groupIds": this.itsmData.allDuty == 1 ? undefined : (this.itsmData.scopeGroups.map(v => v.id).toString() || undefined),
  2109. "dutyIds": this.itsmData.allDuty == 1 ? undefined : (this.itsmData.checkedHos.map(v => v.id).toString() || undefined),
  2110. "urgentType": +this.itsmData.orderScopeRadio + 1,
  2111. "queryTask": "doing",
  2112. "assignee": this.tool.getCurrentUserId(),
  2113. "deleteFlag": 0,
  2114. "platform": 3,
  2115. }
  2116. }
  2117. }
  2118. console.log(postData);
  2119. this.mainService.orderList(postData).subscribe((data:any) => {
  2120. if (stateId == 1) {
  2121. // 未分派
  2122. let unassignedList = data.data || [];
  2123. unassignedList.forEach((item) => {
  2124. item.checked = false;
  2125. if(item.type === 'mdv2'){
  2126. item.computedSubstitutionFlag = this.computedSubstitution(item.data)
  2127. item.computedReceiveFlag = this.computedReceive(item.data)
  2128. item.computedEditFlag = this.computedEdit(item.data)
  2129. }
  2130. });
  2131. this.unassignedList = unassignedList;
  2132. this.batchType = false;
  2133. this.allUnassignedList = false;
  2134. this.unassignedListClone = cloneDeep(this.unassignedList);
  2135. if (this.audioNotDispatched && this.unassignedList.length > 0 && isAudio) {
  2136. //语音播报开启
  2137. let audio = document.createElement("audio");
  2138. audio.src = "./../../assets/audio/audioNotDispatched.mp3";
  2139. audio.addEventListener("canplay", function () {
  2140. //监听audio是否加载完毕
  2141. audio.play();
  2142. });
  2143. }
  2144. this.loading1 = false;
  2145. } else if (stateId == 2) {
  2146. // 待到达
  2147. let arriveList = data.data || [];
  2148. arriveList.forEach((item) => {
  2149. item.checked = false;
  2150. if(item.type === 'mdv2'){
  2151. item.computedSubstitutionFlag = this.computedSubstitution(item.data)
  2152. item.computedReceiveFlag = this.computedReceive(item.data)
  2153. item.computedEditFlag = this.computedEdit(item.data)
  2154. }
  2155. });
  2156. this.arriveList = arriveList;
  2157. this.batchType1 = false;
  2158. this.allArriveList = false;
  2159. this.arriveListClone = cloneDeep(this.arriveList);
  2160. this.loading2 = false;
  2161. } else if (stateId == 3) {
  2162. // 执行中
  2163. let executionList = data.data || [];
  2164. executionList.forEach((item) => {
  2165. if(item.type === 'mdv2'){
  2166. item.computedSubstitutionFlag = this.computedSubstitution(item.data)
  2167. item.computedHandleFlag = this.computedHandle(item.data)
  2168. item.computedEditFlag = this.computedEdit(item.data)
  2169. }
  2170. });
  2171. this.executionList = executionList;
  2172. this.loading3 = false;
  2173. }
  2174. if (keyWords) {
  2175. this.loading1 = this.loading2 = this.loading3 = false;
  2176. }
  2177. });
  2178. }
  2179. // 计算顶部行数
  2180. showRowNum: number; // 已展示行数
  2181. maxNum: number; //可展示行数最大值
  2182. initTopCount() {
  2183. let that = this;
  2184. that.maxNum = Math.ceil(that.workerMessage.length / that.patientCareCol);
  2185. that.showRowNum = that.patientCareCol == 6 ? 4 : 2;
  2186. console.log(that.maxNum, that.showRowNum);
  2187. that.cotHeight = 140;
  2188. }
  2189. // 展开顶部列表
  2190. unfold() {
  2191. if (this.showRowNum < this.maxNum && this.patientCareCol != 6) {
  2192. this.cotHeight += 70;
  2193. this.showRowNum++;
  2194. } else if (this.showRowNum < this.maxNum && this.patientCareCol == 6) {
  2195. this.cotHeight += 35;
  2196. this.showRowNum++;
  2197. } else {
  2198. return;
  2199. }
  2200. }
  2201. // 收起顶部列表
  2202. retract() {
  2203. this.showRowNum = this.patientCareCol == 6 ? 4 : 2;
  2204. this.cotHeight = 140;
  2205. }
  2206. // 查看工单详情
  2207. openDetails(data) {
  2208. if (data.taskType.associationType.value == 'specimen' || data.taskType.associationType.value == 'specimenPlan') {
  2209. // 标本类
  2210. this.router.navigateByUrl("dispatchingDesk/detailSample/" + data.id);
  2211. } else if (data.taskType.associationType.value == 'inspect' || data.taskType.associationType.value == 'patientTransport') {
  2212. // 送患者
  2213. this.router.navigateByUrl("dispatchingDesk/detailPatients/" + data.id);
  2214. } else if (data.taskType.associationType.value == 'drugsBag' || data.taskType.associationType.value == 'jPBag') {
  2215. // 药品配送/静配
  2216. this.router.navigateByUrl("dispatchingDesk/detailDrug/" + data.id);
  2217. } else if (data.taskType.associationType.value == 'ordinary') {
  2218. // 万能交接服务
  2219. this.router.navigateByUrl("dispatchingDesk/detailOrdinary/" + data.id);
  2220. } else {
  2221. // 其他
  2222. this.router.navigateByUrl("dispatchingDesk/detailOthers/" + data.id);
  2223. }
  2224. }
  2225. // 查看ITSM工单详情
  2226. detailModalShow = false; //弹窗开关
  2227. openItsmDetails(data) {
  2228. this.coopData = data;
  2229. this.detailModalShow = true;
  2230. }
  2231. // 关闭弹窗
  2232. closeDetailModelOrder(e) {
  2233. this.detailModalShow = JSON.parse(e).show;
  2234. }
  2235. // 弹窗确定
  2236. confirmDetailModelOrder(e){
  2237. console.log(e);
  2238. this.detailModalShow = false;
  2239. }
  2240. // 选择楼栋
  2241. changeUnassignedBuilding(e) {
  2242. this.getOrderList(1);
  2243. }
  2244. // 未分派搜索
  2245. searchUnassigned() {
  2246. this.getOrderList(1);
  2247. }
  2248. // 待到达搜索
  2249. searchArrive() {
  2250. this.getOrderList(2);
  2251. }
  2252. // 执行中搜索
  2253. searchExecution() {
  2254. this.getOrderList(3);
  2255. }
  2256. // 派单,flag是否是下班后进入未分派的单子
  2257. allotWorker(id, stateId, flag?) {
  2258. if (flag == 1) {
  2259. this.router.navigateByUrl(
  2260. "dispatchingDesk/allotWorker/" +
  2261. id +
  2262. "/" +
  2263. stateId +
  2264. "/1/" +
  2265. this.checkedHos
  2266. );
  2267. } else {
  2268. this.router.navigateByUrl(
  2269. "dispatchingDesk/allotWorker/" +
  2270. id +
  2271. "/" +
  2272. stateId +
  2273. "/0/" +
  2274. this.checkedHos
  2275. );
  2276. }
  2277. }
  2278. // 右侧菜单
  2279. showLastItems: boolean = false;
  2280. // 下拉
  2281. fixedMenuXiala() {
  2282. this.showLastItems = true;
  2283. }
  2284. // 上拉
  2285. fixedMenuShangla() {
  2286. this.showLastItems = false;
  2287. this.fixedTab = "";
  2288. }
  2289. // 退出系统
  2290. logOut(): void {
  2291. this.logoutModal = true;
  2292. }
  2293. // 确认退出
  2294. confirmLogout() {
  2295. this.btnLoading = true;
  2296. // 假退出
  2297. this.btnLoading = false;
  2298. this.closeLogoutModal();
  2299. let hospital = this.tool.getCurrentHospital();
  2300. if(hospital){
  2301. this.router.navigate(["login", hospital.id]);
  2302. }else{
  2303. this.router.navigateByUrl("login");
  2304. }
  2305. localStorage.removeItem("user");
  2306. localStorage.removeItem("menu");
  2307. this.incomingService.removePhoneNumber();
  2308. this.incomingService.removePhoneNumberPre();
  2309. this.incomingService.removeSocketUrl();
  2310. this.incomingService.removeSign();
  2311. this.incomingService.removePhoneNumberPre();
  2312. localStorage.removeItem("index");
  2313. // 假退出
  2314. this.mainService.logOut().subscribe((data) => {
  2315. this.btnLoading = false;
  2316. this.closeLogoutModal();
  2317. if (data.status == 200) {
  2318. if(hospital){
  2319. this.router.navigate(["login", hospital.id]);
  2320. }else{
  2321. this.router.navigateByUrl("login");
  2322. }
  2323. localStorage.removeItem("user");
  2324. localStorage.removeItem("menu");
  2325. this.incomingService.removePhoneNumber();
  2326. this.incomingService.removeSocketUrl();
  2327. this.incomingService.removeSign();
  2328. this.incomingService.removePhoneNumberPre();
  2329. localStorage.removeItem("index");
  2330. }
  2331. });
  2332. }
  2333. // 关闭模态框
  2334. closeLogoutModal() {
  2335. this.logoutModal = false;
  2336. }
  2337. // 切换右侧菜单Tab
  2338. fixedTab: string = "";
  2339. checkFixedTab(type: string) {
  2340. if (type == "toSystem") {
  2341. this.router.navigateByUrl("main");
  2342. return;
  2343. }
  2344. if (type == "logout") {
  2345. this.logOut();
  2346. }
  2347. if (type == "nucleicAcidPrinting") {
  2348. this.getNucleicAcidBuildingSummary();
  2349. }
  2350. if (this.fixedTab == type) {
  2351. this.fixedTab = "";
  2352. } else {
  2353. this.fixedTab = type;
  2354. }
  2355. }
  2356. // 护工信息展示形式
  2357. // changPatientCareCol(e) {
  2358. // this.initTopCount();
  2359. // }
  2360. // 获取配置文件写死的任务类型ID(送病人回病房9),选择此任务类型的话,患者信息从终点科室获取
  2361. getConfigTasktypeLoading: boolean = false;
  2362. getConfigTasktype() {
  2363. if(!this.hsmsData.hsmsSwitch){
  2364. return;
  2365. }
  2366. let postData = {
  2367. idx: 0,
  2368. sum: 1,
  2369. hospitalConfig: {
  2370. hosId: this.checkedHos,
  2371. key: "rebackPatientTypeId",
  2372. },
  2373. };
  2374. this.getConfigTasktypeLoading = true;
  2375. this.mainService.getFetchDataList("simple/data", "hospitalConfig", postData).subscribe(res => {
  2376. this.getConfigTasktypeLoading = false;
  2377. if (res && res.status == 200) {
  2378. this.deathTasktypeId = res.list.length ? res.list[0].value : undefined;
  2379. } else {
  2380. this.msg.error('请求数据失败');
  2381. }
  2382. });
  2383. }
  2384. // 获取配置文件写死的任务类型ID(转科,给转出院记录用6)
  2385. patientLogTasktypeLoading: boolean = false;
  2386. patientLogTasktype() {
  2387. if(!this.hsmsData.hsmsSwitch){
  2388. return;
  2389. }
  2390. let postData = {
  2391. idx: 0,
  2392. sum: 1,
  2393. systemConfiguration: {
  2394. keyconfig: "transDeptTypeId",
  2395. },
  2396. };
  2397. this.patientLogTasktypeLoading = true;
  2398. this.mainService.getFetchDataList("simple/data", "systemConfiguration", postData).subscribe(res => {
  2399. this.patientLogTasktypeLoading = false;
  2400. if (res.status == 200) {
  2401. this.deathTasktypeIdPatient = res.list.length ? res.list[0].valueconfig : undefined;
  2402. } else {
  2403. this.msg.error('请求数据失败');
  2404. }
  2405. });
  2406. }
  2407. // 重置新建工单数据
  2408. resetOrderData(){
  2409. this.applicationRequesterList = [];
  2410. this.fileList = [];
  2411. this.repairImgs = [];
  2412. this.isRelatedDepartment = true;
  2413. this.solutionId = undefined;
  2414. delete this.incidentMsg.requesterPhone;
  2415. }
  2416. // 重置新建工单数据-继续建单-编辑-报修转事件
  2417. resetOrderData2(){
  2418. this.fileList = [];
  2419. this.repairImgs = [];
  2420. if(this.incidentModel.repairIncidentType === 'public'){
  2421. this.isRelatedDepartment = false;
  2422. }else{
  2423. this.isRelatedDepartment = true;
  2424. }
  2425. }
  2426. // 打开新建工单
  2427. deathTasktypeId; //获取这个写死的任务类型的id,送病人回病房
  2428. deathTasktypeIdPatient; //获取这个写死的任务类型的id,转出院记录
  2429. async showNewOrder(des = '', phone = '', isInit = false, buildType = '') {
  2430. if(this.incomingService.getSign() === 'callCenter' && this.incomingService.getPhoneNumber()){
  2431. //进入弹窗,强制示忙
  2432. setTimeout(()=>{
  2433. tlwsa.tlaAcw();
  2434. },0)
  2435. }
  2436. this.buildType = buildType;
  2437. if(this.itsmData.mdv2Switch){
  2438. if(this.buildType !== '继续建单' && this.buildType !== '编辑事件' && this.buildType !== '报修转事件'){
  2439. this.resetOrderData();
  2440. }else{
  2441. this.resetOrderData2();
  2442. }
  2443. this.searchApplicationHospital();
  2444. this.searchApplicationCategory();
  2445. this.searchApplicationPriority();
  2446. this.searchApplicationSource();
  2447. this.getRepairIncidentType();
  2448. isInit ? this.searchApplicationDepartment('itsm', undefined, undefined, undefined, true) : this.searchApplicationDepartment('itsm');
  2449. isInit && ((this.isRelatedDepartment && this.incidentModel.department) || (!this.isRelatedDepartment && this.incidentModel.hosId) || this.buildType === '报修转事件' ) && this.incidentModel.hosId && this.searchApplicationBuilding();
  2450. isInit && this.incidentModel.area && this.searchApplicationFloor();
  2451. if(!this.hsmsData.hsmsSwitch){
  2452. this.taskBuild = null;
  2453. this.residenceNo = null;
  2454. this.newOrderShow = true;
  2455. this.newOrderShowOpen = true;
  2456. this.fixedTab = "newOrder";
  2457. this.currentRTab = 0;
  2458. this.rightTitle_tab = [];
  2459. this.incidentModel = isInit ? this.incidentModel : { repairIncidentType: 'dept' };
  2460. this.incidentMsg = isInit ? this.incidentMsg : {};
  2461. this.isBuildOrderAgagin = false;
  2462. this.applyDept = null;
  2463. this.countRemarkIndex = -1;
  2464. this.incidentModel.department = isInit ? this.incidentModel.department : null;
  2465. //正常初始化
  2466. this.getAutoWorkTypes(false, isInit);
  2467. return;
  2468. }
  2469. }
  2470. // 预约相关重置
  2471. this.yyDateZy = new Date();
  2472. this.yyDate = new Date();
  2473. this.yyTimeZy = null;
  2474. this.yyTime = null;
  2475. this.isYyInspect = false;
  2476. this.clickYYZyFlag = false;
  2477. this.clickYYFlag = false;
  2478. this.inspectToday = new Date();
  2479. if(!isInit && this.hsmsData.hsmsSwitch){
  2480. if(!this.deathTasktypeId){
  2481. // 送病人回病房
  2482. this.msg.error('【送病人回病房】未配置');
  2483. return;
  2484. }
  2485. if(!this.deathTasktypeIdPatient){
  2486. // 转出院记录
  2487. this.msg.error('【转出院记录】未配置');
  2488. return;
  2489. }
  2490. }
  2491. this.taskBuild = null;
  2492. this.residenceNo = null;
  2493. this.newOrderShow = true;
  2494. this.newOrderShowOpen = true;
  2495. this.fixedTab = "newOrder";
  2496. this.currentRTab = 0;
  2497. this.rightTitle_tab = [];
  2498. this.incidentModel = isInit ? this.incidentModel : { repairIncidentType: 'dept' };
  2499. this.incidentMsg = isInit ? this.incidentMsg : {};
  2500. this.isBuildOrderAgagin = false;
  2501. this.applyDept = null;
  2502. this.countRemarkIndex = -1;
  2503. this.incidentModel.department = isInit ? this.incidentModel.department : null;
  2504. console.log(des);
  2505. if (des === "no") {
  2506. //没绑定科室
  2507. this.searchApplicationDepartment("hsms", "", phone);
  2508. this.noWorkerPhone = false;
  2509. } else if (des === "yes") {
  2510. //绑定了科室
  2511. this.searchApplicationDepartment("hsms", "&ks&");
  2512. this.noWorkerPhone = false;
  2513. } else if (des === "&go&") {
  2514. //继续建单
  2515. this.searchApplicationDepartment("hsms", "&go&");
  2516. this.noWorkerPhone = false;
  2517. } else {
  2518. //正常初始化
  2519. this.searchApplicationDepartment("hsms");
  2520. this.noWorkerPhone = true;
  2521. }
  2522. this.getSearchTaskList("").subscribe((result) => {
  2523. if (result.status == 200) {
  2524. this.searchTaskLoading = false;
  2525. this.searchTaskList = result.data;
  2526. this.searchTaskList.forEach((item) => {
  2527. item.sid = item.associationTypeId + "_" + item.id + "_" + item.associationTypeValue;
  2528. });
  2529. // if(phone){
  2530. // this.getAutoWorkTypes(true, isInit);
  2531. // }else{
  2532. // this.getAutoWorkTypes(false, isInit);
  2533. // }
  2534. this.getAutoWorkTypes(false, isInit);
  2535. }
  2536. });
  2537. }
  2538. // 获取可选择的任务类型列表
  2539. searchTaskList;
  2540. searchTaskLoading = false;
  2541. getSearchTaskList(keyword, countRemark = '') {
  2542. if(!this.hsmsData.hsmsSwitch){
  2543. return;
  2544. }
  2545. this.searchTaskLoading = true;
  2546. return this.mainService.getTaskTypeBySearchKey({
  2547. searchKey: keyword || undefined,
  2548. countRemark: countRemark || undefined,
  2549. hosId: this.checkedHos,
  2550. });
  2551. }
  2552. getPhoneNum(flag = true) {
  2553. if (!flag) {
  2554. //切换院区的时候清除掉缓存中的号码
  2555. this.incomingService.removePhoneNumber();
  2556. }
  2557. if (this.incomingService.getPhoneNumber()) {
  2558. this.getWebsocketPhone(this.incomingService.getPhoneNumber());
  2559. }else{
  2560. this.websocketLoading = false;
  2561. }
  2562. }
  2563. // 患者转运默认陪检
  2564. defaultInspectFn(){
  2565. if(this.currentTabIndex === '患者转运'){
  2566. console.log(this.workTypesArrange);
  2567. let obj = this.workTypesArrange.find(v => v.key == this.currentTabIndex);
  2568. let tabIndex = this.workTypesArrange.findIndex(v => v.key == this.currentTabIndex);
  2569. let arr = obj.value || [];
  2570. let index = arr.findIndex(v => v.associationTypeValue === 'inspect');
  2571. let o = arr.find(v => v.associationTypeValue === 'inspect');
  2572. o && this.radioChangeZy(o.id, tabIndex);
  2573. }
  2574. }
  2575. // 点击tab切换
  2576. tabClick(key, isInit = false, patient?) {
  2577. let preCurrentTabIndex = this.currentTabIndex;
  2578. this.currentTabIndex = key;
  2579. this.radioValueQt = null;
  2580. this.startDeptQt = null;
  2581. this.endDeptQt = null;
  2582. this.radioValueZy = null;
  2583. this.radioValueZyPre = null;
  2584. this.defaultInspectFn();
  2585. if(this.currentTabIndex === '患者转运'){
  2586. this.getPatientList(this.applyDept, "", patient);
  2587. }
  2588. this.startDeptZy = null;
  2589. this.endDeptZy = null;
  2590. this.patientZy = null;
  2591. this.goodsNow = [];
  2592. this.workOrderRemark = "";
  2593. this.workOrderRemarkZy = "";
  2594. this.deptZyList["startDept"] = [];
  2595. this.deptZyList["endDept"] = [];
  2596. this.deptZyList["startStatus"] = 0;
  2597. this.deptZyList["endStatus"] = 0;
  2598. this.deptQtList["startDept"] = [];
  2599. this.deptQtList["endDept"] = [];
  2600. this.deptQtList["startStatus"] = 0;
  2601. this.deptQtList["endStatus"] = 0;
  2602. if(preCurrentTabIndex === '故障报修'){
  2603. if(this.applyDept){
  2604. this.rightTitle_tab = [
  2605. { id: 0, name: '近期配送' },
  2606. { id: 1, name: '转出院记录' },
  2607. ]
  2608. this.rightTitleHandler(this.rightTitle_tab[0].id);
  2609. }
  2610. let deptObj = this.applicationDeptList.find(v => v.id == this.incidentModel.department);
  2611. if(this.applyDept != this.incidentModel.department){
  2612. this.applyDept = this.incidentModel.department;
  2613. this.searchApplicationDepartment('hsms', deptObj ? deptObj.dept : '', undefined, this.incidentModel.department);
  2614. }
  2615. }else if(this.currentTabIndex === '故障报修'){
  2616. if(this.incidentModel.department){
  2617. this.rightTitle_tab = [
  2618. { id: 2, name: '近期维修' },
  2619. { id: 3, name: '知识库' },
  2620. ]
  2621. this.rightTitleHandler(this.rightTitle_tab[0].id);
  2622. }
  2623. let deptObj = this.applicationDepartmentList.find(v => v.id == this.applyDept);
  2624. if(this.incidentModel.department != this.applyDept && (!isInit || !this.buildType)){
  2625. this.incidentModel.department = this.applyDept;
  2626. this.searchApplicationDepartment('itsm', deptObj ? deptObj.dept : '', undefined, this.applyDept);
  2627. }
  2628. }
  2629. }
  2630. // 获取患者信息
  2631. searchPatientList(id, searchWords) {
  2632. this.searchPatientListSubject.next([id, searchWords]);
  2633. }
  2634. // 获取患者信息
  2635. isLoadingPatient: boolean = false;
  2636. getPatientList(id, searchWords, patient?) {
  2637. if(patient){
  2638. this.patientList = [patient];
  2639. return;
  2640. }
  2641. if(!id){
  2642. this.patientList = [];
  2643. return;
  2644. }
  2645. let dataObj = { searchWords, deptId: id };
  2646. this.isLoadingPatient = true;
  2647. this.mainService.getPatientList(dataObj).subscribe((result) => {
  2648. this.isLoadingPatient = false;
  2649. if (result["state"] == 200) {
  2650. this.patientList = result["data"];
  2651. // if (this.patientList.length) {
  2652. // this.patientList = this.patientList.filter((item) => !!item.bednum);
  2653. // }
  2654. }
  2655. });
  2656. }
  2657. // 根据住院号获取患者信息
  2658. getPatientByResidenceNo(residenceNo) {
  2659. let postData = {
  2660. residenceNo,
  2661. hosId: this.checkedHos,
  2662. idx: 0,
  2663. sum: 2,
  2664. };
  2665. this.mainService.listMsgByMain('listPatient',postData).subscribe((result) => {
  2666. if (result["status"] == 200) {
  2667. let patientList = result["list"];
  2668. if (patientList.length) {
  2669. patientList = patientList.filter((item) => !!item.bedNum);
  2670. }
  2671. if(patientList.length === 1){
  2672. let patient = patientList[0];
  2673. patient.bednum = patient.bedNum;
  2674. patient.patientname = patient.patientName;
  2675. patient.department && (this.applicationDepartmentList = [patient.department]);
  2676. patient.department && (this.applyDept = patient.department.id);
  2677. patient.department && this.tabClick('患者转运', false, patient);
  2678. // patient.department && (this.patientList = [patient]);
  2679. patient.department && (this.patientZy = patient.patientCode);
  2680. console.log(this.patientList)
  2681. }else{
  2682. this.msg.warning('未查询到患者');
  2683. }
  2684. }
  2685. });
  2686. }
  2687. // tab任务类型向左移动
  2688. toLeft() {
  2689. let maxStep = this.workTypesArrange.length - 5;
  2690. this.disStep = Math.max(-maxStep, --this.disStep);
  2691. this.disX = (this.disStep * this.elementView.nativeElement.offsetWidth) / 5;
  2692. }
  2693. // tab任务类型向右移动
  2694. toRight() {
  2695. this.disStep = Math.min(0, ++this.disStep);
  2696. this.disX = (this.disStep * this.elementView.nativeElement.offsetWidth) / 5;
  2697. }
  2698. // 边输边搜节流阀
  2699. // WS;//边输入边搜索的定时器
  2700. WSNum = 0;
  2701. changeInp(type, e) {
  2702. this.changeInpSubject.next([type, e]);
  2703. }
  2704. changeCommonInp(type, e) {
  2705. this.changeCommonInpSubject.next([type, e]);
  2706. }
  2707. // 院区列表
  2708. applicationHospitalList:any[] = [];
  2709. searchApplicationHospital() {
  2710. let dataObj = {
  2711. idx: 0,
  2712. sum: 9999,
  2713. hospital: {
  2714. selectType:'level1',
  2715. },
  2716. };
  2717. this.isLoading = true;
  2718. this.mainService
  2719. .getFetchDataList("data", "hospital", dataObj)
  2720. .subscribe((data) => {
  2721. this.isLoading = false;
  2722. if (data.status == 200) {
  2723. this.applicationHospitalList = data.list;
  2724. }
  2725. });
  2726. }
  2727. // 选择院区
  2728. changeApplyHospital(e){
  2729. console.log(e);
  2730. this.incidentModel.department = undefined;
  2731. this.searchApplicationDepartment('itsm');
  2732. if(this.buildType !== '报修转事件'){
  2733. this.incidentModel.requester = undefined;
  2734. this.searchApplicationRequester();
  2735. }
  2736. this.applicationRequesterList = [];
  2737. this.incidentModel.area = undefined;
  2738. this.searchApplicationBuilding();
  2739. this.incidentModel.place = undefined;
  2740. this.applicationFloorList = [];
  2741. this.incidentModel.houseNumber = undefined;
  2742. this.incidentModel.duty = undefined;
  2743. // 根据院区和故障现象带出责任部门,优先级,维修人/组
  2744. if(this.incidentModel.category && e && this.buildType !== '编辑事件'){
  2745. let postData = {
  2746. idx: 0,
  2747. sum: 9999,
  2748. incidentCategoryConfig: {
  2749. categoryId: this.incidentModel.category,
  2750. hosId: e,
  2751. },
  2752. };
  2753. console.log(postData);
  2754. // return;
  2755. this.isLoading = true;
  2756. this.mainService
  2757. .getFetchDataList("simple/data", "incidentCategoryConfig", postData)
  2758. .subscribe((data) => {
  2759. this.isLoading = false;
  2760. if (data.status == 200) {
  2761. let list = data.list || [];
  2762. if(list.length > 0){
  2763. console.log(list[0]);
  2764. this.incidentCategoryConfig = list[0];
  2765. }else{
  2766. this.incidentCategoryConfig = {};
  2767. }
  2768. // 根据院区和故障现象带出责任部门,优先级,维修人/组
  2769. this.incidentModel.duty = this.incidentCategoryConfig.dutyDTO;
  2770. this.incidentModel.priorityId = this.incidentCategoryConfig.priority;
  2771. // 回显维修人/组
  2772. this.showGroupOrUser();
  2773. }
  2774. });
  2775. }else{
  2776. this.incidentModel.group = undefined;
  2777. this.applicationGroupList = [];
  2778. this.incidentModel.user = undefined;
  2779. this.applicationUserList = [];
  2780. }
  2781. }
  2782. // 申请人列表(搜索)
  2783. applicationRequesterList:any[] = [];
  2784. isRelatedDepartment:boolean = true;
  2785. searchApplicationRequester(keyWord?) {
  2786. // 关联查询,且没选择申请科室
  2787. if(this.isRelatedDepartment && !this.incidentModel.department){
  2788. this.applicationRequesterList = [];
  2789. return;
  2790. }
  2791. // 不关联查询,且没选择院区
  2792. if(!this.isRelatedDepartment && !this.incidentModel.hosId){
  2793. this.applicationRequesterList = [];
  2794. return;
  2795. }
  2796. let postData = {
  2797. idx: 0,
  2798. sum: 20,
  2799. user: {
  2800. hospital: this.isRelatedDepartment ? undefined : { id: this.incidentModel.hosId },
  2801. dept: this.isRelatedDepartment ? { id: this.incidentModel.department } : undefined,
  2802. name: keyWord,
  2803. // simpleQuery: true,
  2804. },
  2805. };
  2806. this.isLoading = true;
  2807. this.mainService
  2808. .getFetchDataList("simple/data", "user", postData)
  2809. .subscribe((data) => {
  2810. this.isLoading = false;
  2811. if (data.status == 200) {
  2812. this.applicationRequesterList = data.list;
  2813. }
  2814. });
  2815. }
  2816. // 修改申请人
  2817. changeApplyRequester(e){
  2818. console.log(e)
  2819. let userObj = this.applicationRequesterList.find(v => v.id == e);
  2820. // 选择申请人回显申请人电话
  2821. if(userObj){
  2822. this.incidentMsg.requesterPhone = userObj.phone;
  2823. }
  2824. }
  2825. // 故障现象列表
  2826. applicationCategoryList:any[] = [];
  2827. searchApplicationCategory(keyWord?) {
  2828. let dutyIds;
  2829. if(this.buildType === '编辑事件'){
  2830. dutyIds = this.incidentModel.duty.id.toString();
  2831. }else{
  2832. dutyIds = this.itsmData.checkedHos.length ? (this.itsmData.checkedHos.map(v => v.id).toString() || undefined) : undefined;
  2833. }
  2834. let postData = {
  2835. category: {
  2836. category: keyWord,
  2837. selectType: 'mutlQuery',
  2838. hierarchy: 3,//只差有三级的故障现象列表
  2839. dutyIds,
  2840. },
  2841. };
  2842. console.log(postData);
  2843. // return;
  2844. this.isLoading = true;
  2845. this.mainService
  2846. .incidentPost("listIncidentCategory", postData)
  2847. .subscribe((data) => {
  2848. this.isLoading = false;
  2849. if (data.status == 200) {
  2850. this.applicationCategoryList = data.data;
  2851. }
  2852. });
  2853. }
  2854. // 修改故障现象
  2855. incidentCategoryConfig:any = {};//当前匹配的故障现象规则
  2856. changeApplyCategory(e, isCoverage = false){
  2857. console.log(e)
  2858. // 知识库
  2859. this.getKnowageList();
  2860. if(e && !isCoverage){
  2861. // 根据故障现象带出故障描述
  2862. if(this.incidentModel.description){
  2863. this.incidentModel.description = this.incidentModel.description + ';' + this.applicationCategoryList.find(v => v.id == e).mutiCategory;
  2864. }else{
  2865. this.incidentModel.description = this.applicationCategoryList.find(v => v.id == e).mutiCategory;
  2866. }
  2867. }
  2868. // 根据院区和故障现象带出责任部门,优先级,维修人/组
  2869. if(this.incidentModel.hosId && e && this.buildType !== '编辑事件'){
  2870. let postData = {
  2871. idx: 0,
  2872. sum: 9999,
  2873. incidentCategoryConfig: {
  2874. categoryId: e,
  2875. hosId: this.incidentModel.hosId,
  2876. },
  2877. };
  2878. console.log(postData);
  2879. // return;
  2880. this.isLoading = true;
  2881. this.mainService
  2882. .getFetchDataList("simple/data", "incidentCategoryConfig", postData)
  2883. .subscribe((data) => {
  2884. this.isLoading = false;
  2885. if (data.status == 200) {
  2886. let list = data.list || [];
  2887. if(list.length > 0){
  2888. console.log(list[0]);
  2889. this.incidentCategoryConfig = list[0];
  2890. }else{
  2891. this.incidentCategoryConfig = {};
  2892. }
  2893. // 根据院区和故障现象带出责任部门,优先级,维修人/组
  2894. this.incidentModel.duty = this.incidentCategoryConfig.dutyDTO;
  2895. this.incidentModel.priorityId = this.incidentCategoryConfig.priority;
  2896. // 回显维修人/组
  2897. this.showGroupOrUser();
  2898. }
  2899. });
  2900. }else{
  2901. this.incidentModel.group = undefined;
  2902. this.applicationGroupList = [];
  2903. this.incidentModel.user = undefined;
  2904. this.applicationUserList = [];
  2905. }
  2906. }
  2907. // 直接解决-弹窗
  2908. directOrderModalShow = false; //弹窗开关
  2909. showDirectOrder() {
  2910. this.directOrderModalShow = true;
  2911. }
  2912. // 关闭弹窗
  2913. closeDirectOrderModelOrder(e) {
  2914. this.directOrderModalShow = JSON.parse(e).show;
  2915. }
  2916. // 弹窗确定
  2917. confirmDirectOrderModelOrder(incidentModel){
  2918. console.log(incidentModel);
  2919. this.maskFlag = this.msg.loading("正在加载中..", {
  2920. nzDuration: 0,
  2921. }).messageId;
  2922. this.incidentModel = {...this.incidentModel, ...incidentModel};
  2923. let category = this.applicationCategoryList.find(v => v.id == this.incidentModel.category);
  2924. let postData:any = {
  2925. solutionId: this.solutionId,
  2926. "incident": {
  2927. "id": this.incidentModel.id || undefined,
  2928. "deleteFlag": 0,
  2929. "duty": this.incidentModel.duty ? { id: this.incidentModel.duty.id } : undefined,
  2930. "requester": this.incidentModel.requester ? { id: this.incidentModel.requester } : undefined,
  2931. "repairIncidentType": this.incidentModel.repairIncidentType ? this.repairIncidentTypeList.find(v => v.value === this.incidentModel.repairIncidentType) : undefined,
  2932. "alarmType": false,
  2933. "department": this.incidentModel.department ? { id: this.incidentModel.department } : undefined,
  2934. "contactsInformation": this.incidentModel.contactsInformation,
  2935. "contacts": this.incidentModel.contacts,
  2936. "hosId": this.incidentModel.hosId || undefined,
  2937. "area": this.incidentModel.area ? { id: this.incidentModel.area } : undefined,
  2938. "place": this.incidentModel.place ? { id: this.incidentModel.place } : undefined,
  2939. "houseNumber": this.incidentModel.houseNumber,
  2940. "category": this.incidentModel.category ? { id: this.incidentModel.category } : undefined,
  2941. "priorityId": this.incidentModel.priorityId || undefined,
  2942. "source": this.incidentModel.source ? { id: this.incidentModel.source } : undefined,
  2943. // "title": category.mutiCategory,
  2944. "description": this.incidentModel.description,
  2945. "directProcess": 1,
  2946. "handleDescription": this.incidentModel.handleDescription,
  2947. "handlingPersonnelUser": {id: this.tool.getCurrentUserId()},
  2948. "yyTime": this.incidentModel.yyTime ? format(new Date(this.incidentModel.yyTime), 'yyyy-MM-dd HH:mm:ss') : undefined,
  2949. "closecode": this.incidentModel.closecode ? { id: this.incidentModel.closecode } : undefined,
  2950. "acceptUser": { id: this.tool.getCurrentUserId() },
  2951. "callID": this.incidentModel.callID || undefined,
  2952. "incomingPhone": this.incidentModel.incomingPhone || undefined,
  2953. "hjzxRecordId": this.incidentModel.hjzxRecordId || undefined,
  2954. },
  2955. };
  2956. if(this.buildType){
  2957. if(this.buildType === '报修转事件'){
  2958. postData.incident.fromWx = true;
  2959. }
  2960. if(this.buildType !== '继续建单' && this.buildType !== '编辑事件' && this.buildType !== '报修转事件'){
  2961. postData.incident = Object.assign({}, postData.incident);
  2962. }else{
  2963. postData.incident = Object.assign({}, this.editOrder, postData.incident);
  2964. }
  2965. }
  2966. this.mainService
  2967. .flowPost("incident/task/accept", postData)
  2968. .subscribe((result) => {
  2969. this.msg.remove(this.maskFlag);
  2970. this.maskFlag = false;
  2971. if (result.state == 200) {
  2972. // 图片上传
  2973. if(this.fileList.length){
  2974. console.log(this.fileList.map(v => v.originFileObj));
  2975. this.fileList.map(v => v.originFileObj).forEach(async file => {
  2976. await this.uploadImages(file, result.data.id);
  2977. })
  2978. }
  2979. this.directOrderModalShow = false;
  2980. // this.msg.success('直接解决成功');
  2981. this.isBuildOrderAgaginFn();
  2982. } else {
  2983. this.msg.error(result.msg || '直接解决失败');
  2984. }
  2985. });
  2986. }
  2987. // 回显维修人/组
  2988. showGroupOrUser(){
  2989. // 先判断科室绑定人/组
  2990. if(this.incidentModel.department && this.incidentModel.category && this.incidentModel.duty){
  2991. let postData = {
  2992. idx: 0,
  2993. sum: 10,
  2994. incidentAssignManager: {
  2995. deptId: this.incidentModel.department,
  2996. categoryId: this.incidentModel.category,
  2997. hosId: this.incidentModel.duty.id,
  2998. operationType: 'queryConfig',
  2999. },
  3000. };
  3001. this.mainService
  3002. .getFetchDataList("simple/data", "incidentAssignManager", postData)
  3003. .subscribe((result) => {
  3004. if (result.status == 200) {
  3005. var deptBinduserConfig = result.list.length ? result.list[0] : null;//获取第一条配置
  3006. if(deptBinduserConfig){
  3007. console.log('deptBinduserConfig:', deptBinduserConfig)
  3008. // 如果有科室绑定人员的配置
  3009. if(deptBinduserConfig.handleGroupDTO){
  3010. this.incidentModel.group = deptBinduserConfig.handleGroupDTO.id;
  3011. this.applicationGroupList = [deptBinduserConfig.handleGroupDTO];
  3012. }else{
  3013. this.incidentModel.group = undefined;
  3014. this.applicationGroupList = [];
  3015. }
  3016. if(deptBinduserConfig.handleUserDTO){
  3017. this.incidentModel.user = deptBinduserConfig.handleUserDTO.id;
  3018. this.applicationUserList = [deptBinduserConfig.handleUserDTO];
  3019. }else{
  3020. this.incidentModel.user = undefined;
  3021. this.applicationUserList = [];
  3022. }
  3023. }else{
  3024. if(this.incidentModel.category){
  3025. // 选择了故障现象
  3026. if(this.incidentCategoryConfig.groupId && this.incidentCategoryConfig.groupDTO){
  3027. this.incidentModel.group = this.incidentCategoryConfig.groupId;
  3028. this.applicationGroupList = [this.incidentCategoryConfig.groupDTO];
  3029. }else{
  3030. this.incidentModel.group = undefined;
  3031. this.applicationGroupList = [];
  3032. }
  3033. if(this.incidentCategoryConfig.userId && this.incidentCategoryConfig.userDTO){
  3034. this.incidentModel.user = this.incidentCategoryConfig.userId;
  3035. this.applicationUserList = [this.incidentCategoryConfig.userDTO];
  3036. }else{
  3037. this.incidentModel.user = undefined;
  3038. this.applicationUserList = [];
  3039. }
  3040. }
  3041. }
  3042. }
  3043. });
  3044. }else{
  3045. if(this.incidentModel.category){
  3046. // 选择了故障现象
  3047. if(this.incidentCategoryConfig.groupId && this.incidentCategoryConfig.groupDTO){
  3048. this.incidentModel.group = this.incidentCategoryConfig.groupId;
  3049. this.applicationGroupList = [this.incidentCategoryConfig.groupDTO];
  3050. }else{
  3051. this.incidentModel.group = undefined;
  3052. this.applicationGroupList = [];
  3053. }
  3054. if(this.incidentCategoryConfig.userId && this.incidentCategoryConfig.userDTO){
  3055. this.incidentModel.user = this.incidentCategoryConfig.userId;
  3056. this.applicationUserList = [this.incidentCategoryConfig.userDTO];
  3057. }else{
  3058. this.incidentModel.user = undefined;
  3059. this.applicationUserList = [];
  3060. }
  3061. }
  3062. }
  3063. }
  3064. // 图片相关
  3065. showUploadList = {
  3066. showPreviewIcon: true,
  3067. showRemoveIcon: true,
  3068. hidePreviewIconInNonImage: true
  3069. };
  3070. fileList = [
  3071. // {
  3072. // uid: -1,
  3073. // name: 'xxx.png',
  3074. // status: '1',
  3075. // url: 'https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png'
  3076. // }
  3077. ];
  3078. previewImage: string | undefined = '';
  3079. previewVisible = false;
  3080. handlePreview = (file: UploadFile) => {
  3081. console.log('file1:', file)
  3082. this.previewImage = file.url || file.thumbUrl;
  3083. this.previewVisible = true;
  3084. };
  3085. beforeUpload = (file: UploadFile): boolean => {
  3086. console.log('file2:', file)
  3087. this.fileList = [...this.fileList, file];
  3088. setTimeout(async () => {
  3089. file.url = await this.getBase64(file);
  3090. }, 0);
  3091. console.log('this.fileList:', this.fileList)
  3092. return true;
  3093. };
  3094. getBase64(file: any): Promise<any> {
  3095. return new Promise((resolve, reject) => {
  3096. const reader = new FileReader();
  3097. reader.readAsDataURL(file);
  3098. reader.onload = () => resolve(reader.result);
  3099. reader.onerror = error => reject(error);
  3100. });
  3101. }
  3102. // 临时上传图片
  3103. temporarilyUrl = this.mainService.returnUploadUrl('temporarily', 0);
  3104. // 处理组列表
  3105. applicationGroupList:any[] = [];
  3106. searchApplicationGroup(keyWord?) {
  3107. if(!this.incidentModel.duty){
  3108. this.incidentModel.group = undefined;
  3109. this.applicationGroupList = [];
  3110. this.incidentModel.user = undefined;
  3111. this.applicationUserList = [];
  3112. return;
  3113. }
  3114. let postData = {
  3115. idx: 0,
  3116. sum: 20,
  3117. group2: {
  3118. groupName: keyWord,
  3119. hospitals: this.incidentModel.duty ? this.incidentModel.duty.id.toString() : undefined,
  3120. type: 3,
  3121. },
  3122. };
  3123. this.isLoading = true;
  3124. this.mainService
  3125. .getFetchDataList("simple/data", "group2", postData)
  3126. .subscribe((data) => {
  3127. this.isLoading = false;
  3128. if (data.status == 200) {
  3129. this.applicationGroupList = data.list;
  3130. }
  3131. });
  3132. }
  3133. // 修改处理组
  3134. changeApplyGroup(e){
  3135. console.log(e);
  3136. this.incidentModel.user = undefined;
  3137. this.searchApplicationUser();
  3138. }
  3139. // 处理人列表
  3140. applicationUserList:any[] = [];
  3141. searchApplicationUser(keyWord?) {
  3142. let postData = {
  3143. idx: 0,
  3144. sum: 20,
  3145. user: {
  3146. name:keyWord,
  3147. groupdata: this.incidentModel.group ? { id: this.incidentModel.group } : undefined,
  3148. roleCodes: 'first-line support',
  3149. engineer: 1,
  3150. simpleQuery: true,
  3151. },
  3152. };
  3153. this.isLoading = true;
  3154. this.mainService
  3155. .getFetchDataList("simple/data", "user", postData)
  3156. .subscribe((data) => {
  3157. this.isLoading = false;
  3158. if (data.status == 200) {
  3159. this.applicationUserList = data.list;
  3160. }
  3161. });
  3162. }
  3163. // 优先级列表
  3164. applicationPriorityList:any[] = [];
  3165. searchApplicationPriority(keyWord?) {
  3166. let postData = {
  3167. idx: 0,
  3168. sum: 9999,
  3169. priority: {},
  3170. };
  3171. this.isLoading = true;
  3172. this.mainService
  3173. .getFetchDataList("simple/data", "priority", postData)
  3174. .subscribe((data) => {
  3175. this.isLoading = false;
  3176. if (data.status == 200) {
  3177. this.applicationPriorityList = data.list;
  3178. // 回显事件来源
  3179. let source = this.applicationSourceList.find(v => v.value === 'phone');
  3180. if(!this.incidentModel.source && source){
  3181. this.incidentModel.source = source.id;
  3182. }
  3183. }
  3184. });
  3185. }
  3186. // 事件来源列表
  3187. applicationSourceList:any[] = [];
  3188. searchApplicationSource(keyWord?) {
  3189. this.mainService.getDictionary("list", "incident_source").subscribe((data) => {
  3190. this.applicationSourceList = data || [];
  3191. });
  3192. }
  3193. // 报修类型列表
  3194. repairIncidentTypeList:any[] = [];
  3195. getRepairIncidentType() {
  3196. this.mainService.getDictionary("list", "repair_incident_type").subscribe((data) => {
  3197. this.repairIncidentTypeList = data || [];
  3198. });
  3199. }
  3200. // 选择报修类型
  3201. changeRepairIncidentType(value){
  3202. this.incidentModel.department = undefined;
  3203. this.incidentMsg.deptManyPhone = '';
  3204. this.isRelatedDepartment = value !== 'public';
  3205. this.changeApplyRelatedDepartment(this.isRelatedDepartment);
  3206. }
  3207. // 楼栋列表
  3208. applicationBuildingList:any[] = [];
  3209. searchApplicationBuilding(keyWord?, buildingId?) {
  3210. let postData = {
  3211. idx: 0,
  3212. sum: 9999,
  3213. building: {
  3214. cascadeHosId: this.incidentModel.hosId,
  3215. },
  3216. };
  3217. this.isLoading = true;
  3218. this.mainService
  3219. .getFetchDataList("simple/data", "building", postData)
  3220. .subscribe((data) => {
  3221. this.isLoading = false;
  3222. if (data.status == 200) {
  3223. this.applicationBuildingList = data.list;
  3224. if(buildingId){
  3225. let hasBuildingId = this.applicationBuildingList.some(v => v.id == buildingId);
  3226. if(hasBuildingId){
  3227. this.incidentModel.area = buildingId;
  3228. }else{
  3229. this.incidentModel.area = undefined;
  3230. }
  3231. }
  3232. }
  3233. });
  3234. }
  3235. // 修改楼栋
  3236. changeApplyBuilding(e){
  3237. console.log(e)
  3238. this.incidentModel.place = undefined;
  3239. this.searchApplicationFloor();
  3240. }
  3241. // 楼层列表
  3242. applicationFloorList:any[] = [];
  3243. searchApplicationFloor(keyWord?, floorId?, buildingId?) {
  3244. let postData = {
  3245. idx: 0,
  3246. sum: 9999,
  3247. floor: {
  3248. buildId: buildingId || this.incidentModel.area || undefined,
  3249. hosId: this.incidentModel.hosId,
  3250. },
  3251. };
  3252. this.isLoading = true;
  3253. this.mainService
  3254. .getFetchDataList("simple/data", "floor", postData)
  3255. .subscribe((data) => {
  3256. this.isLoading = false;
  3257. if (data.status == 200) {
  3258. this.applicationFloorList = data.list;
  3259. if(floorId){
  3260. let hasFloorId = this.applicationFloorList.some(v => v.id == floorId);
  3261. if(hasFloorId){
  3262. this.incidentModel.place = floorId;
  3263. }else{
  3264. this.incidentModel.place = undefined;
  3265. }
  3266. }
  3267. }
  3268. });
  3269. }
  3270. // 修改关联查
  3271. changeApplyRelatedDepartment(e){
  3272. if(this.buildType !== '报修转事件'){
  3273. this.incidentModel.requester = undefined;
  3274. }
  3275. this.searchApplicationRequester();
  3276. }
  3277. // 申请科室列表(搜索)
  3278. isLoadingApply: boolean = false;
  3279. applicationDeptList:any[] = [];
  3280. searchApplicationDepartment(type, e?, phone?, deptId?, isInit?) {
  3281. if(!this.hsmsData.hsmsSwitch && !this.itsmData.mdv2Switch){
  3282. return;
  3283. }
  3284. let keyWord = "";
  3285. if (e && e !== "&ks&" && e !== "&go&") {
  3286. keyWord = e;
  3287. }
  3288. let cascadeHosId;
  3289. if(type == 'itsm'){
  3290. cascadeHosId = this.incidentModel.hosId || undefined;
  3291. }else{
  3292. cascadeHosId = this.checkedHos;
  3293. }
  3294. let dataObj = {
  3295. idx: 0,
  3296. sum: 20,
  3297. department: {
  3298. searchType: type == 'itsm' ? undefined : 1,// 简单查询
  3299. cascadeHosId,
  3300. keyWord: keyWord,
  3301. flag: 1,
  3302. },
  3303. };
  3304. this.WSNum++;
  3305. this.isLoadingApply = true;
  3306. this.mainService
  3307. .getFetchDataList("data", "department", dataObj)
  3308. .subscribe((data) => {
  3309. this.WSNum--;
  3310. if (this.WSNum === 0) {
  3311. this.isLoadingApply = false;
  3312. }
  3313. if (data.status == 200) {
  3314. if(type == 'hsms'){
  3315. this.applicationDepartmentList = data.list;
  3316. deptId && this.changeApply(deptId);
  3317. if (e === undefined) {
  3318. //初始化
  3319. this.changeApplicationDepartment();
  3320. } else if (e === "&ks&") {
  3321. //绑定了科室
  3322. // 配送--start
  3323. let obj = this.applicationDepartmentList.find(
  3324. (item) => item.id == this.applyDeptMiddle.id
  3325. );
  3326. if (!obj) {
  3327. this.applicationDepartmentList.push(this.applyDeptMiddle);
  3328. }
  3329. this.applyDept = this.applyDeptMiddle.id;
  3330. this.changeApplicationDepartment("&ks&");
  3331. // 配送--end
  3332. } else if (e === "&go&") {
  3333. //继续建单
  3334. let obj = this.applicationDepartmentList.find(
  3335. (item) => item.id == this.applyStartDept.id
  3336. );
  3337. if (!obj) {
  3338. this.applicationDepartmentList.push(this.applyStartDept);
  3339. }
  3340. this.applyDept = this.applyStartDept.id;
  3341. this.changeApplicationDepartment("&go&");
  3342. } else if (e === "") {
  3343. //没绑定科室
  3344. this.changeApplicationDepartment(phone);
  3345. }
  3346. }else if(type == 'itsm'){
  3347. this.applicationDeptList = data.list;
  3348. let ids = this.applicationDeptList.map(v => v.id);
  3349. isInit && !ids.includes(this.incidentModel.department) && (this.applicationDeptList.unshift({id: this.incidentModel.department, dept: this.incidentMsg.deptName}))
  3350. console.log(this.applicationDeptList);
  3351. console.log(this.incidentModel);
  3352. console.log(this.incidentMsg);
  3353. deptId && this.changeApplyDept(deptId);
  3354. }
  3355. }
  3356. });
  3357. }
  3358. openChangeApply(flag){
  3359. flag && this.searchApplicationDepartment('hsms')
  3360. }
  3361. openChangeApplyDept(flag){
  3362. flag && this.searchApplicationDepartment('itsm');
  3363. }
  3364. openChangeApplyRequester(flag){
  3365. flag && this.searchApplicationRequester();
  3366. }
  3367. openChangeApplyCategory(flag){
  3368. flag && this.searchApplicationCategory();
  3369. }
  3370. openChangeApplyGroup(flag){
  3371. flag && this.searchApplicationGroup()
  3372. }
  3373. openChangeApplyUser(flag){
  3374. flag && this.searchApplicationUser()
  3375. }
  3376. // 配送-选择科室
  3377. changeApply(e) {
  3378. console.log(e, this.applicationDepartmentList);
  3379. this.changeApplicationDepartment("&same&");
  3380. this.defaultInspectFn();
  3381. if(this.applyDept && this.currentTabIndex !== '故障报修'){
  3382. this.rightTitle_tab = [
  3383. { id: 0, name: '近期配送' },
  3384. { id: 1, name: '转出院记录' },
  3385. ]
  3386. this.rightTitleHandler(this.rightTitle_tab[0].id);
  3387. }
  3388. let deptObj = this.applicationDepartmentList.find(v => v.id == e);
  3389. if(this.incidentModel.department != e){
  3390. this.incidentModel.department = e;
  3391. this.searchApplicationDepartment('itsm', deptObj ? deptObj.dept : '', undefined, e);
  3392. }
  3393. }
  3394. // 运维-选择科室
  3395. changeApplyDept(e) {
  3396. console.log(e, this.applicationDeptList);
  3397. if(this.incidentModel.department && this.currentTabIndex === '故障报修'){
  3398. this.rightTitle_tab = [
  3399. { id: 2, name: '近期维修' },
  3400. { id: 3, name: '知识库' },
  3401. ]
  3402. this.rightTitleHandler(this.rightTitle_tab[0].id);
  3403. }
  3404. let deptObj = this.applicationDeptList.find(v => v.id == e);
  3405. if(this.applyDept != e){
  3406. this.applyDept = e;
  3407. this.searchApplicationDepartment('hsms', deptObj ? deptObj.dept : '', undefined, e);
  3408. }
  3409. // 选择科室回显一级院区
  3410. if(!this.incidentModel.hosId){
  3411. if(deptObj){
  3412. this.incidentModel.hosId = deptObj.hospital.parent ? deptObj.hospital.parent.id : deptObj.hospital.id;
  3413. }
  3414. this.incidentModel.area = undefined;
  3415. this.searchApplicationBuilding();
  3416. this.incidentModel.place = undefined;
  3417. this.applicationFloorList = [];
  3418. }
  3419. // 选择科室回显科室电话,楼栋,楼层,地址
  3420. if(deptObj){
  3421. console.log('deptObj:', deptObj)
  3422. this.incidentMsg.deptManyPhone = deptObj.manyPhone;
  3423. let buildingId = deptObj.building ? deptObj.building.id : undefined;
  3424. buildingId && this.searchApplicationBuilding('', buildingId);
  3425. let floorId = deptObj.floor ? deptObj.floor.id : undefined;
  3426. buildingId && floorId && this.searchApplicationFloor('', floorId, buildingId);
  3427. this.incidentModel.houseNumber = deptObj.address;
  3428. }
  3429. // 刷新申请人列表
  3430. if(this.buildType !== '报修转事件'){
  3431. this.incidentModel.requester = undefined;
  3432. }
  3433. this.searchApplicationRequester();
  3434. // 根据院区和故障现象带出责任部门,优先级,维修人/组
  3435. if(this.incidentModel.category && this.incidentModel.hosId && this.buildType !== '编辑事件'){
  3436. let postData = {
  3437. idx: 0,
  3438. sum: 9999,
  3439. incidentCategoryConfig: {
  3440. categoryId: this.incidentModel.category,
  3441. hosId: this.incidentModel.hosId,
  3442. },
  3443. };
  3444. console.log(postData);
  3445. // return;
  3446. this.isLoading = true;
  3447. this.mainService
  3448. .getFetchDataList("simple/data", "incidentCategoryConfig", postData)
  3449. .subscribe((data) => {
  3450. this.isLoading = false;
  3451. if (data.status == 200) {
  3452. let list = data.list || [];
  3453. if(list.length > 0){
  3454. console.log(list[0]);
  3455. this.incidentCategoryConfig = list[0];
  3456. }else{
  3457. this.incidentCategoryConfig = {};
  3458. }
  3459. // 根据院区和故障现象带出责任部门,优先级,维修人/组
  3460. this.incidentModel.duty = this.incidentCategoryConfig.dutyDTO;
  3461. this.incidentModel.priorityId = this.incidentCategoryConfig.priority;
  3462. // 回显维修人/组
  3463. this.showGroupOrUser();
  3464. }
  3465. });
  3466. }else{
  3467. // 回显维修人/组
  3468. this.showGroupOrUser();
  3469. }
  3470. }
  3471. // 申请科室列表(搜索)失去焦点的时候
  3472. changeApplicationDepartment(phone?) {
  3473. this.radioValueQt = null;
  3474. this.startDeptQt = null;
  3475. this.endDeptQt = null;
  3476. this.radioValueZy = null;
  3477. this.radioValueZyPre = null;
  3478. this.startDeptZy = null;
  3479. this.endDeptZy = null;
  3480. this.patientZy = null;
  3481. this.goodsNow = [];
  3482. // this.patientList = [];
  3483. this.workOrderRemark = "";
  3484. this.workOrderRemarkZy = "";
  3485. this.deptZyList["startDept"] = [];
  3486. this.deptZyList["endDept"] = [];
  3487. this.deptZyList["startStatus"] = 0;
  3488. this.deptZyList["endStatus"] = 0;
  3489. this.deptQtList["startDept"] = [];
  3490. this.deptQtList["endDept"] = [];
  3491. this.deptQtList["startStatus"] = 0;
  3492. this.deptQtList["endStatus"] = 0;
  3493. console.log(phone);
  3494. if (
  3495. phone !== undefined &&
  3496. phone !== "&same&" &&
  3497. phone !== "&ks&" &&
  3498. phone !== "&go&"
  3499. ) {
  3500. // this.incidentModel.incomingPhone = this.callNumber = this.incidentModel.contactsInformation = phone;
  3501. this.applyDept = null;
  3502. this.noArrives = []; //近期配送
  3503. } else if (phone === "&ks&") {
  3504. let filter = this.applicationDepartmentList.filter(
  3505. (item) => item.id == this.applyDept
  3506. );
  3507. console.log('filter', filter)
  3508. // this.incidentModel.incomingPhone = this.callNumber = this.incidentModel.contactsInformation = filter[0].phone;
  3509. console.log(this.callNumber); //ceshi
  3510. if (this.currentTabIndex == "患者转运") {
  3511. //患者转运
  3512. //获取患者信息
  3513. this.getPatientList(this.applyDept, "");
  3514. }
  3515. if (this.currentRTab === 0) {
  3516. this.getWorkOrders(this.applyDept);
  3517. } else if (this.currentRTab === 1) {
  3518. this.getPatientLog(this.applyDept);
  3519. } else if (this.currentRTab === 2) {
  3520. this.getItsmOrders(this.incidentModel.department);
  3521. } else if (this.currentRTab === 3) {
  3522. this.getDictionaryList();
  3523. }
  3524. } else if (phone === "&go&") {
  3525. if (this.currentTabIndex == "患者转运") {
  3526. //患者转运
  3527. //获取患者信息
  3528. this.getPatientList(this.applyDept, "");
  3529. }
  3530. if (this.currentRTab === 0) {
  3531. this.getWorkOrders(this.applyDept);
  3532. } else if (this.currentRTab === 1) {
  3533. this.getPatientLog(this.applyDept);
  3534. } else if (this.currentRTab === 2) {
  3535. this.getItsmOrders(this.incidentModel.department);
  3536. } else if (this.currentRTab === 3) {
  3537. this.getDictionaryList();
  3538. }
  3539. } else if (phone === "&same&") {
  3540. if (this.currentTabIndex == "患者转运") {
  3541. //患者转运
  3542. //获取患者信息
  3543. this.getPatientList(this.applyDept, "");
  3544. }
  3545. if (this.currentRTab === 0) {
  3546. this.getWorkOrders(this.applyDept);
  3547. } else if (this.currentRTab === 1) {
  3548. this.getPatientLog(this.applyDept);
  3549. } else if (this.currentRTab === 2) {
  3550. this.getItsmOrders(this.incidentModel.department);
  3551. } else if (this.currentRTab === 3) {
  3552. this.getDictionaryList();
  3553. }
  3554. }
  3555. }
  3556. // 引入电话号码
  3557. importPhone(phone, isTransform){
  3558. if(isTransform){
  3559. this.incidentModel.contactsInformation = phone.split(',')[0];
  3560. }else{
  3561. this.incidentModel.contactsInformation = phone;
  3562. }
  3563. }
  3564. // 是否连续建单
  3565. isBuildOrderAgagin:boolean = false;
  3566. maskFlag:any = false;
  3567. // 运维-直接解决
  3568. directOrder(){
  3569. if(this.incidentModel.repairIncidentType === 'public' && !this.incidentModel.requester){
  3570. this.msg.warning('请选择申请人!');
  3571. return;
  3572. }
  3573. if(!this.incidentModel.category){
  3574. this.msg.warning('请选择故障现象!');
  3575. return;
  3576. }
  3577. let category = this.applicationCategoryList.find(v => v.id == this.incidentModel.category);
  3578. if(!this.incidentModel.duty){
  3579. this.msg.warning(`故障现象【${category.mutiCategory}】没有设置责任部门!`);
  3580. return;
  3581. }
  3582. if(this.incidentModel.repairIncidentType === 'dept' && !this.incidentModel.department){
  3583. this.msg.warning('请选择申请科室!');
  3584. return;
  3585. }
  3586. if(!this.incidentModel.contactsInformation){
  3587. this.msg.warning('请填写联系电话!');
  3588. return;
  3589. }
  3590. if(!this.incidentModel.priorityId){
  3591. this.msg.warning('请选择优先级!');
  3592. return;
  3593. }
  3594. if(!this.incidentModel.source){
  3595. this.msg.warning('请选择事件来源!');
  3596. return;
  3597. }
  3598. if(!this.incidentModel.description){
  3599. this.msg.warning('请选择故障描述!');
  3600. return;
  3601. }
  3602. this.showDirectOrder();
  3603. }
  3604. // 图片上传
  3605. uploadImages(file, id){
  3606. const formData = new FormData();
  3607. formData.append('file', file);
  3608. formData.append('fileName', file.name);
  3609. const req = new HttpRequest('Post', this.mainService.returnUploadUrl('wechatRequesterIncident', id), formData, {
  3610. reportProgress: true
  3611. });
  3612. return this.http.request(req).pipe(filter(e => e instanceof HttpResponse)).toPromise();
  3613. }
  3614. // 运维-建单并派单
  3615. assignOrder(){
  3616. if(this.incidentModel.repairIncidentType === 'public' && !this.incidentModel.requester){
  3617. this.msg.warning('请选择申请人!');
  3618. return;
  3619. }
  3620. if(!this.incidentModel.category){
  3621. this.msg.warning('请选择故障现象!');
  3622. return;
  3623. }
  3624. let category = this.applicationCategoryList.find(v => v.id == this.incidentModel.category);
  3625. console.log('故障现象对象=>>>>>',category)
  3626. if(!this.incidentModel.duty){
  3627. this.msg.warning(`故障现象【${category.mutiCategory}】没有设置责任部门!`);
  3628. return;
  3629. }
  3630. if(this.incidentModel.repairIncidentType === 'dept' && !this.incidentModel.department){
  3631. this.msg.warning('请选择申请科室!');
  3632. return;
  3633. }
  3634. if(!this.incidentModel.contactsInformation){
  3635. this.msg.warning('请填写联系电话!');
  3636. return;
  3637. }
  3638. if(!this.incidentModel.priorityId){
  3639. this.msg.warning('请选择优先级!');
  3640. return;
  3641. }
  3642. if(!this.incidentModel.source){
  3643. this.msg.warning('请选择事件来源!');
  3644. return;
  3645. }
  3646. if(!this.incidentModel.description){
  3647. this.msg.warning('请选择故障描述!');
  3648. return;
  3649. }
  3650. if(!this.incidentModel.group && this.buildType !== '编辑事件'){
  3651. this.msg.warning('请选择处理组!');
  3652. return;
  3653. }
  3654. this.maskFlag = this.msg.loading("正在加载中..", {
  3655. nzDuration: 0,
  3656. }).messageId;
  3657. let postData:any = {
  3658. solutionId: this.solutionId,
  3659. "incident": {
  3660. "id": this.incidentModel.id || undefined,
  3661. "deleteFlag": 0,
  3662. "duty": this.incidentModel.duty ? { id: this.incidentModel.duty.id } : undefined,
  3663. "department": this.incidentModel.department ? { id: this.incidentModel.department } : undefined,
  3664. "contactsInformation": this.incidentModel.contactsInformation,
  3665. "contacts": this.incidentModel.contacts,
  3666. "hosId": this.incidentModel.hosId || undefined,
  3667. "area": this.incidentModel.area ? { id: this.incidentModel.area } : undefined,
  3668. "place": this.incidentModel.place ? { id: this.incidentModel.place } : undefined,
  3669. "houseNumber": this.incidentModel.houseNumber,
  3670. "category": this.incidentModel.category ? { id: this.incidentModel.category } : undefined,
  3671. "priorityId": this.incidentModel.priorityId || undefined,
  3672. "source": this.incidentModel.source ? { id: this.incidentModel.source } : undefined,
  3673. // "title": category.mutiCategory,
  3674. "description": this.incidentModel.description,
  3675. "yyTime": this.incidentModel.yyTime ? format(new Date(this.incidentModel.yyTime), 'yyyy-MM-dd HH:mm:ss') : undefined,
  3676. "requester": this.incidentModel.requester ? { id: this.incidentModel.requester } : undefined,
  3677. "repairIncidentType": this.incidentModel.repairIncidentType ? this.repairIncidentTypeList.find(v => v.value === this.incidentModel.repairIncidentType) : undefined,
  3678. "acceptUser": { id: this.tool.getCurrentUserId() },
  3679. "callID": this.incidentModel.callID || undefined,
  3680. "incomingPhone": this.incidentModel.incomingPhone || undefined,
  3681. "candidateGroups": this.incidentModel.group || undefined,
  3682. "assignee": this.incidentModel.user || undefined,
  3683. "hjzxRecordId": this.incidentModel.hjzxRecordId || undefined,
  3684. }
  3685. };
  3686. if(this.buildType){
  3687. if(this.buildType === '报修转事件'){
  3688. postData.incident.fromWx = true;
  3689. }
  3690. if(this.buildType !== '继续建单' && this.buildType !== '编辑事件' && this.buildType !== '报修转事件'){
  3691. postData.incident = Object.assign({}, postData.incident);
  3692. }else{
  3693. postData.incident = Object.assign({}, this.editOrder, postData.incident);
  3694. }
  3695. }
  3696. console.log(postData);
  3697. // return;
  3698. this.mainService
  3699. .flowPost("incident/task/accept", postData)
  3700. .subscribe((result) => {
  3701. this.msg.remove(this.maskFlag);
  3702. this.maskFlag = false;
  3703. if (result.state == 200) {
  3704. // 图片上传
  3705. if(this.fileList.length){
  3706. console.log(this.fileList.map(v => v.originFileObj));
  3707. this.fileList.map(v => v.originFileObj).forEach(async file => {
  3708. await this.uploadImages(file, result.data.id);
  3709. })
  3710. }
  3711. // this.msg.success('建单并派单成功');
  3712. this.isBuildOrderAgaginFn();
  3713. } else {
  3714. this.msg.error(result.msg || '建单并派单失败');
  3715. }
  3716. });
  3717. }
  3718. // 运维-暂存
  3719. temporaryStorage(){
  3720. this.maskFlag = this.msg.loading("正在加载中..", {
  3721. nzDuration: 0,
  3722. }).messageId;
  3723. let category;
  3724. if(this.incidentModel.category){
  3725. category = this.applicationCategoryList.find(v => v.id == this.incidentModel.category);
  3726. }
  3727. let postData:any = {
  3728. solutionId: this.solutionId,
  3729. "incident": {
  3730. "id": this.incidentModel.id || undefined,
  3731. "deleteFlag": 0,
  3732. "duty": this.incidentModel.duty ? { id: this.incidentModel.duty.id } : undefined,
  3733. "department": this.incidentModel.department ? { id: this.incidentModel.department } : undefined,
  3734. "contactsInformation": this.incidentModel.contactsInformation,
  3735. "contacts": this.incidentModel.contacts,
  3736. "hosId": this.incidentModel.hosId || undefined,
  3737. "area": this.incidentModel.area ? { id: this.incidentModel.area } : undefined,
  3738. "place": this.incidentModel.place ? { id: this.incidentModel.place } : undefined,
  3739. "houseNumber": this.incidentModel.houseNumber,
  3740. "category": this.incidentModel.category ? { id: this.incidentModel.category } : undefined,
  3741. "priorityId": this.incidentModel.priorityId || undefined,
  3742. "source": this.incidentModel.source ? { id: this.incidentModel.source } : undefined,
  3743. // "title": category ? category.mutiCategory : '',
  3744. "description": this.incidentModel.description,
  3745. "yyTime": this.incidentModel.yyTime ? format(new Date(this.incidentModel.yyTime), 'yyyy-MM-dd HH:mm:ss') : undefined,
  3746. "requester": this.incidentModel.requester ? { id: this.incidentModel.requester } : undefined,
  3747. "repairIncidentType": this.incidentModel.repairIncidentType ? this.repairIncidentTypeList.find(v => v.value === this.incidentModel.repairIncidentType) : undefined,
  3748. "acceptUser": { id: this.tool.getCurrentUserId() },
  3749. "callID": this.incidentModel.callID || undefined,
  3750. "incomingPhone": this.incidentModel.incomingPhone || undefined,
  3751. "candidateGroups": this.incidentModel.group || undefined,
  3752. "assignee": this.incidentModel.user || undefined,
  3753. "hjzxRecordId": this.incidentModel.hjzxRecordId || undefined,
  3754. }
  3755. };
  3756. if(this.buildType){
  3757. if(this.buildType === '报修转事件'){
  3758. postData.incident.fromWx = true;
  3759. }
  3760. if(this.buildType !== '继续建单' && this.buildType !== '编辑事件' && this.buildType !== '报修转事件'){
  3761. postData.incident = Object.assign({}, postData.incident);
  3762. }else{
  3763. postData.incident = Object.assign({}, this.editOrder, postData.incident);
  3764. }
  3765. }
  3766. console.log(postData);
  3767. // return;
  3768. this.mainService
  3769. .flowPost("incident/task/storage", postData)
  3770. .subscribe((result) => {
  3771. this.msg.remove(this.maskFlag);
  3772. this.maskFlag = false;
  3773. if (result.state == 200) {
  3774. // 图片上传
  3775. if(this.fileList.length){
  3776. console.log(this.fileList.map(v => v.originFileObj));
  3777. this.fileList.map(v => v.originFileObj).forEach(async file => {
  3778. await this.uploadImages(file, result.data.id);
  3779. })
  3780. }
  3781. // this.msg.success('暂存成功');
  3782. this.isBuildOrderAgaginFn();
  3783. } else {
  3784. this.msg.error(result.msg || '暂存失败');
  3785. }
  3786. });
  3787. }
  3788. // 运维-保存
  3789. saveOrder(){
  3790. if(this.incidentModel.repairIncidentType === 'public' && !this.incidentModel.requester){
  3791. this.msg.warning('请选择申请人!');
  3792. return;
  3793. }
  3794. if(!this.incidentModel.category){
  3795. this.msg.warning('请选择故障现象!');
  3796. return;
  3797. }
  3798. let category = this.applicationCategoryList.find(v => v.id == this.incidentModel.category);
  3799. if(!this.incidentModel.duty){
  3800. this.msg.warning(`故障现象【${category.mutiCategory}】没有设置责任部门!`);
  3801. return;
  3802. }
  3803. if(this.incidentModel.repairIncidentType === 'dept' && !this.incidentModel.department){
  3804. this.msg.warning('请选择申请科室!');
  3805. return;
  3806. }
  3807. if(!this.incidentModel.contactsInformation){
  3808. this.msg.warning('请填写联系电话!');
  3809. return;
  3810. }
  3811. if(!this.incidentModel.priorityId){
  3812. this.msg.warning('请选择优先级!');
  3813. return;
  3814. }
  3815. if(!this.incidentModel.source){
  3816. this.msg.warning('请选择事件来源!');
  3817. return;
  3818. }
  3819. if(!this.incidentModel.description){
  3820. this.msg.warning('请选择故障描述!');
  3821. return;
  3822. }
  3823. this.maskFlag = this.msg.loading("正在加载中..", {
  3824. nzDuration: 0,
  3825. }).messageId;
  3826. let postData:any = {
  3827. solutionId: this.solutionId,
  3828. "incident": {
  3829. "id": this.incidentModel.id || undefined,
  3830. "deleteFlag": 0,
  3831. "duty": this.incidentModel.duty ? { id: this.incidentModel.duty.id } : undefined,
  3832. "department": this.incidentModel.department ? { id: this.incidentModel.department } : undefined,
  3833. "contactsInformation": this.incidentModel.contactsInformation,
  3834. "contacts": this.incidentModel.contacts,
  3835. "hosId": this.incidentModel.hosId || undefined,
  3836. "area": this.incidentModel.area ? { id: this.incidentModel.area } : undefined,
  3837. "place": this.incidentModel.place ? { id: this.incidentModel.place } : undefined,
  3838. "houseNumber": this.incidentModel.houseNumber,
  3839. "category": this.incidentModel.category ? { id: this.incidentModel.category } : undefined,
  3840. "priorityId": this.incidentModel.priorityId || undefined,
  3841. "source": this.incidentModel.source ? { id: this.incidentModel.source } : undefined,
  3842. // "title": category ? category.mutiCategory : '',
  3843. "description": this.incidentModel.description,
  3844. "yyTime": this.incidentModel.yyTime ? format(new Date(this.incidentModel.yyTime), 'yyyy-MM-dd HH:mm:ss') : undefined,
  3845. "requester": this.incidentModel.requester ? { id: this.incidentModel.requester } : undefined,
  3846. "repairIncidentType": this.incidentModel.repairIncidentType ? this.repairIncidentTypeList.find(v => v.value === this.incidentModel.repairIncidentType) : undefined,
  3847. "acceptUser": { id: this.tool.getCurrentUserId() },
  3848. "callID": this.incidentModel.callID || undefined,
  3849. "incomingPhone": this.incidentModel.incomingPhone || undefined,
  3850. "hjzxRecordId": this.incidentModel.hjzxRecordId || undefined,
  3851. }
  3852. };
  3853. if(this.buildType){
  3854. postData.incident = Object.assign({}, this.editOrder, postData.incident);
  3855. }
  3856. console.log(postData);
  3857. // return;
  3858. this.mainService
  3859. .flowPost("incident/task/edit", postData)
  3860. .subscribe((result) => {
  3861. this.msg.remove(this.maskFlag);
  3862. this.maskFlag = false;
  3863. if (result.state == 200) {
  3864. // 图片上传
  3865. if(this.fileList.length){
  3866. console.log(this.fileList.map(v => v.originFileObj));
  3867. this.fileList.map(v => v.originFileObj).forEach(async file => {
  3868. await this.uploadImages(file, result.data.id);
  3869. })
  3870. }
  3871. // this.msg.success('编辑成功');
  3872. this.isBuildOrderAgaginFn();
  3873. } else {
  3874. this.msg.error(result.msg || '编辑失败');
  3875. }
  3876. });
  3877. }
  3878. // 是否连续建单
  3879. isBuildOrderAgaginFn(){
  3880. if(this.isBuildOrderAgagin){
  3881. // 清除故障现象,维修人/组
  3882. this.incidentModel.category = undefined;
  3883. this.incidentModel.user = undefined;
  3884. this.incidentModel.group = undefined;
  3885. this.showPromptModal("操作", true, "", "");
  3886. }else{
  3887. if(this.incomingService.getSign() === 'callCenter' && this.incomingService.getPhoneNumber()){
  3888. this.jry_shixian();
  3889. }
  3890. this.newOrderShow = false; //关闭弹窗
  3891. this.newOrderShowOpen = false; //此时可出现新的弹窗
  3892. this.showPromptModal("操作", true, "", "");
  3893. }
  3894. }
  3895. // 选择统计备注
  3896. countRemarkIndex:number = -1;
  3897. addCountRemark(countRemark, index, i){
  3898. if(this.countRemarkIndex == i){
  3899. this.countRemarkIndex = -1;
  3900. }else{
  3901. this.countRemarkIndex = i;
  3902. }
  3903. this.getSearchTaskList('', this.countRemarkIndex > -1 ? countRemark : '').subscribe((result) => {
  3904. if (result.status == 200) {
  3905. this.searchTaskLoading = false;
  3906. this.workTypes = result['data'] || [];
  3907. // 整理后的任务类型
  3908. this.isShowResidenceNo = false;
  3909. this.workTypesArrange[index].value = [];
  3910. // for (const value of this.workTypesArrange) {
  3911. // value.value = [];
  3912. // }
  3913. this.workTypes.forEach((item) => {
  3914. if(item.associationTypeValue === 'patientTransport' || item.associationTypeValue === 'inspect'){
  3915. // // 患者其他服务
  3916. // let obj = this.workTypesArrange.find(v => v.key === '患者转运');
  3917. // if(obj){
  3918. // obj.value.push(item);
  3919. // }else{
  3920. // this.workTypesArrange.unshift({ key: '患者转运', value: [item] });
  3921. // this.isShowResidenceNo = true;
  3922. // }
  3923. }else if(item.associationTypeValue === 'other' || item.associationTypeValue === 'specimen' || item.associationTypeValue === 'ordinary'){
  3924. // 物品配送
  3925. let obj = this.workTypesArrange.find(v => v.key === '物品配送');
  3926. if(obj){
  3927. obj.value.push(item);
  3928. }else{
  3929. this.workTypesArrange.unshift({ key: '物品配送', value: [item] });
  3930. }
  3931. }
  3932. });
  3933. console.log('workTypesArrange', this.workTypesArrange);
  3934. // 任务类型是否显示操作项
  3935. let arr = this.workTypesArrange;
  3936. this.workTypesFlag = arr.length >= 5;
  3937. }
  3938. });
  3939. }
  3940. // 新建工单->获取新建类型
  3941. countRemarkList:any[] = [];
  3942. isShowResidenceNo = false;
  3943. getAutoWorkTypes(isFirst, isInit) {
  3944. this.workTypesArrange = [];
  3945. // 运维
  3946. if(this.itsmData.mdv2Switch){
  3947. this.workTypesArrange = [{key:'故障报修', value: []}];
  3948. if(!this.hsmsData.hsmsSwitch){
  3949. console.log('workTypesArrange', this.workTypesArrange);
  3950. // 是否显示操作项
  3951. this.workTypesFlag = this.workTypesArrange.length >= 5;
  3952. // 默认选中第一项
  3953. if (this.workTypesArrange.length > 0) {
  3954. this.tabClick(this.workTypesArrange[0].key, isInit);
  3955. }
  3956. }
  3957. }
  3958. // 配送
  3959. if(this.hsmsData.hsmsSwitch){
  3960. this.newLoading = true;
  3961. this.mainService.getTaskTypeBySearchKey({
  3962. hosId: this.checkedHos,
  3963. }).subscribe((data) => {
  3964. this.newLoading = false;
  3965. if (data["status"] == 200) {
  3966. this.workTypes = data["data"];
  3967. // 整理后的任务类型
  3968. this.isShowResidenceNo = false;
  3969. this.workTypes.forEach((item) => {
  3970. if(item.associationTypeValue === 'patientTransport' || item.associationTypeValue === 'inspect'){
  3971. // 患者其他服务
  3972. let obj = this.workTypesArrange.find(v => v.key === '患者转运');
  3973. if(obj){
  3974. obj.value.push(item);
  3975. }else{
  3976. this.workTypesArrange.unshift({ key: '患者转运', value: [item] });
  3977. this.isShowResidenceNo = true;
  3978. }
  3979. }else if(item.associationTypeValue === 'other' || item.associationTypeValue === 'specimen' || item.associationTypeValue === 'ordinary'){
  3980. // 物品配送
  3981. let obj = this.workTypesArrange.find(v => v.key === '物品配送');
  3982. if(obj){
  3983. obj.value.push(item);
  3984. }else{
  3985. this.workTypesArrange.unshift({ key: '物品配送', value: [item] });
  3986. }
  3987. }
  3988. });
  3989. console.log('workTypesArrange', this.workTypesArrange);
  3990. // 任务类型是否显示操作项
  3991. let arr = this.workTypesArrange;
  3992. this.workTypesFlag = arr.length >= 5;
  3993. // 默认选中第一项
  3994. if (arr.length > 0) {
  3995. isFirst ? this.tabClick(arr[0].key, isInit) : this.tabClick(arr[arr.length - 1].key, isInit);
  3996. }
  3997. }
  3998. });
  3999. this.getTaskTypeCountRemarkList();
  4000. }
  4001. }
  4002. // 查类型
  4003. getTaskTypeCountRemarkList(){
  4004. this.mainService.getTaskTypeCountRemarkList({
  4005. hosId: this.checkedHos,
  4006. typeValues: 'other,specimen,ordinary',
  4007. }).subscribe((data) => {
  4008. if (data["status"] == 200){
  4009. this.countRemarkList = data.data || [];
  4010. }
  4011. })
  4012. }
  4013. // 终点科室选中
  4014. endDeptZyChange() {
  4015. if (!this.applyDept || !this.endDeptZy) {
  4016. return;
  4017. }
  4018. // 终点科室患者信息列表,id是送病人回病房的任务类型
  4019. if (this.radioValueZy == this.deathTasktypeId) {
  4020. //获取患者信息
  4021. this.patientZy = null;
  4022. this.getPatientList(this.endDeptZy, "");
  4023. }
  4024. }
  4025. //搜索院区下面的科室(患者转运)
  4026. searchHosDepartment(id, type, dept?) {
  4027. if (dept) {
  4028. this.searchHosDepartmentSubject.next([id, type, dept]);
  4029. } else {
  4030. this.searchHosDepartmentSubject.next([id, type]);
  4031. }
  4032. }
  4033. // 搜索院区下面的科室(患者转运)
  4034. getHosDepartment(id, type, dept?) {
  4035. //id院区,type起点科室'start',终点科室'end'。科室名称dept。
  4036. let value = "";
  4037. if (dept) {
  4038. value = dept;
  4039. }
  4040. if (type === "start" && this.deptZyList["startStatus"] == 202) {
  4041. //固定科室范围,禁止搜索
  4042. this.mainService.getdeptList(this.radioValueZy).subscribe((data:any) => {
  4043. let arr = data;
  4044. if(value!=''){
  4045. data = arr.startDept.filter(i=>i.dept.indexOf(value) !=-1)
  4046. this.deptZyList.startDept = data
  4047. }else{
  4048. this.deptZyList.startDept = arr.startDept
  4049. }
  4050. })
  4051. return;
  4052. } else if (type === "end" && this.deptZyList["endStatus"] == 202) {
  4053. //固定科室范围,禁止搜索
  4054. this.mainService.getdeptList(this.radioValueZy).subscribe((data:any) => {
  4055. let arr = data;
  4056. if(value!=''){
  4057. data = arr.endDept.filter(i=>i.dept.indexOf(value) !=-1)
  4058. this.deptZyList.endDept = data
  4059. }else{
  4060. this.deptZyList.endDept = arr.endDept
  4061. }
  4062. })
  4063. return;
  4064. }
  4065. let postData = {
  4066. idx: 0,
  4067. sum: 10,
  4068. department: {
  4069. dept: value,
  4070. cascadeHosId: id
  4071. },
  4072. };
  4073. if (type == "start" && this.deptZyList["startStatus"] == 205) {
  4074. postData.department["type"] = { id: this.deptZyList["startTypeId"] };
  4075. } else if (type == "end" && this.deptZyList["endStatus"] == 205) {
  4076. postData.department["type"] = { id: this.deptZyList["endTypeId"] };
  4077. }
  4078. this.isLoading = true;
  4079. this.mainService
  4080. .getFetchDataList("data", "department", postData)
  4081. .subscribe((data) => {
  4082. this.isLoading = false;
  4083. if (data["status"] == 200) {
  4084. if (type === "start") {
  4085. this.deptZyList["startDept"] = data.list;
  4086. } else if (type === "end") {
  4087. this.deptZyList["endDept"] = data.list;
  4088. }
  4089. }
  4090. });
  4091. }
  4092. //搜索院区下面的科室(其他)
  4093. searchHosDepartmentQt(id, type, dept?) {
  4094. if (dept) {
  4095. this.searchHosDepartmentQtSubject.next([id, type, dept]);
  4096. } else {
  4097. this.searchHosDepartmentQtSubject.next([id, type]);
  4098. }
  4099. }
  4100. // 搜索院区下面的科室(其他)
  4101. getHosDepartmentQt(id, type, dept?) {
  4102. //id院区,type起点科室'start',终点科室'end'。科室名称dept。
  4103. let value = "";
  4104. if (dept) {
  4105. value = dept;
  4106. }
  4107. if (type === "start" && this.deptQtList["startStatus"] == 202) {
  4108. //固定科室范围,禁止搜索
  4109. this.mainService.getdeptList(this.psValue).subscribe((data:any) => {
  4110. let arr = data;
  4111. if(value!=''){
  4112. data = arr.startDept.filter(i=>i.dept.indexOf(value) !=-1)
  4113. this.deptQtList.startDept = data
  4114. }else{
  4115. this.deptQtList.startDept = arr.startDept
  4116. }
  4117. })
  4118. return;
  4119. } else if (type === "end" && this.deptQtList["endStatus"] == 202) {
  4120. //固定科室范围,禁止搜索
  4121. this.mainService.getdeptList(this.psValue).subscribe((data:any) => {
  4122. let arr = data;
  4123. if(value!=''){
  4124. data = arr.endDept.filter(i=>i.dept.indexOf(value) !=-1)
  4125. this.deptQtList.endDept = data
  4126. }else{
  4127. this.deptQtList.endDept = arr.endDept
  4128. }
  4129. })
  4130. return;
  4131. }
  4132. let postData = {
  4133. idx: 0,
  4134. sum: 10,
  4135. department: {
  4136. dept: value,
  4137. cascadeHosId: id
  4138. },
  4139. };
  4140. if (type == "start" && this.deptQtList["startStatus"] == 205) {
  4141. postData.department["type"] = { id: this.deptQtList["startTypeId"] };
  4142. } else if (type == "end" && this.deptQtList["endStatus"] == 205) {
  4143. postData.department["type"] = { id: this.deptQtList["endTypeId"] };
  4144. }
  4145. this.isLoading = true;
  4146. this.mainService
  4147. .getFetchDataList("data", "department", postData)
  4148. .subscribe((data) => {
  4149. this.isLoading = false;
  4150. if (data["status"] == 200) {
  4151. if (type === "start") {
  4152. this.deptQtList["startDept"] = data.list;
  4153. } else if (type === "end") {
  4154. this.deptQtList["endDept"] = data.list;
  4155. }
  4156. }
  4157. });
  4158. }
  4159. // 获取大于x,并且是n的倍数的数字
  4160. getLgNumber(x: number, n:number): number{
  4161. for(let i = x; i < 60; i++){
  4162. if(i % n === 0){
  4163. return i;
  4164. }
  4165. }
  4166. return 0;
  4167. }
  4168. // 禁用小时
  4169. disabledHours = (): number[] => {
  4170. let now = new Date();
  4171. let nHour = now.getHours();
  4172. let nMinute = now.getMinutes();
  4173. if (nMinute > (60 - this.inspectAndPatientTransportConfig.timeMod)) {
  4174. return range(0, nHour + 1);
  4175. } else {
  4176. return range(0, nHour);
  4177. }
  4178. }
  4179. // 禁用分钟
  4180. disabledMinutes = (hour: number): number[] => {
  4181. let now = new Date();
  4182. let nHour = now.getHours();
  4183. let nMinute = now.getMinutes();
  4184. if (hour === nHour || hour === undefined) {
  4185. return this.integralDivision(0, nMinute, this.inspectAndPatientTransportConfig.timeMod);
  4186. } else {
  4187. return [];
  4188. }
  4189. }
  4190. // start和end之间能被n整除的所有数字集合
  4191. integralDivision(start:number, end:number, n:number): number[]{
  4192. let arr = [];
  4193. for(let i = start; i <= end; i++){
  4194. if(i % n === 0){
  4195. arr.push(i);
  4196. }
  4197. }
  4198. return arr;
  4199. }
  4200. //修改预约建单时间的日期
  4201. yyDateChange(e) {
  4202. // 获取年月日
  4203. let yyDate = new Date(e);
  4204. let year = yyDate.getFullYear();
  4205. let month = yyDate.getMonth();
  4206. let date = yyDate.getDate();
  4207. // 获取当前时间的年月日
  4208. let now = new Date();
  4209. let nYear = now.getFullYear();
  4210. let nMonth = now.getMonth();
  4211. let nDate = now.getDate();
  4212. if (year != nYear || month != nMonth || date != nDate) {
  4213. this.disabledHours = () => [];
  4214. this.disabledMinutes = (hour) => [];
  4215. } else {
  4216. // 禁用小时
  4217. this.disabledHours = () => {
  4218. let now = new Date();
  4219. let nHour = now.getHours();
  4220. let nMinute = now.getMinutes();
  4221. if (nMinute > (60 - this.inspectAndPatientTransportConfig.timeMod)) {
  4222. return range(0, nHour + 1);
  4223. } else {
  4224. return range(0, nHour);
  4225. }
  4226. };
  4227. // 禁用分钟
  4228. this.disabledMinutes = (hour) => {
  4229. let now = new Date();
  4230. let nHour = now.getHours();
  4231. let nMinute = now.getMinutes();
  4232. if (hour === nHour || hour === undefined) {
  4233. return this.integralDivision(0, nMinute, this.inspectAndPatientTransportConfig.timeMod);
  4234. } else {
  4235. return [];
  4236. }
  4237. };
  4238. }
  4239. }
  4240. // 下一日(患者其他服务)
  4241. nextDayZy() {
  4242. this.yyDateZy = addDays(this.yyDateZy, 1);
  4243. this.yyDateChange(this.yyDateZy);
  4244. }
  4245. // 下一日(其他临床服务)
  4246. nextDay() {
  4247. this.yyDate = addDays(this.yyDate, 1);
  4248. this.yyDateChange(this.yyDate);
  4249. }
  4250. // 禁用日期(患者其他服务)
  4251. disabledyyDateZy = (current: Date): boolean => {
  4252. return differenceInCalendarDays(current, new Date()) < 0;
  4253. };
  4254. // 禁用日期(其他)
  4255. disabledyyDate = (current: Date): boolean => {
  4256. return differenceInCalendarDays(current, new Date()) < 0;
  4257. };
  4258. yyTimeZyChange(e) {
  4259. if (this.yyTimeZy) {
  4260. let now = new Date();
  4261. // 禁用日期(转运)
  4262. if (getHours(this.yyTimeZy) < getHours(now)) {
  4263. this.disabledyyDateZy = (current: Date): boolean => {
  4264. return differenceInCalendarDays(current, new Date()) < 1;
  4265. };
  4266. } else {
  4267. this.disabledyyDateZy = (current: Date): boolean => {
  4268. return differenceInCalendarDays(current, new Date()) < 0;
  4269. };
  4270. }
  4271. let end = this.getLgNumber(getMinutes(this.yyTimeZy), this.inspectAndPatientTransportConfig.timeMod);
  4272. this.yyTimeZy = setMinutes(this.yyTimeZy, end);
  4273. }
  4274. this.clickYYZyFlag = false;
  4275. }
  4276. yyTimeChange(e) {
  4277. if (this.yyTime) {
  4278. let now = new Date();
  4279. // 禁用日期(其他)
  4280. if (getHours(this.yyTime) < getHours(now)) {
  4281. this.disabledyyDate = (current: Date): boolean => {
  4282. return differenceInCalendarDays(current, new Date()) < 1;
  4283. };
  4284. } else {
  4285. this.disabledyyDate = (current: Date): boolean => {
  4286. return differenceInCalendarDays(current, new Date()) < 0;
  4287. };
  4288. }
  4289. let end = this.getLgNumber(getMinutes(this.yyTime), this.inspectAndPatientTransportConfig.timeMod);
  4290. this.yyTime = setMinutes(this.yyTime, end);
  4291. }
  4292. this.clickYYFlag = false;
  4293. }
  4294. // 需要预约建单-事件
  4295. yyInspectChange(e) {
  4296. if (this.currentTasktype.associationType.value === "other") {
  4297. //其他临床服务
  4298. this.yyTime = null;
  4299. this.yyDate = new Date();
  4300. console.log(this.isYyInspect);
  4301. } else if (this.currentTasktype.associationType.value === "patientTransport") {
  4302. //患者其他服务
  4303. this.yyTimeZy = null;
  4304. this.yyDateZy = new Date();
  4305. }else if (this.currentTasktype.associationType.value === "inspect") {
  4306. //陪检
  4307. let obj = this.filterLinkCheckLis.find((item) => {
  4308. return (parse(item.yyTime, 'yyyy-MM-dd HH:mm:ss', new Date()).getTime() - new Date().getTime() > 0);
  4309. });
  4310. if (obj) {
  4311. this.showDateTime();
  4312. } else {
  4313. this.yyTimeZy = null;
  4314. this.yyDateZy = new Date();
  4315. console.log(this.isYyInspect);
  4316. }
  4317. }
  4318. }
  4319. //回显时间日期
  4320. showDateTime() {
  4321. //当前时间要大于生效时间
  4322. let isYyInspect = this.filterLinkCheckLis.every((item) => {
  4323. return (parse(item.yyTime, 'yyyy-MM-dd HH:mm:ss', new Date()).getTime() - new Date().getTime() > 0);
  4324. });
  4325. //如果勾选需要预约检查
  4326. if (isYyInspect) {
  4327. //筛选离当前时间最近的
  4328. let timeList = this.filterLinkCheckLis
  4329. .map((item) => parse(item.yyTime, 'yyyy-MM-dd HH:mm:ss', new Date()).getTime())
  4330. .sort();
  4331. this.yyTimeZy = new Date(timeList[0] - 0); //回显预约时间,需要减去生效时间
  4332. this.yyDateZy = new Date(timeList[0] - 0); //回显预约日期,需要减去生效时间
  4333. this.yyDateChange(this.yyTimeZy);
  4334. } else {
  4335. this.yyTimeZy = null;
  4336. this.yyDateZy = null;
  4337. }
  4338. }
  4339. // 患者送检检查项目-选择检查项目
  4340. linkCheckLisTrue = false; //是否有已选择(患者)
  4341. filterLinkCheckLis = []; //有预约时间并且选中的
  4342. isInspects = false; //勾选检车的时候是否多个检查多个检查科室
  4343. linkCheckLisChange(e) {
  4344. let flag = false; //检查是否紧急
  4345. let arr = []; //选中的索引
  4346. // 是否检查生成工单允许多个科室,1是,0否
  4347. if (this.currentTasktype.isMoreDept === 0) {
  4348. let arr = e.map((item) => item.execDeptId);
  4349. arr = Array.from(new Set(arr));
  4350. this.isInspects = arr.length > 1;
  4351. }
  4352. this.linkCheckLis.forEach((item, index) => {
  4353. if (e.length) {
  4354. //有选中的检查
  4355. e.forEach((v) => {
  4356. //检查是否有紧急度
  4357. if (v.priority == 1) {
  4358. flag = true;
  4359. }
  4360. //选中的检查设置checked
  4361. if (v.value == item.value) {
  4362. arr.push(index);
  4363. }
  4364. });
  4365. } else {
  4366. item.checked = false;
  4367. }
  4368. });
  4369. this.linkCheckLis.forEach((item, index) => {
  4370. item.checked = arr.includes(index);
  4371. });
  4372. console.log(e, this.linkCheckLis);
  4373. this.clickYYFlag = false;
  4374. // 有预约时间并且选中的
  4375. this.filterLinkCheckLis = this.linkCheckLis.filter(
  4376. (item) => Boolean(item.yyTime) && item.checked
  4377. );
  4378. //有预约时间并且选中的检查数组不为空
  4379. if (this.filterLinkCheckLis.length) {
  4380. //当前时间要大于生效时间
  4381. this.isYyInspect = this.filterLinkCheckLis.every((item) => {
  4382. return (parse(item.yyTime, 'yyyy-MM-dd HH:mm:ss', new Date()).getTime() - new Date().getTime() > 0);
  4383. });
  4384. //不加急状态下,回显时间
  4385. this.showDateTime();
  4386. } else {
  4387. //有预约时间并且选中的检查数组为空
  4388. this.isYyInspect = false;
  4389. this.yyTimeZy = null;
  4390. this.yyDateZy = null;
  4391. }
  4392. this.linkCheckLisTrue = e.length > 0;
  4393. }
  4394. // 转运类型选中类型(单选)触发
  4395. goodsNow; //携带的物品列表
  4396. yyDateZy = null; //预约日期-患者其他服务
  4397. yyDate = null; //预约日期-其他临床服务
  4398. yyTimeZy = null; //预约时间-患者其他服务
  4399. yyTime = null; //预约时间-其他临床服务
  4400. inspectAndPatientTransportConfig:any = {timeMod: 30};
  4401. isYyInspect = false; //需要预约检查
  4402. clickYYZyFlag = false; //是否点击预约建单-患者其他服务
  4403. clickYYFlag = false; //是否点击预约建单-其他临床服务
  4404. currentTasktype = null; //当前选中的任务类型对象
  4405. isTaskTypeInspect:boolean = false;//是否是患者陪检
  4406. linkCheckLis:any[] = [];//检查列表
  4407. tabIndex;
  4408. isStartFixedType:boolean = false;
  4409. isEndFixedType:boolean = false;
  4410. radioChangeZy(value, index) {
  4411. this.radioValueZyPre = this.radioValueZy;
  4412. this.radioValueZy = value;
  4413. this.tabIndex = index;
  4414. //任务类型id
  4415. if (value === "" || value === null) {
  4416. return;
  4417. }
  4418. this.linkCheckLisTrue = false;
  4419. this.startDeptZy = null;
  4420. this.endDeptZy = null;
  4421. // 患者陪检-则参数增加patientCode
  4422. console.log(this.workTypesArrange[index].value);
  4423. let taskType = this.workTypesArrange[index].value.find(v => v.id == value);
  4424. let patientCode;
  4425. if(taskType.associationTypeValue === 'inspect'){
  4426. patientCode = this.patientZy;
  4427. this.requiredConfigChange('validateFormZy', 'startDept', false);
  4428. this.requiredConfigChange('validateFormZy', 'endDepts', false);
  4429. this.isTaskTypeInspect = true;
  4430. }else{
  4431. patientCode = undefined;
  4432. this.requiredConfigChange('validateFormZy', 'startDept', true);
  4433. this.requiredConfigChange('validateFormZy', 'endDepts', true);
  4434. this.isTaskTypeInspect = false;
  4435. }
  4436. // 返回值的status是201 则是默认发起科室,把申请科室作为值
  4437. // 返回值的status是202 则是固定科室范围,会返回科室列表
  4438. // 返回值的status是203 则是固定科室,会返回单个科室
  4439. // 返回值的status是204 则让前端自己调用科室搜索接口
  4440. // 返回值的status是205 则是固定科室类型,会返回科室列表
  4441. // 返回值的status是206 则是默认患者所在科室,把患者所在科室作为值
  4442. this.mainService.getdeptList(value, patientCode, (taskType.associationTypeValue === 'inspect' ? format(startOfDay(this.inspectToday), 'yyyy-MM-dd HH:mm:ss') : undefined), (taskType.associationTypeValue === 'inspect' ? format(endOfDay(this.inspectToday), 'yyyy-MM-dd HH:mm:ss') : undefined)).subscribe((data:any) => {
  4443. this.deptZyList = data;
  4444. if(data.startStatus==202 || data.startStatus==204 || data.startStatus==205){
  4445. this.isStartFixedType = true
  4446. }else{
  4447. this.isStartFixedType = false
  4448. }
  4449. if(data.endStatus==202 || data.endStatus==204 || data.endStatus==205){
  4450. this.isEndFixedType = true
  4451. }else{
  4452. this.isEndFixedType = false
  4453. }
  4454. // 预约start
  4455. this.currentTasktype = data.taskType;
  4456. this.isYyInspect = false;
  4457. this.clickYYZyFlag = false;
  4458. this.yyDateZy = new Date();
  4459. this.yyTimeZy = null;
  4460. // 预约end
  4461. console.log(this.deptZyList);
  4462. // 如果是患者陪检,则没有起点科室,终点科室
  4463. if(taskType.associationTypeValue === 'inspect'){
  4464. this.linkCheckLis = [];
  4465. if (data.data && Array.isArray(data.data.data) && data.data.data.length) {
  4466. let arr = [];
  4467. data.data.data.forEach((e) => {
  4468. arr.push({
  4469. execDeptId: e.execDept.id,
  4470. yyTime: e.yyTime,
  4471. priority: e.priority,
  4472. label: (e.yyTime || "") + " " + e.execDept.dept + " 进行 " + (e.inspectName || "检查"),
  4473. value: e["id"],
  4474. checked: false,
  4475. });
  4476. });
  4477. this.linkCheckLis = arr;
  4478. }
  4479. return;
  4480. }
  4481. // 起点科室
  4482. if (data["startStatus"] == 201 || data["startStatus"] == 206) {
  4483. if (this.applyDept) {
  4484. //选择了申请科室,则起点科室就是申请科室
  4485. this.deptZyList["startDept"] = this.applicationDepartmentList.filter(
  4486. (item) => item.id == this.applyDept
  4487. );
  4488. this.startDeptZy = this.applyDept;
  4489. }
  4490. } else if (data["startStatus"] == 203) {
  4491. this.startDeptZy = data["startDept"][0]["id"];
  4492. } else if (data["startStatus"] == 204 || data["startStatus"] == 205) {
  4493. this.getHosDepartment(this.checkedHos, "start", "");
  4494. }
  4495. // 终点科室
  4496. if (data["endStatus"] == 201 || data["endStatus"] == 206) {
  4497. if (this.applyDept) {
  4498. //选择了申请科室,则终点科室就是申请科室
  4499. this.deptZyList["endDept"] = this.applicationDepartmentList.filter(
  4500. (item) => item.id == this.applyDept
  4501. );
  4502. this.endDeptZy = this.applyDept;
  4503. }
  4504. } else if (data["endStatus"] == 203) {
  4505. this.endDeptZy = data["endDept"][0]["id"];
  4506. } else if (data["endStatus"] == 204 || data["endStatus"] == 205) {
  4507. this.getHosDepartment(this.checkedHos, "end", "");
  4508. }
  4509. if (this.currentTabIndex == "患者转运") {
  4510. // 终点科室患者信息列表,id是送病人回病房的任务类型
  4511. if (this.endDeptZy && this.radioValueZy == this.deathTasktypeId) {
  4512. //获取患者信息
  4513. this.patientZy = null;
  4514. this.getPatientList(this.endDeptZy, "");
  4515. } else if(this.applyDept && this.radioValueZyPre == this.deathTasktypeId) {
  4516. //获取患者信息
  4517. this.patientZy = null;
  4518. this.getPatientList(this.applyDept, "");
  4519. }
  4520. }
  4521. });
  4522. setTimeout(() => {
  4523. // 获取携带设备
  4524. let arrObj = this.workTypesArrange.find(v => v.key === this.currentTabIndex);
  4525. let arr = arrObj.value;
  4526. this.goodsNow = arr.filter(
  4527. (item) => item.id == value
  4528. )[0].taskType.carryEquipmentIds;
  4529. if (this.goodsNow) {
  4530. this.goodsNow = this.goodsNow.map((item) => {
  4531. return {
  4532. label: item.name,
  4533. value: item.id,
  4534. checked: false,
  4535. };
  4536. });
  4537. } else {
  4538. this.goodsNow = [];
  4539. }
  4540. }, 0)
  4541. }
  4542. psValue:any;
  4543. radioChangeQt(value) {
  4544. //任务类型id
  4545. if (value === "" || value === null) {
  4546. return;
  4547. }
  4548. this.psValue = value
  4549. this.startDeptQt = null;
  4550. this.endDeptQt = null;
  4551. // 返回值的status是201 则是默认发起科室,把申请科室作为值
  4552. // 返回值的status是202 则是固定科室范围,会返回科室列表
  4553. // 返回值的status是203 则是固定科室,会返回单个科室
  4554. // 返回值的status是204 则让前端自己调用科室搜索接口
  4555. // 返回值的status是205 则是固定科室类型,会返回科室列表
  4556. this.mainService.getdeptList(value).subscribe((data:any) => {
  4557. this.deptQtList = data;
  4558. if(data.startStatus==202 || data.startStatus==204 || data.startStatus==205){
  4559. this.isStartFixedType = true
  4560. }else{
  4561. this.isStartFixedType = false
  4562. }
  4563. if(data.endStatus==202 || data.endStatus==204 || data.endStatus==205){
  4564. this.isEndFixedType = true
  4565. }else{
  4566. this.isEndFixedType = false
  4567. }
  4568. // 预约start
  4569. this.currentTasktype = data.taskType;
  4570. this.isYyInspect = false;
  4571. this.clickYYFlag = false;
  4572. this.yyDate = new Date();
  4573. this.yyTime = null;
  4574. // 预约end
  4575. this.deptQtList.taskType.customRemarks = this.deptQtList.taskType.customRemarks ? this.deptQtList.taskType.customRemarks.split("$") : [];
  4576. // 起点科室
  4577. if (data["startStatus"] == 201) {
  4578. if (this.applyDept) {
  4579. //选择了申请科室,则起点科室就是申请科室
  4580. this.deptQtList["startDept"] = this.applicationDepartmentList.filter(
  4581. (item) => item.id == this.applyDept
  4582. );
  4583. this.startDeptQt = this.applyDept;
  4584. }
  4585. } else if (data["startStatus"] == 203) {
  4586. this.startDeptQt = data["startDept"][0]["id"];
  4587. } else if (data["startStatus"] == 204 || data["startStatus"] == 205) {
  4588. this.getHosDepartmentQt(this.checkedHos, "start", "");
  4589. }
  4590. // 终点科室
  4591. if (data["endStatus"] == 201) {
  4592. if (this.applyDept) {
  4593. //选择了申请科室,则终点科室就是申请科室
  4594. this.deptQtList["endDept"] = this.applicationDepartmentList.filter(
  4595. (item) => item.id == this.applyDept
  4596. );
  4597. this.endDeptQt = this.applyDept;
  4598. }
  4599. } else if (data["endStatus"] == 203) {
  4600. this.endDeptQt = data["endDept"][0]["id"];
  4601. } else if (data["endStatus"] == 204 || data["endStatus"] == 205) {
  4602. this.getHosDepartmentQt(this.checkedHos, "end", "");
  4603. }
  4604. });
  4605. }
  4606. //新建工单->确定提交
  4607. isGoLoading = false;
  4608. newOrderOk(go?): void {
  4609. console.log(this.radioValueQt);
  4610. let arr = this.workTypesArrange.find(v => v.key === this.currentTabIndex);
  4611. let objQt = arr.value.find(v => v.id == this.radioValueQt);
  4612. let objZy = arr.value.find(v => v.id == this.radioValueZy);
  4613. if (this.isYyInspect && objQt && objQt.associationTypeValue === 'other') {
  4614. this.clickYYFlag = true;
  4615. } else {
  4616. this.clickYYFlag = false;
  4617. }
  4618. if (this.isYyInspect && objZy && (objZy.associationTypeValue === 'patientTransport' || objZy.associationTypeValue === 'inspect')) {
  4619. this.clickYYZyFlag = true;
  4620. } else {
  4621. this.clickYYZyFlag = false;
  4622. }
  4623. if (
  4624. (!this.yyTime && objQt && objQt.associationTypeValue === 'other' && this.isYyInspect) ||
  4625. (!this.yyTimeZy && objZy && (objZy.associationTypeValue === 'patientTransport' || objZy.associationTypeValue === 'inspect') && this.isYyInspect)
  4626. ) {
  4627. return;
  4628. }
  4629. if (go !== "&go&") {
  4630. this.isOkLoading = true;
  4631. } else {
  4632. this.isGoLoading = true;
  4633. }
  4634. if (objZy && objZy.associationTypeValue === 'patientTransport') {
  4635. //患者转运
  4636. go === "&go&" ? this.submitFormZy(go) : this.submitFormZy();
  4637. }if (objZy && objZy.associationTypeValue === 'inspect') {
  4638. //患者陪检
  4639. go === "&go&" ? this.submitFormInspect(go) : this.submitFormInspect();
  4640. } else if (objQt && objQt.associationTypeValue === 'specimen') {
  4641. //标本配送
  4642. go === "&go&" ? this.submitFormBbps(go) : this.submitFormBbps();
  4643. } else if (objQt && objQt.associationTypeValue === 'other') {
  4644. //其他配送
  4645. go === "&go&" ? this.submitFormQt(go) : this.submitFormQt();
  4646. } else if (objQt && objQt.associationTypeValue === 'ordinary') {
  4647. //万能交接
  4648. go === "&go&" ? this.submitFormOrdinary(go) : this.submitFormOrdinary();
  4649. }
  4650. }
  4651. nucleicAcidPrintingCancel():void {
  4652. this.fixedTab = '';
  4653. }
  4654. // 取消
  4655. newOrderCancel(): void {
  4656. if(this.incomingService.getSign() === 'callCenter' && this.incomingService.getPhoneNumber()){
  4657. this.jry_shixian();
  4658. }
  4659. this.newOrderShow = false;
  4660. this.newOrderShowOpen = false;
  4661. this.currentTabIndex = "";
  4662. this.fixedTab = "";
  4663. this.fixedMenuShangla();
  4664. this.radioValueQt = null;
  4665. this.startDeptQt = null;
  4666. this.endDeptQt = null;
  4667. this.radioValueZy = null;
  4668. this.radioValueZyPre = null;
  4669. this.startDeptZy = null;
  4670. this.endDeptZy = null;
  4671. this.patientZy = null;
  4672. this.goodsNow = [];
  4673. this.patientList = [];
  4674. this.workOrderRemark = "";
  4675. this.workOrderRemarkZy = "";
  4676. this.deptZyList["startDept"] = [];
  4677. this.deptZyList["endDept"] = [];
  4678. this.deptZyList["startStatus"] = 0;
  4679. this.deptZyList["endStatus"] = 0;
  4680. this.deptQtList["startDept"] = [];
  4681. this.deptQtList["endDept"] = [];
  4682. this.deptQtList["startStatus"] = 0;
  4683. this.deptQtList["endStatus"] = 0;
  4684. }
  4685. // 携带设备
  4686. changeGoods(value: object[]): void {
  4687. console.log(value);
  4688. }
  4689. // 撤回
  4690. // 打开撤回模态框
  4691. openRecallModal(id) {
  4692. this.coopId = id;
  4693. this.recallOrderShow = true;
  4694. }
  4695. // 确认撤回
  4696. confirmRec() {
  4697. let that = this;
  4698. that.btnLoading = true;
  4699. let postData: any = {};
  4700. let flags = "";
  4701. this.coopId = this.coopId + "";
  4702. if (this.coopId.includes("-")) {
  4703. //批量
  4704. flags = "batchExcuteWorkOrder";
  4705. let ids = this.coopId.split("-");
  4706. postData.workOrders = [];
  4707. ids.forEach((item) => {
  4708. postData.workOrders.push({ id: item, type: "recall" });
  4709. });
  4710. } else {
  4711. flags = "excuteWorkOrder/recall";
  4712. postData = {
  4713. workOrder: {
  4714. id: this.coopId,
  4715. },
  4716. };
  4717. }
  4718. that.mainService.coopWorkerOrder(flags, postData).subscribe((data) => {
  4719. that.btnLoading = false;
  4720. that.closeRecallOrderModal();
  4721. if (data.status == 200) {
  4722. that.showPromptModal("撤回", true, "");
  4723. } else {
  4724. that.showPromptModal("撤回", false, data.msg);
  4725. }
  4726. });
  4727. }
  4728. // 撤回并删除
  4729. recAndDel() {
  4730. let that = this;
  4731. that.recDelLoading = true;
  4732. that.mainService.delOrder(that.coopId).subscribe((data) => {
  4733. that.recDelLoading = false;
  4734. console.log(data);
  4735. that.closeRecallOrderModal();
  4736. if (data.status == 200) {
  4737. that.showPromptModal("删除", true, "");
  4738. } else {
  4739. that.showPromptModal("删除", false, data.msg);
  4740. }
  4741. });
  4742. }
  4743. // 关闭撤回模态框
  4744. closeRecallOrderModal() {
  4745. this.recallOrderShow = false;
  4746. this.batchClickType1 = false;
  4747. }
  4748. // 删除
  4749. // 打开模态框
  4750. coopId; //当前操作id
  4751. coopType;
  4752. openDelModal(id, type) {
  4753. this.coopId = id;
  4754. this.coopType = type;
  4755. this.delOrderShow = true;
  4756. }
  4757. // 确认删除
  4758. confirmDel() {
  4759. let that = this;
  4760. that.btnLoading = true;
  4761. if(this.coopType === 'hsms'){
  4762. that.mainService.delOrder(that.coopId).subscribe((data) => {
  4763. that.btnLoading = false;
  4764. console.log(data);
  4765. that.closeDelOrderModal();
  4766. if (data.status == 200) {
  4767. that.showPromptModal("删除", true, "");
  4768. } else {
  4769. that.showPromptModal("删除", false, data.msg);
  4770. }
  4771. });
  4772. }else if(this.coopType === 'itsm'){
  4773. that.mainService.simplePost("rmvData", "incident", [this.coopId]).subscribe((data) => {
  4774. that.btnLoading = false;
  4775. console.log(data);
  4776. that.closeDelOrderModal();
  4777. if (data.status == 200) {
  4778. that.showPromptModal("删除", true, "");
  4779. } else {
  4780. that.showPromptModal("删除", false, data.msg);
  4781. }
  4782. });
  4783. }
  4784. }
  4785. // 关闭模态框
  4786. closeDelOrderModal() {
  4787. this.delOrderShow = false;
  4788. }
  4789. // 新建工单
  4790. // 提交选择转入科室的模态框
  4791. submitFormHand(id) {
  4792. // 有转入科室
  4793. this.createLoading = true;
  4794. let postData = {
  4795. workOrder: {
  4796. sourceId: SourceId.fuwutai,
  4797. taskType: {
  4798. id: this.deathTasktypeIdPatient, //转科
  4799. },
  4800. startDept: {
  4801. //起点科室
  4802. id: this.createOrderObj.sqDept.id,
  4803. },
  4804. createDept: this.applyDept, //申请科室
  4805. endDepts: [
  4806. //终点科室
  4807. {
  4808. id: id,
  4809. },
  4810. ],
  4811. patient: {
  4812. patientCode: this.createOrderObj.patient.patientCode,
  4813. },
  4814. },
  4815. };
  4816. this.mainService.buildOrder(postData).subscribe((result) => {
  4817. this.createLoading = false;
  4818. this.deptFlag = false;
  4819. if (result["status"] == 200) {
  4820. this.showPromptModal("建单", true, "");
  4821. } else {
  4822. this.showPromptModal("建单", false, result["msg"]);
  4823. }
  4824. });
  4825. }
  4826. // 隐藏选择转入科室的模态框
  4827. deptFlagHand(e) {
  4828. this.deptFlag = false;
  4829. }
  4830. // 打开模态框,服务台右侧转入院记录建单
  4831. createOrderObj; //当前操作id
  4832. createLoading = false;
  4833. deptFlag = false;
  4834. patientLogBuild(obj) {
  4835. this.createOrderObj = obj;
  4836. this.deptFlag = true;
  4837. }
  4838. // 初始化展示形式
  4839. controlView:any = {}; //展示形式
  4840. initControlView() {
  4841. let postData = {
  4842. controlView: {},
  4843. idx: 0,
  4844. sum: 1,
  4845. };
  4846. this.mainService
  4847. .coopTypeConfig("fetchDataList", "controlView", postData)
  4848. .subscribe((data) => {
  4849. this.controlView = data.list[0] ? data.list[0] : {
  4850. hurseInfoHiding: 1,
  4851. orderInfoTime: 60,
  4852. workerInfoTime: 60,
  4853. unsendOrderVoice: true,
  4854. orderType: 'priority',
  4855. };
  4856. this.patientCareCol = 7;
  4857. this.hurseInfoHiding = this.controlView.hurseInfoHiding ? 1 : 0;
  4858. this.txtLabelCol = 1;
  4859. this.orderRefreshTime = this.orderInfoTime = this.controlView.orderInfoTime;
  4860. this.workerRefreshTime = this.workerInfoTime = this.controlView.workerInfoTime;
  4861. this.audioNotDispatched = this.controlView.unsendOrderVoice !== false;
  4862. this.orderType = this.controlView.orderType || 'priority';
  4863. this.checkTab(this.typeId);
  4864. this.getOrderList(1);
  4865. this.getOrderList(2);
  4866. this.getOrderList(3);
  4867. });
  4868. }
  4869. // 保存展现形式
  4870. saveControlView() {
  4871. let that = this;
  4872. that.saveLoading = true;
  4873. let wn;
  4874. switch (that.patientCareCol) {
  4875. case 6:
  4876. wn = 1;
  4877. break;
  4878. case 7:
  4879. wn = 2;
  4880. break;
  4881. case 4:
  4882. wn = 3;
  4883. break;
  4884. }
  4885. let postData = {
  4886. controlView: {
  4887. workerNum: wn,
  4888. labelNum: that.txtLabelCol,
  4889. workerInfoTime: that.workerInfoTime,
  4890. orderInfoTime: that.orderInfoTime,
  4891. unsendOrderVoice: that.audioNotDispatched,
  4892. hurseInfoHiding: that.hurseInfoHiding === 1,
  4893. orderType: this.orderType,
  4894. },
  4895. };
  4896. if (that.controlView["id"]) {
  4897. postData.controlView["id"] = that.controlView["id"];
  4898. }
  4899. console.log(postData);
  4900. that.mainService
  4901. .coopTypeConfig("addData", "controlView", postData)
  4902. .subscribe((data) => {
  4903. that.saveLoading = false;
  4904. if (data.status == 200) {
  4905. that.msg.success('排序成功');
  4906. this.initControlView();
  4907. } else {
  4908. that.msg.error(data.msg || '排序失败');
  4909. }
  4910. });
  4911. }
  4912. closeModel(e) {
  4913. if (e === "close") {
  4914. this.newOrderShowOpen = false; //此时可出现新的弹窗
  4915. } else if (e === "closeGo") {
  4916. this.showNewOrder("&go&");
  4917. }
  4918. }
  4919. // 展示信息提示框(con:提示信息,success:操作是否成功,promptInfo:操作结果提示信息)(con:提示信息,success:操作是否成功,promptInfo:操作结果提示信息)
  4920. showPromptModal(con, success, promptInfo?, back?) {
  4921. this.promptModalShow = false;
  4922. this.promptContent = con;
  4923. this.ifSuccess = success;
  4924. this.promptInfo = promptInfo;
  4925. this.back = back || "";
  4926. setTimeout(() => {
  4927. this.showPromptModalRefresh();
  4928. this.promptModalShow = true;
  4929. }, 100);
  4930. }
  4931. showPromptModalRefresh(){
  4932. this.getUnassignedBuilding2();
  4933. this.resetList();
  4934. this.getOrderList(1);
  4935. this.getOrderList(2);
  4936. this.getOrderList(3);
  4937. this.getVisitList();
  4938. this.getMessageList();
  4939. if (this.currentRTab === 0) {
  4940. this.getWorkOrders(this.applyDept);
  4941. } else if (this.currentRTab === 1) {
  4942. this.getPatientLog(this.applyDept);
  4943. } else if (this.currentRTab === 2) {
  4944. this.getItsmOrders(this.incidentModel.department);
  4945. } else if (this.currentRTab === 3) {
  4946. this.getDictionaryList();
  4947. }
  4948. this.fixedTab = "";
  4949. this.fixedMenuShangla();
  4950. }
  4951. // 格式化时分秒
  4952. // (时间小于一分钟则显示秒,时间大于一分钟则显示分钟数,如超出一小时则显示小时和分钟。)time: 秒
  4953. formatTime(time) {
  4954. let timeStr = "";
  4955. if (time >= 0 && time < 60) {
  4956. // 秒
  4957. timeStr = time + "秒";
  4958. } else if (time >= 60 && time < 3600) {
  4959. // 分钟
  4960. timeStr = Math.floor(time / 60) + "分钟";
  4961. } else if (time >= 3600) {
  4962. // 时 + 分
  4963. let h = "";
  4964. let m = "";
  4965. h = Math.floor(time / 3600) + "小时";
  4966. m = time % 3600 >= 60 ? Math.floor((time % 3600) / 60) + "分钟" : "";
  4967. timeStr = h + m;
  4968. }
  4969. return timeStr;
  4970. }
  4971. // 菜单拖拽-上下
  4972. moveMenu(nodeId) {
  4973. let fixedMenu = document.getElementById(nodeId);
  4974. if (!fixedMenu) return;
  4975. fixedMenu.onmousedown = function (e) {
  4976. fixedMenu.classList.remove('maskFull');
  4977. let y = e.clientY - fixedMenu.offsetTop;
  4978. document.onmousemove = function (ev) {
  4979. fixedMenu.classList.add('maskFull');
  4980. var _y = ev.clientY - y > 0 ? ev.clientY - y : 0;
  4981. var wh = window.innerHeight;
  4982. if (_y > wh - fixedMenu.clientHeight) {
  4983. _y = wh - fixedMenu.clientHeight;
  4984. }
  4985. fixedMenu.style.top = _y + "px";
  4986. };
  4987. document.onmouseup = function () {
  4988. fixedMenu.classList.remove('maskFull');
  4989. document.onmousemove = null;
  4990. document.onmouseup = null;
  4991. };
  4992. };
  4993. }
  4994. // 处理人+协同人
  4995. transferSynergetic(incidentData){
  4996. let str = incidentData.groupORHandlerUser || "";
  4997. if(incidentData.synergetic && incidentData.synergetic.length){
  4998. str += ',' + incidentData.synergetic.map(v => v.name).join(',');
  4999. }
  5000. return str;
  5001. }
  5002. // 菜单拖拽-自由
  5003. moveMenuAll(nodeId) {
  5004. let fixedMenu = document.getElementById(nodeId);
  5005. if (!fixedMenu) return;
  5006. fixedMenu.onmousedown = function (e) {
  5007. fixedMenu.classList.remove('maskFull');
  5008. let x = e.clientX - fixedMenu.offsetLeft;
  5009. let y = e.clientY - fixedMenu.offsetTop;
  5010. document.onmousemove = function (ev) {
  5011. fixedMenu.classList.add('maskFull');
  5012. var _y = ev.clientY - y > 0 ? ev.clientY - y : 0;
  5013. var h = window.innerHeight;
  5014. if (_y > h - fixedMenu.clientHeight) {
  5015. _y = h - fixedMenu.clientHeight;
  5016. }
  5017. fixedMenu.style.top = _y + "px";
  5018. var _x = ev.clientX - x > 0 ? ev.clientX - x : 0;
  5019. var w = window.innerWidth;
  5020. if (_x > w - fixedMenu.clientWidth) {
  5021. _x = w - fixedMenu.clientWidth;
  5022. }
  5023. fixedMenu.style.right = w - _x - fixedMenu.clientWidth + "px";
  5024. };
  5025. document.onmouseup = function () {
  5026. fixedMenu.classList.remove('maskFull');
  5027. document.onmousemove = null;
  5028. document.onmouseup = null;
  5029. };
  5030. };
  5031. }
  5032. @ViewChild("msgTemplate", { static: false }) msgTemplate: TemplateRef<any>; //消息通知模板
  5033. // 消息提醒
  5034. createBasicNotification(msgs): void {
  5035. this.notification.template(this.msgTemplate, {
  5036. nzDuration: 0,
  5037. nzData: msgs,
  5038. });
  5039. }
  5040. // tab头部分组向左移动
  5041. disXHead = 0;
  5042. headToLeft() {
  5043. let num = Math.floor(this.tabs.nativeElement.offsetWidth / 126);
  5044. let maxStep = this.scopeGroups.length - (num - 1);
  5045. this.disStep = Math.max(-maxStep, --this.disStep);
  5046. this.disXHead = this.disStep * 126;
  5047. }
  5048. // tab头部分组向右移动
  5049. headToRight() {
  5050. this.disStep = Math.min(0, ++this.disStep);
  5051. this.disXHead = this.disStep * 126;
  5052. }
  5053. //服务台建单任务类型搜索查询
  5054. onSearchTaskBuild(e) {
  5055. this.onSearchTaskBuildSubject.next(e);
  5056. }
  5057. //获取任务类型
  5058. getTasktypeByPhone(e) {
  5059. this.getSearchTaskList(e).subscribe((result) => {
  5060. if (result.status == 200) {
  5061. this.searchTaskLoading = false;
  5062. this.searchTaskList = result.data;
  5063. this.searchTaskList.forEach((item) => {
  5064. item.sid = item.associationTypeId + "_" + item.id + "_" + item.associationTypeValue;
  5065. });
  5066. }
  5067. });
  5068. }
  5069. //服务台建单任务类型回车,0_1,0是关联类型,1是任务类型
  5070. changeTaskBuild(e) {
  5071. let arr = e.split("_");
  5072. if(arr[2] === 'other' || arr[2] === 'specimen' || arr[2] === 'ordinary'){
  5073. this.currentTabIndex = '物品配送';
  5074. }else if(arr[2] === 'patientTransport'){
  5075. this.currentTabIndex = '患者转运';
  5076. }
  5077. if (this.currentTabIndex == "患者转运") {
  5078. //患者其他服务业务
  5079. this.radioValueZy = +arr[1];
  5080. } else if (this.currentTabIndex == "物品配送") {
  5081. //其他临床服务
  5082. this.radioValueQt = +arr[1];
  5083. }
  5084. }
  5085. // 服务台建单输入住院号,查到有且仅有一个患者,则自动选中【患者转运】,自动带出【申请科室】,自动带出【患者信息】
  5086. changeResidenceNo(e){
  5087. console.log(e);
  5088. this.changeCommonInpSubject.next(['patient', e]);
  5089. }
  5090. // 运维、配送工单切换
  5091. filterOrderList(type, state){
  5092. if(!this.itsmData.mdv2Switch && this.hsmsData.hsmsSwitch){
  5093. return;
  5094. }
  5095. if(this.itsmData.mdv2Switch && !this.hsmsData.hsmsSwitch){
  5096. return;
  5097. }
  5098. this.flagList[`${type}Flag${state}`] = !this.flagList[`${type}Flag${state}`];
  5099. this.getOrderList(state, state === 1);
  5100. }
  5101. // 排序
  5102. orderType: string = 'priority'; //排序方式 priority:优先级,time:时间
  5103. orderList(){
  5104. this.orderType = this.orderType === 'priority' ? 'time' : 'priority';
  5105. this.saveControlView();
  5106. }
  5107. // 优先级颜色
  5108. priorityColor(priorityId) {
  5109. // 极低|低
  5110. if(priorityId == 1 || priorityId == 2){
  5111. return '';
  5112. } else if(priorityId == 3){
  5113. return 'yellow';
  5114. } else if(priorityId == 4 || priorityId == 5){
  5115. return 'red';
  5116. }
  5117. }
  5118. // 延期记录
  5119. transferHandlerLog = function (currentLog) {
  5120. if(!currentLog){
  5121. return '';
  5122. }
  5123. currentLog = cloneDeep(currentLog);
  5124. if(currentLog.extra1DTO && currentLog.extra2 && currentLog.startTime){
  5125. if(currentLog.extra2==0.5){
  5126. currentLog.extra2 = 4;
  5127. return currentLog.extra1DTO.name+"<br>"+ format(addHours(currentLog.startTime, +currentLog.extra2), "MM月dd日")+"<br>"+ format(addHours(currentLog.startTime, +currentLog.extra2), "HH时mm分前完成");
  5128. }else{
  5129. return currentLog.extra1DTO.name+"<br>"+ format(addDays(currentLog.startTime, +currentLog.extra2), "MM月dd日前完成");
  5130. }
  5131. }else{
  5132. return '';
  5133. }
  5134. }
  5135. // 生成工单
  5136. buildType;
  5137. editOrder;
  5138. generateOrder(data){
  5139. this.editOrder = cloneDeep(data);
  5140. let incidentModel = cloneDeep(data);
  5141. let incidentMsg:any = {};
  5142. console.log('data:', data)
  5143. // incidentModel.department && (this.applicationDeptList = [cloneDeep(incidentModel.department)]);
  5144. incidentModel.department && (incidentMsg.deptManyPhone = incidentModel.department.manyPhone);
  5145. incidentModel.department && (incidentMsg.deptName = incidentModel.department.dept);
  5146. incidentModel.department && (incidentModel.department = incidentModel.department.id);
  5147. incidentModel.requester && (this.applicationRequesterList = [cloneDeep(incidentModel.requester)]);
  5148. incidentModel.requester && (incidentMsg.requesterPhone = incidentModel.requester.phone);
  5149. incidentModel.requester && (incidentMsg.requesterName = incidentModel.requester.name);
  5150. incidentModel.requester && (incidentModel.requester = incidentModel.requester.id);
  5151. if(incidentModel.repairIncidentType){
  5152. incidentModel.repairIncidentType = incidentModel.repairIncidentType.value
  5153. this.changeRepairIncidentType(incidentModel.repairIncidentType);
  5154. }
  5155. incidentModel.source && (incidentModel.source = incidentModel.source.id);
  5156. incidentModel.area && (incidentModel.area = incidentModel.area.id);
  5157. incidentModel.place && (incidentModel.place = incidentModel.place.id);
  5158. incidentModel.category && (this.applicationCategoryList = [cloneDeep(incidentModel.category)]);
  5159. incidentModel.category && (incidentModel.category = incidentModel.category.id);
  5160. this.incidentModel = incidentModel;
  5161. this.incidentMsg = incidentMsg;
  5162. this.incidentModel.category && this.changeApplyCategory(this.incidentModel.category, true);
  5163. console.log('this.applicationDeptList:', this.applicationDeptList)
  5164. console.log('incidentModel:', incidentModel)
  5165. this.showNewOrder('', '', true, '报修转事件');
  5166. // 查询报修图片
  5167. this.getRepairImgs(data.id);
  5168. }
  5169. // 继续建单
  5170. storageSj(data){
  5171. this.editOrder = cloneDeep(data);
  5172. let incidentModel = cloneDeep(data);
  5173. let incidentMsg:any = {};
  5174. console.log('data:', data)
  5175. // incidentModel.department && (this.applicationDeptList = [cloneDeep(incidentModel.department)]);
  5176. incidentModel.department && (incidentMsg.deptManyPhone = incidentModel.department.manyPhone);
  5177. incidentModel.department && (incidentMsg.deptName = incidentModel.department.dept);
  5178. incidentModel.department && (incidentModel.department = incidentModel.department.id);
  5179. incidentModel.requester && (this.applicationRequesterList = [cloneDeep(incidentModel.requester)]);
  5180. incidentModel.requester && (incidentMsg.requesterPhone = incidentModel.requester.phone);
  5181. incidentModel.requester && (incidentMsg.requesterName = incidentModel.requester.name);
  5182. incidentModel.requester && (incidentModel.requester = incidentModel.requester.id);
  5183. if(incidentModel.repairIncidentType){
  5184. incidentModel.repairIncidentType = incidentModel.repairIncidentType.value
  5185. this.changeRepairIncidentType(incidentModel.repairIncidentType);
  5186. }
  5187. incidentModel.source && (incidentModel.source = incidentModel.source.id);
  5188. incidentModel.area && (incidentModel.area = incidentModel.area.id);
  5189. incidentModel.place && (incidentModel.place = incidentModel.place.id);
  5190. incidentModel.category && (this.applicationCategoryList = [cloneDeep(incidentModel.category)]);
  5191. incidentModel.category && (incidentModel.category = incidentModel.category.id);
  5192. this.incidentModel = incidentModel;
  5193. this.incidentMsg = incidentMsg;
  5194. console.log('this.applicationDeptList:', this.applicationDeptList)
  5195. console.log('incidentModel:', incidentModel)
  5196. this.showNewOrder('', '', true, '继续建单');
  5197. // 查询报修图片
  5198. this.getRepairImgs(data.id);
  5199. }
  5200. // 获取报修图片
  5201. repairImgs:any[] = [];//报修图片
  5202. getRepairImgs(incidentId) {
  5203. this.mainService
  5204. .getPreviewImage('wechatRequesterIncident', incidentId)
  5205. .subscribe((res:any) => {
  5206. res.data = res.data || [];
  5207. res.data.forEach(v => {
  5208. v.previewUrl = location.origin + "/file" + v.relativeFilePath;
  5209. v.thumbFilePath = location.origin + "/file" + v.thumbFilePath;
  5210. })
  5211. this.repairImgs = res.data;
  5212. });
  5213. }
  5214. // 预览图片
  5215. imgs = [];
  5216. isPreview = false;
  5217. initialViewIndex:number = 0;
  5218. previewImageHandler(data = [], index = 0) {
  5219. this.initialViewIndex = index;
  5220. console.log(index)
  5221. this.isPreview = false;
  5222. data = data || [];
  5223. this.imgs = data.map((v) => location.origin + '/file' + v.relativeFilePath);
  5224. setTimeout(() => {
  5225. this.isPreview = true;
  5226. }, 0)
  5227. }
  5228. // 不受理-弹窗
  5229. rejectModalShow = false; //弹窗开关
  5230. rejectFn(data) {
  5231. this.coopData = data;
  5232. this.rejectModalShow = true;
  5233. }
  5234. // 关闭弹窗
  5235. closeRejectModelOrder(e) {
  5236. this.rejectModalShow = JSON.parse(e).show;
  5237. }
  5238. // 弹窗确定
  5239. confirmRejectModelOrder(rejectRemark){
  5240. this.maskFlag = this.msg.loading("正在加载中..", {
  5241. nzDuration: 0,
  5242. }).messageId;
  5243. let postData = {
  5244. incident: {
  5245. ...this.coopData,
  5246. rejectRemark,
  5247. },
  5248. }
  5249. console.log(postData);
  5250. // return;
  5251. this.mainService
  5252. .flowPost("incident/task/reject", postData)
  5253. .subscribe((result) => {
  5254. this.msg.remove(this.maskFlag);
  5255. this.maskFlag = false;
  5256. if (result.state == 200) {
  5257. this.rejectModalShow = false;
  5258. this.showPromptModal("不受理", true, "", "");
  5259. } else {
  5260. this.msg.error(result.msg || '不受理失败');
  5261. }
  5262. });
  5263. }
  5264. // 编辑-弹窗
  5265. edit(data){
  5266. this.editOrder = cloneDeep(data);
  5267. let incidentModel = cloneDeep(data);
  5268. let incidentMsg:any = {};
  5269. console.log('data:', data)
  5270. incidentModel.department && (incidentMsg.deptManyPhone = incidentModel.department.manyPhone);
  5271. incidentModel.department && (incidentMsg.deptName = incidentModel.department.dept);
  5272. incidentModel.department && (incidentModel.department = incidentModel.department.id);
  5273. incidentModel.requester && (this.applicationRequesterList = [cloneDeep(incidentModel.requester)]);
  5274. incidentModel.requester && (incidentMsg.requesterPhone = incidentModel.requester.phone);
  5275. incidentModel.requester && (incidentMsg.requesterName = incidentModel.requester.name);
  5276. incidentModel.requester && (incidentModel.requester = incidentModel.requester.id);
  5277. if(incidentModel.repairIncidentType){
  5278. incidentModel.repairIncidentType = incidentModel.repairIncidentType.value
  5279. this.changeRepairIncidentType(incidentModel.repairIncidentType);
  5280. }
  5281. incidentModel.source && (incidentModel.source = incidentModel.source.id);
  5282. incidentModel.area && (incidentModel.area = incidentModel.area.id);
  5283. incidentModel.place && (incidentModel.place = incidentModel.place.id);
  5284. incidentModel.category && (this.applicationCategoryList = [cloneDeep(incidentModel.category)]);
  5285. incidentModel.category && (incidentModel.category = incidentModel.category.id);
  5286. this.incidentModel = incidentModel;
  5287. this.incidentMsg = incidentMsg;
  5288. console.log('this.applicationRequesterList:', this.applicationRequesterList)
  5289. console.log('this.applicationDeptList:', this.applicationDeptList)
  5290. console.log('incidentModel:', incidentModel)
  5291. this.showNewOrder('', '', true, '编辑事件');
  5292. // 查询报修图片
  5293. this.getRepairImgs(data.id);
  5294. }
  5295. // 换人处理-弹窗
  5296. substitutionModalShow = false; //弹窗开关
  5297. substitution(data) {
  5298. this.coopData = data;
  5299. this.substitutionModalShow = true;
  5300. }
  5301. // 关闭弹窗
  5302. closeSubstitutionModelOrder(e) {
  5303. this.substitutionModalShow = JSON.parse(e).show;
  5304. }
  5305. // 弹窗确定
  5306. confirmSubstitutionModelOrder(e){
  5307. console.log(e);
  5308. this.substitutionModalShow = false;
  5309. this.showPromptModalRefresh();
  5310. }
  5311. // 是否显示接单按钮
  5312. computedReceive(data){
  5313. let inUser = data.currentLog && data.currentLog.workerId == this.tool.getCurrentUserId();
  5314. let inGroup = false;
  5315. let groupList = this.tool.getCurrentGroupList();
  5316. groupList.forEach(item => {
  5317. if(data.currentLog){
  5318. if (item.id == data.currentLog.groupId) {
  5319. inGroup = true;
  5320. }
  5321. }
  5322. })
  5323. return data.state.value === 'pending' && (inUser || inGroup) && this.coopBtns.receive && data.deleteFlag !== 1;
  5324. }
  5325. // 是否显示换人处理按钮
  5326. computedSubstitution(data){
  5327. return (data.state.value === 'pending' || data.state.value === 'handler' || (data.state.value === 'reassign' && this.coopBtns.assign)) && data.deleteFlag !== 1;
  5328. }
  5329. // 是否显示编辑按钮
  5330. computedEdit(data){
  5331. return (data.state.value === 'pending' || data.state.value === 'reassign' || data.state.value === 'handler' || data.state.value === 'close') && this.coopBtns.edit && data.deleteFlag !== 1;
  5332. }
  5333. // 是否显示处理按钮
  5334. computedHandle(data){
  5335. return this.coopBtns.handle && data.state.value === 'handler' && data.handlingPersonnelUser && data.handlingPersonnelUser.id == this.tool.getCurrentUserId() && data.deleteFlag !== 1;
  5336. }
  5337. delModal: boolean = false; //删除模态框
  5338. tipsMsg1: string; //提示框信息
  5339. tipsMsg2: string; //操作后信息
  5340. confirmDelType: string; //确认的类型(启用/停用,删除)
  5341. showDelModal(
  5342. e,
  5343. data,
  5344. tipsMsg1: string,
  5345. tipsMsg2: string,
  5346. type: string,
  5347. ) {
  5348. e && e.stopPropagation();
  5349. this.confirmDelType = type;
  5350. this.delModal = true;
  5351. this.coopData = data;
  5352. this.tipsMsg1 = tipsMsg1;
  5353. this.tipsMsg2 = tipsMsg2;
  5354. }
  5355. // 隐藏删除框
  5356. hideDelModal() {
  5357. this.delModal = false;
  5358. }
  5359. // 确认删除
  5360. confirmDelFn() {
  5361. this.btnLoading = true;
  5362. if (this.confirmDelType === "del") {
  5363. //删除
  5364. this.mainService
  5365. .simplePost("rmvData", "incident", [this.coopData.id])
  5366. .subscribe((data) => {
  5367. this.btnLoading = false;
  5368. this.delModal = false;
  5369. if (data.status == 200) {
  5370. this.showPromptModal(this.tipsMsg2, true, "");
  5371. } else {
  5372. this.showPromptModal(this.tipsMsg2, false, data.msg);
  5373. }
  5374. });
  5375. }else if (this.confirmDelType === "receive") {
  5376. //接单
  5377. this.mainService
  5378. .flowPost("incident/task/receive", { incident: this.coopData })
  5379. .subscribe((data) => {
  5380. this.btnLoading = false;
  5381. this.delModal = false;
  5382. if (data.state == 200) {
  5383. this.showPromptModal(this.tipsMsg2, true, "");
  5384. } else {
  5385. this.showPromptModal(this.tipsMsg2, false, data.msg);
  5386. }
  5387. });
  5388. }else if (this.confirmDelType === "checkout") {
  5389. //签出
  5390. this.btnLoading = false;
  5391. this.delModal = false;
  5392. this.msg.success('签出成功');
  5393. if(this.incomingService.getSign() === 'box'){
  5394. this.incomingService.closeWs(true);
  5395. this.incomingService.removeSign();
  5396. }if(this.incomingService.getSign() === 'callCenter'){
  5397. this.incomingService.closeWs(true);
  5398. this.incomingService.removeSign();
  5399. this.incomingService.removeSocketUrl();
  5400. }
  5401. this.incomingService.removePhoneNumber();
  5402. }
  5403. }
  5404. // 处理-弹窗
  5405. handleModalShow = false; //弹窗开关
  5406. handle(data) {
  5407. this.coopData = data;
  5408. this.handleModalShow = true;
  5409. }
  5410. // 关闭弹窗
  5411. closeHandleModelOrder(e) {
  5412. this.handleModalShow = JSON.parse(e).show;
  5413. }
  5414. // 弹窗确定
  5415. confirmHandleModelOrder(e){
  5416. console.log(e);
  5417. this.handleModalShow = false;
  5418. this.showPromptModalRefresh();
  5419. }
  5420. // 回访列表
  5421. visitShow = false; //弹窗开关
  5422. visitOrder() {
  5423. this.visitShow = true;
  5424. }
  5425. // 关闭弹窗
  5426. closeVisit(e) {
  5427. this.visitShow = JSON.parse(e).show;
  5428. }
  5429. // 留言列表
  5430. messageShow = false; //弹窗开关
  5431. messageOrder() {
  5432. this.messageShow = true;
  5433. }
  5434. // 关闭弹窗
  5435. closeMessage(e) {
  5436. this.messageShow = e.show;
  5437. if(e.data){
  5438. // 留言创建工单
  5439. let postData = {
  5440. hosId: this.tool.getCurrentHospital().id,
  5441. phone: e.data.ano,
  5442. };
  5443. this.maskFlag = this.msg.loading("正在加载中..", {
  5444. nzDuration: 0,
  5445. }).messageId;
  5446. this.mainService
  5447. .findPhoneDept(postData)
  5448. .subscribe((result:any) => {
  5449. this.msg.remove(this.maskFlag);
  5450. this.maskFlag = false;
  5451. if (result.state == 200) {
  5452. this.mainService.getDictionary("list", "incident_source").subscribe((res) => {
  5453. let sourceList = res || [];
  5454. let incidentModel:any = {
  5455. hjzxRecordId: e.data.id,
  5456. incomingPhone: e.data.ano,
  5457. };
  5458. let incidentMsg:any = {};
  5459. let source = sourceList.find(v => v.value === 'record');
  5460. source && (incidentModel.source = source.id);
  5461. if (result.data.length > 0) {
  5462. //绑定了科室
  5463. let deptDTO;
  5464. if(result.type === 'qrCode'){
  5465. deptDTO = result.data[0].deptDTO;
  5466. deptDTO.address = result.data[0].name;
  5467. }else if(result.type === 'dept'){
  5468. deptDTO = result.data[0];
  5469. }
  5470. incidentModel.department = deptDTO;
  5471. incidentModel.department && incidentModel.department.hospital && (incidentModel.hosId = incidentModel.department.hospital.parent ? incidentModel.department.hospital.parent.id : incidentModel.department.hospital.id);
  5472. incidentModel.department && incidentModel.department.building && (incidentModel.area = incidentModel.department.building.id);
  5473. incidentModel.department && incidentModel.department.floor && (incidentModel.place = incidentModel.department.floor.id);
  5474. incidentModel.department && incidentModel.department.address && (incidentModel.houseNumber = incidentModel.department.address);
  5475. incidentModel.department && (incidentMsg.deptManyPhone = incidentModel.department.manyPhone);
  5476. incidentModel.department && (incidentMsg.deptName = incidentModel.department.dept);
  5477. incidentModel.department && (incidentModel.department = incidentModel.department.id);
  5478. incidentModel.repairIncidentType = 'dept';
  5479. this.changeRepairIncidentType(incidentModel.repairIncidentType);
  5480. this.incidentModel = incidentModel;
  5481. console.log('this.incidentModel:', this.incidentModel)
  5482. this.incidentMsg = incidentMsg;
  5483. this.showNewOrder('', '', true, '留言转事件');
  5484. } else {
  5485. //没绑定科室
  5486. this.incidentModel = incidentModel;
  5487. this.incidentMsg = incidentMsg;
  5488. this.showNewOrder('', '', true, '留言转事件');
  5489. }
  5490. });
  5491. }
  5492. });
  5493. }
  5494. }
  5495. // 通话记录列表
  5496. callShow = false; //弹窗开关
  5497. callOrder() {
  5498. this.callShow = true;
  5499. }
  5500. // 关闭弹窗
  5501. closeCall(e) {
  5502. this.callShow = e.show;
  5503. }
  5504. // 详细地址获取焦点
  5505. isShowAddressList:boolean = false;
  5506. focusAddress(){
  5507. this.isShowAddressList = true;
  5508. this.getAddressList();
  5509. }
  5510. // 点击其他位置
  5511. clickExtra(e){
  5512. if(document.documentElement.contains(document.querySelector('.addressList')) && e.target !== document.querySelector('.addressFocus')){
  5513. this.isShowAddressList = false;
  5514. }
  5515. if(document.documentElement.contains(document.querySelector('.noteList')) && e.target !== document.querySelector('.noteFocus')){
  5516. this.isShowNoteList = false;
  5517. }
  5518. }
  5519. // 选择地址
  5520. selectAddress(name){
  5521. this.incidentModel.houseNumber = name;
  5522. this.isShowAddressList = false;
  5523. }
  5524. // 获取科室地点列表
  5525. addressList:any[] = [];
  5526. addressLoading:boolean = false;
  5527. getAddressList() {
  5528. if(!this.incidentModel.department){
  5529. this.addressList = [];
  5530. return;
  5531. }
  5532. let postData = {
  5533. idx: 0,
  5534. sum: 99999,
  5535. qrCode: {
  5536. deptId: this.incidentModel.department,
  5537. }
  5538. };
  5539. this.addressLoading = true;
  5540. this.mainService.getFetchDataList("simple/data", "qrCode", postData).subscribe(result=>{
  5541. this.addressLoading = false;
  5542. if(result.status == 200){
  5543. this.addressList = result.list || [];
  5544. }else{
  5545. this.addressList = [];
  5546. }
  5547. });
  5548. }
  5549. // 选择患者
  5550. selectPatientZy(e){
  5551. let patient = this.patientList.find(v => v.patientCode === e);
  5552. if(patient){
  5553. this.workOrderRemarkZy = patient.remark || '';
  5554. }else{
  5555. this.workOrderRemarkZy = '';
  5556. }
  5557. if(this.tabIndex !== undefined && this.currentTasktype && this.currentTasktype.associationType.value === 'inspect'){
  5558. let index = this.tabIndex;
  5559. let value = this.currentTasktype.id;
  5560. let taskType = this.workTypesArrange[index].value.find(v => v.id == value);
  5561. let patientCode;
  5562. if(taskType.associationTypeValue === 'inspect'){
  5563. patientCode = this.patientZy;
  5564. }else{
  5565. patientCode = undefined;
  5566. }
  5567. this.mainService.getdeptList(value, patientCode, (taskType.associationTypeValue === 'inspect' ? format(startOfDay(this.inspectToday), 'yyyy-MM-dd HH:mm:ss') : undefined), (taskType.associationTypeValue === 'inspect' ? format(endOfDay(this.inspectToday), 'yyyy-MM-dd HH:mm:ss') : undefined)).subscribe((data:any) => {
  5568. this.linkCheckLis = [];
  5569. if(data.data && Array.isArray(data.data.data) && data.data.data.length) {
  5570. let arr = [];
  5571. data.data.data.forEach((e) => {
  5572. arr.push({
  5573. execDeptId: e.execDept.id,
  5574. yyTime: e.yyTime,
  5575. priority: e.priority,
  5576. label: (e.yyTime || "") + " " + e.execDept.dept + " 进行 " + (e.inspectName || "检查"),
  5577. value: e["id"],
  5578. checked: false,
  5579. });
  5580. });
  5581. this.linkCheckLis = arr;
  5582. }
  5583. })
  5584. }
  5585. }
  5586. // 注意事项获取焦点
  5587. isShowNoteList:boolean = false;
  5588. focusNote(){
  5589. this.isShowNoteList = true;
  5590. this.getNoteList();
  5591. }
  5592. // 选择注意事项
  5593. selectNote(name){
  5594. this.workOrderRemarkZy = name;
  5595. this.isShowNoteList = false;
  5596. }
  5597. // 获取注意事项列表
  5598. noteList:any[] = [];
  5599. noteLoading:boolean = false;
  5600. getNoteList() {
  5601. this.noteLoading = true;
  5602. this.mainService.getDictionary('list', 'inspect_notes',).subscribe(result=>{
  5603. this.noteLoading = false;
  5604. this.noteList = result || [];
  5605. });
  5606. }
  5607. // 关联的检查-上一日,下一日,今天
  5608. inspectToday:Date = new Date();
  5609. // 上一日
  5610. previousDayNew(){
  5611. this.inspectToday = addDays(this.inspectToday, -1);
  5612. this.inspectSubject.next();
  5613. }
  5614. // 今天
  5615. todayNew(){
  5616. this.inspectToday = new Date();
  5617. this.inspectSubject.next();
  5618. }
  5619. // 下一日
  5620. nextDayNew(){
  5621. this.inspectToday = addDays(this.inspectToday, 1);
  5622. this.inspectSubject.next();
  5623. }
  5624. refreshInspectList(){
  5625. this.linkCheckLis = [];
  5626. this.mainService.getdeptList(this.radioValueZy, this.patientZy, format(startOfDay(this.inspectToday), 'yyyy-MM-dd HH:mm:ss'), format(endOfDay(this.inspectToday), 'yyyy-MM-dd HH:mm:ss')).subscribe((data:any) => {
  5627. if (data.data && Array.isArray(data.data.data) && data.data.data.length) {
  5628. let arr = [];
  5629. data.data.data.forEach((e) => {
  5630. arr.push({
  5631. execDeptId: e.execDept.id,
  5632. yyTime: e.yyTime,
  5633. priority: e.priority,
  5634. label: (e.yyTime || "") + " " + e.execDept.dept + " 进行 " + (e.inspectName || "检查"),
  5635. value: e["id"],
  5636. checked: false,
  5637. });
  5638. });
  5639. this.linkCheckLis = arr;
  5640. }
  5641. });
  5642. }
  5643. // 修改备注
  5644. isShowBuildQuickConfirm:boolean = false;
  5645. buildQuickConfirmData:any = {};
  5646. buildQuick(data){
  5647. this.buildQuickConfirmData = data || {};
  5648. this.isShowBuildQuickConfirm = true;
  5649. }
  5650. cancelBuildQuickConfirm(e){
  5651. this.isShowBuildQuickConfirm = false;
  5652. }
  5653. loadingQuick:boolean = false;
  5654. confirmBuildQuickConfirm(options){
  5655. let { workOrderRemark} = options;
  5656. this.maskFlag = this.msg.loading("正在加载中..", {
  5657. nzDuration: 0,
  5658. }).messageId;
  5659. let postData:any = {
  5660. orderId: this.buildQuickConfirmData.id,
  5661. workOrderRemark,
  5662. };
  5663. this.mainService.coopWorkerOrder("editOrder", postData)
  5664. .subscribe((result) => {
  5665. this.msg.remove(this.maskFlag);
  5666. this.maskFlag = false;
  5667. if (result.state == 200) {
  5668. this.isShowBuildQuickConfirm = false;
  5669. this.showPromptModal("修改备注", true, "");
  5670. } else {
  5671. this.showPromptModal("修改备注", false, result.msg || '');
  5672. }
  5673. });
  5674. }
  5675. }