Package org.openmrs

Examples of org.openmrs.Patient


      }
     
      @Override
      public Encounter getEncounterToView(){
        Encounter e = new Encounter();
        Patient p = Context.getPatientService().getPatient(2);
        e.setPatient(p);
        e.setEncounterDatetime(date);
        e.setProvider(Context.getPersonService().getPerson(502));
        e.setEncounterType(Context.getEncounterService().getEncounterType(1));
        e.setLocation(Context.getLocationService().getLocation(2));
View Full Code Here


      return new ArrayList<Obs>();
        }

        cannotBePreviewed();

        Patient p = session.getPatient();
    Concept concept = HtmlFormEntryUtil.getConcept(conceptId);

        if (p == null || concept == null) {
      return new ArrayList<Obs>();
        }
View Full Code Here

  private List<Encounter> getAllEncounters(EncounterType type) {
    if (session.getPatient() == null) {
      return new ArrayList<Encounter>();
    }
    cannotBePreviewed();
    Patient p = session.getPatient();
    if (p == null) {
      return new ArrayList<Encounter>();
    }
    else {
      if (type == null) {
View Full Code Here

    return getLogicService().eval(session.getPatient(), lc);
  }

  @SuppressWarnings("deprecation")
    public PatientState currentProgramWorkflowStatus(Integer programWorkflowId) {
    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,
View Full Code Here

     * @should  return the ageInMonths accurately to the nearest month
     */

    public Integer patientAgeInMonths() {

        Patient patient = session.getPatient();
        if(patient == null || patient.getBirthdate() == null){
          return null;     // if there is error in patient's data return age as null
        }
        Date birthdate = patient.getBirthdate();
        DateTime today = new DateTime();
        DateTime dob = new DateTime(birthdate.getTime());
        return Months.monthsBetween(dob.toDateMidnight(), today.toDateMidnight()).getMonths();
    }
View Full Code Here

     * @return   patient's age in days
     * @should  return the ageInDays accurately to the nearest date
     */
    public Integer patientAgeInDays(){

        Patient patient = session.getPatient();
        if(patient == null  || patient.getBirthdate() == null){
          return null;   // if there is error in patient's data return age as null
        }
        Date birthdate = patient.getBirthdate();
        DateTime today = new DateTime();
        DateTime dob = new DateTime(birthdate.getTime());
        return Days.daysBetween(dob.toDateMidnight(), today.toDateMidnight()).getDays();
    }
View Full Code Here

   * @see {@link HtmlFormEntryUtil#isEnrolledInProgramOnDate(Patient, Program, Date)}
   */
  @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 false if the program was completed", method = "isEnrolledInProgram(Patient,Program,Date)")
  public void isEnrolledInProgram_shouldReturnFalseIfTheProgramWasCompleted() throws Exception {
    ProgramWorkflowService pws = Context.getProgramWorkflowService();
    Patient patient = Context.getPatientService().getPatient(2);
   
    //for test purposes, lets set a program as complete
    PatientProgram pp = pws.getPatientProgram(1);
    Assert.assertSame(patient, pp.getPatient());
    pp.setDateCompleted(new Date());
View Full Code Here

   * @see {@link HtmlFormEntryUtil#isEnrolledInProgramOnDate(Patient,Program,Date)}
   */
  @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

  @Test
  @Verifies(value = "should return false if the date is before the existing patient program enrollment date", method = "isEnrolledInProgram(Patient,Program,Date)")
  public void isEnrolledInProgram_shouldReturnFalseIfTheDateIsBeforeTheExistingPatientProgramEnrollmentDateIgnoringTimeFields()
      throws Exception {//2008-08-01 00:00:00.0
    ProgramWorkflowService pws = Context.getProgramWorkflowService();
    Patient patient = Context.getPatientService().getPatient(2);
    Program program = pws.getProgram(1);
    PatientProgram pp = pws.getPatientProgram(1);
   
    Calendar cal = Calendar.getInstance();
    cal.set(2008, 6, 31);
View Full Code Here

TOP

Related Classes of org.openmrs.Patient

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.