|  | @ -794,21 +794,11 @@ public class EmergencyAssistanceService extends BaseJpaService<EmergencyAssistan
 | 
												
													
														
															|  |                 patientCodes.add(obj.getPatient());
 |  |                 patientCodes.add(obj.getPatient());
 | 
												
													
														
															|  |             }
 |  |             }
 | 
												
													
														
															|  |         }
 |  |         }
 | 
												
													
														
															|  |         String inSql = "";
 |  | 
 | 
												
													
														
															|  |         for (String code : patientCodes) {
 |  | 
 | 
												
													
														
															|  |             inSql += "'"+code+"',";
 |  | 
 | 
												
													
														
															|  |         }
 |  | 
 | 
												
													
														
															|  |         if(StringUtils.isNotBlank(inSql)){
 |  | 
 | 
												
													
														
															|  |             inSql = inSql.substring(0,inSql.lastIndexOf(","));
 |  | 
 | 
												
													
														
															|  |             //居民绑定的设备code
 |  | 
 | 
												
													
														
															|  |             String deviceSql = "SELECT user,GROUP_CONCAT( DISTINCT category_code SEPARATOR ',' ) code  " +
 |  | 
 | 
												
													
														
															|  |                     "from wlyy_patient_device where del = 0 and user in ("+inSql+") group by user";
 |  | 
 | 
												
													
														
															|  |             List<Map<String, Object>> list = jdbcTemplate.queryForList(deviceSql);
 |  | 
 | 
												
													
														
															|  |             for (Map<String, Object> map : list) {
 |  | 
 | 
												
													
														
															|  |                 for (EmergencyAssistanceDO em : resultList) {
 |  | 
 | 
												
													
														
															|  |                     if(map.get("user").toString().equals(em.getPatient())){
 |  | 
 | 
												
													
														
															|  |                         em.setPatientDevices(map.get("code").toString());
 |  | 
 | 
												
													
														
															|  |                     }
 |  | 
 | 
												
													
														
															|  | 
 |  |         List<Map<String, Object>> list = this.getUserCodeByPatientList(patientCodes);
 | 
												
													
														
															|  | 
 |  |         for (Map<String, Object> map : list) {
 | 
												
													
														
															|  | 
 |  |             for (EmergencyAssistanceDO em : resultList) {
 | 
												
													
														
															|  | 
 |  |                 if(map.get("user").toString().equals(em.getPatient())){
 | 
												
													
														
															|  | 
 |  |                     em.setPatientDevices(map.get("code").toString());
 | 
												
													
														
															|  |                 }
 |  |                 }
 | 
												
													
														
															|  |             }
 |  |             }
 | 
												
													
														
															|  |         }
 |  |         }
 | 
												
											
												
													
														
															|  | @ -1409,9 +1399,25 @@ public class EmergencyAssistanceService extends BaseJpaService<EmergencyAssistan
 | 
												
													
														
															|  |             sql += " order by create_time desc limit "+page*pageSize+","+pageSize;
 |  |             sql += " order by create_time desc limit "+page*pageSize+","+pageSize;
 | 
												
													
														
															|  |             result =   jdbcTemplate.queryForList(sql);
 |  |             result =   jdbcTemplate.queryForList(sql);
 | 
												
													
														
															|  |         }
 |  |         }
 | 
												
													
														
															|  | 
 |  |         //获取居民的设备code
 | 
												
													
														
															|  | 
 |  |         List<String> patientCodes = new ArrayList<>();
 | 
												
													
														
															|  | 
 |  |         for (Map<String, Object> map : result) {
 | 
												
													
														
															|  | 
 |  |             if(!patientCodes.contains(map.get("patient").toString())){
 | 
												
													
														
															|  | 
 |  |                 patientCodes.add(map.get("patient").toString());
 | 
												
													
														
															|  | 
 |  |             }
 | 
												
													
														
															|  | 
 |  |         }
 | 
												
													
														
															|  | 
 |  |         List<Map<String, Object>> list = this.getUserCodeByPatientList(patientCodes);
 | 
												
													
														
															|  | 
 |  |         for (Map<String, Object> map : list) {
 | 
												
													
														
															|  | 
 |  |             for (Map<String, Object> l : result) {
 | 
												
													
														
															|  | 
 |  |                 if(map.get("user").toString().equals(l.get("patient").toString())){
 | 
												
													
														
															|  | 
 |  |                     l.put("patientDevices",map.get("code").toString());
 | 
												
													
														
															|  | 
 |  |                 }
 | 
												
													
														
															|  | 
 |  |             }
 | 
												
													
														
															|  | 
 |  |         }
 | 
												
													
														
															|  |         return result;
 |  |         return result;
 | 
												
													
														
															|  |     }
 |  |     }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |     public JSONObject getEmeAndSecuOrderTab(String doctor,String status){
 |  |     public JSONObject getEmeAndSecuOrderTab(String doctor,String status){
 | 
												
													
														
															|  |         JSONObject result = new JSONObject();
 |  |         JSONObject result = new JSONObject();
 | 
												
													
														
															|  |         JSONObject eme = new JSONObject();
 |  |         JSONObject eme = new JSONObject();
 | 
												
											
												
													
														
															|  | @ -1813,4 +1819,26 @@ public class EmergencyAssistanceService extends BaseJpaService<EmergencyAssistan
 | 
												
													
														
															|  |         return result;
 |  |         return result;
 | 
												
													
														
															|  |     }
 |  |     }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |     /**
 | 
												
													
														
															|  | 
 |  |      * 根据用户code集合获取设备码
 | 
												
													
														
															|  | 
 |  |      * @param patientCodes
 | 
												
													
														
															|  | 
 |  |      * @return
 | 
												
													
														
															|  | 
 |  |      */
 | 
												
													
														
															|  | 
 |  |     List<Map<String, Object>> getUserCodeByPatientList(List<String> patientCodes){
 | 
												
													
														
															|  | 
 |  |         List<Map<String, Object>> list = new ArrayList<>();
 | 
												
													
														
															|  | 
 |  |         String inSql = "";
 | 
												
													
														
															|  | 
 |  |         for (String code : patientCodes) {
 | 
												
													
														
															|  | 
 |  |             inSql += "'"+code+"',";
 | 
												
													
														
															|  | 
 |  |         }
 | 
												
													
														
															|  | 
 |  |         if(StringUtils.isNotBlank(inSql)) {
 | 
												
													
														
															|  | 
 |  |             inSql = inSql.substring(0, inSql.lastIndexOf(","));
 | 
												
													
														
															|  | 
 |  |             //居民绑定的设备code
 | 
												
													
														
															|  | 
 |  |             String deviceSql = "SELECT user,GROUP_CONCAT( DISTINCT category_code SEPARATOR ',' ) code  " +
 | 
												
													
														
															|  | 
 |  |                     "from wlyy_patient_device where del = 0 and user in (" + inSql + ") group by user";
 | 
												
													
														
															|  | 
 |  |             list = jdbcTemplate.queryForList(deviceSql);
 | 
												
													
														
															|  | 
 |  |         }
 | 
												
													
														
															|  | 
 |  |         return list;
 | 
												
													
														
															|  | 
 |  |     }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | }
 |  | }
 |