Package org.openmrs

Examples of org.openmrs.Encounter


    Integer encId = regimenTestBuildEncounterHelper("all3");
    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("all3"));
View Full Code Here


    Integer encId = regimenTestBuildEncounterHelper("all3");
    Context.flushSession();
    Context.clearSession();
   
    //update orders to have different start dates
    Encounter e = Context.getEncounterService().getEncounter(encId);
    int aDay = 1000*60*60*24;
    int counter = 1;
    for (Order dor : e.getOrders()){
      dor.setStartDate(new Date((dor.getStartDate().getTime()) - (aDay * counter)));
      counter ++;
      log.debug("drugOrder now has start date " + dor.getStartDate());
    }
    Context.getEncounterService().saveEncounter(e);
    Context.flushSession();
    Context.clearSession();
   
    //check to see that method returns drug2only
    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

  private static Integer regimenTestBuildEncounterHelper(String code){
    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(RegimenUtil.getStandardRegimenByCode(regList, code), new Date(), p);
    for (Order o : dos)
      e.addOrder(o);
   
    //save the encounter
    e = Context.getEncounterService().saveEncounter(e);
    return e.getId();
  }
View Full Code Here

        return "simplestForm";
      }

      @Override
      public Encounter getEncounterToView() throws Exception {
        Encounter e = new Encounter();
        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));
        return e;
      }

      @Override
      public void testViewingEncounter(Encounter encounter, String html) {
View Full Code Here

        return "singleObsForm";
      }

      @Override
      public Encounter getEncounterToView() throws Exception {
        Encounter e = new Encounter();
        e.setPatient(getPatient());
        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, 2, 12.3, null); // weight has conceptId 2
        return e;
      }

      @Override
View Full Code Here

        return "singleObsForm";
      }

      @Override
      public Encounter getEncounterToView() throws Exception {
        Encounter e = new Encounter();
        e.setPatient(getPatient());
        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, 1, 965.0, null); // this is a CD4 Count
        return e;
      }

      @Override
View Full Code Here

        return "obsGroupsWithCodedValuesForm";
      }

      @Override
      public Encounter getEncounterToView() throws Exception {
        Encounter e = new Encounter();
        e.setPatient(getPatient());
        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));

        // create three obsgroups with the identical structures but with different answer values for the ALLERGY CODED obs
        TestUtil.addObsGroup(e, 7, new Date(), 1000, Context.getConceptService().getConcept(1001), new Date(), 1119,
            date, new Date());
        TestUtil.addObsGroup(e, 7, new Date(), 1000, Context.getConceptService().getConcept(1002), new Date(), 1119,
View Full Code Here

        return "obsGroupsWithMultipleAnswerConceptIds";
      }

      @Override
      public Encounter getEncounterToView() throws Exception {
        Encounter e = new Encounter();
        e.setPatient(getPatient());
        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.addObsGroup(e, 7, new Date(),
            1000, Context.getConceptService().getConcept(1004), new Date(),
            1002, Context.getConceptService().getConcept(1119), new Date()
            );
View Full Code Here

        return "obsGroupsWithMultipleAnswerConceptIds";
      }

      @Override
      public Encounter getEncounterToView() throws Exception {
        Encounter e = new Encounter();
        e.setPatient(getPatient());
        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.addObsGroup(e, 7, new Date(),
            1000, Context.getConceptService().getConcept(1004), new Date(),
            1002, Context.getConceptService().getConcept(1119), new Date()
            );
View Full Code Here

          return "obsGroupsWithDifferentGroupingConceptsButSameMemberConceptsForm";
        }

        @Override
        public Encounter getEncounterToView() throws Exception {
          Encounter e = new Encounter();
          e.setPatient(getPatient());
          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));

          // first create two ALLERGY CONSTRUCT obsgroups that contain ALLERGY CODED obs with different answer values
          TestUtil.addObsGroup(e, 7, new Date(), 1000, Context.getConceptService().getConcept(1001), new Date());
          TestUtil.addObsGroup(e, 7, new Date(), 1000, Context.getConceptService().getConcept(1002), new Date());
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.