fuwutai.component.ts 151 KB

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