diff --git a/config/app_settings.properties b/config/app_settings.properties new file mode 100644 index 0000000..65249eb --- /dev/null +++ b/config/app_settings.properties @@ -0,0 +1,17 @@ +#BSK Client Application Settings +#Wed Jul 23 13:22:55 ICT 2025 +app.auto_save=false +app.auto_save_interval=5 +app.language=Ti\u1EBFng Vi\u1EC7t +app.theme=T\u1ED1i +backup.auto_enabled=false +backup.frequency=H\u1EB1ng ng\u00E0y +backup.path= +clinic.address=Khu v\u1EF1c 5, th\u1ECB tr\u1EA5n \u0110\u1EE9c H\u00F2a, huy\u1EC7n \u0110\u1EE9c H\u00F2a, t\u1EC9nh Long An +clinic.name=Ph\u00F2ng kh\u00E1m B\u00E1c S\u0129 Kh\u1EAFp +clinic.phone=0912345678 +server.address= +server.auto_connect=false +server.port=1999 +storage.image_path= +storage.pdf_path= diff --git a/config/config.properties b/config/config.properties new file mode 100644 index 0000000..3712df6 --- /dev/null +++ b/config/config.properties @@ -0,0 +1,11 @@ +#BSK Clinic Management System Configuration - Updated via Settings Dialog +#Wed Jul 23 13:42:36 ICT 2025 +clinic.address=S\u1ED1 ABC, \u0110\u01B0\u1EDDng XYZ, Qu\u1EADn 1, TP.HCM +clinic.name=Ph\u00F2ng kh\u00E1m BSK +clinic.phone=0123456789 +google.drive.enabled=true +google.drive.root.folder=BSK_Clinic_Patient_Files +server.address=127.0.0.1 +server.port=1999 +storage.checkup_media_base_dir=src/main/resources/image/checkup_media +storage.image_db_path=img_db diff --git a/logs/bsk_server-1.log.gz b/logs/bsk_server-1.log.gz new file mode 100644 index 0000000..387e3ba Binary files /dev/null and b/logs/bsk_server-1.log.gz differ diff --git a/src/main/java/BsK/client/LocalStorage.java b/src/main/java/BsK/client/LocalStorage.java index f35a567..d6adb58 100644 --- a/src/main/java/BsK/client/LocalStorage.java +++ b/src/main/java/BsK/client/LocalStorage.java @@ -21,6 +21,6 @@ public class LocalStorage { public static String[] wards; public static HashMap provinceToId; public static HashMap districtToId; - public static HashMap cachedDistricts; // cache local areas - public static HashMap cachedWards; // cache local areas + public static HashMap cachedDistricts; // cache local areas later will do + public static HashMap cachedWards; // cache local areas later will do } \ No newline at end of file diff --git a/src/main/java/BsK/client/ui/assets/icon/settings.png b/src/main/java/BsK/client/ui/assets/icon/settings.png new file mode 100644 index 0000000..21dd605 Binary files /dev/null and b/src/main/java/BsK/client/ui/assets/icon/settings.png differ diff --git a/src/main/java/BsK/client/ui/component/CheckUpPage/AddDialog/AddDialog.java b/src/main/java/BsK/client/ui/component/CheckUpPage/AddDialog/AddDialog.java index dde7def..89e24c3 100644 --- a/src/main/java/BsK/client/ui/component/CheckUpPage/AddDialog/AddDialog.java +++ b/src/main/java/BsK/client/ui/component/CheckUpPage/AddDialog/AddDialog.java @@ -41,7 +41,7 @@ public class AddDialog extends JDialog { private JTextField customerAddressField; private DefaultTableModel patientTableModel; private JTable patientTable; - private String[] patientColumns = {"Patient ID", "Patient Name", "Patient Year", "Patient Phone" ,"Patient Address"}; + private String[] patientColumns = {"Mã BN", "Tên Bệnh Nhân", "Năm sinh", "Số điện thoại" ,"Địa chỉ"}; private String[][] patientData; private final ResponseListener getRecentPatientResponseListener = this::getRecentPatientHandler; private final ResponseListener districtResponseListener = this::handleGetDistrictResponse; @@ -77,6 +77,11 @@ public class AddDialog extends JDialog { patientData = response.getPatientData(); patientTableModel.setDataVector(patientData, patientColumns); + // Set column widths: id, name, birthyear, sdt, address + int[] columnWidths = {60, 180, 70, 120, 300}; + for (int i = 0; i < columnWidths.length; i++) { + patientTable.getColumnModel().getColumn(i).setPreferredWidth(columnWidths[i]); + } } private int findProvinceIndex(String province) { @@ -172,7 +177,7 @@ public class AddDialog extends JDialog { } public AddDialog(Frame parent) { - super(parent, "Add Patient", true); + super(parent, "Thêm Bệnh Nhân", true); setDefaultCloseOperation(DISPOSE_ON_CLOSE); // Set size of the dialog @@ -229,6 +234,11 @@ public class AddDialog extends JDialog { patientTable.setFont(textFont); patientTable.setRowHeight(35); patientTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); + // Set column widths: id, name, birthyear, sdt, address + int[] columnWidths = {60, 180, 70, 120, 300}; + for (int i = 0; i < columnWidths.length; i++) { + patientTable.getColumnModel().getColumn(i).setPreferredWidth(columnWidths[i]); + } JScrollPane scrollPane = new JScrollPane(patientTable); patientTable.addMouseListener(new MouseAdapter() { @@ -441,7 +451,7 @@ public class AddDialog extends JDialog { gbc.gridx = 2; gbc.gridwidth = 2; gbc.weightx = 0.5; - clearButton = new JButton("Clear"); + clearButton = new JButton("Làm mới"); clearButton.setFont(textFont); checkupInfoPanel.add(clearButton, gbc); gbc.weightx = 0.0; // Reset weightx @@ -583,14 +593,14 @@ public class AddDialog extends JDialog { JPanel ButtonPanel = new JPanel(); - JButton closeButton = new JButton("Close"); + JButton closeButton = new JButton("Đóng"); closeButton.setFont(labelFont); closeButton.addActionListener(e -> { setVisible(false); }); ButtonPanel.add(closeButton); - saveButton = new JButton("Add to Checkup"); + saveButton = new JButton("Thêm vào khám"); saveButton.setFont(labelFont); saveButton.addActionListener(e -> { int patientId = Integer.parseInt(patientIdField.getText()); @@ -646,7 +656,7 @@ public class AddDialog extends JDialog { String lastNameStr = lastName.toString(); // check if dobPicker is not null if (patientName.isEmpty() || patientPhone.isEmpty() || customerAddress.isEmpty() || dobPicker.getJFormattedTextField().getText().isEmpty()) { - JOptionPane.showMessageDialog(this, "Please fill in all fields"); + JOptionPane.showMessageDialog(this, "Vui lòng điền đầy đủ thông tin"); return; } @@ -660,7 +670,7 @@ public class AddDialog extends JDialog { patientPhone, address, patientGender, cccd)); } catch (ParseException pe) { pe.printStackTrace(); - JOptionPane.showMessageDialog(null, "Invalid date format: " + dateText); + JOptionPane.showMessageDialog(null, "Định dạng ngày không hợp lệ: " + dateText); } }); @@ -765,7 +775,7 @@ public class AddDialog extends JDialog { dobPicker.getModel().setSelected(true); } catch (ParseException | NumberFormatException exception) { exception.printStackTrace(); - JOptionPane.showMessageDialog(null, "Invalid date format: " + patientDob); + JOptionPane.showMessageDialog(null, "Định dạng ngày không hợp lệ: " + patientDob); } saveButton.setEnabled(true); // Enable button after successfully populating fields addPatientButton.setEnabled(false); // Disable add patient button when a patient is selected @@ -850,7 +860,7 @@ public class AddDialog extends JDialog { frame.setLayout(new BorderLayout()); frame.setVisible(true); - JButton openDialogButton = new JButton("Open Dialog"); + JButton openDialogButton = new JButton("Mở Dialog"); openDialogButton.addActionListener(e -> { AddDialog dialog = new AddDialog(frame); dialog.setVisible(true); diff --git a/src/main/java/BsK/client/ui/component/CheckUpPage/CheckUpPage.java b/src/main/java/BsK/client/ui/component/CheckUpPage/CheckUpPage.java index 74ab076..8506449 100644 --- a/src/main/java/BsK/client/ui/component/CheckUpPage/CheckUpPage.java +++ b/src/main/java/BsK/client/ui/component/CheckUpPage/CheckUpPage.java @@ -192,6 +192,10 @@ public class CheckUpPage extends JPanel { private JButton openQueueButton; private JButton addPatientButton; private JButton[] actionButtons; + + // Template info labels + private JLabel imageCountValueLabel; + private JLabel genderValueLabel; private QueueViewPage tvQueueFrame; private QueueManagementPage queueManagementPage; // The new queue window @@ -934,15 +938,40 @@ public class CheckUpPage extends JPanel { templateComboBox.addActionListener(e -> handleTemplateSelection()); templatePanel.add(templateComboBox, gbcTemplate); + // Add template info labels between template selection and orientation + gbcTemplate.gridx = 2; gbcTemplate.weightx = 0.0; + JLabel imageCountInfoLabel = new JLabel("SL ảnh:"); + imageCountInfoLabel.setFont(new Font("Arial", Font.PLAIN, 12)); + imageCountInfoLabel.setForeground(new Color(100, 100, 100)); + templatePanel.add(imageCountInfoLabel, gbcTemplate); + + gbcTemplate.gridx = 3; + imageCountValueLabel = new JLabel("-"); + imageCountValueLabel.setFont(new Font("Arial", Font.BOLD, 12)); + imageCountValueLabel.setForeground(new Color(63, 81, 181)); + templatePanel.add(imageCountValueLabel, gbcTemplate); + + gbcTemplate.gridx = 4; + JLabel genderInfoLabel = new JLabel("Giới:"); + genderInfoLabel.setFont(new Font("Arial", Font.PLAIN, 12)); + genderInfoLabel.setForeground(new Color(100, 100, 100)); + templatePanel.add(genderInfoLabel, gbcTemplate); + + gbcTemplate.gridx = 5; + genderValueLabel = new JLabel("-"); + genderValueLabel.setFont(new Font("Arial", Font.BOLD, 12)); + genderValueLabel.setForeground(new Color(63, 81, 181)); + templatePanel.add(genderValueLabel, gbcTemplate); + // Add "Thêm mẫu" button next to template combobox // Add orientation dropdown - gbcTemplate.gridx = 2; gbcTemplate.weightx = 0.0; + gbcTemplate.gridx = 6; gbcTemplate.weightx = 0.0; JLabel orientationLabel = new JLabel("Hướng in:"); orientationLabel.setFont(labelFont); templatePanel.add(orientationLabel, gbcTemplate); - gbcTemplate.gridx = 3; + gbcTemplate.gridx = 7; orientationComboBox = new JComboBox<>(new String[]{"ngang", "dọc"}); orientationComboBox.setFont(fieldFont); orientationComboBox.setPreferredSize(new Dimension(80, 25)); @@ -952,7 +981,7 @@ public class CheckUpPage extends JPanel { templatePanel.add(orientationComboBox, gbcTemplate); // Add template button - gbcTemplate.gridx = 4; gbcTemplate.weightx = 0.0; + gbcTemplate.gridx = 8; gbcTemplate.weightx = 0.0; JButton addTemplateButton = new JButton("Thêm mẫu"); addTemplateButton.setFont(fieldFont); addTemplateButton.setBackground(new Color(63, 81, 181)); @@ -986,7 +1015,7 @@ public class CheckUpPage extends JPanel { notesField = new JTextPane(); notesField.setContentType("text/rtf"); - addSelectAllOnFocus(notesField); + // addSelectAllOnFocus(notesField); // Do NOT select all for notes field // Set default font and size notesField.setFont(new Font("Times New Roman", Font.PLAIN, 16)); @@ -4379,6 +4408,9 @@ public class CheckUpPage extends JPanel { if (selectedTemplateName == null || allTemplates == null || selectedTemplateName.equals("Không sử dụng mẫu")) { // Reset orientation to landscape when no template is selected orientationComboBox.setSelectedItem("ngang"); + // Clear template info when no template is selected + imageCountValueLabel.setText("-"); + genderValueLabel.setText("-"); return; } @@ -4409,12 +4441,28 @@ public class CheckUpPage extends JPanel { templateContent = template.getContent(); templateConclusion = template.getConclusion(); templateSuggestion = template.getSuggestion(); + + // Update template info labels + imageCountValueLabel.setText(template.getPhotoNum()); + genderValueLabel.setText(template.getTemplateGender()); } private void handleGetAllTemplatesResponse(GetAllTemplatesRes response) { log.info("Get all templates response"); this.allTemplates = response.getTemplates(); List