基于javaweb+springboot的医院预约挂号系统(java+Springboot+jsp+maven+layui+mysql)
一、项目简述
功能包括:
用户分为患者,医生,管理员,患者可进行注册选择医生挂号,选择日期,选择号源,医生可进行接诊,管理员可对用户,医生信息的维护等等功能。
二、项目运行
环境配置:
Jdk1.8 + Tomcat8.5 + mysql + Eclispe(IntelliJ IDEA,Eclispe,MyEclispe,Sts都支持)
项目技术:
JSP +Spring + SpringBoot + MyBatis + html+ css + JavaScript + JQuery + Ajax + layui+ maven等等
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
// messages.setTime(new Date());
messages.setType(1);
messages.setDid(dt.getId());
PageInfo<Messages> pageInfo = messagesService.selectMessagesList(messages, 1, size);
model.addAttribute("doctorList",pageInfo.getList());
model.addAttribute("pageInfo",pageInfo);
model.addAttribute("patient",patient);
return "doctor/patientList";
}
/**
*预约信息列表
/**
*添加患者信息
*/
@RequestMapping(value = "/loginByPatient")
public String loginByPatient(@RequestBody Patient patient) {
return "loginByPatient";
}
/**
*添加患者信息
}
}
return list;
}
/**
* @throws ParseException
*/
if(type == null){
type=1;
}
model.addAttribute("type",type);
session.invalidate(); //session销毁
return "behind/login";
}
*//**
* 管理员修改密码界面
* @return
*//*
@RequestMapping("/adminUptatePage")
public String adminUptatePage(Model model) {
return "behind/admin/adminUptate";
}
*//**
@RequestMapping("/admin_Register")
public String admin_Register(Admin admin,Model model) {
int insertSelective = adminService.insertSelective(admin);
model.addAttribute("type",2);
return "login";
}
/**
* 登陆验证
* @return
*/
@RequestMapping("/verificatio")
public String verificatio(String username, String password, Integer type, HttpServletRequest request,Model model) {
HttpSession session = request.getSession();
session.setAttribute("type",type);
//类型为1是医院 2是管理员
if(type == 1){
Doctor doctor = new Doctor();
return "doctor/doctorUptate";
}
/**
* 修改医生信息
*/
@RequestMapping("/messageTime")
public String messageTime(String name,Model model,HttpServletRequest request) {
@RequestMapping(value ="/zixunAdd")
@ResponseBody
public Map<String, Object> zixunAdd(@RequestParam("mf")MultipartFile mufile,@RequestParam("id")Integer id) throws IOException{
Map<String, Object> map = new HashMap<String, Object>();
String random = StringRandom.getRandom();
String filename = mufile.getOriginalFilename();
//随机字符+原图片名用作新的图片名
filename = random+".jpg";
try {
//文件保存路径 D:/xxxx/xxxx/
File file = new File(filePath+filename);
//判断父级文件是否存在
if (!file.getParentFile().exists()) {
file.getParentFile().mkdir();
}
/**
* 患者注册界面
*/
@RequestMapping("/patientAddPage")
public String patientAddPage(Model model) {
return "patientRegister";
}
/**
*患者信息列表
*/
@RequestMapping(value = "/patientList")
@ResponseBody
public List<Patient> patientList(Integer pid,HttpServletRequest request) {
Patient pa = new Patient();
@ResponseBody
public String timeZhuan(String time) throws ParseException {
Date parse = new Date();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
if(time != null) {
parse = sdf.parse(time);
}
return sdf.format(parse);
}
}
/**
*医生列表查询
* @throws ParseException
*/
@RequestMapping(value = "/doctorGeRenList")
@ResponseBody
public Doctor doctorGeRenList(Integer id) throws ParseException {
Doctor doctor = doctorService.selectByPrimaryKey(id);
return doctor;
}
/**
*时间格式转换
*/
@ResponseBody
public String userLoginView(HttpServletRequest request) throws ParseException {
HttpSession session = request.getSession();
Patient patient =(Patient) session.getAttribute("USER");
System.out.println("*********登陆验证********");
System.out.println(patient);
if(patient != null) {
return "ok";
}
return "err";
}
/**
*banner图
*/
@RequestMapping(value = "/bannerList")
@ResponseBody
public String[] formAdd() {
Banners banners = bannersService.selectByPrimaryKey(1);
String[] split = null;
if(banners != null && banners.getImg() != null) {
split = banners.getImg().split(",");
}
/**
*科室下级查询
*/
@RequestMapping(value = "/sectionXiaList")
@ResponseBody
public List<Section> sectionXiaList(Integer id) {
Section se = new Section();
/**
*科室下级查询
*/
@RequestMapping(value = "/patientPai")
@ResponseBody
public Integer patientPai(Integer id) {
Patient pa = new Patient();
pa.setPid(id);
PatientExample se = new PatientExample();
PatientExample.Criteria criteria = se.createCriteria();
if(pa != null){
int section = sectionService.count(); //科室总数
//患者总数
int patient = 0;
List<Patient> selectByExample = patientService.selectByExample(null);
Messages mess = new Messages();
for (Patient pa : selectByExample) {
if(pa.getName() != null) {
mess.setDid(dt.getId());
mess.setUsername(pa.getName());
List<Messages> selectMessages = messagesService.selectMessages(mess);
if(selectMessages.size() > 0 )
{
patient++;
}
}
}
//预约总数
MessagesExample me = new MessagesExample();
me.setType(1);
me.setTime(new Date());
for (int i = 0; i < list.size(); i++) {
me.setDid(list.get(i).getDid());
List<Messages> lin = messagesService.selectMessagesPai(me);
list.get(i).setAge(lin.size());
}
return list;
}
/**
*预约信息列表
* @throws ParseException
*/
@RequestMapping(value = "/messagesList")
@ResponseBody
public List<Messages> messagesList(@RequestParam("type")Integer type,@RequestParam("uid")Integer uid) throws ParseException {
Messages message = new Messages();
List<Messages> list = null;
message.setType(type);
message.setUid(uid);
if(type != null && type == 1) {
message.setTime(new Date());
Merchant me = new Merchant();
me.setZhanghao(zhanghao);
me.setMibao(mibao);
List<Merchant> list = merchantService.selectMerchant(me);
if(list.size() > 0){
Merchant me2 = new Merchant();
me2.setId(list.get(0).getId());
me2.setMima(mima);
merchantService.updateByPrimaryKeySelective(me2);
map.put("pan","ok");
}else{
map.put("pan","err");
}
return map;
}
*//**
* 后台登陆界面
* @return
*//*
@RequestMapping("/afterView")
*/
@RequestMapping(value = "/doctorList")
@ResponseBody
public List<Doctor> doctorList(Integer sid) {
Doctor doctor = new Doctor();
doctor.setSid(sid);
List<Doctor> selectDoctor = doctorService.selectDoctor(doctor);
return selectDoctor;
}
/**
*医生列表查询
*/
@RequestMapping(value = "/doctorLike")
@ResponseBody
@Autowired
private BannersService bannersService;
@Autowired
private DoctorService doctorService;
@Autowired
private PatientService patientService;
@Autowired
private MessagesService messagesService;
/**
* 医生列表
*/
@RequestMapping("/doctorList1")
if(messages == null) {
messages = new Messages();
}
HttpSession session = request.getSession();
Doctor dt = (Doctor) session.getAttribute("DOCTOR");
if(dt != null){
messages.setDid(dt.getId());
}else{
return "redirect:/login/index";
}
messages.setType(type);
//底层数据
PageInfo<Messages> pageInfo = messagesService.selectMessagesList(messages,page,size);
public String merchantUptate(Model model) {
return "behind/merchant/merchantUptate";
}
*/
}
后端管理员控制层:
/**
* 后端管理员控制层
*/
@Controller
@RequestMapping("/api")
public class PatientController {
private Integer size = 6;//每页显示数量
@Autowired
return "doctorRegister";
}
return "adminRegister";
}
/**
* 医生注册界面
*/
@RequestMapping("/doctorRegisterPage")
public String doctorRegister(Model model) {
List<Section> sectionlist2 = null;
Section se = new Section();
se.setType(1);
@ResponseBody
public Patient userLogin(@RequestBody Patient patient) throws ParseException {
List<Patient> list = patientService.selectPatient(patient);
if(patient != null && patient.getUsername() != null && patient.getPassword() != null) {
if(list.size() > 0) {
return list.get(0);
}
}
return patient;
}
/**
*登录
* @throws ParseException
*/
@RequestMapping(value = "/passwordSave")
@ResponseBody
public String passwordSave(@RequestBody Patient patient ) throws ParseException {
if(patient != null && patient.getUsername() != null && patient.getPassword() != null) {
Patient pa = new Patient();
pa.setUsername(patient.getUsername());
if(section != null) {
patient.setSname(section.getName());
}
Patient pa = patientService.selectByPrimaryKey(patient1.getId()); //患者
if(pa != null) {
patient.setUid(pa.getPid());
patient.setUserid(pa.getId());
patient.setPhone(pa.getPhone());
patient.setUsername(pa.getUsername());
patient.setAge(pa.getAge());
int countByExample = messagesService.countByExample(null);
patient.setBianhao(countByExample+1);
//排序
Messages message = new Messages();
// message.setUid(patient.getUid());
message.setTime(patient.getTime());
/**
* 后台登陆界面
*/
@RequestMapping("/index")
public String index(Integer type,Model model) {
if(type == null){
type = 1;
}
model.addAttribute("type",type);
return "login";
}
/**
* 后台登陆界面
*/
@RequestMapping("/font/index")
public String fontIndex(Integer type,Model model) {
HttpSession session = request.getSession();
Doctor dt = (Doctor) session.getAttribute("DOCTOR");
if(name != null) {
Messages mess = new Messages();
mess.setDid(dt.getId());
mess.setUsername(name);
List<Messages> selectMessages = messagesService.selectMessagesTWO(mess);
model.addAttribute("messagesList", selectMessages);
}
return "doctor/messageTime";
}
/**
* 修改医生信息
*/
@RequestMapping("/admindoctorUptate")
public String adminUptatePassword(Doctor doctor,Model model) {
/**
*取消预约
* @throws ParseException
*/
@RequestMapping(value = "/messagesQuXiao")
public String messagesQuXiao(Integer id) throws ParseException {
Messages ma = new Messages();
ma.setId(id);
ma.setType(2); //取消预约
messagesService.updateByPrimaryKeySelective(ma);
Messages mes = messagesService.selectByPrimaryKey(id);
Messages messages = new Messages();
messages.setType(1);
messages.setUid(mes.getUid());
messages.setTime(new Date());
List<Messages> list = messagesService.selectMessages(messages);
return "redirect:/api/patientList2";
}
/**
*预约信息列表
* @throws ParseException
*/
return j;
}
j++;
}
}
return -1;
}
/**
*查询科室
/**
*添加患者信息
*/
@RequestMapping(value = "/loginByPatient")
public String loginByPatient(@RequestBody Patient patient) {
return "loginByPatient";
}
/**
*添加患者信息
*/
@RequestMapping(value = "/patientSave")
public String patientSave(Patient patient) {
patientService.insertSelective(patient);
return "loginByPatient";
*//*
@RequestMapping("/verificatio")
public String signin(String username, String password, Integer type, HttpServletRequest request,Model model) {
HttpSession session = request.getSession();
session.setAttribute("type",type);
//类型为1是商户后台 2是管理员
if(type == 1){
Merchant merchant = new Merchant();
merchant.setZhanghao(username);
merchant.setMima(password);
merchant.setState(1);
List<Merchant> merchants = merchantService.selectMerchant(merchant);
if(merchants.size() <= 0){
model.addAttribute("message","密码错误");
model.addAttribute("type",type);
return "behind/login";
}
session.setAttribute("MERCHANT",merchants.get(0));