123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394 |
- import {
- Component,
- OnInit,
- TemplateRef,
- ViewChild,
- ElementRef,
- HostListener,
- } from "@angular/core";
- import { FormBuilder, FormGroup, Validators } from "@angular/forms";
- import { Router, ActivatedRoute } from "@angular/router";
- import { MainService } from "../../services/main.service";
- import { WebsocketPhoneService } from "../../services/websocket-phone.service";
- import { WebsocketSerService } from "../../services/websocket-ser.service";
- import http from "../../../assets/js/http";
- import { NzMessageService } from "ng-zorro-antd/message";
- import { NzNotificationService } from "ng-zorro-antd/notification";
- import { OverlayScrollbarsComponent } from "overlayscrollbars-ngx";
- import { Subject, forkJoin } from "rxjs";
- import { debounceTime, filter, map } from "rxjs/operators";
- import { SourceId } from "src/app/type/types";
- import { ToolService } from 'src/app/services/tool.service';
- import { addDays, differenceInCalendarDays, getHours, getMinutes, setMinutes, parse, format, addHours } from 'date-fns';
- import { UploadFile } from 'ng-zorro-antd';
- import { HttpRequest, HttpClient, HttpResponse } from '@angular/common/http';
- import cloneDeep from 'lodash-es/cloneDeep'
- import { WebsocketIncomingService } from 'src/app/services/websocket-incoming.service';
- declare const tlwsa: any;
- declare const TLWSA: any;
- // 日期禁用
- function range(start: number, end: number): number[] {
- const result: number[] = [];
- for (let i = start; i < end; i++) {
- result.push(i);
- }
- return result;
- }
- @Component({
- selector: "app-fuwutai",
- templateUrl: "./fuwutai.component.html",
- styleUrls: ["./fuwutai.component.less"],
- })
- export class FuwutaiComponent implements OnInit {
- @ViewChild('printBtn', { static: false }) printBtn: ElementRef<HTMLElement>;
- @ViewChild("remarksEle", { static: false }) remarksEle: ElementRef;
- @ViewChild("tabs", { static: false }) tabs: ElementRef;
- @ViewChild("tab", { static: false }) elementView: ElementRef;
- @ViewChild("osComponentRef7", {
- read: OverlayScrollbarsComponent,
- static: false,
- })
- osComponentRef7: OverlayScrollbarsComponent;
- @ViewChild("osComponentRef8", {
- read: OverlayScrollbarsComponent,
- static: false,
- })
- osComponentRef8: OverlayScrollbarsComponent;
- @ViewChild("osComponentRef9", {
- read: OverlayScrollbarsComponent,
- static: false,
- })
- osComponentRef9: OverlayScrollbarsComponent;
- @ViewChild("osComponentRef10", {
- read: OverlayScrollbarsComponent,
- static: false,
- })
- osComponentRef10: OverlayScrollbarsComponent;
- @ViewChild("osComponentRef11", {
- read: OverlayScrollbarsComponent,
- static: false,
- })
- osComponentRef11: OverlayScrollbarsComponent;
- @ViewChild("osComponentRef12", {
- read: OverlayScrollbarsComponent,
- static: false,
- })
- osComponentRef12: OverlayScrollbarsComponent;
- @ViewChild("osComponentRef13", {
- read: OverlayScrollbarsComponent,
- static: false,
- })
- osComponentRef13: OverlayScrollbarsComponent;
- @ViewChild("osComponentRef14", {
- read: OverlayScrollbarsComponent,
- static: false,
- })
- osComponentRef14: OverlayScrollbarsComponent;
- @ViewChild("osComponentRef15", {
- read: OverlayScrollbarsComponent,
- static: false,
- })
- osComponentRef15: OverlayScrollbarsComponent;
- @ViewChild("osComponentRef16", {
- read: OverlayScrollbarsComponent,
- static: false,
- })
- osComponentRef16: OverlayScrollbarsComponent;
- @ViewChild("osComponentRef17", {
- read: OverlayScrollbarsComponent,
- static: false,
- })
- osComponentRef17: OverlayScrollbarsComponent;
- constructor(
- private fb: FormBuilder,
- public router: Router,
- private mainService: MainService,
- private msg: NzMessageService,
- private notification: NzNotificationService,
- private phones: WebsocketPhoneService,
- private sers: WebsocketSerService,
- private tool: ToolService,
- private http: HttpClient,
- public route: ActivatedRoute,
- public incomingService: WebsocketIncomingService,
- ) {
- // 在组件中订阅服务的Observable
- this.phones.getDataUpdate().subscribe(data => {
- this.websocketLoading = data;
- });
- }
- validateFormZy!: FormGroup;
- validateFormQt!: FormGroup;
- // ---------------------------------------
- noWorkerPhone = false; //请求是否携带来电号码
- patientList; //患者信息列表
- isLoading: Boolean = false; //下拉框loading
- disX = 0; //移动的距离
- disStep = 0; //移动的步长
- applicationDepartmentList = []; //新建工单->申请科室列表(搜索)
- callNumber = ""; //来电号码
- workTypes = []; //任务类型
- workTypesArrange = []; //整理后的任务类型
- workTypesFlag = false; //任务类型是否显示操作项
- currentTabIndex = ""; //获取任务类型的key
- radioValueZy: any = ""; //转运->类型
- deptZyList: any = {}; //转运->请求结果
- startDeptZy = ""; //转运->选中起点科室
- endDeptZy = ""; //转运->选中终点科室
- patientZy = ""; //转运->选中患者编码
- radioValueQt: any = ""; //转运->类型
- deptQtList: any = {}; //其他->请求结果
- startDeptQt = ""; //其他->选中起点科室
- endDeptQt = ""; //其他->选中终点科室
- workOrderRemark = ""; //工单备注
- // 新建工单弹框
- newOrderShow = false; //展示/隐藏新建工单弹框
- newOrderShowOpen = false; //展示/隐藏新建工单弹框(辅助项)
- isOkLoading = false; //确认按钮loading状态
- applyDept; //申请科室
- applyDeptMiddle; //申请科室(中间传递)
- taskBuild; //任务类型选择
- targetDept; //目标科室
- noArrives = []; //未到达列表
- newLoading = false; //loading
- //防抖
- changeInpSubject = new Subject();
- changeCommonInpSubject = new Subject();
- onSearchTaskBuildSubject = new Subject();
- searchHosDepartmentSubject = new Subject();
- searchHosDepartmentQtSubject = new Subject();
- searchPatientListSubject = new Subject();
- // 运维相关
- incidentModel:any = {};
- incidentMsg:any = {};
- // 初始化增删改按钮
- coopBtns: any = {};
- // 获取院区配置配置,是否核酸打印
- isShowNucleicAcidPrinting = false;
- getHospitalConfigList(key) {
- if(!this.hsmsData.hsmsSwitch){
- return;
- }
- let postData = { idx: 0, sum: 1, hospitalConfig: { hosId: this.checkedHos, key } };
- this.mainService.getFetchDataList("simple/data", "hospitalConfig", postData).subscribe(result=>{
- if(result.status == 200){
- this.isShowNucleicAcidPrinting = result.list[0].value == 1;
- }else{
- this.isShowNucleicAcidPrinting = false;
- }
- });
- }
- // 打开选择楼栋多选框
- openChangeUnassignedBuilding(e) {
- if (e) {
- this.getUnassignedBuilding();
- }
- }
- // 获取楼栋-未派单
- unassignedBuildings = [];
- unassignedBuilding = [];
- bLoading = false;
- getUnassignedBuilding() {
- if(!this.hsmsData.hsmsSwitch){
- return;
- }
- let postData: any = {
- hosId: this.checkedHos,
- unassignedOder: 1, //未派单
- };
- if (this.allUnassignedOrders) {
- postData.wokerIds = this.allUnassignedOrders;
- }
- this.bLoading = true;
- this.mainService
- .coopData("getBuildingOrFloor", "building", postData)
- .subscribe((result) => {
- this.bLoading = false;
- if (result.status == 200) {
- this.unassignedBuildings = result.data;
- }
- });
- }
- allUnassignedOrders = "";
- b2Loading = false;
- getUnassignedBuilding2() {
- if (this.user.user.scope) {
- this.user.user.scope.typeIds = this.user.user.scope.typeIds || [];
- } else {
- return;
- }
- let types = "";
- this.user.user.scope.typeIds.forEach((e) => {
- types += e.id + ",";
- });
- types = types.slice(0, types.length - 1);
- let postData = {
- workOrder: {
- serTaskTypes: types || undefined,
- serGdState: 1,
- range: this.orderScopeRadio,
- platform: 3,
- searchDays: 1,
- keyWord: "",
- },
- idx: 0,
- sum: 9999,
- };
- this.b2Loading = true;
- this.mainService
- .getFetchDataList("ser", "workOrder", postData)
- .subscribe((result) => {
- this.b2Loading = false;
- if (result.status == 200) {
- this.allUnassignedOrders = result.list
- .map((item) => item.id)
- .toString();
- }
- });
- // -----------------------
- }
- // 选中未派单列表-全选
- changeAllUnassignedList(e) {
- this.unassignedList.forEach((v) => (v.checked = e));
- this.unassignedList.forEach((item1) => {
- this.unassignedListClone.forEach((item2) => {
- if (item1.data.id == item2.data.id) {
- item2.checked = item1.checked;
- }
- });
- });
- this.batchType = this.unassignedListClone.some((item) => item.checked);
- }
- // 选中待到达列表-全选
- changeAllArriveList(e) {
- this.arriveList.forEach((v) => (v.checked = e));
- this.arriveList.forEach((item1) => {
- this.arriveListClone.forEach((item2) => {
- if (item1.data.id == item2.data.id) {
- item2.checked = item1.checked;
- }
- });
- });
- this.batchType1 = this.arriveListClone.some((item) => item.checked);
- }
- // 添加备注
- addRemarks(item) {
- this.remarksEle.nativeElement.focus();
- this.workOrderRemark += item;
- }
- // 批量分派
- batchType = false; //是否开启批量派单
- batchDispatch() {
- let ids_types = [];
- let stateIds = [];
- this.unassignedList.forEach((item) => {
- if (item.checked) {
- if (item.data.gdState.value == 2) {
- //普通派单
- ids_types.push(`${item.data.id}_assign`);
- } else if (!item.data.worker && item.data.gdState.value != 2) {
- ids_types.push(`${item.data.id}_reassign`);
- }
- stateIds.push(item.data.gdState.id);
- }
- });
- this.router.navigateByUrl(
- "dispatchingDesk/allotWorker/" +
- ids_types.join("-") +
- "/" +
- stateIds.join("-") +
- "/2/" +
- this.checkedHos
- );
- }
- // 批量撤回
- batchType1 = false; //是否开启批量撤回
- batchClickType1 = false; //是否点击批量撤回
- batchWithdrawal() {
- this.batchClickType1 = true;
- let ids = [];
- this.arriveList.forEach((item) => {
- if (item.checked) {
- ids.push(item.data.id);
- }
- });
- this.openRecallModal(ids.join("-"));
- }
- // 批量分派选中
- allUnassignedList = false;
- batchDispatchSelect(e, id, event?) {
- event && event.stopPropagation();
- this.unassignedList.forEach((item) => {
- if (item.data.id == id) {
- item.checked = e;
- }
- });
- this.unassignedList.forEach((item1) => {
- this.unassignedListClone.forEach((item2) => {
- if (item1.data.id == item2.data.id) {
- item2.checked = item1.checked;
- }
- });
- });
- this.batchType = this.unassignedListClone.some((item) => item.checked);
- if (this.unassignedListClone.length) {
- this.allUnassignedList = this.unassignedListClone.every(
- (item) => item.checked
- );
- } else {
- this.allUnassignedList = false;
- }
- }
- // 批量撤回选中
- allArriveList = false;
- batchWithdrawalSelect(e, id, event?) {
- event && event.stopPropagation();
- this.arriveList.forEach((item) => {
- if (item.data.id == id) {
- item.checked = e;
- }
- });
- this.arriveList.forEach((item1) => {
- this.arriveListClone.forEach((item2) => {
- if (item1.data.id == item2.data.id) {
- item2.checked = item1.checked;
- }
- });
- });
- this.batchType1 = this.arriveListClone.some((item) => item.checked);
- if (this.arriveListClone.length) {
- this.allArriveList = this.arriveListClone.every((item) => item.checked);
- } else {
- this.allArriveList = false;
- }
- }
- // 获取科室
- applyStartDept;
- // 患者转运表单提交
- submitFormZy(go?): void {
- let newOrderShowFlag = true; //是否可以关闭弹窗
- for (const i in this.validateFormZy.controls) {
- this.validateFormZy.controls[i].markAsDirty();
- this.validateFormZy.controls[i].updateValueAndValidity();
- if (this.validateFormZy.controls[i].valid === false && i !== "goods") {
- //携带物品非必填ca
- // if (this.validateFormZy.controls[i].valid === false && i !== 'goods' && i !== 'patient') {//携带物品非必填
- newOrderShowFlag = false;
- }
- if (!this.validateFormZy.controls[i].valid) {
- this.isOkLoading = false;
- this.isGoLoading = false;
- }
- }
- if (newOrderShowFlag) {
- let goods = this.validateFormZy.controls.goods.value
- ? this.validateFormZy.controls.goods.value.filter(
- (item) => item.checked === true
- )
- : [];
- goods = goods.map((current) => current.value).join();
- // 预约日期
- let yyTime1;
- if(this.isYyInspect && this.currentTabIndex == '患者转运'){
- let yyDateZy = (typeof this.yyDateZy === 'object') ? new Date(this.yyDateZy) : parse(this.yyDateZy, 'yyyy-MM-dd HH:mm:ss', new Date());
- let yyTimeZy = (typeof this.yyTimeZy === 'object') ? new Date(this.yyTimeZy) : parse(this.yyTimeZy, 'yyyy-MM-dd HH:mm:ss', new Date());
- yyTime1 = format(yyDateZy, "yyyy-MM-dd") + " " + format(yyTimeZy, "HH:mm") + ":00";
- }
- let postData = {
- workOrder: {
- yyTime: yyTime1,
- sourceId: SourceId.fuwutai,
- taskType: {
- id: this.validateFormZy.controls.taskType.value,
- },
- startDept: {
- id: this.validateFormZy.controls.startDept.value,
- },
- createDept: this.applyDept,
- endDepts: [
- {
- id: this.validateFormZy.controls.endDepts.value,
- },
- ],
- patient: {
- patientCode: this.validateFormZy.controls.patient.value,
- },
- goods: goods,
- },
- };
- if (!this.noWorkerPhone) {
- postData.workOrder["workOrderPhone"] = this.callNumber;
- }
- this.mainService.buildOrder(postData).subscribe((data) => {
- console.log(data);
- this.isOkLoading = false;
- this.isGoLoading = false;
- if (data["status"] == 200) {
- this.newOrderShow = false; //关闭弹窗
- if (go === "&go&") {
- this.applyDept = data["startDept"].id;
- this.applyStartDept = data["startDept"];
- this.incidentModel.incomingPhone = this.callNumber = this.incidentModel.contactsInformation = data["phone"];
- this.showPromptModal("建单", true, "", "closeGo");
- } else {
- if(this.incomingService.getSign() === 'callCenter' && this.incomingService.getPhoneNumber()){
- this.jry_shixian();
- }
- this.showPromptModal("建单", true, "", "close");
- }
- } else {
- this.showPromptModal("建单", false, data["msg"]);
- }
- });
- }
- }
- // 标本配送表单提交
- submitFormBbps(go?) {
- let postData = {
- workOrder: {
- sourceId: SourceId.fuwutai,
- taskType: {
- id: this.validateFormQt.controls.taskTypeQt.value,
- },
- startDept: {
- id: this.applyDept,
- },
- },
- };
- if (!this.noWorkerPhone) {
- postData.workOrder["workOrderPhone"] = this.callNumber;
- }
- this.mainService.buildOrder(postData).subscribe((data) => {
- this.isOkLoading = false;
- this.isGoLoading = false;
- if (data["status"] == 200) {
- this.newOrderShow = false; //关闭弹窗
- if (go === "&go&") {
- this.applyDept = data["startDept"].id;
- this.applyStartDept = data["startDept"];
- this.incidentModel.incomingPhone = this.callNumber = this.incidentModel.contactsInformation = data["phone"];
- this.showPromptModal("建单", true, "", "closeGo");
- } else {
- if(this.incomingService.getSign() === 'callCenter' && this.incomingService.getPhoneNumber()){
- this.jry_shixian();
- }
- this.showPromptModal("建单", true, "", "close");
- }
- } else {
- this.showPromptModal("建单", false, data["msg"]);
- }
- });
- }
- // 其他表单提交
- submitFormQt(go?) {
- for (const i in this.validateFormQt.controls) {
- this.validateFormQt.controls[i].markAsDirty();
- this.validateFormQt.controls[i].updateValueAndValidity();
- if (!this.validateFormQt.controls[i].valid) {
- this.isOkLoading = false;
- this.isGoLoading = false;
- return;
- }
- }
- // 预约日期
- let yyTime1;
- if(this.isYyInspect && this.currentTabIndex == '物品配送'){
- let yyDate = (typeof this.yyDate === 'object') ? new Date(this.yyDate) : parse(this.yyDate, 'yyyy-MM-dd HH:mm:ss', new Date());
- let yyTime = (typeof this.yyTime === 'object') ? new Date(this.yyTime) : parse(this.yyTime, 'yyyy-MM-dd HH:mm:ss', new Date());
- yyTime1 = format(yyDate, "yyyy-MM-dd") + " " + format(yyTime, "HH:mm") + ":00";
- }
- let postData = {
- workOrder: {
- yyTime: yyTime1,
- sourceId: SourceId.fuwutai,
- workOrderRemark: this.validateFormQt.controls.workOrderRemark.value,
- taskType: {
- id: this.validateFormQt.controls.taskTypeQt.value,
- },
- startDept: {
- id: this.validateFormQt.controls.startDeptQt.value,
- },
- createDept: this.applyDept,
- endDepts: [
- {
- id: this.validateFormQt.controls.endDeptsQt.value,
- },
- ],
- },
- };
- if (!this.noWorkerPhone) {
- postData.workOrder["workOrderPhone"] = this.callNumber;
- }
- this.mainService.buildOrder(postData).subscribe((data) => {
- this.isOkLoading = false;
- this.isGoLoading = false;
- if (data["status"] == 200) {
- this.newOrderShow = false; //关闭弹窗
- if (go === "&go&") {
- this.applyDept = data["startDept"].id;
- this.applyStartDept = data["startDept"];
- this.incidentModel.incomingPhone = this.callNumber = this.incidentModel.contactsInformation = data["phone"];
- this.showPromptModal("建单", true, "", "closeGo");
- } else {
- if(this.incomingService.getSign() === 'callCenter' && this.incomingService.getPhoneNumber()){
- this.jry_shixian();
- }
- this.showPromptModal("建单", true, "", "close");
- }
- } else {
- this.showPromptModal("建单", false, data["msg"]);
- }
- });
- }
- // 万能交接表单提交
- submitFormOrdinary(go?) {
- for (const i in this.validateFormQt.controls) {
- this.validateFormQt.controls[i].markAsDirty();
- this.validateFormQt.controls[i].updateValueAndValidity();
- if (!this.validateFormQt.controls[i].valid) {
- this.isOkLoading = false;
- this.isGoLoading = false;
- return;
- }
- }
- let postData = {
- workOrder: {
- sourceId: SourceId.fuwutai,
- workOrderRemark: this.validateFormQt.controls.workOrderRemark.value,
- taskType: {
- id: this.validateFormQt.controls.taskTypeQt.value,
- },
- startDept: {
- id: this.validateFormQt.controls.startDeptQt.value,
- },
- createDept: this.applyDept,
- endDepts: [
- {
- id: this.validateFormQt.controls.endDeptsQt.value,
- },
- ],
- },
- };
- if (!this.noWorkerPhone) {
- postData.workOrder["workOrderPhone"] = this.callNumber;
- }
- this.mainService.buildOrder(postData).subscribe((data) => {
- this.isOkLoading = false;
- this.isGoLoading = false;
- if (data["status"] == 200) {
- this.newOrderShow = false; //关闭弹窗
- if (go === "&go&") {
- this.applyDept = data["startDept"].id;
- this.applyStartDept = data["startDept"];
- this.incidentModel.incomingPhone = this.callNumber = this.incidentModel.contactsInformation = data["phone"];
- this.showPromptModal("建单", true, "", "closeGo");
- } else {
- if(this.incomingService.getSign() === 'callCenter' && this.incomingService.getPhoneNumber()){
- this.jry_shixian();
- }
- this.showPromptModal("建单", true, "", "close");
- }
- } else {
- this.showPromptModal("建单", false, data["msg"]);
- }
- });
- }
- // 核酸打印
- nucleicAcidLoading = false;
- nucleicAcidList: any = [];
- // nucleicAcidListPageIndex: number = 1;//表格当前页码
- // nucleicAcidListPageSize: number = 5;//表格每页展示条数
- // nucleicAcidListLength: number = 10;//表格总数据量
- // 获取列表数据
- getNucleicAcidBuildingSummary(idx?) {
- // if (idx) {
- // this.nucleicAcidListPageIndex = 1;
- // }
- this.nucleicAcidLoading = true;
- this.mainService.getNucleicAcidBuildingSummary({}).subscribe((data:any) => {
- this.nucleicAcidLoading = false;
- let nucleicAcidList = data.data || [];
- for (let i = 0; i < nucleicAcidList.length; i++) {
- if(nucleicAcidList[i].deptData && Array.isArray(nucleicAcidList[i].deptData)){
- nucleicAcidList[i].deptNames = nucleicAcidList[i].deptData.map(v=>v.deptName).toString();
- }else{
- nucleicAcidList[i].deptData = [];
- nucleicAcidList[i].deptNames = '';
- }
- }
- this.nucleicAcidList = nucleicAcidList;
- console.log(this.nucleicAcidList)
- // this.nucleicAcidListLength = data.totalNum || 0;
- })
- }
- // 打印
- mapQrcodes:any = {};
- printDate:number = Date.now();
- printAucleicAcid(){
- this.isOkLoading = true;
- this.mainService.printNucleicAcid({}).subscribe((data:any) => {
- this.isOkLoading = false;
- if(data.state == 200){
- let mapQrcodes = {};
- data.data.forEach(v=>{
- mapQrcodes[v.buildId] = v.qrcode;
- })
- this.mapQrcodes = mapQrcodes;
- this.nucleicAcidPrintingCancel();
- setTimeout(()=>{
- this.printBtn.nativeElement.click();
- },0)
- }else{
- this.msg.create('error', `操作失败!`);
- }
- })
- }
- //获取检查页面任务类型
- getInspectAndPatientTransportConfigTasktype() {
- if(!this.hsmsData.hsmsSwitch){
- return;
- }
- let postData = {
- idx: 0,
- sum: 10,
- taskType: {
- simpleQuery: true,
- hosId: {
- id: this.checkedHos
- },
- associationType: {
- key:"association_types",
- value: 'inspect'
- }
- }
- };
- this.mainService
- .getFetchDataList("simple/data", "taskType", postData)
- .subscribe((result) => {
- if (result.status == 200) {
- let tasktype:any = result.list[0] || {};
- this.getInspectAndPatientTransportConfig(tasktype);
- }
- });
- }
- // 获取检查页面信息配置
- getInspectAndPatientTransportConfig(tasktype) {
- if(!this.hsmsData.hsmsSwitch){
- return;
- }
- let postData = {
- idx: 0,
- sum: 10,
- taskTypeConfig: {
- taskTypeDTO: {
- hosId: {
- id: this.checkedHos
- },
- associationType: tasktype.associationType
- }
- }
- };
- this.mainService
- .getFetchDataList("simple/data", "taskTypeConfig", postData)
- .subscribe((result) => {
- if (result.status == 200) {
- let inspectAndPatientTransportConfig = result.list[0] || {};
- this.inspectAndPatientTransportConfig = {...this.inspectAndPatientTransportConfig, ...inspectAndPatientTransportConfig};
- }
- });
- }
- ngOnInit() {
- this.websocketLoading = true;
- this.coopBtns = this.tool.initCoopBtns(this.route);
- //防抖
- this.changeInpSubject.pipe(debounceTime(500)).subscribe((v) => {
- this.searchApplicationDepartment(v[0], v[1]);
- });
- this.changeCommonInpSubject.pipe(debounceTime(500)).subscribe((v) => {
- if(v[0] === 'requester'){
- this.searchApplicationRequester(v[1]);
- }else if(v[0] === 'category'){
- this.searchApplicationCategory(v[1]);
- }else if(v[0] === 'group'){
- this.searchApplicationGroup(v[1]);
- }else if(v[0] === 'user'){
- this.searchApplicationUser(v[1]);
- }
- });
- this.onSearchTaskBuildSubject.pipe(debounceTime(500)).subscribe((v) => {
- this.getTasktypeByPhone(v);
- });
- this.searchHosDepartmentSubject.pipe(debounceTime(500)).subscribe((v) => {
- this.getHosDepartment(v[0], v[1], v[2]);
- });
- this.searchHosDepartmentQtSubject.pipe(debounceTime(500)).subscribe((v) => {
- this.getHosDepartmentQt(v[0], v[1], v[2]);
- });
- this.searchPatientListSubject.pipe(debounceTime(500)).subscribe((v) => {
- this.getPatientList(v[0], v[1]);
- });
- //患者转运
- this.validateFormZy = this.fb.group({
- taskType: [null, [Validators.required]], //类型
- startDept: [null, [Validators.required]], //起点科室
- endDepts: [null, [Validators.required]], //终点科室
- patient: [null, [Validators.required]], //患者信息
- // patient: [null],//患者信息ca
- goods: [null], //携带物品
- });
- //其他
- this.validateFormQt = this.fb.group({
- taskTypeQt: [null, [Validators.required]], //类型
- startDeptQt: [null, [Validators.required]], //起点科室
- endDeptsQt: [null, [Validators.required]], //终点科室
- workOrderRemark: [null], //工单备注
- });
- this.getWebsocketSer();
- this.initRole();
- this.initLogin();
- this.retract();
- this.refresh();
- this.initOrderScope();
- this.getVisitList();
- this.getMessageList();
- this.initControlView();
- this.moveMenu("fixedMenu");
- this.moveMenu("fixedMenuLeft");
- this.moveMenuAll("fixedMenuAll");
- if(this.incomingService.getSign() === 'box'){
- this.getPhoneNum();
- }else if(this.incomingService.getSign() === 'callCenter'){
- setTimeout(this.getPhoneNum.bind(this), 2000)
- }else{
- this.websocketLoading = false;
- }
- this.getUnassignedBuilding2();
- this.getInspectAndPatientTransportConfigTasktype();
- this.initCallCenter();
- }
- ngOnDestroy() {
- document.removeEventListener("keydown", this.quickShowNewOrder.bind(this));
- this.quickShowNewOrder = null;
- clearTimeout(this.refreshTimerId);
- this.incomingService.closeWs(true);
- this.sers.closeWs(true);
- }
- ngAfterViewInit() {
- // 快捷键打开新建工单
- document.addEventListener("keydown", this.quickShowNewOrder.bind(this));
- }
- // 初始化呼叫中心方法
- initCallCenter(){
- let _this = this;
- // 状态回调函数
- // TLWSA.onStatechange = onstatechange;
- // function onstatechange() {
- // console.log('事件:状态变化----------------------------------------------------');
- // _this.getState();
- // }
- //连接呼叫中心回调函数
- TLWSA.onOpenreturn = (err) => {
- err = Number(err);
- if (!err) {
- _this.incomingService.setPhoneNumber(TLWSA.phoneNumber);
- _this.websocketLoading = false;
- _this.cancelBindExtensionNumber();
- console.log('呼叫中心连接成功-----seimin');
- _this.getState(0);
- _this.msg.success('呼叫中心连接成功')
- //如果设置过话机
- if (_this.incomingService.getPhoneNumberPre()) {
- //强制签出,然后签入
- tlwsa.tlaKillworkid(+_this.incomingService.getPhoneNumberPre());
- }else{
- // 签入并绑定分机
- tlwsa.tlaLogin(_this.user.user.id, 1, -1);
- }
- } else {
- console.log('呼叫中心连接失败-----seimin');
- _this.getState(0);
- _this.msg.error('呼叫中心连接失败')
- }
- }
- //绑定分机回调函数
- TLWSA.onSetphonenumberreturn = function (err) {
- err = Number(err);
- if (!err) {
- console.log('绑定分机成功-----seimin');
- _this.msg.success('绑定分机成功')
- _this.incomingService.setPhoneNumberPre(_this.user.user.id);
- _this.qShimang(1);
- } else {
- console.log('绑定分机失败-----seimin');
- _this.getState(0);
- _this.msg.error('绑定分机失败')
- }
- }
- //强制示忙回调函数
- // TLWSA.onAcw = onacw;
- // function onacw(err) {
- // err = Number(err);
- // if (!err) {
- // console.log('强制示忙成功-----seimin');
- // _this.getState(2);
- // $.toaster({
- // priority: 'info',
- // title: '操作',
- // message: '示忙成功'
- // });
- // } else {
- // console.log('强制示忙失败-----seimin');
- // $.toaster({
- // priority: 'info',
- // title: '操作',
- // message: '示忙失败'
- // });
- // }
- // }
- // //强制示闲回调函数
- // TLWSA.onWca = onwca;
- // function onwca(err) {
- // console.log(err)
- // err = Number(err);
- // if (!err) {
- // console.log('强制示闲成功-----seimin');
- // _this.getState(1);
- // $.toaster({
- // priority: 'info',
- // title: '操作',
- // message: '示闲成功'
- // });
- // } else {
- // console.log('强制示闲失败-----seimin');
- // $.toaster({
- // priority: 'info',
- // title: '操作',
- // message: '示闲失败'
- // });
- // }
- // }
- //与服务器网络连接中断回调函数
- let timer = null;
- TLWSA.onClosed = () => {
- _this.getState(0);
- clearTimeout(timer);
- if(location.hash === '#/dispatchingDesk'){
- console.log('与服务器网络连接中断-----seimin');
- if(this.incomingService.getPhoneNumber()){
- _this.msg.info('与服务器网络连接中断,2分钟后重连')
- console.log('2分钟后自动重连-----seimin')
- timer = setTimeout(function () {
- //连接
- TLWSA.phoneNumber = _this.incomingService.getPhoneNumber();
- tlwsa.tlaOpen(_this.incomingService.getSocketUrl());
- }, 120000)
- }else{
- _this.websocketLoading = false;
- }
- }
- }
- //签入回调函数
- TLWSA.onLoginreturn = function (err) {
- err = Number(err);
- if (!err) {
- console.log('签入成功-----seimin');
- _this.msg.success('签入成功')
- setTimeout(function () {
- console.log(_this.incomingService.getPhoneNumber(), 1111)
- var phoneNumber = _this.incomingService.getPhoneNumber();
- console.log('开始绑定分机【' + phoneNumber + '】-----seimin');
- tlwsa.tlaSetphonenumber(phoneNumber);
- }, 0)
- } else if (err == 9011) {
- console.log('签入失败,该分机已登录-----seimin');
- _this.msg.error('签入失败,该分机已登录')
- } else {
- console.log('签入失败-----seimin');
- _this.msg.error('签入失败')
- }
- }
- // 强制签出回调函数
- TLWSA.onKillreturn = function (err) {
- err = Number(err);
- if (!err) {
- console.log('强制签出成功-----seimin');
- _this.getState(0);
- // $.toaster({
- // priority: 'info',
- // title: '操作',
- // message: '强制签出成功'
- // });
- } else {
- console.log('强制签出失败,该分机不是签入状态-----seimin');
- // $.toaster({
- // priority: 'info',
- // title: '操作',
- // message: '强制签出失败'
- // });
- }
- //如果设置过话机
- if (_this.incomingService.getPhoneNumberPre()) {
- // 签入并绑定分机
- tlwsa.tlaLogin(+_this.incomingService.getPhoneNumberPre(), 1, -1);
- }
- }
- // 签出回调函数
- TLWSA.onLogoffreturn = function (err) {
- err = Number(err);
- if (!err) {
- console.log('签出成功-----seimin');
- _this.getState(0);
- _this.msg.success('签出成功')
- _this.incomingService.removePhoneNumberPre();
- _this.incomingService.removePhoneNumber();
- } else {
- console.log('签出失败-----seimin');
- _this.msg.error('签出失败')
- }
- }
- //示忙回调函数
- TLWSA.onAcwreturn = function (err) {
- err = Number(err);
- if (!err) {
- console.log('示忙成功-----seimin');
- if (location.href.includes('app/incident/editor') || location.href.includes('app/incident/chart')) {
- _this.isShixian = false;
- } else {
- _this.isShixian = true;
- }
- _this.getState(2);
- _this.preState = 2;
- _this.msg.success('示忙成功')
- } else {
- console.log('示忙失败-----seimin');
- // $.toaster({
- // priority: 'info',
- // title: '操作',
- // message: '示忙失败'
- // });
- }
- }
- //示闲回调函数
- TLWSA.onWcareturn = function (err) {
- err = Number(err);
- if (!err) {
- console.log('示闲成功-----seimin');
- _this.getState(1);
- _this.preState = 1;
- _this.msg.success('示闲成功')
- } else {
- console.log('示闲失败-----seimin');
- _this.msg.error('示闲失败')
- }
- }
- //呼叫坐席回调函数
- TLWSA.onCallreturn = function (err) {
- err = Number(err);
- if (!err) {
- console.log('呼叫成功,请摘机-----seimin');
- _this.getState(6);
- _this.msg.success('呼叫成功,请摘机')
- } else {
- console.log('呼叫失败-----seimin');
- _this.msg.error('呼叫失败')
- }
- }
- //呼叫坐席被接听回调函数
- TLWSA.onCallresult = function (jso) {
- console.log(jso);
- var err = Number(jso.err);
- if (!err) {
- console.log('呼叫被接听成功-----seimin');
- _this.getState(5);
- _this.msg.success('呼叫被接听成功')
- } else {
- console.log('呼叫被接听失败-----seimin');
- _this.qShimang(1);
- _this.msg.error('呼叫被接听失败')
- }
- }
- //挂断回调函数
- TLWSA.onCallend = function (jso) {
- console.log(jso);//lmm
- if (jso) {
- console.log('挂断成功-----seimin');
- console.log('最近一次话机状态', _this.preState);
- _this.qShimang(_this.preState);
- _this.msg.success('挂断成功')
- } else {
- console.log('挂断失败-----seimin');
- _this.msg.error('挂断失败')
- }
- }
- //呼入回调函数
- TLWSA.onCallin = function (jso) {
- console.log(jso);
- _this.incidentModel = { repairIncidentType: 'dept' };
- _this.callNumber = _this.incidentModel.incomingPhone = jso.caller;//来电的电话
- _this.incidentModel.callID = jso.crs;//来电的话机id
- if (jso) {
- console.log('呼入坐席成功,请摘机-----seimin');
- _this.getState(3);
- _this.msg.success('呼入坐席成功,请摘机')
- console.log('来电了!电话号码是【' + _this.incidentModel.incomingPhone + '】');
- } else {
- console.log('呼入坐席失败-----seimin');
- _this.msg.error('呼入坐席失败')
- }
- }
- // 测试代码start
- // searchBxDept();
- // 测试代码end
- // 查报修科室
- // function searchBxDept() {
- // var postData = { "idx": 0, "sum": 10, "department": { phone: _this.callNumber = _this.incidentModel.incomingPhone } };//hjzxPhone
- // api_user_data.fetchDataList('department', postData).then(function (result) {
- // if (result.status == 200) {
- // console.log(result.list);
- // var requesters = result.list;
- // if (requesters.length === 0) {
- // //未匹配到报修科室
- // $rootScope.newOrder({
- // incident: {
- // sockid: _this.incidentModel.callID,
- // incomingPhone: _this.callNumber = _this.incidentModel.incomingPhone,
- // source: { id: 1547, name: '电话' }
- // },
- // }, 'incomingCall')
- // } else if (requesters.length === 1) {
- // //匹配到一个报修科室
- // $rootScope.newOrder({
- // incident: {
- // department: requesters[0],
- // phone: requesters[0].phone,
- // sockid: _this.incidentModel.callID,
- // incomingPhone: _this.callNumber = _this.incidentModel.incomingPhone,
- // source: { id: 1547, name: '电话' }
- // },
- // }, 'incomingCall')
- // } else {
- // //匹配到多个报修科室
- // $modal.open({
- // templateUrl: 'assets/views/incident/tpl/tel.html',
- // controller: function ($scope, $modalInstance, $timeout, SweetAlert) {
- // $scope.list = requesters;
- // $scope.selected = {
- // selectedItem: 0
- // };
- // $scope.cancel = function () {
- // $modalInstance.dismiss('cancel');
- // };
- // $scope.changeBxr = function (id) {
- // $scope.selected.selectedItem = id;
- // }
- // $scope.save = function () {
- // var item = $scope.list.find(v => v.id == $scope.selected.selectedItem);
- // if (item) {
- // $scope.cancel();
- // $rootScope.newOrder({
- // incident: {
- // department: item,
- // phone: item.phone,
- // sockid: _this.incidentModel.callID,
- // incomingPhone: _this.callNumber = _this.incidentModel.incomingPhone,
- // source: { id: 1547, name: '电话' }
- // },
- // }, 'incomingCall')
- // } else {
- // SweetAlert.swal({
- // title: "请选择报修科室!",
- // type: "error"
- // })
- // }
- // }
- // }
- // });
- // }
- // }
- // })
- // }
- //呼入摘机应答回调函数
- TLWSA.onAnswer = function (err) {
- err = Number(err);
- if (!err) {
- console.log('呼入摘机应答成功-----seimin');
- _this.getState(5);
- _this.msg.success('呼入摘机应答成功')
- // 查报修科室
- _this.searchBxDept();
- } else {
- console.log('呼入摘机应答失败-----seimin');
- _this.msg.error('呼入摘机应答失败')
- }
- }
- //呼入未摘机应答回调函数
- TLWSA.onMisscall = function (err) {
- err = Number(err);
- if (!err) {
- console.log('呼入未摘机应答成功-----seimin');
- _this.getState(1);
- _this.msg.success('呼入未摘机应答成功')
- } else {
- console.log('呼入未摘机应答失败-----seimin');
- _this.msg.error('呼入未摘机应答失败')
- }
- }
- //转接开始回调函数
- //调用转移方法之后,返回该事件 如果错误码为0,仅仅表示开始转移,不代表转移目标已经接听或已经拒绝
- TLWSA.onTransferreturn = function (err) {
- err = Number(err);
- if (!err) {
- console.log('转接坐席开始成功-----seimin');
- _this.getState(7);
- _this.msg.success('转接坐席开始成功')
- } else {
- console.log('转接坐席开始失败-----seimin');
- _this.msg.error('转接坐席开始失败')
- }
- }
- //转接结果回调函数
- TLWSA.onTransferresult = function (err) {
- err = Number(err);
- if (!err) {
- console.log('转接坐席结果成功-----seimin');
- _this.getState(1);
- _this.msg.success('转接坐席结果成功')
- } else {
- console.log('转接坐席结果失败-----seimin');
- _this.msg.error('转接坐席结果失败')
- }
- }
- // 呼叫中心----end
- }
- // 快捷键打开新建工单
- quickShowNewOrder(e){
- if (e.ctrlKey && e.key == "s") {
- this.showNewOrder();
- e.preventDefault();
- }
- }
- unassignedSearchCon: string = ""; //未分派搜索框内容
- arriveSearchCon: string = ""; //待到达搜索框内容
- executionSearchCon: string = ""; //执行中搜索框内容
- workerMessage: any = []; //顶部全部工单
- // 展示形式
- patientCareCol: number = 7; //顶部工单列数(4列-8人,7列-14人,6列-单排 )
- hurseInfoHiding = 1; //护工信息隐藏
- txtLabelCol: number = 1; //工单信息列数
- workerInfoTime: number = 60; //配送人员刷新时间
- orderInfoTime: number = 60; //工单刷新时间
- audioNotDispatched: boolean = true; //是否开启定时播报未派出工单提示音
- cotHeight: number; //工单初始化高度
- unassignedList: any = []; //未分派数据
- arriveList: any = []; //待到达数据
- executionList: any = []; //执行中数据
- unassignedListClone: any = null; //未分派数据clone
- arriveListClone: any = null; //待到达数据clone
- executionListClone: any = null; //执行中数据clone
- workerRefreshTime: number = 30; //配送人员刷新倒计时
- orderRefreshTime: number = 30; //工单刷新倒计时
- recallOrderShow: boolean = false; //撤回模态框
- delOrderShow: boolean = false; //删除模态框
- logoutModal: boolean = false; //退出模态框
- user = JSON.parse(localStorage.getItem("user")); //用户信息
- promptContent: string; //操作提示框提示信息
- ifSuccess: boolean; //操作成功/失败
- promptInfo: string; //操作结果提示信息
- promptModalShow: boolean; //是否展示提示框
- back = ""; //标识符
- btnLoading: boolean = false; //确认按钮loading状态
- recDelLoading: boolean = false; //撤回并删除loading状态
- saveLoading: boolean = false; //保存按钮loading状态
- flagList:any = {
- itsmFlag1: false,
- hsmsFlag1: false,
- itsmFlag2: false,
- hsmsFlag2: false,
- itsmFlag3: false,
- hsmsFlag3: false,
- }
- mainRole: boolean = false; //回到系统管理权限
- initRole() {
- // let roles = JSON.parse(localStorage.getItem('user')).user.role;
- let menus = JSON.parse(localStorage.getItem("menu"));
- let that = this;
- console.log("菜单数量" + menus.length);
- if (menus.length >= 2) {
- that.mainRole = true;
- return;
- }
- }
- // 判断登录是否已失效
- initLogin() {
- let that = this;
- if (!localStorage.getItem("user")) {
- that.msg.error("您的登录已失效,请重新登录!", {
- nzDuration: 3000,
- });
- setTimeout(() => {
- that.router.navigateByUrl("login");
- }, 2000);
- return;
- }
- }
- // 工单范围设置回显
- checkedHos;// 配送-院区选择
- checkedHosDTO;// 配送-院区选择
- scopeGroups = []; //配送-当前所属人员分组
- orderScopeRadio;// 配送-工单范围
- itsmCheckedHos;// 运维-院区选择
- itsmScopeGroups = []; //运维-当前所属人员分组
- itsmOrderScopeRadio;// 运维-工单范围
- hsmsData: any = {
- checkedHos: undefined,
- scopeGroups: [],
- orderScopeRadio: '0',
- }; //转运工单范围相关信息
- itsmData: any = {
- checkedHos: [],
- scopeGroups: [],
- orderScopeRadio: '0',
- }; //运维工单范围相关信息
- initOrderScope() {
- if (!this.user || !this.user.user || !this.user.user.scope){
- this.showOrderScope();
- return;
- }
- let scopeInfo = this.user.user.scope;
- this.checkedHos = scopeInfo.hospitalId ? scopeInfo.hospitalId.id : undefined;
- this.checkedHosDTO = scopeInfo.hospitalId || undefined;
- this.orderScopeRadio = scopeInfo.range + "";
- let groupIds = scopeInfo.groupIds || [];
- let dutyGroupList = scopeInfo.dutyGroupList || [];
- this.scopeGroups = dutyGroupList.concat(groupIds);
- if(this.scopeGroups.length){
- this.typeId = this.scopeGroups[0].id;
- }
- this.hsmsData = {
- checkedHos: this.checkedHos,
- checkedHosDTO: this.checkedHosDTO,
- scopeGroups: this.scopeGroups,
- orderScopeRadio: this.orderScopeRadio || '0',
- hsmsSwitch: scopeInfo.hsmsSwitch === 1,
- }
- this.flagList.hsmsFlag1 = this.hsmsData.hsmsSwitch;
- this.flagList.hsmsFlag2 = this.hsmsData.hsmsSwitch;
- this.flagList.hsmsFlag3 = this.hsmsData.hsmsSwitch;
- this.itsmCheckedHos = scopeInfo.dutyList || [];
- this.itsmOrderScopeRadio = scopeInfo.dutyRange + "";
- this.itsmScopeGroups = scopeInfo.dutyGroupList || [];
- this.itsmData = {
- checkedHos: this.itsmCheckedHos,
- scopeGroups: this.itsmScopeGroups,
- orderScopeRadio: this.itsmOrderScopeRadio || '0',
- mdv2Switch: scopeInfo.mdv2Switch === 1,
- allDuty: scopeInfo.allDuty === undefined ? 1 : scopeInfo.allDuty,
- }
- this.flagList.itsmFlag1 = this.itsmData.mdv2Switch;
- this.flagList.itsmFlag2 = this.itsmData.mdv2Switch;
- this.flagList.itsmFlag3 = this.itsmData.mdv2Switch;
- this.getHospitalConfigList('allowNucleicAcidPrinting');
- this.getConfigTasktype();
- this.patientLogTasktype();
- }
- // 保存工单信息
- confirmOrderScope(data){
- if (data.status == 200) {
- // this.websocketLoading = true;
- this.cancelOrderScope();
- this.showPromptModal("保存", true, "");
- // 关闭phone的websocket
- // this.incomingService.closeWs(true);
- // this.getPhoneNum(false);
- this.user.user.scope = data.data;
- localStorage.setItem("user", JSON.stringify(this.user));
- this.initOrderScope();
- } else {
- this.showPromptModal("保存", false, data.msg);
- }
- }
- // 第一次打开调度台页面初始化范围设置
- showInitModal: boolean = false;
- cancelOrderScope() {
- this.showInitModal = false;
- }
- showOrderScope() {
- this.showInitModal = true;
- }
- // 展示形式
- showDisplayFormModal: boolean = false;
- cancelDisplayForm() {
- this.showDisplayFormModal = false;
- }
- showDisplayForm() {
- this.showDisplayFormModal = true;
- }
- confirmDisplayForm(data){
- if (data.status == 200) {
- this.cancelDisplayForm();
- this.msg.success('保存成功');
- this.initControlView();
- } else {
- this.msg.error(data.msg || '保存失败');
- }
- }
- // 绑定分机
- showBindExtensionNumberModal: boolean = false;
- cancelBindExtensionNumber() {
- this.showBindExtensionNumberModal = false;
- }
- showBindExtensionNumber() {
- this.showBindExtensionNumberModal = true;
- this.websocketLoading = false;
- }
- // 保存绑定分机-签入
- checkIn(phoneNumber){
- this.websocketLoading = true;
- // this.incomingService.setPhoneNumber(phoneNumber);
- this.incomingService.closeWs(true);
- this.getWebsocketPhone(phoneNumber);
- }
- // 签出
- checkOut(){
- this.showDelModal(undefined, undefined,'您确认要签出吗?','签出','checkout');
- }
- // 连接websocket
- getWebsocketSer() {
- this.sers
- .connectWs(http.fwtWs, { userCount: this.user.user.account })
- .subscribe((result) => {
- console.log(result);
- if (result && result.content) {
- this.createBasicNotification(result);
- }
- });
- }
- // 连接websocket
- websocketLoading:boolean = false; //websocket连接状态
- preState:any = '';//最近一次示忙还是示闲的状态
- isShixian = false;//是否示闲
- jry_state = '';//话机状态
- jry_extnNumberObj = {
- // tel1: '',//目的号码对象
- // tel2: '',//转接坐席对象
- }
- getWebsocketPhone(phoneNumber) {
- const sign = this.incomingService.getSign();
- if(sign === 'box'){
- // 录音盒
- this.incomingService.connectWs(phoneNumber).subscribe((data) => {
- // data = { status: 201, phone: '013581394341' };//ceshi
- console.log(data);
- console.log(this.incidentModel);
- this.websocketLoading = false;
- // 200签入 201摘机 202来电
- if (data.status == 200 && data.phone) {
- this.incomingService.setPhoneNumber(phoneNumber);
- this.incidentModel = { repairIncidentType: 'dept' };
- this.incidentMsg = {};
- this.incidentModel.callID = data.callId || undefined;
- this.msg.info('签入成功');
- this.cancelBindExtensionNumber();
- } else if (data.status == 201 && data.phone) {
- this.incidentModel = { repairIncidentType: 'dept' };
- this.incidentMsg = {};
- this.incidentModel.callID = data.callId || undefined;
- this.incidentModel.incomingPhone = this.callNumber = this.incidentModel.contactsInformation = data.phone;
- this.searchBxDept();
- } else if (data.status == 201 && data.phone === "") {
- this.incidentModel = { repairIncidentType: 'dept' };
- this.incidentMsg = {};
- this.incidentModel.callID = data.callId || undefined;
- //没绑定科室
- if (!this.newOrderShow && !this.newOrderShowOpen) {
- this.applyDept = null;
- this.showNewOrder("no", data.phone, true, '来电弹屏');
- }
- } else if (data.status == 202) {
- this.msg.warning(data.msg);
- }
- });
- }else if(sign === 'callCenter'){
- // 呼叫中心----start
- this.preState = '';
- //连接
- TLWSA.phoneNumber = phoneNumber;
- tlwsa.tlaOpen(this.incomingService.getSocketUrl());
- }else{
- this.websocketLoading = false;
- }
- }
- // 呼叫中心---start
- searchBxDept(){
- let dataObj = {
- hosId: this.tool.getCurrentHospital().id,
- phone: this.incidentModel.incomingPhone,
- };
- this.mainService
- .findPhoneDept(dataObj)
- .subscribe((result:any) => {
- if (result.state == 200) {
- console.log(result);
- if (result.data.length > 0) {
- //绑定了科室
- // if (!this.newOrderShow && !this.newOrderShowOpen) {
- let incidentModel:any = Object.assign({}, this.incidentModel);
- let incidentMsg:any = Object.assign({}, this.incidentMsg);
- incidentModel.department = result.data[0];
- incidentModel.department && incidentModel.department.hospital && (incidentModel.hosId = incidentModel.department.hospital.parent ? incidentModel.department.hospital.parent.id : incidentModel.department.hospital.id);
- incidentModel.department && incidentModel.department.building && (incidentModel.area = incidentModel.department.building.id);
- incidentModel.department && incidentModel.department.floor && (incidentModel.place = incidentModel.department.floor.id);
- incidentModel.department && incidentModel.department.address && (incidentModel.houseNumber = incidentModel.department.address);
- incidentModel.department && (incidentMsg.deptManyPhone = incidentModel.department.manyPhone);
- incidentModel.department && (incidentMsg.deptName = incidentModel.department.dept);
- incidentModel.department && (incidentModel.department = incidentModel.department.id);
- this.incidentModel = incidentModel;
- this.incidentMsg = incidentMsg;
- this.searchApplicationRequester();
- this.applyDeptMiddle = result.data[0];
- this.showNewOrder("yes", this.incidentModel.incomingPhone, true, '来电弹屏');
- // }
- } else {
- //没绑定科室
- console.log(this.newOrderShow);
- console.log(this.incidentModel);
- console.log(this.incidentMsg);
- this.incidentMsg = {};
- if (!this.newOrderShow && !this.newOrderShowOpen) {
- this.applyDept = null;
- this.showNewOrder("no", this.incidentModel.incomingPhone, true, '来电弹屏');
- }
- }
- }
- });
- }
- // 强制示忙
- qShimang(state) {
- if (location.href.includes('app/incident/editor') || location.href.includes('app/incident/chart')) {
- //进入页面,强制示忙
- // tlwsa.tlaForceacw(this.user.user.id);
- setTimeout(() => {
- tlwsa.tlaAcw();
- }, 0)
- } else {
- this.getState(state);
- }
- }
- // 获取状态
- getState(state) {
- switch (state) {
- case 0:
- this.jry_state = 'weiqianru';
- break;
- case 1:
- this.jry_state = 'shixian';
- break;
- case 2:
- this.jry_state = 'shimang';
- break;
- case 3:
- this.jry_state = 'laidian';
- break;
- case 5:
- this.jry_state = 'tonghuazhong';
- break;
- case 6:
- this.jry_state = 'zhengzaiwaihu';
- break;
- case 7:
- this.jry_state = 'zhengzaizhuanyi';
- break;
- }
- }
- // 签入
- jry_qianru = function () {
- if (!this.incomingService.getPhoneNumber()) {
- this.msg.warning('绑定分机不能为空')
- return;
- }
- // 签入并绑定分机
- // this.incomingService.getPhoneNumber() 分机号
- // this.user.user.id 坐席号(用户id)
- tlwsa.tlaLogin(this.user.user.id, 1, -1);
- }
- // 示闲
- jry_shixian = function () {
- tlwsa.tlaWca();
- }
- // 示忙
- jry_shimang = function () {
- tlwsa.tlaAcw();
- }
- // 签出
- jry_qianchu = function () {
- tlwsa.tlaLogoff();
- }
- // 呼叫坐席
- // tlaCallagc = function () {
- // tlwsa.tlaCallagc(this.jry_extnNumberObj.tel1)
- // }
- // 呼叫外线
- tlaCallout = function () {
- // 选择目的号码
- var reg1 = /^[0][1-9]{2,3}-[0-9]{5,10}$/;
- var reg2 = /^(0|9|90|86|17951)?(13[0-9]|15[012356789]|166|17[3678]|18[0-9]|14[57])[0-9]{8}$/;
- if (!reg1.test(this.jry_extnNumberObj.tel1) && !reg2.test(this.jry_extnNumberObj.tel1)) {
- this.msg.warning('请输入正确的手机号或座机号')
- return;
- }
- // tlwsa.tlaCallout(this.jry_extnNumberObj.tel1,this.incomingService.getPhoneNumber(),0)
- tlwsa.tlaCallout(this.jry_extnNumberObj.tel1, '3558177', 1);//襄阳主叫号码写死
- }
- // // 转移坐席
- // tlaTransfertoagc = function () {
- // tlwsa.tlaTransfertoagc(this.jry_extnNumberObj.tel2)
- // }
- // 转移外线
- tlaTransferout = function () {
- // 选择转接号码
- var reg1 = /^[0][1-9]{2,3}-[0-9]{5,10}$/;
- var reg2 = /^(0|9|90|86|17951)?(13[0-9]|15[012356789]|166|17[3678]|18[0-9]|14[57])[0-9]{8}$/;
- if (!reg1.test(this.jry_extnNumberObj.tel2) && !reg2.test(this.jry_extnNumberObj.tel2)) {
- this.msg.warning('请输入正确的手机号或座机号')
- return;
- }
- tlwsa.tlaTransferout(this.jry_extnNumberObj.tel2, '3558177', 1);//襄阳主叫号码写死
- }
- // 呼叫中心---end
- onChange(value: number): void {
- console.log(`onChange: ${value}`);
- }
- onAfterChange(value: number): void {
- console.log(`onAfterChange: ${value}`);
- }
- // 来电咨询右侧的tab页
- // 服务台新建工单—根据申请科室id来查询转入院记录(科室id)
- rightTitle_tab:any[] = [
- // { id: 0, name: '近期配送' },
- // { id: 1, name: '转出院记录' },
- // { id: 2, name: '近期维修' },
- // { id: 3, name: '知识库' },
- ]
- currentRTab:any; //当前选中的
- loading5 = false;
- patientLogList = [];
- getPatientLog(id) {
- if(!this.hsmsData.hsmsSwitch){
- return;
- }
- if (id == -1 || id === null || id === undefined) {
- this.patientLogList = [];
- return;
- }
- let postData = {
- patientLog: {
- sqDept: { id },
- hosId: this.checkedHos,
- },
- idx: 0,
- sum: 10000,
- };
- this.loading5 = true;
- this.mainService
- .getFetchDataList("api", "patientLog", postData)
- .subscribe((result) => {
- this.loading5 = false;
- if (result.status == 200) {
- this.patientLogList = result.list;
- }
- });
- }
- rightTitleHandler(i) {
- this.currentRTab = i;
- if (i === 0) {
- this.getWorkOrders(this.applyDept);
- } else if (i === 1) {
- this.getPatientLog(this.applyDept);
- } else if (i === 2) {
- this.getItsmOrders(this.incidentModel.department);
- } else if (i === 3) {
- this.getDictionaryList();
- }
- }
- // 服务台新建工单—根据申请科室id来查询未到达工单(科室id)
- loading4 = false;
- getWorkOrders(id) {
- if(!this.hsmsData.hsmsSwitch){
- return;
- }
- if (id == -1 || id === null || id === undefined) {
- this.noArrives = [];
- return;
- }
- let types = "";
- this.user.user.scope.typeIds.forEach((e) => {
- types += e.id + ",";
- });
- types = types.slice(0, types.length - 1);
- let dataObj = {
- workOrder: {
- serTaskTypes: types,
- serGdState: 4,
- range: "0",
- platform: 3,
- searchDays: 100,
- startDept: {
- id: id,
- },
- },
- idx: 0,
- sum: 5,
- };
- this.loading4 = true;
- this.mainService
- .getFetchDataList("data", "workOrder", dataObj)
- .subscribe((data) => {
- this.loading4 = false;
- if (data.status == 200) {
- this.noArrives = data.list;
- }
- });
- }
- // 服务台新建工单—根据申请科室id来查询
- loading6 = false;
- itsmOrders:any[] = [];
- getItsmOrders(id) {
- if(!this.itsmData.mdv2Switch){
- return;
- }
- if (id == -1 || id === null || id === undefined) {
- this.itsmOrders = [];
- return;
- }
- let postData = {
- incident: {
- "deleteFlag": 0,
- queryTask: 'all',
- department: {
- id,
- },
- },
- idx: 0,
- sum: 6,
- };
- this.loading6 = true;
- this.mainService
- .getFetchDataList("simple/data", "incident", postData)
- .subscribe((data) => {
- this.loading6 = false;
- if (data.status == 200) {
- this.itsmOrders = data.list;
- }
- });
- }
- //获取知识库状态/类型
- getDictionaryList() {
- let solutionStatus$ = this.mainService.getDictionary('list', 'solution_status', true);
- let solutionType$ = this.mainService.getDictionary('list', 'solution_type', true);
- forkJoin(solutionStatus$, solutionType$).subscribe((data:any[]) => {
- let solutionStatusList = data[0] || [];
- let solutionTypeList = data[1] || [];
- this.solutionStatus = solutionStatusList.find(item => item.value == 3);
- console.log('this.solutionStatus:', this.solutionStatus)
- this.solutionType = solutionTypeList.find(item => item.value == 1);
- console.log('this.solutionType:', this.solutionType)
- this.getKnowageList();
- })
- }
- solutionStatus;//知识库状态
- solutionType;//知识库类型
- // 服务台新建工单—知识库
- loading7 = false;
- knowageList:any[] = [];
- getKnowageList() {
- if(!this.itsmData.mdv2Switch){
- return;
- }
- if(!(this.incidentModel.category && this.solutionStatus && this.solutionType)){
- this.loading7 = false;
- this.knowageList = [];
- return;
- }
- this.loading7 = true;
- let postData:any = {
- idx: 0,
- sum: 9999,
- solution: {
- categoryId: this.incidentModel.category,
- status: this.solutionStatus,
- type: this.solutionType,
- },
- };
- this.mainService
- .getFetchDataList('simple/data', 'solution', postData)
- .subscribe((result) => {
- this.loading7 = false;
- if(result.status == 200){
- this.knowageList = result.list || [];
- }else{
- this.msg.error(result.msg || '请求数据失败!');
- }
- });
- }
- // 引入知识库
- solutionId;//引用的知识库Id
- importKnowage(item){
- console.log(item)
- this.incidentModel = {...this.incidentModel, description: `引用知识库解决,知识库编号:${item.solutionNumber}`};
- this.solutionId = item.id;
- }
- // 知识库查看-知道了
- coopData:any = {};
- isShowKnowledge:boolean = false;
- showKnowledgeModal(data) {
- this.coopData = data || {};
- this.isShowKnowledge = true;
- }
- cancelKnowledgeModal(flag) {
- this.isShowKnowledge = false;
- }
- // 定时刷新数据
- refreshTimerId; //定时刷新定时器
- refresh() {
- clearTimeout(this.refreshTimerId);
- this.refreshTimerId = setTimeout(() => {
- this.refresh()
- // 如果没选择复选框
- if (!this.batchType && !this.batchType1) {
- this.orderRefreshTime--;
- }
- this.workerRefreshTime--;
- if (this.orderRefreshTime == 0) {
- this.getUnassignedBuilding2();
- this.getOrderList(1, true);
- this.getOrderList(2);
- this.getOrderList(3);
- this.getVisitList();
- this.getMessageList();
- if (this.currentRTab === 0) {
- this.getWorkOrders(this.applyDept);
- } else if (this.currentRTab === 1) {
- this.getPatientLog(this.applyDept);
- } else if (this.currentRTab === 2) {
- this.getItsmOrders(this.incidentModel.department);
- } else if (this.currentRTab === 3) {
- this.getDictionaryList();
- }
- this.orderRefreshTime = this.orderInfoTime;
- }
- if (this.workerRefreshTime == 0) {
- this.checkTab(this.typeId);
- this.workerRefreshTime = this.workerInfoTime;
- }
- }, 1000);
- }
- resetList() {
- this.unassignedListClone = null;
- this.arriveListClone = null;
- this.batchType = false;
- this.batchType1 = false;
- }
- // 刷新工单列表
- refreshList(e) {
- if (!e.promptContent) {
- return;
- }
- this.getUnassignedBuilding2();
- this.resetList();
- this.getOrderList(1);
- this.getOrderList(2);
- this.getOrderList(3);
- this.getVisitList();
- this.getMessageList();
- if (this.currentRTab === 0) {
- this.getWorkOrders(this.applyDept);
- } else if (this.currentRTab === 1) {
- this.getPatientLog(this.applyDept);
- } else if (this.currentRTab === 2) {
- this.getItsmOrders(this.incidentModel.department);
- } else if (this.currentRTab === 3) {
- this.getDictionaryList();
- }
- }
- // 切换顶部tab栏
- // typeId = -1; //当前选中tab ID
- typeId; //当前选中tab ID
- typeData; //当前选中tab
- wLoading:boolean = false;
- checkTab(typeId) {
- if(!this.hsmsData.hsmsSwitch){
- return;
- }
- let that = this;
- that.typeId = typeId;
- this.typeData = this.scopeGroups.find(v => v.id === typeId);
- if(this.typeData){
- let type = this.typeData.type;
- // 配送
- if(type === 1 || type === 2){
- let postData = {
- groups: [typeId],
- idx: 0,
- sum: 100,
- hosId: this.checkedHos,
- };
- // if (typeId == -1) {
- // let groups = [];
- // that.scopeGroups.forEach((e) => {
- // groups.push(e.id);
- // });
- // postData.groups = groups;
- // }
- if (this.hurseInfoHiding == 1){
- that.workerMessage = [];
- that.initTopCount();
- return;
- }
- this.wLoading = true;
- that.mainService.getSerInfo("getWorkInfo", postData).subscribe((data) => {
- this.wLoading = false;
- that.workerMessage = data.data ? data.data : [];
- that.initTopCount();
- });
- }
- // 运维
- if(type === 3){
- let postData = {
- groups: [typeId],
- };
- if (this.hurseInfoHiding == 1){
- that.workerMessage = [];
- that.initTopCount();
- return;
- }
- this.wLoading = true;
- that.mainService.incidentUserTaskCount(postData).subscribe((data:any) => {
- this.wLoading = false;
- that.workerMessage = data.data ? data.data : [];
- that.initTopCount();
- });
- }
- }
- }
- // 获取回访列表
- visitNum:any;
- getVisitList(){
- if(!this.itsmData.mdv2Switch){
- return;
- }
- let postData: any = {
- idx: 0,
- sum: 1,
- incident: {
- // "groupIds": this.itsmData.allDuty == 1 ? undefined : (this.itsmData.scopeGroups.map(v => v.id).toString() || undefined),
- "dutyIds": this.itsmData.allDuty == 1 ? undefined : (this.itsmData.checkedHos.map(v => v.id).toString() || undefined),
- "urgentType": +this.itsmData.orderScopeRadio + 1,
- "queryTask": "callback",
- "assignee": this.tool.getCurrentUserId(),
- "deleteFlag": 0,
- },
- };
- this.mainService
- .getFetchDataList("simple/data", "incident", postData)
- .subscribe((result) => {
- this.visitNum = result.totalNum;
- });
- }
- // 获取留言列表
- messageNum:any;
- getMessageList(){
- if(!this.itsmData.mdv2Switch){
- return;
- }
- let postData: any = {
- idx: 0,
- sum: 1,
- hjzxRecord: {
- isExcute: 0,
- },
- };
- this.mainService
- .getFetchDataList("simple/data", "hjzxRecord", postData)
- .subscribe((result) => {
- this.messageNum = result.totalNum;
- });
- }
- //trackBy
- trackById(index, item) {
- return item.type + item.data.id;
- }
- // 获取三个状态数据数据
- loading1 = true;
- loading2 = true;
- loading3 = true;
- getOrderList(stateId, isAudio?) {
- this[`loading${stateId}`] = true;
- let keyWords = "";
- let types = "";
- let postData:any = {
- orderType: this.orderType,
- };
- // 配送
- if(this.flagList['hsmsFlag' + stateId]){
- if (stateId == 1) {
- keyWords = this.unassignedSearchCon || "";
- } else if (stateId == 2) {
- keyWords = this.arriveSearchCon || "";
- } else if (stateId == 3) {
- keyWords = this.executionSearchCon || "";
- }
- if (this.user.user.scope) {
- this.user.user.scope.typeIds = this.user.user.scope.typeIds || [];
- }
- if (!this.user.user.scope || !this.user.user.scope.typeIds) {
- this.loading1 = this.loading2 = this.loading3 = false;
- }else{
- this.user.user.scope.typeIds.forEach((e) => {
- types += e.id + ",";
- });
- types = types.slice(0, types.length - 1);
- postData.workOrderQuery = {
- workOrder: {
- serTaskTypes: types || undefined,
- serGdState: stateId,
- range: this.orderScopeRadio,
- platform: 3,
- searchDays: 1,
- keyWord: keyWords,
- },
- idx: 0,
- sum: 1,
- }
- if (this.unassignedBuilding.length && stateId == 1) {
- postData.workOrderQuery.workOrder["deptIds"] = this.unassignedBuilding.toString();
- }
- }
- }
- // 运维
- if(this.flagList['itsmFlag' + stateId]){
- postData.incidentQuery = {
- idx: 0,
- sum: 1,
- }
- if(stateId == 1){
- postData.incidentQuery.incident = {
- // "groupIds": this.itsmData.allDuty == 1 ? undefined : (this.itsmData.scopeGroups.map(v => v.id).toString() || undefined),
- "acceptDutyIds": this.itsmData.allDuty == 1 ? undefined : (this.itsmData.checkedHos.map(v => v.id).toString() || undefined),
- "urgentType": +this.itsmData.orderScopeRadio + 1,
- "queryTask": "storageAcceptReassign",
- "assignee": this.tool.getCurrentUserId(),
- "deleteFlag": 0,
- }
- }else if(stateId == 2){
- postData.incidentQuery.incident = {
- // "groupIds": this.itsmData.allDuty == 1 ? undefined : (this.itsmData.scopeGroups.map(v => v.id).toString() || undefined),
- "dutyIds": this.itsmData.allDuty == 1 ? undefined : (this.itsmData.checkedHos.map(v => v.id).toString() || undefined),
- "urgentType": +this.itsmData.orderScopeRadio + 1,
- "queryTask": "todoState",
- "deleteFlag": 0,
- }
- }else if(stateId == 3){
- postData.incidentQuery.incident = {
- // "groupIds": this.itsmData.allDuty == 1 ? undefined : (this.itsmData.scopeGroups.map(v => v.id).toString() || undefined),
- "dutyIds": this.itsmData.allDuty == 1 ? undefined : (this.itsmData.checkedHos.map(v => v.id).toString() || undefined),
- "urgentType": +this.itsmData.orderScopeRadio + 1,
- "queryTask": "doing",
- "assignee": this.tool.getCurrentUserId(),
- "deleteFlag": 0,
- "platform": 3,
- }
- }
- }
- console.log(postData);
- this.mainService.orderList(postData).subscribe((data:any) => {
- if (stateId == 1) {
- // 未分派
- let unassignedList = data.data || [];
- unassignedList.forEach((item) => {
- item.checked = false;
- if(item.type === 'mdv2'){
- item.computedSubstitutionFlag = this.computedSubstitution(item.data)
- item.computedReceiveFlag = this.computedReceive(item.data)
- item.computedEditFlag = this.computedEdit(item.data)
- }
- });
- this.unassignedList = unassignedList;
- this.batchType = false;
- this.allUnassignedList = false;
- this.unassignedListClone = cloneDeep(this.unassignedList);
- if (this.audioNotDispatched && this.unassignedList.length > 0 && isAudio) {
- //语音播报开启
- let audio = document.createElement("audio");
- audio.src = "./../../assets/audio/audioNotDispatched.mp3";
- audio.addEventListener("canplay", function () {
- //监听audio是否加载完毕
- audio.play();
- });
- }
- this.loading1 = false;
- } else if (stateId == 2) {
- // 待到达
- let arriveList = data.data || [];
- arriveList.forEach((item) => {
- item.checked = false;
- if(item.type === 'mdv2'){
- item.computedSubstitutionFlag = this.computedSubstitution(item.data)
- item.computedReceiveFlag = this.computedReceive(item.data)
- item.computedEditFlag = this.computedEdit(item.data)
- }
- });
- this.arriveList = arriveList;
- this.batchType1 = false;
- this.allArriveList = false;
- this.arriveListClone = cloneDeep(this.arriveList);
- this.loading2 = false;
- } else if (stateId == 3) {
- // 执行中
- let executionList = data.data || [];
- executionList.forEach((item) => {
- if(item.type === 'mdv2'){
- item.computedSubstitutionFlag = this.computedSubstitution(item.data)
- item.computedHandleFlag = this.computedHandle(item.data)
- item.computedEditFlag = this.computedEdit(item.data)
- }
- });
- this.executionList = executionList;
- this.loading3 = false;
- }
- if (keyWords) {
- this.loading1 = this.loading2 = this.loading3 = false;
- }
- });
- }
- // 计算顶部行数
- showRowNum: number; // 已展示行数
- maxNum: number; //可展示行数最大值
- initTopCount() {
- let that = this;
- that.maxNum = Math.ceil(that.workerMessage.length / that.patientCareCol);
- that.showRowNum = that.patientCareCol == 6 ? 4 : 2;
- console.log(that.maxNum, that.showRowNum);
- that.cotHeight = 140;
- }
- // 展开顶部列表
- unfold() {
- if (this.showRowNum < this.maxNum && this.patientCareCol != 6) {
- this.cotHeight += 70;
- this.showRowNum++;
- } else if (this.showRowNum < this.maxNum && this.patientCareCol == 6) {
- this.cotHeight += 35;
- this.showRowNum++;
- } else {
- return;
- }
- }
- // 收起顶部列表
- retract() {
- this.showRowNum = this.patientCareCol == 6 ? 4 : 2;
- this.cotHeight = 140;
- }
- // 查看工单详情
- openDetails(data) {
- if (data.taskType.associationType.value == 'specimen' || data.taskType.associationType.value == 'specimenPlan') {
- // 标本类
- this.router.navigateByUrl("dispatchingDesk/detailSample/" + data.id);
- } else if (data.taskType.associationType.value == 'inspect' || data.taskType.associationType.value == 'patientTransport') {
- // 送患者
- this.router.navigateByUrl("dispatchingDesk/detailPatients/" + data.id);
- } else if (data.taskType.associationType.value == 'drugsBag' || data.taskType.associationType.value == 'jPBag') {
- // 药品配送/静配
- this.router.navigateByUrl("dispatchingDesk/detailDrug/" + data.id);
- } else if (data.taskType.associationType.value == 'ordinary') {
- // 万能交接服务
- this.router.navigateByUrl("dispatchingDesk/detailOrdinary/" + data.id);
- } else {
- // 其他
- this.router.navigateByUrl("dispatchingDesk/detailOthers/" + data.id);
- }
- }
- // 查看ITSM工单详情
- detailModalShow = false; //弹窗开关
- openItsmDetails(data) {
- this.coopData = data;
- this.detailModalShow = true;
- }
- // 关闭弹窗
- closeDetailModelOrder(e) {
- this.detailModalShow = JSON.parse(e).show;
- }
- // 弹窗确定
- confirmDetailModelOrder(e){
- console.log(e);
- this.detailModalShow = false;
- }
- // 选择楼栋
- changeUnassignedBuilding(e) {
- this.getOrderList(1);
- }
- // 未分派搜索
- searchUnassigned() {
- this.getOrderList(1);
- }
- // 待到达搜索
- searchArrive() {
- this.getOrderList(2);
- }
- // 执行中搜索
- searchExecution() {
- this.getOrderList(3);
- }
- // 派单,flag是否是下班后进入未分派的单子
- allotWorker(id, stateId, flag?) {
- if (flag == 1) {
- this.router.navigateByUrl(
- "dispatchingDesk/allotWorker/" +
- id +
- "/" +
- stateId +
- "/1/" +
- this.checkedHos
- );
- } else {
- this.router.navigateByUrl(
- "dispatchingDesk/allotWorker/" +
- id +
- "/" +
- stateId +
- "/0/" +
- this.checkedHos
- );
- }
- }
- // 右侧菜单
- showLastItems: boolean = false;
- // 下拉
- fixedMenuXiala() {
- this.showLastItems = true;
- }
- // 上拉
- fixedMenuShangla() {
- this.showLastItems = false;
- this.fixedTab = "";
- }
- // 退出系统
- logOut(): void {
- this.logoutModal = true;
- }
- // 确认退出
- confirmLogout() {
- this.btnLoading = true;
- // 假退出
- this.btnLoading = false;
- this.closeLogoutModal();
- let hospital = this.tool.getCurrentHospital();
- if(hospital){
- this.router.navigate(["login", hospital.id]);
- }else{
- this.router.navigateByUrl("login");
- }
- localStorage.removeItem("user");
- localStorage.removeItem("menu");
- this.incomingService.removePhoneNumber();
- this.incomingService.removePhoneNumberPre();
- this.incomingService.removeSocketUrl();
- this.incomingService.removeSign();
- this.incomingService.removePhoneNumberPre();
- localStorage.removeItem("index");
- // 假退出
- this.mainService.logOut().subscribe((data) => {
- this.btnLoading = false;
- this.closeLogoutModal();
- if (data.status == 200) {
- if(hospital){
- this.router.navigate(["login", hospital.id]);
- }else{
- this.router.navigateByUrl("login");
- }
- localStorage.removeItem("user");
- localStorage.removeItem("menu");
- this.incomingService.removePhoneNumber();
- this.incomingService.removeSocketUrl();
- this.incomingService.removeSign();
- this.incomingService.removePhoneNumberPre();
- localStorage.removeItem("index");
- }
- });
- }
- // 关闭模态框
- closeLogoutModal() {
- this.logoutModal = false;
- }
- // 切换右侧菜单Tab
- fixedTab: string = "";
- checkFixedTab(type: string) {
- if (type == "toSystem") {
- this.router.navigateByUrl("main");
- return;
- }
- if (type == "logout") {
- this.logOut();
- }
- if (type == "nucleicAcidPrinting") {
- this.getNucleicAcidBuildingSummary();
- }
- if (this.fixedTab == type) {
- this.fixedTab = "";
- } else {
- this.fixedTab = type;
- }
- }
- // 护工信息展示形式
- // changPatientCareCol(e) {
- // this.initTopCount();
- // }
- // 获取配置文件写死的任务类型ID(送病人回病房9),选择此任务类型的话,患者信息从终点科室获取
- getConfigTasktypeLoading: boolean = false;
- getConfigTasktype() {
- if(!this.hsmsData.hsmsSwitch){
- return;
- }
- let postData = {
- idx: 0,
- sum: 1,
- hospitalConfig: {
- hosId: this.checkedHos,
- key: "transDeptTypeId",
- },
- };
- this.getConfigTasktypeLoading = true;
- this.mainService.getFetchDataList("simple/data", "hospitalConfig", postData).subscribe(res => {
- this.getConfigTasktypeLoading = false;
- if (res && res.status == 200) {
- this.deathTasktypeId = res.list.length ? res.list[0].value : undefined;
- } else {
- this.msg.error('请求数据失败');
- }
- });
- }
- // 获取配置文件写死的任务类型ID(转科,给转出院记录用6)
- patientLogTasktypeLoading: boolean = false;
- patientLogTasktype() {
- if(!this.hsmsData.hsmsSwitch){
- return;
- }
- let postData = {
- idx: 0,
- sum: 1,
- systemConfiguration: {
- keyconfig: "transDeptTypeId",
- },
- };
- this.patientLogTasktypeLoading = true;
- this.mainService.getFetchDataList("simple/data", "systemConfiguration", postData).subscribe(res => {
- this.patientLogTasktypeLoading = false;
- if (res.status == 200) {
- this.deathTasktypeIdPatient = res.list.length ? res.list[0].valueconfig : undefined;
- } else {
- this.msg.error('请求数据失败');
- }
- });
- }
- // 重置新建工单数据
- resetOrderData(){
- this.applicationRequesterList = [];
- this.fileList = [];
- this.repairImgs = [];
- this.isRelatedDepartment = true;
- this.solutionId = undefined;
- }
- // 重置新建工单数据-继续建单-编辑-报修转事件
- resetOrderData2(){
- this.fileList = [];
- this.repairImgs = [];
- if(this.incidentModel.repairIncidentType === 'public'){
- this.isRelatedDepartment = false;
- }else{
- this.isRelatedDepartment = true;
- }
- }
- // 打开新建工单
- deathTasktypeId; //获取这个写死的任务类型的id,送病人回病房
- deathTasktypeIdPatient; //获取这个写死的任务类型的id,转出院记录
- async showNewOrder(des = '', phone = '', isInit = false, buildType = '') {
- if(this.incomingService.getSign() === 'callCenter' && this.incomingService.getPhoneNumber()){
- //进入弹窗,强制示忙
- setTimeout(()=>{
- tlwsa.tlaAcw();
- },0)
- }
- this.buildType = buildType;
- if(this.itsmData.mdv2Switch){
- if(this.buildType !== '继续建单' && this.buildType !== '编辑事件' && this.buildType !== '报修转事件'){
- this.resetOrderData();
- }else{
- this.resetOrderData2();
- }
- this.searchApplicationHospital();
- this.searchApplicationCategory();
- this.searchApplicationPriority();
- this.searchApplicationSource();
- this.getRepairIncidentType();
- isInit ? this.searchApplicationDepartment('itsm', undefined, undefined, undefined, true) : this.searchApplicationDepartment('itsm');
- isInit && ((this.isRelatedDepartment && this.incidentModel.department) || (!this.isRelatedDepartment && this.incidentModel.hosId) || this.buildType === '报修转事件' ) && this.incidentModel.hosId && this.searchApplicationBuilding();
- isInit && this.incidentModel.area && this.searchApplicationFloor();
- if(!this.hsmsData.hsmsSwitch){
- this.taskBuild = null;
- this.newOrderShow = true;
- this.newOrderShowOpen = true;
- this.fixedTab = "newOrder";
- this.currentRTab = 0;
- this.rightTitle_tab = [];
- this.incidentModel = isInit ? this.incidentModel : { repairIncidentType: 'dept' };
- this.incidentMsg = isInit ? this.incidentMsg : {};
- this.isBuildOrderAgagin = false;
- this.applyDept = null;
- this.countRemarkIndex = -1;
- this.incidentModel.department = isInit ? this.incidentModel.department : null;
- //正常初始化
- this.getAutoWorkTypes(false, isInit);
- return;
- }
- }
- // 预约相关重置
- this.yyDateZy = new Date();
- this.yyDate = new Date();
- this.yyTimeZy = null;
- this.yyTime = null;
- this.isYyInspect = false;
- this.clickYYZyFlag = false;
- this.clickYYFlag = false;
- if(!isInit && this.hsmsData.hsmsSwitch){
- if(!this.deathTasktypeId){
- // 送病人回病房
- this.msg.error('【送病人回病房】未配置');
- return;
- }
- if(!this.deathTasktypeIdPatient){
- // 转出院记录
- this.msg.error('【转出院记录】未配置');
- return;
- }
- }
- this.taskBuild = null;
- this.newOrderShow = true;
- this.newOrderShowOpen = true;
- this.fixedTab = "newOrder";
- this.currentRTab = 0;
- this.rightTitle_tab = [];
- this.incidentModel = isInit ? this.incidentModel : { repairIncidentType: 'dept' };
- this.incidentMsg = isInit ? this.incidentMsg : {};
- this.isBuildOrderAgagin = false;
- this.applyDept = null;
- this.countRemarkIndex = -1;
- this.incidentModel.department = isInit ? this.incidentModel.department : null;
- console.log(des);
- if (des === "no") {
- //没绑定科室
- this.searchApplicationDepartment("hsms", "", phone);
- this.noWorkerPhone = false;
- } else if (des === "yes") {
- //绑定了科室
- this.searchApplicationDepartment("hsms", "&ks&");
- this.noWorkerPhone = false;
- } else if (des === "&go&") {
- //继续建单
- this.searchApplicationDepartment("hsms", "&go&");
- this.noWorkerPhone = false;
- } else {
- //正常初始化
- this.searchApplicationDepartment("hsms");
- this.noWorkerPhone = true;
- }
- this.getSearchTaskList("").subscribe((result) => {
- if (result.status == 200) {
- this.searchTaskLoading = false;
- this.searchTaskList = result.data;
- this.searchTaskList.forEach((item) => {
- item.sid = item.associationTypeId + "_" + item.id + "_" + item.associationTypeValue;
- });
- // if(phone){
- // this.getAutoWorkTypes(true, isInit);
- // }else{
- // this.getAutoWorkTypes(false, isInit);
- // }
- this.getAutoWorkTypes(false, isInit);
- }
- });
- }
- // 获取可选择的任务类型列表
- searchTaskList;
- searchTaskLoading = false;
- getSearchTaskList(keyword, countRemark = '') {
- if(!this.hsmsData.hsmsSwitch){
- return;
- }
- this.searchTaskLoading = true;
- return this.mainService.getTaskTypeBySearchKey({
- searchKey: keyword || undefined,
- countRemark: countRemark || undefined,
- hosId: this.checkedHos,
- });
- }
- getPhoneNum(flag = true) {
- if (!flag) {
- //切换院区的时候清除掉缓存中的号码
- this.incomingService.removePhoneNumber();
- }
- if (this.incomingService.getPhoneNumber()) {
- this.getWebsocketPhone(this.incomingService.getPhoneNumber());
- }else{
- this.websocketLoading = false;
- }
- }
- // 点击tab切换
- tabClick(key, isInit = false) {
- let preCurrentTabIndex = this.currentTabIndex;
- this.currentTabIndex = key;
- this.radioValueQt = null;
- this.startDeptQt = null;
- this.endDeptQt = null;
- this.radioValueZy = null;
- this.startDeptZy = null;
- this.endDeptZy = null;
- this.patientZy = null;
- this.goodsNow = [];
- this.workOrderRemark = "";
- this.deptZyList["startDept"] = [];
- this.deptZyList["endDept"] = [];
- this.deptZyList["startStatus"] = 0;
- this.deptZyList["endStatus"] = 0;
- this.deptQtList["startDept"] = [];
- this.deptQtList["endDept"] = [];
- this.deptQtList["startStatus"] = 0;
- this.deptQtList["endStatus"] = 0;
- if(preCurrentTabIndex === '故障报修'){
- if(this.applyDept){
- this.rightTitle_tab = [
- { id: 0, name: '近期配送' },
- { id: 1, name: '转出院记录' },
- ]
- this.rightTitleHandler(this.rightTitle_tab[0].id);
- }
- let deptObj = this.applicationDeptList.find(v => v.id == this.incidentModel.department);
- if(this.applyDept != this.incidentModel.department){
- this.applyDept = this.incidentModel.department;
- this.searchApplicationDepartment('hsms', deptObj ? deptObj.dept : '', undefined, this.incidentModel.department);
- }
- }else if(this.currentTabIndex === '故障报修'){
- if(this.incidentModel.department){
- this.rightTitle_tab = [
- { id: 2, name: '近期维修' },
- { id: 3, name: '知识库' },
- ]
- this.rightTitleHandler(this.rightTitle_tab[0].id);
- }
- let deptObj = this.applicationDepartmentList.find(v => v.id == this.applyDept);
- if(this.incidentModel.department != this.applyDept && (!isInit || !this.buildType)){
- this.incidentModel.department = this.applyDept;
- this.searchApplicationDepartment('itsm', deptObj ? deptObj.dept : '', undefined, this.applyDept);
- }
- }
- }
- // 获取患者信息
- searchPatientList(id, searchWords) {
- this.searchPatientListSubject.next([id, searchWords]);
- }
- // 获取患者信息
- isLoadingPatient: boolean = false;
- getPatientList(id, searchWords) {
- let dataObj = { searchWords, deptId: id };
- this.isLoadingPatient = true;
- this.mainService.getPatientList(dataObj).subscribe((result) => {
- this.isLoadingPatient = false;
- if (result["state"] == 200) {
- this.patientList = result["data"];
- if (this.patientList.length) {
- this.patientList = this.patientList.filter((item) => !!item.bednum);
- }
- }
- });
- }
- // tab任务类型向左移动
- toLeft() {
- let maxStep = this.workTypesArrange.length - 5;
- this.disStep = Math.max(-maxStep, --this.disStep);
- this.disX = (this.disStep * this.elementView.nativeElement.offsetWidth) / 5;
- }
- // tab任务类型向右移动
- toRight() {
- this.disStep = Math.min(0, ++this.disStep);
- this.disX = (this.disStep * this.elementView.nativeElement.offsetWidth) / 5;
- }
- // 边输边搜节流阀
- // WS;//边输入边搜索的定时器
- WSNum = 0;
- changeInp(type, e) {
- this.changeInpSubject.next([type, e]);
- }
- changeCommonInp(type, e) {
- this.changeCommonInpSubject.next([type, e]);
- }
- // 院区列表
- applicationHospitalList:any[] = [];
- searchApplicationHospital() {
- let dataObj = {
- idx: 0,
- sum: 9999,
- hospital: {
- selectType:'level1',
- },
- };
- this.isLoading = true;
- this.mainService
- .getFetchDataList("data", "hospital", dataObj)
- .subscribe((data) => {
- this.isLoading = false;
- if (data.status == 200) {
- this.applicationHospitalList = data.list;
- }
- });
- }
- // 选择院区
- changeApplyHospital(e){
- console.log(e);
- this.incidentModel.department = undefined;
- this.searchApplicationDepartment('itsm');
- if(this.buildType !== '报修转事件'){
- this.incidentModel.requester = undefined;
- this.searchApplicationRequester();
- }
- this.applicationRequesterList = [];
- this.incidentModel.area = undefined;
- this.searchApplicationBuilding();
- this.incidentModel.place = undefined;
- this.applicationFloorList = [];
- this.incidentModel.houseNumber = undefined;
- this.incidentModel.duty = undefined;
- // 根据院区和故障现象带出责任部门,优先级,维修人/组
- if(this.incidentModel.category && e && this.buildType !== '编辑事件'){
- let postData = {
- idx: 0,
- sum: 9999,
- incidentCategoryConfig: {
- categoryId: this.incidentModel.category,
- hosId: e,
- },
- };
- console.log(postData);
- // return;
- this.isLoading = true;
- this.mainService
- .getFetchDataList("simple/data", "incidentCategoryConfig", postData)
- .subscribe((data) => {
- this.isLoading = false;
- if (data.status == 200) {
- let list = data.list || [];
- if(list.length > 0){
- console.log(list[0]);
- this.incidentCategoryConfig = list[0];
- }else{
- this.incidentCategoryConfig = {};
- }
- // 根据院区和故障现象带出责任部门,优先级,维修人/组
- this.incidentModel.duty = this.incidentCategoryConfig.dutyDTO;
- this.incidentModel.priorityId = this.incidentCategoryConfig.priority;
- // 回显维修人/组
- this.showGroupOrUser();
- }
- });
- }else{
- this.incidentModel.group = undefined;
- this.applicationGroupList = [];
- this.incidentModel.user = undefined;
- this.applicationUserList = [];
- }
- }
- // 申请人列表(搜索)
- applicationRequesterList:any[] = [];
- isRelatedDepartment:boolean = true;
- searchApplicationRequester(keyWord?) {
- // 关联查询,且没选择申请科室
- if(this.isRelatedDepartment && !this.incidentModel.department){
- this.applicationRequesterList = [];
- return;
- }
- // 不关联查询,且没选择院区
- if(!this.isRelatedDepartment && !this.incidentModel.hosId){
- this.applicationRequesterList = [];
- return;
- }
- let postData = {
- idx: 0,
- sum: 20,
- user: {
- hospital: this.isRelatedDepartment ? undefined : { id: this.incidentModel.hosId },
- dept: this.isRelatedDepartment ? { id: this.incidentModel.department } : undefined,
- name: keyWord,
- // simpleQuery: true,
- },
- };
- this.isLoading = true;
- this.mainService
- .getFetchDataList("simple/data", "user", postData)
- .subscribe((data) => {
- this.isLoading = false;
- if (data.status == 200) {
- this.applicationRequesterList = data.list;
- }
- });
- }
- // 修改申请人
- changeApplyRequester(e){
- console.log(e)
- let userObj = this.applicationRequesterList.find(v => v.id == e);
- // 选择申请人回显申请人电话
- if(userObj){
- this.incidentMsg.requesterPhone = userObj.phone;
- }
- }
- // 故障现象列表
- applicationCategoryList:any[] = [];
- searchApplicationCategory(keyWord?) {
- let dutyIds;
- if(this.buildType === '编辑事件'){
- dutyIds = this.incidentModel.duty.id.toString();
- }else{
- dutyIds = this.itsmData.checkedHos.length ? (this.itsmData.checkedHos.map(v => v.id).toString() || undefined) : undefined;
- }
- let postData = {
- category: {
- category: keyWord,
- selectType: 'mutlQuery',
- hierarchy: 3,//只差有三级的故障现象列表
- dutyIds,
- },
- };
- console.log(postData);
- // return;
- this.isLoading = true;
- this.mainService
- .incidentPost("listIncidentCategory", postData)
- .subscribe((data) => {
- this.isLoading = false;
- if (data.status == 200) {
- this.applicationCategoryList = data.data;
- }
- });
- }
- // 修改故障现象
- incidentCategoryConfig:any = {};//当前匹配的故障现象规则
- changeApplyCategory(e, isCoverage = false){
- console.log(e)
- // 知识库
- this.getKnowageList();
- if(e && !isCoverage){
- // 根据故障现象带出故障描述
- if(this.incidentModel.description){
- this.incidentModel.description = this.incidentModel.description + ';' + this.applicationCategoryList.find(v => v.id == e).mutiCategory;
- }else{
- this.incidentModel.description = this.applicationCategoryList.find(v => v.id == e).mutiCategory;
- }
- }
- // 根据院区和故障现象带出责任部门,优先级,维修人/组
- if(this.incidentModel.hosId && e && this.buildType !== '编辑事件'){
- let postData = {
- idx: 0,
- sum: 9999,
- incidentCategoryConfig: {
- categoryId: e,
- hosId: this.incidentModel.hosId,
- },
- };
- console.log(postData);
- // return;
- this.isLoading = true;
- this.mainService
- .getFetchDataList("simple/data", "incidentCategoryConfig", postData)
- .subscribe((data) => {
- this.isLoading = false;
- if (data.status == 200) {
- let list = data.list || [];
- if(list.length > 0){
- console.log(list[0]);
- this.incidentCategoryConfig = list[0];
- }else{
- this.incidentCategoryConfig = {};
- }
- // 根据院区和故障现象带出责任部门,优先级,维修人/组
- this.incidentModel.duty = this.incidentCategoryConfig.dutyDTO;
- this.incidentModel.priorityId = this.incidentCategoryConfig.priority;
- // 回显维修人/组
- this.showGroupOrUser();
- }
- });
- }else{
- this.incidentModel.group = undefined;
- this.applicationGroupList = [];
- this.incidentModel.user = undefined;
- this.applicationUserList = [];
- }
- }
- // 直接解决-弹窗
- directOrderModalShow = false; //弹窗开关
- showDirectOrder() {
- this.directOrderModalShow = true;
- }
- // 关闭弹窗
- closeDirectOrderModelOrder(e) {
- this.directOrderModalShow = JSON.parse(e).show;
- }
- // 弹窗确定
- confirmDirectOrderModelOrder(incidentModel){
- console.log(incidentModel);
- this.maskFlag = this.msg.loading("正在加载中..", {
- nzDuration: 0,
- }).messageId;
- this.incidentModel = {...this.incidentModel, ...incidentModel};
- let category = this.applicationCategoryList.find(v => v.id == this.incidentModel.category);
- let postData:any = {
- solutionId: this.solutionId,
- "incident": {
- "id": this.incidentModel.id || undefined,
- "deleteFlag": 0,
- "duty": this.incidentModel.duty ? { id: this.incidentModel.duty.id } : undefined,
- "requester": this.incidentModel.requester ? { id: this.incidentModel.requester } : undefined,
- "repairIncidentType": this.incidentModel.repairIncidentType ? this.repairIncidentTypeList.find(v => v.value === this.incidentModel.repairIncidentType) : undefined,
- "alarmType": false,
- "department": this.incidentModel.department ? { id: this.incidentModel.department } : undefined,
- "contactsInformation": this.incidentModel.contactsInformation,
- "contacts": this.incidentModel.contacts,
- "hosId": this.incidentModel.hosId || undefined,
- "area": this.incidentModel.area ? { id: this.incidentModel.area } : undefined,
- "place": this.incidentModel.place ? { id: this.incidentModel.place } : undefined,
- "houseNumber": this.incidentModel.houseNumber,
- "category": this.incidentModel.category ? { id: this.incidentModel.category } : undefined,
- "priorityId": this.incidentModel.priorityId || undefined,
- "source": this.incidentModel.source ? { id: this.incidentModel.source } : undefined,
- // "title": category.mutiCategory,
- "description": this.incidentModel.description,
- "directProcess": 1,
- "handleDescription": this.incidentModel.handleDescription,
- "handlingPersonnelUser": {id: this.tool.getCurrentUserId()},
- "yyTime": this.incidentModel.yyTime ? format(new Date(this.incidentModel.yyTime), 'yyyy-MM-dd HH:mm:ss') : undefined,
- "closecode": this.incidentModel.closecode ? { id: this.incidentModel.closecode } : undefined,
- "acceptUser": { id: this.tool.getCurrentUserId() },
- "callID": this.incidentModel.callID || undefined,
- "incomingPhone": this.incidentModel.incomingPhone || undefined,
- "hjzxRecordId": this.incidentModel.hjzxRecordId || undefined,
- },
- };
- if(this.buildType){
- if(this.buildType === '报修转事件'){
- postData.incident.fromWx = true;
- }
- if(this.buildType !== '继续建单' && this.buildType !== '编辑事件' && this.buildType !== '报修转事件'){
- postData.incident = Object.assign({}, postData.incident);
- }else{
- postData.incident = Object.assign({}, this.editOrder, postData.incident);
- }
- }
- this.mainService
- .flowPost("incident/task/accept", postData)
- .subscribe((result) => {
- this.msg.remove(this.maskFlag);
- this.maskFlag = false;
- if (result.state == 200) {
- // 图片上传
- if(this.fileList.length){
- console.log(this.fileList.map(v => v.originFileObj));
- this.fileList.map(v => v.originFileObj).forEach(async file => {
- await this.uploadImages(file, result.data.id);
- })
- }
- this.directOrderModalShow = false;
- // this.msg.success('直接解决成功');
- this.isBuildOrderAgaginFn();
- } else {
- this.msg.error(result.msg || '直接解决失败');
- }
- });
- }
- // 回显维修人/组
- showGroupOrUser(){
- // 先判断科室绑定人/组
- if(this.incidentModel.department && this.incidentModel.category && this.incidentModel.duty){
- let postData = {
- idx: 0,
- sum: 10,
- incidentAssignManager: {
- deptId: this.incidentModel.department,
- categoryId: this.incidentModel.category,
- hosId: this.incidentModel.duty.id,
- operationType: 'queryConfig',
- },
- };
- this.mainService
- .getFetchDataList("simple/data", "incidentAssignManager", postData)
- .subscribe((result) => {
- if (result.status == 200) {
- var deptBinduserConfig = result.list.length ? result.list[0] : null;//获取第一条配置
- if(deptBinduserConfig){
- console.log('deptBinduserConfig:', deptBinduserConfig)
- // 如果有科室绑定人员的配置
- if(deptBinduserConfig.handleGroupDTO){
- this.incidentModel.group = deptBinduserConfig.handleGroupDTO.id;
- this.applicationGroupList = [deptBinduserConfig.handleGroupDTO];
- }else{
- this.incidentModel.group = undefined;
- this.applicationGroupList = [];
- }
- if(deptBinduserConfig.handleUserDTO){
- this.incidentModel.user = deptBinduserConfig.handleUserDTO.id;
- this.applicationUserList = [deptBinduserConfig.handleUserDTO];
- }else{
- this.incidentModel.user = undefined;
- this.applicationUserList = [];
- }
- }else{
- if(this.incidentModel.category){
- // 选择了故障现象
- if(this.incidentCategoryConfig.groupId && this.incidentCategoryConfig.groupDTO){
- this.incidentModel.group = this.incidentCategoryConfig.groupId;
- this.applicationGroupList = [this.incidentCategoryConfig.groupDTO];
- }else{
- this.incidentModel.group = undefined;
- this.applicationGroupList = [];
- }
- if(this.incidentCategoryConfig.userId && this.incidentCategoryConfig.userDTO){
- this.incidentModel.user = this.incidentCategoryConfig.userId;
- this.applicationUserList = [this.incidentCategoryConfig.userDTO];
- }else{
- this.incidentModel.user = undefined;
- this.applicationUserList = [];
- }
- }
- }
- }
- });
- }else{
- if(this.incidentModel.category){
- // 选择了故障现象
- if(this.incidentCategoryConfig.groupId && this.incidentCategoryConfig.groupDTO){
- this.incidentModel.group = this.incidentCategoryConfig.groupId;
- this.applicationGroupList = [this.incidentCategoryConfig.groupDTO];
- }else{
- this.incidentModel.group = undefined;
- this.applicationGroupList = [];
- }
- if(this.incidentCategoryConfig.userId && this.incidentCategoryConfig.userDTO){
- this.incidentModel.user = this.incidentCategoryConfig.userId;
- this.applicationUserList = [this.incidentCategoryConfig.userDTO];
- }else{
- this.incidentModel.user = undefined;
- this.applicationUserList = [];
- }
- }
- }
- }
- // 图片相关
- showUploadList = {
- showPreviewIcon: true,
- showRemoveIcon: true,
- hidePreviewIconInNonImage: true
- };
- fileList = [
- // {
- // uid: -1,
- // name: 'xxx.png',
- // status: '1',
- // url: 'https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png'
- // }
- ];
- previewImage: string | undefined = '';
- previewVisible = false;
- handlePreview = (file: UploadFile) => {
- console.log('file1:', file)
- this.previewImage = file.url || file.thumbUrl;
- this.previewVisible = true;
- };
- beforeUpload = (file: UploadFile): boolean => {
- console.log('file2:', file)
- this.fileList = [...this.fileList, file];
- setTimeout(async () => {
- file.url = await this.getBase64(file);
- }, 0);
- console.log('this.fileList:', this.fileList)
- return true;
- };
- getBase64(file: any): Promise<any> {
- return new Promise((resolve, reject) => {
- const reader = new FileReader();
- reader.readAsDataURL(file);
- reader.onload = () => resolve(reader.result);
- reader.onerror = error => reject(error);
- });
- }
- // 临时上传图片
- temporarilyUrl = this.mainService.returnUploadUrl('temporarily', 0);
- // 处理组列表
- applicationGroupList:any[] = [];
- searchApplicationGroup(keyWord?) {
- if(!this.incidentModel.duty){
- this.incidentModel.group = undefined;
- this.applicationGroupList = [];
- this.incidentModel.user = undefined;
- this.applicationUserList = [];
- return;
- }
- let postData = {
- idx: 0,
- sum: 20,
- group2: {
- groupName: keyWord,
- hospitals: this.incidentModel.duty ? this.incidentModel.duty.id.toString() : undefined,
- type: 3,
- },
- };
- this.isLoading = true;
- this.mainService
- .getFetchDataList("simple/data", "group2", postData)
- .subscribe((data) => {
- this.isLoading = false;
- if (data.status == 200) {
- this.applicationGroupList = data.list;
- }
- });
- }
- // 修改处理组
- changeApplyGroup(e){
- console.log(e);
- this.incidentModel.user = undefined;
- this.searchApplicationUser();
- }
- // 处理人列表
- applicationUserList:any[] = [];
- searchApplicationUser(keyWord?) {
- let postData = {
- idx: 0,
- sum: 20,
- user: {
- name:keyWord,
- hospital: this.incidentModel.duty ? { id: this.incidentModel.duty.id } : undefined,
- groupdata: this.incidentModel.group ? { id: this.incidentModel.group } : undefined,
- roleCodes: 'first-line support',
- engineer: 1,
- simpleQuery: true,
- },
- };
- this.isLoading = true;
- this.mainService
- .getFetchDataList("simple/data", "user", postData)
- .subscribe((data) => {
- this.isLoading = false;
- if (data.status == 200) {
- this.applicationUserList = data.list;
- }
- });
- }
- // 优先级列表
- applicationPriorityList:any[] = [];
- searchApplicationPriority(keyWord?) {
- let postData = {
- idx: 0,
- sum: 9999,
- priority: {},
- };
- this.isLoading = true;
- this.mainService
- .getFetchDataList("simple/data", "priority", postData)
- .subscribe((data) => {
- this.isLoading = false;
- if (data.status == 200) {
- this.applicationPriorityList = data.list;
- // 回显事件来源
- let source = this.applicationSourceList.find(v => v.value === 'phone');
- if(!this.incidentModel.source && source){
- this.incidentModel.source = source.id;
- }
- }
- });
- }
- // 事件来源列表
- applicationSourceList:any[] = [];
- searchApplicationSource(keyWord?) {
- this.mainService.getDictionary("list", "incident_source").subscribe((data) => {
- this.applicationSourceList = data || [];
- });
- }
- // 报修类型列表
- repairIncidentTypeList:any[] = [];
- getRepairIncidentType() {
- this.mainService.getDictionary("list", "repair_incident_type").subscribe((data) => {
- this.repairIncidentTypeList = data || [];
- });
- }
- // 选择报修类型
- changeRepairIncidentType(value){
- this.incidentModel.department = undefined;
- this.incidentMsg.deptManyPhone = '';
- this.isRelatedDepartment = value !== 'public';
- this.changeApplyRelatedDepartment(this.isRelatedDepartment);
- }
- // 楼栋列表
- applicationBuildingList:any[] = [];
- searchApplicationBuilding(keyWord?, buildingId?) {
- let postData = {
- idx: 0,
- sum: 9999,
- building: {
- cascadeHosId: this.incidentModel.hosId,
- },
- };
- this.isLoading = true;
- this.mainService
- .getFetchDataList("simple/data", "building", postData)
- .subscribe((data) => {
- this.isLoading = false;
- if (data.status == 200) {
- this.applicationBuildingList = data.list;
- if(buildingId){
- let hasBuildingId = this.applicationBuildingList.some(v => v.id == buildingId);
- if(hasBuildingId){
- this.incidentModel.area = buildingId;
- }else{
- this.incidentModel.area = undefined;
- }
- }
- }
- });
- }
- // 修改楼栋
- changeApplyBuilding(e){
- console.log(e)
- this.incidentModel.place = undefined;
- this.searchApplicationFloor();
- }
- // 楼层列表
- applicationFloorList:any[] = [];
- searchApplicationFloor(keyWord?, floorId?, buildingId?) {
- let postData = {
- idx: 0,
- sum: 9999,
- floor: {
- buildId: buildingId || this.incidentModel.area || undefined,
- hosId: this.incidentModel.hosId,
- },
- };
- this.isLoading = true;
- this.mainService
- .getFetchDataList("simple/data", "floor", postData)
- .subscribe((data) => {
- this.isLoading = false;
- if (data.status == 200) {
- this.applicationFloorList = data.list;
- if(floorId){
- let hasFloorId = this.applicationFloorList.some(v => v.id == floorId);
- if(hasFloorId){
- this.incidentModel.place = floorId;
- }else{
- this.incidentModel.place = undefined;
- }
- }
- }
- });
- }
- // 修改关联查
- changeApplyRelatedDepartment(e){
- if(this.buildType !== '报修转事件'){
- this.incidentModel.requester = undefined;
- }
- this.searchApplicationRequester();
- }
- // 申请科室列表(搜索)
- isLoadingApply: boolean = false;
- applicationDeptList:any[] = [];
- searchApplicationDepartment(type, e?, phone?, deptId?, isInit?) {
- if(!this.hsmsData.hsmsSwitch && !this.itsmData.mdv2Switch){
- return;
- }
- let keyWord = "";
- if (e && e !== "&ks&" && e !== "&go&") {
- keyWord = e;
- }
- let cascadeHosId;
- if(type == 'itsm'){
- cascadeHosId = this.incidentModel.hosId || undefined;
- }else{
- cascadeHosId = this.checkedHos;
- }
- let dataObj = {
- idx: 0,
- sum: 20,
- department: {
- searchType: type == 'itsm' ? undefined : 1,// 简单查询
- cascadeHosId,
- keyWord: keyWord,
- flag: 1,
- },
- };
- this.WSNum++;
- this.isLoadingApply = true;
- this.mainService
- .getFetchDataList("data", "department", dataObj)
- .subscribe((data) => {
- this.WSNum--;
- if (this.WSNum === 0) {
- this.isLoadingApply = false;
- }
- if (data.status == 200) {
- if(type == 'hsms'){
- this.applicationDepartmentList = data.list;
- deptId && this.changeApply(deptId);
- if (e === undefined) {
- //初始化
- this.changeApplicationDepartment("");
- } else if (e === "&ks&") {
- //绑定了科室
- // 配送--start
- let obj = this.applicationDepartmentList.find(
- (item) => item.id == this.applyDeptMiddle.id
- );
- if (!obj) {
- this.applicationDepartmentList.push(this.applyDeptMiddle);
- }
- this.applyDept = this.applyDeptMiddle.id;
- this.changeApplicationDepartment("&ks&");
- // 配送--end
- } else if (e === "&go&") {
- //继续建单
- let obj = this.applicationDepartmentList.find(
- (item) => item.id == this.applyStartDept.id
- );
- if (!obj) {
- this.applicationDepartmentList.push(this.applyStartDept);
- }
- this.applyDept = this.applyStartDept.id;
- this.changeApplicationDepartment("&go&");
- } else if (e === "") {
- //没绑定科室
- this.changeApplicationDepartment(phone);
- }
- }else if(type == 'itsm'){
- this.applicationDeptList = data.list;
- let ids = this.applicationDeptList.map(v => v.id);
- isInit && !ids.includes(this.incidentModel.department) && (this.applicationDeptList.unshift({id: this.incidentModel.department, dept: this.incidentMsg.deptName}))
- console.log(this.applicationDeptList);
- console.log(this.incidentModel);
- console.log(this.incidentMsg);
- deptId && this.changeApplyDept(deptId);
- }
- }
- });
- }
- openChangeApply(flag){
- flag && this.searchApplicationDepartment('hsms')
- }
- openChangeApplyDept(flag){
- flag && this.searchApplicationDepartment('itsm');
- }
- openChangeApplyRequester(flag){
- flag && this.searchApplicationRequester();
- }
- openChangeApplyCategory(flag){
- flag && this.searchApplicationCategory();
- }
- openChangeApplyGroup(flag){
- flag && this.searchApplicationGroup()
- }
- openChangeApplyUser(flag){
- flag && this.searchApplicationUser()
- }
- // 配送-选择科室
- changeApply(e) {
- console.log(e, this.applicationDepartmentList);
- this.changeApplicationDepartment("&same&");
- if(this.applyDept && this.currentTabIndex !== '故障报修'){
- this.rightTitle_tab = [
- { id: 0, name: '近期配送' },
- { id: 1, name: '转出院记录' },
- ]
- this.rightTitleHandler(this.rightTitle_tab[0].id);
- }
- let deptObj = this.applicationDepartmentList.find(v => v.id == e);
- if(this.incidentModel.department != e){
- this.incidentModel.department = e;
- this.searchApplicationDepartment('itsm', deptObj ? deptObj.dept : '', undefined, e);
- }
- }
- // 运维-选择科室
- changeApplyDept(e) {
- console.log(e, this.applicationDeptList);
- if(this.incidentModel.department && this.currentTabIndex === '故障报修'){
- this.rightTitle_tab = [
- { id: 2, name: '近期维修' },
- { id: 3, name: '知识库' },
- ]
- this.rightTitleHandler(this.rightTitle_tab[0].id);
- }
- let deptObj = this.applicationDeptList.find(v => v.id == e);
- if(this.applyDept != e){
- this.applyDept = e;
- this.searchApplicationDepartment('hsms', deptObj ? deptObj.dept : '', undefined, e);
- }
- // 选择科室回显一级院区
- if(!this.incidentModel.hosId){
- if(deptObj){
- this.incidentModel.hosId = deptObj.hospital.parent ? deptObj.hospital.parent.id : deptObj.hospital.id;
- }
- this.incidentModel.area = undefined;
- this.searchApplicationBuilding();
- this.incidentModel.place = undefined;
- this.applicationFloorList = [];
- }
- // 选择科室回显科室电话,楼栋,楼层,地址
- if(deptObj){
- console.log('deptObj:', deptObj)
- this.incidentMsg.deptManyPhone = deptObj.manyPhone;
- let buildingId = deptObj.building ? deptObj.building.id : undefined;
- buildingId && this.searchApplicationBuilding('', buildingId);
- let floorId = deptObj.floor ? deptObj.floor.id : undefined;
- buildingId && floorId && this.searchApplicationFloor('', floorId, buildingId);
- this.incidentModel.houseNumber = deptObj.address;
- }
- // 刷新申请人列表
- if(this.buildType !== '报修转事件'){
- this.incidentModel.requester = undefined;
- }
- this.searchApplicationRequester();
- // 根据院区和故障现象带出责任部门,优先级,维修人/组
- if(this.incidentModel.category && this.incidentModel.hosId && this.buildType !== '编辑事件'){
- let postData = {
- idx: 0,
- sum: 9999,
- incidentCategoryConfig: {
- categoryId: this.incidentModel.category,
- hosId: this.incidentModel.hosId,
- },
- };
- console.log(postData);
- // return;
- this.isLoading = true;
- this.mainService
- .getFetchDataList("simple/data", "incidentCategoryConfig", postData)
- .subscribe((data) => {
- this.isLoading = false;
- if (data.status == 200) {
- let list = data.list || [];
- if(list.length > 0){
- console.log(list[0]);
- this.incidentCategoryConfig = list[0];
- }else{
- this.incidentCategoryConfig = {};
- }
- // 根据院区和故障现象带出责任部门,优先级,维修人/组
- this.incidentModel.duty = this.incidentCategoryConfig.dutyDTO;
- this.incidentModel.priorityId = this.incidentCategoryConfig.priority;
- // 回显维修人/组
- this.showGroupOrUser();
- }
- });
- }else{
- // 回显维修人/组
- this.showGroupOrUser();
- }
- }
- // 申请科室列表(搜索)失去焦点的时候
- changeApplicationDepartment(phone?) {
- this.radioValueQt = null;
- this.startDeptQt = null;
- this.endDeptQt = null;
- this.radioValueZy = null;
- this.startDeptZy = null;
- this.endDeptZy = null;
- this.patientZy = null;
- this.goodsNow = [];
- this.patientList = [];
- this.workOrderRemark = "";
- this.deptZyList["startDept"] = [];
- this.deptZyList["endDept"] = [];
- this.deptZyList["startStatus"] = 0;
- this.deptZyList["endStatus"] = 0;
- this.deptQtList["startDept"] = [];
- this.deptQtList["endDept"] = [];
- this.deptQtList["startStatus"] = 0;
- this.deptQtList["endStatus"] = 0;
- console.log(phone);
- if (
- phone !== undefined &&
- phone !== "&same&" &&
- phone !== "&ks&" &&
- phone !== "&go&"
- ) {
- // this.incidentModel.incomingPhone = this.callNumber = this.incidentModel.contactsInformation = phone;
- this.applyDept = null;
- this.noArrives = []; //近期配送
- } else if (phone === "&ks&") {
- let filter = this.applicationDepartmentList.filter(
- (item) => item.id == this.applyDept
- );
- console.log('filter', filter)
- // this.incidentModel.incomingPhone = this.callNumber = this.incidentModel.contactsInformation = filter[0].phone;
- console.log(this.callNumber); //ceshi
- if (this.currentTabIndex == "患者转运") {
- //患者转运
- //获取患者信息
- this.getPatientList(this.applyDept, "");
- }
- if (this.currentRTab === 0) {
- this.getWorkOrders(this.applyDept);
- } else if (this.currentRTab === 1) {
- this.getPatientLog(this.applyDept);
- } else if (this.currentRTab === 2) {
- this.getItsmOrders(this.incidentModel.department);
- } else if (this.currentRTab === 3) {
- this.getDictionaryList();
- }
- } else if (phone === "&go&") {
- if (this.currentTabIndex == "患者转运") {
- //患者转运
- //获取患者信息
- this.getPatientList(this.applyDept, "");
- }
- if (this.currentRTab === 0) {
- this.getWorkOrders(this.applyDept);
- } else if (this.currentRTab === 1) {
- this.getPatientLog(this.applyDept);
- } else if (this.currentRTab === 2) {
- this.getItsmOrders(this.incidentModel.department);
- } else if (this.currentRTab === 3) {
- this.getDictionaryList();
- }
- } else if (phone === "&same&") {
- if (this.currentTabIndex == "患者转运") {
- //患者转运
- //获取患者信息
- this.getPatientList(this.applyDept, "");
- }
- if (this.currentRTab === 0) {
- this.getWorkOrders(this.applyDept);
- } else if (this.currentRTab === 1) {
- this.getPatientLog(this.applyDept);
- } else if (this.currentRTab === 2) {
- this.getItsmOrders(this.incidentModel.department);
- } else if (this.currentRTab === 3) {
- this.getDictionaryList();
- }
- }
- }
- // 引入电话号码
- importPhone(phone, isTransform){
- if(isTransform){
- this.incidentModel.contactsInformation = phone.split(',')[0];
- }else{
- this.incidentModel.contactsInformation = phone;
- }
- }
- // 是否连续建单
- isBuildOrderAgagin:boolean = false;
- maskFlag:any = false;
- // 运维-直接解决
- directOrder(){
- if(this.incidentModel.repairIncidentType === 'public' && !this.incidentModel.requester){
- this.msg.warning('请选择申请人!');
- return;
- }
- if(!this.incidentModel.category){
- this.msg.warning('请选择故障现象!');
- return;
- }
- let category = this.applicationCategoryList.find(v => v.id == this.incidentModel.category);
- if(!this.incidentModel.duty){
- this.msg.warning(`故障现象【${category.mutiCategory}】没有设置责任部门!`);
- return;
- }
- if(this.incidentModel.repairIncidentType === 'dept' && !this.incidentModel.department){
- this.msg.warning('请选择申请科室!');
- return;
- }
- if(!this.incidentModel.contactsInformation){
- this.msg.warning('请填写联系电话!');
- return;
- }
- if(!this.incidentModel.priorityId){
- this.msg.warning('请选择优先级!');
- return;
- }
- if(!this.incidentModel.description){
- this.msg.warning('请选择故障描述!');
- return;
- }
- this.showDirectOrder();
- }
- // 图片上传
- uploadImages(file, id){
- const formData = new FormData();
- formData.append('file', file);
- formData.append('fileName', file.name);
- const req = new HttpRequest('Post', this.mainService.returnUploadUrl('wechatRequesterIncident', id), formData, {
- reportProgress: true
- });
- return this.http.request(req).pipe(filter(e => e instanceof HttpResponse)).toPromise();
- }
- // 运维-建单并派单
- assignOrder(){
- if(this.incidentModel.repairIncidentType === 'public' && !this.incidentModel.requester){
- this.msg.warning('请选择申请人!');
- return;
- }
- if(!this.incidentModel.category){
- this.msg.warning('请选择故障现象!');
- return;
- }
- let category = this.applicationCategoryList.find(v => v.id == this.incidentModel.category);
- console.log('故障现象对象=>>>>>',category)
- if(!this.incidentModel.duty){
- this.msg.warning(`故障现象【${category.mutiCategory}】没有设置责任部门!`);
- return;
- }
- if(this.incidentModel.repairIncidentType === 'dept' && !this.incidentModel.department){
- this.msg.warning('请选择申请科室!');
- return;
- }
- if(!this.incidentModel.contactsInformation){
- this.msg.warning('请填写联系电话!');
- return;
- }
- if(!this.incidentModel.priorityId){
- this.msg.warning('请选择优先级!');
- return;
- }
- if(!this.incidentModel.description){
- this.msg.warning('请选择故障描述!');
- return;
- }
- if(!this.incidentModel.group && this.buildType !== '编辑事件'){
- this.msg.warning('请选择处理组!');
- return;
- }
- this.maskFlag = this.msg.loading("正在加载中..", {
- nzDuration: 0,
- }).messageId;
- let postData:any = {
- solutionId: this.solutionId,
- "incident": {
- "id": this.incidentModel.id || undefined,
- "deleteFlag": 0,
- "duty": this.incidentModel.duty ? { id: this.incidentModel.duty.id } : undefined,
- "department": this.incidentModel.department ? { id: this.incidentModel.department } : undefined,
- "contactsInformation": this.incidentModel.contactsInformation,
- "contacts": this.incidentModel.contacts,
- "hosId": this.incidentModel.hosId || undefined,
- "area": this.incidentModel.area ? { id: this.incidentModel.area } : undefined,
- "place": this.incidentModel.place ? { id: this.incidentModel.place } : undefined,
- "houseNumber": this.incidentModel.houseNumber,
- "category": this.incidentModel.category ? { id: this.incidentModel.category } : undefined,
- "priorityId": this.incidentModel.priorityId || undefined,
- "source": this.incidentModel.source ? { id: this.incidentModel.source } : undefined,
- // "title": category.mutiCategory,
- "description": this.incidentModel.description,
- "yyTime": this.incidentModel.yyTime ? format(new Date(this.incidentModel.yyTime), 'yyyy-MM-dd HH:mm:ss') : undefined,
- "requester": this.incidentModel.requester ? { id: this.incidentModel.requester } : undefined,
- "repairIncidentType": this.incidentModel.repairIncidentType ? this.repairIncidentTypeList.find(v => v.value === this.incidentModel.repairIncidentType) : undefined,
- "acceptUser": { id: this.tool.getCurrentUserId() },
- "callID": this.incidentModel.callID || undefined,
- "incomingPhone": this.incidentModel.incomingPhone || undefined,
- "candidateGroups": this.incidentModel.group || undefined,
- "assignee": this.incidentModel.user || undefined,
- "hjzxRecordId": this.incidentModel.hjzxRecordId || undefined,
- }
- };
- if(this.buildType){
- if(this.buildType === '报修转事件'){
- postData.incident.fromWx = true;
- }
- if(this.buildType !== '继续建单' && this.buildType !== '编辑事件' && this.buildType !== '报修转事件'){
- postData.incident = Object.assign({}, postData.incident);
- }else{
- postData.incident = Object.assign({}, this.editOrder, postData.incident);
- }
- }
- console.log(postData);
- // return;
- this.mainService
- .flowPost("incident/task/accept", postData)
- .subscribe((result) => {
- this.msg.remove(this.maskFlag);
- this.maskFlag = false;
- if (result.state == 200) {
- // 图片上传
- if(this.fileList.length){
- console.log(this.fileList.map(v => v.originFileObj));
- this.fileList.map(v => v.originFileObj).forEach(async file => {
- await this.uploadImages(file, result.data.id);
- })
- }
- // this.msg.success('建单并派单成功');
- this.isBuildOrderAgaginFn();
- } else {
- this.msg.error(result.msg || '建单并派单失败');
- }
- });
- }
- // 运维-暂存
- temporaryStorage(){
- this.maskFlag = this.msg.loading("正在加载中..", {
- nzDuration: 0,
- }).messageId;
- let category;
- if(this.incidentModel.category){
- category = this.applicationCategoryList.find(v => v.id == this.incidentModel.category);
- }
- let postData:any = {
- solutionId: this.solutionId,
- "incident": {
- "id": this.incidentModel.id || undefined,
- "deleteFlag": 0,
- "duty": this.incidentModel.duty ? { id: this.incidentModel.duty.id } : undefined,
- "department": this.incidentModel.department ? { id: this.incidentModel.department } : undefined,
- "contactsInformation": this.incidentModel.contactsInformation,
- "contacts": this.incidentModel.contacts,
- "hosId": this.incidentModel.hosId || undefined,
- "area": this.incidentModel.area ? { id: this.incidentModel.area } : undefined,
- "place": this.incidentModel.place ? { id: this.incidentModel.place } : undefined,
- "houseNumber": this.incidentModel.houseNumber,
- "category": this.incidentModel.category ? { id: this.incidentModel.category } : undefined,
- "priorityId": this.incidentModel.priorityId || undefined,
- "source": this.incidentModel.source ? { id: this.incidentModel.source } : undefined,
- // "title": category ? category.mutiCategory : '',
- "description": this.incidentModel.description,
- "yyTime": this.incidentModel.yyTime ? format(new Date(this.incidentModel.yyTime), 'yyyy-MM-dd HH:mm:ss') : undefined,
- "requester": this.incidentModel.requester ? { id: this.incidentModel.requester } : undefined,
- "repairIncidentType": this.incidentModel.repairIncidentType ? this.repairIncidentTypeList.find(v => v.value === this.incidentModel.repairIncidentType) : undefined,
- "acceptUser": { id: this.tool.getCurrentUserId() },
- "callID": this.incidentModel.callID || undefined,
- "incomingPhone": this.incidentModel.incomingPhone || undefined,
- "candidateGroups": this.incidentModel.group || undefined,
- "assignee": this.incidentModel.user || undefined,
- "hjzxRecordId": this.incidentModel.hjzxRecordId || undefined,
- }
- };
- if(this.buildType){
- if(this.buildType === '报修转事件'){
- postData.incident.fromWx = true;
- }
- if(this.buildType !== '继续建单' && this.buildType !== '编辑事件' && this.buildType !== '报修转事件'){
- postData.incident = Object.assign({}, postData.incident);
- }else{
- postData.incident = Object.assign({}, this.editOrder, postData.incident);
- }
- }
- console.log(postData);
- // return;
- this.mainService
- .flowPost("incident/task/storage", postData)
- .subscribe((result) => {
- this.msg.remove(this.maskFlag);
- this.maskFlag = false;
- if (result.state == 200) {
- // 图片上传
- if(this.fileList.length){
- console.log(this.fileList.map(v => v.originFileObj));
- this.fileList.map(v => v.originFileObj).forEach(async file => {
- await this.uploadImages(file, result.data.id);
- })
- }
- // this.msg.success('暂存成功');
- this.isBuildOrderAgaginFn();
- } else {
- this.msg.error(result.msg || '暂存失败');
- }
- });
- }
- // 运维-保存
- saveOrder(){
- if(this.incidentModel.repairIncidentType === 'public' && !this.incidentModel.requester){
- this.msg.warning('请选择申请人!');
- return;
- }
- if(!this.incidentModel.category){
- this.msg.warning('请选择故障现象!');
- return;
- }
- let category = this.applicationCategoryList.find(v => v.id == this.incidentModel.category);
- if(!this.incidentModel.duty){
- this.msg.warning(`故障现象【${category.mutiCategory}】没有设置责任部门!`);
- return;
- }
- if(this.incidentModel.repairIncidentType === 'dept' && !this.incidentModel.department){
- this.msg.warning('请选择申请科室!');
- return;
- }
- if(!this.incidentModel.contactsInformation){
- this.msg.warning('请填写联系电话!');
- return;
- }
- if(!this.incidentModel.priorityId){
- this.msg.warning('请选择优先级!');
- return;
- }
- if(!this.incidentModel.description){
- this.msg.warning('请选择故障描述!');
- return;
- }
- this.maskFlag = this.msg.loading("正在加载中..", {
- nzDuration: 0,
- }).messageId;
- let postData:any = {
- solutionId: this.solutionId,
- "incident": {
- "id": this.incidentModel.id || undefined,
- "deleteFlag": 0,
- "duty": this.incidentModel.duty ? { id: this.incidentModel.duty.id } : undefined,
- "department": this.incidentModel.department ? { id: this.incidentModel.department } : undefined,
- "contactsInformation": this.incidentModel.contactsInformation,
- "contacts": this.incidentModel.contacts,
- "hosId": this.incidentModel.hosId || undefined,
- "area": this.incidentModel.area ? { id: this.incidentModel.area } : undefined,
- "place": this.incidentModel.place ? { id: this.incidentModel.place } : undefined,
- "houseNumber": this.incidentModel.houseNumber,
- "category": this.incidentModel.category ? { id: this.incidentModel.category } : undefined,
- "priorityId": this.incidentModel.priorityId || undefined,
- "source": this.incidentModel.source ? { id: this.incidentModel.source } : undefined,
- // "title": category ? category.mutiCategory : '',
- "description": this.incidentModel.description,
- "yyTime": this.incidentModel.yyTime ? format(new Date(this.incidentModel.yyTime), 'yyyy-MM-dd HH:mm:ss') : undefined,
- "requester": this.incidentModel.requester ? { id: this.incidentModel.requester } : undefined,
- "repairIncidentType": this.incidentModel.repairIncidentType ? this.repairIncidentTypeList.find(v => v.value === this.incidentModel.repairIncidentType) : undefined,
- "acceptUser": { id: this.tool.getCurrentUserId() },
- "callID": this.incidentModel.callID || undefined,
- "incomingPhone": this.incidentModel.incomingPhone || undefined,
- "hjzxRecordId": this.incidentModel.hjzxRecordId || undefined,
- }
- };
- if(this.buildType){
- postData.incident = Object.assign({}, this.editOrder, postData.incident);
- }
- console.log(postData);
- // return;
- this.mainService
- .flowPost("incident/task/edit", postData)
- .subscribe((result) => {
- this.msg.remove(this.maskFlag);
- this.maskFlag = false;
- if (result.state == 200) {
- // 图片上传
- if(this.fileList.length){
- console.log(this.fileList.map(v => v.originFileObj));
- this.fileList.map(v => v.originFileObj).forEach(async file => {
- await this.uploadImages(file, result.data.id);
- })
- }
- // this.msg.success('编辑成功');
- this.isBuildOrderAgaginFn();
- } else {
- this.msg.error(result.msg || '编辑失败');
- }
- });
- }
- // 是否连续建单
- isBuildOrderAgaginFn(){
- if(this.isBuildOrderAgagin){
- // 清除故障现象,维修人/组
- this.incidentModel.category = undefined;
- this.incidentModel.user = undefined;
- this.incidentModel.group = undefined;
- this.showPromptModal("操作", true, "", "");
- }else{
- if(this.incomingService.getSign() === 'callCenter' && this.incomingService.getPhoneNumber()){
- this.jry_shixian();
- }
- this.newOrderShow = false; //关闭弹窗
- this.newOrderShowOpen = false; //此时可出现新的弹窗
- this.showPromptModal("操作", true, "", "");
- }
- }
- // 选择统计备注
- countRemarkIndex:number = -1;
- addCountRemark(countRemark, index, i){
- if(this.countRemarkIndex == i){
- this.countRemarkIndex = -1;
- }else{
- this.countRemarkIndex = i;
- }
- this.getSearchTaskList('', this.countRemarkIndex > -1 ? countRemark : '').subscribe((result) => {
- if (result.status == 200) {
- this.searchTaskLoading = false;
- // this.workTypesArrange[index].value = result.data || [];
- this.workTypes = result['data'] || [];
- // 整理后的任务类型
- for (const value of this.workTypesArrange) {
- value.value = [];
- }
- this.workTypes.forEach((item) => {
- if(item.associationTypeValue === 'patientTransport'){
- // 患者其他服务
- let obj = this.workTypesArrange.find(v => v.key === '患者转运');
- if(obj){
- obj.value.push(item);
- }else{
- this.workTypesArrange.unshift({ key: '患者转运', value: [item] });
- }
- }else if(item.associationTypeValue === 'other' || item.associationTypeValue === 'specimen' || item.associationTypeValue === 'ordinary'){
- // 物品配送
- let obj = this.workTypesArrange.find(v => v.key === '物品配送');
- if(obj){
- obj.value.push(item);
- }else{
- this.workTypesArrange.unshift({ key: '物品配送', value: [item] });
- }
- }
- });
- console.log('workTypesArrange', this.workTypesArrange);
- // 任务类型是否显示操作项
- let arr = this.workTypesArrange;
- this.workTypesFlag = arr.length >= 5;
- }
- });
- }
- // 新建工单->获取新建类型
- countRemarkList:any[] = [];
- getAutoWorkTypes(isFirst, isInit) {
- this.workTypesArrange = [];
- // 运维
- if(this.itsmData.mdv2Switch){
- this.workTypesArrange = [{key:'故障报修', value: []}];
- if(!this.hsmsData.hsmsSwitch){
- console.log('workTypesArrange', this.workTypesArrange);
- // 是否显示操作项
- this.workTypesFlag = this.workTypesArrange.length >= 5;
- // 默认选中第一项
- if (this.workTypesArrange.length > 0) {
- this.tabClick(this.workTypesArrange[0].key, isInit);
- }
- }
- }
- // 配送
- if(this.hsmsData.hsmsSwitch){
- this.newLoading = true;
- this.mainService.getTaskTypeBySearchKey({
- hosId: this.checkedHos,
- }).subscribe((data) => {
- this.newLoading = false;
- if (data["status"] == 200) {
- this.workTypes = data["data"];
- // 整理后的任务类型
- this.workTypes.forEach((item) => {
- if(item.associationTypeValue === 'patientTransport'){
- // 患者其他服务
- let obj = this.workTypesArrange.find(v => v.key === '患者转运');
- if(obj){
- obj.value.push(item);
- }else{
- this.workTypesArrange.unshift({ key: '患者转运', value: [item] });
- }
- }else if(item.associationTypeValue === 'other' || item.associationTypeValue === 'specimen' || item.associationTypeValue === 'ordinary'){
- // 物品配送
- let obj = this.workTypesArrange.find(v => v.key === '物品配送');
- if(obj){
- obj.value.push(item);
- }else{
- this.workTypesArrange.unshift({ key: '物品配送', value: [item] });
- }
- }
- });
- console.log('workTypesArrange', this.workTypesArrange);
- // 任务类型是否显示操作项
- let arr = this.workTypesArrange;
- this.workTypesFlag = arr.length >= 5;
- // 默认选中第一项
- if (arr.length > 0) {
- isFirst ? this.tabClick(arr[0].key, isInit) : this.tabClick(arr[arr.length - 1].key, isInit);
- }
- }
- });
- this.getTaskTypeCountRemarkList();
- }
- }
- // 查类型
- getTaskTypeCountRemarkList(){
- this.mainService.getTaskTypeCountRemarkList({
- hosId: this.checkedHos,
- typeValues: 'other,specimen,ordinary',
- }).subscribe((data) => {
- if (data["status"] == 200){
- this.countRemarkList = data.data || [];
- }
- })
- }
- // 终点科室选中
- endDeptZyChange() {
- if (!this.applyDept || !this.endDeptZy) {
- return;
- }
- // 终点科室患者信息列表,id是送病人回病房的任务类型,写死了
- if (this.radioValueZy == this.deathTasktypeId) {
- //获取患者信息
- this.patientZy = null;
- this.getPatientList(this.endDeptZy, "");
- } else {
- //获取患者信息
- console.log(this.deptZyList);
- if (
- this.deptZyList.startStatus != 206 &&
- this.deptZyList.endStatus != 206
- ) {
- this.patientZy = null;
- }
- this.getPatientList(this.applyDept, "");
- }
- }
- //搜索院区下面的科室(患者转运)
- searchHosDepartment(id, type, dept?) {
- if (dept) {
- this.searchHosDepartmentSubject.next([id, type, dept]);
- } else {
- this.searchHosDepartmentSubject.next([id, type]);
- }
- }
- // 搜索院区下面的科室(患者转运)
- getHosDepartment(id, type, dept?) {
- //id院区,type起点科室'start',终点科室'end'。科室名称dept。
- let value = "";
- if (dept) {
- value = dept;
- }
- if (type === "start" && this.deptZyList["startStatus"] == 202) {
- //固定科室范围,禁止搜索
- return;
- } else if (type === "end" && this.deptZyList["endStatus"] == 202) {
- //固定科室范围,禁止搜索
- return;
- }
- let postData = {
- idx: 0,
- sum: 10,
- department: {
- dept: value,
- cascadeHosId: id
- },
- };
- if (type == "start" && this.deptZyList["startStatus"] == 205) {
- postData.department["type"] = { id: this.deptZyList["startTypeId"] };
- } else if (type == "end" && this.deptZyList["endStatus"] == 205) {
- postData.department["type"] = { id: this.deptZyList["endTypeId"] };
- }
- this.isLoading = true;
- this.mainService
- .getFetchDataList("data", "department", postData)
- .subscribe((data) => {
- this.isLoading = false;
- if (data["status"] == 200) {
- if (type === "start") {
- this.deptZyList["startDept"] = data.list;
- } else if (type === "end") {
- this.deptZyList["endDept"] = data.list;
- }
- }
- });
- }
- //搜索院区下面的科室(其他)
- searchHosDepartmentQt(id, type, dept?) {
- if (dept) {
- this.searchHosDepartmentQtSubject.next([id, type, dept]);
- } else {
- this.searchHosDepartmentQtSubject.next([id, type]);
- }
- }
- // 搜索院区下面的科室(其他)
- getHosDepartmentQt(id, type, dept?) {
- //id院区,type起点科室'start',终点科室'end'。科室名称dept。
- let value = "";
- if (dept) {
- value = dept;
- }
- if (type === "start" && this.deptQtList["startStatus"] == 202) {
- //固定科室范围,禁止搜索
- return;
- } else if (type === "end" && this.deptQtList["endStatus"] == 202) {
- //固定科室范围,禁止搜索
- return;
- }
- let postData = {
- idx: 0,
- sum: 10,
- department: {
- dept: value,
- cascadeHosId: id
- },
- };
- if (type == "start" && this.deptQtList["startStatus"] == 205) {
- postData.department["type"] = { id: this.deptQtList["startTypeId"] };
- } else if (type == "end" && this.deptQtList["endStatus"] == 205) {
- postData.department["type"] = { id: this.deptQtList["endTypeId"] };
- }
- this.isLoading = true;
- this.mainService
- .getFetchDataList("data", "department", postData)
- .subscribe((data) => {
- this.isLoading = false;
- if (data["status"] == 200) {
- if (type === "start") {
- this.deptQtList["startDept"] = data.list;
- } else if (type === "end") {
- this.deptQtList["endDept"] = data.list;
- }
- }
- });
- }
- // 获取大于x,并且是n的倍数的数字
- getLgNumber(x: number, n:number): number{
- for(let i = x; i < 60; i++){
- if(i % n === 0){
- return i;
- }
- }
- return 0;
- }
- // 禁用小时
- disabledHours = (): number[] => {
- let now = new Date();
- let nHour = now.getHours();
- let nMinute = now.getMinutes();
- if (nMinute > (60 - this.inspectAndPatientTransportConfig.timeMod)) {
- return range(0, nHour + 1);
- } else {
- return range(0, nHour);
- }
- }
- // 禁用分钟
- disabledMinutes = (hour: number): number[] => {
- let now = new Date();
- let nHour = now.getHours();
- let nMinute = now.getMinutes();
- if (hour === nHour || hour === undefined) {
- return this.integralDivision(0, nMinute, this.inspectAndPatientTransportConfig.timeMod);
- } else {
- return [];
- }
- }
- // start和end之间能被n整除的所有数字集合
- integralDivision(start:number, end:number, n:number): number[]{
- let arr = [];
- for(let i = start; i <= end; i++){
- if(i % n === 0){
- arr.push(i);
- }
- }
- return arr;
- }
- //修改预约建单时间的日期
- yyDateChange(e) {
- // 获取年月日
- let yyDate = new Date(e);
- let year = yyDate.getFullYear();
- let month = yyDate.getMonth();
- let date = yyDate.getDate();
- // 获取当前时间的年月日
- let now = new Date();
- let nYear = now.getFullYear();
- let nMonth = now.getMonth();
- let nDate = now.getDate();
- if (year != nYear || month != nMonth || date != nDate) {
- this.disabledHours = () => [];
- this.disabledMinutes = (hour) => [];
- } else {
- // 禁用小时
- this.disabledHours = () => {
- let now = new Date();
- let nHour = now.getHours();
- let nMinute = now.getMinutes();
- if (nMinute > (60 - this.inspectAndPatientTransportConfig.timeMod)) {
- return range(0, nHour + 1);
- } else {
- return range(0, nHour);
- }
- };
- // 禁用分钟
- this.disabledMinutes = (hour) => {
- let now = new Date();
- let nHour = now.getHours();
- let nMinute = now.getMinutes();
- if (hour === nHour || hour === undefined) {
- return this.integralDivision(0, nMinute, this.inspectAndPatientTransportConfig.timeMod);
- } else {
- return [];
- }
- };
- }
- }
- // 下一日(患者其他服务)
- nextDayZy() {
- this.yyDateZy = addDays(this.yyDateZy, 1);
- this.yyDateChange(this.yyDateZy);
- }
- // 下一日(其他临床服务)
- nextDay() {
- this.yyDate = addDays(this.yyDate, 1);
- this.yyDateChange(this.yyDate);
- }
- // 禁用日期(患者其他服务)
- disabledyyDateZy = (current: Date): boolean => {
- return differenceInCalendarDays(current, new Date()) < 0;
- };
- // 禁用日期(其他)
- disabledyyDate = (current: Date): boolean => {
- return differenceInCalendarDays(current, new Date()) < 0;
- };
- yyTimeZyChange(e) {
- if (this.yyTimeZy) {
- let now = new Date();
- // 禁用日期(转运)
- if (getHours(this.yyTimeZy) < getHours(now)) {
- this.disabledyyDateZy = (current: Date): boolean => {
- return differenceInCalendarDays(current, new Date()) < 1;
- };
- } else {
- this.disabledyyDateZy = (current: Date): boolean => {
- return differenceInCalendarDays(current, new Date()) < 0;
- };
- }
- let end = this.getLgNumber(getMinutes(this.yyTimeZy), this.inspectAndPatientTransportConfig.timeMod);
- this.yyTimeZy = setMinutes(this.yyTimeZy, end);
- }
- this.clickYYZyFlag = false;
- }
- yyTimeChange(e) {
- if (this.yyTime) {
- let now = new Date();
- // 禁用日期(其他)
- if (getHours(this.yyTime) < getHours(now)) {
- this.disabledyyDate = (current: Date): boolean => {
- return differenceInCalendarDays(current, new Date()) < 1;
- };
- } else {
- this.disabledyyDate = (current: Date): boolean => {
- return differenceInCalendarDays(current, new Date()) < 0;
- };
- }
- let end = this.getLgNumber(getMinutes(this.yyTime), this.inspectAndPatientTransportConfig.timeMod);
- this.yyTime = setMinutes(this.yyTime, end);
- }
- this.clickYYFlag = false;
- }
- // 需要预约建单-事件
- yyInspectChange(e) {
- if (this.currentTasktype.associationType.value === "other") {
- //其他临床服务
- this.yyTime = null;
- this.yyDate = new Date();
- console.log(this.isYyInspect);
- } else if (this.currentTasktype.associationType.value === "patientTransport") {
- //患者其他服务
- this.yyTimeZy = null;
- this.yyDateZy = new Date();
- }
- }
- // 转运类型选中类型(单选)触发
- goodsNow; //携带的物品列表
- yyDateZy = null; //预约日期-患者其他服务
- yyDate = null; //预约日期-其他临床服务
- yyTimeZy = null; //预约时间-患者其他服务
- yyTime = null; //预约时间-其他临床服务
- inspectAndPatientTransportConfig:any = {timeMod: 30};
- isYyInspect = false; //需要预约检查
- clickYYZyFlag = false; //是否点击预约建单-患者其他服务
- clickYYFlag = false; //是否点击预约建单-其他临床服务
- currentTasktype = null; //当前选中的任务类型对象
- radioChangeZy(value) {
- //任务类型id
- if (value === "" || value === null) {
- return;
- }
- this.startDeptZy = null;
- this.endDeptZy = null;
- this.patientZy = null;
- // 返回值的status是201 则是默认发起科室,把申请科室作为值
- // 返回值的status是202 则是固定科室范围,会返回科室列表
- // 返回值的status是203 则是固定科室,会返回单个科室
- // 返回值的status是204 则让前端自己调用科室搜索接口
- // 返回值的status是205 则是固定科室类型,会返回科室列表
- // 返回值的status是206 则是默认患者所在科室,把患者所在科室作为值
- this.mainService.getdeptList(value).subscribe((data:any) => {
- this.deptZyList = data;
- // 预约start
- this.currentTasktype = data.taskType;
- this.isYyInspect = false;
- this.clickYYZyFlag = false;
- this.yyDateZy = new Date();
- this.yyTimeZy = null;
- // 预约end
- console.log(this.deptZyList);
- // 起点科室
- if (data["startStatus"] == 201 || data["startStatus"] == 206) {
- if (this.applyDept) {
- //选择了申请科室,则起点科室就是申请科室
- this.deptZyList["startDept"] = this.applicationDepartmentList.filter(
- (item) => item.id == this.applyDept
- );
- this.startDeptZy = this.applyDept;
- }
- } else if (data["startStatus"] == 203) {
- this.startDeptZy = data["startDept"][0]["id"];
- } else if (data["startStatus"] == 204 || data["startStatus"] == 205) {
- this.getHosDepartment(this.checkedHos, "start", "");
- }
- // 终点科室
- if (data["endStatus"] == 201 || data["endStatus"] == 206) {
- if (this.applyDept) {
- //选择了申请科室,则终点科室就是申请科室
- this.deptZyList["endDept"] = this.applicationDepartmentList.filter(
- (item) => item.id == this.applyDept
- );
- this.endDeptZy = this.applyDept;
- }
- } else if (data["endStatus"] == 203) {
- this.endDeptZy = data["endDept"][0]["id"];
- } else if (data["endStatus"] == 204 || data["endStatus"] == 205) {
- this.getHosDepartment(this.checkedHos, "end", "");
- }
- // 终点科室患者信息列表,id是送病人回病房的任务类型
- if (
- (data["endStatus"] == 201 || data["endStatus"] == 203) &&
- this.radioValueZy == this.deathTasktypeId
- ) {
- if (this.currentTabIndex == "患者转运") {
- //患者转运
- //获取患者信息
- this.getPatientList(this.endDeptZy, "");
- }
- }
- });
- // 获取携带物品
- let arrObj = this.workTypesArrange.find(v => v.key === this.currentTabIndex);
- let arr = arrObj.value;
- this.goodsNow = arr.filter(
- (item) => item.id == value
- )[0].taskType.carryEquipmentIds;
- if (this.goodsNow) {
- this.goodsNow = this.goodsNow.map((item) => {
- return {
- label: item.name,
- value: item.id,
- checked: false,
- };
- });
- } else {
- this.goodsNow = [];
- }
- }
- radioChangeQt(value) {
- //任务类型id
- if (value === "" || value === null) {
- return;
- }
- this.startDeptQt = null;
- this.endDeptQt = null;
- // 返回值的status是201 则是默认发起科室,把申请科室作为值
- // 返回值的status是202 则是固定科室范围,会返回科室列表
- // 返回值的status是203 则是固定科室,会返回单个科室
- // 返回值的status是204 则让前端自己调用科室搜索接口
- // 返回值的status是205 则是固定科室类型,会返回科室列表
- this.mainService.getdeptList(value).subscribe((data:any) => {
- this.deptQtList = data;
- // 预约start
- this.currentTasktype = data.taskType;
- this.isYyInspect = false;
- this.clickYYFlag = false;
- this.yyDate = new Date();
- this.yyTime = null;
- // 预约end
- this.deptQtList.taskType.customRemarks = this.deptQtList.taskType.customRemarks ? this.deptQtList.taskType.customRemarks.split("$") : [];
- // 起点科室
- if (data["startStatus"] == 201) {
- if (this.applyDept) {
- //选择了申请科室,则起点科室就是申请科室
- this.deptQtList["startDept"] = this.applicationDepartmentList.filter(
- (item) => item.id == this.applyDept
- );
- this.startDeptQt = this.applyDept;
- }
- } else if (data["startStatus"] == 203) {
- this.startDeptQt = data["startDept"][0]["id"];
- } else if (data["startStatus"] == 204 || data["startStatus"] == 205) {
- this.getHosDepartmentQt(this.checkedHos, "start", "");
- }
- // 终点科室
- if (data["endStatus"] == 201) {
- if (this.applyDept) {
- //选择了申请科室,则终点科室就是申请科室
- this.deptQtList["endDept"] = this.applicationDepartmentList.filter(
- (item) => item.id == this.applyDept
- );
- this.endDeptQt = this.applyDept;
- }
- } else if (data["endStatus"] == 203) {
- this.endDeptQt = data["endDept"][0]["id"];
- } else if (data["endStatus"] == 204 || data["endStatus"] == 205) {
- this.getHosDepartmentQt(this.checkedHos, "end", "");
- }
- });
- }
- //新建工单->确定提交
- isGoLoading = false;
- newOrderOk(go?): void {
- console.log(this.radioValueQt);
- let arr = this.workTypesArrange.find(v => v.key === this.currentTabIndex);
- let objQt = arr.value.find(v => v.id == this.radioValueQt);
- let objZy = arr.value.find(v => v.id == this.radioValueZy);
- if (this.isYyInspect && objQt && objQt.associationTypeValue === 'other') {
- this.clickYYFlag = true;
- } else {
- this.clickYYFlag = false;
- }
- if (this.isYyInspect && objZy && objZy.associationTypeValue === 'patientTransport') {
- this.clickYYZyFlag = true;
- } else {
- this.clickYYZyFlag = false;
- }
- if (
- (!this.yyTime && objQt && objQt.associationTypeValue === 'other' && this.isYyInspect) ||
- (!this.yyTimeZy && objZy && objZy.associationTypeValue === 'patientTransport' && this.isYyInspect)
- ) {
- return;
- }
- if (go !== "&go&") {
- this.isOkLoading = true;
- } else {
- this.isGoLoading = true;
- }
- if (objZy && objZy.associationTypeValue === 'patientTransport') {
- //患者转运
- go === "&go&" ? this.submitFormZy(go) : this.submitFormZy();
- } else if (objQt && objQt.associationTypeValue === 'specimen') {
- //标本配送
- go === "&go&" ? this.submitFormBbps(go) : this.submitFormBbps();
- } else if (objQt && objQt.associationTypeValue === 'other') {
- //其他配送
- go === "&go&" ? this.submitFormQt(go) : this.submitFormQt();
- } else if (objQt && objQt.associationTypeValue === 'ordinary') {
- //万能交接
- go === "&go&" ? this.submitFormOrdinary(go) : this.submitFormOrdinary();
- }
- }
- nucleicAcidPrintingCancel():void {
- this.fixedTab = '';
- }
- // 取消
- newOrderCancel(): void {
- if(this.incomingService.getSign() === 'callCenter' && this.incomingService.getPhoneNumber()){
- this.jry_shixian();
- }
- this.newOrderShow = false;
- this.newOrderShowOpen = false;
- this.currentTabIndex = "";
- this.fixedTab = "";
- this.fixedMenuShangla();
- this.radioValueQt = null;
- this.startDeptQt = null;
- this.endDeptQt = null;
- this.radioValueZy = null;
- this.startDeptZy = null;
- this.endDeptZy = null;
- this.patientZy = null;
- this.goodsNow = [];
- this.patientList = [];
- this.workOrderRemark = "";
- this.deptZyList["startDept"] = [];
- this.deptZyList["endDept"] = [];
- this.deptZyList["startStatus"] = 0;
- this.deptZyList["endStatus"] = 0;
- this.deptQtList["startDept"] = [];
- this.deptQtList["endDept"] = [];
- this.deptQtList["startStatus"] = 0;
- this.deptQtList["endStatus"] = 0;
- }
- // 携带物品
- changeGoods(value: object[]): void {
- console.log(value);
- }
- // 撤回
- // 打开撤回模态框
- openRecallModal(id) {
- this.coopId = id;
- this.recallOrderShow = true;
- }
- // 确认撤回
- confirmRec() {
- let that = this;
- that.btnLoading = true;
- let postData: any = {};
- let flags = "";
- this.coopId = this.coopId + "";
- if (this.coopId.includes("-")) {
- //批量
- flags = "batchExcuteWorkOrder";
- let ids = this.coopId.split("-");
- postData.workOrders = [];
- ids.forEach((item) => {
- postData.workOrders.push({ id: item, type: "recall" });
- });
- } else {
- flags = "excuteWorkOrder/recall";
- postData = {
- workOrder: {
- id: this.coopId,
- },
- };
- }
- that.mainService.coopWorkerOrder(flags, postData).subscribe((data) => {
- that.btnLoading = false;
- that.closeRecallOrderModal();
- if (data.status == 200) {
- that.showPromptModal("撤回", true, "");
- } else {
- that.showPromptModal("撤回", false, data.msg);
- }
- });
- }
- // 撤回并删除
- recAndDel() {
- let that = this;
- that.recDelLoading = true;
- that.mainService.delOrder(that.coopId).subscribe((data) => {
- that.recDelLoading = false;
- console.log(data);
- that.closeRecallOrderModal();
- if (data.status == 200) {
- that.showPromptModal("删除", true, "");
- } else {
- that.showPromptModal("删除", false, data.msg);
- }
- });
- }
- // 关闭撤回模态框
- closeRecallOrderModal() {
- this.recallOrderShow = false;
- this.batchClickType1 = false;
- }
- // 删除
- // 打开模态框
- coopId; //当前操作id
- coopType;
- openDelModal(id, type) {
- this.coopId = id;
- this.coopType = type;
- this.delOrderShow = true;
- }
- // 确认删除
- confirmDel() {
- let that = this;
- that.btnLoading = true;
- if(this.coopType === 'hsms'){
- that.mainService.delOrder(that.coopId).subscribe((data) => {
- that.btnLoading = false;
- console.log(data);
- that.closeDelOrderModal();
- if (data.status == 200) {
- that.showPromptModal("删除", true, "");
- } else {
- that.showPromptModal("删除", false, data.msg);
- }
- });
- }else if(this.coopType === 'itsm'){
- that.mainService.simplePost("rmvData", "incident", [this.coopId]).subscribe((data) => {
- that.btnLoading = false;
- console.log(data);
- that.closeDelOrderModal();
- if (data.status == 200) {
- that.showPromptModal("删除", true, "");
- } else {
- that.showPromptModal("删除", false, data.msg);
- }
- });
- }
- }
- // 关闭模态框
- closeDelOrderModal() {
- this.delOrderShow = false;
- }
- // 新建工单
- // 提交选择转入科室的模态框
- submitFormHand(id) {
- // 有转入科室
- this.createLoading = true;
- let postData = {
- workOrder: {
- sourceId: SourceId.fuwutai,
- taskType: {
- id: this.deathTasktypeIdPatient, //转科
- },
- startDept: {
- //起点科室
- id: this.createOrderObj.sqDept.id,
- },
- createDept: this.applyDept, //申请科室
- endDepts: [
- //终点科室
- {
- id: id,
- },
- ],
- patient: {
- patientCode: this.createOrderObj.patient.patientCode,
- },
- },
- };
- this.mainService.buildOrder(postData).subscribe((result) => {
- this.createLoading = false;
- this.deptFlag = false;
- if (result["status"] == 200) {
- this.showPromptModal("建单", true, "");
- } else {
- this.showPromptModal("建单", false, result["msg"]);
- }
- });
- }
- // 隐藏选择转入科室的模态框
- deptFlagHand(e) {
- this.deptFlag = false;
- }
- // 打开模态框,服务台右侧转入院记录建单
- createOrderObj; //当前操作id
- createLoading = false;
- deptFlag = false;
- patientLogBuild(obj) {
- this.createOrderObj = obj;
- this.deptFlag = true;
- }
- // 初始化展示形式
- controlView = {}; //展示形式
- initControlView() {
- let that = this;
- let postData = {
- controlView: {},
- idx: 0,
- sum: 1,
- };
- that.mainService
- .coopTypeConfig("fetchDataList", "controlView", postData)
- .subscribe((data) => {
- that.controlView = data.list[0] ? data.list[0] : [];
- if (!data.list.length) return;
- // switch (data.list[0].workerNum) {
- // case 1:
- // that.patientCareCol = 6;
- // break;
- // case 2:
- // that.patientCareCol = 7;
- // break;
- // case 3:
- // that.patientCareCol = 4;
- // break;
- // }
- that.patientCareCol = 7;
- this.hurseInfoHiding = data.list[0].hurseInfoHiding ? 1 : 0;
- // that.txtLabelCol = data.list[0].labelNum;
- that.txtLabelCol = 1;
- that.orderRefreshTime = that.orderInfoTime = data.list[0].orderInfoTime;
- that.workerRefreshTime = that.workerInfoTime =
- data.list[0].workerInfoTime;
- that.audioNotDispatched = data.list[0].unsendOrderVoice !== false;
- this.orderType = data.list[0].orderType || 'priority';
- that.checkTab(this.typeId);
- this.getOrderList(1);
- this.getOrderList(2);
- this.getOrderList(3);
- });
- }
- // 保存展现形式
- saveControlView() {
- let that = this;
- that.saveLoading = true;
- let wn;
- switch (that.patientCareCol) {
- case 6:
- wn = 1;
- break;
- case 7:
- wn = 2;
- break;
- case 4:
- wn = 3;
- break;
- }
- let postData = {
- controlView: {
- workerNum: wn,
- labelNum: that.txtLabelCol,
- workerInfoTime: that.workerInfoTime,
- orderInfoTime: that.orderInfoTime,
- unsendOrderVoice: that.audioNotDispatched,
- hurseInfoHiding: that.hurseInfoHiding === 1,
- orderType: this.orderType,
- },
- };
- if (that.controlView["id"]) {
- postData.controlView["id"] = that.controlView["id"];
- }
- console.log(postData);
- that.mainService
- .coopTypeConfig("addData", "controlView", postData)
- .subscribe((data) => {
- that.saveLoading = false;
- if (data.status == 200) {
- that.msg.success('排序成功');
- this.initControlView();
- } else {
- that.msg.error(data.msg || '排序失败');
- }
- });
- }
- closeModel(e) {
- if (e === "close") {
- this.newOrderShowOpen = false; //此时可出现新的弹窗
- } else if (e === "closeGo") {
- this.showNewOrder("&go&");
- }
- }
- // 展示信息提示框(con:提示信息,success:操作是否成功,promptInfo:操作结果提示信息)(con:提示信息,success:操作是否成功,promptInfo:操作结果提示信息)
- showPromptModal(con, success, promptInfo?, back?) {
- this.promptModalShow = false;
- this.promptContent = con;
- this.ifSuccess = success;
- this.promptInfo = promptInfo;
- this.back = back || "";
- setTimeout(() => {
- this.showPromptModalRefresh();
- this.promptModalShow = true;
- }, 100);
- }
- showPromptModalRefresh(){
- this.getUnassignedBuilding2();
- this.resetList();
- this.getOrderList(1);
- this.getOrderList(2);
- this.getOrderList(3);
- this.getVisitList();
- this.getMessageList();
- if (this.currentRTab === 0) {
- this.getWorkOrders(this.applyDept);
- } else if (this.currentRTab === 1) {
- this.getPatientLog(this.applyDept);
- } else if (this.currentRTab === 2) {
- this.getItsmOrders(this.incidentModel.department);
- } else if (this.currentRTab === 3) {
- this.getDictionaryList();
- }
- this.fixedTab = "";
- this.fixedMenuShangla();
- }
- // 格式化时分秒
- // (时间小于一分钟则显示秒,时间大于一分钟则显示分钟数,如超出一小时则显示小时和分钟。)time: 秒
- formatTime(time) {
- let timeStr = "";
- if (time >= 0 && time < 60) {
- // 秒
- timeStr = time + "秒";
- } else if (time >= 60 && time < 3600) {
- // 分钟
- timeStr = Math.floor(time / 60) + "分钟";
- } else if (time >= 3600) {
- // 时 + 分
- let h = "";
- let m = "";
- h = Math.floor(time / 3600) + "小时";
- m = time % 3600 >= 60 ? Math.floor((time % 3600) / 60) + "分钟" : "";
- timeStr = h + m;
- }
- return timeStr;
- }
- // 菜单拖拽-上下
- moveMenu(nodeId) {
- let fixedMenu = document.getElementById(nodeId);
- if (!fixedMenu) return;
- fixedMenu.onmousedown = function (e) {
- fixedMenu.classList.remove('maskFull');
- let y = e.clientY - fixedMenu.offsetTop;
- document.onmousemove = function (ev) {
- fixedMenu.classList.add('maskFull');
- var _y = ev.clientY - y > 0 ? ev.clientY - y : 0;
- var wh = window.innerHeight;
- if (_y > wh - fixedMenu.clientHeight) {
- _y = wh - fixedMenu.clientHeight;
- }
- fixedMenu.style.top = _y + "px";
- };
- document.onmouseup = function () {
- fixedMenu.classList.remove('maskFull');
- document.onmousemove = null;
- document.onmouseup = null;
- };
- };
- }
- // 处理人+协同人
- transferSynergetic(incidentData){
- let str = incidentData.groupORHandlerUser || "";
- if(incidentData.synergetic && incidentData.synergetic.length){
- str += ',' + incidentData.synergetic.map(v => v.name).join(',');
- }
- return str;
- }
- // 菜单拖拽-自由
- moveMenuAll(nodeId) {
- let fixedMenu = document.getElementById(nodeId);
- if (!fixedMenu) return;
- fixedMenu.onmousedown = function (e) {
- fixedMenu.classList.remove('maskFull');
- let x = e.clientX - fixedMenu.offsetLeft;
- let y = e.clientY - fixedMenu.offsetTop;
- document.onmousemove = function (ev) {
- fixedMenu.classList.add('maskFull');
- var _y = ev.clientY - y > 0 ? ev.clientY - y : 0;
- var h = window.innerHeight;
- if (_y > h - fixedMenu.clientHeight) {
- _y = h - fixedMenu.clientHeight;
- }
- fixedMenu.style.top = _y + "px";
- var _x = ev.clientX - x > 0 ? ev.clientX - x : 0;
- var w = window.innerWidth;
- if (_x > w - fixedMenu.clientWidth) {
- _x = w - fixedMenu.clientWidth;
- }
- fixedMenu.style.right = w - _x - fixedMenu.clientWidth + "px";
- };
- document.onmouseup = function () {
- fixedMenu.classList.remove('maskFull');
- document.onmousemove = null;
- document.onmouseup = null;
- };
- };
- }
- @ViewChild("msgTemplate", { static: false }) msgTemplate: TemplateRef<any>; //消息通知模板
- // 消息提醒
- createBasicNotification(msgs): void {
- this.notification.template(this.msgTemplate, {
- nzDuration: 0,
- nzData: msgs,
- });
- }
- // tab头部分组向左移动
- disXHead = 0;
- headToLeft() {
- let num = Math.floor(this.tabs.nativeElement.offsetWidth / 126);
- let maxStep = this.scopeGroups.length - (num - 1);
- this.disStep = Math.max(-maxStep, --this.disStep);
- this.disXHead = this.disStep * 126;
- }
- // tab头部分组向右移动
- headToRight() {
- this.disStep = Math.min(0, ++this.disStep);
- this.disXHead = this.disStep * 126;
- }
- //服务台建单任务类型搜索查询
- onSearchTaskBuild(e) {
- this.onSearchTaskBuildSubject.next(e);
- }
- //获取任务类型
- getTasktypeByPhone(e) {
- this.getSearchTaskList(e).subscribe((result) => {
- if (result.status == 200) {
- this.searchTaskLoading = false;
- this.searchTaskList = result.data;
- this.searchTaskList.forEach((item) => {
- item.sid = item.associationTypeId + "_" + item.id + "_" + item.associationTypeValue;
- });
- }
- });
- }
- //服务台建单任务类型回车,0_1,0是关联类型,1是任务类型
- changeTaskBuild(e) {
- let arr = e.split("_");
- if(arr[2] === 'other' || arr[2] === 'specimen' || arr[2] === 'ordinary'){
- this.currentTabIndex = '物品配送';
- }else if(arr[2] === 'patientTransport'){
- this.currentTabIndex = '患者转运';
- }
- if (this.currentTabIndex == "患者转运") {
- //患者其他服务业务
- this.radioValueZy = +arr[1];
- } else if (this.currentTabIndex == "物品配送") {
- //其他临床服务
- this.radioValueQt = +arr[1];
- }
- }
- // 运维、配送工单切换
- filterOrderList(type, state){
- if(!this.itsmData.mdv2Switch && this.hsmsData.hsmsSwitch){
- return;
- }
- if(this.itsmData.mdv2Switch && !this.hsmsData.hsmsSwitch){
- return;
- }
- this.flagList[`${type}Flag${state}`] = !this.flagList[`${type}Flag${state}`];
- this.getOrderList(state, state === 1);
- }
- // 排序
- orderType: string = 'priority'; //排序方式 priority:优先级,time:时间
- orderList(){
- this.orderType = this.orderType === 'priority' ? 'time' : 'priority';
- this.saveControlView();
- }
- // 优先级颜色
- priorityColor(priorityId) {
- // 极低|低
- if(priorityId == 1 || priorityId == 2){
- return '';
- } else if(priorityId == 3){
- return 'yellow';
- } else if(priorityId == 4 || priorityId == 5){
- return 'red';
- }
- }
- // 延期记录
- transferHandlerLog = function (currentLog) {
- if(!currentLog){
- return '';
- }
- currentLog = cloneDeep(currentLog);
- if(currentLog.extra1DTO && currentLog.extra2 && currentLog.startTime){
- if(currentLog.extra2==0.5){
- currentLog.extra2 = 4;
- return currentLog.extra1DTO.name+"<br>"+ format(addHours(currentLog.startTime, +currentLog.extra2), "MM月dd日")+"<br>"+ format(addHours(currentLog.startTime, +currentLog.extra2), "HH时mm分前完成");
- }else{
- return currentLog.extra1DTO.name+"<br>"+ format(addDays(currentLog.startTime, +currentLog.extra2), "MM月dd日前完成");
- }
- }else{
- return '';
- }
- }
- // 生成工单
- buildType;
- editOrder;
- generateOrder(data){
- this.editOrder = cloneDeep(data);
- let incidentModel = cloneDeep(data);
- let incidentMsg:any = {};
- console.log('data:', data)
- // incidentModel.department && (this.applicationDeptList = [cloneDeep(incidentModel.department)]);
- incidentModel.department && (incidentMsg.deptManyPhone = incidentModel.department.manyPhone);
- incidentModel.department && (incidentMsg.deptName = incidentModel.department.dept);
- incidentModel.department && (incidentModel.department = incidentModel.department.id);
- incidentModel.requester && (this.applicationRequesterList = [cloneDeep(incidentModel.requester)]);
- incidentModel.requester && (incidentMsg.requesterPhone = incidentModel.requester.phone);
- incidentModel.requester && (incidentMsg.requesterName = incidentModel.requester.name);
- incidentModel.requester && (incidentModel.requester = incidentModel.requester.id);
- if(incidentModel.repairIncidentType){
- incidentModel.repairIncidentType = incidentModel.repairIncidentType.value
- this.changeRepairIncidentType(incidentModel.repairIncidentType);
- }
- incidentModel.source && (incidentModel.source = incidentModel.source.id);
- incidentModel.area && (incidentModel.area = incidentModel.area.id);
- incidentModel.place && (incidentModel.place = incidentModel.place.id);
- incidentModel.category && (this.applicationCategoryList = [cloneDeep(incidentModel.category)]);
- incidentModel.category && (incidentModel.category = incidentModel.category.id);
- this.incidentModel = incidentModel;
- this.incidentMsg = incidentMsg;
- this.incidentModel.category && this.changeApplyCategory(this.incidentModel.category, true);
- console.log('this.applicationDeptList:', this.applicationDeptList)
- console.log('incidentModel:', incidentModel)
- this.showNewOrder('', '', true, '报修转事件');
- // 查询报修图片
- this.getRepairImgs(data.id);
- }
- // 继续建单
- storageSj(data){
- this.editOrder = cloneDeep(data);
- let incidentModel = cloneDeep(data);
- let incidentMsg:any = {};
- console.log('data:', data)
- // incidentModel.department && (this.applicationDeptList = [cloneDeep(incidentModel.department)]);
- incidentModel.department && (incidentMsg.deptManyPhone = incidentModel.department.manyPhone);
- incidentModel.department && (incidentMsg.deptName = incidentModel.department.dept);
- incidentModel.department && (incidentModel.department = incidentModel.department.id);
- incidentModel.requester && (this.applicationRequesterList = [cloneDeep(incidentModel.requester)]);
- incidentModel.requester && (incidentMsg.requesterPhone = incidentModel.requester.phone);
- incidentModel.requester && (incidentMsg.requesterName = incidentModel.requester.name);
- incidentModel.requester && (incidentModel.requester = incidentModel.requester.id);
- if(incidentModel.repairIncidentType){
- incidentModel.repairIncidentType = incidentModel.repairIncidentType.value
- this.changeRepairIncidentType(incidentModel.repairIncidentType);
- }
- incidentModel.source && (incidentModel.source = incidentModel.source.id);
- incidentModel.area && (incidentModel.area = incidentModel.area.id);
- incidentModel.place && (incidentModel.place = incidentModel.place.id);
- incidentModel.category && (this.applicationCategoryList = [cloneDeep(incidentModel.category)]);
- incidentModel.category && (incidentModel.category = incidentModel.category.id);
- this.incidentModel = incidentModel;
- this.incidentMsg = incidentMsg;
- console.log('this.applicationDeptList:', this.applicationDeptList)
- console.log('incidentModel:', incidentModel)
- this.showNewOrder('', '', true, '继续建单');
- // 查询报修图片
- this.getRepairImgs(data.id);
- }
- // 获取报修图片
- repairImgs:any[] = [];//报修图片
- getRepairImgs(incidentId) {
- this.mainService
- .getPreviewImage('wechatRequesterIncident', incidentId)
- .subscribe((res:any) => {
- res.data = res.data || [];
- res.data.forEach(v => {
- v.previewUrl = location.origin + "/file" + v.relativeFilePath;
- v.thumbFilePath = location.origin + "/file" + v.thumbFilePath;
- })
- this.repairImgs = res.data;
- });
- }
- // 预览图片
- imgs = [];
- isPreview = false;
- initialViewIndex:number = 0;
- previewImageHandler(data = [], index = 0) {
- this.initialViewIndex = index;
- console.log(index)
- this.isPreview = false;
- data = data || [];
- this.imgs = data.map((v) => location.origin + '/file' + v.relativeFilePath);
- setTimeout(() => {
- this.isPreview = true;
- }, 0)
- }
- // 不受理-弹窗
- rejectModalShow = false; //弹窗开关
- rejectFn(data) {
- this.coopData = data;
- this.rejectModalShow = true;
- }
- // 关闭弹窗
- closeRejectModelOrder(e) {
- this.rejectModalShow = JSON.parse(e).show;
- }
- // 弹窗确定
- confirmRejectModelOrder(rejectRemark){
- this.maskFlag = this.msg.loading("正在加载中..", {
- nzDuration: 0,
- }).messageId;
- let postData = {
- incident: {
- ...this.coopData,
- rejectRemark,
- },
- }
- console.log(postData);
- // return;
- this.mainService
- .flowPost("incident/task/reject", postData)
- .subscribe((result) => {
- this.msg.remove(this.maskFlag);
- this.maskFlag = false;
- if (result.state == 200) {
- this.rejectModalShow = false;
- this.showPromptModal("不受理", true, "", "");
- } else {
- this.msg.error(result.msg || '不受理失败');
- }
- });
- }
- // 编辑-弹窗
- edit(data){
- this.editOrder = cloneDeep(data);
- let incidentModel = cloneDeep(data);
- let incidentMsg:any = {};
- console.log('data:', data)
- incidentModel.department && (incidentMsg.deptManyPhone = incidentModel.department.manyPhone);
- incidentModel.department && (incidentMsg.deptName = incidentModel.department.dept);
- incidentModel.department && (incidentModel.department = incidentModel.department.id);
- incidentModel.requester && (this.applicationRequesterList = [cloneDeep(incidentModel.requester)]);
- incidentModel.requester && (incidentMsg.requesterPhone = incidentModel.requester.phone);
- incidentModel.requester && (incidentMsg.requesterName = incidentModel.requester.name);
- incidentModel.requester && (incidentModel.requester = incidentModel.requester.id);
- if(incidentModel.repairIncidentType){
- incidentModel.repairIncidentType = incidentModel.repairIncidentType.value
- this.changeRepairIncidentType(incidentModel.repairIncidentType);
- }
- incidentModel.source && (incidentModel.source = incidentModel.source.id);
- incidentModel.area && (incidentModel.area = incidentModel.area.id);
- incidentModel.place && (incidentModel.place = incidentModel.place.id);
- incidentModel.category && (this.applicationCategoryList = [cloneDeep(incidentModel.category)]);
- incidentModel.category && (incidentModel.category = incidentModel.category.id);
- this.incidentModel = incidentModel;
- this.incidentMsg = incidentMsg;
- console.log('this.applicationRequesterList:', this.applicationRequesterList)
- console.log('this.applicationDeptList:', this.applicationDeptList)
- console.log('incidentModel:', incidentModel)
- this.showNewOrder('', '', true, '编辑事件');
- // 查询报修图片
- this.getRepairImgs(data.id);
- }
- // 换人处理-弹窗
- substitutionModalShow = false; //弹窗开关
- substitution(data) {
- this.coopData = data;
- this.substitutionModalShow = true;
- }
- // 关闭弹窗
- closeSubstitutionModelOrder(e) {
- this.substitutionModalShow = JSON.parse(e).show;
- }
- // 弹窗确定
- confirmSubstitutionModelOrder(e){
- console.log(e);
- this.substitutionModalShow = false;
- this.showPromptModalRefresh();
- }
- // 是否显示接单按钮
- computedReceive(data){
- let inUser = data.currentLog && data.currentLog.workerId == this.tool.getCurrentUserId();
- let inGroup = false;
- let groupList = this.tool.getCurrentGroupList();
- groupList.forEach(item => {
- if(data.currentLog){
- if (item.id == data.currentLog.groupId) {
- inGroup = true;
- }
- }
- })
- return data.state.value === 'pending' && (inUser || inGroup) && this.coopBtns.receive && data.deleteFlag !== 1;
- }
- // 是否显示换人处理按钮
- computedSubstitution(data){
- return (data.state.value === 'pending' || data.state.value === 'handler' || (data.state.value === 'reassign' && this.coopBtns.assign)) && data.deleteFlag !== 1;
- }
- // 是否显示编辑按钮
- computedEdit(data){
- return (data.state.value === 'pending' || data.state.value === 'reassign' || data.state.value === 'handler' || data.state.value === 'close') && this.coopBtns.edit && data.deleteFlag !== 1;
- }
- // 是否显示处理按钮
- computedHandle(data){
- return this.coopBtns.handle && data.state.value === 'handler' && data.handlingPersonnelUser && data.handlingPersonnelUser.id == this.tool.getCurrentUserId() && data.deleteFlag !== 1;
- }
- delModal: boolean = false; //删除模态框
- tipsMsg1: string; //提示框信息
- tipsMsg2: string; //操作后信息
- confirmDelType: string; //确认的类型(启用/停用,删除)
- showDelModal(
- e,
- data,
- tipsMsg1: string,
- tipsMsg2: string,
- type: string,
- ) {
- e && e.stopPropagation();
- this.confirmDelType = type;
- this.delModal = true;
- this.coopData = data;
- this.tipsMsg1 = tipsMsg1;
- this.tipsMsg2 = tipsMsg2;
- }
- // 隐藏删除框
- hideDelModal() {
- this.delModal = false;
- }
- // 确认删除
- confirmDelFn() {
- this.btnLoading = true;
- if (this.confirmDelType === "del") {
- //删除
- this.mainService
- .simplePost("rmvData", "incident", [this.coopData.id])
- .subscribe((data) => {
- this.btnLoading = false;
- this.delModal = false;
- if (data.status == 200) {
- this.showPromptModal(this.tipsMsg2, true, "");
- } else {
- this.showPromptModal(this.tipsMsg2, false, data.msg);
- }
- });
- }else if (this.confirmDelType === "receive") {
- //接单
- this.mainService
- .flowPost("incident/task/receive", { incident: this.coopData })
- .subscribe((data) => {
- this.btnLoading = false;
- this.delModal = false;
- if (data.state == 200) {
- this.showPromptModal(this.tipsMsg2, true, "");
- } else {
- this.showPromptModal(this.tipsMsg2, false, data.msg);
- }
- });
- }else if (this.confirmDelType === "checkout") {
- //签出
- this.btnLoading = false;
- this.delModal = false;
- this.msg.success('签出成功');
- if(this.incomingService.getSign() === 'box'){
- this.incomingService.closeWs(true);
- this.incomingService.removeSign();
- }if(this.incomingService.getSign() === 'callCenter'){
- this.incomingService.closeWs(true);
- this.incomingService.removeSign();
- this.incomingService.removeSocketUrl();
- }
- this.incomingService.removePhoneNumber();
- }
- }
- // 处理-弹窗
- handleModalShow = false; //弹窗开关
- handle(data) {
- this.coopData = data;
- this.handleModalShow = true;
- }
- // 关闭弹窗
- closeHandleModelOrder(e) {
- this.handleModalShow = JSON.parse(e).show;
- }
- // 弹窗确定
- confirmHandleModelOrder(e){
- console.log(e);
- this.handleModalShow = false;
- this.showPromptModalRefresh();
- }
- // 回访列表
- visitShow = false; //弹窗开关
- visitOrder() {
- this.visitShow = true;
- }
- // 关闭弹窗
- closeVisit(e) {
- this.visitShow = JSON.parse(e).show;
- }
- // 留言列表
- messageShow = false; //弹窗开关
- messageOrder() {
- this.messageShow = true;
- }
- // 关闭弹窗
- closeMessage(e) {
- this.messageShow = e.show;
- if(e.data){
- // 留言创建工单
- let postData = {
- hosId: this.tool.getCurrentHospital().id,
- phone: e.data.ano,
- };
- this.maskFlag = this.msg.loading("正在加载中..", {
- nzDuration: 0,
- }).messageId;
- this.mainService
- .findPhoneDept(postData)
- .subscribe((result:any) => {
- this.msg.remove(this.maskFlag);
- this.maskFlag = false;
- if (result.state == 200) {
- this.mainService.getDictionary("list", "incident_source").subscribe((res) => {
- let sourceList = res || [];
- let incidentModel:any = {
- hjzxRecordId: e.data.id,
- incomingPhone: e.data.ano,
- };
- let incidentMsg:any = {};
- let source = sourceList.find(v => v.value === 'record');
- source && (incidentModel.source = source.id);
- if (result.data.length > 0) {
- //绑定了科室
- incidentModel.department = result.data[0];
- incidentModel.department && incidentModel.department.hospital && (incidentModel.hosId = incidentModel.department.hospital.parent ? incidentModel.department.hospital.parent.id : incidentModel.department.hospital.id);
- incidentModel.department && incidentModel.department.building && (incidentModel.area = incidentModel.department.building.id);
- incidentModel.department && incidentModel.department.floor && (incidentModel.place = incidentModel.department.floor.id);
- incidentModel.department && incidentModel.department.address && (incidentModel.houseNumber = incidentModel.department.address);
- incidentModel.department && (incidentMsg.deptManyPhone = incidentModel.department.manyPhone);
- incidentModel.department && (incidentMsg.deptName = incidentModel.department.dept);
- incidentModel.department && (incidentModel.department = incidentModel.department.id);
- incidentModel.repairIncidentType = 'dept';
- this.changeRepairIncidentType(incidentModel.repairIncidentType);
- this.incidentModel = incidentModel;
- console.log('this.incidentModel:', this.incidentModel)
- this.incidentMsg = incidentMsg;
- this.showNewOrder('', '', true, '留言转事件');
- } else {
- //没绑定科室
- this.incidentModel = incidentModel;
- this.incidentMsg = incidentMsg;
- this.showNewOrder('', '', true, '留言转事件');
- }
- });
- }
- });
- }
- }
- // 通话记录列表
- callShow = false; //弹窗开关
- callOrder() {
- this.callShow = true;
- }
- // 关闭弹窗
- closeCall(e) {
- this.callShow = e.show;
- }
- // 详细地址获取焦点
- isShowAddressList:boolean = false;
- focusAddress(){
- this.isShowAddressList = true;
- this.getAddressList();
- }
- // 点击其他位置
- clickExtra(e){
- if(document.documentElement.contains(document.querySelector('.addressList')) && e.target !== document.querySelector('.addressFocus')){
- this.isShowAddressList = false;
- }
- }
- // 选择地址
- selectAddress(name){
- this.incidentModel.houseNumber = name;
- this.isShowAddressList = false;
- }
- // 获取科室地点列表
- addressList:any[] = [];
- addressLoading:boolean = false;
- getAddressList() {
- if(!this.incidentModel.department){
- this.addressList = [];
- return;
- }
- let postData = {
- idx: 0,
- sum: 99999,
- qrCode: {
- deptId: this.incidentModel.department,
- }
- };
- this.addressLoading = true;
- this.mainService.getFetchDataList("simple/data", "qrCode", postData).subscribe(result=>{
- this.addressLoading = false;
- if(result.status == 200){
- this.addressList = result.list || [];
- }else{
- this.addressList = [];
- }
- });
- }
- }
|