Browse Source

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

liubing 3 years ago
parent
commit
44b9a9799f

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

@ -149,7 +149,8 @@ public class AdminInfoEndpoint extends EnvelopRestEndpoint {
    @GetMapping(value = "getServiceSituation")
    @ApiOperation(value = "设备库存、使用、总备案、照护类型设备数量")
    public ObjEnvelop getServiceSituation() {
    public ObjEnvelop getServiceSituation( @RequestParam(required = true) String area,
                                           @RequestParam(required = true) int level) {
        try {
            JSONObject param = new JSONObject();
            String doctorId =  permissionService.getUID();
@ -157,7 +158,7 @@ public class AdminInfoEndpoint extends EnvelopRestEndpoint {
            if(permissionService.noPermission(0,param)){
                return ObjEnvelop.getError("该操作没有权限");
            }
            return success("查询成功", 200, platformService.getServiceSituation());
            return success("查询成功", 200, platformService.getServiceSituation(area,level));
        } catch (Exception e) {
            return failedObjEnvelopException(e);
        }
@ -165,7 +166,8 @@ public class AdminInfoEndpoint extends EnvelopRestEndpoint {
    @GetMapping(value = "getDeviceCompany")
    @ApiOperation(value = "设备物联率、失联率")
    public ObjEnvelop getDeviceCompany() {
    public ObjEnvelop getDeviceCompany( @RequestParam(required = true) String area,
                                        @RequestParam(required = true) int level) {
        try {
            JSONObject param = new JSONObject();
            String doctorId =  permissionService.getUID();
@ -173,7 +175,7 @@ public class AdminInfoEndpoint extends EnvelopRestEndpoint {
            if(permissionService.noPermission(0,param)){
                return ObjEnvelop.getError("该操作没有权限");
            }
            JSONObject o = platformService.getDeviceComapny();
            JSONObject o = platformService.getDeviceComapny(area,level);
            return success(o);
        } catch (Exception e) {
            return failedObjEnvelopException(e);

+ 4 - 2
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/lifeCare/DoctorLifeCareEndpoint.java

@ -61,9 +61,11 @@ public class DoctorLifeCareEndpoint extends EnvelopRestEndpoint {
    @ApiOperation(value = "顶部状态栏订单分类tab")
    public ObjEnvelop topStatusBarNum(
            @ApiParam(name = "doctor", value = "医生code")
            @RequestParam(value = "doctor", required = true) String doctor) {
            @RequestParam(value = "doctor", required = true) String doctor,
            @ApiParam(name = "code", value = "服务项类型", required = false)
            @RequestParam(value = "code",required = false) String code) {
        try {
            Map<String, Integer> map = lifeCareOrderService.getNumGroupByStatus(doctor);
            Map<String, Integer> map = lifeCareOrderService.getNumGroupByStatus(doctor,code);
            return ObjEnvelop.getSuccess("获取成功",map);
        } catch (Exception e) {
            return failedObjEnvelopException2(e);

+ 2 - 2
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/statistics/DetectionPlatformEndpoint.java

@ -74,7 +74,7 @@ public class DetectionPlatformEndpoint extends EnvelopRestEndpoint {
    @ApiOperation(value = "设备物联率、失联率")
    public ObjEnvelop getDeviceCompany() {
        try {
            JSONObject o = platformService.getDeviceComapny();
            JSONObject o = platformService.getDeviceComapny(null,null);
            return success(o);
        } catch (Exception e) {
            return failedObjEnvelopException(e);
@ -280,7 +280,7 @@ public class DetectionPlatformEndpoint extends EnvelopRestEndpoint {
    @ApiOperation(value = "物联网检测大屏,设备库存、使用、总备案、照护类型设备数量")
    public ObjEnvelop getServiceSituation() {
        try {
            return success("查询成功", 200, platformService.getServiceSituation());
            return success("查询成功", 200, platformService.getServiceSituation(null,null));
        } catch (Exception e) {
            return failedObjEnvelopException(e);
        }

+ 8 - 3
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/lifeCare/LifeCareOrderService.java

@ -213,13 +213,18 @@ public class LifeCareOrderService extends BaseJpaService<LifeCareOrderDO, LifeCa
     * @param doctor
     * @return
     */
    public Map<String, Integer> getNumGroupByStatus(String doctor) {
    public Map<String, Integer> getNumGroupByStatus(String doctor,String code) {
        List<BaseDoctorHospitalDO> doctorHospitalDOs = doctorHospitalDao.findByDoctorCode(doctor);
        String hospital = doctorHospitalDOs.get(0).getOrgCode();
        String filter = " ";
        if (StringUtils.isNotBlank(code)){
            filter = " and fed.code='"+code+"' ";
        }
        String sql = "SELECT a.status, COUNT(DISTINCT a.id) as num FROM base_life_care_order a " ;
        String sql = "SELECT a.status, COUNT(DISTINCT a.id) as num FROM base_life_care_order a " +
                " INNER JOIN base_life_care_fee_detail fed on a.id = fed.order_id " ;
        sql +=  "  WHERE  a.hospital = ? and a.pay_status>0 and a.status<>0 group BY a.status";
        sql +=  "  WHERE  a.hospital = ? and a.pay_status>0 and a.status<>0 "+filter+" group BY a.status";
        List<Map<String, Object>> list = jdbcTemplate.queryForList(sql, hospital);
        Map<String, Integer> map = new HashMap<>();
        //状态 待服务 1、已完成 2 、已取消 -1 已签到 3

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

@ -117,7 +117,9 @@ public class DetectionPlatformService  {
        }
    }
    public JSONObject getDeviceComapny(){
    public JSONObject getDeviceComapny(String area,Integer level){
        String olderFilter = roleService.getOlderRoleSQL(area,level+"");
        String filter = "";
        String sqltmp = "SELECT GROUP_CONCAT(dict_code) orgCodes from wlyy_hospital_sys_dict WHERE dict_name = 'jkzl_child' or dict_name = 'jkzl_older' ";
        List<Map<String,Object>> listtmp =  jdbcTemplate.queryForList(sqltmp);
@ -144,7 +146,7 @@ public class DetectionPlatformService  {
        }
        String securitySql = "SELECT allCount,isUse,(allCount - isUse) inventory FROM \n" +
                "(SELECT COUNT(1) allCount FROM wlyy_devices WHERE device_type = 1) allCount,\n" +
                "(SELECT COUNT(DISTINCT pd.device_sn) isUse FROM wlyy_devices d,wlyy_patient_device pd WHERE d.device_type = 1 AND d.device_code = pd.device_sn and pd.user "+filter+" AND pd.del = 0) isUse";
                "(SELECT COUNT(DISTINCT pd.device_sn) isUse FROM wlyy_devices d,wlyy_patient_device pd WHERE d.device_type = 1 AND d.device_code = pd.device_sn and pd.user "+filter+" AND pd.del = 0 "+olderFilter.replace("{patient}","pd.user")+" ) isUse";
        List<Map<String , Object>> securityList = jdbcTemplate.queryForList(securitySql);
        if (securityList.size() > 0) {
            object.put("securityAllCount",securityList.get(0).get("allCount")); //安防设备总量
@ -157,7 +159,7 @@ public class DetectionPlatformService  {
        }
        String healthSql = "SELECT allCount,isUse,(allCount - isUse) inventory FROM \n" +
                "(SELECT COUNT(1) allCount FROM wlyy_devices WHERE device_type = 0) allCount,\n" +
                "(SELECT COUNT(DISTINCT pd.device_sn) isUse FROM wlyy_devices d,wlyy_patient_device pd WHERE d.device_type = 0 AND d.device_code = pd.device_sn and pd.user "+filter+" AND pd.del = 0) isUse";
                "(SELECT COUNT(DISTINCT pd.device_sn) isUse FROM wlyy_devices d,wlyy_patient_device pd WHERE d.device_type = 0 AND d.device_code = pd.device_sn and pd.user "+filter+" AND pd.del = 0 "+olderFilter.replace("{patient}","pd.user")+" ) isUse";
        List<Map<String , Object>> healthList = jdbcTemplate.queryForList(healthSql);
        if (healthList.size() > 0) {
            object.put("healthAllCount",healthList.get(0).get("allCount"));//健康设备总量
@ -175,7 +177,7 @@ public class DetectionPlatformService  {
        object.put("lawOfIOT",getRange( (securityIsUser.intValue() + healthIsUser.intValue() ),( securityAllCount.intValue() + healthAllCount.intValue()  ) ));//物联率 发放了就算物联
        object.put("isUseAllIot",(securityIsUser.intValue() + healthIsUser.intValue()));//已发放设备 失联分母、物联分子
        object.put("allIot",securityAllCount.intValue() + healthAllCount.intValue());//总设备 物联分母
        String unUseSql = "SELECT DISTINCT wd.device_code FROM wlyy_devices wd INNER JOIN wlyy_patient_device pd on wd.device_code =pd.device_sn and pd.user "+filter+"  WHERE contact_status = 0";//contact_status = 0   失联
        String unUseSql = "SELECT DISTINCT wd.device_code FROM wlyy_devices wd INNER JOIN wlyy_patient_device pd on wd.device_code =pd.device_sn and pd.user "+filter+" "+olderFilter.replace("{patient}","pd.user")+" WHERE contact_status = 0";//contact_status = 0   失联
        List<Map<String , Object>> unUseList = jdbcTemplate.queryForList(unUseSql);
        int unUseCount = unUseList.size();
        object.put("unUseCount",unUseCount);//设备失联数量 失联分子
@ -492,8 +494,9 @@ public class DetectionPlatformService  {
        return object;
    }
    public JSONObject getServiceSituation(){
    public JSONObject getServiceSituation(String area,Integer level){
        JSONObject object = new JSONObject();
        String olderFilter = roleService.getOlderRoleSQL(area,level+"");
        /*****设备分类****/
        // SELECT hsd.`value` dict_value,aa.count FROM base_system_dict_entry hsd LEFT JOIN (SELECT serve_desc,COUNT(1) count FROM base_security_monitoring_order GROUP BY serve_desc)aa ON hsd.`value` = aa.serve_desc WHERE hsd.remark = 'security'
        String passportTypeSql = "SELECT sde.`value`,COUNT(d.id) count,GROUP_CONCAT(DISTINCT d.category_code SEPARATOR ',') AS category_code,GROUP_CONCAT(DISTINCT d.model SEPARATOR ',') AS model FROM base_system_dict_entry sde LEFT JOIN dm_device d ON FIND_IN_SET(sde.`code`,d.service_topic) WHERE sde.remark = 'security' GROUP BY sde.`value` ";
@ -510,7 +513,7 @@ public class DetectionPlatformService  {
                model = (String) passportType.get(i).get("model");
                model = model.replace(",","','");
                if ( count.intValue() > 0) {
                    useSql = "SELECT COUNT(DISTINCT device_sn) FROM wlyy_patient_device WHERE category_code IN ("+ passportType.get(i).get("category_code") +") AND del = 0";
                    useSql = "SELECT COUNT(DISTINCT device_sn) FROM wlyy_patient_device pd WHERE category_code IN ("+ passportType.get(i).get("category_code") +") AND del = 0 "+olderFilter.replace("{patient}","pd.user");
                    use = jdbcTemplate.queryForObject(useSql,Integer.class);
                    passportType.get(i).put("use",use);//使用
                    allSql = "SELECT COUNT(DISTINCT device_code) FROM wlyy_devices WHERE device_model IN ('"+ model +"')";
@ -616,7 +619,12 @@ public class DetectionPlatformService  {
     */
    public JSONObject getTopicPeopleNums(String area,String level){
        JSONObject result = new JSONObject();
        String sql = " select dict_code from wlyy_hospital_sys_dict where dict_name='security_topic_dict' ";
        List<String> sqlList = jdbcTemplate.queryForList(sql,String.class);
        for (String tmp:sqlList){
            result.put(tmp,0);
        }
        result.put("emergencyAssistance",0);
        String olderFilter = roleService.getOlderRoleSQL(area,level);
//        String filter = " ";
@ -629,7 +637,7 @@ public class DetectionPlatformService  {
//                filter = " and pd.user not in ('" + orgCodes + "') ";
//            }
//        }
        String sql = " select count(DISTINCT pd.user) total,pd.category_code from wlyy_patient_device pd where pd.del=0  " +
        sql = " select count(DISTINCT pd.user) total,pd.category_code from wlyy_patient_device pd where pd.del=0  " +
                " and pd.category_code in (4,7,12,13,14,15) " + olderFilter.replace("{patient}","pd.user")+
                " group by pd.category_code ";
        List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);