Преглед на файлове

Merge branch 'dev' of liuwenbin/patient-co-management into dev

yeshijie преди 7 години
родител
ревизия
bbc4dde547
променени са 26 файла, в които са добавени 753 реда и са изтрити 25 реда
  1. 1 1
      common/common-entity/src/main/java/com/yihu/wlyy/entity/message/Message.java
  2. 87 0
      common/common-entity/src/main/java/com/yihu/wlyy/entity/template/DoctorGuidanceTempLabel.java
  3. 19 0
      common/common-entity/src/main/java/com/yihu/wlyy/entity/template/DoctorTeamGuidanceTemplate.java
  4. 17 2
      patient-co/patient-co-doctor-assistant/src/main/java/com/yihu/wlyy/task/PushMsgTask.java
  5. 4 1
      patient-co/patient-co-doctor-assistant/src/main/resources/application-dev.yml
  6. 4 0
      patient-co/patient-co-doctor-assistant/src/main/resources/application-devtest.yml
  7. 4 0
      patient-co/patient-co-doctor-assistant/src/main/resources/application-local.yml
  8. 4 0
      patient-co/patient-co-doctor-assistant/src/main/resources/application-localtest.yml
  9. 4 0
      patient-co/patient-co-doctor-assistant/src/main/resources/application-prod.yml
  10. 4 0
      patient-co/patient-co-doctor-assistant/src/main/resources/application-test.yml
  11. 10 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/message/MessageDao.java
  12. 38 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/template/DoctorGuidanceTempLabelDao.java
  13. 9 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/template/DoctorTeamGuidanceTemplateDao.java
  14. 16 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/account/DoctorInfoService.java
  15. 33 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/message/MessageService.java
  16. 126 6
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/jimeiJkEdu/JMJkEduArticleService.java
  17. 80 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/template/DoctorGuidanceTempLableService.java
  18. 36 4
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/template/DoctorTeamGuidanceService.java
  19. 43 3
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/third/jkEduArticle/ThirdJkEduArticleService.java
  20. 6 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/util/MessageType.java
  21. 1 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/BaseController.java
  22. 9 2
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/jimeiJkEduPC/DoctorJMJkEduArticlePCController.java
  23. 22 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/message/DoctorMessageController.java
  24. 125 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/template/DoctorGuidanceTempLabelController.java
  25. 46 2
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/template/DoctorTeamGuidanceController.java
  26. 5 2
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/third/jkEduArticle/ThirdJkEduArticleController.java

Файловите разлики са ограничени, защото са твърде много
+ 1 - 1
common/common-entity/src/main/java/com/yihu/wlyy/entity/message/Message.java


+ 87 - 0
common/common-entity/src/main/java/com/yihu/wlyy/entity/template/DoctorGuidanceTempLabel.java

@ -0,0 +1,87 @@
package com.yihu.wlyy.entity.template;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yihu.wlyy.entity.IdEntity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.util.Date;
/**
 * Created by 刘文彬 on 2018/5/17.
 */
@Entity
@Table(name = "wlyy_doctor_guidance_temp_label")
public class DoctorGuidanceTempLabel extends IdEntity {
    private String code;//业务编码
    private String name;//标签名称
    private Date createTime;// 创建时间
    private String doctorCode;//创建人code
    private Integer del;//作废标识1、正常 ,0、作废
    private Integer teamId;//医生团队Id
    @Column(name = "code", length = 50)
    public String getCode() {
        return code;
    }
    public void setCode(String code) {
        this.code = code;
    }
    @Column(name = "name", length = 100)
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    @Column(name = "create_time")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
    @Column(name = "doctor_code", length = 50)
    public String getDoctorCode() {
        return doctorCode;
    }
    public void setDoctorCode(String doctorCode) {
        this.doctorCode = doctorCode;
    }
    @Column(name = "del", length = 2)
    public Integer getDel() {
        return del;
    }
    public void setDel(Integer del) {
        this.del = del;
    }
    @Column(name = "team_id", length = 11)
    public Integer getTeamId() {
        return teamId;
    }
    public void setTeamId(Integer teamId) {
        this.teamId = teamId;
    }
    public DoctorGuidanceTempLabel(String code, String name) {
        this.code = code;
        this.name = name;
    }
    public DoctorGuidanceTempLabel() {
    }
}

+ 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);
}

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

@ -0,0 +1,38 @@
package com.yihu.wlyy.repository.template;
import com.yihu.wlyy.entity.template.DoctorGuidanceTempLabel;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
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.
 */
public interface DoctorGuidanceTempLabelDao extends PagingAndSortingRepository<DoctorGuidanceTempLabel, Long> {
    @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);
    @Query("select t from DoctorGuidanceTempLabel t where t.code = ?1 ")
    DoctorGuidanceTempLabel findByCode(String code);
    @Modifying
    @Query(value = "update DoctorGuidanceTempLabel p set p.del=?1 where p.code=?2 ")
    int updateDel(int del,String code);
    @Modifying
    @Query(value = "update DoctorGuidanceTempLabel p set p.name=?1 where p.code=?2 ")
    int updateName(String name,String code);
}

+ 9 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/template/DoctorTeamGuidanceTemplateDao.java

@ -71,4 +71,13 @@ public interface DoctorTeamGuidanceTemplateDao extends PagingAndSortingRepositor
            " AND b.del = 1 AND b.teamId = ?1 AND b.title LIKE ?2 ")
    List<DoctorTeamGuidanceTemplate> getListByTile(int teamId, String title, Pageable pageRequest);
    // 根据模板文章标题模糊搜索团队指导模板(不分页)
    @Query("SELECT b FROM DoctorTeamGuidanceTemplate b WHERE   " +
            " b.del = 1 AND b.teamId = ?1 AND b.title LIKE ?2 ")
    List<DoctorTeamGuidanceTemplate> getListByTile(int teamId, String title);
    //    根据团队ID获取团队内的模板列表(带分页和创建时间倒序)
    @Query("select t from DoctorTeamGuidanceTemplate t where t.del = 1 and t.teamId = ?1 and t.labelCode= ?2")
    List<DoctorTeamGuidanceTemplate> findGuidanceByTeamIdAndLabelCode(int teamId,String labelCode, Pageable request);
}

+ 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_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
    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");
                    }
                }
            }
        }
    }

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

@ -0,0 +1,80 @@
package com.yihu.wlyy.service.template;
import com.yihu.wlyy.entity.template.DoctorGuidanceTempLabel;
import com.yihu.wlyy.repository.template.DoctorGuidanceTempLabelDao;
import com.yihu.wlyy.service.BaseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Sort;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
 * Created by 刘文彬 on 2018/5/18.
 */
@Service
public class DoctorGuidanceTempLableService extends BaseService {
    @Autowired
    private DoctorGuidanceTempLabelDao doctorGuidanceTempLableDao;
    /**
     * 保存
     * @param doctorCode
     * @param name
     */
    @Transactional
    public DoctorGuidanceTempLabel save(String doctorCode, String name, Integer teamId)throws Exception{
        DoctorGuidanceTempLabel one = new DoctorGuidanceTempLabel();
        one.setCode(getCode());
        one.setCreateTime(new Date());
        one.setDoctorCode(doctorCode);
        one.setName(name);
        one.setTeamId(teamId);
        one.setDel(1);
        return doctorGuidanceTempLableDao.save(one);
    }
    public List<DoctorGuidanceTempLabel> findByDoctorCode(Integer teamId, int pageSize, int pageNo) throws Exception{
        Sort sort = new Sort(Sort.Direction.DESC, "createTime");
        pageNo=pageNo-1;
        PageRequest pageRequest = new PageRequest(pageNo, pageSize,sort);
        Page<DoctorGuidanceTempLabel> page =  doctorGuidanceTempLableDao.findByTeamId(teamId,pageRequest);
        List<DoctorGuidanceTempLabel> newList = new ArrayList<>();
        newList.add(0,new DoctorGuidanceTempLabel("","未分组"));
        newList.addAll(page.getContent());
        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);
        if(temp>0){
            return true;
        }
        return false;
    }
    @Transactional
    public boolean updateName(String code,String name) throws Exception{
        int temp = doctorGuidanceTempLableDao.updateName(name,code);
        if(temp>0){
            return true;
        }
        return false;
    }
}

+ 36 - 4
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/template/DoctorTeamGuidanceService.java

@ -5,6 +5,7 @@ import com.yihu.wlyy.entity.doctor.team.admin.AdminTeam;
import com.yihu.wlyy.entity.patient.Patient;
import com.yihu.wlyy.entity.patient.PatientHealthGuidance;
import com.yihu.wlyy.entity.template.DoctorGuidanceTemp;
import com.yihu.wlyy.entity.template.DoctorGuidanceTempLabel;
import com.yihu.wlyy.entity.template.DoctorTeamGuidanceDetail;
import com.yihu.wlyy.entity.template.DoctorTeamGuidanceTemplate;
import com.yihu.wlyy.logs.BusinessLogs;
@ -12,13 +13,13 @@ import com.yihu.wlyy.repository.doctor.DoctorAdminTeamMemberDao;
import com.yihu.wlyy.repository.doctor.DoctorDao;
import com.yihu.wlyy.repository.patient.PatientDao;
import com.yihu.wlyy.repository.template.DoctorGuidanceTempDao;
import com.yihu.wlyy.repository.template.DoctorGuidanceTempLabelDao;
import com.yihu.wlyy.repository.template.DoctorTeamGuidanceDetailDao;
import com.yihu.wlyy.repository.template.DoctorTeamGuidanceTemplateDao;
import com.yihu.wlyy.service.BaseService;
import com.yihu.wlyy.service.app.consult.ConsultService;
import com.yihu.wlyy.service.app.health.PatientHealthGuidanceService;
import com.yihu.wlyy.util.CommonUtil;
import io.swagger.models.auth.In;
import org.apache.commons.lang3.StringUtils;
import org.json.JSONArray;
import org.json.JSONObject;
@ -57,6 +58,8 @@ public class DoctorTeamGuidanceService extends BaseService {
    DoctorGuidanceTempDao guidanceTempDao;
    @Autowired
    private CommonUtil CommonUtil;
    @Autowired
    private DoctorGuidanceTempLabelDao doctorGuidanceTempLableDao;
    /**
     * 新增团队指导模板
@ -66,7 +69,7 @@ public class DoctorTeamGuidanceService extends BaseService {
     * @param content
     * @param images
     */
    public String saveTeamGuidance(String doctor, String title, JSONArray teams, String content, String images) throws Exception {
    public String saveTeamGuidance(String doctor, String title, JSONArray teams, String content, String images,String labelCode) throws Exception {
        String templateCode = getCode();
        Date nowDate = new Date();
        String image = "";
@ -75,7 +78,12 @@ public class DoctorTeamGuidanceService extends BaseService {
            image = CommonUtil.copyTempImage(images);
            System.out.println("images =====>" + image);
        }
        //指导标签
        DoctorGuidanceTempLabel doctorGuidanceTempLable =  doctorGuidanceTempLableDao.findByCode(labelCode);
        String labelName = "未分组";
        if(doctorGuidanceTempLable!=null){
            labelName = doctorGuidanceTempLable.getName();
        }
        for (Object team : teams) {
            JSONObject teamJson = new JSONObject(team.toString());
            int teamId = teamJson.getInt("teamId");
@ -93,7 +101,8 @@ public class DoctorTeamGuidanceService extends BaseService {
                doctorTeamGuidanceTemplate.setTitle(title);
                doctorTeamGuidanceTemplate.setTeamTemplateCode(templateCode);
                doctorTeamGuidanceTemplate.setUseTimes(0);
                doctorTeamGuidanceTemplate.setLabelCode(labelCode);
                doctorTeamGuidanceTemplate.setLabelName(labelName);
                doctorTeamGuidanceTemplateDao.save(doctorTeamGuidanceTemplate);
            } else {
                throw new Exception(teamName + ":团队标题重复!");
@ -468,4 +477,27 @@ public class DoctorTeamGuidanceService extends BaseService {
        return imagePath;
    }
    public List<DoctorTeamGuidanceTemplate> getGuidanceByTeamIdAndLabelCode( Integer teamId,String labelCode, int pageNo, int pageSize) throws Exception {
        Sort sort = new Sort(Sort.Direction.DESC, "useTimes","createTime");
        pageNo = pageNo -1;
        PageRequest request = new PageRequest(pageNo, pageSize, sort);
        List<DoctorTeamGuidanceTemplate> list = doctorTeamGuidanceTemplateDao.findGuidanceByTeamIdAndLabelCode(teamId,labelCode,request);
        return list;
    }
    public Map<String,List<DoctorTeamGuidanceTemplate>> getTeamGuidanceListByLabelWithFilter(Integer teamId ,String filter) throws Exception {
        List<DoctorTeamGuidanceTemplate>  listGuidances = doctorTeamGuidanceTemplateDao.getListByTile(teamId,"%"+filter+"%");
        Map<String,List<DoctorTeamGuidanceTemplate>> map= new HashMap<>();
        for(DoctorTeamGuidanceTemplate one:listGuidances){
            if(map.containsKey(one.getLabelName()!=null?one.getLabelName():"未分组")){
                List<DoctorTeamGuidanceTemplate> temp = map.get(one.getLabelName()!=null?one.getLabelName():"未分组");
                temp.add(one);
            }else{
                map.put(one.getLabelName()!=null?one.getLabelName():"未分组",new ArrayList<>(Arrays.asList(one)));
            }
        }
        return map;
    }
}

+ 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;
        }
    }

+ 6 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/util/MessageType.java

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

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

@ -51,7 +51,7 @@ public class BaseController {
            JSONObject json = new JSONObject(userAgent);
            return json.getString("uid");
//            return "xh1D2017031502222";// wjw00000001000e6badcfa163e424589/wjw00000001000e6badcfa163e424525
//            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("获取超标指标消息--根据患者分组")

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

@ -0,0 +1,125 @@
package com.yihu.wlyy.web.doctor.template;
import com.yihu.wlyy.aop.ObserverRequired;
import com.yihu.wlyy.entity.template.DoctorGuidanceTempLabel;
import com.yihu.wlyy.service.template.DoctorGuidanceTempLableService;
import com.yihu.wlyy.web.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
 * Created by 刘文彬 on 2018/5/18.
 */
@RestController
@RequestMapping(value = "/doctor/guidance_temp/lable")
@Api(description = "医生健康指导模板标签")
public class DoctorGuidanceTempLabelController extends BaseController {
    @Autowired
    private DoctorGuidanceTempLableService doctorGuidanceTempLableService;
    @RequestMapping(value = "/add", method = RequestMethod.POST)
    @ApiOperation(value = "添加指导模板标签")
    @ObserverRequired
    public String save(@ApiParam(name = "name", value = "标签名称", required = true)
                        @RequestParam(value = "name", required = true) String name,
                        @ApiParam(name = "teamId", value = "医生团队id", required = true)
                        @RequestParam(value = "teamId", required = true) Integer teamId){
        try{
            DoctorGuidanceTempLabel doctorGuidanceTempLable = doctorGuidanceTempLableService.save(getUID(),name,teamId);
            if(doctorGuidanceTempLable!=null){
                return write(200,"保存标签成功!","data",doctorGuidanceTempLable);
            }
        }catch (Exception e){
            e.printStackTrace();
            return error(-1,"保存标签失败!");
        }
        return error(-1,"保存标签失败!");
    }
    @RequestMapping(value = "/findAllList", method = RequestMethod.GET)
    @ApiOperation(value = "根据团队id获取标签")
    @ObserverRequired
    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){
        try{
            List<DoctorGuidanceTempLabel> list = doctorGuidanceTempLableService.findByDoctorCode(teamId, pageSize, pageNo);
            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 = "/deleteLabel", method = RequestMethod.POST)
    @ApiOperation(value = "删除健康指导模板标签")
    @ObserverRequired
    public String deleteLabel(@ApiParam(name = "code", value = "标签code", required = true)
                              @RequestParam(value = "code", required = true) String code){
        try {
            boolean b = doctorGuidanceTempLableService.delete(code);
            if(b){
                return success("删除成功!");
            }
        }catch (Exception e){
            e.printStackTrace();
            return error(-1,"删除成功!");
        }
        return error(-1,"删除成功!");
    }
    @RequestMapping(value = "/updateLabel", method = RequestMethod.POST)
    @ApiOperation(value = "修改健康指导模板标签")
    @ObserverRequired
    public String updateLabel(@ApiParam(name = "code", value = "标签code", required = true)
                              @RequestParam(value = "code", required = true) String code,
                              @ApiParam(name = "name", value = "标签名称", required = true)
                              @RequestParam(value = "name", required = true) String name){
        try {
            boolean b = doctorGuidanceTempLableService.updateName(code,name);
            if(b){
                return success("修改成功!");
            }
        }catch (Exception e){
            e.printStackTrace();
            return error(-1,"修改失败!");
        }
        return error(-1,"修改失败!");
    }
}

+ 46 - 2
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/template/DoctorTeamGuidanceController.java

@ -122,13 +122,15 @@ public class DoctorTeamGuidanceController extends WeixinBaseController {
            @ApiParam(value = "模板内容")
            @RequestParam String content,
            @ApiParam(value = "图片路径")
            @RequestParam(required = false) String images
            @RequestParam(required = false) String images,
            @ApiParam(value = "指导标签")
            @RequestParam(required = false) String labelCode
    ) {
        try {
//            前端参数校验
            String doctor = getUID();
            JSONArray teams = new JSONArray(teamInfo);
            String guidanceCode = doctorTeamGuidanceService.saveTeamGuidance(doctor, title, teams, content, images);
            String guidanceCode = doctorTeamGuidanceService.saveTeamGuidance(doctor, title, teams, content, images,labelCode);
            return write(200, "保存团队模板成功!","guidanceCode",guidanceCode);
        } catch (Exception e) {
            return invalidUserException(e, -1, e.getMessage());
@ -251,4 +253,46 @@ public class DoctorTeamGuidanceController extends WeixinBaseController {
        }
    }
    /**
     * 根据医生所属的单个团队获取团队模板标签列表
     *
     * @param teamId
     * @return
     */
    @RequestMapping(value = "/getTeamGuidanceLabelList", method = RequestMethod.GET)
    @ResponseBody
    @ApiOperation("根据单个团队标签获取团队模板列表")
    public String getTeamGuidanceListByLabel(
            @RequestParam(required = true)
            @ApiParam(value = "团队ID") Integer teamId,
            @RequestParam(required = false)
            @ApiParam(value = "团队模板标签code") String labelCode,
            @RequestParam(value = "pageNo", required = true,defaultValue = "1") int pageNo,
            @RequestParam(value = "pageSize", required = true,defaultValue = "10") int pageSize) {
        try {
            List<DoctorTeamGuidanceTemplate> list = doctorTeamGuidanceService.getGuidanceByTeamIdAndLabelCode(teamId,labelCode, pageNo , pageSize);
            return write(200, "获取团队模板列表成功!", "data", list);
        } catch (Exception e) {
            return error(-1,"查询失败!");
        }
    }
    @RequestMapping(value = "/getTeamGuidanceListByLabelWithFilter", method = RequestMethod.GET)
    @ResponseBody
    @ApiOperation("根据单个团队标签过滤条件获取团队模板列表")
    public String getTeamGuidanceListByLabelWithFilter(@RequestParam(value = "teamId",required = true)
                                                        @ApiParam(value = "团队ID") Integer teamId,
                                                       @RequestParam(value = "filter",required = true)
                                                       @ApiParam(value = "过滤条件") String filter){
        try{
            Map<String,List<DoctorTeamGuidanceTemplate>> map = doctorTeamGuidanceService.getTeamGuidanceListByLabelWithFilter(teamId ,filter);
            return write(200, "查询成功!","data",map);
        }catch (Exception e){
            e.printStackTrace();
            return error(-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);