Jelajahi Sumber

Merge branch 'dev' of liubing/wlyy2.0 into dev

liubing 3 tahun lalu
induk
melakukan
fd41b4cdcf

+ 1 - 1
common/common-entity/src/main/java/com/yihu/jw/entity/care/device/BaseSleepNightRecord.java

@ -16,7 +16,7 @@ public class BaseSleepNightRecord extends IdEntity {
    private String patient ;
    private String deviceSn;
    private String outTime;//离床时长 秒
    private Integer status;//是否回床 0否,1是
    private Integer status;//是否回床 -1否 0否,1是
    private String day;//监控日期
    private Date createTime;// 创建日期 即起床时间
    private Date updateTime;// 更新日期

+ 4 - 4
common/common-entity/src/main/java/com/yihu/jw/entity/care/device/BaseSleepPlanDetail.java

@ -18,13 +18,13 @@ public class BaseSleepPlanDetail extends IdEntity {
    private String  patient;
    private String  deviceSn;
    private String  day; //睡眠监控日期
    private Integer  upStatus; //起床状态 0未起床 1起床
    private Integer  upStatus; //起床状态 0起床 1未起床
    private Date  upTime; //起床时间
    private Integer  siestaStatus; //午睡状态 0未入床 1已入床
    private Integer  siestaStatus; //午睡状态 0未上床 1已上床
    private Date  siestaTimeBegin; //午睡开始时间
    private Date  siestaTimeEnd;  //午睡结束时间
    private String  siestaLong; //午睡时长 单位秒
    private Integer  inStatus; //睡觉状态 0未入床 1已入床,2无午睡计划
    private Integer  inStatus; //睡觉状态 0未上床 1已上床
    private Date  inTimeBegin; //夜眠开始时间
    private Date  inTimeEnd; //夜眠结束时间
    private Date createTime;
@ -32,7 +32,7 @@ public class BaseSleepPlanDetail extends IdEntity {
    private List<BaseSleepNightRecord> sleepNightRecordList;
    private String heartRate;
    private String breath;
    private Integer bedStatus;
    private Integer bedStatus; //0未在床 1在床
    public String getPatient() {
        return patient;

+ 4 - 2
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/device/PatientDeviceController.java

@ -410,10 +410,12 @@ public class PatientDeviceController extends BaseController {
    public String getPatientDeviceDetail(@ApiParam(name="patient")
                                         @RequestParam(value = "patient")String patient,
                                         @ApiParam(name="deviceSN")
                                         @RequestParam(value = "deviceSN")String deviceSn){
                                         @RequestParam(value = "deviceSN")String deviceSn,
                                         @ApiParam(name="day",value = "yyyy-mm-dd")
                                         @RequestParam(value = "day",required = false)String day){
        try {
            JSONObject result = patientDeviceService.getPatientDeviceDetail(patient,deviceSn);
            JSONObject result = patientDeviceService.getPatientDeviceDetail(patient,deviceSn,day);
            if (result.getInt(ResponseContant.resultFlag)==ResponseContant.success){
                return write(200,"获取成功","data", JSON.parseObject(result.getString(ResponseContant.resultMsg)));
            }else {

+ 1 - 1
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/sign/SignEndpoint.java

@ -178,7 +178,7 @@ public class SignEndpoint extends EnvelopRestEndpoint {
    }
    @GetMapping(value = "servicePackageByTopicType")
    @ApiOperation(value = "根据服务专题获取服务项目")
    @ApiOperation(value = "根据服务专题获取服务项目--存在绑定设备的专题")
    public ObjEnvelop servicePackageByTopicType (
            @ApiParam(name = "patient", value = "patient", required = true)
            @RequestParam(value = "patient") String patient,

+ 7 - 4
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/device/PatientDeviceService.java

@ -880,7 +880,7 @@ public class PatientDeviceService extends BaseJpaService<DevicePatientDevice, Pa
     * @param deviceSn 设备sn码
     * @return
     */
    public JSONObject getPatientDeviceDetail(String patient,String deviceSn) throws Exception {
    public JSONObject getPatientDeviceDetail(String patient,String deviceSn,String day) throws Exception {
        JSONObject result = new JSONObject();
        BasePatientDO patientDO = patientDao.findById(patient);
        if (null==patientDO){
@ -931,12 +931,15 @@ public class PatientDeviceService extends BaseJpaService<DevicePatientDevice, Pa
                        }
                        break;
                    case "13"://睡眠带 获取当天睡眠详情
                        securityMonitoringOrderService.preventOutOfBed(devInfoObj,patient,false);
                        securityMonitoringOrderService.preventOutOfBed(devInfoObj,patient,false,day);
                        break;
                    case "14"://气感报警器 当天监测记录以及最新浓度
                        List<Map<String,Object>> listTmp = gasConcentration(patient,DateUtil.getStringDateShort());
                        if (StringUtils.isBlank(day)){
                            day = DateUtil.getStringDateShort();
                        }
                        List<Map<String,Object>> listTmp = gasConcentration(patient,day);
                        devInfoObj.put("monitorInfo",listTmp);
                        devInfoObj.put("day",DateUtil.getStringDateShort());
                        devInfoObj.put("day",day);
                        securityMonitoringOrderService.preventGasLeakage(devInfoObj,patient,false);
                        break;
                    case "15"://烟感报警器 获取最新浓度

+ 7 - 5
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/security/SecurityMonitoringOrderService.java

@ -460,14 +460,14 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
                if (StringUtils.isBlank(doc.getDoctorLat()) || StringUtils.isBlank(doc.getDoctorLon())) {
                    continue;
                }
                double distanceTmp = countDistance.getDistance(Double.parseDouble(orderDO.getServeLat()),Double.parseDouble(orderDO.getServeLon()),Double.parseDouble(doc.getDoctorLat()),Double.parseDouble(doc.getDoctorLon()));
                //double distanceTmp = countDistance.getDistance(Double.parseDouble(orderDO.getServeLat()),Double.parseDouble(orderDO.getServeLon()),Double.parseDouble(doc.getDoctorLat()),Double.parseDouble(doc.getDoctorLon()));
                otherDoctorDistanceObj = new JSONObject();
                otherDoctorDistanceObj.put("doctor",doc.getId());
                otherDoctorDistanceObj.put("doctorName",doc.getName());
                otherDoctorDistanceObj.put("doctorAddress",doc.getDoctorLocateAddress());
                otherDoctorDistanceObj.put("doctorLon",doc.getDoctorLon());
                otherDoctorDistanceObj.put("doctorLat",doc.getDoctorLat());
                otherDoctorDistanceObj.put("distance",distanceTmp);//两点距离
                otherDoctorDistanceObj.put("distance",null);//两点距离
                otherDoctorDistance.add(otherDoctorDistanceObj);
            }
            emergencyOrderVO.setOtherDoctorDistance(otherDoctorDistance.toJSONString());
@ -1336,7 +1336,7 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
        }
    }
    public void preventOutOfBed(JSONObject result,String patient,boolean video){
    public void preventOutOfBed(JSONObject result,String patient,boolean video,String dayTime){
        List<DevicePatientDevice> devicePatientDeviceDos = patientDeviceDao.findByUserAndCategoryCode(patient,"13");
        if (devicePatientDeviceDos.size()==0){}
        else {
@ -1349,7 +1349,9 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
                    result.put("sleepStatus",true);
                    JSONObject tmp = objInfo.getJSONObject(0);
                    JSONObject sleepInfo = new JSONObject();
                    String dayTime = getSleepMonitoringDay(new Date(),patient);
                    if (StringUtils.isBlank(dayTime)){
                        dayTime = getSleepMonitoringDay(new Date(),patient);
                    }
                    List<BaseSleepPlanDetail> planDetails = sleepPlanDetailDao.findByPatientAndDay(patient,dayTime);
                    if (planDetails.size()>0){
                        BaseSleepPlanDetail planDetail =  planDetails.get(0);
@ -1487,7 +1489,7 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
            monitorInfo(result, patient);
        }
        if ("preventOutOfBed".equals(topicItem)||StringUtils.isBlank(topicItem)){
            preventOutOfBed(result, patient,true);
            preventOutOfBed(result, patient,true,null);
        }
        if ("preventFire".equals(topicItem)||StringUtils.isBlank(topicItem)){
            preventFire(result, patient,true);

+ 17 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/sign/ServicePackageService.java

@ -579,6 +579,23 @@ public class ServicePackageService extends BaseJpaService<ServicePackageDO, Serv
                " and pack.del=1 and  item.topic_item='"+topicType+"' and re.sign_id in (\n" +
                "select rd.id from base_service_package_sign_record rd  where rd.patient='"+patient+"' and rd.status=1) GROUP BY item.code; ";
        List<Map<String,Object>> result = jdbcTemplate.queryForList(sql);
        Iterator<Map<String, Object>> iterator = result.iterator();
        while (iterator.hasNext()){
            Map<String, Object> map = iterator.next();
            String item = map.get("serverItem").toString();
            sql = " select count(pd.device_sn) from dm_device dd INNER JOIN wlyy_patient_device " +
                    "pd on dd.category_code = pd.category_code INNER JOIN wlyy_devices wd on dd.model = wd.device_model" +
                    " and pd.device_sn = wd.device_code \n" +
                    "where 1=1 and  pd.del=0  and  pd.`user`='"+patient+"'  and dd.service_topic " +
                    "like '%"+item+"%'   ";
            Integer count = jdbcTemplate.queryForObject(sql,Integer.class);
            if (count>0){
            }else {
                iterator.remove();
            }
        }
        return result;
    }

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

@ -608,8 +608,8 @@ public class DeviceService {
                        Long timeDiffer = timeDate.getTime() - bedUp.getTime();
                        if(DateUtil.isInArea(timeDate,bedUpBegin,bedUpEnd)){//起床时间内
                            if ("0".equals(bed_status)){//起床
                                if (null==planDetail.getUpStatus()){
                                    planDetail.setUpStatus(1);
                                if (null==planDetail.getUpStatus()||1==planDetail.getUpStatus()){
                                    planDetail.setUpStatus(0);
                                    planDetail.setUpTime(timeDate);
                                }
                            }
@ -617,7 +617,7 @@ public class DeviceService {
                        else if (3600*upLongWarn*1000<timeDiffer){//距离起床超过三个小时还在床
                            if ("1".equals(bed_status)){//还在床
                                if (null==planDetail.getUpStatus()) {
                                    planDetail.setUpStatus(0);
                                    planDetail.setUpStatus(1);
                                    planDetail.setBedStatus(1);
                                    planDetail.setBreath(breath);
                                    planDetail.setHeartRate(heartrate);
@ -629,7 +629,7 @@ public class DeviceService {
                        /***午睡***/
                        if(needSiesta&&DateUtil.isInArea(timeDate,SiestaBegin,bedIn)){//午睡时段
                            if ("0".equals(bed_status)){
                                if (null==planDetail.getSiestaStatus()){//超时未午睡午睡
                                if (null==planDetail.getSiestaStatus()){//超时未午睡
                                    timeDiffer = timeDate.getTime() - SiestaTime.getTime();
                                    if (timeDiffer>3600*siestaLongWarn*1000){
                                        planDetail.setSiestaStatus(0);
@ -646,7 +646,7 @@ public class DeviceService {
                            }
                            if ("1".equals(bed_status)){
                                if (null==planDetail.getSiestaStatus()){
                                if (null==planDetail.getSiestaStatus()||0==planDetail.getSiestaStatus()){
                                    planDetail.setSiestaStatus(1);
                                    planDetail.setSiestaTimeBegin(timeDate);
                                }
@ -669,13 +669,16 @@ public class DeviceService {
                        if (timeDiffer>0&&timeDate.after(bedBegin)){ //起夜记录
                            BaseSleepNightRecord record = new BaseSleepNightRecord();
                            if ("1".equals(bed_status)){
                                if (null==planDetail.getInStatus()){
                                if (null==planDetail.getInStatus()||0==planDetail.getInStatus()){
                                    planDetail.setInStatus(1);
                                    planDetail.setInTimeBegin(timeDate);
                                }
                                else if (1==planDetail.getInStatus()){//在床记录起夜时长
                                    List<BaseSleepNightRecord> records = nightRecord.findBySnStaPaTime(device,patient,0,bedBegin,dayTime);
                                    if (records.size()>0){//
                                    if (records.size()==0){
                                        records = nightRecord.findBySnStaPaTime(device,patient,-1,bedBegin,dayTime);//超时未归的起夜记录
                                    }
                                    if (records.size()>0){//已经晚休了 但是存在起夜未归
                                        record = records.get(0);
                                        record.setStatus(1);
                                        record.setUpdateTime(timeDate);
@ -709,7 +712,7 @@ public class DeviceService {
                                    }else {//是否触发工单
                                        record = records.get(0);
                                        timeDiffer = timeDate.getTime()-record.getCreateTime().getTime();
                                        if (timeDiffer>3600*nightLongWarn*1000){//超过2未回床小时 触发工单
                                        if (timeDiffer>3600*nightLongWarn*1000&&0==records.get(0).getStatus()){//超过2未回床小时 触发工单
                                            planDetail.setSleepNightRecordList(records);
                                            planDetail.setBedStatus(0);
                                            outBedOrder(records.get(0),timeDate,devicePatientDeviceDos.get(0),patient,device,"起夜超时未回床",JSON.toJSONStringWithDateFormat(planDetail,"yyyy-MM-dd HH:mm:ss",SerializerFeature.WriteMapNullValue));
@ -812,9 +815,6 @@ public class DeviceService {
            }
            if (null!=record){
                record.setStatus(-1);
                record.setUpdateTime(time_date);
                Long timeDiffer = (time_date.getTime() - record.getCreateTime().getTime())/1000;
                record.setOutTime(timeDiffer+"");
                nightRecord.save(record);
            }
    }

+ 1 - 1
svr/svr-cloud-device/src/main/java/com/yihu/jw/care/service/YsDeviceService.java

@ -190,7 +190,7 @@ public class YsDeviceService {
                jsonObject.put("patientName",patientDO.getName());
                jsonObject.put("patientPhone",patientDO.getMobile());
                jsonObject.put("serveDesc",serveDesc);
                jsonObject.put("hospital",hospital);
                jsonObject.put("hospital",sqlResult.get(0).get("org_code"));
                jsonObject.put("serveAddress",deviceDO.getSosAddress());
                jsonObject.put("serveLat",lat);
                jsonObject.put("serveLon",lon);