Java项目:ssm药品管理系统
创始人
2024-02-22 07:36:07

作者主页:源码空间站2022

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

文末获取源码

项目介绍

该项目是前后台的医药管理系统(写在了一个web项目里),

简单明了,界面高端大气,共6张表,适合毕业设计使用,

后台管理系统用于药片的管理,

前台系统是用户购买药片,下订单使用。

主要功能介绍:

药品管理系统-后台:

订单管理

添加、编辑、删除

药品管理

添加、编辑、删除 - 药品名、药品类别、单价

药品类别管理

添加、编辑、删除 - 类别名称、描述

用户管理

添加、编辑、删除 - 用户名、电话、描述

药品商城-前台:

前台页面展示药品类别、药品缩略图、药品详情、可购买、加入购物车、形成订单

配置环境

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.是否Maven项目: 是;查看源码目录中是否包含pom.xml;

若包含,则为maven项目,否则为非maven项目

6.数据库:MySql 5.7版本;

技术栈

1. 后端:Spring SpringMVC MyBatis
2. 前端:html+jQuery+javascript

使用步骤

1 使用IDEA/Eclipse导入MedicinesMS项目

2 使用Navicat或者其它工具,导入并执行sql文件 medicine_ms.sql,在项目的数据库配置文件db.properties中修改数据库相关配置,包括数据库名称、数据库用户名、密码等;

3 使用tomcat启动项目,项目名是/MedicinesMS 注:请固定为此项目名,否则会产生异常

4 访问后台系统http://localhost:8080/MedicinesMS/admin_login.html

进入登录页面,用户名 admin,密码123

5 在后台系统上添加药品信息

6 访问前台页面http://localhost:8080/MedicinesMS/login.html,

使用用户名 admin,密码123登录,购买要求,形成订单。

运行截图

前台界面

后台界面

相关代码 

药品控制器

package com.clw.medicine.medi_detail.controller;import com.clw.medicine.medi_detail.po.Medicine;
import com.clw.medicine.medi_detail.service.MedicineService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.List;
import java.util.Map;/*** Description: 药品控制器* Author: clw* Date: 2018/4/9* Version: 1.0*/
@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 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 medicines = medicineService.getFilteredLimitMedicine(medTypeId, offset, limit);Map result = new HashMap();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 getSomeMedicine(@RequestParam(value = "medicineIds[]") String[] medicineIds) throws Exception {List medicines = medicineService.getSomeMedicine(medicineIds);Map result = new HashMap();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 getMedicineCount() throws Exception {int count = medicineService.count();Map result = new HashMap();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 updateMedicineById(@RequestBody Medicine medicine) throws Exception {int updateCount = medicineService.updateById(medicine);Map result = new HashMap();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 deleteSomeMedicine(@RequestParam(value = "medicineIds[]") String[] medicineIds) throws Exception {int deleteNum = medicineService.deleteSomeMedicine(medicineIds);Map result = new HashMap();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 addMedicine(@RequestBody Medicine medicine) throws Exception {int addCount = medicineService.addMedicine(medicine);Map result = new HashMap();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 addMedicinePic(HttpServletRequest request,@RequestParam("medicinePic") MultipartFile medicinePic) throws Exception {Map result = new HashMap();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 getFilteredMedicineCount(@RequestBody Medicine medicine) throws Exception {System.out.println("getFilteredMedicineCount --- medicine: " + medicine);Map result = new HashMap();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;}}

MedicineTypeController

package com.clw.medicine.medi_detail.controller;import com.clw.medicine.medi_detail.po.MedicineType;
import com.clw.medicine.medi_detail.service.MedicineTypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;import java.util.HashMap;
import java.util.List;
import java.util.Map;/*** Description:* Author: clw* Date: 2018/4/9* Version: 1.0*/
@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 getSomeMedicineType(@RequestParam(value = "typeIds[]") String[] typeIds) throws Exception {List medicineTypes = medicineTypeService.getSomeMedicineType(typeIds);Map result = new HashMap();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 getMedicineTypeCount() throws Exception {int count = medicineTypeService.count();Map result = new HashMap();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 getLimitMedicineType(@RequestParam(value = "offset") int offset,@RequestParam(value = "limit") int limit) throws Exception {List medicineTypes = medicineTypeService.getLimitMedicineType(offset, limit);Map result = new HashMap();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 updateMedicineTypeById(@RequestBody MedicineType medicineType) throws Exception {int updateCount = medicineTypeService.updateById(medicineType);Map result = new HashMap();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 deleteSomeMedicineType(@RequestParam(value = "medicineTypeIds[]") String[] medicineTypeIds) throws Exception {int deleteNum = medicineTypeService.deleteSomeMedicineType(medicineTypeIds);Map result = new HashMap();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 addMedicineType(@RequestBody MedicineType medicineType) throws Exception {System.out.println(medicineType);int addCount = medicineTypeService.addMedicineType(medicineType);Map result = new HashMap();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 getAllMedicineType() throws Exception {List medicineTypes = medicineTypeService.getAllMedicineType();Map result = new HashMap();if (medicineTypes.size() > 0) {result.put("state", "success");result.put("result", medicineTypes);} else {result.put("state", "fail");result.put("reason", null);}return result;}}

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

 

相关内容

热门资讯

埃菲尔铁塔在哪 中国仿建埃菲尔... 2019年4月26日,广西南宁市,街头惊现一座巨型山寨版埃菲尔铁塔,高约20米,白色塔身,造型逼真,...
苗族的传统节日 贵州苗族节日有... 【岜沙苗族芦笙节】岜沙,苗语叫“分送”,距从江县城7.5公里,是世界上最崇拜树木并以树为神的枪手部落...
北京的名胜古迹 北京最著名的景... 北京从元代开始,逐渐走上帝国首都的道路,先是成为大辽朝五大首都之一的南京城,随着金灭辽,金代从海陵王...
长白山自助游攻略 吉林长白山游... 昨天介绍了西坡的景点详细请看链接:一个人的旅行,据说能看到长白山天池全凭运气,您的运气如何?今日介绍...
应用未安装解决办法 平板应用未... ---IT小技术,每天Get一个小技能!一、前言描述苹果IPad2居然不能安装怎么办?与此IPad不...
脚上的穴位图 脚面经络图对应的... 人体穴位作用图解大全更清晰直观的标注了各个人体穴位的作用,包括头部穴位图、胸部穴位图、背部穴位图、胳...
demo什么意思 demo版本... 618快到了,各位的小金库大概也在准备开闸放水了吧。没有小金库的,也该向老婆撒娇卖萌服个软了,一切只...
猫咪吃了塑料袋怎么办 猫咪误食... 你知道吗?塑料袋放久了会长猫哦!要说猫咪对塑料袋的喜爱程度完完全全可以媲美纸箱家里只要一有塑料袋的响...
世界上最漂亮的人 世界上最漂亮... 此前在某网上,选出了全球265万颜值姣好的女性。从这些数量庞大的女性群体中,人们投票选出了心目中最美...
埃菲尔铁塔在哪 中国仿建埃菲尔... 2019年4月26日,广西南宁市,街头惊现一座巨型山寨版埃菲尔铁塔,高约20米,白色塔身,造型逼真,...
苗族的传统节日 贵州苗族节日有... 【岜沙苗族芦笙节】岜沙,苗语叫“分送”,距从江县城7.5公里,是世界上最崇拜树木并以树为神的枪手部落...
北京的名胜古迹 北京最著名的景... 北京从元代开始,逐渐走上帝国首都的道路,先是成为大辽朝五大首都之一的南京城,随着金灭辽,金代从海陵王...
长白山自助游攻略 吉林长白山游... 昨天介绍了西坡的景点详细请看链接:一个人的旅行,据说能看到长白山天池全凭运气,您的运气如何?今日介绍...