MyHospital09
UserSql.java
package com.chinasofti.hospital.user.sql;
public class UserSql {
public static final String FIND_NAME = "select PATIENT_NAME from patient where PATIENT_NAME = ?";
public static final String REGISTER = "insert into patient(patient_Id,PATIENT_NAME,ACCOUNT,USERPWD,sex,age,telphone,MAIL) values(PATIENT_SEQ.nextval,?,?,?,?,?,?,?)";
public static final String PATIENT_LOGIN = "select userPwd from patient where ACCOUNT = ?";
public static final String ADMIN_LOGIN = "select Pwd from admin where admin_Name = ?";
public static final String DOCTOR_LOGIN = "select PASSWORD from doctor where DOCTOR_NAME = ?";
public static final String SQL_QUERY_DOCTOR_BYNAME = "select * from doctor where DOCTOR_NAME = ?";
public static final String SQL_QUERY_DEPARTMENT_BYNAME = "select * from department where DEPARTMENT_NAME = ?";
public static final String QUERY_DEPARTMENT_COUNT = "select count(department_id) from department";
public static final String QUERY_DEPARTMENT_FENYE = "select * from (select rownum r,b.* from(select * from department order by department_id) b where rownum <=?) where r>=?";
public static final String QUERY_DOCTOR_FENYE ="select * from (select rownum r,b.* from(select * from doctor order by doctor_id) b where rownum <=?) where r>=?";
public static final String QUERY_DOCTOR_COUNT = "select count(doctor_id) from doctor";
public static final String QUERY_DEPARTMENT_BY_NAME = "select DEPARTMENT_NAME from department where DEPARTMENT_NAME = ?";
public static final String GUAHAOREGISTER = "insert into guahao(GUAHAO_ID,DEPARTMENT_NAME,WORK_TIME,DOCTOR_NAME,MONEY,PATIENT_NAME,SEX) values(GUAHAO_SEQ.nextval,?,?,?,9,?,?)";
public static final String PATIENT_QUERY_BY_ACCOUNT = "select * from patient where account=?";
public static final String GuaHao_QUERY_BY_PATIENT_NAME = "select * from guahao where PATIENT_NAME=?";
public static final String UPDATE_PATIENT_BY_ACCOUNT = "update patient set USERPWD=?,SEX=?,AGE=?,TELPHONE=?,MAIL=? where account=?";
public static final String DOCTOR_QUERY_BY_DOCTOR_NAME = "select * from DOCTOR where DOCTOR_NAME=?";
public static final String GuaHao_QUERY_BY_DOCTOR_NAME = "select * from guahao where DOCTOR_NAME=?";
public static final String DOCTOR_QUERY_ALL = "select * from DOCTOR";
public static final String GuaHao_QUERY_ALL = "select * from guahao";
public static final String QUERY_DEPARTMENT_ALL = "select * from department";
public static final String QUERY_ACCOUNT_BY_PATIENT_NAME = "select account from patient where PATIENT_NAME = ?";
public static final String UPDATE_DOCTOR_BY_DOCTOR_ID = "update doctor set DOCTOR_NAME=?,PASSWORD=?,DEPARTMENT_NAME=?,JOB_TITLE=?,GOOD_JOB=?,JOB_SYNOPSIS=?,INTRODUCTION=? where DOCTOR_ID=?";
public static final String DELETE_DOCTOR_BY_DOCTOR_ID = "delete from doctor where DOCTOR_ID=?";
public static final String UPDATE_DEPARTMENT_BY_DEPARTMENT_ID = "update DEPARTMENT set DEPARTMENT_SYNOPSIS=?,DEPARTMENT_NOTICE_CONTENT=?,DEPARTMENT_NOTICE_HEAD=? where DEPARTMENT_ID=?";
public static final String DELETE_DEPARTMENT_BY_DEPARTMENT_ID = "delete from DEPARTMENT where DEPARTMENT_ID=?";
public static final String ADD_DOCTOR = "insert into doctor(DOCTOR_ID,DOCTOR_NAME,PASSWORD,DEPARTMENT_NAME,JOB_TITLE,GOOD_JOB,JOB_SYNOPSIS,INTRODUCTION,img) values(?,?,?,?,?,?,?,?,a)";
public static final String ADD_DEPARTMENT = "insert into DEPARTMENT(DEPARTMENT_ID,DEPARTMENT_NAME,DEPARTMENT_SYNOPSIS,DEPARTMENT_NOTICE_HEAD,DEPARTMENT_NOTICE_CONTENT) values(DEP_SEQ.nextval,?,?,?,?)";
public static final String ADD_NOTICE = "insert into Notice(NOTICE_ID,NOTICE_HEAD,NOTICE_CONTENT) values(INFO_ID.nextval,?,?)";
public static final String QUERY_NOTICE_ALL = "select * from Notice";
public static final String DOCTOR_QUERY_BY_DEPARTMENT_NAME = "select * from DOCTOR where DEPARTMENT_NAME=?";
}
UserService.java
package com.chinasofti.hospital.user.service;
import java.util.List;
import com.chinasofti.hospital.user.dao.UserDao;
import com.chinasofti.hospital.user.vo.Department;
import com.chinasofti.hospital.user.vo.Doctor;
import com.chinasofti.hospital.user.vo.GuaHao;
import com.chinasofti.hospital.user.vo.Notice;
import com.chinasofti.hospital.user.vo.Patient;
import com.chinasofti.hospital.util.PageHelper;
public class UserService {
public boolean findNameService(String name) {
// TODO Auto-generated method stub
UserDao dao = new UserDao();
return dao.findNameDao(name);
}
public int registerService(Patient patient) {
// TODO Auto-generated method stub
UserDao dao = new UserDao();
return dao.registerDao(patient);
}
public boolean patientLoginService(String userName, String userPwd) {
// TODO Auto-generated method stub
UserDao dao = new UserDao();
String pwd = dao.patientLoginDao(userName);
if(userPwd.equals(pwd)){
return true;
}
return false;
}
public boolean adminLoginService(String adminName, String adminPwd) {
// TODO Auto-generated method stub
UserDao dao = new UserDao();
String apwd = dao.adminLoginDao(adminName);
if(adminPwd.equals(apwd)){
return true;
}
return false;
}
public boolean doctorLoginService(String doctorName, String doctorPwd) {
// TODO Auto-generated method stub
UserDao dao = new UserDao();
String dpwd = dao.doctoLoginDao(doctorName);
if(doctorPwd.equals(dpwd)){
return true;
}
return false;
}
public Doctor queryDoctorService(String DOCTOR_NAME) {
// TODO Auto-generated method stub
UserDao dao = new UserDao();
Doctor doctor = dao.queryDoctorDao(DOCTOR_NAME);
return doctor;
}
public Department queryDepartmentService(String DEPARTMENT_NAME) {
// TODO Auto-generated method stub
UserDao dao = new UserDao();
Department department = dao.queryDepartmentDao(DEPARTMENT_NAME);
return department;
}
public int getCountService() {
// TODO Auto-generated method stub
UserDao dao = new UserDao();
return dao.getCountDao();
}
public List<Department> queryDepartmentService(PageHelper helper) {
// TODO Auto-generated method stub
UserDao dao = new UserDao();
return dao.queryDepartmentDao(helper);
}
public List<Doctor> queryDoctorService(PageHelper helper) {
// TODO Auto-generated method stub
UserDao dao = new UserDao();
return dao.queryDoctorDao(helper);
}
public int getCountDoctorService() {
// TODO Auto-generated method stub
UserDao dao = new UserDao();
return dao.getCountDoctorDao();
}
public boolean queryBySnameService(String sname) {
// TODO Auto-generated method stub
UserDao dao = new UserDao();
return dao.queryBySnameDao(sname);
}
public int registerGuaHaoService(GuaHao guaHao) {
// TODO Auto-generated method stub
UserDao dao = new UserDao();
return dao.registerGuaHaoDao(guaHao);
}
public List<Patient> patientQueryService(String account) {
// TODO Auto-generated method stub
UserDao dao = new UserDao();
return dao.patientQueryDao(account);
}
public List<GuaHao> guaHaoQueryService(String PATIENT_NAME) {
// TODO Auto-generated method stub
UserDao dao = new UserDao();
return dao.guaHaoQueryDao(PATIENT_NAME);
}
public int updatePatientService(String account,Patient patient) {
// TODO Auto-generated method stub
UserDao dao = new UserDao();
return dao.updatePatientDao(account,patient);
}
public List<Doctor> doctorQueryService(String DOCTOR_NAME) {
// TODO Auto-generated method stub
UserDao dao = new UserDao();
return dao.doctorQueryDao(DOCTOR_NAME);
}
public List<GuaHao> guaHaoQueryByDoctorNameService(String DOCTOR_NAME) {
// TODO Auto-generated method stub
UserDao dao = new UserDao();
return dao.guaHaoQueryByDoctorNameDao(DOCTOR_NAME);
}
public List<Doctor> queryAllDoctorService() {
// TODO Auto-generated method stub
UserDao dao = new UserDao();
return dao.queryAllDoctorDao();
}
public List<GuaHao> queryAllGuaHaoService() {
// TODO Auto-generated method stub
UserDao dao = new UserDao();
return dao.queryAllGuaHaoDao();
}
public List<Department> queryAllDepartmentService() {
// TODO Auto-generated method stub
UserDao dao = new UserDao();
return dao.queryAllDepartmentDao();
}
public String queryPatientByNameService(String PATIENT_NAME) {
// TODO Auto-generated method stub
UserDao dao = new UserDao();
return dao.queryPatientByNameDao(PATIENT_NAME);
}
public int updateDoctorService(String DOCTOR_ID, Doctor doctor) {
// TODO Auto-generated method stub
UserDao dao = new UserDao();
return dao.updateDoctortDao(DOCTOR_ID,doctor);
}
public int deleteDoctorService(String DOCTOR_ID) {
// TODO Auto-generated method stub
UserDao dao = new UserDao();
return dao.deleteDoctortDao(DOCTOR_ID);
}
public int updateDepartmentService(String DEPARTMENT_ID, Department department) {
// TODO Auto-generated method stub
UserDao dao = new UserDao();
return dao.updateDepartmentDao(DEPARTMENT_ID,department);
}
public int deleteDepartmentService(String DEPARTMENT_ID) {
// TODO Auto-generated method stub
UserDao dao = new UserDao();
return dao.deleteDepartmentDao(DEPARTMENT_ID);
}
public int addDoctorService(Doctor doctor) {
// TODO Auto-generated method stub
UserDao dao = new UserDao();
return dao.addDoctortDao(doctor);
}
public int addDepartmentService(Department department) {
// TODO Auto-generated method stub
UserDao dao = new UserDao();
return dao.addDepartmentDao(department);
}
public int addNoticeService(Notice notice) {
// TODO Auto-generated method stub
UserDao dao = new UserDao();
return dao.addNoticeDao(notice);
}
public List<Notice> noticeQueryService() {
// TODO Auto-generated method stub
UserDao dao = new UserDao();
return dao.noticeQueryDao();
}
public List<Doctor> queryDoctorByDepartmentNameService(String DEPARTMENT_NAME) {
// TODO Auto-generated method stub
UserDao dao = new UserDao();
return dao.queryDoctorByDepartmentNameDao(DEPARTMENT_NAME);
}
}
Department.java
package com.chinasofti.hospital.user.vo;
public class Department {
private String DEPARTMENT_ID;
private String DEPARTMENT_NAME;
private String DEPARTMENT_SYNOPSIS;
private String DEPARTMENT_NOTICE_CONTENT;
private String DEPARTMENT_NOTICE_HEAD;
public Department(String dEPARTMENT_ID, String dEPARTMENT_NAME, String dEPARTMENT_SYNOPSIS,
String dEPARTMENT_NOTICE_CONTENT, String dEPARTMENT_NOTICE_HEAD) {
super();
DEPARTMENT_ID = dEPARTMENT_ID;
DEPARTMENT_NAME = dEPARTMENT_NAME;
DEPARTMENT_SYNOPSIS = dEPARTMENT_SYNOPSIS;
DEPARTMENT_NOTICE_CONTENT = dEPARTMENT_NOTICE_CONTENT;
DEPARTMENT_NOTICE_HEAD = dEPARTMENT_NOTICE_HEAD;
}
public Department() {
super();
}
public String getDEPARTMENT_ID() {
return DEPARTMENT_ID;
}
public void setDEPARTMENT_ID(String dEPARTMENT_ID) {
DEPARTMENT_ID = dEPARTMENT_ID;
}
public String getDEPARTMENT_NAME() {
return DEPARTMENT_NAME;
}
public void setDEPARTMENT_NAME(String dEPARTMENT_NAME) {
DEPARTMENT_NAME = dEPARTMENT_NAME;
}
public String getDEPARTMENT_SYNOPSIS() {
return DEPARTMENT_SYNOPSIS;
}
public void setDEPARTMENT_SYNOPSIS(String dEPARTMENT_SYNOPSIS) {
DEPARTMENT_SYNOPSIS = dEPARTMENT_SYNOPSIS;
}
public String getDEPARTMENT_NOTICE_CONTENT() {
return DEPARTMENT_NOTICE_CONTENT;
}
public void setDEPARTMENT_NOTICE_CONTENT(String dEPARTMENT_NOTICE_CONTENT) {
DEPARTMENT_NOTICE_CONTENT = dEPARTMENT_NOTICE_CONTENT;
}
public String getDEPARTMENT_NOTICE_HEAD() {
return DEPARTMENT_NOTICE_HEAD;
}
public void setDEPARTMENT_NOTICE_HEAD(String dEPARTMENT_NOTICE_HEAD) {
DEPARTMENT_NOTICE_HEAD = dEPARTMENT_NOTICE_HEAD;
}
@Override
public String toString() {
return "Department [DEPARTMENT_ID=" + DEPARTMENT_ID + ", DEPARTMENT_NAME=" + DEPARTMENT_NAME
+ ", DEPARTMENT_SYNOPSIS=" + DEPARTMENT_SYNOPSIS + ", DEPARTMENT_NOTICE_CONTENT="
+ DEPARTMENT_NOTICE_CONTENT + ", DEPARTMENT_NOTICE_HEAD=" + DEPARTMENT_NOTICE_HEAD + "]";
}
}
Doctor.java
package com.chinasofti.hospital.user.vo;
public class Doctor {
private String DOCTOR_ID;
private String DOCTOR_NAME;
private String PASSWORD;
private String DEPARTMENT_NAME;
private String JOB_TITLE;
private String GOOD_JOB ;
private String JOB_SYNOPSIS ;
private String INTRODUCTION;
private String IMG;
public Doctor(String dOCTOR_ID, String dOCTOR_NAME, String pASSWORD, String dEPARTMENT_NAME, String jOB_TITLE,
String gOOD_JOB, String jOB_SYNOPSIS, String iNTRODUCTION, String iMG) {
super();
DOCTOR_ID = dOCTOR_ID;
DOCTOR_NAME = dOCTOR_NAME;
PASSWORD = pASSWORD;
DEPARTMENT_NAME = dEPARTMENT_NAME;
JOB_TITLE = jOB_TITLE;
GOOD_JOB = gOOD_JOB;
JOB_SYNOPSIS = jOB_SYNOPSIS;
INTRODUCTION = iNTRODUCTION;
IMG = iMG;
}
public Doctor() {
super();
}
public String getDOCTOR_ID() {
return DOCTOR_ID;
}
public void setDOCTOR_ID(String dOCTOR_ID) {
DOCTOR_ID = dOCTOR_ID;
}
public String getDOCTOR_NAME() {
return DOCTOR_NAME;
}
public void setDOCTOR_NAME(String dOCTOR_NAME) {
DOCTOR_NAME = dOCTOR_NAME;
}
public String getPASSWORD() {
return PASSWORD;
}
public void setPASSWORD(String pASSWORD) {
PASSWORD = pASSWORD;
}
public String getDEPARTMENT_NAME() {
return DEPARTMENT_NAME;
}
public void setDEPARTMENT_NAME(String dEPARTMENT_NAME) {
DEPARTMENT_NAME = dEPARTMENT_NAME;
}
public String getJOB_TITLE() {
return JOB_TITLE;
}
public void setJOB_TITLE(String jOB_TITLE) {
JOB_TITLE = jOB_TITLE;
}
public String getGOOD_JOB() {
return GOOD_JOB;
}
public void setGOOD_JOB(String gOOD_JOB) {
GOOD_JOB = gOOD_JOB;
}
public String getJOB_SYNOPSIS() {
return JOB_SYNOPSIS;
}
public void setJOB_SYNOPSIS(String jOB_SYNOPSIS) {
JOB_SYNOPSIS = jOB_SYNOPSIS;
}
public String getINTRODUCTION() {
return INTRODUCTION;
}
public void setINTRODUCTION(String iNTRODUCTION) {
INTRODUCTION = iNTRODUCTION;
}
public String getIMG() {
return IMG;
}
public void setIMG(String iMG) {
IMG = iMG;
}
@Override
public String toString() {
return "Doctor [DOCTOR_ID=" + DOCTOR_ID + ", DOCTOR_NAME=" + DOCTOR_NAME + ", PASSWORD=" + PASSWORD
+ ", DEPARTMENT_NAME=" + DEPARTMENT_NAME + ", JOB_TITLE=" + JOB_TITLE + ", GOOD_JOB=" + GOOD_JOB
+ ", JOB_SYNOPSIS=" + JOB_SYNOPSIS + ", INTRODUCTION=" + INTRODUCTION + ", IMG=" + IMG + "]";
}
}
GuaHao.java
package com.chinasofti.hospital.user.vo;
public class GuaHao {
private String GUAHAO_ID;
private String DEPARTMENT_NAME;
private String WORK_TIME;
private String DOCTOR_NAME;
private String MONEY;
private String PATIENT_NAME;
private String SEX;
public GuaHao(String gUAHAO_ID, String dEPARTMENT_NAME, String wORK_TIME, String dOCTOR_NAME, String mONEY,
String pATIENT_NAME, String sEX) {
super();
GUAHAO_ID = gUAHAO_ID;
DEPARTMENT_NAME = dEPARTMENT_NAME;
WORK_TIME = wORK_TIME;
DOCTOR_NAME = dOCTOR_NAME;
MONEY = mONEY;
PATIENT_NAME = pATIENT_NAME;
SEX = sEX;
}
public GuaHao() {
super();
}
public String getGUAHAO_ID() {
return GUAHAO_ID;
}
public void setGUAHAO_ID(String gUAHAO_ID) {
GUAHAO_ID = gUAHAO_ID;
}
public String getDEPARTMENT_NAME() {
return DEPARTMENT_NAME;
}
public void setDEPARTMENT_NAME(String dEPARTMENT_NAME) {
DEPARTMENT_NAME = dEPARTMENT_NAME;
}
public String getWORK_TIME() {
return WORK_TIME;
}
public void setWORK_TIME(String wORK_TIME) {
WORK_TIME = wORK_TIME;
}
public String getDOCTOR_NAME() {
return DOCTOR_NAME;
}
public void setDOCTOR_NAME(String dOCTOR_NAME) {
DOCTOR_NAME = dOCTOR_NAME;
}
public String getMONEY() {
return MONEY;
}
public void setMONEY(String mONEY) {
MONEY = mONEY;
}
public String getPATIENT_NAME() {
return PATIENT_NAME;
}
public void setPATIENT_NAME(String pATIENT_NAME) {
PATIENT_NAME = pATIENT_NAME;
}
public String getSEX() {
return SEX;
}
public void setSEX(String sEX) {
SEX = sEX;
}
@Override
public String toString() {
return "GuaHao [GUAHAO_ID=" + GUAHAO_ID + ", DEPARTMENT_NAME=" + DEPARTMENT_NAME + ", WORK_TIME=" + WORK_TIME
+ ", DOCTOR_NAME=" + DOCTOR_NAME + ", MONEY=" + MONEY + ", PATIENT_NAME=" + PATIENT_NAME + ", SEX="
+ SEX + "]";
}
}
Notice.java
package com.chinasofti.hospital.user.vo;
public class Notice {
private String NOTICE_ID;
private String NOTICE_HEAD;
private String NOTICE_CONTENT;
public Notice(String nOTICE_ID, String nOTICE_HEAD, String nOTICE_CONTENT) {
super();
NOTICE_ID = nOTICE_ID;
NOTICE_HEAD = nOTICE_HEAD;
NOTICE_CONTENT = nOTICE_CONTENT;
}
public Notice() {
super();
}
public String getNOTICE_ID() {
return NOTICE_ID;
}
public void setNOTICE_ID(String nOTICE_ID) {
NOTICE_ID = nOTICE_ID;
}
public String getNOTICE_HEAD() {
return NOTICE_HEAD;
}
public void setNOTICE_HEAD(String nOTICE_HEAD) {
NOTICE_HEAD = nOTICE_HEAD;
}
public String getNOTICE_CONTENT() {
return NOTICE_CONTENT;
}
public void setNOTICE_CONTENT(String nOTICE_CONTENT) {
NOTICE_CONTENT = nOTICE_CONTENT;
}
@Override
public String toString() {
return "Notice [NOTICE_ID=" + NOTICE_ID + ", NOTICE_HEAD=" + NOTICE_HEAD + ", NOTICE_CONTENT=" + NOTICE_CONTENT
+ "]";
}
}
Patient.java
package com.chinasofti.hospital.user.vo;
public class Patient {
private String PATIENT_ID;
private String PATIENT_NAME;
private String account;
private String userPwd;
private String sex;
private String age;
private String telphone;
private String mail;
public Patient(String pATIENT_ID, String pATIENT_NAME, String account, String userPwd, String sex, String age,
String telphone, String mail) {
super();
PATIENT_ID = pATIENT_ID;
PATIENT_NAME = pATIENT_NAME;
this.account = account;
this.userPwd = userPwd;
this.sex = sex;
this.age = age;
this.telphone = telphone;
this.mail = mail;
}
public Patient() {
super();
}
public String getPATIENT_ID() {
return PATIENT_ID;
}
public void setPATIENT_ID(String pATIENT_ID) {
PATIENT_ID = pATIENT_ID;
}
public String getPATIENT_NAME() {
return PATIENT_NAME;
}
public void setPATIENT_NAME(String pATIENT_NAME) {
PATIENT_NAME = pATIENT_NAME;
}
public String getAccount() {
return account;
}
public void setAccount(String account) {
this.account = account;
}
public String getUserPwd() {
return userPwd;
}
public void setUserPwd(String userPwd) {
this.userPwd = userPwd;
}
public String getSex() {
return sex;
}
public void setSex(String sex) {
this.sex = sex;
}
public String getAge() {
return age;
}
public void setAge(String age) {
this.age = age;
}
public String getTelphone() {
return telphone;
}
public void setTelphone(String telphone) {
this.telphone = telphone;
}
public String getMail() {
return mail;
}
public void setMail(String mail) {
this.mail = mail;
}
@Override
public String toString() {
return "Patient [PATIENT_ID=" + PATIENT_ID + ", PATIENT_NAME=" + PATIENT_NAME + ", account=" + account
+ ", userPwd=" + userPwd + ", sex=" + sex + ", age=" + age + ", telphone=" + telphone + ", mail=" + mail
+ "]";
}
}