| 
					
				 | 
			
			
				@ -1242,11 +1242,6 @@ public class EmergencyAssistanceService extends BaseJpaService<EmergencyAssistan 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNotBlank(patientName)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            filter += " and ord.patient_name like'%"+patientName+"%' "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNotBlank(doctor)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            filter += "  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 (StringUtils.isNotBlank(status)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            filter += " and ord.status ='"+status+"' "; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -1258,7 +1253,8 @@ public class EmergencyAssistanceService extends BaseJpaService<EmergencyAssistan 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                sql += "select '20' as OrderType,ord.id,ord.patient,ord.patient_name,ord.doctor,ord.status,ord.doctor_name," + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        "'紧急呼叫' as serve_desc,DATE_FORMAT(ord.create_time,'%Y-%m-%d %H:%i:%S') create_time ,case p.sex when 1 then '男' when 2 then '女' else p.sex end as sex," + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        " TIMESTAMPDIFF(YEAR,p.birthday,now()) as age " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        "from base_emergency_assistance_order ord  INNER JOIN base_patient p on ord.patient = p.id  where 1=1 " +filter; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        "from base_emergency_assistance_order ord  INNER JOIN base_patient p on ord.patient = p.id  INNER JOIN base_patient_helper ph on p.id = ph.patient and ph.del=1  " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        " where ph.doctor='"+doctor+"' "+filter; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (orderTypes.contains("20")&&orderTypes.contains("22")){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                sql += " UNION "; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -1267,7 +1263,8 @@ public class EmergencyAssistanceService extends BaseJpaService<EmergencyAssistan 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                sql += " select  '22' as 'OrderType',ord.id,ord.patient,ord.patient_name,ord.doctor,ord.status,ord.doctor_name," + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        "ord.serve_desc,DATE_FORMAT(ord.create_time,'%Y-%m-%d %H:%i:%S') create_time ,case p.sex when 1 then '男' when 2 then '女' else p.sex end as sex, " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        "TIMESTAMPDIFF(YEAR,p.birthday,now()) as age from base_security_monitoring_order ord " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        " INNER JOIN base_patient p on ord.patient = p.id  where 1=1 "+filter; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        " INNER JOIN base_patient p on ord.patient = p.id INNER JOIN base_patient_helper ph on p.id = ph.patient and ph.del=1 " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        " where ph.doctor='"+doctor+"'  "+filter; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if(StringUtils.isNotBlank(svrDesc)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    sql += " and ord.service = '"+svrDesc+"' "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -1281,29 +1278,22 @@ public class EmergencyAssistanceService extends BaseJpaService<EmergencyAssistan 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public JSONObject getEmeAndSecuOrderTab(String orderType,String doctor){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        JSONObject result = new JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if ("20".equals(orderType)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            JSONObject tmpObj = new JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            tmpObj.put("status_-2",0);//误报警 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            tmpObj.put("status_-1",0);//已取消 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            tmpObj.put("status_0",0);//已完成 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            tmpObj.put("status_1",0);//预警中 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String sql = " select ord.status,count(ord.id) count from base_emergency_assistance_order ord where 1=1" ; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (StringUtils.isNotBlank(doctor)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                sql+= " 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) "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            List<Map<String,Object>> sqlResult = jdbcTemplate.queryForList(sql.toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            result.put("status_-2",0);//误报警 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            result.put("status_-1",0);//已取消 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            result.put("status_0",0);//已完成 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            result.put("status_1",0);//预警中 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String sql = " select ord.status,count(ord.id) count from base_emergency_assistance_order ord INNER JOIN base_patient_helper ph on ord.patient = ph.patient and ph.del=1 " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "  where ph.doctor='"+doctor+"'  " ; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            List<Map<String,Object>> sqlResult = jdbcTemplate.queryForList(sql); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            for (Map<String,Object> map:sqlResult){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                tmpObj.put("status_"+map.get("status"),map.get("count")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                result.put("status_"+map.get("status"),map.get("count")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            Integer All = 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            Set<String> keySet = tmpObj.keySet(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            Set<String> keySet = result.keySet(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            for (String key : keySet){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                All+=tmpObj.getInteger(key); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                All+=result.getInteger(key); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            tmpObj.put("all",All); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            result.put(ResponseContant.resultFlag, ResponseContant.success); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            result.put(ResponseContant.resultMsg,tmpObj); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            result.put("all",All); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        else if("22".equals(orderType)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            result.put("status_-2", 0);//误报警 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -1322,13 +1312,8 @@ public class EmergencyAssistanceService extends BaseJpaService<EmergencyAssistan 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                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 "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    " INNER JOIN base_patient_helper ph on ord.patient = ph.patient and ph.del=1  where ph.doctor='"+doctor+"'  "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String fliter = "  "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (StringUtils.isNotBlank(doctor)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                fliter+= " 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) "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            fliter += " group by ord.status,ord.serve_desc "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            List<Map<String, Object>> sqlResult = jdbcTemplate.queryForList(sql + fliter); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String pyCode = ""; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -1343,22 +1328,13 @@ public class EmergencyAssistanceService extends BaseJpaService<EmergencyAssistan 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return result; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        }else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String sql = " select count(ord.id)  from base_emergency_assistance_order ord where 1=1" ; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (StringUtils.isNotBlank(doctor)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                sql+= " 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) "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String sql = " select count(ord.id)  from base_emergency_assistance_order ord INNER JOIN base_patient_helper ph on ord.patient = ph.patient and ph.del=1 " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "  where ph.doctor='"+doctor+"' " ; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            Long emeCount = jdbcTemplate.queryForObject(sql,Long.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            result.put("emeAll",emeCount); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql = "select count(ord.id) count from base_security_monitoring_order ord INNER JOIN base_patient p on p.id = ord.patient " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "where 1=1 "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql = "select count(ord.id) count from base_security_monitoring_order ord INNER JOIN base_patient p on ord.patient = ord.patient " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    " INNER JOIN base_patient_helper ph on p.id = ph.patient and ph.del=1  where ph.doctor='"+doctor+"'  "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String fliter = "  "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (StringUtils.isNotBlank(doctor)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                sql += " 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) "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            Long secuCount = jdbcTemplate.queryForObject(sql,Long.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            result.put("secuAll",secuCount); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 |