Package org.openmrs

Examples of org.openmrs.Program


      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)
View Full Code Here


     
      @SuppressWarnings("deprecation")
            @Override
            public Patient getPatient()  {
        Patient patient = Context.getPatientService().getPatient(2);
        Program program = Context.getProgramWorkflowService().getProgram(1);
       
        // as a sanity check, make sure the patient is currently enrolled in the program before we run the test
        Assert.assertTrue("Patient should be in program", Context.getProgramWorkflowService().isInProgram(patient, program, new Date(), null));
       
        return patient;
      };
       
      @Override
      public String[] widgetLabels() {
        return new String[] { "Date:", "Location:", "Provider:" };
      }
     
      @Override
      public void setupRequest(MockHttpServletRequest request, Map<String, String> widgets) {
        request.addParameter(widgets.get("Date:"), dateAsString(date));
        request.addParameter(widgets.get("Location:"), "2");
        request.addParameter(widgets.get("Provider:"), "502");
      }
     
      @SuppressWarnings("deprecation")
            @Override
            public void testResults(SubmissionResults results) {
        // do all the basic assertions to make sure the program was processed correctly
        results.assertNoErrors();
        results.assertEncounterCreated();
        results.assertProvider(502);
        results.assertLocation(2);
       
        // confirm that that patient is no longer in the program
        Patient patient = Context.getPatientService().getPatient(2);
        Program program = Context.getProgramWorkflowService().getProgram(1);
        Assert.assertFalse("Patient should no longer be in program", Context.getProgramWorkflowService().isInProgram(patient, program, new Date(), null));
       
        // but confirm that the patient was in the program in the past
        Assert.assertTrue("Patient should still be in program in the past", Context.getProgramWorkflowService().isInProgram(patient, program, null, new Date()))
       
View Full Code Here

        results.assertProvider(502);
        results.assertLocation(2);
       
        // confirm that that patient is no longer in the program
        Patient patient = Context.getPatientService().getPatient(2);
        Program program = Context.getProgramWorkflowService().getProgram(1);
        Assert.assertFalse("Patient should no longer be in program", Context.getProgramWorkflowService().isInProgram(patient, program, new Date(), null));
       
        // but confirm that the patient was in the program in the past
        Assert.assertTrue("Patient should still be in program in the past", Context.getProgramWorkflowService().isInProgram(patient, program, null, new Date()))
       
View Full Code Here

    {
      for(String prog: programIds)
    {
        if(prog != null && prog.trim().length() > 0)
        {
          Program personProgram = HtmlFormEntryUtil.getProgram(prog);
         
          if(personProgram != null)
          {
            Cohort pp = Context.getPatientSetService().getPatientsInProgram(personProgram, null, null);
            if(programMatches != null)
View Full Code Here

    if (!Program.class.isAssignableFrom(clazz)) {
      return value;
    }
   
    // see if this is a name reference to a program
    Program program = Context.getProgramWorkflowService().getProgramByName(value);
   
    // if we've found a match, return the uuid, otherwise do nothing
    if (program != null) {
      return program.getUuid();
    }
    else {
      return value;
    }
    }
View Full Code Here

    Assert.assertEquals(0, pws.getPatientPrograms(patient, pws.getProgram(programId), null, null, null, null, false)
            .size());
    //enroll the patient in a test program
    PatientProgram pp = new PatientProgram();
    pp.setPatient(patient);
    Program program = pws.getProgram(programId);
    pp.setProgram(pws.getProgram(programId));
    final ProgramWorkflow wf = program.getWorkflow(100);
    final Date initialEnrollmentDate = new Date();
    pp.setDateEnrolled(initialEnrollmentDate);
    pp.transitionToState(wf.getState(200), initialEnrollmentDate);
    pws.savePatientProgram(pp);
    final ProgramWorkflowState originalState = pp.getCurrentState(wf).getState();
View Full Code Here

                    continue;
                  }
                }
                // need to handle the special case where a program "name" is considered the "name" of the underlying concept
                if (Program.class.equals(attributeDescriptor.getClazz())) {
                  Program program = HtmlFormEntryUtil.getProgram(id);
                  if (program != null) {
                    dependencies.add(program);
                    continue;
                  }
                }
View Full Code Here

   * @should find a program by its uuid
   * @should return null otherwise
   */
  public static Program getProgram(String id) {
   
    Program program = null;
   
    if (id != null) {

            id = id.trim();

View Full Code Here

   */
  @Test
  @Verifies(value = "should return false if the patient is not enrolled in the program", method = "isEnrolledInProgram(Patient,Program,Date)")
  public void isEnrolledInProgram_shouldReturnFalseIfThePatientIsNotEnrolledInTheProgram() throws Exception {
    Patient patient = Context.getPatientService().getPatient(6);
    Program program = Context.getProgramWorkflowService().getProgram(1);
    Assert.assertFalse(HtmlFormEntryUtil.isEnrolledInProgramOnDate(patient, program, new Date()));
  }
View Full Code Here

   */
  @Test
  @Verifies(value = "should return true if the patient is enrolled in the program at the specified date", method = "isEnrolledInProgram(Patient,Program,Date)")
  public void isEnrolledInProgram_shouldReturnTrueIfThePatientIsEnrolledInTheProgramAtTheSpecifiedDate() throws Exception {
    Patient patient = Context.getPatientService().getPatient(2);
    Program program = Context.getProgramWorkflowService().getProgram(1);
    Assert.assertTrue(HtmlFormEntryUtil.isEnrolledInProgramOnDate(patient, program, new Date()));
  }
View Full Code Here

TOP

Related Classes of org.openmrs.Program

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.