|
@ -2,14 +2,14 @@ package com.yihu.wlyy.web.doctor.health;
|
|
|
|
|
|
import java.util.*;
|
|
|
|
|
|
import com.yihu.wlyy.entity.education.HealthEduArticleOpHistory;
|
|
|
import com.yihu.wlyy.service.app.health.HealthEduArticleOpHistoryService;
|
|
|
import com.yihu.wlyy.service.app.health.HealthEduArticlePatientService;
|
|
|
import com.yihu.wlyy.entity.education.*;
|
|
|
import com.yihu.wlyy.service.app.health.*;
|
|
|
import com.yihu.wlyy.service.app.label.SignPatientLabelInfoService;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.json.JSONArray;
|
|
|
import org.json.JSONObject;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.data.domain.Page;
|
|
|
import org.springframework.http.MediaType;
|
|
@ -20,9 +20,6 @@ import org.springframework.web.bind.annotation.RequestParam;
|
|
|
import org.springframework.web.bind.annotation.ResponseBody;
|
|
|
|
|
|
import com.yihu.wlyy.entity.doctor.profile.Doctor;
|
|
|
import com.yihu.wlyy.entity.education.HealthEduArticle;
|
|
|
import com.yihu.wlyy.entity.education.HealthEduArticlePatient;
|
|
|
import com.yihu.wlyy.service.app.health.HealthEduArticleService;
|
|
|
import com.yihu.wlyy.service.common.account.DoctorService;
|
|
|
import com.yihu.wlyy.task.PushMsgTask;
|
|
|
import com.yihu.wlyy.util.DateUtil;
|
|
@ -51,6 +48,12 @@ public class DoctorHealthEduArticleController extends BaseController {
|
|
|
|
|
|
@Autowired
|
|
|
private HealthEduArticlePatientService healthEduArticlePatientService;
|
|
|
|
|
|
@Autowired
|
|
|
private HealthEduArticleDoctorService healthEduArticleDoctorService;
|
|
|
|
|
|
@Autowired
|
|
|
private HealthEduArticleLabelService healthEduArticleLabelService;
|
|
|
/**
|
|
|
* 查询
|
|
|
* @param pagesize 分页大小
|
|
@ -60,7 +63,7 @@ public class DoctorHealthEduArticleController extends BaseController {
|
|
|
@ResponseBody
|
|
|
public String list(@RequestParam(value = "page",required = true)int page, @RequestParam(value = "pagesize",required = true)int pagesize,@RequestParam(value = "filter",required = false)String filter) {
|
|
|
try {
|
|
|
Page<HealthEduArticle> list = healthEduArticleService.findAll(page, pagesize,filter);
|
|
|
Page<HealthEduArticle> list = healthEduArticleService.findAll(page, pagesize,filter,getUID());
|
|
|
JSONArray jsonArray = new JSONArray();
|
|
|
if (list != null) {
|
|
|
for (HealthEduArticle article : list) {
|
|
@ -76,6 +79,8 @@ public class DoctorHealthEduArticleController extends BaseController {
|
|
|
json.put("content", article.getContent());
|
|
|
// 添加日期
|
|
|
json.put("czrq", DateUtil.dateToStrLong(article.getCzrq()));
|
|
|
|
|
|
json.put("keyword", article.getKeyword());
|
|
|
int collectionAmount = healthEduArticleOpHistoryService.countCollectionAmount(article.getCode());
|
|
|
int readAmount = healthEduArticleOpHistoryService.countReadAmount(article.getCode());
|
|
|
int repeatAmount = healthEduArticleOpHistoryService.countRepeatAmount(article.getCode());
|
|
@ -83,6 +88,8 @@ public class DoctorHealthEduArticleController extends BaseController {
|
|
|
json.put("readAmount", readAmount);
|
|
|
//收藏量
|
|
|
json.put("collectionAmount", collectionAmount);
|
|
|
|
|
|
|
|
|
//转发量
|
|
|
json.put("repeatAmount", repeatAmount);
|
|
|
//是否收藏
|
|
@ -98,6 +105,40 @@ public class DoctorHealthEduArticleController extends BaseController {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 查询医生收藏列表
|
|
|
* @param pagesize 分页大小
|
|
|
* @return 列表
|
|
|
*/
|
|
|
@RequestMapping(value = "listDoctor")
|
|
|
@ResponseBody
|
|
|
public String listDoctor(@RequestParam(value = "page",required = true)int page, @RequestParam(value = "pagesize",required = true)int pagesize,@RequestParam(value = "filter",required = false)String filter) {
|
|
|
try {
|
|
|
List<Object> list = healthEduArticleDoctorService.list(page, pagesize,filter,getUID());
|
|
|
return write(200, "查询成功", "list", list);
|
|
|
} catch (Exception ex) {
|
|
|
error(ex);
|
|
|
return invalidUserException(ex, -1, "查询失败!");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 查询标签列表
|
|
|
* @param pagesize 分页大小
|
|
|
* @return 列表
|
|
|
*/
|
|
|
@RequestMapping(value = "listLabel")
|
|
|
@ResponseBody
|
|
|
public String listLabel(@RequestParam(value = "page",required = true)int page, @RequestParam(value = "pagesize",required = true)int pagesize,@RequestParam(value = "type",required = false,defaultValue = "0")int type) {
|
|
|
try {
|
|
|
Page<HealthEduArticleLabel> list = healthEduArticleLabelService.findAll(page,pagesize,type,getUID());
|
|
|
return write(200, "查询成功", "list", list);
|
|
|
} catch (Exception ex) {
|
|
|
error(ex);
|
|
|
return invalidUserException(ex, -1, "查询失败!");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 查询文章列表
|
|
|
* @param code 数据文章唯一标示code
|
|
@ -242,7 +283,51 @@ public class DoctorHealthEduArticleController extends BaseController {
|
|
|
patientSet.add(patient);
|
|
|
}
|
|
|
if(result.length()==100){
|
|
|
getPatientByGroup( labelCode,labelType,teamCode,patientSet,page+1,pagesize);
|
|
|
getPatientByGroup(labelCode,labelType,teamCode,patientSet,page+1,pagesize);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 文章收藏
|
|
|
* @param article 文章CODE
|
|
|
* @return
|
|
|
*/
|
|
|
@RequestMapping(value = "collectionArticle")
|
|
|
@ResponseBody
|
|
|
public String collectionArticle(@RequestParam(value = "article",required = true)String article){
|
|
|
HealthEduArticleDoctor healthEduArticleDoctor = healthEduArticleDoctorService.findByArticle(article,getUID());
|
|
|
if(healthEduArticleDoctor!=null){
|
|
|
return error(-1, "收藏失败,该文章已经收藏!");
|
|
|
}
|
|
|
HealthEduArticle healthEduArticle = healthEduArticleService.findArticleByCode(article);
|
|
|
healthEduArticleDoctor = new HealthEduArticleDoctor();
|
|
|
try{
|
|
|
BeanUtils.copyProperties(healthEduArticle,healthEduArticleDoctor);
|
|
|
healthEduArticleDoctor.setDoctor(getUID());
|
|
|
healthEduArticleDoctor.setArticle(healthEduArticle.getCode());
|
|
|
healthEduArticleDoctorService.save(healthEduArticleDoctor);
|
|
|
//更新收藏量
|
|
|
healthEduArticleOpHistoryService.saveByStatus(HealthEduArticleOpHistory.COLLECTION_STATUS,healthEduArticle.getCode(),healthEduArticle.getTitle(),getUID());
|
|
|
return success("收藏成功!");
|
|
|
}catch (Exception e){
|
|
|
error(e);
|
|
|
return error(-1, "收藏失败!");
|
|
|
}
|
|
|
}
|
|
|
/**
|
|
|
* 文章收藏
|
|
|
* @param article 文章CODE
|
|
|
* @return
|
|
|
*/
|
|
|
@RequestMapping(value = "uncollectionArticle")
|
|
|
@ResponseBody
|
|
|
public String uncollectionArticle(@RequestParam(value = "article",required = true)String article){
|
|
|
try{
|
|
|
healthEduArticleDoctorService.delete(article,getUID());
|
|
|
return success("取消收藏成功!");
|
|
|
}catch (Exception e){
|
|
|
error(e);
|
|
|
return error(-1, "取消收藏失败!");
|
|
|
}
|
|
|
}
|
|
|
|