|  | @ -303,22 +303,34 @@ public class PatientInfoPlatFormService {
 | 
	
		
			
				|  |  |      */
 | 
	
		
			
				|  |  |     public PageEnvelop getEmergencyWarnOrderList(String patient,Integer orderType,Integer page,Integer pageSize){
 | 
	
		
			
				|  |  |         page = page>0?page-1:0;
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         String filter =" ";
 | 
	
		
			
				|  |  |         String sqltmp = "SELECT GROUP_CONCAT(dict_code) orgCodes from wlyy_hospital_sys_dict WHERE dict_name = 'jkzl_child' or dict_name = 'jkzl_older' ";
 | 
	
		
			
				|  |  |         List<Map<String,Object>> listtmp =  jdbcTemplate.queryForList(sqltmp);
 | 
	
		
			
				|  |  |         if(listtmp.size()>0){
 | 
	
		
			
				|  |  |             String orgCodes = String.valueOf(listtmp.get(0).get("orgCodes"));
 | 
	
		
			
				|  |  |             if (StringUtils.isNotBlank(orgCodes)){
 | 
	
		
			
				|  |  |                 orgCodes = orgCodes.replaceAll(",","','");
 | 
	
		
			
				|  |  |                 filter = " and lab.patient not in ('"+orgCodes+"')";
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         String sql = " ";
 | 
	
		
			
				|  |  |         if (null==orderType){
 | 
	
		
			
				|  |  |             sql = " select '20' as OrderType,ord.id,ord.patient,p.name,'紧急呼叫' as serve_desc," +
 | 
	
		
			
				|  |  |                     " DATE_FORMAT(ord.create_time,'%Y-%m-%d %H:%i:%S') create_time from base_emergency_assistance_order ord " +
 | 
	
		
			
				|  |  |                     " INNER JOIN base_patient p on ord.patient = p.id {{patient}} \n" +
 | 
	
		
			
				|  |  |                     " INNER JOIN base_patient p on ord.patient = p.id {{patient}} "+filter+" \n" +
 | 
	
		
			
				|  |  |                     "UNION \n" +
 | 
	
		
			
				|  |  |                     "select  '22' as 'OrderType',ord.id,ord.patient,p.name,ord.serve_desc,DATE_FORMAT(ord.create_time,'%Y-%m-%d %H:%i:%S') create_time " +
 | 
	
		
			
				|  |  |                     " from base_security_monitoring_order ord INNER JOIN base_patient p on ord.patient = p.id {{patient}} \n" +
 | 
	
		
			
				|  |  |                     " from base_security_monitoring_order ord INNER JOIN base_patient p on ord.patient = p.id {{patient}} "+filter+" \n" +
 | 
	
		
			
				|  |  |                     "order by create_time desc  ";
 | 
	
		
			
				|  |  |         }else if (20==orderType){
 | 
	
		
			
				|  |  |             sql = " select '20' as OrderType,ord.id,ord.patient,p.name,'紧急呼叫' as serve_desc," +
 | 
	
		
			
				|  |  |                     " DATE_FORMAT(ord.create_time,'%Y-%m-%d %H:%i:%S') create_time from base_emergency_assistance_order ord " +
 | 
	
		
			
				|  |  |                     " INNER JOIN base_patient p on ord.patient = p.id {{patient}} order by create_time desc ";
 | 
	
		
			
				|  |  |                     " INNER JOIN base_patient p on ord.patient = p.id {{patient}} "+filter+"  order by create_time desc ";
 | 
	
		
			
				|  |  |         }else if (22==orderType){
 | 
	
		
			
				|  |  |             sql=  "select  '22' as 'OrderType',ord.id,ord.patient,p.name,ord.serve_desc,DATE_FORMAT(ord.create_time,'%Y-%m-%d %H:%i:%S') create_time " +
 | 
	
		
			
				|  |  |                     " from base_security_monitoring_order ord INNER JOIN base_patient p on ord.patient = p.id {{patient}} \n" +
 | 
	
		
			
				|  |  |                     " from base_security_monitoring_order ord INNER JOIN base_patient p on ord.patient = p.id {{patient}} "+filter+" \n" +
 | 
	
		
			
				|  |  |                     "order by create_time desc  ";
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         if (StringUtils.isNotBlank(patient)){
 | 
	
	
		
			
				|  | @ -327,6 +339,7 @@ public class PatientInfoPlatFormService {
 | 
	
		
			
				|  |  |         else {
 | 
	
		
			
				|  |  |             sql = sql.replace("{{patient}}"," ");
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         String countSql = "select count(id) from ("+sql+")A ";
 | 
	
		
			
				|  |  |         long count = jdbcTemplate.queryForObject(countSql,long.class);
 | 
	
		
			
				|  |  |         sql +=" limit "+page*pageSize+","+pageSize;
 | 
	
	
		
			
				|  | @ -336,13 +349,22 @@ public class PatientInfoPlatFormService {
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     public PageEnvelop getEmergencyWarnOrderListNew(Integer page,Integer pageSize,String patient){
 | 
	
		
			
				|  |  |         page = page>0?page-1:0;
 | 
	
		
			
				|  |  |         String filter =" ";
 | 
	
		
			
				|  |  |         String sqltmp = "SELECT GROUP_CONCAT(dict_code) orgCodes from wlyy_hospital_sys_dict WHERE dict_name = 'jkzl_child' or dict_name = 'jkzl_older' ";
 | 
	
		
			
				|  |  |         List<Map<String,Object>> listtmp =  jdbcTemplate.queryForList(sqltmp);
 | 
	
		
			
				|  |  |         if(listtmp.size()>0){
 | 
	
		
			
				|  |  |             String orgCodes = String.valueOf(listtmp.get(0).get("orgCodes"));
 | 
	
		
			
				|  |  |             orgCodes = orgCodes.replaceAll(",","','");
 | 
	
		
			
				|  |  |             filter = " and ord.patient not in ('"+orgCodes+"') ";
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         String sql = " select  '22' as 'OrderType',p.archive_type archiveType,p.residential_area residentialArea,ord.id,ord.patient,p.name,ord.serve_desc,DATE_FORMAT(ord.create_time,'%Y-%m-%d %H:%i:%S') create_time," +
 | 
	
		
			
				|  |  |                 "ord.`status`,case p.sex when 1 then '男' when 2 then '女' else p.sex end as sex,TIMESTAMPDIFF(YEAR,p.birthday,now()) as age \n" +
 | 
	
		
			
				|  |  |                 "from base_security_monitoring_order ord INNER JOIN base_patient p on ord.patient = p.id " ;
 | 
	
		
			
				|  |  |         if (StringUtils.isNotBlank(patient)){
 | 
	
		
			
				|  |  |             sql +=" and ord.patient='"+patient+"' ";
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         sql+= " order by create_time desc ";
 | 
	
		
			
				|  |  |         sql+= filter +" order by create_time desc ";
 | 
	
		
			
				|  |  |         String countSql = "select count(id) from ("+sql+")A ";
 | 
	
		
			
				|  |  |         long count = jdbcTemplate.queryForObject(countSql,long.class);
 | 
	
		
			
				|  |  |         sql +=" limit "+page*pageSize+","+pageSize;
 | 
	
	
		
			
				|  | @ -489,6 +511,15 @@ public class PatientInfoPlatFormService {
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     public PageEnvelop getEmergencyWarningListNew(Integer page,Integer pageSize,String patient){
 | 
	
		
			
				|  |  |         page = page>0?page-1:0;
 | 
	
		
			
				|  |  |         String filter=" ";
 | 
	
		
			
				|  |  |         String sqltmp = "SELECT GROUP_CONCAT(dict_code) orgCodes from wlyy_hospital_sys_dict WHERE dict_name = 'jkzl_child' or dict_name = 'jkzl_older' ";
 | 
	
		
			
				|  |  |         List<Map<String,Object>> listtmp =  jdbcTemplate.queryForList(sqltmp);
 | 
	
		
			
				|  |  |         if(listtmp.size()>0){
 | 
	
		
			
				|  |  |             String orgCodes = String.valueOf(listtmp.get(0).get("orgCodes"));
 | 
	
		
			
				|  |  |             orgCodes = orgCodes.replaceAll(",","','");
 | 
	
		
			
				|  |  |             filter = " and ord.patient not in ('"+orgCodes+"') ";
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         String sql = " select '20' as OrderType,p.archive_type archiveType,p.residential_area residentialArea,ord.id,ord.patient, " +
 | 
	
		
			
				|  |  |                 "p.name,'紧急呼叫' as serve_desc,DATE_FORMAT(ord.create_time,'%Y-%m-%d %H:%i:%S') create_time,ord.`status`," +
 | 
	
		
			
				|  |  |                 " case p.sex when 1 then '男' when 2 then '女' else p.sex end as sex,TIMESTAMPDIFF(YEAR,p.birthday,now()) as age \n" +
 | 
	
	
		
			
				|  | @ -496,7 +527,7 @@ public class PatientInfoPlatFormService {
 | 
	
		
			
				|  |  |         if (StringUtils.isNotBlank(patient)){
 | 
	
		
			
				|  |  |             sql +=" and ord.patient='"+patient+"' ";
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         sql+=  " order by create_time desc ";
 | 
	
		
			
				|  |  |         sql +=  filter + "  order by create_time desc ";
 | 
	
		
			
				|  |  |         String countSql = "select count(id) from ("+sql+")A ";
 | 
	
		
			
				|  |  |         long count = jdbcTemplate.queryForObject(countSql,long.class);
 | 
	
		
			
				|  |  |         sql +=" limit "+page*pageSize+","+pageSize;
 | 
	
	
		
			
				|  | @ -506,10 +537,20 @@ public class PatientInfoPlatFormService {
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     public PageEnvelop getHealthMonitoringListNew(Integer page,Integer pageSize){
 | 
	
		
			
				|  |  |         page = page>0?page-1:0;
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         String filter=" ";
 | 
	
		
			
				|  |  |         String sqltmp = "SELECT GROUP_CONCAT(dict_code) orgCodes from wlyy_hospital_sys_dict WHERE dict_name = 'jkzl_child' or dict_name = 'jkzl_older' ";
 | 
	
		
			
				|  |  |         List<Map<String,Object>> listtmp =  jdbcTemplate.queryForList(sqltmp);
 | 
	
		
			
				|  |  |         if(listtmp.size()>0){
 | 
	
		
			
				|  |  |             String orgCodes = String.valueOf(listtmp.get(0).get("orgCodes"));
 | 
	
		
			
				|  |  |             orgCodes = orgCodes.replaceAll(",","','");
 | 
	
		
			
				|  |  |             filter = " and idx.user not in ('"+orgCodes+"') ";
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         String sql = " SELECT idx.id,idx.user,idx.`name`,p.archive_type archiveType,p.residential_area residentialArea,'健康监测' as serve_desc, " +
 | 
	
		
			
				|  |  |                 "idx.czrq,value1,value2,value3,value4,value5,value6,value7,type FROM wlyy_patient_health_index idx " +
 | 
	
		
			
				|  |  |                 " INNER JOIN base_patient p on idx.user = p.id and p.del=1\n" +
 | 
	
		
			
				|  |  |                 " WHERE idx.del = 1 AND idx.type < 3 ORDER BY idx.czrq ";
 | 
	
		
			
				|  |  |                 " WHERE idx.del = 1 AND idx.type < 3 "+filter+" ORDER BY idx.czrq ";
 | 
	
		
			
				|  |  |         String countSql = "select count(id) from ("+sql+")A ";
 | 
	
		
			
				|  |  |         long count = jdbcTemplate.queryForObject(countSql,long.class);
 | 
	
		
			
				|  |  |         sql +=" limit "+page*pageSize+","+pageSize;
 |