/** Creates new form ViewJPanel */ public ViewJPanel(Profile profile, VitalSignHistory vitalSignHistory) { initComponents(); this.profile = profile; this.vitalSignHistory = vitalSignHistory; pNameTextField.setText(profile.getpName()); pIDTextField.setText(profile.getpID()); ageTextField.setText(String.valueOf(profile.getAge())); docNameTextField.setText(profile.getDocName()); pharmacyTextField.setText(profile.getPharmacy()); pNameTextField.disable(); pIDTextField.disable(); ageTextField.disable(); docNameTextField.disable(); pharmacyTextField.disable(); respRateTextField.disable(); heartRateTextField.disable(); bpTextField.disable(); weightTextField.disable(); timeTextField.disable(); populateTable(); }
public void populateTable() { DefaultTableModel dtm = (DefaultTableModel) vitalSignTable.getModel(); dtm.setRowCount(0); for (VitalSign vs : vitalSignHistory.getVitalSignList()) { Object row[] = new Object[6]; row[0] = vs.getRespRate(); row[1] = vs.getHeartRate(); row[2] = vs.getBp(); row[3] = vs.getWeight(); row[4] = vs; if (profile.getAge() >= 1 && profile.getAge() <= 3) { if (((vs.getRespRate() < 20) || (vs.getRespRate() > 30)) || (vs.getHeartRate() < 80) || (vs.getHeartRate() > 130) || (vs.getBp() < 80) || (vs.getBp() > 110) || (vs.getWeight() < 22) || (vs.getWeight() > 31)) { row[5] = "Abnormal"; } else { row[5] = "Normal"; } } else if (profile.getAge() >= 4 && profile.getAge() <= 5) { if (((vs.getRespRate() < 20) || (vs.getRespRate() > 30)) || (vs.getHeartRate() < 80) || (vs.getHeartRate() > 120) || (vs.getBp() < 80) || (vs.getBp() >= 110) || (vs.getWeight() < 31) || (vs.getWeight() > 40)) { row[5] = "Abormal"; } else { row[5] = "Normal"; } } else if (profile.getAge() >= 6 && profile.getAge() <= 12) { if (((vs.getRespRate() < 20) || (vs.getRespRate() > 30)) || (vs.getHeartRate() < 70) || (vs.getHeartRate() > 110) || (vs.getBp() < 80) || (vs.getBp() >= 120) || (vs.getWeight() < 41) || (vs.getWeight() >= 92)) { row[5] = "Abnormal"; } else { row[5] = "Normal"; } } else { if (((vs.getRespRate() < 12) || (vs.getRespRate() > 20)) || (vs.getHeartRate() < 55) || (vs.getHeartRate() > 105) || (vs.getBp() < 110) || (vs.getBp() >= 120) || (vs.getWeight() > 110)) { row[5] = "Abnormal"; } else { row[5] = "Normal"; } } dtm.addRow(row); } }