1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389 |
- 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 { WebsocketService } from "../../services/websocket.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,
- } from "date-fns";
- // 日期禁用
- 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("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;
- othersListOptions: any;
- sortableTimer = null;
- searchTabInpSubject = new Subject(); //左侧查患者信息和检查信息防抖
- otherSearchChangeSubject = 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: WebsocketService,
- 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.sortTaskType(postData).subscribe((result) => {});
- }, 500);
- },
- };
- }
- // 关闭倒计时
- closeTime = 3;
- timerCloseTime = null;
- changeShow = true;
- currentHospital; //当前院区
- logTimer = null; //综合日志定时器
- logTime = 0; //综合日志自动刷新秒数
- logTimeConst = 30; //综合日志自动刷新秒数
- ngOnInit() {
- //防抖
- this.searchTabInpSubject.pipe(debounceTime(500)).subscribe((v) => {
- this.getPatient(v);
- });
- this.otherSearchChangeSubject.pipe(debounceTime(500)).subscribe((v) => {
- this.getDeptTaskType(v);
- });
- this.currentHospital = this.tool.getCurrentHospital();
- this.changeKs();
- this.initLogin();
- this.getDeptTaskType();
- this.initForm();
- this.getAdvice();
- this.getHistorySpecimen();
- this.getOrderSelectList();
- this.getCheckStatusLis();
- this.refreshSpecimenWorkOrderMsg();
- this.initRole();
- this.getWebsocket();
- this.listDeptOrderRecord();
- this.logTime = this.logTimeConst;
- clearInterval(this.logTimer);
- this.logTimer = setInterval(() => {
- this.logTime--;
- if (this.logTime === 0) {
- this.logTime = this.logTimeConst;
- this.listDeptOrderRecord();
- }
- }, 1000);
- }
- ngOnDestroy() {
- console.log("关闭护士端", this.webs.ws);
- clearInterval(this.moveId);
- clearInterval(this.moveId1);
- clearInterval(this.msgTimerId);
- clearInterval(this.logTimer);
- this.webs.closeWs();
- }
- 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 = true; //护士端科室切换提示框是否展示
- 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 = {}; //药品静配提示信息
- btnLoading: boolean = false; //确认按钮loading状态
- workOrderRemark = ""; //备注
- workOrderRemarkTips = ""; //备注提示
- customRemarks = []; //备注快速输入
- // 添加备注
- addRemarks(item) {
- this.remarksEle.nativeElement.focus();
- this.workOrderRemark += item;
- }
- //获取综合日志
- rLoading = false;
- listDeptOrderRecords: any = [];
- listDeptOrderRecord() {
- this.rLoading = true;
- this.mainService
- .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;
- }
- // 护士端患者信息列表,鼠标移入姓名展示最近一条检查信息
- recentInfo = "";
- recentInfoTimer = null;
- recentInfoNum = 0;
- isRemand = true; //自动送回
- yyTime = null; //预约时间-患者列表
- yyTimeZy = null; //预约时间-患者列表-患者其他服务
- yyDate = null; //预约日期-陪检
- yyDateZy = null; //预约日期-转运
- getRecentInfo(patientCode) {
- this.recentInfo = "";
- clearTimeout(this.recentInfoTimer);
- this.recentInfoTimer = setTimeout(() => {
- this.recentInfoNum++;
- this.mainService.getRecentInfo({ 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: {
- 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");
- }
- //搜索
- otherNum = 0;
- otherSearchChange() {
- this.otherSearchChangeSubject.next(this.otherSearch);
- }
- // 切换科室
- changeKs() {
- this.hsPromptModalShow = true;
- this.closeTime = 3;
- clearInterval(this.timerCloseTime);
- this.timerCloseTime = setInterval(() => {
- this.closeTime = Math.max(--this.closeTime, -1);
- if (this.closeTime === -1) {
- 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() {
- let that = this;
- that.mainService
- .postCustom("nurse", "getSpecimenWorkOrderMsg", {
- deptId: JSON.parse(localStorage.getItem("user")).user.dept.id,
- })
- .subscribe((data) => {
- that.specimenWorkOrderMsg = data;
- });
- }
- // 药品静配提示信息
- drugJpLoading = true;
- getJpDrugsWKOMsg() {
- let that = this;
- 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.changeFollow(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, "");
- }
- );
- }
- // 获取当前登录人科室任务类型信息
- 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) {
- // 陪检权限
- 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.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.id == 259) {
- that.othersList.push(e);
- } else if (e.associationType.id == 256) {
- that.bbMsg = e;
- } else if (
- e.associationType.id == 255 ||
- e.associationType.id == 260
- ) {
- 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 = {
- idx: 0,
- sum: 50,
- department: {
- searchType: 1,
- },
- };
- 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 || "";
- }
- 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) return;
- this.infoPageIdx = 1;
- this.getPatient();
- }
- // 获取患者信息
- snum = 0;
- getPatient(e?) {
- let that = this;
- that.pLoading = true;
- let postData = {
- idx: that.infoPageIdx - 1,
- sum: 9999,
- };
- // 患者信息
- postData["patient"] = {
- keyWord: e ? e : that.tabSearchCont,
- };
- postData["patient"]["department"] = { id: that.loginUserDeptId };
- this.snum++;
- that.mainService
- .getFetchDataList("nurse", "patient", postData)
- .subscribe((data) => {
- this.snum--;
- if (data.list.length > 0) {
- data.list.forEach((item) => {
- if (item.focusPatient === undefined) {
- item.focusPatient = 0;
- }
- });
- }
- that.patientList = data.list || [];
- if (this.snum === 0) {
- that.pLoading = false;
- }
- that.infoLength = data.totalNum || 0;
- });
- }
- // tab输入搜索节流阀
- searchTabInp(e) {
- if (!this.deptTaskTypeRules.openInspection) 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();
- } 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 = []; //携带设备
- allowUrgent: any = "0"; //加急
- urgentReason: any = ""; //加急原因
- // 初始化form表单
- initForm() {
- // 初始化患者信息一键建单表单
- this.patientForm = this.fb.group({
- checkedType: [null, [Validators.required]],
- goods: [null],
- linkCheck: [null, []],
- targetOffice: [null, [this.targetOfficeValidator]],
- originOffice: [null, [this.originOfficeValidator]],
- allowUrgent: [null], //加急
- urgentReason: [null], //加急原因
- });
- // 初始化一键发起建单表单
- 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]],
- });
- }
- //创建自定义校验规则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 };
- }
- };
- // 患者信息一键建单
- patientModal: boolean = false; //患者信息一键建单模态框
- patientMsg; //患者信息
- // 打开患者信息一键建单模态框
- maskFlag: any = false;
- newPatientOrder(msg) {
- this.yyTime = null;
- this.yyTimeZy = null;
- 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;
- // 默认选中患者陪检
- that.checkTypeLis.forEach((e) => {
- if (e.associationType.value == "inspect") {
- that.patientForm.controls.checkedType.setValue(e.id);
- that.patientForm.value.checkedType = e.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.id == 255
- );
- });
- //预约时间-患者陪检不能为空
- 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: {
- 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 (
- (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.patientForm.value.linkCheck &&
- that.patientForm.value.linkCheck.length
- ) {
- that.patientForm.value.linkCheck.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;
- 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.patientForm.value.linkCheck &&
- 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();
- } else if (data.status == 100042) {
- that.showPromptModal("创建", true, data.msg);
- } 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();
- } else if (data.status == 100042) {
- this.showPromptModal("创建", true, data.msg);
- } 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();
- } 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();
- } else if (data.status == 100042) {
- this.showPromptModal("创建", true, data.msg);
- } 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();
- } else {
- this.showPromptModal("创建", false, data.msg);
- }
- });
- }
- }
- // 切换患者送检检查项目
- checkedShowMsg: any = {}; //患者送检检查项目对应展示信息
- current_allowUrgent = false; //当前任务类型是否允许加急
- currentTasktype; //当前选中的任务类型对象
- cLoading = false;
- changeCheckedType() {
- 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.id == 255
- );
- if (appointmentZyBuildFlag.length) {
- this.appointmentZyBuildFlag =
- appointmentZyBuildFlag[0].appointmentOtherSwitch == 1 ? "1" : "0";
- 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.appointmentZyBuildFlag = "0";
- }
- 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,
- });
- });
- }
- that.linkCheckLis = [];
- if (data.status == 200 && data.data && data.data.length) {
- let arr = [];
- data.data.forEach((e) => {
- arr.push({
- yyTime: e.yyTime,
- priority: e.priority,
- label:
- (e.yyTime || "") +
- " " +
- e.execDept.dept +
- " 进行 " +
- (e.inspectName || "检查"),
- value: e["id"],
- checked: false,
- });
- });
- that.linkCheckLis = arr;
- }
- });
- }
- // 需要预约建单-事件
- yyInspectChange(e) {
- if (this.filterLinkCheckLis.length) {
- this.showDateTime();
- } else {
- this.yyTime = null;
- this.yyDate = null;
- console.log(this.isYyInspect);
- }
- }
- //回显时间日期
- 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 = []; //有预约时间并且选中的
- linkCheckLisChange(e) {
- console.log(e, this.linkCheckLis);
- let flag = false; //检查是否紧急
- this.linkCheckLis.forEach((item) => {
- if (e.length) {
- //有选中的检查
- e.forEach((v) => {
- //检查是否有紧急度
- if (v.priority == 1) {
- flag = true;
- }
- //选中的检查设置checked
- item.checked = v.value == item.value;
- });
- } else {
- item.checked = false;
- }
- });
- //检查有紧急度,则加急
- 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.isYyInspect = this.filterLinkCheckLis.every((item) => {
- return (
- new Date(item.yyTime).getTime() - new Date().getTime() >
- this.leadTime * 60 * 1000
- );
- });
- 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) {
- 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; //一键发起建单表单
- // 一键建单校验
- // 起点科室校验
- 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: {
- 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");
- } else if (data.status == 200 && that.buildType == "bb") {
- that.showPromptModal("创建", true, "", "bb");
- } else if (that.buildType == "bb" && data.status == 100043) {
- that.showPromptModal("创建", true, data.msg);
- } else {
- that.showPromptModal("创建", false, data.msg);
- }
- });
- }
- // ======================start===============================
- // 快捷一键发起建单
- shortcutModal: boolean = false; //检查信息一键建单模态框
- shortcutMsg1; //一键发起信息
- buildMsg1: any = {}; //一键发起返回信息
- urgentFlag = false;
- // 打开一键发起建单模态框,urgent为true的时候是紧急
- newShortcutOrder1(msg, type, urgent?) {
- 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.mainService
- .postCustom("nurse", "workOrder/buildTrip", postData)
- .subscribe((data) => {
- this.shortcutModal = true;
- this.buildMsg1 = data;
- });
- }
- 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: {
- 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");
- } else if (data.status == 200 && that.buildType == "bb") {
- that.showPromptModal("创建", true, "", "bb");
- } else if (that.buildType == "bb" && data.status == 100043) {
- that.showPromptModal("创建", true, data.msg);
- this.getOrderList();
- this.getSpecimenWorkOrderMsg();
- } else {
- that.showPromptModal("创建", false, data.msg);
- }
- });
- }
- // =======================end=================================
- // 页面中间部分tab切换
- checkedTableType: string = "other";
- checkTable(type) {
- this.checkedTableType = type;
- }
- // 意见箱表格数据
- 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;
- });
- }
- // 意见箱-查看模态框
- 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();
- 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;
- }
- // 审核状态
- 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(id, typeId) {
- if (typeId == 256 || typeId == 380) {
- // 标本类
- this.router.navigateByUrl("nurse/detailSample/" + id);
- } else if (typeId == 260 || typeId == 255) {
- // 患者陪检/患者转运
- this.router.navigateByUrl("nurse/detailPatients/" + id);
- } else if (typeId == 257 || typeId == 258) {
- // 药品配送/静配
- this.router.navigate(["nurse/detailDrug/" + id]);
- } else {
- // 其他
- this.router.navigateByUrl("nurse/detailOthers/" + 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");
- }
- // 退出
- 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<any>; //消息通知模板
- // 消息提醒
- 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; //回到系统管理权限
- initRole() {
- let menus = JSON.parse(localStorage.getItem("menu"));
- let that = this;
- console.log("菜单数量" + menus.length);
- if (menus.length >= 2) {
- that.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;
- }
- }
|