Skip to content

Commit 485e01a

Browse files
k-josephwluyima
authored andcommittedDec 19, 2013
[#TRUNK-4169] Add added quantity and units properties to DrugIngredient
1 parent 9d08da2 commit 485e01a

File tree

4 files changed

+75
-1
lines changed

4 files changed

+75
-1
lines changed
 

‎api/src/main/java/org/openmrs/DrugIngredient.java

+42
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@ public class DrugIngredient extends BaseOpenmrsObject implements java.io.Seriali
2626

2727
private Concept ingredient;
2828

29+
private Double quantity;
30+
31+
private Concept units;
32+
2933
// Constructors
3034

3135
/** default constructor */
@@ -78,4 +82,42 @@ public void setId(Integer id) {
7882
throw new UnsupportedOperationException();
7983
}
8084

85+
/**
86+
* Gets quantity of Drug Ingredient
87+
*
88+
* @since 1.10
89+
*/
90+
public Double getQuantity() {
91+
return quantity;
92+
}
93+
94+
/**
95+
* Sets quantity of Drug Ingredient
96+
*
97+
* @param quantity
98+
* @since 1.10
99+
*/
100+
public void setQuantity(Double quantity) {
101+
this.quantity = quantity;
102+
}
103+
104+
/**
105+
* Gets units of Drug Ingredient
106+
*
107+
* @since 1.10
108+
*/
109+
public Concept getUnits() {
110+
return units;
111+
}
112+
113+
/**
114+
* Sets units of Drug Ingredient
115+
*
116+
* @param units
117+
* @since 1.10
118+
*/
119+
public void setUnits(Concept units) {
120+
this.units = units;
121+
}
122+
81123
}

‎api/src/main/java/org/openmrs/api/impl/OrderServiceImpl.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ public <o extends Order> o getOrder(Integer orderId, Class<o> orderClassType) th
140140
* java.util.List, java.util.List)
141141
*/
142142
public <Ord extends Order> List<Ord> getOrders(Class<Ord> orderClassType, List<Patient> patients,
143-
List<Concept> concepts, List<User> orderers, List<Encounter> encounters) {
143+
List<Concept> concepts, List<User> orderers, List<Encounter> encounters) {
144144
if (orderClassType == null)
145145
throw new APIException(
146146
"orderClassType cannot be null. An order type of Order.class or DrugOrder.class is required");

‎api/src/main/resources/liquibase-update-to-latest.xml

+27
Original file line numberDiff line numberDiff line change
@@ -6604,5 +6604,32 @@
66046604
</column>
66056605
</addColumn>
66066606
</changeSet>
6607+
6608+
<changeSet id="201312111626-TRUNK-4169" author="k-joseph">
6609+
<preConditions onFail="MARK_RAN">
6610+
<not>
6611+
<columnExists tableName="drug_ingredient" columnName="quantity" />
6612+
</not>
6613+
</preConditions>
6614+
<comment>Adding quantity column to drug_ingredient table</comment>
6615+
<addColumn tableName="drug_ingredient">
6616+
<column name="quantity" type="double" />
6617+
</addColumn>
6618+
</changeSet>
6619+
6620+
<changeSet id="201312111630-TRUNK-4169" author="k-joseph">
6621+
<preConditions onFail="MARK_RAN">
6622+
<not>
6623+
<columnExists tableName="drug_ingredient" columnName="units" />
6624+
</not>
6625+
</preConditions>
6626+
<comment>Adding units column to drug_ingredient table</comment>
6627+
<addColumn tableName="drug_ingredient">
6628+
<column name="units" type="int" />
6629+
</addColumn>
6630+
<addForeignKeyConstraint constraintName="drug_ingredient_units_fk"
6631+
baseTableName="drug_ingredient" baseColumnNames="units"
6632+
referencedTableName="concept" referencedColumnNames="concept_id" />
6633+
</changeSet>
66076634

66086635
</databaseChangeLog>

‎api/src/main/resources/org/openmrs/api/db/hibernate/DrugIngredient.hbm.xml

+5
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,11 @@
3131
</many-to-one>
3232

3333
<!-- end of derived association(s) -->
34+
35+
<property name="quantity" type="double" column="quantity" length="22"/>
36+
<many-to-one name="units" class="org.openmrs.Concept">
37+
<column name="units"/>
38+
</many-to-one>
3439

3540
</class>
3641

0 commit comments

Comments
 (0)
Please sign in to comment.