|  | @ -21,6 +21,7 @@ import com.yihu.jw.entity.hospital.message.SystemMessageDO;
 | 
	
		
			
				|  |  | import com.yihu.jw.im.dao.ConsultDao;
 | 
	
		
			
				|  |  | import com.yihu.jw.im.util.ImUtil;
 | 
	
		
			
				|  |  | import com.yihu.jw.restmodel.emergency.EmergencyOrderVO;
 | 
	
		
			
				|  |  | import com.yihu.jw.restmodel.web.PageEnvelop;
 | 
	
		
			
				|  |  | import com.yihu.jw.util.common.GpsUtil;
 | 
	
		
			
				|  |  | import com.yihu.jw.care.util.MessageUtil;
 | 
	
		
			
				|  |  | import com.yihu.jw.doctor.dao.BaseDoctorDao;
 | 
	
	
		
			
				|  | @ -409,30 +410,34 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
 | 
	
		
			
				|  |  |         return result;
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     public JSONArray getSecurityOrderList(String doctor,String serverDoctor,String patientName, String patient, String status, Integer page, Integer pageSize){
 | 
	
		
			
				|  |  |     public PageEnvelop getSecurityOrderList(String doctor, String serverDoctor, String patientName, String patient, String status, Integer page, Integer pageSize){
 | 
	
		
			
				|  |  |         String sqlCount = "select count(ord.id) from base_security_monitoring_order ord INNER JOIN base_patient p on p.id = ord.patient " +
 | 
	
		
			
				|  |  |                 "where 1=1 ";
 | 
	
		
			
				|  |  |         String fliter = "  ";
 | 
	
		
			
				|  |  |         String sql = " select p.id patientCode,p.name,p.sex,p.photo,p.idcard,ord.id orderId,ord.number,ord.serve_desc,ord.create_time,ord.`status`,ord.doctor," +
 | 
	
		
			
				|  |  |                 "ord.doctor_name,ord.patient_phone,ord.conclusion_status from base_security_monitoring_order ord INNER JOIN base_patient p on p.id = ord.patient " +
 | 
	
		
			
				|  |  |                 "where 1=1 ";
 | 
	
		
			
				|  |  |         if (StringUtils.isNotBlank(doctor)){
 | 
	
		
			
				|  |  |             sql+=" and  EXISTS ( SELECT 1 from base_service_package_sign_record sr,base_service_package_record r, base_service_package_item i ," +
 | 
	
		
			
				|  |  |             fliter+=" and  EXISTS ( SELECT 1 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 = i.team_code  and i.del = 1 and sr.`status`=1  and i.code='preventLost' and m.doctor_code = '"+doctor+"' and m.del = '1') ";
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         if (StringUtils.isNotBlank(serverDoctor)){
 | 
	
		
			
				|  |  |             sql +=" and ord.doctor = '"+serverDoctor+"' ";
 | 
	
		
			
				|  |  |             fliter +=" and ord.doctor = '"+serverDoctor+"' ";
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         if (StringUtils.isNotBlank(patientName)){
 | 
	
		
			
				|  |  |             sql+=" and (ord.patient_name like '%"+patientName+"%' or p.idcard='"+patientName+"')  ";
 | 
	
		
			
				|  |  |             fliter+=" and (ord.patient_name like '%"+patientName+"%' or p.idcard='"+patientName+"')  ";
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         if (StringUtils.isNotBlank(patient)){
 | 
	
		
			
				|  |  |             sql+=" and ord.patient='"+patient+"' ";
 | 
	
		
			
				|  |  |             fliter+=" and ord.patient='"+patient+"' ";
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         if (StringUtils.isNotBlank(status)){
 | 
	
		
			
				|  |  |             sql+=" and ord.status='"+Integer.parseInt(status)+"' ";
 | 
	
		
			
				|  |  |             fliter+=" and ord.status='"+Integer.parseInt(status)+"' ";
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         sql+=" order by ord.create_time desc limit " + (page*pageSize) + "," + pageSize;
 | 
	
		
			
				|  |  |         List<Map<String,Object>> sqlResult = jdbcTemplate.queryForList(sql);
 | 
	
		
			
				|  |  |         Long count = jdbcTemplate.queryForObject(sqlCount+fliter,Long.class);
 | 
	
		
			
				|  |  |         fliter+=" order by ord.create_time desc limit " + (page*pageSize) + "," + pageSize;
 | 
	
		
			
				|  |  |         List<Map<String,Object>> sqlResult = jdbcTemplate.queryForList(sql+fliter);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         JSONArray result = new JSONArray();
 | 
	
		
			
				|  |  |         for (Map<String,Object>one:sqlResult){
 | 
	
	
		
			
				|  | @ -480,7 +485,7 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
 | 
	
		
			
				|  |  |                 tmp.put("deviceFlag","0");
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         return result;
 | 
	
		
			
				|  |  |         return PageEnvelop.getSuccessListWithPage("success",result,page,pageSize,count);
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  |     public List<Map<String,Object>> getSecurityOrderUnCompleteList(String doctor){
 | 
	
		
			
				|  |  |         List<Map<String,Object>> result = new ArrayList<>();
 |