Skip to content
Permalink
Browse files

Fixed some bug in ChartSearchNonFacetFiltering and adding appointment…

…s to display results
  • Loading branch information
k-joseph committed Jul 7, 2015
1 parent 0ec93e8 commit 4e6a69fd23c8c752c0f6b631df40f11864f29e07
@@ -31,9 +31,11 @@
* @param categoryName
* @return
*/
public boolean checkIfCategoriesContainNonFacetCategory(List<String> categories, String categoryName) {
private boolean checkIfCategoriesContainNonFacetCategory(List<String> categories, String categoryName) {
boolean contains = false;
if (categories != null && !categories.isEmpty() && categories.size() > 1 && StringUtils.isNotBlank(categoryName)) {
if (categories != null && !categories.isEmpty() && categories.size() > 1
&& !checkIfCategoriesContainBothAndOnlyAllergiesAndAppointments(categories)
&& StringUtils.isNotBlank(categoryName)) {
for (int i = 0; i < categories.size(); i++) {
if (categories.get(i).equals(categoryName)) {
contains = true;
@@ -44,7 +46,7 @@ public boolean checkIfCategoriesContainNonFacetCategory(List<String> categories,
return contains;
}

public boolean checkifCategoriesContainsOnlyOneNonFacetCategory(List<String> categories, String categoryName) {
private boolean checkifCategoriesContainsOnlyOneNonFacetCategory(List<String> categories, String categoryName) {
boolean contains = false;
if (categories != null && !categories.isEmpty() && StringUtils.isNotBlank(categoryName)) {
if (categories.size() == 1 && categories.get(0).equals(categoryName)) {
@@ -55,15 +57,31 @@ public boolean checkifCategoriesContainsOnlyOneNonFacetCategory(List<String> cat
return contains;
}

private boolean checkIfCategoriesContainBothAndOnlyAllergiesAndAppointments(List<String> categories) {
boolean contains = false;
if (categories != null && !categories.isEmpty()) {
if (categories.size() == 2
&& ((categories.get(0).equals("allergies") && categories.get(1).equals("appointments")) || (categories
.get(0).equals("appointments") && categories.get(1).equals("allergies")))) {
contains = true;
}
}

return contains;
}

public void applyNonFacetingLogicWhileSearching(Integer patientId, String searchText, List<String> selectedCategories,
SolrServer solrServer, SolrQuery query, List<ChartListItem> list)
SolrServer solrServer, SolrQuery query, List<ChartListItem> list)
throws SolrServerException {
ChartSearchSearcher searcher = new ChartSearchSearcher();

if (checkifCategoriesContainsOnlyOneNonFacetCategory(selectedCategories, "allergies")) {
searcher.searchAllergiesAndGenerateSolrDoc(patientId, searchText, solrServer, list);
} else if (checkifCategoriesContainsOnlyOneNonFacetCategory(selectedCategories, "appointments")) {
searcher.searchAppointmentsAndGenerateSolrDoc(patientId, searchText, solrServer, list);
} else if (checkIfCategoriesContainBothAndOnlyAllergiesAndAppointments(selectedCategories)) {
searcher.searchAllergiesAndGenerateSolrDoc(patientId, searchText, solrServer, list);
searcher.searchAppointmentsAndGenerateSolrDoc(patientId, searchText, solrServer, list);
} else if (checkIfCategoriesContainNonFacetCategory(selectedCategories, "allergies")
&& !checkIfCategoriesContainNonFacetCategory(selectedCategories, "appointments")) {
searcher.searchObservationsAndGenerateSolrDoc(solrServer, query, list);
@@ -228,7 +228,7 @@ function addAppointmentsToResults(app) {

if (jsonAfterParse.obs_singles.length === 0
&& jsonAfterParse.patientAllergies.length === 0
&& jsonAfterParse.patientAllergies[0].id === app.id) {
&& jsonAfterParse.patientAppointments[0].id === app.id) {
appointmentIdHtml = 'id="first_appointment"';
appId = "first_appointment";
} else {

0 comments on commit 4e6a69f

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