Pārlūkot izejas kodu

体征设备重复数据排除

zd_123 6 gadi atpakaļ
vecāks
revīzija
ba8d2442c2

+ 3 - 0
patient-co-service/wlyy_device/src/main/java/com/yihu/hos/device/common/dao/PatientHealthIndexDao.java

@ -64,5 +64,8 @@ public interface PatientHealthIndexDao
	@Query("select a from PatientHealthIndex a where a.user = ?1 and a.deviceSn = ?2 and a.value1 = ?3 and a.type = ?4 and a.recordDate >= ?5 and a.recordDate<=?6 and a.del = '1' ")
	List<PatientHealthIndex> findByTypeInHalfMinute(String patient, String deviceSn, String value1, Integer type, Date minDate,Date maxDate);
	@Query("select a from PatientHealthIndex a where a.user = ?1 and a.deviceSn = ?2 and a.value1 = ?3 and a.value2=?7 and a.value3=?8 and a.type = ?4 and a.recordDate >= ?5 and a.recordDate<=?6 and a.del = '1' ")
	List<PatientHealthIndex> findByTypeInHalfMinuteAllValue(String patient, String deviceSn, String value1, Integer type, Date minDate,Date maxDate,String value2,String value3);
}

+ 17 - 0
patient-co-service/wlyy_device/src/main/java/com/yihu/hos/device/common/util/DateUtil.java

@ -1599,4 +1599,21 @@ public class DateUtil {
        SimpleDateFormat formatter = new SimpleDateFormat(DEFAULT_DATE_YMD_FORMAT);
        return formatter.format(currentTime);
    }
    /**
     * 时间前推或后推天数(负数前推正数后推)
     * date 基准时间
     */
    public static java.util.Date getPreDays(java.util.Date date, int days) {
        java.util.Date day = null;
        try {
            Calendar c = Calendar.getInstance();
            c.setTime(date);
            c.add(Calendar.DATE, days);
            day = c.getTime();
        } catch (Exception e) {
        }
        return day;
    }
}

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

@ -487,18 +487,25 @@ public class DeviceService extends BaseService{
        if (device!=null) {
            /************设备数据重复推送处理 start**********************/
            String value1 = data;
            String value2="";
            String value3="";
            if("2".equals(type)){
                String[] value = data.split(",");
                if (value.length > 0) {
                    value1 = value[0];     //收缩压
                    value2 = value[1];
                    value3 = value[2];
                }
            }
            if (value1.equals(value2) && value2.equals(value3)){
                return null;
            }
//            List<PatientHealthIndex> list = patientHealthIndexDao.findByType(device.getUser(),deviceSn,value1,Integer.parseInt(type),time);
            long maxtime = time.getTime()+30*1000;
            long mintime = time.getTime()-30*1000;
            Date minDate = new Date(mintime);
            Date maxDate = new Date(maxtime);
            List<PatientHealthIndex> list = iotDeviceService.findByType(device.getUser(),deviceSn,value1,Integer.parseInt(type),time,minDate,maxDate);
            /*long maxtime = time.getTime()+30*1000;
            long mintime = time.getTime()-30*1000;*/
            Date minDate = DateUtil.getPreDays(time,-3);
            Date maxDate = DateUtil.getPreDays(time,3);
            List<PatientHealthIndex> list = iotDeviceService.findByType(device.getUser(),deviceSn,value1,value2,value3,Integer.parseInt(type),time,minDate,maxDate);
            if(list!=null&&list.size()>0){
                DeviceInfo deviceInfo = new DeviceInfo();
                deviceInfo.setDeviceData(json.toString());

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

@ -130,12 +130,18 @@ public class IotDeviceService extends BaseService{
     * @param time
     * @return
     */
    public List<PatientHealthIndex> findByType(String user,String deviceSn,String value1,Integer type,Date time,Date timeMin,Date timeMax){
    public List<PatientHealthIndex> findByType(String user,String deviceSn,String value1,String value2,String value3,Integer type,Date time,Date timeMin,Date timeMax){
        if(isUploadIot()){
            return findRepeat(user,deviceSn,value1,type,time);
        }else {
            //return  patientHealthIndexDao.findByType(user,deviceSn,value1,type,time);
            return  patientHealthIndexDao.findByTypeInHalfMinute(user,deviceSn,value1,type,timeMin,timeMax);
            List<PatientHealthIndex> list = new ArrayList<>();
            if (type==1){
                list =  patientHealthIndexDao.findByTypeInHalfMinute(user,deviceSn,value1,type,timeMin,timeMax);
            }else if (type==2){
                list = patientHealthIndexDao.findByTypeInHalfMinuteAllValue(user,deviceSn,value1,type,timeMin,timeMax,value2,value3);
            }
            return list;
        }
    }

+ 1 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/imm/ChildFamilyImmuneService.java

@ -189,7 +189,7 @@ public class ChildFamilyImmuneService extends BaseService {
	 * @param barcode
	 * @return
	 */
	public List<ChildImmuneVaccin> getChildImmuneVaccinByBarcode(String barcode){
	public List<ChildImmuneVaccin> getChildImmuneVaccinByBarcode(String barcode)throws Exception{
		return childImmuneVaccinDao.getChildImmuneVaccinByBarcodeAndYmsx(barcode);
	}