diff --git a/api/src/main/java/org/openmrs/module/queue/model/QueueEntryTransition.java b/api/src/main/java/org/openmrs/module/queue/model/QueueEntryTransition.java index b2551d7..367db1d 100644 --- a/api/src/main/java/org/openmrs/module/queue/model/QueueEntryTransition.java +++ b/api/src/main/java/org/openmrs/module/queue/model/QueueEntryTransition.java @@ -34,6 +34,8 @@ public class QueueEntryTransition implements Serializable { private Concept newPriority; + private String newPriorityComment; + /** * @return a new queue entry representing what one intends to transition into */ @@ -43,7 +45,8 @@ public QueueEntry constructNewQueueEntry() { queueEntry.setPatient(queueEntryToTransition.getPatient()); queueEntry.setVisit(queueEntryToTransition.getVisit()); queueEntry.setPriority(newPriority == null ? queueEntryToTransition.getPriority() : newPriority); - queueEntry.setPriorityComment(queueEntryToTransition.getPriorityComment()); + queueEntry.setPriorityComment( + newPriorityComment == null ? queueEntryToTransition.getPriorityComment() : newPriorityComment); queueEntry.setStatus(newStatus == null ? queueEntryToTransition.getStatus() : newStatus); queueEntry.setSortWeight(queueEntryToTransition.getSortWeight()); queueEntry.setLocationWaitingFor(queueEntryToTransition.getLocationWaitingFor()); diff --git a/api/src/test/java/org/openmrs/module/queue/api/QueueEntryServiceTest.java b/api/src/test/java/org/openmrs/module/queue/api/QueueEntryServiceTest.java index 3644135..ec3a519 100644 --- a/api/src/test/java/org/openmrs/module/queue/api/QueueEntryServiceTest.java +++ b/api/src/test/java/org/openmrs/module/queue/api/QueueEntryServiceTest.java @@ -216,6 +216,7 @@ public void shouldTransitionQueueEntry() { Concept concept1 = new Concept(); Concept concept2 = new Concept(); String string1 = "starting"; + String string2 = "some string"; double double1 = 5.0; Location location1 = new Location(); Provider provider1 = new Provider(); @@ -265,6 +266,7 @@ public void shouldTransitionQueueEntry() { transition2.setTransitionDate(date3); transition2.setNewQueue(queue2); transition2.setNewPriority(concept2); + transition2.setNewPriorityComment(string2); transition2.setNewStatus(concept2); QueueEntry queueEntry3 = queueEntryService.transitionQueueEntry(transition2); assertThat(queueEntry2.getEndedAt(), equalTo(date3)); @@ -272,7 +274,7 @@ public void shouldTransitionQueueEntry() { assertThat(queueEntry3.getPatient(), equalTo(patient1)); assertThat(queueEntry3.getVisit(), equalTo(visit1)); assertThat(queueEntry3.getPriority(), equalTo(concept2)); - assertThat(queueEntry3.getPriorityComment(), equalTo(string1)); + assertThat(queueEntry3.getPriorityComment(), equalTo(string2)); assertThat(queueEntry3.getStatus(), equalTo(concept2)); assertThat(queueEntry3.getSortWeight(), equalTo(double1)); assertThat(queueEntry3.getLocationWaitingFor(), equalTo(location1)); diff --git a/omod/src/main/java/org/openmrs/module/queue/web/QueueEntryTransitionRestController.java b/omod/src/main/java/org/openmrs/module/queue/web/QueueEntryTransitionRestController.java index 10e83d1..70c5fa3 100644 --- a/omod/src/main/java/org/openmrs/module/queue/web/QueueEntryTransitionRestController.java +++ b/omod/src/main/java/org/openmrs/module/queue/web/QueueEntryTransitionRestController.java @@ -47,6 +47,8 @@ public class QueueEntryTransitionRestController extends BaseRestController { public static final String NEW_PRIORITY = "newPriority"; + public static final String NEW_PRIORITY_COMMENT = "newPriorityComment"; + private final QueueServicesWrapper services; @Autowired @@ -102,6 +104,8 @@ public Object transitionQueueEntry(@RequestBody Map body) { transition.setNewPriority(concept); } + transition.setNewPriorityComment(body.get(NEW_PRIORITY_COMMENT)); + // Execute transition QueueEntry newQueueEntry = services.getQueueEntryService().transitionQueueEntry(transition); return ConversionUtil.convertToRepresentation(newQueueEntry, Representation.REF); diff --git a/omod/src/main/java/org/openmrs/module/queue/web/resources/QueueEntryResource.java b/omod/src/main/java/org/openmrs/module/queue/web/resources/QueueEntryResource.java index 457761f..d22346e 100644 --- a/omod/src/main/java/org/openmrs/module/queue/web/resources/QueueEntryResource.java +++ b/omod/src/main/java/org/openmrs/module/queue/web/resources/QueueEntryResource.java @@ -131,9 +131,13 @@ public DelegatingResourceDescription getCreatableProperties() throws ResourceDoe public DelegatingResourceDescription getUpdatableProperties() throws ResourceDoesNotSupportOperationException { DelegatingResourceDescription description = new DelegatingResourceDescription(); description.addProperty("status"); + description.addProperty("priority"); description.addProperty("priorityComment"); description.addProperty("sortWeight"); + description.addProperty("startedAt"); description.addProperty("endedAt"); + description.addProperty("locationWaitingFor"); + description.addProperty("providerWaitingFor"); return description; }