fuwutai.component.ts 135 KB

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