private void setPaediatricContainer() { if (form.grdPaedCont().getRows().size() == 1 && form.grdAltPaedCont().getRows().size() > 0) { engine.showMessage("Please remove the Alternative Paediatric Containers before adding a new Paediatric Container."); return; } form.grdPaedCont().setValue(null); clearForPaediatricContainer(); SpecimenContainerVo paediatricContainer = new SpecimenContainerVo(); paediatricContainer.setType(SpecimenContainerType.PAEDIATRIC); // adultSpecimenContainer.setVolumeUnits(PathVolumeUnits.MLS); form.getGlobalContext().OCRR.setPaediatricsContainer(paediatricContainer); engine.open(form.getForms().OCRR.AlternativeContainerDialog); }
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; }
@Override protected void onBtnOkClick() throws ims.framework.exceptions.PresentationLogicException { if (!validateUI()) return; if (form.getGlobalContext().OCRR.getAdultSpecimenContainerIsNotNull()) { SpecimenContainerVo adultContainer = form.getGlobalContext().OCRR.getAdultSpecimenContainer(); adultContainer.setSpecContainer(form.cmbContainer().getValue()); adultContainer.setVolume(form.decVol().getValue()); adultContainer.setLabelSuffix(form.txtLabelSuffix().getValue()); form.getGlobalContext().OCRR.setAdultSpecimenContainer(adultContainer); } else if (form.getGlobalContext().OCRR.getPaediatricsContainerIsNotNull()) { SpecimenContainerVo paedContainer = form.getGlobalContext().OCRR.getPaediatricsContainer(); paedContainer.setSpecContainer(form.cmbContainer().getValue()); paedContainer.setVolume(form.decVol().getValue()); paedContainer.setLabelSuffix(form.txtLabelSuffix().getValue()); form.getGlobalContext().OCRR.setPaediatricsContainer(paedContainer); } else if (form.getGlobalContext().OCRR.getAlternativePaediatricsContainerIsNotNull()) { SpecimenContainerVo alternativePaedContainer = form.getGlobalContext().OCRR.getAlternativePaediatricsContainer(); alternativePaedContainer.setSpecContainer(form.cmbContainer().getValue()); alternativePaedContainer.setVolume(form.decVol().getValue()); alternativePaedContainer.setLabelSuffix(form.txtLabelSuffix().getValue()); form.getGlobalContext().OCRR.setAlternativePaediatricsContainer(alternativePaedContainer); } engine.close(DialogResult.OK); }
private void setAlternatePaediatricContainer() { form.grdAltPaedCont().setValue(null); clearForAlternatePaedContainer(); SpecimenContainerVo alternatePaediatricContainer = new SpecimenContainerVo(); alternatePaediatricContainer.setType(SpecimenContainerType.ALTERNATE_PAEDIATRIC); // adultSpecimenContainer.setVolumeUnits(PathVolumeUnits.MLS); form.getGlobalContext().OCRR.setAlternativePaediatricsContainer(alternatePaediatricContainer); engine.open(form.getForms().OCRR.AlternativeContainerDialog); }
private void setAdultSpecimenContainer() { form.grdAdultSpecCont().setValue(null); clearForAdultSpecimenContainer(); SpecimenContainerVo adultSpecimenContainer = new SpecimenContainerVo(); adultSpecimenContainer.setType(SpecimenContainerType.ADULT); // adultSpecimenContainer.setVolumeUnits(PathVolumeUnits.MLS); form.getGlobalContext().OCRR.setAdultSpecimenContainer(adultSpecimenContainer); engine.open(form.getForms().OCRR.AlternativeContainerDialog); }
private void addEditAlternatePaediatricContainer(SpecimenContainerVo specimenContainerVo) { //check if container was already added for (int i=0; i < form.grdAltPaedCont().getRows().size(); i++) { if (form.grdAltPaedCont().getSelectedRow() != null && specimenContainerVo.equals(form.grdAltPaedCont().getSelectedRow().getValue())) continue; if (form.grdAltPaedCont().getRows().get(i).getValue().getSpecContainer().getID_PathSpecimenContainer().equals(specimenContainerVo.getSpecContainer().getID_PathSpecimenContainer())) { engine.showMessage("This container was already added to Alternative Paediatric Containers."); return; } } grdAltPaedContRow newRow; if (form.grdAltPaedCont().getValue() != null) { newRow = form.grdAltPaedCont().getSelectedRow(); } else newRow = form.grdAltPaedCont().getRows().newRow(); SpecimenContainerVo altPaedCont = specimenContainerVo; newRow.setColContainer(altPaedCont.getSpecContainer().getName()); if (altPaedCont.getVolume() ==0) { newRow.setColVolume("N/A"); } else newRow.setColVolume(altPaedCont.getVolume().toString()); newRow.setColLblSuffix(altPaedCont.getLabelSuffix()); newRow.setValue(altPaedCont); }
private void addEditPaediatricContainer(SpecimenContainerVo specimenContainerVo) { //check if container was already added for (int i=0; i < form.grdPaedCont().getRows().size(); i++) { if (form.grdPaedCont().getSelectedRow() != null && specimenContainerVo.equals(form.grdPaedCont().getSelectedRow().getValue())) continue; if (form.grdPaedCont().getRows().get(i).getValue().getSpecContainer().getID_PathSpecimenContainer().equals(specimenContainerVo.getSpecContainer().getID_PathSpecimenContainer())) { engine.showMessage("This container was already added to Paediatric Containers."); return; } } grdPaedContRow newRow; if (form.grdPaedCont().getValue() != null) { newRow = form.grdPaedCont().getSelectedRow(); } else newRow = form.grdPaedCont().getRows().newRow(); SpecimenContainerVo paedCont = specimenContainerVo; newRow.setColContainer(paedCont.getSpecContainer().getName()); if (paedCont.getVolume() ==0) { newRow.setColVolume("N/A"); } else newRow.setColVolume(paedCont.getVolume().toString()); newRow.setColLblSuffix(paedCont.getLabelSuffix()); newRow.setValue(paedCont); }
private void addEditAdultSpecimenContainer(SpecimenContainerVo specimenContainerVo) { //check if container was already added for (int i=0; i < form.grdAdultSpecCont().getRows().size(); i++) { if (form.grdAdultSpecCont().getSelectedRow() != null && specimenContainerVo.equals(form.grdAdultSpecCont().getSelectedRow().getValue())) continue; if (form.grdAdultSpecCont().getRows().get(i).getValue().getSpecContainer().getID_PathSpecimenContainer().equals(specimenContainerVo.getSpecContainer().getID_PathSpecimenContainer())) { engine.showMessage("This container was already added to Adult Specimen Containers."); return; } } grdAdultSpecContRow newRow; if (form.grdAdultSpecCont().getValue() != null) { newRow = form.grdAdultSpecCont().getSelectedRow(); } else newRow = form.grdAdultSpecCont().getRows().newRow(); SpecimenContainerVo adultCont = specimenContainerVo; newRow.setColContainer(adultCont.getSpecContainer().getName()); if (adultCont.getVolume() ==0) { newRow.setColVolume("N/A"); } else newRow.setColVolume(adultCont.getVolume().toString()); newRow.setColLblSuffix(adultCont.getLabelSuffix()); newRow.setValue(adultCont); }
@Override protected void onBtnOkClick() throws ims.framework.exceptions.PresentationLogicException { boolean atLeastOneContainerNotSelected = false; //collect choices made and then repopulate back to the original investigations config and run the container calculation again OrderInvestigationVoCollection voCollRewrittenConfig = new OrderInvestigationVoCollection(); for(int i=0; i<form.grdItems().getRows().size(); i++) { grdItemsRow row = form.grdItems().getRows().get(i); for(int p=0;p<row.getRows().size(); p++) { grdItemsRow cRow = row.getRows().get(p); OrderInvestigationVo voOrderInv = cRow.getValue(); PathInvDetailsVo pathInvDetails1 = null; if(voOrderInv.getInvestigation().getParentInvestigationPathDetailsIsNotNull()) pathInvDetails1 = voOrderInv.getInvestigation().getParentInvestigationPathDetails(); else pathInvDetails1 = voOrderInv.getInvestigation().getPathInvDetails(); boolean isPaed = isUsePaedContainer(); if(isPaed) voOrderInv.setChosenContainer((SpecimenContainerVo) cRow.getColContainer().getValue()); // pathInvDetails1.getSpecimens().get(0).getPaediatricContainers().get(0).setSpecContainer((PathSpecimenContainerDetailVo) cRow.getColContainer().getValue()); // else - There are no more alternative containers to the adult // pathInvDetails1.getSpecimens().get(0).getAdultContainers().get(0).setSpecContainer((PathSpecimenContainerDetailVo) cRow.getColContainer().getValue()); //WDEV-11730 if (cRow.getColContainer().getValue() == null) { atLeastOneContainerNotSelected = true; } //modifying the config here if(voOrderInv.getInvestigation().getParentInvestigationPathDetailsIsNotNull()) voOrderInv.getInvestigation().setParentInvestigationPathDetails(pathInvDetails1); else voOrderInv.getInvestigation().setPathInvDetails(pathInvDetails1); voCollRewrittenConfig.add(voOrderInv); } } //WDEV-11730 if (atLeastOneContainerNotSelected) { engine.showMessage("Please select Alternative Containers for all Investigations"); return; } form.getGlobalContext().OCRR.setReWrittenOrderInvestigations(voCollRewrittenConfig); engine.close(DialogResult.OK); }
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; }
private void open() { if (form.getGlobalContext().OCRR.getAdultSpecimenContainerIsNotNull()) { SpecimenContainerVo adultContainer = form.getGlobalContext().OCRR.getAdultSpecimenContainer(); form.cmbContainer().setValue(adultContainer.getSpecContainer()); if (adultContainer.getVolume() != null && adultContainer.getVolume() == 0) { form.txtVol().setValue("N/A"); form.decVol().setValue((float)0); } else form.decVol().setValue(adultContainer.getVolume()); form.txtLabelSuffix().setValue(adultContainer.getLabelSuffix()); } else if (form.getGlobalContext().OCRR.getPaediatricsContainerIsNotNull()) { SpecimenContainerVo paedContainer = form.getGlobalContext().OCRR.getPaediatricsContainer(); form.cmbContainer().setValue(paedContainer.getSpecContainer()); if (paedContainer.getVolume() != null && paedContainer.getVolume() == 0) { form.txtVol().setValue("N/A"); form.decVol().setValue((float)0); } else form.decVol().setValue(paedContainer.getVolume()); form.txtLabelSuffix().setValue(paedContainer.getLabelSuffix()); } else if (form.getGlobalContext().OCRR.getAlternativePaediatricsContainerIsNotNull()) { SpecimenContainerVo alternativePaedContainer = form.getGlobalContext().OCRR.getAlternativePaediatricsContainer(); form.cmbContainer().setValue(alternativePaedContainer.getSpecContainer()); if (alternativePaedContainer.getVolume() != null && alternativePaedContainer.getVolume() == 0) { form.txtVol().setValue("N/A"); form.decVol().setValue((float)0); } else form.decVol().setValue(alternativePaedContainer.getVolume()); form.txtLabelSuffix().setValue(alternativePaedContainer.getLabelSuffix()); } updateControlState(); }
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); }