fuwutai.component.ts 177 KB

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