Browse Source

Merge branch 'dev' of trick9191/patient-co-management into dev

trick9191 7 years ago
parent
commit
70fb68b2f0

+ 2 - 2
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/label/SignPatientLabelInfoService.java

@ -396,7 +396,7 @@ public class SignPatientLabelInfoService extends BaseService {
                    "  LEFT JOIN wlyy_patient p on p.code = t1.patient  "+
                    "  RIGHT JOIN wlyy_sign_patient_label_info t2 on t2.patient = t1.patient ";
            if(StringUtils.isNotBlank(trackFlag)&&"1".equals(trackFlag)){
                sql = sql +" JOIN wlyy_track_patient tp WHERE tp.patient_code = p.code";
                sql = sql +" JOIN wlyy_track_patient tp ON tp.patient_code = p.code";
            }
            sql = sql + " WHERE t2.label = ?";
@ -415,7 +415,7 @@ public class SignPatientLabelInfoService extends BaseService {
                sql += "  AND p.openid IS NOT NULL AND p.openid <>'' ";
            }
            if(StringUtils.isNotBlank(trackFlag)&&"1".equals(trackFlag)){
                sql = sql + " AND tp.del='1'  AND tp.doctor_code ='"+doctor+"' AND tp.team_code"+teamCode;
                sql = sql + " AND tp.del='1'  AND tp.doctor_code ='"+doctor+"' AND tp.team_code ="+teamCode;
            }
    
            sql = sql + " order by p.standard_status DESC ,p.disease_condition DESC,t2.label DESC,t1.openid DESC ,convert(t1.name using gbk) ";

+ 393 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/scheme/DoctorSchemeService.java

@ -1530,4 +1530,397 @@ public class DoctorSchemeService extends BaseService{
        List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
        return list;
    }
    public List<Map<String,Object>> getTrackPatientIndexCountList(String doctor,Integer teamCode,String type,String startDate,String endDate,String keyword,Integer page,Integer size){
        startDate = startDate+" 00:00:00";
        endDate = endDate + " 23:59:59";
        // /血糖查询
        if("1".equals(type)){
            List<Map<String,Object>> list = jdbcTemplate.queryForList(getXTTrackPatientIndexCountListSql(doctor,teamCode,startDate,endDate,keyword, page, size));
            return list;
        }else{
            List<Map<String,Object>> list = jdbcTemplate.queryForList(getXYTrackPatientIndexCountListSql(doctor,teamCode,startDate,endDate,keyword, page, size));
            return list;
        }
    }
    public String getXTTrackPatientIndexCountListSql(String doctor,Integer teamCode,String startDate,String endDate,String keyword,Integer page,Integer size){
        String sql = "SELECT  " +
                " tt1.patient_code, " +
                " tt1.highCount, " +
                " tt2.lowCount, " +
                " tt3.stdCount, " +
                " p.`name`, " +
                " IFNULL(year( from_days( datediff( now(), p.birthday))),'未知') age, " +
                " p.photo, " +
                " p.idcard " +
                " FROM " +
                " " +
                "( " +
                " " +
                " SELECT " +
                " t1.patient_code, " +
                " t2.total + t1.total AS highCount " +
                " FROM " +
                " ( " +
                "  SELECT " +
                "   t.patient_code, " +
                "   IFNULL(pid.total, 0) AS total " +
                "  FROM " +
                "   ( " +
                "    SELECT " +
                "     tp.patient_code " +
                "    FROM " +
                "     wlyy_track_patient tp " +
                "    WHERE " +
                "     tp.del = '1' " +
                "    AND tp.doctor_code = '"+doctor+"' " +
                "    AND tp.team_code = " +teamCode+
                "   ) t " +
                "  LEFT JOIN ( " +
                "   SELECT " +
                "    i. USER, " +
                "    COUNT(1) AS total " +
                "   FROM " +
                "    device.wlyy_patient_health_index i " +
                "   WHERE " +
                "    i.del = '1' " +
                "   AND i.type = 1 " +
                "   AND i.value2 IN (2, 4, 6) " +
                "   AND i.value1 > 7.8 " +
                "   AND i.i.record_date >='"+startDate+"'" +
                "   AND i.i.record_date <='"+endDate+"'" +
                "   GROUP BY " +
                "    i. USER " +
                "  ) pid ON pid. USER = t.patient_code " +
                " ) t1  " +
                " " +
                " JOIN  " +
                " " +
                " ( " +
                " SELECT " +
                "  t.patient_code, " +
                "  IFNULL(pid.total, 0) AS total " +
                " FROM " +
                "  ( " +
                "   SELECT " +
                "    tp.patient_code " +
                "   FROM " +
                "    wlyy_track_patient tp " +
                "   WHERE " +
                "    tp.del = '1' " +
                "   AND tp.doctor_code = '"+doctor+"' " +
                "   AND tp.team_code =" +teamCode+
                "  ) t " +
                " LEFT JOIN ( " +
                "  SELECT " +
                "   i. USER, " +
                "   COUNT(1) AS total " +
                "  FROM " +
                "   device.wlyy_patient_health_index i " +
                "  WHERE " +
                "   i.del = '1' " +
                "  AND i.type = 1 " +
                "  AND i.value2 IN (1, 3, 5, 7) " +
                "  AND i.value1 > 6.1 " +
                "  AND i.i.record_date >='"+startDate+"'" +
                "  AND i.i.record_date <='"+endDate+"'" +
                "  GROUP BY " +
                "   i. USER " +
                " ) pid ON pid. USER = t.patient_code " +
                ") t2 ON t1.patient_code = t2.patient_code " +
                " " +
                ") tt1  " +
                " " +
                " JOIN  " +
                " " +
                "( " +
                "  SELECT " +
                " t1.patient_code, " +
                " t1.total + t2.total AS lowCount " +
                " FROM " +
                " ( " +
                "  SELECT " +
                "   t.patient_code, " +
                "   IFNULL(pid.total, 0) AS total " +
                "  FROM " +
                "   ( " +
                "    SELECT " +
                "     tp.patient_code " +
                "    FROM " +
                "     wlyy_track_patient tp " +
                "    WHERE " +
                "     tp.del = '1' " +
                "    AND tp.doctor_code = '"+doctor+"' " +
                "    AND tp.team_code =  " +teamCode+
                "   ) t " +
                "  LEFT JOIN ( " +
                "   SELECT " +
                "    i. USER, " +
                "    COUNT(1) AS total " +
                "   FROM " +
                "    device.wlyy_patient_health_index i " +
                "   WHERE " +
                "    i.del = '1' " +
                "   AND i.type = 1 " +
                "   AND i.value2 IN (2, 4, 6) " +
                "   AND i.value1 < 4.4 " +
                "  AND i.i.record_date >='"+startDate+"'" +
                "  AND i.i.record_date <='"+endDate+"'" +
                "   GROUP BY " +
                "    i. USER " +
                "  ) pid ON pid. USER = t.patient_code " +
                " ) t1  " +
                " " +
                " JOIN  " +
                " " +
                "( " +
                " SELECT " +
                "  t.patient_code, " +
                "  IFNULL(pid.total, 0) AS total " +
                " FROM " +
                "  ( " +
                "   SELECT " +
                "    tp.patient_code " +
                "   FROM " +
                "    wlyy_track_patient tp " +
                "   WHERE " +
                "    tp.del = '1' " +
                "   AND tp.doctor_code = '"+doctor+"' " +
                "   AND tp.team_code =  " +teamCode+
                "  ) t " +
                " LEFT JOIN ( " +
                "  SELECT " +
                "   i. USER, " +
                "   COUNT(1) AS total " +
                "  FROM " +
                "   device.wlyy_patient_health_index i " +
                "  WHERE " +
                "   i.del = '1' " +
                "  AND i.type = 1 " +
                "  AND i.value2 IN (1, 3, 5, 7) " +
                "  AND i.value1 < 3.9 " +
                "  AND i.i.record_date >='"+startDate+"'" +
                "  AND i.i.record_date <='"+endDate+"'" +
                "  GROUP BY " +
                "   i. USER " +
                " ) pid ON pid. USER = t.patient_code " +
                ") t2 ON t1.patient_code = t2.patient_code " +
                " " +
                ") tt2 ON tt1.patient_code = tt2.patient_code  " +
                " " +
                "JOIN  " +
                " " +
                "( " +
                "   " +
                " SELECT " +
                " t1.patient_code, " +
                " t1.total + t2.total AS stdCount " +
                " FROM " +
                " ( " +
                "  SELECT " +
                "   t.patient_code, " +
                "   IFNULL(pid.total, 0) AS total " +
                "  FROM " +
                "   ( " +
                "    SELECT " +
                "     tp.patient_code " +
                "    FROM " +
                "     wlyy_track_patient tp " +
                "    WHERE " +
                "     tp.del = '1' " +
                "    AND tp.doctor_code = '"+doctor+"' " +
                "    AND tp.team_code = " +teamCode +
                "   ) t " +
                "  LEFT JOIN ( " +
                "   SELECT " +
                "    i. USER, " +
                "    COUNT(1) AS total " +
                "   FROM " +
                "    device.wlyy_patient_health_index i " +
                "   WHERE " +
                "    i.del = '1' " +
                "   AND i.type = 1 " +
                "   AND i.value2 IN (2, 4, 6) " +
                "   AND i.value1 >= 4.4 " +
                "   AND i.value1 <= 7.8 " +
                "  AND i.i.record_date >='"+startDate+"'" +
                "  AND i.i.record_date <='"+endDate+"'" +
                "   GROUP BY " +
                "    i. USER " +
                "  ) pid ON pid. USER = t.patient_code " +
                " ) t1  " +
                " " +
                " JOIN  " +
                " " +
                " ( " +
                " SELECT " +
                "  t.patient_code, " +
                "  IFNULL(pid.total, 0) AS total " +
                " FROM " +
                "  ( " +
                "   SELECT " +
                "    tp.patient_code " +
                "   FROM " +
                "    wlyy_track_patient tp " +
                "   WHERE " +
                "    tp.del = '1' " +
                "   AND tp.doctor_code = '"+doctor+"' " +
                "   AND tp.team_code = " +teamCode+
                "  ) t " +
                " LEFT JOIN ( " +
                "  SELECT " +
                "   i. USER, " +
                "   COUNT(1) AS total " +
                "  FROM " +
                "   device.wlyy_patient_health_index i " +
                "  WHERE " +
                "   i.del = '1' " +
                "  AND i.type = 1 " +
                "  AND i.value2 IN (1, 3, 5, 7) " +
                "  AND i.value1 >= 3.9 " +
                "  AND i.value1 <= 6.1 " +
                "  AND i.i.record_date >='"+startDate+"'" +
                "  AND i.i.record_date <='"+endDate+"'" +
                "  GROUP BY " +
                "   i. USER " +
                " ) pid ON pid. USER = t.patient_code " +
                " ) t2 ON t1.patient_code = t2.patient_code " +
                " " +
                " )tt3 ON tt1.patient_code = tt3.patient_code " +
                " " +
                " JOIN wlyy_patient p On tt1.patient_code =p.code";
        if(StringUtils.isNotBlank(keyword)){
            Patient p = patientDao.findByIdcard(keyword);
            if(p!=null){
                sql =sql + " WHERE p.idcard ='"+keyword+"'";
            }else{
                sql =sql + " WHERE p.name like '%"+keyword+"%' ";
            }
        }
        sql += " ORDER BY highCount DESC LIMIT "+(page-1)*size+","+size;
        return sql ;
    }
    public String getXYTrackPatientIndexCountListSql(String doctor,Integer teamCode,String startDate,String endDate,String keyword,Integer page,Integer size){
        String sql ="SELECT  " +
                " t1.patient_code, " +
                " t1.total AS lowCount, " +
                " t2.total AS stdCount, " +
                " t3.total AS highCount, " +
                " p.`name`, " +
                " IFNULL(year( from_days( datediff( now(), p.birthday))),'未知') age, " +
                " p.photo " +
                " FROM " +
                " " +
                " ( " +
                "  SELECT " +
                "   t.patient_code, " +
                "   IFNULL(pid.total, 0) AS total " +
                "  FROM " +
                "   ( " +
                "    SELECT " +
                "     tp.patient_code " +
                "    FROM " +
                "     wlyy_track_patient tp " +
                "    WHERE " +
                "     tp.del = '1' " +
                "   AND tp.doctor_code = '"+doctor+"' " +
                "   AND tp.team_code = " +teamCode+
                "   ) t " +
                "  LEFT JOIN ( " +
                "   SELECT " +
                "    i. USER, " +
                "    COUNT(1) AS total " +
                "   FROM " +
                "    device.wlyy_patient_health_index i " +
                "   WHERE " +
                "    i.del = '1' " +
                "   AND i.type = 2 " +
                "   AND i.value1 < 90 " +
                "  AND i.i.record_date >='"+startDate+"'" +
                "  AND i.i.record_date <='"+endDate+"'" +
                "   GROUP BY " +
                "    i. USER " +
                "  ) pid ON pid. USER = t.patient_code " +
                " ) t1  " +
                " JOIN " +
                " ( " +
                "  SELECT " +
                "   t.patient_code, " +
                "   IFNULL(pid.total, 0) AS total " +
                "  FROM " +
                "   ( " +
                "    SELECT " +
                "     tp.patient_code " +
                "    FROM " +
                "     wlyy_track_patient tp " +
                "    WHERE " +
                "     tp.del = '1' " +
                "   AND tp.doctor_code = '"+doctor+"' " +
                "   AND tp.team_code = " +teamCode+
                "   ) t " +
                "  LEFT JOIN ( " +
                "   SELECT " +
                "    i. USER, " +
                "    COUNT(1) AS total " +
                "   FROM " +
                "    device.wlyy_patient_health_index i " +
                "   WHERE " +
                "    i.del = '1' " +
                "   AND i.type = 2 " +
                "   AND i.value1 >= 90 " +
                "   AND i.value1 <=139 " +
                "  AND i.i.record_date >='"+startDate+"'" +
                "  AND i.i.record_date <='"+endDate+"'" +
                "   GROUP BY " +
                "    i. USER " +
                "  ) pid ON pid. USER = t.patient_code " +
                "  " +
                " ) t2 ON t1.patient_code = t2.patient_code " +
                " JOIN  " +
                " ( " +
                "  SELECT " +
                "   t.patient_code, " +
                "   IFNULL(pid.total, 0) AS total " +
                "  FROM " +
                "   ( " +
                "    SELECT " +
                "     tp.patient_code " +
                "    FROM " +
                "     wlyy_track_patient tp " +
                "    WHERE " +
                "     tp.del = '1' " +
                "   AND tp.doctor_code = '"+doctor+"' " +
                "   AND tp.team_code = " +teamCode+
                "   ) t " +
                "  LEFT JOIN ( " +
                "   SELECT " +
                "    i. USER, " +
                "    COUNT(1) AS total " +
                "   FROM " +
                "    device.wlyy_patient_health_index i " +
                "   WHERE " +
                "    i.del = '1' " +
                "   AND i.type = 2 " +
                "   AND i.value1 >139 " +
                "  AND i.i.record_date >='"+startDate+"'" +
                "  AND i.i.record_date <='"+endDate+"'" +
                "   GROUP BY " +
                "    i. USER " +
                "  ) pid ON pid. USER = t.patient_code " +
                " ) t3 ON t1.patient_code = t3.patient_code " +
                " JOIN wlyy_patient p ON t1.patient_code = p.`code`";
        if(StringUtils.isNotBlank(keyword)){
            Patient p = patientDao.findByIdcard(keyword);
            if(p!=null){
                sql =sql + " WHERE p.idcard ='"+keyword+"'";
            }else{
                sql =sql + " WHERE p.name like '%"+keyword+"%' ";
            }
        }
        sql += " ORDER BY highCount DESC LIMIT "+(page-1)*size+","+size;
        return sql;
    }
}

+ 12 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/scheme/PatientSchemeController.java

@ -104,4 +104,16 @@ public class PatientSchemeController extends BaseController {
            return error(-1, "查询失败");
        }
    }
    @RequestMapping(value="getTrackPatientIndexCountList",method = RequestMethod.GET)
    @ApiOperation("获取关注居民测量数据列表")
    public String getTrackPatientIndexCountList(Integer teamCode,String type,String startDate,String endDate,String keyword,Integer page,Integer size){
        try {
            return write(200, "查询成功", "data",doctorSchemeService.getTrackPatientIndexCountList(getUID(), teamCode, type, startDate, endDate, keyword, page, size));
        }catch (Exception e){
            error(e);
            //返回接口异常信息处理结果
            return error(-1, "查询失败");
        }
    }
}

+ 1 - 1
patient-co/patient-co-wlyy/src/main/resources/system.properties

@ -31,7 +31,7 @@ patient_QRCode_url=https://open.weixin.qq.com/connect/oauth2/authorize?appid={ap
#居民wifi图片地址
patient_wifi_pic_url = {server}/images/wifi.png
#居民wifi链接
patient_wifi_url = https://open.weixin.qq.com/connect/oauth2/authorize?appid={appId}&amp;redirect_uri={server}%2fwx%2fhtml%2fintroduction%2fhtml%2fyygh.html&amp;response_type=code&amp;scope=snsapi_base&amp;state=code#wechat_redirect
patient_wifi_url = https://open.weixin.qq.com/connect/oauth2/authorize?appid={appId}&amp;redirect_uri=http://www.baidu.com
#就诊记录
patient_visit_pic ={server}/images/visit.png
#检查检验