Package org.openmrs

Examples of org.openmrs.ProgramWorkflow


        Assert.assertEquals(ymdToDate(dateAsString(enrollmentDate)), ymdToDate(dateAsString(pps.get(0)
                .getDateEnrolled())));
       
        //the initial states should have been set for the 2 workflows in the form
        Assert.assertEquals(2, pps.get(0).getCurrentStates().size());
        ProgramWorkflow wf1 = pws.getWorkflowByUuid("67337cdc-53ad-11e1-8cb6-00248140a5eb");
        ProgramWorkflow wf2 = pws.getWorkflowByUuid("6de7ed10-53ad-11e1-8cb6-00248140a5eb");
        Assert.assertNotNull(pps.get(0).getCurrentState(wf1).getState());
        Assert.assertEquals(ymdToDate(dateAsString(enrollmentDate)), ymdToDate(dateAsString(pps.get(0).getCurrentState(wf1).getStartDate())));
        Assert.assertNotNull(pps.get(0).getCurrentState(wf2).getState());
        Assert.assertEquals(ymdToDate(dateAsString(enrollmentDate)), ymdToDate(dateAsString(pps.get(0).getCurrentState(wf2).getStartDate())));
      };
View Full Code Here


    //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();
    final Integer patientProgramId = pp.getId();
    final Date completionDate = pp.getDateCompleted();
   
View Full Code Here

                  }
                }
                // need to handle the special case where a program workflow is specified by a concept map pointing to it's underlying concept
                // note that we shouldn't have to handle program workflow states because they should always be picked up when sharing the overriding program and/or program workflow
                if (ProgramWorkflow.class.equals(attributeDescriptor.getClazz())) {
                  ProgramWorkflow workflow = HtmlFormEntryUtil.getWorkflow(id);
                  if (workflow != null) {
                    dependencies.add(workflow);
                  }
                }
                // need to special case of the name of a role
View Full Code Here

        results.assertEncounterCreated();
        results.assertProvider(502);
        results.assertLocation(2);
       
        // make sure the enrollment date has NOT been changed (since no state was set)
        ProgramWorkflow workflow = Context.getProgramWorkflowService().getWorkflow(100);
        Assert.assertEquals(1, Context.getProgramWorkflowService().getPatientPrograms(patient, workflow.getProgram(), null, null, null, null, false).size());
        PatientProgram patientProgram = Context.getProgramWorkflowService().getPatientPrograms(patient, workflow.getProgram(), null, null, null, null, false).get(0);
        Assert.assertNotNull(patientProgram)
        Assert.assertEquals(dateAsString(DATE), dateAsString(patientProgram.getDateEnrolled()));
       
        // assert that no states have been associated
        Assert.assertEquals(0, patientProgram.getStates().size());
View Full Code Here

        results.assertNoErrors();
       
        ProgramWorkflowState state = Context.getProgramWorkflowService().getStateByUuid(START_STATE);
       
        // we should now have two program enrollments, one on PAST_DATE and one on DATE
        ProgramWorkflow workflow = Context.getProgramWorkflowService().getWorkflow(100);
        Assert.assertEquals(2, Context.getProgramWorkflowService().getPatientPrograms(patient, workflow.getProgram(), null, null, null, null, false).size());
       
        // now verify that new state is correct
        PatientProgram patientProgram = getPatientProgramByState(results.getPatient(), state, PAST_DATE);
        Assert.assertNotNull(patientProgram);
        Assert.assertEquals(dateAsString(PAST_DATE), dateAsString(patientProgram.getDateEnrolled()));
View Full Code Here

     
      @SuppressWarnings("deprecation")
            public void testEditedResults(SubmissionResults results) {
        results.assertNoErrors();
       
        ProgramWorkflow workflow = Context.getProgramWorkflowService().getWorkflow(100);
       
        ProgramWorkflowState startState = Context.getProgramWorkflowService().getStateByUuid(START_STATE);
        ProgramWorkflowState middleState = Context.getProgramWorkflowService().getStateByUuid(MIDDLE_STATE);
        ProgramWorkflowState endState = Context.getProgramWorkflowService().getStateByUuid(END_STATE);
       
        PatientProgram patientProgram = Context.getProgramWorkflowService().getPatientPrograms(patient, workflow.getProgram(), null, null, null, null, false).get(0);
        Assert.assertNotNull(patientProgram);
       
        // assert that the patient program only has two states
        Assert.assertEquals(2, patientProgram.statesInWorkflow(workflow, false).size());
       
View Full Code Here

     
      @SuppressWarnings("deprecation")
            public void testEditedResults(SubmissionResults results) {
        results.assertNoErrors();
       
        ProgramWorkflow workflow = Context.getProgramWorkflowService().getWorkflow(100);
       
        ProgramWorkflowState startState = Context.getProgramWorkflowService().getStateByUuid(START_STATE);
        ProgramWorkflowState endState = Context.getProgramWorkflowService().getStateByUuid(END_STATE);
       
        PatientProgram patientProgram = Context.getProgramWorkflowService().getPatientPrograms(patient, workflow.getProgram(), null, null, null, null, false).get(0);
        Assert.assertNotNull(patientProgram);
       
        // assert that the patient program only has two states
        Assert.assertEquals(2, patientProgram.statesInWorkflow(workflow, false).size());
       
View Full Code Here

  /**
   * Looks up a {@link ProgramWorkflow} by id, uuid or by concept map of the underlying concept
   */
  @SuppressWarnings("deprecation")
  public static ProgramWorkflow getWorkflow(String identifier) {
    ProgramWorkflow workflow = null;
   
    if (identifier != null) {

            identifier = identifier.trim();

View Full Code Here

    Patient p = session.getPatient();
    if (p == null || p.getId() == null) {
      return null;
    }
    cannotBePreviewed();
    ProgramWorkflow workflow = getProgramWorkflowService().getWorkflow(programWorkflowId); // not sure if and how I want to reference the UUID
    List<PatientProgram> pps = getProgramWorkflowService().getPatientPrograms(p, workflow.getProgram(), null, null,
        null, null, false);
    PatientProgram mostRecentPatientProgram = null;
    for (PatientProgram pp : pps) {
      // try to figure out which program enrollment is active or the most
      // recent one; guess this would better fit somewhere in the
View Full Code Here

TOP

Related Classes of org.openmrs.ProgramWorkflow

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.