Java 类ims.core.vo.CSPrimaryDiagnosisVo 实例源码

项目:AvoinApotti    文件:Logic.java   
private CSPrimaryDiagnosisVo getPrimaryDiagnosisRecord(PatientDiagnosisEDischargeVo voPatDiagnosis)
{
    if (voPatDiagnosis == null || voPatDiagnosis.getPrimaryForCareSpells() == null)
        return null;

    CSPrimaryDiagnosisVoCollection voColl = voPatDiagnosis.getPrimaryForCareSpells();
    for (int i = 0; voColl != null && i < voColl.size(); i++)
    {
        boolean sameDiagnosis = voColl.get(i).getDiagnosisIsNotNull() && voColl.get(i).getDiagnosis().equals(voPatDiagnosis);
        boolean sameCareContext = voColl.get(i).getCareContextIsNotNull() && voColl.get(i).getCareContext().equals(form.getGlobalContext().Core.getCurrentCareContext());

        if (sameDiagnosis && sameCareContext)
            return voColl.get(i);
    }

    return null;
}
项目:AvoinApotti    文件:Logic.java   
private void setCsPrimaryDiagnosis(PatientDiagnosisEDischargeVo voPatDiagnosis, boolean isChkPrimaryChecked)
{
    CSPrimaryDiagnosisVo voCSPrimaryDiagnosis = getPrimaryDiagnosisRecord(voPatDiagnosis);
    if (voCSPrimaryDiagnosis != null || isChkPrimaryChecked)
    {
        if (voCSPrimaryDiagnosis == null)
        {
            voCSPrimaryDiagnosis = populatePrimaryDiagnosisDataFromScreen(new CSPrimaryDiagnosisVo(), voPatDiagnosis, isChkPrimaryChecked);
            if (voPatDiagnosis.getPrimaryForCareSpells() == null)
                voPatDiagnosis.setPrimaryForCareSpells(new CSPrimaryDiagnosisVoCollection());
            voPatDiagnosis.getPrimaryForCareSpells().add(voCSPrimaryDiagnosis);
        }
        else
        {
            int index = voPatDiagnosis.getPrimaryForCareSpells().indexOf(voCSPrimaryDiagnosis);
            if (index >= 0)
            {
                voCSPrimaryDiagnosis = populatePrimaryDiagnosisDataFromScreen(voCSPrimaryDiagnosis, voPatDiagnosis, isChkPrimaryChecked);
                voPatDiagnosis.getPrimaryForCareSpells().set(index, voCSPrimaryDiagnosis);
            }
        }
    }
}
项目:AvoinApotti    文件:Logic.java   
private CSPrimaryDiagnosisVo getPrimaryDiagnosisRecord(PatientDiagnosisEDischargeVo voPatDiagnosis)
{
    if (voPatDiagnosis == null || voPatDiagnosis.getPrimaryForCareSpells() == null)
        return null;

    CSPrimaryDiagnosisVoCollection voColl = voPatDiagnosis.getPrimaryForCareSpells();
    for (int i = 0; voColl != null && i < voColl.size(); i++)
    {
        boolean sameDiagnosis = voColl.get(i).getDiagnosisIsNotNull() && voColl.get(i).getDiagnosis().equals(voPatDiagnosis);
        boolean sameCareContext = voColl.get(i).getCareContextIsNotNull() && voColl.get(i).getCareContext().equals(form.getGlobalContext().Core.getCurrentCareContext());

        if (sameDiagnosis && sameCareContext)
            return voColl.get(i);
    }

    return null;
}
项目:AvoinApotti    文件:Logic.java   
private void setCsPrimaryDiagnosis(PatientDiagnosisEDischargeVo voPatDiagnosis, boolean isChkPrimaryChecked, boolean bDiagnosisContainer)
{
    CSPrimaryDiagnosisVo voCSPrimaryDiagnosis = getPrimaryDiagnosisRecord(voPatDiagnosis);
    if (voCSPrimaryDiagnosis != null || isChkPrimaryChecked)
    {
        if (voCSPrimaryDiagnosis == null)
        {
            voCSPrimaryDiagnosis = populatePrimaryDiagnosisDataFromScreen(new CSPrimaryDiagnosisVo(), voPatDiagnosis, isChkPrimaryChecked, bDiagnosisContainer);
            if (voPatDiagnosis.getPrimaryForCareSpells() == null)
                voPatDiagnosis.setPrimaryForCareSpells(new CSPrimaryDiagnosisVoCollection());
            voPatDiagnosis.getPrimaryForCareSpells().add(voCSPrimaryDiagnosis);
        }
        else
        {
            int index = voPatDiagnosis.getPrimaryForCareSpells().indexOf(voCSPrimaryDiagnosis);
            if (index >= 0)
            {
                voCSPrimaryDiagnosis = populatePrimaryDiagnosisDataFromScreen(voCSPrimaryDiagnosis, voPatDiagnosis, isChkPrimaryChecked, bDiagnosisContainer);
                voPatDiagnosis.getPrimaryForCareSpells().set(index, voCSPrimaryDiagnosis);
            }
        }
    }
}
项目:AvoinApotti    文件:Logic.java   
private boolean isPrimaryDiagnosisRecord(PatientDiagnosisOpNotesVo voPatDiagnosis)
{
    if (voPatDiagnosis == null || voPatDiagnosis.getPrimaryForCareSpells() == null)
        return false;

    CSPrimaryDiagnosisVoCollection voColl = voPatDiagnosis.getPrimaryForCareSpells();
    for (int i = 0; voColl != null && i < voColl.size(); i++)
    {
        CSPrimaryDiagnosisVo primaryDiagnosisVo = voColl.get(i);
        boolean sameDiagnosis = primaryDiagnosisVo.getDiagnosisIsNotNull() && primaryDiagnosisVo.getDiagnosis().equals(voPatDiagnosis);
        boolean sameCareContext = primaryDiagnosisVo.getCareContextIsNotNull() && primaryDiagnosisVo.getCareContext().equals(form.getGlobalContext().Core.getCurrentCareContext());

        if (sameDiagnosis && sameCareContext && primaryDiagnosisVo.getIsActiveIsNotNull() && primaryDiagnosisVo.getIsActive())
            return true;
    }

    return false;
}
项目:AvoinApotti    文件:Logic.java   
private void setCsPrimaryDiagnosis(PatientDiagnosisVo voPatDiagnosis, boolean isChkPrimaryChecked)
{
    CSPrimaryDiagnosisVo voCSPrimaryDiagnosis = getPrimaryDiagnosisRecord(voPatDiagnosis);
    if (voCSPrimaryDiagnosis != null || isChkPrimaryChecked)
    {
        if (voCSPrimaryDiagnosis == null)
        {
            voCSPrimaryDiagnosis = populatePrimaryDiagnosisDataFromScreen(new CSPrimaryDiagnosisVo(), voPatDiagnosis, isChkPrimaryChecked);
            if (voPatDiagnosis.getPrimaryForCareSpells() == null)
                voPatDiagnosis.setPrimaryForCareSpells(new CSPrimaryDiagnosisVoCollection());
            voPatDiagnosis.getPrimaryForCareSpells().add(voCSPrimaryDiagnosis);
        }
        else
        {
            int index = voPatDiagnosis.getPrimaryForCareSpells().indexOf(voCSPrimaryDiagnosis);
            if (index >= 0)
            {
                voCSPrimaryDiagnosis = populatePrimaryDiagnosisDataFromScreen(voCSPrimaryDiagnosis, voPatDiagnosis, isChkPrimaryChecked);
                voPatDiagnosis.getPrimaryForCareSpells().set(index, voCSPrimaryDiagnosis);
            }
        }
    }
}
项目:AvoinApotti    文件:Logic.java   
private boolean isPrimaryDiagnosisActive(PatientDiagnosisRefVo voPatDiagRef, CSPrimaryDiagnosisVoCollection voColl)
{
    for (int i = 0; i < voColl.size(); i++)
    {
        CSPrimaryDiagnosisVo primary = voColl.get(i);

        boolean isActive = primary.getIsActiveIsNotNull() && primary.getIsActive().booleanValue();
        boolean sameDiagnosis = primary.getDiagnosisIsNotNull() && primary.getDiagnosis().equals(voPatDiagRef);

        // WDEV-11693 - Also check for EpisodeOfCare - as now PatientDiagnosis & CSPrimaryDiagnosis are recorded at this level
        boolean sameEpisodeOfCare = primary.getEpisodeOfCareIsNotNull() && primary.getEpisodeOfCare().equals(form.getGlobalContext().Core.getEpisodeofCareShort());
        boolean sameCareContext = (primary.getCareContextIsNotNull() && primary.getCareContext().equals(form.getGlobalContext().Core.getCurrentCareContext()))
                                    || (!form.getGlobalContext().Core.getCurrentCareContextIsNotNull() && !primary.getCareContextIsNotNull());

        if (isActive && sameDiagnosis && sameEpisodeOfCare && sameCareContext)
            return true;
    }
    return false;
}
项目:AvoinApotti    文件:Logic.java   
private CSPrimaryDiagnosisVo getPrimaryDiagnosisRecord(PatientDiagnosisVo voPatDiagnosis)
{
    if (voPatDiagnosis == null || voPatDiagnosis.getPrimaryForCareSpells() == null)
        return null;

    CSPrimaryDiagnosisVoCollection voColl = voPatDiagnosis.getPrimaryForCareSpells();
    for (int i = 0; voColl != null && i < voColl.size(); i++)
    {
        boolean sameDiagnosis = voColl.get(i).getDiagnosisIsNotNull() && voColl.get(i).getDiagnosis().equals(voPatDiagnosis);

        // WDEV-11693 - Also check for EpisodeOfCare - as now PatientDiagnosis & CSPrimaryDiagnosis are recorded at this level
        boolean sameEpisodeOfCare = voColl.get(i).getEpisodeOfCareIsNotNull() && voColl.get(i).getEpisodeOfCare().equals(form.getGlobalContext().Core.getEpisodeofCareShort());
        boolean sameCareContext = (voColl.get(i).getCareContextIsNotNull() && voColl.get(i).getCareContext().equals(form.getGlobalContext().Core.getCurrentCareContext()))
                                    || (!form.getGlobalContext().Core.getCurrentCareContextIsNotNull() && !voColl.get(i).getCareContextIsNotNull());

        if (sameDiagnosis && sameEpisodeOfCare && sameCareContext)
            return voColl.get(i);
    }

    return null;
}
项目:AvoinApotti    文件:Logic.java   
private void setCsPrimaryDiagnosis(PatientDiagnosisOpNotesVo voPatDiagnosis, boolean isChkPrimaryChecked)
{
    CSPrimaryDiagnosisVo voCSPrimaryDiagnosis = getPrimaryDiagnosisRecord(voPatDiagnosis);
    if (voCSPrimaryDiagnosis != null || isChkPrimaryChecked)
    {
        if (voCSPrimaryDiagnosis == null)
        {
            voCSPrimaryDiagnosis = populatePrimaryDiagnosisDataFromScreen(new CSPrimaryDiagnosisVo(), voPatDiagnosis, isChkPrimaryChecked);
            if (voPatDiagnosis.getPrimaryForCareSpells() == null)
                voPatDiagnosis.setPrimaryForCareSpells(new CSPrimaryDiagnosisVoCollection());
            voPatDiagnosis.getPrimaryForCareSpells().add(voCSPrimaryDiagnosis);
        }
        else
        {
            int index = voPatDiagnosis.getPrimaryForCareSpells().indexOf(voCSPrimaryDiagnosis);
            if (index >= 0)
            {
                voCSPrimaryDiagnosis = populatePrimaryDiagnosisDataFromScreen(voCSPrimaryDiagnosis, voPatDiagnosis, isChkPrimaryChecked);
                voPatDiagnosis.getPrimaryForCareSpells().set(index, voCSPrimaryDiagnosis);
            }
        }
    }
}
项目:AvoinApotti    文件:Logic.java   
private CSPrimaryDiagnosisVo getPrimaryDiagnosisRecord(PatientDiagnosisOpNotesVo voPatDiagnosis)
{
    if (voPatDiagnosis == null || voPatDiagnosis.getPrimaryForCareSpells() == null)
        return null;

    CSPrimaryDiagnosisVoCollection voColl = voPatDiagnosis.getPrimaryForCareSpells();
    for (int i = 0; voColl != null && i < voColl.size(); i++)
    {
        boolean sameDiagnosis = voColl.get(i).getDiagnosisIsNotNull() && voColl.get(i).getDiagnosis().equals(voPatDiagnosis);
        boolean sameCareContext = voColl.get(i).getCareContextIsNotNull() && voColl.get(i).getCareContext().equals(form.getGlobalContext().Core.getCurrentCareContext());

        if (sameDiagnosis && sameCareContext)
            return voColl.get(i);
    }

    return null;
}
项目:openMAXIMS    文件:Logic.java   
private CSPrimaryDiagnosisVo getPrimaryDiagnosisRecord(PatientDiagnosisEDischargeVo voPatDiagnosis)
{
    if (voPatDiagnosis == null || voPatDiagnosis.getPrimaryForCareSpells() == null)
        return null;

    CSPrimaryDiagnosisVoCollection voColl = voPatDiagnosis.getPrimaryForCareSpells();
    for (int i = 0; voColl != null && i < voColl.size(); i++)
    {
        boolean sameDiagnosis = voColl.get(i).getDiagnosisIsNotNull() && voColl.get(i).getDiagnosis().equals(voPatDiagnosis);
        boolean sameCareContext = voColl.get(i).getCareContextIsNotNull() && voColl.get(i).getCareContext().equals(form.getGlobalContext().Core.getCurrentCareContext());

        if (sameDiagnosis && sameCareContext)
            return voColl.get(i);
    }

    return null;
}
项目:openMAXIMS    文件:Logic.java   
private void setCsPrimaryDiagnosis(PatientDiagnosisEDischargeVo voPatDiagnosis, boolean isChkPrimaryChecked)
{
    CSPrimaryDiagnosisVo voCSPrimaryDiagnosis = getPrimaryDiagnosisRecord(voPatDiagnosis);
    if (voCSPrimaryDiagnosis != null || isChkPrimaryChecked)
    {
        if (voCSPrimaryDiagnosis == null)
        {
            voCSPrimaryDiagnosis = populatePrimaryDiagnosisDataFromScreen(new CSPrimaryDiagnosisVo(), voPatDiagnosis, isChkPrimaryChecked);
            if (voPatDiagnosis.getPrimaryForCareSpells() == null)
                voPatDiagnosis.setPrimaryForCareSpells(new CSPrimaryDiagnosisVoCollection());
            voPatDiagnosis.getPrimaryForCareSpells().add(voCSPrimaryDiagnosis);
        }
        else
        {
            int index = voPatDiagnosis.getPrimaryForCareSpells().indexOf(voCSPrimaryDiagnosis);
            if (index >= 0)
            {
                voCSPrimaryDiagnosis = populatePrimaryDiagnosisDataFromScreen(voCSPrimaryDiagnosis, voPatDiagnosis, isChkPrimaryChecked);
                voPatDiagnosis.getPrimaryForCareSpells().set(index, voCSPrimaryDiagnosis);
            }
        }
    }
}
项目:openMAXIMS    文件:Logic.java   
private CSPrimaryDiagnosisVo getPrimaryDiagnosisRecord(PatientDiagnosisEDischargeListVo voPatDiagnosis)
{
    if (voPatDiagnosis == null || voPatDiagnosis.getPrimaryForCareSpells() == null)
        return null;

    CSPrimaryDiagnosisVoCollection voColl = voPatDiagnosis.getPrimaryForCareSpells();
    for (int i = 0; voColl != null && i < voColl.size(); i++)
    {
        boolean sameDiagnosis = voColl.get(i).getDiagnosisIsNotNull() && voColl.get(i).getDiagnosis().equals(voPatDiagnosis);
        boolean sameCareContext = voColl.get(i).getCareContextIsNotNull() && voColl.get(i).getCareContext().equals(form.getGlobalContext().Core.getCurrentCareContext());

        if (sameDiagnosis && sameCareContext)
            return voColl.get(i);
    }

    return null;
}
项目:openMAXIMS    文件:Logic.java   
private void setCsPrimaryDiagnosis(PatientDiagnosisEDischargeListVo voPatDiagnosis, boolean isChkPrimaryChecked, boolean bDiagnosisContainer)
{
    CSPrimaryDiagnosisVo voCSPrimaryDiagnosis = getPrimaryDiagnosisRecord(voPatDiagnosis);
    if (voCSPrimaryDiagnosis != null || isChkPrimaryChecked)
    {
        if (voCSPrimaryDiagnosis == null)
        {
            voCSPrimaryDiagnosis = populatePrimaryDiagnosisDataFromScreen(new CSPrimaryDiagnosisVo(), voPatDiagnosis, isChkPrimaryChecked, bDiagnosisContainer);
            if (voPatDiagnosis.getPrimaryForCareSpells() == null)
                voPatDiagnosis.setPrimaryForCareSpells(new CSPrimaryDiagnosisVoCollection());
            voPatDiagnosis.getPrimaryForCareSpells().add(voCSPrimaryDiagnosis);
        }
        else
        {
            int index = voPatDiagnosis.getPrimaryForCareSpells().indexOf(voCSPrimaryDiagnosis);
            if (index >= 0)
            {
                voCSPrimaryDiagnosis = populatePrimaryDiagnosisDataFromScreen(voCSPrimaryDiagnosis, voPatDiagnosis, isChkPrimaryChecked, bDiagnosisContainer);
                voPatDiagnosis.getPrimaryForCareSpells().set(index, voCSPrimaryDiagnosis);
            }
        }
    }
}
项目:openMAXIMS    文件:Logic.java   
private boolean isPrimaryDiagnosisRecord(PatientDiagnosisOpNotesVo voPatDiagnosis)
{
    if (voPatDiagnosis == null || voPatDiagnosis.getPrimaryForCareSpells() == null)
        return false;

    CSPrimaryDiagnosisVoCollection voColl = voPatDiagnosis.getPrimaryForCareSpells();
    for (int i = 0; voColl != null && i < voColl.size(); i++)
    {
        CSPrimaryDiagnosisVo primaryDiagnosisVo = voColl.get(i);
        boolean sameDiagnosis = primaryDiagnosisVo.getDiagnosisIsNotNull() && primaryDiagnosisVo.getDiagnosis().equals(voPatDiagnosis);
        boolean sameCareContext = primaryDiagnosisVo.getCareContextIsNotNull() && primaryDiagnosisVo.getCareContext().equals(form.getGlobalContext().Core.getCurrentCareContext());

        if (sameDiagnosis && sameCareContext && primaryDiagnosisVo.getIsActiveIsNotNull() && primaryDiagnosisVo.getIsActive())
            return true;
    }

    return false;
}
项目:openMAXIMS    文件:Logic.java   
private void setCsPrimaryDiagnosis(PatientDiagnosisVo voPatDiagnosis, boolean isChkPrimaryChecked)
{
    CSPrimaryDiagnosisVo voCSPrimaryDiagnosis = getPrimaryDiagnosisRecord(voPatDiagnosis);
    if (voCSPrimaryDiagnosis != null || isChkPrimaryChecked)
    {
        if (voCSPrimaryDiagnosis == null)
        {
            voCSPrimaryDiagnosis = populatePrimaryDiagnosisDataFromScreen(new CSPrimaryDiagnosisVo(), voPatDiagnosis, isChkPrimaryChecked);
            if (voPatDiagnosis.getPrimaryForCareSpells() == null)
                voPatDiagnosis.setPrimaryForCareSpells(new CSPrimaryDiagnosisVoCollection());
            voPatDiagnosis.getPrimaryForCareSpells().add(voCSPrimaryDiagnosis);
        }
        else
        {
            int index = voPatDiagnosis.getPrimaryForCareSpells().indexOf(voCSPrimaryDiagnosis);
            if (index >= 0)
            {
                voCSPrimaryDiagnosis = populatePrimaryDiagnosisDataFromScreen(voCSPrimaryDiagnosis, voPatDiagnosis, isChkPrimaryChecked);
                voPatDiagnosis.getPrimaryForCareSpells().set(index, voCSPrimaryDiagnosis);
            }
        }
    }
}
项目:openMAXIMS    文件:Logic.java   
private boolean isPrimaryDiagnosisActive(PatientDiagnosisRefVo voPatDiagRef, CSPrimaryDiagnosisVoCollection voColl)
{
    for (int i = 0; i < voColl.size(); i++)
    {
        CSPrimaryDiagnosisVo primary = voColl.get(i);

        boolean isActive = primary.getIsActiveIsNotNull() && primary.getIsActive().booleanValue();
        boolean sameDiagnosis = primary.getDiagnosisIsNotNull() && primary.getDiagnosis().equals(voPatDiagRef);

        // WDEV-11693 - Also check for EpisodeOfCare - as now PatientDiagnosis & CSPrimaryDiagnosis are recorded at this level
        boolean sameEpisodeOfCare = primary.getEpisodeOfCareIsNotNull() && primary.getEpisodeOfCare().equals(form.getGlobalContext().Core.getEpisodeofCareShort());
        boolean sameCareContext = (primary.getCareContextIsNotNull() && primary.getCareContext().equals(form.getGlobalContext().Core.getCurrentCareContext()))
                                    || (!form.getGlobalContext().Core.getCurrentCareContextIsNotNull() && !primary.getCareContextIsNotNull());

        if (isActive && sameDiagnosis && sameEpisodeOfCare && sameCareContext)
            return true;
    }
    return false;
}
项目:openMAXIMS    文件:Logic.java   
private CSPrimaryDiagnosisVo getPrimaryDiagnosisRecord(PatientDiagnosisVo voPatDiagnosis)
{
    if (voPatDiagnosis == null || voPatDiagnosis.getPrimaryForCareSpells() == null)
        return null;

    CSPrimaryDiagnosisVoCollection voColl = voPatDiagnosis.getPrimaryForCareSpells();
    for (int i = 0; voColl != null && i < voColl.size(); i++)
    {
        boolean sameDiagnosis = voColl.get(i).getDiagnosisIsNotNull() && voColl.get(i).getDiagnosis().equals(voPatDiagnosis);

        // WDEV-11693 - Also check for EpisodeOfCare - as now PatientDiagnosis & CSPrimaryDiagnosis are recorded at this level
        boolean sameEpisodeOfCare = voColl.get(i).getEpisodeOfCareIsNotNull() && voColl.get(i).getEpisodeOfCare().equals(form.getGlobalContext().Core.getEpisodeofCareShort());
        boolean sameCareContext = (voColl.get(i).getCareContextIsNotNull() && voColl.get(i).getCareContext().equals(form.getGlobalContext().Core.getCurrentCareContext()))
                                    || (!form.getGlobalContext().Core.getCurrentCareContextIsNotNull() && !voColl.get(i).getCareContextIsNotNull());

        if (sameDiagnosis && sameEpisodeOfCare && sameCareContext)
            return voColl.get(i);
    }

    return null;
}
项目:openMAXIMS    文件:Logic.java   
private void setCsPrimaryDiagnosis(PatientDiagnosisOpNotesVo voPatDiagnosis, boolean isChkPrimaryChecked)
{
    CSPrimaryDiagnosisVo voCSPrimaryDiagnosis = getPrimaryDiagnosisRecord(voPatDiagnosis);
    if (voCSPrimaryDiagnosis != null || isChkPrimaryChecked)
    {
        if (voCSPrimaryDiagnosis == null)
        {
            voCSPrimaryDiagnosis = populatePrimaryDiagnosisDataFromScreen(new CSPrimaryDiagnosisVo(), voPatDiagnosis, isChkPrimaryChecked);
            if (voPatDiagnosis.getPrimaryForCareSpells() == null)
                voPatDiagnosis.setPrimaryForCareSpells(new CSPrimaryDiagnosisVoCollection());
            voPatDiagnosis.getPrimaryForCareSpells().add(voCSPrimaryDiagnosis);
        }
        else
        {
            int index = voPatDiagnosis.getPrimaryForCareSpells().indexOf(voCSPrimaryDiagnosis);
            if (index >= 0)
            {
                voCSPrimaryDiagnosis = populatePrimaryDiagnosisDataFromScreen(voCSPrimaryDiagnosis, voPatDiagnosis, isChkPrimaryChecked);
                voPatDiagnosis.getPrimaryForCareSpells().set(index, voCSPrimaryDiagnosis);
            }
        }
    }
}
项目:openMAXIMS    文件:Logic.java   
private CSPrimaryDiagnosisVo getPrimaryDiagnosisRecord(PatientDiagnosisOpNotesVo voPatDiagnosis)
{
    if (voPatDiagnosis == null || voPatDiagnosis.getPrimaryForCareSpells() == null)
        return null;

    CSPrimaryDiagnosisVoCollection voColl = voPatDiagnosis.getPrimaryForCareSpells();
    for (int i = 0; voColl != null && i < voColl.size(); i++)
    {
        boolean sameDiagnosis = voColl.get(i).getDiagnosisIsNotNull() && voColl.get(i).getDiagnosis().equals(voPatDiagnosis);
        boolean sameCareContext = voColl.get(i).getCareContextIsNotNull() && voColl.get(i).getCareContext().equals(form.getGlobalContext().Core.getCurrentCareContext());

        if (sameDiagnosis && sameCareContext)
            return voColl.get(i);
    }

    return null;
}
项目:openMAXIMS    文件:Logic.java   
private CSPrimaryDiagnosisVo getPrimaryDiagnosisRecord(PatientDiagnosisEDischargeVo voPatDiagnosis)
{
    if (voPatDiagnosis == null || voPatDiagnosis.getPrimaryForCareSpells() == null)
        return null;

    CSPrimaryDiagnosisVoCollection voColl = voPatDiagnosis.getPrimaryForCareSpells();
    for (int i = 0; voColl != null && i < voColl.size(); i++)
    {
        boolean sameDiagnosis = voColl.get(i).getDiagnosisIsNotNull() && voColl.get(i).getDiagnosis().equals(voPatDiagnosis);
        boolean sameCareContext = voColl.get(i).getCareContextIsNotNull() && voColl.get(i).getCareContext().equals(form.getGlobalContext().Core.getCurrentCareContext());

        if (sameDiagnosis && sameCareContext)
            return voColl.get(i);
    }

    return null;
}
项目:openMAXIMS    文件:Logic.java   
private void setCsPrimaryDiagnosis(PatientDiagnosisEDischargeVo voPatDiagnosis, boolean isChkPrimaryChecked)
{
    CSPrimaryDiagnosisVo voCSPrimaryDiagnosis = getPrimaryDiagnosisRecord(voPatDiagnosis);
    if (voCSPrimaryDiagnosis != null || isChkPrimaryChecked)
    {
        if (voCSPrimaryDiagnosis == null)
        {
            voCSPrimaryDiagnosis = populatePrimaryDiagnosisDataFromScreen(new CSPrimaryDiagnosisVo(), voPatDiagnosis, isChkPrimaryChecked);
            if (voPatDiagnosis.getPrimaryForCareSpells() == null)
                voPatDiagnosis.setPrimaryForCareSpells(new CSPrimaryDiagnosisVoCollection());
            voPatDiagnosis.getPrimaryForCareSpells().add(voCSPrimaryDiagnosis);
        }
        else
        {
            int index = voPatDiagnosis.getPrimaryForCareSpells().indexOf(voCSPrimaryDiagnosis);
            if (index >= 0)
            {
                voCSPrimaryDiagnosis = populatePrimaryDiagnosisDataFromScreen(voCSPrimaryDiagnosis, voPatDiagnosis, isChkPrimaryChecked);
                voPatDiagnosis.getPrimaryForCareSpells().set(index, voCSPrimaryDiagnosis);
            }
        }
    }
}
项目:openMAXIMS    文件:Logic.java   
private CSPrimaryDiagnosisVo getPrimaryDiagnosisRecord(PatientDiagnosisEDischargeVo voPatDiagnosis)
{
    if (voPatDiagnosis == null || voPatDiagnosis.getPrimaryForCareSpells() == null)
        return null;

    CSPrimaryDiagnosisVoCollection voColl = voPatDiagnosis.getPrimaryForCareSpells();
    for (int i = 0; voColl != null && i < voColl.size(); i++)
    {
        boolean sameDiagnosis = voColl.get(i).getDiagnosisIsNotNull() && voColl.get(i).getDiagnosis().equals(voPatDiagnosis);
        boolean sameCareContext = voColl.get(i).getCareContextIsNotNull() && voColl.get(i).getCareContext().equals(form.getGlobalContext().Core.getCurrentCareContext());

        if (sameDiagnosis && sameCareContext)
            return voColl.get(i);
    }

    return null;
}
项目:openMAXIMS    文件:Logic.java   
private void setCsPrimaryDiagnosis(PatientDiagnosisEDischargeVo voPatDiagnosis, boolean isChkPrimaryChecked, boolean bDiagnosisContainer)
{
    CSPrimaryDiagnosisVo voCSPrimaryDiagnosis = getPrimaryDiagnosisRecord(voPatDiagnosis);
    if (voCSPrimaryDiagnosis != null || isChkPrimaryChecked)
    {
        if (voCSPrimaryDiagnosis == null)
        {
            voCSPrimaryDiagnosis = populatePrimaryDiagnosisDataFromScreen(new CSPrimaryDiagnosisVo(), voPatDiagnosis, isChkPrimaryChecked, bDiagnosisContainer);
            if (voPatDiagnosis.getPrimaryForCareSpells() == null)
                voPatDiagnosis.setPrimaryForCareSpells(new CSPrimaryDiagnosisVoCollection());
            voPatDiagnosis.getPrimaryForCareSpells().add(voCSPrimaryDiagnosis);
        }
        else
        {
            int index = voPatDiagnosis.getPrimaryForCareSpells().indexOf(voCSPrimaryDiagnosis);
            if (index >= 0)
            {
                voCSPrimaryDiagnosis = populatePrimaryDiagnosisDataFromScreen(voCSPrimaryDiagnosis, voPatDiagnosis, isChkPrimaryChecked, bDiagnosisContainer);
                voPatDiagnosis.getPrimaryForCareSpells().set(index, voCSPrimaryDiagnosis);
            }
        }
    }
}
项目:openMAXIMS    文件:Logic.java   
private boolean isPrimaryDiagnosisRecord(PatientDiagnosisOpNotesVo voPatDiagnosis)
{
    if (voPatDiagnosis == null || voPatDiagnosis.getPrimaryForCareSpells() == null)
        return false;

    CSPrimaryDiagnosisVoCollection voColl = voPatDiagnosis.getPrimaryForCareSpells();
    for (int i = 0; voColl != null && i < voColl.size(); i++)
    {
        CSPrimaryDiagnosisVo primaryDiagnosisVo = voColl.get(i);
        boolean sameDiagnosis = primaryDiagnosisVo.getDiagnosisIsNotNull() && primaryDiagnosisVo.getDiagnosis().equals(voPatDiagnosis);
        boolean sameCareContext = primaryDiagnosisVo.getCareContextIsNotNull() && primaryDiagnosisVo.getCareContext().equals(form.getGlobalContext().Core.getCurrentCareContext());

        if (sameDiagnosis && sameCareContext && primaryDiagnosisVo.getIsActiveIsNotNull() && primaryDiagnosisVo.getIsActive())
            return true;
    }

    return false;
}
项目:openMAXIMS    文件:Logic.java   
private void setCsPrimaryDiagnosis(PatientDiagnosisVo voPatDiagnosis, boolean isChkPrimaryChecked)
{
    CSPrimaryDiagnosisVo voCSPrimaryDiagnosis = getPrimaryDiagnosisRecord(voPatDiagnosis);
    if (voCSPrimaryDiagnosis != null || isChkPrimaryChecked)
    {
        if (voCSPrimaryDiagnosis == null)
        {
            voCSPrimaryDiagnosis = populatePrimaryDiagnosisDataFromScreen(new CSPrimaryDiagnosisVo(), voPatDiagnosis, isChkPrimaryChecked);
            if (voPatDiagnosis.getPrimaryForCareSpells() == null)
                voPatDiagnosis.setPrimaryForCareSpells(new CSPrimaryDiagnosisVoCollection());
            voPatDiagnosis.getPrimaryForCareSpells().add(voCSPrimaryDiagnosis);
        }
        else
        {
            int index = voPatDiagnosis.getPrimaryForCareSpells().indexOf(voCSPrimaryDiagnosis);
            if (index >= 0)
            {
                voCSPrimaryDiagnosis = populatePrimaryDiagnosisDataFromScreen(voCSPrimaryDiagnosis, voPatDiagnosis, isChkPrimaryChecked);
                voPatDiagnosis.getPrimaryForCareSpells().set(index, voCSPrimaryDiagnosis);
            }
        }
    }
}
项目:openMAXIMS    文件:Logic.java   
private boolean isPrimaryDiagnosisActive(PatientDiagnosisRefVo voPatDiagRef, CSPrimaryDiagnosisVoCollection voColl)
{
    for (int i = 0; i < voColl.size(); i++)
    {
        CSPrimaryDiagnosisVo primary = voColl.get(i);

        boolean isActive = primary.getIsActiveIsNotNull() && primary.getIsActive().booleanValue();
        boolean sameDiagnosis = primary.getDiagnosisIsNotNull() && primary.getDiagnosis().equals(voPatDiagRef);

        // WDEV-11693 - Also check for EpisodeOfCare - as now PatientDiagnosis & CSPrimaryDiagnosis are recorded at this level
        boolean sameEpisodeOfCare = primary.getEpisodeOfCareIsNotNull() && primary.getEpisodeOfCare().equals(form.getGlobalContext().Core.getEpisodeofCareShort());
        boolean sameCareContext = (primary.getCareContextIsNotNull() && primary.getCareContext().equals(form.getGlobalContext().Core.getCurrentCareContext()))
                                    || (!form.getGlobalContext().Core.getCurrentCareContextIsNotNull() && !primary.getCareContextIsNotNull());

        if (isActive && sameDiagnosis && sameEpisodeOfCare && sameCareContext)
            return true;
    }
    return false;
}
项目:openMAXIMS    文件:Logic.java   
private CSPrimaryDiagnosisVo getPrimaryDiagnosisRecord(PatientDiagnosisVo voPatDiagnosis)
{
    if (voPatDiagnosis == null || voPatDiagnosis.getPrimaryForCareSpells() == null)
        return null;

    CSPrimaryDiagnosisVoCollection voColl = voPatDiagnosis.getPrimaryForCareSpells();
    for (int i = 0; voColl != null && i < voColl.size(); i++)
    {
        boolean sameDiagnosis = voColl.get(i).getDiagnosisIsNotNull() && voColl.get(i).getDiagnosis().equals(voPatDiagnosis);

        // WDEV-11693 - Also check for EpisodeOfCare - as now PatientDiagnosis & CSPrimaryDiagnosis are recorded at this level
        boolean sameEpisodeOfCare = voColl.get(i).getEpisodeOfCareIsNotNull() && voColl.get(i).getEpisodeOfCare().equals(form.getGlobalContext().Core.getEpisodeofCareShort());
        boolean sameCareContext = (voColl.get(i).getCareContextIsNotNull() && voColl.get(i).getCareContext().equals(form.getGlobalContext().Core.getCurrentCareContext()))
                                    || (!form.getGlobalContext().Core.getCurrentCareContextIsNotNull() && !voColl.get(i).getCareContextIsNotNull());

        if (sameDiagnosis && sameEpisodeOfCare && sameCareContext)
            return voColl.get(i);
    }

    return null;
}
项目:openMAXIMS    文件:Logic.java   
private void setCsPrimaryDiagnosis(PatientDiagnosisOpNotesVo voPatDiagnosis, boolean isChkPrimaryChecked)
{
    CSPrimaryDiagnosisVo voCSPrimaryDiagnosis = getPrimaryDiagnosisRecord(voPatDiagnosis);
    if (voCSPrimaryDiagnosis != null || isChkPrimaryChecked)
    {
        if (voCSPrimaryDiagnosis == null)
        {
            voCSPrimaryDiagnosis = populatePrimaryDiagnosisDataFromScreen(new CSPrimaryDiagnosisVo(), voPatDiagnosis, isChkPrimaryChecked);
            if (voPatDiagnosis.getPrimaryForCareSpells() == null)
                voPatDiagnosis.setPrimaryForCareSpells(new CSPrimaryDiagnosisVoCollection());
            voPatDiagnosis.getPrimaryForCareSpells().add(voCSPrimaryDiagnosis);
        }
        else
        {
            int index = voPatDiagnosis.getPrimaryForCareSpells().indexOf(voCSPrimaryDiagnosis);
            if (index >= 0)
            {
                voCSPrimaryDiagnosis = populatePrimaryDiagnosisDataFromScreen(voCSPrimaryDiagnosis, voPatDiagnosis, isChkPrimaryChecked);
                voPatDiagnosis.getPrimaryForCareSpells().set(index, voCSPrimaryDiagnosis);
            }
        }
    }
}
项目:openMAXIMS    文件:Logic.java   
private CSPrimaryDiagnosisVo getPrimaryDiagnosisRecord(PatientDiagnosisOpNotesVo voPatDiagnosis)
{
    if (voPatDiagnosis == null || voPatDiagnosis.getPrimaryForCareSpells() == null)
        return null;

    CSPrimaryDiagnosisVoCollection voColl = voPatDiagnosis.getPrimaryForCareSpells();
    for (int i = 0; voColl != null && i < voColl.size(); i++)
    {
        boolean sameDiagnosis = voColl.get(i).getDiagnosisIsNotNull() && voColl.get(i).getDiagnosis().equals(voPatDiagnosis);
        boolean sameCareContext = voColl.get(i).getCareContextIsNotNull() && voColl.get(i).getCareContext().equals(form.getGlobalContext().Core.getCurrentCareContext());

        if (sameDiagnosis && sameCareContext)
            return voColl.get(i);
    }

    return null;
}
项目:openmaxims-linux    文件:Logic.java   
private CSPrimaryDiagnosisVo getPrimaryDiagnosisRecord(PatientDiagnosisEDischargeVo voPatDiagnosis)
{
    if (voPatDiagnosis == null || voPatDiagnosis.getPrimaryForCareSpells() == null)
        return null;

    CSPrimaryDiagnosisVoCollection voColl = voPatDiagnosis.getPrimaryForCareSpells();
    for (int i = 0; voColl != null && i < voColl.size(); i++)
    {
        boolean sameDiagnosis = voColl.get(i).getDiagnosisIsNotNull() && voColl.get(i).getDiagnosis().equals(voPatDiagnosis);
        boolean sameCareContext = voColl.get(i).getCareContextIsNotNull() && voColl.get(i).getCareContext().equals(form.getGlobalContext().Core.getCurrentCareContext());

        if (sameDiagnosis && sameCareContext)
            return voColl.get(i);
    }

    return null;
}
项目:openmaxims-linux    文件:Logic.java   
private void setCsPrimaryDiagnosis(PatientDiagnosisEDischargeVo voPatDiagnosis, boolean isChkPrimaryChecked)
{
    CSPrimaryDiagnosisVo voCSPrimaryDiagnosis = getPrimaryDiagnosisRecord(voPatDiagnosis);
    if (voCSPrimaryDiagnosis != null || isChkPrimaryChecked)
    {
        if (voCSPrimaryDiagnosis == null)
        {
            voCSPrimaryDiagnosis = populatePrimaryDiagnosisDataFromScreen(new CSPrimaryDiagnosisVo(), voPatDiagnosis, isChkPrimaryChecked);
            if (voPatDiagnosis.getPrimaryForCareSpells() == null)
                voPatDiagnosis.setPrimaryForCareSpells(new CSPrimaryDiagnosisVoCollection());
            voPatDiagnosis.getPrimaryForCareSpells().add(voCSPrimaryDiagnosis);
        }
        else
        {
            int index = voPatDiagnosis.getPrimaryForCareSpells().indexOf(voCSPrimaryDiagnosis);
            if (index >= 0)
            {
                voCSPrimaryDiagnosis = populatePrimaryDiagnosisDataFromScreen(voCSPrimaryDiagnosis, voPatDiagnosis, isChkPrimaryChecked);
                voPatDiagnosis.getPrimaryForCareSpells().set(index, voCSPrimaryDiagnosis);
            }
        }
    }
}
项目:openmaxims-linux    文件:Logic.java   
private CSPrimaryDiagnosisVo getPrimaryDiagnosisRecord(PatientDiagnosisEDischargeVo voPatDiagnosis)
{
    if (voPatDiagnosis == null || voPatDiagnosis.getPrimaryForCareSpells() == null)
        return null;

    CSPrimaryDiagnosisVoCollection voColl = voPatDiagnosis.getPrimaryForCareSpells();
    for (int i = 0; voColl != null && i < voColl.size(); i++)
    {
        boolean sameDiagnosis = voColl.get(i).getDiagnosisIsNotNull() && voColl.get(i).getDiagnosis().equals(voPatDiagnosis);
        boolean sameCareContext = voColl.get(i).getCareContextIsNotNull() && voColl.get(i).getCareContext().equals(form.getGlobalContext().Core.getCurrentCareContext());

        if (sameDiagnosis && sameCareContext)
            return voColl.get(i);
    }

    return null;
}
项目:openmaxims-linux    文件:Logic.java   
private void setCsPrimaryDiagnosis(PatientDiagnosisEDischargeVo voPatDiagnosis, boolean isChkPrimaryChecked, boolean bDiagnosisContainer)
{
    CSPrimaryDiagnosisVo voCSPrimaryDiagnosis = getPrimaryDiagnosisRecord(voPatDiagnosis);
    if (voCSPrimaryDiagnosis != null || isChkPrimaryChecked)
    {
        if (voCSPrimaryDiagnosis == null)
        {
            voCSPrimaryDiagnosis = populatePrimaryDiagnosisDataFromScreen(new CSPrimaryDiagnosisVo(), voPatDiagnosis, isChkPrimaryChecked, bDiagnosisContainer);
            if (voPatDiagnosis.getPrimaryForCareSpells() == null)
                voPatDiagnosis.setPrimaryForCareSpells(new CSPrimaryDiagnosisVoCollection());
            voPatDiagnosis.getPrimaryForCareSpells().add(voCSPrimaryDiagnosis);
        }
        else
        {
            int index = voPatDiagnosis.getPrimaryForCareSpells().indexOf(voCSPrimaryDiagnosis);
            if (index >= 0)
            {
                voCSPrimaryDiagnosis = populatePrimaryDiagnosisDataFromScreen(voCSPrimaryDiagnosis, voPatDiagnosis, isChkPrimaryChecked, bDiagnosisContainer);
                voPatDiagnosis.getPrimaryForCareSpells().set(index, voCSPrimaryDiagnosis);
            }
        }
    }
}
项目:openmaxims-linux    文件:Logic.java   
private boolean isPrimaryDiagnosisRecord(PatientDiagnosisOpNotesVo voPatDiagnosis)
{
    if (voPatDiagnosis == null || voPatDiagnosis.getPrimaryForCareSpells() == null)
        return false;

    CSPrimaryDiagnosisVoCollection voColl = voPatDiagnosis.getPrimaryForCareSpells();
    for (int i = 0; voColl != null && i < voColl.size(); i++)
    {
        CSPrimaryDiagnosisVo primaryDiagnosisVo = voColl.get(i);
        boolean sameDiagnosis = primaryDiagnosisVo.getDiagnosisIsNotNull() && primaryDiagnosisVo.getDiagnosis().equals(voPatDiagnosis);
        boolean sameCareContext = primaryDiagnosisVo.getCareContextIsNotNull() && primaryDiagnosisVo.getCareContext().equals(form.getGlobalContext().Core.getCurrentCareContext());

        if (sameDiagnosis && sameCareContext && primaryDiagnosisVo.getIsActiveIsNotNull() && primaryDiagnosisVo.getIsActive())
            return true;
    }

    return false;
}
项目:openmaxims-linux    文件:Logic.java   
private void setCsPrimaryDiagnosis(PatientDiagnosisVo voPatDiagnosis, boolean isChkPrimaryChecked)
{
    CSPrimaryDiagnosisVo voCSPrimaryDiagnosis = getPrimaryDiagnosisRecord(voPatDiagnosis);
    if (voCSPrimaryDiagnosis != null || isChkPrimaryChecked)
    {
        if (voCSPrimaryDiagnosis == null)
        {
            voCSPrimaryDiagnosis = populatePrimaryDiagnosisDataFromScreen(new CSPrimaryDiagnosisVo(), voPatDiagnosis, isChkPrimaryChecked);
            if (voPatDiagnosis.getPrimaryForCareSpells() == null)
                voPatDiagnosis.setPrimaryForCareSpells(new CSPrimaryDiagnosisVoCollection());
            voPatDiagnosis.getPrimaryForCareSpells().add(voCSPrimaryDiagnosis);
        }
        else
        {
            int index = voPatDiagnosis.getPrimaryForCareSpells().indexOf(voCSPrimaryDiagnosis);
            if (index >= 0)
            {
                voCSPrimaryDiagnosis = populatePrimaryDiagnosisDataFromScreen(voCSPrimaryDiagnosis, voPatDiagnosis, isChkPrimaryChecked);
                voPatDiagnosis.getPrimaryForCareSpells().set(index, voCSPrimaryDiagnosis);
            }
        }
    }
}
项目:openmaxims-linux    文件:Logic.java   
private boolean isPrimaryDiagnosisActive(PatientDiagnosisRefVo voPatDiagRef, CSPrimaryDiagnosisVoCollection voColl)
{
    for (int i = 0; i < voColl.size(); i++)
    {
        CSPrimaryDiagnosisVo primary = voColl.get(i);

        boolean isActive = primary.getIsActiveIsNotNull() && primary.getIsActive().booleanValue();
        boolean sameDiagnosis = primary.getDiagnosisIsNotNull() && primary.getDiagnosis().equals(voPatDiagRef);

        // WDEV-11693 - Also check for EpisodeOfCare - as now PatientDiagnosis & CSPrimaryDiagnosis are recorded at this level
        boolean sameEpisodeOfCare = primary.getEpisodeOfCareIsNotNull() && primary.getEpisodeOfCare().equals(form.getGlobalContext().Core.getEpisodeofCareShort());
        boolean sameCareContext = (primary.getCareContextIsNotNull() && primary.getCareContext().equals(form.getGlobalContext().Core.getCurrentCareContext()))
                                    || (!form.getGlobalContext().Core.getCurrentCareContextIsNotNull() && !primary.getCareContextIsNotNull());

        if (isActive && sameDiagnosis && sameEpisodeOfCare && sameCareContext)
            return true;
    }
    return false;
}
项目:openmaxims-linux    文件:Logic.java   
private CSPrimaryDiagnosisVo getPrimaryDiagnosisRecord(PatientDiagnosisVo voPatDiagnosis)
{
    if (voPatDiagnosis == null || voPatDiagnosis.getPrimaryForCareSpells() == null)
        return null;

    CSPrimaryDiagnosisVoCollection voColl = voPatDiagnosis.getPrimaryForCareSpells();
    for (int i = 0; voColl != null && i < voColl.size(); i++)
    {
        boolean sameDiagnosis = voColl.get(i).getDiagnosisIsNotNull() && voColl.get(i).getDiagnosis().equals(voPatDiagnosis);

        // WDEV-11693 - Also check for EpisodeOfCare - as now PatientDiagnosis & CSPrimaryDiagnosis are recorded at this level
        boolean sameEpisodeOfCare = voColl.get(i).getEpisodeOfCareIsNotNull() && voColl.get(i).getEpisodeOfCare().equals(form.getGlobalContext().Core.getEpisodeofCareShort());
        boolean sameCareContext = (voColl.get(i).getCareContextIsNotNull() && voColl.get(i).getCareContext().equals(form.getGlobalContext().Core.getCurrentCareContext()))
                                    || (!form.getGlobalContext().Core.getCurrentCareContextIsNotNull() && !voColl.get(i).getCareContextIsNotNull());

        if (sameDiagnosis && sameEpisodeOfCare && sameCareContext)
            return voColl.get(i);
    }

    return null;
}
项目:openmaxims-linux    文件:Logic.java   
private void setCsPrimaryDiagnosis(PatientDiagnosisOpNotesVo voPatDiagnosis, boolean isChkPrimaryChecked)
{
    CSPrimaryDiagnosisVo voCSPrimaryDiagnosis = getPrimaryDiagnosisRecord(voPatDiagnosis);
    if (voCSPrimaryDiagnosis != null || isChkPrimaryChecked)
    {
        if (voCSPrimaryDiagnosis == null)
        {
            voCSPrimaryDiagnosis = populatePrimaryDiagnosisDataFromScreen(new CSPrimaryDiagnosisVo(), voPatDiagnosis, isChkPrimaryChecked);
            if (voPatDiagnosis.getPrimaryForCareSpells() == null)
                voPatDiagnosis.setPrimaryForCareSpells(new CSPrimaryDiagnosisVoCollection());
            voPatDiagnosis.getPrimaryForCareSpells().add(voCSPrimaryDiagnosis);
        }
        else
        {
            int index = voPatDiagnosis.getPrimaryForCareSpells().indexOf(voCSPrimaryDiagnosis);
            if (index >= 0)
            {
                voCSPrimaryDiagnosis = populatePrimaryDiagnosisDataFromScreen(voCSPrimaryDiagnosis, voPatDiagnosis, isChkPrimaryChecked);
                voPatDiagnosis.getPrimaryForCareSpells().set(index, voCSPrimaryDiagnosis);
            }
        }
    }
}
项目:openmaxims-linux    文件:Logic.java   
private CSPrimaryDiagnosisVo getPrimaryDiagnosisRecord(PatientDiagnosisOpNotesVo voPatDiagnosis)
{
    if (voPatDiagnosis == null || voPatDiagnosis.getPrimaryForCareSpells() == null)
        return null;

    CSPrimaryDiagnosisVoCollection voColl = voPatDiagnosis.getPrimaryForCareSpells();
    for (int i = 0; voColl != null && i < voColl.size(); i++)
    {
        boolean sameDiagnosis = voColl.get(i).getDiagnosisIsNotNull() && voColl.get(i).getDiagnosis().equals(voPatDiagnosis);
        boolean sameCareContext = voColl.get(i).getCareContextIsNotNull() && voColl.get(i).getCareContext().equals(form.getGlobalContext().Core.getCurrentCareContext());

        if (sameDiagnosis && sameCareContext)
            return voColl.get(i);
    }

    return null;
}