浏览代码

Merge branch 'dev' of wujunjie/patient-management into dev

trick9191 8 年之前
父节点
当前提交
f74d205382

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

@ -56,6 +56,8 @@ public class HealthEduArticlePatient extends IdEntity {
	//签约表code
	private String signCode;
	private Integer articleId;
	public String getBatchNo() {
		return batchNo;
	}
@ -178,4 +180,12 @@ public class HealthEduArticlePatient extends IdEntity {
	public void setSignCode(String signCode) {
		this.signCode = signCode;
	}
	@Transient
	public Integer getArticleId() {
		return articleId;
	}
	public void setArticleId(Integer articleId) {
		this.articleId = articleId;
	}
}

+ 18 - 7
patient-co-wlyy/src/main/java/com/yihu/wlyy/job/SignAgainJob.java

@ -1,11 +1,13 @@
package com.yihu.wlyy.job;
import com.google.zxing.datamatrix.encoder.SymbolShapeHint;
import com.sun.org.apache.xpath.internal.operations.Bool;
import com.yihu.wlyy.entity.patient.Patient;
import com.yihu.wlyy.repository.patient.PatientDao;
import com.yihu.wlyy.service.common.account.PatientService;
import com.yihu.wlyy.util.DateUtil;
import com.yihu.wlyy.util.SendNews;
import com.yihu.wlyy.util.SystemConf;
import com.yihu.wlyy.web.BaseController;
import com.yihu.wlyy.web.WeixinBaseController;
import com.yihu.wlyy.web.common.account.WechatController;
@ -19,10 +21,8 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.web.context.support.SpringBeanAutowiringSupport;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;
import java.util.Map;
import java.text.SimpleDateFormat;
import java.util.*;
/**
 * Created by Reece on 2017/5/18.
@ -37,9 +37,20 @@ public class SignAgainJob extends WeixinBaseController implements Job {
            System.out.println("sign again job start");
            SpringBeanAutowiringSupport.processInjectionBasedOnCurrentContext(this);
            System.out.println(" ============job ===========>");
            String accessToken = getAccessToken();
            List<String> openIds = patientDao.findOpenids();
            SendNews.sendNews(accessToken,openIds);
            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
            String trigger = SystemConf.getInstance().getSystemProperties().getProperty("sign_again_job_end");
            Date nowDate = new Date();
            Date endTime = sdf.parse(trigger);
            Boolean flag = nowDate.before(endTime);
            System.out.println(flag);
//            如果当期时间在截止时间之前,发送图文,否则不发送
            if (nowDate.before(endTime)){
                String accessToken = getAccessToken();
                List<String> openIds = patientDao.findOpenids();
                System.out.println("accessToken ---> "+ accessToken);
                System.out.println("openIds --> "+openIds.size());
                SendNews.sendNews(accessToken,openIds);
            }
            System.out.println(" ==============================>");
            System.out.println("sign again job end");
        } catch (Exception e) {

+ 24 - 7
patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/consult/ConsultTeamService.java

@ -22,6 +22,7 @@ import com.yihu.wlyy.repository.doctor.DoctorPatientDao;
import com.yihu.wlyy.repository.doctor.DoctorTeamDao;
import com.yihu.wlyy.repository.doctor.DoctorTeamMemberDao;
import com.yihu.wlyy.repository.patient.SignFamilyDao;
import com.yihu.wlyy.service.app.health.HealthEduArticleService;
import com.yihu.wlyy.service.app.health.PatientHealthGuidanceService;
import com.yihu.wlyy.service.app.talk.TalkGroupService;
import com.yihu.wlyy.task.PushMsgTask;
@ -81,6 +82,10 @@ public class ConsultTeamService extends ConsultService {
    private JdbcTemplate jdbcTemplate;
    @Autowired
    private PatientHealthGuidanceService guidanceService;
    @Autowired
    private HealthEduArticleService healthEduArticleService;
    @Autowired
    private TalkGroupService talkGroupService;
    @Autowired
@ -745,10 +750,7 @@ public class ConsultTeamService extends ConsultService {
        consult.setGuidance(ct.getGuidance());
        // 设置咨询标识
        ct.setConsult(consult.getCode());
        // 保存医生咨询信息
        // 添加咨询转发记录
        // 添加医生咨询日志
        String content = addLogs(ct);
        //推送给IM去创建议题,取得成员消息
//        JSONObject messages = ImUtill.getCreateTopicMessage(patient, tempPatient.getName(), consult.getTitle(), "咨询问题:"+consult.getSymptoms(), consult.getImages());
        JSONObject messages = ImUtill.getCreateTopicMessage(patient, tempPatient.getName(), consult.getTitle(), consult.getSymptoms(), consult.getImages());
@ -772,6 +774,12 @@ public class ConsultTeamService extends ConsultService {
            cd.setTo(key);
            consultTeamDoctorDao.save(cd);
        }
        // 保存医生咨询信息
        // 添加咨询转发记录
        // 添加医生咨询日志
        String content = addLogs(ct);
        return 1;
    }
@ -826,12 +834,21 @@ public class ConsultTeamService extends ConsultService {
        String content = "";
        if (ct.getGuidance() != null && ct.getGuidance() > 0) {
            //先判断从健康指导转咨询是否存在指导。
            JSONObject json = guidanceService.findById(ct.getGuidance());
            if (json == null) {
                throw new Exception("guidance not exist");
                //再判断从健康教育文章转咨询是否存在文章 20170602
                Object article = healthEduArticleService.findArticleById(ct.getGuidance());
                if(article == null) {
                    throw new Exception("guidance not exist");
                }
            }else{
                content += "医生" + (json.get("doctorName") != null ? json.get("doctorName").toString() : "")
                        + "发出的指导:" + (json.getString("content") != null ? json.getString("content").toString() : "") + "<br/>";
            }
            content += "医生" + (json.get("doctorName") != null ? json.get("doctorName").toString() : "")
                    + "发出的指导:" + (json.getString("content") != null ? json.getString("content").toString() : "") + "<br/>";
        }
        content += "咨询问题:" + (StringUtils.isEmpty(ct.getSymptoms()) ? "无" : ct.getSymptoms());

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

@ -112,6 +112,7 @@ public class HealthEduArticlePatientService extends BaseService {
                "    ,a.is_read as 'read'" +
                "    ,a.czrq" +
                "    ,a.attached_content" +
                "    ,b.id as article_id" +
                " from" +
                "     wlyy_health_edu_article_patient a" +
                "     , wlyy_health_edu_article b" +

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

@ -157,6 +157,10 @@ public class HealthEduArticleService extends BaseService {
        return healthEduArticleDao.findByCode(code);
    }
    public HealthEduArticle findArticleById(Long id) {
        return healthEduArticleDao.findOne(id);
    }
    /**
     * 获取文章列表
     *

+ 8 - 2
patient-co-wlyy/src/main/java/com/yihu/wlyy/util/SendNews.java

@ -46,7 +46,9 @@ public class SendNews {
     */
    public static String uploadImage(String url, String filePath) throws IOException {
        String result = null;
        filePath = "http:///ehr.yihu.com/wlyy/images/renew.png";
        File file = new File(filePath);
        System.out.println("file  ====> "+file);
        if (!file.exists() || !file.isFile()) {
            throw new IOException("文件不存在");
        }
@ -153,20 +155,24 @@ public class SendNews {
        return json;
    }
    public static void sendNews(String accessToken,List<String> openIds) throws Exception {
    public static void sendNews(String accessToken, List<String> openIds) throws Exception {
        // 配置信息
        Properties systemConf = SystemConf.getInstance().getSystemProperties();
        //本地上传图片的路径及跳转路径
        String renewPath = systemConf.getProperty("patient_sign_again_pic_url");
        renewPath = renewPath.replace("{server}", systemConf.getProperty("server_url"));
        String renewUrl = systemConf.getProperty("patient_sign_again_url");
        String signPath = systemConf.getProperty("doctor_qrcode_pic_url");
        signPath = signPath.replace("{server}", systemConf.getProperty("server_url"));
        String signUrl = systemConf.getProperty("doctor_subscribe_url");
        String sendUrl = "http://api.weixin.qq.com/cgi-bin/media/uploadimg?access_token=ACCESS_TOKEN&type=image";
        String mediaurl = "https://api.weixin.qq.com/cgi-bin/media/uploadnews?access_token=ACCESS_TOKEN";//ACCESS_TOKEN是获取到的access_token
        String groupUrl = "https://api.weixin.qq.com/cgi-bin/message/mass/send?access_token=ACCESS_TOKEN";//根据openid发群发消息地址
        sendUrl = sendUrl.replace("ACCESS_TOKEN", accessToken);
        System.out.println("renewPath --> "+renewPath);
        System.out.println("signPath  --> "+signPath);
        String renewImage = SendNews.uploadImage(sendUrl, renewPath);
        String signImage = SendNews.uploadImage(sendUrl, signPath);

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

@ -327,12 +327,8 @@ public class ManagerUtilController extends BaseController {
    @ResponseBody
    public String startSignAgainJob() {
        try {
            if (!quartzHelper.isExistJob("start_sign_again_job")) {
                quartzHelper.startNow(SignAgainJob.class, "start_sign_again_job", new HashMap<String, Object>());
                return write(200, "启动成功");
            } else {
                return write(200, "任务已存在");
            }
            quartzHelper.startNow(SignAgainJob.class, "start_sign_again_job"+UUID.randomUUID(), new HashMap<String, Object>());
            return write(200, "启动成功");
        } catch (Exception e) {
            return error(-1, "启动失败");
        }

+ 4 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/consult/ConsultController.java

@ -273,6 +273,8 @@ public class ConsultController extends WeixinBaseController {
                      @RequestParam(required = false) String voice,
                      @RequestParam(required = false) Long guidance) {
        try {
            System.out.println("guidance1="+guidance);
            System.out.println("symptoms="+symptoms);
            if (type == null) {
                type = 1;
            }
@ -314,6 +316,8 @@ public class ConsultController extends WeixinBaseController {
            if (guidance != null && guidance > 0) {
                consult.setGuidance(guidance);
            }
            System.out.println("guidance2="+guidance);
            // 保存到数据库
            int res = consultTeamService.addTeamConsult(consult, getUID());
            if (res == -1) {

+ 1 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/health/HealthEduArticleController.java

@ -69,6 +69,7 @@ public class HealthEduArticleController extends BaseController {
                for (HealthEduArticlePatient article : list) {
                    JSONObject json = new JSONObject();
                    json.put("id", article.getId());
                    json.put("article_id", article.getArticleId());
                    // 文章标识
                    json.put("article", article.getArticle());
                    // 医生姓名