瀏覽代碼

居民列表

lyr 8 年之前
父節點
當前提交
9b6becf15e

+ 3 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/health/PatientHealthGuidanceService.java

@ -47,6 +47,9 @@ public class PatientHealthGuidanceService extends BaseService {
			Patient p = patientDao.findByCode(guidance.getPatient());
			obj.put("doctorName",doc.getName());
			obj.put("photo",doc.getPhoto());
			obj.put("name",doc.getName());
			obj.put("level",doc.getLevel());
			obj.put("patientName",p.getName());
			obj.put("czrq",guidance.getCzrq()!= null ? DateUtil.dateToStr(guidance.getCzrq(),DateUtil.YYYY_MM_DD_HH_MM) :"");
			return obj;

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

@ -181,7 +181,7 @@ public class SignPatientLabelInfoService extends BaseService {
            sql = "select * " +
                    " from " +
                    "     wlyy_sign_family " +
                    " where " + (doc.getLevel() == 2 ? " doctor" : "doctor_health") + " = ? and status > 0 and admin_team_code = ? ";
                    " where repdoctor = ? and status > 0 and admin_team_code = ? ";
            if (labelCode.equals("1")) {
                int week = today.get(Calendar.DAY_OF_WEEK) - 2;
@ -204,7 +204,7 @@ public class SignPatientLabelInfoService extends BaseService {
                throw new Exception("label is not exist");
            }
            args = new Object[]{doctor, teamCode};
            args = new Object[]{doctor, teamCode,doctor, teamCode};
        } else {
            if (labelCode.equals("0")) {
                sql = "SELECT " +
@ -213,16 +213,16 @@ public class SignPatientLabelInfoService extends BaseService {
                        "    wlyy_sign_family t1 " +
                        " left join " +
                        "    (select patient,label,label_type from wlyy_sign_patient_label_info where patient in " +
                        "    (select patient from wlyy_sign_family where " + (doc.getLevel() == 2 ? "doctor" : "doctor_health") + "='" + doctor + "' and status > 0) " +
                        "    (select patient from wlyy_sign_family where repdoctor ='" + doctor + "' and status > 0) " +
                        "     and label_type = ? and status = 1) t2 " +
                        " on t1.patient = t2.patient " +
                        " WHERE " +
                        "    t2.patient is null " +
                        "    AND t1." + (doc.getLevel() == 2 ? "doctor" : "doctor_health") + " = ? " +
                        "    AND t1.repdoctor = ? " +
                        "    AND t1.status > 0 " +
                        "    AND t1.admin_team_code = ? limit " + start + "," + pagesize;
                        "    AND t1.admin_team_code = ? ";
                args = new Object[]{labelType, doctor, teamCode};
                args = new Object[]{labelType, doctor, teamCode,labelType, doctor, teamCode};
            } else {
                sql = "SELECT " +
                        "    t1.* " +
@ -230,19 +230,24 @@ public class SignPatientLabelInfoService extends BaseService {
                        "    wlyy_sign_family t1, " +
                        "    wlyy_sign_patient_label_info t2 " +
                        " WHERE " +
                        "     t2.patient in (select patient from wlyy_sign_family where " + (doc.getLevel() == 2 ? "doctor" : "doctor_health") + " = '" + doctor + "' and status > 0 ) " +
                        "     t2.patient in (select patient from wlyy_sign_family where repdoctor = '" + doctor + "' and status > 0 ) " +
                        "    AND t2.label = ? " +
                        "    AND t2.label_type = ? " +
                        "    AND t2.status = 1 " +
                        "    AND t1.patient = t2.patient " +
                        "    AND t1." + (doc.getLevel() == 2 ? "doctor" : "doctor_health") + " = ? " +
                        "    AND t1.repdoctor = ? " +
                        "    AND t1.status > 0 " +
                        "    AND t1.admin_team_code = ? limit " + start + "," + pagesize;
                        "    AND t1.admin_team_code = ? ";
                args = new Object[]{labelCode, labelType, doctor, teamCode};
                args = new Object[]{labelCode, labelType, doctor, teamCode,labelCode, labelType, doctor, teamCode};
            }
        }
        String sqlDoc = sql.replaceAll("repdoctor","doctor");
        String sqlDocHealth = sql.replaceAll("repdoctor","doctor_health").replaceAll("t1","t3").replace("t2","t4");
        sql = "select t.* from (" + sqlDoc + " union all " + sqlDocHealth + ") t limit " + start + "," + pagesize;
        signList = jdbcTemplate.queryForList(sql, args);
        if (signList != null && signList.size() > 0) {
@ -366,12 +371,13 @@ public class SignPatientLabelInfoService extends BaseService {
        Object[] args = null;
        sql = " select * from wlyy_sign_family where " +
                (doc.getLevel() == 2 ? " doctor" : "doctor_health") +
                " = ? and status > 0 and admin_team_code = ? " +
                " limit " + start + "," + pagesize;
                " repdoctor = ? and status > 0 and admin_team_code = ? ";
        args = new Object[]{doctor, teamCode};
        String sqlDoc = sql.replaceAll("repdoctor","doctor");
        String sqlDocHealth = sql.replaceAll("repdoctor","doctor_health");
        args = new Object[]{doctor, teamCode,doctor, teamCode};
        sql = "select t.* from (" + sqlDoc + " union all " + sqlDocHealth + ") t limit " + start + "," + pagesize;
        signList = jdbcTemplate.queryForList(sql, args);
        if (signList != null && signList.size() > 0) {
@ -529,10 +535,10 @@ public class SignPatientLabelInfoService extends BaseService {
                    Calendar today = Calendar.getInstance();
                    Calendar startDate = Calendar.getInstance();
                    SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
                    sql = "select count(DISTINCT patient) count" +
                    sql = "select *" +
                            " from " +
                            "     wlyy_sign_family " +
                            " where " + (doc.getLevel() == 2 ? " doctor" : "doctor_health") + " = ? and status > 0 " +
                            " where repdoctor = ? and status > 0 " +
                            (teamCode > 0 ? " and admin_team_code = ? " : "");
                    if (label.getLabelCode().equals("1")) {
@ -555,56 +561,61 @@ public class SignPatientLabelInfoService extends BaseService {
                        throw new Exception("label is not exist");
                    }
                    if (teamCode > 0) {
                        args = new Object[]{doctor, teamCode};
                        args = new Object[]{doctor, teamCode,doctor, teamCode};
                    } else {
                        args = new Object[]{doctor};
                        args = new Object[]{doctor,doctor};
                    }
                } else {
                    if (label.getLabelCode().equals("0")) {
                        sql = " SELECT " +
                                "     count(DISTINCT t1.patient) count " +
                                "     t1.* " +
                                " FROM" +
                                "     wlyy_sign_family t1 " +
                                " left join " +
                                "    (SELECT patient,label,label_type from wlyy_sign_patient_label_info where patient in " +
                                "    (select patient from wlyy_sign_family where " + (doc.getLevel() == 2 ? "doctor" : "doctor_health") + " = '" + doctor + "' and status > 0) " +
                                "    (select patient from wlyy_sign_family where repdoctor = '" + doctor + "' and status > 0) " +
                                "    and label_type = ? and status = 1)  t2 " +
                                " on t1.patient = t2.patient " +
                                " WHERE" +
                                "     t2.patient is null " +
                                "     AND t1." + (doc.getLevel() == 2 ? "doctor" : "doctor_health") + " = ? " +
                                "     AND t1.repdoctor = ? " +
                                "     AND t1.status > 0 " +
                                (teamCode > 0 ? "    AND t1.admin_team_code = ? " : "");
                        if (teamCode > 0) {
                            args = new Object[]{labelType, doctor, teamCode};
                            args = new Object[]{labelType, doctor, teamCode,labelType, doctor, teamCode};
                        } else {
                            args = new Object[]{labelType, doctor};
                            args = new Object[]{labelType, doctor,labelType, doctor};
                        }
                    } else {
                        sql = " SELECT " +
                                "     count(DISTINCT t1.patient) count " +
                                "     t1.* " +
                                " FROM" +
                                "     wlyy_sign_family t1, " +
                                "     wlyy_sign_patient_label_info t2 " +
                                " WHERE" +
                                "     t1.patient = t2.patient " +
                                "     AND t2.patient in (select patient from wlyy_sign_family where " + (doc.getLevel() == 2 ? "doctor" : "doctor_health") + " = '" + doctor + "' and status > 0) " +
                                "     AND t2.patient in (select patient from wlyy_sign_family where repdoctor = '" + doctor + "' and status > 0) " +
                                "     AND t2.label = ? " +
                                "     AND t2.label_type = ? " +
                                "     AND t2.status = 1 " +
                                "     AND t1." + (doc.getLevel() == 2 ? "doctor" : "doctor_health") + " = ? " +
                                "     AND t1.repdoctor = ? " +
                                "     AND t1.status > 0 " +
                                (teamCode > 0 ? "    AND t1.admin_team_code = ? " : "");
                        if (teamCode > 0) {
                            args = new Object[]{label.getLabelCode(), labelType, doctor, teamCode};
                            args = new Object[]{label.getLabelCode(), labelType, doctor, teamCode,label.getLabelCode(), labelType, doctor, teamCode};
                        } else {
                            args = new Object[]{label.getLabelCode(), labelType, doctor};
                            args = new Object[]{label.getLabelCode(), labelType, doctor,label.getLabelCode(), labelType, doctor};
                        }
                    }
                }
                String sqlDoc = sql.replaceAll("repdoctor","doctor");
                String sqlDocHealth = sql.replaceAll("repdoctor","doctor_health").replaceAll("t1","t3").replaceAll("t2","t4");
                sql = "select count(DISTINCT t.patient) count from (" + sqlDoc + " union all " + sqlDocHealth + ") t";
                List<Map<String, Object>> count = jdbcTemplate.queryForList(sql, args);
                if (count != null && count.size() > 0 && count.get(0).containsKey("count")) {
@ -830,26 +841,28 @@ public class SignPatientLabelInfoService extends BaseService {
                (StringUtils.isNotEmpty(labelCode) || StringUtils.isNotEmpty(labelType) ?
                        " join " : " left join ") +
                "    (select patient,label,label_name,label_type from wlyy_sign_patient_label_info  where patient in" +
                "    (select patient from wlyy_sign_family where " + (doc.getLevel() == 2 ? "doctor" : "doctor_health") + " = '" + doctor + "' and status > 0) " +
                "    (select patient from wlyy_sign_family where repdoctor = '" + doctor + "' and status > 0) " +
                "     and status = 1 " +
                (StringUtils.isNotEmpty(labelCode) ? " AND label = ? " : "") +
                (StringUtils.isNotEmpty(labelType) ? " AND label_type = ? " : "") + ") t2" +
                " ON t1.patient = t2.patient " +
                " WHERE " +
                "    t1." + (doc.getLevel() == 2 ? "doctor" : "doctor_health") + " = ? " +
                "    t1.repdoctor = ? " +
                "    AND t1.status > 0 " +
                (teamCode > 0 ? (" AND admin_team_code = " + teamCode) : "") +
                "    AND (t1.name like ? OR t2.label_name like ?) " +
                " limit " + page + "," + pagesize;
                "    AND (t1.name like ? OR t2.label_name like ?) ";
        if (StringUtils.isNotEmpty(labelCode)) {
            args = new Object[]{labelCode, labelType, doctor, "%" + filter + "%", "%" + filter + "%"};
            args = new Object[]{labelCode, labelType, doctor, "%" + filter + "%", "%" + filter + "%",labelCode, labelType, doctor, "%" + filter + "%", "%" + filter + "%"};
        } else if (StringUtils.isEmpty(labelCode) && StringUtils.isNotEmpty(labelType)) {
            args = new Object[]{labelType, doctor, "%" + filter + "%", "%" + filter + "%"};
            args = new Object[]{labelType, doctor, "%" + filter + "%", "%" + filter + "%",labelType, doctor, "%" + filter + "%", "%" + filter + "%"};
        } else {
            args = new Object[]{doctor, "%" + filter + "%", "%" + filter + "%"};
            args = new Object[]{doctor, "%" + filter + "%", "%" + filter + "%",doctor, "%" + filter + "%", "%" + filter + "%"};
        }
        String sqlDoc = sql.replaceAll("repdoctor","doctor");
        String sqlDocHealth = sql.replaceAll("repdoctor","doctor_health").replaceAll("t1","t3").replaceAll("t2","t4");
        sql = "select t.* from (" + sqlDoc + " union all " + sqlDocHealth + ") t limit " + page + "," + pagesize;
        signList = jdbcTemplate.queryForList(sql, args);
        if (signList != null && signList.size() > 0) {