| 
					
				 | 
			
			
				@ -276,7 +276,7 @@ public class MessageService extends BaseService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public List<Map<String, Object>> getHealthIndexMessage(String doctor) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<Map<String, Object>> re = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String sql = "select a.sender,a.tz_type,count(1) count,max(date_format(a.czrq,'%Y-%c-%d %H:%i:%s')) last_time,a.has_read from wlyy_Message a where a.receiver='" + doctor + "' and a.type='2' group by a.sender,a.tz_type,a.has_read order by last_time desc"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String sql = "select a.sender,a.tz_type,count(1) count,max(date_format(a.create_time,'%Y-%c-%d %H:%i:%s')) last_time from wlyy_Message a where a.receiver='" + doctor + "' and a.has_read='1' and a.type='2' group by a.sender,a.tz_type order by last_time desc"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<Map<String, Object>> list = jdbcTemplate.queryForList(sql); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Map<String,Map<String, Object>> map = new HashMap<>(); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -287,38 +287,23 @@ public class MessageService extends BaseService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            Patient patient = patientDao.findByCode(patientCode); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (patient != null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                String type = String.valueOf(item.get("tz_type")); //1血糖,2血压,3体重,4腰 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                String read = String.valueOf(item.get("has_read")); //0已读,1未读 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                String patientType = patientCode + type; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if(map.containsKey(patientType)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    obj = map.get(patientType); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    if(obj.get("time").toString().compareTo(item.get("last_time").toString())<0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        obj.put("time", item.get("last_time")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                }else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    obj = new HashMap<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    obj.put("patient", patientCode); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    obj.put("type", type); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    obj.put("time", item.get("last_time")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    obj.put("name", patient.getName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    obj.put("sex", patient.getSex()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    obj.put("birthday", DateUtil.dateToStrShort(patient.getBirthday())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    obj.put("photo", patient.getPhoto()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if("1".equals(read)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    obj.put("count1", item.get("count")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                }else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    obj.put("count0", item.get("count")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                obj.put("patient", patientCode); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                obj.put("type", type); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                obj.put("time", item.get("last_time")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                obj.put("name", patient.getName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                obj.put("sex", patient.getSex()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                obj.put("birthday", DateUtil.dateToStrShort(patient.getBirthday())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                obj.put("sex", patient.getSex()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                obj.put("photo", patient.getPhoto()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if ("1".equals(type)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    obj.put("message", "有" + item.get("count") + "条血糖异常未读消息"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } else if ("2".equals(type)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    obj.put("message", "有" + item.get("count") + "条血压异常未读消息"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    obj.put("message", "暂无未读消息"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                map.put(patientType,obj); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                if ("1".equals(type)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                    obj.put("message", "有" + item.get("count") + "条血糖异常未读消息"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                } else if ("2".equals(type)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                    obj.put("message", "有" + item.get("count") + "条血压异常未读消息"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                    break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                re.add(obj); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                re.add(obj); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                System.out.print("not exit patient!code:" + patientCode); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -337,6 +322,13 @@ public class MessageService extends BaseService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            obj.put("sex", item.get("sex")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            obj.put("birthday", item.get("birthday")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            obj.put("photo", item.get("photo")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if ("1".equals(type)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                obj.put("message", "有" + count1 + "条血糖异常未读消息"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } else if ("2".equals(type)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                obj.put("message", "有" + item.get("count") + "条血压异常未读消息"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if ("1".equals(type)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                obj.put("message", "有血糖异常未读消息"+count1+"条,已读消息"+count0+"条"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } else if ("2".equals(type)) { 
			 |