|
@ -18,6 +18,7 @@ import com.yihu.wlyy.util.HttpClientUtil;
|
|
import com.yihu.wlyy.util.IdCardUtil;
|
|
import com.yihu.wlyy.util.IdCardUtil;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.json.JSONObject;
|
|
import org.json.JSONObject;
|
|
|
|
import org.slf4j.LoggerFactory;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
import org.springframework.data.domain.Page;
|
|
import org.springframework.data.domain.Page;
|
|
@ -46,6 +47,8 @@ import java.util.*;
|
|
@Transactional(rollbackOn = Exception.class)
|
|
@Transactional(rollbackOn = Exception.class)
|
|
public class MessageService extends BaseService {
|
|
public class MessageService extends BaseService {
|
|
|
|
|
|
|
|
private static org.slf4j.Logger logger = LoggerFactory.getLogger(MessageService.class);
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
private ConsultTeamDao consultTeamDao;
|
|
private ConsultTeamDao consultTeamDao;
|
|
@Autowired
|
|
@Autowired
|
|
@ -67,6 +70,11 @@ public class MessageService extends BaseService {
|
|
|
|
|
|
@Value("${im.im_list_get}")
|
|
@Value("${im.im_list_get}")
|
|
private String im_list_get;
|
|
private String im_list_get;
|
|
|
|
|
|
|
|
@Value("${specialist.url}")
|
|
|
|
private String specialistUrl;
|
|
|
|
@Autowired
|
|
|
|
private HttpClientUtil httpClientUtil;
|
|
/**
|
|
/**
|
|
* IM消息数量
|
|
* IM消息数量
|
|
*/
|
|
*/
|
|
@ -621,8 +629,16 @@ public class MessageService extends BaseService {
|
|
}
|
|
}
|
|
buffer.deleteCharAt(buffer.length()-1);
|
|
buffer.deleteCharAt(buffer.length()-1);
|
|
buffer.append(")");
|
|
buffer.append(")");
|
|
String sql = " update wlyy_message a set a.has_read = 0,a.over = '0' where a.receiver = '"+doctor+"' and "+buffer;
|
|
|
|
int i = jdbcTemplate.update(sql);
|
|
|
|
|
|
int i = 0;
|
|
|
|
if (types.contains(19)&&types.contains(21)){
|
|
|
|
String sql = " update wlyy_message a set a.has_read = 0,a.over = '0' where a.receiver = '"+doctor+"' and "+buffer;
|
|
|
|
i = jdbcTemplate.update(sql);
|
|
|
|
}else {
|
|
|
|
String sql1 = " update wlyy_message a set a.has_read = 0,a.over = '0' where a.receiver = '"+doctor+"' and type = 20";
|
|
|
|
i=jdbcTemplate.update(sql1);
|
|
|
|
String sql2 = "update wlyy_message a set a.has_read = 0 where a.receiver = '"+doctor+"' and type IN (22,23)";
|
|
|
|
i=jdbcTemplate.update(sql2);
|
|
|
|
}
|
|
return Integer.toString(i);
|
|
return Integer.toString(i);
|
|
|
|
|
|
}
|
|
}
|
|
@ -865,14 +881,14 @@ public class MessageService extends BaseService {
|
|
public JSONObject selectUntreated(String doctor){
|
|
public JSONObject selectUntreated(String doctor){
|
|
|
|
|
|
//专科医生签约平台
|
|
//专科医生签约平台
|
|
List<Message> specialist = messageDao.getSpecialistApply(doctor,1,"1");
|
|
|
|
|
|
List<Message> specialist = messageDao.getSpecialistApply(doctor,"1");
|
|
JSONObject specialistJson = new JSONObject();
|
|
JSONObject specialistJson = new JSONObject();
|
|
if (specialist != null && specialist.size() != 0){
|
|
if (specialist != null && specialist.size() != 0){
|
|
specialistJson.put("amount", specialist.size());
|
|
specialistJson.put("amount", specialist.size());
|
|
JSONObject specialistObject = new JSONObject();
|
|
JSONObject specialistObject = new JSONObject();
|
|
specialistObject.put("title", specialist.get(0).getTitle());
|
|
specialistObject.put("title", specialist.get(0).getTitle());
|
|
specialistObject.put("type", specialist.get(0).getType());
|
|
specialistObject.put("type", specialist.get(0).getType());
|
|
specialistObject.put("msg", "您有"+specialist.size()+"个居民申请共管服务");
|
|
|
|
|
|
specialistObject.put("msg", "您有"+specialist.size()+"个消息待处理,请查收");
|
|
specialistObject.put("msgTime", DateUtil.dateToStrLong(specialist.get(0).getCreateTime()));
|
|
specialistObject.put("msgTime", DateUtil.dateToStrLong(specialist.get(0).getCreateTime()));
|
|
specialistObject.put("relationCode",specialist.get(0).getRelationCode());
|
|
specialistObject.put("relationCode",specialist.get(0).getRelationCode());
|
|
specialistJson.put("specialist",specialistObject);
|
|
specialistJson.put("specialist",specialistObject);
|
|
@ -919,7 +935,7 @@ public class MessageService extends BaseService {
|
|
public List<Message> getFamilySign(String receiver,Integer page, Integer size) throws Exception{
|
|
public List<Message> getFamilySign(String receiver,Integer page, Integer size) throws Exception{
|
|
|
|
|
|
// 排序
|
|
// 排序
|
|
Sort sort = new Sort(Sort.Direction.DESC, "read","over","createTime");
|
|
|
|
|
|
Sort sort = new Sort(Direction.DESC, "createTime");
|
|
// 分页信息
|
|
// 分页信息
|
|
Pageable pageRequest = new PageRequest(page - 1, size, sort);
|
|
Pageable pageRequest = new PageRequest(page - 1, size, sort);
|
|
return messageDao.selectFamilySign(receiver,pageRequest);
|
|
return messageDao.selectFamilySign(receiver,pageRequest);
|
|
@ -938,11 +954,11 @@ public class MessageService extends BaseService {
|
|
public List<Message> getSpecialistUnTreated(Message message, Integer page, Integer size) throws Exception{
|
|
public List<Message> getSpecialistUnTreated(Message message, Integer page, Integer size) throws Exception{
|
|
|
|
|
|
// 排序
|
|
// 排序
|
|
Sort sort = new Sort(Sort.Direction.DESC, "read","over","createTime");
|
|
|
|
|
|
Sort sort = new Sort(Sort.Direction.DESC, "createTime");
|
|
// 分页信息
|
|
// 分页信息
|
|
Pageable pageRequest = new PageRequest(page - 1, size, sort);
|
|
Pageable pageRequest = new PageRequest(page - 1, size, sort);
|
|
|
|
|
|
return messageDao.getSpecialistUntreated(message.getReceiver(),message.getRead(),message.getOver(),pageRequest);
|
|
|
|
|
|
return messageDao.getSpecialistUntreated(message.getReceiver(),message.getOver(),pageRequest);
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@ -984,6 +1000,45 @@ public class MessageService extends BaseService {
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 设置待办消息已处理
|
|
|
|
*
|
|
|
|
* @param id
|
|
|
|
* @param type
|
|
|
|
*/
|
|
|
|
public int setSpecialistOver(Long id,Integer type){
|
|
|
|
if (type == 22 || type==23){
|
|
|
|
int result = 0;
|
|
|
|
Message message = messageDao.findOne(id);
|
|
|
|
String response = null;
|
|
|
|
String url =specialistUrl + "svr-specialist/selectByIds";
|
|
|
|
Map<String,String> params = new HashMap<>();
|
|
|
|
params.put("ids",message.getRelationCode());
|
|
|
|
try {
|
|
|
|
response = httpClientUtil.httpPost(url,params);
|
|
|
|
com.alibaba.fastjson.JSONObject object = com.alibaba.fastjson.JSONObject.parseObject(response);
|
|
|
|
if (object.getInteger("status") == 200){
|
|
|
|
JSONArray array = object.getJSONArray("obj");
|
|
|
|
Integer count = 0;
|
|
|
|
for (int i =0;i<array.size();i++){
|
|
|
|
if (array.getJSONObject(i).getInteger("status") == 1){
|
|
|
|
count = count+1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (count == array.size()){
|
|
|
|
result = messageDao.setSpecialistById(id);
|
|
|
|
}else {
|
|
|
|
result = messageDao.setSpecialistReadById(id);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}catch (Exception e){
|
|
|
|
e.printStackTrace();
|
|
|
|
logger.error(e.getMessage());
|
|
|
|
}
|
|
|
|
return result;
|
|
|
|
}else {
|
|
|
|
return messageDao.setSpecialistById(id);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
}
|
|
}
|