Sfoglia il codice sorgente

慢病管理相关接口BUG修改

huangwenjie 7 anni fa
parent
commit
e7dc7fba09

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

@ -384,24 +384,24 @@ public class DeviceService {
            if (result == null) {
                throw new Exception("This device is not relate patient!");
            } else {
    
                //患者信息
                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) {
                    verifyHealthIndex(result);
                    //发送华三demo推送
	
	            //患者信息
	            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) {
		            verifyHealthIndex(result);
		            //发送华三demo推送
//                    messagePush(result);
                    
                    //判断是否有未结束的续方咨询,发送消息给对应的医生----huangwenjie--2017.11.06
                    sendPrescriptionHealthIndexMsgresult(result,patient);
                }
		
		            //判断是否有未结束的续方咨询,发送消息给对应的医生----huangwenjie--2017.11.06
		            sendPrescriptionHealthIndexMsgresult(result,patient);
	            }
                //指标数据上传基卫
                uploadHealthIndex(result);
@ -447,16 +447,16 @@ public class DeviceService {
                }
                //连续5次正常,修改用户为非预警状态
                if(StringUtils.isNotBlank(patientdisease)){
                    if("1".equals(patientdisease)){
                if(patient.getDisease() != null){
                    if( 1 == patient.getDisease()){
                        if(0 == bloodPressureBbnormalCount && (patient.getStandardStatus() == null || 1 == patient.getStandardStatus())){
                            patient.setStandardStatus(0);
                        }
                    }else if("2".equals(patientdisease)){
                    }else if(2 == patient.getDisease()){
                        if(0 == bloodSuggurBbnormalCount && (patient.getStandardStatus() == null || 1 == patient.getStandardStatus())){
                            patient.setStandardStatus(0);
                        }
                    }else if( "1,2".equals(patientdisease) || "2,1".equals(patientdisease)){
                    }else if( 3 == patient.getDisease()){
                        if( 0 == bloodSuggurBbnormalCount && 0 == bloodPressureBbnormalCount && (patient.getStandardStatus() == null || 1 == patient.getStandardStatus())){
                            patient.setStandardStatus(0);
                        }

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

@ -37,7 +37,6 @@ 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;
@ -956,13 +955,13 @@ public class PatientHealthIndexService extends BaseService {
    public void handlePatientStandarStatus(DevicePatientHealthIndex obj) {
        //连续5次体征值正常,则修改为非预警状态;连续5次异常,修改为预警状态-----START
        String patientCode = obj.getUser();
        //患者信息
        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);
	    //患者信息
	    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;//血糖异常次数
@ -984,42 +983,42 @@ public class PatientHealthIndexService extends BaseService {
                bloodSuggurBbnormalCount++;
            }
        }
        //连续3次异常,修改用户为预警状态
        if ((bloodPressureBbnormalCount >= 3 || bloodSuggurBbnormalCount >= 3) && (patient.getStandardStatus() == null || 0 == patient.getStandardStatus())) {
            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次,记为预警状态
                p.setStandardStatus(1);
            }
        }
        //连续5次正常,修改用户为非预警状态
        if (StringUtils.isNotBlank(patientdisease)) {
            if ("1".equals(patientdisease)) {
                if (0 == bloodPressureBbnormalCount && (patient.getStandardStatus() == null || 1 == patient.getStandardStatus())) {
                    p.setStandardStatus(0);
                }
            } else if ("2".equals(patientdisease)) {
                if (0 == bloodSuggurBbnormalCount && (patient.getStandardStatus() == null || 1 == patient.getStandardStatus())) {
                    p.setStandardStatus(0);
                }
            } else if ("1,2".equals(patientdisease) || "2,1".equals(patientdisease)) {
                if (0 == bloodSuggurBbnormalCount && 0 == bloodPressureBbnormalCount && (patient.getStandardStatus() == null || 1 == patient.getStandardStatus())) {
                    p.setStandardStatus(0);
                }
            }
        } else {
            p.setStandardStatus(0);
        }
        patientDao.save(p);
        //连续5次体征值正常,则修改为非预警状态;连续5次异常,修改为预警状态-----END
	
	
	    //连续3次异常,修改用户为预警状态
	    if ((bloodPressureBbnormalCount >= 3 || bloodSuggurBbnormalCount >= 3) && (patient.getStandardStatus() == null || 0 == patient.getStandardStatus())) {
		    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次,记为预警状态
			    p.setStandardStatus(1);
		    }
	    }
	
	    //连续5次正常,修改用户为非预警状态
	    if (StringUtils.isNotBlank(patientdisease)) {
		    if ("1".equals(patientdisease)) {
			    if (0 == bloodPressureBbnormalCount && (patient.getStandardStatus() == null || 1 == patient.getStandardStatus())) {
				    p.setStandardStatus(0);
			    }
		    } else if ("2".equals(patientdisease)) {
			    if (0 == bloodSuggurBbnormalCount && (patient.getStandardStatus() == null || 1 == patient.getStandardStatus())) {
				    p.setStandardStatus(0);
			    }
		    } else if ("1,2".equals(patientdisease) || "2,1".equals(patientdisease)) {
			    if (0 == bloodSuggurBbnormalCount && 0 == bloodPressureBbnormalCount && (patient.getStandardStatus() == null || 1 == patient.getStandardStatus())) {
				    p.setStandardStatus(0);
			    }
		    }
	    } else {
		    p.setStandardStatus(0);
	    }
	
	    patientDao.save(p);
	    //连续5次体征值正常,则修改为非预警状态;连续5次异常,修改为预警状态-----END
    }

+ 3 - 9
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/call/CustomerService.java

@ -9,6 +9,7 @@ import com.yihu.wlyy.repository.call.CallServiceDao;
import com.yihu.wlyy.repository.message.MessageDao;
import com.yihu.wlyy.repository.patient.PatientDao;
import com.yihu.wlyy.service.BaseService;
import com.yihu.wlyy.util.DateUtil;
import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
@ -151,14 +152,7 @@ public class CustomerService extends BaseService{
	}
	/**
	 *     private Integer dealReason; // 处理取消原因:0.没有号源、1.病人取消
	 private String orderHospital; //预约医院code
	 private String orderHospitalName; //预约医院
	 private String orderDept; //预约科室code
	 private String orderDeptName; //预约科室名称
	 private String orderDoctor; //预约医生code
	 private String orderDoctorName; //预约医生名称
	 private String orderTime; //预约时间段
	 *
	 * @param type
	 * @param orderHospital
     * @return
@ -176,7 +170,7 @@ public class CustomerService extends BaseService{
			cs.setOrderHospitalName(orderHospitalName);
			cs.setOrderTime(orderTime);
			cs.setDealTime(new Date());
			cs.setRegisterTime(new Date());
			cs.setRegisterTime(DateUtil.stringToDate(registerTime,"yyyy-MM-dd HH:mm:ss"));
			cs.setDealState(1);
		//预约失败
		}else{