基于javaweb的医院门诊收费管理系统(java+html+jdbc+mysql)
一、项目简述
功能:登录,门诊划价,收费,报表,药品管理等等功能。
二、项目运行
运行环境: Jdk1.8 + Tomcats . 5 + mysql + Eclispe ( IntelliJ IDEA ,Eclispe , MyEclispe , sts 都支持)。
项目技术: JSP + Entity + Servlet + html + css + Javascript + JQuery + Ajax +Fileupload 等等。
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
/**
* @see HttpServlet#HttpServlet()
*/
public PayServlet() {
super();
// TODO Auto-generated constructor stub
}
/**
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
int PayListID = Integer.parseInt(request.getParameter("PayListID"));
User user = (User)request.getSession().getAttribute("User");
if(user == null) {
request.getRequestDispatcher("login.jsp").forward(request, response);
return;
public ProductInfoUpdateServlet() {
super();
// TODO Auto-generated constructor stub
}
/**
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
int ProductID = Integer.parseInt(request.getParameter("ProductID"));
request.setAttribute("ProductModifyInfo", CashSystemFactory.getProductDao().getProductByID(ProductID));
request.getRequestDispatcher("productManage.jsp").forward(request, response);
}
/**
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
*/
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
int ProductID = Integer.parseInt(request.getParameter("ProductID"));
request.setAttribute("ProductModifyInfo", CashSystemFactory.getProductDao().getProductByID(ProductID));
request.getRequestDispatcher("productManage.jsp").forward(request, response);
}
/**
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
*/
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
request.setCharacterEncoding("utf-8");
Product p = new Product(ProductID, ProductNums, ProductName, ProductShortName, ProductPrice);
CashSystemFactory.getProductDao().modifyProduct(p);
response.sendRedirect("productManage.jsp");
}
}
支付服务:
/**
* Servlet implementation class PayServlet
*/
@WebServlet("/PayServlet")
public class PayServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
/**
request.getRequestDispatcher("login.jsp").forward(request, response);
return;
}
if(user.getUserID() == CashSystemFactory.getPayListDao(user).getPayListByID(user.getUserID(), PayListID).getUserID()) {
CashSystemFactory.getPayBackDao().createPayBack(PayListID);
response.sendRedirect("finishedPay.jsp");
}else {
response.sendRedirect("index.jsp");
}
}
private static final long serialVersionUID = 1L;
/**
* @see HttpServlet#HttpServlet()
*/
public ProductInfoUpdateServlet() {
super();
// TODO Auto-generated constructor stub
}
/**
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
*/
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
String UserName = request.getParameter("UserName");
String Password = request.getParameter("Password");
User u = CashSystemFactory.getUserDao().Login(new User(UserName, Password));
if(u.getUserID() == 0) {
//登陆失败
response.getWriter().append("Login error!");
}else {
//登陆成功
request.getSession().setAttribute("User", u);
response.sendRedirect("index.jsp");
}
}
}
产品信息更新服务:
/**
* Servlet implementation class ProductInfoUpdateServlet
*/
int ProductID = Integer.parseInt(request.getParameter("ProductID"));
request.setAttribute("ProductModifyInfo", CashSystemFactory.getProductDao().getProductByID(ProductID));
request.getRequestDispatcher("productManage.jsp").forward(request, response);
}
/**
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
*/
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
request.setCharacterEncoding("utf-8");
// 首先把信息都拿上 创建对象后调用方法更新
int ProductID = Integer.parseInt(request.getParameter("ProductID"));
String ProductName = request.getParameter("ProductName");
// TODO Auto-generated constructor stub
}
/**
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
response.getWriter().append("Do not request me directly! :P");
}
/**
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
*/
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
String UserName = request.getParameter("UserName");
String Password = request.getParameter("Password");
User u = CashSystemFactory.getUserDao().Login(new User(UserName, Password));
if(u.getUserID() == 0) {
//登陆失败
response.getWriter().append("Login error!");
}else {
//登陆成功
request.getSession().setAttribute("User", u);
private static final long serialVersionUID = 1L;
/**
* @see HttpServlet#HttpServlet()
*/
public PayServlet() {
super();
// TODO Auto-generated constructor stub
}
/**
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
int PayListID = Integer.parseInt(request.getParameter("PayListID"));
User user = (User)request.getSession().getAttribute("User");
if(user == null) {
request.getRequestDispatcher("login.jsp").forward(request, response);
return;
}
if(user.getUserID() == CashSystemFactory.getPayListDao(user).getPayListByID(user.getUserID(), PayListID).getUserID()) {
CashSystemFactory.getPayBackDao().createPayBack(PayListID);
response.sendRedirect("finishedPay.jsp");
}
/**
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
response.getWriter().append("Do not request me directly! :P");
}
/**
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
*/
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
String UserName = request.getParameter("UserName");
String Password = request.getParameter("Password");
User u = CashSystemFactory.getUserDao().Login(new User(UserName, Password));
if(u.getUserID() == 0) {
//登陆失败
response.getWriter().append("Login error!");
}else {
//登陆成功
request.getSession().setAttribute("User", u);
response.sendRedirect("index.jsp");
}
}
String ProductShortName = request.getParameter("ProductShortName");
int ProductNums = Integer.parseInt(request.getParameter("ProductNums"));
double ProductPrice = Double.parseDouble(request.getParameter("ProductPrice"));
Product p = new Product(ProductID, ProductNums, ProductName, ProductShortName, ProductPrice);
CashSystemFactory.getProductDao().modifyProduct(p);
response.sendRedirect("productManage.jsp");
}
}
支付服务:
/**
* Servlet implementation class PayServlet
*/
@WebServlet("/PayServlet")
public class PayServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
/**
* @see HttpServlet#HttpServlet()
*/
public PayServlet() {
super();
// TODO Auto-generated constructor stub
}
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
int PayListID = Integer.parseInt(request.getParameter("PayListID"));
User user = (User)request.getSession().getAttribute("User");
if(user == null) {
request.getRequestDispatcher("login.jsp").forward(request, response);
return;
}
if(user.getUserID() == CashSystemFactory.getPayListDao(user).getPayListByID(user.getUserID(), PayListID).getUserID()) {
CashSystemFactory.getPayBackDao().createPayBack(PayListID);
response.sendRedirect("finishedPay.jsp");
private static final long serialVersionUID = 1L;
/**
* @see HttpServlet#HttpServlet()
*/
public ProductInfoUpdateServlet() {
super();
// TODO Auto-generated constructor stub
}
/**
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
int ProductID = Integer.parseInt(request.getParameter("ProductID"));
request.setAttribute("ProductModifyInfo", CashSystemFactory.getProductDao().getProductByID(ProductID));
request.getRequestDispatcher("productManage.jsp").forward(request, response);
}
}
/**
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
*/
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
doGet(request, response);
}
登录服务:
/**
* Servlet implementation class LoginServlet
* Servlet implementation class LoginServlet
*/
@WebServlet("/LoginServlet")
public class LoginServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
/**
* @see HttpServlet#HttpServlet()
*/
public LoginServlet() {
super();
// TODO Auto-generated constructor stub
}
/**
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
response.getWriter().append("Do not request me directly! :P");
}
/**
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
*/
* Servlet implementation class ProductInfoUpdateServlet
*/
@WebServlet("/ProductInfoUpdateServlet")
public class ProductInfoUpdateServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
/**
* @see HttpServlet#HttpServlet()
*/
public ProductInfoUpdateServlet() {
super();
// TODO Auto-generated constructor stub
}
/**
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
int ProductID = Integer.parseInt(request.getParameter("ProductID"));
request.setAttribute("ProductModifyInfo", CashSystemFactory.getProductDao().getProductByID(ProductID));
request.getRequestDispatcher("productManage.jsp").forward(request, response);
}
/**
String Password = request.getParameter("Password");
User u = CashSystemFactory.getUserDao().Login(new User(UserName, Password));
if(u.getUserID() == 0) {
//登陆失败
response.getWriter().append("Login error!");
}else {
//登陆成功
request.getSession().setAttribute("User", u);
response.sendRedirect("index.jsp");
}
}
}
产品信息更新服务:
/**
* Servlet implementation class ProductInfoUpdateServlet
*/
@WebServlet("/ProductInfoUpdateServlet")
public class ProductInfoUpdateServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
/**
*/
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
request.setCharacterEncoding("utf-8");
// 首先把信息都拿上 创建对象后调用方法更新
int ProductID = Integer.parseInt(request.getParameter("ProductID"));
String ProductName = request.getParameter("ProductName");
String ProductShortName = request.getParameter("ProductShortName");
int ProductNums = Integer.parseInt(request.getParameter("ProductNums"));
double ProductPrice = Double.parseDouble(request.getParameter("ProductPrice"));
Product p = new Product(ProductID, ProductNums, ProductName, ProductShortName, ProductPrice);
CashSystemFactory.getProductDao().modifyProduct(p);
response.sendRedirect("productManage.jsp");
}
}
支付服务:
/**
* Servlet implementation class PayServlet
*/
@WebServlet("/PayServlet")
public class PayServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
/**
* @see HttpServlet#HttpServlet()
// TODO Auto-generated constructor stub
}
/**
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
int PayListID = Integer.parseInt(request.getParameter("PayListID"));
User user = (User)request.getSession().getAttribute("User");
if(user == null) {
request.getRequestDispatcher("login.jsp").forward(request, response);
return;
}
if(user.getUserID() == CashSystemFactory.getPayListDao(user).getPayListByID(user.getUserID(), PayListID).getUserID()) {
CashSystemFactory.getPayBackDao().createPayBack(PayListID);
response.sendRedirect("finishedPay.jsp");
}else {
response.sendRedirect("index.jsp");
}
}
/**
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
*/
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
public ProductInfoUpdateServlet() {
super();
// TODO Auto-generated constructor stub
}
/**
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
int ProductID = Integer.parseInt(request.getParameter("ProductID"));
request.setAttribute("ProductModifyInfo", CashSystemFactory.getProductDao().getProductByID(ProductID));
request.getRequestDispatcher("productManage.jsp").forward(request, response);
}
/**
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
*/
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
request.setCharacterEncoding("utf-8");
// 首先把信息都拿上 创建对象后调用方法更新
int ProductID = Integer.parseInt(request.getParameter("ProductID"));
String ProductName = request.getParameter("ProductName");
String ProductShortName = request.getParameter("ProductShortName");
/**
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
*/
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
request.setCharacterEncoding("utf-8");
// 首先把信息都拿上 创建对象后调用方法更新
int ProductID = Integer.parseInt(request.getParameter("ProductID"));
String ProductName = request.getParameter("ProductName");
String ProductShortName = request.getParameter("ProductShortName");
int ProductNums = Integer.parseInt(request.getParameter("ProductNums"));
double ProductPrice = Double.parseDouble(request.getParameter("ProductPrice"));
Product p = new Product(ProductID, ProductNums, ProductName, ProductShortName, ProductPrice);
CashSystemFactory.getProductDao().modifyProduct(p);
response.sendRedirect("productManage.jsp");
}
}
* @see HttpServlet#HttpServlet()
*/
public PayServlet() {
super();
// TODO Auto-generated constructor stub
}
/**
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
int PayListID = Integer.parseInt(request.getParameter("PayListID"));
User user = (User)request.getSession().getAttribute("User");
if(user == null) {
request.getRequestDispatcher("login.jsp").forward(request, response);
return;
}
if(user.getUserID() == CashSystemFactory.getPayListDao(user).getPayListByID(user.getUserID(), PayListID).getUserID()) {
request.setCharacterEncoding("utf-8");
// 首先把信息都拿上 创建对象后调用方法更新
int ProductID = Integer.parseInt(request.getParameter("ProductID"));
String ProductName = request.getParameter("ProductName");
String ProductShortName = request.getParameter("ProductShortName");
int ProductNums = Integer.parseInt(request.getParameter("ProductNums"));
double ProductPrice = Double.parseDouble(request.getParameter("ProductPrice"));
Product p = new Product(ProductID, ProductNums, ProductName, ProductShortName, ProductPrice);
CashSystemFactory.getProductDao().modifyProduct(p);
response.sendRedirect("productManage.jsp");
}
}
支付服务:
/**
* Servlet implementation class PayServlet
*/
* @see HttpServlet#HttpServlet()
*/
public PayServlet() {
super();
// TODO Auto-generated constructor stub
}
/**
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
int PayListID = Integer.parseInt(request.getParameter("PayListID"));
User user = (User)request.getSession().getAttribute("User");
if(user == null) {
request.getRequestDispatcher("login.jsp").forward(request, response);
return;
}
if(user.getUserID() == CashSystemFactory.getPayListDao(user).getPayListByID(user.getUserID(), PayListID).getUserID()) {
CashSystemFactory.getPayBackDao().createPayBack(PayListID);
User u = CashSystemFactory.getUserDao().Login(new User(UserName, Password));
if(u.getUserID() == 0) {
//登陆失败
response.getWriter().append("Login error!");
}else {
//登陆成功
request.getSession().setAttribute("User", u);
response.sendRedirect("index.jsp");
}
}