Compare commits

..

No commits in common. "212fee01db131f5b137ca86c81b23d572c5086e0" and "6a8479737cdce3ccf0c4815c6002acceeaa925e5" have entirely different histories.

26 changed files with 149 additions and 1296 deletions

3
.idea/.gitignore vendored
View File

@ -1,3 +1,2 @@
# Default ignored files # Default ignored files
/workspace.xml /workspace.xml
/logs/*

View File

@ -17,7 +17,7 @@ import java.util.Date;
@Data @Data
public class SysUser extends BaseEntity { public class SysUser extends BaseEntity {
public static final String DEFAULT_PASSWORD = "123456"; public static final String DEFAULT_PASSWORD = "Aqpx123456";
/** 用户ID **/ /** 用户ID **/
@TableId(type = IdType.AUTO) @TableId(type = IdType.AUTO)

View File

@ -9,6 +9,7 @@ import com.org.system.pojo.LoginMenuTreeNode;
import com.org.utils.Constants; import com.org.utils.Constants;
import com.org.utils.MessageUtil; import com.org.utils.MessageUtil;
import com.org.utils.SecurityUtil; import com.org.utils.SecurityUtil;
import com.org.utils.StringUtils;
import com.org.utils.exception.CustomException; import com.org.utils.exception.CustomException;
import com.org.utils.exception.UserPasswordNotMatchException; import com.org.utils.exception.UserPasswordNotMatchException;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
@ -111,7 +112,7 @@ public class SysLoginService {
// 获取当前登录账号的当前角色信息 // 获取当前登录账号的当前角色信息
SysRole sysRole = null; SysRole sysRole = null;
for (SysRole role : sysRoleList) { if(SecurityUtil.getLoginUser().getCurrentRoleCode().equals(role.getCode())) sysRole = role; } for (SysRole role : sysRoleList) { if(SecurityUtil.getLoginUser().getCurrentRoleCode().equals(role.getCode())) sysRole = role; }
if(ObjectUtil.isEmpty(sysRole)) throw new CustomException("用户暂无权限,请联系管理员授权"); if(ObjectUtil.isEmpty(sysRole)) throw new CustomException("当前用户没有该角色");
SecurityUtil.getLoginUser().setCurrentRole(sysRole); SecurityUtil.getLoginUser().setCurrentRole(sysRole);
@ -124,13 +125,11 @@ public class SysLoginService {
// 获取当前登录账号当前角色的权限 // 获取当前登录账号当前角色的权限
Set<String> permissions = new HashSet<>(); Set<String> permissions = new HashSet<>();
/*if(SecurityUtil.getLoginUser().ifAdmin()){ if(SecurityUtil.getLoginUser().ifAdmin()){
permissions.add(PermissionService.ALL_PERMISSION); permissions.add(PermissionService.ALL_PERMISSION);
} else { } else {
for (SysMenu sysMenu : sysMenuList) { if(StringUtils.isNotEmpty(sysMenu.getPermission())) permissions.add(sysMenu.getPermission()); } for (SysMenu sysMenu : sysMenuList) { if(StringUtils.isNotEmpty(sysMenu.getPermission())) permissions.add(sysMenu.getPermission()); }
}*/ }
// todo 可登录的就能看到所有权限
permissions.add(PermissionService.ALL_PERMISSION);
SecurityUtil.getLoginUser().setPermissions(permissions); SecurityUtil.getLoginUser().setPermissions(permissions);
tokenService.refreshToken(SecurityUtil.getLoginUser()); tokenService.refreshToken(SecurityUtil.getLoginUser());

View File

@ -91,7 +91,7 @@ public class SysUserService extends ServiceImpl<SysUserMapper, SysUser> {
int countByAccount = this.count(queryWrapper); int countByAccount = this.count(queryWrapper);
//大于等于1个则表示重复 //大于等于1个则表示重复
if (countByAccount >= 1) { if (countByAccount >= 1) {
throw new CustomException("身份证号" + sysUser.getUserName() + "已存在"); throw new CustomException("用户名" + sysUser.getUserName() + "已存在");
} }
} }

View File

@ -5,6 +5,7 @@ import com.org.utils.AjaxResult;
import com.org.web.data.service.DataService; import com.org.web.data.service.DataService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
@ -18,8 +19,8 @@ public class DataController extends BaseController {
DataService dataService; DataService dataService;
@PostMapping("/statistics") @PostMapping("/statistics")
// @PreAuthorize("@ss.hasPermi('data:statistics')") @PreAuthorize("@ss.hasPermi('data:statistics')")
public AjaxResult statistics() { public AjaxResult add() {
return AjaxResult.success(dataService.queryDataStatistics()); return AjaxResult.success(dataService.queryDataStatistics());
} }

View File

@ -3,7 +3,6 @@ package com.org.web.data.domain;
import lombok.Data; import lombok.Data;
import java.math.BigDecimal;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -13,33 +12,17 @@ import java.util.List;
@Data @Data
public class DataStatistics { public class DataStatistics {
List<DataStatisticsItem> sexList = new ArrayList<>(); List<DataStatisticsItem> villageCountList = new ArrayList<>();
List<DataStatisticsItem> ageList = new ArrayList<>();
List<DataStatisticsItem> nursingLevelList = new ArrayList<>();
List<DataStatisticsItem> ifHelpPoorList = new ArrayList<>(); List<DataStatisticsItem> ifHelpPoorList = new ArrayList<>();
List<DataStatisticsItem> sexList = new ArrayList<>();
int ljrzCount = 0; List<DataStatisticsItem> nursingLevelList = new ArrayList<>();
int jnrzCount = 0;
int byxzCount = 0;
int mqzyCount = 0;
int wcjyCount = 0;
int jnjyCount = 0;
BigDecimal jzgyRate = BigDecimal.ZERO; List<DataStatisticsItem> ageList = new ArrayList<>();
BigDecimal fsgyRate = BigDecimal.ZERO;
// 在院人数村籍榜 List<DataStatisticsItem> inHospitalList = new ArrayList<>();
List<DataStatisticsItem> villageRankList = new ArrayList<>();
// 入住情况
List<DataStatisticsItem> roomTypeList = new ArrayList<>();
List<DataStatisticsItem> roomCountList = new ArrayList<>(); List<DataStatisticsItem> roomCountList = new ArrayList<>();
// 各村供养情况
List<DataStatisticsItem> villageCountList = new ArrayList<>();
} }

View File

@ -13,20 +13,15 @@ public class DataStatisticsItem {
/** /**
* 子项名称 * 子项名称
*/ */
private String name; private String itemName;
/**
* 子项备注 可存放数据字典的value值
*/
private Integer id;
/** /**
* 子项值 * 子项值
*/ */
private int value; private int itemValue;
/** /**
* 子项2 * 子项备注 可存放数据字典的value
*/ */
private int value2; private String itemRemark;
} }

View File

@ -6,80 +6,80 @@ import com.org.web.person.domain.BcPersonSupport;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select; import org.apache.ibatis.annotations.Select;
import java.math.BigDecimal;
import java.util.List; import java.util.List;
@Mapper @Mapper
public interface DataMapper extends BaseMapper<BcPersonSupport> { public interface DataMapper extends BaseMapper<BcPersonSupport> {
// 是否精准扶贫 // 各村供养人数
@Select("SELECT " + @Select("select c.name as item_name, c.value as item_remark, " +
" '是' AS name, " +
" 1 as id, " +
" SUM(CASE WHEN if_help_poor = 1 THEN 1 ELSE 0 END) AS value " +
"FROM bc_person_support " +
"where is_delete = 0 " +
"and type = 1 " +
"and support_type = 1 " +
"UNION " +
"SELECT " +
" '否' AS name, " +
" 0 as id, " +
" SUM(CASE WHEN if_help_poor = 0 THEN 1 ELSE 0 END) AS value " +
"FROM bc_person_support " +
"where is_delete = 0 " +
"and type = 1 " +
"and support_type = 1 ")
List<DataStatisticsItem> listIfHelpPoor();
// 性别
@Select("SELECT " +
" '男' AS name, " +
" 1 as id, " +
" SUM(CASE WHEN sex = 1 THEN 1 ELSE 0 END) AS value " +
"FROM bc_person_support " +
"where is_delete = 0 " +
"and type = 1 " +
"and support_type = 1 " +
"UNION " +
"SELECT " +
" '女' AS name, " +
" 0 as id, " +
" SUM(CASE WHEN sex = 0 THEN 1 ELSE 0 END) AS value " +
"FROM bc_person_support " +
"where is_delete = 0 " +
"and type = 1 " +
"and support_type = 1 ")
List<DataStatisticsItem> listSex();
// 护理等级
@Select("select c.name as name, c.value as id, " +
" (select count(1) " + " (select count(1) " +
" from bc_person_support a " + " from bc_person_support a " +
" where a.is_delete = 0 " + " where a.is_delete = 0 " +
" and a.type = 1 " + " and a.type = 1 " +
" and a.support_type = 1 " + " and IFNULL(a.village, '') != '' " +
" and IFNULL(a.nursing_level, '') != '' " + " and a.village = c.value) as item_value " +
" and a.nursing_level = c.value) as value " +
" from sys_data_dictionary_item c " + " from sys_data_dictionary_item c " +
" where c.is_delete = 0 " + " where c.is_delete = 0 " +
" and c.dictionary_code = '0021' " + " and c.dictionary_code = '0040' ")
" order by c.value ") List<DataStatisticsItem> listVillageCount();
// 是否精准扶贫
@Select("SELECT " +
" '是' AS item_name, " +
" 1 as item_remark, " +
" SUM(CASE WHEN if_help_poor = 1 THEN 1 ELSE 0 END) AS item_value " +
"FROM bc_person_support " +
"UNION " +
"SELECT " +
" '否' AS item_name, " +
" 0 as item_remark, " +
" SUM(CASE WHEN if_help_poor = 0 THEN 1 ELSE 0 END) AS item_value " +
"FROM bc_person_support " +
"where is_delete = 0 " +
"and type = 1 ")
List<DataStatisticsItem> listIfHelpPoor();
// 性别
@Select("SELECT " +
" '男' AS item_name, " +
" 1 as item_remark, " +
" SUM(CASE WHEN sex = 1 THEN 1 ELSE 0 END) AS item_value " +
"FROM bc_person_support " +
"UNION " +
"SELECT " +
" '女' AS item_name, " +
" 0 as item_remark, " +
" SUM(CASE WHEN sex = 0 THEN 1 ELSE 0 END) AS item_value " +
"FROM bc_person_support " +
"where is_delete = 0 " +
"and type = 1 ")
List<DataStatisticsItem> listSex();
// 护理等级
@Select("select c.name as item_name, c.value as item_remark, " +
" (select count(1) " +
" from bc_person_support a " +
" where a.is_delete = 0 " +
" and a.type = 1 " +
" and IFNULL(a.village, '') != '' " +
" and a.village = c.value) as item_value " +
" from sys_data_dictionary_item c " +
" where c.is_delete = 0 " +
" and c.dictionary_code = '0040' ")
List<DataStatisticsItem> listNursingLevel(); List<DataStatisticsItem> listNursingLevel();
// 年龄区间 // 年龄区间
@Select("SELECT " + @Select("SELECT " +
" age_ranges.age_group as name, id, " + " age_ranges.age_group as item_name, " +
" COALESCE(COUNT(age_table.id_card_no), 0) AS value " + " COALESCE(COUNT(age_table.id_card_no), 0) AS item_value " +
"FROM ( " + "FROM ( " +
" SELECT '50岁以下' AS age_group, 0 AS min_age, 49 AS max_age, 1 AS id " + " SELECT '50岁以下' AS age_group, 0 AS min_age, 49 AS max_age " +
" UNION SELECT '50-59岁', 50, 59, 2 " + " UNION SELECT '50-59岁', 50, 59 " +
" UNION SELECT '60-69岁', 60, 69, 3 " + " UNION SELECT '60-69岁', 60, 69 " +
" UNION SELECT '70-79岁 ', 70, 79, 4 " + " UNION SELECT '70-79岁', 70, 79 " +
" UNION SELECT '80-89岁', 80, 89, 5 " + " UNION SELECT '80-89岁', 80, 89 " +
" UNION SELECT '90岁以上', 90, 999, 6 " + " UNION SELECT '90岁以上', 90, 999 " +
") AS age_ranges " + ") AS age_ranges " +
"LEFT JOIN ( " + "LEFT JOIN ( " +
" SELECT " + " SELECT " +
@ -88,189 +88,43 @@ public interface DataMapper extends BaseMapper<BcPersonSupport> {
" FROM bc_person_support " + " FROM bc_person_support " +
" where is_delete = 0 " + " where is_delete = 0 " +
" and type = 1 " + " and type = 1 " +
" and support_type = 1 " +
") AS age_table ON age_table.age BETWEEN age_ranges.min_age AND age_ranges.max_age " + ") AS age_table ON age_table.age BETWEEN age_ranges.min_age AND age_ranges.max_age " +
"GROUP BY age_ranges.age_group, id ") "GROUP BY age_ranges.age_group ")
List<DataStatisticsItem> listAgeCount(); List<DataStatisticsItem> listAgeCount();
// 是否在 // 是否在
@Select("SELECT " + @Select("SELECT " +
" '是' AS name, " + " '是' AS item_name, " +
" 1 as id, " + " 1 as item_remark, " +
" SUM(CASE WHEN is_in_hospital = 1 THEN 1 ELSE 0 END) AS value " + " SUM(CASE WHEN is_in_hospital = 1 THEN 1 ELSE 0 END) AS item_value " +
"FROM bc_person_support " + "FROM bc_person_support " +
"where is_delete = 0 " +
"and type = 1 " +
"and support_type = 1 " +
"UNION " + "UNION " +
"SELECT " + "SELECT " +
" '否' AS name, " + " '否' AS item_name, " +
" 0 as id, " + " 0 as item_remark, " +
" SUM(CASE WHEN is_in_hospital = 0 THEN 1 ELSE 0 END) AS value " + " SUM(CASE WHEN is_in_hospital = 0 THEN 1 ELSE 0 END) AS item_value " +
"FROM bc_person_support " + "FROM bc_person_support " +
"where is_delete = 0 " + "where is_delete = 0 " +
"and type = 1 " + "and type = 1 ")
"and support_type = 1 ")
List<DataStatisticsItem> listInHospital(); List<DataStatisticsItem> listInHospital();
/** ----------------------------------------- center ------------------------------ */
// 在院人数村籍榜
@Select("select c.name as name, c.value as id, " +
" (select count(1) " +
" from bc_person_support a " +
" where a.is_delete = 0 " +
" and a.type = 1 " +
" and a.support_type = 1 " +
" and IFNULL(a.village, '') != '' " +
" and a.village = c.value) as value " +
" from sys_data_dictionary_item c " +
" where c.is_delete = 0 " +
" and c.dictionary_code = '0040' " +
" order by value desc ")
List<DataStatisticsItem> listVillageRank();
// 累计入住数
@Select("select count(1) " +
"from bc_hospital_record " +
"where is_delete = 0")
int getLjrzCount();
// 今年入住数
@Select("select count(1) " +
"from bc_hospital_record " +
"where is_delete = 0 " +
"and year(check_in_time) = year(curdate()) ")
int getJnrzCount();
// 本月新增数
@Select("select count(1) " +
"from bc_hospital_record " +
"where is_delete = 0 " +
"and year(check_in_time) = year(curdate()) " +
"and month(check_in_time) = month(curdate()) ")
int getByxzCount();
// 目前在院数
@Select("select count(1) " +
"from bc_person_support " +
"where is_delete = 0 " +
" and type = 1 " +
" and support_type = 1 " +
" and is_in_hospital = 1")
int getMqzyCount();
// 外出就医数
@Select("select count(1) " +
"from bc_person_support " +
"where is_delete = 0 " +
" and type = 1 " +
" and support_type = 1 " +
" and is_in_hospital = 0")
int getWcjyCount();
// 今年减员数
@Select("select count(1) " +
"from bc_hospital_record " +
"where is_delete = 0 " +
" and year(check_out_time) = year(curdate())")
int getJnjyCount();
// 集中供养率
@Select("select ROUND((select count(1) " +
" from bc_person_support a " +
" where a.is_delete = 0 " +
" and a.type = 1 " +
" and a.support_type = 1) / " +
" (select count(1) " +
" from bc_person_support a " +
" where a.is_delete = 0 " +
" and a.type = 1) * 100)")
BigDecimal getJzgyl();
// 分散供养率
@Select("select ROUND((select count(1) " +
" from bc_person_support a " +
" where a.is_delete = 0 " +
" and a.type = 1 " +
" and a.support_type = 2) / " +
" (select count(1) " +
" from bc_person_support a " +
" where a.is_delete = 0 " +
" and a.type = 1) * 100)")
BigDecimal getFsgyl();
/** ----------------------------------------- center ------------------------------ */
/** ----------------------------------------- 入住情况统计 ------------------------------ */
@Select("select c.name as name, " +
" c.value as id, " +
" (select count(1) " +
" from bc_room a " +
" where a.is_delete = 0 " +
" and a.room_type = c.value) as value " +
"from sys_data_dictionary_item c " +
"where c.is_delete = 0 " +
" and c.dictionary_code = '0010' " +
"order by c.value")
List<DataStatisticsItem> listRoomType();
// 房源入住情况 // 房源入住情况
@Select("select '供养床位' as name, " + @Select("SELECT " +
" (select count(1) " + " '总房源' AS item_name, " +
" from bc_room_bed a " + " 0 as item_remark, " +
" left join bc_room b on a.room_id = b.id " + " count(1) AS item_value " +
" where a.is_delete = 0 " + "FROM bc_room a " +
" and b.is_delete = 0 " + "left join bc_room_bed b on a.id = b.room_id " +
" and b.room_type = 1) as value, " + "where a.is_delete = 0 " +
" (select count(1) " + "and b.is_delete = 0 " +
" from bc_room_bed a " + "and a.room_type = 1 " +
" left join bc_hospital_record b on a.id = b.bed_id " + "UNION " +
" where a.is_delete = 0 " + "select '入住房源' AS item_name, " +
" and b.is_delete = 0 " + " 1 as item_remark, " +
" and b.check_out_time is null) as value2 " + " count(1) AS item_value " +
"from bc_hospital_record a " +
"union " + "where a.is_delete = 0 " +
"and check_out_time is null")
"select '供养房间' as name, " +
" (select count(1) " +
" from bc_room " +
" where is_delete = 0 " +
" and room_type = 1) as value, " +
" (select count(distinct a.id) " +
" from bc_room a " +
" left join bc_hospital_record b on a.id = b.room_id " +
" where a.is_delete = 0 " +
" and b.is_delete = 0 " +
" and b.check_out_time is null) as value2 ")
List<DataStatisticsItem> listRoomCount(); List<DataStatisticsItem> listRoomCount();
/** ----------------------------------------- 入住情况统计 ------------------------------ */
// 各村供养人数
@Select("select c.name as name, c.value as id, " +
" (select count(1) " +
" from bc_person_support a " +
" where a.is_delete = 0 " +
" and a.type = 1 " +
" and IFNULL(a.village, '') != '' " +
" and a.village = c.value) as value, " +
" (select count(1) " +
" from bc_person_support a " +
" where a.is_delete = 0 " +
" and a.type = 1 " +
" and a.support_type = 1 " +
" and IFNULL(a.village, '') != '' " +
" and a.village = c.value) as value2 " +
" from sys_data_dictionary_item c " +
" where c.is_delete = 0 " +
" and c.dictionary_code = '0040' " +
" order by c.value ")
List<DataStatisticsItem> listVillageCount();
} }

View File

@ -9,7 +9,6 @@ import com.org.web.person.domain.BcPersonSupport;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.util.List; import java.util.List;
@Service @Service
@ -20,66 +19,28 @@ public class DataService extends ServiceImpl<DataMapper, BcPersonSupport> {
* 列表 * 列表
*/ */
public DataStatistics queryDataStatistics() { public DataStatistics queryDataStatistics() {
List<DataStatisticsItem> sexList = baseMapper.listSex();
List<DataStatisticsItem> ageList = baseMapper.listAgeCount();
List<DataStatisticsItem> nursingLevelList = baseMapper.listNursingLevel();
List<DataStatisticsItem> ifHelpPoorList = baseMapper.listIfHelpPoor();
int ljrzCount = baseMapper.getLjrzCount();
int jnrzCount = baseMapper.getJnrzCount();
int byxzCount = baseMapper.getByxzCount();
int mqzyCount = baseMapper.getMqzyCount();
int wcjyCount = baseMapper.getWcjyCount();
int jnjyCount = baseMapper.getJnjyCount();
BigDecimal jzgyl = baseMapper.getJzgyl();
BigDecimal fsgyl = baseMapper.getFsgyl();
List<DataStatisticsItem> villageRankList = baseMapper.listVillageRank();
// 修改value总数->剩余数
List<DataStatisticsItem> roomCountList = baseMapper.listRoomCount();
// 供养床位
DataStatisticsItem gycw = new DataStatisticsItem();
if (roomCountList != null && !roomCountList.isEmpty()) {
gycw.setName("供养床位");
gycw.setId(1);
gycw.setValue(roomCountList.get(0).getValue()); // 床位总数
}
for (DataStatisticsItem item : roomCountList) {
item.setValue(item.getValue() - item.getValue2());
}
List<DataStatisticsItem> roomTypeList = baseMapper.listRoomType();
List<DataStatisticsItem> villageCountList = baseMapper.listVillageCount(); List<DataStatisticsItem> villageCountList = baseMapper.listVillageCount();
List<DataStatisticsItem> ifHelpPoorList = baseMapper.listIfHelpPoor();
List<DataStatisticsItem> sexList = baseMapper.listSex();
List<DataStatisticsItem> nursingLevelList = baseMapper.listNursingLevel();
List<DataStatisticsItem> ageList = baseMapper.listAgeCount();
List<DataStatisticsItem> inHospitalList = baseMapper.listInHospital();
List<DataStatisticsItem> roomCountList = baseMapper.listRoomCount();
DataStatistics dataStatistics = new DataStatistics(); DataStatistics dataStatistics = new DataStatistics();
dataStatistics.setSexList(sexList);
dataStatistics.setAgeList(ageList);
dataStatistics.setNursingLevelList(nursingLevelList);
dataStatistics.setIfHelpPoorList(ifHelpPoorList);
dataStatistics.setVillageRankList(villageRankList);
dataStatistics.setLjrzCount(ljrzCount);
dataStatistics.setJnrzCount(jnrzCount);
dataStatistics.setByxzCount(byxzCount);
dataStatistics.setMqzyCount(mqzyCount);
dataStatistics.setWcjyCount(wcjyCount);
dataStatistics.setJnjyCount(jnjyCount);
dataStatistics.setJzgyRate(jzgyl);
dataStatistics.setFsgyRate(fsgyl);
dataStatistics.setRoomCountList(roomCountList);
roomTypeList.add(gycw);
dataStatistics.setRoomTypeList(roomTypeList);
dataStatistics.setVillageCountList(villageCountList); dataStatistics.setVillageCountList(villageCountList);
dataStatistics.setIfHelpPoorList(ifHelpPoorList);
dataStatistics.setSexList(sexList);
dataStatistics.setNursingLevelList(nursingLevelList);
dataStatistics.setAgeList(ageList);
dataStatistics.setInHospitalList(inHospitalList);
dataStatistics.setRoomCountList(roomCountList);
return dataStatistics; return dataStatistics;
} }

View File

@ -80,17 +80,4 @@ public class BcHonorShowController extends BaseController {
} }
/**
* 设置置顶
*/
@PostMapping("/setTop")
@PreAuthorize("@ss.hasPermi('honor:show:add')")
@Log(title = "荣誉橱窗展示置顶", businessType = BusinessType.UPDATE)
public AjaxResult setTop(@Validated @RequestBody IdParams params) {
log.info("BcHonorShowController - setTop params:{}", params);
bcHonorShowService.setTop(params.getId());
return AjaxResult.success();
}
} }

View File

@ -40,10 +40,5 @@ public class BcHonorShow extends BaseEntity {
*/ */
private String files; private String files;
/**
* 是否置顶 1- 0-
*/
private Integer ifTop;
public BcHonorShow() {} public BcHonorShow() {}
} }

View File

@ -3,9 +3,7 @@ package com.org.web.honor.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.org.web.honor.domain.BcHonorShow; import com.org.web.honor.domain.BcHonorShow;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select; import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import java.util.List; import java.util.List;
@ -21,19 +19,8 @@ public interface BcHonorShowMapper extends BaseMapper<BcHonorShow> {
" and title like concat('%', #{title}, '%') " + " and title like concat('%', #{title}, '%') " +
" </if> " + " </if> " +
" order by if_top desc,create_time desc " + " order by create_time desc " +
"</script>") "</script>")
List<BcHonorShow> queryList(BcHonorShow params); List<BcHonorShow> queryList(BcHonorShow params);
// 置顶
@Update("<script>" +
"update bc_honor_show " +
"set if_top = #{ifTop} " +
"where 1 = 1 " +
" <if test = \"id != null \"> " +
" AND id = #{id} " +
" </if>" +
"</script>")
void setTop(@Param("id") Long id, @Param("ifTop") Integer ifTop);
} }

View File

@ -57,24 +57,5 @@ public class BcHonorShowService extends ServiceImpl<BcHonorShowMapper, BcHonorSh
public List<BcHonorShow> listShow(BcHonorShow params) { public List<BcHonorShow> listShow(BcHonorShow params) {
return baseMapper.queryList(params); return baseMapper.queryList(params);
} }
/**
* 置顶操作
*/
public void setTop(Long id) {
log.info("BcHonorShowService - setTop id:{}", id);
BcHonorShow bcHonorShow = getById(id);
if (ObjectUtil.isEmpty(bcHonorShow)) {
throw new CustomException("数据不存在");
}
// 取消 其他数据的 置顶状态
baseMapper.setTop(null, 0);
// 设置当前数据 为置顶
baseMapper.setTop(id, 1);
}
} }

View File

@ -1,11 +1,9 @@
package com.org.web.hospital.domain; package com.org.web.hospital.domain;
import cn.hutool.core.date.DatePattern;
import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.org.system.entity.BaseEntity; import com.org.system.entity.BaseEntity;
import lombok.Data; import lombok.Data;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
@ -43,13 +41,11 @@ public class BcHospitalRecord extends BaseEntity {
/** /**
* 入住时间 * 入住时间
*/ */
@JsonFormat(pattern = DatePattern.NORM_DATE_PATTERN, timezone = "GMT+8")
private Date checkInTime; private Date checkInTime;
/** /**
* 退房时间 * 退房时间
*/ */
@JsonFormat(pattern = DatePattern.NORM_DATE_PATTERN, timezone = "GMT+8")
private Date checkOutTime; private Date checkOutTime;
/** /**
@ -79,12 +75,6 @@ public class BcHospitalRecord extends BaseEntity {
@TableField(exist = false) @TableField(exist = false)
private Integer type; private Integer type;
/**
* 退房时间类型 1-全部 2-今年
*/
@TableField(exist = false)
private Integer returnType;
/** /**
* 人员名称 * 人员名称
*/ */
@ -96,7 +86,7 @@ public class BcHospitalRecord extends BaseEntity {
@TableField(exist = false) @TableField(exist = false)
private String roomName; private String roomName;
/** /**
* 床位 * 床位名称
*/ */
@TableField(exist = false) @TableField(exist = false)
private String bedName; private String bedName;

View File

@ -5,7 +5,6 @@ import com.org.web.hospital.domain.BcHospitalRecord;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select; import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import java.util.List; import java.util.List;
@ -37,17 +36,12 @@ public interface BcHospitalRecordMapper extends BaseMapper<BcHospitalRecord> {
" <if test = 'type != null'> " + " <if test = 'type != null'> " +
" <choose> " + " <choose> " +
/*查询入院记录*/
" <when test=\"type == 1\"> " + " <when test=\"type == 1\"> " +
" and a.check_out_time is null " + " and a.check_out_time is null " +
" </when> " + " </when> " +
" <when test=\"type == 2\"> " + " <when test=\"type == 2\"> " +
" and a.check_out_time is not null " + // " and a.check_out_time is not null " +
" and 1 = 1 " +
" <if test = 'returnType != null and returnType == 2'>" +
" and year(a.check_out_time) = year(curdate()) " +
" </if>" +
" </when> " + " </when> " +
" </choose> " + " </choose> " +
" </if> " + " </if> " +
@ -63,9 +57,6 @@ public interface BcHospitalRecordMapper extends BaseMapper<BcHospitalRecord> {
" and a.room_id = #{roomId} " + " and a.room_id = #{roomId} " +
" </if>" + " </if>" +
" <if test = 'bedId != null '>" +
" and a.bed_id = #{bedId} " +
" </if>" +
" order by a.create_time desc " + " order by a.create_time desc " +
"</script>") "</script>")
@ -84,9 +75,4 @@ public interface BcHospitalRecordMapper extends BaseMapper<BcHospitalRecord> {
"and check_out_time is null "+ "and check_out_time is null "+
"</script>" ) "</script>" )
BcHospitalRecord getLastRecordByPersonId(@Param("personId") Long personId, @Param("bedId") Long bedId); BcHospitalRecord getLastRecordByPersonId(@Param("personId") Long personId, @Param("bedId") Long bedId);
@Update("update bc_hospital_record set is_delete = 1, delete_by = #{deleteBy}, delete_time = now() " +
"where is_delete = 0 " +
"and person_id = #{personId} ")
void deleteByPersonId(@Param("personId") Long personId, @Param("deleteBy") Long deleteBy);
} }

View File

@ -47,9 +47,7 @@ public class BcHospitalRecordService extends ServiceImpl<BcHospitalRecordMapper,
record.setCreateTime(new Date()); record.setCreateTime(new Date());
record.setIsDelete(YesOrNoState.NO.getState()); record.setIsDelete(YesOrNoState.NO.getState());
if (null == record.getCheckInTime()) { record.setCheckInTime(new Date()); // 入住时间
record.setCheckInTime(new Date()); // 入住时间
}
} else { } else {
if (record.getType() == 1) checkParams(record, true); if (record.getType() == 1) checkParams(record, true);
@ -60,10 +58,7 @@ public class BcHospitalRecordService extends ServiceImpl<BcHospitalRecordMapper,
if (record.getType() == 2) { if (record.getType() == 2) {
// 退房 查询是否存在入住信息 // 退房 查询是否存在入住信息
// BcHospitalRecord lastRecordByPersonId = baseMapper.getLastRecordByPersonId(record.getPersonId()); // BcHospitalRecord lastRecordByPersonId = baseMapper.getLastRecordByPersonId(record.getPersonId());
if (null == record.getCheckOutTime()) { record.setCheckOutTime(new Date()); // 退房时间
record.setCheckOutTime(new Date()); // 退房时间
}
} }
} }
saveOrUpdate(record); saveOrUpdate(record);
@ -155,33 +150,11 @@ public class BcHospitalRecordService extends ServiceImpl<BcHospitalRecordMapper,
return null; return null;
} }
/**
* 根据床位查询入院记录
*/
public BcHospitalRecord getRecordByBedId(Long bedId) {
BcHospitalRecord record = new BcHospitalRecord();
record.setBedId(bedId);
record.setType(1);
List<BcHospitalRecord> bcHospitalRecords = baseMapper.checkList(record);
if (null != bcHospitalRecords && !bcHospitalRecords.isEmpty()) {
BcHospitalRecord hospitalRecord = bcHospitalRecords.get(0);
BcPersonSupport person = personSupportService.getById(hospitalRecord.getPersonId());
if (ObjectUtil.isNotNull(person)) {
hospitalRecord.setPersonName(person.getName());
}
return hospitalRecord;
}
return null;
}
/** /**
* 删除 * 删除
*/ */
public boolean del(Long id) { public boolean del(Long id) {
log.info("BcHospitalRecordService - del id:{}", id); log.info("BcHonorShowService - del id:{}", id);
BcHospitalRecord hospitalRecord = getById(id); BcHospitalRecord hospitalRecord = getById(id);
if (ObjectUtil.isEmpty(hospitalRecord)) { if (ObjectUtil.isEmpty(hospitalRecord)) {
@ -193,12 +166,5 @@ public class BcHospitalRecordService extends ServiceImpl<BcHospitalRecordMapper,
return updateById(hospitalRecord); return updateById(hospitalRecord);
} }
/**
* 删除
*/
public void delByPersonId(Long personId) {
log.info("BcHospitalRecordService - delByPersonId personId:{}", personId);
baseMapper.deleteByPersonId(personId, SecurityUtil.getUserId());
}
} }

View File

@ -101,11 +101,6 @@ public class BcPersonService extends BaseEntity {
*/ */
private String certificate; private String certificate;
/**
* 政治面貌 数据字典0060
*/
private Integer politicalOutlook;
/** /**
* 账号名称 * 账号名称
*/ */

View File

@ -27,7 +27,7 @@ public interface BcPersonServiceMapper extends BaseMapper<BcPersonService> {
" and phone like concat('%', #{phone}, '%') " + " and phone like concat('%', #{phone}, '%') " +
" </if> " + " </if> " +
" order by create_time " + " order by create_time desc " +
"</script>") "</script>")
List<BcPersonService> queryList(BcPersonService person); List<BcPersonService> queryList(BcPersonService person);

View File

@ -79,7 +79,7 @@ public interface BcPersonSupportMapper extends BaseMapper<BcPersonSupport> {
" and age BETWEEN 80 AND 89 " + " and age BETWEEN 80 AND 89 " +
" </when> " + " </when> " +
" <when test=\"ageRange == 6\"> " + " <when test=\"ageRange == 6\"> " +
" and age >= 90 " + " and age > 90 " +
" </when> " + " </when> " +
" <otherwise> " + " <otherwise> " +
" and 1=1 " + " and 1=1 " +

View File

@ -3,7 +3,9 @@ package com.org.web.person.service;
import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import cn.hutool.crypto.digest.DigestUtil;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.org.system.config.security.Md5PasswordEncoder;
import com.org.system.entity.SysRole; import com.org.system.entity.SysRole;
import com.org.system.entity.SysUser; import com.org.system.entity.SysUser;
import com.org.system.enums.YesOrNoState; import com.org.system.enums.YesOrNoState;
@ -64,7 +66,16 @@ public class BcPersonSupportService extends ServiceImpl<BcPersonSupportMapper, B
BeanUtils.copyProperties(person, sysUser); BeanUtils.copyProperties(person, sysUser);
sysUser.setUserName(person.getIdCardNo()); sysUser.setUserName(person.getIdCardNo());
sysUser.setNickName(person.getName()); sysUser.setNickName(person.getName());
sysUserService.saveOrUpdate(sysUser);
sysUser.setSalt(DigestUtil.md5Hex(sysUser.getUserName()));
Md5PasswordEncoder md5PasswordEncoder = Md5PasswordEncoder.getInstance();
md5PasswordEncoder.setSalt(sysUser.getSalt());
sysUser.setPassword(md5PasswordEncoder.encode(SysUser.DEFAULT_PASSWORD));
sysUser.setStatus(1);
sysUser.setCreateTime(new Date());
sysUser.setIsDelete(YesOrNoState.NO.getState());
sysUserService.save(sysUser);
// 保存用户角色信息 // 保存用户角色信息
sysUserRoleService.save(sysUser.getId(), CollectionUtil.newArrayList(person.getType() == 1 ? SysRole.SUPPORT_ROLE : SysRole.TEND_ROLE)); sysUserRoleService.save(sysUser.getId(), CollectionUtil.newArrayList(person.getType() == 1 ? SysRole.SUPPORT_ROLE : SysRole.TEND_ROLE));
@ -146,8 +157,6 @@ public class BcPersonSupportService extends ServiceImpl<BcPersonSupportMapper, B
// 删除家庭成员 // 删除家庭成员
familyService.delByPersonId(person.getId()); familyService.delByPersonId(person.getId());
hospitalRecordService.delByPersonId(person.getId());
return updateById(person); return updateById(person);
} }
@ -185,7 +194,7 @@ public class BcPersonSupportService extends ServiceImpl<BcPersonSupportMapper, B
// 查询居住房间 // 查询居住房间
BcHospitalRecord record = hospitalRecordService.getRecordByPersonId(personVO.getId()); BcHospitalRecord record = hospitalRecordService.getRecordByPersonId(personVO.getId());
if (null != record) { if (null != record) {
personVO.setRoomBed(record.getBedName()); personVO.setRoomBed(record.getRoomName() + record.getBedName());
} }
if (personVO.getType() == 1) { if (personVO.getType() == 1) {

View File

@ -89,9 +89,9 @@ public class BcRoomController extends BaseController {
@PostMapping("/listAllRoom") @PostMapping("/listAllRoom")
@PreAuthorize("@ss.hasAnyPermi('room:listBed')") @PreAuthorize("@ss.hasAnyPermi('room:listBed')")
@Log(title = "床位列表查询", businessType = BusinessType.SELECT) @Log(title = "床位列表查询", businessType = BusinessType.SELECT)
public AjaxResult listAllRoom( @RequestBody BcRoom room) { public AjaxResult listAllRoom() {
List<BcRoom> list = bcRoomService.getBaseMapper().queryList(room); List<BcRoom> list = bcRoomService.getBaseMapper().queryList(new BcRoom());
return AjaxResult.success(list); return AjaxResult.success(list);
} }

View File

@ -1,7 +1,6 @@
package com.org.web.room.domain; package com.org.web.room.domain;
import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import com.org.system.entity.BaseEntity; import com.org.system.entity.BaseEntity;
@ -21,7 +20,7 @@ public class BcRoomBed extends BaseEntity {
private Long id; private Long id;
/** /**
* 床位 * 床位名称
*/ */
private String name; private String name;
@ -30,16 +29,4 @@ public class BcRoomBed extends BaseEntity {
*/ */
private Long roomId; private Long roomId;
/**
* 入住人员id
*/
@TableField(exist = false)
private Long personId;
/**
* 人员名称
*/
@TableField(exist = false)
private String personName;
} }

View File

@ -8,8 +8,6 @@ import com.org.system.enums.YesOrNoState;
import com.org.system.service.SysDataDictionaryItemService; import com.org.system.service.SysDataDictionaryItemService;
import com.org.utils.SecurityUtil; import com.org.utils.SecurityUtil;
import com.org.utils.exception.CustomException; import com.org.utils.exception.CustomException;
import com.org.web.hospital.domain.BcHospitalRecord;
import com.org.web.hospital.service.BcHospitalRecordService;
import com.org.web.room.domain.BcRoom; import com.org.web.room.domain.BcRoom;
import com.org.web.room.domain.BcRoomBed; import com.org.web.room.domain.BcRoomBed;
import com.org.web.room.mapper.BcRoomMapper; import com.org.web.room.mapper.BcRoomMapper;
@ -32,9 +30,6 @@ public class BcRoomService extends ServiceImpl<BcRoomMapper, BcRoom> {
@Autowired @Autowired
SysDataDictionaryItemService sysDataDictionaryItemService; SysDataDictionaryItemService sysDataDictionaryItemService;
@Autowired
BcHospitalRecordService hospitalRecordService;
/** /**
* 新增或编辑 * 新增或编辑
*/ */
@ -72,17 +67,6 @@ public class BcRoomService extends ServiceImpl<BcRoomMapper, BcRoom> {
// 查询床位数据 // 查询床位数据
List<BcRoomBed> roomBedList = bcRoomBedService.listByRoomId(id); List<BcRoomBed> roomBedList = bcRoomBedService.listByRoomId(id);
// 为供养房 查询入住信息
if (bcRoom.getRoomType() == 1) {
for (BcRoomBed roomBed : roomBedList) {
BcHospitalRecord recordByBedId = hospitalRecordService.getRecordByBedId(roomBed.getId());
if (null != recordByBedId) {
roomBed.setPersonId(recordByBedId.getPersonId());
roomBed.setPersonName(recordByBedId.getPersonName());
}
}
}
bcRoom.setRoomBedList(roomBedList); bcRoom.setRoomBedList(roomBedList);

View File

@ -23,10 +23,11 @@ spring:
datasource: datasource:
driver-class-name: com.mysql.cj.jdbc.Driver driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://localhost:3306/welfare?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowPublicKeyRetrieval=true url: jdbc:mysql://localhost:3306/welfare?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowPublicKeyRetrieval=true
username: welfare username: root
password: welfare password: root
redis: redis:
host: 127.0.0.1 password: yjhon.com
host: 121.196.96.144
port: 6379 port: 6379
database: 10 database: 10
timeout: 10s timeout: 10s

View File

@ -1,37 +0,0 @@
<?xml version="1.0"?>
<configuration debug="false" scan="true" scanPeriod="30 seconds">
<!--定义日志文件的存储地址 勿在 LogBack 的配置中使用相对路径 -->
<property name="LOG_HOME" value="logs"/>
<!-- 定义日志文件名称 -->
<property name="LOG_FILENAME" value="welfare"/>
<!-- 日志输出格式 -->
<property name="LOG_PATTERN" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n" />
<!-- 控制台输出 -->
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>${LOG_PATTERN}</pattern>
</encoder>
</appender>
<!-- 系统日志输出 -->
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${LOG_HOME}/${LOG_FILENAME}.log</file>
<!-- 循环政策:基于时间创建日志文件 -->
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- 日志文件名格式 -->
<fileNamePattern>${LOG_HOME}/${LOG_FILENAME}.%d{yyyy-MM-dd}.log</fileNamePattern>
<!-- 日志最大的历史 60天 -->
<maxHistory>60</maxHistory>
</rollingPolicy>
<encoder>
<pattern>${LOG_PATTERN}</pattern>
</encoder>
</appender>
<!-- 日志输出级别 -->
<root level="INFO">
<appender-ref ref="FILE"/>
<appender-ref ref="CONSOLE"/>
</root>
</configuration>

File diff suppressed because one or more lines are too long