hushijiandan.component.ts 184 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820
  1. import {
  2. Component,
  3. ElementRef,
  4. OnInit,
  5. TemplateRef,
  6. ViewChild,
  7. } from "@angular/core";
  8. import {
  9. FormBuilder,
  10. Validators,
  11. FormGroup,
  12. FormControl,
  13. } from "@angular/forms";
  14. import { Router, ActivatedRoute } from "@angular/router";
  15. import http from "../../../assets/js/http";
  16. import { MainService } from "../../services/main.service";
  17. import { WebsocketNurseService } from "../../services/websocket-nurse.service";
  18. import { NzMessageService, UploadFile } from "ng-zorro-antd";
  19. import { NzNotificationService } from "ng-zorro-antd/notification";
  20. import { OverlayScrollbarsComponent } from "overlayscrollbars-ngx";
  21. import { ToolService } from "../../services/tool.service";
  22. import { Subject } from "rxjs";
  23. import { debounceTime, filter } from "rxjs/operators";
  24. import { HttpRequest, HttpResponse, HttpClient } from '@angular/common/http';
  25. import {
  26. format,
  27. getMinutes,
  28. setMinutes,
  29. addDays,
  30. differenceInCalendarDays,
  31. getHours,
  32. startOfDay,
  33. endOfDay,
  34. parse,
  35. subHours,
  36. startOfMinute,
  37. addMinutes
  38. } from "date-fns";
  39. import { SourceId } from "src/app/type/types";
  40. import cloneDeep from 'lodash-es/cloneDeep'
  41. // 日期禁用
  42. function range(start: number, end: number): number[] {
  43. const result: number[] = [];
  44. for (let i = start; i < end; i++) {
  45. result.push(i);
  46. }
  47. return result;
  48. }
  49. @Component({
  50. selector: "app-hushijiandan",
  51. templateUrl: "./hushijiandan.component.html",
  52. styleUrls: ["./hushijiandan.component.less"],
  53. })
  54. export class HushijiandanComponent implements OnInit {
  55. @ViewChild('printBtn', { static: false }) printBtn: ElementRef<HTMLElement>;
  56. @ViewChild("remarksEle", { static: false }) remarksEle: ElementRef;
  57. @ViewChild("remarksEle1", { static: false }) remarksEle1: ElementRef;
  58. @ViewChild("remarksEle2", { static: false }) remarksEle2: ElementRef;
  59. @ViewChild("osComponentRef1", {
  60. read: OverlayScrollbarsComponent,
  61. static: false,
  62. })
  63. osComponentRef1: OverlayScrollbarsComponent;
  64. @ViewChild("osComponentRef2", {
  65. read: OverlayScrollbarsComponent,
  66. static: false,
  67. })
  68. osComponentRef2: OverlayScrollbarsComponent;
  69. @ViewChild("osComponentRef3", {
  70. read: OverlayScrollbarsComponent,
  71. static: false,
  72. })
  73. osComponentRef3: OverlayScrollbarsComponent;
  74. @ViewChild("osComponentRef4", {
  75. read: OverlayScrollbarsComponent,
  76. static: false,
  77. })
  78. osComponentRef4: OverlayScrollbarsComponent;
  79. // @ViewChild("osComponentRef5", {
  80. // read: OverlayScrollbarsComponent,
  81. // static: false,
  82. // })
  83. // osComponentRef5: OverlayScrollbarsComponent;
  84. @ViewChild("osComponentRef6", {
  85. read: OverlayScrollbarsComponent,
  86. static: false,
  87. })
  88. osComponentRef6: OverlayScrollbarsComponent;
  89. @ViewChild("osComponentRef7", {
  90. read: OverlayScrollbarsComponent,
  91. static: false,
  92. })
  93. osComponentRef7: OverlayScrollbarsComponent;
  94. @ViewChild("osComponentRef8", {
  95. read: OverlayScrollbarsComponent,
  96. static: false,
  97. })
  98. osComponentRef8: OverlayScrollbarsComponent;
  99. @ViewChild("osComponentRef9", {
  100. read: OverlayScrollbarsComponent,
  101. static: false,
  102. })
  103. osComponentRef9: OverlayScrollbarsComponent;
  104. @ViewChild("osComponentRef10", {
  105. read: OverlayScrollbarsComponent,
  106. static: false,
  107. })
  108. osComponentRef10: OverlayScrollbarsComponent;
  109. @ViewChild("osComponentRef11", {
  110. read: OverlayScrollbarsComponent,
  111. static: false,
  112. })
  113. osComponentRef11: OverlayScrollbarsComponent;
  114. othersListOptions: any;
  115. sortableTimer = null;
  116. searchAccountSubject = new Subject(); //查工号防抖
  117. searchTabInpSubject = new Subject(); //左侧查患者信息和检查信息防抖
  118. otherSearchChangeSubject = new Subject(); //其他建单搜索防抖
  119. inspectSubject = new Subject();
  120. changeAssetInpSubject = new Subject();
  121. changeCommonInpSubject = new Subject();
  122. isYyInspect = false; //需要预约检查
  123. inspectAndPatientTransportConfig:any = {timeMod: 30};
  124. constructor(
  125. private message: NzMessageService,
  126. private fb: FormBuilder,
  127. public router: Router,
  128. private route: ActivatedRoute,
  129. private mainService: MainService,
  130. private notification: NzNotificationService,
  131. private webs: WebsocketNurseService,
  132. public tool: ToolService,
  133. public http: HttpClient
  134. ) {
  135. this.othersListOptions = {
  136. onUpdate: (event: any) => {
  137. // 触发一次排序
  138. clearTimeout(this.sortableTimer);
  139. this.sortableTimer = setTimeout(() => {
  140. let postData = {
  141. orders: [],
  142. tabId: this.checkedTableType == 'other' ? undefined : this.checkedTableType,
  143. };
  144. postData.orders = this.othersList[this.checkedTableType].map((item, i) => {
  145. return {
  146. id: item.id,
  147. orders: i,
  148. };
  149. });
  150. this.mainService
  151. .coopConfig("setOrders", postData)
  152. .subscribe((result) => {});
  153. }, 500);
  154. },
  155. };
  156. }
  157. // 下拉
  158. showDropdown:boolean = false;
  159. // 关闭倒计时
  160. closeTime = 3;
  161. closeTimeFlag;
  162. timerCloseTime = null;
  163. changeShow = true;
  164. currentHospital; //当前院区
  165. currentDept; //当前科室
  166. logTimer = null; //综合日志定时器
  167. logTime = 0; //综合日志自动刷新秒数
  168. logTimeConst = 60; //综合日志自动刷新秒数
  169. orderListTimer = null; //工单列表定时器
  170. orderListTime = 0; //工单列表自动刷新秒数
  171. orderListTimeConst = 60; //工单列表自动刷新秒数
  172. deptDisplay; //护士端是否显示可以别名,1是显示科室名称,2是显示科室别名
  173. pathologyModal:boolean = false; //病理申请单
  174. pathologyDetailModal:boolean = false; //病理详情
  175. // 初始化权限按钮
  176. coopBtns: any = {};
  177. surgeryDataId: any; //手术id
  178. patientDataId: any; //病人id
  179. smartShow:boolean = false; //智能客服弹框
  180. ngOnInit() {
  181. this.getCoopBtns();
  182. this.currentHospital = this.tool.getCurrentHospital();
  183. this.tool.getDeptDisplay().subscribe((result) => {
  184. if (result.status == 200) {
  185. this.deptDisplay = result.list[0].valueconfig;
  186. }
  187. });
  188. this.getItsmIncident();
  189. this.getPagePermissionConfigList();
  190. this.getInspectAndPatientTransportConfigTasktype();
  191. this.getUpdateTipsForNurses();
  192. this.getRefreshNurseWorkOrderTime();
  193. this.getCloseTimeFlag();
  194. this.getCmdbRepairFlag();
  195. this.currentDept = this.tool.getCurrentUserDept();
  196. console.log(this.currentDept, this.tabSearchCont);
  197. this.currentDept.typeValue == 'surgery' && !this.tabSearchCont && this.getSurgeryConfig();
  198. this.getSpecimenButton();
  199. //防抖
  200. this.getAccountList();
  201. this.searchAccountSubject.pipe(debounceTime(500)).subscribe((v:any) => {
  202. this.getAccountList(v);
  203. });
  204. this.searchTabInpSubject.pipe(debounceTime(500)).subscribe((v) => {
  205. this.getPatient(v);
  206. });
  207. this.otherSearchChangeSubject.pipe(debounceTime(500)).subscribe((v) => {
  208. this.getDeptTaskType(v);
  209. });
  210. this.inspectSubject.pipe(debounceTime(500)).subscribe((v) => {
  211. this.refreshInspectList();
  212. });
  213. this.changeAssetInpSubject.pipe(debounceTime(500)).subscribe((v) => {
  214. this.getAssetData(v);
  215. });
  216. this.changeCommonInpSubject.pipe(debounceTime(500)).subscribe((v) => {
  217. this.searchApplicationCategory(v);
  218. });
  219. this.getTodayNum();
  220. this.initLogin();
  221. this.getDeptTaskType();
  222. this.getAdvice();
  223. this.getOrderSelectList();
  224. this.getCheckStatusLis();
  225. this.refreshSpecimenWorkOrderMsg();
  226. this.initRole();
  227. this.getWebsocket();
  228. this.getTaskTypesId();
  229. // 综合日志倒计时 start
  230. this.logTime = this.logTimeConst;
  231. clearInterval(this.logTimer);
  232. this.logTimer = setInterval(() => {
  233. this.logTime--;
  234. if (this.logTime === 0) {
  235. this.logTime = this.logTimeConst;
  236. if (this.smallTabId == 1) {
  237. this.listDeptOrderRecord();
  238. } else if (this.smallTabId == 2) {
  239. this.getQuickBxlb();
  240. }
  241. this.getTodayNum(); //当日工单数量
  242. }
  243. }, 1000);
  244. // 综合日志倒计时 end
  245. }
  246. ngOnDestroy() {
  247. clearInterval(this.moveId);
  248. clearInterval(this.moveId1);
  249. clearInterval(this.msgTimerId);
  250. clearInterval(this.logTimer);
  251. clearInterval(this.orderListTimer);
  252. this.webs.closeWs(true);
  253. }
  254. loginUser: any = localStorage.getItem("user")
  255. ? JSON.parse(localStorage.getItem("user")).user
  256. : null; //登录人信息
  257. loginUserDeptId: number = JSON.parse(localStorage.getItem("user")).user.dept
  258. .id; //登录人所属科室
  259. appointmentBuildFlag = "0"; //是否开启护士端预约建单-患者陪检
  260. appointmentZyBuildFlag = "0"; //是否开启护士端预约建单-患者其他
  261. leadTime = 0; //护士端预约建单生效时长
  262. followFlag = "0"; //是否开启护士端终点关注
  263. promptContent: string; //操作提示框提示信息
  264. ifSuccess: boolean; //操作成功/失败
  265. promptInfo: string; //操作结果提示信息
  266. back: string; //操作结果后回调标识
  267. promptModalShow: boolean; //操作提示框是否展示
  268. hsPromptModalShow: boolean = false; //护士端科室切换提示框是否展示
  269. deptTaskTypeRules: any = {}; //当前登录科室任务类型信息规则
  270. orderSelectList: any = []; //工单列表筛选选项
  271. orderSelected = "-1"; //工单列表下拉框选中
  272. orderStateSelected = "1"; //工单列表工单状态下拉框选中
  273. tabSearchCont: string = ""; //左侧tab搜索框内容
  274. pLoading: boolean = true; //患者信息loading
  275. patientList: any = []; //左侧tab患者信息list
  276. infoPageIdx: number = 1; //左侧tab页码
  277. infoLength: number = 5; //左侧tab信息总数
  278. specimenWorkOrderMsg: any = {}; //急标普标数量&信息
  279. jpDrugsWKOMsg: any = {}; //药品静配提示信息
  280. surgeryWKOMsg: any = {}; //手术提示信息
  281. detailId:any = null; //病理申请单详情id
  282. getCoopBtns(){
  283. let menu: any = JSON.parse(localStorage.getItem("menu")) || []; //菜单
  284. let coopBtns:any = {};
  285. let nurseMenu = menu.find(v => v.link === 'nurse');
  286. let nurseMenuChildren = nurseMenu.childrens || [];
  287. nurseMenuChildren.forEach((e) => {
  288. switch (e.link) {
  289. case "suggestionBox":
  290. coopBtns.suggestionBox = true; //意见箱
  291. break;
  292. case "surgery":
  293. coopBtns.surgery = true; //手术排程信息
  294. break;
  295. case "outpatientHelpAppointment":
  296. coopBtns.outpatientHelpAppointment = true; //门诊帮扶预约
  297. break;
  298. case "inquiryOfHistoricalSpecimens":
  299. coopBtns.inquiryOfHistoricalSpecimens = true; //历史标本查询
  300. break;
  301. case "historicalMedicineListInquiry":
  302. coopBtns.historicalMedicineListInquiry = true; //历史药单查询
  303. break;
  304. case "repairList":
  305. coopBtns.repairList = true; //报修列表
  306. break;
  307. case "buildOrdersForOtherTasks":
  308. coopBtns.buildOrdersForOtherTasks = true; //其他任务建单
  309. break;
  310. }
  311. });
  312. this.coopBtns = coopBtns;
  313. console.log(this.coopBtns);
  314. }
  315. // 关闭客服弹框
  316. smartClose(e){
  317. this.smartShow = false;
  318. }
  319. // 打开客服弹框
  320. smartOpen(e?){
  321. this.smartShow = true;
  322. }
  323. // 预览图片
  324. imgs = [];
  325. isPreview = false;
  326. initialViewIndex:number = 0;
  327. previewImageHandler(data = [], index = 0) {
  328. this.initialViewIndex = index;
  329. console.log(index)
  330. this.isPreview = false;
  331. data = data || [];
  332. this.imgs = data.map((v) => location.origin + '/file' + v.relativeFilePath);
  333. setTimeout(() => {
  334. this.isPreview = true;
  335. }, 0)
  336. }
  337. // 图片相关
  338. showUploadList = {
  339. showPreviewIcon: true,
  340. showRemoveIcon: true,
  341. hidePreviewIconInNonImage: true
  342. };
  343. fileList = [
  344. // {
  345. // uid: -1,
  346. // name: 'xxx.png',
  347. // status: '1',
  348. // url: 'https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png'
  349. // }
  350. ];
  351. previewImage: string | undefined = '';
  352. previewVisible = false;
  353. repairImgs:any[] = [];//报修图片
  354. handlePreview = (file: UploadFile) => {
  355. console.log('file1:', file)
  356. this.previewImage = file.url || file.thumbUrl;
  357. this.previewVisible = true;
  358. };
  359. beforeUpload = (file: UploadFile): boolean => {
  360. console.log('file2:', file)
  361. this.fileList = [...this.fileList, file];
  362. setTimeout(async () => {
  363. file.url = await this.getBase64(file);
  364. }, 0);
  365. console.log('this.fileList:', this.fileList)
  366. return true;
  367. };
  368. getBase64(file: any): Promise<any> {
  369. return new Promise((resolve, reject) => {
  370. const reader = new FileReader();
  371. reader.readAsDataURL(file);
  372. reader.onload = () => resolve(reader.result);
  373. reader.onerror = error => reject(error);
  374. });
  375. }
  376. // 临时上传图片
  377. temporarilyUrl = this.mainService.returnUploadUrl('wechatRequesterIncident', 0);
  378. // 图片上传
  379. uploadImages(file, id){
  380. const formData = new FormData();
  381. formData.append('file', file);
  382. formData.append('fileName', file.name);
  383. const req = new HttpRequest('Post', this.mainService.returnUploadUrl('wechatRequesterIncident', id), formData, {
  384. reportProgress: true
  385. });
  386. return this.http.request(req).pipe(filter(e => e instanceof HttpResponse)).toPromise();
  387. }
  388. // 获取任务类型(病理标本)
  389. taskTypeData:any;
  390. getTaskTypesId() {
  391. this.mainService.getDictionary("list", "ordinary_field").subscribe((data) => {
  392. this.taskTypeData = data.find(i=>i.value=='pathology')
  393. this.getPathologySys();
  394. });
  395. }
  396. // 获取标本配置
  397. autoCreate:any;
  398. pathologyFrozenSpecime:any;
  399. getPathologySys(){
  400. let postData = {
  401. idx: 0,
  402. sum: 10,
  403. taskTypeConfig: {
  404. hosId:this.currentHospital.id,
  405. taskType:this.taskTypeData.id
  406. }
  407. }
  408. this.mainService
  409. .getFetchDataList("simple/data", "taskTypeConfig", postData)
  410. .subscribe((result) => {
  411. if (result.status == 200) {
  412. if(Array.isArray(result.list) && result.list[0]){
  413. this.autoCreate = result.list[0].autoCreate;
  414. this.pathologyFrozenSpecime = result.list[0].pathologyFrozenSpecimenNum;
  415. }
  416. }
  417. });
  418. }
  419. // 新增申请单自选类型
  420. applicationType:any;
  421. isPathologyVisible:any = false;
  422. addPathologyType(type){
  423. this.applicationType = type
  424. if(type ==1 && this.pathologyFrozenSpecime == 1){
  425. this.submitPathlogyForm()
  426. }else{
  427. if(this.viewData.length>0){
  428. this.isPathologyVisible = true
  429. }else{
  430. this.submitPathlogyForm()
  431. }
  432. }
  433. }
  434. // 取消新增申请单自选类型
  435. handlePathologyCancel(){
  436. this.applicationType = null
  437. this.isPathologyVisible = false
  438. }
  439. // 确定新增申请单自选类型
  440. handlePathologyOk(){
  441. this.submitPathlogyForm()
  442. }
  443. // 新增申请单自选类型
  444. submitPathlogyForm(){
  445. if(this.openType=='btn'){
  446. this.surgeryDataId = this.surgeryWKOMsg.id
  447. this.patientDataId = this.surgeryWKOMsg.patientDTO.id
  448. }else{
  449. this.surgeryDataId = this.scheduleItem.id
  450. this.patientDataId = this.scheduleItem.patientDTO.id
  451. }
  452. let data = {
  453. idx: 0,
  454. sum: 9999,
  455. surgeryId: this.surgeryDataId || "",
  456. patientId: this.patientDataId || "",
  457. hosId: this.currentHospital.id || "" ,
  458. operationType: 'pathologyForm',
  459. pathologyFormType: this.applicationType
  460. };
  461. this.mainService
  462. .simplePost("addData", "pathologyForm", data)
  463. .subscribe((data) => {
  464. this.detailId = data.data.id
  465. this.isPathologyVisible = false
  466. this.multiDialog = false
  467. this.pathologyModal = true
  468. });
  469. }
  470. // 手术排程-病理申请单
  471. openType:any;
  472. scheduleItem:any;
  473. pathologyAddItem(e,item){
  474. this.openType = 'schedule'
  475. this.scheduleItem = item
  476. // this.surgeryDataId = item.id
  477. // this.patientDataId = item.patientDTO.id
  478. let data = {
  479. idx: 0,
  480. sum: 9999,
  481. pathologyForm: {
  482. surgeryId: item.id || "",
  483. patientId: item.patientDTO.id || "",
  484. surgeryDeptId:this.loginUser.dept.id,
  485. // hosId: this.currentHospital.id || "" ,
  486. operationType: 'pathologyForm',
  487. order:'createTime desc',
  488. },
  489. };
  490. this.isSpinning = true
  491. this.mainService
  492. .getFetchDataList("data", "pathologyForm", data)
  493. .subscribe((data) => {
  494. this.isSpinning = false
  495. this.viewData = data.list
  496. for(let i of this.viewData){
  497. if(i.pathologyInspectDTOS){
  498. i.arr = []
  499. for(let x of i.pathologyInspectDTOS){
  500. i.arr.push(x.inspectProject.name)
  501. }
  502. }
  503. }
  504. this.multiDialog = true
  505. });
  506. }
  507. // 病理申请单
  508. multiDialog:any = false;
  509. isSpinning:any = false;
  510. viewData:any = [];
  511. pathologyAdd(e){
  512. this.openType = 'btn'
  513. this.surgeryDataId = this.surgeryWKOMsg.id
  514. this.patientDataId = this.surgeryWKOMsg.patientDTO.id
  515. let data = {
  516. idx: 0,
  517. sum: 9999,
  518. pathologyForm: {
  519. surgeryId: this.surgeryWKOMsg.id || "",
  520. patientId: this.surgeryWKOMsg.patientDTO.id || "",
  521. surgeryDeptId:this.loginUser.dept.id,
  522. // hosId: this.currentHospital.id || "" ,
  523. operationType: 'pathologyForm',
  524. order:'createTime desc'
  525. },
  526. };
  527. this.isSpinning = true
  528. this.mainService
  529. .getFetchDataList("data", "pathologyForm", data)
  530. .subscribe((data) => {
  531. this.isSpinning = false
  532. this.viewData = data.list
  533. for(let i of this.viewData){
  534. if(i.pathologyInspectDTOS){
  535. i.arr = []
  536. for(let x of i.pathologyInspectDTOS){
  537. i.arr.push(x.inspectProject.name)
  538. }
  539. }
  540. }
  541. this.multiDialog = true
  542. });
  543. }
  544. // 获取病理申请单最新数据
  545. getPathologyData(){
  546. if(this.openType=='btn'){
  547. this.surgeryDataId = this.surgeryWKOMsg.id
  548. this.patientDataId = this.surgeryWKOMsg.patientDTO.id
  549. }else{
  550. this.surgeryDataId = this.scheduleItem.id
  551. this.patientDataId = this.scheduleItem.patientDTO.id
  552. }
  553. let data = {
  554. idx: 0,
  555. sum: 9999,
  556. pathologyForm: {
  557. surgeryId: this.surgeryDataId || "",
  558. patientId: this.patientDataId || "",
  559. hosId: this.currentHospital.id || "" ,
  560. surgeryDeptId:this.loginUser.dept.id,
  561. operationType: 'pathologyForm',
  562. order:'createTime desc'
  563. },
  564. };
  565. this.isSpinning = true
  566. this.mainService
  567. .getFetchDataList("data", "pathologyForm", data)
  568. .subscribe((data) => {
  569. this.isSpinning = false
  570. this.viewData = data.list
  571. for(let i of this.viewData){
  572. if(i.pathologyInspectDTOS){
  573. i.arr = []
  574. for(let x of i.pathologyInspectDTOS){
  575. i.arr.push(x.inspectProject.name)
  576. }
  577. }
  578. }
  579. })
  580. }
  581. // 申请单号点击
  582. itemClick(item){
  583. this.detailId = item.id
  584. this.multiDialog = false
  585. setTimeout(_=>{
  586. if(!item.status){
  587. this.pathologyModal = true
  588. return
  589. }
  590. if(item.status && (item.status.value==1 || item.status.value==2 ||
  591. item.status.value==3 || item.status.value==4)){
  592. this.pathologyModal = true
  593. }else{
  594. this.pathologyDetailModal = true
  595. }
  596. },200)
  597. }
  598. // 申请单作废
  599. cancellationLoading:any = false;
  600. cancellationModal:any = false;
  601. cancellation(data){
  602. this.coopId = data.id
  603. this.cancellationModal = true
  604. }
  605. // 确定作废
  606. confirmCancellation(){
  607. this.cancellationLoading = true;
  608. this.mainService
  609. .coopTypeConfig('rmvData', 'pathologyForm', [this.coopId])
  610. .subscribe((data) => {
  611. this.cancellationLoading = false;
  612. this.cancelCancellation();
  613. if (data["status"] == 200) {
  614. this.showPromptModal("作废", true, "", "application");
  615. } else {
  616. this.showPromptModal("作废", false, data["msg"]);
  617. }
  618. });
  619. }
  620. // 取消作废
  621. cancelCancellation(){
  622. this.cancellationModal = false
  623. }
  624. hideModal(){
  625. this.multiDialog = false
  626. }
  627. pathologyDetailCancel(){
  628. this.pathologyDetailModal = false
  629. }
  630. pathologyCancel(){
  631. this.pathologyModal = false
  632. }
  633. // 切换综合日志和一键报修
  634. smallTabs = [];
  635. smallTabId = 2; //默认显示一键报修
  636. changeSmallTab(id) {
  637. this.smallTabId = id;
  638. if (id == 1) {
  639. this.listDeptOrderRecord();
  640. } else if (id == 2) {
  641. this.getQuickBxlb();
  642. }
  643. }
  644. // 获取当日建单总数
  645. todayNum = ""; //当日建单总数
  646. getTodayNum() {
  647. this.mainService
  648. .getFetchDataList("nurse", "workOrder", {
  649. idx: 0,
  650. sum: 1,
  651. workOrder: {
  652. createDept: this.loginUser.dept.id,
  653. startTime1: format(startOfDay(new Date()), "yyyy-MM-dd HH:mm:ss"),
  654. endTime1: format(endOfDay(new Date()), "yyyy-MM-dd HH:mm:ss"),
  655. },
  656. })
  657. .subscribe((data) => {
  658. if (data.status == 200) {
  659. this.todayNum = data.totalNum || 0;
  660. }
  661. });
  662. }
  663. // 获取报修区域(所属院区)
  664. // areas: any = []; //区域(所属院区)列表
  665. // getArea() {
  666. // this.areas = [];
  667. // this.mainService
  668. // .fetchListBx("area", { idx: 0, sum: 1000 })
  669. // .subscribe((result: any) => {
  670. // if (result.status == 200) {
  671. // this.areas = result.list;
  672. // if (this.areas.length) {
  673. // this.bxForm.controls.hospital.setValue(this.areas[0].id);
  674. // } else {
  675. // this.bxForm.controls.hospital.setValue(null);
  676. // }
  677. // }
  678. // });
  679. // }
  680. //根据区域(所属院区)获取地点(楼栋)
  681. places: any = []; //地点(楼栋)列表
  682. getPlace(buildingId) {
  683. this.places = [];
  684. this.mainService
  685. .fetchListBx("place", {
  686. idx: 0,
  687. sum: 1000,
  688. place: { area: { id: buildingId } },
  689. })
  690. .subscribe((result: any) => {
  691. if (result.status == 200) {
  692. this.places = result.list;
  693. if (this.places.length) {
  694. this.bxForm.controls.building.setValue(this.places[0].id);
  695. } else {
  696. this.bxForm.controls.building.setValue(null);
  697. }
  698. }
  699. });
  700. }
  701. btnLoading: boolean = false; //确认按钮loading状态
  702. workOrderRemark = ""; //备注
  703. workOrderRemark1 = ""; //备注
  704. workOrderRemark2 = ""; //备注
  705. workOrderRemarkTips = ""; //备注提示
  706. workOrderRemarkTips1 = ""; //备注提示
  707. workOrderRemarkTips2 = ""; //备注提示
  708. customRemarks = []; //备注快速输入
  709. customRemarks1 = []; //备注快速输入
  710. customRemarks2 = []; //备注快速输入
  711. // 添加备注
  712. addRemarks(item) {
  713. this.remarksEle.nativeElement.focus();
  714. this.workOrderRemark += item;
  715. }
  716. // 添加备注
  717. addRemarks1(item) {
  718. this.remarksEle1.nativeElement.focus();
  719. this.workOrderRemark1 += item;
  720. }
  721. // 添加备注
  722. addRemarks2(item) {
  723. this.remarksEle2.nativeElement.focus();
  724. this.workOrderRemark2 += item;
  725. }
  726. // 立即执行
  727. coopItem: any = {};
  728. execModal: boolean = false;
  729. // 打开立即执行模态框
  730. openExecModal(item) {
  731. this.coopItem = item;
  732. // 是否允许提前执行
  733. if(item.taskType.executeSwitch == 1){
  734. this.execModal = true;
  735. }else{
  736. this.showPromptModal("操作", false, "相关任务会到点执行,无需立即执行。有问题请联系相关科室!");
  737. }
  738. }
  739. // 确认立即执行
  740. confirmExec() {
  741. this.btnLoading = true;
  742. this.mainService.executeNow(this.coopItem.id).subscribe((result: any) => {
  743. this.closeExecModal();
  744. if (result.status == 200) {
  745. this.showPromptModal("立即执行", true, "");
  746. this.getOrderList();
  747. } else {
  748. this.showPromptModal("立即执行", false, result.msg);
  749. }
  750. });
  751. }
  752. // 关闭立即执行模态框
  753. closeExecModal() {
  754. this.execModal = false;
  755. }
  756. // 快捷配置背景色
  757. backColorComputed(icon){
  758. if(icon === 'transport-biaobenxinxi'){
  759. return 'specimen';
  760. }else if(icon === 'transport-shuyeguanli'){
  761. return 'blood';
  762. }else if(icon === 'transport-yaopinshuju'){
  763. return 'drugbag';
  764. }else if(icon === 'transport-baoxiu'){
  765. return 'incident';
  766. }else if(icon === 'transport-peihuguanli'){
  767. return 'inspect';
  768. }else if(icon === 'transport-dabao'){
  769. return 'specimenPackage';
  770. }else{
  771. return '';
  772. }
  773. }
  774. // 获取快捷配置列表
  775. pagePermissionConfigList: any[] = []; //表格数据
  776. getPagePermissionConfigList() {
  777. let data = {
  778. idx: 0,
  779. sum: 99999,
  780. pagePermissionConfig: {
  781. hosId: this.currentHospital.id,
  782. active: 1,
  783. taskTypeDeptId: this.loginUser.dept.id,
  784. },
  785. };
  786. this.mainService
  787. .getFetchDataList("simple/data", "pagePermissionConfig", data)
  788. .subscribe((data) => {
  789. let pagePermissionConfigList = data.list || [];
  790. pagePermissionConfigList.forEach(v => {
  791. if(v.urgentIds){
  792. let urgentIds = v.urgentIds.split(',');
  793. v.urgentFlag = urgentIds.some(v => v == 1);
  794. v.ordinaryFlag = urgentIds.some(v => v == 2);
  795. }
  796. })
  797. this.pagePermissionConfigList = pagePermissionConfigList;
  798. });
  799. }
  800. // 获取系统配置
  801. isShowBx = false;// 护士端是否显示报修
  802. isAssign = false;// 是否护士指定人员
  803. getItsmIncident() {
  804. let postData = { idx: 0, sum: 100, hospitalConfig: { hosId: this.currentHospital.id } };
  805. this.mainService.getFetchDataList("simple/data", "hospitalConfig", postData).subscribe((result) => {
  806. if (result.status == 200) {
  807. this.isShowBx = result.list.find(v => v.key == 'hos_itsmIncident').value == 1;
  808. this.isAssign = result.list.find(v => v.key == 'nurseSendOrder').value == 1;
  809. if (this.isShowBx && this.coopBtns.repairList && !this.checkedTableType) {
  810. // 初始化默认显示第一个
  811. console.log(this.tabPermission)
  812. // if(this.tabPermission.length){
  813. // this.checkedTableType = (this.tabPermission[0] && this.tabPermission[0].system) ? 'other' : this.tabPermission[0].id;
  814. // }else if(this.coopBtns.suggestionBox){
  815. // this.checkedTableType = 'advice';
  816. // this.checkTable(this.checkedTableType);
  817. // }else if(this.coopBtns.surgery){
  818. // this.checkedTableType = 'surgery';
  819. // this.checkTable(this.checkedTableType);
  820. // }else if(this.coopBtns.outpatientHelpAppointment){
  821. // this.checkedTableType = 'outpatientHelpAppointment';
  822. // this.checkTable(this.checkedTableType);
  823. // }else if(this.coopBtns.inquiryOfHistoricalSpecimens){
  824. // this.checkedTableType = 'historySpecimen';
  825. // this.checkTable(this.checkedTableType);
  826. // }else if(this.coopBtns.historicalMedicineListInquiry){
  827. // this.checkedTableType = 'historyDrugsbag';
  828. // this.checkTable(this.checkedTableType);
  829. // }else if(this.coopBtns.repairList && this.isShowBx){
  830. // this.checkedTableType = 'bxlb';
  831. // this.checkTable(this.checkedTableType);
  832. // }
  833. this.smallTabs = [
  834. { id: 1, name: "综合日志" },
  835. { id: 2, name: "一键报修" },
  836. ];
  837. this.smallTabId = 2;
  838. this.getQuickBxlb();
  839. this.getBxlb(this.bxlbPageIndex, true);
  840. } else {
  841. this.smallTabs = [{ id: 1, name: "综合日志" }];
  842. this.smallTabId = 1;
  843. this.listDeptOrderRecord();
  844. }
  845. }
  846. });
  847. }
  848. // 派单,flag 0是待抢单指派,1是待到达指派
  849. allotWorker(id, stateId, flag?) {
  850. if (flag == 1) {
  851. this.router.navigateByUrl("nurse/allotWorker/" + id + "/" + stateId + "/1/" + this.currentHospital.id);
  852. } else {
  853. this.router.navigateByUrl("nurse/allotWorker/" + id + "/" + stateId + "/0/" + this.currentHospital.id);
  854. }
  855. }
  856. //获取检查页面任务类型
  857. getInspectAndPatientTransportConfigTasktype() {
  858. let postData = {
  859. idx: 0,
  860. sum: 10,
  861. taskType: {
  862. simpleQuery: true,
  863. hosId: {
  864. id: this.currentHospital.id
  865. },
  866. associationType: {
  867. key:"association_types",
  868. value: 'inspect'
  869. }
  870. }
  871. };
  872. this.mainService
  873. .getFetchDataList("simple/data", "taskType", postData)
  874. .subscribe((result) => {
  875. if (result.status == 200) {
  876. let tasktype:any = result.list[0] || {};
  877. this.getInspectAndPatientTransportConfig(tasktype);
  878. }
  879. });
  880. }
  881. // 获取检查页面信息配置
  882. getInspectAndPatientTransportConfig(tasktype) {
  883. let postData = {
  884. idx: 0,
  885. sum: 10,
  886. taskTypeConfig: {
  887. taskTypeDTO: {
  888. hosId: {
  889. id: this.currentHospital.id
  890. },
  891. associationType: tasktype.associationType
  892. }
  893. }
  894. };
  895. this.mainService
  896. .getFetchDataList("simple/data", "taskTypeConfig", postData)
  897. .subscribe((result) => {
  898. if (result.status == 200) {
  899. let inspectAndPatientTransportConfig = result.list[0] || {};
  900. this.inspectAndPatientTransportConfig = {...this.inspectAndPatientTransportConfig, ...inspectAndPatientTransportConfig};
  901. // 是否显示排队信息
  902. if(this.inspectAndPatientTransportConfig.queuingInformation == 1){
  903. this.getQueuingInformation();
  904. }
  905. this.initForm();
  906. }
  907. });
  908. }
  909. // 获取排队信息
  910. queuingInformationList:any[] = [];
  911. getQueuingInformation() {
  912. this.mainService
  913. .coopWorkerOrder("queuingInformation", {})
  914. .subscribe((result) => {
  915. if(result.status == 200){
  916. this.queuingInformationList = result.datalist || [];
  917. }
  918. });
  919. }
  920. // 获取护士端更新提示
  921. updateTipsForNurses = "";
  922. getUpdateTipsForNurses() {
  923. let postData = {
  924. idx: 0,
  925. sum: 1,
  926. systemConfiguration: { keyconfig: "updateTipsForNurses" },
  927. };
  928. this.mainService
  929. .getFetchDataList("simple/data", "systemConfiguration", postData)
  930. .subscribe((result) => {
  931. if (result.status == 200) {
  932. this.updateTipsForNurses = result.list[0].valueconfig;
  933. }
  934. });
  935. }
  936. // 获取护士工单列表刷新速度
  937. getRefreshNurseWorkOrderTime() {
  938. let postData = {
  939. idx: 0,
  940. sum: 1,
  941. systemConfiguration: { keyconfig: "refreshNurseWorkOrderTime" },
  942. };
  943. this.mainService
  944. .getFetchDataList("simple/data", "systemConfiguration", postData)
  945. .subscribe((result) => {
  946. if (result.status == 200) {
  947. this.orderListTimeConst = result.list[0].valueconfig;
  948. // 工单列表倒计时 start
  949. this.orderListTime = this.orderListTimeConst;
  950. clearInterval(this.orderListTimer);
  951. this.orderListTimer = setInterval(() => {
  952. this.orderListTime--;
  953. if (this.orderListTime === 0) {
  954. this.orderListTime = this.orderListTimeConst;
  955. this.getOrderList();
  956. }
  957. }, 1000);
  958. // 工单列表倒计时 end
  959. }
  960. });
  961. }
  962. // 获取标本按钮
  963. specimenButton = "";
  964. getSpecimenButton() {
  965. if(this.currentDept.typeValue == 'surgery' && !this.tabSearchCont){
  966. return;
  967. }
  968. let postData = {
  969. idx: 0,
  970. sum: 1,
  971. systemConfiguration: { keyconfig: "specimenButton" },
  972. };
  973. this.mainService
  974. .getFetchDataList("simple/data", "systemConfiguration", postData)
  975. .subscribe((result) => {
  976. if (result.status == 200) {
  977. this.specimenButton = result.list[0].valueconfig;
  978. }
  979. });
  980. }
  981. // 获取护士端弹窗的配置
  982. // (1) 当用户设置为正数时,用户必须查看此窗体指定秒数。
  983. // (2) 当用户设置为负数时,用户可点击知道了也可倒计时自动关闭。
  984. // (3) 如果用户填写0则为无自动关闭和强制查看时间。
  985. getCloseTimeFlag() {
  986. let postData = {
  987. idx: 0,
  988. sum: 1,
  989. systemConfiguration: { keyconfig: "nurseDeptSwitchTip" },
  990. };
  991. this.mainService
  992. .getFetchDataList("simple/data", "systemConfiguration", postData)
  993. .subscribe((result) => {
  994. if (result.status == 200) {
  995. this.closeTimeFlag = result.list[0].valueconfig - 0;
  996. this.changeKs();
  997. }
  998. });
  999. }
  1000. // 获取资产报修是否开启
  1001. cmdbRepair:Boolean = false;
  1002. getCmdbRepairFlag() {
  1003. let postData = {
  1004. idx: 0,
  1005. sum: 1,
  1006. systemConfiguration: { keyconfig: "cmdbRepair" },
  1007. };
  1008. this.mainService
  1009. .getFetchDataList("simple/data", "systemConfiguration", postData)
  1010. .subscribe((result) => {
  1011. if (result.status == 200) {
  1012. if(result.list[0].valueconfig==1){
  1013. this.cmdbRepair = true
  1014. this.getAssetData();
  1015. }else{
  1016. this.cmdbRepair = false
  1017. }
  1018. }
  1019. });
  1020. }
  1021. changeCommonInp(e) {
  1022. return
  1023. this.changeCommonInpSubject.next(e);
  1024. }
  1025. changeApplyCategory(e){
  1026. console.log(111, e)
  1027. if(e){
  1028. // 根据故障现象带出故障描述
  1029. if(this.validateBxForm.value.description){
  1030. this.validateBxForm.controls.description.setValue(this.validateBxForm.value.description +';'+this.applicationCategoryList.find(v => v.id == e).mutiCategory)
  1031. }else{
  1032. this.validateBxForm.controls.description.setValue(this.applicationCategoryList.find(v => v.id == e).mutiCategory)
  1033. }
  1034. }
  1035. }
  1036. // 故障现象列表
  1037. applicationCategoryList:any[] = [];
  1038. searchApplicationCategory(keyWord?) {
  1039. let item = this.assetData.find(i=> i.id == this.validateBxForm.value.assetId)
  1040. if(!item.assetProductDTO.incidentCategoryIds){
  1041. return
  1042. }
  1043. let postData = {
  1044. incidentCategoryIds: item.assetProductDTO.incidentCategoryIds,
  1045. // category: {
  1046. // category: keyWord,
  1047. // selectType: 'mutlQuery',
  1048. // hierarchy: 3,//只差有三级的故障现象列表
  1049. // },
  1050. };
  1051. console.log(postData);
  1052. this.isLoading = true;
  1053. this.mainService
  1054. .incidentPost("listIncidentCategory", postData)
  1055. .subscribe((data) => {
  1056. this.isLoading = false;
  1057. if (data.status == 200) {
  1058. this.applicationCategoryList = data.data;
  1059. }
  1060. });
  1061. }
  1062. changeAsset(e){
  1063. this.changeAssetInpSubject.next(e);
  1064. }
  1065. // 选择资产
  1066. changeAssetData(e){
  1067. this.validateBxForm.controls.category.setValue(null)
  1068. this.searchApplicationCategory();
  1069. }
  1070. // 获取资产列表
  1071. assetData:any = [];
  1072. getAssetData(name?){
  1073. let data = {
  1074. idx: 0,
  1075. sum: 20,
  1076. asset: {
  1077. downHosId: this.currentHospital.id,
  1078. name: name
  1079. },
  1080. };
  1081. this.mainService
  1082. .getFetchDataList("simple/data", "asset", data)
  1083. .subscribe((data) => {
  1084. if (data.status == 200) {
  1085. this.assetData = data.list;
  1086. }
  1087. });
  1088. }
  1089. //获取综合日志
  1090. rLoading = false;
  1091. listDeptOrderRecords: any = [];
  1092. listDeptOrderRecord() {
  1093. this.rLoading = true;
  1094. this.mainService
  1095. .listMsgByMain("listDeptOrderRecord", { deptId: this.loginUserDeptId })
  1096. .subscribe((result) => {
  1097. this.rLoading = false;
  1098. if (result["status"] == 200) {
  1099. this.listDeptOrderRecords = result["data"].slice(0, 15);
  1100. }
  1101. });
  1102. }
  1103. // 查看标本历史记录
  1104. historyPromptModalShow = false; //标本历史记录弹窗开关
  1105. scode = ""; //查看历史记录携带
  1106. viewSpecimenHistory(data) {
  1107. this.scode = data.scode;
  1108. this.historyPromptModalShow = true;
  1109. }
  1110. // 关闭标本历史记录弹窗
  1111. closeModelHistory(e) {
  1112. this.historyPromptModalShow = JSON.parse(e).show;
  1113. }
  1114. // 查看药单历史记录
  1115. historyDPromptModalShow = false; //药单历史记录弹窗开关
  1116. drugsBagId = ""; //查看历史记录携带
  1117. viewDrugsbagHistory(data) {
  1118. this.drugsBagId = data.id;
  1119. this.historyDPromptModalShow = true;
  1120. }
  1121. // 关闭药单历史记录弹窗
  1122. closeModelHistoryDrugsbag(e) {
  1123. this.historyDPromptModalShow = JSON.parse(e).show;
  1124. }
  1125. // 查看报修信息
  1126. detailBx(data){
  1127. this.router.navigateByUrl("nurse/detailBx/" + data.id);
  1128. }
  1129. // 查看报修信息弹窗
  1130. bxPromptModalShow = false; //弹窗开关
  1131. bData = ""; //查看详情携带所有数据
  1132. viewBx(data) {
  1133. this.bData = data;
  1134. this.bxPromptModalShow = true;
  1135. }
  1136. // 关闭报修信息弹窗
  1137. closeModelBx(e) {
  1138. this.bxPromptModalShow = JSON.parse(e).show;
  1139. }
  1140. // 护士端患者信息列表,鼠标移入姓名展示最近一条检查信息
  1141. recentInfo = "";
  1142. recentInfoTimer = null;
  1143. recentInfoNum = 0;
  1144. isRemand = true; //自动送回
  1145. yyTime = null; //预约时间-患者列表
  1146. yyTimeZy = null; //预约时间-患者列表-患者其他服务
  1147. yyDate = null; //预约日期-陪检
  1148. yyDateZy = null; //预约日期-转运
  1149. getRecentInfo(patientCode) {
  1150. if(this.currentDept.typeValue == 'surgery' && !this.tabSearchCont){
  1151. return;
  1152. }
  1153. this.recentInfo = "";
  1154. clearTimeout(this.recentInfoTimer);
  1155. this.recentInfoTimer = setTimeout(() => {
  1156. this.recentInfoNum++;
  1157. this.mainService
  1158. .listMsgByMain("workOrder/findInspectRecently", { patientCode })
  1159. .subscribe((result) => {
  1160. this.recentInfoNum--;
  1161. if (result["status"] == 200 && this.recentInfoNum === 0) {
  1162. this.recentInfo = result["data"]["info"];
  1163. } else {
  1164. this.recentInfo = "";
  1165. }
  1166. });
  1167. }, 500);
  1168. }
  1169. // 获取患者陪检任务类型(只有一个)的信息
  1170. getTaskTypeByInspection() {
  1171. const list = {
  1172. idx: 0,
  1173. sum: 1,
  1174. taskType: {
  1175. patientInspectQuery: true,
  1176. hosIds: this.currentHospital.id + "",
  1177. associationType: {
  1178. id: 260,
  1179. },
  1180. },
  1181. };
  1182. return this.mainService.getFetchDataList("configuration", "taskType", list);
  1183. }
  1184. //修改预约建单时间的日期
  1185. yyDateChange(e) {
  1186. // 获取年月日
  1187. let yyDate = new Date(e);
  1188. let year = yyDate.getFullYear();
  1189. let month = yyDate.getMonth();
  1190. let date = yyDate.getDate();
  1191. // 获取当前时间的年月日
  1192. let now = new Date();
  1193. let nYear = now.getFullYear();
  1194. let nMonth = now.getMonth();
  1195. let nDate = now.getDate();
  1196. if (year != nYear || month != nMonth || date != nDate) {
  1197. this.disabledHours = () => [];
  1198. this.disabledMinutes = (hour) => [];
  1199. } else {
  1200. // 禁用小时
  1201. this.disabledHours = () => {
  1202. let now = new Date();
  1203. let nHour = now.getHours();
  1204. let nMinute = now.getMinutes();
  1205. if (nMinute > (60 - this.inspectAndPatientTransportConfig.timeMod)) {
  1206. return range(0, nHour + 1);
  1207. } else {
  1208. return range(0, nHour);
  1209. }
  1210. };
  1211. // 禁用分钟
  1212. this.disabledMinutes = (hour) => {
  1213. let now = new Date();
  1214. let nHour = now.getHours();
  1215. let nMinute = now.getMinutes();
  1216. if (hour === nHour || hour === undefined) {
  1217. return this.integralDivision(0, nMinute, this.inspectAndPatientTransportConfig.timeMod);
  1218. } else {
  1219. return [];
  1220. }
  1221. };
  1222. }
  1223. }
  1224. // 关闭其他建单保存结果
  1225. closeModel(e) {
  1226. console.log(e);
  1227. if (e === "other" || e === "ordinary") {
  1228. this.osComponentRef2.osInstance().scroll({ x: 0, y: this.positionY });
  1229. this.getOrderList();
  1230. } else if (e === "bb") {
  1231. this.getOrderList();
  1232. this.getSpecimenWorkOrderMsg();
  1233. } else if (e === "application"){
  1234. this.getPathologyData()
  1235. }
  1236. }
  1237. // 其他建单
  1238. selectOtherId; //选中的id
  1239. otherSearch = ""; //搜索的关键词
  1240. oLoading = false;
  1241. nLoading = false;
  1242. positionY = 0; //记录其他建单Y轴滚动距离
  1243. otherClick(item) {
  1244. this.osComponentRef2 && (this.positionY = this.osComponentRef2.osInstance().scroll().position.y); //内容滚动的距离
  1245. this.selectOtherId = item.id;
  1246. this.newShortcutOrder(item, "other");
  1247. this.account = null;
  1248. this.userAccount = null;
  1249. }
  1250. selectIncidentId; //选中的id
  1251. incidentClick(item) {
  1252. this.positionY = this.osComponentRef10.osInstance().scroll().position.y; //内容滚动的距离
  1253. this.selectIncidentId = item.id;
  1254. this.bxForm.controls.content.setValue(item.mutiCategory);
  1255. }
  1256. //搜索
  1257. otherNum = 0;
  1258. otherSearchChange() {
  1259. this.otherSearchChangeSubject.next(this.otherSearch);
  1260. }
  1261. // 切换科室
  1262. changeKs() {
  1263. this.hsPromptModalShow = true;
  1264. // (1) 当用户设置为正数时,用户必须查看此窗体指定秒数。
  1265. // (2) 当用户设置为负数时,用户可点击知道了也可倒计时自动关闭。
  1266. // (3) 如果用户填写0则为无自动关闭和强制查看时间。
  1267. if (this.closeTimeFlag === 0) {
  1268. return;
  1269. }
  1270. this.closeTime = Math.abs(this.closeTimeFlag);
  1271. clearInterval(this.timerCloseTime);
  1272. this.timerCloseTime = setInterval(() => {
  1273. this.closeTime = Math.max(--this.closeTime, 0);
  1274. if (this.closeTime === 0) {
  1275. if (this.closeTimeFlag <= 0) {
  1276. this.hsPromptModalShow = false;
  1277. }
  1278. clearInterval(this.timerCloseTime);
  1279. }
  1280. }, 1000);
  1281. }
  1282. // 判断登录是否已失效
  1283. initLogin() {
  1284. let that = this;
  1285. if (!localStorage.getItem("user")) {
  1286. that.message.error("您的登录已失效,请重新登录!", {
  1287. nzDuration: 3000,
  1288. });
  1289. setTimeout(() => {
  1290. that.router.navigateByUrl("login");
  1291. }, 2000);
  1292. return;
  1293. }
  1294. }
  1295. // 连接websocket
  1296. getWebsocket() {
  1297. let that = this;
  1298. this.webs
  1299. .connectWs(http.nurseWs, { userCount: that.loginUser.account })
  1300. .subscribe((data) => {
  1301. if (data && data.content) {
  1302. that.createBasicNotification(data);
  1303. }
  1304. });
  1305. }
  1306. // 每隔一分钟刷新标本信息
  1307. msgTimerId: any;
  1308. refreshSpecimenWorkOrderMsg() {
  1309. this.msgTimerId = setInterval(() => {
  1310. this.getSpecimenWorkOrderMsg();
  1311. this.getPatientInspectCountMsg();
  1312. this.getSpePackageCountMsg();
  1313. }, 60000);
  1314. }
  1315. // 工单列表筛选
  1316. getOrderSelectList() {
  1317. let that = this;
  1318. that.mainService
  1319. .getDictionary("list", "association_types")
  1320. .subscribe((data) => {
  1321. that.orderSelectList = data || [];
  1322. });
  1323. }
  1324. // 急标普标数量
  1325. getSpecimenWorkOrderMsg() {
  1326. if(this.currentDept.typeValue == 'surgery' && !this.tabSearchCont){
  1327. return;
  1328. }
  1329. let that = this;
  1330. that.mainService
  1331. .postCustom("nurse", "getSpecimenWorkOrderMsg", {
  1332. deptId: JSON.parse(localStorage.getItem("user")).user.dept.id,
  1333. })
  1334. .subscribe((data) => {
  1335. that.specimenWorkOrderMsg = data;
  1336. });
  1337. }
  1338. // 护士端-批量陪检图标下两个数字
  1339. patientInspectCountMsg: any = {};
  1340. getPatientInspectCountMsg() {
  1341. if(this.currentDept.typeValue == 'surgery' && !this.tabSearchCont){
  1342. return;
  1343. }
  1344. let that = this;
  1345. that.mainService
  1346. .getPatientInspectCount({
  1347. deptId: JSON.parse(localStorage.getItem("user")).user.dept.id,
  1348. })
  1349. .subscribe((data) => {
  1350. that.patientInspectCountMsg = data;
  1351. });
  1352. }
  1353. // 护士端-标本打包图标下两个数字
  1354. specimenPackageCountMsg: any = {};
  1355. getSpePackageCountMsg() {
  1356. if(this.currentDept.typeValue == 'surgery' && !this.tabSearchCont){
  1357. return;
  1358. }
  1359. let that = this;
  1360. that.mainService
  1361. .getSpePackageCount({
  1362. deptId: JSON.parse(localStorage.getItem("user")).user.dept.id,
  1363. })
  1364. .subscribe((data) => {
  1365. that.specimenPackageCountMsg = data;
  1366. });
  1367. }
  1368. // 手术提示信息
  1369. surgeryLoading = false;
  1370. now:any = new Date();
  1371. getSurgeryWKOMsg() {
  1372. if(this.currentDept.typeValue != 'surgery'){
  1373. return;
  1374. }
  1375. let postData = {
  1376. idx: 0,
  1377. sum: 1,
  1378. surgery: {
  1379. applyDateStart: format(subHours(new Date(),12), "yyyy-MM-dd HH:mm:ss"),
  1380. applyDateEnd: format(endOfDay(new Date()), "yyyy-MM-dd")+' '+'23:59:59',
  1381. // hosId: this.currentHospital.id,
  1382. surgeryDept: this.loginUserDeptId,
  1383. state: {
  1384. key: 'surgery_trans_state',
  1385. value: 8
  1386. }
  1387. }
  1388. }
  1389. this.surgeryLoading = true;
  1390. this.mainService
  1391. .getFetchDataList("simple/data", "surgery", postData)
  1392. .subscribe((data) => {
  1393. data.list = Array.isArray(data.list) ? data.list : [];
  1394. this.surgeryLoading = false;
  1395. this.surgeryWKOMsg = data.list[0] || {};
  1396. });
  1397. }
  1398. // 获取手术配置信息
  1399. surgeryField = null; //手术关联业务
  1400. surgeryConfigs:any = {};
  1401. // 送回苏醒室的运输过程终点科室信息
  1402. surgeryCarryingCourse:any = null;
  1403. surgeryCarryingCourseDepts: any[] = [];
  1404. getSurgeryConfig() {
  1405. this.mainService
  1406. .getDictionary("list", "ordinary_field")
  1407. .subscribe((data) => {
  1408. this.surgeryField = data.find(v => v.value == 'surgery');
  1409. if(this.surgeryField){
  1410. let postData = {
  1411. idx: 0,
  1412. sum: 10,
  1413. taskTypeConfig: {
  1414. hosId: this.currentHospital.id,
  1415. ordinaryField: this.surgeryField
  1416. }
  1417. };
  1418. this.mainService
  1419. .getFetchDataList("simple/data", "taskTypeConfig", postData)
  1420. .subscribe((result) => {
  1421. if (result.status == 200) {
  1422. this.surgeryConfigs = result.list[0] || {};
  1423. // 送回苏醒室开关开启 并且 有对应的任务类型
  1424. if(this.surgeryConfigs.remandRecovery == 1 && this.surgeryConfigs.recoveryType){
  1425. this.surgeryCarryingCourse = this.surgeryConfigs.recoveryType.carryingCourses ? this.surgeryConfigs.recoveryType.carryingCourses.find(v => v.nodeId ? v.nodeId.value == 'finish' : false) : null;
  1426. // 运输过程终点科室配置是固定科室或者固定科室范围-苏醒室
  1427. if(this.surgeryCarryingCourse && (this.surgeryCarryingCourse.departmentStrategy.value == 2 || this.surgeryCarryingCourse.departmentStrategy.value == 3)){
  1428. this.surgeryCarryingCourseDepts = this.surgeryCarryingCourse.departmentDTOS || [];
  1429. }
  1430. }
  1431. }
  1432. });
  1433. }
  1434. });
  1435. }
  1436. // 药品静配提示信息
  1437. drugJpLoading = false;
  1438. getJpDrugsWKOMsg() {
  1439. if(this.currentDept.typeValue == 'surgery' && !this.tabSearchCont){
  1440. return;
  1441. }
  1442. let that = this;
  1443. this.drugJpLoading = true;
  1444. that.mainService
  1445. .postCustom("nurse", "getJpDrugsWKOMsg", {})
  1446. .subscribe((data) => {
  1447. this.drugJpLoading = false;
  1448. that.jpDrugsWKOMsg = data.data ? data.data : {};
  1449. console.log(that.jpDrugsWKOMsg);
  1450. if (
  1451. that.jpDrugsWKOMsg.drugsInfoList &&
  1452. that.jpDrugsWKOMsg.drugsInfoList.length
  1453. ) {
  1454. that.startSwiper(that.jpDrugsWKOMsg.drugsInfoList.length);
  1455. }
  1456. if (
  1457. that.jpDrugsWKOMsg.jpInfoList &&
  1458. that.jpDrugsWKOMsg.jpInfoList.length
  1459. ) {
  1460. that.startSwiper1(that.jpDrugsWKOMsg.jpInfoList.length);
  1461. }
  1462. });
  1463. }
  1464. // swiper 轮播图
  1465. swiperTop: number = 0;
  1466. moveId: any;
  1467. index: number = 0;
  1468. startSwiper(length) {
  1469. let that = this;
  1470. clearInterval(that.moveId);
  1471. setInterval(() => {
  1472. that.index++;
  1473. clearInterval(that.moveId);
  1474. that.moveId = setInterval(() => {
  1475. if (that.swiperTop > -44 * that.index) {
  1476. that.swiperTop--;
  1477. }
  1478. if (that.swiperTop <= length * -44) {
  1479. that.swiperTop = 0;
  1480. that.index = 0;
  1481. clearInterval(that.moveId);
  1482. }
  1483. }, 20);
  1484. }, 2000);
  1485. }
  1486. swiperTop1: number = 0;
  1487. moveId1: any;
  1488. index1: number = 0;
  1489. startSwiper1(length) {
  1490. let that = this;
  1491. clearInterval(that.moveId1);
  1492. setInterval(() => {
  1493. that.index1++;
  1494. clearInterval(that.moveId1);
  1495. that.moveId1 = setInterval(() => {
  1496. if (that.swiperTop1 > -44 * that.index1) {
  1497. that.swiperTop1--;
  1498. }
  1499. if (that.swiperTop1 <= length * -44) {
  1500. that.swiperTop1 = 0;
  1501. that.index1 = 0;
  1502. clearInterval(that.moveId1);
  1503. }
  1504. }, 20);
  1505. }, 2000);
  1506. }
  1507. // 关注患者
  1508. follow(data) {
  1509. this.showCommonModal(
  1510. data,
  1511. data.focusPatient === 0
  1512. ? "您将设置患者【" +
  1513. data.patientName +
  1514. "】为重点关注,后期此患者的相关检查将会自动建单通知支助中心"
  1515. : "您将取消设置患者【" +
  1516. data.patientName +
  1517. "】为重点关注,后期此患者的相关检查将不会自动建单通知支助中心"
  1518. );
  1519. }
  1520. // 通用提示模态框
  1521. commonModal: boolean = false; //模态框
  1522. loading4 = false;
  1523. tipsMsg1: string; //提示框信息
  1524. coop: any; //当前操作列
  1525. showCommonModal(data: any, tipsMsg1: string) {
  1526. this.commonModal = true;
  1527. this.coop = data;
  1528. this.tipsMsg1 = tipsMsg1;
  1529. }
  1530. // 隐藏模态框
  1531. hideCommonModal() {
  1532. this.commonModal = false;
  1533. }
  1534. // 确认
  1535. confirmCommon() {
  1536. this.commonModal = false;
  1537. let postData = {
  1538. patient: {
  1539. id: this.coop.id,
  1540. focusPatient: this.coop.focusPatient === 0 ? 1 : 0,
  1541. },
  1542. };
  1543. this.loading4 = true;
  1544. this.mainService.listMsgByMain("updData/patient", postData).subscribe(
  1545. (result) => {
  1546. this.loading4 = false;
  1547. if (result["status"] == 200) {
  1548. this.showPromptModal(
  1549. result["data"].focusPatient === 0 ? "取消关注" : "关注",
  1550. true,
  1551. ""
  1552. );
  1553. this.getPatient(this.tabSearchCont);
  1554. } else {
  1555. this.showPromptModal(
  1556. result["data"].focusPatient === 0 ? "取消关注" : "关注",
  1557. false,
  1558. ""
  1559. );
  1560. }
  1561. },
  1562. (err) => {
  1563. this.loading4 = false;
  1564. this.showPromptModal("操作", false, "");
  1565. }
  1566. );
  1567. }
  1568. // 初始化新增form表单
  1569. initBxForm(content) {
  1570. this.validateBxForm = this.fb.group({
  1571. description: [content || null, [Validators.required]],
  1572. building: [null, [Validators.required]],
  1573. floor: [null, [Validators.required]],
  1574. officeAddress: [null, [Validators.required]],
  1575. contacts: [this.loginUser.name, [Validators.required]],
  1576. contactsInformation: [this.loginUser.phone, [Validators.required]],
  1577. assetId: [null, []],
  1578. // category: [null, []],
  1579. });
  1580. if(this.cmdbRepair){
  1581. this.validateBxForm.addControl(
  1582. 'assetId',
  1583. new FormControl(null, [])
  1584. );
  1585. // this.validateBxForm.addControl(
  1586. // 'category',
  1587. // new FormControl(null, [])
  1588. // );
  1589. }else{
  1590. this.validateBxForm.removeControl('assetId');
  1591. // this.validateBxForm.removeControl('category');
  1592. }
  1593. this.getDeptById(this.currentDept.id);
  1594. }
  1595. // 根据科室ID获取详情
  1596. deptDto:any = {};
  1597. getDeptById(id){
  1598. this.mainService
  1599. .getFetchDataList("simple/data", "department", {
  1600. idx: 0,
  1601. sum: 1,
  1602. department: {
  1603. id,
  1604. }
  1605. })
  1606. .subscribe((data:any) => {
  1607. let list = data.list || [];
  1608. this.deptDto = list.length > 0 ? list[0] : {};
  1609. console.log(this.deptDto);
  1610. this.changeHosp();
  1611. // 回显楼栋
  1612. if(this.deptDto.building){
  1613. this.validateBxForm.controls.building.setValue(this.deptDto.building.id);
  1614. }
  1615. // 回显楼层
  1616. if(this.deptDto.floor){
  1617. this.validateBxForm.controls.floor.setValue(this.deptDto.floor.id);
  1618. }
  1619. });
  1620. }
  1621. // 切换院区选项
  1622. buildings: any = []; //楼栋
  1623. changeHosp() {
  1624. this.validateBxForm.controls.building.setValue(null);
  1625. this.buildings = [];
  1626. let data = {
  1627. idx: 0,
  1628. sum: 9999,
  1629. building: {
  1630. hosId: this.deptDto.hospital.id,
  1631. }
  1632. };
  1633. this.mainService
  1634. .getFetchDataList("simple/data", "building", data)
  1635. .subscribe((data:any) => {
  1636. this.buildings = data.list || [];
  1637. this.floors = [];
  1638. this.message.remove(this.maskFlag);
  1639. this.maskFlag = false;
  1640. });
  1641. }
  1642. // 切换楼栋信息
  1643. floors: Array<any> = []; //楼层
  1644. floorLoading: boolean = false;
  1645. changeBuilding(buildingId) {
  1646. if(!buildingId){
  1647. return;
  1648. }
  1649. this.validateBxForm.controls.floor.setValue(null);
  1650. this.validateBxForm.controls.officeAddress.setValue(null);
  1651. this.floors = [];
  1652. let data = {
  1653. idx: 0,
  1654. sum: 9999,
  1655. floor: {
  1656. buildId: buildingId,
  1657. }
  1658. };
  1659. this.floorLoading = true;
  1660. this.mainService
  1661. .getFetchDataList("simple/data", "floor", data)
  1662. .subscribe((data:any) => {
  1663. this.floorLoading = false;
  1664. this.message.remove(this.maskFlag);
  1665. this.maskFlag = false;
  1666. this.floors = data.list || [];
  1667. });
  1668. }
  1669. // 是否确定报修模态框
  1670. bxModal: boolean = false; //模态框
  1671. loading6 = false;
  1672. coopBx: any; //当前操作列
  1673. validateBxForm: FormGroup; //新增/编辑表单
  1674. showBxModal(data?) {
  1675. this.maskFlag = this.message.loading("正在加载中..", {
  1676. nzDuration: 0,
  1677. }).messageId;
  1678. this.bxModal = true;
  1679. this.coopBx = data || {};
  1680. this.fileList = [];
  1681. this.initBxForm(this.coopBx.content);
  1682. }
  1683. // 隐藏模态框
  1684. hideBxModal() {
  1685. this.bxModal = false;
  1686. this.fileList = [];
  1687. }
  1688. // 确认
  1689. confirmBx() {
  1690. for (const i in this.validateBxForm.controls) {
  1691. this.validateBxForm.controls[i].markAsDirty();
  1692. this.validateBxForm.controls[i].updateValueAndValidity();
  1693. }
  1694. if (this.validateBxForm.invalid){
  1695. this.message.error('请填写必填字段!');
  1696. return;
  1697. };
  1698. if (!this.deptDto.id){
  1699. this.message.error('数据异常,无法建单!');
  1700. return;
  1701. };
  1702. this.showReqModal();
  1703. }
  1704. // 报修
  1705. // type, 1是,0否
  1706. async confirmBxNext(type){
  1707. this.maskFlag = this.message.loading("正在加载中..", {
  1708. nzDuration: 0,
  1709. }).messageId;
  1710. if(type == 1){
  1711. this.btnLoading = true;
  1712. let loginUser:any = cloneDeep(this.loginUser);
  1713. // loginUser.upType = "changeDept";
  1714. if(this.deptDto.hospital){
  1715. loginUser.hospital = { id: this.deptDto.hospital.id };
  1716. }
  1717. if(this.deptDto){
  1718. loginUser.dept = {id: this.deptDto.id};
  1719. }
  1720. if(this.validateBxForm.value.contacts){
  1721. loginUser.name = this.validateBxForm.value.contacts;
  1722. }
  1723. // if(this.validateBxForm.value.floor){
  1724. // loginUser.place = {id: this.validateBxForm.value.floor, area: { id: this.validateBxForm.value.building }};
  1725. // }
  1726. // if(this.validateBxForm.value.officeAddress){
  1727. // loginUser.houseNumber = this.validateBxForm.value.officeAddress;
  1728. // }
  1729. if(this.validateBxForm.value.contactsInformation){
  1730. loginUser.phone = this.validateBxForm.value.contactsInformation;
  1731. }
  1732. let result:any = await this.mainService.coopData("updData", "user", { user: loginUser }).toPromise();
  1733. console.log(result);
  1734. if(result.status != 200){
  1735. this.hideReqModal();
  1736. this.btnLoading = false;
  1737. this.message.remove(this.maskFlag);
  1738. this.maskFlag = false;
  1739. this.message.error(result.msg);
  1740. return;
  1741. }
  1742. }else{
  1743. this.cancenlLoading = true;
  1744. }
  1745. this.mainService.getDictionary("list", "incident_source").subscribe((source:any) => {
  1746. let incidentSourceList = source || [];
  1747. let pc = incidentSourceList.find(v => v.value === 'pc');
  1748. this.mainService.getDictionary("list", "repair_incident_type").subscribe((result) => {
  1749. let repairIncidentTypeList = result || [];
  1750. let repairIncidentType = repairIncidentTypeList.find(v => v.value === 'dept');
  1751. if (repairIncidentType) {
  1752. let postData: any = {
  1753. incident: {
  1754. repairIncidentType,
  1755. place: this.validateBxForm.value.floor ? { id: this.validateBxForm.value.floor } : undefined,
  1756. department: { id: this.deptDto.id},
  1757. description: this.validateBxForm.value.description,
  1758. houseNumber: this.validateBxForm.value.officeAddress,
  1759. contacts: this.validateBxForm.value.contacts,
  1760. contactsInformation: this.validateBxForm.value.contactsInformation,
  1761. hosId: this.deptDto.hospital.id,
  1762. source: pc,
  1763. fromWx: true,
  1764. requester: this.loginUser,
  1765. acceptUser: this.loginUser,
  1766. deleteFlag: 0,
  1767. assetId: this.validateBxForm.value.assetId || undefined,
  1768. // category: this.validateBxForm.value.category ? { id: this.validateBxForm.value.category } : undefined,
  1769. },
  1770. };
  1771. // if (this.coopBx.category) {
  1772. // postData.incident.category = this.coopBx.categoryDTO;
  1773. // }
  1774. this.mainService.flowPost("incident/task/request", postData).subscribe((res) => {
  1775. this.btnLoading = false;
  1776. this.cancenlLoading = false;
  1777. this.message.remove(this.maskFlag);
  1778. this.maskFlag = false;
  1779. this.bxModal = false;
  1780. this.hideReqModal();
  1781. if ((res as any).state == 200) {
  1782. // 图片上传
  1783. if(this.fileList.length){
  1784. console.log(this.fileList.map(v => v.originFileObj));
  1785. this.fileList.map(v => v.originFileObj).forEach(async file => {
  1786. await this.uploadImages(file, res.data.id);
  1787. })
  1788. }
  1789. this.showPromptModal("提交", true, "");
  1790. this.checkTable("bxlb");
  1791. } else {
  1792. this.showPromptModal("提交", false, (res as any).msg);
  1793. }
  1794. });
  1795. } else {
  1796. this.btnLoading = false;
  1797. this.showPromptModal("提交", false, "缺少【科室内报修】数据字典");
  1798. }
  1799. });
  1800. })
  1801. }
  1802. // 获取星级
  1803. degrees = [];
  1804. getDegrees() {
  1805. this.iLoading = true;
  1806. this.mainService.getDictionary("list", "incident_degree").subscribe((data: any) => {
  1807. this.iLoading = false;
  1808. this.degrees = data || [];
  1809. });
  1810. }
  1811. iLoading = false;
  1812. // 获取当前登录人科室任务类型信息
  1813. othersList: any = []; // 其他一键建单列表
  1814. bbMsg: any = {}; //标本一键建单
  1815. patientMsgList: any = []; // 患者转运,患者陪检一键建单
  1816. tabFlag = true; //页面初始化获取一次患者陪检的任务类型信息
  1817. allowUrgentFlag = false; //检查列表的患者陪检类型是否允许加急
  1818. tabPermission:any = []; //tab自定义
  1819. tabPermissionTpl:any = []; //tab自定义模板
  1820. getDeptTaskType(search?, clear?) {
  1821. let that = this;
  1822. this.otherNum++;
  1823. this.oLoading = true;
  1824. let postData = {
  1825. deptId: that.loginUserDeptId,
  1826. };
  1827. if (search !== undefined) {
  1828. postData["taskName"] = search;
  1829. postData["tabId"] = this.checkedTableType == 'other' ? undefined : this.checkedTableType;
  1830. }
  1831. that.mainService
  1832. .postCustom("nurse", "getDeptTaskType", postData)
  1833. .subscribe((data) => {
  1834. this.otherNum--;
  1835. if (this.otherNum === 0) {
  1836. this.oLoading = false;
  1837. }
  1838. if (search === undefined) {
  1839. that.deptTaskTypeRules = data.data;
  1840. that.getOrderList();
  1841. if(that.deptTaskTypeRules.openPatientTransport){
  1842. // 手术权限
  1843. that.getSurgeryWKOMsg();
  1844. }
  1845. if (
  1846. that.deptTaskTypeRules.openInspection ||
  1847. that.deptTaskTypeRules.openPatientTransport
  1848. ) {
  1849. this.getPatientInspectCountMsg();
  1850. // 陪检权限或转科权限
  1851. if (this.tabFlag) {
  1852. this.tabFlag = false;
  1853. this.getTaskTypeByInspection().subscribe((result) => {
  1854. console.log(result);
  1855. if (result.list && result.list.length > 0) {
  1856. this.appointmentBuildFlag =
  1857. result.list[0].appointmentSwitch + ""; //是否开启护士端预约建单
  1858. // this.leadTime = result.list[0].appointmentTime; //生效时长
  1859. this.leadTime = 0; //生效时长
  1860. this.followFlag = result.list[0].focusSwitch + ""; //是否开启护士端重点关注
  1861. this.allowUrgentFlag =
  1862. result.list[0].allowUrgent == 1 ? true : false; //是否允许加急(检查列表)
  1863. } else {
  1864. this.appointmentBuildFlag = "0"; //是否开启护士端预约建单
  1865. this.leadTime = 0; //生效时长
  1866. this.followFlag = "0"; //是否开启护士端重点关注
  1867. this.allowUrgentFlag = false; //是否允许加急(检查列表)
  1868. }
  1869. this.pLoading = true;
  1870. that.getPatient();
  1871. });
  1872. } else {
  1873. that.getPatient();
  1874. }
  1875. }
  1876. if (that.deptTaskTypeRules.openSpecimen) {
  1877. // 标本权限
  1878. that.getSpecimenWorkOrderMsg();
  1879. }
  1880. if (
  1881. that.deptTaskTypeRules.openStaticDistribution ||
  1882. that.deptTaskTypeRules.openDrugsBag
  1883. ) {
  1884. // 药品静配权限
  1885. that.getJpDrugsWKOMsg();
  1886. }
  1887. that.getSpePackageCountMsg();
  1888. }
  1889. if(data.data.tabPermission && Array.isArray(data.data.tabPermission.data)){
  1890. if (search !== undefined) {
  1891. let tabPermission = [];
  1892. tabPermission = this.tabPermissionTpl.map(v => {
  1893. let obj = data.data.tabPermission.data.find(vv => vv.id == v.id);
  1894. if(obj){
  1895. return obj;
  1896. }else{
  1897. return v;
  1898. }
  1899. })
  1900. this.tabPermission = tabPermission.sort((a,b) => a.orders - b.orders);
  1901. }else{
  1902. this.tabPermission = data.data.tabPermission.data.sort((a,b) => a.orders - b.orders);
  1903. this.tabPermissionTpl = data.data.tabPermission.data.sort((a,b) => a.orders - b.orders).map(v => ({...v, taskTypeList: []}));
  1904. }
  1905. }else{
  1906. this.tabPermission = this.tabPermissionTpl.length ? cloneDeep(this.tabPermissionTpl) : [];
  1907. }
  1908. if(!this.coopBtns.buildOrdersForOtherTasks){
  1909. this.tabPermission = this.tabPermission.filter(v => !v.system);
  1910. }
  1911. // 初始化默认显示第一个
  1912. if(search === undefined && !this.checkedTableType){
  1913. console.log(this.tabPermission)
  1914. if(this.tabPermission.length){
  1915. this.checkedTableType = (this.tabPermission[0] && this.tabPermission[0].system) ? 'other' : this.tabPermission[0].id;
  1916. }else if(this.coopBtns.suggestionBox){
  1917. this.checkedTableType = 'advice';
  1918. this.checkTable(this.checkedTableType);
  1919. }else if(this.coopBtns.surgery){
  1920. this.checkedTableType = 'surgery';
  1921. this.checkTable(this.checkedTableType);
  1922. }else if(this.coopBtns.outpatientHelpAppointment){
  1923. this.checkedTableType = 'outpatientHelpAppointment';
  1924. this.checkTable(this.checkedTableType);
  1925. }else if(this.coopBtns.inquiryOfHistoricalSpecimens){
  1926. this.checkedTableType = 'historySpecimen';
  1927. this.checkTable(this.checkedTableType);
  1928. }else if(this.coopBtns.historicalMedicineListInquiry){
  1929. this.checkedTableType = 'historyDrugsbag';
  1930. this.checkTable(this.checkedTableType);
  1931. }else if(this.coopBtns.repairList && this.isShowBx){
  1932. this.checkedTableType = 'bxlb';
  1933. this.checkTable(this.checkedTableType);
  1934. }
  1935. }else{
  1936. console.log('this.checkedTableType', this.checkedTableType);
  1937. this.checkTable(this.checkedTableType);
  1938. }
  1939. this.othersList = {};
  1940. this.tabPermission.forEach(v => {
  1941. if(v.system){
  1942. that.othersList['other'] = [];
  1943. }else{
  1944. that.othersList[v.id] = v.taskTypeList || [];
  1945. }
  1946. })
  1947. if (data.data.allTaskTypes) {
  1948. that.patientMsgList = [];
  1949. data.data.allTaskTypes.forEach((e) => {
  1950. if (e.associationType.value == "other") {
  1951. if(that.othersList['other']){
  1952. that.othersList['other'].push(e);
  1953. }else{
  1954. that.othersList['other'] = [e];
  1955. }
  1956. } else if (e.associationType.value == "specimen") {
  1957. that.bbMsg = e;
  1958. } else if (
  1959. e.associationType.value == "patientTransport" ||
  1960. e.associationType.value == "inspect"
  1961. ) {
  1962. that.patientMsgList.push(e);
  1963. }
  1964. });
  1965. // if (clear === "clear") {
  1966. // this.otherSearch = "";
  1967. // this.workOrderRemark = "";
  1968. // this.customRemarks = [];
  1969. // this.historyCustomRemarks = [];
  1970. // let obj = that.othersList.find(
  1971. // (item) => item.id == this.selectOtherId
  1972. // );
  1973. // obj && this.otherClick(obj);
  1974. // }
  1975. console.log(this.selectOtherId);
  1976. if (!this.selectOtherId) {
  1977. if (that.othersList[that.checkedTableType] && that.othersList[that.checkedTableType].length) {
  1978. this.selectOtherId = that.othersList[that.checkedTableType][0].id;
  1979. let obj = that.othersList[that.checkedTableType].find(
  1980. (item) => item.id == this.selectOtherId
  1981. );
  1982. obj && this.otherClick(obj);
  1983. } else {
  1984. this.selectOtherId = null;
  1985. }
  1986. }
  1987. }
  1988. });
  1989. }
  1990. // 工号输入搜索
  1991. searchAccount(e) {
  1992. this.searchAccountSubject.next(e);
  1993. }
  1994. // 根据工号获取用户
  1995. account = null;
  1996. accountList = [];
  1997. isLoading:boolean = false;
  1998. getAccountList(key = ''): void {
  1999. let postData = {
  2000. idx: 0,
  2001. sum: 10,
  2002. user: {
  2003. account: key,
  2004. hospital: {
  2005. id: this.currentHospital.id
  2006. }
  2007. }
  2008. };
  2009. this.isLoading = true;
  2010. this.mainService
  2011. .getFetchDataList("data", "user", postData)
  2012. .subscribe((data) => {
  2013. this.isLoading = false;
  2014. this.accountList = data.list || [];
  2015. });
  2016. }
  2017. // 目标科室输入搜索
  2018. searchDept(type, msg, e) {
  2019. this.getDeptList(type, msg, e)
  2020. }
  2021. // 获取科室
  2022. getDeptList(type, msg, key?): void {
  2023. // 返回值的status是201 则是默认发起科室
  2024. // 返回值的status是202 则是固定科室范围
  2025. // 返回值的status是203 则是固定科室
  2026. // 返回值的status是204 则是自主填写
  2027. // 返回值的status是205 则是固定科室类型
  2028. key = key.toUpperCase()
  2029. console.log('hahhah =======', key)
  2030. if (
  2031. (type == "start" && msg.start.start.departmentStrategy == 202) ||
  2032. (type == "target" && msg.end.end.departmentStrategy == 202)
  2033. ) {
  2034. let data = [];
  2035. let postData = null
  2036. if(this.patientModal){
  2037. postData = this.patientQuery
  2038. }else{
  2039. postData = {
  2040. taskTypeId: this.msgId
  2041. };
  2042. }
  2043. if(type == "start"){
  2044. this.mainService
  2045. .postCustom("nurse", "workOrder/buildTrip", postData)
  2046. .subscribe((result) => {
  2047. let arr = result.start.start.list;
  2048. arr.forEach(i=>{
  2049. if(i.inputcode){
  2050. i.inputcode = i.inputcode.toUpperCase()
  2051. if(this.deptDisplay == 2){
  2052. i.deptalias = i.deptalias + '('+i.inputcode+')'
  2053. }else{
  2054. i.dept = i.dept + '('+i.inputcode+')'
  2055. }
  2056. }
  2057. })
  2058. if(key!=''){
  2059. if(this.deptDisplay ==2){
  2060. data = arr.filter(i=>i.deptalias.indexOf(key) !=-1)
  2061. }else{
  2062. data = arr.filter(i=>i.dept.indexOf(key) !=-1)
  2063. }
  2064. msg.start.start.list = data
  2065. }else{
  2066. msg.start.start.list = arr
  2067. }
  2068. });
  2069. }else{
  2070. this.mainService
  2071. .postCustom("nurse", "workOrder/buildTrip", postData)
  2072. .subscribe((result) => {
  2073. let arr = result.end.end.list;
  2074. arr.forEach(i=>{
  2075. if(i.inputcode){
  2076. i.inputcode = i.inputcode.toUpperCase()
  2077. if(this.deptDisplay == 2){
  2078. i.deptalias = i.deptalias + '('+i.inputcode+')'
  2079. }else{
  2080. i.dept = i.dept + '('+i.inputcode+')'
  2081. }
  2082. }
  2083. })
  2084. if(key!=''){
  2085. if(this.deptDisplay ==2){
  2086. data = arr.filter(i=>i.deptalias.indexOf(key) !=-1)
  2087. }else{
  2088. data = arr.filter(i=>i.dept.indexOf(key) !=-1)
  2089. }
  2090. msg.end.end.list = data
  2091. }else{
  2092. msg.end.end.list = arr
  2093. }
  2094. });
  2095. }
  2096. return; //固定科室范围禁用搜索
  2097. }
  2098. let postData: any = {
  2099. idx: 0,
  2100. sum: 20,
  2101. department: {
  2102. searchType: 1,
  2103. cascadeHosId: this.currentHospital.id
  2104. },
  2105. };
  2106. if (key) {
  2107. postData.department["keyWord"] = key;
  2108. }
  2109. if (type == "start" && msg.start.start.departmentStrategy == 205) {
  2110. postData.department["type"] = { id: msg.start.start.startTypeId };
  2111. } else if (type == "target" && msg.end.end.departmentStrategy == 205) {
  2112. postData.department["type"] = { id: msg.end.end.endTypeId };
  2113. }
  2114. if (type == "start") {
  2115. postData.department["ids"] = msg.start.deptIds || "";
  2116. } else if (type == "target") {
  2117. postData.department["ids"] = msg.end.deptIds || "";
  2118. }
  2119. postData.department.nurseSign = 1;
  2120. this.mainService
  2121. .getFetchDataList("data", "department", postData)
  2122. .subscribe((data) => {
  2123. if (type == "target") {
  2124. data.list.forEach(i=>{
  2125. if(i.inputcode){
  2126. i.inputcode = i.inputcode.toUpperCase()
  2127. if(this.deptDisplay == 2){
  2128. i.deptalias = i.deptalias + '('+i.inputcode+')'
  2129. }else{
  2130. i.dept = i.dept + '('+i.inputcode+')'
  2131. }
  2132. }
  2133. })
  2134. msg.end.end.list = data.list;
  2135. } else if (type == "start") {
  2136. data.list.forEach(i=>{
  2137. if(i.inputcode){
  2138. i.inputcode = i.inputcode.toUpperCase()
  2139. if(this.deptDisplay == 2){
  2140. i.deptalias = i.deptalias + '('+i.inputcode+')'
  2141. }else{
  2142. i.dept = i.dept + '('+i.inputcode+')'
  2143. }
  2144. }
  2145. })
  2146. msg.start.start.list = data.list;
  2147. }
  2148. });
  2149. }
  2150. // 切换左侧tab
  2151. changeInfo() {
  2152. if (
  2153. !this.deptTaskTypeRules.openInspection &&
  2154. !this.deptTaskTypeRules.openPatientTransport
  2155. ) {
  2156. return;
  2157. }
  2158. this.infoPageIdx = 1;
  2159. this.getPatient();
  2160. }
  2161. // 获取患者信息
  2162. snum = 0;
  2163. getPatient(e?) {
  2164. if ((this.currentDept.typeValue == "outpatientDept" || this.currentDept.typeValue == "checkRoom" || this.currentDept.typeValue == "outpatientService") && !this.tabSearchCont) {
  2165. this.pLoading = false;
  2166. this.patientList = [];
  2167. this.infoLength = 0;
  2168. return; //护士端如果登录后如果科室类型为“门诊科室”、“检验科室”、“门诊服务点”,默认不显示患者信息
  2169. }
  2170. this.pLoading = true;
  2171. let postData = {
  2172. idx: this.infoPageIdx - 1,
  2173. sum: 10,
  2174. };
  2175. if(this.currentDept.typeValue == 'surgery' && !this.tabSearchCont){
  2176. // 手术安排信息-手术室类型
  2177. postData["surgery"] = {
  2178. searchKey: e ? e : this.tabSearchCont,
  2179. applyDateStart: format(startOfDay(new Date()), "yyyy-MM-dd HH:mm:ss"),
  2180. applyDateEnd: format(endOfDay(new Date()), "yyyy-MM-dd HH:mm:ss"),
  2181. hosId: this.currentHospital.id,
  2182. surgeryDept: this.loginUserDeptId,
  2183. state: {
  2184. key: 'surgery_trans_state',
  2185. value: 3
  2186. }
  2187. };
  2188. }else if(this.currentDept.typeValue == 'recovery'){
  2189. // 患者信息-复苏室类型
  2190. postData["patient"] = {
  2191. keyWord: e ? e : this.tabSearchCont,
  2192. };
  2193. // 查询父级科室患者
  2194. postData["patient"]["parentIdOnly"] = true;
  2195. postData["patient"]["recoveryDept"] = this.loginUserDeptId;
  2196. postData["patient"]["recoveryDeptDTO"] = {keyWord: '1'};
  2197. }else if(this.currentDept.typeValue == "checkRoom2"){
  2198. // 患者信息
  2199. postData["patient"] = {
  2200. keyWord: e ? e : this.tabSearchCont,
  2201. };
  2202. // 查询父级科室患者
  2203. postData["patient"]["parentIdOnly"] = true;
  2204. if (this.tabSearchCont) {
  2205. delete postData["patient"]["department"]; //搜索范围为全院在院患者
  2206. delete postData["patient"]["checkTempDept"];
  2207. } else {
  2208. postData["patient"]["checkTempDept"] = { id: this.loginUserDeptId };
  2209. }
  2210. }else{
  2211. // 患者信息
  2212. postData["patient"] = {
  2213. keyWord: e ? e : this.tabSearchCont,
  2214. };
  2215. // 查询父级科室患者
  2216. postData["patient"]["parentIdOnly"] = true;
  2217. if (
  2218. this.currentDept.typeValue == "checkRoom2" ||
  2219. this.currentDept.typeValue == "outpatientDept" ||
  2220. this.currentDept.typeValue == "checkRoom" ||
  2221. (this.currentDept.typeValue == 'surgery' && this.tabSearchCont)
  2222. ) {
  2223. delete postData["patient"]["department"]; //搜索范围为全院在院患者
  2224. } else {
  2225. postData["patient"]["department"] = { id: this.loginUserDeptId };
  2226. }
  2227. }
  2228. this.snum++;
  2229. this.mainService
  2230. .getFetchDataList((this.currentDept.typeValue == 'surgery' && !this.tabSearchCont) ? "simple/data" : 'nurse', (this.currentDept.typeValue == 'surgery' && !this.tabSearchCont) ? "surgery" : 'patient', postData)
  2231. .subscribe((data) => {
  2232. this.snum--;
  2233. if (data.list.length > 0) {
  2234. data.list.forEach((item) => {
  2235. if(this.currentDept.typeValue == 'surgery' && !this.tabSearchCont){
  2236. if (item.patientDTO && item.patientDTO.focusPatient === undefined) {
  2237. item.patientDTO.focusPatient = 0;
  2238. }
  2239. }else{
  2240. if (item.focusPatient === undefined) {
  2241. item.focusPatient = 0;
  2242. }
  2243. }
  2244. });
  2245. }
  2246. this.patientList = data.list || [];
  2247. if (this.snum === 0) {
  2248. this.pLoading = false;
  2249. }
  2250. this.infoLength = data.totalNum || 0;
  2251. });
  2252. }
  2253. // tab输入搜索节流阀
  2254. searchTabInp(e) {
  2255. if (
  2256. !this.deptTaskTypeRules.openInspection &&
  2257. !this.deptTaskTypeRules.openPatientTransport
  2258. ) {
  2259. return;
  2260. }
  2261. this.searchTabInpSubject.next(e);
  2262. }
  2263. // 下一日(陪检)
  2264. nextDay() {
  2265. this.yyDate = addDays(this.yyDate, 1);
  2266. this.yyDateChange(this.yyDate);
  2267. }
  2268. // 下一日(转运)
  2269. nextDayZy() {
  2270. this.yyDateZy = addDays(this.yyDateZy, 1);
  2271. this.yyDateChange(this.yyDateZy);
  2272. }
  2273. // 禁用日期(陪检)
  2274. disabledyyDate = (current: Date): boolean => {
  2275. return differenceInCalendarDays(current, new Date()) < 0;
  2276. };
  2277. // 禁用日期(转运)
  2278. disabledyyDateZy = (current: Date): boolean => {
  2279. return differenceInCalendarDays(current, new Date()) < 0;
  2280. };
  2281. // 一键建单确认弹框
  2282. confirmSub: boolean = false;
  2283. confirmPostData: any = {}; //确认提交数据
  2284. confirmYuyue: boolean = false; //确认预约
  2285. confirmInfo: string = "";
  2286. btnLoading3 = false;
  2287. confirm() {
  2288. if (this.confirmYuyue) {
  2289. this.confirmPostData.workOrder.yyTime =
  2290. format(parse(this.yyTime, 'yyyy-MM-dd HH:mm:ss', new Date()), "yyyy-MM-dd HH:mm") + ":00";
  2291. }
  2292. if (!this.confirmYuyue) {
  2293. this.confirmPostData.workOrder.platform = 2;
  2294. } else {
  2295. delete this.confirmPostData.workOrder.platform;
  2296. }
  2297. //是否需要医护陪同检查
  2298. if (this.patientMsg.careLevel && this.currentTasktype.isAccompany == 1) {
  2299. //特级护理或一级护理
  2300. if (
  2301. this.patientMsg.careLevel.value === "0" ||
  2302. this.patientMsg.careLevel.value === "1"
  2303. ) {
  2304. this.btnLoading = false;
  2305. this.btnLoading1 = false;
  2306. this.accompany(this.confirmPostData, this.confirmYuyue, "patient-yy");
  2307. return;
  2308. }
  2309. }
  2310. if (this.patientMsg.illnessState && this.currentTasktype.isAccompany == 1) {
  2311. //病危或病重
  2312. if (
  2313. this.patientMsg.illnessState.value === "2" ||
  2314. this.patientMsg.illnessState.value === "3"
  2315. ) {
  2316. this.btnLoading = false;
  2317. this.btnLoading1 = false;
  2318. this.accompany(this.confirmPostData, this.confirmYuyue, "patient-yy");
  2319. return;
  2320. }
  2321. }
  2322. this.btnLoading3 = true;
  2323. this.confirmPostData.workOrder.isAccompany = 0; //是否需要医护陪同检查
  2324. this.newOrderTimeFun(this.confirmPostData.workOrder, () => {
  2325. this.btnLoading3 = false;
  2326. this.cancel();
  2327. }, () => {
  2328. this.mainService
  2329. .postCustom(
  2330. "api",
  2331. this.confirmYuyue ? "appointmentOrder" : "startOrder",
  2332. this.confirmPostData
  2333. )
  2334. .subscribe((data) => {
  2335. this.message.remove(this.jdFlagId);
  2336. this.btnLoading3 = false;
  2337. this.cancel();
  2338. if (data.status == 200) {
  2339. if(this.currentDept.typeValue == 'recovery'){
  2340. this.mainService.postCustom("api", "clearPatientRecoveryDept", {patientCode: this.confirmPostData.workOrder.patient.patientCode}).subscribe((resultData) => {
  2341. this.showPromptModal("创建", true, "");
  2342. this.goodsLis = [];
  2343. // this.workOrderInspectScore = undefined;
  2344. this.getOrderList();
  2345. this.getDeptTaskType();
  2346. this.getTodayNum();
  2347. });
  2348. }else{
  2349. this.showPromptModal("创建", true, "");
  2350. this.goodsLis = [];
  2351. // this.workOrderInspectScore = undefined;
  2352. this.getOrderList();
  2353. this.getDeptTaskType();
  2354. this.getTodayNum();
  2355. }
  2356. } else if (data.status == 100042) {
  2357. this.showPromptModal("创建", false, data.msg);
  2358. this.getPatient(this.tabSearchCont);
  2359. } else if (data.status == 1000033) {
  2360. //重复建单那策略
  2361. this.repeatMsg = data.msg;
  2362. this.showDelModal(
  2363. this.confirmPostData,
  2364. "accompany5",
  2365. this.confirmYuyue
  2366. );
  2367. } else {
  2368. this.showPromptModal("创建", false, data.msg);
  2369. }
  2370. });
  2371. })
  2372. }
  2373. cancel() {
  2374. this.confirmSub = false;
  2375. // this.confirmPostData = {};
  2376. // this.confirmYuyue = false;
  2377. this.btnLoading = false;
  2378. }
  2379. patientForm: FormGroup; //患者信息一键建单表单
  2380. //患者送检检查项目
  2381. checkTypeLis: any = [];
  2382. // 患者信息一键建单关联检查
  2383. linkCheckLis: any = [];
  2384. isRemarks: boolean = false; //是否开启备注信息
  2385. allowUrgent: any = "0"; //加急
  2386. urgentReason: any = ""; //加急原因
  2387. // 初始化form表单
  2388. initForm() {
  2389. // 初始化患者信息一键建单表单
  2390. this.patientForm = this.fb.group({
  2391. checkedType: [null, [Validators.required]],
  2392. goods: [null],
  2393. inspectScore: this.inspectAndPatientTransportConfig.enableTripType == 1 ? [null, [Validators.required]] : [null],
  2394. workOrderRemark2: [null],
  2395. linkCheck: [null, []],
  2396. targetOffice: [null, [this.targetOfficeValidator]],
  2397. originOffice: [null, [this.originOfficeValidator]],
  2398. allowUrgent: [null], //加急
  2399. urgentReason: [null, [this.urgentReasonValidator]], //加急原因
  2400. });
  2401. // 初始化一键发起建单表单
  2402. this.shortcutForm = this.fb.group({
  2403. targetOffice: [null, [this.targetOfficeShortCutValidator]],
  2404. originOffice: [null, [this.originOfficeShortCutValidator]],
  2405. });
  2406. // 初始化一键发起建单表单
  2407. this.shortcutForm1 = this.fb.group({
  2408. targetOffice: [null, [this.targetOfficeShortCutValidator1]],
  2409. originOffice: [null, [this.originOfficeShortCutValidator1]],
  2410. });
  2411. //新增报修
  2412. this.bxForm = this.fb.group({
  2413. // name: [null, [Validators.required]],
  2414. // phone: [null, [Validators.required]],
  2415. // hospital: [null, [Validators.required]],
  2416. // building: [null, [Validators.required]],
  2417. // address: [null, [Validators.required]],
  2418. content: [null, [Validators.required]],
  2419. });
  2420. }
  2421. //创建自定义校验规则dateValidator,用于复选框组校验时调用。
  2422. // 起点科室校验
  2423. originOfficeValidator = (control: FormControl): { [s: string]: boolean } => {
  2424. if (
  2425. this.patientForm &&
  2426. this.patientForm.value &&
  2427. this.checkedShowMsg.status != 200 &&
  2428. !control.value &&
  2429. (this.checkedShowMsg.status == 100015 ||
  2430. this.checkedShowMsg.status == 100013)
  2431. ) {
  2432. return { required: true };
  2433. }
  2434. };
  2435. // 目标科室校验
  2436. targetOfficeValidator = (control: FormControl): { [s: string]: boolean } => {
  2437. if (
  2438. this.patientForm &&
  2439. this.patientForm.value &&
  2440. this.checkedShowMsg.status != 200 &&
  2441. !control.value &&
  2442. (this.checkedShowMsg.status == 100015 ||
  2443. this.checkedShowMsg.status == 100014)
  2444. ) {
  2445. return { required: true };
  2446. }
  2447. };
  2448. // 加急原因校验
  2449. urgentReasonValidator = (control: FormControl): { [s: string]: boolean } => {
  2450. if (this.allowUrgent == 1) {
  2451. return { required: true };
  2452. }
  2453. };
  2454. surgeryModal: boolean = false; //模态框
  2455. surgeryInfo:string = '';
  2456. surgeryItem: any = {};
  2457. hideSurgeryModal() {
  2458. this.surgeryModal = false;
  2459. }
  2460. // 确认
  2461. confirmSurgery(surgeryItem) {
  2462. console.log(surgeryItem);
  2463. this.btnLoading = true;
  2464. this.mainService
  2465. .listMsgByMain('surgeryMsg', {
  2466. surgeryId: surgeryItem.id,
  2467. code: 'surgery_begin',
  2468. })
  2469. .subscribe((result:any) => {
  2470. this.btnLoading = false;
  2471. this.surgeryModal = false;
  2472. if(result.state == 200){
  2473. this.showPromptModal("操作", true, "");
  2474. }else{
  2475. this.showPromptModal("操作", false, result.msg);
  2476. }
  2477. });
  2478. }
  2479. // 手术安排信息-即将开始
  2480. surgeryBegin(e, item){
  2481. e.stopPropagation();
  2482. let maskFlag = this.message.loading("正在加载中..", {
  2483. nzDuration: 0,
  2484. }).messageId;
  2485. let postData = {
  2486. idx: 0,
  2487. sum: 9999,
  2488. transportMessage: {
  2489. hosId: this.currentHospital.id,
  2490. code: 'surgery_begin',
  2491. },
  2492. };
  2493. this.mainService
  2494. .getFetchDataList("simple/data", "transportMessage", postData)
  2495. .subscribe((result:any) => {
  2496. this.message.remove(maskFlag);
  2497. if (result.status == 200) {
  2498. result.list = result.list || [];
  2499. if(result.list.length){
  2500. let resultObj:any = {};
  2501. result.list.forEach(v => {
  2502. resultObj[v.role] = v;
  2503. })
  2504. item.doctorNameFlag = resultObj.doctor.phoneFlag == 1 || resultObj.doctor.wechatFlag == 1;
  2505. item.docAssistantInfosFlag = resultObj.docAssistant.phoneFlag == 1 || resultObj.docAssistant.wechatFlag == 1;
  2506. item.anesthetistNameFlag = resultObj.anesthetist.phoneFlag == 1 || resultObj.anesthetist.wechatFlag == 1;
  2507. item.patientNameFlag = resultObj.patient.phoneFlag == 1 || resultObj.patient.wechatFlag == 1;
  2508. if(item.docAssistantInfosFlag && item.docAssistantInfos){
  2509. item.docAssistantInfos = item.docAssistantInfos.split('|').map(v => v.split(',')[0]).join(' / ');
  2510. }
  2511. this.surgeryModal = true;
  2512. this.surgeryItem = item;
  2513. this.surgeryInfo = `提示:您即将给以下工作人员发送短信/微信提醒,请确认以下信息`;
  2514. }else{
  2515. this.showPromptModal("【手术即将开始通知】未配置", false, "失败");
  2516. }
  2517. }else{
  2518. this.showPromptModal("接口获取数据", false, "失败");
  2519. }
  2520. });
  2521. }
  2522. // -----------------
  2523. // --------------------------------------------------------start
  2524. otherDataModal: boolean = false; //模态框
  2525. otherDataInfo:string = '';
  2526. otherDataItem: any = {};
  2527. hideOtherDataModal() {
  2528. this.otherDataModal = false;
  2529. }
  2530. // 确认
  2531. confirmOtherData() {
  2532. console.log(this.otherDataItem);
  2533. this.otherBuildOrder(JSON.parse(this.otherDataItem).otherList);
  2534. this.otherDataModal = false;
  2535. this.relationTransModalShow = JSON.parse(this.otherDataItem).show;
  2536. }
  2537. otherDataConfirm(e){
  2538. this.otherDataModal = true;
  2539. this.otherDataItem = e;
  2540. this.otherDataInfo = `您本次送${this.otherBindConfigDto.relationTrans.name}选择了${JSON.parse(this.otherDataItem).otherList.length}本${this.otherBindConfigDto.relationTrans.name},您确认要建单配送吗?`;
  2541. }
  2542. // --------------------------------------------------------end
  2543. pickUpModal: boolean = false; //模态框
  2544. pickUpInfo:string = '';
  2545. pickUpItem: any = {};
  2546. hidePickUpModal() {
  2547. this.pickUpModal = false;
  2548. }
  2549. // 确认
  2550. confirmPickUp() {
  2551. console.log(this.pickUpItem);
  2552. this.btnLoading = true;
  2553. this.mainService
  2554. .createOrTakeOrder({
  2555. type: 'surgery',
  2556. id: this.pickUpItem.id,
  2557. workOrder: {
  2558. sourceld: 2,
  2559. createDept: this.loginUser.dept.id,
  2560. platform: 2
  2561. }
  2562. })
  2563. .subscribe((result:any) => {
  2564. this.btnLoading = false;
  2565. this.pickUpModal = false;
  2566. if(result.state == 200){
  2567. this.showPromptModal("创建", true, "");
  2568. this.getOrderList();
  2569. this.getDeptTaskType();
  2570. this.getTodayNum();
  2571. }else{
  2572. this.showPromptModal("创建", false, result.msg);
  2573. }
  2574. });
  2575. }
  2576. // 手术安排信息-一键接患者
  2577. pickUpPatient(e, item){
  2578. e.stopPropagation();
  2579. this.pickUpModal = true;
  2580. this.pickUpItem = item;
  2581. this.pickUpInfo = `您本次需要从<span style="color:red;">${item.areaDeptDTO ? (this.deptDisplay == 2 ? item.areaDeptDTO.deptalias : item.areaDeptDTO.dept) : ''}</span>科室接<span style="color:red;">${item.patientDTO ? item.patientDTO.patientName : ''}</span>患者到<span style="color:red;">${item.surgeryDeptDTO ? (this.deptDisplay == 2 ? item.surgeryDeptDTO.deptalias : item.surgeryDeptDTO.dept) : ''}</span>手术间进行手术,您确认接患者吗?`
  2582. }
  2583. sendWardModal: boolean = false; //模态框
  2584. sendWardInfo:string = '';
  2585. sendWardItem: any = {};
  2586. hideSendWardModal() {
  2587. this.sendWardModal = false;
  2588. }
  2589. // 确认
  2590. sLoading1 = false;
  2591. confirmSendWard(data) {
  2592. console.log(this.sendWardItem);
  2593. this.sLoading1 = true;
  2594. this.mainService
  2595. .createRemandOrder({
  2596. type: 'surgery',
  2597. surgeryId: this.sendWardItem.id,
  2598. orderId: this.sendWardItem.gdid,
  2599. configId: this.surgeryConfigs.id,
  2600. remandType: 'clinical',
  2601. remandClean: data.isRemandClean ? 1 : 0,
  2602. })
  2603. .subscribe((result:any) => {
  2604. this.sLoading1 = false;
  2605. this.sendWardModal = false;
  2606. if(result.state == 200){
  2607. this.showPromptModal("创建", true, "");
  2608. this.getOrderList();
  2609. this.getDeptTaskType();
  2610. this.getTodayNum();
  2611. }else{
  2612. this.showPromptModal("创建", false, result.msg);
  2613. }
  2614. });
  2615. }
  2616. // 手术中患者-送回病房
  2617. sendWard(e, item){
  2618. e.stopPropagation();
  2619. this.sendWardModal = true;
  2620. this.sendWardItem = item;
  2621. this.sendWardInfo = `您是否确认将<span style="color:red;">${item.patientDTO ? item.patientDTO.patientName : ''}</span>患者送往<span style="color:red;">${item.areaDeptDTO ? (this.deptDisplay == 2 ? item.areaDeptDTO.deptalias : item.areaDeptDTO.dept) : ''}</span>科室吗?`
  2622. }
  2623. sendAwakeningRoomModal: boolean = false; //模态框
  2624. sendAwakeningRoomInfo:string = '';
  2625. sendAwakeningRoomItem: any = {};
  2626. hideSendAwakeningRoomModal() {
  2627. this.sendAwakeningRoomModal = false;
  2628. }
  2629. // 确认
  2630. sLoading2 = false;
  2631. confirmSendAwakeningRoom(data) {
  2632. console.log(this.sendAwakeningRoomItem);
  2633. console.log(this.surgeryConfigs);
  2634. if(!data.recoveryRoom){
  2635. this.message.info(`<span class="red">${this.surgeryConfigs.recoveryType.taskName}</span>任务类型-运输过程-终点科室-默认科室配置错误!`);
  2636. return;
  2637. }
  2638. this.sLoading2 = true;
  2639. this.mainService
  2640. .createRemandOrder({
  2641. type: 'surgery',
  2642. surgeryId: this.sendAwakeningRoomItem.id,
  2643. orderId: this.sendAwakeningRoomItem.gdid,
  2644. configId: this.surgeryConfigs.id,
  2645. remandType: 'recovery',
  2646. remandClean: data.isRemandClean ? 1 : 0,
  2647. endDept: data.recoveryRoom || undefined,
  2648. })
  2649. .subscribe((result:any) => {
  2650. this.sLoading2 = false;
  2651. this.sendAwakeningRoomModal = false;
  2652. if(result.state == 200){
  2653. this.showPromptModal("创建", true, "");
  2654. this.getOrderList();
  2655. this.getDeptTaskType();
  2656. this.getTodayNum();
  2657. }else{
  2658. this.showPromptModal("创建", false, result.msg);
  2659. }
  2660. });
  2661. }
  2662. // 手术中患者-送回苏醒区
  2663. sendAwakeningRoom(e, item){
  2664. e.stopPropagation();
  2665. this.sendAwakeningRoomModal = true;
  2666. this.sendAwakeningRoomItem = item;
  2667. this.sendAwakeningRoomInfo = `您是否确定将<span style="color:red;">${item.patientDTO ? item.patientDTO.patientName : ''}</span>患者送往<span style="color:red;">${this.surgeryConfigs.recoveryDeptDTO ? (this.deptDisplay == 2 ? this.surgeryConfigs.recoveryDeptDTO.deptalias : this.surgeryConfigs.recoveryDeptDTO.dept) : ''}</span>科室吗?`
  2668. }
  2669. // 手术排程信息-一键建单
  2670. createOrder(e, item){
  2671. e.stopPropagation();
  2672. this.newPatientOrder(item.patientDTO);
  2673. }
  2674. // 患者信息一键建单
  2675. patientModal: boolean = false; //患者信息一键建单模态框
  2676. patientMsg; //患者信息
  2677. // 打开患者信息一键建单模态框
  2678. maskFlag: any = false;
  2679. newPatientOrder(msg) {
  2680. this.yyTime = null;
  2681. this.yyTimeZy = null;
  2682. this.btnLoading = false;
  2683. this.btnLoading1 = false;
  2684. let that = this;
  2685. that.initForm();
  2686. that.checkedShowMsg = {};
  2687. that.patientMsg = msg;
  2688. this.workOrderInspectScore = msg.tripType;
  2689. this.workOrderRemark2 = msg.remark || '';
  2690. this.maskFlag = this.message.loading("正在加载中..", {
  2691. nzDuration: 0,
  2692. }).messageId;
  2693. that.mainService
  2694. .postCustom("configuration", "deptTSPTaskType", {})
  2695. .subscribe((data) => {
  2696. that.checkTypeLis = data.data;
  2697. // 默认选中患者陪检,没有患者陪检,则选择第一个患者其他服务的任务类型
  2698. let id;
  2699. for (let i = that.checkTypeLis.length - 1; i >= 0; i--) {
  2700. if (that.checkTypeLis[i].associationType.value == "inspect") {
  2701. id = that.checkTypeLis[i].id;
  2702. break;
  2703. } else if (
  2704. that.checkTypeLis[i].associationType.value == "patientTransport"
  2705. ) {
  2706. id = that.checkTypeLis[i].id;
  2707. }
  2708. }
  2709. that.patientForm.controls.checkedType.setValue(id);
  2710. this.changeCheckedType(true);
  2711. });
  2712. }
  2713. yyTimeChange(e) {
  2714. if (this.yyTime) {
  2715. let now = new Date();
  2716. // 禁用日期(陪检)
  2717. if (getHours(this.yyTime) < getHours(now)) {
  2718. this.disabledyyDate = (current: Date): boolean => {
  2719. return differenceInCalendarDays(current, new Date()) < 1;
  2720. };
  2721. } else {
  2722. this.disabledyyDate = (current: Date): boolean => {
  2723. return differenceInCalendarDays(current, new Date()) < 0;
  2724. };
  2725. }
  2726. let end = this.getLgNumber(getMinutes(this.yyTime), this.inspectAndPatientTransportConfig.timeMod);
  2727. this.yyTime = setMinutes(this.yyTime, end);
  2728. }
  2729. this.clickYYFlag = false;
  2730. }
  2731. yyTimeZyChange(e) {
  2732. if (this.yyTimeZy) {
  2733. let now = new Date();
  2734. // 禁用日期(转运)
  2735. if (getHours(this.yyTimeZy) < getHours(now)) {
  2736. this.disabledyyDateZy = (current: Date): boolean => {
  2737. return differenceInCalendarDays(current, new Date()) < 1;
  2738. };
  2739. } else {
  2740. this.disabledyyDateZy = (current: Date): boolean => {
  2741. return differenceInCalendarDays(current, new Date()) < 0;
  2742. };
  2743. }
  2744. let end = this.getLgNumber(getMinutes(this.yyTimeZy), this.inspectAndPatientTransportConfig.timeMod);
  2745. this.yyTimeZy = setMinutes(this.yyTimeZy, end);
  2746. }
  2747. this.clickYYZyFlag = false;
  2748. }
  2749. // 获取大于x,并且是n的倍数的数字
  2750. getLgNumber(x: number, n:number): number{
  2751. for(let i = x; i < 60; i++){
  2752. if(i % n === 0){
  2753. return i;
  2754. }
  2755. }
  2756. return 0;
  2757. }
  2758. hidePatientOrder() {
  2759. this.patientModal = false;
  2760. this.clickYYFlag = false;
  2761. this.clickYYZyFlag = false;
  2762. }
  2763. // 预约建单
  2764. btnLoading1 = false;
  2765. confirmPatient1(type) {
  2766. this.confirmPatient(type);
  2767. }
  2768. // 患者信息保存
  2769. clickYYFlag = false; //是否点击预约建单-患者陪检
  2770. clickYYZyFlag = false; //是否点击预约建单-患者其他
  2771. confirmPatient(yuyue?) {
  2772. if (yuyue === "patient-yuyue") {
  2773. this.clickYYFlag = true;
  2774. } else {
  2775. this.clickYYFlag = false;
  2776. }
  2777. if (yuyue === "patient-zy-yuyue") {
  2778. this.clickYYZyFlag = true;
  2779. } else {
  2780. this.clickYYZyFlag = false;
  2781. }
  2782. // 选项是患者转运
  2783. let flag = this.checkTypeLis.some((item) => {
  2784. return (
  2785. item.id == this.patientForm.controls.checkedType.value &&
  2786. item.associationType.value == "patientTransport"
  2787. );
  2788. });
  2789. //预约时间-患者陪检不能为空
  2790. console.log(this.yyTime, this.yyTimeZy, flag, yuyue);
  2791. if (
  2792. (!this.yyTime && !flag && yuyue === "patient-yuyue") ||
  2793. (!this.yyTimeZy && flag && yuyue === "patient-zy-yuyue")
  2794. ) {
  2795. return;
  2796. }
  2797. console.log(this.yyDateZy, this.yyTimeZy, this.yyDate, this.yyTime, flag);
  2798. if (flag) {
  2799. //转运
  2800. let yyDateZy = (typeof this.yyDateZy === 'object') ? new Date(this.yyDateZy) : parse(this.yyDateZy, 'yyyy-MM-dd HH:mm:ss', new Date());
  2801. let yyTimeZy = (typeof this.yyTimeZy === 'object') ? new Date(this.yyTimeZy) : parse(this.yyTimeZy, 'yyyy-MM-dd HH:mm:ss', new Date());
  2802. this.yyTimeZy =
  2803. format(yyDateZy, "yyyy-MM-dd") +
  2804. " " +
  2805. format(yyTimeZy, "HH:mm") +
  2806. ":00";
  2807. } else {
  2808. //陪检
  2809. let yyDate = (typeof this.yyDate === 'object') ? new Date(this.yyDate) : parse(this.yyDate, 'yyyy-MM-dd HH:mm:ss', new Date());
  2810. let yyTime = (typeof this.yyTime === 'object') ? new Date(this.yyTime) : parse(this.yyTime, 'yyyy-MM-dd HH:mm:ss', new Date());
  2811. this.yyTime =
  2812. format(yyDate, "yyyy-MM-dd") +
  2813. " " +
  2814. format(yyTime, "HH:mm") +
  2815. ":00";
  2816. }
  2817. var that = this;
  2818. for (const i in that.patientForm.controls) {
  2819. that.patientForm.controls[i].markAsDirty();
  2820. that.patientForm.controls[i].updateValueAndValidity();
  2821. }
  2822. if (that.patientForm.invalid) {
  2823. if(!that.patientForm.value.inspectScore){
  2824. this.message.error("陪检方式必填!");
  2825. }
  2826. return;
  2827. }
  2828. console.log(that.patientForm);
  2829. if (yuyue) {
  2830. this.confirmYuyue = true;
  2831. this.btnLoading1 = true;
  2832. } else {
  2833. this.confirmYuyue = false;
  2834. this.btnLoading = true;
  2835. }
  2836. let postData: any = {
  2837. workOrder: {
  2838. sourceId: SourceId.hushi,
  2839. taskType: { id: that.patientForm.controls.checkedType.value },
  2840. startDept: { id: that.checkedShowMsg.startDept },
  2841. endDepts: [{ id: that.checkedShowMsg.endDept }],
  2842. createDept: that.loginUserDeptId,
  2843. patient: {
  2844. patientCode: that.patientMsg.patientCode,
  2845. },
  2846. },
  2847. };
  2848. if (!flag) {
  2849. postData.workOrder.taskType.isHalfInspect =
  2850. this.currentTasktype.isHalfInspect === 1 ? 1 : 0; //半程陪检
  2851. }
  2852. if (
  2853. (that.checkedShowMsg.status == 100013 ||
  2854. that.checkedShowMsg.status == 100015) &&
  2855. that.patientForm.value.originOffice
  2856. ) {
  2857. postData.workOrder.startDept.id = that.patientForm.value.originOffice;
  2858. }
  2859. if (that.patientForm.value.targetOffice) {
  2860. postData.workOrder["endDepts"] = [
  2861. { id: that.patientForm.value.targetOffice },
  2862. ];
  2863. } else if (flag) {
  2864. postData.workOrder["endDepts"] = [
  2865. { id: that.checkedShowMsg.end.end.list[0].id },
  2866. ];
  2867. }
  2868. let checkedArr = [];
  2869. let yy = false; //是否有预约时间
  2870. if (that.linkCheckLis && that.linkCheckLis.length) {
  2871. that.linkCheckLis.forEach((e) => {
  2872. if (e.checked) {
  2873. checkedArr.push({ id: e.value });
  2874. if (e.yyTime) {
  2875. yy = true;
  2876. }
  2877. }
  2878. });
  2879. }
  2880. // 携带设备
  2881. let goods = "";
  2882. if (that.patientForm.value.goods && that.patientForm.value.goods.length) {
  2883. that.patientForm.value.goods.forEach((e) => {
  2884. if (e.checked) {
  2885. goods += e.value + ",";
  2886. }
  2887. });
  2888. goods = goods.slice(0, goods.length - 1);
  2889. }
  2890. postData.workOrder["goods"] = goods;
  2891. // 陪检方式
  2892. if (that.patientForm.value.inspectScore) {
  2893. postData.workOrder["inspectScore"] = { id: that.patientForm.value.inspectScore };
  2894. }
  2895. // 工单备注
  2896. postData.workOrder["workOrderRemark"] = that.workOrderRemark2 || '';
  2897. if (!yuyue && that.current_allowUrgent && this.allowUrgent == 1) {
  2898. postData.workOrder["urgentDetails"] = {
  2899. checkStatus: { id: 329 },
  2900. urgentReason: that.urgentReason,
  2901. };
  2902. } else {
  2903. delete postData.workOrder["urgentDetails"];
  2904. }
  2905. if (
  2906. yy &&
  2907. that.checkedShowMsg.status == 200 &&
  2908. that.linkCheckLis &&
  2909. checkedArr.length
  2910. ) {
  2911. // 有预约时间
  2912. postData.workOrder["checkList"] = checkedArr;
  2913. that.hidePatientOrder();
  2914. that.confirmSub = true;
  2915. that.confirmPostData = postData;
  2916. that.confirmInfo = "您确认建单吗?";
  2917. } else {
  2918. if (!yy && that.checkedShowMsg.status == 200) {
  2919. postData.workOrder["checkList"] = checkedArr;
  2920. // 添加预约时间
  2921. if (yuyue) {
  2922. postData.workOrder.yyTime =
  2923. format(parse(this.yyTime, 'yyyy-MM-dd HH:mm:ss', new Date()), "yyyy-MM-dd HH:mm") + ":00";
  2924. }
  2925. } else {
  2926. delete postData.workOrder["checkList"];
  2927. // 添加预约时间
  2928. if (yuyue) {
  2929. postData.workOrder.yyTime =
  2930. format(parse(this.yyTimeZy, 'yyyy-MM-dd HH:mm:ss', new Date()), "yyyy-MM-dd HH:mm") + ":00";
  2931. }
  2932. }
  2933. if (that.checkedShowMsg.status != 200) {
  2934. postData.workOrder["isRemand"] = this.isRemand ? 1 : 0;
  2935. }
  2936. if (!yuyue) {
  2937. postData.workOrder.platform = 2;
  2938. } else {
  2939. delete postData.workOrder.platform;
  2940. }
  2941. //是否需要医护陪同检查
  2942. if (this.patientMsg.careLevel && this.currentTasktype.isAccompany == 1) {
  2943. //特级护理或一级护理
  2944. if (
  2945. this.patientMsg.careLevel.value === "0" ||
  2946. this.patientMsg.careLevel.value === "1"
  2947. ) {
  2948. this.btnLoading = false;
  2949. this.btnLoading1 = false;
  2950. this.accompany(postData, yuyue, "patient");
  2951. return;
  2952. }
  2953. }
  2954. if (
  2955. this.patientMsg.illnessState &&
  2956. this.currentTasktype.isAccompany == 1
  2957. ) {
  2958. //病危或病重
  2959. if (
  2960. this.patientMsg.illnessState.value === "2" ||
  2961. this.patientMsg.illnessState.value === "3"
  2962. ) {
  2963. this.btnLoading = false;
  2964. this.btnLoading1 = false;
  2965. this.accompany(postData, yuyue, "patient");
  2966. return;
  2967. }
  2968. }
  2969. postData.workOrder.isAccompany = 0; //是否需要医护陪同检查
  2970. this.newOrderTimeFun(postData.workOrder, () => {
  2971. this.hidePatientOrder();
  2972. }, () => {
  2973. this.mainService
  2974. .postCustom("api", yuyue ? "appointmentOrder" : "startOrder", postData)
  2975. .subscribe((data) => {
  2976. this.message.remove(this.jdFlagId);
  2977. this.hidePatientOrder();
  2978. if (data.status == 200) {
  2979. if(this.currentDept.typeValue == 'recovery'){
  2980. this.mainService.postCustom("api", "clearPatientRecoveryDept", {patientCode: postData.workOrder.patient.patientCode}).subscribe((resultData) => {
  2981. this.showPromptModal("创建", true, "");
  2982. this.goodsLis = [];
  2983. // this.workOrderInspectScore = undefined;
  2984. this.getOrderList();
  2985. this.getDeptTaskType();
  2986. this.getTodayNum();
  2987. });
  2988. }else{
  2989. this.showPromptModal("创建", true, "");
  2990. this.goodsLis = [];
  2991. // this.workOrderInspectScore = undefined;
  2992. this.getOrderList();
  2993. this.getDeptTaskType();
  2994. this.getTodayNum();
  2995. }
  2996. } else if (data.status == 100042) {
  2997. this.showPromptModal("创建", false, data.msg);
  2998. this.getPatient(this.tabSearchCont);
  2999. } else if (data.status == 1000033) {
  3000. //重复建单那策略
  3001. this.repeatMsg = data.msg;
  3002. this.showDelModal(postData, "transport", yuyue);
  3003. } else {
  3004. this.showPromptModal("创建", false, data.msg);
  3005. }
  3006. });
  3007. })
  3008. }
  3009. }
  3010. // 是否需要护士医生陪同模态框
  3011. accompanyModal: boolean = false;
  3012. accompanyLoading: boolean = false;
  3013. cancenlLoading: boolean = false;
  3014. accompanyPostData = null;
  3015. accompanyYuyue;
  3016. accompanyType = "";
  3017. accompany(postData, yuyue, type) {
  3018. this.accompanyModal = true;
  3019. this.accompanyPostData = postData;
  3020. this.accompanyYuyue = yuyue;
  3021. this.accompanyType = type;
  3022. }
  3023. confirmAccompany() {
  3024. this.accompanyPostData.workOrder.isAccompany = 1;
  3025. this.accompanyLoading = true;
  3026. if (this.accompanyType == "patient") {
  3027. //患者列表直接建单
  3028. this.newOrderTimeFun(this.accompanyPostData.workOrder, () => {
  3029. this.hidePatientOrder();
  3030. this.accompanyModal = false;
  3031. this.accompanyLoading = false;
  3032. }, () => {
  3033. this.mainService
  3034. .postCustom(
  3035. "api",
  3036. this.accompanyYuyue ? "appointmentOrder" : "startOrder",
  3037. this.accompanyPostData
  3038. )
  3039. .subscribe((data) => {
  3040. this.message.remove(this.jdFlagId);
  3041. this.hidePatientOrder();
  3042. this.accompanyModal = false;
  3043. this.accompanyLoading = false;
  3044. if (data.status == 200) {
  3045. if(this.currentDept.typeValue == 'recovery'){
  3046. this.mainService.postCustom("api", "clearPatientRecoveryDept", {patientCode: this.accompanyPostData.workOrder.patient.patientCode}).subscribe((resultData) => {
  3047. this.showPromptModal("创建", true, "");
  3048. this.goodsLis = [];
  3049. // this.workOrderInspectScore = undefined;
  3050. this.getOrderList();
  3051. this.getDeptTaskType();
  3052. this.getTodayNum();
  3053. });
  3054. }else{
  3055. this.showPromptModal("创建", true, "");
  3056. this.goodsLis = [];
  3057. // this.workOrderInspectScore = undefined;
  3058. this.getOrderList();
  3059. this.getDeptTaskType();
  3060. this.getTodayNum();
  3061. }
  3062. } else if (data.status == 100042) {
  3063. this.showPromptModal("创建", false, data.msg);
  3064. this.getPatient(this.tabSearchCont);
  3065. } else if (data.status == 1000033) {
  3066. //重复建单那策略
  3067. this.repeatMsg = data.msg;
  3068. this.showDelModal(
  3069. this.accompanyPostData,
  3070. "accompany1",
  3071. this.accompanyYuyue
  3072. );
  3073. } else {
  3074. this.showPromptModal("创建", false, data.msg);
  3075. }
  3076. });
  3077. })
  3078. } else if (this.accompanyType == "patient-yy") {
  3079. //患者列表预约建单
  3080. this.newOrderTimeFun(this.accompanyPostData.workOrder, () => {
  3081. this.btnLoading3 = false;
  3082. this.accompanyModal = false;
  3083. this.accompanyLoading = false;
  3084. this.cancel();
  3085. }, () => {
  3086. this.mainService
  3087. .postCustom(
  3088. "api",
  3089. this.accompanyYuyue ? "appointmentOrder" : "startOrder",
  3090. this.accompanyPostData
  3091. )
  3092. .subscribe((data) => {
  3093. this.message.remove(this.jdFlagId);
  3094. this.btnLoading3 = false;
  3095. this.accompanyModal = false;
  3096. this.accompanyLoading = false;
  3097. this.cancel();
  3098. if (data.status == 200) {
  3099. if(this.currentDept.typeValue == 'recovery'){
  3100. this.mainService.postCustom("api", "clearPatientRecoveryDept", {patientCode: this.accompanyPostData.workOrder.patient.patientCode}).subscribe((resultData) => {
  3101. this.showPromptModal("创建", true, "");
  3102. this.goodsLis = [];
  3103. // this.workOrderInspectScore = undefined;
  3104. this.getOrderList();
  3105. this.getDeptTaskType();
  3106. this.getTodayNum();
  3107. });
  3108. }else{
  3109. this.showPromptModal("创建", true, "");
  3110. this.goodsLis = [];
  3111. // this.workOrderInspectScore = undefined;
  3112. this.getOrderList();
  3113. this.getDeptTaskType();
  3114. this.getTodayNum();
  3115. }
  3116. } else if (data.status == 100042) {
  3117. this.showPromptModal("创建", false, data.msg);
  3118. this.getPatient(this.tabSearchCont);
  3119. } else if (data.status == 1000033) {
  3120. //重复建单那策略
  3121. this.repeatMsg = data.msg;
  3122. this.showDelModal(
  3123. this.accompanyPostData,
  3124. "accompany2",
  3125. this.accompanyYuyue
  3126. );
  3127. } else {
  3128. this.showPromptModal("创建", false, data.msg);
  3129. }
  3130. });
  3131. })
  3132. }
  3133. }
  3134. hideAccompanyModal(e) {
  3135. console.log(e);
  3136. if (e === "x") {
  3137. //关闭
  3138. this.accompanyModal = false;
  3139. return;
  3140. }
  3141. this.accompanyPostData.workOrder.isAccompany = 0;
  3142. this.cancenlLoading = true;
  3143. if (this.accompanyType == "patient") {
  3144. //患者列表直接建单
  3145. this.newOrderTimeFun(this.accompanyPostData.workOrder, () => {
  3146. this.hidePatientOrder();
  3147. this.accompanyModal = false;
  3148. this.cancenlLoading = false;
  3149. }, () => {
  3150. this.mainService
  3151. .postCustom(
  3152. "api",
  3153. this.accompanyYuyue ? "appointmentOrder" : "startOrder",
  3154. this.accompanyPostData
  3155. )
  3156. .subscribe((data) => {
  3157. this.message.remove(this.jdFlagId);
  3158. this.hidePatientOrder();
  3159. this.accompanyModal = false;
  3160. this.cancenlLoading = false;
  3161. if (data.status == 200) {
  3162. if(this.currentDept.typeValue == 'recovery'){
  3163. this.mainService.postCustom("api", "clearPatientRecoveryDept", {patientCode: this.accompanyPostData.workOrder.patient.patientCode}).subscribe((resultData) => {
  3164. this.showPromptModal("创建", true, "");
  3165. this.goodsLis = [];
  3166. // this.workOrderInspectScore = undefined;
  3167. this.getOrderList();
  3168. this.getDeptTaskType();
  3169. this.getTodayNum();
  3170. });
  3171. }else{
  3172. this.showPromptModal("创建", true, "");
  3173. this.goodsLis = [];
  3174. // this.workOrderInspectScore = undefined;
  3175. this.getOrderList();
  3176. this.getDeptTaskType();
  3177. this.getTodayNum();
  3178. }
  3179. } else if (data.status == 100042) {
  3180. this.showPromptModal("创建", false, data.msg);
  3181. this.getPatient(this.tabSearchCont);
  3182. } else if (data.status == 1000033) {
  3183. //重复建单那策略
  3184. this.repeatMsg = data.msg;
  3185. this.showDelModal(
  3186. this.accompanyPostData,
  3187. "accompany3",
  3188. this.accompanyYuyue
  3189. );
  3190. } else {
  3191. this.showPromptModal("创建", false, data.msg);
  3192. }
  3193. });
  3194. })
  3195. } else if (this.accompanyType == "patient-yy") {
  3196. //患者列表预约建单
  3197. this.newOrderTimeFun(this.accompanyPostData.workOrder, () => {
  3198. this.btnLoading3 = false;
  3199. this.accompanyModal = false;
  3200. this.cancenlLoading = false;
  3201. this.cancel();
  3202. }, () => {
  3203. this.mainService
  3204. .postCustom(
  3205. "api",
  3206. this.accompanyYuyue ? "appointmentOrder" : "startOrder",
  3207. this.accompanyPostData
  3208. )
  3209. .subscribe((data) => {
  3210. this.message.remove(this.jdFlagId);
  3211. this.btnLoading3 = false;
  3212. this.accompanyModal = false;
  3213. this.cancenlLoading = false;
  3214. this.cancel();
  3215. if (data.status == 200) {
  3216. if(this.currentDept.typeValue == 'recovery'){
  3217. this.mainService.postCustom("api", "clearPatientRecoveryDept", {patientCode: this.accompanyPostData.workOrder.patient.patientCode}).subscribe((resultData) => {
  3218. this.showPromptModal("创建", true, "");
  3219. this.goodsLis = [];
  3220. // this.workOrderInspectScore = undefined;
  3221. this.getOrderList();
  3222. this.getDeptTaskType();
  3223. this.getTodayNum();
  3224. });
  3225. }else{
  3226. this.showPromptModal("创建", true, "");
  3227. this.goodsLis = [];
  3228. // this.workOrderInspectScore = undefined;
  3229. this.getOrderList();
  3230. this.getDeptTaskType();
  3231. this.getTodayNum();
  3232. }
  3233. } else if (data.status == 100042) {
  3234. this.showPromptModal("创建", false, data.msg);
  3235. this.getPatient(this.tabSearchCont);
  3236. } else if (data.status == 1000033) {
  3237. //重复建单那策略
  3238. this.repeatMsg = data.msg;
  3239. this.showDelModal(
  3240. this.accompanyPostData,
  3241. "accompany4",
  3242. this.accompanyYuyue
  3243. );
  3244. } else {
  3245. this.showPromptModal("创建", false, data.msg);
  3246. }
  3247. });
  3248. })
  3249. }
  3250. }
  3251. //获取携带设备
  3252. goodsLis: any = []; //携带设备
  3253. getAllGoods() {
  3254. this.mainService.getDictionary("list", "goods").subscribe((data) => {
  3255. let goodsLis = data || [];
  3256. goodsLis.forEach((e) => {
  3257. this.goodsLis.push({
  3258. label: e.name,
  3259. value: e.id,
  3260. checked: false,
  3261. });
  3262. });
  3263. });
  3264. }
  3265. //获取陪检方式
  3266. workOrderInspectScoreList:any[] = [];
  3267. workOrderInspectScore:any;
  3268. getWorkOrderInspectScore() {
  3269. let postData = { idx: 0, sum: 9999, workOrderInspectScore: { hosId: this.currentHospital.id } };
  3270. this.mainService
  3271. .getFetchDataList("simple/data", "workOrderInspectScore", postData)
  3272. .subscribe((result) => {
  3273. if (result.status == 200) {
  3274. this.workOrderInspectScoreList = result.list || [];
  3275. } else {
  3276. this.message.error("请求数据失败");
  3277. }
  3278. });
  3279. }
  3280. // 切换患者送检检查项目
  3281. checkedShowMsg: any = {}; //患者送检检查项目对应展示信息
  3282. current_allowUrgent = false; //当前任务类型是否允许加急
  3283. currentTasktype; //当前选中的任务类型对象
  3284. cLoading = false;
  3285. historyCustomRemarks2 = [];
  3286. isStartFixedType:boolean = false;
  3287. isEndFixedType:boolean = false;
  3288. patientQuery:any={};
  3289. changeCheckedType(isInit = false) {
  3290. isInit && (this.inspectToday = new Date());
  3291. this.customRemarks2 = [];
  3292. this.historyCustomRemarks2 = [];
  3293. this.isYyInspect = false;
  3294. this.linkCheckLisTrue = false;
  3295. this.clickYYFlag = false;
  3296. this.clickYYZyFlag = false;
  3297. this.currentTasktype = this.checkTypeLis.find(
  3298. (item) => item.id == this.patientForm.controls.checkedType.value
  3299. );
  3300. // 是否回显注意事项
  3301. if(isInit){
  3302. if(this.currentTasktype.remarksSwitch === 1){
  3303. this.workOrderRemark2 = this.patientMsg.remark || "";
  3304. }else{
  3305. this.workOrderRemark2 = '';
  3306. }
  3307. }
  3308. // 获取患者其他服务,护士端是否预约建单
  3309. let appointmentZyBuildFlag = this.checkTypeLis.filter((item) => item.id == this.patientForm.controls.checkedType.value && item.associationType.value == "patientTransport");
  3310. if (appointmentZyBuildFlag.length) {
  3311. this.appointmentZyBuildFlag =
  3312. appointmentZyBuildFlag[0].appointmentOtherSwitch == 1 ? "1" : "0";
  3313. console.log(this.appointmentZyBuildFlag, "seimin");
  3314. this.yyDateZy = new Date();
  3315. this.yyTimeZy = new Date();
  3316. let end = this.getLgNumber(this.yyTimeZy.getMinutes(), this.inspectAndPatientTransportConfig.timeMod);
  3317. this.yyTimeZy.setMinutes(end);
  3318. if(end === 0){
  3319. this.yyTimeZy.setHours(this.yyTimeZy.getHours() + 1);
  3320. }
  3321. } else {
  3322. this.appointmentBuildFlag =
  3323. this.currentTasktype.appointmentSwitch == 1 ? "1" : "0";
  3324. console.log(this.appointmentBuildFlag, "seimin");
  3325. }
  3326. console.log(this.patientForm.controls.checkedType.value, this.checkTypeLis);
  3327. this.current_allowUrgent =
  3328. this.checkTypeLis.find(
  3329. (item) => item.id == this.patientForm.controls.checkedType.value
  3330. ).allowUrgent == 1
  3331. ? true
  3332. : false;
  3333. // 判断这个任务类型是否允许加急 start
  3334. // 判断这个任务类型是否允许加急 end
  3335. let that = this;
  3336. let isInpect = this.checkTypeLis.some((item) => item.id == this.patientForm.controls.checkedType.value && item.associationType.value == "inspect");
  3337. this.patientQuery = {
  3338. taskTypeId: that.patientForm.controls.checkedType.value,
  3339. patientCode: that.patientMsg.patientCode,
  3340. startTime: isInpect ? format(startOfDay(this.inspectToday), 'yyyy-MM-dd HH:mm:ss') : undefined,
  3341. endTime: isInpect ? format(endOfDay(this.inspectToday), 'yyyy-MM-dd HH:mm:ss') : undefined,
  3342. };
  3343. this.cLoading = true;
  3344. that.mainService
  3345. .postCustom("nurse", "workOrder/buildTrip", this.patientQuery)
  3346. .subscribe((data) => {
  3347. this.cLoading = false;
  3348. this.message.remove(this.maskFlag);
  3349. this.maskFlag = false;
  3350. this.patientModal = true;
  3351. that.checkedShowMsg = data;
  3352. if(data.end){
  3353. if(data.end.end.departmentStrategy==202 ||
  3354. data.end.end.departmentStrategy==204 ||
  3355. data.end.end.departmentStrategy==205){
  3356. this.isEndFixedType = true
  3357. }else{
  3358. this.isEndFixedType = false
  3359. }
  3360. }
  3361. if(data.start){
  3362. if(data.start.start.departmentStrategy==202 ||
  3363. data.start.start.departmentStrategy==204 ||
  3364. data.start.start.departmentStrategy==205){
  3365. this.isStartFixedType = true
  3366. }else{
  3367. this.isStartFixedType = false
  3368. }
  3369. }
  3370. if (that.checkedShowMsg.status != 200) {
  3371. that.isRemand = data.isRemand == 1 ? true : false;
  3372. }
  3373. that.goodsLis = [];
  3374. // that.workOrderInspectScore = undefined;
  3375. that.allowUrgent = "0"; //加急
  3376. that.urgentReason = ""; //加急原因
  3377. that.getAllGoods();
  3378. that.getWorkOrderInspectScore();
  3379. // 工单备注配置 start
  3380. that.isRemarks = data.remarksSwitch == 1;
  3381. if (data.remarksSwitch == 1) {
  3382. if (data.customRemarks === null || data.customRemarks === "") {
  3383. that.customRemarks2 = [];
  3384. } else {
  3385. that.customRemarks2 = data.customRemarks.split("$");
  3386. }
  3387. that.workOrderRemarkTips2 =
  3388. data.remarksPrompts || "请填写工单备注,不超过100个字符";
  3389. // let user = JSON.parse(localStorage.getItem("user"));
  3390. // that.mainService
  3391. // .postCustom("nurse", "workOrder/recentRemarks", {
  3392. // deptId: user.user.dept.id,
  3393. // taskTypeId: that.patientForm.controls.checkedType.value,
  3394. // })
  3395. // .subscribe((result) => {
  3396. // if (result.state == 200) {
  3397. // that.historyCustomRemarks2 = result.data;
  3398. // }
  3399. // });
  3400. }
  3401. // 工单备注配置 end
  3402. that.linkCheckLis = [];
  3403. if (data.status == 200 && data.data && data.data.length) {
  3404. let arr = [];
  3405. data.data.forEach((e) => {
  3406. e.yyEndTime = e.yyTime
  3407. e.newTime = format(new Date(e.yyTime), 'MM-dd HH:mm')
  3408. if(e.endCheckTime){
  3409. e.newTime2 = format(new Date(e.endCheckTime), 'HH:mm')
  3410. e.yyEndTime = e.newTime + '--' + e.newTime2
  3411. }else{
  3412. e.yyEndTime = e.newTime
  3413. // e.newTime2 = format(addMinutes(new Date(e.yyTime), this.inspectAndPatientTransportConfig.yytimeGapMinute), 'HH:mm')
  3414. }
  3415. arr.push({
  3416. execDeptId: e.execDept.id,
  3417. yyTime: e.yyTime,
  3418. priority: e.priority,
  3419. manualCreate: e.manualCreate,
  3420. label:
  3421. (e.yyEndTime || "") +
  3422. " " +
  3423. (this.deptDisplay == 2
  3424. ? e.execDept.deptalias
  3425. : e.execDept.dept) +
  3426. " 进行 " +
  3427. (e.inspectName?e.inspectName:'' + '-' + e.inspectCode || "检查"),
  3428. value: e["id"],
  3429. checked: false,
  3430. remark: e.remark,
  3431. });
  3432. });
  3433. that.linkCheckLis = arr;
  3434. }
  3435. });
  3436. }
  3437. // 需要预约建单-事件
  3438. yyInspectChange(e) {
  3439. if (this.currentTasktype.associationType.value === "inspect") {
  3440. //陪检
  3441. let obj = this.filterLinkCheckLis.find((item) => {
  3442. return (
  3443. parse(item.yyTime, 'yyyy-MM-dd HH:mm:ss', new Date()).getTime() - new Date().getTime() >
  3444. this.leadTime * 60 * 1000
  3445. );
  3446. });
  3447. if (obj) {
  3448. this.showDateTime();
  3449. } else {
  3450. this.yyTime = null;
  3451. this.yyDate = new Date();
  3452. console.log(this.isYyInspect);
  3453. }
  3454. } else {
  3455. //转运
  3456. this.yyTimeZy = null;
  3457. this.yyDateZy = new Date();
  3458. }
  3459. }
  3460. //回显时间日期
  3461. showDateTime() {
  3462. //当前时间要大于生效时间
  3463. let isYyInspect = this.filterLinkCheckLis.every((item) => {
  3464. return (
  3465. parse(item.yyTime, 'yyyy-MM-dd HH:mm:ss', new Date()).getTime() - new Date().getTime() >
  3466. this.leadTime * 60 * 1000
  3467. );
  3468. });
  3469. //如果勾选需要预约检查
  3470. if (isYyInspect) {
  3471. //筛选离当前时间最近的
  3472. let timeList = this.filterLinkCheckLis
  3473. .map((item) => parse(item.yyTime, 'yyyy-MM-dd HH:mm:ss', new Date()).getTime())
  3474. .sort();
  3475. this.yyTime = new Date(timeList[0] - this.leadTime * 60 * 1000); //回显预约时间,需要减去生效时间
  3476. this.yyDate = new Date(timeList[0] - this.leadTime * 60 * 1000); //回显预约日期,需要减去生效时间
  3477. this.yyDateChange(this.yyTime);
  3478. } else {
  3479. this.yyTime = null;
  3480. this.yyDate = null;
  3481. }
  3482. }
  3483. // 患者送检检查项目-选择检查项目
  3484. linkCheckLisTrue = false; //是否有已选择(患者)
  3485. isInspectPriority = false; //选择的检查是否紧急(患者)
  3486. filterLinkCheckLis = []; //有预约时间并且选中的
  3487. isInspects = false; //勾选检车的时候是否多个检查多个检查科室
  3488. linkCheckLisChange(e) {
  3489. let flag = false; //检查是否紧急
  3490. let arr = []; //选中的索引
  3491. // 是否检查生成工单允许多个科室,1是,0否
  3492. if (this.currentTasktype.isMoreDept === 0) {
  3493. let arr = e.map((item) => item.execDeptId);
  3494. arr = Array.from(new Set(arr));
  3495. this.isInspects = arr.length > 1;
  3496. }
  3497. this.linkCheckLis.forEach((item, index) => {
  3498. if (e.length) {
  3499. //有选中的检查
  3500. e.forEach((v) => {
  3501. //检查是否有紧急度
  3502. if (v.priority == 1) {
  3503. flag = true;
  3504. }
  3505. //选中的检查设置checked
  3506. if (v.value == item.value) {
  3507. arr.push(index);
  3508. }
  3509. });
  3510. } else {
  3511. item.checked = false;
  3512. }
  3513. });
  3514. this.linkCheckLis.forEach((item, index) => {
  3515. item.checked = arr.includes(index);
  3516. });
  3517. console.log(e, this.linkCheckLis);
  3518. //检查有紧急度,则加急
  3519. if (flag) {
  3520. this.allowUrgent = "1";
  3521. this.urgentReason = "系统根据检查信息,自动进行加急";
  3522. } else {
  3523. this.allowUrgent = "0";
  3524. this.urgentReason = "";
  3525. }
  3526. this.clickYYFlag = false;
  3527. // 有预约时间并且选中的
  3528. this.filterLinkCheckLis = this.linkCheckLis.filter(
  3529. (item) => Boolean(item.yyTime) && item.checked
  3530. );
  3531. //有预约时间并且选中的检查数组不为空,并且预约建单的开关开启
  3532. if (this.filterLinkCheckLis.length && this.appointmentBuildFlag == "1") {
  3533. //当前时间要大于生效时间
  3534. this.isYyInspect = this.filterLinkCheckLis.every((item) => {
  3535. return (
  3536. parse(item.yyTime, 'yyyy-MM-dd HH:mm:ss', new Date()).getTime() - new Date().getTime() >
  3537. this.leadTime * 60 * 1000
  3538. );
  3539. });
  3540. this.allowUrgentChange(this.allowUrgent);
  3541. if (this.allowUrgent == 0) {
  3542. //不加急状态下,回显时间
  3543. this.showDateTime();
  3544. }
  3545. } else {
  3546. //有预约时间并且选中的检查数组为空
  3547. this.isYyInspect = false;
  3548. this.yyTime = null;
  3549. this.yyDate = null;
  3550. }
  3551. this.linkCheckLisTrue = e.length > 0;
  3552. this.isInspectPriority = e.some((item) => item.priority == 1);
  3553. }
  3554. // 是否加急
  3555. allowUrgentChange(e) {
  3556. // this.urgentReasonValidator = (control: FormControl): { [s: string]: boolean } => {
  3557. // if (e == 1) {
  3558. // return { required: true };
  3559. // }
  3560. // };
  3561. if (e == 0) {
  3562. this.patientForm.get("urgentReason")!.clearValidators();
  3563. this.patientForm.get("urgentReason")!.markAsPristine();
  3564. } else {
  3565. this.patientForm.get("urgentReason")!.setValidators(Validators.required);
  3566. this.patientForm.get("urgentReason")!.markAsDirty();
  3567. }
  3568. this.patientForm.get("urgentReason")!.updateValueAndValidity();
  3569. if (this.isYyInspect) {
  3570. this.isYyInspect = e == 0;
  3571. if (!this.isYyInspect) {
  3572. this.yyDate = null;
  3573. this.yyDateZy = null;
  3574. this.yyTime = null;
  3575. this.yyTimeZy = null;
  3576. }
  3577. } else {
  3578. this.yyDate = null;
  3579. this.yyDateZy = null;
  3580. this.yyTime = null;
  3581. this.yyTimeZy = null;
  3582. }
  3583. }
  3584. // 禁用小时
  3585. disabledHours = (): number[] => {
  3586. let now = new Date();
  3587. let nHour = now.getHours();
  3588. let nMinute = now.getMinutes();
  3589. if (nMinute > (60 - this.inspectAndPatientTransportConfig.timeMod)) {
  3590. return range(0, nHour + 1);
  3591. } else {
  3592. return range(0, nHour);
  3593. }
  3594. }
  3595. // 禁用分钟
  3596. disabledMinutes = (hour: number): number[] => {
  3597. let now = new Date();
  3598. let nHour = now.getHours();
  3599. let nMinute = now.getMinutes();
  3600. if (hour === nHour || hour === undefined) {
  3601. return this.integralDivision(0, nMinute, this.inspectAndPatientTransportConfig.timeMod);
  3602. } else {
  3603. return [];
  3604. }
  3605. }
  3606. // start和end之间能被n整除的所有数字集合
  3607. integralDivision(start:number, end:number, n:number): number[]{
  3608. let arr = [];
  3609. for(let i = start; i <= end; i++){
  3610. if(i % n === 0){
  3611. arr.push(i);
  3612. }
  3613. }
  3614. return arr;
  3615. }
  3616. // 快捷一键发起建单
  3617. shortcutMsg; //一键发起信息
  3618. buildMsg: any = {}; //一键发起返回信息
  3619. buildType: string = ""; //快捷建单类型
  3620. historyCustomRemarks = []; //历史快捷输入
  3621. msgId:any;
  3622. // 打开一键发起建单模态框
  3623. newShortcutOrder(msg, type) {
  3624. this.workOrderRemark = "";
  3625. this.customRemarks = [];
  3626. this.historyCustomRemarks = [];
  3627. console.log(msg, type);
  3628. this.buildType = type;
  3629. this.shortcutMsg = msg;
  3630. this.initForm();
  3631. this.buildMsg = {};
  3632. this.msgId = msg.id;
  3633. let postData = {
  3634. taskTypeId: msg.id,
  3635. };
  3636. this.nLoading = true;
  3637. this.mainService
  3638. .postCustom("nurse", "workOrder/buildTrip", postData)
  3639. .subscribe((result) => {
  3640. result.start.start.list.forEach(i=>{
  3641. if(i.inputcode){
  3642. i.inputcode = i.inputcode.toUpperCase()
  3643. if(this.deptDisplay ==2){
  3644. i.deptalias = i.deptalias + '('+i.inputcode+')'
  3645. }else{
  3646. i.dept = i.dept + '('+i.inputcode+')'
  3647. }
  3648. }
  3649. })
  3650. result.end.end.list.forEach(i=>{
  3651. if(i.inputcode){
  3652. i.inputcode = i.inputcode.toUpperCase()
  3653. if(this.deptDisplay ==2){
  3654. i.deptalias = i.deptalias + '('+i.inputcode+')'
  3655. }else{
  3656. i.dept = i.dept + '('+i.inputcode+')'
  3657. }
  3658. }
  3659. })
  3660. this.buildMsg = result;
  3661. if(result.end){
  3662. if(result.end.end.departmentStrategy==202 ||
  3663. result.end.end.departmentStrategy==204 ||
  3664. result.end.end.departmentStrategy==205){
  3665. this.isEndFixedType = true
  3666. }else{
  3667. this.isEndFixedType = false
  3668. }
  3669. }
  3670. if(result.start){
  3671. if(result.start.start.departmentStrategy==202 ||
  3672. result.start.start.departmentStrategy==204 ||
  3673. result.start.start.departmentStrategy==205){
  3674. this.isStartFixedType = true
  3675. }else{
  3676. this.isStartFixedType = false
  3677. }
  3678. }
  3679. if (result.remarksSwitch == 1) {
  3680. if (result.customRemarks === null || result.customRemarks === "") {
  3681. this.customRemarks = [];
  3682. } else {
  3683. this.customRemarks = result.customRemarks.split("$");
  3684. }
  3685. this.workOrderRemarkTips =
  3686. result.remarksPrompts || "请填写工单备注,不超过100个字符";
  3687. let user = JSON.parse(localStorage.getItem("user"));
  3688. this.mainService
  3689. .postCustom("nurse", "workOrder/recentRemarks", {
  3690. deptId: user.user.dept.id,
  3691. taskTypeId: msg.id,
  3692. })
  3693. .subscribe((result1) => {
  3694. this.nLoading = false;
  3695. if (result1.state == 200) {
  3696. this.historyCustomRemarks = result1.data;
  3697. }
  3698. });
  3699. } else {
  3700. this.nLoading = false;
  3701. }
  3702. });
  3703. }
  3704. shortcutForm: FormGroup; //一键发起建单表单
  3705. bxForm: FormGroup; //报修表单
  3706. // 一键建单校验
  3707. // 起点科室校验
  3708. originOfficeShortCutValidator = (
  3709. control: FormControl
  3710. ): { [s: string]: boolean } => {
  3711. if (
  3712. this.shortcutForm &&
  3713. this.shortcutForm.value &&
  3714. !control.value &&
  3715. (this.buildMsg.status == 100013 || this.buildMsg.status == 100015)
  3716. ) {
  3717. return { required: true };
  3718. }
  3719. };
  3720. // 目标科室校验
  3721. targetOfficeShortCutValidator = (
  3722. control: FormControl
  3723. ): { [s: string]: boolean } => {
  3724. if (
  3725. this.shortcutForm &&
  3726. this.shortcutForm.value &&
  3727. !control.value &&
  3728. (this.buildMsg.status == 100014 || this.buildMsg.status == 100015)
  3729. ) {
  3730. return { required: true };
  3731. }
  3732. };
  3733. // 修改工号
  3734. userAccount = null;
  3735. changeAccount(e){
  3736. this.userAccount =this.accountList.find(v => v.id == e);
  3737. }
  3738. // 查看关联业务
  3739. otherBindConfigDto:any = {};
  3740. relationTransModalShow = false; //关联业务弹窗开关
  3741. // 关闭关联业务弹窗
  3742. closeModelRelationTrans(e) {
  3743. this.relationTransModalShow = JSON.parse(e).show;
  3744. }
  3745. // 确定关联业务弹窗
  3746. confirmModelRelationTrans(e) {
  3747. if(JSON.parse(e).otherList.length){
  3748. this.otherDataConfirm(e);
  3749. }else{
  3750. this.message.info('请选择病历!');
  3751. }
  3752. }
  3753. // 一键发起建单保存
  3754. loading5 = false;
  3755. async confirmShortcut(shortcutForm?, buildType?) {
  3756. shortcutForm && (this.shortcutForm = shortcutForm);
  3757. var that = this;
  3758. for (const i in that.shortcutForm.controls) {
  3759. that.shortcutForm.controls[i].markAsDirty();
  3760. that.shortcutForm.controls[i].updateValueAndValidity();
  3761. }
  3762. console.log(that.shortcutForm);
  3763. if (that.shortcutForm.invalid) return;
  3764. that.loading5 = true;
  3765. that.buildType = buildType || "other";
  3766. if(this.buildMsg.reserveUserSwitch == 1 && !this.userAccount){
  3767. this.message.info('请选择工号!');
  3768. this.loading5 = false;
  3769. return;
  3770. }
  3771. // 判断改任务类型是否开启关联数据
  3772. let taskTypeDtoPromise = await this.mainService.getFetchDataList('simple/data', 'otherBindConfig', {"idx":0,"sum":10,"otherBindConfig":{"hosId":1}}).toPromise();
  3773. console.log(taskTypeDtoPromise);
  3774. console.log(that.shortcutMsg);
  3775. let otherBindConfigDto = taskTypeDtoPromise.list.find(v => v.taskTypeId == that.shortcutMsg.id);
  3776. if(taskTypeDtoPromise.status == 200 && otherBindConfigDto && otherBindConfigDto.startAlert == 1 && that.shortcutMsg.bindTrans == 1){
  3777. this.otherBindConfigDto = otherBindConfigDto;
  3778. this.relationTransModalShow = true;
  3779. that.loading5 = false;
  3780. return;
  3781. }
  3782. shortcutForm && (this.isShowBuildQuickConfirm = false);
  3783. this.otherBuildOrder(undefined, buildType);
  3784. }
  3785. otherBuildOrder(otherList?,buildType?){
  3786. var that = this;
  3787. // 其他
  3788. let workOrderRemark = '';
  3789. if(otherList){
  3790. workOrderRemark = this.userAccount ? `${this.userAccount.account}-${this.userAccount.name}:${this.workOrderRemark}共${otherList.length}本${this.otherBindConfigDto.relationTrans.name}` : this.workOrderRemark + `共${otherList.length}本${this.otherBindConfigDto.relationTrans.name}`;
  3791. }else{
  3792. workOrderRemark = this.userAccount ? `${this.userAccount.account}-${this.userAccount.name}:${this.workOrderRemark}` : this.workOrderRemark;
  3793. }
  3794. let postData = {
  3795. workOrder: {
  3796. sourceId: SourceId.hushi,
  3797. workOrderRemark,
  3798. taskType: { id: that.shortcutMsg.id },
  3799. createDept: that.loginUserDeptId,
  3800. startDept: { id: that.buildMsg.startDept },
  3801. endDepts: [{ id: that.buildMsg.endDept }],
  3802. otherList: otherList || undefined,
  3803. },
  3804. };
  3805. if (
  3806. (that.buildMsg.status == 100013 || that.buildMsg.status == 100015) &&
  3807. that.shortcutForm.value.originOffice
  3808. ) {
  3809. postData.workOrder.startDept.id = that.shortcutForm.value.originOffice;
  3810. }
  3811. if (that.shortcutForm.value.targetOffice) {
  3812. postData.workOrder["endDepts"] = [
  3813. { id: that.shortcutForm.value.targetOffice },
  3814. ];
  3815. } else {
  3816. postData.workOrder["endDepts"] = [
  3817. { id: that.buildMsg.end.end.list[0].id },
  3818. ];
  3819. }
  3820. console.log(postData);
  3821. this.newOrderTimeFun(postData.workOrder, () => {
  3822. that.loading5 = false;
  3823. }, () => {
  3824. that.mainService
  3825. .postCustom("api", this.shortcutMsg.reserveSwitch == 1 && this.currentDept.typeValue != 'recovery' && this.currentDept.typeValue != 'surgery' ? "reserveOrder" :"startOrder", postData)
  3826. .subscribe((data) => {
  3827. this.message.remove(this.jdFlagId);
  3828. that.loading5 = false;
  3829. if (data.status == 200 && (that.buildType == "other" || that.buildType == "ordinary")) {
  3830. that.showPromptModal("创建", true, "", that.buildType);
  3831. this.getTodayNum();
  3832. } else if (data.status == 200 && that.buildType == "bb") {
  3833. that.showPromptModal("创建", true, "", "bb");
  3834. this.getTodayNum();
  3835. } else if (that.buildType == "bb" && data.status == 100043) {
  3836. that.showPromptModal("创建", true, data.msg);
  3837. this.getTodayNum();
  3838. } else if (data.status == 1000033) {
  3839. //重复建单那策略
  3840. this.repeatMsg = data.msg;
  3841. this.showDelModal(postData, that.buildType);
  3842. } else {
  3843. that.showPromptModal("创建", false, data.msg);
  3844. }
  3845. // 重置
  3846. this.getDeptTaskType();
  3847. });
  3848. })
  3849. }
  3850. // ======================start===============================
  3851. // 快捷一键发起建单
  3852. shortcutModal: boolean = false; //检查信息一键建单模态框
  3853. shortcutMsg1; //一键发起信息
  3854. buildMsg1: any = {}; //一键发起返回信息
  3855. urgentFlag = false;
  3856. bLoading = false; //收取标本的loading
  3857. // 打开一键发起建单模态框,urgent为true的时候是紧急
  3858. historyCustomRemarks1 = [];
  3859. newShortcutOrder1(msg, type, urgent?) {
  3860. this.btnLoading = false;
  3861. this.workOrderRemark1 = "";
  3862. this.customRemarks1 = [];
  3863. this.historyCustomRemarks1 = [];
  3864. console.log(msg, type);
  3865. this.urgentFlag = Boolean(urgent);
  3866. this.buildType = type;
  3867. this.shortcutMsg1 = msg;
  3868. this.initForm();
  3869. this.buildMsg1 = {};
  3870. let postData = {
  3871. taskTypeId: msg.id,
  3872. deptId: JSON.parse(localStorage.getItem("user")).user.dept.id,
  3873. };
  3874. this.bLoading = true;
  3875. this.mainService
  3876. .postCustom("nurse", "workOrder/buildTrip", postData)
  3877. .subscribe((result) => {
  3878. this.shortcutModal = true;
  3879. this.buildMsg1 = result;
  3880. if (result.remarksSwitch == 1) {
  3881. if (result.customRemarks === null || result.customRemarks === "") {
  3882. this.customRemarks1 = [];
  3883. } else {
  3884. this.customRemarks1 = result.customRemarks.split("$");
  3885. }
  3886. this.workOrderRemarkTips1 =
  3887. result.remarksPrompts || "请填写工单备注,不超过100个字符";
  3888. let user = JSON.parse(localStorage.getItem("user"));
  3889. this.mainService
  3890. .postCustom("nurse", "workOrder/recentRemarks", {
  3891. deptId: user.user.dept.id,
  3892. taskTypeId: msg.id,
  3893. })
  3894. .subscribe((result1) => {
  3895. this.bLoading = false;
  3896. if (result1.state == 200) {
  3897. this.historyCustomRemarks1 = result1.data;
  3898. }
  3899. });
  3900. } else {
  3901. this.bLoading = false;
  3902. }
  3903. });
  3904. }
  3905. hideShortcutOrder() {
  3906. this.shortcutModal = false;
  3907. }
  3908. shortcutForm1: FormGroup; //一键发起建单表单
  3909. // 一键建单校验
  3910. // 起点科室校验
  3911. originOfficeShortCutValidator1 = (
  3912. control: FormControl
  3913. ): { [s: string]: boolean } => {
  3914. if (
  3915. this.shortcutForm1 &&
  3916. this.shortcutForm1.value &&
  3917. !control.value &&
  3918. (this.buildMsg1.status == 100013 || this.buildMsg1.status == 100015)
  3919. ) {
  3920. return { required: true };
  3921. }
  3922. };
  3923. // 目标科室校验
  3924. targetOfficeShortCutValidator1 = (
  3925. control: FormControl
  3926. ): { [s: string]: boolean } => {
  3927. if (
  3928. this.shortcutForm1 &&
  3929. this.shortcutForm1.value &&
  3930. !control.value &&
  3931. (this.buildMsg1.status == 100014 || this.buildMsg1.status == 100015)
  3932. ) {
  3933. return { required: true };
  3934. }
  3935. };
  3936. // 建单判断时间-护士端建单通用方法
  3937. isShowConfirm:boolean = true;
  3938. isShowConfirmInfo:string = '';
  3939. newOrderTimeFun(order, fun1, fun2){
  3940. if(this.currentDept.typeValue != 'recovery' && this.currentDept.typeValue != 'surgery'){
  3941. let taskTypeId = order.taskType.id;
  3942. let deptId = order.createDept;
  3943. let maskFlag = this.message.loading("正在加载中..", {
  3944. nzDuration: 0,
  3945. }).messageId;
  3946. this.mainService
  3947. .postCustom("api", "compareWorkTime", {taskTypeId, deptId, yyTime: order.yyTime})
  3948. .subscribe((data) => {
  3949. this.message.remove(maskFlag);
  3950. if(data.state == 200){
  3951. fun2.call(this);
  3952. }else{
  3953. fun1.call(this);
  3954. this.limitTimeModal = true;
  3955. this.limitTimeItem = {taskTypeId, fun1, fun2};
  3956. this.limitTimeInfo = data.data.remark;
  3957. this.isShowConfirm = data.data.limitType == 1;
  3958. if(this.isShowConfirm || data.data.limitNum == 1){
  3959. this.isShowConfirmInfo = '';
  3960. }else{
  3961. this.isShowConfirmInfo = '请在规定时间内下单';
  3962. }
  3963. }
  3964. })
  3965. }else{
  3966. fun2.call(this);
  3967. }
  3968. }
  3969. limitTimeModal: boolean = false; //模态框
  3970. limitTimeInfo:string = '';
  3971. limitTimeItem: any = {};
  3972. hideLimitTimeModal() {
  3973. this.limitTimeModal = false;
  3974. }
  3975. // 确认
  3976. jdFlagId;
  3977. limitTimeLoading:boolean = false;
  3978. confirmLimitTime() {
  3979. console.log(this.limitTimeItem);
  3980. this.limitTimeModal = false;
  3981. this.jdFlagId = this.message.loading("正在加载中..", {
  3982. nzDuration: 0,
  3983. }).messageId;
  3984. this.limitTimeItem.fun2.call(this);
  3985. }
  3986. // 一键发起建单保存
  3987. confirmShortcut1(shortcutForm?) {
  3988. shortcutForm && (this.shortcutForm1 = shortcutForm);
  3989. var that = this;
  3990. for (const i in that.shortcutForm1.controls) {
  3991. that.shortcutForm1.controls[i].markAsDirty();
  3992. that.shortcutForm1.controls[i].updateValueAndValidity();
  3993. }
  3994. console.log(that.shortcutForm1);
  3995. if (that.shortcutForm1.invalid) return;
  3996. shortcutForm && (this.isShowBuildQuickConfirm = false);
  3997. that.btnLoading = true;
  3998. let postData;
  3999. if (that.buildType == "bb") {
  4000. // 标本
  4001. postData = {
  4002. urgent: this.urgentFlag ? 1 : 0,
  4003. workOrder: {
  4004. sourceId: SourceId.hushi,
  4005. workOrderRemark: this.workOrderRemark1,
  4006. taskType: { id: that.shortcutMsg1.id },
  4007. createDept: that.loginUserDeptId,
  4008. startDept: { id: that.loginUserDeptId },
  4009. },
  4010. };
  4011. }
  4012. console.log(postData);
  4013. this.newOrderTimeFun(postData.workOrder, () => {
  4014. this.hideShortcutOrder();
  4015. }, () => {
  4016. that.mainService
  4017. .postCustom("api", "startOrder", postData)
  4018. .subscribe((data) => {
  4019. this.message.remove(this.jdFlagId);
  4020. this.hideShortcutOrder();
  4021. console.log(that.buildType, data.status);
  4022. if (data.status == 200 && that.buildType == "other") {
  4023. that.showPromptModal("创建", true, "", "other");
  4024. this.getTodayNum();
  4025. } else if (data.status == 200 && that.buildType == "bb") {
  4026. that.showPromptModal("创建", true, "", "bb");
  4027. this.getTodayNum();
  4028. } else if (that.buildType == "bb" && data.status == 100043) {
  4029. that.showPromptModal("创建", true, data.msg);
  4030. this.getOrderList();
  4031. this.getSpecimenWorkOrderMsg();
  4032. this.getTodayNum();
  4033. } else if (data.status == 1000033) {
  4034. //重复建单那策略
  4035. this.repeatMsg = data.msg;
  4036. this.showDelModal(postData, "specimen");
  4037. } else {
  4038. that.showPromptModal("创建", false, data.msg);
  4039. }
  4040. });
  4041. });
  4042. }
  4043. repeatModal: boolean = false; //删除模态框
  4044. repeatMsg = "";
  4045. loadingRepeat = false;
  4046. repeatPostData;
  4047. sourceType;
  4048. isYuyue;
  4049. showDelModal(postData, sourceType, yuyue?) {
  4050. this.repeatModal = true;
  4051. this.repeatPostData = postData;
  4052. this.sourceType = sourceType;
  4053. this.isYuyue = yuyue ? yuyue : false;
  4054. }
  4055. hideRepeatModal() {
  4056. this.repeatModal = false;
  4057. this.btnLoading = false;
  4058. }
  4059. confirmRepeat() {
  4060. this.loadingRepeat = true;
  4061. this.repeatPostData.tipsCreateOder = 1;
  4062. this.newOrderTimeFun(this.repeatPostData.workOrder, () => {
  4063. this.loadingRepeat = false;
  4064. this.repeatModal = false;
  4065. }, () => {
  4066. this.mainService
  4067. .postCustom(
  4068. "api",
  4069. this.isYuyue ? "appointmentOrder" : "startOrder",
  4070. this.repeatPostData
  4071. )
  4072. .subscribe((data) => {
  4073. this.message.remove(this.jdFlagId);
  4074. this.loadingRepeat = false;
  4075. this.repeatModal = false;
  4076. if(this.currentDept.typeValue == 'recovery'){
  4077. this.mainService.postCustom("api", "clearPatientRecoveryDept", {patientCode: this.repeatPostData.workOrder.patient.patientCode}).subscribe((resultData) => {
  4078. this.confirmRepeatFun(data);
  4079. });
  4080. }else{
  4081. this.confirmRepeatFun(data);
  4082. }
  4083. });
  4084. })
  4085. }
  4086. confirmRepeatFun(data){
  4087. if (this.sourceType === "specimen") {
  4088. // 标本建单
  4089. if (data.status == 200 && (this.buildType == "other" || this.buildType == "ordinary")) {
  4090. this.showPromptModal("创建", true, "", this.buildType);
  4091. this.getTodayNum();
  4092. } else if (data.status == 200 && this.buildType == "bb") {
  4093. this.showPromptModal("创建", true, "", "bb");
  4094. this.getTodayNum();
  4095. } else if (this.buildType == "bb" && data.status == 100043) {
  4096. this.showPromptModal("创建", true, data.msg);
  4097. this.getOrderList();
  4098. this.getSpecimenWorkOrderMsg();
  4099. this.getTodayNum();
  4100. } else {
  4101. this.showPromptModal("创建", false, data.msg);
  4102. }
  4103. } else if (this.sourceType === "other" || this.sourceType === "ordinary") {
  4104. // 其他建单
  4105. if (data.status == 200 && (this.buildType == "other" || this.buildType == "ordinary")) {
  4106. this.showPromptModal("创建", true, "", this.buildType);
  4107. this.getTodayNum();
  4108. } else if (data.status == 200 && this.buildType == "bb") {
  4109. this.showPromptModal("创建", true, "", "bb");
  4110. this.getTodayNum();
  4111. } else if (this.buildType == "bb" && data.status == 100043) {
  4112. this.showPromptModal("创建", true, data.msg);
  4113. this.getTodayNum();
  4114. } else {
  4115. this.showPromptModal("创建", false, data.msg);
  4116. }
  4117. } else if (this.sourceType === "transport") {
  4118. // 转运
  4119. if (data.status == 200) {
  4120. this.showPromptModal("创建", true, "");
  4121. this.goodsLis = [];
  4122. // this.workOrderInspectScore = undefined;
  4123. this.getOrderList();
  4124. this.getDeptTaskType();
  4125. this.getTodayNum();
  4126. } else if (data.status == 100042) {
  4127. this.showPromptModal("创建", false, data.msg);
  4128. this.getPatient(this.tabSearchCont);
  4129. } else {
  4130. this.showPromptModal("创建", false, data.msg);
  4131. }
  4132. } else if (this.sourceType === "accompany1") {
  4133. // 陪检
  4134. if (data.status == 200) {
  4135. this.showPromptModal("创建", true, "");
  4136. this.goodsLis = [];
  4137. // this.workOrderInspectScore = undefined;
  4138. this.getOrderList();
  4139. this.getDeptTaskType();
  4140. this.getTodayNum();
  4141. } else if (data.status == 100042) {
  4142. this.showPromptModal("创建", false, data.msg);
  4143. this.getPatient(this.tabSearchCont);
  4144. } else {
  4145. this.showPromptModal("创建", false, data.msg);
  4146. }
  4147. } else if (this.sourceType === "accompany2") {
  4148. // 陪检
  4149. if (data.status == 200) {
  4150. this.showPromptModal("创建", true, "");
  4151. this.goodsLis = [];
  4152. // this.workOrderInspectScore = undefined;
  4153. this.getOrderList();
  4154. this.getDeptTaskType();
  4155. this.getTodayNum();
  4156. } else if (data.status == 100042) {
  4157. this.showPromptModal("创建", false, data.msg);
  4158. this.getPatient(this.tabSearchCont);
  4159. } else {
  4160. this.showPromptModal("创建", false, data.msg);
  4161. }
  4162. } else if (this.sourceType === "accompany3") {
  4163. // 陪检
  4164. if (data.status == 200) {
  4165. this.showPromptModal("创建", true, "");
  4166. this.goodsLis = [];
  4167. // this.workOrderInspectScore = undefined;
  4168. this.getOrderList();
  4169. this.getDeptTaskType();
  4170. this.getTodayNum();
  4171. } else if (data.status == 100042) {
  4172. this.showPromptModal("创建", false, data.msg);
  4173. this.getPatient(this.tabSearchCont);
  4174. } else {
  4175. this.showPromptModal("创建", false, data.msg);
  4176. }
  4177. } else if (this.sourceType === "accompany4") {
  4178. // 陪检
  4179. if (data.status == 200) {
  4180. this.showPromptModal("创建", true, "");
  4181. this.goodsLis = [];
  4182. // this.workOrderInspectScore = undefined;
  4183. this.getOrderList();
  4184. this.getDeptTaskType();
  4185. this.getTodayNum();
  4186. } else if (data.status == 100042) {
  4187. this.showPromptModal("创建", false, data.msg);
  4188. this.getPatient(this.tabSearchCont);
  4189. } else {
  4190. this.showPromptModal("创建", false, data.msg);
  4191. }
  4192. } else if (this.sourceType === "accompany5") {
  4193. // 陪检
  4194. if (data.status == 200) {
  4195. this.showPromptModal("创建", true, "");
  4196. this.goodsLis = [];
  4197. // this.workOrderInspectScore = undefined;
  4198. this.getOrderList();
  4199. this.getDeptTaskType();
  4200. this.getTodayNum();
  4201. } else if (data.status == 100042) {
  4202. this.showPromptModal("创建", false, data.msg);
  4203. this.getPatient(this.tabSearchCont);
  4204. } else {
  4205. this.showPromptModal("创建", false, data.msg);
  4206. }
  4207. }
  4208. }
  4209. // =======================end=================================
  4210. // 页面中间部分tab切换
  4211. checkedTableType: string = "";
  4212. checkTable(type) {
  4213. if(typeof type === 'object'){
  4214. if(type.system){
  4215. this.checkedTableType = 'other';
  4216. }else{
  4217. this.checkedTableType = type.id;
  4218. }
  4219. this.getDeptTaskType('');
  4220. }else{
  4221. this.checkedTableType = type;
  4222. }
  4223. this.positionY = 0;
  4224. this.selectOtherId = null;
  4225. this.otherSearch = '';
  4226. if (type === "surgery") {
  4227. this.getSurgery(true);
  4228. } else if (type === "outpatientHelpAppointment") {
  4229. this.getOutpatientHelpAppointment(true);
  4230. } else if (type === "historySpecimen") {
  4231. this.getHistorySpecimen(true);
  4232. } else if (type === "historyDrugsbag") {
  4233. this.getHistoryDrugsbag(true);
  4234. } else if (type === "bxlb" && this.isShowBx && this.coopBtns.repairList) {
  4235. this.getBxlb(this.bxlbPageIndex);
  4236. // this.getIncidentState();
  4237. this.getDegrees();
  4238. }
  4239. }
  4240. //提交报修
  4241. bxLoading = false;
  4242. submitBxForm() {
  4243. for (const i in this.bxForm.controls) {
  4244. this.bxForm.controls[i].markAsDirty();
  4245. this.bxForm.controls[i].updateValueAndValidity();
  4246. }
  4247. if (this.bxForm.invalid) return;
  4248. // if(!this.selectIncidentId){
  4249. // this.message.error("请选择故障现象!");
  4250. // return;
  4251. // }
  4252. this.bxLoading = true;
  4253. this.mainService.wxbx({}).subscribe((result) => {
  4254. if ((result as any).status == 200) {
  4255. let bxcode = (result as any).data; //生成微信报修号
  4256. let postData = {
  4257. verification: "true",
  4258. incident: {
  4259. branch:this.loginUser.currentHospital.id,
  4260. // contacts: this.loginUser.name,
  4261. deptId:this.loginUser.dept.id,
  4262. // contactsInformation: this.loginUser.phone,
  4263. // address: this.bxForm.controls.address.value,
  4264. // areaId: this.bxForm.controls.hospital.value,
  4265. // contacts: this.bxForm.controls.name.value,
  4266. // contactsInformation: this.bxForm.controls.phone.value,
  4267. description: this.bxForm.controls.content.value,
  4268. categoryId: this.selectIncidentId,
  4269. // placeId: this.bxForm.controls.building.value,
  4270. requester: { account: this.loginUser.account },
  4271. sourceType: "wechatUserIncident",
  4272. fileUrl: "url",
  4273. bxcode,
  4274. },
  4275. loginUser: {
  4276. account: this.loginUser.account,
  4277. id: this.loginUser.id,
  4278. },
  4279. };
  4280. this.mainService.addWxIncident(postData).subscribe((res) => {
  4281. this.bxLoading = false;
  4282. if ((res as any).state == 200) {
  4283. this.showPromptModal("提交", true, "");
  4284. this.checkTable("bxlb");
  4285. } else {
  4286. this.showPromptModal("提交", false, (res as any).msg);
  4287. }
  4288. });
  4289. } else {
  4290. this.bxLoading = false;
  4291. this.showPromptModal("提交", false, "");
  4292. }
  4293. });
  4294. }
  4295. // 意见箱表格数据
  4296. adviceList: any = [];
  4297. advicePageIndex: number = 1; //表格当前页码
  4298. advicePageSize: number = 10; //表格每页展示条数
  4299. adviceListLength: number = 10; //表格总数据量
  4300. adviceSearchInp: string = ""; //意见箱搜索
  4301. adviceLoading = false;
  4302. getAdvice(idx?) {
  4303. if(!this.coopBtns.suggestionBox){
  4304. return;
  4305. }
  4306. if(idx){
  4307. this.advicePageIndex = 1;
  4308. }
  4309. let that = this;
  4310. let postData = {
  4311. advice: {
  4312. content: that.adviceSearchInp || "",
  4313. creatDepartment: {
  4314. id: that.loginUserDeptId,
  4315. },
  4316. createUser: {
  4317. id: that.loginUser.id,
  4318. },
  4319. },
  4320. idx: that.advicePageIndex - 1,
  4321. sum: that.advicePageSize,
  4322. };
  4323. this.adviceLoading = true;
  4324. that.mainService
  4325. .getFetchDataList("adviceCollection", "advice", postData)
  4326. .subscribe((data) => {
  4327. this.adviceLoading = false;
  4328. that.adviceList = data.list || [];
  4329. that.adviceListLength = data.totalNum || 0;
  4330. });
  4331. }
  4332. startDate:any = format(startOfDay(new Date()), "yyyy-MM-dd HH:mm:ss");
  4333. endDate:any = format(endOfDay(new Date()), "yyyy-MM-dd HH:mm:ss");
  4334. scheduleTime: any = format(startOfDay(new Date()), "yyyy-MM-dd HH:mm:ss");
  4335. changeDate(result){
  4336. if(result){
  4337. this.startDate = format(result, 'yyyy-MM-dd') +' '+ '00:00:00';
  4338. this.endDate = format(result, 'yyyy-MM-dd') +' '+'23:59:59';
  4339. }else{
  4340. this.startDate = null
  4341. this.endDate = null
  4342. }
  4343. }
  4344. // 手术排程信息表格数据
  4345. surgeryList: any = [];
  4346. surgeryPageIndex: number = 1; //表格当前页码
  4347. surgeryPageSize: number = 10; //表格每页展示条数
  4348. surgeryListLength: number = 10; //表格总数据量
  4349. surgeryCodeSearchInp: string = ""; //标本编码搜索
  4350. surgeryParentSearchInp: string = ""; //患者信息搜索
  4351. surgeryInfoLoading = false;
  4352. getSurgery(idx?) {
  4353. if (idx) {
  4354. this.surgeryPageIndex = 1;
  4355. }
  4356. let postData:any = {
  4357. surgery: {
  4358. applyDateStart: this.startDate,
  4359. applyDateEnd: this.endDate,
  4360. // hosId: this.currentHospital.id,
  4361. },
  4362. idx: this.surgeryPageIndex - 1,
  4363. sum: this.surgeryPageSize,
  4364. };
  4365. if(this.currentDept.typeValue == 'surgery'){
  4366. postData.surgery.surgeryDept = this.loginUserDeptId;
  4367. }else{
  4368. postData.surgery.areaDept = this.loginUserDeptId;
  4369. }
  4370. this.surgeryInfoLoading = true;
  4371. this.mainService
  4372. .getFetchDataList("simple/data", "surgery", postData)
  4373. .subscribe((data) => {
  4374. this.surgeryInfoLoading = false;
  4375. this.surgeryList = data.list || [];
  4376. this.surgeryListLength = data.totalNum || 0;
  4377. });
  4378. }
  4379. // 门诊帮扶表格数据
  4380. outpatientHelpAppointmentList: any = [];
  4381. outpatientHelpAppointmentPageIndex: number = 1; //表格当前页码
  4382. outpatientHelpAppointmentPageSize: number = 10; //表格每页展示条数
  4383. outpatientHelpAppointmentListLength: number = 10; //表格总数据量
  4384. outpatientHelpAppointmentDateSearchInp = new Date(); //预约时间搜索
  4385. outpatientHelpAppointmentInfoLoading = false;
  4386. getOutpatientHelpAppointment(idx?) {
  4387. if (idx) {
  4388. this.outpatientHelpAppointmentPageIndex = 1;
  4389. }
  4390. let postData:any = {
  4391. patientAppointment: {
  4392. escortTime: this.outpatientHelpAppointmentDateSearchInp ? format(startOfDay(this.outpatientHelpAppointmentDateSearchInp), "yyyy-MM-dd HH:mm:ss") : undefined,
  4393. hosId: this.currentHospital.id,
  4394. },
  4395. idx: this.outpatientHelpAppointmentPageIndex - 1,
  4396. sum: this.outpatientHelpAppointmentPageSize,
  4397. };
  4398. this.outpatientHelpAppointmentInfoLoading = true;
  4399. this.mainService
  4400. .getFetchDataList("simple/data", "patientAppointment", postData)
  4401. .subscribe((data) => {
  4402. this.outpatientHelpAppointmentInfoLoading = false;
  4403. this.outpatientHelpAppointmentList = data.list || [];
  4404. this.outpatientHelpAppointmentListLength = data.totalNum || 0;
  4405. });
  4406. }
  4407. // 历史标本查询表格数据
  4408. historySpecimenList: any = [];
  4409. historySpecimenPageIndex: number = 1; //表格当前页码
  4410. historySpecimenPageSize: number = 10; //表格每页展示条数
  4411. historySpecimenListLength: number = 10; //表格总数据量
  4412. historySpecimenCodeSearchInp: string = ""; //标本编码搜索
  4413. historySpecimenParentSearchInp: string = ""; //患者信息搜索
  4414. hsLoading = false;
  4415. getHistorySpecimen(idx?) {
  4416. if (idx) {
  4417. this.historySpecimenPageIndex = 1;
  4418. }
  4419. let current = JSON.parse(localStorage.getItem("user"));
  4420. let postData = {
  4421. specimen: {
  4422. hosId: this.currentHospital.id,
  4423. sickRoom: {
  4424. id: current.user.dept.id,
  4425. },
  4426. scode:
  4427. this.historySpecimenCodeSearchInp === ""
  4428. ? null
  4429. : this.historySpecimenCodeSearchInp,
  4430. keyWord:
  4431. this.historySpecimenParentSearchInp === ""
  4432. ? null
  4433. : this.historySpecimenParentSearchInp,
  4434. },
  4435. idx: this.historySpecimenPageIndex - 1,
  4436. sum: this.historySpecimenPageSize,
  4437. };
  4438. this.hsLoading = true;
  4439. this.mainService
  4440. .getFetchDataList("simple/data", "specimen", postData)
  4441. .subscribe((data) => {
  4442. this.hsLoading = false;
  4443. this.historySpecimenList = data.list || [];
  4444. this.historySpecimenListLength = data.totalNum || 0;
  4445. });
  4446. }
  4447. // 历史药单查询表格数据
  4448. historyDrugsbagList: any = [];
  4449. historyDrugsbagPageIndex: number = 1; //表格当前页码
  4450. historyDrugsbagPageSize: number = 10; //表格每页展示条数
  4451. historyDrugsbagListLength: number = 10; //表格总数据量
  4452. historyDrugsbagCodeSearchInp: string = ""; //发药单号搜索
  4453. // historyDrugsbagParentSearchInp: string = ""; //患者信息搜索
  4454. hsDLoading = false;
  4455. getHistoryDrugsbag(idx?) {
  4456. if (idx) {
  4457. this.historyDrugsbagPageIndex = 1;
  4458. }
  4459. let current = JSON.parse(localStorage.getItem("user"));
  4460. let postData = {
  4461. drugsBag: {
  4462. target: {
  4463. id: current.user.dept.id,
  4464. },
  4465. packid:
  4466. this.historyDrugsbagCodeSearchInp === ""
  4467. ? ""
  4468. : this.historyDrugsbagCodeSearchInp,
  4469. platform: 2,
  4470. },
  4471. idx: this.historyDrugsbagPageIndex - 1,
  4472. sum: this.historyDrugsbagPageSize,
  4473. };
  4474. this.hsDLoading = true;
  4475. this.mainService
  4476. .getFetchDataList("api", "drugsBag", postData)
  4477. .subscribe((data) => {
  4478. this.hsDLoading = false;
  4479. this.historyDrugsbagList = data.list || [];
  4480. this.historyDrugsbagListLength = data.totalNum || 0;
  4481. });
  4482. }
  4483. // 获取事件状态
  4484. incidentStateId = undefined;
  4485. incidentStateList = [
  4486. {name: '全部', value: 0},
  4487. {name: '待受理', value: 'accept,storage'},
  4488. {name: '处理中', value: 'pending,handler,reassign'},
  4489. {name: '待评价', value: 'close0', hasWxdegree: 0},
  4490. {name: '已关闭', value: 'close1', hasWxdegree: 1},
  4491. {name: '不受理', value: 'reject'},
  4492. {name: '撤销', value: 'cancel'},
  4493. ];
  4494. // getIncidentState() {
  4495. // let postData = { type: "list", key: "wxincident_state" };
  4496. // this.iLoading = true;
  4497. // this.mainService.getDictionaryByITSM(postData).subscribe((data: any) => {
  4498. // this.iLoading = false;
  4499. // if (data.status == 200) {
  4500. // this.incidentStateList = data.data || [];
  4501. // }
  4502. // });
  4503. // }
  4504. // 报修列表查询表格数据
  4505. bxlbList: any = [];
  4506. bxlbPageIndex: number = 1; //表格当前页码
  4507. bxlbPageSize: number = 10; //表格每页展示条数
  4508. bxlbListLength: number = 10; //表格总数据量
  4509. bxlbCodeSearchInp: string = ""; //标本编码搜索
  4510. bxlbParentSearchInp: string = ""; //患者信息搜索
  4511. processing: number = 0; //处理中的数量
  4512. bxlbLoading = false;
  4513. repairIncidentTypeList = [];//科室报修或公共报修
  4514. getBxlb(idx, isInitState = false) {
  4515. // 获取事件状态
  4516. this.iLoading = true;
  4517. this.bxlbLoading = true;
  4518. this.mainService.getDictionary('list', 'repair_incident_type').subscribe((data: any) => {
  4519. this.iLoading = false;
  4520. this.repairIncidentTypeList = data || [];
  4521. if(isInitState){
  4522. let valueObj2 = this.incidentStateList.find(v => v.value == 0);
  4523. this.incidentStateId = valueObj2 ? valueObj2.value : undefined;
  4524. }
  4525. // 报修列表查询表格数据
  4526. if (idx) {
  4527. this.bxlbPageIndex = 1;
  4528. }
  4529. let current = JSON.parse(localStorage.getItem("user"));
  4530. this.mainService
  4531. .getFetchDataList("simple/data", "incident", {
  4532. idx: this.bxlbPageIndex - 1,
  4533. sum: this.bxlbPageSize,
  4534. incident: {
  4535. repairIncidentType: { id: this.repairIncidentTypeList.find(v => v.value === 'dept').id },
  4536. statesValues: this.incidentStateId || undefined,
  4537. department: { id: current.user.dept.id },
  4538. }
  4539. })
  4540. .subscribe((data: any) => {
  4541. this.bxlbLoading = false;
  4542. this.bxlbList = data.list || [];
  4543. this.bxlbListLength = data.totalNum || 0;
  4544. this.processing = data.totalNum || 0;
  4545. });
  4546. })
  4547. }
  4548. //快速报修列表
  4549. quickBxlbLoading = false;
  4550. quickBxlbList = [];
  4551. getQuickBxlb() {
  4552. this.quickBxlbLoading = true;
  4553. this.mainService
  4554. .getFetchDataList("simple/data", "incidentCategoryContent", { idx: 0, sum: 10 })
  4555. .subscribe((data: any) => {
  4556. this.quickBxlbLoading = false;
  4557. if (data.status == 200) {
  4558. this.quickBxlbList = data.list || [];
  4559. }
  4560. });
  4561. }
  4562. // 意见箱-查看模态框
  4563. adviceModal: boolean = false;
  4564. adviceDetailInfo: any = {}; //意见详情
  4565. adviceDetail(id) {
  4566. this.adviceModal = true;
  4567. this.mainService
  4568. .getFetchData("adviceCollection", "advice", id)
  4569. .subscribe((data) => {
  4570. this.adviceDetailInfo = data.data;
  4571. console.log(this.adviceDetailInfo);
  4572. });
  4573. }
  4574. hideAdvice() {
  4575. this.adviceModal = false;
  4576. }
  4577. // 意见收集
  4578. adviceSubModal: boolean = false;
  4579. adviceSubContent: string; //填写意见内容
  4580. coopAdviceInfo: any = {}; //当前编辑意见详情
  4581. addAdvice(data?) {
  4582. let that = this;
  4583. that.adviceSubContent = "";
  4584. if (data) {
  4585. that.coopAdviceInfo = data;
  4586. that.adviceSubContent = data.content;
  4587. }
  4588. that.adviceSubModal = true;
  4589. }
  4590. hideSubAdvice() {
  4591. this.adviceSubModal = false;
  4592. }
  4593. // 提交意见内容
  4594. confirmSubAdvice() {
  4595. let that = this;
  4596. if (!that.adviceSubContent) return;
  4597. that.btnLoading = true;
  4598. let postData = {
  4599. advice: {
  4600. creatDepartment: {
  4601. id: that.loginUserDeptId,
  4602. },
  4603. createUser: {
  4604. id: that.loginUser.id,
  4605. },
  4606. content: that.adviceSubContent,
  4607. },
  4608. };
  4609. if (that.coopAdviceInfo.id) {
  4610. postData.advice["id"] = that.coopAdviceInfo.id;
  4611. }
  4612. that.mainService
  4613. .postCustom(
  4614. "adviceCollection",
  4615. that.coopAdviceInfo.id ? "updData/advice" : "addData/advice",
  4616. postData
  4617. )
  4618. .subscribe((data) => {
  4619. if (data.status == 200) {
  4620. that.adviceSubModal = false;
  4621. that.showPromptModal(
  4622. that.coopAdviceInfo.id ? "编辑" : "新增",
  4623. true,
  4624. ""
  4625. );
  4626. that.coopAdviceInfo = {};
  4627. that.adviceSubContent = "";
  4628. that.getAdvice();
  4629. } else {
  4630. that.adviceSubModal = false;
  4631. that.showPromptModal(
  4632. that.coopAdviceInfo.id ? "编辑" : "新增",
  4633. false,
  4634. data.msg
  4635. );
  4636. that.adviceSubContent = "";
  4637. }
  4638. });
  4639. }
  4640. // 查看标本详情
  4641. detailModel: boolean = false;
  4642. loading33: boolean = false;
  4643. detailList: any = [];
  4644. // 选择急查或普查(1是急标,0是普标)
  4645. changeSpeDetail(e, speDetailType: number) {
  4646. e.stopPropagation();
  4647. this.detailModel = true;
  4648. let user = JSON.parse(localStorage.getItem("user"));
  4649. let postData = {
  4650. deptId: user.user.dept.id,
  4651. urgent: speDetailType,
  4652. };
  4653. this.loading33 = true;
  4654. this.mainService
  4655. .postCustom("nurse", "getSpecimenWorkOrderDetails", postData)
  4656. .subscribe((result) => {
  4657. this.loading33 = false;
  4658. if (result.status == 200) {
  4659. this.detailList = result.data || [];
  4660. }
  4661. });
  4662. }
  4663. // 跳转患者陪检闭环视图
  4664. changeInspectClosedLoopView(e, stateValue){
  4665. e.stopPropagation();
  4666. let queryParams = {
  4667. department: { id: this.currentDept.id, dept: this.currentDept.dept },
  4668. stateValue,
  4669. }
  4670. this.router.navigateByUrl(`/inspectClosedLoopView?queryParams=${JSON.stringify(queryParams)}`);
  4671. }
  4672. // 标本打包弹窗
  4673. toSpecimenPackage(e, stateValue){
  4674. e.stopPropagation();
  4675. this.viewSpecimenPackageList(stateValue);
  4676. }
  4677. // 隐藏查看标本详情弹层
  4678. hideSpeDetailModel() {
  4679. this.detailModel = false;
  4680. }
  4681. // 意见删除模态框
  4682. delAdviceModal: boolean = false;
  4683. delAdviceId: number; //删除意见id
  4684. delAdvice(id) {
  4685. this.delAdviceId = id;
  4686. this.delAdviceModal = true;
  4687. }
  4688. confirmDelAdvice() {
  4689. let that = this;
  4690. that.btnLoading = true;
  4691. let postData = [that.delAdviceId];
  4692. that.mainService
  4693. .postCustom("adviceCollection", "rmvData/advice", postData)
  4694. .subscribe((data) => {
  4695. if (data.status == 200) {
  4696. that.delAdviceModal = false;
  4697. that.showPromptModal("删除", true, "");
  4698. if (
  4699. that.adviceList.length == 1 &&
  4700. that.advicePageIndex ==
  4701. Math.ceil(that.adviceListLength / that.advicePageSize)
  4702. ) {
  4703. that.adviceListLength--;
  4704. that.advicePageIndex = Math.ceil(
  4705. that.adviceListLength / that.advicePageSize
  4706. );
  4707. }
  4708. that.getAdvice();
  4709. } else {
  4710. that.delAdviceModal = false;
  4711. that.showPromptModal("删除", false, data.msg);
  4712. }
  4713. });
  4714. }
  4715. hideDelAdviceModal() {
  4716. this.delAdviceModal = false;
  4717. }
  4718. // 追加检查删除模态框
  4719. delInspectModal: boolean = false;
  4720. delInspectId: number; //删除id
  4721. btnLoading4:boolean = false;
  4722. delInspect(id) {
  4723. this.delInspectId = id;
  4724. this.delInspectModal = true;
  4725. }
  4726. confirmDelInspect() {
  4727. this.btnLoading4 = true;
  4728. this.mainService
  4729. .coopData("rmvData", "inspect", [this.delInspectId])
  4730. .subscribe((data) => {
  4731. this.delInspectModal = false;
  4732. this.btnLoading4 = false;
  4733. if (data.status == 200) {
  4734. this.message.success('删除检查成功!')
  4735. this.refreshInspectList();
  4736. } else {
  4737. this.message.error(data.msg || '删除检查失败!')
  4738. }
  4739. });
  4740. }
  4741. hideDelInspectModal() {
  4742. this.delInspectModal = false;
  4743. }
  4744. // 报修撤销模态框
  4745. delBxModal: boolean = false;
  4746. delBxData: any; //删除的data
  4747. delBx(data) {
  4748. this.delBxData = data;
  4749. this.delBxModal = true;
  4750. }
  4751. confirmDelBx() {
  4752. this.btnLoading = true;
  4753. this.mainService
  4754. .flowPost("incident/task/cancel", { incident: this.delBxData })
  4755. .subscribe((result) => {
  4756. if(result.state == 200){
  4757. this.delBxModal = false;
  4758. this.showPromptModal("撤销", true, "");
  4759. this.getBxlb(true);
  4760. }else{
  4761. this.delBxModal = false;
  4762. this.showPromptModal("撤销", false, result.msg);
  4763. }
  4764. });
  4765. }
  4766. hideDelBxModal() {
  4767. this.delBxModal = false;
  4768. }
  4769. // 报修提示框
  4770. reqModal: boolean = false;
  4771. extraData:any = {};
  4772. showReqModal() {
  4773. this.extraData.floor = this.floors.find(v => v.id == this.validateBxForm.value.floor);
  4774. // this.reqModal = true;
  4775. this.confirmBxNext(0);
  4776. }
  4777. confirmReq() {
  4778. this.confirmBxNext(1);
  4779. }
  4780. cancelReq() {
  4781. this.confirmBxNext(0);
  4782. }
  4783. hideReqModal() {
  4784. this.reqModal = false;
  4785. }
  4786. // 工单列表下拉筛选
  4787. selectedType: null;
  4788. changeOrderSel(e) {
  4789. this.selectedType = e;
  4790. this.getOrderList();
  4791. }
  4792. // 工单列表工单状态下拉筛选
  4793. changeOrderState(e) {
  4794. this.getOrderList();
  4795. }
  4796. // 工单列表
  4797. orderList: any = [];
  4798. orderIdx: number = 1;
  4799. orderLength: number = 10;
  4800. OLoading: boolean = true;
  4801. getOrderList() {
  4802. let that = this;
  4803. that.orderList = [];
  4804. that.OLoading = true;
  4805. let postData: any = {
  4806. workOrder: {
  4807. createDept: JSON.parse(localStorage.getItem("user")).user.dept.id,
  4808. platform: 2,
  4809. searchDays: 2,
  4810. taskType: {},
  4811. },
  4812. idx: that.orderIdx - 1,
  4813. sum: 10,
  4814. };
  4815. if (that.selectedType && that.selectedType != -1) {
  4816. postData.workOrder.taskType["associationType"] = {
  4817. id: that.selectedType,
  4818. };
  4819. }
  4820. // 执行中包含状态:待抢单、待接单、待到达、待送达、执行中、定时预约
  4821. if (that.orderStateSelected == "1") {
  4822. //执行中
  4823. delete postData.workOrder.gdState;
  4824. postData.workOrder.nurseState = 1;
  4825. } else if (that.orderStateSelected == "2") {
  4826. //待评价
  4827. delete postData.workOrder.nurseState;
  4828. postData.workOrder.gdState = { id: "73" };
  4829. } else {
  4830. //全部
  4831. delete postData.workOrder.nurseState;
  4832. delete postData.workOrder.gdState;
  4833. }
  4834. that.mainService
  4835. .getFetchDataList("nurse", "workOrder", postData)
  4836. .subscribe((data) => {
  4837. that.orderList = data.list || [];
  4838. //显示三项
  4839. that.orderList.forEach((item) => {
  4840. if (item.record.length > 2) {
  4841. let i = item.record
  4842. .reverse()
  4843. .findIndex((step) => step.record.length > 0);
  4844. item.record.reverse();
  4845. i = item.record.length - 1 - i;
  4846. if (i < 2) {
  4847. item.record = item.record.slice(0, 3);
  4848. } else if (i > item.record.length - 2) {
  4849. item.record = item.record.slice(
  4850. item.record.length - 3,
  4851. item.record.length
  4852. );
  4853. } else {
  4854. item.record = item.record.slice(i - 1, i + 2);
  4855. }
  4856. }
  4857. });
  4858. that.orderLength = data.totalNum || 0;
  4859. that.OLoading = false;
  4860. });
  4861. }
  4862. // 撤销
  4863. coopId: number;
  4864. recallOrderModal: boolean = false;
  4865. // 打开撤销模态框
  4866. openRecallModal(id) {
  4867. this.coopId = id;
  4868. this.recallOrderModal = true;
  4869. }
  4870. // 确认撤销
  4871. confirmRec() {
  4872. let that = this;
  4873. that.btnLoading = true;
  4874. that.mainService.delOrder(that.coopId).subscribe((data) => {
  4875. that.closeRecallOrderModal();
  4876. if (data.status == 200) {
  4877. that.getOrderList();
  4878. that.changeInfo();
  4879. this.getTodayNum();
  4880. that.showPromptModal("撤销", true, "");
  4881. } else {
  4882. that.showPromptModal("撤销", false, data.msg);
  4883. }
  4884. });
  4885. }
  4886. // 关闭撤销模态框
  4887. closeRecallOrderModal() {
  4888. this.recallOrderModal = false;
  4889. }
  4890. // 打印二维码-门诊服务点---------------start
  4891. outpatientServiceMsg = "";
  4892. coopOutpatientServiceItem: any;
  4893. outpatientServiceModal: boolean = false;
  4894. // 打开模态框
  4895. openOutpatientServiceModal(item) {
  4896. this.coopOutpatientServiceItem = item;
  4897. this.outpatientServiceMsg = `提示:打印<strong class='red'>${item.patientName}</strong>患者二维码,可用于身份识别`
  4898. this.outpatientServiceModal = true;
  4899. }
  4900. // 确认
  4901. cardNoDto: any = {};
  4902. confirmOutpatientService() {
  4903. this.btnLoading = true;
  4904. this.mainService.qrcodeCardNo({id: this.coopOutpatientServiceItem.id, fieldName: 'cardNo'}).subscribe((data) => {
  4905. this.closeOutpatientServiceModal();
  4906. this.btnLoading = false;
  4907. if (data.state == 200) {
  4908. data.logo = location.origin + '/file' + data.logo || '';
  4909. this.cardNoDto = data;
  4910. this.getPatient();
  4911. // 打印
  4912. setTimeout(()=>{
  4913. this.printBtn.nativeElement.click();
  4914. }, )
  4915. } else {
  4916. this.showPromptModal("打印", false, data.msg);
  4917. }
  4918. });
  4919. }
  4920. // 关闭模态框
  4921. closeOutpatientServiceModal() {
  4922. this.outpatientServiceModal = false;
  4923. }
  4924. // 打印二维码-门诊服务点---------------end
  4925. // 评价
  4926. appraiseModal: boolean = false;
  4927. starNum: number = 5; //评价星
  4928. appraiseContent: string = ""; //评级
  4929. appraiseId: number;
  4930. showAppraise(id) {
  4931. this.appraiseId = id;
  4932. this.appraiseModal = true;
  4933. this.starNum = 5;
  4934. this.appraiseContent = "";
  4935. }
  4936. // 保存评价
  4937. confirmAppraise() {
  4938. console.log(this.starNum, this.appraiseContent);
  4939. let that = this;
  4940. if (!that.starNum) return;
  4941. that.btnLoading = true;
  4942. let id;
  4943. switch (that.starNum) {
  4944. case 1:
  4945. id = 358;
  4946. break;
  4947. case 2:
  4948. id = 357;
  4949. break;
  4950. case 3:
  4951. id = 356;
  4952. break;
  4953. case 4:
  4954. id = 355;
  4955. break;
  4956. case 5:
  4957. id = 354;
  4958. break;
  4959. }
  4960. let postData = {
  4961. serviceEvaluation: { id: id },
  4962. remark: that.appraiseContent,
  4963. };
  4964. this.mainService
  4965. .postCustom("nurse/workOrder", "evaluate/" + this.appraiseId, postData)
  4966. .subscribe((data) => {
  4967. that.hideAppraise();
  4968. if (data.status == 200) {
  4969. that.getOrderList();
  4970. that.showPromptModal("评价", true, "");
  4971. } else {
  4972. that.showPromptModal("评价", false, data.msg);
  4973. }
  4974. });
  4975. }
  4976. hideAppraise() {
  4977. this.appraiseModal = false;
  4978. }
  4979. // 报修评价
  4980. appraiseModalBx: boolean = false;
  4981. starNumBx: number = 5; //评价星
  4982. appraiseContentBx: string = ""; //评级
  4983. appraiseDataBx: any;
  4984. showAppraiseBx(data) {
  4985. this.appraiseDataBx = data;
  4986. this.appraiseModalBx = true;
  4987. this.starNumBx = 5;
  4988. this.appraiseContentBx = "";
  4989. }
  4990. // 保存评价
  4991. confirmAppraiseBx() {
  4992. console.log(this.starNumBx, this.appraiseContentBx);
  4993. if (!this.starNumBx) return;
  4994. this.btnLoading = true;
  4995. let id = this.degrees.find(v=>v.value == this.starNumBx).id;
  4996. let postData = {
  4997. incident: {
  4998. ...this.appraiseDataBx,
  4999. wxdegree: { id },
  5000. wxdegreeremark: this.appraiseContentBx,
  5001. }
  5002. };
  5003. this.mainService
  5004. .flowPost("incident/task/resolve", postData)
  5005. .subscribe((data:any) => {
  5006. this.hideAppraiseBx();
  5007. if (data.state == 200) {
  5008. this.getBxlb(this.bxlbPageIndex);
  5009. this.showPromptModal("评价", true, "");
  5010. } else {
  5011. this.showPromptModal("评价", false, data.msg);
  5012. }
  5013. });
  5014. }
  5015. hideAppraiseBx() {
  5016. this.appraiseModalBx = false;
  5017. }
  5018. // 审核状态
  5019. checkStatusLis: any = [];
  5020. getCheckStatusLis() {
  5021. let that = this;
  5022. that.mainService.getDictionary("list", "check_status").subscribe((data) => {
  5023. that.checkStatusLis = data;
  5024. });
  5025. }
  5026. // 填写加急原因模态框
  5027. jiajiModal: boolean = false;
  5028. jiajiContent: string; //加急原因
  5029. jiajiId; //加急工单id
  5030. showJiaji(id) {
  5031. this.jiajiId = id;
  5032. this.jiajiModal = true;
  5033. this.jiajiContent = "";
  5034. }
  5035. hideJiaji() {
  5036. this.jiajiModal = false;
  5037. }
  5038. // 保存加急原因
  5039. confirmJiaji() {
  5040. let that = this;
  5041. let checkStatusId;
  5042. if (!that.jiajiContent) return;
  5043. that.btnLoading = true;
  5044. that.checkStatusLis.forEach((e) => {
  5045. if (e.value == 1) {
  5046. checkStatusId = e.id;
  5047. }
  5048. });
  5049. let postData = {
  5050. urgentDetails: {
  5051. workerOrder: that.jiajiId,
  5052. checkStatus: { id: checkStatusId },
  5053. urgentReason: that.jiajiContent,
  5054. },
  5055. };
  5056. that.mainService
  5057. .postCustom("workerOrder", "urge", postData)
  5058. .subscribe((data) => {
  5059. if (data.status == 200) {
  5060. that.showPromptModal("加急", true, "");
  5061. that.getOrderList();
  5062. that.hideJiaji();
  5063. } else {
  5064. that.showPromptModal("加急", false, data.msg);
  5065. }
  5066. });
  5067. }
  5068. // 查看工单详情
  5069. openDetails(data) {
  5070. if (data.taskType.associationType.value == 'specimen' || data.taskType.associationType.value == 'specimenPlan') {
  5071. // 标本类
  5072. this.router.navigateByUrl("nurse/detailSample/" + data.id);
  5073. } else if (data.taskType.associationType.value == 'inspect' || data.taskType.associationType.value == 'patientTransport') {
  5074. // 送患者
  5075. this.router.navigateByUrl("nurse/detailPatients/" + data.id);
  5076. } else if (data.taskType.associationType.value == 'drugsBag' || data.taskType.associationType.value == 'jPBag') {
  5077. // 药品配送/静配
  5078. this.router.navigateByUrl("nurse/detailDrug/" + data.id);
  5079. } else if (data.taskType.associationType.value == 'ordinary') {
  5080. // 万能交接服务
  5081. this.router.navigateByUrl("nurse/detailOrdinary/" + data.id);
  5082. } else {
  5083. // 其他
  5084. this.router.navigateByUrl("nurse/detailOthers/" + data.id);
  5085. }
  5086. }
  5087. // 展示信息提示框(con:提示信息,success:操作是否成功,promptInfo:操作结果提示信息)
  5088. showPromptModal(con, success, promptInfo?, back?) {
  5089. this.btnLoading = false;
  5090. this.btnLoading1 = false;
  5091. this.promptModalShow = false;
  5092. this.promptContent = con;
  5093. this.ifSuccess = success;
  5094. this.promptInfo = promptInfo;
  5095. this.back = back;
  5096. setTimeout(() => {
  5097. this.promptModalShow = true;
  5098. }, 100);
  5099. }
  5100. // 回到系统管理
  5101. toMain() {
  5102. this.router.navigateByUrl("main");
  5103. }
  5104. // 查看工单
  5105. toOrder() {
  5106. this.router.navigateByUrl(`main/orderManagement`);
  5107. }
  5108. // 退出
  5109. logOut(): void {
  5110. let that = this;
  5111. // 假退出
  5112. let hospital = this.tool.getCurrentHospital();
  5113. if(hospital){
  5114. this.router.navigate(["login", hospital.id]);
  5115. }else{
  5116. this.router.navigateByUrl("login");
  5117. }
  5118. localStorage.removeItem("user");
  5119. localStorage.removeItem("menu");
  5120. localStorage.removeItem("index");
  5121. // 假退出
  5122. that.mainService.logOut().subscribe((data) => {
  5123. if (data.status == 200) {
  5124. if(hospital){
  5125. this.router.navigate(["login", hospital.id]);
  5126. }else{
  5127. this.router.navigateByUrl("login");
  5128. }
  5129. localStorage.removeItem("user");
  5130. localStorage.removeItem("menu");
  5131. localStorage.removeItem("index");
  5132. }
  5133. });
  5134. }
  5135. // 格式化时分秒
  5136. // (时间小于一分钟则显示秒,时间大于一分钟则显示分钟数,如超出一小时则显示小时和分钟。)time单位:秒
  5137. formatTime(time) {
  5138. let timeStr = "";
  5139. if (time >= 0 && time < 60) {
  5140. // 秒
  5141. timeStr = time + "秒";
  5142. } else if (time >= 60 && time < 3600) {
  5143. // 分钟
  5144. timeStr = Math.floor(time / 60) + "分钟";
  5145. } else if (time >= 3600) {
  5146. // 时 + 分
  5147. let h = "";
  5148. let m = "";
  5149. h = Math.floor(time / 3600) + "小时";
  5150. m = time % 3600 >= 60 ? Math.floor((time % 3600) / 60) + "分钟" : "";
  5151. timeStr = h + m;
  5152. }
  5153. return timeStr;
  5154. }
  5155. // 计算历史记录耗时
  5156. filterTime(step) {
  5157. let num = 0;
  5158. step.forEach((e) => {
  5159. num += e.difTime;
  5160. });
  5161. return this.formatTime(num / 1000);
  5162. }
  5163. // 截取意见内容(ie内核截取)
  5164. spliceContent(con) {
  5165. if (con.length >= 41 && navigator.userAgent.indexOf("Trident") > -1) {
  5166. return con.slice(0, 41) + "...";
  5167. } else {
  5168. return con;
  5169. }
  5170. }
  5171. @ViewChild("msgTemplate", { static: false }) msgTemplate: TemplateRef<any>; //消息通知模板
  5172. // 消息提醒
  5173. createBasicNotification(msgs): void {
  5174. this.notification.template(this.msgTemplate, {
  5175. nzDuration: 0,
  5176. nzData: msgs,
  5177. });
  5178. }
  5179. isShowNurseCode = false; //是否展开科室二维码
  5180. nurseCodeImg = ""; //图片
  5181. refreshQRCodeTime = 0; //刷新时间间隔
  5182. // 关闭科室二维码
  5183. closeNurseCode() {
  5184. this.isShowNurseCode = false;
  5185. clearInterval(this.timer);
  5186. this.timer = null;
  5187. }
  5188. // 展开科室二维码
  5189. timer = null;
  5190. showNurseCode() {
  5191. this.isShowNurseCode = true;
  5192. this.getConfig()
  5193. }
  5194. // 获取配置
  5195. iskeySwitch:any = false;
  5196. getConfig() {
  5197. let postData = {
  5198. idx: 0,
  5199. sum: 9999,
  5200. hospitalConfig:{
  5201. hosId:this.currentHospital.id,
  5202. model:"all"
  5203. }
  5204. };
  5205. this.mainService.getFetchDataList("simple/data", "hospitalConfig", postData).subscribe((result:any) => {
  5206. if (result.status == 200) {
  5207. for(let i of result.list){
  5208. if(i.key=='digitalSecretKey'){
  5209. if(i.value==1){
  5210. this.iskeySwitch = true
  5211. this.getSecretKey()
  5212. }else{
  5213. this.iskeySwitch = false
  5214. this.mainService.getDeptCode([this.loginUserDeptId]).subscribe((data) => {
  5215. if (data["status"] == 200) {
  5216. this.nurseCodeImg = data["data"][0].base64;
  5217. this.refreshQRCodeTime = data["data"][0].refreshQRCodeTime;
  5218. clearInterval(this.timer);
  5219. this.timer = setInterval(() => {
  5220. this.refreshQRCodeTime = Math.max(--this.refreshQRCodeTime, 0);
  5221. if (this.refreshQRCodeTime === 0) {
  5222. clearInterval(this.timer);
  5223. this.showNurseCode();
  5224. }
  5225. }, 1000);
  5226. }
  5227. });
  5228. }
  5229. }
  5230. }
  5231. }
  5232. });
  5233. }
  5234. // 获取动态密钥
  5235. numberKey:any;
  5236. getSecretKey(){
  5237. this.mainService.getSecretKey(this.currentDept.id).subscribe((res:any) => {
  5238. if (res["status"] == 200) {
  5239. this.numberKey = res.data.digitalSecretKey;
  5240. this.nurseCodeImg = res.data.base64;
  5241. this.refreshQRCodeTime = res.data.refreshQRCodeTime;
  5242. clearInterval(this.timer);
  5243. this.timer = setInterval(() => {
  5244. this.refreshQRCodeTime = Math.max(--this.refreshQRCodeTime, 0);
  5245. if (this.refreshQRCodeTime === 0) {
  5246. clearInterval(this.timer);
  5247. this.showNurseCode();
  5248. }
  5249. }, 1000);
  5250. }
  5251. });
  5252. }
  5253. // 右侧菜单
  5254. showLastItems: boolean = false;
  5255. // 下拉
  5256. fixedMenuXiala() {
  5257. this.showLastItems = true;
  5258. }
  5259. // 上拉
  5260. fixedMenuShangla() {
  5261. this.showLastItems = false;
  5262. }
  5263. mainRole: boolean = false; //回到系统管理权限
  5264. mainRoleBtnName = "回到系统管理"; //回到系统管理名字
  5265. initRole() {
  5266. let menus = JSON.parse(localStorage.getItem("menu"));
  5267. console.log("菜单数量" + menus.length);
  5268. if (menus.length >= 2) {
  5269. this.mainRole = true;
  5270. return;
  5271. }
  5272. }
  5273. // 切换右侧菜单Tab
  5274. fixedTab: string = "";
  5275. checkFixedTab(type: string) {
  5276. if (type == "toSystem") {
  5277. this.router.navigateByUrl("main");
  5278. }
  5279. if (this.fixedTab == type) {
  5280. this.fixedTab = "";
  5281. } else {
  5282. this.fixedTab = type;
  5283. }
  5284. }
  5285. //子传父接收
  5286. closeModelHs(e) {
  5287. this.hsPromptModalShow = JSON.parse(e).show;
  5288. this.changeShow = JSON.parse(e).changeShow;
  5289. }
  5290. //子传父接收
  5291. clearModelHs(e) {
  5292. if (JSON.parse(e).clear === true) {
  5293. clearInterval(this.timerCloseTime);
  5294. }
  5295. this.changeShow = JSON.parse(e).changeShow;
  5296. }
  5297. // 头部切换科室
  5298. changeKsNow() {
  5299. this.hsPromptModalShow = true;
  5300. clearInterval(this.timerCloseTime);
  5301. this.changeShow = false;
  5302. }
  5303. // 刷新工单列表
  5304. refreshList(e) {
  5305. if (!e.promptContent) {
  5306. return;
  5307. }
  5308. this.getOrderList();
  5309. }
  5310. // 打印二维码-门诊服务点
  5311. printCode(item){
  5312. console.log(item)
  5313. }
  5314. //打开修改密码弹窗
  5315. pwdAfterOpen(){
  5316. this.passwordVisible = false;
  5317. this.pwdIsOkLoading = false;
  5318. this.enoughRegFlag = true; //弱
  5319. this.mediumRegFlag = false; //中
  5320. this.strongRegFlag = false; //强
  5321. this.upModalData = {
  5322. userid: "",
  5323. pwdOld: "",
  5324. newPwd: "",
  5325. newPwd2: "",
  5326. };
  5327. }
  5328. // 修改密码
  5329. passwordVisible = false;
  5330. password?: string;
  5331. isPwdVisible = false;
  5332. pwdIsOkLoading = false;
  5333. upModalData = {
  5334. userid: "",
  5335. pwdOld: "",
  5336. newPwd: "",
  5337. newPwd2: "",
  5338. };
  5339. upPwd(): void {
  5340. if(this.upModalData.pwdOld.trim() === ''){
  5341. this.message.error('请填写原始密码!', {
  5342. nzDuration: 5000,
  5343. });
  5344. return;
  5345. }
  5346. if(!this.strongRegFlag){
  5347. this.message.error('新密码不符合要求!', {
  5348. nzDuration: 5000,
  5349. });
  5350. return;
  5351. }
  5352. if(this.upModalData.newPwd !== this.upModalData.newPwd2){
  5353. this.message.error('新密码与确认新密码不一致!', {
  5354. nzDuration: 5000,
  5355. });
  5356. return;
  5357. }
  5358. this.pwdIsOkLoading = true;
  5359. let userid = JSON.parse(localStorage.getItem("user")).user.id;
  5360. this.upModalData.userid = userid;
  5361. this.mainService.upPwd(this.upModalData).subscribe((data) => {
  5362. if (data.status == 200) {
  5363. this.isPwdVisible = false;
  5364. this.pwdIsOkLoading = false;
  5365. this.message.success("修改成功!", {
  5366. nzDuration: 5000,
  5367. });
  5368. } else {
  5369. this.pwdIsOkLoading = false;
  5370. this.message.error(data.error, {
  5371. nzDuration: 5000,
  5372. });
  5373. }
  5374. });
  5375. }
  5376. showUpPwd(): void {
  5377. this.isPwdVisible = true;
  5378. }
  5379. pwdHandleOk(): void {
  5380. this.upPwd();
  5381. }
  5382. pwdHandleCancel(): void {
  5383. this.isPwdVisible = false;
  5384. }
  5385. // 新密码失去焦点
  5386. enoughRegFlag = true; //弱
  5387. mediumRegFlag = false; //中
  5388. strongRegFlag = false; //强
  5389. blurNewPwd(){
  5390. let enoughReg = /^.{0,6}$/;//密码强度-弱
  5391. let strongReg = /^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[\!\@\#\$\%\^\&\*]).{9,}$/;//密码强度-强
  5392. this.enoughRegFlag = enoughReg.test(this.upModalData.newPwd);
  5393. this.strongRegFlag = strongReg.test(this.upModalData.newPwd);
  5394. this.mediumRegFlag = !this.enoughRegFlag && !this.strongRegFlag;
  5395. console.log(this.enoughRegFlag,this.mediumRegFlag,this.strongRegFlag);
  5396. }
  5397. // 快捷方式建单
  5398. isShowBuildQuickConfirm:boolean = false;
  5399. buildQuickConfirmData:any = {};
  5400. buildQuick(data){
  5401. if(data.bussType.value === 'service'){
  5402. // 运维报修
  5403. this.showBxModal();
  5404. }else if(data.icon.value === 'specimenPackage'){
  5405. // 标本打包
  5406. this.router.navigateByUrl("/batchSpecimen");
  5407. }else if(data.bussType.value === 'goods'){
  5408. // 物品配送
  5409. this.buildQuickConfirmData = data || {};
  5410. this.isShowBuildQuickConfirm = true;
  5411. }else if(data.bussType.value === 'inspect'){
  5412. // 陪检
  5413. if(this.inspectAndPatientTransportConfig.batchInspectType == 1){
  5414. // 预约陪检
  5415. this.router.navigateByUrl("/batchInspection");
  5416. }else if(this.inspectAndPatientTransportConfig.batchInspectType == 2){
  5417. // 陪检信息配置
  5418. this.router.navigateByUrl("/inspectInfoConfig");
  5419. }
  5420. }
  5421. }
  5422. cancelBuildQuickConfirm(e){
  5423. this.isShowBuildQuickConfirm = false;
  5424. }
  5425. loadingQuick:boolean = false;
  5426. confirmBuildQuickConfirm(options){
  5427. let { taskType, shortcutForm, buildMsg, workOrderRemark, userAccount } = options;
  5428. if(taskType.associationType.value === 'other' || taskType.associationType.value === 'ordinary'){
  5429. // 其他临床服务|万能交接
  5430. this.loadingQuick = this.loading5;
  5431. this.buildType = taskType.associationType.value;
  5432. this.shortcutMsg = taskType;
  5433. this.buildMsg = buildMsg;
  5434. this.workOrderRemark = workOrderRemark;
  5435. this.userAccount = userAccount;
  5436. this.confirmShortcut(shortcutForm, taskType.associationType.value);
  5437. }else if(taskType.associationType.value === 'specimen'){
  5438. // 标本配送
  5439. this.loadingQuick = this.btnLoading;
  5440. this.buildType = "bb";
  5441. this.shortcutMsg1 = taskType;
  5442. this.workOrderRemark1 = workOrderRemark;
  5443. this.confirmShortcut1(shortcutForm);
  5444. }
  5445. }
  5446. // 详细地址获取焦点
  5447. isShowAddressList:boolean = false;
  5448. focusAddress(){
  5449. this.isShowAddressList = true;
  5450. this.getAddressList();
  5451. }
  5452. // 点击其他位置
  5453. clickExtra(e){
  5454. if(document.documentElement.contains(document.querySelector('.addressList')) && e.target !== document.querySelector('.addressFocus')){
  5455. this.isShowAddressList = false;
  5456. }
  5457. if(document.documentElement.contains(document.querySelector('.noteList')) && e.target !== document.querySelector('.noteFocus')){
  5458. this.isShowNoteList = false;
  5459. }
  5460. }
  5461. // 选择地址
  5462. selectAddress(name){
  5463. this.validateBxForm.controls.officeAddress.setValue(name)
  5464. this.isShowAddressList = false;
  5465. }
  5466. // 获取科室地点列表
  5467. addressList:any[] = [];
  5468. addressLoading:boolean = false;
  5469. getAddressList() {
  5470. let postData = {
  5471. idx: 0,
  5472. sum: 99999,
  5473. qrCode: {
  5474. deptId: this.loginUserDeptId,
  5475. }
  5476. };
  5477. this.addressLoading = true;
  5478. this.mainService.getFetchDataList("simple/data", "qrCode", postData).subscribe(result=>{
  5479. this.addressLoading = false;
  5480. if(result.status == 200){
  5481. this.addressList = result.list || [];
  5482. }else{
  5483. this.addressList = [];
  5484. }
  5485. });
  5486. }
  5487. // 注意事项获取焦点
  5488. isShowNoteList:boolean = false;
  5489. focusNote(){
  5490. this.isShowNoteList = true;
  5491. this.getNoteList();
  5492. }
  5493. // 选择注意事项
  5494. selectNote(name){
  5495. this.workOrderRemark2 = name;
  5496. this.isShowNoteList = false;
  5497. }
  5498. // 获取注意事项列表
  5499. noteList:any[] = [];
  5500. noteLoading:boolean = false;
  5501. getNoteList() {
  5502. this.noteLoading = true;
  5503. this.mainService.getDictionary('list', 'inspect_notes',).subscribe(result=>{
  5504. this.noteLoading = false;
  5505. this.noteList = result || [];
  5506. });
  5507. }
  5508. // 关联的检查-上一日,下一日,今天
  5509. inspectToday:Date = new Date();
  5510. // 上一日
  5511. previousDayNew(){
  5512. this.inspectToday = addDays(this.inspectToday, -1);
  5513. this.inspectSubject.next();
  5514. }
  5515. // 今天
  5516. todayNew(){
  5517. this.inspectToday = new Date();
  5518. this.inspectSubject.next();
  5519. }
  5520. // 下一日
  5521. nextDayNew(){
  5522. this.inspectToday = addDays(this.inspectToday, 1);
  5523. this.inspectSubject.next();
  5524. }
  5525. refreshInspectList(){
  5526. let postData = {
  5527. taskTypeId: this.patientForm.controls.checkedType.value,
  5528. patientCode: this.patientMsg.patientCode,
  5529. startTime: format(startOfDay(this.inspectToday), 'yyyy-MM-dd HH:mm:ss'),
  5530. endTime: format(endOfDay(this.inspectToday), 'yyyy-MM-dd HH:mm:ss'),
  5531. };
  5532. this.linkCheckLis = [];
  5533. this.mainService
  5534. .postCustom("nurse", "workOrder/buildTrip", postData)
  5535. .subscribe((data) => {
  5536. // 工单备注配置 end
  5537. if (data.status == 200 && data.data && data.data.length) {
  5538. let arr = [];
  5539. data.data.forEach((e) => {
  5540. e.newTime = format(new Date(e.yyTime), 'MM-dd HH:mm')
  5541. if(e.endCheckTime){
  5542. e.newTime2 = format(new Date(e.endCheckTime), 'HH:mm')
  5543. e.yyEndTime = e.newTime + '--' + e.newTime2
  5544. }else{
  5545. // e.newTime2 = format(addMinutes(new Date(e.yyTime), this.inspectAndPatientTransportConfig.yytimeGapMinute), 'HH:mm')
  5546. e.yyEndTime = e.newTime
  5547. }
  5548. arr.push({
  5549. execDeptId: e.execDept.id,
  5550. yyTime: e.yyTime,
  5551. priority: e.priority,
  5552. manualCreate: e.manualCreate,
  5553. label:
  5554. (e.yyEndTime|| "") +
  5555. " " +
  5556. (this.deptDisplay == 2
  5557. ? e.execDept.deptalias
  5558. : e.execDept.dept) +
  5559. " 进行 " +
  5560. (e.inspectName?e.inspectName:'' + '-' + e.inspectCode || "检查"),
  5561. value: e["id"],
  5562. checked: false,
  5563. remark: e.remark,
  5564. });
  5565. });
  5566. this.linkCheckLis = arr;
  5567. }
  5568. });
  5569. }
  5570. // 查看标本打包
  5571. specimenPackageStateValue;
  5572. isShowSpecimenPackageList = false; //业务数据弹窗开关
  5573. viewSpecimenPackageList(stateValue) {
  5574. this.specimenPackageStateValue = stateValue;
  5575. this.isShowSpecimenPackageList = true;
  5576. }
  5577. // 关闭标本打包弹窗
  5578. closeSpecimenPackageList(e) {
  5579. this.isShowSpecimenPackageList = JSON.parse(e).show;
  5580. }
  5581. // 追加检查
  5582. isShowAddInspect = false; //弹窗开关
  5583. addInspect(){
  5584. this.isShowAddInspect = true;
  5585. }
  5586. // 关闭弹窗
  5587. closeAddInspectModel(e) {
  5588. this.isShowAddInspect = JSON.parse(e).show;
  5589. }
  5590. // 确定弹窗
  5591. confirmAddInspectModel(e) {
  5592. console.log(e);
  5593. let obj = JSON.parse(e);
  5594. this.isShowAddInspect = obj.show;
  5595. let user = JSON.parse(localStorage.getItem("user"));
  5596. if(obj.type == 2){
  5597. // 手动添加
  5598. let postData:any = {
  5599. inspectList: obj.list.map(v => ({
  5600. patientCode: this.patientMsg.patientCode,
  5601. patientName: this.patientMsg.patientName,
  5602. barCode: this.patientMsg.barCode,
  5603. inspectCheckType: { id: v.id },
  5604. applyDeptId: user.user.dept.id,
  5605. bedNum: this.patientMsg.bedNum,
  5606. hosId: this.patientMsg.hosId,
  5607. })) || undefined,
  5608. };
  5609. this.maskFlag = this.message.loading("正在加载中..", {
  5610. nzDuration: 0,
  5611. }).messageId;
  5612. this.mainService
  5613. .simplePost("addData", "inspect", postData)
  5614. .subscribe((data:any) => {
  5615. this.message.remove(this.maskFlag);
  5616. this.maskFlag = false;
  5617. if (data.status == 200) {
  5618. this.message.success('追加检查成功!')
  5619. this.refreshInspectList();
  5620. } else {
  5621. this.message.error(data.msg || '追加检查失败!')
  5622. }
  5623. });
  5624. }else{
  5625. let postData:any = {
  5626. inspectList: [{
  5627. patientCode: this.patientMsg.patientCode,
  5628. patientName: this.patientMsg.patientName,
  5629. barCode: this.patientMsg.barCode,
  5630. inspectCheckType: { id: obj.inspectData.id },
  5631. applyDeptId: user.user.dept.id,
  5632. execDeptId: obj.inspectData.execDeptId,
  5633. bedNum: this.patientMsg.bedNum,
  5634. hosId: this.patientMsg.hosId,
  5635. yyTime: format(new Date(obj.inspectData.date), 'yyyy-MM-dd ') + format(startOfMinute(new Date(obj.inspectData.time)), 'HH:mm:ss'),
  5636. endCheckTime: obj.inspectData.endCheckTime
  5637. }] || undefined,
  5638. };
  5639. this.maskFlag = this.message.loading("正在加载中..", {
  5640. nzDuration: 0,
  5641. }).messageId;
  5642. this.mainService
  5643. .simplePost("addData", "inspect", postData)
  5644. .subscribe((data:any) => {
  5645. this.message.remove(this.maskFlag);
  5646. this.maskFlag = false;
  5647. if (data.status == 200) {
  5648. this.message.success('追加检查成功!')
  5649. this.refreshInspectList();
  5650. } else {
  5651. this.message.error(data.msg || '追加检查失败!')
  5652. }
  5653. });
  5654. }
  5655. }
  5656. }