hushijiandan.component.ts 116 KB

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