diff --git a/bahmnicore-api/pom.xml b/bahmnicore-api/pom.xml
index 59aa0893f5..7c466792d9 100644
--- a/bahmnicore-api/pom.xml
+++ b/bahmnicore-api/pom.xml
@@ -211,11 +211,6 @@
4.5.14
provided
-
- org.bahmni.module
- bahmni-events-api
- 1.0.0-SNAPSHOT
-
diff --git a/bahmnicore-api/src/main/java/org/bahmni/module/bahmnicore/config/AsyncConfig.java b/bahmnicore-api/src/main/java/org/bahmni/module/bahmnicore/config/AsyncConfig.java
deleted file mode 100644
index ad9c01010a..0000000000
--- a/bahmnicore-api/src/main/java/org/bahmni/module/bahmnicore/config/AsyncConfig.java
+++ /dev/null
@@ -1,19 +0,0 @@
-//package org.bahmni.module.bahmnicore.config;
-//
-//
-//import org.springframework.context.annotation.Bean;
-//import org.springframework.context.annotation.Configuration;
-//import org.springframework.scheduling.annotation.EnableAsync;
-//import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
-//
-//import java.util.concurrent.Executor;
-//@Configuration
-//@EnableAsync
-//public class AsyncConfig {
-//
-// @Bean(name = "bahmniCoreAsync")
-// public Executor threadPoolTaskExecutor() {
-// ThreadPoolTaskExecutor threadPoolTaskExecutor = new ThreadPoolTaskExecutor();
-// return threadPoolTaskExecutor;
-// }
-//}
\ No newline at end of file
diff --git a/bahmnicore-api/src/main/java/org/bahmni/module/bahmnicore/contract/SMS/SMSRequest.java b/bahmnicore-api/src/main/java/org/bahmni/module/bahmnicore/contract/SMS/SMSRequest.java
deleted file mode 100644
index 4a37ad4288..0000000000
--- a/bahmnicore-api/src/main/java/org/bahmni/module/bahmnicore/contract/SMS/SMSRequest.java
+++ /dev/null
@@ -1,26 +0,0 @@
-package org.bahmni.module.bahmnicore.contract.SMS;
-
-import org.codehaus.jackson.annotate.JsonProperty;
-
-public class SMSRequest {
- private String phoneNumber;
- private String message;
-
- @JsonProperty
- public String getPhoneNumber() {
- return phoneNumber;
- }
-
- public void setPhoneNumber(String phoneNumber) {
- this.phoneNumber = phoneNumber;
- }
-
- @JsonProperty
- public String getMessage() {
- return message;
- }
-
- public void setMessage(String message) {
- this.message = message;
- }
-}
\ No newline at end of file
diff --git a/bahmnicore-api/src/main/java/org/bahmni/module/bahmnicore/eventListener/SMSEventListenerBahmniCore.java b/bahmnicore-api/src/main/java/org/bahmni/module/bahmnicore/eventListener/SMSEventListenerBahmniCore.java
deleted file mode 100644
index 07c7542393..0000000000
--- a/bahmnicore-api/src/main/java/org/bahmni/module/bahmnicore/eventListener/SMSEventListenerBahmniCore.java
+++ /dev/null
@@ -1,50 +0,0 @@
-package org.bahmni.module.bahmnicore.eventListener;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.bahmni.module.events.api.model.BahmniEventType;
-import org.openmrs.Person;
-import org.openmrs.api.context.Context;
-import org.openmrs.api.context.UserContext;
-import org.openmrs.module.webservices.rest.SimpleObject;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.event.EventListener;
-import org.springframework.scheduling.annotation.Async;
-import org.springframework.stereotype.Component;
-import org.bahmni.module.events.api.model.Event;
-
-import java.util.Locale;
-
-@Component
-public class SMSEventListenerBahmniCore {
-
-
- private final Log log = LogFactory.getLog(this.getClass());
-
-
- @EventListener
- public void onApplicationEvent(Event event) {
- System.out.println("inside event listner bahmni core");
- if (event.eventType == BahmniEventType.BAHMNI_PATIENT_CREATED) {
- Boolean isregistrationSmsEnabled = Boolean.valueOf(Context.getAdministrationService().getGlobalProperty("sms.enableRegistrationSMSAlert"));
- if (isregistrationSmsEnabled) {
- System.out.println("hi");
- Object person = ((SimpleObject) event.payload).get("person");
-// String phoneNumber = person.get("phoneNumebr");
-// if (null == phoneNumber) {
-// log.info("Since no mobile number found for the patient. SMS not sent.");
-// return;
-// }
-// if (savePatientEvent.isRegistrationSmsEnabled()) {
-// UserContext userContext = savePatientEvent.getUserContext();
-// Context.openSession();
-// Context.setUserContext(userContext);
-
-// Location location = Context.getLocationService().getLocationByUuid(locationUuid);
-// String message = smsService.getRegistrationMessage(new Locale("en"), person, location);
-// smsService.sendSMS(phoneNumber, message);
-// }
- }
- }
- }
-}
diff --git a/bahmnicore-api/src/main/java/org/bahmni/module/bahmnicore/service/SMSService.java b/bahmnicore-api/src/main/java/org/bahmni/module/bahmnicore/service/SMSService.java
deleted file mode 100644
index 672d100b7f..0000000000
--- a/bahmnicore-api/src/main/java/org/bahmni/module/bahmnicore/service/SMSService.java
+++ /dev/null
@@ -1,12 +0,0 @@
-package org.bahmni.module.bahmnicore.service;
-
-import org.openmrs.Location;
-import org.openmrs.Patient;
-import java.util.Locale;
-
-public interface SMSService {
-
- String getRegistrationMessage(Locale locale, Patient patient, Location location);
-
- String sendSMS(String phoneNumber, String message);
-}
\ No newline at end of file
diff --git a/bahmnicore-api/src/main/java/org/bahmni/module/bahmnicore/service/impl/SMSServiceImpl.java b/bahmnicore-api/src/main/java/org/bahmni/module/bahmnicore/service/impl/SMSServiceImpl.java
deleted file mode 100644
index 5a80899c39..0000000000
--- a/bahmnicore-api/src/main/java/org/bahmni/module/bahmnicore/service/impl/SMSServiceImpl.java
+++ /dev/null
@@ -1,108 +0,0 @@
-package org.bahmni.module.bahmnicore.service.impl;
-
-import com.fasterxml.jackson.databind.ObjectMapper;
-import org.apache.commons.lang.StringUtils;
-import org.apache.http.HttpResponse;
-import org.apache.http.client.methods.HttpPost;
-import org.apache.http.entity.StringEntity;
-import org.apache.http.impl.client.CloseableHttpClient;
-import org.apache.http.impl.client.HttpClients;
-import org.apache.logging.log4j.LogManager;
-import org.apache.logging.log4j.Logger;
-import org.bahmni.module.bahmnicore.contract.SMS.SMSRequest;
-import org.bahmni.module.bahmnicore.properties.BahmniCoreProperties;
-import org.bahmni.module.bahmnicore.service.BahmniDrugOrderService;
-import org.bahmni.module.bahmnicore.service.SMSService;
-import org.openmrs.Location;
-import org.openmrs.Patient;
-import org.openmrs.api.context.Context;
-import org.springframework.stereotype.Service;
-
-import java.io.BufferedReader;
-import java.io.FileReader;
-import java.io.IOException;
-import java.util.regex.Matcher;
-import java.util.HashMap;
-import java.util.Locale;
-import java.util.Map;
-import java.util.regex.Pattern;
-
-@Service
-public class SMSServiceImpl implements SMSService {
- private static Logger logger = LogManager.getLogger(BahmniDrugOrderService.class);
- private final static String REGISTRATION_SMS_TEMPLATE = "sms.registrationSMSTemplate";
- private final static String SMS_URI = "sms.uri";
-
- @Override
- public String sendSMS(String phoneNumber, String message) {
- try {
- SMSRequest smsRequest = new SMSRequest();
- smsRequest.setPhoneNumber(phoneNumber);
- smsRequest.setMessage(message);
- ObjectMapper objMapper = new ObjectMapper();
- String jsonObject = objMapper.writeValueAsString(smsRequest);
- StringEntity params = new StringEntity(jsonObject);
-
-
- String smsUrl = StringUtils.isBlank(BahmniCoreProperties.getProperty("sms.uri")) ? SMS_URI : BahmniCoreProperties.getProperty("sms.uri");
- HttpPost request = new HttpPost(Context.getMessageSourceService().getMessage(smsUrl, null, new Locale("en")));
- request.addHeader("content-type", "application/json");
- String smsPropertiesPath = BahmniCoreProperties.getProperty("sms.token.path");
- BufferedReader bufferedReader;
- try (FileReader reader = new FileReader(smsPropertiesPath)) {
- bufferedReader = new BufferedReader(reader);
- request.addHeader("Authorization", "Bearer " + bufferedReader.readLine());
- } catch (IOException e) {
- throw new RuntimeException("Error loading SMS properties file.", e);
- }
- request.setEntity(params);
- CloseableHttpClient httpClient = HttpClients.createDefault();
- HttpResponse response = httpClient.execute(request);
- httpClient.close();
- return response.getStatusLine().getReasonPhrase();
- } catch (Exception e) {
- logger.error("Exception occured in sending sms ", e);
- throw new RuntimeException("Exception occured in sending sms ", e);
- }
- }
-
- @Override
- public String getRegistrationMessage(Locale locale, Patient patient, Location location) {
- String helpdeskNumber = Context.getAdministrationService().getGlobalPropertyObject("clinic.helpDeskNumber").getPropertyValue();
- String clinicTime = Context.getAdministrationService().getGlobalPropertyObject("clinic.clinicTimings").getPropertyValue();
-
- Map arguments = createArgumentsMap(location, patient, helpdeskNumber, clinicTime);
-
- return templateMessage(REGISTRATION_SMS_TEMPLATE, arguments);
- }
-
- private Map createArgumentsMap(Location location, Patient patient, String helpdeskNumber, String clinicTime) {
- Map arguments = new HashMap<>();
- arguments.put("location", location.getName());
- arguments.put("identifier", patient.getPatientIdentifier().getIdentifier());
- arguments.put("patientname", patient.getGivenName() + " " + patient.getFamilyName());
- arguments.put("gender", patient.getGender());
- arguments.put("age", patient.getAge().toString());
- arguments.put("helpdesknumber", helpdeskNumber);
- arguments.put("facilitytimings", clinicTime);
- return arguments;
- }
-
- public String templateMessage(String smsTemplate, Map arguments) {
- String template = Context.getAdministrationService().getGlobalProperty(smsTemplate);
- String formattedMessage = StringUtils.isBlank(template) ? Context.getMessageSourceService().getMessage(smsTemplate, null, new Locale("en")) : template;
-
- Pattern pattern = Pattern.compile("\\{([^}]*)\\}");
- Matcher matcher = pattern.matcher(formattedMessage);
- while (matcher.find()) {
- String placeholder = matcher.group(1);
- String modifiedPlaceholder = placeholder.toLowerCase().replaceAll("\\s", "");
- Object value = arguments.get(modifiedPlaceholder);
- placeholder = String.format("{%s}", placeholder);
- formattedMessage = formattedMessage.replace(placeholder, String.valueOf(value));
- }
-
- return formattedMessage.replace("\\n", System.lineSeparator());
- }
-
-}
\ No newline at end of file
diff --git a/bahmnicore-omod/pom.xml b/bahmnicore-omod/pom.xml
index fc77027cec..d987a02bc7 100644
--- a/bahmnicore-omod/pom.xml
+++ b/bahmnicore-omod/pom.xml
@@ -251,11 +251,6 @@
org.bahmni.module
bahmni-mapping
-
- org.bahmni.module
- bahmni-events-api
- 1.0.0-SNAPSHOT
-
org.openmrs.module
uiframework-api
diff --git a/bahmnicore-omod/src/main/java/org/bahmni/module/bahmnicore/web/v1_0/controller/TransmissionController.java b/bahmnicore-omod/src/main/java/org/bahmni/module/bahmnicore/web/v1_0/controller/TransmissionController.java
deleted file mode 100644
index b348113ebe..0000000000
--- a/bahmnicore-omod/src/main/java/org/bahmni/module/bahmnicore/web/v1_0/controller/TransmissionController.java
+++ /dev/null
@@ -1,61 +0,0 @@
-package org.bahmni.module.bahmnicore.web.v1_0.controller;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.http.HttpResponse;
-import org.apache.http.HttpResponseFactory;
-import org.apache.http.HttpStatus;
-import org.apache.http.HttpVersion;
-import org.apache.http.impl.DefaultHttpResponseFactory;
-import org.apache.http.message.BasicStatusLine;
-import org.bahmni.module.bahmnicore.web.v1_0.contract.BahmniMailContent;
-import org.bahmni.module.communication.api.CommunicationService;
-import org.bahmni.module.communication.model.MailContent;
-import org.bahmni.module.communication.model.Recipient;
-import org.openmrs.Patient;
-import org.openmrs.api.PatientService;
-import org.openmrs.api.context.Context;
-import org.openmrs.module.webservices.rest.web.RestConstants;
-import org.openmrs.module.webservices.rest.web.v1_0.controller.BaseRestController;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Controller;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.ResponseBody;
-import org.springframework.web.bind.annotation.PathVariable;
-
-@Controller
-@RequestMapping(value = "/rest/" + RestConstants.VERSION_1 + "/patient/{patientUuid}/send/")
-public class TransmissionController extends BaseRestController {
-
- private final Log log = LogFactory.getLog(this.getClass());
-
- @Autowired
- PatientService patientService;
-
- @PostMapping(value = "email")
- @ResponseBody
- public Object sendEmail(@RequestBody BahmniMailContent bahmniMailContent, @PathVariable("patientUuid") String patientUuid) {
- HttpResponseFactory factory = new DefaultHttpResponseFactory();
- HttpResponse response = null;
- if(Boolean.valueOf(Context.getAdministrationService().getGlobalProperty("bahmni.enableEmailPrescriptionOption"))) {
- try {
- Patient patient = patientService.getPatientByUuid(patientUuid);
- String recipientName = patient.getGivenName() + (patient.getMiddleName()!=null ? " " + patient.getMiddleName() : "") + (patient.getFamilyName()!=null ? " " + patient.getFamilyName() : "");
- String recipientEmail = patient.getAttribute("email").getValue();
- Recipient recipient = new Recipient(recipientName, recipientEmail);
- bahmniMailContent.setRecipient(recipient);
- Context.getService(CommunicationService.class).sendEmail(bahmniMailContent);
- response = factory.newHttpResponse(new BasicStatusLine(HttpVersion.HTTP_1_1, HttpStatus.SC_OK, "Mail sent successfully"), null);
- } catch (Exception exception) {
- log.error("Unable to send email", exception);
- response = factory.newHttpResponse(new BasicStatusLine(HttpVersion.HTTP_1_1, HttpStatus.SC_INTERNAL_SERVER_ERROR, "Unable to send email"), null);
- }
- } else {
- response = factory.newHttpResponse(new BasicStatusLine(HttpVersion.HTTP_1_1, HttpStatus.SC_METHOD_NOT_ALLOWED, "Sending email is not enabled"), null);
- }
- return response;
- }
-
-}
diff --git a/bahmnicore-omod/src/main/resources/config.xml b/bahmnicore-omod/src/main/resources/config.xml
index bebb6a6354..039bb26aea 100644
--- a/bahmnicore-omod/src/main/resources/config.xml
+++ b/bahmnicore-omod/src/main/resources/config.xml
@@ -33,7 +33,7 @@
org.openmrs.module.episodes
org.openmrs.module.auditlog
org.bahmni.module.bahmnicommons
- org.bahmni.module.communication
+
@@ -179,24 +179,6 @@
Boolean to enable sending email with prescription details
-
- sms.enableRegistrationSMSAlert
- false
- Boolean to enable sending sms when ptient registers
-
-
-
- clinic.clinicTimings
- Mon-Fri (09:00-22:00), Sat-Sun CLOSED
- Global property having timings of particular clinic
-
-
-
- sms.registrationSMSTemplate
- Thank you for registering at {location}. Please note your Patient Registration Details-{identifier}, name:{patientname}, {gender},Age- {age} years\nFor any queries call us on {helpdesknumber}. Clinic Timings: {facilitytimings}.
- Template of sms being sent when patient registers
-
-
bahmni.executeGroovyObsValueCalculator
true
diff --git a/bahmnicore-omod/src/main/resources/messages.properties b/bahmnicore-omod/src/main/resources/messages.properties
index ec9a5a3618..cd2616a57a 100644
--- a/bahmnicore-omod/src/main/resources/messages.properties
+++ b/bahmnicore-omod/src/main/resources/messages.properties
@@ -1,4 +1 @@
-@MODULE_ID@.title=Bahmni Core
-
-sms.registrationSMSTemplate=Thank you for registering at {location}. Please note your Patient Registration Details-{identifier}, name:{patientname}, {gender},Age- {age} years\nFor any queries call us on {helpdesknumber}. Clinic Timings: {facilitytimings}
-sms.uri=http://sms-service:8080/notification/sms
+@MODULE_ID@.title=Bahmni Core
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
index f4eddee89b..3cdbf81185 100644
--- a/pom.xml
+++ b/pom.xml
@@ -223,11 +223,6 @@
${hamcrestVersion}
test
-
- org.bahmni.module
- bahmni-events-api
- 1.0.0-SNAPSHOT
-
org.bahmni.module
bahmnicore-omod
@@ -284,11 +279,6 @@
${bahmniCommons.version}
provided
-
- org.bahmni.module
- bahmni-events-api
- 1.0.0-SNAPSHOT
-
org.openmrs.api
openmrs-api