123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932 |
- import { Component, OnInit, ViewChild, OnDestroy } from "@angular/core";
- import { MainService } from "../../services/main.service";
- import { Router } from "@angular/router";
- import { OverlayScrollbarsComponent } from "overlayscrollbars-ngx";
- import { startOfDay, format, endOfDay } from "date-fns";
- import { ToolService } from 'src/app/services/tool.service';
- import { NzMessageService } from "ng-zorro-antd";
- import { debounceTime } from 'rxjs/operators';
- import { Subject } from 'rxjs';
- import {
- FormBuilder,
- Validators,
- FormGroup,
- FormControl,
- } from "@angular/forms";
- @Component({
- selector: "app-specimen-room-view",
- templateUrl: "./specimen-room-view.component.html",
- styleUrls: ["./specimen-room-view.component.less"],
- })
- export class SpecimenRoomViewComponent implements OnInit, OnDestroy {
- @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("osComponentRef5", {
- read: OverlayScrollbarsComponent,
- static: false,
- })
- osComponentRef5: OverlayScrollbarsComponent;
- constructor(
- private mainService: MainService,
- public router: Router,
- public tool: ToolService,
- private fb: FormBuilder,
- private message: NzMessageService,
- ) {}
- // 今日药单量
- todayTotal: undefined;
- // 今日已完成
- todayComplete: undefined;
- //手术间数据
- printPharmacyList = []; //数据列表
- printPharmacyIdx = 0; //页码
- printPharmacyTotal = 0; //总数
- printPharmacyFlag = false; //是否查看更多
- printPharmacySearchKey = ""; //搜索的内容
- printPharmacyLoad = false; //按钮的loading
- // 标本间列表
- waitPharmacyList = [];
- waitPharmacyIdx = 0;
- waitPharmacyTotal = 0;
- waitPharmacyFlag = false;
- waitPharmacySearchKey = "";
- waitPharmacyLoad = false;
- // 今日离科列表
- pharmacyList = [];
- pharmacyIdx = 0;
- pharmacyTotal = 0;
- pharmacyFlag = false;
- pharmacySearchKey = "";
- pharmacyLoad = false;
- // 配送中列表
- distributionList = [];
- distributionIdx = 0;
- distributionTotal = 0;
- distributionFlag = false;
- distributionSearchKey = "";
- distributionLoad = false;
- // 已完成列表
- completedList = [];
- completedIdx = 0;
- completedTotal = 0;
- completedFlag = false;
- completedSearchKey = "";
- completedLoad = false;
- barCode:any; //条码搜索
- // other
- loginUser: any = localStorage.getItem("user")
- ? JSON.parse(localStorage.getItem("user")).user
- : null; //登录人信息
- logTimer = null; //定时器
- logTime = 0; //自动刷新秒数
- logTimeConst = 60; //自动刷新秒数
- time = new Date().getTime(); // 时间戳
- timer = null; // 时间定时器
- relevanceModal:boolean = false //关联标本和手术室
- validateForm: FormGroup; //关联标本和手术室表单
- validateVerificationForm: FormGroup; //核验标本
- specimenData:any = []; //标本间数据
- operationData:any = []; //手术间数据
- fixationModal:boolean = false //标本接收固定
- verificationMoadl:boolean = false //标本核验
- specimenCode:any; //标本条码
- listOfData:any=[];
- fixativeData:any = []; //固体液类型
- hosId:any;
- userId:any;
- detailsData:any;
- isSpinning:boolean = false; //全屏加载状态
- codeData:any; //标本条码数据
- btnInfoLoading :boolean = false; //标本加固加载
- searchMsg:any = null;
- changeInpSubject = new Subject(); //防抖
- changeInpSubjectSpecimen = new Subject(); //防抖
- ngOnDestroy() {
- clearTimeout(this.timer);
- clearTimeout(this.logTimer);
- }
- ngOnInit() {
- this.changeInpSubject.pipe(debounceTime(500)).subscribe((v) => {
- this.searchSpecimenData(v[0])
- });
- this.changeInpSubjectSpecimen.pipe(debounceTime(500)).subscribe((v) => {
- this.searchSpecimen(v[0])
- });
- this.hosId = this.tool.getCurrentHospital().id;
- this.userId = this.tool.getCurrentUserId()
- this.runTime();
- // 统计
- // this.total();
- this.getDept()
- // 切换科室
- // this.changeKs();
- this.initRole();
- // 自动刷新倒计时 start
- this.autoUpdate();
- // 自动刷新倒计时 end
- setTimeout(_=>{
- document.getElementById('Binput').focus();
- },200)
- }
- // 当前时间日期
- runTime() {
- clearTimeout(this.timer);
- this.timer = setTimeout(() => {
- this.time = Date.now();
- this.runTime();
- }, 500);
- }
- // 标本条码搜索
- searchSpecimen(e){
- if(!this.barCode){
- return
- }
- if(this.barCode.length < 10) {
- return
- }
- let data={
- barcode:e
- }
- this.isSpinning = true
- clearInterval(this.logTimer);
- this.mainService.pathologyScanCode(data)
- .subscribe((res:any) => {
- this.isSpinning = false
- if(res.status==200){
- this.codeData = res.data[0]
- let item = this.codeData.pathologySpecimenDTOList.find(i=>i.specimenCode == e)
- console.log(7,item)
- if(!item.fixationTime && this.codeData.pathologyFormType==0){
- if(this.codeData.status.value==2 || this.codeData.status.value==3 ||
- this.codeData.status.value==4){
- if(this.codeData.pathologyInspectDTOS){
- this.project = this.codeData.pathologyInspectDTOS.map(i=>{
- return i.inspectProject.name
- })
- this.project = this.project.join('、')
- }
- this.getFixationNum(this.codeData.id)
- }else{
- this.viewDetail(this.codeData,'4')
- }
- this.fixationError = null
- this.searchMsg = null
- }else if(item.fixationTime && this.codeData.pathologyFormType==0){
- this.viewDetail(this.codeData,'4')
- this.barCode = null
- this.fixationError = null
- this.searchMsg = null
- }else{
- this.barCode = null
- this.fixationError = null
- this.searchMsg = '该申请单类型不是病理检查申请单'
- }
-
- }else{
- this.barCode = null
- this.searchMsg = res.msg
- }
- })
- }
-
- // 获取申请单扫标本信息
- fixationNum:any;
- specimenNum:any;
- totalNum:any
- getFixationNum(id){
- this.mainService.pathologyCheckPrint('pathologyForm',id,{
- operationType:'fixation'
- }).subscribe((res:any)=>{
- this.fixationModal = true
- this.fixationNum = res.fixationNum
- this.specimenNum = res.specimenNum
- this.totalNum = res.totalNum
- setTimeout(_=>{
- document.getElementById('specimen').focus();
- },200)
- })
- }
-
- // 选择固定时间
- formChangeDate(result){
- this.startDate = format(result, 'yyyy-MM-dd HH:mm:ss');
- }
- // 确定接受固定标本
- startDate:any;
- submitFixationForm(){
- this.validateVerificationForm = this.fb.group({
- fixationTime: [null, [Validators.required]],
- jobNumber: [null, [Validators.required]],
- name:[null, [Validators.required]],
- fixative:[null, [Validators.required]],
- });
- let date = new Date();
- this.startDate = format(date, "yyyy-MM-dd HH:mm:ss")
- this.validateVerificationForm.controls.fixationTime.setValue(this.startDate);
- this.btnLoading = true
- this.mainService.getDictionary("list", "fixing_liquid_type").subscribe((res) => {
- this.fixativeData = res
- this.btnLoading = false
- this.verificationMoadl = true
- });
- }
- // 关闭接受固定标本
- hideSpecimenModal(){
- this.autoUpdate()
- this.cancelSpecimenModal()
- this.barCode = null;
- this.specimenCode = null;
- this.fixationError = null
- this.fixationModal = false;
- setTimeout(_=>{
- document.getElementById('Binput').focus();
- },200)
- }
-
- cancelSpecimenModal(){
- let ids = []
- for(let i of this.codeData.pathologySpecimenDTOList){
- ids.push(i.id)
- }
- let data = {
- pathologySpecimenIds:ids.join(',')
- }
- this.mainService.pathologyOperation(data,'cancel').subscribe((res) =>{
-
- })
- }
-
- // 获取标本详情
- project:any = [];
- getSampleData(item){
- this.mainService.getFetchData("data", "pathologyForm", item.id)
- .subscribe((data) => {
- this.isSpinning = false
- this.detailsData = data.data
- this.specimenList = data.data.pathologySpecimenDTOList||[]
- this.pathologyLogs = data.data.formLogDTOS
- this.stepLength = this.pathologyLogs.length
- if(this.detailsData.pathologyInspectDTOS){
- this.project = this.detailsData.pathologyInspectDTOS.map(i=>{
- return i.inspectProject.name
- })
- this.project = this.project.join('、')
- }
- this.detailMoadl = true
- });
- }
-
- // 关闭查看标本
- closeSpecimenModal(){
- this.specimenViewDialog = false
- }
-
- // 查看标本
- specimenViewDialog:any = false;
- viewData:any = [];
- specimenItem:any;
- specimenView(item){
- this.viewData = []
- this.specimenViewDialog = true
- this.specimenItem = item;
- this.viewData.push(item)
- }
-
- // 获取科室
- getDept(){
- this.setSpecimen()
- var that = this;
- that.mainService.getDictionary("list", "dept_type").subscribe((res2) => {
- let item1 = res2.find(i=>i.name=='手术室科室')
- let item2 = res2.find(i=>i.name=='标本间科室')
- let data1 = {
- idx: 0,
- sum: 9999,
- department: {
- hospital: { id: that.hosId || "" },
- type: { id: item1.id || "" },
- },
- };
- let data2 = {
- idx: 0,
- sum: 9999,
- department: {
- hospital: { id: that.hosId || "" },
- type: { id: item2.id || "" },
- },
- };
- that.mainService
- .getFetchDataList("data", "department", data1)
- .subscribe((res) => {
- that.operationData = res.list;
- });
- that.mainService
- .getFetchDataList("data", "department", data2)
- .subscribe((res) => {
- that.specimenData = res.list
- this.getDeptDetail()
- });
- });
- }
- // 获取关联科室详情
- getDeptDetail(){
- this.mainService
- .transfusionPrint("user", this.userId)
- .subscribe((res) => {
- let data = res.data;
- if(data.surgeryDepts){
- let deptArr = []
- for(let i of data.surgeryDepts){
- deptArr.push(i.id)
- }
- this.validateForm.controls.operation.setValue(deptArr);
- }
- this.validateForm.controls.specimen.setValue(data.dept.id);
- if(data.autoCreateOrder){
- this.validateForm.controls.generate.setValue(data.autoCreateOrder);
- }
- });
- }
- // 获取是否关联标本间
- setSpecimen(){
- if(this.validateForm){
- this.validateForm = this.fb.group({
- specimen: [this.validateForm.value.specimen, [Validators.required]],
- operation: [this.validateForm.value.operation, [Validators.required]],
- generate:[this.validateForm.value.generate, [Validators.required]],
- });
- }else{
- this.validateForm = this.fb.group({
- specimen: [null, [Validators.required]],
- operation: [null, [Validators.required]],
- generate:[1, [Validators.required]],
- });
- }
- this.relevanceModal = true
- }
- // 确定关联科室
- btnLoading:boolean = false;
- submitForm(){
- for (const i in this.validateForm.controls) {
- this.validateForm.controls[i].markAsDirty();
- this.validateForm.controls[i].updateValueAndValidity();
- }
- if (this.validateForm.invalid) return;
- let deptArr = this.validateForm.value.operation.join(',')
- let data = {
- user: {
- autoCreateOrder: this.validateForm.value.generate,
- dept:{
- id:this.validateForm.value.specimen
- },
- surgeryDeptIds:deptArr,
- id:this.userId
- },
- };
- this.btnLoading = true
- this.mainService
- .coopData("updData", "user", data)
- .subscribe((data) => {
- this.getNewDept()
- // 手术间列表
- this.getPharmacyList(this.printPharmacyIdx, 'surgeryDept', this.printPharmacySearchKey);
- // 标本间列表
- this.getPharmacyList(this.waitPharmacyIdx, 'specimenDept', this.waitPharmacySearchKey);
- // 今日离科标本列表
- this.getPharmacyList(this.pharmacyIdx, 'leavedDept', this.pharmacySearchKey);
- this.btnLoading = false
- this.relevanceModal = false
- if (data.status == 200) {
- this.showPromptModal("操作", true, "");
- } else {
- this.showPromptModal("操作", false, data.msg);
- }
- });
- }
- getNewDept(){
- let postData = {
- currentHosId: this.hosId,
- loginType: "PC",
- };
- this.mainService.changeHospital(postData).subscribe((result) => {
- if (result.status == 200) {
- let dataObj = {
- user: {
- dept: {
- id: this.validateForm.value.specimen,
- },
- id: JSON.parse(localStorage.getItem("user")).user.id,
- },
- };
- this.mainService
- .coopData("updData", "user", dataObj)
- .subscribe((data) => {
- if (data.status == 200) {
- this.getCurrentUserNow();
- }
- });
- }
- });
- }
- // 获取当前用户信息
- getCurrentUserNow() {
- this.mainService.getCurrentUser1().subscribe((data:any) => {
- if (data["status"] == 200) {
- this.loginUser = data.data
- let user = JSON.parse(localStorage.getItem("user"));
- user.user.dept = data["data"].dept;
- user.user.currentHospital = data["data"].currentHospital;
- localStorage.setItem("user", JSON.stringify(user));
- }
- });
- }
- // 输入工号查询姓名
- handoverUserId:any = null;
- numberChange(e){
- if(e.length < 3) {
- this.validateVerificationForm.controls.name.setValue('');
- return
- }
- let query = {
- account: e
- };
- this.mainService
- .jobSearch(query)
- .subscribe((data:any) => {
- if(data.status==200){
- this.validateVerificationForm.controls.name.setValue(data.userName);
- this.handoverUserId = data.userId
- }else{
- this.validateVerificationForm.controls.name.setValue('');
- this.handoverUserId =null
- // this.message.error(data.data)
- }
- });
- }
- // 提交固定标本接收
- submitVerificationForm(){
- for (const i in this.validateVerificationForm.controls) {
- this.validateVerificationForm.controls[i].markAsDirty();
- this.validateVerificationForm.controls[i].updateValueAndValidity();
- }
- if (this.validateVerificationForm.invalid) return;
- let str = this.codeData.pathologySpecimenDTOList.map(i=>{
- return i.specimenCode
- })
- let data: any = {
- id:this.codeData.id,
- specimenDeptId:this.validateForm.value.specimen,
- specimenFixingLiquid:{
- id:this.validateVerificationForm.value.fixative
- },
- specimenCodes:str.join(','),
- fixationTime:this.startDate,
- hosId: this.hosId || "" ,
- handoverUserId:this.handoverUserId
- };
- this.btnInfoLoading = true;
- this.mainService
- .simplePost("addData", "pathologyForm", data)
- .subscribe((res) => {
- this.autoUpdate(false)
- this.btnInfoLoading = false;
- this.barCode = null;
- // 手术间列表
- this.getPharmacyList(this.printPharmacyIdx, 'surgeryDept', this.printPharmacySearchKey);
- // 标本间列表
- this.getPharmacyList(this.waitPharmacyIdx, 'specimenDept', this.waitPharmacySearchKey);
- // 今日离科标本列表
- this.getPharmacyList(this.pharmacyIdx, 'leavedDept', this.pharmacySearchKey);
- if (res.status == 200) {
- this.showPromptModal("操作", true, "");
- } else {
- this.showPromptModal("操作", false, res.msg);
- }
- });
- }
- closeModel(){
- this.verificationMoadl = false
- this.fixationModal = false
- setTimeout(_=>{
- document.getElementById('Binput').focus();
- },200)
- }
- // 关闭固定接受标本
- hideVerificationModal(){
- this.verificationMoadl = false
- setTimeout(_=>{
- document.getElementById('Binput').focus();
- },200)
- }
- // 监听标本条码
- specimenCodeChange(e){
- this.changeInpSubjectSpecimen.next([e]);
- }
- // 监听接受固定标本条码
- tableLoading:boolean = false;
- codeChange(e){
- this.changeInpSubject.next([e]);
- }
-
- fixationError:any;
- searchSpecimenData(e){
- if(!e){
- return
- }
- if(e.length < 10) {
- return
- }
- this.tableLoading = true
- this.mainService.pathologyScanCode({
- barcode:e,
- pathologyFormId:this.codeData.id
- })
- .subscribe((res:any) => {
- this.autoUpdate(false)
- this.tableLoading = false
- this.specimenCode = null
- if(res.status==200){
- let item = res.data[0].pathologySpecimenDTOList.find(i=>i.specimenCode == e)
- if(item.fixationTime){
- this.fixationError = '该标本已经固定过'
- }else{
- this.getFixationNum(res.data[0].id)
- this.codeData = res.data[0]
- this.fixationError = null
- }
- }else{
- this.fixationError = res.msg
- }
- })
- }
- // 查看详情
- detailMoadl:boolean = false;
- pathologyLogs:any=[];
- specimenList:any=[]
- stepLength:any = 0;
- viewDetail(item,type){
- this.isSpinning = true
- this.getSampleData(item)
- clearInterval(this.logTimer);
- }
- closeDetailMoadl(){
- setTimeout(_=>{
- document.getElementById('Binput').focus();
- },200)
- this.detailMoadl = false
- this.autoUpdate(false);
- }
- // 自动刷新倒计时
- autoUpdate(flag = true) {
- if (flag) {
- this.logTime = this.logTimeConst;
- }
- clearInterval(this.logTimer);
- this.logTimer = setInterval(() => {
- this.logTime--;
- if (this.logTime === 0) {
- this.logTime = this.logTimeConst;
- // 代收急查标本(标本信息)列表
- this.getPharmacyList(0, 'surgeryDept', this.printPharmacySearchKey);
- // 已收取(工单信息)列表
- this.getPharmacyList(0, 'specimenDept', this.waitPharmacySearchKey);
- // 中转标本(标本统计信息)列表
- this.getPharmacyList(0, 'leavedDept', this.pharmacySearchKey);
- }
- }, 1000);
- }
- // 药房端药房列表查询、搜索
- // 1为pc待打印状态、2为pc配药中、3为pc核对中、4为pc配送中
- // searchKey 为搜索的关键字,没有就不传
- loading1 = false;
- loading2 = false;
- loading3 = false;
- loading4 = false;
- loading5 = false;
- getPharmacyList(idx, type, searchKey) {
- let hosId = JSON.parse(localStorage.getItem("user")).user.currentHospital.id;
- switch (type) {
- case 'surgeryDept':
- this.loading1 = true;
- break;
- case 'specimenDept':
- this.loading2 = true;
- break;
- case 'leavedDept':
- this.loading3 = true;
- break;
- }
- let postData = {
- idx: 0,
- sum: 50,
- pathologyForm:{
- detailsType: type,
- keyWords:searchKey,
- hosId,
- }
- };
- this.mainService
- .getFetchDataList("data", "pathologyForm", postData)
- .subscribe((result) => {
- switch (type) {
- case 'surgeryDept':
- this.loading1 = false;
- break;
- case 'specimenDept':
- this.loading2 = false;
- break;
- case 'leavedDept':
- this.loading3 = false;
- break;
- }
- if (result["status"] == 200) {
- switch (type) {
- case 'surgeryDept':
- // 总数
- this.printPharmacyTotal = result.totalNum;
- // 隐藏按钮的loading
- this.printPharmacyLoad = false;
- // 查看更多,是否显示
- if (result["list"].length < 10) {
- this.printPharmacyFlag = false;
- } else if (result["list"].length === 0 && idx === 0) {
- this.printPharmacyFlag = false;
- } else {
- this.printPharmacyFlag = true;
- }
- // 列表数据合并
- if (idx === 0) {
- this.printPharmacyList = result["list"];
- } else {
- this.printPharmacyList = [
- ...this.printPharmacyList,
- ...result["list"],
- ];
- }
- break;
- case 'specimenDept':
- this.waitPharmacyTotal = result.totalNum;
- this.waitPharmacyLoad = false;
- if (result["list"].length < 10) {
- this.waitPharmacyFlag = false;
- } else if (result["list"].length === 0 && idx === 0) {
- this.waitPharmacyFlag = false;
- } else {
- this.waitPharmacyFlag = true;
- }
- if (idx === 0) {
- this.waitPharmacyList = result["list"];
- } else {
- this.waitPharmacyList = [
- ...this.waitPharmacyList,
- ...result["list"],
- ];
- }
- break;
- case 'leavedDept':
- this.pharmacyTotal = result.totalNum;
- this.pharmacyLoad = false;
- if (result["list"].length < 10) {
- this.pharmacyFlag = false;
- } else if (result["list"].length === 0 && idx === 0) {
- this.pharmacyFlag = false;
- } else {
- this.pharmacyFlag = true;
- }
- if (idx === 0) {
- this.pharmacyList = result["list"];
- } else {
- this.pharmacyList = [...this.pharmacyList, ...result["list"]];
- }
- break;
- }
- }
- });
- }
- // 加载更多
- // loadMore(type) {
- // switch (type) {
- // case 'surgeryDept':
- // this.printPharmacyIdx++;
- // this.printPharmacyLoad = true;
- // this.getPharmacyList(
- // this.printPharmacyIdx,
- // type,
- // this.printPharmacySearchKey
- // );
- // break;
- // case 'specimenDept':
- // this.waitPharmacyIdx++;
- // this.waitPharmacyLoad = true;
- // this.getPharmacyList(
- // this.waitPharmacyIdx,
- // type,
- // this.waitPharmacySearchKey
- // );
- // break;
- // case 'leavedDept':
- // this.pharmacyIdx++;
- // this.pharmacyLoad = true;
- // this.getPharmacyList(this.pharmacyIdx, type, this.pharmacySearchKey);
- // break;
- // }
- // }
- // 搜索关键词
- searchKeyHandle(type) {
- switch (type) {
- case 'surgeryDept':
- this.printPharmacyIdx = 0; //页码重置
- this.printPharmacyList = []; //列表重置
- this.getPharmacyList(
- this.printPharmacyIdx,
- type,
- this.printPharmacySearchKey
- );
- break;
- case 'specimenDept':
- this.waitPharmacyIdx = 0; //页码重置
- this.waitPharmacyList = []; //列表重置
- this.getPharmacyList(
- this.waitPharmacyIdx,
- type,
- this.waitPharmacySearchKey
- );
- break;
- case 'leavedDept':
- this.pharmacyIdx = 0; //页码重置
- this.pharmacyList = []; //列表重置
- this.getPharmacyList(this.pharmacyIdx, type, this.pharmacySearchKey);
- break;
- }
- }
- // 退出
- logOut(): void {
- // 假退出
- let hospital = this.tool.getCurrentHospital();
- if(hospital){
- this.router.navigate(["login", hospital.id]);
- }else{
- this.router.navigateByUrl("login");
- }
- localStorage.removeItem("user");
- localStorage.removeItem("menu");
- localStorage.removeItem("index");
- // 假退出
- this.mainService.logOut().subscribe((data) => {
- if (data.status == 200) {
- if(hospital){
- this.router.navigate(["login", hospital.id]);
- }else{
- this.router.navigateByUrl("login");
- }
- localStorage.removeItem("user");
- localStorage.removeItem("menu");
- localStorage.removeItem("index");
- }
- });
- }
- // 右侧菜单
- showLastItems: boolean = false;
- // 下拉
- fixedMenuXiala() {
- this.showLastItems = true;
- }
- // 上拉
- fixedMenuShangla() {
- this.showLastItems = false;
- }
- mainRole: boolean = false; //回到系统管理权限
- 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;
- }
- }
- //药房端科室切换
- changeShow = true;
- closeTime = 3;
- closeTimeFlag = 0;
- hsPromptModalShow: boolean = false; //科室切换提示框是否展示
- timerCloseTime = null;
- deptDisplay = 1; //护士端是否显示可以别名,1是显示科室名称,2是显示科室别名
- //子传父接收
- 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;
- }
- // 切换科室
- 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);
- }
- promptModalShow:boolean = false;
- promptContent:any = null;
- ifSuccess:any = null;
- promptInfo:any = null;
- // 展示信息提示框(con:提示信息,success:操作是否成功,promptInfo:操作结果提示信息)
- showPromptModal(con, success, promptInfo?) {
- this.promptModalShow = false;
- this.promptContent = con;
- this.ifSuccess = success;
- this.promptInfo = promptInfo;
- setTimeout(() => {
- this.promptModalShow = true;
- }, 100);
- }
- }
|