Jelajahi Sumber

代码修改

LAPTOP-KB9HII50\70708 8 bulan lalu
induk
melakukan
1b9bddb9f4

+ 3 - 0
business/base-service/src/main/java/com/yihu/jw/device/dao/DevicePatientHealthIndexDao.java

@ -29,6 +29,9 @@ public interface DevicePatientHealthIndexDao
	@Query("select count(a) from DevicePatientHealthIndex a where a.recordDate >= ?1 and a.recordDate <= ?2 and a.type in (1,2) and a.status = ?3 and a.del = '1' and a.user = ?4")
	@Query("select count(a) from DevicePatientHealthIndex a where a.recordDate >= ?1 and a.recordDate <= ?2 and a.type in (1,2) and a.status = ?3 and a.del = '1' and a.user = ?4")
	int getCountByTimeAndStatus(Date start, Date end, int status, String patientCode);
	int getCountByTimeAndStatus(Date start, Date end, int status, String patientCode);
	@Query("select count(a) from DevicePatientHealthIndex a where a.recordDate >= ?1 and a.recordDate <= ?2 and a.type =?3 and a.status = ?4 and a.del = '1' and a.user = ?4")
	int getCountByTimeAndStatus(Date start, Date end, int status,int type, String patientCode);
	@Query(value= "SELECT DISTINCT\n" +
	@Query(value= "SELECT DISTINCT\n" +
			"	a.* \n" +
			"	a.* \n" +

+ 1 - 1
common/common-entity/src/main/java/com/yihu/jw/entity/base/patient/BasePatientDO.java

@ -193,7 +193,7 @@ public class BasePatientDO extends UuidIdentityEntityWithOperator {
    private String principalCode;
    private String principalCode;
    /**
    /**
     * 居民预警状态:0为标准,1为预警状态
     * 居民预警状态:0为标准,大于1为预警状态 1高血压预警 2糖尿病预警  3高血压糖尿病预警
     */
     */
    private Integer standardStatus;
    private Integer standardStatus;

+ 32 - 27
svr/svr-visit-behind/src/main/java/com/yihu/jw/hospital/module/health/service/DeviceUploadService.java

@ -186,41 +186,46 @@ public class DeviceUploadService {
                }
                }
            }
            }
            //连续3次异常,修改用户为预警状态
            if( (bloodPressureBbnormalCount >=3 || bloodSuggurBbnormalCount >=3)){
                patient.setStandardStatus(1);
//                setTrackPatientByDoctor(patientCode);
            }else{
                Date end = new Date();
                Date start = DateUtil.setDateTime(end,-7);
                //计算血糖或者血压一周内的异常记录数量
                int errorCount = patientHealthIndexDao.getCountByTimeAndStatus(start,end,1,patientCode);
                if(errorCount >= 5){//超过5次,记为预警状态
                    System.out.println("计算血糖或者血压一周内的异常记录数量-->超过5次,记为预警状态");
            //连续3次异常,修改用户为预警状态 ||计算血糖或者血压一周内的异常记录数量(超过5次,记为预警状态)
            Date end = new Date();
            Date start = DateUtil.setDateTime(end, -7);
            int errorCount1 = patientHealthIndexDao.getCountByTimeAndStatus(start, end, 1,2, patientCode);
            int errorCount2 = patientHealthIndexDao.getCountByTimeAndStatus(start, end, 1,1, patientCode);
            if (bloodPressureBbnormalCount >= 3 || errorCount1 >= 5) {
                if(patient.getStandardStatus()==0){
                    patient.setStandardStatus(1);
                    patient.setStandardStatus(1);
//                    setTrackPatientByDoctor(patientCode);
                }else {
                    System.out.println("计算血糖或者血压一周内的异常记录数量-->没有超过5次");
                }else if(patient.getStandardStatus()==2){
                    patient.setStandardStatus(3);
                }
            }
            if (bloodSuggurBbnormalCount >= 3 || errorCount2 >= 5) {
                if(patient.getStandardStatus()==0){
                    patient.setStandardStatus(2);
                }else if(patient.getStandardStatus()==1){
                    patient.setStandardStatus(3);
                }
                }
            }
            }
            System.out.println("patientdisease=>"+patientdisease+"  stdbloodPressureBbnormalCount=>"+stdbloodPressureBbnormalCount+"  bloodPressureBbnormalCount=>"+bloodPressureBbnormalCount);
            System.out.println("patientdisease=>"+patientdisease+"  stdbloodPressureBbnormalCount=>"+stdbloodPressureBbnormalCount+"  bloodPressureBbnormalCount=>"+bloodPressureBbnormalCount);
            //连续5次正常,修改用户为非预警状态
            //连续5次正常,修改用户为非预警状态
            if(StringUtils.isNotBlank(patientdisease)){
            if(StringUtils.isNotBlank(patientdisease)){
                if("1".equals(patientdisease)){
                    if(stdbloodPressureBbnormalCount==5&&0 == bloodPressureBbnormalCount){
                        patient.setStandardStatus(0);
//                        cancalTrackPatientByDoctor(patientCode);
                    }
                }else if("2".equals(patientdisease)){
                    if(stdbloodSuggurBbnormalCount==5&&0 == bloodSuggurBbnormalCount){
                        patient.setStandardStatus(0);
//                        cancalTrackPatientByDoctor(patientCode);
                if ("1".equals(patientdisease)||"3".equals(patientdisease)) {
                    if (stdbloodPressureBbnormalCount == 5) {
                        if(patient.getStandardStatus()==1){
                            patient.setStandardStatus(0);
                        }else if(patient.getStandardStatus()==3){
                            patient.setStandardStatus(2);
                        }
//                    cancalTrackPatientByDoctor(patientCode);
                    }
                    }
                }else if( "1,2".equals(patientdisease) || "2,1".equals(patientdisease)){
                    if(stdbloodSuggurBbnormalCount==5&&stdbloodPressureBbnormalCount==5&&0 == bloodSuggurBbnormalCount && 0 == bloodPressureBbnormalCount){
                        patient.setStandardStatus(0);
//                        cancalTrackPatientByDoctor(patientCode);
                }
                if ("2".equals(patientdisease)||"3".equals(patientdisease)) {
                    if (stdbloodSuggurBbnormalCount == 5 ) {
                        if(patient.getStandardStatus()==2){
                            patient.setStandardStatus(0);
                        }else if(patient.getStandardStatus()==3){
                            patient.setStandardStatus(1);
                        }
                    }
                    }
                }
                }
            }else{
            }else{

+ 31 - 23
svr/svr-visit-behind/src/main/java/com/yihu/jw/hospital/module/health/service/PatientHealthIndexService.java

@ -138,36 +138,44 @@ public class PatientHealthIndexService {
            }
            }
        }
        }
        //连续3次异常,修改用户为预警状态
        if ((bloodPressureBbnormalCount >= 3 || bloodSuggurBbnormalCount >= 3)) {
            p.setStandardStatus(1);
//            setTrackPatientByDoctor(patientCode);
        } else {
            Date end = new Date();
            Date start = DateUtil.setDateTime(end, -7);
            //计算血糖或者血压一周内的异常记录数量
            int errorCount = patientHealthIndexDao.getCountByTimeAndStatus(start, end, 1, patientCode);
            if (errorCount >= 5) {//超过5次,记为预警状态
        //连续3次异常,修改用户为预警状态 ||计算血糖或者血压一周内的异常记录数量(超过5次,记为预警状态)
        Date end = new Date();
        Date start = DateUtil.setDateTime(end, -7);
        int errorCount1 = patientHealthIndexDao.getCountByTimeAndStatus(start, end, 1,2, patientCode);
        int errorCount2 = patientHealthIndexDao.getCountByTimeAndStatus(start, end, 1,1, patientCode);
        if (bloodPressureBbnormalCount >= 3 || errorCount1 >= 5) {
            if(p.getStandardStatus()==0){
                p.setStandardStatus(1);
                p.setStandardStatus(1);
//                setTrackPatientByDoctor(patientCode);
            }else if(p.getStandardStatus()==2){
                p.setStandardStatus(3);
            }
        }
        if (bloodSuggurBbnormalCount >= 3 || errorCount2 >= 5) {
            if(p.getStandardStatus()==0){
                p.setStandardStatus(2);
            }else if(p.getStandardStatus()==1){
                p.setStandardStatus(3);
            }
            }
        }
        }
        //连续5次正常,修改用户为非预警状态
        //连续5次正常,修改用户为非预警状态
        if (StringUtils.isNotBlank(patientdisease)) {
        if (StringUtils.isNotBlank(patientdisease)) {
            if ("1".equals(patientdisease)) {
                if (stdbloodPressureBbnormalCount == 5 && 0 == bloodPressureBbnormalCount) {
                    p.setStandardStatus(0);
//                    cancalTrackPatientByDoctor(patientCode);
                }
            } else if ("2".equals(patientdisease)) {
                if (stdbloodSuggurBbnormalCount == 5 && 0 == bloodSuggurBbnormalCount) {
                    p.setStandardStatus(0);
            if ("1".equals(patientdisease)||"3".equals(patientdisease)) {
                if (stdbloodPressureBbnormalCount == 5) {
                    if(p.getStandardStatus()==1){
                        p.setStandardStatus(0);
                    }else if(p.getStandardStatus()==3){
                        p.setStandardStatus(2);
                    }
//                    cancalTrackPatientByDoctor(patientCode);
//                    cancalTrackPatientByDoctor(patientCode);
                }
                }
            } else if ("1,2".equals(patientdisease) || "2,1".equals(patientdisease)) {
                if (stdbloodPressureBbnormalCount == 5 && stdbloodSuggurBbnormalCount == 5 && 0 == bloodSuggurBbnormalCount && 0 == bloodPressureBbnormalCount) {
                    p.setStandardStatus(0);
//                    cancalTrackPatientByDoctor(patientCode);
            }
            if ("2".equals(patientdisease)||"3".equals(patientdisease)) {
                if (stdbloodSuggurBbnormalCount == 5 ) {
                    if(p.getStandardStatus()==2){
                        p.setStandardStatus(0);
                    }else if(p.getStandardStatus()==3){
                        p.setStandardStatus(1);
                    }
                }
                }
            }
            }
        } else {
        } else {

+ 7 - 70
svr/svr-visit-behind/src/main/java/com/yihu/jw/hospital/module/health/service/scheme/DoctorSchemeService.java

@ -611,18 +611,6 @@ public class DoctorSchemeService {
        patients = jdbcTemplate.query(patientsql, new BeanPropertyRowMapper(PatientVO.class));
        patients = jdbcTemplate.query(patientsql, new BeanPropertyRowMapper(PatientVO.class));
        JSONObject result = new JSONObject();
        JSONObject result = new JSONObject();
        JSONObject green = new JSONObject();//绿标
        JSONObject yellow = new JSONObject();//黄标
        JSONObject red = new JSONObject();//红标
        JSONObject pressure_standard = new JSONObject();//血压预警
        JSONObject sugar_standard = new JSONObject();//血糖预警
        JSONObject pressure_count = new JSONObject();//血压体征总数
        JSONObject pressure_unusual_ount = new JSONObject();//血压体征总数
        JSONObject sugar_count = new JSONObject();//血糖体征总数
        JSONObject sugar_unusual_count = new JSONObject();//血糖体征总数
        int count = patients.size();
        //绿标居民
        //绿标居民
        List<PatientVO> green_patients = new ArrayList<>();
        List<PatientVO> green_patients = new ArrayList<>();
        //黄标居民
        //黄标居民
@ -652,12 +640,13 @@ public class DoctorSchemeService {
                }
                }
                //获取预警居民CODES
                //获取预警居民CODES
                if (1 == getstands && (patient.getStandardStatus() != null && patient.getStandardStatus() == 1)) {
                    if (patient.getDisease() != null) {
                if (1 == getstands && patient.getStandardStatus() != null && patient.getDisease() != null) {
                    if(patient.getStandardStatus()==1||patient.getStandardStatus()==3){
                        if ("1".equals(patient.getDisease())|| "3".equals(patient.getDisease())  || "1,2".equals(patient.getDisease()) || "2,1".equals(patient.getDisease())) {
                        if ("1".equals(patient.getDisease())|| "3".equals(patient.getDisease())  || "1,2".equals(patient.getDisease()) || "2,1".equals(patient.getDisease())) {
                            bloodpressure_patientcodes.add(patient.getCode());
                            bloodpressure_patientcodes.add(patient.getCode());
                        }
                        }
                    }
                    if(patient.getStandardStatus()==2||patient.getStandardStatus()==3){
                        if ("2".equals(patient.getDisease())|| "3".equals(patient.getDisease())  || "1,2".equals(patient.getDisease()) || "2,1".equals(patient.getDisease())) {
                        if ("2".equals(patient.getDisease())|| "3".equals(patient.getDisease())  || "1,2".equals(patient.getDisease()) || "2,1".equals(patient.getDisease())) {
                            bloodsugar_patientcodes.add(patient.getCode());
                            bloodsugar_patientcodes.add(patient.getCode());
                        }
                        }
@ -679,7 +668,6 @@ public class DoctorSchemeService {
        if (1 == gethealthindex) {
        if (1 == gethealthindex) {
            Date start = DateUtil.strToDate(startdate);
            Date start = DateUtil.strToDate(startdate);
            Date end = DateUtil.strToDate(enddate);
            Date end = DateUtil.strToDate(enddate);
//            List<DevicePatientHealthIndex> devicePatientHealthIndices = devicePatientHealthIndexDao.findByTeamcodeAndRecordDate(start,end,teamCode,doctorcode);
            List<DevicePatientHealthIndex> devicePatientHealthIndices = devicePatientHealthIndexDao.findByDoctor(start, end, doctorcode);
            List<DevicePatientHealthIndex> devicePatientHealthIndices = devicePatientHealthIndexDao.findByDoctor(start, end, doctorcode);
            int sugar = 0;
            int sugar = 0;
@ -2262,57 +2250,6 @@ public class DoctorSchemeService {
        doctorSwitchDao.save(doctorSwitch);
        doctorSwitchDao.save(doctorSwitch);
    }
    }
    public JSONObject patientsByDoctorAndLabelCode(String labelCode, String doctorCode) {//1,2改变。
        StringBuilder sqlLabelStr = new StringBuilder();
        sqlLabelStr.append(" sp.label in ('").append(labelCode.replace(",", "','")).append("') ");
        List<PatientVO> patients = new ArrayList<>();
        String patientsql = "select * from (select p.code,p.standard_status,p.disease_condition,group_concat(DISTINCT sp.label order by sp.label asc ) as disease from wlyy_patient p " +
                "  LEFT JOIN wlyy_sign_family s on s.patient = p.code " +
                "  RIGHT JOIN wlyy_sign_patient_label_info sp on sp.patient = p.code and sp.label_type = 3 and " + sqlLabelStr.toString() + " and sp.status =1" +
                " WHERE s.status > 0 and (s.doctor = '" + doctorCode + "' or s.doctor_health ='" + doctorCode + "') GROUP BY p.code " +
                "order by sp.label asc)tmp where tmp.disease='" + labelCode + "'";
        patients = jdbcTemplate.query(patientsql, new BeanPropertyRowMapper(PatientVO.class));
        JSONObject result = new JSONObject();
        //绿标居民
        List<PatientVO> green_patients = new ArrayList<>();
        //黄标居民
        List<PatientVO> yellow_patients = new ArrayList<>();
        //红标居民
        List<PatientVO> red_patients = new ArrayList<>();
        if (!patients.isEmpty()) {
            for (PatientVO patient : patients) {
                //获取居民颜色标签
                if (patient.getDiseaseCondition() != null) {
                    switch (patient.getDiseaseCondition()) {
                        case 0:
                            green_patients.add(patient);
                            break;
                        case 1:
                            yellow_patients.add(patient);
                            break;
                        case 2:
                            red_patients.add(patient);
                            break;
                    }
                }
            }
        }
        result.put("greencount", green_patients.size());
        result.put("yellowcount", yellow_patients.size());
        result.put("redcount", red_patients.size());
        // 重点关注居民
        List<TrackPatient> list = trackPatientDao.findByDoctorCodeAndDel(doctorCode, "1");
        if (list != null && list.size() > 0) {
            result.put("trackPatientCount", list.size());
        } else {
            result.put("trackPatientCount", 0);
        }
        return result;
    }
    public String getCode() {
    public String getCode() {
        return UUID.randomUUID().toString().replaceAll("-", "");
        return UUID.randomUUID().toString().replaceAll("-", "");
    }
    }
@ -2322,7 +2259,7 @@ public class DoctorSchemeService {
    /**
    /**
     * 获取红黄绿标高血压糖尿病的指标人数
     * 获取红黄绿标高血压糖尿病的指标人数
     * disease 1高血压,2糖尿病,3高血压+糖尿病
     * disease 1高血压,2糖尿病,3高血压+糖尿病
     * 预警数量   a.standard_status='1'
     * 预警数量   a.standard_status>1
     *
     *
     * @return
     * @return
     */
     */
@ -2334,7 +2271,7 @@ public class DoctorSchemeService {
                "INNER join wlyy_patient_label l on l.patient=a.id AND l.label_type='2' " +
                "INNER join wlyy_patient_label l on l.patient=a.id AND l.label_type='2' " +
                "left join wlyy_track_patient t on t.doctor_code='"+doctorId+"' and t.patient_code=a.id AND t.del='1' " +
                "left join wlyy_track_patient t on t.doctor_code='"+doctorId+"' and t.patient_code=a.id AND t.del='1' " +
                "WHERE 1=1\n" +
                "WHERE 1=1\n" +
                "AND a.standard_status='1'\n" +
                "AND a.standard_status>0 " +
                "and l.label_name='高血压' " +
                "and l.label_name='高血压' " +
                "AND b.doctor ='" + doctorId + "'";
                "AND b.doctor ='" + doctorId + "'";
        // 高血压
        // 高血压
@ -2354,7 +2291,7 @@ public class DoctorSchemeService {
                "INNER join wlyy_patient_label l on l.patient=a.id AND l.label_type='2' " +
                "INNER join wlyy_patient_label l on l.patient=a.id AND l.label_type='2' " +
                "left join wlyy_track_patient t on t.doctor_code='"+doctorId+"' and t.patient_code=a.id AND t.del='1' " +
                "left join wlyy_track_patient t on t.doctor_code='"+doctorId+"' and t.patient_code=a.id AND t.del='1' " +
                "WHERE 1=1\n" +
                "WHERE 1=1\n" +
                "AND a.standard_status='1'\n" +
                "AND a.standard_status>0 " +
                "and l.label_name='糖尿病' " +
                "and l.label_name='糖尿病' " +
                "AND b.doctor ='" + doctorId + "'";
                "AND b.doctor ='" + doctorId + "'";
        // 糖尿病
        // 糖尿病