Skip to content

Commit

Permalink
Merge pull request #1214 from mozzy11/develop
Browse files Browse the repository at this point in the history
FFix Loading NonConforming eOrders
  • Loading branch information
mozzy11 authored Jul 31, 2024
2 parents ad75b49 + 5d5d784 commit 57b7604
Show file tree
Hide file tree
Showing 9 changed files with 113 additions and 18 deletions.
16 changes: 9 additions & 7 deletions frontend/src/components/addOrder/Index.js
Original file line number Diff line number Diff line change
Expand Up @@ -169,13 +169,15 @@ const Index = () => {
crossSampleTypeMap = {};
crossSampleTypeOrderMap = {};

parseSampletypes(
newOrderFormValues,
order.sampleTypes instanceof Array
? order.sampleTypes
: [{ sampleType: order.sampleTypes.sampleType }],
SampleTypes,
);
if (order.sampleTypes != "") {
parseSampletypes(
newOrderFormValues,
order.sampleTypes instanceof Array
? order.sampleTypes
: [{ sampleType: order.sampleTypes.sampleType }],
SampleTypes,
);
}

const urlParams = new URLSearchParams(window.location.search);
const externalId = urlParams.get("ID");
Expand Down
7 changes: 6 additions & 1 deletion frontend/src/components/eOrder/EOrder.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,12 @@ const EOrder = ({ eOrders, setEOrders, eOrderRef }) => {
}

function editOrder(externalOrderId, labNumber) {
window.open("SamplePatientEntry?ID=" + externalOrderId + "&labNumber=" + (labNumber || ""));
window.open(
"SamplePatientEntry?ID=" +
externalOrderId +
"&labNumber=" +
(labNumber || ""),
);
}

const handleLabNoGeneration = (e, index) => {
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<minor.version>8</minor.version>
<state.version>1</state.version>
<!-- 0 = alpha, 1 = beta, 2 = rc, 3 = deployable -->
<fix.version>37</fix.version>
<fix.version>38</fix.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<liquibase.propertyFile>${project.basedir}/liquibase/liquibase.properties</liquibase.propertyFile>
<castor.version>1.4.1</castor.version>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -467,12 +467,18 @@ private void addToTestOrPanel(List<Request> tests, String loinc, String sampleTy
}
}
if (test == null) {
test = testService.getActiveTestsByLoinc(loinc).get(0);
List<Test> alltests = testService.getActiveTestsByLoinc(loinc);
if (alltests != null && alltests.size() > 0) {
test = alltests.get(0);
}
}
if (typeOfSample == null) {
typeOfSample = typeOfSampleService.getTypeOfSampleForTest(test.getId()).get(0);
if (test != null) {
if (typeOfSample == null) {
typeOfSample = typeOfSampleService.getTypeOfSampleForTest(test.getId()).get(0);
}
tests.add(new Request(test.getName(), loinc, typeOfSample.getLocalizedName()));
}
tests.add(new Request(test.getName(), loinc, typeOfSample.getLocalizedName()));

}

private void createMaps(List<Request> testRequests, List<Request> panelNames) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -347,8 +347,10 @@ public DashBoardMetrics getDasBoardTiles() {
metrics.setUnPritendResults(unprintedResults().size());
break;
case INCOMING_ORDERS:
metrics.setIncomigOrders(electronicOrderService.getCountOfElectronicOrdersByTimestampAndStatus(
startTimestamp, endTimestamp, iStatusService.getStatusID(ExternalOrderStatus.Entered)));
List<Integer> estausIds = new ArrayList<>();
estausIds.add(Integer.parseInt(iStatusService.getStatusID(ExternalOrderStatus.Entered)));
estausIds.add(Integer.parseInt(iStatusService.getStatusID(ExternalOrderStatus.NonConforming)));
metrics.setIncomigOrders(electronicOrderService.getCountOfElectronicOrdersByStatusList(estausIds));
break;
case AVERAGE_TURN_AROUND_TIME:
metrics.setAverageTurnAroudTime(calculateAverageReceptionToValidationTime());
Expand Down Expand Up @@ -436,8 +438,10 @@ private List<OrderDisplayBean> retreiveOrders(DashBoardTile.TileType listType, S
case UN_PRINTED_RESULTS:
return convertAnalysesToOrderBean(unprintedResults());
case INCOMING_ORDERS:
List<ElectronicOrder> eOrders = electronicOrderService.getAllElectronicOrdersByTimestampAndStatus(
startTimestamp, endTimestamp, iStatusService.getStatusID(ExternalOrderStatus.Entered),
List<Integer> estausIds = new ArrayList<>();
estausIds.add(Integer.parseInt(iStatusService.getStatusID(ExternalOrderStatus.Entered)));
estausIds.add(Integer.parseInt(iStatusService.getStatusID(ExternalOrderStatus.NonConforming)));
List<ElectronicOrder> eOrders = electronicOrderService.getAllElectronicOrdersByStatusList(estausIds,
ElectronicOrder.SortOrder.STATUS_ID);
return convertElectronicToOrderBean(eOrders);
case AVERAGE_TURN_AROUND_TIME:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,8 @@ public List<ElectronicOrder> getAllElectronicOrdersMatchingAnyValue(List<String>
String patientValue, SortOrder order);

int getCountOfAllElectronicOrdersByDateAndStatus(Date startDate, Date endDate, String statusId);

int getCountOfElectronicOrdersByStatusList(List<Integer> statusIds);

List<ElectronicOrder> getAllElectronicOrdersByStatusList(List<Integer> statusIds, SortOrder sortOrder);
}
Original file line number Diff line number Diff line change
Expand Up @@ -458,4 +458,64 @@ public int getCountOfAllElectronicOrdersByDateAndStatus(Date startDate, Date end
}
return 0;
}

@Override
public int getCountOfElectronicOrdersByStatusList(List<Integer> statusIds) {
String hql = "SELECT COUNT(*) From ElectronicOrder eo WHERE 1 = 1 ";

if (statusIds != null) {
hql += "AND eo.statusId IN (:statusIds)";
}

try {
Query<Long> query = entityManager.unwrap(Session.class).createQuery(hql, Long.class);
if (statusIds != null) {
query.setParameter("statusIds", statusIds);
}
Long count = query.uniqueResult();
return count.intValue();
} catch (HibernateException e) {
handleException(e, "getCountOfElectronicOrdersByStatusList");
}
return 0;
}

@Override
public List<ElectronicOrder> getAllElectronicOrdersByStatusList(List<Integer> statusIds, SortOrder sortOrder) {
String hql = "From ElectronicOrder eo WHERE 1 = 1 ";

if (statusIds != null) {
hql += "AND eo.statusId IN (:statusIds)";
}

switch (sortOrder) {
case STATUS_ID:
hql += "ORDER BY eo.statusId asc ";
break;
case LAST_UPDATED_ASC:
hql += "ORDER BY eo.lastUpdated asc ";
break;
case LAST_UPDATED_DESC:
hql += "ORDER BY eo.lastUpdated desc ";
break;
case EXTERNAL_ID:
hql += "ORDER BY eo.externalId asc ";
break;
default:
//
break;
}

try {
Query<ElectronicOrder> query = entityManager.unwrap(Session.class).createQuery(hql, ElectronicOrder.class);

if (statusIds != null) {
query.setParameter("statusIds", statusIds);
}
return query.list();
} catch (HibernateException e) {
handleException(e, "getAllElectronicOrdersByStatusList");
}
return new ArrayList<>();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,15 @@ List<ElectronicOrder> getAllElectronicOrdersByDateAndStatus(Date startDate, Date
int getCountOfAllElectronicOrdersByDateAndStatus(Date startDate, Date endDate, String statusId);

List<ElectronicOrder> getAllElectronicOrdersByTimestampAndStatus(Timestamp startTimestamp, Timestamp endTimestamp,
String statusId, SortOrder statusId2);
String statusId, SortOrder sortOrder);

int getCountOfElectronicOrdersByTimestampAndStatus(Timestamp startTimestamp, Timestamp endTimestamp,
String statusId);

int getCountOfElectronicOrdersByStatusList(List<Integer> statusIds);

List<ElectronicOrder> getAllElectronicOrdersByStatusList(List<Integer> statusIds, SortOrder sortOrder);

List<ElectronicOrder> searchForElectronicOrders(ElectronicOrderViewForm form);

List<ElectronicOrder> searchForStudyElectronicOrders(ElectronicOrderViewForm form);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -214,4 +214,14 @@ public List<ElectronicOrder> searchForStudyElectronicOrders(ElectronicOrderViewF
public int getCountOfAllElectronicOrdersByDateAndStatus(Date startDate, Date endDate, String statusId) {
return getBaseObjectDAO().getCountOfAllElectronicOrdersByDateAndStatus(startDate, endDate, statusId);
}

@Override
public List<ElectronicOrder> getAllElectronicOrdersByStatusList(List<Integer> statusIds, SortOrder sortOrder) {
return getBaseObjectDAO().getAllElectronicOrdersByStatusList(statusIds, sortOrder);
}

@Override
public int getCountOfElectronicOrdersByStatusList(List<Integer> statusIds) {
return getBaseObjectDAO().getCountOfElectronicOrdersByStatusList(statusIds);
}
}

0 comments on commit 57b7604

Please sign in to comment.