|
@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.yihu.jw.care.dao.device.PatientDeviceDao;
|
|
|
import com.yihu.jw.care.dao.message.BaseServiceNewsDao;
|
|
|
import com.yihu.jw.care.service.patient.CarePatientService;
|
|
|
import com.yihu.jw.care.service.role.RoleService;
|
|
|
import com.yihu.jw.care.util.CommonUtil;
|
|
@ -15,7 +16,9 @@ import com.yihu.jw.doctor.dao.BaseDoctorHospitalDao;
|
|
|
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
|
|
|
import com.yihu.jw.entity.base.login.BaseLoginLogDO;
|
|
|
import com.yihu.jw.entity.base.patient.BasePatientDO;
|
|
|
import com.yihu.jw.entity.care.assistance.EmergencyAssistanceDO;
|
|
|
import com.yihu.jw.entity.care.device.DevicePatientDevice;
|
|
|
import com.yihu.jw.entity.care.message.BaseServiceNews;
|
|
|
import com.yihu.jw.es.es.ElasticSearchHelperUtil;
|
|
|
import com.yihu.jw.es.util.ElasticsearchUtil;
|
|
|
import com.yihu.jw.es.util.SaveModel;
|
|
@ -25,7 +28,6 @@ import com.yihu.jw.patient.dao.BasePatientDao;
|
|
|
import com.yihu.jw.restmodel.web.PageEnvelop;
|
|
|
import com.yihu.jw.util.common.IdCardUtil;
|
|
|
import com.yihu.jw.util.date.DateUtil;
|
|
|
import com.yihu.jw.utils.StringUtil;
|
|
|
import org.apache.commons.collections.map.HashedMap;
|
|
|
import org.apache.commons.lang.StringUtils;
|
|
|
import org.slf4j.Logger;
|
|
@ -86,6 +88,8 @@ public class StatisticsService {
|
|
|
private CarePatientService carePatientService;
|
|
|
@Autowired
|
|
|
private RoleService roleService;
|
|
|
@Autowired
|
|
|
private BaseServiceNewsDao baseServiceNewsDao;
|
|
|
|
|
|
private static final String defalutArea = "330100";
|
|
|
|
|
@ -469,8 +473,8 @@ public class StatisticsService {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
String sql = "select * from base_login_log where create_time>='" + dateStr + "' " + filter + " order by create_time desc limit " + (page - 1) * size + "," + size;
|
|
|
String sqlCount = "select count(id) from base_login_log where create_time>='" + dateStr + "' " + filter;
|
|
|
String sql = "select * from base_login_log where login_type<>1 and create_time>='" + dateStr + "' " + filter + " order by create_time desc limit " + (page - 1) * size + "," + size;
|
|
|
String sqlCount = "select count(id) from base_login_log where login_type<>1 and create_time>='" + dateStr + "' " + filter;
|
|
|
Long count = jdbcTemplate.queryForObject(sqlCount, Long.class);
|
|
|
List<BaseLoginLogDO> loginLogDOs = jdbcTemplate.query(sql, new BeanPropertyRowMapper(BaseLoginLogDO.class));
|
|
|
for (BaseLoginLogDO log : loginLogDOs) {
|
|
@ -903,7 +907,6 @@ public class StatisticsService {
|
|
|
res.put("inTime", saveModel3.getResult2().longValue());
|
|
|
res.put("noReplyRate", statisticsUtilService.getTwoRange(saveModel2.getResult2(), saveModel1.getResult2()));
|
|
|
res.put("inTimeRate", statisticsUtilService.getTwoRange(saveModel3.getResult2(), saveModel1.getResult2()));
|
|
|
|
|
|
return res;
|
|
|
}
|
|
|
|
|
@ -1098,7 +1101,8 @@ public class StatisticsService {
|
|
|
if ("37".equals(index)) {
|
|
|
archiType = "1";
|
|
|
}
|
|
|
List<SaveModel> sexList = elasticsearchUtil.findDateQuotaLevel2ByKeyGroup(endDate, endDate, defalutArea, level, "51", SaveModel.timeLevel_DDL, null, archiType, null, null, "2", "1");
|
|
|
List<SaveModel> sexList = elasticsearchUtil.findDateQuotaLevel2ByKeyGroup(endDate, endDate, area, level,
|
|
|
"51", SaveModel.timeLevel_DDL, null, archiType, null, null, null, "1");
|
|
|
JSONArray sexArray = new JSONArray();
|
|
|
for (int i = 0; i < sexList.size(); i++) {
|
|
|
SaveModel saveModel = sexList.get(i);
|
|
@ -1420,7 +1424,7 @@ public class StatisticsService {
|
|
|
/**
|
|
|
* 管理端首页安防预警统计分析
|
|
|
*/
|
|
|
public JSONObject statisticsSecurityOlder(String endDate, String area, int level, String type) throws Exception {
|
|
|
public JSONObject statisticsSecurityOlder(String endDate, String area, Integer level, String type) throws Exception {
|
|
|
JSONObject res = new JSONObject();
|
|
|
|
|
|
SaveModel saveModel = elasticsearchUtil.findOneDateQuotaLevels(endDate, endDate, area, level, "46", SaveModel.timeLevel_DDL, null, null, "-2,0,1" );
|
|
@ -1490,31 +1494,12 @@ public class StatisticsService {
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
public PageEnvelop getAllDeviceLostMessage(String area, Integer deviceCode,String deviceName,Integer page, Integer size) {
|
|
|
public PageEnvelop getAllDeviceLostMessage(String area, Integer page, Integer size) {
|
|
|
page = page > 0 ? page - 1 : 0;
|
|
|
String sql = "";
|
|
|
boolean dc = null==deviceCode;
|
|
|
boolean dn = StringUtils.isBlank(deviceName);
|
|
|
if (dc ||dn) {
|
|
|
sql = "select GROUP_CONCAT(id) id,type,title,sender,sender_name senderName,\n" +
|
|
|
"receiver,receiver_name receiverName,relation_code relationCode,\n" +
|
|
|
"data,is_read isRead,create_time createTime,sender_photo\n" +
|
|
|
"from base_system_message where type=43 and del=1 GROUP BY relation_code order by createTime desc ";
|
|
|
}else {
|
|
|
sql = "select DISTINCT GROUP_CONCAT(sm.id) id,sm.type AS type,sm.title AS title,sm.sender AS sender,sm.sender_name AS senderName,\n" +
|
|
|
" sm.receiver AS receiver,sm.receiver_name AS receiver_name,sm.relation_code AS relationCode,\n" +
|
|
|
" sm.data AS data,sm.is_read AS isRead,sm.create_time AS createTime,sm.sender_photo AS sender_photo\n" +
|
|
|
" from base_system_message sm LEFT JOIN wlyy_patient_device pd ON sm.relation_code = pd.device_sn where sm.type=43 and sm.del=1 ";
|
|
|
|
|
|
if (dc) {
|
|
|
sql +=" AND pd.category_code = '"+deviceCode+"'";
|
|
|
}
|
|
|
if(dn){
|
|
|
sql +=" and pd.device_name LIKE '%"+deviceName+"%'";
|
|
|
}
|
|
|
|
|
|
sql +="GROUP BY sm.relation_code order by sm.create_time desc";
|
|
|
}
|
|
|
String sql = "select GROUP_CONCAT(id) id,type,title,sender,sender_name senderName,\n" +
|
|
|
"receiver,receiver_name receiverName,relation_code relationCode,\n" +
|
|
|
"data,is_read isRead,create_time createTime,sender_photo\n" +
|
|
|
"from base_system_message where type=43 and del=1 GROUP BY relation_code order by createTime desc ";
|
|
|
|
|
|
Long count = jdbcTemplate.queryForObject(" select count(id) from (" + sql + ")A ", Long.class);
|
|
|
sql += " limit " + page * size + "," + size;
|
|
@ -1857,8 +1842,7 @@ public class StatisticsService {
|
|
|
public JSONObject patientAnalysisDP(String endDate, String area, int level, String index) throws Exception {
|
|
|
JSONObject res = new JSONObject();
|
|
|
String areaLevel = "6";
|
|
|
if ("42".equals(index)) {
|
|
|
areaLevel = "4";
|
|
|
if ("42".equals(index)) {//幼儿
|
|
|
//新生儿
|
|
|
//是否入学
|
|
|
List<SaveModel> statusList = elasticsearchUtil.findDateAllQuotaLevel1(endDate, endDate, area, level, index, SaveModel.timeLevel_DDL, null, null, areaLevel);
|
|
@ -1872,13 +1856,13 @@ public class StatisticsService {
|
|
|
statusArray.add(json);
|
|
|
}
|
|
|
res.put("statusList", statusArray);
|
|
|
} else {
|
|
|
} else {//老人
|
|
|
//老人
|
|
|
//能力评估 从签约时服务标签取
|
|
|
res.put("levelList", cloudCareForTheElderly(endDate, area, level));
|
|
|
|
|
|
//居民健康标签
|
|
|
List<SaveModel> list = elasticsearchUtil.findDateAllQuotaLevel1(endDate, endDate, area, level, "47", SaveModel.timeLevel_DDL, null, null, "2");
|
|
|
List<SaveModel> list = elasticsearchUtil.findDateAllQuotaLevel1(endDate, endDate, area, level, "47", SaveModel.timeLevel_DDL, null, null, areaLevel);
|
|
|
JSONArray labelArr = new JSONArray();
|
|
|
Long total = 0l;
|
|
|
for (int i = 0; i < list.size(); i++) {
|
|
@ -1903,7 +1887,7 @@ public class StatisticsService {
|
|
|
|
|
|
//年龄分布 50
|
|
|
// ageList = elasticsearchUtil.findDateAllQuotaLevel1(endDate, endDate, area, level, "50", SaveModel.timeLevel_DDL,null,null,"2");
|
|
|
List<SaveModel> ageList = elasticsearchUtil.findDateAllQuotaLevel1(endDate, endDate, area, level, "50", SaveModel.timeLevel_DDL, null, null, "2");
|
|
|
List<SaveModel> ageList = elasticsearchUtil.findDateAllQuotaLevel1(endDate, endDate, area, level, "50", SaveModel.timeLevel_DDL, null, null, areaLevel);
|
|
|
JSONArray ageArray = new JSONArray();
|
|
|
for (int i = 0; i < ageList.size(); i++) {
|
|
|
SaveModel saveModel = ageList.get(i);
|
|
@ -2411,17 +2395,21 @@ public class StatisticsService {
|
|
|
public PageEnvelop<List<Map<String,Object>>> getOlderTeamListWithPage(String area,String level,Integer page,Integer size) throws Exception {
|
|
|
List<Map<String,Object>> teamList = new ArrayList<>();
|
|
|
page = page>0?page-1:0;
|
|
|
String areaFilter = " ";
|
|
|
if ("5".equals(level)){
|
|
|
areaFilter += " and te.id='"+area+"' ";
|
|
|
}
|
|
|
String sql = " select count(distinct org.code) from " +
|
|
|
" base_service_package pack INNER JOIN base_org org on pack.org_code = org.code " +
|
|
|
"INNER JOIN base_team te on te.org_code = org.`code` " +
|
|
|
" where org.del=1 and org.type=3 and te.del=1 and org.code not in " +
|
|
|
" (select dict_code from wlyy_hospital_sys_dict where dict_name='jkzl_org') ";
|
|
|
" (select dict_code from wlyy_hospital_sys_dict where dict_name='jkzl_org') "+areaFilter;
|
|
|
Long totalNum = jdbcTemplate.queryForObject(sql,Long.class);
|
|
|
sql = " select distinct org.code as orgCode,org.name as orgName,te.id as teamId,te.name as teamName from " +
|
|
|
" base_service_package pack INNER JOIN base_org org on pack.org_code = org.code " +
|
|
|
"INNER JOIN base_team te on te.org_code = org.`code` " +
|
|
|
" where org.del=1 and org.type=3 and te.del=1 and org.code not in " +
|
|
|
" (select dict_code from wlyy_hospital_sys_dict where dict_name='jkzl_org') order by org.code asc " +
|
|
|
" (select dict_code from wlyy_hospital_sys_dict where dict_name='jkzl_org') "+areaFilter+" order by org.code asc " +
|
|
|
"limit "+(page*size)+","+size ;
|
|
|
teamList = jdbcTemplate.queryForList(sql);
|
|
|
for (Map<String,Object> map:teamList){
|
|
@ -2512,7 +2500,7 @@ public class StatisticsService {
|
|
|
sql = " SELECT count(o.consult) FROM wlyy_consult_team o INNER JOIN base_doctor d on o.doctor = d.id " +
|
|
|
" where 1=1 and o.type = 25 AND d.del = 1 "+olderFilter.replace("{patient}","o.patient")+" ";
|
|
|
doctorServiceCount += jdbcTemplate.queryForObject(sql,Long.class);
|
|
|
map.put("doctorServiceTotal",doctorServiceCount);//社工数量
|
|
|
map.put("doctorServiceTotal",doctorServiceCount);//医生服务数量
|
|
|
}
|
|
|
return PageEnvelop.getSuccessListWithPage("success",teamList,page,size,totalNum);
|
|
|
}
|
|
@ -2561,4 +2549,246 @@ public class StatisticsService {
|
|
|
}
|
|
|
return list;
|
|
|
}
|
|
|
|
|
|
public List<BaseServiceNews> serviceDynamics(Integer page,Integer size,String area,String level){
|
|
|
|
|
|
|
|
|
List<String> jkzlPatients = jdbcTemplate.queryForList("SELECT dict_code FROM wlyy_hospital_sys_dict WHERE dict_name LIKE '%jkzl%' ",String.class);
|
|
|
|
|
|
List<BaseServiceNews> result = new ArrayList<>();
|
|
|
String olderFilter = roleService.getOlderRoleSQL(area,level);
|
|
|
String baseServiceSql = "select sn.* from base_service_news sn where sn.type = 1 " + olderFilter.replace("{patient}","sn.code");
|
|
|
|
|
|
if ("330100".equals(area)){
|
|
|
baseServiceSql +=" UNION SELECT sn.* FROM base_service_news sn WHERE sn.type =2 ";
|
|
|
}else {
|
|
|
// 1省 2市 3区县 4机构 5团队 6医生
|
|
|
baseServiceSql +=" UNION SELECT sn.* FROM base_service_news sn LEFT JOIN base_team_member tm ON sn.`code` = tm.doctor_code WHERE sn.type =2 AND tm.del =1 ";
|
|
|
if ("4".equals(level)){
|
|
|
baseServiceSql +=" AND tm.org_code ='"+area+"'";
|
|
|
}
|
|
|
if ("5".equals(level)){
|
|
|
baseServiceSql += " AND tm.team_code ='"+area+"'";
|
|
|
}
|
|
|
}
|
|
|
baseServiceSql += " ORDER BY create_time DESC LIMIT "+(page-1)*size+","+size+"";
|
|
|
|
|
|
List<BaseServiceNews> list = jdbcTemplate.query(baseServiceSql,new BeanPropertyRowMapper<>(BaseServiceNews.class));
|
|
|
|
|
|
for (BaseServiceNews tmp:list){
|
|
|
if (jkzlPatients.contains(tmp.getCode())){
|
|
|
continue;
|
|
|
}
|
|
|
BasePatientDO patientDO = patientDao.findById(tmp.getCode());
|
|
|
if (null!=patientDO){
|
|
|
tmp.setArchiveType(patientDO.getArchiveType());
|
|
|
tmp.setResidentialArea(patientDO.getResidentialArea());
|
|
|
}
|
|
|
String relationCode = tmp.getRelationCode();
|
|
|
if (StringUtils.isNotBlank(relationCode)){
|
|
|
if ("1".equals(tmp.getType())){//上门
|
|
|
String sql = " select group_concat(Distinct name SEPARATOR '、') from base_door_coach_fee_detail where order_id ='"+relationCode+"' and status =1 ";
|
|
|
List<String> serviceItems = jdbcTemplate.queryForList(sql,String.class);
|
|
|
if (serviceItems.size()>0){
|
|
|
tmp.setServeItems(serviceItems.get(0));
|
|
|
}
|
|
|
}
|
|
|
if ("3".equals(tmp.getType())||"4".equals(tmp.getType())){//生活照料
|
|
|
String sql = " select group_concat(Distinct name SEPARATOR '、') from base_life_care_fee_detail where order_id ='"+relationCode+"' ";
|
|
|
List<String> serviceItems = jdbcTemplate.queryForList(sql,String.class);
|
|
|
if (serviceItems.size()>0){
|
|
|
tmp.setServeItems(serviceItems.get(0));
|
|
|
}
|
|
|
}
|
|
|
if ("5".equals(tmp.getType())){
|
|
|
String sql = "";
|
|
|
}
|
|
|
}
|
|
|
result.add(tmp);
|
|
|
}
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 咨询排名情况
|
|
|
* @param endDate
|
|
|
* @param area
|
|
|
* @param level 1省2市3区县4机构5团队6医生
|
|
|
* @param type 咨询类型 23新生儿在线咨询 24老人在线咨询,25老人健康咨询
|
|
|
* @return
|
|
|
*/
|
|
|
public JSONArray getConsultAnalysisRank(String endDate,String area,int level,String type) throws Exception {
|
|
|
JSONArray result = new JSONArray();
|
|
|
String totalIndex = "";
|
|
|
String noReplyIndex = "";
|
|
|
String inTimeIndex = "";
|
|
|
String lowLevel = "";
|
|
|
if ("23".equals(type)){
|
|
|
totalIndex = "28";
|
|
|
noReplyIndex = "29";
|
|
|
inTimeIndex = "30";
|
|
|
lowLevel = "4";
|
|
|
}else if ("24".equals(type)){
|
|
|
totalIndex = "31";
|
|
|
noReplyIndex = "32";
|
|
|
inTimeIndex = "33";
|
|
|
lowLevel = "5";
|
|
|
}else if ("25".equals(type)){
|
|
|
totalIndex = "57";
|
|
|
noReplyIndex = "58";
|
|
|
inTimeIndex = "59";
|
|
|
lowLevel = "5";
|
|
|
}else {
|
|
|
return null;
|
|
|
}
|
|
|
//按机构排名
|
|
|
List<SaveModel> list = elasticsearchUtil.findDateQuotaLevelList(endDate, endDate, area, level, totalIndex, SaveModel.timeLevel_DDL,null,lowLevel, null);
|
|
|
for (SaveModel tmp:list){
|
|
|
JSONObject res = new JSONObject();
|
|
|
SaveModel saveModel2 = elasticsearchUtil.findOneDateQuotaLevel0(endDate, endDate, tmp.getHospital(), 4, noReplyIndex, SaveModel.timeLevel_DDL);
|
|
|
//及时回复数
|
|
|
SaveModel saveModel3 = elasticsearchUtil.findOneDateQuotaLevel0(endDate, endDate, tmp.getHospital(), 4, inTimeIndex, SaveModel.timeLevel_DDL);
|
|
|
res.put("total", tmp.getResult2().longValue());
|
|
|
res.put("dept", tmp.getDept());
|
|
|
res.put("deptName", tmp.getDeptName());
|
|
|
res.put("hospital", tmp.getHospital());
|
|
|
res.put("hospitalName", tmp.getHospitalName());
|
|
|
res.put("noReply", saveModel2.getResult2().longValue());
|
|
|
res.put("inTime", saveModel3.getResult2().longValue());
|
|
|
res.put("finish", saveModel2.getResult2().longValue()+saveModel3.getResult2().longValue());
|
|
|
res.put("noReplyRate", commonUtil.getRangeDouble(saveModel2.getResult2().intValue(), tmp.getResult2().intValue()));
|
|
|
res.put("inTimeRate", commonUtil.getRangeDouble(saveModel3.getResult2().intValue(), tmp.getResult2().intValue()));
|
|
|
res.put("finishRate", commonUtil.getRangeDouble(saveModel2.getResult2().intValue()+saveModel3.getResult2().intValue(), tmp.getResult2().intValue()));
|
|
|
result.add(res);
|
|
|
}
|
|
|
result.sort(Comparator.comparing(obj -> ((JSONObject) obj).getDouble("finishRate")).reversed());
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
|
|
|
public List<EmergencyAssistanceDO> getAdminOrderList(String patient, String patientName, String doctor, String status, Integer page, Integer pageSize,String area,String level){
|
|
|
String olderFilter = roleService.getOlderRoleSQL(area,level);
|
|
|
StringBuilder sql = new StringBuilder(" select ord.* from base_emergency_assistance_order ord inner join base_patient pa on pa.id = ord.patient and pa.del=1 where 1=1 ");
|
|
|
if (org.apache.commons.lang3.StringUtils.isNotBlank(doctor)){
|
|
|
BaseDoctorDO doctorDO = doctorDao.findById(doctor);
|
|
|
if (null!=doctorDO){
|
|
|
if (2==doctorDO.getLevel()){//社工
|
|
|
sql.append(" AND EXISTS (" +
|
|
|
"SELECT sr.patient from base_service_package_sign_record sr,base_service_package_record r, base_service_package_item i ," +
|
|
|
"base_team_member m " +
|
|
|
"where ord.patient = CONVERT(sr.patient USING utf8) and sr.id = r.sign_id and sr.status=1 and r.service_package_id = i.service_package_id and m.team_code = r.team_code " +
|
|
|
" and i.del = 1 and sr.`status`=1 and i.code='emergencyAssistance' and m.doctor_code = '"+doctor+"' and m.del = '1') ");
|
|
|
}
|
|
|
if (4==doctorDO.getLevel()){//助老员
|
|
|
sql.append(" and EXISTS (" +
|
|
|
"SELECT 1 from base_patient_helper ph INNER JOIN base_patient p on ph.patient = p.id and p.del=1 " +
|
|
|
" where ord.patient = ph.patient and ph.doctor='"+doctor+"' and ph.del=1) ");
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
if (org.apache.commons.lang3.StringUtils.isNotBlank(patient)){
|
|
|
sql.append(" and ( ord.patient = '"+patient+"' or ord.proxy_patient='"+patient+"' )");
|
|
|
}
|
|
|
if (org.apache.commons.lang3.StringUtils.isNotBlank(patientName)){
|
|
|
sql.append(" and (pa.name like '%"+patientName+"%' or pa.idcard like '%"+patientName+"%') ");
|
|
|
}
|
|
|
if (StringUtils.isNotBlank(status)) {
|
|
|
sql.append(" and ord.status in ( '").append(status.replace(",","','")).append("') ");
|
|
|
}
|
|
|
|
|
|
sql.append(olderFilter.replace("{patient}","pa.id"));
|
|
|
sql.append(" order by ord.create_time DESC limit "+page*pageSize+","+pageSize);
|
|
|
|
|
|
List<EmergencyAssistanceDO> resultList = jdbcTemplate.query(sql.toString(),new BeanPropertyRowMapper(EmergencyAssistanceDO.class));
|
|
|
for (EmergencyAssistanceDO obj:resultList){
|
|
|
BasePatientDO patientDO = patientDao.findById(obj.getPatient());
|
|
|
obj.setPatientPhoto(patientDO.getPhoto());
|
|
|
obj.setPatientSex(patientDO.getSex());
|
|
|
obj.setPatientAge(IdCardUtil.getAgeForIdcard(patientDO.getIdcard()));
|
|
|
}
|
|
|
return resultList;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 获取上门辅导排名
|
|
|
* @return
|
|
|
*/
|
|
|
public JSONArray getDoorCoachRank(String endDate,String area,Integer level) throws Exception {
|
|
|
JSONArray result = new JSONArray();
|
|
|
List<SaveModel> list = elasticsearchUtil.findDateQuotaLevelList(endDate, endDate, area, level, "54", SaveModel.timeLevel_DDL,null,"4", null);
|
|
|
for (SaveModel tmp:list){
|
|
|
JSONObject res = new JSONObject();
|
|
|
SaveModel saveModel2 = elasticsearchUtil.findOneDateQuotaLevel0(endDate, endDate, tmp.getHospital(), 4, "35", SaveModel.timeLevel_DDL);
|
|
|
res.put("total", tmp.getResult2().longValue());
|
|
|
res.put("hospital", tmp.getHospital());
|
|
|
res.put("hospitalName", tmp.getHospitalName());
|
|
|
res.put("finish", saveModel2.getResult2().longValue());
|
|
|
res.put("finishRate", commonUtil.getRangeDouble(saveModel2.getResult2().intValue(), tmp.getResult2().intValue()));
|
|
|
result.add(res);
|
|
|
}
|
|
|
result.sort(Comparator.comparing(obj -> ((JSONObject) obj).getDouble("finishRate")).reversed());
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 获取生活照料排名
|
|
|
* @param endDate
|
|
|
* @param area
|
|
|
* @param level
|
|
|
* @return
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
public JSONArray getLifeCareRank(String endDate,String area,Integer level) throws Exception {
|
|
|
JSONArray result = new JSONArray();
|
|
|
List<SaveModel> list = elasticsearchUtil.findDateQuotaLevelList(endDate, endDate, area, level, "49", SaveModel.timeLevel_DDL,null,"4", null,"1,2,3");
|
|
|
for (SaveModel tmp:list){
|
|
|
JSONObject res = new JSONObject();
|
|
|
SaveModel saveModel2 = elasticsearchUtil.findOneDateQuotaLevels(endDate, endDate, tmp.getHospital(), 4, "49", SaveModel.timeLevel_DDL,null,"2");
|
|
|
res.put("total", tmp.getResult2().longValue());
|
|
|
res.put("hospital", tmp.getHospital());
|
|
|
res.put("hospitalName", tmp.getHospitalName());
|
|
|
res.put("finish", saveModel2.getResult2().longValue());
|
|
|
res.put("finishRate", commonUtil.getRangeDouble(saveModel2.getResult2().intValue(), tmp.getResult2().intValue()));
|
|
|
result.add(res);
|
|
|
}
|
|
|
result.sort(Comparator.comparing(obj -> ((JSONObject) obj).getDouble("finishRate")).reversed());
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 管理端首页智慧照护生活照料项目新增情况
|
|
|
*/
|
|
|
public JSONObject statisticsLifeCareItemAdd(String endDate, String area, Integer level, String type) throws Exception {
|
|
|
JSONObject res = new JSONObject();
|
|
|
|
|
|
SaveModel saveModel = elasticsearchUtil.findOneDateQuotaLevels(endDate, endDate, area, level, "48", SaveModel.timeLevel_DDL, null, null);
|
|
|
|
|
|
res.put("index_" + 48 + "_total", saveModel.getResult2().longValue());
|
|
|
if (StringUtils.isNotBlank(type)) {
|
|
|
//周/月 增量
|
|
|
String start = statisticsUtilService.calStart(endDate, type);
|
|
|
SaveModel saveModelAdd = elasticsearchUtil.findOneDateQuotaLevels(start, endDate, area, level, "48", SaveModel.timeLevel_ZL, null,null);
|
|
|
res.put("index_" + 48 + "_add", saveModelAdd.getResult2().longValue());
|
|
|
}
|
|
|
JSONArray addDetail = new JSONArray();
|
|
|
if (StringUtils.isNotBlank(type)) {
|
|
|
//周/月 增量
|
|
|
String start = statisticsUtilService.calStart(endDate, type);
|
|
|
|
|
|
List<SaveModel> saveModelAdds = elasticsearchUtil.findDateQuotaLevelList(start, endDate, area, level, "48", SaveModel.timeLevel_ZL, null,null,"1", null );
|
|
|
for (SaveModel saveModelTmp : saveModelAdds) {
|
|
|
JSONObject json = new JSONObject();
|
|
|
SaveModel saveMode2 = elasticsearchUtil.findOneDateQuotaLevels(endDate, endDate, area, level, "48", SaveModel.timeLevel_DDL, null, saveModelTmp.getSlaveKey1());
|
|
|
json.put("total", saveMode2.getResult2().longValue());
|
|
|
json.put("num", saveModelTmp.getResult2().longValue());
|
|
|
json.put("code", saveModelTmp.getSlaveKey1());
|
|
|
json.put("name", saveModelTmp.getSlaveKey1Name());
|
|
|
addDetail.add(json);
|
|
|
}
|
|
|
}
|
|
|
res.put("index_add_detail", addDetail);
|
|
|
return res;
|
|
|
}
|
|
|
|
|
|
}
|