java实战之医院管理系统的实现-mile米乐体育

目录

  • 项目介绍
  • 环境需要
  • 技术栈
  • 使用说明
  • 效果图展示
  • 核心代码
    • 用户管理控制层
    • 医生管理控制层
    • 病房管理控制层

项目介绍

医院管理系统,分为管理员、医生、病人三种角色;

管理员主要功能包括:

mile米乐体育首页、系统管理:医生管理、患者管理、药品管理;预约管理;病史管理;住院信息管理;管理员用户管理;

医生主要功能包括:mile米乐体育首页、就医/查看病史;

病人主要功能包括:mile米乐体育首页、病史、住院信息、挂号;

环境需要

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. 后端:springboot

2. 前端:layui freemaker

使用说明

1. 使用navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件;

2. 使用idea/eclipse/myeclipse导入项目,eclipse/myeclipse导入时,若为maven项目请选择maven;

若为maven项目,导入成功后请执行maven clean;maven install命令

3. 将项目中application.yml配置文件中的数据库配置改为自己的配置,配置tomcat,然后运行;

4. 运行项目,输入http://localhost:8088 登录

效果图展示

核心代码

用户管理控制层

@restcontroller @requestmapping(value = "/user") @api(tags = "用户管理api") public class usercontroller { @autowired private iuserservice iuserservice; /** * 登录验证 * * @param reqvo * @param model * @return */ @requestmapping(value = "/dologin", method = requestmethod.post) public baseresponse dologin(@requestbody @validated userloginreqvo reqvo, model model) { return iuserservice.dologin(reqvo); } /** * 保存用户注册信息,向用户发送激活链接 * * @param reqvo * @return */ @requestmapping(value = "/doregister", method = requestmethod.post) public baseresponse registered(@requestbody @validated userregisterreqvo reqvo, model model) { return iuserservice.saveuserandsendemail(reqvo); } /** * 获取登录日志 * * @param reqvo * @return */ @requestmapping(value = "/getloginfor",method = requestmethod.get) public pagerspvo getloginfor(basepagereqvo reqvo) { return iuserservice.getloginfor(reqvo); } /** * 修改密码 * * @param reqvo * @return */ @postmapping(value = "/changepassword") public baseresponse changepassword(@requestbody @validated changepasswordreqvo reqvo) { return iuserservice.changepassword(reqvo); } /** * 个人资料设置 * * @return */ @postmapping(value = "/getuserinfo") public list getuserinfo() { return iuserservice.getuserinfo(); } @postmapping(value = "/changeuserinfo") public baseresponse changeuserinfo(@requestbody @validated userinfovo reqvo) { return iuserservice.changeuserinfo(reqvo); } @postmapping(value = "/getanncontent") public annrspvo getanncontent(@requestparam string id) { return iuserservice.getanncontent(id); } @postmappi恰卡编程网ng(value = "/addanotherrole") public baseresponse addanotherrole(@requestbody @validated accountrolevo reqvo) { return iuserservice.addanotherrole(reqvo); } /** * 获取所有角色 * @param * @return */ @postmapping(value = "/getallrole") public list getallrole() { return iuserservice.getallrole(); } }

@controller public class deptcontroller { @autowired private deptservice deptservice; /** * 分页查询 */ @requestmapping("/finddept") public string finddept(string deptno, string deptname,integer pageindex , integer pagesize, model model,httpsession session){ pageinfo de = deptservice.findpageinfo(deptno,deptname, pageindex,pagesize); model.addattribute("de",de); session.setattribute("u",deptno); session.setattribute("t",deptname); return "dept_list"; } /** * 添加管理员信息 */ @requestmapping(value = "/adddept" ,method = requestmethod.post) @responsebody public string adddept(@requestbody dept dept) { int a = deptservice.adddept(dept); return "dept_list"; } /** * 修改信息 */ @requestmapping( value = "/updatedept", method = requestmethod.post) public string updatedept(dept dept) { int a = deptservice.updatedept(dept); return "redirect:/finddept"; } /** * 根据id搜索; */ @requestmapping("/finddeptbyid") public string finddeptbyid(integer deptid, httpsession session) { dept de2= deptservice.finddeptbyid(deptid); session.setattribute("de2",de2); return "dept_edit"; } /** * 导出excel */ @requestmapping(value = "/exportdeptlist" , method = requestmethod.post) @responsebody public list exportdept(){ list depts = deptservice.getall(); return depts; } /** * 部门人员信息查询 */ @requestmapping(value = "/finddeptpersonnel") public string findclassstudent(dept dept,model model, httpsession session) { list dep = deptservice.finddeptpersonnel(dept); model.addattribute("dep",dep); return "dept_personnellist"; } }

医生管理控制层

/** * 医生管理控制层 */ @controller @requestmapping("/doctor") public class doctorcontroller { @autowired private doctorservice doctorservice; @autowired private userservice userservice; @autowired private roleservice roleservice; @autowired private operaterlogservice operaterlogservice; @autowired private departmentservice departmentservice; @autowired private orderreceivingservice orderreceivingservice; @autowired private bedallotservice bedallotservice; /** * 跳转医生列表页面 * @param model * @param doctor * @param pagebean * @return */ @requestmapping(value = "/list") public string list(model model, doctor doctor, pagebean pagebean) { model.addattribute("title", "医生列表"); if (doctor.getuser() != null) { model.addattribute("name", doctor.getuser().getname()); } model.addattribute("pagebean", doctorservice.findlist(doctor, pagebean)); return "admin/doctor/list"; } /** * 医生添加页面 * @param model * @return */ @requestmapping(value = "/add", method = requestmethod.get) public string add(model model) { model.addattribute("departments", departmentservice.findalldepartment()); return "admin/doctor/add"; } /** * 医生添加提交 * @param doctor * @return */ @requestmapping(value = "/add", method = requestmethod.post) @responsebody public result add(doctor doctor) { codemsg validate = validateentityutil.validate(doctor); if (validate.getcode() != codemsg.success.getcode()) { return result.error(validate); } if(objects.isnull(doctor.getuser().getemail())){ return result.error(codemsg.admin_public_no_isexist_email); } if(objects.isnull(doctor.getuser().getmobile())){ return result.error(codemsg.admin_public_no_isexist_mobile); } if (!stringutil.emailformat(doctor.getuser().getemail())) { return result.error(codemsg.admin_public_email); } if (!stringutil.ismobile(doctor.getuser().getmobile())) { return result.error(codemsg.admin_public_mobile); } role role = roleservice.find(doctor.doctor_role_id); string dno = stringutil.generatesn(doctor.patient_role_dno); int age = dateutil.getage(doctor.getuser().getbirthday()); if (age < 0) { return result.error(codemsg.admin_public_age); } doctor.setdoctordno(dno); doctor.getuser().setpassword(dno); doctor.getuser().setusername(dno); doctor.getuser().setrole(role); user user = doctor.getuser(); user.setage(age); user save = userservice.save(user); if (userservice.save(user) == null) { return result.error(codemsg.admin_use_add_error); } operaterlogservice.add("添加用户,用户名:" user.getusername()); doctor.setuser(save); if (doctorservice.save(doctor) == null) { return result.error(codemsg.admin_doctor_add_exist); } return result.success(true); } /** * 医生修改页面 * @param model * @param id * @return */ @requestmapping(value = "/edit", method = requestmethod.get) public string edit(model model, @requestparam(name = "id") long id) { model.addattribute("doctor", doctorservice.find(id)); model.addattribute("departments", departmentservice.findalldepartment()); return "admin/doctor/edit"; } /** * 医生修改提交 * @param doctor * @return */ @requestmapping(value = "/edit", method = requestmethod.post) @responsebody public result edit(doctor doctor) { doctor finddowww.cppcns.comctor = doctorservice.find(doctor.getid()); list doctors = doctorservice.findbydoctordno(finddoctor.getdoctordno()); if (doctors.size() > 1 || doctors.size() <= 0) { return result.error(codemsg.admin_patient_pno_error); } if (doctors.get(0).getid() != doctor.getid()) { return result.error(codemsg.admin_patient_pno_error); } if(objects.isnull(doctor.getuser().getemail())){ return result.error(codemsg.admin_public_no_isexist_email); } if(objects.isnull(doctor.getuser().getmobile())){ return result.error(codemsg.admin_public_no_isexist_mobile); } if (!stringutil.emailformat(doctor.getuser().getemail())) { return result.error(codemsg.admin_public_email); } if (!stringutil.ismobile(doctor.getuser().getmobile())) { return result.error(codemsg.admin_public_mobile); } int age = dateutil.getage(doctor.getuser().getbirthday()); if (age < 0) { return result.error(codemsg.admin_public_age); } finddoctor.setdepartment(doctor.getdepartment()); finddoctor.setdescription(doctor.getdescription()); finddoctor.setexperience(doctor.getexperience()); user user = doctorgvfpmjasgk.getuser(); user.setage(age); beanutils.copyproperties(user, finddoctor.getuser(), "id", "createtime", "updatetime", "password", "username", "role"); userservice.save(finddoctor.getuser()); doctorservice.save(finddoctor); return result.success(true); } /** * 删除医生用户 * @param id * @return */ @requestmapping(value = "/delete", method = requestmethod.post) @responsebody public result delete(@requestparam(name = "id", required = true) long id) { try { doctor doctor = doctorservice.find(id); doctorservice.deletebyid(id); userservice.delete(doctor.getuser().getid()); } catch (exception e) { return result.error(codemsg.admin_doctor_delete_error); } operaterlogservice.add("添加用户,用户id:" id); return result.success(true); } /** * 修改个人出诊状态页面 * @param model * @return */ @requestmapping(value = "/updatestatus", method = requestmethod.get) public string updatedoctorstatus(model model) { doctor doctor = doctorservice.findbylogindoctoruser(); model.addattribute("title","个人出诊信息修改"); model.addattribute("doctor", doctor); return "admin/doctor/visitingstatus"; } /** * 提交修改个人出诊状态 * @param doctor * @return */ @requestmapping(value = "/updatestatus", method = requestmethod.post) @responsebody public result editstatus(doctor doctor) { doctor doc = doctorservice.findbylogindoctoruser(); if(objects.isnull(doctor.getuser().getemail())){ return result.error(codemsg.admin_public_no_isexist_email); } if(objects.isnull(doctor.getuser().getmobile())){ return result.error(codemsg.admin_public_no_isexist_mobile); } if (!stringutil.ismobile(doctor.getuser().getmobile())) { return result.error(codemsg.admin_public_mobile); } if (!stringutil.emailformat(doctor.getuser().getemail())) { return result.error(codemsg.admin_public_email); } user user = doc.getuser(); user.setemail(doctor.getuser().getemail()); user.setmobile(doctor.getuser().getmobile()); user.setstatus(doctor.getstatus()); doc.setstatus(doctor.getstatus()); doc.setdescription(doctor.getdescription()); doc.setexperience(doctor.getexperience()); beanutils.copyproperties(user, doctor.getuser(), "id", "createtime", "updatetime", "password", "username", "role", "sex", "age", "birthday"); doctorservice.save(doc); return result.success(true); } /** * 医生查询接单记录 * @param model * @param pagebean * @return */ @requestmapping(value = "/orderrecord",method = requestmethod.get) public string doctororderrecords(model model, pagebean pagebean) { //获取医生登录的信息 doctor logindoctoruser = doc恰卡编程网torservice.findbylogindoctoruser(); model.addattribute("title", "出诊信息"); model.addattribute("pagebean", orderreceivingservice.findbydoctorid(pagebean,logindoctoruser.getid())); return "admin/doctor/orderrecord"; } /** * 查看自己科室所有医生信息 * @param model * @param pagebean * @return */ @requestmapping(value = "/findbydepartment", method = requestmethod.get) public string alldoctorbydepartment(model model,pagebean pagebean) { doctor logindoctoruser = doctorservice.findbylogindoctoruser(); model.addattribute("title", "本科室所有医生列表"); model.addattribute("pagebean", doctorservice.findallbydepartment(pagebean, logindoctoruser.getdepartment().getid())); return "admin/doctor/doctorinformation"; } /** * 医生完成出诊订单 * @param id * @return */ @requestmapping(value = "/orderrecord",method = requestmethod.post) @responsebody public resultmodifyvisitstatus(long id){ boolean flag = doctorservice.modifyvisitstatus(id); if (flag){ return result.success(true); } return result.error(codemsg.admin_doctor_cannot_repeated); } /** * 管理员查看所有订单信息 * @param model * @param orderreceiving * @param pagebean * @return */ @requestmapping(value="/allorderinformation",method = requestmethod.get) public string findall(model model,orderreceiving orderreceiving, pagebean pagebean){ model.addattribute("title","出诊信息"); model.addattribute("pagebean",orderreceivingservice.findlist(orderreceiving,pagebean)); return "admin/doctor/allorderinformation"; } /** * 医生查询负责的住院信息 */ @requestmapping(value="/bedallot") public string bedallotself(model model,pagebean pagebean){ doctor logindoctoruser = doctorservice.findbylogindoctoruser(); long doctorid = logindoctoruser.getid(); model.addattribute("title","住院信息"); model.addattribute("pagebean",bedallotservice.findbydoctor(pagebean,doctorid)); return "admin/doctor/bedallot"; } }

病房管理控制层

/*** * 病房管理控制层 */ @controller @requestmapping("/room") public class roomcontroller { @autowired private roomservice roomservice; @autowired private operaterlogservice operaterlogservice; @autowired private bedservice bedservice; @autowired private roomtypeservice roomtypeservice; /*** * 病房分页查询 * @param model * @param pagebean * @param room * @return */ @requestmapping("/list") string list(model model, pagebean pagebean, room room){ model.addattribute("title","病房列表"); model.addattribute("roomno", room.getroomno()); model.addattribute("pagebean",roomservice.findall(room,pagebean)); return "admin/room/list"; } /** * 新增病房页面 * @param model * @return */ @requestmapping(value="/add") public string add(model model){ model.addattribute("roomtype",roomtypeservice.findlist()); return "admin/room/add"; } /** * 病房添加表单提交处理 * @param room * @return */ @requestmapping(value="/add",method= requestmethod.post) @responsebody public result add(room room){ //用统一验证实体方法验证是否合法 codemsg validate = validateentityutil.validate(room); if(validate.getcode() != codemsg.success.getcode()){ return result.error(validate); } //设置可用床数 int total = room.gettotal(); room.setusable(total); if(objects.isnull(room.getroomno())){ return result.error(codemsg.admin_room_no_isexist); } if(roomservice.isexistroomno(room.getroomno(),0l)){ return result.error(codemsg.admin_room_exist); } //到这说明一切符合条件,进行数据库新增 if(roomservice.save(room) == null){ return result.error(codemsg.admin_room_add_error); } /* //判断是否床位存在 if(bedservice.find(room.getid())!=null){ return result.error(codemsg.admin_bed_exist); }*/ //循环total向床位表添加相应床位 for (int i = 0 ;i edit(room room){ //用统一验证实体方法验证是否合法 codemsg validate = validateentityutil.validate(room); if(validate.getcode() != codemsg.success.getcode()){ return result.error(validate); } if(room.getid() == null || room.getid().longvalue() <= 0){ return result.error(codemsg.admin_room_no_exist); } if(roomservice.isexistroomno(room.getroomno(),room.getid())){ return result.error(codemsg.admin_room_exist); } //到这说明一切符合条件,进行数据库保存 room findbyid = roomservice.find(room.getid()); //将提交的科室信息指定字段复制到已存在的roomtype对象中,该方法会覆盖新字段内容 beanutils.copyproperties(room, findbyid, "id","createtime","updatetime","total","usable"); if(roomservice.save(findbyid) == null){ return result.error(codemsg.admin_room_edit_error); } operaterlogservice.add("编辑病房,病房号:" room.getroomno()); return result.success(true); }*/ /** * 删除病房 * @param id * @return */ @requestmapping(value="/delete",method=requestmethod.post) @responsebody public result delete(@requestparam(name="id",required=true)long id){ try { roomservice.delete(id); } catch (exception e) { return result.error(codemsg.admin_room_delete_error); } operaterlogservice.add("删除病房,病房id:" id); return result.success(true); } }

以上就是java实战之医院管理系统的实现的详细内容,更多关于java医院管理系统的资料请关注mile米乐体育其它相关文章!

展开全文
内容来源于互联网和用户投稿,文章中一旦含有米乐app官网登录的联系方式务必识别真假,本站仅做信息展示不承担任何相关责任,如有侵权或涉及法律问题请联系米乐app官网登录删除

最新文章

网站地图