mirror of
https://github.com/tiennm99/BSK-All-in-One-Clinic-Management-System.git
synced 2026-10-17 00:14:28 +00:00
[update] Enhance CheckUpPage and HistoryViewDialog by adding comprehensive patient vitals including height, weight, heart rate, and blood pressure. Update data handling and UI components to reflect these changes, ensuring a more detailed patient history and improved user experience. Revise database queries and report generation to accommodate new fields.
This commit is contained in:
1 parent
cd54e2813e
commit
64a6aeeb15
8 files changed
+179
-74
No files matched your search
@@ -1230,7 +1230,7 @@ public class CheckUpPage extends JPanel {
|
||||
new Font("Arial", Font.BOLD, 16), new Color(63, 81, 181)
|
||||
)
|
||||
));
|
||||
String historyColumns[] = {"Ngày Tháng","Mã khám bệnh", "Triệu chứng", "Chẩn đoán", "Ghi chú"};
|
||||
String historyColumns[] = {"Ngày khám", "Loại khám", "Kết luận", "Cao (cm)", "Nặng (kg)", "Nhịp tim", "Huyết áp"};
|
||||
historyModel = new DefaultTableModel(this.history, historyColumns) {
|
||||
@Override public boolean isCellEditable(int row, int column) { return false; }
|
||||
};
|
||||
@@ -1246,8 +1246,8 @@ public class CheckUpPage extends JPanel {
|
||||
// Check if the row index is valid for our data array
|
||||
if (selectedRow >= 0 && history != null && selectedRow < history.length) {
|
||||
String[] selectedHistory = history[selectedRow];
|
||||
// Ensure the selected record has enough data fields
|
||||
if (selectedHistory != null && selectedHistory.length >= 11) {
|
||||
// Ensure the selected record has enough data fields (now need 15 for vitals)
|
||||
if (selectedHistory != null && selectedHistory.length >= 15) {
|
||||
String checkupId = selectedHistory[1];
|
||||
String patientName = customerFirstNameField.getText() + " " + customerLastNameField.getText();
|
||||
String checkupDate = selectedHistory[0];
|
||||
@@ -1257,8 +1257,12 @@ public class CheckUpPage extends JPanel {
|
||||
String conclusion = selectedHistory[7];
|
||||
String reCheckupDate = selectedHistory[8];
|
||||
String doctorName = selectedHistory[9] + " " + selectedHistory[10];
|
||||
|
||||
openHistoryViewDialog(checkupId, patientName, checkupDate, suggestion, diagnosis, conclusion, notes, reCheckupDate, doctorName);
|
||||
String customerHeight = selectedHistory[11]; // customer_height
|
||||
String customerWeight = selectedHistory[12]; // customer_weight
|
||||
String heartRate = selectedHistory[13]; // heart_beat
|
||||
String bloodPressure = selectedHistory[14]; // blood_pressure
|
||||
|
||||
openHistoryViewDialog(checkupId, patientName, checkupDate, suggestion, diagnosis, conclusion, notes, reCheckupDate, doctorName, customerHeight, customerWeight, heartRate, bloodPressure);
|
||||
} else {
|
||||
log.warn("Selected history record has incomplete data. Length: {}", (selectedHistory != null ? selectedHistory.length : "null"));
|
||||
}
|
||||
@@ -1598,7 +1602,11 @@ public class CheckUpPage extends JPanel {
|
||||
recheckupDatePicker.getJFormattedTextField().getText(),
|
||||
selectedImagesForPrint,
|
||||
printType,
|
||||
templateTitle
|
||||
templateTitle,
|
||||
customerHeightSpinner.getValue().toString(),
|
||||
customerWeightSpinner.getValue().toString(),
|
||||
patientHeartRateSpinner.getValue().toString(),
|
||||
bloodPressureSystolicSpinner.getValue() + "/" + bloodPressureDiastolicSpinner.getValue()
|
||||
);
|
||||
|
||||
JasperPrint jasperPrintToPrint;
|
||||
@@ -1659,7 +1667,11 @@ public class CheckUpPage extends JPanel {
|
||||
recheckupDatePicker.getJFormattedTextField().getText(),
|
||||
selectedImagesForPrint,
|
||||
printType,
|
||||
templateTitle
|
||||
templateTitle,
|
||||
customerHeightSpinner.getValue().toString(),
|
||||
customerWeightSpinner.getValue().toString(),
|
||||
patientHeartRateSpinner.getValue().toString(),
|
||||
bloodPressureSystolicSpinner.getValue() + "/" + bloodPressureDiastolicSpinner.getValue()
|
||||
);
|
||||
|
||||
JasperPrint jasperPrintToView;
|
||||
@@ -2031,23 +2043,33 @@ public class CheckUpPage extends JPanel {
|
||||
|
||||
private void handleGetPatientHistoryResponse(GetPatientHistoryResponse response) {
|
||||
SwingUtilities.invokeLater(() -> {
|
||||
log.info("Received patient history");
|
||||
this.history = response.getHistory(); // Keep original 6-column data for the dialog
|
||||
|
||||
// Prepare data specifically for the 5-column table view
|
||||
String[][] tableData = new String[this.history.length][5];
|
||||
for (int i = 0; i < this.history.length; i++) {
|
||||
if (this.history[i] != null && this.history[i].length >= 6) {
|
||||
// 0: checkup_date, 1: checkup_id, 2: suggestion, 3: diagnosis, 4: prescription_id, 5: notes, 6: checkup_type, 7: conclusion
|
||||
// display 0, 1, 6, 7
|
||||
tableData[i][0] = this.history[i][0];
|
||||
tableData[i][1] = this.history[i][1];
|
||||
tableData[i][2] = this.history[i][6];
|
||||
tableData[i][3] = this.history[i][7];
|
||||
log.info("Received patient history");
|
||||
this.history = response.getHistory(); // Keep original data for the dialog
|
||||
|
||||
if (this.history != null && this.history.length > 0) {
|
||||
// Prepare data specifically for the 7-column table view
|
||||
String[] historyColumns = {"Ngày khám", "Loại khám", "Kết luận", "Cao (cm)", "Nặng (kg)", "Nhịp tim", "Huyết áp"};
|
||||
String[][] tableData = new String[this.history.length][7];
|
||||
|
||||
for (int i = 0; i < this.history.length; i++) {
|
||||
if (this.history[i] != null && this.history[i].length >= 15) {
|
||||
// 0: checkup_date, 1: checkup_id, 2: suggestion, 3: diagnosis, 4: prescription_id, 5: notes, 6: checkup_type,
|
||||
// 7: conclusion, 8: reCheckupDate, 9: doctor_last_name, 10: doctor_first_name, 11: customer_height, 12: customer_weight,
|
||||
// 13: heart_beat, 14: blood_pressure
|
||||
tableData[i][0] = this.history[i][0]; // Ngày khám
|
||||
tableData[i][1] = this.history[i][6]; // Loại khám
|
||||
tableData[i][2] = this.history[i][7]; // Kết luận
|
||||
tableData[i][3] = this.history[i][11]; // Cao (cm)
|
||||
tableData[i][4] = this.history[i][12]; // Nặng (kg)
|
||||
tableData[i][5] = this.history[i][13]; // Nhịp tim
|
||||
tableData[i][6] = this.history[i][14]; // Huyết áp
|
||||
}
|
||||
}
|
||||
historyModel.setDataVector(tableData, historyColumns);
|
||||
} else {
|
||||
// Clear the table if there is no history
|
||||
historyModel.setRowCount(0);
|
||||
}
|
||||
|
||||
historyModel.setDataVector(tableData, new String[]{"Ngày Tháng","Mã khám bệnh", "Loại khám", "Kết luận"});
|
||||
});
|
||||
}
|
||||
|
||||
@@ -3686,10 +3708,10 @@ public class CheckUpPage extends JPanel {
|
||||
/**
|
||||
* Opens the history view dialog for the selected checkup
|
||||
*/
|
||||
private void openHistoryViewDialog(String checkupId, String patientName, String checkupDate, String suggestion, String diagnosis, String conclusion, String notes, String reCheckupDate, String doctorName) {
|
||||
private void openHistoryViewDialog(String checkupId, String patientName, String checkupDate, String suggestion, String diagnosis, String conclusion, String notes, String reCheckupDate, String doctorName, String customerHeight, String customerWeight, String heartRate, String bloodPressure) {
|
||||
try {
|
||||
// Pass all the necessary details to the dialog
|
||||
HistoryViewDialog historyDialog = new HistoryViewDialog(mainFrame, checkupId, patientName, checkupDate, suggestion, diagnosis, conclusion, notes, reCheckupDate, doctorName);
|
||||
// Pass all the necessary details to the dialog including vitals
|
||||
HistoryViewDialog historyDialog = new HistoryViewDialog(mainFrame, checkupId, patientName, checkupDate, suggestion, diagnosis, conclusion, notes, reCheckupDate, doctorName, customerHeight, customerWeight, heartRate, bloodPressure);
|
||||
historyDialog.setVisible(true);
|
||||
} catch (Exception e) {
|
||||
log.error("Error opening history view dialog", e);
|
||||
|
||||
+57
-1
@@ -10,6 +10,8 @@ import java.awt.event.MouseAdapter;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.awt.event.WindowAdapter;
|
||||
import java.awt.event.WindowEvent;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.KeyEvent;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.File;
|
||||
@@ -49,6 +51,12 @@ public class HistoryViewDialog extends JDialog {
|
||||
private String[][] medicinePrescription;
|
||||
private String[][] servicePrescription;
|
||||
|
||||
// Vitals data
|
||||
private String customerHeight;
|
||||
private String customerWeight;
|
||||
private String heartRate;
|
||||
private String bloodPressure;
|
||||
|
||||
// UI Components
|
||||
private JLabel imagePreviewLabel;
|
||||
private JPanel imageListPanel;
|
||||
@@ -76,7 +84,7 @@ public class HistoryViewDialog extends JDialog {
|
||||
private final ResponseListener<GetOrderInfoByCheckupRes> orderInfoListener = this::handleGetOrderInfoResponse;
|
||||
private final ResponseListener<GetImagesByCheckupIdRes> imagesListener = this::handleGetImagesResponse;
|
||||
|
||||
public HistoryViewDialog(Frame parent, String checkupId, String patientName, String checkupDate, String suggestion, String diagnosis, String conclusion, String notes, String reCheckupDate, String doctorName) {
|
||||
public HistoryViewDialog(Frame parent, String checkupId, String patientName, String checkupDate, String suggestion, String diagnosis, String conclusion, String notes, String reCheckupDate, String doctorName, String customerHeight, String customerWeight, String heartRate, String bloodPressure) {
|
||||
super(parent, "Xem chi tiết lịch sử khám - " + patientName, true);
|
||||
this.checkupId = checkupId;
|
||||
this.patientName = patientName;
|
||||
@@ -90,6 +98,10 @@ public class HistoryViewDialog extends JDialog {
|
||||
this.conclusion = conclusion;
|
||||
this.reCheckupDate = reCheckupDate;
|
||||
this.doctorName = doctorName;
|
||||
this.customerHeight = customerHeight;
|
||||
this.customerWeight = customerWeight;
|
||||
this.heartRate = heartRate;
|
||||
this.bloodPressure = bloodPressure;
|
||||
initializeDialog(parent);
|
||||
setupUI();
|
||||
|
||||
@@ -288,6 +300,50 @@ public class HistoryViewDialog extends JDialog {
|
||||
JLabel checkupIdLabel = new JLabel(checkupId);
|
||||
checkupIdLabel.setFont(valueFont);
|
||||
patientInfoPanel.add(checkupIdLabel, gbc);
|
||||
|
||||
// --- ROW 4 - Vitals Information ---
|
||||
gbc.gridy = 4;
|
||||
gbc.gridx = 0;
|
||||
JLabel heightLabel = new JLabel("Chiều cao:");
|
||||
heightLabel.setFont(labelFont);
|
||||
patientInfoPanel.add(heightLabel, gbc);
|
||||
|
||||
gbc.gridx = 1;
|
||||
JLabel heightValueLabel = new JLabel(getDisplayableString(this.customerHeight) + " cm");
|
||||
heightValueLabel.setFont(valueFont);
|
||||
patientInfoPanel.add(heightValueLabel, gbc);
|
||||
|
||||
gbc.gridx = 2;
|
||||
JLabel weightLabel = new JLabel("Cân nặng:");
|
||||
weightLabel.setFont(labelFont);
|
||||
patientInfoPanel.add(weightLabel, gbc);
|
||||
|
||||
gbc.gridx = 3;
|
||||
JLabel weightValueLabel = new JLabel(getDisplayableString(this.customerWeight) + " kg");
|
||||
weightValueLabel.setFont(valueFont);
|
||||
patientInfoPanel.add(weightValueLabel, gbc);
|
||||
|
||||
// --- ROW 5 - Heart Rate and Blood Pressure ---
|
||||
gbc.gridy = 5;
|
||||
gbc.gridx = 0;
|
||||
JLabel heartRateLabel = new JLabel("Nhịp tim:");
|
||||
heartRateLabel.setFont(labelFont);
|
||||
patientInfoPanel.add(heartRateLabel, gbc);
|
||||
|
||||
gbc.gridx = 1;
|
||||
JLabel heartRateValueLabel = new JLabel(getDisplayableString(this.heartRate) + " bpm");
|
||||
heartRateValueLabel.setFont(valueFont);
|
||||
patientInfoPanel.add(heartRateValueLabel, gbc);
|
||||
|
||||
gbc.gridx = 2;
|
||||
JLabel bloodPressureLabel = new JLabel("Huyết áp:");
|
||||
bloodPressureLabel.setFont(labelFont);
|
||||
patientInfoPanel.add(bloodPressureLabel, gbc);
|
||||
|
||||
gbc.gridx = 3;
|
||||
JLabel bloodPressureValueLabel = new JLabel(getDisplayableString(this.bloodPressure) + " mmHg");
|
||||
bloodPressureValueLabel.setFont(valueFont);
|
||||
patientInfoPanel.add(bloodPressureValueLabel, gbc);
|
||||
|
||||
headerPanel.add(patientInfoPanel, BorderLayout.CENTER);
|
||||
|
||||
|
||||
+18
-1
@@ -77,6 +77,12 @@ public class UltrasoundResult {
|
||||
private final List<File> selectedImages;
|
||||
private final String printType; // "ngang" or "dọc"
|
||||
private final String templateTitle;
|
||||
|
||||
// Vitals data
|
||||
private final String customerHeight;
|
||||
private final String customerWeight;
|
||||
private final String heartRate;
|
||||
private final String bloodPressure;
|
||||
|
||||
private static final String PDF_PATH = "ultrasound_result.pdf";
|
||||
|
||||
@@ -84,7 +90,8 @@ public class UltrasoundResult {
|
||||
String patientAddress, String doctorName, String checkupDate,
|
||||
String rtfContent, String conclusion, String suggestion,
|
||||
String recheckupDate, List<File> selectedImages,
|
||||
String printType, String templateTitle) {
|
||||
String printType, String templateTitle, String customerHeight,
|
||||
String customerWeight, String heartRate, String bloodPressure) {
|
||||
|
||||
// Defensive null checks to prevent JasperReports from crashing on null parameters
|
||||
this.checkupId = checkupId != null ? checkupId : "";
|
||||
@@ -101,6 +108,10 @@ public class UltrasoundResult {
|
||||
this.selectedImages = selectedImages != null ? selectedImages : new ArrayList<>();
|
||||
this.printType = printType != null ? printType : "";
|
||||
this.templateTitle = templateTitle != null ? templateTitle : "";
|
||||
this.customerHeight = customerHeight != null ? customerHeight : "";
|
||||
this.customerWeight = customerWeight != null ? customerWeight : "";
|
||||
this.heartRate = heartRate != null ? heartRate : "";
|
||||
this.bloodPressure = bloodPressure != null ? bloodPressure : "";
|
||||
}
|
||||
|
||||
public void showDirectJasperViewer() {
|
||||
@@ -153,6 +164,12 @@ public class UltrasoundResult {
|
||||
parameters.put("checkupConclusion", this.conclusion);
|
||||
parameters.put("checkupSuggestion", this.suggestion);
|
||||
parameters.put("reCheckupDate", this.recheckupDate);
|
||||
|
||||
// Vitals data
|
||||
parameters.put("checkupHeight", this.customerHeight);
|
||||
parameters.put("checkupWeight", this.customerWeight);
|
||||
parameters.put("checkupHeartBeat", this.heartRate);
|
||||
parameters.put("checkupBloodPressure", this.bloodPressure);
|
||||
|
||||
// Handle images
|
||||
int numberOfImages = this.selectedImages.size();
|
||||
|
||||
+30
-2
@@ -36,10 +36,14 @@
|
||||
<parameter name="image1" class="java.lang.String"/>
|
||||
<parameter name="image2" class="java.lang.String"/>
|
||||
<parameter name="image3" class="java.lang.String"/>
|
||||
<parameter name="checkupHeight" class="java.lang.String"/>
|
||||
<parameter name="image4" class="java.lang.String"/>
|
||||
<parameter name="image5" class="java.lang.String"/>
|
||||
<parameter name="numberImage" class="java.lang.Integer"/>
|
||||
<parameter name="image6" class="java.lang.String"/>
|
||||
<parameter name="checkupBloodPressure" class="java.lang.String"/>
|
||||
<parameter name="checkupHeartBeat" class="java.lang.String"/>
|
||||
<parameter name="checkupWeight" class="java.lang.String"/>
|
||||
<query language="sql"><![CDATA[]]></query>
|
||||
<background splitType="Stretch"/>
|
||||
<title splitType="Stretch"/>
|
||||
@@ -111,12 +115,36 @@
|
||||
<element kind="textField" uuid="5ae67e13-7a79-437f-bfb8-c720d896720d" x="60" y="124" width="340" height="26" fontName="Times New Roman" fontSize="10.0">
|
||||
<expression><![CDATA[$P{patientDiagnos}]]></expression>
|
||||
</element>
|
||||
<element kind="staticText" uuid="b1fa845a-48da-4e45-82b8-8b9d972650f6" x="0" y="146" width="100" height="30" forecolor="#FF0905" fontName="Times New Roman" fontSize="15.0" bold="true">
|
||||
<element kind="staticText" uuid="b1fa845a-48da-4e45-82b8-8b9d972650f6" x="0" y="184" width="100" height="30" forecolor="#FF0905" fontName="Times New Roman" fontSize="15.0" bold="true">
|
||||
<text><![CDATA[II.Nội dung]]></text>
|
||||
</element>
|
||||
<element kind="textField" uuid="6d652a25-b701-45bd-91ba-750842650004" x="0" y="164" width="400" height="376" markup="rtf" fontName="Times New Roman" fontSize="10.0">
|
||||
<element kind="textField" uuid="6d652a25-b701-45bd-91ba-750842650004" x="0" y="200" width="400" height="340" markup="rtf" fontName="Times New Roman" fontSize="10.0">
|
||||
<expression><![CDATA[$P{checkupNote}]]></expression>
|
||||
</element>
|
||||
<element kind="staticText" uuid="8f720f6a-0257-4556-b3bc-3b81ad4f8099" x="1" y="150" width="59" height="16" fontName="Times New Roman" fontSize="10.0" bold="true" hTextAlign="Left">
|
||||
<text><![CDATA[Chiều cao:]]></text>
|
||||
</element>
|
||||
<element kind="staticText" uuid="a57e7a9d-4ac7-4219-b268-cd08ce943327" x="100" y="150" width="59" height="16" fontName="Times New Roman" fontSize="10.0" bold="true" hTextAlign="Left">
|
||||
<text><![CDATA[Cân nặng:]]></text>
|
||||
</element>
|
||||
<element kind="staticText" uuid="2b9cfd9d-ec8f-4036-9c96-039fd7855e24" x="200" y="150" width="59" height="16" fontName="Times New Roman" fontSize="10.0" bold="true" hTextAlign="Left">
|
||||
<text><![CDATA[Nhịp tim:]]></text>
|
||||
</element>
|
||||
<element kind="staticText" uuid="c1356370-11ce-4b68-97d6-ce6e18e306c5" x="290" y="150" width="59" height="16" fontName="Times New Roman" fontSize="10.0" bold="true" hTextAlign="Left">
|
||||
<text><![CDATA[Huyết áp:]]></text>
|
||||
</element>
|
||||
<element kind="textField" uuid="3e1069a6-daea-45c2-b21f-935b49baba45" x="50" y="150" width="50" height="16" fontName="Times New Roman" fontSize="10.0">
|
||||
<expression><![CDATA[$P{checkupHeight} +" cm"]]></expression>
|
||||
</element>
|
||||
<element kind="textField" uuid="fb080012-3196-4535-bcd2-e87274c66fa5" x="150" y="150" width="50" height="16" fontName="Times New Roman" fontSize="10.0">
|
||||
<expression><![CDATA[$P{checkupWeight} + " kg"]]></expression>
|
||||
</element>
|
||||
<element kind="textField" uuid="e4185ffe-8712-41e3-a9ff-2be6569dff15" x="243" y="150" width="47" height="16" fontName="Times New Roman" fontSize="10.0">
|
||||
<expression><![CDATA[$P{checkupHeartBeat} + " bpm"]]></expression>
|
||||
</element>
|
||||
<element kind="textField" uuid="6b0b21be-2ca3-4594-bbe9-34868e13eb1e" x="335" y="150" width="63" height="16" fontName="Times New Roman" fontSize="10.0">
|
||||
<expression><![CDATA[$P{checkupBloodPressure} +" mmHg"]]></expression>
|
||||
</element>
|
||||
</element>
|
||||
<element kind="frame" uuid="a72ffc70-007e-43af-a566-b34e6e07b312" x="400" y="0" width="400" height="540">
|
||||
<element kind="staticText" uuid="246a04b0-2565-4987-b7f3-dd369703035c" x="0" y="340" width="100" height="30" forecolor="#FF0905" fontName="Times New Roman" fontSize="15.0" bold="true">
|
||||
|
||||
@@ -24,33 +24,41 @@ public class DateLabelFormatter extends JFormattedTextField.AbstractFormatter {
|
||||
if (text == null || text.trim().isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
// Clean up the input text
|
||||
text = text.trim();
|
||||
|
||||
java.util.Date parsedDate;
|
||||
|
||||
// Handle different input formats that users might type
|
||||
if (text.matches("\\d{1,2}/\\d{1,2}/\\d{4}")) {
|
||||
// Standard format: dd/mm/yyyy or d/m/yyyy
|
||||
return dateFormatter.parseObject(text);
|
||||
parsedDate = (java.util.Date) dateFormatter.parseObject(text);
|
||||
} else if (text.matches("\\d{1,2}-\\d{1,2}-\\d{4}")) {
|
||||
// Handle dash format: dd-mm-yyyy
|
||||
text = text.replace("-", "/");
|
||||
return dateFormatter.parseObject(text);
|
||||
parsedDate = (java.util.Date) dateFormatter.parseObject(text);
|
||||
} else if (text.matches("\\d{1,2}\\.\\d{1,2}\\.\\d{4}")) {
|
||||
// Handle dot format: dd.mm.yyyy
|
||||
text = text.replace(".", "/");
|
||||
return dateFormatter.parseObject(text);
|
||||
parsedDate = (java.util.Date) dateFormatter.parseObject(text);
|
||||
} else if (text.matches("\\d{8}")) {
|
||||
// Handle compact format: ddmmyyyy
|
||||
String day = text.substring(0, 2);
|
||||
String month = text.substring(2, 4);
|
||||
String year = text.substring(4, 8);
|
||||
text = day + "/" + month + "/" + year;
|
||||
return dateFormatter.parseObject(text);
|
||||
parsedDate = (java.util.Date) dateFormatter.parseObject(text);
|
||||
} else {
|
||||
// If none of the formats match, try default parsing
|
||||
parsedDate = (java.util.Date) dateFormatter.parseObject(text);
|
||||
}
|
||||
|
||||
// If none of the formats match, try default parsing
|
||||
return dateFormatter.parseObject(text);
|
||||
|
||||
if (parsedDate != null) {
|
||||
Calendar cal = Calendar.getInstance();
|
||||
cal.setTime(parsedDate);
|
||||
return cal;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -14,38 +14,4 @@ import java.util.List;
|
||||
@Slf4j
|
||||
public class GetPatientHistoryResponse implements Packet {
|
||||
private String[][] history;
|
||||
private transient List<PatientHistory> patientHistoryList;
|
||||
|
||||
public GetPatientHistoryResponse(String[][] history) {
|
||||
this.history = history;
|
||||
this.patientHistoryList = convertToPatientHistoryList(history);
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts the raw string array data to a list of PatientHistory objects
|
||||
* @param history Raw patient history data as string arrays
|
||||
* @return List of PatientHistory objects
|
||||
*/
|
||||
private List<PatientHistory> convertToPatientHistoryList(String[][] history) {
|
||||
List<PatientHistory> result = new ArrayList<>();
|
||||
if (history != null) {
|
||||
for (String[] data : history) {
|
||||
if (data.length >= 6) {
|
||||
result.add(new PatientHistory(data));
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the patient history list, converting from raw data if needed
|
||||
* @return List of PatientHistory objects
|
||||
*/
|
||||
public List<PatientHistory> getPatientHistoryList() {
|
||||
if (patientHistoryList == null && history != null) {
|
||||
patientHistoryList = convertToPatientHistoryList(history);
|
||||
}
|
||||
return patientHistoryList;
|
||||
}
|
||||
}
|
||||
@@ -294,7 +294,11 @@ public class ServerHandler extends SimpleChannelInboundHandler<TextWebSocketFram
|
||||
C.conclusion,
|
||||
C.reCheckupDate,
|
||||
D.doctor_last_name,
|
||||
D.doctor_first_name
|
||||
D.doctor_first_name,
|
||||
C.customer_height,
|
||||
C.customer_weight,
|
||||
C.heart_beat,
|
||||
C.blood_pressure
|
||||
FROM Checkup C JOIN Doctor D ON C.doctor_id = D.doctor_id WHERE C.status = ? AND C.customer_id = ?
|
||||
ORDER BY C.checkup_date DESC;
|
||||
""";
|
||||
@@ -311,7 +315,7 @@ public class ServerHandler extends SimpleChannelInboundHandler<TextWebSocketFram
|
||||
} else {
|
||||
ArrayList<String[]> resultList = new ArrayList<>();
|
||||
while (rs.next()) {
|
||||
String[] historyEntry = new String[11]; // Corrected size from 9 to 11
|
||||
String[] historyEntry = new String[15];
|
||||
|
||||
String checkupDateStr = rs.getString("checkup_date");
|
||||
try {
|
||||
@@ -334,6 +338,10 @@ public class ServerHandler extends SimpleChannelInboundHandler<TextWebSocketFram
|
||||
historyEntry[8] = rs.getString("reCheckupDate");
|
||||
historyEntry[9] = rs.getString("doctor_last_name");
|
||||
historyEntry[10] = rs.getString("doctor_first_name");
|
||||
historyEntry[11] = rs.getString("customer_height");
|
||||
historyEntry[12] = rs.getString("customer_weight");
|
||||
historyEntry[13] = rs.getString("heart_beat");
|
||||
historyEntry[14] = rs.getString("blood_pressure");
|
||||
resultList.add(historyEntry);
|
||||
}
|
||||
|
||||
|
||||
Binary file not shown.
Reference in new issue
Block a user