基于javaweb的SSM+Maven药店药品管理系统(java+ssm+html+jquery+tomcat+mysql)

运行环境

Java≥8、MySQL≥5.7、Tomcat≥8

开发工具

eclipse/idea/myeclipse/sts等均可配置运行

适用

课程设计,大作业,毕业设计,项目练习,学习演示等

功能说明

330023082402

340023082402

350023082402

370023082402

380023082402

390023082402

基于javaweb的SSM+Maven药店药品管理系统(java+ssm+html+jquery+tomcat+mysql)

项目介绍

该项目是前后台的医药管理系统(写在了一个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登录,购买要求,形成订单。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
        }
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;
}

}
package com.clw.medicine.medi_detail.controller;



/**
* Description: 药品控制器
* Author: clw
* Version: 1.0
*/
@Controller
@RequestMapping(value = "medicine/medicine", method = {RequestMethod.POST})
public class MedicineController {

@Autowired
MedicineService medicineService;

/**
* 获取指定数量的药品信息
* @param offset 偏移量
* @param limit 返回限制条数
* @return Map 返回相关状态及信息
* @throws Exception 异常
*/
@RequestMapping(value = "getFilteredLimitMedicine")
public @ResponseBody
Map<String, Object> getFilteredLimitMedicine(@RequestParam(value = "medTypeId", defaultValue = "") String medTypeId,
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45

@Autowired
MedicineService medicineService;

/**
* 获取指定数量的药品信息
* @param offset 偏移量
* @param limit 返回限制条数
* @return Map 返回相关状态及信息
* @throws Exception 异常
*/
@RequestMapping(value = "getFilteredLimitMedicine")
public @ResponseBody
Map<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 @ResponseBody
Map<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");
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
 * @throws Exception 异常
*/
@RequestMapping(value = "getUserCount")
public @ResponseBody
Map<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 @ResponseBody
Map<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 @ResponseBody
Map<String, Object> updateUserById(@RequestBody User user) throws Exception {
int updateCount = userService.updateById(user);
Map<String, Object> result = new HashMap<String, Object>();
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46

/**
* 添加药品类型
* @param medicineType 药品信息
* @return Map 返回相关状态及信息
* @throws Exception 异常
*/
@RequestMapping(value = "addMedicineType")
public @ResponseBody
Map<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 @ResponseBody
Map<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;
}

}
package com.clw.medicine.orders.controller;

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
     * 根据管理员ID更新用户密码
* @param uid 管理员ID
* @param originalPasswd 原密码
* @param newPasswd 新密码
* @return Map 返回相关状态及信息
* @throws Exception 异常
*/
@RequestMapping(value = "updateAdminPasswdById")
public @ResponseBody
Map<String, Object> updateAdminPasswdById(@RequestParam(value = "uid", defaultValue = "") String uid,
@RequestParam(value = "originalPasswd", defaultValue = "") String originalPasswd,
@RequestParam(value = "newPasswd", defaultValue = "") String newPasswd) throws Exception {
int updateCount = adminService.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;
}

}
package com.clw.medicine.medi_detail.controller;



/**
* Description:
* Author: clw
* Version: 1.0
*/
@Controller
@RequestMapping(value = "medicine/medicine_type", method = {RequestMethod.POST})
public class MedicineTypeController {

@Autowired
MedicineTypeService medicineTypeService;


项目链接:
https://javayms.github.io?id=421422292105200fn
https://javayms.pages.dev?id=421422292105200fn