fuwutai.component.ts 197 KB

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