基于jsp+servlet在线预约挂号系统

开发环境:idea+mysql

使用技术:jsp+servlet

关键代码:

pom.xml

<?xml version="1.0" encoding="UTF-8"?>

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <groupId>nchu</groupId>
  <artifactId>hospital</artifactId>
  <version>1.0-SNAPSHOT</version>
  <packaging>war</packaging>

  <name>hospital Maven Webapp</name>
  <!-- FIXME change it to the project's website -->
  <url>http://www.example.com</url>

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <maven.compiler.source>1.7</maven.compiler.source>
    <maven.compiler.target>1.7</maven.compiler.target>
  </properties>

  <dependencies>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>4.11</version>
      <scope>test</scope>
    </dependency>
    <!-- https://mvnrepository.com/artifact/mysql/mysql-connector-java -->
    <dependency>
      <groupId>mysql</groupId>
      <artifactId>mysql-connector-java</artifactId>
      <version>8.0.13</version>
    </dependency>
    <!-- https://mvnrepository.com/artifact/javax.servlet/javax.servlet-api -->
    <dependency>
      <groupId>javax.servlet</groupId>
      <artifactId>javax.servlet-api</artifactId>
      <version>3.1.0</version>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>taglibs</groupId>
      <artifactId>standard</artifactId>
      <version>1.1.2</version>
    </dependency>
    <dependency>
      <groupId>jstl</groupId>
      <artifactId>jstl</artifactId>
      <version>1.2</version>
    </dependency>
    <!-- https://mvnrepository.com/artifact/org.json/json -->
    <dependency>
      <groupId>org.json</groupId>
      <artifactId>json</artifactId>
      <version>20160810</version>
    </dependency>
    <!-- java邮件 -->
    <dependency>
      <groupId>com.sun.mail</groupId>
      <artifactId>javax.mail</artifactId>
      <version>1.5.6</version>
    </dependency>
  </dependencies>

  <build>
    <finalName>hospital</finalName>
    <pluginManagement><!-- lock down plugins versions to avoid using Maven defaults (may be moved to parent pom) -->
      <plugins>
        <plugin>
          <artifactId>maven-clean-plugin</artifactId>
          <version>3.1.0</version>
        </plugin>
        <!-- see http://maven.apache.org/ref/current/maven-core/default-bindings.html#Plugin_bindings_for_war_packaging -->
        <plugin>
          <artifactId>maven-resources-plugin</artifactId>
          <version>3.0.2</version>
        </plugin>
        <plugin>
          <artifactId>maven-compiler-plugin</artifactId>
          <version>3.8.0</version>
        </plugin>
        <plugin>
          <artifactId>maven-surefire-plugin</artifactId>
          <version>2.22.1</version>
        </plugin>
        <plugin>
          <artifactId>maven-war-plugin</artifactId>
          <version>3.2.2</version>
        </plugin>
        <plugin>
          <artifactId>maven-install-plugin</artifactId>
          <version>2.5.2</version>
        </plugin>
        <plugin>
          <artifactId>maven-deploy-plugin</artifactId>
          <version>2.8.2</version>
        </plugin>
      </plugins>
    </pluginManagement>
  </build>
</project>
@WebServlet("/admin/doctorManage")
public class DoctorManage extends HttpServlet {
    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        String office = Util.nullToString(req.getParameter("office"));
        String name = Util.nullToString(req.getParameter("doctor"));
        String action = Util.nullToString(req.getParameter("action"));
        if("add".equals(action)){
            String message="增加医生失败!";
            DoctorDao doctorDao = new DoctorDao();
            System.out.println(req.getParameter("account"));
            List<Doctor> doctors = doctorDao.query("where account=? ",new Object[]{Util.nullToString(req.getParameter("account"))});
            if(doctors.size()==0){
                Doctor doctor=new Doctor();
                doctor.setAccount(req.getParameter("account"));
                doctor.setPassword(req.getParameter("password"));
                doctor.setDname(req.getParameter("name"));
                doctor.setFee(req.getParameter("fee"));
                doctor.setGender(req.getParameter("gender"));
                doctor.setAge(req.getParameter("age"));
                doctor.setOffice(req.getParameter("office1"));
                doctor.setRoom(req.getParameter("room"));
                doctor.setCareer(req.getParameter("career"));
                doctor.setDescription(req.getParameter("description"));
                doctor.setPicpath(req.getContextPath()+"/images/docpic/default.jpg");
                if(doctorDao.insert(doctor)){
                    message="添加"+req.getParameter("name")+"医生成功!";
                }
            }else {
                message=req.getParameter("account")+"账号已存在!";
            }
            req.setAttribute("message",message);
        }
        int start = Util.nullToZero(req.getParameter("start"));
        DoctorDao doctorDao=new DoctorDao();
        String where="where office like ? and dname like ? ";
        int total=doctorDao.getDoctorCount(where,new Object[]{Util.toLike(office),Util.toLike(name)});
        Pages pages = new Pages(start , total, 6);
        where+="limit "+((pages.getCurrentPage()-1)*6)+",6";
        List<Doctor> doctors = doctorDao.query(where, new Object[]{Util.toLike(office),Util.toLike(name)});
        req.setAttribute("doctors",doctors);
        req.setAttribute("pages",pages);
        req.setAttribute("doctor",name);
        //OfficeDao officeDao=new OfficeDao();
        //List<Office> offices = officeDao.query("officename", office, "");
        req.setAttribute("office",office);
        req.getRequestDispatcher("doctorManage.jsp").forward(req,resp);
    }
}

项目下载:基于jsp+servlet在线预约挂号系统 

  • 0
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

打赏作者

aqiu12316

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

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

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

打赏作者

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

抵扣说明:

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

余额充值