|
@ -2,7 +2,11 @@ package com.yihu.wlyy.web.doctor.jimeiJkEdu;
|
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.yihu.es.entity.HealthEduArticlePatient;
|
|
|
import com.yihu.wlyy.aop.ObserverRequired;
|
|
|
import com.yihu.wlyy.entity.education.HealthEduArticle;
|
|
|
import com.yihu.wlyy.entity.patient.Patient;
|
|
|
import com.yihu.wlyy.service.app.label.SignPatientLabelInfoService;
|
|
|
import com.yihu.wlyy.service.call.CustomerService;
|
|
|
import com.yihu.wlyy.service.jimeiJkEdu.JMJkEduArticleService;
|
|
|
import com.yihu.wlyy.service.third.jkEduArticle.ThirdJkEduArticleService;
|
|
|
import com.yihu.wlyy.web.BaseController;
|
|
@ -13,6 +17,8 @@ import com.yihu.wlyy.web.third.gateway.vo.base.ResultPageListModel;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import io.swagger.annotations.ApiParam;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.json.JSONArray;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.http.MediaType;
|
|
@ -24,9 +30,7 @@ import javax.jms.JMSException;
|
|
|
import javax.jms.Message;
|
|
|
import javax.jms.Session;
|
|
|
import javax.jms.TextMessage;
|
|
|
import java.util.HashSet;
|
|
|
import java.util.List;
|
|
|
import java.util.Set;
|
|
|
import java.util.*;
|
|
|
|
|
|
/**
|
|
|
* Created by Trick on 2017/11/14.
|
|
@ -35,7 +39,7 @@ import java.util.Set;
|
|
|
@RequestMapping(value = "/doctor/jkEdu/article", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
|
|
|
@Api(description = "医生、卫计委")
|
|
|
public class DoctorJMJkEduArticleController extends BaseController {
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
private JMJkEduArticleService jmJkEduArticleService;
|
|
|
@Autowired
|
|
@ -47,7 +51,8 @@ public class DoctorJMJkEduArticleController extends BaseController {
|
|
|
private String channelName;
|
|
|
@Value("${jkEdu.web.articleBaseUrl}")
|
|
|
private String articleBaseUrl;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 发送到redis
|
|
|
*
|
|
@ -69,7 +74,7 @@ public class DoctorJMJkEduArticleController extends BaseController {
|
|
|
});
|
|
|
});
|
|
|
}
|
|
|
|
|
|
|
|
|
/*************************************************************************卫计委(管理员)角色start***************************************************************************************************/
|
|
|
/**医生、卫计委(管理员)-已推送文章
|
|
|
* @param page
|
|
@ -96,7 +101,7 @@ public class DoctorJMJkEduArticleController extends BaseController {
|
|
|
return new ResultPageListModel(BaseResultModel.statusEm.find_error.getCode(), BaseResultModel.statusEm.find_error.getMessage() + "," + e.getMessage());
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
@RequestMapping(value = "manageSendArticleToPatients", method = RequestMethod.POST)
|
|
|
@ApiOperation("卫计委(管理员)文章群推送")
|
|
|
public BaseResultModel manageSendArticleToPatients(
|
|
@ -107,16 +112,17 @@ public class DoctorJMJkEduArticleController extends BaseController {
|
|
|
@ApiParam(name = "labelServeType", value = "标签类型 3:服务类型,多个用逗号分隔", required = false) @RequestParam(value = "labelServeType", required = false, defaultValue = "") String labelServeType,
|
|
|
@ApiParam(name = "labelDiseaseType", value = "标签类型 4:疾病类型,多个用逗号分隔", required = false) @RequestParam(value = "labelDiseaseType", required = false, defaultValue = "") String labelDiseaseType,
|
|
|
@ApiParam(name = "labelHealthType", value = "标签类型 5:健康情况,多个用逗号分隔", required = false) @RequestParam(value = "labelHealthType", required = false, defaultValue = "") String labelHealthType,
|
|
|
@ApiParam(name = "articleId", value = "文章ID", required = true) @RequestParam(value = "articleId", required = true) String articleId
|
|
|
@ApiParam(name = "articleId", value = "文章ID", required = true) @RequestParam(value = "articleId", required = true) String articleId,
|
|
|
@ApiParam(name = "leaveWords", value = "医生留言", required = false) @RequestParam(value = "leaveWords", required = false) String leaveWords
|
|
|
){
|
|
|
try {
|
|
|
|
|
|
|
|
|
Set<String> patientSet = new HashSet<>(); //放入set中可以去重复
|
|
|
//得到需要发送的患者
|
|
|
jmJkEduArticleService.initPatient(patientSet,labelUnitType,labelSexType,labelServeType,labelDiseaseType,labelHealthType,getUID());
|
|
|
// patientSet.add(patientService.findByCode("wjw00000001000e6badcfa163e424525"));
|
|
|
//获取保存发送记录
|
|
|
HealthEduArticlePatient healthEduArticlePatient = jmJkEduArticleService.saveArticle(patientSet, getUID(), 2,"", 0L, articleId);
|
|
|
HealthEduArticlePatient healthEduArticlePatient = jmJkEduArticleService.saveArticle(patientSet, getUID(), 2,"", 0L, articleId,leaveWords);
|
|
|
//推送微信模板消息和发送im消息
|
|
|
new Thread(() -> {
|
|
|
//发送任务到redis
|
|
@ -126,21 +132,21 @@ public class DoctorJMJkEduArticleController extends BaseController {
|
|
|
}catch (Exception e) {
|
|
|
return new BaseResultModel(BaseResultModel.statusEm.opera_error.getCode(), BaseResultModel.statusEm.opera_error.getMessage() + ":" + e.getMessage());
|
|
|
}
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@RequestMapping(value = "managePushArticleConfirm",method = RequestMethod.GET)
|
|
|
@ApiOperation("卫计委(管理员)确认健教推送人数")
|
|
|
public String managePushArticleConfirm(@ApiParam(name = "labelUnitType", value = "标签类型 1:下属单位,多个用逗号分隔", required = false) @RequestParam(value = "labelUnitType", required = false, defaultValue = "") String labelUnitType,
|
|
|
@ApiParam(name = "labelSexType", value = "标签类型 2:性别,多个用逗号分隔", required = false) @RequestParam(value = "labelSexType", required = false, defaultValue = "") String labelSexType,
|
|
|
@ApiParam(name = "labelServeType", value = "标签类型 3:服务类型,多个用逗号分隔", required = false) @RequestParam(value = "labelServeType", required = false, defaultValue = "") String labelServeType,
|
|
|
@ApiParam(name = "labelDiseaseType", value = "标签类型 4:疾病类型,多个用逗号分隔", required = false) @RequestParam(value = "labelDiseaseType", required = false, defaultValue = "") String labelDiseaseType,
|
|
|
@ApiParam(name = "labelHealthType", value = "标签类型 5:健康情况,多个用逗号分隔", required = false) @RequestParam(value = "labelHealthType", required = false, defaultValue = "") String labelHealthType,
|
|
|
@ApiParam(name = "articleId", value = "文章ID", required = true) @RequestParam(value = "articleId", required = true) String articleId){
|
|
|
@ApiParam(name = "labelSexType", value = "标签类型 2:性别,多个用逗号分隔", required = false) @RequestParam(value = "labelSexType", required = false, defaultValue = "") String labelSexType,
|
|
|
@ApiParam(name = "labelServeType", value = "标签类型 3:服务类型,多个用逗号分隔", required = false) @RequestParam(value = "labelServeType", required = false, defaultValue = "") String labelServeType,
|
|
|
@ApiParam(name = "labelDiseaseType", value = "标签类型 4:疾病类型,多个用逗号分隔", required = false) @RequestParam(value = "labelDiseaseType", required = false, defaultValue = "") String labelDiseaseType,
|
|
|
@ApiParam(name = "labelHealthType", value = "标签类型 5:健康情况,多个用逗号分隔", required = false) @RequestParam(value = "labelHealthType", required = false, defaultValue = "") String labelHealthType,
|
|
|
@ApiParam(name = "articleId", value = "文章ID", required = true) @RequestParam(value = "articleId", required = true) String articleId){
|
|
|
try {
|
|
|
|
|
|
|
|
|
com.alibaba.fastjson.JSONObject response = jmJkEduArticleService.pushArticleConfirm(articleId, labelUnitType,labelSexType,labelServeType,labelDiseaseType,labelHealthType,"wjw00000001000e6badcfa163e424525");
|
|
|
return write(200,"查询成功!","data",response);
|
|
|
}catch (Exception e){
|
|
@ -148,10 +154,10 @@ public class DoctorJMJkEduArticleController extends BaseController {
|
|
|
return error(-1,"查询失败!");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
/*************************************************************************卫计委(管理员)角色end***************************************************************************************************/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*************************************************************************医生角色start***************************************************************************************************/
|
|
|
@RequestMapping(value = "labelWithPushPatients", method = RequestMethod.GET)
|
|
|
@ApiOperation("医生-查询推送对象 ")
|
|
@ -159,9 +165,9 @@ public class DoctorJMJkEduArticleController extends BaseController {
|
|
|
@ApiParam(name = "teamId", value = "行政团队id", required = false) @RequestParam(value = "teamId", required = false) Long teamId,
|
|
|
@ApiParam(name = "labelType", value = "1:服务类型(卫计委分组) 2:健康情况 3:疾病类型 4:团队标签(自定义标签)", required = true) @RequestParam(value = "labelType", required = true) String labelType,
|
|
|
@ApiParam(name = "codition", value = "筛选多个条件以逗号分割", required = false) @RequestParam(value = "codition", required = false) String codition){
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
|
com.alibaba.fastjson.JSONArray response = jmJkEduArticleService.labelWithPushPatients(labelType,codition,teamId,getUID());
|
|
|
return write(200,"查询成功!","data",response);
|
|
|
}catch (Exception e) {
|
|
@ -169,19 +175,35 @@ public class DoctorJMJkEduArticleController extends BaseController {
|
|
|
return error(-1,"查询失败!");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
@ApiOperation("医生确认健教推送人数")
|
|
|
@ResponseBody
|
|
|
@RequestMapping(value = "doctorPushArticleConfirm",method = RequestMethod.GET)
|
|
|
public String doctorPushArticleConfirm(
|
|
|
@ApiParam(name = "teamId", value = "行政团队id", required = false) @RequestParam(value = "teamId", required = false) Long teamId,
|
|
|
@ApiParam(name = "labelType", value = "1:服务类型(卫计委分组) 2:健康情况 3:疾病类型 4:团队标签(自定义标签)", required = true) @RequestParam(value = "labelType", required = true) String labelType,
|
|
|
@ApiParam(name = "condition", value = "多个筛选条件以逗号分割", required = false) @RequestParam(value = "condition", required = false) String condition,
|
|
|
@ApiParam(name = "groupType", value = "多个分组以逗号分割", required = false) @RequestParam(value = "groupType", required = false) String groupType,
|
|
|
@ApiParam(name = "articleId", value = "文章ID", required = true) @RequestParam(value = "articleId", required = true) String articleId){
|
|
|
@RequestParam(value = "code") String code,
|
|
|
@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 = "articleId", required = false) String articleId){
|
|
|
try {
|
|
|
|
|
|
com.alibaba.fastjson.JSONObject response = jmJkEduArticleService.pushArticleConfirm(articleId,labelType,condition,groupType,teamId,getUID());
|
|
|
|
|
|
if (StringUtils.isEmpty(code)) {
|
|
|
return error(-1,"请至少选择一篇文章!");
|
|
|
}
|
|
|
if (StringUtils.isEmpty(patient) && StringUtils.isEmpty(group)) {
|
|
|
return error(-1,"请至少选择一个患者!");
|
|
|
}
|
|
|
String[] articles = code.split(",");
|
|
|
String[] patients = patient.split(",");
|
|
|
String[] groups = group.split(",");
|
|
|
if (articles.length == 0) {
|
|
|
return error(-1,"请至少选择一篇文章!");
|
|
|
}
|
|
|
if (patients.length == 0 && groups.length == 0) {
|
|
|
return error(-1,"请至少选择一个患者!");
|
|
|
}
|
|
|
com.alibaba.fastjson.JSONObject response = jmJkEduArticleService.pushArticleConfirm(getUID(),groups,group,labelType,teamCode,patients,articleId);
|
|
|
return write(200,"查询成功!","data",response);
|
|
|
}catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
@ -189,41 +211,87 @@ public class DoctorJMJkEduArticleController extends BaseController {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
// @RequestMapping(value = "doctorSendArticleToPatients", method = RequestMethod.POST)
|
|
|
// @ApiOperation("医生文章群推送")
|
|
|
// public BaseResultModel doctorSendArticleToPatients(
|
|
|
// @ApiParam(name = "teamId", value = "行政团队id", required = false) @RequestParam(value = "teamId", required = false) Long teamId,
|
|
|
// @ApiParam(name = "labelType", value = "1:服务类型(卫计委分组) 2:健康情况 3:疾病类型 4:团队标签(自定义标签)", required = true) @RequestParam(value = "labelType", required = true) String labelType,
|
|
|
// @ApiParam(name = "condition", value = "多个筛选条件以逗号分割", required = false) @RequestParam(value = "condition", required = false) String condition,
|
|
|
// @ApiParam(name = "groupType", value = "多个分组以逗号分割", required = false) @RequestParam(value = "groupType", required = false) String groupType,
|
|
|
// @ApiParam(name = "articleId", value = "文章ID", required = true) @RequestParam(value = "articleId", required = true) String articleId){
|
|
|
// try {
|
|
|
// Set<String> patientSet = new HashSet<>(); //放入set中可以去重复
|
|
|
// //得到需要发送的患者
|
|
|
// jmJkEduArticleService.initPatients(patientSet,labelType,condition,groupType,teamId,getUID());
|
|
|
// HealthEduArticlePatient healthEduArticlePatient = jmJkEduArticleService.saveArticle(patientSet, getUID(), 1,"", teamId, articleId);
|
|
|
// //推送微信模板消息和发送im消息
|
|
|
// new Thread(() -> {
|
|
|
// //发送任务到redis
|
|
|
// sender(healthEduArticlePatient);
|
|
|
// }).start();
|
|
|
// return new BaseResultModel();
|
|
|
// }catch (Exception e) {
|
|
|
// return new BaseResultModel(BaseResultModel.statusEm.opera_error.getCode(), BaseResultModel.statusEm.opera_error.getMessage() + ":" + e.getMessage());
|
|
|
// }
|
|
|
// }
|
|
|
|
|
|
@RequestMapping(value = "doctorSendArticleToPatients", method = RequestMethod.POST)
|
|
|
@ApiOperation("医生文章群推送")
|
|
|
public BaseResultModel doctorSendArticleToPatients(
|
|
|
@ApiParam(name = "teamId", value = "行政团队id", required = false) @RequestParam(value = "teamId", required = false) Long teamId,
|
|
|
@ApiParam(name = "labelType", value = "1:服务类型(卫计委分组) 2:健康情况 3:疾病类型 4:团队标签(自定义标签)", required = true) @RequestParam(value = "labelType", required = true) String labelType,
|
|
|
@ApiParam(name = "condition", value = "多个筛选条件以逗号分割", required = false) @RequestParam(value = "condition", required = false) String condition,
|
|
|
@ApiParam(name = "groupType", value = "多个分组以逗号分割", required = false) @RequestParam(value = "groupType", required = false) String groupType,
|
|
|
@ApiParam(name = "articleId", value = "文章ID", required = true) @RequestParam(value = "articleId", required = true) String articleId){
|
|
|
public BaseResultModel doctorSendArticleToPatients(@RequestParam(value = "code") String code,
|
|
|
@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 = "articleId", required = false) String articleId,
|
|
|
@RequestParam(value = "leaveWords", required = false) String leaveWords){
|
|
|
|
|
|
try {
|
|
|
if (StringUtils.isEmpty(code)) {
|
|
|
return new BaseResultModel("请至少选择一篇文章!");
|
|
|
}
|
|
|
if (StringUtils.isEmpty(patient) && StringUtils.isEmpty(group)) {
|
|
|
return new BaseResultModel("请至少选择一个患者!");
|
|
|
}
|
|
|
String[] articles = code.split(",");
|
|
|
String[] patients = patient.split(",");
|
|
|
String[] groups = group.split(",");
|
|
|
if (articles.length == 0) {
|
|
|
return new BaseResultModel("请至少选择一篇文章!");
|
|
|
}
|
|
|
if (patients.length == 0 && groups.length == 0) {
|
|
|
return new BaseResultModel("请至少选择一个患者!");
|
|
|
}
|
|
|
Set<String> patientSet = new HashSet<>(); //放入set中可以去重复
|
|
|
//得到需要发送的患者
|
|
|
jmJkEduArticleService.initPatients(patientSet,labelType,condition,groupType,teamId,getUID());
|
|
|
HealthEduArticlePatient healthEduArticlePatient = jmJkEduArticleService.saveArticle(patientSet, getUID(), 1,"", teamId, articleId);
|
|
|
jmJkEduArticleService.initPatients(getUID(),groups, group,labelType,teamCode,patients,patientSet);
|
|
|
// jmJkEduArticleService.initPatient(getUID(),groups,group,labelType,teamCode,patients,patientSet);
|
|
|
if (patientSet.size() == 0) {
|
|
|
return new BaseResultModel("请至少选择一个患者!");
|
|
|
}
|
|
|
HealthEduArticlePatient healthEduArticlePatient = jmJkEduArticleService.saveArticle(patientSet, getUID(), 1,"", teamCode, articleId,leaveWords);
|
|
|
//推送微信模板消息和发送im消息
|
|
|
new Thread(() -> {
|
|
|
//发送任务到redis
|
|
|
sender(healthEduArticlePatient);
|
|
|
}).start();
|
|
|
return new BaseResultModel();
|
|
|
}catch (Exception e) {
|
|
|
} catch (Exception e) {
|
|
|
error(e);
|
|
|
return new BaseResultModel(BaseResultModel.statusEm.opera_error.getCode(), BaseResultModel.statusEm.opera_error.getMessage() + ":" + e.getMessage());
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
@RequestMapping(value = "doctorSendArticleToSingle", method = RequestMethod.POST)
|
|
|
@ApiOperation("医生文章单个患者推送")
|
|
|
public BaseResultModel doctorSendArticleToSingle(
|
|
|
@ApiParam(name = "patientCode", value = "患者Code", required = true) @RequestParam(value = "patientCode", required = true) String patientCode,
|
|
|
@ApiParam(name = "articleId", value = "文章ID", required = true) @RequestParam(value = "articleId", required = true) String articleId){
|
|
|
@ApiParam(name = "articleId", value = "文章ID", required = true) @RequestParam(value = "articleId", required = true) String articleId,
|
|
|
@ApiParam(name = "leaveWords", value = "医生留言", required = false) @RequestParam(value = "leaveWords", required = false) String leaveWords){
|
|
|
try {
|
|
|
Set<String> patientSet = new HashSet<>(); //放入set中可以去重复
|
|
|
//得到需要发送的患者
|
|
|
patientSet.add(patientCode);
|
|
|
// jmJkEduArticleService.initPatients(patientSet,labelType,condition,groupType,teamId,getUID());
|
|
|
HealthEduArticlePatient healthEduArticlePatient = jmJkEduArticleService.saveArticle(patientSet, getUID(), 1,"", 0L, articleId);
|
|
|
HealthEduArticlePatient healthEduArticlePatient = jmJkEduArticleService.saveArticle(patientSet, getUID(), 1,"", 0L, articleId,leaveWords);
|
|
|
//推送微信模板消息和发送im消息
|
|
|
new Thread(() -> {
|
|
|
//发送任务到redis
|
|
@ -253,7 +321,6 @@ public class DoctorJMJkEduArticleController extends BaseController {
|
|
|
* @param firstLevelCategoryId
|
|
|
* @param secondLevelCategoryId
|
|
|
* @param insertTimeStart
|
|
|
* @param insertTimeEnds
|
|
|
* @param articlelevel
|
|
|
* @param articleTitle
|
|
|
* @return
|
|
@ -275,7 +342,7 @@ public class DoctorJMJkEduArticleController extends BaseController {
|
|
|
@ApiParam(name = "currentUserRole", value = "当前登录的角色")
|
|
|
@RequestParam(value = "currentUserRole", required = true) String currentUserRole,
|
|
|
@ApiParam(name = "currentUserRoleLevel", value = "当前登录的角色级别")
|
|
|
@RequestParam(value = "currentUserRoleLevel", required = false)String currentUserRoleLevel,
|
|
|
@RequestParam(value = "currentUserRoleLevel", required = false )String currentUserRoleLevel,
|
|
|
@ApiParam(name = "isAuthentication", value = "是否认证")
|
|
|
@RequestParam(value = "isAuthentication", required = false) String isAuthentication,
|
|
|
@ApiParam(name = "isMyArticle", value = "是否过滤我的文章")
|
|
@ -285,8 +352,11 @@ public class DoctorJMJkEduArticleController extends BaseController {
|
|
|
@ApiParam(name = "pageSize", value = "分页数")
|
|
|
@RequestParam(value = "pageSize", required = true) Integer pageSize){
|
|
|
try {
|
|
|
JSONObject response = jmJkEduArticleService.queryArticlePcList(firstLevelCategoryId,secondLevelCategoryId,insertTimeStart,insertTimeEnd,articlelevel,articleTitle,
|
|
|
getUID(),currentUserRole,currentUserRoleLevel,isAuthentication,isMyArticle,page,pageSize);
|
|
|
|
|
|
|
|
|
|
|
|
com.alibaba.fastjson.JSONObject response = jmJkEduArticleService.queryArticlePcList(firstLevelCategoryId, secondLevelCategoryId, insertTimeStart, insertTimeEnd, articlelevel, articleTitle,
|
|
|
"0de7295862dd11e69faffa163e8aee56", currentUserRole, currentUserRoleLevel, isAuthentication, isMyArticle, page, pageSize,null);
|
|
|
|
|
|
return write(200,"查询成功!","data",response);
|
|
|
} catch (Exception e){
|
|
@ -333,8 +403,8 @@ public class DoctorJMJkEduArticleController extends BaseController {
|
|
|
return error(-1,"添加失败!");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*************************************************************************医生角色end***************************************************************************************************/
|
|
|
|
|
|
|
|
|
}
|