Package org.openmrs

Examples of org.openmrs.Encounter


        //Build a couple of encounters for the form
        List<Encounter> encounters = new ArrayList<Encounter>();
       
       
        //encounter1
        Encounter e = new Encounter();
        e.setPatient(Context.getPatientService().getPatient(2));
        Date date = Context.getDateFormat().parse("01/02/2003");
        e.setDateCreated(new Date());
        e.setEncounterDatetime(date);
        e.setLocation(Context.getLocationService().getLocation(2));
        e.setProvider(Context.getPersonService().getPerson(502));
        //top of form
        TestUtil.addObs(e, 3032, date, date);
        TestUtil.addObs(e, 1441, Context.getConceptService().getConcept(656), date);
        TestUtil.addObsGroup(e, 1004, date, 1005, Context.getConceptService().getConcept(1001), new Date());
        TestUtil.addObs(e, 1119, new Date(), date);
        TestUtil.addObs(e, 2474, Context.getConceptService().getConcept(767), date);
        //DST RESULT
        Obs dstParent = TestUtil.createObs(e, 3040, null, date);
        e.addObs(dstParent);
        Obs resultParent = TestUtil.createObs(e, 3025, null, date);
        dstParent.addGroupMember(resultParent);
        Obs drugResult = TestUtil.createObs(e, 3017, Context.getConceptService().getConcept(656), date);
        resultParent.addGroupMember(drugResult);
        Obs colonies1 = TestUtil.createObs(e, 3016, 200, date);
View Full Code Here


        //Build a couple of encounters for the form
        List<Encounter> encounters = new ArrayList<Encounter>();
       
       
        //encounter1
        Encounter e = new Encounter();
        e.setPatient(Context.getPatientService().getPatient(2));
        Date date = Context.getDateFormat().parse("01/02/2003");
        e.setDateCreated(new Date());
        e.setEncounterDatetime(date);
        e.setLocation(Context.getLocationService().getLocation(2));
        e.setProvider(Context.getPersonService().getPerson(502));
       
        Context.getEncounterService().saveEncounter(e);
        encounters.add(e);

        StringBuffer ret = HtmlFormEntryExportUtil.buildHtmlFormExport(encounters, htmlform, extraCols, new StringBuffer(""), new Locale("en"),pitList);
View Full Code Here

        //Build a couple of encounters for the form
        List<Encounter> encounters = new ArrayList<Encounter>();
       
       
        //encounter1
        Encounter e = new Encounter();
        e.setPatient(Context.getPatientService().getPatient(2));
        Date date = Context.getDateFormat().parse("01/02/2003");
        e.setDateCreated(new Date());
        e.setEncounterDatetime(date);
        e.setLocation(Context.getLocationService().getLocation(2));
        e.setProvider(Context.getPersonService().getPerson(502));
       
       
        TestUtil.addObs(e, 1119, date, date);
        TestUtil.addObs(e, 1007, date, date);
       
View Full Code Here

   * @verifies return the most recent encounter if encounter type is null
   */
  @Test
  public void latestEncounter_shouldReturnTheMostRecentEncounterByType() throws Exception {
    VelocityFunctions functions = setupFunctionsForPatient(7);
    Encounter latestEncounter = functions.latestEncounter("2");
        Assert.assertEquals(new Integer(3), latestEncounter.getEncounterId());
  }
View Full Code Here

    Assert.assertEquals(concept.getDisplayString (), functions.getConcept ("5089").getDisplayString ());
  }

    @Test
    public void getObs_shouldReturnObsWithGivenConcept() throws Exception {
        Encounter encounter = Context.getEncounterService().getEncounter(4);
        VelocityFunctions functions = setupFunctionsForPatient(7);

        assertThat(functions.getObs(encounter, "5089").getValueNumeric(), is(55d));
        assertThat(functions.getObs(encounter, "3"), nullValue());
    }
View Full Code Here

        assertThat(functions.getObs(encounter, "3"), nullValue());
    }

    @Test
    public void allObs_shouldReturnObsWithGivenConcept() throws Exception {
        Encounter encounter = Context.getEncounterService().getEncounter(4);
        VelocityFunctions functions = setupFunctionsForPatient(7);

        List<Obs> allObs = functions.allObs(encounter, "5089");
        assertThat(allObs.size(), is(1));
        assertThat(allObs.get(0).getValueNumeric(), is(55d));
View Full Code Here

     
      @Override
      public void testResults(SubmissionResults results) {
        results.assertNoErrors();
        results.assertEncounterCreated();
        Encounter e = results.getEncounterCreated();
       
        Set<Order> orders = e.getOrders();
       
        Drug drug = Context.getConceptService().getDrug(2);
        assertThat(orders, contains(allOf(hasProperty("drug", is(drug)), hasProperty("dose", is(1.0)),
          hasProperty("startDate", is(ymdToDate(dateAsString(date)))))));
      }
View Full Code Here

  public void standardRegimenToDrugOrders_shouldCreateDrugOrders() throws Exception {
    List<RegimenSuggestion> regList = Context.getOrderService().getStandardRegimens();
    Assert.assertTrue(regList.size() > 0);
   
    //Add regimens to an encounter:
    Encounter e = new Encounter();
    e.setPatient(Context.getPatientService().getPatient(2));
    Date date = new Date();
    e.setDateCreated(new Date());
    e.setEncounterDatetime(date);
    e.setLocation(Context.getLocationService().getLocation(2));
    e.setProvider(Context.getPersonService().getPerson(502));
   
    //And, add some drugOrders
    Patient p = Context.getPatientService().getPatient(2);
    Set<Order> dos = RegimenUtil.standardRegimenToDrugOrders(regList.get(0), new Date(), p);
    Assert.assertTrue(dos.size() == 2);
    for (Order o : dos)
      e.addOrder(o);
   
    //save the encounter
    e = Context.getEncounterService().saveEncounter(e);
    Integer encId = e.getId();
    Context.flushSession();
    Context.clearSession();
   
    //now retrieve it and make sure that there are two orders in the Encounter  (checks to ensure adequate values are set in creation of DrugOrder for not null constraints)
    Encounter enc = Context.getEncounterService().getEncounter(encId);
    Assert.assertTrue(enc.getOrders().size() == 2);
  }
View Full Code Here

    Integer encId = regimenTestBuildEncounterHelper("drug2and3");
    Context.flushSession();
    Context.clearSession();
   
    //Check to see that method returns drug2and3
    Encounter e = Context.getEncounterService().getEncounter(encId);
    List<Order> dors = new ArrayList<Order>();
    dors.addAll(e.getOrders());
    Map<RegimenSuggestion, List<DrugOrder>>  m = RegimenUtil.findStrongestStandardRegimenInDrugOrders(Context.getOrderService().getStandardRegimens(),dors);
    Assert.assertTrue(m.size() > 0);
    RegimenSuggestion rs = m.keySet().iterator().next();
    log.debug("findStrongestStandardRegimenInDrugOrders found standard regimen " + rs.getCodeName());
    Assert.assertTrue(rs.getCodeName().equals("drug2and3"));
View Full Code Here

    Integer encId = regimenTestBuildEncounterHelper("drug2only");
    Context.flushSession();
    Context.clearSession();
   
    //check to see that method returns drug2only
    Encounter e = Context.getEncounterService().getEncounter(encId);
    List<Order> dors = new ArrayList<Order>();
    dors.addAll(e.getOrders());
    Map<RegimenSuggestion, List<DrugOrder>>  m = RegimenUtil.findStrongestStandardRegimenInDrugOrders(Context.getOrderService().getStandardRegimens(),dors);
    Assert.assertTrue(m.size() > 0);
    RegimenSuggestion rs = m.keySet().iterator().next();
    log.debug("findStrongestStandardRegimenInDrugOrders found standard regimen " + rs.getCodeName());
    Assert.assertTrue(rs.getCodeName().equals("drug2only"));
View Full Code Here

TOP

Related Classes of org.openmrs.Encounter

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.