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, OnInit, Input, OnDestroy, SimpleChanges, OnChanges } from '@angular/core';
import { EwvViewerService } from '../../ewv-viewer/ewv-viewer.service';
import { Subscription } from 'rxjs/Subscription';
import { TableColumnModel } from '../../../shared/table';

@Component({
selector: 'app-service-line',
templateUrl: './service-lines.component.html',
styleUrls: [
'../../ewv-viewer/ewv-viewer.component.scss',
'../../../shared/table/table.component.scss'
]
})
export class ServiceLinesComponent implements OnChanges, AfterViewInit, OnDestroy {
@Input() data;
@Input() compareData;
@Input() isSplitView: boolean;
@Input() claimType;
@Input() accordionId;
@Input() isDetail: boolean;

collapseState = true;
collapseStateSubscription: Subscription = new Subscription();
serviceLinMsg = 'No Service Line Data Found';
tableColumns: TableColumnModel[] = [];
compareTableColumns: TableColumnModel[] = [];
serviceLinesTableColumns: TableColumnModel[] = [];
sameLineNumberArray = [];
differentLineNumberArray = [];

dentalTableColumns = [
new TableColumnModel('Line # ', 'lineNumber'),
new TableColumnModel('Date of Service ', 'dateOfService'),
new TableColumnModel('POS ', 'pos'),
new TableColumnModel('Tooth ', 'toothNumber'),
new TableColumnModel('S1 ', 'surface1'),
new TableColumnModel('S2 ', 'surface2'),
new TableColumnModel('S3 ', 'surface3'),
new TableColumnModel('S4 ', 'surface4'),
new TableColumnModel('S5 ', 'surface5'),
new TableColumnModel('DX Pointer ', 'dxDtPointers'),
// new TableColumnModel('Rev. ', 'revCode'),
new TableColumnModel('PROC/NDC ', 'procedureCode'),
new TableColumnModel('Modifiers ', 'modifiers'),
new TableColumnModel('Qty. / Type ', 'quantityOrType'),
new TableColumnModel('Sales Tax ', 'salesTax'),
new TableColumnModel('Amount ', 'charge')
];

professionalTableColumns = [
new TableColumnModel('Line # ', 'lineNumber'),
new TableColumnModel('Service From ', 'beginDateOfService'),
new TableColumnModel('Service To ', 'endDateOfService'),
new TableColumnModel('POS ', 'pos'),
new TableColumnModel('DX Pointer ', 'dxDtPointers'),
new TableColumnModel('PROC/NDC ', 'procedureCode'),
new TableColumnModel('Modifiers ', 'modifiers'),
new TableColumnModel('Qty. / Type ', 'quantityOrType'),
new TableColumnModel('Sales Tax ', 'salesTax'),
new TableColumnModel('Fac. Tax ', 'facilityTax'),
new TableColumnModel('Amount ', 'charge')
];

institutionalTableColumns = [
new TableColumnModel('Line # ', 'lineNumber'),
new TableColumnModel('Service From ', 'beginDateOfService'),
new TableColumnModel('Service To ', 'endDateOfService'),
new TableColumnModel('REV ', 'revCode'),
new TableColumnModel('PROC/NDC ', 'procedureCode'),
new TableColumnModel('MOD', 'modifiers'),
new TableColumnModel('Qty.', 'quantity'),
new TableColumnModel('Type', 'type'),
new TableColumnModel('Service Tax ', 'serviceTax'),
new TableColumnModel('Fac. Tax ', 'facilityTax'),
new TableColumnModel('Amount ', 'charge')
];

// highlighting
componentId = 0;
@Input() detail: boolean;
@Input() isRightSide: boolean;

billingMiscellanous;
tableInfoRows = [];
compareTableInfoRows = [];
serviceLinesInfoArray;
loading = false;

constructor(private ewvService: EwvViewerService) {}

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

ngOnChanges(changes: SimpleChanges): void {
if (changes.data && changes.data.currentValue) {
// this.data = changes.data.currentValue;
this.populateData();
}
if (changes.compareData && changes.compareData.currentValue) {
this.compareData = changes.compareData.currentValue;
this.comparePopulateData();
this.tableColumns.length > this.compareTableColumns.length ?
this.serviceLinesTableColumns = this.tableColumns :
this.serviceLinesTableColumns = this.compareTableColumns;
}
}

displayOperatorPhysicianNameAndNpiInformation(row) {
if (!row) {
return false;
}

if (row['operatorPhysicianNpi']) {
return true;
}

if (row['operatorPhysicianName']) {
return true;
}

return false;
}

populateData() {
// leave below line or else you get twice as many rows that you are supposed to display
this.tableInfoRows = [];
this.tableColumns = [];
this.serviceLinesInfoArray = null;

this.billingMiscellanous = this.data['billingMiscellanous'];

if (this.claimType === 'DENTAL') {
this.tableColumns = this.dentalTableColumns;

this.serviceLinesInfoArray = this.data['serviceLinesInfo'];
if (
this.serviceLinesInfoArray === undefined ||
this.serviceLinesInfoArray === null
) {
this.serviceLinesInfoArray = [];
}
for (let i = 0; i < this.serviceLinesInfoArray.length; i++) {
const aServiceLineInfo = this.serviceLinesInfoArray[i];
let listOfTeethArray = aServiceLineInfo.listOfTeeth;
if (listOfTeethArray === undefined || listOfTeethArray === null) {
listOfTeethArray = [];
}
if (listOfTeethArray.length) {
for (let j = 0; j < listOfTeethArray.length; j++) {
const tooth = listOfTeethArray[j];
const rowServiceLine = {
lineNumber: aServiceLineInfo.lineNumber,
dateOfService: aServiceLineInfo.dateOfService,
pos: aServiceLineInfo.pos,
toothNumber: tooth.toothNumber,
surface1: tooth.surface1,
surface2: tooth.surface2,
surface3: tooth.surface3,
surface4: tooth.surface4,
surface5: tooth.surface5,
dxDtPointers: aServiceLineInfo.dxDtPointers,
// revCode: aServiceLineInfo.revCode,
procedureCode: aServiceLineInfo.procedureCode,
modifiers: aServiceLineInfo.modifiers,
quantityOrType: aServiceLineInfo.quantityOrType,
salesTax: aServiceLineInfo.salesTax,
// charge: this.regx(aServiceLineInfo.charge)
charge: aServiceLineInfo.charge
};

if (!rowServiceLine['pos']) {
rowServiceLine['pos'] = this.billingMiscellanous['placeOfService'];
}

this.tableInfoRows.push(rowServiceLine);
}
} else {
if (aServiceLineInfo['pos'] !== undefined && !aServiceLineInfo['pos']) {
aServiceLineInfo['pos'] = this.billingMiscellanous['placeOfService'];
}

if (aServiceLineInfo.charge !== undefined) {
// aServiceLineInfo.charge = this.regx(aServiceLineInfo.charge);
aServiceLineInfo.charge = aServiceLineInfo.charge;
}

this.tableInfoRows.push(aServiceLineInfo);
}
}
}

if (this.claimType === 'PROFESSIONAL') {
this.tableColumns = this.professionalTableColumns;

let tempData = this.data['serviceLinesInfo'];
if (tempData === undefined || tempData === null) {
tempData = [];
}
for (let i = 0; i < tempData.length; i++) {
const temp = tempData[i];
const tableData = {
lineNumber: temp.lineNumber,
beginDateOfService: temp.beginDateOfService,
endDateOfService: temp.endDateOfService,
pos: temp.pos,
dxDtPointers: temp.dxDtPointers,
procedureCode: temp.procedureCode,
modifiers: temp.modifiers,
quantityOrType: temp.quantityOrType,
salesTax: temp.salesTax,
facilityTax: temp.facilityTax,
// charge: this.regx(temp.charge),
charge: temp.charge,
listOfDrugLines: this.getDisplayInfoForListOfDrugLines(
temp.listOfDrugLines
),
listOfProviderInfo: temp.listOfProviderInfo
};

if (!tableData['pos']) {
tableData['pos'] = this.billingMiscellanous['placeOfService'];
}

this.tableInfoRows.push(tableData);
}
}

if (this.data && this.claimType === 'INSTITUTIONAL') {
this.tableColumns = this.institutionalTableColumns;

let tempData = this.data['serviceLinesInfo'];
if (tempData === undefined || tempData === null) {
tempData = [];
}
for (let i = 0; i < tempData.length; i++) {
const temp = tempData[i];
const tableData = {
lineNumber: temp.lineNumber,
beginDateOfService: temp.beginDateOfService,
endDateOfService: temp.endDateOfService,
revCode: temp.revCode,
procedureCode: temp.procedureCode,
modifiers: temp.modifiers,
quantity: temp.quantity,
type: temp.type,
serviceTax: temp.serviceTax,
facilityTax: temp.facilityTax,
// charge: this.regx(temp.charge),
charge: temp.charge,
listOfDrugLines: this.getDisplayInfoForListOfDrugLines(
temp.listOfDrugLines
),
operatorPhysicianName: temp.operatorPhysicianName,
operatorPhysicianNpi: temp.operatorPhysicianNpi,
listOfProviderInfo: temp.listOfProviderInfo
};
this.tableInfoRows.push(tableData);
}
}
}

comparePopulateData() {
// leave below line or else you get twice as many rows that you are supposed to display
this.compareTableInfoRows = [];
this.compareTableColumns = [];
this.serviceLinesInfoArray = null;

this.billingMiscellanous = this.compareData['billingMiscellanous'];

if (this.claimType === 'DENTAL') {
this.compareTableColumns = this.dentalTableColumns;

this.serviceLinesInfoArray = this.compareData['serviceLinesInfo'];
if (
this.serviceLinesInfoArray === undefined ||
this.serviceLinesInfoArray === null
) {
this.serviceLinesInfoArray = [];
}
for (let i = 0; i < this.serviceLinesInfoArray.length; i++) {
const aServiceLineInfo = this.serviceLinesInfoArray[i];
let listOfTeethArray = aServiceLineInfo.listOfTeeth;
if (listOfTeethArray === undefined || listOfTeethArray === null) {
listOfTeethArray = [];
}
if (listOfTeethArray.length) {
for (let j = 0; j < listOfTeethArray.length; j++) {
const tooth = listOfTeethArray[j];
const rowServiceLine = {
lineNumber: aServiceLineInfo.lineNumber,
dateOfService: aServiceLineInfo.dateOfService,
pos: aServiceLineInfo.pos,
toothNumber: tooth.toothNumber,
surface1: tooth.surface1,
surface2: tooth.surface2,
surface3: tooth.surface3,
surface4: tooth.surface4,
surface5: tooth.surface5,
dxDtPointers: aServiceLineInfo.dxDtPointers,
// revCode: aServiceLineInfo.revCode,
procedureCode: aServiceLineInfo.procedureCode,
modifiers: aServiceLineInfo.modifiers,
quantityOrType: aServiceLineInfo.quantityOrType,
salesTax: aServiceLineInfo.salesTax,
// charge: this.regx(aServiceLineInfo.charge)
charge: aServiceLineInfo.charge
};

if (!rowServiceLine['pos']) {
rowServiceLine['pos'] = this.billingMiscellanous['placeOfService'];
}

this.compareTableInfoRows.push(rowServiceLine);
}
} else {
if (aServiceLineInfo['pos'] !== undefined && !aServiceLineInfo['pos']) {
aServiceLineInfo['pos'] = this.billingMiscellanous['placeOfService'];
}

if (aServiceLineInfo.charge !== undefined) {
// aServiceLineInfo.charge = this.regx(aServiceLineInfo.charge);
aServiceLineInfo.charge = aServiceLineInfo.charge;
}

this.compareTableInfoRows.push(aServiceLineInfo);
}
}
}

if (this.claimType === 'PROFESSIONAL') {
this.compareTableColumns = this.professionalTableColumns;

let tempData = this.compareData['serviceLinesInfo'];
if (tempData === undefined || tempData === null) {
tempData = [];
}
for (let i = 0; i < tempData.length; i++) {
const temp = tempData[i];
const tableData = {
lineNumber: temp.lineNumber,
beginDateOfService: temp.beginDateOfService,
endDateOfService: temp.endDateOfService,
pos: temp.pos,
dxDtPointers: temp.dxDtPointers,
procedureCode: temp.procedureCode,
modifiers: temp.modifiers,
quantityOrType: temp.quantityOrType,
salesTax: temp.salesTax,
facilityTax: temp.facilityTax,
// charge: this.regx(temp.charge),
charge: temp.charge,
listOfDrugLines: this.getDisplayInfoForListOfDrugLines(
temp.listOfDrugLines
),
listOfProviderInfo: temp.listOfProviderInfo
};

if (!tableData['pos']) {
tableData['pos'] = this.billingMiscellanous['placeOfService'];
}

this.compareTableInfoRows.push(tableData);
}
}

if (this.compareData && this.claimType === 'INSTITUTIONAL') {
this.compareTableColumns = this.institutionalTableColumns;

let tempData = this.compareData['serviceLinesInfo'];
if (tempData === undefined || tempData === null) {
tempData = [];
}
for (let i = 0; i < tempData.length; i++) {
const temp = tempData[i];
const tableData = {
lineNumber: temp.lineNumber,
beginDateOfService: temp.beginDateOfService,
endDateOfService: temp.endDateOfService,
revCode: temp.revCode,
procedureCode: temp.procedureCode,
modifiers: temp.modifiers,
quantity: temp.quantity,
type: temp.type,
serviceTax: temp.serviceTax,
facilityTax: temp.facilityTax,
// charge: this.regx(temp.charge),
charge: temp.charge,
listOfDrugLines: this.getDisplayInfoForListOfDrugLines(
temp.listOfDrugLines
),
operatorPhysicianName: temp.operatorPhysicianName,
operatorPhysicianNpi: temp.operatorPhysicianNpi,
listOfProviderInfo: temp.listOfProviderInfo
};

this.compareTableInfoRows.push(tableData);
}
}
}


getDisplayInfoForListOfDrugLines(listOfDrugLines) {
let listOfDrugLinesArray = listOfDrugLines;
if (listOfDrugLinesArray === undefined || listOfDrugLinesArray === null) {
listOfDrugLinesArray = [];
}

const displayInforForListOfDrugLines = [];
for (let i = 0; i < listOfDrugLinesArray.length; i++) {
const aDrugLine = listOfDrugLinesArray[i];

// let drugRxValue = 'DRUG RX';
let drugRxValue = '';
if (aDrugLine.drugCategory_5010) {
drugRxValue += ' (' + aDrugLine.drugCategory_5010 + ')';
}

// drugRxValue += ':';
if (aDrugLine.drugRx) {
drugRxValue += ' ' + aDrugLine.drugRx;
}

let amountValue = '';
if (aDrugLine.drugRxCharge || aDrugLine.drugRxType) {
amountValue += '(';

if (aDrugLine.drugRxCharge) {
amountValue += '$' + aDrugLine.drugRxCharge;
}

amountValue += '/';

if (aDrugLine.drugRxType) {
amountValue += aDrugLine.drugRxType;
}

amountValue += ')';
}

const aDrugLineForSeviceLine = {
drugRx: drugRxValue,
drugRxNdcCode: aDrugLine.drugRxNdcCode ? aDrugLine.drugRxNdcCode : '',
drugRxQuantity: aDrugLine.drugRxQuantity
? aDrugLine.drugRxQuantity
: '',
drugRxType: aDrugLine.drugRxType ? aDrugLine.drugRxType : '',
drugRxQuantityPlusType: aDrugLine.drugRxQuantityPlusType
? aDrugLine.drugRxQuantityPlusType
: '',
amount: amountValue
};

displayInforForListOfDrugLines.push(aDrugLineForSeviceLine);
}

return displayInforForListOfDrugLines;
}

regx(Property) {
if (Property) {
Property = Property.trim();
} else {
Property = '';
}

if (Property.length === 0) {
return Property;
}

const reg = /^\${1}[0-9].*/;
if (reg.test(Property) === false) {
return (Property = `$${Property}`);
} else {
return Property;
}
}

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