Package org.openmrs

Examples of org.openmrs.Cohort


          personList.add(PersonListItem.createBestMatch(p));
        }
      }
    }
   
    Cohort cohort = null;
    if(searchAttribute != null)
    {
      String[] attributes = searchAttribute.split(",");
      String[] attrValues = null;
      if(attributeValue != null)
      {
        attrValues = searchAttribute.split(",");
      }
     
      for(int i = 0; i < attributes.length; i++)
      {
        String attr = attributes[i];
        String val = null;
        if(attrValues != null && attrValues[i].trim().length() > 0)
        {
          val = attrValues[i];
        }
        if(attr != null && attr.trim().length() > 0)
        {
          List<Integer> ids = Context.getService(HtmlFormEntryService.class).getPersonIdsHavingAttributes(attr, val);
          Set<Integer> setOfIds = new HashSet<Integer>();
          setOfIds.addAll(ids);
         
          Cohort pp = new Cohort();
          pp.setMemberIds(setOfIds);
       
          if(cohort != null)
          {
            cohort = Cohort.intersect(cohort, pp);
          }
          else
          {
            cohort = pp;
          }
        }
      }
    }
   
    if(searchProgram != null)
    {
      String[] programs = searchProgram.split(",");
     
      for(int i = 0; i < programs.length; i++)
      {
        String prog = programs[i];
        if(prog != null && prog.trim().length() > 0)
        {
          Program personProgram = Context.getProgramWorkflowService().getProgramByUuid(prog);
          if(personProgram == null)
          {
            personProgram = Context.getProgramWorkflowService().getProgram(Integer.parseInt(prog));
          }
          if(personProgram != null)
          {
            Cohort pp = Context.getPatientSetService().getPatientsInProgram(personProgram, null, null);
            if(cohort != null)
            {
              cohort = Cohort.intersect(cohort, pp);
            }
            else
View Full Code Here


        {
          Program personProgram = HtmlFormEntryUtil.getProgram(prog);
         
          if(personProgram != null)
          {
            Cohort pp = Context.getPatientSetService().getPatientsInProgram(personProgram, null, null);
            if(programMatches != null)
            {
              programMatches.retainAll(pp.getMemberIds());
            }
            else
            {
              programMatches = pp.getMemberIds();
            }
          }
        }
      }
    }
View Full Code Here

TOP

Related Classes of org.openmrs.Cohort

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.