Commit 886dd3f6 by wangchunyang

重点人员统计类别改为根据配置动态动态

parent a3fbbeae
...@@ -36,9 +36,18 @@ public class KeyPersonStatisticsImpl { ...@@ -36,9 +36,18 @@ public class KeyPersonStatisticsImpl {
// 获取重点人员总数 // 获取重点人员总数
Map<String, Object> peopleCountMap = commonService.getObject(namespace + "selectPeopleCount", map); Map<String, Object> peopleCountMap = commonService.getObject(namespace + "selectPeopleCount", map);
Map<String, Object> mentalPatient = commonService.getObject(namespace + "selectMentalPatientRatingCount", map); // Map<String, Object> mentalPatient = commonService.getObject(namespace + "selectMentalPatientRatingCount", map);
Map<String, Object> minors = commonService.getObject(namespace + "selectMinorsRatingCount", map); // Map<String, Object> minors = commonService.getObject(namespace + "selectMinorsRatingCount", map);
Map<String, Object> released = commonService.getObject(namespace + "selectReleasedRatingCount", map); // Map<String, Object> released = commonService.getObject(namespace + "selectReleasedRatingCount", map);
map.put("sysType", "3");
List<Map<String, Object>> mentalPatientDynamic = commonService.findList(namespace + "selectItemRatingCount", map);
map.put("sysType", "6");
List<Map<String, Object>> minorsDynamic = commonService.findList(namespace + "selectItemRatingCount", map);
map.put("sysType", "2");
List<Map<String, Object>> releasedDynamic = commonService.findList(namespace + "selectItemRatingCount", map);
// 构建返回结果 // 构建返回结果
Map<String, Object> result = new HashMap<>(); Map<String, Object> result = new HashMap<>();
...@@ -47,21 +56,21 @@ public class KeyPersonStatisticsImpl { ...@@ -47,21 +56,21 @@ public class KeyPersonStatisticsImpl {
Map<String, Object> mentalPatientData = new HashMap<>(); Map<String, Object> mentalPatientData = new HashMap<>();
int mentalTotal = getIntValue(peopleCountMap, "mental_patient_count"); int mentalTotal = getIntValue(peopleCountMap, "mental_patient_count");
mentalPatientData.put("total", mentalTotal); mentalPatientData.put("total", mentalTotal);
mentalPatientData.put("categories", buildCategories(mentalPatient)); mentalPatientData.put("categories", buildDynamicCategories(mentalPatientDynamic));
result.put("mentalPatient", mentalPatientData); result.put("mentalPatient", mentalPatientData);
// 未成年人数据 // 未成年人数据
Map<String, Object> minorsData = new HashMap<>(); Map<String, Object> minorsData = new HashMap<>();
int minorsTotal = getIntValue(peopleCountMap, "minors_count"); int minorsTotal = getIntValue(peopleCountMap, "minors_count");
minorsData.put("total", minorsTotal); minorsData.put("total", minorsTotal);
minorsData.put("categories", buildCategories(minors)); minorsData.put("categories", buildDynamicCategories(minorsDynamic));
result.put("minors", minorsData); result.put("minors", minorsData);
// 刑满释放数据 // 刑满释放数据
Map<String, Object> releasedData = new HashMap<>(); Map<String, Object> releasedData = new HashMap<>();
int releasedTotal = getIntValue(peopleCountMap, "released_count"); int releasedTotal = getIntValue(peopleCountMap, "released_count");
releasedData.put("total", releasedTotal); releasedData.put("total", releasedTotal);
releasedData.put("categories", buildCategories(released)); releasedData.put("categories", buildDynamicCategories(releasedDynamic));
result.put("released", releasedData); result.put("released", releasedData);
return result; return result;
...@@ -93,6 +102,18 @@ public class KeyPersonStatisticsImpl { ...@@ -93,6 +102,18 @@ public class KeyPersonStatisticsImpl {
} }
/** /**
* 构建分类数据
*/
private Object buildDynamicCategories(List<Map<String, Object>> data) {
Map<String, Object>[] categories = (Map<String, Object>[]) new Map[data.size()];// 3/6/2
for (int i = 0; i < data.size(); i++) {
categories[i] = data.get(i);
}
return categories;
}
/**
* 获取整数值 * 获取整数值
*/ */
private int getIntValue(Map<String, Object> data, String key) { private int getIntValue(Map<String, Object> data, String key) {
......
...@@ -492,4 +492,51 @@ ...@@ -492,4 +492,51 @@
</choose> </choose>
</where> </where>
</select> </select>
<!-- 新统计方法,根据配置动态获取分类 =========================================================================-->
<select id="selectItemRatingCount" parameterType="map" resultType="map">
select
sd.value as mark,
sd.label as name,
case when tab.sl is null then 0 else tab.sl end value
from sys_dict sd left join
(select jkprs.rating_type, count(*) sl from jl_key_person_rating_summary jkprs
left join
<choose>
<when test="sysType == '6'.toString()">
jl_key_person_minor jkp
</when>
<otherwise>
jl_key_person jkp
</otherwise>
</choose>
on jkp.sys_type = #{sysType} and jkp.id = jkprs.key_person_id
<where>
and jkp.id is not null
and jkprs.is_history = '1'
<choose>
<when test="scope_grade == '3'.toString()">
AND ((jkp.city_id = #{scope_area_id} and jkp.city_id not in (select city_id from jl_key_person_rating_dual_person where key_person_id=jkp.id))
OR exists(select id from jl_key_person_rating_dual_person where city_id = #{scope_area_id} AND key_person_id=jkp.id))
</when>
<when test="scope_grade == '4'.toString()">
AND ((jkp.area_id = #{scope_area_id} and jkp.area_id not in (select area_id from jl_key_person_rating_dual_person where key_person_id=jkp.id))
OR exists(select id from jl_key_person_rating_dual_person where area_id = #{scope_area_id} AND key_person_id=jkp.id))
</when>
<when test="scope_grade == '5'.toString()">
AND ((jkp.street_id = #{scope_area_id} and jkp.street_id not in (select street_id from jl_key_person_rating_dual_person where key_person_id=jkp.id))
OR exists(select id from jl_key_person_rating_dual_person where street_id = #{scope_area_id} AND key_person_id=jkp.id))
</when>
<when test="scope_grade == '6'.toString()">
AND ((jkp.community_id = #{scope_area_id} and jkp.community_id not in (select community_id from jl_key_person_rating_dual_person where key_person_id=jkp.id))
OR exists(select id from jl_key_person_rating_dual_person where community_id = #{scope_area_id} AND key_person_id=jkp.id))
</when>
</choose>
</where>
group by jkprs.rating_type) tab
on sd.value = tab.rating_type
where sd.`type` = 'rating_level' and sd.del_flag = '0'
order by sd.sort
</select>
</mapper> </mapper>
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论