liubing 3 éve
szülő
commit
784806dfba

+ 4 - 1
common/common-entity/sql记录

@ -1294,4 +1294,7 @@ CREATE TABLE base_patient_out_bed (
  `status` varchar(50) DEFAULT NULL COMMENT '在床状态0离床1在床',
  `status` varchar(50) DEFAULT NULL COMMENT '在床状态0离床1在床',
  `create_time` timestamp NULL DEFAULT NULL COMMENT '创建日期 即起床时间',
  `create_time` timestamp NULL DEFAULT NULL COMMENT '创建日期 即起床时间',
  PRIMARY KEY (`id`)
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='患者离床时间';
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='患者离床时间';
-- 20210819
alter table wlyy_devices add COLUMN device_type TINYINT(2) default null COMMENT '设备种类 0健康设备 1安防设备';
alter table wlyy_patient_device add COLUMN device_type TINYINT(2) default null COMMENT '设备种类 0健康设备 1安防设备';

+ 9 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/care/device/DevicePatientHealthIndex.java

@ -51,6 +51,7 @@ public class DevicePatientHealthIndex extends IdEntity {
	//设备编号
	//设备编号
	private String deviceSn;
	private String deviceSn;
	private Integer manageResult;//0未干预 1异常有效干预 2异常无效干预
	private Integer status;//状态:0为标准,1为异常
	private Integer status;//状态:0为标准,1为异常
	private String name;//居民姓名
	private String name;//居民姓名
	private String hospital;//医院
	private String hospital;//医院
@ -195,6 +196,14 @@ public class DevicePatientHealthIndex extends IdEntity {
		this.deviceSn = deviceSn;
		this.deviceSn = deviceSn;
	}
	}
	public Integer getManageResult() {
		return manageResult;
	}
	public void setManageResult(Integer manageResult) {
		this.manageResult = manageResult;
	}
	public Integer getStatus() {
	public Integer getStatus() {
		return status;
		return status;
	}
	}

+ 4 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/config/AqgConfig.java

@ -48,6 +48,10 @@ public class AqgConfig {
     */
     */
    public static final String  sleepDevice_info=baseUrl+"/api/sleepdevice/";
    public static final String  sleepDevice_info=baseUrl+"/api/sleepdevice/";
    /**
     * X1定位数据  即轨迹
     */
    public static final String X1_locations = baseUrl+"/api/locationdata/";
    public static final String username = "13559485270";
    public static final String username = "13559485270";
    public static final String password = "zjxl@2021";
    public static final String password = "zjxl@2021";

+ 4 - 1
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/dao/device/DevicePatientHealthIndexDao.java

@ -3,6 +3,7 @@ package com.yihu.jw.care.dao.device;
import com.yihu.jw.entity.care.device.DevicePatientHealthIndex;
import com.yihu.jw.entity.care.device.DevicePatientHealthIndex;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.data.repository.PagingAndSortingRepository;
@ -73,5 +74,7 @@ public interface DevicePatientHealthIndexDao
	@Query("select a from DevicePatientHealthIndex 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' ")
	@Query("select a from DevicePatientHealthIndex 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<DevicePatientHealthIndex> findByTypeInHalfMinuteAllValue(String patient, String deviceSn, String value1, Integer type, Date minDate,Date maxDate,String value2,String value3);
	List<DevicePatientHealthIndex> findByTypeInHalfMinuteAllValue(String patient, String deviceSn, String value1, Integer type, Date minDate,Date maxDate,String value2,String value3);
	@Modifying
	@Query("update DevicePatientHealthIndex a set a.manageResult=1 where a.id in (?1) ")
	void handleHealthIndex(Long[] id);
}
}

+ 31 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/device/DoctorHealthController.java

@ -314,4 +314,35 @@ public class DoctorHealthController extends BaseController {
			return errorResult(e);
			return errorResult(e);
		}
		}
	}
	}
	@RequestMapping(value = "getErrorHealthIndexPatients",method = RequestMethod.GET)
	@ApiOperation("获取签约医生底下未干预异常体征患者")
	public String getErrorHealthIndexPatients(@ApiParam(name="doctor")@RequestParam(value = "doctor")String doctor) {
		try {
			return write(200, "查询成功", "data", healthIndexService.getErrorHealthIndexPatients(doctor));
		} catch (Exception e) {
			return errorResult(e);
		}
	}
	@RequestMapping(value = "getErrorHealthIndexByPatients",method = RequestMethod.GET)
	@ApiOperation("获取患者未干预异常体征列表")
	public String getErrorHealthIndexByPatients(@ApiParam(name="patient")@RequestParam(value = "patient")String patient) {
		try {
			return write(200, "查询成功", "data", healthIndexService.getErrorHealthIndexByPatients(patient));
		} catch (Exception e) {
			return errorResult(e);
		}
	}
	@RequestMapping(value = "handleHealthIndex",method = RequestMethod.POST)
	@ApiOperation("医生体征干预")
	public String handleHealthIndex(@ApiParam(name="ids")@RequestParam(value = "ids")Long[] ids) {
		try {
			healthIndexService.handleHealthIndex(ids);
			return write(200, "处理成功");
		} catch (Exception e) {
			return errorResult(e);
		}
	}
}
}

+ 1 - 1
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/message/DoctorMessageEndpoint.java

@ -24,7 +24,7 @@ public class DoctorMessageEndpoint extends EnvelopRestEndpoint {
    @GetMapping(value = "messages")
    @GetMapping(value = "messages")
    @ApiOperation("应用消息")
    @ApiOperation("应用消息")
    public ObjEnvelop messages(@ApiParam(name = "type", value = "消息类型 10床位申请,11安全监护,12紧急救助")
    public ObjEnvelop messages(@ApiParam(name = "type", value = "消息类型 10床位申请,11安全监护,12紧急救助,13体征异常消息")
                               @RequestParam(value = "type", required = false) String type,
                               @RequestParam(value = "type", required = false) String type,
                               @ApiParam(name = "doctor", value = "doctor")
                               @ApiParam(name = "doctor", value = "doctor")
                               @RequestParam(value = "doctor", required = false) String doctor){
                               @RequestParam(value = "doctor", required = false) String doctor){

+ 2 - 5
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/birthday/BirthdayWishesService.java

@ -403,7 +403,7 @@ public class BirthdayWishesService {
        SimpleDateFormat f = new SimpleDateFormat("yyyy-MM-dd");
        SimpleDateFormat f = new SimpleDateFormat("yyyy-MM-dd");
        String createTime = f.format(new Date())+" 00:00:00";
        String createTime = f.format(new Date())+" 00:00:00";
        //医生今日推送的居民
        //医生今日推送的居民
        List<BirthDayWishesToPatient> sendPatientList = findSendPatientByCreateTime(p.toString(),createTime);
        List<BirthDayWishesToPatient> sendPatientList = findSendPatientByCreateTime(createTime);
        Set<String> sendPatient = sendPatientList.stream().map(BirthDayWishesToPatient::getPatientCode).collect(Collectors.toSet());
        Set<String> sendPatient = sendPatientList.stream().map(BirthDayWishesToPatient::getPatientCode).collect(Collectors.toSet());
        Set<String> openidSet = new HashSet<>();
        Set<String> openidSet = new HashSet<>();
@ -501,13 +501,10 @@ public class BirthdayWishesService {
     * @param
     * @param
     * @return
     * @return
     */
     */
    public List<BirthDayWishesToPatient> findSendPatientByCreateTime(String patient,String createTime) {
    public List<BirthDayWishesToPatient> findSendPatientByCreateTime(String createTime) {
        StringBuffer sql = new StringBuffer("select patient_code patientCode from  birthday_wishes_to_patient  "+
        StringBuffer sql = new StringBuffer("select patient_code patientCode from  birthday_wishes_to_patient  "+
                " where user_type=1 and create_time>'" + createTime + "' ");
                " where user_type=1 and create_time>'" + createTime + "' ");
        if (StringUtils.isNotBlank(patient)){
            sql.append(" and patient_code in ( "+patient+" ) ") ;
        }
        sql.append(" limit 0,500000 ");
        sql.append(" limit 0,500000 ");
        List<BirthDayWishesToPatient> patientList = jdbcTemplate.query(sql.toString(),new BeanPropertyRowMapper<>(BirthDayWishesToPatient.class));
        List<BirthDayWishesToPatient> patientList = jdbcTemplate.query(sql.toString(),new BeanPropertyRowMapper<>(BirthDayWishesToPatient.class));
        return patientList;
        return patientList;

+ 25 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/device/PatientHealthIndexService.java

@ -10,6 +10,7 @@ import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.care.device.DeviceDetail;
import com.yihu.jw.entity.care.device.DeviceDetail;
import com.yihu.jw.entity.care.device.DevicePatientHealthIndex;
import com.yihu.jw.entity.care.device.DevicePatientHealthIndex;
import com.yihu.jw.entity.care.device.DevicePatientDevice;
import com.yihu.jw.entity.care.device.DevicePatientDevice;
import com.yihu.jw.entity.patient.Patient;
import com.yihu.jw.message.dao.MessageDao;
import com.yihu.jw.message.dao.MessageDao;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.util.date.DateUtil;
@ -1604,4 +1605,28 @@ public class PatientHealthIndexService extends BaseJpaService<DevicePatientHealt
    public DevicePatientHealthIndex getHealthIndexById(Long id) {
    public DevicePatientHealthIndex getHealthIndexById(Long id) {
        return patientHealthIndexDao.findOne(id);
        return patientHealthIndexDao.findOne(id);
    }
    }
    public List<Map<String,Object>> getErrorHealthIndexPatients(String doctor){
        String sql = " select count(id),patient,photo,mobile,record_date from (\n" +
                "select idx.id,p.id patient,p.photo,idx.record_date,p.mobile from wlyy_patient_health_index idx,base_patient p " +
                "where  idx.user = p.id and  status=1 and (manage_result=0 or manage_result is null)  and EXISTS ( " +
                " SELECT 1 from base_service_package_sign_record sr,base_service_package_record r ,base_team_member m where " +
                "idx.user = CONVERT(sr.patient USING utf8) and  sr.id = r.sign_id and sr.status=1 and   m.team_code = r.team_code  " +
                " and sr.`status`=1  and m.doctor_code = '"+doctor+"' and m.del = '1') order by idx.record_date " +
                " desc)A GROUP BY A.patient order by record_date desc ";
        List<Map<String,Object>> result = jdbcTemplate.queryForList(sql);
        return result;
    }
    public List<Map<String,Object>> getErrorHealthIndexByPatients(String patient){
        String sql = " select * from  wlyy_patient_health_index where user='"+patient+"' and  " +
                "status=1 and (manage_result=0 or manage_result is null) ";
        List<Map<String,Object>> result = jdbcTemplate.queryForList(sql);
        return result;
    }
    @Transactional
    public void handleHealthIndex(Long[] id){
        patientHealthIndexDao.handleHealthIndex(id);
    }
}
}

+ 2 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/lifeCare/LifeCareOrderService.java

@ -790,6 +790,8 @@ public class LifeCareOrderService extends BaseJpaService<LifeCareOrderDO, LifeCa
        //3 已签到
        //3 已签到
        lifeCareOrderDO.setStatus(3);
        lifeCareOrderDO.setStatus(3);
        BaseDoctorDO doctorDO = doctorDao.findById(doctorId);
        BaseDoctorDO doctorDO = doctorDao.findById(doctorId);
        lifeCareOrderDO.setDoctor(doctorId);
        lifeCareOrderDO.setDoctorName(doctorDO.getName());
        lifeCareOrderDO.setSignDoctor(doctorId);
        lifeCareOrderDO.setSignDoctor(doctorId);
        lifeCareOrderDO.setSignDoctorName(doctorDO.getName());
        lifeCareOrderDO.setSignDoctorName(doctorDO.getName());
        lifeCareOrderDO.setUpdateTime(new Date());
        lifeCareOrderDO.setUpdateTime(new Date());

+ 12 - 2
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/message/DoctorMessageService.java

@ -49,7 +49,7 @@ public class DoctorMessageService {
    /**
    /**
     *
     *
     * @param doctor
     * @param doctor
     * @param type  11床位申请,11安全监护 ,12紧急救助
     * @param type  11床位申请,11安全监护 ,12紧急救助,13体征异常消息
     * @return
     * @return
     */
     */
    public JSONObject findDoctorAllMessage(String doctor,String type){
    public JSONObject findDoctorAllMessage(String doctor,String type){
@ -92,7 +92,7 @@ public class DoctorMessageService {
            List<Map<String,Object>> listTmp = new ArrayList<>();
            List<Map<String,Object>> listTmp = new ArrayList<>();
            String sql ="select count(*) count,patient_name,DATE_FORMAT(create_time,'%Y-%m-%d %H:%i:%S') create_time,serve_desc from base_security_monitoring_order ord where 1=1 " +
            String sql ="select count(*) count,patient_name,DATE_FORMAT(create_time,'%Y-%m-%d %H:%i:%S') create_time,serve_desc from base_security_monitoring_order ord where 1=1 " +
                    "and status <>-1 and status<> 0  ";
                    "and status <>-1 and status<> 0  ";
            sql+= "and  EXISTS ( SELECT 1 from base_service_package_sign_record sr,base_service_package_record r" +
            sql+= "and  EXISTS ( SELECT 1 from base_service_package_sign_record sr,base_service_package_record r," +
                    "base_team_member m " +
                    "base_team_member m " +
                    "where ord.patient = CONVERT(sr.patient USING utf8) and  sr.id = r.sign_id and sr.status=1 and " +
                    "where ord.patient = CONVERT(sr.patient USING utf8) and  sr.id = r.sign_id and sr.status=1 and " +
                    "  m.team_code = r.team_code   and sr.`status`=1  and m.doctor_code = '"+doctor+"' and m.del = '1') ";
                    "  m.team_code = r.team_code   and sr.`status`=1  and m.doctor_code = '"+doctor+"' and m.del = '1') ";
@ -134,6 +134,16 @@ public class DoctorMessageService {
            }
            }
            result.put("assistance",tmpJson);
            result.put("assistance",tmpJson);
        }
        }
        if (typeNull||type.equals("13")){//居民体征异常消息
            JSONObject tmpJson = new JSONObject();
            count=0;
            String sql = " select count(idx.id) from wlyy_patient_health_index idx where status=1 and (manage_result=0 or manage_result is null) " +
                    "and  EXISTS ( SELECT 1 from base_service_package_sign_record sr,base_service_package_record r ,base_team_member m " +
                    " where idx.user = CONVERT(sr.patient USING utf8) and  sr.id = r.sign_id and sr.status=1 and m.team_code = r.team_code " +
                    "  and sr.`status`=1  and m.doctor_code = '"+doctor+"' and m.del = '1')  order by idx.record_date desc   ";
            count = jdbcTemplate.queryForObject(sql,Integer.class);
            result.put("errorHealthIndex",count);
        }
        return result;
        return result;
    }
    }

+ 12 - 13
svr/svr-cloud-device/src/main/java/com/yihu/jw/care/service/DeviceService.java

@ -361,13 +361,9 @@ public class DeviceService {
                    patientHealthIndex.setRecordDate(recordDate);
                    patientHealthIndex.setRecordDate(recordDate);
                    patientHealthIndex.setSortDate(recordDate);
                    patientHealthIndex.setSortDate(recordDate);
                    patientHealthIndex.setCzrq(new Date());
                    patientHealthIndex.setCzrq(new Date());
                    if (heartrate >= theshold_heartrate_h || heartrate <= theshold_heartrate_l) {
                        patientHealthIndex.setStatus(1);
                    } else {
                        patientHealthIndex.setStatus(0);
                    }
                    patientHealthIndex.setStatus(0);
                    patientHealthIndex.setDel("1");
                    patientHealthIndex.setDel("1");
                    healthIndexDao.save(patientHealthIndex);
                    SystemMessageDO messageDO = new SystemMessageDO();
                    SystemMessageDO messageDO = new SystemMessageDO();
                    String typeName = "您有新的心率测量记录。心率:" + patientHealthIndex.getValue1() + "次/min";
                    String typeName = "您有新的心率测量记录。心率:" + patientHealthIndex.getValue1() + "次/min";
@ -397,6 +393,9 @@ public class DeviceService {
                    String content_notice = null;
                    String content_notice = null;
                    for (int i=0;i<errorIndex.size();i++){
                    for (int i=0;i<errorIndex.size();i++){
                        com.alibaba.fastjson.JSONObject tmp = errorIndex.getJSONObject(i);
                        com.alibaba.fastjson.JSONObject tmp = errorIndex.getJSONObject(i);
                        if (0!=tmp.getInteger("error")){
                            patientHealthIndex.setStatus(1);
                        }
                        if (1 == tmp.getInteger("error")){
                        if (1 == tmp.getInteger("error")){
                            content_notice += tmp.getString("indexName")+"、";
                            content_notice += tmp.getString("indexName")+"、";
                        }
                        }
@ -406,6 +405,7 @@ public class DeviceService {
                        message.put("content_notice","您的key1过高,请注意饮食,尽量食用少油少盐食物".replace("key1",content_notice));
                        message.put("content_notice","您的key1过高,请注意饮食,尽量食用少油少盐食物".replace("key1",content_notice));
                        messageDO.setContent("您的key1过高,请注意饮食,尽量食用少油少盐食物".replace("key1",content_notice));
                        messageDO.setContent("您的key1过高,请注意饮食,尽量食用少油少盐食物".replace("key1",content_notice));
                    }
                    }
                    healthIndexDao.save(patientHealthIndex);
                    systemMessageDao.save(messageDO);
                    systemMessageDao.save(messageDO);
                    imUtil.sendPatientSystemMessage(messageDO.getReceiver(),JSON.toJSONString(message,SerializerFeature.WriteMapNullValue));
                    imUtil.sendPatientSystemMessage(messageDO.getReceiver(),JSON.toJSONString(message,SerializerFeature.WriteMapNullValue));
@ -445,14 +445,8 @@ public class DeviceService {
                    patientHealthIndex.setRecordDate(recordDate);
                    patientHealthIndex.setRecordDate(recordDate);
                    patientHealthIndex.setSortDate(recordDate);
                    patientHealthIndex.setSortDate(recordDate);
                    patientHealthIndex.setCzrq(new Date());
                    patientHealthIndex.setCzrq(new Date());
                    if (sbp>=sbp_h||dbp<=dbp_l){
                        patientHealthIndex.setStatus(1);
                    }
                    else {
                        patientHealthIndex.setStatus(0);
                    }
                    patientHealthIndex.setStatus(0);
                    patientHealthIndex.setDel("1");
                    patientHealthIndex.setDel("1");
                    healthIndexDao.save(patientHealthIndex);
                    SystemMessageDO messageDO = new SystemMessageDO();
                    SystemMessageDO messageDO = new SystemMessageDO();
                    String typeName = "您有新的血压测量记录:收缩压:"+patientHealthIndex.getValue1()+"mmHg,收缩压:"
                    String typeName = "您有新的血压测量记录:收缩压:"+patientHealthIndex.getValue1()+"mmHg,收缩压:"
@ -481,6 +475,9 @@ public class DeviceService {
                    String content_notice = "";
                    String content_notice = "";
                    for (int i=0;i<errorIndex.size();i++){
                    for (int i=0;i<errorIndex.size();i++){
                        com.alibaba.fastjson.JSONObject tmp = errorIndex.getJSONObject(i);
                        com.alibaba.fastjson.JSONObject tmp = errorIndex.getJSONObject(i);
                        if (0!=tmp.getInteger("error")){
                            patientHealthIndex.setStatus(1);
                        }
                        if (1 == tmp.getInteger("error")){
                        if (1 == tmp.getInteger("error")){
                            content_notice += tmp.getString("indexName")+"、";
                            content_notice += tmp.getString("indexName")+"、";
                        }
                        }
@ -490,6 +487,8 @@ public class DeviceService {
                        message.put("content_notice","您的key1过高,请注意饮食,尽量食用少油少盐食物".replace("key1",content_notice));
                        message.put("content_notice","您的key1过高,请注意饮食,尽量食用少油少盐食物".replace("key1",content_notice));
                        messageDO.setContent("您的key1过高,请注意饮食,尽量食用少油少盐食物".replace("key1",content_notice));
                        messageDO.setContent("您的key1过高,请注意饮食,尽量食用少油少盐食物".replace("key1",content_notice));
                    }
                    }
                    healthIndexDao.save(patientHealthIndex);
                    systemMessageDao.save(messageDO);
                    systemMessageDao.save(messageDO);
                    imUtil.sendPatientSystemMessage(messageDO.getReceiver(),JSON.toJSONString(message,SerializerFeature.WriteMapNullValue));
                    imUtil.sendPatientSystemMessage(messageDO.getReceiver(),JSON.toJSONString(message,SerializerFeature.WriteMapNullValue));
                }
                }

+ 5 - 2
svr/svr-cloud-device/src/main/java/com/yihu/jw/care/service/DeviceUploadService.java

@ -160,6 +160,9 @@ public class DeviceUploadService {
                    String content_notice = "";
                    String content_notice = "";
                    for (int i=0;i<errorIndex.size();i++){
                    for (int i=0;i<errorIndex.size();i++){
                        com.alibaba.fastjson.JSONObject tmp = errorIndex.getJSONObject(i);
                        com.alibaba.fastjson.JSONObject tmp = errorIndex.getJSONObject(i);
                        if (0!=tmp.getInteger("error")){
                            result.setStatus(1);
                        }
                        if (1 == tmp.getInteger("error")){
                        if (1 == tmp.getInteger("error")){
                            content_notice += tmp.getString("indexName")+"、";
                            content_notice += tmp.getString("indexName")+"、";
                        }
                        }
@ -169,6 +172,7 @@ public class DeviceUploadService {
                        message.put("content_notice","您的key1过高,请注意饮食,尽量食用少油少盐食物".replace("key1",content_notice));
                        message.put("content_notice","您的key1过高,请注意饮食,尽量食用少油少盐食物".replace("key1",content_notice));
                        messageDO.setContent("您的key1过高,请注意饮食,尽量食用少油少盐食物".replace("key1",content_notice));
                        messageDO.setContent("您的key1过高,请注意饮食,尽量食用少油少盐食物".replace("key1",content_notice));
                    }
                    }
                    patientHealthIndexDao.save(result);
                    systemMessageDao.save(messageDO);
                    systemMessageDao.save(messageDO);
                    imUtil.sendPatientSystemMessage(messageDO.getReceiver(),JSON.toJSONString(message,SerializerFeature.WriteMapNullValue));
                    imUtil.sendPatientSystemMessage(messageDO.getReceiver(),JSON.toJSONString(message,SerializerFeature.WriteMapNullValue));
                }
                }
@ -206,7 +210,7 @@ public class DeviceUploadService {
        List<DeviceDetail> deviceDetails = deviceDetailDao.findByDeviceCode(deviceSn);
        List<DeviceDetail> deviceDetails = deviceDetailDao.findByDeviceCode(deviceSn);
        if (deviceDetails != null || deviceDetails.size()!=0){
        if (deviceDetails != null || deviceDetails.size()!=0){
            deviceDetail = deviceDetails.get(0);
            deviceDetail = deviceDetails.get(0);
            if (deviceDetail.getGrantOrgCode() != null&& deviceDetail.getGrantOrgCode().equals("3502050300")){
            if (deviceDetail.getGrantOrgCode() != null&& deviceDetail.getGrantOrgCode().equals("3502050300")){//
                List<DevicePatientDevice> patientDeviceList =  patientDeviceDao.findByDeviceSnAndCategoryCode(deviceSn, type);
                List<DevicePatientDevice> patientDeviceList =  patientDeviceDao.findByDeviceSnAndCategoryCode(deviceSn, type);
                if (patientDeviceList != null&&patientDeviceList.size()==1) {
                if (patientDeviceList != null&&patientDeviceList.size()==1) {
                    device = patientDeviceList.get(0);
                    device = patientDeviceList.get(0);
@ -329,7 +333,6 @@ public class DeviceUploadService {
                obj.setHospitalName(deviceDetail.getOrgName());
                obj.setHospitalName(deviceDetail.getOrgName());
            }
            }
//            obj = patientHealthIndexDao.save(obj);
            obj = patientHealthIndexDao.save(obj);
            obj = patientHealthIndexDao.save(obj);
            return obj;
            return obj;
        }
        }