hushijiandan.component.ts 104 KB

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