Explorar el Código

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

trick9191 hace 7 años
padre
commit
73a68b0820
Se han modificado 15 ficheros con 1847 adiciones y 0 borrados
  1. 291 0
      common/common-entity/src/main/java/com/yihu/wlyy/entity/jkedu/EduArticle.java
  2. 5 0
      patient-co/patient-co-wlyy/pom.xml
  3. 40 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/sign/FamilyContractService.java
  4. 66 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/third/jkedu/controller/EduArticleController.java
  5. 485 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/third/jkedu/controller/doctor/EduDoctorArticleController.java
  6. 137 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/third/jkedu/controller/doctor/EduLableController.java
  7. 86 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/third/jkedu/controller/patient/EduPatientArticleController.java
  8. 364 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/third/jkedu/vo/ArticleModel.java
  9. 32 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/third/jkedu/vo/CategoryModel.java
  10. 45 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/third/jkedu/vo/base/BaseResultModel.java
  11. 69 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/third/jkedu/vo/base/ResultBatchModel.java
  12. 36 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/third/jkedu/vo/base/ResultListModel.java
  13. 39 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/third/jkedu/vo/base/ResultOneModel.java
  14. 67 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/third/jkedu/vo/base/ResultPageListModel.java
  15. 85 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/third/jkedu/vo/state/ErrorStateMessage.java

+ 291 - 0
common/common-entity/src/main/java/com/yihu/wlyy/entity/jkedu/EduArticle.java

@ -0,0 +1,291 @@
/*
package com.yihu.wlyy.entity.jkedu;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yihu.wlyy.entity.IdEntity;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.xml.crypto.Data;
import java.util.Date;
*/
/**
 * Created by zhangdan on 2017/9/29.
 *//*
@Entity
@Table(name = "org_article",schema = "",catalog = "jkedudb")
public class EduArticle extends IdEntity{
    //文章ID
    private String ArticleId;
    //文章标题
    private String ArticleTitle;
    //文章内容
    private String ArticleContent;
    //排序
    private int ArticleOrder;
    //1、正常、2删除
    private int ArticleState;
    //文章所属单位名称
    private String OrgName;
    //文章来源(填写发布人所在的机构)
    private String ArticleSource;
    //文章所属单位ID
    private String OgId;
    //1、重要、2紧急
    private int Articlelevel;
    //封面图
    private String ArticleCover;
    //插入时间
    private Date InsertTime;
    //最后更新时间
    private Data UpdateTime;
    //创建人
    private String OperatorName;
    //创建人ID
    private String OperatorId;
    //2级类别名称
    private String SecondLevelCategoryName;
    //2级类别ID
    private String SecondLevelCategoryId;
    //认证单位
    private String Authentication;
    //认证单位ID
    private String AuthenticationId;
    //是否认证 1已认证2、未认证
    private int IsAuthentication;
    //1、视频 2、图文3、音频、 4 、精选问答
    private String ArticleType;
    //1级类别id
    private String FirstLevelCategoryId;
    //1级类别名称
    private String FirstLevelCategoryName;
    //操作人所在科室
    private String DeptName;
    //等级职称
    private String TitleLevel;
    //操作人头像
    private String OperatorImg;
    //最后修改人ID
    private String LastOperatorId;
    //最后修改人
    private String LastOperatorName;
    public String getArticleId() {
        return ArticleId;
    }
    public void setArticleId(String articleId) {
        ArticleId = articleId;
    }
    public String getArticleTitle() {
        return ArticleTitle;
    }
    public void setArticleTitle(String articleTitle) {
        ArticleTitle = articleTitle;
    }
    public String getArticleContent() {
        return ArticleContent;
    }
    public void setArticleContent(String articleContent) {
        ArticleContent = articleContent;
    }
    public int getArticleOrder() {
        return ArticleOrder;
    }
    public void setArticleOrder(int articleOrder) {
        ArticleOrder = articleOrder;
    }
    public int getArticleState() {
        return ArticleState;
    }
    public void setArticleState(int articleState) {
        ArticleState = articleState;
    }
    public String getOrgName() {
        return OrgName;
    }
    public void setOrgName(String orgName) {
        OrgName = orgName;
    }
    public String getArticleSource() {
        return ArticleSource;
    }
    public void setArticleSource(String articleSource) {
        ArticleSource = articleSource;
    }
    public String getOgId() {
        return OgId;
    }
    public void setOgId(String ogId) {
        OgId = ogId;
    }
    public int getArticlelevel() {
        return Articlelevel;
    }
    public void setArticlelevel(int articlelevel) {
        Articlelevel = articlelevel;
    }
    public String getArticleCover() {
        return ArticleCover;
    }
    public void setArticleCover(String articleCover) {
        ArticleCover = articleCover;
    }
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    public Date getInsertTime() {
        return InsertTime;
    }
    public void setInsertTime(Date insertTime) {
        InsertTime = insertTime;
    }
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    public Data getUpdateTime() {
        return UpdateTime;
    }
    public void setUpdateTime(Data updateTime) {
        UpdateTime = updateTime;
    }
    public String getOperatorName() {
        return OperatorName;
    }
    public void setOperatorName(String operatorName) {
        OperatorName = operatorName;
    }
    public String getOperatorId() {
        return OperatorId;
    }
    public void setOperatorId(String operatorId) {
        OperatorId = operatorId;
    }
    public String getSecondLevelCategoryName() {
        return SecondLevelCategoryName;
    }
    public void setSecondLevelCategoryName(String secondLevelCategoryName) {
        SecondLevelCategoryName = secondLevelCategoryName;
    }
    public String getSecondLevelCategoryId() {
        return SecondLevelCategoryId;
    }
    public void setSecondLevelCategoryId(String secondLevelCategoryId) {
        SecondLevelCategoryId = secondLevelCategoryId;
    }
    public String getAuthentication() {
        return Authentication;
    }
    public void setAuthentication(String authentication) {
        Authentication = authentication;
    }
    public String getAuthenticationId() {
        return AuthenticationId;
    }
    public void setAuthenticationId(String authenticationId) {
        AuthenticationId = authenticationId;
    }
    public int getIsAuthentication() {
        return IsAuthentication;
    }
    public void setIsAuthentication(int isAuthentication) {
        IsAuthentication = isAuthentication;
    }
    public String getArticleType() {
        return ArticleType;
    }
    public void setArticleType(String articleType) {
        ArticleType = articleType;
    }
    public String getFirstLevelCategoryId() {
        return FirstLevelCategoryId;
    }
    public void setFirstLevelCategoryId(String firstLevelCategoryId) {
        FirstLevelCategoryId = firstLevelCategoryId;
    }
    public String getFirstLevelCategoryName() {
        return FirstLevelCategoryName;
    }
    public void setFirstLevelCategoryName(String firstLevelCategoryName) {
        FirstLevelCategoryName = firstLevelCategoryName;
    }
    public String getDeptName() {
        return DeptName;
    }
    public void setDeptName(String deptName) {
        DeptName = deptName;
    }
    public String getTitleLevel() {
        return TitleLevel;
    }
    public void setTitleLevel(String titleLevel) {
        TitleLevel = titleLevel;
    }
    public String getOperatorImg() {
        return OperatorImg;
    }
    public void setOperatorImg(String operatorImg) {
        OperatorImg = operatorImg;
    }
    public String getLastOperatorId() {
        return LastOperatorId;
    }
    public void setLastOperatorId(String lastOperatorId) {
        LastOperatorId = lastOperatorId;
    }
    public String getLastOperatorName() {
        return LastOperatorName;
    }
    public void setLastOperatorName(String lastOperatorName) {
        LastOperatorName = lastOperatorName;
    }
}
*/

+ 5 - 0
patient-co/patient-co-wlyy/pom.xml

@ -447,6 +447,11 @@
            <artifactId>jest</artifactId>
            <version>2.4.0</version>
        </dependency>
        <dependency>
            <groupId>commons-collections</groupId>
            <artifactId>commons-collections</artifactId>
            <version>3.2.2</version>
        </dependency>
        <!--elasticsearch end-->
    </dependencies>
    <build>

+ 40 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/sign/FamilyContractService.java

@ -32,8 +32,10 @@ import com.yihu.wlyy.service.third.jw.JwArchivesService;
import com.yihu.wlyy.task.PushMsgTask;
import com.yihu.wlyy.task.SignUploadTask;
import com.yihu.wlyy.util.*;
import com.yihu.wlyy.web.third.jkedu.vo.PatientModel;
import com.yihu.wlyy.wechat.util.WeiXinAccessTokenUtils;
import com.yihu.wlyy.wechat.util.WeiXinOpenIdUtils;
import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.lang3.StringUtils;
import org.json.JSONArray;
import org.json.JSONObject;
@ -146,6 +148,7 @@ public class FamilyContractService extends BaseService {
    @Autowired
    private PushMsgTask pushMsgTask;
    public SignFamily findSignFamilyByCode(String code) {
        return signFamilyDao.findByCodeAndType(code, 2);
    }
@ -4089,4 +4092,41 @@ public class FamilyContractService extends BaseService {
        return rs ;
    }
    /*public Map<String,Object> getPushPatientList(int type,String[] searchTypes,String doctor,String doctorHealth){
        StringBuffer sb = new StringBuffer("SELECT p.*,sf.server_type serverType,sf.server_type_name serverTypeName,sf.team_code teamCode " +
                "from wlyy_sign_family sf LEFT JOIN wlyy_patient p ON sf.patient=p.`code`" +
                "WHERE sf.`status`>0 and (sf.doctor=? OR sf.doctor_health=?) AND p.`status`=1");
        //searchType==1重点关注2有绑定设备3孕产妇4年纪在65以上
        for (String searchType:searchTypes) {
            if("1".equals(searchType)){
                sb.append(" AND p.disease_condition =3");
            }else if("2".equals(searchType)){
                sb.append(" AND sf.`patient` IN (SELECT pd.user from wlyy_patient_device pd)");
            }else if("3".equals(searchType)){
                sb.append(" AND sf.server_type=6");
            }else if ("4".equals(searchType)){
                Calendar cal = Calendar.getInstance();
                int year =cal.get(Calendar.YEAR)-65;
                String birthday = year+"-01-01";
                sb.append("p.birthday<"+birthday);
            }
        }
        List params = new ArrayList<>();
        params.add(doctor);
        params.add(doctorHealth);
        List<PatientModel> patients = jdbcTemplate.query(sb.toString(), params.toArray(), new BeanPropertyRowMapper(PatientModel.class));
        Map<String,Object> map = new HashedMap();
        if(type==1){
            for (PatientModel patientModle: patients) {
                int serverType = patientModle.getServerType();
                String serverTypeName = patientModle.getServerTypeName();
            }
        }
        map.put("list",patients);
        return map;
    }*/
}

+ 66 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/third/jkedu/controller/EduArticleController.java

@ -0,0 +1,66 @@
package com.yihu.wlyy.web.third.jkedu.controller;
import com.alibaba.fastjson.JSON;
import com.yihu.wlyy.util.HttpUtil;
import com.yihu.wlyy.web.BaseController;
import com.yihu.wlyy.web.third.jkedu.vo.ArticleModel;
import com.yihu.wlyy.web.third.jkedu.vo.base.ResultOneModel;
import com.yihu.wlyy.web.third.jkedu.vo.state.ErrorStateMessage;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
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.ResponseBody;
import java.util.Map;
/**
 * Created by zhangdan on 2017/10/10.
 */
@Controller
@RequestMapping(value = "/wlyygc/article/jkedu",produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
@Api(description = "健康教育文章类")
public class EduArticleController extends BaseController{
    @Autowired
    private  HttpUtil HttpUtil;
    @RequestMapping(value = "/getById",method = RequestMethod.POST)
    @ResponseBody
    @ApiOperation("获取文章详情")
    public ResultOneModel<ArticleModel> getById(@ApiParam(name = "articleId",value = "文章ID")@RequestParam(value = "articleId")String articleId){
        int code  = 0;
        try{
            //调用福州接口
            String url ="http://172.17.110.230:83/WsPlatform/rest?Api=JkEdu.Article.getArticalById&Param={\"articleId\":\""+articleId+"\"}&AuthInfo={ClientId:\"9000276\"}";
            String jsonStr = HttpUtil.sendPost(url,"");
            if(StringUtils.isNotBlank(jsonStr)){
                Map<String,Object> map = (Map<String, Object>) JSON.parseObject(jsonStr);
                code = Integer.valueOf(String.valueOf(map.get("Code")));
                if(code == 10000){
                    String result = String.valueOf(map.get("Result"));
                    JSONArray jsonArray = JSONArray.fromObject(result);
                    Object o = jsonArray.get(0);
                    JSONObject jsonObject = JSONObject.fromObject(o);
                    ArticleModel articleModel = (ArticleModel) JSONObject.toBean(jsonObject,ArticleModel.class);
                    return  new ResultOneModel(code, ErrorStateMessage.getMessge(code),articleModel);
                }else{
                    return  new ResultOneModel(code,ErrorStateMessage.getMessge(code));
                }
            }
            return  new ResultOneModel(0,"远程请求出错");
        }catch (Exception e){
            e.printStackTrace();
            return  new ResultOneModel(code,ErrorStateMessage.getMessge(code)+","+e.getMessage());
        }
    }
}

+ 485 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/third/jkedu/controller/doctor/EduDoctorArticleController.java

@ -0,0 +1,485 @@
package com.yihu.wlyy.web.third.jkedu.controller.doctor;
import com.alibaba.fastjson.JSON;
import com.yihu.es.entity.HealthEduArticlePatient;
import com.yihu.wlyy.entity.doctor.profile.Doctor;
import com.yihu.wlyy.entity.patient.Patient;
import com.yihu.wlyy.service.app.account.DoctorInfoService;
import com.yihu.wlyy.service.app.sign.FamilyContractService;
import com.yihu.wlyy.web.BaseController;
import com.yihu.wlyy.web.third.gateway.service.GcEduArticleService;
import com.yihu.wlyy.web.third.gateway.vo.HealthEduArticlePatientModel;
import com.yihu.wlyy.web.third.gateway.vo.base.ResultPageListModel;
import com.yihu.wlyy.web.third.jkedu.vo.ArticleModel;
import com.yihu.wlyy.web.third.jkedu.vo.CategoryModel;
import com.yihu.wlyy.web.third.jkedu.vo.base.BaseResultModel;
import com.yihu.wlyy.web.third.jkedu.vo.state.ErrorStateMessage;
import com.yihu.wlyy.web.third.jkedu.vo.base.ResultListModel;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import net.sf.json.JSONArray;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.MediaType;
import org.springframework.jms.core.JmsTemplate;
import org.springframework.jms.core.MessageCreator;
import org.springframework.stereotype.Controller;
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.ResponseBody;
import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.Session;
import javax.jms.TextMessage;
import java.util.*;
/**
 * Created by Zhang Dan on 2017/9/29.
 */
@Controller
@RequestMapping(value = "/wlyygc/doctor/jkedu",produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
@Api(description = "App端医生--健康教育")
public class EduDoctorArticleController extends BaseController{
    @Autowired
    private com.yihu.wlyy.util.HttpUtil HttpUtil;
    @Autowired
    private DoctorInfoService doctorInfoService;
    @Autowired
    private GcEduArticleService gcEduArticleService;
    @Autowired
    private JmsTemplate jmsTemplate;
    @Value("${activemq.queue.healtHarticleQueue}")
    private String channelName;
    @Autowired
    private FamilyContractService familyContractService;
    /**
     * 获取文章类别
     * @param categoryLevel
     * @return
     */
    @RequestMapping(value = "/getCategoryList",method = RequestMethod.GET)
    @ApiOperation("获取文章类别")
    @ResponseBody
    public ResultListModel<List<CategoryModel>> getCategoryList(
            @ApiParam(name = "categoryLevel",value = "获取类别:1、一级类别 2、二级类别",required = false)@RequestParam(value = "categoryLevel")String categoryLevel){
        int code =0;
        try {
            //调用福州接口
            String url ="http://172.17.110.230:83/WsPlatform/rest?Api=JkEdu.Category.getCategoryList&Param={\"categoryLevel\":\""+categoryLevel+"\"}&AuthInfo={ClientId:\"9000276\"}";
            String jsonStr = HttpUtil.sendPost(url,"");
            //结果转map
            if(StringUtils.isNotBlank(jsonStr)){
                Map<String,Object> map = (Map<String, Object>) JSON.parseObject(jsonStr);
                code = Integer.valueOf(String.valueOf(map.get("Code")));
                List<CategoryModel> list = new ArrayList<CategoryModel>();
                if(code==10000){
                    String result = String.valueOf(map.get("Result"));
                    Map<String,Object> resultMap = JSON.parseObject(result);
                    String resultStr = String.valueOf(resultMap.get("result"));
                    JSONArray jsonArray = JSONArray.fromObject(resultStr);
                    list = (List<CategoryModel>) JSONArray.toCollection(jsonArray, CategoryModel.class);//转换成列表
                    return new ResultListModel(list);
                }else{
                    return new ResultListModel(code, ErrorStateMessage.getMessge(code));
                }
            }
            return  new ResultListModel(0,"远程请求出错");
        }catch (Exception e){
            return new ResultListModel(code, ErrorStateMessage.getMessge(code)+","+e.getMessage());
        }
    }
    /**
     * 添加文章收藏
     * @param ArticleId
     * @param articleCategoryId
     * @param articleCategoryName
     * @return
     */
    @RequestMapping(value = "/saveArticleCollection",method = RequestMethod.POST)
    @ApiOperation("APP端--医生添加收藏文章")
    @ResponseBody
    public BaseResultModel saveArticleCollection(
            @ApiParam(name = "ArticleId",value = "文章id")@RequestParam(value = "ArticleId")String ArticleId,
            @ApiParam(name = "articleCategoryId",value = "文章类别id")@RequestParam(value = "articleCategoryId")String articleCategoryId,
            @ApiParam(name = "articleCategoryName", value = "文章类别名称")@RequestParam(value = "articleCategoryName")String articleCategoryName) {
        int code = 0;
        try {
            //调用福州接口
            String url = "http://172.17.110.230:83/WsPlatform/rest?Api=JkEdu.Behavior.saveArticleCollection&" +
                    "Param={\"userType\":\"1\",\"articleId\":\"" + ArticleId + "\",\"articleCategoryId\":\"" + articleCategoryId + "\",\"articleCategoryName\":\"" + articleCategoryName + "\",";
            //获取医生的id
            String userId = getUID();
            Doctor doctor = doctorInfoService.findDoctorByCode(userId);
            if(doctor!=null){
                url+="\"userId\":\"" + doctor.getCode() + "\",\"cName\":\""+doctor.getName()+"\"," +
                        "\"orgName\":\""+doctor.getHospitalName()+"\",\"orgId\":\""+doctor.getHospital()+"\"}&AuthInfo={ClientId:\"9000276\"}";
            }
            String jsonStr = HttpUtil.sendPost(url, "");
            //结果转map
            if(StringUtils.isNotBlank(jsonStr)){
                Map<String, Object> map = (Map<String, Object>) JSON.parseObject(jsonStr);
                code = Integer.valueOf(String.valueOf(map.get("Code")));
                return new BaseResultModel(code,ErrorStateMessage.getMessge(code));
            }else{
                return new BaseResultModel(0,"远程请求过程出错");
            }
        } catch (Exception e) {
            return new BaseResultModel(code, ErrorStateMessage.getMessge(code) + "," + e.getMessage());
        }
    }
    /**
     * 取消收藏
     * @param articleId
     * @param userId
     * @param userType
     * @return
     */
    @RequestMapping(value = "/cancelArticleCollection",method = RequestMethod.POST)
    @ApiOperation("APP端--医生取消收藏文章")
    @ResponseBody
    public BaseResultModel cancelArticleCollection(
            @ApiParam(name = "articleId",value = "文章id")@RequestParam(value = "articleId")String articleId,
            @ApiParam(name = "userId",value = "用户id")@RequestParam(value = "userId")String userId,
            @ApiParam(name = "userType",value = "1医生2居民")@RequestParam(value = "userType")String userType) {
        int code = 0;
        try {
            //调用福州接口
            String url = "http://172.17.110.230:83/WsPlatform/rest?Api=JkEdu.Behavior.cancelArticleCollection&" +
                    "Param={\"articleId\":\"" + articleId + "\",\"userId\":\"" + userId + "\",\"userType\":\"" + userType + "\"}&AuthInfo={ClientId:\"9000276\"}";
            String jsonStr = HttpUtil.sendPost(url, "");
            //结果转map
            if (StringUtils.isNotBlank(jsonStr)){
                Map<String, Object> map = (Map<String, Object>) JSON.parseObject(jsonStr);
                code = Integer.valueOf(String.valueOf(map.get("Code")));
                if (code == -10000) {
                    return new BaseResultModel(code, "没有找到相应的数据");
                } else {
                    return new BaseResultModel(code,ErrorStateMessage.getMessge(code));
                }
            }
            return  new BaseResultModel(0,"远程请求出错");
        } catch (Exception e) {
            return new BaseResultModel(code, ErrorStateMessage.getMessge(code) + "," + e.getMessage());
        }
    }
    /**
     * 收藏文章列表
     * @param articleTitle
     * @param firstLevelCategoryId
     * @param pageIndex
     * @param userType
     * @return
     */
    @RequestMapping(value = "/getCollectionArticalList",method = RequestMethod.GET)
    @ApiOperation("APP端--医生收藏文章列表")
    @ResponseBody
    public ResultListModel getCollectionArticalList(
            @ApiParam(name = "articleTitle",value = "文章标题",required = false)@RequestParam(value = "articleTitle",required = false)String articleTitle,
            @ApiParam(name = "firstLevelCategoryId",value = "一级类别ID ,多个逗号隔开",required = false)@RequestParam(value = "firstLevelCategoryId",required = false)String firstLevelCategoryId,
            @ApiParam(name = "pageIndex",value = "起始页数 0开始,默认0",required = false)@RequestParam(value = "pageIndex",required = false)String pageIndex,
            @ApiParam(name = "userType",value = "1医生2居民")@RequestParam(value = "userType")String userType){
        int code =0;
        int pageNo=0;
        int pageSize=5;
        try {
            //调用福州接口
            String url ="http://172.17.110.230:83/WsPlatform/rest?Api=JkEdu.Article.getCollectionArticalList&Param={\"articleState\":\"1\",\"pageSize\":\""+pageSize+"\",";
            if(org.apache.commons.lang.StringUtils.isNotBlank(articleTitle)){
                url += "\"articleTitle\":\""+articleTitle+"\",";
            }
            if(org.apache.commons.lang.StringUtils.isNotBlank(firstLevelCategoryId)){
                url += "\"firstLevelCategoryId\":\""+firstLevelCategoryId+"\",";
            }
            if(org.apache.commons.lang.StringUtils.isNotBlank(pageIndex)){
                pageNo=Integer.valueOf(pageIndex);
                url += "\"pageIndex\":\""+pageNo+"\",";
            }
            if(StringUtils.isNotBlank(userType) && "2".equals(userType)){
                url += "\"userType\":\""+userType+",\"userId\":\""+getRepUID()+"\"}&AuthInfo={ClientId:\"9000276\"}";
            }else if (StringUtils.isNotBlank(userType) && "1".equals(userType)){
                url += "\"userType\":\""+userType+",\"userId\":\""+getUID()+"\"}&AuthInfo={ClientId:\"9000276\"}";
            }
            String jsonStr = HttpUtil.sendPost(url,"");
            if(StringUtils.isNotBlank(jsonStr)){
                //结果转map
                Map<String,Object> map = (Map<String, Object>) JSON.parseObject(jsonStr);
                code = Integer.valueOf(String.valueOf(map.get("Code")));
                List<ArticleModel> list = new ArrayList<ArticleModel>();
                if(code == 10000){
                    String result = String.valueOf(map.get("Result"));
                    String resultStr = String.valueOf(result);
                    JSONArray jsonArray = JSONArray.fromObject(resultStr);
                    list = (List<ArticleModel>) JSONArray.toCollection(jsonArray, ArticleModel.class);//转换成列表
                    return new ResultListModel(list);
                }else{
                    return new ResultListModel(code, ErrorStateMessage.getMessge(code));
                }
            }
            return  new ResultListModel(0,"远程请求出错");
        }catch (Exception e){
            e.printStackTrace();
            return new ResultListModel(code, ErrorStateMessage.getMessge(code)+","+e.getMessage());
        }
    }
    /**
     *
     * @param articleTitle
     * @param firstLevelCategoryId
     * @param pageIndex
     * @return
     */
    @RequestMapping(value = "/getDoctorArticalList",method = RequestMethod.GET)
    @ApiOperation("获取卫计委认证文章+医生发表未认证文章")
    @ResponseBody
    public ResultListModel<List<ArticleModel>> getDoctorArticalList(
            @ApiParam(name = "articleTitle",value = "文章标题",required = false)@RequestParam(value = "articleTitle",required = false)String articleTitle,
            @ApiParam(name = "firstLevelCategoryId",value = "一级类别ID ,多个逗号隔开",required = false)@RequestParam(value = "firstLevelCategoryId",required = false)String firstLevelCategoryId,
            @ApiParam(name = "pageIndex",value = "起始页数 0开始,默认0",required = false)@RequestParam(value = "pageIndex",required = false)String pageIndex){
        int code =0;
        int pageNo=0;
        int pageSize=5;
        try {
            //调用福州接口
            String url ="http://172.17.110.230:83/WsPlatform/rest?Api=JkEdu.Article.getDoctorArticalList&Param={\"articleState\":\"1\",\"pageSize\":\""+pageSize+"\",";
            if(org.apache.commons.lang.StringUtils.isNotBlank(articleTitle)){
                url += "\"articleTitle\":\""+articleTitle+"\",";
            }
            if(org.apache.commons.lang.StringUtils.isNotBlank(firstLevelCategoryId)){
                url += "\"firstLevelCategoryId\":\""+firstLevelCategoryId+"\",";
            }
            if(org.apache.commons.lang.StringUtils.isNotBlank(pageIndex)){
                pageNo=Integer.valueOf(pageIndex);
                url += "\"pageIndex\":\""+pageNo+"\",";
            }
            url += "\"userId\":\""+getUID()+"\"}&AuthInfo={ClientId:\"9000276\"}";
            String jsonStr = HttpUtil.sendPost(url,"");
            if (StringUtils.isNotBlank(jsonStr)){
                //结果转map
                Map<String,Object> map = (Map<String, Object>) JSON.parseObject(jsonStr);
                code = Integer.valueOf(String.valueOf(map.get("Code")));
                List<ArticleModel> list = new ArrayList<ArticleModel>();
                if(code ==10000){
                    String result = String.valueOf(map.get("Result"));
                    String resultStr = String.valueOf(result);
                    JSONArray jsonArray = JSONArray.fromObject(resultStr);
                    list = (List<ArticleModel>) JSONArray.toCollection(jsonArray, ArticleModel.class);//转换成列表
                    return new ResultListModel(list);
                }else{
                    return new ResultListModel(code, ErrorStateMessage.getMessge(code));
                }
            }
            return  new ResultListModel(0,"远程请求出错");
        }catch (Exception e){
            e.printStackTrace();
            return new ResultListModel(code, ErrorStateMessage.getMessge(code)+","+e.getMessage());
        }
    }
    /**
     *
     * @param doctorCode
     * @param articleTitle
     * @param page
     * @param pagesize
     * @return
     */
    @RequestMapping(value = "/getPushedList", method = RequestMethod.GET)
    @ApiOperation("查询医生已推送文章 ")
    @ResponseBody
    public ResultPageListModel<HealthEduArticlePatientModel> getPatientHealthLogs(
            @ApiParam(name = "doctorCode", value = "医生code,为空从useragent取", required = false) @RequestParam(value = "doctorCode", required = false) String doctorCode,
            @ApiParam(name = "articleTitle", value = "文章标题", required = false) @RequestParam(value = "articleTitle", required = false) String articleTitle,
            @ApiParam(name = "page", value = "当前页 起始1", required = true) @RequestParam(value = "page", required = true) Integer page,
            @ApiParam(name = "pagesize", value = "每页显示条数", required = true) @RequestParam(value = "pagesize", required = true) Integer pagesize) {
        int code =0;
        try {
            if (StringUtils.isEmpty(doctorCode)) {
                doctorCode = getUID();
            }
            //最大1000
            if (pagesize > 1000) {
                pagesize = 1000;
            }
            List<HealthEduArticlePatientModel> eduArticlePatients = gcEduArticleService.getPatientHealthLogs(doctorCode, "", "", "", "", articleTitle, "", "", page, pagesize);
            Long count = gcEduArticleService.getPatientHealthLogsCount(getUID(), "", "", "", "", articleTitle, "", "");
            String ids = "";
            if(eduArticlePatients!=null && eduArticlePatients.size()>0){
                for (HealthEduArticlePatientModel healthEduArticle:eduArticlePatients) {
                    if (StringUtils.isNotBlank(healthEduArticle.getArticleId())){
                        ids += healthEduArticle.getArticleId()+",";
                    }
                }
            }
            if (StringUtils.isNotBlank(ids)){
                ids = ids.substring(0,ids.length()-1);
                //调用福州接口
                String url ="http://172.17.110.230:83/WsPlatform/rest?Api=JkEdu.Article.getArticalList&Param={\"articleState\":\"1\",\"articleId\":\""+ids+"\"," +
                        "\"pageIndex\":\""+page+"\",\"pageSize\":\""+pagesize+"\",";
                String jsonStr = HttpUtil.sendPost(url,"");
                if (StringUtils.isNotBlank(jsonStr)){
                    //结果转map
                    Map<String,Object> map = (Map<String, Object>) JSON.parseObject(jsonStr);
                    code = Integer.valueOf(String.valueOf(map.get("Code")));
                    List<ArticleModel> list = new ArrayList<ArticleModel>();
                    if(code ==10000){
                        String result = String.valueOf(map.get("Result"));
                        String resultStr = String.valueOf(result);
                        JSONArray jsonArray = JSONArray.fromObject(resultStr);
                        list = (List<ArticleModel>) JSONArray.toCollection(jsonArray, ArticleModel.class);//转换成列表
                        return new ResultPageListModel(page,pagesize,count.intValue(), list);
                    }else{
                        return new ResultPageListModel(code, ErrorStateMessage.getMessge(code));
                    }
                }
                return  new ResultPageListModel(0,"远程请求失败!");
            }
            return  new ResultPageListModel(-1000,"没有相应的数据!");
        } catch (Exception e) {
            return new ResultPageListModel(code,ErrorStateMessage.getMessge(code)+ "," + e.getMessage());
        }
    }
    @RequestMapping(value = "/send", method = RequestMethod.POST)
    @ResponseBody
    @ApiOperation("文章推送")
    public BaseResultModel send(
            @ApiParam(name = "sendType", value = "发送类型 1医生发送 2卫纪委发送", required = true) @RequestParam(value = "sendType", required = true) Integer sendType,
            @ApiParam(name = "sendCode", value = "发送人code", required = true) @RequestParam(value = "sendCode", required = true) String sendCode,
            @ApiParam(name = "sendName", value = "发送人名", required = true) @RequestParam(value = "sendName", required = true) String sendName,
            @ApiParam(name = "sendMessage", value = "发送人信息", required = false) @RequestParam(value = "sendMessage", required = false) String sendMessage,
            @ApiParam(name = "teamId", value = "发送人是医生的时候,医生所属的团队", required = false) @RequestParam(value = "teamId", required = false) Long teamId,
            @ApiParam(name = "labelCode", value = "所选群组,多个用逗号分隔", required = true) @RequestParam(value = "labelCode", required = false, defaultValue = "") String labelCode,
            @ApiParam(name = "labelType", value = "标签类型  1:服务类型(卫计委分组) 2:健康情况 3:疾病类型 4:团队标签(自定义标签)", required = false) @RequestParam(value = "labelType", required = false, defaultValue = "") String labelType,
            @ApiParam(name = "receiveCodes", value = "接收人code,多个逗号分割", required = false) @RequestParam(value = "receiveCodes", required = false, defaultValue = "") String receiveCodes,
            @ApiParam(name = "unReceiveCodes", value = "不接收人code,多个逗号分割(如果同时存在receiveCodes和unReceiveCodes,也不会发送)", required = false) @RequestParam(value = "unReceiveCodes", required = false, defaultValue = "") String unReceiveCodes,
            @ApiParam(name = "articleId", value = "文章ID", required = true) @RequestParam(value = "articleId", required = true) String articleId,
            @ApiParam(name = "articlePic", value = "文章封面", required = true) @RequestParam(value = "articlePic", required = true) String articlePic,
            @ApiParam(name = "articleTitle", value = "文章标题", required = true) @RequestParam(value = "articleTitle", required = true) String articleTitle,
            @ApiParam(name = "articleContent", value = "文章内容", required = true) @RequestParam(value = "articleContent", required = true) String articleContent,
            @ApiParam(name = "articleType", value = "文章类别", required = true) @RequestParam(value = "articleType", required = true) String articleType,
            @ApiParam(name = "level1Type", value = "一级分类", required = true) @RequestParam(value = "level1Type", required = true) String level1Type,
            @ApiParam(name = "level2Type", value = "二级分类", required = true) @RequestParam(value = "level2Type", required = true) String level2Type,
            @ApiParam(name = "level", value = "等级", required = true) @RequestParam(value = "level", required = true) String level,
            @ApiParam(name = "articleUrl", value = "宣教文章获取url", required = true) @RequestParam(value = "articleUrl", required = true) String articleUrl
    ) {
        try {
            String[] patients = receiveCodes.split(",");//接收人的code
            String[] unPatients = unReceiveCodes.split(",");//接收人的code
            Set<String> patientSet = new HashSet<>(); //放入set中可以去重复
            //得到需要发送的患者
            gcEduArticleService.initPatient(patientSet, patients, unPatients, labelType, labelCode, teamId);
            //获取保存发送记录
            List<com.yihu.es.entity.HealthEduArticlePatient> healthEduArticlePatients = gcEduArticleService.getSaveArticle(patientSet, sendCode, sendName, sendType, sendMessage, teamId, articleId, articlePic, articleTitle, articleContent, articleType, level1Type, level2Type, level,articleUrl);
            //推送微信模板消息和发送im消息
            new Thread(() -> {
                //发送任务到redis
                sender(healthEduArticlePatients);
            }).start();
            return new BaseResultModel();
        } catch (Exception e) {
            return new BaseResultModel(-10000, ErrorStateMessage.fail + ":" + e.getMessage());
        }
    }
    /**
     * 发送到redis
     *
     * @param healthEduArticlePatients
     */
    public void sender(List<HealthEduArticlePatient> healthEduArticlePatients) {
        //送到到队列
        healthEduArticlePatients.stream().forEach(one -> {
            jmsTemplate.send(channelName, new MessageCreator() {
                @Override
                public Message createMessage(Session session) throws JMSException {
                    TextMessage textMessage = session.createTextMessage();
                    textMessage.setText(net.sf.json.JSONObject.fromObject(one).toString());
                    return textMessage;
                }
            });
        });
    }
    @RequestMapping(value = "/sendPatients", method = RequestMethod.POST)
    @ResponseBody
    @ApiOperation("文章群推送")
    public BaseResultModel sendPatients(
            @ApiParam(name = "sendType", value = "发送类型 1医生发送 2卫纪委发送", required = true) @RequestParam(value = "sendType", required = true) Integer sendType,
            @ApiParam(name = "sendCode", value = "发送人code(医生发送时,必填医生code)", required = false) @RequestParam(value = "sendCode", required = false) String sendCode,
            @ApiParam(name = "sendName", value = "发送方名称(如:卫计委发送:集美区;医生发送:医生名称)", required = true) @RequestParam(value = "sendName", required = true) String sendName,
            @ApiParam(name = "labelUnitType", value = "标签类型  1:下属单位,多个用逗号分隔", required = false) @RequestParam(value = "labelUnitType", required = false, defaultValue = "") String labelUnitType,
            @ApiParam(name = "labelSexType", value = "标签类型  2:性别,多个用逗号分隔", required = false) @RequestParam(value = "labelSexType", required = false, defaultValue = "") String labelSexType,
            @ApiParam(name = "labelServeType", value = "标签类型  3:服务类型,多个用逗号分隔", required = false) @RequestParam(value = "labelServeType", required = false, defaultValue = "") String labelServeType,
            @ApiParam(name = "labelDiseaseType", value = "标签类型  4:疾病类型,多个用逗号分隔", required = false) @RequestParam(value = "labelDiseaseType", required = false, defaultValue = "") String labelDiseaseType,
            @ApiParam(name = "labelHealthType", value = "标签类型  5:健康情况,多个用逗号分隔", required = false) @RequestParam(value = "labelHealthType", required = false, defaultValue = "") String labelHealthType,
            @ApiParam(name = "articleId", value = "文章ID", required = true) @RequestParam(value = "articleId", required = true) String articleId,
            @ApiParam(name = "articlePic", value = "文章封面", required = true) @RequestParam(value = "articlePic", required = true) String articlePic,
            @ApiParam(name = "articleTitle", value = "文章标题", required = true) @RequestParam(value = "articleTitle", required = true) String articleTitle,
            @ApiParam(name = "articleContent", value = "文章内容", required = true) @RequestParam(value = "articleContent", required = true) String articleContent,
            @ApiParam(name = "articleType", value = "文章类别", required = true) @RequestParam(value = "articleType", required = true) String articleType,
            @ApiParam(name = "level1Type", value = "一级分类", required = true) @RequestParam(value = "level1Type", required = true) String level1Type,
            @ApiParam(name = "level2Type", value = "二级分类", required = true) @RequestParam(value = "level2Type", required = true) String level2Type,
            @ApiParam(name = "level", value = "等级", required = true) @RequestParam(value = "level", required = true) String level,
            @ApiParam(name = "articleUrl", value = "宣教文章获取的url", required = true) @RequestParam(value = "articleUrl", required = true) String articleUrl
    ){
        try {
            Set<String> patientSet = new HashSet<>(); //放入set中可以去重复
            //得到需要发送的患者
            gcEduArticleService.initPatient(patientSet,labelUnitType,labelSexType,labelServeType,labelDiseaseType,labelHealthType);
            //获取保存发送记录
            List<com.yihu.es.entity.HealthEduArticlePatient> healthEduArticlePatients = gcEduArticleService.getSaveArticle(patientSet, sendCode, sendName, sendType, "", 0L, articleId, articlePic, articleTitle, articleContent, articleType, level1Type, level2Type, level,articleUrl);
            //推送微信模板消息和发送im消息
            new Thread(() -> {
                //发送任务到redis
                sender(healthEduArticlePatients);
            }).start();
            return new BaseResultModel();
        }catch (Exception e) {
            return new BaseResultModel(-10000, ErrorStateMessage.fail + ":" + e.getMessage());
        }
    }
    /**
     * 获取要推送的患者
     * @param type
     * @param searchType
     * @return
     */
    /*@RequestMapping(value = "/getPatientList",method = RequestMethod.POST)
    @ApiOperation("获取要推送的患者")
    @ResponseBody
    public Map<String,Object> getPatienList(
            @ApiParam(name = "type",value = "分组类型1按服务类型2按疾病类型3按健康状况4按团队标签")@RequestParam(value = "type")Integer type,
            @ApiParam(name = "searchType",value = "筛选方式1重点关注2有绑定设备3孕产妇4年纪在65以上",required = false)@RequestParam(value = "searchType",required = false)String searchType){
        String[] searchTypes = {};
        if (StringUtils.isNotBlank(searchType)){
            searchTypes = searchType.split(",");
        }
        if(type==null){
            type=1;
        }
        Map<String,Object> map = familyContractService.getPushPatientList(type,searchTypes,getUID(),"");
        return map;
    }*/
}

+ 137 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/third/jkedu/controller/doctor/EduLableController.java

@ -0,0 +1,137 @@
package com.yihu.wlyy.web.third.jkedu.controller.doctor;
import com.yihu.wlyy.service.app.label.SignPatientLabelInfoService;
import com.yihu.wlyy.service.app.label.SignPatientLabelService;
import com.yihu.wlyy.service.common.account.PatientService;
import com.yihu.wlyy.web.BaseController;
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.PatientLabelModel;
import com.yihu.wlyy.web.third.gateway.vo.PatientModel;
import com.yihu.wlyy.web.third.gateway.vo.base.BaseResultModel;
import com.yihu.wlyy.web.third.gateway.vo.base.ResultListModel;
import com.yihu.wlyy.web.third.gateway.vo.base.ResultPageListModel;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.json.JSONArray;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
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.ResponseBody;
import java.util.ArrayList;
import java.util.List;
/**
 * Created by chenweida on 2017/8/30.
 */
@Controller
@RequestMapping(value = "/wlyygc/doctor/labeledu", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
@ResponseBody
@Api(description = "疾病标签")
public class EduLableController extends BaseController {
    @Autowired
    private SignPatientLabelService signPatientLabelService;
    @Autowired
    private SignPatientLabelInfoService signPatientLabelInfoService;
    @Autowired
    private GcLabelService labelService;
    @Autowired
    private PatientService patientService;
    @RequestMapping(value = "/labels", method = RequestMethod.GET)
    @ApiOperation("根据分组类型查找标签")
    public ResultListModel<List<PatientLabelModel>> labels(
            @ApiParam(name = "labelType", value = "1:服务类型(卫计委分组) 2:健康情况 3:疾病类型 4:团队标签(自定义标签)", required = true) @RequestParam(value = "labelType", required = true) String labelType
    ) {
        try {
            List<DictModel> dictModels = labelService.getLabelsByTypeAndTeam(labelType);
            return new ResultListModel(dictModels);
        } catch (Exception e) {
            return new ResultListModel(BaseResultModel.statusEm.find_error.getCode(), BaseResultModel.statusEm.find_error.getMessage() + "," + e.getMessage());
        }
    }
    @RequestMapping(value = "/labelsWithNum", method = RequestMethod.GET)
    @ApiOperation("根据分组类型查找标签已经标签下的患者数目")
    public ResultListModel<List<PatientLabelModel>> labelsWithNum(
            @ApiParam(name = "labelType", value = "1:服务类型(卫计委分组) 2:健康情况 3:疾病类型 4:团队标签(自定义标签)", required = true) @RequestParam(value = "labelType", required = true) String labelType,
            @ApiParam(name = "teamCode", value = "医生所属的团队ID", required = false) @RequestParam(value = "teamCode", required = false) Long teamCode
    ) {
        try {
            JSONArray result = null;
            if ("1".equals(labelType)) {
                //卫纪委服务类型
                result = patientService.getSignByTeamCodeGpbyServer(teamCode);
            } else {
                //其他标签
                result = labelService.getPatientAmountByTeamGroupLable(teamCode, labelType);
            }
            List<PatientLabelModel> patientLabelModels = new ArrayList<>();
            for (int i = 0; i < result.length(); i++) {
                JSONObject jo = result.getJSONObject(i);
                PatientLabelModel patientLabelModel = new PatientLabelModel();
                patientLabelModel.setLabelCode(jo.getString("labelCode"));
                patientLabelModel.setLabelName(jo.getString("labelName"));
                patientLabelModel.setAmount(jo.getInt("amount"));
                patientLabelModel.setFocusAmount(jo.getInt("focusAmount"));
                patientLabelModels.add(patientLabelModel);
            }
            return new ResultListModel(patientLabelModels);
        } catch (Exception e) {
            return new ResultListModel(BaseResultModel.statusEm.find_error.getCode(), BaseResultModel.statusEm.find_error.getMessage() + "," + e.getMessage());
        }
    }
    @RequestMapping(value = "/signPatientsByLabel", method = RequestMethod.GET)
    @ApiOperation("获取医生签约的患者列表")
    public ResultPageListModel<PatientModel> signPatients(
            @ApiParam(name = "labelType", value = "标签类型", required = true) @RequestParam(value = "labelType", required = true) String labelType,
            @ApiParam(name = "labelCode", value = "标签code", required = true) @RequestParam(value = "labelCode", required = true) String labelCode,
            @ApiParam(name = "teamCode", value = "所属团队", required = true) @RequestParam(value = "teamCode", required = true) Long teamCode,
            @ApiParam(name = "page", value = "当前页(1开始)", required = true) @RequestParam(value = "page", required = true, defaultValue = "1") Integer page,
            @ApiParam(name = "pageSize", value = "每页大小", required = true) @RequestParam(value = "pageSize", required = true, defaultValue = "10") Integer pageSize,
            @ApiParam(name = "isSlowDisease", value = "是否是慢病管理", required = true) @RequestParam(value="isSlowDisease",required = false,defaultValue = "false") boolean isSlowDisease
    ) {
        try {
            JSONArray result = signPatientLabelInfoService.getPatientByLabel(getUID(), labelCode, labelType, teamCode, page-1, pageSize, isSlowDisease, "");
            List<PatientModel> patientLabelModels = new ArrayList<>();
            for (int i = 0; i < result.length(); i++) {
                JSONObject jo = result.getJSONObject(i);
                PatientModel patientModel = new PatientModel();
                patientModel.setCode(jo.getString("code"));
                patientModel.setName(jo.getString("name"));
                patientModel.setWechatFocusRemind(jo.getInt("wechatFocusRemind")+"");
                patientModel.setPhoto(jo.getString("photo"));
                patientModel.setSex(jo.getInt("sex"));
                patientModel.setAge(jo.getInt("age"));
                patientLabelModels.add(patientModel);
            }
            return new ResultPageListModel(
                    page,
                    pageSize,
                    signPatientLabelInfoService.getPatientByLabelCount(getUID(), labelCode, labelType, teamCode).length()
                    ,patientLabelModels);
        } catch (Exception e) {
            return new ResultPageListModel(BaseResultModel.statusEm.find_error.getCode(), BaseResultModel.statusEm.find_error.getMessage() + "," + e.getMessage());
        }
    }
    @RequestMapping(value = "/unitLabels", method = RequestMethod.GET)
    @ApiOperation("根据地区查找卫计委下属单位标签")
    public ResultListModel<List<PatientLabelModel>> unitLabels(
            @ApiParam(name = "areas", value = "地区code,多个地区用逗号分隔", required = true) @RequestParam(value = "areas", required = true) String areas
    ) {
        try {
            List<DictModel> dictModels = labelService.getUnitLabels(areas);
            return new ResultListModel(dictModels);
        } catch (Exception e) {
            return new ResultListModel(BaseResultModel.statusEm.find_error.getCode(), BaseResultModel.statusEm.find_error.getMessage() + "," + e.getMessage());
        }
    }
}

+ 86 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/third/jkedu/controller/patient/EduPatientArticleController.java

@ -0,0 +1,86 @@
package com.yihu.wlyy.web.third.jkedu.controller.patient;
import com.alibaba.fastjson.JSON;
import com.yihu.wlyy.service.app.sign.FamilyContractService;
import com.yihu.wlyy.web.BaseController;
import com.yihu.wlyy.web.third.jkedu.vo.ArticleModel;
import com.yihu.wlyy.web.third.jkedu.vo.CategoryModel;
import com.yihu.wlyy.web.third.jkedu.vo.base.ResultListModel;
import com.yihu.wlyy.web.third.jkedu.vo.state.ErrorStateMessage;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import net.sf.json.JSONArray;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
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.ResponseBody;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
 * Created by zhangdan on 2017/9/30.
 */
@Controller
@Api(description = "居民端--健康宣教文章")
@RequestMapping(value = "/wlyygc/patient/jkedu",produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public class EduPatientArticleController extends BaseController{
    @Autowired
    private FamilyContractService familyContractService;
    @Autowired
    private com.yihu.wlyy.util.HttpUtil HttpUtil;
    @RequestMapping(value = "/getDoctorArticalByUserId",method = RequestMethod.GET)
    @ApiOperation("获取医生主页中的文章列表(医生发表文章接口)")
    @ResponseBody
    public ResultListModel<List<ArticleModel>> getDoctorArticalByUserId(
            @ApiParam(name = "articleTitle",value = "文章标题",required = false)@RequestParam(value = "articleTitle",required = false)String articleTitle,
            @ApiParam(name = "firstLevelCategoryId",value = "一级类别ID ,多个逗号隔开",required = false)@RequestParam(value = "firstLevelCategoryId",required = false)String firstLevelCategoryId,
            @ApiParam(name = "pageIndex",value = "起始页数 0开始,默认0",required = false)@RequestParam(value = "pageIndex",required = false)String pageIndex){
        int errCode =0;
        int pageNo=0;
        int pageSize=5;
        try {
            //调用福州接口
            String url ="http://172.17.110.230:83/WsPlatform/rest?Api=JkEdu.Article.getDoctorArticalByUserId&Param={\"articleState\":\"1\",\"pageSize\":\""+pageSize+"\",";
            if(org.apache.commons.lang.StringUtils.isNotBlank(articleTitle)){
                url += "\"articleTitle\":\""+articleTitle+"\",";
            }
            if(org.apache.commons.lang.StringUtils.isNotBlank(firstLevelCategoryId)){
                url += "\"firstLevelCategoryId\":\""+firstLevelCategoryId+"\",";
            }
            if(org.apache.commons.lang.StringUtils.isNotBlank(pageIndex)){
                pageNo=Integer.valueOf(pageIndex);
                url += "\"pageIndex\":\""+pageNo+"\",";
            }
            String doctor = familyContractService.checkPatient(getRepUID());
            url += "\"userId\":\""+doctor+"\"}&AuthInfo={ClientId:\"9000276\"}";
            String jsonStr = HttpUtil.sendPost(url,"");
            //结果转map
            Map<String,Object> map = (Map<String, Object>) JSON.parseObject(jsonStr);
            System.out.println(map);
            List<ArticleModel> list = new ArrayList<ArticleModel>();
            if("10000".equals(String.valueOf(map.get("Code")))){
                String result = String.valueOf(map.get("Result"));
                String resultStr = String.valueOf(result);
                JSONArray jsonArray = JSONArray.fromObject(resultStr);
                list = (List<ArticleModel>) JSONArray.toCollection(jsonArray, ArticleModel.class);//转换成列表
                return new ResultListModel(list);
            }else{
                errCode =Integer.valueOf(String.valueOf(map.get("Code")));
                return new ResultListModel(errCode, ErrorStateMessage.getMessge(errCode));
            }
        }catch (Exception e){
            e.printStackTrace();
            return new ResultListModel(errCode, ErrorStateMessage.getMessge(errCode)+","+e.getMessage());
        }
    }
}

+ 364 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/third/jkedu/vo/ArticleModel.java

@ -0,0 +1,364 @@
package com.yihu.wlyy.web.third.jkedu.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.Date;
/**
 * Created by Administrator on 2017/9/29.
 */
@ApiModel(description = "公众号--医生健康文章")
public class ArticleModel {
    //文章ID
    @ApiModelProperty(value = "文章ID", required = false, access = "response")
    private String articleId;
    //文章标题
    @ApiModelProperty(value = "文章标题", required = false, access = "response")
    private String articleTitle;
    //文章内容
    @ApiModelProperty(value = "文章内容", required = false, access = "response")
    private String articleContent;
    //排序
    @ApiModelProperty(value = "文章排序", required = false, access = "response")
    private int articleOrder;
    //1、正常、2删除
    @ApiModelProperty(value = "文章状态", required = false, access = "response")
    private int articleState;
    //文章所属单位名称
    @ApiModelProperty(value = "文章所属单位名称", required = false, access = "response")
    private String orgName;
    //文章来源(填写发布人所在的机构)
    @ApiModelProperty(value = "文章来源", required = false, access = "response")
    private String articleSource;
    //文章所属单位ID
   // @ApiModelProperty(value = "文章ID", required = false, access = "response")
    //private String OgId;
    //1、重要、2紧急、3、一般
    @ApiModelProperty(value = "文章级别", required = false, access = "response")
    private int articlelevel;
    //封面图
    @ApiModelProperty(value = "封面图", required = false, access = "response")
    private String articleCover;
    //插入时间
    @ApiModelProperty(value = "插入时间", required = false, access = "response")
    private Date insertTime;
    //最后更新时间
    @ApiModelProperty(value = "最后更新时间", required = false, access = "response")
    private Date updateTime;
    //创建人
    @ApiModelProperty(value = "创建人", required = false, access = "response")
    private String operatorName;
    //创建人ID
    @ApiModelProperty(value = "创建人ID", required = false, access = "response")
    private String operatorId;
    //1级类别id
    @ApiModelProperty(value = "1级类别id", required = false, access = "response")
    private String firstLevelCategoryId;
    //1级类别名称
    @ApiModelProperty(value = "1级类别名称", required = false, access = "response")
    private String firstLevelCategoryName;
    //2级类别ID
    @ApiModelProperty(value = "2级类别ID", required = false, access = "response")
    private String secondLevelCategoryId;
    //2级类别名称
    @ApiModelProperty(value = "2级类别名称", required = false, access = "response")
    private String secondLevelCategoryName;
    //认证单位
    @ApiModelProperty(value = "认证单位", required = false, access = "response")
    private String authentication;
    //认证单位ID
    @ApiModelProperty(value = "认证单位ID", required = false, access = "response")
    private String authenticationId;
    //是否认证 1已认证2、未认证
    @ApiModelProperty(value = "是否认证", required = false, access = "response")
    private int isAuthentication;
    //1、视频 2、图文3、音频、 4 、精选问答
    @ApiModelProperty(value = "文章类型", required = false, access = "response")
    private String articleType;
    //操作人所在科室
    @ApiModelProperty(value = "操作人所在科室", required = false, access = "response")
    private String deptName;
    //等级职称
    @ApiModelProperty(value = "等级职称", required = false, access = "response")
    private String titleLevel;
    //操作人头像
    @ApiModelProperty(value = "操作人头像", required = false, access = "response")
    private String operatorImg;
    @ApiModelProperty(value = "浏览数", required = false, access = "response")
    private int browseNumbere;//浏览数
    @ApiModelProperty(value = "点赞数", required = false, access = "response")
    private int pointNumber;//点赞数
    @ApiModelProperty(value = "评论数", required = false, access = "response")
    private int commentNumber;//评论数
    @ApiModelProperty(value = "分享数", required = false, access = "response")
    private int shareNumber;//分享数
    @ApiModelProperty(value = "收藏数", required = false, access = "response")
    private int collectionNumber;//收藏数
    public String getArticleId() {
        return articleId;
    }
    public void setArticleId(String articleId) {
        this.articleId = articleId;
    }
    public String getArticleTitle() {
        return articleTitle;
    }
    public void setArticleTitle(String articleTitle) {
        this.articleTitle = articleTitle;
    }
    public String getArticleContent() {
        return articleContent;
    }
    public void setArticleContent(String articleContent) {
        this.articleContent = articleContent;
    }
    public int getArticleOrder() {
        return articleOrder;
    }
    public void setArticleOrder(int articleOrder) {
        this.articleOrder = articleOrder;
    }
    public int getArticleState() {
        return articleState;
    }
    public void setArticleState(int articleState) {
        this.articleState = articleState;
    }
    public String getOrgName() {
        return orgName;
    }
    public void setOrgName(String orgName) {
        this.orgName = orgName;
    }
    public String getArticleSource() {
        return articleSource;
    }
    public void setArticleSource(String articleSource) {
        this.articleSource = articleSource;
    }
    public int getArticlelevel() {
        return articlelevel;
    }
    public void setArticlelevel(int articlelevel) {
        this.articlelevel = articlelevel;
    }
    public String getArticleCover() {
        return articleCover;
    }
    public void setArticleCover(String articleCover) {
        this.articleCover = articleCover;
    }
    public Date getInsertTime() {
        return insertTime;
    }
    public void setInsertTime(Date insertTime) {
        this.insertTime = insertTime;
    }
    public Date getUpdateTime() {
        return updateTime;
    }
    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }
    public String getOperatorName() {
        return operatorName;
    }
    public void setOperatorName(String operatorName) {
        this.operatorName = operatorName;
    }
    public String getOperatorId() {
        return operatorId;
    }
    public void setOperatorId(String operatorId) {
        this.operatorId = operatorId;
    }
    public String getFirstLevelCategoryId() {
        return firstLevelCategoryId;
    }
    public void setFirstLevelCategoryId(String firstLevelCategoryId) {
        this.firstLevelCategoryId = firstLevelCategoryId;
    }
    public String getFirstLevelCategoryName() {
        return firstLevelCategoryName;
    }
    public void setFirstLevelCategoryName(String firstLevelCategoryName) {
        this.firstLevelCategoryName = firstLevelCategoryName;
    }
    public String getSecondLevelCategoryId() {
        return secondLevelCategoryId;
    }
    public void setSecondLevelCategoryId(String secondLevelCategoryId) {
        this.secondLevelCategoryId = secondLevelCategoryId;
    }
    public String getSecondLevelCategoryName() {
        return secondLevelCategoryName;
    }
    public void setSecondLevelCategoryName(String secondLevelCategoryName) {
        this.secondLevelCategoryName = secondLevelCategoryName;
    }
    public String getAuthentication() {
        return authentication;
    }
    public void setAuthentication(String authentication) {
        this.authentication = authentication;
    }
    public String getAuthenticationId() {
        return authenticationId;
    }
    public void setAuthenticationId(String authenticationId) {
        this.authenticationId = authenticationId;
    }
    public int getIsAuthentication() {
        return isAuthentication;
    }
    public void setIsAuthentication(int isAuthentication) {
        this.isAuthentication = isAuthentication;
    }
    public String getArticleType() {
        return articleType;
    }
    public void setArticleType(String articleType) {
        this.articleType = articleType;
    }
    public String getDeptName() {
        return deptName;
    }
    public void setDeptName(String deptName) {
        this.deptName = deptName;
    }
    public String getTitleLevel() {
        return titleLevel;
    }
    public void setTitleLevel(String titleLevel) {
        this.titleLevel = titleLevel;
    }
    public String getOperatorImg() {
        return operatorImg;
    }
    public void setOperatorImg(String operatorImg) {
        this.operatorImg = operatorImg;
    }
    public int getBrowseNumbere() {
        return browseNumbere;
    }
    public void setBrowseNumbere(int browseNumbere) {
        this.browseNumbere = browseNumbere;
    }
    public int getPointNumber() {
        return pointNumber;
    }
    public void setPointNumber(int pointNumber) {
        this.pointNumber = pointNumber;
    }
    public int getCommentNumber() {
        return commentNumber;
    }
    public void setCommentNumber(int commentNumber) {
        this.commentNumber = commentNumber;
    }
    public int getShareNumber() {
        return shareNumber;
    }
    public void setShareNumber(int shareNumber) {
        this.shareNumber = shareNumber;
    }
    public int getCollectionNumber() {
        return collectionNumber;
    }
    public void setCollectionNumber(int collectionNumber) {
        this.collectionNumber = collectionNumber;
    }
}

+ 32 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/third/jkedu/vo/CategoryModel.java

@ -0,0 +1,32 @@
package com.yihu.wlyy.web.third.jkedu.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/**
 * Created by Administrator on 2017/9/29.
 */
@ApiModel(description = "文章类型")
public class CategoryModel {
    @ApiModelProperty(value = "类型ID",required = false,access = "response")
    private String categoryid;
    @ApiModelProperty(value = "类型明显",required = false,access = "response")
    private String categoryname;
    public String getCategoryid() {
        return categoryid;
    }
    public void setCategoryid(String categoryid) {
        this.categoryid = categoryid;
    }
    public String getCategoryname() {
        return categoryname;
    }
    public void setCategoryname(String categoryname) {
        this.categoryname = categoryname;
    }
}

+ 45 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/third/jkedu/vo/base/BaseResultModel.java

@ -0,0 +1,45 @@
package com.yihu.wlyy.web.third.jkedu.vo.base;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/**
 * Created by chenweida on 2017/8/17.
 */
@ApiModel("返回实体")
public class BaseResultModel {
    @ApiModelProperty(value = "状态", required = false, access = "response")
    protected Integer status = 10000;
    @ApiModelProperty(value = "信息", required = false, access = "response")
    protected String message = "成功";
    public Integer getStatus() {
        return status;
    }
    public void setStatus(Integer status) {
        this.status = status;
    }
    public String getMessage() {
        return message;
    }
    public void setMessage(String message) {
        this.message = message;
    }
    public BaseResultModel() {
    }
    public BaseResultModel(String message) {
        this.message = message;
    }
    public BaseResultModel(Integer status, String message) {
        this.status = status;
        this.message = message;
    }
}

+ 69 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/third/jkedu/vo/base/ResultBatchModel.java

@ -0,0 +1,69 @@
package com.yihu.wlyy.web.third.jkedu.vo.base;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.ArrayList;
import java.util.List;
/**
 * Created by chenweida on 2017/8/17.
 */
@ApiModel("返回实体")
public class ResultBatchModel extends BaseResultModel {
    @ApiModelProperty(value = "成功数目", required = false, access = "response")
    private Integer successNum = 0;
    @ApiModelProperty(value = "失败数目", required = false, access = "response")
    private Integer errorNum = 0;
    @ApiModelProperty(value = "失败List", required = false, access = "response")
    private List<String> errorList = new ArrayList<>();
    public ResultBatchModel(Integer success, Integer error, List<String> errorList) {
        this.successNum = success;
        this.errorNum = error;
        this.errorList = errorList;
    }
    public ResultBatchModel(Integer code, String message, Integer success, Integer error, List<String> errorList) {
        super(code, message);
        this.successNum = success;
        this.errorNum = error;
        this.errorList = errorList;
    }
    public ResultBatchModel() {
    }
    public ResultBatchModel(Integer status, String message) {
        super(status, message);
    }
    public Integer getSuccessNum() {
        return successNum;
    }
    public void setSuccessNum(Integer successNum) {
        this.successNum = successNum;
    }
    public Integer getErrorNum() {
        return errorNum;
    }
    public void setErrorNum(Integer errorNum) {
        this.errorNum = errorNum;
    }
    public List<String> getErrorList() {
        return errorList;
    }
    public void setErrorList(List<String> errorList) {
        this.errorList = errorList;
    }
}

+ 36 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/third/jkedu/vo/base/ResultListModel.java

@ -0,0 +1,36 @@
package com.yihu.wlyy.web.third.jkedu.vo.base;
import io.swagger.annotations.ApiModelProperty;
import java.util.List;
/**
 * Created by chenweida on 2017/8/17.
 */
public class ResultListModel<T> extends BaseResultModel {
    @ApiModelProperty(value = "返回数据", required = false, access = "response")
    private List<T> result;
    public List<T> getResult() {
        return result;
    }
    public void setResult(List<T> result) {
        this.result = result;
    }
    public ResultListModel(List<T> result) {
        this.result = result;
    }
    public ResultListModel(Integer status, String message) {
        this.status = status;
        this.message = message;
    }
    public ResultListModel() {
    }
}

+ 39 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/third/jkedu/vo/base/ResultOneModel.java

@ -0,0 +1,39 @@
package com.yihu.wlyy.web.third.jkedu.vo.base;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/**
 * Created by chenweida on 2017/8/17.
 * 对外放回的实体
 */
@ApiModel("返回的实体类")
public class ResultOneModel<T> extends BaseResultModel {
    @ApiModelProperty(value = "返回数据", required = false, access = "response")
    private T result;
    public T getResult() {
        return result;
    }
    public void setResult(T result) {
        this.result = result;
    }
    public ResultOneModel(T result) {
        this.result = result;
    }
    public ResultOneModel() {
    }
    public ResultOneModel(Integer code, String message) {
        super(code, message);
    }
    public ResultOneModel(Integer status, String message, T result) {
        super(status, message);
        this.result = result;
    }
}

+ 67 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/third/jkedu/vo/base/ResultPageListModel.java

@ -0,0 +1,67 @@
package com.yihu.wlyy.web.third.jkedu.vo.base;
import io.swagger.annotations.ApiModelProperty;
import java.util.List;
/**
 * Created by chenweida on 2017/8/17.
 */
public class ResultPageListModel<T> extends BaseResultModel {
    @ApiModelProperty(value = "当前页", required = false, access = "response")
    private Integer page;
    @ApiModelProperty(value = "每页大小", required = false, access = "response")
    private Integer pageSize;
    @ApiModelProperty(value = "总数", required = false, access = "response")
    private Integer allNum;
    @ApiModelProperty(value = "返回数据", required = false, access = "response")
    private List<T> result;
    public List<T> getResult() {
        return result;
    }
    public void setResult(List<T> result) {
        this.result = result;
    }
    public Integer getPage() {
        return page;
    }
    public void setPage(Integer page) {
        this.page = page;
    }
    public Integer getPageSize() {
        return pageSize;
    }
    public void setPageSize(Integer pageSize) {
        this.pageSize = pageSize;
    }
    public ResultPageListModel(Integer page, Integer pageSize, Integer allNum, List<T> result) {
        this.page = page;
        this.pageSize = pageSize;
        this.result = result;
        this.allNum = allNum;
    }
    public ResultPageListModel() {
    }
    public ResultPageListModel(Integer status, String message) {
        super(status, message);
    }
    public Integer getAllNum() {
        return allNum;
    }
    public void setAllNum(Integer allNum) {
        this.allNum = allNum;
    }
}

+ 85 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/third/jkedu/vo/state/ErrorStateMessage.java

@ -0,0 +1,85 @@
package com.yihu.wlyy.web.third.jkedu.vo.state;
/**
 * Created by Administrator on 2017/9/30.
 */
public class ErrorStateMessage {
    public  final  static  String success="请求成功";
    public  final  static  String err_20000="api参数缺失或api参数值格式错误";
    public  final  static  String err_20001="路由解析错误";
    public  final  static  String err_20002="未找到可用的路由地址";
    public  final  static  String err_20003="未找到远程接口实现类";
    public  final  static  String err_20004="应用系统返回空结果集";
    public  final  static  String err_20005="IP不在允许访问范围内";
    public  final  static  String err_20006="渠道ID不存在";
    public  final  static  String err_20007="签名验证不通过,请检查secret是否正确/加密方式是否正确";
    public  final  static  String err_20008="已超过每小时的额定调用上限,禁止访问";
    public  final  static  String err_20009="已超过每天的额定调用上限,禁止访问";
    public  final  static  String err_20010="验证不通过:timestamp参数不能为空";
    public  final  static  String err_29999="远程过程调用(RPC)异常";
    public  final  static  String err_30000="响应超时";
    public  final  static  String fail="请求失败";
    public  final  static  String err_f_10000="必填参数异常";
    public  final  static  String err_f_14444="程序异常";
    public  final  static  String err_f_10001="收藏异常";
    public final static String getMessge(int code){
        String message ="";
        switch (code){
            case 10000:
                message = success;
                break;
            case 20000:
                message = err_20000;
                break;
            case 20001:
                message = err_20001;
                break;
            case 20002:
                message = err_20002;
                break;
            case 20003:
                message = err_20003;
                break;
            case 20004:
                message = err_20004;
                break;
            case 20005:
                message = err_20005;
                break;
            case 20006:
                message = err_20006;
                break;
            case 20007:
                message = err_20007;
                break;
            case 20008:
                message = err_20008;
                break;
            case 20009:
                message = err_20009;
                break;
            case 20010:
                message = err_20010;
                break;
            case 29999:
                message = err_29999;
                break;
            case 30000:
                message = err_30000;
                break;
            case -10000:
                message = err_f_10000;
                break;
            case -14444:
                message = err_f_14444;
                break;
            case -10001:
                message = err_f_10001;
                break;
        }
        return message;
    }
}