| 
					
				 | 
			
			
				@ -9,11 +9,11 @@ import com.yihu.jw.care.dao.device.PatientSafeAreaDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.care.dao.log.BaseConsultWaresManageDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.care.dao.log.BaseFamilyPushOnOffDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.care.dao.log.BasePatientPadPushOnOffDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.care.dao.message.OrgNoticeDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.care.dao.message.UserNoticeDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.care.dao.message.*; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.care.dao.security.BaseEmergencyWarnLogDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.care.service.assistance.EmergencyAssistanceService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.care.service.device.PatientDeviceService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.care.service.device.YsDeviceService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.entity.base.notice.UserNoticeDO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.entity.base.patient.BasePatientDO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.entity.care.device.PatientSafeAreaDO; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -22,8 +22,7 @@ import com.yihu.jw.entity.care.securitymonitoring.BaseEmergencyWarnLogDO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.entity.child.BaseChildManage; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.entity.child.BaseConsultWaresManageEntity; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.entity.hospital.message.SystemMessageDO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.entity.log.BaseFamilyPushOnOffEntity; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.entity.log.ZhaohuiDailyEntity; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.entity.log.*; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.hospital.message.dao.SystemMessageDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.patient.dao.BasePatientDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.restmodel.ResponseContant; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -74,38 +73,38 @@ public class PatientMessageService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private BaseFamilyPushOnOffDao baseFamilyPushOnOffDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public PageEnvelop getNoticeList(String patient,String beginTime, String endTime, int page, int size){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        page = page>0?page-1:0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public PageEnvelop getNoticeList(String patient, String beginTime, String endTime, int page, int size) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        page = page > 0 ? page - 1 : 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String sqlCount = "select count(t.id) from base_org_notice t INNER JOIN base_user_notice usno on t.id = CONVERT(usno.notice_id USING utf8) and usno.del=1 " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "where t.del=1 "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String sql = "select t.id,t.title,t.org_code orgCode,t.org_name orgName,DATE_FORMAT(t.notice_time,'%Y-%m-%d %H:%i:%S') noticeTime, " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "t.content,t.img,usno.is_read isRead from base_org_notice t INNER JOIN base_user_notice usno on t.id = CONVERT(usno.notice_id USING utf8) " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "and usno.del=1 where t.del=1 "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String sqlCondition =""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNotBlank(patient)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sqlCondition += " and usno.user_id = '"+patient+"' "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String sqlCondition = ""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNotBlank(patient)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sqlCondition += " and usno.user_id = '" + patient + "' "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNotBlank(beginTime)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sqlCondition += " and t.notice_time >= '"+beginTime+"' "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNotBlank(beginTime)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sqlCondition += " and t.notice_time >= '" + beginTime + "' "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNotBlank(endTime)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sqlCondition += " and t.notice_time <= '"+endTime+"' "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNotBlank(endTime)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sqlCondition += " and t.notice_time <= '" + endTime + "' "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String time = DateUtil.getStringDate(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        sqlCondition += " and t.notice_time <= '"+time+"' "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        sqlCondition += " and t.notice_time <= '" + time + "' "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Long count = jdbcTemplate.queryForObject(sqlCount+sqlCondition,Long.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        sqlCondition += " order by t.notice_time desc limit "+page*size+","+size; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<Map<String,Object>> list = jdbcTemplate.queryForList(sql+sqlCondition); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return PageEnvelop.getSuccessListWithPage("查询成功",list,page,size,count); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Long count = jdbcTemplate.queryForObject(sqlCount + sqlCondition, Long.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        sqlCondition += " order by t.notice_time desc limit " + page * size + "," + size; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<Map<String, Object>> list = jdbcTemplate.queryForList(sql + sqlCondition); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return PageEnvelop.getSuccessListWithPage("查询成功", list, page, size, count); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public OrgNoticeDO orgNoticeDetail(String noticeId,String patient){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        OrgNoticeDO orgNoticeDO =  orgNoticeDao.findOne(noticeId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (orgNoticeDO!=null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            UserNoticeDO userNoticeDO =  userNoticeDao.findByNoticeIdAndUserIdAndDel(orgNoticeDO.getId(),patient,1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (userNoticeDO!=null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public OrgNoticeDO orgNoticeDetail(String noticeId, String patient) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        OrgNoticeDO orgNoticeDO = orgNoticeDao.findOne(noticeId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (orgNoticeDO != null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            UserNoticeDO userNoticeDO = userNoticeDao.findByNoticeIdAndUserIdAndDel(orgNoticeDO.getId(), patient, 1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (userNoticeDO != null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                userNoticeDO.setIsRead(1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                userNoticeDao.save(userNoticeDO); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -114,79 +113,75 @@ public class PatientMessageService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     *50 紧急预警系统消息 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 50 紧急预警系统消息 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public List<Map<String,Object>> getSystemMessage(String patient,String agent){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        patient = "'"+patient+"'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNotBlank(agent)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            patient +=",'"+agent+"'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public List<Map<String, Object>> getSystemMessage(String patient, String agent) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        patient = "'" + patient + "'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNotBlank(agent)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            patient += ",'" + agent + "'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String sql = " select A.*,B.notRead from " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "(select  count(1) as 'all',type,DATE_FORMAT(MAX(create_time),'%Y-%m-%d %H:%i:%S') create_time " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "from base_system_message where receiver in("+patient+") and del=1  GROUP BY type ORDER BY create_time desc)A " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "from base_system_message where receiver in(" + patient + ") and del=1  GROUP BY type ORDER BY create_time desc)A " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "LEFT JOIN (select count(1) notRead,type " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "from base_system_message where receiver in("+patient+") and (is_read=0 or is_read is null ) and del=1  GROUP BY type)B on A.type = B.type " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "from base_system_message where receiver in(" + patient + ") and (is_read=0 or is_read is null ) and del=1  GROUP BY type)B on A.type = B.type " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "ORDER BY A.create_time desc "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return jdbcTemplate.queryForList(sql); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param patient 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param type 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * type=50,code:20紧急救助 22安防监护 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * type=41,code:1 生日祝福 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * type=42,code与体征类型对应 体征设备数据 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param type    type=50,code:20紧急救助 22安防监护 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     *                type=41,code:1 生日祝福 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     *                type=42,code与体征类型对应 体征设备数据 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public List<Map<String,Object>> getSystemMessageList(String patient,String type,String isRead,String agent){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        patient = "'"+patient+"'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNotBlank(agent)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            patient +=",'"+agent+"'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public List<Map<String, Object>> getSystemMessageList(String patient, String type, String isRead, String agent) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        patient = "'" + patient + "'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNotBlank(agent)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            patient += ",'" + agent + "'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String typeIn = " '"+type.replace(",","','")+"' "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String typeIn = " '" + type.replace(",", "','") + "' "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String sql = " select id,title,type,relation_code,sender,content,sender_name,is_read,code,DATE_FORMAT(create_time,'%Y-%m-%d %H:%i:%S') create_time,data " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "from base_system_message where receiver in ("+patient+") and del=1 and type in ("+typeIn+" )  " ; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNotBlank(isRead)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if ("1".equals(isRead)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "from base_system_message where receiver in (" + patient + ") and del=1 and type in (" + typeIn + " )  "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNotBlank(isRead)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if ("1".equals(isRead)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                sql += " and is_read = '1'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            }else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                sql += " and ( is_read = '0' or is_read is null ) "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         sql +=  "ORDER BY create_time desc"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        sql += "ORDER BY create_time desc"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return jdbcTemplate.queryForList(sql); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    //获取天气 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public JSONObject envMessage(){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public JSONObject envMessage() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return emergencyAssistanceService.getBaiduWeather(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public List<Map<String,Object>> getSystemMessageListPad(String patient,String type){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public List<Map<String, Object>> getSystemMessageListPad(String patient, String type) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (!StringUtils.isNotBlank(type)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            type = "41,42,991,992,993,994,995,996,999"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String sql = "SELECT id,type,title,sender_name,DATE_FORMAT(create_time,'%Y-%m-%d %H:%i:%S') create_time,is_read,data,content,audio_url as audioUrl " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " FROM base_system_message WHERE type IN ("+type+") and receiver = '"+patient+"'" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " FROM base_system_message WHERE type IN (" + type + ") and receiver = '" + patient + "'" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " AND del = 1  ORDER BY create_time DESC "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return  jdbcTemplate.queryForList(sql); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return jdbcTemplate.queryForList(sql); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public void updateMessageRead(String messageId){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public void updateMessageRead(String messageId) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        SystemMessageDO messageDO = systemMessageDao.findOne(messageId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        messageDO.setIsRead("1"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        messageDO.setOver("1"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        systemMessageDao.save(messageDO); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if ("50" .equals(messageDO.getType())){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if ("50".equals(messageDO.getType())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            BasePatientDO patientDO = patientDao.findById(messageDO.getReceiver()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (null!=patientDO){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (null != patientDO) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                BaseEmergencyWarnLogDO logDO = new BaseEmergencyWarnLogDO(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                logDO.setUserCode(patientDO.getId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                logDO.setUserName(patientDO.getName()); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -199,46 +194,45 @@ public class PatientMessageService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public void delMessageRead(String msgId){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public void delMessageRead(String msgId) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        SystemMessageDO systemMessageDO = systemMessageDao.findOne(msgId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (systemMessageDO!=null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (systemMessageDO != null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            systemMessageDO.setDel("0"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            systemMessageDao.save(systemMessageDO); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param msgId 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param safe_area 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @Transactional(rollbackFor =Exception.class ) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public JSONObject ConfirmFences(String msgId,String safe_area){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @Transactional(rollbackFor = Exception.class) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public JSONObject ConfirmFences(String msgId, String safe_area) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        JSONObject result = new JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        SystemMessageDO systemMessageDO = systemMessageDao.findOne(msgId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if ("1".equals(systemMessageDO.getData())){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            result.put(ResponseContant.resultFlag,ResponseContant.fail); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            result.put(ResponseContant.resultMsg,"已有家属确认管理,无需再次确认!"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if ("1".equals(systemMessageDO.getData())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            result.put(ResponseContant.resultFlag, ResponseContant.fail); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            result.put(ResponseContant.resultMsg, "已有家属确认管理,无需再次确认!"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return result; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<PatientSafeAreaDO> patientSafeAreaDOs = patientSafeAreaDao.findByPatient2(systemMessageDO.getRelationCode()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        PatientSafeAreaDO patientSafeAreaDO = null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (patientSafeAreaDOs.size()>0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (patientSafeAreaDOs.size() > 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            patientSafeAreaDO = patientSafeAreaDOs.get(0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        }else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            result.put(ResponseContant.resultFlag,ResponseContant.fail); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            result.put(ResponseContant.resultMsg,"居民未绑定防走失设备!"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            result.put(ResponseContant.resultFlag, ResponseContant.fail); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            result.put(ResponseContant.resultMsg, "居民未绑定防走失设备!"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return result; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNotBlank(safe_area)&&null != patientSafeAreaDO){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNotBlank(safe_area) && null != patientSafeAreaDO) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            patientSafeAreaDO.setSafeAreaGz(safe_area); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //更新围栏 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Integer successFlag = patientDeviceService.updatePatientSafeArea(systemMessageDO.getRelationCode(),patientSafeAreaDO.getSafeAreaGz()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Integer successFlag = patientDeviceService.updatePatientSafeArea(systemMessageDO.getRelationCode(), patientSafeAreaDO.getSafeAreaGz()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        patientSafeAreaDO.setManageStatus(1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        patientSafeAreaDO.setSuccessFlag(successFlag); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -246,23 +240,23 @@ public class PatientMessageService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //修改数据 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        patientSafeAreaConfirmDao.manageByPatient(patientSafeAreaDO.getPatient()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        systemMessageDao.readByTypeAndRelationCode("44",patientSafeAreaDO.getPatient(),"1"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        result.put(ResponseContant.resultFlag,ResponseContant.success); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        result.put(ResponseContant.resultMsg,"已确认"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        systemMessageDao.readByTypeAndRelationCode("44", patientSafeAreaDO.getPatient(), "1"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        result.put(ResponseContant.resultFlag, ResponseContant.success); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        result.put(ResponseContant.resultMsg, "已确认"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return result; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    //pad端 获取居民推送开关 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public List<Map<String, Object>> patientPadPushOnOff(String patient){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String sql = "select patient,type,type_name,on_off from base_patient_pad_pushonoff where patient ='"+patient+"'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public List<Map<String, Object>> patientPadPushOnOff(String patient) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String sql = "select patient,type,type_name,on_off from base_patient_pad_pushonoff where patient ='" + patient + "'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<Map<String, Object>> list = jdbcTemplate.queryForList(sql); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return list; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    //家属端 获取家属开关 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public List<Map<String, Object>> familyPushOnOff(String patient){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String sql = "select patient,type,type_name,on_off from base_patient_family_pushonoff where patient ='"+patient+"'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public List<Map<String, Object>> familyPushOnOff(String patient) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String sql = "select patient,type,type_name,on_off from base_patient_family_pushonoff where patient ='" + patient + "'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<Map<String, Object>> list = jdbcTemplate.queryForList(sql); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return list; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -275,18 +269,18 @@ public class PatientMessageService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @Transactional(rollbackFor = Exception.class) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public void cshOnOff(){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public void cshOnOff() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        JSONObject jsonObject = new JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        JSONArray jsonArray = new JSONArray(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<BaseFamilyPushOnOffEntity> onOffEntityList = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        jsonObject.put("1","紧急预警"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        jsonObject.put("1", "紧急预警"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        jsonArray.add(jsonObject); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        jsonObject.put("2","设备动态"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        jsonObject.put("2", "设备动态"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        jsonArray.add(jsonObject); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        jsonObject.put("3","体征动态"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        jsonObject.put("3", "体征动态"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        jsonArray.add(jsonObject); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        jsonObject.put("4","平台通知"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        jsonObject.put("4", "平台通知"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        jsonArray.add(jsonObject); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -299,7 +293,7 @@ public class PatientMessageService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                BaseFamilyPushOnOffEntity ent = new BaseFamilyPushOnOffEntity(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                ent.setPatient(basePatientDO.getId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                ent.setType(i); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                ent.setTypeName(jsonArray.getJSONObject(0).getString(i+"")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                ent.setTypeName(jsonArray.getJSONObject(0).getString(i + "")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                ent.setOnOff(1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                ent.setCreateTime(new Date()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                onOffEntityList.add(ent); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -319,37 +313,124 @@ public class PatientMessageService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public List<ZhaohuiDailyEntity> getZhaoHuiRiBaoList(String start,String end,String patient) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        StringBuffer sql  =new StringBuffer("select * from base_zhaohui_daily where patient = '"+patient+"'  ") ; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNotBlank(start)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql.append(" and create_time >='"+start+"' "); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private ZhaohuiDailySleepDao zhaohuiDailySleepDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private ZhaohuiDailyVideoDao zhaohuiDailyVideoDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private ZhaohuiDailyWatchDao zhaohuiDailyWatchDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private ZhaohuiDailyEmeDao zhaohuiDailyEmeDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private ZhaohuiDailyDao zhaohuiDailyDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private YsDeviceService ysDeviceService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public JSONObject getZHaohuiRiBaoInfo(String patient, String dailyId){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        JSONObject result = new JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //基本信息 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        ZhaohuiDailyEntity baseInfo = zhaohuiDailyDao.findById(Long.parseLong(dailyId)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        result.put("baseInfo",baseInfo); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //睡眠带 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        JSONObject sleepObject = new  JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        ZhaohuiDailySleepEntity sleepEntity = zhaohuiDailySleepDao.findByDailyId(dailyId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (null != sleepEntity) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sleepObject.put("sleepObject",sleepEntity); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sleepObject.put("status",1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        }else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sleepObject.put("status",0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        result.put("sleep",sleepObject); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //监控 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        JSONObject videoObject = new JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<ZhaohuiDailyVideoEntity> videoEntityList = zhaohuiDailyVideoDao.findByDailyId(dailyId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (videoEntityList.size()>0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //取之前时间的监控 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            try { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    videoObject.put("status", 1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    String[] time = videoEntityList.get(0).getTime().split(","); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    JSONObject tmp = ysDeviceService.videoList2(patient, videoEntityList.get(0).getDeviceSn(), 1, null, null, 4, null, time[0], time[1], "2", null, null, null); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    videoObject.put("monitorInfoStatus", tmp.getIntValue(ResponseContant.resultFlag)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    if (tmp.getIntValue(ResponseContant.resultFlag) == ResponseContant.fail) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        videoObject.put("monitorInfo", tmp.getString(ResponseContant.resultMsg)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        JSONObject js1 = tmp.getJSONObject(ResponseContant.resultMsg); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        js1.put("hdAddress", js1.getString("url")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        videoObject.put("monitorInfo", js1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } catch (Exception e) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                e.printStackTrace(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                videoObject.put("monitorInfoStatus", 0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                videoObject.put("monitorInfo", "未获取到当天录像信息"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        }else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            videoObject.put("status",0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        result.put("video",videoObject); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNotBlank(end)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql.append(" and create_time <= '"+end+"' "); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //手表 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        ZhaohuiDailyWatchEntity watchEntity = zhaohuiDailyWatchDao.findByDailyId(dailyId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        JSONObject watchObject = new JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (null!=watchEntity) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            watchObject.put("watchObject",watchEntity); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            watchObject.put("status",1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        }else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            watchObject.put("status",0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        result.put("watch",watchObject); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //紧急预警 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        ZhaohuiDailyEmeEntity emeEntity = zhaohuiDailyEmeDao.findByDailyId(dailyId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        JSONObject emeObject = new JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (null!=emeEntity) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            emeObject.put("emeObject",emeEntity); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            emeObject.put("status",1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        }else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            emeObject.put("status",0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        result.put("eme",emeObject); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return result; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public List<Map<String, Object>> getZhaoHuiRiBaoList(String start, String end, String patient) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<ZhaohuiDailyEntity> zhaohuiDailyEntities = jdbcTemplate.queryForList(sql.toString(), ZhaohuiDailyEntity.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return  zhaohuiDailyEntities; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            StringBuffer sql = new StringBuffer("SELECT  id,eme_num,service,DATE_FORMAT(create_time,'%Y-%m-%d %H:%i:%s') as create_time,patient_name FROM base_zhaohui_daily WHERE family_code = '" + patient + "' "); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (StringUtils.isNotBlank(start)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                sql.append(" and create_time >='" + start + "' "); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (StringUtils.isNotBlank(end)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                sql.append(" and create_time <= '" + end + "' "); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<Map<String, Object>> list = jdbcTemplate.queryForList(sql.toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return list; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public List<Map<String, Object>> getFamilySystemMessageList(String type,String patient,String startTime,String endTime){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        StringBuffer sql = new StringBuffer("select id,code,type,title,sender,sender_name,receiver,receiver_name,data,is_read,del,DATE_FORMAT(create_time,'%Y-%m-%d %H:%i:%s') as create_time ,content,user_type from base_system_message where user_type = 3 and type in ("+type+") and receiver = '"+patient+"' "); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public List<Map<String, Object>> getFamilySystemMessageList(String type, String patient, String startTime, String endTime) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        StringBuffer sql = new StringBuffer("select id,code,type,title,sender,sender_name,receiver,receiver_name,data,is_read,del,DATE_FORMAT(create_time,'%Y-%m-%d %H:%i:%s') as create_time ,content,user_type from base_system_message where user_type = 3 and type in (" + type + ") and receiver = '" + patient + "' "); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNotBlank(startTime)&&StringUtils.isNotBlank(endTime)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            startTime = startTime+" 00:00:00"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            endTime = endTime+" 23:59:59"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql.append(" and create_time >= '"+startTime+"' and  create_time<='"+endTime+"' "); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNotBlank(startTime) && StringUtils.isNotBlank(endTime)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            startTime = startTime + " 00:00:00"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            endTime = endTime + " 23:59:59"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql.append(" and create_time >= '" + startTime + "' and  create_time<='" + endTime + "' "); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<Map<String, Object>> list = jdbcTemplate.queryForList(sql.toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return list; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    //落地页-保存登记信息 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @Transactional(rollbackFor = Exception.class) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public void saveRegisterInfo(String name,String phone,String type){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public void saveRegisterInfo(String name, String phone, String type) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        BaseConsultWaresManageEntity entity = new BaseConsultWaresManageEntity(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        entity.setName(name); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        entity.setMobile(phone); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -362,19 +443,19 @@ public class PatientMessageService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private BaseChildManageDao baseChildManageDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    //落地页-获取商品文章 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public List<Map<String, Object>> getDeviceArticleList(String id){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public List<Map<String, Object>> getDeviceArticleList(String id) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<Map<String, Object>> list = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String sql = ""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNotBlank(id)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql = "select id,type,org_name,title,url,img,click,sort,del*1 as del,DATE_FORMAT(create_time,'%Y-%m-%d') as create_time from base_child_manage where type = 5 and del = 1 and id='"+id+"' order by sort"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql = "select id,type,org_name,title,url,img,click,sort,del*1 as del,DATE_FORMAT(create_time,'%Y-%m-%d') as create_time from base_child_manage where type = 5 and del = 1 and id='" + id + "' order by sort"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            list = jdbcTemplate.queryForList(sql); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (list.size()>0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (list.size() > 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                BaseChildManage baseChildManage = JSONObject.parseObject(JSON.toJSON(list.get(0)).toString(), BaseChildManage.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                baseChildManage.setClick(baseChildManage.getClick()+1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                baseChildManage.setClick(baseChildManage.getClick() + 1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                baseChildManageDao.save(baseChildManage); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        }else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql = "select *  from base_child_manage where type = 5 and del = 1 order by sort"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            list = jdbcTemplate.queryForList(sql); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -383,13 +464,10 @@ public class PatientMessageService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public List<Map<String, Object>>  getDeviceArticleDict(){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public List<Map<String, Object>> getDeviceArticleDict() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String sql = "select id,dict_name,dict_code,dict_value from wlyy_hospital_sys_dict where dict_name = 'consultService' order by sort  "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return jdbcTemplate.queryForList(sql); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				} 
			 |