基于SSM的宠物医院管理系统-宠物看病预约网站(idea-javaweb-php-asp.netC#-j2ee-springboot)挂号-领养-寄养-诊疗记录-宠物科室分类-就诊挂号

0、效果展示

1、概述

 

 

系统主要为用户提供了医生、客户、管理员三种权限的用户,实现了前台客户查看信息、在线预约、登录、注册等;后台医生管理坐诊信息、管理就诊信息、修改密码;后台管理员管理公告、管理宠物分类、管理就诊、管理用户、修改密码等。在设计方面,本系统采用MVC模式,同时使用JSP技术进行动态页面的设计,使用Ajax进行页面异步交互。后台数据库选用mysql数据库。

 

2、搭建环境

 

本文以实现一个宠物医院管理系统-宠物看病预约网为目标,从环境搭建到编码实现全过程讲述

我们使用javaweb、J2EE来构建宠物医院管理系统-宠物看病预约网,环境使用最新版jdk和tomcat,配合mysql数据库

开发工具使用idea(也可以使用eclipse),数据库管理工具使用Navicat Premium 

开发框架使用JavaBean Servlet MVC结构;

没有使用SSH(Struts+Spring+Hibernate)或SSM(Spring+SpringMVC+MyBatis),这两个框架我们在别的项目中再介绍开发过程

 

在项目中会引入My97DatePicker作为前端日期时间选择工具,使用fckeditor作为富媒体编辑器(也可以使用百度的ueditor)

 

 

使用DWR(Direct Web Remoting)用于改善web页面与Java类交互,实现远程服务器端AJAX读取登录数据。

使用JSTL(Java server pages standarded tag library,即JSP标准标签库),此库是由JCP(Java community Proces)所制定的标准规范,它主要提供给Java Web开发人员一个标准通用的标签库,并由Apache的Jakarta小组来维护。开发人员可以利用这些标签取代JSP页面上的Java代码,从而提高程序的可读性,降低程序的维护难度。

 

3、数据表结构

 

表5  挂号就诊信息

字段名称

字段大小

字段类型

说明

orderId

4

int

编号

goodsId

4

int

商品编号

status

4

int

状态0已挂号,1检查缴费,100治疗完毕买药,101复诊

 

表6  宠物分类信息

字段名称

字段大小

字段类型

说明

typeId

4

int

编号

typeName

20

varchar

名称

 

表7 在线预约信息

字段名称

字段大小

字段类型

说明

orderId

4

长整型(3)

在线预约编号

goodsId

4

长整型(3)

经验编号

status

4

长整型(3)

状态0未确认,1已确认,100在线预约,101退约

 

​4、后端代码示例

 

 

package com.control.web;

import com.dao.*;
import com.entity.*;
import com.util.PublicToolCheckParam;
import com.util.PublicToolParam;
import com.util.Validate;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;

@SuppressWarnings("serial")
public class AdoptInfo extends HttpServlet {
    /**
     * Constructor of the object.
     */
    public AdoptInfo() {
        super();
    }

    /**
     * Destruction of the servlet. <br>
     */
    @Override
    public void destroy() {
        super.destroy(); // Just puts "destroy" string in log
        // Put your code here
    }

    /**
     * The doGet method of the servlet. <br>
     * <p>
     * This method is called when a form has its tag value method equals to get.
     *
     * @param request  the request send by the client to the server
     * @param response the response send by the server to the client
     * @throws ServletException if an error occurred
     * @throws IOException      if an error occurred
     */
    @Override
    public void doGet(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {

        doPost(request, response);
    }

    /**
     * The doPost method of the servlet. <br>
     * <p>
     * This method is called when a form has its tag value method equals to
     * post.
     *
     * @param request  the request send by the client to the server
     * @param response the response send by the server to the client
     * @throws ServletException if an error occurred
     * @throws IOException      if an error occurred
     */
    @Override
    public void doPost(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
        String method = (String) request.getParameter("method");
        if (method.equals("addAdoptInfo")) {
            addAdoptInfo(request, response);
        } else if (method.equals("showAdoptInfo")) {
            showAdoptInfo(request, response);
        }
    }

    @SuppressWarnings({"unchecked", "static-access"})
    public static void addAdoptInfo(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        String title = Validate.replaceHtml(request.getParameter("title"));
        String content = Validate.replaceHtml(request.getParameter("content"));
        String type = Validate.replaceHtml(request.getParameter("type"));
        String publishDate = Validate.replaceHtml(request.getParameter("publishDate"));
        String expiryTime = Validate.replaceHtml(request.getParameter("expiryTime"));
        String publisherString = Validate.replaceHtml(request.getParameter("publisher"));
        String remark = Validate.replaceHtml(request.getParameter("remark"));
        if (title == null || title.trim().length() == 0) {
            throw new NullPointerException("标题 不能为空");
        }
        if (type == null || type.trim().length() == 0) {
            throw new NullPointerException("类型 不能为空");
        }
        if (publishDate == null || publishDate.trim().length() == 0) {
            throw new NullPointerException("发布日期 不能为空");
        }
        if (expiryTime == null || expiryTime.trim().length() == 0) {
            throw new NullPointerException("有效日期 不能为空");
        }
        CustomerInfoDAO customerInfoDAO = new CustomerInfoDAO();
        CustomerInfo data = customerInfoDAO.getIdByEmail(publisherString);
        int publisher = data.getId();
        AdoptDAO adoptDAO = new AdoptDAO();
        adoptDAO.addAdopt(title, type, content, publishDate, publisher, expiryTime, remark, "0");
//        request.getRequestDispatcher("../web/addAdpot.jsp")
//                .forward(request, response);
        response.sendRedirect("../");
    }

    public static void showAdoptInfo(HttpServletRequest request,
                                     HttpServletResponse response) throws ServletException, IOException {
        String adoptId = request.getParameter("adoptId");
        AdoptDAO adoptDAO = new AdoptDAO();
        Adopt adopt = adoptDAO.getById(Integer.parseInt(adoptId));
        request.setAttribute("adopt", adopt);
        request.setAttribute("adoptId", adoptId);
        request.getRequestDispatcher("../web/AdpotDetail.jsp").forward(request, response);

    }

    /**
     * Initialization of the servlet. <br>
     *
     * @throws ServletException if an error occurs
     */
    @Override
    public void init() throws ServletException {
        // Put your code here
    }

}

5、前端代码示例

 

<%@ page language="java" import="com.entity.GoodsInfo,java.text.DecimalFormat" pageEncoding="utf-8" %>
<%@page import="java.util.ArrayList" %>

<%@page import="com.entity.Adopt" %>
<%@ page import="java.text.SimpleDateFormat" %>
<%@ page import="java.util.Date" %>


<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
%>

<%
    String email = (String) session.getAttribute("email");
    String thirdemail = (String) session.getAttribute("thirdemail");
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<base href="<%=basePath%>">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    
    <title>发布寄养领养</title>
    <meta content="" name="keywords">
    <meta content="" name="description">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" type="text/css" href="./stylesheet/bootstrap.css"><!--bootstrap框架-->
    <link rel="stylesheet" type="text/css" href="./stylesheet/style.css"><!--网站主框-->
    <link rel="stylesheet" type="text/css" href="./stylesheet/responsive.css"><!--自适应屏幕大小使用-->

    <script type="text/javascript">
        function checkLogin() {
            if ("<%=email%>" == "" || "<%=email%>" == "null") {
                alert("请先登陆!");
                return false;
            }
            else {
                top.location.href = "servlet/DoMethod?method=showMyInformation";
                return true;
            }
        }

        function checkPublishData() {

            if (document.formAdd.type.value == '') {
                alert("请选择类型");
                return false;
            }

            if (document.formAdd.title.value == '') {
                alert("请输入标题");
                return false;
            }

            if (document.formAdd.content.value == '') {
                alert("请输入内容");
                return false;
            }

            if (document.formAdd.expiryTime.value == '') {
                alert("请输入有效日期");
                return false;
            }
            return true;
        }

        function checkUserLogin() {
            if ("<%=email%>" == "" || "<%=email%>" == "null") {
                alert("请先登陆!");
                return false;
            }
            else {
                top.location.href = "servlet/DoChatMethod?method=login";
                return true;
            }
        }
    </script>
    <!---reload-!-->
</head>
<body>

<div class="boxed">
    <div class="preloader">
        <div class="clear-loading loading-effect-2">
            <span></span>
        </div>
    </div>
    <jsp:include page="../web/top.jsp" flush="true"/>
    <div class="page-title">
        <div class="container">
            <div class="row">
                <div class="col-md-12">
                    <div class="page-title-heading">
                        <h1 class="h1-title">发布寄养领养</h1>
                    </div>
                    <div class="clearfix"></div>
                </div>
            </div>
        </div>
    </div>

    <section class="flat-row pd-contact-v2">
        <div class="container">
            <div class="row">
                <!--左栏-->

                <div class="col-md-8 boxl">
                    <div class="course">


                        <div class="  lay3">
                            <form name="formAdd" action="servlet/AdoptInfo?method=addAdoptInfo" method="post">
                                <div style="padding:10px">
                                    <div class="clr"></div>
                                    <div class="mt10 productsbox">
                                        <h2> 发布寄养领养 </h2>
                                        <div class="productscontent" style="margin-top: 15px">
                                            类型:
                                            <select name="type" id="type">
                                                <option value="">请选择</option>
                                                <option value="0">领养</option>
                                                <option value="1">寄养</option>
                                            </select>
                                        </div>
                                        <input type="hidden" name="publisher" id="publisher" value="<%=email%>"/>
                                        <div class="productscontent" style="margin-top: 15px">
                                            标题: <input type="text" maxlength="100" style="width: 60%" name="title"
                                                       id="title"/>
                                        </div>
                                        <div class="productscontent" style="margin-top: 15px">
                                            内容:<textarea rows="5" cols="80" name="content" id="content"
                                                         style="background-color: white;height: 100px;width: 70%;margin-top: 10px"></textarea>
                                        </div>
                                        <input maxlength="100" type="hidden" name="publishDate"
                                               id="publishDate"
                                               value="<%=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date())%>"/>

                                        <div class="productscontent" style="margin-top: 15px">
                                            有效日期: <input maxlength="100" type="text" name="expiryTime" id="expiryTime"
                                                         value="<%=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date())%>"/>
                                        </div>

                                        <div class="productscontent" style="margin-top: 15px">
                                            备注: <textarea rows="5" cols="80" name="remark" id="remark"
                                                          style="background-color: white;height: 100px;width: 70%;margin-top: 10px"></textarea>
                                        </div>

                                    </div>
                                    <!--内容-->
                                </div>
                                <input type="submit" value="提交" style="margin-bottom: 20px"
                                       onclick="return checkPublishData()">
                            </form>
                        </div>
                    </div>
                </div>

                <!--右栏-->
                <div class="col-md-4 boxr">
                    <div class="overl">
                        <h2>用户登录</h2>
                        <ul>
                            <jsp:include page="../web/left.jsp" flush="true"/>
                        </ul>
                    </div>

                </div>

            </div>
        </div>
    </section>
    <jsp:include page="../web/bottom.jsp" flush="true"/>
</div>
<script type="text/javascript" src="./javascript/jquery.min.js"></script><!--jquery主文件-->
<script type="text/javascript" src="./javascript/bootstrap.min.js"></script><!--bootstrap主文件-->
<script type="text/javascript" src="./javascript/main.js"></script><!--程序主文件-->
</body>
</html>



  • 3
    点赞
  • 25
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 3
    评论
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

打赏作者

计算机程序设计开发

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

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

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

打赏作者

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

抵扣说明:

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

余额充值