Compare commits

...

10 Commits

Author SHA1 Message Date
giaogiao 212fee01db 提交 2023-12-21 10:29:44 +08:00
giaogiao 6325b2b437 修改数据库配置 2023-12-21 10:15:44 +08:00
aoli.qu dab93717bf 根据床位查询入住人员 2023-11-06 10:30:02 +08:00
aoli.qu b2b9e68184 提示信息修改 2023-11-02 16:35:08 +08:00
aoli.qu 0b239daba2 可登录的就能看到所有权限 2023-11-02 15:58:09 +08:00
aoli.qu e83235e955 大屏统计修改 2023-11-01 14:44:31 +08:00
aoli.qu d75ccfe889 新增政治面貌等需求 2023-10-30 00:07:21 +08:00
aoli.qu a65993f8aa 新增置顶功能 2023-10-26 17:12:05 +08:00
aoli.qu 295327fcd7 修改查询顺序 2023-10-25 15:15:17 +08:00
aoli.qu 6cbb40b1dd 数据统计动态查询 2023-10-25 00:46:04 +08:00
26 changed files with 1284 additions and 137 deletions

1
.idea/.gitignore vendored
View File

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

View File

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

View File

@ -9,7 +9,6 @@ import com.org.system.pojo.LoginMenuTreeNode;
import com.org.utils.Constants;
import com.org.utils.MessageUtil;
import com.org.utils.SecurityUtil;
import com.org.utils.StringUtils;
import com.org.utils.exception.CustomException;
import com.org.utils.exception.UserPasswordNotMatchException;
import lombok.extern.slf4j.Slf4j;
@ -112,7 +111,7 @@ public class SysLoginService {
// 获取当前登录账号的当前角色信息
SysRole sysRole = null;
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);
@ -125,11 +124,13 @@ public class SysLoginService {
// 获取当前登录账号当前角色的权限
Set<String> permissions = new HashSet<>();
if(SecurityUtil.getLoginUser().ifAdmin()){
/*if(SecurityUtil.getLoginUser().ifAdmin()){
permissions.add(PermissionService.ALL_PERMISSION);
} else {
for (SysMenu sysMenu : sysMenuList) { if(StringUtils.isNotEmpty(sysMenu.getPermission())) permissions.add(sysMenu.getPermission()); }
}
}*/
// todo 可登录的就能看到所有权限
permissions.add(PermissionService.ALL_PERMISSION);
SecurityUtil.getLoginUser().setPermissions(permissions);
tokenService.refreshToken(SecurityUtil.getLoginUser());

View File

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

View File

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

View File

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

View File

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

View File

@ -6,80 +6,80 @@ import com.org.web.person.domain.BcPersonSupport;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import java.math.BigDecimal;
import java.util.List;
@Mapper
public interface DataMapper extends BaseMapper<BcPersonSupport> {
// 各村供养人数
@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> 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 " +
" '是' 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 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 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 " +
" '男' 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 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 item_name, c.value as item_remark, " +
@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 item_value " +
" and a.support_type = 1 " +
" and IFNULL(a.nursing_level, '') != '' " +
" and a.nursing_level = c.value) as value " +
" from sys_data_dictionary_item c " +
" where c.is_delete = 0 " +
" and c.dictionary_code = '0040' ")
" and c.dictionary_code = '0021' " +
" order by c.value ")
List<DataStatisticsItem> listNursingLevel();
// 年龄区间
@Select("SELECT " +
" age_ranges.age_group as item_name, " +
" COALESCE(COUNT(age_table.id_card_no), 0) AS item_value " +
" age_ranges.age_group as name, id, " +
" COALESCE(COUNT(age_table.id_card_no), 0) AS value " +
"FROM ( " +
" SELECT '50岁以下' AS age_group, 0 AS min_age, 49 AS max_age " +
" UNION SELECT '50-59岁', 50, 59 " +
" UNION SELECT '60-69岁', 60, 69 " +
" UNION SELECT '70-79岁', 70, 79 " +
" UNION SELECT '80-89岁', 80, 89 " +
" UNION SELECT '90岁以上', 90, 999 " +
" SELECT '50岁以下' AS age_group, 0 AS min_age, 49 AS max_age, 1 AS id " +
" UNION SELECT '50-59岁', 50, 59, 2 " +
" UNION SELECT '60-69岁', 60, 69, 3 " +
" UNION SELECT '70-79岁 ', 70, 79, 4 " +
" UNION SELECT '80-89岁', 80, 89, 5 " +
" UNION SELECT '90岁以上', 90, 999, 6 " +
") AS age_ranges " +
"LEFT JOIN ( " +
" SELECT " +
@ -88,43 +88,189 @@ public interface DataMapper extends BaseMapper<BcPersonSupport> {
" FROM bc_person_support " +
" where is_delete = 0 " +
" and type = 1 " +
" and support_type = 1 " +
") AS age_table ON age_table.age BETWEEN age_ranges.min_age AND age_ranges.max_age " +
"GROUP BY age_ranges.age_group ")
"GROUP BY age_ranges.age_group, id ")
List<DataStatisticsItem> listAgeCount();
// 是否在
// 是否在
@Select("SELECT " +
" '是' AS item_name, " +
" 1 as item_remark, " +
" SUM(CASE WHEN is_in_hospital = 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 is_in_hospital = 0 THEN 1 ELSE 0 END) AS item_value " +
" '是' AS name, " +
" 1 as id, " +
" SUM(CASE WHEN is_in_hospital = 1 THEN 1 ELSE 0 END) AS value " +
"FROM bc_person_support " +
"where is_delete = 0 " +
"and type = 1 ")
"and type = 1 " +
"and support_type = 1 " +
"UNION " +
"SELECT " +
" '否' AS name, " +
" 0 as id, " +
" SUM(CASE WHEN is_in_hospital = 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> 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 item_name, " +
" 0 as item_remark, " +
" count(1) AS item_value " +
"FROM bc_room a " +
"left join bc_room_bed b on a.id = b.room_id " +
"where a.is_delete = 0 " +
"and b.is_delete = 0 " +
"and a.room_type = 1 " +
"UNION " +
"select '入住房源' AS item_name, " +
" 1 as item_remark, " +
" count(1) AS item_value " +
"from bc_hospital_record a " +
"where a.is_delete = 0 " +
"and check_out_time is null")
@Select("select '供养床位' as name, " +
" (select count(1) " +
" from bc_room_bed a " +
" left join bc_room b on a.room_id = b.id " +
" where a.is_delete = 0 " +
" and b.is_delete = 0 " +
" and b.room_type = 1) as value, " +
" (select count(1) " +
" from bc_room_bed a " +
" left join bc_hospital_record b on a.id = b.bed_id " +
" where a.is_delete = 0 " +
" and b.is_delete = 0 " +
" and b.check_out_time is null) as value2 " +
"union " +
"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();
/** ----------------------------------------- 入住情况统计 ------------------------------ */
// 各村供养人数
@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,6 +9,7 @@ import com.org.web.person.domain.BcPersonSupport;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.util.List;
@Service
@ -19,29 +20,67 @@ public class DataService extends ServiceImpl<DataMapper, BcPersonSupport> {
* 列表
*/
public DataStatistics queryDataStatistics() {
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> nursingLevelList = baseMapper.listNursingLevel();
List<DataStatisticsItem> ifHelpPoorList = baseMapper.listIfHelpPoor();
List<DataStatisticsItem> inHospitalList = baseMapper.listInHospital();
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();
DataStatistics dataStatistics = new DataStatistics();
dataStatistics.setVillageCountList(villageCountList);
dataStatistics.setIfHelpPoorList(ifHelpPoorList);
dataStatistics.setSexList(sexList);
dataStatistics.setNursingLevelList(nursingLevelList);
dataStatistics.setAgeList(ageList);
dataStatistics.setInHospitalList(inHospitalList);
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);
return dataStatistics;
}

View File

@ -80,4 +80,17 @@ 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,5 +40,10 @@ public class BcHonorShow extends BaseEntity {
*/
private String files;
/**
* 是否置顶 1- 0-
*/
private Integer ifTop;
public BcHonorShow() {}
}

View File

@ -3,7 +3,9 @@ package com.org.web.honor.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.org.web.honor.domain.BcHonorShow;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import java.util.List;
@ -19,8 +21,19 @@ public interface BcHonorShowMapper extends BaseMapper<BcHonorShow> {
" and title like concat('%', #{title}, '%') " +
" </if> " +
" order by create_time desc " +
" order by if_top desc,create_time desc " +
"</script>")
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

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

View File

@ -5,6 +5,7 @@ import com.org.web.hospital.domain.BcHospitalRecord;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import java.util.List;
@ -36,12 +37,17 @@ public interface BcHospitalRecordMapper extends BaseMapper<BcHospitalRecord> {
" <if test = 'type != null'> " +
" <choose> " +
/*查询入院记录*/
" <when test=\"type == 1\"> " +
" and a.check_out_time is null " +
" </when> " +
" <when test=\"type == 2\"> " +
// " and a.check_out_time is not null " +
" and 1 = 1 " +
" and a.check_out_time is not null " +
" <if test = 'returnType != null and returnType == 2'>" +
" and year(a.check_out_time) = year(curdate()) " +
" </if>" +
" </when> " +
" </choose> " +
" </if> " +
@ -57,6 +63,9 @@ public interface BcHospitalRecordMapper extends BaseMapper<BcHospitalRecord> {
" and a.room_id = #{roomId} " +
" </if>" +
" <if test = 'bedId != null '>" +
" and a.bed_id = #{bedId} " +
" </if>" +
" order by a.create_time desc " +
"</script>")
@ -75,4 +84,9 @@ public interface BcHospitalRecordMapper extends BaseMapper<BcHospitalRecord> {
"and check_out_time is null "+
"</script>" )
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,7 +47,9 @@ public class BcHospitalRecordService extends ServiceImpl<BcHospitalRecordMapper,
record.setCreateTime(new Date());
record.setIsDelete(YesOrNoState.NO.getState());
record.setCheckInTime(new Date()); // 入住时间
if (null == record.getCheckInTime()) {
record.setCheckInTime(new Date()); // 入住时间
}
} else {
if (record.getType() == 1) checkParams(record, true);
@ -58,7 +60,10 @@ public class BcHospitalRecordService extends ServiceImpl<BcHospitalRecordMapper,
if (record.getType() == 2) {
// 退房 查询是否存在入住信息
// BcHospitalRecord lastRecordByPersonId = baseMapper.getLastRecordByPersonId(record.getPersonId());
record.setCheckOutTime(new Date()); // 退房时间
if (null == record.getCheckOutTime()) {
record.setCheckOutTime(new Date()); // 退房时间
}
}
}
saveOrUpdate(record);
@ -150,11 +155,33 @@ public class BcHospitalRecordService extends ServiceImpl<BcHospitalRecordMapper,
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) {
log.info("BcHonorShowService - del id:{}", id);
log.info("BcHospitalRecordService - del id:{}", id);
BcHospitalRecord hospitalRecord = getById(id);
if (ObjectUtil.isEmpty(hospitalRecord)) {
@ -166,5 +193,12 @@ public class BcHospitalRecordService extends ServiceImpl<BcHospitalRecordMapper,
return updateById(hospitalRecord);
}
/**
* 删除
*/
public void delByPersonId(Long personId) {
log.info("BcHospitalRecordService - delByPersonId personId:{}", personId);
baseMapper.deleteByPersonId(personId, SecurityUtil.getUserId());
}
}

View File

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

View File

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

View File

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

View File

@ -3,9 +3,7 @@ package com.org.web.person.service;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.crypto.digest.DigestUtil;
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.SysUser;
import com.org.system.enums.YesOrNoState;
@ -66,16 +64,7 @@ public class BcPersonSupportService extends ServiceImpl<BcPersonSupportMapper, B
BeanUtils.copyProperties(person, sysUser);
sysUser.setUserName(person.getIdCardNo());
sysUser.setNickName(person.getName());
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);
sysUserService.saveOrUpdate(sysUser);
// 保存用户角色信息
sysUserRoleService.save(sysUser.getId(), CollectionUtil.newArrayList(person.getType() == 1 ? SysRole.SUPPORT_ROLE : SysRole.TEND_ROLE));
@ -157,6 +146,8 @@ public class BcPersonSupportService extends ServiceImpl<BcPersonSupportMapper, B
// 删除家庭成员
familyService.delByPersonId(person.getId());
hospitalRecordService.delByPersonId(person.getId());
return updateById(person);
}
@ -194,7 +185,7 @@ public class BcPersonSupportService extends ServiceImpl<BcPersonSupportMapper, B
// 查询居住房间
BcHospitalRecord record = hospitalRecordService.getRecordByPersonId(personVO.getId());
if (null != record) {
personVO.setRoomBed(record.getRoomName() + record.getBedName());
personVO.setRoomBed(record.getBedName());
}
if (personVO.getType() == 1) {

View File

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

View File

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

View File

@ -8,6 +8,8 @@ import com.org.system.enums.YesOrNoState;
import com.org.system.service.SysDataDictionaryItemService;
import com.org.utils.SecurityUtil;
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.BcRoomBed;
import com.org.web.room.mapper.BcRoomMapper;
@ -30,6 +32,9 @@ public class BcRoomService extends ServiceImpl<BcRoomMapper, BcRoom> {
@Autowired
SysDataDictionaryItemService sysDataDictionaryItemService;
@Autowired
BcHospitalRecordService hospitalRecordService;
/**
* 新增或编辑
*/
@ -67,6 +72,17 @@ public class BcRoomService extends ServiceImpl<BcRoomMapper, BcRoom> {
// 查询床位数据
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);

View File

@ -23,11 +23,10 @@ spring:
datasource:
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
username: root
password: root
username: welfare
password: welfare
redis:
password: yjhon.com
host: 121.196.96.144
host: 127.0.0.1
port: 6379
database: 10
timeout: 10s

View File

@ -0,0 +1,37 @@
<?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>

770
welfare_20231124_104211.sql Normal file

File diff suppressed because one or more lines are too long