欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

Java畢業(yè)設(shè)計(jì)實(shí)戰(zhàn)之醫(yī)院心理咨詢問診系統(tǒng)的實(shí)現(xiàn)

 更新時(shí)間:2022年01月24日 14:59:51   作者:OldWinePot  
這是一個(gè)使用了java+Spring+Maven+mybatis+Vue+mysql開發(fā)的醫(yī)院心理咨詢問診系統(tǒng),是一個(gè)畢業(yè)設(shè)計(jì)的實(shí)戰(zhàn)練習(xí),具有心理咨詢問診該有的所有功能,感興趣的朋友快來看看吧

一、項(xiàng)目運(yùn)行

環(huán)境配置:

Jdk1.8 + Tomcat8.5 + Mysql + HBuilderX(Webstorm也行)+ Eclispe(IntelliJ IDEA,Eclispe,MyEclispe,Sts都支持)。

項(xiàng)目技術(shù):

Spring + SpringMvc + mybatis + Maven + Vue 等等組成,B/S模式 + Maven管理等等。

系統(tǒng)控制器:

/**
 * 系統(tǒng)控制器
 * @author yy
 *
 */
@RequestMapping("/system")
@Controller
public class SystemController {
 
 
    @Autowired
    private OrderAuthService orderAuthService;
    @Autowired
    private OperaterLogService operaterLogService;
 
    @Autowired
    private UserService userService;
 
    @Autowired
    private DatabaseBakService databaseBakService;
 
    @Autowired
    private OrderReceivingService orderReceivingService;
 
    @Value("${show.tips.text}")
    private String showTipsText;
    @Value("${show.tips.url.text}")
    private String showTipsUrlText;
    @Value("${show.tips.btn.text}")
    private String showTipsBtnText;
    @Value("${show.tips.url}")
    private String showTipsUtl;
    private Logger log = LoggerFactory.getLogger(SystemController.class);
 
    /**
     * 登錄頁(yè)面
     * @param model
     * @param model
     * @return
     */
    @RequestMapping(value="/login",method=RequestMethod.GET)
    public String login(Model model){
        return "admin/system/login";
    }
 
    /**
     * 用戶登錄提交表單處理方法
     * @param request
     * @param user
     * @param cpacha
     * @return
     */
    @RequestMapping(value="/login",method=RequestMethod.POST)
    @ResponseBody
    public Result<Boolean> login(HttpServletRequest request,User user,String cpacha){
        if(user == null){
            return Result.error(CodeMsg.DATA_ERROR);
        }
        //用統(tǒng)一驗(yàn)證實(shí)體方法驗(yàn)證是否合法
        CodeMsg validate = ValidateEntityUtil.validate(user);
        if(validate.getCode() != CodeMsg.SUCCESS.getCode()){
            return Result.error(validate);
        }
        //表示實(shí)體信息合法,開始驗(yàn)證驗(yàn)證碼是否為空
        if(StringUtils.isEmpty(cpacha)){
            return Result.error(CodeMsg.CPACHA_EMPTY);
        }
        //說明驗(yàn)證碼不為空,從session里獲取驗(yàn)證碼
        Object attribute = request.getSession().getAttribute("admin_login");
        if(attribute == null){
            return Result.error(CodeMsg.SESSION_EXPIRED);
        }
        //表示session未失效,進(jìn)一步判斷用戶填寫的驗(yàn)證碼是否正確
        if(!cpacha.equalsIgnoreCase(attribute.toString())){
            return Result.error(CodeMsg.CPACHA_ERROR);
        }
        //表示驗(yàn)證碼正確,開始查詢數(shù)據(jù)庫(kù),檢驗(yàn)密碼是否正確
        User findByUsername = userService.findByUsername(user.getUsername());
        //判斷是否為空
        if(findByUsername == null){
            return Result.error(CodeMsg.ADMIN_USERNAME_NO_EXIST);
        }
        //表示用戶存在,進(jìn)一步對(duì)比密碼是否正確
        if(!findByUsername.getPassword().equals(user.getPassword())){
            return Result.error(CodeMsg.ADMIN_PASSWORD_ERROR);
        }
        //表示密碼正確,接下來判斷用戶狀態(tài)是否可用
        if(findByUsername.getStatus() == User.ADMIN_USER_STATUS_UNABLE){
            return Result.error(CodeMsg.ADMIN_USER_UNABLE);
        }
        //檢查用戶所屬角色狀態(tài)是否可用
        if(findByUsername.getRole() == null || findByUsername.getRole().getStatus() == Role.ADMIN_ROLE_STATUS_UNABLE){
            return Result.error(CodeMsg.ADMIN_USER_ROLE_UNABLE);
        }
        //檢查用戶所屬角色的權(quán)限是否存在
        if(findByUsername.getRole().getAuthorities() == null || findByUsername.getRole().getAuthorities().size() == 0){
            return Result.error(CodeMsg.ADMIN_USER_ROLE_AUTHORITES_EMPTY);
        }
        //檢查一切符合,可以登錄,將用戶信息存放至session
        request.getSession().setAttribute(SessionConstant.SESSION_USER_LOGIN_KEY, findByUsername);
        //銷毀session中的驗(yàn)證碼
        request.getSession().setAttribute("admin_login", null);
        //將登陸記錄寫入日志庫(kù)
        operaterLogService.add("用戶【"+user.getUsername()+"】于【" + StringUtil.getFormatterDate(new Date(), "yyyy-MM-dd HH:mm:ss") + "】登錄系統(tǒng)!");
        log.info("用戶成功登錄,user = " + findByUsername);
        return Result.success(true);
    }
 
    /**
     * 登錄成功后的系統(tǒng)主頁(yè)
     * @param model
     * @return
     */
    @RequestMapping(value="/index")
    public String index(Model model){
        model.addAttribute("operatorLogs", operaterLogService.findLastestLog(10));
        model.addAttribute("userTotal", userService.total());
        model.addAttribute("operatorLogTotal", operaterLogService.total());
        model.addAttribute("databaseBackupTotal", databaseBakService.total());
        model.addAttribute("onlineUserTotal", SessionListener.onlineUserCount);
        model.addAttribute("orderReceivings", orderReceivingService.findOrderReceivingDesc());
        model.addAttribute("showTipsText", showTipsText);
        model.addAttribute("showTipsUrlText", showTipsUrlText);
        model.addAttribute("showTipsUtl", showTipsUtl);
        model.addAttribute("showTipsBtnText", showTipsBtnText);
        return "admin/system/index";
    }
 
    /**
     * 注銷登錄
     * @return
     */
    @RequestMapping(value="/logout")
    public String logout(){
        User loginedUser = SessionUtil.getLoginedUser();
        if(loginedUser != null){
            SessionUtil.set(SessionConstant.SESSION_USER_LOGIN_KEY, null);
        }
        return "redirect:login";
    }
 
    /**
     * 無權(quán)限提示頁(yè)面
     * @return
     */
    @RequestMapping(value="/no_right")
    public String noRight(){
        return "admin/system/no_right";
    }
 
    /**
     * 修改用戶個(gè)人信息
     * @return
     */
    @RequestMapping(value="/update_userinfo",method=RequestMethod.GET)
    public String updateUserInfo(){
        return "admin/system/update_userinfo";
    }
 
    /**
     * 修改個(gè)人信息保存
     * @param user
     * @return
     */
    @RequestMapping(value="/update_userinfo",method=RequestMethod.POST)
    @ResponseBody
    public Result<Boolean> updateUserInfo(User user) throws Exception {
        User loginedUser = SessionUtil.getLoginedUser();
        loginedUser.setId(user.getId());
        if(user.getEmail() == null){
            Result.error(CodeMsg.ADMIN_PUBLIC_EMAIL);
        }
        loginedUser.setEmail(user.getEmail());
        if(user.getMobile() == null){
            Result.error(CodeMsg.ADMIN_PUBLIC_MOBILE);
        }
        loginedUser.setMobile(user.getMobile());
        loginedUser.setHeadPic(user.getHeadPic());
        int age = DateUtil.getAge(user.getBirthDay());
        if (age < 0) {
            Result.error(CodeMsg.ADMIN_PUBLIC_AGE);
        }
        loginedUser.setAge(age);
        loginedUser.setBirthDay(user.getBirthDay());
        if(user.getName() == null){
            Result.error(CodeMsg.ADMIN_PUBLIC_NAME);
        }
        loginedUser.setName(user.getName());
        //首先保存到數(shù)據(jù)庫(kù)
        userService.save(loginedUser);
        //更新session里的值
        SessionUtil.set(SessionConstant.SESSION_USER_LOGIN_KEY, loginedUser);
        return Result.success(true);
    }
 
    /**
     * 修改密碼頁(yè)面
     * @return
     */
    @RequestMapping(value="/update_pwd",method=RequestMethod.GET)
    public String updatePwd(){
        return "admin/system/update_pwd";
    }
 
    /**
     * 修改密碼表單提交
     * @param oldPwd
     * @param newPwd
     * @return
     */
    @RequestMapping(value="/update_pwd",method=RequestMethod.POST)
    @ResponseBody
    public Result<Boolean> updatePwd(@RequestParam(name="oldPwd",required=true)String oldPwd,
                                     @RequestParam(name="newPwd",required=true)String newPwd
    ){
        User loginedUser = SessionUtil.getLoginedUser();
        if(!loginedUser.getPassword().equals(oldPwd)){
            return Result.error(CodeMsg.ADMIN_USER_UPDATE_PWD_ERROR);
        }
        if(StringUtils.isEmpty(newPwd)){
            return Result.error(CodeMsg.ADMIN_USER_UPDATE_PWD_EMPTY);
        }
        loginedUser.setPassword(newPwd);
        //保存數(shù)據(jù)庫(kù)
        userService.save(loginedUser);
        //更新session
        SessionUtil.set(SessionConstant.SESSION_USER_LOGIN_KEY, loginedUser);
        return Result.success(true);
    }
 
    /**
     * 日志管理列表
     * @param model
     * @param operaterLog
     * @param pageBean
     * @return
     */
    @RequestMapping(value="/operator_log_list")
    public String operatorLogList(Model model,OperaterLog operaterLog,PageBean<OperaterLog> pageBean){
        model.addAttribute("pageBean", operaterLogService.findList(operaterLog, pageBean));
        model.addAttribute("operator", operaterLog.getOperator());
        model.addAttribute("title", "日志列表");
        return "admin/system/operator_log_list";
    }
 
    /**
     * 刪除操作日志,可刪除多個(gè)
     * @param ids
     * @return
     */
    @RequestMapping(value="/delete_operator_log",method=RequestMethod.POST)
    @ResponseBody
    public Result<Boolean> delete(String ids){
        if(!StringUtils.isEmpty(ids)){
            String[] splitIds = ids.split(",");
            for(String id : splitIds){
                operaterLogService.delete(Long.valueOf(id));
            }
        }
        return Result.success(true);
    }
 
    /**
     * 驗(yàn)證訂單
     * @param orderSn
     * @param phone
     * @return
     */
    @RequestMapping(value="/auth_order",method=RequestMethod.POST)
    @ResponseBody
    public Result<Boolean> authOrder(@RequestParam(name="orderSn",required=true)String orderSn,@RequestParam(name="phone",required=true)String phone){
        OrderAuth orderAuth = new OrderAuth();
        orderAuth.setMac(StringUtil.getMac());
        orderAuth.setOrderSn(orderSn);
        orderAuth.setPhone(phone);
        orderAuthService.save(orderAuth);
        AppConfig.ORDER_AUTH = 1;
        return Result.success(true);
    }
 
 
 
    /**
     * 清空整個(gè)日志
     * @return
     */
    @RequestMapping(value="/delete_all_operator_log",method=RequestMethod.POST)
    @ResponseBody
    public Result<Boolean> deleteAll(){
        operaterLogService.deleteAll();
        return Result.success(true);
    }
}

后臺(tái)角色管理控制器:

/**
 * 后臺(tái)角色管理控制器
 * @author yy
 *
 */
@RequestMapping("/role")
@Controller
public class RoleController {
 
	
	private Logger log = LoggerFactory.getLogger(RoleController.class);
	
	@Autowired
	private MenuService menuService;
	
	@Autowired
	private OperaterLogService operaterLogService;
	
	@Autowired
	private RoleService roleService;
	
	/**
	 * 分頁(yè)搜索角色列表
	 * @param model
	 * @param role
	 * @param pageBean
	 * @return
	 */
	@RequestMapping(value="/list")
	public String list(Model model,Role role,PageBean<Role> pageBean){
		model.addAttribute("title", "角色列表");
		model.addAttribute("name", role.getName());
		model.addAttribute("pageBean", roleService.findByName(role, pageBean));
		return "admin/role/list";
	}
	
	/**
	 * 角色添加頁(yè)面
	 * @param model
	 * @return
	 */
	@RequestMapping(value="/add",method=RequestMethod.GET)
	public String add(Model model){
		List<Menu> findAll = menuService.findAll();
		model.addAttribute("topMenus",MenuUtil.getTopMenus(findAll));
		model.addAttribute("secondMenus",MenuUtil.getSecondMenus(findAll));
		model.addAttribute("thirdMenus",MenuUtil.getThirdMenus(findAll));
		return "admin/role/add";
	}
	
	/**
	 * 角色添加表單提交處理
	 * @param role
	 * @return
	 */
	@RequestMapping(value="/add",method=RequestMethod.POST)
	@ResponseBody
	public Result<Boolean> add(Role role){
		//用統(tǒng)一驗(yàn)證實(shí)體方法驗(yàn)證是否合法
		CodeMsg validate = ValidateEntityUtil.validate(role);
		if(validate.getCode() != CodeMsg.SUCCESS.getCode()){
			return Result.error(validate);
		}
		if(roleService.save(role) == null){
			return Result.error(CodeMsg.ADMIN_ROLE_ADD_ERROR);
		}
		log.info("添加角色【"+role+"】");
		operaterLogService.add("添加角色【"+role.getName()+"】");
		return Result.success(true);
	}
	
	/**
	 * 角色編輯頁(yè)面
	 * @param id
	 * @param model
	 * @return
	 */
	@RequestMapping(value="/edit",method=RequestMethod.GET)
	public String edit(@RequestParam(name="id",required=true)Long id,Model model){
		List<Menu> findAll = menuService.findAll();
		model.addAttribute("topMenus",MenuUtil.getTopMenus(findAll));
		model.addAttribute("secondMenus",MenuUtil.getSecondMenus(findAll));
		model.addAttribute("thirdMenus",MenuUtil.getThirdMenus(findAll));
		Role role = roleService.find(id);
		model.addAttribute("role", role);
		model.addAttribute("authorities",JSONArray.toJSON(role.getAuthorities()).toString());
		return "admin/role/edit";
	}
	
	/**
	 * 角色修改表單提交處理
	 * @param request
	 * @param role
	 * @return
	 */
	@RequestMapping(value="/edit",method=RequestMethod.POST)
	@ResponseBody
	public Result<Boolean> edit(Role role){
		//用統(tǒng)一驗(yàn)證實(shí)體方法驗(yàn)證是否合法
		CodeMsg validate = ValidateEntityUtil.validate(role);
		if(validate.getCode() != CodeMsg.SUCCESS.getCode()){
			return Result.error(validate);
		}
		Role existRole = roleService.find(role.getId());
		if(existRole == null){
			return Result.error(CodeMsg.ADMIN_ROLE_NO_EXIST);
		}
		existRole.setName(role.getName());
		existRole.setRemark(role.getRemark());
		existRole.setStatus(role.getStatus());
		existRole.setAuthorities(role.getAuthorities());
		if(roleService.save(existRole) == null){
			return Result.error(CodeMsg.ADMIN_ROLE_EDIT_ERROR);
		}
		log.info("編輯角色【"+role+"】");
		operaterLogService.add("編輯角色【"+role.getName()+"】");
		return Result.success(true);
	}
	
	/**
	 * 刪除角色
	 * @param request
	 * @param id
	 * @return
	 */
	@RequestMapping(value="delete",method=RequestMethod.POST)
	@ResponseBody
	public Result<Boolean> delete(@RequestParam(name="id",required=true)Long id){
		try {
			roleService.delete(id);
		} catch (Exception e) {
			// TODO: handle exception
			return Result.error(CodeMsg.ADMIN_ROLE_DELETE_ERROR);
		}
		log.info("編輯角色I(xiàn)D【"+id+"】");
		operaterLogService.add("刪除角色I(xiàn)D【"+id+"】");
		return Result.success(true);
	}
}

后臺(tái)用戶管理控制器:

/**
 * 后臺(tái)用戶管理控制器
 * @author yy
 *
 */
@RequestMapping("/user")
@Controller
public class UserController {
 
	@Autowired
	private UserService userService;
	@Autowired
	private RoleService roleService;
	@Autowired
	private OperaterLogService operaterLogService;
	/**
	 * 用戶列表頁(yè)面
	 * @param model
	 * @param user
	 * @param pageBean
	 * @return
	 */
	@RequestMapping(value="/list")
	public String list(Model model,User user,PageBean<User> pageBean){
		model.addAttribute("title", "用戶列表");
		model.addAttribute("username", user.getUsername());
		model.addAttribute("pageBean", userService.findList(user, pageBean));
		return "admin/user/list";
	}
	
	/**
	 * 新增用戶頁(yè)面
	 * @param model
	 * @return
	 */
	@RequestMapping(value="/add",method=RequestMethod.GET)
	public String add(Model model){
		model.addAttribute("roles", roleService.findSome());
		return "admin/user/add";
	}
	
	/**
	 * 用戶添加表單提交處理
	 * @param user
	 * @return
	 */
	@RequestMapping(value="/add",method=RequestMethod.POST)
	@ResponseBody
	public Result<Boolean> add(User user){
		//用統(tǒng)一驗(yàn)證實(shí)體方法驗(yàn)證是否合法
		CodeMsg validate = ValidateEntityUtil.validate(user);
		if(validate.getCode() != CodeMsg.SUCCESS.getCode()){
			return Result.error(validate);
		}
		if(user.getRole() == null || user.getRole().getId() == null){
			return Result.error(CodeMsg.ADMIN_USER_ROLE_EMPTY);
		}
		//判斷用戶名是否存在
		if(userService.isExistUsername(user.getUsername(), 0l)){
			return Result.error(CodeMsg.ADMIN_USERNAME_EXIST);
		}
 
		int age = DateUtil.getAge(user.getBirthDay());
		if (age < 0) {
			return   Result.error(CodeMsg.ADMIN_PUBLIC_AGE);
		}
		user.setAge(age);
		//到這說明一切符合條件,進(jìn)行數(shù)據(jù)庫(kù)新增
		if(userService.save(user) == null){
			return Result.error(CodeMsg.ADMIN_USE_ADD_ERROR);
		}
		operaterLogService.add("添加用戶,用戶名:" + user.getUsername());
		return Result.success(true);
	}
	
	/**
	 * 用戶編輯頁(yè)面
	 * @param model
	 * @return
	 */
	@RequestMapping(value="/edit",method=RequestMethod.GET)
	public String edit(Model model,@RequestParam(name="id",required=true)Long id){
		model.addAttribute("roles", roleService.findSome());
		model.addAttribute("user", userService.find(id));
		return "admin/user/edit";
	}
	
	/**
	 * 編輯用戶信息表單提交處理
	 * @param user
	 * @return
	 */
	@RequestMapping(value="/edit",method=RequestMethod.POST)
	@ResponseBody
	public Result<Boolean> edit(User user){
		//用統(tǒng)一驗(yàn)證實(shí)體方法驗(yàn)證是否合法
		CodeMsg validate = ValidateEntityUtil.validate(user);
		if(validate.getCode() != CodeMsg.SUCCESS.getCode()){
			return Result.error(validate);
		}
		if(user.getRole() == null || user.getRole().getId() == null){
			return Result.error(CodeMsg.ADMIN_USER_ROLE_EMPTY_EDIT);
		}
		if(user.getRole().getId() == Doctor.DOCTOR_ROLE_ID || user.getRole().getId() == Patient.PATIENT_ROLE_ID){
			return Result.error(CodeMsg.ADMIN_USER_ROLE_CANNOT_CHANGE);
		}
		if(user.getId() == null || user.getId().longValue() <= 0){
			return Result.error(CodeMsg.ADMIN_USE_NO_EXIST);
		}
		if(userService.isExistUsername(user.getUsername(), user.getId())){
			return Result.error(CodeMsg.ADMIN_USERNAME_EXIST);
		}
		//到這說明一切符合條件,進(jìn)行數(shù)據(jù)庫(kù)保存
		User findById = userService.find(user.getId());
		int age = DateUtil.getAge(user.getBirthDay());
		if (age < 0) {
			return   Result.error(CodeMsg.ADMIN_PUBLIC_AGE);
		}
		user.setAge(age);
		//講提交的用戶信息指定字段復(fù)制到已存在的user對(duì)象中,該方法會(huì)覆蓋新字段內(nèi)容
		BeanUtils.copyProperties(user, findById, "id","createTime","updateTime");
		if(userService.save(findById) == null){
			return Result.error(CodeMsg.ADMIN_USE_EDIT_ERROR);
		}
		operaterLogService.add("編輯用戶,用戶名:" + user.getUsername());
		return Result.success(true);
	}
	
	/**
	 * 刪除用戶
	 * @param id
	 * @return
	 */
	@RequestMapping(value="/delete",method=RequestMethod.POST)
	@ResponseBody
	public Result<Boolean> delete(@RequestParam(name="id",required=true)Long id){
		try {
			userService.delete(id);
		} catch (Exception e) {
			return Result.error(CodeMsg.ADMIN_USE_DELETE_ERROR);
		}
		operaterLogService.add("添加用戶,用戶ID:" + id);
		return Result.success(true);
	}
}

醫(yī)生管理控制層:

/**
 * 醫(yī)生管理控制層
 */
 
@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;
 
    /**
     * 跳轉(zhuǎn)醫(yī)生列表頁(yè)面
     * @param model
     * @param doctor
     * @param pageBean
     * @return
     */
    @RequestMapping(value = "/list")
    public String list(Model model, Doctor doctor, PageBean<Doctor> pageBean) {
        model.addAttribute("title", "醫(yī)生列表");
        if (doctor.getUser() != null) {
            model.addAttribute("name", doctor.getUser().getName());
        }
        model.addAttribute("pageBean", doctorService.findList(doctor, pageBean));
        return "admin/doctor/list";
    }
 
    /**
     * 醫(yī)生添加頁(yè)面
     * @param model
     * @return
     */
    @RequestMapping(value = "/add", method = RequestMethod.GET)
    public String add(Model model) {
 
        model.addAttribute("departments", departmentService.findAllDepartment());
        return "admin/doctor/add";
    }
 
    /**
     * 醫(yī)生添加提交
     * @param doctor
     * @return
     */
    @RequestMapping(value = "/add", method = RequestMethod.POST)
    @ResponseBody
    public Result<Boolean> 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);
    }
 
 
    /**
     * 醫(yī)生修改頁(yè)面
     * @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";
    }
 
 
    /**
     * 醫(yī)生修改提交
     * @param doctor
     * @return
     */
    @RequestMapping(value = "/edit", method = RequestMethod.POST)
    @ResponseBody
    public Result<Boolean> edit(Doctor doctor) {
        Doctor findDoctor = doctorService.find(doctor.getId());
 
        List<Doctor> 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 = doctor.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);
    }
 
 
    /**
     * 刪除醫(yī)生用戶
     * @param id
     * @return
     */
    @RequestMapping(value = "/delete", method = RequestMethod.POST)
    @ResponseBody
    public Result<Boolean> 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);
    }
 
    /**
     * 修改個(gè)人出診狀態(tài)頁(yè)面
     * @param model
     * @return
     */
    @RequestMapping(value = "/updateStatus", method = RequestMethod.GET)
    public String updateDoctorStatus(Model model) {
        Doctor doctor = doctorService.findByLoginDoctorUser();
        model.addAttribute("title","個(gè)人出診信息修改");
        model.addAttribute("doctor", doctor);
        return "admin/doctor/visitingStatus";
    }
 
    /**
     * 提交修改個(gè)人出診狀態(tài)
     * @param doctor
     * @return
     */
    @RequestMapping(value = "/updateStatus", method = RequestMethod.POST)
    @ResponseBody
    public Result<Boolean> 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);
    }
 
    /**
     * 醫(yī)生查詢接單記錄
     * @param model
     * @param pageBean
     * @return
     */
    @RequestMapping(value = "/orderRecord",method = RequestMethod.GET)
    public String doctorOrderRecords(Model model, PageBean<OrderReceiving> pageBean) {
        //獲取醫(yī)生登錄的信息
        Doctor loginDoctorUser = doctorService.findByLoginDoctorUser();
        model.addAttribute("title", "出診信息");
        model.addAttribute("pageBean", orderReceivingService.findByDoctorId(pageBean,loginDoctorUser.getId()));
        return "admin/doctor/orderRecord";
    }
 
    /**
     * 查看自己科室所有醫(yī)生信息
     * @param model
     * @param pageBean
     * @return
     */
    @RequestMapping(value = "/findByDepartment", method = RequestMethod.GET)
    public String AllDoctorByDepartment(Model model,PageBean<Doctor> pageBean) {
        Doctor loginDoctorUser = doctorService.findByLoginDoctorUser();
        model.addAttribute("title", "本科室所有醫(yī)生列表");
        model.addAttribute("pageBean", doctorService.findAllByDepartment(pageBean, loginDoctorUser.getDepartment().getId()));
        return "admin/doctor/doctorInformation";
    }
 
    /**
     * 醫(yī)生完成出診訂單
     * @param id
     * @return
     */
    @RequestMapping(value = "/orderRecord",method = RequestMethod.POST)
    @ResponseBody
    public Result<Boolean>modifyVisitStatus(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<OrderReceiving> pageBean){
        model.addAttribute("title","出診信息");
        model.addAttribute("pageBean",orderReceivingService.findList(orderReceiving,pageBean));
        return "admin/doctor/allOrderInformation";
    }
 
 
    /**
     * 醫(yī)生查詢負(fù)責(zé)的住院信息
     */
    @RequestMapping(value="/bedAllot")
    public String bedAllotSelf(Model model,PageBean<BedAllot> pageBean){
        Doctor loginDoctorUser = doctorService.findByLoginDoctorUser();
        Long doctorId = loginDoctorUser.getId();
        model.addAttribute("title","住院信息");
        model.addAttribute("pageBean",bedAllotService.findByDoctor(pageBean,doctorId));
        return "admin/doctor/bedAllot";
    }
 
 
}

到此這篇關(guān)于Java畢業(yè)設(shè)計(jì)實(shí)戰(zhàn)之醫(yī)院心理咨詢問診系統(tǒng)的實(shí)現(xiàn)的文章就介紹到這了,更多相關(guān)Java 醫(yī)院心理咨詢問診系統(tǒng)內(nèi)容請(qǐng)搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!

相關(guān)文章

  • Java跨域問題的處理詳解

    Java跨域問題的處理詳解

    這篇文章主要給大家介紹了關(guān)于Java跨域問題處理的相關(guān)資料,文中介紹的非常詳細(xì),相信對(duì)大家具有一定的參考價(jià)值,需要的朋友們下面來一起看看吧。
    2017-03-03
  • Java中stream.map和stream.forEach的區(qū)別

    Java中stream.map和stream.forEach的區(qū)別

    本文主要介紹了Java中stream.map和stream.forEach的區(qū)別,文中通過示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧
    2022-08-08
  • Mysql?json類型字段Java+Mybatis數(shù)據(jù)字典功能的實(shí)踐方式

    Mysql?json類型字段Java+Mybatis數(shù)據(jù)字典功能的實(shí)踐方式

    這篇文章主要介紹了Mysql?json類型字段Java+Mybatis數(shù)據(jù)字典功能的實(shí)踐方式,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教
    2022-08-08
  • JAVA加密算法實(shí)密鑰一致協(xié)議代碼示例

    JAVA加密算法實(shí)密鑰一致協(xié)議代碼示例

    這篇文章主要介紹了JAVA加密算法實(shí)密鑰一致協(xié)議代碼示例,文中通過示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友可以參考下
    2020-10-10
  • Java將文件上傳到ftp服務(wù)器

    Java將文件上傳到ftp服務(wù)器

    這篇文章主要為大家詳細(xì)介紹了Java將文件上傳到ftp服務(wù)器,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
    2022-06-06
  • java使用dbcp2數(shù)據(jù)庫(kù)連接池

    java使用dbcp2數(shù)據(jù)庫(kù)連接池

    這篇文章主要為大家詳細(xì)介紹了java使用dbcp2數(shù)據(jù)庫(kù)連接池的相關(guān)資料,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
    2016-10-10
  • Java獲取兩個(gè)字符串中最大相同子串的方法

    Java獲取兩個(gè)字符串中最大相同子串的方法

    今天小編就為大家分享一篇Java獲取兩個(gè)字符串中最大相同子串的方法,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過來看看吧
    2018-07-07
  • 關(guān)于Maven依賴沖突解決之exclusions

    關(guān)于Maven依賴沖突解決之exclusions

    這篇文章主要介紹了關(guān)于Maven依賴沖突解決之exclusions用法,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教
    2021-12-12
  • 導(dǎo)入項(xiàng)目出現(xiàn)Java多個(gè)工程相互引用異常A cycle was detected in the build path of project的解決辦法

    導(dǎo)入項(xiàng)目出現(xiàn)Java多個(gè)工程相互引用異常A cycle was detected in the build path o

    今天小編就為大家分享一篇關(guān)于導(dǎo)入項(xiàng)目出現(xiàn)Java多個(gè)工程相互引用異常A cycle was detected in the build path of project的解決辦法,小編覺得內(nèi)容挺不錯(cuò)的,現(xiàn)在分享給大家,具有很好的參考價(jià)值,需要的朋友一起跟隨小編來看看吧
    2018-12-12
  • Springboot整合Swagger3全注解配置(springdoc-openapi-ui)

    Springboot整合Swagger3全注解配置(springdoc-openapi-ui)

    本文主要介紹了Springboot整合Swagger3全注解配置(springdoc-openapi-ui),文中通過示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
    2022-03-03

最新評(píng)論