Browse Source

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

chenweida 7 years ago
parent
commit
64c105892b

+ 24 - 17
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/health/PatientHealthIndexService.java

@ -483,28 +483,35 @@ public class PatientHealthIndexService extends BaseService {
            json.put("msg", content);
            json.put("data", "");
            array.put(json);
        }
        // 批量保存消息
        messageDao.save(messages);
        for (String receiver : receivers) {
            if (StringUtils.isEmpty(receiver)) {
                continue;
            }
            //            新增发送医生助手模板消息 v1.4.0 by wujunjie
            if (StringUtils.isNotEmpty(doctorOpenID)) {
                List<Message> messagesList = messageDao.findUnreadHealthIndex(patientCode, receiver);
                String url = doctorAssistant + "/wlyy/feldsher/sendDoctorTemplates";
                List<NameValuePair> params = new ArrayList<>();
                params.add(new BasicNameValuePair("type", "3"));
                params.add(new BasicNameValuePair("openId", doctorOpenID));
                params.add(new BasicNameValuePair("url", targetUrl));
                params.add(new BasicNameValuePair("first", doctorName + "医生,您的签约居民" + patientName +
                        "有" + messagesList.size() + "条未读的体征异常消息"));
                params.add(new BasicNameValuePair("remark", "请进入手机APP查看"));
                SimpleDateFormat format = new SimpleDateFormat("yyyy年MM月dd日 HH:mm");
                String date = format.format(new Date());
                String keywords = date + "," + patientName;
                params.add(new BasicNameValuePair("keywords", keywords));
                httpClientUtil.post(url, params, "UTF-8");
                if (messagesList != null && messagesList.size()>0){
                    String url = doctorAssistant + "/wlyy/feldsher/sendDoctorTemplates";
                    List<NameValuePair> params = new ArrayList<>();
                    params.add(new BasicNameValuePair("type", "3"));
                    params.add(new BasicNameValuePair("openId", doctorOpenID));
                    params.add(new BasicNameValuePair("url", targetUrl));
                    params.add(new BasicNameValuePair("first", doctorName + "医生,您的签约居民" + patientName +
                            "有" + messagesList.size() + "条未读的体征异常消息"));
                    params.add(new BasicNameValuePair("remark", "请进入手机APP查看"));
                    SimpleDateFormat format = new SimpleDateFormat("yyyy年MM月dd日 HH:mm");
                    String date = format.format(new Date());
                    String keywords = date + "," + patientName;
                    params.add(new BasicNameValuePair("keywords", keywords));
                    httpClientUtil.post(url, params, "UTF-8");
                }
            }
        }
        // 批量保存消息
        messageDao.save(messages);
        // 推送消息给医生
        pushMsgTask.put(array);
    }

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

@ -29,9 +29,12 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
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.http.MediaType;
import org.springframework.stereotype.Controller;
@ -40,6 +43,7 @@ import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@ -88,6 +92,12 @@ public class ConsultController extends WeixinBaseController {
    private PrescriptionDao prescriptionDao;
    @Autowired
    private ConsultDao consultDao;
    @Value("${doctorAssistant.api}")
    private String doctorAssistant;
    @Value("${doctorAssistant.target_url}")
    private String targetUrl;
    @Autowired
    private HttpClientUtil httpClientUtil;
    /**
@ -382,10 +392,40 @@ public class ConsultController extends WeixinBaseController {
            // 推送消息给医生
            if(dts==null||dts.length()==0){
                pushMsgTask.put(consult.getDoctor(), MessageType.MESSAGE_TYPE_DOCTOR_NEW_CONSULT_TEAM.D_CT_01.name(), MessageType.MESSAGE_TYPE_DOCTOR_NEW_CONSULT_TEAM.指定咨询.name(), MessageType.MESSAGE_TYPE_DOCTOR_NEW_CONSULT_TEAM.您有新的指定咨询.name(), consult.getConsult());
                Doctor doctor = doctorDao.findByCode(consult.getDoctor());
                if (doctor!=null && StringUtils.isNotEmpty(doctor.getOpenid())){
                    String url = doctorAssistant + "/wlyy/feldsher/sendDoctorTemplates";
                    List<NameValuePair> params = new ArrayList<>();
                    params.add(new BasicNameValuePair("type", "4"));
                    params.add(new BasicNameValuePair("openId", doctor.getOpenid()));
                    params.add(new BasicNameValuePair("url", targetUrl));
                    params.add(new BasicNameValuePair("first", doctor.getName() + "医生您好,有患者向您发起咨询"));
                    params.add(new BasicNameValuePair("remark", "请进入手机APP查看"));
                    String sex = consult.getSex()==1? "男" : "女";
                    String keywords = consult.getName() + "," + sex;
                    params.add(new BasicNameValuePair("keywords", keywords));
                    httpClientUtil.post(url, params, "UTF-8");
                }
            }else {
                for (int i=0;i<dts.length();i++){
                    String doctorCode = dts.getString(i);
                    pushMsgTask.put(doctorCode, MessageType.MESSAGE_TYPE_DOCTOR_NEW_CONSULT_TEAM.D_CT_01.name(), MessageType.MESSAGE_TYPE_DOCTOR_NEW_CONSULT_TEAM.指定咨询.name(), MessageType.MESSAGE_TYPE_DOCTOR_NEW_CONSULT_TEAM.您有新的指定咨询.name(), consult.getConsult());
                    Doctor doctor = doctorDao.findByCode(doctorCode);
                    if (doctor!=null && StringUtils.isNotEmpty(doctor.getOpenid())){
                        String url = doctorAssistant + "/wlyy/feldsher/sendDoctorTemplates";
                        List<NameValuePair> params = new ArrayList<>();
                        params.add(new BasicNameValuePair("type", "4"));
                        params.add(new BasicNameValuePair("openId", doctor.getOpenid()));
                        params.add(new BasicNameValuePair("url", targetUrl));
                        params.add(new BasicNameValuePair("first", doctor.getName() + "医生您好,有患者向您发起咨询"));
                        params.add(new BasicNameValuePair("remark", "请进入手机APP查看"));
                        String sex = consult.getSex()==1? "男" : "女";
                        String keywords = consult.getName() + "," + sex;
                        params.add(new BasicNameValuePair("keywords", keywords));
                        httpClientUtil.post(url, params, "UTF-8");
                    }
                }
            }
@ -756,6 +796,7 @@ public class ConsultController extends WeixinBaseController {
            for (ConsultTeamLog log : logs) {
//                String response = ImUtill.sendTopicIM(getUID(), patient.getName(), consult, String.valueOf(log.getType()), log.getContent());
                String response = ImUtill.sendTopicIM(getRepUID(), patient.getName(), consult, String.valueOf(log.getType()), log.getContent(),agent);
                if (StringUtils.isNotEmpty(response)) {
                    JSONObject resObj = new JSONObject(response);
                    if (resObj.getInt("status") == -1) {

+ 1 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/ehc/PatientEHCController.java

@ -36,7 +36,7 @@ public class PatientEHCController extends WeixinBaseController {
        try {
            String msg = null;
            int code = 0;
            String patient = getUID();
            String patient = getRepUID();
            String result = ehcService.EHCRedirecturl(patient);
            switch (result) {
                case "0":