Lalu buat
struktur seperti gambar dibawah ini pada Netbeans
Selanjutnya
buat coding atau sintax pada class koneksi dan fungsi :
Class Koneksi
package Koneksi;
import java.sql.*;
import java.sql.*;
public class
Koneksi {
public Connection getConnection() throws SQLException
{
Connection cn = null;
try
{
String db = "rumah_sakit_rj";
String sv = "jdbc:mysql://localhost:3306/"+db;
String driver = "com.mysql.jdbc.Driver";
Class.forName(driver);
cn = DriverManager.getConnection(sv,"root","");
return cn;
}
catch (SQLException s)
{
System.out.println("Ekspesi SQL : " + s.getMessage());
return null;
}
catch (Exception e)
{
System.out.println("Ekspesi : " + e.getMessage());
return null;
}
}
}
Class Fungsi
package
Fungsi;
import
java.sql.*;
import
Koneksi.Koneksi;
public class
Fungsi {
static Connection Cnn;
static Koneksi db = new Koneksi();
static Statement st;
static int i;
//Eksekusi Printah INSERT, UPDATE, DELETE
public static int EQuery(String sql) throws SQLException
{
i = 0;
try
{
Cnn = db.getConnection();
st = Cnn.createStatement();
i = st.executeUpdate(sql);
return i;
}
catch (Exception e)
{
return i;
}
finally
{
Cnn.close();
}
}
}
Selanjutnya buat
coding pada class entity :
Source code class Entity Dokter
package
Entity;
public class
Dokter {
private String ID_Dokter, Nama_Dokter, ID_Poliklinik;
public Dokter(String ID_Dokter, String Nama_Dokter, String ID_Poliklinik) {
this.ID_Dokter = ID_Dokter;
this.Nama_Dokter = Nama_Dokter;
this.ID_Poliklinik = ID_Poliklinik;
}
public Dokter() {
}
/*public Dokter(String ID_Dokter, String Nama, String ID_Poliklinik) {
this.ID_Dokter = ID_Dokter;
this.Nama_Dokter = Nama_Dokter;
this.ID_Poliklinik = ID_Poliklinik;
}*/
/**
* @return the ID_Dokter
*/
public String getID_Dokter() {
return ID_Dokter;
}
/**
* @param ID_Dokter the ID_Dokter to set
*/
public void setID_Dokter(String ID_Dokter) {
this.ID_Dokter = ID_Dokter;
}
/**
* @return the Nama
*/
public String getNama_Dokter() {
return Nama_Dokter;
}
/**
* @param Nama the Nama to set
*/
public void setNama_Dokter(String Nama) {
this.Nama_Dokter = Nama_Dokter;
}
/**
* @return the ID_Poliklinik
*/
public String getID_Poliklinik() {
return ID_Poliklinik;
}
/**
* @param ID_Poliklinik the ID_Poliklinik to set
*/
public void setID_Poliklinik(String ID_Poliklinik) {
this.ID_Poliklinik = ID_Poliklinik;
}
}
Source code class Entity Kunjungan
package
Entity;
public class
Kunjungan {
private String No_Kunjungan, No_RM, Tgl, Id_Poli, Id_Dokter;
public void setNo_Kunjungan(String No_Kunjungan) {
this.No_Kunjungan = No_Kunjungan;
}
public String getNo_Kunjungan() {
return No_Kunjungan;
}
public Kunjungan(String No_Kunjungan, String No_RM, String Tgl, String Id_Poli,
String Id_Dokter) {
this.No_Kunjungan = No_Kunjungan;
this.No_RM = No_RM;
this.Tgl = Tgl;
this.Id_Poli = Id_Poli;
this.Id_Dokter = Id_Dokter;
}
/**
* @return the No_RM
*/
public String getNo_RM() {
return No_RM;
}
/**
* @param No_RM the No_RM to set
*/
public void setNo_RM(String No_RM) {
this.No_RM = No_RM;
}
/**
* @return the Tgl
*/
public String getTgl() {
return Tgl;
}
/**
* @param Tgl the Tgl to set
*/
public void setTgl(String Tgl) {
this.Tgl = Tgl;
}
/**
* @return the Id_Poli
*/
public String getId_Poli() {
return Id_Poli;
}
/**
* @param Id_Poli the Id_Poli to set
*/
public void setId_Poli(String Id_Poli) {
this.Id_Poli = Id_Poli;
}
/**
* @return the Id_Dokter
*/
public String getId_Dokter() {
return Id_Dokter;
}
/**
* @param Id_Dokter the Id_Dokter to set
*/
public void setId_Dokter(String Id_Dokter) {
this.Id_Dokter = Id_Dokter;
}
public Kunjungan() {
}
}
Source code class Entity Login
package
Entity;
public class
Login {
private String Username, Password;
public Login() {
}
public Login(String Username, String Password) {
this.Username = Username;
this.Password = Password;
}
/**
* @return the Username
*/
public String getUsername() {
return Username;
}
/**
* @param Username the Username to set
*/
public void setUsername(String Username) {
this.Username = Username;
}
/**
* @return the Password
*/
public String getPassword() {
return Password;
}
/**
* @param Password the Password to set
*/
public void setPassword(String Password) {
this.Password = Password;
}
}
Source code class Entity Obat
package
Entity;
public class
Obat {
private String Id_Obat, Nama_Obat, Satuan, Harga;
public String getId_Obat() {
return Id_Obat;
}
public void setId_Obat(String Id_Obat) {
this.Id_Obat = Id_Obat;
}
public Obat(String Id_Obat, String Nama_Obat, String Satuan, String Harga) {
this.Id_Obat = Id_Obat;
this.Nama_Obat = Nama_Obat;
this.Satuan = Satuan;
this.Harga = Harga;
}
public Obat() {
}
/**
* @return the Nama_Obat
*/
public String getNama_Obat() {
return Nama_Obat;
}
/**
* @param Nama_Obat the Nama_Obat to set
*/
public void setNama_Obat(String Nama_Obat) {
this.Nama_Obat = Nama_Obat;
}
/**
* @return the Satuan
*/
public String getSatuan() {
return Satuan;
}
/**
* @param Satuan the Satuan to set
*/
public void setSatuan(String Satuan) {
this.Satuan = Satuan;
}
/**
* @return the Harga
*/
public String getHarga() {
return Harga;
}
/**
* @param Harga the Harga to set
*/
public void setHarga(String Harga) {
this.Harga = Harga;
}
}
Source code class Entity Pasien
package
Entity;
public class
Pasien {
private String No_RM, Nama,Alamat,Telepon,Pekerjaan;
public void setNo_RM(String No_RM) {
this.No_RM = No_RM;
}
public String getNo_RM() {
return No_RM;
}
public Pasien(String No_RM, String Nama, String Alamat, String Telepon, String
Pekerjaan) {
this.No_RM = No_RM;
this.Nama = Nama;
this.Alamat = Alamat;
this.Telepon = Telepon;
this.Pekerjaan = Pekerjaan;
}
/**
* @return the Nama
*/
public String getNama() {
return Nama;
}
/**
* @param Nama the Nama to set
*/
public void setNama(String Nama) {
this.Nama = Nama;
}
/**
* @return the Alamat
*/
public String getAlamat() {
return Alamat;
}
/**
* @param Alamat the Alamat to set
*/
public void setAlamat(String Alamat) {
this.Alamat = Alamat;
}
/**
* @return the Telepon
*/
public String getTelepon() {
return Telepon;
}
/**
* @param Telepon the Telepon to set
*/
public void setTelepon(String Telepon) {
this.Telepon = Telepon;
}
/**
* @return the Pekerjaan
*/
public String getPekerjaan() {
return Pekerjaan;
}
/**
* @param Pekerjaan the Pekerjaan to set
*/
public void setPekerjaan(String Pekerjaan) {
this.Pekerjaan = Pekerjaan;
}
//Overloading Constructor
public Pasien() {
}
}
Source code class Entity Pembayaran
package
Entity;
public class
Pembayaran {
private String Id_Pembayaran, No_Kunjungan, Id_Poliklinik, No_Resep,
Total_Bayar, Harga_Resep, Tarif_Poli;
public Pembayaran(String Id_Pembayaran, String No_Kunjungan, String
Id_Poliklinik, String No_Resep, String Total_Bayar, String Harga_Resep, String
Tarif_Poli) {
this.Id_Pembayaran = Id_Pembayaran;
this.No_Kunjungan = No_Kunjungan;
this.Id_Poliklinik = Id_Poliklinik;
this.No_Resep = No_Resep;
this.Total_Bayar = Total_Bayar;
this.Harga_Resep = Harga_Resep;
this.Tarif_Poli = Tarif_Poli;
}
public Pembayaran() {
}
/**
* @return the Id_Pembayaran
*/
public String getId_Pembayaran() {
return Id_Pembayaran;
}
/**
* @param Id_Pembayaran the Id_Pembayaran to set
*/
public void setId_Pembayaran(String Id_Pembayaran) {
this.Id_Pembayaran = Id_Pembayaran;
}
/**
* @return the No_Kunjungan
*/
public String getNo_Kunjungan() {
return No_Kunjungan;
}
/**
* @param No_Kunjungan the No_Kunjungan to set
*/
public void setNo_Kunjungan(String No_Kunjungan) {
this.No_Kunjungan = No_Kunjungan;
}
/**
* @return the Id_Poliklinik
*/
public String getId_Poliklinik() {
return Id_Poliklinik;
}
/**
* @param Id_Poliklinik the Id_Poliklinik to set
*/
public void setId_Poliklinik(String Id_Poliklinik) {
this.Id_Poliklinik = Id_Poliklinik;
}
/**
* @return the No_Resep
*/
public String getNo_Resep() {
return No_Resep;
}
/**
* @param No_Resep the No_Resep to set
*/
public void setNo_Resep(String No_Resep) {
this.No_Resep = No_Resep;
}
/**
* @return the Total_Bayar
*/
public String getTotal_Bayar() {
return Total_Bayar;
}
/**
* @param Total_Bayar the Total_Bayar to set
*/
public void setTotal_Bayar(String Total_Bayar) {
this.Total_Bayar = Total_Bayar;
}
/**
* @return the Harga_Resep
*/
public String getHarga_Resep() {
return Harga_Resep;
}
/**
* @param Harga_Resep the Harga_Resep to set
*/
public void setHarga_Resep(String Harga_Resep) {
this.Harga_Resep = Harga_Resep;
}
/**
* @return the Tarif_Poli
*/
public String getTarif_Poli() {
return Tarif_Poli;
}
/**
* @param Tarif_Poli the Tarif_Poli to set
*/
public void setTarif_Poli(String Tarif_Poli) {
this.Tarif_Poli = Tarif_Poli;
}
}
Source code class Entity Poliklinik
package
Entity;
public class
Poliklinik {
private String Id_Poliklinik, Nama_Poliklinik, Tarif_Poli;
public void setId_Poliklinik(String Id_Poliklinik) {
this.Id_Poliklinik = Id_Poliklinik;
}
public String getId_Poliklinik() {
return Id_Poliklinik;
}
public Poliklinik(String Id_Poliklinik, String Nama_Poliklinik, String
Tarif_Poli) {
this.Id_Poliklinik = Id_Poliklinik;
this.Nama_Poliklinik = Nama_Poliklinik;
this.Tarif_Poli = Tarif_Poli;
}
/**
* @return the Nama_Poliklinik
*/
public String getNama_Poliklinik() {
return Nama_Poliklinik;
}
/**
* @param Nama_Poliklinik the Nama_Poliklinik to set
*/
public void setNama_Poliklinik(String Nama_Poliklinik) {
this.Nama_Poliklinik = Nama_Poliklinik;
}
/**
* @return the Tarif_Poli
*/
public String getTarif_Poli() {
return Tarif_Poli;
}
/**
* @param Tarif_Poli the Tarif_Poli to set
*/
public void setTarif_Poli(String Tarif_Poli) {
this.Tarif_Poli = Tarif_Poli;
}
public Poliklinik() {
}
}
Source code class Entity Rekam
package
Entity;
public class
Rekam {
private String Id_Rekam, No_Kunjungan, Keluhan, Diagnosa, Terapi;
public void setId_Rekam(String Id_Rekam) {
this.Id_Rekam = Id_Rekam;
}
public String getId_Rekam() {
return Id_Rekam;
}
public Rekam(String Id_Rekam, String No_Kunjungan, String Keluhan, String
Diagnosa, String Terapi) {
this.Id_Rekam = Id_Rekam;
this.No_Kunjungan = No_Kunjungan;
this.Keluhan = Keluhan;
this.Diagnosa = Diagnosa;
this.Terapi = Terapi;
}
/**
* @return the No_Kunjungan
*/
public String getNo_Kunjungan() {
return No_Kunjungan;
}
/**
* @param No_Kunjungan the No_Kunjungan to set
*/
public void setNo_Kunjungan(String No_Kunjungan) {
this.No_Kunjungan = No_Kunjungan;
}
/**
* @return the Keluhan
*/
public String getKeluhan() {
return Keluhan;
}
/**
* @param Keluhan the Keluhan to set
*/
public void setKeluhan(String Keluhan) {
this.Keluhan = Keluhan;
}
/**
* @return the Diagnosa
*/
public String getDiagnosa() {
return Diagnosa;
}
/**
* @param Diagnosa the Diagnosa to set
*/
public void setDiagnosa(String Diagnosa) {
this.Diagnosa = Diagnosa;
}
/**
* @return the Terapi
*/
public String getTerapi() {
return Terapi;
}
/**
* @param Terapi the Terapi to set
*/
public void setTerapi(String Terapi) {
this.Terapi = Terapi;
}
public Rekam() {
}
}
Source code class Entity Resep
package
Entity;
public class Resep {
private String No_Resep, Id_Obat, No_Kunjungan, Harga_Resep;
public void setNo_Resep(String No_Resep) {
this.No_Resep = No_Resep;
}
public String getNo_Resep() {
return No_Resep;
}
public Resep(String No_Resep, String Id_Obat, String No_Kunjungan, String Harga_Resep) {
this.No_Resep = No_Resep;
this.Id_Obat = Id_Obat;
this.No_Kunjungan = No_Kunjungan;
this.Harga_Resep = Harga_Resep;
}
/**
* @return the Id_Obat
*/
public String getId_Obat() {
return Id_Obat;
}
/**
* @param Id_Obat the Id_Obat to set
*/
public void setId_Obat(String Id_Obat) {
this.Id_Obat = Id_Obat;
}
/**
* @return the No_Kunjungan
*/
public String getNo_Kunjungan() {
return No_Kunjungan;
}
/**
* @param No_Kunjungan the No_Kunjungan to set
*/
public void setNo_Kunjungan(String No_Kunjungan) {
this.No_Kunjungan = No_Kunjungan;
}
/**
* @return the Harga_Resep
*/
public String getHarga_Resep() {
return Harga_Resep;
}
/**
* @param Harga_Resep the Harga_Resep to set
*/
public void setHarga_Resep(String Harga_Resep) {
this.Harga_Resep = Harga_Resep;
}
public Resep() {
}
}
public class Resep {
private String No_Resep, Id_Obat, No_Kunjungan, Harga_Resep;
public void setNo_Resep(String No_Resep) {
this.No_Resep = No_Resep;
}
public String getNo_Resep() {
return No_Resep;
}
public Resep(String No_Resep, String Id_Obat, String No_Kunjungan, String Harga_Resep) {
this.No_Resep = No_Resep;
this.Id_Obat = Id_Obat;
this.No_Kunjungan = No_Kunjungan;
this.Harga_Resep = Harga_Resep;
}
/**
* @return the Id_Obat
*/
public String getId_Obat() {
return Id_Obat;
}
/**
* @param Id_Obat the Id_Obat to set
*/
public void setId_Obat(String Id_Obat) {
this.Id_Obat = Id_Obat;
}
/**
* @return the No_Kunjungan
*/
public String getNo_Kunjungan() {
return No_Kunjungan;
}
/**
* @param No_Kunjungan the No_Kunjungan to set
*/
public void setNo_Kunjungan(String No_Kunjungan) {
this.No_Kunjungan = No_Kunjungan;
}
/**
* @return the Harga_Resep
*/
public String getHarga_Resep() {
return Harga_Resep;
}
/**
* @param Harga_Resep the Harga_Resep to set
*/
public void setHarga_Resep(String Harga_Resep) {
this.Harga_Resep = Harga_Resep;
}
public Resep() {
}
}
Berikutnya
coding pada class Entity Manager :
Source code class Entity Manager Pasien
package
EntityManager;
import
Entity.Pasien;
import
Fungsi.Fungsi;
public class
PasienManager {
int i;
public int inputdata (Pasien pasien1) {
i = 0;
try {
String sql = "insert into pasien
values('"+pasien1.getNo_RM()+"','"+pasien1.getNama()+"','"+pasien1.getAlamat()+"','"
+ pasien1.getTelepon()+"','"+pasien1.getPekerjaan()+"')";
i = Fungsi.EQuery(sql);
return i;
} catch (Exception e) {
return i;
}
}
public int ubahdata (Pasien pasien1) {
i = 0;
try {
String sql = "update pasien set Nama='"+
pasien1.getNama()+"',"+
" Alamat='"+ pasien1.getAlamat()+"',"+
" Telepon='" + pasien1.getTelepon() + "',"+
" Pekerjaan='" + pasien1.getPekerjaan() + "'"+
"where No_RM='" + pasien1.getNo_RM()+"'";
i = Fungsi.EQuery(sql);
return i;
} catch (Exception e) {
return i;
}
}
public int hapusdata (String ID) {
i = 0;
try {
String sql = "Delete from pasien where No_RM='"+ID+"'";
i = Fungsi.EQuery(sql);
return i;
} catch (Exception e) {
return i;
}
}
}
Source code class Entity Manager Dokter
package
EntityManagerDokter;
import
Entity.Dokter;
import
Fungsi.Fungsi;
public class
DokterManager {
int i;
public int inputdata (Dokter dokter1) {
i = 0;
try {
String sql = "insert into dokter (Id_Dokter,Nama_Dokter,Id_Poliklinik)
"+
"values('"+dokter1.getID_Dokter()+"','" +
dokter1.getNama_Dokter()+"','"+dokter1.getID_Poliklinik()+"')";
i = Fungsi.EQuery(sql);
return i;
} catch (Exception e) {
return i;
}
}
public int ubahdata (Dokter dokter1) {
i = 0;
try {
String sql = "update dokter set Nama_Dokter='"+ dokter1.getNama_Dokter()+"',"+
" Id_Poliklinik='"+ dokter1.getID_Poliklinik()+"'"+
"where Id_Dokter='" + dokter1.getID_Dokter()+"'";
i = Fungsi.EQuery(sql);
return i;
} catch (Exception e) {
return i;
}
}
public int hapusdata (String ID) {
i = 0;
try {
String sql = "Delete from dokter where Id_Dokter='"+ID+"'";
i = Fungsi.EQuery(sql);
return i;
} catch (Exception e) {
return i;
}
}
}
Source code class Entity Manager Kunjungan
package
EntityManagerKunjungan;
import
Entity.Kunjungan;
import
Fungsi.Fungsi;
public class
KunjunganManager {
int i;
public int inputdata (Kunjungan k1) {
i = 0;
try {
String sql = "insert into kunjungan
values('"+k1.getNo_Kunjungan()+"','"+k1.getNo_RM()+"','"+k1.getTgl()+"','"
+ k1.getId_Poli()+"','"+k1.getId_Dokter()+"')";
i = Fungsi.EQuery(sql);
return i;
} catch (Exception e) {
return i;
}
}
public int ubahdata (Kunjungan k1) {
i = 0;
try {
String sql = "update kunjungan set No_RM='"+
k1.getNo_RM()+"',"+
" Tgl_Kunjungan='"+ k1.getTgl()+"',"+
" Id_Poliklinik='" + k1.getId_Poli() + "',"+
" Id_Dokter='" + k1.getId_Dokter() + "'"+
"where No_Kunjungan='" + k1.getNo_Kunjungan()+"'";
i = Fungsi.EQuery(sql);
return i;
} catch (Exception e) {
return i;
}
}
public int hapusdata (String ID) {
i = 0;
try {
String sql = "Delete from kunjungan where
No_Kunjungan='"+ID+"'";
i = Fungsi.EQuery(sql);
return i;
} catch (Exception e) {
return i;
}
}
}
Source code class Entity Manager Login
package
EntityManagerLogin;
import
Fungsi.Fungsi;
import
Entity.Login;
public class
LoginManager {
int i;
public int inputdata(Login l) {
i = 0;
try {
String sql = "insert into admin(Username,Password)"
+ "values ('" + l.getUsername() +"', '"+ l.getPassword() +
"')";
i = Fungsi.EQuery(sql);
return i;
} catch (Exception e) {
return i;
}
}
public int ubahdata(Login l) {
i = 0;
try {
String sql = "update admin set Password = '" +
l.getPassword()+"'"
+ "where Username = '" + l.getUsername() + "'";
i = Fungsi.EQuery(sql);
return i;
} catch (Exception e) {
return i;
}
}
public int hapusdata(String ID) {
i = 0;
try {
String sql = "Delete from admin where Username='" + ID +
"'";
i = Fungsi.EQuery(sql);
return i;
} catch (Exception e) {
return i;
}
}
}
Source code class Entity Manager Obat
package
EntityManagerObat;
import
Entity.Obat;
import
Fungsi.Fungsi;
public class
ObatManager {
int i;
public int inputdata (Obat o1) {
i = 0;
try {
String sql = "insert into obat
values('"+o1.getId_Obat()+"','"+o1.getNama_Obat()+"','"+o1.getSatuan()+"','"
+ o1.getHarga()+"')";
i = Fungsi.EQuery(sql);
return i;
} catch (Exception e) {
return i;
}
}
public int ubahdata (Obat o1) {
i = 0;
try {
String sql = "update obat set Nama_Obat='"+
o1.getNama_Obat()+"',"+
" Satuan='"+ o1.getSatuan()+"',"+
" Harga='" + o1.getHarga() + "'"+
"where Id_Obat='" + o1.getId_Obat()+"'";
i = Fungsi.EQuery(sql);
return i;
} catch (Exception e) {
return i;
}
}
public int hapusdata (String ID) {
i = 0;
try {
String sql = "Delete from obat where Id_Obat='"+ID+"'";
i = Fungsi.EQuery(sql);
return i;
} catch (Exception e) {
return i;
}
}
}
Source code class Entity Manager Pembayaran
package
EntityManagerPembayaran;
import
Entity.Pembayaran;
import
Fungsi.Fungsi;
public class
PembayaranManager {
int i;
public int inputdata (Pembayaran pby1) {
i = 0;
try {
String sql = "insert into pembayaran
values('"+pby1.getId_Pembayaran()+"','"+pby1.getNo_Kunjungan()+"','"+pby1.getId_Poliklinik()+"','"
+ pby1.getNo_Resep()+"','"+pby1.getHarga_Resep()+"','"+pby1.getTarif_Poli()+"','"+pby1.getTotal_Bayar()+"')";
i = Fungsi.EQuery(sql);
return i;
} catch (Exception e) {
return i;
}
}
public int ubahdata (Pembayaran pby1) {
i = 0;
try {
String sql = "update pembayaran set No_Kunjungan='"+
pby1.getNo_Kunjungan()+"',"+
" Poliklinik='"+ pby1.getId_Poliklinik()+"',"+
" No_Resep='" + pby1.getNo_Resep() + "',"+
"Harga_Resep='" + pby1.getHarga_Resep() + "',"+
"Tarif_Poli='" + pby1.getTarif_Poli() + ","+
" Total_Bayar='" + pby1.getTotal_Bayar() + "''"+
"where Id_Pembayaran='" + pby1.getId_Pembayaran()+ "'";
i = Fungsi.EQuery(sql);
return i;
} catch (Exception e) {
return i;
}
}
public int hapusdata (String ID) {
i = 0;
try {
String sql = "Delete from pembayaran where
Id_Pembayaran='"+ID+"'";
i = Fungsi.EQuery(sql);
return i;
} catch (Exception e) {
return i;
}
}
}
Source code class Entity Manager Poliklinik
package
EntityManagerPoliklinik;
import
Entity.Poliklinik;
import
Fungsi.Fungsi;
public class
PoliklinikManager {
int i;
public int inputdata (Poliklinik p1) {
i = 0;
try {
String
sql = "insert into poliklinik
values('"+p1.getId_Poliklinik()+"','"+p1.getNama_Poliklinik()+"','"+p1.getTarif_Poli()+"')";
i = Fungsi.EQuery(sql);
return i;
} catch (Exception e) {
return i;
}
}
public int ubahdata (Poliklinik p1) {
i = 0;
try {
String sql = "update poliklinik set Nama_Poliklinik='"+
p1.getNama_Poliklinik()+"',"+
" Tarif_Poli='"+ p1.getTarif_Poli()+"'"+
"where Id_poliklinik='" + p1.getId_Poliklinik()+"'";
i = Fungsi.EQuery(sql);
return i;
} catch (Exception e) {
return i;
}
}
public int hapusdata (String ID) {
i = 0;
try {
String sql = "Delete from poliklinik where Id_Poliklinik='"+ID+"'";
i = Fungsi.EQuery(sql);
return i;
} catch (Exception e) {
return i;
}
}
}
Source code class Entity Manager Rekam
package
EntityManagerRekam;
import
Entity.Rekam;
import
Fungsi.Fungsi;
public class
RekamManager {
int i;
public int inputdata (Rekam rk1) {
i = 0;
try {
String
sql = "insert into rekam
values('"+rk1.getId_Rekam()+"','"+rk1.getNo_Kunjungan()+"','"+rk1.getKeluhan()+"','"+rk1.getDiagnosa()+"','"+rk1.getId_Rekam()+"')";
i = Fungsi.EQuery(sql);
return i;
} catch (Exception e) {
return i;
}
}
public int ubahdata (Rekam rk1) {
i = 0;
try {
String sql = "update rekam set No_Kunjungan='"+
rk1.getNo_Kunjungan()+"',"+
" Keluhan='"+ rk1.getKeluhan()+"',"+
" Diagnosa='" + rk1.getDiagnosa() + "',"+
" Terapi='" + rk1.getTerapi() + "'"+
"where Id_Rekam='" + rk1.getId_Rekam()+"'";
i = Fungsi.EQuery(sql);
return i;
} catch (Exception e) {
return i;
}
}
public int hapusdata (String ID) {
i = 0;
try {
String sql = "Delete from rekam where ID_Rekam='"+ID+"'";
i = Fungsi.EQuery(sql);
return i;
} catch (Exception e) {
return i;
}
}
}
Source code class Entity Manager Resep
package EntityManagerResep;import Entity.Resep;
import Fungsi.Fungsi;
public class ResepManager {
int i;
public int inputdata (Resep r1) {
i = 0;
try {
String sql = "insert into resep values('"+r1.getNo_Resep()+"','"+r1.getId_Obat()+"','"+r1.getNo_Kunjungan()+"','" + r1.getHarga_Resep()+"')";
i = Fungsi.EQuery(sql);
return i;
} catch (Exception e) {
return i;
}
}
public int ubahdata (Resep r1) {
i = 0;
try {
String sql = "update resep set Id_Obat='"+ r1.getId_Obat()+"',"+
" No_Kunjungan='"+ r1.getNo_Kunjungan()+"',"+
" Harga_Resep='" + r1.getHarga_Resep()+"'"+
"where No_Resep='" + r1.getNo_Resep()+"'";
i = Fungsi.EQuery(sql);
return i;
} catch (Exception e) {
return i;
}
}
public int hapusdata (String ID) {
i = 0;
try {
String sql = "Delete from resep where No_Resep='"+ID+"'";
i = Fungsi.EQuery(sql);
return i;
} catch (Exception e) {
return i;
}
}
}
Komentar
Posting Komentar