hushijiandan.component.ts 148 KB

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