|
@ -1,13 +1,11 @@
|
|
|
package com.yihu.wlyy.service.app.message;
|
|
|
|
|
|
import java.util.Date;
|
|
|
import java.util.HashMap;
|
|
|
import java.util.Map;
|
|
|
import java.util.UUID;
|
|
|
import java.util.*;
|
|
|
|
|
|
import javax.transaction.Transactional;
|
|
|
|
|
|
import com.yihu.wlyy.entity.message.Message;
|
|
|
import com.yihu.wlyy.entity.patient.Patient;
|
|
|
import com.yihu.wlyy.repository.message.MessageDao;
|
|
|
import com.yihu.wlyy.util.DateUtil;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
@ -18,6 +16,8 @@ import org.springframework.data.domain.PageRequest;
|
|
|
import org.springframework.data.domain.Sort;
|
|
|
import org.springframework.data.domain.Sort.Direction;
|
|
|
import org.springframework.data.jpa.domain.Specification;
|
|
|
import org.springframework.jdbc.core.BeanPropertyRowMapper;
|
|
|
import org.springframework.jdbc.core.JdbcTemplate;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
import org.springside.modules.persistence.DynamicSpecifications;
|
|
|
import org.springside.modules.persistence.SearchFilter;
|
|
@ -40,6 +40,8 @@ public class MessageService extends BaseService {
|
|
|
private ConsultTeamDao consultTeamDao;
|
|
|
@Autowired
|
|
|
private MessageDao messageDao;
|
|
|
@Autowired
|
|
|
private JdbcTemplate jdbcTemplate;
|
|
|
|
|
|
/**
|
|
|
* 汇总查询医生的消息总数
|
|
@ -280,4 +282,23 @@ public class MessageService extends BaseService {
|
|
|
return messageDao.findAll(spec, pageRequest);
|
|
|
}
|
|
|
|
|
|
public JSONObject findMessageNum(String doctor, Integer type) {
|
|
|
JSONObject jo=new JSONObject();
|
|
|
//得到消息总数
|
|
|
int count= messageDao.findMessageNum(doctor,type);
|
|
|
String DateString="";
|
|
|
String message="";
|
|
|
String sql="select w.* from wlyy_message w where w.type=3 and w.receiver='"+doctor+"' order by w.czrq desc limit 0,1";
|
|
|
List<Message> returnList= jdbcTemplate.query(sql,new BeanPropertyRowMapper(Message.class));
|
|
|
if(returnList!=null&&returnList.size()>0){
|
|
|
Message m=returnList.get(0);
|
|
|
DateString=DateUtil.dateToStrShort(m.getCzrq());
|
|
|
message=m.getContent();
|
|
|
|
|
|
}
|
|
|
jo.put("count",count);
|
|
|
jo.put("message",message);
|
|
|
jo.put("date",DateString);
|
|
|
return jo;
|
|
|
}
|
|
|
}
|