From 868e21c6a7f56c066f4fde8843e83ca360fbc2a2 Mon Sep 17 00:00:00 2001 From: k-joseph Date: Fri, 3 Jul 2015 13:55:53 +0300 Subject: [PATCH] Indexed patient's Appointments and returned them to the client side --- api/pom.xml | 35 +-- .../module/chartsearch/AppointmentItem.java | 106 +++++++++ .../module/chartsearch/GeneratingJson.java | 30 ++- .../apiIndexing/ChartSearchAPIIndexer.java | 218 ++++++++++++++++++ .../ChartSearchAllergiesIndexer.java | 136 ----------- .../chartsearch/solr/ChartSearchIndexer.java | 6 +- .../chartsearch/solr/ChartSearchSearcher.java | 30 +++ omod/pom.xml | 41 ++-- .../controller/ChartsearchPageController.java | 8 +- omod/src/main/resources/config.xml | 4 + pom.xml | 1 + .../resources/collection1/conf/schema.xml | 33 ++- 12 files changed, 474 insertions(+), 174 deletions(-) create mode 100644 api/src/main/java/org/openmrs/module/chartsearch/AppointmentItem.java create mode 100644 api/src/main/java/org/openmrs/module/chartsearch/apiIndexing/ChartSearchAPIIndexer.java delete mode 100644 api/src/main/java/org/openmrs/module/chartsearch/customindexing/ChartSearchAllergiesIndexer.java diff --git a/api/pom.xml b/api/pom.xml index 68102e1d..24050675 100644 --- a/api/pom.xml +++ b/api/pom.xml @@ -1,4 +1,5 @@ - + 4.0.0 @@ -14,25 +15,29 @@ - - + + ${project.parent.groupId} ${project.parent.artifactId}-server ${project.parent.version} - - - org.openmrs.module - allergyapi-api - ${allergyapiVersion} - jar - provided - + + + org.openmrs.module + allergyapi-api + ${allergyapiVersion} + jar + provided + + + + org.openmrs.module + appointmentscheduling-api + ${appointmentschedulingVersion} + provided + diff --git a/api/src/main/java/org/openmrs/module/chartsearch/AppointmentItem.java b/api/src/main/java/org/openmrs/module/chartsearch/AppointmentItem.java new file mode 100644 index 00000000..24b0afad --- /dev/null +++ b/api/src/main/java/org/openmrs/module/chartsearch/AppointmentItem.java @@ -0,0 +1,106 @@ +/** + * This Source Code Form is subject to the terms of the Mozilla Public License, + * v. 2.0. If a copy of the MPL was not distributed with this file, You can + * obtain one at http://mozilla.org/MPL/2.0/. OpenMRS is also distributed under + * the terms of the Healthcare Disclaimer located at http://openmrs.org/license. + * + * Copyright (C) OpenMRS Inc. OpenMRS is a registered trademark and the OpenMRS + * graphic logo is a trademark of OpenMRS Inc. + */ +package org.openmrs.module.chartsearch; + +import java.util.Date; + +public class AppointmentItem extends ChartListItem { + + private String reason; + + private Integer appointmentId; + + private String status; + + private Date start; + + private Date end; + + private String type; + + private String typeDesc; + + private String cancelReason; + + private String provider; + + public String getReason() { + return reason; + } + + public void setReason(String reason) { + this.reason = reason; + } + + public Integer getAppointmentId() { + return appointmentId; + } + + public void setAppointmentId(Integer appointmentId) { + this.appointmentId = appointmentId; + } + + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + + public Date getStart() { + return start; + } + + public void setStart(Date start) { + this.start = start; + } + + public Date getEnd() { + return end; + } + + public void setEnd(Date end) { + this.end = end; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public String getTypeDesc() { + return typeDesc; + } + + public void setTypeDesc(String typeDesc) { + this.typeDesc = typeDesc; + } + + public String getCancelReason() { + return cancelReason; + } + + public void setCancelReason(String cancelReason) { + this.cancelReason = cancelReason; + } + + public String getProvider() { + return provider; + } + + public void setProvider(String provider) { + this.provider = provider; + } + +} diff --git a/api/src/main/java/org/openmrs/module/chartsearch/GeneratingJson.java b/api/src/main/java/org/openmrs/module/chartsearch/GeneratingJson.java index 4511105e..d827e234 100644 --- a/api/src/main/java/org/openmrs/module/chartsearch/GeneratingJson.java +++ b/api/src/main/java/org/openmrs/module/chartsearch/GeneratingJson.java @@ -54,7 +54,6 @@ public static ChartSearchService getChartSearchService() { public static String generateJson(boolean wholePageIsToBeLoaded) { JSONObject jsonToReturn = new JSONObject(); - @SuppressWarnings("rawtypes") List returnedResults = SearchAPI.getInstance().getResults(); boolean foundNoResults = false; JSONObject noResults = new JSONObject(); @@ -92,6 +91,7 @@ public static String generateJson(boolean wholePageIsToBeLoaded) { List catNms = SearchAPI.getSelectedCategoryNames(); String[] appliedCats = new String[catNms.size()]; JSONArray allergies = generateAllergiesJSONFromResults(returnedResults); + JSONArray appointments = generateAppointmentsJSONFromResults(returnedResults); jsonToReturn.put("noResults", noResults); jsonToReturn.put("retrievalTime", SearchAPI.getInstance().getRetrievalTime()); @@ -100,6 +100,7 @@ public static String generateJson(boolean wholePageIsToBeLoaded) { jsonToReturn.put("searchBookmarks", bookmarks); jsonToReturn.put("appliedFacets", (String[]) catNms.toArray(appliedCats)); jsonToReturn.put("patientAllergies", allergies); + jsonToReturn.put("patientAppointments", appointments); addBothPersonalAndGlobalNotesToJSON(searchPhrase, patientId, jsonToReturn, wholePageIsToBeLoaded); @@ -552,6 +553,33 @@ public static JSONArray generateAllergiesJSONFromResults(List ret return allergies; } + private static JSONArray generateAppointmentsJSONFromResults(List returnedResults) { + JSONArray appointments = new JSONArray(); + + for (ChartListItem item : returnedResults) { + if (item != null && item instanceof AppointmentItem) { + AppointmentItem appointment = (AppointmentItem) item; + JSONObject json = new JSONObject(); + if (appointment.getAppointmentId() != null) { + json.put("id", appointment.getAppointmentId()); + json.put("uuid", appointment.getUuid()); + json.put("status", appointment.getStatus()); + json.put("reason", appointment.getReason()); + json.put("type", appointment.getType()); + json.put("start", appointment.getStart().getTime()); + json.put("end", appointment.getEnd().getTime()); + json.put("typeDesc", appointment.getTypeDesc()); + json.put("cancelReason", appointment.getCancelReason()); + json.put("provider", appointment.getProvider()); + + appointments.add(json); + } + } + } + + return appointments; + } + public static JSONObject generateLocationJson(String location) { JSONObject jsonLocation = new JSONObject(); jsonLocation.put("location", location); diff --git a/api/src/main/java/org/openmrs/module/chartsearch/apiIndexing/ChartSearchAPIIndexer.java b/api/src/main/java/org/openmrs/module/chartsearch/apiIndexing/ChartSearchAPIIndexer.java new file mode 100644 index 00000000..e5d70f7b --- /dev/null +++ b/api/src/main/java/org/openmrs/module/chartsearch/apiIndexing/ChartSearchAPIIndexer.java @@ -0,0 +1,218 @@ +/** + * This Source Code Form is subject to the terms of the Mozilla Public License, + * v. 2.0. If a copy of the MPL was not distributed with this file, You can + * obtain one at http://mozilla.org/MPL/2.0/. OpenMRS is also distributed under + * the terms of the Healthcare Disclaimer located at http://openmrs.org/license. + * + * Copyright (C) OpenMRS Inc. OpenMRS is a registered trademark and the OpenMRS + * graphic logo is a trademark of OpenMRS Inc. + */ +package org.openmrs.module.chartsearch.apiIndexing; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Date; +import java.util.List; + +import org.apache.commons.lang3.StringUtils; +import org.apache.solr.client.solrj.SolrServer; +import org.apache.solr.client.solrj.SolrServerException; +import org.apache.solr.client.solrj.response.UpdateResponse; +import org.apache.solr.common.SolrInputDocument; +import org.openmrs.ConceptName; +import org.openmrs.Patient; +import org.openmrs.api.context.Context; +import org.openmrs.module.allergyapi.Allergies; +import org.openmrs.module.allergyapi.Allergy; +import org.openmrs.module.allergyapi.AllergyReaction; +import org.openmrs.module.allergyapi.api.PatientService; +import org.openmrs.module.appointmentscheduling.Appointment; +import org.openmrs.module.appointmentscheduling.api.AppointmentService; + +/** + * Handles all Indexing that is done onto documents whose data is obtained from the Database using + * various respective APIs + */ +public class ChartSearchAPIIndexer { + + /** + * Solr Indexing process of patient's allergies + * + * @param patientId + * @param solrServer + */ + @SuppressWarnings({ "rawtypes", "unchecked" }) + public void indexPatientAllergies(Integer patientId, SolrServer solrServer) { + Collection docs = new ArrayList(); + PatientService patientService = Context.getService(PatientService.class); + + if (patientId != null) { + Patient patient = Context.getPatientService().getPatient(patientId); + if (patient != null) { + Allergies allergies = patientService.getAllergies(patient); + + for (Allergy allergy : allergies) { + SolrInputDocument doc = addAllergiesPropertiesToSolrDoc(allergy); + + docs.add(doc); + } + indexDocumentsUsingSolr(solrServer, docs); + } + } + } + + private void indexDocumentsUsingSolr(SolrServer solrServer, Collection docs) { + if (!docs.isEmpty()) { + try { + if (docs.size() > 1000) {// Commit within 5 minutes. + UpdateResponse resp = solrServer.add(docs, 300000); + printFailureIfNoResponseIsreturned(resp); + } else { + UpdateResponse resp = solrServer.add(docs); + printFailureIfNoResponseIsreturned(resp); + } + solrServer.commit(); + } + catch (SolrServerException e) { + System.out.println("Error generated" + e); + } + catch (IOException e) { + System.out.println("Error generated" + e); + } + } + } + + private SolrInputDocument addAllergiesPropertiesToSolrDoc(Allergy allergy) { + SolrInputDocument doc = new SolrInputDocument(); + + if (allergy != null && allergy.getAllergyId() != null) { + Integer patientId = allergy.getPatient().getPatientId(); + String nonCodedAllergen = allergy.getAllergen().getNonCodedAllergen(); + List reactions = allergy.getReactions(); + String codedAllegen = null; + String severity = null; + String codedReaction = ""; + String nonCodedReactions = null; + + if (allergy.getAllergen().getCodedAllergen() != null) { + ConceptName codedCName = allergy.getAllergen().getCodedAllergen().getName(); + codedAllegen = codedCName.getName(); + } + if (allergy.getSeverity() != null) { + ConceptName severityCName = allergy.getSeverity().getName(); + severity = severityCName.getName(); + } + for (int i = 0; i < reactions.size(); i++) { + AllergyReaction reaction = reactions.get(i); + + if (StringUtils.isNotBlank(reaction.getReactionNonCoded())) { + nonCodedReactions = reaction.getReactionNonCoded(); + break; + } else { + if (reaction.getReaction() != null) { + String codedReactioncName = reaction.getReaction().getName().getName(); + if (StringUtils.isNotBlank(codedReactioncName)) { + if (i == reactions.size() - 1) { + codedReaction += codedReactioncName; + } else { + codedReaction += codedReactioncName + ", "; + } + } + } + } + + } + + doc.addField("id", allergy.getUuid()); + doc.addField("allergy_id", allergy.getAllergyId()); + doc.addField("allergy_coded_name", codedAllegen); + doc.addField("patient_id", patientId); + doc.addField("allergy_non_coded_name", nonCodedAllergen); + doc.addField("allergy_severity", severity); + doc.addField("allergy_type", allergy.getAllergen().getAllergenType()); + doc.addField("allergy_coded_reaction", codedReaction); + doc.addField("allergy_non_coded_reaction", nonCodedReactions); + doc.addField("allergy_comment", allergy.getComment()); + doc.addField("allergy_date", + allergy.getDateChanged() != null ? allergy.getDateChanged() : allergy.getDateCreated()); + } + return doc; + } + + private void printFailureIfNoResponseIsreturned(UpdateResponse resp) { + if (resp.getStatus() != 0) { + System.out.println("Some error has occurred, status is: " + resp.getStatus()); + } + } + + /** + * Solr Indexing process for patient's appointments + * + * @param patientId + * @param solrServer + */ + @SuppressWarnings({ "rawtypes", "unchecked" }) + public void indexPatientAppoinments(Integer patientId, SolrServer solrServer) { + AppointmentService appointmentService = Context.getService(AppointmentService.class); + Collection docs = new ArrayList(); + + if (patientId != null) { + Patient patient = Context.getPatientService().getPatient(patientId); + if (patient != null) { + List appointments = appointmentService.getAppointmentsOfPatient(patient); + + for (Appointment appointment : appointments) { + SolrInputDocument doc = addAppointmentPropertiesToSolrDoc(appointment); + + docs.add(doc); + } + indexDocumentsUsingSolr(solrServer, docs); + } + } + } + + private SolrInputDocument addAppointmentPropertiesToSolrDoc(Appointment appointment) { + SolrInputDocument doc = new SolrInputDocument(); + + if (appointment != null && appointment.getAppointmentId() != null) { + Integer patientId = appointment.getPatient().getPatientId(); + String reason = appointment.getReason(); + String uuid = appointment.getUuid(); + Integer id = appointment.getId(); + String status = appointment.getStatus() != null ? appointment.getStatus().getName() : ""; + Date start = appointment.getTimeSlot() != null ? appointment.getTimeSlot().getStartDate() : null; + Date end = appointment.getTimeSlot() != null ? appointment.getTimeSlot().getEndDate() : null; + String type = appointment.getAppointmentType() != null ? appointment.getAppointmentType().getDisplayString() + : ""; + String typeDesc = appointment.getAppointmentType() != null ? appointment.getAppointmentType().getDescription() + : ""; + String cancelReason = appointment.getCancelReason() != null ? appointment.getCancelReason() : ""; + String provider = null; + + if (appointment.getTimeSlot() != null && appointment.getTimeSlot().getAppointmentBlock() != null + && appointment.getTimeSlot().getAppointmentBlock().getProvider() != null) { + provider = appointment.getTimeSlot().getAppointmentBlock().getProvider().getName(); + } + + doc.addField("id", uuid); + doc.addField("patient_id", patientId); + doc.addField("appointment_reason", reason); + doc.addField("appointment_provider", provider); + doc.addField("appointment_id", id); + doc.addField("appointment_status", status); + doc.addField("appointment_start", start); + doc.addField("appointment_end", end); + doc.addField("appointment_type", type); + doc.addField("appointment_typeDesc", typeDesc); + doc.addField("appointment_cancelReason", cancelReason); + } + + return doc; + } + + public void indexBothPatientAllergiesAndAppointments(Integer patientId, SolrServer solrServer) { + indexPatientAllergies(patientId, solrServer); + indexPatientAppoinments(patientId, solrServer); + } +} diff --git a/api/src/main/java/org/openmrs/module/chartsearch/customindexing/ChartSearchAllergiesIndexer.java b/api/src/main/java/org/openmrs/module/chartsearch/customindexing/ChartSearchAllergiesIndexer.java deleted file mode 100644 index 4412c8bb..00000000 --- a/api/src/main/java/org/openmrs/module/chartsearch/customindexing/ChartSearchAllergiesIndexer.java +++ /dev/null @@ -1,136 +0,0 @@ -/** - * This Source Code Form is subject to the terms of the Mozilla Public License, - * v. 2.0. If a copy of the MPL was not distributed with this file, You can - * obtain one at http://mozilla.org/MPL/2.0/. OpenMRS is also distributed under - * the terms of the Healthcare Disclaimer located at http://openmrs.org/license. - * - * Copyright (C) OpenMRS Inc. OpenMRS is a registered trademark and the OpenMRS - * graphic logo is a trademark of OpenMRS Inc. - */ -package org.openmrs.module.chartsearch.customindexing; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; - -import org.apache.commons.lang3.StringUtils; -import org.apache.solr.client.solrj.SolrServer; -import org.apache.solr.client.solrj.SolrServerException; -import org.apache.solr.client.solrj.response.UpdateResponse; -import org.apache.solr.common.SolrInputDocument; -import org.openmrs.ConceptName; -import org.openmrs.Patient; -import org.openmrs.api.context.Context; -import org.openmrs.module.allergyapi.Allergies; -import org.openmrs.module.allergyapi.Allergy; -import org.openmrs.module.allergyapi.AllergyReaction; -import org.openmrs.module.allergyapi.api.PatientService; - -public class ChartSearchAllergiesIndexer { - - @SuppressWarnings({ "rawtypes", "unchecked" }) - public void indexPatientAllergies(Integer patientId, SolrServer solrServer) { - Collection docs = new ArrayList(); - PatientService patientService = Context.getService(PatientService.class); - - if (patientId != null) { - Patient patient = Context.getPatientService().getPatient(patientId); - if (patient != null) { - Allergies allAllergies = patientService.getAllergies(patient); - Allergies allergies = new Allergies();//current patient's allergies - - for (Allergy allergy : allAllergies) { - if (allergy.getPatient().getPatientId().equals(patientId)) { - allergies.add(allergy); - } - } - for (Allergy allergy : allergies) { - SolrInputDocument doc = addAllergiesPropertiesToSolrDoc(allergy, patientId); - - docs.add(doc); - } - if (!docs.isEmpty()) { - try { - if (docs.size() > 1000) {// Commit within 5 minutes. - UpdateResponse resp = solrServer.add(docs, 300000); - printFailureIfNoResponseIsreturned(resp); - } else { - UpdateResponse resp = solrServer.add(docs); - printFailureIfNoResponseIsreturned(resp); - } - solrServer.commit(); - } - catch (SolrServerException e) { - System.out.println("Error generated" + e); - } - catch (IOException e) { - System.out.println("Error generated" + e); - } - } - } - } - } - - private SolrInputDocument addAllergiesPropertiesToSolrDoc(Allergy allergy, Integer patientId) { - SolrInputDocument doc = new SolrInputDocument(); - - if (allergy != null && allergy.getAllergyId() != null) { - String nonCodedAllergen = allergy.getAllergen().getNonCodedAllergen(); - List reactions = allergy.getReactions(); - String codedAllegen = null; - String severity = null; - String codedReaction = ""; - String nonCodedReactions = null; - - if (allergy.getAllergen().getCodedAllergen() != null) { - ConceptName codedCName = allergy.getAllergen().getCodedAllergen().getName(); - codedAllegen = codedCName.getName(); - } - if (allergy.getSeverity() != null) { - ConceptName severityCName = allergy.getSeverity().getName(); - severity = severityCName.getName(); - } - for (int i = 0; i < reactions.size(); i++) { - AllergyReaction reaction = reactions.get(i); - - if (StringUtils.isNotBlank(reaction.getReactionNonCoded())) { - nonCodedReactions = reaction.getReactionNonCoded(); - break; - } else { - if (reaction.getReaction() != null) { - String codedReactioncName = reaction.getReaction().getName().getName(); - if (StringUtils.isNotBlank(codedReactioncName)) { - if (i == reactions.size() - 1) { - codedReaction += codedReactioncName; - } else { - codedReaction += codedReactioncName + ", "; - } - } - } - } - - } - - doc.addField("id", allergy.getUuid()); - doc.addField("allergy_id", allergy.getAllergyId()); - doc.addField("allergy_coded_name", codedAllegen); - doc.addField("patient_id", patientId); - doc.addField("allergy_non_coded_name", nonCodedAllergen); - doc.addField("allergy_severity", severity); - doc.addField("allergy_type", allergy.getAllergen().getAllergenType()); - doc.addField("allergy_coded_reaction", codedReaction); - doc.addField("allergy_non_coded_reaction", nonCodedReactions); - doc.addField("allergy_comment", allergy.getComment()); - doc.addField("allergy_date", - allergy.getDateChanged() != null ? allergy.getDateChanged() : allergy.getDateCreated()); - } - return doc; - } - - private void printFailureIfNoResponseIsreturned(UpdateResponse resp) { - if (resp.getStatus() != 0) { - System.out.println("Some error has occurred, status is: " + resp.getStatus()); - } - } -} diff --git a/api/src/main/java/org/openmrs/module/chartsearch/solr/ChartSearchIndexer.java b/api/src/main/java/org/openmrs/module/chartsearch/solr/ChartSearchIndexer.java index b1a7602d..45d79f8f 100644 --- a/api/src/main/java/org/openmrs/module/chartsearch/solr/ChartSearchIndexer.java +++ b/api/src/main/java/org/openmrs/module/chartsearch/solr/ChartSearchIndexer.java @@ -24,7 +24,7 @@ import org.apache.solr.client.solrj.response.QueryResponse; import org.apache.solr.common.params.ModifiableSolrParams; import org.apache.solr.common.util.NamedList; -import org.openmrs.module.chartsearch.customindexing.ChartSearchAllergiesIndexer; +import org.openmrs.module.chartsearch.apiIndexing.ChartSearchAPIIndexer; import org.openmrs.module.chartsearch.server.ConfigCommands; import org.openmrs.module.chartsearch.server.PatientInfo; import org.openmrs.module.chartsearch.server.StatisticsInfo; @@ -48,10 +48,10 @@ public void indexPatientData(Integer personId) { params.set("personId", personId); try { if (solrServer != null) { - ChartSearchAllergiesIndexer allergiesIndexer = new ChartSearchAllergiesIndexer(); + ChartSearchAPIIndexer apiIndexer = new ChartSearchAPIIndexer(); solrServer.query(params); - allergiesIndexer.indexPatientAllergies(personId, solrServer); + apiIndexer.indexBothPatientAllergiesAndAppointments(personId, solrServer); } } catch (SolrServerException ex) { diff --git a/api/src/main/java/org/openmrs/module/chartsearch/solr/ChartSearchSearcher.java b/api/src/main/java/org/openmrs/module/chartsearch/solr/ChartSearchSearcher.java index d060fecf..ac2341ff 100644 --- a/api/src/main/java/org/openmrs/module/chartsearch/solr/ChartSearchSearcher.java +++ b/api/src/main/java/org/openmrs/module/chartsearch/solr/ChartSearchSearcher.java @@ -32,6 +32,7 @@ import org.apache.solr.common.params.FacetParams; import org.openmrs.api.context.Context; import org.openmrs.module.chartsearch.AllergyItem; +import org.openmrs.module.chartsearch.AppointmentItem; import org.openmrs.module.chartsearch.ChartListItem; import org.openmrs.module.chartsearch.EncounterItem; import org.openmrs.module.chartsearch.FormItem; @@ -127,12 +128,41 @@ public List getDocumentList(Integer patientId, String searchText, List list = searchObservationsAndGenerateSolrDoc(solrServer, query); searchAllergiesAndGenerateSolrDoc(patientId, searchText, solrServer, list); + searchAppointmentsAndGenerateSolrDoc(patientId, searchText, solrServer, list); searchEncounterTypesAndGenerateSolrDoc(patientId, searchText, solrServer, list); searchEFormsAndGenerateSolrDoc(searchText, solrServer, list); return list; } + private void searchAppointmentsAndGenerateSolrDoc(Integer patientId, String searchText, SolrServer solrServer, + List list) throws SolrServerException { + SolrQuery query5 = new SolrQuery(String.format("appointment_text:(%s)", searchText)); + + query5.addFilterQuery(String.format("patient_id:%d", patientId)); + QueryResponse response5 = solrServer.query(query5); + Iterator iter5 = response5.getResults().iterator(); + + while (iter5.hasNext()) { + SolrDocument doc = iter5.next(); + AppointmentItem item = new AppointmentItem(); + item.setUuid((String) doc.get("id")); + item.setAppointmentId((Integer) doc.get("appointment_id")); + item.setProvider((String) doc.get("appointment_provider")); + item.setStatus((String) doc.get("appointment_status")); + item.setReason((String) doc.get("appointment_reason")); + item.setType((String) doc.get("appointment_type")); + item.setStart((Date) doc.get("appointment_start")); + item.setEnd((Date) doc.get("appointment_end")); + item.setTypeDesc((String) doc.get("appointment_typeDesc")); + item.setCancelReason((String) doc.get("appointment_cancelReason")); + + list.add(item); + + System.out.println("FOUND APPOINTMENT: " + doc.toString()); + } + } + private void searchEFormsAndGenerateSolrDoc(String searchText, SolrServer solrServer, List list) throws SolrServerException { // forms diff --git a/omod/pom.xml b/omod/pom.xml index 2102ce40..b0e0cbb1 100644 --- a/omod/pom.xml +++ b/omod/pom.xml @@ -1,4 +1,5 @@ - + 4.0.0 @@ -22,7 +23,7 @@ ${project.parent.artifactId}-api ${project.parent.version} - + org.openmrs.web openmrs-web @@ -34,26 +35,36 @@ tests test - + + + org.openmrs.module + uiframework-api + + - org.openmrs.module - uiframework-api + org.openmrs.module + emrapi-api + - org.openmrs.module - emrapi-api - - org.openmrs.module appui-omod + - org.openmrs.module - allergyapi-api - ${allergyapiVersion} - jar - provided - + org.openmrs.module + allergyapi-api + ${allergyapiVersion} + jar + provided + + + + org.openmrs.module + appointmentscheduling-api + ${appointmentschedulingVersion} + provided + diff --git a/omod/src/main/java/org/openmrs/module/chartsearch/page/controller/ChartsearchPageController.java b/omod/src/main/java/org/openmrs/module/chartsearch/page/controller/ChartsearchPageController.java index 331cd745..9b4bf5f1 100644 --- a/omod/src/main/java/org/openmrs/module/chartsearch/page/controller/ChartsearchPageController.java +++ b/omod/src/main/java/org/openmrs/module/chartsearch/page/controller/ChartsearchPageController.java @@ -21,6 +21,7 @@ import org.openmrs.api.context.Context; import org.openmrs.module.appui.UiSessionContext; import org.openmrs.module.chartsearch.AllergyItem; +import org.openmrs.module.chartsearch.AppointmentItem; import org.openmrs.module.chartsearch.ChartListItem; import org.openmrs.module.chartsearch.EncounterItem; import org.openmrs.module.chartsearch.FormItem; @@ -77,7 +78,6 @@ public static void searchAndReturnResults(SearchPhrase search_phrase, Patient pa List items = searchAPIInstance.search(patient.getPatientId(), search_phrase, selectedCategories, reloadWholePage); List updatedItems = new ArrayList(); - //loop to get full details about observations. for (ChartListItem chartListItem : items) { if (chartListItem instanceof ObsItem) { int itemObsId = ((ObsItem) chartListItem).getObsId(); @@ -92,7 +92,11 @@ public static void searchAndReturnResults(SearchPhrase search_phrase, Patient pa updatedItems.add(chartListItem); } - if(chartListItem instanceof AllergyItem) { + if (chartListItem instanceof AllergyItem) { + updatedItems.add(chartListItem); + } + + if (chartListItem instanceof AppointmentItem) { updatedItems.add(chartListItem); } } diff --git a/omod/src/main/resources/config.xml b/omod/src/main/resources/config.xml index ca6acf16..59bf30af 100644 --- a/omod/src/main/resources/config.xml +++ b/omod/src/main/resources/config.xml @@ -41,6 +41,10 @@ org.openmrs.module.allergyapi + + + org.openmrs.module.appointmentscheduling + diff --git a/pom.xml b/pom.xml index 64db6e16..dd953d06 100644 --- a/pom.xml +++ b/pom.xml @@ -56,6 +56,7 @@ 1.0 1.0 1.3 + 1.3 UTF-8 diff --git a/server/src/main/resources/collection1/conf/schema.xml b/server/src/main/resources/collection1/conf/schema.xml index bed16a7c..8e42fb45 100644 --- a/server/src/main/resources/collection1/conf/schema.xml +++ b/server/src/main/resources/collection1/conf/schema.xml @@ -957,12 +957,35 @@ stored="true" required="false" /> - + + + + + + + + + + + + + + @@ -1022,6 +1045,12 @@ + + + + + +