Browse Source

Merge branch '1.4.1' of liuwenbin/patient-co-management into dev_1.4.1

huangwenjie 7 years ago
parent
commit
7e69b6b51b
36 changed files with 467 additions and 319 deletions
  1. 12 0
      common/common-entity/src/main/java/com/yihu/es/entity/HealthEduArticleES.java
  2. 1 1
      edu-article/JkEdu/WebRoot/WEB-INF/classes/Article.sql.xml
  3. 3 1
      edu-article/JkEdu/WebRoot/WEB-INF/classes/articlePc.sql.xml
  4. BIN
      edu-article/JkEdu/WebRoot/WEB-INF/classes/com/yihu/jk/action/ArticleQRCodeAction.class
  5. BIN
      edu-article/JkEdu/WebRoot/WEB-INF/classes/com/yihu/jk/api/ArticleApi.class
  6. BIN
      edu-article/JkEdu/WebRoot/WEB-INF/classes/com/yihu/jk/api/ArticleApiTest.class
  7. BIN
      edu-article/JkEdu/WebRoot/WEB-INF/classes/com/yihu/jk/api/ArticleQRCodeApi.class
  8. BIN
      edu-article/JkEdu/WebRoot/WEB-INF/classes/com/yihu/jk/api/ArticleQRCodeApiTest.class
  9. BIN
      edu-article/JkEdu/WebRoot/WEB-INF/classes/com/yihu/jk/api/BehaviorApi.class
  10. BIN
      edu-article/JkEdu/WebRoot/WEB-INF/classes/com/yihu/jk/api/CategoryApi.class
  11. BIN
      edu-article/JkEdu/WebRoot/WEB-INF/classes/com/yihu/jk/api/CategoryApiTest.class
  12. BIN
      edu-article/JkEdu/WebRoot/WEB-INF/classes/com/yihu/jk/api/ConfigSysApi.class
  13. BIN
      edu-article/JkEdu/WebRoot/WEB-INF/classes/com/yihu/jk/dao/ArticleDao.class
  14. BIN
      edu-article/JkEdu/WebRoot/WEB-INF/classes/com/yihu/jk/dao/ArticleQRCodeDao.class
  15. BIN
      edu-article/JkEdu/WebRoot/WEB-INF/classes/com/yihu/jk/dao/CategoryDao.class
  16. BIN
      edu-article/JkEdu/WebRoot/WEB-INF/classes/com/yihu/jk/dao/ConfigSysDao.class
  17. BIN
      edu-article/JkEdu/WebRoot/WEB-INF/classes/com/yihu/jk/enums/ArticleSqlNameEnum.class
  18. BIN
      edu-article/JkEdu/WebRoot/WEB-INF/classes/com/yihu/jk/vo/Article.class
  19. BIN
      edu-article/JkEdu/WebRoot/WEB-INF/classes/com/yihu/jk/vo/ArticleStatistic.class
  20. BIN
      edu-article/JkEdu/WebRoot/WEB-INF/classes/com/yihu/jk/vo/OrgArticleVo.class
  21. 1 1
      edu-article/JkEdu/WebRoot/WEB-INF/classes/route/JkEdu.xml
  22. 6 6
      edu-article/JkEdu/WebRoot/WEB-INF/classes/sys.xml
  23. 5 2
      edu-article/JkEdu/src/com/yihu/jk/dao/ArticleDao.java
  24. 1 0
      edu-article/JkEdu/src/com/yihu/jk/dao/ArticleQRCodeDao.java
  25. 44 2
      patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/activemq/HealthArtListener.java
  26. 1 1
      patient-co/patient-co-wlyy-job/src/main/resources/application-devtest.yml
  27. 84 60
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/jimeiJkEdu/JMJkEduArticleService.java
  28. 59 24
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/third/jkEduArticle/ThirdJkEduArticleService.java
  29. 4 4
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/util/ElasticsearchUtil.java
  30. 13 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/BaseController.java
  31. 12 4
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/jimeiJkEduPC/DoctorJMJkEduArticlePCController.java
  32. 2 3
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/jimeiJkEdu/PatientJMJkEduArticleController.java
  33. 170 170
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/third/gateway/controller/doctor/GcEduArticleController.java
  34. 23 13
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/third/gateway/vo/HealthEduArticlePatientModel.java
  35. 23 23
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/third/jkEduArticle/ThirdJkEduArticleController.java
  36. 3 3
      patient-co/patient-co-wlyy/src/main/resources/application-devtest.yml

+ 12 - 0
common/common-entity/src/main/java/com/yihu/es/entity/HealthEduArticleES.java

@ -58,6 +58,7 @@ public class HealthEduArticleES {
    private String currentUserRoleLevel;//发送者当前登录的角色级别
    private Integer sendSource; //1或者为空 i健康后台推送  2PC端推送
    private Integer allCount;//所有的推送数目
    private Long readNumber;//阅读数(备注和浏览数不一样)
    @Transient
    private Boolean newArricleFlag;//新版文章推送标志
@ -367,4 +368,15 @@ public class HealthEduArticleES {
    public void setUserType(Integer userType) {
        this.userType = userType;
    }
    public Long getReadNumber() {
        return readNumber;
    }
    public void setReadNumber(Long readNumber) {
        this.readNumber = readNumber;
    }
    public HealthEduArticleES() {
    }
}

+ 1 - 1
edu-article/JkEdu/WebRoot/WEB-INF/classes/Article.sql.xml

@ -3,7 +3,7 @@
	<Sqls>
		<Sql name='getArticleList'>
			<![CDATA[
		select m.*,n.BrowseNumber,n.PointNumber,n.CollectionNumber,n.CommentNumber from Org_Article m 
		select m.*,IFNULL(n.BrowseNumber,0) as BrowseNumber,IFNULL(n.PointNumber,0) as PointNumber,IFNULL(n.CollectionNumber,0) as CollectionNumber,IFNULL(n.CommentNumber,0) as CommentNumber  from Org_Article m
LEFT JOIN User_ArticleStatistics n on m.ArticleId=n.ArticleId where 1=1 @Condition
		
			]]>

+ 3 - 1
edu-article/JkEdu/WebRoot/WEB-INF/classes/articlePc.sql.xml

@ -3,7 +3,8 @@
	<Sqls> 
		 <Sql name='getArticlePcList'>
		 <![CDATA[
				select m.*,n.BrowseNumber,n.PointNumber,n.CollectionNumber,n.CommentNumber from Org_Article m
				select m.*,IFNULL(n.BrowseNumber,0) as BrowseNumber,IFNULL(n.PointNumber,0) as PointNumber,IFNULL(n.CollectionNumber,0) as CollectionNumber,IFNULL(n.CommentNumber,0) as CommentNumber ,
				(select count(1) from user_articlecollection a where a.ArticleId=m.ArticleId  @Condition2 )as collectionType from Org_Article m
				LEFT JOIN User_ArticleStatistics n on m.ArticleId=n.ArticleId where 1=1   and  ArticleState =1  @Condition    order by ArticleOrder desc  ,UpdateTime desc   @PageParam
			]]>
		</Sql>
@ -40,5 +41,6 @@
				update  Org_Article  set @behaviorParam where 1=1 @Condition
			]]>
		</Sql>
	</Sqls>
</das-client>

BIN
edu-article/JkEdu/WebRoot/WEB-INF/classes/com/yihu/jk/action/ArticleQRCodeAction.class


BIN
edu-article/JkEdu/WebRoot/WEB-INF/classes/com/yihu/jk/api/ArticleApi.class


BIN
edu-article/JkEdu/WebRoot/WEB-INF/classes/com/yihu/jk/api/ArticleApiTest.class


BIN
edu-article/JkEdu/WebRoot/WEB-INF/classes/com/yihu/jk/api/ArticleQRCodeApi.class


BIN
edu-article/JkEdu/WebRoot/WEB-INF/classes/com/yihu/jk/api/ArticleQRCodeApiTest.class


BIN
edu-article/JkEdu/WebRoot/WEB-INF/classes/com/yihu/jk/api/BehaviorApi.class


BIN
edu-article/JkEdu/WebRoot/WEB-INF/classes/com/yihu/jk/api/CategoryApi.class


BIN
edu-article/JkEdu/WebRoot/WEB-INF/classes/com/yihu/jk/api/CategoryApiTest.class


BIN
edu-article/JkEdu/WebRoot/WEB-INF/classes/com/yihu/jk/api/ConfigSysApi.class


BIN
edu-article/JkEdu/WebRoot/WEB-INF/classes/com/yihu/jk/dao/ArticleDao.class


BIN
edu-article/JkEdu/WebRoot/WEB-INF/classes/com/yihu/jk/dao/ArticleQRCodeDao.class


BIN
edu-article/JkEdu/WebRoot/WEB-INF/classes/com/yihu/jk/dao/CategoryDao.class


BIN
edu-article/JkEdu/WebRoot/WEB-INF/classes/com/yihu/jk/dao/ConfigSysDao.class


BIN
edu-article/JkEdu/WebRoot/WEB-INF/classes/com/yihu/jk/enums/ArticleSqlNameEnum.class


BIN
edu-article/JkEdu/WebRoot/WEB-INF/classes/com/yihu/jk/vo/Article.class


BIN
edu-article/JkEdu/WebRoot/WEB-INF/classes/com/yihu/jk/vo/ArticleStatistic.class


BIN
edu-article/JkEdu/WebRoot/WEB-INF/classes/com/yihu/jk/vo/OrgArticleVo.class


+ 1 - 1
edu-article/JkEdu/WebRoot/WEB-INF/classes/route/JkEdu.xml

@ -6,7 +6,7 @@
<module name="JkEdu.Category" remoteClass="com.yihu.jk.api.CategoryApi"></module>
<module name="JkEdu.ConfigSys" remoteClass="com.yihu.jk.api.ConfigSysApi"></module>
<module name="JkEdu.ConfigDicSho" remoteClass="com.yihu.jk.api.ConfigDicShoApi"></module>
<module name="JkEdu.ArticleQR" remoteClass="com.yihu.jk.api.getArticleQRCodeApi"></module>
<module name="JkEdu.ArticleQR" remoteClass="com.yihu.jk.api.ArticleQRCodeApi"></module>
</Mapping>
<Route url="url.JkEdu"></Route>
</Config>

+ 6 - 6
edu-article/JkEdu/WebRoot/WEB-INF/classes/sys.xml

@ -8,14 +8,14 @@
  <!-- 数据库连接配置  -->
  <DB.Alias>jkedudb</DB.Alias>
  <DB.DatabaseName>jkedudb</DB.DatabaseName>
  <!--<DB.IP>172.19.103.85</DB.IP>-->
  <!--<DB.Port>3306</DB.Port>-->
  <!--<DB.UserName>linzhou</DB.UserName>-->
  <!--<DB.Password>FDw6DUFgoKg=</DB.Password>-->
  <DB.IP>172.19.103.77</DB.IP>
  <DB.IP>172.19.103.85</DB.IP>
  <DB.Port>3306</DB.Port>
  <DB.UserName>linzhou</DB.UserName>
  <DB.Password>FDw6DUFgoKg=</DB.Password>
  <!--<DB.IP>172.19.103.77</DB.IP>
  <DB.Port>3306</DB.Port>
  <DB.UserName>root</DB.UserName>
  <DB.Password>VYhw4YNnygE=</DB.Password>
  <DB.Password>VYhw4YNnygE=</DB.Password>-->
  <!--<EhrApiUrl>http://ehr.yihu.com/wlyyfz</EhrApiUrl>-->
  <EhrApiUrl>http://192.168.131.131:8080/</EhrApiUrl>

+ 5 - 2
edu-article/JkEdu/src/com/yihu/jk/dao/ArticleDao.java

@ -595,7 +595,8 @@ public class ArticleDao {
			param.append(" and UserScope <= ? ");
            sql.addParamValue(Integer.valueOf(vo.getOperatorRoleLevel())-1);
        }else{
            sql.addParamValue(3);
			param.append(" and UserScope <= 3 ");
//            sql.addParamValue(3);
        }
		if(StringUtil.isNotEmpty(vo.getRoleType())) {
			param.append(" and RoleType = ? ");
@ -628,6 +629,7 @@ public class ArticleDao {
//			result = dao.getCategoryList( temp, 0, 1000);
//			one.setSecondLevelCategoryName(result.get("CategoryName")+"");
//		}
		System.out.printf("queryArticlePcList:"+sql.toString());
		return DB.me().queryForJson(MyDatabaseEnum.JkEduDB, sql, start, pageSize);
	}
@ -693,7 +695,7 @@ public class ArticleDao {
			param.append(" and UserScope <= ? ");
			sql.addParamValue(Integer.valueOf(vo.getOperatorRoleLevel())-1);
		}else{
			sql.addParamValue(3);
            param.append(" and UserScope <= 3 ");
		}
		if(StringUtil.isNotEmpty(vo.getRoleType())) {
			param.append(" and RoleType = ? ");
@ -708,6 +710,7 @@ public class ArticleDao {
		sql.addVar("@Condition", param.toString());
		sql.addVar("@Condition2", param2.toString());
		sql.addVar("@PageParam", pageParam.toString());
		System.out.printf("queryArticleAPPList:"+sql.toString());
		List<Article> list = DB.me().queryForBeanList(MyDatabaseEnum.JkEduDB, sql,Article.class);
		return list;
//		Category temp = null;

+ 1 - 0
edu-article/JkEdu/src/com/yihu/jk/dao/ArticleQRCodeDao.java

@ -93,6 +93,7 @@ public class ArticleQRCodeDao {
		param.append(" and OperatorRoleLevel = ? ");
		sql.addParamValue(vo.getOperatorRoleLevel() );
		sql.addVar("@Condition", param.toString());
		System.out.printf("getArticleQRDetail:"+sql.toString());
		ArticleQR articleQRCode = DB.me().queryForBean(MyDatabaseEnum.JkEduDB, sql,ArticleQR.class);
		return articleQRCode;
	}

+ 44 - 2
patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/activemq/HealthArtListener.java

@ -21,6 +21,8 @@ import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.MessageListener;
import javax.jms.TextMessage;
import java.util.Date;
import java.util.List;
/**
 * Created by chenweida on 2017/9/9.
@ -45,8 +47,48 @@ public class HealthArtListener implements MessageListener {
    public void onMessage(Message message) {
        try {
            TextMessage textMessage = (TextMessage) message;
            HealthEduArticleES healthEduArticleES = (HealthEduArticleES)JSONObject.toBean(JSONObject.fromObject(textMessage.getText()),HealthEduArticleES.class);
            HealthEduArticleES healthEduArticleES = new HealthEduArticleES();
            JSONObject obj = JSONObject.fromObject(textMessage.getText());
            healthEduArticleES.setBatchNo(obj.get("batchNo")!=null?obj.get("batchNo").toString():null);
            healthEduArticleES.setPatientCode(obj.get("patientCode")!=null?obj.get("patientCode").toString():null);
            healthEduArticleES.setPatientName(obj.get("patientName")!=null?obj.get("patientName").toString():null);
            healthEduArticleES.setDoctorCode(obj.get("doctorCode")!=null?obj.get("doctorCode").toString():null);
            healthEduArticleES.setDoctorName(obj.get("doctorName")!=null?obj.get("doctorName").toString():null);
            healthEduArticleES.setSendPic(obj.get("sendPic")!=null?obj.get("sendPic").toString():null);
            healthEduArticleES.setSendSex(obj.get("sendSex")!=null?obj.get("sendSex").toString():null);
            healthEduArticleES.setAdminTeamCode(obj.get("adminTeamCode")!=null?(Long)obj.get("adminTeamCode"):null);
            healthEduArticleES.setAdminTeamName(obj.get("adminTeamName")!=null?obj.get("adminTeamCode").toString():null);
            healthEduArticleES.setHospital(obj.get("hospital")!=null?obj.get("hospital").toString():null);
            healthEduArticleES.setHospitalName(obj.get("hospitalName")!=null?obj.get("hospitalName").toString():null);
            healthEduArticleES.setTown(obj.get("town")!=null?obj.get("town").toString():null);
            healthEduArticleES.setTownName(obj.get("townName")!=null?obj.get("townName").toString():null);
            healthEduArticleES.setCreateTime(obj.get("createTime")!=null?(Date)obj.get("createTime"):null);
            healthEduArticleES.setSendType(obj.get("sendType")!=null?(Integer)obj.get("sendType"):null);
            healthEduArticleES.setSendLevel(obj.get("sendLevel")!=null?obj.get("sendLevel").toString():null);
            healthEduArticleES.setArticleId(obj.get("articleId")!=null?obj.get("articleId").toString():null);
            healthEduArticleES.setArticleTitle(obj.get("articleTitle")!=null?obj.get("articleTitle").toString():null);
            healthEduArticleES.setArticleCover(obj.get("articleCover")!=null?obj.get("articleCover").toString():null);
            healthEduArticleES.setArticleContent(obj.get("articleContent")!=null?obj.get("articleContent").toString():null);
            healthEduArticleES.setArticleCategoryId(obj.get("articleCategoryId")!=null?obj.get("articleCategoryId").toString():null);
            healthEduArticleES.setFirstLevelCategoryId(obj.get("firstLevelCategoryId")!=null?obj.get("firstLevelCategoryId").toString():null);
            healthEduArticleES.setFirstLevelCategoryName(obj.get("firstLevelCategoryName")!=null?obj.get("firstLevelCategoryName").toString():null);
            healthEduArticleES.setSecondLevelCategoryId(obj.get("secondLevelCategoryId")!=null?obj.get("secondLevelCategoryId").toString():null);
            healthEduArticleES.setSecondLevelCategoryName(obj.get("secondLevelCategoryName")!=null?obj.get("secondLevelCategoryName").toString():null);
            healthEduArticleES.setOperatorId(obj.get("operatorId")!=null?obj.get("operatorId").toString():null);
            healthEduArticleES.setIsRead(obj.get("isRead")!=null?(Integer)obj.get("isRead"):null);
            healthEduArticleES.setArticleSource(obj.get("articleSource")!=null?obj.get("articleSource").toString():null);
            healthEduArticleES.setRoleList(obj.get("roleList")!=null?(List)obj.get("roleList"):null);
            healthEduArticleES.setLeaveWords(obj.get("leaveWords")!=null?obj.get("leaveWords").toString():null);
            healthEduArticleES.setCurrentUserRoleCode(obj.get("currentUserRoleCode")!=null?obj.get("currentUserRoleCode").toString():null);
            healthEduArticleES.setCurrentUserRoleLevel(obj.get("currentUserRoleLevel")!=null?obj.get("currentUserRoleLevel").toString():null);
            healthEduArticleES.setSendSource(obj.get("sendSource")!=null?(Integer)obj.get("sendSource"):null);
            healthEduArticleES.setAllCount(obj.get("allCount")!=null?(Integer)obj.get("allCount"):null);
            healthEduArticleES.setReadNumber(obj.get("readNumber")!=null?(Long)obj.get("readNumber"):null);
            healthEduArticleES.setNewArricleFlag(obj.get("newArricleFlag")!=null?(Boolean)obj.get("newArricleFlag"):null);
            healthEduArticleES.setUserType(obj.get("userType")!=null?(Integer) obj.get("userType"):null);
//            HealthEduArticleES one = (HealthEduArticleES)JSONObject.toBean(JSONObject.fromObject(textMessage.getText()),HealthEduArticleES.class);
//            logger.info(jo.toString());
//            System.out.printf(healthEduArticleES.toString());
            sendWxTemplateAndIM(healthEduArticleES);
            //返回服务器表示消息消费成功
            message.acknowledge();
@ -73,7 +115,7 @@ public class HealthArtListener implements MessageListener {
                }
                // 推送消息给微信端
                org.json.JSONObject json = new org.json.JSONObject();
                json.put("first", patient.getName() + ",您好! " + one.getSendName() + (one.getSendType()==2 ? "卫计委":"医生") +"给您发来了一篇患教文章");
                json.put("first", patient.getName() + ",您好! " + one.getSendName() + (one.getSendType()==2 ? "":"医生") +"给您发来了一篇患教文章");
                json.put("toUser", patient.getCode());
                json.put("article", one.getArticleId() + "");
                json.put("title", one.getArticleTitle());

+ 1 - 1
patient-co/patient-co-wlyy-job/src/main/resources/application-devtest.yml

@ -105,7 +105,7 @@ activemq:
  password: admin
  url: tcp://172.19.103.87:61616
  queue:
    healtHarticleQueue: healthArticleChannel_devtest
    healtHarticleQueue: healthArticleChannel_test
  consumers:
    count: 10 #消费者集群数

+ 84 - 60
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/jimeiJkEdu/JMJkEduArticleService.java

@ -7,10 +7,12 @@ import com.yihu.es.entity.RoleVo;
import com.yihu.wlyy.config.es.ElasticFactory;
import com.yihu.wlyy.config.es.ElastricSearchSave;
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.patient.Patient;
import com.yihu.wlyy.repository.doctor.DoctorDao;
import com.yihu.wlyy.repository.doctor.DoctorRoleDao;
import com.yihu.wlyy.repository.patient.PatientDao;
import com.yihu.wlyy.service.BaseService;
import com.yihu.wlyy.service.app.account.DoctorInfoService;
@ -29,6 +31,7 @@ import io.searchbox.core.*;
import org.elasticsearch.index.query.BoolQueryBuilder;
import org.elasticsearch.index.query.QueryBuilders;
import org.elasticsearch.search.builder.SearchSourceBuilder;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.annotation.Transient;
@ -55,7 +58,7 @@ public class JMJkEduArticleService extends BaseService {
    private String esIndex;
    @Autowired
    private AdminTeamService adminTeamService;
    
    @Autowired
    private ElasticFactory elasticFactory;
    @Autowired
@ -80,6 +83,8 @@ public class JMJkEduArticleService extends BaseService {
    private SignPatientLabelInfoService signPatientLabelInfoService;
    @Autowired
    private DoctorInfoService doctorInfoService;
    @Autowired
    private DoctorRoleDao doctorRoleDao;
    /**
     *
@ -94,8 +99,8 @@ public class JMJkEduArticleService extends BaseService {
     */
    public List<HealthEduArticlePatientModel> pushArticleList(int page, int pagesize, String sendCode,  String firstLevelCategoryId,String secondLevelCategoryId,Integer myArticle,Integer sendType,String currentUserRole,
                                                              String currentUserRoleLevel,String articleTitle,String sendTimeStart,String sendTimeEnd) throws Exception {
        pagesize = page * pagesize;
        page = (page - 1) * pagesize;
//        pagesize = page * pagesize;
//        page = (page - 1) ;
//        if(loginType==2){
//
//            String sql = "select r.code as roleCode from wlyy_user_role u " +
@ -138,16 +143,19 @@ public class JMJkEduArticleService extends BaseService {
        HealthEduArticlePatientModel heapm = null;
        JSONObject article = null;
        Doctor doctor = null;
    
        List<HealthEduArticlePatientModel> resultList = new ArrayList<>();
        
        StringBuffer sql3 = null;
        for (HealthEduArticleES one : esList) {
            article = thirdJkEduArticleService.getArticalById(one.getArticleId(),"");
//            if (result.get(one.getArticleId()) != null) {
//                heapm = result.get(one.getArticleId());
//
//            } else {
                heapm = new HealthEduArticlePatientModel();
            heapm = new HealthEduArticlePatientModel();
//            }
            heapm.setSendName(one.getSendName());
            heapm.setSendCode(one.getDoctorCode());
@ -163,6 +171,15 @@ public class JMJkEduArticleService extends BaseService {
            heapm.setLevel2TypeName(one.getSecondLevelCategoryName());
            heapm.setLevel(article.getString("articlelevel"));
//            heapm.setAllCount(heapm.getAllCount() + one.getPatients().size());
            sql3 = new StringBuffer();
            sql3.append("SELECT COUNT(*) as num FROM "+esType+" WHERE isRead='1' AND batchNo = '"+one.getBatchNo()+"' AND patientCode is not null AND articleId='"+article.getString("articleId")+"'");
            Long num = elasticsearchUtil.excuteForLong(sql3.toString(), esType, esIndex);
            if(num!=null){
                heapm.setReadNumber(num.longValue());
            }else{
                heapm.setReadNumber(0L);
            }
            if(!StringUtils.isEmpty(article.getString("browseNumber"))){
                heapm.setBrowseNumbere(Integer.valueOf(article.getString("browseNumber")));//文章浏览数
            }else{
@ -173,7 +190,7 @@ public class JMJkEduArticleService extends BaseService {
            }else{
                heapm.setCommentNumber(0);//文章评论数
            }
            
            if(!StringUtils.isEmpty(article.getString("pointNumber"))){
                heapm.setPointNumber(Integer.valueOf(article.getString("pointNumber")));//文章点赞数
            }else{
@ -185,7 +202,7 @@ public class JMJkEduArticleService extends BaseService {
            }else{
                heapm.setCollectionNumber(0);//文章点赞数
            }
            
            heapm.setArticleCover(article.getString("articleCover"));//封面
            if(article.getString("insertTime")!=null){
                heapm.setComputeTime(computeTime(article.getString("insertTime")));
@ -212,7 +229,7 @@ public class JMJkEduArticleService extends BaseService {
     * @throws Exception
     */
    public List<HealthEduArticleES> pushArticleListCount(String sendCode,  String firstLevelCategoryId,String secondLevelCategoryId,Integer myArticle,Integer sendType,String currentUserRole,
                                                              String currentUserRoleLevel,String articleTitle,String sendTimeStart,String sendTimeEnd) throws Exception {
                                                         String currentUserRoleLevel,String articleTitle,String sendTimeStart,String sendTimeEnd) throws Exception {
        StringBuffer sql2 = new StringBuffer("select * from   " + esType +
                " where  doctorCode='" + sendCode + "' and userType = 2" );
@ -432,15 +449,15 @@ public class JMJkEduArticleService extends BaseService {
     */
    @Transactional
    public List<HealthEduArticleES> savePCPushArticle(Set<String> patientSet,
                                                     String sendCode,
                                                      String sendCode,
//                                                  String sendName,
                                                     Integer sendType,
                                                     String sendMessage,
                                                     Long teamId,
                                                     String articleId,
                                                     String leaveWords,
                                                     String currentUserRoleCode,
                                                     String currentUserRoleLevel) throws Exception {
                                                      Integer sendType,
                                                      String sendMessage,
                                                      Long teamId,
                                                      String articleId,
                                                      String leaveWords,
                                                      String currentUserRoleCode,
                                                      String currentUserRoleLevel) throws Exception {
//        String batchNo = UUID.randomUUID().toString();
@ -504,7 +521,6 @@ public class JMJkEduArticleService extends BaseService {
//        healthEduArticlePatient.setBatchNo(batchNo);
//        healthEduArticlePatient.setCreateTime(new Date());
//
//
//        //通过文章id 获取文章详情
//        JSONObject article = thirdJkEduArticleService.getArticalById(articleId,"");
//
@ -532,34 +548,41 @@ public class JMJkEduArticleService extends BaseService {
        Patient one = null;
        String batchNo = UUID.randomUUID().toString();
        String sendName = "";
        List<DoctorRole> roleList = doctorRoleDao.findUserRole(sendCode);
        if(sendType==2){
            String resultSql ="";
            String whereSql ="";
            switch (currentUserRoleLevel){
                case "1":{resultSql +=" DISTINCT (province_name) as name";
                    whereSql+=" and province ='"+currentUserRoleCode+"'";break;}
                case "2":{resultSql +=" DISTINCT (city_name) as name";
                    whereSql+=" and city ='"+currentUserRoleCode+"'";break;}
                case "3":{resultSql +=" DISTINCT (town_name) as name";
                    whereSql+=" and town ='"+currentUserRoleCode+"'";break;}
                case "4":{resultSql +=" DISTINCT (name) as name";
                    whereSql+=" and code ='"+currentUserRoleCode+"'";break;}
//            String resultSql ="";
//            String whereSql ="";
//            switch (currentUserRoleLevel){
//                case "1":{resultSql +=" DISTINCT (province_name) as name";
//                    whereSql+=" and province ='"+currentUserRoleCode+"'";break;}
//                case "2":{resultSql +=" DISTINCT (city_name) as name";
//                    whereSql+=" and city ='"+currentUserRoleCode+"'";break;}
//                case "3":{resultSql +=" DISTINCT (town_name) as name";
//                    whereSql+=" and town ='"+currentUserRoleCode+"'";break;}
//                case "4":{resultSql +=" DISTINCT (name) as name";
//                    whereSql+=" and code ='"+currentUserRoleCode+"'";break;}
//            }
//            String sql = "select "+resultSql+" from dm_hospital  where level=2 "+whereSql ;
//            List<Map<String, Object>> returnList = jdbcTemplate.queryForList(sql);
//            sendName = returnList.get(0).get("name")+"";
            //通过当前的登陆角色获取角色名称
            for(DoctorRole ones :roleList){
                if(ones.getCode().equals(currentUserRoleCode)){
                    if(currentUserRoleCode.length()==6&&!currentUserRoleCode.endsWith("00")){
                        sendName =  ones.getName()+"卫生和计划生育局";
                    }else{
                        sendName =  ones.getName();
                    }
                    break;
                }
            }
            String sql = "select "+resultSql+" from dm_hospital  where level=2 "+whereSql ;
            List<Map<String, Object>> returnList = jdbcTemplate.queryForList(sql);
            sendName = returnList.get(0).get("name")+"";
        }
        Map<String,Object> resultMap = labelService.fetchUserHighestAuthority(sendCode);
        List<RoleVo> roleVoLists= new ArrayList<>();
        if(resultMap.containsKey("roleList") && resultMap.get("roleList") != null){
            List<String> roleList = (List<String>)resultMap.get("roleList");
            for(String temp:roleList){
                RoleVo roleVo = new RoleVo();
                roleVo.setCode(temp);
                roleVoLists.add(roleVo);
            }
        for(DoctorRole ones :roleList){
            RoleVo roleVo = new RoleVo();
            roleVo.setCode(ones.getCode());
            roleVoLists.add(roleVo);
        }
        JSONObject article = thirdJkEduArticleService.getArticalById(articleId,"");
        Date createTime = new Date();
        for (String patient : patientSet) {
@ -623,7 +646,9 @@ public class JMJkEduArticleService extends BaseService {
        //保存到ES中
        elastricSearchSave.save(healthEduArticleESList, esIndex, esType);
        HealthEduArticleES e = healthEduArticleESList.get(0);
        HealthEduArticleES e = new HealthEduArticleES();
        BeanUtils.copyProperties(healthEduArticleESList.get(0),e);
        e.setUserType(2);
        e.setPatientCode(null);
        e.setPatientName(null);
@ -732,14 +757,14 @@ public class JMJkEduArticleService extends BaseService {
        if (!StringUtils.isEmpty(labelHealth) || !StringUtils.isEmpty(labelDisease)) {
            tableSql += " left join wlyy_sign_patient_label_info l on w.patient=l.patient ";
            whereSql += " and l.status=1 ";
    
            if (!StringUtils.isEmpty(labelHealth) && !StringUtils.isEmpty(labelDisease)) {
                whereSql += " and ( (l.label_type = 2 AND l.label in (" + labelHealth + ") ) or (l.label_type = 3 AND l.label in (" + labelDisease + ") ))";
            }else {
                if(!StringUtils.isEmpty(labelHealth)){
                    whereSql += " and (l.label_type = 2 AND l.label in (" + labelHealth + "))";
                }
                
                if(!StringUtils.isEmpty(labelDisease)){
                    whereSql += " and (l.label_type = 3 AND l.label in (" + labelDisease + "))";
                }
@ -756,7 +781,7 @@ public class JMJkEduArticleService extends BaseService {
//        if (!StringUtils.isEmpty(labelHealth) || !StringUtils.isEmpty(labelDisease)) {
//            whereSql += ")";
//        }
        
        tableSql += " left join wlyy_patient p on p.code=w.patient AND p.openid IS NOT NULL and p.openid <>''";
        if (!StringUtils.isEmpty(labelSex)) {
            whereSql += " and p.sex in (" + labelSex + ") ";
@ -1036,10 +1061,10 @@ public class JMJkEduArticleService extends BaseService {
//        }
//        patientSet.addAll(resultList);
//    }
    
    
    public void readAllArticle(String patient)throws Exception{
    
//        JestClient jestClient = null;
//
//        try {
@ -1081,16 +1106,16 @@ public class JMJkEduArticleService extends BaseService {
//        for (HealthEduArticlePatient healthEduArticlePatient: esList) {
//            healthEduArticlePatient.setIsread("1");
//        }
        
    }
    
    /**
     * 一键修改居民推送文章的文章为已读
     * @param patient
     */
    public void readAllArticleNew(String patient,String firstLevelCategoryId){
        JestClient jestClient = null;
    
        try {
            jestClient = elasticFactory.getJestClient();
            SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder();
@ -1125,7 +1150,7 @@ public class JMJkEduArticleService extends BaseService {
            }
        }
    }
    
    /**
     * 居民单条文章增加已读状态
     * @param patient
@ -1133,7 +1158,7 @@ public class JMJkEduArticleService extends BaseService {
     */
    public void readPatientArticle(String patient,String articleId){
        JestClient jestClient = null;
        
        try {
            jestClient = elasticFactory.getJestClient();
            SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder();
@ -1167,23 +1192,22 @@ public class JMJkEduArticleService extends BaseService {
            }
        }
    }
    
    public JSONArray pushArticleLogs(int page, int pagesize, String patientCode,String level1Type) throws Exception {
        page = (page - 1) * pagesize;
        String sql = "SELECT * FROM " + esType + "  where patientCode= '" + patientCode + "' and userType = 1";
        
        if(!StringUtils.isEmpty(level1Type)){
            sql= sql + " and firstLevelCategoryId = '"+level1Type+"' ";
        }
        sql += " order by createTime desc ";
        if(pagesize !=0){
            sql= sql+  " limit " + page + "," + pagesize;
        }
        
        List<HealthEduArticleES> esList = elasticsearchUtil.excute(sql, HealthEduArticleES.class, esIndex, esType);
        HealthEduArticlePatientModel heapm = null;
        JSONObject article = null;
@ -1281,7 +1305,7 @@ public class JMJkEduArticleService extends BaseService {
     * @throws Exception
     */
    public JSONObject queryArticlePcList(String firstLevelCategoryId, String secondLevelCategoryId, String insertTimeStart, String insertTimeEnd, String articlelevel, String articleTitle,
                                          String userCode, String currentUserRole, String currentUserRoleLevel, String isAuthentication, Boolean isMyArticle, Integer page, Integer pageSize,Integer sEcho,Integer roleType) throws Exception{
                                         String userCode, String currentUserRole, String currentUserRoleLevel, String isAuthentication, Boolean isMyArticle, Integer page, Integer pageSize,Integer sEcho,Integer roleType) throws Exception{
        return thirdJkEduArticleService.queryArticlePcList(firstLevelCategoryId,secondLevelCategoryId,insertTimeStart,insertTimeEnd,articlelevel,isMyArticle,
                articleTitle,userCode,isAuthentication,currentUserRole,currentUserRoleLevel,page,pageSize,sEcho,roleType);
    }
@ -1300,7 +1324,7 @@ public class JMJkEduArticleService extends BaseService {
     * @throws Exception
     */
    public JSONObject queryArticleAPPList(String firstLevelCategoryId, String secondLevelCategoryId, String insertTimeStart, String insertTimeEnd, String articlelevel, String articleTitle,
                                         String userCode, String currentUserRole, String currentUserRoleLevel, String isAuthentication, Boolean isMyArticle, Integer page, Integer pageSize,Integer roleType) throws Exception{
                                          String userCode, String currentUserRole, String currentUserRoleLevel, String isAuthentication, Boolean isMyArticle, Integer page, Integer pageSize,Integer roleType) throws Exception{
        return thirdJkEduArticleService.queryArticleAPPList(firstLevelCategoryId,secondLevelCategoryId,insertTimeStart,insertTimeEnd,articlelevel,isMyArticle,
                articleTitle,userCode,isAuthentication,currentUserRole,currentUserRoleLevel,page,pageSize,roleType);
    }
@ -1322,7 +1346,7 @@ public class JMJkEduArticleService extends BaseService {
     * @throws Exception
     */
    public JSONObject authenArticlePCList(String firstLevelCategoryId, String secondLevelCategoryId, String insertTimeStart, String insertTimeEnd, String articleTitle,
                                         String currentUserRole, String currentUserRoleLevel, String isAuthentication,Integer page, Integer pageSize,Integer sEcho) throws Exception{
                                          String currentUserRole, String currentUserRoleLevel, String isAuthentication,Integer page, Integer pageSize,Integer sEcho) throws Exception{
        return thirdJkEduArticleService.authenArticlePCList(firstLevelCategoryId,secondLevelCategoryId,insertTimeStart,insertTimeEnd,
                articleTitle,isAuthentication,currentUserRole,currentUserRoleLevel,page,pageSize,sEcho);
    }

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

@ -6,10 +6,12 @@ import com.alibaba.fastjson.JSONObject;
import com.yihu.es.entity.HealthEduArticlePatient;
import com.yihu.wlyy.entity.doctor.profile.Doctor;
import com.yihu.wlyy.entity.doctor.profile.DoctorRole;
import com.yihu.wlyy.entity.organization.Hospital;
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.organization.HospitalDao;
import com.yihu.wlyy.repository.organization.HospitalMappingDao;
import com.yihu.wlyy.repository.patient.PatientDao;
import com.yihu.wlyy.service.BaseService;
@ -68,7 +70,9 @@ public class ThirdJkEduArticleService extends BaseService {
    private HospitalMappingDao hospitalMappingDao;
    @Autowired
    private DoctorRoleDao doctorRoleDao;
    
    @Autowired
    private HospitalDao hospitalDao;
    //    private String baseUrl = "http://service.yihu.com:8085/WsPlatform/rest";
//    private String baseUrl = "http://172.17.110.230:83/WsPlatform/rest";
//    private String baseUrl = articleBaseUrl+"/WsPlatform/rest";
@ -404,8 +408,8 @@ public class ThirdJkEduArticleService extends BaseService {
     * @throws Exception
     */
    public void 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 {
                            String	secondLevelCategoryName,String firstLevelCategoryId,String firstLevelCategoryName,String content,
                            String operatorRoleCode,String opertorRoleLevel,Integer userScope,Integer isAuthentication,String articleId,Integer roleType) throws Exception {
        String response = "";
        JSONObject json = null;
@ -435,29 +439,37 @@ public class ThirdJkEduArticleService extends BaseService {
            param.put("firstLevelCategoryName", firstLevelCategoryName);
            param.put("content", content);
            param.put("newUrl", newUrl);
            Hospital hospital = hospitalDao.findByCode(operatorRoleCode);
            if(hospital!=null&&hospital.getLevel()==3){
                operatorRoleCode = hospital.getTown();
            }
            param.put("operatorRoleCode", operatorRoleCode);
            param.put("opertorRoleLevel", opertorRoleLevel);
            param.put("userScope", userScope);
            param.put("roleType", roleType);
            param.put("isAuthentication", isAuthentication);
//            if(isAuthentication==1){
                String operatorRoleCodeName = "";//认证机构的名称
                List<DoctorRole> roleList = doctorRoleDao.findUserRole(userCode);
                if(roleList.isEmpty()){
                    operatorRoleCodeName = doctor.getHospitalName();
                }else{
                    HashMap<String,String> rolemap = new HashMap<>();
                    for (DoctorRole doctorRole:roleList) {
                        rolemap.put(doctorRole.getCode(),doctorRole.getName());
                    }
                    if(rolemap.keySet().contains(operatorRoleCode)){
                        operatorRoleCodeName =  rolemap.get(operatorRoleCode);
            String operatorRoleCodeName = "";//认证机构的名称
            List<DoctorRole> roleList = doctorRoleDao.findUserRole(userCode);
            if(roleList.isEmpty()){
                operatorRoleCodeName = doctor.getHospitalName();
            }else{
                HashMap<String,String> rolemap = new HashMap<>();
                for (DoctorRole doctorRole:roleList) {
                    rolemap.put(doctorRole.getCode(),doctorRole.getName());
                }
                if(rolemap.keySet().contains(operatorRoleCode)){
                    if(operatorRoleCode.length()==6&&!operatorRoleCode.endsWith("00")){
                        operatorRoleCodeName =  rolemap.get(operatorRoleCode)+"卫生和计划生育局";
                    }else{
                        operatorRoleCodeName = doctor.getHospitalName();
                        operatorRoleCodeName =  rolemap.get(operatorRoleCode);
                    }
                }else{
                    operatorRoleCodeName = doctor.getHospitalName();
                }
                param.put("authentication", operatorRoleCodeName);
                param.put("authenticationId", userCode);
            }
            param.put("authentication", operatorRoleCodeName);
            param.put("authenticationId", userCode);
//            }
            response = httpClientUtil.httpPost(articleBaseUrl+"/WsPlatform/rest", getParamsMap(saveArticle, param.toString(), "1"));
            json = JSON.parseObject(response);
@ -487,7 +499,7 @@ public class ThirdJkEduArticleService extends BaseService {
     * @throws Exception
     */
    public JSONObject queryArticlePcList(String firstLevelCategoryId,String secondLevelCategoryId,String insertTimeStart,String insertTimeEnd,String articlelevel,Boolean isMyArticle,
                                        String articleTitle,String userCode,String isAuthentication,String currentUserRole,String currentUserRoleLevel,Integer page,Integer pageSize,Integer sEcho,Integer roleType) throws Exception {
                                         String articleTitle,String userCode,String isAuthentication,String currentUserRole,String currentUserRoleLevel,Integer page,Integer pageSize,Integer sEcho,Integer roleType) throws Exception {
        String response = "";
        JSONObject json = null;
@ -501,6 +513,11 @@ public class ThirdJkEduArticleService extends BaseService {
            param.put("articleTitle", articleTitle);
            param.put("userCode", userCode);
            param.put("isAuthentication", isAuthentication);
            Hospital hospital = hospitalDao.findByCode(currentUserRole);
            if(hospital!=null&&hospital.getLevel()==3){
                currentUserRole = hospital.getTown();
            }
            param.put("currentUserRole", currentUserRole);
            param.put("currentUserRoleLevel", currentUserRoleLevel);
            param.put("page", page+"");
@ -536,7 +553,7 @@ public class ThirdJkEduArticleService extends BaseService {
     * @throws Exception
     */
    public JSONObject queryArticleAPPList(String firstLevelCategoryId,String secondLevelCategoryId,String insertTimeStart,String insertTimeEnd,String articlelevel,Boolean isMyArticle,
                                         String articleTitle,String userCode,String isAuthentication,String currentUserRole,String currentUserRoleLevel,Integer page,Integer pageSize,Integer roleType) throws Exception {
                                          String articleTitle,String userCode,String isAuthentication,String currentUserRole,String currentUserRoleLevel,Integer page,Integer pageSize,Integer roleType) throws Exception {
        String response = "";
        JSONObject json = null;
@ -550,6 +567,11 @@ public class ThirdJkEduArticleService extends BaseService {
            param.put("articleTitle", articleTitle);
            param.put("userCode", userCode);
            param.put("isAuthentication", isAuthentication);
            Hospital hospital = hospitalDao.findByCode(currentUserRole);
            if(hospital!=null&&hospital.getLevel()==3){
                currentUserRole = hospital.getTown();
            }
            param.put("currentUserRole", currentUserRole);
            param.put("currentUserRoleLevel", currentUserRoleLevel);
            param.put("page", page+"");
@ -585,7 +607,7 @@ public class ThirdJkEduArticleService extends BaseService {
     * @throws Exception
     */
    public JSONObject authenArticlePCList(String firstLevelCategoryId,String secondLevelCategoryId,String insertTimeStart,String insertTimeEnd,
                                         String articleTitle,String isAuthentication,String currentUserRole,String currentUserRoleLevel,Integer page,Integer pageSize,Integer sEcho) throws Exception {
                                          String articleTitle,String isAuthentication,String currentUserRole,String currentUserRoleLevel,Integer page,Integer pageSize,Integer sEcho) throws Exception {
        String response = "";
        JSONObject json = null;
@ -597,6 +619,10 @@ public class ThirdJkEduArticleService extends BaseService {
            param.put("insertTimeEnd", insertTimeEnd);
            param.put("articleTitle", articleTitle);
            param.put("isAuthentication", isAuthentication);
            Hospital hospital = hospitalDao.findByCode(currentUserRole);
            if(hospital!=null&&hospital.getLevel()==3){
                currentUserRole = hospital.getTown();
            }
            param.put("currentUserRole", currentUserRole);
            param.put("currentUserRoleLevel", currentUserRoleLevel);
            param.put("page", page+"");
@ -852,7 +878,7 @@ public class ThirdJkEduArticleService extends BaseService {
     * @throws Exception
     */
    public void updateArticleQRCode(String currentRoleLevel,String currentRoleCode,String imgUrl,Integer position,String userId,String userName,
                                          String orgId,String orgName,Integer id,String identification) throws Exception {
                                    String orgId,String orgName,Integer id,String identification) throws Exception {
        JSONObject json = null;
        try{
@ -879,7 +905,7 @@ public class ThirdJkEduArticleService extends BaseService {
    }
    public void saveArticleQRCode(String currentRoleLevel,String currentRoleCode,String imgUrl,Integer position,String userId,String userName,
                                          String orgId,String orgName,String identification) throws Exception {
                                  String orgId,String orgName,String identification) throws Exception {
        JSONObject json = null;
        try{
            JSONObject param = new JSONObject();
@ -923,14 +949,23 @@ public class ThirdJkEduArticleService extends BaseService {
    /**************************************************** behaver *******************************************************/
    public void saveBehavior(String articleId,String cName,String userId) throws Exception {
    public void saveBehavior(String articleId,String userId,Integer behaviorAction,Integer number) throws Exception {
        JSONObject json = null;
        try{
            JSONObject param = new JSONObject();
            param.put("articleId",articleId);// 文章ID
            Patient patient = patientDao.findByCode(userId);
            Doctor doctor = doctorDao.findByCode(userId);
            String cName = "";
            if(patient!=null){
                cName = patient.getName();
            }else if(doctor!=null){
                cName = doctor.getName();
            }
            param.put("cName",cName);//用户名称
            param.put("userId",userId);//用户ID
            param.put("behaviorAction",behaviorAction);//用户
            param.put("number",number);//用户
            String response = httpClientUtil.httpPost(articleBaseUrl+"/WsPlatform/rest", getParamsMap(saveBehavior, param.toString(), "1"));
            json = JSON.parseObject(response);
        }catch (Exception e) {

+ 4 - 4
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/util/ElasticsearchUtil.java

@ -113,7 +113,7 @@ public class ElasticsearchUtil {
                            if (heads.get(i).contains("date_histogram")) {
                                key = "setQuotaDate";
                            }
                            
                            try {
                                //yyyy-MM-dd'T'HH:mm:ssXX
                                value = dateFormat.parse(String.valueOf(one.get(i)));
@ -127,12 +127,12 @@ public class ElasticsearchUtil {
                                        Date date = new Date();
                                        date = ts;
                                        value =date;
                                    
                                    } catch (Exception e2) {
                                        value = String.valueOf(one.get(i));
                                    }
                                }
                                
                            }
//                            value = DateUtil.strToDate(String.valueOf(value).replace("T00:00:00+0800", " 00:00:00"), "yyyy-MM-dd HH:mm:ss");
                        }
@ -184,7 +184,7 @@ public class ElasticsearchUtil {
            }
            SearchResponse response = (SearchResponse) requestBuilder.get();
            ObjectResult temp = new ObjectResultsExtractor(true, true, true).extractResults(response.getAggregations(), true);
            Long Longvalue = ((Double) temp.getLines().get(0).get(1)).longValue();
            Long Longvalue = ((Double) temp.getLines().get(0).get(0)).longValue();
            return Longvalue;
        } catch (Exception e) {
            logger.error(e.getMessage());

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

@ -2,6 +2,8 @@ package com.yihu.wlyy.web;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.wlyy.entity.IdEntity;
import com.yihu.wlyy.entity.organization.Hospital;
import com.yihu.wlyy.repository.organization.HospitalDao;
import com.yihu.wlyy.util.DateUtil;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
@ -32,6 +34,8 @@ public class BaseController {
    @Autowired
    protected HttpServletRequest request;
    @Autowired
    private HospitalDao hospitalDao;
    /**
     * 獲取髮送請求用戶的uid
@ -191,7 +195,15 @@ public class BaseController {
                userAgent = request.getHeader("User-Agent");
            }
            JSONObject json = new JSONObject(userAgent);
            return json.getJSONObject("currentUserRole").getString("code");
            String currentUserRole = json.getJSONObject("currentUserRole").getString("code");
            if(StringUtils.isNotEmpty(currentUserRole)){
                Hospital hospital = hospitalDao.findByCode(currentUserRole);
                if(hospital!=null&&hospital.getLevel()==3){
                    return hospital.getTown();
                }
            }
            return currentUserRole;
        } catch (Exception e) {
            return null;
        }

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

@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONObject;
import com.yihu.es.entity.HealthEduArticleES;
import com.yihu.wlyy.service.app.health.HealthEduArticleLabelService;
import com.yihu.wlyy.service.jimeiJkEdu.JMJkEduArticleService;
import com.yihu.wlyy.util.ElasticsearchUtil;
import com.yihu.wlyy.web.BaseController;
import com.yihu.wlyy.web.third.gateway.vo.HealthEduArticlePatientModel;
import io.swagger.annotations.Api;
@ -33,6 +34,12 @@ public class DoctorJMJkEduArticlePCController extends BaseController {
    String fastdfs_file_url;
    @Value("${neiwang.enable}")
    private Boolean isneiwang = false;  //如果不是内网项目要转到到内网wlyy在上传
    @Value("${es.type.HealthEduArticlePatient}")
    private String esType;
    @Value("${es.index.HealthEduArticlePatient}")
    private String esIndex;
    @Autowired
    private ElasticsearchUtil elasticsearchUtil;
    @Autowired
    private HealthEduArticleLabelService healthEduArticleLabelService;
@ -144,7 +151,8 @@ public class DoctorJMJkEduArticlePCController extends BaseController {
            if(StringUtils.isNotBlank(patient)){
                com.alibaba.fastjson.JSONArray pushresponse = jmJkEduArticleService.pushArticleLogs(0,0,patient,"");
                Set<String> articleids = new HashSet<>();
                if(pushresponse.size() > 0){
                if(pushresponse.size() > 0)
                {
                    for (int i = 0; i < pushresponse.size(); i++) {
                        articleids.add(pushresponse.getJSONObject(i).getString("articleId"));
                    }
@ -279,9 +287,9 @@ public class DoctorJMJkEduArticlePCController extends BaseController {
            if(StringUtils.isEmpty(currentRoleLevel)){
                currentRoleLevel = getCurrentRoleLevel();
            }
            if(page == 0){
                page ++;
            }
//            if(page == 0){
//                page ++;
//            }
            List<HealthEduArticlePatientModel> eduArticlePatients = jmJkEduArticleService.pushArticleList(page, pagesize, getUID(),firstLevelCategoryId,secondLevelCategoryId,myArticle,sendType,currentRoleCode,currentRoleLevel,articleTitle,sendTimeStart,sendTimeEnd);
//            Long count = jmJkEduArticleService.pushArticleListCount(getUID(),2);
            List<HealthEduArticleES> eduArticlePatientsCount = jmJkEduArticleService.pushArticleListCount( getUID(),firstLevelCategoryId,secondLevelCategoryId,myArticle,sendType,currentRoleCode,

+ 2 - 3
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/jimeiJkEdu/PatientJMJkEduArticleController.java

@ -191,10 +191,9 @@ public class PatientJMJkEduArticleController extends BaseController {
    @ApiOperation("添加 浏览、转发、分享、点赞 ")
    public String saveBehavior(
            @ApiParam(name = "articleId", value = "文章ID", required = true) @RequestParam(value = "articleId", required = true) String articleId,
            @ApiParam(name = "cName", value = "用户名称", required = true) @RequestParam(value = "cName", required = true) String cName,
            @ApiParam(name = "userId", value = "用户ID", required = true) @RequestParam(value = "userId", required = false) String  userId){
            @ApiParam(name = "behaviorAction", value = "1、点赞 2、转发 3、分享 4、浏览 5、评论 6、收藏 7、发送", required = true) @RequestParam(value = "behaviorAction", required = true) Integer behaviorAction){
        try {
            thirdJkEduArticleService.saveBehavior(articleId,cName,userId);
            thirdJkEduArticleService.saveBehavior(articleId,getUID(),behaviorAction,null);
//            Long count = healthEducationArticleService.pushArticleLogsCount("ece5c665b16542b0847e52b4a9fee44a");
            return write(200,"保存成功!");
        }catch (Exception e) {

+ 170 - 170
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/third/gateway/controller/doctor/GcEduArticleController.java

@ -1,170 +1,170 @@
package com.yihu.wlyy.web.third.gateway.controller.doctor;
import com.yihu.es.entity.HealthEduArticlePatient;
import com.yihu.wlyy.entity.patient.Patient;
import com.yihu.wlyy.service.app.consult.ConsultService;
import com.yihu.wlyy.service.common.account.PatientService;
import com.yihu.wlyy.task.PushMsgTask;
import com.yihu.wlyy.web.WeixinBaseController;
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.BaseResultModel;
import com.yihu.wlyy.web.third.gateway.vo.base.ResultPageListModel;
import com.yihu.wlyy.wechat.util.WeiXinOpenIdUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.redis.core.StringRedisTemplate;
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.HashSet;
import java.util.List;
import java.util.Set;
/**
 * Created by chenweida on 2017/8/30...
 */
@Controller
@RequestMapping(value = "/wlyygc/doctor/edu/article", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
@ResponseBody
@Api(description = "医生文章相关服务")
public class GcEduArticleController extends WeixinBaseController {
    private Logger logger = LoggerFactory.getLogger(GcEduArticleController.class);
    @Autowired
    private WeiXinOpenIdUtils weiXinOpenIdUtils;
    @Autowired
    private PushMsgTask pushMsgTask;
    @Autowired
    private PatientService patientService;
    @Autowired
    private ConsultService consultService;
    @Autowired
    private GcEduArticleService gcEduArticleService;
    @Autowired
    private StringRedisTemplate redisTemplate;
    @Autowired
    private JmsTemplate jmsTemplate;
    @Value("${activemq.queue.healtHarticleQueue}")
    private String channelName;
    @Value("${jkEdu.web.articleBaseUrl}")
    private String articleBaseUrl;
    /**
     * 发送到redis
     *
     */
    public void sender(HealthEduArticlePatient healthEduArticlePatient) {
        //送到到队列
        List<Patient> patients = healthEduArticlePatient.getPatients();
        patients.stream().forEach(one -> {
            healthEduArticlePatient.setPatient(one.getCode());
            healthEduArticlePatient.setPatients(null);
            healthEduArticlePatient.setArticleUrl(articleBaseUrl+"JkEduWeb/web/jkEdu/articleDetail.html?behavior=4&articleId="+healthEduArticlePatient.getArticleId()+"&userId="+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(healthEduArticlePatient).toString());
                    return textMessage;
                }
            });
        });
    }
    /**PC端
     * @param doctorCode
     * @param page
     * @param pagesize
     * @return
     */
    @RequestMapping(value = "logs", method = RequestMethod.GET)
    @ApiOperation("查询医生给患者推送记录 ")
    public ResultPageListModel<HealthEduArticlePatientModel> getPatientHealthLogs(
            @ApiParam(name = "articleType", value = "文章类别", required = false) @RequestParam(value = "articleType", required = false) String articleType,
            @ApiParam(name = "level1Type", value = "一级分类", required = false) @RequestParam(value = "level1Type", required = false) String level1Type,
            @ApiParam(name = "level2Type", value = "二级分类", required = false) @RequestParam(value = "level2Type", required = false) String level2Type,
            @ApiParam(name = "level", value = "等级", required = false) @RequestParam(value = "level", required = false) String level,
            @ApiParam(name = "doctorCode", value = "医生code,为空从useragent取", required = false) @RequestParam(value = "doctorCode", required = false) String doctorCode,
            @ApiParam(name = "patientCode", value = "接收人code", required = false) @RequestParam(value = "patientCode", required = false) String patientCode,
            @ApiParam(name = "articleTitle", value = "文章标题", required = false) @RequestParam(value = "articleTitle", required = false) String articleTitle,
            @ApiParam(name = "startTime", value = "开始时间yyyy-Mm-dd", required = false) @RequestParam(value = "startTime", required = false) String startTime,
            @ApiParam(name = "endTime", value = "结束时间yyyy-Mm-dd", required = false) @RequestParam(value = "endTime", required = false) String endTime,
            @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) {
        try {
            if (org.springframework.util.StringUtils.isEmpty(doctorCode)) {
                doctorCode = getUID();
            }
            //最大1000
            if (pagesize > 1000) {
                pagesize = 1000;
            }
            List<HealthEduArticlePatientModel> eduArticlePatients = gcEduArticleService.getPatientHealthLogs(doctorCode, articleType, level1Type, level2Type, level, articleTitle, startTime, endTime, page, pagesize);
            Long count = gcEduArticleService.getPatientHealthLogsCount(getUID(), articleType, level1Type, level2Type, level, articleTitle, startTime, endTime);
            return new ResultPageListModel(
                    page,
                    pagesize,
                    count.intValue()
                    , eduArticlePatients);
        } catch (Exception e) {
            return new ResultPageListModel(BaseResultModel.statusEm.find_error.getCode(), BaseResultModel.statusEm.find_error.getMessage() + "," + e.getMessage());
        }
    }
    /**
     * * 参考原来的教育文章推送
     * http://172.19.103.88:9092/wlyy//doctor/health/edu/send?code=2e6467b5bb2f4b81b598633624d7f98e&patient=e911d1b756cd4680ab241ab76a463282&teamCode=1&attachedContent=
     *
     * @return
     */
    @RequestMapping(value = "send", method = RequestMethod.POST)
    @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
    ) {
        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);
            //获取保存发送记录
            HealthEduArticlePatient healthEduArticlePatients = gcEduArticleService.getSaveArticle(patientSet, sendCode, sendName, sendType, sendMessage, teamId, articleId);
            //推送微信模板消息和发送im消息
            new Thread(() -> {
                //发送任务到redis
                sender(healthEduArticlePatients);
            }).start();
            return new BaseResultModel();
        } catch (Exception e) {
            return new BaseResultModel(BaseResultModel.statusEm.opera_error.getCode(), BaseResultModel.statusEm.opera_error.getMessage() + ":" + e.getMessage());
        }
    }
}
//package com.yihu.wlyy.web.third.gateway.controller.doctor;
//
//import com.yihu.es.entity.HealthEduArticlePatient;
//import com.yihu.wlyy.entity.patient.Patient;
//import com.yihu.wlyy.service.app.consult.ConsultService;
//import com.yihu.wlyy.service.common.account.PatientService;
//import com.yihu.wlyy.task.PushMsgTask;
//import com.yihu.wlyy.web.WeixinBaseController;
//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.BaseResultModel;
//import com.yihu.wlyy.web.third.gateway.vo.base.ResultPageListModel;
//import com.yihu.wlyy.wechat.util.WeiXinOpenIdUtils;
//import io.swagger.annotations.Api;
//import io.swagger.annotations.ApiOperation;
//import io.swagger.annotations.ApiParam;
//import org.slf4j.Logger;
//import org.slf4j.LoggerFactory;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.beans.factory.annotation.Value;
//import org.springframework.data.redis.core.StringRedisTemplate;
//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.HashSet;
//import java.util.List;
//import java.util.Set;
//
///**
// * Created by chenweida on 2017/8/30...
// */
//@Controller
//@RequestMapping(value = "/wlyygc/doctor/edu/article", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
//@ResponseBody
//@Api(description = "医生文章相关服务")
//public class GcEduArticleController extends WeixinBaseController {
//    private Logger logger = LoggerFactory.getLogger(GcEduArticleController.class);
//
//    @Autowired
//    private WeiXinOpenIdUtils weiXinOpenIdUtils;
//    @Autowired
//    private PushMsgTask pushMsgTask;
//    @Autowired
//    private PatientService patientService;
//    @Autowired
//    private ConsultService consultService;
//    @Autowired
//    private GcEduArticleService gcEduArticleService;
//    @Autowired
//    private StringRedisTemplate redisTemplate;
//    @Autowired
//    private JmsTemplate jmsTemplate;
//    @Value("${activemq.queue.healtHarticleQueue}")
//    private String channelName;
//    @Value("${jkEdu.web.articleBaseUrl}")
//    private String articleBaseUrl;
//
//    /**
//     * 发送到redis
//     *
//     */
//    public void sender(HealthEduArticlePatient healthEduArticlePatient) {
//        //送到到队列
//        List<Patient> patients = healthEduArticlePatient.getPatients();
//        patients.stream().forEach(one -> {
//            healthEduArticlePatient.setPatient(one.getCode());
//            healthEduArticlePatient.setPatients(null);
//            healthEduArticlePatient.setArticleUrl(articleBaseUrl+"JkEduWeb/web/jkEdu/articleDetail.html?behavior=4&articleId="+healthEduArticlePatient.getArticleId()+"&userId="+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(healthEduArticlePatient).toString());
//                    return textMessage;
//                }
//            });
//        });
//    }
//
//    /**PC端
//     * @param doctorCode
//     * @param page
//     * @param pagesize
//     * @return
//     */
//    @RequestMapping(value = "logs", method = RequestMethod.GET)
//    @ApiOperation("查询医生给患者推送记录 ")
//    public ResultPageListModel<HealthEduArticlePatientModel> getPatientHealthLogs(
//            @ApiParam(name = "articleType", value = "文章类别", required = false) @RequestParam(value = "articleType", required = false) String articleType,
//            @ApiParam(name = "level1Type", value = "一级分类", required = false) @RequestParam(value = "level1Type", required = false) String level1Type,
//            @ApiParam(name = "level2Type", value = "二级分类", required = false) @RequestParam(value = "level2Type", required = false) String level2Type,
//            @ApiParam(name = "level", value = "等级", required = false) @RequestParam(value = "level", required = false) String level,
//            @ApiParam(name = "doctorCode", value = "医生code,为空从useragent取", required = false) @RequestParam(value = "doctorCode", required = false) String doctorCode,
//            @ApiParam(name = "patientCode", value = "接收人code", required = false) @RequestParam(value = "patientCode", required = false) String patientCode,
//            @ApiParam(name = "articleTitle", value = "文章标题", required = false) @RequestParam(value = "articleTitle", required = false) String articleTitle,
//            @ApiParam(name = "startTime", value = "开始时间yyyy-Mm-dd", required = false) @RequestParam(value = "startTime", required = false) String startTime,
//            @ApiParam(name = "endTime", value = "结束时间yyyy-Mm-dd", required = false) @RequestParam(value = "endTime", required = false) String endTime,
//            @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) {
//        try {
//            if (org.springframework.util.StringUtils.isEmpty(doctorCode)) {
//                doctorCode = getUID();
//            }
//            //最大1000
//            if (pagesize > 1000) {
//                pagesize = 1000;
//            }
//            List<HealthEduArticlePatientModel> eduArticlePatients = gcEduArticleService.getPatientHealthLogs(doctorCode, articleType, level1Type, level2Type, level, articleTitle, startTime, endTime, page, pagesize);
//            Long count = gcEduArticleService.getPatientHealthLogsCount(getUID(), articleType, level1Type, level2Type, level, articleTitle, startTime, endTime);
//            return new ResultPageListModel(
//                    page,
//                    pagesize,
//                    count.intValue()
//                    , eduArticlePatients);
//        } catch (Exception e) {
//            return new ResultPageListModel(BaseResultModel.statusEm.find_error.getCode(), BaseResultModel.statusEm.find_error.getMessage() + "," + e.getMessage());
//        }
//    }
//
//    /**
//     * * 参考原来的教育文章推送
//     * http://172.19.103.88:9092/wlyy//doctor/health/edu/send?code=2e6467b5bb2f4b81b598633624d7f98e&patient=e911d1b756cd4680ab241ab76a463282&teamCode=1&attachedContent=
//     *
//     * @return
//     */
//    @RequestMapping(value = "send", method = RequestMethod.POST)
//    @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
//    ) {
//        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);
//            //获取保存发送记录
//            HealthEduArticlePatient healthEduArticlePatients = gcEduArticleService.getSaveArticle(patientSet, sendCode, sendName, sendType, sendMessage, teamId, articleId);
//            //推送微信模板消息和发送im消息
//            new Thread(() -> {
//                //发送任务到redis
//                sender(healthEduArticlePatients);
//            }).start();
//            return new BaseResultModel();
//        } catch (Exception e) {
//            return new BaseResultModel(BaseResultModel.statusEm.opera_error.getCode(), BaseResultModel.statusEm.opera_error.getMessage() + ":" + e.getMessage());
//        }
//    }
//
//}

+ 23 - 13
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/third/gateway/vo/HealthEduArticlePatientModel.java

@ -41,6 +41,8 @@ public class HealthEduArticlePatientModel {
    private Integer commentNumber=0;//文章评论数
    @ApiModelProperty(value = "文章点赞数", required = false, access = "response")
    private Integer pointNumber=0;//文章点赞数
    @ApiModelProperty(value = "文章阅读数", required = false, access = "response")
    private Long readNumber=0L;//文章阅读数
    @ApiModelProperty(value = "封面图", required = false, access = "response")
    private String articleCover="";//封面图
    @ApiModelProperty(value = "发送类型", required = false, access = "response")
@ -53,7 +55,7 @@ public class HealthEduArticlePatientModel {
    private Integer collectionNumber;//收藏数
    @ApiModelProperty(value = "文章来源", required = false, access = "response")
    private String articleSource;//文章来源
    
    private String computeTime;//时间
    private String photo;//医生头像
    private String operatorName;//文章作者
@ -201,43 +203,43 @@ public class HealthEduArticlePatientModel {
    public void setOperatorName(String operatorName) {
        this.operatorName = operatorName;
    }
    
    public Integer getSendType() {
        return sendType;
    }
    
    public void setSendType(Integer sendType) {
        this.sendType = sendType;
    }
    
    public String getIsread() {
        return isread;
    }
    
    public void setIsread(String isread) {
        this.isread = isread;
    }
    
    public String getLeaveWords() {
        return leaveWords;
    }
    
    public void setLeaveWords(String leaveWords) {
        this.leaveWords = leaveWords;
    }
    
    public String getLevel1TypeName() {
        return level1TypeName;
    }
    
    public void setLevel1TypeName(String level1TypeName) {
        this.level1TypeName = level1TypeName;
    }
    
    public String getLevel2TypeName() {
        return level2TypeName;
    }
    
    public void setLevel2TypeName(String level2TypeName) {
        this.level2TypeName = level2TypeName;
    }
@ -249,12 +251,20 @@ public class HealthEduArticlePatientModel {
    public void setCollectionNumber(Integer collectionNumber) {
        this.collectionNumber = collectionNumber;
    }
    
    public String getArticleSource() {
        return articleSource;
    }
    
    public void setArticleSource(String articleSource) {
        this.articleSource = articleSource;
    }
    public Long getReadNumber() {
        return readNumber;
    }
    public void setReadNumber(Long readNumber) {
        this.readNumber = readNumber;
    }
}

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

@ -85,7 +85,7 @@ public class ThirdJkEduArticleController extends BaseController {
        try {
            com.alibaba.fastjson.JSONArray response = thirdJkEduArticleService.getCollectionArticalList(articleTitle,articleState,firstLevelCategoryId,pageIndex,pageSize,getRepUID(),userType,myArticle);
//            com.alibaba.fastjson.JSONArray response = thirdJkEduArticleService.getCollectionArticalList(articleTitle,articleState,firstLevelCategoryId,pageIndex,pageSize,"812f75071f434fde9a1fb64c6213a897",userType,myArticle);
    
            //判断文章列表是否有推送过该居民
            if(org.apache.commons.lang3.StringUtils.isNotBlank(patient)){
                com.alibaba.fastjson.JSONArray pushresponse = jmJkEduArticleService.pushArticleLogs(0,0,patient,"");
@ -95,7 +95,7 @@ public class ThirdJkEduArticleController extends BaseController {
                        articleids.add(pushresponse.getJSONObject(i).getString("articleId"));
                    }
                }
        
                if(response.size() > 0 && !articleids.isEmpty()){
                    for (int i = 0; i < response.size(); i++) {
                        String dataarticleid = response.getJSONObject(i).getString("articleId");
@ -122,11 +122,11 @@ public class ThirdJkEduArticleController extends BaseController {
                                 @RequestParam(value = "userType", required = false) String userType){
        try {
            com.alibaba.fastjson.JSONObject response = thirdJkEduArticleService.getArticalById(articleId,getUID());
            
            if("2".equals(userType)){
                jmJkEduArticleService.readPatientArticle(getRepUID(),articleId);
            }
            
            return write(200,"查询成功!","data",response);
        }catch (Exception e){
            e.printStackTrace();
@ -141,7 +141,7 @@ public class ThirdJkEduArticleController extends BaseController {
                                          @RequestParam(value = "articleId", required = true) String articleId,
                                          @ApiParam(name = "userType", value = "用户类型:1医生,2居民",defaultValue = "1")
                                          @RequestParam(value = "userType", required = true) Integer userType
                                          ){
    ){
        try {
            thirdJkEduArticleService.cancelArticleCollection(articleId,getRepUID(),userType);
//            thirdJkEduArticleService.cancelArticleCollection(articleId,"0de7295862dd11e69faffa163e8aee56",1);
@ -162,7 +162,7 @@ public class ThirdJkEduArticleController extends BaseController {
                                        @ApiParam(name = "articleCategoryName", value = "文章类别名称")
                                        @RequestParam(value = "articleCategoryName", required = false) String articleCategoryName,
                                        @ApiParam(name = "userType", value = "用户类型:1医生,2居民",defaultValue = "1")
                                            @RequestParam(value = "userType", required = true) Integer userType){
                                        @RequestParam(value = "userType", required = true) Integer userType){
        try {
            thirdJkEduArticleService.saveArticleCollection(articleId,articleCategoryId,articleCategoryName,getRepUID(),userType);
//            thirdJkEduArticleService.saveArticleCollection(articleId,articleCategoryId,articleCategoryName,"0de7295862dd11e69faffa163e8aee56",1);
@ -237,13 +237,13 @@ public class ThirdJkEduArticleController extends BaseController {
    @RequestMapping(value = "addCategory",method = RequestMethod.POST)
    @ApiOperation("添加二级分类-仅向市级管理员开放编辑权限")
    public String addCategory(@ApiParam(name = "categoryName", value = "文章分类名称")
                                           @RequestParam(value = "categoryName", required = true) String categoryName,
                                           @ApiParam(name = "categoryLevel", value = "分类级别-默认二级")
                                           @RequestParam(value = "categoryLevel", required = true,defaultValue = "2") Integer categoryLevel,
                                           @ApiParam(name = "firstlevelId", value = "一级类别ID")
                                           @RequestParam(value = "firstlevelId", required = true ) String firstlevelId,
                                           @ApiParam(name = "secondLevelId", value = "二级类别ID")
                                           @RequestParam(value = "secondLevelId", required = false ) String secondLevelId
                              @RequestParam(value = "categoryName", required = true) String categoryName,
                              @ApiParam(name = "categoryLevel", value = "分类级别-默认二级")
                              @RequestParam(value = "categoryLevel", required = true,defaultValue = "2") Integer categoryLevel,
                              @ApiParam(name = "firstlevelId", value = "一级类别ID")
                              @RequestParam(value = "firstlevelId", required = true ) String firstlevelId,
                              @ApiParam(name = "secondLevelId", value = "二级类别ID")
                              @RequestParam(value = "secondLevelId", required = false ) String secondLevelId
//                                           @ApiParam(name = "currentRoleCode", value = "当前登录角色")
//                                           @RequestParam(value = "currentRoleCode", required = true ) String currentRoleCode
    ){
@ -264,9 +264,9 @@ public class ThirdJkEduArticleController extends BaseController {
    @RequestMapping(value = "checkCategory",method = RequestMethod.POST)
    @ApiOperation("添加二级分类-仅向市级管理员开放编辑权限")
    public String checkCategory(@ApiParam(name = "categoryName", value = "文章分类名称")
                              @RequestParam(value = "categoryName", required = true) String categoryName,
                              @ApiParam(name = "categoryLevel", value = "分类级别-默认二级")
                              @RequestParam(value = "categoryLevel", required = true,defaultValue = "2") Integer categoryLevel){
                                @RequestParam(value = "categoryName", required = true) String categoryName,
                                @ApiParam(name = "categoryLevel", value = "分类级别-默认二级")
                                @RequestParam(value = "categoryLevel", required = true,defaultValue = "2") Integer categoryLevel){
        try {
            thirdJkEduArticleService.checkCategory(categoryName,categoryLevel);
            return success("添加成功!");
@ -279,11 +279,11 @@ public class ThirdJkEduArticleController extends BaseController {
    @RequestMapping(value = "updateCategory",method = RequestMethod.POST)
    @ApiOperation("更新二级分类-仅向市级管理员开放编辑权限")
    public String updateCategory(@ApiParam(name = "categoryId", value = "文章分类code")
                              @RequestParam(value = "categoryId", required = true) String categoryId,
                              @ApiParam(name = "categoryName", value = "文章分类名称")
                              @RequestParam(value = "categoryName", required = true ) String categoryName,
                              @ApiParam(name = "categoryState", value = "类别状态1、正常、2删除")
                              @RequestParam(value = "categoryState", required = false ) Integer categoryState){
                                 @RequestParam(value = "categoryId", required = true) String categoryId,
                                 @ApiParam(name = "categoryName", value = "文章分类名称")
                                 @RequestParam(value = "categoryName", required = true ) String categoryName,
                                 @ApiParam(name = "categoryState", value = "类别状态1、正常、2删除")
                                 @RequestParam(value = "categoryState", required = false ) Integer categoryState){
//                              @ApiParam(name = "currentRoleCode", value = "当前登录角色")
//                              @RequestParam(value = "currentRoleCode", required = true ) String currentRoleCode){
@ -312,7 +312,7 @@ public class ThirdJkEduArticleController extends BaseController {
            return error(-1,"查询失败!");
        }
    }
    
    @RequestMapping(value = "getCategoryByName",method = RequestMethod.GET)
    @ApiOperation("根据一级类别名称获取二级分类下得所有分类")
    public String getCategoryList(@ApiParam(name = "name", value = "类别名称")
@ -352,7 +352,7 @@ public class ThirdJkEduArticleController extends BaseController {
    @RequestMapping(value = "getConfigDicShoList",method = RequestMethod.GET)
    @ApiOperation("获取优先级-数据字典")
    public String getConfigDicShoList(@ApiParam(name = "typeName", value = "优先级-字典业务类型")
                                          @RequestParam(value = "typeName", required = true) String typeName){
                                      @RequestParam(value = "typeName", required = true) String typeName){
        try {
            com.alibaba.fastjson.JSONArray response = thirdJkEduArticleService.getConfigDicShoList(typeName);
            return write(200,"查询成功!","data",response);

+ 3 - 3
patient-co/patient-co-wlyy/src/main/resources/application-devtest.yml

@ -101,11 +101,11 @@ pushMes:
  redis_prescription_title: redisMessage
es:
  index:
    HealthEduArticlePatient: health_edu_article_patient_test6
    HealthEduArticlePatient: health_edu_article_patient_test3
    FollowUp: wlyy_followup
    Statistics: wlyy_quota_test
  type:
    HealthEduArticlePatient: health_edu_article_patient_test6
    HealthEduArticlePatient: health_edu_article_patient_test3
    FollowUpContent: wlyy_followup_content
    Statistics: wlyy_quota_test
  host:  http://172.19.103.68:9200
@ -125,7 +125,7 @@ activemq:
  password: admin
  url: tcp://172.19.103.87:61616
  queue:
    healtHarticleQueue: healthArticleChannel_devtest  #健康文章推送
    healtHarticleQueue: healthArticleChannel_test  #健康文章推送
##如果是外网项目就是flase 内网是true
neiwang: