liubing 3 years ago
parent
commit
e19a31b091

+ 11 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/third/platForm/PatientInfoPlatFormEndpoint.java

@ -263,6 +263,17 @@ public class PatientInfoPlatFormEndpoint extends EnvelopRestEndpoint {
        }
    }
    @GetMapping(value = "getPatientTopicWarnInfo")
    @ApiOperation("获取居民各专题预警情况")
    public String getPatientTopicWarnInfo(@ApiParam(name="patient",value="患者代码",defaultValue = "808080eb7917a3be017918a979380055")
                                     @RequestParam(value="patient",required = true) String patient){
        try {
            return baseController.write (200,"查询成功","data",securityMonitoringOrderService.getPatientTopicWarnInfo(patient));
        }catch (Exception e){
            return baseController.errorResult(e);
        }
    }
    @GetMapping("getDoorCoachByOrderId")
    @ApiOperation(value = "根据工单id获取相应的工单,如果为空,则获取该患者当前最新一条的工单")
    public ObjEnvelop getByOrderId(

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

@ -1579,8 +1579,8 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
        result.put("emeAssistance", false);
        result.put("monitorInfo", null);
        String sql = " select dict.code,count(ord.id) total from base_system_dict_entry dict LEFT JOIN base_security_monitoring_order ord " +
                " on dict.code = ord.topic_item COLLATE utf8_unicode_ci and ord.status=" + SecurityMonitoringOrderDO.Status.apply.getType() + " where dict.dict_code='service_item' " +
                "and dict.remark='security' and ord.patient='" + patient + "' GROUP BY dict.code ";
                " on dict.code = ord.topic_item COLLATE utf8_unicode_ci and ord.status=" + SecurityMonitoringOrderDO.Status.apply.getType() + " and ord.patient='" + patient + "' where dict.dict_code='service_item' " +
                "and dict.remark='security' GROUP BY dict.code ";
        List<Map<String, Object>> sqlResult = jdbcTemplate.queryForList(sql);
        for (Map<String, Object> tmp : sqlResult) {
            switch (tmp.get("code").toString()) {
@ -1650,6 +1650,99 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
        return result;
    }
    /**
     * 获取各专题预警情况
     * @param patient
     * @return
     */
    public List<Map<String,Object>> getPatientTopicWarnInfo(String patient) {
        String sql = " select dict.code,count(ord.id) total,ord.patient,ord.id,'22' as OrderType,ord.serve_desc as serveDesc from base_system_dict_entry dict LEFT JOIN base_security_monitoring_order ord " +
                " on dict.code = ord.topic_item COLLATE utf8_unicode_ci and ord.status=" + SecurityMonitoringOrderDO.Status.apply.getType() + " and ord.patient='" + patient + "' " +
                " where dict.dict_code='service_item' " +
                "and dict.remark='security'  GROUP BY dict.code ";
        List<Map<String, Object>> list = jdbcTemplate.queryForList(sql);
        for (Map<String, Object> tmp : list) {
            switch (tmp.get("code").toString()) {
                case "preventGasLeakage":
                    List<Map<String,Object>> devices = patientDeviceService.patientDeviceListByTopic(patient,"preventGasLeakage");
                    if (devices.size()>0) {
                        tmp.put("band", true);
                        tmp.put("devices", devices);
                    }else {
                        tmp.put("band", false);
                        tmp.put("devices", null);
                    }
                    break;
                case "preventFire":
                    devices = patientDeviceService.patientDeviceListByTopic(patient,"preventFire");
                    if (devices.size()>0){
                        tmp.put("band", true);
                        tmp.put("devices", devices);
                    }else {
                        tmp.put("band", false);
                        tmp.put("devices", null);
                    }
                    break;
                case "preventFall":
                    devices = patientDeviceService.patientDeviceListByTopic(patient,"preventFall");
                    if (devices.size()>0){
                        tmp.put("band", true);
                        tmp.put("devices", devices);
                    }else {
                        tmp.put("band", false);
                        tmp.put("devices", null);
                    }
                    break;
                case "preventOutOfBed":
                    devices = patientDeviceService.patientDeviceListByTopic(patient,"preventOutOfBed");
                    if (devices.size()>0){
                        tmp.put("band", true);
                        tmp.put("devices", devices);
                    }else {
                        tmp.put("band", false);
                        tmp.put("devices", null);
                    }
                    break;
                case "preventLost":
                    devices = patientDeviceService.patientDeviceListByTopic(patient,"preventLost");
                    if (devices.size()>0){
                        tmp.put("band", true);
                        tmp.put("devices", devices);
                    }else {
                        tmp.put("band", false);
                        tmp.put("devices", null);
                    }
                    break;
            }
        }
        sql = " select 'emeAssistance' as code,ord.id,ord.patient,'20' as OrderType,'紧急呼叫' as serveDesc " +
                " from base_emergency_assistance_order ord where ord.`status`='"+EmergencyAssistanceDO.Status.apply.getType()+"' " +
                " and ord.patient='"+patient+"' limit 1 ";
        List<Map<String,Object>> emeAssistances = jdbcTemplate.queryForList(sql);
        sql = " select dd.photo,pd.device_sn,dd.brands,dd.category_code,dd.model,pd.device_name,date_format(pd.czrq,'%Y-%m-%d %H:%i:%S' ) deviceTime \n" +
                "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 dd.category_code in (4,7,16) and user='"+patient+"' ";
        List<Map<String,Object>> devices = jdbcTemplate.queryForList(sql);
        if (emeAssistances.size()>0){
          Map<String,Object> tmp =  emeAssistances.get(0);
            tmp.put("band",devices.size()>0?true:false);
            tmp.put("devices",devices);
            list.add(tmp);
        }else{
            Map<String,Object> tmp = new HashMap<>();
            tmp.put("code","emeAssistance");
            tmp.put("id",null);
            tmp.put("patient",null);
            tmp.put("OrderType",null);
            tmp.put("serveDesc",null);
            tmp.put("band",devices.size()>0?true:false);
            tmp.put("devices",devices);
            list.add(tmp);
        }
        return list;
    }
    /**
     * 老人家属首页实时监护信息
     * 居家状态取手表 无手表缺省

+ 2 - 2
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/third/PatientInfoPlatFormService.java

@ -234,11 +234,11 @@ public class PatientInfoPlatFormService {
        emeWarn.put("unfinish",unfinish);
        emeWarn.put("finish",finish);
        //获取最近一次工单
        sql = " select o.id,p.id patient,p.name,p.idcard,p.residential_area,'20' orderType,'1' type,o.serve_address,'紧急呼叫' serve_desc, " +
        sql = " select o.id,p.id patient,p.name,p.idcard,p.residential_area,'20' OrderType,'1' type,o.serve_address,'紧急呼叫' serve_desc, " +
                " o.status,DATE_FORMAT(o.create_time,'%Y-%m-%d %H:%i:%S') create_time from base_emergency_assistance_order o INNER JOIN base_patient p on p.id = o.patient " +
                " where o.patient='"+patient+"' and o.`status` <>-1 " +
                " UNION " +
                "select o.id,p.id patient,p.name,p.idcard,p.residential_area,'22' orderType,'1' type,o.serve_address,o.serve_desc, " +
                "select o.id,p.id patient,p.name,p.idcard,p.residential_area,'22' OrderType,'1' type,o.serve_address,o.serve_desc, " +
                " o.status,DATE_FORMAT(o.create_time,'%Y-%m-%d %H:%i:%S') create_time from base_security_monitoring_order o INNER JOIN base_patient p on p.id = o.patient " +
                " where o.patient='"+patient+"' and o.`status` <>-1 " +
                "ORDER BY create_time desc limit 1 ";