• Java项目:中药药方管理系统(java+SSM+JSP+bootstrap+Mysql)


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

    项目介绍

    本项目分为药房人员、管理员与医生三种角色;
    药房人员角色包含以下功能:
    药房人员登录,导诊单管理,采购管理等功能。

    管理员角色包含以下功能:
    管理员登录,药房人员管理,医生管理,药材信息管理,药方管理等功能。

    医生角色包含以下功能:
    医生登录,药材信息查询,药方查询,导诊单管理等功能。

    环境需要

    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/8.0版本均可;
    6.是否Maven项目:是;

    技术栈

    1. 后端:Spring+SpringMVC+Mbytes
    2. 前端:JSP+css+javascript+bootstrap+jQuery

    使用说明

    1. 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件;
    2. 使用IDEA/Eclipse/MyEclipse导入项目,Eclipse/MyEclipse导入时,若为maven项目请选择maven;
    若为maven项目,导入成功后请执行maven clean;maven install命令,然后运行;
    3. 将项目中db.properties配置文件中的数据库配置改为自己的配置;
    4. 运行项目,在浏览器中输入localhost:8080/ssm_yaofangsys/
    医生账号/密码: doctor/123456
    药房人员账号/密码:yaofang/123456
    管理员账号/密码:admin/admin

     

     

     

     

     

     

    登录管理控制层:

    1. @Controller
    2. @RequestMapping("/login")
    3. public class LoginController extends BaseController{
    4. @Autowired
    5. private ManageService manageService;
    6. @Autowired
    7. private MedicineUserService medicineUserService;
    8. @Autowired
    9. private DoctorService doctorService;
    10. /**
    11. * 跳转登陆
    12. * @return
    13. */
    14. @RequestMapping("/login")
    15. public String login(){
    16. return "login/mLogin";
    17. }
    18. @RequestMapping("/index")
    19. public String index(){
    20. return "login/mIndex";
    21. }
    22. @RequestMapping("/uIndex")
    23. public String uIndex(Model model){
    24. return "login/uIndex";
    25. }
    26. @RequestMapping("/welcome")
    27. public String welcome(){
    28. return "login/welcome";
    29. }
    30. @RequestMapping("/mup")
    31. public String mpass(){
    32. return "login/mup";
    33. }
    34. /**
    35. * 管理员登陆
    36. * @param manage
    37. * @param request
    38. * @param response
    39. * @return
    40. */
    41. @RequestMapping("/toLogin")
    42. public String toLogin(Manage manage,Integer role, HttpServletRequest request, HttpServletResponse response){
    43. if (role == null){
    44. return "redirect:/login/login.action";
    45. }
    46. //超级管理员
    47. if (role== 1){
    48. Manage byEntity = manageService.getByEntity(manage);
    49. if(byEntity != null){
    50. request.getSession().setAttribute("role", role);
    51. request.getSession().setAttribute("name", byEntity.getRealName());
    52. return "redirect:/login/index.action";
    53. }else{
    54. return "redirect:/login/login.action";
    55. }
    56. }
    57. //1 超级管理员2 医生 3 药房人员
    58. if (role== 2){
    59. Doctor d = new Doctor();
    60. d.setPassword(manage.getPassword());
    61. d.setUserName(manage.getUserName());
    62. Doctor byEntity = doctorService.getByEntity(d);
    63. if(byEntity != null){
    64. request.getSession().setAttribute("role", role);
    65. request.getSession().setAttribute("name", byEntity.getRealName());
    66. request.getSession().setAttribute("userId", byEntity.getId());
    67. return "redirect:/login/index.action";
    68. }else{
    69. return "redirect:/login/login.action";
    70. }
    71. }
    72. //药房人员
    73. if (role== 3){
    74. MedicineUser d = new MedicineUser();
    75. d.setPassword(manage.getPassword());
    76. d.setUserName(manage.getUserName());
    77. MedicineUser byEntity = medicineUserService.getByEntity(d);
    78. if(byEntity != null){
    79. request.getSession().setAttribute("role", role);
    80. request.getSession().setAttribute("name", byEntity.getRealName());
    81. request.getSession().setAttribute("userId", byEntity.getId());
    82. return "redirect:/login/index.action";
    83. }else{
    84. return "redirect:/login/login.action";
    85. }
    86. }
    87. return null;
    88. }
    89. /**
    90. * 退出
    91. * @param request
    92. * @param response
    93. * @return
    94. */
    95. @RequestMapping("/tuichu")
    96. public String tuichu( HttpServletRequest request, HttpServletResponse response){
    97. HttpSession session = request.getSession();
    98. session.invalidate();
    99. return "redirect:/login/login.action";
    100. }
    101. @RequestMapping("/uTui")
    102. public String uTui( HttpServletRequest request, HttpServletResponse response){
    103. HttpSession session = request.getSession();
    104. session.invalidate();
    105. return "redirect:/login/uLogin.action";
    106. }
    107. @RequestMapping("/head")
    108. private String head(){
    109. return "inc/head";
    110. }
    111. @RequestMapping("/left")
    112. private String left(){
    113. return "inc/left";
    114. }
    115. }

    医生管理控制层: 

    1. @Controller
    2. @RequestMapping("/doctor")
    3. public class DoctorController extends BaseController {
    4. /**
    5. * 依赖注入 start dao/service/===
    6. */
    7. @Autowired
    8. private DoctorService doctorService;
    9. @RequestMapping(value = "/findBySql")
    10. public String findBySql(Doctor doctor, Model model, HttpServletRequest request, HttpServletResponse response) {
    11. //分页查询
    12. String sql = "SELECT * FROM doctor WHERE 1=1 and isDelete = 0 ";//and isDelete = 0
    13. if(!isEmpty(doctor.getUserName())){
    14. sql += " and userName like '%"+doctor.getUserName()+"%'";
    15. }
    16. if(!isEmpty(doctor.getPassword())){
    17. sql += " and password like '%"+doctor.getPassword()+"%'";
    18. }
    19. if(!isEmpty(doctor.getRealName())){
    20. sql += " and realName like '%"+doctor.getRealName()+"%'";
    21. }
    22. if(!isEmpty(doctor.getIdCard())){
    23. sql += " and idCard like '%"+doctor.getIdCard()+"%'";
    24. }
    25. if(!isEmpty(doctor.getPhone())){
    26. sql += " and phone like '%"+doctor.getPhone()+"%'";
    27. }
    28. if(!isEmpty(doctor.getSex())){
    29. sql += " and sex like '%"+doctor.getSex()+"%'";
    30. }
    31. if(!isEmpty(doctor.getIsDelete())){
    32. sql += " and isDelete like '%"+doctor.getIsDelete()+"%'";
    33. }
    34. sql += " ORDER BY ID DESC ";
    35. Pager<Doctor> pagers = doctorService.findBySqlRerturnEntity(sql);
    36. model.addAttribute("pagers", pagers);
    37. //存储查询条件
    38. model.addAttribute("obj", doctor);
    39. return "doctor/doctor";
    40. }
    41. /**
    42. * 跳至添加页面
    43. * @return
    44. */
    45. @RequestMapping(value = "/add")
    46. public String add() {
    47. return "doctor/add";
    48. }
    49. /**
    50. * 添加执行
    51. * @return
    52. */
    53. @RequestMapping(value = "/exAdd")
    54. public String exAdd(Doctor doctor, Model model, HttpServletRequest request, HttpServletResponse response) {
    55. doctor.setIsDelete(0);
    56. doctorService.insert(doctor);
    57. return "redirect:/doctor/findBySql";
    58. }
    59. /**
    60. * 跳至修改页面
    61. * @return
    62. */
    63. @RequestMapping(value = "/update")
    64. public String update(Integer id,Model model) {
    65. Doctor obj = doctorService.load(id);
    66. model.addAttribute("obj",obj);
    67. return "doctor/update";
    68. }
    69. /**
    70. * 添加修改
    71. * @return
    72. */
    73. @RequestMapping(value = "/exUpdate")
    74. public String exUpdate(Doctor doctor, Model model, HttpServletRequest request, HttpServletResponse response) {
    75. //1.通过实体类修改,可以多传修改条件
    76. doctorService.updateById(doctor);
    77. //2.通过主键id修改
    78. //doctorService.updateById(doctor);
    79. return "redirect:/doctor/findBySql";
    80. }
    81. /**
    82. * 删除通过主键
    83. * @return
    84. */
    85. @RequestMapping(value = "/delete")
    86. public String delete(Integer id, Model model, HttpServletRequest request, HttpServletResponse response) {
    87. Doctor load = doctorService.load(id);
    88. load.setIsDelete(1);
    89. doctorService.update(load);
    90. doctorService.updateById(load);
    91. return "redirect:/doctor/findBySql";
    92. }
    93. }

    药房人员管理控制层:

    1. @Controller
    2. @RequestMapping("/medicineUser")
    3. public class MedicineUserController extends BaseController {
    4. /**
    5. * 依赖注入 start dao/service/===
    6. */
    7. @Autowired
    8. private MedicineUserService medicineUserService;
    9. @RequestMapping(value = "/findBySql")
    10. public String findBySql(MedicineUser medicineUser, Model model, HttpServletRequest request, HttpServletResponse response) {
    11. //分页查询
    12. String sql = "SELECT * FROM medicine_user WHERE 1=1 and isDelete = 0 ";//and isDelete = 0
    13. if(!isEmpty(medicineUser.getUserName())){
    14. sql += " and userName like '%"+medicineUser.getUserName()+"%'";
    15. }
    16. if(!isEmpty(medicineUser.getPassword())){
    17. sql += " and password like '%"+medicineUser.getPassword()+"%'";
    18. }
    19. if(!isEmpty(medicineUser.getRealName())){
    20. sql += " and realName like '%"+medicineUser.getRealName()+"%'";
    21. }
    22. if(!isEmpty(medicineUser.getIdCard())){
    23. sql += " and idCard like '%"+medicineUser.getIdCard()+"%'";
    24. }
    25. if(!isEmpty(medicineUser.getPhone())){
    26. sql += " and phone like '%"+medicineUser.getPhone()+"%'";
    27. }
    28. if(!isEmpty(medicineUser.getSex())){
    29. sql += " and sex like '%"+medicineUser.getSex()+"%'";
    30. }
    31. if(!isEmpty(medicineUser.getIsDelete())){
    32. sql += " and isDelete like '%"+medicineUser.getIsDelete()+"%'";
    33. }
    34. sql += " ORDER BY ID DESC ";
    35. Pager<MedicineUser> pagers = medicineUserService.findBySqlRerturnEntity(sql);
    36. model.addAttribute("pagers", pagers);
    37. //存储查询条件
    38. model.addAttribute("obj", medicineUser);
    39. return "medicineUser/medicineUser";
    40. }
    41. /**
    42. * 跳至添加页面
    43. * @return
    44. */
    45. @RequestMapping(value = "/add")
    46. public String add() {
    47. return "medicineUser/add";
    48. }
    49. /**
    50. * 添加执行
    51. * @return
    52. */
    53. @RequestMapping(value = "/exAdd")
    54. public String exAdd(MedicineUser medicineUser, Model model, HttpServletRequest request, HttpServletResponse response) {
    55. medicineUser.setIsDelete(0);
    56. medicineUserService.insert(medicineUser);
    57. return "redirect:/medicineUser/findBySql";
    58. }
    59. /**
    60. * 跳至修改页面
    61. * @return
    62. */
    63. @RequestMapping(value = "/update")
    64. public String update(Integer id,Model model) {
    65. MedicineUser obj = medicineUserService.load(id);
    66. model.addAttribute("obj",obj);
    67. return "medicineUser/update";
    68. }
    69. /**
    70. * 添加修改
    71. * @return
    72. */
    73. @RequestMapping(value = "/exUpdate")
    74. public String exUpdate(MedicineUser medicineUser, Model model, HttpServletRequest request, HttpServletResponse response) {
    75. //1.通过实体类修改,可以多传修改条件
    76. medicineUserService.updateById(medicineUser);
    77. //2.通过主键id修改
    78. //medicineUserService.updateById(medicineUser);
    79. return "redirect:/medicineUser/findBySql";
    80. }
    81. /**
    82. * 删除通过主键
    83. * @return
    84. */
    85. @RequestMapping(value = "/delete")
    86. public String delete(Integer id, Model model, HttpServletRequest request, HttpServletResponse response) {
    87. MedicineUser load = medicineUserService.load(id);
    88. load.setIsDelete(1);
    89. medicineUserService.updateById(load);
    90. return "redirect:/medicineUser/findBySql";
    91. }
    92. }

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

  • 相关阅读:
    【jquery Ajax 】art-template模板引擎的概念与使用
    SpringMVC:RESTful案例
    在线问诊 Python、FastAPI、Neo4j — 创建药品节点
    java计算机毕业设计医药垃圾分类管理系统源程序+mysql+系统+lw文档+远程调试
    APP自动化测试,Appium+PO模式+Pytest框架实战—项目案例
    C# 自定义控件库之Lable组合控件
    基于人工蜂群算法的线性规划求解matlab程序
    丝裂原活化蛋白激酶TaMPK3抑制植物对ABA的反应
    Git的安装
    【教3妹学编程-java基础6】详解父子类变量、代码块、构造函数执行顺序
  • 原文地址:https://blog.csdn.net/m0_66863468/article/details/125632926