private void populateScreenFromData(SpecimenVo specimen) { if (specimen == null) return; clearScreen(); //WDEV-16831 if (Boolean.FALSE.equals(specimen.getType().isActive())) { form.cmbSpecimenType().newRow(specimen.getType(), specimen.getType().getText()); } form.cmbSpecimenType().setValue(specimen.getType()); populateAdultSpecimenContainerGrid(specimen); populatePaediatricContainerGrid(specimen); populateAlternativePaediatricContainerGrid(specimen); }
private boolean specimenHasOptions(HashMap<PathSpecimenContainerDetailVo, OrderInvestigationVoCollection> specimenAlternateContainers) { Set<PathSpecimenContainerDetailVo> keys = specimenAlternateContainers.keySet(); for (PathSpecimenContainerDetailVo specimenContainer : keys) { OrderInvestigationVoCollection values = specimenAlternateContainers.get(specimenContainer); if (values != null && values.size() > 1) { for (OrderInvestigationVo investigation : values) { PathInvDetailsVo pathologyDetails = null; if (investigation.getInvestigation().getParentInvestigationPathDetails() != null) { pathologyDetails = investigation.getInvestigation().getParentInvestigationPathDetails(); } else { pathologyDetails = investigation.getInvestigation().getPathInvDetails(); } SpecimenVo specimenVo = pathologyDetails.getSpecimens().get(0); if (specimenVo.getAlternativePaediatricContainers() != null) { for (SpecimenContainerVo container : specimenVo.getAlternativePaediatricContainers()) { if (container.getSpecContainer().equals(specimenContainer)) return true; } } } } } return false; }
private void populateAlternativePaediatricContainerGrid(SpecimenVo specimen) { if (specimen.getAlternativePaediatricContainers() == null) return; for (int i = 0; i < specimen.getAlternativePaediatricContainers().size(); i++) { addEditAlternatePaediatricContainer(specimen.getAlternativePaediatricContainers().get(i)); } }
private void populatePaediatricContainerGrid(SpecimenVo specimen) { if (specimen.getPaediatricContainers() == null) return; for (int i = 0; i < specimen.getPaediatricContainers().size(); i++) { addEditPaediatricContainer(specimen.getPaediatricContainers().get(i)); } }
private void populateAdultSpecimenContainerGrid(SpecimenVo specimen) { if (specimen.getAdultContainers() == null) return; for (int i = 0; i < specimen.getAdultContainers().size(); i++) { addEditAdultSpecimenContainer(specimen.getAdultContainers().get(i)); } }
private float addInvestigationsWithAlternates(OrderInvestigationRefVoCollection investigations, grdItemsRow specimenRow, HashMap<PathSpecimenContainerDetailVo, OrderInvestigationVoCollection> alternativeContainers) { if (investigations == null || investigations.size() == 0) throw new CodingRuntimeException("Logical Error - can't choose alternative containers for specimens without investigations"); float totalRequiedVolume = 0; for (OrderInvestigationRefVo investigationRef : investigations) { // Upcast - possible error, but done due to performance consideration OrderInvestigationVo investigation = (OrderInvestigationVo) investigationRef; // Get investigation pathology details // Favor parent investigation Pathology Details - this might indicate an add-on investigation PathInvDetailsVo pathologyDetails = null; if (investigation.getInvestigation().getParentInvestigationPathDetails() != null) { pathologyDetails = investigation.getInvestigation().getParentInvestigationPathDetails(); } else { pathologyDetails = investigation.getInvestigation().getPathInvDetails(); } // Create child row for OrderInvestigationVo grdItemsRow investigationRow = specimenRow.getRows().newRow(); // Set investigation name and value to row investigationRow.setColText(getInvestigationDisplayText(investigation, pathologyDetails)); investigationRow.setValue(investigation); boolean isPaed = isUsePaedContainer(); if (isPaed) { // Get specimen from pathology details - implementation only for Simple Investigation // Revise code when implementing Complex investigations SpecimenVo specimen = pathologyDetails.getSpecimens().get(0); // Pediatric container - alternate containers can only be configured for investigations with // only one pediatric container; any investigation must contain at least one pediatric container SpecimenContainerVo paediatricContainer = specimen.getPaediatricContainers().get(0); investigationRow.getColContainer().newRow(paediatricContainer, paediatricContainer.getSpecContainer().getName()); investigationRow.getColContainer().setValue(paediatricContainer); totalRequiedVolume += pathologyDetails.getSpecimens().get(0).getPaediatricContainers().get(0).getVolume(); if (specimen.getAlternativePaediatricContainers() != null) { int addedAlternatives = 0; for (SpecimenContainerVo alternatePaedContainer : specimen.getAlternativePaediatricContainers()) { OrderInvestigationVoCollection orderInvestigations = alternativeContainers.get(alternatePaedContainer.getSpecContainer()); if (orderInvestigations != null && orderInvestigations.size() > 1 && orderInvestigations.contains(investigation)) { alternatePaedContainer.getSpecContainer().setAlternativeVol(alternatePaedContainer.getVolume()); investigationRow.getColContainer().newRow(alternatePaedContainer, alternatePaedContainer.getSpecContainer().getName()); addedAlternatives++; } } investigationRow.setColContainerReadOnly(addedAlternatives == 0); } } } return totalRequiedVolume; }
/** * Build a hash map with OderSpecimen as key, configured SpecimenContainer as secondary key, and OrderInvestigation collection as values * * Instead of comparing every specimen container from every investigation with every specimen from other investigations, build a hash map with OrderSpecimen primary key, * SpecimenContainer secondary key and add all investigations from an OrderSpecimen that have SpecimenContainer configured. If there are more than one investigation * in the collection, then that SpecimenContainer is common to more than one investigation for the OrderSpecimen */ private HashMap<OrderSpecimenVo, HashMap<PathSpecimenContainerDetailVo, OrderInvestigationVoCollection>> buildHashMapOfAlternativeContainers(OrderSpecimenVoCollection myOrderPotentialSpecimens) { if (myOrderPotentialSpecimens == null || myOrderPotentialSpecimens.size() == 0) return null; HashMap<OrderSpecimenVo, HashMap<PathSpecimenContainerDetailVo, OrderInvestigationVoCollection>> generalAlternativeContainers = new HashMap<OrderSpecimenVo, HashMap<PathSpecimenContainerDetailVo,OrderInvestigationVoCollection>>(); for (OrderSpecimenVo specimen : myOrderPotentialSpecimens) { HashMap<PathSpecimenContainerDetailVo, OrderInvestigationVoCollection> specimenAlternativeContainers = new HashMap<PathSpecimenContainerDetailVo, OrderInvestigationVoCollection>(); for (int i = 0; i < specimen.getInvestigations().size(); i++) { OrderInvestigationVo investigation = (OrderInvestigationVo) specimen.getInvestigations().get(i); // Unsafe upcast due to performance reasons PathInvDetailsVo pathologyDetails = null; if (investigation.getInvestigation().getParentInvestigationPathDetails() != null) { pathologyDetails = investigation.getInvestigation().getParentInvestigationPathDetails(); } else { pathologyDetails = investigation.getInvestigation().getPathInvDetails(); } SpecimenVo specimenVo = pathologyDetails.getSpecimens().get(0); PathSpecimenContainerDetailVo pediatricContainer = specimenVo.getPaediatricContainers().get(0).getSpecContainer(); addSpecimenInvestigationToMap(specimenAlternativeContainers, investigation, pediatricContainer); for (SpecimenContainerVo containers : specimenVo.getAlternativePaediatricContainers()) { addSpecimenInvestigationToMap(specimenAlternativeContainers, investigation, containers.getSpecContainer()); } } generalAlternativeContainers.put(specimen, specimenAlternativeContainers); } return generalAlternativeContainers; }
public SpecimenVo getValue() { return populateSpecimen(form.getLocalContext().getSpecimen()); }
public void setValue(SpecimenVo specimen) { form.getLocalContext().setSpecimen(specimen); populateScreenFromData(form.getLocalContext().getSpecimen()); }
private grdTestRow addInvestigationRow(MyOrderComponentVo component, SiteCount count) { grdTestRow pRow = form.lyrDetails().tabPathDetails().lyrPathology().tabRequestedTests().grdTest().getRows().newRow(); pRow.setColTest(component.getText()); pRow.setColTestNameHidden(component.getText()); pRow.setExpandedImage(form.getImages().OCRR.Investigation); pRow.setCollapsedImage(form.getImages().OCRR.Investigation); // WDEV-11938 - starts here OrderInvestigationVo investigation = getOrderInvestigationFromContextByInvestID(component.getID()); pRow.setValue(investigation); if (investigation != null && investigation.getInvestigationIsNotNull()) pRow.setTooltipForColTest(investigation.getInvestigation().buildHelpTextTooltip()); // WDEV-11938 - ends here if (component.getRequiresSiteIsNotNull() && component.getRequiresSite().booleanValue()) { pRow.setColBtnSites(form.getImages().OCRR.SpecimenDetails16); pRow.setTooltipForColBtnSites("Specimen Details"); pRow.setColTypeEmpty(true); count.increment(); } else { pRow.setColTypeEmpty(true); pRow.setColBtnSitesEmpty(true); // Check if the investigation has pathology details if (investigation.getInvestigation().getPathInvDetails() != null) { // Add the specimens as sub-rows of investigation row for (SpecimenVo specimen : investigation.getInvestigation().getPathInvDetails().getSpecimens()) { grdTestRow specimenRow = pRow.getRows().newRow(); specimenRow.setColTest(specimen.getType().toString()); specimenRow.setColTestNameHidden(specimen.getType().toString()); specimenRow.setColBtnSitesEmpty(true); specimenRow.setColSpecimen(specimen); specimenRow.setValue(investigation); addSpecimenContainerRequestedTypeRootItems(specimenRow); } } } if (component.getRequiresSiteIsNotNull() && component.getRequiresSite().booleanValue()) pRow.setReadOnly(true); pRow.setExpanded(true); return pRow; }
private boolean validateRequestedTests() { if (form.lyrDetails().tabPathDetails().lyrPathology().tabRequestedTests().grdTest().getRows().size() == 0) return true; SpecimenCollectionTypeCollection collTypes = new SpecimenCollectionTypeCollection(); for (int i = 0; i < form.lyrDetails().tabPathDetails().lyrPathology().tabRequestedTests().grdTest().getAllRows().length; i++) { GenForm.lyrDetailsLayer.tabPathDetailsContainer.lyrPathologyLayer.tabRequestedTestsContainer.grdTestRow specimenOrSiteRow = form.lyrDetails().tabPathDetails().lyrPathology().tabRequestedTests().grdTest().getAllRows()[i]; if (specimenOrSiteRow.getValue() instanceof OrderInvestigationVo) { if (specimenOrSiteRow.getColSpecimen() instanceof SpecimenVo) { collTypes.add((SpecimenCollectionType) specimenOrSiteRow.getColType().getValue()); if (!specimenOrSiteRow.isReadOnly() && specimenOrSiteRow.getColType().getValue() == null) return false; } else if (specimenOrSiteRow.getColSpecimen() == null && specimenOrSiteRow.getValue() != null && Boolean.TRUE.equals(specimenOrSiteRow.getValue().getInvestigation().getInvestigationIndex().getRequiresSiteSpecifier())) // This could be a site specifier investigation and collection type { collTypes.add((SpecimenCollectionType) specimenOrSiteRow.getColType().getValue()); if (!specimenOrSiteRow.isReadOnly() && specimenOrSiteRow.getColType().getValue() == null) return false; } else if (specimenOrSiteRow.getParentRow() != null) { collTypes.add((SpecimenCollectionType) specimenOrSiteRow.getParentRow().getColType().getValue()); if (specimenOrSiteRow.getParentRow().getColType().getValue() == null) return false; } } else if (specimenOrSiteRow.getValue() == null && specimenOrSiteRow.getParentRow() != null) { collTypes.add((SpecimenCollectionType) specimenOrSiteRow.getParentRow().getColType().getValue()); if (specimenOrSiteRow.getParentRow().getColType().getValue() == null) return false; } } if (collTypes.size() == 0) return false; else return true; }
/** * go through OrderSpecimen grid comparing discipline && specimenSource if found add row to the found row else instantiate new parent row and add to this * * @param tRow * @param grid */ private void modifyDynamicGridNowOrPatient(grdTestRow tRow, DynamicGrid grid) { OrderInvestigationVo voOrderInvestigation = tRow.getValue(); SpecimenVo specimen = tRow.getColSpecimen(); if (tRow.getColHiddenOrderInvestigationSite() != null) { voOrderInvestigation = tRow.getColHiddenOrderInvestigationSite(); } if (voOrderInvestigation == null) // profile collection { grdTestRowCollection collRows = tRow.getRows(); for (int i = 0; i < collRows.size(); i++) { voOrderInvestigation = collRows.get(i).getValue(); voOrderInvestigation.setCollectionType((SpecimenCollectionType) tRow.getColType().getValue()); // Clear OderSpecimen for OrderInvestigation voOrderInvestigation.setSpecimen(null); boolean bProfileProcessed = i > 0; modifyNowOrPatientRows(grid, voOrderInvestigation, null, collRows.get(i).getColSiteHidden(), null, false, bProfileProcessed); } } else { // Clear OderSpecimen for OrderInvestigation voOrderInvestigation.setSpecimen(null); voOrderInvestigation.setCollectionType((SpecimenCollectionType) tRow.getColType().getValue()); modifyNowOrPatientRows(grid, voOrderInvestigation, specimen, tRow.getColSiteHidden(), null, false, false); InvestigationUnderSpecimenVoCollection voCollInvUnderSpecimen = null; if (tRow.getParentRow() != null && tRow.getParentRow().getColAddOnsHidden() != null && tRow.getParentRow().getColAddOnsHidden().getItems() != null) voCollInvUnderSpecimen = tRow.getParentRow().getColAddOnsHidden(); else if (tRow.getColAddOnsHidden() != null && tRow.getColAddOnsHidden().getItems() != null) voCollInvUnderSpecimen = tRow.getColAddOnsHidden(); if (voCollInvUnderSpecimen != null) { for (int i = 0; i < voCollInvUnderSpecimen.size(); i++) { voOrderInvestigation = createOrderInvestigation(voOrderInvestigation, voCollInvUnderSpecimen.get(i)); voOrderInvestigation.setCollectionType((SpecimenCollectionType) tRow.getColType().getValue()); GenericInfoAdapter site = tRow.getColSiteHidden(); PathInvDetailsVo addOnPathInvDetails = tRow.getParentRow() != null ? tRow.getParentRow().getValue().getInvestigation().getPathInvDetails() : tRow.getValue().getInvestigation().getPathInvDetails(); modifyNowOrPatientRows(grid, voOrderInvestigation, null, site, addOnPathInvDetails, true, false); } } } grid.setSelectable(false); grid.setReadOnly(false); }
private void addOrEditSpecimenContainerChildRow(DynamicGridRow row, DynamicGrid grid, OrderInvestigationVo voOrderInvestigation, SpecimenVo specimen, boolean bProfileProcessed, boolean bUsePaediatricContainer, SpecimenContainerVo specimenContainer, Float requiredVal) { if (specimenContainer == null) { engine.showMessage("Config Error - No Container specified"); return; } // WDEV-11747 if (specimenContainer.getVolumeIsNotNull()) requiredVal = specimenContainer.getVolume(); Float containerVal = specimenContainer.getSpecContainer().getVolume(); boolean isAddNew = row.getRows().size() == 0; for (int i = 0; i < row.getRows().size(); i++) { DynamicGridRow childRow = row.getRows().get(i); DynamicGridCell specimenCell = childRow.getCells().get(grid.getColumns().getByIdentifier(SPECIMENTYPE_COLUMN)); if (specimenCell.getIdentifier() != null && ((SpecimenContainerVo)specimenCell.getIdentifier()).getSpecContainer().equals(specimenContainer.getSpecContainer())) { editChildRow(grid, requiredVal, containerVal, childRow, voOrderInvestigation, bProfileProcessed); isAddNew = false; break; } else { isAddNew = true; } } if (isAddNew == true) { addChildRow(row, grid, voOrderInvestigation, specimen, bUsePaediatricContainer, specimenContainer, containerVal, requiredVal); } // adding the orderinvestigation to the collection of // orderinvestigations for the parent(OrderSpecimen) row OrderSpecimenVo voOrderSpecimen = (OrderSpecimenVo) row.getValue(); // Test if the oder investigation is DFT // Test if the investigation OrderSpecimen collection was created if (voOrderInvestigation.getSpecimen() == null) voOrderInvestigation.setSpecimen(new OrderSpecimenRefVoCollection()); voOrderInvestigation.getSpecimen().add(voOrderSpecimen); voOrderSpecimen.getInvestigations().add(voOrderInvestigation); voOrderSpecimen.setOrder(form.getLocalContext().getOcsOrder()); row.setValue(voOrderSpecimen); // WDEV-11542 updating the total required for specimen updateSpecimenRowTotal(row, grid); }