소스 검색

测试数据过滤

liubing 3 년 전
부모
커밋
301d68a40b

+ 30 - 12
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/statistics/DetectionPlatformService.java

@ -7,9 +7,12 @@ import com.yihu.jw.care.dao.device.PatientDeviceDao;
import com.yihu.jw.care.service.device.PatientDeviceService;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.care.device.DevicePatientDevice;
import com.yihu.jw.es.util.ElasticsearchUtil;
import com.yihu.jw.es.util.SaveModel;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.restmodel.web.PageEnvelop;
import com.yihu.jw.rm.base.BaseRequestMapping;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.utils.StringUtil;
import io.swagger.models.auth.In;
import org.apache.commons.lang.StringUtils;
@ -44,6 +47,9 @@ public class DetectionPlatformService  {
    private PatientDeviceDao patientDeviceDao;
    @Autowired
    private BasePatientDao patientDao;
    @Autowired
    private ElasticsearchUtil elasticsearchUtil;
    private static final String defalutArea = "330100";
    /**
     * 体征监测 安防监护
@ -335,35 +341,47 @@ public class DetectionPlatformService  {
        return nightRecordList;  //起夜记录
    }
    public JSONObject getDistributionOfWarningTypes(){
    public JSONObject getDistributionOfWarningTypes() throws Exception {
        JSONObject object = new JSONObject();
        String sqltmp = "SELECT GROUP_CONCAT(dict_code) orgCodes from wlyy_hospital_sys_dict WHERE dict_name = 'jkzl_org' ";
        List<Map<String,Object>> listtmp =  jdbcTemplate.queryForList(sqltmp);
        String filter="";
        if(listtmp.size()>0){
            String orgCodes = String.valueOf(listtmp.get(0).get("orgCodes"));
            orgCodes = orgCodes.replaceAll(",","','");
            filter = " and hospital not in ('"+orgCodes+"') ";
        }
        /****预警类型分布****/
        String sql = "SELECT hsd.`value`,aa.count FROM base_system_dict_entry hsd LEFT JOIN \n" +
                "(SELECT topic_item,COUNT(1) count FROM base_security_monitoring_order GROUP BY topic_item)aa \n" +
                "(SELECT topic_item,COUNT(1) count FROM base_security_monitoring_order where 1=1 "+filter+" GROUP BY topic_item)aa \n" +
                "ON CONVERT(hsd.`code` USING utf8) COLLATE utf8_unicode_ci = aa.topic_item  WHERE hsd.remark = 'security'";
        List<Map<String , Object>> list = jdbcTemplate.queryForList(sql);
        /****工单总量****/
        String sqlAll = "SELECT COUNT(1) count FROM base_security_monitoring_order";
        Integer countAll = jdbcTemplate.queryForObject(sqlAll,Integer.class);
        SaveModel saveModel = elasticsearchUtil.findOneDateQuotaLevel0(DateUtil.getStringDateShort(),DateUtil.getStringDateShort(),defalutArea,2,"46","2","4");
        long countAll = saveModel.getResult2().longValue();
        /****误报警数量****/
        String sql1 = "SELECT COUNT(1) count FROM base_security_monitoring_order WHERE emergency_cancel IS NOT NULL OR emergency_cancel != ''";
        Integer falseAlarmCount = jdbcTemplate.queryForObject(sql1,Integer.class);
        //安防误报警
        saveModel = elasticsearchUtil.findOneDateQuotaLevel2NoSlaveKey1(DateUtil.getStringDateShort(),defalutArea,2,"46","2","-2","4");
        long falseAlarmCount = saveModel.getResult2().longValue();
        /****响应数量****/
        String responseCountSql = "SELECT COUNT(1) count FROM base_security_monitoring_order WHERE (emergency_cancel IS NOT NULL OR emergency_cancel != '') OR `status` = 0 GROUP BY id";
        List<Map<String,Object>> responseList = jdbcTemplate.queryForList(responseCountSql);
        Integer responseCount = responseList.size();
        /****响应数量**误报警+完成**/
        saveModel = elasticsearchUtil.findOneDateQuotaLevel2NoSlaveKey1(DateUtil.getStringDateShort(),defalutArea,2,"46","2","-2","4");
        long responseCount = saveModel.getResult2().longValue();
        saveModel = elasticsearchUtil.findOneDateQuotaLevel2NoSlaveKey1(DateUtil.getStringDateShort(),defalutArea,2,"46","2","0","4");
        responseCount += saveModel.getResult2().longValue();
        object.put("distributionOfWarning",list);
        object.put("countAll",countAll);
        object.put("falseAlarmCount",falseAlarmCount);
        object.put("responseCount",responseCount);
        /****误报警率****/
        object.put("falseAlarmLaw",getRange(falseAlarmCount,countAll));
        object.put("falseAlarmLaw",getRange(Integer.parseInt(falseAlarmCount+""),Integer.parseInt(countAll+"")));
        /****响应率****/
        object.put("responseLaw",getRange(responseCount,countAll));
        object.put("responseLaw",getRange(Integer.parseInt(responseCount+"") ,Integer.parseInt(countAll+"")));
        return object;
    }

+ 31 - 6
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/statistics/StatisticsService.java

@ -81,9 +81,19 @@ public class StatisticsService {
            res.put("index_"+ind,saveModel.getResult2().longValue());
        }
        //41紧急预警43安防要与实时一样,查sql
        String emergencyCallSql = "SELECT COUNT(1) FROM base_emergency_assistance_order WHERE status >= 0";
        String sqltmp = "SELECT GROUP_CONCAT(dict_code) orgCodes from wlyy_hospital_sys_dict WHERE dict_name = 'jkzl_org' ";
        List<Map<String,Object>> listtmp =  jdbcTemplate.queryForList(sqltmp);
        String filter="";
        String filter2="";
        if(listtmp.size()>0){
            String orgCodes = String.valueOf(listtmp.get(0).get("orgCodes"));
            orgCodes = orgCodes.replaceAll(",","','");
            filter = " and hospital not in ('"+orgCodes+"') ";
            filter2 = " and org_code not in ('"+orgCodes+"') ";
        }
        String emergencyCallSql = "SELECT COUNT(1) FROM base_emergency_assistance_order WHERE status >= 0 "+filter2;
        Integer emergencyCallNum = jdbcTemplate.queryForObject(emergencyCallSql,Integer.class);
        String securityMonitoringSql = "SELECT COUNT(1) FROM base_security_monitoring_order";
        String securityMonitoringSql = "SELECT COUNT(1) FROM base_security_monitoring_order where 1=1 "+filter;
        Integer securityMonitoringNum = jdbcTemplate.queryForObject(securityMonitoringSql,Integer.class);
        res.put("index_"+41,emergencyCallNum);
@ -177,13 +187,25 @@ public class StatisticsService {
                childTotal = num;
            }
        }
        String healthEquipmentSql = "SELECT COUNT(1) FROM wlyy_patient_device WHERE del = 0 AND (category_code = 1 OR category_code = 2)";
        Integer healthEquipmentNum = jdbcTemplate.queryForObject(healthEquipmentSql,Integer.class);
        String securityEquipmentSql = "SELECT COUNT(1) FROM wlyy_patient_device WHERE del = 0 AND category_code > 2";
        Integer securityEquipmentNum = jdbcTemplate.queryForObject(securityEquipmentSql,Integer.class);
        String emergencyCallSql = "SELECT COUNT(1) FROM base_emergency_assistance_order WHERE status >= 0";
        sqltmp = "SELECT GROUP_CONCAT(dict_code) orgCodes from wlyy_hospital_sys_dict WHERE dict_name = 'jkzl_org' ";
        listtmp =  jdbcTemplate.queryForList(sqltmp);
        filter="";
        String filter2="";
        if(listtmp.size()>0){
            String orgCodes = String.valueOf(listtmp.get(0).get("orgCodes"));
            orgCodes = orgCodes.replaceAll(",","','");
            filter = " and hospital not in ('"+orgCodes+"') ";
            filter2 = " and org_code not in ('"+orgCodes+"') ";
        }
        String emergencyCallSql = "SELECT COUNT(1) FROM base_emergency_assistance_order WHERE status >= 0"+filter2;
        Integer emergencyCallNum = jdbcTemplate.queryForObject(emergencyCallSql,Integer.class);
        String securityMonitoringSql = "SELECT COUNT(1) FROM base_security_monitoring_order";
        String securityMonitoringSql = "SELECT COUNT(1) FROM base_security_monitoring_order"+filter;
        Integer securityMonitoringNum = jdbcTemplate.queryForObject(securityMonitoringSql,Integer.class);
        res.put("olderTotal",olderTotal);   //老人注册人数
        res.put("childTotal",childTotal);   //儿童注册人数
@ -872,9 +894,12 @@ public class StatisticsService {
            //安防总数
            SaveModel saveModel = elasticsearchUtil.findOneDateQuotaLevel0(endDate,endDate,defalutArea,2,"46","2","4");
            res.put("index_"+46+"_total",saveModel.getResult2().longValue());
            //安防完成
            //安防响应 误报警+完成
            saveModel = elasticsearchUtil.findOneDateQuotaLevel2NoSlaveKey1(endDate,defalutArea,2,"46","2","-2","4");
            long finish = saveModel.getResult2().longValue();
            saveModel = elasticsearchUtil.findOneDateQuotaLevel2NoSlaveKey1(endDate,defalutArea,2,"46","2","0","4");
            res.put("index_"+46+"_finish",saveModel.getResult2().longValue());
            finish += saveModel.getResult2().longValue();
            res.put("index_"+46+"_finish",finish);
            //安防误报警
            saveModel = elasticsearchUtil.findOneDateQuotaLevel2NoSlaveKey1(endDate,defalutArea,2,"46","2","-2","4");
            res.put("index_"+46+"_error",saveModel.getResult2().longValue());

+ 1 - 1
svr/svr-cloud-job/src/main/java/com/yihu/jw/care/job/device/PatientSosContactsJob.java

@ -64,7 +64,7 @@ public class PatientSosContactsJob implements Job {
                }
                if(null!=sosContactsDO){
                    if (StringUtils.isNotBlank(sim)){
                        JSONObject response = cardService.setPatientContacts(sim, null, null, "1", sos_phone, null);//移动白名单
                        JSONObject response = cardService.setPatientContacts(null, sim, null, "1", sos_phone, null);//移动白名单
                        //0成功 12102名单重复
                        if (response.getInteger("status")==0||response.getInteger("status")==12108){
                            if (1==sosContactsDO.getSuccessFlag()||0==sosContactsDO.getSuccessFlag()){

+ 2 - 2
svr/svr-statistics-es/src/main/java/com/yihu/wlyy/statistics/etl/compute/ComputeHelper.java

@ -189,7 +189,7 @@ public class ComputeHelper {
                " FROM " +
                "base_org o" +
                " WHERE "+
                " o.del='1' and o.code not in('fxty')";
                " o.del='1' and o.code not in('fxty','lxyl')";
        if(StringUtils.isNotBlank(orgType)){
            sql += " and o.type = '"+orgType+"'";
        }
@ -220,7 +220,7 @@ public class ComputeHelper {
                " WHERE bdh.doctor_code = bd.id  " +
                "AND hd.code= bdh.dept_code " +
                "AND o.code = bdh.org_code " +
                "AND bdh.del=1 and o.del=1 and o.code not in('fxty')";
                "AND bdh.del=1 and o.del=1 and o.code not in('fxty','lxyl')";
        if(StringUtils.isNotBlank(orgType)){
            sql += " and o.type = '"+orgType+"'";
        }