Kode Sumber Aplikasi Implementasi Aplikasi

89

5.2 Implementasi Aplikasi

Tahap implementasi aplikasi menjadi salah satu bagian utama dalam pengembangan Sistem Pakar Pemantau Kondisi Pasien Rawat Inap Menggunakan Fuzzy Inferensi Tsukamoto. Implementasi aplikasi meliputi implementasi pada bagian kode sumber aplikasi back end dan implementasi antarmuka aplikasi front end. Berikut ini uraian masing-masing bagian pada tahap implementasi aplikasi.

5.2.1 Kode Sumber Aplikasi

Sistem Pakar Pemantau Kondisi Pasien Rawat Inap ini dibangun menggunakan bahasa Java dan dalam implemetasinya, sistem ini dibangun dengan menerapkan konsep pemrograman berorientasi objek. Dibawah ini kode sumber aplikasi. 5.2.1.1 BloodSugar.java package engine; import ui.MainWindow; import java.util.ArrayList; public class BloodSugar { private double bloodSugar; private final int[] bloodSugarLinguistic = {-3,- 2,0,2,3}; private ArrayListInteger linguistic = new ArrayListInteger; private MainWindow mainWindow; public BloodSugar double bloodSugar, MainWindow mainWindow{ this.bloodSugar = bloodSugar; this.mainWindow = mainWindow; } public BloodSugar { } 90 public double GetBS { return bloodSugar; } public int[] getBloodSugarLinguistic { return bloodSugarLinguistic; } public void SetBSdouble BS { this.bloodSugar = BS; } public void clearLinguistik{ this.linguistic.clear; } public int[] convertLinguistik{ int[] adjacent = new int[this.linguistic.size]; int count = 0; for Integer n : this.linguistic{ adjacent[count++] = n.intValue; } return adjacent; } public void setLinguistikdouble BS { mainWindow.setHasilTextBS : +this.bloodSugar+\n; ifBS 66{ this.linguistic.add-3; mainWindow.setHasilTextBS : +this.convertToString-3+\n; } ifBS = 63 BS = 72{ this.linguistic.add-2; mainWindow.setHasilTextBS : +this.convertToString-2+\n; } ifBS = 70 BS = 110{ this.linguistic.add0; mainWindow.setHasilTextBS : +this.convertToString0+\n; } ifBS = 106 BS = 150{ this.linguistic.add2; 91 mainWindow.setHasilTextBS : +this.convertToString2+\n; } ifBS 140{ this.linguistic.add3; mainWindow.setHasilTextBS : +this.convertToString3+\n; } } public double selectionRuleint value{ ifvalue==-3{ returnlow3; }else ifvalue==-2{ returnlow2; }else ifvalue==0{ returnnormal0; }else ifvalue==2{ returnhigh2; }else ifvalue==3{ returnhigh3; } else return 0; } public double low3{ if bloodSugar = 63{ return 1; } else ifbloodSugar 63 bloodSugar 66{ return 66-bloodSugar3; }else { return 0; } } public double low2{ if bloodSugar = 63 bloodSugar 66{ return bloodSugar-633; }else ifbloodSugar = 66 bloodSugar 70{ return 1; }else if bloodSugar = 70 bloodSugar = 72{ return 72-bloodSugar2; }else { return 0; } 92 } public double normal0{ if bloodSugar = 70 bloodSugar 72{ return bloodSugar-702; }else ifbloodSugar = 72 bloodSugar 106{ return 1; }else if bloodSugar = 106 bloodSugar = 110{ return 110-bloodSugar4; }else { return 0; } } public double high2{ if bloodSugar = 106 bloodSugar 110{ return bloodSugar-1064; }else ifbloodSugar = 110 bloodSugar 140{ return 1; }else if bloodSugar = 140 bloodSugar = 150{ return 150-bloodSugar10; }else { return 0; } } public double high3{ if bloodSugar = 150{ return 1; } else if bloodSugar 140 bloodSugar 150{ return bloodSugar-14010; } else{ return 0; } } private String convertToStringint value{ ifvalue==-3{ return low3; }else ifvalue==-2{ return low2; }else ifvalue==-1{ return low1; }else ifvalue==0{ return normal; 93 }else ifvalue==1{ return high1; }else ifvalue==2{ return high2; }else ifvalue==3{ return high3; }else return ; } } 5.2.1.2 HeartRate.java package engine; import ui.MainWindow; import java.util.ArrayList; public class HeartRate { private double heartRate; private final int[] heartRateLinguistic = {-2,- 1,0,1,2,3}; private ArrayListInteger linguistic = new ArrayListInteger; private MainWindow mainWindow; public HeartRatedouble heartRate, MainWindow mainWindow{ this.heartRate = heartRate; this.mainWindow = mainWindow; } public HeartRate { } public double GetHR { return heartRate; } public int[] getHeartRateLinguistic { return heartRateLinguistic; } public void SetHRdouble HR { this.heartRate = HR; 94 } public void clearLinguistik{ this.linguistic.clear; } public int[] convertLinguistik{ int[] adjacent = new int[this.linguistic.size]; int count = 0; for Integer n : this.linguistic{ adjacent[count++] = n.intValue; } return adjacent; } public void setLinguistikdouble HR { mainWindow.setHasilTextHR : +this.heartRate+\n; ifHR 50{ this.linguistic.add-2; mainWindow.setHasilTextHR : +this.convertToString-2+\n; } ifHR = 45 HR = 60{ this.linguistic.add-1; mainWindow.setHasilTextHR : +this.convertToString-1+\n; } ifHR = 53 HR = 100{ this.linguistic.add0; mainWindow.setHasilTextHR : +this.convertToString0+\n; } ifHR = 95 HR = 110{ this.linguistic.add1; mainWindow.setHasilTextHR : +this.convertToString1+\n; } ifHR = 105 HR = 130{ this.linguistic.add2; mainWindow.setHasilTextHR : +this.convertToString2+\n; } ifHR 125{ this.linguistic.add3; 95 mainWindow.setHasilTextHR : +this.convertToString3+\n; } } public double selectionRuleint value{ ifvalue==-2{ returnlow2; }else ifvalue==-1{ returnlow1; }else ifvalue==0{ returnnormal0; }else ifvalue==1{ returnhigh1; }else ifvalue==2{ returnhigh2; }else ifvalue==3{ returnhigh3; } else return 0; } public double low2{ if heartRate = 45{ return 1; } else ifheartRate 45 heartRate 50{ return 50-heartRate5; }else { return 0; } } public double low1{ if heartRate = 45 heartRate 50{ return heartRate-455; }else ifheartRate = 50 heartRate 53{ return 1; }else if heartRate = 53 heartRate = 60{ return 60-heartRate7; }else { return 0; } } public double normal0{ 96 if heartRate = 53 heartRate 60{ return heartRate-537; }else ifheartRate = 60 heartRate 95{ return 1; }else if heartRate =95 heartRate = 100{ return 100-heartRate5; }else { return 0; } } public double high1{ if heartRate = 95 heartRate 100{ return heartRate-955; }else ifheartRate = 100 heartRate 105{ return 1; }else if heartRate = 105 heartRate = 110{ return 110-heartRate5; }else { return 0; } } public double high2{ if heartRate = 105 heartRate 110{ return heartRate-1055; }else ifheartRate = 110 heartRate 125{ return 1; }else if heartRate = 125 heartRate = 130{ return 130-heartRate5; }else { return 0; } } public double high3{ if heartRate = 130{ return 1; } else if heartRate 125 heartRate 130{ return heartRate-1255; } else{ return 0; } } 97 private String convertToStringint value{ ifvalue==-3{ return low3; }else ifvalue==-2{ return low2; }else ifvalue==-1{ return low1; }else ifvalue==0{ return normal; }else ifvalue==1{ return high1; }else ifvalue==2{ return high2; }else ifvalue==3{ return high3; }else return ; } } 5.2.1.3 SystolicBloodPressure.java package engine; import ui.MainWindow; import java.util.ArrayList; public class SystolicBloodPressure { private double systolicBloodPressure; private final int[] sbpLinguistic = {-3,-2,-1,0,2}; private ArrayListInteger linguistic = new ArrayListInteger; private MainWindow mainWindow; public SystolicBloodPressure double systolicBloodPressure, MainWindow mainWindow{ this.systolicBloodPressure = systolicBloodPressure; this.mainWindow = mainWindow; } public SystolicBloodPressure { } public double GetSBP { return systolicBloodPressure; } 98 public int[] getSbpLinguistic { return sbpLinguistic; } public void SetSBPdouble SBP { this.systolicBloodPressure = SBP; } public void clearLinguistik{ this.linguistic.clear; } public int[] convertLinguistik{ int[] adjacent = new int[this.linguistic.size]; int count = 0; for Integer n : this.linguistic{ adjacent[count++] = n.intValue; } return adjacent; } public void setLinguistikdouble SBP { mainWindow.setHasilTextSBP : +this.systolicBloodPressure+\n; ifSBP 75{ this.linguistic.add-3; mainWindow.setHasilTextSBP : +this.convertToString-3+\n; } ifSBP = 70 SBP = 85{ this.linguistic.add-2; mainWindow.setHasilTextSBP : +this.convertToString-2+\n; } ifSBP = 80 SBP = 100{ this.linguistic.add-1; mainWindow.setHasilTextSBP : +this.convertToString-1+\n; } ifSBP = 95 SBP = 199{ this.linguistic.add0; mainWindow.setHasilTextSBP : +this.convertToString0+\n; } 99 ifSBP 185{ this.linguistic.add2; mainWindow.setHasilTextSBP : +this.convertToString2+\n; } } public double selectionRuleint value{ ifvalue==-3{ returnlow3; }else ifvalue==-2{ returnlow2; }else ifvalue==-1{ returnlow1; }else ifvalue==0{ returnnormal0; }else ifvalue==2{ returnhigh2; } else return 0; } public double low3{ if systolicBloodPressure 70{ return 1; } else ifsystolicBloodPressure = 70 systolicBloodPressure 75{ return 75-systolicBloodPressure5; }else { return 0; } } public double low2{ if systolicBloodPressure = 70 systolicBloodPressure 75{ return systolicBloodPressure-705; }else ifsystolicBloodPressure = 75 systolicBloodPressure 80{ return 1; }else if systolicBloodPressure = 80 systolicBloodPressure = 85{ return 85-systolicBloodPressure5; }else { return 0; 100 } } public double low1{ if systolicBloodPressure = 80 systolicBloodPressure 85{ return systolicBloodPressure-805; }else ifsystolicBloodPressure = 85 systolicBloodPressure 95{ return 1; }else if systolicBloodPressure = 95 systolicBloodPressure = 100{ return 100-systolicBloodPressure5; }else { return 0; } } public double normal0{ if systolicBloodPressure = 95 systolicBloodPressure 100{ return systolicBloodPressure-955; }else ifsystolicBloodPressure = 100 systolicBloodPressure 185{ return 1; }else if systolicBloodPressure = 185 systolicBloodPressure = 199{ return 199-systolicBloodPressure14; }else { return 0; } } public double high2{ if systolicBloodPressure = 199{ return 1; } else if systolicBloodPressure 185 systolicBloodPressure 199{ return systolicBloodPressure-18514; } else{ return 0; } } private String convertToStringint value{ 101 ifvalue==-3{ return low3; }else ifvalue==-2{ return low2; }else ifvalue==-1{ return low1; }else ifvalue==0{ return normal; }else ifvalue==1{ return high1; }else ifvalue==2{ return high2; }else ifvalue==3{ return high3; }else return ; } } 5.2.1.4 OxygenSaturation.java package engine; import ui.MainWindow; import java.util.ArrayList; public class OxygenSaturation { private double oxygenSaturation; private final int[] oxygenSaturationLinguistic = {-3,- 2,-1,0}; private ArrayListInteger linguistic = new ArrayListInteger; private MainWindow mainWindow; public OxygenSaturation double oxygenSaturation, MainWindow mainWindow{ this.oxygenSaturation= oxygenSaturation; this.mainWindow = mainWindow; } public OxygenSaturation { } public double GetSPO2 { return oxygenSaturation; } 102 public int[] getOxygenSaturationLinguistic { return oxygenSaturationLinguistic; } public void SetSPO2double SPO2 { this.oxygenSaturation = SPO2; } public void clearLinguistik{ this.linguistic.clear; } public int[] convertLinguistik{ int[] adjacent = new int[this.linguistic.size]; int count = 0; for Integer n : this.linguistic{ adjacent[count++] = n.intValue; } return adjacent; } public void setLinguistikdouble SPO2 { mainWindow.setHasilTextSPO2 : +this.oxygenSaturation+\n; ifSPO2 85{ this.linguistic.add-3; mainWindow.setHasilTextSPO2 : +this.convertToString-3+\n; } ifSPO2 = 83 SPO2 = 90{ this.linguistic.add-2; mainWindow.setHasilTextSPO2 : +this.convertToString-2+\n; } ifSPO2 = 87 SPO2 = 95{ this.linguistic.add-1; mainWindow.setHasilTextSPO2 : +this.convertToString-1+\n; } ifSPO2 93{ this.linguistic.add0; mainWindow.setHasilTextSPO2 : +this.convertToString0+\n; } 103 } public double selectionRuleint value{ ifvalue==-3{ returnlow3; }else ifvalue==-2{ returnlow2; }else ifvalue==-1{ returnlow1; }else ifvalue==0{ returnnormal0; } else return 0; } public double low3{ if oxygenSaturation = 83{ return 1; } else ifoxygenSaturation 83 oxygenSaturation 85{ return 85-oxygenSaturation2; }else { return 0; } } public double low2{ if oxygenSaturation =83 oxygenSaturation 85{ return oxygenSaturation-832; }else ifoxygenSaturation = 85 oxygenSaturation 87{ return 1; }else if oxygenSaturation = 87 oxygenSaturation = 90{ return 90-oxygenSaturation3; }else { return 0; } } public double low1{ if oxygenSaturation = 87 oxygenSaturation 90{ return oxygenSaturation-873; }else ifoxygenSaturation = 90 oxygenSaturation 93{ 104 return 1; }else if oxygenSaturation = 93 oxygenSaturation = 95{ return 95-oxygenSaturation2; }else { return 0; } } public double normal0{ if oxygenSaturation = 95{ return 1; } else if oxygenSaturation 93 oxygenSaturation 95{ return oxygenSaturation-932; } else{ return 0; } } private String convertToStringint value{ ifvalue==-3{ return low3; }else ifvalue==-2{ return low2; }else ifvalue==-1{ return low1; }else ifvalue==0{ return normal; }else ifvalue==1{ return high1; }else ifvalue==2{ return high2; }else ifvalue==3{ return high3; }else return ; } } 5.2.1.5 Temperature.java package engine; import ui.MainWindow; 105 import java.util.ArrayList; public class Temperature { private double temperature; private final int[] temperatureLinguistic = {-2,0,2}; private ArrayListInteger linguistic = new ArrayListInteger; private MainWindow mainWindow; public Temperature double temperature, MainWindow mainWindow{ this.temperature = temperature; this.mainWindow = mainWindow; } public Temperature { } public double GetTEMP { return temperature; } public int[] getTemperatureLinguistic { return temperatureLinguistic; } public void SetTEMPdouble TEMP { this.temperature = TEMP; } public void clearLinguistik{ this.linguistic.clear; } public int[] convertLinguistik{ int[] adjacent = new int[this.linguistic.size]; int count = 0; for Integer n : this.linguistic{ adjacent[count++] = n.intValue; } return adjacent; } public void setLinguistikdouble TEMP { mainWindow.setHasilTextTEMP : 106 +this.temperature+\n; ifTEMP 36.5{ this.linguistic.add-2; mainWindow.setHasilTextTEMP : +this.convertToString-2+\n; } ifTEMP = 36 TEMP = 38.5{ this.linguistic.add0; mainWindow.setHasilTextTEMP : +this.convertToString0+\n; } ifTEMP 38{ this.linguistic.add2; mainWindow.setHasilTextTEMP : +this.convertToString2+\n; } } public double selectionRuleint value{ ifvalue==-2{ returnlow2; }else ifvalue==0{ returnnormal0; }else ifvalue==2{ returnhigh2; } else return 0; } public double low2{ if temperature = 36{ return 1; } else iftemperature 36 temperature 36.5{ return 36.5-temperature0.5; }else { return 0; } } public double normal0{ if temperature = 36 temperature 36.5 { return temperature-360.5; } else if temperature =36.5 temperature 38 { return 1; } else if temperature =38 temperature = 38.5 107 { return 38.5-temperature0.5; }else{ return 0; } } public double high2{ if temperature = 38.5{ return 1; } else if temperature 38 temperature 38.5{ return temperature-380.5; } else{ return 0; } } private String convertToStringint value{ ifvalue==-3{ return low3; }else ifvalue==-2{ return low2; }else ifvalue==-1{ return low1; }else ifvalue==0{ return normal; }else ifvalue==1{ return high1; }else ifvalue==2{ return high2; }else ifvalue==3{ return high3; }else return ; } } 5.2.1.6 Risk.java package engine; public class Risk { private int Risk; public Riskint Risk { this.Risk = Risk; 108 } public Risk { } public int getRisk { return Risk; } public void setRiskint Risk { this.Risk = Risk; } } 5.2.1.7 RiskPrediction.java package engine; import ui.MainWindow; import java.sql.ResultSet; import java.sql.SQLException; import java.text.DecimalFormat; import java.util.logging.Level; import java.util.logging.Logger; public class RiskPrediction { private double sbpValue, heartRateValue, spo2Value, tempValue, bloodSugarValue; private double alpha[] = new double[50]; private double Z[] = new double[50]; private int[] Lsbp,Lhr,Lspo2,Ltemp,Lbs; private int[] str=new int[7]; private ResultSet rs=null; private DBConnection strconn = null; private MainWindow pcm; public RiskPredictiondouble systolicBloodPressure, double heartRate, double oxygenSaturation, double temperature, double bloodSugar, DBConnection startConn, MainWindow mainWindow { this.sbpValue = systolicBloodPressure; this.heartRateValue = heartRate; this.spo2Value = oxygenSaturation; this.tempValue = temperature; 109 this.bloodSugarValue = bloodSugar; this.strconn = startConn; this.pcm = mainWindow; } private double findMindouble a, double b, double c, double d, double e { if a b a c a d a e { return a; } else if b a b c b d b e { return b; } else if c a c b c d c e { return c; } else if d a d b d c d e{ return d; }else if e a e b e c e d{ return e; }else if a==b b==c c==d d==e{ return a; }else { return 0; } } private int applyRule { SystolicBloodPressure SBP = new SystolicBloodPressuresbpValue, this.pcm; HeartRate HR = new HeartRateheartRateValue, this.pcm; OxygenSaturation SPO2 = new OxygenSaturationspo2Value, this.pcm; Temperature TEMP = new TemperaturetempValue, this.pcm; BloodSugar BS = new BloodSugarbloodSugarValue, this.pcm; Risk risk = new Risk; int count=0; pcm.ClearHasilText; pcm.setHasilText Proses \n\n\n; pcm.setHasilText=== Fuzzifikasi ===\n; SBP.setLinguistikthis.sbpValue; Lsbp=SBP.convertLinguistik; 110 SBP.clearLinguistik; pcm.setHasilText\n; HR.setLinguistikthis.heartRateValue; Lhr=HR.convertLinguistik; HR.clearLinguistik; pcm.setHasilText\n; SPO2.setLinguistikthis.spo2Value; Lspo2=SPO2.convertLinguistik; SPO2.clearLinguistik; pcm.setHasilText\n; TEMP.setLinguistikthis.tempValue; Ltemp=TEMP.convertLinguistik; TEMP.clearLinguistik; pcm.setHasilText\n; BS.setLinguistikthis.bloodSugarValue; Lbs=BS.convertLinguistik; BS.clearLinguistik; pcm.setHasilText\n\n; pcm.setHasilText=== Selection Rule ===\n; forint a=0;aLsbp.length;a++{ forint b=0;bLhr.length;b++{ forint c=0;cLspo2.length;c++{ forint d=0;dLtemp.length;d++{ forint e=0;eLbs.length;e++{ rs = strconn.querySELECT from rule where SBP=+Lsbp[a]+ AND HR=+Lhr[b]+ AND SPO2=+Lspo2[c]+ AND TEMP=+Ltemp[d]+ AND BS=+Lbs[e]+; try { while rs.next { str[0]=rs.getInt1; str[1]=rs.getInt2; str[2]=rs.getInt3; str[3]=rs.getInt4; str[4]=rs.getInt5; str[5]=rs.getInt6; 111 str[6]=rs.getInt7; } } catch SQLException ex { Logger.getLoggerRiskPrediction.class.getName.logLevel.S EVERE, null, ex; } pcm.setProsessTextRule No.+str[0]+ = If SBP=+this.convertToStringstr[1]+ and HR=+this.convertToStringstr[2]+ and SPO2=+this.convertToStringstr[3]+ and TEMP=+this.convertToStringstr[4]+ and BS=+this.convertToStringstr[5]+ THEN EWS SCORE=+str[6]+\n; pcm.setHasilTextRule No.+str[0]+ = If SBP=+this.convertToStringstr[1]+ and HR=+this.convertToStringstr[2]+ and SPO2=+this.convertToStringstr[3]+ and TEMP=+this.convertToStringstr[4]+ and BS=+this.convertToStringstr[5]+ THEN EWS SCORE=+str[6]+\n; pcm.setHasilTextmiu SBP +this.convertToStringstr[1]+ = +SBP.selectionRulestr[1]+\n; pcm.setHasilTextmiu HR +this.convertToStringstr[2]+ = +HR.selectionRulestr[2]+\n; pcm.setHasilTextmiu SPO2 +this.convertToStringstr[3]+ = +SPO2.selectionRulestr[3]+\n; pcm.setHasilTextmiu TEMP +this.convertToStringstr[4]+ = +TEMP.selectionRulestr[4]+\n; pcm.setHasilTextmiu BS +this.convertToStringstr[5]+ = +BS.selectionRulestr[5]+\n\n; alpha[count]=findMinSBP.selectionRulestr[1], HR.selectionRulestr[2], SPO2.selectionRulestr[3], TEMP.selectionRulestr[4], BS.selectionRulestr[5]; Z[count]=str[6]; count++; } } 112 } } } return count; } private String convertToStringint value{ ifvalue==-3{ return low3; }else ifvalue==-2{ return low2; }else ifvalue==-1{ return low1; }else ifvalue==0{ return normal; }else ifvalue==1{ return high1; }else ifvalue==2{ return high2; }else ifvalue==3{ return high3; }else return ; } public double getRiskPrediction { int count = 0; count = applyRule; return defuzzycount; } private double defuzzyint count { pcm.setHasilText\n; pcm.setHasilText=== Defuzzifikasi ===\n; DecimalFormat bulat = new DecimalFormat.; double a = 0, temp1 = 0, temp2 = 0; double hasil1,hasil2; pcm.setHasilTextEWS Score = ; for int i = 0; i count; i++ { temp1 = temp1+ alpha[i] Z[i]; temp2 = temp2 + alpha[i]; ifi = count- 1pcm.setHasilText+alpha[i]++Z[i]++; else 113 pcm.setHasilText+alpha[i]++Z[i]+; } pcm.setHasilText; for int i = 0; i count; i++ { ifi = count-1pcm.setHasilTextalpha[i]++; else pcm.setHasilText+alpha[i]; } pcm.setHasilText\n; hasil1 = temp1 temp2; hasil2 = Double.valueOfbulat.formathasil1; pcm.setHasilTextEWS Score = +hasil1; return hasil1; } } 5.2.1.8 PCMFuzzy.java package engine; import ui.MainWindow; public class PCMFuzzy { private double systolicBloodPressure, heartRate, oxygenSaturation, temperature, bloodSugar; private String assesment, keterangan; private DBConnection startConn = null; private MainWindow mainWindow; public PCMFuzzydouble systolicBloodPressure, double heartRate, double oxygenSaturation, double temperature, double bloodSugar, DBConnection startConn, MainWindow mainWindow { this.systolicBloodPressure = systolicBloodPressure; this.heartRate = heartRate; this.oxygenSaturation = oxygenSaturation; this.temperature = temperature; this.bloodSugar = bloodSugar; this.mainWindow= mainWindow; this.startConn = startConn; } public double getSystolicBloodPressure { return systolicBloodPressure; 114 } public void setPemrintaandouble SBP { this.systolicBloodPressure = SBP; } public double getHeartRate { return heartRate; } public void setHeartRatedouble heartRate { this.heartRate = heartRate; } public double getOxygenSaturation { return oxygenSaturation; } public void setOxygenSaturationdouble oxygenSaturation { this.oxygenSaturation = oxygenSaturation; } public double getRiskPrediction{ return new RiskPredictionsystolicBloodPressure,heartRate,oxygenSaturat ion,temperature,bloodSugar,startConn, mainWindow.getRiskPrediction; } } 5.2.1.9 DBConnection.java package engine; import com.mysql.jdbc.Connection; import com.mysql.jdbc.Statement; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.SQLException; public class DBConnection { private Connection conn = null; 115 public DBConnectionString host, String username, String password{ try { this.conn = Connection DriverManager.getConnectionhost,username,password; System.out.printlnConnected; } catch SQLException ex { System.out.printlnNot Connected; } } public ResultSet queryString sql{ ResultSet rs = null; try { Statement statement = Statement conn.createStatement; rs = statement.executeQuerysql; } catch SQLException ex {} return rs; } public void dmlQueryString sql{ try { Statement statement = Statement conn.createStatement; statement.executeUpdatesql; } catch SQLException ex {} } } 5.2.1.10 LoginWindow.java package ui; import engine.DBConnection; import java.awt.Dimension; import java.awt.Toolkit; import java.sql.Connection; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; 116 import javax.swing.JOptionPane; public class LoginWindow extends javax.swing.JFrame { Connection Con; ResultSet resultSet; Statement statement; DBConnection startConn = null; public LoginWindow { initComponents; initDB; } public void initDB{ String hosttext=localhost; String databasetext=pcm; String usernametext=root; String passwordtext=My Lab1; try { Class.forNamecom.mysql.jdbc.Driver; } catch Exception ex { System.err.printlnError 1: + ex; System.exit1; } startConn = new DBConnectionjdbc:mysql:+hosttext+:3306+databasetext, usernametext,passwordtext; } SuppressWarningsunchecked private void initComponents { usernameLabel = new javax.swing.JLabel; usernameField = new javax.swing.JTextField; passwordLabel = new javax.swing.JLabel; loginButton = new javax.swing.JButton; passwordField = new javax.swing.JPasswordField; jLabel1 = new javax.swing.JLabel; jLabel2 = new javax.swing.JLabel; jSeparator1 = new javax.swing.JSeparator; 117 setDefaultCloseOperationjavax.swing.WindowConstants.EXIT_ON _CLOSE; usernameLabel.setTextUsername; passwordLabel.setTextPassword; loginButton.setTextLog In; loginButton.addActionListenernew java.awt.event.ActionListener { public void actionPerformedjava.awt.event.ActionEvent evt { loginButtonActionPerformedevt; } }; jLabel1.setTextSilahkan log in untuk masuk ke Sistem Pakar; jLabel2.setTextPemantau Kondisi Pasien Rawat Inap; javax.swing.GroupLayout layout = new javax.swing.GroupLayoutgetContentPane; getContentPane.setLayoutlayout; layout.setHorizontalGroup layout.createParallelGroupjavax.swing.GroupLayout.Alignment .LEADING .addGroupjavax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup .addGrouplayout.createParallelGroupjavax.swing.GroupLayout .Alignment.TRAILING .addGrouplayout.createSequentialGroup .addContainerGapjavax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE .addComponentloginButton .addGroupjavax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup .addGap60, 60, 60 118 .addGrouplayout.createParallelGroupjavax.swing.GroupLayout .Alignment.LEADING .addGrouplayout.createSequentialGroup .addComponentusernameLabel .addPreferredGapjavax.swing.LayoutStyle.ComponentPlacement. RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE .addComponentusernameField, javax.swing.GroupLayout.PREFERRED_SIZE, 130, javax.swing.GroupLayout.PREFERRED_SIZE .addGrouplayout.createSequentialGroup .addComponentpasswordLabel .addPreferredGapjavax.swing.LayoutStyle.ComponentPlacement. RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE .addComponentpasswordField, javax.swing.GroupLayout.PREFERRED_SIZE, 130, javax.swing.GroupLayout.PREFERRED_SIZE .addGrouplayout.createSequentialGroup .addGrouplayout.createParallelGroupjavax.swing.GroupLayout .Alignment.LEADING .addComponentjLabel1 .addGrouplayout.createSequentialGroup .addGap25, 25, 25 .addComponentjLabel2 .addGap0, 0, Short.MAX_VALUE .addGap69, 69, 69 .addGrouplayout.createSequentialGroup .addGap28, 28, 28 .addComponentjSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, 372, javax.swing.GroupLayout.PREFERRED_SIZE .addContainerGapjavax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE ; 119 layout.setVerticalGroup layout.createParallelGroupjavax.swing.GroupLayout.Alignment .LEADING .addGrouplayout.createSequentialGroup .addGap24, 24, 24 .addComponentjLabel1 .addPreferredGapjavax.swing.LayoutStyle.ComponentPlacement. RELATED .addComponentjLabel2 .addPreferredGapjavax.swing.LayoutStyle.ComponentPlacement. UNRELATED .addComponentjSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE .addPreferredGapjavax.swing.LayoutStyle.ComponentPlacement. RELATED, 31, Short.MAX_VALUE .addGrouplayout.createParallelGroupjavax.swing.GroupLayout .Alignment.LEADING .addComponentusernameLabel, javax.swing.GroupLayout.Alignment.TRAILING .addComponentusernameField, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE .addGap18, 18, 18 .addGrouplayout.createParallelGroupjavax.swing.GroupLayout .Alignment.BASELINE .addComponentpasswordField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE .addComponentpasswordLabel .addGap33, 33, 33 .addComponentloginButton .addGap44, 44, 44 ; pack; 120 } private void loginButtonActionPerformedjava.awt.event.ActionEvent evt { String password = null; String username = null; password = new StringpasswordField.getPassword; username = usernameField.getText; int countRow = 0; resultSet = startConn.queryselect from admins where username = +username+ and password = +password+; try { while resultSet.next{ countRow = resultSet.getInt1; } } catch SQLException e { JOptionPane.showMessageDialognull, e; } if countRow == 1 { MainWindow mainWindow = new MainWindow; mainWindow.setVisibletrue; Dimension dimension = Toolkit.getDefaultToolkit.getScreenSize; int x = int dimension.getWidth - mainWindow.getWidth 2; int y = int dimension.getHeight - mainWindow.getHeight 2; mainWindow.setLocationx, y; } else { JOptionPane.showMessageDialognull, username dan password tidak cocok; } } private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel2; private javax.swing.JSeparator jSeparator1; private javax.swing.JButton loginButton; 121 private javax.swing.JPasswordField passwordField; private javax.swing.JLabel passwordLabel; private javax.swing.JTextField usernameField; private javax.swing.JLabel usernameLabel; } 5.2.1.11 MainWindow.java package ui; import engine.DBConnection; import engine.BloodSugar; import engine.HeartRate; import engine.PCMFuzzy; import engine.OxygenSaturation; import engine.SystolicBloodPressure; import engine.Temperature; import java.sql.ResultSet; import java.sql.SQLException; import java.util.logging.Level; import java.util.logging.Logger; import javax.swing.JOptionPane; public class MainWindow extends javax.swing.JFrame { public MainWindow { initComponents; initDB; initRule; } private void initDB{ String hosttext=localhost; String databasetext=pcm; String usernametext=root; String passwordtext=My Lab1; try { Class.forNamecom.mysql.jdbc.Driver; } catch Exception ex { System.err.printlnError 1: + ex; System.exit1; } startConn = new DBConnectionjdbc:mysql:+hosttext+:3306+databasetext, usernametext,passwordtext; 122 } private void initRule{ int countRow = 0; int[] str = new int[7]; resultSet = startConn.queryselect count from rule; try { while resultSet.next{ countRow=resultSet.getInt1; } } catch SQLException ex { Logger.getLoggerMainWindow.class.getName.logLevel.SEVER E, null, ex; } if countRow0{ resultSet=startConn.queryselect from rule; this.ProsessText.setText; try { while resultSet.next{ countRow=resultSet.getInt1; str[0]=resultSet.getInt1; str[1]=resultSet.getInt2; str[2]=resultSet.getInt3; str[3]=resultSet.getInt4; str[4]=resultSet.getInt5; str[5]=resultSet.getInt6; str[6]=resultSet.getInt7; this.ProsessText.appendstr[0]+. If SBP=+this.convertToStringstr[1]+ and HR=+this.convertToStringstr[2]+ and SPO2=+this.convertToStringstr[3]+ and TEMP=+this.convertToStringstr[4]+ and BS=+this.convertToStringstr[5]+ THEN EWS SCORE=+str[6]+\n; } } catch SQLException ex { Logger.getLoggerMainWindow.class.getName.logLevel.SEVER E, null, ex; } this.BtnImportRule.setEnabledfalse; 123 this.BtnRemoveRule.setEnabledtrue; } else { this.BtnImportRule.setEnabledtrue; this.BtnRemoveRule.setEnabledfalse; } } SuppressWarningsunchecked private void initComponents { jTabbedPane1 = new javax.swing.JTabbedPane; jPanel1 = new javax.swing.JPanel; Textsbp = new javax.swing.JTextField; jScrollPane1 = new javax.swing.JScrollPane; HasilText = new javax.swing.JTextArea; jScrollPane2 = new javax.swing.JScrollPane; ProsessText = new javax.swing.JTextArea; Texthr = new javax.swing.JTextField; Textspo2 = new javax.swing.JTextField; Texttemp = new javax.swing.JTextField; Textbs = new javax.swing.JTextField; BtnPrediksi = new javax.swing.JButton; BtnReset = new javax.swing.JButton; Labelsbp = new javax.swing.JLabel; Labelhr = new javax.swing.JLabel; Labelspo2 = new javax.swing.JLabel; Labeltemp = new javax.swing.JLabel; Labelbs = new javax.swing.JLabel; BtnImportRule = new javax.swing.JButton; BtnRemoveRule = new javax.swing.JToggleButton; jMenuBar1 = new javax.swing.JMenuBar; jMenu1 = new javax.swing.JMenu; jMenu2 = new javax.swing.JMenu; setDefaultCloseOperationjavax.swing.WindowConstants.EXIT_ON _CLOSE; jTabbedPane1.setNamejTabbedPane1; NOI18N jPanel1.setNamejPanel1; NOI18N Textsbp.setToolTipTextSystolic Blood Pleasure; Textsbp.setNameTextsbp; NOI18N 124 Textsbp.addActionListenernew java.awt.event.ActionListener { public void actionPerformedjava.awt.event.ActionEvent evt { TextsbpActionPerformedevt; } }; Textsbp.addKeyListenernew java.awt.event.KeyAdapter { public void keyPressedjava.awt.event.KeyEvent evt { TextsbpKeyPressedevt; } public void keyReleasedjava.awt.event.KeyEvent evt { TextsbpKeyReleasedevt; } }; jScrollPane1.setNamejScrollPane1; NOI18N HasilText.setColumns20; HasilText.setEditablefalse; HasilText.setRows5; HasilText.setNameHasilText; NOI18N jScrollPane1.setViewportViewHasilText; jScrollPane2.setNamejScrollPane2; NOI18N ProsessText.setColumns20; ProsessText.setEditablefalse; ProsessText.setRows5; ProsessText.setNameProsessText; NOI18N jScrollPane2.setViewportViewProsessText; Texthr.setToolTipTextHeart Rate; Texthr.setNameTexthr; NOI18N Texthr.addActionListenernew java.awt.event.ActionListener { public void actionPerformedjava.awt.event.ActionEvent evt { TexthrActionPerformedevt; } }; Texthr.addKeyListenernew 125 java.awt.event.KeyAdapter { public void keyPressedjava.awt.event.KeyEvent evt { TexthrKeyPressedevt; } public void keyReleasedjava.awt.event.KeyEvent evt { TexthrKeyReleasedevt; } }; Textspo2.setToolTipTextOxygen Saturation; Textspo2.setNameTextspo2; NOI18N Textspo2.addActionListenernew java.awt.event.ActionListener { public void actionPerformedjava.awt.event.ActionEvent evt { Textspo2ActionPerformedevt; } }; Textspo2.addKeyListenernew java.awt.event.KeyAdapter { public void keyPressedjava.awt.event.KeyEvent evt { Textspo2KeyPressedevt; } public void keyReleasedjava.awt.event.KeyEvent evt { Textspo2KeyReleasedevt; } }; Texttemp.setToolTipTextTemperature; Texttemp.setNameTexttemp; NOI18N Texttemp.addActionListenernew java.awt.event.ActionListener { public void actionPerformedjava.awt.event.ActionEvent evt { TexttempActionPerformedevt; } }; Texttemp.addKeyListenernew java.awt.event.KeyAdapter { public void keyPressedjava.awt.event.KeyEvent evt { 126 TexttempKeyPressedevt; } public void keyReleasedjava.awt.event.KeyEvent evt { TexttempKeyReleasedevt; } }; Textbs.setToolTipTextBlood Sugar; Textbs.setNameTextbs; NOI18N Textbs.addActionListenernew java.awt.event.ActionListener { public void actionPerformedjava.awt.event.ActionEvent evt { TextbsActionPerformedevt; } }; Textbs.addKeyListenernew java.awt.event.KeyAdapter { public void keyPressedjava.awt.event.KeyEvent evt { TextbsKeyPressedevt; } public void keyReleasedjava.awt.event.KeyEvent evt { TextbsKeyReleasedevt; } }; BtnPrediksi.setTextCALCULATE; BtnPrediksi.setNameBtnPrediksi; NOI18N BtnPrediksi.addActionListenernew java.awt.event.ActionListener { public void actionPerformedjava.awt.event.ActionEvent evt { BtnPrediksiActionPerformedevt; } }; BtnReset.setTextRESET; BtnReset.setNameBtnReset; NOI18N BtnReset.addActionListenernew java.awt.event.ActionListener { public void actionPerformedjava.awt.event.ActionEvent evt { 127 BtnResetActionPerformedevt; } }; Labelsbp.setTextSBP; Labelsbp.setNameLabelsbp; NOI18N Labelhr.setTextHR; Labelhr.setNameLabelhr; NOI18N Labelspo2.setTextSPO2; Labelspo2.setNameLabelspo2; NOI18N Labeltemp.setTextTEMP; Labeltemp.setNameLabeltemp; NOI18N Labelbs.setTextBS; Labelbs.setNameLabelbs; NOI18N BtnImportRule.setTextImport Rule; BtnImportRule.setNameBtnImportRule; NOI18N BtnImportRule.addActionListenernew java.awt.event.ActionListener { public void actionPerformedjava.awt.event.ActionEvent evt { BtnImportRuleActionPerformedevt; } }; BtnRemoveRule.setTextRemove Rule; BtnRemoveRule.setNameBtnRemoveRule; NOI18N BtnRemoveRule.addActionListenernew java.awt.event.ActionListener { public void actionPerformedjava.awt.event.ActionEvent evt { BtnRemoveRuleActionPerformedevt; } }; javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayoutjPanel1; jPanel1.setLayoutjPanel1Layout; jPanel1Layout.setHorizontalGroup jPanel1Layout.createParallelGroupjavax.swing.GroupLayout.Al 128 ignment.LEADING .addGroupjPanel1Layout.createSequentialGroup .addContainerGap .addGroupjPanel1Layout.createParallelGroupjavax.swing.Grou pLayout.Alignment.LEADING .addComponentjScrollPane2, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 649, Short.MAX_VALUE .addGroupjavax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup .addGroupjPanel1Layout.createParallelGroupjavax.swing.Grou pLayout.Alignment.LEADING, false .addComponentLabelsbp, javax.swing.GroupLayout.DEFAULT_SIZE, 100, Short.MAX_VALUE .addComponentLabelhr, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE .addComponentLabelspo2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE .addComponentBtnPrediksi, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE .addComponentLabeltemp, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE .addComponentLabelbs, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE .addGap36, 36, 36 .addGroupjPanel1Layout.createParallelGroupjavax.swing.Grou pLayout.Alignment.LEADING, false .addComponentBtnReset, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE .addComponentTextsbp, javax.swing.GroupLayout.DEFAULT_SIZE, 119, Short.MAX_VALUE .addComponentTexthr .addComponentTextspo2 .addComponentTexttemp .addComponentTextbs 129 .addGap66, 66, 66 .addComponentjScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 307, javax.swing.GroupLayout.PREFERRED_SIZE .addGroupjPanel1Layout.createSequentialGroup .addComponentBtnImportRule, javax.swing.GroupLayout.PREFERRED_SIZE, 113, javax.swing.GroupLayout.PREFERRED_SIZE .addPreferredGapjavax.swing.LayoutStyle.ComponentPlacement. UNRELATED .addComponentBtnRemoveRule .addContainerGap ; jPanel1Layout.setVerticalGroup jPanel1Layout.createParallelGroupjavax.swing.GroupLayout.Al ignment.LEADING .addGroupjPanel1Layout.createSequentialGroup .addContainerGap .addGroupjPanel1Layout.createParallelGroupjavax.swing.Grou pLayout.Alignment.LEADING .addComponentjScrollPane1 .addGroupjPanel1Layout.createSequentialGroup .addGroupjPanel1Layout.createParallelGroupjavax.swing.Grou pLayout.Alignment.BASELINE .addComponentTextsbp, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE .addComponentLabelsbp .addGap18, 18, 18 .addGroupjPanel1Layout.createParallelGroupjavax.swing.Grou pLayout.Alignment.BASELINE .addComponentTexthr, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE .addComponentLabelhr .addGap18, 18, 18 130 .addGroupjPanel1Layout.createParallelGroupjavax.swing.Grou pLayout.Alignment.BASELINE .addComponentTextspo2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE .addComponentLabelspo2 .addGap18, 18, 18 .addGroupjPanel1Layout.createParallelGroupjavax.swing.Grou pLayout.Alignment.BASELINE .addComponentTexttemp, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE .addComponentLabeltemp .addGap18, 18, 18 .addGroupjPanel1Layout.createParallelGroupjavax.swing.Grou pLayout.Alignment.BASELINE .addComponentTextbs, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE .addComponentLabelbs .addPreferredGapjavax.swing.LayoutStyle.ComponentPlacement. RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE .addGroupjPanel1Layout.createParallelGroupjavax.swing.Grou pLayout.Alignment.BASELINE .addComponentBtnPrediksi .addComponentBtnReset .addGap9, 9, 9 .addGap36, 36, 36 .addComponentjScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 139, javax.swing.GroupLayout.PREFERRED_SIZE .addGap7, 7, 7 .addGroupjPanel1Layout.createParallelGroupjavax.swing.Grou pLayout.Alignment.BASELINE .addComponentBtnImportRule 131 .addComponentBtnRemoveRule .addContainerGap ; jTabbedPane1.addTabmain, jPanel1; jMenuBar1.setNamejMenuBar1; NOI18N jMenu1.setTextFile; jMenu1.setNamejMenu1; NOI18N jMenuBar1.addjMenu1; jMenu2.setTextEdit; jMenu2.setNamejMenu2; NOI18N jMenuBar1.addjMenu2; setJMenuBarjMenuBar1; javax.swing.GroupLayout layout = new javax.swing.GroupLayoutgetContentPane; getContentPane.setLayoutlayout; layout.setHorizontalGroup layout.createParallelGroupjavax.swing.GroupLayout.Alignment .LEADING .addComponentjTabbedPane1, javax.swing.GroupLayout.Alignment.TRAILING ; layout.setVerticalGroup layout.createParallelGroupjavax.swing.GroupLayout.Alignment .LEADING .addComponentjTabbedPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 477, Short.MAX_VALUE ; pack; } private void TextsbpActionPerformedjava.awt.event.ActionEvent evt { TODO add your handling code here: } 132 private void TexthrActionPerformedjava.awt.event.ActionEvent evt { TODO add your handling code here: } private void Textspo2ActionPerformedjava.awt.event.ActionEvent evt { TODO add your handling code here: } private void TexttempActionPerformedjava.awt.event.ActionEvent evt { TODO add your handling code here: } private void TextbsActionPerformedjava.awt.event.ActionEvent evt { TODO add your handling code here: } private void TextsbpKeyPressedjava.awt.event.KeyEvent evt { if evt.getKeyCode == 10 || evt.getKeyCode == 11 { Textsbp.requestFocus; } } private void TexthrKeyPressedjava.awt.event.KeyEvent evt { if evt.getKeyCode == 10 || evt.getKeyCode == 11 { Texthr.requestFocus; } } private void Textspo2KeyPressedjava.awt.event.KeyEvent evt { if evt.getKeyCode == 10 || evt.getKeyCode == 11 { Textspo2.requestFocus; } } private void TexttempKeyPressedjava.awt.event.KeyEvent 133 evt { if evt.getKeyCode == 10 || evt.getKeyCode == 11 { Texttemp.requestFocus; } } private void TextbsKeyPressedjava.awt.event.KeyEvent evt { if evt.getKeyCode == 10 || evt.getKeyCode == 11 { Textbs.requestFocus; } } private void TextsbpKeyReleasedjava.awt.event.KeyEvent evt { if isIntevt.getKeyCode { JOptionPane.showMessageDialognull, Inputan berupa angka; Textsbp.setText; } } private void TexthrKeyReleasedjava.awt.event.KeyEvent evt { if isIntevt.getKeyCode { JOptionPane.showMessageDialognull, Inputan berupa angka; Texthr.setText; } } private void Textspo2KeyReleasedjava.awt.event.KeyEvent evt { if isIntevt.getKeyCode { JOptionPane.showMessageDialognull, Inputan berupa angka; Textspo2.setText; } } private void TexttempKeyReleasedjava.awt.event.KeyEvent evt { if isIntevt.getKeyCode { 134 JOptionPane.showMessageDialognull, Inputan berupa angka; Texttemp.setText; } } private void TextbsKeyReleasedjava.awt.event.KeyEvent evt { if isIntevt.getKeyCode { JOptionPane.showMessageDialognull, Inputan berupa angka; Textbs.setText; } } private void BtnPrediksiActionPerformedjava.awt.event.ActionEvent evt { if Textsbp.getText.equals { JOptionPane.showMessageDialognull, Inputan belum lengkap; Textsbp.requestFocus; } else if Texthr.getText.equals { JOptionPane.showMessageDialognull, Inputan belum lengkap; Texthr.requestFocus; } else if Textspo2.getText.equals { JOptionPane.showMessageDialognull, Inputan belum lengkap; Textspo2.requestFocus; } else if Texttemp.getText.equals { JOptionPane.showMessageDialognull, Inputan belum lengkap; Texttemp.requestFocus; } else if Textbs.getText.equals { JOptionPane.showMessageDialognull, Inputan belum lengkap; Textbs.requestFocus; } else { HasilText.setText; ProsessText.setText; double Risk = new PCMFuzzyDouble.valueOfTextsbp.getText, Double.valueOfTexthr.getText, Double.valueOfTextspo2.getText, 135 Double.valueOfTexttemp.getText, Double.valueOfTextbs.getText,startConn, this.getRiskPrediction; HasilText.append\n\n\n FINISHED ; } } private void BtnResetActionPerformedjava.awt.event.ActionEvent evt { Textsbp.setText; Texthr.setText; Textspo2.setText; Texttemp.setText; Textbs.setText; HasilText.setText; initRule; Textsbp.requestFocus; } private void BtnImportRuleActionPerformedjava.awt.event.ActionEvent evt { int sbp[]=systolicBloodPressure.getSbpLinguistic; int hr[]=heartRate.getHeartRateLinguistic; int spo2[]=oxygenSaturation.getOxygenSaturationLinguistic; int temp[]=temperature.getTemperatureLinguistic; int bs[]=bloodSugar.getBloodSugarLinguistic; int total=0, jumlah=0, jumlahRule=0; String sql=null; jumlahRule=sbp.lengthhr.lengthspo2.lengthtemp.lengthbs .length; forint a=0;asbp.length;a++{ forint b=0;bhr.length;b++{ forint c=0;cspo2.length;c++{ forint d=0;dtemp.length;d++{ forint e=0;ebs.length;e++{ jumlah=Math.abssbp[a]+Math.abshr[b]+Math.absspo2[ c]+Math.abstemp[d]+Math.absbs[e]; startConn.dmlQueryinsert into rule SBP,HR,SPO2,TEMP,BS,risk values 136 +sbp[a]+,+hr[b]+,+spo2[c]+,+temp[d]+,+bs[e]+,+ju mlah+; this.ProsessText.appendtotal+1+. If SystolicBloodPressure=+this.convertToStringsbp[a]+ and HeartRate=+this.convertToStringhr[b]+ and OxygenSaturation=+this.convertToStringspo2[c]+ and Temperature=+this.convertToStringtemp[d]+ and BloodSugar=+this.convertToStringbs[e]+ THEN EWS SCORE=+jumlah+\n; this.ProsessText.setTextadded +total; total++; } } } } } initRule; JOptionPane.showMessageDialognull, Succes added +total+ rule; } private void BtnRemoveRuleActionPerformedjava.awt.event.ActionEvent evt { int dialogButton = JOptionPane.NO_OPTION; JOptionPane.showConfirmDialog null, Would You Like to Delete All Rule ?,Warning,dialogButton; ifdialogButton == 1{ The ISSUE is here startConn.dmlQuerytruncate rule; this.ProsessText.setText; initRule; } } private boolean isIntint key { if key = 48 key = 57 || key = 8 key = 11|| key == 46 { return true; } else { return false; } 137 } private String convertToStringint value{ ifvalue==-3{ return low3; }else ifvalue==-2{ return low2; }else ifvalue==-1{ return low1; }else ifvalue==0{ return normal; }else ifvalue==1{ return high1; }else ifvalue==2{ return high2; }else ifvalue==3{ return high3; }else return ; } public void ClearHasilText{ this.HasilText.setText; } public void ClearProsessText{ this.ProsessText.setText; } public void setHasilTextString str{ this.HasilText.appendstr; } public void setProsessTextString str{ this.ProsessText.appendstr; } private javax.swing.JButton BtnImportRule; private javax.swing.JButton BtnPrediksi; private javax.swing.JToggleButton BtnRemoveRule; private javax.swing.JButton BtnReset; private javax.swing.JTextArea HasilText; private javax.swing.JLabel Labelbs; private javax.swing.JLabel Labelhr; private javax.swing.JLabel Labelsbp; private javax.swing.JLabel Labelspo2; 138 private javax.swing.JLabel Labeltemp; private javax.swing.JTextArea ProsessText; private javax.swing.JTextField Textbs; private javax.swing.JTextField Texthr; private javax.swing.JTextField Textsbp; private javax.swing.JTextField Textspo2; private javax.swing.JTextField Texttemp; private javax.swing.JMenu jMenu1; private javax.swing.JMenu jMenu2; private javax.swing.JMenuBar jMenuBar1; private javax.swing.JPanel jPanel1; private javax.swing.JScrollPane jScrollPane1; private javax.swing.JScrollPane jScrollPane2; private javax.swing.JTabbedPane jTabbedPane1; private SystolicBloodPressure systolicBloodPressure = new SystolicBloodPressure; private HeartRate heartRate = new HeartRate; private OxygenSaturation oxygenSaturation = new OxygenSaturation; private Temperature temperature = new Temperature; private BloodSugar bloodSugar = new BloodSugar; private DBConnection startConn = null; private ResultSet resultSet = null; } 5.2.1.12 TestUnit.java package ui; import java.awt.Dimension; import java.awt.Toolkit; public class TestUnit { public static void mainString[] args { java.awt.EventQueue.invokeLaternew Runnable { public void run { LoginWindow loginForm = new LoginWindow; loginForm.setVisibletrue; Dimension dimension = Toolkit.getDefaultToolkit.getScreenSize; int x = int dimension.getWidth - loginForm.getWidth 2; int y = int dimension.getHeight - 139 loginForm.getHeight 2; loginForm.setLocationx, y; } }; } }

5.2.2 Antarmuka Aplikasi