Skip to content

(feat) O3-5255 Implemented a free text field to allow entering a discharge note when discharging a patient#2166

Open
sourav-jyoti wants to merge 8 commits intoopenmrs:mainfrom
sourav-jyoti:feat/O3-5255
Open

(feat) O3-5255 Implemented a free text field to allow entering a discharge note when discharging a patient#2166
sourav-jyoti wants to merge 8 commits intoopenmrs:mainfrom
sourav-jyoti:feat/O3-5255

Conversation

@sourav-jyoti
Copy link

@sourav-jyoti sourav-jyoti commented Dec 15, 2025

Requirements

  • This PR has a title that briefly describes the work done including the ticket number. If there is a ticket, make sure your PR title includes a conventional commit label. See existing PR titles for inspiration.
  • My work is based on designs, which are linked or shown either in the Jira ticket or the description below.
  • My work includes tests or is validated by existing tests.

Summary

Currently, in the discharge patient section the implementaion is one click button to discharge a patient.
In this Pr i have implemented

  1. A confirmation popup modal before finalizing a discharge
  2. A mandatory discharge note field to record the reason for discharge.

Screenrecording

Before

Screencast.From.2025-12-16.01-49-21.mp4

After

Screencast.From.2025-12-16.01-53-18.mp4

Related Issue

https://openmrs.atlassian.net/issues/O3-5255

import styles from './patient-discharge.scss';

const createNoteSchema = (translate: (key: string, defaultMessage: string) => string) =>
z.object({
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this field should be optional. Encounters can be created without observations, so the backend won't enforce this client-side constraint.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i have applied this check currently on the frontend as mentioned by anish_dhodari in the ticket " A mandatory discharge note field to record the reason for discharge."

so should i remove it completely

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mogoodrich @chibongho any thoughts?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@denniskigen I don't think this note field should be mandatory and it would be good if it was configurable. We have a separate Discharge form where the clinicians capture discharge notes and other details. cc: @chibongho

@sourav-jyoti sourav-jyoti changed the title fix/O3-5255 Implemented a free text field to allow entering a discharge note when discharging a patient feat/O3-5255 Implemented a free text field to allow entering a discharge note when discharging a patient Dec 17, 2025
@sourav-jyoti sourav-jyoti marked this pull request as ready for review December 17, 2025 18:04

const onSubmit = useCallback(
(data: DischargeData) => {
const dispose = showModal('PatientDischargeConfirmationModal', {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We usually don't have an additional confirmation modal when submitting a form in a workspace, since the form has a cancel button already as well.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i have added this confirmation as suggested by anish_dhodari in the ticket "A confirmation (page or popup) before finalizing a discharge"

@chibongho should i remove it ?

}
})
.then((response) => {
if (!response?.ok) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know the old code had this response.ok check, but I don't think we need it.

https://o3-docs.openmrs.org/docs/coding-conventions/error-handling.en-US

@sourav-jyoti
Copy link
Author

sourav-jyoti commented Dec 19, 2025

@denniskigen i have updated the according to the new requirements

  1. removed the confirmation modal
  2. made the note optional
  3. used modern try catch block as suggested by chibongho

Updated screenrecording

Screencast.From.2025-12-20.01-19-45.mp4

@sourav-jyoti sourav-jyoti changed the title feat/O3-5255 Implemented a free text field to allow entering a discharge note when discharging a patient (feat) O3-5255 Implemented a free text field to allow entering a discharge note when discharging a patient Jan 9, 2026
@sourav-jyoti
Copy link
Author

@denniskigen could you pls review this pr

@kdaud
Copy link
Member

kdaud commented Feb 9, 2026

Hi @denniskigen @chibongho, could you help review this PR when you get a chance? Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants