|
@ -0,0 +1,83 @@
|
|
|
package com.yihu.jw.care.util;
|
|
|
|
|
|
import com.yihu.jw.care.dao.pushLog.BasePushRecordLogDao;
|
|
|
import com.yihu.jw.entity.hospital.message.SystemMessageDO;
|
|
|
import com.yihu.jw.entity.log.BasePushRecordLogEntity;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.jdbc.core.BeanPropertyRowMapper;
|
|
|
import org.springframework.jdbc.core.JdbcTemplate;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import java.util.Date;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
|
|
|
/**
|
|
|
* Created by wsl on 2022/7/29
|
|
|
*/
|
|
|
|
|
|
@Component
|
|
|
public class SystemPushMessageUtil {
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
private BasePushRecordLogDao basePushRecordLogDao;
|
|
|
@Autowired
|
|
|
private JdbcTemplate jdbcTemplate;
|
|
|
|
|
|
|
|
|
public List<Map<String, Object>> signOldPatient() {
|
|
|
String sql = "SELECT p.id,p.`name`,p.photo,p.sex FROM base_patient p " +
|
|
|
" WHERE p.sign_status = 1 AND p.del = 1 ";
|
|
|
List<Map<String, Object>> list = jdbcTemplate.queryForList(sql);
|
|
|
return list;
|
|
|
}
|
|
|
|
|
|
public Boolean findPatientPushOnOff(String patient, Integer type) {
|
|
|
String sql = "select on_off from base_patient_pad_pushonoff where patient = '" + patient + "' and type ='" + type + "'";
|
|
|
Integer integer = jdbcTemplate.queryForObject(sql, new BeanPropertyRowMapper<>(Integer.class));
|
|
|
return integer == 0 ? false : true;
|
|
|
}
|
|
|
|
|
|
|
|
|
//basePushRecordLogEntity
|
|
|
|
|
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public void basePushRecordLogEntitySave(String content, String push_type, Date sendTime, Integer num, Integer status, String sendObject, Integer sendObjectType, Integer messageType) {
|
|
|
BasePushRecordLogEntity basePushRecordLogEntity = new BasePushRecordLogEntity();
|
|
|
basePushRecordLogEntity.setContent(content);
|
|
|
basePushRecordLogEntity.setPushType(push_type);
|
|
|
basePushRecordLogEntity.setSendTime(sendTime);
|
|
|
basePushRecordLogEntity.setNum(num);
|
|
|
basePushRecordLogEntity.setStatus(status);
|
|
|
basePushRecordLogEntity.setSendObject(sendObject);
|
|
|
basePushRecordLogEntity.setSendObjectType(sendObjectType);
|
|
|
basePushRecordLogEntity.setMessageType(messageType);
|
|
|
basePushRecordLogEntity.setCreateTime(new Date());
|
|
|
basePushRecordLogDao.save(basePushRecordLogEntity);
|
|
|
}
|
|
|
|
|
|
|
|
|
public SystemMessageDO systemMessageDOSave(String title, String content, String type, String isRead, String sender, String senderName, String receiver, String receiverName, String over, String senderPhoto, String url) {
|
|
|
SystemMessageDO messageDO = new SystemMessageDO();
|
|
|
messageDO.setTitle(title);
|
|
|
messageDO.setContent(content);
|
|
|
messageDO.setType(type);
|
|
|
messageDO.setIsRead(isRead);
|
|
|
messageDO.setSender(sender);
|
|
|
messageDO.setSenderName(senderName);
|
|
|
messageDO.setReceiver(receiver);
|
|
|
messageDO.setReceiverName(receiverName);
|
|
|
messageDO.setOver(over);
|
|
|
// messageDO.setData(deviceName+"离线");
|
|
|
messageDO.setDel("1");
|
|
|
messageDO.setCreateTime(new Date());
|
|
|
messageDO.setSenderPhoto(senderPhoto);
|
|
|
messageDO.setAudioUrl(url);
|
|
|
return messageDO;
|
|
|
}
|
|
|
|
|
|
|
|
|
}
|