hushijiandan.component.ts 181 KB

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