Browse Source

Merge branch 'dev' of liubing/wlyy2.0 into dev

liubing 3 years ago
parent
commit
146d7fee35

+ 23 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/doctor/admin/AdminInfoEndpoint.java

@ -442,4 +442,27 @@ public class AdminInfoEndpoint extends EnvelopRestEndpoint {
            return failedObjEnvelopException2(e);
        }
    }
    @GetMapping(value = "statisticsLifeCareItemAdd")
    @ApiOperation(value = "管理端首页智慧照护生活照料项目新增情况")
    public ObjEnvelop statisticsLifeCareItemAdd(
            @RequestParam(required = true) String endDate,
            @RequestParam(required = true) String area,
            @RequestParam(required = true) Integer level,
            @ApiParam(name="type",value="类型:1本周,2本月",defaultValue = "")@RequestParam(required = false) String type) {
        try {
            JSONObject param = new JSONObject();
            String doctorId =  permissionService.getUID();
            param.put("doctorId",doctorId);
            if(permissionService.noPermission(0,param)){
                return ObjEnvelop.getError("该操作没有权限");
            }
            JSONObject result = statisticsService.statisticsLifeCareItemAdd(endDate,area,level, type);
            return success(result);
        } catch (Exception e) {
            return failedObjEnvelopException2(e);
        }
    }
}

+ 27 - 17
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/security/SecurityMonitoringOrderService.java

@ -2736,32 +2736,42 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
                            tmp.put("eCall", 0);
                            tmp.put("orderId", "");
                        }
                        BasePatientDO patientDO = basePatientDao.findById(id);
                        if (null != patientDO) {
                            if (StringUtils.isNotBlank(patientDO.getLatLon())) {
                                String[] latLon = patientDO.getLatLon().toString().split(",");
                                if (StringUtils.isNotBlank(patientDO.getHomeLatLon())&&latLon.length==2) {
                                    String homeLatLon = patientDO.getHomeLatLon();
                                    double homeLat = Double.parseDouble(homeLatLon.split(",")[0]);
                                    double homeLon = Double.parseDouble(homeLatLon.split(",")[1]);
                                    double homeDistance = countDistance.getDistance(Double.parseDouble(latLon[0]), Double.parseDouble(latLon[1]),
                                            homeLat, homeLon);
                                    if (homeDistance * 1000 > 50) {
                                        tmp.put("atHome", false);
                        sql = "select pd.device_sn from wlyy_patient_device pd INNER JOIN dm_device dd " +
                                " on pd.device_id = dd.id where  pd.user = '" + patientTmp.get("id").toString() + "' and pd.del=0  and pd.category_code =4 ";
                        List<String> deviceSns = jdbcTemplate.queryForList(sql, String.class);
                        if (deviceSns.size() > 0) {
                            JSONObject objectTmp = patientMonitoringInfo(patientTmp.get("id").toString(), "preventLost", deviceSns.get(0),false);
                            tmp.put("atHome", objectTmp.get("atHome"));
                            tmp.put("address", objectTmp.get("address"));
                        }else {
                            BasePatientDO patientDO = basePatientDao.findById(id);
                            if (null != patientDO) {
                                if (StringUtils.isNotBlank(patientDO.getLatLon())) {
                                    String[] latLon = patientDO.getLatLon().toString().split(",");
                                    if (StringUtils.isNotBlank(patientDO.getHomeLatLon())&&latLon.length==2) {
                                        String homeLatLon = patientDO.getHomeLatLon();
                                        double homeLat = Double.parseDouble(homeLatLon.split(",")[0]);
                                        double homeLon = Double.parseDouble(homeLatLon.split(",")[1]);
                                        double homeDistance = countDistance.getDistance(Double.parseDouble(latLon[0]), Double.parseDouble(latLon[1]),
                                                homeLat, homeLon);
                                        if (homeDistance * 1000 > 50) {
                                            tmp.put("atHome", false);
                                        } else {
                                            tmp.put("atHome", true);
                                        }
                                    } else {
                                        tmp.put("atHome", true);
                                    }
                                    String locationAddress = LatitudeUtils.getLocationAddress(latLon[0], latLon[1]);
                                    tmp.put("address", locationAddress);
                                } else {
                                    tmp.put("atHome", true);
                                    tmp.put("address", "");
                                }
                                String locationAddress = LatitudeUtils.getLocationAddress(latLon[0], latLon[1]);
                                tmp.put("address", locationAddress);
                            } else {
                                tmp.put("atHome", true);
                                tmp.put("address", "");
                            }
                        }
                        object.put("info", tmp);
                        break;
                    default:
                        String patientId = (String) list.get(i).get("id");

+ 36 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/statistics/StatisticsService.java

@ -2780,4 +2780,40 @@ public class StatisticsService {
        return result;
    }
    /**
     * 管理端首页智慧照护生活照料项目新增情况
     */
    public JSONObject statisticsLifeCareItemAdd(String endDate, String area, Integer level, String type) throws Exception {
        JSONObject res = new JSONObject();
        SaveModel saveModel = elasticsearchUtil.findOneDateQuotaLevels(endDate, endDate, area, level, "48", SaveModel.timeLevel_DDL, null, null);
        res.put("index_" + 48 + "_total", saveModel.getResult2().longValue());
        if (StringUtils.isNotBlank(type)) {
            //周/月 增量
            String start = statisticsUtilService.calStart(endDate, type);
            SaveModel saveModelAdd = elasticsearchUtil.findOneDateQuotaLevels(start, endDate, area, level, "48", SaveModel.timeLevel_ZL, null,null);
            res.put("index_" + 48 + "_add", saveModelAdd.getResult2().longValue());
        }
        JSONArray addDetail = new JSONArray();
        if (StringUtils.isNotBlank(type)) {
            //周/月 增量
            String start = statisticsUtilService.calStart(endDate, type);
            List<SaveModel> saveModelAdds = elasticsearchUtil.findDateQuotaLevelList(start, endDate, area, level, "48", SaveModel.timeLevel_ZL, null,null,"1", null );
            for (SaveModel saveModelTmp : saveModelAdds) {
                JSONObject json = new JSONObject();
                SaveModel saveMode2 = elasticsearchUtil.findOneDateQuotaLevels(endDate, endDate, area, level, "48", SaveModel.timeLevel_DDL, null, saveModelTmp.getSlaveKey1());
                json.put("total", saveMode2.getResult2().longValue());
                json.put("num", saveModelTmp.getResult2().longValue());
                json.put("code", saveModelTmp.getSlaveKey1());
                json.put("name", saveModelTmp.getSlaveKey1Name());
                addDetail.add(json);
            }
        }
        res.put("index_add_detail", addDetail);
        return res;
    }
}

+ 1 - 1
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/third/PatientInfoPlatFormService.java

@ -232,7 +232,7 @@ public class PatientInfoPlatFormService {
        Integer finish=0;
        for (Map<String,Object> map:list){
            if (null!=map.get("status")){
                if ("0".equals(map.get("status").toString())){
                if ("0".equals(map.get("status").toString())||"2".equals(map.get("status").toString())){
                    finish += Integer.parseInt(map.get("total").toString());
                }else {
                    unfinish +=Integer.parseInt(map.get("total").toString());