Quellcode durchsuchen

慢病管理相关接口BUG修改

huangwenjie vor 7 Jahren
Ursprung
Commit
c5422a940a

+ 8 - 4
patient-co-service/wlyy_device/src/main/java/com/yihu/hos/device/service/DeviceService.java

@ -388,6 +388,10 @@ public class DeviceService {
                //患者信息
                String patientCode = result.getUser();
                Patient patient = patientDao.findByCode(patientCode);
    
                String patientsql = "select group_concat(label) disease from wlyy.wlyy_sign_patient_label_info where label_type = 3 and status=1 and (label = 1 or label = 2) and patient = '"+patient.getCode()+"' GROUP BY patient";
    
                String patientdisease = jdbcTemplate.queryForObject(patientsql,String.class);
                
                //血糖、血压数据需校验,如果超标,需要发送消息给医生
                if (1 == deviceType || 2 == deviceType) {
@ -443,16 +447,16 @@ public class DeviceService {
                }
                //连续5次正常,修改用户为非预警状态
                if(patient.getDisease() != null){
                    if( 1 == patient.getDisease()){
                if(StringUtils.isNotBlank(patientdisease)){
                    if("1".equals(patientdisease)){
                        if(0 == bloodPressureBbnormalCount && (patient.getStandardStatus() == null || 1 == patient.getStandardStatus())){
                            patient.setStandardStatus(0);
                        }
                    }else if(2 == patient.getDisease()){
                    }else if("2".equals(patientdisease)){
                        if(0 == bloodSuggurBbnormalCount && (patient.getStandardStatus() == null || 1 == patient.getStandardStatus())){
                            patient.setStandardStatus(0);
                        }
                    }else if( 3 == patient.getDisease()){
                    }else if( "1,2".equals(patientdisease) || "2,1".equals(patientdisease)){
                        if( 0 == bloodSuggurBbnormalCount && 0 == bloodPressureBbnormalCount && (patient.getStandardStatus() == null || 1 == patient.getStandardStatus())){
                            patient.setStandardStatus(0);
                        }

+ 1 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/health/repository/DevicePatientHealthIndexDao.java

@ -98,7 +98,7 @@ public interface DevicePatientHealthIndexDao
	@Query(value = "select DATE_FORMAT(a.record_date,'%Y-%m-%d') from device.wlyy_patient_health_index a where a.user = ?1 and a.record_date >= ?2 and a.record_date <= ?3 and a.del = '1' group by DATE_FORMAT(a.record_date,'%Y-%m-%d') order by DATE_FORMAT(a.record_date,'%Y-%m-%d') desc limit ?4 ,?5",nativeQuery = true)
	List<String> findDateList(String patient,Date start ,Date end,int currentSize,int pageSize);
	@Query(value= " select * from device.wlyy_patient_health_index where type in (1,2) and record_date BETWEEN ?1 AND ?2  AND user in (select p.code from wlyy.wlyy_patient p INNER JOIN wlyy.wlyy_sign_family s on s.patient = p.code and s.status > 0 AND s.admin_team_code = ?3 and p.disease >0 and (s.doctor = ?4 or s.doctor_health =?4))",nativeQuery = true)
	@Query(value= " select * from device.wlyy_patient_health_index where type in (1,2) and record_date BETWEEN ?1 AND ?2  AND user in (select p.code from wlyy.wlyy_patient p INNER JOIN wlyy.wlyy_sign_family s on s.patient = p.code RIGHT JOIN wlyy.wlyy_sign_patient_label_info sp on sp.patient = p.code where  s.status > 0 AND s.admin_team_code = ?3 and (s.doctor = ?4 or s.doctor_health =?4) and sp.status = 1 and sp.label_type = 3 and (sp.label = 1 or sp.label = 2))",nativeQuery = true)
	List<DevicePatientHealthIndex> findByTeamcodeAndRecordDate(Date start, Date end,String teamcode,String doctorcode);
	@Query(value="select * from device.wlyy_patient_health_index where user = ?1 and type = ?2 ORDER BY record_date desc limit 0 ,5",nativeQuery = true)

+ 19 - 12
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/health/PatientHealthIndexService.java

@ -12,6 +12,7 @@ import com.yihu.wlyy.entity.patient.Patient;
import com.yihu.wlyy.entity.patient.PatientAimSports;
import com.yihu.wlyy.entity.patient.PatientHealthStandard;
import com.yihu.wlyy.entity.patient.SignFamily;
import com.yihu.wlyy.entity.patient.vo.PatientVO;
import com.yihu.wlyy.health.repository.DevicePatientHealthIndexDao;
import com.yihu.wlyy.repository.consult.ConsultTeamDao;
import com.yihu.wlyy.repository.doctor.DoctorDao;
@ -36,6 +37,7 @@ import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Sort;
import org.springframework.data.domain.Sort.Direction;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
@ -955,7 +957,12 @@ public class PatientHealthIndexService extends BaseService {
        //连续5次体征值正常,则修改为非预警状态;连续5次异常,修改为预警状态-----START
        String patientCode = obj.getUser();
        //患者信息
        Patient patient = patientDao.findByCode(patientCode);
        Patient p = patientDao.findByCode(patientCode);
    
        PatientVO patient = new PatientVO();
        String patientsql = "select 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 = '"+p.getCode()+"' GROUP BY patient";
        
        String patientdisease = jdbcTemplate.queryForObject(patientsql,String.class);
        int bloodPressureBbnormalCount = 0;//血压异常次数
        int bloodSuggurBbnormalCount = 0;//血糖异常次数
@ -981,37 +988,37 @@ public class PatientHealthIndexService extends BaseService {
        //连续3次异常,修改用户为预警状态
        if ((bloodPressureBbnormalCount >= 3 || bloodSuggurBbnormalCount >= 3) && (patient.getStandardStatus() == null || 0 == patient.getStandardStatus())) {
            patient.setStandardStatus(1);
            p.setStandardStatus(1);
        } else {
            Date end = new Date();
            Date start = DateUtil.setDateTime(end, -7);
            //计算血糖或者血压一周内的异常记录数量
            int errorCount = patientHealthIndexDao.getCountByTimeAndStatus(start, end, 1, patientCode);
            if (errorCount >= 5) {//超过5次,记为预警状态
                patient.setStandardStatus(1);
                p.setStandardStatus(1);
            }
        }
        //连续5次正常,修改用户为非预警状态
        if (patient.getDisease() != null) {
            if (1 == patient.getDisease()) {
        if (StringUtils.isNotBlank(patientdisease)) {
            if ("1".equals(patientdisease)) {
                if (0 == bloodPressureBbnormalCount && (patient.getStandardStatus() == null || 1 == patient.getStandardStatus())) {
                    patient.setStandardStatus(0);
                    p.setStandardStatus(0);
                }
            } else if (2 == patient.getDisease()) {
            } else if ("2".equals(patientdisease)) {
                if (0 == bloodSuggurBbnormalCount && (patient.getStandardStatus() == null || 1 == patient.getStandardStatus())) {
                    patient.setStandardStatus(0);
                    p.setStandardStatus(0);
                }
            } else if (3 == patient.getDisease()) {
            } else if ("1,2".equals(patientdisease) || "2,1".equals(patientdisease)) {
                if (0 == bloodSuggurBbnormalCount && 0 == bloodPressureBbnormalCount && (patient.getStandardStatus() == null || 1 == patient.getStandardStatus())) {
                    patient.setStandardStatus(0);
                    p.setStandardStatus(0);
                }
            }
        } else {
            patient.setStandardStatus(0);
            p.setStandardStatus(0);
        }
        patientDao.save(patient);
        patientDao.save(p);
        //连续5次体征值正常,则修改为非预警状态;连续5次异常,修改为预警状态-----END
    }

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

@ -1099,10 +1099,9 @@ public class SignPatientLabelInfoService extends BaseService {
                    if("1".equals(label.getLabelCode()) ||  "2".equals(label.getLabelCode())){
                        sql = " SELECT " +
                                "     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" +
                                "     t1.patient = t2.patient " +
                                "     AND t1.patient = t3.code "+

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

@ -396,7 +396,7 @@ public class DoctorSchemeService {
//        List<Patient> patients = patientDao.findAllSignPatientTeamcode(teamCode,doctorcode);
    
        List<PatientVO> patients = new ArrayList<>();
        String patientsql = "select p.*,b.deviceType as deviceType,group_concat(sp.label) diseaseType from wlyy_patient p " +
        String patientsql = "select p.*,b.deviceType as deviceType,group_concat(sp.label) 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 (sp.label = 1 or sp.label = 2) and sp.status =1" +
                "  LEFT JOIN (select user,sum(category_code) deviceType FROM wlyy_patient_device GROUP BY user) b on p.code = b.user " +
@ -462,7 +462,7 @@ public class DoctorSchemeService {
                            bloodpressure_patientcodes.add(patient.getCode());
                        }
                        if( "2" == patient.getDisease() || "1,2".equals(patient.getDisease()) || "2,1".equals(patient.getDisease())){
                        if( "2".equals(patient.getDisease()) || "1,2".equals(patient.getDisease()) || "2,1".equals(patient.getDisease())){
                            bloodsugar_patientcodes.add(patient.getCode());
                        }
                    }