فهرست منبع

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

lyr 8 سال پیش
والد
کامیت
67b59808f4

+ 10 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/entity/education/HealthEduArticle.java

@ -28,6 +28,8 @@ public class HealthEduArticle extends IdEntity {
	private String title;
	// 文章链接
	private String url;
	// 简介
	private String summary;
	// 文章内容
	private String content;
	// 发布时间
@ -67,6 +69,14 @@ public class HealthEduArticle extends IdEntity {
		this.url = url;
	}
	public String getSummary() {
		return summary;
	}
	public void setSummary(String summary) {
		this.summary = summary;
	}
	public String getContent() {
		return content;
	}

+ 10 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/entity/education/HealthEduArticlePatient.java

@ -45,6 +45,8 @@ public class HealthEduArticlePatient extends IdEntity {
	private Integer signType;
	// 行政团队
	private Long adminTeamCode;
	// 简介
	private String summary;
	public String getPatient() {
		return patient;
@ -135,4 +137,12 @@ public class HealthEduArticlePatient extends IdEntity {
	public void setAdminTeamCode(Long adminTeamCode) {
		this.adminTeamCode = adminTeamCode;
	}
	public String getSummary() {
		return summary;
	}
	public void setSummary(String summary) {
		this.summary = summary;
	}
}

+ 1 - 1
patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/patient/PatientHealthGuidanceDao.java

@ -55,6 +55,6 @@ public interface PatientHealthGuidanceDao extends PagingAndSortingRepository<Pat
	@Query("SELECT count(a) from PatientHealthGuidance a WHERE  a.patient=?2 and a.doctor=?1 ")
	Integer findbydoctorAndPatient(String doctor, String patientCode);
	@Query("select b.name, b.photo, a.id, a.content, a.czrq,b.level,b.code,a.adminTeamCode from PatientHealthGuidance a, Doctor b where a.doctor = b.code and a.patient = ?1 and a.adminTeamCode = ?2 and a.del = '1'")
	@Query("select b.name, b.photo, a.id, substring(a.content, 1, 50) as content, a.czrq,b.level,b.code,a.adminTeamCode from PatientHealthGuidance a, Doctor b where a.doctor = b.code and a.patient = ?1 and a.adminTeamCode = ?2 and a.del = '1'")
	Page<Object> findByPatientAndTeamCode(String patient, Long teamCode, Pageable pageable);
}

+ 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");

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

@ -42,12 +42,13 @@ public class HealthEduArticleService extends BaseService {
    /**
     * 保存福州健康教育文章
     *
     * @param result xml格式
     * @return
     * @throws Exception
     */
    public int saveHealthEduArticles(String result) throws Exception {
        List<Map<String,String>> listmap= Xml2ListMap.xml2List(result);
        List<Map<String, String>> listmap = Xml2ListMap.xml2List(result);
        String code = null;
        String title = null;
        String imgUrl = null;
@ -55,13 +56,13 @@ public class HealthEduArticleService extends BaseService {
        String keyWord = null;
        String type = null;
        int rows = 0;
        for(Map<String,String> temp : listmap){
        for (Map<String, String> temp : listmap) {
            code = temp.get("xml.Result.MessageId");
            title = temp.get("xml.Result.MessageTitle");
            imgUrl = temp.get("xml.Result.ImageUrlSmall");
            content = temp.get("xml.Result.MessageContent");
            keyWord = temp.get("xml.Result.MessageType");
            switch (keyWord){
            switch (keyWord) {
                case "1":
                    keyWord = "高血压";
                    type = "2";
@ -101,15 +102,19 @@ public class HealthEduArticleService extends BaseService {
            }
            String sql = "INSERT INTO wlyy_health_edu_article  " +
                    "VALUES(NULL,?,?,?,?,NULL,?,?)";
            rows = jdbcTemplate.update(sql,code,title,imgUrl,content,keyWord,type);
            rows+=rows;
                    "VALUES(NULL,?,?,?,?,?,NULL,?,?)";
            String summary = content.replaceAll("</?[^>]+>", "")
                    .replaceAll("<a>\\s*|\t|\r|\n</a>", "")
                    .replaceAll("&nbsp;", "").replaceAll(" ", "");
            rows = jdbcTemplate.update(sql, code, title, summary, imgUrl, content, keyWord, type);
            rows += rows;
        }
        return rows;
    }
    /**
     * 由请求参数获取福州健康教育文章
     *
     * @param params
     * @return
     * @throws Exception
@ -120,19 +125,19 @@ public class HealthEduArticleService extends BaseService {
//      获取远程地址url 、App Key 和 App secret  
        String prixUrl = SystemConf.getInstance().getYihuOpenPlatformUrl();
//        String prixUrl ="http://apitest.yihu.com.cn/OpenPlatform/cgiBin/1.0/";
        String appId =SystemConf.getInstance().getYihuOpenPlatformAppId();
        String appId = SystemConf.getInstance().getYihuOpenPlatformAppId();
//        String appId = "9000276";
        String secret = SystemConf.getInstance().getYihuOpenPlatformSecret();
//        String secret = "OKC8BS1KGXTDE9GPP1EO4VYLUXF8DJ7QUP72H613ZXA";
//      请求参数(i健康接口说明文档)正式接口 由prixUrl获取apixUrl
        String apiUrl = prixUrl+"jkjy/JkjyImpl/queryHealtheducationForIHealth";
        String apiUrl = prixUrl + "jkjy/JkjyImpl/queryHealtheducationForIHealth";
//      获取加密后参数集合
        Map<String,String> param = httpClientUtil.getSecretParams(params,appId,secret);
        Map<String, String> param = httpClientUtil.getSecretParams(params, appId, secret);
//      拼接请求URL (加密签名+apiUrl)
//      获取返回数据( HTTP post请求,参数需要utf-8编码)
        String  results = httpClientUtil.httpPost(apiUrl,param);
        String results = httpClientUtil.httpPost(apiUrl, param);
        return results;
@ -164,7 +169,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");
@ -212,7 +217,7 @@ public class HealthEduArticleService extends BaseService {
                "    ,a.title" +
                "    ,a.url" +
                "    ,a.czrq" +
                "    ,a.content" +
                "    ,a.summary content" +
                "    ,d.code" +
                "    ,d.name" +
                "    ,d.photo" +
@ -224,9 +229,9 @@ public class HealthEduArticleService extends BaseService {
                "    a.doctor = d.code " +
                "    and a.patient = ?" +
                "    and a.admin_team_code = ?" +
                "  order by a.czrq desc limit " + page*pageSize + "," + pageSize;
                "  order by a.czrq desc limit " + page * pageSize + "," + pageSize;
        List<Map<String,Object>> result = jdbcTemplate.queryForList(sql,new Object[]{patient,teamCode});
        List<Map<String, Object>> result = jdbcTemplate.queryForList(sql, new Object[]{patient, teamCode});
        return result;
    }

+ 31 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/service/common/util/ManageUtilService.java

@ -4,10 +4,14 @@ import com.yihu.wlyy.entity.doctor.team.sign.DoctorPatientGroupInfo;
import com.yihu.wlyy.entity.doctor.team.sign.DoctorTeam;
import com.yihu.wlyy.entity.doctor.team.sign.DoctorTeamInfo;
import com.yihu.wlyy.entity.doctor.team.sign.DoctorTeamMember;
import com.yihu.wlyy.entity.education.HealthEduArticle;
import com.yihu.wlyy.entity.education.HealthEduArticlePatient;
import com.yihu.wlyy.entity.patient.SignFamily;
import com.yihu.wlyy.repository.doctor.DoctorPatientGroupInfoDao;
import com.yihu.wlyy.repository.doctor.DoctorTeamDao;
import com.yihu.wlyy.repository.doctor.DoctorTeamMemberDao;
import com.yihu.wlyy.repository.education.HealthEduArticleDao;
import com.yihu.wlyy.repository.education.HealthEduArticlePatientDao;
import com.yihu.wlyy.repository.patient.SignFamilyDao;
import com.yihu.wlyy.service.BaseService;
import com.yihu.wlyy.util.IdCardUtil;
@ -44,6 +48,10 @@ public class ManageUtilService extends BaseService {
    DoctorTeamMemberDao teamMemberDao;
    @Autowired
    JpaTransactionManager transactionManager;
    @Autowired
    HealthEduArticleDao healthEduArticleDao;
    @Autowired
    HealthEduArticlePatientDao healthEduArticlePatientDao;
    public static int page = 0;
    public static List<Integer> errorPages = new ArrayList<>();
@ -516,4 +524,27 @@ public class ManageUtilService extends BaseService {
            throw new Exception(e.getMessage());
        }
    }
    @Transactional
    public void transformEduArticle() {
        Iterable<HealthEduArticle> articles = healthEduArticleDao.findAll();
        for (HealthEduArticle article : articles) {
            String content = article.getContent();
            content = content.replaceAll("</?[^>]+>", "")
                    .replaceAll("<a>\\s*|\t|\r|\n</a>", "")
                    .replaceAll("&nbsp;", "").replaceAll(" ",""); //剔出<html>的标签
            article.setSummary(content.length() > 50 ? content.substring(0, 49) : content);
        }
        Iterable<HealthEduArticlePatient> articlesPatient = healthEduArticlePatientDao.findAll();
        for (HealthEduArticlePatient article : articlesPatient) {
            String content = article.getContent();
            content = content.replaceAll("</?[^>]+>", "")
                    .replaceAll("<a>\\s*|\t|\r|\n</a>", "")
                    .replaceAll("&nbsp;", "").replaceAll(" ",""); //剔出<html>的标签
            article.setSummary(content.length() > 50 ? content.substring(0, 49) : content);
        }
    }
}

+ 15 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/common/util/ManagerUtilController.java

@ -219,4 +219,19 @@ public class ManagerUtilController extends BaseController {
        }
    }
    /**
     * 健康教育数据清洗
     *
     * @return
     */
    @RequestMapping(value = "/tranform_edu_article")
    public String tranformEduArticle(){
        try {
            manageUtilService.transformEduArticle();
            return write(200,"启动成功");
        } catch (Exception e) {
            return error(-1, "启动失败");
        }
    }
}

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

@ -101,7 +101,7 @@ public class DoctorHealthEduArticleController extends WeixinBaseController {
                    json.put("url", map.get("url"));
                    // 文章简介
                    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,7 @@ public class DoctorHealthEduArticleController extends WeixinBaseController {
                    // 文章查看URL
                    json.put("url", map.get("url"));
                    // 文章简介
                    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 +203,7 @@ public class DoctorHealthEduArticleController extends WeixinBaseController {
                json.put("url", map.get("url"));
                // 文章简介
                json.put("content", parsrHtml(map.get("content").toString()));
                json.put("content", map.get("content").toString());
                // 添加日期
                json.put("czrq", DateUtil.dateToStrLong((Date) map.get("czrq")));