Java 實戰練手項目之醫院預約掛號系統的實現流程
一、項目簡述
功能: 用戶分為患者,醫生,管理員,患者可進行註冊選擇醫生 掛號,選擇日期,選擇號源,醫生可進行接診,管理員可 對用戶,醫生信息的維護等等功能。
二、項目運行
環境配置: Jdk1.8 + Tomcat8.5 + mysql + Eclispe (IntelliJ IDEA,Eclispe,MyEclispe,Sts 都支持)
項目技術: Jdbc+ Servlert + Jsp + css + JavaScript + JQuery + Ajax + Fileupload等等。
登錄攔截器代碼:
/** * 登錄攔截器 * @author Administrator * */ @Component public class LoginInterceptor implements HandlerInterceptor{ private Logger log = LoggerFactory.getLogger(LoginInterceptor.class); @Autowired private SiteConfig siteConfig; @Override public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler){ String requestURI = request.getRequestURI(); HttpSession session = request.getSession(); session.setAttribute(SessionConstant.SESSION_USER_AUTH_KEY, AppConfig.ORDER_AUTH); Object attribute = session.getAttribute(SessionConstant.SESSION_USER_LOGIN_KEY); if(attribute == null){ log.info("用戶還未登錄或者session失效,重定向到登錄頁面,當前URL=" + requestURI); //首先判斷是否是ajax請求 if(StringUtil.isAjax(request)){ //表示是ajax請求 try { response.setCharacterEncoding("UTF-8"); response.getWriter().write(JSON.toJSONString(CodeMsg.USER_SESSION_EXPIRED)); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } return false; } //說明是普通的請求,可直接重定向到登錄頁面 //用戶還未登錄或者session失效,重定向到登錄頁面 try { response.sendRedirect("/system/login"); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } return false; } log.info("該請求符合登錄要求,放行" + requestURI); if(!StringUtil.isAjax(request)){ //若不是ajax請求,則將菜單信息放入頁面模板變量 User user = (User)attribute; List<Menu> authorities = user.getRole().getAuthorities(); request.setAttribute("userTopMenus", MenuUtil.getTopMenus(authorities)); List<Menu> secondMenus = MenuUtil.getSecondMenus(user.getRole().getAuthorities()); request.setAttribute("userSecondMenus", secondMenus); request.setAttribute("userThirdMenus", MenuUtil.getChildren(MenuUtil.getMenuIdByUrl(requestURI,secondMenus),authorities)); request.setAttribute("siteName", siteConfig.getSiteName()); request.setAttribute("siteUrl", siteConfig.getSiteUrl()); } return true; } }
醫院預約掛號系統後臺管理頁面代碼:
<!DOCTYPE html> <html lang="zh"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"/> <title>${siteName!""}後臺管理系統主頁</title> <#include "../common/header.ftl"/> </head> <body> <div class="lyear-layout-web"> <!--左側導航--> <aside class="lyear-layout-sidebar"> <!-- logo --> <div id="logo" class="sidebar-header"> <a href="/system/index" rel="external nofollow" ><img src="/admin/images/logo-sidebar.png" title="${siteName!""}" alt="${siteName!""}"/></a> </div> <div class="lyear-layout-sidebar-scroll"> <#include "../common/left-menu.ftl"/> </div> </aside> <!--End 左側導航--> <#include "../common/header-menu.ftl"/> <!--頁面主要內容--> <main class="lyear-layout-content"> <div class="container-fluid"> <div class="row"> <div class="col-sm-6 col-lg-3"> <div class="card bg-primary"> <div class="card-body clearfix"> <div class="pull-right"> <p class="h6 text-white m-t-0">備份文件</p> <p class="h3 text-white m-b-0">${databaseBackupTotal!"0"}</p> </div> <div class="pull-left"><span class="img-avatar img-avatar-48 bg-translucent"><i class="mdi mdi-database fa-1-5x"></i></span></div> </div> </div> </div> <div class="col-sm-6 col-lg-3"> <div class="card bg-danger"> <div class="card-body clearfix"> <div class="pull-right"> <p class="h6 text-white m-t-0">用戶總數</p> <p class="h3 text-white m-b-0">${userTotal!"0"}</p> </div> <div class="pull-left"><span class="img-avatar img-avatar-48 bg-translucent"><i class="mdi mdi-account fa-1-5x"></i></span></div> </div> </div> </div> <div class="col-sm-6 col-lg-3"> <div class="card bg-success"> <div class="card-body clearfix"> <div class="pull-right"> <p class="h6 text-white m-t-0">當前在線用戶</p> <p class="h3 text-white m-b-0">${onlineUserTotal!"0"}</p> </div> <div class="pull-left"><span class="img-avatar img-avatar-48 bg-translucent"><i class="mdi mdi-account-multiple fa-1-5x"></i></span></div> </div> </div> </div> <div class="col-sm-6 col-lg-3"> <div class="card bg-purple"> <div class="card-body clearfix"> <div class="pull-right"> <p class="h6 text-white m-t-0">操作日志</p> <p class="h3 text-white m-b-0">${operatorLogTotal!"0"}條</p> </div> <div class="pull-left"> <span class="img-avatar img-avatar-48 bg-translucent"><i class="mdi mdi-keyboard-close fa-1-5x"></i></span> </div> </div> </div> </div> </div> <div class="row"> <div class="col-lg-12"> <div class="card"> <div class="card-toolbar clearfix"> <#include "../common/third-menu.ftl"/> </div> <div class="card-body"> <div class="table-responsive"> <table class="table table-bordered"> <thead> <tr> <th>醫生編號</th> <th>醫生名稱</th> <th>病人名稱</th> <th>所屬科室</th> <th>支付狀態</th> <th>出診狀態</th> </tr> </thead> <tbody> <#if orderReceivings?size gt 0> <#list orderReceivings as orderReceiving> <tr> <td style="vertical-align:middle;">${orderReceiving.doctor.doctorDno}</td> <td style="vertical-align:middle;">${orderReceiving.doctor.user.name}</td> <td style="vertical-align:middle;">${orderReceiving.orderRegistration.patient.user.name}</td> <td style="vertical-align:middle;">${orderReceiving.doctor.department.name}</td> <td style="vertical-align:middle;"> <#if orderReceiving.payStatus == 1> <font class="text-warning">未支付</font> <#else> <font class="text-success">已支付</font> </#if> </td> <td style="vertical-align:middle;"> <#if orderReceiving.status == 1> <font class="text-warning">未完成</font> <#else> <font class="text-success" id="tab1">已完成</font> </#if> </td> </tr> </#list> </#if> </tbody> </table> </div> </div> </div> </div> </div> </div> </main> <!--End 頁面主要內容--> </div> </div> <#include "../common/footer.ftl"/> <script type="text/javascript" src="/admin/js/perfect-scrollbar.min.js"></script> <script type="text/javascript" src="/admin/js/main.min.js"></script> <script type="text/javascript"> $(document).ready(function () { }); </script> </body> </html>
到此這篇關於Java 實戰練手項目之醫院預約掛號系統的實現流程的文章就介紹到這瞭,更多相關Java 醫院預約掛號系統內容請搜索WalkonNet以前的文章或繼續瀏覽下面的相關文章希望大傢以後多多支持WalkonNet!
推薦閱讀:
- vue+antd實現折疊與展開組件
- Python用HBuilder創建交流社區APP
- 微前端之Web組件自定義元素示例詳解
- Vue實現簡易記事本功能
- Web Components實現類Element UI中的Card卡片