Ver código fonte

1.4.7版本代码提交

liuwenbin 7 anos atrás
pai
commit
53bee16ef8
22 arquivos alterados com 370 adições e 30 exclusões
  1. 1 1
      common/common-entity/src/main/java/com/yihu/wlyy/entity/message/Message.java
  2. 19 0
      common/common-entity/src/main/java/com/yihu/wlyy/entity/template/DoctorTeamGuidanceTemplate.java
  3. 17 2
      patient-co/patient-co-doctor-assistant/src/main/java/com/yihu/wlyy/task/PushMsgTask.java
  4. 4 1
      patient-co/patient-co-doctor-assistant/src/main/resources/application-dev.yml
  5. 4 0
      patient-co/patient-co-doctor-assistant/src/main/resources/application-devtest.yml
  6. 4 0
      patient-co/patient-co-doctor-assistant/src/main/resources/application-local.yml
  7. 4 0
      patient-co/patient-co-doctor-assistant/src/main/resources/application-localtest.yml
  8. 4 0
      patient-co/patient-co-doctor-assistant/src/main/resources/application-prod.yml
  9. 4 0
      patient-co/patient-co-doctor-assistant/src/main/resources/application-test.yml
  10. 10 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/message/MessageDao.java
  11. 5 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/template/DoctorGuidanceTempLabelDao.java
  12. 16 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/account/DoctorInfoService.java
  13. 33 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/message/MessageService.java
  14. 126 6
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/jimeiJkEdu/JMJkEduArticleService.java
  15. 8 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/template/DoctorGuidanceTempLableService.java
  16. 43 3
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/third/jkEduArticle/ThirdJkEduArticleService.java
  17. 3 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/util/MessageType.java
  18. 8 8
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/BaseController.java
  19. 9 2
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/jimeiJkEduPC/DoctorJMJkEduArticlePCController.java
  20. 22 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/message/DoctorMessageController.java
  21. 21 3
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/template/DoctorGuidanceTempLabelController.java
  22. 5 2
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/third/jkEduArticle/ThirdJkEduArticleController.java

Diferenças do arquivo suprimidas por serem muito extensas
+ 1 - 1
common/common-entity/src/main/java/com/yihu/wlyy/entity/message/Message.java


+ 19 - 0
common/common-entity/src/main/java/com/yihu/wlyy/entity/template/DoctorTeamGuidanceTemplate.java

@ -33,6 +33,9 @@ public class DoctorTeamGuidanceTemplate extends IdEntity {
    private Date czrq;
    //        团队内的团队模板状态  0删除  1正常
    private int del;
    private String labelCode;//指导标签code
    private String labelName;//指导标签name
    public String getTeamName() {
        return teamName;
@ -109,4 +112,20 @@ public class DoctorTeamGuidanceTemplate extends IdEntity {
    public void setDel(int del) {
        this.del = del;
    }
    public String getLabelCode() {
        return labelCode;
    }
    public void setLabelCode(String labelCode) {
        this.labelCode = labelCode;
    }
    public String getLabelName() {
        return labelName;
    }
    public void setLabelName(String labelName) {
        this.labelName = labelName;
    }
}

+ 17 - 2
patient-co/patient-co-doctor-assistant/src/main/java/com/yihu/wlyy/task/PushMsgTask.java

@ -52,6 +52,10 @@ public class PushMsgTask {
    private String template_service_remind;
    @Value("${wechat.message.template_callserver_remind}")
    private String template_callserver_remind;
    @Value("${wechat.message.template_article_check_result}")
    private String template_article_check_result;
    @Value("${wechat.message.template_article_authen}")
    private String template_article_authen;
    @Value("${pushMes.method}")
    private String putMesMethod;
    @Value("${pushMes.redis_prescription_title}")
@ -209,7 +213,7 @@ public class PushMsgTask {
    /**
     * 直接发送微信模板消息
     *
     * @param type 1:处方待处理提醒  2:服务状态提醒  3:居民体征异常提醒  4:咨询请求通知  5:签约申请通知  6:随访提醒  7:处理结果通知 8 咨询回复提醒 9 代办事项提醒
     * @param type 1:处方待处理提醒  2:服务状态提醒  3:居民体征异常提醒  4:咨询请求通知  5:签约申请通知  6:随访提醒  7:处理结果通知 8 咨询回复提醒 9 代办事项提醒 12 文章审核结果提醒
     * @return
     */
    public boolean sendWeixinMessage(String access_token, int type, String openid, String url, JSONObject data) {
@ -253,7 +257,12 @@ public class PushMsgTask {
     */
    public String typeMsg(int type, String openid, String url, JSONObject data) {
        try {
            url = server_url + "wx_doctor/html/" + url;
            if(StringUtils.isNotEmpty(url)){
                url = server_url + "wx_doctor/html/" + url;
            }else{
                url="";
            }
            String temp_id = getTemplateId(type);
            JSONObject temp = new JSONObject();
            temp.put("touser", openid);
@ -340,6 +349,12 @@ public class PushMsgTask {
            case 11:
                templateId = template_callserver_remind;
                break;
            case 12:
                templateId = template_article_check_result;
                break;
            case 13:
                templateId = template_article_authen;
                break;
        }
        return templateId;
    }

+ 4 - 1
patient-co/patient-co-doctor-assistant/src/main/resources/application-dev.yml

@ -54,7 +54,10 @@ wechat:
   template_service_remind:  v2iqCHvqNLiU0PBBMIEPkB40xi8eUtdpsjwyxw-euo4
   #协同服务提醒
   template_callserver_remind: Fsnt5YUDBCNOREMKifZbr51XhNRyop6VAEV8mIuFYuc
   #健康文章审核提醒
   template_article_check_result: qiYuHVB20unKW2Yd9qIB7rVZyWfeSGR2WmkSXzCtFuQ
   #健康文章认证处理提醒
   template_article_authen: X3m6jEg9hNGJqn4dnfPpnetxQh63ktu0SRvTRFxcqhI
yihu:
  yihu_OpenPlatform_url: http://ssotest.yihu.cn/OpenPlatform/cgiBin/1.0/
  yihu_OpenPlatform_appId: 9000276

+ 4 - 0
patient-co/patient-co-doctor-assistant/src/main/resources/application-devtest.yml

@ -54,6 +54,10 @@ wechat:
   template_service_remind:  v2iqCHvqNLiU0PBBMIEPkB40xi8eUtdpsjwyxw-euo4
   #协同服务提醒
   template_callserver_remind: Fsnt5YUDBCNOREMKifZbr51XhNRyop6VAEV8mIuFYuc
   #健康文章审核提醒
   template_article_check_result: qiYuHVB20unKW2Yd9qIB7rVZyWfeSGR2WmkSXzCtFuQ
   #健康文章认证处理提醒
   template_article_authen: X3m6jEg9hNGJqn4dnfPpnetxQh63ktu0SRvTRFxcqhI
yihu:
  yihu_OpenPlatform_url: http://ssotest.yihu.cn/OpenPlatform/cgiBin/1.0/

+ 4 - 0
patient-co/patient-co-doctor-assistant/src/main/resources/application-local.yml

@ -54,6 +54,10 @@ wechat:
   template_service_remind:  v2iqCHvqNLiU0PBBMIEPkB40xi8eUtdpsjwyxw-euo4
   #协同服务提醒
   template_callserver_remind: Fsnt5YUDBCNOREMKifZbr51XhNRyop6VAEV8mIuFYuc
   #健康文章审核提醒
   template_article_check_result: qiYuHVB20unKW2Yd9qIB7rVZyWfeSGR2WmkSXzCtFuQ
   #健康文章认证处理提醒
   template_article_authen: X3m6jEg9hNGJqn4dnfPpnetxQh63ktu0SRvTRFxcqhI
yihu:
  yihu_OpenPlatform_url: http://ssotest.yihu.cn/OpenPlatform/cgiBin/1.0/

+ 4 - 0
patient-co/patient-co-doctor-assistant/src/main/resources/application-localtest.yml

@ -54,6 +54,10 @@ wechat:
   template_service_remind:  v2iqCHvqNLiU0PBBMIEPkB40xi8eUtdpsjwyxw-euo4
   #协同服务提醒
   template_callserver_remind: Fsnt5YUDBCNOREMKifZbr51XhNRyop6VAEV8mIuFYuc
   #健康文章审核提醒
   template_article_check_result: qiYuHVB20unKW2Yd9qIB7rVZyWfeSGR2WmkSXzCtFuQ
   #健康文章认证处理提醒
   template_article_authen: X3m6jEg9hNGJqn4dnfPpnetxQh63ktu0SRvTRFxcqhI
yihu:

+ 4 - 0
patient-co/patient-co-doctor-assistant/src/main/resources/application-prod.yml

@ -53,6 +53,10 @@ wechat:
   template_service_remind:  v2iqCHvqNLiU0PBBMIEPkB40xi8eUtdpsjwyxw-euo4
   #协同服务提醒
   template_callserver_remind: Fsnt5YUDBCNOREMKifZbr51XhNRyop6VAEV8mIuFYuc
   #健康文章审核提醒
   template_article_check_result: qiYuHVB20unKW2Yd9qIB7rVZyWfeSGR2WmkSXzCtFuQ
   #健康文章认证处理提醒
   template_article_authen: X3m6jEg9hNGJqn4dnfPpnetxQh63ktu0SRvTRFxcqhI
yihu:
  yihu_OpenPlatform_url: http://api.yihu.com.cn/OpenPlatform/cgiBin/1.0/

+ 4 - 0
patient-co/patient-co-doctor-assistant/src/main/resources/application-test.yml

@ -53,6 +53,10 @@ wechat:
   template_service_remind:  v2iqCHvqNLiU0PBBMIEPkB40xi8eUtdpsjwyxw-euo4
   #协同服务提醒
   template_callserver_remind: Fsnt5YUDBCNOREMKifZbr51XhNRyop6VAEV8mIuFYuc
   #健康文章审核提醒
   template_article_check_result: qiYuHVB20unKW2Yd9qIB7rVZyWfeSGR2WmkSXzCtFuQ
   #健康文章认证处理提醒
   template_article_authen: X3m6jEg9hNGJqn4dnfPpnetxQh63ktu0SRvTRFxcqhI
yihu:
  yihu_OpenPlatform_url: http://ssotest.yihu.cn/OpenPlatform/cgiBin/1.0/

+ 10 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/message/MessageDao.java

@ -36,6 +36,10 @@ public interface MessageDao extends PagingAndSortingRepository<Message, Long>, J
    @Query("update Message a set a.read = 0,a.over='0' where a.id = ?1")
    int read(long msgid);
    @Modifying
    @Query("update Message a set a.read = 0,a.over='0' where a.code = ?1")
    int read(String msgCode);
    @Query("SELECT a FROM Message a WHERE a.sender=?1 AND a.receiver = ?2 and a.signStatus = ?3 and a.read=1 ORDER BY czrq DESC")
    List<Message> findUnreadSign(String sender, String receiver, String signStatus);
@ -106,4 +110,10 @@ public interface MessageDao extends PagingAndSortingRepository<Message, Long>, J
    @Query("from Message a where a.type = 12 and a.del='1' and a.over='1' and relationCode = ?1  ")
    List<Message> findByCallServiceRelationCode(String relationCode);
    @Query(" select a from Message a where a.type=14 and a.del='1' and a.read=1 and a.receiver=?1 and a.over='1'")
    List<Message> findEduArticle(String receiver);
    @Query(" select a from Message a where a.type=14 and a.del='1' and a.read=1 and a.receiver=?1 and a.over='1'")
    List<Message> findEduArticle(String receiver, Pageable pageRequest);
}

+ 5 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/template/DoctorGuidanceTempLabelDao.java

@ -7,6 +7,8 @@ import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
/**
 * Created by 刘文彬 on 2018/5/18.
 */
@ -15,6 +17,9 @@ public interface DoctorGuidanceTempLabelDao extends PagingAndSortingRepository<D
    @Query("select t from DoctorGuidanceTempLabel t where t.teamId = ?1 and t.del=1")
    Page<DoctorGuidanceTempLabel> findByTeamId(Integer teamId, Pageable pageRequest);
    @Query("select t from DoctorGuidanceTempLabel t where t.teamId = ?1 and t.del=1 order by t.createTime desc ")
    List<DoctorGuidanceTempLabel> findByTeamId(Integer teamId);
    @Query("select t from DoctorGuidanceTempLabel t where t.code = ?1 and t.del=1 ")
    DoctorGuidanceTempLabel findByCodeWithDel(String code);

+ 16 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/account/DoctorInfoService.java

@ -1620,4 +1620,20 @@ public class DoctorInfoService extends BaseService {
        }
        return jdbcTemplate.queryForList(sql);
    }
    /**
     * 获取同级的文章审核管理员
     * @param operatorRoleCode
     * @return
     */
    public List<Map<String,Object>> getDoctorManager(String operatorRoleCode){
        String sql = "select d.code,d.name,d.openid from wlyy_doctor d " +
                " join wlyy_user_role h on d.code=h.user " +
                " join manage_role_user ru on d.code=ru.user_code " +
                " join manage_role_feature rf on ru.role_id=rf.role_id " +
                " join manage_feature f on rf.feature_id=f.id " +
                " where f.code='Manage_Article_Authentication' " +
                " and h.role='"+operatorRoleCode+"'";
        return jdbcTemplate.queryForList(sql);
    }
}

+ 33 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/message/MessageService.java

@ -191,6 +191,22 @@ public class MessageService extends BaseService {
            callServiceMesJson.put("amount", 0);
        }
        //文章审核消息
        List<Message> articleMes = messageDao.findEduArticle(doctor);
        JSONObject articleMesJson = new JSONObject();
        if (articleMes != null && articleMes.size() > 0) {
            articleMesJson.put("amount", articleMes.size());
            JSONObject articleJson = new JSONObject();
            articleJson.put("title", "文章审核消息");
            articleJson.put("type", articleMes.get(0).getType());
            articleJson.put("msg", "你有"+articleMes.size()+"个文章审核消息");
            articleJson.put("msgTime", DateUtil.dateToStrLong(articleMes.get(0).getCreateTime()));
            articleMesJson.put("lastMessage", articleJson);
        }else{
            articleMesJson.put("amount", 0);
        }
        JSONObject json = new JSONObject();
        json.put("imMsgCount", getImMsgAmount(doctor));//IM消息数量
        json.put("sign", signJson);//签约数
@ -198,7 +214,7 @@ public class MessageService extends BaseService {
        json.put("system", systemJson);//系统消息
        json.put("prescription", prescriptionJson);//续方消息
        json.put("callService", callServiceMesJson);//协同服务消息
        json.put("articleCheck", articleMesJson);//健康文章审核消息
        return json;
    }
@ -485,6 +501,22 @@ public class MessageService extends BaseService {
        return messageDao.getPrescriptionMessage(doctor,type, pageRequest);
    }
    /**
     * 获取新增健康文章审核消息
     * @param receiver
     * @param page
     * @param pagesize
     * @return
     * @throws Exception
     */
    public List<Message> getEduArticleMessage(String receiver ,Integer page, Integer pagesize) throws Exception{
        // 排序
        Sort sort = new Sort(Sort.Direction.DESC, "createTime");
        // 分页信息
        Pageable pageRequest = new PageRequest(page - 1, pagesize, sort);
        return messageDao.findEduArticle(receiver,pageRequest);
    }
    /**
     * 设置某类消息已读
     *

+ 126 - 6
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/jimeiJkEdu/JMJkEduArticleService.java

@ -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.team.admin.AdminTeam;
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.repository.doctor.DoctorAdminTeamDao;
import com.yihu.wlyy.repository.doctor.DoctorDao;
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.service.BaseService;
import com.yihu.wlyy.service.app.account.DoctorInfoService;
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.common.account.RoleService;
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.vo.DictModel;
import com.yihu.wlyy.web.third.gateway.vo.HealthEduArticlePatientModel;
import io.searchbox.client.JestClient;
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.QueryBuilders;
import org.elasticsearch.search.builder.SearchSourceBuilder;
@ -89,6 +95,20 @@ public class JMJkEduArticleService extends BaseService {
    private DoctorRoleDao doctorRoleDao;
    @Autowired
    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;
            }
        }
        thirdJkEduArticleService.saveArticle(userCode,articleTitle,articleType,articlelevel,secondLevelCategoryId,image,
        boolean b = thirdJkEduArticleService.saveArticle(userCode,articleTitle,articleType,articlelevel,secondLevelCategoryId,image,
                secondLevelCategoryName,firstLevelCategoryId,firstLevelCategoryName,content,operatorRoleCode,opertorRoleLevel,
                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_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(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
    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(",");
        Doctor doctor = doctorDao.findByCode(sender);
        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");
                    }
                }
            }
        }
    }

+ 8 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/template/DoctorGuidanceTempLableService.java

@ -52,6 +52,14 @@ public class DoctorGuidanceTempLableService extends BaseService {
        return newList;
    }
    public List<DoctorGuidanceTempLabel> findByDoctorCode(Integer teamId) throws Exception{
        List<DoctorGuidanceTempLabel> list =  doctorGuidanceTempLableDao.findByTeamId(teamId);
        List<DoctorGuidanceTempLabel> newList = new ArrayList<>();
        newList.add(0,new DoctorGuidanceTempLabel("未分组"));
        newList.addAll(list);
        return newList;
    }
    @Transactional
    public boolean delete(String code) throws Exception{
        int temp = doctorGuidanceTempLableDao.updateDel(0,code);

+ 43 - 3
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/third/jkEduArticle/ThirdJkEduArticleService.java

@ -11,6 +11,7 @@ import com.yihu.wlyy.entity.organization.HospitalMapping;
import com.yihu.wlyy.entity.patient.Patient;
import com.yihu.wlyy.repository.doctor.DoctorDao;
import com.yihu.wlyy.repository.doctor.DoctorRoleDao;
import com.yihu.wlyy.repository.message.MessageDao;
import com.yihu.wlyy.repository.organization.HospitalDao;
import com.yihu.wlyy.repository.organization.HospitalMappingDao;
import com.yihu.wlyy.repository.patient.PatientDao;
@ -72,6 +73,8 @@ public class ThirdJkEduArticleService extends BaseService {
    private DoctorRoleDao doctorRoleDao;
    @Autowired
    private HospitalDao hospitalDao;
    @Autowired
    private MessageDao messageDao;
    //    private String baseUrl = "http://service.yihu.com:8085/WsPlatform/rest";
//    private String baseUrl = "http://172.17.110.230:83/WsPlatform/rest";
@ -394,6 +397,41 @@ public class ThirdJkEduArticleService extends BaseService {
        }
    }
    /**
     * 获取文章详情
     *
     * @param articleId 文章id
     * @return
     */
    public JSONObject getArticalById(String articleId,String userId,String userType,String messageCode) throws Exception {
        JSONObject re = new JSONObject();
        JSONObject json = null;
        try {
            JSONObject param = new JSONObject();
            param.put("articleId", articleId);
            param.put("userId", userId);
            param.put("userType", userType);
            String response = httpClientUtil.httpPost(articleBaseUrl+"/WsPlatform/rest", getParamsMap(getArticalById, param.toString(), "1"));
            json = JSON.parseObject(response);
            if("1".equals(userType)&&!org.apache.commons.lang.StringUtils.isEmpty(messageCode)){
                messageDao.read(messageCode);
            }
        } catch (Exception e) {
            e.printStackTrace();
            return re;
        }
        if ("10000".equals(json.getString("Code"))) {
            JSONArray result = json.getJSONArray("Result");
            if (result.size() > 0) {
                return result.getJSONObject(0);
            }
            return re;
        } else {
            throw new Exception(json.getString("Message"));
        }
    }
    /**
     * 添加文章
     * @param userCode 医生code
@ -409,7 +447,7 @@ public class ThirdJkEduArticleService extends BaseService {
     * @return
     * @throws Exception
     */
    public void saveArticle(String userCode,String articleTitle,String articleType,Integer	articlelevel,String	secondLevelCategoryId,String newUrl,
    public boolean saveArticle(String userCode,String articleTitle,String articleType,Integer	articlelevel,String	secondLevelCategoryId,String newUrl,
                                 String	secondLevelCategoryName,String firstLevelCategoryId,String firstLevelCategoryName,String content,
                                 String operatorRoleCode,String opertorRoleLevel,Integer userScope,Integer isAuthentication,String articleId,Integer roleType) throws Exception {
@ -479,7 +517,7 @@ public class ThirdJkEduArticleService extends BaseService {
            e.printStackTrace();
        }
        if ("10000".equals(json.getString("Code"))) {
            return true;
        } else {
            throw new Exception(json.getString("Message"));
        }
@ -646,7 +684,7 @@ public class ThirdJkEduArticleService extends BaseService {
     * 认证文章
     * @return
     */
    public void authenticationArticle(String articleId,String isAuthentication,String firstLevelCategoryId,String firstLevelCategoryName,String secondLevelCategoryId,String secondLevelCategoryName) throws Exception{
    public boolean authenticationArticle(String articleId,String isAuthentication,String firstLevelCategoryId,String firstLevelCategoryName,String secondLevelCategoryId,String secondLevelCategoryName) throws Exception{
        String response = "";
        JSONObject json = null;
@ -665,6 +703,8 @@ public class ThirdJkEduArticleService extends BaseService {
        }
        if (!"10000".equals(json.getString("Code"))) {
            throw new Exception(json.getString("Message"));
        }else{
            return true;
        }
    }

+ 3 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/util/MessageType.java

@ -177,6 +177,8 @@ public class MessageType {
		D_P_WRD, 续方消息, 待取药
	}
	public static enum MESSAGE_TYPE_SAVE_HEALTH_EDU_ARTICLE{
		D_EDU_01,新增文章审核消息
	}
}

+ 8 - 8
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/BaseController.java

@ -44,14 +44,14 @@ public class BaseController {
     */
    public String getUID() {
        try {
//            String userAgent = request.getHeader("userAgent");
//            if (StringUtils.isEmpty(userAgent)) {
//                userAgent = request.getHeader("User-Agent");
//            }
//            JSONObject json = new JSONObject(userAgent);
//            return json.getString("uid");
            return "test00000000005";// wjw00000001000e6badcfa163e424589/wjw00000001000e6badcfa163e424525
            String userAgent = request.getHeader("userAgent");
            if (StringUtils.isEmpty(userAgent)) {
                userAgent = request.getHeader("User-Agent");
            }
            JSONObject json = new JSONObject(userAgent);
            return json.getString("uid");
//            return "test00000000005";// wjw00000001000e6badcfa163e424589/wjw00000001000e6badcfa163e424525
        } catch (Exception e) {
            return null;
        }

+ 9 - 2
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/jimeiJkEduPC/DoctorJMJkEduArticlePCController.java

@ -3,6 +3,8 @@ package com.yihu.wlyy.web.doctor.jimeiJkEduPC;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.yihu.es.entity.HealthEduArticleES;
import com.yihu.wlyy.entity.doctor.profile.Doctor;
import com.yihu.wlyy.service.app.account.DoctorInfoService;
import com.yihu.wlyy.service.app.health.HealthEduArticleLabelService;
import com.yihu.wlyy.service.jimeiJkEdu.JMJkEduArticleService;
import com.yihu.wlyy.util.ElasticsearchUtil;
@ -18,6 +20,7 @@ import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
/**
@ -42,6 +45,8 @@ public class DoctorJMJkEduArticlePCController extends BaseController {
    private ElasticsearchUtil elasticsearchUtil;
    @Autowired
    private HealthEduArticleLabelService healthEduArticleLabelService;
    @Autowired
    private DoctorInfoService doctorInfoService;
    @RequestMapping(value = "saveArticle", method = RequestMethod.POST)
    @ApiOperation("添加、编辑文章")
@ -249,9 +254,11 @@ public class DoctorJMJkEduArticlePCController extends BaseController {
                                         @ApiParam(name = "secondLevelCategoryId", value = "文章二级分类")
                                         @RequestParam(value = "secondLevelCategoryId", required = false) String secondLevelCategoryId,
                                         @ApiParam(name = "secondLevelCategoryName", value = "文章二级分类名称")
                                         @RequestParam(value = "secondLevelCategoryName", required = false) String secondLevelCategoryName){
                                         @RequestParam(value = "secondLevelCategoryName", required = false) String secondLevelCategoryName,
                                         @ApiParam(name = "reasonContent", value = "原因内容")
                                         @RequestParam(value = "reasonContent", required = false) String reasonContent){
        try{
            jmJkEduArticleService.authenticationArticle(articleId,isAuthentication,firstLevelCategoryId,firstLevelCategoryName,secondLevelCategoryId,secondLevelCategoryName);
            jmJkEduArticleService.authenticationArticle(articleId,isAuthentication,firstLevelCategoryId,firstLevelCategoryName,secondLevelCategoryId,secondLevelCategoryName,reasonContent,getUID());
            return success("认证成功!");
        }catch (Exception e){
            e.printStackTrace();

+ 22 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/message/DoctorMessageController.java

@ -206,6 +206,28 @@ public class DoctorMessageController extends BaseController {
        }
    }
    /**
     * 文章审核
     * @param page
     * @param pagesize
     * @return
     */
    @RequestMapping(value = "getEduArticleMessage", method = RequestMethod.GET)
    @ResponseBody
    @ApiOperation("获取文章审核消息")
    public String getEduArticleMessage(@ApiParam(value = "第几页", defaultValue = "1")
                                       @RequestParam Integer page,
                                       @ApiParam(value = "每页几行", defaultValue = "10")
                                       @RequestParam Integer pagesize){
        try{
            List<Message> list = messageService.getEduArticleMessage(getUID(),page,pagesize);
            return write(200,"获取消息成功!", "list", list);
        }catch (Exception e){
            error(e);
            return error(-1, "获取消息失败!");
        }
    }
    @RequestMapping(value = "getHealthIndexMessage", method = RequestMethod.GET)
    @ResponseBody
    @ApiOperation("获取超标指标消息--根据患者分组")

+ 21 - 3
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/template/DoctorGuidanceTempLabelController.java

@ -48,12 +48,30 @@ public class DoctorGuidanceTempLabelController extends BaseController {
    @RequestMapping(value = "/findAllList", method = RequestMethod.GET)
    @ApiOperation(value = "根据团队id获取标签")
    @ObserverRequired
    public String findAllList(@ApiParam(name = "pageSize", value = "每页总数", required = true)
                                  @RequestParam(value = "pageSize", required = true,defaultValue = "10") int pageSize,
    public String findAllList(@ApiParam(name = "teamId", value = "医生团队id", required = true)
                               @RequestParam(value = "teamId", required = true) Integer teamId){
        try{
            List<DoctorGuidanceTempLabel> list = doctorGuidanceTempLableService.findByDoctorCode(teamId);
            if (list == null || list.size() < 1) {
                return write(200, "查询成功!");
            } else {
                return write(200, "查询成功!", "data", list);
            }
        }catch (Exception e){
            e.printStackTrace();
            return error(-1,"查询失败!");
        }
    }
    @RequestMapping(value = "/findAllListByPage", method = RequestMethod.GET)
    @ApiOperation(value = "根据团队id获取标签(分页)")
    @ObserverRequired
    public String findAllListByPage(@ApiParam(name = "pageSize", value = "每页总数", required = true)
                              @RequestParam(value = "pageSize", required = true,defaultValue = "10") int pageSize,
                              @ApiParam(name = "pageNo", value = "当前页", required = true)
                              @RequestParam(value = "pageNo", required = true,defaultValue = "1") int pageNo,
                              @ApiParam(name = "teamId", value = "医生团队id", required = true)
                                  @RequestParam(value = "teamId", required = true) Integer teamId){
                              @RequestParam(value = "teamId", required = true) Integer teamId){
        try{
            List<DoctorGuidanceTempLabel> list = doctorGuidanceTempLableService.findByDoctorCode(teamId, pageSize, pageNo);
            if (list == null || list.size() < 1) {

+ 5 - 2
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/third/jkEduArticle/ThirdJkEduArticleController.java

@ -3,6 +3,7 @@ package com.yihu.wlyy.web.third.jkEduArticle;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.yihu.wlyy.aop.ObserverRequired;
import com.yihu.wlyy.repository.message.MessageDao;
import com.yihu.wlyy.service.jimeiJkEdu.JMJkEduArticleService;
import com.yihu.wlyy.service.third.jkEduArticle.ThirdJkEduArticleService;
import com.yihu.wlyy.web.BaseController;
@ -119,7 +120,9 @@ public class ThirdJkEduArticleController extends BaseController {
    public String getArticalById(@ApiParam(name = "articleId", value = "文章id",defaultValue = "1")
                                 @RequestParam(value = "articleId", required = true) String articleId,
                                 @ApiParam(name = "userType", value = "用户类型:1医生,2居民",defaultValue = "1")
                                 @RequestParam(value = "userType", required = false) String userType){
                                 @RequestParam(value = "userType", required = false) String userType,
                                 @ApiParam(name = "messageCode", value = "消息code")
                                 @RequestParam(value = "messageCode", required = false) String messageCode){
        try {
            String uid = "";
            if("2".equals(userType)){
@ -127,7 +130,7 @@ public class ThirdJkEduArticleController extends BaseController {
            }else{
                uid = getUID();
            }
            com.alibaba.fastjson.JSONObject response = thirdJkEduArticleService.getArticalById(articleId,uid,userType);
            com.alibaba.fastjson.JSONObject response = thirdJkEduArticleService.getArticalById(articleId,uid,userType,messageCode);
            if("2".equals(userType)){
                jmJkEduArticleService.readPatientArticle(getRepUID(),articleId);