| 
					
				 | 
			
			
				@ -1,6 +1,8 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				package com.yihu.jw.base.service.ManageMessagePush; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.alibaba.fastjson.JSON; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.alibaba.fastjson.JSONObject; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.alibaba.fastjson.serializer.SerializerFeature; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.base.dao.log.BasePushRecordLogDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.base.dao.log.BasePushrecordLogInfoDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.entity.base.patient.BasePatientDO; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -9,6 +11,7 @@ import com.yihu.jw.entity.log.BasePushRecordLogEntity; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.entity.log.BasePushrecordLogInfoEntity; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.hospital.dict.WlyyHospitalSysDictDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.hospital.message.dao.SystemMessageDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.im.util.ImUtil; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.util.date.DateUtil; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import org.apache.commons.lang3.StringUtils; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import org.springframework.beans.factory.annotation.Autowired; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -19,7 +22,11 @@ import org.springframework.stereotype.Service; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import org.springframework.transaction.annotation.Transactional; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import org.springframework.web.client.RestTemplate; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import java.util.*; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import java.util.ArrayList; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import java.util.Date; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import java.util.List; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import java.util.UUID; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				/** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 * Created by wsl on 2022/7/4 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -40,11 +47,14 @@ public class ManageSystemPushMessageService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private WlyyHospitalSysDictDao dictDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private RestTemplate restTemplate; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private ImUtil imUtil; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /*   SELECT p.id,p.name  FROM base_patient p INNER JOIN wlyy_patient_device d ON p.id = d.`user` 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    WHERE p.sign_status = 0 AND p.del = 1 AND d.del = 0 AND p.id NOT IN ( SELECT dict_code FROM `base`.`wlyy_hospital_sys_dict` WHERE `dict_name` = 'jkzl_older' OR dict_name = 'jkzl_child' )*/ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 获取签约老人 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param name 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -218,8 +228,9 @@ public class ManageSystemPushMessageService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            systemMessageDO.setOver("1"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            systemMessageDO.setDel("1"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            systemMessageDO.setCreateTime(new Date()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            systemMessageDO.setAudioUrl(audioUrl(content)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            systemMessageDO.setAudioUrl(audioUrl(data)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            messageDOS.add(systemMessageDO); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            patientMessageSocket(systemMessageDO); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        systemMessageDao.save(messageDOS); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -255,6 +266,17 @@ public class ManageSystemPushMessageService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private void patientMessageSocket(SystemMessageDO messageDOWatch){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        JSONObject message = new JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        message.put("title",messageDOWatch.getTitle()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        message.put("type",messageDOWatch.getType()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        message.put("content",messageDOWatch.getContent()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        message.put("audioUrl",messageDOWatch.getAudioUrl()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        message.put("content_type",999); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        imUtil.sendPatientSystemMessage(messageDOWatch.getReceiver(), JSON.toJSONString(message, SerializerFeature.WriteMapNullValue)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 |