hushijiandan.component.ts 71 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389
  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 { WebsocketService } from "../../services/websocket.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. } from "date-fns";
  32. // 日期禁用
  33. function range(start: number, end: number): number[] {
  34. const result: number[] = [];
  35. for (let i = start; i < end; i++) {
  36. result.push(i);
  37. }
  38. return result;
  39. }
  40. @Component({
  41. selector: "app-hushijiandan",
  42. templateUrl: "./hushijiandan.component.html",
  43. styleUrls: ["./hushijiandan.component.less"],
  44. })
  45. export class HushijiandanComponent implements OnInit {
  46. @ViewChild("remarksEle", { static: false }) remarksEle: ElementRef;
  47. @ViewChild("osComponentRef1", {
  48. read: OverlayScrollbarsComponent,
  49. static: false,
  50. })
  51. osComponentRef1: OverlayScrollbarsComponent;
  52. @ViewChild("osComponentRef2", {
  53. read: OverlayScrollbarsComponent,
  54. static: false,
  55. })
  56. osComponentRef2: OverlayScrollbarsComponent;
  57. @ViewChild("osComponentRef3", {
  58. read: OverlayScrollbarsComponent,
  59. static: false,
  60. })
  61. osComponentRef3: OverlayScrollbarsComponent;
  62. @ViewChild("osComponentRef4", {
  63. read: OverlayScrollbarsComponent,
  64. static: false,
  65. })
  66. osComponentRef4: OverlayScrollbarsComponent;
  67. @ViewChild("osComponentRef6", {
  68. read: OverlayScrollbarsComponent,
  69. static: false,
  70. })
  71. osComponentRef6: OverlayScrollbarsComponent;
  72. @ViewChild("osComponentRef7", {
  73. read: OverlayScrollbarsComponent,
  74. static: false,
  75. })
  76. osComponentRef7: OverlayScrollbarsComponent;
  77. @ViewChild("osComponentRef8", {
  78. read: OverlayScrollbarsComponent,
  79. static: false,
  80. })
  81. osComponentRef8: OverlayScrollbarsComponent;
  82. @ViewChild("osComponentRef9", {
  83. read: OverlayScrollbarsComponent,
  84. static: false,
  85. })
  86. osComponentRef9: OverlayScrollbarsComponent;
  87. othersListOptions: any;
  88. sortableTimer = null;
  89. searchTabInpSubject = new Subject(); //左侧查患者信息和检查信息防抖
  90. otherSearchChangeSubject = new Subject(); //其他建单搜索防抖
  91. isYyInspect = false; //需要预约检查
  92. constructor(
  93. private message: NzMessageService,
  94. private fb: FormBuilder,
  95. public router: Router,
  96. private mainService: MainService,
  97. private msg: NzMessageService,
  98. private notification: NzNotificationService,
  99. private webs: WebsocketService,
  100. private tool: ToolService
  101. ) {
  102. this.othersListOptions = {
  103. onUpdate: (event: any) => {
  104. // 触发一次排序
  105. clearTimeout(this.sortableTimer);
  106. this.sortableTimer = setTimeout(() => {
  107. let postData = {
  108. orders: [],
  109. };
  110. postData.orders = this.othersList.map((item, i) => {
  111. return {
  112. id: item.id,
  113. orders: i,
  114. };
  115. });
  116. this.mainService.sortTaskType(postData).subscribe((result) => {});
  117. }, 500);
  118. },
  119. };
  120. }
  121. // 关闭倒计时
  122. closeTime = 3;
  123. timerCloseTime = null;
  124. changeShow = true;
  125. currentHospital; //当前院区
  126. logTimer = null; //综合日志定时器
  127. logTime = 0; //综合日志自动刷新秒数
  128. logTimeConst = 30; //综合日志自动刷新秒数
  129. ngOnInit() {
  130. //防抖
  131. this.searchTabInpSubject.pipe(debounceTime(500)).subscribe((v) => {
  132. this.getPatient(v);
  133. });
  134. this.otherSearchChangeSubject.pipe(debounceTime(500)).subscribe((v) => {
  135. this.getDeptTaskType(v);
  136. });
  137. this.currentHospital = this.tool.getCurrentHospital();
  138. this.changeKs();
  139. this.initLogin();
  140. this.getDeptTaskType();
  141. this.initForm();
  142. this.getAdvice();
  143. this.getHistorySpecimen();
  144. this.getOrderSelectList();
  145. this.getCheckStatusLis();
  146. this.refreshSpecimenWorkOrderMsg();
  147. this.initRole();
  148. this.getWebsocket();
  149. this.listDeptOrderRecord();
  150. this.logTime = this.logTimeConst;
  151. clearInterval(this.logTimer);
  152. this.logTimer = setInterval(() => {
  153. this.logTime--;
  154. if (this.logTime === 0) {
  155. this.logTime = this.logTimeConst;
  156. this.listDeptOrderRecord();
  157. }
  158. }, 1000);
  159. }
  160. ngOnDestroy() {
  161. console.log("关闭护士端", this.webs.ws);
  162. clearInterval(this.moveId);
  163. clearInterval(this.moveId1);
  164. clearInterval(this.msgTimerId);
  165. clearInterval(this.logTimer);
  166. this.webs.closeWs();
  167. }
  168. loginUser: any = localStorage.getItem("user")
  169. ? JSON.parse(localStorage.getItem("user")).user
  170. : null; //登录人信息
  171. loginUserDeptId: number = JSON.parse(localStorage.getItem("user")).user.dept
  172. .id; //登录人所属科室
  173. appointmentBuildFlag = "0"; //是否开启护士端预约建单-患者陪检
  174. appointmentZyBuildFlag = "0"; //是否开启护士端预约建单-患者其他
  175. leadTime = 0; //护士端预约建单生效时长
  176. followFlag = "0"; //是否开启护士端终点关注
  177. promptContent: string; //操作提示框提示信息
  178. ifSuccess: boolean; //操作成功/失败
  179. promptInfo: string; //操作结果提示信息
  180. back: string; //操作结果后回调标识
  181. promptModalShow: boolean; //操作提示框是否展示
  182. hsPromptModalShow: boolean = true; //护士端科室切换提示框是否展示
  183. deptTaskTypeRules: any = {}; //当前登录科室任务类型信息规则
  184. orderSelectList: any = []; //工单列表筛选选项
  185. orderSelected = "-1"; //工单列表下拉框选中
  186. orderStateSelected = "1"; //工单列表工单状态下拉框选中
  187. tabSearchCont: string = ""; //左侧tab搜索框内容
  188. pLoading: boolean = true; //患者信息loading
  189. patientList: any = []; //左侧tab患者信息list
  190. infoPageIdx: number = 1; //左侧tab页码
  191. infoLength: number = 5; //左侧tab信息总数
  192. specimenWorkOrderMsg: any = {}; //急标普标数量&信息
  193. jpDrugsWKOMsg: any = {}; //药品静配提示信息
  194. btnLoading: boolean = false; //确认按钮loading状态
  195. workOrderRemark = ""; //备注
  196. workOrderRemarkTips = ""; //备注提示
  197. customRemarks = []; //备注快速输入
  198. // 添加备注
  199. addRemarks(item) {
  200. this.remarksEle.nativeElement.focus();
  201. this.workOrderRemark += item;
  202. }
  203. //获取综合日志
  204. rLoading = false;
  205. listDeptOrderRecords: any = [];
  206. listDeptOrderRecord() {
  207. this.rLoading = true;
  208. this.mainService
  209. .listDeptOrderRecord({ deptId: this.loginUserDeptId })
  210. .subscribe((result) => {
  211. this.rLoading = false;
  212. if (result["status"] == 200) {
  213. this.listDeptOrderRecords = result["data"].slice(0, 15);
  214. }
  215. });
  216. }
  217. // 查看标本历史记录
  218. historyPromptModalShow = false; //标本历史记录弹窗开关
  219. scode = ""; //查看历史记录携带
  220. viewSpecimenHistory(data) {
  221. this.scode = data.scode;
  222. this.historyPromptModalShow = true;
  223. }
  224. // 关闭标本历史记录弹窗
  225. closeModelHistory(e) {
  226. this.historyPromptModalShow = JSON.parse(e).show;
  227. }
  228. // 护士端患者信息列表,鼠标移入姓名展示最近一条检查信息
  229. recentInfo = "";
  230. recentInfoTimer = null;
  231. recentInfoNum = 0;
  232. isRemand = true; //自动送回
  233. yyTime = null; //预约时间-患者列表
  234. yyTimeZy = null; //预约时间-患者列表-患者其他服务
  235. yyDate = null; //预约日期-陪检
  236. yyDateZy = null; //预约日期-转运
  237. getRecentInfo(patientCode) {
  238. this.recentInfo = "";
  239. clearTimeout(this.recentInfoTimer);
  240. this.recentInfoTimer = setTimeout(() => {
  241. this.recentInfoNum++;
  242. this.mainService.getRecentInfo({ patientCode }).subscribe((result) => {
  243. this.recentInfoNum--;
  244. if (result["status"] == 200 && this.recentInfoNum === 0) {
  245. this.recentInfo = result["data"]["info"];
  246. } else {
  247. this.recentInfo = "";
  248. }
  249. });
  250. }, 500);
  251. }
  252. // 获取患者陪检任务类型(只有一个)的信息
  253. getTaskTypeByInspection() {
  254. const list = {
  255. idx: 0,
  256. sum: 1,
  257. taskType: {
  258. hosIds: this.currentHospital.id + "",
  259. associationType: {
  260. id: 260,
  261. },
  262. },
  263. };
  264. return this.mainService.getFetchDataList("configuration", "taskType", list);
  265. }
  266. //修改预约建单时间的日期
  267. yyDateChange(e) {
  268. // 获取年月日
  269. let yyDate = new Date(e);
  270. let year = yyDate.getFullYear();
  271. let month = yyDate.getMonth();
  272. let date = yyDate.getDate();
  273. // 获取当前时间的年月日
  274. let now = new Date();
  275. let nYear = now.getFullYear();
  276. let nMonth = now.getMonth();
  277. let nDate = now.getDate();
  278. if (year != nYear || month != nMonth || date != nDate) {
  279. this.disabledHours = () => [];
  280. this.disabledMinutes = (hour) => [];
  281. } else {
  282. // 禁用小时
  283. this.disabledHours = () => {
  284. let now = new Date();
  285. let nHour = now.getHours();
  286. let nMinute = now.getMinutes();
  287. if (nMinute > 30) {
  288. return range(0, nHour + 1);
  289. } else {
  290. return range(0, nHour);
  291. }
  292. };
  293. // 禁用分钟
  294. this.disabledMinutes = (hour) => {
  295. let now = new Date();
  296. let nHour = now.getHours();
  297. let nMinute = now.getMinutes();
  298. if (hour === nHour || hour === undefined) {
  299. if (nMinute == 0) {
  300. return [];
  301. } else if (nMinute <= 30 && nMinute > 0) {
  302. return [0];
  303. } else {
  304. return [0, 30];
  305. }
  306. } else {
  307. return [];
  308. }
  309. };
  310. }
  311. }
  312. // 关闭其他建单保存结果
  313. closeModel(e) {
  314. console.log(e);
  315. if (e === "other") {
  316. this.osComponentRef2.osInstance().scroll({ x: 0, y: this.positionY });
  317. this.getOrderList();
  318. } else if (e === "bb") {
  319. this.getOrderList();
  320. this.getSpecimenWorkOrderMsg();
  321. }
  322. }
  323. // 其他建单
  324. selectOtherId; //选中的id
  325. otherSearch = ""; //搜索的关键词
  326. oLoading = false;
  327. nLoading = false;
  328. positionY = 0; //记录其他建单Y轴滚动距离
  329. otherClick(item) {
  330. this.positionY = this.osComponentRef2.osInstance().scroll().position.y; //内容滚动的距离
  331. this.selectOtherId = item.id;
  332. this.newShortcutOrder(item, "other");
  333. }
  334. //搜索
  335. otherNum = 0;
  336. otherSearchChange() {
  337. this.otherSearchChangeSubject.next(this.otherSearch);
  338. }
  339. // 切换科室
  340. changeKs() {
  341. this.hsPromptModalShow = true;
  342. this.closeTime = 3;
  343. clearInterval(this.timerCloseTime);
  344. this.timerCloseTime = setInterval(() => {
  345. this.closeTime = Math.max(--this.closeTime, -1);
  346. if (this.closeTime === -1) {
  347. this.hsPromptModalShow = false;
  348. clearInterval(this.timerCloseTime);
  349. }
  350. }, 1000);
  351. }
  352. // 判断登录是否已失效
  353. initLogin() {
  354. let that = this;
  355. if (!localStorage.getItem("user")) {
  356. that.msg.error("您的登录已失效,请重新登录!", {
  357. nzDuration: 3000,
  358. });
  359. setTimeout(() => {
  360. that.router.navigateByUrl("login");
  361. }, 2000);
  362. return;
  363. }
  364. }
  365. // 连接websocket
  366. getWebsocket() {
  367. let that = this;
  368. this.webs
  369. .connectWs(http.nurseWs, { userCount: that.loginUser.account })
  370. .subscribe((data) => {
  371. if (data && data.content) {
  372. that.createBasicNotification(data);
  373. }
  374. });
  375. }
  376. // 每隔一分钟刷新标本信息
  377. msgTimerId: any;
  378. refreshSpecimenWorkOrderMsg() {
  379. this.msgTimerId = setInterval(() => {
  380. this.getSpecimenWorkOrderMsg();
  381. }, 60000);
  382. }
  383. // 工单列表筛选
  384. getOrderSelectList() {
  385. let that = this;
  386. that.mainService
  387. .getDictionary("list", "association_types")
  388. .subscribe((data) => {
  389. that.orderSelectList = data || [];
  390. });
  391. }
  392. // 急标普标数量
  393. getSpecimenWorkOrderMsg() {
  394. let that = this;
  395. that.mainService
  396. .postCustom("nurse", "getSpecimenWorkOrderMsg", {
  397. deptId: JSON.parse(localStorage.getItem("user")).user.dept.id,
  398. })
  399. .subscribe((data) => {
  400. that.specimenWorkOrderMsg = data;
  401. });
  402. }
  403. // 药品静配提示信息
  404. drugJpLoading = true;
  405. getJpDrugsWKOMsg() {
  406. let that = this;
  407. that.mainService
  408. .postCustom("nurse", "getJpDrugsWKOMsg", {})
  409. .subscribe((data) => {
  410. this.drugJpLoading = false;
  411. that.jpDrugsWKOMsg = data.data ? data.data : {};
  412. console.log(that.jpDrugsWKOMsg);
  413. if (
  414. that.jpDrugsWKOMsg.drugsInfoList &&
  415. that.jpDrugsWKOMsg.drugsInfoList.length
  416. ) {
  417. that.startSwiper(that.jpDrugsWKOMsg.drugsInfoList.length);
  418. }
  419. if (
  420. that.jpDrugsWKOMsg.jpInfoList &&
  421. that.jpDrugsWKOMsg.jpInfoList.length
  422. ) {
  423. that.startSwiper1(that.jpDrugsWKOMsg.jpInfoList.length);
  424. }
  425. });
  426. }
  427. // swiper 轮播图
  428. swiperTop: number = 0;
  429. moveId: any;
  430. index: number = 0;
  431. startSwiper(length) {
  432. let that = this;
  433. clearInterval(that.moveId);
  434. setInterval(() => {
  435. that.index++;
  436. clearInterval(that.moveId);
  437. that.moveId = setInterval(() => {
  438. if (that.swiperTop > -44 * that.index) {
  439. that.swiperTop--;
  440. }
  441. if (that.swiperTop <= length * -44) {
  442. that.swiperTop = 0;
  443. that.index = 0;
  444. clearInterval(that.moveId);
  445. }
  446. }, 20);
  447. }, 2000);
  448. }
  449. swiperTop1: number = 0;
  450. moveId1: any;
  451. index1: number = 0;
  452. startSwiper1(length) {
  453. let that = this;
  454. clearInterval(that.moveId1);
  455. setInterval(() => {
  456. that.index1++;
  457. clearInterval(that.moveId1);
  458. that.moveId1 = setInterval(() => {
  459. if (that.swiperTop1 > -44 * that.index1) {
  460. that.swiperTop1--;
  461. }
  462. if (that.swiperTop1 <= length * -44) {
  463. that.swiperTop1 = 0;
  464. that.index1 = 0;
  465. clearInterval(that.moveId1);
  466. }
  467. }, 20);
  468. }, 2000);
  469. }
  470. // 关注患者
  471. follow(data) {
  472. this.showCommonModal(
  473. data,
  474. data.focusPatient === 0
  475. ? "您将设置患者【" +
  476. data.patientName +
  477. "】为重点关注,后期此患者的相关检查将会自动建单通知支助中心"
  478. : "您将取消设置患者【" +
  479. data.patientName +
  480. "】为重点关注,后期此患者的相关检查将不会自动建单通知支助中心"
  481. );
  482. }
  483. // 通用提示模态框
  484. commonModal: boolean = false; //模态框
  485. loading4 = false;
  486. tipsMsg1: string; //提示框信息
  487. coop: any; //当前操作列
  488. showCommonModal(data: any, tipsMsg1: string) {
  489. this.commonModal = true;
  490. this.coop = data;
  491. this.tipsMsg1 = tipsMsg1;
  492. }
  493. // 隐藏模态框
  494. hideCommonModal() {
  495. this.commonModal = false;
  496. }
  497. // 确认
  498. confirmCommon() {
  499. this.commonModal = false;
  500. let postData = {
  501. patient: {
  502. id: this.coop.id,
  503. focusPatient: this.coop.focusPatient === 0 ? 1 : 0,
  504. },
  505. };
  506. this.loading4 = true;
  507. this.mainService.changeFollow(postData).subscribe(
  508. (result) => {
  509. this.loading4 = false;
  510. if (result["status"] == 200) {
  511. this.showPromptModal(
  512. result["data"].focusPatient === 0 ? "取消关注" : "关注",
  513. true,
  514. ""
  515. );
  516. this.getPatient(this.tabSearchCont);
  517. } else {
  518. this.showPromptModal(
  519. result["data"].focusPatient === 0 ? "取消关注" : "关注",
  520. false,
  521. ""
  522. );
  523. }
  524. },
  525. (err) => {
  526. this.loading4 = false;
  527. this.showPromptModal("操作", false, "");
  528. }
  529. );
  530. }
  531. // 获取当前登录人科室任务类型信息
  532. othersList: any = []; // 其他一键建单列表
  533. bbMsg: any = {}; //标本一键建单
  534. patientMsgList: any = []; // 患者转运,患者陪检一键建单
  535. tabFlag = true; //页面初始化获取一次患者陪检的任务类型信息
  536. allowUrgentFlag = false; //检查列表的患者陪检类型是否允许加急
  537. getDeptTaskType(search?, clear?) {
  538. let that = this;
  539. this.otherNum++;
  540. this.oLoading = true;
  541. let postData = {
  542. deptId: that.loginUserDeptId,
  543. };
  544. if (search !== undefined) {
  545. postData["taskName"] = search;
  546. }
  547. that.mainService
  548. .postCustom("nurse", "getDeptTaskType", postData)
  549. .subscribe((data) => {
  550. this.otherNum--;
  551. if (this.otherNum === 0) {
  552. this.oLoading = false;
  553. }
  554. if (search === undefined) {
  555. that.deptTaskTypeRules = data.data;
  556. that.getOrderList();
  557. if (that.deptTaskTypeRules.openInspection) {
  558. // 陪检权限
  559. if (this.tabFlag) {
  560. this.tabFlag = false;
  561. this.getTaskTypeByInspection().subscribe((result) => {
  562. console.log(result);
  563. if (result.list && result.list.length > 0) {
  564. this.appointmentBuildFlag =
  565. result.list[0].appointmentSwitch + ""; //是否开启护士端预约建单
  566. this.leadTime = result.list[0].appointmentTime; //是否开启护士端预约建单
  567. this.followFlag = result.list[0].focusSwitch + ""; //是否开启护士端终点关注
  568. this.allowUrgentFlag =
  569. result.list[0].allowUrgent == 1 ? true : false; //是否允许加急(检查列表)
  570. } else {
  571. this.appointmentBuildFlag = "0"; //是否开启护士端预约建单
  572. this.leadTime = 0; //是否开启护士端预约建单
  573. this.followFlag = "0"; //是否开启护士端终点关注
  574. this.allowUrgentFlag = false; //是否允许加急(检查列表)
  575. }
  576. this.pLoading = true;
  577. that.getPatient();
  578. });
  579. } else {
  580. that.getPatient();
  581. }
  582. }
  583. if (that.deptTaskTypeRules.openSpecimen) {
  584. // 标本权限
  585. that.getSpecimenWorkOrderMsg();
  586. }
  587. if (
  588. that.deptTaskTypeRules.openStaticDistribution ||
  589. that.deptTaskTypeRules.openDrugsBag
  590. ) {
  591. // 药品静配权限
  592. that.getJpDrugsWKOMsg();
  593. }
  594. }
  595. if (data.data.allTaskTypes) {
  596. that.othersList = [];
  597. that.patientMsgList = [];
  598. data.data.allTaskTypes.forEach((e) => {
  599. if (e.associationType.id == 259) {
  600. that.othersList.push(e);
  601. } else if (e.associationType.id == 256) {
  602. that.bbMsg = e;
  603. } else if (
  604. e.associationType.id == 255 ||
  605. e.associationType.id == 260
  606. ) {
  607. that.patientMsgList.push(e);
  608. }
  609. });
  610. // if (clear === "clear") {
  611. // this.otherSearch = "";
  612. // this.workOrderRemark = "";
  613. // this.customRemarks = [];
  614. // this.historyCustomRemarks = [];
  615. // let obj = that.othersList.find(
  616. // (item) => item.id == this.selectOtherId
  617. // );
  618. // obj && this.otherClick(obj);
  619. // }
  620. console.log(this.selectOtherId);
  621. if (!this.selectOtherId) {
  622. if (that.othersList.length) {
  623. this.selectOtherId = that.othersList[0].id;
  624. let obj = that.othersList.find(
  625. (item) => item.id == this.selectOtherId
  626. );
  627. obj && this.otherClick(obj);
  628. } else {
  629. this.selectOtherId = null;
  630. }
  631. }
  632. }
  633. });
  634. }
  635. // 目标科室输入搜索
  636. searchDept(type, msg, e) {
  637. this.getDeptList(type, msg, e);
  638. }
  639. // 获取科室
  640. getDeptList(type, msg, key?): void {
  641. // 返回值的status是201 则是默认发起科室
  642. // 返回值的status是202 则是固定科室范围
  643. // 返回值的status是203 则是固定科室
  644. // 返回值的status是204 则是自主填写
  645. // 返回值的status是205 则是固定科室类型
  646. if (
  647. (type == "start" && msg.start.start.departmentStrategy == 202) ||
  648. (type == "target" && msg.end.end.departmentStrategy == 202)
  649. ) {
  650. return; //固定科室范围禁用搜索
  651. }
  652. let postData = {
  653. idx: 0,
  654. sum: 50,
  655. department: {
  656. searchType: 1,
  657. },
  658. };
  659. if (key) {
  660. postData.department["keyWord"] = key;
  661. }
  662. if (type == "start" && msg.start.start.departmentStrategy == 205) {
  663. postData.department["type"] = { id: msg.start.start.startTypeId };
  664. } else if (type == "target" && msg.end.end.departmentStrategy == 205) {
  665. postData.department["type"] = { id: msg.end.end.endTypeId };
  666. }
  667. if (type == "start") {
  668. postData.department["ids"] = msg.start.deptIds || "";
  669. } else if (type == "target") {
  670. postData.department["ids"] = msg.end.deptIds || "";
  671. }
  672. this.mainService
  673. .getFetchDataList("data", "department", postData)
  674. .subscribe((data) => {
  675. if (type == "target") {
  676. msg.end.end.list = data.list;
  677. } else if (type == "start") {
  678. msg.start.start.list = data.list;
  679. }
  680. });
  681. }
  682. // 切换左侧tab
  683. changeInfo() {
  684. if (!this.deptTaskTypeRules.openInspection) return;
  685. this.infoPageIdx = 1;
  686. this.getPatient();
  687. }
  688. // 获取患者信息
  689. snum = 0;
  690. getPatient(e?) {
  691. let that = this;
  692. that.pLoading = true;
  693. let postData = {
  694. idx: that.infoPageIdx - 1,
  695. sum: 9999,
  696. };
  697. // 患者信息
  698. postData["patient"] = {
  699. keyWord: e ? e : that.tabSearchCont,
  700. };
  701. postData["patient"]["department"] = { id: that.loginUserDeptId };
  702. this.snum++;
  703. that.mainService
  704. .getFetchDataList("nurse", "patient", postData)
  705. .subscribe((data) => {
  706. this.snum--;
  707. if (data.list.length > 0) {
  708. data.list.forEach((item) => {
  709. if (item.focusPatient === undefined) {
  710. item.focusPatient = 0;
  711. }
  712. });
  713. }
  714. that.patientList = data.list || [];
  715. if (this.snum === 0) {
  716. that.pLoading = false;
  717. }
  718. that.infoLength = data.totalNum || 0;
  719. });
  720. }
  721. // tab输入搜索节流阀
  722. searchTabInp(e) {
  723. if (!this.deptTaskTypeRules.openInspection) return;
  724. this.searchTabInpSubject.next(e);
  725. }
  726. // 下一日(陪检)
  727. nextDay() {
  728. this.yyDate = addDays(this.yyDate, 1);
  729. this.yyDateChange(this.yyDate);
  730. }
  731. // 下一日(转运)
  732. nextDayZy() {
  733. this.yyDateZy = addDays(this.yyDateZy, 1);
  734. this.yyDateChange(this.yyDateZy);
  735. }
  736. // 禁用日期(陪检)
  737. disabledyyDate = (current: Date): boolean => {
  738. return differenceInCalendarDays(current, new Date()) < 0;
  739. };
  740. // 禁用日期(转运)
  741. disabledyyDateZy = (current: Date): boolean => {
  742. return differenceInCalendarDays(current, new Date()) < 0;
  743. };
  744. // 一键建单确认弹框
  745. confirmSub: boolean = false;
  746. confirmPostData: any = {}; //确认提交数据
  747. confirmYuyue: boolean = false; //确认预约
  748. confirmInfo: string = "";
  749. btnLoading3 = false;
  750. confirm() {
  751. if (this.confirmYuyue) {
  752. this.confirmPostData.workOrder.yyTime =
  753. format(new Date(this.yyTime), "yyyy-MM-dd HH:mm") + ":00";
  754. }
  755. if (!this.confirmYuyue) {
  756. this.confirmPostData.workOrder.platform = 2;
  757. } else {
  758. delete this.confirmPostData.workOrder.platform;
  759. }
  760. //是否需要医护陪同检查
  761. if (this.patientMsg.careLevel && this.currentTasktype.isAccompany == 1) {
  762. //特级护理或一级护理
  763. if (
  764. this.patientMsg.careLevel.value === "0" ||
  765. this.patientMsg.careLevel.value === "1"
  766. ) {
  767. this.btnLoading = false;
  768. this.btnLoading1 = false;
  769. this.accompany(this.confirmPostData, this.confirmYuyue, "patient-yy");
  770. return;
  771. }
  772. }
  773. if (this.patientMsg.illnessState && this.currentTasktype.isAccompany == 1) {
  774. //病危或病重
  775. if (
  776. this.patientMsg.illnessState.value === "2" ||
  777. this.patientMsg.illnessState.value === "3"
  778. ) {
  779. this.btnLoading = false;
  780. this.btnLoading1 = false;
  781. this.accompany(this.confirmPostData, this.confirmYuyue, "patient-yy");
  782. return;
  783. }
  784. }
  785. this.btnLoading3 = true;
  786. this.confirmPostData.workOrder.isAccompany = 0; //是否需要医护陪同检查
  787. this.mainService
  788. .postCustom(
  789. "api",
  790. this.confirmYuyue ? "appointmentOrder" : "startOrder",
  791. this.confirmPostData
  792. )
  793. .subscribe((data) => {
  794. this.btnLoading3 = false;
  795. this.cancel();
  796. if (data.status == 200) {
  797. this.showPromptModal("创建", true, "");
  798. this.goodsLis = [];
  799. this.getOrderList();
  800. this.getDeptTaskType();
  801. } else {
  802. this.showPromptModal("创建", false, data.msg);
  803. }
  804. });
  805. }
  806. cancel() {
  807. this.confirmSub = false;
  808. this.confirmPostData = {};
  809. this.confirmYuyue = false;
  810. this.btnLoading = false;
  811. }
  812. patientForm: FormGroup; //患者信息一键建单表单
  813. //患者送检检查项目
  814. checkTypeLis: any = [];
  815. // 患者信息一键建单关联检查
  816. linkCheckLis: any = [];
  817. goodsLis: any = []; //携带设备
  818. allowUrgent: any = "0"; //加急
  819. urgentReason: any = ""; //加急原因
  820. // 初始化form表单
  821. initForm() {
  822. // 初始化患者信息一键建单表单
  823. this.patientForm = this.fb.group({
  824. checkedType: [null, [Validators.required]],
  825. goods: [null],
  826. linkCheck: [null, []],
  827. targetOffice: [null, [this.targetOfficeValidator]],
  828. originOffice: [null, [this.originOfficeValidator]],
  829. allowUrgent: [null], //加急
  830. urgentReason: [null], //加急原因
  831. });
  832. // 初始化一键发起建单表单
  833. this.shortcutForm = this.fb.group({
  834. targetOffice: [null, [this.targetOfficeShortCutValidator]],
  835. originOffice: [null, [this.originOfficeShortCutValidator]],
  836. });
  837. // 初始化一键发起建单表单
  838. this.shortcutForm1 = this.fb.group({
  839. targetOffice: [null, [this.targetOfficeShortCutValidator1]],
  840. originOffice: [null, [this.originOfficeShortCutValidator1]],
  841. });
  842. }
  843. //创建自定义校验规则dateValidator,用于复选框组校验时调用。
  844. // 起点科室校验
  845. originOfficeValidator = (control: FormControl): { [s: string]: boolean } => {
  846. if (
  847. this.patientForm &&
  848. this.patientForm.value &&
  849. this.checkedShowMsg.status != 200 &&
  850. !control.value &&
  851. (this.checkedShowMsg.status == 100015 ||
  852. this.checkedShowMsg.status == 100013)
  853. ) {
  854. return { required: true };
  855. }
  856. };
  857. // 目标科室校验
  858. targetOfficeValidator = (control: FormControl): { [s: string]: boolean } => {
  859. if (
  860. this.patientForm &&
  861. this.patientForm.value &&
  862. this.checkedShowMsg.status != 200 &&
  863. !control.value &&
  864. (this.checkedShowMsg.status == 100015 ||
  865. this.checkedShowMsg.status == 100014)
  866. ) {
  867. return { required: true };
  868. }
  869. };
  870. // 患者信息一键建单
  871. patientModal: boolean = false; //患者信息一键建单模态框
  872. patientMsg; //患者信息
  873. // 打开患者信息一键建单模态框
  874. maskFlag: any = false;
  875. newPatientOrder(msg) {
  876. this.yyTime = null;
  877. this.yyTimeZy = null;
  878. let that = this;
  879. that.initForm();
  880. that.checkedShowMsg = {};
  881. that.patientMsg = msg;
  882. this.maskFlag = this.message.loading("正在加载中..", {
  883. nzDuration: 0,
  884. }).messageId;
  885. that.mainService
  886. .postCustom("configuration", "deptTSPTaskType", {})
  887. .subscribe((data) => {
  888. that.checkTypeLis = data.data;
  889. // 默认选中患者陪检
  890. that.checkTypeLis.forEach((e) => {
  891. if (e.associationType.value == "inspect") {
  892. that.patientForm.controls.checkedType.setValue(e.id);
  893. that.patientForm.value.checkedType = e.id;
  894. }
  895. });
  896. this.changeCheckedType();
  897. });
  898. }
  899. yyTimeChange(e) {
  900. if (this.yyTime) {
  901. let now = new Date();
  902. // 禁用日期(陪检)
  903. if (getHours(this.yyTime) < getHours(now)) {
  904. this.disabledyyDate = (current: Date): boolean => {
  905. return differenceInCalendarDays(current, new Date()) < 1;
  906. };
  907. } else {
  908. this.disabledyyDate = (current: Date): boolean => {
  909. return differenceInCalendarDays(current, new Date()) < 0;
  910. };
  911. }
  912. if (getMinutes(this.yyTime) > 0 && getMinutes(this.yyTime) < 30) {
  913. this.yyTime = setMinutes(this.yyTime, 30);
  914. } else if (getMinutes(this.yyTime) > 30 && getMinutes(this.yyTime) < 60) {
  915. this.yyTime = setMinutes(this.yyTime, 0);
  916. }
  917. }
  918. this.clickYYFlag = false;
  919. }
  920. yyTimeZyChange(e) {
  921. if (this.yyTimeZy) {
  922. let now = new Date();
  923. // 禁用日期(转运)
  924. if (getHours(this.yyTimeZy) < getHours(now)) {
  925. this.disabledyyDateZy = (current: Date): boolean => {
  926. return differenceInCalendarDays(current, new Date()) < 1;
  927. };
  928. } else {
  929. this.disabledyyDateZy = (current: Date): boolean => {
  930. return differenceInCalendarDays(current, new Date()) < 0;
  931. };
  932. }
  933. if (getMinutes(this.yyTimeZy) > 0 && getMinutes(this.yyTimeZy) < 30) {
  934. this.yyTimeZy = setMinutes(this.yyTimeZy, 30);
  935. } else if (
  936. getMinutes(this.yyTimeZy) > 30 &&
  937. getMinutes(this.yyTimeZy) < 60
  938. ) {
  939. this.yyTimeZy = setMinutes(this.yyTimeZy, 0);
  940. }
  941. }
  942. this.clickYYZyFlag = false;
  943. }
  944. hidePatientOrder() {
  945. this.patientModal = false;
  946. this.clickYYFlag = false;
  947. this.clickYYZyFlag = false;
  948. }
  949. // 预约建单
  950. btnLoading1 = false;
  951. confirmPatient1(type) {
  952. this.confirmPatient(type);
  953. }
  954. // 患者信息保存
  955. clickYYFlag = false; //是否点击预约建单-患者陪检
  956. clickYYZyFlag = false; //是否点击预约建单-患者其他
  957. confirmPatient(yuyue?) {
  958. if (yuyue === "patient-yuyue") {
  959. this.clickYYFlag = true;
  960. } else {
  961. this.clickYYFlag = false;
  962. }
  963. if (yuyue === "patient-zy-yuyue") {
  964. this.clickYYZyFlag = true;
  965. } else {
  966. this.clickYYZyFlag = false;
  967. }
  968. // 选项是患者转运
  969. let flag = this.checkTypeLis.some((item) => {
  970. return (
  971. item.id == this.patientForm.controls.checkedType.value &&
  972. item.associationType.id == 255
  973. );
  974. });
  975. //预约时间-患者陪检不能为空
  976. console.log(this.yyTime, this.yyTimeZy, flag, yuyue);
  977. if (
  978. (!this.yyTime && !flag && yuyue === "patient-yuyue") ||
  979. (!this.yyTimeZy && flag && yuyue === "patient-zy-yuyue")
  980. ) {
  981. return;
  982. }
  983. if (flag) {
  984. //转运
  985. this.yyTimeZy =
  986. format(new Date(this.yyDateZy), "yyyy-MM-dd") +
  987. " " +
  988. format(new Date(this.yyTimeZy), "HH:mm") +
  989. ":00";
  990. } else {
  991. //陪检
  992. this.yyTime =
  993. format(new Date(this.yyDate), "yyyy-MM-dd") +
  994. " " +
  995. format(new Date(this.yyTime), "HH:mm") +
  996. ":00";
  997. }
  998. var that = this;
  999. for (const i in that.patientForm.controls) {
  1000. that.patientForm.controls[i].markAsDirty();
  1001. that.patientForm.controls[i].updateValueAndValidity();
  1002. }
  1003. if (that.patientForm.invalid) {
  1004. return;
  1005. }
  1006. console.log(that.patientForm);
  1007. if (yuyue) {
  1008. this.confirmYuyue = true;
  1009. this.btnLoading1 = true;
  1010. } else {
  1011. this.confirmYuyue = false;
  1012. this.btnLoading = true;
  1013. }
  1014. let postData: any = {
  1015. workOrder: {
  1016. taskType: { id: that.patientForm.controls.checkedType.value },
  1017. startDept: { id: that.checkedShowMsg.startDept },
  1018. endDepts: [{ id: that.checkedShowMsg.endDept }],
  1019. createDept: that.loginUserDeptId,
  1020. patient: {
  1021. patientCode: that.patientMsg.patientCode,
  1022. },
  1023. },
  1024. };
  1025. if (
  1026. (that.checkedShowMsg.status == 100013 ||
  1027. that.checkedShowMsg.status == 100015) &&
  1028. that.patientForm.value.originOffice
  1029. ) {
  1030. postData.workOrder.startDept.id = that.patientForm.value.originOffice;
  1031. }
  1032. if (that.patientForm.value.targetOffice) {
  1033. postData.workOrder["endDepts"] = [
  1034. { id: that.patientForm.value.targetOffice },
  1035. ];
  1036. } else if (flag) {
  1037. postData.workOrder["endDepts"] = [
  1038. { id: that.checkedShowMsg.end.end.list[0].id },
  1039. ];
  1040. }
  1041. let checkedArr = [];
  1042. let yy = false; //是否有预约时间
  1043. if (
  1044. that.patientForm.value.linkCheck &&
  1045. that.patientForm.value.linkCheck.length
  1046. ) {
  1047. that.patientForm.value.linkCheck.forEach((e) => {
  1048. if (e.checked) {
  1049. checkedArr.push({ id: e.value });
  1050. if (e.yyTime) {
  1051. yy = true;
  1052. }
  1053. }
  1054. });
  1055. }
  1056. // 携带设备
  1057. let goods = "";
  1058. if (that.patientForm.value.goods && that.patientForm.value.goods.length) {
  1059. that.patientForm.value.goods.forEach((e) => {
  1060. if (e.checked) {
  1061. goods += e.value + ",";
  1062. }
  1063. });
  1064. goods = goods.slice(0, goods.length - 1);
  1065. }
  1066. postData.workOrder["goods"] = goods;
  1067. if (!yuyue && that.current_allowUrgent && this.allowUrgent == 1) {
  1068. postData.workOrder["urgentDetails"] = {
  1069. checkStatus: { id: 329 },
  1070. urgentReason: that.urgentReason,
  1071. };
  1072. } else {
  1073. delete postData.workOrder["urgentDetails"];
  1074. }
  1075. if (
  1076. yy &&
  1077. that.checkedShowMsg.status == 200 &&
  1078. that.patientForm.value.linkCheck &&
  1079. checkedArr.length
  1080. ) {
  1081. // 有预约时间
  1082. postData.workOrder["checkList"] = checkedArr;
  1083. that.hidePatientOrder();
  1084. that.confirmSub = true;
  1085. that.confirmPostData = postData;
  1086. that.confirmInfo = "您确认建单吗?";
  1087. } else {
  1088. if (!yy && that.checkedShowMsg.status == 200) {
  1089. postData.workOrder["checkList"] = checkedArr;
  1090. // 添加预约时间
  1091. if (yuyue) {
  1092. postData.workOrder.yyTime =
  1093. format(new Date(this.yyTime), "yyyy-MM-dd HH:mm") + ":00";
  1094. }
  1095. } else {
  1096. delete postData.workOrder["checkList"];
  1097. // 添加预约时间
  1098. if (yuyue) {
  1099. postData.workOrder.yyTime =
  1100. format(new Date(this.yyTimeZy), "yyyy-MM-dd HH:mm") + ":00";
  1101. }
  1102. }
  1103. if (that.checkedShowMsg.status != 200) {
  1104. postData.workOrder["isRemand"] = this.isRemand ? 1 : 0;
  1105. }
  1106. if (!yuyue) {
  1107. postData.workOrder.platform = 2;
  1108. } else {
  1109. delete postData.workOrder.platform;
  1110. }
  1111. //是否需要医护陪同检查
  1112. if (this.patientMsg.careLevel && this.currentTasktype.isAccompany == 1) {
  1113. //特级护理或一级护理
  1114. if (
  1115. this.patientMsg.careLevel.value === "0" ||
  1116. this.patientMsg.careLevel.value === "1"
  1117. ) {
  1118. this.btnLoading = false;
  1119. this.btnLoading1 = false;
  1120. this.accompany(postData, yuyue, "patient");
  1121. return;
  1122. }
  1123. }
  1124. if (
  1125. this.patientMsg.illnessState &&
  1126. this.currentTasktype.isAccompany == 1
  1127. ) {
  1128. //病危或病重
  1129. if (
  1130. this.patientMsg.illnessState.value === "2" ||
  1131. this.patientMsg.illnessState.value === "3"
  1132. ) {
  1133. this.btnLoading = false;
  1134. this.btnLoading1 = false;
  1135. this.accompany(postData, yuyue, "patient");
  1136. return;
  1137. }
  1138. }
  1139. postData.workOrder.isAccompany = 0; //是否需要医护陪同检查
  1140. that.mainService
  1141. .postCustom("api", yuyue ? "appointmentOrder" : "startOrder", postData)
  1142. .subscribe((data) => {
  1143. that.hidePatientOrder();
  1144. if (data.status == 200) {
  1145. that.showPromptModal("创建", true, "");
  1146. that.goodsLis = [];
  1147. that.getOrderList();
  1148. that.getDeptTaskType();
  1149. } else if (data.status == 100042) {
  1150. that.showPromptModal("创建", true, data.msg);
  1151. } else {
  1152. that.showPromptModal("创建", false, data.msg);
  1153. }
  1154. });
  1155. }
  1156. }
  1157. // 是否需要护士医生陪同模态框
  1158. accompanyModal: boolean = false;
  1159. accompanyLoading: boolean = false;
  1160. cancenlLoading: boolean = false;
  1161. accompanyPostData = null;
  1162. accompanyYuyue;
  1163. accompanyType = "";
  1164. accompany(postData, yuyue, type) {
  1165. this.accompanyModal = true;
  1166. this.accompanyPostData = postData;
  1167. this.accompanyYuyue = yuyue;
  1168. this.accompanyType = type;
  1169. }
  1170. confirmAccompany() {
  1171. this.accompanyPostData.workOrder.isAccompany = 1;
  1172. this.accompanyLoading = true;
  1173. if (this.accompanyType == "patient") {
  1174. //患者列表直接建单
  1175. this.mainService
  1176. .postCustom(
  1177. "api",
  1178. this.accompanyYuyue ? "appointmentOrder" : "startOrder",
  1179. this.accompanyPostData
  1180. )
  1181. .subscribe((data) => {
  1182. this.hidePatientOrder();
  1183. this.accompanyModal = false;
  1184. this.accompanyLoading = false;
  1185. if (data.status == 200) {
  1186. this.showPromptModal("创建", true, "");
  1187. this.goodsLis = [];
  1188. this.getOrderList();
  1189. this.getDeptTaskType();
  1190. } else if (data.status == 100042) {
  1191. this.showPromptModal("创建", true, data.msg);
  1192. } else {
  1193. this.showPromptModal("创建", false, data.msg);
  1194. }
  1195. });
  1196. } else if (this.accompanyType == "patient-yy") {
  1197. //患者列表预约建单
  1198. this.mainService
  1199. .postCustom(
  1200. "api",
  1201. this.accompanyYuyue ? "appointmentOrder" : "startOrder",
  1202. this.accompanyPostData
  1203. )
  1204. .subscribe((data) => {
  1205. this.btnLoading3 = false;
  1206. this.accompanyModal = false;
  1207. this.accompanyLoading = false;
  1208. this.cancel();
  1209. if (data.status == 200) {
  1210. this.showPromptModal("创建", true, "");
  1211. this.goodsLis = [];
  1212. this.getOrderList();
  1213. this.getDeptTaskType();
  1214. } else {
  1215. this.showPromptModal("创建", false, data.msg);
  1216. }
  1217. });
  1218. }
  1219. }
  1220. hideAccompanyModal(e) {
  1221. console.log(e);
  1222. if (e === "x") {
  1223. //关闭
  1224. this.accompanyModal = false;
  1225. return;
  1226. }
  1227. this.accompanyPostData.workOrder.isAccompany = 0;
  1228. this.cancenlLoading = true;
  1229. if (this.accompanyType == "patient") {
  1230. //患者列表直接建单
  1231. this.mainService
  1232. .postCustom(
  1233. "api",
  1234. this.accompanyYuyue ? "appointmentOrder" : "startOrder",
  1235. this.accompanyPostData
  1236. )
  1237. .subscribe((data) => {
  1238. this.hidePatientOrder();
  1239. this.accompanyModal = false;
  1240. this.cancenlLoading = false;
  1241. if (data.status == 200) {
  1242. this.showPromptModal("创建", true, "");
  1243. this.goodsLis = [];
  1244. this.getOrderList();
  1245. this.getDeptTaskType();
  1246. } else if (data.status == 100042) {
  1247. this.showPromptModal("创建", true, data.msg);
  1248. } else {
  1249. this.showPromptModal("创建", false, data.msg);
  1250. }
  1251. });
  1252. } else if (this.accompanyType == "patient-yy") {
  1253. //患者列表预约建单
  1254. this.mainService
  1255. .postCustom(
  1256. "api",
  1257. this.accompanyYuyue ? "appointmentOrder" : "startOrder",
  1258. this.accompanyPostData
  1259. )
  1260. .subscribe((data) => {
  1261. this.btnLoading3 = false;
  1262. this.accompanyModal = false;
  1263. this.cancenlLoading = false;
  1264. this.cancel();
  1265. if (data.status == 200) {
  1266. this.showPromptModal("创建", true, "");
  1267. this.goodsLis = [];
  1268. this.getOrderList();
  1269. this.getDeptTaskType();
  1270. } else {
  1271. this.showPromptModal("创建", false, data.msg);
  1272. }
  1273. });
  1274. }
  1275. }
  1276. // 切换患者送检检查项目
  1277. checkedShowMsg: any = {}; //患者送检检查项目对应展示信息
  1278. current_allowUrgent = false; //当前任务类型是否允许加急
  1279. currentTasktype; //当前选中的任务类型对象
  1280. cLoading = false;
  1281. changeCheckedType() {
  1282. this.isYyInspect = false;
  1283. this.linkCheckLisTrue = false;
  1284. this.clickYYFlag = false;
  1285. this.clickYYZyFlag = false;
  1286. this.currentTasktype = this.checkTypeLis.find(
  1287. (item) => item.id == this.patientForm.controls.checkedType.value
  1288. );
  1289. // 获取患者其他服务,护士端是否预约建单
  1290. let appointmentZyBuildFlag = this.checkTypeLis.filter(
  1291. (item) =>
  1292. item.id == this.patientForm.controls.checkedType.value &&
  1293. item.associationType.id == 255
  1294. );
  1295. if (appointmentZyBuildFlag.length) {
  1296. this.appointmentZyBuildFlag =
  1297. appointmentZyBuildFlag[0].appointmentOtherSwitch == 1 ? "1" : "0";
  1298. this.yyDateZy = new Date();
  1299. this.yyTimeZy = new Date();
  1300. if (this.yyTimeZy.getMinutes() >= 0 && this.yyTimeZy.getMinutes() <= 30) {
  1301. this.yyTimeZy.setMinutes(30);
  1302. } else if (
  1303. this.yyTimeZy.getMinutes() > 30 &&
  1304. this.yyTimeZy.getMinutes() < 60
  1305. ) {
  1306. this.yyTimeZy.setMinutes(0);
  1307. this.yyTimeZy.setHours(this.yyTimeZy.getHours() + 1);
  1308. }
  1309. } else {
  1310. this.appointmentZyBuildFlag = "0";
  1311. }
  1312. console.log(this.patientForm.controls.checkedType.value, this.checkTypeLis);
  1313. this.current_allowUrgent =
  1314. this.checkTypeLis.find(
  1315. (item) => item.id == this.patientForm.controls.checkedType.value
  1316. ).allowUrgent == 1
  1317. ? true
  1318. : false;
  1319. // 判断这个任务类型是否允许加急 start
  1320. // 判断这个任务类型是否允许加急 end
  1321. let that = this;
  1322. let postData = {
  1323. taskTypeId: that.patientForm.controls.checkedType.value,
  1324. patientCode: that.patientMsg.patientCode,
  1325. };
  1326. this.cLoading = true;
  1327. that.mainService
  1328. .postCustom("nurse", "workOrder/buildTrip", postData)
  1329. .subscribe((data) => {
  1330. this.cLoading = false;
  1331. this.message.remove(this.maskFlag);
  1332. this.maskFlag = false;
  1333. this.patientModal = true;
  1334. that.checkedShowMsg = data;
  1335. if (that.checkedShowMsg.status != 200) {
  1336. that.isRemand = data.isRemand == 1 ? true : false;
  1337. }
  1338. that.goodsLis = [];
  1339. that.allowUrgent = "0"; //加急
  1340. that.urgentReason = ""; //加急原因
  1341. if (data.goods && data.goods.length) {
  1342. data.goods.forEach((e) => {
  1343. that.goodsLis.push({
  1344. label: e.name,
  1345. value: e["id"],
  1346. checked: false,
  1347. });
  1348. });
  1349. }
  1350. that.linkCheckLis = [];
  1351. if (data.status == 200 && data.data && data.data.length) {
  1352. let arr = [];
  1353. data.data.forEach((e) => {
  1354. arr.push({
  1355. yyTime: e.yyTime,
  1356. priority: e.priority,
  1357. label:
  1358. (e.yyTime || "") +
  1359. " " +
  1360. e.execDept.dept +
  1361. " 进行 " +
  1362. (e.inspectName || "检查"),
  1363. value: e["id"],
  1364. checked: false,
  1365. });
  1366. });
  1367. that.linkCheckLis = arr;
  1368. }
  1369. });
  1370. }
  1371. // 需要预约建单-事件
  1372. yyInspectChange(e) {
  1373. if (this.filterLinkCheckLis.length) {
  1374. this.showDateTime();
  1375. } else {
  1376. this.yyTime = null;
  1377. this.yyDate = null;
  1378. console.log(this.isYyInspect);
  1379. }
  1380. }
  1381. //回显时间日期
  1382. showDateTime() {
  1383. //当前时间要大于生效时间
  1384. let isYyInspect = this.filterLinkCheckLis.every((item) => {
  1385. return (
  1386. new Date(item.yyTime).getTime() - new Date().getTime() >
  1387. this.leadTime * 60 * 1000
  1388. );
  1389. });
  1390. //如果勾选需要预约检查
  1391. if (isYyInspect) {
  1392. //筛选离当前时间最近的
  1393. let timeList = this.filterLinkCheckLis
  1394. .map((item) => new Date(item.yyTime).getTime())
  1395. .sort();
  1396. this.yyTime = new Date(timeList[0] - this.leadTime * 60 * 1000); //回显预约时间,需要减去生效时间
  1397. this.yyDate = new Date(timeList[0] - this.leadTime * 60 * 1000); //回显预约日期,需要减去生效时间
  1398. this.yyDateChange(this.yyTime);
  1399. } else {
  1400. this.yyTime = null;
  1401. this.yyDate = null;
  1402. }
  1403. }
  1404. // 患者送检检查项目-选择检查项目
  1405. linkCheckLisTrue = false; //是否有已选择(患者)
  1406. isInspectPriority = false; //选择的检查是否紧急(患者)
  1407. filterLinkCheckLis = []; //有预约时间并且选中的
  1408. linkCheckLisChange(e) {
  1409. console.log(e, this.linkCheckLis);
  1410. let flag = false; //检查是否紧急
  1411. this.linkCheckLis.forEach((item) => {
  1412. if (e.length) {
  1413. //有选中的检查
  1414. e.forEach((v) => {
  1415. //检查是否有紧急度
  1416. if (v.priority == 1) {
  1417. flag = true;
  1418. }
  1419. //选中的检查设置checked
  1420. item.checked = v.value == item.value;
  1421. });
  1422. } else {
  1423. item.checked = false;
  1424. }
  1425. });
  1426. //检查有紧急度,则加急
  1427. if (flag) {
  1428. this.allowUrgent = "1";
  1429. this.urgentReason = "系统根据检查信息,自动进行加急";
  1430. } else {
  1431. this.allowUrgent = "0";
  1432. this.urgentReason = "";
  1433. }
  1434. this.clickYYFlag = false;
  1435. // 有预约时间并且选中的
  1436. this.filterLinkCheckLis = this.linkCheckLis.filter(
  1437. (item) => Boolean(item.yyTime) && item.checked
  1438. );
  1439. //有预约时间并且选中的检查数组不为空
  1440. if (this.filterLinkCheckLis.length) {
  1441. //当前时间要大于生效时间
  1442. this.isYyInspect = this.filterLinkCheckLis.every((item) => {
  1443. return (
  1444. new Date(item.yyTime).getTime() - new Date().getTime() >
  1445. this.leadTime * 60 * 1000
  1446. );
  1447. });
  1448. this.showDateTime();
  1449. } else {
  1450. //有预约时间并且选中的检查数组为空
  1451. this.isYyInspect = false;
  1452. this.yyTime = null;
  1453. this.yyDate = null;
  1454. }
  1455. this.linkCheckLisTrue = e.length > 0;
  1456. this.isInspectPriority = e.some((item) => item.priority == 1);
  1457. }
  1458. // 是否加急
  1459. allowUrgentChange(e) {
  1460. if (this.isYyInspect) {
  1461. this.isYyInspect = e == 0;
  1462. if (!this.isYyInspect) {
  1463. this.yyDate = null;
  1464. this.yyDateZy = null;
  1465. this.yyTime = null;
  1466. this.yyTimeZy = null;
  1467. }
  1468. } else {
  1469. this.yyDate = null;
  1470. this.yyDateZy = null;
  1471. this.yyTime = null;
  1472. this.yyTimeZy = null;
  1473. }
  1474. }
  1475. // 禁用小时
  1476. disabledHours(): number[] {
  1477. let now = new Date();
  1478. let nHour = now.getHours();
  1479. let nMinute = now.getMinutes();
  1480. if (nMinute > 30) {
  1481. return range(0, nHour + 1);
  1482. } else {
  1483. return range(0, nHour);
  1484. }
  1485. }
  1486. // 禁用分钟
  1487. disabledMinutes(hour: number): number[] {
  1488. let now = new Date();
  1489. let nHour = now.getHours();
  1490. let nMinute = now.getMinutes();
  1491. if (hour === nHour || hour === undefined) {
  1492. if (nMinute == 0) {
  1493. return [];
  1494. } else if (nMinute <= 30 && nMinute > 0) {
  1495. return [0];
  1496. } else {
  1497. return [0, 30];
  1498. }
  1499. } else {
  1500. return [];
  1501. }
  1502. }
  1503. // 快捷一键发起建单
  1504. shortcutMsg; //一键发起信息
  1505. buildMsg: any = {}; //一键发起返回信息
  1506. buildType: string = ""; //快捷建单类型
  1507. historyCustomRemarks = []; //历史快捷输入
  1508. // 打开一键发起建单模态框
  1509. newShortcutOrder(msg, type) {
  1510. this.workOrderRemark = "";
  1511. this.customRemarks = [];
  1512. this.historyCustomRemarks = [];
  1513. console.log(msg, type);
  1514. this.buildType = type;
  1515. this.shortcutMsg = msg;
  1516. this.initForm();
  1517. this.buildMsg = {};
  1518. let postData = {
  1519. taskTypeId: msg.id,
  1520. };
  1521. this.nLoading = true;
  1522. this.mainService
  1523. .postCustom("nurse", "workOrder/buildTrip", postData)
  1524. .subscribe((result) => {
  1525. this.buildMsg = result;
  1526. if (result.remarksSwitch == 1) {
  1527. if (result.customRemarks === null || result.customRemarks === "") {
  1528. this.customRemarks = [];
  1529. } else {
  1530. this.customRemarks = result.customRemarks.split("$");
  1531. }
  1532. this.workOrderRemarkTips =
  1533. result.remarksPrompts || "请填写工单备注,不超过100个字符";
  1534. let user = JSON.parse(localStorage.getItem("user"));
  1535. this.mainService
  1536. .postCustom("nurse", "workOrder/recentRemarks", {
  1537. deptId: user.user.dept.id,
  1538. taskTypeId: msg.id,
  1539. })
  1540. .subscribe((result1) => {
  1541. this.nLoading = false;
  1542. if (result1.state == 200) {
  1543. this.historyCustomRemarks = result1.data;
  1544. }
  1545. });
  1546. } else {
  1547. this.nLoading = false;
  1548. }
  1549. });
  1550. }
  1551. shortcutForm: FormGroup; //一键发起建单表单
  1552. // 一键建单校验
  1553. // 起点科室校验
  1554. originOfficeShortCutValidator = (
  1555. control: FormControl
  1556. ): { [s: string]: boolean } => {
  1557. if (
  1558. this.shortcutForm &&
  1559. this.shortcutForm.value &&
  1560. !control.value &&
  1561. (this.buildMsg.status == 100013 || this.buildMsg.status == 100015)
  1562. ) {
  1563. return { required: true };
  1564. }
  1565. };
  1566. // 目标科室校验
  1567. targetOfficeShortCutValidator = (
  1568. control: FormControl
  1569. ): { [s: string]: boolean } => {
  1570. if (
  1571. this.shortcutForm &&
  1572. this.shortcutForm.value &&
  1573. !control.value &&
  1574. (this.buildMsg.status == 100014 || this.buildMsg.status == 100015)
  1575. ) {
  1576. return { required: true };
  1577. }
  1578. };
  1579. // 一键发起建单保存
  1580. loading5 = false;
  1581. confirmShortcut() {
  1582. var that = this;
  1583. for (const i in that.shortcutForm.controls) {
  1584. that.shortcutForm.controls[i].markAsDirty();
  1585. that.shortcutForm.controls[i].updateValueAndValidity();
  1586. }
  1587. console.log(that.shortcutForm);
  1588. if (that.shortcutForm.invalid) return;
  1589. that.loading5 = true;
  1590. let postData;
  1591. that.buildType = "other";
  1592. if (that.buildType == "other") {
  1593. // 其他
  1594. postData = {
  1595. workOrder: {
  1596. workOrderRemark: this.workOrderRemark,
  1597. taskType: { id: that.shortcutMsg.id },
  1598. createDept: that.loginUserDeptId,
  1599. startDept: { id: that.buildMsg.startDept },
  1600. endDepts: [{ id: that.buildMsg.endDept }],
  1601. },
  1602. };
  1603. if (
  1604. (that.buildMsg.status == 100013 || that.buildMsg.status == 100015) &&
  1605. that.shortcutForm.value.originOffice
  1606. ) {
  1607. postData.workOrder.startDept.id = that.shortcutForm.value.originOffice;
  1608. }
  1609. if (that.shortcutForm.value.targetOffice) {
  1610. postData.workOrder["endDepts"] = [
  1611. { id: that.shortcutForm.value.targetOffice },
  1612. ];
  1613. } else {
  1614. postData.workOrder["endDepts"] = [
  1615. { id: that.buildMsg.end.end.list[0].id },
  1616. ];
  1617. }
  1618. }
  1619. console.log(postData);
  1620. that.mainService
  1621. .postCustom("api", "startOrder", postData)
  1622. .subscribe((data) => {
  1623. that.loading5 = false;
  1624. if (data.status == 200 && that.buildType == "other") {
  1625. that.showPromptModal("创建", true, "", "other");
  1626. } else if (data.status == 200 && that.buildType == "bb") {
  1627. that.showPromptModal("创建", true, "", "bb");
  1628. } else if (that.buildType == "bb" && data.status == 100043) {
  1629. that.showPromptModal("创建", true, data.msg);
  1630. } else {
  1631. that.showPromptModal("创建", false, data.msg);
  1632. }
  1633. });
  1634. }
  1635. // ======================start===============================
  1636. // 快捷一键发起建单
  1637. shortcutModal: boolean = false; //检查信息一键建单模态框
  1638. shortcutMsg1; //一键发起信息
  1639. buildMsg1: any = {}; //一键发起返回信息
  1640. urgentFlag = false;
  1641. // 打开一键发起建单模态框,urgent为true的时候是紧急
  1642. newShortcutOrder1(msg, type, urgent?) {
  1643. console.log(msg, type);
  1644. this.urgentFlag = Boolean(urgent);
  1645. this.buildType = type;
  1646. this.shortcutMsg1 = msg;
  1647. this.initForm();
  1648. this.buildMsg1 = {};
  1649. let postData = {
  1650. taskTypeId: msg.id,
  1651. deptId: JSON.parse(localStorage.getItem("user")).user.dept.id,
  1652. };
  1653. this.mainService
  1654. .postCustom("nurse", "workOrder/buildTrip", postData)
  1655. .subscribe((data) => {
  1656. this.shortcutModal = true;
  1657. this.buildMsg1 = data;
  1658. });
  1659. }
  1660. hideShortcutOrder() {
  1661. this.shortcutModal = false;
  1662. }
  1663. shortcutForm1: FormGroup; //一键发起建单表单
  1664. // 一键建单校验
  1665. // 起点科室校验
  1666. originOfficeShortCutValidator1 = (
  1667. control: FormControl
  1668. ): { [s: string]: boolean } => {
  1669. if (
  1670. this.shortcutForm1 &&
  1671. this.shortcutForm1.value &&
  1672. !control.value &&
  1673. (this.buildMsg1.status == 100013 || this.buildMsg1.status == 100015)
  1674. ) {
  1675. return { required: true };
  1676. }
  1677. };
  1678. // 目标科室校验
  1679. targetOfficeShortCutValidator1 = (
  1680. control: FormControl
  1681. ): { [s: string]: boolean } => {
  1682. if (
  1683. this.shortcutForm1 &&
  1684. this.shortcutForm1.value &&
  1685. !control.value &&
  1686. (this.buildMsg1.status == 100014 || this.buildMsg1.status == 100015)
  1687. ) {
  1688. return { required: true };
  1689. }
  1690. };
  1691. // 一键发起建单保存
  1692. confirmShortcut1() {
  1693. var that = this;
  1694. for (const i in that.shortcutForm1.controls) {
  1695. that.shortcutForm1.controls[i].markAsDirty();
  1696. that.shortcutForm1.controls[i].updateValueAndValidity();
  1697. }
  1698. console.log(that.shortcutForm1);
  1699. if (that.shortcutForm1.invalid) return;
  1700. that.btnLoading = true;
  1701. let postData;
  1702. if (that.buildType == "bb") {
  1703. // 标本
  1704. postData = {
  1705. urgent: this.urgentFlag ? 1 : 0,
  1706. workOrder: {
  1707. taskType: { id: that.shortcutMsg1.id },
  1708. createDept: that.loginUserDeptId,
  1709. startDept: { id: that.loginUserDeptId },
  1710. },
  1711. };
  1712. }
  1713. console.log(postData);
  1714. that.mainService
  1715. .postCustom("api", "startOrder", postData)
  1716. .subscribe((data) => {
  1717. this.hideShortcutOrder();
  1718. console.log(that.buildType, data.status);
  1719. if (data.status == 200 && that.buildType == "other") {
  1720. that.showPromptModal("创建", true, "", "other");
  1721. } else if (data.status == 200 && that.buildType == "bb") {
  1722. that.showPromptModal("创建", true, "", "bb");
  1723. } else if (that.buildType == "bb" && data.status == 100043) {
  1724. that.showPromptModal("创建", true, data.msg);
  1725. this.getOrderList();
  1726. this.getSpecimenWorkOrderMsg();
  1727. } else {
  1728. that.showPromptModal("创建", false, data.msg);
  1729. }
  1730. });
  1731. }
  1732. // =======================end=================================
  1733. // 页面中间部分tab切换
  1734. checkedTableType: string = "other";
  1735. checkTable(type) {
  1736. this.checkedTableType = type;
  1737. }
  1738. // 意见箱表格数据
  1739. adviceList: any = [];
  1740. advicePageIndex: number = 1; //表格当前页码
  1741. advicePageSize: number = 10; //表格每页展示条数
  1742. adviceListLength: number = 10; //表格总数据量
  1743. adviceSearchInp: string = ""; //意见箱搜索
  1744. adviceLoading = false;
  1745. getAdvice() {
  1746. let that = this;
  1747. let postData = {
  1748. advice: {
  1749. content: that.adviceSearchInp || "",
  1750. creatDepartment: {
  1751. id: that.loginUserDeptId,
  1752. },
  1753. createUser: {
  1754. id: that.loginUser.id,
  1755. },
  1756. },
  1757. idx: that.advicePageIndex - 1 < 0 ? 0 : that.advicePageIndex - 1,
  1758. sum: that.advicePageSize,
  1759. };
  1760. this.adviceLoading = true;
  1761. that.mainService
  1762. .getFetchDataList("adviceCollection", "advice", postData)
  1763. .subscribe((data) => {
  1764. this.adviceLoading = false;
  1765. that.adviceList = data.list || [];
  1766. that.adviceListLength = data.totalNum || 0;
  1767. });
  1768. }
  1769. // 历史标本查询表格数据
  1770. historySpecimenList: any = [];
  1771. historySpecimenPageIndex: number = 1; //表格当前页码
  1772. historySpecimenPageSize: number = 10; //表格每页展示条数
  1773. historySpecimenListLength: number = 10; //表格总数据量
  1774. historySpecimenCodeSearchInp: string = ""; //标本编码搜索
  1775. historySpecimenParentSearchInp: string = ""; //患者信息搜索
  1776. hsLoading = false;
  1777. getHistorySpecimen(idx?) {
  1778. if (idx) {
  1779. this.historySpecimenPageIndex = 1;
  1780. }
  1781. let current = JSON.parse(localStorage.getItem("user"));
  1782. let postData = {
  1783. specimen: {
  1784. hosId: this.currentHospital.id,
  1785. sickRoom: {
  1786. id: current.user.dept.id,
  1787. },
  1788. scode:
  1789. this.historySpecimenCodeSearchInp === ""
  1790. ? null
  1791. : this.historySpecimenCodeSearchInp,
  1792. keyWord:
  1793. this.historySpecimenParentSearchInp === ""
  1794. ? null
  1795. : this.historySpecimenParentSearchInp,
  1796. },
  1797. idx: this.historySpecimenPageIndex - 1,
  1798. sum: this.historySpecimenPageSize,
  1799. };
  1800. this.hsLoading = true;
  1801. this.mainService
  1802. .getFetchDataList("simple/data", "specimen", postData)
  1803. .subscribe((data) => {
  1804. this.hsLoading = false;
  1805. this.historySpecimenList = data.list || [];
  1806. this.historySpecimenListLength = data.totalNum || 0;
  1807. });
  1808. }
  1809. // 意见箱-查看模态框
  1810. adviceModal: boolean = false;
  1811. adviceDetailInfo: any = {}; //意见详情
  1812. adviceDetail(id) {
  1813. this.adviceModal = true;
  1814. this.mainService
  1815. .getFetchData("adviceCollection", "advice", id)
  1816. .subscribe((data) => {
  1817. this.adviceDetailInfo = data.data;
  1818. console.log(this.adviceDetailInfo);
  1819. });
  1820. }
  1821. hideAdvice() {
  1822. this.adviceModal = false;
  1823. }
  1824. // 意见收集
  1825. adviceSubModal: boolean = false;
  1826. adviceSubContent: string; //填写意见内容
  1827. coopAdviceInfo: any = {}; //当前编辑意见详情
  1828. addAdvice(data?) {
  1829. let that = this;
  1830. that.adviceSubContent = "";
  1831. if (data) {
  1832. that.coopAdviceInfo = data;
  1833. that.adviceSubContent = data.content;
  1834. }
  1835. that.adviceSubModal = true;
  1836. }
  1837. hideSubAdvice() {
  1838. this.adviceSubModal = false;
  1839. }
  1840. // 提交意见内容
  1841. confirmSubAdvice() {
  1842. let that = this;
  1843. if (!that.adviceSubContent) return;
  1844. that.btnLoading = true;
  1845. let postData = {
  1846. advice: {
  1847. creatDepartment: {
  1848. id: that.loginUserDeptId,
  1849. },
  1850. createUser: {
  1851. id: that.loginUser.id,
  1852. },
  1853. content: that.adviceSubContent,
  1854. },
  1855. };
  1856. if (that.coopAdviceInfo.id) {
  1857. postData.advice["id"] = that.coopAdviceInfo.id;
  1858. }
  1859. that.mainService
  1860. .postCustom(
  1861. "adviceCollection",
  1862. that.coopAdviceInfo.id ? "updData/advice" : "addData/advice",
  1863. postData
  1864. )
  1865. .subscribe((data) => {
  1866. if (data.status == 200) {
  1867. that.adviceSubModal = false;
  1868. that.showPromptModal(
  1869. that.coopAdviceInfo.id ? "编辑" : "新增",
  1870. true,
  1871. ""
  1872. );
  1873. that.coopAdviceInfo = {};
  1874. that.adviceSubContent = "";
  1875. that.getAdvice();
  1876. } else {
  1877. that.adviceSubModal = false;
  1878. that.showPromptModal(
  1879. that.coopAdviceInfo.id ? "编辑" : "新增",
  1880. false,
  1881. data.msg
  1882. );
  1883. that.adviceSubContent = "";
  1884. }
  1885. });
  1886. }
  1887. // 查看标本详情
  1888. detailModel: boolean = false;
  1889. loading33: boolean = false;
  1890. detailList: any = [];
  1891. // 选择急查或普查(1是急标,2是普标)
  1892. changeSpeDetail(speDetailType: number) {
  1893. this.detailModel = true;
  1894. let user = JSON.parse(localStorage.getItem("user"));
  1895. let postData = {
  1896. deptId: user.user.dept.id,
  1897. urgent: speDetailType,
  1898. };
  1899. this.loading33 = true;
  1900. this.mainService
  1901. .postCustom("nurse", "getSpecimenWorkOrderDetails", postData)
  1902. .subscribe((result) => {
  1903. this.loading33 = false;
  1904. if (result.status == 200) {
  1905. this.detailList = result.data || [];
  1906. }
  1907. });
  1908. }
  1909. // 隐藏查看标本详情弹层
  1910. hideSpeDetailModel() {
  1911. this.detailModel = false;
  1912. }
  1913. // 意见删除模态框
  1914. delAdviceModal: boolean = false;
  1915. delAdviceId: number; //删除意见id
  1916. delAdvice(id) {
  1917. this.delAdviceId = id;
  1918. this.delAdviceModal = true;
  1919. }
  1920. confirmDelAdvice() {
  1921. let that = this;
  1922. that.btnLoading = true;
  1923. let postData = [that.delAdviceId];
  1924. that.mainService
  1925. .postCustom("adviceCollection", "rmvData/advice", postData)
  1926. .subscribe((data) => {
  1927. if (data.status == 200) {
  1928. that.delAdviceModal = false;
  1929. that.showPromptModal("删除", true, "");
  1930. if (
  1931. that.adviceList.length == 1 &&
  1932. that.advicePageIndex ==
  1933. Math.ceil(that.adviceListLength / that.advicePageSize)
  1934. ) {
  1935. that.adviceListLength--;
  1936. that.advicePageIndex = Math.ceil(
  1937. that.adviceListLength / that.advicePageSize
  1938. );
  1939. }
  1940. that.getAdvice();
  1941. } else {
  1942. that.delAdviceModal = false;
  1943. that.showPromptModal("删除", false, data.msg);
  1944. }
  1945. });
  1946. }
  1947. hideDelAdviceModal() {
  1948. this.delAdviceModal = false;
  1949. }
  1950. // 工单列表下拉筛选
  1951. selectedType: null;
  1952. changeOrderSel(e) {
  1953. this.selectedType = e;
  1954. this.getOrderList();
  1955. }
  1956. // 工单列表工单状态下拉筛选
  1957. changeOrderState(e) {
  1958. this.getOrderList();
  1959. }
  1960. // 工单列表
  1961. orderList: any = [];
  1962. orderIdx: number = 1;
  1963. orderLength: number = 10;
  1964. OLoading: boolean = true;
  1965. getOrderList() {
  1966. let that = this;
  1967. that.orderList = [];
  1968. that.OLoading = true;
  1969. let postData: any = {
  1970. workOrder: {
  1971. createDept: JSON.parse(localStorage.getItem("user")).user.dept.id,
  1972. platform: 2,
  1973. searchDays: 2,
  1974. taskType: {},
  1975. },
  1976. idx: that.orderIdx - 1,
  1977. sum: 10,
  1978. };
  1979. if (that.selectedType && that.selectedType != -1) {
  1980. postData.workOrder.taskType["associationType"] = {
  1981. id: that.selectedType,
  1982. };
  1983. }
  1984. // 执行中包含状态:待抢单、待接单、待到达、待送达、执行中、定时预约
  1985. if (that.orderStateSelected == "1") {
  1986. //执行中
  1987. delete postData.workOrder.gdState;
  1988. postData.workOrder.nurseState = 1;
  1989. } else if (that.orderStateSelected == "2") {
  1990. //待评价
  1991. delete postData.workOrder.nurseState;
  1992. postData.workOrder.gdState = { id: "73" };
  1993. } else {
  1994. //全部
  1995. delete postData.workOrder.nurseState;
  1996. delete postData.workOrder.gdState;
  1997. }
  1998. that.mainService
  1999. .getFetchDataList("nurse", "workOrder", postData)
  2000. .subscribe((data) => {
  2001. that.orderList = data.list || [];
  2002. //显示三项
  2003. that.orderList.forEach((item) => {
  2004. if (item.record.length > 2) {
  2005. let i = item.record
  2006. .reverse()
  2007. .findIndex((step) => step.record.length > 0);
  2008. item.record.reverse();
  2009. i = item.record.length - 1 - i;
  2010. if (i < 2) {
  2011. item.record = item.record.slice(0, 3);
  2012. } else if (i > item.record.length - 2) {
  2013. item.record = item.record.slice(
  2014. item.record.length - 3,
  2015. item.record.length
  2016. );
  2017. } else {
  2018. item.record = item.record.slice(i - 1, i + 2);
  2019. }
  2020. }
  2021. });
  2022. that.orderLength = data.totalNum || 0;
  2023. that.OLoading = false;
  2024. });
  2025. }
  2026. // 撤销
  2027. coopId: number;
  2028. recallOrderModal: boolean = false;
  2029. // 打开撤销模态框
  2030. openRecallModal(id) {
  2031. this.coopId = id;
  2032. this.recallOrderModal = true;
  2033. }
  2034. // 确认撤销
  2035. confirmRec() {
  2036. let that = this;
  2037. that.btnLoading = true;
  2038. that.mainService.delOrder(that.coopId).subscribe((data) => {
  2039. that.closeRecallOrderModal();
  2040. if (data.status == 200) {
  2041. that.getOrderList();
  2042. that.changeInfo();
  2043. that.showPromptModal("撤销", true, "");
  2044. } else {
  2045. that.showPromptModal("撤销", false, data.msg);
  2046. }
  2047. });
  2048. }
  2049. // 关闭撤销模态框
  2050. closeRecallOrderModal() {
  2051. this.recallOrderModal = false;
  2052. }
  2053. // 评价
  2054. appraiseModal: boolean = false;
  2055. starNum: number = 5; //评价星
  2056. appraiseContent: string = ""; //评级
  2057. appraiseId: number;
  2058. showAppraise(id) {
  2059. this.appraiseId = id;
  2060. this.appraiseModal = true;
  2061. this.starNum = 5;
  2062. this.appraiseContent = "";
  2063. }
  2064. // 保存评价
  2065. confirmAppraise() {
  2066. console.log(this.starNum, this.appraiseContent);
  2067. let that = this;
  2068. if (!that.starNum) return;
  2069. that.btnLoading = true;
  2070. let id;
  2071. switch (that.starNum) {
  2072. case 1:
  2073. id = 358;
  2074. break;
  2075. case 2:
  2076. id = 357;
  2077. break;
  2078. case 3:
  2079. id = 356;
  2080. break;
  2081. case 4:
  2082. id = 355;
  2083. break;
  2084. case 5:
  2085. id = 354;
  2086. break;
  2087. }
  2088. let postData = {
  2089. serviceEvaluation: { id: id },
  2090. remark: that.appraiseContent,
  2091. };
  2092. this.mainService
  2093. .postCustom("nurse/workOrder", "evaluate/" + this.appraiseId, postData)
  2094. .subscribe((data) => {
  2095. that.hideAppraise();
  2096. if (data.status == 200) {
  2097. that.getOrderList();
  2098. that.showPromptModal("评价", true, "");
  2099. } else {
  2100. that.showPromptModal("评价", false, data.msg);
  2101. }
  2102. });
  2103. }
  2104. hideAppraise() {
  2105. this.appraiseModal = false;
  2106. }
  2107. // 审核状态
  2108. checkStatusLis: any = [];
  2109. getCheckStatusLis() {
  2110. let that = this;
  2111. that.mainService.getDictionary("list", "check_status").subscribe((data) => {
  2112. that.checkStatusLis = data;
  2113. });
  2114. }
  2115. // 填写加急原因模态框
  2116. jiajiModal: boolean = false;
  2117. jiajiContent: string; //加急原因
  2118. jiajiId; //加急工单id
  2119. showJiaji(id) {
  2120. this.jiajiId = id;
  2121. this.jiajiModal = true;
  2122. this.jiajiContent = "";
  2123. }
  2124. hideJiaji() {
  2125. this.jiajiModal = false;
  2126. }
  2127. // 保存加急原因
  2128. confirmJiaji() {
  2129. let that = this;
  2130. let checkStatusId;
  2131. if (!that.jiajiContent) return;
  2132. that.btnLoading = true;
  2133. that.checkStatusLis.forEach((e) => {
  2134. if (e.value == 1) {
  2135. checkStatusId = e.id;
  2136. }
  2137. });
  2138. let postData = {
  2139. urgentDetails: {
  2140. workerOrder: that.jiajiId,
  2141. checkStatus: { id: checkStatusId },
  2142. urgentReason: that.jiajiContent,
  2143. },
  2144. };
  2145. that.mainService
  2146. .postCustom("workerOrder", "urge", postData)
  2147. .subscribe((data) => {
  2148. if (data.status == 200) {
  2149. that.showPromptModal("加急", true, "");
  2150. that.getOrderList();
  2151. that.hideJiaji();
  2152. } else {
  2153. that.showPromptModal("加急", false, data.msg);
  2154. }
  2155. });
  2156. }
  2157. // 查看工单详情
  2158. openDetails(id, typeId) {
  2159. if (typeId == 256 || typeId == 380) {
  2160. // 标本类
  2161. this.router.navigateByUrl("nurse/detailSample/" + id);
  2162. } else if (typeId == 260 || typeId == 255) {
  2163. // 患者陪检/患者转运
  2164. this.router.navigateByUrl("nurse/detailPatients/" + id);
  2165. } else if (typeId == 257 || typeId == 258) {
  2166. // 药品配送/静配
  2167. this.router.navigate(["nurse/detailDrug/" + id]);
  2168. } else {
  2169. // 其他
  2170. this.router.navigateByUrl("nurse/detailOthers/" + id);
  2171. }
  2172. }
  2173. // 派单
  2174. allotWorker(id, stateId) {
  2175. this.router.navigateByUrl("nurse/allotWorker/" + id + "/" + stateId);
  2176. }
  2177. // 展示信息提示框(con:提示信息,success:操作是否成功,promptInfo:操作结果提示信息)
  2178. showPromptModal(con, success, promptInfo?, back?) {
  2179. this.btnLoading = false;
  2180. this.btnLoading1 = false;
  2181. this.promptModalShow = false;
  2182. this.promptContent = con;
  2183. this.ifSuccess = success;
  2184. this.promptInfo = promptInfo;
  2185. this.back = back;
  2186. setTimeout(() => {
  2187. this.promptModalShow = true;
  2188. }, 100);
  2189. }
  2190. // 回到系统管理
  2191. toMain() {
  2192. this.router.navigateByUrl("main");
  2193. }
  2194. // 退出
  2195. logOut(): void {
  2196. let that = this;
  2197. // 假退出
  2198. localStorage.removeItem("user");
  2199. localStorage.removeItem("menu");
  2200. localStorage.removeItem("phones");
  2201. localStorage.removeItem("index");
  2202. that.router.navigateByUrl("login");
  2203. // 假退出
  2204. that.mainService.logOut().subscribe((data) => {
  2205. if (data.status == 200) {
  2206. localStorage.removeItem("user");
  2207. localStorage.removeItem("menu");
  2208. localStorage.removeItem("phones");
  2209. localStorage.removeItem("index");
  2210. that.router.navigateByUrl("login");
  2211. }
  2212. });
  2213. }
  2214. // 格式化时分秒
  2215. // (时间小于一分钟则显示秒,时间大于一分钟则显示分钟数,如超出一小时则显示小时和分钟。)time单位:秒
  2216. formatTime(time) {
  2217. let timeStr = "";
  2218. if (time >= 0 && time < 60) {
  2219. // 秒
  2220. timeStr = time + "秒";
  2221. } else if (time >= 60 && time < 3600) {
  2222. // 分钟
  2223. timeStr = Math.floor(time / 60) + "分钟";
  2224. } else if (time >= 3600) {
  2225. // 时 + 分
  2226. let h = "";
  2227. let m = "";
  2228. h = Math.floor(time / 3600) + "小时";
  2229. m = time % 3600 >= 60 ? Math.floor((time % 3600) / 60) + "分钟" : "";
  2230. timeStr = h + m;
  2231. }
  2232. return timeStr;
  2233. }
  2234. // 计算历史记录耗时
  2235. filterTime(step) {
  2236. let num = 0;
  2237. step.forEach((e) => {
  2238. num += e.difTime;
  2239. });
  2240. return this.formatTime(num / 1000);
  2241. }
  2242. // 截取意见内容(ie内核截取)
  2243. spliceContent(con) {
  2244. if (con.length >= 41 && navigator.userAgent.indexOf("Trident") > -1) {
  2245. return con.slice(0, 41) + "...";
  2246. } else {
  2247. return con;
  2248. }
  2249. }
  2250. @ViewChild("msgTemplate", { static: false }) msgTemplate: TemplateRef<any>; //消息通知模板
  2251. // 消息提醒
  2252. createBasicNotification(msgs): void {
  2253. this.notification.template(this.msgTemplate, {
  2254. nzDuration: 0,
  2255. nzData: msgs,
  2256. });
  2257. }
  2258. isShowNurseCode = false; //是否展开科室二维码
  2259. nurseCodeImg = ""; //图片
  2260. refreshQRCodeTime = 0; //刷新时间间隔
  2261. // 关闭科室二维码
  2262. closeNurseCode() {
  2263. this.isShowNurseCode = false;
  2264. clearInterval(this.timer);
  2265. this.timer = null;
  2266. }
  2267. // 展开科室二维码
  2268. timer = null;
  2269. showNurseCode() {
  2270. this.isShowNurseCode = true;
  2271. this.mainService.getDeptCode([this.loginUserDeptId]).subscribe((data) => {
  2272. if (data["status"] == 200) {
  2273. this.nurseCodeImg = data["data"][0].base64;
  2274. this.refreshQRCodeTime = data["data"][0].refreshQRCodeTime;
  2275. clearInterval(this.timer);
  2276. this.timer = setInterval(() => {
  2277. this.refreshQRCodeTime = Math.max(--this.refreshQRCodeTime, 0);
  2278. if (this.refreshQRCodeTime === 0) {
  2279. clearInterval(this.timer);
  2280. this.showNurseCode();
  2281. }
  2282. }, 1000);
  2283. }
  2284. });
  2285. }
  2286. // 右侧菜单
  2287. showLastItems: boolean = false;
  2288. // 下拉
  2289. fixedMenuXiala() {
  2290. this.showLastItems = true;
  2291. }
  2292. // 上拉
  2293. fixedMenuShangla() {
  2294. this.showLastItems = false;
  2295. }
  2296. mainRole: boolean = false; //回到系统管理权限
  2297. initRole() {
  2298. let menus = JSON.parse(localStorage.getItem("menu"));
  2299. let that = this;
  2300. console.log("菜单数量" + menus.length);
  2301. if (menus.length >= 2) {
  2302. that.mainRole = true;
  2303. return;
  2304. }
  2305. }
  2306. // 切换右侧菜单Tab
  2307. fixedTab: string = "";
  2308. checkFixedTab(type: string) {
  2309. if (type == "toSystem") {
  2310. this.router.navigateByUrl("main");
  2311. }
  2312. if (this.fixedTab == type) {
  2313. this.fixedTab = "";
  2314. } else {
  2315. this.fixedTab = type;
  2316. }
  2317. }
  2318. //子传父接收
  2319. closeModelHs(e) {
  2320. this.hsPromptModalShow = JSON.parse(e).show;
  2321. this.changeShow = JSON.parse(e).changeShow;
  2322. }
  2323. //子传父接收
  2324. clearModelHs(e) {
  2325. if (JSON.parse(e).clear === true) {
  2326. clearInterval(this.timerCloseTime);
  2327. }
  2328. this.changeShow = JSON.parse(e).changeShow;
  2329. }
  2330. // 头部切换科室
  2331. changeKsNow() {
  2332. this.hsPromptModalShow = true;
  2333. clearInterval(this.timerCloseTime);
  2334. this.changeShow = false;
  2335. }
  2336. }