Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Common Ui Scripts---->Start
- //variables holding values for the current session
- var isQADirty = false;
- var RequestTypeLegacyCardiologyNewRequest = 1;
- var SpecialtyNameCardiology = "Cardiology";
- var SpecialtyCardiologyId = "5688EC08-EFA6-E211-B214-00155D1E5005";
- var SpecialtyNameOncology = "Oncology";
- var SpecialtyNameRadiationOncology = "Radiation Oncology";
- var SpecialtyNameImaging = "Imaging";
- var DisplayTypeStandardWithText = "StandaredWithText";
- var RequestTypeUmIntake = "UmIntake";
- var currentRuleTriggerId;
- var currentRegimenConversations;
- var currentCrmUserId;
- var currentCrmServiceId;
- var currentCrmIsDssSupplemental;
- var currentDeterminationSupportId;
- var currentCrmPassedIcdId;
- var currentClassificationId;
- var currentTreatmentMedicationTypeId;
- var selectableRegimenData;
- var isTestWindow;
- var REQUEST_TYPE = "";
- var selectedRegimenId = "";
- var dssSelectedDiagnosisName = "";
- var oldSelectedDiagnosisName = "";
- function GetClinicalInformationJsContextRegimenAssemblyQualifiedName() {
- if (typeof (Cp) === "undefined" ||
- typeof (Cp.NewRequest) === "undefined" ||
- typeof (Cp.NewRequest.CommonProcessor) === "undefined" ||
- typeof (Cp.NewRequest.CommonProcessor.Instance) === "undefined") {
- return medicationOncologyRegimenAssemblyQualifiedName;
- }
- return Cp.NewRequest.CommonProcessor.Instance.IsRadiationOncology()
- ? radiationOncologyRegimenAssemblyQualifiedName
- : (Cp.NewRequest.CommonProcessor.Instance.IsCardiology()
- ? cardiologyRegimenAssemblyQualifiedName
- : (Cp.NewRequest.CommonProcessor.Instance.IsImaging()
- ? imagingRegimenAssemblyQualifiedName
- : medicationOncologyRegimenAssemblyQualifiedName));
- }
- //validate the question answer section
- var validateQuestionAnswers = function (suppressErrorHighlight, qaParentDomElement, checkVisibility, allowPartial, isNoQnA) {
- var canPartial = allowPartial != undefined && allowPartial;
- var qaParent = "";
- if (qaParentDomElement != undefined && qaParentDomElement.length > 0) {
- qaParent = qaParentDomElement;
- } else {
- qaParent = $("#commonUiClinicalInformationSection").find(".panel-section:visible");
- if (qaParent.length <= 0) {
- qaParent = $("#clinicalQuestionAnswerDiv").find(".panel-section:visible");
- }
- }
- var noError = true;
- var errorCssClass = "input-validation-error";
- var isNoQnACheckBox = $(document).find("#NoQnACheck");
- if (isNoQnACheckBox.length > 0 && $(isNoQnACheckBox).val() == "true") {
- return noError;
- }
- qaParent.each(function () {
- var inputElement = $(this).find("input:hidden");
- var currentQuestion = $(this);
- if (inputElement != undefined && inputElement.length > 0) {
- inputElement.each(function () {
- if (this.value != undefined && this.value.trim().length == 0) {
- var checkBoxDisplayItems = inputElement.siblings("label[data-val-visualid='" + $(this).attr("data-val-visualid") + "']").filter(".answerButtonBox");
- if (checkBoxDisplayItems != undefined && checkBoxDisplayItems.length > 0 && checkBoxDisplayItems.is(":visible") && !(checkBoxDisplayItems.hasClass("active")) && !canPartial) {
- if (!suppressErrorHighlight) {
- checkBoxDisplayItems.addClass(errorCssClass);
- }
- noError = false;
- }
- if (checkVisibility != undefined && checkVisibility == false) {
- if (currentQuestion.attr('override-validation') != "true" && checkBoxDisplayItems != undefined && checkBoxDisplayItems.length > 0 && !(checkBoxDisplayItems.hasClass("active"))) {
- if (!suppressErrorHighlight) {
- checkBoxDisplayItems.addClass(errorCssClass);
- }
- noError = false;
- }
- }
- }
- });
- } else {
- var textBoxDisplayItems = $(this).find("label.labLabelStyle").find("input:text");
- textBoxDisplayItems.each(function () {
- if ($(this) != undefined && textBoxDisplayItems.is(":visible")) {
- if (($(this).hasClass('labDatePicker') && !isDate(this.value)) && !canPartial) {
- $(this).attr('title', "Please enter a valid lab date.");
- if (!suppressErrorHighlight) {
- $(this).addClass(errorCssClass);
- }
- noError = false;
- } else if ((this.value.trim().length == 0) && !canPartial) {
- if (!suppressErrorHighlight) {
- $(this).addClass(errorCssClass);
- }
- noError = false;
- }
- }
- });
- }
- var dssDropdowns = $(this).find(".dssReasonDropdown:visible");
- if (dssDropdowns != undefined && dssDropdowns.length > 0) {
- dssDropdowns.each(function () {
- if (($(this).val() == "0")) {
- if (!suppressErrorHighlight) {
- $(this).addClass(errorCssClass);
- }
- noError = false;
- }
- });
- }
- var inputElementsWithAnswerTextVisible = $(this).find('input[type="text"].answerText');
- if (inputElementsWithAnswerTextVisible != undefined && inputElementsWithAnswerTextVisible.length > 0) {
- inputElementsWithAnswerTextVisible.each(function () {
- if (this.value != undefined && this.value.trim().length == 0 && !canPartial) {
- if (!suppressErrorHighlight) {
- $(this).addClass(errorCssClass);
- }
- noError = false;
- }
- });
- }
- });
- return noError;
- };
- //get all the selected question with answers - returns collection
- var getSelectedQuestionAnswers = function (p_qaParent) {
- answeredQuestionInfoList = [];
- var qaParent = "";
- if (p_qaParent != undefined && p_qaParent.length > 0) {
- qaParent = p_qaParent;
- } else {
- qaParent = $("#commonUiClinicalInformationSection").find(".panel-section:visible");
- if (qaParent.length <= 0) {
- qaParent = $("#clinicalQuestionAnswerDiv").find(".panel-section:visible");
- }
- }
- var isNoQnACheckBox = $(document).find("#NoQnACheck");
- if (isNoQnACheckBox.length > 0 && $(isNoQnACheckBox).val() == false) {
- return answeredQuestionInfoList;
- }
- qaParent.each(function () {
- var questionText = $(this).find("h3.section-heading").attr('questionText');
- var currentQnId = $(this).find("h3.section-heading").attr('question');
- var questionOrder = $(this).find("h3.section-heading").attr('sortOrder');
- var currentElement = $(this);
- answers = [];
- if (currentQnId == undefined) {
- $(this).find("h3.section-sub-heading").each(function () {
- questionText = questionText + ":" + $(this).attr('questionText');
- currentQnId = $(this).attr('question');
- answers = [];
- var activeLabel = currentElement.find("label.active[question='" + currentQnId + "']");
- if (activeLabel != undefined && activeLabel.length > 0) {
- activeLabel.each(function () {
- answerValue = [];
- var value = $(this).text();
- var displayType = $(this).parent().siblings("table").find("h3.section-heading").attr('displaytype');
- var lastAnswer = $(this).parent().find('.answerButtonBox:last')[0];
- if (displayType != undefined && displayType == DisplayTypeStandardWithText) {
- if ($(this).attr('id') == lastAnswer.id) {
- value = ($(this).parent().find("input.answerText")[0].value) == "" ? value : $(this).parent().find("input.answerText")[0].value;
- } else {
- value = $(this).text();
- }
- }
- var answer = {
- Value: value,
- RegimenConversationDetailType: "InputValue",
- RuleAnswerValueType: "725060001"
- }
- answerValue.push(answer);
- var BaseAnswerInfo = {
- Id: this.id,
- AnswerValues: answerValue,
- TriagePoint: $(this).attr('triage-point')
- }
- answers.push(BaseAnswerInfo);
- });
- var reason = $(this).parent().siblings().find(".dssReasonDropdown:visible").val();
- var answeredQuestionInfo = {
- QuestionId: activeLabel.attr("question"),
- Question: questionText,
- QuestionOrder: questionOrder,
- DssReasonType: reason,
- Answers: answers
- }
- answeredQuestionInfoList.push(answeredQuestionInfo);
- questionText = currentElement.find("h3.section-heading").attr('questionText');
- }
- else {
- var answeredQuestionInfo = {
- QuestionId: currentQnId,
- Question: questionText,
- QuestionOrder: questionOrder,
- DssReasonType: undefined,
- Answers: answers
- }
- answeredQuestionInfoList.push(answeredQuestionInfo);
- }
- });
- } else {
- var activeLabel = $(this).find("label.active[question='" + currentQnId + "']");
- //if (currentElement.children != undefined && currentElement.children.length > 0 && currentElement.children(0).attr("id") == "PerformQuestion") {
- // activeLabel = $('[data-master=performance-status-ecog]').find("label.active").add($('[data-master=performance-status-karnofsky]').find("label.active"));
- //}
- if (activeLabel != undefined && activeLabel.length > 0) {
- activeLabel.each(function () {
- answerValue = [];
- if ($(this).attr("name") == "performance_status_ecog") {
- questionText = questionText + ":ECOG";
- } else if ($(this).attr("name") == "performance_status_karnofsky") {
- questionText = questionText + ":Karnofsky";
- }
- var value = $(this).text();
- var displayType = $(this).parent().siblings("table").find("h3.section-heading").attr('displaytype');
- var lastAnswer = $(this).parent().find('.answerButtonBox:last')[0];
- if (displayType != undefined && displayType == DisplayTypeStandardWithText) {
- if ($(this).attr('id') == lastAnswer.id) {
- value = ($(this).parent().find("input.answerText")[0].value) == "" ? value : $(this).parent().find("input.answerText")[0].value;
- } else {
- value = $(this).text();
- }
- }
- var answer = {
- Value: value,
- RegimenConversationDetailType: "InputValue",
- RuleAnswerValueType: "725060001"
- }
- answerValue.push(answer);
- var BaseAnswerInfo = {
- Id: this.id,
- AnswerValues: answerValue,
- TriagePoint: $(this).attr('triage-point')
- }
- answers.push(BaseAnswerInfo);
- });
- var reason = activeLabel.closest(".panel-section").find(".dssReasonDropdown:visible").val();
- var answeredQuestionInfo = {
- QuestionId: activeLabel.attr("question"),
- Question: questionText,
- QuestionOrder: questionOrder,
- DssReasonType: reason,
- Answers: answers
- }
- answeredQuestionInfoList.push(answeredQuestionInfo);
- } else {
- var textBoxDisplayItems = $(this).find("label.labLabelStyle").find("input:text");
- answers = [];
- textBoxDisplayItems.each(function () {
- answerValue = [];
- if (this.id == "labValue") {
- answer = {
- Value: this.value,
- RegimenConversationDetailType: "InputValue",
- RuleAnswerValueType: "725060002"
- }
- answerValue.push(answer);
- } else if ($(this).hasClass('labDatePicker')) {
- answer = {
- Value: days_between(new Date(), this.value),
- RegimenConversationDetailType: "CalculatedValue",
- RuleAnswerValueType: "725060000"
- }
- answerValue.push(answer);
- answer = {
- Value: this.value,
- RegimenConversationDetailType: "LabDate",
- RuleAnswerValueType: "725060003"
- }
- answerValue.push(answer);
- }
- var BaseAnswerInfo = {
- Id: $(this).attr("answer"),
- AnswerValues: answerValue
- }
- answers.push(BaseAnswerInfo);
- });
- var reason = textBoxDisplayItems.parent().parent().siblings().find(".dssReasonDropdown:visible").val();
- var answeredQuestionInfo = {
- QuestionId: currentQnId,
- Question: questionText,
- QuestionOrder: questionOrder,
- DssReasonType: reason,
- Answers: answers
- }
- answeredQuestionInfoList.push(answeredQuestionInfo);
- }
- }
- });
- return answeredQuestionInfoList;
- };
- //get Regimens collection
- var getRegimens = function (answeredQuestionInfoList, requestType, bypassCallback, onSuccessCallback) {
- var isSimulation = (requestType == "SimulateRequest");
- //loading the selected Information
- if (requestType == "NewRequest")
- refreshSelectedInfoForDosing(true);
- var regimenRuleId = $("input:hidden[name='CurrentRegimenRuleSearchingResponse.RegimenRuleId']").attr("value");
- var urlPost;
- if (requestType == "SimulateRequest" ||
- requestType == "NewRequest" ||
- requestType == RequestTypeLegacyCardiologyNewRequest) {
- urlPost = "/Authorization/RegimenSelection/Regimen";
- } else if (requestType == "CrmRequest") {
- if (currentDeterminationSupportId == undefined || currentDeterminationSupportId == '')
- currentDeterminationSupportId = getQueryString('determinationSupportId');
- if (currentCrmServiceId == undefined || currentCrmServiceId == '')
- currentCrmServiceId = getQueryString('serviceRequestId');
- if (currentCrmUserId == undefined || currentCrmUserId == '')
- currentCrmUserId = getQueryString('userId');
- urlPost = "/QandARegimen/RegimenSelection/Regimen";
- currentRuleTriggerId = regimenRuleId;
- } else if (requestType == "TestRequest") {
- urlPost = "/RegimenRuleAdmin/RegimenSelection/Regimen";
- regimenRuleId = currentRuleTriggerId;
- } else if (requestType == "PortalDssRequest") {
- if (currentDeterminationSupportId == undefined || currentDeterminationSupportId == '')
- currentDeterminationSupportId = getQueryString('determinationSupportId');
- if (currentCrmServiceId == undefined || currentCrmServiceId == '')
- currentCrmServiceId = getQueryString('serviceRequestId');
- if (currentCrmUserId == undefined || currentCrmUserId == '')
- currentCrmUserId = getQueryString('userId');
- urlPost = "/Determination/DssRegimenSelection/Regimen";
- currentRuleTriggerId = regimenRuleId;
- } else if (requestType === RequestTypeUmIntake) {
- urlPost = "/Authorization/RegimenSelection/DisplayRegimen";
- }
- // if (answeredQuestionInfoList != undefined && answeredQuestionInfoList != null && answeredQuestionInfoList.length > 0) {
- currentRegimenConversations = answeredQuestionInfoList;
- if (currentCrmIsDssSupplemental == undefined || currentCrmIsDssSupplemental == '')
- currentCrmIsDssSupplemental = getQueryString('isDssSupplemental');
- if (currentCrmPassedIcdId == undefined || currentCrmPassedIcdId == '') {
- currentCrmPassedIcdId = getQueryString('icdId');
- }
- if (currentClassificationId == undefined || currentClassificationId == '') {
- currentClassificationId = getQueryString('classificationId');
- }
- if (currentTreatmentMedicationTypeId == undefined || currentTreatmentMedicationTypeId == '') {
- currentTreatmentMedicationTypeId = getQueryString('treatmentMedicationTypeId');
- }
- if (currentCrmIsDssSupplemental != 'true') {
- var SelectedQuestionAnswerRequest =
- requestType !== RequestTypeUmIntake
- ? {
- RegimenRuleId: regimenRuleId,
- AnsweredQuestions: answeredQuestionInfoList,
- DeterminationSupportId: currentDeterminationSupportId,
- ServiceRequestId: currentCrmServiceId,
- UserId: currentCrmUserId,
- IsSimulation: isSimulation,
- IcdId: currentCrmPassedIcdId,
- ClassificationId: currentClassificationId,
- TreatmentMedicationTypeId: currentTreatmentMedicationTypeId,
- EligibilityType: 0 // Placeholder for EligibilityType
- }
- : Cp.IntakeHome.AuthRequest.Instance.GetSelectableRegimenRequest(regimenRuleId, answeredQuestionInfoList);
- if(requestType !== RequestTypeUmIntake) {
- window.scrollTo(10, 10);
- }
- var hasCpOncologyNewRequestRegimenMatcher =
- typeof (Cp) != "undefined" &&
- typeof (Cp.OncologyNewRequest) != "undefined" &&
- typeof (Cp.OncologyNewRequest.RegimenMatcher) != "undefined" &&
- typeof (Cp.OncologyNewRequest.RegimenMatcher.Instance) != "undefined" &&
- Cp.NewRequest &&
- Cp.NewRequest.CommonProcessor &&
- Cp.NewRequest.CommonProcessor.Instance &&
- Cp.NewRequest.CommonProcessor.Instance.IsOncology();
- if (typeof (contextHasRegimenMatcher) == "undefined" ||
- !hasCpOncologyNewRequestRegimenMatcher) {
- contextIsRegimenMatchingInProgress = false;
- } else {
- contextIsRegimenMatchingInProgress =
- contextHasRegimenMatcher &&
- Cp.OncologyNewRequest.RegimenMatcher.Instance.IsRegimenMatchingInProgress() &&
- bypassCallback == undefined;
- }
- if (!contextIsRegimenMatchingInProgress) {
- $("#loadingSpinner").dialog({
- closeOnEscape: false,
- dialogClass: 'no-close',
- resizable: false,
- title: "Loading...",
- position: {
- my: "center center",
- at: "center center",
- of: window
- },
- modal: true
- });
- }
- $.ajax({
- type: "POST",
- url: urlPost,
- data: JSON.stringify(SelectedQuestionAnswerRequest),
- contentType: 'application/json; charset=utf-8',
- dataType: 'html',
- success: function (html) {
- try {
- $("#commonUiregimenSelectionSection").html('');
- $("#commonUiregimenSelectionSection").html(html);
- if(requestType === RequestTypeUmIntake) {
- $("#commonUiregimenSelectionSection").show();
- Cp.Utilities.Instance.ScrollToElement(".regimen-selection-table");
- }
- if (requestType == "CrmRequest") {
- regimenSelectCallbackPortal30(null, requestType);
- }
- if (contextIsRegimenMatchingInProgress) {
- Cp.OncologyNewRequest.RegimenMatcher.Instance.HandleNewQandANextClickedForRegimenInDifferentRuleCallback();
- } else { // handle an existing unhanlded case where new Q&A results in the selected regimen is not available in the new list of selectable regimens
- if (isByPassingRegimenSelection()) {
- Cp.NewRequest.CommonProcessor.Instance.FullyLockApplicableNewRequestFields();
- }
- else if (hasCpOncologyNewRequestRegimenMatcher) {
- Cp.OncologyNewRequest.RegimenMatcher.Instance.HandleNewQandANextClicked();
- }
- }
- if (typeof(onSuccessCallback) === "function") {
- onSuccessCallback.apply();
- }
- } finally {
- html = null;
- if (requestType != "CrmRequest") {
- $("#loadingSpinner").dialog("close");
- }
- }
- },
- error: function (xhr, ajaxOptions, thrownError) {
- alert(xhr.status);
- alert(thrownError);
- $("#loadingSpinner").dialog("close");
- }
- });
- }
- else {
- if (requestType == "CrmRequest") {
- regimenSelectCallbackPortal30(null, requestType);
- }
- }
- return true;
- };
- function savePortalDssCoversation(answeredQuestionInfoList) {
- var regimenRuleId = $("input:hidden[name='CurrentRegimenRuleSearchingResponse.RegimenRuleId']").attr("value");
- if (currentDeterminationSupportId == undefined || currentDeterminationSupportId == '')
- currentDeterminationSupportId = getQueryString('determinationSupportId');
- if (currentCrmServiceId == undefined || currentCrmServiceId == '')
- currentCrmServiceId = getQueryString('serviceRequestId');
- if (currentCrmUserId == undefined || currentCrmUserId == '')
- currentCrmUserId = getQueryString('userId');
- var urlPost = "/Determination/DssRegimenSelection/SaveDssConversation";
- currentRuleTriggerId = regimenRuleId;
- currentRegimenConversations = answeredQuestionInfoList;
- if (currentCrmIsDssSupplemental == undefined || currentCrmIsDssSupplemental == '')
- currentCrmIsDssSupplemental = getQueryString('isDssSupplemental');
- if (currentCrmPassedIcdId == undefined || currentCrmPassedIcdId == '') {
- currentCrmPassedIcdId = getQueryString('icdId');
- }
- if (currentClassificationId == undefined || currentClassificationId == '') {
- currentClassificationId = getQueryString('classificationId');
- }
- if (currentTreatmentMedicationTypeId == undefined || currentTreatmentMedicationTypeId == '') {
- currentTreatmentMedicationTypeId = getQueryString('treatmentMedicationTypeId');
- }
- var SelectedQuestionAnswerRequest = {
- RegimenRuleId: regimenRuleId,
- AnsweredQuestions: answeredQuestionInfoList,
- DeterminationSupportId: currentDeterminationSupportId,
- ServiceRequestId: currentCrmServiceId,
- UserId: currentCrmUserId,
- IsSimulation: false,
- IcdId: currentCrmPassedIcdId,
- ClassificationId: currentClassificationId,
- TreatmentMedicationTypeId: currentTreatmentMedicationTypeId,
- EligibilityType: 0 // Placeholder for EligibilityType
- };
- $("#loadingSpinner").dialog({
- closeOnEscape: false,
- dialogClass: 'no-close',
- resizable: false,
- title: "Loading...",
- position: {
- my: "center center",
- at: "center center",
- of: window
- },
- modal: true
- });
- $.ajax({
- type: "POST",
- url: urlPost,
- async:false,
- data: JSON.stringify(SelectedQuestionAnswerRequest),
- contentType: 'application/json; charset=utf-8',
- dataType: 'html',
- success: function (response) {
- try {
- if(response){
- if (window.opener) {
- window.opener.$("#dssRegimenContainer").show();
- window.opener.$("#dssRegimenConversationsContainer").html("");
- if(response !== "NoConversationDetail") {
- window.opener.$("#dssRegimenConversationsContainer").html(response);
- }
- if (window.opener.dssSelectedDiagnosisName == "" || window.opener.oldSelectedDiagnosisName == "") {
- window.opener.$("#dssSelectedDiagnosisCode").text(window.opener.$("#hdnDssPrimaryDiagnosisName").val());
- window.opener.$("#selectedDiagnosis").text(window.opener.$("#hdnDssPrimaryDiagnosisName").val());
- } else {
- window.opener.$("#dssSelectedDiagnosisCode").text(window.opener.dssSelectedDiagnosisName);
- window.opener.$("#selectedDiagnosis").text(window.opener.oldSelectedDiagnosisName);
- }
- window.opener.$("#diseaseCategory").val(window.opener.$("#hdnOldClassificationIdGuid").val());
- window.opener.$("#diseaseCategory").siblings(".nchSelectSpan").text(window.opener.$("#diseaseCategory").children("option:selected").text());
- window.opener.$("#treatmentType").val(window.opener.$("#hdnOldTreatmentMedicationTypeIdGuid").val());
- window.opener.$("#treatmentType").siblings(".nchSelectSpan").text(window.opener.$("#treatmentType").children("option:selected").text());
- window.opener.$("#dssDiseaseClassificationSummary").text(window.opener.$("#hdndssClassificationName").val());
- window.opener.$("#dssTreatmentMedicationSummary").text(window.opener.$("#hdndssTreatmentMedicationTypeName").val());
- }
- if ($("#surgicalInformationSectionDiv").html().trim() == "") {
- window.close();
- }
- }
- else{
- alert("Some error occurred, please try again.");
- }
- } finally {
- response = null;
- $("#loadingSpinner").dialog("close");
- }
- },
- error: function (xhr, ajaxOptions, thrownError) {
- alert(xhr.status);
- alert(thrownError);
- $("#loadingSpinner").dialog("close");
- }
- });
- }
- function savePortalDssCoversationAndSelectedRegimen(answeredQuestionInfoList, selectedRegimenId) {
- var regimenRuleId = $("input:hidden[name='CurrentRegimenRuleSearchingResponse.RegimenRuleId']").attr("value");
- var urlPost;
- if (currentDeterminationSupportId == undefined || currentDeterminationSupportId == '')
- currentDeterminationSupportId = getQueryString('determinationSupportId');
- if (currentCrmServiceId == undefined || currentCrmServiceId == '')
- currentCrmServiceId = getQueryString('serviceRequestId');
- if (currentCrmUserId == undefined || currentCrmUserId == '')
- currentCrmUserId = getQueryString('userId');
- urlPost = "/Determination/DssRegimenSelection/SaveDssRegimenConversationAndSelectedRegimen";
- currentRuleTriggerId = regimenRuleId;
- // if (answeredQuestionInfoList != undefined && answeredQuestionInfoList != null && answeredQuestionInfoList.length > 0) {
- currentRegimenConversations = answeredQuestionInfoList;
- if (currentCrmIsDssSupplemental == undefined || currentCrmIsDssSupplemental == '')
- currentCrmIsDssSupplemental = getQueryString('isDssSupplemental');
- if (currentCrmPassedIcdId == undefined || currentCrmPassedIcdId == '') {
- currentCrmPassedIcdId = getQueryString('icdId');
- }
- if (currentClassificationId == undefined || currentClassificationId == '') {
- currentClassificationId = getQueryString('classificationId');
- }
- if (currentTreatmentMedicationTypeId == undefined || currentTreatmentMedicationTypeId == '') {
- currentTreatmentMedicationTypeId = getQueryString('treatmentMedicationTypeId');
- }
- if (currentCrmIsDssSupplemental != 'true') {
- var SelectedQuestionAnswerRequest = {
- RegimenRuleId: regimenRuleId,
- AnsweredQuestions: answeredQuestionInfoList,
- DeterminationSupportId: currentDeterminationSupportId,
- ServiceRequestId: currentCrmServiceId,
- UserId: currentCrmUserId,
- IsSimulation: false,
- IcdId: currentCrmPassedIcdId,
- ClassificationId: currentClassificationId,
- TreatmentMedicationTypeId: currentTreatmentMedicationTypeId,
- EligibilityType: 0, // Placeholder for EligibilityType,
- SelectedRegimenId: selectedRegimenId
- };
- }
- if (selectedRegimenId == null || selectedRegimenId == "" || selectedRegimenId == undefined) {
- savePortalDssCoversation(answeredQuestionInfoList);
- return;
- }
- $("#loadingSpinner").dialog({
- closeOnEscape: false,
- dialogClass: 'no-close',
- resizable: false,
- title: "Loading...",
- position: {
- my: "center center",
- at: "center center",
- of: window
- },
- modal: true
- });
- $.ajax({
- type: "POST",
- url: urlPost,
- async:false,
- data: JSON.stringify(SelectedQuestionAnswerRequest),
- contentType: 'application/json; charset=utf-8',
- dataType: 'html',
- success: function (response) {
- try {
- if (response) {
- if (window.opener) {
- window.opener.$("#dssRegimenContainer").show();
- window.opener.$("#dssRegimenConversationsContainer").html("");
- window.opener.$("#dssRegimenConversationsContainer").html(response);
- if (window.opener.dssSelectedDiagnosisName == "" || window.opener.oldSelectedDiagnosisName == "") {
- window.opener.$("#dssSelectedDiagnosisCode").text(window.opener.$("#hdnDssPrimaryDiagnosisName").val());
- window.opener.$("#selectedDiagnosis").text(window.opener.$("#hdnDssPrimaryDiagnosisName").val());
- } else
- {
- window.opener.$("#dssSelectedDiagnosisCode").text(window.opener.dssSelectedDiagnosisName);
- window.opener.$("#selectedDiagnosis").text(window.opener.oldSelectedDiagnosisName);
- }
- window.opener.$("#diseaseCategory").val(window.opener.$("#hdnOldClassificationIdGuid").val());
- window.opener.$("#diseaseCategory").siblings(".nchSelectSpan").text(window.opener.$("#diseaseCategory").children("option:selected").text());
- window.opener.$("#treatmentType").val(window.opener.$("#hdnOldTreatmentMedicationTypeIdGuid").val());
- window.opener.$("#treatmentType").siblings(".nchSelectSpan").text(window.opener.$("#treatmentType").children("option:selected").text());
- window.opener.$("#dssDiseaseClassificationSummary").text(window.opener.$("#hdndssClassificationName").val());
- window.opener.$("#dssTreatmentMedicationSummary").text(window.opener.$("#hdndssTreatmentMedicationTypeName").val());
- //get selected Regimen
- getSelectedRegimen();
- }
- if ($("#surgicalInformationSectionDiv").html().trim() == "") {
- window.close();
- }
- }
- } finally {
- $("#loadingSpinner").dialog("close");
- if ($("#surgicalInformationSectionDiv").html().trim() == "") {
- window.close();
- }
- }
- },
- error: function (xhr, ajaxOptions, thrownError) {
- alert(xhr.status);
- alert(thrownError);
- $("#loadingSpinner").dialog("close");
- }
- });
- }
- //get selected regimen from session
- function getSelectedRegimen()
- {
- $.ajax({
- async: false,
- type: "POST",
- url: "/Determination/DssRegimenSelection/GetSelectedRegimen",
- data: JSON.stringify({"selectedRegimenId" : selectedRegimenId}),
- contentType: 'application/json; charset=utf-8',
- success: function (response) {
- try {
- if (response != null) {
- if (window.opener) {
- window.opener.$("#displayNoResultRegimen").hide();
- window.opener.$("#displayResultRegimen").show();
- window.opener.$("#selectedRegimenTextId").text(response.regimenName);
- window.opener.$("#riskFactorEmetogenicTextId").text(response.regimenCost);
- window.opener.$("#riskFactorNeutropenicTextId").text(response.riskFactorEmetogenic);
- window.opener.$("#regimenCostTextId").text(response.riskFactorNeutropenic);
- }
- }
- } finally {
- response = null;
- $("#loadingSpinner").dialog("close");
- if ($("#surgicalInformationSectionDiv").html().trim() == "") {
- window.close();
- }
- }
- },
- error: function (xhr, ajaxOptions, thrownError) {
- alert(xhr.status);
- alert(thrownError);
- $("#loadingSpinner").dialog("close");
- }
- });
- }
- //get current regimen conversation from session
- function getCurrentRegimenConversations(requestType) {
- var regimenConversationUrl = "/ClinicalInformation/GetCurrentRegimenConversation";
- var contentType = 'application/json; charset=utf-8';
- var data = null;
- if (requestType == "CrmRequest") {
- if (currentCrmServiceId == undefined || currentCrmServiceId == '')
- currentCrmServiceId = getQueryString('serviceRequestId');
- data = { ServiceId: currentCrmServiceId };
- contentType = 'application/x-www-form-urlencoded; charset=UTF-8';
- regimenConversationUrl = "/QandARegimen/ClinicalInformation/GetCurrentRegimenConversationByServiceRequestId";
- } else if (requestType == "PortalDssRequest") {
- if (currentCrmServiceId == undefined || currentCrmServiceId == '')
- currentCrmServiceId = getQueryString('serviceRequestId');
- data = { ServiceId: currentCrmServiceId };
- contentType = 'application/x-www-form-urlencoded; charset=UTF-8';
- regimenConversationUrl = "/Determination/DssClinicalInformation/GetCurrentRegimenConversationByServiceRequestId";
- }
- $.ajax({
- cache: false,
- data: data,
- url: regimenConversationUrl,
- contentType: contentType,
- dataType: 'html',
- type: 'POST',
- async: false,
- success: function (jsonData) {
- //regimen conversation data
- regimenConversation = jsonData;
- },
- error: function (xhr, ajaxOptions, thrownError) {
- alert('RegimenConversation failed');
- }
- });
- return regimenConversation;
- }
- //get the dateDiff
- function days_between(dateTo, dateFrom) {
- var ONE_DAY = 1000 * 60 * 60 * 24;
- var date1 = new Date(dateTo);
- var date2 = new Date(dateFrom);
- var date1_ms = date1.getTime();
- var date2_ms = date2.getTime();
- var diff_ms = Math.abs(date1_ms - date2_ms);
- return Math.round(diff_ms / ONE_DAY);
- }
- //check whether it is a future date
- function isFutureDate(txtDate) {
- var date = new Date(txtDate);
- var _now = new Date();
- if (date.getTime() > _now.getTime()) {
- return true;
- }
- }
- //check whether the input is in date format or not
- function isDate(txtDate) {
- var currVal = txtDate;
- if ((currVal == '') || isFutureDate(txtDate))
- return false;
- //Declare Regex
- var rxDatePattern = /^(\d{1,2})(\/|-)(\d{1,2})(\/|-)(\d{4})$/;
- var dtArray = currVal.match(rxDatePattern); // is format OK?
- if (dtArray == null)
- return false;
- //Checks for mm/dd/yyyy format.
- dtMonth = dtArray[1];
- dtDay = dtArray[3];
- dtYear = dtArray[5];
- if (dtMonth < 1 || dtMonth > 12)
- return false;
- else if (dtDay < 1 || dtDay > 31)
- return false;
- else if ((dtMonth == 4 || dtMonth == 6 || dtMonth == 9 || dtMonth == 11) && dtDay == 31)
- return false;
- else if (dtMonth == 2) {
- var isleap = (dtYear % 4 == 0 && (dtYear % 100 != 0 || dtYear % 400 == 0));
- if (dtDay > 29 || (dtDay == 29 && !isleap))
- return false;
- }
- return true;
- }
- //load the clinical Information section
- function loadClinicalInformationQuestions(requestType, onSuccessCallback) {
- if (requestType === RequestTypeUmIntake) {
- REQUEST_TYPE = requestType;
- }
- $("#loadingSpinner").dialog({
- closeOnEscape: false,
- dialogClass: 'no-close',
- resizable: false,
- title: "Loading...",
- position: {
- my: "center center",
- at: "center center",
- of: window
- },
- modal: true,
- open: function (event, ui) {
- $("#loadingSpinner").find(".ui-dialog-titlebar-close").hide();
- },
- close: function (event, ui) {
- $("#loadingSpinner").find(".ui-dialog-titlebar-close").show();
- }
- });
- var isSimulation = (requestType == "SimulateRequest");
- var networkId = $('#networkSelectWrapper').find(':selected').val();
- var clinicalUrl; var serviceRequestId; var isDssSupplemental; var determinationSupportId;
- var isRequestTypeLegacyCardiologyNewRequest = requestType == RequestTypeLegacyCardiologyNewRequest;
- if (requestType == "SimulateRequest" ||
- requestType == "NewRequest" ||
- isRequestTypeLegacyCardiologyNewRequest) {
- clinicalUrl = "/ClinicalInformation/ClinicalInfo";
- } else if (requestType == "CrmRequest") {
- clinicalUrl = "/QandARegimen/ClinicalInformation/ClinicalInfo";
- serviceRequestId = getQueryString('serviceRequestId');
- if (currentDeterminationSupportId == undefined || currentDeterminationSupportId == '')
- currentDeterminationSupportId = getQueryString('determinationSupportId');
- if (currentCrmIsDssSupplemental == undefined || currentCrmIsDssSupplemental == '')
- currentCrmIsDssSupplemental = getQueryString('isDssSupplemental');
- if (currentCrmPassedIcdId == undefined || currentCrmPassedIcdId == '') {
- currentCrmPassedIcdId = getQueryString('icdId');
- }
- if (currentClassificationId == undefined || currentClassificationId == '') {
- currentClassificationId = getQueryString('classificationId');
- }
- if (currentTreatmentMedicationTypeId == undefined || currentTreatmentMedicationTypeId == '') {
- currentTreatmentMedicationTypeId = getQueryString('treatmentMedicationTypeId');
- }
- } else if (requestType == "PortalDssRequest") {
- clinicalUrl = "/Determination/DssClinicalInformation/ClinicalInfo";
- serviceRequestId = getQueryString('serviceRequestId');
- if (currentDeterminationSupportId == undefined || currentDeterminationSupportId == '')
- currentDeterminationSupportId = getQueryString('determinationSupportId');
- if (currentCrmIsDssSupplemental == undefined || currentCrmIsDssSupplemental == '')
- currentCrmIsDssSupplemental = getQueryString('isDssSupplemental');
- if (currentCrmPassedIcdId == undefined || currentCrmPassedIcdId == '') {
- currentCrmPassedIcdId = getQueryString('icdId');
- }
- if (currentClassificationId == undefined || currentClassificationId == '') {
- currentClassificationId = getQueryString('classificationId');
- }
- if (currentTreatmentMedicationTypeId == undefined || currentTreatmentMedicationTypeId == '') {
- currentTreatmentMedicationTypeId = getQueryString('treatmentMedicationTypeId');
- }
- }
- var treatmentMedicationTypeJQueryObject = $("#ServiceRequest_TreatmentMedicationSummary_Id");
- var classificationJQueryObject = $("#ServiceRequest_DiseaseClassificationSummary_Id");
- if (treatmentMedicationTypeJQueryObject.length != 0) {
- currentTreatmentMedicationTypeId = treatmentMedicationTypeJQueryObject.attr('value');
- } else if (currentTreatmentMedicationTypeId == undefined) {
- currentTreatmentMedicationTypeId = '';
- }
- if (classificationJQueryObject.length != 0) {
- currentClassificationId = classificationJQueryObject.attr('value');
- } else if (currentClassificationId == undefined) {
- currentClassificationId = '';
- }
- var questionAnswerRequest =
- isRequestTypeLegacyCardiologyNewRequest
- ? cp.cardiology.newRequest.GenerateQuestionAnswerRequest()
- : (requestType !== RequestTypeUmIntake
- ? {
- DiagnosisCode: $('#ServiceRequest_PrimaryDiagnosis_Icd9').attr('value'),
- SpecialityId: $('#ServiceRequest_Specialty_Id').attr('value'),
- NetworkId: networkId,
- IsSimulation: isSimulation,
- ServiceId: serviceRequestId,
- DeterminationSupportId: currentDeterminationSupportId,
- IsDssSupplemental: currentCrmIsDssSupplemental,
- IcdId: currentCrmPassedIcdId,
- ClassificationId: currentClassificationId,
- TreatmentMedicationTypeId: currentTreatmentMedicationTypeId,
- PracticeId: $('#practiceSelect').val(),
- EligibilityType: 0 // Placeholder for EligibilityType
- }
- : Cp.IntakeHome.AuthRequest.Instance.GetQuestionAndAnswerRequest());
- var contentType = 'application/json; charset=utf-8';
- var data = JSON.stringify(questionAnswerRequest);
- if (requestType == "TestRequest") {
- clinicalUrl = "/RegimenRuleAdmin/ClinicalInformation/ClinicalInfo";
- data = { ruleId: currentRuleTriggerId };
- contentType = 'application/x-www-form-urlencoded; charset=UTF-8';
- } else if (requestType === RequestTypeUmIntake) {
- clinicalUrl = "/ClinicalInformation/ClinicalQAndA";
- }
- $.ajax({
- cache: false,
- data: data,
- url: clinicalUrl,
- contentType: contentType,
- dataType: 'html',
- type: 'POST',
- success: function (html) {
- try {
- $("#commonUiClinicalInformationSection").html('');
- $("#commonUiClinicalInformationSection").html(html);
- LoadSurgicalInformationSection(requestType);
- if (requestType === RequestTypeUmIntake) {
- Cp.Utilities.Instance.ScrollToElement("#clinicalInfoContainer");
- }
- if (isRequestTypeLegacyCardiologyNewRequest) {
- cp.cardiology.newRequest.serviceGroupQuestionnaireViewModel.isVisible(true);
- var allQuestionDisplayed =
- $("#commonUiClinicalInformationSection").find(".panel-section:visible").length > 0 &&
- validateQuestionAnswers(true);
- cp.cardiology.newRequest.serviceGroupQuestionnaireViewModel.AllQuestionDisplayed(allQuestionDisplayed);
- }
- if (typeof(onSuccessCallback) === "function") {
- onSuccessCallback.apply();
- }
- } finally {
- html = null;
- $("#loadingSpinner").dialog("close");
- }
- },
- error: function (xhr, ajaxOptions, thrownError) {
- alert(xhr.status);
- alert(thrownError);
- $("#loadingSpinner").dialog("close");
- }
- });
- };
- var medicationOncologyRegimenAssemblyQualifiedName = 'CarePro.Domain.MedicationOncologyRegimen, CarePro.Domain, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null';
- var radiationOncologyRegimenAssemblyQualifiedName = 'CarePro.Domain.RadiationOncologyRegimen, CarePro.Domain, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null';
- var cardiologyRegimenAssemblyQualifiedName = 'CarePro.Domain.CardiologyRegimen, CarePro.Domain, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null';
- var imagingRegimenAssemblyQualifiedName = 'CarePro.Domain.ImagingRegimen, CarePro.Domain, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null';
- //extended jquery method for building the selected regimen, tooltip for the question help text
- (function ($) {
- // TODO: ML extract all the dynamic html to the respective partial view
- //build the regimens div
- $.fn.buildRegimens = function (jsonRegimenCollection, callback, pathwayImgUrl, isPathway, isSimulation, requestType, oosItems, isReadOnly, MGFMedications) {
- var isRequestTypeUmIntake = REQUEST_TYPE === RequestTypeUmIntake;
- var renderTarget = $(this);
- var oosFramework = false;
- var outOfScopeItems = null;
- var outOfScopeAction = null;
- var requiredOptionalDrugInputNames = new Array();
- var contextRegimenAssemblyQualifiedName = "";
- var regimenDisplayTerm = "";
- var isCardiology = false;
- var isRadiationOncology = false;
- var isMedicalOncology = false;
- var isImaging = false;
- if (jsonRegimenCollection.SpecialtyName() == SpecialtyNameCardiology) {
- contextRegimenAssemblyQualifiedName = cardiologyRegimenAssemblyQualifiedName;
- regimenDisplayTerm = "Service Group Name";
- isCardiology = true;
- }
- else if (jsonRegimenCollection.SpecialtyName() == SpecialtyNameOncology) {
- contextRegimenAssemblyQualifiedName = medicationOncologyRegimenAssemblyQualifiedName;
- regimenDisplayTerm = "Compendium regimens";
- isMedicalOncology = true;
- }
- else if (jsonRegimenCollection.SpecialtyName() == SpecialtyNameImaging) {
- contextRegimenAssemblyQualifiedName = imagingRegimenAssemblyQualifiedName;
- regimenDisplayTerm = "Service Group Name";
- isImaging = true;
- }
- else {
- contextRegimenAssemblyQualifiedName = radiationOncologyRegimenAssemblyQualifiedName;
- regimenDisplayTerm = "Treatment Modality";
- isRadiationOncology = true;
- }
- if (oosItems != null && oosItems != undefined && oosItems != "") {
- outOfScopeItems = oosItems.OutOfSupportedScopeItems != null ? oosItems.OutOfSupportedScopeItems : null;
- outOfScopeAction = oosItems.OutOfSupportedScopeActionInfo != null ? oosItems.OutOfSupportedScopeActionInfo : null;
- }
- if (outOfScopeItems != undefined && outOfScopeItems != null) {
- oosFramework = true;
- }
- var hasProcedures = false;
- if (jsonRegimenCollection.RequiredRegimenProcedures != undefined) {
- hasProcedures = true;
- }
- var oosDisableButton = false;
- var selectedRegimen = {
- Name: null,
- IsPathway: null,
- IsAutoApprovable: null,
- RiskFactor: null,
- Id: null,
- RequiredRegimenMedications: new Array(),
- OptionalRegimenMedications: new Array(),
- RequiredRegimenProcedures: new Array(),
- OptionalRegimenProcedures: new Array(),
- StatusCode: 1,
- MaximumDuration: 0,
- ModelType: contextRegimenAssemblyQualifiedName
- };
- // for test page
- if ((requestType == undefined || requestType == null) && (isSimulation == undefined || isSimulation == null)) {
- isSimulation = 'true';
- }
- var pwayTarget = $("<div></div>")
- .addClass("PwayTarget");
- var nonPwayContainer = $("<div></div>")
- .hide()
- .addClass("NPwaysContainer");
- if (isSimulation) {
- nonPwayContainer.append($("<a href='javascript:void(0)' class='dispPathways'>Click to view " + regimenDisplayTerm + ".</a>").click(function () {
- $(".NPwayTarget").show();
- $(this).hide();
- }));
- }
- var nonPwayTarget = $("<div></div>").addClass("NPwayTarget").hide();
- if (isPathway) {
- renderTarget.append(pwayTarget);
- // .append($("<div id='nonRegimenStatus' style='text-align: center;'>Checking for Compendium regimens<span class='loading_spinner_non_pathway'><img src='../../Content/themes/base/images/spinnerSmall.gif' /></span></div>"));
- } else {
- renderTarget.append(nonPwayContainer);
- nonPwayContainer.append(nonPwayTarget);
- //clear status indicator if no regimens found, othewise just hide spinner
- if (jsonRegimenCollection.length == 0) {
- $("#nonRegimenStatus").html('No ' + regimenDisplayTerm + ' exist.');
- } else {
- $('.nonRegimenMedsButtonGroup').show();
- $("#nonRegimenStatus").hide();
- }
- }
- var hasPathwayImg = pathwayImgUrl != null && pathwayImgUrl != "" && pathwayImgUrl != undefined;
- var compiledTemplate;
- function createRegimenMedication(regData, mgfMedications) {
- var newRegimen = compiledTemplate.clone();
- newRegimen.find(".regRisk").text(getRiskText(GetObjectValue(regData.RiskFactor)));
- newRegimen.find(".regNeuRisk").text(getRiskText(GetObjectValue(regData.RiskFactorNeutropenic)));
- newRegimen.find(".regName").text(GetObjectValue(regData.Name));
- newRegimen.find(".regCost").text(addUSD(regData.RegimenCost));
- newRegimen.data('data-regimen', regData);
- var regDataRequiredRegimenMedications = GetObjectValue(regData.RequiredRegimenMedications);
- var regDataOptionalRegimenMedications = GetObjectValue(regData.OptionalRegimenMedications);
- var requiredMeds = (regDataRequiredRegimenMedications == null || regDataRequiredRegimenMedications === undefined || regDataRequiredRegimenMedications.length == 0) ? null : groupMedsByOrder(regDataRequiredRegimenMedications);
- var optionalMeds = (regDataOptionalRegimenMedications == null || regDataOptionalRegimenMedications === undefined || regDataOptionalRegimenMedications.length == 0) ? null : groupMedsByOrder(regDataOptionalRegimenMedications);
- var requiredMedsListItems = buildListItemMedications(requiredMeds, true);
- var supportMedsListItems = buildListItemMedications(optionalMeds, false);
- var reqMedsList = newRegimen.find("div ul.reqMeds");
- var optMedsList = newRegimen.find("div ul.optMeds");
- $.each(requiredMedsListItems, function (index, currentData) { appendDrugsToList(reqMedsList, currentData); });
- $.each(supportMedsListItems, function (index, currentData) { appendDrugsToList(optMedsList, currentData); });
- var regDataMGfMedications = GetObjectValue(mgfMedications);
- // Check MgfForHighRisk
- if (regData.RiskFactorNeutropenic() == "725060004" && regDataMGfMedications != null && regDataMGfMedications != undefined && regDataMGfMedications.length != null) {
- var mgfMeds = regDataMGfMedications;
- var mgfMedsListItems = buildListItemMGFMedications(mgfMeds, false);
- var mgfMedsList = newRegimen.find("div ul.mgfMeds");
- $.each(mgfMedsListItems, function (index, currentData) { appendDrugsToList(mgfMedsList, currentData); });
- newRegimen.find(".mgfMedsDiv").show();
- } else {
- newRegimen.find(".mgfMedsDiv").hide();
- }
- if (supportMedsListItems && supportMedsListItems.length == 0) {
- newRegimen.find(".clearOptMeds").hide();
- }
- var regDataIsPathway = GetObjectValue(regData.IsPathway);
- if (regDataIsPathway != null) {
- if (regDataIsPathway && hasPathwayImg)
- newRegimen.find(".pathwayImg").append($("<img></img>").attr("src", pathwayImgUrl));
- else
- newRegimen.find(".pathwayImg").remove();
- pwayTarget.append(newRegimen);
- } else if (regDataRequiredRegimenMedications != null && regDataRequiredRegimenMedications != "") {
- newRegimen.find(".pathwayImg").remove();
- nonPwayTarget.append(newRegimen);
- nonPwayContainer.show();
- } else {
- $(".regimenOptionButtonToHideGroup").hide();
- // no regimens. forward to the search box
- if (isSimulation == undefined || !isSimulation) {
- $("#requestedItemsContainer").load("/NewRequest/NonRegimenSelect", {}); // not being used
- }
- }
- newRegimen.find(".chooseRegimen").click(function (button) {
- button.preventDefault();
- processChooseRegimen(packageJsonMedication, newRegimen);
- });
- newRegimen.find(".cancel").click(function (button) {
- $('#page-selection .regimen-selection-table tbody tr').closest('tr').removeClass('selected');
- $(".subpage").removeClass('active');
- $(".subpage").hide();
- $("#regimens").html('');
- $(".btnDivLayout").show();
- });
- //add click event to clear optional meds button
- newRegimen.find(".clearOptMeds").click(function (e) {
- newRegimen.find(".optMeds").find(":input").attr('checked', false);
- e.preventDefault();
- });
- // add click event to clear MGF meds button
- newRegimen.find(".clearMgfMeds").click(function (e) {
- newRegimen.find(".mgfMeds").find(":input").attr('checked', false);
- e.preventDefault();
- });
- newRegimen.show();
- }
- function createRegimenProcedure(regData) {
- var newRegimen = compiledTemplate.clone();
- newRegimen.find(".regName").text(GetObjectValue(regData.Name));
- newRegimen.data('data-regimen', regData);
- var regDataRequiredRegimenProcedures = GetObjectValue(regData.RequiredRegimenProcedures);
- var regDataOptionalRegimenProcedures = GetObjectValue(regData.OptionalRegimenProcedures);
- var requiredProcs = (regDataRequiredRegimenProcedures == null || regDataRequiredRegimenProcedures == undefined || regDataRequiredRegimenProcedures.length == 0) ? null : groupProcsByOrder(regDataRequiredRegimenProcedures);
- var optionalProcs = (regDataOptionalRegimenProcedures == null || regDataOptionalRegimenProcedures == undefined || regDataOptionalRegimenProcedures.length == 0) ? null : groupProcsByOrder(regDataOptionalRegimenProcedures);
- var requiredProcsListItems = buildListItemProcedures(requiredProcs, true);
- var optionalProcsListItems = buildListItemProcedures(optionalProcs, false);
- var reqProcsList = newRegimen.find("div ul.reqProcs");
- var optProcsList = newRegimen.find("div ul.optProcs");
- $.each(requiredProcsListItems, function (index, currentData) { appendDrugsToList(reqProcsList, currentData); });
- $.each(optionalProcsListItems, function (index, currentData) { appendDrugsToList(optProcsList, currentData); });
- if (optionalProcsListItems && optionalProcsListItems.length == 0) {
- newRegimen.find(".clearOptProcs").hide();
- }
- var regDataIsPathway = GetObjectValue(regData.IsPathway);
- if (regDataIsPathway != null) {
- if (regDataIsPathway && hasPathwayImg)
- newRegimen.find(".pathwayImg").append($("<img></img>").attr("src", pathwayImgUrl));
- else
- newRegimen.find(".pathwayImg").remove();
- pwayTarget.append(newRegimen);
- } else if (regDataRequiredRegimenProcedures != null && regDataRequiredRegimenProcedures != "") {
- newRegimen.find(".pathwayImg").remove();
- nonPwayTarget.append(newRegimen);
- nonPwayContainer.show();
- } else {
- $(".regimenOptionButtonToHideGroup").hide();
- // no regimens. forward to the search box
- if (isSimulation == undefined || !isSimulation) {
- $("#requestedItemsContainer").load("/NewRequest/NonRegimenSelect", {}); // not being used
- }
- }
- newRegimen.find(".chooseRegimen").click(function (button) {
- button.preventDefault();
- processChooseRegimen(packageJsonProcedure, newRegimen);
- });
- newRegimen.find(".cancel").click(function (button) {
- $('#page-selection .regimen-selection-table tbody tr').closest('tr').removeClass('selected');
- $(".subpage").removeClass('active');
- $(".subpage").hide();
- $("#regimens").html('');
- $(".btnDivLayout").show();
- });
- //add click event to clear optional procs button
- newRegimen.find(".clearOptProcs").click(function (e) {
- newRegimen.find(".optProcs").find(":input").attr('checked', false);
- e.preventDefault();
- });
- newRegimen.show();
- }
- function CreateCardiologyRegimen(regData) {
- var newRegimen = compiledTemplate.clone();
- newRegimen.find(".regName").text(GetObjectValue(regData.Name));
- newRegimen.data('data-regimen', regData);
- var regDataRequiredRegimenProcedures = GetObjectValue(regData.RequiredRegimenProcedures);
- var regDataRequiredRegimenMedications = GetObjectValue(regData.RequiredRegimenMedications);
- var requiredProcs = (regDataRequiredRegimenProcedures == null || regDataRequiredRegimenProcedures == undefined || regDataRequiredRegimenProcedures.length == 0) ? null : groupProcsByOrder(regDataRequiredRegimenProcedures);
- var requiredMeds = (regDataRequiredRegimenMedications == null || regDataRequiredRegimenMedications == undefined || regDataRequiredRegimenMedications.length == 0) ? null : groupMedsByOrder(regDataRequiredRegimenMedications);
- var requiredProcsListItems = buildListItemProcedures(requiredProcs, true);
- var requiredMedsListItems = buildListItemMedications(requiredMeds, true);
- var reqProcsList = newRegimen.find("div ul.reqProcs");
- var reqMedsList = newRegimen.find("div ul.reqMeds");
- $.each(requiredProcsListItems, function (index, currentData) { appendDrugsToList(reqProcsList, currentData); });
- $.each(requiredMedsListItems, function (index, currentData) {
- appendDrugsToList(reqMedsList, currentData);
- });
- var regDataIsPathway = GetObjectValue(regData.IsPathway);
- if (regDataIsPathway != null) {
- if (regDataIsPathway && hasPathwayImg)
- newRegimen.find(".pathwayImg").append($("<img></img>").attr("src", pathwayImgUrl));
- else
- newRegimen.find(".pathwayImg").remove();
- pwayTarget.append(newRegimen);
- } else if (regDataRequiredRegimenProcedures != null && regDataRequiredRegimenProcedures != "") {
- newRegimen.find(".pathwayImg").remove();
- nonPwayTarget.append(newRegimen);
- nonPwayContainer.show();
- } else {
- $(".regimenOptionButtonToHideGroup").hide();
- // no regimens. forward to the search box
- if (isSimulation == undefined || !isSimulation) {
- $("#requestedItemsContainer").load("/NewRequest/NonRegimenSelect", {}); // not being used
- }
- }
- newRegimen.find(".chooseRegimen").click(function (button) {
- button.preventDefault();
- processChooseRegimen(PackageRegimenJson, newRegimen);
- });
- newRegimen.find(".cancel").click(function (button) {
- $('#page-selection .regimen-selection-table tbody tr').closest('tr').removeClass('selected');
- $(".subpage").removeClass('active');
- $(".subpage").hide();
- $("#regimens").html('');
- $(".btnDivLayout").show();
- });
- //add click event to clear optional procs button
- newRegimen.find(".clearOptProcs").click(function (e) {
- newRegimen.find(".optProcs").find(":input").attr('checked', false);
- e.preventDefault();
- });
- newRegimen.show();
- }
- function CreateRegimen(regData) {
- var newRegimen = compiledTemplate.clone();
- newRegimen.find(".regName").text(GetObjectValue(regData.Name));
- newRegimen.data('data-regimen', regData);
- var requiredProcs = !regData.HasRequiredRegimenProcedures ? null : groupProcsByOrder(GetObjectValue(regData.RequiredRegimenProcedures));
- var requiredMeds = !regData.HasRequiredRegimenMedications ? null : groupMedsByOrder(GetObjectValue(regData.RequiredRegimenMedications));
- var optionalProcs = !regData.HasOptionalRegimenProcedures ? null : groupProcsByOrder(GetObjectValue(regData.OptionalRegimenProcedures));
- var optionalMeds = !regData.HasOptionalRegimenMedications ? null : groupMedsByOrder(GetObjectValue(regData.OptionalRegimenMedications));
- var requiredProcsListItems = buildListItemProcedures(requiredProcs, true);
- var requiredMedsListItems = buildListItemMedications(requiredMeds, true);
- var optionalProcsListItems = buildListItemProcedures(optionalProcs, false);
- var optionalMedsListItems = buildListItemMedications(optionalMeds, false);
- var reqProcsList = newRegimen.find("div ul.reqProcs");
- var reqMedsList = newRegimen.find("div ul.reqMeds");
- var optProcsList = newRegimen.find("div ul.optProcs");
- var optMedsList = newRegimen.find("div ul.optMeds");
- $.each(requiredProcsListItems, function (index, currentData) {
- appendDrugsToList(reqProcsList, currentData);
- });
- $.each(requiredMedsListItems, function (index, currentData) {
- appendDrugsToList(reqMedsList, currentData);
- });
- $.each(optionalProcsListItems, function (index, currentData) {
- appendDrugsToList(optProcsList, currentData);
- });
- $.each(optionalMedsListItems, function (index, currentData) {
- appendDrugsToList(optMedsList, currentData);
- });
- var regDataIsPathway = GetObjectValue(regData.IsPathway);
- if (regDataIsPathway != null) {
- if (regDataIsPathway && hasPathwayImg)
- newRegimen.find(".pathwayImg").append($("<img></img>").attr("src", pathwayImgUrl));
- else
- newRegimen.find(".pathwayImg").remove();
- pwayTarget.append(newRegimen);
- } else if (regData.HasRequiredRegimenProcedures ||
- regData.HasRequiredRegimenMedications) {
- newRegimen.find(".pathwayImg").remove();
- nonPwayTarget.append(newRegimen);
- nonPwayContainer.show();
- } else {
- $(".regimenOptionButtonToHideGroup").hide();
- // no regimens. forward to the search box
- if (isSimulation == undefined || !isSimulation) {
- $("#requestedItemsContainer").load("/NewRequest/NonRegimenSelect", {}); // not being used
- }
- }
- newRegimen.find(".chooseRegimen").click(function (button) {
- button.preventDefault();
- processChooseRegimen(PackageRegimenJson, newRegimen);
- });
- newRegimen.find(".cancel").click(function (button) {
- $('#page-selection .regimen-selection-table tbody tr').closest('tr').removeClass('selected');
- $(".subpage").removeClass('active');
- $(".subpage").hide();
- $("#regimens").html('');
- $(".btnDivLayout").show();
- });
- //add click event to clear optional procs button
- newRegimen.find(".clearOptProcs").click(function (e) {
- newRegimen.find(".optProcs").find(":input").attr('checked', false);
- e.preventDefault();
- });
- //add click event to clear optional meds button
- newRegimen.find(".clearOptMeds").click(function (e) {
- newRegimen.find(".optMeds").find(":input").attr('checked', false);
- e.preventDefault();
- });
- // add click event to clear MGF meds button
- newRegimen.find(".clearMgfMeds").click(function (e) {
- newRegimen.find(".mgfMeds").find(":input").attr('checked', false);
- e.preventDefault();
- });
- newRegimen.show();
- }
- function processChooseRegimen(packageJsonDataCallBack, newRegimen) {
- HideRequiredServiceItemSelectionError();
- $(".chooseRegimen").attr('disabled', true);
- if (packageJsonDataCallBack(newRegimen, requestType)) {
- if (isRequestTypeUmIntake) {
- Cp.IntakeHome.AuthRequest.Instance.ProcessRegimenSelection();
- }
- else if (requestType == undefined || requestType != "CrmRequest") {
- $(".btnDivLayout").show();
- $("#Ntm").hide();
- }
- $('.regimenOptionButtonToHideGroup').hide();
- $(".subpage").removeClass('active');
- $(".subpage").hide();
- $("#regimens").html('');
- } else {
- ShowRequiredServiceItemSelectionError();
- alert("Required data missing");
- $(".chooseRegimen").removeAttr("disabled");
- }
- }
- function HideRequiredServiceItemSelectionError() {
- if ($("#requiredServiceItemContainerTd").length) {
- $('#requiredServiceItemContainerTd').removeClass('input-validation-error');
- $('#requiredServiceItemErrorMessageDiv').hide();
- }
- if ($("#requiredServiceItemMedContainerTd").length) {
- $('#requiredServiceItemMedContainerTd').removeClass('input-validation-error');
- $('#requiredServiceItemMedErrorMessageDiv').hide();
- }
- }
- function ShowRequiredServiceItemSelectionError() {
- if ($("#requiredServiceItemContainerTd").length) {
- $('#requiredServiceItemContainerTd').addClass('input-validation-error');
- $('#requiredServiceItemErrorMessageDiv').show();
- }
- if ($("#requiredServiceItemMedContainerTd").length) {
- $('#requiredServiceItemMedContainerTd').addClass('input-validation-error');
- $('#requiredServiceItemMedErrorMessageDiv').show();
- }
- }
- function getRiskText(riskFactor) {
- switch (riskFactor) {
- case 725060000:
- return "Unspecified";
- break;
- case 725060001:
- return "Minimal";
- break;
- case 725060002:
- return "Low";
- break;
- case 725060003:
- return "Moderate";
- break;
- case 725060004:
- return "High";
- break;
- case 725060005:
- return "Intermediate";
- }
- return "Not Specified";
- }
- function formatCurrency(value) {
- if (value != undefined && value != null)
- return "$" + value();
- }
- function addUSD(regimenCost) {
- if (regimenCost != undefined && regimenCost != null && regimenCost != '') {
- var regimenAverageCost = GetObjectValue(regimenCost.AverageCost);
- if (regimenAverageCost != undefined && regimenAverageCost != null && regimenAverageCost != '')
- return regimenAverageCost;
- }
- }
- function isOutOfScope(id) {
- var returnValue = false;
- if (outOfScopeItems != undefined && outOfScopeItems != null && outOfScopeItems != '') {
- $.each(outOfScopeItems, function (index, outOfScopeItem) {
- if (outOfScopeItem.ScopeItemId == id) {
- returnValue = true;
- }
- });
- }
- return returnValue;
- }
- function buildTemplateMedication(showCost, regimenCost) {
- var template = $("<div></div>").addClass("regTemplate").hide();
- var costTitle = "Estimated Cost Calculation";
- try {
- var clearSupportiveMeds = isReadOnly ? "" : $("<a class='clearOptMeds clear-regimen' title='Clear all supportive medication(s)'>Clear All</a>");
- var clearMgfMeds = isReadOnly ? "" : $("<a class='clearMgfMeds clear-regimen' title='Clear all MGF medication(s)'>Clear</a>");
- template.append($("<table cellpadding='4'></table>").addClass("regimen-panel")
- .append($("<tr></tr>")
- .append($("<td></td>").addClass("selected-regimen-label").text("Regimen Name"))
- .append($("<td></td>").addClass("selected-regimen-label").text(costTitle).attr("style", "visibility:" + showCost)
- .append(" <span class='estimatedCostCalculationToolTip' data-content='The estimated cost calculation is based on anti-cancer medications for three months of therapy using Average Sales Price (ASP) + 6% or Wholesale Acquisition Cost (WAC), if there is no ASP +6%. The calculation is based on an average BSA of 1.8 or weight of 68kg, using the standard dosing and most common frequency for the regimen selected. The cost for anti-emetics and /or growth factors are included in the cost when a regimen with high risk for emesis and/or febrile neutropenia is chosen.' data-title='Estimated Cost Calculation' data-container='body' data-toggle='popover'></span>"))
- .append($("<td></td>").text(""))
- .append($("<td></td>").addClass("selected-regimen-label").text("Emetogenic Risk"))
- .append($("<td></td>").addClass("selected-regimen-label").text("Neutropenic Risk")))
- .append($("<tr></tr>")
- .append($("<td></td>").addClass("selected-regimen-name")
- .append($("<div></div>").addClass("pathwayImg").attr("style", "clear:both"))
- .append($("<span></span>").addClass("regName")))
- .append($("<td></td>").addClass("selected-regimen-name")
- .append($("<span></span>").addClass("regCost")).attr("style", "visibility:" + showCost))
- .append($("<td></td>").text(""))
- .append($("<td></td>").addClass("selected-regimen-name")
- .append($("<span></span>").addClass("regRisk")))
- .append($("<td></td>").addClass("selected-regimen-name")
- .append($("<span></span>").addClass("regNeuRisk"))))
- .append($("<tr></tr>")
- .append($("<td></td>")
- .append($("<h3>Required Medication(s)</h3>").addClass("regimen-panel-section-heading")))
- .append($("<td colspan=4></td>")
- .append($("<h3>Supportive Medication(s)</h3>").addClass("regimen-panel-section-heading").append(clearSupportiveMeds))))
- .append($("<tr></tr>")
- .append($("<td valign='top'></td>")
- .append($("<div></div>").addClass("medListDiv requiredMedsDiv")
- .append($("<ul style='width: 450px; margin-left: 10px;'></ul>").addClass("reqMeds")))
- .append($("<div></div>").addClass("mgfMedsDiv")
- .append($("<h3>MGF Medication(s)</h3>").addClass("regimen-panel-section-heading").append(clearMgfMeds))
- .append($("<ul style='width: 450px; margin-left: 10px;'></ul>").addClass("mgfMeds"))))
- .append($("<td colspan=4 valign='top'></td>")
- .append($("<div></div>").addClass("medListDiv supportMedsDiv")
- .append($("<ul style='width: 450px; margin-left: 10px;'></ul>").addClass("optMeds")))))
- );
- if (!isReadOnly && !isRequestTypeUmIntake) {
- template.append($("<div></div>").addClass("pull-left").append($("<a class='cancel' id='cancel'></a>").append($("<span class='remove-x close' style='margin-right:5px'></span>").text("X"))
- .append($("<a class='cancel'></a>").text("Cancel & Select Another Regimen"))));
- }
- var useRegimenButtonCaption = isRequestTypeUmIntake ? "OK" : "Use This Regimen With Selections";
- if (isSimulation != 'true' && !isReadOnly) {
- template.append($("<div></div>").addClass("selectRegDiv pull-right")
- .append($("<button id='btnUseThisRegimen' class='moveforwardbtnStyle')></button>").addClass("chooseRegimen").text(useRegimenButtonCaption)));
- }
- return template;
- } finally {
- template = null;
- }
- }
- function buildTemplateProcedure() {
- var template = $("<div></div>").addClass("regTemplate").hide();
- try {
- var clearSupportiveProcs = isReadOnly ? "" : $("<a class='clearOptProcs clear-regimen' title='Clear all supportive procedure(s)'>Clear All</a>");
- template.append($("<table cellpadding='4'></table>").addClass("regimen-panel")
- .append($("<tr></tr>")
- .append($("<td></td>").addClass("selected-regimen-label").text("Treatment Modality"))
- .append($("<td></td>").text("")))
- .append($("<tr></tr>")
- .append($("<td></td>").addClass("selected-regimen-name")
- .append($("<div></div>").addClass("pathwayImg").attr("style", "clear:both"))
- .append($("<span></span>").addClass("regName")))
- .append($("<td></td>").text("")))
- .append($("<tr></tr>")
- .append($("<td></td>")
- .append($("<h3>Required Treatment(s)</h3>").addClass("regimen-panel-section-heading")))
- .append($("<td></td>")
- .append($("<h3>Optional Treatment(s)</h3>").addClass("regimen-panel-section-heading").append(clearSupportiveProcs))))
- .append($("<tr></tr>")
- .append($("<td id='requiredServiceItemContainerTd' valign='top'></td>")
- .append($("<div></div>").addClass("medListDiv requiredMedsDiv")
- .append($("<ul style='width: 450px; margin-left: 10px;'></ul>").addClass("reqProcs")))
- .append($("<div id='requiredServiceItemErrorMessageDiv' style='display:none;color:red;'>Selection required</div>")))
- .append($("<td valign='top'></td>")
- .append($("<div></div>").addClass("medListDiv supportMedsDiv")
- .append($("<ul style='width: 450px; margin-left: 10px;'></ul>").addClass("optProcs")))))
- );
- if (!isReadOnly && !isRequestTypeUmIntake) {
- template.append($("<div></div>").addClass("pull-left").append($("<a class='cancel' id='cancel'></a>").append($("<span class='remove-x close' style='margin-right:5px'></span>").text("X"))
- .append($("<a class='cancel'></a>").text("Cancel & Select Another Treatment Modality"))));
- }
- var useRegimenButtonCaption = isRequestTypeUmIntake ? "OK" : "Use This Treatment Plan With Selections";
- if (isSimulation != 'true' && !isReadOnly)
- template.append($("<div></div>").addClass("selectRegDiv pull-right")
- .append($("<button id='btnUseThisRegimen' class='moveforwardbtnStyle')></button>").addClass("chooseRegimen").text(useRegimenButtonCaption)));
- return template;
- } finally {
- template = null;
- }
- }
- function BuildCardiologyTemplate(requiredRegimenMedications) {
- var template = $("<div></div>").addClass("regTemplate").hide();
- try {
- var templateTable =
- $("<table cellpadding='4'></table>").addClass("regimen-panel")
- .append($("<tr></tr>")
- .append($("<td></td>").addClass("selected-regimen-label").text(regimenDisplayTerm))
- .append($("<td></td>").text("")))
- .append($("<tr></tr>")
- .append($("<td></td>").addClass("selected-regimen-name")
- .append($("<div></div>").addClass("pathwayImg").attr("style", "clear:both"))
- .append($("<span></span>").addClass("regName")))
- .append($("<td></td>").text("")))
- .append($("<tr></tr>")
- .append($("<td></td>")
- .append($("<h3>Recommended Procedure(s)</h3>").addClass("regimen-panel-section-heading")))
- .append($("<td></td>")))
- .append($("<tr></tr>")
- .append($("<td id='requiredServiceItemContainerTd' valign='top'></td>")
- .append($("<div></div>").addClass("medListDiv requiredProcsDiv")
- .append($("<ul style='width: 450px; margin-left: 10px;'></ul>").addClass("reqProcs")))
- .append($("<div id='requiredServiceItemErrorMessageDiv' style='display:none;color:red;'>Selection required</div>")))
- .append($("<td></td>")));
- if (requiredRegimenMedications().length != 0) {
- templateTable = templateTable
- .append($("<tr id='requiredMedicationTr'></tr>")
- .append($("<td></td>")
- .append($("<h3>Required Medication(s)</h3>").addClass("regimen-panel-section-heading")))
- .append($("<td></td>")))
- .append($("<tr></tr>")
- .append($("<td id='requiredServiceItemMedContainerTd' valign='top'></td>")
- .append($("<div></div>").addClass("medListDiv requiredMedsDiv")
- .append($("<ul style='width: 450px; margin-left: 10px;'></ul>").addClass("reqMeds")))
- .append($("<div id='requiredServiceItemMedErrorMessageDiv' style='display:none;color:red;'>Selection required</div>")))
- .append($("<td></td>")));
- }
- template.append(templateTable);
- if (!isReadOnly && !isRequestTypeUmIntake) {
- template.append($("<div></div>").addClass("pull-left").append($("<a class='cancel' id='cancel'></a>").append($("<span class='remove-x close' style='margin-right:5px'></span>").text("X"))
- .append($("<a class='cancel'></a>").text("Cancel & Select Another " + regimenDisplayTerm))));
- }
- var useRegimenButtonCaption = isRequestTypeUmIntake ? "OK" : "Use This Treatment Plan With Selections";
- if (isSimulation != 'true' && !isReadOnly)
- template.append($("<div></div>").addClass("selectRegDiv pull-right")
- .append($("<button id='btnUseThisRegimen' class='moveforwardbtnStyle')></button>").addClass("chooseRegimen").text(useRegimenButtonCaption)));
- return template;
- } finally {
- template = null;
- }
- }
- function BuildRegimenTemplate(regimenData) {
- var template = $("<div></div>").addClass("regTemplate").hide();
- try {
- var templateTable =
- $("<table cellpadding='4'></table>").addClass("regimen-panel");
- if (regimenData.HasRequiredRegimenProcedures) {
- templateTable = templateTable
- .append($("<tr></tr>")
- .append($("<td></td>").addClass("selected-regimen-label").text(regimenDisplayTerm))
- .append($("<td></td>").text("")))
- .append($("<tr></tr>")
- .append($("<td></td>").addClass("selected-regimen-name")
- .append($("<div></div>").addClass("pathwayImg").attr("style", "clear:both"))
- .append($("<span></span>").addClass("regName")))
- .append($("<td></td>").text("")))
- .append($("<tr></tr>")
- .append($("<td></td>")
- .append($("<h3>Recommended Procedure(s)</h3>").addClass("regimen-panel-section-heading")))
- .append($("<td></td>")))
- .append($("<tr></tr>")
- .append($("<td id='requiredServiceItemContainerTd' valign='top'></td>")
- .append($("<div></div>").addClass("medListDiv requiredProcsDiv")
- .append($("<ul style='width: 450px; margin-left: 10px;'></ul>").addClass("reqProcs")))
- .append($(
- "<div id='requiredServiceItemErrorMessageDiv' style='display:none;color:red;'>Selection required</div>")))
- .append($("<td></td>")));
- }
- if (regimenData.HasRequiredRegimenMedications) {
- templateTable = templateTable
- .append($("<tr id='requiredMedicationTr'></tr>")
- .append($("<td></td>")
- .append($("<h3>Recommended Medication(s)</h3>").addClass("regimen-panel-section-heading")))
- .append($("<td></td>")))
- .append($("<tr></tr>")
- .append($("<td id='requiredServiceItemMedContainerTd' valign='top'></td>")
- .append($("<div></div>").addClass("medListDiv requiredMedsDiv")
- .append($("<ul style='width: 450px; margin-left: 10px;'></ul>").addClass("reqMeds")))
- .append($("<div id='requiredServiceItemMedErrorMessageDiv' style='display:none;color:red;'>Selection required</div>")))
- .append($("<td></td>")));
- }
- if (regimenData.HasOptionalRegimenProcedures) {
- var clearOptionalProcs = isReadOnly ? "" : $("<a class='clearOptProcs clear-regimen' title='Clear all optional procedure(s)'>Clear All</a>");
- templateTable = templateTable
- .append($("<tr id='optionalProcedureTr'></tr>")
- .append($("<td></td>")
- .append($("<h3>Optional Procedure(s)</h3>").addClass("regimen-panel-section-heading").append(clearOptionalProcs)))
- .append($("<td></td>")))
- .append($("<tr></tr>")
- .append($("<td id='optionalServiceItemProcContainerTd' valign='top'></td>")
- .append($("<div></div>").addClass("medListDiv optionalProcsDiv")
- .append($("<ul style='width: 450px; margin-left: 10px;'></ul>").addClass("optProcs"))))
- .append($("<td></td>")));
- }
- if (regimenData.HasOptionalRegimenMedications) {
- var clearOptionalMeds = isReadOnly ? "" : $("<a class='clearOptMeds clear-regimen' title='Clear all optional medication(s)'>Clear All</a>");
- templateTable = templateTable
- .append($("<tr id='optionalMedicationTr'></tr>")
- .append($("<td></td>")
- .append($("<h3>Optional Medication(s)</h3>").addClass("regimen-panel-section-heading").append(clearOptionalMeds)))
- .append($("<td></td>")))
- .append($("<tr></tr>")
- .append($("<td id='optionalServiceItemMedContainerTd' valign='top'></td>")
- .append($("<div></div>").addClass("medListDiv optionalMedsDiv")
- .append($("<ul style='width: 450px; margin-left: 10px;'></ul>").addClass("optMeds"))))
- .append($("<td></td>")));
- }
- template.append(templateTable);
- if (!isReadOnly && !isRequestTypeUmIntake) {
- template.append($("<div></div>").addClass("pull-left").append($("<a class='cancel' id='cancel'></a>").append($("<span class='remove-x close' style='margin-right:5px'></span>").text("X"))
- .append($("<a class='cancel'></a>").text("Cancel & Select Another " + regimenDisplayTerm))));
- }
- var useRegimenButtonCaption = isRequestTypeUmIntake ? "OK" : "Use This Treatment Plan With Selections";
- if (isSimulation != 'true' && !isReadOnly)
- template.append($("<div></div>").addClass("selectRegDiv pull-right")
- .append($("<button id='btnUseThisRegimen' class='moveforwardbtnStyle')></button>").addClass("chooseRegimen").text(useRegimenButtonCaption)));
- return template;
- } finally {
- template = null;
- }
- }
- function ShowRegimenCost(regimenCost) {
- var showCost = "hidden";
- if (regimenCost != undefined && regimenCost != null && regimenCost != '') {
- var regimenAverageCost = GetObjectValue(regimenCost.AverageCost);
- if (regimenAverageCost != undefined && regimenAverageCost != null && regimenAverageCost != '')
- showCost = "visible";
- }
- return showCost;
- }
- function packageJsonMedication(regimenDiv, contextRequestType) {
- turnOffHighlightRadioDrugs();
- if (!isRequiredOptionalDrugsSelected()) return false;
- var regData = regimenDiv.data("data-regimen");
- selectedRegimen.Id = regData.Id;
- selectedRegimen.IsAutoApprovable = regData.IsAutoApprovable;
- selectedRegimen.IsPathway = regData.IsPathway;
- selectedRegimen.Name = regData.Name;
- selectedRegimen.RiskFactor = regData.RiskFactor;
- selectedRegimen.RiskFactorNeutropenic = regData.RiskFactorNeutropenic;
- selectedRegimen.MaximumDuration = regData.MaximumDuration;
- selectedRegimen.SelectableRegimenId = regData.SelectableRegimenId;
- selectedRegimen["MGFMedications"] = new Array;
- //selectedRegimen.ModelType = medicationOncologyRegimenAssemblyQualifiedName;
- $.each(regimenDiv.find(".requiredMedsDiv input:checked"), function (index, data) { selectedRegimen.RequiredRegimenMedications.push($(data).data("data-drug")); });
- $.each(regimenDiv.find(".supportMedsDiv input:checked"), function (index, data) { selectedRegimen.OptionalRegimenMedications.push($(data).data("data-drug")); });
- $.each(regimenDiv.find(".mgfMedsDiv input:checked"), function (index, data) { selectedRegimen.MGFMedications.push($(data).data("data-drug")); });
- recursivelyRemoveWCFArtifacts(selectedRegimen.RequiredRegimenMedications);
- recursivelyRemoveWCFArtifacts(selectedRegimen.OptionalRegimenMedications);
- if (callback != null) callback(selectedRegimen, contextRequestType);
- return true;
- }
- function packageJsonProcedure(regimenDiv, contextRequestType) {
- turnOffHighlightRadioDrugs();
- if (!isRequiredOptionalDrugsSelected()) return false;
- var regData = regimenDiv.data("data-regimen");
- selectedRegimen.Id = regData.Id;
- selectedRegimen.IsAutoApprovable = regData.IsAutoApprovable;
- selectedRegimen.IsPathway = regData.IsPathway;
- selectedRegimen.Name = regData.Name;
- selectedRegimen.SelectableRegimenId = regData.SelectableRegimenId;
- //selectedRegimen.ModelType = radiationOncologyRegimenAssemblyQualifiedName;
- selectedRegimen.RequiredRegimenProcedures = new Array();
- selectedRegimen.OptionalRegimenProcedures = new Array();
- $.each(regimenDiv.find(".requiredMedsDiv input:checked"), function (index, data) { selectedRegimen.RequiredRegimenProcedures.push($(data).data("data-drug")); });
- if (selectedRegimen.RequiredRegimenProcedures.length == 0)
- return false;
- $.each(regimenDiv.find(".supportMedsDiv input:checked"), function (index, data) { selectedRegimen.OptionalRegimenProcedures.push($(data).data("data-drug")); });
- recursivelyRemoveWCFArtifactsProcedure(selectedRegimen.RequiredRegimenProcedures);
- recursivelyRemoveWCFArtifactsProcedure(selectedRegimen.OptionalRegimenProcedures);
- if (callback != null) callback(selectedRegimen, contextRequestType);
- return true;
- }
- function PackageRegimenJson(regimenDiv, contextRequestType) {
- turnOffHighlightRadioDrugs();
- if (!isRequiredOptionalDrugsSelected()) return false;
- var regData = regimenDiv.data("data-regimen");
- selectedRegimen.Id = regData.Id;
- selectedRegimen.IsAutoApprovable = regData.IsAutoApprovable;
- selectedRegimen.IsPathway = regData.IsPathway;
- selectedRegimen.Name = regData.Name;
- selectedRegimen.SelectableRegimenId = regData.SelectableRegimenId;
- selectedRegimen.AucScore = regData.AucScore;
- //selectedRegimen.ModelType = radiationOncologyRegimenAssemblyQualifiedName;
- if (regData.HasRequiredRegimenProcedures) {
- selectedRegimen.RequiredRegimenProcedures = new Array();
- $.each(regimenDiv.find(".requiredProcsDiv input:checked"), function (index, data) { selectedRegimen.RequiredRegimenProcedures.push($(data).data("data-drug")); });
- if (selectedRegimen.RequiredRegimenProcedures.length == 0) {
- return false;
- }
- recursivelyRemoveWCFArtifactsProcedure(selectedRegimen.RequiredRegimenProcedures);
- }
- if (regData.HasRequiredRegimenMedications) {
- selectedRegimen.RequiredRegimenMedications = new Array();
- $.each(regimenDiv.find(".requiredMedsDiv input:checked"), function (index, data) { selectedRegimen.RequiredRegimenMedications.push($(data).data("data-drug")); });
- if ($("#requiredMedicationTr").length && selectedRegimen.RequiredRegimenMedications.length == 0) {
- return false;
- }
- recursivelyRemoveWCFArtifacts(selectedRegimen.RequiredRegimenMedications);
- }
- if (regData.HasOptionalRegimenProcedures) {
- selectedRegimen.OptionalRegimenProcedures = new Array();
- $.each(regimenDiv.find(".optionalProcsDiv input:checked"), function (index, data) { selectedRegimen.OptionalRegimenProcedures.push($(data).data("data-drug")); });
- recursivelyRemoveWCFArtifactsProcedure(selectedRegimen.OptionalRegimenProcedures);
- }
- if (regData.HasOptionalRegimenMedications) {
- selectedRegimen.OptionalRegimenMedications = new Array();
- $.each(regimenDiv.find(".optionalMedsDiv input:checked"), function (index, data) { selectedRegimen.OptionalRegimenMedications.push($(data).data("data-drug")); });
- recursivelyRemoveWCFArtifacts(selectedRegimen.OptionalRegimenMedications);
- }
- if (callback != null) callback(selectedRegimen, contextRequestType);
- return true;
- }
- function recursivelyRemoveWCFArtifacts(drugCollection) {
- removeAsstacularTypeArtifact(drugCollection);
- for (var i = 0; i < drugCollection.length; i++) {
- var drug = drugCollection[i];
- removeAsstacularTypeArtifact(drug);
- if (drug.Dosing() != null && drug.Dosing().length > 0) {
- for (var n = 0; n < drug.Dosing().length; n++) {
- removeAsstacularTypeArtifact(drug.Dosing()[n]);
- if (drug.Dosing()[n].DirectionForUses() != null && drug.Dosing()[n].DirectionForUses().length > 0) {
- for (var r = 0; r < drug.Dosing()[n].DirectionForUses().length; r++) {
- removeAsstacularTypeArtifact(drug.Dosing()[n].DirectionForUses()[r]);
- }
- }
- }
- }
- if (drug.Medication() != null && drug.Medication().length > 0) {
- for (var n = 0; n < drug.Medication().length; n++) {
- removeAsstacularTypeArtifact(drug.Medication()[n]);
- }
- }
- }
- }
- function recursivelyRemoveWCFArtifactsProcedure(drugCollection) {
- removeAsstacularTypeArtifact(drugCollection);
- for (var i = 0; i < drugCollection.length; i++) {
- var drug = drugCollection[i];
- removeAsstacularTypeArtifact(drug);
- removeAsstacularTypeArtifact(drug.Procedure);
- }
- }
- function removeAsstacularTypeArtifact(currentObj) {
- delete currentObj.__type;
- }
- function appendDrugsToList(list, drug) {
- list.append(drug);
- }
- function groupMedsByOrder(drugCollection) {
- var drugGroups = new Array();
- var currentRank = GetObjectValue(drugCollection[0].Order);
- for (var i = 0; i < drugCollection.length; i++) {
- var med = drugCollection[i];
- var medOrder = GetObjectValue(med.Order);
- if (drugGroups[medOrder - 1] == null) drugGroups[medOrder - 1] = new Array();
- drugGroups[medOrder - 1].push(med);
- }
- return drugGroups;
- }
- function groupProcsByOrder(drugCollection) {
- var drugGroups = new Array();
- for (var i = 0; i < drugCollection.length; i++) {
- var proc = drugCollection[i];
- var procOrder = GetObjectValue(proc.Order);
- if (procOrder < 0) procOrder = 0;
- if (drugGroups[procOrder - 1] == null)
- drugGroups[procOrder - 1] = new Array();
- drugGroups[procOrder - 1].push(proc);
- }
- return drugGroups;
- }
- function buildListItemMGFMedications(drugGroups, isRequired) {
- if (drugGroups == null) return [];
- var list = new Array();
- for (var i = 0; i < drugGroups.length; i++) {
- var drugGroup = drugGroups[i];
- var li = $("<li></li>").addClass('indent');
- if (drugGroup != undefined) {
- var drug = drugGroup;
- var drugMeds = GetObjectValue(drug.Medication);
- var drugId = GetObjectValue(drugMeds[0].Id);
- var drugMedCode = GetObjectValue(drugMeds[0].Code);
- var drugMedGenericName = GetObjectValue(drugMeds[0].GenericName);
- var drugMedBrandName = GetObjectValue(drugMeds[0].BrandName);
- var input = $("<input type='radio' name='mgfMed' id='" + drugId + "' />");
- input.click(function (e) { e.stopPropagation(); });
- input.val(drugId);
- input.data("data-drug", drugGroup);
- var drugText = $("<label for='" + drugId + "'></label>").text(drugMedCode + '-' + drugMedGenericName + ' (' + drugMedBrandName + ')');
- if (oosFramework == true) {
- if (isOutOfScope(drug.Medication()[0].Id())) {
- if ((outOfScopeAction != undefined && outOfScopeAction != null) && outOfScopeAction.OutOfSupportedScopeActionType == "725060002") {
- input.attr("disabled", true);
- }
- //drugText.append(oosText);
- }
- }
- li.append(input);
- li.append(drugText);
- list.push(li);
- }
- }
- return list;
- }
- function buildListItemMedications(drugGroups, isRequired) {
- if (drugGroups == null) return [];
- //var oosText = "<label class='outOfScope'> - Out of scope</label>";
- var list = new Array();
- for (var i = 0; i < drugGroups.length; i++) {
- var group = drugGroups[i];
- var li = $("<li></li>").addClass('indent');
- if (group != undefined && group.length == 1) {
- var drug = group[0];
- var drugId = GetObjectValue(drug.Id);
- var drugMeds = GetObjectValue(drug.Medication);
- var drugMedCode = GetObjectValue(drugMeds[0].Code);
- var drugMedGenericName = GetObjectValue(drugMeds[0].GenericName);
- var drugMedBrandName = GetObjectValue(drugMeds[0].BrandName);
- var input = $("<input type='checkbox' id='" + drugId + "' />");
- input.click(function (e) { e.stopPropagation(); });
- input.val(drugId);
- if (isRequired || isReadOnly) input.attr("checked", true).attr("disabled", true);
- input.data("data-drug", drug);
- var drugText = $("<label for='" + drugId + "'></label>").text(drugMedCode + '-' + drugMedGenericName + ' (' + drugMedBrandName + ')');
- //NoMessageDecompNoMedsSplitForward = 725060000,
- //NoMessageAllowDecompMedsSplitForwardOutOfScope = 725060001,
- //ShowMessageStopDecomp = 725060002,
- if (oosFramework == true) {
- if (isOutOfScope(drug.Medication()[0].Id())) {
- if ((outOfScopeAction != undefined && outOfScopeAction != null) && outOfScopeAction.OutOfSupportedScopeActionType == "725060002") {
- if (isRequired) {
- //Set a flag to disable Regimen selection button if a required medication is OOS and Action type is 'ShowMessageStopDecomp'
- oosDisableButton = true;
- } else {
- input.attr("disabled", true);
- }
- }
- //drugText.append(oosText);
- }
- }
- li.append(input);
- li.append(drugText);
- list.push(li);
- } else if (group != undefined) {
- var orderNum = getFirstGroupOrderNumber(group);
- var groupName = generateGroupName(isRequired, orderNum, false);
- var div = "<div id='" + groupName + "'></div>";
- var indent = $(div).addClass('groupSpacing radioGroup');
- for (var j = 0; j < group.length; j++) {
- var li2 = $("<li></li>");
- var drug = group[j];
- var drugOrder = GetObjectValue(drug.Order);
- var drugId = GetObjectValue(drug.Id);
- var optId = (isRequired ? "reqMed_" : "optMed_") + drugOrder;
- var disableRadio = isReadOnly ? "disabled" : "";
- var input = $("<input type='radio' name=" + optId + " id='" + drugId + "' " + disableRadio + " />");
- input.click(function (e) { e.stopPropagation(); });
- input.val(drugId);
- input.data("data-drug", drug);
- if (isRequired) {
- requiredOptionalDrugInputNames.push(optId);
- }
- var drugMeds = GetObjectValue(drug.Medication);
- var drugMedCode = GetObjectValue(drugMeds[0].Code);
- var drugMedGenericName = GetObjectValue(drugMeds[0].GenericName);
- var drugMedBrandName = GetObjectValue(drugMeds[0].BrandName);
- var drugText = $("<label for='" + drugId + "'></label>").text(drugMedCode + '-' + drugMedGenericName + ' (' + drugMedBrandName + ')');
- if (oosFramework == true) {
- if (isOutOfScope(drug.Medication()[0].Id())) {
- if ((outOfScopeAction != undefined && outOfScopeAction != null) && outOfScopeAction.OutOfSupportedScopeActionType == "725060002") {
- input.attr("disabled", true);
- }
- //drugText.append(oosText);
- }
- }
- li2.append(input);
- li2.append(drugText);
- indent.append(li2);
- }
- li.append(indent);
- list.push(li);
- }
- }
- return list;
- }
- function getFirstGroupOrderNumber(group) {
- if (group.length > 1) {
- return GetObjectValue(group[0].Order);
- }
- return -1;
- }
- function generateGroupName(isRequired, drugOrder, isProc) {
- var suffix = isProc ? "Proc" : "Med";
- var optId = (isRequired ? "req" : "opt") + suffix + "_" + drugOrder;
- return optId;
- }
- function buildListItemProcedures(drugGroups, isRequired) {
- if (drugGroups == null) return [];
- var list = new Array();
- for (var i = 0; i < drugGroups.length; i++) {
- var group = drugGroups[i];
- var li = $("<li></li>").addClass('indent');
- if (group != undefined && group.length == 1) {
- var drug = group[0];
- var drugId = GetObjectValue(drug.Id);
- var drugProc = GetObjectValue(drug.Procedure);
- var drugProcName = GetObjectValue(drugProc.Name);
- var input = $("<input type='checkbox' id='" + drugId + "' />");
- input.click(function (e) {
- e.stopPropagation();
- if (isRequired) {
- HideRequiredServiceItemSelectionError();
- }
- });
- input.val(drugId);
- if (isRequired) input.attr("checked", true);
- if (isRequired || isReadOnly) input.attr("disabled", true);
- input.data("data-drug", drug);
- var drugText = $("<label for='" + drugId + "'></label>").text(drugProcName);
- if (oosFramework == true) {
- if (isOutOfScope(drugProc.Id())) {
- if ((outOfScopeAction != undefined && outOfScopeAction != null) && outOfScopeAction.OutOfSupportedScopeActionType == "725060002") {
- if (isRequired) {
- //Set a flag to disable Regimen selection button if a required procedure is OOS and Action type is 'ShowMessageStopDecomp'
- oosDisableButton = true;
- }
- else {
- input.attr("disabled", true);
- }
- }
- }
- }
- li.append(input);
- li.append(drugText);
- list.push(li);
- } else if (group != undefined) {
- var orderNum = getFirstGroupOrderNumber(group);
- var groupName = generateGroupName(isRequired, orderNum, true);
- var div = "<div id='" + groupName + "'></div>";
- var indent = $(div).addClass('groupSpacing radioGroup');
- for (var j = 0; j < group.length; j++) {
- var li2 = $("<li></li>");
- var drug = group[j];
- var drugId = GetObjectValue(drug.Id);
- var drugProc = GetObjectValue(drug.Procedure);
- var drugProcName = GetObjectValue(drugProc.Name);
- var drugOrder = GetObjectValue(drug.Order);
- var optId = (isRequired ? "reqProc_" : "optProc_") + drugOrder;
- var disableRadio = isReadOnly ? "disabled" : "";
- var input = $("<input type='radio' name=" + optId + " id='" + drugId + "' " + disableRadio + " />");
- input.click(function (e) {
- e.stopPropagation();
- if (isRequired) {
- HideRequiredServiceItemSelectionError();
- }
- });
- input.val(drugId);
- input.data("data-drug", drug);
- if (isRequired) {
- requiredOptionalDrugInputNames.push(optId);
- }
- var drugText = $("<label for='" + drugId + "'></label>").text(drugProcName);
- if (oosFramework == true) {
- if (isOutOfScope(drugProc.Id())) {
- if ((outOfScopeAction != undefined && outOfScopeAction != null) && outOfScopeAction.OutOfSupportedScopeActionType == "725060002") {
- if (isRequired) {
- //Set a flag to disable Regimen selection button if a required procedure is OOS and Action type is 'ShowMessageStopDecomp'
- oosDisableButton = true;
- }
- else {
- input.attr("disabled", true);
- }
- }
- }
- }
- li2.append(input);
- li2.append(drugText);
- indent.append(li2);
- }
- li.append(indent);
- list.push(li);
- }
- }
- return list;
- }
- function isRequiredOptionalDrugsSelected() {
- var isSuccess = true;
- $.each($.unique(requiredOptionalDrugInputNames), function (i, name) {
- var isSelected =
- $('.requiredMedsDiv input[name=' + name + ']:radio:checked').length > 0 ||
- $('.requiredProcsDiv input[name=' + name + ']:radio:checked').length > 0;
- if (!isSelected) {
- isSuccess = false;
- turnOnHighlightRadioDrugs(name);
- }
- });
- return isSuccess;
- }
- function turnOnHighlightRadioDrugs(id) {
- var div = "div[id='" + id + "']";
- $(div).addClass("highlightRadioDrug");
- }
- function turnOffHighlightRadioDrugs() {
- $(".radioGroup").removeClass('highlightRadioDrug');
- }
- var mgfMedications = (typeof (MGFMedications) !== "undefined" && MGFMedications != null)
- ? GetObjectValue(MGFMedications) : null;
- var requiredRegimenProcedures = typeof (jsonRegimenCollection.RequiredRegimenProcedures) !== "undefined"
- ? GetObjectValue(jsonRegimenCollection.RequiredRegimenProcedures)
- : null;
- var requiredRegimenMedications = typeof (jsonRegimenCollection.RequiredRegimenMedications) !== "undefined"
- ? GetObjectValue(jsonRegimenCollection.RequiredRegimenMedications)
- : null;
- var optionalRegimenProcedures = typeof (jsonRegimenCollection.OptionalRegimenProcedures) !== "undefined"
- ? GetObjectValue(jsonRegimenCollection.OptionalRegimenProcedures)
- : null;
- var optionalRegimenMedications = typeof (jsonRegimenCollection.OptionalRegimenMedications) !== "undefined"
- ? GetObjectValue(jsonRegimenCollection.OptionalRegimenMedications)
- : null;
- jsonRegimenCollection.HasRequiredRegimenProcedures = requiredRegimenProcedures &&
- requiredRegimenProcedures.length !== 0;
- jsonRegimenCollection.HasRequiredRegimenMedications = requiredRegimenMedications !== null &&
- requiredRegimenMedications !== undefined &&
- requiredRegimenMedications.length !== 0;
- jsonRegimenCollection.HasOptionalRegimenProcedures = optionalRegimenProcedures !== null &&
- optionalRegimenProcedures !== undefined &&
- optionalRegimenProcedures.length !== 0;
- jsonRegimenCollection.HasOptionalRegimenMedications = optionalRegimenMedications !== null &&
- optionalRegimenMedications !== undefined &&
- optionalRegimenMedications.length !== 0;
- if (isRadiationOncology) {
- compiledTemplate = buildTemplateProcedure();
- createRegimenProcedure(jsonRegimenCollection);
- }
- else if (isCardiology) {
- compiledTemplate = BuildCardiologyTemplate(jsonRegimenCollection.RequiredRegimenMedications);
- CreateCardiologyRegimen(jsonRegimenCollection);
- }
- else if (isImaging) {
- compiledTemplate = BuildRegimenTemplate(jsonRegimenCollection);
- CreateRegimen(jsonRegimenCollection);
- }
- else {
- var visibility = ShowRegimenCost(jsonRegimenCollection.RegimenCost);
- compiledTemplate = buildTemplateMedication(visibility, jsonRegimenCollection.RegimenCost);
- createRegimenMedication(jsonRegimenCollection, MGFMedications);
- }
- compiledTemplate.show();
- //Disabling 'Use this Regimen' button based on flag value
- if (oosDisableButton) {
- $('#btnUseThisRegimen').attr("disabled", true);
- $('#btnUseThisRegimen').css('background-color', '#EF9422');
- $('#btnUseThisRegimen').css('cursor', 'default');
- $('#btnUseThisRegimen').css('color', '#A0A0A0');
- $('#btnUseThisRegimen').css('text-shadow', '1px 1px #FFFFFF');
- }
- $(function () {
- $('.estimatedCostCalculationToolTip').popover({
- trigger: 'hover',
- placement: 'auto top',
- html: true
- });
- });
- };
- //end
- })(jQuery)
- + function (a) { "use strict"; var b = function (a, b) { this.type = this.options = this.enabled = this.timeout = this.hoverState = this.$element = null, this.init("tooltip", a, b) }; b.DEFAULTS = { animation: !0, placement: "top", selector: !1, template: '<div class="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>', trigger: "hover focus", title: "", delay: 0, html: !1, container: !1 }, b.prototype.init = function (b, c, d) { this.enabled = !0, this.type = b, this.$element = a(c), this.options = this.getOptions(d); var e = this.options.trigger.split(" "); for (var f = e.length; f--;) { var g = e[f]; if (g == "click") this.$element.on("click." + this.type, this.options.selector, a.proxy(this.toggle, this)); else if (g != "manual") { var h = g == "hover" ? "mouseenter" : "focus", i = g == "hover" ? "mouseleave" : "blur"; this.$element.on(h + "." + this.type, this.options.selector, a.proxy(this.enter, this)), this.$element.on(i + "." + this.type, this.options.selector, a.proxy(this.leave, this)) } } this.options.selector ? this._options = a.extend({}, this.options, { trigger: "manual", selector: "" }) : this.fixTitle() }, b.prototype.getDefaults = function () { return b.DEFAULTS }, b.prototype.getOptions = function (b) { return b = a.extend({}, this.getDefaults(), this.$element.data(), b), b.delay && typeof b.delay == "number" && (b.delay = { show: b.delay, hide: b.delay }), b }, b.prototype.getDelegateOptions = function () { var b = {}, c = this.getDefaults(); return this._options && a.each(this._options, function (a, d) { c[a] != d && (b[a] = d) }), b }, b.prototype.enter = function (b) { var c = b instanceof this.constructor ? b : a(b.currentTarget)[this.type](this.getDelegateOptions()).data("bs." + this.type); clearTimeout(c.timeout), c.hoverState = "in"; if (!c.options.delay || !c.options.delay.show) return c.show(); c.timeout = setTimeout(function () { c.hoverState == "in" && c.show() }, c.options.delay.show) }, b.prototype.leave = function (b) { var c = b instanceof this.constructor ? b : a(b.currentTarget)[this.type](this.getDelegateOptions()).data("bs." + this.type); clearTimeout(c.timeout), c.hoverState = "out"; if (!c.options.delay || !c.options.delay.hide) return c.hide(); c.timeout = setTimeout(function () { c.hoverState == "out" && c.hide() }, c.options.delay.hide) }, b.prototype.show = function () { var b = a.Event("show.bs." + this.type); if (this.hasContent() && this.enabled) { this.$element.trigger(b); if (b.isDefaultPrevented()) return; var c = this.tip(); this.setContent(), this.options.animation && c.addClass("fade"); var d = typeof this.options.placement == "function" ? this.options.placement.call(this, c[0], this.$element[0]) : this.options.placement, e = /\s?auto?\s?/i, f = e.test(d); f && (d = d.replace(e, "") || "top"), c.detach().css({ top: 0, left: 0, display: "block" }).addClass(d), this.options.container ? c.appendTo(this.options.container) : c.insertAfter(this.$element); var g = this.getPosition(), h = c[0].offsetWidth, i = c[0].offsetHeight; if (f) { var j = this.$element.parent(), k = d, l = document.documentElement.scrollTop || document.body.scrollTop, m = this.options.container == "body" ? window.innerWidth : j.outerWidth(), n = this.options.container == "body" ? window.innerHeight : j.outerHeight(), o = this.options.container == "body" ? 0 : j.offset().left; d = d == "bottom" && g.top + g.height + i - l > n ? "top" : d == "top" && g.top - l - i < 0 ? "bottom" : d == "right" && g.right + h > m ? "left" : d == "left" && g.left - h < o ? "right" : d, c.removeClass(k).addClass(d) } var p = this.getCalculatedOffset(d, g, h, i); this.applyPlacement(p, d), this.$element.trigger("shown.bs." + this.type) } }, b.prototype.applyPlacement = function (a, b) { var c, d = this.tip(), e = d[0].offsetWidth, f = d[0].offsetHeight, g = parseInt(d.css("margin-top"), 10), h = parseInt(d.css("margin-left"), 10); isNaN(g) && (g = 0), isNaN(h) && (h = 0), a.top = a.top + g, a.left = a.left + h, d.offset(a).addClass("in"); var i = d[0].offsetWidth, j = d[0].offsetHeight; b == "top" && j != f && (c = !0, a.top = a.top + f - j); if (/bottom|top/.test(b)) { var k = 0; a.left < 0 && (k = a.left * -2, a.left = 0, d.offset(a), i = d[0].offsetWidth, j = d[0].offsetHeight), this.replaceArrow(k - e + i, i, "left") } else this.replaceArrow(j - f, j, "top"); c && d.offset(a) }, b.prototype.replaceArrow = function (a, b, c) { this.arrow().css(c, a ? 50 * (1 - a / b) + "%" : "") }, b.prototype.setContent = function () { var a = this.tip(), b = this.getTitle(); a.find(".tooltip-inner")[this.options.html ? "html" : "text"](b), a.removeClass("fade in top bottom left right") }, b.prototype.hide = function () { function e() { b.hoverState != "in" && c.detach() } var b = this, c = this.tip(), d = a.Event("hide.bs." + this.type); this.$element.trigger(d); if (d.isDefaultPrevented()) return; return c.removeClass("in"), a.support.transition && this.$tip.hasClass("fade") ? c.one(a.support.transition.end, e).emulateTransitionEnd(150) : e(), this.$element.trigger("hidden.bs." + this.type), this }, b.prototype.fixTitle = function () { var a = this.$element; (a.attr("title") || typeof a.attr("data-original-title") != "string") && a.attr("data-original-title", a.attr("title") || "").attr("title", "") }, b.prototype.hasContent = function () { return this.getTitle() }, b.prototype.getPosition = function () { var b = this.$element[0]; return a.extend({}, typeof b.getBoundingClientRect == "function" ? b.getBoundingClientRect() : { width: b.offsetWidth, height: b.offsetHeight }, this.$element.offset()) }, b.prototype.getCalculatedOffset = function (a, b, c, d) { return a == "bottom" ? { top: b.top + b.height, left: b.left + b.width / 2 - c / 2 } : a == "top" ? { top: b.top - d, left: b.left + b.width / 2 - c / 2 } : a == "left" ? { top: b.top + b.height / 2 - d / 2, left: b.left - c } : { top: b.top + b.height / 2 - d / 2, left: b.left + b.width } }, b.prototype.getTitle = function () { var a, b = this.$element, c = this.options; return a = b.attr("data-original-title") || (typeof c.title == "function" ? c.title.call(b[0]) : c.title), a }, b.prototype.tip = function () { return this.$tip = this.$tip || a(this.options.template) }, b.prototype.arrow = function () { return this.$arrow = this.$arrow || this.tip().find(".tooltip-arrow") }, b.prototype.validate = function () { this.$element[0].parentNode || (this.hide(), this.$element = null, this.options = null) }, b.prototype.enable = function () { this.enabled = !0 }, b.prototype.disable = function () { this.enabled = !1 }, b.prototype.toggleEnabled = function () { this.enabled = !this.enabled }, b.prototype.toggle = function (b) { var c = b ? a(b.currentTarget)[this.type](this.getDelegateOptions()).data("bs." + this.type) : this; c.tip().hasClass("in") ? c.leave(c) : c.enter(c) }, b.prototype.destroy = function () { this.hide().$element.off("." + this.type).removeData("bs." + this.type) }; var c = a.fn.tooltip; a.fn.tooltip = function (c) { return this.each(function () { var d = a(this), e = d.data("bs.tooltip"), f = typeof c == "object" && c; e || d.data("bs.tooltip", e = new b(this, f)), typeof c == "string" && e[c]() }) }, a.fn.tooltip.Constructor = b, a.fn.tooltip.noConflict = function () { return a.fn.tooltip = c, this } }(jQuery),
- +function (a) { "use strict"; var b = function (a, b) { this.init("popover", a, b) }; if (!a.fn.tooltip) throw new Error("Popover requires tooltip.js"); b.DEFAULTS = a.extend({}, a.fn.tooltip.Constructor.DEFAULTS, { placement: "right", trigger: "click", content: "", template: '<div class="popover"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>' }), b.prototype = a.extend({}, a.fn.tooltip.Constructor.prototype), b.prototype.constructor = b, b.prototype.getDefaults = function () { return b.DEFAULTS }, b.prototype.setContent = function () { var a = this.tip(), b = this.getTitle(), c = this.getContent(); a.find(".popover-title")[this.options.html ? "html" : "text"](b), a.find(".popover-content")[this.options.html ? "html" : "text"](c), a.removeClass("fade top bottom left right in"), a.find(".popover-title").html() || a.find(".popover-title").hide() }, b.prototype.hasContent = function () { return this.getTitle() || this.getContent() }, b.prototype.getContent = function () { var a = this.$element, b = this.options; return a.attr("data-content") || (typeof b.content == "function" ? b.content.call(a[0]) : b.content) }, b.prototype.arrow = function () { return this.$arrow = this.$arrow || this.tip().find(".arrow") }, b.prototype.tip = function () { return this.$tip || (this.$tip = a(this.options.template)), this.$tip }; var c = a.fn.popover; a.fn.popover = function (c) { return this.each(function () { var d = a(this), e = d.data("bs.popover"), f = typeof c == "object" && c; e || d.data("bs.popover", e = new b(this, f)), typeof c == "string" && e[c]() }) }, a.fn.popover.Constructor = b, a.fn.popover.noConflict = function () { return a.fn.popover = c, this } }(jQuery)
- //save regimen conversation
- var saveRegimenConversationToSession = function (answeredQuestionInfoList, callback, callbackUrl) {
- var urlPost = "/Authorization/RegimenSelection/SaveQandAToSession";
- if (answeredQuestionInfoList != undefined && answeredQuestionInfoList != null && answeredQuestionInfoList.length > 0) {
- currentRegimenConversations = answeredQuestionInfoList;
- var regimenRuleId = $("input:hidden[name='CurrentRegimenRuleSearchingResponse.RegimenRuleId']").attr("value");
- var SelectedQuestionAnswerRequest = {
- RegimenRuleId: regimenRuleId,
- AnsweredQuestions: answeredQuestionInfoList,
- IsSimulation: false
- }
- window.scrollTo(10, 10);
- $.ajax({
- type: "POST",
- url: urlPost,
- data: JSON.stringify(SelectedQuestionAnswerRequest),
- contentType: 'application/json; charset=utf-8',
- success: function () {
- try {
- } finally {
- callback(true, callbackUrl);
- }
- },
- error: function (xhr, ajaxOptions, thrownError) {
- alert(xhr.status);
- alert(thrownError);
- callback(false, callbackUrl);
- }
- });
- } else
- callback(true, callbackUrl);
- };
- //call after selecting the regimen to save in crm and to populate the dosing and direction for portal
- var regimenSelectCallbackPortal30 = function (json, requestType) {
- if (requestType != undefined && requestType == "CrmRequest") {
- $("#loadingSpinner").dialog({
- closeOnEscape: false,
- dialogClass: 'no-close',
- resizable: false,
- title: "Loading...",
- position: {
- my: "center center",
- at: "center center",
- of: window
- },
- modal: true
- });
- var answeredQuestionInfoList = currentRegimenConversations;
- if (currentCrmServiceId == undefined || currentCrmServiceId == '')
- currentCrmServiceId = getQueryString('serviceRequestId');
- if (currentCrmUserId == undefined || currentCrmUserId == '')
- currentCrmUserId = getQueryString('userId');
- if (currentDeterminationSupportId == undefined || currentDeterminationSupportId == '')
- currentDeterminationSupportId = getQueryString('determinationSupportId');
- if (currentCrmIsDssSupplemental == undefined || currentCrmIsDssSupplemental == '')
- currentCrmIsDssSupplemental = getQueryString('isDssSupplemental');
- if (currentCrmPassedIcdId == undefined || currentCrmPassedIcdId == '') {
- currentCrmPassedIcdId = getQueryString('icdId');
- }
- if (answeredQuestionInfoList != undefined && answeredQuestionInfoList != null) {
- var serviceId = currentCrmServiceId;
- var userId = currentCrmUserId;
- var determinationSupportId = currentDeterminationSupportId;
- var isDssSupplemental = currentCrmIsDssSupplemental;
- var jsonSelectableRegimen = [];
- //jsonSelectableRegimen = populateSelectableRegimenToJson();
- var RegimenServiceIdRequest = {
- //SelectableRegimen: jsonSelectableRegimen,
- SelectedRegimen: json,
- ServiceId: serviceId,
- RuleId: currentRuleTriggerId,
- AnsweredQuestions: answeredQuestionInfoList,
- UserId: userId,
- DeterminationSupportId: determinationSupportId,
- IsDssSupplemental: isDssSupplemental,
- IcdId: currentCrmPassedIcdId
- };
- $.ajax({
- cache: false,
- url: '/QandARegimen/QandARegimen/SaveRegimen',
- type: "POST",
- contentType: 'application/json; charset=utf-8',
- dataType: "text",
- data: ko.toJSON(RegimenServiceIdRequest),
- success: function (returnVal) {
- try {
- if (returnVal != "answered") {
- if (window.opener) {
- window.opener.returnValue = returnVal;
- }
- window.returnValue = returnVal;
- window.close();
- }
- } finally {
- html = null;
- $("#loadingSpinner").dialog("close");
- }
- },
- error: function (xhr, ajaxOptions, thrownError) {
- alert(xhr.status);
- alert(thrownError);
- $("#loadingSpinner").dialog("close");
- window.returnValue = false;
- }
- });
- }
- }
- else {
- if (requestType !== RequestTypeUmIntake) {
- openNextTab();
- sendAuthDetailToGoogleAnalytics("Authorization - New Request - Service Item Detail", "/Authorization/NewRequest/ServiceItemDetail");
- }
- else {
- json.RequestSpecs = Cp.IntakeHome.AuthRequest.Instance.GetRequestSpecs();
- }
- $("#loadingSpinner").dialog({
- closeOnEscape: false,
- dialogClass: 'no-close',
- resizable: false,
- title: "Loading...",
- position: {
- my: "center center",
- at: "center center",
- of: window
- },
- modal: true
- });
- $.ajax({
- cache: false,
- url: '/Authorization/NewRequestHelper/RegimenSelect',
- type: "POST",
- contentType: 'application/json; charset=utf-8',
- dataType: "html",
- data: ko.toJSON(json),// + "&isUmIntake=" + requestType !== RequestTypeUmIntake ,
- success: function(html) {
- RegimenSelectSuccessCallback(html);
- $("#loadingSpinner").dialog("close");
- console.log($("#maxMonthDurationId").val());
- console.log($("#hasRegimenId").val());
- },
- error: function (request, status, error) {
- if ($("#loadingSpinner").hasClass("ui-dialog-content") &&
- $("#loadingSpinner").dialog("isOpen")) {
- $("#loadingSpinner").dialog("close");
- }
- alert(request.responseText);
- }
- });
- }
- };
- function RegimenSelectSuccessCallback(html) {
- try {
- $("#requestedItemsContainer").html('');
- $("#requestedItemsContainer").html(html);
- $.each($('select[id$="__ServiceItem_Quantity"]'), function (i, $obj) {
- setSpanValueForSelect($obj.id);
- });
- } finally {
- html = null;
- $("#loadingSpinnerInDosing").dialog("close");
- if (REQUEST_TYPE !== RequestTypeUmIntake) {
- refreshSelectedInfoForDosing(true);
- Cp.NewRequest.CommonProcessor.Instance.FullyLockApplicableNewRequestFields();
- }
- }
- }
- function saveSelectableRegimenToSession(requestType) {
- var jsonSelectableRegimen = [];
- jsonSelectableRegimen = populateSelectableRegimenToJson();
- var jsonData;
- var requestUrl;
- if (requestType == undefined || requestType == "SimulateRequest" || requestType == "NewRequest") {
- requestUrl = '/Authorization/NewRequest/SaveToSessionSelectableRegimen';
- jsonData = jsonSelectableRegimen;
- }
- if (requestType != undefined && requestType == "CrmRequest") {
- requestUrl = '/QandARegimen/QandARegimen/SaveAllSelectableRegimen';
- if (currentCrmServiceId == undefined || currentCrmServiceId == '')
- currentCrmServiceId = getQueryString('serviceRequestId');
- if (currentCrmUserId == undefined || currentCrmUserId == '')
- currentCrmUserId = getQueryString('userId');
- var RegimenServiceIdRequest = {
- SelectableRegimen: jsonSelectableRegimen,
- ServiceId: currentCrmServiceId,
- UserId: currentCrmUserId
- }
- jsonData = RegimenServiceIdRequest;
- }
- $.ajax({
- cache: false,
- async: false,
- url: requestUrl,
- type: "POST",
- contentType: 'application/json; charset=utf-8',
- dataType: "json",
- data: JSON.stringify(jsonData),
- success: function () { return true; }, error: function (request, status, error) {
- alert(request.responseText);
- }
- });
- }
- function populateSelectableRegimenToJson() {
- var regimens = [];
- if (selectableRegimenData != null) {
- $.each(selectableRegimenData.Regimens, function (index) {
- regimens.push({
- "Id": selectableRegimenData.Regimens[index].Id, "Name": selectableRegimenData.Regimens[index].Name,
- "IsPathway": selectableRegimenData.Regimens[index].IsPathway, "IsAutoApprovable": selectableRegimenData.Regimens[index].IsAutoApprovable,
- "RiskFactor": selectableRegimenData.Regimens[index].RiskFactor, "RequiredRegimenMedications": selectableRegimenData.Regimens[index].RequiredRegimenMedications,
- "OptionalRegimenMedications": selectableRegimenData.Regimens[index].OptionalRegimenMedications, "Diagnoses": selectableRegimenData.Regimens[index].Diagnoses,
- "StateCode": selectableRegimenData.Regimens[index].StateCode, "StatusCode": selectableRegimenData.Regimens[index].StatusCode,
- "RiskFactorNeutropenic": selectableRegimenData.Regimens[index].RiskFactorNeutropenic,
- "SelectableRegimenId": selectableRegimenData.Regimens[index].SelectableRegimenId,
- "MaximumDuration": selectableRegimenData.Regimens[index].MaximumDuration
- });
- });
- }
- return regimens;
- }
- //remove the regimen conversation from session
- function removeRegimenFromSession() {
- //
- var url = "/Authorization/RegimenSelection/DeleteSelectedRegimen";
- $.ajax({
- url: url,
- type: 'POST',
- success: function () {
- try {
- $('#page-selection .regimen-selection-table tbody tr').closest('tr').removeClass('selected');
- $("#DisplayPatientValError").html('');
- } finally {
- result = null;
- }
- },
- error: function (xhr, ajaxOptions, thrownError) {
- alert(xhr.status);
- alert(thrownError);
- }
- });
- }
- //initialize the question and answer section
- function initializeCommonUiQuestionAnswer() {
- $(function () {
- var requestType = $("input:hidden[name='RequestType']").attr("value");
- //Variable decalaration
- var errorCssClass = "input-validation-error";
- answeredQuestionInfoList = [];
- answers = [];
- //Remove error class from input text box for calendar when select the date
- $('.labDatePicker').datepicker({
- onSelect: function (dateText, inst) {
- $(this).removeClass(errorCssClass);
- $(this).attr('title', "");
- $(this).change();
- }
- });
- $('.labDatePicker').change(function (evt) {
- showHideDssDropdown($(this), false);
- });
- $('.dssReasonDropdown').change(function (evt) {
- $(this).removeClass(errorCssClass);
- });
- //Remove error class from input text box for calendar when user enters
- $('.labDatePicker').keyup(function () {
- $(this).removeClass(errorCssClass);
- $(this).attr('title', "");
- });
- $('.qn-help').popover({
- trigger: 'hover',
- placement: 'auto top'
- });
- //Can show the determination support reason dropdown
- var regimenConversations = null;
- function canShowDssReasonDropdown(currentQnId, selectedAnswers, isChoicebox) {
- var canShow = false;
- if (requestType == "CrmRequest" || requestType == "PortalDssRequest") {
- var selectedRegimenConversations = [];
- var regimenConversationsForCurrentQn = [];
- //get answerIds from regimenConversation for the currentQnId
- if (regimenConversations == null) {
- regimenConversations = JSON.parse(getCurrentRegimenConversations(REQUEST_TYPE));
- }
- if (isChoicebox) {
- $.each(regimenConversations, function (index, regimenConversation) {
- if (regimenConversation.QuestionReferenceId == currentQnId) {
- //need this for qns with multiple answers selected
- regimenConversationsForCurrentQn.push(regimenConversation.AnswerReferenceId);
- if (jQuery.inArray(regimenConversation.AnswerReferenceId, selectedAnswers) != -1) {
- selectedRegimenConversations.push(regimenConversation.AnswerReferenceId);
- }
- }
- });
- } else {
- $.each(regimenConversations, function (index, regimenConversation) {
- if (regimenConversation.QuestionReferenceId == currentQnId) {
- if (jQuery.inArray(regimenConversation.ResponseText, selectedAnswers) != -1) {
- selectedRegimenConversations.push(regimenConversation.ResponseText);
- //adding this to keep the below condition intact for lab/lab with calendar
- regimenConversationsForCurrentQn.push(regimenConversation.AnswerReferenceId);
- }
- }
- });
- }
- if ((regimenConversationsForCurrentQn.length != selectedRegimenConversations.length) || (selectedAnswers.length != selectedRegimenConversations.length)) {
- canShow = true;
- }
- }
- return canShow;
- }
- //Show hide determination support reason dropdown
- function showHideDssDropdown(selectedAnswer, isChoicebox) {
- var selectedAnswers = [];
- var selectedAnswerValues = [];
- if (currentCrmIsDssSupplemental == undefined || currentCrmIsDssSupplemental == '')
- currentCrmIsDssSupplemental = getQueryString('isDssSupplemental');
- if (currentDeterminationSupportId == undefined || currentDeterminationSupportId == '')
- currentDeterminationSupportId = getQueryString('determinationSupportId');
- if (currentCrmPassedIcdId == undefined || currentCrmPassedIcdId == '') {
- currentCrmPassedIcdId = getQueryString('icdId');
- }
- if ((requestType == "CrmRequest" || requestType == "PortalDssRequest") && currentCrmIsDssSupplemental != 'true' && currentDeterminationSupportId != undefined && currentDeterminationSupportId != '' &&
- (currentCrmPassedIcdId == undefined || currentCrmPassedIcdId == '' || requestType == "PortalDssRequest")) {
- if (isChoicebox) {
- if (selectedAnswer.hasClass("active")) {
- selectedAnswers.push(selectedAnswer.attr("id"));
- }
- $.each(selectedAnswer.siblings(".active"), function (index, selectedAnswerElement) {
- selectedAnswers.push(selectedAnswerElement.id);
- });
- var currentQnId = selectedAnswer.attr('question');
- if (selectedAnswer.attr("name") == "performance_status_ecog" || selectedAnswer.attr("name") == "performance_status_karnofsky") {
- if (canShowDssReasonDropdown(currentQnId, selectedAnswers, isChoicebox)) {
- selectedAnswer.closest(".panel-section").find(".dssReasonDropdown").each(function () {
- if (currentQnId == $(this).attr("name")) {
- $(this).show();
- }
- });
- } else {
- selectedAnswer.closest(".panel-section").find(".dssReasonDropdown").each(function () {
- if (currentQnId == $(this).attr("name")) {
- $(this).hide();
- $(this).val('0');
- }
- });
- }
- }
- if (canShowDssReasonDropdown(currentQnId, selectedAnswers, isChoicebox)) {
- selectedAnswer.parent().siblings().find(".dssReasonDropdown").each(function () {
- if (currentQnId == $(this).attr("name")) {
- $(this).show();
- }
- });
- } else {
- selectedAnswer.parent().siblings().find(".dssReasonDropdown").each(function () {
- if (currentQnId == $(this).attr("name")) {
- $(this).hide();
- $(this).val('0');
- }
- });
- }
- } else {
- var currentParent = selectedAnswer.parent();
- var textBoxDisplayItems = currentParent.find("input:text");
- textBoxDisplayItems.each(function () {
- if ($(this) != undefined && textBoxDisplayItems.is(":visible")) {
- selectedAnswers.push(this.value);
- }
- });
- var currentQnId = currentParent.attr('question');
- if (canShowDssReasonDropdown(currentQnId, selectedAnswers, isChoicebox)) {
- currentParent.parent().siblings().find(".dssReasonDropdown").each(function () {
- if (currentQnId == $(this).attr("name")) {
- $(this).show();
- }
- });
- } else {
- currentParent.parent().siblings().find(".dssReasonDropdown").each(function () {
- if (currentQnId == $(this).attr("name")) {
- $(this).hide();
- $(this).val('0');
- }
- });
- }
- }
- }
- }
- //Check whether the valus is a number or not
- function isNumber(value, evt) {
- var charCode = (evt.which) ? evt.which : event.keyCode
- if (charCode != 45 && (charCode != 46 || value.indexOf('.') != -1) &&
- (charCode < 48 || charCode > 57) && charCode != 8)
- return false;
- else {
- if (charCode == 8) return true; //backspace.
- var len = value.length;
- var index = value.indexOf('.');
- if (index >= 0) {
- var CharAfterdot = (len + 1) - index;
- if (CharAfterdot > 3) {
- return false;
- }
- } else if (len == 3) {
- if (charCode != 46)
- return false;
- }
- }
- return true;
- }
- //Key press for the lab type
- $('.numbersOnly').keypress(function (evt) {
- if (isNumber(this.value, evt)) {
- if ($(this).hasClass(errorCssClass)) {
- $(this).removeClass(errorCssClass);
- }
- } else
- return false;
- });
- $('.numbersOnly').blur(function (evt) {
- showHideDssDropdown($(this), false);
- });
- //Show/hide Ecog /Karnofsky
- $('[name=performance_status_type]').change(function () {
- if ($('#regimenMappingDialog').is(':visible')) {
- var logicalOperandRadioName = $(this).parents(".panel-section").attr("id");
- $("input[name=" + logicalOperandRadioName + "][value=Or]").prop('checked', true).trigger("click");
- }
- $('[data-master=performance-status-ecog], [data-master=performance-status-karnofsky]').toggleClass('hide');
- });
- //Select Ecog based on Karnofsky value
- var selectEcog = function (karnofskyValue) {
- var ecogValue;
- switch (karnofskyValue) {
- case "0":
- ecogValue = 5;
- break;
- case "1": case "2": case "3":
- ecogValue = 4;
- break;
- case "4": case "5":
- ecogValue = 3;
- break;
- case "6": case "7":
- ecogValue = 2;
- break;
- case "8": case "9":
- ecogValue = 1;
- break;
- case "10":
- ecogValue = 0;
- break;
- }
- var ecogElement = $('[data-master=performance-status-ecog]').find("label:contains('" + ecogValue + " - ')");
- if (ecogElement != undefined) {
- ecogElement.addClass('active');
- ecogElement.siblings(".answerButtonBox").removeClass("active");
- ecogElement.siblings(".answerButtonBox").removeClass(errorCssClass);
- }
- };
- //Get all questions which has pre requisite
- var getAllFocusedQuestionsByPreRequisite = function (selectedAnswer) {
- var questionsWithPreReq = [];
- var commonUiClinicalInformationSection = selectedAnswer.parents('#commonUiClinicalInformationSectionTest');
- if (commonUiClinicalInformationSection.length <= 0) {
- commonUiClinicalInformationSection = selectedAnswer.parents('#commonUiClinicalInformationSection');
- if (commonUiClinicalInformationSection.length <= 0) {
- commonUiClinicalInformationSection = selectedAnswer.parents('.js-question-table');
- }
- }
- commonUiClinicalInformationSection.find(".panel-section").each(function () {
- if (($(this).attr('preReq') == 'true') && ($(this).filter("[preReqQn*='" + selectedAnswer.attr('question') + "']").length > 0)) {
- questionsWithPreReq.push($(this));
- }
- });
- return questionsWithPreReq;
- }
- //check whether current question is pre requisite for any questions. If yes return all those question
- var getAllDependentQuestionsInfo = function (selectedAnswer) {
- var dependentQnInfo = [];
- var currentQnId;
- //Get all hiddent questions for the current answered question
- var currentFocusedHiddenQns = getAllFocusedQuestionsByPreRequisite(selectedAnswer);
- if (currentFocusedHiddenQns != undefined) {
- //get the focused hidden qns
- $.each(currentFocusedHiddenQns, function (index, hiddenQuestion) {
- var hasQuestionsSatisfied = false;
- var hasAnswersSatisfied = false;
- var QnsCount = 0;
- var answerCount = 0;
- var count = 0;
- //Get the pre requisite questions of the hidden qn
- var preReqQns = hiddenQuestion.attr('preReqQn').split(",");
- //get array of all prereq answers and isNot flags in hiddenQuestion
- var preReqAnsWithIsNot = hiddenQuestion.attr('preReqAnswer').split(",");
- var preReqIsNotAns = [];
- var preReqAns = [];
- $.each(preReqAnsWithIsNot, function (index, preReqAnswer) {
- if (preReqAnswer.match("^!")) {
- preReqIsNotAns.push(preReqAnswer.substring(1));
- } else {
- preReqAns.push(preReqAnswer);
- }
- });
- var selectedQns = [];
- var isNotCount = 0;
- var commonUiClinicalInformationSection = selectedAnswer.parents('#commonUiClinicalInformationSectionTest');
- if (commonUiClinicalInformationSection.length <= 0) {
- commonUiClinicalInformationSection = selectedAnswer.parents('#commonUiClinicalInformationSection');
- if (commonUiClinicalInformationSection.length <= 0) {
- commonUiClinicalInformationSection = selectedAnswer.parents('.js-question-table');
- }
- }
- //Get the count of all questions and answer satisified
- commonUiClinicalInformationSection.find("label.active").each(function () {
- //$("#commonUiClinicalInformationSection").find("label.active").each(function () {
- currentQnId = $(this).attr('question');
- //checking for qn count(eliminating duplicates - when multiselect is on)
- if (jQuery.inArray(currentQnId, selectedQns) == -1) {
- selectedQns.push(currentQnId);
- if (jQuery.inArray(currentQnId, preReqQns) >= 0) {
- QnsCount++;
- }
- }
- if (QnsCount > 0) {
- var currentAnswerId = $(this).attr('id');
- if (jQuery.inArray(currentAnswerId, preReqIsNotAns) >= 0) {
- isNotCount++;
- }
- if (jQuery.inArray(currentAnswerId, preReqAns) >= 0) {
- answerCount++;
- }
- }
- });
- //Check whether all the pre req question satisfied
- if (preReqQns.length == QnsCount) {
- hasQuestionsSatisfied = true;
- }
- //check whether answer is satisfied
- if (preReqAns.length == answerCount && isNotCount == 0) {
- //if (answerCount != 0 && isNotCount == 0) {
- hasAnswersSatisfied = true;
- }
- var preReqValue = { hasQuestionsSatisfied: hasQuestionsSatisfied, hasAnswersSatisfied: hasAnswersSatisfied, focusedHiddenQn: hiddenQuestion };
- dependentQnInfo.push(preReqValue);
- });
- }
- return dependentQnInfo;
- };
- //hide the question and clear the error border and the input value
- var hideQuestion = function (currentQn) {
- currentQn.hide();
- currentQn.find(".answerButtonBox").removeClass("active");
- currentQn.find(".answerButtonBox").removeClass(errorCssClass);
- currentQn.find("input").val('');
- currentQn.find(".dssReasonDropdown").val('0');
- currentQn.attr("override-validation", true);
- currentQn.find('input[type="text"].answerText').each(function () { this.type = 'hidden'; this.value = ''; });
- // call again to see whethere there is any dependencies
- var currentAnswerBox = currentQn.find("label.answerButtonBox:first");
- //if undefined, it will be lab
- if (currentAnswerBox == undefined || currentAnswerBox == null)
- currentAnswerBox = currentQn.find("label.labLabelStyle:first");
- hideShowQns(currentAnswerBox);
- var LogicalOprandContainer = currentQn.parent().siblings("td");
- if (LogicalOprandContainer.length > 0) {
- $(LogicalOprandContainer).find(".LogicalOprandDiv").hide();
- }
- }
- //hide show qns based on the answer
- var hideShowQns = function (selectedAnswer) {
- var hideRest = false;
- var dependentQnInfo;
- // check if RegimenMapping as Test harnesss is Active
- var commonUiClinicalInformationSection = selectedAnswer.parents('#commonUiClinicalInformationSectionTest');
- if (commonUiClinicalInformationSection.length <= 0) {
- commonUiClinicalInformationSection = selectedAnswer.parents('#commonUiClinicalInformationSection');
- if (commonUiClinicalInformationSection.length <= 0) {
- commonUiClinicalInformationSection = selectedAnswer.parents('.js-question-table');
- }
- }
- // show or hide the questions if there are any dependent qns
- commonUiClinicalInformationSection.find(".panel-section").each(function () {
- //$("#commonUiClinicalInformationSection").find(".panel-section").each(function () {
- var currentElement = $(this);
- if ($(this).attr('preReq') == 'true') {
- //get the dependent questions details for the selected question. Check it everytime- might be the selection change based on the hide and show
- dependentQnInfo = getAllDependentQuestionsInfo(selectedAnswer);
- $.each(dependentQnInfo, function (index, questionInfo) {
- //if the current element is the focused question
- if (questionInfo != undefined && questionInfo.focusedHiddenQn != undefined && questionInfo.focusedHiddenQn.attr("id") == currentElement.attr("id")) {
- hideRest = false;
- //check qn satisfied for that
- if (questionInfo.hasQuestionsSatisfied) {
- //check for answer satisfied
- if (questionInfo.hasAnswersSatisfied) {
- currentElement.show();
- currentElement.attr("override-validation", false);
- var LogicalOprandContainer = currentElement.parent().siblings("td");
- if (LogicalOprandContainer.length > 0) {
- $(LogicalOprandContainer).find(".LogicalOprandDiv").show();
- }
- return false;
- } else {
- hideQuestion(currentElement);
- return false;
- }
- } else {
- hideQuestion(currentElement);
- return false;
- }
- }
- });
- } else {
- currentElement.show();
- currentElement.attr("override-validation", false);
- var LogicalOprandContainer = currentElement.parent().siblings("td");
- if (LogicalOprandContainer.length > 0) {
- $(LogicalOprandContainer).find(".LogicalOprandDiv").show();
- }
- }
- });
- };
- $("#commonUiClinicalInformationSection").find("label.active").each(function () {
- hideShowQns($(this));
- });
- $("#commonUiClinicalInformationSectionTest").find("label.active").each(function () {
- hideShowQns($(this));
- });
- $("#generalQASelection .js-question-table").find("label.active").each(function () {
- hideShowQns($(this));
- });
- $("#adverseEventsSelection .js-question-table").find("label.active").each(function () {
- hideShowQns($(this));
- });
- $(".LogicalOprand").on("click", function () {
- if ($(this).val() == "And") {
- if ($(this).parents(".LogicalOprandDiv").closest("td").next().find(".section-sub-heading").length > 0) {
- $(this).parents(".LogicalOprandDiv").closest("td").next().find(".section-sub-heading").attr('multiselectable', 'true');
- $(this).parents(".LogicalOprandDiv").closest("td").next().find(".answerButtonBox").each(function () {
- if ($(this).hasClass("active")) {
- $(this).click();
- }
- });
- } else {
- $(this).parents(".LogicalOprandDiv").closest("td").next().find("h3.section-heading").attr('multiselectable', 'true');
- $(this).parents(".LogicalOprandDiv").closest("td").next().find(".answerButtonBox").each(function () {
- if ($(this).hasClass("active")) {
- $(this).click();
- }
- });
- }
- } else if ($(this).val() == "Or") {
- if ($(this).parents(".LogicalOprandDiv").closest("td").next().find(".section-sub-heading").length > 0) {
- $(this).parents(".LogicalOprandDiv").closest("td").next().find(".answerButtonBox").each(function () {
- if ($(this).hasClass("active")) {
- $(this).click();
- }
- });
- } else {
- $(this).parents(".LogicalOprandDiv").closest("td").next().find(".answerButtonBox").each(function () {
- if ($(this).hasClass("active")) {
- $(this).click();
- }
- });
- }
- } else if ($(this).val() == "Any") {
- $(this).parents(".LogicalOprandDiv").closest("td").next().find(".answerButtonBox").removeClass('active');
- if ($(this).parents(".LogicalOprandDiv").closest("td").next().find(".section-sub-heading").length > 0) {
- $(this).parents(".LogicalOprandDiv").closest("td").next().find(".section-sub-heading").attr('multiselectable', 'true');
- } else {
- $(this).parents(".LogicalOprandDiv").closest("td").next().find("h3.section-heading").attr('multiselectable', 'true');
- }
- $(this).prop('checked', false);
- var performanceQuenAnsButtons = $(this).parents(".LogicalOprandDiv").closest("td").next().find(".form-conditional");
- if (performanceQuenAnsButtons.length > 0) {
- $.each(performanceQuenAnsButtons, function () {
- if ($("#" + $(this).data('master')).prop('checked')) {
- $(this).find(".answerButtonBox").click();
- }
- });
- } else {
- $(this).parents(".LogicalOprandDiv").closest("td").next().find(".answerButtonBox").click();
- }
- $(this).prop('checked', true);
- }
- });
- //when select the answer
- $('label.answerButtonBox').unbind('click').click(function (event) {
- var logicalOperandTd = $(this).parents('.panel-section').parent().siblings();
- var isClickable = true;
- var isInteractiveViewActive = false;
- if (logicalOperandTd.length > 0) {
- isInteractiveViewActive = true;
- var questionId = $(this).attr("question");
- if ($("input[name='" + questionId + "']:checked").val() == "Any") {
- isClickable = false;
- }
- }
- if (isClickable) {
- isQADirty = true;
- dirtyTab = "DisplayClinical";
- var ansButton = $(this).parents(".form-conditional").length > 0 ? $(this).parents(".form-conditional") : $(this);
- var multiselect = $(ansButton).parent().siblings("table").find("h3.section-heading").attr('multiselectable');
- var displayType = $(ansButton).parent().siblings("table").find("h3.section-heading").attr('displaytype');
- var chosenValue;
- if (multiselect == undefined)
- multiselect = $(this).parent().siblings("table").find("h3.section-sub-heading[question ='" + $(this).attr('question') + "']").attr('multiselectable');
- //check whether the qn is having mutliselect answer flag
- if ((multiselect != undefined) && (multiselect.toLowerCase() == 'true')) {
- $(this).toggleClass("active");
- } else {
- $(this).addClass('active');
- $(this).siblings(".answerButtonBox").removeClass("active");
- }
- //remove error class when you click
- $(this).siblings(".answerButtonBox").removeClass(errorCssClass);
- $(this).removeClass(errorCssClass);
- //check for hidden input value - answer
- if ($(this).filter(".active").length == 0 && ($(this).siblings(".active").length == 0)) {
- chosenValue = '';
- } else if ($(this).filter(".active").length == 0 && ($(this).siblings(".active").length > 0)) {
- } else {
- chosenValue = $(this).attr('checkBoxItemValue');
- }
- //set the hidden input value
- if (chosenValue != undefined) {
- $(this).siblings("input").not(".answerText").val(chosenValue);
- }
- //check for display type standard with text
- if ((displayType != undefined) && (displayType.toLowerCase() == DisplayTypeStandardWithText.toLowerCase())) {
- var lastAnswer = $(this).parent().find('.answerButtonBox:last')[0];
- if ((multiselect != undefined) && (multiselect.toLowerCase() == 'true')) {
- if ($(this).attr('id') == lastAnswer.id) {
- if ($(this).hasClass('active')) {
- $(this).parent().find('input[type="hidden"].answerText').each(function () { this.type = 'text'; this.value = ''; });
- } else {
- $(this).parent().find('input[type="text"].answerText').each(function () { this.type = 'hidden'; this.value = ''; });
- }
- }
- } else {
- if ($(this).attr('id') == lastAnswer.id) {
- $(this).parent().find('input[type="hidden"].answerText').each(function () { this.type = 'text'; this.value = ''; });
- } else {
- $(this).parent().find('input[type="text"].answerText').each(function () { this.type = 'hidden'; this.value = ''; });
- }
- }
- }
- //clearing karnofsky when change ecog
- if ($(this).attr("name") == "performance_status_ecog") {
- $('[data-master=performance-status-karnofsky]').find("label").removeClass("active");
- $('[data-master=performance-status-karnofsky]').find("label").removeClass(errorCssClass);
- } else if ($(this).attr("name") == "performance_status_karnofsky") {
- selectEcog($(this).attr("checkboxitemvalue"));
- }
- showHideDssDropdown($(this), true);
- hideShowQns($(this));
- if ($('#commonUiTriageClinicalInformationSection').is(':visible')) {
- var allAnswersAnswered = validateQuestionAnswers(true, $(this).parents(".js-question-table").find(".panel-section:visible"));
- if (allAnswersAnswered) {
- openNextAccordionPanel($('#commonUiTriageClinicalInformationSection').find(".js-question-table"));
- $(this).parents(".js-question-table").parent().siblings().find('.all-answered-check').show();
- } else {
- $(this).parents(".js-question-table").parent().siblings().find('.all-answered-check').hide();
- }
- }
- if (REQUEST_TYPE === RequestTypeUmIntake) {
- Cp.IntakeHome.AuthRequest.Instance.CheckAndResetRegimenAndServiceItemSelection();
- if (validateQuestionAnswers(true)) {
- Cp.IntakeHome.AuthRequest.Instance.ShowFindRegimenButton();
- } else {
- Cp.IntakeHome.AuthRequest.Instance.HideFindRegimenButton();
- }
- }
- if (typeof (cp) != "undefined" &&
- typeof (cp.cardiology) != "undefined" &&
- typeof (cp.cardiology.newRequest) != "undefined" &&
- typeof (cp.cardiology.newRequest.serviceGroupQuestionnaireViewModel) != "undefined") {
- cp.cardiology.newRequest.serviceGroupQuestionnaireViewModel.AllQuestionDisplayed(validateQuestionAnswers(true));
- cp.cardiology.newRequest.serviceGroupQuestionnaireViewModel.NotAllRulesManagerQuestionsAnswered(false);
- cp.cardiology.newRequest.serviceGroupQuestionnaireViewModel.HasClinicalInfoSaved(false);
- cp.cardiology.newRequest.serviceGroupItemsViewModel.clear(true);
- }
- if (isInteractiveViewActive)
- showHideTestRegimensQueAns($(this));
- }
- });
- function ShowCurrentQuestion(currentElement) {
- currentElement.show();
- var LogicalOprandContainer = currentElement.parent().siblings("td");
- $("input:radio[name=" + currentElement.attr("id") + "]").each(function () {
- if ($(this).val() == "Or")
- $(this).click();
- });
- $(LogicalOprandContainer).find(".LogicalOprandDiv").show();
- }
- function showHideTestRegimensQueAns(selectedAnswerButton) {
- var commonUiClinicalInformationSection = selectedAnswerButton.parents('#commonUiClinicalInformationSectionTest');
- var dependentQnInfo = getAllDependentQuestionsInfo(selectedAnswerButton);
- var selectedAnswerId = selectedAnswerButton.attr("id");
- var isAllAnswersWithIsNot = true;
- commonUiClinicalInformationSection.find(".panel-section").each(function () {
- var currentElement = $(this);
- if ($(this).attr('preReq') == 'true') {
- //get the dependent questions details for the selected question. Check it everytime- might be the selection change based on the hide and show
- $.each(dependentQnInfo, function (index, questionInfo) {
- //if the current element is the focused question
- if (questionInfo != undefined && questionInfo.focusedHiddenQn != undefined && questionInfo.focusedHiddenQn.attr("id") == currentElement.attr("id")) {
- if (questionInfo.hasQuestionsSatisfied && questionInfo.hasAnswersSatisfied) {
- ShowCurrentQuestion(currentElement);
- } else if (questionInfo.hasQuestionsSatisfied && !questionInfo.hasAnswersSatisfied) {
- var preRequisiteAnswers = currentElement.attr("prereqanswer").split(",");
- var satisfiedAnsCount = 0;
- // If all pre requisite anwsers are with IsNot
- var IsNotAnswerIds = new Array();
- $.each(preRequisiteAnswers, function (index, value) {
- isAllAnswersWithIsNot = true;
- if (value.match("^!") && IsNotAnswerIds.indexOf(value) < 0) {
- value = value.substring(1, value.length);
- answeredPanelSection = $("#" + value).attr("question");
- if ($("#" + answeredPanelSection).attr("class") != "panel-section")
- answeredPanelSection = $("#" + answeredPanelSection).parents(".panel-section");
- $("#" + answeredPanelSection).find(".answerButtonBox").each(function () {
- if ($(this).hasClass("active") && preRequisiteAnswers.indexOf("!" + $(this).attr("id")) < 0) {
- isAllAnswersWithIsNot = false;
- }
- if (preRequisiteAnswers.indexOf("!" + $(this).attr("id")) > -1)
- IsNotAnswerIds.push("!" + $(this).attr("id"));
- });
- if (isAllAnswersWithIsNot)
- satisfiedAnsCount = preRequisiteAnswers.length;
- }
- });
- if (satisfiedAnsCount != preRequisiteAnswers.length) {
- satisfiedAnsCount = 0;
- for (i = 0; i < preRequisiteAnswers.length; i++) {
- if (!preRequisiteAnswers[i].match("^!") && $("#" + preRequisiteAnswers[i]).hasClass("active")) {
- satisfiedAnsCount++;
- } else if (preRequisiteAnswers[i].match("^!")) {
- var preReqNotAnswerId = preRequisiteAnswers[i].substring(1, preRequisiteAnswers[i].length);
- var preReqQn = "";
- var answeredPanelSection = "";
- if ($("#" + preReqNotAnswerId).hasClass("active")) {
- if (selectedAnswerId != preReqNotAnswerId) {
- if ($("#" + selectedAnswerId).hasClass("active"))
- satisfiedAnsCount++;
- else {
- preReqQn = currentElement.attr("prereqqn").split(",");
- if (preReqQn.indexOf($("#" + selectedAnswerId).attr("question")) > -1) {
- answeredPanelSection = $("#" + selectedAnswerId).attr("question");
- if ($("#" + answeredPanelSection).attr("class") != "panel-section")
- answeredPanelSection = $("#" + answeredPanelSection).parents(".panel-section");
- $("#" + answeredPanelSection).find(".answerButtonBox").each(function () {
- if ($(this).hasClass("active") && $(this).attr("id") != selectedAnswerId && $(this).attr("id") != preReqNotAnswerId) {
- satisfiedAnsCount++;
- return false;
- }
- });
- }
- }
- } else if (selectedAnswerId == preReqNotAnswerId) {
- preReqQn = currentElement.attr("prereqqn").split(",");
- if (preReqQn.indexOf($("#" + selectedAnswerId).attr("question")) > -1) {
- answeredPanelSection = $("#" + selectedAnswerId).attr("question");
- if ($("#" + answeredPanelSection).attr("class") != "panel-section")
- answeredPanelSection = $("#" + answeredPanelSection).parents(".panel-section");
- $("#" + answeredPanelSection).find(".answerButtonBox").each(function () {
- if ($(this).hasClass("active") && $(this).attr("id") != selectedAnswerId) {
- satisfiedAnsCount++;
- return false;
- }
- });
- }
- }
- } else {
- satisfiedAnsCount++;
- }
- }
- }
- } else {
- satisfiedAnsCount = 0;
- }
- if (satisfiedAnsCount == preRequisiteAnswers.length) {
- ShowCurrentQuestion(currentElement);
- }
- }
- }
- });
- } else {
- currentElement.show();
- var LogicalOprandContainer = currentElement.parent().siblings("td");
- $(LogicalOprandContainer).find(".LogicalOprandDiv").show();
- }
- });
- }
- });
- }
- function isByPassingRegimenSelection() {
- var success = false;
- try {
- success = Cp.NewRequest.CommonProcessor.Instance.IsDisabledNewRequestField;
- }
- catch (err) {
- return success;
- }
- return success;
- }
- //initialize regimen selection section
- function initializeRegimenSelection(initialData, regimenCheckmarkLocation) {
- $(document).ready(function () {
- var self = this;
- var regimenViewModel = {
- regimenSelectionGrid: ko.mapping.fromJS(initialData),
- selectedRegimen: ko.observable(),
- getRiskText: ko.observable(),
- addUSD: ko.observable(),
- loadRegimen: ko.observable(),
- formatCurrency: ko.observable()
- }
- regimenViewModel.selectRegimen = function(item) {
- regimenViewModel.selectedRegimen(item);
- if (REQUEST_TYPE == "PortalDssRequest") {
- $("#dssSelectedRegimen").show();
- selectedRegimenId = item.Id();
- $(".subpage-selected-regimen").hide();
- $("#page-selection").hide();
- } else {
- $(".subpage-selected-regimen").show();
- var contextRequestTypeUmIntake = REQUEST_TYPE === RequestTypeUmIntake;
- if (contextRequestTypeUmIntake) {
- $("#regimens").html('');
- $("#removeSelectedRegimenButton").hide();
- Cp.IntakeHome.AuthRequest.Instance.ProcessRegimenPeeking();
- }
- loadRegimen(item, regimenViewModel.regimenSelectionGrid.MGFMedications);
- if (contextRequestTypeUmIntake) {
- Cp.Utilities.Instance.ScrollToElement("#regimens");
- }
- }
- }
- function getRiskText(riskFactor) {
- switch (riskFactor) {
- case 725060000:
- return "Unspecified";
- break;
- case 725060001:
- return "Minimal";
- break;
- case 725060002:
- return "Low";
- break;
- case 725060003:
- return "Moderate";
- break;
- case 725060004:
- return "High";
- break;
- case 725060005:
- return "Intermediate";
- }
- return "Not Specified";
- }
- regimenViewModel.getEmetogenicRiskText = function (data) {
- if (data.RiskFactor == undefined)
- return "";
- return getRiskText(data.RiskFactor());
- }
- regimenViewModel.getNeutropenicRiskText = function (data) {
- if (data.RiskFactorNeutropenic == undefined)
- return "";
- return getRiskText(data.RiskFactorNeutropenic());
- }
- function formatCurrency(value) {
- if (value != undefined && value != null)
- return value();
- }
- regimenViewModel.getAverageCostText = function (data) {
- if (data.RegimenCost == undefined)
- return "";
- return formatCurrency(data.RegimenCost.AverageCost);
- }
- regimenViewModel.GetAucScoreText = function (data) {
- if (data.AucScore == undefined)
- return "";
- return data.AucScore();
- }
- regimenViewModel.getMaximumDurationText = function (data) {
- if (data.MaximumDuration == undefined)
- return "";
- return data.MaximumDuration();
- }
- ko.applyBindings(regimenViewModel, document.getElementById('common-ui-regimen-selection'));
- ko.mapping.defaultOptions().ignore = ["__type"];
- var isRequestTypeUmIntake = REQUEST_TYPE === RequestTypeUmIntake;
- var requestType = $("input:hidden[name='RequestType']").attr("value");
- if (isRequestTypeUmIntake) { requestType = RequestTypeUmIntake; }
- var isSimulation = $("input:hidden[name='isSimulation']").attr("value");
- if (isRequestTypeUmIntake) { isSimulation = "false"; }
- selectableRegimenData = initialData;
- // ltrmikeliu the deserialization of the selectable regimens is very slow so move it to upon getting them from the service
- //if (selectableRegimenData.Regimens != null && selectableRegimenData.Regimens.length != 0 && isTestWindow != true ) {
- // saveSelectableRegimenToSession(requestType);
- //}
- //isTestWindow = false;
- var loadRegimen = function (regimenSet, MGFMedications) {
- try {
- //get the OOS Items for given Regimen
- var oosItems = null;
- if (!isTestWindow) {
- oosItems = checkForOOS(regimenSet.Id());
- }
- //hide once we have gotten the regimens
- $(".loading_spinner_regimen").hide();
- // setHasRegimens(jsonPackage.Questions, regimenSet);
- $("#regimens").buildRegimens(regimenSet, regimenSelectCallbackPortal30,
- regimenCheckmarkLocation, true,
- isSimulation, requestType, oosItems, false, MGFMedications);
- //once the call to the pathway regimens completes, get the non-pathway regimens
- // nonPathwayGet();
- } finally {
- resp = null;
- }
- };
- var checkForOOS = function (itemId) {
- if (typeof (contextIsSimulation) !== "undefined" && contextIsSimulation) return true;
- var returnValue = null;
- var currentData = { id: itemId, currentCallOn: "regimen" };
- var url = "/Authorization/NewRequest/CheckOutOfScope";
- if (requestType != undefined && requestType == "CrmRequest") {
- url = "/QandARegimen/QandARegimen/CheckOutOfScope";
- if (currentCrmServiceId == undefined || currentCrmServiceId == '')
- currentCrmServiceId = getQueryString('serviceRequestId');
- //if (currentCrmUserId == undefined || currentCrmUserId == '')
- // currentCrmUserId = getQueryString('userId');
- currentData = { id: itemId, currentCallOn: "regimen", serviceId: currentCrmServiceId };
- }
- var isUmIntake = requestType === RequestTypeUmIntake;
- if (isUmIntake) {
- url = "/IntakeHome/NewRequest/CheckOutOfScope";
- currentData = $.extend({},
- currentData,
- {
- specialtyId: Cp.IntakeHome.Data.Instance.GeneralInfo.GetSpecialtyId(),
- payerId: Cp.IntakeHome.Data.Instance.GeneralInfo.GetPayerId(),
- networkId: Cp.IntakeHome.Data.Instance.FromProviderInfo.GetNetworkId()
- });
- }
- $.ajax(url, {
- type: "GET",
- async: false,
- data: currentData,
- cache: false,
- contentType: 'application/json; charset=utf-8',
- success: function (resp) {
- try {
- returnValue = resp;
- } finally {
- resp = null;
- }
- },
- error: function (jqXHR, textStatus, errorThrown) {
- errorObj = new Object();
- errorObj.xhr = jqXHR;
- errorObj.text = textStatus;
- errorObj.error = errorThrown;
- }
- });
- return returnValue;
- };
- $(".btnDivLayout").show();
- var noRegimenSelection = isByPassingRegimenSelection();
- if (regimenViewModel.regimenSelectionGrid.Regimens() != null && regimenViewModel.regimenSelectionGrid.Regimens().length > 0) {
- var regimenMappingDialog = $(document).find("#regimenMappingDialog");
- var sortTableStr = regimenMappingDialog.length > 0 ? '#questionandRegimenModalWindow table.sortable' : 'table.sortable';
- var oTable = $(sortTableStr).dataTable({
- "bPaginate": false,
- "bLengthChange": false,
- "bFilter": false,
- "bSort": true,
- "bInfo": false,
- "bAutoWidth": false
- });
- // Sort immediately with columns 0 and 1
- oTable.fnSort([[2, 'asc'], [1, 'asc']]);
- oTable.fnSort([[1, 'desc'], [1, 'asc']]);
- $('#page-selection .regimen-selection-table tbody tr').each(function () {
- var firstTd = $(this).find("td:first");
- if (regimenViewModel.regimenSelectionGrid.SelectedRegimen() != null &&
- firstTd.val() == regimenViewModel.regimenSelectionGrid.SelectedRegimen()) {
- $(this).siblings('.selected').removeClass('selected');
- $(this).addClass('selected');
- }
- });
- } else {
- if ((requestType == undefined || requestType == null) && (isSimulation == undefined || isSimulation == null)) {
- isSimulation = 'true';
- }
- if ((requestType != undefined && requestType == "CrmRequest") || (isSimulation == 'true')) {
- var emptyMessageCell = $('#page-selection .regimen-selection-table > tbody > tr > td');
- emptyMessageCell[0].innerHTML = emptyMessageCell[0].innerText.split('.')[0] + ".";
- }
- if ((requestType == undefined || requestType != "CrmRequest") && (isSimulation != 'true')) {
- $("#Ntm").hide();
- if (!noRegimenSelection && REQUEST_TYPE !== RequestTypeUmIntake) //already taken the nextTab
- openNextTab();
- }
- }
- $('#page-selection .regimen-selection-table tbody tr').click(function (event) {
- if (regimenViewModel.regimenSelectionGrid.Regimens() != null && regimenViewModel.regimenSelectionGrid.Regimens().length > 0) {
- var target = $(event.target).closest('tr');
- target.siblings('.selected').removeClass('selected');
- target.siblings('.Peeking').removeClass('Peeking');
- if (REQUEST_TYPE === RequestTypeUmIntake) {
- target.addClass('Peeking');
- } else {
- target.addClass('selected');
- }
- $(".subpage").addClass('active');
- var offset = $('#page-selection').offset();
- var outerHeight = $('#page-selection').outerHeight(true);
- $(".subpage").css({
- minHeight: outerHeight,
- minWidth: $('#page-selection').outerWidth(true),
- backgroundColor: $("body").css("background-color")
- });
- if(REQUEST_TYPE !== RequestTypeUmIntake) {
- $("#dialog.subpage").offset({ top: offset.top, left: offset.left });
- }
- $(".btnDivLayout").hide();
- $("#DisplayPatientValError").html('');
- }
- });
- });
- }
- function DisplaySelectableRegimen(initialData) {
- var displaySelectableRegViewModel = {
- selectableRegimen: ko.mapping.fromJS(initialData)
- };
- displaySelectableRegViewModel.handleSelectRegimenClick = function (item) {
- $("#popRegimenDialog").buildRegimens(item, null, null, true, false, null, null, true, displaySelectableRegViewModel.selectableRegimen.MGFMedications);
- $("#popRegimenDialog").dialog({
- width: 'auto',
- resizable: true,
- modal: true,
- autoOpen: true,
- //width: 1250,
- close: function () {
- $("#popRegimenDialog").empty();
- },
- buttons: {
- "Close": function () {
- $("#popRegimenDialog").dialog("close");
- }
- }
- });
- };
- //KN - need to make reusable
- displaySelectableRegViewModel.getRiskText = function (riskFactor) {
- switch (riskFactor()) {
- case 725060000:
- return "Unspecified";
- break;
- case 725060001:
- return "Minimal";
- break;
- case 725060002:
- return "Low";
- break;
- case 725060003:
- return "Moderate";
- break;
- case 725060004:
- return "High";
- break;
- case 725060005:
- return "Intermediate";
- }
- return "Not Specified";
- };
- displaySelectableRegViewModel.formatCurrencyAverageCost = function (regimenCost) {
- if (regimenCost != null && regimenCost.AverageCost != null)
- return regimenCost.AverageCost;
- return "";
- };
- return displaySelectableRegViewModel;
- }
- function GetObjectValue(objectRecord) {
- if (typeof (objectRecord) == "function") {
- return objectRecord();
- }
- return objectRecord;
- }
- //remove , clear and hide the question answer section
- function removeAndHideQandASection(useAsync) {
- var isSimulatorFlg = $("input:hidden[name='isSimulation']").attr("value");
- var url = "/Authorization/RegimenSelection/DeleteCurrentRegimenConversation";
- $.ajax({
- url: url,
- data: { isSimulator: isSimulatorFlg },
- type: 'POST',
- async: useAsync,
- success: function () {
- try {
- $("#clinicalInformationSection").hide();
- $("#commonUiClinicalInformationSection").html('');
- $("#DisplayPatientValError").html('');
- if ($(document).find("#surgicalInformationSection").length > 0) {
- $("#surgicalInformationSection").hide();
- }
- } finally {
- result = null;
- }
- },
- error: function (xhr, ajaxOptions, thrownError) {
- alert(xhr.status);
- alert(thrownError);
- }
- });
- }
- //Common Ui Scripts---->End
- function initializeTest() {
- reinitializeModal();
- $(document).on("click", "#Next", function () {
- if (validateQuestionAnswers()) {
- $("#DisplayPatientValError").html('');
- getRegimens(getSelectedQuestionAnswers(), "TestRequest");
- $("#commonUiClinicalInformationSection").hide();
- $("#commonUiregimenSelectionSection").show();
- $("#Previous").show();
- $("#Next").hide();
- } else {
- $("#DisplayPatientValError").html('');
- $("#DisplayPatientValError").html("*Please answer all questions before moving to next step.");
- return false;
- }
- });
- $(document).on("click", "#Previous", function () {
- $("#Previous").hide();
- $("#commonUiClinicalInformationSection").show();
- $("#commonUiregimenSelectionSection").hide();
- $("#Next").show();
- });
- }
- function initializeModalWindow(requestType) {
- REQUEST_TYPE = (requestType != undefined && requestType != "") ? requestType : "CrmRequest";
- reinitializeModal();
- $(document).on("click", "#Next", function () {
- if (validateQuestionAnswers() && ValidateSurgicalInformation()) {
- $("#DisplayPatientValError").html('');
- getRegimens(getSelectedQuestionAnswers(), REQUEST_TYPE);
- $("#commonUiClinicalInformationSection").hide();
- $("#commonUiregimenSelectionSection").show();
- $("#Previous").show();
- if (REQUEST_TYPE == "PortalDssRequest") {
- $("#portalDssSave").show();
- $("#surgicalInformationSectionDiv").hide();
- }
- $("#Next").hide();
- $("#portalDssQASave").hide();
- } else {
- $("#DisplayPatientValError").html('');
- $("#DisplayPatientValError").html("*Please answer all questions before moving to next step.");
- return false;
- }
- });
- $(document).on("click", "#portalDssQASave", function () {
- if (validateQuestionAnswers(undefined, undefined, undefined, true)) {
- $("#DisplayPatientValError").html('');
- if ($("#surgicalInformationSectionDiv").html().trim() != '') {
- if (!ValidateSurgicalInformation()) {
- return false;
- } else {
- GetSurgicalInfoModifiedFieldReasonCodes("");
- var dssSelectedQuestionsAndAnswers = getSelectedQuestionAnswers();
- }
- } else {
- var dssSelectedQuestionsAndAnswers = getSelectedQuestionAnswers();
- savePortalDssCoversation(dssSelectedQuestionsAndAnswers);
- }
- } else {
- $("#DisplayPatientValError").html('');
- $("#DisplayPatientValError").html("*Please answer all questions before moving to next step.");
- return false;
- }
- });
- $(document).on("click", "#Previous", function () {
- $("#Previous").hide();
- $("#portalDssSave").hide();
- $("#commonUiClinicalInformationSection").show();
- $("#commonUiregimenSelectionSection").hide();
- $("#Next").show();
- $("#portalDssQASave").show();
- $("#surgicalInformationSectionDiv").show();
- });
- }
- function loadTestWindow(triggerId) {
- reinitializeModal();
- $("#Close").hide();
- $("#displayProcessing").dialog({
- height: 150,
- width: 150,
- resizable: false,
- modal: true,
- autoOpen: true,
- closeOnEscape: false,
- open: function (event, ui) {
- $(".ui-dialog-titlebar-close").hide();
- }
- });
- currentRuleTriggerId = triggerId;
- isTestWindow = true;
- $("#Previous").hide();
- $("#commonUiClinicalInformationSection").show();
- $("#commonUiregimenSelectionSection").hide();
- $("#Next").show();
- loadClinicalInformationQuestions("TestRequest");
- $("#displayProcessing").dialog("destroy");
- $("#questionandRegimenModalWindow").dialog({
- width: 1000,
- height: 800,
- resizable: true,
- modal: true,
- autoOpen: true,
- title: "Test",
- open: function (event, ui) {
- $("#questionandRegimenModalWindow").closest(".ui-dialog").find(".ui-dialog-titlebar-close").show();
- }
- });
- }
- function loadSupplementalTestWindow(triggerId) {
- reinitializeModal();
- $("#Previous").hide();
- $("#Next").hide();
- $("#Close").show();
- $("#questionandRegimenModalWindow").dialog({
- width: 1000,
- height: 800,
- resizable: true,
- modal: true,
- autoOpen: false,
- title: "Test Dss Supplemental",
- open: function (event, ui) {
- $("#questionandRegimenModalWindow").closest(".ui-dialog").find(".ui-dialog-titlebar-close").show();
- }
- });
- $("#questionandRegimenModalWindow").dialog('open');
- $("#Close").click(function () {
- $("#Close").hide();
- $("#questionandRegimenModalWindow").dialog('close');
- });
- currentRuleTriggerId = triggerId;
- isTestWindow = true;
- $("#commonUiClinicalInformationSection").show();
- $("#commonUiregimenSelectionSection").hide();
- loadClinicalInformationQuestions("TestRequest");
- }
- function getQueryStringParams() {
- var queryString = [];
- var hash;
- var currentUrl = decodeURIComponent(document.URL);
- var hashes = currentUrl.slice(currentUrl.indexOf('?') + 1).split('&');
- for (var i = 0; i < hashes.length; i++) {
- hash = hashes[i].split('=');
- queryString.push(hash[0]);
- queryString[hash[0]] = hash[1];
- }
- return queryString;
- }
- function getQueryString(key) {
- var params = getQueryStringParams();
- return params[key];
- }
- function loadClinicalSection(RequestType) {
- REQUEST_TYPE = RequestType;
- reinitializeModal();
- $("#displayProcessing").dialog({
- height: 150,
- width: 150,
- resizable: false,
- modal: true,
- autoOpen: true,
- closeOnEscape: false,
- open: function (event, ui) {
- $(".ui-dialog-titlebar-close").hide();
- }
- });
- $("#Previous").hide();
- $("#commonUiClinicalInformationSection").show();
- $("#commonUiregimenSelectionSection").hide();
- if (RequestType == "CrmRequest") {
- if (currentDeterminationSupportId == undefined || currentDeterminationSupportId == '')
- currentDeterminationSupportId = getQueryString('determinationSupportId');
- if (currentCrmPassedIcdId == undefined || currentCrmPassedIcdId == '') {
- currentCrmPassedIcdId = getQueryString('icdId');
- }
- if (currentDeterminationSupportId != undefined &&
- currentDeterminationSupportId != '') {
- $("#Next").hide();
- $("#dssSave").show();
- $("#dssCancel").show();
- }
- else {
- $("#Next").show();
- $("#dssSave").hide();
- $("#dssCancel").hide();
- }
- } else if (RequestType == "PortalDssRequest") {
- if (currentDeterminationSupportId == undefined || currentDeterminationSupportId == '')
- currentDeterminationSupportId = getQueryString('determinationSupportId');
- if (currentCrmPassedIcdId == undefined || currentCrmPassedIcdId == '') {
- currentCrmPassedIcdId = getQueryString('icdId');
- }
- $("#Next").show();
- $("#portalDssQASave").show();
- $("#dssSave").hide();
- $("#dssCancel").show();
- }
- else {
- $("#Next").show();
- }
- loadClinicalInformationQuestions(RequestType);
- $("#displayProcessing").dialog("destroy");
- if (RequestType == "CrmRequest" && currentDeterminationSupportId != undefined && currentDeterminationSupportId != '') {
- $("#dssSave").click(function () {
- if (currentCrmIsDssSupplemental == undefined || currentCrmIsDssSupplemental == '')
- currentCrmIsDssSupplemental = getQueryString('isDssSupplemental');
- if (currentCrmIsDssSupplemental != 'true') {
- if (validateQuestionAnswers()) {
- $("#DisplayPatientValError").html('');
- getRegimens(getSelectedQuestionAnswers(), "CrmRequest");
- } else {
- $("#DisplayPatientValError").html('');
- $("#DisplayPatientValError").html("*Please answer all questions before saving.");
- return false;
- }
- }
- else {
- getRegimens(getSelectedQuestionAnswers(), "CrmRequest");
- }
- });
- $("#dssCancel").click(function () { window.close(); });
- } else if (RequestType == "PortalDssRequest" && currentDeterminationSupportId != undefined && currentDeterminationSupportId != '') {
- $("#portalDssSave").click(function () {
- if (currentCrmIsDssSupplemental == undefined || currentCrmIsDssSupplemental == '')
- currentCrmIsDssSupplemental = getQueryString('isDssSupplemental');
- if (currentCrmIsDssSupplemental != 'true') {
- if (validateQuestionAnswers()) {
- if ($("#surgicalInformationSectionDiv").html().trim() != '') {
- if (!ValidateSurgicalInformation()) {
- return false;
- } else {
- $("#DisplayPatientValError").html('');
- GetSurgicalInfoModifiedFieldReasonCodes(selectedRegimenId);
- }
- } else {
- $("#DisplayPatientValError").html('');
- savePortalDssCoversationAndSelectedRegimen(getSelectedQuestionAnswers(), selectedRegimenId);
- }
- } else {
- $("#DisplayPatientValError").html('');
- $("#DisplayPatientValError").html("*Please answer all questions before saving.");
- return false;
- }
- }
- // check for supplemental dss
- });
- $("#dssCancel").click(function () { window.close(); });
- }
- }
- function reinitializeModal() {
- $("#DisplayPatientValError").html('');
- $("#commonUiClinicalInformationSection").html('');
- $("#commonUiregimenSelectionSection").html('');
- }
- var requestController;
- //Display clinical javascript
- function ClinicalEventHandler(isEnhancedDiagnosisSelectorFeatureChanged) {
- //var requestController;
- $(document).ready(function () {
- var networkId = $('#networkSelectWrapper').find(':selected').val();
- var diagnosisCode = $('#ServiceRequest_PrimaryDiagnosis_Icd9').attr('value');
- var isSimulation = $("input:hidden[name='isSimulation']").attr("value");
- if (isSimulation == 'true') {
- requestController = "SimulateRequest";
- } else {
- requestController = "NewRequest";
- }
- var isEnhancedDiagnosisSelectorFeatureChangedBool = isEnhancedDiagnosisSelectorFeatureChanged === "True";
- if (isEnhancedDiagnosisSelectorFeatureChangedBool) {
- HandleDiagnosisRemoval(false);
- }
- var hasUseEnhancedDiagnosisSelector = typeof (useEnhancedDiagnosisSelector) != "undefined" && useEnhancedDiagnosisSelector && typeof (enhancedDiagnosisSelectorKoObject) != "undefined" && enhancedDiagnosisSelectorKoObject;
- if (networkId && diagnosisCode && (!hasUseEnhancedDiagnosisSelector || enhancedDiagnosisSelectorKoObject.IsSelectionValidated())) {
- loadClinicalInformationQuestions(requestController);
- $("#clinicalInformationSection").show();
- $("#DisplayPatientValError").html('');
- if ($(document).find("#surgicalInformationSection").length > 0) {
- $("#surgicalInformationSection").show();
- }
- $(".loading_spinner_patient_search").hide();
- }
- if (!hasUseEnhancedDiagnosisSelector) {
- $('#clinicalPageLoadingDiv').hide();
- }
- Cp.NewRequest.CommonProcessor.Instance.PartiallyLockApplicableNewRequestFields();
- });
- //Removing Primary diagnosis
- $(document).ready(function () {
- loadDiagCodeSearchBox();
- // End of validation logic for grey out
- $('#primaryDiagnosisSearchTerm').click(function () {
- if ($("#primaryDiagnosisSearchTerm").val() == "Search by ICD or Diagnosis Code" || $("#primaryDiagnosisSearchTerm").val() == "Secondary Diagnosis") {
- $('#hdnTextVal').val($('#primaryDiagnosisSearchTerm').val());
- $('#primaryDiagnosisSearchTerm').val("");
- }
- $('#primaryDiagnosisSearchTerm').css("color", "#555555");
- });
- $('#primaryDiagnosisSearchTerm').blur(function () {
- if ($('#primaryDiagnosisSearchTerm').val().trim() == "")
- loadDiagCodeSearchBox();
- });
- function loadDiagCodeSearchBox() {
- $('#primaryDiagnosisSearchTerm').val("Search by ICD or Diagnosis Code");
- $('#primaryDiagnosisSearchTerm').css("color", "#999999");
- // Added validation logic for grey out
- if ($("#DiagnosisPrimary").html() != undefined) {
- if ($("#DiagnosisPrimary").is(":visible")) {
- $('#primaryDiagnosisSearchTerm').val("Search by ICD or Diagnosis Code");
- }
- } else {
- if ($("#DiagnosisPrimary").html() != undefined && $("#DiagnosisSecondary").html() != undefined) {
- if ($("#DiagnosisSecondary").is(":visible") && !$("#DiagnosisPrimary").is(":visible")) {
- $('#primaryDiagnosisSearchTerm').val("Search by ICD or Diagnosis Code");
- } else if ($("#DiagnosisPrimary").is(":visible") && $("#DiagnosisSecondary").is(":visible")) {
- $('#primaryDiagnosisSearchTerm').addClass("textBackgroundGrey");
- $('#primaryDiagnosisSearchTerm').attr('readonly', true);
- } else if (!$("#DiagnosisPrimary").is(":visible") && !$("#DiagnosisSecondary").is(":visible")) {
- $('#primaryDiagnosisSearchTerm').val("Search by ICD or Diagnosis Code");
- }
- }
- }
- }
- //Getting Primary diagnosis results
- $('#searchPrimaryDiagnosis_button').click(function () {
- getPrimaryDiagnosisResult();
- }
- );
- $('#searchPrimaryDiagnosis_button').keypress(function (e) {
- $('#hdnTextVal').val("Search by ICD or Diagnosis Code");
- if (e.which == 13) {
- getPrimaryDiagnosisResult();
- }
- });
- function getPrimaryDiagnosisResult() {
- $("#DiagnosisSearch").val($("#primaryDiagnosisSearchTerm").val());
- var searchTerm = $("#primaryDiagnosisSearchTerm").val().trim();
- if ($('#hdnTextVal').val() == "Search by ICD or Diagnosis Code" && searchTerm.length > 0 && (searchTerm != "Search by ICD or Diagnosis Code" && searchTerm != "Secondary Diagnosis")) {
- $(".loading_spinner_primary_diagnosis").show();
- var url = "/Authorization/" + requestController + "/PrimaryDiagnosisSearch";
- $.ajax({
- url: url,
- data: { "searchTerm": searchTerm },
- type: 'POST',
- success: function (result) {
- try {
- $('#primaryDiagnosisSearchResults').html('');
- $('#secondaryDiagnosisSearchResults').html('');
- $('#primaryDiagnosisSearchResults').html(result);
- $(".loading_spinner_primary_diagnosis").hide();
- $('#primaryDiagnosisSearchResults').show();
- } finally {
- result = null;
- }
- },
- error: function (xhr, ajaxOptions, thrownError) {
- alert(xhr.status);
- alert(thrownError);
- }
- });
- }
- //Getting Secondary diagnosis results
- /*
- else {
- if ($('#hdnTextVal').val() == "Secondary Diagnosis" && searchTerm.length > 0 && (searchTerm != "Search by ICD or Diagnosis Code" && searchTerm != "Secondary Diagnosis")) {
- $(".loading_spinner_patient_search").show();
- var url = "/Authorization/" + requestController + "/SecondaryDiagnosisSearch";
- $.ajax({
- url: url,
- data: { "searchTerm": searchTerm },
- type: 'POST',
- success: function (result) {
- try {
- $('#primaryDiagnosisSearchResults').html('');
- $('#secondaryDiagnosisSearchResults').html('');
- $('#secondaryDiagnosisSearchResults').html(result);
- $(".loading_spinner_patient_search").hide();
- $('#secondaryDiagnosisSearchResults').show();
- } finally {
- result = null;
- }
- },
- error: function (xhr, ajaxOptions, thrownError) {
- alert(xhr.status);
- alert(thrownError);
- }
- });
- }
- }
- */
- }
- });
- }
- //End of Display Clinical javascript
- function LoadClinicalQuestions(contextRequestType) {
- loadClinicalInformationQuestions(contextRequestType);
- $("#clinicalInformationSection").show();
- if ($(document).find("#surgicalInformationSection").length > 0) {
- $("#surgicalInformationSection").show();
- }
- HandleDiagnosisSelectionCompletion(contextRequestType);
- }
- function HandleDiagnosisSelectionCompletion(contextRequestType) {
- $("#DisplayPatientValError").html('');
- if (contextRequestType == "NewRequest") {
- $("#saveDraft").show();
- $("#startOverButton").show();
- }
- }
- $(function () {
- $(document).on("click", "#btnSelectPrimary", (function () {
- if ($("#common-ui-regimen-popselection").exists()) {
- $("#common-ui-regimen-popselection").empty();
- }
- if ($('#tblPrimaryResults div.trSelected').attr('id') != undefined) {
- var selectedId = $('#tblPrimaryResults div.trSelected').attr('id');
- if (REQUEST_TYPE != "PortalDssRequest") {
- var searchDiagUrl = "/Authorization/" + requestController + "/PrimaryDiagnosisSelect";
- var isSimulation = $("input:hidden[name='isSimulation']").attr("value");
- if (isSimulation == "true" || checkForOOSDiagnosis(selectedId)) {
- $.ajax({
- cache: false,
- url: searchDiagUrl,
- data: { selectGuid: selectedId },
- success: function (response) {
- try {
- $('#primaryDiagnosisSearchSelection').html('');
- $('#primaryDiagnosisSearchResults').slideUp();
- $("#primaryDiagnosisSearchSelection").html(response);
- $("#NoQnACheck").attr('checked', false);
- $("#ClinicalNoQnASection").hide();
- $("#commonUiClinicalInformationSection").show();
- if($(document).find("#NoQnACheck").length>0 && $(document).find("#NoQnACheck").is(":checked")) {
- $(document).find("#NoQnACheck").click();
- }
- LoadClinicalQuestions(requestController);
- $("#primaryDiagnosisSearchSelection").show();
- if ($("#DiagnosisSecondary").html() != undefined) {
- if ($("#DiagnosisSecondary").is(":visible")) {
- $('#primaryDiagnosisSearchTerm').addClass("textBackgroundGrey");
- $('#primaryDiagnosisSearchTerm').attr('readonly', true);
- }
- }
- } finally {
- response = null;
- }
- },
- error: function (xhr, ajaxOptions, thrownError) {
- alert(xhr.status);
- alert(thrownError);
- }
- });
- }
- } else {
- var selectedDiagnosisName = $('#tblPrimaryResults div.trSelected').text().trim();
- oldSelectedDiagnosisName = $("#selectedDiagnosis").text().trim();
- dssSelectedDiagnosisName = selectedDiagnosisName;
- $("#selectedDiagnosis").text(selectedDiagnosisName);
- $("#hdnICDIdGuid").val(selectedId);
- $('#primaryDiagnosisSearchSelection').html('');
- $('#primaryDiagnosisSearchResults').slideUp();
- $("#primaryDiagnosisSearchSelection").show();
- }
- $('#primaryDiagnosisSearchTerm').css("color", "#999999");
- $('#primaryDiagnosisSearchTerm').val("Search by ICD or Diagnosis Code");
- }
- }));
- //Applied Raka table styles to Primary diagnosis results
- $(document).on("click", ".primarySearchResultTr", (function () {
- $("#tblPrimaryResults div").removeClass("trSelected");
- rakaStyleForTables();
- var selected = $(this).index();
- $(this).removeClass("tblOddRow");
- $(this).removeClass("tblEvenRow");
- $(this).addClass("trSelected");
- }));
- //Applied Raka table styles to Secondary diagnosis results
- $(document).on("click", ".secondarySearchResultTr", (function () {
- $("#tblSecondaryResults div").removeClass("trSelected");
- rakaStyleForTables();
- var selected = $(this).index();
- $(this).removeClass("tblOddRow");
- $(this).removeClass("tblEvenRow");
- $(this).addClass("trSelected");
- }));
- $(document).on("click", "#btnSelectSecondary", (function () {
- if ($('#tblSecondaryResults div.trSelected').attr('id') != undefined) {
- var selectedId = $('#tblSecondaryResults div.trSelected').attr('id');
- var searchDiagUrl = "/Authorization/" + requestController + "/SecondaryDiagnosisSelect";
- $.ajax({
- cache: false,
- url: searchDiagUrl,
- data: { selectGuid: selectedId },
- success: function (response) {
- try {
- $("#secondaryDiagnosisSearchSelection").html('');
- $('#secondaryDiagnosisSearchResults').slideUp();
- $("#secondaryDiagnosisSearchSelection").html(response);
- $("#secondaryDiagnosisSearchSelection").show();
- $('#primaryDiagnosisSearchTerm').addClass("textBackgroundGrey");
- $('#primaryDiagnosisSearchTerm').attr('readonly', true);
- } finally {
- response = null;
- }
- $('#primaryDiagnosisSearchTerm').val("");
- },
- error: function (xhr, ajaxOptions, thrownError) {
- alert(xhr.status);
- alert(thrownError);
- }
- });
- }
- }));
- //Cancelling Primary diagnosis results
- $(document).on("click", "#btnCancelPrimary", (function () {
- $("#primaryDiagnosisSearchResults").hide();
- $('#primaryDiagnosisSearchTerm').css("color", "#999999");
- $('#primaryDiagnosisSearchTerm').val("Search by ICD or Diagnosis Code");
- }));
- //Cancelling Secondary diagnosis results
- $(document).on("click", "#btnCancelSecondary", (function () {
- $("#secondaryDiagnosisSearchResults").hide();
- }));
- $(document).on('click', '.removePrimaryIcd', function () {
- $("#DiagnosisPrimary").html('');
- $('#primaryDiagnosisSearchTerm').val("");
- $('#primaryDiagnosisSearchTerm').val("Search by ICD or Diagnosis Code");
- $("#primaryDiagnosisSearchSelection").hide();
- $('#primaryDiagnosisSearchTerm').removeClass("textBackgroundGrey");
- $('#primaryDiagnosisSearchTerm').attr('readonly', false);
- $('#primaryDiagnosisSearchTerm').css("color", "#999999");
- $("#saveDraft").hide();
- $("#startOverButton").hide();
- $('#secondaryDiagnosisSearchResults').hide();
- HandleDiagnosisRemoval(true);
- });
- //Removing Secondary diagnosis
- $(document).on('click', '.secondaryremove', function () {
- clearSecondaryDiagnosis();
- if ($('#primaryDiagnosisSearchTerm').val() != "Search by ICD or Diagnosis Code") {
- $('#primaryDiagnosisSearchTerm').val("");
- $('#primaryDiagnosisSearchTerm').val("Search by ICD or Diagnosis Code");
- }
- $('#primaryDiagnosisSearchTerm').css("color", "#999999");
- $('#primaryDiagnosisSearchTerm').removeClass("textBackgroundGrey");
- $('#primaryDiagnosisSearchTerm').attr('readonly', false);
- $("#secondaryDiagnosisSearchSelection").hide();
- });
- function clearSecondaryDiagnosis() {
- $("#secondaryDiagnosisSearchSelection").load("/NewRequest/SecondaryDiagnosisRemove");
- }
- function rakaStyleForTables() {
- $("div#tblPrimaryResults div:even").addClass("tblOddRow");
- $("div#tblPrimaryResults div:odd").addClass("tblEvenRow");
- }
- });
- //On-Removal of content inside tab disable successor tabs link
- function disableSuccessorNavLnk() {
- //$("#portalNavigation li.active a").attr('href')
- var activeIndex = $("#portalNavigation li.active").index();
- $('#portalNavigation a').each(function (e) {
- if (e > activeIndex) {
- $(this).data('href', $(this).attr('href'));
- $(this).removeAttr('href');
- }
- });
- }
- //Clear service items
- function clearServiceItems() {
- $('#requestedItemsContainer').html('');
- $('#requestedItemsContainer').load('/Authorization/NewRequestHelper/RegimenSelect',
- {
- ModelType: GetClinicalInformationJsContextRegimenAssemblyQualifiedName()
- });
- }
- function HandleDiagnosisRemoval(useAsync) {
- //Clear Service Items
- if ($("[name$='].ServiceItem.Id']").length > 0) {
- clearServiceItems();
- }
- //To restrict the top navigation
- disableSuccessorNavLnk();
- //remove clinical section and delete the regimen conversation from session
- if ($("#commonUiClinicalInformationSection").html().length != 0) {
- removeAndHideQandASection(useAsync);
- }
- }
- function checkForOOSDiagnosis(itemId) {
- var isRequestTypeUmIntake = REQUEST_TYPE === RequestTypeUmIntake;
- var returnValue = true;
- if (typeof (contextIsSimulation) !== "undefined" && contextIsSimulation) return true;
- var currentData = isRequestTypeUmIntake
- ? {
- id: itemId,
- currentCallOn: "diagnosis",
- specialtyId: Cp.IntakeHome.Data.Instance.GeneralInfo.GetSpecialtyId(),
- payerId: Cp.IntakeHome.Data.Instance.GeneralInfo.GetPayerId(),
- networkId: Cp.IntakeHome.Data.Instance.FromProviderInfo.GetNetworkId()
- }
- : { id: itemId, currentCallOn: "diagnosis" };
- var url = isRequestTypeUmIntake ? "/IntakeHome/NewRequest/CheckOutOfScope" : "/Authorization/NewRequest/CheckOutOfScope";
- $.ajax(url, {
- type: "GET",
- async: false,
- data: currentData,
- cache: false,
- success: function (resp) {
- try {
- var outOfScopeItems = (resp != undefined && resp != null && resp != '') && (resp.OutOfSupportedScopeItems != null) ? resp.OutOfSupportedScopeItems : null;
- var isOos = false;
- var outOfScopeAction = (resp != undefined && resp != null && resp != '' && resp.OutOfSupportedScopeActionInfo != null) ? resp.OutOfSupportedScopeActionInfo : null;
- if (outOfScopeItems != undefined && outOfScopeItems != null) {
- $.each(outOfScopeItems, function (index, outOfScopeItem) {
- if (outOfScopeItem.ScopeItemId == itemId)
- isOos = true;
- });
- }
- //NoMessageDecompNoMedsSplitForward = 725060000,
- //NoMessageAllowDecompMedsSplitForwardOutOfScope = 725060001,
- //ShowMessageStopDecomp = 725060002,
- if ((isOos) && ((outOfScopeAction != undefined && outOfScopeAction != null) && (outOfScopeAction.OutOfSupportedScopeActionType != "725060000") && (outOfScopeAction.OutOfSupportedScopeActionType != "725060001"))) {
- alert(outOfScopeAction.OutOfSupportedScopeMessage);
- }
- if ((outOfScopeAction != undefined && outOfScopeAction != null) && outOfScopeAction.OutOfSupportedScopeActionType == "725060002") {
- returnValue = false;
- }
- } finally {
- resp = null;
- }
- },
- error: function (jqXHR, textStatus, errorThrown) {
- errorObj = new Object();
- errorObj.xhr = jqXHR;
- errorObj.text = textStatus;
- errorObj.error = errorThrown;
- },
- contentType: 'application/json; charset=utf-8'
- });
- return returnValue;
- }
- function getIsDirtyFlag() {
- return isQADirty;
- }
- function setIsDirtyFlag(p_isQADirty) {
- isQADirty = p_isQADirty;
- }
- function LoadSurgicalInformationSection(requestType) {
- var urlPath;
- if (requestType == "NewRequest") {
- urlPath = "/Authorization/NewRequest/LoadSurgicalInformationSection";
- $.ajax({
- type: 'GET',
- cache: false,
- async: false,
- url: urlPath,
- dataType: 'html',
- success: function (surgicalInfoHtml) {
- $("#surgicalInformationSectionDiv").html('');
- $("#surgicalInformationSectionDiv").html(surgicalInfoHtml);
- },
- error: function (xhr, thrownError) {
- alert(xhr.status);
- alert(thrownError);
- }
- });
- } else if (requestType == "PortalDssRequest") {
- urlPath = "/Determination/Request/LoadSurgicalInformationSection";
- $.ajax({
- type: 'POST',
- cache: false,
- async: false,
- url: urlPath,
- contentType: "application/json; charset=utf-8",
- data: JSON.stringify({ "authorizationRequestIdString": window.opener.$("#hdnAuthGuid").val() }),
- dataType: 'html',
- success: function (surgicalInfoHtml) {
- $("#surgicalInformationSectionDiv").html('');
- $("#surgicalInformationSectionDiv").html(surgicalInfoHtml);
- },
- error: function (xhr, thrownError) {
- alert(xhr.status);
- alert(thrownError);
- }
- });
- } else if (requestType == RequestTypeUmIntake) {
- urlPath = "/IntakeHome/AuthRequest/LoadSurgicalInformationSection";
- $.ajax({
- type: 'POST',
- cache: false,
- async: false,
- url: urlPath,
- contentType: "application/json; charset=utf-8",
- dataType: 'html',
- data: JSON.stringify({ "specialtyId": $("#GeneralInfoDataModel_SelectedSpecialtyId").val() }),
- success: function (surgicalInfoHtml) {
- $("#surgicalInfoContainer").empty();
- $("#surgicalInfoContainer").html(surgicalInfoHtml);
- },
- error: function (xhr, thrownError) {
- alert(xhr.status);
- alert(thrownError);
- }
- });
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement