Smart Senior Care Platform: Architecture and Implementation

System Overview

The smart senior care platform is a web-based management system designed to digitize and streamline elderly care services. The system replaces traditional paper-based record keeping with a centralized database approach, enabling efficient management of elderly residents, family members, community staff, care services, messaging, and announcements.

Technology Stack

Backend Architecture

The platform employs the Spring Boot framework, which has gained significant traction in enterprise application development. Spring Boot eliminates the extensive XML configuration requirements of traditional Spring applications by providing sensible defaults and auto-configuration capabilities. This approach significantly accelerates the development process while maintaining code quality and maintainability.

Key characteristics of Spring Boot:

  • Auto-configuration reduces manual setup overhead
  • Embedded server support (Tomcat by default)
  • Starter POMs simplify dependency management
  • Production-ready features including metrics and health checks

Database Layer

MySQL serves as the relational database management system. It provides reliable data storage with ACID compliance, making it suitable for transactional operations common in care management scenarios.

MySQL advantages for this application:

  • Fast query execution optimized for web applications
  • Comprehensive indexing capabilities
  • Strong data integrity enforcement
  • Widely supported by hosting providers

Frontend Technology

JSP (JavaServer Pages) handles the presentation layer, generating dynamic content server-side. This approach allows for clean separation between business logic and presentation while enabling direct access to server-side data within HTML templates.

Development Environment

Component Specification
JDK 1.8
Application Server Tomcat 7+
Database MySQL 5.7
Build Tool Maven 3.3.9
IDE Eclipse/MyEclipse/IntelliJ IDEA
Browser Chrome/Edge

Project Structure

src/main/java/com/controller/
├── FileController.java      # Handles file uploads and downloads
├── ForumController.java     # Community forum management
└── ...

File Upload Controller Implemantation

The file management component handles binary asset uploads including images and documents. The controller manages file storage in a dedicated upload directory and provides download endpoints.

package com.controller;

import java.io.File;
import java.io.IOException;
import java.util.Date;
import org.apache.commons.io.FileUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.util.ResourceUtils;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import com.annotation.IgnoreAuth;
import com.entity.ConfigEntity;
import com.service.ConfigService;
import com.utils.R;

@RestController
@RequestMapping("file")
public class FileController {
    
    @Autowired
    private ConfigService configService;
    
    @PostMapping("/upload")
    @IgnoreAuth
    public R uploadFile(@RequestParam("file") MultipartFile file, String type) throws Exception {
        if (file.isEmpty()) {
            throw new EIException("File cannot be empty");
        }
        
        String fileExtension = file.getOriginalFilename()
            .substring(file.getOriginalFilename().lastIndexOf(".") + 1);
        
        File basePath = new File(ResourceUtils.getURL("classpath:static").getPath());
        if (!basePath.exists()) {
            basePath = new File("");
        }
        
        File uploadDir = new File(basePath.getAbsolutePath(), "/upload/");
        if (!uploadDir.exists()) {
            uploadDir.mkdirs();
        }
        
        String fileName = new Date().getTime() + "." + fileExtension;
        File destFile = new File(uploadDir.getAbsolutePath() + "/" + fileName);
        file.transferTo(destFile);
        
        if (StringUtils.isNotBlank(type) && type.equals("1")) {
            ConfigEntity config = configService.selectOne(
                new EntityWrapper<ConfigEntity>().eq("name", "faceFile"));
            if (config == null) {
                config = new ConfigEntity();
                config.setName("faceFile");
                config.setValue(fileName);
            } else {
                config.setValue(fileName);
            }
            configService.insertOrUpdate(config);
        }
        
        return R.ok().put("file", fileName);
    }
    
    @GetMapping("/download")
    @IgnoreAuth
    public ResponseEntity<byte[]> downloadFile(@RequestParam String fileName) {
        try {
            File basePath = new File(ResourceUtils.getURL("classpath:static").getPath());
            if (!basePath.exists()) {
                basePath = new File("");
            }
            
            File uploadDir = new File(basePath.getAbsolutePath(), "/upload/");
            if (!uploadDir.exists()) {
                uploadDir.mkdirs();
            }
            
            File targetFile = new File(uploadDir.getAbsolutePath() + "/" + fileName);
            if (targetFile.exists()) {
                HttpHeaders headers = new HttpHeaders();
                headers.setContentType(MediaType.APPLICATION_OCTET_STREAM);
                headers.setContentDispositionFormData("attachment", fileName);
                return new ResponseEntity<>(
                    FileUtils.readFileToByteArray(targetFile),
                    headers,
                    HttpStatus.CREATED
                );
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
        return new ResponseEntity<>(HttpStatus.INTERNAL_SERVER_ERROR);
    }
}

Forum Management Controller

The community forum module enables interaction between users, supporting threaded discussions with hierarchical replies.

package com.controller;

import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.annotation.IgnoreAuth;
import com.entity.ForumEntity;
import com.entity.view.ForumView;
import com.service.ForumService;
import com.utils.PageUtils;
import com.utils.R;
import com.utils.MPUtil;

@RestController
@RequestMapping("/forum")
public class ForumController {
    
    @Autowired
    private ForumService forumService;
    
    @GetMapping("/page")
    public R getPaginatedList(@RequestParam Map<String, Object> params, 
                              ForumEntity forum,
                              HttpServletRequest request) {
        if (!request.getSession().getAttribute("role").toString().equals("Administrator")) {
            forum.setUserid((Long) request.getSession().getAttribute("userId"));
        }
        
        EntityWrapper<ForumEntity> condition = new EntityWrapper<>();
        PageUtils page = forumService.queryPage(
            params,
            MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(condition, forum), params), params)
        );
        
        return R.ok().put("data", page);
    }
    
    @GetMapping("/list")
    public R getPublicList(@RequestParam Map<String, Object> params,
                            ForumEntity forum,
                            HttpServletRequest request) {
        EntityWrapper<ForumEntity> condition = new EntityWrapper<>();
        PageUtils page = forumService.queryPage(
            params,
            MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(condition, forum), params), params)
        );
        return R.ok().put("data", page);
    }
    
    @GetMapping("/flist")
    @IgnoreAuth
    public R getFilteredList(@RequestParam Map<String, Object> params,
                             ForumEntity forum) {
        EntityWrapper<ForumEntity> condition = new EntityWrapper<>();
        PageUtils page = forumService.queryPage(
            params,
            MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(condition, forum), params), params)
        );
        return R.ok().put("data", page);
    }
    
    @GetMapping("/query")
    public R searchRecords(ForumEntity forum) {
        EntityWrapper<ForumEntity> condition = new EntityWrapper<>();
        condition.allEq(MPUtil.allEQMapPre(forum, "forum"));
        ForumView result = forumService.selectView(condition);
        return R.ok("Query successful").put("data", result);
    }
    
    @GetMapping("/info/{id}")
    public R getDetails(@PathVariable("id") Long id) {
        ForumEntity forum = forumService.selectById(id);
        return R.ok().put("data", forum);
    }
    
    @GetMapping("/detail/{id}")
    @IgnoreAuth
    public R getPublicDetails(@PathVariable("id") Long id) {
        ForumEntity forum = forumService.selectById(id);
        return R.ok().put("data", forum);
    }
    
    @GetMapping("/list/{id}")
    @IgnoreAuth
    public R getThreadDetails(@PathVariable("id") String id) {
        ForumEntity forum = forumService.selectById(id);
        populateReplies(forum);
        return R.ok().put("data", forum);
    }
    
    private ForumEntity populateReplies(ForumEntity forum) {
        List<ForumEntity> replies = forumService.selectList(
            new EntityWrapper<ForumEntity>().eq("parentid", forum.getId())
        );
        if (replies == null || replies.isEmpty()) {
            return null;
        }
        forum.setChilds(replies);
        for (ForumEntity reply : replies) {
            populateReplies(reply);
        }
        return forum;
    }
    
    @PostMapping("/save")
    public R createRecord(@RequestBody ForumEntity forum, HttpServletRequest request) {
        forum.setId(new Date().getTime() + 
            (long) Math.floor(Math.random() * 1000));
        forum.setUserid((Long) request.getSession().getAttribute("userId"));
        forumService.insert(forum);
        return R.ok();
    }
    
    @PostMapping("/add")
    public R addRecord(@RequestBody ForumEntity forum, HttpServletRequest request) {
        forum.setId(new Date().getTime() + 
            (long) Math.floor(Math.random() * 1000));
        forum.setUserid((Long) request.getSession().getAttribute("userId"));
        forumService.insert(forum);
        return R.ok();
    }
    
    @PutMapping("/update")
    @Transactional
    public R modifyRecord(@RequestBody ForumEntity forum, HttpServletRequest request) {
        forumService.updateById(forum);
        return R.ok();
    }
    
    @DeleteMapping("/delete")
    public R removeRecords(@RequestBody Long[] ids) {
        forumService.deleteBatchIds(Arrays.asList(ids));
        return R.ok();
    }
    
    @GetMapping("/remind/{columnName}/{type}")
    public R getNotificationCount(@PathVariable("columnName") String columnName,
                                   HttpServletRequest request,
                                   @PathVariable("type") String type,
                                   @RequestParam Map<String, Object> map) {
        map.put("column", columnName);
        map.put("type", type);
        
        if (type.equals("2")) {
            SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
            Calendar calendar = Calendar.getInstance();
            Date startDate = null;
            Date endDate = null;
            
            if (map.get("remindstart") != null) {
                Integer daysOffset = Integer.parseInt(map.get("remindstart").toString());
                calendar.setTime(new Date());
                calendar.add(Calendar.DAY_OF_MONTH, daysOffset);
                startDate = calendar.getTime();
                map.put("remindstart", formatter.format(startDate));
            }
            
            if (map.get("remindend") != null) {
                Integer daysOffset = Integer.parseInt(map.get("remindend").toString());
                calendar.setTime(new Date());
                calendar.add(Calendar.DAY_OF_MONTH, daysOffset);
                endDate = calendar.getTime();
                map.put("remindend", formatter.format(endDate));
            }
        }
        
        EntityWrapper<ForumEntity> wrapper = new EntityWrapper<>();
        if (map.get("remindstart") != null) {
            wrapper.ge(columnName, map.get("remindstart"));
        }
        if (map.get("remindend") != null) {
            wrapper.le(columnName, map.get("remindend"));
        }
        
        int totalCount = forumService.selectCount(wrapper);
        return R.ok().put("count", totalCount);
    }
}

Core Functional Modules

The platform encompasses several interconnected modules:

  1. Elderly Information Management: CRUD operations for resident records including personal details, health status, and care requirements.

  2. Family Portal: Enables registered family members to view care updates, communicate with staff, and access elderly resident information.

  3. Community Staff Administration: Manages personnel records, shifts, and assignment tracking for caregivers and medical staff.

  4. Service Catalog: Defines and manages available care services, scheduling, and service request workflows.

  5. Communication System: Supports threaded discussions, message exchanges, and announcement broadcasting.

  6. Announcement Board: Publishes system-wide notifications and policy updates with timestamps.

System Testing Approach

Testing Methodology

The platform underwent comprehensive testing including both glass-box and black-box testing strategies. Local deployment validated core functionality before integration testing.

Testing Principles Applied

  • Requirements Traceability: All test cases mapped to functional specifications
  • Incremental Coverage: Testing progressed from individual modules to integrated workflows
  • Pareto Analysis: Focus on high-impact areas representing majority of user interactions
  • Comprehensive Logic Coverage: Test scenarios designed to exercise all conditional branches

System Access Points

Environment URL Pattern
Admin Panel localhost:8080/project-name/admin/dist/index.html
User Portal localhost:8080/project-name/front/dist/index.html

Default credentials: admin / admin

Tags: java Spring Boot MySQL JSP Web Application

Posted on Mon, 18 May 2026 22:46:10 +0000 by Magneto