Skip to content

Commit 2ce6ca9

Browse files
Introduce new fields for Note amendment feature
1 parent 8acbf7f commit 2ce6ca9

File tree

3 files changed

+109
-0
lines changed

3 files changed

+109
-0
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
/**
2+
* This Source Code Form is subject to the terms of the Mozilla Public License,
3+
* v. 2.0. If a copy of the MPL was not distributed with this file, You can
4+
* obtain one at http://mozilla.org/MPL/2.0/. OpenMRS is also distributed under
5+
* the terms of the Healthcare Disclaimer located at http://openmrs.org/license.
6+
*
7+
* Copyright (C) OpenMRS Inc. OpenMRS is a registered trademark and the OpenMRS
8+
* graphic logo is a trademark of OpenMRS Inc.
9+
*/
10+
package org.openmrs.module.ipd.api.model;
11+
12+
/**
13+
* Enum representing the approval status of a medication administration note amendment
14+
*/
15+
public enum ApprovalStatus {
16+
PENDING,
17+
APPROVED,
18+
REJECTED
19+
}

api/src/main/java/org/openmrs/module/ipd/api/model/MedicationAdministrationNote.java

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,38 @@ public class MedicationAdministrationNote extends BaseOpenmrsData {
5555
@Column(name = "text", length=65535)
5656
private String text;
5757

58+
/**
59+
* Amendment reason - why this note was amended
60+
*/
61+
@Column(name = "amended_reason", nullable = true)
62+
private String amendedReason;
63+
64+
/**
65+
* Provider who approved this amendment
66+
*/
67+
@OneToOne(optional = true)
68+
@JoinColumn(name = "approved_by_id", nullable = true)
69+
private Provider approvedBy;
70+
71+
/**
72+
* Date and time when the amendment was approved
73+
*/
74+
@Column(name = "approved_date_time", nullable = true)
75+
private Date approvedDateTime;
76+
77+
/**
78+
* Status of the approval (PENDING, APPROVED, REJECTED)
79+
*/
80+
@Enumerated(EnumType.STRING)
81+
@Column(name = "approval_status", nullable = true)
82+
private ApprovalStatus approvalStatus;
83+
84+
/**
85+
* Notes related to the approval decision
86+
*/
87+
@Column(name = "approval_notes", length=65535, nullable = true)
88+
private String approvalNotes;
89+
5890
public MedicationAdministrationNote() {
5991
}
6092

@@ -106,4 +138,44 @@ public void setText(String text) {
106138
this.text = text;
107139
}
108140

141+
public String getAmendedReason() {
142+
return amendedReason;
143+
}
144+
145+
public void setAmendedReason(String amendedReason) {
146+
this.amendedReason = amendedReason;
147+
}
148+
149+
public Provider getApprovedBy() {
150+
return approvedBy;
151+
}
152+
153+
public void setApprovedBy(Provider approvedBy) {
154+
this.approvedBy = approvedBy;
155+
}
156+
157+
public Date getApprovedDateTime() {
158+
return approvedDateTime;
159+
}
160+
161+
public void setApprovedDateTime(Date approvedDateTime) {
162+
this.approvedDateTime = approvedDateTime;
163+
}
164+
165+
public ApprovalStatus getApprovalStatus() {
166+
return approvalStatus;
167+
}
168+
169+
public void setApprovalStatus(ApprovalStatus approvalStatus) {
170+
this.approvalStatus = approvalStatus;
171+
}
172+
173+
public String getApprovalNotes() {
174+
return approvalNotes;
175+
}
176+
177+
public void setApprovalNotes(String approvalNotes) {
178+
this.approvalNotes = approvalNotes;
179+
}
180+
109181
}

api/src/main/resources/liquibase.xml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,4 +228,22 @@
228228
</update>
229229
</changeSet>
230230

231+
<changeSet id="202511181030_add_amendment_approval_fields" author="Bahmni">
232+
<preConditions onFail="MARK_RAN" onError="MARK_RAN">
233+
<tableExists tableName="medication_administration_note"/>
234+
<not>
235+
<columnExists tableName="medication_administration_note" columnName="amended_reason"/>
236+
</not>
237+
</preConditions>
238+
<comment>Add amendment and approval fields to medication_administration_note table</comment>
239+
<addColumn tableName="medication_administration_note">
240+
<column name="amended_reason" type="text"/>
241+
<column name="approved_by_id" type="int"/>
242+
<column name="approved_date_time" type="datetime"/>
243+
<column name="approval_status" type="varchar(50)"/>
244+
<column name="approval_notes" type="text"/>
245+
</addColumn>
246+
<addForeignKeyConstraint constraintName="medication_administration_note_approved_by_fk" baseTableName="medication_administration_note" baseColumnNames="approved_by_id" referencedTableName="provider" referencedColumnNames="provider_id"/>
247+
</changeSet>
248+
231249
</databaseChangeLog>

0 commit comments

Comments
 (0)