源码获取:俺的博客首页 "资源" 里下载!

项目介绍

管理员角色包含以下功能:
管理员登录,角色权限管理,职工管理,药品销售管理,供应商管理,进货管理,药品信息管理,过期药品处理等功能。

环境需要

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版本;

技术栈

1. 后端:Spring+SpringMVC+Mybatis
2. 前端:HTML+CSS+JavaScript+jsp

使用说明

1. 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件;
2. 使用IDEA/Eclipse/MyEclipse导入项目,Eclipse/MyEclipse导入时,若为maven项目请选择maven;
若为maven项目,导入成功后请执行maven clean;maven install命令,然后运行;
3. 将项目中application.yml配置文件中的数据库配置改为自己的配置;
4. 运行项目,输入localhost:8080/ 登录

用户管理控制器:

/*** Description: 用户控制器*/
@Controller
@RequestMapping(value = "user/user", method = {RequestMethod.POST})
public class UserController {@AutowiredUserService userService;/*** 登录Controller* @param request HttpServletRequest 对象* @param username 用户名* @param password 密码* @return Map 返回相关状态* @throws Exception 异常*/@RequestMapping(value = "login")public @ResponseBodyMap<String, String> login(HttpServletRequest request, @RequestParam(value = "username", defaultValue = "") String username,@RequestParam(value = "password", defaultValue = "") String password) throws Exception {System.out.println("username: " + username + ", password: " + password);User user = userService.loginCheck(username, password);Map<String, String> resultMap =new HashMap<String, String>();if (user != null) {request.getSession().setAttribute("userid", user.getUid());request.getSession().setAttribute("username", user.getUsername());request.getSession().setAttribute("identity", "user");resultMap.put("state", "success");} else {resultMap.put("state", "fail");resultMap.put("reason", ErrorInfoUtil.getErrorInfo("user.login.check.null"));}return resultMap;}/*** 获取指定用户ID的用户信息* @param userIds 用户ID数组* @return Map 返回相关状态及信息* @throws Exception 异常*/@RequestMapping(value = "getSomeUser")public @ResponseBodyMap<String, Object> getSomeUser(@RequestParam(value = "userIds[]") String[] userIds) throws Exception {List<User> users = userService.getSomeUser(userIds);Map<String, Object> result = new HashMap<String, Object>();if (users.size() > 0) {result.put("state", "success");result.put("result", users);} else {result.put("state", "fail");result.put("reason", null);}return result;}/*** 获取用户总量* @return Map 返回相关状态及信息* @throws Exception 异常*/@RequestMapping(value = "getUserCount")public @ResponseBodyMap<String, Object> getUserCount() throws Exception {int count = userService.count();Map<String, Object> result = new HashMap<String, Object>();if (count > 0) {result.put("state", "success");result.put("result", count);} else {result.put("state", "fail");result.put("reason", 0);}return result;}/*** 获取指定数量的用户信息* @param offset 偏移量* @param limit 限制返回条数* @return Map 返回相关状态及信息* @throws Exception 异常*/@RequestMapping(value = "getLimitUser")public @ResponseBodyMap<String, Object> getLimitUser(@RequestParam(value = "offset") int offset,@RequestParam(value = "limit") int limit) throws Exception {List<User> userList = userService.getLimitUser(offset, limit);Map<String, Object> result = new HashMap<String, Object>();if (userList.size() > 0) {result.put("state", "success");result.put("result", userList);} else {result.put("state", "fail");result.put("reason", null);}return result;}/*** 根据用户ID更新用户信息* @param user 新的用户信息* @return Map 返回相关状态及信息* @throws Exception 异常*/@RequestMapping(value = "updateUserById")public @ResponseBodyMap<String, Object> updateUserById(@RequestBody User user) throws Exception {int updateCount = userService.updateById(user);Map<String, Object> result = new HashMap<String, Object>();if (updateCount > 0) {result.put("state", "success");result.put("result", updateCount);} else {result.put("state", "fail");result.put("reason", 0);}return result;}/*** 根据用户ID数组删除一些用户信息* @param userIds 用户ID数组* @return Map 返回相关状态及信息* @throws Exception 异常*/@RequestMapping(value = "deleteSomeUser")public @ResponseBodyMap<String, Object> deleteSomeUser(@RequestParam(value = "userIds[]") String[] userIds) throws Exception {int deleteNum = userService.deleteSomeUser(userIds);Map<String, Object> result = new HashMap<String, Object>();if (deleteNum > 0) {result.put("state", "success");result.put("result", deleteNum);} else {result.put("state", "fail");result.put("reason", null);}return result;}/*** 添加用户* @param user 用户信息* @return Map 返回相关状态及信息* @throws Exception 异常*/@RequestMapping(value = {"addUser", "registerUser"})public @ResponseBodyMap<String, Object> addUser(@RequestBody User user) throws Exception {int addCount = userService.addUser(user);Map<String, Object> result = new HashMap<String, Object>();if (addCount > 0) {result.put("state", "success");result.put("result", addCount);} else {result.put("state", "fail");result.put("reason", 0);}return result;}/*** 根据用户ID更新用户密码* @param uid 用户ID* @param originalPasswd 原密码* @param newPasswd 新密码* @return Map 返回相关状态及信息* @throws Exception 异常*/@RequestMapping(value = "updateUserPasswdById")public @ResponseBodyMap<String, Object> updateUserPasswdById(@RequestParam(value = "uid", defaultValue = "") String uid,@RequestParam(value = "originalPasswd", defaultValue = "") String originalPasswd,@RequestParam(value = "newPasswd", defaultValue = "") String newPasswd) throws Exception {int updateCount = userService.updatePasswdById(uid, originalPasswd, newPasswd);Map<String, Object> result = new HashMap<String, Object>();if (updateCount > 0) {result.put("state", "success");result.put("result", updateCount);} else {result.put("state", "fail");result.put("reason", 0);}return result;}/*** 获取当前登录用户* @return Map 返回相关状态及信息* @throws Exception 异常*/@RequestMapping(value = "getCurrentUser")public @ResponseBodyMap<String, Object> getCurrentUser(HttpServletRequest request) throws Exception {String userId = (String) request.getSession().getAttribute("userid");User user = null;if (userId != null && !"".equals(userId)) {user = userService.getUserById(userId);}Map<String, Object> result = new HashMap<String, Object>();if (user != null) {result.put("state", "success");result.put("result", user);} else {result.put("state", "fail");result.put("reason", null);}return result;}}

药品管理控制器:

/*** Description: 药品控制器*/
@Controller
@RequestMapping(value = "medicine/medicine", method = {RequestMethod.POST})
public class MedicineController {@AutowiredMedicineService medicineService;/*** 获取指定数量的药品信息* @param offset 偏移量* @param limit 返回限制条数* @return Map 返回相关状态及信息* @throws Exception 异常*/@RequestMapping(value = "getFilteredLimitMedicine")public @ResponseBodyMap<String, Object> getFilteredLimitMedicine(@RequestParam(value = "medTypeId", defaultValue = "") String medTypeId,@RequestParam(value = "offset") int offset,@RequestParam(value = "limit") int limit) throws Exception {medTypeId = "".equals(medTypeId) ? null : medTypeId;List<Medicine> medicines = medicineService.getFilteredLimitMedicine(medTypeId, offset, limit);Map<String, Object> result = new HashMap<String, Object>();if (medicines.size() > 0) {result.put("state", "success");result.put("result", medicines);} else {result.put("state", "fail");result.put("reason", null);}return result;}/*** 获取指定ID的药品信息* @param medicineIds String[] 药品ID数组* @return Map 返回相关状态及信息* @throws Exception 异常*/@RequestMapping(value = "getSomeMedicine")public @ResponseBodyMap<String, Object> getSomeMedicine(@RequestParam(value = "medicineIds[]") String[] medicineIds) throws Exception {List<Medicine> medicines = medicineService.getSomeMedicine(medicineIds);Map<String, Object> result = new HashMap<String, Object>();if (medicines.size() > 0) {result.put("state", "success");result.put("result", medicines);} else {result.put("state", "fail");result.put("reason", null);}return result;}/*** 获取药品总量* @return Map 返回相关状态及信息* @throws Exception 异常*/@RequestMapping(value = "getMedicineCount")public @ResponseBodyMap<String, Object> getMedicineCount() throws Exception {int count = medicineService.count();Map<String, Object> result = new HashMap<String, Object>();if (count > 0) {result.put("state", "success");result.put("result", count);} else {result.put("state", "fail");result.put("reason", 0);}return result;}/*** 根据药品ID更新药品信息* @param medicine 新的药品信息* @return Map 返回相关状态及信息* @throws Exception 异常*/@RequestMapping(value = "updateMedicineById")public @ResponseBodyMap<String, Object> updateMedicineById(@RequestBody Medicine medicine) throws Exception {int updateCount = medicineService.updateById(medicine);Map<String, Object> result = new HashMap<String, Object>();if (updateCount > 0) {result.put("state", "success");result.put("result", updateCount);} else {result.put("state", "fail");result.put("reason", 0);}return result;}/*** 根据药品ID数组删除一些药品信息* @param medicineIds 药品ID数组* @return Map 返回相关状态及信息* @throws Exception 异常*/@RequestMapping(value = "deleteSomeMedicine")public @ResponseBodyMap<String, Object> deleteSomeMedicine(@RequestParam(value = "medicineIds[]") String[] medicineIds) throws Exception {int deleteNum = medicineService.deleteSomeMedicine(medicineIds);Map<String, Object> result = new HashMap<String, Object>();if (deleteNum > 0) {result.put("state", "success");result.put("result", deleteNum);} else {result.put("state", "fail");result.put("reason", null);}return result;}/*** 添加药品* @param medicine 药品信息* @return Map 返回相关状态及信息* @throws Exception 异常*/@RequestMapping(value = "addMedicine")public @ResponseBodyMap<String, Object> addMedicine(@RequestBody Medicine medicine) throws Exception {int addCount = medicineService.addMedicine(medicine);Map<String, Object> result = new HashMap<String, Object>();if (addCount > 0) {result.put("state", "success");result.put("result", addCount);} else {result.put("state", "fail");result.put("reason", 0);}return result;}/*** 药品图片上传* @param medicinePic 药品图片* @return Map 返回相关状态及信息* @throws Exception 异常*/@RequestMapping(value = "addMedicinePic")public @ResponseBodyMap<String, Object> addMedicinePic(HttpServletRequest request,@RequestParam("medicinePic") MultipartFile medicinePic) throws Exception {Map<String, Object> result = new HashMap<String, Object>();String imgPath = medicineService.uploadFile(request, medicinePic);System.out.println("upload img path: " + imgPath);if (imgPath != null) {result.put("state", "success");result.put("result", imgPath);} else {result.put("state", "fail");result.put("reason", null);}return result;}/*** 根据过滤条件过滤查询药品总数* @param medicine 药品过滤信息* @return Map 返回相关状态及信息* @throws Exception 异常*/@RequestMapping(value = "getFilteredMedicineCount")public @ResponseBodyMap<String, Object> getFilteredMedicineCount(@RequestBody Medicine medicine) throws Exception {System.out.println("getFilteredMedicineCount --- medicine: " + medicine);Map<String, Object> result = new HashMap<String, Object>();int count = medicineService.getFilteredCount(medicine);if (count > 0) {result.put("state", "success");result.put("result", count);} else {result.put("state", "fail");result.put("reason", null);}return result;}}

药品信息管理控制层:

@Controller
@RequestMapping(value = "medicine/medicine_type", method = {RequestMethod.POST})
public class MedicineTypeController {@AutowiredMedicineTypeService medicineTypeService;/*** 获取指定ID的药品类型信息* @param typeIds String[] 药品类型ID数组* @return Map 返回相关状态及信息* @throws Exception 异常*/@RequestMapping(value = "getSomeMedicineType")public @ResponseBodyMap<String, Object> getSomeMedicineType(@RequestParam(value = "typeIds[]") String[] typeIds) throws Exception {List<MedicineType> medicineTypes = medicineTypeService.getSomeMedicineType(typeIds);Map<String, Object> result = new HashMap<String, Object>();if (medicineTypes.size() > 0) {result.put("state", "success");result.put("result", medicineTypes);} else {result.put("state", "fail");result.put("reason", null);}return result;}/*** 获取药品类型总量* @return Map 返回相关状态及信息* @throws Exception 异常*/@RequestMapping(value = "getMedicineTypeCount")public @ResponseBodyMap<String, Object> getMedicineTypeCount() throws Exception {int count = medicineTypeService.count();Map<String, Object> result = new HashMap<String, Object>();if (count > 0) {result.put("state", "success");result.put("result", count);} else {result.put("state", "fail");result.put("reason", 0);}return result;}/*** 获取指定数量的药品类型信息* @param offset 偏移量* @param limit 返回限制条数* @return Map 返回相关状态及信息* @throws Exception 异常*/@RequestMapping(value = "getLimitMedicineType")public @ResponseBodyMap<String, Object> getLimitMedicineType(@RequestParam(value = "offset") int offset,@RequestParam(value = "limit") int limit) throws Exception {List<MedicineType> medicineTypes = medicineTypeService.getLimitMedicineType(offset, limit);Map<String, Object> result = new HashMap<String, Object>();if (medicineTypes.size() > 0) {result.put("state", "success");result.put("result", medicineTypes);} else {result.put("state", "fail");result.put("reason", null);}return result;}/*** 根据药品类型ID更新药品类型信息* @param medicineType 新的药品类型信息* @return Map 返回相关状态及信息* @throws Exception 异常*/@RequestMapping(value = "updateMedicineTypeById")public @ResponseBodyMap<String, Object> updateMedicineTypeById(@RequestBody MedicineType medicineType) throws Exception {int updateCount = medicineTypeService.updateById(medicineType);Map<String, Object> result = new HashMap<String, Object>();if (updateCount > 0) {result.put("state", "success");result.put("result", updateCount);} else {result.put("state", "fail");result.put("reason", 0);}return result;}/*** 根据药品类型ID数组删除一些药品类型信息* @param medicineTypeIds 药品类型ID数组* @return Map 返回相关状态及信息* @throws Exception 异常*/@RequestMapping(value = "deleteSomeMedicineType")public @ResponseBodyMap<String, Object> deleteSomeMedicineType(@RequestParam(value = "medicineTypeIds[]") String[] medicineTypeIds) throws Exception {int deleteNum = medicineTypeService.deleteSomeMedicineType(medicineTypeIds);Map<String, Object> result = new HashMap<String, Object>();if (deleteNum > 0) {result.put("state", "success");result.put("result", deleteNum);} else {result.put("state", "fail");result.put("reason", null);}return result;}/*** 添加药品类型* @param medicineType 药品信息* @return Map 返回相关状态及信息* @throws Exception 异常*/@RequestMapping(value = "addMedicineType")public @ResponseBodyMap<String, Object> addMedicineType(@RequestBody MedicineType medicineType) throws Exception {System.out.println(medicineType);int addCount = medicineTypeService.addMedicineType(medicineType);Map<String, Object> result = new HashMap<String, Object>();if (addCount > 0) {result.put("state", "success");result.put("result", addCount);} else {result.put("state", "fail");result.put("reason", 0);}return result;}/*** 查询所有药品类型* @return Map 返回相关状态及信息* @throws Exception 异常*/@RequestMapping(value = "getAllMedicineType")public @ResponseBodyMap<String, Object> getAllMedicineType() throws Exception {List<MedicineType> medicineTypes = medicineTypeService.getAllMedicineType();Map<String, Object> result = new HashMap<String, Object>();if (medicineTypes.size() > 0) {result.put("state", "success");result.put("result", medicineTypes);} else {result.put("state", "fail");result.put("reason", null);}return result;}}

源码获取:俺的博客首页 "资源" 里下载!

Java项目:药品进货销售管理系统(java+SSM+HTML+JS+JSP+mysql)相关推荐

  1. 基于javaweb的药品进货销售管理系统(java+ssm+html+js+jsp+mysql)

    基于javaweb的药品进货销售管理系统(java+ssm+html+js+jsp+mysql) 运行环境 Java≥8.MySQL≥5.7.Tomcat≥8 开发工具 eclipse/idea/my ...

  2. 基于javaweb的律师事务所律师管理系统(java+ssm+html+js+jsp+mysql)

    基于javaweb的律师事务所律师管理系统(java+ssm+html+js+jsp+mysql) 运行环境 Java≥8.MySQL≥5.7.Tomcat≥8 开发工具 eclipse/idea/m ...

  3. 基于javaweb的网吧计费管理系统(java+ssm+html+js+jsp+mysql)

    基于javaweb的网吧计费管理系统(java+ssm+html+js+jsp+mysql) 运行环境 Java≥8.MySQL≥5.7.Tomcat≥8 开发工具 eclipse/idea/myec ...

  4. 基于javaweb的物流快递管理系统(java+ssm+html+js+jsp+mysql)

    基于javaweb的物流快递管理系统(java+ssm+html+js+jsp+mysql) 运行环境 Java≥8.MySQL≥5.7.Tomcat≥8 开发工具 eclipse/idea/myec ...

  5. 基于javaweb的新闻管理系统(java+ssm+html+js+jsp+mysql)

    基于javaweb的新闻管理系统(java+ssm+html+js+jsp+mysql) 运行环境 Java≥8.MySQL≥5.7.Tomcat≥8 开发工具 eclipse/idea/myecli ...

  6. 基于javaweb的物业缴费管理系统(java+ssm+html+js+jsp+mysql)

    基于javaweb的物业缴费管理系统(java+ssm+html+js+jsp+mysql) 运行环境 Java≥8.MySQL≥5.7.Tomcat≥8 开发工具 eclipse/idea/myec ...

  7. Java项目:SSM药品进货销售管理系统

    作者主页:夜未央5788 简介:Java领域优质创作者.Java项目.学习资料.技术互助 文末获取源码 项目介绍 管理员角色包含以下功能: 管理员登录,角色权限管理,职工管理,药品销售管理,供应商管理 ...

  8. Java项目:快递取件管理系统(java+SSM+JSP+jQuery+Mysql)

    源码获取:俺的博客首页 "资源" 里下载! 项目介绍 车险理赔管理系统源码,分为两个角色,一个管理员,一个普通用户 主要功能说明: 管理员角色包含以下功能:管理员登录,个人资料修改 ...

  9. Java项目:CRM客户关系管理系统(java+Springboot+maven+mysql)

    源码获取:博客首页 "资源" 里下载! Springboot项目CRM客户关系管理系统: 系统实现了CRM客户关系系统的基本功能,主要有看板(当月参与的业务机会.当月转化情况.将要 ...

最新文章

  1. visual studio 2005 新建C++空项目无法调试的解决方案
  2. [POI2008] Poc (原名 Trians) Treap+Hash
  3. MySQL基础篇(03):系统和自定义函数总结,触发器使用详解
  4. 造成跨域的原因和解决方法
  5. 批量插入数据到sqlserver
  6. java调用 火眼臻睛,火眼臻睛车牌识别SDK评测
  7. 下载 .m3u8视频文件
  8. WiFi共享二维码自动生成
  9. 高速硬盘和固态硬盘的区别
  10. VBA_自定义对数函数
  11. django 1.11 文档
  12. 操作系统镜像下载【windows+linux+mac】
  13. 内网安全-域横向CobaltStrikeSPNRDP
  14. 摹客导入html,导入摹客RP
  15. 解决Retrofit和RxJava 抛出异常报错问题
  16. JAVA毕业设计宠物店管理系统设计与实现计算机源码+lw文档+系统+调试部署+数据库
  17. 【高德地图API】从零开始学高德JS API(一)地图展现——仙剑地图,麻点图,街景,室内图...
  18. php保留两位小数并且不四舍五入
  19. iOS-自定义相机拍照获取指定区域图片
  20. hdu 3665 Seaside floyd+超级汇点

热门文章

  1. python注释中文_python中文注释问题
  2. 下载torrent格式的文件
  3. Zen of Python(python之禅)
  4. HTML+CSS-----认识标签(第一部分)
  5. apt-get安装问题:请尝试不指明软件包的名字来运行“apt-get -f install”(也可以指定一个解决办法)。
  6. 阔密保密专家 防泄密软件概念
  7. Wedding Suite主题V2.6.4婚礼婚庆展示网站模板+WordPress内核
  8. 反直觉的「生日悖论」问题
  9. java日记day11
  10. HTML、CSS学习笔记小结