diff --git a/api/src/main/java/org/openmrs/module/queue/model/QueueEntry.java b/api/src/main/java/org/openmrs/module/queue/model/QueueEntry.java
index 40c05a2..9592ffb 100644
--- a/api/src/main/java/org/openmrs/module/queue/model/QueueEntry.java
+++ b/api/src/main/java/org/openmrs/module/queue/model/QueueEntry.java
@@ -16,6 +16,7 @@
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
+import javax.persistence.OneToOne;
import javax.persistence.Table;
import java.util.Date;
@@ -80,6 +81,11 @@ public class QueueEntry extends BaseChangeableOpenmrsData {
@JoinColumn(name = "provider_waiting_for", referencedColumnName = "provider_id")
private Provider providerWaitingFor;
+ //The Location the patient is coming from, if any.
+ @OneToOne
+ @JoinColumn(name = "location_coming_from", referencedColumnName = "queue_id")
+ private Queue locationComingFrom;
+
@Column(name = "started_at", nullable = false)
private Date startedAt;
diff --git a/api/src/main/resources/liquibase.xml b/api/src/main/resources/liquibase.xml
index b6f16df..650d168 100644
--- a/api/src/main/resources/liquibase.xml
+++ b/api/src/main/resources/liquibase.xml
@@ -328,4 +328,25 @@
TIMESTAMP(CURDATE()), 'MM/dd/yyyy HH:mm:ss', 86400, TRUE, 1, NOW(), UUID());
+
+
+
+
+
+
+
+ Add column location_coming_from to queue entry table
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/omod/src/main/java/org/openmrs/module/queue/web/resources/QueueEntrySubResource.java b/omod/src/main/java/org/openmrs/module/queue/web/resources/QueueEntrySubResource.java
index 809d8d2..596db2a 100644
--- a/omod/src/main/java/org/openmrs/module/queue/web/resources/QueueEntrySubResource.java
+++ b/omod/src/main/java/org/openmrs/module/queue/web/resources/QueueEntrySubResource.java
@@ -96,6 +96,7 @@ public DelegatingResourceDescription getCreatableProperties() throws ResourceDoe
description.addProperty("sortWeight");
description.addProperty("startedAt");
description.addProperty("locationWaitingFor");
+ description.addProperty("locationComingFrom");
description.addProperty("providerWaitingFor");
return description;
}
@@ -119,6 +120,7 @@ public DelegatingResourceDescription getRepresentationDescription(Representation
resourceDescription.addProperty("patient", Representation.REF);
resourceDescription.addProperty("priority", Representation.REF);
resourceDescription.addProperty("locationWaitingFor", Representation.REF);
+ resourceDescription.addProperty("locationComingFrom", Representation.REF);
resourceDescription.addProperty("providerWaitingFor", Representation.REF);
resourceDescription.addLink("full", ".?v=" + RestConstants.REPRESENTATION_FULL);
} else if (representation instanceof DefaultRepresentation) {
@@ -128,6 +130,7 @@ public DelegatingResourceDescription getRepresentationDescription(Representation
resourceDescription.addProperty("patient", Representation.DEFAULT);
resourceDescription.addProperty("priority", Representation.DEFAULT);
resourceDescription.addProperty("locationWaitingFor", Representation.DEFAULT);
+ resourceDescription.addProperty("locationComingFrom", Representation.DEFAULT);
resourceDescription.addProperty("providerWaitingFor", Representation.DEFAULT);
resourceDescription.addLink("full", ".?v=" + RestConstants.REPRESENTATION_FULL);
} else if (representation instanceof FullRepresentation) {
@@ -140,6 +143,7 @@ public DelegatingResourceDescription getRepresentationDescription(Representation
resourceDescription.addProperty("patient", Representation.FULL);
resourceDescription.addProperty("priority", Representation.FULL);
resourceDescription.addProperty("locationWaitingFor", Representation.FULL);
+ resourceDescription.addProperty("locationComingFrom", Representation.FULL);
resourceDescription.addProperty("providerWaitingFor", Representation.FULL);
} else if (representation instanceof CustomRepresentation) {
//Let the user decide