This commit is contained in:
parent
1e274e563d
commit
6a8479737c
|
@ -178,7 +178,7 @@ public class SysMenuService extends ServiceImpl<SysMenuMapper, SysMenu> {
|
||||||
* @param id
|
* @param id
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@Transactional
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public boolean del(Long id, String deleteReason){
|
public boolean del(Long id, String deleteReason){
|
||||||
log.info("SysMenuService - del - id:{}", id);
|
log.info("SysMenuService - del - id:{}", id);
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,27 @@
|
||||||
|
package com.org.web.data.controller;
|
||||||
|
|
||||||
|
import com.org.system.controller.BaseController;
|
||||||
|
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;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/data")
|
||||||
|
public class DataController extends BaseController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
DataService dataService;
|
||||||
|
|
||||||
|
@PostMapping("/statistics")
|
||||||
|
@PreAuthorize("@ss.hasPermi('data:statistics')")
|
||||||
|
public AjaxResult add() {
|
||||||
|
return AjaxResult.success(dataService.queryDataStatistics());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,28 @@
|
||||||
|
package com.org.web.data.domain;
|
||||||
|
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
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> roomCountList = new ArrayList<>();
|
||||||
|
}
|
|
@ -0,0 +1,27 @@
|
||||||
|
package com.org.web.data.domain;
|
||||||
|
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据统计 - 子项
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class DataStatisticsItem {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 子项名称
|
||||||
|
*/
|
||||||
|
private String itemName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 子项值
|
||||||
|
*/
|
||||||
|
private int itemValue;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 子项备注 可存放数据字典的value值
|
||||||
|
*/
|
||||||
|
private String itemRemark;
|
||||||
|
}
|
|
@ -0,0 +1,130 @@
|
||||||
|
package com.org.web.data.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.org.web.data.domain.DataStatisticsItem;
|
||||||
|
import com.org.web.person.domain.BcPersonSupport;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import org.apache.ibatis.annotations.Select;
|
||||||
|
|
||||||
|
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 " +
|
||||||
|
"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();
|
||||||
|
|
||||||
|
// 年龄区间
|
||||||
|
@Select("SELECT " +
|
||||||
|
" age_ranges.age_group as item_name, " +
|
||||||
|
" COALESCE(COUNT(age_table.id_card_no), 0) AS item_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 " +
|
||||||
|
") AS age_ranges " +
|
||||||
|
"LEFT JOIN ( " +
|
||||||
|
" SELECT " +
|
||||||
|
" id_card_no, " +
|
||||||
|
" TIMESTAMPDIFF(YEAR, STR_TO_DATE(SUBSTRING(id_card_no, 7, 8), '%Y%m%d'), CURDATE()) AS age " +
|
||||||
|
" FROM bc_person_support " +
|
||||||
|
" where is_delete = 0 " +
|
||||||
|
" and 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 ")
|
||||||
|
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 " +
|
||||||
|
"FROM bc_person_support " +
|
||||||
|
"where is_delete = 0 " +
|
||||||
|
"and type = 1 ")
|
||||||
|
List<DataStatisticsItem> listInHospital();
|
||||||
|
|
||||||
|
// 房源入住情况
|
||||||
|
@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")
|
||||||
|
List<DataStatisticsItem> listRoomCount();
|
||||||
|
}
|
|
@ -0,0 +1,48 @@
|
||||||
|
package com.org.web.data.service;
|
||||||
|
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.org.web.data.domain.DataStatistics;
|
||||||
|
import com.org.web.data.domain.DataStatisticsItem;
|
||||||
|
import com.org.web.data.mapper.DataMapper;
|
||||||
|
import com.org.web.person.domain.BcPersonSupport;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
@Slf4j
|
||||||
|
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> inHospitalList = baseMapper.listInHospital();
|
||||||
|
|
||||||
|
List<DataStatisticsItem> roomCountList = baseMapper.listRoomCount();
|
||||||
|
|
||||||
|
DataStatistics dataStatistics = new DataStatistics();
|
||||||
|
dataStatistics.setVillageCountList(villageCountList);
|
||||||
|
dataStatistics.setIfHelpPoorList(ifHelpPoorList);
|
||||||
|
dataStatistics.setSexList(sexList);
|
||||||
|
dataStatistics.setNursingLevelList(nursingLevelList);
|
||||||
|
dataStatistics.setAgeList(ageList);
|
||||||
|
dataStatistics.setInHospitalList(inHospitalList);
|
||||||
|
dataStatistics.setRoomCountList(roomCountList);
|
||||||
|
|
||||||
|
return dataStatistics;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -46,13 +46,18 @@ public interface BcHospitalRecordMapper extends BaseMapper<BcHospitalRecord> {
|
||||||
" </choose> " +
|
" </choose> " +
|
||||||
" </if> " +
|
" </if> " +
|
||||||
|
|
||||||
|
" <if test = 'personId != null '>" +
|
||||||
|
" and a.person_id = #{personId} " +
|
||||||
|
" </if>" +
|
||||||
" <if test = 'personName != null and personName != \"\" '>" +
|
" <if test = 'personName != null and personName != \"\" '>" +
|
||||||
" and b.name like concat('%', #{personName}, '%') " +
|
" and b.name like concat('%', #{personName}, '%') " +
|
||||||
" </if>" +
|
" </if>" +
|
||||||
|
|
||||||
" <if test = 'roomId != null '>" +
|
" <if test = 'roomId != null '>" +
|
||||||
" and a.room_id = #{roomId} " +
|
" and a.room_id = #{roomId} " +
|
||||||
" </if>" +
|
" </if>" +
|
||||||
|
|
||||||
|
|
||||||
" order by a.create_time desc " +
|
" order by a.create_time desc " +
|
||||||
"</script>")
|
"</script>")
|
||||||
List<BcHospitalRecord> checkList(BcHospitalRecord record);
|
List<BcHospitalRecord> checkList(BcHospitalRecord record);
|
||||||
|
|
|
@ -35,7 +35,7 @@ public class BcHospitalRecordService extends ServiceImpl<BcHospitalRecordMapper,
|
||||||
@Autowired
|
@Autowired
|
||||||
BcRoomBedService bcRoomBedService;
|
BcRoomBedService bcRoomBedService;
|
||||||
|
|
||||||
@Transactional
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public boolean executeSaveOrUpdate(BcHospitalRecord record) {
|
public boolean executeSaveOrUpdate(BcHospitalRecord record) {
|
||||||
log.info("BcHospitalRecordService - executeSaveOrUpdate record:{}", record);
|
log.info("BcHospitalRecordService - executeSaveOrUpdate record:{}", record);
|
||||||
|
|
||||||
|
@ -135,6 +135,21 @@ public class BcHospitalRecordService extends ServiceImpl<BcHospitalRecordMapper,
|
||||||
return baseMapper.checkList(record);
|
return baseMapper.checkList(record);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据人员查询入院记录
|
||||||
|
* @param personId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public BcHospitalRecord getRecordByPersonId(Long personId) {
|
||||||
|
BcHospitalRecord record = new BcHospitalRecord();
|
||||||
|
record.setPersonId(personId);
|
||||||
|
|
||||||
|
List<BcHospitalRecord> bcHospitalRecords = baseMapper.checkList(record);
|
||||||
|
if (null != bcHospitalRecords && !bcHospitalRecords.isEmpty()) return bcHospitalRecords.get(0);
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除
|
* 删除
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -47,12 +47,17 @@ public class BcPersonService extends BaseEntity {
|
||||||
private String phone;
|
private String phone;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 岗位
|
* 岗位 数据字典0050
|
||||||
*/
|
*/
|
||||||
private String jobs;
|
private Integer jobs;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 婚姻状况 1-未婚 2-已婚 3-离异 99-未知
|
* 家庭住址
|
||||||
|
*/
|
||||||
|
private String homeAddress;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 婚姻状况 数据字典0030 1-未婚 2-已婚 3-离异 99-未知
|
||||||
*/
|
*/
|
||||||
private Integer maritalStatus;
|
private Integer maritalStatus;
|
||||||
|
|
||||||
|
@ -102,6 +107,12 @@ public class BcPersonService extends BaseEntity {
|
||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
private String userName;
|
private String userName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 岗位名称
|
||||||
|
*/
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String jobsName;
|
||||||
|
|
||||||
/** ---------------- 家庭成员 ------------------ */
|
/** ---------------- 家庭成员 ------------------ */
|
||||||
|
|
||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
|
|
|
@ -59,7 +59,12 @@ public class BcPersonSupport extends BaseEntity {
|
||||||
private String residenceAddress;
|
private String residenceAddress;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 户籍村属
|
* 所在村 数据字典0040
|
||||||
|
*/
|
||||||
|
private Integer village;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 归属村组
|
||||||
*/
|
*/
|
||||||
private String residenceVillage;
|
private String residenceVillage;
|
||||||
|
|
||||||
|
@ -69,9 +74,29 @@ public class BcPersonSupport extends BaseEntity {
|
||||||
private Integer type;
|
private Integer type;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 供养方式
|
* 供养方式 数据字典0020
|
||||||
*/
|
*/
|
||||||
private String supportType;
|
private Integer supportType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 护理等级 数据字典0021
|
||||||
|
*/
|
||||||
|
private Integer nursingLevel;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否在院 1是 0否
|
||||||
|
*/
|
||||||
|
private Integer isInHospital;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 住院信息
|
||||||
|
*/
|
||||||
|
private String hospitalMessage;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 亲属联系方式
|
||||||
|
*/
|
||||||
|
private String relativeContact;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 是否残疾 1-是 0-否
|
* 是否残疾 1-是 0-否
|
||||||
|
@ -122,7 +147,7 @@ public class BcPersonSupport extends BaseEntity {
|
||||||
/** ---------------- 详细信息 ------------------ */
|
/** ---------------- 详细信息 ------------------ */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 婚姻状况 1-未婚 2-已婚 3-离异 99-未知
|
* 婚姻状况 数据字典0030 1-未婚 2-已婚 3-离异 99-未知
|
||||||
*/
|
*/
|
||||||
private Integer maritalStatus;
|
private Integer maritalStatus;
|
||||||
|
|
||||||
|
@ -207,4 +232,42 @@ public class BcPersonSupport extends BaseEntity {
|
||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
private List<BcPersonFamily> familyList = new ArrayList<>();
|
private List<BcPersonFamily> familyList = new ArrayList<>();
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
|
private Integer age;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 年龄区间 1:50岁以下 2:50-59 3:60-69 4:70-79 5:80-89 6:90岁以上
|
||||||
|
*/
|
||||||
|
@TableField(exist = false)
|
||||||
|
private Integer ageRange;
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
|
private Integer gender;
|
||||||
|
|
||||||
|
// 居住房间
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String roomBed;
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String villageName;
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String nursingLevelName;
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String supportTypeName;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 房间id
|
||||||
|
*/
|
||||||
|
@TableField(exist = false)
|
||||||
|
private Long roomId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 床位id
|
||||||
|
*/
|
||||||
|
@TableField(exist = false)
|
||||||
|
private Long bedId;
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,10 @@ import java.util.List;
|
||||||
public interface BcPersonSupportMapper extends BaseMapper<BcPersonSupport> {
|
public interface BcPersonSupportMapper extends BaseMapper<BcPersonSupport> {
|
||||||
|
|
||||||
@Select("<script>" +
|
@Select("<script>" +
|
||||||
"select * " +
|
"select t.* from (" +
|
||||||
|
|
||||||
|
"select *, " +
|
||||||
|
" TIMESTAMPDIFF(YEAR, STR_TO_DATE(SUBSTRING(id_card_no, 7, 8), '%Y%m%d'), CURDATE()) AS age " +
|
||||||
"from bc_person_support " +
|
"from bc_person_support " +
|
||||||
"where is_delete = 0 "+
|
"where is_delete = 0 "+
|
||||||
" <if test = 'type != null'> " +
|
" <if test = 'type != null'> " +
|
||||||
|
@ -28,8 +31,62 @@ public interface BcPersonSupportMapper extends BaseMapper<BcPersonSupport> {
|
||||||
" and phone like concat('%', #{phone}, '%') " +
|
" and phone like concat('%', #{phone}, '%') " +
|
||||||
" </if> " +
|
" </if> " +
|
||||||
|
|
||||||
|
" <if test = 'village != null'> " +
|
||||||
|
" and village = #{village} " +
|
||||||
|
" </if> " +
|
||||||
|
|
||||||
|
" <if test = 'supportType != null'> " +
|
||||||
|
" and support_type = #{supportType} " +
|
||||||
|
" </if> " +
|
||||||
|
|
||||||
|
" <if test = 'gender != null'> " +
|
||||||
|
" and sex = #{gender} " +
|
||||||
|
" </if> " +
|
||||||
|
|
||||||
|
" <if test = 'nursingLevel != null'> " +
|
||||||
|
" and nursing_level = #{nursingLevel} " +
|
||||||
|
" </if> " +
|
||||||
|
|
||||||
|
" <if test = 'isInHospital != null'> " +
|
||||||
|
" and is_in_hospital = #{isInHospital} " +
|
||||||
|
" </if> " +
|
||||||
|
|
||||||
|
" <if test = 'ifHelpPoor != null'> " +
|
||||||
|
" and if_help_poor = #{ifHelpPoor} " +
|
||||||
|
" </if> " +
|
||||||
|
|
||||||
" order by create_time desc " +
|
" order by create_time desc " +
|
||||||
|
|
||||||
|
") t " +
|
||||||
|
|
||||||
|
"where 1 = 1 " +
|
||||||
|
|
||||||
|
" <if test = 'ageRange != null'> " +
|
||||||
|
" <choose> " +
|
||||||
|
" <when test=\"ageRange == 1\"> " +
|
||||||
|
" and age < 50 " +
|
||||||
|
" </when> " +
|
||||||
|
" <when test=\"ageRange == 2\"> " +
|
||||||
|
" and age BETWEEN 50 AND 59 " +
|
||||||
|
" </when> " +
|
||||||
|
" <when test=\"ageRange == 3\"> " +
|
||||||
|
" and age BETWEEN 60 AND 69 " +
|
||||||
|
" </when> " +
|
||||||
|
" <when test=\"ageRange == 4\"> " +
|
||||||
|
" and age BETWEEN 70 AND 79 " +
|
||||||
|
" </when> " +
|
||||||
|
" <when test=\"ageRange == 5\"> " +
|
||||||
|
" and age BETWEEN 80 AND 89 " +
|
||||||
|
" </when> " +
|
||||||
|
" <when test=\"ageRange == 6\"> " +
|
||||||
|
" and age > 90 " +
|
||||||
|
" </when> " +
|
||||||
|
" <otherwise> " +
|
||||||
|
" and 1=1 " +
|
||||||
|
" </otherwise> " +
|
||||||
|
" </choose>" +
|
||||||
|
" </if> " +
|
||||||
|
|
||||||
"</script>" )
|
"</script>" )
|
||||||
List<BcPersonSupport> queryList(BcPersonSupport person);
|
List<BcPersonSupport> queryList(BcPersonSupport person);
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,7 @@ 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;
|
||||||
|
import com.org.system.service.SysDataDictionaryItemService;
|
||||||
import com.org.system.service.SysUserRoleService;
|
import com.org.system.service.SysUserRoleService;
|
||||||
import com.org.system.service.SysUserService;
|
import com.org.system.service.SysUserService;
|
||||||
import com.org.utils.SecurityUtil;
|
import com.org.utils.SecurityUtil;
|
||||||
|
@ -39,8 +40,11 @@ public class BcPersonServiceService extends ServiceImpl<BcPersonServiceMapper, B
|
||||||
@Autowired
|
@Autowired
|
||||||
BcPersonFamilyService familyService;
|
BcPersonFamilyService familyService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
SysDataDictionaryItemService sysDataDictionaryItemService;
|
||||||
|
|
||||||
@Transactional
|
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public boolean executeSaveOrUpdate(BcPersonService person) {
|
public boolean executeSaveOrUpdate(BcPersonService person) {
|
||||||
log.info("BcPersonServiceService - executeSaveOrUpdate person:{}", person);
|
log.info("BcPersonServiceService - executeSaveOrUpdate person:{}", person);
|
||||||
if (null == person.getId()) {
|
if (null == person.getId()) {
|
||||||
|
@ -114,7 +118,7 @@ public class BcPersonServiceService extends ServiceImpl<BcPersonServiceMapper, B
|
||||||
return updateById(person);
|
return updateById(person);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public boolean del(Long id) {
|
public boolean del(Long id) {
|
||||||
log.info("BcPersonServiceService - del id:{}", id);
|
log.info("BcPersonServiceService - del id:{}", id);
|
||||||
|
|
||||||
|
@ -157,6 +161,12 @@ public class BcPersonServiceService extends ServiceImpl<BcPersonServiceMapper, B
|
||||||
public List<BcPersonService> queryList(BcPersonService person) {
|
public List<BcPersonService> queryList(BcPersonService person) {
|
||||||
log.info("BcPersonServiceService - queryList person:{}", person);
|
log.info("BcPersonServiceService - queryList person:{}", person);
|
||||||
|
|
||||||
return baseMapper.queryList(person);
|
List<BcPersonService> list = baseMapper.queryList(person);
|
||||||
|
for (BcPersonService personVO : list) {
|
||||||
|
if (null != personVO.getJobs()) {
|
||||||
|
personVO.setJobsName(sysDataDictionaryItemService.findDictonaryBydictonaryCode("0050", personVO.getJobs()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return list;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,10 +9,13 @@ 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;
|
||||||
|
import com.org.system.service.SysDataDictionaryItemService;
|
||||||
import com.org.system.service.SysUserRoleService;
|
import com.org.system.service.SysUserRoleService;
|
||||||
import com.org.system.service.SysUserService;
|
import com.org.system.service.SysUserService;
|
||||||
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.person.domain.BcPersonFamily;
|
import com.org.web.person.domain.BcPersonFamily;
|
||||||
import com.org.web.person.domain.BcPersonSupport;
|
import com.org.web.person.domain.BcPersonSupport;
|
||||||
import com.org.web.person.mapper.BcPersonSupportMapper;
|
import com.org.web.person.mapper.BcPersonSupportMapper;
|
||||||
|
@ -38,8 +41,13 @@ public class BcPersonSupportService extends ServiceImpl<BcPersonSupportMapper, B
|
||||||
@Autowired
|
@Autowired
|
||||||
BcPersonFamilyService familyService;
|
BcPersonFamilyService familyService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
BcHospitalRecordService hospitalRecordService;
|
||||||
|
|
||||||
@Transactional
|
@Autowired
|
||||||
|
SysDataDictionaryItemService sysDataDictionaryItemService;
|
||||||
|
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public boolean executeSaveOrUpdate(BcPersonSupport person) {
|
public boolean executeSaveOrUpdate(BcPersonSupport person) {
|
||||||
log.info("BcPersonSupportService - executeSaveOrUpdate person:{}", person);
|
log.info("BcPersonSupportService - executeSaveOrUpdate person:{}", person);
|
||||||
if (null == person.getId()) {
|
if (null == person.getId()) {
|
||||||
|
@ -72,7 +80,6 @@ public class BcPersonSupportService extends ServiceImpl<BcPersonSupportMapper, B
|
||||||
// 保存用户角色信息
|
// 保存用户角色信息
|
||||||
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));
|
||||||
|
|
||||||
|
|
||||||
// 新增人员信息
|
// 新增人员信息
|
||||||
person.setId(sysUser.getId()); // 人员的id为sysUser的id
|
person.setId(sysUser.getId()); // 人员的id为sysUser的id
|
||||||
person.setCreateTime(new Date());
|
person.setCreateTime(new Date());
|
||||||
|
@ -82,6 +89,15 @@ public class BcPersonSupportService extends ServiceImpl<BcPersonSupportMapper, B
|
||||||
// 新增家庭成员子表数据
|
// 新增家庭成员子表数据
|
||||||
familyService.executeSaveOrUpdate(person.getId(), person.getFamilyList());
|
familyService.executeSaveOrUpdate(person.getId(), person.getFamilyList());
|
||||||
|
|
||||||
|
// 选择了床位和房间,则新增入院记录
|
||||||
|
if (null != person.getRoomId() && null != person.getBedId()) {
|
||||||
|
BcHospitalRecord record = new BcHospitalRecord();
|
||||||
|
record.setPersonId(person.getId());
|
||||||
|
record.setRoomId(person.getRoomId());
|
||||||
|
record.setBedId(person.getBedId());
|
||||||
|
hospitalRecordService.executeSaveOrUpdate(record);
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -110,10 +126,20 @@ public class BcPersonSupportService extends ServiceImpl<BcPersonSupportMapper, B
|
||||||
// 编辑家庭成员子表数据
|
// 编辑家庭成员子表数据
|
||||||
familyService.executeSaveOrUpdate(person.getId(), person.getFamilyList());
|
familyService.executeSaveOrUpdate(person.getId(), person.getFamilyList());
|
||||||
|
|
||||||
|
// 选择了床位和房间,则新增/编辑入院记录
|
||||||
|
if (null != person.getRoomId() && null != person.getBedId()) {
|
||||||
|
BcHospitalRecord lastRecord = hospitalRecordService.getRecordByPersonId(person.getId());
|
||||||
|
if (null == lastRecord) lastRecord = new BcHospitalRecord();
|
||||||
|
lastRecord.setPersonId(person.getId());
|
||||||
|
lastRecord.setRoomId(person.getRoomId());
|
||||||
|
lastRecord.setBedId(person.getBedId());
|
||||||
|
hospitalRecordService.executeSaveOrUpdate(lastRecord);
|
||||||
|
}
|
||||||
|
|
||||||
return updateById(person);
|
return updateById(person);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public boolean del(Long id) {
|
public boolean del(Long id) {
|
||||||
log.info("BcPersonSupportService - del id:{}", id);
|
log.info("BcPersonSupportService - del id:{}", id);
|
||||||
|
|
||||||
|
@ -147,6 +173,13 @@ public class BcPersonSupportService extends ServiceImpl<BcPersonSupportMapper, B
|
||||||
|
|
||||||
person.setFamilyList(familyList);
|
person.setFamilyList(familyList);
|
||||||
|
|
||||||
|
// 查询房间床位
|
||||||
|
BcHospitalRecord record = hospitalRecordService.getRecordByPersonId(id);
|
||||||
|
if (null != record) {
|
||||||
|
person.setRoomId(record.getRoomId());
|
||||||
|
person.setBedId(record.getBedId());
|
||||||
|
}
|
||||||
|
|
||||||
return person;
|
return person;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -156,7 +189,27 @@ public class BcPersonSupportService extends ServiceImpl<BcPersonSupportMapper, B
|
||||||
public List<BcPersonSupport> queryList(BcPersonSupport person) {
|
public List<BcPersonSupport> queryList(BcPersonSupport person) {
|
||||||
log.info("BcPersonSupportService - queryList person:{}", person);
|
log.info("BcPersonSupportService - queryList person:{}", person);
|
||||||
|
|
||||||
return baseMapper.queryList(person);
|
List<BcPersonSupport> personList = baseMapper.queryList(person);
|
||||||
|
for (BcPersonSupport personVO : personList) {
|
||||||
|
// 查询居住房间
|
||||||
|
BcHospitalRecord record = hospitalRecordService.getRecordByPersonId(personVO.getId());
|
||||||
|
if (null != record) {
|
||||||
|
personVO.setRoomBed(record.getRoomName() + record.getBedName());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (personVO.getType() == 1) {
|
||||||
|
if (null != personVO.getVillage()) {
|
||||||
|
personVO.setVillageName(sysDataDictionaryItemService.findDictonaryBydictonaryCode("0040", personVO.getVillage()));
|
||||||
|
}
|
||||||
|
if (null != personVO.getSupportType()) {
|
||||||
|
personVO.setSupportTypeName(sysDataDictionaryItemService.findDictonaryBydictonaryCode("0020", personVO.getSupportType()));
|
||||||
|
}
|
||||||
|
if (null != personVO.getNursingLevel()) {
|
||||||
|
personVO.setNursingLevelName(sysDataDictionaryItemService.findDictonaryBydictonaryCode("0021", personVO.getNursingLevel()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return personList;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue