| 
					
				 | 
			
			
				@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONArray; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.alibaba.fastjson.JSONObject; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.alibaba.fastjson.serializer.SerializerFeature; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.fasterxml.jackson.databind.ObjectMapper; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.sun.org.apache.bcel.internal.generic.IF_ACMPEQ; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.care.dao.device.PatientDeviceDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.care.dao.security.*; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.care.service.sign.ServicePackageService; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -211,8 +212,8 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public JSONArray getSecurityOrderList(String doctor,String serverDoctor, String patient, String status, Integer page, Integer pageSize){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String sql = " select p.id patientCode,p.name,p.sex,p.idcard,ord.id orderId,ord.number,ord.serve_desc,ord.create_time,ord.`status`,ord.doctor," + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public JSONArray getSecurityOrderList(String doctor,String serverDoctor,String patientName, String patient, String status, Integer page, Integer pageSize){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        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 "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<BaseDoctorHospitalDO> hospitalDOs = baseDoctorHospitalDao.findByDoctorCode(doctor); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -224,8 +225,11 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNotBlank(serverDoctor)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql +=" and ord.doctor = '"+serverDoctor+"' "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNotBlank(patientName)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql+=" and (ord.patient_name like '%"+patientName+"%' or p.idcard='"+patientName+"')  "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNotBlank(patient)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql+=" and ord.patient_name= like '%"+patient+"%' or p.idcard='"+patient+"'  "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql+=" and ord.patient='"+patient+"' "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNotBlank(status)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql+=" and ord.status='"+Integer.parseInt(status)+"' "; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -239,6 +243,7 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            tmp.put("patientCode",one.get("patientCode")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            tmp.put("patientName",one.get("name")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            tmp.put("sex",one.get("sex")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            tmp.put("photo",one.get("photo")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            tmp.put("idcard",one.get("idcard")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            tmp.put("number",one.get("number")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            tmp.put("id",one.get("orderId")); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -289,14 +294,25 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<Map<String,Object>> result = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (hospitalDOs.size()>0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            for (BaseDoctorHospitalDO obj:hospitalDOs){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                String sql = " select p.id patientCode,p.name,p.sex,p.idcard,ord.id orderId,ord.number,ord.serve_desc,DATE_FORMAT(ord.create_time,'%Y-%m-%d %H:%i:%S') create_time,ord.`status`,ord.doctor," + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                String sql = " select p.id patientCode,p.name,p.sex,p.idcard,p.photo,ord.id orderId,ord.number,ord.serve_desc,DATE_FORMAT(ord.create_time,'%Y-%m-%d %H:%i:%S') 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 ord.status <>-1 and ord.status<> 7  "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                sql += "and ord.hospital = '"+obj.getOrgCode()+"' "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                sql +=" order by ord.create_time asc "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                List<Map<String,Object>> tmp= jdbcTemplate.queryForList(sql); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                for (Map<String,Object> map:tmp){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    if (map.get("idcard")==null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        map.put("age",null); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        Integer age  = IdCardUtil.getAgeForIdcard(map.get("idcard").toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        map.put("age",age); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                result.addAll(tmp); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            result.sort(Comparator.comparing(obj -> ((Map<String,Object>) obj).get("create_time").toString())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return result; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 |