Browse Source

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

trick9191 7 years ago
parent
commit
5771376eef

+ 35 - 0
patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/job/HealthMessageJob.java

@ -1,14 +1,19 @@
package com.yihu.wlyy.job;
import com.yihu.wlyy.entity.doctor.profile.Doctor;
import com.yihu.wlyy.entity.job.QuartzJobLog;
import com.yihu.wlyy.entity.message.Message;
import com.yihu.wlyy.entity.patient.SignFamily;
import com.yihu.wlyy.repository.doctor.DoctorDao;
import com.yihu.wlyy.repository.job.QuartzJobLogDao;
import com.yihu.wlyy.repository.message.MessageDao;
import com.yihu.wlyy.task.NoticeJobPushMsgTask;
import com.yihu.wlyy.util.DBExtract;
import com.yihu.wlyy.util.HttpClientUtil;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import org.apache.http.NameValuePair;
import org.apache.http.message.BasicNameValuePair;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
@ -43,6 +48,14 @@ public class HealthMessageJob implements Job {
    private JdbcTemplate jdbcTemplate;
    @Autowired
    private QuartzJobLogDao quartzJobLogDao;
    @Value("${doctorAssistant.api}")
    private String doctorAssistant;
    @Value("${doctorAssistant.target_url}")
    private String targetUrl;
    @Autowired
    private HttpClientUtil httpClientUtil;
    @Autowired
    private DoctorDao doctorDao;
    @Transactional
    public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
@ -112,6 +125,28 @@ public class HealthMessageJob implements Job {
                message.setReceiver(teamLeader);
                messageDao.save(message);
                quartzJobLogDao.save(quartzJobLog);
                try {
                    //            新增发送医生助手模板消息 v1.4.0 by wujunjie
                    Doctor doctor = doctorDao.findByCode(teamLeader);
                    String doctorOpenID = doctor.getOpenid();
                    if (!StringUtils.isEmpty(doctorOpenID)) {
                        String url = doctorAssistant + "/wlyy/feldsher/sendDoctorTemplates";
                        List<NameValuePair> sendParams = new ArrayList<>();
                        sendParams.add(new BasicNameValuePair("type", "9"));
                        sendParams.add(new BasicNameValuePair("openId", doctorOpenID));
                        sendParams.add(new BasicNameValuePair("url", targetUrl));
                        sendParams.add(new BasicNameValuePair("first", doctor.getName()+"医生您好。" + content));
                        sendParams.add(new BasicNameValuePair("remark", "请进入手机APP查看"));
                        SimpleDateFormat format = new SimpleDateFormat("yyyy年MM月dd日 HH:mm");
                        String date = format.format(new Date());
                        String keywords = "分配健管师" + "," + date  ;
                        sendParams.add(new BasicNameValuePair("keywords", keywords));
                        httpClientUtil.post(url, sendParams, "UTF-8");
                    }
                } catch (Exception e) {
                    e.printStackTrace();
                }
                // 异常通知
                JSONObject json = new JSONObject();

+ 4 - 0
patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/repository/followup/FollowUpDao.java

@ -24,6 +24,10 @@ public interface FollowUpDao extends PagingAndSortingRepository<Followup, Long>,
    @Query("select a from Followup a where a.creater = ?1 and a.followupDate between ?2 and ?3 and a.status <> '0'")
    List<Followup> findByCreater(String creater, Date begin, Date end, Pageable pageRequest) throws Exception;
    //查询未完成有效随访计划记录
    @Query("select a from Followup a where a.doctorCode = ?1 and a.followupPlanDate between ?2 and ?3 and a.status NOT IN ('0', '1') ")
    List<Followup> getByDoctorPlan(String doctor, Date begin, Date end) throws Exception;
    @Query(value = "select a.* from wlyy_followup a where a.doctor_code in ?1 and a.patient_code = ?2 and a.followup_class=?3 and a.status ='1' order by a.followup_date DESC limit 1",nativeQuery = true)
    Followup findLastFollowup(String[] doctors,String patientCode,String followClass) throws Exception;

+ 38 - 0
patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/service/app/followup/FollowUpService.java

@ -22,10 +22,14 @@ import com.yihu.wlyy.service.system.SystemDictService;
import com.yihu.wlyy.task.FollowupUploadTask;
import com.yihu.wlyy.task.PushMsgTask;
import com.yihu.wlyy.util.DateUtil;
import com.yihu.wlyy.util.HttpClientUtil;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.NameValuePair;
import org.apache.http.message.BasicNameValuePair;
import org.json.JSONArray;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
@ -34,6 +38,7 @@ import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Component;
import javax.transaction.Transactional;
import java.text.SimpleDateFormat;
import java.util.*;
/**
@ -82,6 +87,12 @@ public class FollowUpService extends BaseService {
    private PatientService patientService;
    @Autowired
    private PushMsgTask pushMsgTask;
    @Value("${doctorAssistant.api}")
    private String doctorAssistant;
    @Value("${doctorAssistant.target_url}")
    private String targetUrl;
    @Autowired
    private HttpClientUtil httpClientUtil;
    /**
@ -680,6 +691,33 @@ public class FollowUpService extends BaseService {
                    list.add(message);
                    // 推送消息给医生
                    pushMsgTask.put(doctor, "4", title, content, "");
                    try {
                        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
                        List<Followup> followups = followupDao.getByDoctorPlan(doctor,format.parse(start),format.parse(end));
                        for (Followup followup:followups) {
                            //            新增发送医生助手模板消息 v1.4.0 by wujunjie
                            Doctor doctor1 = doctorDao.findByCode(doctor);
                            String doctorOpenID = doctor1.getOpenid();
                            if (StringUtils.isNotEmpty(doctorOpenID)) {
                                String url = doctorAssistant + "/wlyy/feldsher/sendDoctorTemplates";
                                List<NameValuePair> params = new ArrayList<>();
                                params.add(new BasicNameValuePair("type", "6"));
                                params.add(new BasicNameValuePair("openId", doctorOpenID));
                                params.add(new BasicNameValuePair("url", targetUrl));
                                params.add(new BasicNameValuePair("first", "您今日有"+count+"个随访计划待处理"));
                                params.add(new BasicNameValuePair("remark", ""));
                                SimpleDateFormat formatDate = new SimpleDateFormat("yyyy年MM月dd日 HH:mm");
                                String newDate = formatDate.format(new Date());
                                String keywords = followup.getPatientName() + newDate + "," + "请进入手机APP查看";
                                params.add(new BasicNameValuePair("keywords", keywords));
                                httpClientUtil.post(url, params, "UTF-8");
                            }
                        }
                    } catch (Exception e) {
                        e.printStackTrace();
                    }
                }
                messageDao.save(list);

+ 4 - 0
patient-co/patient-co-wlyy-job/src/main/resources/application-dev.yml

@ -25,6 +25,10 @@ channel:
server:
  server_url: http://weixin.xmtyw.cn/wlyy-dev/
#医生助手服务器地址及模板跳转链接(医生未读消息统计页)
doctorAssistant:
  api: http://192.168.131.113:8080/
  target_url: home/html/unreadMessageStatistic.html
im:

+ 4 - 0
patient-co/patient-co-wlyy-job/src/main/resources/application-devtest.yml

@ -25,6 +25,10 @@ channel:
server:
  server_url: http://ehr.yihu.com/wlyy/
#医生助手服务器地址及模板跳转链接(医生未读消息统计页)
doctorAssistant:
  api: http://192.168.131.113:8080/
  target_url: home/html/unreadMessageStatistic.html
im:

+ 4 - 0
patient-co/patient-co-wlyy-job/src/main/resources/application-prod.yml

@ -26,6 +26,10 @@ channel:
server:
  server_url: http://www.xmtyw.cn/wlyy/
#医生助手服务器地址及模板跳转链接(医生未读消息统计页)
doctorAssistant:
  api: http://www.xmtyw.cn/assistant/
  target_url: home/html/unreadMessageStatistic.html
im:

+ 4 - 0
patient-co/patient-co-wlyy-job/src/main/resources/application-test.yml

@ -25,6 +25,10 @@ channel:
server:
  server_url: http://ehr.yihu.com/wlyy/
#医生助手服务器地址及模板跳转链接(医生未读消息统计页)
doctorAssistant:
  api: http://172.19.103.88:443/assistant/
  target_url: home/html/unreadMessageStatistic.html
im:

+ 4 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/followup/FollowUpDao.java

@ -28,6 +28,10 @@ public interface FollowUpDao extends PagingAndSortingRepository<Followup, Long>,
    @Query("select a from Followup a where a.doctorCode = ?1 and a.followupDate between ?2 and ?3 and a.status NOT IN ('0', '1') ")
    List<Followup> getByDoctor(String doctor, Date begin, Date end) throws Exception;
    //查询未完成有效随访计划记录
    @Query("select a from Followup a where a.doctorCode = ?1 and a.followupPlanDate between ?2 and ?3 and a.status NOT IN ('0', '1') ")
    List<Followup> getByDoctorPlan(String doctor, Date begin, Date end) throws Exception;
    @Query("select a from Followup a where a.creater = ?1 and a.followupDate between ?2 and ?3 and a.status <> '0'")
    List<Followup> findByCreater(String creater, Date begin, Date end, Pageable pageRequest) throws Exception;

+ 25 - 19
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/followup/FollowUpService.java

@ -866,25 +866,31 @@ public class FollowUpService extends BaseService {
                    pushMsgTask.put(doctor, "4", title, content, "");
                    //            新增发送医生助手模板消息 v1.4.0 by wujunjie
                    SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
                    List<Followup> followups = followupDao.getByDoctor(doctor, format.parse(start), format.parse(end));
                    Doctor doctor1 = doctorDao.findByCode(doctor);
                    String doctorOpenID = doctor1.getOpenid();
                    if (StringUtils.isNotEmpty(doctorOpenID)) {
                        String url = doctorAssistant + "/wlyy/feldsher/sendDoctorTemplates";
                        List<NameValuePair> params = new ArrayList<>();
                        params.add(new BasicNameValuePair("type", "6"));
                        params.add(new BasicNameValuePair("openId", doctorOpenID));
                        params.add(new BasicNameValuePair("url", targetUrl));
                        params.add(new BasicNameValuePair("first", "您今日有1个随访计划待处理"));
                        params.add(new BasicNameValuePair("remark", ""));
                        SimpleDateFormat formatDate = new SimpleDateFormat("yyyy年MM月dd日 HH:mm");
                        String newDate = formatDate.format(new Date());
                        String keywords = "patientName" + newDate + "," + "请进入手机APP查看";
                        params.add(new BasicNameValuePair("keywords", keywords));
                        httpClientUtil.post(url, params, "UTF-8");
                    try {
                        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
                        List<Followup> followups = followupDao.getByDoctorPlan(doctor,format.parse(start),format.parse(end));
                        for (Followup followup:followups) {
                            //            新增发送医生助手模板消息 v1.4.0 by wujunjie
                            Doctor doctor1 = doctorDao.findByCode(doctor);
                            String doctorOpenID = doctor1.getOpenid();
                            if (StringUtils.isNotEmpty(doctorOpenID)) {
                                String url = doctorAssistant + "/wlyy/feldsher/sendDoctorTemplates";
                                List<NameValuePair> params = new ArrayList<>();
                                params.add(new BasicNameValuePair("type", "6"));
                                params.add(new BasicNameValuePair("openId", doctorOpenID));
                                params.add(new BasicNameValuePair("url", targetUrl));
                                params.add(new BasicNameValuePair("first", "您今日有"+count+"个随访计划待处理"));
                                params.add(new BasicNameValuePair("remark", ""));
                                SimpleDateFormat formatDate = new SimpleDateFormat("yyyy年MM月dd日 HH:mm");
                                String newDate = formatDate.format(new Date());
                                String keywords = followup.getPatientName() + newDate + "," + "请进入手机APP查看";
                                params.add(new BasicNameValuePair("keywords", keywords));
                                httpClientUtil.post(url, params, "UTF-8");
                            }
                        }
                    } catch (Exception e) {
                        e.printStackTrace();
                    }
                }

+ 33 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/prescription/PatientPrescriptionPayService.java

@ -33,6 +33,7 @@ import com.yihu.wlyy.service.weixin.wxpay.model.BindCard;
import com.yihu.wlyy.service.weixin.wxpay.model.Charge;
import com.yihu.wlyy.service.weixin.wxpay.service.OnePayService;
import com.yihu.wlyy.task.PushMsgTask;
import com.yihu.wlyy.util.HttpClientUtil;
import com.yihu.wlyy.util.MessageType;
import com.yihu.wlyy.util.SystemConf;
import com.yihu.wlyy.web.wx.OnePayController;
@ -42,6 +43,8 @@ import com.ylzinfo.onepay.sdk.domain.ResponseParams;
import com.ylzinfo.onepay.sdk.utils.DateUtil;
import com.ylzinfo.onepay.sdk.utils.StringUtil;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.NameValuePair;
import org.apache.http.message.BasicNameValuePair;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@ -81,6 +84,14 @@ public class PatientPrescriptionPayService extends BaseService {
    //    Java配置文件 后续删除
    private String signType = "MD5";
    private String encryptType = "AES";
    @Value("${doctorAssistant.api}")
    private String doctorAssistant;
    @Value("${doctorAssistant.target_url}")
    private String targetUrl;
    @Autowired
    private HttpClientUtil httpClientUtil;
    @Autowired
    private DoctorDao doctorDao;
    //    引入实例
    @Autowired
@ -743,6 +754,28 @@ public class PatientPrescriptionPayService extends BaseService {
                            message.setState(1);//已发送
                            message.setCzrq(new Date());
                            messageDao.save(message);
                            try {
                                //            新增发送医生助手模板消息 v1.4.0 by wujunjie
                                Doctor doctor = doctorDao.findByCode(receiver);
                                String doctorOpenID = doctor.getOpenid();
                                if (StringUtils.isNotEmpty(doctorOpenID)) {
                                        String url = doctorAssistant + "/wlyy/feldsher/sendDoctorTemplates";
                                        List<NameValuePair> sendParams = new ArrayList<>();
                                        sendParams.add(new BasicNameValuePair("type", "9"));
                                        sendParams.add(new BasicNameValuePair("openId", doctorOpenID));
                                        sendParams.add(new BasicNameValuePair("url", targetUrl));
                                        sendParams.add(new BasicNameValuePair("first", doctor.getName()+"医生您好。" + content + ",一个尽快分配。"));
                                        sendParams.add(new BasicNameValuePair("remark", "请进入手机APP查看"));
                                        SimpleDateFormat format = new SimpleDateFormat("yyyy年MM月dd日 HH:mm");
                                        String date = format.format(new Date());
                                        String keywords = "分配配送员" + "," + date  ;
                                        sendParams.add(new BasicNameValuePair("keywords", keywords));
                                        httpClientUtil.post(url, sendParams, "UTF-8");
                                }
                            } catch (Exception e) {
                                e.printStackTrace();
                            }
                        }
                        //支付成功生成二维码
                        result = prescriptionCode;