|
@ -5,8 +5,12 @@ import java.util.*;
|
|
|
import com.yihu.wlyy.entity.education.*;
|
|
|
import com.yihu.wlyy.service.app.health.*;
|
|
|
import com.yihu.wlyy.service.app.label.SignPatientLabelInfoService;
|
|
|
import com.yihu.wlyy.util.HttpClientUtil;
|
|
|
import com.yihu.wlyy.util.SystemConf;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.apache.http.NameValuePair;
|
|
|
import org.apache.http.message.BasicNameValuePair;
|
|
|
import org.htmlparser.Parser;
|
|
|
import org.htmlparser.beans.StringBean;
|
|
|
import org.htmlparser.util.ParserException;
|
|
@ -263,9 +267,10 @@ public class DoctorHealthEduArticleController extends BaseController {
|
|
|
}
|
|
|
// 查询医生信息
|
|
|
Doctor doctor = doctorService.findDoctorByCode(getUID());
|
|
|
JSONArray messages = new JSONArray();
|
|
|
List<List<NameValuePair>> msgList = new ArrayList<>();
|
|
|
for (String p : patientSet) {
|
|
|
for (String a : articles) {
|
|
|
List<NameValuePair> params = new ArrayList<>();
|
|
|
// 查询文章信息
|
|
|
HealthEduArticle temp = maps.get(a);
|
|
|
if (temp == null) {
|
|
@ -294,14 +299,21 @@ public class DoctorHealthEduArticleController extends BaseController {
|
|
|
// 设置为示读
|
|
|
heap.setRead(1);
|
|
|
list.add(heap);
|
|
|
String summary = parsrHtml(temp.getContent());
|
|
|
if(summary!=null&&summary.length()>50){
|
|
|
summary = summary.substring(0,49);
|
|
|
}
|
|
|
JSONObject content = new JSONObject();
|
|
|
content.put("link","../../jkjy/html/article.html?article"+temp.getCode());
|
|
|
content.put("title",temp.getTitle());
|
|
|
content.put("thumbnail",temp.getUrl());
|
|
|
content.put("summary",summary);
|
|
|
params.add(new BasicNameValuePair("from", getUID()));
|
|
|
params.add(new BasicNameValuePair("to", p));
|
|
|
params.add(new BasicNameValuePair("contentType", "4"));
|
|
|
params.add(new BasicNameValuePair("content", ""));
|
|
|
msgList.add(params);
|
|
|
}
|
|
|
|
|
|
JSONObject message = new JSONObject();
|
|
|
message.put("receiver", p);
|
|
|
message.put("type", MessageType.MESSAGE_TYPE_PATIENT_HEALTH_EDU.P_HE_01.name());
|
|
|
message.put("title", MessageType.MESSAGE_TYPE_PATIENT_HEALTH_EDU.健康教育.name());
|
|
|
message.put("msg", MessageType.MESSAGE_TYPE_PATIENT_HEALTH_EDU.您有新的健康教育.name());
|
|
|
messages.put(message);
|
|
|
}
|
|
|
// 保存到数据库
|
|
|
int row = healthEduArticleService.send(list);
|
|
@ -309,7 +321,9 @@ public class DoctorHealthEduArticleController extends BaseController {
|
|
|
return error(-1, "发送失败!");
|
|
|
} else {
|
|
|
// 推送消息给患者
|
|
|
PushMsgTask.getInstance().put(messages);
|
|
|
for(List<NameValuePair> params : msgList){
|
|
|
HttpClientUtil.post(SystemConf.getInstance().getSendImUrl(),params,"UTF-8");
|
|
|
}
|
|
|
return success("发送成功!");
|
|
|
}
|
|
|
} catch (Exception e) {
|