Package org.openmrs

Examples of org.openmrs.PatientState


        results.assertLocation(2);
       
        // patient should now be in the middle state
        ProgramWorkflowState state = Context.getProgramWorkflowService().getStateByUuid(MIDDLE_STATE);
        PatientProgram patientProgram = getPatientProgramByState(results.getPatient(), state, DATE);
        PatientState patientState = getPatientState(patientProgram, state, DATE);
        Assert.assertNotNull(patientProgram);
        Assert.assertEquals(dateAsString(DATE), dateAsString(patientState.getStartDate()));
        Assert.assertNull(patientState.getEndDate());
      }
     
    }.run();
  }
View Full Code Here


                // double check that states have been set
                ProgramWorkflowState state = Context.getProgramWorkflowService().getStateByUuid(START_STATE);
                ProgramWorkflowState anotherState = Context.getProgramWorkflowService().getStateByUuid("67337cdc-53ad-11e1-8cb6-00248140a5eb");
                PatientProgram patientProgram = getPatientProgramByState(results.getPatient(), state, DATE);
                PatientState patientState = getPatientState(patientProgram, state, DATE);
                PatientState anotherPatientState = getPatientState(patientProgram, anotherState, DATE);

                Assert.assertNotNull(patientProgram);
                Assert.assertEquals(dateAsString(DATE), dateAsString(patientState.getStartDate()));
                Assert.assertEquals(dateAsString(DATE), dateAsString(patientProgram.getDateEnrolled()));
                Assert.assertEquals(dateAsString(DATE), dateAsString(anotherPatientState.getStartDate()));

            }
        }.run();
    }
View Full Code Here

                Assert.assertEquals(1, Context.getProgramWorkflowService().getPatientPrograms(patient, Context.getProgramWorkflowService().getProgram(10), null, null, null, null, false).size());

                // double check that state has been set
                ProgramWorkflowState state = Context.getProgramWorkflowService().getStateByUuid(START_STATE);
                PatientProgram patientProgram = getPatientProgramByState(results.getPatient(), state, DATE);
                PatientState patientState = getPatientState(patientProgram, state, DATE);

                Assert.assertNotNull(patientProgram);
                Assert.assertEquals(dateAsString(DATE), dateAsString(patientState.getStartDate()));
                Assert.assertEquals(dateAsString(PAST_DATE), dateAsString(patientProgram.getDateEnrolled()));
            }
        }.run();
    }
View Full Code Here

                Assert.assertEquals(1, Context.getProgramWorkflowService().getPatientPrograms(patient, Context.getProgramWorkflowService().getProgram(10), null, null, null, null, false).size());

                // double check that state has been set
                ProgramWorkflowState state = Context.getProgramWorkflowService().getStateByUuid(START_STATE);
                PatientProgram patientProgram = getPatientProgramByState(results.getPatient(), state, DATE);
                PatientState patientState = getPatientState(patientProgram, state, DATE);

                Assert.assertNotNull(patientProgram);
                Assert.assertEquals(dateAsString(DATE), dateAsString(patientState.getStartDate()));
                Assert.assertEquals(dateAsString(PAST_DATE), dateAsString(patientProgram.getDateEnrolled()));
            }
        }.run();
    }
View Full Code Here

            // let the states decide for uncompleted programs
            // (_should_ not be necessary, but that's life,
            // partially due
            // to ProgramLocation module, or Reopening of old
            // programs, or patient merge)
            PatientState mostRecentState = mostRecentPatientProgram.getCurrentState(workflow);
            PatientState ps = pp.getCurrentState(workflow);
            if (mostRecentState == null || ps == null) {
              // just do nothing
            } else if (mostRecentState.getEndDate() != null && ps.getEndDate() == null) {
              mostRecentPatientProgram = pp;
            } else if (ps.getStartDate().after(mostRecentState.getStartDate())) {
              mostRecentPatientProgram = pp;
            }
          }
        }
      }
    }
    if (mostRecentPatientProgram != null) {
      PatientState ps = mostRecentPatientProgram.getCurrentState(workflow);
      if (ps != null && ps.getState() != null && ps.getState().getConcept().getName() != null) {
        return ps;
      }
    }
    return null;
  }
View Full Code Here

TOP

Related Classes of org.openmrs.PatientState

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.