Summary Table

Categories Total Count
PII 0
URL 0
DNS 0
EKL 0
IP 0
PORT 0
VsID 0
CF 0
AI 0
VPD 0
PL 0
Other 0

File Content

import {
Component,
AfterViewInit,
Input,
OnDestroy,
SimpleChanges,
OnChanges
} from '@angular/core';
import { Subscription } from 'rxjs/Subscription';

import { EwvViewerService } from '../../ewv-viewer/ewv-viewer.service';
import { OhiLineAdjustmentService } from './ohi-line-adjustment.service';

@Component({
selector: 'app-ohi-line-adjustments',
templateUrl: './ohi-line-adjustment.component.html',
styleUrls: ['../../ewv-viewer/ewv-viewer.component.scss']
})
export class OhiLineAdjustmentsComponent
implements AfterViewInit, OnChanges, OnDestroy, OnChanges {
@Input() data;
@Input() compareData;
@Input() accordionId;
@Input() tabbable = true;
@Input() isRightSide: boolean;
@Input() isSplitView: boolean;
get tabbableIdx() {
return this.tabbable ? '0' : '-1';
}

// isSplitView: boolean; // This
isSplitSubscription = new Subscription(); // This

claimType;

collapseState = true;
ohiSrvcLineAdjInfo;
compareOhiSrvcLineAdjInfo;
ohiSrvcLineAdjInfoList = [];
ohiSrvcLineAdjInfoDiffs;
rowsWithoutLineNumbersDiffs;
collapseStateSubscription: Subscription = new Subscription();
ohiMsg = 'No OHI Service Line Adjustment Data Found';

constructor(private ewvViewerService: EwvViewerService, private ohiLineAdjService: OhiLineAdjustmentService) {}

ngAfterViewInit() {
this.collapseStateSubscription = this.ewvViewerService
.getCollapseState()
.subscribe(state => {
this.collapseState = state;
});

if (this.data) {
this.populateData();
// this.ohiLineAdjService.getInstance(this);
// console.log('line adj info', this.ohiSrvcLineAdjInfo);
// console.log('line adj diffs', this.ohiSrvcLineAdjInfoDiffs);
}
// setTimeout(() => {
// console.log('line adj diffs:', this.ohiSrvcLineAdjInfoDiffs);
// console.log('line adj:', this.ohiSrvcLineAdjInfo);
// }, 3000);
}

ngOnChanges(changes: SimpleChanges): void {
if (changes.data && changes.data.currentValue) {
this.data = changes.data.currentValue; // Wrong!
this.populateData();
// this.ohiLineAdjService.differences.subscribe(
// (data) => {
// this.ohiSrvcLineAdjInfoDiffs = data[0];
// this.rowsWithoutLineNumbersDiffs = data[1];
// if (JSON.stringify(this.ohiSrvcLineAdjInfoDiffs) === '{}') {
// // console.log('EMTPY');
// this.ohiSrvcLineAdjInfoDiffs = false;
// }
// console.log('SERVICE LINE DIFS', this.rowsWithoutLineNumbersDiffs);
// }
// );
}
if (this.isRightSide) {
this.comparePopulateData();
this.ohiSrvcLineAdjInfoList =
this.ohiSrvcLineAdjInfo.length > this.compareOhiSrvcLineAdjInfo.length
? this.ohiSrvcLineAdjInfo : this.compareOhiSrvcLineAdjInfo;
}
}

populateData() {
// this.isSplitSubscription = this.ewvViewerService.isSplitView.subscribe(
// // This
// data => (this.isSplitView = data)
// );

this.claimType = undefined;
if (this.data['patientHeaderInfo']) {
this.claimType = this.data['patientHeaderInfo']['claimType'];
}

this.ohiSrvcLineAdjInfo = undefined;
if (
this.data['ohiInfo'] &&
this.data['ohiInfo']['detailServiceLineOhiOutputRows']
) {
this.ohiSrvcLineAdjInfo = this.data['ohiInfo'][
'detailServiceLineOhiOutputRows'
];

// Sorting is now done in the back-end, because this doesn't really work.
// Because multiple lines must be sorted as a unit.
// if (this.claimType === 'INSTITUTIONAL') {
// this.ohiSrvcLineAdjInfo.sort((a, b) => {
// // compareNumber(a.revenueCode, b.revenueCode)
// if (Number(a.revenueCode) < Number(b.revenueCode)) { return -1; }
// if (Number(a.revenueCode) > Number(b.revenueCode)) { return 1; }
// // ?? Are lineNumber's really unique?
// // compareNumber(a.lineNumber, b.lineNumber)
// if (a.lineNumber < b.lineNumber) { return -1; }
// if (a.lineNumber > b.lineNumber) { return 1; }
// return 0;
// });
// }

// Sorting is now done in the back-end, because this doesn't really work.
// if (this.claimType === 'PROFESSIONAL') {
// // console.log('Inside of IF statment for PROFESSIONAL!');
// this.ohiSrvcLineAdjInfo.sort((a, b) => {
// // compareDate(a.beginDateOfService, b.beginDateOfService)
// if (this.getDate(a.beginDateOfService) < this.getDate(b.beginDateOfService)) {
// return -1;
// }
// if (this.getDate(a.beginDateOfService) > this.getDate(b.beginDateOfService)) {
// return 1;
// }
// // compareNumber(a.revenueCode, b.revenueCode)
// if (Number(a.revenueCode) < Number(b.revenueCode)) { return -1; }
// if (Number(a.revenueCode) > Number(b.revenueCode)) { return 1; }
// // ?? Are lineNumber's really unique?
// // compareNumber(a.lineNumber, b.lineNumber)
// if (a.lineNumber < b.lineNumber) { return -1; }
// if (a.lineNumber > b.lineNumber) { return 1; }
// return 0;
// });
// }
}
}

comparePopulateData() {
// this.isSplitSubscription = this.ewvViewerService.isSplitView.subscribe(
// // This
// data => (this.isSplitView = data)
// );

this.claimType = undefined;
if (this.compareData['patientHeaderInfo']) {
this.claimType = this.compareData['patientHeaderInfo']['claimType'];
}

this.compareOhiSrvcLineAdjInfo = undefined;
if (
this.compareData['ohiInfo'] &&
this.compareData['ohiInfo']['detailServiceLineOhiOutputRows']
) {
this.compareOhiSrvcLineAdjInfo = this.compareData['ohiInfo'][
'detailServiceLineOhiOutputRows'
];

// Sorting is now done in the back-end, because this doesn't really work.
// if (this.claimType === 'INSTITUTIONAL') {
// this.compareOhiSrvcLineAdjInfo.sort((a, b) => {
// // compareNumber(a.revenueCode, b.revenueCode)
// if (Number(a.revenueCode) < Number(b.revenueCode)) { return -1; }
// if (Number(a.revenueCode) > Number(b.revenueCode)) { return 1; }
// // ?? Are lineNumber's really unique?
// // compareNumber(a.lineNumber, b.lineNumber)
// if (a.lineNumber < b.lineNumber) { return -1; }
// if (a.lineNumber > b.lineNumber) { return 1; }
// return 0;
// });
// }

// Sorting is now done in the back-end, because this doesn't really work.
// if (this.claimType === 'PROFESSIONAL') {
// // console.log('Inside of IF statment for PROFESSIONAL!');
// this.compareOhiSrvcLineAdjInfo.sort((a, b) => {
// // compareDate(a.beginDateOfService, b.beginDateOfService)
// if (this.getDate(a.beginDateOfService) < this.getDate(b.beginDateOfService)) {
// return -1;
// }
// if (this.getDate(a.beginDateOfService) > this.getDate(b.beginDateOfService)) {
// return 1;
// }
// // compareNumber(a.revenueCode, b.revenueCode)
// if (Number(a.revenueCode) < Number(b.revenueCode)) { return -1; }
// if (Number(a.revenueCode) > Number(b.revenueCode)) { return 1; }
// // ?? Are lineNumber's really unique?
// // compareNumber(a.lineNumber, b.lineNumber)
// if (a.lineNumber < b.lineNumber) { return -1; }
// if (a.lineNumber > b.lineNumber) { return 1; }
// return 0;
// });
// }
}
}

getDate(dateString) {
if (!dateString) {
return null;
}

dateString = dateString.trim();
const splitDate = dateString.split('\/');
if (splitDate.length !== 3) {
return null;
}

const monthString = splitDate[0];
const dayString = splitDate[1];
let yearString = splitDate[2];

if (yearString.length === 2) {
yearString = '20' + yearString;
}

const monthNumber = Number(monthString) - 1;
const dayNumber = Number(dayString);
const yearNumber = Number(yearString);

return new Date(yearNumber, monthNumber, dayNumber);
}

ngOnDestroy() {
this.collapseStateSubscription.unsubscribe();
this.isSplitSubscription.unsubscribe(); // This
}

getDisplayString(value) {
let aValue = '';
if (value) {
aValue = value.trim();
}
if (!aValue) {
aValue = '\u2013\u2013\u2013';
}

return aValue;
}

getDollarSignString(dollarAmount) {
let aDollarValue = '';
if (dollarAmount) {
dollarAmount = dollarAmount.trim();
}
if (dollarAmount) {
aDollarValue = '$' + dollarAmount;
}

if (!dollarAmount) {
aDollarValue = '\u2013\u2013\u2013';
}

return aDollarValue;
}
}