hushijiandan.component.ts 137 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239
  1. import {
  2. Component,
  3. ElementRef,
  4. OnInit,
  5. TemplateRef,
  6. ViewChild,
  7. } from "@angular/core";
  8. import {
  9. FormBuilder,
  10. Validators,
  11. FormGroup,
  12. FormControl,
  13. } from "@angular/forms";
  14. import { Router, ActivatedRoute } from "@angular/router";
  15. import http from "../../../assets/js/http";
  16. import { MainService } from "../../services/main.service";
  17. import { WebsocketNurseService } from "../../services/websocket-nurse.service";
  18. import { NzMessageService } from "ng-zorro-antd";
  19. import { NzNotificationService } from "ng-zorro-antd/notification";
  20. import { OverlayScrollbarsComponent } from "overlayscrollbars-ngx";
  21. import { ToolService } from "../../services/tool.service";
  22. import { Subject } from "rxjs";
  23. import { debounceTime } from "rxjs/operators";
  24. import {
  25. format,
  26. getMinutes,
  27. setMinutes,
  28. addDays,
  29. differenceInCalendarDays,
  30. getHours,
  31. startOfDay,
  32. endOfDay,
  33. parse,
  34. } from "date-fns";
  35. import { SourceId } from "src/app/type/types";
  36. import cloneDeep from 'lodash-es/cloneDeep'
  37. // 日期禁用
  38. function range(start: number, end: number): number[] {
  39. const result: number[] = [];
  40. for (let i = start; i < end; i++) {
  41. result.push(i);
  42. }
  43. return result;
  44. }
  45. @Component({
  46. selector: "app-hushijiandan",
  47. templateUrl: "./hushijiandan.component.html",
  48. styleUrls: ["./hushijiandan.component.less"],
  49. })
  50. export class HushijiandanComponent implements OnInit {
  51. @ViewChild("remarksEle", { static: false }) remarksEle: ElementRef;
  52. @ViewChild("remarksEle1", { static: false }) remarksEle1: ElementRef;
  53. @ViewChild("remarksEle2", { static: false }) remarksEle2: ElementRef;
  54. @ViewChild("osComponentRef1", {
  55. read: OverlayScrollbarsComponent,
  56. static: false,
  57. })
  58. osComponentRef1: OverlayScrollbarsComponent;
  59. @ViewChild("osComponentRef2", {
  60. read: OverlayScrollbarsComponent,
  61. static: false,
  62. })
  63. osComponentRef2: OverlayScrollbarsComponent;
  64. @ViewChild("osComponentRef3", {
  65. read: OverlayScrollbarsComponent,
  66. static: false,
  67. })
  68. osComponentRef3: OverlayScrollbarsComponent;
  69. @ViewChild("osComponentRef4", {
  70. read: OverlayScrollbarsComponent,
  71. static: false,
  72. })
  73. osComponentRef4: OverlayScrollbarsComponent;
  74. @ViewChild("osComponentRef6", {
  75. read: OverlayScrollbarsComponent,
  76. static: false,
  77. })
  78. osComponentRef6: OverlayScrollbarsComponent;
  79. @ViewChild("osComponentRef7", {
  80. read: OverlayScrollbarsComponent,
  81. static: false,
  82. })
  83. osComponentRef7: OverlayScrollbarsComponent;
  84. @ViewChild("osComponentRef8", {
  85. read: OverlayScrollbarsComponent,
  86. static: false,
  87. })
  88. osComponentRef8: OverlayScrollbarsComponent;
  89. @ViewChild("osComponentRef9", {
  90. read: OverlayScrollbarsComponent,
  91. static: false,
  92. })
  93. osComponentRef9: OverlayScrollbarsComponent;
  94. @ViewChild("osComponentRef10", {
  95. read: OverlayScrollbarsComponent,
  96. static: false,
  97. })
  98. osComponentRef10: OverlayScrollbarsComponent;
  99. @ViewChild("osComponentRef11", {
  100. read: OverlayScrollbarsComponent,
  101. static: false,
  102. })
  103. osComponentRef11: OverlayScrollbarsComponent;
  104. othersListOptions: any;
  105. sortableTimer = null;
  106. searchAccountSubject = new Subject(); //查工号防抖
  107. searchTabInpSubject = new Subject(); //左侧查患者信息和检查信息防抖
  108. otherSearchChangeSubject = new Subject(); //其他建单搜索防抖
  109. incidentSearchChangeSubject = new Subject(); //故障现象搜索防抖
  110. isYyInspect = false; //需要预约检查
  111. inspectAndPatientTransportConfig:any = {timeMod: 30};
  112. constructor(
  113. private message: NzMessageService,
  114. private fb: FormBuilder,
  115. public router: Router,
  116. private route: ActivatedRoute,
  117. private mainService: MainService,
  118. private notification: NzNotificationService,
  119. private webs: WebsocketNurseService,
  120. public tool: ToolService
  121. ) {
  122. this.othersListOptions = {
  123. onUpdate: (event: any) => {
  124. // 触发一次排序
  125. clearTimeout(this.sortableTimer);
  126. this.sortableTimer = setTimeout(() => {
  127. let postData = {
  128. orders: [],
  129. tabId: this.checkedTableType == 'other' ? undefined : this.checkedTableType,
  130. };
  131. postData.orders = this.othersList[this.checkedTableType].map((item, i) => {
  132. return {
  133. id: item.id,
  134. orders: i,
  135. };
  136. });
  137. this.mainService
  138. .coopConfig("setOrders", postData)
  139. .subscribe((result) => {});
  140. }, 500);
  141. },
  142. };
  143. }
  144. // 关闭倒计时
  145. closeTime = 3;
  146. closeTimeFlag;
  147. timerCloseTime = null;
  148. changeShow = true;
  149. currentHospital; //当前院区
  150. currentDept; //当前科室
  151. logTimer = null; //综合日志定时器
  152. logTime = 0; //综合日志自动刷新秒数
  153. logTimeConst = 60; //综合日志自动刷新秒数
  154. orderListTimer = null; //工单列表定时器
  155. orderListTime = 0; //工单列表自动刷新秒数
  156. orderListTimeConst = 60; //工单列表自动刷新秒数
  157. deptDisplay; //护士端是否显示可以别名,1是显示科室名称,2是显示科室别名
  158. // 初始化权限按钮
  159. coopBtns: any = {};
  160. ngOnInit() {
  161. this.getCoopBtns();
  162. this.currentHospital = this.tool.getCurrentHospital();
  163. this.tool.getDeptDisplay().subscribe((result) => {
  164. if (result.status == 200) {
  165. this.deptDisplay = result.list[0].valueconfig;
  166. }
  167. });
  168. this.getItsmIncident();
  169. this.getInspectAndPatientTransportConfigTasktype();
  170. this.getUpdateTipsForNurses();
  171. this.getCloseTimeFlag();
  172. this.currentDept = this.tool.getCurrentUserDept();
  173. console.log(this.currentDept, this.tabSearchCont);
  174. this.currentDept.typeValue == 'surgery' && !this.tabSearchCont && this.getSurgeryConfig();
  175. this.getSpecimenButton();
  176. //防抖
  177. this.getAccountList();
  178. this.searchAccountSubject.pipe(debounceTime(500)).subscribe((v:any) => {
  179. this.getAccountList(v);
  180. });
  181. this.searchTabInpSubject.pipe(debounceTime(500)).subscribe((v) => {
  182. this.getPatient(v);
  183. });
  184. this.otherSearchChangeSubject.pipe(debounceTime(500)).subscribe((v) => {
  185. this.getDeptTaskType(v);
  186. });
  187. this.incidentSearchChangeSubject
  188. .pipe(debounceTime(500))
  189. .subscribe((v: string) => {
  190. this.getIncidentcategory(v);
  191. });
  192. this.getTodayNum();
  193. this.initLogin();
  194. this.getDeptTaskType();
  195. this.initForm();
  196. this.getAdvice();
  197. this.getOrderSelectList();
  198. this.getCheckStatusLis();
  199. this.refreshSpecimenWorkOrderMsg();
  200. this.initRole();
  201. this.getWebsocket();
  202. // 综合日志倒计时 start
  203. this.logTime = this.logTimeConst;
  204. clearInterval(this.logTimer);
  205. this.logTimer = setInterval(() => {
  206. this.logTime--;
  207. if (this.logTime === 0) {
  208. this.logTime = this.logTimeConst;
  209. if (this.smallTabId == 1) {
  210. this.listDeptOrderRecord();
  211. } else if (this.smallTabId == 2) {
  212. this.getQuickBxlb();
  213. }
  214. this.getTodayNum(); //当日工单数量
  215. }
  216. }, 1000);
  217. // 综合日志倒计时 end
  218. // 工单列表倒计时 start
  219. this.orderListTime = this.orderListTimeConst;
  220. clearInterval(this.orderListTimer);
  221. this.orderListTimer = setInterval(() => {
  222. this.orderListTime--;
  223. if (this.orderListTime === 0) {
  224. this.orderListTime = this.orderListTimeConst;
  225. this.getOrderList();
  226. }
  227. }, 1000);
  228. // 工单列表倒计时 end
  229. }
  230. ngOnDestroy() {
  231. clearInterval(this.moveId);
  232. clearInterval(this.moveId1);
  233. clearInterval(this.msgTimerId);
  234. clearInterval(this.logTimer);
  235. clearInterval(this.orderListTimer);
  236. this.webs.closeWs(true);
  237. }
  238. loginUser: any = localStorage.getItem("user")
  239. ? JSON.parse(localStorage.getItem("user")).user
  240. : null; //登录人信息
  241. loginUserDeptId: number = JSON.parse(localStorage.getItem("user")).user.dept
  242. .id; //登录人所属科室
  243. appointmentBuildFlag = "0"; //是否开启护士端预约建单-患者陪检
  244. appointmentZyBuildFlag = "0"; //是否开启护士端预约建单-患者其他
  245. leadTime = 0; //护士端预约建单生效时长
  246. followFlag = "0"; //是否开启护士端终点关注
  247. promptContent: string; //操作提示框提示信息
  248. ifSuccess: boolean; //操作成功/失败
  249. promptInfo: string; //操作结果提示信息
  250. back: string; //操作结果后回调标识
  251. promptModalShow: boolean; //操作提示框是否展示
  252. hsPromptModalShow: boolean = false; //护士端科室切换提示框是否展示
  253. deptTaskTypeRules: any = {}; //当前登录科室任务类型信息规则
  254. orderSelectList: any = []; //工单列表筛选选项
  255. orderSelected = "-1"; //工单列表下拉框选中
  256. orderStateSelected = "1"; //工单列表工单状态下拉框选中
  257. tabSearchCont: string = ""; //左侧tab搜索框内容
  258. pLoading: boolean = true; //患者信息loading
  259. patientList: any = []; //左侧tab患者信息list
  260. infoPageIdx: number = 1; //左侧tab页码
  261. infoLength: number = 5; //左侧tab信息总数
  262. specimenWorkOrderMsg: any = {}; //急标普标数量&信息
  263. jpDrugsWKOMsg: any = {}; //药品静配提示信息
  264. surgeryWKOMsg: any = {}; //手术提示信息
  265. getCoopBtns(){
  266. let menu: any = JSON.parse(localStorage.getItem("menu")) || []; //菜单
  267. let coopBtns:any = {};
  268. let nurseMenu = menu.find(v => v.link === 'nurse');
  269. let nurseMenuChildren = nurseMenu.childrens || [];
  270. nurseMenuChildren.forEach((e) => {
  271. switch (e.link) {
  272. case "suggestionBox":
  273. coopBtns.suggestionBox = true; //意见箱
  274. break;
  275. case "surgery":
  276. coopBtns.surgery = true; //手术排程信息
  277. break;
  278. case "inquiryOfHistoricalSpecimens":
  279. coopBtns.inquiryOfHistoricalSpecimens = true; //历史标本查询
  280. break;
  281. case "historicalMedicineListInquiry":
  282. coopBtns.historicalMedicineListInquiry = true; //历史药单查询
  283. break;
  284. case "quickReportForRepair":
  285. coopBtns.quickReportForRepair = true; //快捷报修
  286. break;
  287. case "repairList":
  288. coopBtns.repairList = true; //报修列表
  289. break;
  290. case "buildOrdersForOtherTasks":
  291. coopBtns.buildOrdersForOtherTasks = true; //其他任务建单
  292. break;
  293. }
  294. });
  295. this.coopBtns = coopBtns;
  296. console.log(this.coopBtns);
  297. }
  298. // 切换综合日志和一键报修
  299. smallTabs = [];
  300. smallTabId = 2; //默认显示一键报修
  301. changeSmallTab(id) {
  302. this.smallTabId = id;
  303. if (id == 1) {
  304. this.listDeptOrderRecord();
  305. } else if (id == 2) {
  306. this.getQuickBxlb();
  307. }
  308. }
  309. // 获取当日建单总数
  310. todayNum = ""; //当日建单总数
  311. getTodayNum() {
  312. this.mainService
  313. .getFetchDataList("nurse", "workOrder", {
  314. idx: 0,
  315. sum: 1,
  316. workOrder: {
  317. createDept: this.loginUser.dept.id,
  318. startTime1: format(startOfDay(new Date()), "yyyy-MM-dd HH:mm:ss"),
  319. endTime1: format(endOfDay(new Date()), "yyyy-MM-dd HH:mm:ss"),
  320. },
  321. })
  322. .subscribe((data) => {
  323. if (data.status == 200) {
  324. this.todayNum = data.totalNum || 0;
  325. }
  326. });
  327. }
  328. // 获取报修区域(所属院区)
  329. // areas: any = []; //区域(所属院区)列表
  330. // getArea() {
  331. // this.areas = [];
  332. // this.mainService
  333. // .fetchListBx("area", { idx: 0, sum: 1000 })
  334. // .subscribe((result: any) => {
  335. // if (result.status == 200) {
  336. // this.areas = result.list;
  337. // if (this.areas.length) {
  338. // this.bxForm.controls.hospital.setValue(this.areas[0].id);
  339. // } else {
  340. // this.bxForm.controls.hospital.setValue(null);
  341. // }
  342. // }
  343. // });
  344. // }
  345. //根据区域(所属院区)获取地点(楼栋)
  346. places: any = []; //地点(楼栋)列表
  347. getPlace(buildingId) {
  348. this.places = [];
  349. this.mainService
  350. .fetchListBx("place", {
  351. idx: 0,
  352. sum: 1000,
  353. place: { area: { id: buildingId } },
  354. })
  355. .subscribe((result: any) => {
  356. if (result.status == 200) {
  357. this.places = result.list;
  358. if (this.places.length) {
  359. this.bxForm.controls.building.setValue(this.places[0].id);
  360. } else {
  361. this.bxForm.controls.building.setValue(null);
  362. }
  363. }
  364. });
  365. }
  366. btnLoading: boolean = false; //确认按钮loading状态
  367. workOrderRemark = ""; //备注
  368. workOrderRemark1 = ""; //备注
  369. workOrderRemark2 = ""; //备注
  370. workOrderRemarkTips = ""; //备注提示
  371. workOrderRemarkTips1 = ""; //备注提示
  372. workOrderRemarkTips2 = ""; //备注提示
  373. customRemarks = []; //备注快速输入
  374. customRemarks1 = []; //备注快速输入
  375. customRemarks2 = []; //备注快速输入
  376. // 添加备注
  377. addRemarks(item) {
  378. this.remarksEle.nativeElement.focus();
  379. this.workOrderRemark += item;
  380. }
  381. // 添加备注
  382. addRemarks1(item) {
  383. this.remarksEle1.nativeElement.focus();
  384. this.workOrderRemark1 += item;
  385. }
  386. // 添加备注
  387. addRemarks2(item) {
  388. this.remarksEle2.nativeElement.focus();
  389. this.workOrderRemark2 += item;
  390. }
  391. // 立即执行
  392. coopItem: any = {};
  393. execModal: boolean = false;
  394. // 打开立即执行模态框
  395. openExecModal(item) {
  396. this.coopItem = item;
  397. // 是否允许提前执行
  398. if(item.taskType.executeSwitch == 1){
  399. this.execModal = true;
  400. }else{
  401. this.showPromptModal("操作", false, "相关任务会到点执行,无需立即执行。有问题请联系相关科室!");
  402. }
  403. }
  404. // 确认立即执行
  405. confirmExec() {
  406. this.btnLoading = true;
  407. this.mainService.executeNow(this.coopItem.id).subscribe((result: any) => {
  408. this.closeExecModal();
  409. if (result.status == 200) {
  410. this.showPromptModal("立即执行", true, "");
  411. this.getOrderList();
  412. } else {
  413. this.showPromptModal("立即执行", false, result.msg);
  414. }
  415. });
  416. }
  417. // 关闭立即执行模态框
  418. closeExecModal() {
  419. this.execModal = false;
  420. }
  421. // 获取系统配置
  422. isShowBx = false;// 护士端是否显示报修
  423. isAssign = false;// 是否护士指定人员
  424. getItsmIncident() {
  425. let postData = { idx: 0, sum: 100, hospitalConfig: { hosId: this.currentHospital.id } };
  426. this.mainService.getFetchDataList("simple/data", "hospitalConfig", postData).subscribe((result) => {
  427. if (result.status == 200) {
  428. this.isShowBx = result.list.find(v => v.key == 'hos_itsmIncident').value == 1;
  429. this.isAssign = result.list.find(v => v.key == 'nurseSendOrder').value == 1;
  430. if (this.isShowBx && (this.coopBtns.repairList || this.coopBtns.quickReportForRepair)) {
  431. // 初始化默认显示第一个
  432. if(this.tabPermission.length){
  433. this.checkedTableType = (this.tabPermission[0] && this.tabPermission[0].system) ? 'other' : this.tabPermission[0].id;
  434. }else if(this.coopBtns.suggestionBox){
  435. this.checkedTableType = 'advice';
  436. this.checkTable(this.checkedTableType);
  437. }else if(this.coopBtns.surgery){
  438. this.checkedTableType = 'surgery';
  439. this.checkTable(this.checkedTableType);
  440. }else if(this.coopBtns.inquiryOfHistoricalSpecimens){
  441. this.checkedTableType = 'historySpecimen';
  442. this.checkTable(this.checkedTableType);
  443. }else if(this.coopBtns.historicalMedicineListInquiry){
  444. this.checkedTableType = 'historyDrugsbag';
  445. this.checkTable(this.checkedTableType);
  446. }else if(this.coopBtns.quickReportForRepair && this.isShowBx){
  447. this.checkedTableType = 'kjbx';
  448. this.checkTable(this.checkedTableType);
  449. }else if(this.coopBtns.repairList && this.isShowBx){
  450. this.checkedTableType = 'bxlb';
  451. this.checkTable(this.checkedTableType);
  452. }
  453. this.smallTabs = [
  454. { id: 1, name: "综合日志" },
  455. { id: 2, name: "一键报修" },
  456. ];
  457. this.smallTabId = 2;
  458. this.getQuickBxlb();
  459. this.getBxlb();
  460. } else {
  461. this.smallTabs = [{ id: 1, name: "综合日志" }];
  462. this.smallTabId = 1;
  463. this.listDeptOrderRecord();
  464. }
  465. }
  466. });
  467. }
  468. // 派单,flag 0是待抢单指派,1是待到达指派
  469. allotWorker(id, stateId, flag?) {
  470. if (flag == 1) {
  471. this.router.navigateByUrl("nurse/allotWorker/" + id + "/" + stateId + "/1/" + this.currentHospital.id);
  472. } else {
  473. this.router.navigateByUrl("nurse/allotWorker/" + id + "/" + stateId + "/0/" + this.currentHospital.id);
  474. }
  475. }
  476. //获取检查页面任务类型
  477. getInspectAndPatientTransportConfigTasktype() {
  478. let postData = {
  479. idx: 0,
  480. sum: 10,
  481. taskType: {
  482. simpleQuery: true,
  483. hosId: {
  484. id: this.currentHospital.id
  485. },
  486. associationType: {
  487. key:"association_types",
  488. value: 'inspect'
  489. }
  490. }
  491. };
  492. this.mainService
  493. .getFetchDataList("simple/data", "taskType", postData)
  494. .subscribe((result) => {
  495. if (result.status == 200) {
  496. let tasktype:any = result.list[0] || {};
  497. this.getInspectAndPatientTransportConfig(tasktype);
  498. }
  499. });
  500. }
  501. // 获取检查页面信息配置
  502. getInspectAndPatientTransportConfig(tasktype) {
  503. let postData = {
  504. idx: 0,
  505. sum: 10,
  506. taskTypeConfig: {
  507. taskTypeDTO: {
  508. hosId: {
  509. id: this.currentHospital.id
  510. },
  511. associationType: tasktype.associationType
  512. }
  513. }
  514. };
  515. this.mainService
  516. .getFetchDataList("simple/data", "taskTypeConfig", postData)
  517. .subscribe((result) => {
  518. if (result.status == 200) {
  519. let inspectAndPatientTransportConfig = result.list[0] || {};
  520. this.inspectAndPatientTransportConfig = {...this.inspectAndPatientTransportConfig, ...inspectAndPatientTransportConfig};
  521. // 是否显示排队信息
  522. if(this.inspectAndPatientTransportConfig.queuingInformation == 1){
  523. this.getQueuingInformation();
  524. }
  525. }
  526. });
  527. }
  528. // 获取排队信息
  529. queuingInformationList:any[] = [];
  530. getQueuingInformation() {
  531. this.mainService
  532. .coopWorkerOrder("queuingInformation", {})
  533. .subscribe((result) => {
  534. if(result.status == 200){
  535. this.queuingInformationList = result.datalist || [];
  536. }
  537. });
  538. }
  539. // 获取护士端更新提示
  540. updateTipsForNurses = "";
  541. getUpdateTipsForNurses() {
  542. let postData = {
  543. idx: 0,
  544. sum: 1,
  545. systemConfiguration: { keyconfig: "updateTipsForNurses" },
  546. };
  547. this.mainService
  548. .getFetchDataList("simple/data", "systemConfiguration", postData)
  549. .subscribe((result) => {
  550. if (result.status == 200) {
  551. this.updateTipsForNurses = result.list[0].valueconfig;
  552. }
  553. });
  554. }
  555. // 获取标本按钮
  556. specimenButton = "";
  557. getSpecimenButton() {
  558. if(this.currentDept.typeValue == 'surgery' && !this.tabSearchCont){
  559. return;
  560. }
  561. let postData = {
  562. idx: 0,
  563. sum: 1,
  564. systemConfiguration: { keyconfig: "specimenButton" },
  565. };
  566. this.mainService
  567. .getFetchDataList("simple/data", "systemConfiguration", postData)
  568. .subscribe((result) => {
  569. if (result.status == 200) {
  570. this.specimenButton = result.list[0].valueconfig;
  571. }
  572. });
  573. }
  574. // 获取护士端弹窗的配置
  575. // (1) 当用户设置为正数时,用户必须查看此窗体指定秒数。
  576. // (2) 当用户设置为负数时,用户可点击知道了也可倒计时自动关闭。
  577. // (3) 如果用户填写0则为无自动关闭和强制查看时间。
  578. getCloseTimeFlag() {
  579. let postData = {
  580. idx: 0,
  581. sum: 1,
  582. systemConfiguration: { keyconfig: "nurseDeptSwitchTip" },
  583. };
  584. this.mainService
  585. .getFetchDataList("simple/data", "systemConfiguration", postData)
  586. .subscribe((result) => {
  587. if (result.status == 200) {
  588. this.closeTimeFlag = result.list[0].valueconfig - 0;
  589. this.changeKs();
  590. }
  591. });
  592. }
  593. //获取综合日志
  594. rLoading = false;
  595. listDeptOrderRecords: any = [];
  596. listDeptOrderRecord() {
  597. this.rLoading = true;
  598. this.mainService
  599. .listMsgByMain("listDeptOrderRecord", { deptId: this.loginUserDeptId })
  600. .subscribe((result) => {
  601. this.rLoading = false;
  602. if (result["status"] == 200) {
  603. this.listDeptOrderRecords = result["data"].slice(0, 15);
  604. }
  605. });
  606. }
  607. // 查看标本历史记录
  608. historyPromptModalShow = false; //标本历史记录弹窗开关
  609. scode = ""; //查看历史记录携带
  610. viewSpecimenHistory(data) {
  611. this.scode = data.scode;
  612. this.historyPromptModalShow = true;
  613. }
  614. // 关闭标本历史记录弹窗
  615. closeModelHistory(e) {
  616. this.historyPromptModalShow = JSON.parse(e).show;
  617. }
  618. // 查看药单历史记录
  619. historyDPromptModalShow = false; //药单历史记录弹窗开关
  620. drugsBagId = ""; //查看历史记录携带
  621. viewDrugsbagHistory(data) {
  622. this.drugsBagId = data.id;
  623. this.historyDPromptModalShow = true;
  624. }
  625. // 关闭药单历史记录弹窗
  626. closeModelHistoryDrugsbag(e) {
  627. this.historyDPromptModalShow = JSON.parse(e).show;
  628. }
  629. // 查看报修信息
  630. detailBx(data){
  631. this.router.navigateByUrl("nurse/detailBx/" + data.id);
  632. }
  633. // 查看报修信息弹窗
  634. bxPromptModalShow = false; //弹窗开关
  635. bData = ""; //查看详情携带所有数据
  636. viewBx(data) {
  637. this.bData = data;
  638. this.bxPromptModalShow = true;
  639. }
  640. // 关闭报修信息弹窗
  641. closeModelBx(e) {
  642. this.bxPromptModalShow = JSON.parse(e).show;
  643. }
  644. // 护士端患者信息列表,鼠标移入姓名展示最近一条检查信息
  645. recentInfo = "";
  646. recentInfoTimer = null;
  647. recentInfoNum = 0;
  648. isRemand = true; //自动送回
  649. yyTime = null; //预约时间-患者列表
  650. yyTimeZy = null; //预约时间-患者列表-患者其他服务
  651. yyDate = null; //预约日期-陪检
  652. yyDateZy = null; //预约日期-转运
  653. getRecentInfo(patientCode) {
  654. if(this.currentDept.typeValue == 'surgery' && !this.tabSearchCont){
  655. return;
  656. }
  657. this.recentInfo = "";
  658. clearTimeout(this.recentInfoTimer);
  659. this.recentInfoTimer = setTimeout(() => {
  660. this.recentInfoNum++;
  661. this.mainService
  662. .listMsgByMain("workOrder/findInspectRecently", { patientCode })
  663. .subscribe((result) => {
  664. this.recentInfoNum--;
  665. if (result["status"] == 200 && this.recentInfoNum === 0) {
  666. this.recentInfo = result["data"]["info"];
  667. } else {
  668. this.recentInfo = "";
  669. }
  670. });
  671. }, 500);
  672. }
  673. // 获取患者陪检任务类型(只有一个)的信息
  674. getTaskTypeByInspection() {
  675. const list = {
  676. idx: 0,
  677. sum: 1,
  678. taskType: {
  679. patientInspectQuery: true,
  680. hosIds: this.currentHospital.id + "",
  681. associationType: {
  682. id: 260,
  683. },
  684. },
  685. };
  686. return this.mainService.getFetchDataList("configuration", "taskType", list);
  687. }
  688. //修改预约建单时间的日期
  689. yyDateChange(e) {
  690. // 获取年月日
  691. let yyDate = new Date(e);
  692. let year = yyDate.getFullYear();
  693. let month = yyDate.getMonth();
  694. let date = yyDate.getDate();
  695. // 获取当前时间的年月日
  696. let now = new Date();
  697. let nYear = now.getFullYear();
  698. let nMonth = now.getMonth();
  699. let nDate = now.getDate();
  700. if (year != nYear || month != nMonth || date != nDate) {
  701. this.disabledHours = () => [];
  702. this.disabledMinutes = (hour) => [];
  703. } else {
  704. // 禁用小时
  705. this.disabledHours = () => {
  706. let now = new Date();
  707. let nHour = now.getHours();
  708. let nMinute = now.getMinutes();
  709. if (nMinute > (60 - this.inspectAndPatientTransportConfig.timeMod)) {
  710. return range(0, nHour + 1);
  711. } else {
  712. return range(0, nHour);
  713. }
  714. };
  715. // 禁用分钟
  716. this.disabledMinutes = (hour) => {
  717. let now = new Date();
  718. let nHour = now.getHours();
  719. let nMinute = now.getMinutes();
  720. if (hour === nHour || hour === undefined) {
  721. return this.integralDivision(0, nMinute, this.inspectAndPatientTransportConfig.timeMod);
  722. } else {
  723. return [];
  724. }
  725. };
  726. }
  727. }
  728. // 关闭其他建单保存结果
  729. closeModel(e) {
  730. console.log(e);
  731. if (e === "other") {
  732. this.osComponentRef2.osInstance().scroll({ x: 0, y: this.positionY });
  733. this.getOrderList();
  734. } else if (e === "bb") {
  735. this.getOrderList();
  736. this.getSpecimenWorkOrderMsg();
  737. }
  738. }
  739. // 其他建单
  740. selectOtherId; //选中的id
  741. otherSearch = ""; //搜索的关键词
  742. oLoading = false;
  743. nLoading = false;
  744. positionY = 0; //记录其他建单Y轴滚动距离
  745. otherClick(item) {
  746. this.osComponentRef2 && (this.positionY = this.osComponentRef2.osInstance().scroll().position.y); //内容滚动的距离
  747. this.selectOtherId = item.id;
  748. this.newShortcutOrder(item, "other");
  749. this.account = null;
  750. this.userAccount = null;
  751. }
  752. selectIncidentId; //选中的id
  753. incidentClick(item) {
  754. this.positionY = this.osComponentRef10.osInstance().scroll().position.y; //内容滚动的距离
  755. this.selectIncidentId = item.id;
  756. this.bxForm.controls.content.setValue(item.mutiCategory);
  757. }
  758. //搜索
  759. otherNum = 0;
  760. otherSearchChange() {
  761. this.otherSearchChangeSubject.next(this.otherSearch);
  762. }
  763. //搜索
  764. incidentSearch = ""; //搜索的关键词
  765. incidentNum = 0;
  766. incidentSearchChange() {
  767. this.incidentSearchChangeSubject.next(this.incidentSearch);
  768. }
  769. // 切换科室
  770. changeKs() {
  771. this.hsPromptModalShow = true;
  772. // (1) 当用户设置为正数时,用户必须查看此窗体指定秒数。
  773. // (2) 当用户设置为负数时,用户可点击知道了也可倒计时自动关闭。
  774. // (3) 如果用户填写0则为无自动关闭和强制查看时间。
  775. if (this.closeTimeFlag === 0) {
  776. return;
  777. }
  778. this.closeTime = Math.abs(this.closeTimeFlag);
  779. clearInterval(this.timerCloseTime);
  780. this.timerCloseTime = setInterval(() => {
  781. this.closeTime = Math.max(--this.closeTime, 0);
  782. if (this.closeTime === 0) {
  783. if (this.closeTimeFlag <= 0) {
  784. this.hsPromptModalShow = false;
  785. }
  786. clearInterval(this.timerCloseTime);
  787. }
  788. }, 1000);
  789. }
  790. // 判断登录是否已失效
  791. initLogin() {
  792. let that = this;
  793. if (!localStorage.getItem("user")) {
  794. that.message.error("您的登录已失效,请重新登录!", {
  795. nzDuration: 3000,
  796. });
  797. setTimeout(() => {
  798. that.router.navigateByUrl("login");
  799. }, 2000);
  800. return;
  801. }
  802. }
  803. // 连接websocket
  804. getWebsocket() {
  805. let that = this;
  806. this.webs
  807. .connectWs(http.nurseWs, { userCount: that.loginUser.account })
  808. .subscribe((data) => {
  809. if (data && data.content) {
  810. that.createBasicNotification(data);
  811. }
  812. });
  813. }
  814. // 每隔一分钟刷新标本信息
  815. msgTimerId: any;
  816. refreshSpecimenWorkOrderMsg() {
  817. this.msgTimerId = setInterval(() => {
  818. this.getSpecimenWorkOrderMsg();
  819. }, 60000);
  820. }
  821. // 工单列表筛选
  822. getOrderSelectList() {
  823. let that = this;
  824. that.mainService
  825. .getDictionary("list", "association_types")
  826. .subscribe((data) => {
  827. that.orderSelectList = data || [];
  828. });
  829. }
  830. // 急标普标数量
  831. getSpecimenWorkOrderMsg() {
  832. if(this.currentDept.typeValue == 'surgery' && !this.tabSearchCont){
  833. return;
  834. }
  835. let that = this;
  836. that.mainService
  837. .postCustom("nurse", "getSpecimenWorkOrderMsg", {
  838. deptId: JSON.parse(localStorage.getItem("user")).user.dept.id,
  839. })
  840. .subscribe((data) => {
  841. that.specimenWorkOrderMsg = data;
  842. });
  843. }
  844. // 手术提示信息
  845. surgeryLoading = false;
  846. getSurgeryWKOMsg() {
  847. if(this.currentDept.typeValue != 'surgery'){
  848. return;
  849. }
  850. let postData = {
  851. idx: 0,
  852. sum: 1,
  853. surgery: {
  854. applyDateStart: format(startOfDay(new Date()), "yyyy-MM-dd HH:mm:ss"),
  855. applyDateEnd: format(endOfDay(new Date()), "yyyy-MM-dd HH:mm:ss"),
  856. hosId: this.currentHospital.id,
  857. surgeryDept: this.loginUserDeptId,
  858. state: {
  859. key: 'surgery_trans_state',
  860. value: 8
  861. }
  862. }
  863. }
  864. this.surgeryLoading = true;
  865. this.mainService
  866. .getFetchDataList("simple/data", "surgery", postData)
  867. .subscribe((data) => {
  868. data.list = Array.isArray(data.list) ? data.list : [];
  869. this.surgeryLoading = false;
  870. this.surgeryWKOMsg = data.list[0] || {};
  871. });
  872. }
  873. // 获取手术配置信息
  874. surgeryField = null; //手术关联业务
  875. surgeryConfigs:any = {};
  876. // 送回苏醒室的运输过程终点科室信息
  877. surgeryCarryingCourse:any = null;
  878. surgeryCarryingCourseDepts: any[] = [];
  879. getSurgeryConfig() {
  880. this.mainService
  881. .getDictionary("list", "ordinary_field")
  882. .subscribe((data) => {
  883. this.surgeryField = data.find(v => v.value == 'surgery');
  884. if(this.surgeryField){
  885. let postData = {
  886. idx: 0,
  887. sum: 10,
  888. taskTypeConfig: {
  889. hosId: this.currentHospital.id,
  890. ordinaryField: this.surgeryField
  891. }
  892. };
  893. this.mainService
  894. .getFetchDataList("simple/data", "taskTypeConfig", postData)
  895. .subscribe((result) => {
  896. if (result.status == 200) {
  897. this.surgeryConfigs = result.list[0] || {};
  898. // 送回苏醒室开关开启 并且 有对应的任务类型
  899. if(this.surgeryConfigs.remandRecovery == 1 && this.surgeryConfigs.recoveryType){
  900. this.surgeryCarryingCourse = this.surgeryConfigs.recoveryType.carryingCourses ? this.surgeryConfigs.recoveryType.carryingCourses.find(v => v.nodeId ? v.nodeId.value == 'finish' : false) : null;
  901. // 运输过程终点科室配置是固定科室或者固定科室范围-苏醒室
  902. if(this.surgeryCarryingCourse && (this.surgeryCarryingCourse.departmentStrategy.value == 2 || this.surgeryCarryingCourse.departmentStrategy.value == 3)){
  903. this.surgeryCarryingCourseDepts = this.surgeryCarryingCourse.departmentDTOS || [];
  904. }
  905. }
  906. }
  907. });
  908. }
  909. });
  910. }
  911. // 药品静配提示信息
  912. drugJpLoading = false;
  913. getJpDrugsWKOMsg() {
  914. if(this.currentDept.typeValue == 'surgery' && !this.tabSearchCont){
  915. return;
  916. }
  917. let that = this;
  918. this.drugJpLoading = true;
  919. that.mainService
  920. .postCustom("nurse", "getJpDrugsWKOMsg", {})
  921. .subscribe((data) => {
  922. this.drugJpLoading = false;
  923. that.jpDrugsWKOMsg = data.data ? data.data : {};
  924. console.log(that.jpDrugsWKOMsg);
  925. if (
  926. that.jpDrugsWKOMsg.drugsInfoList &&
  927. that.jpDrugsWKOMsg.drugsInfoList.length
  928. ) {
  929. that.startSwiper(that.jpDrugsWKOMsg.drugsInfoList.length);
  930. }
  931. if (
  932. that.jpDrugsWKOMsg.jpInfoList &&
  933. that.jpDrugsWKOMsg.jpInfoList.length
  934. ) {
  935. that.startSwiper1(that.jpDrugsWKOMsg.jpInfoList.length);
  936. }
  937. });
  938. }
  939. // swiper 轮播图
  940. swiperTop: number = 0;
  941. moveId: any;
  942. index: number = 0;
  943. startSwiper(length) {
  944. let that = this;
  945. clearInterval(that.moveId);
  946. setInterval(() => {
  947. that.index++;
  948. clearInterval(that.moveId);
  949. that.moveId = setInterval(() => {
  950. if (that.swiperTop > -44 * that.index) {
  951. that.swiperTop--;
  952. }
  953. if (that.swiperTop <= length * -44) {
  954. that.swiperTop = 0;
  955. that.index = 0;
  956. clearInterval(that.moveId);
  957. }
  958. }, 20);
  959. }, 2000);
  960. }
  961. swiperTop1: number = 0;
  962. moveId1: any;
  963. index1: number = 0;
  964. startSwiper1(length) {
  965. let that = this;
  966. clearInterval(that.moveId1);
  967. setInterval(() => {
  968. that.index1++;
  969. clearInterval(that.moveId1);
  970. that.moveId1 = setInterval(() => {
  971. if (that.swiperTop1 > -44 * that.index1) {
  972. that.swiperTop1--;
  973. }
  974. if (that.swiperTop1 <= length * -44) {
  975. that.swiperTop1 = 0;
  976. that.index1 = 0;
  977. clearInterval(that.moveId1);
  978. }
  979. }, 20);
  980. }, 2000);
  981. }
  982. // 关注患者
  983. follow(data) {
  984. this.showCommonModal(
  985. data,
  986. data.focusPatient === 0
  987. ? "您将设置患者【" +
  988. data.patientName +
  989. "】为重点关注,后期此患者的相关检查将会自动建单通知支助中心"
  990. : "您将取消设置患者【" +
  991. data.patientName +
  992. "】为重点关注,后期此患者的相关检查将不会自动建单通知支助中心"
  993. );
  994. }
  995. // 通用提示模态框
  996. commonModal: boolean = false; //模态框
  997. loading4 = false;
  998. tipsMsg1: string; //提示框信息
  999. coop: any; //当前操作列
  1000. showCommonModal(data: any, tipsMsg1: string) {
  1001. this.commonModal = true;
  1002. this.coop = data;
  1003. this.tipsMsg1 = tipsMsg1;
  1004. }
  1005. // 隐藏模态框
  1006. hideCommonModal() {
  1007. this.commonModal = false;
  1008. }
  1009. // 确认
  1010. confirmCommon() {
  1011. this.commonModal = false;
  1012. let postData = {
  1013. patient: {
  1014. id: this.coop.id,
  1015. focusPatient: this.coop.focusPatient === 0 ? 1 : 0,
  1016. },
  1017. };
  1018. this.loading4 = true;
  1019. this.mainService.listMsgByMain("updData/patient", postData).subscribe(
  1020. (result) => {
  1021. this.loading4 = false;
  1022. if (result["status"] == 200) {
  1023. this.showPromptModal(
  1024. result["data"].focusPatient === 0 ? "取消关注" : "关注",
  1025. true,
  1026. ""
  1027. );
  1028. this.getPatient(this.tabSearchCont);
  1029. } else {
  1030. this.showPromptModal(
  1031. result["data"].focusPatient === 0 ? "取消关注" : "关注",
  1032. false,
  1033. ""
  1034. );
  1035. }
  1036. },
  1037. (err) => {
  1038. this.loading4 = false;
  1039. this.showPromptModal("操作", false, "");
  1040. }
  1041. );
  1042. }
  1043. // 是否确定报修模态框
  1044. bxModal: boolean = false; //模态框
  1045. loading6 = false;
  1046. tipsMsg2: string; //提示框信息
  1047. coopBx: any; //当前操作列
  1048. showBxModal(data: any, tipsMsg2: string) {
  1049. this.bxModal = true;
  1050. this.coopBx = data;
  1051. this.tipsMsg2 = tipsMsg2;
  1052. }
  1053. // 隐藏模态框
  1054. hideBxModal() {
  1055. this.bxModal = false;
  1056. }
  1057. // 确认
  1058. confirmBx() {
  1059. this.loading6 = true;
  1060. this.mainService.wxbx({}).subscribe((result) => {
  1061. if ((result as any).status == 200) {
  1062. let bxcode = (result as any).data; //生成微信报修号
  1063. let postData: any = {
  1064. verification: "true",
  1065. incident: {
  1066. branch:this.loginUser.currentHospital.id,
  1067. deptId:this.loginUser.dept.id,
  1068. // contacts: this.loginUser.name,
  1069. // contactsInformation: this.loginUser.phone,
  1070. description: this.coopBx.content,
  1071. requester: { account: this.loginUser.account },
  1072. sourceType: "wechatUserIncident",
  1073. fileUrl: "url",
  1074. bxcode,
  1075. },
  1076. loginUser: {
  1077. account: this.loginUser.account,
  1078. id: this.loginUser.id,
  1079. },
  1080. };
  1081. if (this.coopBx.category) {
  1082. postData.incident.categoryId = this.coopBx.category.id;
  1083. }
  1084. this.mainService.addWxIncident(postData).subscribe((res) => {
  1085. this.loading6 = false;
  1086. this.bxModal = false;
  1087. if ((res as any).state == 200) {
  1088. this.showPromptModal("提交", true, "");
  1089. this.checkTable("bxlb");
  1090. } else {
  1091. this.showPromptModal("提交", false, (res as any).msg);
  1092. }
  1093. });
  1094. } else {
  1095. this.loading6 = false;
  1096. this.showPromptModal("提交", false, "");
  1097. }
  1098. });
  1099. }
  1100. // 获取事件状态
  1101. incidentStateId = undefined;
  1102. incidentStateList = [];
  1103. getIncidentState() {
  1104. let postData = { type: "list", key: "wxincident_state" };
  1105. this.iLoading = true;
  1106. this.mainService.getDictionaryByITSM(postData).subscribe((data: any) => {
  1107. this.iLoading = false;
  1108. if (data.status == 200) {
  1109. this.incidentStateList = data.data || [];
  1110. }
  1111. });
  1112. }
  1113. // 获取星级
  1114. degrees = [];
  1115. getDegrees() {
  1116. let postData = { type: "list", key: "incident_degree" };
  1117. this.iLoading = true;
  1118. this.mainService.getDictionaryByITSM(postData).subscribe((data: any) => {
  1119. this.iLoading = false;
  1120. if (data.status == 200) {
  1121. this.degrees = data.data || [];
  1122. }
  1123. });
  1124. }
  1125. // 获取故障现象(三级)
  1126. incidentList = [];
  1127. iLoading = false;
  1128. getIncidentcategory(key = "") {
  1129. let postData = {
  1130. idx: 0,
  1131. sum: 9999,
  1132. incidentcategory: {
  1133. category: key,
  1134. selectType: "pinyin_qs",
  1135. hierarchyQuery: "three",
  1136. },
  1137. };
  1138. this.iLoading = true;
  1139. this.mainService
  1140. .fetchListBx("incidentcategory", postData)
  1141. .subscribe((data: any) => {
  1142. this.iLoading = false;
  1143. if (data.status == 200) {
  1144. this.incidentList = data.list || [];
  1145. }
  1146. });
  1147. }
  1148. // 获取当前登录人科室任务类型信息
  1149. othersList: any = []; // 其他一键建单列表
  1150. bbMsg: any = {}; //标本一键建单
  1151. patientMsgList: any = []; // 患者转运,患者陪检一键建单
  1152. tabFlag = true; //页面初始化获取一次患者陪检的任务类型信息
  1153. allowUrgentFlag = false; //检查列表的患者陪检类型是否允许加急
  1154. tabPermission:any = []; //tab自定义
  1155. tabPermissionTpl:any = []; //tab自定义模板
  1156. getDeptTaskType(search?, clear?) {
  1157. let that = this;
  1158. this.otherNum++;
  1159. this.oLoading = true;
  1160. let postData = {
  1161. deptId: that.loginUserDeptId,
  1162. };
  1163. if (search !== undefined) {
  1164. postData["taskName"] = search;
  1165. postData["tabId"] = this.checkedTableType == 'other' ? undefined : this.checkedTableType;
  1166. }
  1167. that.mainService
  1168. .postCustom("nurse", "getDeptTaskType", postData)
  1169. .subscribe((data) => {
  1170. this.otherNum--;
  1171. if (this.otherNum === 0) {
  1172. this.oLoading = false;
  1173. }
  1174. if (search === undefined) {
  1175. that.deptTaskTypeRules = data.data;
  1176. that.getOrderList();
  1177. if(that.deptTaskTypeRules.openPatientTransport){
  1178. // 手术权限
  1179. that.getSurgeryWKOMsg();
  1180. }
  1181. if (
  1182. that.deptTaskTypeRules.openInspection ||
  1183. that.deptTaskTypeRules.openPatientTransport
  1184. ) {
  1185. // 陪检权限或转科权限
  1186. if (this.tabFlag) {
  1187. this.tabFlag = false;
  1188. this.getTaskTypeByInspection().subscribe((result) => {
  1189. console.log(result);
  1190. if (result.list && result.list.length > 0) {
  1191. this.appointmentBuildFlag =
  1192. result.list[0].appointmentSwitch + ""; //是否开启护士端预约建单
  1193. // this.leadTime = result.list[0].appointmentTime; //生效时长
  1194. this.leadTime = 0; //生效时长
  1195. this.followFlag = result.list[0].focusSwitch + ""; //是否开启护士端重点关注
  1196. this.allowUrgentFlag =
  1197. result.list[0].allowUrgent == 1 ? true : false; //是否允许加急(检查列表)
  1198. } else {
  1199. this.appointmentBuildFlag = "0"; //是否开启护士端预约建单
  1200. this.leadTime = 0; //生效时长
  1201. this.followFlag = "0"; //是否开启护士端重点关注
  1202. this.allowUrgentFlag = false; //是否允许加急(检查列表)
  1203. }
  1204. this.pLoading = true;
  1205. that.getPatient();
  1206. });
  1207. } else {
  1208. that.getPatient();
  1209. }
  1210. }
  1211. if (that.deptTaskTypeRules.openSpecimen) {
  1212. // 标本权限
  1213. that.getSpecimenWorkOrderMsg();
  1214. }
  1215. if (
  1216. that.deptTaskTypeRules.openStaticDistribution ||
  1217. that.deptTaskTypeRules.openDrugsBag
  1218. ) {
  1219. // 药品静配权限
  1220. that.getJpDrugsWKOMsg();
  1221. }
  1222. }
  1223. if(data.data.tabPermission && Array.isArray(data.data.tabPermission.data)){
  1224. if (search !== undefined) {
  1225. let tabPermission = [];
  1226. tabPermission = this.tabPermissionTpl.map(v => {
  1227. let obj = data.data.tabPermission.data.find(vv => vv.id == v.id);
  1228. if(obj){
  1229. return obj;
  1230. }else{
  1231. return v;
  1232. }
  1233. })
  1234. this.tabPermission = tabPermission.sort((a,b) => a.orders - b.orders);
  1235. }else{
  1236. this.tabPermission = data.data.tabPermission.data.sort((a,b) => a.orders - b.orders);
  1237. this.tabPermissionTpl = data.data.tabPermission.data.sort((a,b) => a.orders - b.orders).map(v => ({...v, taskTypeList: []}));
  1238. }
  1239. }else{
  1240. this.tabPermission = this.tabPermissionTpl.length ? cloneDeep(this.tabPermissionTpl) : [];
  1241. }
  1242. if(!this.coopBtns.buildOrdersForOtherTasks){
  1243. this.tabPermission = this.tabPermission.filter(v => !v.system);
  1244. }
  1245. // 初始化默认显示第一个
  1246. if(search === undefined){
  1247. if(this.tabPermission.length){
  1248. this.checkedTableType = (this.tabPermission[0] && this.tabPermission[0].system) ? 'other' : this.tabPermission[0].id;
  1249. }else if(this.coopBtns.suggestionBox){
  1250. this.checkedTableType = 'advice';
  1251. this.checkTable(this.checkedTableType);
  1252. }else if(this.coopBtns.surgery){
  1253. this.checkedTableType = 'surgery';
  1254. this.checkTable(this.checkedTableType);
  1255. }else if(this.coopBtns.inquiryOfHistoricalSpecimens){
  1256. this.checkedTableType = 'historySpecimen';
  1257. this.checkTable(this.checkedTableType);
  1258. }else if(this.coopBtns.historicalMedicineListInquiry){
  1259. this.checkedTableType = 'historyDrugsbag';
  1260. this.checkTable(this.checkedTableType);
  1261. }else if(this.coopBtns.quickReportForRepair && this.isShowBx){
  1262. this.checkedTableType = 'kjbx';
  1263. this.checkTable(this.checkedTableType);
  1264. }else if(this.coopBtns.repairList && this.isShowBx){
  1265. this.checkedTableType = 'bxlb';
  1266. this.checkTable(this.checkedTableType);
  1267. }
  1268. }
  1269. this.othersList = {};
  1270. this.tabPermission.forEach(v => {
  1271. if(v.system){
  1272. that.othersList['other'] = [];
  1273. }else{
  1274. that.othersList[v.id] = v.taskTypeList || [];
  1275. }
  1276. })
  1277. if (data.data.allTaskTypes) {
  1278. that.patientMsgList = [];
  1279. data.data.allTaskTypes.forEach((e) => {
  1280. if (e.associationType.value == "other") {
  1281. if(that.othersList['other']){
  1282. that.othersList['other'].push(e);
  1283. }else{
  1284. that.othersList['other'] = [e];
  1285. }
  1286. } else if (e.associationType.value == "specimen") {
  1287. that.bbMsg = e;
  1288. } else if (
  1289. e.associationType.value == "patientTransport" ||
  1290. e.associationType.value == "inspect"
  1291. ) {
  1292. that.patientMsgList.push(e);
  1293. }
  1294. });
  1295. // if (clear === "clear") {
  1296. // this.otherSearch = "";
  1297. // this.workOrderRemark = "";
  1298. // this.customRemarks = [];
  1299. // this.historyCustomRemarks = [];
  1300. // let obj = that.othersList.find(
  1301. // (item) => item.id == this.selectOtherId
  1302. // );
  1303. // obj && this.otherClick(obj);
  1304. // }
  1305. console.log(this.selectOtherId);
  1306. if (!this.selectOtherId) {
  1307. if (that.othersList[that.checkedTableType] && that.othersList[that.checkedTableType].length) {
  1308. this.selectOtherId = that.othersList[that.checkedTableType][0].id;
  1309. let obj = that.othersList[that.checkedTableType].find(
  1310. (item) => item.id == this.selectOtherId
  1311. );
  1312. obj && this.otherClick(obj);
  1313. } else {
  1314. this.selectOtherId = null;
  1315. }
  1316. }
  1317. }
  1318. });
  1319. }
  1320. // 工号输入搜索
  1321. searchAccount(e) {
  1322. this.searchAccountSubject.next(e);
  1323. }
  1324. // 根据工号获取用户
  1325. account = null;
  1326. accountList = [];
  1327. isLoading:boolean = false;
  1328. getAccountList(key = ''): void {
  1329. let postData = {
  1330. idx: 0,
  1331. sum: 10,
  1332. user: {
  1333. account: key,
  1334. hospital: {
  1335. id: this.currentHospital.id
  1336. }
  1337. }
  1338. };
  1339. this.isLoading = true;
  1340. this.mainService
  1341. .getFetchDataList("data", "user", postData)
  1342. .subscribe((data) => {
  1343. this.isLoading = false;
  1344. this.accountList = data.list || [];
  1345. });
  1346. }
  1347. // 目标科室输入搜索
  1348. searchDept(type, msg, e) {
  1349. this.getDeptList(type, msg, e);
  1350. }
  1351. // 获取科室
  1352. getDeptList(type, msg, key?): void {
  1353. // 返回值的status是201 则是默认发起科室
  1354. // 返回值的status是202 则是固定科室范围
  1355. // 返回值的status是203 则是固定科室
  1356. // 返回值的status是204 则是自主填写
  1357. // 返回值的status是205 则是固定科室类型
  1358. if (
  1359. (type == "start" && msg.start.start.departmentStrategy == 202) ||
  1360. (type == "target" && msg.end.end.departmentStrategy == 202)
  1361. ) {
  1362. return; //固定科室范围禁用搜索
  1363. }
  1364. let postData: any = {
  1365. idx: 0,
  1366. sum: 20,
  1367. department: {
  1368. searchType: 1,
  1369. cascadeHosId: this.currentHospital.id
  1370. },
  1371. };
  1372. if (key) {
  1373. postData.department["keyWord"] = key;
  1374. }
  1375. if (type == "start" && msg.start.start.departmentStrategy == 205) {
  1376. postData.department["type"] = { id: msg.start.start.startTypeId };
  1377. } else if (type == "target" && msg.end.end.departmentStrategy == 205) {
  1378. postData.department["type"] = { id: msg.end.end.endTypeId };
  1379. }
  1380. if (type == "start") {
  1381. postData.department["ids"] = msg.start.deptIds || "";
  1382. } else if (type == "target") {
  1383. postData.department["ids"] = msg.end.deptIds || "";
  1384. }
  1385. postData.department.nurseSign = 1;
  1386. this.mainService
  1387. .getFetchDataList("data", "department", postData)
  1388. .subscribe((data) => {
  1389. if (type == "target") {
  1390. msg.end.end.list = data.list;
  1391. } else if (type == "start") {
  1392. msg.start.start.list = data.list;
  1393. }
  1394. });
  1395. }
  1396. // 切换左侧tab
  1397. changeInfo() {
  1398. if (
  1399. !this.deptTaskTypeRules.openInspection &&
  1400. !this.deptTaskTypeRules.openPatientTransport
  1401. ) {
  1402. return;
  1403. }
  1404. this.infoPageIdx = 1;
  1405. this.getPatient();
  1406. }
  1407. // 获取患者信息
  1408. snum = 0;
  1409. getPatient(e?) {
  1410. if ((this.currentDept.typeValue == "checkRoom2" || this.currentDept.typeValue == "outpatientDept" || this.currentDept.typeValue == "checkRoom") && !this.tabSearchCont) {
  1411. this.pLoading = false;
  1412. this.patientList = [];
  1413. this.infoLength = 0;
  1414. return; //护士端如果登录后如果科室类型为“检查科室”、“门诊科室”、“检验科室”,默认不显示患者信息
  1415. }
  1416. this.pLoading = true;
  1417. let postData = {
  1418. idx: this.infoPageIdx - 1,
  1419. sum: 10,
  1420. };
  1421. if(this.currentDept.typeValue == 'surgery' && !this.tabSearchCont){
  1422. // 手术安排信息-手术室类型
  1423. postData["surgery"] = {
  1424. searchKey: e ? e : this.tabSearchCont,
  1425. applyDateStart: format(startOfDay(new Date()), "yyyy-MM-dd HH:mm:ss"),
  1426. applyDateEnd: format(endOfDay(new Date()), "yyyy-MM-dd HH:mm:ss"),
  1427. hosId: this.currentHospital.id,
  1428. surgeryDept: this.loginUserDeptId,
  1429. state: {
  1430. key: 'surgery_trans_state',
  1431. value: 3
  1432. }
  1433. };
  1434. }else if(this.currentDept.typeValue == 'recovery'){
  1435. // 患者信息-复苏室类型
  1436. postData["patient"] = {
  1437. keyWord: e ? e : this.tabSearchCont,
  1438. };
  1439. // 查询父级科室患者
  1440. postData["patient"]["parentIdOnly"] = true;
  1441. postData["patient"]["recoveryDept"] = this.loginUserDeptId;
  1442. postData["patient"]["recoveryDeptDTO"] = {keyWord: '1'};
  1443. }else{
  1444. // 患者信息
  1445. postData["patient"] = {
  1446. keyWord: e ? e : this.tabSearchCont,
  1447. };
  1448. // 查询父级科室患者
  1449. postData["patient"]["parentIdOnly"] = true;
  1450. if (
  1451. this.currentDept.typeValue == "checkRoom2" ||
  1452. this.currentDept.typeValue == "outpatientDept" ||
  1453. this.currentDept.typeValue == "checkRoom" ||
  1454. (this.currentDept.typeValue == 'surgery' && this.tabSearchCont)
  1455. ) {
  1456. delete postData["patient"]["department"]; //搜索范围为全院在院患者
  1457. } else {
  1458. postData["patient"]["department"] = { id: this.loginUserDeptId };
  1459. }
  1460. }
  1461. this.snum++;
  1462. this.mainService
  1463. .getFetchDataList((this.currentDept.typeValue == 'surgery' && !this.tabSearchCont) ? "simple/data" : 'nurse', (this.currentDept.typeValue == 'surgery' && !this.tabSearchCont) ? "surgery" : 'patient', postData)
  1464. .subscribe((data) => {
  1465. this.snum--;
  1466. if (data.list.length > 0) {
  1467. data.list.forEach((item) => {
  1468. if(this.currentDept.typeValue == 'surgery' && !this.tabSearchCont){
  1469. if (item.patientDTO && item.patientDTO.focusPatient === undefined) {
  1470. item.patientDTO.focusPatient = 0;
  1471. }
  1472. }else{
  1473. if (item.focusPatient === undefined) {
  1474. item.focusPatient = 0;
  1475. }
  1476. }
  1477. });
  1478. }
  1479. this.patientList = data.list || [];
  1480. if (this.snum === 0) {
  1481. this.pLoading = false;
  1482. }
  1483. this.infoLength = data.totalNum || 0;
  1484. });
  1485. }
  1486. // tab输入搜索节流阀
  1487. searchTabInp(e) {
  1488. if (
  1489. !this.deptTaskTypeRules.openInspection &&
  1490. !this.deptTaskTypeRules.openPatientTransport
  1491. ) {
  1492. return;
  1493. }
  1494. this.searchTabInpSubject.next(e);
  1495. }
  1496. // 下一日(陪检)
  1497. nextDay() {
  1498. this.yyDate = addDays(this.yyDate, 1);
  1499. this.yyDateChange(this.yyDate);
  1500. }
  1501. // 下一日(转运)
  1502. nextDayZy() {
  1503. this.yyDateZy = addDays(this.yyDateZy, 1);
  1504. this.yyDateChange(this.yyDateZy);
  1505. }
  1506. // 禁用日期(陪检)
  1507. disabledyyDate = (current: Date): boolean => {
  1508. return differenceInCalendarDays(current, new Date()) < 0;
  1509. };
  1510. // 禁用日期(转运)
  1511. disabledyyDateZy = (current: Date): boolean => {
  1512. return differenceInCalendarDays(current, new Date()) < 0;
  1513. };
  1514. // 一键建单确认弹框
  1515. confirmSub: boolean = false;
  1516. confirmPostData: any = {}; //确认提交数据
  1517. confirmYuyue: boolean = false; //确认预约
  1518. confirmInfo: string = "";
  1519. btnLoading3 = false;
  1520. confirm() {
  1521. if (this.confirmYuyue) {
  1522. this.confirmPostData.workOrder.yyTime =
  1523. format(parse(this.yyTime, 'yyyy-MM-dd HH:mm:ss', new Date()), "yyyy-MM-dd HH:mm") + ":00";
  1524. }
  1525. if (!this.confirmYuyue) {
  1526. this.confirmPostData.workOrder.platform = 2;
  1527. } else {
  1528. delete this.confirmPostData.workOrder.platform;
  1529. }
  1530. //是否需要医护陪同检查
  1531. if (this.patientMsg.careLevel && this.currentTasktype.isAccompany == 1) {
  1532. //特级护理或一级护理
  1533. if (
  1534. this.patientMsg.careLevel.value === "0" ||
  1535. this.patientMsg.careLevel.value === "1"
  1536. ) {
  1537. this.btnLoading = false;
  1538. this.btnLoading1 = false;
  1539. this.accompany(this.confirmPostData, this.confirmYuyue, "patient-yy");
  1540. return;
  1541. }
  1542. }
  1543. if (this.patientMsg.illnessState && this.currentTasktype.isAccompany == 1) {
  1544. //病危或病重
  1545. if (
  1546. this.patientMsg.illnessState.value === "2" ||
  1547. this.patientMsg.illnessState.value === "3"
  1548. ) {
  1549. this.btnLoading = false;
  1550. this.btnLoading1 = false;
  1551. this.accompany(this.confirmPostData, this.confirmYuyue, "patient-yy");
  1552. return;
  1553. }
  1554. }
  1555. this.btnLoading3 = true;
  1556. this.confirmPostData.workOrder.isAccompany = 0; //是否需要医护陪同检查
  1557. this.newOrderTimeFun(this.confirmPostData.workOrder, () => {
  1558. this.btnLoading3 = false;
  1559. this.cancel();
  1560. }, () => {
  1561. this.mainService
  1562. .postCustom(
  1563. "api",
  1564. this.confirmYuyue ? "appointmentOrder" : "startOrder",
  1565. this.confirmPostData
  1566. )
  1567. .subscribe((data) => {
  1568. this.message.remove(this.jdFlagId);
  1569. this.btnLoading3 = false;
  1570. this.cancel();
  1571. if (data.status == 200) {
  1572. if(this.currentDept.typeValue == 'recovery'){
  1573. this.mainService.postCustom("api", "clearPatientRecoveryDept", {patientCode: this.confirmPostData.workOrder.patient.patientCode}).subscribe((resultData) => {
  1574. this.showPromptModal("创建", true, "");
  1575. this.goodsLis = [];
  1576. this.getOrderList();
  1577. this.getDeptTaskType();
  1578. this.getTodayNum();
  1579. });
  1580. }else{
  1581. this.showPromptModal("创建", true, "");
  1582. this.goodsLis = [];
  1583. this.getOrderList();
  1584. this.getDeptTaskType();
  1585. this.getTodayNum();
  1586. }
  1587. } else if (data.status == 100042) {
  1588. this.showPromptModal("创建", false, data.msg);
  1589. this.getPatient(this.tabSearchCont);
  1590. } else if (data.status == 1000033) {
  1591. //重复建单那策略
  1592. this.repeatMsg = data.msg;
  1593. this.showDelModal(
  1594. this.confirmPostData,
  1595. "accompany5",
  1596. this.confirmYuyue
  1597. );
  1598. } else {
  1599. this.showPromptModal("创建", false, data.msg);
  1600. }
  1601. });
  1602. })
  1603. }
  1604. cancel() {
  1605. this.confirmSub = false;
  1606. // this.confirmPostData = {};
  1607. // this.confirmYuyue = false;
  1608. this.btnLoading = false;
  1609. }
  1610. patientForm: FormGroup; //患者信息一键建单表单
  1611. //患者送检检查项目
  1612. checkTypeLis: any = [];
  1613. // 患者信息一键建单关联检查
  1614. linkCheckLis: any = [];
  1615. goodsLis: any = []; //携带设备
  1616. isRemarks: boolean = false; //是否开启备注信息
  1617. allowUrgent: any = "0"; //加急
  1618. urgentReason: any = ""; //加急原因
  1619. // 初始化form表单
  1620. initForm() {
  1621. // 初始化患者信息一键建单表单
  1622. this.patientForm = this.fb.group({
  1623. checkedType: [null, [Validators.required]],
  1624. goods: [null],
  1625. workOrderRemark2: [null],
  1626. linkCheck: [null, []],
  1627. targetOffice: [null, [this.targetOfficeValidator]],
  1628. originOffice: [null, [this.originOfficeValidator]],
  1629. allowUrgent: [null], //加急
  1630. urgentReason: [null, [this.urgentReasonValidator]], //加急原因
  1631. });
  1632. // 初始化一键发起建单表单
  1633. this.shortcutForm = this.fb.group({
  1634. targetOffice: [null, [this.targetOfficeShortCutValidator]],
  1635. originOffice: [null, [this.originOfficeShortCutValidator]],
  1636. });
  1637. // 初始化一键发起建单表单
  1638. this.shortcutForm1 = this.fb.group({
  1639. targetOffice: [null, [this.targetOfficeShortCutValidator1]],
  1640. originOffice: [null, [this.originOfficeShortCutValidator1]],
  1641. });
  1642. //新增报修
  1643. this.bxForm = this.fb.group({
  1644. // name: [null, [Validators.required]],
  1645. // phone: [null, [Validators.required]],
  1646. // hospital: [null, [Validators.required]],
  1647. // building: [null, [Validators.required]],
  1648. // address: [null, [Validators.required]],
  1649. content: [null, [Validators.required]],
  1650. });
  1651. }
  1652. //创建自定义校验规则dateValidator,用于复选框组校验时调用。
  1653. // 起点科室校验
  1654. originOfficeValidator = (control: FormControl): { [s: string]: boolean } => {
  1655. if (
  1656. this.patientForm &&
  1657. this.patientForm.value &&
  1658. this.checkedShowMsg.status != 200 &&
  1659. !control.value &&
  1660. (this.checkedShowMsg.status == 100015 ||
  1661. this.checkedShowMsg.status == 100013)
  1662. ) {
  1663. return { required: true };
  1664. }
  1665. };
  1666. // 目标科室校验
  1667. targetOfficeValidator = (control: FormControl): { [s: string]: boolean } => {
  1668. if (
  1669. this.patientForm &&
  1670. this.patientForm.value &&
  1671. this.checkedShowMsg.status != 200 &&
  1672. !control.value &&
  1673. (this.checkedShowMsg.status == 100015 ||
  1674. this.checkedShowMsg.status == 100014)
  1675. ) {
  1676. return { required: true };
  1677. }
  1678. };
  1679. // 加急原因校验
  1680. urgentReasonValidator = (control: FormControl): { [s: string]: boolean } => {
  1681. if (this.allowUrgent == 1) {
  1682. return { required: true };
  1683. }
  1684. };
  1685. surgeryModal: boolean = false; //模态框
  1686. surgeryInfo:string = '';
  1687. surgeryItem: any = {};
  1688. hideSurgeryModal() {
  1689. this.surgeryModal = false;
  1690. }
  1691. // 确认
  1692. confirmSurgery(surgeryItem) {
  1693. console.log(surgeryItem);
  1694. this.btnLoading = true;
  1695. this.mainService
  1696. .listMsgByMain('surgeryMsg', {
  1697. surgeryId: surgeryItem.id,
  1698. code: 'surgery_begin',
  1699. })
  1700. .subscribe((result:any) => {
  1701. this.btnLoading = false;
  1702. this.surgeryModal = false;
  1703. if(result.state == 200){
  1704. this.showPromptModal("操作", true, "");
  1705. }else{
  1706. this.showPromptModal("操作", false, result.msg);
  1707. }
  1708. });
  1709. }
  1710. // 手术安排信息-即将开始
  1711. surgeryBegin(e, item){
  1712. e.stopPropagation();
  1713. let maskFlag = this.message.loading("正在加载中..", {
  1714. nzDuration: 0,
  1715. }).messageId;
  1716. let postData = {
  1717. idx: 0,
  1718. sum: 9999,
  1719. transportMessage: {
  1720. hosId: this.currentHospital.id,
  1721. code: 'surgery_begin',
  1722. },
  1723. };
  1724. this.mainService
  1725. .getFetchDataList("simple/data", "transportMessage", postData)
  1726. .subscribe((result:any) => {
  1727. this.message.remove(maskFlag);
  1728. if (result.status == 200) {
  1729. result.list = result.list || [];
  1730. if(result.list.length){
  1731. let resultObj:any = {};
  1732. result.list.forEach(v => {
  1733. resultObj[v.role] = v;
  1734. })
  1735. item.doctorNameFlag = resultObj.doctor.phoneFlag == 1 || resultObj.doctor.wechatFlag == 1;
  1736. item.docAssistantInfosFlag = resultObj.docAssistant.phoneFlag == 1 || resultObj.docAssistant.wechatFlag == 1;
  1737. item.anesthetistNameFlag = resultObj.anesthetist.phoneFlag == 1 || resultObj.anesthetist.wechatFlag == 1;
  1738. item.patientNameFlag = resultObj.patient.phoneFlag == 1 || resultObj.patient.wechatFlag == 1;
  1739. if(item.docAssistantInfosFlag && item.docAssistantInfos){
  1740. item.docAssistantInfos = item.docAssistantInfos.split('|').map(v => v.split(',')[0]).join(' / ');
  1741. }
  1742. this.surgeryModal = true;
  1743. this.surgeryItem = item;
  1744. this.surgeryInfo = `提示:您即将给以下工作人员发送短信/微信提醒,请确认以下信息`;
  1745. }else{
  1746. this.showPromptModal("【手术即将开始通知】未配置", false, "失败");
  1747. }
  1748. }else{
  1749. this.showPromptModal("接口获取数据", false, "失败");
  1750. }
  1751. });
  1752. }
  1753. // -----------------
  1754. // --------------------------------------------------------start
  1755. otherDataModal: boolean = false; //模态框
  1756. otherDataInfo:string = '';
  1757. otherDataItem: any = {};
  1758. hideOtherDataModal() {
  1759. this.otherDataModal = false;
  1760. }
  1761. // 确认
  1762. confirmOtherData() {
  1763. console.log(this.otherDataItem);
  1764. this.otherBuildOrder(JSON.parse(this.otherDataItem).otherList);
  1765. this.otherDataModal = false;
  1766. this.relationTransModalShow = JSON.parse(this.otherDataItem).show;
  1767. }
  1768. otherDataConfirm(e){
  1769. this.otherDataModal = true;
  1770. this.otherDataItem = e;
  1771. this.otherDataInfo = `您本次送${this.otherBindConfigDto.relationTrans.name}选择了${JSON.parse(this.otherDataItem).otherList.length}本${this.otherBindConfigDto.relationTrans.name},您确认要建单配送吗?`;
  1772. }
  1773. // --------------------------------------------------------end
  1774. pickUpModal: boolean = false; //模态框
  1775. pickUpInfo:string = '';
  1776. pickUpItem: any = {};
  1777. hidePickUpModal() {
  1778. this.pickUpModal = false;
  1779. }
  1780. // 确认
  1781. confirmPickUp() {
  1782. console.log(this.pickUpItem);
  1783. this.btnLoading = true;
  1784. this.mainService
  1785. .createOrTakeOrder({
  1786. type: 'surgery',
  1787. id: this.pickUpItem.id,
  1788. workOrder: {
  1789. sourceld: 2,
  1790. createDept: this.loginUser.dept.id,
  1791. platform: 2
  1792. }
  1793. })
  1794. .subscribe((result:any) => {
  1795. this.btnLoading = false;
  1796. this.pickUpModal = false;
  1797. if(result.state == 200){
  1798. this.showPromptModal("创建", true, "");
  1799. this.getOrderList();
  1800. this.getDeptTaskType();
  1801. this.getTodayNum();
  1802. }else{
  1803. this.showPromptModal("创建", false, result.msg);
  1804. }
  1805. });
  1806. }
  1807. // 手术安排信息-一键接患者
  1808. pickUpPatient(e, item){
  1809. e.stopPropagation();
  1810. this.pickUpModal = true;
  1811. this.pickUpItem = item;
  1812. this.pickUpInfo = `您本次需要从<span style="color:red;">${item.areaDeptDTO ? (this.deptDisplay == 2 ? item.areaDeptDTO.deptalias : item.areaDeptDTO.dept) : ''}</span>科室接<span style="color:red;">${item.patientDTO ? item.patientDTO.patientName : ''}</span>患者到<span style="color:red;">${item.surgeryDeptDTO ? (this.deptDisplay == 2 ? item.surgeryDeptDTO.deptalias : item.surgeryDeptDTO.dept) : ''}</span>手术间进行手术,您确认接患者吗?`
  1813. }
  1814. sendWardModal: boolean = false; //模态框
  1815. sendWardInfo:string = '';
  1816. sendWardItem: any = {};
  1817. hideSendWardModal() {
  1818. this.sendWardModal = false;
  1819. }
  1820. // 确认
  1821. sLoading1 = false;
  1822. confirmSendWard(data) {
  1823. console.log(this.sendWardItem);
  1824. this.sLoading1 = true;
  1825. this.mainService
  1826. .createRemandOrder({
  1827. type: 'surgery',
  1828. surgeryId: this.sendWardItem.id,
  1829. orderId: this.sendWardItem.gdid,
  1830. configId: this.surgeryConfigs.id,
  1831. remandType: 'clinical',
  1832. remandClean: data.isRemandClean ? 1 : 0,
  1833. })
  1834. .subscribe((result:any) => {
  1835. this.sLoading1 = false;
  1836. this.sendWardModal = false;
  1837. if(result.state == 200){
  1838. this.showPromptModal("创建", true, "");
  1839. this.getOrderList();
  1840. this.getDeptTaskType();
  1841. this.getTodayNum();
  1842. }else{
  1843. this.showPromptModal("创建", false, result.msg);
  1844. }
  1845. });
  1846. }
  1847. // 手术中患者-送回病房
  1848. sendWard(e, item){
  1849. e.stopPropagation();
  1850. this.sendWardModal = true;
  1851. this.sendWardItem = item;
  1852. this.sendWardInfo = `您是否确认将<span style="color:red;">${item.patientDTO ? item.patientDTO.patientName : ''}</span>患者送往<span style="color:red;">${item.areaDeptDTO ? (this.deptDisplay == 2 ? item.areaDeptDTO.deptalias : item.areaDeptDTO.dept) : ''}</span>科室吗?`
  1853. }
  1854. sendAwakeningRoomModal: boolean = false; //模态框
  1855. sendAwakeningRoomInfo:string = '';
  1856. sendAwakeningRoomItem: any = {};
  1857. hideSendAwakeningRoomModal() {
  1858. this.sendAwakeningRoomModal = false;
  1859. }
  1860. // 确认
  1861. sLoading2 = false;
  1862. confirmSendAwakeningRoom(data) {
  1863. console.log(this.sendAwakeningRoomItem);
  1864. console.log(this.surgeryConfigs);
  1865. if(!data.recoveryRoom){
  1866. this.message.info(`<span class="red">${this.surgeryConfigs.recoveryType.taskName}</span>任务类型-运输过程-终点科室-默认科室配置错误!`);
  1867. return;
  1868. }
  1869. this.sLoading2 = true;
  1870. this.mainService
  1871. .createRemandOrder({
  1872. type: 'surgery',
  1873. surgeryId: this.sendAwakeningRoomItem.id,
  1874. orderId: this.sendAwakeningRoomItem.gdid,
  1875. configId: this.surgeryConfigs.id,
  1876. remandType: 'recovery',
  1877. remandClean: data.isRemandClean ? 1 : 0,
  1878. endDept: data.recoveryRoom || undefined,
  1879. })
  1880. .subscribe((result:any) => {
  1881. this.sLoading2 = false;
  1882. this.sendAwakeningRoomModal = false;
  1883. if(result.state == 200){
  1884. this.showPromptModal("创建", true, "");
  1885. this.getOrderList();
  1886. this.getDeptTaskType();
  1887. this.getTodayNum();
  1888. }else{
  1889. this.showPromptModal("创建", false, result.msg);
  1890. }
  1891. });
  1892. }
  1893. // 手术中患者-送回苏醒区
  1894. sendAwakeningRoom(e, item){
  1895. e.stopPropagation();
  1896. this.sendAwakeningRoomModal = true;
  1897. this.sendAwakeningRoomItem = item;
  1898. this.sendAwakeningRoomInfo = `您是否确定将<span style="color:red;">${item.patientDTO ? item.patientDTO.patientName : ''}</span>患者送往<span style="color:red;">${this.surgeryConfigs.recoveryDeptDTO ? (this.deptDisplay == 2 ? this.surgeryConfigs.recoveryDeptDTO.deptalias : this.surgeryConfigs.recoveryDeptDTO.dept) : ''}</span>科室吗?`
  1899. }
  1900. // 患者信息一键建单
  1901. patientModal: boolean = false; //患者信息一键建单模态框
  1902. patientMsg; //患者信息
  1903. // 打开患者信息一键建单模态框
  1904. maskFlag: any = false;
  1905. newPatientOrder(msg) {
  1906. this.yyTime = null;
  1907. this.yyTimeZy = null;
  1908. this.btnLoading = false;
  1909. this.btnLoading1 = false;
  1910. let that = this;
  1911. that.initForm();
  1912. that.checkedShowMsg = {};
  1913. that.patientMsg = msg;
  1914. this.maskFlag = this.message.loading("正在加载中..", {
  1915. nzDuration: 0,
  1916. }).messageId;
  1917. that.mainService
  1918. .postCustom("configuration", "deptTSPTaskType", {})
  1919. .subscribe((data) => {
  1920. that.checkTypeLis = data.data;
  1921. // 默认选中患者陪检,没有患者陪检,则选择第一个患者其他服务的任务类型
  1922. let id;
  1923. for (let i = that.checkTypeLis.length - 1; i >= 0; i--) {
  1924. if (that.checkTypeLis[i].associationType.value == "inspect") {
  1925. id = that.checkTypeLis[i].id;
  1926. break;
  1927. } else if (
  1928. that.checkTypeLis[i].associationType.value == "patientTransport"
  1929. ) {
  1930. id = that.checkTypeLis[i].id;
  1931. }
  1932. }
  1933. that.patientForm.controls.checkedType.setValue(id);
  1934. this.changeCheckedType();
  1935. });
  1936. }
  1937. yyTimeChange(e) {
  1938. if (this.yyTime) {
  1939. let now = new Date();
  1940. // 禁用日期(陪检)
  1941. if (getHours(this.yyTime) < getHours(now)) {
  1942. this.disabledyyDate = (current: Date): boolean => {
  1943. return differenceInCalendarDays(current, new Date()) < 1;
  1944. };
  1945. } else {
  1946. this.disabledyyDate = (current: Date): boolean => {
  1947. return differenceInCalendarDays(current, new Date()) < 0;
  1948. };
  1949. }
  1950. let end = this.getLgNumber(getMinutes(this.yyTime), this.inspectAndPatientTransportConfig.timeMod);
  1951. this.yyTime = setMinutes(this.yyTime, end);
  1952. }
  1953. this.clickYYFlag = false;
  1954. }
  1955. yyTimeZyChange(e) {
  1956. if (this.yyTimeZy) {
  1957. let now = new Date();
  1958. // 禁用日期(转运)
  1959. if (getHours(this.yyTimeZy) < getHours(now)) {
  1960. this.disabledyyDateZy = (current: Date): boolean => {
  1961. return differenceInCalendarDays(current, new Date()) < 1;
  1962. };
  1963. } else {
  1964. this.disabledyyDateZy = (current: Date): boolean => {
  1965. return differenceInCalendarDays(current, new Date()) < 0;
  1966. };
  1967. }
  1968. let end = this.getLgNumber(getMinutes(this.yyTimeZy), this.inspectAndPatientTransportConfig.timeMod);
  1969. this.yyTimeZy = setMinutes(this.yyTimeZy, end);
  1970. }
  1971. this.clickYYZyFlag = false;
  1972. }
  1973. // 获取大于x,并且是n的倍数的数字
  1974. getLgNumber(x: number, n:number): number{
  1975. for(let i = x; i < 60; i++){
  1976. if(i % n === 0){
  1977. return i;
  1978. }
  1979. }
  1980. return 0;
  1981. }
  1982. hidePatientOrder() {
  1983. this.patientModal = false;
  1984. this.clickYYFlag = false;
  1985. this.clickYYZyFlag = false;
  1986. }
  1987. // 预约建单
  1988. btnLoading1 = false;
  1989. confirmPatient1(type) {
  1990. this.confirmPatient(type);
  1991. }
  1992. // 患者信息保存
  1993. clickYYFlag = false; //是否点击预约建单-患者陪检
  1994. clickYYZyFlag = false; //是否点击预约建单-患者其他
  1995. confirmPatient(yuyue?) {
  1996. if (yuyue === "patient-yuyue") {
  1997. this.clickYYFlag = true;
  1998. } else {
  1999. this.clickYYFlag = false;
  2000. }
  2001. if (yuyue === "patient-zy-yuyue") {
  2002. this.clickYYZyFlag = true;
  2003. } else {
  2004. this.clickYYZyFlag = false;
  2005. }
  2006. // 选项是患者转运
  2007. let flag = this.checkTypeLis.some((item) => {
  2008. return (
  2009. item.id == this.patientForm.controls.checkedType.value &&
  2010. item.associationType.value == "patientTransport"
  2011. );
  2012. });
  2013. //预约时间-患者陪检不能为空
  2014. console.log(this.yyTime, this.yyTimeZy, flag, yuyue);
  2015. if (
  2016. (!this.yyTime && !flag && yuyue === "patient-yuyue") ||
  2017. (!this.yyTimeZy && flag && yuyue === "patient-zy-yuyue")
  2018. ) {
  2019. return;
  2020. }
  2021. console.log(this.yyDateZy, this.yyTimeZy, this.yyDate, this.yyTime, flag);
  2022. if (flag) {
  2023. //转运
  2024. let yyDateZy = (typeof this.yyDateZy === 'object') ? new Date(this.yyDateZy) : parse(this.yyDateZy, 'yyyy-MM-dd HH:mm:ss', new Date());
  2025. let yyTimeZy = (typeof this.yyTimeZy === 'object') ? new Date(this.yyTimeZy) : parse(this.yyTimeZy, 'yyyy-MM-dd HH:mm:ss', new Date());
  2026. this.yyTimeZy =
  2027. format(yyDateZy, "yyyy-MM-dd") +
  2028. " " +
  2029. format(yyTimeZy, "HH:mm") +
  2030. ":00";
  2031. } else {
  2032. //陪检
  2033. let yyDate = (typeof this.yyDate === 'object') ? new Date(this.yyDate) : parse(this.yyDate, 'yyyy-MM-dd HH:mm:ss', new Date());
  2034. let yyTime = (typeof this.yyTime === 'object') ? new Date(this.yyTime) : parse(this.yyTime, 'yyyy-MM-dd HH:mm:ss', new Date());
  2035. this.yyTime =
  2036. format(yyDate, "yyyy-MM-dd") +
  2037. " " +
  2038. format(yyTime, "HH:mm") +
  2039. ":00";
  2040. }
  2041. var that = this;
  2042. for (const i in that.patientForm.controls) {
  2043. that.patientForm.controls[i].markAsDirty();
  2044. that.patientForm.controls[i].updateValueAndValidity();
  2045. }
  2046. if (that.patientForm.invalid) {
  2047. return;
  2048. }
  2049. console.log(that.patientForm);
  2050. if (yuyue) {
  2051. this.confirmYuyue = true;
  2052. this.btnLoading1 = true;
  2053. } else {
  2054. this.confirmYuyue = false;
  2055. this.btnLoading = true;
  2056. }
  2057. let postData: any = {
  2058. workOrder: {
  2059. sourceId: SourceId.hushi,
  2060. taskType: { id: that.patientForm.controls.checkedType.value },
  2061. startDept: { id: that.checkedShowMsg.startDept },
  2062. endDepts: [{ id: that.checkedShowMsg.endDept }],
  2063. createDept: that.loginUserDeptId,
  2064. patient: {
  2065. patientCode: that.patientMsg.patientCode,
  2066. },
  2067. },
  2068. };
  2069. if (!flag) {
  2070. postData.workOrder.taskType.isHalfInspect =
  2071. this.currentTasktype.isHalfInspect === 1 ? 1 : 0; //半程陪检
  2072. }
  2073. if (
  2074. (that.checkedShowMsg.status == 100013 ||
  2075. that.checkedShowMsg.status == 100015) &&
  2076. that.patientForm.value.originOffice
  2077. ) {
  2078. postData.workOrder.startDept.id = that.patientForm.value.originOffice;
  2079. }
  2080. if (that.patientForm.value.targetOffice) {
  2081. postData.workOrder["endDepts"] = [
  2082. { id: that.patientForm.value.targetOffice },
  2083. ];
  2084. } else if (flag) {
  2085. postData.workOrder["endDepts"] = [
  2086. { id: that.checkedShowMsg.end.end.list[0].id },
  2087. ];
  2088. }
  2089. let checkedArr = [];
  2090. let yy = false; //是否有预约时间
  2091. if (that.linkCheckLis && that.linkCheckLis.length) {
  2092. that.linkCheckLis.forEach((e) => {
  2093. if (e.checked) {
  2094. checkedArr.push({ id: e.value });
  2095. if (e.yyTime) {
  2096. yy = true;
  2097. }
  2098. }
  2099. });
  2100. }
  2101. // 携带设备
  2102. let goods = "";
  2103. if (that.patientForm.value.goods && that.patientForm.value.goods.length) {
  2104. that.patientForm.value.goods.forEach((e) => {
  2105. if (e.checked) {
  2106. goods += e.value + ",";
  2107. }
  2108. });
  2109. goods = goods.slice(0, goods.length - 1);
  2110. }
  2111. postData.workOrder["goods"] = goods;
  2112. // 工单备注
  2113. postData.workOrder["workOrderRemark"] = that.workOrderRemark2 || '';
  2114. if (!yuyue && that.current_allowUrgent && this.allowUrgent == 1) {
  2115. postData.workOrder["urgentDetails"] = {
  2116. checkStatus: { id: 329 },
  2117. urgentReason: that.urgentReason,
  2118. };
  2119. } else {
  2120. delete postData.workOrder["urgentDetails"];
  2121. }
  2122. if (
  2123. yy &&
  2124. that.checkedShowMsg.status == 200 &&
  2125. that.linkCheckLis &&
  2126. checkedArr.length
  2127. ) {
  2128. // 有预约时间
  2129. postData.workOrder["checkList"] = checkedArr;
  2130. that.hidePatientOrder();
  2131. that.confirmSub = true;
  2132. that.confirmPostData = postData;
  2133. that.confirmInfo = "您确认建单吗?";
  2134. } else {
  2135. if (!yy && that.checkedShowMsg.status == 200) {
  2136. postData.workOrder["checkList"] = checkedArr;
  2137. // 添加预约时间
  2138. if (yuyue) {
  2139. postData.workOrder.yyTime =
  2140. format(parse(this.yyTime, 'yyyy-MM-dd HH:mm:ss', new Date()), "yyyy-MM-dd HH:mm") + ":00";
  2141. }
  2142. } else {
  2143. delete postData.workOrder["checkList"];
  2144. // 添加预约时间
  2145. if (yuyue) {
  2146. postData.workOrder.yyTime =
  2147. format(parse(this.yyTimeZy, 'yyyy-MM-dd HH:mm:ss', new Date()), "yyyy-MM-dd HH:mm") + ":00";
  2148. }
  2149. }
  2150. if (that.checkedShowMsg.status != 200) {
  2151. postData.workOrder["isRemand"] = this.isRemand ? 1 : 0;
  2152. }
  2153. if (!yuyue) {
  2154. postData.workOrder.platform = 2;
  2155. } else {
  2156. delete postData.workOrder.platform;
  2157. }
  2158. //是否需要医护陪同检查
  2159. if (this.patientMsg.careLevel && this.currentTasktype.isAccompany == 1) {
  2160. //特级护理或一级护理
  2161. if (
  2162. this.patientMsg.careLevel.value === "0" ||
  2163. this.patientMsg.careLevel.value === "1"
  2164. ) {
  2165. this.btnLoading = false;
  2166. this.btnLoading1 = false;
  2167. this.accompany(postData, yuyue, "patient");
  2168. return;
  2169. }
  2170. }
  2171. if (
  2172. this.patientMsg.illnessState &&
  2173. this.currentTasktype.isAccompany == 1
  2174. ) {
  2175. //病危或病重
  2176. if (
  2177. this.patientMsg.illnessState.value === "2" ||
  2178. this.patientMsg.illnessState.value === "3"
  2179. ) {
  2180. this.btnLoading = false;
  2181. this.btnLoading1 = false;
  2182. this.accompany(postData, yuyue, "patient");
  2183. return;
  2184. }
  2185. }
  2186. postData.workOrder.isAccompany = 0; //是否需要医护陪同检查
  2187. this.newOrderTimeFun(postData.workOrder, () => {
  2188. this.hidePatientOrder();
  2189. }, () => {
  2190. this.mainService
  2191. .postCustom("api", yuyue ? "appointmentOrder" : "startOrder", postData)
  2192. .subscribe((data) => {
  2193. this.message.remove(this.jdFlagId);
  2194. this.hidePatientOrder();
  2195. if (data.status == 200) {
  2196. if(this.currentDept.typeValue == 'recovery'){
  2197. this.mainService.postCustom("api", "clearPatientRecoveryDept", {patientCode: postData.workOrder.patient.patientCode}).subscribe((resultData) => {
  2198. this.showPromptModal("创建", true, "");
  2199. this.goodsLis = [];
  2200. this.getOrderList();
  2201. this.getDeptTaskType();
  2202. this.getTodayNum();
  2203. });
  2204. }else{
  2205. this.showPromptModal("创建", true, "");
  2206. this.goodsLis = [];
  2207. this.getOrderList();
  2208. this.getDeptTaskType();
  2209. this.getTodayNum();
  2210. }
  2211. } else if (data.status == 100042) {
  2212. this.showPromptModal("创建", false, data.msg);
  2213. this.getPatient(this.tabSearchCont);
  2214. } else if (data.status == 1000033) {
  2215. //重复建单那策略
  2216. this.repeatMsg = data.msg;
  2217. this.showDelModal(postData, "transport", yuyue);
  2218. } else {
  2219. this.showPromptModal("创建", false, data.msg);
  2220. }
  2221. });
  2222. })
  2223. }
  2224. }
  2225. // 是否需要护士医生陪同模态框
  2226. accompanyModal: boolean = false;
  2227. accompanyLoading: boolean = false;
  2228. cancenlLoading: boolean = false;
  2229. accompanyPostData = null;
  2230. accompanyYuyue;
  2231. accompanyType = "";
  2232. accompany(postData, yuyue, type) {
  2233. this.accompanyModal = true;
  2234. this.accompanyPostData = postData;
  2235. this.accompanyYuyue = yuyue;
  2236. this.accompanyType = type;
  2237. }
  2238. confirmAccompany() {
  2239. this.accompanyPostData.workOrder.isAccompany = 1;
  2240. this.accompanyLoading = true;
  2241. if (this.accompanyType == "patient") {
  2242. //患者列表直接建单
  2243. this.newOrderTimeFun(this.accompanyPostData.workOrder, () => {
  2244. this.hidePatientOrder();
  2245. this.accompanyModal = false;
  2246. this.accompanyLoading = false;
  2247. }, () => {
  2248. this.mainService
  2249. .postCustom(
  2250. "api",
  2251. this.accompanyYuyue ? "appointmentOrder" : "startOrder",
  2252. this.accompanyPostData
  2253. )
  2254. .subscribe((data) => {
  2255. this.message.remove(this.jdFlagId);
  2256. this.hidePatientOrder();
  2257. this.accompanyModal = false;
  2258. this.accompanyLoading = false;
  2259. if (data.status == 200) {
  2260. if(this.currentDept.typeValue == 'recovery'){
  2261. this.mainService.postCustom("api", "clearPatientRecoveryDept", {patientCode: this.accompanyPostData.workOrder.patient.patientCode}).subscribe((resultData) => {
  2262. this.showPromptModal("创建", true, "");
  2263. this.goodsLis = [];
  2264. this.getOrderList();
  2265. this.getDeptTaskType();
  2266. this.getTodayNum();
  2267. });
  2268. }else{
  2269. this.showPromptModal("创建", true, "");
  2270. this.goodsLis = [];
  2271. this.getOrderList();
  2272. this.getDeptTaskType();
  2273. this.getTodayNum();
  2274. }
  2275. } else if (data.status == 100042) {
  2276. this.showPromptModal("创建", false, data.msg);
  2277. this.getPatient(this.tabSearchCont);
  2278. } else if (data.status == 1000033) {
  2279. //重复建单那策略
  2280. this.repeatMsg = data.msg;
  2281. this.showDelModal(
  2282. this.accompanyPostData,
  2283. "accompany1",
  2284. this.accompanyYuyue
  2285. );
  2286. } else {
  2287. this.showPromptModal("创建", false, data.msg);
  2288. }
  2289. });
  2290. })
  2291. } else if (this.accompanyType == "patient-yy") {
  2292. //患者列表预约建单
  2293. this.newOrderTimeFun(this.accompanyPostData.workOrder, () => {
  2294. this.btnLoading3 = false;
  2295. this.accompanyModal = false;
  2296. this.accompanyLoading = false;
  2297. this.cancel();
  2298. }, () => {
  2299. this.mainService
  2300. .postCustom(
  2301. "api",
  2302. this.accompanyYuyue ? "appointmentOrder" : "startOrder",
  2303. this.accompanyPostData
  2304. )
  2305. .subscribe((data) => {
  2306. this.message.remove(this.jdFlagId);
  2307. this.btnLoading3 = false;
  2308. this.accompanyModal = false;
  2309. this.accompanyLoading = false;
  2310. this.cancel();
  2311. if (data.status == 200) {
  2312. if(this.currentDept.typeValue == 'recovery'){
  2313. this.mainService.postCustom("api", "clearPatientRecoveryDept", {patientCode: this.accompanyPostData.workOrder.patient.patientCode}).subscribe((resultData) => {
  2314. this.showPromptModal("创建", true, "");
  2315. this.goodsLis = [];
  2316. this.getOrderList();
  2317. this.getDeptTaskType();
  2318. this.getTodayNum();
  2319. });
  2320. }else{
  2321. this.showPromptModal("创建", true, "");
  2322. this.goodsLis = [];
  2323. this.getOrderList();
  2324. this.getDeptTaskType();
  2325. this.getTodayNum();
  2326. }
  2327. } else if (data.status == 100042) {
  2328. this.showPromptModal("创建", false, data.msg);
  2329. this.getPatient(this.tabSearchCont);
  2330. } else if (data.status == 1000033) {
  2331. //重复建单那策略
  2332. this.repeatMsg = data.msg;
  2333. this.showDelModal(
  2334. this.accompanyPostData,
  2335. "accompany2",
  2336. this.accompanyYuyue
  2337. );
  2338. } else {
  2339. this.showPromptModal("创建", false, data.msg);
  2340. }
  2341. });
  2342. })
  2343. }
  2344. }
  2345. hideAccompanyModal(e) {
  2346. console.log(e);
  2347. if (e === "x") {
  2348. //关闭
  2349. this.accompanyModal = false;
  2350. return;
  2351. }
  2352. this.accompanyPostData.workOrder.isAccompany = 0;
  2353. this.cancenlLoading = true;
  2354. if (this.accompanyType == "patient") {
  2355. //患者列表直接建单
  2356. this.newOrderTimeFun(this.accompanyPostData.workOrder, () => {
  2357. this.hidePatientOrder();
  2358. this.accompanyModal = false;
  2359. this.cancenlLoading = false;
  2360. }, () => {
  2361. this.mainService
  2362. .postCustom(
  2363. "api",
  2364. this.accompanyYuyue ? "appointmentOrder" : "startOrder",
  2365. this.accompanyPostData
  2366. )
  2367. .subscribe((data) => {
  2368. this.message.remove(this.jdFlagId);
  2369. this.hidePatientOrder();
  2370. this.accompanyModal = false;
  2371. this.cancenlLoading = false;
  2372. if (data.status == 200) {
  2373. if(this.currentDept.typeValue == 'recovery'){
  2374. this.mainService.postCustom("api", "clearPatientRecoveryDept", {patientCode: this.accompanyPostData.workOrder.patient.patientCode}).subscribe((resultData) => {
  2375. this.showPromptModal("创建", true, "");
  2376. this.goodsLis = [];
  2377. this.getOrderList();
  2378. this.getDeptTaskType();
  2379. this.getTodayNum();
  2380. });
  2381. }else{
  2382. this.showPromptModal("创建", true, "");
  2383. this.goodsLis = [];
  2384. this.getOrderList();
  2385. this.getDeptTaskType();
  2386. this.getTodayNum();
  2387. }
  2388. } else if (data.status == 100042) {
  2389. this.showPromptModal("创建", false, data.msg);
  2390. this.getPatient(this.tabSearchCont);
  2391. } else if (data.status == 1000033) {
  2392. //重复建单那策略
  2393. this.repeatMsg = data.msg;
  2394. this.showDelModal(
  2395. this.accompanyPostData,
  2396. "accompany3",
  2397. this.accompanyYuyue
  2398. );
  2399. } else {
  2400. this.showPromptModal("创建", false, data.msg);
  2401. }
  2402. });
  2403. })
  2404. } else if (this.accompanyType == "patient-yy") {
  2405. //患者列表预约建单
  2406. this.newOrderTimeFun(this.accompanyPostData.workOrder, () => {
  2407. this.btnLoading3 = false;
  2408. this.accompanyModal = false;
  2409. this.cancenlLoading = false;
  2410. this.cancel();
  2411. }, () => {
  2412. this.mainService
  2413. .postCustom(
  2414. "api",
  2415. this.accompanyYuyue ? "appointmentOrder" : "startOrder",
  2416. this.accompanyPostData
  2417. )
  2418. .subscribe((data) => {
  2419. this.message.remove(this.jdFlagId);
  2420. this.btnLoading3 = false;
  2421. this.accompanyModal = false;
  2422. this.cancenlLoading = false;
  2423. this.cancel();
  2424. if (data.status == 200) {
  2425. if(this.currentDept.typeValue == 'recovery'){
  2426. this.mainService.postCustom("api", "clearPatientRecoveryDept", {patientCode: this.accompanyPostData.workOrder.patient.patientCode}).subscribe((resultData) => {
  2427. this.showPromptModal("创建", true, "");
  2428. this.goodsLis = [];
  2429. this.getOrderList();
  2430. this.getDeptTaskType();
  2431. this.getTodayNum();
  2432. });
  2433. }else{
  2434. this.showPromptModal("创建", true, "");
  2435. this.goodsLis = [];
  2436. this.getOrderList();
  2437. this.getDeptTaskType();
  2438. this.getTodayNum();
  2439. }
  2440. } else if (data.status == 100042) {
  2441. this.showPromptModal("创建", false, data.msg);
  2442. this.getPatient(this.tabSearchCont);
  2443. } else if (data.status == 1000033) {
  2444. //重复建单那策略
  2445. this.repeatMsg = data.msg;
  2446. this.showDelModal(
  2447. this.accompanyPostData,
  2448. "accompany4",
  2449. this.accompanyYuyue
  2450. );
  2451. } else {
  2452. this.showPromptModal("创建", false, data.msg);
  2453. }
  2454. });
  2455. })
  2456. }
  2457. }
  2458. // 切换患者送检检查项目
  2459. checkedShowMsg: any = {}; //患者送检检查项目对应展示信息
  2460. current_allowUrgent = false; //当前任务类型是否允许加急
  2461. currentTasktype; //当前选中的任务类型对象
  2462. cLoading = false;
  2463. historyCustomRemarks2 = [];
  2464. changeCheckedType() {
  2465. this.workOrderRemark2 = "";
  2466. this.customRemarks2 = [];
  2467. this.historyCustomRemarks2 = [];
  2468. this.isYyInspect = false;
  2469. this.linkCheckLisTrue = false;
  2470. this.clickYYFlag = false;
  2471. this.clickYYZyFlag = false;
  2472. this.currentTasktype = this.checkTypeLis.find(
  2473. (item) => item.id == this.patientForm.controls.checkedType.value
  2474. );
  2475. // 获取患者其他服务,护士端是否预约建单
  2476. let appointmentZyBuildFlag = this.checkTypeLis.filter(
  2477. (item) =>
  2478. item.id == this.patientForm.controls.checkedType.value &&
  2479. item.associationType.value == "patientTransport"
  2480. );
  2481. if (appointmentZyBuildFlag.length) {
  2482. this.appointmentZyBuildFlag =
  2483. appointmentZyBuildFlag[0].appointmentOtherSwitch == 1 ? "1" : "0";
  2484. console.log(this.appointmentZyBuildFlag, "seimin");
  2485. this.yyDateZy = new Date();
  2486. this.yyTimeZy = new Date();
  2487. let end = this.getLgNumber(this.yyTimeZy.getMinutes(), this.inspectAndPatientTransportConfig.timeMod);
  2488. this.yyTimeZy.setMinutes(end);
  2489. if(end === 0){
  2490. this.yyTimeZy.setHours(this.yyTimeZy.getHours() + 1);
  2491. }
  2492. } else {
  2493. this.appointmentBuildFlag =
  2494. this.currentTasktype.appointmentSwitch == 1 ? "1" : "0";
  2495. console.log(this.appointmentBuildFlag, "seimin");
  2496. }
  2497. console.log(this.patientForm.controls.checkedType.value, this.checkTypeLis);
  2498. this.current_allowUrgent =
  2499. this.checkTypeLis.find(
  2500. (item) => item.id == this.patientForm.controls.checkedType.value
  2501. ).allowUrgent == 1
  2502. ? true
  2503. : false;
  2504. // 判断这个任务类型是否允许加急 start
  2505. // 判断这个任务类型是否允许加急 end
  2506. let that = this;
  2507. let postData = {
  2508. taskTypeId: that.patientForm.controls.checkedType.value,
  2509. patientCode: that.patientMsg.patientCode,
  2510. };
  2511. this.cLoading = true;
  2512. that.mainService
  2513. .postCustom("nurse", "workOrder/buildTrip", postData)
  2514. .subscribe((data) => {
  2515. this.cLoading = false;
  2516. this.message.remove(this.maskFlag);
  2517. this.maskFlag = false;
  2518. this.patientModal = true;
  2519. that.checkedShowMsg = data;
  2520. if (that.checkedShowMsg.status != 200) {
  2521. that.isRemand = data.isRemand == 1 ? true : false;
  2522. }
  2523. that.goodsLis = [];
  2524. that.allowUrgent = "0"; //加急
  2525. that.urgentReason = ""; //加急原因
  2526. if (data.goods && data.goods.length) {
  2527. data.goods.forEach((e) => {
  2528. that.goodsLis.push({
  2529. label: e.name,
  2530. value: e["id"],
  2531. checked: false,
  2532. });
  2533. });
  2534. }
  2535. // 工单备注配置 start
  2536. that.isRemarks = data.remarksSwitch == 1;
  2537. if (data.remarksSwitch == 1) {
  2538. if (data.customRemarks === null || data.customRemarks === "") {
  2539. that.customRemarks2 = [];
  2540. } else {
  2541. that.customRemarks2 = data.customRemarks.split("$");
  2542. }
  2543. that.workOrderRemarkTips2 =
  2544. data.remarksPrompts || "请填写工单备注,不超过100个字符";
  2545. // let user = JSON.parse(localStorage.getItem("user"));
  2546. // that.mainService
  2547. // .postCustom("nurse", "workOrder/recentRemarks", {
  2548. // deptId: user.user.dept.id,
  2549. // taskTypeId: that.patientForm.controls.checkedType.value,
  2550. // })
  2551. // .subscribe((result) => {
  2552. // if (result.state == 200) {
  2553. // that.historyCustomRemarks2 = result.data;
  2554. // }
  2555. // });
  2556. }
  2557. // 工单备注配置 end
  2558. that.linkCheckLis = [];
  2559. if (data.status == 200 && data.data && data.data.length) {
  2560. let arr = [];
  2561. data.data.forEach((e) => {
  2562. arr.push({
  2563. execDeptId: e.execDept.id,
  2564. yyTime: e.yyTime,
  2565. priority: e.priority,
  2566. label:
  2567. (e.yyTime || "") +
  2568. " " +
  2569. (this.deptDisplay == 2
  2570. ? e.execDept.deptalias
  2571. : e.execDept.dept) +
  2572. " 进行 " +
  2573. (e.inspectName || "检查"),
  2574. value: e["id"],
  2575. checked: false,
  2576. });
  2577. });
  2578. that.linkCheckLis = arr;
  2579. }
  2580. });
  2581. }
  2582. // 需要预约建单-事件
  2583. yyInspectChange(e) {
  2584. if (this.currentTasktype.associationType.value === "inspect") {
  2585. //陪检
  2586. let obj = this.filterLinkCheckLis.find((item) => {
  2587. return (
  2588. parse(item.yyTime, 'yyyy-MM-dd HH:mm:ss', new Date()).getTime() - new Date().getTime() >
  2589. this.leadTime * 60 * 1000
  2590. );
  2591. });
  2592. if (obj) {
  2593. this.showDateTime();
  2594. } else {
  2595. this.yyTime = null;
  2596. this.yyDate = new Date();
  2597. console.log(this.isYyInspect);
  2598. }
  2599. } else {
  2600. //转运
  2601. this.yyTimeZy = null;
  2602. this.yyDateZy = new Date();
  2603. }
  2604. }
  2605. //回显时间日期
  2606. showDateTime() {
  2607. //当前时间要大于生效时间
  2608. let isYyInspect = this.filterLinkCheckLis.every((item) => {
  2609. return (
  2610. parse(item.yyTime, 'yyyy-MM-dd HH:mm:ss', new Date()).getTime() - new Date().getTime() >
  2611. this.leadTime * 60 * 1000
  2612. );
  2613. });
  2614. //如果勾选需要预约检查
  2615. if (isYyInspect) {
  2616. //筛选离当前时间最近的
  2617. let timeList = this.filterLinkCheckLis
  2618. .map((item) => parse(item.yyTime, 'yyyy-MM-dd HH:mm:ss', new Date()).getTime())
  2619. .sort();
  2620. this.yyTime = new Date(timeList[0] - this.leadTime * 60 * 1000); //回显预约时间,需要减去生效时间
  2621. this.yyDate = new Date(timeList[0] - this.leadTime * 60 * 1000); //回显预约日期,需要减去生效时间
  2622. this.yyDateChange(this.yyTime);
  2623. } else {
  2624. this.yyTime = null;
  2625. this.yyDate = null;
  2626. }
  2627. }
  2628. // 患者送检检查项目-选择检查项目
  2629. linkCheckLisTrue = false; //是否有已选择(患者)
  2630. isInspectPriority = false; //选择的检查是否紧急(患者)
  2631. filterLinkCheckLis = []; //有预约时间并且选中的
  2632. isInspects = false; //勾选检车的时候是否多个检查多个检查科室
  2633. linkCheckLisChange(e) {
  2634. let flag = false; //检查是否紧急
  2635. let arr = []; //选中的索引
  2636. // 是否检查生成工单允许多个科室,1是,0否
  2637. if (this.currentTasktype.isMoreDept === 0) {
  2638. let arr = e.map((item) => item.execDeptId);
  2639. arr = Array.from(new Set(arr));
  2640. this.isInspects = arr.length > 1;
  2641. }
  2642. this.linkCheckLis.forEach((item, index) => {
  2643. if (e.length) {
  2644. //有选中的检查
  2645. e.forEach((v) => {
  2646. //检查是否有紧急度
  2647. if (v.priority == 1) {
  2648. flag = true;
  2649. }
  2650. //选中的检查设置checked
  2651. if (v.value == item.value) {
  2652. arr.push(index);
  2653. }
  2654. });
  2655. } else {
  2656. item.checked = false;
  2657. }
  2658. });
  2659. this.linkCheckLis.forEach((item, index) => {
  2660. item.checked = arr.includes(index);
  2661. });
  2662. console.log(e, this.linkCheckLis);
  2663. //检查有紧急度,则加急
  2664. if (flag) {
  2665. this.allowUrgent = "1";
  2666. this.urgentReason = "系统根据检查信息,自动进行加急";
  2667. } else {
  2668. this.allowUrgent = "0";
  2669. this.urgentReason = "";
  2670. }
  2671. this.clickYYFlag = false;
  2672. // 有预约时间并且选中的
  2673. this.filterLinkCheckLis = this.linkCheckLis.filter(
  2674. (item) => Boolean(item.yyTime) && item.checked
  2675. );
  2676. //有预约时间并且选中的检查数组不为空,并且预约建单的开关开启
  2677. if (this.filterLinkCheckLis.length && this.appointmentBuildFlag == "1") {
  2678. //当前时间要大于生效时间
  2679. this.isYyInspect = this.filterLinkCheckLis.every((item) => {
  2680. return (
  2681. parse(item.yyTime, 'yyyy-MM-dd HH:mm:ss', new Date()).getTime() - new Date().getTime() >
  2682. this.leadTime * 60 * 1000
  2683. );
  2684. });
  2685. this.allowUrgentChange(this.allowUrgent);
  2686. if (this.allowUrgent == 0) {
  2687. //不加急状态下,回显时间
  2688. this.showDateTime();
  2689. }
  2690. } else {
  2691. //有预约时间并且选中的检查数组为空
  2692. this.isYyInspect = false;
  2693. this.yyTime = null;
  2694. this.yyDate = null;
  2695. }
  2696. this.linkCheckLisTrue = e.length > 0;
  2697. this.isInspectPriority = e.some((item) => item.priority == 1);
  2698. }
  2699. // 是否加急
  2700. allowUrgentChange(e) {
  2701. // this.urgentReasonValidator = (control: FormControl): { [s: string]: boolean } => {
  2702. // if (e == 1) {
  2703. // return { required: true };
  2704. // }
  2705. // };
  2706. if (e == 0) {
  2707. this.patientForm.get("urgentReason")!.clearValidators();
  2708. this.patientForm.get("urgentReason")!.markAsPristine();
  2709. } else {
  2710. this.patientForm.get("urgentReason")!.setValidators(Validators.required);
  2711. this.patientForm.get("urgentReason")!.markAsDirty();
  2712. }
  2713. this.patientForm.get("urgentReason")!.updateValueAndValidity();
  2714. if (this.isYyInspect) {
  2715. this.isYyInspect = e == 0;
  2716. if (!this.isYyInspect) {
  2717. this.yyDate = null;
  2718. this.yyDateZy = null;
  2719. this.yyTime = null;
  2720. this.yyTimeZy = null;
  2721. }
  2722. } else {
  2723. this.yyDate = null;
  2724. this.yyDateZy = null;
  2725. this.yyTime = null;
  2726. this.yyTimeZy = null;
  2727. }
  2728. }
  2729. // 禁用小时
  2730. disabledHours = (): number[] => {
  2731. let now = new Date();
  2732. let nHour = now.getHours();
  2733. let nMinute = now.getMinutes();
  2734. if (nMinute > (60 - this.inspectAndPatientTransportConfig.timeMod)) {
  2735. return range(0, nHour + 1);
  2736. } else {
  2737. return range(0, nHour);
  2738. }
  2739. }
  2740. // 禁用分钟
  2741. disabledMinutes = (hour: number): number[] => {
  2742. let now = new Date();
  2743. let nHour = now.getHours();
  2744. let nMinute = now.getMinutes();
  2745. if (hour === nHour || hour === undefined) {
  2746. return this.integralDivision(0, nMinute, this.inspectAndPatientTransportConfig.timeMod);
  2747. } else {
  2748. return [];
  2749. }
  2750. }
  2751. // start和end之间能被n整除的所有数字集合
  2752. integralDivision(start:number, end:number, n:number): number[]{
  2753. let arr = [];
  2754. for(let i = start; i <= end; i++){
  2755. if(i % n === 0){
  2756. arr.push(i);
  2757. }
  2758. }
  2759. return arr;
  2760. }
  2761. // 快捷一键发起建单
  2762. shortcutMsg; //一键发起信息
  2763. buildMsg: any = {}; //一键发起返回信息
  2764. buildType: string = ""; //快捷建单类型
  2765. historyCustomRemarks = []; //历史快捷输入
  2766. // 打开一键发起建单模态框
  2767. newShortcutOrder(msg, type) {
  2768. this.workOrderRemark = "";
  2769. this.customRemarks = [];
  2770. this.historyCustomRemarks = [];
  2771. console.log(msg, type);
  2772. this.buildType = type;
  2773. this.shortcutMsg = msg;
  2774. this.initForm();
  2775. this.buildMsg = {};
  2776. let postData = {
  2777. taskTypeId: msg.id,
  2778. };
  2779. this.nLoading = true;
  2780. this.mainService
  2781. .postCustom("nurse", "workOrder/buildTrip", postData)
  2782. .subscribe((result) => {
  2783. this.buildMsg = result;
  2784. if (result.remarksSwitch == 1) {
  2785. if (result.customRemarks === null || result.customRemarks === "") {
  2786. this.customRemarks = [];
  2787. } else {
  2788. this.customRemarks = result.customRemarks.split("$");
  2789. }
  2790. this.workOrderRemarkTips =
  2791. result.remarksPrompts || "请填写工单备注,不超过100个字符";
  2792. let user = JSON.parse(localStorage.getItem("user"));
  2793. this.mainService
  2794. .postCustom("nurse", "workOrder/recentRemarks", {
  2795. deptId: user.user.dept.id,
  2796. taskTypeId: msg.id,
  2797. })
  2798. .subscribe((result1) => {
  2799. this.nLoading = false;
  2800. if (result1.state == 200) {
  2801. this.historyCustomRemarks = result1.data;
  2802. }
  2803. });
  2804. } else {
  2805. this.nLoading = false;
  2806. }
  2807. });
  2808. }
  2809. shortcutForm: FormGroup; //一键发起建单表单
  2810. bxForm: FormGroup; //报修表单
  2811. // 一键建单校验
  2812. // 起点科室校验
  2813. originOfficeShortCutValidator = (
  2814. control: FormControl
  2815. ): { [s: string]: boolean } => {
  2816. if (
  2817. this.shortcutForm &&
  2818. this.shortcutForm.value &&
  2819. !control.value &&
  2820. (this.buildMsg.status == 100013 || this.buildMsg.status == 100015)
  2821. ) {
  2822. return { required: true };
  2823. }
  2824. };
  2825. // 目标科室校验
  2826. targetOfficeShortCutValidator = (
  2827. control: FormControl
  2828. ): { [s: string]: boolean } => {
  2829. if (
  2830. this.shortcutForm &&
  2831. this.shortcutForm.value &&
  2832. !control.value &&
  2833. (this.buildMsg.status == 100014 || this.buildMsg.status == 100015)
  2834. ) {
  2835. return { required: true };
  2836. }
  2837. };
  2838. // 修改工号
  2839. userAccount = null;
  2840. changeAccount(e){
  2841. this.userAccount =this.accountList.find(v => v.id == e);
  2842. }
  2843. // 查看关联业务
  2844. otherBindConfigDto:any = {};
  2845. relationTransModalShow = false; //关联业务弹窗开关
  2846. // 关闭关联业务弹窗
  2847. closeModelRelationTrans(e) {
  2848. this.relationTransModalShow = JSON.parse(e).show;
  2849. }
  2850. // 确定关联业务弹窗
  2851. confirmModelRelationTrans(e) {
  2852. if(JSON.parse(e).otherList.length){
  2853. this.otherDataConfirm(e);
  2854. }else{
  2855. this.message.info('请选择病历!');
  2856. }
  2857. }
  2858. // 一键发起建单保存
  2859. loading5 = false;
  2860. async confirmShortcut() {
  2861. var that = this;
  2862. for (const i in that.shortcutForm.controls) {
  2863. that.shortcutForm.controls[i].markAsDirty();
  2864. that.shortcutForm.controls[i].updateValueAndValidity();
  2865. }
  2866. console.log(that.shortcutForm);
  2867. if (that.shortcutForm.invalid) return;
  2868. that.loading5 = true;
  2869. that.buildType = "other";
  2870. if(this.buildMsg.reserveUserSwitch == 1 && !this.userAccount){
  2871. this.message.info('请选择工号!');
  2872. this.loading5 = false;
  2873. return;
  2874. }
  2875. // 判断改任务类型是否开启关联数据
  2876. let taskTypeDtoPromise = await this.mainService.getFetchDataList('simple/data', 'otherBindConfig', {"idx":0,"sum":10,"otherBindConfig":{"hosId":1}}).toPromise();
  2877. console.log(taskTypeDtoPromise);
  2878. console.log(that.shortcutMsg);
  2879. let otherBindConfigDto = taskTypeDtoPromise.list.find(v => v.taskTypeId == that.shortcutMsg.id);
  2880. if(taskTypeDtoPromise.status == 200 && otherBindConfigDto && otherBindConfigDto.startAlert == 1 && that.shortcutMsg.bindTrans == 1){
  2881. this.otherBindConfigDto = otherBindConfigDto;
  2882. this.relationTransModalShow = true;
  2883. that.loading5 = false;
  2884. return;
  2885. }
  2886. this.otherBuildOrder();
  2887. }
  2888. otherBuildOrder(otherList?){
  2889. var that = this;
  2890. // 其他
  2891. let workOrderRemark = '';
  2892. if(otherList){
  2893. workOrderRemark = this.userAccount ? `${this.userAccount.account}-${this.userAccount.name}:${this.workOrderRemark}${otherList.length}本${this.otherBindConfigDto.relationTrans.name}` : this.workOrderRemark + `${otherList.length}本${this.otherBindConfigDto.relationTrans.name}`;
  2894. }else{
  2895. workOrderRemark = this.userAccount ? `${this.userAccount.account}-${this.userAccount.name}:${this.workOrderRemark}` : this.workOrderRemark;
  2896. }
  2897. let postData = {
  2898. workOrder: {
  2899. sourceId: SourceId.hushi,
  2900. workOrderRemark,
  2901. taskType: { id: that.shortcutMsg.id },
  2902. createDept: that.loginUserDeptId,
  2903. startDept: { id: that.buildMsg.startDept },
  2904. endDepts: [{ id: that.buildMsg.endDept }],
  2905. otherList: otherList || undefined,
  2906. },
  2907. };
  2908. if (
  2909. (that.buildMsg.status == 100013 || that.buildMsg.status == 100015) &&
  2910. that.shortcutForm.value.originOffice
  2911. ) {
  2912. postData.workOrder.startDept.id = that.shortcutForm.value.originOffice;
  2913. }
  2914. if (that.shortcutForm.value.targetOffice) {
  2915. postData.workOrder["endDepts"] = [
  2916. { id: that.shortcutForm.value.targetOffice },
  2917. ];
  2918. } else {
  2919. postData.workOrder["endDepts"] = [
  2920. { id: that.buildMsg.end.end.list[0].id },
  2921. ];
  2922. }
  2923. console.log(postData);
  2924. this.newOrderTimeFun(postData.workOrder, () => {
  2925. that.loading5 = false;
  2926. }, () => {
  2927. that.mainService
  2928. .postCustom("api", this.shortcutMsg.reserveSwitch == 1 && this.currentDept.typeValue != 'recovery' && this.currentDept.typeValue != 'surgery' ? "reserveOrder" :"startOrder", postData)
  2929. .subscribe((data) => {
  2930. this.message.remove(this.jdFlagId);
  2931. that.loading5 = false;
  2932. if (data.status == 200 && that.buildType == "other") {
  2933. that.showPromptModal("创建", true, "", "other");
  2934. this.getTodayNum();
  2935. } else if (data.status == 200 && that.buildType == "bb") {
  2936. that.showPromptModal("创建", true, "", "bb");
  2937. this.getTodayNum();
  2938. } else if (that.buildType == "bb" && data.status == 100043) {
  2939. that.showPromptModal("创建", true, data.msg);
  2940. this.getTodayNum();
  2941. } else if (data.status == 1000033) {
  2942. //重复建单那策略
  2943. this.repeatMsg = data.msg;
  2944. this.showDelModal(postData, "other");
  2945. } else {
  2946. that.showPromptModal("创建", false, data.msg);
  2947. }
  2948. });
  2949. })
  2950. }
  2951. // ======================start===============================
  2952. // 快捷一键发起建单
  2953. shortcutModal: boolean = false; //检查信息一键建单模态框
  2954. shortcutMsg1; //一键发起信息
  2955. buildMsg1: any = {}; //一键发起返回信息
  2956. urgentFlag = false;
  2957. bLoading = false; //收取标本的loading
  2958. // 打开一键发起建单模态框,urgent为true的时候是紧急
  2959. historyCustomRemarks1 = [];
  2960. newShortcutOrder1(msg, type, urgent?) {
  2961. this.btnLoading = false;
  2962. this.workOrderRemark1 = "";
  2963. this.customRemarks1 = [];
  2964. this.historyCustomRemarks1 = [];
  2965. console.log(msg, type);
  2966. this.urgentFlag = Boolean(urgent);
  2967. this.buildType = type;
  2968. this.shortcutMsg1 = msg;
  2969. this.initForm();
  2970. this.buildMsg1 = {};
  2971. let postData = {
  2972. taskTypeId: msg.id,
  2973. deptId: JSON.parse(localStorage.getItem("user")).user.dept.id,
  2974. };
  2975. this.bLoading = true;
  2976. this.mainService
  2977. .postCustom("nurse", "workOrder/buildTrip", postData)
  2978. .subscribe((result) => {
  2979. this.shortcutModal = true;
  2980. this.buildMsg1 = result;
  2981. if (result.remarksSwitch == 1) {
  2982. if (result.customRemarks === null || result.customRemarks === "") {
  2983. this.customRemarks1 = [];
  2984. } else {
  2985. this.customRemarks1 = result.customRemarks.split("$");
  2986. }
  2987. this.workOrderRemarkTips1 =
  2988. result.remarksPrompts || "请填写工单备注,不超过100个字符";
  2989. let user = JSON.parse(localStorage.getItem("user"));
  2990. this.mainService
  2991. .postCustom("nurse", "workOrder/recentRemarks", {
  2992. deptId: user.user.dept.id,
  2993. taskTypeId: msg.id,
  2994. })
  2995. .subscribe((result1) => {
  2996. this.bLoading = false;
  2997. if (result1.state == 200) {
  2998. this.historyCustomRemarks1 = result1.data;
  2999. }
  3000. });
  3001. } else {
  3002. this.bLoading = false;
  3003. }
  3004. });
  3005. }
  3006. hideShortcutOrder() {
  3007. this.shortcutModal = false;
  3008. }
  3009. shortcutForm1: FormGroup; //一键发起建单表单
  3010. // 一键建单校验
  3011. // 起点科室校验
  3012. originOfficeShortCutValidator1 = (
  3013. control: FormControl
  3014. ): { [s: string]: boolean } => {
  3015. if (
  3016. this.shortcutForm1 &&
  3017. this.shortcutForm1.value &&
  3018. !control.value &&
  3019. (this.buildMsg1.status == 100013 || this.buildMsg1.status == 100015)
  3020. ) {
  3021. return { required: true };
  3022. }
  3023. };
  3024. // 目标科室校验
  3025. targetOfficeShortCutValidator1 = (
  3026. control: FormControl
  3027. ): { [s: string]: boolean } => {
  3028. if (
  3029. this.shortcutForm1 &&
  3030. this.shortcutForm1.value &&
  3031. !control.value &&
  3032. (this.buildMsg1.status == 100014 || this.buildMsg1.status == 100015)
  3033. ) {
  3034. return { required: true };
  3035. }
  3036. };
  3037. // 建单判断时间-护士端建单通用方法
  3038. isShowConfirm:boolean = true;
  3039. isShowConfirmInfo:string = '';
  3040. newOrderTimeFun(order, fun1, fun2){
  3041. if(this.currentDept.typeValue != 'recovery' && this.currentDept.typeValue != 'surgery'){
  3042. let taskTypeId = order.taskType.id;
  3043. let deptId = order.createDept;
  3044. let maskFlag = this.message.loading("正在加载中..", {
  3045. nzDuration: 0,
  3046. }).messageId;
  3047. this.mainService
  3048. .postCustom("api", "compareWorkTime", {taskTypeId, deptId})
  3049. .subscribe((data) => {
  3050. this.message.remove(maskFlag);
  3051. if(data.state == 200){
  3052. fun2.call(this);
  3053. }else{
  3054. fun1.call(this);
  3055. this.limitTimeModal = true;
  3056. this.limitTimeItem = {taskTypeId, fun1, fun2};
  3057. this.limitTimeInfo = data.data.remark;
  3058. this.isShowConfirm = data.data.limitType == 1;
  3059. if(this.isShowConfirm){
  3060. this.isShowConfirmInfo = '';
  3061. }else{
  3062. this.isShowConfirmInfo = '请在规定时间内下单';
  3063. }
  3064. }
  3065. })
  3066. }else{
  3067. fun2.call(this);
  3068. }
  3069. }
  3070. limitTimeModal: boolean = false; //模态框
  3071. limitTimeInfo:string = '';
  3072. limitTimeItem: any = {};
  3073. hideLimitTimeModal() {
  3074. this.limitTimeModal = false;
  3075. }
  3076. // 确认
  3077. jdFlagId;
  3078. limitTimeLoading:boolean = false;
  3079. confirmLimitTime() {
  3080. console.log(this.limitTimeItem);
  3081. this.limitTimeModal = false;
  3082. this.jdFlagId = this.message.loading("正在加载中..", {
  3083. nzDuration: 0,
  3084. }).messageId;
  3085. this.limitTimeItem.fun2.call(this);
  3086. }
  3087. // 一键发起建单保存
  3088. confirmShortcut1() {
  3089. var that = this;
  3090. for (const i in that.shortcutForm1.controls) {
  3091. that.shortcutForm1.controls[i].markAsDirty();
  3092. that.shortcutForm1.controls[i].updateValueAndValidity();
  3093. }
  3094. console.log(that.shortcutForm1);
  3095. if (that.shortcutForm1.invalid) return;
  3096. that.btnLoading = true;
  3097. let postData;
  3098. if (that.buildType == "bb") {
  3099. // 标本
  3100. postData = {
  3101. urgent: this.urgentFlag ? 1 : 0,
  3102. workOrder: {
  3103. sourceId: SourceId.hushi,
  3104. workOrderRemark: this.workOrderRemark1,
  3105. taskType: { id: that.shortcutMsg1.id },
  3106. createDept: that.loginUserDeptId,
  3107. startDept: { id: that.loginUserDeptId },
  3108. },
  3109. };
  3110. }
  3111. console.log(postData);
  3112. this.newOrderTimeFun(postData.workOrder, () => {
  3113. this.hideShortcutOrder();
  3114. }, () => {
  3115. that.mainService
  3116. .postCustom("api", "startOrder", postData)
  3117. .subscribe((data) => {
  3118. this.message.remove(this.jdFlagId);
  3119. this.hideShortcutOrder();
  3120. console.log(that.buildType, data.status);
  3121. if (data.status == 200 && that.buildType == "other") {
  3122. that.showPromptModal("创建", true, "", "other");
  3123. this.getTodayNum();
  3124. } else if (data.status == 200 && that.buildType == "bb") {
  3125. that.showPromptModal("创建", true, "", "bb");
  3126. this.getTodayNum();
  3127. } else if (that.buildType == "bb" && data.status == 100043) {
  3128. that.showPromptModal("创建", true, data.msg);
  3129. this.getOrderList();
  3130. this.getSpecimenWorkOrderMsg();
  3131. this.getTodayNum();
  3132. } else if (data.status == 1000033) {
  3133. //重复建单那策略
  3134. this.repeatMsg = data.msg;
  3135. this.showDelModal(postData, "specimen");
  3136. } else {
  3137. that.showPromptModal("创建", false, data.msg);
  3138. }
  3139. });
  3140. });
  3141. }
  3142. repeatModal: boolean = false; //删除模态框
  3143. repeatMsg = "";
  3144. loadingRepeat = false;
  3145. repeatPostData;
  3146. sourceType;
  3147. isYuyue;
  3148. showDelModal(postData, sourceType, yuyue?) {
  3149. this.repeatModal = true;
  3150. this.repeatPostData = postData;
  3151. this.sourceType = sourceType;
  3152. this.isYuyue = yuyue ? yuyue : false;
  3153. }
  3154. hideRepeatModal() {
  3155. this.repeatModal = false;
  3156. this.btnLoading = false;
  3157. }
  3158. confirmRepeat() {
  3159. this.loadingRepeat = true;
  3160. this.repeatPostData.tipsCreateOder = 1;
  3161. this.newOrderTimeFun(this.repeatPostData.workOrder, () => {
  3162. this.loadingRepeat = false;
  3163. this.repeatModal = false;
  3164. }, () => {
  3165. this.mainService
  3166. .postCustom(
  3167. "api",
  3168. this.isYuyue ? "appointmentOrder" : "startOrder",
  3169. this.repeatPostData
  3170. )
  3171. .subscribe((data) => {
  3172. this.message.remove(this.jdFlagId);
  3173. this.loadingRepeat = false;
  3174. this.repeatModal = false;
  3175. if(this.currentDept.typeValue == 'recovery'){
  3176. this.mainService.postCustom("api", "clearPatientRecoveryDept", {patientCode: this.repeatPostData.workOrder.patient.patientCode}).subscribe((resultData) => {
  3177. this.confirmRepeatFun(data);
  3178. });
  3179. }else{
  3180. this.confirmRepeatFun(data);
  3181. }
  3182. });
  3183. })
  3184. }
  3185. confirmRepeatFun(data){
  3186. if (this.sourceType === "specimen") {
  3187. // 标本建单
  3188. if (data.status == 200 && this.buildType == "other") {
  3189. this.showPromptModal("创建", true, "", "other");
  3190. this.getTodayNum();
  3191. } else if (data.status == 200 && this.buildType == "bb") {
  3192. this.showPromptModal("创建", true, "", "bb");
  3193. this.getTodayNum();
  3194. } else if (this.buildType == "bb" && data.status == 100043) {
  3195. this.showPromptModal("创建", true, data.msg);
  3196. this.getOrderList();
  3197. this.getSpecimenWorkOrderMsg();
  3198. this.getTodayNum();
  3199. } else {
  3200. this.showPromptModal("创建", false, data.msg);
  3201. }
  3202. } else if (this.sourceType === "other") {
  3203. // 其他建单
  3204. if (data.status == 200 && this.buildType == "other") {
  3205. this.showPromptModal("创建", true, "", "other");
  3206. this.getTodayNum();
  3207. } else if (data.status == 200 && this.buildType == "bb") {
  3208. this.showPromptModal("创建", true, "", "bb");
  3209. this.getTodayNum();
  3210. } else if (this.buildType == "bb" && data.status == 100043) {
  3211. this.showPromptModal("创建", true, data.msg);
  3212. this.getTodayNum();
  3213. } else {
  3214. this.showPromptModal("创建", false, data.msg);
  3215. }
  3216. } else if (this.sourceType === "transport") {
  3217. // 转运
  3218. if (data.status == 200) {
  3219. this.showPromptModal("创建", true, "");
  3220. this.goodsLis = [];
  3221. this.getOrderList();
  3222. this.getDeptTaskType();
  3223. this.getTodayNum();
  3224. } else if (data.status == 100042) {
  3225. this.showPromptModal("创建", false, data.msg);
  3226. this.getPatient(this.tabSearchCont);
  3227. } else {
  3228. this.showPromptModal("创建", false, data.msg);
  3229. }
  3230. } else if (this.sourceType === "accompany1") {
  3231. // 陪检
  3232. if (data.status == 200) {
  3233. this.showPromptModal("创建", true, "");
  3234. this.goodsLis = [];
  3235. this.getOrderList();
  3236. this.getDeptTaskType();
  3237. this.getTodayNum();
  3238. } else if (data.status == 100042) {
  3239. this.showPromptModal("创建", false, data.msg);
  3240. this.getPatient(this.tabSearchCont);
  3241. } else {
  3242. this.showPromptModal("创建", false, data.msg);
  3243. }
  3244. } else if (this.sourceType === "accompany2") {
  3245. // 陪检
  3246. if (data.status == 200) {
  3247. this.showPromptModal("创建", true, "");
  3248. this.goodsLis = [];
  3249. this.getOrderList();
  3250. this.getDeptTaskType();
  3251. this.getTodayNum();
  3252. } else if (data.status == 100042) {
  3253. this.showPromptModal("创建", false, data.msg);
  3254. this.getPatient(this.tabSearchCont);
  3255. } else {
  3256. this.showPromptModal("创建", false, data.msg);
  3257. }
  3258. } else if (this.sourceType === "accompany3") {
  3259. // 陪检
  3260. if (data.status == 200) {
  3261. this.showPromptModal("创建", true, "");
  3262. this.goodsLis = [];
  3263. this.getOrderList();
  3264. this.getDeptTaskType();
  3265. this.getTodayNum();
  3266. } else if (data.status == 100042) {
  3267. this.showPromptModal("创建", false, data.msg);
  3268. this.getPatient(this.tabSearchCont);
  3269. } else {
  3270. this.showPromptModal("创建", false, data.msg);
  3271. }
  3272. } else if (this.sourceType === "accompany4") {
  3273. // 陪检
  3274. if (data.status == 200) {
  3275. this.showPromptModal("创建", true, "");
  3276. this.goodsLis = [];
  3277. this.getOrderList();
  3278. this.getDeptTaskType();
  3279. this.getTodayNum();
  3280. } else if (data.status == 100042) {
  3281. this.showPromptModal("创建", false, data.msg);
  3282. this.getPatient(this.tabSearchCont);
  3283. } else {
  3284. this.showPromptModal("创建", false, data.msg);
  3285. }
  3286. } else if (this.sourceType === "accompany5") {
  3287. // 陪检
  3288. if (data.status == 200) {
  3289. this.showPromptModal("创建", true, "");
  3290. this.goodsLis = [];
  3291. this.getOrderList();
  3292. this.getDeptTaskType();
  3293. this.getTodayNum();
  3294. } else if (data.status == 100042) {
  3295. this.showPromptModal("创建", false, data.msg);
  3296. this.getPatient(this.tabSearchCont);
  3297. } else {
  3298. this.showPromptModal("创建", false, data.msg);
  3299. }
  3300. }
  3301. }
  3302. // =======================end=================================
  3303. // 页面中间部分tab切换
  3304. checkedTableType: string = "";
  3305. checkTable(type) {
  3306. if(typeof type === 'object'){
  3307. if(type.system){
  3308. this.checkedTableType = 'other';
  3309. }else{
  3310. this.checkedTableType = type.id;
  3311. }
  3312. this.getDeptTaskType('');
  3313. }else{
  3314. this.checkedTableType = type;
  3315. }
  3316. this.positionY = 0;
  3317. this.selectOtherId = null;
  3318. this.otherSearch = '';
  3319. if (type === "surgery") {
  3320. this.getSurgery();
  3321. } else if (type === "historySpecimen") {
  3322. this.getHistorySpecimen();
  3323. } else if (type === "historyDrugsbag") {
  3324. this.getHistoryDrugsbag();
  3325. } else if (type === "bxlb" && this.isShowBx && this.coopBtns.repairList) {
  3326. this.getBxlb();
  3327. this.getIncidentState();
  3328. this.getDegrees();
  3329. } else if (type === "kjbx" && this.isShowBx && this.coopBtns.quickReportForRepair) {
  3330. // this.getQuickBxlb();
  3331. this.getIncidentcategory();
  3332. // 获取报修的区域(所属院区)
  3333. // this.getArea();
  3334. // this.bxForm.controls.name.setValue(this.loginUser.name);
  3335. // this.bxForm.controls.phone.setValue(this.loginUser.phone);
  3336. // this.bxForm.controls.address.setValue(null);
  3337. this.bxForm.controls.content.setValue(null);
  3338. }
  3339. }
  3340. //提交报修
  3341. bxLoading = false;
  3342. submitBxForm() {
  3343. for (const i in this.bxForm.controls) {
  3344. this.bxForm.controls[i].markAsDirty();
  3345. this.bxForm.controls[i].updateValueAndValidity();
  3346. }
  3347. if (this.bxForm.invalid) return;
  3348. // if(!this.selectIncidentId){
  3349. // this.message.error("请选择故障现象!");
  3350. // return;
  3351. // }
  3352. this.bxLoading = true;
  3353. this.mainService.wxbx({}).subscribe((result) => {
  3354. if ((result as any).status == 200) {
  3355. let bxcode = (result as any).data; //生成微信报修号
  3356. let postData = {
  3357. verification: "true",
  3358. incident: {
  3359. branch:this.loginUser.currentHospital.id,
  3360. // contacts: this.loginUser.name,
  3361. deptId:this.loginUser.dept.id,
  3362. // contactsInformation: this.loginUser.phone,
  3363. // address: this.bxForm.controls.address.value,
  3364. // areaId: this.bxForm.controls.hospital.value,
  3365. // contacts: this.bxForm.controls.name.value,
  3366. // contactsInformation: this.bxForm.controls.phone.value,
  3367. description: this.bxForm.controls.content.value,
  3368. categoryId: this.selectIncidentId,
  3369. // placeId: this.bxForm.controls.building.value,
  3370. requester: { account: this.loginUser.account },
  3371. sourceType: "wechatUserIncident",
  3372. fileUrl: "url",
  3373. bxcode,
  3374. },
  3375. loginUser: {
  3376. account: this.loginUser.account,
  3377. id: this.loginUser.id,
  3378. },
  3379. };
  3380. this.mainService.addWxIncident(postData).subscribe((res) => {
  3381. this.bxLoading = false;
  3382. if ((res as any).state == 200) {
  3383. this.showPromptModal("提交", true, "");
  3384. this.checkTable("bxlb");
  3385. } else {
  3386. this.showPromptModal("提交", false, (res as any).msg);
  3387. }
  3388. });
  3389. } else {
  3390. this.bxLoading = false;
  3391. this.showPromptModal("提交", false, "");
  3392. }
  3393. });
  3394. }
  3395. // 意见箱表格数据
  3396. adviceList: any = [];
  3397. advicePageIndex: number = 1; //表格当前页码
  3398. advicePageSize: number = 10; //表格每页展示条数
  3399. adviceListLength: number = 10; //表格总数据量
  3400. adviceSearchInp: string = ""; //意见箱搜索
  3401. adviceLoading = false;
  3402. getAdvice() {
  3403. if(!this.coopBtns.suggestionBox){
  3404. return;
  3405. }
  3406. let that = this;
  3407. let postData = {
  3408. advice: {
  3409. content: that.adviceSearchInp || "",
  3410. creatDepartment: {
  3411. id: that.loginUserDeptId,
  3412. },
  3413. createUser: {
  3414. id: that.loginUser.id,
  3415. },
  3416. },
  3417. idx: that.advicePageIndex - 1 < 0 ? 0 : that.advicePageIndex - 1,
  3418. sum: that.advicePageSize,
  3419. };
  3420. this.adviceLoading = true;
  3421. that.mainService
  3422. .getFetchDataList("adviceCollection", "advice", postData)
  3423. .subscribe((data) => {
  3424. this.adviceLoading = false;
  3425. that.adviceList = data.list || [];
  3426. that.adviceListLength = data.totalNum || 0;
  3427. });
  3428. }
  3429. // 手术排程信息表格数据
  3430. surgeryList: any = [];
  3431. surgeryPageIndex: number = 1; //表格当前页码
  3432. surgeryPageSize: number = 10; //表格每页展示条数
  3433. surgeryListLength: number = 10; //表格总数据量
  3434. surgeryCodeSearchInp: string = ""; //标本编码搜索
  3435. surgeryParentSearchInp: string = ""; //患者信息搜索
  3436. surgeryInfoLoading = false;
  3437. getSurgery(idx?) {
  3438. if (idx) {
  3439. this.surgeryPageIndex = 1;
  3440. }
  3441. let postData = {
  3442. surgery: {
  3443. applyDateStart: format(startOfDay(new Date()), "yyyy-MM-dd HH:mm:ss"),
  3444. applyDateEnd: format(endOfDay(new Date()), "yyyy-MM-dd HH:mm:ss"),
  3445. hosId: this.currentHospital.id,
  3446. surgeryDept: this.loginUserDeptId,
  3447. },
  3448. idx: this.surgeryPageIndex - 1,
  3449. sum: this.surgeryPageSize,
  3450. };
  3451. this.surgeryInfoLoading = true;
  3452. this.mainService
  3453. .getFetchDataList("simple/data", "surgery", postData)
  3454. .subscribe((data) => {
  3455. this.surgeryInfoLoading = false;
  3456. this.surgeryList = data.list || [];
  3457. this.surgeryListLength = data.totalNum || 0;
  3458. });
  3459. }
  3460. // 历史标本查询表格数据
  3461. historySpecimenList: any = [];
  3462. historySpecimenPageIndex: number = 1; //表格当前页码
  3463. historySpecimenPageSize: number = 10; //表格每页展示条数
  3464. historySpecimenListLength: number = 10; //表格总数据量
  3465. historySpecimenCodeSearchInp: string = ""; //标本编码搜索
  3466. historySpecimenParentSearchInp: string = ""; //患者信息搜索
  3467. hsLoading = false;
  3468. getHistorySpecimen(idx?) {
  3469. if (idx) {
  3470. this.historySpecimenPageIndex = 1;
  3471. }
  3472. let current = JSON.parse(localStorage.getItem("user"));
  3473. let postData = {
  3474. specimen: {
  3475. hosId: this.currentHospital.id,
  3476. sickRoom: {
  3477. id: current.user.dept.id,
  3478. },
  3479. scode:
  3480. this.historySpecimenCodeSearchInp === ""
  3481. ? null
  3482. : this.historySpecimenCodeSearchInp,
  3483. keyWord:
  3484. this.historySpecimenParentSearchInp === ""
  3485. ? null
  3486. : this.historySpecimenParentSearchInp,
  3487. },
  3488. idx: this.historySpecimenPageIndex - 1,
  3489. sum: this.historySpecimenPageSize,
  3490. };
  3491. this.hsLoading = true;
  3492. this.mainService
  3493. .getFetchDataList("simple/data", "specimen", postData)
  3494. .subscribe((data) => {
  3495. this.hsLoading = false;
  3496. this.historySpecimenList = data.list || [];
  3497. this.historySpecimenListLength = data.totalNum || 0;
  3498. });
  3499. }
  3500. // 历史药单查询表格数据
  3501. historyDrugsbagList: any = [];
  3502. historyDrugsbagPageIndex: number = 1; //表格当前页码
  3503. historyDrugsbagPageSize: number = 10; //表格每页展示条数
  3504. historyDrugsbagListLength: number = 10; //表格总数据量
  3505. historyDrugsbagCodeSearchInp: string = ""; //发药单号搜索
  3506. // historyDrugsbagParentSearchInp: string = ""; //患者信息搜索
  3507. hsDLoading = false;
  3508. getHistoryDrugsbag(idx?) {
  3509. if (idx) {
  3510. this.historyDrugsbagPageIndex = 1;
  3511. }
  3512. let current = JSON.parse(localStorage.getItem("user"));
  3513. let postData = {
  3514. drugsBag: {
  3515. target: {
  3516. id: current.user.dept.id,
  3517. },
  3518. packid:
  3519. this.historyDrugsbagCodeSearchInp === ""
  3520. ? ""
  3521. : this.historyDrugsbagCodeSearchInp,
  3522. platform: 2,
  3523. },
  3524. idx: this.historyDrugsbagPageIndex - 1,
  3525. sum: this.historyDrugsbagPageSize,
  3526. };
  3527. this.hsDLoading = true;
  3528. this.mainService
  3529. .getFetchDataList("api", "drugsBag", postData)
  3530. .subscribe((data) => {
  3531. this.hsDLoading = false;
  3532. this.historyDrugsbagList = data.list || [];
  3533. this.historyDrugsbagListLength = data.totalNum || 0;
  3534. });
  3535. }
  3536. // 报修列表查询表格数据
  3537. bxlbList: any = [];
  3538. bxlbPageIndex: number = 1; //表格当前页码
  3539. bxlbPageSize: number = 10; //表格每页展示条数
  3540. bxlbListLength: number = 10; //表格总数据量
  3541. bxlbCodeSearchInp: string = ""; //标本编码搜索
  3542. bxlbParentSearchInp: string = ""; //患者信息搜索
  3543. processing: number = 0; //处理中的数量
  3544. bxlbLoading = false;
  3545. getBxlb(idx?) {
  3546. if (idx) {
  3547. this.bxlbPageIndex = 1;
  3548. }
  3549. let current = JSON.parse(localStorage.getItem("user"));
  3550. this.bxlbLoading = true;
  3551. this.mainService
  3552. .listWxIncident({
  3553. deptId: current.user.dept.id,
  3554. // assignee: current.user.account,
  3555. state: this.incidentStateId?parseInt(this.incidentStateId):undefined,
  3556. idx: this.bxlbPageIndex - 1,
  3557. sum: this.bxlbPageSize,
  3558. })
  3559. .subscribe((data: any) => {
  3560. this.bxlbLoading = false;
  3561. this.bxlbList = data.data || [];
  3562. this.bxlbListLength = data.resultCount || 0;
  3563. this.processing = data.resultCount || 0;
  3564. });
  3565. }
  3566. //快速报修列表
  3567. quickBxlbLoading = false;
  3568. quickBxlbList = [];
  3569. getQuickBxlb() {
  3570. this.quickBxlbLoading = true;
  3571. this.mainService
  3572. .fetchListBx("incidentCategoryContent", { idx: 0, sum: 10 })
  3573. .subscribe((data: any) => {
  3574. this.quickBxlbLoading = false;
  3575. if (data.status == 200) {
  3576. this.quickBxlbList = data.list || [];
  3577. }
  3578. });
  3579. }
  3580. // 意见箱-查看模态框
  3581. adviceModal: boolean = false;
  3582. adviceDetailInfo: any = {}; //意见详情
  3583. adviceDetail(id) {
  3584. this.adviceModal = true;
  3585. this.mainService
  3586. .getFetchData("adviceCollection", "advice", id)
  3587. .subscribe((data) => {
  3588. this.adviceDetailInfo = data.data;
  3589. console.log(this.adviceDetailInfo);
  3590. });
  3591. }
  3592. hideAdvice() {
  3593. this.adviceModal = false;
  3594. }
  3595. // 意见收集
  3596. adviceSubModal: boolean = false;
  3597. adviceSubContent: string; //填写意见内容
  3598. coopAdviceInfo: any = {}; //当前编辑意见详情
  3599. addAdvice(data?) {
  3600. let that = this;
  3601. that.adviceSubContent = "";
  3602. if (data) {
  3603. that.coopAdviceInfo = data;
  3604. that.adviceSubContent = data.content;
  3605. }
  3606. that.adviceSubModal = true;
  3607. }
  3608. hideSubAdvice() {
  3609. this.adviceSubModal = false;
  3610. }
  3611. // 提交意见内容
  3612. confirmSubAdvice() {
  3613. let that = this;
  3614. if (!that.adviceSubContent) return;
  3615. that.btnLoading = true;
  3616. let postData = {
  3617. advice: {
  3618. creatDepartment: {
  3619. id: that.loginUserDeptId,
  3620. },
  3621. createUser: {
  3622. id: that.loginUser.id,
  3623. },
  3624. content: that.adviceSubContent,
  3625. },
  3626. };
  3627. if (that.coopAdviceInfo.id) {
  3628. postData.advice["id"] = that.coopAdviceInfo.id;
  3629. }
  3630. that.mainService
  3631. .postCustom(
  3632. "adviceCollection",
  3633. that.coopAdviceInfo.id ? "updData/advice" : "addData/advice",
  3634. postData
  3635. )
  3636. .subscribe((data) => {
  3637. if (data.status == 200) {
  3638. that.adviceSubModal = false;
  3639. that.showPromptModal(
  3640. that.coopAdviceInfo.id ? "编辑" : "新增",
  3641. true,
  3642. ""
  3643. );
  3644. that.coopAdviceInfo = {};
  3645. that.adviceSubContent = "";
  3646. that.getAdvice();
  3647. } else {
  3648. that.adviceSubModal = false;
  3649. that.showPromptModal(
  3650. that.coopAdviceInfo.id ? "编辑" : "新增",
  3651. false,
  3652. data.msg
  3653. );
  3654. that.adviceSubContent = "";
  3655. }
  3656. });
  3657. }
  3658. // 查看标本详情
  3659. detailModel: boolean = false;
  3660. loading33: boolean = false;
  3661. detailList: any = [];
  3662. // 选择急查或普查(1是急标,2是普标)
  3663. changeSpeDetail(speDetailType: number) {
  3664. this.detailModel = true;
  3665. let user = JSON.parse(localStorage.getItem("user"));
  3666. let postData = {
  3667. deptId: user.user.dept.id,
  3668. urgent: speDetailType,
  3669. };
  3670. this.loading33 = true;
  3671. this.mainService
  3672. .postCustom("nurse", "getSpecimenWorkOrderDetails", postData)
  3673. .subscribe((result) => {
  3674. this.loading33 = false;
  3675. if (result.status == 200) {
  3676. this.detailList = result.data || [];
  3677. }
  3678. });
  3679. }
  3680. // 隐藏查看标本详情弹层
  3681. hideSpeDetailModel() {
  3682. this.detailModel = false;
  3683. }
  3684. // 意见删除模态框
  3685. delAdviceModal: boolean = false;
  3686. delAdviceId: number; //删除意见id
  3687. delAdvice(id) {
  3688. this.delAdviceId = id;
  3689. this.delAdviceModal = true;
  3690. }
  3691. confirmDelAdvice() {
  3692. let that = this;
  3693. that.btnLoading = true;
  3694. let postData = [that.delAdviceId];
  3695. that.mainService
  3696. .postCustom("adviceCollection", "rmvData/advice", postData)
  3697. .subscribe((data) => {
  3698. if (data.status == 200) {
  3699. that.delAdviceModal = false;
  3700. that.showPromptModal("删除", true, "");
  3701. if (
  3702. that.adviceList.length == 1 &&
  3703. that.advicePageIndex ==
  3704. Math.ceil(that.adviceListLength / that.advicePageSize)
  3705. ) {
  3706. that.adviceListLength--;
  3707. that.advicePageIndex = Math.ceil(
  3708. that.adviceListLength / that.advicePageSize
  3709. );
  3710. }
  3711. that.getAdvice();
  3712. } else {
  3713. that.delAdviceModal = false;
  3714. that.showPromptModal("删除", false, data.msg);
  3715. }
  3716. });
  3717. }
  3718. hideDelAdviceModal() {
  3719. this.delAdviceModal = false;
  3720. }
  3721. // 工单列表下拉筛选
  3722. selectedType: null;
  3723. changeOrderSel(e) {
  3724. this.selectedType = e;
  3725. this.getOrderList();
  3726. }
  3727. // 工单列表工单状态下拉筛选
  3728. changeOrderState(e) {
  3729. this.getOrderList();
  3730. }
  3731. // 工单列表
  3732. orderList: any = [];
  3733. orderIdx: number = 1;
  3734. orderLength: number = 10;
  3735. OLoading: boolean = true;
  3736. getOrderList() {
  3737. let that = this;
  3738. that.orderList = [];
  3739. that.OLoading = true;
  3740. let postData: any = {
  3741. workOrder: {
  3742. createDept: JSON.parse(localStorage.getItem("user")).user.dept.id,
  3743. platform: 2,
  3744. searchDays: 2,
  3745. taskType: {},
  3746. },
  3747. idx: that.orderIdx - 1,
  3748. sum: 10,
  3749. };
  3750. if (that.selectedType && that.selectedType != -1) {
  3751. postData.workOrder.taskType["associationType"] = {
  3752. id: that.selectedType,
  3753. };
  3754. }
  3755. // 执行中包含状态:待抢单、待接单、待到达、待送达、执行中、定时预约
  3756. if (that.orderStateSelected == "1") {
  3757. //执行中
  3758. delete postData.workOrder.gdState;
  3759. postData.workOrder.nurseState = 1;
  3760. } else if (that.orderStateSelected == "2") {
  3761. //待评价
  3762. delete postData.workOrder.nurseState;
  3763. postData.workOrder.gdState = { id: "73" };
  3764. } else {
  3765. //全部
  3766. delete postData.workOrder.nurseState;
  3767. delete postData.workOrder.gdState;
  3768. }
  3769. that.mainService
  3770. .getFetchDataList("nurse", "workOrder", postData)
  3771. .subscribe((data) => {
  3772. that.orderList = data.list || [];
  3773. //显示三项
  3774. that.orderList.forEach((item) => {
  3775. if (item.record.length > 2) {
  3776. let i = item.record
  3777. .reverse()
  3778. .findIndex((step) => step.record.length > 0);
  3779. item.record.reverse();
  3780. i = item.record.length - 1 - i;
  3781. if (i < 2) {
  3782. item.record = item.record.slice(0, 3);
  3783. } else if (i > item.record.length - 2) {
  3784. item.record = item.record.slice(
  3785. item.record.length - 3,
  3786. item.record.length
  3787. );
  3788. } else {
  3789. item.record = item.record.slice(i - 1, i + 2);
  3790. }
  3791. }
  3792. });
  3793. that.orderLength = data.totalNum || 0;
  3794. that.OLoading = false;
  3795. });
  3796. }
  3797. // 撤销
  3798. coopId: number;
  3799. recallOrderModal: boolean = false;
  3800. // 打开撤销模态框
  3801. openRecallModal(id) {
  3802. this.coopId = id;
  3803. this.recallOrderModal = true;
  3804. }
  3805. // 确认撤销
  3806. confirmRec() {
  3807. let that = this;
  3808. that.btnLoading = true;
  3809. that.mainService.delOrder(that.coopId).subscribe((data) => {
  3810. that.closeRecallOrderModal();
  3811. if (data.status == 200) {
  3812. that.getOrderList();
  3813. that.changeInfo();
  3814. this.getTodayNum();
  3815. that.showPromptModal("撤销", true, "");
  3816. } else {
  3817. that.showPromptModal("撤销", false, data.msg);
  3818. }
  3819. });
  3820. }
  3821. // 关闭撤销模态框
  3822. closeRecallOrderModal() {
  3823. this.recallOrderModal = false;
  3824. }
  3825. // 评价
  3826. appraiseModal: boolean = false;
  3827. starNum: number = 5; //评价星
  3828. appraiseContent: string = ""; //评级
  3829. appraiseId: number;
  3830. showAppraise(id) {
  3831. this.appraiseId = id;
  3832. this.appraiseModal = true;
  3833. this.starNum = 5;
  3834. this.appraiseContent = "";
  3835. }
  3836. // 保存评价
  3837. confirmAppraise() {
  3838. console.log(this.starNum, this.appraiseContent);
  3839. let that = this;
  3840. if (!that.starNum) return;
  3841. that.btnLoading = true;
  3842. let id;
  3843. switch (that.starNum) {
  3844. case 1:
  3845. id = 358;
  3846. break;
  3847. case 2:
  3848. id = 357;
  3849. break;
  3850. case 3:
  3851. id = 356;
  3852. break;
  3853. case 4:
  3854. id = 355;
  3855. break;
  3856. case 5:
  3857. id = 354;
  3858. break;
  3859. }
  3860. let postData = {
  3861. serviceEvaluation: { id: id },
  3862. remark: that.appraiseContent,
  3863. };
  3864. this.mainService
  3865. .postCustom("nurse/workOrder", "evaluate/" + this.appraiseId, postData)
  3866. .subscribe((data) => {
  3867. that.hideAppraise();
  3868. if (data.status == 200) {
  3869. that.getOrderList();
  3870. that.showPromptModal("评价", true, "");
  3871. } else {
  3872. that.showPromptModal("评价", false, data.msg);
  3873. }
  3874. });
  3875. }
  3876. hideAppraise() {
  3877. this.appraiseModal = false;
  3878. }
  3879. // 报修评价
  3880. appraiseModalBx: boolean = false;
  3881. starNumBx: number = 5; //评价星
  3882. appraiseContentBx: string = ""; //评级
  3883. appraiseIdBx: number;
  3884. showAppraiseBx(id) {
  3885. this.appraiseIdBx = id;
  3886. this.appraiseModalBx = true;
  3887. this.starNumBx = 5;
  3888. this.appraiseContentBx = "";
  3889. }
  3890. // 保存评价
  3891. confirmAppraiseBx() {
  3892. console.log(this.starNumBx, this.appraiseContentBx);
  3893. if (!this.starNumBx) return;
  3894. this.btnLoading = true;
  3895. let id = this.degrees.find(v=>v.value == this.starNumBx).id;
  3896. let postData = {
  3897. degree: id,
  3898. degreeRemark: this.appraiseContentBx,
  3899. id: this.appraiseIdBx,
  3900. };
  3901. this.mainService
  3902. .degree(postData)
  3903. .subscribe((data:any) => {
  3904. this.hideAppraiseBx();
  3905. if (data.state == 200) {
  3906. this.getBxlb();
  3907. this.showPromptModal("评价", true, "");
  3908. } else {
  3909. this.showPromptModal("评价", false, "");
  3910. }
  3911. });
  3912. }
  3913. hideAppraiseBx() {
  3914. this.appraiseModalBx = false;
  3915. }
  3916. // 审核状态
  3917. checkStatusLis: any = [];
  3918. getCheckStatusLis() {
  3919. let that = this;
  3920. that.mainService.getDictionary("list", "check_status").subscribe((data) => {
  3921. that.checkStatusLis = data;
  3922. });
  3923. }
  3924. // 填写加急原因模态框
  3925. jiajiModal: boolean = false;
  3926. jiajiContent: string; //加急原因
  3927. jiajiId; //加急工单id
  3928. showJiaji(id) {
  3929. this.jiajiId = id;
  3930. this.jiajiModal = true;
  3931. this.jiajiContent = "";
  3932. }
  3933. hideJiaji() {
  3934. this.jiajiModal = false;
  3935. }
  3936. // 保存加急原因
  3937. confirmJiaji() {
  3938. let that = this;
  3939. let checkStatusId;
  3940. if (!that.jiajiContent) return;
  3941. that.btnLoading = true;
  3942. that.checkStatusLis.forEach((e) => {
  3943. if (e.value == 1) {
  3944. checkStatusId = e.id;
  3945. }
  3946. });
  3947. let postData = {
  3948. urgentDetails: {
  3949. workerOrder: that.jiajiId,
  3950. checkStatus: { id: checkStatusId },
  3951. urgentReason: that.jiajiContent,
  3952. },
  3953. };
  3954. that.mainService
  3955. .postCustom("workerOrder", "urge", postData)
  3956. .subscribe((data) => {
  3957. if (data.status == 200) {
  3958. that.showPromptModal("加急", true, "");
  3959. that.getOrderList();
  3960. that.hideJiaji();
  3961. } else {
  3962. that.showPromptModal("加急", false, data.msg);
  3963. }
  3964. });
  3965. }
  3966. // 查看工单详情
  3967. openDetails(data) {
  3968. if (data.taskType.associationType.value == 'specimen' || data.taskType.associationType.value == 'specimenPlan') {
  3969. // 标本类
  3970. this.router.navigateByUrl("nurse/detailSample/" + data.id);
  3971. } else if (data.taskType.associationType.value == 'inspect' || data.taskType.associationType.value == 'patientTransport') {
  3972. // 送患者
  3973. this.router.navigateByUrl("nurse/detailPatients/" + data.id);
  3974. } else if (data.taskType.associationType.value == 'drugsBag' || data.taskType.associationType.value == 'jPBag') {
  3975. // 药品配送/静配
  3976. this.router.navigateByUrl("nurse/detailDrug/" + data.id);
  3977. } else if (data.taskType.associationType.value == 'ordinary') {
  3978. // 万能交接服务
  3979. this.router.navigateByUrl("nurse/detailOrdinary/" + data.id);
  3980. } else {
  3981. // 其他
  3982. this.router.navigateByUrl("nurse/detailOthers/" + data.id);
  3983. }
  3984. }
  3985. // 展示信息提示框(con:提示信息,success:操作是否成功,promptInfo:操作结果提示信息)
  3986. showPromptModal(con, success, promptInfo?, back?) {
  3987. this.btnLoading = false;
  3988. this.btnLoading1 = false;
  3989. this.promptModalShow = false;
  3990. this.promptContent = con;
  3991. this.ifSuccess = success;
  3992. this.promptInfo = promptInfo;
  3993. this.back = back;
  3994. setTimeout(() => {
  3995. this.promptModalShow = true;
  3996. }, 100);
  3997. }
  3998. // 回到系统管理
  3999. toMain() {
  4000. this.router.navigateByUrl("main");
  4001. }
  4002. // 查看工单
  4003. toOrder() {
  4004. this.router.navigateByUrl(`main/orderManagement`);
  4005. }
  4006. // 退出
  4007. logOut(): void {
  4008. let that = this;
  4009. // 假退出
  4010. localStorage.removeItem("user");
  4011. localStorage.removeItem("menu");
  4012. localStorage.removeItem("phones");
  4013. localStorage.removeItem("index");
  4014. that.router.navigateByUrl("login");
  4015. // 假退出
  4016. that.mainService.logOut().subscribe((data) => {
  4017. if (data.status == 200) {
  4018. localStorage.removeItem("user");
  4019. localStorage.removeItem("menu");
  4020. localStorage.removeItem("phones");
  4021. localStorage.removeItem("index");
  4022. that.router.navigateByUrl("login");
  4023. }
  4024. });
  4025. }
  4026. // 格式化时分秒
  4027. // (时间小于一分钟则显示秒,时间大于一分钟则显示分钟数,如超出一小时则显示小时和分钟。)time单位:秒
  4028. formatTime(time) {
  4029. let timeStr = "";
  4030. if (time >= 0 && time < 60) {
  4031. // 秒
  4032. timeStr = time + "秒";
  4033. } else if (time >= 60 && time < 3600) {
  4034. // 分钟
  4035. timeStr = Math.floor(time / 60) + "分钟";
  4036. } else if (time >= 3600) {
  4037. // 时 + 分
  4038. let h = "";
  4039. let m = "";
  4040. h = Math.floor(time / 3600) + "小时";
  4041. m = time % 3600 >= 60 ? Math.floor((time % 3600) / 60) + "分钟" : "";
  4042. timeStr = h + m;
  4043. }
  4044. return timeStr;
  4045. }
  4046. // 计算历史记录耗时
  4047. filterTime(step) {
  4048. let num = 0;
  4049. step.forEach((e) => {
  4050. num += e.difTime;
  4051. });
  4052. return this.formatTime(num / 1000);
  4053. }
  4054. // 截取意见内容(ie内核截取)
  4055. spliceContent(con) {
  4056. if (con.length >= 41 && navigator.userAgent.indexOf("Trident") > -1) {
  4057. return con.slice(0, 41) + "...";
  4058. } else {
  4059. return con;
  4060. }
  4061. }
  4062. @ViewChild("msgTemplate", { static: false }) msgTemplate: TemplateRef<any>; //消息通知模板
  4063. // 消息提醒
  4064. createBasicNotification(msgs): void {
  4065. this.notification.template(this.msgTemplate, {
  4066. nzDuration: 0,
  4067. nzData: msgs,
  4068. });
  4069. }
  4070. isShowNurseCode = false; //是否展开科室二维码
  4071. nurseCodeImg = ""; //图片
  4072. refreshQRCodeTime = 0; //刷新时间间隔
  4073. // 关闭科室二维码
  4074. closeNurseCode() {
  4075. this.isShowNurseCode = false;
  4076. clearInterval(this.timer);
  4077. this.timer = null;
  4078. }
  4079. // 展开科室二维码
  4080. timer = null;
  4081. showNurseCode() {
  4082. this.isShowNurseCode = true;
  4083. this.mainService.getDeptCode([this.loginUserDeptId]).subscribe((data) => {
  4084. if (data["status"] == 200) {
  4085. this.nurseCodeImg = data["data"][0].base64;
  4086. this.refreshQRCodeTime = data["data"][0].refreshQRCodeTime;
  4087. clearInterval(this.timer);
  4088. this.timer = setInterval(() => {
  4089. this.refreshQRCodeTime = Math.max(--this.refreshQRCodeTime, 0);
  4090. if (this.refreshQRCodeTime === 0) {
  4091. clearInterval(this.timer);
  4092. this.showNurseCode();
  4093. }
  4094. }, 1000);
  4095. }
  4096. });
  4097. }
  4098. // 右侧菜单
  4099. showLastItems: boolean = false;
  4100. // 下拉
  4101. fixedMenuXiala() {
  4102. this.showLastItems = true;
  4103. }
  4104. // 上拉
  4105. fixedMenuShangla() {
  4106. this.showLastItems = false;
  4107. }
  4108. mainRole: boolean = false; //回到系统管理权限
  4109. mainRoleBtnName = "回到系统管理"; //回到系统管理名字
  4110. initRole() {
  4111. let menus = JSON.parse(localStorage.getItem("menu"));
  4112. console.log("菜单数量" + menus.length);
  4113. if (menus.length >= 2) {
  4114. this.mainRole = true;
  4115. return;
  4116. }
  4117. }
  4118. // 切换右侧菜单Tab
  4119. fixedTab: string = "";
  4120. checkFixedTab(type: string) {
  4121. if (type == "toSystem") {
  4122. this.router.navigateByUrl("main");
  4123. }
  4124. if (this.fixedTab == type) {
  4125. this.fixedTab = "";
  4126. } else {
  4127. this.fixedTab = type;
  4128. }
  4129. }
  4130. //子传父接收
  4131. closeModelHs(e) {
  4132. this.hsPromptModalShow = JSON.parse(e).show;
  4133. this.changeShow = JSON.parse(e).changeShow;
  4134. }
  4135. //子传父接收
  4136. clearModelHs(e) {
  4137. if (JSON.parse(e).clear === true) {
  4138. clearInterval(this.timerCloseTime);
  4139. }
  4140. this.changeShow = JSON.parse(e).changeShow;
  4141. }
  4142. // 头部切换科室
  4143. changeKsNow() {
  4144. this.hsPromptModalShow = true;
  4145. clearInterval(this.timerCloseTime);
  4146. this.changeShow = false;
  4147. }
  4148. // 刷新工单列表
  4149. refreshList(e) {
  4150. if (!e.promptContent) {
  4151. return;
  4152. }
  4153. this.getOrderList();
  4154. }
  4155. }