Преглед изворни кода

Merge branch 'dev' of http://192.168.1.220:10080/Amoy/patient-co-management into dev

wangzhinan пре 7 година
родитељ
комит
70aacef4af
31 измењених фајлова са 1499 додато и 130 уклоњено
  1. 20 8
      patient-co-service/wlyy_device/src/main/java/com/yihu/hos/device/service/AsyncService.java
  2. 15 5
      patient-co-service/wlyy_device/src/main/java/com/yihu/hos/device/service/DeviceService.java
  3. 4 4
      patient-co-service/wlyy_device/src/main/resources/application.yml
  4. 1 1
      patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/service/JMService.java
  5. 18 0
      patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/event/ApplicationEvent.java
  6. 67 0
      patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/job/specialist/EightSpecialistJob.java
  7. 69 0
      patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/job/specialist/SixteenSpecialistJob.java
  8. 41 0
      patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/util/http/HttpResponse.java
  9. 384 0
      patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/util/http/HttpUtils.java
  10. 54 0
      patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/util/http/IPInfoUtils.java
  11. 34 0
      patient-co/patient-co-wlyy/doc/技术文档/es/推送日志记录新增索引
  12. 3 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/patient/SignFamilyDao.java
  13. 2 2
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/family/FamilyService.java
  14. 1 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/health/bank/TaskService.java
  15. 1 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/message/MessageService.java
  16. 2 3
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/statisticsES/StatisticsESService.java
  17. 78 15
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/specialist/RehabilitationPlanService.java
  18. 21 14
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/specialist/SpecialistEvaluateSevice.java
  19. 212 4
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/specialist/rehabilitation/RehabilitationManageService.java
  20. 19 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/util/ImUtill.java
  21. 46 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/common/job/SpecialistRehabilitationJob.java
  22. 1 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/data/DataHandingService.java
  23. 19 5
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/device/DoctorDeviceController.java
  24. 2 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/jimeiJkEdu/DoctorJMJkEduArticleController.java
  25. 7 7
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/message/DoctorMessageController.java
  26. 157 9
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/specialist/rehabilitation/RehabilitationManageController.java
  27. 5 5
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/device/PatientDeviceController.java
  28. 137 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/specialist/rehabilitation/PatientRehabilitationManageController.java
  29. 12 5
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/statistic/EsStatisticsController.java
  30. 62 38
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/third/specialist/ThirdRehabilitationPlanController.java
  31. 5 2
      patient-co/patient-co-wlyy/src/main/resources/application-dev.yml

+ 20 - 8
patient-co-service/wlyy_device/src/main/java/com/yihu/hos/device/service/AsyncService.java

@ -598,7 +598,19 @@ public class AsyncService extends BaseService{
                flagStr="GLU_MEASURE";
            }
            PatientDevice patientDevice = patientDeviceDao.findByDeviceSnAndCategoryCodeAndUserType(deviceSn,type,userType);
            //根据设备获取患者(设备只绑定一个人的时候,不判断按键)
            List<PatientDevice> patientDeviceList =  patientDeviceDao.findByDeviceSnAndCategoryCode(deviceSn, type);
            PatientDevice patientDevice = null;
            if (patientDeviceList != null&&patientDeviceList.size()==1) {
                patientDevice = patientDeviceList.get(0);
            }else if(patientDeviceList != null&&patientDeviceList.size()==2){
                for (int i=0;i<patientDeviceList.size();i++){
                    if(userType.equals(patientDeviceList.get(i).getUserType())){
                        patientDevice = patientDeviceList.get(i);
                        break;
                    }
                }
            }
            boolean dataUoloadCount = true;
            if (patientDevice!=null){
                //String today = DateUtil.getStringDateShort();
@ -617,17 +629,17 @@ public class AsyncService extends BaseService{
                //判断今天是否加过体征积分
                String urlSearch = wlyyService + "healthBank/selectByDate";
                List<NameValuePair> paramsSearch1 = new ArrayList<>();
                paramsSearch1.add(new BasicNameValuePair("objectStr", "{\"taskCode\":\"BP_MEASURE\",\"startTime\":\""+uploadTime+"\",\"endTime\":\""+uploadTime+"\",\"patientId\":\""+patientCode+"\"}"));
                paramsSearch1.add(new BasicNameValuePair("objectStr", "{\"taskCode\":\""+flagStr+"\",\"startTime\":\""+uploadTime+"\",\"endTime\":\""+uploadTime+"\",\"patientId\":\""+patientCode+"\"}"));
                String responseSearch1 = HttpClientUtil.post(urlSearch, paramsSearch1, "UTF-8");
                List<NameValuePair> paramsSearch2 = new ArrayList<>();
               /* List<NameValuePair> paramsSearch2 = new ArrayList<>();
                paramsSearch2.add(new BasicNameValuePair("objectStr", "{\"taskCode\":\"GLU_MEASURE\",\"startTime\":\""+uploadTime+"\",\"endTime\":\""+uploadTime+"\",\"patientId\":\""+patientCode+"\"}"));
                String responseSearch2 = HttpClientUtil.post(urlSearch, paramsSearch2, "UTF-8");
                String responseSearch2 = HttpClientUtil.post(urlSearch, paramsSearch2, "UTF-8");*/
                com.alibaba.fastjson.JSONObject object1 = com.alibaba.fastjson.JSONObject.parseObject(responseSearch1);
                com.alibaba.fastjson.JSONObject object2 = com.alibaba.fastjson.JSONObject.parseObject(responseSearch2);
                if(object1!=null && object2!=null){
                //com.alibaba.fastjson.JSONObject object2 = com.alibaba.fastjson.JSONObject.parseObject(responseSearch2);
                if(object1!=null){
                    com.alibaba.fastjson.JSONObject jsonObject1 = (com.alibaba.fastjson.JSONObject) object1.getJSONObject("data").getJSONArray("detailModelList").get(0);
                    com.alibaba.fastjson.JSONObject jsonObject2 = (com.alibaba.fastjson.JSONObject) object2.getJSONObject("data").getJSONArray("detailModelList").get(0);
                    if (jsonObject1.getJSONArray("creditsDetailDOS").size()==0 && jsonObject2.getJSONArray("creditsDetailDOS").size()==0){
                    //com.alibaba.fastjson.JSONObject jsonObject2 = (com.alibaba.fastjson.JSONObject) object2.getJSONObject("data").getJSONArray("detailModelList").get(0);
                    if (jsonObject1.getJSONArray("creditsDetailDOS").size()==0){
                        dataUoloadCount = false;
                    }
                }

+ 15 - 5
patient-co-service/wlyy_device/src/main/java/com/yihu/hos/device/service/DeviceService.java

@ -427,7 +427,7 @@ public class DeviceService extends BaseService{
                String patientCode = result.getUser();
                Patient patient = patientDao.findByCode(patientCode);
                asyncService.addIntegral(deviceSn,type,userType,patientCode,deviceType);
                asyncService.addIntegral(deviceSn,type,userType,patientCode,deviceType,uploadTime);
                //血糖、血压数据需校验,如果超标,需要发送消息给医生
	            if (1 == deviceType || 2 == deviceType) {
                    asyncService.verifyHealthIndex(result);
@ -471,10 +471,20 @@ public class DeviceService extends BaseService{
            userType = "-1";
        }
        //根据设备获取患者
        PatientDevice device = patientDeviceDao.findByDeviceSnAndCategoryCodeAndUserType(deviceSn, type, userType);
        if (device != null) {
        //根据设备获取患者(设备只绑定一个人的时候,不判断按键)
        List<PatientDevice> patientDeviceList =  patientDeviceDao.findByDeviceSnAndCategoryCode(deviceSn, type);
        PatientDevice device = null;
        if (patientDeviceList != null&&patientDeviceList.size()==1) {
            device = patientDeviceList.get(0);
        }else if(patientDeviceList != null&&patientDeviceList.size()==2){
            for (int i=0;i<patientDeviceList.size();i++){
                if(userType.equals(patientDeviceList.get(i).getUserType())){
                    device = patientDeviceList.get(i);
                    break;
                }
            }
        }
        if (device!=null) {
            /************设备数据重复推送处理 start**********************/
            String value1 = data;
            if("2".equals(type)){

+ 4 - 4
patient-co-service/wlyy_device/src/main/resources/application.yml

@ -26,9 +26,9 @@ spring:
spring:
  profiles: dev
  datasource:
    url: jdbc:mysql://172.19.103.77:3306/device?useUnicode=true&characterEncoding=utf-8&autoReconnect=true
    username: root
    password: 123456
    url: jdbc:mysql://172.19.103.85:3306/device?useUnicode=true&characterEncoding=utf-8&autoReconnect=true
    username: linzhou
    password: linzhou
    driverClassName: com.mysql.jdbc.Driver
    maxTotal: 500
    maxIdle: 30
@ -58,7 +58,7 @@ healthStandard:
systemConfig:
  msg_push_server: http://127.0.0.1:3000/system/sendmsg.im
  jw_server: http://172.19.103.87:8011/wlyy_service
  socket_server: http://192.168.131.102:3008
  socket_server: http://192.168.131.24:3000
  server_url: http://192.168.131.24:8080/
# Specify the DBMS
#医生助手服务器地址及模板跳转链接(医生未读消息统计页)

+ 1 - 1
patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/service/JMService.java

@ -442,7 +442,7 @@ public class JMService {
        return re;
    }
    private String apiString = "Action";
    private String apiString = "";
    /**
     * 获取口令,4小时有效,465439011

+ 18 - 0
patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/event/ApplicationEvent.java

@ -4,6 +4,8 @@ import com.yihu.wlyy.job.*;
import com.yihu.wlyy.job.consult.EvaluateScoreJob;
import com.yihu.wlyy.job.consult.FinishConsultJob;
import com.yihu.wlyy.job.consult.ParticipantsCleanJob;
import com.yihu.wlyy.job.specialist.EightSpecialistJob;
import com.yihu.wlyy.job.specialist.SixteenSpecialistJob;
import com.yihu.wlyy.redis.RedisThread;
import com.yihu.wlyy.util.SystemConf;
import org.slf4j.Logger;
@ -264,6 +266,22 @@ public class ApplicationEvent implements ApplicationListener<ContextRefreshedEve
                logger.info("patient_medicare_number_job  job exist");
            }
            //康复计划每天8点发送服务执行进展
            if (!quartzHelper.isExistJob(EightSpecialistJob.jobKey)) {
                quartzHelper.addJob(EightSpecialistJob.class, EightSpecialistJob.jobCron, EightSpecialistJob.jobKey, new HashMap<String, Object>());
                logger.info("NoticeJob  job success");
            } else {
                logger.info("NoticeJob  job exist");
            }
            //康复计划每天16点发送服务执行进展
            if (!quartzHelper.isExistJob(SixteenSpecialistJob.jobKey)) {
                quartzHelper.addJob(SixteenSpecialistJob.class, SixteenSpecialistJob.jobCron, SixteenSpecialistJob.jobKey, new HashMap<String, Object>());
                logger.info("NoticeJob  job success");
            } else {
                logger.info("NoticeJob  job exist");
            }
        } catch (Exception e) {
            logger.info("sign end job start failed");
        }

+ 67 - 0
patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/job/specialist/EightSpecialistJob.java

@ -0,0 +1,67 @@
package com.yihu.wlyy.job.specialist;
import com.yihu.wlyy.entity.job.QuartzJobLog;
import com.yihu.wlyy.repository.job.QuartzJobLogDao;
import com.yihu.wlyy.util.DateUtil;
import com.yihu.wlyy.util.HttpClientUtil;
import com.yihu.wlyy.util.http.HttpResponse;
import com.yihu.wlyy.util.http.HttpUtils;
import org.apache.commons.collections.map.HashedMap;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import java.util.Date;
import java.util.Map;
/**
 * Created by Administrator on 2016/11/7.
 */
@Component
@Scope("prototype")
public class EightSpecialistJob implements Job {
    public static String jobKey = "Specialist_Rehabilitation_8_JOB";
    public static String jobCron = "0 0 8 * * ?"; //每天8点
    @Autowired
    private String serverUrl;
    @Autowired
    private QuartzJobLogDao dbStorage;
    @Autowired
    private HttpClientUtil httpClientUtil;
    private String dailyJobSendMessage = "/specialist/job/dailyJobSendMessage";//康复管理-每天推送项目进展
    @Transactional
    public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
        //新建任务日志对象
        QuartzJobLog quartzJobLog = new QuartzJobLog();
        quartzJobLog.setJobStartTime(new Date());
        quartzJobLog.setJobId(jobKey);
        quartzJobLog.setJobName(jobKey);
        try {
            String startTime = DateUtil.getStringDateShort()+" "+"00:00:00";
            String endTime = DateUtil.getStringDateShort()+" "+"23:59:59";
            Map<String, Object> param = new HashedMap();
            param.put("startTime", startTime);
            param.put("endTime", endTime);
            param.put("type", 23);
            HttpResponse response = HttpUtils.doPost(serverUrl + dailyJobSendMessage, param);
        }catch (Exception e){
            //保存日志
            quartzJobLog.setJobEndTime(new Date());
            quartzJobLog.setJobContent("通知失败");
            quartzJobLog.setJobType("0");
            dbStorage.save(quartzJobLog);
            e.printStackTrace();
        }
    }
}

+ 69 - 0
patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/job/specialist/SixteenSpecialistJob.java

@ -0,0 +1,69 @@
package com.yihu.wlyy.job.specialist;
import com.yihu.wlyy.entity.job.QuartzJobLog;
import com.yihu.wlyy.repository.job.QuartzJobLogDao;
import com.yihu.wlyy.util.DateUtil;
import com.yihu.wlyy.util.HttpClientUtil;
import com.yihu.wlyy.util.http.HttpResponse;
import com.yihu.wlyy.util.http.HttpUtils;
import org.apache.commons.collections.map.HashedMap;
import org.apache.http.NameValuePair;
import org.apache.http.message.BasicNameValuePair;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
 * Created by Administrator on 2016/11/7.
 */
@Component
@Scope("prototype")
public class SixteenSpecialistJob implements Job {
    public static String jobKey = "Specialist_Rehabilitation_16_JOB";
    public static String jobCron = "0 0 16 * * ?"; //每天8点,14点,20 点执行一次
    @Autowired
    private String serverUrl;
    @Autowired
    private QuartzJobLogDao dbStorage;
    @Autowired
    private HttpClientUtil httpClientUtil;
    private String dailyJobSendMessage = "/specialist/job/dailyJobSendMessage";//康复管理-每天推送项目进展
    @Transactional
    public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
        //新建任务日志对象
        QuartzJobLog quartzJobLog = new QuartzJobLog();
        quartzJobLog.setJobStartTime(new Date());
        quartzJobLog.setJobId(jobKey);
        quartzJobLog.setJobName(jobKey);
        try {
            String startTime = DateUtil.getStringDateShort()+" "+"00:00:00";
            String endTime = DateUtil.getStringDateShort()+" "+"23:59:59";
            Map<String, Object> param = new HashedMap();
            param.put("startTime", startTime);
            param.put("endTime", endTime);
            param.put("type", 22);
            HttpResponse response = HttpUtils.doPost(serverUrl + dailyJobSendMessage, param);
        }catch (Exception e){
            //保存日志
            quartzJobLog.setJobEndTime(new Date());
            quartzJobLog.setJobContent("通知失败");
            quartzJobLog.setJobType("0");
            dbStorage.save(quartzJobLog);
            e.printStackTrace();
        }
    }
}

+ 41 - 0
patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/util/http/HttpResponse.java

@ -0,0 +1,41 @@
package com.yihu.wlyy.util.http;
/**
 * Utils - Http请求辅助类,简化页面页面判断逻辑
 * Created by progr1mmer on 2018/1/16.
 */
public class HttpResponse {
    private int status;
    private String content;
    public HttpResponse(int status, String content) {
        this.status = status;
        this.content = content;
    }
    public int getStatus() {
        return status;
    }
    public void setStatus(int status) {
        this.status = status;
    }
    public String getContent() {
        return content;
    }
    public void setContent(String content) {
        this.content = content;
    }
    public boolean isSuccessFlg() {
        return status == 200;
    }
    public String getErrorMsg() {
        return content;
    }
}

+ 384 - 0
patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/util/http/HttpUtils.java

@ -0,0 +1,384 @@
package com.yihu.wlyy.util.http;
import org.apache.http.HttpEntity;
import org.apache.http.HttpStatus;
import org.apache.http.NameValuePair;
import org.apache.http.auth.AuthScope;
import org.apache.http.auth.UsernamePasswordCredentials;
import org.apache.http.client.CredentialsProvider;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.*;
import org.apache.http.entity.ContentType;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.BasicCredentialsProvider;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.message.BasicNameValuePair;
import org.apache.http.util.EntityUtils;
import org.springframework.util.StringUtils;
import java.io.BufferedReader;
import java.io.File;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
 * Utils - HTTP请求辅助工具类
 * Created by progr1mmer on 2017/9/27.
 */
public class HttpUtils {
    public static HttpResponse doGet(String url, Map<String, Object> params) throws Exception {
        return doGet(url, params, null);
    }
    public static HttpResponse doGet(String url, Map<String, Object> params, Map<String, String> headers) throws Exception {
        return doGet(url, params, headers, null, null);
    }
    public static HttpResponse doGet(String url, Map<String, Object> params, Map<String, String> headers, String username, String password) throws Exception {
        String response;
        int status;
        CloseableHttpClient httpClient = null;
        CloseableHttpResponse closeableHttpResponse = null;
        List<NameValuePair> nameValuePairList = new ArrayList<NameValuePair>();
        if (params != null) {
            for (String key : params.keySet()) {
                Object value = params.get(key);
                if (value != null) {
                    nameValuePairList.add(new BasicNameValuePair(key, String.valueOf(params.get(key))));
                }
            }
        }
        String paramStr = EntityUtils.toString(new UrlEncodedFormEntity(nameValuePairList, "UTF-8"));
        HttpGet httpGet = new HttpGet(url + "?" + paramStr);
        if (headers != null) {
            for (String key : headers.keySet()) {
                httpGet.addHeader(key, headers.get(key));
            }
        }
        try {
            if (!StringUtils.isEmpty(username) && !StringUtils.isEmpty(password)) {
                UsernamePasswordCredentials usernamePasswordCredentials = new UsernamePasswordCredentials(username, password);
                CredentialsProvider credentialsProvider = new BasicCredentialsProvider();
                credentialsProvider.setCredentials(AuthScope.ANY, usernamePasswordCredentials);
                httpClient = HttpClients.custom().setDefaultCredentialsProvider(credentialsProvider).build();
            } else {
                httpClient = HttpClients.createDefault();
            }
            closeableHttpResponse = httpClient.execute(httpGet);
            HttpEntity resEntity = closeableHttpResponse.getEntity();
            status = closeableHttpResponse.getStatusLine().getStatusCode();
            response = getRespString(resEntity);
        } finally {
            try {
                if (closeableHttpResponse != null) {
                    closeableHttpResponse.close();
                }
                if (httpClient != null) {
                    httpClient.close();
                }
            }catch (Exception e) {
                e.printStackTrace();
            }
        }
        if (status != HttpStatus.SC_OK) {
//            LogService.getLogger().error(" GET: " + url + " " + status);
        }
        HttpResponse httpResponse = new HttpResponse(status, response);
        return httpResponse;
    }
    public static HttpResponse doPost(String url, Map<String, Object> params) throws Exception {
        return doPost(url, params, null);
    }
    public static HttpResponse doPost(String url, Map<String, Object> params, Map<String, String> headers) throws Exception{
        return doPost(url, params, headers, null, null);
    }
    public static HttpResponse doPost(String url, Map<String, Object> params, Map<String, String> headers, String username, String password) throws Exception{
        String response;
        int status;
        CloseableHttpClient httpClient = null;
        CloseableHttpResponse closeableHttpResponse = null;
        HttpPost httpPost = new HttpPost(url);
        List<NameValuePair> nameValuePairList = new ArrayList<NameValuePair>();
        if (params != null) {
            for (String key : params.keySet()) {
                Object value = params.get(key);
                if (value != null) {
                    nameValuePairList.add(new BasicNameValuePair(key, String.valueOf(params.get(key))));
                }
            }
        }
        httpPost.setEntity(new UrlEncodedFormEntity(nameValuePairList, "UTF-8"));
        if (headers != null) {
            for (String key : headers.keySet()) {
                httpPost.addHeader(key, headers.get(key));
            }
        }
        try {
            if (!StringUtils.isEmpty(username) && !StringUtils.isEmpty(password)) {
                UsernamePasswordCredentials usernamePasswordCredentials = new UsernamePasswordCredentials(username, password);
                CredentialsProvider credentialsProvider = new BasicCredentialsProvider();
                credentialsProvider.setCredentials(AuthScope.ANY, usernamePasswordCredentials);
                httpClient = HttpClients.custom().setDefaultCredentialsProvider(credentialsProvider).build();
            } else {
                httpClient = HttpClients.createDefault();
            }
            closeableHttpResponse = httpClient.execute(httpPost);
            HttpEntity resEntity = closeableHttpResponse.getEntity();
            status = closeableHttpResponse.getStatusLine().getStatusCode();
            response = getRespString(resEntity);
        } finally {
            try {
                if (closeableHttpResponse != null) {
                    closeableHttpResponse.close();
                }
                if (httpClient != null) {
                    httpClient.close();
                }
            }catch (Exception e) {
                e.printStackTrace();
            }
        }
        if(status != HttpStatus.SC_OK) {
//            LogService.getLogger().error(" POST: " + url + " " + status);
        }
        HttpResponse httpResponse = new HttpResponse(status, response);
        return httpResponse;
    }
    public static HttpResponse doJsonPost(String url, String jsonData, Map<String, String> headers, String username, String password) throws Exception{
        String response;
        int status;
        CloseableHttpClient httpClient = null;
        CloseableHttpResponse closeableHttpResponse = null;
        HttpPost httpPost = new HttpPost(url);
        httpPost.setHeader("Content-Type", "application/json;charset=UTF-8");
        httpPost.setEntity(new StringEntity(jsonData, "UTF-8"));
        if (headers != null) {
            for (String key : headers.keySet()) {
                httpPost.addHeader(key, headers.get(key));
            }
        }
        try {
            if (!StringUtils.isEmpty(username) && !StringUtils.isEmpty(password)) {
                UsernamePasswordCredentials usernamePasswordCredentials = new UsernamePasswordCredentials(username, password);
                CredentialsProvider credentialsProvider = new BasicCredentialsProvider();
                credentialsProvider.setCredentials(AuthScope.ANY, usernamePasswordCredentials);
                httpClient = HttpClients.custom().setDefaultCredentialsProvider(credentialsProvider).build();
            } else {
                httpClient = HttpClients.createDefault();
            }
            closeableHttpResponse = httpClient.execute(httpPost);
            HttpEntity resEntity = closeableHttpResponse.getEntity();
            status = closeableHttpResponse.getStatusLine().getStatusCode();
            response = getRespString(resEntity);
        } finally {
            try {
                if (closeableHttpResponse != null) {
                    closeableHttpResponse.close();
                }
                if (httpClient != null) {
                    httpClient.close();
                }
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
        if(status != HttpStatus.SC_OK) {
//            LogService.getLogger().error(" POST: " + url + " " + status);
        }
        HttpResponse httpResponse = new HttpResponse(status, response);
        return httpResponse;
    }
    public static HttpResponse doPut(String url, Map<String, Object> params) throws Exception {
        return doPut(url, params, null);
    }
    public static HttpResponse doPut(String url, Map<String, Object> params, Map<String, String> headers) throws Exception {
        return doPut(url, params, headers, null, null);
    }
    public static HttpResponse doPut(String url, Map<String, Object> params, Map<String, String> headers, String username, String password) throws Exception {
        String response;
        int status;
        CloseableHttpClient httpClient = null;
        CloseableHttpResponse closeableHttpResponse = null;
        HttpPut httpPut = new HttpPut(url);
        List<NameValuePair> nameValuePairList = new ArrayList<NameValuePair>();
        if (params != null) {
            for (String key : params.keySet()) {
                Object value = params.get(key);
                if (value != null) {
                    nameValuePairList.add(new BasicNameValuePair(key, String.valueOf(params.get(key))));
                }
            }
        }
        httpPut.setEntity(new UrlEncodedFormEntity(nameValuePairList, "UTF-8"));
        if (headers != null) {
            for (String key : headers.keySet()) {
                httpPut.addHeader(key, headers.get(key));
            }
        }
        try {
            if (!StringUtils.isEmpty(username) && !StringUtils.isEmpty(password)) {
                UsernamePasswordCredentials usernamePasswordCredentials = new UsernamePasswordCredentials(username, password);
                CredentialsProvider credentialsProvider = new BasicCredentialsProvider();
                credentialsProvider.setCredentials(AuthScope.ANY, usernamePasswordCredentials);
                httpClient = HttpClients.custom().setDefaultCredentialsProvider(credentialsProvider).build();
            } else {
                httpClient = HttpClients.createDefault();
            }
            closeableHttpResponse = httpClient.execute(httpPut);
            HttpEntity resEntity = closeableHttpResponse.getEntity();
            status = closeableHttpResponse.getStatusLine().getStatusCode();
            response = getRespString(resEntity);
        } finally {
            try {
                if (closeableHttpResponse != null) {
                    closeableHttpResponse.close();
                }
                if (httpClient != null) {
                    httpClient.close();
                }
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
        if (status != HttpStatus.SC_OK) {
//            LogService.getLogger().error(" PUT: " + url + " " + status);
        }
        HttpResponse httpResponse = new HttpResponse(status, response);
        return httpResponse;
    }
    public static HttpResponse doJsonPut(String url, String jsonData, Map<String, String> headers, String username, String password) throws Exception {
        String response;
        int status;
        CloseableHttpClient httpClient = null;
        CloseableHttpResponse closeableHttpResponse = null;
        HttpPut httpPut = new HttpPut(url);
        httpPut.setHeader("Content-Type", "application/json;charset=UTF-8");
        httpPut.setEntity(new StringEntity(jsonData, "UTF-8"));
        if (headers != null) {
            for (String key : headers.keySet()) {
                httpPut.addHeader(key, headers.get(key));
            }
        }
        try {
            if (!StringUtils.isEmpty(username) && !StringUtils.isEmpty(password)) {
                UsernamePasswordCredentials usernamePasswordCredentials = new UsernamePasswordCredentials(username, password);
                CredentialsProvider credentialsProvider = new BasicCredentialsProvider();
                credentialsProvider.setCredentials(AuthScope.ANY, usernamePasswordCredentials);
                httpClient = HttpClients.custom().setDefaultCredentialsProvider(credentialsProvider).build();
            } else {
                httpClient = HttpClients.createDefault();
            }
            closeableHttpResponse = httpClient.execute(httpPut);
            HttpEntity resEntity = closeableHttpResponse.getEntity();
            status = closeableHttpResponse.getStatusLine().getStatusCode();
            response = getRespString(resEntity);
        } finally {
            try {
                if (closeableHttpResponse != null) {
                    closeableHttpResponse.close();
                }
                if (httpClient != null) {
                    httpClient.close();
                }
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
        if (status != HttpStatus.SC_OK) {
//            LogService.getLogger().error(" PUT: " + url + " " + status);
        }
        HttpResponse httpResponse = new HttpResponse(status, response);
        return httpResponse;
    }
    public static HttpResponse doDelete(String url, Map<String, Object> params) throws Exception {
        return doDelete(url, params, null);
    }
    public static HttpResponse doDelete(String url, Map<String, Object> params, Map<String, String> headers) throws Exception {
        return doDelete(url, params, headers, null, null);
    }
    public static HttpResponse doDelete(String url, Map<String, Object> params, Map<String, String> headers, String username, String password) throws Exception {
        String response;
        int status;
        CloseableHttpClient httpClient = null;
        CloseableHttpResponse closeableHttpResponse = null;
        List<NameValuePair> nameValuePairList = new ArrayList<NameValuePair>();
        if (params != null) {
            for (String key : params.keySet()) {
                Object value = params.get(key);
                if (value != null) {
                    nameValuePairList.add(new BasicNameValuePair(key, String.valueOf(params.get(key))));
                }
            }
        }
        String paramStr = EntityUtils.toString(new UrlEncodedFormEntity(nameValuePairList, "UTF-8"));
        HttpDelete httpDelete = new HttpDelete(url + "?" + paramStr);
        if (headers != null) {
            for (String key : headers.keySet()) {
                httpDelete.addHeader(key, headers.get(key));
            }
        }
        try {
            if (!StringUtils.isEmpty(username) && !StringUtils.isEmpty(password)) {
                UsernamePasswordCredentials usernamePasswordCredentials = new UsernamePasswordCredentials(username, password);
                CredentialsProvider credentialsProvider = new BasicCredentialsProvider();
                credentialsProvider.setCredentials(AuthScope.ANY, usernamePasswordCredentials);
                httpClient = HttpClients.custom().setDefaultCredentialsProvider(credentialsProvider).build();
            } else {
                httpClient = HttpClients.createDefault();
            }
            closeableHttpResponse = httpClient.execute(httpDelete);
            HttpEntity resEntity = closeableHttpResponse.getEntity();
            status = closeableHttpResponse.getStatusLine().getStatusCode();
            response = getRespString(resEntity);
        } finally {
            try {
                if (closeableHttpResponse != null) {
                    closeableHttpResponse.close();
                }
                if (httpClient != null) {
                    httpClient.close();
                }
            }catch (Exception e) {
                e.printStackTrace();
            }
        }
        if (status != HttpStatus.SC_OK) {
//            LogService.getLogger().error(" DELETE: " + url + " " + status);
        }
        HttpResponse httpResponse = new HttpResponse(status, response);
        return httpResponse;
    }
    private static String getRespString(HttpEntity entity) throws Exception {
        if (entity == null) {
            return null;
        }
        InputStream is = entity.getContent();
        BufferedReader reader = new BufferedReader(new InputStreamReader(is, "UTF-8"));
        StringBuilder stringBuilder = new StringBuilder();
        String line;
        while ((line = reader.readLine()) != null) {
            stringBuilder.append(line);
        }
        return stringBuilder.toString();
    }
}

+ 54 - 0
patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/util/http/IPInfoUtils.java

@ -0,0 +1,54 @@
package com.yihu.wlyy.util.http;
import javax.servlet.http.HttpServletRequest;
/**
 * Utils - ip信息辅助工具类
 * Created by progr1mmer on 2018/1/18.
 */
public class IPInfoUtils {
    private static final long A1 = getIpNum("10.0.0.0");
    private static final long A2 = getIpNum("10.255.255.255");
    private static final long B1 = getIpNum("172.16.0.0");
    private static final long B2 = getIpNum("172.31.255.255");
    private static final long C1 = getIpNum("192.168.0.0");
    private static final long C2 = getIpNum("192.168.255.255");
    private static final long D1 = getIpNum("10.44.0.0");
    private static final long D2 = getIpNum("10.69.0.255");
    private static long getIpNum(String ipAddress) {
        String [] ip = ipAddress.split("\\.");
        long a = Integer.parseInt(ip[0]);
        long b = Integer.parseInt(ip[1]);
        long c = Integer.parseInt(ip[2]);
        long d = Integer.parseInt(ip[3]);
        return a * 256 * 256 * 256 + b * 256 * 256 + c * 256 + d;
    }
    public static boolean isInnerIP(String ip){
        long n = getIpNum(ip);
        return (n >= A1 && n <= A2) || (n >= B1 && n <= B2) || (n >= C1 && n <= C2) || (n >= D1 && n <= D2);
    }
    public static String getIPAddress(HttpServletRequest request) {
        String ip = request.getHeader("x-forwarded-for");
        if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
            ip = request.getHeader("Proxy-Client-IP");
        }
        if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
            ip = request.getHeader("WL-Proxy-Client-IP");
        }
        if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
            ip = request.getHeader("HTTP_CLIENT_IP");
        }
        if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
            ip = request.getHeader("HTTP_X_FORWARDED_FOR");
        }
        if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
            ip = request.getRemoteAddr();
        }
        return ip;
    }
}

+ 34 - 0
patient-co/patient-co-wlyy/doc/技术文档/es/推送日志记录新增索引

@ -0,0 +1,34 @@
创建索引
POST  http://172.19.103.68:9200/assistant_msg_push_log
查询索引
GET http://172.19.103.68:9200/assistant_msg_push_log/
给索引加mapping
POST http://172.19.103.68:9200/assistant_msg_push_log/assistant_msg_push_log/_mapping
{
    "assistant_msg_push_log": {
        "properties": {
            "data": {
                "type": "string"
            },
            "createTime": {
                "format": "strict_date_optional_time||epoch_millis",
                "type": "date"
            },
            "openid": {
                "type": "string"
            },
            "accessToken": {
                "type": "string"
            },
            "type": {
                "type": "string"
            },
            "pushPlatform": {
                "type": "long"
            },
            "url": {
                "type": "string"
            }
        }
    }
  }

+ 3 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/patient/SignFamilyDao.java

@ -444,4 +444,7 @@ public interface SignFamilyDao extends PagingAndSortingRepository<SignFamily, Lo
    //根据居民获取有效的签约
    List<SignFamily> findByPatientAndExpensesStatusAndStatus(String patient,String expensesStatus,Integer status);
    //根据居民找出居民签约团队
    @Query("select a from SignFamily a where a.patient = ?1 and a.status = 1 and a.expensesStatus = '1'")
    SignFamily findSignFamilyByPatient(String patient);
}

+ 2 - 2
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/family/FamilyService.java

@ -451,7 +451,7 @@ public class FamilyService {
        System.out.println(MD5.GetMD5Code(password+salt));
    }
    public SignFamily findByPatientAndDoctor(String patient, String doctor) {
        return signFamilyDao.findSignFamilyByPatientAndDoctor(patient, doctor);
    public SignFamily findByPatient(String patient) {
        return signFamilyDao.findSignFamilyByPatient(patient);
    }
}

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

@ -307,6 +307,7 @@ public class TaskService {
        object.put("patientIdcard",patient.getIdcard());
        object.put("patientOpenid",patient.getOpenid());
        String url =getBaseUrl() + "createActiveRecord";
        //String url = "http://localhost:10051/svr-health-bank/createActiveRecord";
        try {
            response = httpClientUtil.iotPostBody(url,object.toString());
        }catch (Exception e){

+ 1 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/message/MessageService.java

@ -405,7 +405,7 @@ public class MessageService extends BaseService {
     */
    public Map<String,List<Map<String, Object>>> getHealthIndexMessage(String doctor) throws Exception {
        String sql = "select a.sender,a.tz_type,count(1) count,max(date_format(a.create_time,'%Y-%m-%d %H:%i:%s')) last_time,a.has_read from wlyy_Message a where a.receiver='" + doctor + "' and a.type='2' and a.over='1' group by a.sender,a.tz_type,a.has_read order by last_time desc";
        String sql = "select a.sender,a.tz_type,count(1) count,max(date_format(a.create_time,'%Y-%m-%d %H:%i:%s')) last_time,a.has_read from wlyy_Message a left join wlyy_sign_family f on a.sender=f.patient  where f.status=1 and f.expenses_status='1' and a.receiver='" + doctor + "' and a.type='2' and a.over='1' group by a.sender,a.tz_type,a.has_read order by last_time desc";
        List<Map<String, Object>> list = jdbcTemplate.queryForList(sql);
        Map<String,Map<String, Object>> map = new HashMap<>();

+ 2 - 3
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/statisticsES/StatisticsESService.java

@ -6353,12 +6353,11 @@ public class StatisticsESService {
                sql +=" AND d.grant_admin_team IN(SELECT id FROM wlyy_admin_team WHERE available = 1)";
            }
            sqlList = jdbcTemplate.queryForList(sql);
            esModelList = getDeviceBindToTeam(sqlList);
        }else {
            esModelList = (List<SaveModel>) elasticsearchUtil.findListDateQuotaLevel0(year+"-07-01",date, area, level, index, SaveModel.timeLevel_ZL, low_level);
            esModelList = (List<SaveModel>) elasticsearchUtil.findListDateQuotaLevel0(date, area, level, index, SaveModel.timeLevel_DDL, low_level);
        }
        esModelList = getDeviceBindToTeam(sqlList);
        //到绑定人的封装数据
        if (esModelList != null && esModelList.size() > 0) {
            for (SaveModel one : esModelList) {

+ 78 - 15
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/specialist/RehabilitationPlanService.java

@ -1,22 +1,24 @@
package com.yihu.wlyy.service.specialist;
import com.yihu.wlyy.entity.doctor.profile.Doctor;
import com.yihu.wlyy.entity.patient.SignFamily;
import com.yihu.wlyy.entity.doctor.team.admin.AdminTeam;
import com.yihu.wlyy.service.BaseService;
import com.yihu.wlyy.service.app.team.AdminTeamService;
import com.yihu.wlyy.util.http.HttpResponse;
import com.yihu.wlyy.util.http.HttpUtils;
import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.lang3.StringUtils;
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.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
import java.util.Map;
/**
 * Created by Trick on 2018/8/22.
 * Created by humingfen on 2018/8/22.
 */
@Service
@Transactional
@ -24,10 +26,20 @@ public class RehabilitationPlanService extends BaseService {
    @Value("${specialist.url}")
    private String specialistUrl;
    @Autowired
    private AdminTeamService teamService;
    public JSONObject findTemplateInfo(Long teamId) {
    public JSONObject findTemplateInfo(String doctor, String patient) {
        Map<String, Object> param = new HashedMap();
        param.put("adminTeamCode", teamId);
        Long adminTeamId = null;
        AdminTeam team = teamService.findByLeaderCode(doctor);
        if(StringUtils.isBlank(patient)){
            adminTeamId = team.getId();
            param.put("adminTeamCode", adminTeamId);
        }else {
            param.put("doctor", doctor);
            param.put("patient", patient);
        }
        HttpResponse response = null;
        try {
            response = HttpUtils.doGet(specialistUrl + "svr-specialist/findRehabilitationPlanTemplate", param);
@ -78,9 +90,9 @@ public class RehabilitationPlanService extends BaseService {
        JSONObject object = new JSONObject(json);
        JSONArray details = new JSONArray();
        String templateId = object.get("templateId").toString();
        String serviceItemIds = object.get("hospitalServiceItemIds").toString();
        if(serviceItemIds.contains(",")) {
            String [] itemIds = serviceItemIds.split(",");
        String hospitalServiceItemIds = object.get("hospitalServiceItemId").toString();
        if(hospitalServiceItemIds.contains(",")) {
            String [] itemIds = hospitalServiceItemIds.split(",");
            int len = itemIds.length;
            while (len > 0){
                len --;
@ -91,6 +103,10 @@ public class RehabilitationPlanService extends BaseService {
                j.put("createUserName", doctor.getName());
                details.put(len, j);
            }
        }else {
            object.put("createUser", doctor.getCode());
            object.put("createUserName", doctor.getName());
            details.put(object);
        }
        Map<String, Object> param = new HashedMap();
        param.put("rehabilitationTemplateDetail", details.toString());
@ -108,15 +124,13 @@ public class RehabilitationPlanService extends BaseService {
        return rs.getString("message");
    }
    public JSONObject findServiceItemsByHospital(SignFamily signFamily, Doctor doctor) {
        List<String> hospitals = null;
        hospitals.add(doctor.getHospital());
        hospitals.add(signFamily.getHospital());
    public JSONObject findServiceItemsByHospital(String doctorHospital, String signHospital) {
        Map<String, Object> param = new HashedMap();
        param.put("hospitals", hospitals);
        param.put("doctorHospital", doctorHospital);
        param.put("signHospital", signHospital);
        HttpResponse response = null;
        try {
            response = HttpUtils.doPost(specialistUrl + "svr-specialist/", param);
            response = HttpUtils.doGet(specialistUrl + "svr-specialist/findServiceItemsByHospital", param);
        } catch (Exception e) {
            e.printStackTrace();
        }
@ -129,7 +143,7 @@ public class RehabilitationPlanService extends BaseService {
        object.put("createUser", doctor.getCode());
        object.put("createUserName", doctor.getName());
        Map<String, Object> param = new HashedMap();
        param.put("rehabilitationPlan", json.toString());
        param.put("rehabilitationPlan", object.toString());
        HttpResponse response = null;
        try {
            response = HttpUtils.doPost(specialistUrl + "svr-specialist/createPatientRehabilitationPlan", param);
@ -139,4 +153,53 @@ public class RehabilitationPlanService extends BaseService {
        JSONObject rs = new JSONObject(response.getContent());
        return rs.getString("message");
    }
    public String deleteTemplate(String templateId) {
        Map<String, Object> param = new HashedMap();
        param.put("id", templateId);
        HttpResponse response = null;
        try {
            response = HttpUtils.doPost(specialistUrl + "svr-specialist/deleteRehabilitationPlanTemplate", param);
        } catch (Exception e) {
            e.printStackTrace();
        }
        JSONObject rs = new JSONObject(response.getContent());
        return rs.getString("message");
    }
    /**
     * 根据医生code获取签约居民信息
     * @param doctor
     * @return
     */
    public JSONObject getPatientInfoByDoctor(String doctor, String patientInfo) {
        Map<String, Object> param = new HashedMap();
        param.put("doctor", doctor);
        param.put("patientInfo", patientInfo);
        HttpResponse response = null;
        try {
            response = HttpUtils.doGet(specialistUrl + "svr-specialist/getPatientAndDiseaseByDoctor", param);
        } catch (Exception e) {
            e.printStackTrace();
        }
        JSONObject rs = new JSONObject(response.getContent());
        return rs;
    }
    /**
     * 更新计划的状态
     * @param planId
     * @param status
     * @throws Exception
     */
    public void updatePlanStatusById(String planId, Integer status) throws Exception{
        Map<String, Object> param = new HashedMap();
        param.put("planId", planId);
        param.put("status", status);
        HttpResponse response = HttpUtils.doPost(specialistUrl + "svr-specialist/updatePlanStatusById", param);
        JSONObject result = new JSONObject(response.getContent());
        if(result.getInt("status")!=200){
            throw new Exception("请求微服务失败!");
        }
    }
}

+ 21 - 14
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/specialist/SpecialistEvaluateSevice.java

@ -113,40 +113,47 @@ public class SpecialistEvaluateSevice extends BaseService {
    /**
     * 发送消息 type:19 受理提醒,20 待办工作提醒 21 服务进展提醒-已完成 22 服务进展提醒-未完成
     */
    public JSONObject sendMessage(Message message,String hospital,String patient,Integer time){
    public JSONObject sendMessage(Message message,String hospitalCode,String patientCode,Integer num){
        JSONObject object = new JSONObject();
        try {
            Patient patient1 = patientDao.findByCode(patient);
            Hospital hospital1 = hospitalDao.findByCode(hospital);
            Doctor doctor = doctorDao.findByCode(message.getSender());
            Doctor doctor1 = doctorDao.findByCode(message.getReceiver());
            if (message.getType() == 19 && StringUtils.isNoneBlank(hospital)){
            Hospital hospital = null;
            if(StringUtils.isNotEmpty(hospitalCode)){
                hospital = hospitalDao.findByCode(hospitalCode);
            }
            Patient patient = patientDao.findByCode(patientCode);
            Doctor sendDoctor = doctorDao.findByCode(message.getSender());
            Doctor receiverDoctor = doctorDao.findByCode(message.getReceiver());
            if (message.getType() == 19 ){
                message.setType(19);
                message.setTitle("康复计划-受理提醒");
                message.setContent("您的"+patient1.getName()+"签约居民,刚刚出院,"+hospital1.getName()+"已完成康复计划的制定,请查看");
                message.setContent("您的"+patient.getName()+"签约居民,刚刚出院,"+(hospital!=null?hospital.getName():"")+"已完成康复计划的制定,请查看");
            }else if (message.getType() == 20){
                message.setType(20);
                message.setTitle("康复计划-待办工作提醒");
                message.setContent("您的"+patient1.getName()+"签约居民"+time+"天后计划到"+hospital1.getName()+"复诊,请查看");
                message.setContent("您的"+patient.getName()+"签约居民"+num+"天后计划到"+(hospital!=null?hospital.getName():"")+"复诊,请查看");
            }else if (message.getType() == 21){
                message.setType(21);
                message.setTitle("康复计划-服务进展提醒");
                message.setContent("您的"+patient1.getName()+"签约居民已完成康复计划今日项目,请查看");
                message.setContent("您的"+patient.getName()+"签约居民已完成康复计划今日项目,请查看");
            }else if (message.getType() == 22){
                message.setType(22);
                message.setTitle("康复计划-服务进展提醒");
                message.setContent("您的"+patient1.getName()+"签约居民未完成康复计划今天项目,请尽快处理");
                message.setContent("您的"+patient.getName()+"签约居民未完成康复计划今天项目,请尽快处理");
            }else if (message.getType() == 23){
                message.setType(23);
                message.setTitle("康复计划-服务进展提醒");
                message.setContent("您的"+patient.getName()+"签约居民今日有"+num+"个康复计划项目待完成,请尽快处理");
            }
            message.setSenderName(doctor.getName());
            message.setSenderName(sendDoctor.getName());
            message.setCode(getCode());
            message.setSenderPhoto(doctor.getPhoto());
            message.setSenderPhoto(sendDoctor.getPhoto());
            message.setReadonly(1);//是否只读消息
            message.setSex(doctor.getSex());
            message.setSex(sendDoctor.getSex());
            message.setOver("1");//未处理
            message.setDel("1");
            message.setState(1);
            message.setCzrq(new Date());
            message.setReceiverName(doctor1.getName());
            message.setReceiverName(receiverDoctor.getName());
            messageDao.save(message);
        }catch (Exception e){
            e.printStackTrace();

+ 212 - 4
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/specialist/rehabilitation/RehabilitationManageService.java

@ -1,10 +1,15 @@
package com.yihu.wlyy.service.specialist.rehabilitation;
import com.yihu.wlyy.entity.doctor.profile.Doctor;
import com.yihu.wlyy.entity.message.Message;
import com.yihu.wlyy.entity.patient.Patient;
import com.yihu.wlyy.entity.patient.SignFamily;
import com.yihu.wlyy.repository.doctor.DoctorDao;
import com.yihu.wlyy.repository.patient.PatientDao;
import com.yihu.wlyy.repository.patient.SignFamilyDao;
import com.yihu.wlyy.service.BaseService;
import com.yihu.wlyy.service.specialist.SpecialistEvaluateSevice;
import com.yihu.wlyy.util.IdCardUtil;
import com.yihu.wlyy.util.http.HttpResponse;
import com.yihu.wlyy.util.http.HttpUtils;
import org.apache.commons.collections.map.HashedMap;
@ -33,6 +38,10 @@ public class RehabilitationManageService extends BaseService {
    private DoctorDao doctorDao;
    @Autowired
    private SignFamilyDao signFamilyDao;
    @Autowired
    private PatientDao patientDao;
    @Autowired
    private SpecialistEvaluateSevice specialistEvaluateSevice;
    /************************************************************* start ************************************************************************/
    private String findRehabilitationPlanList = "/svr-specialist/findRehabilitationPlanList";//康复管理-康复计划列表
@ -45,6 +54,14 @@ public class RehabilitationManageService extends BaseService {
    private String updateStatusRehabilitationOperate = "/svr-specialist/updateStatusRehabilitationOperate";//康复管理-服务项目-完成项目内容信息
    private String patientRehabilitationDetail = "/svr-specialist/patientRehabilitationDetail";//康复管理-居民详情页
    private String recentPlanDetailRecord = "/svr-specialist/recentPlanDetailRecord";//居民康复计划详情页-近期康复相关记录
    private String createServiceQrCode ="/svr-specialist/createServiceQrCode";//根据康复计划明细id和对话sessionId生成服务码
    private String checkAfterQrCode="/svr-specialist/checkAfterQrCode";//居民扫码后验证是否是关联的居民扫码
    private String serviceDoctorList = "/svr-specialist/serviceDoctorList";//康复管理-医生端居民详情服务医生列表
    private String appCalendarPlanDetailList = "/svr-specialist/appCalendarPlanDetailList";//康复管理-app端、微信端计划的服务项目列表
    private String dailyJob = "/svr-specialist/dailyJob";//每日康复服务通知
    private String saveRehabilitationOperateRecodr ="/svr-specialist/saveRehabilitationOperateRecodr";//新增operateRecodr
    private String updateNoteAndImageRehabilitationOperate ="/svr-specialist/updateNoteAndImageRehabilitationOperate";//康复计划完成时更新服务完成笔记和图片接口;
    private String updatePlanDetailStatusById = "/svr-specialist/updatePlanDetailStatusById";//康复管理-更新康复计划服务项目状态
    /************************************************************* end ************************************************************************/
    /**
@ -81,6 +98,14 @@ public class RehabilitationManageService extends BaseService {
        HttpResponse response = HttpUtils.doGet(specialistUrl + findRehabilitationPlanList, param);
        JSONObject result = new JSONObject(response.getContent());
        if(result.getInt("status")==200){
            JSONArray json = result.getJSONArray("detailModelList");
            String patientCode ="";
            Patient patient =null;
            for(int i=0;i<json.length();i++){
                patientCode = json.getJSONObject(i).get("patientCode")+"";
                patient = patientDao.findByCode(patientCode);
                json.getJSONObject(i).put("photo",patient!=null?patient.getPhoto():"");
            }
            return result;
        }
        throw new Exception("请求微服务失败!");
@ -198,7 +223,6 @@ public class RehabilitationManageService extends BaseService {
     * @param messageId
     * @param patientCode
     * @param doctorCode
     * @param doctorType
     * @param content
     * @param planDetailId
     * @return
@ -213,7 +237,7 @@ public class RehabilitationManageService extends BaseService {
        param.put("doctorCode", doctorCode);
        param.put("doctorType", doctorType);
        param.put("content", content);
        param.put("planDetailIds", planDetailId);
        param.put("planDetailId", planDetailId);
        HttpResponse response = HttpUtils.doPost(specialistUrl + saveGuidanceMessage, param);
        JSONObject result = new JSONObject(response.getContent());
        if(result.getInt("status")!=200){
@ -251,12 +275,20 @@ public class RehabilitationManageService extends BaseService {
        String healthDoctorName =null;
        String generalDoctor = null;
        String generalDoctorName = null;
        String patientName = null;
        Integer age = null;
        String sex = null;
        String signHospitalName = null;
        if(list.size()>0){
            SignFamily signFamily = list.get(0);
            healthDoctor = signFamily.getDoctorHealth();
            healthDoctorName = signFamily.getDoctorHealthName();
            generalDoctor = signFamily.getDoctor();
            generalDoctorName = signFamily.getDoctorName();
            patientName = signFamily.getName();
            age = IdCardUtil.getAgeForIdcard(signFamily.getIdcard());
            sex = IdCardUtil.getSexForIdcard_new(signFamily.getIdcard());
            signHospitalName = signFamily.getHospitalName();
        }
        param.put("patientCode", patientCode);
        param.put("healthDoctor", healthDoctor);
@ -266,7 +298,23 @@ public class RehabilitationManageService extends BaseService {
        HttpResponse response = HttpUtils.doGet(specialistUrl + patientRehabilitationDetail, param);
        JSONObject result = new JSONObject(response.getContent());
        if(result.getInt("status")==200){
            return result.getJSONObject("obj");
            JSONObject json = result.getJSONObject("obj").getJSONObject("patientInfo");
            json.put("patientName",patientName);
            json.put("age",age);
            json.put("sex",sex);
            json.put("healthyCondition","康复期");
            json.put("signHospitalName",signHospitalName);
            json.put("photo",patientDao.findByCode(patientCode).getPhoto());
            JSONArray jsonArray = result.getJSONObject("obj").getJSONArray("serviceDoctorList");
            String doctorCode ="";
            Doctor doctor = null;
            for(int i=0;i<jsonArray.length();i++){
                doctorCode = jsonArray.getJSONObject(i).get("doctorCode")+"";
                doctor = doctorDao.findByCode(doctorCode);
                jsonArray.getJSONObject(i).put("doctorPhoto",doctor!=null?doctor.getPhoto():"");
            }
            return result.getJSONObject("obj").put("patientInfo",json);
        }
        throw new Exception("请求微服务失败!");
    }
@ -279,11 +327,13 @@ public class RehabilitationManageService extends BaseService {
     * @return
     * @throws Exception
     */
    public JSONObject recentPlanDetailRecord(String patientCode,String startTime,String endTime) throws Exception{
    public JSONObject recentPlanDetailRecord(String patientCode,String startTime,String endTime,Integer page,Integer pageSize) throws Exception{
        Map<String, Object> param = new HashedMap();
        param.put("patientCode", patientCode);
        param.put("startTime", startTime);
        param.put("endTime", endTime);
        param.put("page", page);//第几页,从1开始
        param.put("pageSize", pageSize);//每页分页大小
        HttpResponse response = HttpUtils.doGet(specialistUrl + recentPlanDetailRecord, param);
        JSONObject result = new JSONObject(response.getContent());
        if(result.getInt("status")==200){
@ -291,4 +341,162 @@ public class RehabilitationManageService extends BaseService {
        }
        throw new Exception("请求微服务失败!");
    }
    public String createServiceQrCode(String planDetailId,String sessionId) throws Exception{
        Map<String, Object> param = new HashedMap();
        param.put("planDetailId", planDetailId);
        param.put("sessionId", sessionId);
        //specialistUrl= "http://localhost:10051";
        HttpResponse response = HttpUtils.doPost(specialistUrl + createServiceQrCode, param);
        JSONObject result = new JSONObject(response.getContent());
        if(result.getInt("status")==200){
            return String.valueOf(result.get("obj"));
        }
        throw new Exception("获取二维码失败!");
    }
    public JSONObject checkAfterQrCode(String planDetailId,String patientCode) throws Exception{
        Map<String, Object> param = new HashedMap();
        param.put("planDetailId", planDetailId);
        param.put("patientCode", patientCode);
        //specialistUrl= "http://localhost:10051";
        HttpResponse response = HttpUtils.doPost(specialistUrl + checkAfterQrCode, param);
        JSONObject result = new JSONObject(response.getContent());
        return  result;
    }
    /**
     * 康复管理-app端、居民端-服务医生列表
     * @param patientCode
     * @return
     * @throws Exception
     */
    public JSONArray serviceDoctorList(String patientCode) throws Exception{
        Map<String, Object> param = new HashedMap();
        List<SignFamily> list = signFamilyDao.findByPatientAndExpensesStatusAndStatus(patientCode,"1",1);
        String healthDoctor = null;
        String healthDoctorName =null;
        String generalDoctor = null;
        String generalDoctorName = null;
        if(list.size()>0){
            SignFamily signFamily = list.get(0);
            healthDoctor = signFamily.getDoctorHealth();
            healthDoctorName = signFamily.getDoctorHealthName();
            generalDoctor = signFamily.getDoctor();
            generalDoctorName = signFamily.getDoctorName();
        }
        param.put("patientCode", patientCode);
        param.put("healthDoctor", healthDoctor);
        param.put("healthDoctorName", healthDoctorName);
        param.put("generalDoctor", generalDoctor);
        param.put("generalDoctorName", generalDoctorName);
        HttpResponse response = HttpUtils.doGet(specialistUrl + serviceDoctorList, param);
        JSONObject result = new JSONObject(response.getContent());
        if(result.getInt("status")==200){
            return result.getJSONArray("obj");
        }
        throw new Exception("请求微服务失败!");
    }
    /**
     * 康复管理-app端、微信端计划的服务项目列表
     * @param executeStartTime
     * @param executeEndTime
     * @param planId
     * @param searchTask
     * @param status
     * @return
     * @throws Exception
     */
    public JSONObject appCalendarPlanDetailList(String executeStartTime, String executeEndTime, String planId, Integer searchTask, Integer status) throws Exception{
        Map<String, Object> param = new HashedMap();
        param.put("executeStartTime", executeStartTime);
        param.put("executeEndTime", executeEndTime);
        param.put("planId", planId);
        param.put("searchTask", searchTask);
        param.put("status", status);
        HttpResponse response = HttpUtils.doGet(specialistUrl + appCalendarPlanDetailList, param);
        JSONObject result = new JSONObject(response.getContent());
        if(result.getInt("status")==200){
            return result.getJSONObject("obj");
        }
        throw new Exception("请求微服务失败!");
    }
    public JSONArray dailyJob(String startTime, String endTime) throws Exception{
        Map<String, Object> param = new HashedMap();
        param.put("startTime", startTime);
        param.put("endTime", endTime);
        HttpResponse response = HttpUtils.doGet(specialistUrl + dailyJob, param);
        JSONObject result = new JSONObject(response.getContent());
        if(result.getInt("status")==200){
            return result.getJSONArray("obj");
        }
        throw new Exception("请求微服务失败!");
    }
    public JSONObject saveRehabilitationOperateRecodr(String dataJson) throws Exception{
        Map<String, Object> param = new HashedMap();
        param.put("dataJson", dataJson);
        //specialistUrl= "http://localhost:10051";
        HttpResponse response = HttpUtils.doPost(specialistUrl + saveRehabilitationOperateRecodr, param);
        JSONObject result = new JSONObject(response.getContent());
        return  result;
    }
    public JSONObject updateNodeAndRelationRecordImg(String planDetailId,String node,String image) throws Exception{
        Map<String, Object> param = new HashedMap();
        param.put("planDetailId", planDetailId);
        param.put("node", node);
        param.put("image", image);
        //specialistUrl= "http://localhost:10051";
        HttpResponse response = HttpUtils.doPost(specialistUrl + updateNoteAndImageRehabilitationOperate, param);
        JSONObject result = new JSONObject(response.getContent());
        return  result;
    }
    /**
     * 每天8点,16点的job
     * @param startTime
     * @param endTime
     * @throws Exception
     */
    public void dailyJobSendMessage(String startTime,String endTime,Integer type) throws Exception{
        JSONArray jsonArray = dailyJob(startTime,endTime);
        JSONObject jsonObject = null;
        String doctor = "";
        String patient ="";
        Integer num = null;
        for(int i=0;i<jsonArray.length();i++){
            jsonObject = jsonArray.getJSONObject(i);
            doctor = jsonObject.get("doctor")+"";//执行的医生(接收的医生)
            patient = jsonObject.get("patient")+"";//执行的居民
            num = (Integer)jsonObject.get("num");//需要今日需要执行的项目数
            Message message1 = new Message();
            message1.setSender(null);
            message1.setType(type);
            message1.setReceiver(doctor);
            specialistEvaluateSevice.sendMessage(message1,null,patient,num);
        }
    }
    /**
     * 康复管理-更新康复计划服务项目状态
     * @param planDetailId
     * @param status
     * @throws Exception
     */
    public void updatePlanDetailStatusById(String planDetailId,Integer status) throws Exception{
        Map<String, Object> param = new HashedMap();
        param.put("planDetailId", planDetailId);
        param.put("status", status);
        HttpResponse response = HttpUtils.doPost(specialistUrl + updatePlanDetailStatusById, param);
        JSONObject result = new JSONObject(response.getContent());
        if(result.getInt("status")!=200){
            throw new Exception("请求微服务失败!");
        }
    }
}

+ 19 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/util/ImUtill.java

@ -59,6 +59,25 @@ public class ImUtill {
        }
    }
    /**
     * 发送消息
     * @param senderId 发送者的code
     * @param receiverId 接受者code
     * @param contentType 消息类型 1二维码内容
     * @param content 消息内容
     * @return
     */
    public String sendMessage(String senderId,String receiverId,String contentType,String content){
        String imAddr = im_host + "api/v2/message/send";
        JSONObject params = new JSONObject();
        params.put("sender_id", senderId);
        params.put("sender_name", receiverId);
        params.put("content_type", contentType);
        params.put("content", content);
        String response = HttpClientUtil.postBody(imAddr, params);
        return response;
    }
    /**
     * 获取医生统计数据
     * status reply 为空值是是该医生总咨询量

+ 46 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/common/job/SpecialistRehabilitationJob.java

@ -0,0 +1,46 @@
package com.yihu.wlyy.web.common.job;
import com.yihu.wlyy.aop.ObserverRequired;
import com.yihu.wlyy.service.specialist.rehabilitation.RehabilitationManageService;
import com.yihu.wlyy.web.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.apache.commons.lang3.StringUtils;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
/**
 * Created by 刘文彬 on 2018/9/3.
 */
@RestController
@RequestMapping(value = "/specialist/job")
@Api(description = "专科模块job")
public class SpecialistRehabilitationJob extends BaseController {
    @Autowired
    private RehabilitationManageService rehabilitationManageService;
    @RequestMapping(value = "/dailyJobSendMessage", method = RequestMethod.POST)
    @ApiOperation("康复管理-康复计划每天8点,16点发送服务进展的job")
    @ObserverRequired
    public String dailyJobSendMessage(@ApiParam(name = "startTime", value = "开始时间(格式:yyyy-MM-dd HH:mm:ss)", required = true)
                                      @RequestParam(value = "startTime", required = true)String startTime,
                                      @ApiParam(name = "endTime", value = "结束时间(格式:yyyy-MM-dd HH:mm:ss)", required = true)
                                      @RequestParam(value = "endTime", required = true)String endTime,
                                      @ApiParam(name = "type", value = "8点:23,16点:22", required = true)
                                      @RequestParam(value = "type", required = true)Integer type){
        try {
            rehabilitationManageService.dailyJobSendMessage(startTime,endTime,type);
            return write(200, "发送成功");
        } catch (Exception e) {
            error(e);
            return error(-1, "发送失败");
        }
    }
}

+ 1 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/data/DataHandingService.java

@ -378,7 +378,7 @@ public class DataHandingService {
    @Transactional(rollbackFor = Exception.class)
    public void updateDevice()throws Exception{
        //String patientDeviceSql = "SELECT pd.*,sf.admin_team_code,sf.hospital FROM wlyy_patient_device pd LEFT JOIN wlyy_sign_family sf ON pd.`user` = sf.patient where sf.`status`>0 GROUP BY pd.id";
        String patientDeviceSql = "SELECT pd.id,pd.device_id AS deviceId,pd.category_code categoryCode,pd.device_name deviceName,pd.device_sn deviceSn,pd.`user`,pd.user_type userType,pd.czrq FROM wlyy_patient_device pd where pd.category_code in(1,2) GROUP BY pd.id";
        String patientDeviceSql = "SELECT pd.id,pd.device_id AS deviceId,pd.category_code categoryCode,pd.device_name deviceName,pd.device_sn deviceSn,pd.`user`,pd.user_type userType,pd.czrq FROM wlyy_patient_device pd where pd.del =0 and pd.category_code in(1,2) GROUP BY pd.id";
        List<Map<String,Object>> patientDeviceList = jdbcTemplate.queryForList(patientDeviceSql);
        String deviceSql = "SELECT * FROM device.wlyy_devices";
        List<DeviceDetail> deviceDetailList = jdbcTemplate.query(deviceSql,new BeanPropertyRowMapper<>(DeviceDetail.class));

+ 19 - 5
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/device/DoctorDeviceController.java

@ -136,6 +136,20 @@ public class DoctorDeviceController extends BaseController {
			//修改设备表中{"1":"0", "2":"0"}绑定次数 和其他绑定信息,
			deviceDetailService.updateAfterBinding(device,new Date(),flag);
			String flagStr ="";
			if ("1".equals(device.getCategoryCode())){
				flagStr="GLU_BIND";
			}else if ("2".equals(device.getCategoryCode())){
				flagStr="BP_BIND";
			}
			Patient patient = patientDao.findByCode(device.getUser());
			//活动的活跃度
			if (flag){
				JSONObject jsonObject = new JSONObject();
				jsonObject.put("patientId",patient.getCode());
				jsonObject.put("taskCode",flagStr);
				taskService.createActiveRecord(jsonObject);
			}
			return success("设备保存成功!");
		}
		catch (Exception ex) {
@ -178,12 +192,12 @@ public class DoctorDeviceController extends BaseController {
			SignFamily signFamily = signFamilyDao.findSignByPatient(patient.getCode(),2);
			//调用增加积分接口  海沧区的居民才能添加积分
			String flagStr ="";
			if ("1".equals(device.getCategoryCode())){
				flagStr="GLU_BIND";
			}else if ("2".equals(device.getCategoryCode())){
				flagStr="BP_BIND";
			}
			if (flag && "350205".equals(signFamily.getHospital().substring(0,6))){
				if ("1".equals(device.getCategoryCode())){
					flagStr="GLU_BIND";
				}else if ("2".equals(device.getCategoryCode())){
					flagStr="BP_BIND";
				}
				String creditDetail = "{\"tradeType\":\"ACTIVITY_TASK\",\"flag\":\""+flagStr+"\",\"tradeDirection\":1,\"status\":1,\"patientId\":\""+device.getUser()+"\",\"hospital\":\""+patient.getTown()+"\"}";
				JSONObject jsonObject = JSONObject.parseObject(creditDetail);
				JSONObject response = creditLogService.insert(jsonObject);

+ 2 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/jimeiJkEdu/DoctorJMJkEduArticleController.java

@ -10,6 +10,7 @@ import com.yihu.wlyy.util.DateUtil;
import com.yihu.wlyy.web.BaseController;
import com.yihu.wlyy.web.third.gateway.vo.HealthEduArticlePatientModel;
import com.yihu.wlyy.web.third.gateway.vo.base.BaseResultModel;
import com.yihu.wlyy.web.third.gateway.vo.base.ResultOneModel;
import com.yihu.wlyy.web.third.gateway.vo.base.ResultPageListModel;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@ -397,7 +398,7 @@ public class DoctorJMJkEduArticleController extends BaseController {
                //发送任务到redis
                sender(healthEduArticleESList);
            }).start();
            return new BaseResultModel();
            return new ResultOneModel(ResultOneModel.statusEm.success.getCode(), ResultOneModel.statusEm.success.getMessage(), healthEduArticleESList.get(0).getBatchNo());
        }catch (Exception e) {
            return new BaseResultModel(BaseResultModel.statusEm.opera_error.getCode(), BaseResultModel.statusEm.opera_error.getMessage() + ":" + e.getMessage());
        }

+ 7 - 7
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/message/DoctorMessageController.java

@ -601,13 +601,13 @@ public class DoctorMessageController extends BaseController {
    @RequestMapping(value = "sendMessage", method = RequestMethod.GET)
    @ResponseBody
    @ApiOperation("发送消息")
    public String sendMessage(@ApiParam(name = "message",value = "消息对象")
                              @RequestParam(value = "message")String message,
                              @ApiParam(name = "hospital",value = "医院code")
                              @RequestParam(value = "hospital")String hospital,
                              @ApiParam(name = "patient",value = "居民code")
                              @RequestParam(value = "patient")String patient,
                              @ApiParam(name = "time",value = "时间")
    public String sendMessage(@ApiParam(name = "message",value = "消息对象(如:{'sender':'','receiver':'','relationCode':'','type':19})",required = true)
                              @RequestParam(value = "message",required = true)String message,
                              @ApiParam(name = "hospital",value = "医院code",required = false)
                              @RequestParam(value = "hospital",required = false)String hospital,
                              @ApiParam(name = "patient",value = "居民code",required = true)
                              @RequestParam(value = "patient",required = true)String patient,
                              @ApiParam(name = "time",value = "时间",required = false)
                              @RequestParam(value = "time",required = false)Integer time) {
        try {
            com.alibaba.fastjson.JSONObject object = com.alibaba.fastjson.JSONObject.parseObject(message);

+ 157 - 9
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/specialist/rehabilitation/RehabilitationManageController.java

@ -1,5 +1,7 @@
package com.yihu.wlyy.web.doctor.specialist.rehabilitation;
import com.yihu.wlyy.util.ImUtill;
import com.yihu.wlyy.service.specialist.RehabilitationPlanService;
import org.json.JSONArray;
import com.yihu.wlyy.aop.ObserverRequired;
import com.yihu.wlyy.entity.doctor.team.sign.SignPatientLabelInfo;
@ -25,15 +27,19 @@ import java.util.List;
@RestController
@RequestMapping(value = "/doctor/specialist/rehabilitation", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
@Api(description = "医生端-康复管理")
public class RehabilitationManageController extends BaseController {
public class DoctorRehabilitationManageController extends BaseController {
    @Autowired
    private RehabilitationManageService rehabilitationManageService;
    @Autowired
    private ImUtill imUtill;
    @Autowired
    private RehabilitationPlanService rehabilitationPlanService;
    @RequestMapping(value = "findRehabilitationPlanList", method = RequestMethod.GET)
    @ApiOperation("康复管理-康复计划列表")
    @ObserverRequired
    public String findRehabilitationPlanList(@ApiParam(name = "doctorCode", value = "医生code", required = true)
    public String findRehabilitationPlanList(@ApiParam(name = "doctorCode", value = "医生code", required = false)
                                             @RequestParam(value = "doctorCode", required = false)String doctorCode,
//                                             @ApiParam(name = "doctorType", value = "医生类型(1、专科医生,2、家庭医生)", required = true)
//                                             @RequestParam(value = "doctorType", required = true)Integer doctorType,
@ -150,7 +156,7 @@ public class RehabilitationManageController extends BaseController {
        }
    }
    @RequestMapping(value = "planDetailId", method = RequestMethod.GET)
    @RequestMapping(value = "serviceItem", method = RequestMethod.GET)
    @ApiOperation("康复管理-康复计划服务项目确认详情页")
    @ObserverRequired
    public String serviceItem(@ApiParam(name = "planDetailId", value = "康复计划服务项目id", required = true)
@ -223,21 +229,163 @@ public class RehabilitationManageController extends BaseController {
    }
    @RequestMapping(value = "recentPlanDetailRecord", method = RequestMethod.GET)
    @ApiOperation("康复管理-居民详情页")
    @ApiOperation("康复管理-近期康复相关记录")
    @ObserverRequired
    public String recentPlanDetailRecord(@ApiParam(name = "patientCode", value = "居民code", required = true)
                                         @RequestParam(value = "patientCode", required = true)String patientCode,
                                         @ApiParam(name = "startTime", value = "开始时间(格式:yyyy-MM-dd HH:mm:ss)", required = true)
                                         @RequestParam(value = "startTime", required = true)String startTime,
                                         @ApiParam(name = "endTime", value = "结束时间(格式:yyyy-MM-dd HH:mm:ss)", required = true)
                                         @RequestParam(value = "endTime", required = true)String endTime){
                                         @ApiParam(name = "startTime", value = "开始时间(格式:yyyy-MM-dd HH:mm:ss)", required = false)
                                         @RequestParam(value = "startTime", required = false)String startTime,
                                         @ApiParam(name = "endTime", value = "结束时间(格式:yyyy-MM-dd HH:mm:ss)", required = false)
                                         @RequestParam(value = "endTime", required = false)String endTime,
                                         @ApiParam(name = "page", value = "第几页,从1开始", required = true)
                                         @RequestParam(value = "page", required = false,defaultValue = "1")Integer page,
                                         @ApiParam(name = "pageSize", value = "每页分页大小", required = true)
                                        @RequestParam(value = "pageSize", required = false,defaultValue = "10")Integer pageSize){
        try {
            JSONObject result = rehabilitationManageService.recentPlanDetailRecord(patientCode,startTime,endTime,page,pageSize);
            return write(200, "获取成功!", "data", result);
        } catch (Exception e) {
            error(e);
            return error(-1, "请求失败");
        }
    }
    @RequestMapping(value = "createServiceQrCode", method = RequestMethod.POST)
    @ApiOperation("康复管理-根据康复计划明细id和对话sessionId生成服务码")
    @ObserverRequired
    public String createServiceQrCode(@ApiParam(name = "planDetailId", value = "康复计划项目明细ID")@RequestParam(value = "planDetailId", required = true)String planDetailId,
                                      @ApiParam(name = "sessionId", value = "IM对话sessionId")@RequestParam(value = "sessionId", required = true)String sessionId){
        try {
            return write(200, "获取二维码成功!", "data", rehabilitationManageService.createServiceQrCode(planDetailId,sessionId));
        } catch (Exception e) {
            error(e);
            return error(-1, "请求二维码失败");
        }
    }
    @RequestMapping(value = "checkAfterQrCode", method = RequestMethod.POST)
    @ApiOperation("康复管理-居民扫码后验证是否是关联的居民扫码")
    @ObserverRequired
    public String checkAfterQrCode(@ApiParam(name = "planDetailId", value = "康复计划项目明细ID")@RequestParam(value = "planDetailId", required = true)String planDetailId,
                                      @ApiParam(name = "patientCode", value = "居民端登录的居民code")@RequestParam(value = "patientCode", required = true)String patientCode){
        try {
            JSONObject result = rehabilitationManageService.checkAfterQrCode(planDetailId,patientCode);
            return write(200, String.valueOf(result.get("message")), "data", result.get("obj"));
        } catch (Exception e) {
            error(e);
            return error(-1, "验证失败");
        }
    }
    @RequestMapping(value = "serviceDoctorList", method = RequestMethod.GET)
    @ApiOperation("康复管理-医生端居民详情服务医生列表")
    @ObserverRequired
    public String serviceDoctorList(@ApiParam(name = "patientCode", value = "居民code", required = true)
                                    @RequestParam(value = "patientCode", required = true)String patientCode){
        try {
            JSONObject result = rehabilitationManageService.recentPlanDetailRecord(patientCode,startTime,endTime);
            JSONArray result = rehabilitationManageService.serviceDoctorList(patientCode);
            return write(200, "获取成功!", "data", result);
        } catch (Exception e) {
            error(e);
            return error(-1, "请求失败");
        }
    }
    @RequestMapping(value = "appCalendarPlanDetailList", method = RequestMethod.GET)
    @ApiOperation("康复管理-app端、微信端计划的服务项目列表")
    @ObserverRequired
    public String appCalendarPlanDetailList(@ApiParam(name = "executeStartTime", value = "日历开始时间(格式:yyyy-MM-dd HH:mm:ss)", required = true)
                                            @RequestParam(value = "executeStartTime", required = true)String executeStartTime,
                                            @ApiParam(name = "executeEndTime", value = "日历结束时间(格式:yyyy-MM-dd HH:mm:ss)", required = true)
                                            @RequestParam(value = "executeEndTime", required = true)String executeEndTime,
                                            @ApiParam(name = "planId", value = "计划id", required = true)
                                            @RequestParam(value = "planId", required = true)String planId,
                                            @ApiParam(name = "searchTask", value = "快速查找任务:(1、我的任务,2、随访,3、复诊,4、健康教育)", required = false)
                                            @RequestParam(value = "searchTask", required = false)Integer searchTask,
                                            @ApiParam(name = "status", value = "任务状态(0未完成,1已完成,2已预约)", required = false)
                                            @RequestParam(value = "status", required = false)Integer status){
        try {
            JSONObject result = rehabilitationManageService.appCalendarPlanDetailList(executeStartTime,executeEndTime,planId,searchTask,status);
            return write(200, "获取成功", "data", result);
        } catch (Exception e) {
            error(e);
            return error(-1, "请求失败");
        }
    }
    @RequestMapping(value = "saveRehabilitationOperateRecodr", method = RequestMethod.POST)
    @ApiOperation("康复管理-新增operateRecodr")
    @ObserverRequired
    public String saveRehabilitationOperateRecodr(@ApiParam(name = "dataJson", value = "实体json",defaultValue = "{\"rehabilitationDetailId\":\"402803f6657f195301657f4fbd3c0001\",\"patientCode\":\"00\",\"patientName\":\"11\",\"doctorCode\":\"22\",\"doctorName\":\"33\",\"node\":\"jjjjjj\",\"relationRecordType\":\"4\",\"relation_record_code\":\"55\",\"relationRecordImg\":\"666666\",\"status\":\"0\"}")@RequestParam(value = "dataJson", required = true)String dataJson){
        try {
            JSONObject result = rehabilitationManageService.saveRehabilitationOperateRecodr(dataJson);
            if(result.getInt("status")==200){
                return write(200, "新增康复计划日志成功!", "data", result.getJSONObject("obj"));
            }else {
                return error(-1, result.getString("message"));
            }
        } catch (Exception e) {
            error(e);
            return error(-1, "新增康复计划日志失败!");
        }
    }
    @RequestMapping(value = "updateNoteAndImageRehabilitationOperate", method = RequestMethod.POST)
    @ApiOperation("康复管理-康复计划完成时更新服务完成笔记和图片接口")
    @ObserverRequired
    public String updateNoteAndImageRehabilitationOperate(@ApiParam(name = "planDetailId", value = "康复计划项目明细ID")@RequestParam(value = "planDetailId", required = true)String planDetailId,
                                                          @ApiParam(name = "node", value = "服务完成笔记", required = true)@RequestParam(value = "node", required = true)String node,
                                                          @ApiParam(name = "image", value = "相关记录图片,json格式", required = true)@RequestParam(value = "image", required = true)String image){
        try {
            JSONObject result = rehabilitationManageService.updateNodeAndRelationRecordImg(planDetailId, node, image);
            if (result.getInt("status")==200){
                return write(200, "更新日志成功!");
            }else {
                return error(-1, "更新日志失败");
            }
        } catch (Exception e) {
            error(e);
            return error(-1, "更新日志失败");
        }
    }
    @RequestMapping(value = "updatePlanDetailStatusById", method = RequestMethod.POST)
    @ApiOperation("康复管理-更新康复计划服务项目状态")
    @ObserverRequired
    public String updatePlanDetailStatusById(@ApiParam(name = "planDetailId", value = "服务项目id", required = true)
                                             @RequestParam(value = "planDetailId", required = true)String planDetailId,
                                             @ApiParam(name = "status", value = "状态(0未完成,1已完成,2已预约)", required = true)
                                             @RequestParam(value = "status", required = true)Integer status){
        try {
            rehabilitationManageService.updatePlanDetailStatusById(planDetailId,status);
            return write(200, "更新成功!");
        } catch (Exception e) {
            error(e);
            return error(-1, "请求失败");
        }
    }
    @RequestMapping(value = "updatePlanStatusById", method = RequestMethod.POST)
    @ApiOperation("康复管理-更新计划的状态")
    @ObserverRequired
    public String updatePlanStatusById(@ApiParam(name = "planId", value = "服务项目id", required = true)
                                             @RequestParam(value = "planId", required = true)String planId,
                                             @ApiParam(name = "status", value = "状态(0已中止,1进行中,2已完成)", required = true)
                                             @RequestParam(value = "status", required = true)Integer status){
        try {
            rehabilitationPlanService.updatePlanStatusById(planId,status);
            return write(200, "更新成功!");
        } catch (Exception e) {
            error(e);
            return error(-1, "请求失败");
        }
    }
}

+ 5 - 5
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/device/PatientDeviceController.java

@ -253,12 +253,12 @@ public class PatientDeviceController extends BaseController {
            deviceDetailService.updateAfterBinding(device,new Date(),flag);
            SignFamily signFamily = signFamilyDao.findSignByPatient(patient.getCode());
            String flagStr ="";
            if ("1".equals(device.getCategoryCode())){
                flagStr="GLU_BIND";
            }else if ("2".equals(device.getCategoryCode())){
                flagStr="BP_BIND";
            }
            if (flag && "350205".equals(signFamily.getHospital().substring(0,6))){
                if ("1".equals(device.getCategoryCode())){
                    flagStr="GLU_BIND";
                }else if ("2".equals(device.getCategoryCode())){
                    flagStr="BP_BIND";
                }
                String creditDetail = "{\"tradeType\":\"ACTIVITY_TASK\",\"flag\":\""+flagStr+"\",\"tradeDirection\":1,\"status\":1,\"patientId\":\""+device.getUser()+"\",\"hospital\":\""+patient.getTown()+"\"}";
                com.alibaba.fastjson.JSONObject jsonObject = com.alibaba.fastjson.JSONObject.parseObject(creditDetail);
                com.alibaba.fastjson.JSONObject response = creditLogService.insert(jsonObject);

+ 137 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/specialist/rehabilitation/PatientRehabilitationManageController.java

@ -0,0 +1,137 @@
package com.yihu.wlyy.web.patient.specialist.rehabilitation;
/**
 * Created by 刘文彬 on 2018/8/31.
 */
import com.yihu.wlyy.aop.ObserverRequired;
import com.yihu.wlyy.service.specialist.rehabilitation.RehabilitationManageService;
import com.yihu.wlyy.util.ImUtill;
import com.yihu.wlyy.web.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.apache.commons.lang3.StringUtils;
import org.json.JSONArray;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
/**
 * Created by 刘文彬 on 2018/8/30.
 */
@RestController
@RequestMapping(value = "/patient/specialist/rehabilitation", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
@Api(description = "居民端-康复管理")
public class PatientRehabilitationManageController extends BaseController {
    @Autowired
    private RehabilitationManageService rehabilitationManageService;
    @Autowired
    private ImUtill imUtill;
    @RequestMapping(value = "patientRehabilitationDetail", method = RequestMethod.GET)
    @ApiOperation("康复管理-微信端-居民详情页")
    public String patientRehabilitationDetail(){
        try {
            JSONObject result = rehabilitationManageService.patientRehabilitationDetail(getUID());
            return write(200, "获取成功!", "data", result);
        } catch (Exception e) {
            error(e);
            return error(-1, "请求失败");
        }
    }
    @RequestMapping(value = "calendarPlanDetail", method = RequestMethod.GET)
    @ApiOperation("康复管理-康复计划按日历展示")
    @ObserverRequired
    public String calendarPlanDetail(@ApiParam(name = "executeStartTime", value = "日历开始时间(格式:yyyy-MM-dd HH:mm:ss)", required = true)
                                     @RequestParam(value = "executeStartTime", required = true)String executeStartTime,
                                     @ApiParam(name = "executeEndTime", value = "日历结束时间(格式:yyyy-MM-dd HH:mm:ss)", required = true)
                                     @RequestParam(value = "executeEndTime", required = true)String executeEndTime,
                                     @ApiParam(name = "planId", value = "计划id", required = true)
                                     @RequestParam(value = "planId", required = true)String planId,
                                     @ApiParam(name = "searchTask", value = "快速查找任务:(1、我的任务,2、随访,3、复诊,4、健康教育)", required = false)
                                     @RequestParam(value = "searchTask", required = false)Integer searchTask,
                                     @ApiParam(name = "status", value = "任务状态(0未完成,1已完成,2已预约)", required = false)
                                     @RequestParam(value = "status", required = false)Integer status){
        try {
            JSONObject result = rehabilitationManageService.calendarPlanDetail(executeStartTime,executeEndTime,planId,searchTask,status,null);
            return write(200, "获取成功", "data", result);
        } catch (Exception e) {
            error(e);
            return error(-1, "请求失败");
        }
    }
    @RequestMapping(value = "serviceDoctorList", method = RequestMethod.GET)
    @ApiOperation("康复管理-微信端居民服务医生列表")
    public String serviceDoctorList(){
        try {
            JSONArray result = rehabilitationManageService.serviceDoctorList(getUID());
            return write(200, "获取成功!", "data", result);
        } catch (Exception e) {
            error(e);
            return error(-1, "请求失败");
        }
    }
    @RequestMapping(value = "calendarPlanDetailList", method = RequestMethod.GET)
    @ApiOperation("康复管理-康复计划按列表展示")
    @ObserverRequired
    public String calendarPlanDetailList(@ApiParam(name = "executeStartTime", value = "日历开始时间(格式:yyyy-MM-dd HH:mm:ss)", required = true)
                                         @RequestParam(value = "executeStartTime", required = true)String executeStartTime,
                                         @ApiParam(name = "executeEndTime", value = "日历结束时间(格式:yyyy-MM-dd HH:mm:ss)", required = true)
                                         @RequestParam(value = "executeEndTime", required = true)String executeEndTime,
                                         @ApiParam(name = "planId", value = "计划id", required = true)
                                         @RequestParam(value = "planId", required = true)String planId,
                                         @ApiParam(name = "searchTask", value = "快速查找任务:(1、我的任务,2、随访,3、复诊,4、健康教育)", required = false)
                                         @RequestParam(value = "searchTask", required = false)Integer searchTask,
                                         @ApiParam(name = "status", value = "任务状态(0未完成,1已完成,2已预约)", required = false)
                                         @RequestParam(value = "status", required = false)Integer status){
        try {
            JSONArray result = rehabilitationManageService.calendarPlanDetailList(executeStartTime,executeEndTime,planId,searchTask,status,null);
            return write(200, "获取成功", "data", result);
        } catch (Exception e) {
            error(e);
            return error(-1, "请求失败");
        }
    }
    @RequestMapping(value = "sendMessageIm", method = RequestMethod.POST)
    @ApiOperation("康复管理-扫描二维码发送消息")
    @ObserverRequired
    public String sendMessageIm(@ApiParam(name = "sendId", value = "发送者id")@RequestParam(value = "sendId", required = true)String sendId,
                                @ApiParam(name = "receiverId", value = "接受者id", required = true)@RequestParam(value = "receiverId", required = true)String receiverId,
                                @ApiParam(name = "content", value = "内容", required = true)@RequestParam(value = "content", required = true)String content){
        try {
            imUtill.sendMessage(sendId,receiverId,"1",content);
            return write(200,"发送成功!");
        } catch (Exception e) {
            error(e);
            return error(-1, "发送失败!");
        }
    }
    @RequestMapping(value = "checkAfterQrCode", method = RequestMethod.POST)
    @ApiOperation("康复管理-居民扫码后验证是否是关联的居民扫码")
    @ObserverRequired
    public String checkAfterQrCode(@ApiParam(name = "planDetailId", value = "康复计划项目明细ID")@RequestParam(value = "planDetailId", required = true)String planDetailId,
                                   @ApiParam(name = "patientCode", value = "居民端登录的居民code")@RequestParam(value = "patientCode", required = true)String patientCode){
        try {
            JSONObject result = rehabilitationManageService.checkAfterQrCode(planDetailId,patientCode);
            return write(200, String.valueOf(result.get("message")), "data", result.get("obj"));
        } catch (Exception e) {
            error(e);
            return error(-1, "验证失败");
        }
    }
}

+ 12 - 5
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/statistic/EsStatisticsController.java

@ -519,10 +519,13 @@ public class EsStatisticsController extends BaseController {
                    }
                    //20指标一个键绑定一条数据 2018年开始所以改用86指标. 2018-08-27 zd
                    String thisYear = Constant.getNowYearByDate(endDate);
                    JSONObject json = new JSONObject();
                    if ("20".equals(idx) && Integer.valueOf(thisYear)>=2018){
                        idx="86";
                        //@TODO idx="86";1.5.0版本返回前端改为index_86
                        json = statisticsESService.getDateTotal(startDate, endDate, interval, area, level, "86", lowCode, year,SaveModel.timeLevel_DDL);
                    }else {
                        json = statisticsESService.getDateTotal(startDate, endDate, interval, area, level, idx, lowCode, year,SaveModel.timeLevel_DDL);
                    }
                    JSONObject json = statisticsESService.getDateTotal(startDate, endDate, interval, area, level, idx, lowCode, year,SaveModel.timeLevel_DDL);
                    result.put("index_" + idx, json);
                }
            }
@ -598,7 +601,8 @@ public class EsStatisticsController extends BaseController {
                        result.put("index_" + idx, statisticsESService.getLowLevelTotalOnlineTeamLeader(date, area, level, idx, sort, lowLevel, year, ""));
                    }else if (idx.equals("20") && Integer.valueOf(year)>=2018){
                        //20指标是一个键绑定一条数据 所以2018年开始使用86指标 2018-08-27 zd
                        result.put("index_" + idx, statisticsESService.getDeviceLowLevelTotal(date, area, level, "86", sort, lowLevel, year));
                        //@TODO idx="86";
                        result.put("index_" + idx, statisticsESService.getDeviceLowLevelTotal(date, area, level,"86", sort, lowLevel, year));
                    }else {
                        result.put("index_" + idx, statisticsESService.getLowLevelTotal(date, area, level, idx, sort, lowLevel, year));
                    }
@ -665,10 +669,13 @@ public class EsStatisticsController extends BaseController {
            JSONObject result = new JSONObject();
            for (String idx : indexes) {
                Long total= 0L;
                if ("20".equals(idx) && Integer.valueOf(year)>=2018){
                    idx = "86";
                    //@TODO idx = "86",1.5.0版本改成返回前端改成index_86;
                    total = statisticsESService.getIndexTotal(endDate, area, level, "86", "2");
                }else {
                    total = statisticsESService.getIndexTotal(endDate, area, level, idx, "2");
                }
                Long total=statisticsESService.getIndexTotal(endDate, area, level, idx, "2");
                result.put("index_" + idx, total);
            }

+ 62 - 38
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/third/specialist/ThirdRehabilitationPlanController.java

@ -38,19 +38,13 @@ public class ThirdRehabilitationPlanController extends BaseController {
    @RequestMapping(value = "/findTemplateList", method = RequestMethod.GET)
    @ApiOperation(value = "获取康复服务套餐模板列表")
    public String templateList(@ApiParam(name = "patient", value = "居民标识")
    public String templateList(@ApiParam(name = "doctor", value = "医生标识")
                                   @RequestParam(required = true)String doctor,
                               @ApiParam(name = "patient", value = "居民标识")
                                   @RequestParam(required = false)String patient){
        try {
            Long adminTeamId = null;
            if(StringUtils.isNotBlank(patient)) {
                SignFamily signFamily = familyService.findByPatientAndDoctor(patient, getUID());
                adminTeamId = signFamily.getAdminTeamId();
            }else {
                AdminTeam team = teamService.findByLeaderCode(getUID());
                adminTeamId = team.getId();
            }
            return write(200, "获取成功", "data", rehabilitationPlanService.findTemplateInfo(adminTeamId));
//            return write(200, "获取成功", "data", rehabilitationPlanService.findTemplateInfo((long) 646));
            return write(200, "获取成功", "data", rehabilitationPlanService.findTemplateInfo(doctor, patient));
        } catch (Exception e) {
            error(e);
            return error(-1, "请求失败");
@ -63,7 +57,6 @@ public class ThirdRehabilitationPlanController extends BaseController {
                                         @RequestParam(required = true)String templateId){
        try {
            return write(200, "获取成功", "data", rehabilitationPlanService.findTemplateDetailInfo(templateId));
//            return write(200, "获取成功", "data", rehabilitationPlanService.findTemplateInfo((long) 646));
        } catch (Exception e) {
            error(e);
            return error(-1, "请求失败");
@ -72,14 +65,14 @@ public class ThirdRehabilitationPlanController extends BaseController {
    @RequestMapping(value = "/createTemplate", method = RequestMethod.POST)
    @ApiOperation(value = "创建康复服务套餐模板")
    public String createTemplate(@ApiParam(name = "title", value = "康复服务模板名称")
                                 @RequestParam(required = true) String title){
    public String createTemplate(@ApiParam(name = "doctor", value = "医生标识")
                                     @RequestParam(required = true)String doctor,
                                 @ApiParam(name = "title", value = "康复服务模板名称")
                                    @RequestParam(required = true) String title){
        try {
            AdminTeam team = teamService.findByLeaderCode(getUID());
            Doctor doctor = doctorService.findDoctorByCode(getUID());
            return write(200, "获取成功", "data", rehabilitationPlanService.createTemplate(title,doctor,team.getId()));
//            Doctor doctor = doctorService.findDoctorByCode("0272469a6dcf11e69f7c005056850d66");
//            return write(200, "获取成功", "data", rehabilitationPlanService.createTemplate(title,doctor,(long) 646));
            AdminTeam team = teamService.findByLeaderCode(doctor);
            Doctor d = doctorService.findDoctorByCode(doctor);
            return write(200, "获取成功", "data", rehabilitationPlanService.createTemplate(title,d,team.getId()));
        } catch (Exception e) {
            error(e);
            return error(-1, "请求失败");
@ -88,15 +81,27 @@ public class ThirdRehabilitationPlanController extends BaseController {
    @RequestMapping(value = "/createTemplateDetail", method = RequestMethod.POST)
    @ApiOperation(value = "创建康复服务套餐模板明细")
    public String createTemplateDetail(@ApiParam(name = "json", value = "康复服务模板明细")
                                 @RequestParam(required = true) String json,
    public String createTemplateDetail(@ApiParam(name = "doctor", value = "医生标识")
                                           @RequestParam(required = true)String doctor,
                                       @ApiParam(name = "json", value = "康复服务模板明细")
                                            @RequestParam(required = true) String json,
                                       @ApiParam(name = "type", value = "create或者edit")
                                       @RequestParam(required = true) String type){
                                            @RequestParam(required = true) String type){
        try {
            Doctor d = doctorService.findDoctorByCode(doctor);
            return write(200, "获取成功", "data", rehabilitationPlanService.createTemplateDetail(json, type, d));
        } catch (Exception e) {
            error(e);
            return error(-1, "请求失败");
        }
    }
    @RequestMapping(value = "/deleteTemplate", method = RequestMethod.POST)
    @ApiOperation(value = "删除康复服务套餐模板")
    public String deleteTemplate(@ApiParam(name = "templateId", value = "模板id")
                                 @RequestParam(required = true)String templateId){
        try {
//            Doctor doctor = doctorService.findDoctorByCode(getUID());
//            return write(200, "获取成功", "data", rehabilitationPlanService.createTemplate(title,doctor,team.getId()));
            Doctor doctor = doctorService.findDoctorByCode("0272469a6dcf11e69f7c005056850d66");
            return write(200, "获取成功", "data", rehabilitationPlanService.createTemplateDetail(json,type,doctor));
            return write(200, "获取成功", "data", rehabilitationPlanService.deleteTemplate(templateId));
        } catch (Exception e) {
            error(e);
            return error(-1, "请求失败");
@ -104,14 +109,18 @@ public class ThirdRehabilitationPlanController extends BaseController {
    }
    @RequestMapping(value = "/findServiceItemsByHospital", method = RequestMethod.GET)
    @ApiOperation(value = "根据机构查找服务项目列表")
    public String findServiceItemsByHospital(@ApiParam(name = "patient", value = "居民标识")
                                                 @RequestParam(required = true)String patient){
    @ApiOperation(value = "获取机构服务项目列表")
    public String findServiceItemsByHospital(@ApiParam(name = "doctor", value = "医生标识")
                                                 @RequestParam(required = true)String doctor,
                                             @ApiParam(name = "patient", value = "居民标识")
                                                 @RequestParam(required = false)String patient){
        try {
//            Doctor doctor = doctorService.findDoctorByCode(getUID());
            SignFamily signFamily = familyService.findByPatientAndDoctor(patient, getUID());
            Doctor doctor = doctorService.findDoctorByCode("0272469a6dcf11e69f7c005056850d66");
            return write(200, "获取成功", "data", rehabilitationPlanService.findServiceItemsByHospital(signFamily,doctor));
            SignFamily signFamily = new SignFamily();
            Doctor d = doctorService.findDoctorByCode(doctor);
            if(StringUtils.isNotBlank(patient)) {
                signFamily = familyService.findByPatient(patient);
            }
            return write(200, "获取成功", "data", rehabilitationPlanService.findServiceItemsByHospital(d.getHospital(), signFamily.getHospital()));
        } catch (Exception e) {
            error(e);
            return error(-1, "请求失败");
@ -120,12 +129,27 @@ public class ThirdRehabilitationPlanController extends BaseController {
    @RequestMapping(value = "/createRehabilitationPlan", method = RequestMethod.POST)
    @ApiOperation(value = "创建居民康复计划")
    public String createRehabilitationPlan(@ApiParam(name = "json", value = "康复计划json")
                                 @RequestParam(required = true) String json){
    public String createRehabilitationPlan(@ApiParam(name = "doctor", value = "医生标识")
                                               @RequestParam(required = true)String doctor,
                                           @ApiParam(name = "json", value = "康复计划json")
                                               @RequestParam(required = true) String json){
        try {
            Doctor d = doctorService.findDoctorByCode(doctor);
            return write(200, "获取成功", "data", rehabilitationPlanService.createRehabilitationPlan(json,d));
        } catch (Exception e) {
            error(e);
            return error(-1, "请求失败");
        }
    }
    @RequestMapping(value = "/getPatientInfoByDoctor", method = RequestMethod.GET)
    @ApiOperation(value = "根据医生code获取签约居民信息")
    public String getPatientInfoByDoctor(@ApiParam(name = "doctor", value = "医生标识")
                                         @RequestParam(required = true)String doctor,
                                         @ApiParam(name = "patientInfo", value = "居民信息")
                                         @RequestParam(required = false)String patientInfo){
        try {
//            Doctor doctor = doctorService.findDoctorByCode(getUID());
            Doctor doctor = doctorService.findDoctorByCode("0272469a6dcf11e69f7c005056850d66");
            return write(200, "获取成功", "data", rehabilitationPlanService.createRehabilitationPlan(json,doctor));
            return write(200, "获取成功", "data", rehabilitationPlanService.getPatientInfoByDoctor(doctor, patientInfo));
        } catch (Exception e) {
            error(e);
            return error(-1, "请求失败");

+ 5 - 2
patient-co/patient-co-wlyy/src/main/resources/application-dev.yml

@ -47,7 +47,7 @@ healthBank:
#康复计划配置
rehabilitation:
  url: http://localhost:10055/svr-rehabilitation/
  url: http://localhost:10051/svr-wlyy-rehabilitation/
#小程序
applets:
@ -153,8 +153,11 @@ images:
  renew_path: /usr/local/apache-tomcat-8.0.26/webapps/wlyy/images/renew.png
  sign_path: /usr/local/apache-tomcat-8.0.26/webapps/wlyy/images/familycontract.png
#sign:
#  check_upload: http://172.19.103.87:8011/wlyy_service
#  check_upload_sign: http://172.19.103.88:8011/wlyy_sign
sign:
  check_upload: http://172.19.103.87:8011/wlyy_service
  check_upload: http://172.19.103.88:8011/wlyy_service
  check_upload_sign: http://172.19.103.88:8011/wlyy_sign
express: