|
@ -66,51 +66,35 @@ 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,@RequestParam(value = "patient",required = false)String patient) {
|
|
|
try {
|
|
|
Page<HealthEduArticle> list = healthEduArticleService.findAll(page, pagesize,filter,getUID());
|
|
|
List<Map<String, Object>> list = healthEduArticleService.findAll(page, pagesize,filter,getUID(),patient);
|
|
|
JSONArray jsonArray = new JSONArray();
|
|
|
if (list != null) {
|
|
|
for (HealthEduArticle article : list) {
|
|
|
for (Map<String, Object> map : list) {
|
|
|
JSONObject json = new JSONObject();
|
|
|
json.put("id", article.getId());
|
|
|
json.put("id", map.get("id"));
|
|
|
// 文章标识
|
|
|
json.put("code", article.getCode());
|
|
|
json.put("code", map.get("code"));
|
|
|
// 文章标题
|
|
|
json.put("title", article.getTitle());
|
|
|
json.put("title", map.get("title"));
|
|
|
// 文章查看URL
|
|
|
json.put("url", article.getUrl());
|
|
|
json.put("url", map.get("url"));
|
|
|
|
|
|
// 文章简介
|
|
|
json.put("content", parsrHtml(article.getContent()));
|
|
|
json.put("content", parsrHtml(map.get("content").toString()));
|
|
|
// 添加日期
|
|
|
json.put("czrq", DateUtil.dateToStrLong(article.getCzrq()));
|
|
|
json.put("czrq", DateUtil.dateToStrLong((Date)map.get("czrq")));
|
|
|
|
|
|
json.put("keyword", StringUtils.isNotBlank(article.getKeyword())?article.getKeyword():"");
|
|
|
int collectionAmount = healthEduArticleOpHistoryService.countCollectionAmount(article.getCode());
|
|
|
int readAmount = healthEduArticleOpHistoryService.countReadAmount(article.getCode());
|
|
|
int repeatAmount = healthEduArticleOpHistoryService.countRepeatAmount(article.getCode());
|
|
|
HealthEduArticleDoctor healthEduArticleDoctor = healthEduArticleDoctorService.findByArticle(article.getCode(), getUID());
|
|
|
if(StringUtils.isNotBlank(patient)){
|
|
|
List<HealthEduArticlePatient> healthEduArticlePatients = healthEduArticlePatientService.findByArticleAndPatient(article.getCode(),patient);
|
|
|
if(healthEduArticlePatients!=null&&healthEduArticlePatients.size()>0){
|
|
|
json.put("send", 1);
|
|
|
}else{
|
|
|
json.put("send", 0);
|
|
|
}
|
|
|
}else{
|
|
|
json.put("send", 0);
|
|
|
}
|
|
|
json.put("keyword", map.get("keyword")==null?"":map.get("keyword"));
|
|
|
|
|
|
json.put("send", map.get("send"));
|
|
|
//阅读量
|
|
|
json.put("readAmount", readAmount);
|
|
|
json.put("readAmount", map.get("readAmount"));
|
|
|
//收藏量
|
|
|
json.put("collectionAmount", collectionAmount);
|
|
|
json.put("collectionAmount", map.get("collectionAmount"));
|
|
|
//转发量
|
|
|
json.put("repeatAmount", repeatAmount);
|
|
|
//是否收藏
|
|
|
if(healthEduArticleDoctor!=null){
|
|
|
json.put("collection",1);
|
|
|
}else{
|
|
|
json.put("collection",0);
|
|
|
}
|
|
|
json.put("repeatAmount", map.get("repeatAmount"));
|
|
|
|
|
|
json.put("collection",map.get("collection"));
|
|
|
jsonArray.put(json);
|
|
|
}
|
|
|
}
|
|
@ -130,51 +114,34 @@ public class DoctorHealthEduArticleController extends BaseController {
|
|
|
@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,@RequestParam(value = "patient",required = false)String patient) {
|
|
|
try {
|
|
|
List<Object> list = healthEduArticleDoctorService.list(page, pagesize,filter,getUID());
|
|
|
List<Map<String, Object>> list = healthEduArticleDoctorService.list(page, pagesize,filter,getUID(),patient);
|
|
|
JSONArray jsonArray = new JSONArray();
|
|
|
for(Object obj:list){
|
|
|
HealthEduArticle healthEduArticle= (HealthEduArticle)obj;
|
|
|
for(Map<String, Object> map:list){
|
|
|
JSONObject json = new JSONObject();
|
|
|
json.put("id", healthEduArticle.getId());
|
|
|
json.put("id", map.get("id"));
|
|
|
// 文章标识
|
|
|
json.put("code", healthEduArticle.getCode());
|
|
|
json.put("code", map.get("article"));
|
|
|
// 文章标题
|
|
|
json.put("title", healthEduArticle.getTitle());
|
|
|
json.put("title", map.get("title"));
|
|
|
// 文章查看URL
|
|
|
json.put("url", healthEduArticle.getUrl());
|
|
|
json.put("url", map.get("url"));
|
|
|
|
|
|
// 文章简介
|
|
|
json.put("content", parsrHtml(healthEduArticle.getContent()));
|
|
|
json.put("content", parsrHtml(map.get("content").toString()));
|
|
|
// 添加日期
|
|
|
json.put("czrq", DateUtil.dateToStrLong(healthEduArticle.getCzrq()));
|
|
|
json.put("czrq", DateUtil.dateToStrLong((Date)map.get("czrq")));
|
|
|
|
|
|
json.put("keyword", StringUtils.isNotBlank(healthEduArticle.getKeyword())?healthEduArticle.getKeyword():"");
|
|
|
int collectionAmount = healthEduArticleOpHistoryService.countCollectionAmount(healthEduArticle.getCode());
|
|
|
int readAmount = healthEduArticleOpHistoryService.countReadAmount(healthEduArticle.getCode());
|
|
|
int repeatAmount = healthEduArticleOpHistoryService.countRepeatAmount(healthEduArticle.getCode());
|
|
|
HealthEduArticleDoctor healthEduArticleDoctor = healthEduArticleDoctorService.findByArticle(healthEduArticle.getCode(), getUID());
|
|
|
if(StringUtils.isNotBlank(patient)){
|
|
|
List<HealthEduArticlePatient> healthEduArticlePatients = healthEduArticlePatientService.findByArticleAndPatient(healthEduArticle.getCode(),patient);
|
|
|
if(healthEduArticlePatients!=null&&healthEduArticlePatients.size()>0){
|
|
|
json.put("send", 1);
|
|
|
}else{
|
|
|
json.put("send", 0);
|
|
|
}
|
|
|
}else{
|
|
|
json.put("send", 0);
|
|
|
}
|
|
|
json.put("keyword", map.get("keyword"));
|
|
|
|
|
|
json.put("send", map.get("send"));
|
|
|
//阅读量
|
|
|
json.put("readAmount", readAmount);
|
|
|
json.put("readAmount", map.get("readAmount"));
|
|
|
//收藏量
|
|
|
json.put("collectionAmount", collectionAmount);
|
|
|
json.put("collectionAmount", map.get("collectionAmount"));
|
|
|
//转发量
|
|
|
json.put("repeatAmount", repeatAmount);
|
|
|
//是否收藏
|
|
|
if(healthEduArticleDoctor!=null){
|
|
|
json.put("collection",1);
|
|
|
}else{
|
|
|
json.put("collection",0);
|
|
|
}
|
|
|
json.put("repeatAmount", map.get("repeatAmount"));
|
|
|
//是否收藏(医生收藏的列表肯定是收藏的无需额外校验)
|
|
|
json.put("collection",1);
|
|
|
jsonArray.put(json);
|
|
|
}
|
|
|
return write(200, "查询成功", "list", jsonArray);
|