|
@ -11,6 +11,7 @@ import com.yihu.wlyy.service.app.consult.ConsultService;
|
|
|
import com.yihu.wlyy.service.app.health.*;
|
|
|
import com.yihu.wlyy.service.app.label.SignPatientLabelInfoService;
|
|
|
import com.yihu.wlyy.service.common.account.PatientService;
|
|
|
import com.yihu.wlyy.util.ImUtill;
|
|
|
import com.yihu.wlyy.web.WeixinBaseController;
|
|
|
import com.yihu.wlyy.web.doctor.message.DoctorMessageController;
|
|
|
import com.yihu.wlyy.wechat.util.WeiXinOpenIdUtils;
|
|
@ -84,13 +85,18 @@ public class DoctorHealthEduArticleController extends WeixinBaseController {
|
|
|
* 查询
|
|
|
*
|
|
|
* @param pagesize 分页大小
|
|
|
* @param wheaType 文章类型
|
|
|
* @return 列表
|
|
|
*/
|
|
|
@RequestMapping(value = "list")
|
|
|
@ResponseBody
|
|
|
public String list(@RequestParam(value = "page", required = true) int page, @RequestParam(value = "pagesize", required = true) int pagesize, @RequestParam(value = "filter", required = false) String filter, @RequestParam(value = "patient", required = false) String patient) {
|
|
|
public String list(@RequestParam(value = "page", required = true) int page,
|
|
|
@RequestParam(value = "pagesize", required = true) int pagesize,
|
|
|
@RequestParam(value = "wheaType", required = true) int wheaType,
|
|
|
@RequestParam(value = "filter", required = false) String filter,
|
|
|
@RequestParam(value = "patient", required = false) String patient) {
|
|
|
try {
|
|
|
List<Map<String, Object>> list = healthEduArticleService.findAll(page, pagesize, filter, getUID(), patient);
|
|
|
List<Map<String, Object>> list = healthEduArticleService.findAll(page, pagesize, filter, getUID(), patient,wheaType);
|
|
|
JSONArray jsonArray = new JSONArray();
|
|
|
if (list != null) {
|
|
|
for (Map<String, Object> map : list) {
|
|
@ -170,6 +176,10 @@ public class DoctorHealthEduArticleController extends WeixinBaseController {
|
|
|
// 文章简介
|
|
|
//json.put("content", parsrHtml(map.get("content").toString()));
|
|
|
json.put("content", map.get("content").toString());
|
|
|
|
|
|
json.put("read", map.get("is_read"));
|
|
|
|
|
|
json.put("attached_content", map.get("attached_content"));
|
|
|
// 发送日期
|
|
|
json.put("czrq", DateUtil.dateToStrLong((Date) map.get("czrq")));
|
|
|
// 发送团队
|
|
@ -302,6 +312,7 @@ public class DoctorHealthEduArticleController extends WeixinBaseController {
|
|
|
* @param code 文章标识,多个以逗号分隔
|
|
|
* @param patient 患者标识,多个以逗号分隔
|
|
|
* @param group 所选群组,多个用逗号分隔
|
|
|
* @param attachedContent 附加内容
|
|
|
* @return
|
|
|
*/
|
|
|
@RequestMapping(value = "send")
|
|
@ -310,7 +321,8 @@ public class DoctorHealthEduArticleController extends WeixinBaseController {
|
|
|
@RequestParam(value = "patient", required = false) String patient,
|
|
|
@RequestParam(value = "group", required = false, defaultValue = "") String group,
|
|
|
@RequestParam(value = "labelType", required = false) String labelType,
|
|
|
@RequestParam(value = "teamCode", required = false) long teamCode) {
|
|
|
@RequestParam(value = "teamCode", required = false) long teamCode,
|
|
|
@RequestParam(value = "attachedContent", required = false) String attachedContent) {
|
|
|
try {
|
|
|
List<HealthEduArticlePatient> list = new ArrayList<HealthEduArticlePatient>();
|
|
|
if (StringUtils.isEmpty(code)) {
|
|
@ -347,11 +359,15 @@ public class DoctorHealthEduArticleController extends WeixinBaseController {
|
|
|
}
|
|
|
// 查询医生信息
|
|
|
Doctor doctor = doctorService.findDoctorByCode(getUID());
|
|
|
//Doctor doctor = doctorService.findDoctorByCode("test00000000005");
|
|
|
String msgHead = doctor.getName() + "医生给您发来了一篇患教文章";
|
|
|
String endMsg = "为了您的健康," + doctor.getName() + "医生给您发送了一篇患教文章,请仔细查阅,如有问题,可随时咨询医生。";
|
|
|
String endMsg = "";//"为了您的健康," + doctor.getName() + "医生给您发送了一篇患教文章,请仔细查阅,如有问题,可随时咨询医生。";
|
|
|
if(StringUtils.isNotBlank(attachedContent)){
|
|
|
endMsg = attachedContent;
|
|
|
}
|
|
|
JSONArray messages = new JSONArray();
|
|
|
Map<String, Map<String, Object>> msgs = new HashMap<>();
|
|
|
String batchNo = UUID.randomUUID().toString();
|
|
|
Date createTime = new Date();
|
|
|
for (String p : patientSet) {
|
|
|
Patient patientTemp = patientService.findByCode(p);
|
|
|
SignFamily signFamily = signFamilyDao.findByjiatingPatient(p);
|
|
@ -390,25 +406,33 @@ public class DoctorHealthEduArticleController extends WeixinBaseController {
|
|
|
heap.setSignType(2);
|
|
|
// 行政团队
|
|
|
heap.setAdminTeamCode(signFamily.getAdminTeamId());
|
|
|
//附加内容
|
|
|
heap.setAttachedContent(attachedContent);
|
|
|
//批次号记录发送批次
|
|
|
heap.setBatchNo(batchNo);
|
|
|
//创建时间
|
|
|
heap.setCzrq(createTime);
|
|
|
list.add(heap);
|
|
|
consultService.sendMucMessageBySingnType(doctor.getCode(), doctor.getName(), p, "{\"title\":\"" + temp.getTitle()+ "\",\"type\":0,\"id\":\"" + temp.getCode() + "\",\"img\":\"" + temp.getUrl() + "\",\"content\":\"为了您的健康,我给您发送了一篇文章,请咨询查阅,如有问题,可随时与我沟通\"}", "4", patientTemp.getName());
|
|
|
//if (StringUtils.isNotEmpty(patientTemp.getOpenid())) {
|
|
|
// 推送消息给微信端
|
|
|
JSONObject json = new JSONObject();
|
|
|
json.put("first", patientTemp.getName() + ",您好!\n" + msgHead);
|
|
|
json.put("toUser", p);
|
|
|
json.put("article", temp.getCode() + "");
|
|
|
json.put("title", temp.getTitle());
|
|
|
json.put("doctorName", doctor.getName());
|
|
|
json.put("date", DateUtil.dateToStrLong(DateUtil.getNowDate()));
|
|
|
json.put("remark", endMsg);
|
|
|
Map<String, Object> content = new HashMap<>();
|
|
|
content.put("openid", patientTemp.getOpenid());
|
|
|
content.put("name", patientTemp.getName());
|
|
|
content.put("json", json);
|
|
|
content.put("code",patientTemp.getCode());
|
|
|
msgs.put(patientTemp.getCode(), content);
|
|
|
//}
|
|
|
if(StringUtils.isNotBlank(attachedContent)){
|
|
|
//发送备注
|
|
|
consultService.sendMucMessageBySingnType(doctor.getCode(), doctor.getName(), p, attachedContent, ImUtill.CONTENT_TYPE_TEXT, patientTemp.getName());
|
|
|
}
|
|
|
// 推送消息给微信端
|
|
|
JSONObject json = new JSONObject();
|
|
|
json.put("first", patientTemp.getName() + ",您好!\n" + msgHead);
|
|
|
json.put("toUser", p);
|
|
|
json.put("article", temp.getCode() + "");
|
|
|
json.put("title", temp.getTitle());
|
|
|
json.put("doctorName", doctor.getName());
|
|
|
json.put("date", DateUtil.dateToStrLong(DateUtil.getNowDate()));
|
|
|
json.put("remark", endMsg);
|
|
|
Map<String, Object> content = new HashMap<>();
|
|
|
content.put("openid", patientTemp.getOpenid());
|
|
|
content.put("name", patientTemp.getName());
|
|
|
content.put("json", json);
|
|
|
content.put("code",patientTemp.getCode());
|
|
|
msgs.put(patientTemp.getCode(), content);
|
|
|
}
|
|
|
}
|
|
|
// 保存到数据库
|
|
@ -437,15 +461,10 @@ public class DoctorHealthEduArticleController extends WeixinBaseController {
|
|
|
PushMsgTask.getInstance().putWxMsg(getAccessToken(), 9, member.getOpenid(), member.getName(), data);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
JSONObject json = (JSONObject) map.get("json");
|
|
|
}
|
|
|
|
|
|
for (HealthEduArticlePatient heap : list) {
|
|
|
BusinessLogs.info(BusinessLogs.BusinessType.article, getUID(), heap.getPatient(), new JSONObject(heap));
|
|
|
}
|
|
|
|
|
|
// 推送消息给患者
|
|
|
PushMsgTask.getInstance().put(messages);
|
|
|
return success("发送成功!");
|
|
@ -516,6 +535,29 @@ public class DoctorHealthEduArticleController extends WeixinBaseController {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
@RequestMapping(value = "/logs")
|
|
|
@ResponseBody
|
|
|
public String getPatientHealthLogs(@RequestParam(value = "page", required = true) int page, @RequestParam(value = "pagesize", required = true) int pagesize){
|
|
|
try{
|
|
|
List<Map<String,Object>> result = healthEduArticlePatientService.findByDoctor(getUID(),page,pagesize);
|
|
|
return write(200,"查询成功!","list",result);
|
|
|
}catch (Exception e){
|
|
|
return write(-1,"查询失败!");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@RequestMapping(value = "/log")
|
|
|
@ResponseBody
|
|
|
public String getPatientHealthLog(@RequestParam(value = "article", required = true) String article, @RequestParam(value = "batchNo", required = false) String batchNo){
|
|
|
try{
|
|
|
List<Map<String,Object>> result = healthEduArticlePatientService.findByBatchNo(getUID(),article,batchNo);
|
|
|
return write(200,"查询成功!","list",result);
|
|
|
}catch (Exception e){
|
|
|
return write(-1,"查询失败!");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
private String parsrHtml(String html) {
|
|
|
html = ("<span>" + html + "</span>");//拼接一个HTML标签,防止纯文字字符串转换在linux下面出现的异常。
|
|
|
Parser parser = null;
|