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

@Component({
selector: 'app-billing-miscellaneous',
templateUrl: './billing-miscellaneous.component.html',
styleUrls: ['../../ewv-viewer/ewv-viewer.component.scss']
})
export class BillingMiscellaneousComponent
implements OnInit, OnChanges, OnDestroy {
@Input() data;
@Input() compareData;
@Input() accordionId;
@Input() claimType;
@Input() isRightSide: boolean;
@Input() isDetail: boolean;
@Input() isSplitView: boolean;
@ViewChild(AttachmentViewerComponent) attachmentViewerComponent;

attachmentList = [];
selectedAttachment;
tabbable: boolean;
selectedAttachmentId;
fileList: string[];
displayAttachmentViewer = false;

collapseState = true;

billingMiscellanousData;
compareBillingMiscellanousData;
diagnosisRelatedGroup = 'N/A';
compareDiagnosisRelatedGroup = 'N/A';

collapseStateSubscription: Subscription = new Subscription();
billingMisMsg = 'No Billing Miscellaneous Data Found';

typeOfBillingOrFrequencyLabelString = 'POS/Frequency:';

constructor(
private ewvViewerService: EwvViewerService,
private attachmentService: AttachmentViewerService
) {}

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

// method to get list of attachments.

// this.fetchAttachments();
this.populateData();
}
fetchAttachments() {
if (this.isRightSide) {
this.ewvViewerService.getAttachments2().subscribe(
value => {
this.attachmentList = value.pdiRelatedResponse;
},
error => {
console.log(error.error.errorCode);
});
} else {
this.ewvViewerService.getAttachments().subscribe(
value => {
this.attachmentList = value.pdiRelatedResponse;
},
error => {
console.log(error.error.errorCode);
});
}
}

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

populateData() {
try {
this.billingMiscellanousData = {...this.data.billingMiscellanous}; // copy reference
for (const element of Object.keys(this.billingMiscellanousData)) {
// replace if falsey: null, undefined or '', or 0 or false
this.billingMiscellanousData[element] = this.billingMiscellanousData[element] || '\u2013\u2013\u2013';
}
} catch (error) {}

try {
this.diagnosisRelatedGroup = this.data.healthCareInfo.healthCareDRGInformationBeanList[0].code || 'N/A';
} catch (error) {
this.diagnosisRelatedGroup = 'N/A';
}

if (this.claimType === 'INSTITUTIONAL') {
this.typeOfBillingOrFrequencyLabelString = 'POS/Frequency:';
}
}

populateCompareData() {
try {
this.compareBillingMiscellanousData = {...this.compareData.billingMiscellanous};
for (const element of Object.keys(this.compareBillingMiscellanousData)) {
this.compareBillingMiscellanousData[element] = this.compareBillingMiscellanousData[element] || '\u2013\u2013\u2013';
}
} catch (error) {}

try {
this.compareDiagnosisRelatedGroup = this.compareData.healthCareInfo.healthCareDRGInformationBeanList[0].code || 'N/A';
} catch (error) {
this.compareDiagnosisRelatedGroup = 'N/A';
}

if (this.claimType === 'INSTITUTIONAL') {
this.typeOfBillingOrFrequencyLabelString = 'POS/Frequency:';
}
}


// Method to display correct icon to end user.
getAttachmentIcon(attachmentList) {
let ext;
// if statement required for multipart attachments.
if (attachmentList.attachmentPath && attachmentList.attachmentPath.length > 1) {
// ext = attachmentList.attachmentPath.filter(attachment => attachment.endsWith('XML'))[0].split('.').pop();
ext = attachmentList.attachmentPath.filter(attachment =>
attachment.endsWith('XML')
);
if (ext.length > 0) {
ext = ext[0].split('.').pop();
} else {
ext = attachmentList.attachmentPath.filter(attachment =>
attachment.endsWith('xml')
);
if (ext.length > 0) {
ext = ext[0]
.split('.')
.pop()
.toUpperCase();
}
}
} else if (attachmentList.attachmentPath.length === 1) {
ext = attachmentList.attachmentPath[0]
.split('.')
.pop()
.toUpperCase();
}

switch (ext) {
case 'XML':
return './../../../assets/images/ic_XML_icon_24.svg';
case 'PDF':
return './../../../assets/images/ic_PDF_icon_24.svg';
case 'PNG':
return './../../../assets/images/ic_PNG_icon_24.svg';
case 'TIFF':
return './../../../assets/images/ic_TIFF_icon_24.svg';
case 'TIF':
return './../../../assets/images/ic_TIFF_icon_24.svg';
case 'TXT':
return './../../../assets/images/ic_TXT_icon_24.svg';
case 'DOC':
return './../../../assets/images/ic_DOC_icon_24.svg';
case 'DCM':
return './../../../assets/images/ic_DCM_icon_24.svg';
case 'JPG':
return './../../../assets/images/ic_JPG_icon_24.svg';
case 'GIF':
return './../../../assets/images/ic_GIF_icon_24.svg';
case 'RTF':
return './../../../assets/images/ic_RTF_icon_24.svg';
case 'HTML':
return './../../../assets/images/ic_HTML_icon_24.svg';
case 'BMP':
return './../../../assets/images/ic_BMP_icon_24.svg';
default:
return './../../../assets/images/ic_attachCount_blue_24.svg';
}
}

// method that sets the attachment vierwer with correct selectedAttachment && extension.
onDisplayAttachmentViewer(attachment) {
this.attachmentService.setAttachmentViewerState(true);
this.tabbable = false;
this.selectedAttachment = attachment.attachmentId;
this.displayAttachmentViewer = true;
}

onAttachmentViewerClose(attachmentOption) {
this.attachmentService.setAttachmentViewerState(false);
this.displayAttachmentViewer = attachmentOption.open;
}

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

}