BVB Source Codes

The Android source client + server register online booking system Show DiagnosisDaoImpl.java Source code

Return Download The Android source client + server register online booking system: download DiagnosisDaoImpl.java Source code - Download The Android source client + server register online booking system Source code - Type:.java
  1. package com.hospital.daoimpl;
  2.  
  3. import java.sql.Connection;
  4. import java.sql.ResultSet;
  5. import java.sql.SQLException;
  6. import java.sql.Statement;
  7. import java.util.ArrayList;
  8. import java.util.List;
  9.  
  10. import com.hospital.dao.BaseDao;
  11. import com.hospital.model.Diagnosis;
  12. import com.hospital.model.User;
  13. import com.hospital.util.DaoUtil;
  14.  
  15. public class DiagnosisDaoImpl implements BaseDao<Diagnosis>{
  16.         private Connection conn;
  17.         private Statement stat;
  18.  
  19.         public boolean delete(int id) {
  20.                 conn = DaoUtil.getConnection();
  21.                 stat = DaoUtil.getStatement(conn);
  22.                 try {
  23.                         stat.executeUpdate("delete from diagnosis where id="+id);
  24.                 } catch (SQLException e) {
  25.                         // TODO Auto-generated catch block
  26.                         e.printStackTrace();
  27.                         return false;
  28.                 }
  29.                 return true;
  30.         }
  31.  
  32.         public Diagnosis get(int id) {
  33.                 conn = DaoUtil.getConnection();
  34.                 stat = DaoUtil.getStatement(conn);
  35.                 Diagnosis diagnosis = null;
  36.                 try {
  37.                         ResultSet rs = stat.executeQuery("select * from diagnosis where id="+id);
  38.                         while (rs.next()){
  39.                                 Diagnosis temp = new Diagnosis();
  40.                                 temp.setId(rs.getInt(1));
  41.                                 temp.setWeek(rs.getInt(2));
  42.                                 temp.setDoctorId(rs.getInt(3));
  43.                                 diagnosis = temp;
  44.                         }
  45.                 } catch (SQLException e) {
  46.                         // TODO Auto-generated catch block
  47.                         e.printStackTrace();
  48.                 }
  49.                 return diagnosis;
  50.         }
  51.  
  52.         public boolean save(Diagnosis t) {
  53.                 conn = DaoUtil.getConnection();
  54.                 stat = DaoUtil.getStatement(conn);
  55.                 try {
  56.                         stat.executeUpdate("insert into diagnosis(week,doctor_id) values('"+
  57.                                         t.getWeek()+"','"+t.getDoctorId()+"')");
  58.                         conn.close();
  59.                         stat.close();
  60.                 } catch (SQLException e) {
  61.                         e.printStackTrace();
  62.                         return false;
  63.                 }
  64.                 return true;
  65.         }
  66.  
  67.         public boolean update(Diagnosis t) {
  68.                 conn = DaoUtil.getConnection();
  69.                 stat = DaoUtil.getStatement(conn);
  70.                 try {
  71.                         stat.executeUpdate("update diagnosis set week="+t.getWeek()+",doctor_id="+t.getDoctorId());
  72.                         conn.close();
  73.                         stat.close();
  74.                 } catch (SQLException e) {
  75.                         e.printStackTrace();
  76.                         return false;
  77.                 }
  78.                 return true;
  79.         }
  80.  
  81.         public List<Diagnosis> getAll() {
  82.                 conn = DaoUtil.getConnection();
  83.                 stat = DaoUtil.getStatement(conn);
  84.                 List<Diagnosis> list = new ArrayList<Diagnosis>();
  85.                 try {
  86.                         ResultSet rs = stat.executeQuery("select * from diagnosis");
  87.                         while (rs.next()){
  88.                                 Diagnosis temp = new Diagnosis();
  89.                                 temp.setId(rs.getInt(1));
  90.                                 temp.setWeek(rs.getInt(2));
  91.                                 temp.setDoctorId(rs.getInt(3));
  92.                                 list.add(temp);
  93.                         }
  94.                 } catch (SQLException e) {
  95.                         // TODO Auto-generated catch block
  96.                         e.printStackTrace();
  97.                 }
  98.                 return list;
  99.         }
  100. }
  101.  
downloadDiagnosisDaoImpl.java Source code - Download The Android source client + server register online booking system Source code
Related Source Codes/Software:
CoordinatorTabLayout cool components - CoordinatorTabLayout is combination of a custom co... 2017-02-26
grace - Graceful restart & zero downtime deploy for Go... 2017-02-26
tpm - Tmux Plugin Manager 2017-02-26
Win32-OpenSSH - Win32 port of OpenSSH 2017-02-26
goconvey - Go testing in the browser. Integrates with `go tes... 2017-02-26
The Android source gorgeous sunny weather weather forecast program source code - This item is a weather forecast program source cod... 2017-02-26
The Android source of guangdong ocean university library Android client program source code - This project is a guangdong ocean university libra... 2017-02-26
The Android source code imitation sing part layout interface project - This project is a modeled after sing the UI projec... 2017-02-27
The Android source CSDN information client try simple project - This item is a CSDN practice version information o... 2017-02-27
Android jingdong financial front page head effect - Principle is very simple, is through listening Scr... 2017-02-27
flakes - Flakes is an Admin Template Framework. A combinati... 2017-04-15
capstone - Capstone disassembly/disassembler framework: Core ... 2017-04-15
nginx-resources - A collection of resources covering Nginx, Nginx + ... 2017-04-15
utron - A lightweight MVC framework for Go(Golang) 2017-04-15
cfssl - CFSSL: Cloudflare's PKI and TLS toolkit ... 2017-04-15
HandBrake - HandBrake's main development repository ... 2017-04-15
Awesome-Networking - A curated list of awesome networking libraries, re... 2017-04-15
react-sortable-hoc - A set of higher-order components to turn any list ... 2017-04-15
jugglingdb - Multi-database ORM for nodejs: redis, mongodb, mys... 2017-04-15
waybackpack - Download the entire Wayback Machine archive for a ... 2017-04-15

 Back to top