Package org.openmrs

Examples of org.openmrs.Drug


  /**
   * Test of retireDrug method, of class RaxaDrugController.
   */
  @Test
  public void testRetireDrug() throws Exception {
    Drug drug = service.getDrugByUuid(getUuid());
    Assert.assertFalse(drug.isRetired());
    controller.retireDrug(getUuid(), "testing", request, response);
    Drug drug2 = service.getDrugByUuid(getUuid());
    Assert.assertTrue(drug2.isRetired());
    Assert.assertEquals("testing", drug2.getRetireReason());
  }
View Full Code Here


    drugGroup.setCreator(Context.getUserContext().getAuthenticatedUser());
    drugGroup.setDateCreated(new java.util.Date());
    drugGroup.setUuid("68547121-1b70-465e-99ee-c9dfd95e7d30");
    drugGroup.setRetired(Boolean.FALSE);
    Set<Drug> drugs = new HashSet<Drug>();
    Drug drug1 = new Drug();
    Drug drug2 = new Drug();
    drug1.setId(1);
    drug1.setConcept(new Concept(792));
    drug1.setDateCreated(new Date());
    drug1.setCreator(Context.getUserContext().getAuthenticatedUser());
    drug2.setId(2);
    drug2.setConcept(new Concept(792));
    drug2.setDateCreated(new Date());
    drug2.setCreator(Context.getUserContext().getAuthenticatedUser());
    drugs.add(drug1);
    drugs.add(drug2);
    drugGroup.setDrugs(drugs);
    dao.deleteDrugGroup(drugGroup);
    DrugGroup result = dao.getDrugGroup(2);
View Full Code Here

    String name = result.getName();
    assertEquals("TestDrugGroup1", name);
   
    Set<Drug> resDrugs = result.getDrugs();
    Iterator<Drug> itr = resDrugs.iterator();
    Drug drug3 = itr.next();
    Integer drugId = 11;
    assertEquals(drug3.getId(), drugId);
  }
View Full Code Here

    String nameSet = "NewDrugGroupName";
    String nameRetrieved;
    DrugGroup drugGroup = dao.getDrugGroup(1);
    drugGroup.setName(nameSet);
    Set<Drug> drugs = new HashSet<Drug>();
    Drug drug1 = new Drug();
    Drug drug2 = new Drug();
    drug1.setId(1);
    drug1.setConcept(new Concept(792));
    drug2.setId(2);
    drug2.setConcept(new Concept(792));
    drugs.add(drug1);
    drugs.add(drug2);
    drugGroup.setDrugs(drugs);
    dao.updateDrugGroup(drugGroup);
    nameRetrieved = dao.getDrugGroup(1).getName();
View Full Code Here

    }
    if (postFields.get("description") != null) {
      drugInventory.setDescription(postFields.get("description").toString());
    }
    if (postFields.get("drug") != null) {
      Drug d = Context.getConceptService().getDrugByUuid(postFields.get("drug").toString());
      if (d == null) {
        throw new ResponseException(
                                    "Drug uuid not found") {};
      }
      drugInventory.setDrugId(d.getDrugId());
      drugInventory.setDrug(d);
    }
    if (postFields.get("quantity") != null) {
      drugInventory.setQuantity(Integer.parseInt(postFields.get("quantity").toString()));
    }
View Full Code Here

        SimpleObject newInvObj = new SimpleObject();
        newInvObj.add("name", inventories.get(i).getName());
        newInvObj.add("description", inventories.get(i).getDescription());
        newInvObj.add("uuid", inventories.get(i).getUuid());
        SimpleObject drugObj = new SimpleObject();
        Drug d = inventories.get(i).getDrug();
        if (d != null) {
          drugObj.add("uuid", d.getUuid());
          drugObj.add("display", d.getName());
        }
        newInvObj.add("drug", drugObj);
        newInvObj.add("quantity", inventories.get(i).getQuantity());
        newInvObj.add("originalQuantity", inventories.get(i).getOriginalQuantity());
        newInvObj.add("expiryDate", inventories.get(i).getExpiryDate());
View Full Code Here

TOP

Related Classes of org.openmrs.Drug

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.