Java项目:SSM医药信息管理系统

作者主页:夜未央5788

 简介:Java领域优质创作者、Java项目、学习资料、技术互助

文末获取源码

项目介绍

该系统共七个功能模块:查询模块、录入模块、删除模块、修改模块、浏览模块、打印模块和用户管理模块。

系统只有一个超级管理员,可以创建系统用户并进行权限管理,其他用户没有用户管理权限,只有其他权限。

不同的用户可以进入不同的模块进行相应操作。

管理员角色包含以下功能:

登录,信息查询,信息录入,信息删除,信息修改,信息浏览,打印报表,用户管理,权限管理,系统帮助等功能。

用户角色包含以下功能:

管理员只设置了查询功能,一些说明等功能。

环境需要

1.运行环境:最好是java jdk 1.8,我们在这个平台上运行的。其他版本理论上也可以。
2.IDE环境:IDEA,Eclipse,Myeclipse都可以。推荐IDEA;
3.tomcat环境:Tomcat 7.x,8.x,9.x版本均可
4.硬件环境:windows 7/8/10 1G内存以上;或者 Mac OS; 

5.数据库:MySql 5.7版本;

6.是否Maven项目:是;

技术栈

1. 后端:Spring+SpringMVC+Mybatis

2. 前端:HTML+CSS+JavaScript+easyui

使用说明

1. 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件;

2. 使用IDEA/Eclipse/MyEclipse导入项目,Eclipse/MyEclipse导入时,若为maven项目请选择maven;

若为maven项目,导入成功后请执行maven clean;maven install命令,然后运行;

3. 将项目中jdbc.properties配置文件中的数据库配置改为自己的配置;
4. 运行项目,输入localhost:8080/ 登录
管理员账号:admir 密码:1234

用户账号:test 密码:1201

运行截图

 

 

 

 

 

 

 

相关代码 

AgencyController

package mms.controller;

import org.springframework.beans.factory.annotation.Autowired;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import mms.pojo.Agency;
import mms.pojo.EasyUIResult;
import mms.services.AgencyService;

@RequestMapping("Agency")
@Controller
public class AgencyController {
	// 经办人controller
	@Autowired
	private AgencyService agencyService;

	// 通过ano查询单个经办人
	@RequestMapping("GetAgency")
	@ResponseBody
	public Agency queryAgencyByAno(String ano) {
		Agency agency = agencyService.queryAgencyByAno(ano);
		return agency;
	}

	@RequestMapping(value = "DeleteAgency", produces = "text/html;charset=UTF-8")
	@ResponseBody
	// 按编号删除
	public String deleteAgencyByAno(String ano) {
		return agencyService.deleteAgencyByAno(ano);
	}

	// 批量删除
	@RequestMapping(value = "DeleteRows", produces = "text/html;charset=UTF-8")
	@ResponseBody
	public String deleteAgencyByRows(@RequestParam(value = "array[]") String[] array) {
		try {
			return agencyService.deleteAgencyByRows(array);
		} catch (Exception e) {
			// TODO: handle exception
			// 捕获异常,spring进行事务回滚
			return "操作异常,,某些经办人处理过顾客信息,无法删除该经办人,请重新选择";
		}

	}

	// 修改经办人信息
	@RequestMapping(value = "ModifyAgency", produces = "text/html;charset=UTF-8")
	@ResponseBody
	public String modifyAgency(Agency agency) {
		return agencyService.modifyAgency(agency);
	}

	// easyui数据表格返回全部经办人json
	@RequestMapping("GetMessage")
	@ResponseBody
	public EasyUIResult queryAllAgency(@RequestParam(value = "page", defaultValue = "1") Integer page,
			@RequestParam(value = "rows", defaultValue = "5") Integer rows) {
		return this.agencyService.queryAllAgency(page, rows);
	}

	// 保存经办人信息
	@RequestMapping(value = "SaveAgency", produces = "text/html;charset=UTF-8")
	@ResponseBody
	public String saveAgency(Agency agency) {
		return agencyService.saveAgency(agency);
	}

	// 返回所有经办人
	@RequestMapping("GetAllAgency")
	@ResponseBody
	public java.util.List<Agency> getAllAgency() {
		java.util.List<Agency> allAgency = agencyService.getAllAgency();
		return allAgency;
	}
}

ClientController

package mms.controller;

import org.springframework.beans.factory.annotation.Autowired;



import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import mms.pojo.Client;
import mms.pojo.EasyUIResult;
import mms.services.ClientService;

@RequestMapping("Client")
@Controller
public class ClientController {
	// 顾客controller
	@Autowired
	// 注入service
	private ClientService clientService;

	// 按编号查询
	@RequestMapping("GetClient")
	@ResponseBody
	public Client queryClientBycno(String cno) {
		Client client = clientService.queryClientBycno(cno);
		return client;
	}

	// 按编号删除
	@RequestMapping("DeleteClient")
	@ResponseBody
	public void deleteClientBycno(String cno) {
		clientService.deleteClientBycno(cno);
	}
//	批量删除
	@RequestMapping(value = "DeleteRows", produces = "text/html;charset=UTF-8")
	@ResponseBody
	public String deleteClientByRows(
			@RequestParam(value = "array[]") String[] array) {
		return clientService.deleteClientByRows(array);
		
//		clientService.deleteClientBycno(cno);
	}

	// 保存顾客信息
	@RequestMapping(value = "SaveClient", produces = "text/html;charset=UTF-8")
	@ResponseBody
	public String saveClient(Client client) {
		return clientService.saveClient(client);
	}

	@RequestMapping("GetMessage")
	@ResponseBody
	// easyui返回json
	public EasyUIResult queryAllClient(@RequestParam(value = "page", defaultValue = "1") Integer page,
			@RequestParam(value = "rows", defaultValue = "5") Integer rows) {
		EasyUIResult queryAllClient = clientService.queryAllClient(page, rows);
		return queryAllClient;
	}

	// 修改客户信息
	@RequestMapping(value = "ModifyClient", produces = "text/html;charset=UTF-8")
	@ResponseBody
	public String modifyClient(Client client) {
		return clientService.modifyClient(client);
	}
}

LoginController

package mms.controller;

import java.util.Enumeration;
import javax.servlet.http.HttpSession;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import mms.services.LoginService;
//处理登陆逻辑

@RequestMapping("Login")
@Controller
public class LoginController {
	@Autowired
	private LoginService loginService;

	/*
	 * 用户登陆 判断是否存在用户 存在保存session
	 */
	@RequestMapping(value = "loginUser", produces = "text/html;charset=UTF-8")
	@ResponseBody
	public String login(String username, String password, HttpSession session) {
		return loginService.login(username, password, session);
	}

	// 取出seeion的用户名
	@RequestMapping("GetLoginName")
	@ResponseBody
	public Object GetLoginName(HttpSession session) {
		Object username = session.getAttribute("user");
		return username;
	}

	// 清除session
	@RequestMapping("LogOff")
	@ResponseBody
	public void logOff(HttpSession session) {
		Enumeration em = session.getAttributeNames();
		while (em.hasMoreElements()) {
			session.removeAttribute(em.nextElement().toString());
		}
	}
}

MedicineController

package mms.controller;

import java.util.List;

import javax.servlet.http.HttpSession;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import mms.pojo.EasyUIResult;
import mms.pojo.Medicine;
import mms.services.MedicineService;

@RequestMapping("Medicine")
@Controller
public class MedicineController {
	// 药品controller
	@Autowired
	private MedicineService medicineService;

	// 通过mno查询药品信息
	@RequestMapping("QueryMedicineByMno")
	@ResponseBody
	public Medicine queryMedicineByMno(String mno) {
		Medicine medicine = medicineService.queryMedicineByMno(mno);
		return medicine;
	}

	/*
	 * // 多条件药品信息保存session
	 * 
	 * @RequestMapping("QueryMultiMedicine")
	 * 
	 * @ResponseBody public String queryMultiMedicine(Medicine
	 * medicine,HttpSession session) { return
	 * medicineService.queryMultiMedicine(medicine,session);
	 * 
	 * } // 多条件药品查询url
	 * 
	 * @RequestMapping("GetMultiMedicine")
	 * 
	 * @ResponseBody public EasyUIResult getMultiMedicine(@RequestParam(value =
	 * "page", defaultValue = "1") Integer page,
	 * 
	 * @RequestParam(value = "rows", defaultValue = "5") Integer rows,
	 * HttpSession session) { return medicineService.getMultiMedicine(page,
	 * rows,session);
	 * 
	 * }
	 */
	/*
	 * // 通过mno删除药品信息
	 * 
	 * @RequestMapping(value = "DeleteMedicine", produces =
	 * "text/html;charset=UTF-8")
	 * 
	 * @ResponseBody public String deleteMedicineByMno(String mno) { return
	 * medicineService.deleteMedicineByMno(mno); }
	 */
	// 批量删除
	@RequestMapping(value = "DeleteRows", produces = "text/html;charset=UTF-8")
	@ResponseBody
	public String deleteMedicineByRows(@RequestParam(value = "array[]") String[] array) {
		try {

			return medicineService.deleteMedicineByRows(array);

		} catch (Exception e) {
			// TODO: handle exception
			return "操作异常,可能某些药品被顾客购买过," + "无法删该药品,请重新选择";
		}
	}

	// 保存药品信息
	@RequestMapping(value = "SaveMedicine", produces = "text/html;charset=UTF-8")
	@ResponseBody
	public String saveMedicine(Medicine medicine) {
		return medicineService.saveMedicine(medicine);
	}

	// 修改药品信息
	@RequestMapping(value = "ModifyMedicine", produces = "text/html;charset=UTF-8")
	@ResponseBody
	public String modifyMedicine(Medicine medicine) {
		return medicineService.modifyMedicine(medicine);
	}

	// easyui返回json
	@RequestMapping("GetMessage")
	@ResponseBody
	public EasyUIResult queryAllMedicine(@RequestParam(value = "page", defaultValue = "1") Integer page,
			@RequestParam(value = "rows", defaultValue = "5") Integer rows) {
		return medicineService.queryAllMedicine(page, rows);

	}

	// 获得药品信息
	@RequestMapping("GetAllMedicine")
	@ResponseBody
	public List<Medicine> getAllMedicine() {
		List<Medicine> allMedicine = medicineService.getAllMedicine();
		return allMedicine;

	}
}

UserController

package mms.controller;

import org.springframework.beans.factory.annotation.Autowired;

import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Controller;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.ResponseStatus;

import mms.pojo.EasyUIResult;
import mms.pojo.User;
import mms.services.UserServies;

//用户
@RequestMapping("User")
@Controller
public class UserController {
	@Autowired
	private UserServies userServies;

	// 添加新用户
	@RequestMapping("AddUser")
	@ResponseBody
	public String addUser(User user) {
		userServies.addUser(user);
		return "success";
	}

	// 修改用户信息
	@RequestMapping("UpdateUser")
	@ResponseBody
	public void updateUser(User user) {
		userServies.updateUser(user);
	}

	// 删除用户
	@RequestMapping("DeleteUser")
	@ResponseStatus(value = HttpStatus.OK)
	public void deleteUser(String uUsername) {
		userServies.deleteUser(uUsername);
	}

	// easyui返回全部用户信息
	@RequestMapping("queryAllUser")
	@ResponseBody
	public EasyUIResult queryAllUser(@RequestParam(value = "page", defaultValue = "1") Integer page,
			@RequestParam(value = "rows", defaultValue = "5") Integer rows) {
		EasyUIResult queryAllUser = userServies.queryAllUser(page, rows);
		return queryAllUser;
	}

	// 通过uUsername查询用户
	@RequestMapping(value = "GetUUsername", produces = "text/html;charset=UTF-8")
	@ResponseBody
	public String queryUserByName(String uUsername) {
		return userServies.queryUserByName(uUsername);
	}
	@RequestMapping(value = "GetUpassword", produces = "text/html;charset=UTF-8")
	@ResponseBody
	public String queryPasswordByName(String uUsername) {
		return userServies.queryPasswordByName(uUsername);
	}
}

如果也想学习本系统,下面领取。关注并回复:079ssm 

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

打赏作者

夜未央5788

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

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

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

打赏作者

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

抵扣说明:

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

余额充值