fuwutai.component.ts 158 KB

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