import { Component, OnInit, ViewChild, SkipSelf, ElementRef, Renderer2, ChangeDetectorRef } from "@angular/core"; import { Options } from "select2"; import * as globals from "../../global"; import { HttpClient } from "@angular/common/http"; import { Router, ActivatedRoute, Params, NavigationStart, NavigationEnd } from "@angular/router"; import { Subject, Subscription } from "rxjs"; import { DataTableDirective } from "angular-datatables"; import { FormBuilder, UntypedFormBuilder, UntypedFormGroup } from "@angular/forms"; import { PatientService } from "../../services/patient.service"; import { PreviousRouteService } from "../../services/findRounte.service"; import Swal from "sweetalert2"; import { EncrDecrService } from "../../services/EncrDecrService.service"; import { ToastrService } from 'ngx-toastr'; import { MatMenuTrigger } from '@angular/material/menu'; import * as moment from "moment"; import { DatePipe } from "@angular/common"; import { ExportAsService, ExportAsConfig } from 'ngx-export-as'; @Component({ selector: "app-doctor-desk", // template: // '', templateUrl: "./doctor-desk.component.html", styleUrls: ["./doctor-desk.component.css"], }) export class DoctorDeskComponent implements OnInit { @ViewChild('closebutton') closebutton; @ViewChild('closebuttons') closebuttons; @ViewChild('CloseButtonValues') CloseButtonValues; @ViewChild('CloseButtonValues') closebuttonArrival; @ViewChild('opdtab') opdTab: ElementRef; @ViewChild('ipdtab') ipdTab: ElementRef; @ViewChild('fdesktab') fdesktab: ElementRef; exportAsConfig: ExportAsConfig = { type: 'pdf', elementIdOrContent: 'myTableElementId', } exportAsConfig1: ExportAsConfig = { type: 'xlsx', elementIdOrContent: 'myTableElementId', } doctorOPDFm: UntypedFormGroup; hospitalnum: any; visitNo: any; HideName: boolean = false; opNumber: any; patientName: any; phoneNumber: any; patientList = []; PatientList = []; departmentListArray: string[] = []; searchEnable: boolean; doctorIPDFm: UntypedFormGroup; ipNumber: any; hospitalnum1: any; patientName1: any; phoneNumber1: any; alternativePhoneNumber: any; alternativePhoneNumber1: any; genderIp: any; countRestricted: any; restrictedArrayList: any = [] cosignFlag: any = 1; loading: boolean; wardTypeFilter: any; roomTypeFilter: any; doctorCode: any; customLoadingTemplate: any; longResultTabId: any; totalCount: any; departmentC: any; totalCount1: any; opFullList: any = []; loginDetail: any; gender: any; wardType: any; roomType: any; AssigntoMeForm: UntypedFormGroup; AssigntoForm: UntypedFormGroup; confirmForm: UntypedFormGroup; denyForm: UntypedFormGroup; bednumberFilter: any; ipDate: any; regnDate: any = globals.formatDate(new Date()); toregnDate: any = globals.formatDate(new Date()); doctorCodes: any; public options: Options; message: any = {}; subscription: Subscription; isSchemePatient: any; hideForPermissionNotAllowed: boolean = false; PermissionArray: any; hideForPermissionAllowed: boolean = true; doctorId: any; CompleteSideDetails: any = []; formNameID: any; myList: any; isNo: any; DatePlaceholder: any = "Registraion"; doctorUnit: any; parentMessage = "message from parent"; newArray: any = []; reasons: any; Confirmreason: any patientArray: any = []; techArrayValue: any; techdataPage: any; techArrayValueIp: any; techdataPageIp: any; doctorDepartmentLocalList: any; showSelectedTab: any; id: any; restriCount: any; patientArrayIP: any = []; departmentName1: any; ConsultStatus: any; listObj: any = {} arrayValue: string; decryptedArray: any; product: any; selectedDOctorId: any; selectedHospNum: any; navigateDD: string; navigateDDroute: string; prevSelectedTab: any; demoDetail: any = {}; viewRegistrationDate: any; viewHospitalNumber: any; viewOpNum: any; viewPatientType: any; viewRegistrationType: any; viewStdId: any; viewPerPostoffice: any; viewPerTaluk: any; viewContactNum: any; viewBroughtBY: any; viewBroughtDate: any; viewContactName: any; viewPatientCategory: any; viewCustomer: any; viewPatientTitle: any; viewPassNum: any; viewPassValidity: any; viewReligion: any; viewMotherName: any; viewMaterialStatus: any; viewFatherName: any; viewPatientName: any; viewDOB: any; viewCountry: any; viewDistrict: any; viewPin: any; viewPostoffice: any; viewState: any; viewPerPincode: any; viewPerDistrict: any; viewPerState: any; viewPerCountry: any; viewPerAddress: any; perHide: boolean; viewMlc: any; viewAddress: any; viewTaluk: any; viewId: any; viewVisaNum: any; viewVisaValidity: any; nationalityHide: boolean; viewOccupation: any; viewBloodGroup: any; viewEmail: any; spouseHide: boolean; viewMobileNumber: any; viewSpouseName: any; motherHide: boolean; fatherNameHide: boolean; viewAge: string; viewGender: any; studHide: boolean; customerHide: boolean; viewEmpId: any; viewRateType: any; empHide: boolean; viewIdNum: any; viewPolice: any; hideMlc: boolean; viewNationality: any; docCat: any; previousUrl: string = ''; currentUrl: string = ''; constructor(private exportAsService: ExportAsService, @SkipSelf() private http: HttpClient, private activatedRouter: ActivatedRoute, private previousRouteService: PreviousRouteService, private router: Router, private renderer: Renderer2, private fb: UntypedFormBuilder, private patientS: PatientService, private EncrDecr: EncrDecrService, private toastr: ToastrService, private datePipe: DatePipe, private cdr: ChangeDetectorRef, private cd: ChangeDetectorRef, ) { this.CompleteSideDetails = JSON.parse( localStorage.getItem("formCodePage") ); this.regnDate = globals.formatDate(new Date()); this.toregnDate = globals.formatDate(new Date()); this.newArray = globals.fetchDataFromLocalStore(); //this.getConsultationStatus(); this.doctorOPDFm = this.fb.group({ hospitalnum: [""], visitNo: [""], // opNumber:['',], patientName: [""], phoneNumber: [""], alternativePhoneNumber: [""], regnDate: [""], toregnDate: [""], departmentName: [""], ConsultStatus: [''], unit: [""], gender: [""], }); this.doctorIPDFm = fb.group({ hospitalnum1: [""], ipNumber: [""], patientName1: [""], phoneNumber1: [""], alternativePhoneNumber1: [""], regnDate: [""], toregnDate: [""], departmentName: [""], ConsultStatus: [''], unit: [""], roomTypeFilter: [""], wardTypeFilter: [""], bednumberFilter: [""], gender1: [""], }); //assign to me this.AssigntoMeForm = fb.group({ assignType: [""], consultant: [""], consultantDoctor: [""] }) this.AssigntoForm = fb.group({ assignType: [''], newDepartmentId: [""], newDoctorId: [''], specialtyUnit: [""], reason: [""], isSchemePatient: [""], reasons: [""], isNo: [""] }) this.confirmForm = fb.group({ Confirmreason: [""] }) this.denyForm = fb.group({ denyReason: [""] }) } ngOnDestroy() { localStorage.removeItem('Revist'); } showAprrovalTab: boolean = true; previousRoute: string; internalDept: number = 0; sideDetails: any; isVykoTeam: any; departmentArray: any = [];frontDeskArray:any; formCodeDetails: any; classTab: any; selectedTabIdMy: any; selectedTabIdAll: any; selectedTabIdFoll: any; selectedTabIdEnt: any; doctorDeskType: string = "OPD"; userTypeCode: any; ngOnInit(): void { this.loading = false; setInterval(() => { const body = document.body; this.renderer.setStyle(body, 'padding-right', '0'); }, 1000); this.activatedRouter.url.subscribe(route => { const checkDD = route[0]?.path?.split('-')?.[2]; for (let i = 0; i < this.CompleteSideDetails.length; i++) { for (let j = 0; j < this.CompleteSideDetails[i].PageList.length; j++) { if ( this.CompleteSideDetails[i].PageList[j].pageLink == ("/doctor-master/doctor-desk-" + checkDD) ) { this.listObj = this.CompleteSideDetails[i].PageList[j]; this.formCodeDetails = this.CompleteSideDetails[i].PageList[j].formCode; } } } }); this.previousUrl = this.previousRouteService.getPreviousUrl(); this.currentUrl = this.previousRouteService.getCurrentUrl(); this.countDoctorReviewIpList = 0 this.DoctorReviewCount = 0 this.endDoc = ""; this.sideDetails = JSON.parse(localStorage.getItem("sideDetails")); this.CompleteSideDetails = JSON.parse(localStorage.getItem("formCodePage")); this.loginDetail = JSON.parse(localStorage.getItem("LOGGEDINUSERDATA")); this.userTypeCode = this.loginDetail.userTypeCode this.techdataPage = JSON.parse(localStorage.getItem("dataPage")); this.techArrayValue = [] this.techArrayValue = JSON.parse(localStorage.getItem("datas")); this.frontDeskArray = JSON.parse(localStorage.getItem("dataFrontDesk")); this.techdataPageIp = JSON.parse(localStorage.getItem("dataPageIP")); this.techArrayValueIp = JSON.parse(localStorage.getItem("datasIP")); this.showSelectedTab = JSON.parse(localStorage.getItem("clickedTab")); this.activatedRouter.queryParams.subscribe(params => { this.id = params['id']; this.showInMy = true; if (this.techArrayValue && this.showSelectedTab[0].ipdClick == true) { this.onClickOPDBack(); } else if (this.techArrayValueIp && this.showSelectedTab[0].opdClick == true) { this.onClickIPDBack(); } else if (this.id == 'dashboardOP') { ($('#reviewsTab') as any).tab('show') this.onClickDoctorReviewList(); } else if (this.id == 'dashboardIP') { ($('#reviewspatientIP') as any).tab('show') this.onClickReviewsListIp(); } else { this.opdAllPatientTab = 0; this.opdDepartmentPatientTab = 0; this.opdMyPatientTab = 1; this.opdEncounterPatientTab = 0; this.ipAllPatientSearch = 0; this.ipMyPatientListSearch = 1; this.ipCrossRefferPatientSearch = 0; this.dischargeStatust = 0; this.regnDate = ""; // console.log(globals.formatDate(new Date())) // const date = globals.formatDate(new Date()) // this.doctorOPDFm.setValue({'toregnDate' : date}) ; // console.log(this.doctorOPDFm) this.toregnDate = ""; localStorage.removeItem("datas"); localStorage.removeItem("dataFrontDesk"); localStorage.removeItem("datasIP"); localStorage.removeItem("clickedTab"); localStorage.removeItem("dataPage"); localStorage.removeItem("dataPageIP"); this.getDoctorReviewList(); //this.onClickOpdMyPatient(); // this.onClickMyPatientIp(); } }) // this.getAssignCountOp() // this.getAssignCountIp() if (this.loginDetail['departmentData']) { this.departmentName = this.loginDetail['departmentData'][0].departmentCode } this.departmentArray = this.loginDetail['departmentData'] this.getDepartmentList(); this.userTypeCode = this.loginDetail.userTypeCode this.departmentName = this.loginDetail['departmentData'][0].departmentCode // console.log(this.userTypeCode, this.departmentName); // Default filter value for department drop down if (this.loginDetail?.departmentData?.length) { this.departmentListArray = this.loginDetail?.departmentData.map(obj => obj.departmentCode); // this.departmentName = this.loginDetail?.departmentData?.[0]?.departmentCode; } if (this.loginDetail?.drugAuth.length != 0) { for (let i = 0; i < this.CompleteSideDetails.length; i++) { for (let j = 0; j < this.CompleteSideDetails[i].PageList.length; j++) { if ( this.CompleteSideDetails[i].PageList[j].pageLink == ("/doctor-master/doctor-desk-" + "ipd") ) { this.listObj = this.CompleteSideDetails[i].PageList[j]; this.formCodeDetails = this.CompleteSideDetails[i].PageList[j].formCode; } } } localStorage.setItem("sideDetails", JSON.stringify(this.listObj)); ($('#drugAlertTab') as any).tab('show') this.showAprrovalTab = false; this.showInMy = true; this.HideDept = false; this.dischargeStatust = 0; this.regnDate = ""; this.confirmedStatus = 0; this.isRejectTab = false; // this.restrictedDrugListCount() this.restrictedDrugList() } else { $('#drugAlertTab').parent().remove(); // Remove tab navigation $('#restrictedDrug').remove(); } this.isVykoTeam = this.loginDetail["isVykoTeam"]; if (this.newArray.applicationCode == "LOGRO0002") { this.myList = 1; } else { this.myList = 0; } this.PermissionArray = globals.sideDetails(); if (this.PermissionArray.edit == 1 || this.newArray.isSuperAdmin == 1) { this.hideForPermissionAllowed = true; this.hideForPermissionNotAllowed = false; } else { this.hideForPermissionAllowed = false; this.hideForPermissionNotAllowed = true; } // this.formCodeDetails = this.sideDetails['formCode']; this.searchEnable = true; this.doctorId = this.newArray.loginId; // this.regnDate = globals.formatDate(new Date()) if (localStorage.getItem("LOGGEDINUSERDATA") != null) { this.loginDetail = JSON.parse(localStorage.getItem("LOGGEDINUSERDATA")); this.departmentC = this.loginDetail["department"]; this.doctorCodes = this.loginDetail["doctorCode"]; this.consultantDoctor = this.loginDetail["firstName"]; this.consultant = this.loginDetail["departmentName"]; this.doctorUnit = this.loginDetail["doctorUnit"]; } // this.newMessage(); this.subscription = this.patientS.currentMessage.subscribe( (message) => (this.message = message) ); // this.getOpAllDepartmentPatentList(); this.getWardTypeList(); this.getRoomTypeList(); this.getDepartmentLists(); this.getAssignTypeList(); this.getGender(); this.reviewListCount() // this.reviewsPatientIpListCount() if (this.isRejectTab === true) { this.onClick1(); // reset fields } } assignCount: any = 0; getAssignCountOp() { this.http.post(globals.revamp.assignCountOp, JSON.stringify({ "organizationId": this.newArray.organizationId, "businessId": this.newArray.businessId, "groupId": this.newArray.groupId, "userId": this.newArray.loginId, "status": "PENDING", }), { headers: globals.HeaderValue1 }).subscribe( data => { if (data['error'] == false) { this.assignCount = data['result']?.count } } ) } assignCountIp: any = 0; getAssignCountIp() { this.http.post(globals.revamp.assignCountIp, JSON.stringify({ "organizationId": this.newArray.organizationId, "businessId": this.newArray.businessId, "groupId": this.newArray.groupId, "userId": this.newArray.loginId, "status": "PENDING", }), { headers: globals.HeaderValue1 }).subscribe( data => { if (data['error'] == false) { this.assignCountIp = data['result'].count } } ) } acceptAssign(x) { this.http.post(globals.revamp.acceptRejectAssignOp, JSON.stringify({ "organizationId": this.newArray.organizationId, "businessId": this.newArray.businessId, "groupId": this.newArray.groupId, "userId": this.newArray.loginId, "hospitalNumber": x.hospitalNumber, "opNumber": x.opNumber, "visitNumber": x.visitNumber, "status": "ACCEPT", "rejectReason": this.getReason ? this.getReason : null }), { headers: globals.HeaderValue1 }).subscribe( data => { if (data['error'] == false) { this.toastr.success(data['message']); this.getReason = "" this.getPatientListList() this.getAssignCountOp() } else { this.toastr.error(data['message']); } } ) } getReason: any; rejectAssign(x) { this.http.post(globals.revamp.acceptRejectAssignOp, JSON.stringify({ "organizationId": this.newArray.organizationId, "businessId": this.newArray.businessId, "groupId": this.newArray.groupId, "userId": this.newArray.loginId, "hospitalNumber": x.hospitalNumber, "opNumber": x.opNumber, "visitNumber": x.visitNumber, "status": "REJECT", "rejectReason": this.getReason ? this.getReason : null }), { headers: globals.HeaderValue1 }).subscribe( data => { if (data['error'] == false) { this.toastr.success(data['message']); this.getReason = ""; ($('#denyAssigned') as any).modal('hide'); this.getPatientListList() this.getAssignCountOp() } else { this.toastr.error(data['message']); } } ) } assignData: any; acceptAssignIp(x) { this.http.post(globals.revamp.acceptRejectAssignIp, JSON.stringify({ "organizationId": this.newArray.organizationId, "businessId": this.newArray.businessId, "groupId": this.newArray.groupId, "userId": this.newArray.loginId, "hospitalNumber": x.hospitalNumber, "ipNumber": x.ipNumber, "status": "ACCEPT", "rejectReason": this.getReason ? this.getReason : null }), { headers: globals.HeaderValue1 }).subscribe( data => { if (data['error'] == false) { this.toastr.success(data['message']); this.getReason = ""; this.getMyPatientListForIp() this.getAssignCountIp() } else { this.toastr.error(data['message']); } } ) } rejectAssignIp(x) { this.http.post(globals.revamp.acceptRejectAssignIp, JSON.stringify({ "organizationId": this.newArray.organizationId, "businessId": this.newArray.businessId, "groupId": this.newArray.groupId, "userId": this.newArray.loginId, "hospitalNumber": x.hospitalNumber, "ipNumber": x.ipNumber, "status": "REJECT", "rejectReason": this.getReason ? this.getReason : null }), { headers: globals.HeaderValue1 }).subscribe( data => { if (data['error'] == false) { this.toastr.success(data['message']); this.getReason = ""; ($('#denyAssignedIp') as any).modal('hide'); this.getMyPatientListForIp() this.getAssignCountIp() } else { this.toastr.error(data['message']); } } ) } revAndConCount: any; revCount: any; conCount: any reviewAndConsultCount(x) { this.reviewListObj["loginId"] = this.newArray.userId; this.reviewListObj["organizationId"] = this.newArray.organizationId; this.reviewListObj["businessId"] = this.newArray.businessId; this.reviewListObj["groupId"] = this.newArray.groupId; this.reviewListObj["opOrIp"] = x; this.http .post( globals.DoctorDesk.countQuery, JSON.stringify(this.reviewListObj), { headers: globals.HeaderValue1 } ) .subscribe( (data: { error: boolean; message: string; result: any }) => { if (data.error == false && data?.result?.length != 0) { this.revAndConCount = data["result"][0].OPCount; this.revCount = data["result"][0].Review; this.conCount = data["result"][0].Reviewandconsult; } }, (error) => { // cm Swal.fire({ text: "Error in getting List.", iconHtml: 'Lazy-loaded image', }); } ); } ngAfterViewInit() { this.activatedRouter.url.subscribe(route => { const checkDD = route[0]?.path?.split('-')?.[2]; if (checkDD === "opd") { if (this.id != 'dashboardOP') { setTimeout(() => { this.opdTab.nativeElement.click(); }) } this.doctorDeskType = "OPD"; this.navigateDD = "IPD"; // this.opdAllPatientTab = 0; // this.opdDepartmentPatientTab = 0; // this.opdMyPatientTab = 1; // this.followUpPatientListTab = 0; // this.opdEncounterPatientTab = 0; } else if (checkDD === "ipd") { setTimeout(() => { this.ipdTab.nativeElement.click(); }) this.doctorDeskType = "IPD"; this.navigateDD = "OPD"; } else if (checkDD === "FrntD") { setTimeout(() => { this.fdesktab.nativeElement.click(); }) this.doctorDeskType = "Front Desk"; this.navigateDD = "FrntD"; } else { this.onClickIpd(); } this.navigateDDroute = '/doctor-master/doctor-desk-' + this.navigateDD.toLowerCase(); if (this.navigateDD == 'IPD') { this.DatePlaceholder = "Registration"; } for (let i = 0; i < this.CompleteSideDetails.length; i++) { for (let j = 0; j < this.CompleteSideDetails[i].PageList.length; j++) { if ( this.CompleteSideDetails[i].PageList[j].pageLink == ("/doctor-master/doctor-desk-" + checkDD) ) { this.listObj = this.CompleteSideDetails[i].PageList[j]; this.formCodeDetails = this.CompleteSideDetails[i].PageList[j].formCode; } } } localStorage.setItem("sideDetails", JSON.stringify(this.listObj)) }); } //tab click function HideDept: boolean; showInMy: boolean; opdClick: boolean; tabArray: any = []; onClickOpd() { if (this.techArrayValue) { this.onClickOPDBack(); } else { this.getPatientListList(); } localStorage.removeItem("clickedTab"); this.tabArray = []; let tabObj = { "ipdClick": true } this.tabArray.push(tabObj); localStorage.setItem("clickedTab", JSON.stringify(this.tabArray)) // this.techArrayValue = localStorage.removeItem("datas"); // this.techdataPage = localStorage.removeItem("dataPage"); if (this.id == 1) { } else { if (this.techArrayValue) { } else { this.HideDept = true; this.showInMy = false; } } } ipdClick: boolean; onClickIpd() { if (this.techArrayValueIp) { this.onClickIPDBack(); } else { this.getMyPatientListForIp(); } localStorage.removeItem("clickedTab"); this.tabArray = []; let tabObj = { "opdClick": true } this.tabArray.push(tabObj); this.ipdClick = true; localStorage.setItem("clickedTab", JSON.stringify(this.tabArray)) if (this.id == 2) { } else { if (this.techArrayValueIp) { } else { this.HideDept = true; if(this.showAprrovalTab == false){ this.HideDept = false; } this.showInMy = false; } } if (this.newArray.applicationCode == "LOGRO0002") { this.myList = 1; } // this.onClickMyPatientIp(); this.DatePlaceholder = "Admission"; //hre // this.getMyPatientListForIp(); } //**ON Click Front Desk */ onClickfrnD() { this.getPatientListList(); this.getDepartmentList(); localStorage.removeItem("clickedTab"); let tabObj = { "frnDClick": true } localStorage.removeItem("datas"); localStorage.removeItem("dataFrontDesk"); localStorage.removeItem("dataPage"); this.HideDept = false; this.showInMy = true; this.opdAllPatientTab = 1; this.page = 1; this.doctorId = null; // this.regnDate = globals.formatDate(new Date()) // this.toregnDate = globals.formatDate(new Date()) this.opdDepartmentPatientTab = 0; this.opdMyPatientTab = 0; this.opdEncounterPatientTab = 0; this.followUpPatientListTab = 0; this.reviewPatientTab = 0; // this.hospitalnum = ""; // this.phoneNumber = ""; this.selectedTab = "allPatient"; this.DatePlaceholder = "Registration"; this.getPatientListList(); if (this.id == 1) { } else { this.HideDept = true; this.showInMy = false; } } clear() { this.demoDetail = {}; this.frontDeskLinedetails = {}; } payloadObj: any = {} updateFrntDArrStus() { this.payloadObj['organizationId'] = this.newArray.organizationId; this.payloadObj['businessId'] = this.newArray.businessId; this.payloadObj['groupId'] = this.newArray.groupId; this.payloadObj['hospitalNumber'] = this.demoDetail.hospitalNumber; this.payloadObj['opNumber'] = this.demoDetail.opNumber; this.payloadObj['frontDeskArraivalBy'] = this.newArray.userId; this.http.post(globals.DoctorDesk.updateFrntDArrivalStatus, JSON.stringify(this.payloadObj), { headers: globals.HeaderValue1 }).subscribe( data => { //this.submitBtn = true; if (data['error'] == false) { Swal.fire({ text: data['message'], icon: 'success' }); this.closebuttonArrival.nativeElement.click(); ($('#viewDemographicDetails') as any).modal('hide'); this.payloadObj = {}; this.demoDetail = {}; this.frontDeskLinedetails = {} this.getPatientListList(); } else { Swal.fire({ text: data['message'], icon: 'error' }); } }, ); } frontDeskLinedetails: any = {}; onclickDemographic(demoDetails) { this.frontDeskLinedetails = demoDetails this.demoDetail = ''; this.viewRegistrationDate = '' this.viewRegistrationType = '' this.viewHospitalNumber = '' this.viewOpNum = '' this.viewPatientType = '' this.viewPatientCategory = '' this.viewRateType = '' this.viewCustomer = '' this.viewEmpId = '' this.viewStdId = '' this.viewPatientTitle = '' this.viewPatientName = '' this.viewDOB = '' this.viewAge = '' this.viewGender = '' this.viewMaterialStatus = '' this.viewFatherName = '' this.viewMotherName = '' this.viewSpouseName = '' this.viewMobileNumber = '' this.viewReligion = '' this.viewOccupation = '' this.viewBloodGroup = '' this.viewEmail = '' this.viewNationality = '' this.viewPassNum = '' this.viewPassValidity = '' this.viewVisaNum = '' this.viewVisaValidity = '' this.viewAddress = '' this.viewPin = '' this.viewPostoffice = '' this.viewTaluk = '' this.viewDistrict = '' this.viewState = '' this.viewCountry = '' this.viewId = '' this.viewIdNum = '' this.viewMlc = '' this.viewPerPincode = '' this.viewPerPostoffice = '' this.viewPerTaluk = '' this.viewPerDistrict = '' this.viewPerState = '' this.viewPerCountry = '' this.viewPerAddress = '' this.viewPolice = '' this.viewBroughtBY = '' this.viewContactName = '' this.viewContactNum = '' this.viewBroughtDate = '' let temp1 = { p_hospitalNumber: demoDetails.hospitalNumber, opNumber: demoDetails.opNumber, visitNumber: demoDetails.visitNumber, organizationId: this.newArray.organizationId, groupId: this.newArray.groupId, businessId: this.newArray.businessId } this.http.post(globals.OPRegistration.getupDateDemographicDetails, JSON.stringify(temp1), { headers: globals.HeaderValue1 }).subscribe( (data: { error: boolean, message: string, result: any }) => { if (data.error == false) { this.demoDetail = data.result; this.viewRegistrationDate = this.datePipe.transform(this.demoDetail.regnDate, 'dd-MM-yyyy'); this.viewRegistrationType = this.demoDetail.patientRegTypeValue; this.viewHospitalNumber = this.demoDetail.hospitalNumber; this.viewOpNum = this.demoDetail.opNumber this.viewPatientType = this.demoDetail.patientTypeValue; this.viewPatientCategory = this.demoDetail.patientCategoryValue; this.viewRateType = this.demoDetail.rateTypeValue; if (this.demoDetail.customerCodeValue != null) { this.customerHide = true; this.viewCustomer = this.demoDetail.customerCodeValue; } else { this.customerHide = false; } if (this.demoDetail.employeeId != null) { this.empHide = true; this.viewEmpId = this.demoDetail.employeeId; } else { this.empHide = false; } if (this.demoDetail.studentID != null) { this.studHide = true; this.viewStdId = this.demoDetail.studentID; } else { this.studHide = false; } this.viewPatientTitle = this.demoDetail.patientRegTypeValue; this.viewPatientName = this.demoDetail.patientTitleValue + "." + this.demoDetail.firstName + " " + this.demoDetail.middleName + " " + this.demoDetail.lastName; this.viewDOB = this.datePipe.transform(this.demoDetail.dateOfBirth, 'dd-MM-yyyy'); this.viewAge = this.demoDetail.ageYy + "Y " + this.demoDetail.ageMm + "M " + this.demoDetail.ageDd + "D"; this.viewGender = this.demoDetail.genderTypeValue; this.viewMaterialStatus = this.demoDetail.marirtalStatusValue; if (this.demoDetail.viewFatherName != "") { this.fatherNameHide = true; this.viewFatherName = this.demoDetail.fatherName; } else { this.fatherNameHide = false; } if (this.demoDetail.motherName != "") { this.viewMotherName = this.demoDetail.motherName; this.motherHide = true; } else { this.motherHide = false; } if (this.demoDetail.husbandName != "") { this.viewSpouseName = this.demoDetail.husbandName; this.spouseHide = true; } else { this.spouseHide = false; } this.viewMobileNumber = this.demoDetail.mobileNumber1; this.viewReligion = this.demoDetail.religionCodeValue; this.viewOccupation = this.demoDetail.occuptionValue; this.viewBloodGroup = this.demoDetail.bloodGroupValue; this.viewEmail = this.demoDetail.eMailId; this.viewNationality = this.demoDetail.nationalityValue; if (this.demoDetail.nationalityAppCode != "IND") { this.nationalityHide = true; this.viewPassNum = this.demoDetail.passportNumber; this.viewPassValidity = this.datePipe.transform(this.demoDetail.passportValidity, 'dd-MM-yyyy'); this.viewVisaNum = this.demoDetail.visaNumber; this.viewVisaValidity = this.datePipe.transform(this.demoDetail.visaValidity, 'dd-MM-yyyy'); } else { this.nationalityHide = false } } this.viewAddress = this.demoDetail.address; this.viewPin = this.demoDetail.pinCode; this.viewPostoffice = this.demoDetail.postOfficeValue this.viewTaluk = this.demoDetail.taulkName; this.viewDistrict = this.demoDetail.districtName; this.viewState = this.demoDetail.stateName; this.viewCountry = this.demoDetail.countryName; this.viewId = this.demoDetail.idProofTypeValue; this.viewIdNum = this.demoDetail.idProofNo; this.viewMlc = this.demoDetail.mlcTypeValue; if (this.demoDetail.sameAsPresent == 0) { this.perHide = true this.viewPerPincode = this.demoDetail.parmanentPincode; this.viewPerPostoffice = this.demoDetail.permanantPostOfficeValue; this.viewPerTaluk = this.demoDetail.permanentTalukName; this.viewPerDistrict = this.demoDetail.permanentDisctrictName; this.viewPerState = this.demoDetail.permanentStateName; this.viewPerCountry = this.demoDetail.permanentCountryName; this.viewPerAddress = this.demoDetail.permanentAddress } else { this.perHide = false } if (this.demoDetail.mlcTypeAppCode != "NONE") { this.hideMlc = true; this.viewPolice = this.demoDetail.policeStation; this.viewBroughtBY = this.demoDetail.brougtByValue; this.viewContactName = this.demoDetail.contactName; this.viewContactNum = this.demoDetail.contactNumber; this.viewBroughtDate = this.datePipe.transform(this.demoDetail.regnDate, 'dd-MM-yyyy'); } else { this.hideMlc = false; } this.getPatientDetail(this.frontDeskLinedetails); }) } /**Fetching Move OP to IP Details */ deptCode: any; patientObj: any = {}; patienDetails: any = {}; getPatientDetail(value) { this.deptCode = value.departmentCode; this.patientObj['hospitalNumber'] = value.hospitalNumber; this.patientObj['opNumber'] = value.opNumber; this.patientObj['visitNumber'] = value.visitNumber; this.patientObj['departmentCode'] = value.departmentCode; this.patientObj['organizationId'] = this.newArray.organizationId ? this.newArray.organizationId : value.organizationId; this.patientObj['businessId'] = this.newArray.businessId ? this.newArray.businessId : value.businessId; this.patientObj['groupId'] = this.newArray.groupId ? this.newArray.groupId : value.groupId; this.patientObj['userId'] = this.newArray.userId; if (this.patientObj) { this.http.post(globals.DoctorDesk.getPatientDetails, JSON.stringify(this.patientObj), { headers: globals.HeaderValue1 }).subscribe( data => { if (data['error'] == false) { // if (data['fallowupDetails'].length != 0) { this.patienDetails = data['result']; // console.log(this.patienDetails?.isIpPatient); // } } ($('#viewDemographicDetails') as any).modal('show'); } ) } } opdAllPatientTab: any; opdDepartmentPatientTab: any; opdMyPatientTab: any; getOpAllDepartmentPatentListTab: any = 1; departmentName = this.newArray.department; onClickOpdAllPatient() { this.ipMyPatientListSearch = 0 localStorage.removeItem("datas"); localStorage.removeItem("dataFrontDesk"); localStorage.removeItem("dataPage"); this.HideDept = false; this.showInMy = true; this.opdAllPatientTab = 1; this.page = 1; this.doctorId = null; this.regnDate = globals.formatDate(new Date()) this.toregnDate = globals.formatDate(new Date()) this.opdDepartmentPatientTab = 0; this.opdMyPatientTab = 0; this.opdEncounterPatientTab = 0; this.followUpPatientListTab = 0; this.reviewPatientTab = 0; // this.hospitalnum = ""; // this.phoneNumber = ""; this.selectedTab = "allPatient"; this.DatePlaceholder = "Registration"; this.getPatientListList(); this.getDepartmentList(); } // onClickOpdDepartmentPatient() { // this.opdAllPatientTab = 0; // this.opdDepartmentPatientTab = 1; // this.opdMyPatientTab = 0; // this.hospitalnum = ''; // this.patientName = ''; // this.regnDate = ''; // this.phoneNumber = ''; // this.getOpAllDepartmentPatentList(); // } opdEncounterPatientTab: any = 0; selectedTab: any; onClickOpdMyPatient() { this.reviewAndConsultCount('OP') this.techArrayValue = localStorage.removeItem("datas"); this.frontDeskArray = localStorage.removeItem("dataFrontDesk"); this.techdataPage = localStorage.removeItem("dataPage"); this.HideDept = true; this.showInMy = false; this.opdDepartmentPatientTab = 0; this.opdMyPatientTab = 1; this.opdAllPatientTab = 0; this.followUpPatientListTab = 0; this.opdEncounterPatientTab = 0; this.reviewPatientTab = 0; this.page = 1; this.doctorId = this.newArray.loginId; this.regnDate = ""; this.toregnDate = ""; // this.hospitalnum = ""; // this.phoneNumber = ""; this.DatePlaceholder = "Registration"; this.selectedTab = "myPatient"; this.unit = ""; this.getPatientListList(); } followUpPatientListTab: any = 0; onClickOpdFollowUpList() { localStorage.removeItem("datas"); localStorage.removeItem("dataFrontDesk"); localStorage.removeItem("dataPage"); this.HideDept = false; this.showInMy = true; this.opdAllPatientTab = 0; this.opdDepartmentPatientTab = 0; this.opdMyPatientTab = 0; this.followUpPatientListTab = 1; this.opdEncounterPatientTab = 0; this.reviewPatientTab = 0; this.doctorId = this.newArray.loginId; // this.hospitalnum = ""; // this.phoneNumber = ""; this.pageNo = 1; this.DatePlaceholder = "Registration"; this.getFollowUpPatientList(); this.selectedTab = "followPatient"; } newMessage(data) { this.patientS.changeMessage(data); this.router.navigate(["doctor-master/patient-details-desk"]); } opdObj = {}; listCOunt: any; style: any totalCount4: any; groupByInvest: any; groupByPresc: any; groupByCategory: any = []; stringTab: any; groupStatusCheck: any; showAllFiltersAllPatientTab = false; toggleFiltersForAllPatientTab() { this.showAllFiltersAllPatientTab = !this.showAllFiltersAllPatientTab; } showAllFiltersAllPatientTabIp = false; toggleFiltersForAllPatientTabIp() { this.showAllFiltersAllPatientTabIp = !this.showAllFiltersAllPatientTabIp; this.HideDept = false; this.showInMy = true; } getPatientListList() { this.getAssignCountOp() this.reviewAndConsultCount('OP') // // this.loading = true; cm if (this.ConsultStatus == "CST0001") // ARRIVED { this.arraivalStatus = 1 this.confirmedStatus = 0 } else if (this.ConsultStatus == "CST0003") { //"COMPLETED" this.arraivalStatus = 1 this.confirmedStatus = 1 } else if (this.ConsultStatus == "CST0002") { // "Pt. Not Arrived" this.arraivalStatus = '0' this.confirmedStatus = "Pt. Not Arrived"; } else { this.confirmedStatus = ""; } // if(this.selectedHospNum == 'null'){ let payload = {}; payload["page"] = this.page; // } // else{ // this.opdObj["page"] = 1; // } payload["loginId"] = this.newArray.loginId; payload["organizationId"] = this.newArray.organizationId; payload["businessId"] = this.newArray.businessId; payload["groupId"] = this.newArray.groupId; payload["hospitalNumber"] = this.hospitalnum ? this.hospitalnum : null; payload["visitNumber"] = this.visitNo ? this.visitNo : null; payload["patientName"] = this.patientName ? this.patientName : null; payload["phoneNumber"] = this.phoneNumber ? this.phoneNumber : null; payload["altPhoneNumber"] = this.alternativePhoneNumber ? this.alternativePhoneNumber : null; payload["fromregnDate"] = this.regnDate ? this.regnDate : ""; payload["toregnDate"] = this.toregnDate ? this.toregnDate : ""; payload["departmentName"] = this.departmentName ? this.departmentName : null; payload["departmentUnit"] = this.unit ? this.unit : ""; if (this.departmentListArray.length != 0) { if (this.departmentListArray[0] == undefined) { this.departmentListArray = [] } } payload["departmentList"] = this.departmentListArray ? this.departmentListArray : null; payload["confirmedStatus"] = this.confirmedStatus ? this.confirmedStatus : ""; payload["arraivalStatus"] = this.arraivalStatus; // this.opdObj["confirmedStatus"] = this.confirmedStatus ? this.confirmedStatus : ""; // this.opdObj["arraivalStatus"] = this.arraivalStatus ? this.arraivalStatus : ""; if (!this.selectedDOctorId || this.selectedDOctorId == "myPatient" || this.opdMyPatientTab == 1) { payload["doctorId"] = this?.doctorId ? this?.doctorId : ""; payload["isReview"] = this.review == true ? 1 : 0; payload["reviewAndConsult"] = this.consult == true ? 1 : 0; if (payload["reviewAndConsult"] == 1) { payload["isReview"] = 1 } else if (payload["doctorId"] == "") { payload["isReview"] = 0 payload["reviewAndConsult"] = 0 } } else { payload["doctorId"] = ""; payload["isReview"] = 0 payload["reviewAndConsult"] = 0 } payload["genderName"] = this?.gender ? this?.gender : ""; // this.opdObj['roleTypeId'] = this.newArray.roleTypeId; // this.opdObj['userTypeId'] = this.newArray.userTypeId; // this.opdObj['roleId'] = this.newArray.roleId; // this.opdObj['department'] = null; // this.opdObj['departmentCode'] = this.departmentC; payload["departmentCode"] = this.departmentName ? this.departmentName : null; payload["regnDate"] = this.regnDate ? this.regnDate : ""; payload["regnEndDate"] = this.toregnDate ? this.toregnDate : ""; payload["limit"] = 10; payload["consultationStatus"] = this.ConsultStatus; payload["assignStatus"] = ""; payload["formCode"] = this.formCodeDetails; if (this.selectedTab == "allPatient") { if (this.advancedSearch) { if (this.arrivalStatusToggle <= 1) { payload["arraivalStatus"] = this.arrivalStatusToggle; } if (this.arrivalStatusToggle == 1 && this.diagnosisStatus <= 1) { payload["diagnosisStatus"] = this.diagnosisStatus; } if (this.arrivalStatusToggle == 1 && this.pgImoSigned <= 1) { payload["pgImoSignedStatus"] = this.pgImoSigned; } if (this.arrivalStatusToggle == 1 && this.coSigned <= 1) { payload["confirmedStatus"] = this.coSigned; } } this.loading = true; this.http .post( globals.OPRegistration.getListOfOpRegistration, JSON.stringify(payload), { headers: globals.HeaderValue1 } ) .subscribe( (data: { error: boolean; message: string; result: any }) => { if (data.error == false && data.result.length != 0) { this.loading = false; this.patientList = data["result"]; this.consultCount = data["pickCount"]; this.arraivalStatus = '' this.confirmedStatus = '' this.totalCount4 = data["count"]; for (let i = 0; i < this.patientList.length; i++) { this.patientList[i].tabNameString = ""; if (this.patientList[i]?.tabdetail?.length > 0) { this.groupByCategory = this.patientList[i].tabdetail.reduce((group, product) => { const { tabCode } = product; group[tabCode] = group[tabCode] ?? []; group[tabCode].push(product); return group; }, {}); this.groupByInvest = ""; this.groupByPresc = ""; for (const data in this.groupByCategory) { this.groupByCategory[data].forEach((ele) => { if (ele.tabCode == 'INV0001' && ele.status == 0) { this.groupByInvest = ele.tabName let temp = this.groupByInvest + "," + this.groupByPresc; this.patientList[i].tabNameString = temp.replace('undefined,undefined', ''); this.patientList[i].tabNameString = this.patientList[i].tabNameString.replace(',undefined', '') this.patientList[i].tabNameString = this.patientList[i].tabNameString.replace('undefined,', '') } if (ele.tabCode == 'PRE0001' && ele.status == 0) { this.groupByPresc = ele.tabName let temp = this.groupByInvest + "," + this.groupByPresc; this.patientList[i].tabNameString = temp.replace('undefined,undefined', ''); this.patientList[i].tabNameString = this.patientList[i].tabNameString.replace(',undefined', '') this.patientList[i].tabNameString = this.patientList[i].tabNameString.replace('undefined,', '') } }); } } if (this.patientList[i].consultationStatus) { this.patientList[i].consultationStatus = this.patientList[i].consultationStatus.toLowerCase(); if ( this.patientList[i].consultationStatus == "pt. not arrived" ) { this.patientList[i].color = "badge badge-success"; this.patientList[i].DocStatus = "No" } else if ( this.patientList[i].consultationStatus == "arrived" ) { this.patientList[i].color = "badge badge-warning"; this.patientList[i].DocStatus = "Yes" } else { this.patientList[i].DocStatus = "No" this.patientList[i].color = "badge badge-success"; } } if (this.patientList[i].recordStatus == 1 && this.isVykoTeam == 1) { this.patientList[i].colour = "bg-warning" } if (this.doctorDeskType == 'Front Desk' && this.patientList[i].genderValue == 'MALE') { this.patientList[i].genderValueFD = "M" } else if (this.doctorDeskType == 'Front Desk' && this.patientList[i].genderValue == 'FEMALE') { this.patientList[i].genderValueFD = "F" } if (this.doctorDeskType == 'Front Desk' && this.patientList[i].frontDeskArraivalStatus == 1) { this.patientList[i].frntDStatus = "Arrived" this.patientList[i].frntcolor = "badge bg-success"; } if (this.doctorDeskType == 'Front Desk' && !(this.patientList[i].frontDeskArraivalStatus == 1)) { this.patientList[i].frntDStatus = "Not arrived" this.patientList[i].frntcolor = "badge badge-success"; } // this.style=(this.patientList[i].recordStatus==1 &&this.isVykoTeam==1)?{ // 'background':'yellow' // }:{ // 'background':'none' // } // if (this.doctorDeskType == 'Front Desk' && this.patientList[i].frontDeskArraivalStatus == 1) { // this.patientList[i].frntDStatus = "Front Desk Arrived" // this.patientList[i].frntcolor = "badge bg-success"; // } // if (this.doctorDeskType == 'Front Desk' && !(this.patientList[i].frontDeskArraivalStatus == 1)) { // this.patientList[i].frntDStatus = "pt.not arrived" // this.patientList[i].frntcolor = "badge badge-success"; // } // this.style=(this.patientList[i].recordStatus==1 &&this.isVykoTeam==1)?{ // 'background':'yellow' // }:{ // 'background':'none' // } } let limit = 10; this.listCOunt = this.patientList.length; for (let j = 0; j < this.patientList.length; j++) { let offSet = (this.page - 1) * limit; this.patientList[j].slNo = offSet + 1 + j; } } else if (data.error == false && data?.result?.length == 0) { this.loading = false; this.patientList = data["result"]; this.totalCount4 = data["count"]; this.toastr.error("No data for Patient List"); } else { this.loading = false; this.patientList = []; this.totalCount4 = []; this.toastr.error(data?.message || "Something went wrong"); } if (this.patientList?.length > 0) { this.patientList = this.patientList.map((item) => { return ({ ...item, PatientName: item.patientName, departmentName2: item.departmentName }) }) } }, (error) => { this.loading = false; this.toastr.error("Error during get Patient List .") } ); } else { payload["departmentName"] = null; payload["departmentUnit"] = ""; payload["departmentList"] = null; payload["departmentCode"] = null; delete payload["arraivalStatus"]; this.loading = true; this.http .post( globals.revamp.mylistopd, JSON.stringify(payload), { headers: globals.HeaderValue1 } ) .subscribe( (data: { error: boolean; message: string; result: any }) => { if (data?.error == false && data?.result?.length != 0) { this.loading = false; this.patientList = data["result"]; this.consultCount = data["pickCount"]; this.arraivalStatus = '' this.confirmedStatus = '' this.totalCount4 = data["count"]; for (let i = 0; i < this.patientList.length; i++) { this.patientList[i].tabNameString = ""; if (this.patientList[i]?.tabdetail?.length > 0) { this.groupByCategory = this.patientList[i].tabdetail.reduce((group, product) => { const { tabCode } = product; group[tabCode] = group[tabCode] ?? []; group[tabCode].push(product); return group; }, {}); this.groupByInvest = ""; this.groupByPresc = ""; for (const data in this.groupByCategory) { this.groupByCategory[data].forEach((ele) => { if (ele.tabCode == 'INV0001' && ele.status == 0) { this.groupByInvest = ele.tabName let temp = this.groupByInvest + "," + this.groupByPresc; this.patientList[i].tabNameString = temp.replace('undefined,undefined', ''); this.patientList[i].tabNameString = this.patientList[i].tabNameString.replace(',undefined', '') this.patientList[i].tabNameString = this.patientList[i].tabNameString.replace('undefined,', '') } if (ele.tabCode == 'PRE0001' && ele.status == 0) { this.groupByPresc = ele.tabName let temp = this.groupByInvest + "," + this.groupByPresc; this.patientList[i].tabNameString = temp.replace('undefined,undefined', ''); this.patientList[i].tabNameString = this.patientList[i].tabNameString.replace(',undefined', '') this.patientList[i].tabNameString = this.patientList[i].tabNameString.replace('undefined,', '') } }); } } if (this.patientList[i].consultationStatus) { this.patientList[i].consultationStatus = this.patientList[i].consultationStatus.toLowerCase(); if ( this.patientList[i].consultationStatus == "pt. not arrived" ) { this.patientList[i].DocStatus = "No" this.patientList[i].color = "badge badge-success"; } else if ( this.patientList[i].consultationStatus == "arrived" ) { this.patientList[i].color = "badge badge-warning"; this.patientList[i].DocStatus = "Yes" } else { this.patientList[i].DocStatus = "No" this.patientList[i].color = "badge badge-success"; } } if (this.doctorDeskType == 'Front Desk' && this.patientList[i].genderValue == 'MALE') { this.patientList[i].genderValueFD = "M" } else if (this.doctorDeskType == 'Front Desk' && this.patientList[i].genderValue == 'FEMALE') { this.patientList[i].genderValueFD = "F" } if (this.patientList[i].recordStatus == 1 && this.isVykoTeam == 1) { this.patientList[i].colour = "bg-warning" } if (this.doctorDeskType == 'Front Desk' && this.patientList[i].frontDeskArraivalStatus == 1) { this.patientList[i].frntDStatus = "Arrived" this.patientList[i].frntcolor = "badge bg-success"; } if (this.doctorDeskType == 'Front Desk' && !(this.patientList[i].frontDeskArraivalStatus == 1)) { this.patientList[i].frntDStatus = "Not arrived" this.patientList[i].frntcolor = "badge badge-success"; } // this.style=(this.patientList[i].recordStatus==1 &&this.isVykoTeam==1)?{ // 'background':'yellow' // }:{ // 'background':'none' // } } let limit = 10; this.listCOunt = this.patientList.length; for (let j = 0; j < this.patientList.length; j++) { let offSet = (this.page - 1) * limit; this.patientList[j].slNo = offSet + 1 + j; } } else if (data.error == false && data?.result?.length == 0) { this.loading = false; this.patientList = data["result"]; this.totalCount4 = data["count"]; this.toastr.error("No data for Patient List"); } else { this.loading = false; this.patientList = []; this.totalCount4 = []; this.toastr.error(data?.message || "Something went wrong"); } if (this.patientList?.length > 0) { this.patientList = this.patientList.map((item) => { return ({ ...item, PatientName: item.patientName, departmentName2: item.departmentName }) }) } }, (error) => { this.loading = false; this.toastr.error("Error during get Patient List .") } ); } } departmentWiseList = []; totalCount2: any; getOpAllDepartmentPatentList() { this.loading = true; let data = { page: this.page2, organizationId: this.newArray.organizationId, businessId: this.newArray.businessId, groupId: this.newArray.groupId, userId: this.newArray.userId, formName: this.formCodeDetails, roleTypeId: this.newArray.roleTypeId, userTypeId: this.newArray.userTypeId, roleId: this.newArray.roleId, department: this.departmentName ? this.departmentName : null, hospitalNumber: this.hospitalnum, visitNumber: this.visitNo, regnDate: this.regnDate, phoneNumber: this.phoneNumber, altPhoneNumber: this.alternativePhoneNumber, alternativePhoneNumber: this.alternativePhoneNumber, patientName: this.patientName, doctorId: this.doctorId, }; // data'departmentCode'] = this.departmentC; this.loading = true; this.http .post(globals.OPRegistration.listOPreg, JSON.stringify(data), { headers: globals.HeaderValue1, }) .subscribe((data) => { if (data["error"] == false) { this.departmentWiseList = data["result"]; this.loading = false; for (let i = 0; i < this.departmentWiseList.length; i++) { if (this.departmentWiseList[i].consultationStatus) { if (this.departmentWiseList[i].consultationStatus == "pending") { this.departmentWiseList[i].color = "badge badge-success"; } else { this.departmentWiseList[i].color = "badge badge-warning"; } if (this.departmentWiseList[i].isActive == 0) { this.departmentWiseList[i].consultationStatus == "Cancel"; } } } // this.listCOunt = this.departmentWiseList.length; this.totalCount2 = data["count"]; } else if (data["error"] == true) { this.loading = false; this.toastr.error(data["message"]) } else { this.loading = false; this.toastr.error(data["message"] || "something went wrong in doctor desk list ") } }); } // `doctor-master/patient-details?id= ${id}?gg=${gg}` // section/:id1/:id2' // SelectedObj: any = []; // onClickSelection(e, val) { // if (e.target.checked == true) { // var value = { // "hospitalNumber": val["hospitalNumber"] // } // this.SelectedObj.push(value); // } else { // this.SelectedObj.splice(val,1); // } // } DeptList = []; deptObj: any = {}; ListOfDepartment = []; getDepartmentList() { let temp = []; if (this.newArray.isDepartmentRestricted == 1) { this.deptObj["organizationId"] = this.newArray.organizationId; this.deptObj["businessId"] = this.newArray.businessId; this.deptObj["groupId"] = this.newArray.groupId; this.http .post(globals.Department.listOfDepartment, JSON.stringify(this.deptObj), { headers: globals.HeaderValue1, }) .subscribe((data) => { this.ListOfDepartment = data["result"]; this.ListOfDepartment.forEach((element) => { if (element.departmentTypeAppCode == "DEPTTY0001") { temp.push({ id: element.departmentCode, text: element.departmentName, }); } }); this.DeptList = temp; }); } else if (this.newArray.isDepartmentRestricted == 0 || this.doctorDeskType != 'Front Desk') { let temp = [] this.departmentArray = this.loginDetail['departmentData'] this.departmentArray?.forEach((el) => { temp.push({ id: el.departmentCode, text: el.departmentName }) }); this.DeptList = temp; } } SelectedObj: any = []; decrypted: any = []; obj: any = {}; update(data) { let obj = { "hospitalnum": this.hospitalnum, "patientName": this.patientName, "phoneNumber": this.phoneNumber, "alternativePhoneNumber": this.alternativePhoneNumber, "regnDate": this.regnDate, "toregnDate": this.toregnDate, "visitNo": this.visitNo, "ConsultStatus": this.ConsultStatus, "gender": this.gender, "selectedTab": this.selectedTab, "departmentName": this.departmentName, "unit": this.unit, "opdAllPatientTab": this.opdAllPatientTab, "opdMyPatientTab": this.opdMyPatientTab, "followUpPatientListTab": this.followUpPatientListTab, "opdEncounterPatientTab": this.opdEncounterPatientTab, "reviewPatientTab": this.reviewPatientTab } this.patientArray.push(obj); localStorage.setItem("datas", JSON.stringify(this.patientArray)) var value = { hospitalNumber: data["hospitalNumber"], opNumber: data["opNumber"], // visitNumber: data["maxOpVisitNumber"], visitNumber: data["visitNumber"], departmentCode: data["departmentCode"], }; this.SelectedObj.push(value); // localStorage.setItem('patientDetails', JSON.stringify(this.SelectedObj)); var encrypted = this.EncrDecr.set( "123456$#@$^@1ERF", JSON.stringify(this.SelectedObj) ); localStorage.setItem("encrypt", encrypted); // this.decrypted = JSON.stringify(this.SelectedObj) // this.parentMessage = JSON.stringify(this.SelectedObj) this.router.navigate(["/doctor-master/patient-details-desk"]); } updateFront(data) { let obj = { "hospitalnum": this.hospitalnum, "patientName": this.patientName, "phoneNumber": this.phoneNumber, "alternativePhoneNumber": this.alternativePhoneNumber, "regnDate": this.regnDate, "toregnDate": this.toregnDate, "visitNo": this.visitNo, "ConsultStatus": this.ConsultStatus, "gender": this.gender, "selectedTab": this.selectedTab, "departmentName": this.departmentName, "unit": this.unit, "opdAllPatientTab": this.opdAllPatientTab, "opdMyPatientTab": this.opdMyPatientTab, "followUpPatientListTab": this.followUpPatientListTab, "opdEncounterPatientTab": this.opdEncounterPatientTab, "reviewPatientTab": this.reviewPatientTab, "frontDesk": data.frontDeskArraivalStatus, "doctorDeskType": "FrontDesk", } let list =[] list.push(obj); localStorage.setItem("dataFrontDesk", JSON.stringify(list)) var value = { hospitalNumber: data["hospitalNumber"], opNumber: data["opNumber"], visitNumber: data["maxOpVisitNumber"], frontDesk: data["frontDeskArraivalStatus"], doctorDeskType: "FrontDesk", departmentCode: data["departmentCode"], }; this.SelectedObj.push(value); // localStorage.setItem('patientDetails', JSON.stringify(this.SelectedObj)); var encrypted = this.EncrDecr.set( "123456$#@$^@1ERF", JSON.stringify(this.SelectedObj) ); localStorage.setItem("encrypt", encrypted); localStorage.setItem("frontDesk", encrypted); // this.decrypted = JSON.stringify(this.SelectedObj) // this.parentMessage = JSON.stringify(this.SelectedObj) this.router.navigate(["/doctor-master/patient-details-desk"]); }SearchonHospNo(Patient = this.SelectedObj) { this.router.navigate(["/doctor-master/patient-details-opd"], { state: { hospitalNumber: "data" }, }); this.router.navigate([ "/doctor-master/patient-details-opd", JSON.stringify(Patient), ]); } SelectedObjIp: any = []; updateIP(data) { let obj = { "hospitalnum1": this.hospitalnum1, "patientName": this.patientName, "ipNumber": this.ipNumber, "phoneNumber1": this.phoneNumber1, "alternativePhoneNumber1": this.alternativePhoneNumber1, "wardTypeFilter": this.wardTypeFilter, "roomTypeFilter": this.roomTypeFilter, "bednumberFilter": this.bednumberFilter, "gender": this.gender, "regnDate": this.regnDate, "toregnDate": this.toregnDate, "selectedTab": this.selectedTab, "departmentName": this.departmentName, "unit": this.unit, "ipMyPatientListSearch": this.ipMyPatientListSearch, "ipAllPatientSearch": this.ipAllPatientSearch, "ipCrossRefferPatientSearch": this.ipCrossRefferPatientSearch, "ipReviewsListSearch": this.ipReviewsListSearch, "dischargeStatust": this.dischargeStatust, // "drugApproval": this.showAprrovalTab == false ? 1 : 0, "drugApproval": this.restrictedArrayList?.length > 0 ? (this.hospitalNumberMatches(data.hospitalNumber) == true ? 1 : 0):0 } this.patientArrayIP =[] this.patientArrayIP.push(obj); localStorage.setItem("datasIP", JSON.stringify(this.patientArrayIP)) if (data.cancelStatus != '1') { var value = { hospitalNumber: data["hospitalNumber"], ipNumber: data["ipNumber"], type: "Doctor", transactionNumber: data["transactionNumber"], serviceConfirmationStatus: data["serviceConfirmationStatus"], }; this.SelectedObjIp.push(value); var encryptedWard = this.EncrDecr.set( "123456$#@$^@1ERF", JSON.stringify(this.SelectedObjIp) ); localStorage.setItem("encryptWard", encryptedWard); localStorage.setItem("wardDetails", JSON.stringify(this.SelectedObjIp)); this.router.navigate(["/ward-management/manage-ward-service"]); // this.OnSelectIP() } else { } } hospitalNumberMatches(targetNumber) { return this.restrictedArrayList.some(hospital => hospital.hospitalNumber === targetNumber); } defpending:any hospitalNumberMatchValue(targetNumber) { return this.hospitalPendingarray.some(hospital => hospital.hospitalNumber === targetNumber); } revisitOP(id) { this.router.navigateByUrl("/op-reg-list/oPRegFm?hospitalnumber=" + id); } OnSelectIP(IpPatient = this.SelectedObjIp) { this.router.navigate([ "/ward-management/manage-ward-service", JSON.stringify(IpPatient), ]); // this.router.navigateByUrl('/ward-management/manage-ward-service?hospitalnumber='+hospitalnumber); } ipdObj = {}; DummyPatientStyle: any dischargeStatust: any; displayArraivalStatus: any; advancedSearch: boolean = false; getIPpatientList() { this.reviewAndConsultCount('IP') // this.loading = true; cm this.PatientList = []; this.showInMy = true; if (this.newArray.applicationCode == "LOGRO0003") { this.myList = 1; } this.ipdObj["page"] = this.page1; this.ipdObj["organizationId"] = this.newArray.organizationId; this.ipdObj["businessId"] = this.newArray.businessId; this.ipdObj["groupId"] = this.newArray.groupId; this.ipdObj["userTypeId"] = this.newArray.userTypeId; this.ipdObj["roleTypeId"] = this.newArray.roleTypeId; this.ipdObj["loginId"] = this.newArray.loginId; this.ipdObj["roleId"] = this.newArray.roleId; this.ipdObj["department"] = this.departmentName ? this.departmentName : ""; this.ipdObj["departmentList"] = this.departmentListArray ? this.departmentListArray : ""; this.ipdObj["unit"] = this.unit ? this.unit : ""; this.ipdObj["hospitalNumber"] = this.hospitalnum1; this.ipdObj["ipNumber"] = this.ipNumber; this.ipdObj["phoneNumber"] = this.phoneNumber1; this.ipdObj["altPhoneNumber"] = this.alternativePhoneNumber1; // this.ipdObj["altPhoneNumber"] = this.alternativePhoneNumber1; this.ipdObj["myList"] = this.myList; this.ipdObj["fromregnDate"] = this.regnDate ? this.regnDate : ""; this.ipdObj["firstName"] = this.patientName ? this.patientName : ""; this.ipdObj["toregnDate"] = this.toregnDate ? this.toregnDate : ""; this.ipdObj["bedNumber"] = this.bednumberFilter; this.ipdObj["roomType"] = this.roomTypeFilter; this.ipdObj["wardType"] = this.wardTypeFilter; this.ipdObj["gender"] = this.gender; this.ipdObj["deficiencyPending"] = this.deficiencyPending; // this.ipdObj["passPortAvailable"] = this.passPortAvailable; // if (this.passPortAvailable == "PSPA0002") { // this.ipdObj["recordStatus"] = 1; // } // else if (this.passPortAvailable == "PSPA0001") { // this.ipdObj["recordStatus"] = 0; // } if (this.advancedSearch) { if (this.arrivalStatusToggle <= 1) { this.ipdObj["arrivalStatus"] = this.arrivalStatusToggle; } if (this.arrivalStatusToggle == 1 && this.diagnosisStatus <= 1) { this.ipdObj["diagnosisStatus"] = this.diagnosisStatus; } if (this.arrivalStatusToggle == 1 && this.pgImoSigned <= 1) { this.ipdObj["pgImoSignedStatus"] = this.pgImoSigned; } if (this.arrivalStatusToggle == 1 && this.coSigned <= 1) { this.ipdObj["confirmedStatus"] = this.coSigned; } } // if(this.arrivalStatusToggle <= 1){ // this.ipdObj["arraivalStatus"] = this.arrivalStatusToggle; // } // if(this.arrivalStatusToggle == 1 && this.diagnosisStatus <= 1){ // this.ipdObj["diagnosisStatus"] = this.diagnosisStatus; // } // if(this.arrivalStatusToggle == 1 && this.pgImoSigned <= 1){ // this.ipdObj["pgImoSignedStatus"]= this.pgImoSigned; // } // if( this.arrivalStatusToggle == 1 && this.coSigned <= 1){ // this.ipdObj["confirmedStatus"]= this.coSigned; // } //console.log(this.ipdObj) //thi 3 start this.ipdObj["dischargeStatus"] = this.dischargeStatust; // this.ipdObj['userId'] = this.newArray.userId; // this.ipdObj['formName'] = "PG0005"; let temp = []; this.loading = true; this.http .post( globals.DoctorDesk.IPPatientListDoctor, JSON.stringify(this.ipdObj), { headers: globals.HeaderValue1 } ) .subscribe( (data) => { this.loading = false; if (data["error"] == false && data["result"].length != 0) { this.PatientList = data["result"]; let limit = 10; for (let j = 0; j < this.PatientList.length; j++) { let offSet = (this.page1 - 1) * limit; this.PatientList[j].slNo = offSet + 1 + j; } for (let i = 0; i < this.PatientList.length; i++) { if (this.PatientList[i]?.doctorStatus?.length > 0) { this.groupByCategory = this.PatientList[i].doctorStatus.reduce((group, product) => { const { tabCode } = product; group[tabCode] = group[tabCode] ?? []; group[tabCode].push(product); return group; }, {}); this.groupByInvest = ""; this.groupByPresc = ""; for (const data in this.groupByCategory) { this.groupByCategory[data].forEach((ele) => { if (ele.tabCode == 'INV0001' && ele.status == 0) { this.groupByInvest = ele.tabName let temp = this.groupByInvest + "," + this.groupByPresc; this.PatientList[i].tabNameString = temp.replace('undefined,undefined', ''); this.PatientList[i].tabNameString = this.PatientList[i].tabNameString.replace(',undefined', '') this.PatientList[i].tabNameString = this.PatientList[i].tabNameString.replace('undefined,', '') } if (ele.tabCode == 'PHA0001' && ele.status == 0) { this.groupByPresc = ele.tabName let temp = this.groupByInvest + "," + this.groupByPresc; this.PatientList[i].tabNameString = temp.replace('undefined,undefined', ''); this.PatientList[i].tabNameString = this.PatientList[i].tabNameString.replace(',undefined', '') this.PatientList[i].tabNameString = this.PatientList[i].tabNameString.replace('undefined,', '') } }); } } if (this.PatientList[i].arrivalStatus == 1) { this.PatientList[i].displayArraivalStatus = "Arrived" this.PatientList[i].color = "badge badge-success"; } else if (this.PatientList[i].arrivalStatus == 0) { this.PatientList[i].displayArraivalStatus = "Not-Arrived" this.PatientList[i].color = "badge badge-warning"; } if (this.PatientList[i].dischargeStatus == 1) { this.PatientList[i].disc = "Discharged"; } else if (this.PatientList[i].cancelStatus == 1) { this.PatientList[i].disc = "Cancelled"; } else if (this.PatientList[i].dischargeIntimation == 1 && this.PatientList[i].clearanceStatus == 0 && this.PatientList[i].dischargeConfirmation == 0) { this.PatientList[i].disc = "Discharge Intimated"; } else if (this.PatientList[i].dischargeIntimation == 1 && this.PatientList[i].clearanceStatus == 1 && this.PatientList[i].dischargeConfirmation == 0) { this.PatientList[i].disc = "Clearance Completed"; } else if (this.PatientList[i].dischargeIntimation == 1 && this.PatientList[i].clearanceStatus == 1 && this.PatientList[i].dischargeConfirmation == 1) { this.PatientList[i].disc = "Discharge Confirmed"; } else { this.PatientList[i].disc = "On-Going"; } // this.DummyPatientStyle=(this.PatientList[i].recordStatus==1 && this.isVykoTeam==1)?{ // 'background':'yellow' // }:{ // 'background':'none' // } } for (let i = 0; i < this.PatientList.length; i++) { if (this.PatientList[i].disc) { if (this.PatientList[i].disc == "Discharged") { this.PatientList[i].color = "badge badge-success"; } else if (this.PatientList[i].disc == "Cancelled") { this.PatientList[i].color = "badge badge-danger"; } else if (this.PatientList[i].disc == "Discharge Intimated") { this.PatientList[i].color = "badge bg-primary"; } else if (this.PatientList[i].disc == "Clearance Completed") { this.PatientList[i].color = "badge bg-secondary text-light"; } else if (this.PatientList[i].disc == "Discharge Confirmed") { this.PatientList[i].color = "badge bg-warning text-dark"; } else { this.PatientList[i].color = "badge badge-warning"; } } else if (this.PatientList[i].recordStatus == 1 && this.isVykoTeam == 1) { this.PatientList[i].colour = "bg-warning" } else { } } this.totalCount1 = data["pageCount"]; } else if (data["error"] == false && data["result"].length == 0) { this.loading = false; this.toastr.error("No data for IPD") } else { // cm this.toastr.error(data["message"] || "Something went wrong") } }, (error) => { this.loading = false; this.toastr.error("Error in IPD ALl Patient list .") } ); } page: number = 1; pageArray: any = []; handlePageChange(e) { this.page = e; this.pageArray.push(this.page) localStorage.setItem("dataPage", JSON.stringify(this.pageArray)); let obj = { "hospitalnum": this.hospitalnum, "patientName": this.patientName, "phoneNumber": this.phoneNumber, "alternativePhoneNumber": this.alternativePhoneNumber, "regnDate": this.regnDate, "toregnDate": this.toregnDate, "visitNo": this.visitNo, "ConsultStatus": this.ConsultStatus, "gender": this.gender, "selectedTab": this.selectedTab, "departmentName": this.departmentName, "unit": this.unit, "opdAllPatientTab": this.opdAllPatientTab, "opdMyPatientTab": this.opdMyPatientTab, "followUpPatientListTab": this.followUpPatientListTab, "opdEncounterPatientTab": this.opdEncounterPatientTab, "reviewPatientTab": this.reviewPatientTab, "showInMy": true } this.patientArray.push(this.obj); localStorage.setItem("datas", JSON.stringify(this.patientArray)) this.getPatientListList(); } restPage: number = 1; // handleRestricted(e) { // this.restPage = e; // } page1: number = 1; handlePageChange1(e) { this.page1 = e; this.pageArray.push(this.page1) localStorage.setItem("dataPageIP", JSON.stringify(this.pageArray)); let obj = { "hospitalnum1": this.hospitalnum1, "patientName": this.patientName, "ipNumber": this.ipNumber, "phoneNumber1": this.phoneNumber1, "alternativePhoneNumber1": this.alternativePhoneNumber1, "wardTypeFilter": this.wardTypeFilter, "roomTypeFilter": this.roomTypeFilter, "bednumberFilter": this.bednumberFilter, "gender": this.gender, "regnDate": this.regnDate, "toregnDate": this.toregnDate, "selectedTab": this.selectedTab, "departmentName": this.departmentName, "unit": this.unit, "ipMyPatientListSearch": this.ipMyPatientListSearch, "ipAllPatientSearch": this.ipAllPatientSearch, "ipCrossRefferPatientSearch": this.ipCrossRefferPatientSearch, "ipReviewsListSearch": this.ipReviewsListSearch, "dischargeStatust": this.dischargeStatust } this.patientArrayIP.push(obj); localStorage.setItem("datasIP", JSON.stringify(this.patientArrayIP)) this.getIPpatientList(); } page2: number = 1; handlePageChangeDepartment(e) { this.page = e; this.pageArray.push(this.page) localStorage.setItem("dataPage", JSON.stringify(this.pageArray)); let obj = { "hospitalnum": this.hospitalnum, "patientName": this.patientName, "phoneNumber": this.phoneNumber, "alternativePhoneNumber": this.alternativePhoneNumber, "regnDate": this.regnDate, "toregnDate": this.toregnDate, "visitNo": this.visitNo, "ConsultStatus": this.ConsultStatus, "gender": this.gender, "selectedTab": this.selectedTab, "departmentName": this.departmentName, "unit": this.unit, "opdAllPatientTab": this.opdAllPatientTab, "opdMyPatientTab": this.opdMyPatientTab, "followUpPatientListTab": this.followUpPatientListTab, "opdEncounterPatientTab": this.opdEncounterPatientTab, "reviewPatientTab": this.reviewPatientTab } this.patientArray.push(this.obj); localStorage.setItem("datas", JSON.stringify(this.patientArray)) this.doctorId = this.newArray.loginId; this.getPatientListList(); } //OPD changeHos(e) { this.hospitalnum = e; } changeName(e) { this.patientName = e; } changeNum(e) { this.phoneNumber = e; } // Date range filter restriction changeFrom(e) { let fromDate = moment(e?.target?.value); let toDate = moment(this.toregnDate); let daysDifference = toDate.diff(fromDate, 'days'); if (daysDifference > 30 || daysDifference < 0 || !this.toregnDate) { this.toregnDate = fromDate.add(30, 'days').format("YYYY-MM-DD"); } // this.regnDate = e; } changeTo(e) { let fromDate = moment(this.regnDate); let toDate = moment(e?.target?.value); let daysDifference = toDate.diff(fromDate, 'days'); if (daysDifference > 30 || daysDifference < 0 || !this.regnDate) { this.regnDate = toDate.subtract(30, 'days').format("YYYY-MM-DD"); } // this.toregnDate = e; } changeDep(e) { if (!e) { return; } this.seldepartmentType(e) this.departmentName = e; this.departmentListArray = [e]; } //IPD changeHospital(e) { this.hospitalnum1 = e; } changeIP(e) { this.ipNumber = e; } SelectedsObj: any = []; // decrypted: any = []; viewRevisitDEmographicDetails(data, val) { let value = { hospitalNumber: data["hospitalNumber"], opNumber: data["opNumber"], visitNumber: data["visitNumber"], Update: val, user: 'Doctor', }; // localStorage.removeItem("revisit") this.SelectedsObj.push(value); var encrypted = this.EncrDecr.set( "123456$#@$^@1ERF", JSON.stringify(this.SelectedsObj) ); localStorage.setItem("revisit", encrypted); this.router.navigate(["/op-reg-list/oPRegFm"]); } // navigate() { // localStorage.removeItem("revisit") // this.router.navigate(["/op-reg-list/oPRegFm"]); // } submitdoctorOPD(value) { if (this.reviewListObj["isReview"] == 1) { this.reviewList('OP') return } if (this.reviewListObj["reviewAndConsult"] == 1) { this.consultList('OP') return } // if(this.selectedTabIdMy this.selectedTabIdAll this.selectedTabIdFoll this.selectedTabIdEnt) if ( this.opdAllPatientTab == 1 && this.opdDepartmentPatientTab == 0 && this.opdMyPatientTab == 0 && this.reviewPatientTab == 0 && this.followUpPatientListTab == 0 && this.opdEncounterPatientTab == 0 ) { this.selectedTab = "allPatient"; this.page = 1; // this.getPatientListList(); if (this.hospitalnum || this.phoneNumber) { this.regnDate = ''; this.toregnDate = ''; this.patientName = null; this.alternativePhoneNumber = null; this.unit = ""; this.departmentName = null; this.departmentListArray = []; this.confirmedStatus = "" this.gender = ""; this.getPatientListList(); } else if (this.regnDate || this.toregnDate) { this.regnDate = this.regnDate; this.toregnDate = this.toregnDate; this.getPatientListList(); } else { this.regnDate = globals.formatDate(new Date()); this.toregnDate = globals.formatDate(new Date()); this.getPatientListList(); } } if ( this.opdAllPatientTab == 0 && this.opdDepartmentPatientTab == 0 && this.opdMyPatientTab == 1 && this.reviewPatientTab == 0 && this.followUpPatientListTab == 0 && this.opdEncounterPatientTab == 0 ) { this.selectedTab = "myPatient"; // this.getOpAllDepartmentPatentList(); // if (this.hospitalnum || this.phoneNumber) { // this.regnDate = ''; // this.toregnDate = ''; // this.getOpAllDepartmentPatentList(); this.showAllFiltersAllPatientTab = false this.getPatientListList(); // } // else if (this.regnDate || this.toregnDate) { // this.regnDate = this.regnDate; // this.toregnDate = this.toregnDate; // // this.getOpAllDepartmentPatentList(); // this.getPatientListList(); // } // else { // this.regnDate = globals.formatDate(new Date()); // this.toregnDate = globals.formatDate(new Date()); // // this.getOpAllDepartmentPatentList(); // this.getPatientListList(); // } } if ( this.opdAllPatientTab == 0 && this.opdDepartmentPatientTab == 0 && this.opdMyPatientTab == 0 && this.followUpPatientListTab == 1 && this.reviewPatientTab == 0 && this.opdEncounterPatientTab == 0 ) { this.selectedTab = "followPatient"; this.getFollowUpPatientList(); if (this.hospitalnum || this.phoneNumber) { this.regnDate = ''; this.toregnDate = ''; this.getFollowUpPatientList(); } else if (this.regnDate || this.toregnDate) { this.regnDate = this.regnDate; this.toregnDate = this.toregnDate; this.getFollowUpPatientList(); } else { this.regnDate = globals.formatDate(new Date()); this.toregnDate = globals.formatDate(new Date()); this.getFollowUpPatientList(); } } if ( this.opdAllPatientTab == 0 && this.opdDepartmentPatientTab == 0 && this.opdMyPatientTab == 0 && this.followUpPatientListTab == 0 && this.reviewPatientTab == 0 && this.opdEncounterPatientTab == 1 ) { this.selectedTab = "encountPatient"; // this.getEncounterPatientList(); if (this.hospitalnum || this.phoneNumber) { this.regnDate = ''; this.toregnDate = ''; this.getEncounterPatientList(); } else if (this.regnDate || this.toregnDate) { this.regnDate = this.regnDate; this.toregnDate = this.toregnDate; this.getEncounterPatientList(); } else { this.regnDate = globals.formatDate(new Date()); this.toregnDate = globals.formatDate(new Date()); this.getEncounterPatientList(); } } if ( this.opdAllPatientTab == 0 && this.opdDepartmentPatientTab == 0 && this.opdMyPatientTab == 0 && this.followUpPatientListTab == 0 && this.opdEncounterPatientTab == 0 && this.reviewPatientTab == 1 ) { this.selectedTab = "reviewPatient"; this.getDoctorReviewList(); if (this.hospitalnum || this.phoneNumber) { this.regnDate = ''; this.toregnDate = ''; this.getDoctorReviewList(); } else if (this.regnDate || this.toregnDate) { this.regnDate = this.regnDate; this.toregnDate = this.toregnDate; this.getDoctorReviewList(); } else { this.regnDate = globals.formatDate(new Date()); this.toregnDate = globals.formatDate(new Date()); this.getDoctorReviewList(); } } if ( this.opdAllPatientTab == 0 && this.opdDepartmentPatientTab == 0 && this.opdEncounterPatientTab == 0 && this.opdMyPatientTab == 1 && this.reviewPatientTab == 1 ) { // this.getPatientListList(); if (this.hospitalnum || this.phoneNumber) { this.regnDate = ''; this.toregnDate = ''; this.getPatientListList(); } else if (this.regnDate || this.toregnDate) { this.regnDate = this.regnDate; this.toregnDate = this.toregnDate; this.getPatientListList(); } else { this.regnDate = globals.formatDate(new Date()); this.toregnDate = globals.formatDate(new Date()); this.getPatientListList(); } } let obj = { "hospitalnum": this.hospitalnum, "patientName": this.patientName, "phoneNumber": this.phoneNumber, "alternativePhoneNumber": this.alternativePhoneNumber, "regnDate": this.regnDate, "toregnDate": this.toregnDate, "visitNo": this.visitNo, "ConsultStatus": this.ConsultStatus, "gender": this.gender, "selectedTab": this.selectedTab, "departmentName": this.departmentName, "unit": this.unit, "opdAllPatientTab": this.opdAllPatientTab, "opdMyPatientTab": this.opdMyPatientTab, "followUpPatientListTab": this.followUpPatientListTab, "opdEncounterPatientTab": this.opdEncounterPatientTab, "reviewPatientTab": this.reviewPatientTab } this.patientArray.push(this.obj); localStorage.setItem("datas", JSON.stringify(this.patientArray)) // value['hospitalNumber'] = (this.hospitalnum) ? this.hospitalnum : null; // value['patientName'] = this.patientName ? this.patientName : null; // value['phoneNumber'] = (this.phoneNumber) ? this.phoneNumber : null; // value['organizationId'] = this.newArray.organizationId; // value['businessId'] = this.newArray.businessId; // value['groupId'] = this.newArray.groupId; // value['userId'] = this.newArray.userId; // value['roleTypeId'] = this.newArray.roleTypeId; // value['userTypeId'] = this.newArray.userTypeId; // value['roleId'] = this.newArray.roleId; // value['formName'] = this.formCodeDetails; // value['department'] = this.newArray.department; // // value['opNumber'] = (this.opNumber) ? this.opNumber : null; // value['page'] = this.page; // this.http.post(globals.OPRegistration.listOPreg, JSON.stringify(value), { headers: globals.HeaderValue1 }).subscribe( // data => { // this.patientList = []; // this.patientList = data['result']; // for (let i = 0; i < this.patientList.length; i++) { // if (this.patientList[i].consultationStatus == 'pending') { // this.patientList[i].color = "badge badge-success" // } else { // this.patientList[i].color = "badge badge-warning" // } // } // // cm // this.searchEnable = false; // } // ) } getOldDateForSearch() { // let currDate = new Date(); // currDate.setDate(currDate.getDate() - 7); let currDate = new Date("2023-01-07"); return currDate; } ipdObject: any = {}; ipAllPatientSearch: any; ipMyPatientListSearch: any; ipCrossRefferPatientSearch: any; submitdoctorIPD(value) { if (this.isRejectTab === true) { this.ipdRejectReviewOb = { department: this.departmentName || '', unit: this.unit || '', hospitalNumber: this.hospitalnum1, fromregnDate: this.regnDate || '', toregnDate: this.toregnDate || '', ipNumber: this.ipNumber || '', firstName: this.patientName || '' }; this.rejectedRestrictedDrugList(); // ✅ Call this return; } if(this.showAprrovalTab == false){ this.restrictedDrugList() return } // // cm if (this.reviewListObj["isReview"] == 1) { this.reviewListIP('IP') return } if (this.reviewListObj["reviewAndConsult"] == 1) { this.consultListIP('IP') return } this.page1 = 1; if ( this.ipAllPatientSearch == 1 && this.ipMyPatientListSearch == 0 && this.ipReviewsListSearch == 0 && this.ipCrossRefferPatientSearch == 0 ) { this.showInMy = true; this.selectedTab = "alllistpatientIP"; if (this.hospitalnum1) { this.departmentName = ""; this.departmentListArray = []; this.unit = ""; this.ipNumber = ""; this.phoneNumber1 = ""; this.alternativePhoneNumber1 = ""; this.myList = ""; this.regnDate = ""; this.patientName = ""; this.toregnDate = ""; this.bednumberFilter = ""; this.roomTypeFilter = ""; this.wardTypeFilter = ""; this.gender = ""; this.deficiencyPending = ""; } this.getIPpatientList(); } if ( this.ipAllPatientSearch == 0 && this.ipMyPatientListSearch == 1 && this.ipReviewsListSearch == 0 && this.ipCrossRefferPatientSearch == 0 ) { this.selectedTab = "mylistpatientIP"; this.getMyPatientListForIp(); } if ( this.ipAllPatientSearch == 0 && this.ipMyPatientListSearch == 0 && this.ipReviewsListSearch == 0 && this.ipCrossRefferPatientSearch == 1 ) { this.selectedTab = "crosslistpatientIP"; this.getCrossRefferalList(); } if ( this.ipAllPatientSearch == 0 && this.ipMyPatientListSearch == 0 && this.ipCrossRefferPatientSearch == 0 && this.ipReviewsListSearch == 1 ) { this.selectedTab = "reviewPatientListIp"; this.getReviewsPatientIpList(); } // this.hospitalnum1 || this.ipNumber || this.phoneNumber || this.wardTypeFilter || this.roomTypeFilter || this.bednumberFilter // if (this.hospitalnum1) { // this.regnDate = ''; // this.toregnDate = ''; // this.getIPpatientList(); // } let obj = { "hospitalnum1": this.hospitalnum1, "patientName": this.patientName, "ipNumber": this.ipNumber, "phoneNumber1": this.phoneNumber1, "alternativePhoneNumber1": this.alternativePhoneNumber1, "wardTypeFilter": this.wardTypeFilter, "roomTypeFilter": this.roomTypeFilter, "bednumberFilter": this.bednumberFilter, "gender": this.gender, "regnDate": this.regnDate, "toregnDate": this.toregnDate, "selectedTab": this.selectedTab, "departmentName": this.departmentName, "unit": this.unit, "ipMyPatientListSearch": this.ipMyPatientListSearch, "ipAllPatientSearch": this.ipAllPatientSearch, "ipCrossRefferPatientSearch": this.ipCrossRefferPatientSearch, "ipReviewsListSearch": this.ipReviewsListSearch, "dischargeStatust": this.dischargeStatust } this.patientArrayIP.push(obj); localStorage.setItem("datasIP", JSON.stringify(this.patientArrayIP)) // this.ipdObject['hospitalNumber'] = (this.hospitalnum1) ? this.hospitalnum1 : null; // // this.ipdObject['patientName'] = this.patientName1 ? this.patientName1 : null; // this.ipdObject['phoneNumber'] = (this.phoneNumber1) ? this.phoneNumber1 : null; // this.ipdObject['ipNumber'] = (this.ipNumber) ? this.ipNumber : null; // this.ipdObject['page'] = this.page1; // this.ipdObject['organizationId'] = this.newArray.organizationId; // this.ipdObject['businessId'] = this.newArray.businessId; // this.ipdObject['groupId'] = this.newArray.groupId; // this.ipdObject['department'] = this.newArray.department; // this.ipdObject['roleTypeId'] = this.newArray.roleTypeId; // this.ipdObject['userTypeId'] = this.newArray.userTypeId; // this.ipdObject['roleId'] = this.newArray.roleId; // // this.ipdObject['page'] = this.page; // this.PatientList = []; // let temp = []; // this.http.post(globals.DoctorDesk.IPPatientListDoctor, JSON.stringify(this.ipdObject), { headers: globals.HeaderValue1 }).subscribe( // data => { // if (data['error'] == false) { // this.PatientList = data['result']; // this.totalCount1 = data['pageCount'] // for (let i = 0; i < this.PatientList.length; i++) { // if (this.PatientList[i].dischargeStatus == 1) { // this.PatientList[i].disc = "Discharged" // } else { // this.PatientList[i].disc = "On-Going" // } // } // // cm // } // if (data['error'] == true) { // // cm // Swal.fire({ // text: data['message'] // }) // } // } // ) } onClick1() { this.regnDate = ''; this.toregnDate = ''; this.consult = 0; this.isReview = 0 this.reviewAndConsult = 0 // localStorage.removeItem("datas"); // localStorage.removeItem("datasIP"); // localStorage.removeItem("dataPage"); this.unit = ''; this.diagnosisStatus = 0; this.arrivalStatusToggle = 0; this.pgImoSigned = 0; this.coSigned = 0; this.bednumberFilter = ''; this.roomTypeFilter = ''; this.wardTypeFilter = ''; this.departmentName = ''; this.phoneNumber1 = ''; this.ipNumber = ''; this.hospitalnum1 = ''; this.patientName = ''; this.alternativePhoneNumber1 = ''; this.gender = ''; this.doctorIPDFm.reset(); this.departmentListArray = []; if (this.isRejectTab === true) { this.ipdRejectReviewOb = { department: '', unit: '', hospitalNumber: '', fromregnDate: '', toregnDate: '', ipNumber: '', firstName: '' }; this.rejectedRestrictedDrugList(); } // this.departmentListArray = this.loginDetail?.departmentData.map(obj => obj.departmentCode); } /** * Follow Up */ followUpPatientList = []; totalCount3: any; pageNo: any = 1; totalFollowUpCount: any; getFollowUpPatientList() { let Temp = { organizationId: this.newArray.organizationId, businessId: this.newArray.businessId, groupId: this.newArray.groupId, page: this.pageNo, departmentName: this.departmentName ? this.departmentName : null, hospitalNumber: this.hospitalnum, confirmedStatus: this?.confirmedStatus ? this.confirmedStatus : "", arraivalStatus: this?.arraivalStatus, visitNo: this.visitNo, departmentUnit: this.unit ? this.unit : "", regnDate: this.regnDate, toregnDate: this.toregnDate, phoneNumber: this.phoneNumber, altPhoneNumber: this.alternativePhoneNumber, alternativePhoneNumber: this.alternativePhoneNumber, patientName: this.patientName, genderName: this.gender, // doctorId: this.doctorId, followUp: true, }; ///////////// this.loading = true; this.http .post( globals.OPRegistration.doctorDeskAllPatientLIst, JSON.stringify(Temp), { headers: globals.HeaderValue1 } ) .subscribe( (data) => { this.loading = false; if (data["error"] == false) { this.totalFollowUpCount = 0; this.followUpPatientList = []; this.followUpPatientList = data["result"]; this.totalFollowUpCount = data["count"]; // for (let j = 0; j < data['result'].length; j++) { // if (data['result'][j].FallowUpStatus!=null){ // let temp=(data['result'][j]) // this.followUpPatientList.push(temp) // } // } for (let i = 0; i < this.followUpPatientList.length; i++) { if (this.followUpPatientList[i].consultationStatus) { if ( this.followUpPatientList[i].consultationStatus == "pending" ) { this.followUpPatientList[i].color = "badge badge-success"; } else { this.followUpPatientList[i].color = "badge badge-warning"; } if (this.followUpPatientList[i].isActive == 0) { this.followUpPatientList[i].consultationStatus == "Cancel"; } } } let limit = 10; for (let j = 0; j < this.followUpPatientList.length; j++) { let offSet = (this.pageNo - 1) * limit; this.followUpPatientList[j].slNo = offSet + 1 + j; this.listCOunt = this.followUpPatientList.length; } // } if (data["error"] == true) { this.loading = false; this.toastr.error(data["message"]) } else { this.loading = false; //this.toastr.error(data["message"]) } }, (error) => { this.loading = false; this.toastr.error("Error while getting Follow List .") } ); } onClick() { this.doctorOPDFm.reset(); //this.regnDate = globals.formatDate(new Date()); this.doctorOPDFm.patchValue({ regnDate: this.regnDate }); // this.getPatientListList(); // localStorage.removeItem("datas"); // localStorage.removeItem("datasIP"); // localStorage.removeItem("dataPage"); this.consult = 0; this.diagnosisStatus = 2; this.arrivalStatusToggle = 0; this.pgImoSigned = 2; this.coSigned = 2; this.hospitalnum = ''; this.patientName = ''; this.phoneNumber = ''; this.departmentName = ''; this.unit = ''; this.confirmedStatus = ''; this.arraivalStatus = ''; this.departmentListArray = []; // this.departmentListArray = this.loginDetail?.departmentData.map(obj => obj.departmentCode); //this.getOpAllDepartmentPatentList(); } handlePageChangeFollowUp(e) { this.pageNo = e; this.pageArray.push(this.page) localStorage.setItem("dataPage", JSON.stringify(this.pageArray)); let obj = { "hospitalnum": this.hospitalnum, "patientName": this.patientName, "phoneNumber": this.phoneNumber, "alternativePhoneNumber": this.alternativePhoneNumber, "regnDate": this.regnDate, "toregnDate": this.toregnDate, "visitNo": this.visitNo, "ConsultStatus": this.ConsultStatus, "gender": this.gender, "selectedTab": this.selectedTab, "departmentName": this.departmentName, "unit": this.unit, "opdAllPatientTab": this.opdAllPatientTab, "opdMyPatientTab": this.opdMyPatientTab, "followUpPatientListTab": this.followUpPatientListTab, "opdEncounterPatientTab": this.opdEncounterPatientTab, "reviewPatientTab": this.reviewPatientTab } this.patientArray.push(this.obj); localStorage.setItem("datas", JSON.stringify(this.patientArray)) this.getFollowUpPatientList(); } consultCount: any; ipMyPatientList: any; isReview: any; ipTotalCount: any; reviewAndConsult: any; getMyPatientListForIp() { this.HideDept = true; if(this.showAprrovalTab == false){ this.HideDept = false; } this.showInMy = false; this.getAssignCountIp() this.reviewAndConsultCount('IP') // cm this.loginDetail = JSON.parse(localStorage.getItem('LOGGEDINUSERDATA')); this.doctorCode = this.loginDetail['doctorCode']; if (this.newArray.applicationCode == "LOGRO0003") { this.myList = 0; } if (this.consult == true) { this.isReview = 1 this.reviewAndConsult = 1 } let data = { page: this.pageNoIp, organizationId: this.newArray.organizationId, businessId: this.newArray.businessId, groupId: this.newArray.groupId, userTypeId: this.newArray.userTypeId, roleTypeId: this.newArray.roleTypeId, loginId: this.newArray.loginId, doctorId: this.doctorCode, roleId: this.newArray.roleId, department: null, departmentListArray: null, myList: this.myList, hospitalNumber: this.hospitalnum1, ipNumber: this.ipNumber, bedNumber: this.bednumberFilter, phoneNumber: this.phoneNumber1, alternativePhoneNumber: this.alternativePhoneNumber, fromregnDate: this.regnDate, toregnDate: this.toregnDate, dischargeStatus: this.dischargeStatust, gender: this.gender, firstName: this.patientName ? this.patientName : "", altPhoneNumber: this.alternativePhoneNumber1 ? this.alternativePhoneNumber1 : "", reviewAndConsult: this.consult == true ? 1 : 0, isReview: this.isReview, listType: 'MY_LIST', assignStatus: "", }; this.opdMyPatientTab = 0 this.ipMyPatientListSearch = 1 this.http .post(globals.revamp.myListIpd, JSON.stringify(data), { headers: globals.HeaderValue1, }) .subscribe( (data) => { if (data["error"] == false) { this.ipMyPatientList = [] this.ipTotalCount = 0; this.consultCount = 0; if (data["result"]) { this.ipMyPatientList = data["result"]; this.ipTotalCount = data["pageCount"]; this.consultCount = data["pickCount"]; for (let i = 0; i < this.ipMyPatientList.length; i++) { if (this.ipMyPatientList[i]?.doctorStatus?.length > 0) { this.groupByCategory = this.ipMyPatientList[i].doctorStatus.reduce((group, product) => { const { tabCode } = product; group[tabCode] = group[tabCode] ?? []; group[tabCode].push(product); return group; }, {}); this.groupByInvest = ""; this.groupByPresc = ""; for (const data in this.groupByCategory) { this.groupByCategory[data].forEach((ele) => { if (ele.tabCode == 'INV0001' && ele.status == 0) { this.groupByInvest = ele.tabName let temp = this.groupByInvest + "," + this.groupByPresc; this.ipMyPatientList[i].tabNameString = temp.replace('undefined,undefined', ''); this.ipMyPatientList[i].tabNameString = this.ipMyPatientList[i].tabNameString.replace(',undefined', '') this.ipMyPatientList[i].tabNameString = this.ipMyPatientList[i].tabNameString.replace('undefined,', '') } if (ele.tabCode == 'PHA0001' && ele.status == 0) { this.groupByPresc = ele.tabName let temp = this.groupByInvest + "," + this.groupByPresc; this.ipMyPatientList[i].tabNameString = temp.replace('undefined,undefined', ''); this.ipMyPatientList[i].tabNameString = this.ipMyPatientList[i].tabNameString.replace(',undefined', '') this.ipMyPatientList[i].tabNameString = this.ipMyPatientList[i].tabNameString.replace('undefined,', '') } }); } } if (this.ipMyPatientList[i].dischargeStatus == 1) { this.ipMyPatientList[i].disc = "Discharged"; } else if (this.ipMyPatientList[i].cancelStatus == 1) { this.ipMyPatientList[i].disc = "Cancelled"; } else { this.ipMyPatientList[i].disc = "On-Going"; } // } } let limit = 10; for (let j = 0; j < this.ipMyPatientList.length; j++) { let offSet = (this.pageNoIp - 1) * limit; this.ipMyPatientList[j].slNo = offSet + 1 + j; this.listCOunt = this.ipMyPatientList.length; } for (let i = 0; i < this.ipMyPatientList.length; i++) { if (this.ipMyPatientList[i].disc == "Discharged") { this.ipMyPatientList[i].color = "badge badge-success"; } else if (this.ipMyPatientList[i].disc == "Cancelled") { this.ipMyPatientList[i].color = "badge badge-danger"; } else { this.ipMyPatientList[i].color = "badge badge-warning"; } } } else { } } else { // cm this.toastr.error("Something went wrong in IP Patient List") } }, (error) => { // cm this.toastr.error("Error in IP Patient List .") } ); } onClickMyPatientIp() { localStorage.removeItem("datasIP") localStorage.removeItem("clickedTab"); localStorage.removeItem("dataPageIP"); // this.regnDate = globals.formatDate(new Date()); this.regnDate = ""; this.toregnDate = ""; if (this.prevSelectedTab == 'alllistpatientIP') { this.HideDept = false; this.showInMy = true; } else { this.HideDept = true; this.showInMy = false; } // this.page1 = 1; this.ipMyPatientListSearch = 1; this.ipAllPatientSearch = 0; this.ipCrossRefferPatientSearch = 0; this.ipReviewsListSearch = 0; this.getMyPatientListForIp(); this.selectedTab = "mylistpatientIP"; } onClickAllPatientIp() { localStorage.removeItem("datasIP") localStorage.removeItem("clickedTab"); localStorage.removeItem("dataPageIP"); this.regnDate = ""; this.toregnDate = ""; this.HideDept = false; this.showInMy = true; this.pageNoIp = 1; this.ipAllPatientSearch = 1; this.ipCrossRefferPatientSearch = 0; this.ipMyPatientListSearch = 0; this.ipReviewsListSearch = 0; this.getIPpatientList(); this.getDepartmentList(); this.selectedTab = "alllistpatientIP"; } ///thi start dischargedList() { this.HideDept = false; this.showInMy = true; this.ipAllPatientSearch = 1; this.ipCrossRefferPatientSearch = 0; this.ipMyPatientListSearch = 0; this.dischargeStatust = 1 let obj = { "hospitalnum1": this.hospitalnum1, "patientName": this.patientName, "ipNumber": this.ipNumber, "phoneNumber1": this.phoneNumber1, "alternativePhoneNumber1": this.alternativePhoneNumber1, "wardTypeFilter": this.wardTypeFilter, "roomTypeFilter": this.roomTypeFilter, "bednumberFilter": this.bednumberFilter, "gender": this.gender, "regnDate": this.regnDate, "toregnDate": this.toregnDate, "selectedTab": this.selectedTab, "departmentName": this.departmentName, "unit": this.unit, "ipMyPatientListSearch": this.ipMyPatientListSearch, "ipAllPatientSearch": this.ipAllPatientSearch, "ipCrossRefferPatientSearch": this.ipCrossRefferPatientSearch, "ipReviewsListSearch": this.ipReviewsListSearch, "dischargeStatust": this.dischargeStatust } this.patientArrayIP.push(obj); localStorage.setItem("datasIP", JSON.stringify(this.patientArrayIP)) this.getIPpatientList(); this.getCount(); } consultList(x) { this.loading = true; if (!this.selectedDOctorId || this.selectedDOctorId == "myPatient" || this.opdMyPatientTab == 1) { this.opdObj["doctorId"] = this?.doctorId ? this?.doctorId : ""; this.opdObj["isReview"] = this.review == true ? 1 : 0; this.opdObj["reviewAndConsult"] = 1 if (this.opdObj["reviewAndConsult"] == 1) { this.opdObj["isReview"] = 1 } else if (this.opdObj["doctorId"] == "") { this.opdObj["isReview"] = 0 this.opdObj["reviewAndConsult"] = 0 } } else { this.opdObj["doctorId"] = ""; this.opdObj["isReview"] = 0 this.opdObj["reviewAndConsult"] = 0 } this.reviewListObj["isReview"] = 0; this.reviewListObj["reviewAndConsult"] = 1; this.reviewListObj["loginId"] = this.newArray.userId; this.reviewListObj["organizationId"] = this.newArray.organizationId; this.reviewListObj["businessId"] = this.newArray.businessId; this.reviewListObj["groupId"] = this.newArray.groupId; this.reviewListObj["hospitalNumber"] = this.hospitalnum ? this.hospitalnum : null; this.reviewListObj["visitNumber"] = this.visitNo ? this.visitNo : null; this.reviewListObj["patientName"] = this.patientName ? this.patientName : null; this.reviewListObj["phoneNumber"] = this.phoneNumber ? this.phoneNumber : null; this.reviewListObj["regnDate"] = this.regnDate ? this.regnDate : ""; this.reviewListObj["regnEndDate"] = this.toregnDate ? this.toregnDate : ""; // if(this.passPortAvailable == "PSPA0002"){ // this.reviewListObj["recordStatus"] = 1; // } // else if(this.passPortAvailable == "PSPA0001"){ // this.reviewListObj["recordStatus"] = 0; // } this.reviewListObj["consultationStatus"] = this.ConsultStatus; this.reviewListObj["opOrIp"] = x; this.http .post( globals.DoctorDesk.reviewAndConsultList, JSON.stringify(this.reviewListObj), { headers: globals.HeaderValue1 } ) .subscribe( (data: { error: boolean; message: string; result: any }) => { this.loading = false; this.patientList = [] if (data.error == false && data?.result?.length != 0 && x == 'OP') { this.patientList = data["result"]; this.totalCount4 = data["count"]; this.conCount = data["count"] for (let i = 0; i < this.patientList.length; i++) { this.patientList[i].tabNameString = ""; if (this.patientList[i]?.tabdetail?.length > 0) { this.groupByCategory = this.patientList[i].tabdetail.reduce((group, product) => { const { tabCode } = product; group[tabCode] = group[tabCode] ?? []; group[tabCode].push(product); return group; }, {}); this.groupByInvest = ""; this.groupByPresc = ""; for (const data in this.groupByCategory) { this.groupByCategory[data].forEach((ele) => { if (ele.tabCode == 'INV0001' && ele.status == 0) { this.groupByInvest = ele.tabName let temp = this.groupByInvest + "," + this.groupByPresc; this.patientList[i].tabNameString = temp.replace('undefined,undefined', ''); this.patientList[i].tabNameString = this.patientList[i].tabNameString.replace(',undefined', '') this.patientList[i].tabNameString = this.patientList[i].tabNameString.replace('undefined,', '') } if (ele.tabCode == 'PRE0001' && ele.status == 0) { this.groupByPresc = ele.tabName let temp = this.groupByInvest + "," + this.groupByPresc; this.patientList[i].tabNameString = temp.replace('undefined,undefined', ''); this.patientList[i].tabNameString = this.patientList[i].tabNameString.replace(',undefined', '') this.patientList[i].tabNameString = this.patientList[i].tabNameString.replace('undefined,', '') } }); } } if (this.patientList[i].consultationStatus) { this.patientList[i].consultationStatus = this.patientList[i].consultationStatus.toLowerCase(); if ( this.patientList[i].consultationStatus == "pt.not arrived" ) { this.patientList[i].color = "badge badge-danger"; } else if ( this.patientList[i].consultationStatus == "arrived" ) { this.patientList[i].color = "badge badge-warning"; } else { this.patientList[i].color = "badge badge-success"; } } if (this.patientList[i].nationality != "INDIAN") { this.patientList[i].colours = "badge badge-intinfo" } else { this.patientList[i].colours = "badge badge-success" } if (this.patientList[i].recordStatus == 1 && this.isVykoTeam == 1) { this.patientList[i].colour = "bg-warning" } // this.style=(this.patientList[i].recordStatus==1 &&this.isVykoTeam==1)?{ // 'background':'yellow' // }:{ // 'background':'none' // } } let limit = 10; this.listCOunt = this.patientList.length; for (let j = 0; j < this.patientList.length; j++) { let offSet = (this.page - 1) * limit; this.patientList[j].slNo = offSet + 1 + j; } } else { this.conCount = "" } if (data.error == false && data?.result?.length != 0 && x == 'IP') { this.ipMyPatientList = [] this.ipTotalCount = 0; this.consultCount = 0; this.conCount = data["count"] this.ipMyPatientList = data["result"]; this.ipTotalCount = data["pageCount"]; this.consultCount = data["pickCount"]; for (let i = 0; i < this.ipMyPatientList.length; i++) { if (this.ipMyPatientList[i].dischargeStatus == 1) { this.ipMyPatientList[i].disc = "Discharged"; } else if (this.ipMyPatientList[i].cancelStatus == 1) { this.ipMyPatientList[i].disc = "Cancelled"; } else { this.ipMyPatientList[i].disc = "On-Going"; } // } // if(this.ipMyPatientList[i].nationality != "INDIAN"){ // this.ipMyPatientList[i].coloursIp = "badge badge-intinfo" // } // else{ // this.ipMyPatientList[i].coloursIp = "badge badge-success" // } } let limit = 10; for (let j = 0; j < this.ipMyPatientList.length; j++) { let offSet = (this.pageNoIp - 1) * limit; this.ipMyPatientList[j].slNo = offSet + 1 + j; this.listCOunt = this.ipMyPatientList.length; } for (let i = 0; i < this.ipMyPatientList.length; i++) { if (this.ipMyPatientList[i].disc == "Discharged") { this.ipMyPatientList[i].color = "badge badge-success"; } else if (this.ipMyPatientList[i].disc == "Cancelled") { this.ipMyPatientList[i].color = "badge badge-danger"; } else { this.ipMyPatientList[i].color = "badge badge-warning"; } } } if (this.patientList?.length > 0) { this.patientList = this.patientList.map((item) => { return ({ ...item, PatientName: item.patientName, departmentName2: item.departmentName }) }) } //this.reviewAndConsultCount() }, (error) => { // cm Swal.fire({ text: "Error in getting List.", iconHtml: 'Lazy-loaded image', }); } ); } consultListIP(x) { this.loading = true; this.isReview = 1 this.reviewAndConsult = 1 this.loginDetail = JSON.parse(localStorage.getItem('LOGGEDINUSERDATA')); this.doctorCode = this.loginDetail['doctorCode']; if (this.newArray.applicationCode == "LOGRO0003") { this.myList = 0; } // if(this.passPortAvailable == "PSPA0002"){ // this.recordStatus = 1; // } // else if(this.passPortAvailable == "PSPA0001"){ // this.recordStatus = 0; // } let data = { page: this.pageNoIp, organizationId: this.newArray.organizationId, businessId: this.newArray.businessId, groupId: this.newArray.groupId, userTypeId: this.newArray.userTypeId, roleTypeId: this.newArray.roleTypeId, loginId: this.newArray.loginId, doctorId: this.doctorCode, roleId: this.newArray.roleId, department: this.departmentName, departmentListArray: this.departmentListArray, myList: this.myList, hospitalNumber: this.hospitalnum1, ipNumber: this.ipNumber, bedNumber: this.bednumberFilter, phoneNumber: this.phoneNumber1, alternativePhoneNumber: this.alternativePhoneNumber, fromregnDate: this.regnDate, toregnDate: this.toregnDate, dischargeStatus: this.dischargeStatust, gender: this.gender, firstName: this.patientName ? this.patientName : "", altPhoneNumber: this.alternativePhoneNumber1 ? this.alternativePhoneNumber1 : "", // recordStatus : this.recordStatus , isReview: 0, reviewAndConsult: 1, opOrIp: x, }; this.http .post( globals.DoctorDesk.reviewAndConsultListIP, JSON.stringify(data), { headers: globals.HeaderValue1 } ) .subscribe( (data: { error: boolean; message: string; result: any }) => { this.loading = false; this.patientList = [] if (data.error == false && data?.result?.length != 0 && x == 'IP') { this.ipMyPatientList = [] this.ipTotalCount = 0; this.consultCount = 0; this.conCount = data["pageCount"] this.ipMyPatientList = data["result"]; this.ipTotalCount = data["pageCount"]; this.consultCount = data["pickCount"]; for (let i = 0; i < this.ipMyPatientList.length; i++) { if (this.ipMyPatientList[i].dischargeStatus == 1) { this.ipMyPatientList[i].disc = "Discharged"; } else if (this.ipMyPatientList[i].cancelStatus == 1) { this.ipMyPatientList[i].disc = "Cancelled"; } else { this.ipMyPatientList[i].disc = "On-Going"; } // } // if(this.ipMyPatientList[i].nationality != "INDIAN"){ // this.ipMyPatientList[i].coloursIp = "badge badge-intinfo" // } // else{ // this.ipMyPatientList[i].coloursIp = "badge badge-success" // } } let limit = 10; for (let j = 0; j < this.ipMyPatientList.length; j++) { let offSet = (this.pageNoIp - 1) * limit; this.ipMyPatientList[j].slNo = offSet + 1 + j; this.listCOunt = this.ipMyPatientList.length; } for (let i = 0; i < this.ipMyPatientList.length; i++) { if (this.ipMyPatientList[i].disc == "Discharged") { this.ipMyPatientList[i].color = "badge badge-success"; } else if (this.ipMyPatientList[i].disc == "Cancelled") { this.ipMyPatientList[i].color = "badge badge-danger"; } else { this.ipMyPatientList[i].color = "badge badge-warning"; } } } else { this.conCount = "" } if (this.patientList?.length > 0) { this.patientList = this.patientList.map((item) => { return ({ ...item, PatientName: item.patientName, departmentName2: item.departmentName }) }) } //this.reviewAndConsultCount() }, (error) => { // cm Swal.fire({ text: "Error in getting List.", iconHtml: 'Lazy-loaded image', }); } ); } reviewListObj: any = {}; reviewList(x) { this.loading = true; if (!this.selectedDOctorId || this.selectedDOctorId == "myPatient" || this.opdMyPatientTab == 1) { this.opdObj["doctorId"] = this?.doctorId ? this?.doctorId : ""; this.opdObj["isReview"] = this.review == true ? 1 : 0; this.opdObj["reviewAndConsult"] = this.consult == true ? 1 : 0; if (this.opdObj["reviewAndConsult"] == 1) { this.opdObj["isReview"] = 1 } else if (this.opdObj["doctorId"] == "") { this.opdObj["isReview"] = 0 this.opdObj["reviewAndConsult"] = 0 } } else { this.opdObj["doctorId"] = ""; this.opdObj["isReview"] = 0 this.opdObj["reviewAndConsult"] = 0 } this.reviewListObj["isReview"] = 1; this.reviewListObj["reviewAndConsult"] = 0; this.reviewListObj["loginId"] = this.newArray.userId; this.reviewListObj["organizationId"] = this.newArray.organizationId; this.reviewListObj["businessId"] = this.newArray.businessId; this.reviewListObj["groupId"] = this.newArray.groupId; this.reviewListObj["hospitalNumber"] = this.hospitalnum ? this.hospitalnum : null; this.reviewListObj["visitNumber"] = this.visitNo ? this.visitNo : null; this.reviewListObj["patientName"] = this.patientName ? this.patientName : null; this.reviewListObj["phoneNumber"] = this.phoneNumber ? this.phoneNumber : null; this.reviewListObj["regnDate"] = this.regnDate ? this.regnDate : ""; this.reviewListObj["regnEndDate"] = this.toregnDate ? this.toregnDate : ""; // if(this.passPortAvailable == "PSPA0002"){ // this.reviewListObj["recordStatus"] = 1; // } // else if(this.passPortAvailable == "PSPA0001"){ // this.reviewListObj["recordStatus"] = 0; // } this.reviewListObj["consultationStatus"] = this.ConsultStatus; this.reviewListObj["opOrIp"] = x; this.http .post( globals.DoctorDesk.reviewAndConsultList, JSON.stringify(this.reviewListObj), { headers: globals.HeaderValue1 } ) .subscribe( (data: { error: boolean; message: string; result: any }) => { this.loading = false; this.patientList = [] if (data.error == false && data?.result?.length != 0 && x == 'OP') { this.patientList = data["result"]; this.totalCount4 = data["count"]; this.revCount = data["count"] for (let i = 0; i < this.patientList.length; i++) { this.patientList[i].tabNameString = ""; if (this.patientList[i]?.tabdetail?.length > 0) { this.groupByCategory = this.patientList[i].tabdetail.reduce((group, product) => { const { tabCode } = product; group[tabCode] = group[tabCode] ?? []; group[tabCode].push(product); return group; }, {}); this.groupByInvest = ""; this.groupByPresc = ""; for (const data in this.groupByCategory) { this.groupByCategory[data].forEach((ele) => { if (ele.tabCode == 'INV0001' && ele.status == 0) { this.groupByInvest = ele.tabName let temp = this.groupByInvest + "," + this.groupByPresc; this.patientList[i].tabNameString = temp.replace('undefined,undefined', ''); this.patientList[i].tabNameString = this.patientList[i].tabNameString.replace(',undefined', '') this.patientList[i].tabNameString = this.patientList[i].tabNameString.replace('undefined,', '') } if (ele.tabCode == 'PRE0001' && ele.status == 0) { this.groupByPresc = ele.tabName let temp = this.groupByInvest + "," + this.groupByPresc; this.patientList[i].tabNameString = temp.replace('undefined,undefined', ''); this.patientList[i].tabNameString = this.patientList[i].tabNameString.replace(',undefined', '') this.patientList[i].tabNameString = this.patientList[i].tabNameString.replace('undefined,', '') } }); } } if (this.patientList[i].consultationStatus) { this.patientList[i].consultationStatus = this.patientList[i].consultationStatus.toLowerCase(); if ( this.patientList[i].consultationStatus == "pt.not arrived" ) { this.patientList[i].color = "badge badge-danger"; } else if ( this.patientList[i].consultationStatus == "arrived" ) { this.patientList[i].color = "badge badge-warning"; } else { this.patientList[i].color = "badge badge-success"; } } if (this.patientList[i].nationality != "INDIAN") { this.patientList[i].colours = "badge badge-intinfo" } else { this.patientList[i].colours = "badge badge-success" } if (this.patientList[i].recordStatus == 1 && this.isVykoTeam == 1) { this.patientList[i].colour = "bg-warning" } // this.style=(this.patientList[i].recordStatus==1 &&this.isVykoTeam==1)?{ // 'background':'yellow' // }:{ // 'background':'none' // } } let limit = 10; this.listCOunt = this.patientList.length; for (let j = 0; j < this.patientList.length; j++) { let offSet = (this.page - 1) * limit; this.patientList[j].slNo = offSet + 1 + j; } } else { this.revCount = "" } if (data.error == false && data?.result?.length != 0 && x == 'IP') { this.ipMyPatientList = [] this.ipTotalCount = 0; this.consultCount = 0; this.conCount = data["count"] this.ipMyPatientList = data["result"]; this.ipTotalCount = data["pageCount"]; this.consultCount = data["pickCount"]; for (let i = 0; i < this.ipMyPatientList.length; i++) { if (this.ipMyPatientList[i].dischargeStatus == 1) { this.ipMyPatientList[i].disc = "Discharged"; } else if (this.ipMyPatientList[i].cancelStatus == 1) { this.ipMyPatientList[i].disc = "Cancelled"; } else { this.ipMyPatientList[i].disc = "On-Going"; } // } if (this.ipMyPatientList[i].nationality != "INDIAN") { this.ipMyPatientList[i].coloursIp = "badge badge-intinfo" } else { this.ipMyPatientList[i].coloursIp = "badge badge-success" } } let limit = 10; for (let j = 0; j < this.ipMyPatientList.length; j++) { let offSet = (this.pageNoIp - 1) * limit; this.ipMyPatientList[j].slNo = offSet + 1 + j; this.listCOunt = this.ipMyPatientList.length; } for (let i = 0; i < this.ipMyPatientList.length; i++) { if (this.ipMyPatientList[i].disc == "Discharged") { this.ipMyPatientList[i].color = "badge badge-success"; } else if (this.ipMyPatientList[i].disc == "Cancelled") { this.ipMyPatientList[i].color = "badge badge-danger"; } else { this.ipMyPatientList[i].color = "badge badge-warning"; } } } if (this.patientList?.length > 0) { this.patientList = this.patientList.map((item) => { return ({ ...item, PatientName: item.patientName, departmentName2: item.departmentName }) }) } // this.reviewAndConsultCount() }, (error) => { // cm Swal.fire({ text: "Error in getting List.", iconHtml: 'Lazy-loaded image', }); } ); } reviewListIP(x) { this.loading = true; this.isReview = 1 this.reviewAndConsult = 1 this.loginDetail = JSON.parse(localStorage.getItem('LOGGEDINUSERDATA')); this.doctorCode = this.loginDetail['doctorCode']; if (this.newArray.applicationCode == "LOGRO0003") { this.myList = 0; } // if(this.passPortAvailable == "PSPA0002"){ // this.recordStatus = 1; // } // else if(this.passPortAvailable == "PSPA0001"){ // this.recordStatus = 0; // } let data = { page: this.pageNoIp, organizationId: this.newArray.organizationId, businessId: this.newArray.businessId, groupId: this.newArray.groupId, userTypeId: this.newArray.userTypeId, roleTypeId: this.newArray.roleTypeId, loginId: this.newArray.loginId, doctorId: this.doctorCode, roleId: this.newArray.roleId, department: this.departmentName, departmentListArray: this.departmentListArray, myList: this.myList, hospitalNumber: this.hospitalnum1, ipNumber: this.ipNumber, bedNumber: this.bednumberFilter, phoneNumber: this.phoneNumber1, alternativePhoneNumber: this.alternativePhoneNumber, fromregnDate: this.regnDate, toregnDate: this.toregnDate, dischargeStatus: this.dischargeStatust, gender: this.gender, firstName: this.patientName ? this.patientName : "", altPhoneNumber: this.alternativePhoneNumber1 ? this.alternativePhoneNumber1 : "", // recordStatus : this.recordStatus , isReview: 1, reviewAndConsult: 0, opOrIp: x, }; this.http .post( globals.DoctorDesk.reviewAndConsultListIP, JSON.stringify(data), { headers: globals.HeaderValue1 } ) .subscribe( (data: { error: boolean; message: string; result: any }) => { this.loading = false; this.patientList = [] if (data.error == false && data?.result?.length != 0 && x == 'IP') { this.ipMyPatientList = [] this.ipTotalCount = 0; this.consultCount = 0; this.conCount = data["count"] this.ipMyPatientList = data["result"]; this.ipTotalCount = data["pageCount"]; this.revCount = data["pageCount"]; for (let i = 0; i < this.ipMyPatientList.length; i++) { if (this.ipMyPatientList[i].dischargeStatus == 1) { this.ipMyPatientList[i].disc = "Discharged"; } else if (this.ipMyPatientList[i].cancelStatus == 1) { this.ipMyPatientList[i].disc = "Cancelled"; } else { this.ipMyPatientList[i].disc = "On-Going"; } // } if (this.ipMyPatientList[i].nationality != "INDIAN") { this.ipMyPatientList[i].coloursIp = "badge badge-intinfo" } else { this.ipMyPatientList[i].coloursIp = "badge badge-success" } } let limit = 10; for (let j = 0; j < this.ipMyPatientList.length; j++) { let offSet = (this.pageNoIp - 1) * limit; this.ipMyPatientList[j].slNo = offSet + 1 + j; this.listCOunt = this.ipMyPatientList.length; } for (let i = 0; i < this.ipMyPatientList.length; i++) { if (this.ipMyPatientList[i].disc == "Discharged") { this.ipMyPatientList[i].color = "badge badge-success"; } else if (this.ipMyPatientList[i].disc == "Cancelled") { this.ipMyPatientList[i].color = "badge badge-danger"; } else { this.ipMyPatientList[i].color = "badge badge-warning"; } } } else { this.revCount = "" } if (this.patientList?.length > 0) { this.patientList = this.patientList.map((item) => { return ({ ...item, PatientName: item.patientName, departmentName2: item.departmentName }) }) } // this.reviewAndConsultCount() }, (error) => { // cm Swal.fire({ text: "Error in getting List.", iconHtml: 'Lazy-loaded image', }); } ); } consultListObj: any = {}; onGoing() { this.http .post( globals.DoctorDesk.reviewAndConsultList, JSON.stringify(this.consultListObj), { headers: globals.HeaderValue1 } ) .subscribe( (data: { error: boolean; message: string; result: any }) => { if (data.error == false && data?.result?.length != 0) { } }, (error) => { // cm Swal.fire({ text: "Error in getting List.", iconHtml: 'Lazy-loaded image', }); } ); this.HideDept = false; this.showInMy = true; this.ipAllPatientSearch = 1; this.ipCrossRefferPatientSearch = 0; this.ipMyPatientListSearch = 0; this.dischargeStatust = 0; let obj = { "hospitalnum1": this.hospitalnum1, "patientName": this.patientName, "ipNumber": this.ipNumber, "phoneNumber1": this.phoneNumber1, "alternativePhoneNumber1": this.alternativePhoneNumber1, "wardTypeFilter": this.wardTypeFilter, "roomTypeFilter": this.roomTypeFilter, "bednumberFilter": this.bednumberFilter, "gender": this.gender, "regnDate": this.regnDate, "toregnDate": this.toregnDate, "selectedTab": this.selectedTab, "departmentName": this.departmentName, "unit": this.unit, "ipMyPatientListSearch": this.ipMyPatientListSearch, "ipAllPatientSearch": this.ipAllPatientSearch, "ipCrossRefferPatientSearch": this.ipCrossRefferPatientSearch, "ipReviewsListSearch": this.ipReviewsListSearch, "dischargeStatust": this.dischargeStatust } this.patientArrayIP.push(obj); localStorage.setItem("datasIP", JSON.stringify(this.patientArrayIP)) this.getIPpatientList(); this.getCount(); } // thi end pageNoIp: number = 1; handlePageChangeIp(e) { this.pageNoIp = e; this.pageArray.push(this.pageNoIp) localStorage.setItem("dataPageIP", JSON.stringify(this.pageArray)); let obj = { "hospitalnum1": this.hospitalnum1, "patientName": this.patientName, "ipNumber": this.ipNumber, "phoneNumber1": this.phoneNumber1, "alternativePhoneNumber1": this.alternativePhoneNumber1, "wardTypeFilter": this.wardTypeFilter, "roomTypeFilter": this.roomTypeFilter, "bednumberFilter": this.bednumberFilter, "gender": this.gender, "regnDate": this.regnDate, "toregnDate": this.toregnDate, "selectedTab": this.selectedTab, "departmentName": this.departmentName, "unit": this.unit, "ipMyPatientListSearch": this.ipMyPatientListSearch, "ipAllPatientSearch": this.ipAllPatientSearch, "ipCrossRefferPatientSearch": this.ipCrossRefferPatientSearch, "ipReviewsListSearch": this.ipReviewsListSearch, "dischargeStatust": this.dischargeStatust } this.patientArrayIP.push(obj); localStorage.setItem("datasIP", JSON.stringify(this.patientArrayIP)) this.getMyPatientListForIp(); } crossRefferalList: any; pageNoIpCrossReffer: number = 1; countCrossRefferIp: any; getCrossRefferalList() { this.loginDetail = JSON.parse(localStorage.getItem('LOGGEDINUSERDATA')); this.doctorCode = this.loginDetail['doctorCode']; let data = { page: this.pageNoIpCrossReffer, organizationId: this.newArray.organizationId, businessId: this.newArray.businessId, groupId: this.newArray.groupId, hospitalNumber: this.hospitalnum1, ipNumber: this.ipNumber, phoneNumber: this.phoneNumber1, altPhoneNumber: this.alternativePhoneNumber1, doctorCode: this.doctorCode, confirmedStatus: this.confirmedStatus, arraivalStatus: this.arraivalStatus, patientName: this.patientName, // 'userTypeId': this.newArray.userTypeId, // 'roleTypeId': this.newArray.roleTypeId, // 'roleId': this.newArray.roleId, fromDate: this.regnDate, department: this.departmentName, }; this.loading = true; this.http .post( globals.DoctorDesk.getCrossRefferalIpPatientList, JSON.stringify(data), { headers: globals.HeaderValue1 } ) .subscribe( (data: { error: boolean; message: string; result: any }) => { this.loading = false; if (data.error == false && data.result.length != 0) { this.crossRefferalList = data["result"]; this.countCrossRefferIp = data["pageCount"]; let limit = 10; for (let j = 0; j < this.crossRefferalList.length; j++) { let offSet = (this.pageNoIpCrossReffer - 1) * limit; this.crossRefferalList[j].slNo = offSet + 1 + j; this.listCOunt = this.crossRefferalList.length; } } else if (data.error == false && data?.result?.length == 0) { // cm this.toastr.error("No data for Cross Refferal List") } else { // cm this.toastr.error(data?.message || "Something went wrong") } }, (error) => { // cm Swal.fire({ text: "Error in get Cross Refferal List.", iconHtml: 'Lazy-loaded image', }); } ); } doctorReviewIpList: any = []; someArrayToFilter: any = [] countDoctorReviewIpList: any = []; ipdReviewOb: any = {}; listData: any = [] reviewsPatientIpListCount() { this.loginDetail = JSON.parse(localStorage.getItem('LOGGEDINUSERDATA')); this.doctorCode = this.loginDetail['doctorCode']; this.ipdReviewOb["page"] = this.page1; this.ipdReviewOb["organizationId"] = this.newArray.organizationId; this.ipdReviewOb["groupId"] = this.newArray.groupId; this.ipdReviewOb["businessId"] = this.newArray.businessId; this.ipdReviewOb["userTypeId"] = this.newArray.userTypeId; this.ipdReviewOb["roleTypeId"] = this.newArray.roleTypeId; this.ipdReviewOb["loginId"] = this.newArray.loginId; this.ipdReviewOb["roleId"] = this.newArray.roleId; this.ipdReviewOb["department"] = this.departmentName ? this.departmentName : ""; this.ipdReviewOb["unit"] = this.unit ? this.unit : ""; this.ipdReviewOb["myList"] = this.myList; this.ipdReviewOb["fromregnDate"] = this.regnDate ? this.regnDate : ""; this.ipdReviewOb["wardType"] = this.wardTypeFilter; this.ipdReviewOb["gender"] = this.gender; this.ipdReviewOb["signedDoctor"] = this.loginDetail['doctorCode']; this.ipdReviewOb["confirmedStatus"] = this.confirmedStatus ? this.confirmedStatus : 0; this.ipdReviewOb["dischargeStatus"] = this.dischargeStatust; this.http .post( globals.DoctorDesk.getReviewDoctorIpList, JSON.stringify(this.ipdReviewOb), { headers: globals.HeaderValue1 } ) .subscribe( (data: { error: boolean; message: string; result: any }) => { if (data.error == false && data.result.length != 0) { this.countDoctorReviewIpList = this.doctorReviewIpList.length; } } ); } getReviewsPatientIpList() { this.ipdReviewOb["organizationId"] = this.newArray.organizationId; this.ipdReviewOb["groupId"] = this.newArray.groupId; this.ipdReviewOb["businessId"] = this.newArray.businessId; this.ipdReviewOb["userId"] = this.newArray.loginId; this.http .post( globals.revamp.fetchPendingNote, JSON.stringify(this.ipdReviewOb), { headers: globals.HeaderValue1 } ) .subscribe( (data: { error: boolean; message: string; result: any }) => { if (data.error == false && data.result.length != 0) { this.someArrayToFilter = data["result"]?.pendingItemsList this.someArrayToFilter = this.someArrayToFilter.map(item => ({ ...item, noteList: item.noteList.filter(note => note.opOrIp !== "OP") })); this.listData = this.someArrayToFilter.filter(item => item.noteList.length > 0); this.countDoctorReviewIpList = data["result"]?.pendingNotesCount?.IP; // this.listData = data['result']?.pendingItemsList } else { this.toastr.error(data?.message || "Something went wrong") } }, (error) => { } ); } restrictedDrugListCount() { this.loginDetail = JSON.parse(localStorage.getItem('LOGGEDINUSERDATA')); this.doctorCode = this.loginDetail['doctorCode']; this.ipdReviewOb["page"] = this.restPage; this.ipdReviewOb["organizationId"] = this.newArray.organizationId; this.ipdReviewOb["groupId"] = this.newArray.groupId; this.ipdReviewOb["businessId"] = this.newArray.businessId; this.ipdReviewOb["userTypeId"] = this.newArray.userTypeId; this.ipdReviewOb["roleTypeId"] = this.newArray.roleTypeId; this.ipdReviewOb["loginId"] = this.newArray.loginId; this.ipdReviewOb["roleId"] = this.newArray.roleId; this.ipdReviewOb["department"] = this.departmentName ? this.departmentName : ""; this.ipdReviewOb["unit"] = this.unit ? this.unit : ""; this.ipdReviewOb["myList"] = this.myList; this.ipdReviewOb["fromregnDate"] = this.regnDate ? this.regnDate : ""; this.ipdReviewOb["wardType"] = this.wardTypeFilter; this.ipdReviewOb["gender"] = this.gender; this.ipdReviewOb["signedDoctor"] = this.loginDetail['doctorCode']; this.ipdReviewOb["confirmedStatus"] = this.confirmedStatus ? this.confirmedStatus : 0; this.ipdReviewOb["dischargeStatus"] = this.dischargeStatust; // if (this.passPortAvailable == "PSPA0002") { // this.ipdReviewOb["recordStatus"] = 1; // } // else if (this.passPortAvailable == "PSPA0001") { // this.ipdReviewOb["recordStatus"] = 0; // } this.http .post( globals.DoctorDesk.getRestrictedDa, JSON.stringify(this.ipdReviewOb), { headers: globals.HeaderValue1 } ) .subscribe( (data: { error: boolean; message: string; result: any }) => { if (data.error == false && data.result.length != 0) { this.countRestricted = data["pageCount"] } }, (error) => { // cm Swal.fire({ text: "Error in get Cross Refferal List.", iconHtml: 'Lazy-loaded image', }); } ); } isRejectTab: boolean = false; changeTab(status: number | null, isRejectTab: boolean = false) { this.isRejectTab = isRejectTab; if (!isRejectTab) { this.confirmedStatus = status !== null ? status : 0; } else { this.confirmedStatus = null; } this.pendingArrayList = []; this.confirmedArrayList = []; if (this.isRejectTab) { this.rejectedRestrictedDrugList(); } else { this.restrictedDrugList(); } } handlePendingPageChange(event: number) { this.pendingPage = event; this.restPage = event; this.restrictedDrugList(); this.restrictedDrugListCount(); } handleConfirmedPageChange(event: number) { this.confirmedPage = event; this.restPage = event; this.restrictedDrugList(); this.restrictedDrugListCount(); } handleRejectedPageChange(event: number) { this.rejectPageNumber = event; this.restPage = event; this.restrictedDrugList(); this.restrictedDrugListCount(); } pendingArrayList : any = [] confirmedArrayList : any = [] pendingPage: number = 1; confirmedPage: number = 1; pendingCount: number = 0; confirmedCount: number = 0; loadRestrictedDrugs() { this.confirmedStatus = 0; // Set pending list as active this.isRejectTab = false; // Ensure Reject Tab is inactive this.pendingPage = 1; this.confirmedPage = 1; this.rejectPageNumber = 1; this.restPage = 1; this.restrictedDrugList(); this.restrictedDrugListCount(); } rejectedArrayList: any = []; rejectedCount: number = 0; rejectPageNumber: number = 1; restrictedDrugList() { this.restrictedArrayList = []; this.showInMy = true; this.HideDept = false; this.restPage = 1 this.loginDetail = JSON.parse(localStorage.getItem('LOGGEDINUSERDATA')); this.doctorCode = this.loginDetail['doctorCode']; const pageNumber = this.confirmedStatus === 0 ? this.pendingPage : this.confirmedPage; // this.ipdReviewOb["page"] = this.restPage; this.ipdReviewOb["page"] = pageNumber; this.ipdReviewOb["organizationId"] = this.newArray.organizationId; this.ipdReviewOb["groupId"] = this.newArray.groupId; this.ipdReviewOb["businessId"] = this.newArray.businessId; this.ipdReviewOb["userTypeId"] = this.newArray.userTypeId; this.ipdReviewOb["roleTypeId"] = this.newArray.roleTypeId; this.ipdReviewOb["loginId"] = this.newArray.loginId; this.ipdReviewOb["roleId"] = this.newArray.roleId; this.ipdReviewOb["department"] = this.departmentName ? this.departmentName : ""; this.ipdReviewOb["unit"] = this.unit ? this.unit : ""; this.ipdReviewOb["myList"] = this.myList; this.ipdReviewOb["hospitalNumber"] = this.hospitalnum1; this.ipdReviewOb["fromregnDate"] = this.regnDate ? this.regnDate : ""; this.ipdReviewOb["wardType"] = this.wardTypeFilter; this.ipdReviewOb["toregnDate"] = this.toregnDate ? this.toregnDate : ""; this.ipdReviewOb["ipNumber"] = this.ipNumber ? this.ipNumber : ""; this.ipdReviewOb["firstName"] = this.patientName ? this.patientName : ""; this.ipdReviewOb["signedDoctor"] = this.loginDetail['doctorCode']; this.ipdReviewOb["confirmedStatus"] = this.confirmedStatus ? this.confirmedStatus : 0; this.ipdReviewOb["strictTypeCategory"] = this.loginDetail?.drugAuth[0].strictTypeCategory; this.ipdReviewOb["dischargeStatus"] = this.dischargeStatust; this.loading = true; this.http .post( globals.DoctorDesk.getRestrictedDa, JSON.stringify(this.ipdReviewOb), { headers: globals.HeaderValue1 } ) .subscribe( (data: { error: boolean; message: string; result: any }) => { this.loading = false; if (!data['error']) { this.restrictedArrayList = data["result"]; if (this.confirmedStatus === 0) { this.pendingArrayList = data.result || []; this.pendingCount = data["totalItems"] || data["count"] || 0; let pendingSlNo = 0; for (let j = 0; j < this.pendingArrayList?.length; j++) { this.pendingArrayList[j].slNo1 = ++pendingSlNo; } } else if (this.confirmedStatus === 1) { this.confirmedArrayList = data.result || []; this.confirmedCount = data["totalItems"] || data["count"] || 0; let confirmedSlNo = 0; for (let j = 0; j < this.confirmedArrayList?.length; j++) { this.confirmedArrayList[j].slNo1 = ++confirmedSlNo; } } this.cd.detectChanges(); this.countDoctorReviewIpList = this.restrictedArrayList?.length; } }, (error) => { this.loading = false; Swal.fire({ text: "Error in getting List.", iconHtml: 'Lazy-loaded image', }); } ); } ipdRejectReviewOb: any = {}; rejectedRestrictedDrugList() { this.restrictedArrayList = []; this.showInMy = true; this.HideDept = false; this.rejectPageNumber = 1 // this.loginDetail = JSON.parse(localStorage.getItem('LOGGEDINUSERDATA')); // this.doctorCode = this.loginDetail['doctorCode']; // this.ipdReviewOb["page"] = this.restPage; this.ipdRejectReviewOb["page"] = this.rejectPageNumber; this.ipdRejectReviewOb["organizationId"] = this.newArray.organizationId; this.ipdRejectReviewOb["groupId"] = this.newArray.groupId; this.ipdRejectReviewOb["businessId"] = this.newArray.businessId; // this.ipdReviewOb["userTypeId"] = this.newArray.userTypeId; // this.ipdReviewOb["roleTypeId"] = this.newArray.roleTypeId; // this.ipdReviewOb["loginId"] = this.newArray.loginId; // this.ipdReviewOb["roleId"] = this.newArray.roleId; // this.ipdReviewOb["myList"] = this.myList; this.ipdRejectReviewOb["department"] = this.departmentName ? this.departmentName : ""; this.ipdRejectReviewOb["unit"] = this.unit ? this.unit : ""; this.ipdRejectReviewOb["hospitalNumber"] = this.hospitalnum1; this.ipdRejectReviewOb["fromregnDate"] = this.regnDate ? this.regnDate : ""; this.ipdRejectReviewOb["toregnDate"] = this.toregnDate ? this.toregnDate : ""; this.ipdRejectReviewOb["ipNumber"] = this.ipNumber ? this.ipNumber : ""; this.ipdRejectReviewOb["firstName"] = this.patientName ? this.patientName : ""; // this.ipdReviewOb["wardType"] = this.wardTypeFilter; // this.ipdReviewOb["signedDoctor"] = this.loginDetail['doctorCode']; // this.ipdReviewOb["strictTypeCategory"] = this.loginDetail?.drugAuth[0].strictTypeCategory; // this.ipdReviewOb["dischargeStatus"] = this.dischargeStatust; // this.ipdReviewOb["isActive"] = 0; this.loading = true; this.http .post( globals.DoctorDesk.getRestrictedRejectedList, JSON.stringify(this.ipdRejectReviewOb), { headers: globals.HeaderValue1 } ) .subscribe( (data: { error: boolean; message: string; result: any }) => { this.loading = false; if (!data['error']) { this.restrictedArrayList = data["result"]; if (this.isRejectTab) { this.rejectedArrayList = data.result || []; this.rejectedCount = data["totalItems"] || data["count"] || 0; let rejectedSlNo = 0; for (let j = 0; j < this.rejectedArrayList?.length; j++) { this.rejectedArrayList[j].slNo1 = ++rejectedSlNo; } } this.cd.detectChanges(); this.countDoctorReviewIpList = this.restrictedArrayList?.length; } }, (error) => { this.loading = false; Swal.fire({ text: "Error in getting List.", iconHtml: 'Lazy-loaded image', }); } ); } selectedConfirmedDurg: any; listOfConfirmedRistrictedDurgs: any []; checkDataValuePresc: boolean = false; confirmedDurgObj: any = {}; confirmedListData(selectedConfirmedDurg: any) { this.confirmedDurgObj["organizationId"] = this.newArray.organizationId; this.confirmedDurgObj["groupId"] = this.newArray.groupId; this.confirmedDurgObj["businessId"] = this.newArray.businessId; this.confirmedDurgObj["userTypeId"] = this.newArray.userTypeId; this.confirmedDurgObj["hospitalNumber"] = selectedConfirmedDurg.hospitalNumber; this.confirmedDurgObj["ipNumber"] = selectedConfirmedDurg.ipNumber; this.confirmedDurgObj["strictTypeCategory"] = this.loginDetail?.drugAuth[0].strictTypeCategory; this.loading = true; this.http .post( globals.DoctorDesk.getRestrictedConfirmedList, JSON.stringify(this.confirmedDurgObj), { headers: globals.HeaderValue1 } ) .subscribe( (data: { error: boolean; message: string; result: any }) => { this.loading = false; if (!data.error && data?.result?.length > 0) { this.listOfConfirmedRistrictedDurgs = data.result.map((drug) => { return { ...drug, activeValue: drug.aciveStatus == 1 ? "Active" : "Inactive", // ✅ Assign active status }; }); this.cdr.detectChanges(); // ✅ Force Angular to detect changes } else { this.listOfConfirmedRistrictedDurgs = []; } }, (error) => { this.loading = false; Swal.fire({ text: "Error in getting List.", iconHtml: 'Lazy-loaded image', }); } ); } openModal(data: any) { this.selectedConfirmedDurg = data; this.confirmedListData(this.selectedConfirmedDurg); setTimeout(() => { const modalElement = document.getElementById('confirmedListModalPopup'); if (modalElement) { modalElement.classList.add('show'); modalElement.style.display = 'block'; document.body.classList.add('modal-open'); // ✅ Ensure modal-open class is added const backdrop = document.createElement('div'); backdrop.className = 'modal-backdrop fade show'; document.body.appendChild(backdrop); // ✅ Add backdrop manually } }, 500); } selectedRejectDurg: any; openRejectModal(data: any) { this.selectedRejectDurg = data; this.rejectedListData(this.selectedRejectDurg); setTimeout(() => { const modalElement = document.getElementById('rejectListModalPopup'); if (modalElement) { modalElement.classList.add('show'); modalElement.style.display = 'block'; document.body.classList.add('modal-open'); // ✅ Ensure modal-open class is added const backdrop = document.createElement('div'); backdrop.className = 'modal-backdrop fade show'; document.body.appendChild(backdrop); // ✅ Add backdrop manually } }, 500); } rejectedDurgObj: any = {}; listOfRejectedRistrictedDurgs: any =[]; rejectedListData(selectedRejectDurg: any) { this.rejectedDurgObj["organizationId"] = this.newArray.organizationId; this.rejectedDurgObj["groupId"] = this.newArray.groupId; this.rejectedDurgObj["businessId"] = this.newArray.businessId; this.rejectedDurgObj["hospitalNumber"] = selectedRejectDurg.hospitalNumber; this.rejectedDurgObj["ipNumber"] = selectedRejectDurg.ipNumber; this.loading = true; this.http .post( globals.DoctorDesk.getRestrictedRejectDa, JSON.stringify(this.rejectedDurgObj), { headers: globals.HeaderValue1 } ) .subscribe( (data: { error: boolean; message: string; result: any }) => { this.loading = false; if (!data.error && data?.result?.length > 0) { this.listOfRejectedRistrictedDurgs = data.result.map((drug) => { return { ...drug, activeValue: drug.aciveStatus == 1 ? "Active" : "Inactive", // ✅ Assign active status }; }); this.cdr.detectChanges(); // ✅ Force Angular to detect changes } else { this.listOfRejectedRistrictedDurgs = []; } }, (error) => { this.loading = false; Swal.fire({ text: "Error in getting List.", iconHtml: 'Lazy-loaded image', }); } ); } closeModal() { const modalElement = document.getElementById('confirmedListModalPopup'); const rejectModalElement = document.getElementById('rejectListModalPopup'); if (modalElement) { modalElement.classList.remove('show'); modalElement.style.display = 'none'; document.body.classList.remove('modal-open'); // ✅ Remove modal-open class from body const backdrop = document.querySelector('.modal-backdrop'); if (backdrop) { backdrop.remove(); // ✅ Remove the backdrop manually } } if (rejectModalElement) { rejectModalElement.classList.remove('show'); rejectModalElement.style.display = 'none'; document.body.classList.remove('modal-open'); // ✅ Remove modal-open class from body const backdrop = document.querySelector('.modal-backdrop'); if (backdrop) { backdrop.remove(); // ✅ Remove the backdrop manually } } } SelectedRejectObj: any = []; rejectUpdate() { this.SelectedRejectObj = this.listOfConfirmedRistrictedDurgs.filter((drug) => drug.isChecked); if (this.SelectedRejectObj.length === 0) { Swal.fire({ text: 'Please select at least one drug to reject.', icon: 'warning' }); return; } for (let i = 0; i < this.SelectedRejectObj.length; i++) { const transcationNumber = this.SelectedRejectObj[i].transcationNumber; this.SelectedRejectObj[i].confirmedStatus = this.SelectedRejectObj[i].confirmStatus this.SelectedRejectObj[i].confirmedBy = this.SelectedRejectObj[i].confirmBy this.SelectedRejectObj[i].drugCategory = this.SelectedRejectObj[i].drugCategoryName ? this.SelectedRejectObj[i].drugCategoryName : this.SelectedRejectObj[i].drugName this.SelectedRejectObj[i].transcationDate = this.SelectedRejectObj[i].transcationDate this.SelectedRejectObj[i].drugPatternValue = this.SelectedRejectObj[i].drugPatternValue this.SelectedRejectObj[i].indentQuantity = this.SelectedRejectObj[i].indentQuantity this.SelectedRejectObj[i].issuedQuantity = this.SelectedRejectObj[i].issuedQuantity this.SelectedRejectObj[i].notes = this.SelectedRejectObj[i].notes this.SelectedRejectObj[i].confirmByDoctor = this.SelectedRejectObj[i].confirmByDoctor this.SelectedRejectObj[i].confirmedBy = this.SelectedRejectObj[i].confirmedBy this.SelectedRejectObj[i].confirmedDate = this.SelectedRejectObj[i].confirmedDate this.SelectedRejectObj[i].activeValue = this.SelectedRejectObj[i].activeValue === "Inactive" ? 0 : 1; this.SelectedRejectObj[i].remarks = this.SelectedRejectObj[i].remarks this.SelectedRejectObj[i].userName = this.SelectedRejectObj[i].userName this.SelectedRejectObj[i].transcationNumber = transcationNumber; } this.confirmedDurgObj["organizationId"] = this.newArray.organizationId; this.confirmedDurgObj["groupId"] = this.newArray.groupId; this.confirmedDurgObj["businessId"] = this.newArray.businessId; this.confirmedDurgObj['children'] = this.SelectedRejectObj; this.confirmedDurgObj['hospitalNumber'] = this.selectedConfirmedDurg.hospitalNumber; this.confirmedDurgObj['ipNumber'] = this.selectedConfirmedDurg.ipNumber; this.confirmedDurgObj["userId"] = this.newArray.loginId; this.loading = true; this.http.post(globals.DoctorDesk.rejectRestrictedDrug, JSON.stringify(this.confirmedDurgObj), { headers: globals.HeaderValue1 }).subscribe( data => { this.loading = false; if (data['error'] == false) { Swal.fire({ text: data['message'], icon: 'success' }) } else { Swal.fire({ text: data['message'], icon: 'error' }) } } ); this.closeModal(); } activeHandoverTab: 'pending' | 'confirmed' = 'pending'; handoverPendingList: any[] = []; handoverConfirmedList: any[] = []; handoverPagePending: number = 1; handoverPageConfirmed: number = 1; totalHandoverPending: number = 0; totalHandoverConfirmed: number = 0; onClickHandoverTab() { this.selectedTab = 'handoverNotesList'; this.activeHandoverTab = 'pending'; this.handoverPagePending = 1; this.handoverPageConfirmed = 1; this.getPendingHandoverList(); this.getPendingHandoverCount(); } handlePageChangeHanderOverNote(e: number) { if (this.activeHandoverTab === 'pending') { this.handoverPagePending = e; this.getPendingHandoverList(); this.getPendingHandoverCount(); } else if (this.activeHandoverTab === 'confirmed') { this.handoverPageConfirmed = e; this.getConfirmedHandoverList(); } } getPendingHandoverList() { // this.loading = true; const payload = { organizationId: this.newArray.organizationId, businessId: this.newArray.businessId, groupId: this.newArray.groupId, userId: this.newArray.userId, page: this.handoverPagePending, handoverStatus: 'PENDING', department: this.departmentName ? this.departmentName : "", unit: this.unit ? this.unit : "", hospitalNumber: this.hospitalnum1, fromregnDate: this.regnDate ? this.regnDate : "", toregnDate: this.toregnDate ? this.toregnDate : "", ipNumber: this.ipNumber ? this.ipNumber : "", firstName: this.patientName ? this.patientName : "" }; this.http.post('api/handover/pending-list', JSON.stringify(payload), { headers: globals.HeaderValue1 }) .subscribe(data => { if (!data['error']) { this.handoverPendingList = data['result']; this.totalHandoverPending = data['count']; const limit = 10; for (let j = 0; j < this.handoverPendingList.length; j++) { const offSet = (this.handoverPagePending - 1) * limit; this.handoverPendingList[j].slNo = offSet + 1 + j; } } else { this.handoverPendingList = []; this.totalHandoverPending = 0; } this.loading = false; }); } getConfirmedHandoverList() { // this.loading = true; const payload = { organizationId: this.newArray.organizationId, businessId: this.newArray.businessId, groupId: this.newArray.groupId, userId: this.newArray.userId, page: this.handoverPageConfirmed, handoverStatus: 'CONFIRMED', department: this.departmentName ? this.departmentName : "", unit: this.unit ? this.unit : "", hospitalNumber: this.hospitalnum1, fromregnDate: this.regnDate ? this.regnDate : "", toregnDate: this.toregnDate ? this.toregnDate : "", ipNumber: this.ipNumber ? this.ipNumber : "", firstName: this.patientName ? this.patientName : "" }; this.http.post('api/handover/confirmed-list', JSON.stringify(payload), { headers: globals.HeaderValue1 }) .subscribe(data => { if (!data['error']) { this.handoverConfirmedList = data['result']; this.totalHandoverConfirmed = data['count']; const limit = 10; for (let j = 0; j < this.handoverConfirmedList.length; j++) { const offSet = (this.handoverPageConfirmed - 1) * limit; this.handoverConfirmedList[j].slNo = offSet + 1 + j; } } else { this.handoverConfirmedList = []; this.totalHandoverConfirmed = 0; } this.loading = false; }); } countPendingHandover: number = 0; getPendingHandoverCount() { const obj = { organizationId: this.newArray.organizationId, groupId: this.newArray.groupId, businessId: this.newArray.businessId, userTypeId: this.newArray.userTypeId, roleTypeId: this.newArray.roleTypeId, loginId: this.newArray.loginId, roleId: this.newArray.roleId, // department: this.Department || "", // unit: this.dischargeDepartmentUnit || "", // wardType: this.wardTypeId || "", doctorCode: this.newArray.doctorCode || "", // if available page: 1 }; this.http .post('api/handover/pending-list', JSON.stringify(obj), { headers: globals.HeaderValue1, }) .subscribe( (data: any) => { if (!data.error && data.result?.length) { this.countPendingHandover = data.pageCount || data.result.length; } else { this.countPendingHandover = 0; } }, (error) => { this.countPendingHandover = 0; Swal.fire({ text: "Error fetching Pending Handover count.", iconHtml: 'Error', }); } ); } selectAllDrugs(event: any) { const isChecked = event.target.checked; this.listOfConfirmedRistrictedDurgs.forEach(drug => { drug.isChecked = isChecked; }); } updateSelection() { this.checkDataValuePresc = this.listOfConfirmedRistrictedDurgs.every(drug => drug.isChecked); } onClickCrossRefferIp() { localStorage.removeItem("datasIP") localStorage.removeItem("clickedTab"); localStorage.removeItem("dataPageIP"); this.regnDate = ""; this.toregnDate = ""; this.HideDept = true; this.showInMy = true; this.HideName = true; this.pageNoIpCrossReffer = 1; this.ipCrossRefferPatientSearch = 1; this.ipAllPatientSearch = 0; this.ipMyPatientListSearch = 0; this.ipReviewsListSearch = 0; this.getCrossRefferalList(); this.selectedTab = "crosslistpatientIP"; } ipReviewsListSearch: any = 0; pageNoIpReviewList: any = 0; onClickReviewsListIp() { // localStorage.removeItem("datasIP") // localStorage.removeItem("dataPage"); this.regnDate = ""; this.toregnDate = ""; this.HideDept = true; this.showInMy = true; this.HideName = true; this.pageNoIpReviewList = 1; this.ipCrossRefferPatientSearch = 0; this.ipAllPatientSearch = 0; this.ipMyPatientListSearch = 0; this.ipReviewsListSearch = 1; this.getReviewsPatientIpList(); this.selectedTab = "reviewPatientListIp"; } handlePageChangeIpCross(e) { this.pageNoIpCrossReffer = e; this.pageArray.push(this.pageNoIpCrossReffer) localStorage.setItem("dataPageIP", JSON.stringify(this.pageArray)); let obj = { "hospitalnum1": this.hospitalnum1, "patientName": this.patientName, "ipNumber": this.ipNumber, "phoneNumber1": this.phoneNumber1, "alternativePhoneNumber1": this.alternativePhoneNumber1, "wardTypeFilter": this.wardTypeFilter, "roomTypeFilter": this.roomTypeFilter, "bednumberFilter": this.bednumberFilter, "gender": this.gender, "regnDate": this.regnDate, "toregnDate": this.toregnDate, "selectedTab": this.selectedTab, "departmentName": this.departmentName, "unit": this.unit, "ipMyPatientListSearch": this.ipMyPatientListSearch, "ipAllPatientSearch": this.ipAllPatientSearch, "ipCrossRefferPatientSearch": this.ipCrossRefferPatientSearch, "ipReviewsListSearch": this.ipReviewsListSearch, "dischargeStatust": this.dischargeStatust } this.patientArrayIP.push(obj); localStorage.setItem("datasIP", JSON.stringify(this.patientArrayIP)) this.getCrossRefferalList(); } onClickOpdMyEncounterPatient() { this.showInMy = true; this.HideDept = true this.techArrayValue = localStorage.removeItem("datas"); this.frontDeskArray = localStorage.removeItem("dataFrontDesk"); this.techdataPage = localStorage.removeItem("dataPage"); this.getEncounterPatientList(); this.opdAllPatientTab = 0; this.opdDepartmentPatientTab = 0; this.opdMyPatientTab = 0; this.encounterPage = 1; this.followUpPatientListTab = 0; this.opdEncounterPatientTab = 1; this.reviewPatientTab = 0; this.DatePlaceholder = "Next Encounter"; this.selectedTab = "encountPatient"; } reviewPatientTab: any = 0; onClickDoctorReviewList() { this.showInMy = true; this.techArrayValue = localStorage.removeItem("datas"); this.frontDeskArray = localStorage.removeItem("dataFrontDesk"); this.techdataPage = localStorage.removeItem("dataPage"); this.getDoctorReviewList(); //this.getPatientListList(); this.opdAllPatientTab = 0; this.opdDepartmentPatientTab = 0; this.opdMyPatientTab = 0; this.encounterPage = 1; this.followUpPatientListTab = 0; this.opdEncounterPatientTab = 0; this.reviewPatientTab = 1; this.DatePlaceholder = "Reviews List"; this.selectedTab = "reviewPatient"; } encounterPatientList = []; encounterPage: number = 1; encounterCount: any; getEncounterPatientList() { this.loading = true; let encounterTemp = { page: this.encounterPage, organizationId: this.newArray.organizationId, businessId: this.newArray.businessId, groupId: this.newArray.groupId, hospitalNumber: this.hospitalnum, visitNo: this.visitNo, gender: this.gender, phoneNumber: this.phoneNumber, altPhoneNumber: this.alternativePhoneNumber, confirmedStatus: this.confirmedStatus, arraivalStatus: this.arraivalStatus, encounterFrom: (this.regnDate == "Invalid date") ? "" : this.regnDate, encounterTo: this.toregnDate, patientName: this.patientName, }; this.http .post( globals.DoctorDesk.getEncounterPatientList, JSON.stringify(encounterTemp), { headers: globals.HeaderValue1 } ) .subscribe( (data: { error: boolean; message: string; result: any }) => { this.loading = false; if (data.error == false && data.result.length != 0) { // cm this.encounterPatientList = data["result"]; this.encounterCount = data["Count"]; let limit = 20; for (let j = 0; j < this.encounterPatientList.length; j++) { let offSet = (this.encounterPage - 1) * limit; this.encounterPatientList[j].slNo = offSet + 1 + j; this.listCOunt = this.encounterPatientList.length; } } else if (data.error == false && data?.result?.length == 0) { // cm this.toastr.error("No data for Encounter Patient List") this.encounterPatientList = []; } else { // cm Swal.fire({ text: data?.message || "Something went wrong", iconHtml: 'Lazy-loaded image', }); } }, (error) => { // cm Swal.fire({ text: "Error getting getDepartment Type .", iconHtml: 'Lazy-loaded image', }); } ); /// } nextEncounterRemarks: any; getRemarks(remarks){ this.nextEncounterRemarks = remarks; } DoctorReviewList: any = []; DoctorReviewCount: any = []; reviewObj: any = {}; reviewListCount() { this.reviewObj["pgConfirmedStatus"] = 1; if (this.loginDetail['roleTypeApplicationCode'] == "DOC" || this.loginDetail['roleTypeApplicationCode'] == "IMO") { delete this.reviewObj["pgConfirmedStatus"]; } this.loading = false; this.reviewObj["organizationId"] = this.newArray.organizationId; this.reviewObj["businessId"] = this.newArray.businessId; this.reviewObj["groupId"] = this.newArray.groupId; this.reviewObj["hospitalNumber"] = this.hospitalnum ? this.hospitalnum : null; this.reviewObj["patientName"] = this.patientName ? this.patientName : null; this.reviewObj["phoneNumber"] = this.phoneNumber ? this.phoneNumber : null; this.reviewObj["altPhoneNumber"] = this.alternativePhoneNumber ? this.alternativePhoneNumber : null; this.reviewObj["fromregnDate"] = this.regnDate ? this.regnDate : ""; this.reviewObj["toregnDate"] = this.toregnDate ? this.toregnDate : ""; this.reviewObj["departmentUnit"] = this.unit ? this.unit : ""; this.reviewObj["page"] = this.pageReview; this.reviewObj["departmentName"] = this.departmentName ? this.departmentName : null; this.reviewObj["confirmedStatus"] = this.confirmedStatus ? this.confirmedStatus : 0; this.reviewObj["arraivalStatus"] = this.arraivalStatus ? this.arraivalStatus : ""; this.reviewObj["signedDoctor"] = this.loginDetail['doctorCode']; this.http .post( globals.DoctorDesk.getReviewDoctorList, JSON.stringify(this.reviewObj), { headers: globals.HeaderValue1 } ) .subscribe( data => { this.loading = false; this.DoctorReviewCount = data["count"]; } ); } showReviewList: any = []; getDoctorReviewList() { this.reviewObj["pgConfirmedStatus"] = 1; if (this.loginDetail['roleTypeApplicationCode'] == "DOC" || this.loginDetail['roleTypeApplicationCode'] == "IMO") { delete this.reviewObj["pgConfirmedStatus"]; } if (this.loginDetail['roleTypeApplicationCode'] == "DOC") { this.reviewObj["pgConfirmedStatus"] = 0; } this.reviewObj["organizationId"] = this.newArray.organizationId; this.reviewObj["businessId"] = this.newArray.businessId; this.reviewObj["groupId"] = this.newArray.groupId; this.reviewObj["userId"] = this.newArray.loginId; this.http .post( globals.revamp.fetchPendingNote, JSON.stringify(this.reviewObj), { headers: globals.HeaderValue1 } ) .subscribe( data => { this.DoctorReviewList = data["result"]?.pendingItemsList this.someArrayToFilter = data["result"]?.pendingItemsList if (this.DoctorReviewList?.length > 0) { this.DoctorReviewList = this.DoctorReviewList.map(item => ({ ...item, noteList: item.noteList.filter(note => note.opOrIp !== "IP") })); let limit = 10; for (let j = 0; j < this.DoctorReviewList.length; j++) { let offSet = (this.pageReview - 1) * limit; this.DoctorReviewList[j].slNo = offSet + 1 + j; } this.listData = this.DoctorReviewList.filter(item => item.noteList.length > 0); this.DoctorReviewCount = data["result"]?.pendingNotesCount?.OP; } }, (error) => { // cm Swal.fire({ text: "Error getting getDepartment Type .", iconHtml: 'Lazy-loaded image', }); } ); /// } pageReview: number = 1; handlePageReviewList(e) { this.pageReview = e; this.pageArray.push(this.page) localStorage.setItem("dataPage", JSON.stringify(this.pageArray)); let obj = { "hospitalnum": this.hospitalnum, "patientName": this.patientName, "phoneNumber": this.phoneNumber, "alternativePhoneNumber": this.alternativePhoneNumber, "regnDate": this.regnDate, "toregnDate": this.toregnDate, "visitNo": this.visitNo, "ConsultStatus": this.ConsultStatus, "gender": this.gender, "selectedTab": this.selectedTab, "departmentName": this.departmentName, "unit": this.unit, "opdAllPatientTab": this.opdAllPatientTab, "opdMyPatientTab": this.opdMyPatientTab, "followUpPatientListTab": this.followUpPatientListTab, "opdEncounterPatientTab": this.opdEncounterPatientTab, "reviewPatientTab": this.reviewPatientTab } this.patientArray.push(obj); localStorage.setItem("datas", JSON.stringify(this.patientArray)) this.getDoctorReviewList(); } handlePageChangeEncounter(e) { this.encounterPage = e; this.pageArray.push(this.page) localStorage.setItem("dataPage", JSON.stringify(this.pageArray)); let obj = { "hospitalnum": this.hospitalnum, "patientName": this.patientName, "phoneNumber": this.phoneNumber, "alternativePhoneNumber": this.alternativePhoneNumber, "regnDate": this.regnDate, "toregnDate": this.toregnDate, "visitNo": this.visitNo, "ConsultStatus": this.ConsultStatus, "gender": this.gender, "selectedTab": this.selectedTab, "departmentName": this.departmentName, "unit": this.unit, "opdAllPatientTab": this.opdAllPatientTab, "opdMyPatientTab": this.opdMyPatientTab, "followUpPatientListTab": this.followUpPatientListTab, "opdEncounterPatientTab": this.opdEncounterPatientTab, "reviewPatientTab": this.reviewPatientTab } this.patientArray.push(obj); localStorage.setItem("datas", JSON.stringify(this.patientArray)) this.getEncounterPatientList(); } menuTopLeftPosition = { x: '0', y: '0' } @ViewChild(MatMenuTrigger, { static: true }) matMenuTrigger: MatMenuTrigger; onRightClick(event: MouseEvent, data) { this.internalDept = 0 event.preventDefault(); this.menuTopLeftPosition.x = event.clientX + 'px'; this.menuTopLeftPosition.y = event.clientY + 'px'; this.matMenuTrigger.menuData = { item: data } this.matMenuTrigger.openMenu(); const elements = document.querySelectorAll('.cdk-overlay-connected-position-bounding-box'); elements.forEach((element: HTMLElement) => { element.style.left = this.menuTopLeftPosition.x; element.style.top = this.menuTopLeftPosition.y; }); if (this.loginDetail['roleTypeApplicationCode'] != "DOC" && this.loginDetail['roleTypeApplicationCode'] != "IMO") { if (this.newArray.departmentData) { for (let i = 0; i < this.newArray.departmentData.length; i++) { if (this.matMenuTrigger.menuData.item.departmentCode == this.newArray.departmentData[i].departmentCode) { this.internalDept = 1 } } } else if (this.matMenuTrigger.menuData.item.departmentCode == this.newArray.department) { this.internalDept = 1 } } else { if (this.loginDetail['roleTypeApplicationCode'] != "IMO") { this.internalDept = 1 } } } WardTypeList = []; WardL = []; wardObj = {}; getWardTypeList() { // cm this.wardObj['codeType'] = "WT"; let st2 = []; this.http.post(globals.OPRegistration.getListOFSystemCodes, JSON.stringify(this.wardObj), { headers: globals.HeaderValue1 }).subscribe( data => { this.WardL = data['result']; this.WardL.forEach(element => { st2.push({ id: element.id, text: element.applicationCodeDesc }) }); this.WardTypeList = st2; // cm } ); } roomList = []; roomL = []; roomObj = {}; getRoomTypeList() { this.roomObj['codeType'] = "RT"; let temp = []; this.http.post(globals.BedMaster.bedtypelist, JSON.stringify(this.roomObj), { headers: globals.HeaderValue1 }).subscribe( data => { this.roomL = data['result']; this.roomL.forEach(element => { temp.push({ id: element.id, text: element.applicationCodeDesc }) }); this.roomList = temp; } ); } // Based on ward type room will display RoomObj: any = {}; RoomType: any = []; selWardType(e) { if (e) { this.RoomType = []; this.RoomObj["wardType"] = e; let RoomTypeList = [] let tempRoomType = []; this.http .post( globals.InPatientAdmission.getRoomType, JSON.stringify(this.RoomObj), { headers: globals.HeaderValue1 } ) .subscribe((data) => { if (data["error"] == false) { RoomTypeList = data["result"]; RoomTypeList.forEach((element) => { tempRoomType.push({ id: element.id, text: element.applicationCodeDesc, }); }); this.RoomType = tempRoomType; } }); } } //assign to me // assign type assignType: any; consultant: any; consultantDoctor: any; AssignTypeValues: any = [] AssignTypeValue: any = [] getAssignTypeList() { const temp = []; this.http.post( globals.OTconfirmation.systemCodesList, JSON.stringify({ "codeType": "ASSTY" }), { headers: globals.HeaderValue1 }) .subscribe( (data: { result: any }) => { if (data.result.length != 0) { this.AssignTypeValues = data['result']; if (this.AssignTypeValues.length > 0) { this.AssignTypeValues.forEach(element => { temp.push({ id: element.applicationCode, text: element.applicationCodeDesc }) }); //this.AssignTypeValue = temp; this.AssignTypeValue = [{ id: "DOC", text: "Consultant Physician" }, { id: "PG", text: "PG" }, { id: "IMO", text: "IMO" }] } } } ) } assignToObj: any = {} onSubmitAssigntoMe(value) { // if (!this.assignType) { // this.toastr.error("Please Select Assign Type"); // $("html,body").animate( // { // scrollTop: $(".assignType").offset().top - 70, // }, // "slow" // ); // return; // } // else { // this.assignToObj['hospitalNumber'] = this.matMenuTrigger.menuData.item.hospitalNumber, // this.assignToObj["opNumber"] = this.matMenuTrigger.menuData.item.opNumber, // this.assignToObj['id'] = this.matMenuTrigger.menuData.item.id // this.assignToObj['organizationId'] = this.newArray.organizationId; // this.assignToObj['groupId'] = this.newArray.groupId; // this.assignToObj['businessId'] = this.newArray.businessId; // this.assignToObj['referredDoctor'] = this.doctorCodes; // this.assignToObj['departmentCode'] = this.departmentC; // this.assignToObj['departmentUnit'] = this.doctorUnit; // this.http.post(globals.DoctorDesk.assignToMe, JSON.stringify(this.assignToObj), { headers: globals.HeaderValue1 }).subscribe( // data => { // if (data['error'] == false) { // // this.submitBtn = false; // Swal.fire({ // text: data['message'], // icon: 'success' // }); // // cm // this.closebutton.nativeElement.click(); // // this.router.navigate(['/operationtheater/surgeryMasterList']); // } else { // // // cm // // this.submitBtn = false; // Swal.fire({ // text: data['message'], // icon: 'error' // }); // } // } // ) // } } //assign to // ListOfDepartment: any = []; onclickClear() { this.AssigntoForm.reset() this.docCat = ''; } clinicType: any; departmentList: any = []; departmentListValue: any; getDepartmentLists() { const getDepartmentListPayload = { clinicName: 21716, organizationId: this.newArray.organizationId, groupId: this.newArray.groupId, businessId: this.newArray.businessId, } let temp = []; this.http.post( globals.OPRegistration.getDepartmentNameOfCLinic, JSON.stringify(getDepartmentListPayload), { headers: globals.HeaderValue1 }).subscribe( (data: { result: any, error: boolean, message: string }) => { if (data?.result?.length != 0 && data.error == false) { this.departmentList = data.result; if (this.departmentList.length > 0) { this.departmentList.forEach(element => { if (element.DepartmentId != null) { temp.push({ id: element.DepartmentId, text: element.DepartmentName }) } }); this.departmentListValue = temp; } else { this.departmentListValue = []; } } else if (data.error == true) { Swal.fire( { text: data.message, iconHtml: 'Lazy-loaded image' } ) } }, (error) => { Swal.fire( { text: 'Error getting department name of clinic, please try refreshing.', iconHtml: 'Lazy-loaded image' } ) } ) } departmentCode: any; doctorList = []; doctorListValue = []; selDepartment(e) { e = e ? e : null; this.departmentCode = e; // this.getRoomNumberList(e) let data = { 'clinicName': this.clinicType, 'DepartmentName': this.departmentCode } let temp = []; // this.value['unitName'] = this.unitType; this.http.post(globals.OPRegistration.getAllDoctorOfClinic, JSON.stringify(data), { headers: globals.HeaderValue1 }).subscribe( data => { if (data['error'] == false) { this.doctorList = data['result']; if (this.doctorList.length > 0) { this.doctorList.forEach(element => { if (element.DoctorId != null && element.DoctorName != null) { temp.push({ id: element.DoctorId, text: element.DoctorName }) } }); this.doctorListValue = temp; } else { this.doctorListValue = []; } } }) } unitList: any; UnitListValue: any; selDoctorCode(e) { e = e ? e : null if (e != null) { let temp1 = { 'clinicName': 21716, 'DepartmentName': this.departmentCode, 'organizationId': this.newArray.organizationId, 'groupId': this.newArray.groupId, 'businessId': this.newArray.businessId, } let temp = []; this.http.post(globals.OPRegistration.getAllUnitOfClinic, JSON.stringify(temp1), { headers: globals.HeaderValue1 }).subscribe( data => { if (data['error'] == false) { this.unitList = data['result']; let doctorCode if (this.unitList.length > 0) { this.unitList.forEach(element => { temp.push({ id: element.unitId, text: element.unitName }) }); this.UnitListValue = temp; this.signedDoctorLists.forEach(element => { if (e == element.loginId) { doctorCode = element.doctorCode } }); const doctor = this.signedDoctorLists.find(doc => doc.doctorCode === doctorCode); // If doctor exists, find corresponding unitName in signedDoctorLists if (doctor) { const signedDoctor = this.doctorList.find(sDoc => sDoc.doctorCode === doctorCode); if (signedDoctor) { this.specialtyUnit = signedDoctor?.unitId; } else { } } else { } } else { this.UnitListValue = []; } } } ) } } //check box function applicable: any; applicableValue: boolean = true; checkBoxfunc(e) { if (e.target.checked) { this.applicableValue = false; this.applicable = false; } else { this.applicable = true; this.applicableValue = true; } } checkBoxfuncYes(e) { if (e.target.checked) { this.applicableValue = true; this.applicable = true; } else { this.applicable = false; this.applicableValue = false; } } assignObj: any = {} newDoctorId: any; reason: any; newDepartmentId: any; specialtyUnit: any onSubmitAssignto(value) { // if (!this.assignType) { // this.toastr.error("Please Select Assign Type"); // $("html,body").animate( // { // scrollTop: $(".assignType").offset().top - 70, // }, // "slow" // ); // return; // } else if (!this.newDepartmentId) { // this.toastr.error("Please Select Department"); // $("html,body").animate( // { // scrollTop: $(".newDepartmentId").offset().top - 70, // }, // "slow" // ); // this.newDepartmentId.selectRootElement(".hosNum").focus() // return; // } else if (!this.newDoctorId) { // this.toastr.error("Please Select Doctor Name"); // $("html,body").animate( // { // scrollTop: $(".newDoctorId").offset().top - 70, // }, // "slow" // ); // return; // } else if (!this.specialtyUnit) { // this.toastr.error("Please Select Unit"); // $("html,body").animate( // { // scrollTop: $(".specialtyUnit").offset().top - 70, // }, // "slow" // ); // return; // } else if (!this.reason) { // this.toastr.error("Please Enter Reason"); // $("html,body").animate( // { // scrollTop: $(".reason").offset().top - 70, // }, // "slow" // ); // return; // } // this.assignObj['hospitalNumber'] = this.matMenuTrigger.menuData.item.hospitalNumber, // this.assignObj["opNumber"] = this.matMenuTrigger.menuData.item.opNumber, // this.assignObj['id'] = this.matMenuTrigger.menuData.item.id // this.assignObj['organizationId'] = this.newArray.organizationId; // this.assignObj['groupId'] = this.newArray.groupId; // this.assignObj['businessId'] = this.newArray.businessId; // this.assignObj['referredDoctor'] = this.newDoctorId; // this.assignObj['reason'] = this.reason; // this.assignObj['departmentCode'] = this.newDepartmentId; // this.assignObj['departmentUnit'] = this.specialtyUnit; // this.http.post(globals.DoctorDesk.assignTo, JSON.stringify(this.assignObj), { headers: globals.HeaderValue1 }).subscribe( // data => { // if (data['error'] == false) { // // this.submitBtn = false; // Swal.fire({ // text: data['message'], // icon: 'success' // }); // // cm // this.closebuttons.nativeElement.click(); // // this.router.navigate(['/operationtheater/surgeryMasterList']); // } else { // // // cm // // this.submitBtn = false; // Swal.fire({ // text: data['message'], // icon: 'error' // }); // } // } // ) } //assign to me list onClickOpdMyAssignPatient() { this.showInMy = true; this.getAssignTotList(); } //list api for assign to assignPatientList: any = [] getAssignTotList() { this.loading = true; let encounterTemp = { page: this.encounterPage, organizationId: this.newArray.organizationId, businessId: this.newArray.businessId, groupId: this.newArray.groupId, finalDoctor: this.doctorCodes, }; this.http .post( globals.DoctorDesk.assignToList, JSON.stringify(encounterTemp), { headers: globals.HeaderValue1 } ) .subscribe( (data: { error: boolean; message: string; result: any }) => { if (data.error == false && data.result.length != 0) { // cm this.assignPatientList = data["result"]; // this.encounterCount = data["count"]; let limit = 20; for (let j = 0; j < this.assignPatientList.length; j++) { let offSet = (this.page1 - 1) * limit; this.assignPatientList[j].slNo = offSet + 1 + j; this.listCOunt = this.assignPatientList.length; } } else if (data.error == false && data?.result?.length == 0) { // cm this.toastr.error("No data for Assign Patient List") } else { // cm Swal.fire({ text: data?.message || "Something went wrong", iconHtml: 'Lazy-loaded image', }); } }, (error) => { // cm Swal.fire({ text: "Error getting getDepartment Type .", iconHtml: 'Lazy-loaded image', }); } ); /// } // confirm doctor confirmObj: any = {} submitConfirmForm(value) { this.confirmObj['hospitalNumber'] = this.hospitalNumber, this.confirmObj["opNumber"] = this.opNumber, this.confirmObj['organizationId'] = this.newArray.organizationId; this.confirmObj['groupId'] = this.newArray.groupId; this.confirmObj['businessId'] = this.newArray.businessId; this.confirmObj['referredDoctor'] = this.doctorCodes; this.confirmObj['departmentCode'] = this.departmentC; this.confirmObj['departmentUnit'] = this.doctorUnit; this.http.post(globals.DoctorDesk.confirmationDoctor, JSON.stringify(this.confirmObj), { headers: globals.HeaderValue1 }).subscribe( data => { if (data['error'] == false) { // this.submitBtn = false; Swal.fire({ text: data['message'], icon: 'success' }); // cm this.CloseButtonValues.nativeElement.click(); // this.router.navigate(['/operationtheater/surgeryMasterList']); } else { // // cm // this.submitBtn = false; Swal.fire({ text: data['message'], icon: 'error' }); } } ) } confirmedStatus: any; arraivalStatus: any; nurseInsList: any = []; nurseInsArray: any = []; arrivalStatusToggle: any = 0; diagnosisStatus: any = 2; pgImoSigned: any = 2; coSigned: any = 2; getConsultationStatus() { let temp = []; this.http .post( globals.WardDietRequest.getAllList, JSON.stringify({ codeType: "CST" }), { headers: globals.HeaderValue1 } ) .subscribe((data) => { if (data["result"]) { this.nurseInsList = data["result"]; if (this.nurseInsList.length > 0) { this.nurseInsList.forEach((element) => { temp.push({ id: element.applicationCode, text: element.applicationCodeDesc, }); }); this.nurseInsArray = temp; } } }); } hospitalNumber: any; // value assignConfirmation(data) { this.hospitalNumber = data.hospitalNumber; this.opNumber = data.opNumber; } unitOnj: any = {}; unitsList: any = []; departmentType: any; ClinicType: any; regAppCode: any; unit: any; UnitGroupList = []; curNum: number = 0; seldepartmentType(e) { e = e ? e : "" if (e) { this.curNum++; if (this.curNum > 1) { return } this.unitsList = []; this.unit = '' this.departmentListArray = [e]; this.departmentType = e; this.unitOnj["clinicName"] = "CLIN0001"; this.unitOnj["DepartmentName"] = e; this.unitOnj['organizationId'] = this.newArray.organizationId; this.unitOnj['groupId'] = this.newArray.groupId; this.unitOnj['businessId'] = this.newArray.businessId; let temp = []; this.http .post( globals.OPRegistration.getAllUnitOfClinic, JSON.stringify(this.unitOnj), { headers: globals.HeaderValue1 } ) .subscribe((data) => { this.unitsList = data["result"]; this.curNum = 0 if (this.unitsList?.length != 0) { this.unitsList.forEach((element) => { if (element.unitId != null) { temp.push({ id: element.unitId, text: element.unitName }); } }); this.UnitGroupList = temp; this.unit = this.unit ? this.unit : this.UnitGroupList[0].id } }); } } genderValue: any = []; genderList: any = []; getGender() { const payloadForGenderSearch = { organizationId: this.newArray.organizationId, businessId: this.newArray.businessId, groupId: this.newArray.groupId, codeType: "G" } this.http.post(globals.SystemCodes.getSystemCodeListForDropDown, JSON.stringify(payloadForGenderSearch), { headers: globals.HeaderValue1 } ) .subscribe( (data: { error: boolean, result: any, message: string }) => { if (data.error === true) { Swal.fire( { text: data.message, iconHtml: 'Lazy-loaded image' } ) } else if (data.error === false) { for (let i = 0; i < data.result?.length; i++) { // console.log(this.genderList) this.genderList[i] = { id: data.result[i].id, text: data.result[i].applicationCodeDesc } } this.genderValue = this.genderList; } else { Swal.fire( { text: data.error || 'Something went wrong, please try refreshing.', iconHtml: 'Lazy-loaded image' } ) } } ), (error) => { Swal.fire( { text: 'Something went wrong, Please try refreshing browser.', iconHtml: 'Lazy-loaded image' } ) } } consult: any; displayRadioForReviewAndConsult: any; review: any; sendTextPsitive(e) { this.regnDate = "" this.toregnDate = "" this.patientList = [] if (e.target.checked == true) { this.displayRadioForReviewAndConsult = 1 if (this.navigateDD == 'IPD') { this.consultList('OP') } else { this.consultListIP('IP') } } else { this.displayRadioForReviewAndConsult = 0 this.reviewListObj["isReview"] = "" this.reviewListObj["reviewAndConsult"] = "" } } submitDenyForm(value) { let data = this.denyObj if (data.recordStatus == 0 && this.denyReason) { this.sendMailObj['organizationId'] = this.newArray.organizationId; this.sendMailObj['groupId'] = this.newArray.groupId; this.sendMailObj['businessId'] = this.newArray.businessId; this.sendMailObj['doctorName'] = this.loginDetail["firstName"]; this.sendMailObj['patientName'] = data.patientName ? data.patientName : data.displayName; this.sendMailObj['hospitalNumber'] = data.hospitalNumber; this.sendMailObj['opNumber'] = data.opNumber; this.sendMailObj['ipNumber'] = data.ipNumber; this.sendMailObj['reviewDoctor'] = data.reviewBy; this.sendMailObj['reviewByCode'] = data.reviewByCode; this.sendMailObj['reviewerDept'] = data.reviewerDepartment this.sendMailObj['referredDoctor'] = data.referredDoctor this.sendMailObj['department'] = this.loginDetail["department"]; this.sendMailObj['reason'] = this.denyReason; this.http.post(globals.DoctorDesk.sendDenyMail, JSON.stringify(this.sendMailObj ), { headers: globals.HeaderValue1 }).subscribe( data => { if (data['error'] == false) { this.patientList = []; Swal.fire({ text: data['result'], icon: 'success' }); ($('#denyModal') as any).modal('hide'); this.denyReason = ""; setTimeout(() => { if (this.sendMailObj['ipNumber']) { this.getMyPatientListForIp(); } if (this.sendMailObj['opNumber']) { this.getPatientListList(); } }, 1000); } else { //this.toastr.error(data['message']); Swal.fire({ text: data['message'], icon: 'error' }); } } ) } else { Swal.fire({ text: "please enter denial reason", icon: 'error' }); } } sendMailObj: any = {}; denyReason: any; denyObj: any; denyFunc(data) { this.denyObj = data; // if(data.recordStatus == 0){ // this.sendMailObj['organizationId'] = this.newArray.organizationId; // this.sendMailObj['groupId'] = this.newArray.groupId; // this.sendMailObj['businessId'] = this.newArray.businessId; // this.sendMailObj['ipNumber'] = data.ipNumber; // this.sendMailObj['opNumber'] = data.opNumber; // this.sendMailObj['patientName'] = data.PatientName; // this.sendMailObj['hospitalNumber'] = data.hospitalNumber; // this.sendMailObj['doctorName'] = data.doctorName; // this.sendMailObj['reviewDoctor'] = data.reviewBy; // this.sendMailObj['reviewerDept'] = data.reviewerDepartment; // this.sendMailObj['department'] = data.departmentCode; // this.sendMailObj['reason'] = data.remarks; // this.http.post(globals.DoctorDesk.sendDenyMail, JSON.stringify(this.sendMailObj // ), { headers: globals.HeaderValue1 }).subscribe( // data => { // if (data['error'] == false) { // Swal.fire({ // text: data['message'], // icon: 'success' // }); // //.toastr.success(data['message']); // } else { // //this.toastr.error(data['message']); // Swal.fire({ // text: data['message'], // icon: 'error' // }); // } // } // ) // } } financialYear: any; crossReferralObj: any = {} acceptFunc(data) { this.seldoctorType(data.reviewById) if (data.recordStatus == 0) { this.crossReferralObj['patientRegTypeValue'] = 'crossrefferal'; this.crossReferralObj['requestSent'] = 1; this.crossReferralObj['organizationId'] = this.newArray.organizationId; this.crossReferralObj['groupId'] = this.newArray.groupId; this.crossReferralObj['businessId'] = this.newArray.businessId; this.crossReferralObj['terminalId'] = "qqq"; this.crossReferralObj['userId'] = this.newArray.userId; this.crossReferralObj['hospitalNumber'] = data.hospitalNumber; this.crossReferralObj['opNumber'] = data.opNumber; this.crossReferralObj['patientRegType'] = "22222"; this.crossReferralObj['visitNumber'] = data.visitNumber; this.crossReferralObj['patientName'] = data.patientName; this.crossReferralObj['departmentCode'] = data.reviewerDepartment; this.crossReferralObj['unit'] = data.reviewerUnit; this.crossReferralObj['clinicName'] = data.clinic; this.crossReferralObj['referredHospital'] = data.referredDoctor; this.crossReferralObj['rateType'] = data.rateType; this.crossReferralObj['reason'] = data.remarks; this.crossReferralObj['doctorCode'] = data.reviewById; this.crossReferralObj['refferedByDoctor'] = this.loginDetail["userId"]; this.crossReferralObj['patientType'] = data.patientType.toString(); this.crossReferralObj['regnDate'] = globals.formatDate(new Date()); this.crossReferralObj['patientCategory'] = data.patientCategory.toString(); this.crossReferralObj['firstName'] = data.patientName; this.crossReferralObj['phoneNumber1'] = data.phoneNumber ? data.phoneNumber : ""; this.crossReferralObj['formCode'] = 'PG0003'; this.crossReferralObj['documentSeries'] = 'HOSP'; this.crossReferralObj['ipDocumentSeries'] = 'OPNO'; this.financialYear = globals.currentFinancialYear(); this.crossReferralObj['financialYear'] = this.financialYear; this.crossReferralObj['consultationAmount'] = this.consultationCharges; this.http.post(globals.OPRegistration.createHmsOpRegistration, JSON.stringify(this.crossReferralObj ), { headers: globals.HeaderValue1 }).subscribe( data => { if (data['error'] == false) { Swal.fire({ text: data['message'], icon: 'success' }); //.toastr.success(data['message']); this.consultList('OP') } else { //this.toastr.error(data['message']); Swal.fire({ text: data['message'], icon: 'error' }); } } ) } } doctorType: any; consultationCharges: any; seldoctorType(e) { if (e != null || e != undefined || e != "") { this.doctorType = e; this.doctorList.forEach(element => { if (element.DoctorId == e) { this.doctorCode = element.DoctorId; this.unit = element.unitId; this.consultationCharges = element.consultationCharges; } else { } }) } } servIPCode: any = {}; quantityIp: any; serviceTName: any; rateObj: any = {}; storeObj: any = {}; consultIPFunction(e) { this.ipConsulationObj.discountAmount = ""; this.ipConsulationObj.quantity = ""; this.storeObj = e // this.servIPCode["serviceCode"] = e["serviceCode"]; this.servIPCode["serviceCode"] = "IPC00008"; this.servIPCode["hospitalNumber"] = e.hospitalNumber; this.servIPCode["ipNumber"] = e.ipNumber; this.servIPCode["ipConsultation"] = "IPC"; this.http .post( globals.WardInvetigation.checkServiceinIpd, JSON.stringify(this.servIPCode), { headers: globals.HeaderValue1 } ) .subscribe((data) => { if (data["error"] == true) { Swal.fire({ text: data["message"], icon: "error", }); this.ipConsulationObj = {}; this.ipConsulationObj.doctorCode = ""; } }); // this.InvestigationObj.serviceName = e.serviceName; // this.ipConsulationObj.serviceType = e.serviceType; // this.ipConsulationObj.serviceClass = e.serviceClass; // this.ipConsulationObj.serviceGroup = e.serviceGroup; // this.ipConsulationObj.serviceName = e.serviceName; // this.quantityIp = e.quantityAllow; this.ipConsulationObj.serviceType = "2"; this.ipConsulationObj.serviceClass = "15855"; this.ipConsulationObj.serviceGroup = "15664"; this.ipConsulationObj.serviceName = "DOCTOR CONSULTATION"; this.quantityIp = "1"; // if (e.quantityAllow == 1) { // this.enableIPquantity = false; // // this.InvestigationObj.quantity = e.quanityAllow; // } else { // this.enableIPquantity = true; // this.ipConsulationObj.quantity = 1; // } // this.rateType1 = this.patientDetailArray['rateType']; // this.serviceCodeInv = e.serviceCode; // this.serviceClassInv = e.serviceClass; // this.serviceGroupInv = e.serviceGroup; // this.serviceType = e.serviceType; // this.serviceTName = e.serviceTypeName; // this.rateObj["serviceCode"] = e.serviceCode; // this.rateObj["serviceClass"] = e.serviceClass; // this.rateObj["serviceType"] = e.serviceType; // this.rateObj["serviceGroup"] = e.serviceGroup; this.serviceTName = "IP CONSULTATION"; this.rateObj["serviceCode"] = "IPC00008"; this.rateObj["serviceClass"] = "15855"; this.rateObj["serviceType"] = "2"; this.rateObj["serviceGroup"] = "15664"; this.rateObj["rateType"] = e.rateType; this.rateObj["roomType"] = e.roomId; this.rateObj["wardType"] = e.wardId; this.getRateTypeList("IP", this.rateObj); } rateType = []; opdrate = []; totalAmountInv: number = 0; ruleEnable: boolean = true; ruleEnableIp: boolean = true; totalAmount: any; getRateTypeList(val, e) { let temp = []; this.http .post(globals.ServiceDetails.listOfRateType, JSON.stringify(e), { headers: globals.HeaderValue1, }) .subscribe((data) => { this.rateType = data["result"]; if (this.rateType != null) { this.ipConsulationObj.rate = Number(this.rateType["rate"]); if (this.quantityIp != 1) { this.ipConsulationObj.quantity = 1; this.totalAmount = Number( this.ipConsulationObj.rate * this.ipConsulationObj.quantity ); this.ipConsulationObj.netAmount = this.totalAmount; this.totalAmount = 0; } else { this.ipConsulationObj.quantity = 1; this.totalAmount = Number( this.ipConsulationObj.rate * this.ipConsulationObj.quantity ); this.ipConsulationObj.netAmount = this.totalAmount; this.totalAmount = 0; } this.createIpConsultation(this.storeObj); if (this.rateType["serviceRuleValue"] == 1) { this.ruleEnableIp = false; } else { this.ruleEnableIp = true; } } else { Swal.fire({ text: data["message"], icon: "error", }); // this.ipConsulationObj = {}; this.ipConsulationObj.serviceCode = ""; } }); } myDate: any; createIpConsultation(data) { this.ipConsulationObj.isEmergency = 0; this.ipConsulationObj.isActive = 1; this.ipConsulationObj.discountAmount = 0; this.ipConsulationObj.doctorCode = data.reviewByCode; this.ipConsulationObj.toBeSeen = "TBSE00001" this.myDate = new Date().toISOString().split("T")[0]; this.ipConsulationObj.serviceDate = new Date().toISOString().split("T")[0]; this.approxIPTotalAMount = this.ipConsulationObj.netAmount; this.TotalIpAmt = this.approxIPTotalAMount; this.childreIpConsultation.push(this.ipConsulationObj); this.ipconcOnj["formCode"] = "PG0010"; this.financialYear = globals.currentFinancialYear(); this.ipconcOnj["financialYear"] = this.financialYear; this.ipconcOnj["documentCode"] = "IPDV"; this.ipconcOnj["documentCategory"] = "IPDVD"; this.ipconcOnj["documentSeries"] = "IPDVDS"; this.ipconcOnj["organizationId"] = this.newArray.organizationId; this.ipconcOnj["groupId"] = this.newArray.groupId; this.ipconcOnj["businessId"] = this.newArray.businessId; this.ipconcOnj["terminalId"] = "1"; this.todayDate = globals.formatDate(new Date()); this.ipconcOnj["transcationDate"] = this.todayDate; this.ipconcOnj["formName"] = "Cross Referral"; this.ipconcOnj["finalActualAmount"] = this.approxIPTotalAMount; this.ipconcOnj["confirmationStatus"] = 1; // value['formName'] = "ManageIpConsultaion"; this.ipconcOnj["hospitalNumber"] = data.hospitalNumber; this.ipconcOnj["ipNumber"] = data.ipNumber; this.ipconcOnj["userId"] = this.newArray.userId; //this.ipconcOnj["finalActualAmount"] = this.approxIPTotalAMount; this.ipconcOnj["approxTotalAmount"] = this.approxIPTotalAMount; this.ipconcOnj["roomType"] = data.roomId; this.ipconcOnj["wardType"] = data.wardId; this.ipconcOnj["rateType"] = data.rateType; this.ipconcOnj["patientType"] = data.patientType; this.ipconcOnj["bedNumber"] = data.bedNumber; this.ipconcOnj["gender"] = data.genderId; this.ipconcOnj["requestSent"] = 1; for (let i = 0; i < this.childreIpConsultation.length; i++) { delete this.childreIpConsultation[i].serviceName; } this.ipconcOnj["children"] = this.childreIpConsultation; this.http .post( globals.WardIpConsultation.createIpCOnsultation, JSON.stringify(this.ipconcOnj), { headers: globals.HeaderValue1 } ) .subscribe((data) => { if (data["error"] == false) { this.toastr.success(data["message"]); } else { this.toastr.error(data["message"]); this.childreIpConsultation = []; } }); } childreIpConsultation: any = []; ipConsulationObj: any = {}; ipconcOnj: any = {}; approxIPTotalAMount: any; TotalIpAmt: any; todayDate: any; acceptIpFunc(data) { this.ipConsulationObj.serviceCode = "IPC00008"; this.consultIPFunction(data) } selectMyOP: any; selectAllOP: any; selectFollowOP: any; selectEncOP: any; selectRevOP: any; onClickOPDBack() { ($('#selectedOp') as any).tab('show') this.techdataPage = JSON.parse(localStorage.getItem("dataPage")); this.techArrayValue = JSON.parse(localStorage.getItem("datas")); for (let i = 0; i < this.techArrayValue.length; i++) { this.selectedHospNum = this.techArrayValue[i].hospitalnum; } if (this.techdataPage) { if (this.selectedHospNum == null || this.selectedHospNum == undefined || this.selectedHospNum == "") { for (let i = 0; i < this.techdataPage.length; i++) { this.page = this.techdataPage[i]; this.pageNo = this.techdataPage[i]; this.encounterPage = this.techdataPage[i] } } else { localStorage.removeItem("dataPage"); } } else { } for (let i = 0; i < this.techArrayValue.length; i++) { this.selectedDOctorId = this.techArrayValue[i].selectedTab; this.hospitalnum = this.techArrayValue[i].hospitalnum; this.patientName = this.techArrayValue[i].patientName; this.phoneNumber = this.techArrayValue[i].phoneNumber; this.alternativePhoneNumber = this.techArrayValue[i].alternativePhoneNumber; this.regnDate = this.techArrayValue[i].regnDate; this.toregnDate = this.techArrayValue[i].toregnDate; this.departmentName = this.techArrayValue[i].departmentName; this.departmentListArray = this.departmentName ? [this.departmentName] : []; this.departmentType = this.departmentName; this.unit = this.techArrayValue[i].unit; this.visitNo = this.techArrayValue[i].visitNo; this.ConsultStatus = this.techArrayValue[i].ConsultStatus; this.gender = this.techArrayValue[i].gender; this.selectMyOP = this.techArrayValue[i].opdMyPatientTab; this.selectAllOP = this.techArrayValue[i].opdAllPatientTab; this.selectFollowOP = this.techArrayValue[i].followUpPatientListTab; this.selectEncOP = this.techArrayValue[i].opdEncounterPatientTab; this.selectRevOP = this.techArrayValue[i].reviewPatientTab; } if (this.selectMyOP == 1) { ($('#mypatientTab') as any).tab('show') this.doctorId = this.newArray.loginId; this.opdAllPatientTab = 0; this.opdDepartmentPatientTab = 0; this.opdMyPatientTab = 1; this.reviewPatientTab = 0; this.followUpPatientListTab = 0; this.opdEncounterPatientTab = 0; // this.getPatientListList(); this.selectedTab = "myPatient"; this.HideDept = true; this.showInMy = false; } else if (this.selectAllOP == 1) { ($('#allpatientTab') as any).tab('show') this.opdAllPatientTab = 1; this.opdDepartmentPatientTab = 0; this.opdMyPatientTab = 0; this.reviewPatientTab = 0; this.followUpPatientListTab = 0; this.opdEncounterPatientTab = 0; this.selectedTab = "allPatient"; this.getPatientListList(); this.HideDept = false; this.showInMy = true; } else if (this.selectFollowOP == 1) { ($('#followTab') as any).tab('show') this.HideDept = false; this.showInMy = true; this.opdAllPatientTab = 0; this.opdDepartmentPatientTab = 0; this.opdMyPatientTab = 0; this.reviewPatientTab = 0; this.followUpPatientListTab = 1; this.opdEncounterPatientTab = 0; this.onClickOpdFollowUpList(); this.selectedTab = "followPatient"; } else if (this.selectEncOP == 1) { ($('#encounterTab') as any).tab('show') this.HideDept = true; this.showInMy = true; this.opdAllPatientTab = 0; this.opdDepartmentPatientTab = 0; this.opdMyPatientTab = 0; this.reviewPatientTab = 0; this.followUpPatientListTab = 0; this.opdEncounterPatientTab = 1; this.getEncounterPatientList(); this.selectedTab = "encountPatient"; } else if (this.selectRevOP == 1) { ($('#reviewsTab') as any).tab('show') this.showInMy = true; this.opdAllPatientTab = 0; this.opdDepartmentPatientTab = 0; this.opdMyPatientTab = 0; this.reviewPatientTab = 1; this.followUpPatientListTab = 0; this.opdEncounterPatientTab = 0; this.getDoctorReviewList(); this.onClickReviewsListIp(); this.getPatientListList(); this.selectedTab = "reviewPatient"; } // this.getPatientListList(); // this.getDoctorReviewList(); } selectedTabMy: any; selectedTabAll: any; selectedTabCross: any; selectedTabRev: any; dischargeStatusVal: any; onClickIPDBack() { ($('#selectedIp') as any).tab('show') for (let i = 0; i < this.techArrayValueIp.length; i++) { this.selectedHospNum = this.techArrayValueIp[i].hospitalnum1; } if (this.techdataPageIp) { if (this.selectedHospNum == null || this.selectedHospNum == undefined || this.selectedHospNum == "") { for (let i = 0; i < this.techdataPageIp.length; i++) { this.page1 = this.techdataPageIp[i]; this.pageNoIp = this.techdataPageIp[i]; this.pageNoIpCrossReffer = this.techdataPageIp[i] } } else { localStorage.removeItem("dataPageIP"); } } else { } for (let i = 0; i < this.techArrayValueIp.length; i++) { this.hospitalnum1 = this.techArrayValueIp[i].hospitalnum1; this.patientName = this.techArrayValueIp[i].patientName; this.ipNumber = this.techArrayValueIp[i].ipNumber; this.phoneNumber1 = this.techArrayValueIp[i].phoneNumber1; this.alternativePhoneNumber1 = this.techArrayValueIp[i].alternativePhoneNumber1; this.departmentName = this.techArrayValueIp[i].departmentName; this.departmentListArray = this.departmentName ? [this.departmentName] : []; this.departmentType = this.departmentName; this.unit = this.techArrayValueIp[i].unit; this.wardTypeFilter = this.techArrayValueIp[i].wardTypeFilter; this.roomTypeFilter = this.techArrayValueIp[i].roomTypeFilter; this.bednumberFilter = this.techArrayValueIp[i].bednumberFilter; this.regnDate = this.techArrayValueIp[i].regnDate; this.toregnDate = this.techArrayValueIp[i].toregnDate; this.gender = this.techArrayValueIp[i].gender; this.selectedTabMy = this.techArrayValueIp[i].ipMyPatientListSearch; this.selectedTabAll = this.techArrayValueIp[i].ipAllPatientSearch; this.selectedTabCross = this.techArrayValueIp[i].ipCrossRefferPatientSearch; this.selectedTabRev = this.techArrayValueIp[i].ipReviewsListSearch; this.dischargeStatusVal = this.techArrayValueIp[i].dischargeStatust; } if (this.selectedTabMy == 1) { ($('#mypatientIP') as any).tab('show') this.selectedTab = "mylistpatientIP"; this.ipAllPatientSearch = 0; this.ipMyPatientListSearch = 1; this.ipCrossRefferPatientSearch = 0; this.ipReviewsListSearch = 0; this.HideDept = true; this.showInMy = false; this.getMyPatientListForIp(); } else if (this.selectedTabAll == 1) { this.prevSelectedTab = this.selectedTab; this.HideDept = false; this.showInMy = true; ($('#allpatientIP') as any).tab('show') if (this.dischargeStatusVal == '1') { $("#onDischarge").prop("checked", true); this.HideDept = false; this.showInMy = true; this.dischargedList(); } else { $("#onGoing").prop("checked", true); this.HideDept = false; this.showInMy = true; this.onGoing(); } // this.getIPpatientList(); this.ipAllPatientSearch = 1; this.ipMyPatientListSearch = 0; this.ipCrossRefferPatientSearch = 0; this.ipReviewsListSearch = 0; this.selectedTab = "alllistpatientIP"; } else if (this.selectedTabCross == 1) { ($('#crosspatientIP') as any).tab('show') this.HideDept = false; this.showInMy = true; this.getCrossRefferalList(); this.ipAllPatientSearch = 0; this.ipMyPatientListSearch = 0; this.ipCrossRefferPatientSearch = 1; this.ipReviewsListSearch = 0; this.selectedTab = "crosslistpatientIP"; } else if (this.selectedTabRev == 1) { ($('#reviewspatientIP') as any).tab('show') this.HideDept = false; this.showInMy = true; this.ipAllPatientSearch = 0; this.ipMyPatientListSearch = 0; this.ipCrossRefferPatientSearch = 0; this.ipReviewsListSearch = 1; this.selectedTab = "reviewPatientListIp"; } this.getDoctorReviewList(); } redirectToChecklist(hospitalNumber) { this.listObj = {} for (let i = 0; i < this.CompleteSideDetails.length; i++) { for (let j = 0; j < this.CompleteSideDetails[i].PageList.length; j++) { if ( this.CompleteSideDetails[i].PageList[j].pageLink == ("/ward-management/defiency-checklist") ) { this.listObj = this.CompleteSideDetails[i].PageList[j]; this.formCodeDetails = this.CompleteSideDetails[i].PageList[j].formCode; } } } localStorage.setItem("sideDetails", JSON.stringify(this.listObj)); console.log(hospitalNumber) // window.open('ward-management/defiency-checklist?data='+ encodeURIComponent(hospitalNumber)); localStorage.removeItem('defiencyData'); let myWindow = window.open('ward-management/defiency-checklist'); myWindow.opener.data = hospitalNumber // this.router.navigateByUrl('/material-management/manage-po-amendment?data='+poKey); } activateReviewsTab() { const reviewsTab = document.getElementById('reviewsTab'); if (reviewsTab) { reviewsTab.click(); } } activateReviewsPatientIPTab() { const reviewspatientIP = document.getElementById('reviewspatientIP'); if (reviewspatientIP) { reviewspatientIP.click(); } } moveToDetail(x) { if ((x?.route?.includes("OP") || x?.opOrIp == 'OP') && (x?.data?.reportKey || x?.reportKey)) { var value = { hospitalNumber: x?.data?.hospitalNumber ?? x.hospitalNumber, opNumber: x?.data?.opNumber ?? x.opNumber, visitNumber: x?.data?.visitNumber ?? x.visitNumber, departmentCode: x?.data?.departmentCode ?? x.departmentCode, reportKey: x?.data?.reportKey ?? x.reportKey }; this.SelectedObj = [] this.SelectedObj.push(value); var encrypted = this.EncrDecr.set( "123456$#@$^@1ERF", JSON.stringify(this.SelectedObj) ); localStorage.setItem("encrypt", encrypted); for (let i = 0; i < this.CompleteSideDetails.length; i++) { for (let j = 0; j < this.CompleteSideDetails[i].PageList.length; j++) { if ( this.CompleteSideDetails[i].PageList[j].pageLink == ("/doctor-master/doctor-desk-" + "opd") ) { this.listObj = [] this.listObj = this.CompleteSideDetails[i].PageList[j]; } } } localStorage.setItem("sideDetails", JSON.stringify(this.listObj)) this.router.navigate(["doctor-master/patient-details-desk"]); ($('#pendingList') as any).modal('hide'); } if ((x?.route?.includes("IP") || x?.opOrIp == 'IP') && (x?.data?.reportKey || x?.reportKey)) { var tempvalue = { hospitalNumber: x?.data?.hospitalNumber ?? x.hospitalNumber, ipNumber: x?.data?.ipNumber ?? x.ipNumber, type: "Doctor", transactionNumber: x?.data?.transactionNumber ?? x.transactionNumber, serviceConfirmationStatus: x?.data?.serviceConfirmationStatus ?? x.serviceConfirmationStatus, reportKey: x?.data?.reportKey ?? x.reportKey }; this.SelectedObjIp.push(tempvalue); var encryptedWard = this.EncrDecr.set( "123456$#@$^@1ERF", JSON.stringify(this.SelectedObjIp) ); localStorage.setItem("encryptWard", encryptedWard); localStorage.setItem("wardDetails", JSON.stringify(this.SelectedObjIp)); for (let i = 0; i < this.CompleteSideDetails.length; i++) { for (let j = 0; j < this.CompleteSideDetails[i].PageList.length; j++) { if ( this.CompleteSideDetails[i].PageList[j].pageLink == ("/doctor-master/doctor-desk-" + "ipd") ) { this.listObj = this.CompleteSideDetails[i].PageList[j]; } } } localStorage.setItem("sideDetails", JSON.stringify(this.listObj)) this.router.navigate(["/ward-management/manage-ward-service"]); ($('#pendingList') as any).modal('hide'); } } exportTableData() { this.exportAsService.save(this.exportAsConfig, 'My Patients List').subscribe(() => { }); } exportTableData1() { this.exportAsService.save(this.exportAsConfig1, 'My Patients List').subscribe(() => { }); } meObj: any = {}; buttonClicked: boolean = false; isSigning: boolean = false; assignToMeFunc(x) { if (x != "ME") { if (!this.newDepartmentId) { this.toastr.error("Please Select Department"); $("html,body").animate( { scrollTop: $(".newDepartmentId").offset().top - 70, }, "slow" ); this.newDepartmentId.selectRootElement(".hosNum").focus() return; } else if (!this.newDoctorId) { this.toastr.error("Please Select Doctor Name"); $("html,body").animate( { scrollTop: $(".newDoctorId").offset().top - 70, }, "slow" ); return; } else if (!this.specialtyUnit) { this.toastr.error("Please Select Unit"); $("html,body").animate( { scrollTop: $(".specialtyUnit").offset().top - 70, }, "slow" ); return; } else if (!this.reason) { this.toastr.error("Please Enter Reason"); $("html,body").animate( { scrollTop: $(".reason").offset().top - 70, }, "slow" ); return; } } if (this.navigateDD == "OPD") { this.meObj = {}; this.meObj["organizationId"] = this.newArray.organizationId; this.meObj["groupId"] = this.newArray.groupId; this.meObj["businessId"] = this.newArray.businessId; this.meObj["hospitalNumber"] = this.matMenuTrigger.menuData.item.hospitalNumber; this.meObj["ipNumber"] = this.matMenuTrigger.menuData.item.ipNumber this.meObj["assignUserId"] = (x != "ME") ? this.newDoctorId : this.newArray.loginId; this.meObj["reason"] = this.reason; this.meObj["userId"] = this.newArray.loginId; if (this.isSigning || this.buttonClicked) { return; // Don't proceed if signing is already in progress or button is already clicked } this.isSigning = true; this.http .post( globals.revamp.assignToMe, JSON.stringify(this.meObj), { headers: globals.HeaderValue1 } ) .subscribe((data) => { this.isSigning = false; if (data["error"] == false) { this.toastr.success(data["message"]); this.getMyPatientListForIp() this.closebuttons.nativeElement.click(); } else { this.toastr.error(data["message"]); } }); } else { this.meObj = {}; this.meObj["organizationId"] = this.newArray.organizationId; this.meObj["groupId"] = this.newArray.groupId; this.meObj["businessId"] = this.newArray.businessId; this.meObj["hospitalNumber"] = this.matMenuTrigger.menuData.item.hospitalNumber; this.meObj["opNumber"] = this.matMenuTrigger.menuData.item.opNumber this.meObj["visitNumber"] = this.matMenuTrigger.menuData.item.visitNumber this.meObj["assignUserId"] = (x != "ME") ? this.newDoctorId : this.newArray.loginId; this.meObj["reason"] = this.reason; this.meObj["userId"] = this.newArray.loginId; if (this.isSigning || this.buttonClicked) { return; // Don't proceed if signing is already in progress or button is already clicked } this.isSigning = true; this.http .post( globals.revamp.opAssignToMe, JSON.stringify(this.meObj), { headers: globals.HeaderValue1 } ) .subscribe((data) => { this.isSigning = false; if (data["error"] == false) { this.toastr.success(data["message"]); this.getPatientListList() this.closebuttons.nativeElement.click(); } else { this.toastr.error(data["message"]); } }); } } myObj: any = {}; signedDoctorLists: any = []; docArr: any = []; basedOnRole(x) { if (x) { this.myObj['organizationId'] = this.newArray.organizationId; this.myObj['groupId'] = this.newArray.groupId; this.myObj['businessId'] = this.newArray.businessId; if (this.navigateDD == "OPD") { this.myObj['unit'] = this.specialtyUnit ? this.specialtyUnit : null; this.myObj['departmentCode'] = this.newDepartmentId ? this.newDepartmentId : null; } else { this.myObj['unit'] = this.specialtyUnit ? this.specialtyUnit : null; this.myObj['departmentCode'] = this.newDepartmentId ? this.newDepartmentId : null; } if (x == "DOC") { this.http.post(globals.DoctorDesk.listdoctorbasedondept, JSON.stringify(this.myObj), { headers: globals.HeaderValue1 }).subscribe(data => { this.signedDoctorLists = data['result']; this.docArr = []; let temp = []; this.signedDoctorLists?.forEach((element) => { if (element.doctorCode != this.loginDetail['doctorCode']) { temp.push({ id: element.loginId, text: element.doctorName, unitName: element?.unitName }); } }); this.docArr = temp; }); } else if (x == "PG") { this.http.post(globals.DoctorDesk.IMODoctorList, JSON.stringify({ "organizationId": this.newArray.organizationId, businessId: this.newArray.businessId, groupId: this.newArray.groupId, userId: this.newArray.loginId, }), { headers: globals.HeaderValue1 }).subscribe(data => { this.signedDoctorLists = data['result']; this.docArr = []; let temp = []; this.signedDoctorLists?.forEach((element) => { if (element.doctorCode != this.loginDetail['doctorCode']) { temp.push({ id: element.loginId, text: element.doctorName, }); } }); this.docArr = temp; }); } else { this.http.post(globals.revamp.imoDoctorList, JSON.stringify({ "organizationId": this.newArray.organizationId, businessId: this.newArray.businessId, groupId: this.newArray.groupId, userId: this.newArray.loginId, }), { headers: globals.HeaderValue1 }).subscribe(data => { this.signedDoctorLists = data['result']; this.docArr = []; let temp = []; this.signedDoctorLists?.forEach((element) => { if (element.doctorCode != this.loginDetail['doctorCode']) { temp.push({ id: element.loginId, text: element.doctorName, }); } }); this.docArr = temp; }); } } } endMyTask() { if (this.navigateDD == "OPD") { this.meObj = {}; this.meObj["organizationId"] = this.newArray.organizationId; this.meObj["groupId"] = this.newArray.groupId; this.meObj["businessId"] = this.newArray.businessId; this.meObj["hospitalNumber"] = this.matMenuTrigger.menuData.item.hospitalNumber; this.meObj["ipNumber"] = this.matMenuTrigger.menuData.item.ipNumber this.meObj["assignedUserId"] = this.newArray.loginId; this.meObj["id"] = this.matMenuTrigger.menuData.item.assignId this.meObj["userId"] = this.newArray.loginId; this.meObj["status"] = "END" this.http .post( globals.revamp.endMyTask, JSON.stringify(this.meObj), { headers: globals.HeaderValue1 } ) .subscribe((data) => { if (data["error"] == false) { this.toastr.success(data["message"]); this.getMyPatientListForIp() } else { this.toastr.error(data["message"]); } }); } else { this.meObj = {}; this.meObj["organizationId"] = this.newArray.organizationId; this.meObj["groupId"] = this.newArray.groupId; this.meObj["businessId"] = this.newArray.businessId; this.meObj["hospitalNumber"] = this.matMenuTrigger.menuData.item.hospitalNumber; this.meObj["opNumber"] = this.matMenuTrigger.menuData.item.opNumber this.meObj["visitNumber"] = this.matMenuTrigger.menuData.item.visitNumber this.meObj["id"] = this.matMenuTrigger.menuData.item.assignId this.meObj["assignedUserId"] = this.newArray.loginId; this.meObj["userId"] = this.newArray.loginId; this.meObj["status"] = "END" this.http .post( globals.revamp.endMyTaskOp, JSON.stringify(this.meObj), { headers: globals.HeaderValue1 } ) .subscribe((data) => { if (data["error"] == false) { this.toastr.success(data["message"]); this.getPatientListList() } else { this.toastr.error(data["message"]); } }); } } viewDoctorLogOp(x) { this.meObj = {}; this.meObj["organizationId"] = this.newArray.organizationId; this.meObj["groupId"] = this.newArray.groupId; this.meObj["businessId"] = this.newArray.businessId; this.meObj["hospitalNumber"] = x.hospitalNumber; this.meObj["opNumber"] = x.opNumber this.meObj["visitNumber"] = x.visitNumber this.http .post( globals.revamp.viewDoctorLog, JSON.stringify(this.meObj), { headers: globals.HeaderValue1 } ) .subscribe((data) => { if (data["error"] == false) { this.doctorLog = data['result'] } else { this.toastr.error(data["message"]); } }); } doctorLog: any = []; viewDoctorLogIp(x) { this.meObj = {}; this.meObj["organizationId"] = this.newArray.organizationId; this.meObj["groupId"] = this.newArray.groupId; this.meObj["businessId"] = this.newArray.businessId; this.meObj["hospitalNumber"] = x.hospitalNumber; this.meObj["ipNumber"] = x.ipNumber; this.meObj["visitNumber"] = "" this.http .post( globals.revamp.viewDoctorLogIp, JSON.stringify(this.meObj), { headers: globals.HeaderValue1 } ) .subscribe((data) => { if (data["error"] == false) { this.doctorLog = data['result'] } else { this.toastr.error(data["message"]); } }); } endDocs: any = []; endDoc: any; endOtherTask(x) { if (x == 'IP') { this.meObj = {}; this.meObj["organizationId"] = this.newArray.organizationId; this.meObj["groupId"] = this.newArray.groupId; this.meObj["businessId"] = this.newArray.businessId; this.meObj["hospitalNumber"] = this.matMenuTrigger.menuData.item.hospitalNumber; this.meObj["ipNumber"] = this.matMenuTrigger.menuData.item.ipNumber this.meObj["visitNumber"] = "" this.meObj["userId"] = this.newArray.loginId; this.http .post( globals.revamp.EndDocListIP, JSON.stringify(this.meObj), { headers: globals.HeaderValue1 } ) .subscribe((data) => { if (data["error"] == false) { let temp = [] data['result']?.forEach((element) => { if (element.statusDescription !== "ENDED" && element.statusDescription !== "REGISTERED" && element.statusDescription !== "REJECTED") { temp.push({ id: element.assignedDoctorLoginId, text: element.doctorName, }); } }); this.endDocs = temp } else { this.toastr.error(data["message"]); } }); } else if (x == 'OP') { this.meObj = {}; this.meObj["organizationId"] = this.newArray.organizationId; this.meObj["groupId"] = this.newArray.groupId; this.meObj["businessId"] = this.newArray.businessId; this.meObj["hospitalNumber"] = this.matMenuTrigger.menuData.item.hospitalNumber; this.meObj["opNumber"] = this.matMenuTrigger.menuData.item.opNumber this.meObj["visitNumber"] = this.matMenuTrigger.menuData.item.visitNumber this.meObj["userId"] = this.newArray.loginId; this.http .post( globals.revamp.EndDocListOP, JSON.stringify(this.meObj), { headers: globals.HeaderValue1 } ) .subscribe((data) => { if (data["error"] == false) { let temp = [] data['result']?.forEach((element) => { if (element.statusDescription !== "ENDED" && element.statusDescription !== "REGISTERED" && element.statusDescription !== "REJECTED") { temp.push({ id: element.assignedDoctorLoginId, text: element.doctorName, }); } }); this.endDocs = temp } else { this.toastr.error(data["message"]); } }); } } endOther() { if (!this.endDoc) { this.toastr.error('Please select doctor'); return; } if (this.navigateDD == "OPD") { this.meObj = {}; this.meObj["organizationId"] = this.newArray.organizationId; this.meObj["groupId"] = this.newArray.groupId; this.meObj["businessId"] = this.newArray.businessId; this.meObj["hospitalNumber"] = this.matMenuTrigger.menuData.item.hospitalNumber; this.meObj["ipNumber"] = this.matMenuTrigger.menuData.item.ipNumber this.meObj["assignedUserId"] = this.endDoc; this.meObj["id"] = this.matMenuTrigger.menuData.item.assignId this.meObj["userId"] = this.newArray.loginId; this.meObj["status"] = "END" this.http .post( globals.revamp.endMyTask, JSON.stringify(this.meObj), { headers: globals.HeaderValue1 } ) .subscribe((data) => { if (data["error"] == false) { this.toastr.success(data["message"]); this.endDoc = ""; ($('#endOthers') as any).modal('hide'); this.getMyPatientListForIp() } else { this.toastr.error(data["message"]); } }); } else { this.meObj = {}; this.meObj["organizationId"] = this.newArray.organizationId; this.meObj["groupId"] = this.newArray.groupId; this.meObj["businessId"] = this.newArray.businessId; this.meObj["hospitalNumber"] = this.matMenuTrigger.menuData.item.hospitalNumber; this.meObj["opNumber"] = this.matMenuTrigger.menuData.item.opNumber this.meObj["visitNumber"] = this.matMenuTrigger.menuData.item.visitNumber this.meObj["id"] = this.matMenuTrigger.menuData.item.assignId this.meObj["assignedUserId"] = this.endDoc; this.meObj["userId"] = this.newArray.loginId; this.meObj["status"] = "END" this.http .post( globals.revamp.endMyTaskOp, JSON.stringify(this.meObj), { headers: globals.HeaderValue1 } ) .subscribe((data) => { if (data["error"] == false) { this.toastr.success(data["message"]); ($('#endOthers') as any).modal('hide'); this.getPatientListList() this.endDoc = ""; } else { this.toastr.error(data["message"]); } }); } } deficiencyPending: any = ""; deficiencyPend: any = 0; ChangeDefStatus(e) { this.deficiencyPending = e.target.checked; if (this.deficiencyPending == true) { this.getCount() this.deficiencyPending = 0; this.getIPpatientList(); } else { this.getCount() this.deficiencyPending = ""; this.getIPpatientList(); } } countObj = {}; defCount: any = 0; defCountLength: any = 0 hospitalPendingarray:any=[] getCount() { this.countObj["organizationId"] = this.newArray.organizationId; this.countObj["businessId"] = this.newArray.businessId; this.countObj["groupId"] = this.newArray.groupId; this.countObj["deficiencyPending"] = 0; this.countObj["hospitalNumber"] = this.hospitalnum1; this.countObj["userTypeId"] = this.newArray.userTypeId; this.countObj["roleTypeId"] = this.newArray.roleTypeId; this.countObj["loginId"] = this.newArray.loginId; this.countObj["roleId"] = this.newArray.roleId; this.countObj["department"] = this.departmentName ? this.departmentName : ""; this.countObj["departmentList"] = this.departmentListArray ? this.departmentListArray : ""; this.countObj["unit"] = this.unit ? this.unit : ""; this.countObj["dischargeStatus"] = this.dischargeStatust; this.countObj["myList"] = this.myList; this.countObj["isHideRuralPt"] = this.newArray.isHideRuralPt; this.http .post( globals.DoctorDesk.DeficiencyCount, JSON.stringify(this.countObj), { headers: globals.HeaderValue1 } ).subscribe((data: any) => { this.defCount = data.count; this.hospitalPendingarray = data.result }) } callCountAPI(e) { if (e != "") { if (this.navigateDD == "OPD") { this.getCount(); } } } }