数据统计动态查询
This commit is contained in:
parent
6a8479737c
commit
6cbb40b1dd
|
@ -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() + "已存在");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,7 @@ public class DataController extends BaseController {
|
||||||
|
|
||||||
@PostMapping("/statistics")
|
@PostMapping("/statistics")
|
||||||
@PreAuthorize("@ss.hasPermi('data:statistics')")
|
@PreAuthorize("@ss.hasPermi('data:statistics')")
|
||||||
public AjaxResult add() {
|
public AjaxResult statistics() {
|
||||||
return AjaxResult.success(dataService.queryDataStatistics());
|
return AjaxResult.success(dataService.queryDataStatistics());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,7 @@ 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;
|
||||||
|
|
||||||
|
@ -12,17 +13,33 @@ import java.util.List;
|
||||||
@Data
|
@Data
|
||||||
public class DataStatistics {
|
public class DataStatistics {
|
||||||
|
|
||||||
List<DataStatisticsItem> villageCountList = new ArrayList<>();
|
|
||||||
|
|
||||||
List<DataStatisticsItem> ifHelpPoorList = new ArrayList<>();
|
|
||||||
|
|
||||||
List<DataStatisticsItem> sexList = new ArrayList<>();
|
List<DataStatisticsItem> sexList = new ArrayList<>();
|
||||||
|
|
||||||
List<DataStatisticsItem> nursingLevelList = new ArrayList<>();
|
|
||||||
|
|
||||||
List<DataStatisticsItem> ageList = 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> roomCountList = new ArrayList<>();
|
||||||
|
|
||||||
|
// 各村供养情况
|
||||||
|
List<DataStatisticsItem> villageCountList = new ArrayList<>();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,15 +13,20 @@ public class DataStatisticsItem {
|
||||||
/**
|
/**
|
||||||
* 子项名称
|
* 子项名称
|
||||||
*/
|
*/
|
||||||
private String itemName;
|
private String name;
|
||||||
|
|
||||||
/**
|
|
||||||
* 子项值
|
|
||||||
*/
|
|
||||||
private int itemValue;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 子项备注 可存放数据字典的value值
|
* 子项备注 可存放数据字典的value值
|
||||||
*/
|
*/
|
||||||
private String itemRemark;
|
private Integer id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 子项值
|
||||||
|
*/
|
||||||
|
private int value;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 子项值2
|
||||||
|
*/
|
||||||
|
private int value2;
|
||||||
}
|
}
|
||||||
|
|
|
@ -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 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 " +
|
@Select("SELECT " +
|
||||||
" '是' AS item_name, " +
|
" '是' AS name, " +
|
||||||
" 1 as item_remark, " +
|
" 1 as id, " +
|
||||||
" SUM(CASE WHEN if_help_poor = 1 THEN 1 ELSE 0 END) AS item_value " +
|
" SUM(CASE WHEN if_help_poor = 1 THEN 1 ELSE 0 END) AS 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 " +
|
"FROM bc_person_support " +
|
||||||
"where is_delete = 0 " +
|
"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();
|
List<DataStatisticsItem> listIfHelpPoor();
|
||||||
|
|
||||||
// 性别
|
// 性别
|
||||||
@Select("SELECT " +
|
@Select("SELECT " +
|
||||||
" '男' AS item_name, " +
|
" '男' AS name, " +
|
||||||
" 1 as item_remark, " +
|
" 1 as id, " +
|
||||||
" SUM(CASE WHEN sex = 1 THEN 1 ELSE 0 END) AS item_value " +
|
" SUM(CASE WHEN sex = 1 THEN 1 ELSE 0 END) AS 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 " +
|
"FROM bc_person_support " +
|
||||||
"where is_delete = 0 " +
|
"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();
|
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) " +
|
" (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 IFNULL(a.village, '') != '' " +
|
" and a.support_type = 1 " +
|
||||||
" and a.village = c.value) as item_value " +
|
" and IFNULL(a.nursing_level, '') != '' " +
|
||||||
|
" 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 = '0040' ")
|
" and c.dictionary_code = '0021' " +
|
||||||
|
" order by c.value ")
|
||||||
List<DataStatisticsItem> listNursingLevel();
|
List<DataStatisticsItem> listNursingLevel();
|
||||||
|
|
||||||
// 年龄区间
|
// 年龄区间
|
||||||
@Select("SELECT " +
|
@Select("SELECT " +
|
||||||
" age_ranges.age_group as item_name, " +
|
" age_ranges.age_group as name, id, " +
|
||||||
" COALESCE(COUNT(age_table.id_card_no), 0) AS item_value " +
|
" COALESCE(COUNT(age_table.id_card_no), 0) AS value " +
|
||||||
"FROM ( " +
|
"FROM ( " +
|
||||||
" SELECT '50岁以下' AS age_group, 0 AS min_age, 49 AS max_age " +
|
" SELECT '50岁以下' AS age_group, 0 AS min_age, 49 AS max_age, 1 AS id " +
|
||||||
" UNION SELECT '50-59岁', 50, 59 " +
|
" UNION SELECT '50-59岁', 50, 59, 2 " +
|
||||||
" UNION SELECT '60-69岁', 60, 69 " +
|
" UNION SELECT '60-69岁', 60, 69, 3 " +
|
||||||
" UNION SELECT '70-79岁', 70, 79 " +
|
" UNION SELECT '70-79岁', 70, 79, 4 " +
|
||||||
" UNION SELECT '80-89岁', 80, 89 " +
|
" UNION SELECT '80-89岁', 80, 89, 5 " +
|
||||||
" UNION SELECT '90岁以上', 90, 999 " +
|
" UNION SELECT '90岁以上', 90, 999, 6 " +
|
||||||
") AS age_ranges " +
|
") AS age_ranges " +
|
||||||
"LEFT JOIN ( " +
|
"LEFT JOIN ( " +
|
||||||
" SELECT " +
|
" SELECT " +
|
||||||
|
@ -88,43 +88,189 @@ 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 ")
|
"GROUP BY age_ranges.age_group, id ")
|
||||||
List<DataStatisticsItem> listAgeCount();
|
List<DataStatisticsItem> listAgeCount();
|
||||||
|
|
||||||
|
|
||||||
// 是否在园
|
// 是否在院
|
||||||
@Select("SELECT " +
|
@Select("SELECT " +
|
||||||
" '是' AS item_name, " +
|
" '是' AS name, " +
|
||||||
" 1 as item_remark, " +
|
" 1 as id, " +
|
||||||
" SUM(CASE WHEN is_in_hospital = 1 THEN 1 ELSE 0 END) AS item_value " +
|
" SUM(CASE WHEN is_in_hospital = 1 THEN 1 ELSE 0 END) AS 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 " +
|
|
||||||
"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 " +
|
||||||
|
|
||||||
|
"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();
|
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 " +
|
@Select("select '房间' as name, " +
|
||||||
" '总房源' AS item_name, " +
|
" (select count(1) " +
|
||||||
" 0 as item_remark, " +
|
" from bc_room " +
|
||||||
" count(1) AS item_value " +
|
" where is_delete = 0 " +
|
||||||
"FROM bc_room a " +
|
" and room_type = 1) as value, " +
|
||||||
"left join bc_room_bed b on a.id = b.room_id " +
|
" (select count(distinct a.id) " +
|
||||||
"where a.is_delete = 0 " +
|
" from bc_room a " +
|
||||||
"and b.is_delete = 0 " +
|
" left join bc_hospital_record b on a.id = b.room_id " +
|
||||||
"and a.room_type = 1 " +
|
" where a.is_delete = 0 " +
|
||||||
"UNION " +
|
" and b.is_delete = 0 " +
|
||||||
"select '入住房源' AS item_name, " +
|
" and b.check_out_time is null) as value2 " +
|
||||||
" 1 as item_remark, " +
|
|
||||||
" count(1) AS item_value " +
|
"union " +
|
||||||
"from bc_hospital_record a " +
|
|
||||||
"where a.is_delete = 0 " +
|
"select '床位' as name, " +
|
||||||
"and check_out_time is null")
|
" (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")
|
||||||
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();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,7 @@ 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
|
||||||
|
@ -19,28 +20,50 @@ public class DataService extends ServiceImpl<DataMapper, BcPersonSupport> {
|
||||||
* 列表
|
* 列表
|
||||||
*/
|
*/
|
||||||
public DataStatistics queryDataStatistics() {
|
public DataStatistics queryDataStatistics() {
|
||||||
List<DataStatisticsItem> villageCountList = baseMapper.listVillageCount();
|
|
||||||
|
|
||||||
List<DataStatisticsItem> ifHelpPoorList = baseMapper.listIfHelpPoor();
|
|
||||||
|
|
||||||
List<DataStatisticsItem> sexList = baseMapper.listSex();
|
List<DataStatisticsItem> sexList = baseMapper.listSex();
|
||||||
|
|
||||||
List<DataStatisticsItem> nursingLevelList = baseMapper.listNursingLevel();
|
|
||||||
|
|
||||||
List<DataStatisticsItem> ageList = baseMapper.listAgeCount();
|
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();
|
||||||
|
|
||||||
List<DataStatisticsItem> roomCountList = baseMapper.listRoomCount();
|
List<DataStatisticsItem> roomCountList = baseMapper.listRoomCount();
|
||||||
|
List<DataStatisticsItem> roomTypeList = baseMapper.listRoomType();
|
||||||
|
|
||||||
|
List<DataStatisticsItem> villageCountList = baseMapper.listVillageCount();
|
||||||
|
|
||||||
DataStatistics dataStatistics = new DataStatistics();
|
DataStatistics dataStatistics = new DataStatistics();
|
||||||
dataStatistics.setVillageCountList(villageCountList);
|
|
||||||
dataStatistics.setIfHelpPoorList(ifHelpPoorList);
|
|
||||||
dataStatistics.setSexList(sexList);
|
dataStatistics.setSexList(sexList);
|
||||||
dataStatistics.setNursingLevelList(nursingLevelList);
|
|
||||||
dataStatistics.setAgeList(ageList);
|
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);
|
dataStatistics.setRoomCountList(roomCountList);
|
||||||
|
dataStatistics.setRoomTypeList(roomTypeList);
|
||||||
|
|
||||||
|
dataStatistics.setVillageCountList(villageCountList);
|
||||||
|
|
||||||
return dataStatistics;
|
return dataStatistics;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,11 @@
|
||||||
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;
|
||||||
|
@ -41,11 +43,13 @@ 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;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -5,6 +5,7 @@ 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;
|
||||||
|
|
||||||
|
@ -75,4 +76,9 @@ 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);
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,7 +47,9 @@ public class BcHospitalRecordService extends ServiceImpl<BcHospitalRecordMapper,
|
||||||
record.setCreateTime(new Date());
|
record.setCreateTime(new Date());
|
||||||
record.setIsDelete(YesOrNoState.NO.getState());
|
record.setIsDelete(YesOrNoState.NO.getState());
|
||||||
|
|
||||||
record.setCheckInTime(new Date()); // 入住时间
|
if (null == record.getCheckInTime()) {
|
||||||
|
record.setCheckInTime(new Date()); // 入住时间
|
||||||
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
if (record.getType() == 1) checkParams(record, true);
|
if (record.getType() == 1) checkParams(record, true);
|
||||||
|
@ -58,7 +60,10 @@ 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());
|
||||||
record.setCheckOutTime(new Date()); // 退房时间
|
if (null == record.getCheckOutTime()) {
|
||||||
|
record.setCheckOutTime(new Date()); // 退房时间
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
saveOrUpdate(record);
|
saveOrUpdate(record);
|
||||||
|
@ -154,7 +159,7 @@ public class BcHospitalRecordService extends ServiceImpl<BcHospitalRecordMapper,
|
||||||
* 删除
|
* 删除
|
||||||
*/
|
*/
|
||||||
public boolean del(Long id) {
|
public boolean del(Long id) {
|
||||||
log.info("BcHonorShowService - del id:{}", id);
|
log.info("BcHospitalRecordService - del id:{}", id);
|
||||||
|
|
||||||
BcHospitalRecord hospitalRecord = getById(id);
|
BcHospitalRecord hospitalRecord = getById(id);
|
||||||
if (ObjectUtil.isEmpty(hospitalRecord)) {
|
if (ObjectUtil.isEmpty(hospitalRecord)) {
|
||||||
|
@ -166,5 +171,12 @@ 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());
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,9 +3,7 @@ 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;
|
||||||
|
@ -66,16 +64,7 @@ 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));
|
||||||
|
@ -157,6 +146,8 @@ 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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -194,7 +185,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.getRoomName() + record.getBedName());
|
personVO.setRoomBed(record.getBedName());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (personVO.getType() == 1) {
|
if (personVO.getType() == 1) {
|
||||||
|
|
|
@ -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() {
|
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);
|
return AjaxResult.success(list);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue