yeshijie 7 роки тому
батько
коміт
1dfaf9d0bd

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

@ -332,11 +332,11 @@ public class SignPatientLabelInfoService extends BaseService {
                sql = sql + " LEFT JOIN wlyy_patient p on p.code = t1.patient  ";
                sql = sql + " LEFT JOIN wlyy_patient p on p.code = t1.patient  ";
            }
            }
            sql = sql + " WHERE t2.label = ?";
            sql = sql + " WHERE t2.label = ?";
    
            if(StringUtils.isNotBlank(diseaseCondition)) {
            if(StringUtils.isNotBlank(diseaseCondition)) {
                sql = sql + " AND p.disease_condition = ? ";
                sql = sql + " AND p.disease_condition = ? ";
            }
            }
    
            sql = sql + "    AND t2.label_type = ? " +
            sql = sql + "    AND t2.label_type = ? " +
                    "    AND t2.status = 1 " +
                    "    AND t2.status = 1 " +
                    "    AND t1.patient = t2.patient " +
                    "    AND t1.patient = t2.patient " +
@ -394,7 +394,7 @@ public class SignPatientLabelInfoService extends BaseService {
//                if (p == null) {
//                if (p == null) {
//                    continue;
//                    continue;
//                }
//                }
    
                PatientVO p = new PatientVO();
                PatientVO p = new PatientVO();
                if(sign.get("patient") != null){
                if(sign.get("patient") != null){
                    String patientsql = "select a.*,b.deviceType as deviceType,c.disease as disease from wlyy_patient a" +
                    String patientsql = "select a.*,b.deviceType as deviceType,c.disease as disease from wlyy_patient a" +
@ -402,7 +402,7 @@ public class SignPatientLabelInfoService extends BaseService {
                            "  left join (select patient,group_concat(label) disease from wlyy_sign_patient_label_info where label_type = 3 and status=1 " +
                            "  left join (select patient,group_concat(label) disease from wlyy_sign_patient_label_info where label_type = 3 and status=1 " +
                            " and (label = 1 or label = 2) and patient = '"+sign.get("patient").toString()+"' GROUP BY patient) c on a.code = c.patient" +
                            " and (label = 1 or label = 2) and patient = '"+sign.get("patient").toString()+"' GROUP BY patient) c on a.code = c.patient" +
                            " where a.status =1 and a.code = '"+sign.get("patient").toString()+"'";
                            " where a.status =1 and a.code = '"+sign.get("patient").toString()+"'";
        
                    p = (PatientVO)jdbcTemplate.queryForObject(patientsql,new BeanPropertyRowMapper(PatientVO.class));
                    p = (PatientVO)jdbcTemplate.queryForObject(patientsql,new BeanPropertyRowMapper(PatientVO.class));
                }else{
                }else{
                    continue;
                    continue;
@ -506,7 +506,7 @@ public class SignPatientLabelInfoService extends BaseService {
                    json.put("expensesStatus", "1");
                    json.put("expensesStatus", "1");
                }
                }
                 //病情类型:0健康,1高血压,2糖尿病,(1,2)高血压+糖尿病
                //病情类型:0健康,1高血压,2糖尿病,(1,2)高血压+糖尿病
                json.put("disease",p.getDisease());
                json.put("disease",p.getDisease());
                // 病情:0绿标,1黄标,2红标,
                // 病情:0绿标,1黄标,2红标,
                json.put("diseaseCondition",p.getDiseaseCondition());
                json.put("diseaseCondition",p.getDiseaseCondition());
@ -1062,14 +1062,14 @@ public class SignPatientLabelInfoService extends BaseService {
                SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
                SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
                if (labelType.equals("5")) {
                if (labelType.equals("5")) {
    
                    sql = "select count(DISTINCT t1.patient) count" +
                    sql = "select count(DISTINCT t1.patient) count" +
                            " from " +
                            " from " +
                            "     wlyy_sign_family t1," +
                            "     wlyy_sign_family t1," +
                            "     wlyy_patient t3 " +
                            "     wlyy_patient t3 " +
                            " where t1.patient = t3.code AND (t1.doctor = ? or t1.doctor_health = ?) and t1.status > 0 " +
                            " where t1.patient = t3.code AND (t1.doctor = ? or t1.doctor_health = ?) and t1.status > 0 " +
                            (teamCode > 0 ? " and t1.admin_team_code = ? " : "");
                            (teamCode > 0 ? " and t1.admin_team_code = ? " : "");
    
                    if (label.getLabelCode().equals("1")) {
                    if (label.getLabelCode().equals("1")) {
                        int week = today.get(Calendar.DAY_OF_WEEK) - 2;
                        int week = today.get(Calendar.DAY_OF_WEEK) - 2;
                        if (week == -1) {
                        if (week == -1) {
@ -1095,14 +1095,13 @@ public class SignPatientLabelInfoService extends BaseService {
                        args = new Object[]{doctor, doctor};
                        args = new Object[]{doctor, doctor};
                    }
                    }
                }else if(labelType.equals("3") && isSlowDisease) {
                }else if(labelType.equals("3") && isSlowDisease) {
                    
                    if("1".equals(label.getLabelCode()) ||  "2".equals(label.getLabelCode())){
                    if("1".equals(label.getLabelCode()) ||  "2".equals(label.getLabelCode())){
                        sql = " SELECT " +
                        sql = " SELECT " +
                                "     count(DISTINCT t1.patient) count" +
                                "     count(DISTINCT t1.patient) count" +
                                " FROM" +
                                "     wlyy_sign_family t1, " +
                                "     wlyy_sign_patient_label_info t2, " +
                                "     wlyy_patient t3 " +
                                " FROM wlyy_sign_family t1 " +
                                " RIGHT JOIN wlyy_sign_patient_label_info t2 ON t1.patient = t2.patient and t2.status=1 " +
                                " JOIN wlyy_patient t3 ON t1.patient = t3.code " +
                                " WHERE" +
                                " WHERE" +
                                "     t1.patient = t2.patient " +
                                "     t1.patient = t2.patient " +
                                "     AND t1.patient = t3.code "+
                                "     AND t1.patient = t3.code "+
@ -1113,7 +1112,7 @@ public class SignPatientLabelInfoService extends BaseService {
                                "     AND t1.status > 0 " +
                                "     AND t1.status > 0 " +
                                (teamCode > 0 ? "    AND t1.admin_team_code = ? " : "")+
                                (teamCode > 0 ? "    AND t1.admin_team_code = ? " : "")+
                                "     AND t3.disease_condition = ? ";
                                "     AND t3.disease_condition = ? ";
    
                        if (teamCode > 0) {
                        if (teamCode > 0) {
                            args = new Object[]{label.getLabelCode(), labelType, doctor, doctor, teamCode,diseaseCondition};
                            args = new Object[]{label.getLabelCode(), labelType, doctor, doctor, teamCode,diseaseCondition};
                        } else {
                        } else {
@ -1184,7 +1183,7 @@ public class SignPatientLabelInfoService extends BaseService {
                }else{
                }else{
                    sql += labelType.equals("5") ? " AND LENGTH(TRIM(IFNULL(t3.openid,''))) > 0 " : " AND LENGTH(TRIM(IFNULL(t3.openid,''))) > 0 ";
                    sql += labelType.equals("5") ? " AND LENGTH(TRIM(IFNULL(t3.openid,''))) > 0 " : " AND LENGTH(TRIM(IFNULL(t3.openid,''))) > 0 ";
                }
                }
                
                List<Map<String, Object>> focusCount = jdbcTemplate.queryForList(sql, args);
                List<Map<String, Object>> focusCount = jdbcTemplate.queryForList(sql, args);
                if (focusCount != null && focusCount.size() > 0 && focusCount.get(0).containsKey("count")) {
                if (focusCount != null && focusCount.size() > 0 && focusCount.get(0).containsKey("count")) {
@ -2453,10 +2452,10 @@ public class SignPatientLabelInfoService extends BaseService {
     * @throws Exception
     * @throws Exception
     */
     */
    public JSONArray searchPatientByNameOrLabelOverdue(String doctor, String filter,
    public JSONArray searchPatientByNameOrLabelOverdue(String doctor, String filter,
                                                String labelCode, String labelType, long teamCode,
                                                String exLabelCode,
                                                String exLabelType,
                                                int page, int pagesize) throws Exception {
                                                       String labelCode, String labelType, long teamCode,
                                                       String exLabelCode,
                                                       String exLabelType,
                                                       int page, int pagesize) throws Exception {
        Doctor doc = doctorDao.findByCode(doctor);
        Doctor doc = doctorDao.findByCode(doctor);
        if (doc == null) {
        if (doc == null) {
@ -3741,11 +3740,11 @@ public class SignPatientLabelInfoService extends BaseService {
                sql = sql + ", wlyy_patient p ";
                sql = sql + ", wlyy_patient p ";
            }
            }
            sql = sql + " WHERE t2.label = ?";
            sql = sql + " WHERE t2.label = ?";
    
            if(StringUtils.isNotBlank(diseaseCondition)) {
            if(StringUtils.isNotBlank(diseaseCondition)) {
                sql = sql + " AND p.disease_condition = ? ";
                sql = sql + " AND p.disease_condition = ? ";
            }
            }
    
            sql = sql + "    AND t2.label_type = ? " +
            sql = sql + "    AND t2.label_type = ? " +
                    "    AND t2.status = 1 " +
                    "    AND t2.status = 1 " +
                    "    AND t1.patient = t2.patient " +
                    "    AND t1.patient = t2.patient " +
@ -3817,7 +3816,7 @@ public class SignPatientLabelInfoService extends BaseService {
        if (signList != null && signList.size() > 0) {
        if (signList != null && signList.size() > 0) {
            for (Map<String, Object> sign : signList) {
            for (Map<String, Object> sign : signList) {
            
//                Patient p = patientDao.findByCode(sign.get("patient") == null ? "" : sign.get("patient").toString());
//                Patient p = patientDao.findByCode(sign.get("patient") == null ? "" : sign.get("patient").toString());
//                if (p == null) {
//                if (p == null) {
//                    continue;
//                    continue;
@ -3830,7 +3829,7 @@ public class SignPatientLabelInfoService extends BaseService {
                            "  left join (select patient,group_concat(label) disease from wlyy_sign_patient_label_info where label_type = 3 AND status =1 " +
                            "  left join (select patient,group_concat(label) disease from wlyy_sign_patient_label_info where label_type = 3 AND status =1 " +
                            " and (label = 1 or label = 2) and patient = '"+sign.get("patient").toString()+"' GROUP BY patient) c on a.code = c.patient" +
                            " and (label = 1 or label = 2) and patient = '"+sign.get("patient").toString()+"' GROUP BY patient) c on a.code = c.patient" +
                            " where a.status =1 and a.code = '"+sign.get("patient").toString()+"'";
                            " where a.status =1 and a.code = '"+sign.get("patient").toString()+"'";
    
                    p = (PatientVO)jdbcTemplate.queryForObject(patientsql,new BeanPropertyRowMapper(PatientVO.class));
                    p = (PatientVO)jdbcTemplate.queryForObject(patientsql,new BeanPropertyRowMapper(PatientVO.class));
                }else{
                }else{
                    continue;
                    continue;
@ -3935,7 +3934,7 @@ public class SignPatientLabelInfoService extends BaseService {
                    json.put("expensesStatus", "1");
                    json.put("expensesStatus", "1");
                }
                }
                 //病情类型:0健康,1高血压,2糖尿病,(1,2)高血压+糖尿病
                //病情类型:0健康,1高血压,2糖尿病,(1,2)高血压+糖尿病
                json.put("disease",p.getDisease());
                json.put("disease",p.getDisease());
                // 病情:0绿标,1黄标,2红标,
                // 病情:0绿标,1黄标,2红标,
                json.put("diseaseCondition",p.getDiseaseCondition());
                json.put("diseaseCondition",p.getDiseaseCondition());
@ -3982,7 +3981,7 @@ public class SignPatientLabelInfoService extends BaseService {
                    //患者預警狀態
                    //患者預警狀態
                    int standardStatus1 = o1.has("standardStatus")?o1.getInt("standardStatus"):0;
                    int standardStatus1 = o1.has("standardStatus")?o1.getInt("standardStatus"):0;
                    int standardStatus2 = o2.has("standardStatus")?o2.getInt("standardStatus"):0;
                    int standardStatus2 = o2.has("standardStatus")?o2.getInt("standardStatus"):0;
    
                    //疾病种类
                    //疾病种类
                    int disease1 = 0;
                    int disease1 = 0;
                    if(o1.has("disease")){
                    if(o1.has("disease")){
@ -4268,7 +4267,7 @@ public class SignPatientLabelInfoService extends BaseService {
                            "  left join (select patient,group_concat(label) disease from wlyy_sign_patient_label_info where label_type = 3 and status=1 " +
                            "  left join (select patient,group_concat(label) disease from wlyy_sign_patient_label_info where label_type = 3 and status=1 " +
                            " and (label = 1 or label = 2) and patient = '"+sign.get("patient").toString()+"' GROUP BY patient) c on a.code = c.patient" +
                            " and (label = 1 or label = 2) and patient = '"+sign.get("patient").toString()+"' GROUP BY patient) c on a.code = c.patient" +
                            " where a.status =1 and a.code = '"+sign.get("patient").toString()+"'";
                            " where a.status =1 and a.code = '"+sign.get("patient").toString()+"'";
        
                    p = (PatientVO)jdbcTemplate.queryForObject(patientsql,new BeanPropertyRowMapper(PatientVO.class));
                    p = (PatientVO)jdbcTemplate.queryForObject(patientsql,new BeanPropertyRowMapper(PatientVO.class));
                }else{
                }else{
                    continue;
                    continue;
@ -4396,7 +4395,7 @@ public class SignPatientLabelInfoService extends BaseService {
                    json.put("expensesStatus", "1");
                    json.put("expensesStatus", "1");
                }
                }
                 //病情类型:0健康,1高血压,2糖尿病,(1,2)高血压+糖尿病
                //病情类型:0健康,1高血压,2糖尿病,(1,2)高血压+糖尿病
                json.put("disease",p.getDisease());
                json.put("disease",p.getDisease());
                // 病情:0绿标,1黄标,2红标,
                // 病情:0绿标,1黄标,2红标,
                json.put("diseaseCondition",p.getDiseaseCondition());
                json.put("diseaseCondition",p.getDiseaseCondition());
@ -4472,7 +4471,7 @@ public class SignPatientLabelInfoService extends BaseService {
                            "  left join (select patient,group_concat(label) disease from wlyy_sign_patient_label_info where label_type = 3 and status=1 " +
                            "  left join (select patient,group_concat(label) disease from wlyy_sign_patient_label_info where label_type = 3 and status=1 " +
                            " and (label = 1 or label = 2) and patient = '"+sign.get("patient").toString()+"' GROUP BY patient) c on a.code = c.patient" +
                            " and (label = 1 or label = 2) and patient = '"+sign.get("patient").toString()+"' GROUP BY patient) c on a.code = c.patient" +
                            " where a.status =1 and a.code = '"+sign.get("patient").toString()+"'";
                            " where a.status =1 and a.code = '"+sign.get("patient").toString()+"'";
        
                    p = (PatientVO)jdbcTemplate.queryForObject(patientsql,new BeanPropertyRowMapper(PatientVO.class));
                    p = (PatientVO)jdbcTemplate.queryForObject(patientsql,new BeanPropertyRowMapper(PatientVO.class));
                }else{
                }else{
                    continue;
                    continue;
@ -4583,7 +4582,7 @@ public class SignPatientLabelInfoService extends BaseService {
                    json.put("expensesStatus", "1");
                    json.put("expensesStatus", "1");
                }
                }
                 //病情类型:0健康,1高血压,2糖尿病,(1,2)高血压+糖尿病
                //病情类型:0健康,1高血压,2糖尿病,(1,2)高血压+糖尿病
                json.put("disease",p.getDisease());
                json.put("disease",p.getDisease());
                // 病情:0绿标,1黄标,2红标,
                // 病情:0绿标,1黄标,2红标,
                json.put("diseaseCondition",p.getDiseaseCondition());
                json.put("diseaseCondition",p.getDiseaseCondition());