|
@ -1,8 +1,10 @@
|
|
|
package com.yihu.wlyy.web.patient.health;
|
|
|
|
|
|
import com.yihu.wlyy.entity.doctor.profile.Doctor;
|
|
|
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.service.common.account.DoctorService;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import org.json.JSONArray;
|
|
|
import org.json.JSONObject;
|
|
@ -20,6 +22,9 @@ import com.yihu.wlyy.service.app.health.HealthEduArticleService;
|
|
|
import com.yihu.wlyy.util.DateUtil;
|
|
|
import com.yihu.wlyy.web.BaseController;
|
|
|
|
|
|
import java.util.HashMap;
|
|
|
import java.util.Map;
|
|
|
|
|
|
/**
|
|
|
* 患者端:健康教育控制类
|
|
|
* @author George
|
|
@ -35,6 +40,8 @@ public class HealthEduArticleController extends BaseController {
|
|
|
|
|
|
@Autowired
|
|
|
private HealthEduArticleOpHistoryService healthEduArticleOpHistoryService;
|
|
|
@Autowired
|
|
|
private DoctorService doctorService;
|
|
|
|
|
|
/**
|
|
|
* 查询文章列表
|
|
@ -47,6 +54,7 @@ public class HealthEduArticleController extends BaseController {
|
|
|
try {
|
|
|
Page<HealthEduArticlePatient> list = healthEduArticlePatientService.findByPatient(getUID(), id, pagesize);
|
|
|
JSONArray jsonArray = new JSONArray();
|
|
|
Map<String,Doctor> docMap = new HashMap<>();
|
|
|
if (list != null) {
|
|
|
for (HealthEduArticlePatient article : list) {
|
|
|
JSONObject json = new JSONObject();
|
|
@ -65,6 +73,14 @@ public class HealthEduArticleController extends BaseController {
|
|
|
json.put("read", article.getRead());
|
|
|
// 添加日期
|
|
|
json.put("czrq", DateUtil.dateToStrLong(article.getCzrq()));
|
|
|
|
|
|
if(docMap.get(article.getDoctor())==null){
|
|
|
Doctor doctor = doctorService.findDoctorByCode(article.getDoctor());
|
|
|
docMap.put(article.getDoctor(),doctor);
|
|
|
json.put("photo",doctor.getPhoto());
|
|
|
}else{
|
|
|
json.put("photo",docMap.get(article.getDoctor()).getPhoto());
|
|
|
}
|
|
|
//int collectionAmount = healthEduArticleOpHistoryService.countCollectionAmount(article.getArticle());
|
|
|
//int readAmount = healthEduArticleOpHistoryService.countReadAmount(article.getArticle());
|
|
|
//int repeatAmount = healthEduArticleOpHistoryService.countRepeatAmount(article.getArticle());
|