UNPKG

acr-assist-simulator-module

Version:

This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 1.7.4.

900 lines (899 loc) 150 kB
/** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ import { Component, Input, Output, EventEmitter } from '@angular/core'; import { SimulatorEngineService } from '../../core/services/simulator-engine.service'; import { InputData } from '../../core/models/input-data.model'; import { SimulatorCommunicationService } from '../shared/services/simulator-communication.service'; const /** @type {?} */ $ = require('jquery'); export class AssistDataElementComponent { /** * @param {?} simulatorEngineService * @param {?} simulatorCommunicationService */ constructor(simulatorEngineService, simulatorCommunicationService) { this.simulatorEngineService = simulatorEngineService; this.simulatorCommunicationService = simulatorCommunicationService; this.Endpoints = []; this.returnReportText = new EventEmitter(); this.returnExecutionHistory = new EventEmitter(); this.returnDataElementChanged = new EventEmitter(); this.inputValues = []; this.comparisonValues = []; this.selectedChoiceValues = []; this.executedResultIds = []; this.executedResultHistories = []; } /** * @return {?} */ ngOnInit() { this.simulatorEngineService.simulatorStateChanged.subscribe((message) => { this.simulatorState = /** @type {?} */ (message); this.dataElementValues = this.simulatorEngineService.getAllDataElementValues(); const /** @type {?} */ nonRelevantIDs = this.simulatorEngineService.evaluateDecisionAndConditionalProperty(); for (const /** @type {?} */ dataElement of this.dataElements) { if (nonRelevantIDs && nonRelevantIDs.length > 0) { if (nonRelevantIDs.indexOf(dataElement.id) >= 0) { dataElement.isVisible = false; } else { dataElement.isVisible = true; } } else { dataElement.isVisible = true; } if (this.dataElementValues[dataElement.id] !== undefined && dataElement.currentValue !== this.dataElementValues[dataElement.id]) { dataElement.currentValue = this.dataElementValues[dataElement.id]; } dataElement.currentValue = (dataElement.currentValue !== undefined) ? dataElement.currentValue : this.dataElementValues[dataElement.id]; } this.dataElements = this.dataElements.filter(x => x.displaySequence != null).sort(function (DE_1, DE_2) { return DE_1.displaySequence - DE_2.displaySequence; }); if (this.simulatorState.endPointId && this.simulatorState.endPointId.length > 0) { this.generateReportText(this.simulatorState.endPointId); } else { this.returnReportText.emit(undefined); } this.simulatorCommunicationService.messageEmitter(''); }); } /** * @param {?} changes * @return {?} */ ngOnChanges(changes) { this.dataElements = this.dataElements.filter(x => x.displaySequence != null).sort(function (DE_1, DE_2) { return DE_1.displaySequence - DE_2.displaySequence; }); this.executedResultIds = []; } /** * @param {?} $event * @return {?} */ choiceSelected($event) { if ($event !== undefined) { if ($event.receivedElement !== undefined && $event.selectedCondition !== undefined) { this.selectedChoiceValues[$event.receivedElement.elementId + 'SelectedValue'] = $event.receivedElement.selectedText; this.simulatorEngineService.addOrUpdateDataElement($event.receivedElement.elementId, $event.receivedElement.selectedValue, $event.receivedElement.selectedText); const /** @type {?} */ executedResults = []; executedResults[$event.selectedCondition.selectedCondition] = $event.selectedCondition.selectedValue; this.executedResultIds[$event.selectedCondition.selectedConditionId] = executedResults; if (this.simulatorState.endPointId && this.simulatorState.endPointId.length > 0) { this.generateExecutionHistory(); } this.afterDataElementChanged(); } } else { this.afterDataElementChanged(); } } /** * @param {?} $event * @return {?} */ numericSelected($event) { if ($event !== undefined) { if ($event.receivedElement !== undefined && $event.selectedCondition !== undefined) { this.simulatorEngineService.addOrUpdateDataElement($event.receivedElement.elementId, $event.receivedElement.selectedValue, $event.receivedElement.selectedValue); const /** @type {?} */ executedResults = []; executedResults[$event.selectedCondition.selectedCondition] = $event.selectedCondition.selectedValue; this.executedResultIds[$event.selectedCondition.selectedConditionId] = executedResults; if (this.simulatorState.endPointId && this.simulatorState.endPointId.length > 0) { this.generateExecutionHistory(); } this.afterDataElementChanged(); } } else { this.afterDataElementChanged(); } } /** * @param {?} $event * @return {?} */ multiSelected($event) { if ($event !== undefined) { if ($event.receivedElement !== undefined && $event.selectedCondition !== undefined) { this.comparisonValues[$event.receivedElement.elementId + 'ComparisonValue'] = $event.receivedElement.selectedComparisonValues; this.simulatorEngineService.addOrUpdateDataElement($event.receivedElement.elementId, $event.receivedElement.selectedComparisonValues, $event.receivedElement.selectedValues); const /** @type {?} */ executedResults = []; executedResults[$event.selectedCondition.selectedCondition] = $event.selectedCondition.selectedValue; this.executedResultIds[$event.selectedCondition.selectedConditionId] = executedResults; if (this.simulatorState.endPointId && this.simulatorState.endPointId.length > 0) { this.generateExecutionHistory(); } this.afterDataElementChanged(); } } else { this.afterDataElementChanged(); } } /** * @param {?} endpointId * @return {?} */ generateReportText(endpointId) { const /** @type {?} */ endpointContent = this.returnEndPointContents(this.xmlContent, '<EndPoint Id="' + endpointId + '">', '</EndPoint>'); this.parseXml(endpointId, endpointContent); } /** * @return {?} */ afterDataElementChanged() { const /** @type {?} */ deValues = []; for (const /** @type {?} */ de of this.dataElements) { if (de.isVisible && de.dataElementType !== 'ComputedDataElement' && de.dataElementType !== 'GlobalValue') { const /** @type {?} */ inputData = new InputData(); inputData.dataElementId = de.id; inputData.dataElementLabel = de.label; inputData.dataElementValue = de.currentValue; if (de.currentValue === undefined || de.currentValue === '') { inputData.dataElementDisplayValue = undefined; } else { if (de.dataElementType === 'ChoiceDataElement') { const /** @type {?} */ choices = (/** @type {?} */ (de)).choiceInfo; inputData.dataElementDisplayValue = choices.filter(ch => ch.value === de.currentValue)[0].label; } else if (de.dataElementType === 'MultiChoiceDataElement') { const /** @type {?} */ choices = (/** @type {?} */ (de)).choiceInfo; inputData.dataElementDisplayValue = []; choices.forEach(choice => { if (Array.isArray(de.currentValue)) { de.currentValue.forEach(element => { if (choice.value === element) { inputData.dataElementDisplayValue.push(choice.label); } }); } else { if (choice.value === de.currentValue) { inputData.dataElementDisplayValue.push(choice.label); } } }); } else { inputData.dataElementDisplayValue = de.currentValue; } } deValues.push(inputData); } } this.returnDataElementChanged.emit(deValues); } /** * @return {?} */ generateExecutionHistory() { this.executedResultHistories = []; let /** @type {?} */ isNonRelevant; isNonRelevant = false; // tslint:disable-next-line:forin for (const /** @type {?} */ resultId in this.executedResultIds) { for (const /** @type {?} */ nonRelevantDataElement of this.simulatorState.nonRelevantDataElementIds) { if (nonRelevantDataElement === resultId) { isNonRelevant = true; break; } else { isNonRelevant = false; } } if (!isNonRelevant) { // tslint:disable-next-line:forin for (const /** @type {?} */ label in this.executedResultIds[resultId]) { const /** @type {?} */ executedResultHistory = new ExecutedResultHistory(); executedResultHistory.resultCondition = label; executedResultHistory.resultValue = this.executedResultIds[resultId][label]; this.executedResultHistories.push(executedResultHistory); } } } const /** @type {?} */ finalExecution = new FinalExecutedHistory(); if (this.executedResultHistories.length > 0) { finalExecution.executionHistories = this.executedResultHistories; finalExecution.resultText = this.mainReportTextObj; finalExecution.inputData = []; for (const /** @type {?} */ de of this.dataElements) { if (de.isVisible && de.dataElementType !== 'ComputedDataElement' && de.dataElementType !== 'GlobalValue') { const /** @type {?} */ inputData = new InputData(); inputData.dataElementId = de.id; inputData.dataElementValue = de.currentValue; finalExecution.inputData.push(inputData); } } } this.returnExecutionHistory.emit(finalExecution); } /** * @param {?} content * @param {?} startToken * @param {?} endToken * @return {?} */ returnEndPointContents(content, startToken, endToken) { let /** @type {?} */ contents; let /** @type {?} */ templateSearchIndexPosition = 0; while (true) { const /** @type {?} */ contentStartPosition = content.indexOf(startToken, templateSearchIndexPosition); const /** @type {?} */ contentEndPosition = content.indexOf(endToken, templateSearchIndexPosition); if (contentStartPosition >= 0 && contentEndPosition >= 0) { const /** @type {?} */ endPosition = contentEndPosition + endToken.length; const /** @type {?} */ contentData = content.substring(contentStartPosition, endPosition); contents = contentData; templateSearchIndexPosition = endPosition + 1; } else { break; } } return contents; } /** * @param {?} xmlData * @return {?} */ parseToJson(xmlData) { let /** @type {?} */ jsonResult; const /** @type {?} */ parseString = require('xml2js').parseString; parseString(xmlData, { explicitRoot: false, explicitArray: false, attrkey: 'Attr' }, function (err, result) { jsonResult = result; }); return jsonResult; } /** * @param {?} endPointId * @param {?} endpointContent * @return {?} */ parseXml(endPointId, endpointContent) { const /** @type {?} */ templateIds = []; let /** @type {?} */ canInsertText; let /** @type {?} */ isSectionIf; let /** @type {?} */ selectedElements; let /** @type {?} */ executeSectionIfNot; let /** @type {?} */ hasSectionNot; let /** @type {?} */ insertValue; let /** @type {?} */ executeTemplate; let /** @type {?} */ isImpression; let /** @type {?} */ isNewTemplate; let /** @type {?} */ hasInsertPartial; let /** @type {?} */ isMainText; const /** @type {?} */ allReportText = []; const /** @type {?} */ endpoints = this.Endpoints; let /** @type {?} */ templatePartialsText; let /** @type {?} */ selectedComparisonValues; let /** @type {?} */ findingsText; let /** @type {?} */ impressionText; let /** @type {?} */ selectedSection; let /** @type {?} */ selectedChoiceTexts; let /** @type {?} */ textExpressionValue; selectedElements = this.simulatorEngineService.getAllDataElementValues(); templatePartialsText = this.templatePartial; selectedComparisonValues = this.comparisonValues; selectedChoiceTexts = this.simulatorEngineService.getAllDataElementTexts(); executeSectionIfNot = false; hasInsertPartial = false; endpointContent = endpointContent.replace(/\n/g, '&#10;'); endpointContent = endpointContent.replace(/\t/g, '&emsp;'); // endpointContent = endpointContent.replace(/\s/g, ' &nbsp; '); // tslint:disable-next-line:forin for (const /** @type {?} */ i in templatePartialsText) { templatePartialsText[i] = templatePartialsText[i].replace(/\n/g, '&#10;'); templatePartialsText[i] = templatePartialsText[i].replace(/\t/g, '&emsp;'); // templatePartialsText[i] = templatePartialsText[i].replace(/\s+/g, ' &nbsp; '); } findingsText = ''; impressionText = ''; let /** @type {?} */ isReportText; let /** @type {?} */ reportTextContent = ''; const /** @type {?} */ endpointSax = require('sax'), /** @type {?} */ strict = true, /** @type {?} */ normalize = true, /** @type {?} */ // set to false for html-mode trim = true, /** @type {?} */ reportTextParser = endpointSax.parser(strict, trim); reportTextParser.onerror = function (e) { // an error happened. reportTextParser.resume(); }; reportTextParser.ontext = function (t) { debugger; // if (t.length > 1) { // t = t.trim(); // } let /** @type {?} */ isTextInserted; isTextInserted = false; if (executeTemplate) { if (!isImpression) { if (canInsertText && hasSectionNot && hasSectionNot !== undefined && executeSectionIfNot) { findingsText = findingsText + t; } else if (canInsertText && isNewTemplate && hasInsertPartial && !isSectionIf) { findingsText = findingsText + t; } else if (canInsertText && !isImpression) { findingsText = findingsText + t; } } else { if (canInsertText && hasSectionNot && hasSectionNot !== undefined && executeSectionIfNot) { impressionText = impressionText + t; } else if (canInsertText && !hasSectionNot && isImpression) { impressionText = impressionText + t; } else if (canInsertText && isNewTemplate) { impressionText = impressionText + t; } } if (isReportText && !isTextInserted && isMainText && canInsertText) { reportTextContent = reportTextContent + t; } } }; reportTextParser.onopentag = function (node) { switch (node.name) { case 'Label': canInsertText = false; isReportText = false; isMainText = false; break; case 'ReportText': if (executeTemplate) { isReportText = true; canInsertText = true; selectedSection = node.attributes.SectionId; impressionText = ''; if (node.attributes.SectionId === 'findings' && executeTemplate) { isImpression = false; } else if (node.attributes.SectionId === 'impression' && executeTemplate) { isImpression = true; } } isSectionIf = false; // isMainText = true; break; case 'InsertPartial': if (executeTemplate) { generatePartialView(node.attributes.PartialId, isImpression); executeTemplate = true; canInsertText = true; if (isReportText) { hasInsertPartial = true; } else { hasInsertPartial = false; } } else { canInsertText = false; } isReportText = false; isMainText = false; break; case 'SectionIfValueNot': if (executeTemplate) { if (Array.isArray(selectedElements[node.attributes.DataElementId])) { for (const /** @type {?} */ comaprisonValue of selectedElements[node.attributes.DataElementId]) { if (comaprisonValue !== node.attributes.ComparisonValue && comaprisonValue !== undefined && !isSectionIf) { canInsertText = true; executeSectionIfNot = true; break; } else { canInsertText = false; executeSectionIfNot = false; } } } else if (selectedElements[node.attributes.DataElementId] !== node.attributes.ComparisonValue && selectedElements[node.attributes.DataElementId] !== '--Select--' && selectedElements[node.attributes.DataElementId] !== undefined && selectedElements[node.attributes.DataElementId] !== null) { canInsertText = true; executeSectionIfNot = true; } else { canInsertText = false; executeSectionIfNot = false; } } hasSectionNot = true; isMainText = false; break; case 'SectionIf': if (selectedElements[node.attributes.DataElementId] !== undefined && selectedElements[node.attributes.DataElementId].length > 0 && selectedChoiceTexts[node.attributes.DataElementId] !== 'Other, please specify…') { isSectionIf = true; canInsertText = true; } else { isSectionIf = false; canInsertText = false; } break; case 'SectionIfValue': if (executeTemplate) { if (executeTemplate) { if (Array.isArray(selectedElements[node.attributes.DataElementId])) { for (const /** @type {?} */ comaprisonValue of selectedElements[node.attributes.DataElementId]) { if (comaprisonValue === node.attributes.ComparisonValue && comaprisonValue !== undefined) { isSectionIf = true; if (selectedElements[node.attributes.DataElementId] !== undefined && !isSectionIf && selectedChoiceTexts[node.attributes.DataElementId] !== 'Other, please specify…') { findingsText = findingsText + selectedChoiceTexts[node.attributes.DataElementId]; } canInsertText = true; break; } else { isSectionIf = false; canInsertText = false; } } } else if (selectedElements[node.attributes.DataElementId] === node.attributes.ComparisonValue && selectedElements[node.attributes.DataElementId] !== undefined) { isSectionIf = true; if (selectedElements[node.attributes.DataElementId] !== undefined && !isSectionIf && selectedChoiceTexts[node.attributes.DataElementId] !== 'Other, please specify…') { findingsText = findingsText + selectedChoiceTexts[node.attributes.DataElementId]; } canInsertText = true; } else { canInsertText = false; } } break; } isMainText = false; break; case 'InsertValue': if (executeTemplate) { isReportText = false; insertValue = true; const /** @type {?} */ choiceText = selectedChoiceTexts[node.attributes.DataElementId]; if (node.attributes.Id === 'findings' || canInsertText) { if (selectedElements[node.attributes.DataElementId] !== undefined && hasSectionNot && executeSectionIfNot) { if (isImpression) { if (selectedChoiceTexts[node.attributes.DataElementId] !== undefined && selectedChoiceTexts[node.attributes.DataElementId] !== 'Other, please specify…') { impressionText = impressionText + (Array.isArray(choiceText) ? choiceText.join(', ') : choiceText); } else { getTextExpressionValue(selectedElements[node.attributes.DataElementId]); impressionText = impressionText + (Array.isArray(selectedElements[node.attributes.DataElementId]) ? selectedElements[node.attributes.DataElementId].join(', ') : textExpressionValue); } } else { if (selectedChoiceTexts[node.attributes.DataElementId] !== undefined && selectedChoiceTexts[node.attributes.DataElementId] !== 'Other, please specify…') { findingsText = findingsText + (Array.isArray(choiceText) ? choiceText.join(', ') : choiceText); } else { getTextExpressionValue(selectedElements[node.attributes.DataElementId]); findingsText = findingsText + (Array.isArray(selectedElements[node.attributes.DataElementId]) ? selectedElements[node.attributes.DataElementId].join(', ') : textExpressionValue); } } } else if (selectedElements[node.attributes.DataElementId] !== undefined && !hasSectionNot) { if (isImpression) { if (selectedChoiceTexts[node.attributes.DataElementId] !== undefined && selectedChoiceTexts[node.attributes.DataElementId] !== 'Other, please specify…') { impressionText = impressionText + (Array.isArray(choiceText) ? choiceText.join(', ') : choiceText); } else { getTextExpressionValue(selectedElements[node.attributes.DataElementId]); impressionText = impressionText + (Array.isArray(selectedElements[node.attributes.DataElementId]) ? selectedElements[node.attributes.DataElementId].join(', ') : textExpressionValue); } } else { if (selectedChoiceTexts[node.attributes.DataElementId] !== undefined && selectedChoiceTexts[node.attributes.DataElementId] !== 'Other, please specify…') { findingsText = findingsText + (Array.isArray(choiceText) ? choiceText.join(', ') : choiceText); } else { getTextExpressionValue(selectedElements[node.attributes.DataElementId]); findingsText = findingsText + (Array.isArray(selectedElements[node.attributes.DataElementId]) ? selectedElements[node.attributes.DataElementId].join(', ') : textExpressionValue); } } } if (isImpression) { canInsertText = true; } } isMainText = false; break; } } executeTemplate = true; isNewTemplate = true; }; reportTextParser.onclosetag = function (node) { switch (node) { case 'SectionIfValueNot': executeSectionIfNot = false; hasSectionNot = false; if (isSectionIf) { canInsertText = true; } break; case 'TemplatePartial': isNewTemplate = false; canInsertText = false; executeTemplate = false; break; case 'ReportText': // isImpression = false; if (!hasInsertPartial && !isImpression) { const /** @type {?} */ reportTextObj = new AllReportText(); reportTextObj.sectionId = 'findings'; reportTextObj.reportText = findingsText; allReportText[reportTextObj.sectionId] = reportTextObj; } if (impressionText !== '' && impressionText !== undefined) { const /** @type {?} */ reportTextObj = new AllReportText(); reportTextObj.sectionId = selectedSection; reportTextObj.reportText = impressionText; allReportText[reportTextObj.sectionId] = reportTextObj; } hasInsertPartial = false; break; case 'SectionIf': isSectionIf = false; canInsertText = true; break; case 'InsertPartial': canInsertText = true; break; case 'InsertValue': if ((hasSectionNot && executeSectionIfNot || !hasSectionNot)) { canInsertText = true; } break; case 'SectionIfValue': canInsertText = true; break; } }; reportTextParser.onend = function () { // parser stream is done, and ready to have more stuff written to it. // if (impressionText !== '' && impressionText !== undefined) { // const reportTextObj: AllReportText = new AllReportText(); // reportTextObj.sectionId = selectedSection; // reportTextObj.reportText = impressionText; // allReportText[reportTextObj.sectionId] = reportTextObj; // } }; reportTextParser.write(endpointContent).onend(); /** * @param {?} textExpression * @return {?} */ function getTextExpressionValue(textExpression) { if (textExpression.indexOf('{') === 0 && (textExpression.indexOf('}') > 1)) { const /** @type {?} */ subString = textExpression.substr(textExpression.indexOf('{') + 1, textExpression.indexOf('}') - 1); getTextExpressionValue(selectedElements[subString]); } else { textExpressionValue = textExpression; } } /** * @param {?} partialViewId * @param {?} isImpressionTemplate * @return {?} */ function generatePartialView(partialViewId, isImpressionTemplate) { // this.templateIds = []; const /** @type {?} */ sax = require('sax'), /** @type {?} */ parser = sax.parser(strict, trim); parser.onerror = function (e) { // an error happened. // parser.resume(); }; parser.ontext = function (t) { if (executeTemplate) { if (!isImpressionTemplate) { if (canInsertText && hasSectionNot && hasSectionNot !== undefined && executeSectionIfNot) { findingsText = findingsText + t; } else if (canInsertText && !hasSectionNot && isImpression) { findingsText = findingsText + t; } else if (canInsertText && isNewTemplate) { findingsText = findingsText + t; } } else { if (canInsertText && hasSectionNot && hasSectionNot !== undefined && executeSectionIfNot) { impressionText = impressionText + t; } else if (canInsertText && !hasSectionNot && isImpression) { impressionText = impressionText + t; } else if (canInsertText && isNewTemplate) { impressionText = impressionText + t; } } } }; parser.onopentag = function (node) { switch (node.name) { case 'Label': canInsertText = false; break; case 'EndPoint': if (node.attributes.Id !== '') { canInsertText = true; isImpression = true; } else { canInsertText = false; isImpression = false; } break; case 'InsertPartial': canInsertText = false; break; case 'ReportText': canInsertText = true; break; case 'TemplatePartial': hasSectionNot = false; executeSectionIfNot = false; if (node.attributes.Id === partialViewId) { executeTemplate = true; canInsertText = true; isNewTemplate = true; break; } else { isNewTemplate = false; executeTemplate = false; } break; case 'SectionIfValueNot': if (executeTemplate) { if (Array.isArray(selectedElements[node.attributes.DataElementId])) { for (const /** @type {?} */ comaprisonValue of selectedComparisonValues[node.attributes.DataElementId + 'ComparisonValue']) { if (comaprisonValue !== node.attributes.ComparisonValue && comaprisonValue !== undefined && !isSectionIf) { canInsertText = true; executeSectionIfNot = true; break; } else { canInsertText = false; executeSectionIfNot = false; } } } else if (selectedElements[node.attributes.DataElementId] !== node.attributes.ComparisonValue && selectedElements[node.attributes.DataElementId] !== '--Select--' && selectedElements[node.attributes.DataElementId] !== undefined && selectedElements[node.attributes.DataElementId] !== null) { canInsertText = true; executeSectionIfNot = true; } else { canInsertText = false; executeSectionIfNot = false; } } hasSectionNot = true; break; case 'SectionIf': if (selectedElements[node.attributes.DataElementId] !== undefined && selectedElements[node.attributes.DataElementId].length > 0 && (!hasSectionNot || (hasSectionNot && executeSectionIfNot)) && selectedChoiceTexts[node.attributes.DataElementId] !== 'Other, please specify…') { isSectionIf = true; canInsertText = true; } else { isSectionIf = false; canInsertText = false; } break; case 'SectionIfValue': if (executeTemplate) { if (Array.isArray(selectedElements[node.attributes.DataElementId])) { for (const /** @type {?} */ comaprisonValue of selectedComparisonValues[node.attributes.DataElementId + 'ComparisonValue']) { if (comaprisonValue === node.attributes.ComparisonValue && comaprisonValue !== undefined) { isSectionIf = true; if (selectedElements[node.attributes.DataElementId] !== undefined && !isSectionIf && selectedChoiceTexts[node.attributes.DataElementId] !== 'Other, please specify…') { findingsText = findingsText + selectedChoiceTexts[node.attributes.DataElementId]; } canInsertText = true; break; } else { isSectionIf = false; canInsertText = false; } } } else if (selectedElements[node.attributes.DataElementId] === node.attributes.ComparisonValue && selectedElements[node.attributes.DataElementId] !== undefined) { isSectionIf = true; if (selectedElements[node.attributes.DataElementId] !== undefined && !isSectionIf && selectedChoiceTexts[node.attributes.DataElementId] !== 'Other, please specify…') { findingsText = findingsText + selectedChoiceTexts[node.attributes.DataElementId]; } canInsertText = true; } else { canInsertText = false; } } break; case 'InsertValue': if (executeTemplate) { insertValue = true; const /** @type {?} */ choiceText = selectedChoiceTexts[node.attributes.DataElementId]; if (node.attributes.Id === 'findings' || canInsertText) { if (isImpression) { canInsertText = true; if (selectedElements[node.attributes.DataElementId] !== undefined && hasSectionNot && executeSectionIfNot && selectedChoiceTexts[node.attributes.DataElementId] !== 'Other, please specify…') { if (selectedChoiceTexts[node.attributes.DataElementId] !== undefined) { impressionText = impressionText + (Array.isArray(choiceText) ? choiceText.join(', ') : choiceText); } else { impressionText = impressionText + (Array.isArray(choiceText) ? choiceText.join(', ') : choiceText); } } else if (selectedElements[node.attributes.DataElementId] !== undefined && !hasSectionNot && selectedChoiceTexts[node.attributes.DataElementId] !== 'Other, please specify…') { if (selectedChoiceTexts[node.attributes.DataElementId] !== undefined) { impressionText = impressionText + (Array.isArray(choiceText) ? choiceText.join(', ') : choiceText); } else { if (selectedChoiceTexts[node.attributes.DataElementId] !== undefined && selectedChoiceTexts[node.attributes.DataElementId] !== 'Other, please specify…') { impressionText = impressionText + (Array.isArray(choiceText) ? choiceText.join(', ') : choiceText); } } } } else { if (selectedElements[node.attributes.DataElementId] !== undefined && hasSectionNot && executeSectionIfNot && selectedChoiceTexts[node.attributes.DataElementId] !== 'Other, please specify…') { if (selectedChoiceTexts[node.attributes.DataElementId] !== undefined) { findingsText = findingsText + (Array.isArray(choiceText) ? choiceText.join(', ') : choiceText); } } else if (selectedElements[node.attributes.DataElementId] !== undefined && !hasSectionNot && selectedChoiceTexts[node.attributes.DataElementId] !== 'Other, please specify…') { if (selectedChoiceTexts[node.attributes.DataElementId] !== undefined) { findingsText = findingsText + (Array.isArray(choiceText) ? choiceText.join(', ') : choiceText); } } } } break; } } }; parser.onclosetag = function (node) { switch (node) { case 'SectionIfValueNot': executeSectionIfNot = false; hasSectionNot = false; if (isSectionIf) { canInsertText = true; } break; case 'TemplatePartial': isNewTemplate = true; canInsertText = false; executeTemplate = true; break; case 'InsertPartial': canInsertText = true; break; case 'SectionIf' || 'SectionIfValue': isSectionIf = false; break; } }; parser.onend = function () { // parser stream is done, and ready to have more stuff written to it. const /** @type {?} */ reportTextObj = new AllReportText(); reportTextObj.sectionId = 'findings'; reportTextObj.reportText = findingsText; allReportText[reportTextObj.sectionId] = reportTextObj; }; parser.write(templatePartialsText).onend(); } this.mainReportTextObj = new MainReportText(); this.mainReportTextObj.reportTextMainContent = reportTextContent; this.mainReportTextObj.allReportText = allReportText; this.returnReportText.emit(this.mainReportTextObj); } } AssistDataElementComponent.decorators = [ { type: Component, args: [{ selector: 'acr-assist-data-element', template: `<ng-container *ngFor="let DataElement of dataElements"> <ng-container *ngIf="(DataElement.dataElementType == 'ChoiceDataElement' || DataElement.dataElementType == 'NumericDataElement' || DataElement.dataElementType == 'IntegerDataElement' || DataElement.dataElementType == 'MultiChoiceDataElement' || DataElement.dataElementType == 'DateTimeDataElement' || DataElement.dataElementType == 'DurationDataElement') "> <ng-container *ngIf="DataElement.isVisible"> <div id="div_{{DataElement.id}}"> <ng-container *ngIf="DataElement.dataElementType == 'ChoiceDataElement'"> <acr-assist-choice-element [choiceDataElement]='DataElement' [imagePath]='imagePath' (returnChoiceElement)='choiceSelected($event)'></acr-assist-choice-element> </ng-container> <ng-container *ngIf="DataElement.dataElementType == 'MultiChoiceDataElement'"> <acr-assist-multi-choice-element [multiChoiceElement]='DataElement' [imagePath]='imagePath' (returnMultiChoice)='multiSelected($event)'></acr-assist-multi-choice-element> </ng-container> <ng-container *ngIf="DataElement.dataElementType == 'NumericDataElement' || DataElement.dataElementType == 'IntegerDataElement'"> <acr-assist-numeric-element [numericDataElement]='DataElement' [imagePath]='imagePath' (returnNumericElement)='numericSelected($event)'></acr-assist-numeric-element> </ng-container> <ng-container *ngIf="DataElement.dataElementType == 'DateTimeDataElement'"> <acr-assist-date-time-element [dateTimeDataElement]='DataElement'></acr-assist-date-time-element> </ng-container> <ng-container *ngIf="DataElement.dataElementType == 'DurationDataElement'"> <acr-assist-duration-element [durationDataElement]='DataElement'></acr-assist-duration-element> </ng-container> </div> </ng-container> </ng-container> </ng-container> `, styles: [``, `.required-field{color:red}.padding-l-5{padding-left:5px}.whitespace{margin-left:5px}.max-w-h-100{max-width:100%;max-height:100%}.carousel-control>.fa{font-size:40px;position:absolute;top:50%;z-index:5;display:inline-block;margin-top:-20px}.carousel-control.left{background-repeat:repeat-x}.carousel-control.left,.carousel-control.right{background-image:none}.carousel-control.right{background-image:linear-gradient(to right,rgba(0,0,0,.0001) 0,rgba(0,0,0,.5) 100%);background-repeat:repeat-x}.scroll{overflow-y:scroll;overflow-x:hidden}.div-simulator-form-height{height:calc(100vh - 100px);overflow-y:scroll;overflow-x:hidden}.div-report-text-scroll{overflow-x:hidden;overflow-y:auto;max-height:calc(100vh - 300px)}.padding-r-10{padding-right:10px}.slide-left{left:30px}.slide-right{right:30px}hr{margin-top:10px;margin-bottom:10px}.white-space-line{white-space:pre-line;word-wrap:break-word}p{margin:0 0 10px}.form-control{border-radius:0;box-shadow:none;border-color:#d2d6de}h4.modal-title.float-left{float:left}.margin-b-0{margin-bottom:0}.font-weight-400{font-weight:400}.custom-radio-style{float:left;margin-right:15px}.zoom{width:100%;overflow:auto}.zoom img{height:auto;width:100%;min-width:100%;max-width:inherit!important}.btn-zoom{background-color:#f4f4f4;color:#444;border-color:#ddd}.btn-zoom.hover,.btn-zoom:active,.btn-zoom:hover{background-color:#e7e7e7}@media (min-width:768px){label.control-label{padding-left:20px}}.padding-5{padding:5px}`] },] }, ]; /** @nocollapse */ AssistDataElementComponent.ctorParameters = () => [ { type: SimulatorEngineService }, { type: SimulatorCommunicationService } ]; AssistDataElementComponent.propDecorators = { dataElements: [{ type: Input }], imagePath: [{ type: Input }], Endpoints: [{ type: Input }], templatePartial: [{ type: Input }], endPointXMLString: [{ type: Input }], xmlContent: [{ type: Input }], returnReportText: [{ type: Output }], returnExecutionHistory: [{ type: Output }], returnDataElementChanged: [{ type: Output }], isReset: [{ type: Input }], inputValues: [{ type: Input }] }; function AssistDataElementComponent_tsickle_Closure_declarations() { /** @type {?} */ AssistDataElementComponent.prototype.dataElements; /** @type {?} */ AssistDataElementComponent.prototype.imagePath; /** @type {?} */ AssistDataElementComponent.prototype.Endpoints; /** @type {?} */ AssistDataElementComponent.prototype.templatePartial; /** @type {?} */ AssistDataElementComponent.prototype.endPointXMLString; /** @type {?} */ AssistDataElementComponent.prototype.xmlContent; /** @type {?} */