main.component.ts 140 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467
  1. import { Component, OnInit, TemplateRef, ViewChild, OnDestroy } from "@angular/core";
  2. import { NavigationEnd, Router } from "@angular/router";
  3. import { MainService } from "../../services/main.service";
  4. import { NzMessageService } from "ng-zorro-antd/message";
  5. import { WebsocketMainService } from "../../services/websocket-main.service";
  6. import http from "../../../assets/js/http";
  7. import { Subject, forkJoin } from "rxjs";
  8. import { debounceTime, filter, map } from "rxjs/operators";
  9. import { SourceId } from "src/app/type/types";
  10. import { addDays, differenceInCalendarDays, getHours, getMinutes, setMinutes, parse, format, addHours, startOfDay, endOfDay } from 'date-fns';
  11. import { UploadFile } from 'ng-zorro-antd';
  12. import { NzNotificationService } from "ng-zorro-antd/notification";
  13. import { OverlayScrollbarsComponent } from "overlayscrollbars-ngx";
  14. import { ToolService } from "../../services/tool.service";
  15. import cloneDeep from 'lodash-es/cloneDeep'
  16. import { HttpRequest, HttpClient, HttpResponse } from '@angular/common/http';
  17. import { WebsocketIncomingService } from 'src/app/services/websocket-incoming.service';
  18. declare const tlwsa: any;
  19. declare const TLWSA: any;
  20. // 日期禁用
  21. function range(start: number, end: number): number[] {
  22. const result: number[] = [];
  23. for (let i = start; i < end; i++) {
  24. result.push(i);
  25. }
  26. return result;
  27. }
  28. @Component({
  29. selector: "app-main",
  30. templateUrl: "./main.component.html",
  31. styleUrls: ["./main.component.less"],
  32. })
  33. export class MainComponent implements OnInit, OnDestroy {
  34. userInfo: any = JSON.parse(localStorage.getItem("user"));
  35. user: any = JSON.parse(localStorage.getItem("user"));
  36. menus: any = JSON.parse(localStorage.getItem("menu"));
  37. currentHospital; //当前院区
  38. routerEventsListener; //监听路由
  39. homeRole: boolean = false; //首页权限
  40. speediness: boolean = false; //新增报修权限
  41. deskRole: boolean = false; //调度台权限
  42. nurseRole: boolean = false; //护士端权限
  43. pharmacyRole: boolean = false; //药房端权限
  44. largeScreenRole: boolean = false; //综合大屏权限
  45. largeScreenRole2: boolean = false; //运送陪检大屏权限
  46. largeScreenRole3: boolean = false; //运维大屏权限
  47. specimenViewRole: boolean = false; //业务视图权限
  48. specimenViewRole2: boolean = false; //标本视图权限
  49. specimenRoomView: boolean = false; //标本间权限
  50. pathology: boolean = false; //病理科权限
  51. sampling: boolean = false; //门诊病理采样端权限
  52. communicationBook: boolean = false; //病理交接本权限
  53. disinfectionSupplyRole: boolean = false; //全局业务查看权限
  54. realtimeBroadcastRole: boolean = false; //故障实时播报
  55. inspectClosedLoopViewRole: boolean = false; //陪检闭环视图
  56. webRepairs: boolean = false; //web报修端权限
  57. incidentConfigRole: boolean = false; //事件配置权限
  58. otherConfigRole: boolean = false; //三方配置权限
  59. pageConfigRole: boolean = false; //业务页面控制权限
  60. nurseConfigRole: boolean = false; //护士端配置控制权限
  61. PCCommutesToWork: boolean = false; //PC上下班权限
  62. newStatisticsRole: boolean = false; //新版统计权限
  63. @ViewChild("osComponentRef1", {
  64. read: OverlayScrollbarsComponent,
  65. static: false,
  66. })
  67. osComponentRef1: OverlayScrollbarsComponent;
  68. constructor(
  69. public router: Router,
  70. private mainService: MainService,
  71. private msg: NzMessageService,
  72. private notification: NzNotificationService,
  73. private webs: WebsocketMainService,
  74. public tool: ToolService,
  75. public incomingService: WebsocketIncomingService,
  76. private http: HttpClient,
  77. // private eventSubscription: Subscription
  78. ) {}
  79. eventData:any
  80. ngOnInit() {
  81. this.getEvent();
  82. this.initHospitalAndDuty(this.tool.getCurrentHospital());
  83. this.highlightMenuByUrl();
  84. this.routerEventsListener = this.router.events
  85. .pipe(filter((event) => event instanceof NavigationEnd))
  86. .subscribe((event) => {
  87. this.highlightMenuByUrl();
  88. });
  89. this.currentHospital = this.tool.getCurrentHospital();
  90. this.initLogin();
  91. this.initMenu();
  92. this.getWebsocket();
  93. }
  94. getEvent(){
  95. // 全局监听
  96. let that = this;
  97. that.tool.getEventObservable().subscribe(res => {
  98. that.eventData = res;
  99. console.log('全局的监听触发111111', that.eventData);
  100. if(that.eventData.message == '建单'){
  101. that.speedinessAdd()
  102. }
  103. });
  104. }
  105. // 离开管理端
  106. ngOnDestroy() {
  107. //取消路由监听
  108. this.routerEventsListener.unsubscribe();
  109. // 断掉连接
  110. this.webs.closeWs(true);
  111. // if (this.eventSubscription) {
  112. // this.eventSubscription.unsubscribe();
  113. // }
  114. }
  115. // 菜单图标名称是否包含transport-
  116. isTransportIcon(icon:any) {
  117. if(icon){
  118. return icon.indexOf("transport-") > -1;
  119. }else{
  120. return false;
  121. }
  122. }
  123. //上下班
  124. loading3 = false;
  125. workModal: boolean = false; //模态框
  126. showWorkModal() {
  127. this.workModal = true;
  128. }
  129. hideWorkModal() {
  130. this.workModal = false;
  131. }
  132. confirmWork() {
  133. this.loading3 = true;
  134. if (this.userInfo.user.online) {
  135. // 判断当前启用的工作方案是自主还是综合排班
  136. this.getUserWorkDept().then((ress:any) => {
  137. if (ress.status == 200) {
  138. let workType = ress.settings ? ress.settings.workType : -1; //1是综合,2是自主
  139. // 自主下班,并且是科室绑定人员,科室绑定分组,绑定分组
  140. if (workType == 2) {
  141. this.loading3 = false;
  142. this.msg.info('不支持此上班模式!');
  143. } else {
  144. this.mainService.onOrOffLine({
  145. type: "off",
  146. }).subscribe((res:any) => {
  147. if (res.status == 200) {
  148. this.getCurrentUserNow();
  149. } else {
  150. this.loading3 = false;
  151. this.msg.error('操作失败');
  152. }
  153. });
  154. }
  155. } else if (ress.status == 500) {
  156. //500的时候自选下班
  157. this.customOff();
  158. } else {
  159. this.loading3 = false;
  160. this.msg.error('操作失败');
  161. }
  162. });
  163. } else {
  164. this.getWorkScheme();
  165. }
  166. }
  167. // 获取启动中的工作分配方案
  168. workSchemeType:any = ""; //启动中工作分配方案类型
  169. getWorkScheme() {
  170. let postData = {
  171. idx: 0,
  172. workScheme: {
  173. status: 1,
  174. hosId: this.currentHospital.id
  175. },
  176. sum: 1,
  177. };
  178. this.mainService.getFetchDataList("simple/data", "workScheme", postData).subscribe((res) => {
  179. if (res.status == 200) {
  180. if(Array.isArray(res.list) && res.list.length){
  181. this.workSchemeType = res.list[0].workType;
  182. if (this.workSchemeType == 2) {
  183. this.loading3 = false;
  184. this.msg.info('不支持此上班模式!');
  185. } else if (this.workSchemeType == 1) {
  186. this.mainService.onOrOffLine({
  187. type: "on",
  188. }).subscribe((res:any) => {
  189. if (res.status == 200) {
  190. this.getCurrentUserNow();
  191. } else {
  192. this.loading3 = false;
  193. this.msg.error('操作失败');
  194. }
  195. });
  196. }
  197. }
  198. } else {
  199. this.loading3 = false;
  200. this.msg.error('操作失败');
  201. }
  202. });
  203. }
  204. // 下班
  205. customOff() {
  206. this.mainService.onOrOffLine({
  207. type: "off",
  208. customWorking: "off",
  209. }).subscribe((res:any) => {
  210. if (res.status == 200) {
  211. this.getCurrentUserNow();
  212. } else {
  213. this.loading3 = false;
  214. this.msg.error('操作失败');
  215. }
  216. });
  217. }
  218. // 获取执行中列表
  219. getWorkingNum() {
  220. return this.mainService.coopWorkerOrder("executingOrders", {
  221. idx: 0,
  222. sum: 1,
  223. }).toPromise();
  224. }
  225. // 获取启动中的工作分配方案
  226. getUserWorkDept() {
  227. return this.mainService.getUserWorkDept({}).toPromise();
  228. }
  229. // 获取当前用户信息
  230. getCurrentUserNow() {
  231. this.mainService.getCurrentUser1().subscribe((data:any) => {
  232. this.loading3 = false;
  233. if (data.status == 200) {
  234. let user = JSON.parse(localStorage.getItem("user"));
  235. user.user = data.data;
  236. this.userInfo.user = data.data;
  237. localStorage.setItem("user", JSON.stringify(user));
  238. this.hideWorkModal();
  239. this.msg.success('操作成功!');
  240. }
  241. });
  242. }
  243. // 上下班
  244. types = "";
  245. async GoWork() {
  246. let workingNum = 0;
  247. if (this.userInfo.user.online) {
  248. this.maskFlag = this.msg.loading("正在加载中..", {
  249. nzDuration: 0,
  250. }).messageId;
  251. let workingNumResult = await this.getWorkingNum();
  252. this.msg.remove(this.maskFlag);
  253. this.maskFlag = false;
  254. if (workingNumResult.status == 200) {
  255. workingNum = workingNumResult.data.data.length;
  256. }
  257. if (workingNum) {
  258. this.types = "您还<b style='color:red'>有未完成的工单</b>,确定下班后,<b style='color:red'>未完成工单将不计算积分。</b>";
  259. } else {
  260. this.types = "确定是否下班 ?";
  261. }
  262. } else {
  263. this.types = "确定是否上班 ?";
  264. }
  265. this.showWorkModal();
  266. }
  267. // 根据url高亮菜单baba
  268. highlightMenuByUrl() {
  269. console.log(this.router.url);
  270. let navOne, navTwo;
  271. let link = this.router.url.split("/").slice(-1)[0];
  272. let menus = JSON.parse(localStorage.getItem("menu"));
  273. if (link == "home") {
  274. this.toMenu("首页");
  275. } else {
  276. menus.forEach((oneNav) => {
  277. if (oneNav.childrens) {
  278. let findTwoNav = oneNav.childrens.find(
  279. (twoNav) => twoNav.link == link
  280. );
  281. if (findTwoNav) {
  282. navTwo = findTwoNav;
  283. navOne = oneNav;
  284. this.toMenu(navTwo.title, navTwo, navOne);
  285. }
  286. }
  287. });
  288. }
  289. }
  290. // 一级导航点击
  291. clickMenuOne(data) {
  292. let menus = JSON.parse(localStorage.getItem("menu"));
  293. data.flag = !data.flag;
  294. menus.find((item) => item.id == data.id).flag = data.flag;
  295. localStorage.setItem("menu", JSON.stringify(menus));
  296. }
  297. initMenu() {
  298. let menus = JSON.parse(localStorage.getItem("menu"));
  299. let arr = [];
  300. menus.forEach((e) => {
  301. if (e.link == "home") {
  302. this.homeRole = true;
  303. console.log("首页权限");
  304. }
  305. if (e.link == "nurse") {
  306. this.nurseRole = true;
  307. console.log("护士端权限");
  308. }
  309. if (e.link == "dispatchingDesk") {
  310. this.deskRole = true;
  311. console.log("调度台权限");
  312. }
  313. if (e.link == "pharmacy") {
  314. this.pharmacyRole = true;
  315. console.log("药房端权限");
  316. }
  317. if (e.link == "largeScreen") {
  318. this.largeScreenRole = true;
  319. console.log("综合大屏权限");
  320. }
  321. if (e.link == "largeScreen2") {
  322. this.largeScreenRole2 = true;
  323. console.log("运送陪检大屏权限");
  324. }
  325. if (e.link == "largeScreen3") {
  326. this.largeScreenRole3 = true;
  327. console.log("运维大屏权限");
  328. }
  329. if (e.link == "specimenView") {
  330. this.specimenViewRole = true;
  331. console.log("业务视图权限");
  332. }
  333. if (e.link == "specimenView2") {
  334. this.specimenViewRole2 = true;
  335. console.log("标本视图权限");
  336. }
  337. if (e.link == "specimenRoomView") {
  338. this.specimenRoomView = true;
  339. console.log("标本间权限");
  340. }
  341. if (e.link == "pathology") {
  342. this.pathology = true;
  343. console.log("病理科权限");
  344. }
  345. if (e.link == "pathologySample") {
  346. this.sampling = true;
  347. console.log("门诊病理采样端权限");
  348. }
  349. if (e.link == "pathologyCommunicationBook") {
  350. this.communicationBook = true;
  351. console.log("病理交接本权限");
  352. }
  353. if (e.link == "disinfectionSupply") {
  354. this.disinfectionSupplyRole = true;
  355. console.log("全局业务查看权限");
  356. }
  357. if (e.link == "realtimeBroadcast") {
  358. this.realtimeBroadcastRole = true;
  359. console.log("故障实时播报权限");
  360. }
  361. if (e.link == "inspectClosedLoopView") {
  362. this.inspectClosedLoopViewRole = true;
  363. console.log("陪检闭环视图权限");
  364. }
  365. if (e.link == "incidentConfig") {
  366. this.incidentConfigRole = true;
  367. console.log("事件配置权限");
  368. }
  369. if (e.link == "otherConfig") {
  370. this.otherConfigRole = true;
  371. console.log("三方配置权限");
  372. }
  373. if (e.link == "pageConfig") {
  374. this.pageConfigRole = true;
  375. console.log("业务页面控制权限");
  376. }
  377. if (e.link == "nurseConfig") {
  378. this.nurseConfigRole = true;
  379. console.log("护士端配置控制权限");
  380. }
  381. if (e.link == "PCCommutesToWork") {
  382. this.PCCommutesToWork = true;
  383. console.log("PC上下班");
  384. }
  385. if (e.type == "newStatistics") {
  386. this.newStatisticsRole = true;
  387. console.log("新版统计");
  388. }
  389. if (e.link == "webRepairs") {
  390. this.webRepairs = true;
  391. console.log("PC上下班");
  392. }
  393. if (e.title == "故障管理") {
  394. let item = e.childrens.find(i=>i.link=="incidentManagement")
  395. if(item){
  396. let item2 = item.childrens.find(i=>i.link=="add")
  397. if(item2){
  398. this.speediness = true
  399. console.log("新增故障工单权限");
  400. }
  401. }
  402. }
  403. if (!e.link) {
  404. arr.push(e);
  405. }
  406. });
  407. this.menus = arr.filter(v => v.type === 'default');
  408. }
  409. // 判断登录是否已失效
  410. initLogin() {
  411. if (!this.userInfo) {
  412. this.msg.error("您的登录已失效,请重新登录!", {
  413. nzDuration: 3000,
  414. });
  415. setTimeout(() => {
  416. this.router.navigateByUrl("login");
  417. }, 2000);
  418. return;
  419. }
  420. }
  421. // 新密码失去焦点
  422. enoughRegFlag = true; //弱
  423. mediumRegFlag = false; //中
  424. strongRegFlag = false; //强
  425. blurNewPwd(){
  426. let enoughReg = /^.{0,6}$/;//密码强度-弱
  427. let strongReg = /^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[\!\@\#\$\%\^\&\*]).{9,}$/;//密码强度-强
  428. this.enoughRegFlag = enoughReg.test(this.upModalData.newPwd);
  429. this.strongRegFlag = strongReg.test(this.upModalData.newPwd);
  430. this.mediumRegFlag = !this.enoughRegFlag && !this.strongRegFlag;
  431. console.log(this.enoughRegFlag,this.mediumRegFlag,this.strongRegFlag);
  432. }
  433. // 跳转页面
  434. menuLabel: string; //当前菜单名称
  435. indexFlag = localStorage.getItem("index") === "true" ? true : false; //首页高亮
  436. toMenu(title, item?, data?) {
  437. sessionStorage.setItem("title", title);
  438. this.menuLabel = sessionStorage.getItem("title");
  439. if (item && data) {
  440. // 首页取消高亮
  441. this.indexFlag = false;
  442. localStorage.setItem("index", "false");
  443. // 操作本地存储
  444. let menus = JSON.parse(localStorage.getItem("menu"));
  445. menus.forEach((item1) => {
  446. item1.flagBg = false;
  447. if (item1.childrens) {
  448. item1.childrens.forEach((value) => {
  449. value.flag = false;
  450. });
  451. }
  452. });
  453. let obj = menus.find((value) => value.id == data.id);
  454. obj.flagBg = true;
  455. obj.flag = true;
  456. obj.childrens.find((value) => value.id == item.id).flag = true;
  457. localStorage.setItem("menu", JSON.stringify(menus));
  458. // 操作菜单一级 二级
  459. this.menus = menus.filter((item) => !item.link);
  460. } else {
  461. // 首页高亮
  462. this.indexFlag = true;
  463. localStorage.setItem("index", "true");
  464. // 操作本地存储
  465. let menus = JSON.parse(localStorage.getItem("menu"));
  466. menus.forEach((item1) => {
  467. item1.flagBg = false;
  468. // item1.flag = false;
  469. if (item1.childrens) {
  470. item1.childrens.forEach((value) => {
  471. value.flag = false;
  472. });
  473. }
  474. });
  475. localStorage.setItem("menu", JSON.stringify(menus));
  476. // 操作菜单一级 二级
  477. this.menus = menus.filter((item) => !item.link);
  478. }
  479. }
  480. // 子路由跳转事件
  481. activeRoute() {
  482. this.menuLabel = sessionStorage.getItem("title");
  483. }
  484. /* 新增报修 start*/
  485. // 打开新建工单
  486. currentTabIndex:any = '故障报修'
  487. noWorkerPhone = false; //请求是否携带来电号码
  488. patientList; //患者信息列表
  489. isLoading: Boolean = false; //下拉框loading
  490. disX = 0; //移动的距离
  491. disStep = 0; //移动的步长
  492. applicationDepartmentList = []; //新建工单->申请科室列表(搜索)
  493. callNumber = ""; //来电号码
  494. workTypes = []; //任务类型
  495. workTypesArrange = []; //整理后的任务类型
  496. workTypesFlag = false; //任务类型是否显示操作项
  497. radioValueZy: any = ""; //转运->类型
  498. radioValueZyPre: any = ""; //转运->类型
  499. deptZyList: any = {}; //转运->请求结果
  500. startDeptZy = ""; //转运->选中起点科室
  501. endDeptZy = ""; //转运->选中终点科室
  502. patientZy = ""; //转运->选中患者编码
  503. radioValueQt: any = ""; //转运->类型
  504. deptQtList: any = {}; //其他->请求结果
  505. startDeptQt = ""; //其他->选中起点科室
  506. endDeptQt = ""; //其他->选中终点科室
  507. workOrderRemark = ""; //工单备注
  508. workOrderRemarkZy = ""; //工单备注
  509. // 新建工单弹框
  510. newOrderShow = false; //展示/隐藏新建工单弹框
  511. newOrderShowOpen = false; //展示/隐藏新建工单弹框(辅助项)
  512. isOkLoading = false; //确认按钮loading状态
  513. applyDept; //申请科室
  514. applyDeptMiddle; //申请科室(中间传递)
  515. taskBuild; //任务类型选择
  516. residenceNo; //住院号
  517. targetDept; //目标科室
  518. noArrives = []; //未到达列表
  519. newLoading = false; //loading
  520. //防抖
  521. changeInpSubject = new Subject();
  522. changeCommonInpSubject = new Subject();
  523. onSearchTaskBuildSubject = new Subject();
  524. searchHosDepartmentSubject = new Subject();
  525. searchHosDepartmentQtSubject = new Subject();
  526. searchPatientListSubject = new Subject();
  527. inspectSubject = new Subject();
  528. changeAssetInpSubject = new Subject();
  529. // 运维相关
  530. incidentModel:any = {};
  531. incidentMsg:any = {};
  532. // 初始化增删改按钮
  533. coopBtns: any = {};
  534. 工单范围设置回显
  535. checkedHos;// 配送-院区选择
  536. checkedHosDTO;// 配送-院区选择
  537. scopeGroups = []; //配送-当前所属人员分组
  538. orderScopeRadio;// 配送-工单范围
  539. itsmCheckedHos;// 运维-院区选择
  540. itsmScopeGroups = []; //运维-当前所属人员分组
  541. itsmOrderScopeRadio;// 运维-工单范围
  542. coopData:any;
  543. hsmsData: any = {
  544. checkedHos: undefined,
  545. scopeGroups: [],
  546. orderScopeRadio: '0',
  547. }; //转运工单范围相关信息
  548. itsmData: any = {
  549. checkedHos: [],
  550. scopeGroups: [],
  551. orderScopeRadio: '0',
  552. }; //运维工单范围相关信息
  553. flagList:any = {
  554. itsmFlag1: false,
  555. hsmsFlag1: false,
  556. itsmFlag2: false,
  557. hsmsFlag2: false,
  558. itsmFlag3: false,
  559. hsmsFlag3: false,
  560. }
  561. tabs:any;
  562. showInitModal:boolean = false;
  563. // 定时刷新数据
  564. refreshTimerId; //定时刷新定时器
  565. refresh() {
  566. clearTimeout(this.refreshTimerId);
  567. this.refreshTimerId = setTimeout(() => {
  568. this.refresh()
  569. this.orderRefreshTime--;
  570. if (this.orderRefreshTime == 0) {
  571. if (this.currentRTab === 0) {
  572. this.getWorkOrders(this.applyDept);
  573. } else if (this.currentRTab === 1) {
  574. this.getPatientLog(this.applyDept);
  575. } else if (this.currentRTab === 2) {
  576. this.getItsmOrders(this.incidentModel.department);
  577. } else if (this.currentRTab === 3) {
  578. this.getDictionaryList();
  579. }
  580. this.orderRefreshTime = this.orderInfoTime;
  581. }
  582. }, 1000);
  583. }
  584. showOrderScope() {
  585. this.showInitModal = true;
  586. this.refresh()
  587. }
  588. initOrderScope() {
  589. // let scopeInfo = this.user.user.scope;
  590. // let hsoObj = this.user.user.currentHospital;
  591. // this.currentHospital.id = hsoObj.hospitalId ? hsoObj.hospitalId.id : undefined;
  592. // this.checkedHosDTO = scopeInfo.hospitalId || undefined;
  593. // this.orderScopeRadio = scopeInfo.range + "";
  594. // let groupIds = scopeInfo.groupIds || [];
  595. // let dutyGroupList = scopeInfo.dutyGroupList || [];
  596. // this.scopeGroups = dutyGroupList.concat(groupIds);
  597. // if(this.scopeGroups.length){
  598. // this.typeId = this.scopeGroups[0].id;
  599. // }
  600. // this.hsmsData = {
  601. // checkedHos: this.currentHospital.id,
  602. // checkedHosDTO: this.checkedHosDTO,
  603. // scopeGroups: this.scopeGroups,
  604. // orderScopeRadio: this.orderScopeRadio || '0',
  605. // hsmsSwitch: scopeInfo.hsmsSwitch === 1,
  606. // }
  607. // this.flagList.hsmsFlag1 = this.hsmsData.hsmsSwitch;
  608. // this.flagList.hsmsFlag2 = this.hsmsData.hsmsSwitch;
  609. // this.flagList.hsmsFlag3 = this.hsmsData.hsmsSwitch;
  610. // this.itsmCheckedHos = scopeInfo.dutyList || [];
  611. // this.itsmOrderScopeRadio = scopeInfo.dutyRange + "";
  612. // this.itsmScopeGroups = scopeInfo.dutyGroupList || [];
  613. // this.itsmData = {
  614. // checkedHos: this.itsmCheckedHos,
  615. // scopeGroups: this.itsmScopeGroups,
  616. // orderScopeRadio: this.itsmOrderScopeRadio || '0',
  617. // mdv2Switch: scopeInfo.mdv2Switch === 1,
  618. // allDuty: scopeInfo.allDuty === undefined ? 1 : scopeInfo.allDuty,
  619. // showReassign: scopeInfo.showReassign == null || scopeInfo.showReassign == 0 ? 0 : 1,
  620. // }
  621. // this.flagList.itsmFlag1 = this.itsmData.mdv2Switch;
  622. // this.flagList.itsmFlag2 = this.itsmData.mdv2Switch;
  623. // this.flagList.itsmFlag3 = this.itsmData.mdv2Switch;
  624. this.showNewOrder();
  625. this.getHospitalConfigList('allowNucleicAcidPrinting');
  626. this.getConfigTasktype();
  627. this.patientLogTasktype();
  628. }
  629. // 获取院区配置配置,是否核酸打印
  630. getHospitalConfigList(key) {
  631. // if(!this.hsmsData.hsmsSwitch){
  632. // return;
  633. // }
  634. let postData = { idx: 0, sum: 1, hospitalConfig: { hosId: this.currentHospital.id, key } };
  635. this.mainService.getFetchDataList("simple/data", "hospitalConfig", postData).subscribe(result=>{
  636. if(result.status == 200){
  637. this.isShowNucleicAcidPrinting = result.list[0].value == 1;
  638. }else{
  639. this.isShowNucleicAcidPrinting = false;
  640. }
  641. });
  642. }
  643. // 获取配置文件写死的任务类型ID(送病人回病房9),选择此任务类型的话,患者信息从终点科室获取
  644. getConfigTasktypeLoading: boolean = false;
  645. getConfigTasktype() {
  646. // if(!this.hsmsData.hsmsSwitch){
  647. // return;
  648. // }
  649. let postData = {
  650. idx: 0,
  651. sum: 1,
  652. hospitalConfig: {
  653. hosId: this.currentHospital.id,
  654. key: "rebackPatientTypeId",
  655. },
  656. };
  657. this.getConfigTasktypeLoading = true;
  658. this.mainService.getFetchDataList("simple/data", "hospitalConfig", postData).subscribe(res => {
  659. this.getConfigTasktypeLoading = false;
  660. if (res && res.status == 200) {
  661. this.deathTasktypeId = res.list.length ? res.list[0].value : undefined;
  662. } else {
  663. this.msg.error('请求数据失败');
  664. }
  665. });
  666. }
  667. // 获取配置文件写死的任务类型ID(转科,给转出院记录用6)
  668. patientLogTasktypeLoading: boolean = false;
  669. patientLogTasktype() {
  670. // if(!this.hsmsData.hsmsSwitch){
  671. // return;
  672. // }
  673. let postData = {
  674. idx: 0,
  675. sum: 1,
  676. systemConfiguration: {
  677. keyconfig: "transDeptTypeId",
  678. },
  679. };
  680. this.patientLogTasktypeLoading = true;
  681. this.mainService.getFetchDataList("simple/data", "systemConfiguration", postData).subscribe(res => {
  682. this.patientLogTasktypeLoading = false;
  683. if (res.status == 200) {
  684. this.deathTasktypeIdPatient = res.list.length ? res.list[0].valueconfig : undefined;
  685. } else {
  686. this.msg.error('请求数据失败');
  687. }
  688. });
  689. }
  690. // 重置新建工单数据
  691. solutionId:any;
  692. resetOrderData(){
  693. this.applicationRequesterList = [];
  694. this.fileList = [];
  695. this.repairImgs = [];
  696. this.isRelatedDepartment = true;
  697. this.solutionId = undefined;
  698. delete this.incidentMsg.requesterPhone;
  699. }
  700. // 重置新建工单数据-继续建单-编辑-报修转事件
  701. resetOrderData2(){
  702. this.fileList = [];
  703. this.repairImgs = [];
  704. if(this.incidentModel.repairIncidentType === 'public'){
  705. this.isRelatedDepartment = false;
  706. }else{
  707. this.isRelatedDepartment = true;
  708. }
  709. }
  710. // 获取院区配置配置,是否核酸打印
  711. currentRTab:any;
  712. rightTitle_tab:any = [];
  713. inspectToday:any;
  714. isShowNucleicAcidPrinting = false;
  715. deathTasktypeId; //获取这个写死的任务类型的id,送病人回病房
  716. deathTasktypeIdPatient; //获取这个写死的任务类型的id,转出院记录
  717. showNewOrder(des = '', phone = '', isInit = false, buildType = '') {
  718. this.buildType = buildType;
  719. console.log(123,buildType)
  720. // if(this.itsmData.mdv2Switch){
  721. console.log(456, this.itsmData)
  722. if(this.buildType !== '继续建单' && this.buildType !== '编辑事件' && this.buildType !== '报修转事件'){
  723. this.resetOrderData();
  724. }else{
  725. this.resetOrderData2();
  726. }
  727. this.searchApplicationHospital();
  728. this.searchApplicationCategory();
  729. this.searchApplicationPriority();
  730. this.searchApplicationSource();
  731. this.getRepairIncidentType();
  732. isInit ? this.searchApplicationDepartment('itsm', undefined, undefined, undefined, true) : this.searchApplicationDepartment('itsm');
  733. isInit && ((this.isRelatedDepartment && this.incidentModel.department) || (!this.isRelatedDepartment && this.incidentModel.hosId) || this.buildType === '报修转事件' ) && this.incidentModel.hosId && this.searchApplicationBuilding();
  734. isInit && this.incidentModel.area && this.searchApplicationFloor();
  735. if(!this.hsmsData.hsmsSwitch){
  736. this.taskBuild = null;
  737. this.residenceNo = null;
  738. this.newOrderShow = true;
  739. this.newOrderShowOpen = true;
  740. this.fixedTab = "newOrder";
  741. this.currentRTab = 0;
  742. this.rightTitle_tab = [];
  743. this.incidentModel = isInit ? this.incidentModel : { repairIncidentType: 'dept' };
  744. this.incidentMsg = isInit ? this.incidentMsg : {};
  745. this.isBuildOrderAgagin = false;
  746. this.applyDept = null;
  747. this.countRemarkIndex = -1;
  748. this.incidentModel.department = isInit ? this.incidentModel.department : null;
  749. //正常初始化
  750. this.getAutoWorkTypes(false, isInit);
  751. this.newOrderShowOpen = true
  752. }
  753. // }
  754. // 预约相关重置
  755. this.yyDateZy = new Date();
  756. this.yyDate = new Date();
  757. this.yyTimeZy = null;
  758. this.yyTime = null;
  759. this.isYyInspect = false;
  760. this.clickYYZyFlag = false;
  761. this.clickYYFlag = false;
  762. this.inspectToday = new Date();
  763. // if(!isInit && this.hsmsData.hsmsSwitch){
  764. // if(!this.deathTasktypeId){
  765. // // 送病人回病房
  766. // this.msg.error('【送病人回病房】未配置');
  767. // return;
  768. // }
  769. // if(!this.deathTasktypeIdPatient){
  770. // // 转出院记录
  771. // this.msg.error('【转出院记录】未配置');
  772. // return;
  773. // }
  774. // }
  775. this.taskBuild = null;
  776. this.residenceNo = null;
  777. this.newOrderShow = true;
  778. this.newOrderShowOpen = true;
  779. this.fixedTab = "newOrder";
  780. this.currentRTab = 0;
  781. this.rightTitle_tab = [];
  782. this.incidentModel = isInit ? this.incidentModel : { repairIncidentType: 'dept' };
  783. this.incidentMsg = isInit ? this.incidentMsg : {};
  784. this.isBuildOrderAgagin = false;
  785. this.applyDept = null;
  786. this.countRemarkIndex = -1;
  787. this.incidentModel.department = isInit ? this.incidentModel.department : null;
  788. console.log(des);
  789. if (des === "no") {
  790. //没绑定科室
  791. this.searchApplicationDepartment("hsms", "", phone);
  792. this.noWorkerPhone = false;
  793. } else if (des === "yes") {
  794. //绑定了科室
  795. this.searchApplicationDepartment("hsms", "&ks&");
  796. this.noWorkerPhone = false;
  797. } else if (des === "&go&") {
  798. //继续建单
  799. this.searchApplicationDepartment("hsms", "&go&");
  800. this.noWorkerPhone = false;
  801. } else {
  802. //正常初始化
  803. this.searchApplicationDepartment("hsms");
  804. this.noWorkerPhone = true;
  805. }
  806. this.getSearchTaskList("").subscribe((result) => {
  807. if (result.status == 200) {
  808. this.searchTaskLoading = false;
  809. this.searchTaskList = result.data;
  810. this.searchTaskList.forEach((item) => {
  811. item.sid = item.associationTypeId + "_" + item.id + "_" + item.associationTypeValue;
  812. });
  813. // if(phone){
  814. // this.getAutoWorkTypes(true, isInit);
  815. // }else{
  816. // this.getAutoWorkTypes(false, isInit);
  817. // }
  818. this.getAutoWorkTypes(false, isInit);
  819. }
  820. });
  821. }
  822. // 获取可选择的任务类型列表
  823. searchTaskList;
  824. searchTaskLoading = false;
  825. getSearchTaskList(keyword, countRemark = '') {
  826. // if(!this.hsmsData.hsmsSwitch){
  827. // return;
  828. // }
  829. this.searchTaskLoading = true;
  830. return this.mainService.getTaskTypeBySearchKey({
  831. searchKey: keyword || undefined,
  832. countRemark: countRemark || undefined,
  833. hosId: this.currentHospital.id,
  834. });
  835. }
  836. rightTitleHandler(i) {
  837. this.currentRTab = i;
  838. if (i === 0) {
  839. this.getWorkOrders(this.applyDept);
  840. } else if (i === 1) {
  841. this.getPatientLog(this.applyDept);
  842. } else if (i === 2) {
  843. this.getItsmOrders(this.incidentModel.department);
  844. } else if (i === 3) {
  845. this.getDictionaryList();
  846. }
  847. }
  848. patientLogList:any;
  849. loading5:boolean = false
  850. getPatientLog(id) {
  851. // if(!this.hsmsData.hsmsSwitch){
  852. // return;
  853. // }
  854. if (id == -1 || id === null || id === undefined) {
  855. this.patientLogList = [];
  856. return;
  857. }
  858. let postData = {
  859. patientLog: {
  860. sqDept: { id },
  861. hosId: this.currentHospital.id,
  862. },
  863. idx: 0,
  864. sum: 10000,
  865. };
  866. this.loading5 = true;
  867. this.mainService
  868. .getFetchDataList("api", "patientLog", postData)
  869. .subscribe((result) => {
  870. this.loading5 = false;
  871. if (result.status == 200) {
  872. this.patientLogList = result.list;
  873. }
  874. });
  875. }
  876. // 服务台新建工单—根据申请科室id来查询未到达工单(科室id)
  877. loading4 = false;
  878. getWorkOrders(id) {
  879. // if(!this.hsmsData.hsmsSwitch){
  880. // return;
  881. // }
  882. if (id == -1 || id === null || id === undefined) {
  883. this.noArrives = [];
  884. return;
  885. }
  886. // let types = "";
  887. // this.user.user.scope.typeIds.forEach((e) => {
  888. // types += e.id + ",";
  889. // });
  890. // types = types.slice(0, types.length - 1);
  891. let dataObj = {
  892. workOrder: {
  893. serTaskTypes: null,
  894. // serGdState: 4,
  895. range: "0",
  896. platform: 3,
  897. searchDays: 100,
  898. createDept: this.applyDept
  899. // startDept: {
  900. // id: id,
  901. // },
  902. },
  903. idx: 0,
  904. sum: 5,
  905. };
  906. this.loading4 = true;
  907. this.mainService
  908. .getFetchDataList("data", "workOrder", dataObj)
  909. .subscribe((data) => {
  910. this.loading4 = false;
  911. if (data.status == 200) {
  912. this.noArrives = data.list;
  913. }
  914. });
  915. }
  916. // 服务台新建工单—根据申请科室id来查询
  917. loading6 = false;
  918. itsmOrders:any[] = [];
  919. getItsmOrders(id) {
  920. // if(!this.itsmData.mdv2Switch){
  921. // return;
  922. // }
  923. if ((id == -1 || id === null || id === undefined ) && this.incidentModel.repairIncidentType === 'dept') {
  924. this.itsmOrders = [];
  925. return;
  926. }
  927. if(!this.incidentModel.department && this.incidentModel.repairIncidentType === 'dept'){
  928. this.itsmOrders = [];
  929. return;
  930. }
  931. let postData = {
  932. incident: {
  933. "deleteFlag": 0,
  934. queryTask: 'all',
  935. department: {
  936. id,
  937. },
  938. requester:{
  939. id:null
  940. }
  941. },
  942. idx: 0,
  943. sum: 6,
  944. };
  945. if(this.incidentModel.repairIncidentType === 'public'){
  946. if(!this.incidentModel.requester){
  947. this.itsmOrders = [];
  948. return
  949. }
  950. postData.incident.requester.id = this.incidentModel.requester || null
  951. delete postData.incident.department
  952. }else{
  953. delete postData.incident.requester
  954. }
  955. this.loading6 = true;
  956. this.mainService
  957. .getFetchDataList("simple/data", "incident", postData)
  958. .subscribe((data) => {
  959. this.loading6 = false;
  960. if (data.status == 200) {
  961. this.itsmOrders = data.list;
  962. }
  963. });
  964. }
  965. //获取知识库状态/类型
  966. getDictionaryList() {
  967. let solutionStatus$ = this.mainService.getDictionary('list', 'solution_status', true);
  968. let solutionType$ = this.mainService.getDictionary('list', 'solution_type', true);
  969. forkJoin(solutionStatus$, solutionType$).subscribe((data:any[]) => {
  970. let solutionStatusList = data[0] || [];
  971. let solutionTypeList = data[1] || [];
  972. this.solutionStatus = solutionStatusList.find(item => item.value == 3);
  973. console.log('this.solutionStatus:', this.solutionStatus)
  974. this.solutionType = solutionTypeList.find(item => item.value == 1);
  975. console.log('this.solutionType:', this.solutionType)
  976. this.getKnowageList();
  977. })
  978. }
  979. solutionStatus;//知识库状态
  980. solutionType;//知识库类型
  981. // 服务台新建工单—知识库
  982. loading7 = false;
  983. knowageList:any[] = [];
  984. getKnowageList() {
  985. // if(!this.itsmData.mdv2Switch){
  986. // return;
  987. // }
  988. if(!(this.incidentModel.category && this.solutionStatus && this.solutionType)){
  989. this.loading7 = false;
  990. this.knowageList = [];
  991. return;
  992. }
  993. this.loading7 = true;
  994. let postData:any = {
  995. idx: 0,
  996. sum: 9999,
  997. solution: {
  998. categoryId: this.incidentModel.category,
  999. status: this.solutionStatus,
  1000. type: this.solutionType,
  1001. },
  1002. };
  1003. this.mainService
  1004. .getFetchDataList('simple/data', 'solution', postData)
  1005. .subscribe((result) => {
  1006. this.loading7 = false;
  1007. if(result.status == 200){
  1008. this.knowageList = result.list || [];
  1009. }else{
  1010. this.msg.error(result.msg || '请求数据失败!');
  1011. }
  1012. });
  1013. }
  1014. // 引入知识库
  1015. importKnowage(item){
  1016. console.log(item)
  1017. this.incidentModel = {...this.incidentModel, description: `引用知识库解决,知识库编号:${item.solutionNumber}`};
  1018. this.solutionId = item.id;
  1019. }
  1020. // 知识库查看-知道了
  1021. isShowKnowledge:boolean = false;
  1022. showKnowledgeModal(data) {
  1023. this.coopData = data || {};
  1024. this.isShowKnowledge = true;
  1025. }
  1026. cancelKnowledgeModal(flag) {
  1027. this.isShowKnowledge = false;
  1028. }
  1029. // 获取患者信息
  1030. searchPatientList(id, searchWords) {
  1031. this.searchPatientListSubject.next([id, searchWords]);
  1032. }
  1033. // 获取患者信息
  1034. isLoadingPatient: boolean = false;
  1035. getPatientList(id, searchWords, patient?) {
  1036. if(patient){
  1037. this.patientList = [patient];
  1038. return;
  1039. }
  1040. if(!id){
  1041. this.patientList = [];
  1042. return;
  1043. }
  1044. let dataObj = { searchWords, deptId: id };
  1045. this.isLoadingPatient = true;
  1046. this.mainService.getPatientList(dataObj).subscribe((result) => {
  1047. this.isLoadingPatient = false;
  1048. if (result["state"] == 200) {
  1049. this.patientList = result["data"];
  1050. // if (this.patientList.length) {
  1051. // this.patientList = this.patientList.filter((item) => !!item.bednum);
  1052. // }
  1053. }
  1054. });
  1055. }
  1056. // 根据住院号获取患者信息
  1057. getPatientByResidenceNo(residenceNo) {
  1058. let postData = {
  1059. residenceNo,
  1060. hosId: this.currentHospital.id,
  1061. idx: 0,
  1062. sum: 2,
  1063. };
  1064. this.mainService.listMsgByMain('listPatient',postData).subscribe((result) => {
  1065. if (result["status"] == 200) {
  1066. let patientList = result["list"];
  1067. if (patientList.length) {
  1068. patientList = patientList.filter((item) => !!item.bedNum);
  1069. }
  1070. if(patientList.length === 1){
  1071. let patient = patientList[0];
  1072. patient.bednum = patient.bedNum;
  1073. patient.patientname = patient.patientName;
  1074. patient.department && (this.applicationDepartmentList = [patient.department]);
  1075. patient.department && (this.applyDept = patient.department.id);
  1076. // patient.department && (this.patientList = [patient]);
  1077. patient.department && (this.patientZy = patient.patientCode);
  1078. console.log(this.patientList)
  1079. }else{
  1080. this.msg.warning('未查询到患者');
  1081. }
  1082. }
  1083. });
  1084. }
  1085. // tab任务类型向左移动
  1086. elementView:any;
  1087. toLeft() {
  1088. let maxStep = this.workTypesArrange.length - 5;
  1089. this.disStep = Math.max(-maxStep, --this.disStep);
  1090. this.disX = (this.disStep * this.elementView.nativeElement.offsetWidth) / 5;
  1091. }
  1092. // tab任务类型向右移动
  1093. toRight() {
  1094. this.disStep = Math.min(0, ++this.disStep);
  1095. this.disX = (this.disStep * this.elementView.nativeElement.offsetWidth) / 5;
  1096. }
  1097. // 边输边搜节流阀
  1098. // WS;//边输入边搜索的定时器
  1099. WSNum = 0;
  1100. changeInp(type, e) {
  1101. this.changeInpSubject.next([type, e]);
  1102. }
  1103. changeCommonInp(type, e) {
  1104. this.changeCommonInpSubject.next([type, e]);
  1105. }
  1106. // 院区列表
  1107. applicationHospitalList:any[] = [];
  1108. searchApplicationHospital() {
  1109. this.applicationHospitalList = this.tool.getHospitalList().filter(i=> !i.parent && !i.type);
  1110. this.incidentModel.hosId = this.currentHospital.id;
  1111. // let dataObj = {
  1112. // idx: 0,
  1113. // sum: 9999,
  1114. // hospital: {
  1115. // selectType:'level1',
  1116. // },
  1117. // };
  1118. // this.isLoading = true;
  1119. // this.mainService
  1120. // .getFetchDataList("data", "hospital", dataObj)
  1121. // .subscribe((data) => {
  1122. // this.isLoading = false;
  1123. // if (data.status == 200) {
  1124. // this.applicationHospitalList = data.list;
  1125. // this.incidentModel.hosId = this.currentHospital.id;
  1126. // }
  1127. // });
  1128. }
  1129. // 选择院区
  1130. changeApplyHospital(e){
  1131. console.log(e);
  1132. // this.incidentModel.department = undefined;
  1133. this.searchApplicationDepartment('itsm');
  1134. if(this.cmdbRepair){
  1135. this.incidentModel.assetId = null;
  1136. this.getAssetData()
  1137. }
  1138. if(this.buildType !== '报修转事件'){
  1139. this.incidentModel.requester = undefined;
  1140. this.searchApplicationRequester();
  1141. }
  1142. this.applicationRequesterList = [];
  1143. this.incidentModel.area = undefined;
  1144. this.searchApplicationBuilding();
  1145. this.incidentModel.place = undefined;
  1146. this.applicationFloorList = [];
  1147. this.incidentModel.houseNumber = undefined;
  1148. this.incidentModel.duty = undefined;
  1149. // 根据院区和故障现象带出责任部门,优先级,维修人/组
  1150. if(this.incidentModel.category && e && this.buildType !== '编辑事件'){
  1151. let postData = {
  1152. idx: 0,
  1153. sum: 9999,
  1154. incidentCategoryConfig: {
  1155. categoryId: this.incidentModel.category,
  1156. hosId: e,
  1157. },
  1158. };
  1159. console.log(postData);
  1160. // return;
  1161. this.isLoading = true;
  1162. this.mainService
  1163. .getFetchDataList("simple/data", "incidentCategoryConfig", postData)
  1164. .subscribe((data) => {
  1165. this.isLoading = false;
  1166. if (data.status == 200) {
  1167. let list = data.list || [];
  1168. if(list.length > 0){
  1169. console.log(list[0]);
  1170. this.incidentCategoryConfig = list[0];
  1171. }else{
  1172. this.incidentCategoryConfig = {};
  1173. }
  1174. // 根据院区和故障现象带出责任部门,优先级,维修人/组
  1175. this.incidentModel.duty = this.incidentCategoryConfig.dutyDTO;
  1176. this.incidentModel.priorityId = this.incidentCategoryConfig.priority;
  1177. // 回显维修人/组
  1178. this.showGroupOrUser();
  1179. }
  1180. });
  1181. }else{
  1182. this.incidentModel.group = undefined;
  1183. this.applicationGroupList = [];
  1184. this.incidentModel.user = undefined;
  1185. this.applicationUserList = [];
  1186. }
  1187. }
  1188. // 申请人列表(搜索)
  1189. applicationRequesterList:any[] = [];
  1190. isRelatedDepartment:boolean = true;
  1191. searchApplicationRequester(keyWord?) {
  1192. // 关联查询,且没选择申请科室
  1193. if(this.isRelatedDepartment && !this.incidentModel.department){
  1194. this.applicationRequesterList = [];
  1195. return;
  1196. }
  1197. // 不关联查询,且没选择院区
  1198. if(!this.isRelatedDepartment && !this.incidentModel.hosId){
  1199. this.applicationRequesterList = [];
  1200. return;
  1201. }
  1202. let postData = {
  1203. idx: 0,
  1204. sum: 20,
  1205. user: {
  1206. statisticalHosId: this.isRelatedDepartment ? undefined : this.incidentModel.hosId,
  1207. // hospital: this.isRelatedDepartment ? undefined : { id: this.incidentModel.hosId },
  1208. dept: this.isRelatedDepartment ? { id: this.incidentModel.department } : undefined,
  1209. name: keyWord,
  1210. // simpleQuery: true,
  1211. },
  1212. };
  1213. this.isLoading = true;
  1214. this.mainService
  1215. .getFetchDataList("simple/data", "user", postData)
  1216. .subscribe((data) => {
  1217. this.isLoading = false;
  1218. if (data.status == 200) {
  1219. this.applicationRequesterList = data.list;
  1220. }
  1221. });
  1222. }
  1223. // 修改申请人
  1224. changeApplyRequester(e){
  1225. console.log(e)
  1226. let userObj = this.applicationRequesterList.find(v => v.id == e);
  1227. // 选择申请人回显申请人电话
  1228. if(userObj){
  1229. this.incidentMsg.requesterPhone = userObj.phone;
  1230. }
  1231. if(this.incidentModel.repairIncidentType === 'public'){
  1232. this.getItsmOrders('')
  1233. if(this.cmdbRepair){
  1234. this.incidentModel.assetId = null;
  1235. this.getAssetData()
  1236. }
  1237. }
  1238. }
  1239. // 故障现象列表
  1240. applicationCategoryList:any[] = [];
  1241. searchApplicationCategory(keyWord?) {
  1242. let list = this.tool.getUserInfoPermission().dutyList
  1243. let dutyIds = list.map(i => {
  1244. return i.id
  1245. })
  1246. // if(this.buildType === '编辑事件'){
  1247. // dutyIds = this.incidentModel.duty.id.toString();
  1248. // }else{
  1249. // dutyIds = this.itsmData.checkedHos.length ? (this.itsmData.checkedHos.map(v => v.id).toString() || undefined) : undefined;
  1250. // }
  1251. let postData = {
  1252. category: {
  1253. // hosId: this.currentHospital.id,
  1254. category: keyWord,
  1255. selectType: 'mutlQuery',
  1256. hierarchy: 3,//只差有三级的故障现象列表
  1257. dutyIds: dutyIds.toString(),
  1258. },
  1259. };
  1260. console.log(postData);
  1261. // return;
  1262. this.isLoading = true;
  1263. this.mainService
  1264. .incidentPost("listIncidentCategory", postData)
  1265. .subscribe((data) => {
  1266. this.isLoading = false;
  1267. if (data.status == 200) {
  1268. this.applicationCategoryList = data.data;
  1269. }
  1270. });
  1271. }
  1272. // 修改故障现象
  1273. incidentCategoryConfig:any = {};//当前匹配的故障现象规则
  1274. changeApplyCategory(e, isCoverage = false){
  1275. console.log(e)
  1276. // 知识库
  1277. this.getKnowageList();
  1278. if(e && !isCoverage){
  1279. // 根据故障现象带出故障描述
  1280. if(this.incidentModel.description){
  1281. this.incidentModel.description = this.incidentModel.description + ';' + this.applicationCategoryList.find(v => v.id == e).mutiCategory;
  1282. }else{
  1283. this.incidentModel.description = this.applicationCategoryList.find(v => v.id == e).mutiCategory;
  1284. }
  1285. }
  1286. // 根据院区和故障现象带出责任部门,优先级,维修人/组
  1287. if(this.incidentModel.hosId && e && this.buildType !== '编辑事件'){
  1288. let postData = {
  1289. idx: 0,
  1290. sum: 9999,
  1291. incidentCategoryConfig: {
  1292. categoryId: e,
  1293. hosId: this.incidentModel.hosId,
  1294. },
  1295. };
  1296. console.log(postData);
  1297. // return;
  1298. this.isLoading = true;
  1299. this.mainService
  1300. .getFetchDataList("simple/data", "incidentCategoryConfig", postData)
  1301. .subscribe((data) => {
  1302. this.isLoading = false;
  1303. if (data.status == 200) {
  1304. let list = data.list || [];
  1305. if(list.length > 0){
  1306. console.log(list[0]);
  1307. this.incidentCategoryConfig = list[0];
  1308. }else{
  1309. this.incidentCategoryConfig = {};
  1310. }
  1311. // 根据院区和故障现象带出责任部门,优先级,维修人/组
  1312. this.incidentModel.duty = this.incidentCategoryConfig.dutyDTO;
  1313. this.incidentModel.priorityId = this.incidentCategoryConfig.priority;
  1314. // 回显维修人/组
  1315. this.showGroupOrUser();
  1316. }
  1317. });
  1318. }else{
  1319. this.incidentModel.group = undefined;
  1320. this.applicationGroupList = [];
  1321. this.incidentModel.user = undefined;
  1322. this.applicationUserList = [];
  1323. }
  1324. }
  1325. // 直接解决-弹窗
  1326. directOrderModalShow = false; //弹窗开关
  1327. showDirectOrder() {
  1328. console.log(669696)
  1329. this.directOrderModalShow = true;
  1330. }
  1331. // 关闭弹窗
  1332. closeDirectOrderModelOrder(e) {
  1333. this.directOrderModalShow = JSON.parse(e).show;
  1334. }
  1335. // 弹窗确定
  1336. confirmDirectOrderModelOrder(incidentModel){
  1337. console.log(incidentModel);
  1338. this.maskFlag = this.msg.loading("正在加载中..", {
  1339. nzDuration: 0,
  1340. }).messageId;
  1341. this.incidentModel = {...this.incidentModel, ...incidentModel};
  1342. let category = this.applicationCategoryList.find(v => v.id == this.incidentModel.category);
  1343. let postData:any = {
  1344. solutionId: this.solutionId,
  1345. alarmId:null,
  1346. "incident": {
  1347. "id": this.incidentModel.id || undefined,
  1348. "deleteFlag": 0,
  1349. "duty": this.incidentModel.duty ? { id: this.incidentModel.duty.id } : undefined,
  1350. "requester": this.incidentModel.requester ? { id: this.incidentModel.requester } : undefined,
  1351. "repairIncidentType": this.incidentModel.repairIncidentType ? this.repairIncidentTypeList.find(v => v.value === this.incidentModel.repairIncidentType) : undefined,
  1352. "alarmType": false,
  1353. "department": this.incidentModel.department ? { id: this.incidentModel.department } : undefined,
  1354. "contactsInformation": this.incidentModel.contactsInformation,
  1355. "contacts": this.incidentModel.contacts,
  1356. "hosId": this.incidentModel.hosId || undefined,
  1357. "area": this.incidentModel.area ? { id: this.incidentModel.area } : undefined,
  1358. "place": this.incidentModel.place ? { id: this.incidentModel.place } : undefined,
  1359. "houseNumber": this.incidentModel.houseNumber,
  1360. "category": this.incidentModel.category ? { id: this.incidentModel.category } : undefined,
  1361. "priorityId": this.incidentModel.priorityId || undefined,
  1362. "source": this.incidentModel.source ? { id: this.incidentModel.source } : undefined,
  1363. // "title": category.mutiCategory,
  1364. "description": this.incidentModel.description,
  1365. "directProcess": 1,
  1366. "handleDescription": this.incidentModel.handleDescription,
  1367. "handlingPersonnelUser": {id: this.tool.getCurrentUserId()},
  1368. "yyTime": this.incidentModel.yyTime ? format(new Date(this.incidentModel.yyTime), 'yyyy-MM-dd HH:mm:ss') : undefined,
  1369. "closecode": this.incidentModel.closecode ? { id: this.incidentModel.closecode } : undefined,
  1370. "acceptUser": { id: this.tool.getCurrentUserId() },
  1371. "callID": this.incidentModel.callID || undefined,
  1372. "incomingPhone": this.incidentModel.incomingPhone || undefined,
  1373. "hjzxRecordId": this.incidentModel.hjzxRecordId || undefined,
  1374. "assetId": this.incidentModel.assetId || undefined
  1375. },
  1376. };
  1377. if(this.buildType){
  1378. if(this.buildType === '报修转事件'){
  1379. postData.incident.fromWx = true;
  1380. }
  1381. if(this.buildType !== '继续建单' && this.buildType !== '编辑事件' && this.buildType !== '报修转事件'){
  1382. postData.incident = Object.assign({}, postData.incident);
  1383. }else{
  1384. postData.incident = Object.assign({}, this.editOrder, postData.incident);
  1385. }
  1386. }
  1387. let url = null
  1388. if(this.eventData){
  1389. postData.alarmId = this.eventData.data.id
  1390. url = this.mainService.addAlarmIncident(postData)
  1391. }else{
  1392. delete postData.alarmId
  1393. url = this.mainService
  1394. .flowPost("incident/task/accept", postData)
  1395. }
  1396. url.subscribe((result) => {
  1397. this.msg.remove(this.maskFlag);
  1398. this.maskFlag = false;
  1399. if (result.state == 200) {
  1400. // 图片上传
  1401. if(this.fileList.length){
  1402. console.log(this.fileList.map(v => v.originFileObj));
  1403. this.fileList.map(v => v.originFileObj).forEach(async file => {
  1404. await this.uploadImages(file, result.data.id);
  1405. })
  1406. }
  1407. this.directOrderModalShow = false;
  1408. // this.msg.success('直接解决成功');
  1409. this.isBuildOrderAgaginFn();
  1410. } else {
  1411. this.msg.error(result.msg || '直接解决失败');
  1412. }
  1413. });
  1414. }
  1415. // 回显维修人/组
  1416. showGroupOrUser(){
  1417. // 先判断科室绑定人/组
  1418. if(this.incidentModel.department && this.incidentModel.category && this.incidentModel.duty){
  1419. let postData = {
  1420. idx: 0,
  1421. sum: 10,
  1422. incidentAssignManager: {
  1423. deptId: this.incidentModel.department,
  1424. categoryId: this.incidentModel.category,
  1425. hosId: this.incidentModel.duty.id,
  1426. operationType: 'queryConfig',
  1427. },
  1428. };
  1429. this.mainService
  1430. .getFetchDataList("simple/data", "incidentAssignManager", postData)
  1431. .subscribe((result) => {
  1432. if (result.status == 200) {
  1433. var deptBinduserConfig = result.list.length ? result.list[0] : null;//获取第一条配置
  1434. if(deptBinduserConfig){
  1435. console.log('deptBinduserConfig:', deptBinduserConfig)
  1436. // 如果有科室绑定人员的配置
  1437. if(deptBinduserConfig.handleGroupDTO){
  1438. this.incidentModel.group = deptBinduserConfig.handleGroupDTO.id;
  1439. this.applicationGroupList = [deptBinduserConfig.handleGroupDTO];
  1440. }else{
  1441. this.incidentModel.group = undefined;
  1442. this.applicationGroupList = [];
  1443. }
  1444. if(deptBinduserConfig.handleUserDTO){
  1445. this.incidentModel.user = deptBinduserConfig.handleUserDTO.id;
  1446. this.applicationUserList = [deptBinduserConfig.handleUserDTO];
  1447. }else{
  1448. this.incidentModel.user = undefined;
  1449. this.applicationUserList = [];
  1450. }
  1451. }else{
  1452. if(this.incidentModel.category){
  1453. // 选择了故障现象
  1454. if(this.incidentCategoryConfig.groupId && this.incidentCategoryConfig.groupDTO){
  1455. this.incidentModel.group = this.incidentCategoryConfig.groupId;
  1456. this.applicationGroupList = [this.incidentCategoryConfig.groupDTO];
  1457. }else{
  1458. this.incidentModel.group = undefined;
  1459. this.applicationGroupList = [];
  1460. }
  1461. if(this.incidentCategoryConfig.userId && this.incidentCategoryConfig.userDTO){
  1462. this.incidentModel.user = this.incidentCategoryConfig.userId;
  1463. this.applicationUserList = [this.incidentCategoryConfig.userDTO];
  1464. }else{
  1465. this.incidentModel.user = undefined;
  1466. this.applicationUserList = [];
  1467. }
  1468. }
  1469. }
  1470. }
  1471. });
  1472. }else{
  1473. if(this.incidentModel.category){
  1474. // 选择了故障现象
  1475. if(this.incidentCategoryConfig.groupId && this.incidentCategoryConfig.groupDTO){
  1476. this.incidentModel.group = this.incidentCategoryConfig.groupId;
  1477. this.applicationGroupList = [this.incidentCategoryConfig.groupDTO];
  1478. }else{
  1479. this.incidentModel.group = undefined;
  1480. this.applicationGroupList = [];
  1481. }
  1482. if(this.incidentCategoryConfig.userId && this.incidentCategoryConfig.userDTO){
  1483. this.incidentModel.user = this.incidentCategoryConfig.userId;
  1484. this.applicationUserList = [this.incidentCategoryConfig.userDTO];
  1485. }else{
  1486. this.incidentModel.user = undefined;
  1487. this.applicationUserList = [];
  1488. }
  1489. }
  1490. }
  1491. }
  1492. // 图片相关
  1493. showUploadList = {
  1494. showPreviewIcon: true,
  1495. showRemoveIcon: true,
  1496. hidePreviewIconInNonImage: true
  1497. };
  1498. fileList = [
  1499. // {
  1500. // uid: -1,
  1501. // name: 'xxx.png',
  1502. // status: '1',
  1503. // url: 'https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png'
  1504. // }
  1505. ];
  1506. previewImage: string | undefined = '';
  1507. previewVisible = false;
  1508. handlePreview = (file: UploadFile) => {
  1509. console.log('file1:', file)
  1510. this.previewImage = file.url || file.thumbUrl;
  1511. this.previewVisible = true;
  1512. };
  1513. beforeUpload = (file: UploadFile): boolean => {
  1514. console.log('file2:', file)
  1515. this.fileList = [...this.fileList, file];
  1516. setTimeout(async () => {
  1517. file.url = await this.getBase64(file);
  1518. }, 0);
  1519. console.log('this.fileList:', this.fileList)
  1520. return true;
  1521. };
  1522. getBase64(file: any): Promise<any> {
  1523. return new Promise((resolve, reject) => {
  1524. const reader = new FileReader();
  1525. reader.readAsDataURL(file);
  1526. reader.onload = () => resolve(reader.result);
  1527. reader.onerror = error => reject(error);
  1528. });
  1529. }
  1530. // 临时上传图片
  1531. temporarilyUrl = this.mainService.returnUploadUrl('temporarily', 0);
  1532. // 处理组列表
  1533. applicationGroupList:any[] = [];
  1534. searchApplicationGroup(keyWord?) {
  1535. if(!this.incidentModel.duty){
  1536. this.incidentModel.group = undefined;
  1537. this.applicationGroupList = [];
  1538. this.incidentModel.user = undefined;
  1539. this.applicationUserList = [];
  1540. return;
  1541. }
  1542. let postData = {
  1543. idx: 0,
  1544. sum: 20,
  1545. group2: {
  1546. groupName: keyWord,
  1547. hospitals: this.incidentModel.duty ? this.incidentModel.duty.id.toString() : undefined,
  1548. type: 3,
  1549. },
  1550. };
  1551. this.isLoading = true;
  1552. this.mainService
  1553. .getFetchDataList("simple/data", "group2", postData)
  1554. .subscribe((data) => {
  1555. this.isLoading = false;
  1556. if (data.status == 200) {
  1557. this.applicationGroupList = data.list;
  1558. }
  1559. });
  1560. }
  1561. // 修改处理组
  1562. changeApplyGroup(e){
  1563. console.log(e);
  1564. this.incidentModel.user = undefined;
  1565. this.searchApplicationUser();
  1566. }
  1567. // 处理人列表
  1568. applicationUserList:any[] = [];
  1569. searchApplicationUser(keyWord?) {
  1570. let postData = {
  1571. idx: 0,
  1572. sum: 20,
  1573. user: {
  1574. name:keyWord,
  1575. groupdata: this.incidentModel.group ? { id: this.incidentModel.group } : undefined,
  1576. roleCodes: 'first-line support',
  1577. engineer: 1,
  1578. simpleQuery: true,
  1579. },
  1580. };
  1581. this.isLoading = true;
  1582. this.mainService
  1583. .getFetchDataList("simple/data", "user", postData)
  1584. .subscribe((data) => {
  1585. this.isLoading = false;
  1586. if (data.status == 200) {
  1587. this.applicationUserList = data.list;
  1588. }
  1589. });
  1590. }
  1591. // 优先级列表
  1592. applicationPriorityList:any[] = [];
  1593. searchApplicationPriority(keyWord?) {
  1594. let postData = {
  1595. idx: 0,
  1596. sum: 9999,
  1597. priority: {},
  1598. };
  1599. this.isLoading = true;
  1600. this.mainService
  1601. .getFetchDataList("simple/data", "priority", postData)
  1602. .subscribe((data) => {
  1603. this.isLoading = false;
  1604. if (data.status == 200) {
  1605. this.applicationPriorityList = data.list;
  1606. // 回显报修来源
  1607. // let source = this.applicationSourceList.find(v => v.value === 'phone');
  1608. // if(!this.incidentModel.source && source){
  1609. // this.incidentModel.source = source.id;
  1610. // }
  1611. }
  1612. });
  1613. }
  1614. // 报修来源列表
  1615. applicationSourceList:any[] = [];
  1616. searchApplicationSource(keyWord?) {
  1617. this.mainService.getDictionary("list", "incident_source").subscribe((data) => {
  1618. this.applicationSourceList = data || [];
  1619. });
  1620. }
  1621. // 报修类型列表
  1622. repairIncidentTypeList:any[] = [];
  1623. getRepairIncidentType() {
  1624. this.mainService.getDictionary("list", "repair_incident_type").subscribe((data) => {
  1625. this.repairIncidentTypeList = data || [];
  1626. });
  1627. }
  1628. // 选择报修类型
  1629. changeRepairIncidentType(value){
  1630. // this.incidentModel.department = undefined;
  1631. this.incidentMsg.deptManyPhone = '';
  1632. this.incidentModel.requester = null;
  1633. this.isRelatedDepartment = value !== 'public';
  1634. this.changeApplyRelatedDepartment(this.isRelatedDepartment);
  1635. this.rightTitleHandler(2);
  1636. }
  1637. // 楼栋列表
  1638. applicationBuildingList:any[] = [];
  1639. searchApplicationBuilding(keyWord?, buildingId?) {
  1640. let postData = {
  1641. idx: 0,
  1642. sum: 9999,
  1643. building: {
  1644. cascadeHosId: this.incidentModel.hosId,
  1645. },
  1646. };
  1647. this.isLoading = true;
  1648. this.mainService
  1649. .getFetchDataList("simple/data", "building", postData)
  1650. .subscribe((data) => {
  1651. this.isLoading = false;
  1652. if (data.status == 200) {
  1653. this.applicationBuildingList = data.list;
  1654. if(buildingId){
  1655. let hasBuildingId = this.applicationBuildingList.some(v => v.id == buildingId);
  1656. if(hasBuildingId){
  1657. this.incidentModel.area = buildingId;
  1658. }else{
  1659. this.incidentModel.area = undefined;
  1660. }
  1661. }
  1662. }
  1663. });
  1664. }
  1665. // 修改楼栋
  1666. changeApplyBuilding(e){
  1667. console.log(e)
  1668. this.incidentModel.place = undefined;
  1669. this.searchApplicationFloor();
  1670. }
  1671. // 楼层列表
  1672. applicationFloorList:any[] = [];
  1673. searchApplicationFloor(keyWord?, floorId?, buildingId?) {
  1674. let postData = {
  1675. idx: 0,
  1676. sum: 9999,
  1677. floor: {
  1678. buildId: buildingId || this.incidentModel.area || undefined,
  1679. hosId: this.incidentModel.hosId,
  1680. },
  1681. };
  1682. this.isLoading = true;
  1683. this.mainService
  1684. .getFetchDataList("simple/data", "floor", postData)
  1685. .subscribe((data) => {
  1686. this.isLoading = false;
  1687. if (data.status == 200) {
  1688. this.applicationFloorList = data.list;
  1689. if(floorId){
  1690. let hasFloorId = this.applicationFloorList.some(v => v.id == floorId);
  1691. if(hasFloorId){
  1692. this.incidentModel.place = floorId;
  1693. }else{
  1694. this.incidentModel.place = undefined;
  1695. }
  1696. }
  1697. }
  1698. });
  1699. }
  1700. // 修改关联查
  1701. changeApplyRelatedDepartment(e){
  1702. if(this.buildType !== '报修转事件'){
  1703. this.incidentModel.requester = undefined;
  1704. }
  1705. this.searchApplicationRequester();
  1706. }
  1707. // 申请科室列表(搜索)
  1708. isLoadingApply: boolean = false;
  1709. applicationDeptList:any[] = [];
  1710. applyStartDept:any;
  1711. searchApplicationDepartment(type, e?, phone?, deptId?, isInit?) {
  1712. // if(!this.hsmsData.hsmsSwitch && !this.itsmData.mdv2Switch){
  1713. // return;
  1714. // }
  1715. let keyWord = "";
  1716. if (e && e !== "&ks&" && e !== "&go&") {
  1717. keyWord = e;
  1718. }
  1719. let cascadeHosId;
  1720. if(type == 'itsm'){
  1721. cascadeHosId = this.incidentModel.hosId || undefined;
  1722. }else{
  1723. cascadeHosId = this.currentHospital.id;
  1724. }
  1725. let dataObj = {
  1726. idx: 0,
  1727. sum: 20,
  1728. department: {
  1729. searchType: type == 'itsm' ? undefined : 1,// 简单查询
  1730. cascadeHosId,
  1731. keyWord: keyWord,
  1732. flag: 1,
  1733. },
  1734. };
  1735. this.WSNum++;
  1736. this.isLoadingApply = true;
  1737. this.mainService
  1738. .getFetchDataList("data", "department", dataObj)
  1739. .subscribe((data) => {
  1740. this.WSNum--;
  1741. if (this.WSNum === 0) {
  1742. this.isLoadingApply = false;
  1743. }
  1744. if (data.status == 200) {
  1745. if(type == 'hsms'){
  1746. this.applicationDepartmentList = data.list;
  1747. deptId && this.changeApply(deptId);
  1748. if (e === undefined) {
  1749. //初始化
  1750. this.changeApplicationDepartment();
  1751. } else if (e === "&ks&") {
  1752. //绑定了科室
  1753. // 配送--start
  1754. let obj = this.applicationDepartmentList.find(
  1755. (item) => item.id == this.applyDeptMiddle.id
  1756. );
  1757. if (!obj) {
  1758. this.applicationDepartmentList.push(this.applyDeptMiddle);
  1759. }
  1760. this.applyDept = this.applyDeptMiddle.id;
  1761. this.changeApplicationDepartment("&ks&");
  1762. // 配送--end
  1763. } else if (e === "&go&") {
  1764. //继续建单
  1765. let obj = this.applicationDepartmentList.find(
  1766. (item) => item.id == this.applyStartDept.id
  1767. );
  1768. if (!obj) {
  1769. this.applicationDepartmentList.push(this.applyStartDept);
  1770. }
  1771. this.applyDept = this.applyStartDept.id;
  1772. this.changeApplicationDepartment("&go&");
  1773. } else if (e === "") {
  1774. //没绑定科室
  1775. this.changeApplicationDepartment(phone);
  1776. }
  1777. }else if(type == 'itsm'){
  1778. if(this.eventData){
  1779. this.applicationRequesterList.push({
  1780. name: this.userInfo.user.name,
  1781. id: this.userInfo.user.id,
  1782. account: this.userInfo.user.account
  1783. })
  1784. this.incidentModel.requester = this.userInfo.user.id;
  1785. let id = this.eventData.data.alarmId?this.eventData.data.alarmId:''
  1786. let ly = this.eventData.data.alarmSource?this.eventData.data.alarmSource:''
  1787. let dd = this.eventData.data.alarmLocation?this.eventData.data.alarmLocation:''
  1788. let jjd = this.eventData.data.alarmUrgency?this.eventData.data.alarmUrgency.name:''
  1789. let time = this.eventData.data.alarmActiveTime?format(new Date(this.eventData.data.alarmActiveTime), 'yyyy-MM-dd HH:mm:ss'):''
  1790. let ip = this.eventData.data.alarmIp?this.eventData.data.alarmIp:''
  1791. let ms = this.eventData.data.alarmDescription?this.eventData.data.alarmDescription:''
  1792. let content = this.eventData.data.alarmContent?this.eventData.data.alarmContent:''
  1793. this.incidentModel.description =
  1794. '告警id:' + id + ';' +
  1795. '告警来源:' + ly + ';' +
  1796. '\n' +
  1797. '告警地点:' + dd + ';' +
  1798. '\n' +
  1799. '紧急度:' + jjd + ';' +
  1800. '告警时间:' + time + ';' +
  1801. '\n' +
  1802. '告警ip:' + ip + ';' +
  1803. '\n' +
  1804. '告警描述:' + ms + ';' +
  1805. '\n' +
  1806. '告警内容:' + content
  1807. }
  1808. this.applicationDeptList = data.list;
  1809. let ids = this.applicationDeptList.map(v => v.id);
  1810. isInit && !ids.includes(this.incidentModel.department) && (this.applicationDeptList.unshift({id: this.incidentModel.department, dept: this.incidentMsg.deptName}))
  1811. console.log(this.applicationDeptList);
  1812. console.log(this.incidentModel);
  1813. console.log(this.incidentMsg);
  1814. deptId && this.changeApplyDept(deptId);
  1815. }
  1816. }
  1817. });
  1818. }
  1819. openChangeApply(flag){
  1820. flag && this.searchApplicationDepartment('hsms')
  1821. }
  1822. openChangeApplyDept(flag){
  1823. flag && this.searchApplicationDepartment('itsm');
  1824. }
  1825. openChangeApplyRequester(flag){
  1826. flag && this.searchApplicationRequester();
  1827. }
  1828. openChangeApplyCategory(flag){
  1829. flag && this.searchApplicationCategory();
  1830. }
  1831. openChangeApplyGroup(flag){
  1832. flag && this.searchApplicationGroup()
  1833. }
  1834. openChangeApplyUser(flag){
  1835. flag && this.searchApplicationUser()
  1836. }
  1837. // 配送-选择科室
  1838. changeApply(e) {
  1839. console.log(e, this.applicationDepartmentList);
  1840. if(this.cmdbRepair){
  1841. this.incidentModel.assetId = null;
  1842. this.getAssetData()
  1843. }
  1844. this.changeApplicationDepartment("&same&");
  1845. if(this.applyDept && this.currentTabIndex !== '故障报修'){
  1846. this.rightTitle_tab = [
  1847. { id: 0, name: '近期配送' },
  1848. // { id: 1, name: '转出院记录' },
  1849. ]
  1850. this.rightTitleHandler(this.rightTitle_tab[0].id);
  1851. }
  1852. let deptObj = this.applicationDepartmentList.find(v => v.id == e);
  1853. if(this.incidentModel.department != e){
  1854. this.incidentModel.department = e;
  1855. this.searchApplicationDepartment('itsm', deptObj ? deptObj.dept : '', undefined, e);
  1856. }
  1857. }
  1858. // 运维-选择科室
  1859. changeApplyDept(e) {
  1860. console.log(e, this.applicationDeptList);
  1861. this.refresh();
  1862. if(this.incidentModel.department && this.currentTabIndex === '故障报修'){
  1863. this.rightTitle_tab = [
  1864. { id: 2, name: '近期维修' },
  1865. { id: 3, name: '知识库' },
  1866. ]
  1867. this.rightTitleHandler(this.rightTitle_tab[0].id);
  1868. }
  1869. let deptObj = this.applicationDeptList.find(v => v.id == e);
  1870. if(this.applyDept != e){
  1871. this.applyDept = e;
  1872. this.searchApplicationDepartment('hsms', deptObj ? deptObj.dept : '', undefined, e);
  1873. }
  1874. // 选择科室回显一级院区
  1875. if(!this.incidentModel.hosId){
  1876. if(deptObj){
  1877. this.incidentModel.hosId = deptObj.hospital.parent ? deptObj.hospital.parent.id : deptObj.hospital.id;
  1878. }
  1879. this.incidentModel.area = undefined;
  1880. this.searchApplicationBuilding();
  1881. this.incidentModel.place = undefined;
  1882. this.applicationFloorList = [];
  1883. }
  1884. // 选择科室回显科室电话,楼栋,楼层,地址
  1885. if(deptObj){
  1886. console.log('deptObj:', deptObj)
  1887. this.incidentMsg.deptManyPhone = deptObj.manyPhone;
  1888. let buildingId = deptObj.building ? deptObj.building.id : undefined;
  1889. buildingId && this.searchApplicationBuilding('', buildingId);
  1890. let floorId = deptObj.floor ? deptObj.floor.id : undefined;
  1891. buildingId && floorId && this.searchApplicationFloor('', floorId, buildingId);
  1892. this.incidentModel.houseNumber = deptObj.address;
  1893. }
  1894. // 刷新申请人列表
  1895. if(this.buildType !== '报修转事件'){
  1896. this.incidentModel.requester = undefined;
  1897. }
  1898. this.searchApplicationRequester();
  1899. // 根据院区和故障现象带出责任部门,优先级,维修人/组
  1900. if(this.incidentModel.category && this.incidentModel.hosId && this.buildType !== '编辑事件'){
  1901. let postData = {
  1902. idx: 0,
  1903. sum: 9999,
  1904. incidentCategoryConfig: {
  1905. categoryId: this.incidentModel.category,
  1906. hosId: this.incidentModel.hosId,
  1907. },
  1908. };
  1909. console.log(postData);
  1910. // return;
  1911. this.isLoading = true;
  1912. this.mainService
  1913. .getFetchDataList("simple/data", "incidentCategoryConfig", postData)
  1914. .subscribe((data) => {
  1915. this.isLoading = false;
  1916. if (data.status == 200) {
  1917. let list = data.list || [];
  1918. if(list.length > 0){
  1919. console.log(list[0]);
  1920. this.incidentCategoryConfig = list[0];
  1921. }else{
  1922. this.incidentCategoryConfig = {};
  1923. }
  1924. // 根据院区和故障现象带出责任部门,优先级,维修人/组
  1925. this.incidentModel.duty = this.incidentCategoryConfig.dutyDTO;
  1926. this.incidentModel.priorityId = this.incidentCategoryConfig.priority;
  1927. // 回显维修人/组
  1928. this.showGroupOrUser();
  1929. }
  1930. });
  1931. }else{
  1932. // 回显维修人/组
  1933. this.showGroupOrUser();
  1934. }
  1935. }
  1936. // 申请科室列表(搜索)失去焦点的时候
  1937. changeApplicationDepartment(phone?) {
  1938. this.radioValueQt = null;
  1939. this.startDeptQt = null;
  1940. this.endDeptQt = null;
  1941. this.radioValueZy = null;
  1942. this.radioValueZyPre = null;
  1943. this.startDeptZy = null;
  1944. this.endDeptZy = null;
  1945. this.patientZy = null;
  1946. this.goodsNow = [];
  1947. this.workOrderInspectScore = undefined;
  1948. // this.patientList = [];
  1949. this.workOrderRemark = "";
  1950. this.workOrderRemarkZy = "";
  1951. this.deptZyList["startDept"] = [];
  1952. this.deptZyList["endDept"] = [];
  1953. this.deptZyList["startStatus"] = 0;
  1954. this.deptZyList["endStatus"] = 0;
  1955. this.deptQtList["startDept"] = [];
  1956. this.deptQtList["endDept"] = [];
  1957. this.deptQtList["startStatus"] = 0;
  1958. this.deptQtList["endStatus"] = 0;
  1959. console.log(phone);
  1960. if (
  1961. phone !== undefined &&
  1962. phone !== "&same&" &&
  1963. phone !== "&ks&" &&
  1964. phone !== "&go&"
  1965. ) {
  1966. // this.incidentModel.incomingPhone = this.callNumber = this.incidentModel.contactsInformation = phone;
  1967. this.applyDept = null;
  1968. this.noArrives = []; //近期配送
  1969. } else if (phone === "&ks&") {
  1970. let filter = this.applicationDepartmentList.filter(
  1971. (item) => item.id == this.applyDept
  1972. );
  1973. console.log('filter', filter)
  1974. // this.incidentModel.incomingPhone = this.callNumber = this.incidentModel.contactsInformation = filter[0].phone;
  1975. console.log(this.callNumber); //ceshi
  1976. if (this.currentTabIndex == "患者转运") {
  1977. //患者转运
  1978. //获取患者信息
  1979. this.getPatientList(this.applyDept, "");
  1980. }
  1981. if (this.currentRTab === 0) {
  1982. this.getWorkOrders(this.applyDept);
  1983. } else if (this.currentRTab === 1) {
  1984. this.getPatientLog(this.applyDept);
  1985. } else if (this.currentRTab === 2) {
  1986. this.getItsmOrders(this.incidentModel.department);
  1987. } else if (this.currentRTab === 3) {
  1988. this.getDictionaryList();
  1989. }
  1990. } else if (phone === "&go&") {
  1991. if (this.currentTabIndex == "患者转运") {
  1992. //患者转运
  1993. //获取患者信息
  1994. this.getPatientList(this.applyDept, "");
  1995. }
  1996. if (this.currentRTab === 0) {
  1997. this.getWorkOrders(this.applyDept);
  1998. } else if (this.currentRTab === 1) {
  1999. this.getPatientLog(this.applyDept);
  2000. } else if (this.currentRTab === 2) {
  2001. this.getItsmOrders(this.incidentModel.department);
  2002. } else if (this.currentRTab === 3) {
  2003. this.getDictionaryList();
  2004. }
  2005. } else if (phone === "&same&") {
  2006. if (this.currentTabIndex == "患者转运") {
  2007. //患者转运
  2008. //获取患者信息
  2009. this.getPatientList(this.applyDept, "");
  2010. }
  2011. if (this.currentRTab === 0) {
  2012. this.getWorkOrders(this.applyDept);
  2013. } else if (this.currentRTab === 1) {
  2014. this.getPatientLog(this.applyDept);
  2015. } else if (this.currentRTab === 2) {
  2016. this.getItsmOrders(this.incidentModel.department);
  2017. } else if (this.currentRTab === 3) {
  2018. this.getDictionaryList();
  2019. }
  2020. }
  2021. }
  2022. // 引入电话号码
  2023. importPhone(phone, isTransform){
  2024. if(isTransform){
  2025. this.incidentModel.contactsInformation = phone.split(',')[0];
  2026. }else{
  2027. this.incidentModel.contactsInformation = phone;
  2028. }
  2029. }
  2030. // 是否连续建单
  2031. isBuildOrderAgagin:boolean = false;
  2032. maskFlag:any = false;
  2033. // 运维-直接解决
  2034. directOrder(){
  2035. if(this.publicRepair && this.applicantMustFillIn==1 && !this.incidentModel.requester){
  2036. this.msg.warning('请选择申请人!');
  2037. return;
  2038. }
  2039. if(!this.incidentModel.category){
  2040. this.msg.warning('请选择故障现象!');
  2041. return;
  2042. }
  2043. let category = this.applicationCategoryList.find(v => v.id == this.incidentModel.category);
  2044. if(!this.incidentModel.duty){
  2045. this.msg.warning(`故障现象【${category.mutiCategory}】没有设置责任部门!`);
  2046. return;
  2047. }
  2048. if(this.incidentModel.repairIncidentType === 'dept' && !this.incidentModel.department){
  2049. this.msg.warning('请选择申请科室!');
  2050. return;
  2051. }
  2052. if(!this.incidentModel.contactsInformation){
  2053. this.msg.warning('请填写联系电话!');
  2054. return;
  2055. }
  2056. if(!this.incidentModel.priorityId){
  2057. this.msg.warning('请选择优先级!');
  2058. return;
  2059. }
  2060. if(!this.incidentModel.source){
  2061. this.msg.warning('请选择报修来源!');
  2062. return;
  2063. }
  2064. if(!this.incidentModel.description){
  2065. this.msg.warning('请选择故障描述!');
  2066. return;
  2067. }
  2068. this.showDirectOrder();
  2069. }
  2070. // 图片上传
  2071. uploadImages(file, id){
  2072. const formData = new FormData();
  2073. formData.append('file', file);
  2074. formData.append('fileName', file.name);
  2075. const req = new HttpRequest('Post', this.mainService.returnUploadUrl('wechatRequesterIncident', id), formData, {
  2076. reportProgress: true
  2077. });
  2078. return this.http.request(req).pipe(filter(e => e instanceof HttpResponse)).toPromise();
  2079. }
  2080. // 运维-建单并派单
  2081. assignOrder(){
  2082. if(this.publicRepair && this.applicantMustFillIn==1 && !this.incidentModel.requester){
  2083. this.msg.warning('请选择申请人!');
  2084. return;
  2085. }
  2086. if(!this.incidentModel.category){
  2087. this.msg.warning('请选择故障现象!');
  2088. return;
  2089. }
  2090. let category = this.applicationCategoryList.find(v => v.id == this.incidentModel.category);
  2091. console.log('故障现象对象=>>>>>',category)
  2092. if(!this.incidentModel.duty){
  2093. this.msg.warning(`故障现象【${category.mutiCategory}】没有设置责任部门!`);
  2094. return;
  2095. }
  2096. if(this.incidentModel.repairIncidentType === 'dept' && !this.incidentModel.department){
  2097. this.msg.warning('请选择申请科室!');
  2098. return;
  2099. }
  2100. if(!this.incidentModel.contactsInformation){
  2101. this.msg.warning('请填写联系电话!');
  2102. return;
  2103. }
  2104. if(!this.incidentModel.priorityId){
  2105. this.msg.warning('请选择优先级!');
  2106. return;
  2107. }
  2108. if(!this.incidentModel.source){
  2109. this.msg.warning('请选择报修来源!');
  2110. return;
  2111. }
  2112. if(!this.incidentModel.description){
  2113. this.msg.warning('请选择故障描述!');
  2114. return;
  2115. }
  2116. if(!this.incidentModel.group && this.buildType !== '编辑事件'){
  2117. this.msg.warning('请选择处理组!');
  2118. return;
  2119. }
  2120. this.maskFlag = this.msg.loading("正在加载中..", {
  2121. nzDuration: 0,
  2122. }).messageId;
  2123. let postData:any = {
  2124. solutionId: this.solutionId,
  2125. alarmId:null,
  2126. "incident": {
  2127. "id": this.incidentModel.id || undefined,
  2128. "deleteFlag": 0,
  2129. "duty": this.incidentModel.duty ? { id: this.incidentModel.duty.id } : undefined,
  2130. "department": this.incidentModel.department ? { id: this.incidentModel.department } : undefined,
  2131. "contactsInformation": this.incidentModel.contactsInformation,
  2132. "contacts": this.incidentModel.contacts,
  2133. "hosId": this.incidentModel.hosId || undefined,
  2134. "area": this.incidentModel.area ? { id: this.incidentModel.area } : undefined,
  2135. "place": this.incidentModel.place ? { id: this.incidentModel.place } : undefined,
  2136. "houseNumber": this.incidentModel.houseNumber,
  2137. "category": this.incidentModel.category ? { id: this.incidentModel.category } : undefined,
  2138. "priorityId": this.incidentModel.priorityId || undefined,
  2139. "source": this.incidentModel.source ? { id: this.incidentModel.source } : undefined,
  2140. // "title": category.mutiCategory,
  2141. "description": this.incidentModel.description,
  2142. "yyTime": this.incidentModel.yyTime ? format(new Date(this.incidentModel.yyTime), 'yyyy-MM-dd HH:mm:ss') : undefined,
  2143. "requester": this.incidentModel.requester ? { id: this.incidentModel.requester } : undefined,
  2144. "repairIncidentType": this.incidentModel.repairIncidentType ? this.repairIncidentTypeList.find(v => v.value === this.incidentModel.repairIncidentType) : undefined,
  2145. "acceptUser": { id: this.tool.getCurrentUserId() },
  2146. "callID": this.incidentModel.callID || undefined,
  2147. "incomingPhone": this.incidentModel.incomingPhone || undefined,
  2148. "candidateGroups": this.incidentModel.group || undefined,
  2149. "assignee": this.incidentModel.user || undefined,
  2150. "hjzxRecordId": this.incidentModel.hjzxRecordId || undefined,
  2151. "assetId": this.incidentModel.assetId || undefined
  2152. }
  2153. };
  2154. if(this.buildType){
  2155. if(this.buildType === '报修转事件'){
  2156. postData.incident.fromWx = true;
  2157. }
  2158. if(this.buildType !== '继续建单' && this.buildType !== '编辑事件' && this.buildType !== '报修转事件'){
  2159. postData.incident = Object.assign({}, postData.incident);
  2160. }else{
  2161. postData.incident = Object.assign({}, this.editOrder, postData.incident);
  2162. }
  2163. }
  2164. console.log('哈哈哈哈哈哈=====', this.eventData);
  2165. // return;
  2166. let url = null
  2167. if(this.eventData){
  2168. postData.alarmId = this.eventData.data.id
  2169. url = this.mainService.addAlarmIncident(postData)
  2170. }else{
  2171. delete postData.alarmId
  2172. url = this.mainService
  2173. .flowPost("incident/task/accept", postData)
  2174. }
  2175. url.subscribe((result) => {
  2176. this.msg.remove(this.maskFlag);
  2177. this.maskFlag = false;
  2178. if (result.state == 200) {
  2179. // 图片上传
  2180. if(this.fileList.length){
  2181. console.log(this.fileList.map(v => v.originFileObj));
  2182. this.fileList.map(v => v.originFileObj).forEach(async file => {
  2183. await this.uploadImages(file, result.data.id);
  2184. })
  2185. }
  2186. // this.msg.success('建单并派单成功');
  2187. this.isBuildOrderAgaginFn();
  2188. } else {
  2189. this.msg.error(result.msg || '建单并派单失败');
  2190. }
  2191. });
  2192. }
  2193. // 运维-暂存
  2194. temporaryStorage(){
  2195. this.maskFlag = this.msg.loading("正在加载中..", {
  2196. nzDuration: 0,
  2197. }).messageId;
  2198. let category;
  2199. if(this.incidentModel.category){
  2200. category = this.applicationCategoryList.find(v => v.id == this.incidentModel.category);
  2201. }
  2202. let postData:any = {
  2203. solutionId: this.solutionId,
  2204. "incident": {
  2205. "id": this.incidentModel.id || undefined,
  2206. "deleteFlag": 0,
  2207. "duty": this.incidentModel.duty ? { id: this.incidentModel.duty.id } : undefined,
  2208. "department": this.incidentModel.department ? { id: this.incidentModel.department } : undefined,
  2209. "contactsInformation": this.incidentModel.contactsInformation,
  2210. "contacts": this.incidentModel.contacts,
  2211. "hosId": this.incidentModel.hosId || undefined,
  2212. "area": this.incidentModel.area ? { id: this.incidentModel.area } : undefined,
  2213. "place": this.incidentModel.place ? { id: this.incidentModel.place } : undefined,
  2214. "houseNumber": this.incidentModel.houseNumber,
  2215. "category": this.incidentModel.category ? { id: this.incidentModel.category } : undefined,
  2216. "priorityId": this.incidentModel.priorityId || undefined,
  2217. "source": this.incidentModel.source ? { id: this.incidentModel.source } : undefined,
  2218. // "title": category ? category.mutiCategory : '',
  2219. "description": this.incidentModel.description,
  2220. "yyTime": this.incidentModel.yyTime ? format(new Date(this.incidentModel.yyTime), 'yyyy-MM-dd HH:mm:ss') : undefined,
  2221. "requester": this.incidentModel.requester ? { id: this.incidentModel.requester } : undefined,
  2222. "repairIncidentType": this.incidentModel.repairIncidentType ? this.repairIncidentTypeList.find(v => v.value === this.incidentModel.repairIncidentType) : undefined,
  2223. "acceptUser": { id: this.tool.getCurrentUserId() },
  2224. "callID": this.incidentModel.callID || undefined,
  2225. "incomingPhone": this.incidentModel.incomingPhone || undefined,
  2226. "candidateGroups": this.incidentModel.group || undefined,
  2227. "assignee": this.incidentModel.user || undefined,
  2228. "hjzxRecordId": this.incidentModel.hjzxRecordId || undefined,
  2229. }
  2230. };
  2231. if(this.buildType){
  2232. if(this.buildType === '报修转事件'){
  2233. postData.incident.fromWx = true;
  2234. }
  2235. if(this.buildType !== '继续建单' && this.buildType !== '编辑事件' && this.buildType !== '报修转事件'){
  2236. postData.incident = Object.assign({}, postData.incident);
  2237. }else{
  2238. postData.incident = Object.assign({}, this.editOrder, postData.incident);
  2239. }
  2240. }
  2241. console.log(postData);
  2242. // return;
  2243. this.mainService
  2244. .flowPost("incident/task/storage", postData)
  2245. .subscribe((result) => {
  2246. this.msg.remove(this.maskFlag);
  2247. this.maskFlag = false;
  2248. if (result.state == 200) {
  2249. // 图片上传
  2250. if(this.fileList.length){
  2251. console.log(this.fileList.map(v => v.originFileObj));
  2252. this.fileList.map(v => v.originFileObj).forEach(async file => {
  2253. await this.uploadImages(file, result.data.id);
  2254. })
  2255. }
  2256. // this.msg.success('暂存成功');
  2257. this.isBuildOrderAgaginFn();
  2258. } else {
  2259. this.msg.error(result.msg || '暂存失败');
  2260. }
  2261. });
  2262. }
  2263. // 运维-保存
  2264. saveOrder(){
  2265. if(this.publicRepair && this.applicantMustFillIn==1 && !this.incidentModel.requester){
  2266. this.msg.warning('请选择申请人!');
  2267. return;
  2268. }
  2269. if(!this.incidentModel.category){
  2270. this.msg.warning('请选择故障现象!');
  2271. return;
  2272. }
  2273. let category = this.applicationCategoryList.find(v => v.id == this.incidentModel.category);
  2274. if(!this.incidentModel.duty){
  2275. this.msg.warning(`故障现象【${category.mutiCategory}】没有设置责任部门!`);
  2276. return;
  2277. }
  2278. if(this.incidentModel.repairIncidentType === 'dept' && !this.incidentModel.department){
  2279. this.msg.warning('请选择申请科室!');
  2280. return;
  2281. }
  2282. if(!this.incidentModel.contactsInformation){
  2283. this.msg.warning('请填写联系电话!');
  2284. return;
  2285. }
  2286. if(!this.incidentModel.priorityId){
  2287. this.msg.warning('请选择优先级!');
  2288. return;
  2289. }
  2290. if(!this.incidentModel.source){
  2291. this.msg.warning('请选择报修来源!');
  2292. return;
  2293. }
  2294. if(!this.incidentModel.description){
  2295. this.msg.warning('请选择故障描述!');
  2296. return;
  2297. }
  2298. this.maskFlag = this.msg.loading("正在加载中..", {
  2299. nzDuration: 0,
  2300. }).messageId;
  2301. let postData:any = {
  2302. solutionId: this.solutionId,
  2303. "incident": {
  2304. "id": this.incidentModel.id || undefined,
  2305. "deleteFlag": 0,
  2306. "duty": this.incidentModel.duty ? { id: this.incidentModel.duty.id } : undefined,
  2307. "department": this.incidentModel.department ? { id: this.incidentModel.department } : undefined,
  2308. "contactsInformation": this.incidentModel.contactsInformation,
  2309. "contacts": this.incidentModel.contacts,
  2310. "hosId": this.incidentModel.hosId || undefined,
  2311. "area": this.incidentModel.area ? { id: this.incidentModel.area } : undefined,
  2312. "place": this.incidentModel.place ? { id: this.incidentModel.place } : undefined,
  2313. "houseNumber": this.incidentModel.houseNumber,
  2314. "category": this.incidentModel.category ? { id: this.incidentModel.category } : undefined,
  2315. "priorityId": this.incidentModel.priorityId || undefined,
  2316. "source": this.incidentModel.source ? { id: this.incidentModel.source } : undefined,
  2317. // "title": category ? category.mutiCategory : '',
  2318. "description": this.incidentModel.description,
  2319. "yyTime": this.incidentModel.yyTime ? format(new Date(this.incidentModel.yyTime), 'yyyy-MM-dd HH:mm:ss') : undefined,
  2320. "requester": this.incidentModel.requester ? { id: this.incidentModel.requester } : undefined,
  2321. "repairIncidentType": this.incidentModel.repairIncidentType ? this.repairIncidentTypeList.find(v => v.value === this.incidentModel.repairIncidentType) : undefined,
  2322. "acceptUser": { id: this.tool.getCurrentUserId() },
  2323. "callID": this.incidentModel.callID || undefined,
  2324. "incomingPhone": this.incidentModel.incomingPhone || undefined,
  2325. "hjzxRecordId": this.incidentModel.hjzxRecordId || undefined,
  2326. }
  2327. };
  2328. if(this.buildType){
  2329. postData.incident = Object.assign({}, this.editOrder, postData.incident);
  2330. }
  2331. console.log(postData);
  2332. // return;
  2333. this.mainService
  2334. .flowPost("incident/task/edit", postData)
  2335. .subscribe((result) => {
  2336. this.msg.remove(this.maskFlag);
  2337. this.maskFlag = false;
  2338. if (result.state == 200) {
  2339. // 图片上传
  2340. if(this.fileList.length){
  2341. console.log(this.fileList.map(v => v.originFileObj));
  2342. this.fileList.map(v => v.originFileObj).forEach(async file => {
  2343. await this.uploadImages(file, result.data.id);
  2344. })
  2345. }
  2346. // this.msg.success('编辑成功');
  2347. this.isBuildOrderAgaginFn();
  2348. } else {
  2349. this.msg.error(result.msg || '编辑失败');
  2350. }
  2351. });
  2352. }
  2353. // 是否连续建单
  2354. isBuildOrderAgaginFn(){
  2355. if(this.isBuildOrderAgagin){
  2356. // 清除故障现象,维修人/组
  2357. this.incidentModel.category = undefined;
  2358. this.incidentModel.user = undefined;
  2359. this.incidentModel.group = undefined;
  2360. this.showPromptModal("操作", true, "", "");
  2361. }else{
  2362. this.goType = null;
  2363. this.newOrderShow = false; //关闭弹窗
  2364. this.newOrderShowOpen = false; //此时可出现新的弹窗
  2365. this.showPromptModal("操作", true, "", "");
  2366. }
  2367. }
  2368. // 选择统计备注
  2369. countRemarkIndex:number = -1;
  2370. addCountRemark(countRemark, index, i){
  2371. if(this.countRemarkIndex == i){
  2372. this.countRemarkIndex = -1;
  2373. }else{
  2374. this.countRemarkIndex = i;
  2375. }
  2376. this.getSearchTaskList('', this.countRemarkIndex > -1 ? countRemark : '').subscribe((result) => {
  2377. if (result.status == 200) {
  2378. this.searchTaskLoading = false;
  2379. this.workTypes = result['data'] || [];
  2380. // 整理后的任务类型
  2381. this.isShowResidenceNo = false;
  2382. this.workTypesArrange[index].value = [];
  2383. // for (const value of this.workTypesArrange) {
  2384. // value.value = [];
  2385. // }
  2386. this.workTypes.forEach((item) => {
  2387. if(item.associationTypeValue === 'patientTransport' || item.associationTypeValue === 'inspect'){
  2388. // // 患者其他服务
  2389. // let obj = this.workTypesArrange.find(v => v.key === '患者转运');
  2390. // if(obj){
  2391. // obj.value.push(item);
  2392. // }else{
  2393. // this.workTypesArrange.unshift({ key: '患者转运', value: [item] });
  2394. // this.isShowResidenceNo = true;
  2395. // }
  2396. }else if(item.associationTypeValue === 'other' || item.associationTypeValue === 'specimen' || item.associationTypeValue === 'ordinary'){
  2397. // 物品配送
  2398. let obj = this.workTypesArrange.find(v => v.key === '物品配送');
  2399. if(obj){
  2400. obj.value.push(item);
  2401. }else{
  2402. this.workTypesArrange.unshift({ key: '物品配送', value: [item] });
  2403. }
  2404. }
  2405. });
  2406. console.log('workTypesArrange', this.workTypesArrange);
  2407. // 任务类型是否显示操作项
  2408. let arr = this.workTypesArrange;
  2409. this.workTypesFlag = arr.length >= 5;
  2410. }
  2411. });
  2412. }
  2413. // 新建工单->获取新建类型
  2414. countRemarkList:any[] = [];
  2415. isShowResidenceNo = false;
  2416. getAutoWorkTypes(isFirst, isInit) {
  2417. this.workTypesArrange = [];
  2418. // 运维
  2419. // if(this.itsmData.mdv2Switch){
  2420. this.workTypesArrange = [{key:'故障报修', value: []}];
  2421. // if(!this.hsmsData.hsmsSwitch){
  2422. // console.log('workTypesArrange', this.workTypesArrange);
  2423. // // 是否显示操作项
  2424. // this.workTypesFlag = this.workTypesArrange.length >= 5;
  2425. // }
  2426. // }
  2427. }
  2428. // 查类型
  2429. getTaskTypeCountRemarkList(){
  2430. this.mainService.getTaskTypeCountRemarkList({
  2431. hosId: this.currentHospital.id,
  2432. typeValues: 'other,specimen,ordinary',
  2433. }).subscribe((data) => {
  2434. if (data["status"] == 200){
  2435. this.countRemarkList = data.data || [];
  2436. }
  2437. })
  2438. }
  2439. // 终点科室选中
  2440. endDeptZyChange() {
  2441. if (!this.applyDept || !this.endDeptZy) {
  2442. return;
  2443. }
  2444. // 终点科室患者信息列表,id是送病人回病房的任务类型
  2445. if (this.radioValueZy == this.deathTasktypeId) {
  2446. //获取患者信息
  2447. this.patientZy = null;
  2448. this.getPatientList(this.endDeptZy, "");
  2449. }
  2450. }
  2451. //搜索院区下面的科室(患者转运)
  2452. searchHosDepartment(id, type, dept?) {
  2453. if (dept) {
  2454. this.searchHosDepartmentSubject.next([id, type, dept]);
  2455. } else {
  2456. this.searchHosDepartmentSubject.next([id, type]);
  2457. }
  2458. }
  2459. // 搜索院区下面的科室(患者转运)
  2460. getHosDepartment(id, type, dept?) {
  2461. //id院区,type起点科室'start',终点科室'end'。科室名称dept。
  2462. let value = "";
  2463. if (dept) {
  2464. value = dept;
  2465. }
  2466. if (type === "start" && this.deptZyList["startStatus"] == 202) {
  2467. //固定科室范围,禁止搜索
  2468. this.mainService.getdeptList(this.radioValueZy).subscribe((data:any) => {
  2469. let arr = data;
  2470. if(value!=''){
  2471. data = arr.startDept.filter(i=>i.dept.indexOf(value) !=-1)
  2472. this.deptZyList.startDept = data
  2473. }else{
  2474. this.deptZyList.startDept = arr.startDept
  2475. }
  2476. })
  2477. return;
  2478. } else if (type === "end" && this.deptZyList["endStatus"] == 202) {
  2479. //固定科室范围,禁止搜索
  2480. this.mainService.getdeptList(this.radioValueZy).subscribe((data:any) => {
  2481. let arr = data;
  2482. if(value!=''){
  2483. data = arr.endDept.filter(i=>i.dept.indexOf(value) !=-1)
  2484. this.deptZyList.endDept = data
  2485. }else{
  2486. this.deptZyList.endDept = arr.endDept
  2487. }
  2488. })
  2489. return;
  2490. }
  2491. let postData = {
  2492. idx: 0,
  2493. sum: 10,
  2494. department: {
  2495. dept: value,
  2496. cascadeHosId: id
  2497. },
  2498. };
  2499. if (type == "start" && this.deptZyList["startStatus"] == 205) {
  2500. postData.department["type"] = { id: this.deptZyList["startTypeId"] };
  2501. } else if (type == "end" && this.deptZyList["endStatus"] == 205) {
  2502. postData.department["type"] = { id: this.deptZyList["endTypeId"] };
  2503. }
  2504. this.isLoading = true;
  2505. this.mainService
  2506. .getFetchDataList("data", "department", postData)
  2507. .subscribe((data) => {
  2508. this.isLoading = false;
  2509. if (data["status"] == 200) {
  2510. if (type === "start") {
  2511. this.deptZyList["startDept"] = data.list;
  2512. } else if (type === "end") {
  2513. this.deptZyList["endDept"] = data.list;
  2514. }
  2515. }
  2516. });
  2517. }
  2518. //搜索院区下面的科室(其他)
  2519. searchHosDepartmentQt(id, type, dept?) {
  2520. if (dept) {
  2521. this.searchHosDepartmentQtSubject.next([id, type, dept]);
  2522. } else {
  2523. this.searchHosDepartmentQtSubject.next([id, type]);
  2524. }
  2525. }
  2526. // 搜索院区下面的科室(其他)
  2527. getHosDepartmentQt(id, type, dept?) {
  2528. //id院区,type起点科室'start',终点科室'end'。科室名称dept。
  2529. let value = "";
  2530. if (dept) {
  2531. value = dept;
  2532. }
  2533. if (type === "start" && this.deptQtList["startStatus"] == 202) {
  2534. //固定科室范围,禁止搜索
  2535. this.mainService.getdeptList(this.psValue).subscribe((data:any) => {
  2536. let arr = data;
  2537. if(value!=''){
  2538. data = arr.startDept.filter(i=>i.dept.indexOf(value) !=-1)
  2539. this.deptQtList.startDept = data
  2540. }else{
  2541. this.deptQtList.startDept = arr.startDept
  2542. }
  2543. })
  2544. return;
  2545. } else if (type === "end" && this.deptQtList["endStatus"] == 202) {
  2546. //固定科室范围,禁止搜索
  2547. this.mainService.getdeptList(this.psValue).subscribe((data:any) => {
  2548. let arr = data;
  2549. if(value!=''){
  2550. data = arr.endDept.filter(i=>i.dept.indexOf(value) !=-1)
  2551. this.deptQtList.endDept = data
  2552. }else{
  2553. this.deptQtList.endDept = arr.endDept
  2554. }
  2555. })
  2556. return;
  2557. }
  2558. let postData = {
  2559. idx: 0,
  2560. sum: 10,
  2561. department: {
  2562. dept: value,
  2563. cascadeHosId: id
  2564. },
  2565. };
  2566. if (type == "start" && this.deptQtList["startStatus"] == 205) {
  2567. postData.department["type"] = { id: this.deptQtList["startTypeId"] };
  2568. } else if (type == "end" && this.deptQtList["endStatus"] == 205) {
  2569. postData.department["type"] = { id: this.deptQtList["endTypeId"] };
  2570. }
  2571. this.isLoading = true;
  2572. this.mainService
  2573. .getFetchDataList("data", "department", postData)
  2574. .subscribe((data) => {
  2575. this.isLoading = false;
  2576. if (data["status"] == 200) {
  2577. if (type === "start") {
  2578. this.deptQtList["startDept"] = data.list;
  2579. } else if (type === "end") {
  2580. this.deptQtList["endDept"] = data.list;
  2581. }
  2582. }
  2583. });
  2584. }
  2585. // 获取大于x,并且是n的倍数的数字
  2586. getLgNumber(x: number, n:number): number{
  2587. for(let i = x; i < 60; i++){
  2588. if(i % n === 0){
  2589. return i;
  2590. }
  2591. }
  2592. return 0;
  2593. }
  2594. // 禁用小时
  2595. disabledHours = (): number[] => {
  2596. let now = new Date();
  2597. let nHour = now.getHours();
  2598. let nMinute = now.getMinutes();
  2599. if (nMinute > (60 - this.inspectAndPatientTransportConfig.timeMod)) {
  2600. return range(0, nHour + 1);
  2601. } else {
  2602. return range(0, nHour);
  2603. }
  2604. }
  2605. // 禁用分钟
  2606. disabledMinutes = (hour: number): number[] => {
  2607. let now = new Date();
  2608. let nHour = now.getHours();
  2609. let nMinute = now.getMinutes();
  2610. if (hour === nHour || hour === undefined) {
  2611. return this.integralDivision(0, nMinute, this.inspectAndPatientTransportConfig.timeMod);
  2612. } else {
  2613. return [];
  2614. }
  2615. }
  2616. // start和end之间能被n整除的所有数字集合
  2617. integralDivision(start:number, end:number, n:number): number[]{
  2618. let arr = [];
  2619. for(let i = start; i <= end; i++){
  2620. if(i % n === 0){
  2621. arr.push(i);
  2622. }
  2623. }
  2624. return arr;
  2625. }
  2626. //修改预约建单时间的日期
  2627. yyDateChange(e) {
  2628. // 获取年月日
  2629. let yyDate = new Date(e);
  2630. let year = yyDate.getFullYear();
  2631. let month = yyDate.getMonth();
  2632. let date = yyDate.getDate();
  2633. // 获取当前时间的年月日
  2634. let now = new Date();
  2635. let nYear = now.getFullYear();
  2636. let nMonth = now.getMonth();
  2637. let nDate = now.getDate();
  2638. if (year != nYear || month != nMonth || date != nDate) {
  2639. this.disabledHours = () => [];
  2640. this.disabledMinutes = (hour) => [];
  2641. } else {
  2642. // 禁用小时
  2643. this.disabledHours = () => {
  2644. let now = new Date();
  2645. let nHour = now.getHours();
  2646. let nMinute = now.getMinutes();
  2647. if (nMinute > (60 - this.inspectAndPatientTransportConfig.timeMod)) {
  2648. return range(0, nHour + 1);
  2649. } else {
  2650. return range(0, nHour);
  2651. }
  2652. };
  2653. // 禁用分钟
  2654. this.disabledMinutes = (hour) => {
  2655. let now = new Date();
  2656. let nHour = now.getHours();
  2657. let nMinute = now.getMinutes();
  2658. if (hour === nHour || hour === undefined) {
  2659. return this.integralDivision(0, nMinute, this.inspectAndPatientTransportConfig.timeMod);
  2660. } else {
  2661. return [];
  2662. }
  2663. };
  2664. }
  2665. }
  2666. // 下一日(患者其他服务)
  2667. nextDayZy() {
  2668. this.yyDateZy = addDays(this.yyDateZy, 1);
  2669. this.yyDateChange(this.yyDateZy);
  2670. }
  2671. // 下一日(其他临床服务)
  2672. nextDay() {
  2673. this.yyDate = addDays(this.yyDate, 1);
  2674. this.yyDateChange(this.yyDate);
  2675. }
  2676. // 禁用日期(患者其他服务)
  2677. disabledyyDateZy = (current: Date): boolean => {
  2678. return differenceInCalendarDays(current, new Date()) < 0;
  2679. };
  2680. // 禁用日期(其他)
  2681. disabledyyDate = (current: Date): boolean => {
  2682. return differenceInCalendarDays(current, new Date()) < 0;
  2683. };
  2684. yyTimeZyChange(e) {
  2685. if (this.yyTimeZy) {
  2686. let now = new Date();
  2687. // 禁用日期(转运)
  2688. if (getHours(this.yyTimeZy) < getHours(now)) {
  2689. this.disabledyyDateZy = (current: Date): boolean => {
  2690. return differenceInCalendarDays(current, new Date()) < 1;
  2691. };
  2692. } else {
  2693. this.disabledyyDateZy = (current: Date): boolean => {
  2694. return differenceInCalendarDays(current, new Date()) < 0;
  2695. };
  2696. }
  2697. let end = this.getLgNumber(getMinutes(this.yyTimeZy), this.inspectAndPatientTransportConfig.timeMod);
  2698. this.yyTimeZy = setMinutes(this.yyTimeZy, end);
  2699. }
  2700. this.clickYYZyFlag = false;
  2701. }
  2702. yyTimeChange(e) {
  2703. if (this.yyTime) {
  2704. let now = new Date();
  2705. // 禁用日期(其他)
  2706. if (getHours(this.yyTime) < getHours(now)) {
  2707. this.disabledyyDate = (current: Date): boolean => {
  2708. return differenceInCalendarDays(current, new Date()) < 1;
  2709. };
  2710. } else {
  2711. this.disabledyyDate = (current: Date): boolean => {
  2712. return differenceInCalendarDays(current, new Date()) < 0;
  2713. };
  2714. }
  2715. let end = this.getLgNumber(getMinutes(this.yyTime), this.inspectAndPatientTransportConfig.timeMod);
  2716. this.yyTime = setMinutes(this.yyTime, end);
  2717. }
  2718. this.clickYYFlag = false;
  2719. }
  2720. // 需要预约建单-事件
  2721. yyInspectChange(e) {
  2722. if (this.currentTasktype.associationType.value === "other") {
  2723. //其他临床服务
  2724. this.yyTime = null;
  2725. this.yyDate = new Date();
  2726. console.log(this.isYyInspect);
  2727. } else if (this.currentTasktype.associationType.value === "patientTransport") {
  2728. //患者其他服务
  2729. this.yyTimeZy = null;
  2730. this.yyDateZy = new Date();
  2731. }else if (this.currentTasktype.associationType.value === "inspect") {
  2732. //陪检
  2733. let obj = this.filterLinkCheckLis.find((item) => {
  2734. return (parse(item.yyTime, 'yyyy-MM-dd HH:mm:ss', new Date()).getTime() - new Date().getTime() > 0);
  2735. });
  2736. if (obj) {
  2737. this.showDateTime();
  2738. } else {
  2739. this.yyTimeZy = null;
  2740. this.yyDateZy = new Date();
  2741. console.log(this.isYyInspect);
  2742. }
  2743. }
  2744. }
  2745. //回显时间日期
  2746. showDateTime() {
  2747. //当前时间要大于生效时间
  2748. let isYyInspect = this.filterLinkCheckLis.every((item) => {
  2749. return (parse(item.yyTime, 'yyyy-MM-dd HH:mm:ss', new Date()).getTime() - new Date().getTime() > 0);
  2750. });
  2751. //如果勾选需要预约检查
  2752. if (isYyInspect) {
  2753. //筛选离当前时间最近的
  2754. let timeList = this.filterLinkCheckLis
  2755. .map((item) => parse(item.yyTime, 'yyyy-MM-dd HH:mm:ss', new Date()).getTime())
  2756. .sort();
  2757. this.yyTimeZy = new Date(timeList[0] - 0); //回显预约时间,需要减去生效时间
  2758. this.yyDateZy = new Date(timeList[0] - 0); //回显预约日期,需要减去生效时间
  2759. this.yyDateChange(this.yyTimeZy);
  2760. } else {
  2761. this.yyTimeZy = null;
  2762. this.yyDateZy = null;
  2763. }
  2764. }
  2765. // 患者送检检查项目-选择检查项目
  2766. linkCheckLisTrue = false; //是否有已选择(患者)
  2767. filterLinkCheckLis = []; //有预约时间并且选中的
  2768. isInspects = false; //勾选检车的时候是否多个检查多个检查科室
  2769. linkCheckLisChange(e) {
  2770. let flag = false; //检查是否紧急
  2771. let arr = []; //选中的索引
  2772. // 是否检查生成工单允许多个科室,1是,0否
  2773. if (this.currentTasktype.isMoreDept === 0) {
  2774. let arr = e.map((item) => item.execDeptId);
  2775. arr = Array.from(new Set(arr));
  2776. this.isInspects = arr.length > 1;
  2777. }
  2778. this.linkCheckLis.forEach((item, index) => {
  2779. if (e.length) {
  2780. //有选中的检查
  2781. e.forEach((v) => {
  2782. //检查是否有紧急度
  2783. if (v.priority == 1) {
  2784. flag = true;
  2785. }
  2786. //选中的检查设置checked
  2787. if (v.value == item.value) {
  2788. arr.push(index);
  2789. }
  2790. });
  2791. } else {
  2792. item.checked = false;
  2793. }
  2794. });
  2795. this.linkCheckLis.forEach((item, index) => {
  2796. item.checked = arr.includes(index);
  2797. });
  2798. console.log(e, this.linkCheckLis);
  2799. this.clickYYFlag = false;
  2800. // 有预约时间并且选中的
  2801. this.filterLinkCheckLis = this.linkCheckLis.filter(
  2802. (item) => Boolean(item.yyTime) && item.checked
  2803. );
  2804. //有预约时间并且选中的检查数组不为空
  2805. if (this.filterLinkCheckLis.length) {
  2806. //当前时间要大于生效时间
  2807. this.isYyInspect = this.filterLinkCheckLis.every((item) => {
  2808. return (parse(item.yyTime, 'yyyy-MM-dd HH:mm:ss', new Date()).getTime() - new Date().getTime() > 0);
  2809. });
  2810. //不加急状态下,回显时间
  2811. this.showDateTime();
  2812. } else {
  2813. //有预约时间并且选中的检查数组为空
  2814. this.isYyInspect = false;
  2815. this.yyTimeZy = null;
  2816. this.yyDateZy = null;
  2817. }
  2818. this.linkCheckLisTrue = e.length > 0;
  2819. }
  2820. // 转运类型选中类型(单选)触发
  2821. yyDateZy = null; //预约日期-患者其他服务
  2822. yyDate = null; //预约日期-其他临床服务
  2823. yyTimeZy = null; //预约时间-患者其他服务
  2824. yyTime = null; //预约时间-其他临床服务
  2825. inspectAndPatientTransportConfig:any = {timeMod: 30};
  2826. isYyInspect = false; //需要预约检查
  2827. clickYYZyFlag = false; //是否点击预约建单-患者其他服务
  2828. clickYYFlag = false; //是否点击预约建单-其他临床服务
  2829. currentTasktype = null; //当前选中的任务类型对象
  2830. isTaskTypeInspect:boolean = false;//是否是患者陪检
  2831. linkCheckLis:any[] = [];//检查列表
  2832. tabIndex;
  2833. isStartFixedType:boolean = false;
  2834. isEndFixedType:boolean = false;
  2835. //获取携带设备
  2836. goodsNow; //携带的物品列表
  2837. getAllGoods() {
  2838. this.mainService.getDictionary("list", "goods").subscribe((data) => {
  2839. let goodsNow = data || [];
  2840. this.goodsNow = [];
  2841. goodsNow.forEach((e) => {
  2842. this.goodsNow.push({
  2843. label: e.name,
  2844. value: e.id,
  2845. checked: false,
  2846. });
  2847. });
  2848. });
  2849. }
  2850. //获取陪检方式
  2851. workOrderInspectScoreList:any[] = [];
  2852. workOrderInspectScore:any;
  2853. getWorkOrderInspectScore() {
  2854. let postData = { idx: 0, sum: 9999, workOrderInspectScore: { hosId: this.currentHospital.id } };
  2855. this.mainService
  2856. .getFetchDataList("simple/data", "workOrderInspectScore", postData)
  2857. .subscribe((result) => {
  2858. if (result.status == 200) {
  2859. this.workOrderInspectScoreList = result.list || [];
  2860. } else {
  2861. this.msg.error("请求数据失败");
  2862. }
  2863. });
  2864. }
  2865. psValue:any;
  2866. taskType:any;
  2867. radioChangeQt(value) {
  2868. //任务类型id
  2869. if (value === "" || value === null) {
  2870. return;
  2871. }
  2872. let index = this.tabIndex;
  2873. // let item = this.workTypesArrange[1].value.find(v => v.id == value);
  2874. // console.log(788787,item)
  2875. // this.taskType = item.associationTypeValue?item.associationTypeValue:null
  2876. this.psValue = value
  2877. this.startDeptQt = null;
  2878. this.endDeptQt = null;
  2879. // 返回值的status是201 则是默认发起科室,把申请科室作为值
  2880. // 返回值的status是202 则是固定科室范围,会返回科室列表
  2881. // 返回值的status是203 则是固定科室,会返回单个科室
  2882. // 返回值的status是204 则让前端自己调用科室搜索接口
  2883. // 返回值的status是205 则是固定科室类型,会返回科室列表
  2884. this.mainService.getdeptList(value).subscribe((data:any) => {
  2885. this.deptQtList = data;
  2886. if(data.startStatus==202 || data.startStatus==204 || data.startStatus==205){
  2887. this.isStartFixedType = true
  2888. }else{
  2889. this.isStartFixedType = false
  2890. }
  2891. if(data.endStatus==202 || data.endStatus==204 || data.endStatus==205){
  2892. this.isEndFixedType = true
  2893. }else{
  2894. this.isEndFixedType = false
  2895. }
  2896. // 预约start
  2897. this.currentTasktype = data.taskType;
  2898. this.isYyInspect = false;
  2899. this.clickYYFlag = false;
  2900. this.yyDate = new Date();
  2901. this.yyTime = null;
  2902. // 预约end
  2903. this.deptQtList.taskType.customRemarks = this.deptQtList.taskType.customRemarks ? this.deptQtList.taskType.customRemarks.split("$") : [];
  2904. // 起点科室
  2905. if (data["startStatus"] == 201) {
  2906. if (this.applyDept) {
  2907. //选择了申请科室,则起点科室就是申请科室
  2908. this.deptQtList["startDept"] = this.applicationDepartmentList.filter(
  2909. (item) => item.id == this.applyDept
  2910. );
  2911. this.startDeptQt = this.applyDept;
  2912. }
  2913. } else if (data["startStatus"] == 203) {
  2914. this.startDeptQt = data["startDept"][0]["id"];
  2915. } else if (data["startStatus"] == 204 || data["startStatus"] == 205) {
  2916. this.getHosDepartmentQt(this.currentHospital.id, "start", "");
  2917. }
  2918. // 终点科室
  2919. if (data["endStatus"] == 201) {
  2920. if (this.applyDept) {
  2921. //选择了申请科室,则终点科室就是申请科室
  2922. this.deptQtList["endDept"] = this.applicationDepartmentList.filter(
  2923. (item) => item.id == this.applyDept
  2924. );
  2925. this.endDeptQt = this.applyDept;
  2926. }
  2927. } else if (data["endStatus"] == 203) {
  2928. this.endDeptQt = data["endDept"][0]["id"];
  2929. } else if (data["endStatus"] == 204 || data["endStatus"] == 205) {
  2930. this.getHosDepartmentQt(this.currentHospital.id, "end", "");
  2931. }
  2932. });
  2933. }
  2934. //新建工单->确定提交
  2935. isGoLoading = false;
  2936. goType:any;
  2937. nucleicAcidPrintingCancel():void {
  2938. this.fixedTab = '';
  2939. }
  2940. // 取消
  2941. newOrderCancel(): void {
  2942. this.newOrderShow = false;
  2943. this.newOrderShowOpen = false;
  2944. // this.currentTabIndex = "";
  2945. this.fixedTab = "";
  2946. this.fixedMenuShangla();
  2947. this.goType = null;
  2948. this.radioValueQt = null;
  2949. this.startDeptQt = null;
  2950. this.endDeptQt = null;
  2951. this.radioValueZy = null;
  2952. this.radioValueZyPre = null;
  2953. this.startDeptZy = null;
  2954. this.endDeptZy = null;
  2955. this.patientZy = null;
  2956. this.goodsNow = [];
  2957. this.workOrderInspectScore = undefined;
  2958. this.patientList = [];
  2959. this.workOrderRemark = "";
  2960. this.workOrderRemarkZy = "";
  2961. this.deptZyList["startDept"] = [];
  2962. this.deptZyList["endDept"] = [];
  2963. this.deptZyList["startStatus"] = 0;
  2964. this.deptZyList["endStatus"] = 0;
  2965. this.deptQtList["startDept"] = [];
  2966. this.deptQtList["endDept"] = [];
  2967. this.deptQtList["startStatus"] = 0;
  2968. this.deptQtList["endStatus"] = 0;
  2969. this.eventData = null
  2970. this.tool.triggerEndEvent({
  2971. message:'关单',
  2972. })
  2973. }
  2974. // 撤回
  2975. // 打开撤回模态框
  2976. openRecallModal(id) {
  2977. this.coopId = id;
  2978. this.recallOrderShow = true;
  2979. }
  2980. // 确认撤回
  2981. btnLoading:any;
  2982. confirmRec() {
  2983. let that = this;
  2984. that.btnLoading = true;
  2985. let postData: any = {};
  2986. let flags = "";
  2987. this.coopId = this.coopId + "";
  2988. if (this.coopId.includes("-")) {
  2989. //批量
  2990. flags = "batchExcuteWorkOrder";
  2991. let ids = this.coopId.split("-");
  2992. postData.workOrders = [];
  2993. ids.forEach((item) => {
  2994. postData.workOrders.push({ id: item, type: "recall" });
  2995. });
  2996. } else {
  2997. flags = "excuteWorkOrder/recall";
  2998. postData = {
  2999. workOrder: {
  3000. id: this.coopId,
  3001. },
  3002. };
  3003. }
  3004. that.mainService.coopWorkerOrder(flags, postData).subscribe((data) => {
  3005. that.btnLoading = false;
  3006. that.closeRecallOrderModal();
  3007. if (data.status == 200) {
  3008. that.showPromptModal("撤回", true, "");
  3009. } else {
  3010. that.showPromptModal("撤回", false, data.msg);
  3011. }
  3012. });
  3013. }
  3014. // 撤回并删除
  3015. recDelLoading:boolean = false;
  3016. recAndDel() {
  3017. let that = this;
  3018. that.recDelLoading = true;
  3019. that.mainService.delOrder(that.coopId).subscribe((data) => {
  3020. that.recDelLoading = false;
  3021. console.log(data);
  3022. that.closeRecallOrderModal();
  3023. if (data.status == 200) {
  3024. that.showPromptModal("删除", true, "");
  3025. } else {
  3026. that.showPromptModal("删除", false, data.msg);
  3027. }
  3028. });
  3029. }
  3030. // 关闭撤回模态框
  3031. batchClickType1:boolean = false;
  3032. recallOrderShow:boolean = false;
  3033. closeRecallOrderModal() {
  3034. this.recallOrderShow = false;
  3035. this.batchClickType1 = false;
  3036. }
  3037. // 删除
  3038. // 打开模态框
  3039. coopId; //当前操作id
  3040. coopType;
  3041. delOrderShow:boolean = false
  3042. openDelModal(id, type) {
  3043. this.coopId = id;
  3044. this.coopType = type;
  3045. this.delOrderShow = true;
  3046. }
  3047. // 关闭模态框
  3048. closeDelOrderModal() {
  3049. this.delOrderShow = false;
  3050. }
  3051. // 新建工单
  3052. // 提交选择转入科室的模态框
  3053. dataStatus:any;
  3054. limitTimeModal: boolean = false; //模态框
  3055. limitTimeInfo:string = '';
  3056. limitTimeItem: any = {};
  3057. hideLimitTimeModal() {
  3058. this.limitTimeModal = false;
  3059. }
  3060. // 建单判断时间-护士端建单通用方法
  3061. isShowConfirm:boolean = true;
  3062. isShowConfirmInfo:string = '';
  3063. newOrderTimeFun(order, fun1, fun2){
  3064. fun2.call(this)
  3065. }
  3066. repeatModal: boolean = false; //删除模态框
  3067. repeatMsg = "";
  3068. loadingRepeat = false;
  3069. repeatPostData;
  3070. sourceType;
  3071. showRepeatModal(postData, sourceType, go) {
  3072. this.repeatModal = true;
  3073. this.repeatPostData = postData;
  3074. this.sourceType = sourceType;
  3075. // if(this.goType=='&go&'){
  3076. // this.showRepetitionModal("建单", true, "", "closeGo");
  3077. // }
  3078. }
  3079. hideRepeatModal() {
  3080. this.repeatModal = false;
  3081. this.btnLoading = false;
  3082. this.confirmType = false;
  3083. if(this.goType=='&go&'){
  3084. console.log('fou222222')
  3085. this.showNewOrder("&go&");
  3086. // this.showRepetitionModal("建单", true, "", "closeGo");
  3087. }
  3088. }
  3089. confirmType:boolean = false;
  3090. currentDept:any;
  3091. confirmRepeat() {
  3092. this.confirmType = true;
  3093. this.loadingRepeat = true;
  3094. this.repeatPostData.tipsCreateOder = 1;
  3095. let url = null;
  3096. if(this.isYyInspect){
  3097. url = this.mainService.postCustom("api", "appointmentOrder", this.repeatPostData)
  3098. }else{
  3099. url = this.mainService.buildOrder(this.repeatPostData)
  3100. }
  3101. url.subscribe((data) => {
  3102. this.loadingRepeat = false;
  3103. this.repeatModal = false;
  3104. if(this.currentDept.typeValue == 'recovery'){
  3105. this.mainService.postCustom("api", "clearPatientRecoveryDept", {patientCode: this.repeatPostData.workOrder.patient.patientCode}).subscribe((resultData) => {
  3106. this.confirmRepeatFun(data);
  3107. });
  3108. }else{
  3109. this.confirmRepeatFun(data);
  3110. }
  3111. });
  3112. }
  3113. confirmRepeatFun(data){
  3114. console.log(10087,this.sourceType)
  3115. if (this.sourceType === "specimen") {
  3116. // 标本建单
  3117. if (data.status == 200){
  3118. this.showRepetitionModal("创建", true, "");
  3119. }else if(data.status == 100043){
  3120. this.showRepetitionModal("创建", true, data.msg);
  3121. }else{
  3122. this.showRepetitionModal("创建", false, data.msg);
  3123. }
  3124. // if (data.status == 200 && (this.taskType == "other" || this.taskType == "ordinary")) {
  3125. // this.showRepetitionModal("创建", true, "", this.taskType);
  3126. // } else if (data.status == 200 && this.taskType == "bb") {
  3127. // this.showRepetitionModal("创建", true, "", "bb");
  3128. // } else if (this.taskType == "bb" && data.status == 100043) {
  3129. // this.showRepetitionModal("创建", true, data.msg);
  3130. // } else if (data.status == 100043){
  3131. // this.showRepetitionModal("创建", true, data.msg);
  3132. // } else {
  3133. // this.showRepetitionModal("创建", false, data.msg);
  3134. // }
  3135. } else if (this.sourceType === "other" || this.sourceType === "ordinary") {
  3136. // 其他建单
  3137. if (data.status == 200){
  3138. this.showRepetitionModal("创建", true, "");
  3139. }else if(data.status == 100043){
  3140. this.showRepetitionModal("创建", true, data.msg);
  3141. }else{
  3142. this.showRepetitionModal("创建", false, data.msg);
  3143. }
  3144. // if (data.status == 200 && (this.taskType == "other" || this.taskType == "ordinary")) {
  3145. // this.showRepetitionModal("创建", true, "", this.taskType);
  3146. // } else if (data.status == 200 && this.taskType == "bb") {
  3147. // this.showRepetitionModal("创建", true, "", "bb");
  3148. // } else if (this.taskType == "bb" && data.status == 100043) {
  3149. // this.showRepetitionModal("创建", true, data.msg);
  3150. // } else if (data.status == 100043){
  3151. // this.showRepetitionModal("创建", true, data.msg);
  3152. // } else {
  3153. // this.showRepetitionModal("创建", false, data.msg);
  3154. // }
  3155. } else if (this.sourceType === "transport") {
  3156. // 转运
  3157. if (data.status == 200) {
  3158. this.showRepetitionModal("创建", true, "");
  3159. } else if (data.status == 100042) {
  3160. this.showRepetitionModal("创建", false, data.msg);
  3161. } else {
  3162. this.showRepetitionModal("创建", false, data.msg);
  3163. }
  3164. } else if (this.sourceType === "accompany1") {
  3165. // 陪检
  3166. if (data.status == 200) {
  3167. this.showRepetitionModal("创建", true, "");
  3168. } else if (data.status == 100042) {
  3169. this.showRepetitionModal("创建", false, data.msg);
  3170. } else {
  3171. this.showRepetitionModal("创建", false, data.msg);
  3172. }
  3173. } else if (this.sourceType === "accompany2") {
  3174. // 陪检
  3175. if (data.status == 200) {
  3176. this.showRepetitionModal("创建", true, "");
  3177. } else if (data.status == 100042) {
  3178. this.showRepetitionModal("创建", false, data.msg);
  3179. } else {
  3180. this.showRepetitionModal("创建", false, data.msg);
  3181. }
  3182. } else if (this.sourceType === "accompany3") {
  3183. // 陪检
  3184. if (data.status == 200) {
  3185. this.showRepetitionModal("创建", true, "");
  3186. } else if (data.status == 100042) {
  3187. this.showRepetitionModal("创建", false, data.msg);
  3188. } else {
  3189. this.showRepetitionModal("创建", false, data.msg);
  3190. }
  3191. } else if (this.sourceType === "accompany4") {
  3192. // 陪检
  3193. if (data.status == 200) {
  3194. this.showRepetitionModal("创建", true, "");
  3195. } else if (data.status == 100042) {
  3196. this.showRepetitionModal("创建", false, data.msg);
  3197. } else {
  3198. this.showRepetitionModal("创建", false, data.msg);
  3199. }
  3200. } else if (this.sourceType === "accompany5") {
  3201. // 陪检
  3202. if (data.status == 200) {
  3203. this.showRepetitionModal("创建", true, "");
  3204. } else if (data.status == 100042) {
  3205. this.showRepetitionModal("创建", false, data.msg);
  3206. } else {
  3207. this.showRepetitionModal("创建", false, data.msg);
  3208. }
  3209. } else {
  3210. if (data.status == 200) {
  3211. this.showRepetitionModal("创建", true, "");
  3212. } else if (data.status == 100042) {
  3213. this.showRepetitionModal("创建", false, data.msg);
  3214. } else if (data.status == 100043) {
  3215. this.showRepetitionModal("创建", true, data.msg);
  3216. } else {
  3217. this.showRepetitionModal("创建", false, data.msg);
  3218. }
  3219. }
  3220. }
  3221. // 隐藏选择转入科室的模态框
  3222. deptFlagHand(e) {
  3223. this.deptFlag = false;
  3224. }
  3225. // 打开模态框,服务台右侧转入院记录建单
  3226. createOrderObj; //当前操作id
  3227. createLoading = false;
  3228. deptFlag = false;
  3229. patientLogBuild(obj) {
  3230. this.createOrderObj = obj;
  3231. this.deptFlag = true;
  3232. }
  3233. // 初始化展示形式
  3234. controlView:any = {}; //展示形式
  3235. hurseInfoHiding:any;
  3236. audioNotDispatched:any;
  3237. orderInfoTime:any;
  3238. workerInfoTime:any;
  3239. txtLabelCol:any;
  3240. patientCareCol:any;
  3241. typeId:any;
  3242. checkTab:any;
  3243. workerRefreshTime:any;
  3244. orderRefreshTime:any;
  3245. initControlView() {
  3246. let postData = {
  3247. controlView: {},
  3248. idx: 0,
  3249. sum: 1,
  3250. };
  3251. this.mainService
  3252. .coopTypeConfig("fetchDataList", "controlView", postData)
  3253. .subscribe((data) => {
  3254. this.controlView = data.list[0] ? data.list[0] : {
  3255. hurseInfoHiding: 1,
  3256. orderInfoTime: 60,
  3257. workerInfoTime: 60,
  3258. unsendOrderVoice: true,
  3259. orderType: 'priority',
  3260. };
  3261. this.patientCareCol = 7;
  3262. this.hurseInfoHiding = this.controlView.hurseInfoHiding ? 1 : 0;
  3263. this.txtLabelCol = 1;
  3264. this.orderRefreshTime = this.orderInfoTime = this.controlView.orderInfoTime;
  3265. this.workerRefreshTime = this.workerInfoTime = this.controlView.workerInfoTime;
  3266. this.audioNotDispatched = this.controlView.unsendOrderVoice !== false;
  3267. this.orderType = this.controlView.orderType || 'priority';
  3268. // this.getOrderList(1);
  3269. // this.getOrderList(2);
  3270. // this.getOrderList(3);
  3271. });
  3272. }
  3273. // 保存展现形式
  3274. saveLoading:boolean = false
  3275. saveControlView() {
  3276. let that = this;
  3277. that.saveLoading = true;
  3278. let wn;
  3279. switch (that.patientCareCol) {
  3280. case 6:
  3281. wn = 1;
  3282. break;
  3283. case 7:
  3284. wn = 2;
  3285. break;
  3286. case 4:
  3287. wn = 3;
  3288. break;
  3289. }
  3290. let postData = {
  3291. controlView: {
  3292. workerNum: wn,
  3293. labelNum: that.txtLabelCol,
  3294. workerInfoTime: that.workerInfoTime,
  3295. orderInfoTime: that.orderInfoTime,
  3296. unsendOrderVoice: that.audioNotDispatched,
  3297. hurseInfoHiding: that.hurseInfoHiding === 1,
  3298. orderType: this.orderType,
  3299. },
  3300. };
  3301. if (that.controlView["id"]) {
  3302. postData.controlView["id"] = that.controlView["id"];
  3303. }
  3304. console.log(postData);
  3305. that.mainService
  3306. .coopTypeConfig("addData", "controlView", postData)
  3307. .subscribe((data) => {
  3308. that.saveLoading = false;
  3309. if (data.status == 200) {
  3310. that.msg.success('排序成功');
  3311. this.initControlView();
  3312. } else {
  3313. that.msg.error(data.msg || '排序失败');
  3314. }
  3315. });
  3316. }
  3317. // 确认
  3318. jdFlagId;
  3319. limitTimeLoading:boolean = false;
  3320. confirmLimitTime() {
  3321. console.log(this.limitTimeItem);
  3322. this.limitTimeModal = false;
  3323. this.jdFlagId = this.msg.loading("正在加载中..", {
  3324. nzDuration: 0,
  3325. }).messageId;
  3326. this.limitTimeItem.fun2.call(this);
  3327. }
  3328. closeModel(e) {
  3329. console.log(99999,e)
  3330. if (e === "close") {
  3331. this.goType = null;
  3332. this.newOrderShowOpen = false; //此时可出现新的弹窗
  3333. } else if (e === "closeGo") {
  3334. console.log(1111)
  3335. this.showNewOrder("&go&");
  3336. }else if(this.dataStatus==1000033 && this.goType=='&go&'){
  3337. console.log(2222)
  3338. this.showNewOrder("&go&");
  3339. }
  3340. }
  3341. // 重复建单提示框
  3342. promptModalShow:boolean = false;
  3343. back:any;
  3344. promptInfo:any;
  3345. ifSuccess:any;
  3346. promptContent:any;
  3347. showRepetitionModal(con, success, promptInfo?, back?){
  3348. this.promptModalShow = false;
  3349. this.promptContent = con;
  3350. this.ifSuccess = success;
  3351. this.promptInfo = promptInfo;
  3352. this.back = back || "";
  3353. setTimeout(() => {
  3354. if(this.confirmType || this.goType=='&go&'){
  3355. this.showPromptModalRefresh();
  3356. this.promptModalShow = true;
  3357. }
  3358. }, 100);
  3359. }
  3360. // 展示信息提示框(con:提示信息,success:操作是否成功,promptInfo:操作结果提示信息)(con:提示信息,success:操作是否成功,promptInfo:操作结果提示信息)
  3361. showPromptModal(con, success, promptInfo?, back?) {
  3362. this.promptModalShow = false;
  3363. this.promptContent = con;
  3364. this.ifSuccess = success;
  3365. this.promptInfo = promptInfo;
  3366. this.back = back || "";
  3367. setTimeout(() => {
  3368. this.showPromptModalRefresh();
  3369. this.promptModalShow = true;
  3370. }, 100);
  3371. }
  3372. showPromptModalRefresh(){
  3373. // this.goType = null;
  3374. // this.confirmType = false;
  3375. // this.getUnassignedBuilding2();
  3376. // this.resetList();
  3377. // this.getOrderList(1);
  3378. // this.getOrderList(2);
  3379. // this.getOrderList(3);
  3380. // this.getVisitList();
  3381. // this.getMessageList();
  3382. // if (this.currentRTab === 0) {
  3383. // this.getWorkOrders(this.applyDept);
  3384. // } else if (this.currentRTab === 1) {
  3385. // this.getPatientLog(this.applyDept);
  3386. // } else if (this.currentRTab === 2) {
  3387. // this.getItsmOrders(this.incidentModel.department);
  3388. // } else if (this.currentRTab === 3) {
  3389. // this.getDictionaryList();
  3390. // }
  3391. // this.newOrderShow = false;
  3392. // this.newOrderShowOpen = false;
  3393. this.eventData = null
  3394. this.tool.triggerEndEvent({
  3395. message:'关单',
  3396. })
  3397. this.fixedTab = "";
  3398. this.fixedMenuShangla();
  3399. }
  3400. // 右侧菜单
  3401. showLastItems: boolean = false;
  3402. fixedTabLany:any;
  3403. fixedTab:any;
  3404. // 下拉
  3405. fixedMenuXiala() {
  3406. this.showLastItems = true;
  3407. }
  3408. // 上拉
  3409. fixedMenuShangla() {
  3410. this.showLastItems = false;
  3411. this.fixedTab = "";
  3412. }
  3413. // 格式化时分秒
  3414. // (时间小于一分钟则显示秒,时间大于一分钟则显示分钟数,如超出一小时则显示小时和分钟。)time: 秒
  3415. formatTime(time) {
  3416. let timeStr = "";
  3417. if (time >= 0 && time < 60) {
  3418. // 秒
  3419. timeStr = time + "秒";
  3420. } else if (time >= 60 && time < 3600) {
  3421. // 分钟
  3422. timeStr = Math.floor(time / 60) + "分钟";
  3423. } else if (time >= 3600) {
  3424. // 时 + 分
  3425. let h = "";
  3426. let m = "";
  3427. h = Math.floor(time / 3600) + "小时";
  3428. m = time % 3600 >= 60 ? Math.floor((time % 3600) / 60) + "分钟" : "";
  3429. timeStr = h + m;
  3430. }
  3431. return timeStr;
  3432. }
  3433. // 菜单拖拽-上下
  3434. moveMenu(nodeId) {
  3435. let fixedMenu = document.getElementById(nodeId);
  3436. if (!fixedMenu) return;
  3437. fixedMenu.onmousedown = function (e) {
  3438. fixedMenu.classList.remove('maskFull');
  3439. let y = e.clientY - fixedMenu.offsetTop;
  3440. document.onmousemove = function (ev) {
  3441. fixedMenu.classList.add('maskFull');
  3442. var _y = ev.clientY - y > 0 ? ev.clientY - y : 0;
  3443. var wh = window.innerHeight;
  3444. if (_y > wh - fixedMenu.clientHeight) {
  3445. _y = wh - fixedMenu.clientHeight;
  3446. }
  3447. fixedMenu.style.top = _y + "px";
  3448. };
  3449. document.onmouseup = function () {
  3450. fixedMenu.classList.remove('maskFull');
  3451. document.onmousemove = null;
  3452. document.onmouseup = null;
  3453. };
  3454. };
  3455. }
  3456. // 处理人+协同人
  3457. transferSynergetic(incidentData){
  3458. let str = incidentData.groupORHandlerUser || "";
  3459. if(incidentData.synergetic && incidentData.synergetic.length){
  3460. str += ',' + incidentData.synergetic.map(v => v.name).join(',');
  3461. }
  3462. return str;
  3463. }
  3464. // 菜单拖拽-自由
  3465. moveMenuAll(nodeId) {
  3466. let fixedMenu = document.getElementById(nodeId);
  3467. if (!fixedMenu) return;
  3468. fixedMenu.onmousedown = function (e) {
  3469. fixedMenu.classList.remove('maskFull');
  3470. let x = e.clientX - fixedMenu.offsetLeft;
  3471. let y = e.clientY - fixedMenu.offsetTop;
  3472. document.onmousemove = function (ev) {
  3473. fixedMenu.classList.add('maskFull');
  3474. var _y = ev.clientY - y > 0 ? ev.clientY - y : 0;
  3475. var h = window.innerHeight;
  3476. if (_y > h - fixedMenu.clientHeight) {
  3477. _y = h - fixedMenu.clientHeight;
  3478. }
  3479. fixedMenu.style.top = _y + "px";
  3480. var _x = ev.clientX - x > 0 ? ev.clientX - x : 0;
  3481. var w = window.innerWidth;
  3482. if (_x > w - fixedMenu.clientWidth) {
  3483. _x = w - fixedMenu.clientWidth;
  3484. }
  3485. fixedMenu.style.right = w - _x - fixedMenu.clientWidth + "px";
  3486. };
  3487. document.onmouseup = function () {
  3488. fixedMenu.classList.remove('maskFull');
  3489. document.onmousemove = null;
  3490. document.onmouseup = null;
  3491. };
  3492. };
  3493. }
  3494. // tab头部分组向左移动
  3495. disXHead = 0;
  3496. headToLeft() {
  3497. let num = Math.floor(this.tabs.nativeElement.offsetWidth / 126);
  3498. let maxStep = this.scopeGroups.length - (num - 1);
  3499. this.disStep = Math.max(-maxStep, --this.disStep);
  3500. this.disXHead = this.disStep * 126;
  3501. }
  3502. // tab头部分组向右移动
  3503. headToRight() {
  3504. this.disStep = Math.min(0, ++this.disStep);
  3505. this.disXHead = this.disStep * 126;
  3506. }
  3507. //服务台建单任务类型搜索查询
  3508. onSearchTaskBuild(e) {
  3509. this.onSearchTaskBuildSubject.next(e);
  3510. }
  3511. //获取任务类型
  3512. getTasktypeByPhone(e) {
  3513. this.getSearchTaskList(e).subscribe((result) => {
  3514. if (result.status == 200) {
  3515. this.searchTaskLoading = false;
  3516. this.searchTaskList = result.data;
  3517. this.searchTaskList.forEach((item) => {
  3518. item.sid = item.associationTypeId + "_" + item.id + "_" + item.associationTypeValue;
  3519. });
  3520. }
  3521. });
  3522. }
  3523. //服务台建单任务类型回车,0_1,0是关联类型,1是任务类型
  3524. changeTaskBuild(e) {
  3525. let arr = e.split("_");
  3526. if(arr[2] === 'other' || arr[2] === 'specimen' || arr[2] === 'ordinary'){
  3527. this.currentTabIndex = '物品配送';
  3528. }else if(arr[2] === 'patientTransport'){
  3529. this.currentTabIndex = '患者转运';
  3530. }
  3531. if (this.currentTabIndex == "患者转运") {
  3532. //患者其他服务业务
  3533. this.radioValueZy = +arr[1];
  3534. } else if (this.currentTabIndex == "物品配送") {
  3535. //其他临床服务
  3536. this.radioValueQt = +arr[1];
  3537. }
  3538. }
  3539. // 服务台建单输入住院号,查到有且仅有一个患者,则自动选中【患者转运】,自动带出【申请科室】,自动带出【患者信息】
  3540. changeResidenceNo(e){
  3541. console.log(e);
  3542. this.changeCommonInpSubject.next(['patient', e]);
  3543. }
  3544. // 运维、配送工单切换
  3545. filterOrderList(type, state){
  3546. // if(!this.itsmData.mdv2Switch && this.hsmsData.hsmsSwitch){
  3547. // return;
  3548. // }
  3549. // if(this.itsmData.mdv2Switch && !this.hsmsData.hsmsSwitch){
  3550. // return;
  3551. // }
  3552. this.flagList[`${type}Flag${state}`] = !this.flagList[`${type}Flag${state}`];
  3553. // this.getOrderList(state, state === 1);
  3554. }
  3555. // 排序
  3556. orderType: string = 'priority'; //排序方式 priority:优先级,time:时间
  3557. orderList(){
  3558. this.orderType = this.orderType === 'priority' ? 'time' : 'priority';
  3559. this.saveControlView();
  3560. }
  3561. // 优先级颜色
  3562. priorityColor(priorityId) {
  3563. // 极低|低
  3564. if(priorityId == 1 || priorityId == 2){
  3565. return '';
  3566. } else if(priorityId == 3){
  3567. return 'yellow';
  3568. } else if(priorityId == 4 || priorityId == 5){
  3569. return 'red';
  3570. }
  3571. }
  3572. // 延期记录
  3573. transferHandlerLog = function (currentLog) {
  3574. if(!currentLog){
  3575. return '';
  3576. }
  3577. currentLog = cloneDeep(currentLog);
  3578. if(currentLog.extra1DTO && currentLog.extra2 && currentLog.startTime){
  3579. if(currentLog.extra2==0.5){
  3580. currentLog.extra2 = 4;
  3581. return currentLog.extra1DTO.name+"<br>"+ format(addHours(currentLog.startTime, +currentLog.extra2), "MM月dd日")+"<br>"+ format(addHours(currentLog.startTime, +currentLog.extra2), "HH时mm分前完成");
  3582. }else{
  3583. return currentLog.extra1DTO.name+"<br>"+ format(addDays(currentLog.startTime, +currentLog.extra2), "MM月dd日前完成");
  3584. }
  3585. }else{
  3586. return '';
  3587. }
  3588. }
  3589. // 生成工单
  3590. buildType;
  3591. editOrder;
  3592. generateOrder(data){
  3593. this.editOrder = cloneDeep(data);
  3594. let incidentModel = cloneDeep(data);
  3595. let incidentMsg:any = {};
  3596. console.log('data:', data)
  3597. // incidentModel.department && (this.applicationDeptList = [cloneDeep(incidentModel.department)]);
  3598. incidentModel.department && (incidentMsg.deptManyPhone = incidentModel.department.manyPhone);
  3599. incidentModel.department && (incidentMsg.deptName = incidentModel.department.dept);
  3600. incidentModel.department && (incidentModel.department = incidentModel.department.id);
  3601. incidentModel.requester && (this.applicationRequesterList = [cloneDeep(incidentModel.requester)]);
  3602. incidentModel.requester && (incidentMsg.requesterPhone = incidentModel.requester.phone);
  3603. incidentModel.requester && (incidentMsg.requesterName = incidentModel.requester.name);
  3604. incidentModel.requester && (incidentModel.requester = incidentModel.requester.id);
  3605. if(incidentModel.repairIncidentType){
  3606. incidentModel.repairIncidentType = incidentModel.repairIncidentType.value
  3607. this.changeRepairIncidentType(incidentModel.repairIncidentType);
  3608. }
  3609. incidentModel.source && (incidentModel.source = incidentModel.source.id);
  3610. incidentModel.area && (incidentModel.area = incidentModel.area.id);
  3611. incidentModel.place && (incidentModel.place = incidentModel.place.id);
  3612. incidentModel.category && (this.applicationCategoryList = [cloneDeep(incidentModel.category)]);
  3613. incidentModel.category && (incidentModel.category = incidentModel.category.id);
  3614. this.incidentModel = incidentModel;
  3615. this.incidentMsg = incidentMsg;
  3616. this.incidentModel.category && this.changeApplyCategory(this.incidentModel.category, true);
  3617. console.log('this.applicationDeptList:', this.applicationDeptList)
  3618. console.log('incidentModel:', incidentModel)
  3619. this.showNewOrder('', '', true, '报修转事件');
  3620. // 查询报修图片
  3621. this.getRepairImgs(data.id);
  3622. }
  3623. // 继续建单
  3624. storageSj(data){
  3625. this.editOrder = cloneDeep(data);
  3626. let incidentModel = cloneDeep(data);
  3627. let incidentMsg:any = {};
  3628. console.log('data:', data)
  3629. // incidentModel.department && (this.applicationDeptList = [cloneDeep(incidentModel.department)]);
  3630. incidentModel.department && (incidentMsg.deptManyPhone = incidentModel.department.manyPhone);
  3631. incidentModel.department && (incidentMsg.deptName = incidentModel.department.dept);
  3632. incidentModel.department && (incidentModel.department = incidentModel.department.id);
  3633. incidentModel.requester && (this.applicationRequesterList = [cloneDeep(incidentModel.requester)]);
  3634. incidentModel.requester && (incidentMsg.requesterPhone = incidentModel.requester.phone);
  3635. incidentModel.requester && (incidentMsg.requesterName = incidentModel.requester.name);
  3636. incidentModel.requester && (incidentModel.requester = incidentModel.requester.id);
  3637. if(incidentModel.repairIncidentType){
  3638. incidentModel.repairIncidentType = incidentModel.repairIncidentType.value
  3639. this.changeRepairIncidentType(incidentModel.repairIncidentType);
  3640. }
  3641. incidentModel.source && (incidentModel.source = incidentModel.source.id);
  3642. incidentModel.area && (incidentModel.area = incidentModel.area.id);
  3643. incidentModel.place && (incidentModel.place = incidentModel.place.id);
  3644. incidentModel.category && (this.applicationCategoryList = [cloneDeep(incidentModel.category)]);
  3645. incidentModel.category && (incidentModel.category = incidentModel.category.id);
  3646. this.incidentModel = incidentModel;
  3647. this.incidentMsg = incidentMsg;
  3648. console.log('this.applicationDeptList:', this.applicationDeptList)
  3649. console.log('incidentModel:', incidentModel)
  3650. this.showNewOrder('', '', true, '继续建单');
  3651. // 查询报修图片
  3652. this.getRepairImgs(data.id);
  3653. }
  3654. // 获取报修图片
  3655. repairImgs:any[] = [];//报修图片
  3656. getRepairImgs(incidentId) {
  3657. this.mainService
  3658. .getPreviewImage('wechatRequesterIncident', incidentId)
  3659. .subscribe((res:any) => {
  3660. res.data = res.data || [];
  3661. res.data.forEach(v => {
  3662. v.previewUrl = location.origin + "/file" + v.relativeFilePath;
  3663. v.thumbFilePath = location.origin + "/file" + v.thumbFilePath;
  3664. })
  3665. this.repairImgs = res.data;
  3666. });
  3667. }
  3668. // 预览图片
  3669. imgs = [];
  3670. isPreview = false;
  3671. initialViewIndex:number = 0;
  3672. previewImageHandler(data = [], index = 0) {
  3673. this.initialViewIndex = index;
  3674. console.log(index)
  3675. this.isPreview = false;
  3676. data = data || [];
  3677. this.imgs = data.map((v) => location.origin + '/file' + v.relativeFilePath);
  3678. setTimeout(() => {
  3679. this.isPreview = true;
  3680. }, 0)
  3681. }
  3682. // 不受理-弹窗
  3683. rejectModalShow = false; //弹窗开关
  3684. rejectFn(data) {
  3685. this.coopData = data;
  3686. this.rejectModalShow = true;
  3687. }
  3688. // 关闭弹窗
  3689. closeRejectModelOrder(e) {
  3690. this.rejectModalShow = JSON.parse(e).show;
  3691. }
  3692. // 弹窗确定
  3693. confirmRejectModelOrder(rejectRemark){
  3694. this.maskFlag = this.msg.loading("正在加载中..", {
  3695. nzDuration: 0,
  3696. }).messageId;
  3697. let postData = {
  3698. incident: {
  3699. ...this.coopData,
  3700. rejectRemark,
  3701. },
  3702. }
  3703. console.log(postData);
  3704. // return;
  3705. this.mainService
  3706. .flowPost("incident/task/reject", postData)
  3707. .subscribe((result) => {
  3708. this.msg.remove(this.maskFlag);
  3709. this.maskFlag = false;
  3710. if (result.state == 200) {
  3711. this.rejectModalShow = false;
  3712. this.showPromptModal("不受理", true, "", "");
  3713. } else {
  3714. this.msg.error(result.msg || '不受理失败');
  3715. }
  3716. });
  3717. }
  3718. /* 新增报修 end */
  3719. addOrder(){
  3720. this.currentDept = this.tool.getCurrentUserDept();
  3721. //防抖
  3722. this.changeInpSubject.pipe(debounceTime(500)).subscribe((v) => {
  3723. this.searchApplicationDepartment(v[0], v[1]);
  3724. });
  3725. this.changeCommonInpSubject.pipe(debounceTime(500)).subscribe((v) => {
  3726. if(v[0] === 'requester'){
  3727. this.searchApplicationRequester(v[1]);
  3728. }else if(v[0] === 'category'){
  3729. this.searchApplicationCategory(v[1]);
  3730. }else if(v[0] === 'group'){
  3731. this.searchApplicationGroup(v[1]);
  3732. }else if(v[0] === 'user'){
  3733. this.searchApplicationUser(v[1]);
  3734. }else if(v[0] === 'patient'){
  3735. this.getPatientByResidenceNo(v[1]);
  3736. }
  3737. });
  3738. this.changeAssetInpSubject.pipe(debounceTime(500)).subscribe((v) => {
  3739. this.getAssetData(v);
  3740. });
  3741. this.onSearchTaskBuildSubject.pipe(debounceTime(500)).subscribe((v) => {
  3742. this.getTasktypeByPhone(v);
  3743. });
  3744. this.searchHosDepartmentSubject.pipe(debounceTime(500)).subscribe((v) => {
  3745. this.getHosDepartment(v[0], v[1], v[2]);
  3746. });
  3747. this.searchHosDepartmentQtSubject.pipe(debounceTime(500)).subscribe((v) => {
  3748. this.getHosDepartmentQt(v[0], v[1], v[2]);
  3749. });
  3750. this.searchPatientListSubject.pipe(debounceTime(500)).subscribe((v) => {
  3751. this.getPatientList(v[0], v[1]);
  3752. });
  3753. this.initLogin();
  3754. this.getSysConfig();
  3755. this.initOrderScope();
  3756. this.initControlView();
  3757. this.moveMenu("fixedMenu");
  3758. this.moveMenu("fixedMenuLeft");
  3759. this.moveMenuAll("fixedMenuAll");
  3760. }
  3761. // 获取系统配置
  3762. initConfig:any;
  3763. config:any;
  3764. hospitalModel:any; //院区模式 1:单院区 -1:多院区
  3765. applicantMustFillIn:any; //申请人是否必填 1是,0否
  3766. deptRepair:boolean = false; //科内报修
  3767. publicRepair:boolean = false; ; //公共报修
  3768. cmdbRepair:boolean = false; ; //是否支持资产报修
  3769. getSysConfig() {
  3770. const postData = { idx: 0, sum: 99 };
  3771. this.mainService
  3772. .getFetchDataList("simple/data", "systemConfiguration", postData)
  3773. .subscribe((result) => {
  3774. if (result.status == 200) {
  3775. if (result.list && Array.isArray(result.list)) {
  3776. this.initConfig = JSON.parse(JSON.stringify(result.list));
  3777. this.config = result.list.map((item) => {
  3778. return [item.keyconfig, item.valueconfig, item.id, item.label];
  3779. });
  3780. this.config.forEach((c) => {
  3781. switch (c[0]) {
  3782. case "deptRepair":
  3783. if(c[1]=='1'){
  3784. this.deptRepair = true
  3785. }else{
  3786. this.deptRepair = false
  3787. }
  3788. break;
  3789. case "publicRepair":
  3790. if(c[1]=='1'){
  3791. this.publicRepair = true
  3792. }else{
  3793. this.publicRepair = false
  3794. }
  3795. break;
  3796. case "hospitalModel":
  3797. this.hospitalModel = c[1]
  3798. break;
  3799. case "applicantMustFillIn":
  3800. this.applicantMustFillIn = c[1]
  3801. break;
  3802. case "cmdbRepair":
  3803. if(c[1]=='1'){
  3804. this.cmdbRepair = true
  3805. }else{
  3806. this.cmdbRepair = false
  3807. }
  3808. break;
  3809. }
  3810. });
  3811. if(this.eventData){
  3812. this.incidentModel.repairIncidentType = 'public'
  3813. }else{
  3814. if(this.publicRepair && !this.deptRepair){
  3815. this.incidentModel.repairIncidentType = 'public'
  3816. this.isRelatedDepartment = false
  3817. }
  3818. if(!this.publicRepair && this.deptRepair){
  3819. this.incidentModel.repairIncidentType = 'dept'
  3820. }
  3821. }
  3822. if(this.hospitalModel==1){
  3823. if(this.tool.getCurrentHospital().parent){
  3824. this.incidentModel.hosId = this.tool.getCurrentHospital().parent.id
  3825. }else{
  3826. this.incidentModel.hosId = this.tool.getCurrentHospital().id
  3827. }
  3828. this.searchApplicationBuilding()
  3829. }
  3830. if(this.cmdbRepair && this.hospitalModel==1){
  3831. this.getAssetData()
  3832. }
  3833. }
  3834. }
  3835. });
  3836. }
  3837. changeAsset(e){
  3838. this.changeAssetInpSubject.next(e);
  3839. }
  3840. // 获取资产列表
  3841. assetData:any = [];
  3842. getAssetData(name?){
  3843. // if(!this.incidentModel.hosId){
  3844. // return
  3845. // }
  3846. let data = {
  3847. idx: 0,
  3848. sum: 20,
  3849. asset: {
  3850. downHosId: this.hospitalModel!=1 ? this.incidentModel.hosId : this.currentHospital.id,
  3851. name: name
  3852. },
  3853. };
  3854. this.mainService
  3855. .getFetchDataList("simple/data", "asset", data)
  3856. .subscribe((data) => {
  3857. if (data.status == 200) {
  3858. this.assetData = data.list;
  3859. }
  3860. });
  3861. }
  3862. // 新增报修
  3863. speedinessAdd(): void {
  3864. this.addOrder();
  3865. if(this.currentTabIndex === '故障报修'){
  3866. this.incidentModel.department = null;
  3867. this.rightTitle_tab = [
  3868. { id: 2, name: '近期维修' },
  3869. { id: 3, name: '知识库' },
  3870. ]
  3871. this.rightTitleHandler(this.rightTitle_tab[0].id);
  3872. }
  3873. }
  3874. // 调度台
  3875. toFuwutai(): void {
  3876. this.router.navigateByUrl("dispatchingDesk");
  3877. }
  3878. // 护士建单
  3879. toHuShi(): void {
  3880. this.router.navigateByUrl("nurse");
  3881. }
  3882. // 药房端
  3883. toPharmacy(): void {
  3884. this.router.navigateByUrl("pharmacy");
  3885. }
  3886. // 药房端2
  3887. toPharmacy2(): void {
  3888. this.router.navigateByUrl("pharmacy2");
  3889. }
  3890. // 标本视图
  3891. toSpecimenView2(): void {
  3892. this.router.navigateByUrl("specimenView2");
  3893. }
  3894. // 标本间
  3895. toSpecimenRoomView(): void {
  3896. this.router.navigateByUrl("specimenRoomView");
  3897. }
  3898. // 病理科
  3899. toPathology(): void {
  3900. this.router.navigateByUrl("pathology");
  3901. }
  3902. // 门诊病理采样端
  3903. toSampling(): void {
  3904. this.router.navigateByUrl("pathologySample");
  3905. }
  3906. // 病理交接本
  3907. toCommunicationBook(): void {
  3908. this.router.navigateByUrl("pathologyCommunicationBook");
  3909. }
  3910. // 全局业务查看
  3911. toDisinfectionSupply(): void {
  3912. this.router.navigateByUrl("disinfectionSupply");
  3913. }
  3914. // 故障实时播报
  3915. toRealtimeBroadcast(): void {
  3916. this.router.navigateByUrl("realtimeBroadcast");
  3917. }
  3918. // 陪检闭环视图
  3919. toInspectClosedLoopView(): void {
  3920. this.router.navigateByUrl("inspectClosedLoopView");
  3921. }
  3922. // 配置中心
  3923. toConfigurationCenter(): void {
  3924. this.iShowMenuModal = true;
  3925. // this.router.navigateByUrl("configurationCenter");
  3926. }
  3927. // web报修-个人报修
  3928. toWebRepairs(): void {
  3929. this.router.navigateByUrl("webRepairs");
  3930. }
  3931. // 统计
  3932. toNewStatistics(): void {
  3933. let menus = JSON.parse(localStorage.getItem("menu"));
  3934. let firstMenu = menus.find((item) => item.type == "newStatistics");
  3935. this.router.navigateByUrl(`newStatistics/${firstMenu.link}/${firstMenu.childrens[0].link}`);
  3936. }
  3937. // 大屏端或视图端
  3938. screenType;
  3939. hosFlag = false;
  3940. toBigScreen(type): void {
  3941. this.screenType = type;
  3942. this.submitFormHand(this.currentHospital.id);
  3943. }
  3944. submitFormHand(id) {
  3945. if (this.screenType === "largeScreen") {
  3946. window.open(`${http.bigScreenHost}/#/${this.queryType}?hosId=${this.hospital ? this.hospital.id : ''}&dutyId=${this.duty ? this.duty.id : ''}`);
  3947. } else if (this.screenType === "largeScreen2") {
  3948. window.open(http.bigScreenHost2 + "/#/" + id);
  3949. } else if (this.screenType === "largeScreen3") {
  3950. window.open(`${http.bigScreenHost3}/#/${this.queryType}?hosId=${this.hospital ? this.hospital.id : ''}&dutyId=${this.duty ? this.duty.id : ''}`);
  3951. } else if (this.screenType === "specimenView") {
  3952. window.open(http.specimenViewHost + "/#/" + id);
  3953. }
  3954. }
  3955. //获取系统设置中的科室类型
  3956. getTypeByDept(id) {
  3957. let postData = {
  3958. idx: 0,
  3959. sum: 1,
  3960. systemConfiguration: { keyconfig: "busiViewDeptId" },
  3961. };
  3962. this.maskFlag = this.msg.loading("正在加载中..", {
  3963. nzDuration: 0,
  3964. }).messageId;
  3965. this.mainService
  3966. .getFetchDataList("simple/data", "systemConfiguration", postData)
  3967. .subscribe((result) => {
  3968. this.msg.remove(this.maskFlag);
  3969. this.maskFlag = false;
  3970. if (result.status == 200) {
  3971. let remember = JSON.parse(localStorage.getItem("remember"));
  3972. window.open(
  3973. http.specimenViewHost +
  3974. "/#/" +
  3975. id +
  3976. "/" +
  3977. encodeURIComponent(remember.username) +
  3978. "/" +
  3979. encodeURIComponent(remember.password) +
  3980. "/" +
  3981. result.list[0].valueconfig
  3982. );
  3983. }
  3984. });
  3985. }
  3986. hosFlagHand(flag) {
  3987. if (!flag) {
  3988. this.hosFlag = false;
  3989. }
  3990. }
  3991. // 选择菜单-知道了
  3992. iShowMenuModal:boolean = false;
  3993. cancelMenuModal(flag) {
  3994. this.iShowMenuModal = false;
  3995. }
  3996. // 下拉
  3997. showDropdown:boolean = false;
  3998. showDropdown1:boolean = false;
  3999. showFastDropdown:boolean = false;
  4000. // 选择院区
  4001. selectHospital(){
  4002. this.hosFlag1 = true
  4003. }
  4004. // 退出
  4005. logOut(): void {
  4006. // 假退出
  4007. let hospital = this.tool.getCurrentHospital();
  4008. if(hospital){
  4009. this.router.navigate(["login", hospital.id]);
  4010. }else{
  4011. this.router.navigateByUrl("login");
  4012. }
  4013. localStorage.removeItem("user");
  4014. localStorage.removeItem("menu");
  4015. localStorage.removeItem("index");
  4016. // 假退出
  4017. this.mainService.logOut().subscribe((data) => {
  4018. if (data.status == 200) {
  4019. if(hospital){
  4020. this.router.navigate(["login", hospital.id]);
  4021. }else{
  4022. this.router.navigateByUrl("login");
  4023. }
  4024. localStorage.removeItem("user");
  4025. localStorage.removeItem("menu");
  4026. localStorage.removeItem("index");
  4027. }
  4028. });
  4029. }
  4030. // 连接websocket
  4031. getWebsocket() {
  4032. this.webs
  4033. .connectWs(http.mainWs, { userCount: this.userInfo.user.account })
  4034. .subscribe((data) => {
  4035. console.log(data);
  4036. if (data && data.content) {
  4037. this.createBasicNotification(data);
  4038. }
  4039. });
  4040. }
  4041. @ViewChild("msgTemplate1", { static: false }) msgTemplate1: TemplateRef<any>; //消息通知模板
  4042. // 消息提醒
  4043. createBasicNotification(msgs): void {
  4044. this.notification.template(this.msgTemplate1, {
  4045. nzDuration: 0,
  4046. nzData: msgs,
  4047. });
  4048. }
  4049. //打开修改密码弹窗
  4050. pwdAfterOpen(){
  4051. this.passwordVisible = false;
  4052. this.pwdIsOkLoading = false;
  4053. this.enoughRegFlag = true; //弱
  4054. this.mediumRegFlag = false; //中
  4055. this.strongRegFlag = false; //强
  4056. this.upModalData = {
  4057. userid: "",
  4058. pwdOld: "",
  4059. newPwd: "",
  4060. newPwd2: "",
  4061. };
  4062. }
  4063. // 修改密码
  4064. passwordVisible = false;
  4065. password?: string;
  4066. isPwdVisible = false;
  4067. pwdIsOkLoading = false;
  4068. upModalData = {
  4069. userid: "",
  4070. pwdOld: "",
  4071. newPwd: "",
  4072. newPwd2: "",
  4073. };
  4074. upPwd(): void {
  4075. if(this.upModalData.pwdOld.trim() === ''){
  4076. this.msg.error('请填写原始密码!', {
  4077. nzDuration: 5000,
  4078. });
  4079. return;
  4080. }
  4081. if(!this.strongRegFlag){
  4082. this.msg.error('新密码不符合要求!', {
  4083. nzDuration: 5000,
  4084. });
  4085. return;
  4086. }
  4087. if(this.upModalData.newPwd !== this.upModalData.newPwd2){
  4088. this.msg.error('新密码与确认新密码不一致!', {
  4089. nzDuration: 5000,
  4090. });
  4091. return;
  4092. }
  4093. this.pwdIsOkLoading = true;
  4094. let userid = JSON.parse(localStorage.getItem("user")).user.id;
  4095. this.upModalData.userid = userid;
  4096. this.mainService.upPwd(this.upModalData).subscribe((data) => {
  4097. if (data.status == 200) {
  4098. this.isPwdVisible = false;
  4099. this.pwdIsOkLoading = false;
  4100. this.msg.success("修改成功!", {
  4101. nzDuration: 5000,
  4102. });
  4103. } else {
  4104. this.pwdIsOkLoading = false;
  4105. this.msg.error(data.error, {
  4106. nzDuration: 5000,
  4107. });
  4108. }
  4109. });
  4110. }
  4111. showUpPwd(): void {
  4112. this.isPwdVisible = true;
  4113. }
  4114. pwdHandleOk(): void {
  4115. this.upPwd();
  4116. }
  4117. pwdHandleCancel(): void {
  4118. this.isPwdVisible = false;
  4119. }
  4120. delModal = false;
  4121. tipsMsg1 = "是否确定离开该界面,如果未点击生效,数据可能会遗失?";
  4122. navInfo = {};
  4123. // 隐藏模态框
  4124. hideDelModal() {
  4125. this.delModal = false;
  4126. }
  4127. // 模态框确认
  4128. confirmDel() {
  4129. this.delModal = false;
  4130. if (this.navInfo["title"] == "首页") {
  4131. this.router.navigateByUrl("/main/home");
  4132. this.toMenu("首页");
  4133. } else {
  4134. this.router.navigateByUrl("/main/" + this.navInfo["item"].link);
  4135. this.toMenu(
  4136. this.navInfo["title"],
  4137. this.navInfo["item"],
  4138. this.navInfo["data"]
  4139. );
  4140. }
  4141. }
  4142. //前往菜单连接(拦截版)
  4143. totoMenu(title, item?, data?) {
  4144. let url = location.href.split("#")[1];
  4145. if (url.includes("/main/quickCombination")) {
  4146. //拦截
  4147. this.delModal = true;
  4148. this.navInfo = {
  4149. title,
  4150. item,
  4151. data,
  4152. };
  4153. } else {
  4154. //正常情况
  4155. if (title == "首页") {
  4156. this.router.navigateByUrl("/main/home");
  4157. this.toMenu("首页");
  4158. } else {
  4159. this.router.navigateByUrl("/main/" + item.link);
  4160. this.toMenu(title, item, data);
  4161. }
  4162. }
  4163. }
  4164. // 切换院区
  4165. hosFlag1 = false;
  4166. submitFormHand1(id) {
  4167. if(this.currentHospital.id == id){
  4168. return;
  4169. }
  4170. this.maskFlag = this.msg.loading("正在加载中..", {
  4171. nzDuration: 0,
  4172. }).messageId;
  4173. this.mainService
  4174. .changeHospital({ currentHosId: +id, loginType: "PC" })
  4175. .subscribe((result) => {
  4176. this.msg.remove(this.maskFlag);
  4177. this.maskFlag = false;
  4178. if (result.status == 200) {
  4179. localStorage.setItem("user", JSON.stringify(result.user));
  4180. location.reload(true);
  4181. } else {
  4182. this.msg.create("error", "切换院区失败");
  4183. }
  4184. });
  4185. }
  4186. hosFlagHand1(flag) {
  4187. if (!flag) {
  4188. this.hosFlag1 = false;
  4189. }
  4190. }
  4191. // 查询范围
  4192. queryRangeFlag = false;
  4193. queryRangeClick(type){
  4194. this.screenType = type;
  4195. this.queryRangeFlag = true;
  4196. }
  4197. submitQueryRange({queryType, hospital, duty, parent}) {
  4198. console.log('queryType:', queryType)
  4199. console.log('hospital:', hospital)
  4200. console.log('duty:', duty)
  4201. console.log('parent:', parent)
  4202. this.queryType = queryType;
  4203. this.hospital = hospital;
  4204. this.duty = duty;
  4205. this.parent = parent;
  4206. this.queryRangeFlag = false;
  4207. this.toBigScreen(this.screenType);
  4208. }
  4209. cancelQueryRange() {
  4210. this.queryRangeFlag = false;
  4211. }
  4212. // 全院查询-1|院区查询-2|责任部门查询-3|部门垂直查询-4
  4213. hospital;
  4214. duty;
  4215. queryType;//查询范围
  4216. parent:any = 0;
  4217. // 初始化院区、部门显示
  4218. initHospitalAndDuty(hospitalOrDuty){
  4219. let type = 'hospital';//默认是院区
  4220. if(hospitalOrDuty.type){
  4221. // 当前是责任部门
  4222. type = 'duty';
  4223. }
  4224. if(type === 'duty'){
  4225. // 当前的所属责任部门
  4226. this.hospital = hospitalOrDuty.parent;
  4227. this.duty = hospitalOrDuty;
  4228. }else{
  4229. // 当前的所属院区
  4230. this.hospital = hospitalOrDuty;
  4231. this.duty = undefined;
  4232. }
  4233. // 查询范围单选框
  4234. if(this.hospital){
  4235. if(this.duty){
  4236. if(this.duty.parentDeptId){
  4237. this.queryType = 3;
  4238. }else{
  4239. this.queryType = 4;
  4240. }
  4241. }else{
  4242. this.queryType = 2;
  4243. }
  4244. }else{
  4245. this.queryType = 1;
  4246. }
  4247. console.log('this.hospital:', this.hospital)
  4248. console.log('this.duty:', this.duty)
  4249. console.log('this.queryType:', this.queryType)
  4250. console.log('this.parent:', this.parent)
  4251. }
  4252. }