Skip to content

Commit

Permalink
[#TRUNK-4169] Add added quantity and units properties to DrugIngredient
Browse files Browse the repository at this point in the history
  • Loading branch information
k-joseph authored and wluyima committed Dec 19, 2013
1 parent 9d08da2 commit 485e01a
Show file tree
Hide file tree
Showing 4 changed files with 75 additions and 1 deletion.
42 changes: 42 additions & 0 deletions api/src/main/java/org/openmrs/DrugIngredient.java
Expand Up @@ -26,6 +26,10 @@ public class DrugIngredient extends BaseOpenmrsObject implements java.io.Seriali

private Concept ingredient;

private Double quantity;

private Concept units;

// Constructors

/** default constructor */
Expand Down Expand Up @@ -78,4 +82,42 @@ public void setId(Integer id) {
throw new UnsupportedOperationException();
}

/**
* Gets quantity of Drug Ingredient
*
* @since 1.10
*/
public Double getQuantity() {
return quantity;
}

/**
* Sets quantity of Drug Ingredient
*
* @param quantity
* @since 1.10
*/
public void setQuantity(Double quantity) {
this.quantity = quantity;
}

/**
* Gets units of Drug Ingredient
*
* @since 1.10
*/
public Concept getUnits() {
return units;
}

/**
* Sets units of Drug Ingredient
*
* @param units
* @since 1.10
*/
public void setUnits(Concept units) {
this.units = units;
}

}
Expand Up @@ -140,7 +140,7 @@ public <o extends Order> o getOrder(Integer orderId, Class<o> orderClassType) th
* java.util.List, java.util.List)
*/
public <Ord extends Order> List<Ord> getOrders(Class<Ord> orderClassType, List<Patient> patients,
List<Concept> concepts, List<User> orderers, List<Encounter> encounters) {
List<Concept> concepts, List<User> orderers, List<Encounter> encounters) {
if (orderClassType == null)
throw new APIException(
"orderClassType cannot be null. An order type of Order.class or DrugOrder.class is required");
Expand Down
27 changes: 27 additions & 0 deletions api/src/main/resources/liquibase-update-to-latest.xml
Expand Up @@ -6604,5 +6604,32 @@
</column>
</addColumn>
</changeSet>

<changeSet id="201312111626-TRUNK-4169" author="k-joseph">
<preConditions onFail="MARK_RAN">
<not>
<columnExists tableName="drug_ingredient" columnName="quantity" />
</not>
</preConditions>
<comment>Adding quantity column to drug_ingredient table</comment>
<addColumn tableName="drug_ingredient">
<column name="quantity" type="double" />
</addColumn>
</changeSet>

<changeSet id="201312111630-TRUNK-4169" author="k-joseph">
<preConditions onFail="MARK_RAN">
<not>
<columnExists tableName="drug_ingredient" columnName="units" />
</not>
</preConditions>
<comment>Adding units column to drug_ingredient table</comment>
<addColumn tableName="drug_ingredient">
<column name="units" type="int" />
</addColumn>
<addForeignKeyConstraint constraintName="drug_ingredient_units_fk"
baseTableName="drug_ingredient" baseColumnNames="units"
referencedTableName="concept" referencedColumnNames="concept_id" />
</changeSet>

</databaseChangeLog>
Expand Up @@ -31,6 +31,11 @@
</many-to-one>

<!-- end of derived association(s) -->

<property name="quantity" type="double" column="quantity" length="22"/>
<many-to-one name="units" class="org.openmrs.Concept">
<column name="units"/>
</many-to-one>

</class>

Expand Down

0 comments on commit 485e01a

Please sign in to comment.