Java项目:springboot药品管理系统

news/2024/5/4 11:56:29/文章来源:https://blog.csdn.net/m0_74967853/article/details/128435550

作者主页:源码空间站2022

 简介: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. 后端:SpringBoot

2. 前端:html+layui+jquery+bootstrap+echarts

使用说明

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

4. 运行项目,后端输入localhost:8081/

运行截图

管理员界面

取药员界面

其他

代码相关

管理端控制器

@RestController
@CrossOrigin
@RequestMapping("/admin")
public class AdminController {@Autowiredprivate AdminService adminService;@RequestMapping("/insertStorage")public AjaxInfo insertStroage(@RequestBody Instorage instorage, HttpSession session) {System.out.println(instorage);AjaxInfo ajaxInfo = new AjaxInfo();Instorage in = new Instorage();if (session.getAttribute("userName") != null) {Medicine med = adminService.getMedicineBymedId(instorage.getMedId());SimpleDateFormat time = new SimpleDateFormat("yyyy-MM-dd HH:mm");Date date = new Date();in.setMedId(instorage.getMedId());in.setBuyerId(instorage.getBuyerId());in.setInDate(time.format(date));in.setInStorageNum(instorage.getInStorageNum());if (med == null) {ajaxInfo.setCode(-1);ajaxInfo.setMsg("入库失败,该药品不存在!");} else {adminService.insertInstorage(in);adminService.updateMedStorage(instorage.getMedId(), instorage.getInStorageNum()+med.getMedStorage());ajaxInfo.setMsg("入库成功~");ajaxInfo.setCode(0);}return ajaxInfo;} else {ajaxInfo.setCode(-2);ajaxInfo.setMsg("权限不足!请先登录~");}return ajaxInfo;}@RequestMapping("/insertMedicine")public AjaxInfo insertMedicine(@RequestBody Medicine medicine, HttpSession session) {System.out.println(medicine);AjaxInfo ajaxInfo = new AjaxInfo();if (session.getAttribute("userName") != null) {Medicine med = adminService.getMedicineBymedId(medicine.getMedId());if (med == null) {adminService.insertMedicine(medicine);ajaxInfo.setMsg("插入信息成功~");ajaxInfo.setCode(0);} else {ajaxInfo.setMsg("该药品已存在~");ajaxInfo.setCode(-1);}return ajaxInfo;} else {ajaxInfo.setCode(-2);ajaxInfo.setMsg("权限不足!请先登录~");}return ajaxInfo;}@RequestMapping("/queryMedicine")public AjaxInfo queryMedicine(@RequestBody Medicine medicine, HttpSession session) {AjaxInfo ajaxInfo = new AjaxInfo();if (session.getAttribute("userName") != null) {Medicine med = adminService.getMedicineBymedId(medicine.getMedId());if (med == null) {ajaxInfo.setMsg("该药品不存在,请重新输入!");ajaxInfo.setCode(-1);} else {ajaxInfo.setMsg("查询成功!");ajaxInfo.setData(med);ajaxInfo.setCode(0);System.out.println(med);}return ajaxInfo;} else {ajaxInfo.setMsg("权限不足!请先登录~");ajaxInfo.setCode(-2);}return ajaxInfo;}@RequestMapping("/updateMedicine")public AjaxInfo updateMedicine(@RequestBody Medicine medicine, HttpSession session) {AjaxInfo ajaxInfo = new AjaxInfo();if (session.getAttribute("userName") != null) {adminService.updateMedicine(medicine);ajaxInfo.setMsg("更新成功!");ajaxInfo.setCode(0);} else {ajaxInfo.setCode(-2);ajaxInfo.setMsg("权限不足!请先登录~");}return ajaxInfo;}@RequestMapping("/deleteMedicine")public AjaxInfo deleteMedicine(@RequestBody Medicine medicine, HttpSession session) {AjaxInfo ajaxInfo = new AjaxInfo();if (session.getAttribute("userName") != null) {adminService.deleteMedicine(medicine.getMedId());ajaxInfo.setMsg("删除成功!");ajaxInfo.setCode(0);} else {ajaxInfo.setMsg("权限不足!请先登录~");}return ajaxInfo;}@RequestMapping("/insertFactory")public AjaxInfo insertFactory(@RequestBody Factory factory, HttpSession session) {AjaxInfo ajaxInfo = new AjaxInfo();if (session.getAttribute("userName") != null) {Factory fId = adminService.getFactoryByfactoryId(factory.getFactoryId());if (fId == null) {adminService.insertFactory(factory);ajaxInfo.setMsg("插入信息成功~");ajaxInfo.setCode(0);} else {ajaxInfo.setMsg("该药厂已存在~");ajaxInfo.setCode(-1);}return ajaxInfo;} else {ajaxInfo.setCode(-2);ajaxInfo.setMsg("权限不足!请先登录~");}return ajaxInfo;}@RequestMapping("/queryFactory")public AjaxInfo queryFactory(@RequestBody Factory factory, HttpSession session) {AjaxInfo ajaxInfo = new AjaxInfo();if (session.getAttribute("userName") != null) {Factory fId = adminService.getFactoryByfactoryId(factory.getFactoryId());if (fId == null) {ajaxInfo.setMsg("该药厂不存在,请重新输入!");ajaxInfo.setCode(-1);} else {ajaxInfo.setMsg("查询成功!");ajaxInfo.setData(fId);ajaxInfo.setCode(0);System.out.println(fId);}return ajaxInfo;} else {ajaxInfo.setMsg("权限不足!请先登录~");ajaxInfo.setCode(-2);}return ajaxInfo;}@RequestMapping("/updateFactory")public AjaxInfo updateFactory(@RequestBody Factory factory, HttpSession session) {System.out.println(factory);AjaxInfo ajaxInfo = new AjaxInfo();if (session.getAttribute("userName") != null) {adminService.updateFactory(factory);ajaxInfo.setMsg("更新成功!");ajaxInfo.setCode(0);} else {ajaxInfo.setCode(-2);ajaxInfo.setMsg("权限不足!请先登录~");}return ajaxInfo;}@RequestMapping("/deleteFactory")public AjaxInfo deleteFactory(@RequestBody Factory factory, HttpSession session) {AjaxInfo ajaxInfo = new AjaxInfo();if (session.getAttribute("userName") != null) {adminService.deleteFactory(factory.getFactoryId());ajaxInfo.setMsg("删除成功!");ajaxInfo.setCode(0);} else {ajaxInfo.setCode(-2);ajaxInfo.setMsg("权限不足!请先登录~");}return ajaxInfo;}
}

 用户端控制器

@RestController
@RequestMapping("/user")
@CrossOrigin
public class UserController {@Autowiredprivate UserService userService;@RequestMapping("/login")public AjaxInfo login(@RequestBody User user, HttpSession session) {AjaxInfo ajaxInfo = new AjaxInfo();System.out.println(session.getId());User user1 = userService.findUser(user);if (user1 != null) {ajaxInfo.setCode(user1.getUserRight());ajaxInfo.setMsg("登陆成功!");ajaxInfo.setData(user1.getUserName());session.setAttribute("userName", user1.getUserName());System.out.println(session.getAttribute("userName"));} else {ajaxInfo.setCode(-1);ajaxInfo.setMsg("账号或密码错误!");}return ajaxInfo;}@RequestMapping("/logout")public String login(HttpSession session) {System.out.println(session.getId());System.out.println(session.getAttribute("userName"));session.removeAttribute("userName");return "success";}@RequestMapping("/registUser")public AjaxInfo regist(@RequestBody User user, HttpSession session) {AjaxInfo ajaxInfo = new AjaxInfo();User userByAcc = userService.getUserByAcc(user.getUserAcc());if (session.getAttribute("userName") != null) {if (userByAcc == null) {userService.registUser(user);ajaxInfo.setMsg("注册成功!");} else {ajaxInfo.setMsg("账号已存在!请重新输入~");}return ajaxInfo;} else {ajaxInfo.setMsg("权限不足!请先登录~");}return ajaxInfo;}@RequestMapping("/queryUser")public AjaxInfo queryUser(@RequestBody User user, HttpSession session) {System.out.println(user);AjaxInfo ajaxInfo = new AjaxInfo();if (session.getAttribute("userName") != null) {User userByAcc = userService.getUserByAcc(user.getUserAcc());if (userByAcc == null||userByAcc.getUserRight()!=2) {ajaxInfo.setMsg("该取药员不存在,请重新输入!");ajaxInfo.setCode(-1);} else {ajaxInfo.setMsg("查询成功!");ajaxInfo.setCode(0);ajaxInfo.setData(userByAcc);}return ajaxInfo;} else {ajaxInfo.setCode(-2);ajaxInfo.setMsg("权限不足!请先登录~");}return ajaxInfo;}@RequestMapping("/deleteUser")public AjaxInfo deleteUser(@RequestBody User user, HttpSession session) {AjaxInfo ajaxInfo = new AjaxInfo();if (session.getAttribute("userName") != null) {userService.deleteUser(user.getUserAcc());ajaxInfo.setMsg("删除成功!");} else {ajaxInfo.setMsg("权限不足!请先登录~");}return ajaxInfo;}@RequestMapping("/registBuyer")public AjaxInfo registBuyer(@RequestBody Buyer buyer, HttpSession session) {AjaxInfo ajaxInfo = new AjaxInfo();System.out.println("======"+buyer);Buyer buyerByUserId = userService.getBuyerById(buyer.getBuyerId());if (session.getAttribute("userName") != null) {if (buyerByUserId == null) {userService.registBuyer(buyer);ajaxInfo.setMsg("注册成功!");} else {ajaxInfo.setMsg("ID已存在!");}return ajaxInfo;} else {ajaxInfo.setMsg("权限不足!请先登录~");}return ajaxInfo;}@RequestMapping("/queryBuyer")public AjaxInfo queryBuyer(@RequestBody Buyer buyer, HttpSession session) {AjaxInfo ajaxInfo = new AjaxInfo();System.out.println(buyer);if (session.getAttribute("userName") != null) {Buyer buyer1 = userService.getBuyerById(buyer.getBuyerId());if (buyer1 == null) {ajaxInfo.setMsg("该采购员不存在,请重新输入!");ajaxInfo.setCode(-1);} else {ajaxInfo.setMsg("查询成功!");ajaxInfo.setData(buyer1);ajaxInfo.setCode(0);}} else {ajaxInfo.setCode(-2);ajaxInfo.setMsg("权限不足!请先登录~");}System.out.println("================="+ajaxInfo.getCode());return ajaxInfo;}@RequestMapping("/deleteBuyer")public AjaxInfo deleteBuyer(@RequestBody Buyer buyer, HttpSession session) {AjaxInfo ajaxInfo = new AjaxInfo();if (session.getAttribute("userName") != null) {userService.deleteBuyer(buyer.getBuyerId());ajaxInfo.setMsg("删除成功!");} else {ajaxInfo.setMsg("权限不足!请先登录~");}return ajaxInfo;}@RequestMapping("/updateBuyer")public AjaxInfo updateBuyer(@RequestBody Buyer buyer, HttpSession session) {AjaxInfo ajaxInfo = new AjaxInfo();if (session.getAttribute("userName") != null) {userService.updateBuyer(buyer);ajaxInfo.setMsg("更新成功!");} else {ajaxInfo.setMsg("权限不足!请先登录~");}return ajaxInfo;}}

如果也想学习本系统,下面领取。回复:085springboot

 

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.luyixian.cn/news_show_240090.aspx

如若内容造成侵权/违法违规/事实不符,请联系dt猫网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

买不到的数目(蓝桥杯C/C++A组真题详解)

题目详细: 题目思路: 对于这个题有一个定理 如果 a,b 均是正整数且互质,那么由 axby,x≥0,y≥0 不能凑出的最大数是 : a*b-a-b 具体的证明过程这里就不赘述 感兴趣的同学可以自行查找 这里就提供一种思…

RabbitMQ 第二天 高级 7 RabbitMQ 高级特性 7.2 Consumer Ack

RabbitMQ 【黑马程序员RabbitMQ全套教程,rabbitmq消息中间件到实战】 文章目录RabbitMQ第二天 高级7 RabbitMQ 高级特性7.2 Consumer Ack7.2.1 Consumer Ack7.2.2 Consumer Ack 小结7.2.3 消息可靠性总结第二天 高级 7 RabbitMQ 高级特性 7.2 Consumer Ack 7.2.…

C#语言实例源码系列-伪装文件

专栏分享点击跳转>Unity3D特效百例点击跳转>案例项目实战源码点击跳转>游戏脚本-辅助自动化点击跳转>Android控件全解手册 👉关于作者 众所周知,人生是一个漫长的流程,不断克服困难,不断反思前进的过程。在这个过程中…

matlab神经网络求解最优化,matlab神经网络训练数据

1、神经网络的准确率是怎么计算的? 其实神经网络的准确率的标准是自己定义的。 我把你的例子赋予某种意义讲解: 1,期望输出[1 0 0 1],每个元素代表一个属性是否存在。像着4个元素分别表示:是否肺炎,是否肝…

你可能不知道的DOM断点调试技巧

前言 作为一个前端,DOM断点应该是我们非常熟悉的,也是我们日常工作中经常要用到的一种调试技巧;但是下面这些DOM断点调试技巧你可能不知道,且听我一一道来。 监听元素 有这样一种场景,当DOM中某个元素移除或者元素属…

数据结构---图

(一) 相关知识点 图(graph):图是由顶点的有穷非空集合和顶点之间边的集合组成,通常表示为:G(V,E),其中,G表示一个图,V是图G中的顶点的集合,E是图G…

从模型到服务——iDesktopX处理自动化工具实现BIM模型到三维服务发布

目录前言一、 处理自动化模型二、 算子参数设置1、 使用迭代数据集打开导出后的BIM模型2、 移除重复点、重复面和重复子对象3、 模型生成缓存4、 三维切片缓存发布5、 执行结果前言 BIM模型在SuperMap实际使用的业务流程中常常需要在桌面产品中生成缓存,然后通过iS…

QT多窗口编程与文件IO编程

目录 一、消息对话框 QMessageBox(掌握) 二、常用窗口类(掌握) 三、主窗口类 QMainWindow(重点) 四、parent参数(掌握) 五、窗口传参 5.1 成员函数/构造函数 5.2 信号槽传参 六、事件…

Android开发进阶——binder通讯学习

什么是binder 通常意义下,binder指的是一种通信机制对Server端来说,Binder指的是Binder本地对象,对于Client端来说,Binder指的是Binder代理对象对于传输过程而言,binder是可以跨进程传输的对象 Binder的基本原理 Bi…

MySQL 管理

文章目录启动及关闭 MySQL 服务器MySQL 用户设置/etc/my.cnf 文件配置管理MySQL的命令启动及关闭 MySQL 服务器 首先,我们需要通过以下命令来检查MySQL服务器是否启动: ps -ef | grep mysqld如果MySql已经启动,以上命令将输出mysql进程列表…

node.js+uni计算机毕设项目基于微信小程序的美甲预约系统(程序+小程序+LW)

该项目含有源码、文档、程序、数据库、配套开发软件、软件安装教程。欢迎交流 项目运行 环境配置: Node.js Vscode Mysql5.7 HBuilderXNavicat11VueExpress。 项目技术: Express框架 Node.js Vue 等等组成,B/S模式 Vscode管理前后端分离等…

Docker安装Zookeeper教程(超详细)

生命无罪,健康万岁,我是laity。 我曾七次鄙视自己的灵魂: 第一次,当它本可进取时,却故作谦卑; 第二次,当它在空虚时,用爱欲来填充; 第三次,在困难和容易之…

【Linux】进程间通信之共享内存

目录🌈前言🌸1、System V共享内存🍡1.1、概念🍢1.2、原理🌺2、共享内存相关函数和指令🍡2.1、shmget函数(创建)🍢2.2、shmctl函数(控制)&#x1f…

【自然语言处理】【ChatGPT系列】ChatGPT的智能来自哪里?

相关博客 【自然语言处理】【ChatGPT系列】ChatGPT的智能来自哪里? 【自然语言处理】【ChatGPT系列】Chain of Thought:从大模型中引导出推理能力 【自然语言处理】【ChatGPT系列】InstructGPT:遵循人类反馈指令来训练语言模型 【自然语言处理…

基于HTML5 技术的开放自动化HMI

人机交互接口(HMI)是自动化系统中不可或缺的一部分。传统的做法是提供一个HMI 显示屏,并且通过组态软件来配置显示屏的功能,通过modbus 或者以太网与PLC 连接。 现在,事情变得复杂了许多,用户不仅需要通过专…

linux共享内存的使用

共享内存可以由多个程序同时访问的内存,能够避免进程间通信过程中的冗余数据拷贝,是IPC中最快的一种,特别适合用来作大块数据的传输。共享内存可以映射到不同的进程空间,这些进程间的数据传递就不再涉及内核。这个过程其实是把同一块物理内存…

FMOC-PEG-COOH,FMOC-PEG-acid,芴甲氧羰基-聚乙二醇-羧基试剂供应

英文名称:FMOC-PEG-COOH,FMOC-PEG-acid 中文名称:芴甲氧羰基-聚乙二醇-羧基 蛋白质、肽和其他材料通过氨基酸或其他酸活性化学组,增加溶解度和稳定性,降低免疫原性;药物修饰或缓释药物研发,新…

ARM_SMMU_下

SMMU驱动代码分析 本文主要分析linux kernel中SMMUv3的代码(drivers/iommu/arm-smmu-v3.c) linux kernel版本是linux 5.7, 体系结构是aarch64 SMMU的作用是把CPU提交给设备的VA地址,直接作为设备发出的地址,变成正确的物理地址,访问到物理内…

[~/vulhub]/log4j/CVE-2021-44228-20221225

[~/vulhub]/log4j/CVE-2021-44228 ┌──(kwkl㉿kwkl)-[~/vulhub] └─$ cd log4j/CVE-2021-44228 ┌──(kwkl㉿kwkl)-[~/vulhub/log4j/CVE-2021-44228] └─$ dir 1.png 2.png docker-compose.yml README.md README.zh-cn.md┌──(kwkl㉿kwkl)-[~/vulhub/log4j/CVE-2021…

_15LeetCode代码随想录算法训练营第十五天-C++二叉树

_15LeetCode代码随想录算法训练营第十五天-C二叉树 题目列表 110.平衡二叉树257.二叉树的所有路径404.左叶子之和 110.平衡二叉树 题目 给定一个二叉树,判断它是否是高度平衡的二叉树。 本题中,一棵高度平衡二叉树定义为: 一个二叉树每…