Skip to content
Permalink
Browse files

Designed a simple useful Allergies detail's display and fixed compata…

…bility issues
  • Loading branch information
k-joseph committed Jun 29, 2015
1 parent 73ae6f3 commit f0454f506021dfe18b2d28d7db1dd8d09ccc281e
@@ -289,7 +289,7 @@ public void addSelectedFilterQueriesToQuery(SolrQuery query, List<String> select
}

/**
* Looks for any added filter fields onto the query and and returns its value names and counts
* Looks for any added filter fields onto the query and returns its value names and counts
*
* @param response
*/
@@ -357,8 +357,9 @@
<preConditions>
<tableExists tableName="chartsearch_synonyms" />
</preConditions>
<comment>Re-create chartsearch_synonyms table which is not yet being used</comment>
<dropTable tableName="chartsearch_synonyms"/>
<comment>Re-create chartsearch_synonyms table which is not yet being
used</comment>
<dropTable tableName="chartsearch_synonyms" />
<createTable tableName="chartsearch_synonyms">
<column name="synonym_id" type="int" autoIncrement="true">
<constraints primaryKey="true" nullable="false" />
@@ -6,7 +6,7 @@
jQuery( document ).ready(function() {
refresh_data();
jq('#first_obs_single').trigger('click');
autoClickFirstResultToShowItsDetails();
});
/* document.getElementById('result_main_box').innerHTML += resultText;*/
@@ -515,7 +515,7 @@
if(cats === "") {
cats = categories;
}
reInitializeGlobalVars();
jq(".obsgroup_view").empty();
jq("#found-results-summary").html('');
jq("#obsgroups_results").html('<img class="search-spinner" src="../ms/uiframework/resource/uicommons/images/spinner.gif">');
@@ -537,7 +537,7 @@
refresh_data();
jq(".results_table_wrap").fadeIn(500);
jq('#first_obs_single').trigger('click');
autoClickFirstResultToShowItsDetails();
jq(".inside_filter_categories").fadeIn(500);
jq("#bookmark-category-names").text(cats);
jq("#bookmark-search-phrase").text(phrase);
@@ -218,6 +218,7 @@
var patientId = jq("#patient_id").val().replace("Patient#", "");
var categories = getAllCheckedCategoriesOrFacets();
reInitializeGlobalVars();
jq("#chart-previous-searches-display").hide();
jq(".obsgroup_view").empty();
jq("#found-results-summary").html('');
@@ -240,7 +241,7 @@
refresh_data();
jq(".results_table_wrap").fadeIn(500);
jq('#first_obs_single').trigger('click');
autoClickFirstResultToShowItsDetails();
jq(".inside_filter_categories").fadeIn(500);
showHistorySuggestionsOnLoad();
@@ -77,8 +77,8 @@ function single_sort_func(a, b) {
return dates.compare(first_date, second_date);
}

function addAllSingleObs(obsJSON) {// TODO rename to:
// addAllSingleObsAndAllergies(obsJSON)
function addAllSingleObs(obsJSON) {
// TODO rename to: addAllSingleObsAndAllergies(obsJSON)
console.log(obsJSON);
var resultText = '';
var single_obsJSON = obsJSON.obs_singles;
@@ -168,9 +168,9 @@ function addAllergiesToResults(allergy, noObsSingle) {
var allergyNonCodedReaction = allergy.allergenNonCodedReaction;
var allergyComment = allergy.allergenComment;
var allergyDate = allergy.allergenDate;
var title = !allergyNonCodedName && allergyNonCodedName === "" ? allergyCodedName
var title = !allergyNonCodedName || allergyNonCodedName === "" ? allergyCodedName
: allergyNonCodedName;
var reaction = !allergyNonCodedReaction && allergyNonCodedReaction === "" ? allergyCodedReaction
var reaction = !allergyNonCodedReaction || allergyNonCodedReaction === "" ? allergyCodedReaction
: allergyNonCodedReaction;
var resultText = '';
var allergyIdHtml;
@@ -187,7 +187,7 @@ function addAllergiesToResults(allergy, noObsSingle) {
resultText += '<div class="obsgroup_first_row">';
resultText += '<div class="obsgroup_titleBox">';
resultText += '<h3 class="obsgroup_title">';
resultText += capitalizeFirstLetter(title);
resultText += title;
resultText += '</h3>';
resultText += '<br><span class="obsgroup_date">';
resultText += getDateStr(allergyDate, true);
@@ -451,15 +451,55 @@ function load_single_detailed_obs(obs_id) {
}
}

function getAllergy(allergyId) {
for (i = 0; i < jsonAfterParse.patientAllergies.length; i++) {
var allergy = jsonAfterParse.patientAllergies[i];
if (allergy.allergenId === allergyId) {
return allergy;
}
}
}

function load_allergen(allergeId) {
removeAllHovering();
if (firstAllergen && firstAllergen.allergenId == allergeId) {
$("#first_alergen").addClass("obsgroup_current");
} else {
$("#allergen_" + allergeId).addClass("obsgroup_current");
}
$(".obsgroup_view").empty();
// TODO load the right section details
var resultText = '';
var allergy = getAllergy(allergeId);
var allergen = (!allergy.allergenNonCodedName || allergy.allergenNonCodedName === "") ? allergy.allergenCodedName
: allergy.allergenNonCodedName;
var reaction = (!allergy.allergenNonCodedReaction || allergy.allergenNonCodedReaction === "") ? allergy.allergenCodedReaction
: allergy.allergenNonCodedReaction;
var severity = allergy.allergenSeverity;
var type = allergy.allergenType;
var comment = allergy.allergenComment;
var date = getDateStr(allergy.allergenDate, true);

if (!severity) {
severity = "";
} else {
severity = capitalizeFirstLetter(severity);
}

resultText += '<div class="obsgroup_view">';
resultText += '<h3 class="chartserach_center">';
resultText += allergen;
resultText += '</h3>';
resultText += '<table>'
resultText += '<tr><th>Allergen:</th><td>' + allergen + '</td></tr>'
resultText += '<tr><th>Type:</th><td>' + type + '</td></tr>'
resultText += '<tr><th>Severity:</th><td>' + severity + '</td></tr>'
resultText += '<tr><th>Reaction:</th><td>' + reaction + '</td></tr>'
resultText += '<tr><th>Comment:</th><td>' + comment + '</td></tr>'
resultText += '<tr><th>Last Updated:</th><td>' + date + '</td></tr>'
resultText += '</table>'
resultText += '</div>';

$("#obsgroup_view").html(resultText);
}

function updateNavigationIndicesToClicked(id) {
@@ -1025,7 +1065,8 @@ function refresh_data() {
} else {
searchText.value = jsonAfterParse.search_phrase;
var numberOfResults = jsonAfterParse.obs_groups.length
+ jsonAfterParse.obs_singles.length + jsonAfterParse.patientAllergies.length;
+ jsonAfterParse.obs_singles.length
+ jsonAfterParse.patientAllergies.length;
document.getElementById('found-results-summary').innerHTML = "<b>"
+ numberOfResults + "</b> Results (<b>"
+ jsonAfterParse.retrievalTime + "</b> seconds)";
@@ -1339,4 +1380,23 @@ function invokeDialog(dialogMessageElement, dialogTitle, dialogWidth) {
title : dialogTitle,
width : dialogWidth
});
}
}

function reInitializeGlobalVars() {
navigationIndex = 1;
peviousIndex = 0;
wasGoingNext = true;
firstSingleObs = null;
firstAllergen = null;
}

function autoClickFirstResultToShowItsDetails() {
if (jsonAfterParse.obs_singles.length
&& jsonAfterParse.obs_singles.length > 0) {
jq('#first_obs_single').trigger('click');
} else if ((!jsonAfterParse.obs_singles.length || jsonAfterParse.obs_singles.length === 0)
&& jsonAfterParse.patientAllergies.length
&& jsonAfterParse.patientAllergies.length > 0) {
jq('#first_alergen').trigger('click');
}
}

0 comments on commit f0454f5

Please sign in to comment.
You can’t perform that action at this time.