• Java项目:基于JSP的养老院管理系统


    作者主页:夜未央5788

     简介: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项目: 否;查看源码目录中是否包含pom.xml;若包含,则为maven项目,否则为非maven项目

    技术栈

    1. 后端:servlet

    2. 前端:JSP+css+javascript+bootstrap+jQuery

    使用说明

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

    护工账号密码:111/111

    运行截图

    管理员角色

     

     

     

     

     

     

    护工角色 

     

     

     

     

     

    相关代码 

    ComServlet

    1. package com.action;
    2. import java.io.IOException;
    3. import java.text.SimpleDateFormat;
    4. import java.util.Calendar;
    5. import java.util.List;
    6. import javax.servlet.ServletException;
    7. import javax.servlet.http.HttpServlet;
    8. import javax.servlet.http.HttpServletRequest;
    9. import javax.servlet.http.HttpServletResponse;
    10. import javax.servlet.http.HttpSession;
    11. import com.bean.ComBean;
    12. import com.util.Constant;
    13. public class ComServlet extends HttpServlet {
    14. /**
    15. * Constructor of the object.
    16. */
    17. public ComServlet() {
    18. super();
    19. }
    20. /**
    21. * Destruction of the servlet.
    22. */
    23. public void destroy() {
    24. super.destroy(); // Just puts "destroy" string in log
    25. // Put your code here
    26. }
    27. /**
    28. * The doGet method of the servlet.
    29. *
    30. * This method is called when a form has its tag value method equals to get.
    31. *
    32. * @param request the request send by the client to the server
    33. * @param response the response send by the server to the client
    34. * @throws ServletException if an error occurred
    35. * @throws IOException if an error occurred
    36. */
    37. public void doGet(HttpServletRequest request, HttpServletResponse response)
    38. throws ServletException, IOException {
    39. doPost(request,response);
    40. }
    41. /**
    42. * The doPost method of the servlet.
    43. *
    44. * This method is called when a form has its tag value method equals to post.
    45. *
    46. * @param request the request send by the client to the server
    47. * @param response the response send by the server to the client
    48. * @throws ServletException if an error occurred
    49. * @throws IOException if an error occurred
    50. */
    51. public void doPost(HttpServletRequest request, HttpServletResponse response)
    52. throws ServletException, IOException {
    53. response.setContentType(Constant.CONTENTTYPE);
    54. request.setCharacterEncoding(Constant.CHARACTERENCODING);
    55. HttpSession session = request.getSession();
    56. ComBean cBean = new ComBean();
    57. String date=new SimpleDateFormat("yyyy-MM-dd").format(Calendar.getInstance().getTime());
    58. String date2=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(Calendar.getInstance().getTime());
    59. String method = request.getParameter("method");
    60. if(method.equals("addlr")){ //ÀÏÈËÐÅÏ¢
    61. //String xm="";String xb="";String nl="";String st="";String hj="";String sfz="";String lxr="";
    62. //String dh="";String zz="";String cw="";String hg="";String rz="";String cy="";
    63. String xm = request.getParameter("xm");
    64. String xb = request.getParameter("xb");
    65. String nl = request.getParameter("nl");
    66. String st = request.getParameter("st");
    67. String hj = request.getParameter("hj");
    68. String sfz = request.getParameter("sfz");
    69. String lxr = request.getParameter("lxr");
    70. String dh = request.getParameter("dh");
    71. String zz = request.getParameter("zz");
    72. String cw = request.getParameter("cw");
    73. String hg = request.getParameter("hg");
    74. String rz = request.getParameter("rz");
    75. String cy = request.getParameter("cy");
    76. int flag = cBean.comUp("insert into lr(xm,xb,nl,st,hj,sfz,lxr,dh,zz,cw,hg,rz,cy) " +
    77. "values('"+xm+"','"+xb+"','"+nl+"','"+st+"','"+hj+"','"+sfz+"','"+lxr+"','"+dh+"','"+zz+"','"+cw+"','"+hg+"','"+rz+"','"+cy+"' )");
    78. if(flag == Constant.SUCCESS){
    79. request.setAttribute("message", "²Ù×÷³É¹¦£¡");
    80. request.getRequestDispatcher("admin/lr/index.jsp").forward(request, response);
    81. }
    82. else{
    83. request.setAttribute("message", "²Ù×÷ʧ°Ü£¡");
    84. request.getRequestDispatcher("admin/lr/index.jsp").forward(request, response);
    85. }
    86. }
    87. else if(method.equals("uplr")){ //ÐÞ¸ÄÀÏÈËÐÅÏ¢
    88. String id=request.getParameter("id");
    89. String xm = request.getParameter("xm");
    90. String xb = request.getParameter("xb");
    91. String nl = request.getParameter("nl");
    92. String st = request.getParameter("st");
    93. String hj = request.getParameter("hj");
    94. String sfz = request.getParameter("sfz");
    95. String lxr = request.getParameter("lxr");
    96. String dh = request.getParameter("dh");
    97. String zz = request.getParameter("zz");
    98. String cw = request.getParameter("cw");
    99. String hg = request.getParameter("hg");
    100. String rz = request.getParameter("rz");
    101. String cy = request.getParameter("cy");
    102. int flag = cBean.comUp("update lr set xm='"+xm+"',xb='"+xb+"',nl='"+nl+"',st='"+st+"',hj='"+hj+"',sfz='"+sfz+"'" +
    103. ",lxr='"+lxr+"',dh='"+dh+"',zz='"+zz+"',cw='"+cw+"',hg='"+hg+"',rz='"+rz+"',cy='"+cy+"' where id='"+id+"'");
    104. if(flag == Constant.SUCCESS){
    105. request.setAttribute("message", "²Ù×÷³É¹¦£¡");
    106. request.getRequestDispatcher("admin/lr/index.jsp").forward(request, response);
    107. }
    108. else{
    109. request.setAttribute("message", "²Ù×÷ʧ°Ü£¡");
    110. request.getRequestDispatcher("admin/lr/index.jsp").forward(request, response);
    111. }
    112. }
    113. else if(method.equals("dellr")){//ɾ³ýÀÏÈËÐÅÏ¢
    114. String id = request.getParameter("id");
    115. int flag = cBean.comUp("delete from lr where id='"+id+"'");
    116. if(flag == Constant.SUCCESS){
    117. request.setAttribute("message", "²Ù×÷³É¹¦£¡");
    118. request.getRequestDispatcher("admin/lr/index.jsp").forward(request, response);
    119. }
    120. else{
    121. request.setAttribute("message", "ϵͳά»¤ÖУ¬ÇëÉÔºóÔÙÊÔ£¡");
    122. request.getRequestDispatcher("admin/lr/index.jsp").forward(request, response);
    123. }
    124. }
    125. else if(method.equals("addsg")){ //ʹʼǼ
    126. String lr = request.getParameter("lr");
    127. String sj = request.getParameter("sj");
    128. String xx = request.getParameter("xx");
    129. int flag = cBean.comUp("insert into sg(lr,sj,xx) values('"+lr+"','"+sj+"','"+xx+"' )");
    130. if(flag == Constant.SUCCESS){
    131. request.setAttribute("message", "²Ù×÷³É¹¦£¡");
    132. request.getRequestDispatcher("admin/sg/index.jsp").forward(request, response);
    133. }
    134. else{
    135. request.setAttribute("message", "²Ù×÷ʧ°Ü£¡");
    136. request.getRequestDispatcher("admin/sg/index.jsp").forward(request, response);
    137. }
    138. }
    139. else if(method.equals("upsg")){ //ÐÞ¸ÄʹʼǼ
    140. String id=request.getParameter("id");
    141. String lr = request.getParameter("lr");
    142. String sj = request.getParameter("sj");
    143. String xx = request.getParameter("xx");
    144. int flag = cBean.comUp("update sg set lr='"+lr+"',sj='"+sj+"',xx='"+xx+"' where id='"+id+"'");
    145. if(flag == Constant.SUCCESS){
    146. request.setAttribute("message", "²Ù×÷³É¹¦£¡");
    147. request.getRequestDispatcher("admin/sg/index.jsp").forward(request, response);
    148. }
    149. else{
    150. request.setAttribute("message", "²Ù×÷ʧ°Ü£¡");
    151. request.getRequestDispatcher("admin/sg/index.jsp").forward(request, response);
    152. }
    153. }
    154. else if(method.equals("delsg")){//ɾ³ýʹʼǼ
    155. String id = request.getParameter("id");
    156. int flag = cBean.comUp("delete from sg where id='"+id+"'");
    157. if(flag == Constant.SUCCESS){
    158. request.setAttribute("message", "²Ù×÷³É¹¦£¡");
    159. request.getRequestDispatcher("admin/sg/index.jsp").forward(request, response);
    160. }
    161. else{
    162. request.setAttribute("message", "ϵͳά»¤ÖУ¬ÇëÉÔºóÔÙÊÔ£¡");
    163. request.getRequestDispatcher("admin/sg/index.jsp").forward(request, response);
    164. }
    165. }
    166. else if(method.equals("addqj")){ //Çë¼ÙÐÅÏ¢
    167. String lr = request.getParameter("lr");
    168. String sj = request.getParameter("sj");
    169. String xx = request.getParameter("xx");
    170. int flag = cBean.comUp("insert into qj(lr,sj,xx) values('"+lr+"','"+sj+"','"+xx+"' )");
    171. if(flag == Constant.SUCCESS){
    172. request.setAttribute("message", "²Ù×÷³É¹¦£¡");
    173. request.getRequestDispatcher("admin/qj/index.jsp").forward(request, response);
    174. }
    175. else{
    176. request.setAttribute("message", "²Ù×÷ʧ°Ü£¡");
    177. request.getRequestDispatcher("admin/qj/index.jsp").forward(request, response);
    178. }
    179. }
    180. else if(method.equals("upqj")){ //ÐÞ¸ÄÇë¼ÙÐÅÏ¢
    181. String id=request.getParameter("id");
    182. String lr = request.getParameter("lr");
    183. String sj = request.getParameter("sj");
    184. String xx = request.getParameter("xx");
    185. int flag = cBean.comUp("update qj set lr='"+lr+"',sj='"+sj+"',xx='"+xx+"' where id='"+id+"'");
    186. if(flag == Constant.SUCCESS){
    187. request.setAttribute("message", "²Ù×÷³É¹¦£¡");
    188. request.getRequestDispatcher("admin/qj/index.jsp").forward(request, response);
    189. }
    190. else{
    191. request.setAttribute("message", "²Ù×÷ʧ°Ü£¡");
    192. request.getRequestDispatcher("admin/qj/index.jsp").forward(request, response);
    193. }
    194. }
    195. else if(method.equals("delqj")){//ɾ³ýÇë¼ÙÐÅÏ¢
    196. String id = request.getParameter("id");
    197. int flag = cBean.comUp("delete from qj where id='"+id+"'");
    198. if(flag == Constant.SUCCESS){
    199. request.setAttribute("message", "²Ù×÷³É¹¦£¡");
    200. request.getRequestDispatcher("admin/qj/index.jsp").forward(request, response);
    201. }
    202. else{
    203. request.setAttribute("message", "ϵͳά»¤ÖУ¬ÇëÉÔºóÔÙÊÔ£¡");
    204. request.getRequestDispatcher("admin/qj/index.jsp").forward(request, response);
    205. }
    206. }
    207. else if(method.equals("upcw")){
    208. String id=request.getParameter("id");
    209. String cw = request.getParameter("cw");
    210. int flag = cBean.comUp("update lr set cw='"+cw+"' where id='"+id+"'");
    211. if(flag == Constant.SUCCESS){
    212. request.setAttribute("message", "²Ù×÷³É¹¦£¡");
    213. request.getRequestDispatcher("admin/cw/index.jsp").forward(request, response);
    214. }
    215. else{
    216. request.setAttribute("message", "²Ù×÷ʧ°Ü£¡");
    217. request.getRequestDispatcher("admin/cw/index.jsp").forward(request, response);
    218. }
    219. }
    220. else if(method.equals("addfy")){ //Èëס·ÑÓÃ
    221. String lr = request.getParameter("lr");
    222. String fy = request.getParameter("fy");
    223. String kc = request.getParameter("kc");
    224. String zt = request.getParameter("zt");
    225. String xx = request.getParameter("xx");
    226. float sji=Float.parseFloat(fy)-Float.parseFloat(kc);
    227. int flag = cBean.comUp("insert into fy(lr,fy,kc,zt,xx,sji) values('"+lr+"','"+fy+"','"+kc+"','"+zt+"','"+xx+"','"+sji+"' )");
    228. if(flag == Constant.SUCCESS){
    229. request.setAttribute("message", "²Ù×÷³É¹¦£¡");
    230. request.getRequestDispatcher("admin/fy/index.jsp").forward(request, response);
    231. }
    232. else{
    233. request.setAttribute("message", "²Ù×÷ʧ°Ü£¡");
    234. request.getRequestDispatcher("admin/fy/index.jsp").forward(request, response);
    235. }
    236. }
    237. else if(method.equals("upfy")){ //ÐÞ¸ÄÈëס·ÑÓÃ
    238. String id=request.getParameter("id");
    239. String lr = request.getParameter("lr");
    240. String fy = request.getParameter("fy");
    241. String kc = request.getParameter("kc");
    242. String zt = request.getParameter("zt");
    243. String xx = request.getParameter("xx");
    244. float sji=Float.parseFloat(fy)-Float.parseFloat(kc);
    245. int flag = cBean.comUp("update fy set lr='"+lr+"',fy='"+fy+"',kc='"+kc+"',zt='"+zt+"',xx='"+xx+"',sji='"+sji+"' where id='"+id+"'");
    246. if(flag == Constant.SUCCESS){
    247. request.setAttribute("message", "²Ù×÷³É¹¦£¡");
    248. request.getRequestDispatcher("admin/fy/index.jsp").forward(request, response);
    249. }
    250. else{
    251. request.setAttribute("message", "²Ù×÷ʧ°Ü£¡");
    252. request.getRequestDispatcher("admin/fy/index.jsp").forward(request, response);
    253. }
    254. }
    255. else if(method.equals("delfy")){//ɾ³ýÈëס·ÑÓÃ
    256. String id = request.getParameter("id");
    257. int flag = cBean.comUp("delete from fy where id='"+id+"'");
    258. if(flag == Constant.SUCCESS){
    259. request.setAttribute("message", "²Ù×÷³É¹¦£¡");
    260. request.getRequestDispatcher("admin/fy/index.jsp").forward(request, response);
    261. }
    262. else{
    263. request.setAttribute("message", "ϵͳά»¤ÖУ¬ÇëÉÔºóÔÙÊÔ£¡");
    264. request.getRequestDispatcher("admin/fy/index.jsp").forward(request, response);
    265. }
    266. }
    267. else if(method.equals("addxz")){ //Èëס·ÑÓÃ
    268. String lr = request.getParameter("lr");
    269. String fy = request.getParameter("fy");
    270. String kc = request.getParameter("kc");
    271. String zt = request.getParameter("zt");
    272. String xx = request.getParameter("xx");
    273. float sji=Float.parseFloat(fy)-Float.parseFloat(kc);
    274. int flag = cBean.comUp("insert into xz(lr,fy,kc,zt,xx,sji) values('"+lr+"','"+fy+"','"+kc+"','"+zt+"','"+xx+"','"+sji+"' )");
    275. if(flag == Constant.SUCCESS){
    276. request.setAttribute("message", "²Ù×÷³É¹¦£¡");
    277. request.getRequestDispatcher("admin/xz/index.jsp").forward(request, response);
    278. }
    279. else{
    280. request.setAttribute("message", "²Ù×÷ʧ°Ü£¡");
    281. request.getRequestDispatcher("admin/xz/index.jsp").forward(request, response);
    282. }
    283. }
    284. else if(method.equals("upxz")){ //ÐÞ¸ÄÈëס·ÑÓÃ
    285. String id=request.getParameter("id");
    286. String lr = request.getParameter("lr");
    287. String fy = request.getParameter("fy");
    288. String kc = request.getParameter("kc");
    289. String zt = request.getParameter("zt");
    290. String xx = request.getParameter("xx");
    291. float sji=Float.parseFloat(fy)-Float.parseFloat(kc);
    292. int flag = cBean.comUp("update xz set lr='"+lr+"',fy='"+fy+"',kc='"+kc+"',zt='"+zt+"',xx='"+xx+"',sji='"+sji+"' where id='"+id+"'");
    293. if(flag == Constant.SUCCESS){
    294. request.setAttribute("message", "²Ù×÷³É¹¦£¡");
    295. request.getRequestDispatcher("admin/xz/index.jsp").forward(request, response);
    296. }
    297. else{
    298. request.setAttribute("message", "²Ù×÷ʧ°Ü£¡");
    299. request.getRequestDispatcher("admin/xz/index.jsp").forward(request, response);
    300. }
    301. }
    302. else if(method.equals("delxz")){//ɾ³ýÈëס·ÑÓÃ
    303. String id = request.getParameter("id");
    304. int flag = cBean.comUp("delete from xz where id='"+id+"'");
    305. if(flag == Constant.SUCCESS){
    306. request.setAttribute("message", "²Ù×÷³É¹¦£¡");
    307. request.getRequestDispatcher("admin/xz/index.jsp").forward(request, response);
    308. }
    309. else{
    310. request.setAttribute("message", "ϵͳά»¤ÖУ¬ÇëÉÔºóÔÙÊÔ£¡");
    311. request.getRequestDispatcher("admin/xz/index.jsp").forward(request, response);
    312. }
    313. }
    314. else if(method.equals("addhgqj")){ //Çë¼ÙÐÅÏ¢
    315. String lr = request.getParameter("lr");
    316. String sj = request.getParameter("sj");
    317. String xx = request.getParameter("xx");
    318. int flag = cBean.comUp("insert into hgqj(lr,sj,xx) values('"+lr+"','"+sj+"','"+xx+"' )");
    319. if(flag == Constant.SUCCESS){
    320. request.setAttribute("message", "²Ù×÷³É¹¦£¡");
    321. request.getRequestDispatcher("admin/hgqj/index.jsp").forward(request, response);
    322. }
    323. else{
    324. request.setAttribute("message", "²Ù×÷ʧ°Ü£¡");
    325. request.getRequestDispatcher("admin/hgqj/index.jsp").forward(request, response);
    326. }
    327. }
    328. else if(method.equals("uphgqj")){ //ÐÞ¸ÄÇë¼ÙÐÅÏ¢
    329. String id=request.getParameter("id");
    330. String lr = request.getParameter("lr");
    331. String sj = request.getParameter("sj");
    332. String xx = request.getParameter("xx");
    333. int flag = cBean.comUp("update hgqj set lr='"+lr+"',sj='"+sj+"',xx='"+xx+"' where id='"+id+"'");
    334. if(flag == Constant.SUCCESS){
    335. request.setAttribute("message", "²Ù×÷³É¹¦£¡");
    336. request.getRequestDispatcher("admin/hgqj/index.jsp").forward(request, response);
    337. }
    338. else{
    339. request.setAttribute("message", "²Ù×÷ʧ°Ü£¡");
    340. request.getRequestDispatcher("admin/hgqj/index.jsp").forward(request, response);
    341. }
    342. }
    343. else if(method.equals("delhgqj")){//ɾ³ýÇë¼ÙÐÅÏ¢
    344. String id = request.getParameter("id");
    345. int flag = cBean.comUp("delete from hgqj where id='"+id+"'");
    346. if(flag == Constant.SUCCESS){
    347. request.setAttribute("message", "²Ù×÷³É¹¦£¡");
    348. request.getRequestDispatcher("admin/hgqj/index.jsp").forward(request, response);
    349. }
    350. else{
    351. request.setAttribute("message", "ϵͳά»¤ÖУ¬ÇëÉÔºóÔÙÊÔ£¡");
    352. request.getRequestDispatcher("admin/hgqj/index.jsp").forward(request, response);
    353. }
    354. }
    355. }
    356. /**
    357. * Initialization of the servlet.
    358. *
    359. * @throws ServletException if an error occure
    360. */
    361. public void init() throws ServletException {
    362. // Put your code here
    363. }
    364. }

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

  • 相关阅读:
    Centos7安装单机版Kafka
    怎么查看证书里是不是包含私钥和公钥
    Elasticsearch in 查询
    vue循环滚动字幕
    Threejs_02 父子位移+缩放改变
    ABP入门教程(六)ABP支持DataTable
    java计算机毕业设计疫情期间高校师生外出请假管理系统录屏源代码+系统+数据库+lw文档
    代码开源设计实现思路
    如何优化网站排名(百度SEO指南与优化布局方法)
    乐歌入选毕马威“第二届新国货50榜单”,用实力演绎国潮当自强
  • 原文地址:https://blog.csdn.net/hanyunlong1989/article/details/126899583