package cc.zte.dao;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import cc.zte.db.DBManager;
import cc.zte.entity.Appoint;
import java.util.Random;
import cc.zte.entity.Day;
import cc.zte.entity.Depart;
import cc.zte.entity.Doctor;
import cc.zte.entity.Hospital;
import cc.zte.entity.Orders;
import cc.zte.entity.Patient;
import cc.zte.entity.Reply;
import cc.zte.entity.Section;
import cc.zte.entity.Topic;
public class PatientDao extends DBManager{
//����û��Ƿ����
public Patient checkPatientLogin(String puname,String pupwd){
Patient user=null;
String sql = "select * from patient where uname='"+puname+"' and upwd='"+pupwd+"'";
this.setSql(sql);
try {
rs = this.executeQuery();
while(rs.next()){
user = new Patient();
// ���û��������Ը�ֵ
user.setPid(rs.getInt("pid"));
user.setName(rs.getString("name"));
user.setAddress(rs.getString("address"));
user.setAge(rs.getString("age"));
user.setPhone(rs.getString("phone"));
user.setSex(rs.getString("sex"));
user.setUname(rs.getString("uname"));
user.setUpwd(rs.getString("upwd"));
user.setPcount(rs.getString("pcount"));
user.setPstatus(rs.getString("pstatus"));
user.setPcard(rs.getString("pcard"));
}
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return user;
}
//����û�ID�Ƿ��Ѿ�����
public boolean isunameExist(String name) {
boolean a = false;
String sql = "select * from patient where uname='"+name+"'";
this.setSql(sql);
try {
rs = this.executeQuery();
while(rs.next()){
a = true;
}
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return a;
}
//������֤�Ƿ�ע��
public boolean iscardExist(String pcard) {
boolean a = false;
String sql = "select * from patient where pcard='"+pcard+"'";
this.setSql(sql);
try {
rs = this.executeQuery();
while(rs.next()){
a = true;
}
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return a;
}
//ע�Ỽ�߷���
public int insertPatient(Patient patient){
String sql = "insert into Patient values(?,?,?,?,?,?,?,?,?,?)";
List<Object> param = new ArrayList<Object>();
param.add(patient.getName());
param.add(patient.getUname());
param.add(patient.getUpwd());
param.add(patient.getSex());
param.add(patient.getPcard());
param.add(patient.getAge());
param.add(patient.getAddress());
param.add(patient.getPhone());
param.add(patient.getPcount());
param.add(patient.getPstatus());
this.setSql(sql);
this.setParam(param);
int a = this.executeUpdate();
return a;
}
//�������
public boolean checkPwd(int pid ,String upwd){
String sql = "select upwd from patient where pid = '"+pid+"'";
this.setSql(sql);
try {
rs = this.executeQuery();
while(rs.next()){
String pwd=rs.getString("upwd");
if(pwd.equals(upwd))
{ return true;}
else{return false;}
}
} catch (SQLException e) {
e.printStackTrace();
}
return false;
}
//������
public int changePwd(int pid,String nupwd){
String sql = "update patient set upwd= '"+nupwd+"' where pid ='"+pid+"'";
this.setSql(sql);
return this.executeUpdate();
}
//�ĸ�����Ϣ
public Patient changeMsg(Patient user,String age,String phone,String address) throws SQLException
{
String sql = "update patient set address= '"+address+"' ,phone='"+phone+"',age='"+age+"' where pid ='"+user.getPid()+"'";
this.setSql(sql);
Patient userr=null;
if(this.executeUpdate()!=0){
userr = new Patient();
// ���û��������Ը�ֵ
userr.setPid(user.getPid());
userr.setUname(user.getUname());
userr.setUpwd(user.getUpwd());
userr.setAddress(address);
userr.setName(user.getName());
userr.setAge(age);
userr.setSex(user.getSex());
userr.setPhone(phone);
userr.setPcount(user.getPcount());
userr.setPstatus(user.getPstatus());
userr.setPcard(user.getPcard());
}
return userr;
}
//��ѯһ��������Ϣ
public Patient CheckPatientone(int pid ){
String sql = "select * from patient where pid='"+pid+"'";
this.setSql(sql);
rs = this.executeQuery();
Patient d = new Patient();
try {
while(rs.next()){
d.setAddress(rs.getString("address"));
d.setAge(rs.getString("age"));
d.setName(rs.getString("name"));
d.setPcard(rs.getString("pcard"));
d.setPcount(rs.getString("pcount"));
d.setPhone(rs.getString("phone"));
d.setPid(rs.getInt("pid"));
d.setPstatus(rs.getString("pstatus"));
d.setSex(rs.getString("sex"));
d.setUname(rs.getString("uname"));
d.setUpwd(rs.getString("upwd"));
this.setParam(param);
}
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return d;
}
//���߲�ѯҽԺ
public List<Hospital> CheckHospital(String hname){
List<Hospital> list = new ArrayList<Hospital>();
String sql = "select * from hospital where hstatus='1' ";
System.out.println("hname00000000000000000");
System.out.println(hname);
if(hname!="")
{
sql+=" and hname like '"+hname+"%'";
}
this.setSql(sql);
rs = this.executeQuery();
Hospital d = new Hospital();
try {
while(rs.next()){
d = new Hospital();
d.setHaddress(rs.getString("haddress"));
d.setHid( rs.getInt("hid"));
d.setHintr(rs.getString("hintr")) ;
d.setHname(rs.getString("hname")) ;
d.setHphone(rs.getString("hphone")) ;
this.setParam(param);
list.add(d);
}
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return list;
}
//��ѯҽԺ��ҳ��Ϣ
public ResultSet GetHospital(int hid){
rs=null;
String sql = "select * from hospital where hid='"+hid+"'";
this.setSql(sql);
rs = this.executeQuery();
return rs;
}
//��ѯҽԺ�Ŀ�����Ϣ
public List<Depart> CheckDepart(int hid){
List<Depart> list = new ArrayList<Depart>();
String sql = "select * from department where hid='"+hid+"' order by kid";
this.setSql(sql);
rs = this.executeQuery();
Depart d = new Depart();
try {
while(rs.next()){
d = new Depart();
d.setHid( rs.getInt("hid"));
d.setKaddress(rs.getString("kaddress"));
d.setKid( rs.getString("kid"));
d.setKintr(rs.getString("kintr")) ;
d.setKname(rs.getString("kname")) ;
d.setKphone(rs.getString("kphone")) ;
this.setParam(param);
list.add(d);
}
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return list;
}
//��ѯ ҽ�� ��Ϣ
public List<Doctor> CheckDoctor(int hid,String kid ){
List<Doctor> list = new ArrayList<Doctor>();
String sql = "select * from doctor where hid='"+hid+"'";
System.out.println("hid");
System.out.println(kid);
if(kid!=
没有合适的资源?快使用搜索试试~ 我知道了~
网上预约挂号系统.zip
共295个文件
class:76个
java:76个
jsp:47个
4星 · 超过85%的资源 需积分: 25 43 下载量 19 浏览量
2019-06-18
16:19:46
上传
评论 7
收藏 4.53MB ZIP 举报
温馨提示
使用eclipse,SQL数据库实现的一个网上预约挂号系统,包括登录,查询,登记,挂号等功能
资源推荐
资源详情
资源评论
收起资源包目录
网上预约挂号系统.zip (295个子文件)
AdminDao.java.bak 9KB
AdminDao.java.bak 9KB
PatientDao.class 22KB
HospitalDao.class 19KB
AdminDao.class 15KB
ExcelDao.class 7KB
AddSectionpic.class 5KB
PatientOrders.class 4KB
ReplyAdd.class 4KB
Patient.class 4KB
AppointDelete.class 3KB
AD.class 3KB
Orders.class 3KB
DBManager.class 3KB
Doctor.class 3KB
PatientRegSuccess.class 3KB
Hospital.class 3KB
ToExcel.class 3KB
Appoint.class 3KB
Reply.class 3KB
AppointAdd.class 3KB
TopicAdd.class 3KB
DoctorAdd.class 3KB
DepartAdd.class 3KB
BbsAdd.class 3KB
Topic.class 2KB
PatientChangemsg.class 2KB
ChangeMsg.class 2KB
HospitalReg.class 2KB
DoctorChangemsg.class 2KB
AdminDeleteServlet.class 2KB
DoctorDeleted.class 2KB
AdminChange.class 2KB
DepartDelete.class 2KB
ReplyDelete.class 2KB
HospitalLogin.class 2KB
PatientSdepart.class 2KB
PatientChangepwd.class 2KB
AdminLoginServlet.class 2KB
ChangePwd.class 2KB
AdminAddsec.class 2KB
PatientAdminCheckServlet.class 2KB
PatientSappoint.class 2KB
HospitalDorders.class 2KB
AdminChangesec.class 2KB
DepartChangemsg.class 2KB
PatientCancelorders.class 2KB
AppointChange.class 2KB
BbsChange.class 2KB
AdminDeltop.class 2KB
AdminAdd.class 2KB
PatientShospital.class 2KB
Depart.class 2KB
BBS.class 2KB
HospitalOut.class 2KB
AppointSearch.class 2KB
HospitalSorders.class 2KB
TopicDelete.class 2KB
BbsSearch.class 2KB
BbsDelete.class 2KB
AdminPasshos.class 2KB
AdminDelhos.class 2KB
AdminDelpat.class 2KB
AdminOutpat.class 2KB
AdminDelsec.class 2KB
AdminInpat.class 2KB
PatientOut.class 2KB
AdminOut.class 2KB
Section.class 2KB
DepartSearch.class 2KB
DoctorSearch.class 2KB
EncodeFilter.class 2KB
AdminCheckhos.class 2KB
AdminCheckpat.class 2KB
YiyuanOut.class 2KB
Admin.class 1KB
AdminSearch.class 1KB
Day.class 691B
.classpath 2KB
org.eclipse.wst.common.component 544B
org.eclipse.wst.jsdt.ui.superType.container 49B
bootstrap.css 134KB
bootstrap.min.css 111KB
bootstrap.min.one.css 97KB
bootstrap-theme.css 21KB
bootstrap-theme.min.css 19KB
common.css 13KB
main.css 3KB
signin.css 1KB
glyphicons-halflings-regular.eot 20KB
icomoon.eot 18KB
onShow.gif 951B
onCorrect.gif 634B
onFocus.gif 633B
onError.gif 633B
poi-3.7-20101029.jar 1.6MB
jxl.jar 692KB
sqljdbc4.jar 525KB
commons-io-1.4.jar 106KB
commons-fileupload-1.2.1.jar 56KB
共 295 条
- 1
- 2
- 3
资源评论
- weixin_428690862019-06-23博主运行试过么,我一直连不上数据库
zlygmx
- 粉丝: 0
- 资源: 4
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功