Java web医院门诊挂号系统(适合初学者)

本系统采用Java +jsp+servlet+mysql+eclipse实现,jdbc编程,具有简单的增删改查等操作,适合初学者满足基本的需求。

1、实体类GuaHao和User类。

package entity;

public class User {
    private Integer id;
    public Integer getId() {
        return id;
    }
    public void setId(Integer id) {
        this.id = id;
    }
    public String getUsername() {
        return username;
    }
    public void setUsername(String username) {
        this.username = username;
    }
    public String getPassword() {
        return password;
    }
    public void setPassword(String password) {
        this.password = password;
    }
    private String username;
    private String password;

}

package entity;

import java.sql.Date;

public class Guahao {
    
    private Integer id;
    public Integer getId() {
        return id;
    }
    public void setId(Integer id) {
        this.id = id;
    }
    public Integer getNo() {
        return no;
    }
    public void setNo(Integer no) {
        this.no = no;
    }
    public String getCondation() {
        return condation;
    }
    public void setCondation(String condation) {
        this.condation = condation;
    }
    public String gethName() {
        return hName;
    }
    public void sethName(String hName) {
        this.hName = hName;
    }
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
    private Integer no;
    private String condation;
    private String hName;
    private Date createTime;

}


2.Jdbc连接数据


public class DBConnection {
    final static String DRIVER="com.mysql.jdbc.Driver";
    final static String URL="jdbc:mysql://localhost:3306/test?useUnicode=true&characterEncoding=utf-8";
    final static String USER="root";
    final static String PASSWORD="123456";
    public static Connection getConnection(){
        try{
            Class.forName(DRIVER);
            Connection connection=DriverManager.getConnection(URL,USER,PASSWORD);
            return connection;
        }catch(Exception e){
            e.printStackTrace();
            return null;
        }
    }
    
    public static void closeConnection(Connection c){
        try{
            c.close();
        }catch(Exception e){
            e.printStackTrace();
        }
    } 
    
    public static void main(String[] args){
        System.out.println("绿色"+DBConnection.getConnection());
    }


}
 


3、Dao层

package mapper;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

import entity.Guahao;
import utils.DBConnection;
public class GuhaoMapper {
    
    
    public List<Guahao> get_ListInfo(){
        List<Guahao> list = new ArrayList<Guahao>();
        Connection conn=DBConnection.getConnection();
        String sql = "select * from guahao";
        PreparedStatement stm = null;
        ResultSet rs = null;
        try {
            stm = conn.prepareStatement(sql);
            rs = stm.executeQuery();
            while(rs.next()){
                Guahao gh = new Guahao();
                gh.setId(rs.getInt("id"));
                gh.setNo(rs.getInt("no"));
                gh.setCondation(rs.getString("condation"));
                gh.sethName(rs.getString("hName"));
                gh.setCreateTime(rs.getDate("createTime"));
                list.add(gh);
            }
        } catch (SQLException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }finally{
            DBConnection.closeConnection(conn);
        }
        return list;
    }
    
    public boolean insert(Guahao guahao){
        Connection conn=DBConnection.getConnection();
        String sql = "insert  into guahao(no,condation,hName,createTime) values(?,?,?,?)";
        
        try{
            PreparedStatement pst=conn.prepareStatement(sql);
            pst.setInt(1, guahao.getNo());
            pst.setString(2, guahao.getCondation());
            pst.setString(3, guahao.gethName());
            pst.setDate(4,guahao.getCreateTime());
            pst.execute();
            return true;
        }catch(Exception e){
            e.printStackTrace();
            return false;
        }finally{
            DBConnection.closeConnection(conn);
        }
        
    }
    
    
    
    public boolean update(Guahao guahao,int id) {
         Connection conn=null;
         PreparedStatement stm=null;
         ResultSet rs=null;
         try{
             conn=DBConnection.getConnection();
            String sql="update guahao set no=?,condation=?,hName=?,createTime=? where id=?";
            stm=conn.prepareStatement(sql);
            stm.setInt(1,guahao.getNo());
            stm.setString(2, guahao.getCondation());
            stm.setString(3, guahao.gethName());
            stm.setDate(4, guahao.getCreateTime());
            stm.setInt(5,id);
            stm.execute();
            return true;
         
         }catch(Exception e){
             e.printStackTrace();
             return false;
         }finally{
             DBConnection.closeConnection(conn);
         }
    }
    
    
    
    public List<Guahao> findByNo(int no){    
        Connection conn=null; 
        List<Guahao> list =new ArrayList<Guahao>();
        ResultSet rs=null;
        PreparedStatement stm=null;
        try{
            conn=DBConnection.getConnection();
            String sql="select * from guahao where  no=?";
            stm=conn.prepareStatement(sql);
            stm.setInt(1, no);
            rs=stm.executeQuery();
            while(rs.next()) {
                Guahao gh =new Guahao();
                gh.setId(rs.getInt("id"));
                gh.setNo(rs.getInt("no"));
                gh.setCondation(rs.getString("condation"));
                gh.sethName(rs.getString("hName"));
                gh.setCreateTime(rs.getDate("createTime"));
                list.add(gh);
                
            }
            return list;
            }catch(Exception e){
            e.printStackTrace();
                return null;
        }finally{
            DBConnection.closeConnection(conn);
        }
        
    }
    
    public Guahao queryById(int id){
        
        Connection conn=null;
        PreparedStatement stm=null;
        ResultSet rs=null;
        try{
            conn=DBConnection.getConnection();
            String sql="select * from guahao where id=?";
            stm=conn.prepareStatement(sql);
            stm.setInt(1,id);            
            rs=stm.executeQuery();
            if(rs.next()){
                Guahao gh =new Guahao();
                gh.setId(rs.getInt("id"));
                gh.setNo(rs.getInt("no"));
                gh.setCondation(rs.getString("condation"));
                gh.sethName(rs.getString("hName"));
                gh.setCreateTime(rs.getDate("createTime"));
                return gh;
            }else{
                return null;
            }
        }catch(Exception e){
            e.printStackTrace();
            return null;
        }finally{
            DBConnection.closeConnection(conn);
        }
        
    }
    public boolean delete( int id) {
        Connection conn=null;
        
        try{
            conn=DBConnection.getConnection();
            String sql="delete from guahao where id=?";
            PreparedStatement pst=conn.prepareStatement(sql);
            pst.setInt(1,id);
            pst.execute();
            return true;
        }catch(Exception e){
            e.printStackTrace();
            return false;
        }finally{
            DBConnection.closeConnection(conn);
        }
        
    }

}


4、效果图


以上是本系统的重要代码,希望给大家一个参考。如若需要源码或者制定类似的中小型管理系统,请加QQ1728608455.,欢迎咨询
 


 

 

一个简单的医院挂号系统本采用ACCESS+ASP开发,系统经过多年应用并且持续不断改进,系统各部功能已基本完善,非常适合大型医疗集团,当然小型医院或科室就更适合了。 (注:如果你觉的功能太多而不想用其他功能,你可以只用挂号登记) 系统功能说明 1.账号权限 (系统可以任设账号,然后给账号赋予权限,比如导医账户,你可以只给他到院与否的设置,其他一概无法操作和查看,咨询账户只允许填写登记而不能修改和删除以确保登记信息不会被随意更改) 2.咨询内容 (可将咨询内容填入患者资料,以方便查询回访) 3.医院(科室)添加 (可无限动态添加科室或医院) 4.回访 (实时回访标注功能,让你对回访记录一目了然) 5.同比数据对比 (让您时时刻刻了解同期数据对比情况,以了解广告投入和同期回报率) 6.数据明细 (竞价广告、电视广告等等全部综合和单独统计到院和预约量实时掌握成本控制) 7.预约人员评比 (实时查看咨询人员到诊数与预约数,以便了解每位咨询人员的咨询质量和能力,更能促进咨询人员的竞争心理) 8.咨询内容记录 (以方便记录每位患者的详细情况,并了解他为何没有到院以便更好的回访) 9、到院跟踪 (运营部、网络部、医院组、导医组、咨询组完美解决医院内部沟通之间的问题) 还有更多更能您可登陆查看
评论 6
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

源码客栈-逍遥游

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值