Forráskód Böngészése

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

huangwenjie 7 éve
szülő
commit
a6c9f3bce4
19 módosított fájl, 546 hozzáadás és 58 törlés
  1. BIN
      classes/production/JkEdu/com/yihu/jk/api/ArticleApi.class
  2. BIN
      classes/production/JkEdu/com/yihu/jk/dao/ArticleDao.class
  3. 11 0
      patient-co-service/wlyy_device/src/main/java/com/yihu/hos/device/model/PatientHealthIndex.java
  4. 1 0
      patient-co-service/wlyy_device/src/main/java/com/yihu/hos/device/service/DeviceService.java
  5. 52 0
      patient-co/patient-co-statistics-es/src/main/java/com/yihu/wlyy/statistics/etl/convert/wlyy/DeviceTypeConvert.java
  6. 66 0
      patient-co/patient-co-statistics-es/src/main/java/com/yihu/wlyy/statistics/etl/convert/wlyy/UseDeviceTypeConvert.java
  7. 228 26
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/statisticsES/StatisticsESService.java
  8. 41 6
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/specialist/SpecialistService.java
  9. 33 14
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/weixin/applets/AppletsService.java
  10. 49 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/util/SecretUtils.java
  11. 15 11
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/specialist/SpecialistController.java
  12. 9 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/statistic/EsStatisticsController.java
  13. 12 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/wx/AppletsController.java
  14. 5 0
      patient-co/patient-co-wlyy/src/main/resources/application-dev.yml
  15. 5 0
      patient-co/patient-co-wlyy/src/main/resources/application-devtest.yml
  16. 5 0
      patient-co/patient-co-wlyy/src/main/resources/application-local.yml
  17. 5 0
      patient-co/patient-co-wlyy/src/main/resources/application-localtest.yml
  18. 5 0
      patient-co/patient-co-wlyy/src/main/resources/application-prod.yml
  19. 4 0
      patient-co/patient-co-wlyy/src/main/resources/application-test.yml

BIN
classes/production/JkEdu/com/yihu/jk/api/ArticleApi.class


BIN
classes/production/JkEdu/com/yihu/jk/dao/ArticleDao.class


+ 11 - 0
patient-co-service/wlyy_device/src/main/java/com/yihu/hos/device/model/PatientHealthIndex.java

@ -50,6 +50,8 @@ public class PatientHealthIndex extends IdEntity {
	private Integer status;//状态:0为标准,1为异常
	private Integer status;//状态:0为标准,1为异常
	private Integer manageResult;//异常数据处理 0未干预 1异常有效干预 2异常无效干预
	public String getUser() {
	public String getUser() {
		return user;
		return user;
	}
	}
@ -192,4 +194,13 @@ public class PatientHealthIndex extends IdEntity {
	public void setStatus(Integer status) {
	public void setStatus(Integer status) {
		this.status = status;
		this.status = status;
	}
	}
	@Column(name = "manage_result")
	public Integer getManageResult() {
		return manageResult;
	}
	public void setManageResult(Integer manageResult) {
		this.manageResult = manageResult;
	}
}
}

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

@ -835,6 +835,7 @@ public class DeviceService extends BaseService{
            obj.setDel("1");
            obj.setDel("1");
            obj.setRecordDate(time);    //记录时间
            obj.setRecordDate(time);    //记录时间
            obj.setSortDate(time);      //排序时间
            obj.setSortDate(time);      //排序时间
            obj.setManageResult(0);//默认数据是医生未干预状态
            String user = device.getUser();
            String user = device.getUser();
            obj.setUser(user);
            obj.setUser(user);

+ 52 - 0
patient-co/patient-co-statistics-es/src/main/java/com/yihu/wlyy/statistics/etl/convert/wlyy/DeviceTypeConvert.java

@ -0,0 +1,52 @@
package com.yihu.wlyy.statistics.etl.convert.wlyy;
import com.yihu.wlyy.entity.dimension.WlyyDimensionQuota;
import com.yihu.wlyy.statistics.etl.convert.Convert;
import com.yihu.wlyy.statistics.util.Contant;
import com.yihu.wlyy.statistics.util.IdCardUtil;
import com.yihu.wlyy.statistics.vo.DataModel;
import org.springframework.jdbc.core.JdbcTemplate;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
 * Created by chenweida on 2017/6/5.
 */
public class DeviceTypeConvert implements Convert {
    /**
     * @param oneList    数据
     * @param slaveLevel 从1开始
     * @return
     */
    @Override
    public List<DataModel> convert(JdbcTemplate jdbcTemplate,List<DataModel> oneList, String slaveLevel, WlyyDimensionQuota temp) {
        String sql = temp.getDictSql();
        List<Map<String,Object>> result = jdbcTemplate.queryForList(sql);
        for(DataModel one:oneList) {
            try {
                String key = getKey(one,result);
                DataModel.class.getMethod("setSlaveKey" + slaveLevel, String.class).invoke(one, key);
            } catch (Exception e) {
                e.printStackTrace();
            }
        };
        return oneList;
    }
    public String getKey(DataModel dataModel,List<Map<String,Object>> dict){
        for (Map<String,Object> one : dict){
            String result = one.get("name")+"";
            if(dataModel.getServerType().equals(result)||dataModel.getServerType().indexOf(result)>0){
                return one.get("code")+"";
            }
        }
        return "";
    }
}

+ 66 - 0
patient-co/patient-co-statistics-es/src/main/java/com/yihu/wlyy/statistics/etl/convert/wlyy/UseDeviceTypeConvert.java

@ -0,0 +1,66 @@
package com.yihu.wlyy.statistics.etl.convert.wlyy;
import com.yihu.wlyy.entity.dimension.WlyyDimensionQuota;
import com.yihu.wlyy.statistics.etl.convert.Convert;
import com.yihu.wlyy.statistics.vo.DataModel;
import org.springframework.jdbc.core.JdbcTemplate;
import java.util.List;
import java.util.Map;
/**
 * Created by chenweida on 2017/6/5.
 */
public class UseDeviceTypeConvert implements Convert {
    /**
     * @param oneList    数据
     * @param slaveLevel 从1开始
     * @return
     */
    @Override
    public List<DataModel> convert(JdbcTemplate jdbcTemplate,List<DataModel> oneList, String slaveLevel, WlyyDimensionQuota temp) {
        String sql = temp.getDictSql();
        List<Map<String,Object>> result = jdbcTemplate.queryForList(sql);
        Map<String,Object> map = null;
        for(DataModel one:oneList) {
            try {
                map = getTeam(one,jdbcTemplate);
                if(map!=null){
                    one.setTeam(map.get("grant_admin_team")+"");
                    one.setServerType(map.get("device_name")+"");
                }else{
                    continue;
                }
                String key = getKey(one,result);
                DataModel.class.getMethod("setSlaveKey" + slaveLevel, String.class).invoke(one, key);
            } catch (Exception e) {
                e.printStackTrace();
            }
        };
        return oneList;
    }
    public String getKey(DataModel dataModel,List<Map<String,Object>> dict){
        for (Map<String,Object> one : dict){
            String result = one.get("name")+"";
            if(dataModel.getServerType().equals(result)||dataModel.getServerType().indexOf(result)>0){
                return one.get("code")+"";
            }
        }
        return "";
    }
    public Map<String,Object> getTeam(DataModel dataModel,JdbcTemplate jdbcTemplate){
        String deviceCode =  dataModel.getHealthProblem();
        String sql = " select * from device.wlyy_devices d where d.device_code ='"+deviceCode+"' and is_grant=1";
        List<Map<String,Object>> result = jdbcTemplate.queryForList(sql);
        if(result.size()>0){
            return result.get(0);
        }
        return null;
    }
}

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

@ -22,6 +22,7 @@ import org.apache.commons.lang3.StringUtils;
import org.json.JSONArray;
import org.json.JSONArray;
import org.json.JSONObject;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.JdbcTemplate;
@ -57,7 +58,10 @@ public class StatisticsESService {
    private SystemDictService systemDictService;
    private SystemDictService systemDictService;
    @Autowired
    @Autowired
    private StatisticsAllService statisticsAllService;
    private StatisticsAllService statisticsAllService;
    @Value("${es.type.HealthEduArticlePatient}")
    private String esType;
    @Value("${es.index.HealthEduArticlePatient}")
    private String esIndex;
    @Autowired
    @Autowired
    private StatisticsService statisticsService;
    private StatisticsService statisticsService;
@ -937,7 +941,7 @@ public class StatisticsESService {
                json.put("amount", amount);
                json.put("amount", amount);
                result.add(json);
                result.add(json);
            }
            }
            if (saveModels!=null && saveModels.size()==1 && saveModels.get(0).getId()==null) {
            if (saveModels!=null && saveModels.size()==1 && saveModels.get(0).getHospital()==null) {
                List<Map<String,Object>> resultList = DateUtil.findDates(dateFormat.parse(startDate), dateFormat.parse(DateUtil.getNextDay(endDate,1)));
                List<Map<String,Object>> resultList = DateUtil.findDates(dateFormat.parse(startDate), dateFormat.parse(DateUtil.getNextDay(endDate,1)));
                result.clear();
                result.clear();
                for (Map<String,Object> map : resultList){
                for (Map<String,Object> map : resultList){
@ -990,7 +994,11 @@ public class StatisticsESService {
        String firstEnd = "";
        String firstEnd = "";
        // 结束日期
        // 结束日期
        Calendar end = Calendar.getInstance();
        Calendar end = Calendar.getInstance();
        end.setTime(DateUtil.strToDate(endDate, DateUtil.YYYY_MM_DD));
        //因为统计时间是统计到当前时间的前一天,所以这里的时间是提前一天
        Calendar temp = Calendar.getInstance();
        temp.setTime(DateUtil.strToDate(endDate, DateUtil.YYYY_MM_DD));
        temp.add(Calendar.DAY_OF_MONTH, -1);
        end.setTime(temp.getTime());
        // 起始日期为周几
        // 起始日期为周几
        int week = start.get(Calendar.DAY_OF_WEEK);
        int week = start.get(Calendar.DAY_OF_WEEK);
        int incre = 7 - week + 1;
        int incre = 7 - week + 1;
@ -1083,7 +1091,10 @@ public class StatisticsESService {
                    range = df.format(saveModel.getQuotaDate());
                    range = df.format(saveModel.getQuotaDate());
                }
                }
                JSONObject json = countResult.get(range);
                JSONObject json = countResult.get(range);
                //因为上述时间集提前一天  但是前端是显示当前时间,所以这里给调整回去
                if(range.equals(df.format(temp.getTime()))){
                    json.put("range",endDate);
                }
                if (json != null) {
                if (json != null) {
                    long amount = saveModel.getResult2().longValue();
                    long amount = saveModel.getResult2().longValue();
                    json.put("amount", amount);
                    json.put("amount", amount);
@ -1133,7 +1144,11 @@ public class StatisticsESService {
        start.setTime(DateUtil.strToDate(startDate, DateUtil.YYYY_MM_DD));
        start.setTime(DateUtil.strToDate(startDate, DateUtil.YYYY_MM_DD));
        // 结束日期
        // 结束日期
        Calendar end = Calendar.getInstance();
        Calendar end = Calendar.getInstance();
        end.setTime(DateUtil.strToDate(endDate, DateUtil.YYYY_MM_DD));
        //因为统计时间是统计到当前时间的前一天,所以这里的时间是提前一天
        Calendar temp = Calendar.getInstance();
        temp.setTime(DateUtil.strToDate(endDate, DateUtil.YYYY_MM_DD));
        temp.add(Calendar.DAY_OF_MONTH, -1);
        end.setTime(temp.getTime());
        // 日期集合
        // 日期集合
        List<Calendar> days = new ArrayList<>();
        List<Calendar> days = new ArrayList<>();
@ -1204,7 +1219,10 @@ public class StatisticsESService {
                    range = df.format(saveModel.getQuotaDate());
                    range = df.format(saveModel.getQuotaDate());
                }
                }
                JSONObject json = countResult.get(range);
                JSONObject json = countResult.get(range);
                //因为上述时间集提前一天  但是前端是显示当前时间,所以这里给调整回去
                if(range.equals(df.format(temp.getTime()))){
                    json.put("range",endDate);
                }
                if (json != null) {
                if (json != null) {
                    long amount = saveModel.getResult2().longValue();
                    long amount = saveModel.getResult2().longValue();
                    json.put("amount", amount);
                    json.put("amount", amount);
@ -5156,31 +5174,105 @@ public class StatisticsESService {
        return saveModel.getResult2().longValue();
        return saveModel.getResult2().longValue();
    }
    }
    public Map<String,Object> getLevelDeviceAndBinding(String area, int level, int sort, String lowLevel, String year) throws Exception {
        String index_85 = "85";
        String index_86= "86";
    public Map<String,Object> getLevelDeviceAndBinding(String area, int level, int sort, String lowLevel, String year,String deviceType) throws Exception {
        String index_85 = "85";//设备发放量统计指标
        String index_86= "86";//设备绑定量统计指标
        String index_87= "87";//设备使用量统计指标
        String index_88= "88";//设备异常数据24H统计指标
        //String lastDate = year + "-06-30";
        //String lastDate = year + "-06-30";
        //String timeKey = elasticsearchUtil.getQuotaTime();
        //String timeKey = elasticsearchUtil.getQuotaTime();
        String timeKey = DateUtil.getStringDateShort();
        String timeKey = DateUtil.getStringDateShort();//当前时间
        String mondayTime = DateUtil.getMondayOfThisDate(new Date());//本周一开始时间
        String low_level = String.valueOf(StringUtils.isEmpty(lowLevel) ? (level + 1) : lowLevel);
        String low_level = String.valueOf(StringUtils.isEmpty(lowLevel) ? (level + 1) : lowLevel);
        List<Map<String, Object>> resultList = new ArrayList<>();
        Map<String,Object> resultMap = new HashedMap();
        Map<String,Object> resultMap = new HashedMap();
        DecimalFormat df = new DecimalFormat("0.00");
        List<Map<String, Object>> resultList = new ArrayList<>();
        //发放量
        List<SaveModel> allAmountList = elasticsearchUtil.findDateQuotaLevel0(timeKey, timeKey, area, level, index_85, SaveModel.timeLevel_DDL, "", low_level);
        //绑定量
        List<SaveModel> bindingAmountList = elasticsearchUtil.findDateQuotaLevel0(timeKey, timeKey, area, level, index_86, SaveModel.timeLevel_DDL, "", low_level);
        Integer totalAllNum = 0;
        Integer totalBindingNum = 0;
        for (SaveModel totalSaveModel : allAmountList){
            totalAllNum += totalSaveModel.getResult2().intValue();
        }
        for (SaveModel bindSaveModel : bindingAmountList){
            totalBindingNum += bindSaveModel.getResult2().intValue();
        SaveModel grantSaveModel = null;
        SaveModel bindingSaveModel = null;
        List<SaveModel> useSaveModel = null;
        SaveModel anomalySaveModel = null;
        String allCountSql = "";
        String anomalyCountSql ="";
//        List<SaveModel> grantList = null;//发放量折线图
//        List<SaveModel> bindingList = null;//绑定量折线图
        List<SaveModel> allAmountList = null;//发放量列表
        List<SaveModel> bindingAmountList = null;//绑定量列表
        switch (deviceType){
            case "1": {
                grantSaveModel = elasticsearchUtil.findOneDateQuotaLevel1(timeKey,area,level, index_85,SaveModel.timeLevel_DDL,"hemopiezometer");
                bindingSaveModel = elasticsearchUtil.findOneDateQuotaLevel1(timeKey,area,level, index_86,SaveModel.timeLevel_DDL,"hemopiezometer");
                allCountSql = "SELECT COUNT(*) FROM device.wlyy_devices d where device_name like '%血压%'";
                useSaveModel = elasticsearchUtil.findDateQuotaLevel1(mondayTime,timeKey, area, level, index_87, SaveModel.timeLevel_ZL, "hemopiezometer", null, null);
                anomalySaveModel = elasticsearchUtil.findOneDateQuotaLevel1(timeKey,area,level, index_88,SaveModel.timeLevel_DDL,"hemopiezometer");
                anomalyCountSql =" SELECT COUNT(d.id) FROM device.wlyy_patient_health_index d where d.type =1 and d.status=1 and d.del=1";
//                grantList = elasticsearchUtil.findDateQuotaLevel1(timeKey,timeKey,area,level,index_85, SaveModel.timeLevel_DDL, "hemopiezometer", interval, null);
//                bindingList = elasticsearchUtil.findDateQuotaLevel1(timeKey,timeKey,area,level,index_86, SaveModel.timeLevel_DDL, "hemopiezometer", interval, null);
                allAmountList = elasticsearchUtil.findDateQuotaLevel1(timeKey, timeKey, area, level, index_85, SaveModel.timeLevel_DDL, "hemopiezometer","", low_level);
                bindingAmountList = elasticsearchUtil.findDateQuotaLevel1(timeKey, timeKey, area, level, index_86, SaveModel.timeLevel_DDL, "hemopiezometer","", low_level);
                break;
            }
            case "2": {
                grantSaveModel = elasticsearchUtil.findOneDateQuotaLevel1(timeKey,area,level, index_85,SaveModel.timeLevel_DDL,"glucometer");
                bindingSaveModel = elasticsearchUtil.findOneDateQuotaLevel1(timeKey,area,level, index_86,SaveModel.timeLevel_DDL,"glucometer");
                allCountSql = "SELECT COUNT(*) FROM device.wlyy_devices d where device_name like '%血糖%'";
                useSaveModel = elasticsearchUtil.findDateQuotaLevel1(mondayTime,timeKey, area, level, index_87, SaveModel.timeLevel_ZL, "glucometer", null, null);
                anomalySaveModel = elasticsearchUtil.findOneDateQuotaLevel1(timeKey,area,level, index_88,SaveModel.timeLevel_DDL,"glucometer");
                anomalyCountSql =" SELECT COUNT(d.id) FROM device.wlyy_patient_health_index d where d.type =2 and d.status=1 and d.del=1";
//                elasticsearchUtil.findDateQuotaLevel1(timeKey,timeKey,area,level,index_85, SaveModel.timeLevel_DDL, "glucometer", interval, null);
//                elasticsearchUtil.findDateQuotaLevel1(timeKey,timeKey,area,level,index_86, SaveModel.timeLevel_DDL, "glucometer", interval, null);
//                grantList = elasticsearchUtil.findDateQuotaLevel1(timeKey,timeKey,area,level,index_85, SaveModel.timeLevel_DDL, "hemopiezometer", interval, null);
//                bindingList = elasticsearchUtil.findDateQuotaLevel1(timeKey,timeKey,area,level,index_86, SaveModel.timeLevel_DDL, "hemopiezometer", interval, null);
                allAmountList = elasticsearchUtil.findDateQuotaLevel1(timeKey, timeKey, area, level, index_85, SaveModel.timeLevel_DDL, "glucometer","", low_level);
                bindingAmountList = elasticsearchUtil.findDateQuotaLevel1(timeKey, timeKey, area, level, index_86, SaveModel.timeLevel_DDL, "glucometer","", low_level);
                break;
            }
            default: {
                grantSaveModel = elasticsearchUtil.findOneDateQuotaLevel0(timeKey,area,level, index_85,SaveModel.timeLevel_DDL);
                bindingSaveModel = elasticsearchUtil.findOneDateQuotaLevel0(timeKey,area,level, index_86,SaveModel.timeLevel_DDL);
                anomalySaveModel = elasticsearchUtil.findOneDateQuotaLevel0(timeKey,area,level, index_88,SaveModel.timeLevel_DDL);
                allCountSql = "SELECT COUNT(*) FROM device.wlyy_devices d ";
                anomalyCountSql =" SELECT COUNT(d.id) FROM device.wlyy_patient_health_index d where  d.status=1 and d.del=1";
                useSaveModel = elasticsearchUtil.findDateQuotaLevel0(mondayTime,timeKey, area, level, index_87, SaveModel.timeLevel_ZL,  null, null);
//                grantList = elasticsearchUtil.findDateQuotaLevel0(timeKey,timeKey,area,level,index_85, SaveModel.timeLevel_DDL,  interval, null);
//                bindingList = elasticsearchUtil.findDateQuotaLevel0(timeKey,timeKey,area,level,index_86, SaveModel.timeLevel_DDL,  interval, null);
                allAmountList = elasticsearchUtil.findDateQuotaLevel0(timeKey, timeKey, area, level, index_85, SaveModel.timeLevel_DDL,"", low_level);
                bindingAmountList = elasticsearchUtil.findDateQuotaLevel0(timeKey, timeKey, area, level, index_86, SaveModel.timeLevel_DDL, "", low_level);
            }
        }
        Integer allCount = jdbcTemplate.queryForObject(allCountSql,Integer.class);
//        Long total = elasticsearchUtil.excuteForLong(countSql,esIndex, esType);
        resultMap.put("totalAll",allCount);//采购量
        resultMap.put("totalGrant",grantSaveModel.getResult1());//发放量
        resultMap.put("totalBinding",bindingSaveModel.getResult1());//绑定量
        if(allCount>0){
            resultMap.put("totalGrantRange",df.format( grantSaveModel.getResult1() > 0.0? ((grantSaveModel.getResult1())/(allCount * 1.0000)*100):0.0)+"%");//发放率
            resultMap.put("totalBindingRange",df.format( bindingSaveModel.getResult1() > 0.0? ((bindingSaveModel.getResult1())/(grantSaveModel.getResult1() * 1.0000)*100):0.0)+"%");//绑定率
        }else{
            resultMap.put("totalGrantRange",0.0+"%");//发放率
            resultMap.put("totalBindingRange",0.0+"%");//绑定率
        }
        Double totalUseAccount = useSaveModel.size()>0?useSaveModel.get(0).getResult1():0.0;
        resultMap.put("totalUse",totalUseAccount);//本周使用量
        if(grantSaveModel.getResult1()>0){
            resultMap.put("totalUseRange",df.format( totalUseAccount > 0.0? ((totalUseAccount)/(grantSaveModel.getResult1() * 1.0000)*100):0.0)+"%");//本周使用率
        }else{
            resultMap.put("totalUseRange",0.0+"%");//本周使用率
        }
        Integer totalAnomaly = jdbcTemplate.queryForObject(anomalyCountSql,Integer.class);
        resultMap.put("totalAnomaly",totalAnomaly);//异常数据量
        resultMap.put("totalIntervene",anomalySaveModel.getResult1());//干预指导数
        if(totalAnomaly>0){
            resultMap.put("totalInterveneRange",df.format( anomalySaveModel.getResult1() > 0.0? ((anomalySaveModel.getResult1())/(totalAnomaly * 1.0000)*100):0.0)+"%");//异常数据24h干预指导率
        }else{
            resultMap.put("totalInterveneRange",0.0+"%");//异常数据24h干预指导率
        }
        }
        resultMap.put("totalAll",totalAllNum);
        resultMap.put("totalBinding",totalBindingNum);
        resultMap.put("totalRange",getRange(totalBindingNum, totalAllNum, 2));
        Map<String, Integer> allMap = new HashMap<>(); //发放量的的列表转map
        Map<String, Integer> allMap = new HashMap<>(); //发放量的的列表转map
        if (allAmountList != null && allAmountList.size() > 0) {
        if (allAmountList != null && allAmountList.size() > 0) {
@ -5202,7 +5294,6 @@ public class StatisticsESService {
        if (resultList != null && resultList.size() > 0) {
        if (resultList != null && resultList.size() > 0) {
            Map<String, SaveModel> bingdingMap = new HashMap<>();
            Map<String, SaveModel> bingdingMap = new HashMap<>();
            DecimalFormat df = new DecimalFormat("0.0000");
            bindingAmountList.stream().forEach(one -> {
            bindingAmountList.stream().forEach(one -> {
                if ("5".equals(low_level)) {
                if ("5".equals(low_level)) {
                    bingdingMap.put(one.getTeam(), one);
                    bingdingMap.put(one.getTeam(), one);
@ -5261,6 +5352,117 @@ public class StatisticsESService {
    }
    }
//    public Map<String,Object> getLevelDeviceAndBinding(String area, int level, int sort, String lowLevel, String year) throws Exception {
//        String index_85 = "85";
//        String index_86= "86";
//        //String lastDate = year + "-06-30";
//        //String timeKey = elasticsearchUtil.getQuotaTime();
//        String timeKey = DateUtil.getStringDateShort();
//        String low_level = String.valueOf(StringUtils.isEmpty(lowLevel) ? (level + 1) : lowLevel);
//        List<Map<String, Object>> resultList = new ArrayList<>();
//        Map<String,Object> resultMap = new HashedMap();
//
//        //发放量
//        List<SaveModel> allAmountList = elasticsearchUtil.findDateQuotaLevel0(timeKey, timeKey, area, level, index_85, SaveModel.timeLevel_DDL, "", low_level);
//        //绑定量
//        List<SaveModel> bindingAmountList = elasticsearchUtil.findDateQuotaLevel0(timeKey, timeKey, area, level, index_86, SaveModel.timeLevel_DDL, "", low_level);
//        Integer totalAllNum = 0;
//        Integer totalBindingNum = 0;
//        for (SaveModel totalSaveModel : allAmountList){
//            totalAllNum += totalSaveModel.getResult2().intValue();
//        }
//        for (SaveModel bindSaveModel : bindingAmountList){
//            totalBindingNum += bindSaveModel.getResult2().intValue();
//        }
//        resultMap.put("totalAll",totalAllNum);
//        resultMap.put("totalBinding",totalBindingNum);
//        resultMap.put("totalRange",getRange(totalBindingNum, totalAllNum, 2));
//
//        Map<String, Integer> allMap = new HashMap<>(); //发放量的的列表转map
//        if (allAmountList != null && allAmountList.size() > 0) {
//            for (SaveModel saveModel : allAmountList) {
//                if ("3".equals(low_level) && saveModel.getTown() != null) {
//                    allMap.put(saveModel.getTown(), saveModel.getResult2().intValue());
//                } else if ("4".equals(low_level) && saveModel.getHospital() != null) {
//                    allMap.put(saveModel.getHospital(), saveModel.getResult2().intValue());
//                } else if ("5".equals(low_level) && saveModel.getTeam() != null) {
//                    allMap.put(saveModel.getTeam(), saveModel.getResult2().intValue());
//                } else {
//                    continue;
//                }
//            }
//        }
//
//        //自建结果集
//        resultList = getLowLevelMapKey(level, low_level, area);
//
//        if (resultList != null && resultList.size() > 0) {
//            Map<String, SaveModel> bingdingMap = new HashMap<>();
//            DecimalFormat df = new DecimalFormat("0.0000");
//            bindingAmountList.stream().forEach(one -> {
//                if ("5".equals(low_level)) {
//                    bingdingMap.put(one.getTeam(), one);
//                } else if ("4".equals(low_level)) {
//                    bingdingMap.put(one.getHospital(), one);
//                } else if ("3".equals(low_level)) {
//                    bingdingMap.put(one.getTown(), one);
//                }
//            });
//            for (Map<String, Object> reMap : resultList) {
//                reMap.put("amount", reMap.get("amount") != null ? Long.valueOf(reMap.get("amount").toString()) : 0L);
//                int bindingAmount = 0;
//                Integer allAmount = 0;
//                //获取绑定数量
//                if (bingdingMap != null && bingdingMap.size() > 0) {
//                    SaveModel one = bingdingMap.get(reMap.get("code").toString());
//                    if (one != null) {
//                        bindingAmount = one.getResult2().intValue();
//                    }
//                }
//                if (allMap != null && allMap.size() > 0) {
//                    allAmount = allMap.get(reMap.get("code").toString());
//                    if (allAmount == null) {
//                        allAmount = 0;
//                    }
//                } else {
//                }
//                reMap.put("allNum", allAmount);
//                reMap.put("bindingNum", bindingAmount);
//                reMap.put("rate", getRange(bindingAmount, allAmount, 2));//续签率是 续签量/去年的签约数
//            }
//
//            if ((level == 2 && "5".equals(lowLevel)) || (level == 4) || (level == 3 && "5".equals(lowLevel))) {
//                translateTeamLeaderName(resultList);
//            }
//            //对结果进行排序
//            Collections.sort(resultList, new Comparator<Map<String, Object>>() {
//                public int compare(Map<String, Object> o1, Map<String, Object> o2) {
//                    int map1value = (int) o1.get("allNum");
//                    int map2value = (int) o2.get("allNum");
//
//                    if (map1value - map2value > 0) {
//                        return sort == 1 ? -1 : 1;
//                    } else if (map1value - map2value < 0) {
//                        return sort == 1 ? 1 : -1;
//                    } else {
//                        return 0;
//                    }
//                }
//            });
//            resultMap.put("list",resultList);
//            return resultMap;
//        } else {
//            return new HashedMap();
//        }
//    }
    /**
    /**
     * 查询签约
     * 查询签约
     *
     *

+ 41 - 6
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/specialist/SpecialistService.java

@ -1,7 +1,9 @@
package com.yihu.wlyy.service.specialist;
package com.yihu.wlyy.service.specialist;
import com.yihu.wlyy.entity.doctor.team.admin.AdminTeam;
import com.yihu.wlyy.entity.doctor.team.sign.SignPatientLabel;
import com.yihu.wlyy.entity.doctor.team.sign.SignPatientLabel;
import com.yihu.wlyy.entity.doctor.team.sign.SignPatientLabelInfo;
import com.yihu.wlyy.entity.doctor.team.sign.SignPatientLabelInfo;
import com.yihu.wlyy.repository.doctor.DoctorAdminTeamDao;
import com.yihu.wlyy.repository.doctor.DoctorDao;
import com.yihu.wlyy.repository.doctor.DoctorDao;
import com.yihu.wlyy.repository.doctor.SignPatientLabelDao;
import com.yihu.wlyy.repository.doctor.SignPatientLabelDao;
import com.yihu.wlyy.repository.doctor.SignPatientLabelInfoDao;
import com.yihu.wlyy.repository.doctor.SignPatientLabelInfoDao;
@ -13,20 +15,24 @@ import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.StringUtils;
import org.json.JSONArray;
import org.json.JSONArray;
import org.json.JSONObject;
import org.json.JSONObject;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.ArrayList;
import java.util.Date;
import java.util.Date;
import java.util.List;
import java.util.List;
import java.util.Map;
import java.util.Map;
import java.util.logging.Logger;
/**
/**
 * Created by Trick on 2018/5/31.
 * Created by Trick on 2018/5/31.
 */
 */
@Service
@Service
@Transactional
public class SpecialistService extends BaseService {
public class SpecialistService extends BaseService {
    @Autowired
    @Autowired
@ -39,6 +45,8 @@ public class SpecialistService extends BaseService {
    private JdbcTemplate jdbcTemplate;
    private JdbcTemplate jdbcTemplate;
    @Value("${specialist.url}")
    @Value("${specialist.url}")
    private String specialistUrl;
    private String specialistUrl;
    @Autowired
    private DoctorAdminTeamDao doctorAdminTeamDao;
    public String setPatientLabelInfo(List<SignPatientLabelInfo> list){
    public String setPatientLabelInfo(List<SignPatientLabelInfo> list){
        if(list!=null&&list.size()>0){
        if(list!=null&&list.size()>0){
@ -56,12 +64,17 @@ public class SpecialistService extends BaseService {
        String sql="SELECT " +
        String sql="SELECT " +
                " d.`code`, " +
                " d.`code`, " +
                " d.`name`, " +
                " d.`name`, " +
                " d.photo " +
                " d.photo," +
                " d.dept_name AS deptName," +
                " d.dept," +
                " d.job," +
                " d.job_name AS jobName " +
                " FROM " +
                " FROM " +
                " wlyy_doctor d " +
                " wlyy_doctor d " +
                " WHERE " +
                " WHERE " +
                " d.`level` = '4' " +
                " d.`level` = '4' " +
                " AND `status` = 1";
                " AND `status` = 1";
        List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
        List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
        return list;
        return list;
    }
    }
@ -178,15 +191,15 @@ public class SpecialistService extends BaseService {
    }
    }
    public String saveHealthAssistant(String json)throws Exception{
    public Boolean saveHealthAssistant(String json)throws Exception{
        Map<String,Object> param = new HashedMap();
        Map<String,Object> param = new HashedMap();
        param.put("json",json);
        param.put("json",json);
        HttpResponse response = HttpUtils.doPost(specialistUrl+"saveHealthAssistant",param);
        HttpResponse response = HttpUtils.doPost(specialistUrl+"saveHealthAssistant",param);
        JSONObject  rs = new JSONObject(response.getContent());
        JSONObject  rs = new JSONObject(response.getContent());
        if("succes".equals(rs.getString("message"))){
        if("succes".equals(rs.getString("message"))){
            return rs.getString("obj");
            return rs.getBoolean("obj");
        }
        }
        return "";
        return false;
    }
    }
    public JSONArray getPatientByLabel(String doctor,String labelType,String labelCode,Integer page,Integer size)throws Exception{
    public JSONArray getPatientByLabel(String doctor,String labelType,String labelCode,Integer page,Integer size)throws Exception{
@ -204,7 +217,14 @@ public class SpecialistService extends BaseService {
        return null;
        return null;
    }
    }
    public List<Map<String,Object>> findDoctorTeamMenmber(String doctor){
    public Map<String,Object> findDoctorTeamMenmber(String doctor){
        Map<String,Object> rs = new HashedMap();
        AdminTeam adminTeam =  doctorAdminTeamDao.findByLeaderCode(doctor);
        rs.put("adminTeam",adminTeam);
        String sql = "SELECT " +
        String sql = "SELECT " +
                " d.`code`, " +
                " d.`code`, " +
                " d. name, " +
                " d. name, " +
@ -228,7 +248,9 @@ public class SpecialistService extends BaseService {
                " )";
                " )";
        List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
        List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
        return list;
        rs.put("member",list);
        return rs;
    }
    }
    public List<Map<String,Object>> getDoctorInHospital(String doctor,String name,Integer page,Integer size){
    public List<Map<String,Object>> getDoctorInHospital(String doctor,String name,Integer page,Integer size){
@ -263,5 +285,18 @@ public class SpecialistService extends BaseService {
        return list;
        return list;
    }
    }
    public JSONArray getDoctorPatientByName(String doctor,String nameKey,Integer page,Integer size) throws Exception{
        Map<String,Object> param = new HashedMap();
        param.put("doctor",doctor);
        param.put("nameKey",nameKey);
        param.put("page",page);
        param.put("size",size);
        HttpResponse response = HttpUtils.doGet(specialistUrl+"getDoctorPatientByName",param);
        JSONObject  rs = new JSONObject(response.getContent());
        if("succes".equals(rs.getString("message"))){
            return rs.getJSONArray("obj");
        }
        return null;
    }
}
}

+ 33 - 14
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/weixin/applets/AppletsService.java

@ -1,10 +1,12 @@
package com.yihu.wlyy.service.weixin.applets;
package com.yihu.wlyy.service.weixin.applets;
import com.yihu.wlyy.util.SecretUtils;
import com.yihu.wlyy.util.http.HttpResponse;
import com.yihu.wlyy.util.http.HttpResponse;
import com.yihu.wlyy.util.http.HttpUtils;
import com.yihu.wlyy.util.http.HttpUtils;
import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.collections.map.HashedMap;
import org.json.JSONArray;
import org.json.JSONObject;
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.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.annotation.Transactional;
@ -17,22 +19,39 @@ import java.util.Map;
@Transactional
@Transactional
public class AppletsService {
public class AppletsService {
    private String appid = "wx47ecd9a6372e7c96";
    private String appSecret ="9df49ebba7d5cdf8b9a77213bbf36807";
    @Value("${applets.appId}")
    private String appid;
    @Value("${applets.appSecret}")
    private String appSecret;
    public Map<String,Object> checkApplets(String code) throws Exception{
    public Map<String, Object> checkApplets(String code) throws Exception {
        HttpUtils httpUtils = new HttpUtils();
        HttpUtils httpUtils = new HttpUtils();
        Map<String,Object> param = new HashedMap();
        param.put("appid",appid);
        param.put("secret",appSecret);
        param.put("js_code",code);
        param.put("grant_type","authorization_code");
        HttpResponse response = httpUtils.doGet("https://api.weixin.qq.com/sns/jscode2session",param);
        Map<String, Object> param = new HashedMap();
        param.put("appid", appid);
        param.put("secret", appSecret);
        param.put("js_code", code);
        param.put("grant_type", "authorization_code");
        HttpResponse response = httpUtils.doGet("https://api.weixin.qq.com/sns/jscode2session", param);
        JSONObject rs = new JSONObject(response.getContent());
        JSONObject rs = new JSONObject(response.getContent());
        Map<String,Object> res = new HashedMap();
        res.put("openid",rs.getString("openid"));
        res.put("sessionKey",rs.getString("session_key"));
        Map<String, Object> res = new HashedMap();
        res.put("openid", rs.getString("openid"));
        res.put("sessionKey", rs.getString("session_key"));
        return res;
        return res;
    }
    }
}
    public JSONObject getWeRunData(String encryptedData, String iv, String sessionKey) throws Exception {
        String result = SecretUtils.AES128CBCdecrypt(encryptedData, iv, appid, sessionKey);
        JSONObject obj = new JSONObject(result);
        JSONArray jsonArray = obj.getJSONArray("stepInfoList");
        JSONObject jsonObject  = (JSONObject) jsonArray.get(jsonArray.length()-1);
        return jsonObject;
    }
}

+ 49 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/util/SecretUtils.java

@ -0,0 +1,49 @@
package com.yihu.wlyy.util;
import net.sf.json.JSONObject;
import org.apache.commons.codec.binary.Base64;
import org.bouncycastle.jce.provider.BouncyCastleProvider;
import javax.crypto.Cipher;
import javax.crypto.spec.IvParameterSpec;
import javax.crypto.spec.SecretKeySpec;
import java.security.AlgorithmParameters;
import java.security.Security;
/**
 * Created by Trick on 2018/6/11.
 */
public class SecretUtils {
    public static String AES128CBCdecrypt(String encryptedData, String iv, String appId, String sessionKey) throws Exception {
        // 被加密的数据
        byte[] dataByte = Base64.decodeBase64(encryptedData);
        // 加密秘钥
        byte[] keyByte = Base64.decodeBase64(sessionKey);
        // 偏移量
        byte[] ivByte = Base64.decodeBase64(iv);
        Security.addProvider(new BouncyCastleProvider());
        Cipher cipher = Cipher.getInstance("AES/CBC/PKCS7Padding", "BC");
        SecretKeySpec spec = new SecretKeySpec(keyByte, "AES");
        AlgorithmParameters parameters = AlgorithmParameters.getInstance("AES");
        parameters.init(new IvParameterSpec(ivByte));
        cipher.init(Cipher.DECRYPT_MODE, spec, parameters);// 初始化
        byte[] resultByte = cipher.doFinal(dataByte);
        if (null != resultByte && resultByte.length > 0) {
            String result = new String(resultByte, "UTF-8");
            //获取30天微信运动情况
//            JSONObject obj = JSONObject.fromObject(result);
//            JSONObject watermark = obj.getJSONObject("watermark");
//            if (!watermark.getString("appid").equals(appId)) {
//                throw new Exception("与小程序appid不符合");
//            }
//            if (System.currentTimeMillis() - watermark.getLong("timestamp") * 1000 > 10000) {
//                throw new Exception("验证时间过长");
//            }
            return result;
        }
        return null;
    }
}

+ 15 - 11
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/specialist/SpecialistController.java

@ -61,7 +61,6 @@ public class SpecialistController extends BaseController {
    @RequestMapping(value = "findLabelbyType", method = RequestMethod.GET)
    @RequestMapping(value = "findLabelbyType", method = RequestMethod.GET)
    @ResponseBody
    @ApiOperation("获取标签")
    @ApiOperation("获取标签")
    public String findLabelbyType(@ApiParam(name = "type", value = "标签类型") @RequestParam(required = true) String type,
    public String findLabelbyType(@ApiParam(name = "type", value = "标签类型") @RequestParam(required = true) String type,
                                  @ApiParam(name = "teamCode", value = "团队id") @RequestParam(required = false) Long teamCode) {
                                  @ApiParam(name = "teamCode", value = "团队id") @RequestParam(required = false) Long teamCode) {
@ -74,7 +73,6 @@ public class SpecialistController extends BaseController {
    }
    }
    @RequestMapping(value = "findLabelAndPatientCount", method = RequestMethod.GET)
    @RequestMapping(value = "findLabelAndPatientCount", method = RequestMethod.GET)
    @ResponseBody
    @ApiOperation("获取标签与居民数量")
    @ApiOperation("获取标签与居民数量")
    public String findLabelAndPatientCount(@ApiParam(name = "doctor", value = "医生") @RequestParam(required = true)String doctor,
    public String findLabelAndPatientCount(@ApiParam(name = "doctor", value = "医生") @RequestParam(required = true)String doctor,
                                           @ApiParam(name = "type", value = "标签类型") @RequestParam(required = true)String type,
                                           @ApiParam(name = "type", value = "标签类型") @RequestParam(required = true)String type,
@ -87,8 +85,7 @@ public class SpecialistController extends BaseController {
        }
        }
    }
    }
        @RequestMapping(value = "findSpecialistPatientRelationCout", method = RequestMethod.GET)
    @ResponseBody
    @RequestMapping(value = "findSpecialistPatientRelationCout", method = RequestMethod.GET)
    @ApiOperation("获取专科医生下未分配标签居民数目")
    @ApiOperation("获取专科医生下未分配标签居民数目")
    public String findSpecialistPatientRelationCout(@ApiParam(name = "doctor", value = "医生code") @RequestParam(required = true) String doctor) {
    public String findSpecialistPatientRelationCout(@ApiParam(name = "doctor", value = "医生code") @RequestParam(required = true) String doctor) {
        try {
        try {
@ -101,7 +98,6 @@ public class SpecialistController extends BaseController {
    @RequestMapping(value = "findNoLabelPatientRelation", method = RequestMethod.GET)
    @RequestMapping(value = "findNoLabelPatientRelation", method = RequestMethod.GET)
    @ResponseBody
    @ApiOperation("获取专科医生下未分配标签居民")
    @ApiOperation("获取专科医生下未分配标签居民")
    public String findNoLabelPatientRelation(@ApiParam(name = "doctor", value = "医生code") @RequestParam(required = true) String doctor) {
    public String findNoLabelPatientRelation(@ApiParam(name = "doctor", value = "医生code") @RequestParam(required = true) String doctor) {
        try {
        try {
@ -113,7 +109,6 @@ public class SpecialistController extends BaseController {
    }
    }
    @RequestMapping(value = "findPatientRelatioByAssistant", method = RequestMethod.GET)
    @RequestMapping(value = "findPatientRelatioByAssistant", method = RequestMethod.GET)
    @ResponseBody
    @ApiOperation("获取计管师下未分配标签居民")
    @ApiOperation("获取计管师下未分配标签居民")
    public String findPatientRelatioByAssistant(@ApiParam(name = "assistant", value = "计管师") @RequestParam(required = true) String assistant,
    public String findPatientRelatioByAssistant(@ApiParam(name = "assistant", value = "计管师") @RequestParam(required = true) String assistant,
                                                @ApiParam(name = "page", value = "第几页,1开始") @RequestParam(required = true) Integer page,
                                                @ApiParam(name = "page", value = "第几页,1开始") @RequestParam(required = true) Integer page,
@ -127,7 +122,6 @@ public class SpecialistController extends BaseController {
    }
    }
    @RequestMapping(value = "saveHealthAssistant", method = RequestMethod.POST)
    @RequestMapping(value = "saveHealthAssistant", method = RequestMethod.POST)
    @ResponseBody
    @ApiOperation("分配计管师居民")
    @ApiOperation("分配计管师居民")
    public String saveHealthAssistant(String json) {
    public String saveHealthAssistant(String json) {
        try {
        try {
@ -139,7 +133,6 @@ public class SpecialistController extends BaseController {
    }
    }
    @RequestMapping(value = "getPatientByLabel", method = RequestMethod.POST)
    @RequestMapping(value = "getPatientByLabel", method = RequestMethod.POST)
    @ResponseBody
    @ApiOperation("获取标签下居民")
    @ApiOperation("获取标签下居民")
    public String getPatientByLabel(@ApiParam(name = "doctor", value = "医生code") @RequestParam(required = true)String doctor,
    public String getPatientByLabel(@ApiParam(name = "doctor", value = "医生code") @RequestParam(required = true)String doctor,
                                    @ApiParam(name = "labelType", value = "标签类型")@RequestParam(required = true) String labelType,
                                    @ApiParam(name = "labelType", value = "标签类型")@RequestParam(required = true) String labelType,
@ -155,8 +148,7 @@ public class SpecialistController extends BaseController {
    }
    }
    @RequestMapping(value = "findDoctorTeamMenmber", method = RequestMethod.GET)
    @RequestMapping(value = "findDoctorTeamMenmber", method = RequestMethod.GET)
    @ResponseBody
    @ApiOperation("获取团队成员")
    @ApiOperation("获取团队及团队成员")
    public String findDoctorTeamMenmber(@ApiParam(name = "doctor", value = "医生code") @RequestParam(required = true)String doctor) {
    public String findDoctorTeamMenmber(@ApiParam(name = "doctor", value = "医生code") @RequestParam(required = true)String doctor) {
        try {
        try {
            return write(200, "获取成功", "data", specialistService.findDoctorTeamMenmber(doctor));
            return write(200, "获取成功", "data", specialistService.findDoctorTeamMenmber(doctor));
@ -167,7 +159,6 @@ public class SpecialistController extends BaseController {
    }
    }
    @RequestMapping(value = "getDoctorInHospital", method = RequestMethod.GET)
    @RequestMapping(value = "getDoctorInHospital", method = RequestMethod.GET)
    @ResponseBody
    @ApiOperation("获取院内工作人员")
    @ApiOperation("获取院内工作人员")
    public String getDoctorInHospital(@ApiParam(name = "doctor", value = "医生code") @RequestParam(required = true)String doctor,
    public String getDoctorInHospital(@ApiParam(name = "doctor", value = "医生code") @RequestParam(required = true)String doctor,
                                      @ApiParam(name = "name", value = "医生姓名模糊") @RequestParam(required = false)String name,
                                      @ApiParam(name = "name", value = "医生姓名模糊") @RequestParam(required = false)String name,
@ -181,5 +172,18 @@ public class SpecialistController extends BaseController {
        }
        }
    }
    }
    @RequestMapping(value = "getDoctorPatientByName", method = RequestMethod.GET)
    @ApiOperation("搜索专科医生下的居民")
    public String getDoctorPatientByName(@ApiParam(name = "doctor", value = "医生code") @RequestParam(required = true)String doctor,
                                         @ApiParam(name = "name", value = "居民姓名模糊") @RequestParam(required = false)String nameKey,
                                         @ApiParam(name = "page", value = "第几页,1开始") @RequestParam(required = true)Integer page,
                                         @ApiParam(name = "size", value = "每页大小") @RequestParam(required = true)Integer size) {
        try {
            return write(200, "获取成功", "data", specialistService.getDoctorPatientByName(doctor,nameKey,page,size));
        } catch (Exception e) {
            error(e);
            return error(-1, "请求失败");
        }
    }
}
}

+ 9 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/statistic/EsStatisticsController.java

@ -500,7 +500,14 @@ public class EsStatisticsController extends BaseController {
            level = elasticsearchUtil.changeLevel(level);
            level = elasticsearchUtil.changeLevel(level);
            String[] indexes = index.split(",");
            String[] indexes = index.split(",");
            JSONObject result = new JSONObject();
            JSONObject result = new JSONObject();
            if(index.indexOf("85")>0||index.indexOf("86")>0){
                if("1".equals(lowCode)){
                    lowCode="hemopiezometer";
                }else if("2".equals(lowCode)){
                    lowCode="glucometer";
                }
            }
            if (index != null) {
            if (index != null) {
                for (String idx : indexes) {
                for (String idx : indexes) {
                    if (org.springframework.util.StringUtils.isEmpty(year)) {
                    if (org.springframework.util.StringUtils.isEmpty(year)) {
@ -2170,6 +2177,7 @@ public class EsStatisticsController extends BaseController {
    @ApiOperation("设备绑定统计")
    @ApiOperation("设备绑定统计")
    @ResponseBody
    @ResponseBody
    public String lowlevel_device(
    public String lowlevel_device(
            @RequestParam(required = false) String deviceType,//1血压 2血糖 不传是所有设备
            @RequestParam(required = true) String area,
            @RequestParam(required = true) String area,
            @RequestParam(required = true) int level,
            @RequestParam(required = true) int level,
            @RequestParam(required = true) int sort,
            @RequestParam(required = true) int sort,
@ -2186,7 +2194,7 @@ public class EsStatisticsController extends BaseController {
                lowLevel = level - 1 + "";
                lowLevel = level - 1 + "";
            }
            }
            return write(200, "查询成功", "data", statisticsESService.getLevelDeviceAndBinding(area, elasticsearchUtil.changeLevel(level), sort, String.valueOf(elasticsearchUtil.changeLevel(Integer.valueOf(lowLevel))), year));
            return write(200, "查询成功", "data", statisticsESService.getLevelDeviceAndBinding(area, elasticsearchUtil.changeLevel(level), sort, String.valueOf(elasticsearchUtil.changeLevel(Integer.valueOf(lowLevel))), year,deviceType));
        } catch (Exception e) {
        } catch (Exception e) {
            e.printStackTrace();
            e.printStackTrace();
            return error(-1, "查询失败");
            return error(-1, "查询失败");

+ 12 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/wx/AppletsController.java

@ -1,6 +1,7 @@
package com.yihu.wlyy.web.wx;
package com.yihu.wlyy.web.wx;
import com.yihu.wlyy.service.weixin.applets.AppletsService;
import com.yihu.wlyy.service.weixin.applets.AppletsService;
import com.yihu.wlyy.util.SecretUtils;
import com.yihu.wlyy.web.WeixinBaseController;
import com.yihu.wlyy.web.WeixinBaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiOperation;
@ -33,4 +34,15 @@ public class AppletsController extends WeixinBaseController {
            return error(-1, "失败");
            return error(-1, "失败");
        }
        }
    }
    }
    @ApiOperation(value = "微信解密微信步数")
    @RequestMapping(value = "/getWeRunData", method = RequestMethod.GET)
    public String getWeRunData(String encryptedData,String iv,String sessionKey){
        try {
            return write(200, "创建成功", "data", appletsService.getWeRunData(encryptedData,iv,sessionKey));
        }catch (Exception e){
            error(e);
            return error(-1, "失败");
        }
    }
}
}

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

@ -47,6 +47,11 @@ healthBank:
rehabilitation:
rehabilitation:
  url: http://localhost:10055/svr-rehabilitation/
  url: http://localhost:10055/svr-rehabilitation/
#小程序
applets:
  appId: wx0e663ce069b5170c
  appSecret: 02de788ffea28f2aa3b9bf10312ab05e
wechat:
wechat:
  appId: wxd03f859efdf0873d
  appId: wxd03f859efdf0873d
  appSecret: 2935b54b53a957d9516c920a544f2537
  appSecret: 2935b54b53a957d9516c920a544f2537

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

@ -48,6 +48,11 @@ healthBank:
rehabilitation:
rehabilitation:
  url: http://localhost:10055/svr-rehabilitation/
  url: http://localhost:10055/svr-rehabilitation/
#小程序
applets:
  appId: wx0e663ce069b5170c
  appSecret: 02de788ffea28f2aa3b9bf10312ab05e
wechat:
wechat:
  appId: wx1f129f7b51701428
  appId: wx1f129f7b51701428
  appSecret: 988f005d8309ed1795939e0f042431fb
  appSecret: 988f005d8309ed1795939e0f042431fb

+ 5 - 0
patient-co/patient-co-wlyy/src/main/resources/application-local.yml

@ -41,6 +41,11 @@ iot:
rehabilitation:
rehabilitation:
  url: http://localhost:10055/svr-rehabilitation/
  url: http://localhost:10055/svr-rehabilitation/
#小程序
applets:
  appId: wx0e663ce069b5170c
  appSecret: 02de788ffea28f2aa3b9bf10312ab05e
wechat:
wechat:
  appId: wxad04e9c4c5255acf
  appId: wxad04e9c4c5255acf
  appSecret: ae77c48ccf1af5d07069f5153d1ac8d3
  appSecret: ae77c48ccf1af5d07069f5153d1ac8d3

+ 5 - 0
patient-co/patient-co-wlyy/src/main/resources/application-localtest.yml

@ -40,6 +40,11 @@ iot:
rehabilitation:
rehabilitation:
  url: http://localhost:10055/svr-rehabilitation/
  url: http://localhost:10055/svr-rehabilitation/
#小程序
applets:
  appId: wx0e663ce069b5170c
  appSecret: 02de788ffea28f2aa3b9bf10312ab05e
wechat:
wechat:
  appId: wx1f129f7b51701428
  appId: wx1f129f7b51701428
  appSecret: 988f005d8309ed1795939e0f042431fb
  appSecret: 988f005d8309ed1795939e0f042431fb

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

@ -46,6 +46,11 @@ healthBank:
rehabilitation:
rehabilitation:
  url: http://localhost:10055/svr-rehabilitation/
  url: http://localhost:10055/svr-rehabilitation/
#小程序
applets:
  appId: wx0e663ce069b5170c
  appSecret: 02de788ffea28f2aa3b9bf10312ab05e
wechat:
wechat:
  appId: wxad04e9c4c5255acf
  appId: wxad04e9c4c5255acf
  appSecret: ae77c48ccf1af5d07069f5153d1ac8d3
  appSecret: ae77c48ccf1af5d07069f5153d1ac8d3

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

@ -41,6 +41,10 @@ healthBank:
#康复计划配置
#康复计划配置
rehabilitation:
rehabilitation:
  url: http://localhost:10055/svr-rehabilitation/
  url: http://localhost:10055/svr-rehabilitation/
#小程序
applets:
  appId: wx0e663ce069b5170c
  appSecret: 02de788ffea28f2aa3b9bf10312ab05e
wechat:
wechat:
  appId: wx1f129f7b51701428
  appId: wx1f129f7b51701428