Java 类ims.ocrr.vo.PathInvDetailsVo 实例源码

项目:AvoinApotti    文件:Logic.java   
private String getInvestigationDisplayText(OrderInvestigationVo investigation, PathInvDetailsVo pathologyDetails)
{
    if (investigation == null || pathologyDetails == null)
        throw new CodingRuntimeException("Logical error - parameters can't be null");

    StringBuilder displayString = new StringBuilder();

    displayString.append(investigation.getInvestigation().getInvestigationIndex().getName());
    displayString.append(" - ");
    displayString.append(pathologyDetails.getSpecimens().get(0).getPaediatricContainers().get(0).getSpecContainer().getName());
    displayString.append(" (").append(pathologyDetails.getSpecimens().get(0).getPaediatricContainers().get(0).getVolume());
    displayString.append(" mls)");

    return displayString.toString();
}
项目:AvoinApotti    文件:Logic.java   
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;
}
项目:AvoinApotti    文件:MyOrderImpl.java   
public PathInvDetailsVo getPathInvDetailsForInvestigation(Integer idInvestigation)
{
    DomainFactory factory = getDomainFactory();

    List invDetails = factory.find("select inv.pathInvDetails from Investigation inv where inv.id = :idInv", new String[]{"idInv"}, new Object[]{idInvestigation});
    if (invDetails != null && invDetails.size() > 0)
        return PathInvDetailsVoAssembler.createPathInvDetailsVoCollectionFromPathInvDetails(invDetails).get(0);

    return null;
}
项目:openMAXIMS    文件:Logic.java   
private String getInvestigationDisplayText(OrderInvestigationVo investigation, PathInvDetailsVo pathologyDetails)
{
    if (investigation == null || pathologyDetails == null)
        throw new CodingRuntimeException("Logical error - parameters can't be null");

    StringBuilder displayString = new StringBuilder();

    displayString.append(investigation.getInvestigation().getInvestigationIndex().getName());
    displayString.append(" - ");
    displayString.append(pathologyDetails.getSpecimens().get(0).getPaediatricContainers().get(0).getSpecContainer().getName());
    displayString.append(" (").append(pathologyDetails.getSpecimens().get(0).getPaediatricContainers().get(0).getVolume());
    displayString.append(" mls)");

    return displayString.toString();
}
项目:openMAXIMS    文件:Logic.java   
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;
}
项目:openMAXIMS    文件:MyOrderImpl.java   
public PathInvDetailsVo getPathInvDetailsForInvestigation(Integer idInvestigation)
{
    DomainFactory factory = getDomainFactory();

    List invDetails = factory.find("select inv.pathInvDetails from Investigation inv where inv.id = :idInv", new String[]{"idInv"}, new Object[]{idInvestigation});
    if (invDetails != null && invDetails.size() > 0)
        return PathInvDetailsVoAssembler.createPathInvDetailsVoCollectionFromPathInvDetails(invDetails).get(0);

    return null;
}
项目:openMAXIMS    文件:Logic.java   
private String getInvestigationDisplayText(OrderInvestigationVo investigation, PathInvDetailsVo pathologyDetails)
{
    if (investigation == null || pathologyDetails == null)
        throw new CodingRuntimeException("Logical error - parameters can't be null");

    StringBuilder displayString = new StringBuilder();

    displayString.append(investigation.getInvestigation().getInvestigationIndex().getName());
    displayString.append(" - ");
    displayString.append(pathologyDetails.getSpecimens().get(0).getPaediatricContainers().get(0).getSpecContainer().getName());
    displayString.append(" (").append(pathologyDetails.getSpecimens().get(0).getPaediatricContainers().get(0).getVolume());
    displayString.append(" mls)");

    return displayString.toString();
}
项目:openMAXIMS    文件:Logic.java   
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;
}
项目:openMAXIMS    文件:MyOrderImpl.java   
public PathInvDetailsVo getPathInvDetailsForInvestigation(Integer idInvestigation)
{
    DomainFactory factory = getDomainFactory();

    List invDetails = factory.find("select inv.pathInvDetails from Investigation inv where inv.id = :idInv", new String[]{"idInv"}, new Object[]{idInvestigation});
    if (invDetails != null && invDetails.size() > 0)
        return PathInvDetailsVoAssembler.createPathInvDetailsVoCollectionFromPathInvDetails(invDetails).get(0);

    return null;
}
项目:openmaxims-linux    文件:Logic.java   
private String getInvestigationDisplayText(OrderInvestigationVo investigation, PathInvDetailsVo pathologyDetails)
{
    if (investigation == null || pathologyDetails == null)
        throw new CodingRuntimeException("Logical error - parameters can't be null");

    StringBuilder displayString = new StringBuilder();

    displayString.append(investigation.getInvestigation().getInvestigationIndex().getName());
    displayString.append(" - ");
    displayString.append(pathologyDetails.getSpecimens().get(0).getPaediatricContainers().get(0).getSpecContainer().getName());
    displayString.append(" (").append(pathologyDetails.getSpecimens().get(0).getPaediatricContainers().get(0).getVolume());
    displayString.append(" mls)");

    return displayString.toString();
}
项目:openmaxims-linux    文件:Logic.java   
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;
}
项目:openmaxims-linux    文件:MyOrderImpl.java   
public PathInvDetailsVo getPathInvDetailsForInvestigation(Integer idInvestigation)
{
    DomainFactory factory = getDomainFactory();

    List invDetails = factory.find("select inv.pathInvDetails from Investigation inv where inv.id = :idInv", new String[]{"idInv"}, new Object[]{idInvestigation});
    if (invDetails != null && invDetails.size() > 0)
        return PathInvDetailsVoAssembler.createPathInvDetailsVoCollectionFromPathInvDetails(invDetails).get(0);

    return null;
}
项目:AvoinApotti    文件:Logic.java   
@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);
    }
项目:AvoinApotti    文件:Logic.java   
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;
}
项目:AvoinApotti    文件:Logic.java   
/**
 * 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;
}
项目:AvoinApotti    文件:Logic.java   
/**
 * 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);
}
项目:AvoinApotti    文件:Logic.java   
/**
 * @param tRow
 * @param grid
 *            go through orderspecimen grid comparing discipline && specimenSource if found add row to the found row else instantiate new parent row and add to this
 */
private void modifyDynamicGridPhlebOrOther(grdTestRow tRow, DynamicGrid grid)
{
    OrderInvestigationVo voOrderInvestigation = tRow.getValue();

    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;
            modifyPhlebOrOtherRows(grid, voOrderInvestigation, tRow.getColSpecimen(), collRows.get(i).getColSiteHidden(), null, false, bProfileProcessed);
        }
    }
    else
    {
        // Clear OderSpecimen for OrderInvestigation
        voOrderInvestigation.setSpecimen(null);
        voOrderInvestigation.setCollectionType((SpecimenCollectionType) tRow.getColType().getValue());

        modifyPhlebOrOtherRows(grid, voOrderInvestigation, tRow.getColSpecimen(), 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();
                modifyPhlebOrOtherRows(grid, voOrderInvestigation, tRow.getColSpecimen(), site, addOnPathInvDetails, true, false);
            }
        }
    }

    grid.setSelectable(false);
    grid.setReadOnly(false);
}
项目:openMAXIMS    文件:Logic.java   
@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);
    }
项目:openMAXIMS    文件:Logic.java   
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;
}
项目:openMAXIMS    文件:Logic.java   
/**
 * 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;
}
项目:openMAXIMS    文件:Logic.java   
/**
 * 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);
}
项目:openMAXIMS    文件:Logic.java   
/**
 * @param tRow
 * @param grid
 *            go through orderspecimen grid comparing discipline && specimenSource if found add row to the found row else instantiate new parent row and add to this
 */
private void modifyDynamicGridPhlebOrOther(grdTestRow tRow, DynamicGrid grid)
{
    OrderInvestigationVo voOrderInvestigation = tRow.getValue();

    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;
            modifyPhlebOrOtherRows(grid, voOrderInvestigation, tRow.getColSpecimen(), collRows.get(i).getColSiteHidden(), null, false, bProfileProcessed);
        }
    }
    else
    {
        // Clear OderSpecimen for OrderInvestigation
        voOrderInvestigation.setSpecimen(null);
        voOrderInvestigation.setCollectionType((SpecimenCollectionType) tRow.getColType().getValue());

        modifyPhlebOrOtherRows(grid, voOrderInvestigation, tRow.getColSpecimen(), 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();
                modifyPhlebOrOtherRows(grid, voOrderInvestigation, tRow.getColSpecimen(), site, addOnPathInvDetails, true, false);
            }
        }
    }

    grid.setSelectable(false);
    grid.setReadOnly(false);
}
项目:openMAXIMS    文件:Logic.java   
@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);
    }
项目:openMAXIMS    文件:Logic.java   
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;
}
项目:openMAXIMS    文件:Logic.java   
/**
 * 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;
}
项目:openMAXIMS    文件:Logic.java   
/**
 * 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);
}
项目:openMAXIMS    文件:Logic.java   
/**
 * @param tRow
 * @param grid
 *            go through orderspecimen grid comparing discipline && specimenSource if found add row to the found row else instantiate new parent row and add to this
 */
private void modifyDynamicGridPhlebOrOther(grdTestRow tRow, DynamicGrid grid)
{
    OrderInvestigationVo voOrderInvestigation = tRow.getValue();

    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;
            modifyPhlebOrOtherRows(grid, voOrderInvestigation, tRow.getColSpecimen(), collRows.get(i).getColSiteHidden(), null, false, bProfileProcessed);
        }
    }
    else
    {
        // Clear OderSpecimen for OrderInvestigation
        voOrderInvestigation.setSpecimen(null);
        voOrderInvestigation.setCollectionType((SpecimenCollectionType) tRow.getColType().getValue());

        modifyPhlebOrOtherRows(grid, voOrderInvestigation, tRow.getColSpecimen(), 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();
                modifyPhlebOrOtherRows(grid, voOrderInvestigation, tRow.getColSpecimen(), site, addOnPathInvDetails, true, false);
            }
        }
    }

    grid.setSelectable(false);
    grid.setReadOnly(false);
}
项目:openmaxims-linux    文件:Logic.java   
@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);
    }
项目:openmaxims-linux    文件:Logic.java   
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;
}
项目:openmaxims-linux    文件:Logic.java   
/**
 * 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;
}
项目:openmaxims-linux    文件:Logic.java   
/**
 * 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);
}
项目:openmaxims-linux    文件:Logic.java   
/**
 * @param tRow
 * @param grid
 *            go through orderspecimen grid comparing discipline && specimenSource if found add row to the found row else instantiate new parent row and add to this
 */
private void modifyDynamicGridPhlebOrOther(grdTestRow tRow, DynamicGrid grid)
{
    OrderInvestigationVo voOrderInvestigation = tRow.getValue();

    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;
            modifyPhlebOrOtherRows(grid, voOrderInvestigation, tRow.getColSpecimen(), collRows.get(i).getColSiteHidden(), null, false, bProfileProcessed);
        }
    }
    else
    {
        // Clear OderSpecimen for OrderInvestigation
        voOrderInvestigation.setSpecimen(null);
        voOrderInvestigation.setCollectionType((SpecimenCollectionType) tRow.getColType().getValue());

        modifyPhlebOrOtherRows(grid, voOrderInvestigation, tRow.getColSpecimen(), 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();
                modifyPhlebOrOtherRows(grid, voOrderInvestigation, tRow.getColSpecimen(), site, addOnPathInvDetails, true, false);
            }
        }
    }

    grid.setSelectable(false);
    grid.setReadOnly(false);
}