hushijiandan.component.ts 168 KB

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