Browse Source

大屏添加老人亲属过滤

liubing 3 years ago
parent
commit
2a22b5e539

+ 1 - 1
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/message/PatientMessageService.java

@ -112,7 +112,7 @@ public class PatientMessageService {
            patient +=",'"+agent+"'";
        }
        String sql = " select A.*,B.notRead from " +
                "(select  count(1) as 'all',type,MAX(create_time) create_time " +
                "(select  count(1) as 'all',type,DATE_FORMAT(MAX(create_time),'%Y-%m-%d %H:%i:%S') create_time " +
                "from base_system_message where receiver in("+patient+") and del=1  GROUP BY type ORDER BY create_time desc)A " +
                "LEFT JOIN (select count(1) notRead,type " +
                "from base_system_message where receiver in("+patient+") and (is_read=0 or is_read is null ) and del=1  GROUP BY type)B on A.type = B.type " +

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

@ -559,6 +559,14 @@ public class CarePatientService extends BaseJpaService<BasePatientDO, BasePatien
            re.put("helperTotal",findHelperTotal(name,filter));
        }
        if("5".equals(type)||StringUtils.isBlank(type)){//老人家属
            filter = "";
            String sqltmp = "SELECT GROUP_CONCAT(dict_code) orgCodes from wlyy_hospital_sys_dict WHERE dict_name = 'jkzl_olderRelative' ";
            List<Map<String,Object>> listtmp =  jdbcTemplate.queryForList(sqltmp);
            if(listtmp.size()>0){
                String orgCodes = String.valueOf(listtmp.get(0).get("orgCodes"));
                orgCodes = orgCodes.replaceAll(",","','");
                filter = " and t2.id not in ('"+orgCodes+"')";
            }
            List<Map<String,Object>> list = findOlderFamily(name,limit,filter);
            re.put("oldFamily",list);
            re.put("oldFamilyCount",findOlderFamilyTotal(name,filter));
@ -740,7 +748,7 @@ public class CarePatientService extends BaseJpaService<BasePatientDO, BasePatien
                "left join base_patient t3 on t3.id = t1.patient  " +
                "where t2.archive_type=3 and t2.del=1 and t3.archive_type=1 and t3.del=1 ";
        if (StringUtils.isNotBlank(name)){
            sql += " and t3.name like '%"+name+"%'";
            sql += " and t3.name like '%"+name+"%' ";
        }
        sql += fileter + " GROUP BY t2.id,t1.patient ORDER BY online desc ";
        sql += limit;
@ -757,7 +765,7 @@ public class CarePatientService extends BaseJpaService<BasePatientDO, BasePatien
                "left join base_patient t3 on t3.id = t1.patient  " +
                "where t2.archive_type=3 and t2.del=1 and t3.archive_type=1 and t3.del=1 ";
        if (StringUtils.isNotBlank(name)){
            sql += " and t3.name like '%"+name+"%'";
            sql += " and t3.name like '%"+name+"%' ";
        }
        sql += fileter +" group by t2.id,t1.patient ";
        String sqlCount = "SELECT count(*) from ( "+sql+")A";

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

@ -866,7 +866,7 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
                    break;
            }
            if (StringUtils.isNotBlank(doctor)) {//日常监护医生必传
                fliter += " and EXISTS( 1" +
                fliter += " and EXISTS( SELECT 1" +
                        " from base_service_package_sign_record sr,base_service_package_record r,base_team_member m  " +
                        " WHERE ord.patient = CONVERT(sr.patient USING utf8) and sr.status=1 and m.team_code = r.team_code and sr.id=r.sign_id  " +
                        " and m.doctor_code = '" + doctor + "' and m.del = '1' ) ";

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

@ -737,7 +737,15 @@ public class StatisticsService {
        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; ";
        String olderRelativeFilter = "";
        String sqltmp = "SELECT GROUP_CONCAT(dict_code) orgCodes from wlyy_hospital_sys_dict WHERE dict_name = 'jkzl_olderRelative' ";
        listtmp =  jdbcTemplate.queryForList(sqltmp);
        if(listtmp.size()>0) {
            String orgCodes = String.valueOf(listtmp.get(0).get("orgCodes"));
            orgCodes = orgCodes.replaceAll(",", "','");
            olderRelativeFilter = " and t2.id not in ('" + orgCodes + "') ";
        }
        sql2 = " select count(id) count,if(openid is null,0,1) online from base_patient t2 where  archive_type=3 and del=1 "+olderRelativeFilter+" 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());
@ -751,7 +759,7 @@ public class StatisticsService {
        }
        olderFamilyTotal = olderFamilyOff+olderFamilyOn;
        //家属绑定老人数量
        olderFamilyBinding = carePatientService.findOlderFamilyTotal(null,"");
        olderFamilyBinding = carePatientService.findOlderFamilyTotal(null,olderRelativeFilter);
        //helper 助老员,teacher 教师,child 幼儿,olderWx 老人公众号,olderPad 老人平板
        result.put("olderTotal", olderTotal);