Explorar el Código

三院医生圈功能

wangzhinan hace 1 año
padre
commit
4318712be7

+ 5 - 0
business/base-service/src/main/java/com/yihu/jw/article/dao/KnowledgeArticleDoctorDao.java

@ -33,4 +33,9 @@ public interface KnowledgeArticleDoctorDao extends JpaRepository<KnowledgeArticl
    @Modifying
    @Query("delete from KnowledgeArticleDoctorDO  where relationCode=?1 and user=?2 and type=?3 ")
    void deletByRelationCodeAndType(String relationCode,String user,Integer type);
    @Query("select a from KnowledgeArticleDoctorDO a where a.relationCode=?1 and a.type=?2 order by a.createTime desc")
    List<KnowledgeArticleDoctorDO> findByRelationCodeAndType(String relationCode,Integer type);
}

+ 18 - 0
business/base-service/src/main/java/com/yihu/jw/article/service/BaseMenuManageService.java

@ -1150,6 +1150,24 @@ public class BaseMenuManageService {
    }
    /**
     * 获取某篇问章的统计数据
     * @param articleId
     * @return
     */
    public JSONObject findArticleStaticsByArticleId(String articleId){
        List<KnowledgeArticleDoctorDO> knowledgeArticleDoctorDOS = knowledgeArticleDoctorDao.findByRelationCodeAndType(articleId,2);//获取点赞
        List<KnowledgeArticleDoctorDO> knowledgeArticleDoctorDOList = knowledgeArticleDoctorDao.findByRelationCodeAndType(articleId,3);//获取收藏
        List<KnowledgeArticleDoctorDO> knowledgeArticleDoctorDOList1 = knowledgeArticleDoctorDao.findByRelationCodeAndType(articleId,1);//获取评论
        JSONObject object = new JSONObject();
        object.put("eulogyTotal",knowledgeArticleDoctorDOS.size());//点赞数量
        object.put("collectTotal",knowledgeArticleDoctorDOList.size());//收藏数量
        object.put("commentTotal",knowledgeArticleDoctorDOList1.size());//评论数量
        return object;
    }
    /**
     * 判断该文章当前医生是否点赞或者收藏
     *

+ 43 - 6
business/base-service/src/main/java/com/yihu/jw/article/service/KnowledgeArticleDictService.java

@ -26,6 +26,7 @@ import com.yihu.jw.patient.dao.BasePatientBusinessDao;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.jw.user.UserDao;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.utils.EntityUtils;
import com.yihu.jw.utils.hibernate.HibenateUtils;
import org.apache.commons.lang.StringUtils;
@ -123,15 +124,18 @@ public class KnowledgeArticleDictService extends BaseJpaService<KnowledgeArticle
	}
	public boolean delArticle(String id){
		KnowledgeArticleDictDO knowledgeArticleDictDO = knowledgeArticleDictDao.findByIdAndDel(id);
		if (knowledgeArticleDictDO!=null){
			knowledgeArticleDictDO.setDel(0);
			knowledgeArticleDictDao.save(knowledgeArticleDictDO);
			return true;
		String str[]= id.split(",");
		for (int i=0;i<str.length;i++){
			KnowledgeArticleDictDO knowledgeArticleDictDO = knowledgeArticleDictDao.findByIdAndDel(str[i]);
			if (knowledgeArticleDictDO!=null){
				knowledgeArticleDictDO.setDel(0);
				knowledgeArticleDictDao.save(knowledgeArticleDictDO);
			}
		}
		return false;
		return true;
	}
	public KnowledgeArticleDictDO findById(String id){
		return knowledgeArticleDictDao.findByIdAndDel(id);
	}
@ -210,6 +214,39 @@ public class KnowledgeArticleDictService extends BaseJpaService<KnowledgeArticle
			return  one;
		}
	}
	/**
	 * 获取doctorId获取医生发布的文章统计数据
	 * @param doctorId
	 * @return
	 */
	public JSONObject findArticleStaticsByDoctorId(String doctorId){
		String eulogySql = " select * from base_knowledge_article_doctor kad where kad.type=2 and kad.relation_code in (select ad.id from wlyy_knowledge_article_dict ad where ad.create_user ='"+doctorId+"') ";
		List<Map<String,Object>> mapList = jdbcTemplate.queryForList(eulogySql);//点赞数量
		String startDate = DateUtil.getNextDay(new Date(),-7)+" 00:00:00";
		String endDate = DateUtil.getStringDateShort()+" 23:59:59";
		String dateCondition = " and kad.create_time >='"+startDate+"' and kad.create_time <='"+endDate+"' ";
		String eulogy7Sql = " select * from base_knowledge_article_doctor kad where kad.type=2 and kad.relation_code in (select ad.id from wlyy_knowledge_article_dict ad where ad.create_user ='"+doctorId+"') "+dateCondition;
		List<Map<String,Object>> map7List = jdbcTemplate.queryForList(eulogy7Sql);//7日点赞数量
		//收藏数量
		String collectSql = " select * from base_knowledge_article_doctor kad where kad.type=3 and kad.relation_code in (select ad.id from wlyy_knowledge_article_dict ad where ad.create_user ='"+doctorId+"') ";
		List<Map<String,Object>> collectList = jdbcTemplate.queryForList(collectSql);//收藏数量
		String collect7Sql = " select * from base_knowledge_article_doctor kad where kad.type=3 and kad.relation_code in (select ad.id from wlyy_knowledge_article_dict ad where ad.create_user ='"+doctorId+"') "+dateCondition;
		List<Map<String,Object>> collect7List = jdbcTemplate.queryForList(collect7Sql);//7日收藏数量
		//评论数量
		String commentSql = " select * from base_knowledge_article_doctor kad where kad.type=1 and kad.relation_code in (select ad.id from wlyy_knowledge_article_dict ad where ad.create_user ='"+doctorId+"') ";
		List<Map<String,Object>> commentList = jdbcTemplate.queryForList(commentSql);//评论数量
		String comment7Sql = " select * from base_knowledge_article_doctor kad where kad.type=1 and kad.relation_code in (select ad.id from wlyy_knowledge_article_dict ad where ad.create_user ='"+doctorId+"') "+dateCondition;
		List<Map<String,Object>> comment7List = jdbcTemplate.queryForList(comment7Sql);//7日评论数量
		JSONObject object = new JSONObject();
		object.put("eulogyTotal",mapList.size());//点赞数量
		object.put("eulogy7Total",map7List.size());//7日新增点赞数量
		object.put("collectTotal",collectList.size());//收藏数量
		object.put("collect7Total",collect7List.size());//7日新增收藏数量
		object.put("commentTotal",commentList.size());//评论数量
		object.put("comment7Total",comment7List.size());//7日新增评论数量
		return object;
	}
	
	//审核/退回文章
	public KnowledgeArticleDictDO reviewArticle(String articleId,Integer status,String reason) throws Exception{

+ 10 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/hospital/article/KnowledgeArticleDictDO.java

@ -46,6 +46,8 @@ public class KnowledgeArticleDictDO extends UuidIdentityEntity {
	private Integer readCount;//已读数
	private Integer collection;//收藏数量
	private Integer fabulous;//点赞数量
	private Integer comment;//评论数量
	@Column(name = "is_share")
	private Integer share;//分享 数量
	private String intro;//简介
@ -406,4 +408,12 @@ public class KnowledgeArticleDictDO extends UuidIdentityEntity {
	public void setUrl(String url) {
		this.url = url;
	}
	public Integer getComment() {
		return comment;
	}
	public void setComment(Integer comment) {
		this.comment = comment;
	}
}

+ 2 - 0
common/common-request-mapping/src/main/java/com/yihu/jw/rm/hospital/BaseHospitalRequestMapping.java

@ -1247,6 +1247,8 @@ public class BaseHospitalRequestMapping {
        public static final String selectArticleDoctorByArticleIdAndUser= "/selectArticleDoctorByArticleIdAndUser";
        public static final String deleteArticleDoctorById= "/deleteArticleDoctorById";
        public static final String findArticleStaticsByDoctorId="/findArticleStaticsByDoctorId";
    }
    /**

+ 26 - 0
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/article/ArticleDictEndpoint.java

@ -1,7 +1,9 @@
package com.yihu.jw.hospital.endpoint.article;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.article.dao.KnowledgeArticleDictDao;
import com.yihu.jw.article.service.BaseMenuManageService;
import com.yihu.jw.article.service.KnowledgeArticleDictService;
import com.yihu.jw.contant.CommonContant;
import com.yihu.jw.doctor.dao.BaseDoctorDao;
@ -43,6 +45,8 @@ public class ArticleDictEndpoint extends EnvelopRestEndpoint {
	private BaseDoctorRoleDao doctorRoleDao;
	@Autowired
	private JdbcTemplate jdbcTemplate;
	@Autowired
	private BaseMenuManageService menuManageService;
	
	@GetMapping(value = BaseHospitalRequestMapping.KnowledgeArticle.searchKnowledgePageList)
@ -81,6 +85,14 @@ public class ArticleDictEndpoint extends EnvelopRestEndpoint {
			}
			filters += ";type=2";
			List<KnowledgeArticleDictDO> list  = knowledgeArticleDictService.search(fields,filters,sorts,page,pageSize);
			for (KnowledgeArticleDictDO articleDictDO:list){
				JSONObject object = menuManageService.findArticleStaticsByArticleId(articleDictDO.getId());
				if (object!=null){
					articleDictDO.setCollection(Integer.parseInt(object.getString("collectTotal")));
					articleDictDO.setComment(Integer.parseInt(object.getString("commentTotal")));
					articleDictDO.setFabulous(Integer.parseInt(object.getString("eulogyTotal")));
				}
			}
			List<KnowledgeArticleDictDO> totals  = knowledgeArticleDictService.search(fields,filters,sorts);
			JSONObject result = new JSONObject();
@ -152,6 +164,20 @@ public class ArticleDictEndpoint extends EnvelopRestEndpoint {
			return failedException2(e);
		}
	}
	@GetMapping (value = BaseHospitalRequestMapping.KnowledgeArticle.findArticleStaticsByDoctorId)
	@ApiOperation(value = "获取doctorId获取医生发布的文章统计数据")
	public Envelop findArticleStaticsByDoctorId(
			@ApiParam(name = "doctorId", value = "医生id", required = true)
			@RequestParam String doctorId) {
		try {
			return success("查询成功",knowledgeArticleDictService.findArticleStaticsByDoctorId(doctorId));
		}catch (Exception e){
			e.printStackTrace();
			return failedException2(e);
		}
	}
	
	@PostMapping (value = BaseHospitalRequestMapping.KnowledgeArticle.reviewArticle)
	@ApiOperation(value = "审核/退回文章")