【计算机毕业设计】老年公寓信息管理系统

互联网发展至今,无论是其理论还是技术都已经成熟,而且它广泛参与在社会中的方方面面。它让信息都可以通过网络传播,搭配信息管理工具可以很好地为人们提供服务。针对信息管理混乱,出错率高,信息安全性差,劳动强度大,费时费力等问题,采用老年公寓信息管理可以有效管理,使信息管理能够更加科学和规范。
老年公寓信息管理在Eclipse环境中,使用Java语言进行编码,使用Mysql创建数据表保存本系统产生的数据。
总之,老年公寓信息管理集中管理信息,有着保密性强,效率高,存储空间大,成本低等诸多优点。它可以降低信息管理成本,实现信息管理计算机化。
互联网发展至今,无论是其理论还是技术都已经成熟,而且它广泛参与在社会中的方方面面。它让信息都可以通过网络传播,搭配信息管理工具可以很好地为人们提供服务。所以各行业,尤其是规模较大的企业和学校等都开始借助互联网和软件工具管理信息,传播信息,共享信息等等,以此可以增强自身实力,提高在同行业当中的竞争能力,并从各种激烈的竞争中获取发展的机会。针对床位信息信息管理混乱,出错率高,信息安全性差,劳动强度大,费时费力等问题,经过分析和考虑,在目前的情况下,可以引进一款老年公寓信息管理这样的现代化管理工具,这个工具就是解决上述问题的最好的解决方案。它不仅可以实时完成信息处理,还缩短床位信息信息管理流程,使其系统化和规范化。同时还可以减少工作量,节约床位信息信息管理需要的人力和资金。所以老年公寓信息管理是信息管理环节中不可缺少的工具,它对管理者来说非常重要。
现如今,信息种类变得越来越多,信息的容量也变得越来越大,这就是信息时代的标志。近些年,计算机科学发展得也越来越快,而且软件开发技术也越来越成熟,因此,在生活中的各个领域,只要存在信息管理,几乎都有计算机的影子,可以说很多行业都采用计算机的方式管理信息。信息计算机化处理相比手工操作,有着保密性强,效率高,存储空间大,成本低等诸多优点。针对床位信息信息管理,采用老年公寓信息管理可以有效管理,使信息管理能够更加科学和规范。
总之,在实际中使用老年公寓信息管理,其意义如下:
第一点:老年公寓信息管理的实际运用,可以帮助管理人员在短时间内完成信息处理工作;
第二点:通过系统页面的合理排版布局,可以更加直观的展示系统的内容,并且使用者可以随时阅读页面信息,随时操作系统提供的功能;
第三点:可以实现信息管理计算机化;
第四点:可以降低信息管理成本;

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

package com.controller;

import java.io.File;
import java.math.BigDecimal;
import java.net.URL;
import java.text.SimpleDateFormat;
import com.alibaba.fastjson.JSONObject;
import java.util.*;
import org.springframework.beans.BeanUtils;
import javax.servlet.http.HttpServletRequest;
import org.springframework.web.context.ContextLoader;
import javax.servlet.ServletContext;
import com.service.TokenService;
import com.utils.*;
import java.lang.reflect.InvocationTargetException;

import com.service.DictionaryService;
import org.apache.commons.lang3.StringUtils;
import com.annotation.IgnoreAuth;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.entity.*;
import com.entity.view.*;
import com.service.*;
import com.utils.PageUtils;
import com.utils.R;
import com.alibaba.fastjson.*;

/**
 * 费用
 * 后端接口
 * @author
 * @email
*/
@RestController
@Controller
@RequestMapping("/feiyong")
public class FeiyongController {
    private static final Logger logger = LoggerFactory.getLogger(FeiyongController.class);

    @Autowired
    private FeiyongService feiyongService;


    @Autowired
    private TokenService tokenService;
    @Autowired
    private DictionaryService dictionaryService;

    //级联表service

    @Autowired
    private YonghuService yonghuService;
    @Autowired
    private HugongService hugongService;


    /**
    * 后端列表
    */
    @RequestMapping("/page")
    public R page(@RequestParam Map<String, Object> params, HttpServletRequest request){
        logger.debug("page方法:,,Controller:{},,params:{}",this.getClass().getName(),JSONObject.toJSONString(params));
        String role = String.valueOf(request.getSession().getAttribute("role"));
        if(false)
            return R.error(511,"永不会进入");
        else if("老人".equals(role))
            params.put("yonghuId",request.getSession().getAttribute("userId"));
        else if("护工".equals(role))
            params.put("hugongId",request.getSession().getAttribute("userId"));
        if(params.get("orderBy")==null || params.get("orderBy")==""){
            params.put("orderBy","id");
        }
        PageUtils page = feiyongService.queryPage(params);

        //字典表数据转换
        List<FeiyongView> list =(List<FeiyongView>)page.getList();
        for(FeiyongView c:list){
            //修改对应字典表字段
            dictionaryService.dictionaryConvert(c, request);
        }
        return R.ok().put("data", page);
    }

    /**
    * 后端详情
    */
    @RequestMapping("/info/{id}")
    public R info(@PathVariable("id") Long id, HttpServletRequest request){
        logger.debug("info方法:,,Controller:{},,id:{}",this.getClass().getName(),id);
        FeiyongEntity feiyong = feiyongService.selectById(id);
        if(feiyong !=null){
            //entity转view
            FeiyongView view = new FeiyongView();
            BeanUtils.copyProperties( feiyong , view );//把实体数据重构到view中

            //修改对应字典表字段
            dictionaryService.dictionaryConvert(view, request);
            return R.ok().put("data", view);
        }else {
            return R.error(511,"查不到数据");
        }

    }

    /**
    * 后端保存
    */
    @RequestMapping("/save")
    public R save(@RequestBody FeiyongEntity feiyong, HttpServletRequest request){
        logger.debug("save方法:,,Controller:{},,feiyong:{}",this.getClass().getName(),feiyong.toString());

        String role = String.valueOf(request.getSession().getAttribute("role"));
        if(false)
            return R.error(511,"永远不会进入");

        Wrapper<FeiyongEntity> queryWrapper = new EntityWrapper<FeiyongEntity>()
            .eq("fangjian_name", feiyong.getFangjianName())
            .eq("feiyong_types", feiyong.getFeiyongTypes())
            ;

        logger.info("sql语句:"+queryWrapper.getSqlSegment());
        FeiyongEntity feiyongEntity = feiyongService.selectOne(queryWrapper);
        if(feiyongEntity==null){
            feiyong.setCreateTime(new Date());
            feiyongService.insert(feiyong);
            return R.ok();
        }else {
            return R.error(511,"表中有相同数据");
        }
    }

    /**
    * 后端修改
    */
    @RequestMapping("/update")
    public R update(@RequestBody FeiyongEntity feiyong, HttpServletRequest request){
        logger.debug("update方法:,,Controller:{},,feiyong:{}",this.getClass().getName(),feiyong.toString());

        String role = String.valueOf(request.getSession().getAttribute("role"));
//        if(false)
//            return R.error(511,"永远不会进入");
        //根据字段查询是否有相同数据
        Wrapper<FeiyongEntity> queryWrapper = new EntityWrapper<FeiyongEntity>()
            .notIn("id",feiyong.getId())
            .andNew()
            .eq("fangjian_name", feiyong.getFangjianName())
            .eq("feiyong_types", feiyong.getFeiyongTypes())
            ;

        logger.info("sql语句:"+queryWrapper.getSqlSegment());
        FeiyongEntity feiyongEntity = feiyongService.selectOne(queryWrapper);
        if(feiyongEntity==null){
            feiyongService.updateById(feiyong);//根据id更新
            return R.ok();
        }else {
            return R.error(511,"表中有相同数据");
        }
    }

    /**
    * 删除
    */
    @RequestMapping("/delete")
    public R delete(@RequestBody Integer[] ids){
        logger.debug("delete:,,Controller:{},,ids:{}",this.getClass().getName(),ids.toString());
        feiyongService.deleteBatchIds(Arrays.asList(ids));
        return R.ok();
    }


    /**
     * 批量上传
     */
    @RequestMapping("/batchInsert")
    public R save( String fileName){
        logger.debug("batchInsert方法:,,Controller:{},,fileName:{}",this.getClass().getName(),fileName);
        try {
            List<FeiyongEntity> feiyongList = new ArrayList<>();//上传的东西
            Map<String, List<String>> seachFields= new HashMap<>();//要查询的字段
            Date date = new Date();
            int lastIndexOf = fileName.lastIndexOf(".");
            if(lastIndexOf == -1){
                return R.error(511,"该文件没有后缀");
            }else{
                String suffix = fileName.substring(lastIndexOf);
                if(!".xls".equals(suffix)){
                    return R.error(511,"只支持后缀为xls的excel文件");
                }else{
                    URL resource = this.getClass().getClassLoader().getResource("static/upload/" + fileName);//获取文件路径
                    File file = new File(resource.getFile());
                    if(!file.exists()){
                        return R.error(511,"找不到上传文件,请联系管理员");
                    }else{
                        List<List<String>> dataList = PoiUtil.poiImport(file.getPath());//读取xls文件
                        dataList.remove(0);//删除第一行,因为第一行是提示
                        for(List<String> data:dataList){
                            //循环
                            FeiyongEntity feiyongEntity = new FeiyongEntity();
//                            feiyongEntity.setFangjianName(data.get(0));                    //标题 要改的
//                            feiyongEntity.setFeiyongTypes(Integer.valueOf(data.get(0)));   //类型 要改的
//                            feiyongEntity.setFeiyong(data.get(0));                    //所需费用 要改的
//                            feiyongEntity.setFeiyongContent("");//照片
//                            feiyongEntity.setCreateTime(date);//时间
                            feiyongList.add(feiyongEntity);


                            //把要查询是否重复的字段放入map中
                        }

                        //查询是否重复
                        feiyongService.insertBatch(feiyongList);
                        return R.ok();
                    }
                }
            }
        }catch (Exception e){
            return R.error(511,"批量插入数据异常,请联系管理员");
        }
    }






}

  • 9
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

JAVA编码选手

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值