diff --git a/api/pom.xml b/api/pom.xml
index cc20907..ecc0868 100644
--- a/api/pom.xml
+++ b/api/pom.xml
@@ -163,7 +163,6 @@
provided
-
org.openmrs.module
webservices.rest-omod-common
diff --git a/api/src/main/java/org/openmrs/module/ipd/api/dao/impl/HibernateWardDAO.java b/api/src/main/java/org/openmrs/module/ipd/api/dao/impl/HibernateWardDAO.java
index ffecf28..f161726 100644
--- a/api/src/main/java/org/openmrs/module/ipd/api/dao/impl/HibernateWardDAO.java
+++ b/api/src/main/java/org/openmrs/module/ipd/api/dao/impl/HibernateWardDAO.java
@@ -61,8 +61,12 @@ public List getAdmittedPatients(Location location, Provider pro
"LEFT JOIN careTeam.participants ctp ON ctp.voided = 0 " +
"LEFT JOIN org.openmrs.Order o on o.encounter = e " +
"LEFT JOIN Slot s on s.order = o " +
- "where assignment.endDatetime is null and v.stopDatetime is null and l.parentLocation = :location ";
-
+ "where assignment.endDatetime is null and v.stopDatetime is null ";
+
+ if(location != null){
+ queryString += "and l.parentLocation = :location ";
+ }
+
if (provider != null) {
queryString += "and ctp.provider = :provider ";
}
@@ -79,7 +83,9 @@ public List getAdmittedPatients(Location location, Provider pro
Query query = session.createQuery(finalQuery);
- query.setParameter("location", location);
+ if(location != null) {
+ query.setParameter("location", location);
+ }
if (provider != null) {
query.setParameter("provider", provider);
diff --git a/omod/src/main/java/org/openmrs/module/ipd/events/ConfigLoader.java b/api/src/main/java/org/openmrs/module/ipd/api/events/ConfigLoader.java
similarity index 92%
rename from omod/src/main/java/org/openmrs/module/ipd/events/ConfigLoader.java
rename to api/src/main/java/org/openmrs/module/ipd/api/events/ConfigLoader.java
index 3b390fa..fc58629 100644
--- a/omod/src/main/java/org/openmrs/module/ipd/events/ConfigLoader.java
+++ b/api/src/main/java/org/openmrs/module/ipd/api/events/ConfigLoader.java
@@ -1,9 +1,9 @@
-package org.openmrs.module.ipd.events;
+package org.openmrs.module.ipd.api.events;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.extern.slf4j.Slf4j;
-import org.openmrs.module.ipd.events.model.ConfigDetail;
+import org.openmrs.module.ipd.api.events.model.ConfigDetail;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.io.FileSystemResource;
import org.springframework.stereotype.Component;
diff --git a/omod/src/main/java/org/openmrs/module/ipd/events/IPDEventManager.java b/api/src/main/java/org/openmrs/module/ipd/api/events/IPDEventManager.java
similarity index 74%
rename from omod/src/main/java/org/openmrs/module/ipd/events/IPDEventManager.java
rename to api/src/main/java/org/openmrs/module/ipd/api/events/IPDEventManager.java
index 7614774..d98f77e 100644
--- a/omod/src/main/java/org/openmrs/module/ipd/events/IPDEventManager.java
+++ b/api/src/main/java/org/openmrs/module/ipd/api/events/IPDEventManager.java
@@ -1,9 +1,9 @@
-package org.openmrs.module.ipd.events;
+package org.openmrs.module.ipd.api.events;
-import org.openmrs.module.ipd.events.factory.IPDEventFactory;
-import org.openmrs.module.ipd.events.handler.IPDEventHandler;
-import org.openmrs.module.ipd.events.model.IPDEvent;
-import org.openmrs.module.ipd.events.model.IPDEventType;
+import org.openmrs.module.ipd.api.events.model.IPDEvent;
+import org.openmrs.module.ipd.api.events.factory.IPDEventFactory;
+import org.openmrs.module.ipd.api.events.handler.IPDEventHandler;
+import org.openmrs.module.ipd.api.events.model.IPDEventType;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
diff --git a/omod/src/main/java/org/openmrs/module/ipd/events/IPDEventUtils.java b/api/src/main/java/org/openmrs/module/ipd/api/events/IPDEventUtils.java
similarity index 88%
rename from omod/src/main/java/org/openmrs/module/ipd/events/IPDEventUtils.java
rename to api/src/main/java/org/openmrs/module/ipd/api/events/IPDEventUtils.java
index 42abc30..b9da7ab 100644
--- a/omod/src/main/java/org/openmrs/module/ipd/events/IPDEventUtils.java
+++ b/api/src/main/java/org/openmrs/module/ipd/api/events/IPDEventUtils.java
@@ -1,8 +1,8 @@
-package org.openmrs.module.ipd.events;
+package org.openmrs.module.ipd.api.events;
import org.openmrs.module.fhir2.model.FhirTask;
import org.openmrs.module.fhirExtension.web.contract.TaskRequest;
-import org.openmrs.module.ipd.events.model.IPDEvent;
+import org.openmrs.module.ipd.api.events.model.IPDEvent;
import java.util.Date;
diff --git a/api/src/main/java/org/openmrs/module/ipd/api/events/factory/IPDEventFactory.java b/api/src/main/java/org/openmrs/module/ipd/api/events/factory/IPDEventFactory.java
new file mode 100644
index 0000000..125fe81
--- /dev/null
+++ b/api/src/main/java/org/openmrs/module/ipd/api/events/factory/IPDEventFactory.java
@@ -0,0 +1,8 @@
+package org.openmrs.module.ipd.api.events.factory;
+
+import org.openmrs.module.ipd.api.events.model.IPDEventType;
+import org.openmrs.module.ipd.api.events.handler.IPDEventHandler;
+
+public interface IPDEventFactory {
+ IPDEventHandler createEventHandler(IPDEventType eventType);
+}
\ No newline at end of file
diff --git a/omod/src/main/java/org/openmrs/module/ipd/events/factory/impl/IPDEventFactoryImpl.java b/api/src/main/java/org/openmrs/module/ipd/api/events/factory/impl/IPDEventFactoryImpl.java
similarity index 64%
rename from omod/src/main/java/org/openmrs/module/ipd/events/factory/impl/IPDEventFactoryImpl.java
rename to api/src/main/java/org/openmrs/module/ipd/api/events/factory/impl/IPDEventFactoryImpl.java
index faf7ddb..cb13de8 100644
--- a/omod/src/main/java/org/openmrs/module/ipd/events/factory/impl/IPDEventFactoryImpl.java
+++ b/api/src/main/java/org/openmrs/module/ipd/api/events/factory/impl/IPDEventFactoryImpl.java
@@ -1,11 +1,11 @@
-package org.openmrs.module.ipd.events.factory.impl;
+package org.openmrs.module.ipd.api.events.factory.impl;
-import org.openmrs.module.ipd.events.model.IPDEventType;
-import org.openmrs.module.ipd.events.factory.IPDEventFactory;
-import org.openmrs.module.ipd.events.handler.IPDEventHandler;
-import org.openmrs.module.ipd.events.handler.impl.PatientAdmitEventHandler;
-import org.openmrs.module.ipd.events.handler.impl.RolloverTaskEventHandler;
-import org.openmrs.module.ipd.events.handler.impl.ShiftStartTaskEventHandler;
+import org.openmrs.module.ipd.api.events.handler.impl.ShiftStartTaskEventHandler;
+import org.openmrs.module.ipd.api.events.model.IPDEventType;
+import org.openmrs.module.ipd.api.events.factory.IPDEventFactory;
+import org.openmrs.module.ipd.api.events.handler.IPDEventHandler;
+import org.openmrs.module.ipd.api.events.handler.impl.PatientAdmitEventHandler;
+import org.openmrs.module.ipd.api.events.handler.impl.RolloverTaskEventHandler;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
diff --git a/api/src/main/java/org/openmrs/module/ipd/api/events/handler/IPDEventHandler.java b/api/src/main/java/org/openmrs/module/ipd/api/events/handler/IPDEventHandler.java
new file mode 100644
index 0000000..4c75fdf
--- /dev/null
+++ b/api/src/main/java/org/openmrs/module/ipd/api/events/handler/IPDEventHandler.java
@@ -0,0 +1,7 @@
+package org.openmrs.module.ipd.api.events.handler;
+
+import org.openmrs.module.ipd.api.events.model.IPDEvent;
+
+public interface IPDEventHandler {
+ void handleEvent(IPDEvent event);
+}
\ No newline at end of file
diff --git a/omod/src/main/java/org/openmrs/module/ipd/events/handler/impl/PatientAdmitEventHandler.java b/api/src/main/java/org/openmrs/module/ipd/api/events/handler/impl/PatientAdmitEventHandler.java
similarity index 79%
rename from omod/src/main/java/org/openmrs/module/ipd/events/handler/impl/PatientAdmitEventHandler.java
rename to api/src/main/java/org/openmrs/module/ipd/api/events/handler/impl/PatientAdmitEventHandler.java
index e9717da..9828da5 100644
--- a/omod/src/main/java/org/openmrs/module/ipd/events/handler/impl/PatientAdmitEventHandler.java
+++ b/api/src/main/java/org/openmrs/module/ipd/api/events/handler/impl/PatientAdmitEventHandler.java
@@ -1,4 +1,4 @@
-package org.openmrs.module.ipd.events.handler.impl;
+package org.openmrs.module.ipd.api.events.handler.impl;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -6,12 +6,12 @@
import org.openmrs.module.fhirExtension.service.TaskService;
import org.openmrs.module.fhirExtension.web.contract.TaskRequest;
import org.openmrs.module.fhirExtension.web.mapper.TaskMapper;
-import org.openmrs.module.ipd.events.ConfigLoader;
-import org.openmrs.module.ipd.events.IPDEventUtils;
-import org.openmrs.module.ipd.events.handler.IPDEventHandler;
-import org.openmrs.module.ipd.events.model.ConfigDetail;
-import org.openmrs.module.ipd.events.model.IPDEvent;
-import org.openmrs.module.ipd.events.model.TaskDetail;
+import org.openmrs.module.ipd.api.events.ConfigLoader;
+import org.openmrs.module.ipd.api.events.IPDEventUtils;
+import org.openmrs.module.ipd.api.events.model.ConfigDetail;
+import org.openmrs.module.ipd.api.events.model.IPDEvent;
+import org.openmrs.module.ipd.api.events.model.TaskDetail;
+import org.openmrs.module.ipd.api.events.handler.IPDEventHandler;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
diff --git a/api/src/main/java/org/openmrs/module/ipd/api/events/handler/impl/RolloverTaskEventHandler.java b/api/src/main/java/org/openmrs/module/ipd/api/events/handler/impl/RolloverTaskEventHandler.java
new file mode 100644
index 0000000..9dc34a3
--- /dev/null
+++ b/api/src/main/java/org/openmrs/module/ipd/api/events/handler/impl/RolloverTaskEventHandler.java
@@ -0,0 +1,54 @@
+package org.openmrs.module.ipd.api.events.handler.impl;
+
+import org.openmrs.module.fhir2.model.FhirTask;
+import org.openmrs.module.fhirExtension.dao.TaskRequestedPeriodDao;
+import org.openmrs.module.fhirExtension.model.FhirTaskRequestedPeriod;
+import org.openmrs.module.fhirExtension.model.Task;
+import org.openmrs.module.fhirExtension.service.TaskService;
+import org.openmrs.module.ipd.api.events.ConfigLoader;
+import org.openmrs.module.ipd.api.events.handler.IPDEventHandler;
+import org.openmrs.module.ipd.api.events.model.ConfigDetail;
+import org.openmrs.module.ipd.api.events.model.IPDEvent;
+import org.openmrs.module.ipd.api.events.model.TaskDetail;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+import java.util.stream.Collectors;
+
+@Component
+public class RolloverTaskEventHandler implements IPDEventHandler {
+
+ @Autowired
+ ConfigLoader configLoader;
+ @Autowired
+ private TaskService taskService;
+ @Autowired
+ private TaskRequestedPeriodDao taskRequestedPeriodDao;
+ private static final String TASK_STATUS = "REQUESTED";
+
+ @Override
+ public void handleEvent(IPDEvent event) {
+ List configList = configLoader.getConfigs();
+ ConfigDetail eventConfig = configList.stream()
+ .filter(config -> config.getType().equals(event.getIpdEventType().name()))
+ .findFirst()
+ .orElse(null);
+
+ List taskNames = eventConfig.getTasks().stream()
+ .map(TaskDetail::getName)
+ .collect(Collectors.toList());
+ List rolloverTasks = taskService.searchTasks(taskNames, FhirTask.TaskStatus.REQUESTED);
+ List fhirTaskRequestedPeriods = new ArrayList();
+ for (Task task : rolloverTasks) {
+ if (task.getFhirTaskRequestedPeriod() != null) {
+ FhirTaskRequestedPeriod fhirTaskRequestedPeriod = task.getFhirTaskRequestedPeriod();
+ fhirTaskRequestedPeriod.setRequestedStartTime(new Date());
+ fhirTaskRequestedPeriods.add(fhirTaskRequestedPeriod);
+ }
+ }
+ taskRequestedPeriodDao.update(fhirTaskRequestedPeriods);
+ }
+}
\ No newline at end of file
diff --git a/api/src/main/java/org/openmrs/module/ipd/api/events/handler/impl/ShiftStartTaskEventHandler.java b/api/src/main/java/org/openmrs/module/ipd/api/events/handler/impl/ShiftStartTaskEventHandler.java
new file mode 100644
index 0000000..e97d620
--- /dev/null
+++ b/api/src/main/java/org/openmrs/module/ipd/api/events/handler/impl/ShiftStartTaskEventHandler.java
@@ -0,0 +1,60 @@
+package org.openmrs.module.ipd.api.events.handler.impl;
+
+import org.openmrs.module.fhirExtension.model.Task;
+import org.openmrs.module.fhirExtension.service.TaskService;
+import org.openmrs.module.fhirExtension.web.contract.TaskRequest;
+import org.openmrs.module.fhirExtension.web.mapper.TaskMapper;
+import org.openmrs.module.ipd.api.events.ConfigLoader;
+import org.openmrs.module.ipd.api.events.IPDEventUtils;
+import org.openmrs.module.ipd.api.events.handler.IPDEventHandler;
+import org.openmrs.module.ipd.api.events.model.ConfigDetail;
+import org.openmrs.module.ipd.api.events.model.IPDEvent;
+import org.openmrs.module.ipd.api.events.model.TaskDetail;
+import org.openmrs.module.ipd.api.model.AdmittedPatient;
+import org.openmrs.module.ipd.api.service.WardService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import java.util.ArrayList;
+import java.util.List;
+
+@Component
+public class ShiftStartTaskEventHandler implements IPDEventHandler {
+
+ @Autowired
+ ConfigLoader configLoader;
+ @Autowired
+ private TaskMapper taskMapper;
+ @Autowired
+ private TaskService taskService;
+ @Autowired
+ private WardService wardService;
+
+ @Override
+ public void handleEvent(IPDEvent event) {
+ List admittedPatients = wardService.getAdmittedPatients();
+ ConfigDetail eventConfig = getEventConfig(event);
+ List tasks = new ArrayList();
+ for(AdmittedPatient admittedPatient: admittedPatients){
+ String patientUuid = admittedPatient.getBedPatientAssignment().getPatient().getUuid();
+ IPDEvent ipdEvent = new IPDEvent(null, patientUuid, event.getIpdEventType());
+ for(TaskDetail taskDetail : eventConfig.getTasks()) {
+ TaskRequest taskRequest = IPDEventUtils.createNonMedicationTaskRequest(ipdEvent, taskDetail.getName(), "nursing_activity_system");
+ Task task = taskMapper.fromRequest(taskRequest);
+ tasks.add(task);
+ }
+ }
+ if(tasks.size() > 0){
+ taskService.saveTask(tasks);
+ }
+ }
+
+ private ConfigDetail getEventConfig(IPDEvent event){
+ List configList = configLoader.getConfigs();
+ ConfigDetail eventConfig = configList.stream()
+ .filter(config -> config.getType().equals(event.getIpdEventType().name()))
+ .findFirst()
+ .orElse(null);
+ return eventConfig;
+ }
+}
\ No newline at end of file
diff --git a/omod/src/main/java/org/openmrs/module/ipd/events/model/ConfigDetail.java b/api/src/main/java/org/openmrs/module/ipd/api/events/model/ConfigDetail.java
similarity index 90%
rename from omod/src/main/java/org/openmrs/module/ipd/events/model/ConfigDetail.java
rename to api/src/main/java/org/openmrs/module/ipd/api/events/model/ConfigDetail.java
index 8eae262..284f2a5 100644
--- a/omod/src/main/java/org/openmrs/module/ipd/events/model/ConfigDetail.java
+++ b/api/src/main/java/org/openmrs/module/ipd/api/events/model/ConfigDetail.java
@@ -1,4 +1,4 @@
-package org.openmrs.module.ipd.events.model;
+package org.openmrs.module.ipd.api.events.model;
import com.fasterxml.jackson.annotation.JsonAutoDetect;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
diff --git a/omod/src/main/java/org/openmrs/module/ipd/events/model/IPDEvent.java b/api/src/main/java/org/openmrs/module/ipd/api/events/model/IPDEvent.java
similarity index 91%
rename from omod/src/main/java/org/openmrs/module/ipd/events/model/IPDEvent.java
rename to api/src/main/java/org/openmrs/module/ipd/api/events/model/IPDEvent.java
index e812c49..dc5cf9b 100644
--- a/omod/src/main/java/org/openmrs/module/ipd/events/model/IPDEvent.java
+++ b/api/src/main/java/org/openmrs/module/ipd/api/events/model/IPDEvent.java
@@ -1,4 +1,4 @@
-package org.openmrs.module.ipd.events.model;
+package org.openmrs.module.ipd.api.events.model;
import com.fasterxml.jackson.annotation.JsonAutoDetect;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
diff --git a/omod/src/main/java/org/openmrs/module/ipd/events/model/IPDEventType.java b/api/src/main/java/org/openmrs/module/ipd/api/events/model/IPDEventType.java
similarity index 64%
rename from omod/src/main/java/org/openmrs/module/ipd/events/model/IPDEventType.java
rename to api/src/main/java/org/openmrs/module/ipd/api/events/model/IPDEventType.java
index 52196f0..e74030c 100644
--- a/omod/src/main/java/org/openmrs/module/ipd/events/model/IPDEventType.java
+++ b/api/src/main/java/org/openmrs/module/ipd/api/events/model/IPDEventType.java
@@ -1,4 +1,4 @@
-package org.openmrs.module.ipd.events.model;
+package org.openmrs.module.ipd.api.events.model;
public enum IPDEventType {
PATIENT_ADMIT,
diff --git a/omod/src/main/java/org/openmrs/module/ipd/events/model/TaskDetail.java b/api/src/main/java/org/openmrs/module/ipd/api/events/model/TaskDetail.java
similarity index 89%
rename from omod/src/main/java/org/openmrs/module/ipd/events/model/TaskDetail.java
rename to api/src/main/java/org/openmrs/module/ipd/api/events/model/TaskDetail.java
index e5de905..7b1426f 100644
--- a/omod/src/main/java/org/openmrs/module/ipd/events/model/TaskDetail.java
+++ b/api/src/main/java/org/openmrs/module/ipd/api/events/model/TaskDetail.java
@@ -1,4 +1,4 @@
-package org.openmrs.module.ipd.events.model;
+package org.openmrs.module.ipd.api.events.model;
import com.fasterxml.jackson.annotation.JsonAutoDetect;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
diff --git a/api/src/main/java/org/openmrs/module/ipd/api/scheduler/tasks/RollOverNonMedicationTasks.java b/api/src/main/java/org/openmrs/module/ipd/api/scheduler/tasks/RollOverNonMedicationTasks.java
new file mode 100644
index 0000000..4f2615e
--- /dev/null
+++ b/api/src/main/java/org/openmrs/module/ipd/api/scheduler/tasks/RollOverNonMedicationTasks.java
@@ -0,0 +1,30 @@
+package org.openmrs.module.ipd.api.scheduler.tasks;
+
+import org.openmrs.module.ipd.api.events.IPDEventManager;
+import org.openmrs.module.ipd.api.events.model.IPDEvent;
+import org.openmrs.module.ipd.api.events.model.IPDEventType;
+import org.openmrs.scheduler.tasks.AbstractTask;
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.ApplicationContextAware;
+import org.springframework.stereotype.Component;
+
+@Component
+public class RollOverNonMedicationTasks extends AbstractTask implements ApplicationContextAware {
+
+ private static ApplicationContext context;
+
+ @Override
+ public void execute() {
+ IPDEventManager eventManager = context.getBean(IPDEventManager.class);
+ IPDEventType eventType = eventManager.getEventTypeForEncounter(String.valueOf(IPDEventType.ROLLOVER_TASK));
+ if (eventType != null) {
+ IPDEvent ipdEvent = new IPDEvent(null, null, eventType);
+ eventManager.processEvent(ipdEvent);
+ }
+ }
+
+ @Override
+ public void setApplicationContext(ApplicationContext applicationContext) {
+ this.context = applicationContext;
+ }
+}
diff --git a/api/src/main/java/org/openmrs/module/ipd/api/scheduler/tasks/ShiftStartTasks.java b/api/src/main/java/org/openmrs/module/ipd/api/scheduler/tasks/ShiftStartTasks.java
new file mode 100644
index 0000000..59ce500
--- /dev/null
+++ b/api/src/main/java/org/openmrs/module/ipd/api/scheduler/tasks/ShiftStartTasks.java
@@ -0,0 +1,29 @@
+package org.openmrs.module.ipd.api.scheduler.tasks;
+
+import org.openmrs.module.ipd.api.events.IPDEventManager;
+import org.openmrs.module.ipd.api.events.model.IPDEvent;
+import org.openmrs.module.ipd.api.events.model.IPDEventType;
+import org.openmrs.scheduler.tasks.AbstractTask;
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.ApplicationContextAware;
+import org.springframework.stereotype.Component;
+
+@Component
+public class ShiftStartTasks extends AbstractTask implements ApplicationContextAware {
+
+ private static ApplicationContext context;
+ @Override
+ public void execute() {
+ IPDEventManager eventManager = context.getBean(IPDEventManager.class);
+ IPDEventType eventType = eventManager.getEventTypeForEncounter(String.valueOf(IPDEventType.SHIFT_START_TASK));
+ if (eventType != null) {
+ IPDEvent ipdEvent = new IPDEvent(null, null, eventType);
+ eventManager.processEvent(ipdEvent);
+ }
+ }
+
+ @Override
+ public void setApplicationContext(ApplicationContext applicationContext) {
+ this.context = applicationContext;
+ }
+}
diff --git a/api/src/main/java/org/openmrs/module/ipd/api/service/WardService.java b/api/src/main/java/org/openmrs/module/ipd/api/service/WardService.java
index e358643..070999a 100644
--- a/api/src/main/java/org/openmrs/module/ipd/api/service/WardService.java
+++ b/api/src/main/java/org/openmrs/module/ipd/api/service/WardService.java
@@ -15,4 +15,6 @@ public interface WardService {
List searchWardPatients(String wardUuid, List searchKeys, String searchValue, String sortBy);
List getPatientsByWardAndProvider(String wardUuid, String providerUuid, String sortBy);
+
+ List getAdmittedPatients();
}
diff --git a/api/src/main/java/org/openmrs/module/ipd/api/service/impl/WardServiceImpl.java b/api/src/main/java/org/openmrs/module/ipd/api/service/impl/WardServiceImpl.java
index f91506d..72dc5dd 100644
--- a/api/src/main/java/org/openmrs/module/ipd/api/service/impl/WardServiceImpl.java
+++ b/api/src/main/java/org/openmrs/module/ipd/api/service/impl/WardServiceImpl.java
@@ -55,4 +55,8 @@ public List searchWardPatients(String wardUuid, List se
return wardDAO.searchAdmittedPatients(location,searchKeys,searchValue,sortBy);
}
+ @Override
+ public List getAdmittedPatients() {
+ return wardDAO.getAdmittedPatients(null,null, null, null);
+ }
}
diff --git a/api/src/main/resources/liquibase.xml b/api/src/main/resources/liquibase.xml
index dd87526..ce25f1d 100644
--- a/api/src/main/resources/liquibase.xml
+++ b/api/src/main/resources/liquibase.xml
@@ -404,4 +404,68 @@
+
+
+
+ SELECT COUNT(*) FROM scheduler_task_config WHERE name = "Shift Start Tasks First";
+
+
+
+ INSERT INTO
+ scheduler_task_config(name, description, schedulable_class, start_time, start_time_pattern, repeat_interval,
+ start_on_startup, created_by, date_created, uuid)
+ VALUES
+ ('Shift Start Tasks First', 'Shift start tasks first shift', 'org.openmrs.module.ipd.api.scheduler.tasks.ShiftStartTasks',
+ '2024-04-11 08:00:00', 'MM/dd/yyyy HH:mm:ss', 86400, true, 1, NOW(), UUID());
+
+
+
+
+
+
+ SELECT COUNT(*) FROM scheduler_task_config WHERE name = "Shift Start Tasks Second";
+
+
+
+ INSERT INTO
+ scheduler_task_config(name, description, schedulable_class, start_time, start_time_pattern, repeat_interval,
+ start_on_startup, created_by, date_created, uuid)
+ VALUES
+ ('Shift Start Tasks Second', 'Shift start tasks second shift', 'org.openmrs.module.ipd.api.scheduler.tasks.ShiftStartTasks',
+ '2024-04-11 19:00:00', 'MM/dd/yyyy HH:mm:ss', 86400, true, 1, NOW(), UUID());
+
+
+
+
+
+
+ SELECT COUNT(*) FROM scheduler_task_config WHERE name = "Rollover Tasks First";
+
+
+
+ INSERT INTO
+ scheduler_task_config(name, description, schedulable_class, start_time, start_time_pattern, repeat_interval,
+ start_on_startup, created_by, date_created, uuid)
+ VALUES
+ ('Rollover Tasks First', 'Rollover tasks first shift', 'org.openmrs.module.ipd.api.scheduler.tasks.RollOverNonMedicationTasks',
+ '2024-04-11 08:00:00', 'MM/dd/yyyy HH:mm:ss', 86400, true, 1, NOW(), UUID());
+
+
+
+
+
+
+ SELECT COUNT(*) FROM scheduler_task_config WHERE name = "Rollover Tasks Second";
+
+
+
+ INSERT INTO
+ scheduler_task_config(name, description, schedulable_class, start_time, start_time_pattern, repeat_interval,
+ start_on_startup, created_by, date_created, uuid)
+ VALUES
+ ('Rollover Tasks Second', 'Rollover tasks second shift', 'org.openmrs.module.ipd.api.scheduler.tasks.RollOverNonMedicationTasks',
+ '2024-04-11 19:00:00', 'MM/dd/yyyy HH:mm:ss', 86400, true, 1, NOW(), UUID());
+
+
+
diff --git a/omod/pom.xml b/omod/pom.xml
index 11a3f26..156e1d2 100644
--- a/omod/pom.xml
+++ b/omod/pom.xml
@@ -181,6 +181,11 @@
2.1
compile
+
+ ${project.parent.groupId}
+ ${project.parent.artifactId}-api
+ ${project.parent.version}
+
\ No newline at end of file
diff --git a/omod/src/main/java/org/openmrs/module/ipd/events/factory/IPDEventFactory.java b/omod/src/main/java/org/openmrs/module/ipd/events/factory/IPDEventFactory.java
deleted file mode 100644
index 690a467..0000000
--- a/omod/src/main/java/org/openmrs/module/ipd/events/factory/IPDEventFactory.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package org.openmrs.module.ipd.events.factory;
-
-import org.openmrs.module.ipd.events.model.IPDEventType;
-import org.openmrs.module.ipd.events.handler.IPDEventHandler;
-
-public interface IPDEventFactory {
- IPDEventHandler createEventHandler(IPDEventType eventType);
-}
\ No newline at end of file
diff --git a/omod/src/main/java/org/openmrs/module/ipd/events/handler/IPDEventHandler.java b/omod/src/main/java/org/openmrs/module/ipd/events/handler/IPDEventHandler.java
deleted file mode 100644
index 27b1cca..0000000
--- a/omod/src/main/java/org/openmrs/module/ipd/events/handler/IPDEventHandler.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package org.openmrs.module.ipd.events.handler;
-
-import org.openmrs.module.ipd.events.model.IPDEvent;
-
-public interface IPDEventHandler {
- void handleEvent(IPDEvent event);
-}
\ No newline at end of file
diff --git a/omod/src/main/java/org/openmrs/module/ipd/events/handler/impl/RolloverTaskEventHandler.java b/omod/src/main/java/org/openmrs/module/ipd/events/handler/impl/RolloverTaskEventHandler.java
deleted file mode 100644
index 71f0def..0000000
--- a/omod/src/main/java/org/openmrs/module/ipd/events/handler/impl/RolloverTaskEventHandler.java
+++ /dev/null
@@ -1,29 +0,0 @@
-package org.openmrs.module.ipd.events.handler.impl;
-
-import org.openmrs.module.ipd.events.ConfigLoader;
-import org.openmrs.module.ipd.events.model.ConfigDetail;
-import org.openmrs.module.ipd.events.model.IPDEvent;
-import org.openmrs.module.ipd.events.handler.IPDEventHandler;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Component;
-
-import java.util.List;
-
-@Component
-public class RolloverTaskEventHandler implements IPDEventHandler {
-
- @Autowired
- ConfigLoader configLoader;
-
- @Override
- public void handleEvent(IPDEvent event) {
- List configList = configLoader.getConfigs();
- ConfigDetail eventConfig = configList.stream()
- .filter(config -> config.getType().equals(event.getIpdEventType().name()))
- .findFirst()
- .orElse(null);
- System.out.println("eventConfig type RolloverTaskEventHandler " + eventConfig.getType());
- System.out.println("eventConfig tasks RolloverTaskEventHandler " + eventConfig.getTasks() + " size --- " + eventConfig.getTasks().size());
- //create task based on configuration
- }
-}
\ No newline at end of file
diff --git a/omod/src/main/java/org/openmrs/module/ipd/events/handler/impl/ShiftStartTaskEventHandler.java b/omod/src/main/java/org/openmrs/module/ipd/events/handler/impl/ShiftStartTaskEventHandler.java
deleted file mode 100644
index 603e59a..0000000
--- a/omod/src/main/java/org/openmrs/module/ipd/events/handler/impl/ShiftStartTaskEventHandler.java
+++ /dev/null
@@ -1,28 +0,0 @@
-package org.openmrs.module.ipd.events.handler.impl;
-
-import org.openmrs.module.ipd.events.ConfigLoader;
-import org.openmrs.module.ipd.events.model.ConfigDetail;
-import org.openmrs.module.ipd.events.model.IPDEvent;
-import org.openmrs.module.ipd.events.handler.IPDEventHandler;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Component;
-
-import java.util.List;
-
-@Component
-public class ShiftStartTaskEventHandler implements IPDEventHandler {
-
- @Autowired
- ConfigLoader configLoader;
-
- @Override
- public void handleEvent(IPDEvent event) {
- List configList = configLoader.getConfigs();
- ConfigDetail eventConfig = configList.stream()
- .filter(config -> config.getType().equals(event.getIpdEventType().name()))
- .findFirst()
- .orElse(null);
-
- //create task based on configuration
- }
-}
\ No newline at end of file
diff --git a/omod/src/main/java/org/openmrs/module/ipd/postprocessor/IPDTransactionHandler.java b/omod/src/main/java/org/openmrs/module/ipd/postprocessor/IPDTransactionHandler.java
index 82c9825..d12737e 100644
--- a/omod/src/main/java/org/openmrs/module/ipd/postprocessor/IPDTransactionHandler.java
+++ b/omod/src/main/java/org/openmrs/module/ipd/postprocessor/IPDTransactionHandler.java
@@ -3,12 +3,12 @@
import org.openmrs.Encounter;
import org.openmrs.module.emrapi.encounter.domain.EncounterTransaction;
import org.openmrs.module.emrapi.encounter.postprocessor.EncounterTransactionHandler;
-import org.openmrs.module.ipd.events.model.IPDEvent;
+import org.openmrs.module.ipd.api.events.model.IPDEvent;
import org.openmrs.module.ipd.service.IPDScheduleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
-import org.openmrs.module.ipd.events.model.IPDEventType;
-import org.openmrs.module.ipd.events.IPDEventManager;
+import org.openmrs.module.ipd.api.events.model.IPDEventType;
+import org.openmrs.module.ipd.api.events.IPDEventManager;
@Component
public class IPDTransactionHandler implements EncounterTransactionHandler {