|
@ -75,70 +75,70 @@ public class MessageService extends BaseService {
|
|
|
*/
|
|
|
public JSONObject findDoctorAllMessage(String doctor) {
|
|
|
// 三师咨询未读消息总数
|
|
|
int consult = 0;
|
|
|
JSONObject consultJson = new JSONObject();
|
|
|
try {
|
|
|
consult = consultTeamDao.amountAllDoctorUnread(doctor);
|
|
|
} catch (Exception e) {
|
|
|
}
|
|
|
|
|
|
consultJson.put("amount", consult);
|
|
|
|
|
|
if (consult > 0) {
|
|
|
PageRequest pageRequest = new PageRequest(0, 1);
|
|
|
Page<Object> msgs = consultTeamDao.AllDoctorUnreadLast(doctor, pageRequest);
|
|
|
|
|
|
if (msgs != null && msgs.getSize() > 0) {
|
|
|
for (Object msg : msgs) {
|
|
|
Object[] msgArray = (Object[]) msg;
|
|
|
JSONObject msgJson = new JSONObject();
|
|
|
msgJson.put("msg", msgArray[0].toString() + "向您发来一个咨询");
|
|
|
if (msgArray[1] != null) {
|
|
|
if (DateUtil.dateToStr(new Date(), DateUtil.YYYY_MM_DD).equals(DateUtil.dateToStr((Date) msgArray[1], DateUtil.YYYY_MM_DD))) {
|
|
|
msgJson.put("msgTime", DateUtil.dateToStr((Date) msgArray[1], DateUtil.HH_MM));
|
|
|
} else {
|
|
|
msgJson.put("msgTime", DateUtil.dateToStr((Date) msgArray[1], DateUtil.YYYY_MM_DD_HH_MM));
|
|
|
}
|
|
|
} else {
|
|
|
msgJson.put("msgTime", "");
|
|
|
}
|
|
|
consultJson.put("lastMessage", msgJson);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
int famousConsult = 0;
|
|
|
JSONObject famousJson = new JSONObject();
|
|
|
|
|
|
try {
|
|
|
famousConsult = consultTeamDao.amountAlFamouslDoctorUnread(doctor);
|
|
|
} catch (Exception e) {
|
|
|
}
|
|
|
|
|
|
famousJson.put("amount", famousConsult);
|
|
|
|
|
|
if (famousConsult > 0) {
|
|
|
PageRequest pageRequest = new PageRequest(0, 1);
|
|
|
Page<Object> msgs = consultTeamDao.AllDoctorFamousUnreadLast(doctor, pageRequest);
|
|
|
|
|
|
if (msgs != null && msgs.getSize() > 0) {
|
|
|
for (Object msg : msgs) {
|
|
|
Object[] msgArray = (Object[]) msg;
|
|
|
JSONObject msgJson = new JSONObject();
|
|
|
msgJson.put("msg", msgArray[0].toString() + "向您发来一个咨询");
|
|
|
if (msgArray[1] != null) {
|
|
|
if (DateUtil.dateToStr(new Date(), DateUtil.YYYY_MM_DD).equals(DateUtil.dateToStr((Date) msgArray[1], DateUtil.YYYY_MM_DD))) {
|
|
|
msgJson.put("msgTime", DateUtil.dateToStr((Date) msgArray[1], DateUtil.HH_MM));
|
|
|
} else {
|
|
|
msgJson.put("msgTime", DateUtil.dateToStr((Date) msgArray[1], DateUtil.YYYY_MM_DD_HH_MM));
|
|
|
}
|
|
|
} else {
|
|
|
msgJson.put("msgTime", "");
|
|
|
}
|
|
|
famousJson.put("lastMessage", msgJson);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
// int consult = 0;
|
|
|
// JSONObject consultJson = new JSONObject();
|
|
|
// try {
|
|
|
// consult = consultTeamDao.amountAllDoctorUnread(doctor);
|
|
|
// } catch (Exception e) {
|
|
|
// }
|
|
|
//
|
|
|
// consultJson.put("amount", consult);
|
|
|
//
|
|
|
// if (consult > 0) {
|
|
|
// PageRequest pageRequest = new PageRequest(0, 1);
|
|
|
// Page<Object> msgs = consultTeamDao.AllDoctorUnreadLast(doctor, pageRequest);
|
|
|
//
|
|
|
// if (msgs != null && msgs.getSize() > 0) {
|
|
|
// for (Object msg : msgs) {
|
|
|
// Object[] msgArray = (Object[]) msg;
|
|
|
// JSONObject msgJson = new JSONObject();
|
|
|
// msgJson.put("msg", msgArray[0].toString() + "向您发来一个咨询");
|
|
|
// if (msgArray[1] != null) {
|
|
|
// if (DateUtil.dateToStr(new Date(), DateUtil.YYYY_MM_DD).equals(DateUtil.dateToStr((Date) msgArray[1], DateUtil.YYYY_MM_DD))) {
|
|
|
// msgJson.put("msgTime", DateUtil.dateToStr((Date) msgArray[1], DateUtil.HH_MM));
|
|
|
// } else {
|
|
|
// msgJson.put("msgTime", DateUtil.dateToStr((Date) msgArray[1], DateUtil.YYYY_MM_DD_HH_MM));
|
|
|
// }
|
|
|
// } else {
|
|
|
// msgJson.put("msgTime", "");
|
|
|
// }
|
|
|
// consultJson.put("lastMessage", msgJson);
|
|
|
// }
|
|
|
// }
|
|
|
// }
|
|
|
//
|
|
|
// int famousConsult = 0;
|
|
|
// JSONObject famousJson = new JSONObject();
|
|
|
//
|
|
|
// try {
|
|
|
// famousConsult = consultTeamDao.amountAlFamouslDoctorUnread(doctor);
|
|
|
// } catch (Exception e) {
|
|
|
// }
|
|
|
//
|
|
|
// famousJson.put("amount", famousConsult);
|
|
|
//
|
|
|
// if (famousConsult > 0) {
|
|
|
// PageRequest pageRequest = new PageRequest(0, 1);
|
|
|
// Page<Object> msgs = consultTeamDao.AllDoctorFamousUnreadLast(doctor, pageRequest);
|
|
|
//
|
|
|
// if (msgs != null && msgs.getSize() > 0) {
|
|
|
// for (Object msg : msgs) {
|
|
|
// Object[] msgArray = (Object[]) msg;
|
|
|
// JSONObject msgJson = new JSONObject();
|
|
|
// msgJson.put("msg", msgArray[0].toString() + "向您发来一个咨询");
|
|
|
// if (msgArray[1] != null) {
|
|
|
// if (DateUtil.dateToStr(new Date(), DateUtil.YYYY_MM_DD).equals(DateUtil.dateToStr((Date) msgArray[1], DateUtil.YYYY_MM_DD))) {
|
|
|
// msgJson.put("msgTime", DateUtil.dateToStr((Date) msgArray[1], DateUtil.HH_MM));
|
|
|
// } else {
|
|
|
// msgJson.put("msgTime", DateUtil.dateToStr((Date) msgArray[1], DateUtil.YYYY_MM_DD_HH_MM));
|
|
|
// }
|
|
|
// } else {
|
|
|
// msgJson.put("msgTime", "");
|
|
|
// }
|
|
|
// famousJson.put("lastMessage", msgJson);
|
|
|
// }
|
|
|
// }
|
|
|
// }
|
|
|
|
|
|
// 签约未读消息总数
|
|
|
int sign = messageDao.amountUnreadByReceiver(doctor);
|
|
@ -181,8 +181,8 @@ public class MessageService extends BaseService {
|
|
|
}
|
|
|
|
|
|
JSONObject json = new JSONObject();
|
|
|
json.put("consult", consultJson);
|
|
|
json.put("famousConsult", famousJson);
|
|
|
//json.put("consult", consultJson);
|
|
|
//json.put("famousConsult", famousJson);
|
|
|
json.put("sign", signJson);
|
|
|
json.put("healthIndex", indexJson);
|
|
|
return json;
|