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 { AfterViewInit, Component, Input, OnChanges, OnDestroy, OnInit, SimpleChanges } from '@angular/core';

import { EwvViewerService } from '../../ewv-viewer/ewv-viewer.service';
import { Subscription } from 'rxjs/Subscription';
import { TableColumnModel } from '../../../shared/table';

// SAFE CONST FOR CLAIM TYPES;
const INSTITUTIONAL = 'INSTITUTIONAL';
const DENTAL = 'DENTAL';
const PROFESSIONAL = 'PROFESSIONAL';

@Component({
selector: 'app-ohi-claim-adjustments',
templateUrl: './ohi-claim-adjustments.component.html',
styleUrls: ['../../ewv-viewer/ewv-viewer.component.scss']
})
export class OhiClaimAdjustmentsComponent implements OnInit, OnChanges, OnDestroy {
@Input() tabbable = true;
@Input() data;
@Input() compareData;
@Input() accordionId;
@Input() claimType;
@Input() isRightSide;
@Input() isSplitView;

collapseState = true;
ohiSrvcLineAdjInfo;
primaryOhiInfo = null;
secondaryOhiInfo = null;
tertiaryOhiInfo = null;
ohiClaimMsg = 'No OHI Claim Adjustment Data Found';
collapseStateSubscription: Subscription = new Subscription();
compareOhiSrvcLineAdjInfo;
comparePrimaryOhiInfo;
compareSecondaryOhiInfo;
compareTertiaryOhiInfo;

get tabbableIdx() {
return this.tabbable ? '0' : '-1';
}

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

primaryClaimAdjustmentsTableColumns: TableColumnModel[] = [
new TableColumnModel('OHI Paid Amt. ', 'ohiPaidAmount'),
new TableColumnModel('Total Non-Covered ', 'totalNonCovered'),
new TableColumnModel('Qty. ', 'quantity'),
new TableColumnModel('Adj. ', 'adjustmentCode'),
new TableColumnModel('Adj. Amt. ', 'adjustmentAmount')
];

secondaryClaimAdjustmentsTableColumns: TableColumnModel[] = [
new TableColumnModel('OHI Paid Amt. ', 'ohiPaidAmount'),
new TableColumnModel('Total Non-Covered ', 'totalNonCovered'),
new TableColumnModel('Qty. ', 'quantity'),
new TableColumnModel('Adj. ', 'adjustmentCode'),
new TableColumnModel('Adj. Amt. ', 'adjustmentAmount')
];

tertiaryClaimAdjustmentsTableColumns: TableColumnModel[] = [
new TableColumnModel('OHI Paid Amt. ', 'ohiPaidAmount'),
new TableColumnModel('Total Non-Covered ', 'totalNonCovered'),
new TableColumnModel('Qty. ', 'quantity'),
new TableColumnModel('Adj. ', 'adjustmentCode'),
new TableColumnModel('Adj. Amt. ', 'adjustmentAmount')
];

primaryClaimAdjustmentsTableInfoRows = [];
comparePrimaryClaimAdjustmentsTableInfoRows = [];
secondaryClaimAdjustmentsTableInfoRows = [];
tertiaryClaimAdjustmentsTableInfoRows = [];
compareSecondaryClaimAdjustmentsTableInfoRows = [];
compareTertiaryClaimAdjustmentsTableInfoRows = [];
loading = false;

constructor(private ewvViewerService: EwvViewerService) {}

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

this.populateData();
}

ngOnChanges(changes: SimpleChanges): void {
if (changes.data && changes.data.currentValue) {
this.data = changes.data.currentValue;
this.populateData();
}
if (changes.compareData && changes.compareData.currentValue) {
this.populateCompareData();
}
}

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

getDollarSignString(dollarAmount) {
let aDollarValue = '';
if (dollarAmount) {
dollarAmount = dollarAmount.trim();
}
if (dollarAmount && dollarAmount[0] === '\u2013') {
aDollarValue = dollarAmount;
}
if (dollarAmount && dollarAmount[0] !== '\u2013') {
aDollarValue = '$' + dollarAmount;
}

return aDollarValue;
}

getPercentageString(percentageAmount) {
let aPercentageValue = '';
if (percentageAmount) {
percentageAmount = percentageAmount.trim();
}
if (percentageAmount) {
aPercentageValue = percentageAmount + '%';
}

return aPercentageValue;
}

doesValueExist(value) {
if (!value) {
return false;
}

const aValue = value.trim();
if (aValue) {
if (aValue === '\u2013\u2013\u2013') {
return false;
}

return true;
}

return false;
}

// method to check which medicare type to display (MIA / MOA).
displayMedicareType(ohiInfo) {
if (this.claimType === INSTITUTIONAL) {
if (ohiInfo.medicareInPatientAdjudicationBean && ohiInfo.medicareOutPatientAdjudicationBean) {
ohiInfo.showMedicareInPatient = true;
ohiInfo.showMedicareOutPatient = false;
} else if (ohiInfo.medicareInPatientAdjudicationBean && !ohiInfo.medicareOutPatientAdjudicationBean) {
ohiInfo.showMedicareInPatient = true;
ohiInfo.showMedicareOutPatient = false;
} else if (!ohiInfo.medicareInPatientAdjudicationBean && ohiInfo.medicareOutPatientAdjudicationBean) {
ohiInfo.showMedicareInPatient = false;
ohiInfo.showMedicareOutPatient = true;
} else {
ohiInfo.showMedicareInPatient = false;
ohiInfo.showMedicareOutPatient = false;
}
} else {
if (ohiInfo.medicareInPatientAdjudicationBean && ohiInfo.medicareOutPatientAdjudicationBean) {
ohiInfo.showMedicareInPatient = false;
ohiInfo.showMedicareOutPatient = true;
} else if (ohiInfo.medicareInPatientAdjudicationBean && !ohiInfo.medicareOutPatientAdjudicationBean) {
ohiInfo.showMedicareInPatient = true;
ohiInfo.showMedicareOutPatient = false;
} else if (!ohiInfo.medicareInPatientAdjudicationBean && ohiInfo.medicareOutPatientAdjudicationBean) {
ohiInfo.showMedicareInPatient = false;
ohiInfo.showMedicareOutPatient = true;
} else {
ohiInfo.showMedicareInPatient = false;
ohiInfo.showMedicareOutPatient = false;
}
}
}



displayMedicareInpatientAdjudication() {
if (this.claimType === PROFESSIONAL) {
return false;
}

if (this.claimType === DENTAL) {
return false;
}

return true;
}

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

this.primaryOhiInfo = null;
this.secondaryOhiInfo = null;
this.tertiaryOhiInfo = null;

if (this.data) {
let claimOhiList = this.data['claimOhiList'];
if (claimOhiList === undefined || claimOhiList === null) {
claimOhiList = [];
}

for (let i = 0; i < claimOhiList.length; i++) {
const aClaimOhi = claimOhiList[i];
if (!aClaimOhi['claimOhiHeaderBean']) {
continue;
}
// Added to replace null with '---'
if (aClaimOhi['claimOhiHeaderBean']) {
for (const element of Object.keys(aClaimOhi['claimOhiHeaderBean'])) {
aClaimOhi['claimOhiHeaderBean'][element] = aClaimOhi[
'claimOhiHeaderBean'
][element]
? aClaimOhi['claimOhiHeaderBean'][element]
: '\u2013\u2013\u2013';
}
}
if (aClaimOhi['medicareInPatientAdjudicationBean']) {
for (const element of Object.keys(
aClaimOhi['medicareInPatientAdjudicationBean']
)) {
aClaimOhi['medicareInPatientAdjudicationBean'][element] = aClaimOhi[
'medicareInPatientAdjudicationBean'
][element]
? aClaimOhi['medicareInPatientAdjudicationBean'][element]
: '\u2013\u2013\u2013';
}
}
if (aClaimOhi['medicareOutPatientAdjudicationBean']) {
for (const element of Object.keys(
aClaimOhi['medicareOutPatientAdjudicationBean']
)) {
aClaimOhi['medicareOutPatientAdjudicationBean'][
element
] = aClaimOhi['medicareOutPatientAdjudicationBean'][element]
? aClaimOhi['medicareOutPatientAdjudicationBean'][element]
: '\u2013\u2013\u2013';
}
}

// end
const paymentSequenceIndicator =
aClaimOhi['claimOhiHeaderBean']['paymentSequenceIndicator'];
if (paymentSequenceIndicator === 'P') {
this.primaryOhiInfo = aClaimOhi;
this.displayMedicareType(this.primaryOhiInfo);
} else if (paymentSequenceIndicator === 'S') {
this.secondaryOhiInfo = aClaimOhi;
this.displayMedicareType(this.secondaryOhiInfo);
} else if (paymentSequenceIndicator === 'T') {
this.tertiaryOhiInfo = aClaimOhi;
this.displayMedicareType(this.tertiaryOhiInfo);
}
}
}

// The below line must not be removed or else you will get duplicates!
this.primaryClaimAdjustmentsTableInfoRows = [];

if (this.primaryOhiInfo) {
const primaryCobAmountsBean = this.primaryOhiInfo['cobAmountsBean'];
const primaryAllClaimAdjustmentsList = this.primaryOhiInfo[
'claimOhiAdjustmentsBean'
]['allClaimAdjustments'];

for (let i = 0; i < primaryAllClaimAdjustmentsList.length; i++) {
const aClaimAdjustment = primaryAllClaimAdjustmentsList[i];
let aOhiPaidAmount = '';

if (i === 0) {
aOhiPaidAmount = this.getDollarSignString(
primaryCobAmountsBean['cobPayerPaidAmount']
);
}
const aTotalNonCovered = this.getDollarSignString(
primaryCobAmountsBean['cobTotalNonCoveredAmount']
);
const aAdjustmentAmount = this.getDollarSignString(
aClaimAdjustment['adjustmentAmount']
);

const tableClaimAdjustmentRow = {
ohiPaidAmount: aOhiPaidAmount,
totalNonCovered: aTotalNonCovered,
quantity: aClaimAdjustment['quantity'],
adjustmentCode: aClaimAdjustment['adjustmentCode'],
adjustmentAmount: aAdjustmentAmount,
descriptionLong: aClaimAdjustment['descriptionLong']
};

this.primaryClaimAdjustmentsTableInfoRows.push(tableClaimAdjustmentRow);
}
}

// The below line must not be removed or else you will get duplicates!
this.secondaryClaimAdjustmentsTableInfoRows = [];

if (this.secondaryOhiInfo) {
const secondaryCobAmountsBean = this.secondaryOhiInfo['cobAmountsBean'];
const secondaryAllClaimAdjustmentsList = this.secondaryOhiInfo[
'claimOhiAdjustmentsBean'
]['allClaimAdjustments'];

for (let i = 0; i < secondaryAllClaimAdjustmentsList.length; i++) {
const aClaimAdjustment = secondaryAllClaimAdjustmentsList[i];

let aOhiPaidAmount = '';

if (i === 0) {
aOhiPaidAmount = this.getDollarSignString(
secondaryCobAmountsBean['cobPayerPaidAmount']
);
}
const aTotalNonCovered = this.getDollarSignString(
secondaryCobAmountsBean['cobTotalNonCoveredAmount']
);
const aAdjustmentAmount = this.getDollarSignString(
aClaimAdjustment['adjustmentAmount']
);

const tableClaimAdjustmentRow = {
ohiPaidAmount: aOhiPaidAmount,
totalNonCovered: aTotalNonCovered,
quantity: aClaimAdjustment['quantity'],
adjustmentCode: aClaimAdjustment['adjustmentCode'],
adjustmentAmount: aAdjustmentAmount,
descriptionLong: aClaimAdjustment['descriptionLong']
};

this.secondaryClaimAdjustmentsTableInfoRows.push(tableClaimAdjustmentRow);
}
}

// The below line must not be removed or else you will get duplicates!
this.tertiaryClaimAdjustmentsTableInfoRows = [];

if (this.tertiaryOhiInfo) {
const tertiaryCobAmountsBean = this.tertiaryOhiInfo['cobAmountsBean'];
const tertiaryAllClaimAdjustmentsList = this.tertiaryOhiInfo[
'claimOhiAdjustmentsBean'
]['allClaimAdjustments'];

for (let i = 0; i < tertiaryAllClaimAdjustmentsList.length; i++) {
const aClaimAdjustment = tertiaryAllClaimAdjustmentsList[i];

let aOhiPaidAmount = '';

if (i === 0) {
aOhiPaidAmount = this.getDollarSignString(
tertiaryCobAmountsBean['cobPayerPaidAmount']
);
}
const aTotalNonCovered = this.getDollarSignString(
tertiaryCobAmountsBean['cobTotalNonCoveredAmount']
);
const aAdjustmentAmount = this.getDollarSignString(
aClaimAdjustment['adjustmentAmount']
);

const tableClaimAdjustmentRow = {
ohiPaidAmount: aOhiPaidAmount,
totalNonCovered: aTotalNonCovered,
quantity: aClaimAdjustment['quantity'],
adjustmentCode: aClaimAdjustment['adjustmentCode'],
adjustmentAmount: aAdjustmentAmount,
descriptionLong: aClaimAdjustment['descriptionLong']
};

this.tertiaryClaimAdjustmentsTableInfoRows.push(tableClaimAdjustmentRow);
}
}
}
populateCompareData() {
this.compareOhiSrvcLineAdjInfo = undefined;
if (this.compareData && this.compareData['detailServiceLineOhiOutputRows']) {
this.compareOhiSrvcLineAdjInfo = this.compareData['detailServiceLineOhiOutputRows'];
}

this.comparePrimaryOhiInfo = null;
this.compareSecondaryOhiInfo = null;
this.compareTertiaryOhiInfo = null;

if (this.compareData) {
let compareClaimOhiList = this.compareData['claimOhiList'];
if (compareClaimOhiList === undefined || compareClaimOhiList === null) {
compareClaimOhiList = [];
}

for (let i = 0; i < compareClaimOhiList.length; i++) {
const aClaimOhi = compareClaimOhiList[i];
if (!aClaimOhi['claimOhiHeaderBean']) {
continue;
}
// Added to replace null with '---'
if (aClaimOhi['claimOhiHeaderBean']) {
for (const element of Object.keys(aClaimOhi['claimOhiHeaderBean'])) {
aClaimOhi['claimOhiHeaderBean'][element] = aClaimOhi[
'claimOhiHeaderBean'
][element]
? aClaimOhi['claimOhiHeaderBean'][element]
: '\u2013\u2013\u2013';
}
}
if (aClaimOhi['medicareInPatientAdjudicationBean']) {
for (const element of Object.keys(
aClaimOhi['medicareInPatientAdjudicationBean']
)) {
aClaimOhi['medicareInPatientAdjudicationBean'][element] = aClaimOhi[
'medicareInPatientAdjudicationBean'
][element]
? aClaimOhi['medicareInPatientAdjudicationBean'][element]
: '\u2013\u2013\u2013';
}
}
if (aClaimOhi['medicareOutPatientAdjudicationBean']) {
for (const element of Object.keys(
aClaimOhi['medicareOutPatientAdjudicationBean']
)) {
aClaimOhi['medicareOutPatientAdjudicationBean'][
element
] = aClaimOhi['medicareOutPatientAdjudicationBean'][element]
? aClaimOhi['medicareOutPatientAdjudicationBean'][element]
: '\u2013\u2013\u2013';
}
}

// end
const paymentSequenceIndicator =
aClaimOhi['claimOhiHeaderBean']['paymentSequenceIndicator'];
if (paymentSequenceIndicator === 'P') {
this.comparePrimaryOhiInfo = aClaimOhi;
} else if (paymentSequenceIndicator === 'S') {
this.compareSecondaryOhiInfo = aClaimOhi;
} else if (paymentSequenceIndicator === 'T') {
this.compareTertiaryOhiInfo = aClaimOhi;
}
}
}

// The below line must not be removed or else you will get duplicates!
this.comparePrimaryClaimAdjustmentsTableInfoRows = [];

if (this.comparePrimaryOhiInfo) {
const primaryCobAmountsBean = this.comparePrimaryOhiInfo['cobAmountsBean'];
const primaryAllClaimAdjustmentsList = this.comparePrimaryOhiInfo[
'claimOhiAdjustmentsBean'
]['allClaimAdjustments'];

for (let i = 0; i < primaryAllClaimAdjustmentsList.length; i++) {
const aClaimAdjustment = primaryAllClaimAdjustmentsList[i];

const aOhiPaidAmount = this.getDollarSignString(
primaryCobAmountsBean['cobPayerPaidAmount']
);
const aTotalNonCovered = this.getDollarSignString(
primaryCobAmountsBean['cobTotalNonCoveredAmount']
);
const aAdjustmentAmount = this.getDollarSignString(
aClaimAdjustment['adjustmentAmount']
);

const tableClaimAdjustmentRow = {
ohiPaidAmount: aOhiPaidAmount,
totalNonCovered: aTotalNonCovered,
quantity: aClaimAdjustment['quantity'],
adjustmentCode: aClaimAdjustment['adjustmentCode'],
adjustmentAmount: aAdjustmentAmount,
descriptionLong: aClaimAdjustment['descriptionLong']
};

this.comparePrimaryClaimAdjustmentsTableInfoRows.push(tableClaimAdjustmentRow);
}
}

// The below line must not be removed or else you will get duplicates!
this.compareSecondaryClaimAdjustmentsTableInfoRows = [];

if (this.compareSecondaryOhiInfo) {
const secondaryCobAmountsBean = this.compareSecondaryOhiInfo['cobAmountsBean'];
const secondaryAllClaimAdjustmentsList = this.compareSecondaryOhiInfo[
'claimOhiAdjustmentsBean'
]['allClaimAdjustments'];

for (let i = 0; i < secondaryAllClaimAdjustmentsList.length; i++) {
const aClaimAdjustment = secondaryAllClaimAdjustmentsList[i];

const aOhiPaidAmount = this.getDollarSignString(
secondaryCobAmountsBean['cobPayerPaidAmount']
);
const aTotalNonCovered = this.getDollarSignString(
secondaryCobAmountsBean['cobTotalNonCoveredAmount']
);
const aAdjustmentAmount = this.getDollarSignString(
aClaimAdjustment['adjustmentAmount']
);

const tableClaimAdjustmentRow = {
ohiPaidAmount: aOhiPaidAmount,
totalNonCovered: aTotalNonCovered,
quantity: aClaimAdjustment['quantity'],
adjustmentCode: aClaimAdjustment['adjustmentCode'],
adjustmentAmount: aAdjustmentAmount,
descriptionLong: aClaimAdjustment['descriptionLong']
};

this.compareSecondaryClaimAdjustmentsTableInfoRows.push(tableClaimAdjustmentRow);
}
}

// The below line must not be removed or else you will get duplicates!
this.compareTertiaryClaimAdjustmentsTableInfoRows = [];

if (this.compareTertiaryOhiInfo) {
const tertiaryCobAmountsBean = this.compareTertiaryOhiInfo['cobAmountsBean'];
const tertiaryAllClaimAdjustmentsList = this.compareTertiaryOhiInfo[
'claimOhiAdjustmentsBean'
]['allClaimAdjustments'];

for (let i = 0; i < tertiaryAllClaimAdjustmentsList.length; i++) {
const aClaimAdjustment = tertiaryAllClaimAdjustmentsList[i];

const aOhiPaidAmount = this.getDollarSignString(
tertiaryCobAmountsBean['cobPayerPaidAmount']
);
const aTotalNonCovered = this.getDollarSignString(
tertiaryCobAmountsBean['cobTotalNonCoveredAmount']
);
const aAdjustmentAmount = this.getDollarSignString(
aClaimAdjustment['adjustmentAmount']
);

const tableClaimAdjustmentRow = {
ohiPaidAmount: aOhiPaidAmount,
totalNonCovered: aTotalNonCovered,
quantity: aClaimAdjustment['quantity'],
adjustmentCode: aClaimAdjustment['adjustmentCode'],
adjustmentAmount: aAdjustmentAmount,
descriptionLong: aClaimAdjustment['descriptionLong']
};

this.compareTertiaryClaimAdjustmentsTableInfoRows.push(tableClaimAdjustmentRow);
}
}
}
}