hushijiandan.component.ts 158 KB

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