基于Spring MVC+MyBatis实现医院就诊挂号

一、语言和环境

1. 实现语言: JAVA语言。

2. 环境要求: MyEclipse/Eclipse + Tomcat + MySQL。

3. 使用技术: Spring MVC + Spring + MyBatis 或 JSP + Servlet + JavaBean + JDBC。

二、实现效果

在这里插入图片描述

实现能够对患者姓名,医师类别、科室的模糊查询,用户点击核销以后状态变为已就诊。

在这里插入图片描述

点击挂号实现基本信息的添加

在这里插入图片描述

三、实现代码

数据库:

SET FOREIGN_KEY_CHECKS=0;


-- ----------------------------
-- Table structure for tb_patient
-- ----------------------------
DROP TABLE IF EXISTS `tb_patient`;
CREATE TABLE `tb_patient` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(50) DEFAULT NULL,
  `sex` varchar(10) DEFAULT NULL,
  `age` int(11) DEFAULT NULL,
  `phone` varchar(20) DEFAULT NULL,
  `department` varchar(50) DEFAULT NULL,
  `type` varchar(50) DEFAULT NULL,
  `price` decimal(9,2) DEFAULT NULL,
  `state` int(11) DEFAULT NULL,
  `register_time` datetime DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8;


-- ----------------------------
-- Records of tb_patient
-- ----------------------------
INSERT INTO `tb_patient` VALUES ('1', '张蕾', '女', '12', '13895463212', '儿科', '专家医师', '25.00', '1', '2021-07-18 12:23:00');
INSERT INTO `tb_patient` VALUES ('2', '刘德明', '男', '28', '13345623215', '骨科', '普通医师', '8.00', '0', '2021-07-18 12:23:00');
INSERT INTO `tb_patient` VALUES ('3', '李将军', '男', '38', '13578064788', '内科', '专家医师', '25.00', '1', '2021-07-17 12:23:00');
INSERT INTO `tb_patient` VALUES ('4', '张佩佩', '女', '44', '18214217246', '外科', '副主任医师', '17.00', '0', '2021-07-16 12:23:00');
INSERT INTO `tb_patient` VALUES ('5', '程聪明', '男', '29', '13652645964', '骨科', '副主任医师', '17.00', '0', '2021-08-08 16:21:52');

项目Java代码:

目录结构

在这里插入图片描述

JAR包:

在这里插入图片描述
在这里插入图片描述
篇幅所限,这里只贴部分代码,需要完整代码和开发文档的同学可以点击传送门即可下载

代码:

=src

com.mhys.crm.controller

HospitalContrller.java

package com.mhys.crm.controller;


import java.util.List;


import javax.annotation.Resource;


import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;


import com.mhys.crm.dao.TbPatientMapper;
import com.mhys.crm.entity.TbPatient;


@Controller
public class HospitalContrller {
  @Resource
  private TbPatientMapper tbPatientMapper;


  @RequestMapping("/select")
  public String getList(Model model) {
    List<TbPatient> selctAll = tbPatientMapper.selectAlls();
    System.out.println(selctAll);
    model.addAttribute("selctAll", selctAll);
    return "info";
  }


  @RequestMapping("/list")
  public String getAll(Model model, String name, String type, String dep) {
    List<TbPatient> selctAll = tbPatientMapper.selectAll(name, type, dep);
    System.out.println(name+"==="+type+"==="+dep);
    model.addAttribute("selctAll", selctAll);
    return "info";
  }


  @RequestMapping("/upd")
  public String upDev(Model model,int id) {
    int update = tbPatientMapper.update(id);
    return "redirect:/select.do";
  }


  @RequestMapping("/adds")
  public String adds(Model model) {
    return "addInfo";
  }


  @RequestMapping("/insert")
  public String toaddDev(Model model,TbPatient tb) {
    tbPatientMapper.insert(tb);
      return "redirect:/select.do";
  }


}

> com.mhys.crm.dao

TbPatientMapper.java

package com.mhys.crm.dao;


import com.mhys.crm.entity.TbPatient;
import java.util.List;


import org.apache.ibatis.annotations.Param;


public interface TbPatientMapper {
    int deleteByPrimaryKey(Integer id);


    int insert(TbPatient record);


    TbPatient selectByPrimaryKey(Integer id);


    List<TbPatient> selectAlls();


    int updateByPr
  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

打赏作者

北游学Java

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

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

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

打赏作者

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

抵扣说明:

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

余额充值