ソースを参照

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

liubing 2 年 前
コミット
32a9d8ad7f

+ 11 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/admin/CommonEndpoint.java

@ -217,4 +217,15 @@ public class CommonEndpoint extends EnvelopRestEndpoint {
        }
    }
    @GetMapping(value = "open/hualianmenjing")
    @ApiOperation(value = "华联社区门禁初始化--临时")
    public Envelop hualianmenjing() {
        try {
            commomService.hualianmenjing();
            return success("success");
        } catch (Exception e) {
            return failedException2(e);
        }
    }
}

+ 52 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/common/CommomService.java

@ -91,4 +91,56 @@ public class CommomService {
            deviceDetailDao.save(deviceDetails);
        }
    }
    //华联社区门禁用户初始化
    public void hualianmenjing(){
        String sql = " select id,idcard from base_patient where saas_id='8a92aba97a9f6f49017ae4fdbdmqteam' " +
                "UNION  " +
                "select p.id,p.idcard from base_patient p, base_service_package_sign_record sr,base_service_package_record r " +
                "where p.id = sr.patient and  sr.status=1 and r.team_code='8a92aba97a9f6f49017ae4fdbdmqteam' and sr.id=r.sign_id  ";
        List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
        List<DeviceDetail> deviceDetails = new ArrayList<>();
        List<DevicePatientDevice> patientDevices = new ArrayList<>();
        List<Device> dmDevices = deviceDao.findByCategoryCode("19");
        Device deviceDo = dmDevices.get(0);
        for (int i=0;i<list.size();i++){
            Map<String,Object> tmp = list.get(i);
            String patient = tmp.get("id").toString();
            String deviceSn = "MJ052700"+i;
            String idcard = tmp.get("idcard").toString();
            DeviceDetail deviceDetail = new DeviceDetail();
            deviceDetail.setDeviceName(deviceDo.getName());
            deviceDetail.setDeviceCode(deviceSn);
            deviceDetail.setDeviceModel(deviceDo.getModel());
            deviceDetail.setCategoryCode(deviceDo.getCategoryCode());
            deviceDetail.setBindingCount("{\"1\":\"1\"}");
            deviceDetail.setContactStatus(1);
            deviceDetail.setDeviceType(1);
            deviceDetail.setIsGrant(1);
            deviceDetail.setGrantAdminTeam("0");
            deviceDetail.setManufacturer("天图");
            deviceDetail.setApplyDate(DateUtil.getStringDate());
            deviceDetails.add(deviceDetail);
            DevicePatientDevice patientDevice = new DevicePatientDevice();
            patientDevice.setDel(0);
            patientDevice.setUser(patient);
            patientDevice.setCategoryCode(deviceDo.getCategoryCode());
            patientDevice.setDeviceId(deviceDo.getId());
            patientDevice.setDeviceName(deviceDo.getName());
            patientDevice.setDeviceSn(deviceSn);
            patientDevice.setUserIdcard(idcard);
            patientDevice.setUserType("-1");
            patientDevice.setCzrq(new Date());
            patientDevice.setDeviceType(1);
            patientDevices.add(patientDevice);
        }
        if (patientDevices.size()>0){
            patientDeviceDao.save(patientDevices);
        }
        if (deviceDetails.size()>0){
            deviceDetailDao.save(deviceDetails);
        }
    }
}

+ 2 - 1
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/statistics/DetectionPlatformService.java

@ -802,7 +802,8 @@ public class DetectionPlatformService  {
            result = result.replace("\\n","").replace("\\","");
            JSONObject objects = JSONObject.parseObject(result);
            if("200".equals(objects.getString("code"))){
                return objects.getString("playrealUrl");
                String videoUrl = objects.getString("playrealUrl");
                return videoUrl.replace("http://59.202.68.104:83/ncg/59.202.68.106","https://zhyzh.gongshu.gov.cn/pagg");
            }
        }
        return null;

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

@ -791,11 +791,11 @@ public class StatisticsService {
     */
    public JSONObject platformPeople(String area,Integer level) {
        boolean b = StringUtils.isNotBlank(area) && 5 == level;
        boolean areaFilterFlag = StringUtils.isNotBlank(area) && 5 == level;
        String areaFilter = " ";
        JSONObject result = new JSONObject();
        Integer olderTotal = 0;
        Integer olderTotal = 0; //已照护老人
        Integer childTotal = 0;
        Integer helperTotal = 0;
        Integer teacherTotal = 0;
@ -816,7 +816,7 @@ public class StatisticsService {
        Integer helper4On=0;
        Integer helper4Off=0;
        Integer helper4Total=0;
        Integer unSignOlderTotal=0;
        Integer unSignOlderTotal=0; //需招呼老人
        Integer unSignOlderOff=0;
        Integer unSignOlderOn=0;
        Integer streetOldTotal = 0;
@ -852,17 +852,19 @@ public class StatisticsService {
        if (listOldtmp.size() > 0) {
            String orgCodes = String.valueOf(listOldtmp.get(0).get("orgCodes"));
            orgCodes = orgCodes.replaceAll(",", "','");
            oldFilter = " and a.id not in ('" + orgCodes + "')";
        }
        if (b){
            areaFilter = " and EXISTS ( select 1 from " +
                    "base_service_package_sign_record sr,base_service_package_record r, base_service_package_item i,base_service_package pack " +
                    " where sr.id = r.sign_id and sr.status=1 and r.service_package_id = i.service_package_id and r.service_package_id = pack.id " +
                    " and i.del = 1  and sr.`status`=1 and CONVERT(sr.patient USING utf8)  = a.id and r.team_code='"+area+"') ";
        }
        String sql1 = "SELECT COUNT(*) c,case 1 WHEN openid is not null then 1 WHEN a.on_line = '1' then 1 ELSE 0 end as online from base_patient a WHERE  a.archive_type = 1 AND a.sign_status = 1 AND a.del =1 " +
                " and del='1' "+areaFilter+" " + oldFilter + " GROUP BY online";
            oldFilter = " and a.id not in ('" + orgCodes + "') ";
        }
        String sql1 = " SELECT COUNT(distinct a.id) c,case 1 WHEN openid is not null then 1 WHEN a.on_line = '1' then 1 ELSE 0 end as online from base_patient a " +
                " WHERE a.archive_type = 1 and a.sign_status=1 and a.del = '1' " +oldFilter+
                "and EXISTS ( select 1 from " +
                "base_service_package_sign_record sr,base_service_package_record r, base_service_package_item i,base_service_package pack  " +
                "where sr.id = r.sign_id and sr.status=1 and r.service_package_id = i.service_package_id and r.service_package_id = pack.id  " +
                "and i.del = 1  and sr.`status`=1 and CONVERT(sr.patient USING utf8)  = a.id "+(areaFilterFlag?" and r.team_code='"+area+"' ":" ")+" ) " +
                "UNION ALL " +
                "SELECT COUNT(distinct a.id) c,case 1 WHEN openid is not null then 1 WHEN a.on_line = '1' then 1 ELSE 0 end as online from base_patient a where a.archive_type = 1 " +
                " and a.sign_status=0 and register='1' and a.del = '1' "+(areaFilterFlag?" and a.saas_id='"+area+"' ":"")+" " +oldFilter+
                "and EXISTS (select 1 from wlyy_patient_device pd where pd.user = a.id and pd.del=0) GROUP BY on_line ";
        List<Map<String, Object>> list1 = jdbcTemplate.queryForList(sql1);
        for (Map<String, Object> map : list1) {
            Integer num = Integer.valueOf(map.get("c").toString());
@ -876,14 +878,14 @@ public class StatisticsService {
        olderTotal = olderOff + olderOn;
        childTotal = childOff + childOn;
        // 社区老人
        // 需招呼老人
        String unSignOldAreaSql ="";
        if (b) {
        if (areaFilterFlag) {
            unSignOldAreaSql = " AND saas_id = '"+area+"'";
        }
        sql1 = "SELECT COUNT(*) c,case 1 WHEN openid is not null then 1 WHEN a.on_line = '1' then 1 ELSE 0 end as online from base_patient a WHERE archive_type = 1 and a.register = 1 and (sign_status=0 or sign_status is null ) " +
                " and del='1' " + oldFilter + unSignOldAreaSql + " GROUP BY online";
                " and del='1' and not EXISTS (select 1 from wlyy_patient_device pd where pd.user = a.id and pd.del=0) " + oldFilter + unSignOldAreaSql + " GROUP BY online";
        list1 = jdbcTemplate.queryForList(sql1);
        for (Map<String, Object> map : list1) {
            Integer num = Integer.valueOf(map.get("c").toString());
@ -915,7 +917,7 @@ public class StatisticsService {
        //社工和教师注册人数
        if (b){
        if (areaFilterFlag){
            areaFilter = " and EXISTS ( select 1 from base_team_member mem where mem.doctor_code = a.id " +
                    " and mem.team_code='"+area+"' and mem.del=1 )  ";
        }
@ -965,7 +967,7 @@ public class StatisticsService {
            orgCodes = orgCodes.replaceAll(",", "','");
            olderRelativeFilter = " and t2.id not in ('" + orgCodes + "') ";
        }
        if (b){
        if (areaFilterFlag){
            //有社区只查询该社区老人的家属列表
            areaFilter = " and EXISTS ( select 1 from " +
                    "base_service_package_sign_record sr,base_service_package_record r, base_service_package_item i,base_service_package pack " +
@ -993,7 +995,7 @@ public class StatisticsService {
        }
        olderFamilyTotal = olderFamilyOff+olderFamilyOn;
        //家属绑定老人数量
        if (b){
        if (areaFilterFlag){
            areaFilter = " and EXISTS ( select 1 from " +
                    "base_service_package_sign_record sr,base_service_package_record r, base_service_package_item i,base_service_package pack " +
                    " where sr.id = r.sign_id and sr.status=1 and r.service_package_id = i.service_package_id and r.service_package_id = pack.id " +
@ -2580,13 +2582,18 @@ public class StatisticsService {
                orgCodes = orgCodes.replaceAll(",","','");
                filter = " and a.id not in ('"+orgCodes+"')";
            }
            sql = "SELECT count(a.id) from base_patient a  WHERE a.archive_type = 1 and a.sign_status=1 and a.del = '1' ";
            sql += " and EXISTS ( select 1 from " +
                    "base_service_package_sign_record sr,base_service_package_record r, base_service_package_item i,base_service_package pack " +
                    " where sr.id = r.sign_id and sr.status=1 and r.service_package_id = i.service_package_id and r.service_package_id = pack.id " +
                    " and i.del = 1  and sr.`status`=1 and CONVERT(sr.patient USING utf8) = a.id and r.team_code='"+teamId+"' ) "+filter;
            sql = " select sum(total) from ( " +
                    "SELECT count(distinct a.id) total from base_patient a  WHERE a.archive_type = 1 and a.sign_status=1 and a.del = '1' " +
                    "and EXISTS ( select 1 from " +
                    "base_service_package_sign_record sr,base_service_package_record r, base_service_package_item i,base_service_package pack  " +
                    "where sr.id = r.sign_id and sr.status=1 and r.service_package_id = i.service_package_id and r.service_package_id = pack.id  " +
                    "and i.del = 1  and sr.`status`=1 and CONVERT(sr.patient USING utf8)  = a.id and r.team_code='"+teamId+"') " +filter+
                    " UNION ALL " +
                    "SELECT count(distinct a.id) total from base_patient a where a.archive_type = 1 and a.sign_status=0 and register='1' and a.del = '1' and a.saas_id='"+teamId+"' " +
                    "and EXISTS (select 1 from wlyy_patient_device pd where pd.user = a.id and pd.del=0) " + filter+
                    " )A ";
            count =  jdbcTemplate.queryForObject(sql,Integer.class);
            map.put("oldTotal",count);
            map.put("oldTotal",count);//照护老人
            //照护老人数量
            filter = "";
            sqltmp = "SELECT GROUP_CONCAT(dict_code) orgCodes from wlyy_hospital_sys_dict WHERE dict_name = 'jkzl_org' ";
@ -2677,14 +2684,18 @@ public class StatisticsService {
            if(listtmp.size()>0){
                String orgCodes = String.valueOf(listtmp.get(0).get("orgCodes"));
                orgCodes = orgCodes.replaceAll(",","','");
                filter = " and a.id not in ('"+orgCodes+"')";
            }
            sql = "SELECT count(distinct a.id) from base_patient a  WHERE a.archive_type = 1 and a.sign_status=1 and a.del = '1' ";
            sql += " and ( EXISTS ( select 1 from " +
                    "base_service_package_sign_record sr,base_service_package_record r, base_service_package_item i,base_service_package pack " +
                    " where sr.id = r.sign_id and sr.status=1 and r.service_package_id = i.service_package_id and r.service_package_id = pack.id " +
                    " and i.del = 1  and sr.`status`=1 and CONVERT(sr.patient USING utf8)  = a.id and r.team_code='"+teamId+"') or " +
                    " (EXISTS (select 1 from wlyy_patient_device pd where pd.user = a.id and pd.del=0) and a.register='1' and  a.saas_id = '"+teamId+"' )) "+filter;
                filter = " and a.id not in ('"+orgCodes+"') ";
            }
            sql = " select sum(total) from ( " +
                    "SELECT count(distinct a.id) total from base_patient a  WHERE a.archive_type = 1 and a.sign_status=1 and a.del = '1' " +
                    "and EXISTS ( select 1 from " +
                    "base_service_package_sign_record sr,base_service_package_record r, base_service_package_item i,base_service_package pack  " +
                    "where sr.id = r.sign_id and sr.status=1 and r.service_package_id = i.service_package_id and r.service_package_id = pack.id  " +
                    "and i.del = 1  and sr.`status`=1 and CONVERT(sr.patient USING utf8)  = a.id and r.team_code='"+teamId+"') " +filter+
                    " UNION ALL " +
                    "SELECT count(distinct a.id) total from base_patient a where a.archive_type = 1 and a.sign_status=0 and register='1' and a.del = '1' and a.saas_id='"+teamId+"' " +
                    "and EXISTS (select 1 from wlyy_patient_device pd where pd.user = a.id and pd.del=0) " + filter+
                    " )A ";
            count =  jdbcTemplate.queryForObject(sql,Integer.class);
            map.put("oldTotal",count);//照护老人数量