diff --git a/api/src/main/java/org/openmrs/DrugOrder.java b/api/src/main/java/org/openmrs/DrugOrder.java index a4e366401da7..fa0509803978 100644 --- a/api/src/main/java/org/openmrs/DrugOrder.java +++ b/api/src/main/java/org/openmrs/DrugOrder.java @@ -56,6 +56,10 @@ public enum DosingType { private String dosingInstructions; + private Double duration; + + private Concept durationUnits; + // Constructors /** default constructor */ @@ -89,6 +93,8 @@ protected DrugOrder copyHelper(DrugOrder target) { target.drug = getDrug(); target.dosingType = getDosingType(); target.dosingInstructions = getDosingInstructions(); + target.duration = getDuration(); + target.durationUnits = getDurationUnits(); return target; } @@ -336,6 +342,44 @@ public String getDosingInstructions() { return this.dosingInstructions; } + /** + * Gets the duration of a Drug Order + * + * @since 1.10 + */ + public Double getDuration() { + return duration; + } + + /** + * Sets the duration of a Drug Order + * + * @param duration to set + * @since 1.10 + */ + public void setDuration(Double duration) { + this.duration = duration; + } + + /** + * Gets durationUnits of a Drug Order + * + * @since 1.10 + */ + public Concept getDurationUnits() { + return durationUnits; + } + + /** + * Sets the durationUnits of a Drug Order + * + * @param durationUnits + * @since 1.10 + */ + public void setDurationUnits(Concept durationUnits) { + this.durationUnits = durationUnits; + } + public String toString() { return "DrugOrder(" + getDose() + getUnits() + " of " + (getDrug() != null ? getDrug().getName() : "[no drug]") + " from " + getStartDate() + " to " + (getDiscontinued() ? getDiscontinuedDate() : getAutoExpireDate()) diff --git a/api/src/main/resources/liquibase-update-to-latest.xml b/api/src/main/resources/liquibase-update-to-latest.xml index c81f146bc1da..62a48d5b7383 100644 --- a/api/src/main/resources/liquibase-update-to-latest.xml +++ b/api/src/main/resources/liquibase-update-to-latest.xml @@ -6632,4 +6632,31 @@ referencedTableName="concept" referencedColumnNames="concept_id" /> + + + + + + + Adding duration column to drug_order table + + + + + + + + + + + + Adding duration_units column to drug_order table + + + + + + \ No newline at end of file diff --git a/api/src/main/resources/org/openmrs/api/db/hibernate/Order.hbm.xml b/api/src/main/resources/org/openmrs/api/db/hibernate/Order.hbm.xml index edac9fca629e..4a55e5f98d5b 100644 --- a/api/src/main/resources/org/openmrs/api/db/hibernate/Order.hbm.xml +++ b/api/src/main/resources/org/openmrs/api/db/hibernate/Order.hbm.xml @@ -114,6 +114,10 @@ + + + +