Skip to content

Commit

Permalink
U4X-646: Add option to manually update the specimen source for test o…
Browse files Browse the repository at this point in the history
…rders. (mohuganda#546)
  • Loading branch information
slubwama authored Jul 1, 2024
1 parent 8aba3c7 commit f33669c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ public class UgandaEMRConstants {

public static final String PROCESSED_ORDER_WITH_RESULT_QUERY = "select orders.order_id from orders inner join test_order on (test_order.order_id=orders.order_id) inner join obs on (orders.order_id=obs.order_id) where orders.accession_number!=\"\" and specimen_source!=\"\" AND orders.date_created BETWEEN \"%s\" AND \"%s\"";

public static final String SPECIMEN_MANUAL_UPDATE_QUERY="UPDATE test_order set specimen_source=%s where order_id=%s";
public static final String PROCESSED_ORDER_WITH_RESULT_OF_ENCOUNTER_QUERY = "select orders.order_id from orders inner join test_order on (test_order.order_id=orders.order_id) inner join obs on (orders.order_id=obs.order_id) where orders.accession_number!=\"\" and fulfiller_status=\"COMPLETED\" AND orders.encounter_id=%s";

public static final String PROCESSED_ORDER_WITH_RESULT_FOR_PATIENT_QUERY = "select orders.order_id from orders inner join test_order on (test_order.order_id=orders.order_id) inner join obs on (orders.order_id=obs.order_id) where orders.fulfiller_status=\"COMPLETED\" AND orders.patient_id=%s";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2086,7 +2086,15 @@ public TestOrder accessionLabTest(String orderUuid, String accessionNumber, Stri
orderService.voidOrder(order, "REVISED with new order " + testOrder.getOrderNumber());
} else {
testOrder = (TestOrder) orderService.updateOrderFulfillerStatus(order, Order.FulfillerStatus.IN_PROGRESS, "To be processed", accessionNumber);
updateSpecimenSourceManually(order,specimenSourceUuid);
}
return testOrder;
}

private void updateSpecimenSourceManually(Order order,String specimenSourceUUID){
Concept specimenSource=Context.getConceptService().getConceptByUuid(specimenSourceUUID);
if(specimenSource!=null) {
Context.getAdministrationService().executeSQL(String.format(SPECIMEN_MANUAL_UPDATE_QUERY,specimenSource.getConceptId(), order.getOrderId()), false);
}
}
}

0 comments on commit f33669c

Please sign in to comment.