Browse Source

Merge branch 'dev' of lyr/patient-co-management into dev

lyr 8 years ago
parent
commit
931e2e16f2

+ 5 - 3
patient-co-wlyy/src/main/java/com/yihu/wlyy/entity/education/HealthEduArticlePatient.java

@ -5,6 +5,7 @@ import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Transient;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yihu.wlyy.entity.IdEntity;
@ -80,6 +81,7 @@ public class HealthEduArticlePatient extends IdEntity {
		this.doctorName = doctorName;
	}
	@Transient
	public String getTitle() {
		return title;
	}
@ -87,7 +89,7 @@ public class HealthEduArticlePatient extends IdEntity {
	public void setTitle(String title) {
		this.title = title;
	}
	@Transient
	public String getUrl() {
		return url;
	}
@ -95,7 +97,7 @@ public class HealthEduArticlePatient extends IdEntity {
	public void setUrl(String url) {
		this.url = url;
	}
	@Transient
	public String getContent() {
		return content;
	}
@ -137,7 +139,7 @@ public class HealthEduArticlePatient extends IdEntity {
	public void setAdminTeamCode(Long adminTeamCode) {
		this.adminTeamCode = adminTeamCode;
	}
	@Transient
	public String getSummary() {
		return summary;
	}

+ 1 - 1
patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/health/HealthEduArticleDoctorService.java

@ -101,7 +101,7 @@ public class HealthEduArticleDoctorService extends BaseService {
		}
		List<Object> params = new ArrayList<Object>();
		StringBuffer sql = new StringBuffer();
		sql.append("select a.id,a.article,a.doctor,a.title,a.url,a.czrq,b.content,b.keyword");
		sql.append("select a.id,a.article,a.doctor,a.title,a.url,a.czrq,b.summary content,b.keyword");
		sql.append(",(select count(1) from wlyy_health_edu_article_op_history c where c.code = a.article and c.status = 1) as readAmount");
		sql.append(",(select count(1) from wlyy_health_edu_article_op_history c where c.code = a.article and c.status = 2) as collectionAmount");
		sql.append(",(select count(1) from wlyy_health_edu_article_op_history c where c.code = a.article and c.status = 3) as repeatAmount");

+ 98 - 57
patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/health/HealthEduArticlePatientService.java

@ -11,6 +11,8 @@ import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Sort;
import org.springframework.data.domain.Sort.Direction;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import org.springside.modules.persistence.DynamicSpecifications;
@ -24,73 +26,112 @@ import java.util.Map;
/**
 * 健康教育患者业务逻辑类
 * @author linz
 *
 * @author linz
 */
@Component
@Transactional(rollbackFor = Exception.class)
public class HealthEduArticlePatientService extends BaseService {
	@Autowired
	private HealthEduArticlePatientDao healthEduArticlePatientDao;
    @Autowired
    private HealthEduArticlePatientDao healthEduArticlePatientDao;
    @Autowired
    private JdbcTemplate jdbcTemplate;
    /**
     * 根据文章标示获取数据
     *
     * @param article
     * @return
     */
    @Deprecated
    public HealthEduArticlePatient findByArticle(String article) {
        return healthEduArticlePatientDao.findByArticle(article);
    }
	/**
	 * 根据文章标示获取数据
	 * @param article
	 * @return
	 *
	 */
	@Deprecated
	public HealthEduArticlePatient findByArticle(String article) {
		return healthEduArticlePatientDao.findByArticle(article);
	}
    /**
     * 根据文章id获取数据
     *
     * @param id
     * @return
     */
    public HealthEduArticlePatient findById(Long id) {
        return healthEduArticlePatientDao.findOne(id);
    }
	/**
	 * 根据文章id获取数据
	 * @param id
	 * @return
	 */
	public HealthEduArticlePatient findById(Long id) {
		return healthEduArticlePatientDao.findOne(id);
	}
    public List<HealthEduArticlePatient> findByArticleAndPatient(String article, String patient) {
        return healthEduArticlePatientDao.findByArticleAndPatient(article, patient);
    }
	public List<HealthEduArticlePatient> findByArticleAndPatient(String article,String patient) {
		return healthEduArticlePatientDao.findByArticleAndPatient(article, patient);
	}
    /**
     * 查询患者文章
     * @param patient 患者标识
     * @param pagesize 分页大小
     * @return
     */
//	public Page<HealthEduArticlePatient> findByPatient(String patient, long id, int pagesize) {
//		if (pagesize <= 0) {
//			pagesize = 10;
//		}
//		// 排序
//		Sort sort = new Sort(Direction.DESC, "id");
//		// 分页信息
//		PageRequest pageRequest = new PageRequest(0, pagesize, sort);
//		// 设置查询条件
//		Map<String, SearchFilter> filters = new HashMap<String, SearchFilter>();
//		// 患者过滤
//		filters.put("patient", new SearchFilter("patient", Operator.EQ, patient));
//		if (id > 0) {
//			filters.put("id", new SearchFilter("id", Operator.LT, id));
//		}
//		Specification<HealthEduArticlePatient> spec = DynamicSpecifications.bySearchFilter(filters.values(), HealthEduArticlePatient.class);
//		return healthEduArticlePatientDao.findAll(spec, pageRequest);
//	}
	/**
	 * 查询患者文章
	 * @param patient 患者标识
	 * @param pagesize 分页大小
	 * @return
	 */
	public Page<HealthEduArticlePatient> findByPatient(String patient, long id, int pagesize) {
		if (pagesize <= 0) {
			pagesize = 10;
		}
		// 排序
		Sort sort = new Sort(Direction.DESC, "id");
		// 分页信息
		PageRequest pageRequest = new PageRequest(0, pagesize, sort);
		// 设置查询条件
		Map<String, SearchFilter> filters = new HashMap<String, SearchFilter>();
		// 患者过滤
		filters.put("patient", new SearchFilter("patient", Operator.EQ, patient));
		if (id > 0) {
			filters.put("id", new SearchFilter("id", Operator.LT, id));
		}
		Specification<HealthEduArticlePatient> spec = DynamicSpecifications.bySearchFilter(filters.values(), HealthEduArticlePatient.class);
		return healthEduArticlePatientDao.findAll(spec, pageRequest);
	}
    /**
     * 查询患者文章
     *
     * @param patient  患者标识
     * @param pagesize 分页大小
     * @return
     */
    public List<HealthEduArticlePatient> findByPatient(String patient, long id, int pagesize) {
        if (pagesize <= 0) {
            pagesize = 10;
        }
        String sql = "select " +
                "    a.id" +
                "    ,a.patient" +
                "    ,a.article" +
                "    ,a.doctor" +
                "    ,a.doctor_name as doctorName" +
                "    ,b.title" +
                "    ,b.url" +
                "    ,b.summary as content" +
                "    ,a.is_read as 'read'" +
                "    ,a.czrq" +
                " from" +
                "     wlyy_health_edu_article_patient a" +
                "     , wlyy_health_edu_article b" +
                " where" +
                "      a.article = b.code" +
                " and a.patient = ?" +
                (id > 0 ? " and a.id < ? " : "") +
                " order by a.id desc limit 0," + pagesize;
        List<HealthEduArticlePatient> list = jdbcTemplate.query(sql,
                id > 0 ? new Object[]{patient,id} : new Object[]{patient}, new BeanPropertyRowMapper(HealthEduArticlePatient.class));
        return list;
    }
	/**
	 * 文章更新为已读
	 * @param patient
	 * @param article
	 * @return
	 */
	public int updateRead(String patient, String article) {
		return healthEduArticlePatientDao.updateRead(patient, article);
	}
    /**
     * 文章更新为已读
     *
     * @param patient
     * @param article
     * @return
     */
    public int updateRead(String patient, String article) {
        return healthEduArticlePatientDao.updateRead(patient, article);
    }
}

+ 7 - 5
patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/health/HealthEduArticleService.java

@ -164,7 +164,7 @@ public class HealthEduArticleService extends BaseService {
        }
        List<Object> params = new ArrayList<Object>();
        StringBuffer sql = new StringBuffer();
        sql.append("select a.id,a.code,a.title,a.url,a.czrq,a.content,a.keyword");
        sql.append("select a.id,a.code,a.title,a.url,a.czrq,a.summary content,a.keyword");
        sql.append(",(select count(1) from wlyy_health_edu_article_op_history c where c.code = a.code and c.status = 1) as readAmount");
        sql.append(",(select count(1) from wlyy_health_edu_article_op_history c where c.code = a.code and c.status = 2) as collectionAmount");
        sql.append(",(select count(1) from wlyy_health_edu_article_op_history c where c.code = a.code and c.status = 3) as repeatAmount");
@ -209,19 +209,21 @@ public class HealthEduArticleService extends BaseService {
        List<Object> params = new ArrayList<Object>();
        String sql = "select " +
                "    a.article" +
                "    ,a.title" +
                "    ,a.url" +
                "    ,b.title" +
                "    ,b.url" +
                "    ,a.czrq" +
                "    ,a.content" +
                "    ,b.summary content" +
                "    ,d.code" +
                "    ,d.name" +
                "    ,d.photo" +
                "    ,a.admin_team_code" +
                "  from" +
                "    wlyy_health_edu_article_patient a" +
                "    ,wlyy_health_edu_article b" +
                "    ,wlyy_doctor d" +
                "  where" +
                "    a.doctor = d.code " +
                "    a.article = b.code " +
                "    and a.doctor = d.code " +
                "    and a.patient = ?" +
                "    and a.admin_team_code = ?" +
                "  order by a.czrq desc limit " + page*pageSize + "," + pageSize;

+ 9 - 7
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/health/DoctorHealthEduArticleController.java

@ -99,9 +99,9 @@ public class DoctorHealthEduArticleController extends WeixinBaseController {
                    json.put("title", map.get("title"));
                    // 文章查看URL
                    json.put("url", map.get("url"));
                    // 文章简介
                    json.put("content", parsrHtml(map.get("content").toString()));
                    //json.put("content", parsrHtml(map.get("content").toString()));
                    json.put("content", map.get("content").toString());
                    // 添加日期
                    json.put("czrq", DateUtil.dateToStrLong((Date) map.get("czrq")));
@ -165,7 +165,8 @@ public class DoctorHealthEduArticleController extends WeixinBaseController {
                    // 文章查看URL
                    json.put("url", map.get("url"));
                    // 文章简介
                    json.put("content", parsrHtml(map.get("content").toString()));
                    //json.put("content", parsrHtml(map.get("content").toString()));
                    json.put("content", map.get("content").toString());
                    // 发送日期
                    json.put("czrq", DateUtil.dateToStrLong((Date) map.get("czrq")));
                    // 发送团队
@ -203,7 +204,8 @@ public class DoctorHealthEduArticleController extends WeixinBaseController {
                json.put("url", map.get("url"));
                // 文章简介
                json.put("content", parsrHtml(map.get("content").toString()));
                //json.put("content", parsrHtml(map.get("content").toString()));
                json.put("content", map.get("content").toString());
                // 添加日期
                json.put("czrq", DateUtil.dateToStrLong((Date) map.get("czrq")));
@ -365,11 +367,11 @@ public class DoctorHealthEduArticleController extends WeixinBaseController {
                    // 设置文章标识
                    heap.setArticle(a);
                    // 设置文章简介
                    heap.setContent(temp.getContent());
                    //heap.setContent(temp.getContent());
                    // 设置文章标题
                    heap.setTitle(temp.getTitle());
                    //heap.setTitle(temp.getTitle());
                    // 设置文章查看URL
                    heap.setUrl(temp.getUrl());
                    //heap.setUrl(temp.getUrl());
                    // 设置发送时间
                    heap.setCzrq(new Date());
                    // 设置医生标识

+ 3 - 2
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/health/HealthEduArticleController.java

@ -57,7 +57,7 @@ public class HealthEduArticleController extends BaseController {
	@ResponseBody
	public String list(@RequestParam("id")long id, @RequestParam("pagesize") int pagesize) {
		try {
			Page<HealthEduArticlePatient> list = healthEduArticlePatientService.findByPatient(getUID(), id, pagesize);
			List<HealthEduArticlePatient> list = healthEduArticlePatientService.findByPatient(getUID(), id, pagesize);
			JSONArray jsonArray = new JSONArray();
			Map<String,Doctor> docMap = new HashMap<>();
			if (list != null) {
@ -73,7 +73,8 @@ public class HealthEduArticleController extends BaseController {
					// 文章查看URL
					json.put("url", article.getUrl());
					// 文章简介
					json.put("content", parsrHtml(article.getContent()));
					//json.put("content", parsrHtml(article.getContent()));
					json.put("content", article.getContent());
					// 是否已读:0已读,1未读
					json.put("read", article.getRead());
					// 添加日期

+ 2 - 1
patient-co-wlyy/src/main/resources/system.properties

@ -62,7 +62,8 @@ chat_server=http://weixin.xmtyw.cn/res/chat/
sign_check_upload=http://172.19.103.87:8011/wlyy_service
# IM配置
im_list_get=http://172.19.103.29:3008/
#im_list_get=http://172.19.103.29:3008/
im_list_get=http://192.168.131.102:3008/
im_group_server=http://172.19.103.29:3000/api/v1/chats/gm
msg_push_server=http://172.19.103.29:3000/api/v1/chats/sm