Java醫(yī)院預(yù)約掛號(hào)系統(tǒng)
一、項(xiàng)目簡述
功能包括:
用戶分為患者,醫(yī)生,管理員,患者可進(jìn)行注冊選擇醫(yī)生掛號(hào),選擇日期,選擇號(hào)源,醫(yī)生可進(jìn)行接診,管理員可對(duì)用戶,醫(yī)生信息的維護(hù)等等功能。
二、項(xiàng)目運(yùn)行
環(huán)境配置:
Jdk1.8 + Tomcat8.5 + mysql + Eclispe(IntelliJ IDEA,Eclispe,MyEclispe,Sts都支持)
?
項(xiàng)目技術(shù):
JSP +Spring + SpringBoot + MyBatis + html+ css + JavaScript + JQuery + Ajax + layui+ maven等等
?


?
?
醫(yī)生業(yè)務(wù)處理層:
public class DoctorServiceImp implements DoctorService {private DoctorMapper dm;public int countByExample(DoctorExample example) {return dm.countByExample(example);}public int deleteByPrimaryKey(Integer id) {return dm.deleteByPrimaryKey(id);}public int insertSelective(Doctor record) {// TODO Auto-generated method stubreturn dm.insertSelective(record);}public ListselectByExample(DoctorExample example) {// TODO Auto-generated method stubreturn dm.selectByExample(example);}public Doctor selectByPrimaryKey(Integer id) {// TODO Auto-generated method stubreturn dm.selectByPrimaryKey(id);}public int updateByPrimaryKeySelective(Doctor record) {// TODO Auto-generated method stubreturn dm.updateByPrimaryKeySelective(record);}public int updateByPrimaryKey(Doctor record) {// TODO Auto-generated method stubreturn dm.updateByPrimaryKey(record);}public ListselectDoctor(Doctor doctor) {DoctorExample se = new DoctorExample();DoctorExample.Criteria criteria = se.createCriteria();if(doctor != null){if(doctor.getName() != null && !"".equals(doctor.getName())){//模糊查詢criteria.andNameLike( "%" +doctor.getName() +"%");}if(doctor.getUsername() != null){criteria.andUsernameEqualTo(doctor.getUsername());}if(doctor.getPasswoed() != null){criteria.andPasswoedEqualTo(doctor.getPasswoed());}if(doctor.getBegindate() != null) {criteria.andBegindateEqualTo(doctor.getBegindate());}if(doctor.getSid() != null) {criteria.andSidEqualTo(doctor.getSid());}}se.setOrderByClause("id desc");return dm.selectByExample(se);}public PageInfoselectDoctorList(Doctor doctor, Integer page, Integer size) {PageHelper.startPage(page,size);DoctorExample se = new DoctorExample();DoctorExample.Criteria criteria = se.createCriteria();if(doctor != null){if(doctor.getName() != null && !"".equals(doctor.getName())){//模糊查詢criteria.andNameLike( "%" +doctor.getName() +"%");}}se.setOrderByClause("id desc");Listshops = dm.selectByExample(se); PageInfopageinfo = new PageInfo (shops); return pageinfo;}public ListselectTime(Doctor doctor) {// TODO Auto-generated method stubreturn dm.selectTime(doctor);}}
管理員業(yè)務(wù)處理層:
public class AdminServiceImp implements AdminService {private AdminMapper am;public int insertSelective(Admin record) {// TODO Auto-generated method stubreturn am.insertSelective(record);}public ListselectByExample(AdminExample example) {// TODO Auto-generated method stubreturn am.selectByExample(example);}public Admin selectByPrimaryKey(Integer id) {// TODO Auto-generated method stubreturn am.selectByPrimaryKey(id);}public int updateByPrimaryKeySelective(Admin record) {// TODO Auto-generated method stubreturn am.updateByPrimaryKeySelective(record);}public ListselectAdmin(Admin admin) {AdminExample ae = new AdminExample();AdminExample.Criteria criteria = ae.createCriteria();if(admin.getUsername() != null){criteria.andUsernameEqualTo(admin.getUsername());}if(admin.getPassword() != null){criteria.andPasswordEqualTo(admin.getPassword());}return am.selectByExample(ae);}}
登錄控制層:
/*** 登錄控制層*/("/login")public class LoginController {private AdminService adminService;private DoctorService doctorService;private SectionService sectionService;private PatientService patientService;("${fileUrl}") //在配置文件中獲取文件的保存路徑private String filePath;/*** 后臺(tái)登陸界面* @throws IOException*/("/afterView")public String afterLogin(Integer type,Model model) {if(type == null) {type = 1;}model.addAttribute("type",type);return "login";}/*** 后臺(tái)登陸界面*/("/index")public String index(Integer type,Model model) {if(type == null){type = 1;}model.addAttribute("type",type);return "login";}/*** 后臺(tái)登陸界面*/("/font/index")public String fontIndex(Integer type,Model model) {if(type == null){type = 3;}model.addAttribute("type",type);return "loginByPatient";}/* public static void main(String[] args) {String filename ="C:\\Users\\Administrator\\Pictures\\項(xiàng)目圖片\\1156.jpg_wh1200.jpg";int indexOf = filename.indexOf(".");String substring = filename.substring(indexOf);System.out.println(substring);}*//*** 醫(yī)生圖片上傳* @param mufile* @param id* @return* @throws IOException*/(value ="/zixunAdd")public Map<String, Object> zixunAdd(("mf")MultipartFile mufile,("id")Integer id) throws IOException{Map<String, Object> map = new HashMap<String, Object>();String random = StringRandom.getRandom();String filename = mufile.getOriginalFilename();//隨機(jī)字符+原圖片名用作新的圖片名filename = random+".jpg";try {//文件保存路徑 D:/xxxx/xxxx/File file = new File(filePath+filename);//判斷父級(jí)文件是否存在if (!file.getParentFile().exists()) {file.getParentFile().mkdir();}mufile.transferTo(file);} catch (IllegalStateException | IOException e) {e.printStackTrace();}Doctor doctor = new Doctor();if(id != -1){doctor.setId(id);doctor.setImg("/files/"+filename);doctorService.updateByPrimaryKeySelective(doctor);}else {//添加圖片路徑doctor.setImg("/files/"+filename);doctorService.insertSelective(doctor);System.out.println("id:"+doctor.getId());map.put("id",doctor.getId());}return map;}/*** 判斷管理員賬號(hào)*/("/sectionxList")public ListsectionxList(Model model, Integer id) { ListselectByExample = null; if(id != null) {Section section = new Section();section.setPid(id);selectByExample = sectionService.selectByExample(section);}return selectByExample;}/*** 判斷管理員賬號(hào)*/("/mimaUpate")public Map<String,String> passwordUpate(Model model, String zhanghao) {Map<String, String> map = new HashMap<String, String>();Admin ad = new Admin();ad.setUsername(zhanghao);ListselectAdmin = adminService.selectAdmin(ad); if(selectAdmin.size() > 0){map.put("pan","err");}else{map.put("pan","ok");}return map;}/*** 判斷醫(yī)生賬號(hào)*/("/panzhanghao")public Map<String,String> panzhanghao(Model model, String zhanghao) {Map<String, String> map = new HashMap<String, String>();DoctorExample se = new DoctorExample();DoctorExample.Criteria criteria = se.createCriteria();criteria.andUsernameEqualTo(zhanghao);ListselectByExample = doctorService.selectByExample(se); if(selectByExample.size() > 0){map.put("pan","err");}else{map.put("pan","ok");}return map;}/*** 醫(yī)生添加* @param model* @param zixun* @return*/("/zixunInsert")public String zixunInsert(Model model,Doctor doctor){if(doctor.getId() != null){if(doctor.getSid() != null) {Section selectByPrimaryKey = sectionService.selectByPrimaryKey(doctor.getSid());doctor.setSname(selectByPrimaryKey.getName());}doctorService.updateByPrimaryKeySelective(doctor);}model.addAttribute("type",1);return "login";}/*** 管理員注冊界面*/("/mimaPageUptate")public String mimaPageUptate(Integer type,Model model) {//1醫(yī)生 2 管理員if(type == 1 ) {return "doctorRegister";}return "adminRegister";}/*** 醫(yī)生注冊界面*/("/doctorRegisterPage")public String doctorRegister(Model model) {Listsectionlist2 = null; Section se = new Section();se.setType(1);Listsectionlist = sectionService.selectByExample(se); if(sectionlist.size() > 0 ) {//科室詳情Section section = new Section();section.setPid(sectionlist.get(0).getId());section.setType(2);sectionlist2 = sectionService.selectByExample(section);}model.addAttribute("sectionlist", sectionlist);model.addAttribute("sectionlist2", sectionlist2);return "doctorRegister";}/*** 管理員注冊*/("/admin_Register")public String admin_Register(Admin admin,Model model) {int insertSelective = adminService.insertSelective(admin);model.addAttribute("type",2);return "login";}/*** 登陸驗(yàn)證* @return*/("/verificatio")public String verificatio(String username, String password, Integer type, HttpServletRequest request,Model model) {HttpSession session = request.getSession();session.setAttribute("type",type);//類型為1是醫(yī)院 2是管理員if(type == 1){Doctor doctor = new Doctor();doctor.setUsername(username);doctor.setPasswoed(password);Listdoctorlist = doctorService.selectDoctor(doctor); if(doctorlist.size() <= 0){model.addAttribute("message","密碼錯(cuò)誤");model.addAttribute("type",type);return "login";}session.setAttribute("DOCTOR",doctorlist.get(0));return "redirect:/doctor/index";}if(type == 3){Patient patient = new Patient();patient.setUsername(username);patient.setPassword(password);Listlist = patientService.selectPatient(patient); if(list.size() <= 0) {model.addAttribute("message","密碼錯(cuò)誤");model.addAttribute("type",type);return "loginByPatient";}session.setAttribute("PATIENT",list.get(0));return "redirect:/api/doctorList1";}Admin admin = new Admin();admin.setUsername(username);admin.setPassword(password);Listadminlist = adminService.selectAdmin(admin); if(adminlist.size() <= 0){model.addAttribute("message","密碼錯(cuò)誤");model.addAttribute("type",type);return "login";}session.setAttribute("ADMIN",adminlist.get(0));return "redirect:/admin/index";}/*** 退出登錄* @param request* @return*/("/sessionInvalidate")public String boot(HttpServletRequest request,Model model) {HttpSession session = request.getSession();Integer type = (Integer) session.getAttribute("type");if(type == null){type=1;}if(type == 3){model.addAttribute("type",type);session.invalidate(); //session銷毀return "loginByPatient";}model.addAttribute("type",type);session.invalidate(); //session銷毀return "login";}/**//*** 跳轉(zhuǎn)忘記密碼界面*//*@RequestMapping("/mimaPageUptate")public String passwordUpate() {return "behind/merchant/mibaoUptate";}*//*** 修改密碼*//*@RequestMapping("/mimaUpate")@ResponseBodypublic MappasswordUpate(Model model, String mima, String mibao, String zhanghao) { Mapmap = new HashMap (); Merchant me = new Merchant();me.setZhanghao(zhanghao);me.setMibao(mibao);Listlist = merchantService.selectMerchant(me); if(list.size() > 0){Merchant me2 = new Merchant();me2.setId(list.get(0).getId());me2.setMima(mima);merchantService.updateByPrimaryKeySelective(me2);map.put("pan","ok");}else{map.put("pan","err");}return map;}*//*** 后臺(tái)登陸界面* @return*//*@RequestMapping("/afterView")public String afterLogin(Integer type,Model model) {if(type == null){type = 1;}model.addAttribute("type",type);return "behind/login";}*//*** 登陸驗(yàn)證* @return*//*@RequestMapping("/verificatio")public String signin(String username, String password, Integer type, HttpServletRequest request,Model model) {HttpSession session = request.getSession();session.setAttribute("type",type);//類型為1是商戶后臺(tái) 2是管理員if(type == 1){Merchant merchant = new Merchant();merchant.setZhanghao(username);merchant.setMima(password);merchant.setState(1);Listmerchants = merchantService.selectMerchant(merchant); if(merchants.size() <= 0){model.addAttribute("message","密碼錯(cuò)誤");model.addAttribute("type",type);return "behind/login";}session.setAttribute("MERCHANT",merchants.get(0));return "redirect:/merchant/index";}Admin admin = new Admin();admin.setUsername(username);admin.setPassword(password);Listadminlist = adminService.selectAdmin(admin); if(adminlist.size() <= 0){model.addAttribute("message","密碼錯(cuò)誤");model.addAttribute("type",type);return "behind/login";}session.setAttribute("ADMIN",adminlist.get(0));return "redirect:/admin/index";}*//*** 退出登錄* @param request* @return*//*@RequestMapping("/sessionInvalidate")public String boot(HttpServletRequest request,Model model) {HttpSession session = request.getSession();Integer type = (Integer) session.getAttribute("type");if(type == null){type=1;}model.addAttribute("type",type);session.invalidate(); //session銷毀return "behind/login";}*//*** 管理員修改密碼界面* @return*//*@RequestMapping("/adminUptatePage")public String adminUptatePage(Model model) {return "behind/admin/adminUptate";}*//*** 商戶修改密碼界面* @return*//*@RequestMapping("/merchantUptate")public String merchantUptate(Model model) {return "behind/merchant/merchantUptate";}*/}
PS:如果覺得我的分享不錯(cuò),歡迎大家隨手點(diǎn)贊、在看。
評(píng)論
圖片
表情
