hushijiandan.component.ts 153 KB

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