|
@ -10,25 +10,31 @@ import com.yihu.wlyy.entity.doctor.profile.Doctor;
|
|
import com.yihu.wlyy.entity.doctor.profile.DoctorRole;
|
|
import com.yihu.wlyy.entity.doctor.profile.DoctorRole;
|
|
import com.yihu.wlyy.entity.doctor.team.admin.AdminTeam;
|
|
import com.yihu.wlyy.entity.doctor.team.admin.AdminTeam;
|
|
import com.yihu.wlyy.entity.education.HealthEduArticle;
|
|
import com.yihu.wlyy.entity.education.HealthEduArticle;
|
|
|
|
import com.yihu.wlyy.entity.message.Message;
|
|
|
|
import com.yihu.wlyy.entity.message.MessageNoticeSetting;
|
|
import com.yihu.wlyy.entity.patient.Patient;
|
|
import com.yihu.wlyy.entity.patient.Patient;
|
|
import com.yihu.wlyy.repository.doctor.DoctorAdminTeamDao;
|
|
import com.yihu.wlyy.repository.doctor.DoctorAdminTeamDao;
|
|
import com.yihu.wlyy.repository.doctor.DoctorDao;
|
|
import com.yihu.wlyy.repository.doctor.DoctorDao;
|
|
import com.yihu.wlyy.repository.doctor.DoctorRoleDao;
|
|
import com.yihu.wlyy.repository.doctor.DoctorRoleDao;
|
|
|
|
import com.yihu.wlyy.repository.message.MessageDao;
|
|
import com.yihu.wlyy.repository.patient.PatientDao;
|
|
import com.yihu.wlyy.repository.patient.PatientDao;
|
|
import com.yihu.wlyy.service.BaseService;
|
|
import com.yihu.wlyy.service.BaseService;
|
|
import com.yihu.wlyy.service.app.account.DoctorInfoService;
|
|
import com.yihu.wlyy.service.app.account.DoctorInfoService;
|
|
import com.yihu.wlyy.service.app.label.SignPatientLabelInfoService;
|
|
import com.yihu.wlyy.service.app.label.SignPatientLabelInfoService;
|
|
|
|
import com.yihu.wlyy.service.app.message.MessageService;
|
|
|
|
import com.yihu.wlyy.service.app.scheduling.DoctorWorkTimeService;
|
|
import com.yihu.wlyy.service.app.team.AdminTeamService;
|
|
import com.yihu.wlyy.service.app.team.AdminTeamService;
|
|
import com.yihu.wlyy.service.common.account.RoleService;
|
|
import com.yihu.wlyy.service.common.account.RoleService;
|
|
import com.yihu.wlyy.service.third.jkEduArticle.ThirdJkEduArticleService;
|
|
import com.yihu.wlyy.service.third.jkEduArticle.ThirdJkEduArticleService;
|
|
import com.yihu.wlyy.util.CommonUtil;
|
|
|
|
import com.yihu.wlyy.util.DateUtil;
|
|
|
|
import com.yihu.wlyy.util.ElasticsearchUtil;
|
|
|
|
|
|
import com.yihu.wlyy.task.PushMsgTask;
|
|
|
|
import com.yihu.wlyy.util.*;
|
|
import com.yihu.wlyy.web.third.gateway.service.GcLabelService;
|
|
import com.yihu.wlyy.web.third.gateway.service.GcLabelService;
|
|
import com.yihu.wlyy.web.third.gateway.vo.DictModel;
|
|
import com.yihu.wlyy.web.third.gateway.vo.DictModel;
|
|
import com.yihu.wlyy.web.third.gateway.vo.HealthEduArticlePatientModel;
|
|
import com.yihu.wlyy.web.third.gateway.vo.HealthEduArticlePatientModel;
|
|
import io.searchbox.client.JestClient;
|
|
import io.searchbox.client.JestClient;
|
|
import io.searchbox.core.*;
|
|
import io.searchbox.core.*;
|
|
|
|
import org.apache.http.NameValuePair;
|
|
|
|
import org.apache.http.message.BasicNameValuePair;
|
|
import org.elasticsearch.index.query.BoolQueryBuilder;
|
|
import org.elasticsearch.index.query.BoolQueryBuilder;
|
|
import org.elasticsearch.index.query.QueryBuilders;
|
|
import org.elasticsearch.index.query.QueryBuilders;
|
|
import org.elasticsearch.search.builder.SearchSourceBuilder;
|
|
import org.elasticsearch.search.builder.SearchSourceBuilder;
|
|
@ -89,6 +95,20 @@ public class JMJkEduArticleService extends BaseService {
|
|
private DoctorRoleDao doctorRoleDao;
|
|
private DoctorRoleDao doctorRoleDao;
|
|
@Autowired
|
|
@Autowired
|
|
DoctorAdminTeamDao teamDao;
|
|
DoctorAdminTeamDao teamDao;
|
|
|
|
@Autowired
|
|
|
|
private MessageDao messageDao;
|
|
|
|
@Autowired
|
|
|
|
private MessageService messageService;
|
|
|
|
@Autowired
|
|
|
|
private DoctorWorkTimeService doctorWorkTimeService;
|
|
|
|
@Autowired
|
|
|
|
private PushMsgTask pushMsgTask;
|
|
|
|
@Value("${doctorAssistant.api}")
|
|
|
|
private String doctorAssistant;
|
|
|
|
@Value("${doctorAssistant.target_url}")
|
|
|
|
private String targetUrl;
|
|
|
|
@Autowired
|
|
|
|
private HttpClientUtil httpClientUtil;
|
|
|
|
|
|
/**
|
|
/**
|
|
*
|
|
*
|
|
@ -1144,9 +1164,59 @@ public class JMJkEduArticleService extends BaseService {
|
|
isAuthentication = 1;
|
|
isAuthentication = 1;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
thirdJkEduArticleService.saveArticle(userCode,articleTitle,articleType,articlelevel,secondLevelCategoryId,image,
|
|
|
|
|
|
boolean b = thirdJkEduArticleService.saveArticle(userCode,articleTitle,articleType,articlelevel,secondLevelCategoryId,image,
|
|
secondLevelCategoryName,firstLevelCategoryId,firstLevelCategoryName,content,operatorRoleCode,opertorRoleLevel,
|
|
secondLevelCategoryName,firstLevelCategoryId,firstLevelCategoryName,content,operatorRoleCode,opertorRoleLevel,
|
|
userScope,isAuthentication,articleId,roleType);
|
|
userScope,isAuthentication,articleId,roleType);
|
|
|
|
//如果文章需要审核且文章保存数据库成功,推送消息通知给审核的管理员
|
|
|
|
if(isAuthentication==0&&b){
|
|
|
|
Doctor doctor = doctorDao.findByCode(userCode);
|
|
|
|
List<Map<String,Object>> list = doctorInfoService.getDoctorManager(operatorRoleCode);
|
|
|
|
for(Map<String,Object> one:list){
|
|
|
|
|
|
|
|
Message message = new Message();
|
|
|
|
message.setCzrq(new Date());
|
|
|
|
message.setCreateTime(new Date());
|
|
|
|
message.setTitle("新增文章审核消息");
|
|
|
|
message.setContent(doctor.getName()+"医生提交了文章审核,您可以点击前往处理");
|
|
|
|
message.setRead(1);//设置未读
|
|
|
|
message.setReceiver(one.get("code")+"");//设置接受医生的code()
|
|
|
|
message.setSender(userCode);//设置发送的医生
|
|
|
|
message.setSenderName(doctor.getName());
|
|
|
|
message.setCode(getCode());
|
|
|
|
message.setSenderPhoto(doctor.getPhoto());
|
|
|
|
message.setType(14);//新增健康文章审核信息
|
|
|
|
message.setReadonly(1);//是否只读消息
|
|
|
|
message.setSex(doctor.getSex());
|
|
|
|
message.setOver("1");//未处理
|
|
|
|
messageDao.save(message);
|
|
|
|
if(messageService.getMessageNoticeSettingByMessageType(one.get("code")+"","1", MessageNoticeSetting.MessageTypeEnum.signSwitch.getValue())){
|
|
|
|
// 发送消息给医生
|
|
|
|
org.json.JSONObject jsonObject = doctorWorkTimeService.isDoctorWorking(one.get("code")+"");
|
|
|
|
if (jsonObject.getString("status").equals("1")) {
|
|
|
|
//如果在工作时间内就推送
|
|
|
|
pushMsgTask.put(one.get("code")+"", MessageType.MESSAGE_TYPE_AUTHEN_HEALTH_EDU_ARTICLE.D_EDU_02.name(), MessageType.MESSAGE_TYPE_AUTHEN_HEALTH_EDU_ARTICLE.新增文章认证消息.name(), doctor.getName() + "医生提交了文章认证,您可以点击前往", doctor.getCode());
|
|
|
|
}
|
|
|
|
//新增发送医生助手模板消息
|
|
|
|
if (org.apache.commons.lang3.StringUtils.isNotEmpty(one.get("openid")+"")){
|
|
|
|
String url = doctorAssistant + "/wlyy/feldsher/sendDoctorTemplates";
|
|
|
|
List<NameValuePair> params = new ArrayList<>();
|
|
|
|
params.add(new BasicNameValuePair("type", "13"));
|
|
|
|
params.add(new BasicNameValuePair("openId", one.get("openid")+""));
|
|
|
|
params.add(new BasicNameValuePair("url", ""));
|
|
|
|
params.add(new BasicNameValuePair("first", "您好,您有新的文章认证申请"));
|
|
|
|
params.add(new BasicNameValuePair("remark", "您可以登录厦门i健康PC端审核文章,感谢您的使用"));
|
|
|
|
// SimpleDateFormat format = new SimpleDateFormat("yyyy年MM月dd日 HH:mm");
|
|
|
|
// String date = format.format(new Date());
|
|
|
|
String keywords = doctor.getName() + ",健康文章";
|
|
|
|
params.add(new BasicNameValuePair("keywords", doctor.getName()));
|
|
|
|
params.add(new BasicNameValuePair("keywords", "健康文章"));
|
|
|
|
|
|
|
|
httpClientUtil.post(url, params, "UTF-8");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@ -1247,11 +1317,61 @@ public class JMJkEduArticleService extends BaseService {
|
|
}
|
|
}
|
|
|
|
|
|
@Transient
|
|
@Transient
|
|
public void authenticationArticle(String articleId,String isAuthentication,String firstLevelCategoryId,String firstLevelCategoryName,String secondLevelCategoryId,String secondLevelCategoryName) throws Exception{
|
|
|
|
|
|
public void authenticationArticle(String articleId,String isAuthentication,String firstLevelCategoryId,String firstLevelCategoryName,String secondLevelCategoryId,String secondLevelCategoryName,String reasonContent,String sender) throws Exception{
|
|
|
|
|
|
String[] str = articleId.split(",");
|
|
String[] str = articleId.split(",");
|
|
|
|
Doctor doctor = doctorDao.findByCode(sender);
|
|
for(String one: str){
|
|
for(String one: str){
|
|
thirdJkEduArticleService.authenticationArticle(one,isAuthentication,firstLevelCategoryId,firstLevelCategoryName,secondLevelCategoryId,secondLevelCategoryName);
|
|
|
|
|
|
boolean b = thirdJkEduArticleService.authenticationArticle(one,isAuthentication,firstLevelCategoryId,firstLevelCategoryName,secondLevelCategoryId,secondLevelCategoryName);
|
|
|
|
if(b){
|
|
|
|
Message message = new Message();
|
|
|
|
message.setCzrq(new Date());
|
|
|
|
message.setCreateTime(new Date());
|
|
|
|
message.setTitle("新增文章审核消息");
|
|
|
|
if("0".equals(isAuthentication)){
|
|
|
|
message.setContent("健康文章审核不通过,原因:"+reasonContent);
|
|
|
|
}else{
|
|
|
|
message.setContent("健康文章审核通过。");
|
|
|
|
}
|
|
|
|
JSONObject article = thirdJkEduArticleService.getArticalById(one,"","");
|
|
|
|
Doctor receiveDoctor = doctorDao.findByCode(article.getString("OperatorId"));
|
|
|
|
message.setRead(1);//设置未读
|
|
|
|
message.setReceiver(article.getString("OperatorId"));//设置接受医生的code()
|
|
|
|
message.setSender(sender);//设置发送的医生
|
|
|
|
message.setSenderName(doctor.getName());
|
|
|
|
message.setCode(getCode());
|
|
|
|
message.setSenderPhoto(doctor.getPhoto());
|
|
|
|
message.setType(14);//新增健康文章审核信息
|
|
|
|
message.setReadonly(1);//是否只读消息
|
|
|
|
message.setSex(doctor.getSex());
|
|
|
|
message.setOver("1");//未处理
|
|
|
|
messageDao.save(message);
|
|
|
|
if(messageService.getMessageNoticeSettingByMessageType(receiveDoctor.getCode(),"1", MessageNoticeSetting.MessageTypeEnum.signSwitch.getValue())){
|
|
|
|
// 发送消息给医生
|
|
|
|
org.json.JSONObject jsonObject = doctorWorkTimeService.isDoctorWorking(receiveDoctor.getCode());
|
|
|
|
if (jsonObject.getString("status").equals("1")) {
|
|
|
|
//如果在工作时间内就推送
|
|
|
|
pushMsgTask.put(receiveDoctor.getCode(), MessageType.MESSAGE_TYPE_SAVE_HEALTH_EDU_ARTICLE.D_EDU_01.name(), MessageType.MESSAGE_TYPE_SAVE_HEALTH_EDU_ARTICLE.新增文章审核消息.name(), doctor.getName() + "医生提交了文章审核,您可以点击前往", doctor.getCode());
|
|
|
|
}
|
|
|
|
//新增发送医生助手模板消息
|
|
|
|
if (org.apache.commons.lang3.StringUtils.isNotEmpty(receiveDoctor.getOpenid())){
|
|
|
|
String url = doctorAssistant + "/wlyy/feldsher/sendDoctorTemplates";
|
|
|
|
List<NameValuePair> params = new ArrayList<>();
|
|
|
|
params.add(new BasicNameValuePair("type", "12"));
|
|
|
|
params.add(new BasicNameValuePair("openId", receiveDoctor.getOpenid()));
|
|
|
|
params.add(new BasicNameValuePair("url", ""));
|
|
|
|
params.add(new BasicNameValuePair("first", receiveDoctor.getName() + "医生您好,您提交的健康文章已审核"));
|
|
|
|
params.add(new BasicNameValuePair("remark", "您可以登录厦门i健康app查看结果,感谢您的使用"));
|
|
|
|
SimpleDateFormat format = new SimpleDateFormat("yyyy年MM月dd日 HH:mm");
|
|
|
|
String date = format.format(new Date());
|
|
|
|
String keywords = date + "," + doctor.getName();
|
|
|
|
params.add(new BasicNameValuePair("keywords", date));
|
|
|
|
params.add(new BasicNameValuePair("keywords", doctor.getName()));
|
|
|
|
|
|
|
|
httpClientUtil.post(url, params, "UTF-8");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|