import { Component, ElementRef, OnInit, TemplateRef, ViewChild, } from "@angular/core"; import { FormBuilder, Validators, FormGroup, FormControl, } from "@angular/forms"; import { Router } from "@angular/router"; import http from "../../../assets/js/http"; import { MainService } from "../../services/main.service"; import { WebsocketNurseService } from "../../services/websocket-nurse.service"; import { NzMessageService } from "ng-zorro-antd/message"; import { NzNotificationService } from "ng-zorro-antd/notification"; import { OverlayScrollbarsComponent } from "overlayscrollbars-ngx"; import { ToolService } from "../../services/tool.service"; import { Subject } from "rxjs"; import { debounceTime } from "rxjs/operators"; import { format, getMinutes, setMinutes, addDays, differenceInCalendarDays, getHours, startOfDay, endOfDay, } from "date-fns"; import { SourceId } from "src/app/type/types"; // 日期禁用 function range(start: number, end: number): number[] { const result: number[] = []; for (let i = start; i < end; i++) { result.push(i); } return result; } @Component({ selector: "app-hushijiandan", templateUrl: "./hushijiandan.component.html", styleUrls: ["./hushijiandan.component.less"], }) export class HushijiandanComponent implements OnInit { @ViewChild("remarksEle", { static: false }) remarksEle: ElementRef; @ViewChild("remarksEle1", { static: false }) remarksEle1: ElementRef; @ViewChild("remarksEle2", { static: false }) remarksEle2: ElementRef; @ViewChild("osComponentRef1", { read: OverlayScrollbarsComponent, static: false, }) osComponentRef1: OverlayScrollbarsComponent; @ViewChild("osComponentRef2", { read: OverlayScrollbarsComponent, static: false, }) osComponentRef2: OverlayScrollbarsComponent; @ViewChild("osComponentRef3", { read: OverlayScrollbarsComponent, static: false, }) osComponentRef3: OverlayScrollbarsComponent; @ViewChild("osComponentRef4", { read: OverlayScrollbarsComponent, static: false, }) osComponentRef4: OverlayScrollbarsComponent; @ViewChild("osComponentRef6", { read: OverlayScrollbarsComponent, static: false, }) osComponentRef6: OverlayScrollbarsComponent; @ViewChild("osComponentRef7", { read: OverlayScrollbarsComponent, static: false, }) osComponentRef7: OverlayScrollbarsComponent; @ViewChild("osComponentRef8", { read: OverlayScrollbarsComponent, static: false, }) osComponentRef8: OverlayScrollbarsComponent; @ViewChild("osComponentRef9", { read: OverlayScrollbarsComponent, static: false, }) osComponentRef9: OverlayScrollbarsComponent; @ViewChild("osComponentRef10", { read: OverlayScrollbarsComponent, static: false, }) osComponentRef10: OverlayScrollbarsComponent; othersListOptions: any; sortableTimer = null; searchTabInpSubject = new Subject(); //左侧查患者信息和检查信息防抖 otherSearchChangeSubject = new Subject(); //其他建单搜索防抖 incidentSearchChangeSubject = new Subject(); //故障现象搜索防抖 isYyInspect = false; //需要预约检查 constructor( private message: NzMessageService, private fb: FormBuilder, public router: Router, private mainService: MainService, private msg: NzMessageService, private notification: NzNotificationService, private webs: WebsocketNurseService, private tool: ToolService ) { this.othersListOptions = { onUpdate: (event: any) => { // 触发一次排序 clearTimeout(this.sortableTimer); this.sortableTimer = setTimeout(() => { let postData = { orders: [], }; postData.orders = this.othersList.map((item, i) => { return { id: item.id, orders: i, }; }); this.mainService .coopConfig("setOrders", postData) .subscribe((result) => {}); }, 500); }, }; } // 关闭倒计时 closeTime = 3; closeTimeFlag; timerCloseTime = null; changeShow = true; currentHospital; //当前院区 currentDept; //当前科室 logTimer = null; //综合日志定时器 logTime = 0; //综合日志自动刷新秒数 logTimeConst = 60; //综合日志自动刷新秒数 orderListTimer = null; //工单列表定时器 orderListTime = 0; //工单列表自动刷新秒数 orderListTimeConst = 60; //工单列表自动刷新秒数 deptDisplay; //护士端是否显示可以别名,1是显示科室名称,2是显示科室别名 ngOnInit() { this.currentHospital = this.tool.getCurrentHospital(); this.tool.getDeptDisplay().subscribe((result) => { if (result.status == 200) { this.deptDisplay = result.list[0].valueconfig; } }); this.getItsmIncident(); this.getUpdateTipsForNurses(); this.getCloseTimeFlag(); this.currentDept = this.tool.getCurrentUserDept(); console.log(this.currentDept, this.tabSearchCont); this.getSpecimenButton(); //防抖 this.searchTabInpSubject.pipe(debounceTime(500)).subscribe((v) => { this.getPatient(v); }); this.otherSearchChangeSubject.pipe(debounceTime(500)).subscribe((v) => { this.getDeptTaskType(v); }); this.incidentSearchChangeSubject .pipe(debounceTime(500)) .subscribe((v: string) => { this.getIncidentcategory(v); }); this.getTodayNum(); this.initLogin(); this.getDeptTaskType(); this.initForm(); this.getAdvice(); this.getOrderSelectList(); this.getCheckStatusLis(); this.refreshSpecimenWorkOrderMsg(); this.initRole(); this.getWebsocket(); // 综合日志倒计时 start this.logTime = this.logTimeConst; clearInterval(this.logTimer); this.logTimer = setInterval(() => { this.logTime--; if (this.logTime === 0) { this.logTime = this.logTimeConst; if (this.smallTabId == 1) { this.listDeptOrderRecord(); } else if (this.smallTabId == 2) { this.getQuickBxlb(); } this.getTodayNum(); //当日工单数量 } }, 1000); // 综合日志倒计时 end // 工单列表倒计时 start this.orderListTime = this.orderListTimeConst; clearInterval(this.orderListTimer); this.orderListTimer = setInterval(() => { this.orderListTime--; if (this.orderListTime === 0) { this.orderListTime = this.orderListTimeConst; this.getOrderList(); } }, 1000); // 工单列表倒计时 end } ngOnDestroy() { clearInterval(this.moveId); clearInterval(this.moveId1); clearInterval(this.msgTimerId); clearInterval(this.logTimer); clearInterval(this.orderListTimer); this.webs.closeWs(true); } loginUser: any = localStorage.getItem("user") ? JSON.parse(localStorage.getItem("user")).user : null; //登录人信息 loginUserDeptId: number = JSON.parse(localStorage.getItem("user")).user.dept .id; //登录人所属科室 appointmentBuildFlag = "0"; //是否开启护士端预约建单-患者陪检 appointmentZyBuildFlag = "0"; //是否开启护士端预约建单-患者其他 leadTime = 0; //护士端预约建单生效时长 followFlag = "0"; //是否开启护士端终点关注 promptContent: string; //操作提示框提示信息 ifSuccess: boolean; //操作成功/失败 promptInfo: string; //操作结果提示信息 back: string; //操作结果后回调标识 promptModalShow: boolean; //操作提示框是否展示 hsPromptModalShow: boolean = false; //护士端科室切换提示框是否展示 deptTaskTypeRules: any = {}; //当前登录科室任务类型信息规则 orderSelectList: any = []; //工单列表筛选选项 orderSelected = "-1"; //工单列表下拉框选中 orderStateSelected = "1"; //工单列表工单状态下拉框选中 tabSearchCont: string = ""; //左侧tab搜索框内容 pLoading: boolean = true; //患者信息loading patientList: any = []; //左侧tab患者信息list infoPageIdx: number = 1; //左侧tab页码 infoLength: number = 5; //左侧tab信息总数 specimenWorkOrderMsg: any = {}; //急标普标数量&信息 jpDrugsWKOMsg: any = {}; //药品静配提示信息 // 切换综合日志和一键报修 smallTabs = []; smallTabId = 2; //默认显示一键报修 changeSmallTab(id) { this.smallTabId = id; if (id == 1) { this.listDeptOrderRecord(); } else if (id == 2) { this.getQuickBxlb(); } } // 获取当日建单总数 todayNum = ""; //当日建单总数 getTodayNum() { this.mainService .getFetchDataList("nurse", "workOrder", { idx: 0, sum: 1, workOrder: { createDept: this.loginUser.dept.id, startTime1: format(startOfDay(new Date()), "yyyy-MM-dd HH:mm:ss"), endTime1: format(endOfDay(new Date()), "yyyy-MM-dd HH:mm:ss"), }, }) .subscribe((data) => { if (data.status == 200) { this.todayNum = data.totalNum || 0; } }); } // 获取报修区域(所属院区) // areas: any = []; //区域(所属院区)列表 // getArea() { // this.areas = []; // this.mainService // .fetchListBx("area", { idx: 0, sum: 1000 }) // .subscribe((result: any) => { // if (result.status == 200) { // this.areas = result.list; // if (this.areas.length) { // this.bxForm.controls.hospital.setValue(this.areas[0].id); // } else { // this.bxForm.controls.hospital.setValue(null); // } // } // }); // } //根据区域(所属院区)获取地点(楼栋) places: any = []; //地点(楼栋)列表 getPlace(buildingId) { this.places = []; this.mainService .fetchListBx("place", { idx: 0, sum: 1000, place: { area: { id: buildingId } }, }) .subscribe((result: any) => { if (result.status == 200) { this.places = result.list; if (this.places.length) { this.bxForm.controls.building.setValue(this.places[0].id); } else { this.bxForm.controls.building.setValue(null); } } }); } btnLoading: boolean = false; //确认按钮loading状态 workOrderRemark = ""; //备注 workOrderRemark1 = ""; //备注 workOrderRemark2 = ""; //备注 workOrderRemarkTips = ""; //备注提示 workOrderRemarkTips1 = ""; //备注提示 workOrderRemarkTips2 = ""; //备注提示 customRemarks = []; //备注快速输入 customRemarks1 = []; //备注快速输入 customRemarks2 = []; //备注快速输入 // 添加备注 addRemarks(item) { this.remarksEle.nativeElement.focus(); this.workOrderRemark += item; } // 添加备注 addRemarks1(item) { this.remarksEle1.nativeElement.focus(); this.workOrderRemark1 += item; } // 添加备注 addRemarks2(item) { this.remarksEle2.nativeElement.focus(); this.workOrderRemark2 += item; } // 立即执行 coopItem: any = {}; execModal: boolean = false; // 打开立即执行模态框 openExecModal(item) { this.coopItem = item; this.execModal = true; } // 确认立即执行 confirmExec() { this.btnLoading = true; // let postData: any = { // workOderId: this.coopItem.id, // workOrder: { // sourceId: this.coopItem.sourceId, // taskType: { // id: this.coopItem.taskType.id, // }, // startDept: { // id: this.coopItem.startDept.id, // }, // endDepts: this.coopItem.endDepts.map((v) => ({ id: v.id })), // createDept: this.coopItem.createDept, // patient: { // patientCode: this.coopItem.patient.patientCode, // }, // goods: this.coopItem.goods, // platform: 2, // isAccompany: this.coopItem.isAccompany, // }, // }; // if (this.coopItem.isRemand !== undefined) { // postData.workOrder.isRemand = this.coopItem.isRemand; // } // if (this.coopItem.taskType.associationType.value == 'inspect') { // postData.workOrder.taskType.isHalfInspect = this.coopItem.taskType.isHalfInspect; // } // checkList:[ // { // "id": 1165517 // } // ] this.mainService.executeNow(this.coopItem.id).subscribe((result: any) => { this.closeExecModal(); if (result.status == 200) { this.showPromptModal("立即执行", true, ""); this.getOrderList(); } else { this.showPromptModal("立即执行", false, result.msg); } }); } // 关闭立即执行模态框 closeExecModal() { this.execModal = false; } // 获取系统配置,护士端是否显示报修 isShowBx = false; getItsmIncident() { let postData = { idx: 0, sum: 100, hospitalConfig: { hosId: this.currentHospital.id } }; this.mainService.getFetchDataList("simple/data", "hospitalConfig", postData).subscribe((result) => { if (result.status == 200) { this.isShowBx = result.list.find(v => v.key == 'hos_itsmIncident').value == 1; if (this.isShowBx) { this.smallTabs = [ { id: 1, name: "综合日志" }, { id: 2, name: "一键报修" }, ]; this.smallTabId = 2; this.getQuickBxlb(); this.getBxlb(); } else { this.smallTabs = [{ id: 1, name: "综合日志" }]; this.smallTabId = 1; this.listDeptOrderRecord(); } } }); } // 获取护士端更新提示 updateTipsForNurses = ""; getUpdateTipsForNurses() { let postData = { idx: 0, sum: 1, systemConfiguration: { keyconfig: "updateTipsForNurses" }, }; this.mainService .getFetchDataList("simple/data", "systemConfiguration", postData) .subscribe((result) => { if (result.status == 200) { this.updateTipsForNurses = result.list[0].valueconfig; } }); } // 获取护士端更新提示 specimenButton = ""; getSpecimenButton() { if(this.currentDept.typeValue == 'surgery'){ return; } let postData = { idx: 0, sum: 1, systemConfiguration: { keyconfig: "specimenButton" }, }; this.mainService .getFetchDataList("simple/data", "systemConfiguration", postData) .subscribe((result) => { if (result.status == 200) { this.specimenButton = result.list[0].valueconfig; } }); } // 获取护士端弹窗的配置 // (1) 当用户设置为正数时,用户必须查看此窗体指定秒数。 // (2) 当用户设置为负数时,用户可点击知道了也可倒计时自动关闭。 // (3) 如果用户填写0则为无自动关闭和强制查看时间。 getCloseTimeFlag() { let postData = { idx: 0, sum: 1, systemConfiguration: { keyconfig: "nurseDeptSwitchTip" }, }; this.mainService .getFetchDataList("simple/data", "systemConfiguration", postData) .subscribe((result) => { if (result.status == 200) { this.closeTimeFlag = result.list[0].valueconfig - 0; this.changeKs(); } }); } //获取综合日志 rLoading = false; listDeptOrderRecords: any = []; listDeptOrderRecord() { this.rLoading = true; this.mainService .listMsgByMain("listDeptOrderRecord", { deptId: this.loginUserDeptId }) .subscribe((result) => { this.rLoading = false; if (result["status"] == 200) { this.listDeptOrderRecords = result["data"].slice(0, 15); } }); } // 查看标本历史记录 historyPromptModalShow = false; //标本历史记录弹窗开关 scode = ""; //查看历史记录携带 viewSpecimenHistory(data) { this.scode = data.scode; this.historyPromptModalShow = true; } // 关闭标本历史记录弹窗 closeModelHistory(e) { this.historyPromptModalShow = JSON.parse(e).show; } // 查看药单历史记录 historyDPromptModalShow = false; //药单历史记录弹窗开关 drugsBagId = ""; //查看历史记录携带 viewDrugsbagHistory(data) { this.drugsBagId = data.id; this.historyDPromptModalShow = true; } // 关闭药单历史记录弹窗 closeModelHistoryDrugsbag(e) { this.historyDPromptModalShow = JSON.parse(e).show; } // 查看报修信息 detailBx(data){ this.router.navigateByUrl("nurse/detailBx/" + data.id); } // 查看报修信息弹窗 bxPromptModalShow = false; //弹窗开关 bData = ""; //查看详情携带所有数据 viewBx(data) { this.bData = data; this.bxPromptModalShow = true; } // 关闭报修信息弹窗 closeModelBx(e) { this.bxPromptModalShow = JSON.parse(e).show; } // 护士端患者信息列表,鼠标移入姓名展示最近一条检查信息 recentInfo = ""; recentInfoTimer = null; recentInfoNum = 0; isRemand = true; //自动送回 yyTime = null; //预约时间-患者列表 yyTimeZy = null; //预约时间-患者列表-患者其他服务 yyDate = null; //预约日期-陪检 yyDateZy = null; //预约日期-转运 getRecentInfo(patientCode) { if(this.currentDept.typeValue == 'surgery'){ return; } this.recentInfo = ""; clearTimeout(this.recentInfoTimer); this.recentInfoTimer = setTimeout(() => { this.recentInfoNum++; this.mainService .listMsgByMain("workOrder/findInspectRecently", { patientCode }) .subscribe((result) => { this.recentInfoNum--; if (result["status"] == 200 && this.recentInfoNum === 0) { this.recentInfo = result["data"]["info"]; } else { this.recentInfo = ""; } }); }, 500); } // 获取患者陪检任务类型(只有一个)的信息 getTaskTypeByInspection() { const list = { idx: 0, sum: 1, taskType: { patientInspectQuery: true, hosIds: this.currentHospital.id + "", associationType: { id: 260, }, }, }; return this.mainService.getFetchDataList("configuration", "taskType", list); } //修改预约建单时间的日期 yyDateChange(e) { // 获取年月日 let yyDate = new Date(e); let year = yyDate.getFullYear(); let month = yyDate.getMonth(); let date = yyDate.getDate(); // 获取当前时间的年月日 let now = new Date(); let nYear = now.getFullYear(); let nMonth = now.getMonth(); let nDate = now.getDate(); if (year != nYear || month != nMonth || date != nDate) { this.disabledHours = () => []; this.disabledMinutes = (hour) => []; } else { // 禁用小时 this.disabledHours = () => { let now = new Date(); let nHour = now.getHours(); let nMinute = now.getMinutes(); if (nMinute > 30) { return range(0, nHour + 1); } else { return range(0, nHour); } }; // 禁用分钟 this.disabledMinutes = (hour) => { let now = new Date(); let nHour = now.getHours(); let nMinute = now.getMinutes(); if (hour === nHour || hour === undefined) { if (nMinute == 0) { return []; } else if (nMinute <= 30 && nMinute > 0) { return [0]; } else { return [0, 30]; } } else { return []; } }; } } // 关闭其他建单保存结果 closeModel(e) { console.log(e); if (e === "other") { this.osComponentRef2.osInstance().scroll({ x: 0, y: this.positionY }); this.getOrderList(); } else if (e === "bb") { this.getOrderList(); this.getSpecimenWorkOrderMsg(); } } // 其他建单 selectOtherId; //选中的id otherSearch = ""; //搜索的关键词 oLoading = false; nLoading = false; positionY = 0; //记录其他建单Y轴滚动距离 otherClick(item) { this.positionY = this.osComponentRef2.osInstance().scroll().position.y; //内容滚动的距离 this.selectOtherId = item.id; this.newShortcutOrder(item, "other"); } selectIncidentId; //选中的id incidentClick(item) { this.positionY = this.osComponentRef10.osInstance().scroll().position.y; //内容滚动的距离 this.selectIncidentId = item.id; this.bxForm.controls.content.setValue(item.mutiCategory); } //搜索 otherNum = 0; otherSearchChange() { this.otherSearchChangeSubject.next(this.otherSearch); } //搜索 incidentSearch = ""; //搜索的关键词 incidentNum = 0; incidentSearchChange() { this.incidentSearchChangeSubject.next(this.incidentSearch); } // 切换科室 changeKs() { this.hsPromptModalShow = true; // (1) 当用户设置为正数时,用户必须查看此窗体指定秒数。 // (2) 当用户设置为负数时,用户可点击知道了也可倒计时自动关闭。 // (3) 如果用户填写0则为无自动关闭和强制查看时间。 if (this.closeTimeFlag === 0) { return; } this.closeTime = Math.abs(this.closeTimeFlag); clearInterval(this.timerCloseTime); this.timerCloseTime = setInterval(() => { this.closeTime = Math.max(--this.closeTime, 0); if (this.closeTime === 0) { if (this.closeTimeFlag <= 0) { this.hsPromptModalShow = false; } clearInterval(this.timerCloseTime); } }, 1000); } // 判断登录是否已失效 initLogin() { let that = this; if (!localStorage.getItem("user")) { that.msg.error("您的登录已失效,请重新登录!", { nzDuration: 3000, }); setTimeout(() => { that.router.navigateByUrl("login"); }, 2000); return; } } // 连接websocket getWebsocket() { let that = this; this.webs .connectWs(http.nurseWs, { userCount: that.loginUser.account }) .subscribe((data) => { if (data && data.content) { that.createBasicNotification(data); } }); } // 每隔一分钟刷新标本信息 msgTimerId: any; refreshSpecimenWorkOrderMsg() { this.msgTimerId = setInterval(() => { this.getSpecimenWorkOrderMsg(); }, 60000); } // 工单列表筛选 getOrderSelectList() { let that = this; that.mainService .getDictionary("list", "association_types") .subscribe((data) => { that.orderSelectList = data || []; }); } // 急标普标数量 getSpecimenWorkOrderMsg() { if(this.currentDept.typeValue == 'surgery'){ return; } let that = this; that.mainService .postCustom("nurse", "getSpecimenWorkOrderMsg", { deptId: JSON.parse(localStorage.getItem("user")).user.dept.id, }) .subscribe((data) => { that.specimenWorkOrderMsg = data; }); } // 药品静配提示信息 drugJpLoading = false; getJpDrugsWKOMsg() { if(this.currentDept.typeValue == 'surgery'){ return; } let that = this; this.drugJpLoading = true; that.mainService .postCustom("nurse", "getJpDrugsWKOMsg", {}) .subscribe((data) => { this.drugJpLoading = false; that.jpDrugsWKOMsg = data.data ? data.data : {}; console.log(that.jpDrugsWKOMsg); if ( that.jpDrugsWKOMsg.drugsInfoList && that.jpDrugsWKOMsg.drugsInfoList.length ) { that.startSwiper(that.jpDrugsWKOMsg.drugsInfoList.length); } if ( that.jpDrugsWKOMsg.jpInfoList && that.jpDrugsWKOMsg.jpInfoList.length ) { that.startSwiper1(that.jpDrugsWKOMsg.jpInfoList.length); } }); } // swiper 轮播图 swiperTop: number = 0; moveId: any; index: number = 0; startSwiper(length) { let that = this; clearInterval(that.moveId); setInterval(() => { that.index++; clearInterval(that.moveId); that.moveId = setInterval(() => { if (that.swiperTop > -44 * that.index) { that.swiperTop--; } if (that.swiperTop <= length * -44) { that.swiperTop = 0; that.index = 0; clearInterval(that.moveId); } }, 20); }, 2000); } swiperTop1: number = 0; moveId1: any; index1: number = 0; startSwiper1(length) { let that = this; clearInterval(that.moveId1); setInterval(() => { that.index1++; clearInterval(that.moveId1); that.moveId1 = setInterval(() => { if (that.swiperTop1 > -44 * that.index1) { that.swiperTop1--; } if (that.swiperTop1 <= length * -44) { that.swiperTop1 = 0; that.index1 = 0; clearInterval(that.moveId1); } }, 20); }, 2000); } // 关注患者 follow(data) { this.showCommonModal( data, data.focusPatient === 0 ? "您将设置患者【" + data.patientName + "】为重点关注,后期此患者的相关检查将会自动建单通知支助中心" : "您将取消设置患者【" + data.patientName + "】为重点关注,后期此患者的相关检查将不会自动建单通知支助中心" ); } // 通用提示模态框 commonModal: boolean = false; //模态框 loading4 = false; tipsMsg1: string; //提示框信息 coop: any; //当前操作列 showCommonModal(data: any, tipsMsg1: string) { this.commonModal = true; this.coop = data; this.tipsMsg1 = tipsMsg1; } // 隐藏模态框 hideCommonModal() { this.commonModal = false; } // 确认 confirmCommon() { this.commonModal = false; let postData = { patient: { id: this.coop.id, focusPatient: this.coop.focusPatient === 0 ? 1 : 0, }, }; this.loading4 = true; this.mainService.listMsgByMain("updData/patient", postData).subscribe( (result) => { this.loading4 = false; if (result["status"] == 200) { this.showPromptModal( result["data"].focusPatient === 0 ? "取消关注" : "关注", true, "" ); this.getPatient(this.tabSearchCont); } else { this.showPromptModal( result["data"].focusPatient === 0 ? "取消关注" : "关注", false, "" ); } }, (err) => { this.loading4 = false; this.showPromptModal("操作", false, ""); } ); } // 是否确定报修模态框 bxModal: boolean = false; //模态框 loading6 = false; tipsMsg2: string; //提示框信息 coopBx: any; //当前操作列 showBxModal(data: any, tipsMsg2: string) { this.bxModal = true; this.coopBx = data; this.tipsMsg2 = tipsMsg2; } // 隐藏模态框 hideBxModal() { this.bxModal = false; } // 确认 confirmBx() { this.loading6 = true; this.mainService.wxbx({}).subscribe((result) => { if ((result as any).status == 200) { let bxcode = (result as any).data; //生成微信报修号 let postData: any = { verification: "true", incident: { branch:this.loginUser.currentHospital.id, deptId:this.loginUser.dept.id, // contacts: this.loginUser.name, // contactsInformation: this.loginUser.phone, description: this.coopBx.content, requester: { account: this.loginUser.account }, sourceType: "wechatUserIncident", fileUrl: "url", bxcode, }, loginUser: { account: this.loginUser.account, id: this.loginUser.id, }, }; if (this.coopBx.category) { postData.incident.categoryId = this.coopBx.category.id; } this.mainService.addWxIncident(postData).subscribe((res) => { this.loading6 = false; this.bxModal = false; if ((res as any).state == 200) { this.showPromptModal("提交", true, ""); this.checkTable("bxlb"); } else { this.showPromptModal("提交", false, (res as any).msg); } }); } else { this.loading6 = false; this.showPromptModal("提交", false, ""); } }); } // 获取事件状态 incidentStateId = undefined; incidentStateList = []; getIncidentState() { let postData = { type: "list", key: "wxincident_state" }; this.iLoading = true; this.mainService.getDictionaryByITSM(postData).subscribe((data: any) => { this.iLoading = false; if (data.status == 200) { this.incidentStateList = data.data || []; } }); } // 获取星级 degrees = []; getDegrees() { let postData = { type: "list", key: "incident_degree" }; this.iLoading = true; this.mainService.getDictionaryByITSM(postData).subscribe((data: any) => { this.iLoading = false; if (data.status == 200) { this.degrees = data.data || []; } }); } // 获取故障现象(三级) incidentList = []; iLoading = false; getIncidentcategory(key = "") { let postData = { idx: 0, sum: 9999, incidentcategory: { category: key, selectType: "pinyin_qs", hierarchyQuery: "three", }, }; this.iLoading = true; this.mainService .fetchListBx("incidentcategory", postData) .subscribe((data: any) => { this.iLoading = false; if (data.status == 200) { this.incidentList = data.list || []; } }); } // 获取当前登录人科室任务类型信息 othersList: any = []; // 其他一键建单列表 bbMsg: any = {}; //标本一键建单 patientMsgList: any = []; // 患者转运,患者陪检一键建单 tabFlag = true; //页面初始化获取一次患者陪检的任务类型信息 allowUrgentFlag = false; //检查列表的患者陪检类型是否允许加急 getDeptTaskType(search?, clear?) { let that = this; this.otherNum++; this.oLoading = true; let postData = { deptId: that.loginUserDeptId, }; if (search !== undefined) { postData["taskName"] = search; } that.mainService .postCustom("nurse", "getDeptTaskType", postData) .subscribe((data) => { this.otherNum--; if (this.otherNum === 0) { this.oLoading = false; } if (search === undefined) { that.deptTaskTypeRules = data.data; that.getOrderList(); if ( that.deptTaskTypeRules.openInspection || that.deptTaskTypeRules.openPatientTransport ) { // 陪检权限或转科权限 if (this.tabFlag) { this.tabFlag = false; this.getTaskTypeByInspection().subscribe((result) => { console.log(result); if (result.list && result.list.length > 0) { this.appointmentBuildFlag = result.list[0].appointmentSwitch + ""; //是否开启护士端预约建单 // this.leadTime = result.list[0].appointmentTime; //生效时长 this.leadTime = 0; //生效时长 this.followFlag = result.list[0].focusSwitch + ""; //是否开启护士端重点关注 this.allowUrgentFlag = result.list[0].allowUrgent == 1 ? true : false; //是否允许加急(检查列表) } else { this.appointmentBuildFlag = "0"; //是否开启护士端预约建单 this.leadTime = 0; //生效时长 this.followFlag = "0"; //是否开启护士端重点关注 this.allowUrgentFlag = false; //是否允许加急(检查列表) } this.pLoading = true; that.getPatient(); }); } else { that.getPatient(); } } if (that.deptTaskTypeRules.openSpecimen) { // 标本权限 that.getSpecimenWorkOrderMsg(); } if ( that.deptTaskTypeRules.openStaticDistribution || that.deptTaskTypeRules.openDrugsBag ) { // 药品静配权限 that.getJpDrugsWKOMsg(); } } if (data.data.allTaskTypes) { that.othersList = []; that.patientMsgList = []; data.data.allTaskTypes.forEach((e) => { if (e.associationType.value == "other") { that.othersList.push(e); } else if (e.associationType.value == "specimen") { that.bbMsg = e; } else if ( e.associationType.value == "patientTransport" || e.associationType.value == "inspect" ) { that.patientMsgList.push(e); } }); // if (clear === "clear") { // this.otherSearch = ""; // this.workOrderRemark = ""; // this.customRemarks = []; // this.historyCustomRemarks = []; // let obj = that.othersList.find( // (item) => item.id == this.selectOtherId // ); // obj && this.otherClick(obj); // } console.log(this.selectOtherId); if (!this.selectOtherId) { if (that.othersList.length) { this.selectOtherId = that.othersList[0].id; let obj = that.othersList.find( (item) => item.id == this.selectOtherId ); obj && this.otherClick(obj); } else { this.selectOtherId = null; } } } }); } // 目标科室输入搜索 searchDept(type, msg, e) { this.getDeptList(type, msg, e); } // 获取科室 getDeptList(type, msg, key?): void { // 返回值的status是201 则是默认发起科室 // 返回值的status是202 则是固定科室范围 // 返回值的status是203 则是固定科室 // 返回值的status是204 则是自主填写 // 返回值的status是205 则是固定科室类型 if ( (type == "start" && msg.start.start.departmentStrategy == 202) || (type == "target" && msg.end.end.departmentStrategy == 202) ) { return; //固定科室范围禁用搜索 } let postData: any = { idx: 0, sum: 20, department: { searchType: 1, hospital: { id: this.currentHospital.id }, }, }; if (key) { postData.department["keyWord"] = key; } if (type == "start" && msg.start.start.departmentStrategy == 205) { postData.department["type"] = { id: msg.start.start.startTypeId }; } else if (type == "target" && msg.end.end.departmentStrategy == 205) { postData.department["type"] = { id: msg.end.end.endTypeId }; } if (type == "start") { postData.department["ids"] = msg.start.deptIds || ""; } else if (type == "target") { postData.department["ids"] = msg.end.deptIds || ""; } postData.department.nurseSign = 1; this.mainService .getFetchDataList("data", "department", postData) .subscribe((data) => { if (type == "target") { msg.end.end.list = data.list; } else if (type == "start") { msg.start.start.list = data.list; } }); } // 切换左侧tab changeInfo() { if ( !this.deptTaskTypeRules.openInspection && !this.deptTaskTypeRules.openPatientTransport ) { return; } this.infoPageIdx = 1; this.getPatient(); } // 获取患者信息 snum = 0; getPatient(e?) { if ( (this.currentDept.typeValue == "checkRoom2" || this.currentDept.typeValue == "outpatientDept" || this.currentDept.typeValue == "checkRoom") && !this.tabSearchCont ) { this.pLoading = false; this.patientList = []; this.infoLength = 0; return; //护士端如果登录后如果科室类型为“检查科室”、“门诊科室”、“检验科室”,默认不显示患者信息 } this.pLoading = true; let postData = { idx: this.infoPageIdx - 1, sum: 10, }; if(this.currentDept.typeValue == 'surgery'){ // 手术安排信息 postData["surgery"] = { searchKey: e ? e : this.tabSearchCont, applyDateStart: format(startOfDay(new Date()), "yyyy-MM-dd HH:mm:ss"), applyDateEnd: format(endOfDay(new Date()), "yyyy-MM-dd HH:mm:ss"), hosId: this.currentHospital.id, surgeryDept: this.loginUserDeptId }; }else{ // 患者信息 postData["patient"] = { keyWord: e ? e : this.tabSearchCont, }; // 查询父级科室患者 postData["patient"]["parentIdOnly"] = true; if ( this.currentDept.typeValue == "checkRoom2" || this.currentDept.typeValue == "outpatientDept" || this.currentDept.typeValue == "checkRoom" ) { delete postData["patient"]["department"]; //搜索范围为全院在院患者 } else { postData["patient"]["department"] = { id: this.loginUserDeptId }; } } this.snum++; this.mainService .getFetchDataList(this.currentDept.typeValue == 'surgery' ? "simple/data" : 'nurse', this.currentDept.typeValue == 'surgery' ? "surgery" : 'patient', postData) .subscribe((data) => { this.snum--; if (data.list.length > 0) { data.list.forEach((item) => { if(this.currentDept.typeValue == 'surgery'){ if (item.patientDTO && item.patientDTO.focusPatient === undefined) { item.patientDTO.focusPatient = 0; } }else{ if (item.focusPatient === undefined) { item.focusPatient = 0; } } }); } this.patientList = data.list || []; if (this.snum === 0) { this.pLoading = false; } this.infoLength = data.totalNum || 0; }); } // tab输入搜索节流阀 searchTabInp(e) { if ( !this.deptTaskTypeRules.openInspection && !this.deptTaskTypeRules.openPatientTransport ) { return; } this.searchTabInpSubject.next(e); } // 下一日(陪检) nextDay() { this.yyDate = addDays(this.yyDate, 1); this.yyDateChange(this.yyDate); } // 下一日(转运) nextDayZy() { this.yyDateZy = addDays(this.yyDateZy, 1); this.yyDateChange(this.yyDateZy); } // 禁用日期(陪检) disabledyyDate = (current: Date): boolean => { return differenceInCalendarDays(current, new Date()) < 0; }; // 禁用日期(转运) disabledyyDateZy = (current: Date): boolean => { return differenceInCalendarDays(current, new Date()) < 0; }; // 一键建单确认弹框 confirmSub: boolean = false; confirmPostData: any = {}; //确认提交数据 confirmYuyue: boolean = false; //确认预约 confirmInfo: string = ""; btnLoading3 = false; confirm() { if (this.confirmYuyue) { this.confirmPostData.workOrder.yyTime = format(new Date(this.yyTime), "yyyy-MM-dd HH:mm") + ":00"; } if (!this.confirmYuyue) { this.confirmPostData.workOrder.platform = 2; } else { delete this.confirmPostData.workOrder.platform; } //是否需要医护陪同检查 if (this.patientMsg.careLevel && this.currentTasktype.isAccompany == 1) { //特级护理或一级护理 if ( this.patientMsg.careLevel.value === "0" || this.patientMsg.careLevel.value === "1" ) { this.btnLoading = false; this.btnLoading1 = false; this.accompany(this.confirmPostData, this.confirmYuyue, "patient-yy"); return; } } if (this.patientMsg.illnessState && this.currentTasktype.isAccompany == 1) { //病危或病重 if ( this.patientMsg.illnessState.value === "2" || this.patientMsg.illnessState.value === "3" ) { this.btnLoading = false; this.btnLoading1 = false; this.accompany(this.confirmPostData, this.confirmYuyue, "patient-yy"); return; } } this.btnLoading3 = true; this.confirmPostData.workOrder.isAccompany = 0; //是否需要医护陪同检查 this.mainService .postCustom( "api", this.confirmYuyue ? "appointmentOrder" : "startOrder", this.confirmPostData ) .subscribe((data) => { this.btnLoading3 = false; this.cancel(); if (data.status == 200) { this.showPromptModal("创建", true, ""); this.goodsLis = []; this.getOrderList(); this.getDeptTaskType(); this.getTodayNum(); } else if (data.status == 100042) { this.showPromptModal("创建", false, data.msg); this.getPatient(this.tabSearchCont); } else if (data.status == 1000033) { //重复建单那策略 this.repeatMsg = data.msg; this.showDelModal( this.confirmPostData, "accompany5", this.confirmYuyue ); } else { this.showPromptModal("创建", false, data.msg); } }); } cancel() { this.confirmSub = false; // this.confirmPostData = {}; this.confirmYuyue = false; this.btnLoading = false; } patientForm: FormGroup; //患者信息一键建单表单 //患者送检检查项目 checkTypeLis: any = []; // 患者信息一键建单关联检查 linkCheckLis: any = []; goodsLis: any = []; //携带设备 isRemarks: boolean = false; //是否开启备注信息 allowUrgent: any = "0"; //加急 urgentReason: any = ""; //加急原因 // 初始化form表单 initForm() { // 初始化患者信息一键建单表单 this.patientForm = this.fb.group({ checkedType: [null, [Validators.required]], goods: [null], workOrderRemark2: [null], linkCheck: [null, []], targetOffice: [null, [this.targetOfficeValidator]], originOffice: [null, [this.originOfficeValidator]], allowUrgent: [null], //加急 urgentReason: [null, [this.urgentReasonValidator]], //加急原因 }); // 初始化一键发起建单表单 this.shortcutForm = this.fb.group({ targetOffice: [null, [this.targetOfficeShortCutValidator]], originOffice: [null, [this.originOfficeShortCutValidator]], }); // 初始化一键发起建单表单 this.shortcutForm1 = this.fb.group({ targetOffice: [null, [this.targetOfficeShortCutValidator1]], originOffice: [null, [this.originOfficeShortCutValidator1]], }); //新增报修 this.bxForm = this.fb.group({ // name: [null, [Validators.required]], // phone: [null, [Validators.required]], // hospital: [null, [Validators.required]], // building: [null, [Validators.required]], // address: [null, [Validators.required]], content: [null, [Validators.required]], }); } //创建自定义校验规则dateValidator,用于复选框组校验时调用。 // 起点科室校验 originOfficeValidator = (control: FormControl): { [s: string]: boolean } => { if ( this.patientForm && this.patientForm.value && this.checkedShowMsg.status != 200 && !control.value && (this.checkedShowMsg.status == 100015 || this.checkedShowMsg.status == 100013) ) { return { required: true }; } }; // 目标科室校验 targetOfficeValidator = (control: FormControl): { [s: string]: boolean } => { if ( this.patientForm && this.patientForm.value && this.checkedShowMsg.status != 200 && !control.value && (this.checkedShowMsg.status == 100015 || this.checkedShowMsg.status == 100014) ) { return { required: true }; } }; // 加急原因校验 urgentReasonValidator = (control: FormControl): { [s: string]: boolean } => { if (this.allowUrgent == 1) { return { required: true }; } }; pickUpModal: boolean = false; //模态框 pickUpInfo:string = ''; pickUpItem: any = {}; hidePickUpModal() { this.pickUpModal = false; } // 确认 confirmPickUp() { alert('建单,无接口') console.log(this.pickUpItem); return; this.showPromptModal("创建", true, ""); this.getOrderList(); this.getDeptTaskType(); this.getTodayNum(); // var that = this; // that.btnLoading = true; // that.mainService // .coopData( // "rmvData", // "department", // 1 // ) // .subscribe((data) => { // that.btnLoading = false; // that.pickUpModal = false; // if (data.data && data.data[0]) { // if (!data.data[0].msg) { // if ( // that.listOfData.length == 1 && // that.pageIndex == Math.ceil(that.listLength / that.pageSize) // ) { // that.listLength--; // that.pageIndex = Math.ceil(that.listLength / that.pageSize); // } // that.showPromptModal("删除", true, ""); // } else { // that.showPromptModal("删除", false, data.data[0].msg); // } // } else { // that.showPromptModal("删除", false, ""); // } // }); } // 手术安排信息-一键接患者 pickUpPatient(e, item){ e.stopPropagation(); this.pickUpModal = true; this.pickUpItem = item; this.pickUpInfo = `您本次需要从${item.areaDeptDTO ? (this.deptDisplay == 2 ? item.areaDeptDTO.deptalias : item.areaDeptDTO.dept) : ''}科室接${item.patientDTO ? item.patientDTO.patientName : ''}患者到${item.surgeryDeptDTO ? (this.deptDisplay == 2 ? item.surgeryDeptDTO.deptalias : item.surgeryDeptDTO.dept) : ''}手术间进行手术,您确认接患者吗?` } // 患者信息一键建单 patientModal: boolean = false; //患者信息一键建单模态框 patientMsg; //患者信息 // 打开患者信息一键建单模态框 maskFlag: any = false; newPatientOrder(msg) { this.yyTime = null; this.yyTimeZy = null; this.btnLoading = false; this.btnLoading1 = false; let that = this; that.initForm(); that.checkedShowMsg = {}; that.patientMsg = msg; this.maskFlag = this.message.loading("正在加载中..", { nzDuration: 0, }).messageId; that.mainService .postCustom("configuration", "deptTSPTaskType", {}) .subscribe((data) => { that.checkTypeLis = data.data; // 默认选中患者陪检,没有患者陪检,则选择第一个患者其他服务的任务类型 let id; for (let i = that.checkTypeLis.length - 1; i >= 0; i--) { if (that.checkTypeLis[i].associationType.value == "inspect") { id = that.checkTypeLis[i].id; break; } else if ( that.checkTypeLis[i].associationType.value == "patientTransport" ) { id = that.checkTypeLis[i].id; } } that.patientForm.controls.checkedType.setValue(id); this.changeCheckedType(); }); } yyTimeChange(e) { if (this.yyTime) { let now = new Date(); // 禁用日期(陪检) if (getHours(this.yyTime) < getHours(now)) { this.disabledyyDate = (current: Date): boolean => { return differenceInCalendarDays(current, new Date()) < 1; }; } else { this.disabledyyDate = (current: Date): boolean => { return differenceInCalendarDays(current, new Date()) < 0; }; } if (getMinutes(this.yyTime) > 0 && getMinutes(this.yyTime) < 30) { this.yyTime = setMinutes(this.yyTime, 30); } else if (getMinutes(this.yyTime) > 30 && getMinutes(this.yyTime) < 60) { this.yyTime = setMinutes(this.yyTime, 0); } } this.clickYYFlag = false; } yyTimeZyChange(e) { if (this.yyTimeZy) { let now = new Date(); // 禁用日期(转运) if (getHours(this.yyTimeZy) < getHours(now)) { this.disabledyyDateZy = (current: Date): boolean => { return differenceInCalendarDays(current, new Date()) < 1; }; } else { this.disabledyyDateZy = (current: Date): boolean => { return differenceInCalendarDays(current, new Date()) < 0; }; } if (getMinutes(this.yyTimeZy) > 0 && getMinutes(this.yyTimeZy) < 30) { this.yyTimeZy = setMinutes(this.yyTimeZy, 30); } else if ( getMinutes(this.yyTimeZy) > 30 && getMinutes(this.yyTimeZy) < 60 ) { this.yyTimeZy = setMinutes(this.yyTimeZy, 0); } } this.clickYYZyFlag = false; } hidePatientOrder() { this.patientModal = false; this.clickYYFlag = false; this.clickYYZyFlag = false; } // 预约建单 btnLoading1 = false; confirmPatient1(type) { this.confirmPatient(type); } // 患者信息保存 clickYYFlag = false; //是否点击预约建单-患者陪检 clickYYZyFlag = false; //是否点击预约建单-患者其他 confirmPatient(yuyue?) { if (yuyue === "patient-yuyue") { this.clickYYFlag = true; } else { this.clickYYFlag = false; } if (yuyue === "patient-zy-yuyue") { this.clickYYZyFlag = true; } else { this.clickYYZyFlag = false; } // 选项是患者转运 let flag = this.checkTypeLis.some((item) => { return ( item.id == this.patientForm.controls.checkedType.value && item.associationType.value == "patientTransport" ); }); //预约时间-患者陪检不能为空 console.log(this.yyTime, this.yyTimeZy, flag, yuyue); if ( (!this.yyTime && !flag && yuyue === "patient-yuyue") || (!this.yyTimeZy && flag && yuyue === "patient-zy-yuyue") ) { return; } if (flag) { //转运 this.yyTimeZy = format(new Date(this.yyDateZy), "yyyy-MM-dd") + " " + format(new Date(this.yyTimeZy), "HH:mm") + ":00"; } else { //陪检 this.yyTime = format(new Date(this.yyDate), "yyyy-MM-dd") + " " + format(new Date(this.yyTime), "HH:mm") + ":00"; } var that = this; for (const i in that.patientForm.controls) { that.patientForm.controls[i].markAsDirty(); that.patientForm.controls[i].updateValueAndValidity(); } if (that.patientForm.invalid) { return; } console.log(that.patientForm); if (yuyue) { this.confirmYuyue = true; this.btnLoading1 = true; } else { this.confirmYuyue = false; this.btnLoading = true; } let postData: any = { workOrder: { sourceId: SourceId.hushi, taskType: { id: that.patientForm.controls.checkedType.value }, startDept: { id: that.checkedShowMsg.startDept }, endDepts: [{ id: that.checkedShowMsg.endDept }], createDept: that.loginUserDeptId, patient: { patientCode: that.patientMsg.patientCode, }, }, }; if (!flag) { postData.workOrder.taskType.isHalfInspect = this.currentTasktype.isHalfInspect === 1 ? 1 : 0; //半程陪检 } if ( (that.checkedShowMsg.status == 100013 || that.checkedShowMsg.status == 100015) && that.patientForm.value.originOffice ) { postData.workOrder.startDept.id = that.patientForm.value.originOffice; } if (that.patientForm.value.targetOffice) { postData.workOrder["endDepts"] = [ { id: that.patientForm.value.targetOffice }, ]; } else if (flag) { postData.workOrder["endDepts"] = [ { id: that.checkedShowMsg.end.end.list[0].id }, ]; } let checkedArr = []; let yy = false; //是否有预约时间 if (that.linkCheckLis && that.linkCheckLis.length) { that.linkCheckLis.forEach((e) => { if (e.checked) { checkedArr.push({ id: e.value }); if (e.yyTime) { yy = true; } } }); } // 携带设备 let goods = ""; if (that.patientForm.value.goods && that.patientForm.value.goods.length) { that.patientForm.value.goods.forEach((e) => { if (e.checked) { goods += e.value + ","; } }); goods = goods.slice(0, goods.length - 1); } postData.workOrder["goods"] = goods; // 工单备注 postData.workOrder["workOrderRemark"] = that.workOrderRemark2 || ''; if (!yuyue && that.current_allowUrgent && this.allowUrgent == 1) { postData.workOrder["urgentDetails"] = { checkStatus: { id: 329 }, urgentReason: that.urgentReason, }; } else { delete postData.workOrder["urgentDetails"]; } if ( yy && that.checkedShowMsg.status == 200 && that.linkCheckLis && checkedArr.length ) { // 有预约时间 postData.workOrder["checkList"] = checkedArr; that.hidePatientOrder(); that.confirmSub = true; that.confirmPostData = postData; that.confirmInfo = "您确认建单吗?"; } else { if (!yy && that.checkedShowMsg.status == 200) { postData.workOrder["checkList"] = checkedArr; // 添加预约时间 if (yuyue) { postData.workOrder.yyTime = format(new Date(this.yyTime), "yyyy-MM-dd HH:mm") + ":00"; } } else { delete postData.workOrder["checkList"]; // 添加预约时间 if (yuyue) { postData.workOrder.yyTime = format(new Date(this.yyTimeZy), "yyyy-MM-dd HH:mm") + ":00"; } } if (that.checkedShowMsg.status != 200) { postData.workOrder["isRemand"] = this.isRemand ? 1 : 0; } if (!yuyue) { postData.workOrder.platform = 2; } else { delete postData.workOrder.platform; } //是否需要医护陪同检查 if (this.patientMsg.careLevel && this.currentTasktype.isAccompany == 1) { //特级护理或一级护理 if ( this.patientMsg.careLevel.value === "0" || this.patientMsg.careLevel.value === "1" ) { this.btnLoading = false; this.btnLoading1 = false; this.accompany(postData, yuyue, "patient"); return; } } if ( this.patientMsg.illnessState && this.currentTasktype.isAccompany == 1 ) { //病危或病重 if ( this.patientMsg.illnessState.value === "2" || this.patientMsg.illnessState.value === "3" ) { this.btnLoading = false; this.btnLoading1 = false; this.accompany(postData, yuyue, "patient"); return; } } postData.workOrder.isAccompany = 0; //是否需要医护陪同检查 that.mainService .postCustom("api", yuyue ? "appointmentOrder" : "startOrder", postData) .subscribe((data) => { that.hidePatientOrder(); if (data.status == 200) { that.showPromptModal("创建", true, ""); that.goodsLis = []; that.getOrderList(); that.getDeptTaskType(); that.getTodayNum(); } else if (data.status == 100042) { that.showPromptModal("创建", false, data.msg); this.getPatient(this.tabSearchCont); } else if (data.status == 1000033) { //重复建单那策略 this.repeatMsg = data.msg; this.showDelModal(postData, "transport", yuyue); } else { that.showPromptModal("创建", false, data.msg); } }); } } // 是否需要护士医生陪同模态框 accompanyModal: boolean = false; accompanyLoading: boolean = false; cancenlLoading: boolean = false; accompanyPostData = null; accompanyYuyue; accompanyType = ""; accompany(postData, yuyue, type) { this.accompanyModal = true; this.accompanyPostData = postData; this.accompanyYuyue = yuyue; this.accompanyType = type; } confirmAccompany() { this.accompanyPostData.workOrder.isAccompany = 1; this.accompanyLoading = true; if (this.accompanyType == "patient") { //患者列表直接建单 this.mainService .postCustom( "api", this.accompanyYuyue ? "appointmentOrder" : "startOrder", this.accompanyPostData ) .subscribe((data) => { this.hidePatientOrder(); this.accompanyModal = false; this.accompanyLoading = false; if (data.status == 200) { this.showPromptModal("创建", true, ""); this.goodsLis = []; this.getOrderList(); this.getDeptTaskType(); this.getTodayNum(); } else if (data.status == 100042) { this.showPromptModal("创建", false, data.msg); this.getPatient(this.tabSearchCont); } else if (data.status == 1000033) { //重复建单那策略 this.repeatMsg = data.msg; this.showDelModal( this.accompanyPostData, "accompany1", this.accompanyYuyue ); } else { this.showPromptModal("创建", false, data.msg); } }); } else if (this.accompanyType == "patient-yy") { //患者列表预约建单 this.mainService .postCustom( "api", this.accompanyYuyue ? "appointmentOrder" : "startOrder", this.accompanyPostData ) .subscribe((data) => { this.btnLoading3 = false; this.accompanyModal = false; this.accompanyLoading = false; this.cancel(); if (data.status == 200) { this.showPromptModal("创建", true, ""); this.goodsLis = []; this.getOrderList(); this.getDeptTaskType(); this.getTodayNum(); } else if (data.status == 100042) { this.showPromptModal("创建", false, data.msg); this.getPatient(this.tabSearchCont); } else if (data.status == 1000033) { //重复建单那策略 this.repeatMsg = data.msg; this.showDelModal( this.accompanyPostData, "accompany2", this.accompanyYuyue ); } else { this.showPromptModal("创建", false, data.msg); } }); } } hideAccompanyModal(e) { console.log(e); if (e === "x") { //关闭 this.accompanyModal = false; return; } this.accompanyPostData.workOrder.isAccompany = 0; this.cancenlLoading = true; if (this.accompanyType == "patient") { //患者列表直接建单 this.mainService .postCustom( "api", this.accompanyYuyue ? "appointmentOrder" : "startOrder", this.accompanyPostData ) .subscribe((data) => { this.hidePatientOrder(); this.accompanyModal = false; this.cancenlLoading = false; if (data.status == 200) { this.showPromptModal("创建", true, ""); this.goodsLis = []; this.getOrderList(); this.getDeptTaskType(); this.getTodayNum(); } else if (data.status == 100042) { this.showPromptModal("创建", false, data.msg); this.getPatient(this.tabSearchCont); } else if (data.status == 1000033) { //重复建单那策略 this.repeatMsg = data.msg; this.showDelModal( this.accompanyPostData, "accompany3", this.accompanyYuyue ); } else { this.showPromptModal("创建", false, data.msg); } }); } else if (this.accompanyType == "patient-yy") { //患者列表预约建单 this.mainService .postCustom( "api", this.accompanyYuyue ? "appointmentOrder" : "startOrder", this.accompanyPostData ) .subscribe((data) => { this.btnLoading3 = false; this.accompanyModal = false; this.cancenlLoading = false; this.cancel(); if (data.status == 200) { this.showPromptModal("创建", true, ""); this.goodsLis = []; this.getOrderList(); this.getDeptTaskType(); this.getTodayNum(); } else if (data.status == 100042) { this.showPromptModal("创建", false, data.msg); this.getPatient(this.tabSearchCont); } else if (data.status == 1000033) { //重复建单那策略 this.repeatMsg = data.msg; this.showDelModal( this.accompanyPostData, "accompany4", this.accompanyYuyue ); } else { this.showPromptModal("创建", false, data.msg); } }); } } // 切换患者送检检查项目 checkedShowMsg: any = {}; //患者送检检查项目对应展示信息 current_allowUrgent = false; //当前任务类型是否允许加急 currentTasktype; //当前选中的任务类型对象 cLoading = false; historyCustomRemarks2 = []; changeCheckedType() { this.workOrderRemark2 = ""; this.customRemarks2 = []; this.historyCustomRemarks2 = []; this.isYyInspect = false; this.linkCheckLisTrue = false; this.clickYYFlag = false; this.clickYYZyFlag = false; this.currentTasktype = this.checkTypeLis.find( (item) => item.id == this.patientForm.controls.checkedType.value ); // 获取患者其他服务,护士端是否预约建单 let appointmentZyBuildFlag = this.checkTypeLis.filter( (item) => item.id == this.patientForm.controls.checkedType.value && item.associationType.value == "patientTransport" ); if (appointmentZyBuildFlag.length) { this.appointmentZyBuildFlag = appointmentZyBuildFlag[0].appointmentOtherSwitch == 1 ? "1" : "0"; console.log(this.appointmentZyBuildFlag, "seimin"); this.yyDateZy = new Date(); this.yyTimeZy = new Date(); if (this.yyTimeZy.getMinutes() >= 0 && this.yyTimeZy.getMinutes() <= 30) { this.yyTimeZy.setMinutes(30); } else if ( this.yyTimeZy.getMinutes() > 30 && this.yyTimeZy.getMinutes() < 60 ) { this.yyTimeZy.setMinutes(0); this.yyTimeZy.setHours(this.yyTimeZy.getHours() + 1); } } else { this.appointmentBuildFlag = this.currentTasktype.appointmentSwitch == 1 ? "1" : "0"; console.log(this.appointmentBuildFlag, "seimin"); } console.log(this.patientForm.controls.checkedType.value, this.checkTypeLis); this.current_allowUrgent = this.checkTypeLis.find( (item) => item.id == this.patientForm.controls.checkedType.value ).allowUrgent == 1 ? true : false; // 判断这个任务类型是否允许加急 start // 判断这个任务类型是否允许加急 end let that = this; let postData = { taskTypeId: that.patientForm.controls.checkedType.value, patientCode: that.patientMsg.patientCode, }; this.cLoading = true; that.mainService .postCustom("nurse", "workOrder/buildTrip", postData) .subscribe((data) => { this.cLoading = false; this.message.remove(this.maskFlag); this.maskFlag = false; this.patientModal = true; that.checkedShowMsg = data; if (that.checkedShowMsg.status != 200) { that.isRemand = data.isRemand == 1 ? true : false; } that.goodsLis = []; that.allowUrgent = "0"; //加急 that.urgentReason = ""; //加急原因 if (data.goods && data.goods.length) { data.goods.forEach((e) => { that.goodsLis.push({ label: e.name, value: e["id"], checked: false, }); }); } // 工单备注配置 start that.isRemarks = data.remarksSwitch == 1; if (data.remarksSwitch == 1) { if (data.customRemarks === null || data.customRemarks === "") { that.customRemarks2 = []; } else { that.customRemarks2 = data.customRemarks.split("$"); } that.workOrderRemarkTips2 = data.remarksPrompts || "请填写工单备注,不超过100个字符"; // let user = JSON.parse(localStorage.getItem("user")); // that.mainService // .postCustom("nurse", "workOrder/recentRemarks", { // deptId: user.user.dept.id, // taskTypeId: that.patientForm.controls.checkedType.value, // }) // .subscribe((result) => { // if (result.state == 200) { // that.historyCustomRemarks2 = result.data; // } // }); } // 工单备注配置 end that.linkCheckLis = []; if (data.status == 200 && data.data && data.data.length) { let arr = []; data.data.forEach((e) => { arr.push({ execDeptId: e.execDept.id, yyTime: e.yyTime, priority: e.priority, label: (e.yyTime || "") + " " + (this.deptDisplay == 2 ? e.execDept.deptalias : e.execDept.dept) + " 进行 " + (e.inspectName || "检查"), value: e["id"], checked: false, }); }); that.linkCheckLis = arr; } }); } // 需要预约建单-事件 yyInspectChange(e) { if (this.currentTasktype.associationType.value === "inspect") { //陪检 let obj = this.filterLinkCheckLis.find((item) => { return ( new Date(item.yyTime).getTime() - new Date().getTime() > this.leadTime * 60 * 1000 ); }); if (obj) { this.showDateTime(); } else { this.yyTime = null; this.yyDate = new Date(); console.log(this.isYyInspect); } } else { //转运 this.yyTimeZy = null; this.yyDateZy = new Date(); } } //回显时间日期 showDateTime() { //当前时间要大于生效时间 let isYyInspect = this.filterLinkCheckLis.every((item) => { return ( new Date(item.yyTime).getTime() - new Date().getTime() > this.leadTime * 60 * 1000 ); }); //如果勾选需要预约检查 if (isYyInspect) { //筛选离当前时间最近的 let timeList = this.filterLinkCheckLis .map((item) => new Date(item.yyTime).getTime()) .sort(); this.yyTime = new Date(timeList[0] - this.leadTime * 60 * 1000); //回显预约时间,需要减去生效时间 this.yyDate = new Date(timeList[0] - this.leadTime * 60 * 1000); //回显预约日期,需要减去生效时间 this.yyDateChange(this.yyTime); } else { this.yyTime = null; this.yyDate = null; } } // 患者送检检查项目-选择检查项目 linkCheckLisTrue = false; //是否有已选择(患者) isInspectPriority = false; //选择的检查是否紧急(患者) filterLinkCheckLis = []; //有预约时间并且选中的 isInspects = false; //勾选检车的时候是否多个检查多个检查科室 linkCheckLisChange(e) { let flag = false; //检查是否紧急 let arr = []; //选中的索引 // 是否检查生成工单允许多个科室,1是,0否 if (this.currentTasktype.isMoreDept === 0) { let arr = e.map((item) => item.execDeptId); arr = Array.from(new Set(arr)); this.isInspects = arr.length > 1; } this.linkCheckLis.forEach((item, index) => { if (e.length) { //有选中的检查 e.forEach((v) => { //检查是否有紧急度 if (v.priority == 1) { flag = true; } //选中的检查设置checked if (v.value == item.value) { arr.push(index); } }); } else { item.checked = false; } }); this.linkCheckLis.forEach((item, index) => { item.checked = arr.includes(index); }); console.log(e, this.linkCheckLis); //检查有紧急度,则加急 if (flag) { this.allowUrgent = "1"; this.urgentReason = "系统根据检查信息,自动进行加急"; } else { this.allowUrgent = "0"; this.urgentReason = ""; } this.clickYYFlag = false; // 有预约时间并且选中的 this.filterLinkCheckLis = this.linkCheckLis.filter( (item) => Boolean(item.yyTime) && item.checked ); //有预约时间并且选中的检查数组不为空,并且预约建单的开关开启 if (this.filterLinkCheckLis.length && this.appointmentBuildFlag == "1") { //当前时间要大于生效时间 this.isYyInspect = this.filterLinkCheckLis.every((item) => { return ( new Date(item.yyTime).getTime() - new Date().getTime() > this.leadTime * 60 * 1000 ); }); this.allowUrgentChange(this.allowUrgent); if (this.allowUrgent == 0) { //不加急状态下,回显时间 this.showDateTime(); } } else { //有预约时间并且选中的检查数组为空 this.isYyInspect = false; this.yyTime = null; this.yyDate = null; } this.linkCheckLisTrue = e.length > 0; this.isInspectPriority = e.some((item) => item.priority == 1); } // 是否加急 allowUrgentChange(e) { // this.urgentReasonValidator = (control: FormControl): { [s: string]: boolean } => { // if (e == 1) { // return { required: true }; // } // }; if (e == 0) { this.patientForm.get("urgentReason")!.clearValidators(); this.patientForm.get("urgentReason")!.markAsPristine(); } else { this.patientForm.get("urgentReason")!.setValidators(Validators.required); this.patientForm.get("urgentReason")!.markAsDirty(); } this.patientForm.get("urgentReason")!.updateValueAndValidity(); if (this.isYyInspect) { this.isYyInspect = e == 0; if (!this.isYyInspect) { this.yyDate = null; this.yyDateZy = null; this.yyTime = null; this.yyTimeZy = null; } } else { this.yyDate = null; this.yyDateZy = null; this.yyTime = null; this.yyTimeZy = null; } } // 禁用小时 disabledHours(): number[] { let now = new Date(); let nHour = now.getHours(); let nMinute = now.getMinutes(); if (nMinute > 30) { return range(0, nHour + 1); } else { return range(0, nHour); } } // 禁用分钟 disabledMinutes(hour: number): number[] { let now = new Date(); let nHour = now.getHours(); let nMinute = now.getMinutes(); if (hour === nHour || hour === undefined) { if (nMinute == 0) { return []; } else if (nMinute <= 30 && nMinute > 0) { return [0]; } else { return [0, 30]; } } else { return []; } } // 快捷一键发起建单 shortcutMsg; //一键发起信息 buildMsg: any = {}; //一键发起返回信息 buildType: string = ""; //快捷建单类型 historyCustomRemarks = []; //历史快捷输入 // 打开一键发起建单模态框 newShortcutOrder(msg, type) { this.workOrderRemark = ""; this.customRemarks = []; this.historyCustomRemarks = []; console.log(msg, type); this.buildType = type; this.shortcutMsg = msg; this.initForm(); this.buildMsg = {}; let postData = { taskTypeId: msg.id, }; this.nLoading = true; this.mainService .postCustom("nurse", "workOrder/buildTrip", postData) .subscribe((result) => { this.buildMsg = result; if (result.remarksSwitch == 1) { if (result.customRemarks === null || result.customRemarks === "") { this.customRemarks = []; } else { this.customRemarks = result.customRemarks.split("$"); } this.workOrderRemarkTips = result.remarksPrompts || "请填写工单备注,不超过100个字符"; let user = JSON.parse(localStorage.getItem("user")); this.mainService .postCustom("nurse", "workOrder/recentRemarks", { deptId: user.user.dept.id, taskTypeId: msg.id, }) .subscribe((result1) => { this.nLoading = false; if (result1.state == 200) { this.historyCustomRemarks = result1.data; } }); } else { this.nLoading = false; } }); } shortcutForm: FormGroup; //一键发起建单表单 bxForm: FormGroup; //报修表单 // 一键建单校验 // 起点科室校验 originOfficeShortCutValidator = ( control: FormControl ): { [s: string]: boolean } => { if ( this.shortcutForm && this.shortcutForm.value && !control.value && (this.buildMsg.status == 100013 || this.buildMsg.status == 100015) ) { return { required: true }; } }; // 目标科室校验 targetOfficeShortCutValidator = ( control: FormControl ): { [s: string]: boolean } => { if ( this.shortcutForm && this.shortcutForm.value && !control.value && (this.buildMsg.status == 100014 || this.buildMsg.status == 100015) ) { return { required: true }; } }; // 一键发起建单保存 loading5 = false; confirmShortcut() { var that = this; for (const i in that.shortcutForm.controls) { that.shortcutForm.controls[i].markAsDirty(); that.shortcutForm.controls[i].updateValueAndValidity(); } console.log(that.shortcutForm); if (that.shortcutForm.invalid) return; that.loading5 = true; let postData; that.buildType = "other"; if (that.buildType == "other") { // 其他 postData = { workOrder: { sourceId: SourceId.hushi, workOrderRemark: this.workOrderRemark, taskType: { id: that.shortcutMsg.id }, createDept: that.loginUserDeptId, startDept: { id: that.buildMsg.startDept }, endDepts: [{ id: that.buildMsg.endDept }], }, }; if ( (that.buildMsg.status == 100013 || that.buildMsg.status == 100015) && that.shortcutForm.value.originOffice ) { postData.workOrder.startDept.id = that.shortcutForm.value.originOffice; } if (that.shortcutForm.value.targetOffice) { postData.workOrder["endDepts"] = [ { id: that.shortcutForm.value.targetOffice }, ]; } else { postData.workOrder["endDepts"] = [ { id: that.buildMsg.end.end.list[0].id }, ]; } } console.log(postData); that.mainService .postCustom("api", "startOrder", postData) .subscribe((data) => { that.loading5 = false; if (data.status == 200 && that.buildType == "other") { that.showPromptModal("创建", true, "", "other"); this.getTodayNum(); } else if (data.status == 200 && that.buildType == "bb") { that.showPromptModal("创建", true, "", "bb"); this.getTodayNum(); } else if (that.buildType == "bb" && data.status == 100043) { that.showPromptModal("创建", true, data.msg); this.getTodayNum(); } else if (data.status == 1000033) { //重复建单那策略 this.repeatMsg = data.msg; this.showDelModal(postData, "other"); } else { that.showPromptModal("创建", false, data.msg); } }); } // ======================start=============================== // 快捷一键发起建单 shortcutModal: boolean = false; //检查信息一键建单模态框 shortcutMsg1; //一键发起信息 buildMsg1: any = {}; //一键发起返回信息 urgentFlag = false; bLoading = false; //收取标本的loading // 打开一键发起建单模态框,urgent为true的时候是紧急 historyCustomRemarks1 = []; newShortcutOrder1(msg, type, urgent?) { this.workOrderRemark1 = ""; this.customRemarks1 = []; this.historyCustomRemarks1 = []; console.log(msg, type); this.urgentFlag = Boolean(urgent); this.buildType = type; this.shortcutMsg1 = msg; this.initForm(); this.buildMsg1 = {}; let postData = { taskTypeId: msg.id, deptId: JSON.parse(localStorage.getItem("user")).user.dept.id, }; this.bLoading = true; this.mainService .postCustom("nurse", "workOrder/buildTrip", postData) .subscribe((result) => { this.shortcutModal = true; this.buildMsg1 = result; if (result.remarksSwitch == 1) { if (result.customRemarks === null || result.customRemarks === "") { this.customRemarks1 = []; } else { this.customRemarks1 = result.customRemarks.split("$"); } this.workOrderRemarkTips1 = result.remarksPrompts || "请填写工单备注,不超过100个字符"; let user = JSON.parse(localStorage.getItem("user")); this.mainService .postCustom("nurse", "workOrder/recentRemarks", { deptId: user.user.dept.id, taskTypeId: msg.id, }) .subscribe((result1) => { this.bLoading = false; if (result1.state == 200) { this.historyCustomRemarks1 = result1.data; } }); } else { this.bLoading = false; } }); } hideShortcutOrder() { this.shortcutModal = false; } shortcutForm1: FormGroup; //一键发起建单表单 // 一键建单校验 // 起点科室校验 originOfficeShortCutValidator1 = ( control: FormControl ): { [s: string]: boolean } => { if ( this.shortcutForm1 && this.shortcutForm1.value && !control.value && (this.buildMsg1.status == 100013 || this.buildMsg1.status == 100015) ) { return { required: true }; } }; // 目标科室校验 targetOfficeShortCutValidator1 = ( control: FormControl ): { [s: string]: boolean } => { if ( this.shortcutForm1 && this.shortcutForm1.value && !control.value && (this.buildMsg1.status == 100014 || this.buildMsg1.status == 100015) ) { return { required: true }; } }; // 一键发起建单保存 confirmShortcut1() { var that = this; for (const i in that.shortcutForm1.controls) { that.shortcutForm1.controls[i].markAsDirty(); that.shortcutForm1.controls[i].updateValueAndValidity(); } console.log(that.shortcutForm1); if (that.shortcutForm1.invalid) return; that.btnLoading = true; let postData; if (that.buildType == "bb") { // 标本 postData = { urgent: this.urgentFlag ? 1 : 0, workOrder: { sourceId: SourceId.hushi, workOrderRemark: this.workOrderRemark1, taskType: { id: that.shortcutMsg1.id }, createDept: that.loginUserDeptId, startDept: { id: that.loginUserDeptId }, }, }; } console.log(postData); that.mainService .postCustom("api", "startOrder", postData) .subscribe((data) => { this.hideShortcutOrder(); console.log(that.buildType, data.status); if (data.status == 200 && that.buildType == "other") { that.showPromptModal("创建", true, "", "other"); this.getTodayNum(); } else if (data.status == 200 && that.buildType == "bb") { that.showPromptModal("创建", true, "", "bb"); this.getTodayNum(); } else if (that.buildType == "bb" && data.status == 100043) { that.showPromptModal("创建", true, data.msg); this.getOrderList(); this.getSpecimenWorkOrderMsg(); this.getTodayNum(); } else if (data.status == 1000033) { //重复建单那策略 this.repeatMsg = data.msg; this.showDelModal(postData, "specimen"); } else { that.showPromptModal("创建", false, data.msg); } }); } repeatModal: boolean = false; //删除模态框 repeatMsg = ""; loadingRepeat = false; repeatPostData; sourceType; isYuyue; showDelModal(postData, sourceType, yuyue?) { this.repeatModal = true; this.repeatPostData = postData; this.sourceType = sourceType; this.isYuyue = yuyue ? yuyue : false; } hideRepeatModal() { this.repeatModal = false; this.btnLoading = false; } confirmRepeat() { this.loadingRepeat = true; this.repeatPostData.tipsCreateOder = 1; this.mainService .postCustom( "api", this.isYuyue ? "appointmentOrder" : "startOrder", this.repeatPostData ) .subscribe((data) => { this.loadingRepeat = false; this.repeatModal = false; if (this.sourceType === "specimen") { // 标本建单 if (data.status == 200 && this.buildType == "other") { this.showPromptModal("创建", true, "", "other"); this.getTodayNum(); } else if (data.status == 200 && this.buildType == "bb") { this.showPromptModal("创建", true, "", "bb"); this.getTodayNum(); } else if (this.buildType == "bb" && data.status == 100043) { this.showPromptModal("创建", true, data.msg); this.getOrderList(); this.getSpecimenWorkOrderMsg(); this.getTodayNum(); } else { this.showPromptModal("创建", false, data.msg); } } else if (this.sourceType === "other") { // 其他建单 if (data.status == 200 && this.buildType == "other") { this.showPromptModal("创建", true, "", "other"); this.getTodayNum(); } else if (data.status == 200 && this.buildType == "bb") { this.showPromptModal("创建", true, "", "bb"); this.getTodayNum(); } else if (this.buildType == "bb" && data.status == 100043) { this.showPromptModal("创建", true, data.msg); this.getTodayNum(); } else { this.showPromptModal("创建", false, data.msg); } } else if (this.sourceType === "transport") { // 转运 if (data.status == 200) { this.showPromptModal("创建", true, ""); this.goodsLis = []; this.getOrderList(); this.getDeptTaskType(); this.getTodayNum(); } else if (data.status == 100042) { this.showPromptModal("创建", false, data.msg); this.getPatient(this.tabSearchCont); } else { this.showPromptModal("创建", false, data.msg); } } else if (this.sourceType === "accompany1") { // 陪检 if (data.status == 200) { this.showPromptModal("创建", true, ""); this.goodsLis = []; this.getOrderList(); this.getDeptTaskType(); this.getTodayNum(); } else if (data.status == 100042) { this.showPromptModal("创建", false, data.msg); this.getPatient(this.tabSearchCont); } else { this.showPromptModal("创建", false, data.msg); } } else if (this.sourceType === "accompany2") { // 陪检 if (data.status == 200) { this.showPromptModal("创建", true, ""); this.goodsLis = []; this.getOrderList(); this.getDeptTaskType(); this.getTodayNum(); } else if (data.status == 100042) { this.showPromptModal("创建", false, data.msg); this.getPatient(this.tabSearchCont); } else { this.showPromptModal("创建", false, data.msg); } } else if (this.sourceType === "accompany3") { // 陪检 if (data.status == 200) { this.showPromptModal("创建", true, ""); this.goodsLis = []; this.getOrderList(); this.getDeptTaskType(); this.getTodayNum(); } else if (data.status == 100042) { this.showPromptModal("创建", false, data.msg); this.getPatient(this.tabSearchCont); } else { this.showPromptModal("创建", false, data.msg); } } else if (this.sourceType === "accompany4") { // 陪检 if (data.status == 200) { this.showPromptModal("创建", true, ""); this.goodsLis = []; this.getOrderList(); this.getDeptTaskType(); this.getTodayNum(); } else if (data.status == 100042) { this.showPromptModal("创建", false, data.msg); this.getPatient(this.tabSearchCont); } else { this.showPromptModal("创建", false, data.msg); } } else if (this.sourceType === "accompany5") { // 陪检 if (data.status == 200) { this.showPromptModal("创建", true, ""); this.goodsLis = []; this.getOrderList(); this.getDeptTaskType(); this.getTodayNum(); } else if (data.status == 100042) { this.showPromptModal("创建", false, data.msg); this.getPatient(this.tabSearchCont); } else { this.showPromptModal("创建", false, data.msg); } } }); } // =======================end================================= // 页面中间部分tab切换 checkedTableType: string = "other"; checkTable(type) { this.checkedTableType = type; if (type === "historySpecimen") { this.getHistorySpecimen(); } else if (type === "historyDrugsbag") { this.getHistoryDrugsbag(); } else if (type === "bxlb" && this.isShowBx) { this.getBxlb(); this.getIncidentState(); this.getDegrees(); } else if (type === "kjbx" && this.isShowBx) { // this.getQuickBxlb(); this.getIncidentcategory(); // 获取报修的区域(所属院区) // this.getArea(); // this.bxForm.controls.name.setValue(this.loginUser.name); // this.bxForm.controls.phone.setValue(this.loginUser.phone); // this.bxForm.controls.address.setValue(null); this.bxForm.controls.content.setValue(null); } } //提交报修 bxLoading = false; submitBxForm() { for (const i in this.bxForm.controls) { this.bxForm.controls[i].markAsDirty(); this.bxForm.controls[i].updateValueAndValidity(); } if (this.bxForm.invalid) return; // if(!this.selectIncidentId){ // this.message.error("请选择故障现象!"); // return; // } this.bxLoading = true; this.mainService.wxbx({}).subscribe((result) => { if ((result as any).status == 200) { let bxcode = (result as any).data; //生成微信报修号 let postData = { verification: "true", incident: { branch:this.loginUser.currentHospital.id, // contacts: this.loginUser.name, deptId:this.loginUser.dept.id, // contactsInformation: this.loginUser.phone, // address: this.bxForm.controls.address.value, // areaId: this.bxForm.controls.hospital.value, // contacts: this.bxForm.controls.name.value, // contactsInformation: this.bxForm.controls.phone.value, description: this.bxForm.controls.content.value, categoryId: this.selectIncidentId, // placeId: this.bxForm.controls.building.value, requester: { account: this.loginUser.account }, sourceType: "wechatUserIncident", fileUrl: "url", bxcode, }, loginUser: { account: this.loginUser.account, id: this.loginUser.id, }, }; this.mainService.addWxIncident(postData).subscribe((res) => { this.bxLoading = false; if ((res as any).state == 200) { this.showPromptModal("提交", true, ""); this.checkTable("bxlb"); } else { this.showPromptModal("提交", false, (res as any).msg); } }); } else { this.bxLoading = false; this.showPromptModal("提交", false, ""); } }); } // 意见箱表格数据 adviceList: any = []; advicePageIndex: number = 1; //表格当前页码 advicePageSize: number = 10; //表格每页展示条数 adviceListLength: number = 10; //表格总数据量 adviceSearchInp: string = ""; //意见箱搜索 adviceLoading = false; getAdvice() { let that = this; let postData = { advice: { content: that.adviceSearchInp || "", creatDepartment: { id: that.loginUserDeptId, }, createUser: { id: that.loginUser.id, }, }, idx: that.advicePageIndex - 1 < 0 ? 0 : that.advicePageIndex - 1, sum: that.advicePageSize, }; this.adviceLoading = true; that.mainService .getFetchDataList("adviceCollection", "advice", postData) .subscribe((data) => { this.adviceLoading = false; that.adviceList = data.list || []; that.adviceListLength = data.totalNum || 0; }); } // 历史标本查询表格数据 historySpecimenList: any = []; historySpecimenPageIndex: number = 1; //表格当前页码 historySpecimenPageSize: number = 10; //表格每页展示条数 historySpecimenListLength: number = 10; //表格总数据量 historySpecimenCodeSearchInp: string = ""; //标本编码搜索 historySpecimenParentSearchInp: string = ""; //患者信息搜索 hsLoading = false; getHistorySpecimen(idx?) { if (idx) { this.historySpecimenPageIndex = 1; } let current = JSON.parse(localStorage.getItem("user")); let postData = { specimen: { hosId: this.currentHospital.id, sickRoom: { id: current.user.dept.id, }, scode: this.historySpecimenCodeSearchInp === "" ? null : this.historySpecimenCodeSearchInp, keyWord: this.historySpecimenParentSearchInp === "" ? null : this.historySpecimenParentSearchInp, }, idx: this.historySpecimenPageIndex - 1, sum: this.historySpecimenPageSize, }; this.hsLoading = true; this.mainService .getFetchDataList("simple/data", "specimen", postData) .subscribe((data) => { this.hsLoading = false; this.historySpecimenList = data.list || []; this.historySpecimenListLength = data.totalNum || 0; }); } // 历史药单查询表格数据 historyDrugsbagList: any = []; historyDrugsbagPageIndex: number = 1; //表格当前页码 historyDrugsbagPageSize: number = 10; //表格每页展示条数 historyDrugsbagListLength: number = 10; //表格总数据量 historyDrugsbagCodeSearchInp: string = ""; //发药单号搜索 // historyDrugsbagParentSearchInp: string = ""; //患者信息搜索 hsDLoading = false; getHistoryDrugsbag(idx?) { if (idx) { this.historyDrugsbagPageIndex = 1; } let current = JSON.parse(localStorage.getItem("user")); let postData = { drugsBag: { target: { id: current.user.dept.id, }, packid: this.historyDrugsbagCodeSearchInp === "" ? "" : this.historyDrugsbagCodeSearchInp, platform: 2, }, idx: this.historyDrugsbagPageIndex - 1, sum: this.historyDrugsbagPageSize, }; this.hsDLoading = true; this.mainService .getFetchDataList("api", "drugsBag", postData) .subscribe((data) => { this.hsDLoading = false; this.historyDrugsbagList = data.list || []; this.historyDrugsbagListLength = data.totalNum || 0; }); } // 报修列表查询表格数据 bxlbList: any = []; bxlbPageIndex: number = 1; //表格当前页码 bxlbPageSize: number = 10; //表格每页展示条数 bxlbListLength: number = 10; //表格总数据量 bxlbCodeSearchInp: string = ""; //标本编码搜索 bxlbParentSearchInp: string = ""; //患者信息搜索 processing: number = 0; //处理中的数量 bxlbLoading = false; getBxlb(idx?) { if (idx) { this.bxlbPageIndex = 1; } let current = JSON.parse(localStorage.getItem("user")); this.bxlbLoading = true; this.mainService .listWxIncident({ deptId: current.user.dept.id, // assignee: current.user.account, state: this.incidentStateId?parseInt(this.incidentStateId):undefined, idx: this.bxlbPageIndex - 1, sum: this.bxlbPageSize, }) .subscribe((data: any) => { this.bxlbLoading = false; this.bxlbList = data.data || []; this.bxlbListLength = data.resultCount || 0; this.processing = data.resultCount || 0; }); } //快速报修列表 quickBxlbLoading = false; quickBxlbList = []; getQuickBxlb() { this.quickBxlbLoading = true; this.mainService .fetchListBx("incidentCategoryContent", { idx: 0, sum: 10 }) .subscribe((data: any) => { this.quickBxlbLoading = false; if (data.status == 200) { this.quickBxlbList = data.list || []; } }); } // 意见箱-查看模态框 adviceModal: boolean = false; adviceDetailInfo: any = {}; //意见详情 adviceDetail(id) { this.adviceModal = true; this.mainService .getFetchData("adviceCollection", "advice", id) .subscribe((data) => { this.adviceDetailInfo = data.data; console.log(this.adviceDetailInfo); }); } hideAdvice() { this.adviceModal = false; } // 意见收集 adviceSubModal: boolean = false; adviceSubContent: string; //填写意见内容 coopAdviceInfo: any = {}; //当前编辑意见详情 addAdvice(data?) { let that = this; that.adviceSubContent = ""; if (data) { that.coopAdviceInfo = data; that.adviceSubContent = data.content; } that.adviceSubModal = true; } hideSubAdvice() { this.adviceSubModal = false; } // 提交意见内容 confirmSubAdvice() { let that = this; if (!that.adviceSubContent) return; that.btnLoading = true; let postData = { advice: { creatDepartment: { id: that.loginUserDeptId, }, createUser: { id: that.loginUser.id, }, content: that.adviceSubContent, }, }; if (that.coopAdviceInfo.id) { postData.advice["id"] = that.coopAdviceInfo.id; } that.mainService .postCustom( "adviceCollection", that.coopAdviceInfo.id ? "updData/advice" : "addData/advice", postData ) .subscribe((data) => { if (data.status == 200) { that.adviceSubModal = false; that.showPromptModal( that.coopAdviceInfo.id ? "编辑" : "新增", true, "" ); that.coopAdviceInfo = {}; that.adviceSubContent = ""; that.getAdvice(); } else { that.adviceSubModal = false; that.showPromptModal( that.coopAdviceInfo.id ? "编辑" : "新增", false, data.msg ); that.adviceSubContent = ""; } }); } // 查看标本详情 detailModel: boolean = false; loading33: boolean = false; detailList: any = []; // 选择急查或普查(1是急标,2是普标) changeSpeDetail(speDetailType: number) { this.detailModel = true; let user = JSON.parse(localStorage.getItem("user")); let postData = { deptId: user.user.dept.id, urgent: speDetailType, }; this.loading33 = true; this.mainService .postCustom("nurse", "getSpecimenWorkOrderDetails", postData) .subscribe((result) => { this.loading33 = false; if (result.status == 200) { this.detailList = result.data || []; } }); } // 隐藏查看标本详情弹层 hideSpeDetailModel() { this.detailModel = false; } // 意见删除模态框 delAdviceModal: boolean = false; delAdviceId: number; //删除意见id delAdvice(id) { this.delAdviceId = id; this.delAdviceModal = true; } confirmDelAdvice() { let that = this; that.btnLoading = true; let postData = [that.delAdviceId]; that.mainService .postCustom("adviceCollection", "rmvData/advice", postData) .subscribe((data) => { if (data.status == 200) { that.delAdviceModal = false; that.showPromptModal("删除", true, ""); if ( that.adviceList.length == 1 && that.advicePageIndex == Math.ceil(that.adviceListLength / that.advicePageSize) ) { that.adviceListLength--; that.advicePageIndex = Math.ceil( that.adviceListLength / that.advicePageSize ); } that.getAdvice(); } else { that.delAdviceModal = false; that.showPromptModal("删除", false, data.msg); } }); } hideDelAdviceModal() { this.delAdviceModal = false; } // 工单列表下拉筛选 selectedType: null; changeOrderSel(e) { this.selectedType = e; this.getOrderList(); } // 工单列表工单状态下拉筛选 changeOrderState(e) { this.getOrderList(); } // 工单列表 orderList: any = []; orderIdx: number = 1; orderLength: number = 10; OLoading: boolean = true; getOrderList() { let that = this; that.orderList = []; that.OLoading = true; let postData: any = { workOrder: { createDept: JSON.parse(localStorage.getItem("user")).user.dept.id, platform: 2, searchDays: 2, taskType: {}, }, idx: that.orderIdx - 1, sum: 10, }; if (that.selectedType && that.selectedType != -1) { postData.workOrder.taskType["associationType"] = { id: that.selectedType, }; } // 执行中包含状态:待抢单、待接单、待到达、待送达、执行中、定时预约 if (that.orderStateSelected == "1") { //执行中 delete postData.workOrder.gdState; postData.workOrder.nurseState = 1; } else if (that.orderStateSelected == "2") { //待评价 delete postData.workOrder.nurseState; postData.workOrder.gdState = { id: "73" }; } else { //全部 delete postData.workOrder.nurseState; delete postData.workOrder.gdState; } that.mainService .getFetchDataList("nurse", "workOrder", postData) .subscribe((data) => { that.orderList = data.list || []; //显示三项 that.orderList.forEach((item) => { if (item.record.length > 2) { let i = item.record .reverse() .findIndex((step) => step.record.length > 0); item.record.reverse(); i = item.record.length - 1 - i; if (i < 2) { item.record = item.record.slice(0, 3); } else if (i > item.record.length - 2) { item.record = item.record.slice( item.record.length - 3, item.record.length ); } else { item.record = item.record.slice(i - 1, i + 2); } } }); that.orderLength = data.totalNum || 0; that.OLoading = false; }); } // 撤销 coopId: number; recallOrderModal: boolean = false; // 打开撤销模态框 openRecallModal(id) { this.coopId = id; this.recallOrderModal = true; } // 确认撤销 confirmRec() { let that = this; that.btnLoading = true; that.mainService.delOrder(that.coopId).subscribe((data) => { that.closeRecallOrderModal(); if (data.status == 200) { that.getOrderList(); that.changeInfo(); this.getTodayNum(); that.showPromptModal("撤销", true, ""); } else { that.showPromptModal("撤销", false, data.msg); } }); } // 关闭撤销模态框 closeRecallOrderModal() { this.recallOrderModal = false; } // 评价 appraiseModal: boolean = false; starNum: number = 5; //评价星 appraiseContent: string = ""; //评级 appraiseId: number; showAppraise(id) { this.appraiseId = id; this.appraiseModal = true; this.starNum = 5; this.appraiseContent = ""; } // 保存评价 confirmAppraise() { console.log(this.starNum, this.appraiseContent); let that = this; if (!that.starNum) return; that.btnLoading = true; let id; switch (that.starNum) { case 1: id = 358; break; case 2: id = 357; break; case 3: id = 356; break; case 4: id = 355; break; case 5: id = 354; break; } let postData = { serviceEvaluation: { id: id }, remark: that.appraiseContent, }; this.mainService .postCustom("nurse/workOrder", "evaluate/" + this.appraiseId, postData) .subscribe((data) => { that.hideAppraise(); if (data.status == 200) { that.getOrderList(); that.showPromptModal("评价", true, ""); } else { that.showPromptModal("评价", false, data.msg); } }); } hideAppraise() { this.appraiseModal = false; } // 报修评价 appraiseModalBx: boolean = false; starNumBx: number = 5; //评价星 appraiseContentBx: string = ""; //评级 appraiseIdBx: number; showAppraiseBx(id) { this.appraiseIdBx = id; this.appraiseModalBx = true; this.starNumBx = 5; this.appraiseContentBx = ""; } // 保存评价 confirmAppraiseBx() { console.log(this.starNumBx, this.appraiseContentBx); if (!this.starNumBx) return; this.btnLoading = true; let id = this.degrees.find(v=>v.value == this.starNumBx).id; let postData = { degree: id, degreeRemark: this.appraiseContentBx, id: this.appraiseIdBx, }; this.mainService .degree(postData) .subscribe((data:any) => { this.hideAppraiseBx(); if (data.state == 200) { this.getBxlb(); this.showPromptModal("评价", true, ""); } else { this.showPromptModal("评价", false, ""); } }); } hideAppraiseBx() { this.appraiseModalBx = false; } // 审核状态 checkStatusLis: any = []; getCheckStatusLis() { let that = this; that.mainService.getDictionary("list", "check_status").subscribe((data) => { that.checkStatusLis = data; }); } // 填写加急原因模态框 jiajiModal: boolean = false; jiajiContent: string; //加急原因 jiajiId; //加急工单id showJiaji(id) { this.jiajiId = id; this.jiajiModal = true; this.jiajiContent = ""; } hideJiaji() { this.jiajiModal = false; } // 保存加急原因 confirmJiaji() { let that = this; let checkStatusId; if (!that.jiajiContent) return; that.btnLoading = true; that.checkStatusLis.forEach((e) => { if (e.value == 1) { checkStatusId = e.id; } }); let postData = { urgentDetails: { workerOrder: that.jiajiId, checkStatus: { id: checkStatusId }, urgentReason: that.jiajiContent, }, }; that.mainService .postCustom("workerOrder", "urge", postData) .subscribe((data) => { if (data.status == 200) { that.showPromptModal("加急", true, ""); that.getOrderList(); that.hideJiaji(); } else { that.showPromptModal("加急", false, data.msg); } }); } // 查看工单详情 openDetails(data) { if (data.taskType.associationType.value == 'specimen' || data.taskType.associationType.value == 'specimenPlan') { // 标本类 this.router.navigateByUrl("nurse/detailSample/" + data.id); } else if (data.taskType.associationType.value == 'inspect' || data.taskType.associationType.value == 'patientTransport') { // 送患者 this.router.navigateByUrl("nurse/detailPatients/" + data.id); } else if (data.taskType.associationType.value == 'drugsBag' || data.taskType.associationType.value == 'jPBag') { // 药品配送/静配 this.router.navigateByUrl("nurse/detailDrug/" + data.id); } else if (data.taskType.associationType.value == 'ordinary' && data.taskType.ordinaryField.value == 'blood') { // 万能交接服务&&血制品 this.router.navigateByUrl("nurse/detailBlood/" + data.id); } else { // 其他 this.router.navigateByUrl("nurse/detailOthers/" + data.id); } } // 派单 allotWorker(id, stateId) { this.router.navigateByUrl("nurse/allotWorker/" + id + "/" + stateId); } // 展示信息提示框(con:提示信息,success:操作是否成功,promptInfo:操作结果提示信息) showPromptModal(con, success, promptInfo?, back?) { this.btnLoading = false; this.btnLoading1 = false; this.promptModalShow = false; this.promptContent = con; this.ifSuccess = success; this.promptInfo = promptInfo; this.back = back; setTimeout(() => { this.promptModalShow = true; }, 100); } // 回到系统管理 toMain() { this.router.navigateByUrl("main"); } // 查看工单 toOrder() { this.router.navigateByUrl(`main/orderManagement`); } // 退出 logOut(): void { let that = this; // 假退出 localStorage.removeItem("user"); localStorage.removeItem("menu"); localStorage.removeItem("phones"); localStorage.removeItem("index"); that.router.navigateByUrl("login"); // 假退出 that.mainService.logOut().subscribe((data) => { if (data.status == 200) { localStorage.removeItem("user"); localStorage.removeItem("menu"); localStorage.removeItem("phones"); localStorage.removeItem("index"); that.router.navigateByUrl("login"); } }); } // 格式化时分秒 // (时间小于一分钟则显示秒,时间大于一分钟则显示分钟数,如超出一小时则显示小时和分钟。)time单位:秒 formatTime(time) { let timeStr = ""; if (time >= 0 && time < 60) { // 秒 timeStr = time + "秒"; } else if (time >= 60 && time < 3600) { // 分钟 timeStr = Math.floor(time / 60) + "分钟"; } else if (time >= 3600) { // 时 + 分 let h = ""; let m = ""; h = Math.floor(time / 3600) + "小时"; m = time % 3600 >= 60 ? Math.floor((time % 3600) / 60) + "分钟" : ""; timeStr = h + m; } return timeStr; } // 计算历史记录耗时 filterTime(step) { let num = 0; step.forEach((e) => { num += e.difTime; }); return this.formatTime(num / 1000); } // 截取意见内容(ie内核截取) spliceContent(con) { if (con.length >= 41 && navigator.userAgent.indexOf("Trident") > -1) { return con.slice(0, 41) + "..."; } else { return con; } } @ViewChild("msgTemplate", { static: false }) msgTemplate: TemplateRef; //消息通知模板 // 消息提醒 createBasicNotification(msgs): void { this.notification.template(this.msgTemplate, { nzDuration: 0, nzData: msgs, }); } isShowNurseCode = false; //是否展开科室二维码 nurseCodeImg = ""; //图片 refreshQRCodeTime = 0; //刷新时间间隔 // 关闭科室二维码 closeNurseCode() { this.isShowNurseCode = false; clearInterval(this.timer); this.timer = null; } // 展开科室二维码 timer = null; showNurseCode() { this.isShowNurseCode = true; this.mainService.getDeptCode([this.loginUserDeptId]).subscribe((data) => { if (data["status"] == 200) { this.nurseCodeImg = data["data"][0].base64; this.refreshQRCodeTime = data["data"][0].refreshQRCodeTime; clearInterval(this.timer); this.timer = setInterval(() => { this.refreshQRCodeTime = Math.max(--this.refreshQRCodeTime, 0); if (this.refreshQRCodeTime === 0) { clearInterval(this.timer); this.showNurseCode(); } }, 1000); } }); } // 右侧菜单 showLastItems: boolean = false; // 下拉 fixedMenuXiala() { this.showLastItems = true; } // 上拉 fixedMenuShangla() { this.showLastItems = false; } mainRole: boolean = false; //回到系统管理权限 mainRoleBtnName = "回到系统管理"; //回到系统管理名字 initRole() { let menus = JSON.parse(localStorage.getItem("menu")); console.log("菜单数量" + menus.length); if (menus.length >= 2) { this.mainRole = true; return; } } // 切换右侧菜单Tab fixedTab: string = ""; checkFixedTab(type: string) { if (type == "toSystem") { this.router.navigateByUrl("main"); } if (this.fixedTab == type) { this.fixedTab = ""; } else { this.fixedTab = type; } } //子传父接收 closeModelHs(e) { this.hsPromptModalShow = JSON.parse(e).show; this.changeShow = JSON.parse(e).changeShow; } //子传父接收 clearModelHs(e) { if (JSON.parse(e).clear === true) { clearInterval(this.timerCloseTime); } this.changeShow = JSON.parse(e).changeShow; } // 头部切换科室 changeKsNow() { this.hsPromptModalShow = true; clearInterval(this.timerCloseTime); this.changeShow = false; } }