|  | @ -35,7 +35,9 @@ import org.springframework.data.domain.PageRequest;
 | 
												
													
														
															|  | import org.springframework.jdbc.core.BeanPropertyRowMapper;
 |  | import org.springframework.jdbc.core.BeanPropertyRowMapper;
 | 
												
													
														
															|  | import org.springframework.jdbc.core.JdbcTemplate;
 |  | import org.springframework.jdbc.core.JdbcTemplate;
 | 
												
													
														
															|  | import org.springframework.stereotype.Service;
 |  | import org.springframework.stereotype.Service;
 | 
												
													
														
															|  | 
 |  | import org.springframework.transaction.annotation.Transactional;
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  | import javax.persistence.Transient;
 | 
												
													
														
															|  | import javax.persistence.criteria.CriteriaBuilder;
 |  | import javax.persistence.criteria.CriteriaBuilder;
 | 
												
													
														
															|  | import java.awt.print.Pageable;
 |  | import java.awt.print.Pageable;
 | 
												
													
														
															|  | import java.text.DecimalFormat;
 |  | import java.text.DecimalFormat;
 | 
												
											
												
													
														
															|  | @ -74,6 +76,8 @@ public class StatisticsService {
 | 
												
													
														
															|  |     private SystemMessageDao messageDao;
 |  |     private SystemMessageDao messageDao;
 | 
												
													
														
															|  |     @Autowired
 |  |     @Autowired
 | 
												
													
														
															|  |     private PatientDeviceDao patientDeviceDao;
 |  |     private PatientDeviceDao patientDeviceDao;
 | 
												
													
														
															|  | 
 |  |     @Autowired
 | 
												
													
														
															|  | 
 |  |     private SystemMessageDao systemMessageDao;
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |     private static final String defalutArea = "330100";
 |  |     private static final String defalutArea = "330100";
 | 
												
													
														
															|  | 
 |  | 
 | 
												
											
												
													
														
															|  | @ -1112,10 +1116,29 @@ public class StatisticsService {
 | 
												
													
														
															|  |         return result;
 |  |         return result;
 | 
												
													
														
															|  |     }
 |  |     }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |     public Page<SystemMessageDO> getAllDeviceLostMessage(String area,Integer page,Integer size){
 |  | 
 | 
												
													
														
															|  |         PageRequest pageRequest = new PageRequest(page - 1, size);
 |  | 
 | 
												
													
														
															|  |         Page<SystemMessageDO> systemMessageDOS = messageDao.getByType("43",pageRequest);
 |  | 
 | 
												
													
														
															|  |         return systemMessageDOS;
 |  | 
 | 
												
													
														
															|  | 
 |  |     public PageEnvelop getAllDeviceLostMessage(String area,Integer page,Integer size){
 | 
												
													
														
															|  | 
 |  |         page = page>0?page-1:0;
 | 
												
													
														
															|  | 
 |  |         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 ;
 | 
												
													
														
															|  | 
 |  |         List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |         return PageEnvelop.getSuccessListWithPage("查询成功",list,page++,size,count);
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |     }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |     @Transactional
 | 
												
													
														
															|  | 
 |  |     public void delMessageRead(String msgId){
 | 
												
													
														
															|  | 
 |  |         if (StringUtils.isNotBlank(msgId)){
 | 
												
													
														
															|  | 
 |  |             String[] ids = msgId.split(",");
 | 
												
													
														
															|  | 
 |  |             if (ids.length>0){
 | 
												
													
														
															|  | 
 |  |                 systemMessageDao.delMessage(ids);
 | 
												
													
														
															|  | 
 |  |             }
 | 
												
													
														
															|  | 
 |  |         }
 | 
												
													
														
															|  |     }
 |  |     }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |     public JSONObject deviceUsingInfo(String area){
 |  |     public JSONObject deviceUsingInfo(String area){
 | 
												
											
												
													
														
															|  | @ -1142,6 +1165,7 @@ public class StatisticsService {
 | 
												
													
														
															|  |     }
 |  |     }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |     public PageEnvelop getSecurityOrderList(String area,String status, String svrDesc,String topicItem, Integer page, Integer pageSize){
 |  |     public PageEnvelop getSecurityOrderList(String area,String status, String svrDesc,String topicItem, Integer page, Integer pageSize){
 | 
												
													
														
															|  | 
 |  |         page = page>1?page-1:0;
 | 
												
													
														
															|  |         JSONArray result = new JSONArray();
 |  |         JSONArray result = new JSONArray();
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |         String sqlCount = "select count(ord.id) from base_security_monitoring_order ord INNER JOIN base_patient p on p.id = ord.patient " +
 |  |         String sqlCount = "select count(ord.id) from base_security_monitoring_order ord INNER JOIN base_patient p on p.id = ord.patient " +
 | 
												
											
												
													
														
															|  | @ -1215,6 +1239,56 @@ public class StatisticsService {
 | 
												
													
														
															|  |         return PageEnvelop.getSuccessListWithPage("success",result,page,pageSize,count);
 |  |         return PageEnvelop.getSuccessListWithPage("success",result,page,pageSize,count);
 | 
												
													
														
															|  |     }
 |  |     }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |     public JSONObject getSecurityTab(String area,String status,String svrDesc,String topicItem){
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |         if (StringUtils.isNotBlank(area)){
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |         }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |         JSONObject result = new JSONObject();
 | 
												
													
														
															|  | 
 |  |         result.put("status_-2",0);//误报警
 | 
												
													
														
															|  | 
 |  |         result.put("status_-1",0);//已取消
 | 
												
													
														
															|  | 
 |  |         result.put("status_0",0);//已完成
 | 
												
													
														
															|  | 
 |  |         result.put("status_1",0);//预警中
 | 
												
													
														
															|  | 
 |  |         result.put("status_all",0);//
 | 
												
													
														
															|  | 
 |  |         result.put("svr_all",0);//
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |         Map<String,String> serverTmp = new HashMap<>();
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |         String sql = " select py_code,dict_value from wlyy_hospital_sys_dict where dict_name='security_server_dict' ";
 | 
												
													
														
															|  | 
 |  |         List<Map<String,Object>> servers = jdbcTemplate.queryForList(sql);
 | 
												
													
														
															|  | 
 |  |         for (Map<String,Object> server:servers){
 | 
												
													
														
															|  | 
 |  |             result.put("svr_"+server.get("py_code").toString(),0);
 | 
												
													
														
															|  | 
 |  |             serverTmp.put(server.get("dict_value").toString(),server.get("py_code").toString());
 | 
												
													
														
															|  | 
 |  |         }
 | 
												
													
														
															|  | 
 |  |         sql = "select ord.status,ord.serve_desc,count(ord.id) count from base_security_monitoring_order ord INNER JOIN base_patient p on p.id = ord.patient " +
 | 
												
													
														
															|  | 
 |  |                 "where 1=1 ";
 | 
												
													
														
															|  | 
 |  |         String fliter = "  ";
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |         if (org.apache.commons.lang3.StringUtils.isNotBlank(status)){
 | 
												
													
														
															|  | 
 |  |             fliter+=" and ord.status='"+Integer.parseInt(status)+"' ";
 | 
												
													
														
															|  | 
 |  |         }
 | 
												
													
														
															|  | 
 |  |         if (org.apache.commons.lang3.StringUtils.isNotBlank(svrDesc)){
 | 
												
													
														
															|  | 
 |  |             fliter+=" and ord.serve_desc='"+svrDesc+"' ";
 | 
												
													
														
															|  | 
 |  |         }
 | 
												
													
														
															|  | 
 |  |         if (org.apache.commons.lang3.StringUtils.isNotBlank(topicItem)){
 | 
												
													
														
															|  | 
 |  |             fliter+=" and ord.topic_item='"+topicItem+"' ";
 | 
												
													
														
															|  | 
 |  |         }
 | 
												
													
														
															|  | 
 |  |         fliter+=" group by ord.status,ord.serve_desc ";
 | 
												
													
														
															|  | 
 |  |         List<Map<String,Object>> sqlResult = jdbcTemplate.queryForList(sql+fliter);
 | 
												
													
														
															|  | 
 |  |         String pyCode = "";
 | 
												
													
														
															|  | 
 |  |         for (Map<String,Object> map:sqlResult){
 | 
												
													
														
															|  | 
 |  |             result.put("status_"+map.get("status"),result.getInteger("status_"+map.get("status"))+Integer.parseInt(map.get("count").toString()));
 | 
												
													
														
															|  | 
 |  |             pyCode =  serverTmp.get(map.get("serve_desc"))==null?null:serverTmp.get(map.get("serve_desc")).toString();
 | 
												
													
														
															|  | 
 |  |             if (org.apache.commons.lang3.StringUtils.isNotBlank(pyCode)){
 | 
												
													
														
															|  | 
 |  |                 result.put("svr_"+pyCode,result.getInteger("svr_"+pyCode)+Integer.parseInt(map.get("count").toString()));
 | 
												
													
														
															|  | 
 |  |                 result.put("status_all",result.getInteger("status_all")+Integer.parseInt(map.get("count").toString()));
 | 
												
													
														
															|  | 
 |  |                 result.put("svr_all",result.getInteger("svr_all")+Integer.parseInt(map.get("count").toString()));
 | 
												
													
														
															|  | 
 |  |             }
 | 
												
													
														
															|  | 
 |  |         }
 | 
												
													
														
															|  | 
 |  |         return result;
 | 
												
													
														
															|  | 
 |  |     }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |     public JSONObject statisticsSecurityWarnInfo(String endDate,String area,Integer level,String index) throws Exception {
 |  |     public JSONObject statisticsSecurityWarnInfo(String endDate,String area,Integer level,String index) throws Exception {
 | 
												
													
														
															|  |         JSONObject res = new JSONObject();
 |  |         JSONObject res = new JSONObject();
 | 
												
													
														
															|  |         String[] indexes = index.split(",");
 |  |         String[] indexes = index.split(",");
 | 
												
											
												
													
														
															|  | @ -1264,7 +1338,7 @@ public class StatisticsService {
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |     public JSONArray statisticsSecurityTrend(String startDate,String endDate,String area,Integer level,String index) throws Exception {
 |  |     public JSONArray statisticsSecurityTrend(String startDate,String endDate,String area,Integer level,String index) throws Exception {
 | 
												
													
														
															|  |         //安防总数
 |  |         //安防总数
 | 
												
													
														
															|  |         List<SaveModel> saveModels = elasticsearchUtil.findDateQuotaLevel0(startDate,endDate,area,level,index,SaveModel.timeLevel_ZL,SaveModel.interval_day,null);
 |  | 
 | 
												
													
														
															|  | 
 |  |         List<SaveModel> saveModels = elasticsearchUtil.findDateQuotaLevel0(startDate,endDate,area,level,index,SaveModel.timeLevel_DDL,SaveModel.interval_day,null);
 | 
												
													
														
															|  |         JSONArray jsonArray = new JSONArray();
 |  |         JSONArray jsonArray = new JSONArray();
 | 
												
													
														
															|  |         for (SaveModel tmp:saveModels){
 |  |         for (SaveModel tmp:saveModels){
 | 
												
													
														
															|  |             JSONObject jsonTmp = new JSONObject();
 |  |             JSONObject jsonTmp = new JSONObject();
 |