current position:Home>Java project: hospital reservation and registration system (java + springboot + jsp + Maven + layui + MySQL)
Java project: hospital reservation and registration system (java + springboot + jsp + Maven + layui + MySQL)
2022-01-27 05:07:29 【qq_ one billion three hundred and thirty-four million six hundr】
One 、 Project brief
Features include :
Users are divided into patients , Doctor , Administrators , Patients can register and choose doctor registration , Select date , Source selection , Doctors can receive , Administrators can control users , Doctor information maintenance and other functions .
Two 、 Project operation
Environment configuration :
Jdk1.8 + Tomcat8.5 + mysql + Eclispe(IntelliJ IDEA,Eclispe,MyEclispe,Sts All support )
Project technology :
JSP +Spring + SpringBoot + MyBatis + html+ css + JavaScript + JQuery + Ajax + layui+ maven wait
Doctor business processing layer :
@Service
public class DoctorServiceImp implements DoctorService {
@Autowired
private DoctorMapper dm;
@Override
public int countByExample(DoctorExample example) {
return dm.countByExample(example);
}
@Override
public int deleteByPrimaryKey(Integer id) {
return dm.deleteByPrimaryKey(id);
}
@Override
public int insertSelective(Doctor record) {
// TODO Auto-generated method stub
return dm.insertSelective(record);
}
@Override
public List<Doctor> selectByExample(DoctorExample example) {
// TODO Auto-generated method stub
return dm.selectByExample(example);
}
@Override
public Doctor selectByPrimaryKey(Integer id) {
// TODO Auto-generated method stub
return dm.selectByPrimaryKey(id);
}
@Override
public int updateByPrimaryKeySelective(Doctor record) {
// TODO Auto-generated method stub
return dm.updateByPrimaryKeySelective(record);
}
@Override
public int updateByPrimaryKey(Doctor record) {
// TODO Auto-generated method stub
return dm.updateByPrimaryKey(record);
}
@Override
public List<Doctor> selectDoctor(Doctor doctor) {
DoctorExample se = new DoctorExample();
DoctorExample.Criteria criteria = se.createCriteria();
if(doctor != null){
if(doctor.getName() != null && !"".equals(doctor.getName())){
// Fuzzy query
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);
}
@Override
public PageInfo<Doctor> selectDoctorList(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())){
// Fuzzy query
criteria.andNameLike( "%" +doctor.getName() +"%");
}
}
se.setOrderByClause("id desc");
List<Doctor> shops = dm.selectByExample(se);
PageInfo<Doctor> pageinfo = new PageInfo<Doctor>(shops);
return pageinfo;
}
@Override
public List<Doctor> selectTime(Doctor doctor) {
// TODO Auto-generated method stub
return dm.selectTime(doctor);
}
}
Administrator business processing layer :
@Service
public class AdminServiceImp implements AdminService {
@Autowired
private AdminMapper am;
@Override
public int insertSelective(Admin record) {
// TODO Auto-generated method stub
return am.insertSelective(record);
}
@Override
public List<Admin> selectByExample(AdminExample example) {
// TODO Auto-generated method stub
return am.selectByExample(example);
}
@Override
public Admin selectByPrimaryKey(Integer id) {
// TODO Auto-generated method stub
return am.selectByPrimaryKey(id);
}
@Override
public int updateByPrimaryKeySelective(Admin record) {
// TODO Auto-generated method stub
return am.updateByPrimaryKeySelective(record);
}
@Override
public List<Admin> selectAdmin(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 control layer :
/**
* Login control layer
*/
@Controller
@RequestMapping("/login")
public class LoginController {
@Autowired
private AdminService adminService;
@Autowired
private DoctorService doctorService;
@Autowired
private SectionService sectionService;
@Autowired
private PatientService patientService;
@Value("${fileUrl}") // Get the save path of the file in the configuration file
private String filePath;
/**
* Background login interface
* @throws IOException
*/
@RequestMapping("/afterView")
public String afterLogin(Integer type,Model model) {
if(type == null) {
type = 1;
}
model.addAttribute("type",type);
return "login";
}
/**
* Background login interface
*/
@RequestMapping("/index")
public String index(Integer type,Model model) {
if(type == null){
type = 1;
}
model.addAttribute("type",type);
return "login";
}
/**
* Background login interface
*/
@RequestMapping("/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\\ Project picture \\1156.jpg_wh1200.jpg";
int indexOf = filename.indexOf(".");
String substring = filename.substring(indexOf);
System.out.println(substring);
}*/
/**
* Doctor picture upload
* @param mufile
* @param id
* @return
* @throws IOException
*/
@RequestMapping(value ="/zixunAdd")
@ResponseBody
public Map<String, Object> zixunAdd(@RequestParam("mf")MultipartFile mufile,@RequestParam("id")Integer id) throws IOException{
Map<String, Object> map = new HashMap<String, Object>();
String random = StringRandom.getRandom();
String filename = mufile.getOriginalFilename();
// Random character + The original picture name is used as the new picture name
filename = random+".jpg";
try {
// File save path D:/xxxx/xxxx/
File file = new File(filePath+filename);
// Determine whether the parent file exists
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 {
// Add image path
doctor.setImg("/files/"+filename);
doctorService.insertSelective(doctor);
System.out.println("id:"+doctor.getId());
map.put("id",doctor.getId());
}
return map;
}
/**
* Judge the administrator account
*/
@RequestMapping("/sectionxList")
@ResponseBody
public List<Section> sectionxList(Model model, Integer id) {
List<Section> selectByExample = null;
if(id != null) {
Section section = new Section();
section.setPid(id);
selectByExample = sectionService.selectByExample(section);
}
return selectByExample;
}
/**
* Judge the administrator account
*/
@RequestMapping("/mimaUpate")
@ResponseBody
public Map<String,String> passwordUpate(Model model, String zhanghao) {
Map<String, String> map = new HashMap<String, String>();
Admin ad = new Admin();
ad.setUsername(zhanghao);
List<Admin> selectAdmin = adminService.selectAdmin(ad);
if(selectAdmin.size() > 0){
map.put("pan","err");
}else{
map.put("pan","ok");
}
return map;
}
/**
* Judge the doctor's account number
*/
@RequestMapping("/panzhanghao")
@ResponseBody
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);
List<Doctor> selectByExample = doctorService.selectByExample(se);
if(selectByExample.size() > 0){
map.put("pan","err");
}else{
map.put("pan","ok");
}
return map;
}
/**
* The doctor added
* @param model
* @param zixun
* @return
*/
@RequestMapping("/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";
}
/**
* Administrator registration interface
*/
@RequestMapping("/mimaPageUptate")
public String mimaPageUptate(Integer type,Model model) {
//1 Doctor 2 Administrators
if(type == 1 ) {
return "doctorRegister";
}
return "adminRegister";
}
/**
* Doctor registration interface
*/
@RequestMapping("/doctorRegisterPage")
public String doctorRegister(Model model) {
List<Section> sectionlist2 = null;
Section se = new Section();
se.setType(1);
List<Section> sectionlist = sectionService.selectByExample(se);
if(sectionlist.size() > 0 ) {
// Department details
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";
}
/**
* Administrator registration
*/
@RequestMapping("/admin_Register")
public String admin_Register(Admin admin,Model model) {
int insertSelective = adminService.insertSelective(admin);
model.addAttribute("type",2);
return "login";
}
/**
* Login authentication
* @return
*/
@RequestMapping("/verificatio")
public String verificatio(String username, String password, Integer type, HttpServletRequest request,Model model) {
HttpSession session = request.getSession();
session.setAttribute("type",type);
// The type is 1 It's a hospital 2 It's the administrator
if(type == 1){
Doctor doctor = new Doctor();
doctor.setUsername(username);
doctor.setPasswoed(password);
List<Doctor> doctorlist = doctorService.selectDoctor(doctor);
if(doctorlist.size() <= 0){
model.addAttribute("message"," Wrong password ");
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);
List<Patient> list = patientService.selectPatient(patient);
if(list.size() <= 0) {
model.addAttribute("message"," Wrong password ");
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);
List<Admin> adminlist = adminService.selectAdmin(admin);
if(adminlist.size() <= 0){
model.addAttribute("message"," Wrong password ");
model.addAttribute("type",type);
return "login";
}
session.setAttribute("ADMIN",adminlist.get(0));
return "redirect:/admin/index";
}
/**
* Log out
* @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;
}
if(type == 3){
model.addAttribute("type",type);
session.invalidate(); //session The destruction
return "loginByPatient";
}
model.addAttribute("type",type);
session.invalidate(); //session The destruction
return "login";
}
/*
*//**
* Jump to the forget password interface
*//*
@RequestMapping("/mimaPageUptate")
public String passwordUpate() {
return "behind/merchant/mibaoUptate";
}
*//**
* Change Password
*//*
@RequestMapping("/mimaUpate")
@ResponseBody
public Map<String,String> passwordUpate(Model model, String mima, String mibao, String zhanghao) {
Map<String, String> map = new HashMap<String, String>();
Merchant me = new Merchant();
me.setZhanghao(zhanghao);
me.setMibao(mibao);
List<Merchant> list = 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;
}
*//**
* Background login interface
* @return
*//*
@RequestMapping("/afterView")
public String afterLogin(Integer type,Model model) {
if(type == null){
type = 1;
}
model.addAttribute("type",type);
return "behind/login";
}
*//**
* Login authentication
* @return
*//*
@RequestMapping("/verificatio")
public String signin(String username, String password, Integer type, HttpServletRequest request,Model model) {
HttpSession session = request.getSession();
session.setAttribute("type",type);
// The type is 1 It's the merchant backstage 2 It's the administrator
if(type == 1){
Merchant merchant = new Merchant();
merchant.setZhanghao(username);
merchant.setMima(password);
merchant.setState(1);
List<Merchant> merchants = merchantService.selectMerchant(merchant);
if(merchants.size() <= 0){
model.addAttribute("message"," Wrong password ");
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);
List<Admin> adminlist = adminService.selectAdmin(admin);
if(adminlist.size() <= 0){
model.addAttribute("message"," Wrong password ");
model.addAttribute("type",type);
return "behind/login";
}
session.setAttribute("ADMIN",adminlist.get(0));
return "redirect:/admin/index";
}
*//**
* Log out
* @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 The destruction
return "behind/login";
}
*//**
* The administrator changes the password interface
* @return
*//*
@RequestMapping("/adminUptatePage")
public String adminUptatePage(Model model) {
return "behind/admin/adminUptate";
}
*//**
* Merchant password modification interface
* @return
*//*
@RequestMapping("/merchantUptate")
public String merchantUptate(Model model) {
return "behind/merchant/merchantUptate";
}
*/
}
copyright notice
author[qq_ one billion three hundred and thirty-four million six hundr],Please bring the original link to reprint, thank you.
https://en.cdmana.com/2022/01/202201270507250897.html
The sidebar is recommended
- Spring IOC container loading process
- [thinking] the difference between singleton mode and static method - object-oriented programming
- Hadoop environment setup (MySQL environment configuration)
- 10 minutes, using node JS creates a real-time early warning system for bad weather!
- Git tool
- Force deduction algorithm - 92 Reverse linked list II
- What is the sub problem of dynamic programming?
- C / C + +: static keyword summary
- Idea does not have the artifacts option when configuring Tomcat
- Anaconda can't open it
guess what you like
-
I don't know how to start this
-
Matlab simulation of transportation optimization algorithm based on PSO
-
MySQL slow log optimization
-
[Vue] as the window is stretched (larger, smaller, wider and higher), the text will not be displayed
-
Popular Linux distributions for embedded computing
-
Suzhou computer research
-
After installing SSL Certificate in Windows + tomcat, the domain name request is not successful. Please answer!!
-
Implementation time output and greetings of jQuery instance
-
The 72 year old uncle became popular. Wu Jing and Guo fan made his story into a film, which made countless dreamers blush
-
How to save computer research
Random recommended
- Springboot implements excel import and export, which is easy to use, and poi can be thrown away
- The final examination subjects of a class are mathematical programming, and the scores are sorted and output from high to low
- Two pronged approach, Tsinghua Professor Pro code JDK and hotspot source code notes, one-time learning to understand
- C + + recursive knapsack problem
- The use of GIT and GitHub and the latest git tutorial are easy to understand -- Video notes of crazy God speaking
- PostgreSQL statement query
- Ignition database test
- Context didn't understand why he got a high salary?, Nginxfair principle
- Bootstrap switch switch control user's guide, springcloud actual combat video
- A list that contains only strings. What other search methods can be used except sequential search
- [matlab path planning] multi ant colony algorithm grid map path planning [including GUI source code 650]
- [matlab path planning] improved genetic algorithm grid map path planning [including source code phase 525]
- Iinternet network path management system
- Appium settings app is not running after 5000ms
- Reactnative foundation - 07 (background image, status bar, statusbar)
- Reactnative foundation - 04 (custom rpx)
- If you want an embedded database (H2, hsql or Derby), please put it on the classpath
- When using stm32g070 Hal library, if you want to write to flash, you must perform an erase. If you don't let it, you can't write continuously.
- Linux checks where the software is installed and what files are installed
- SQL statement fuzzy query and time interval filtering
- 69. Sqrt (x) (c + + problem solving version with vs runnable source program)
- Fresh students are about to graduate. Do you choose Java development or big data?
- Java project: OA management system (java + SSM + bootstrap + MySQL + JSP)
- Titanic passenger survival prediction
- Vectorization of deep learning formula
- Configuration and use of private image warehouse of microservice architect docker
- Relearn JavaScript events
- For someone, delete return 1 and return 0
- How does Java dynamically obtain what type of data is passed? It is used to judge whether the data is the same, dynamic data type
- How does the database cow optimize SQL?
- [data structure] chain structure of binary tree (pre order traversal) (middle order traversal) (post order traversal) (sequence traversal)
- Webpack packaging optimization solution
- 5. Operation element
- Detailed explanation of red and black trees
- redhat7. 9 install database 19C
- Blue Bridge Cup notes: (the given elements are not repeated) complete arrangement (arrangement cannot be repeated, arrangement can be repeated)
- Detailed explanation of springboot default package scanning mechanism and @ componentscan specified scanning path
- How to solve the run-time exception of test times
- Detailed explanation of k8s management tool kubectl
- Android system view memory command