[Java Complete Design] Realizing the New Crown Epidemic Statistics System Based on SpringBoot (Idea+Navicat)

insert image description here

Recommended study column:


insert image description here

foreword

The epidemic has been repeated in our lives. In order to facilitate us to understand the data of the new crown epidemic more intuitively, the epidemic information can be counted through Java programming for better control. This article will share with you a new crown epidemic statistics system based on SpringBoot. This article is also suitable for graduation design of computer science majors, and also meets the needs of the current society. (Source code attached at the end of the article)



注:系统使用步骤可直接跳到【系统部署】

1. System functions

Function introduction : There are user management, new crown symptom management, new crown epidemic prevention management, epidemic data management, administrator management, system management and other functions

①System home page

Realized dynamic graphs and pie charts to record daily changes in the number of epidemic personnel
insert image description here

②Punch function

This function realizes the user's daily check-in, and can realize the addition, deletion, modification, and query of user information and status, which is convenient for the management of the unit.
insert image description hereHere is the punch list
insert image description here

③User Management

This function realizes the information management of using this system, checks user information and adds administrators

insert image description here

④ Epidemic information

There are three functions - vaccination, nucleic acid detection, and epidemic prevention materials
insert image description here

  • Vaccination : Recommended vaccination points based on location, and instructions for vaccination instructions
    insert image description here

  • Nucleic acid detection : introduce relevant knowledge of nucleic acid and nucleic acid detection, so that users have a clearer understanding of nucleic acid detection
    insert image description here

  • Epidemic prevention materials : make detailed science popularization of epidemic prevention knowledge
    insert image description here

⑤ Epidemic personnel

Realized the management of the epidemic personnel. Realize the addition, deletion, modification, and checking of information on close contacts, confirmed cases, cured cases, and deaths
insert image description here

2. System deployment

Partners who need the source code of the project can download it at the end of the article , and here is a demonstration of the entire implementation steps

① Create a database

Open Navicat ( Navicat的安装you can private message if you need to activate it ), then right-click the local point 打开连接, copy the file name in the resource package, that is coronavirus, right-click the local point again 新建数据库to create a database.
insert image description hereinsert image description here
Then double-click to select the newly created database, right-
insert image description here
click to run the SQL file, click Start to run, wait for the data to be imported, then select the database, press F5 to refresh, and all the database tables in this project will be imported successfully Next,
insert image description here
start running the code

②Run the code

Find the source code in the data folder, drag the project coronavirusnamed into IDEA , and wait for the project to load its dependent jar package. After loading, there are two places that need to be modified. The specific modification content is shown in the figure.
insert image description here

After modifying, find the startup class, right-click to run (run) to run,
insert image description here
you can see that there is no error and it is OK
insert image description here

③Open the browser

The last step is to open the browser and enter the access path in the search box localhost:8083. If there is no error, you can enter the main page of the system.
insert image description here

3. System use

You need to log in to use the system, just click on the homepage option to enter the login page.
insert image description here
The account number and password can be found in the database user, select the first one, and the account number and password are both. admin
insert image description here
The function of the system refers to the previous article

4. Code display

  • CheckOutController
@Controller
public class CheckOutController {
    
    
    @Autowired
    CheckOutService checkOutService;

    //打卡
    @RequestMapping(value = "/checkOut/toAdd")
    public String toAdd() {
    
    
        return "checkOutAdd";
    }

    //打卡
    @RequestMapping(value = "/checkOut/add", method = RequestMethod.POST)
    public String addCheckOut(@RequestParam("currentPosition") String currentPosition, @RequestParam("bodyTemperature") Double bodyTemperature,
                             @RequestParam("healthState") String healthState, @RequestParam("isToHighArea") String isToHighArea,
                             @RequestParam("isTouch") String isTouch, @RequestParam("remarks") String remarks,
                              @RequestParam("name") String name, @RequestParam("checkOutDate") Date checkOutDate) {
    
    
        CheckOut checkOut = new CheckOut().setCurrentPosition(currentPosition).setBodyTemperature(bodyTemperature)
                .setHealthState(healthState).setIsToHighArea(isToHighArea).setIsTouch(isTouch)
                .setRemarks(remarks).setName(name).setCheckOutDate(checkOutDate);
        checkOutService.add(checkOut);
        return "redirect:/checkOut/list";
    }

    @InitBinder
    public void initBinder(WebDataBinder binder, WebRequest request) {
    
    
        //转换日期 注意这里的转化要和传进来的字符串的格式一直 如2015-9-9 就应该为yyyy-MM-dd
        DateFormat dateFormat=new SimpleDateFormat("yyyy-MM-dd");
        binder.registerCustomEditor(Date.class, new CustomDateEditor(dateFormat, true));// CustomDateEditor为自定义日期编辑器
    }

    @RequestMapping(value = "/checkOut/list", method = RequestMethod.GET)
    public String list(Model model, @RequestParam(name="page",required = true,defaultValue = "1")int page, @RequestParam(name="size",required=true,defaultValue = "25")int size){
    
    
        java.util.List<CheckOut> checkOuts = checkOutService.findAll(page,size);
        PageInfo<User> pageInfo=new PageInfo(checkOuts);
        model.addAttribute("pageInfo",pageInfo);
        return "checkOutList";
    }

    @RequestMapping(value = "/checkOut/listByCheckOutName")
    public String listByCureName(Model model, @RequestParam(name = "name", required = true) String name) {
    
    
        java.util.List<CheckOut> checkOut = checkOutService.findByName(name);
        PageInfo<Cure> pageInfo = new PageInfo(checkOut);
        model.addAttribute("pageInfo", pageInfo);
        return "checkOutList";
    }
}

  • CureController
@Controller
public class CureController {
    
    
    @Autowired
    CureService service;
    //所有治愈者
    @RequestMapping(value = "cure/list",method = RequestMethod.GET)
    public String list(Model model, @RequestParam(name="page",required = true,defaultValue = "1")int page, @RequestParam(name="size",required=true,defaultValue = "25")int size){
    
    
        List<Cure> cures = service.findAll(page,size);
        PageInfo<User> pageInfo=new PageInfo(cures);
        model.addAttribute("pageInfo",pageInfo);
        return "list";


    }
    //根据id查找治愈者
    @RequestMapping(value = "cure/info/{id}",method = RequestMethod.GET)
    public String info(@PathVariable("id")int id,Model model){
    
    
        Cure cure = service.get(id);
        model.addAttribute("cure",cure);
        return "cureInfo";
    }
    //更新或插入治愈者的现状
    @RequestMapping(value = "cure/update",method = RequestMethod.GET)
    public String update(int baseId,String current){
    
    

        service.update(baseId,current);
        System.out.println(baseId+current);
        return "redirect:/cure/info/"+baseId;
    }

    @RequestMapping(value = "cure/listByCureName")
    public String listByCureName(Model model, @RequestParam(name = "name", required = true) String name) {
    
    
        List<Cure> cures = service.findByName(name);
        System.out.println(cures);
        PageInfo<Cure> pageInfo = new PageInfo<>(cures);
        model.addAttribute("pageInfo", pageInfo);
        return "list";
    }
}

  • UserController
@Controller
public class UserController {
    
    
    @Autowired
    UserService userService;

    @RequestMapping(value = "/manager/list" ,method = RequestMethod.GET)
    public String list(Model model, @RequestParam(name="page",required = true,defaultValue = "1")int page, @RequestParam(name="size",required=true,defaultValue = "25") int size){
    
    
        List<User> users = userService.findAll(page, size);
        PageInfo<User> pageInfo=new PageInfo(users);
        model.addAttribute("pageInfo",pageInfo);
        return "managerlist";
    }

    //跳转添加页面
    @RequestMapping(value = "/manager/toAdd")
    public String toAdd(){
    
    
        return "managerAdd";
    }

    //添加管理员功能
    @RequestMapping(value = "/manager/add",method = RequestMethod.POST)
    public String add(@RequestParam("username")String username, @RequestParam("name")String name,
                      @RequestParam("password")String password, @RequestParam("unit")String unit,
                      @RequestParam("phone") BigInteger phone, @RequestParam("supermanager")char supermanager){
    
    
        BCryptPasswordEncoder bCryptPasswordEncoder = new BCryptPasswordEncoder();
        //加密密码
        String pwd=bCryptPasswordEncoder.encode(password);
        User user=new User().setName(name).setPassword(pwd).setUsername(username).setPhone(phone).setUnit(unit);
        System.out.println(user);
        //添加用户
        userService.addUser(user);
        //找到id
        int id = userService.findByUsername(user.getUsername()).getId();
        //添加普通权限
        userService.addUserRole(id);
        //添加超级管理员权限
        if ("是".equals(supermanager)){
    
    
            userService.addAdminRole(id);
        }
        return "redirect:/manager/list";
    }

    //升级权限
    @RequestMapping("/manager/toSuper/{id}")
    public String toSuper(@PathVariable("id")int id){
    
    
        userService.addAdminRole(id);
        return "redirect:/manager/list";
    }
    //删除用户
    @RequestMapping("/manager/delete/{id}")
    public String delete(@PathVariable("id")int id){
    
    
        userService.deleteUser(id);
        return "redirect:/manager/list";
    }

}

5. Resource acquisition

Summarize

This is the end of the project introduction. The learning process is the process of knowing yourself. In the process of development, you will constantly supplement your own knowledge, increase your own understanding, and make up for the shortcomings. You can also master the system development environment, configuration, and development software more proficiently. I can clearly feel that my English level needs to be improved. Although the debugging process is very irritating, it is also a pleasure to settle down and deal with it. Welcome to subscribe to the blogger column below and learn with bloggers! More exciting articles will be updated later! If you feel good, give it a thumbs up!

Guess you like

Origin blog.csdn.net/CSDN_anhl/article/details/127938488