Browse Source

大屏部分

liubing 3 years ago
parent
commit
1aa9559b9e

+ 1 - 1
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/statistics/OpenStatisticsEndpoint.java

@ -210,7 +210,7 @@ public class OpenStatisticsEndpoint extends EnvelopRestEndpoint {
    @GetMapping(value = "findUserByType")
    @ApiOperation(value = "人员实时动态搜索")
    public Envelop findUserByType(@ApiParam(name = "type", value = "类型:1幼儿,2老人,3助老员,4医生。不传返回四个类型的数据")
    public Envelop findUserByType(@ApiParam(name = "type", value = "类型:1幼儿,2老人,3助老员,4医生,5老人家属。不传返回四个类型的数据")
                                  @RequestParam(value = "type", required = false) String type,
                                  @ApiParam(name = "name", value = "姓名")
                                  @RequestParam(value = "name", required = false) String name,

+ 33 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/patient/CarePatientService.java

@ -558,6 +558,11 @@ public class CarePatientService extends BaseJpaService<BasePatientDO, BasePatien
            re.put("helperTotal",findHelperTotal(name,filter));
        }
        if("5".equals(type)||StringUtils.isBlank(type)){//老人家属
            List<Map<String,Object>> list = findOlderFamily(name,limit,filter);
            re.put("oldFamily",list);
            re.put("oldFamilyCount",findOlderFamilyTotal(name,filter));
        }
        return re;
    }
@ -729,7 +734,35 @@ public class CarePatientService extends BaseJpaService<BasePatientDO, BasePatien
        return jdbcTemplate.queryForObject(sql,Integer.class);
    }
    public List<Map<String,Object>> findOlderFamily(String name,String limit,String fileter){
        String sql = "select t2.id,t2.name,t2.sex,t2.mobile,t2.idcard,if(t2.openid is null,0,1) online,t2.photo,t1.family_relation,t1.patient older,t3.name olderName " +
                "from base_patient t2 left JOIN base_patient_family_member t1 on t1.family_member = t2.id " +
                "left join base_patient t3 on t3.id = t1.patient  " +
                "where t2.archive_type=3 and t2.del=1 ";
        if (StringUtils.isNotBlank(name)){
            sql += " and t3.name like '%"+name+"%'";
        }
        sql += fileter + "GROUP BY t2.id,t1.patient ";
        sql += limit;
        List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
        for (Map<String,Object>tmp:list){
            tmp.put("relaholder", familyMemberService.relations.get(tmp.get("family_relation")));
        }
        return list;
    }
    public Integer findOlderFamilyTotal(String name,String fileter){
        String sql = "select t2.id,t1.patient " +
                "from base_patient t2 left JOIN base_patient_family_member t1 on t1.family_member = t2.id " +
                "left join base_patient t3 on t3.id = t1.patient  " +
                "where t2.archive_type=3 and t2.del=1 ";
        if (StringUtils.isNotBlank(name)){
            sql += " and t3.name like '%"+name+"%'";
        }
        sql += fileter +" group by t2.id,t1.patient ";
        String sqlCount = "SELECT count(*) from ( "+sql+")A";
        return jdbcTemplate.queryForObject(sqlCount,Integer.class);
    }
    public void intiPatient(){
        String sql = "SELECT * from base_patient WHERE residential_area is not null and `password` is null";

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

@ -1736,6 +1736,15 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
                            result.put("fences", fencesEnables);
                        }
                    }
                    //手表剩余电量
                    if (response.containsKey("remaining_power") && response.get("remaining_power") != null) {
                        result.put("remaining_power", response.get("remaining_power"));
                    }
                    //手表佩戴状态
                    if (response.containsKey("wear_flag") && response.get("wear_flag") != null) {
                        result.put("wear_flag", response.get("wear_flag"));
                        result.put("wear_flagName", 1==response.getInteger("wear_flag")?"未佩戴":"已佩戴");
                    }
                }
            }
            if (devicePatientDeviceDos2.size() > 0 && (16 == categoryCode || 0 == categoryCode)) {//拐杖

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

@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.care.dao.device.PatientDeviceDao;
import com.yihu.jw.care.service.patient.CarePatientService;
import com.yihu.jw.care.util.CommonUtil;
import com.yihu.jw.care.util.ConstantUtil;
import com.yihu.jw.care.vo.NumVo;
@ -91,6 +92,8 @@ public class StatisticsService {
    private String esIndex;
    @Value("${es.type.Statistics}")
    private String esType;
    @Autowired
    private CarePatientService carePatientService;
    private static final String defalutArea = "330100";
@ -652,6 +655,10 @@ public class StatisticsService {
        Integer olderOn = 0;
        Integer olderWxOn = 0;
        Integer olderPadOn = 0;
        Integer olderFamilyTotal = 0;//老人家属
        Integer olderFamilyOn = 0;
        Integer olderFamilyOff = 0;
        Integer olderFamilyBinding = 0;//家属绑定老人数量
        //儿童注册人数
        String childFilter = "";
        String sqlChildtmp = "SELECT GROUP_CONCAT(dict_code) orgCodes from wlyy_hospital_sys_dict WHERE dict_name = 'jkzl_child' or dict_name = 'jkzl_older'  ";
@ -729,6 +736,23 @@ public class StatisticsService {
        helperTotal = helperOff + helperOn;
        teacherTotal = teacherOff + teacherOn;
        //老人家属
        sql2 = " select count(id) count,if(openid is null,0,1) online from base_patient where  archive_type=3 and del=1 GROUP BY online; ";
        List<Map<String, Object>> oldFamilyList2 = jdbcTemplate.queryForList(sql2);
        for(Map<String,Object>tmp:oldFamilyList2){
            Integer num = Integer.valueOf(tmp.get("count").toString());
            Integer online = Integer.valueOf(tmp.get("online").toString());
            if (0==online){
                olderFamilyOff+=num;
            }
            if (1==online){
                olderFamilyOn+=num;
            }
        }
        olderFamilyTotal = olderFamilyOff+olderFamilyOn;
        //家属绑定老人数量
        olderFamilyBinding = carePatientService.findOlderFamilyTotal(null,"");
        //helper 助老员,teacher 教师,child 幼儿,olderWx 老人公众号,olderPad 老人平板
        result.put("olderTotal", olderTotal);
        result.put("childTotal", childTotal);
@ -743,6 +767,12 @@ public class StatisticsService {
        result.put("helperOff", helperOff);
        result.put("teacherOff", teacherOff);
        result.put("olderOff", olderOff);
        //老人家属
        result.put("olderFamilyTotal", olderFamilyTotal);
        result.put("olderFamilyOn", olderFamilyOn);
        result.put("olderFamilyOff", olderFamilyOff);
        result.put("olderFamilyBinding", olderFamilyBinding);
        return result;
    }