|
@ -31,35 +31,29 @@ public class DoctorMessageController extends BaseController {
|
|
|
@Autowired
|
|
|
private MessageService messageService;
|
|
|
|
|
|
/**
|
|
|
* 医生消息总数统计接口
|
|
|
* @return
|
|
|
*/
|
|
|
@RequestMapping(value = "amount")
|
|
|
@RequestMapping(value = "messages")
|
|
|
@ResponseBody
|
|
|
public String amount() {
|
|
|
@ApiOperation("查询医生未读消息和最后消息")
|
|
|
public String messages() {
|
|
|
try {
|
|
|
JSONObject json = messageService.findDoctorAllMessageAmount(getUID());
|
|
|
if (json == null) {
|
|
|
return error(-1, "获取消息总数失败!");
|
|
|
} else {
|
|
|
return write(200, "获取消息总数成功!", "data", json);
|
|
|
}
|
|
|
JSONObject json = messageService.findDoctorAllMessage(getUID());
|
|
|
return write(200, "获取消息总数成功!", "data", json);
|
|
|
} catch (Exception e) {
|
|
|
error(e);
|
|
|
return error(-1, "获取消息总数失败!");
|
|
|
return error(-1, e.getMessage());
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 医生消息总数统计接口
|
|
|
* @return
|
|
|
*/
|
|
|
@RequestMapping(value = "messages")
|
|
|
@RequestMapping(value = "amount")
|
|
|
@ResponseBody
|
|
|
public String messages() {
|
|
|
public String amount() {
|
|
|
try {
|
|
|
JSONObject json = messageService.findDoctorAllMessage(getUID());
|
|
|
JSONObject json = messageService.findDoctorAllMessageAmount(getUID());
|
|
|
if (json == null) {
|
|
|
return error(-1, "获取消息总数失败!");
|
|
|
} else {
|
|
@ -114,53 +108,6 @@ public class DoctorMessageController extends BaseController {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 体征指标消息查询接口
|
|
|
* @param id
|
|
|
* @param pagesize
|
|
|
* @param isRead 1未读,0已读
|
|
|
* @return
|
|
|
*/
|
|
|
@RequestMapping(value = "health")
|
|
|
@ResponseBody
|
|
|
public String health(long id, int pagesize, @RequestParam(required = false) String isRead) {
|
|
|
try {
|
|
|
JSONArray array = new JSONArray();
|
|
|
Page<Message> list = messageService.findHealthListByDoctor(getUID(), id, pagesize, isRead);
|
|
|
for (Message msg : list) {
|
|
|
if (msg == null) {
|
|
|
continue;
|
|
|
}
|
|
|
JSONObject json = new JSONObject();
|
|
|
// 消息ID
|
|
|
json.put("id", msg.getId());
|
|
|
// 发送人标识
|
|
|
json.put("sender", msg.getSender());
|
|
|
// 发送人姓名
|
|
|
json.put("senderName", msg.getSenderName());
|
|
|
// 发送人头像
|
|
|
json.put("senderPhoto", msg.getSenderPhoto());
|
|
|
// 消息类型:1血糖,2血压
|
|
|
json.put("type", msg.getTzType());
|
|
|
// 是否已读:1未读,0已读
|
|
|
json.put("read", msg.getRead());
|
|
|
// 是否已读:
|
|
|
json.put("sex", msg.getSex());
|
|
|
// 当前值/收缩压,正数为高,负数为低
|
|
|
json.put("value1", msg.getValue1());
|
|
|
// 上次值/舒张压,正数为高,负数为低
|
|
|
json.put("value2", msg.getValue2());
|
|
|
// 发送时间
|
|
|
json.put("czrq", DateUtil.dateToStrLong(msg.getCzrq()));
|
|
|
array.put(json);
|
|
|
}
|
|
|
return write(200, "获取体征消息成功!", "list", array);
|
|
|
} catch (Exception e) {
|
|
|
error(e);
|
|
|
return error(-1, "获取体征消息失败!");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 更新体征消息为已读
|
|
|
* @param msgid
|
|
@ -168,6 +115,7 @@ public class DoctorMessageController extends BaseController {
|
|
|
*/
|
|
|
@RequestMapping(value = "read_health")
|
|
|
@ResponseBody
|
|
|
@ApiOperation("消息设置成已读")
|
|
|
public String readHealth(long msgid) {
|
|
|
try {
|
|
|
messageService.readHealth(msgid);
|
|
@ -178,16 +126,16 @@ public class DoctorMessageController extends BaseController {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 根据参数查询发送给我的消息
|
|
|
* @return
|
|
|
*/
|
|
|
@RequestMapping(value = "find")
|
|
|
@ResponseBody
|
|
|
public String find(String sender, String signStatus) {
|
|
|
@ApiOperation("查询发送给我的消息")
|
|
|
public String findMyMessage(String sender, String signStatus) {
|
|
|
try {
|
|
|
Message msg = messageService.findMessage(sender, getUID(), signStatus);
|
|
|
Message msg = messageService.findUnreadSign(sender, getUID(), signStatus);
|
|
|
JSONObject json = null;
|
|
|
if (msg != null) {
|
|
|
json = new JSONObject();
|
|
@ -206,11 +154,9 @@ public class DoctorMessageController extends BaseController {
|
|
|
return error(-1, "获取消息失败!");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* @param type 消息类型 1.是家庭签约信息 2.体征消息 3分配健管师
|
|
|
* @param id 消息id
|
|
|
* @param pagesize 每頁顯示條數
|
|
|
* @return
|
|
|
* @param type 消息类型 1.是家庭签约信息 2.体征消息 3系统消息(分配健管师 + 随访计划消息 )
|
|
|
*/
|
|
|
@RequestMapping(value = "findMessage")
|
|
|
@ResponseBody
|
|
@ -249,23 +195,7 @@ public class DoctorMessageController extends BaseController {
|
|
|
return error(-1, "获取消息失败!");
|
|
|
}
|
|
|
}
|
|
|
/**
|
|
|
* @param type 消息类型 1.是家庭签约信息 2.体征消息 3分配健管师
|
|
|
* @return
|
|
|
*/
|
|
|
@RequestMapping(value = "findMessageNum")
|
|
|
@ResponseBody
|
|
|
public String findMessageNum(Integer type) {
|
|
|
try {
|
|
|
|
|
|
JSONObject obj = messageService.findMessageNum(getUID(), type);
|
|
|
|
|
|
return write(200, "获取消息成功!", "list", obj);
|
|
|
} catch (Exception e) {
|
|
|
error(e);
|
|
|
return error(-1, "获取消息失败!");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
@RequestMapping(value = "getHealthIndexMessage",method = RequestMethod.GET)
|
|
@ -300,4 +230,75 @@ public class DoctorMessageController extends BaseController {
|
|
|
return invalidUserException(ex, -1, ex.getMessage());
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
* @param type 消息类型 1.是家庭签约信息 2.体征消息 3分配健管师
|
|
|
*/
|
|
|
@RequestMapping(value = "findMessageNum")
|
|
|
@ResponseBody
|
|
|
@ApiOperation("获取未读消息数(1.2.8版本作废)")
|
|
|
public String findMessageNum(@ApiParam(value="消息类型",defaultValue = "3")
|
|
|
@RequestParam Integer type) {
|
|
|
try {
|
|
|
|
|
|
JSONObject obj = messageService.findMessageNum(getUID(), type);
|
|
|
|
|
|
return write(200, "获取消息成功!", "list", obj);
|
|
|
} catch (Exception e) {
|
|
|
error(e);
|
|
|
return error(-1, "获取消息失败!");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 体征指标消息查询接口
|
|
|
* @param isRead 1未读,0已读
|
|
|
*/
|
|
|
@RequestMapping(value = "health")
|
|
|
@ResponseBody
|
|
|
@ApiOperation("体征指标消息查询接口(1.2.8版本作废)")
|
|
|
public String health(long id, int pagesize, @RequestParam(required = false) String isRead) {
|
|
|
try {
|
|
|
JSONArray array = new JSONArray();
|
|
|
Page<Message> list = messageService.findHealthListByDoctor(getUID(), id, pagesize, isRead);
|
|
|
for (Message msg : list) {
|
|
|
if (msg == null) {
|
|
|
continue;
|
|
|
}
|
|
|
JSONObject json = new JSONObject();
|
|
|
// 消息ID
|
|
|
json.put("id", msg.getId());
|
|
|
// 发送人标识
|
|
|
json.put("sender", msg.getSender());
|
|
|
// 发送人姓名
|
|
|
json.put("senderName", msg.getSenderName());
|
|
|
// 发送人头像
|
|
|
json.put("senderPhoto", msg.getSenderPhoto());
|
|
|
// 消息类型:1血糖,2血压
|
|
|
json.put("type", msg.getTzType());
|
|
|
// 是否已读:1未读,0已读
|
|
|
json.put("read", msg.getRead());
|
|
|
// 是否已读:
|
|
|
json.put("sex", msg.getSex());
|
|
|
// 当前值/收缩压,正数为高,负数为低
|
|
|
json.put("value1", msg.getValue1());
|
|
|
// 上次值/舒张压,正数为高,负数为低
|
|
|
json.put("value2", msg.getValue2());
|
|
|
// 发送时间
|
|
|
json.put("czrq", DateUtil.dateToStrLong(msg.getCzrq()));
|
|
|
array.put(json);
|
|
|
}
|
|
|
return write(200, "获取体征消息成功!", "list", array);
|
|
|
} catch (Exception e) {
|
|
|
error(e);
|
|
|
return error(-1, "获取体征消息失败!");
|
|
|
}
|
|
|
}
|
|
|
}
|