0% found this document useful (0 votes)
2 views3 pages

Infant Medical Note Editor Tool

Uploaded by

anebek555
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views3 pages

Infant Medical Note Editor Tool

Uploaded by

anebek555
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

InfantProgressiveNoteEdit

Class: InfantProgressiveNoteEdit
Purpose:
A Swing JFrame form for editing a single infant’s progressive medical note, including diagnosis,
progress notes, treatment plan, and follow-up information.

Constructor
public InfantProgressiveNoteEdit(String infantMRN, int noteId)

 Parameters:
o infantMRN: The infant’s Medical Record Number.
o noteId: The ID of the progressive note in the database.
 Initializes the UI, fetches infant data from Connect, and pre-fills the form fields.

Key UI Components

Component Type Notes


txtMRN JTextField Infant MRN, non-editable
txtName JTextField Infant name, non-editable
txtDOB JTextField Infant DOB, non-editable
txtGender JTextField Infant gender, non-editable
txtAge JTextField Current age in months, editable
txtPrimaryDiag JTextField Primary diagnosis
txtSecondaryDiag JTextField Secondary diagnosis
progressArea JTextArea Infant progress notes
treatmentArea JTextArea Treatment plan
txtFollowUp JFormattedTextField Follow-up date (with date picker)
txtDoctor JTextField Doctor’s name, non-editable

Panels and Sections

 Infant Information: MRN, name, DOB, gender, age.


 Diagnosis: Primary and secondary diagnosis.
 Progress Notes: Multi-line text area.
 Treatment Plan: Multi-line text area.
 Follow-up & Doctor Info: Date picker and doctor name.

Each section uses a titled border with createSectionPanel(String title).

Date Picker Integration

 Uses a custom JMonthCalendarEdit (similar to JMonthCalendar) to select follow-up


dates.
 Double-clicking a date sets the value in txtFollowUp formatted as dd/MM/yyyy.
 The showDatePicker() method opens a modal dialog with the calendar.

Saving the Note

handleSave():

1. Validates all required fields.


2. Creates an InfantProgressiveNoteModel with updated values.
3. Calls [Link](note) to save changes.
4. Displays success or error dialogs.
5. Triggers the onSaveSuccess callback if provided.

Validation ensures no empty required field, including MRN, name, DOB, gender, diagnosis,
progress, treatment, follow-up date, and doctor.

Custom Calendar Component: JMonthCalendarEdit

 Displays a calendar with month/year spinners and a clickable day table.


 Users double-click a day to select it.
 Fires an ActionEvent to notify listeners (used by InfantProgressiveNoteEdit).
 Handles month/year changes and dynamically updates the calendar table.

Key Methods:

Method Purpose
updateCalendar() Fills table with correct days for selected month/year
getDate() Returns currently selected date
stateChanged() Handles spinner changes (month/year)
addActionListener() Adds listener for date selection events
fireActionPerformed() Fires event to all registered listeners
Notes and Recommendations

1. Date Format Issue:


In your code:
2. SimpleDateFormat dateFormat = new SimpleDateFormat("dd/mm/yyyy");
o mm is minutes; for months, use MM. Correct version:
o SimpleDateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy");
3. Consistency:
o The progressArea and treatmentArea support multi-line input and wrap text
correctly.
o Doctor name is read-only; follow-up date is set via calendar.
4. Callbacks:
o onSaveSuccess allows other forms or UI components to refresh after a note is
updated.
5. Error Handling:
o Displays JOptionPane dialogs for validation errors or database exceptions.

Example Usage
InfantProgressiveNoteEdit editForm = new InfantProgressiveNoteEdit("MRN123",
5);
[Link](() -> {
[Link]("Note updated successfully!");
// Refresh the list or parent form
});
[Link](true);

You might also like