LAPTOP-KB9HII50\70708 3 년 전
부모
커밋
14f53bf84f

+ 3 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/dao/security/BaseEmergencyWarnLogDao.java

@ -18,4 +18,7 @@ public interface BaseEmergencyWarnLogDao extends PagingAndSortingRepository<Base
    @Query("select w from BaseEmergencyWarnLogDO w where w.orderId = ?1 and w.type = 1")
    List<BaseEmergencyWarnLogDO> findByOrderIdByType(String orderId);
    @Query("select w from BaseEmergencyWarnLogDO w where w.orderId = ?1 and w.type = ?2")
    List<BaseEmergencyWarnLogDO> findByOrderIdAndType(String orderId,Integer type);
}

+ 41 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/admin/CommonEndpoint.java

@ -1,6 +1,9 @@
package com.yihu.jw.care.endpoint.admin;
import com.alibaba.fastjson.JSONObject;
import com.getui.push.v2.sdk.ApiHelper;
import com.getui.push.v2.sdk.GtApiConfiguration;
import com.getui.push.v2.sdk.api.PushApi;
import com.yihu.jw.care.dao.label.BaseCapacityLabelDao;
import com.yihu.jw.care.service.common.CommomService;
import com.yihu.jw.care.service.device.DevicePatientFaceService;
@ -9,6 +12,7 @@ import com.yihu.jw.care.util.DingdingUtil;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.care.label.BaseCapacityLabelDO;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.push.service.GetuiService;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.ObjEnvelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
@ -55,6 +59,43 @@ public class CommonEndpoint extends EnvelopRestEndpoint {
    private CarePatientService carePatientService;
    @Autowired
    private DevicePatientFaceService patientFaceService;
    @Autowired
    private GetuiService getuiService;
    @GetMapping(value = "open/forceInit")
    @ApiOperation(value = "测试个推")
    public Envelop forceInit(){
        try {
            getuiService.forceInit();
            return Envelop.getSuccess("success");
        }catch (Exception e){
            e.printStackTrace();
            return failedException2(e);
        }
    }
    @GetMapping(value = "open/pushApi")
    @ApiOperation(value = "测试个推")
    public Envelop pushApi(){
        try {
            GtApiConfiguration apiConfiguration = new GtApiConfiguration();
            //填写应用配置
            apiConfiguration.setAppId("I6JAs97T818HD0hGzG1EH4");
            apiConfiguration.setAppKey("JC2LAW9IK27pansBB4jN87");
            apiConfiguration.setMasterSecret("Rd86CP8bOy7RHyTf4ZE3R4");
            // 接口调用前缀,请查看文档: 接口调用规范 -> 接口前缀, 可不填写appId
            apiConfiguration.setDomain("https://restapi.getui.com/v2/");
            // 实例化ApiHelper对象,用于创建接口对象
            ApiHelper apiHelper = ApiHelper.build(apiConfiguration);
            // 创建对象,建议复用。目前有PushApi、StatisticApi、UserApi
            PushApi pushApi = apiHelper.creatApi(PushApi.class);
            logger.info("个推初始化:"+pushApi);
            return Envelop.getSuccess("success");
        }catch (Exception e){
            e.printStackTrace();
            return failedException2(e);
        }
    }
    @GetMapping(value = "open/findFaceRecord")
    @ApiOperation(value = "获取人脸数据")

+ 42 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/assistance/EmergencyAssistanceEndpoint.java

@ -7,6 +7,7 @@ import com.yihu.jw.care.service.assistance.EmergencyAssistanceService;
import com.yihu.jw.care.service.common.PermissionService;
import com.yihu.jw.care.service.security.SecurityMonitoringOrderService;
import com.yihu.jw.restmodel.ResponseContant;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.ListEnvelop;
import com.yihu.jw.restmodel.web.ObjEnvelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
@ -344,6 +345,47 @@ public class EmergencyAssistanceEndpoint extends EnvelopRestEndpoint {
        }
    }
    @PostMapping("preWarningReview")
    @ApiOperation(value = "预警复核")
    @ObserverRequired
    public ObjEnvelop preWarningReview(
            @ApiParam(value = "工单id", name = "orderId")
            @RequestParam(value = "orderId", required = true) String orderId,
            @ApiParam(value = "复核内容", name = "content")
            @RequestParam(value = "content", required = true) String content) {
        try {
            String doctor = permissionService.getUID();
            JSONObject result = assistanceService.preWarningReview(orderId, doctor,content);
            if (result.getIntValue("resultFlag") == 0) {
                return ObjEnvelop.getError(result.getString("resultMsg"));
            }
            return ObjEnvelop.getSuccess("操作成功",result.getString("resultMsg"));
        } catch (Exception e) {
            return failedObjEnvelopException2(e);
        }
    }
    @PostMapping("addWarnLog")
    @ApiOperation(value = "记录预警核实日志")
    @ObserverRequired
    public Envelop addWarnLog(
            @ApiParam(value = "会话id", name = "sessionId")
            @RequestParam(value = "sessionId", required = true) String sessionId,
            @ApiParam(value = "社工id", name = "doctor")
            @RequestParam(value = "doctor", required = true) String doctor,
            @ApiParam(value = "类型 8发起im会话,9发起音视频通话", name = "type")
            @RequestParam(value = "type", required = true) Integer type,
            @ApiParam(value = "复核内容", required = false, name = "content")
            @RequestParam(value = "content", required = false) String content) {
        try {
            assistanceService.addWarnLog(sessionId, doctor,type,content);
            return Envelop.getSuccess("操作成功");
        } catch (Exception e) {
            return failedException2(e);
        }
    }
    @PostMapping("errorWarning")
    @ApiOperation(value = "误报警")
    @ObserverRequired

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

@ -178,17 +178,18 @@ public class DoctorDeviceController extends BaseController {
	@ApiOperation(value = "设备详细信息")
	public String getDeviceInfo(@ApiParam(name = "patient",value = "居民code")
								@RequestParam(value = "patient")String patient,
								@ApiParam(name = "orderId", required = false,value = "对应工单的id")
								@RequestParam(value = "orderId", required = false) String orderId,
								@ApiParam(name = "deviceSn",value = "设备SN码")
								@RequestParam(value = "deviceSn")String deviceSn){
		try {
			JSONObject param = new JSONObject();
			param.put("doctorId",permissionService.getUID());
			String doctorId = permissionService.getUID();
			param.put("doctorId",doctorId);
			if(permissionService.noPermission(2,param)){
				return write(-1,"该操作没有权限");
			}
			org.json.JSONObject result = deviceManageService.getDeviceInfo(patient, deviceSn);
			org.json.JSONObject result = deviceManageService.getDeviceInfo(patient, deviceSn,doctorId,orderId);
			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/device/PatientDeviceController.java

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

+ 6 - 3
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/statistics/DetectionPlatformEndpoint.java

@ -3,6 +3,7 @@ package com.yihu.jw.care.endpoint.statistics;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.care.service.common.PermissionService;
import com.yihu.jw.care.service.device.DeviceManageService;
import com.yihu.jw.care.service.device.NetworkCardService;
import com.yihu.jw.care.service.device.PatientDeviceService;
@ -43,7 +44,8 @@ public class DetectionPlatformEndpoint extends EnvelopRestEndpoint {
    private NetworkCardService networkCardService;
    @Autowired
    private DeviceManageService deviceManageService;
    @Autowired
    private PermissionService permissionService;
    @ApiOperation("环境信息")
@ -152,11 +154,12 @@ public class DetectionPlatformEndpoint extends EnvelopRestEndpoint {
                                          @RequestParam(value = "patient") String patient,
                                          @ApiParam(name = "deviceSN")
                                          @RequestParam(value = "deviceSN") String deviceSn,
                                          @ApiParam(name = "orderId", required = false,value = "对应工单的id")
                                          @RequestParam(value = "orderId", required = false) String orderId,
                                          @ApiParam(name = "day", value = "yyyy-mm-dd")
                                          @RequestParam(value = "day", required = false) String day) {
        try {
            org.json.JSONObject result = patientDeviceService.getPatientDeviceDetail(patient, deviceSn, day);
            org.json.JSONObject result = patientDeviceService.getPatientDeviceDetail(patient, deviceSn, day,permissionService.getUID(),orderId);
            if (result.getInt(ResponseContant.resultFlag) == ResponseContant.success) {
                return success(JSON.parseObject(result.getString(ResponseContant.resultMsg)));
            } else {

+ 41 - 2
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/third/assistance/EmeAsEndpoint.java

@ -5,6 +5,7 @@ import com.yihu.jw.care.aop.ObserverRequired;
import com.yihu.jw.care.aop.ServicesAuth;
import com.yihu.jw.care.service.assistance.EmergencyAssistanceService;
import com.yihu.jw.restmodel.ResponseContant;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.ObjEnvelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import io.swagger.annotations.Api;
@ -26,8 +27,6 @@ public class EmeAsEndpoint extends EnvelopRestEndpoint {
    @PostMapping(value = "newOrder")
    @ApiOperation(value = "居民发起新的紧急救助")
    @ServicesAuth(item = "emergencyAssistance")
    @ObserverRequired
    public ObjEnvelop newOrder(@ApiParam(name="patientId",value = "居民id")
                               @RequestParam(value = "patientId") String patientId,
                               @ApiParam(name="jsonData",value = "创建工单json")
@ -45,5 +44,45 @@ public class EmeAsEndpoint extends EnvelopRestEndpoint {
            return failedObjEnvelopException2(e);
        }
    }
    @PostMapping("preWarningReview")
    @ApiOperation(value = "预警复核")
    public ObjEnvelop preWarningReview(
            @ApiParam(value = "工单id", name = "orderId")
            @RequestParam(value = "orderId", required = true) String orderId,
            @ApiParam(value = "社工id", name = "doctor")
            @RequestParam(value = "doctor", required = true) String doctor,
            @ApiParam(value = "复核内容", name = "content")
            @RequestParam(value = "content", required = true) String content) {
        try {
            JSONObject result = assistanceService.preWarningReview(orderId, doctor,content);
            if (result.getIntValue("resultFlag") == 0) {
                return ObjEnvelop.getError(result.getString("resultMsg"));
            }
            return ObjEnvelop.getSuccess("操作成功",result.getString("resultMsg"));
        } catch (Exception e) {
            return failedObjEnvelopException2(e);
        }
    }
    @PostMapping("addWarnLog")
    @ApiOperation(value = "记录预警核实日志")
    public Envelop addWarnLog(
            @ApiParam(value = "会话id", name = "sessionId")
            @RequestParam(value = "sessionId", required = true) String sessionId,
            @ApiParam(value = "社工id", name = "doctor")
            @RequestParam(value = "doctor", required = true) String doctor,
            @ApiParam(value = "类型 8发起im会话,9发起音视频通话", name = "type")
            @RequestParam(value = "type", required = true) Integer type,
            @ApiParam(value = "复核内容", required = false, name = "content")
            @RequestParam(value = "content", required = false) String content) {
        try {
            assistanceService.addWarnLog(sessionId, doctor,type,content);
            return Envelop.getSuccess("操作成功");
        } catch (Exception e) {
            return failedException2(e);
        }
    }
}

+ 195 - 19
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/assistance/EmergencyAssistanceService.java

@ -299,7 +299,7 @@ public class EmergencyAssistanceService extends BaseJpaService<EmergencyAssistan
                message.put("orgType",orgDO.getType());
            }
            String url = "/sos/info?id="+assistanceDO.getId()+"&OrderType=20&patient="+assistanceDO.getPatient()+"&patientName="+assistanceDO.getPatientName();
            for (BaseDoctorDO doctorDO:doctorDOS){
                try {
                    if (StringUtils.isNotBlank(doctorDO.getMobile())){
@ -308,7 +308,8 @@ public class EmergencyAssistanceService extends BaseJpaService<EmergencyAssistan
                }catch (Exception e){}
                String body = "您好,"+assistanceDO.getPatientName()+"居民发起紧急呼叫,请关注并及时处理。";
                String dingDingBody = "您好,"+assistanceDO.getPatientName()+"居民发起紧急呼叫,请及时处理。";
                messageUtil.sendDoctorGetuiMessage(doctorDO.getId(),"2","/sos/index?tabActive=1","紧急呼叫",body);
                messageUtil.sendDoctorGetuiMessage(doctorDO.getId(),"2",url,"紧急呼叫",body);
                messageUtil.sendDoctorDingdingMessage(doctorDO,null,"text","2",dingDingBody,null,null);
                imUtill.sendMDTSocketMessageToDoctor(doctorDO.getId(),message.toString());
            }
@ -1121,6 +1122,88 @@ public class EmergencyAssistanceService extends BaseJpaService<EmergencyAssistan
        return result;
    }
    /**
     * 记录预警核实日志
     */
    public void addWarnLog(String sessionId,String doctor,Integer type,String content){
        BaseDoctorDO doctorDO = doctorDao.findById(doctor);
        if(doctorDO==null){
            return;
        }
        String sql = "SELECT e.id from im_internet_hospital.topics t,wlyy_consult c,base_emergency_assistance_order e " +
                "WHERE t.session_id = ? and t.id = c.id " +
                "and c.relation_code = e.id and e.`status` = 1 " +
                "UNION " +
                "SELECT s.id from im_internet_hospital.topics t,wlyy_consult c,base_security_monitoring_order s " +
                "WHERE t.session_id = ? and t.id = c.id " +
                "and c.relation_code = s.id and s.`status` = 1 ";
        List<Map<String,Object>> list = jdbcTemplate.queryForList(sql,new Object[]{sessionId,sessionId});
        for (Map<String,Object> map:list){
            String orderId = map.get("id")+"";
            List<BaseEmergencyWarnLogDO> logDOS = logDao.findByOrderIdAndType(orderId,type);
            if(logDOS.size()==0){
                //新增 type =8 9
                BaseEmergencyWarnLogDO logDO = new BaseEmergencyWarnLogDO();
                logDO.setUserCode(doctor);
                logDO.setUserName(doctorDO.getName());
                logDO.setOrderId(orderId);
                logDO.setUserType(2);
                logDO.setCreateTime(new Date());
                if(type==8){
                    logDO.setContent("发起im会话");
                }else {
                    logDO.setContent(content);
                }
                logDO.setType(type);
                logDao.save(logDO);
            }else if(type==9){
                //更新9
                BaseEmergencyWarnLogDO logDO = logDOS.get(0);
                logDO.setContent(content);
                logDao.save(logDO);
            }
        }
    }
    /**
     * 预警复核
     * @return
     */
    public JSONObject preWarningReview(String orderId,String doctor,String content){
        JSONObject result = new JSONObject();
        EmergencyAssistanceDO one = emergencyAssistanceDao.findOne(orderId);
        if (one==null){
            String failMsg = "工单不存在" ;
            result.put("resultFlag", 0);
            result.put("resultMsg", failMsg);
            return result;
        }
        String orgCode = permissionService.getDoctorOrg(doctor);
        if(!orgCode.equals(one.getOrgCode())){
            String failMsg = "该操作没权限" ;
            result.put("resultFlag", 0);
            result.put("resultMsg", failMsg);
            return result;
        }
        BaseDoctorDO doctorDO = doctorDao.findById(doctor);
        if (null!=doctorDO){
            BaseEmergencyWarnLogDO logDO = new BaseEmergencyWarnLogDO();
            logDO.setUserCode(doctor);
            logDO.setUserName(doctorDO.getName());
            logDO.setOrderId(orderId);
            logDO.setUserType(2);
            logDO.setCreateTime(new Date());
            logDO.setContent(content);
            logDO.setType(7);
            logDao.save(logDO);
        }
        result.put("resultFlag", 1);
        result.put("resultMsg", "success");
        return result;
    }
    public JSONObject responseOrder(String orderId,String doctor){
        JSONObject result = new JSONObject();
        EmergencyAssistanceDO one = emergencyAssistanceDao.findOne(orderId);
@ -1147,15 +1230,7 @@ public class EmergencyAssistanceService extends BaseJpaService<EmergencyAssistan
            BaseDoctorDO doctorDO = doctorDao.findById(doctor);
            if (null!=doctorDO){
                BaseEmergencyWarnLogDO logDO = new BaseEmergencyWarnLogDO();
                BaseEmergencyWarnLogDO logTypeDO = new BaseEmergencyWarnLogDO();
                logDO.setUserCode(doctor);
                logDO.setUserName(doctorDO.getName());
                logDO.setOrderId(orderId);
                logDO.setUserType(2);
                logDO.setCreateTime(new Date());
                logDO.setContent("前往定位");
                logDao.save(logDO);
                List<BaseEmergencyWarnLogDO> byOrderIdByType = logDao.findByOrderIdByType(orderId);
                if (byOrderIdByType.size()==0){
@ -1509,22 +1584,90 @@ public class EmergencyAssistanceService extends BaseJpaService<EmergencyAssistan
        String eaSql = " ";
        List<Map<String, Object>> maps = new ArrayList<>();
        if ("20".equals(orderType)){
            eaSql   = "SELECT `status`,DATE_FORMAT(create_time,'%Y-%m-%d %H:%i:%S') AS createTime,complete_time AS completeTime " +
                    "from base_emergency_assistance_order WHERE id = '"+orderId+"'";
            eaSql   = "SELECT o.`status`,DATE_FORMAT(o.create_time,'%Y-%m-%d %H:%i:%S') AS createTime,o.patient,'紧急呼叫' AS serveDesc,dd.photo " +
                    "from base_emergency_assistance_order o " +
                    "LEFT JOIN wlyy_devices wd on wd.device_code=o.device_sn " +
                    "LEFT JOIN dm_device dd on dd.category_code = wd.category_code " +
                    " WHERE id = ?";
        }
        if ("22".equals(orderType)){
            eaSql   = "SELECT `status`,DATE_FORMAT(create_time,'%Y-%m-%d %H:%i:%S') AS createTime,complete_time AS completeTime " +
                "from base_security_monitoring_order WHERE id = '"+orderId+"'";
            eaSql   = "SELECT o.`status`,DATE_FORMAT(o.create_time,'%Y-%m-%d %H:%i:%S') AS createTime,o.patient,o.serve_desc serveDesc,dd.photo " +
                    "from base_security_monitoring_order o  " +
                    "LEFT JOIN wlyy_devices wd on wd.device_code=o.device_sn " +
                    "LEFT JOIN dm_device dd on dd.category_code = wd.category_code " +
                "  WHERE o.id = ?";
        }
        maps = jdbcTemplate.queryForList(eaSql);
        maps = jdbcTemplate.queryForList(eaSql,new Object[]{orderId});
        if (maps.size()==0) {
            return null;
        }
        for (Map<String, Object> map : maps) {
            jsonObject.put("status",map.get("status"));
            jsonObject.put("createTime",map.get("createTime"));
        }
        //发起预警
        jsonObject.put("start",maps.get(0));
        String patient = maps.get(0).get("patient")+"";
        //预警推送
        //通知对象
        //医生信息
   /*     String sql = "SELECT i.code,r.team_code,pack.org_code,pack.org_name from base_service_package_sign_record sr,base_service_package_record r, base_service_package_item i,base_service_package pack  \n" +
                "where  sr.id = r.sign_id and sr.status=1 and r.service_package_id = i.service_package_id and r.service_package_id = pack.id  and i.del = 1 and sr.`status`=1 \n" +
                "and  sr.patient  = ? and i.code='preventLost' ";
        List<Map<String, Object>> items = jdbcTemplate.queryForList(sql,new Object[]{orderId});
        if (items.size() > 0) {
            Map<String, Object> mapTmp = items.get(0);
            List<BaseDoctorDO> doctorDOS = baseTeamMemberDao.findAllMembersByLevel(mapTmp.get("team_code").toString(), 2);
            JSONArray otherDoctorDistance = new JSONArray();
            JSONObject otherDoctorDistanceObj = new JSONObject();
            for (BaseDoctorDO doc : doctorDOS) {
                Map<String, Object> noticeObj = new HashMap<>();
                noticeObj.put("type", "1");
                noticeObj.put("typeName", "社工");
                noticeObj.put("id", doc.getId());
                noticeObj.put("name", doc.getName());
                noticeObj.put("photo", doc.getPhoto());
                noticeObj.put("mobile", doc.getMobile());
                List<Map<String, Object>> arr = new ArrayList<>();
                Map<String, Object> tmp = new HashMap<>();
                tmp.put("name", "系统预警");
                tmp.put("status", 0);
                tmp.put("statusName", "未响应");
                if (emergencyWarnDoctorResponseDao.findByDoctorAndOrderId(doc.getId(), orderDO.getId()) != null) {
                    tmp.put("status", 1);
                    tmp.put("statusName", "已响应");
                }
                arr.add(tmp);
                noticeObj.put("response", arr);
                noticePersons.add(noticeObj);
                if (StringUtils.isBlank(doc.getDoctorLat()) || StringUtils.isBlank(doc.getDoctorLon())) {
                    List<BaseDoctorHospitalDO> doctorHospitalDOS = baseDoctorHospitalDao.findByDoctorCode(doc.getId());
                    if (doctorHospitalDOS.size() > 0) {
                        BaseDoctorHospitalDO hospitalDO = doctorHospitalDOS.get(0);
                        BaseOrgDO orgDO = orgDao.findByCode(hospitalDO.getOrgCode());
                        doc.setDoctorLocateAddress(orgDO.getAddress());
                        doc.setDoctorLat(orgDO.getLatitude());
                        doc.setDoctorLon(orgDO.getLongitude());
                    } else {
                        continue;
                    }
                }
                //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", null);//两点距离
                otherDoctorDistance.add(otherDoctorDistanceObj);
            }
            emergencyOrderVO.setOtherDoctorDistance(otherDoctorDistance.toJSONString());
        }*/
        //其他日志
        String sql = "select user_name AS userName,create_time AS createTime,content,type from base_emergency_warn_log where (user_type = 2 and order_id = '"+orderId+"' and type IS NOT NULL) " +
                " OR (user_type = 1 AND order_id = '"+orderId+"' and type IS NOT NULL) order by create_time,type ASC ";
        List<Map<String, Object>> result = jdbcTemplate.queryForList(sql);
@ -1541,6 +1684,39 @@ public class EmergencyAssistanceService extends BaseJpaService<EmergencyAssistan
        return jsonObject;
    }
    public void patientFamily(String patient,String orderId){
        List<Map<String, Object>> noticePersons = new ArrayList<>();
        JSONArray familyArr = familyMemberService.getPatientMembers(patient, null, null, null, "3");
        for (int i = 0; i < familyArr.size(); i++) {
            String patientId = familyArr.getJSONObject(i).getString("id");
            BasePatientDO patientDO1 = patientDao.findById(patientId);
            Map<String, Object> noticeObj = new HashMap<>();
            noticeObj.put("type", "0");
            noticeObj.put("typeName", "家属");
            noticeObj.put("id", patientDO1.getId());
            noticeObj.put("name", patientDO1.getName());
            noticeObj.put("photo", patientDO1.getPhoto());
            noticeObj.put("mobile", patientDO1.getMobile());
            List<Map<String, Object>> arr = new ArrayList<>();
            Map<String, Object> tmp = new HashMap<>();
            tmp.put("name", "系统预警");
            tmp.put("status", 0);
            tmp.put("statusName", "未读");
            SystemMessageDO messageDO = systemMessageDao.findByRelationCodeAndReceiver(orderId, patientId);
            if (messageDO != null) {
                if (StringUtils.isNotBlank(messageDO.getIsRead())) {
                    tmp.put("status", Integer.parseInt(messageDO.getIsRead()));
                    if (Integer.parseInt(messageDO.getIsRead()) == 1) {
                        tmp.put("statusName", "已读");
                    }
                }
            }
            arr.add(tmp);
            noticeObj.put("response", arr);
            noticePersons.add(noticeObj);
        }
    }
    public int phoneLogSave(BaseEmergencyWarnLogDO baseEmergencyWarnLogDO,Integer type){
        switch (type) {
            case 1:

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

@ -67,8 +67,8 @@ public class DeviceManageService extends BaseJpaService<BaseDeviceRepairEntity,B
    }
    /*设备详细信息*/
    public org.json.JSONObject getDeviceInfo(String patient, String deviceSn) throws Exception {
        return patientDeviceService.getPatientDeviceDetail(patient, deviceSn, null);
    public org.json.JSONObject getDeviceInfo(String patient, String deviceSn,String doctorId,String orderId) throws Exception {
        return patientDeviceService.getPatientDeviceDetail(patient, deviceSn, null,doctorId,orderId);
    }
    /*监护信息*/

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

@ -927,7 +927,7 @@ public class PatientDeviceService extends BaseJpaService<DevicePatientDevice, Pa
     * @param deviceSn 设备sn码
     * @return
     */
    public JSONObject getPatientDeviceDetail(String patient,String deviceSn,String day) throws Exception {
    public JSONObject getPatientDeviceDetail(String patient,String deviceSn,String day,String doctor,String orderId) throws Exception {
        JSONObject result = new JSONObject();
        BasePatientDO patientDO = patientDao.findById(patient);
        if (null==patientDO){
@ -1017,6 +1017,7 @@ public class PatientDeviceService extends BaseJpaService<DevicePatientDevice, Pa
            if ("4".equals(device.getCategoryCode()) || "7".equals(device.getCategoryCode())|| "16".equals(device.getCategoryCode())) {
                devInfo.put("sosContactsDOS", contactsService.getPatientSosContacts(patient));
            }
            String content = "调阅智能手表详情页";
            com.alibaba.fastjson.JSONObject devInfoObj = JSON.parseObject(JSON.toJSONString(devInfo, SerializerFeature.WriteMapNullValue));
            switch (device.getCategoryCode()) {
                case "1"://血压设备
@ -1028,6 +1029,7 @@ public class PatientDeviceService extends BaseJpaService<DevicePatientDevice, Pa
                    String bloodPressureSql = ssql + " AND type = 1 ORDER BY sort_date DESC LIMIT 10";
                    dataList = jdbcTemplate.queryForList(bloodPressureSql);
                    devInfoObj.put("bloodPressure",dataList); //血压
                    content +="血压监测";
                    break;
                case "2"://血糖设备
                    dataSql = "SELECT record_date recordDate,value1,value2,value3,value4,value5,value6,value7,type FROM wlyy_patient_health_index WHERE device_sn = '" + deviceSn + "' AND del = 1 ";
@ -1038,6 +1040,7 @@ public class PatientDeviceService extends BaseJpaService<DevicePatientDevice, Pa
                    recordSql = "SELECT record_date recordDate,value1,value2,value3,value4,value5,value6,value7,type FROM wlyy_patient_health_index WHERE device_sn = '" + deviceSn + "' AND del = 1  AND status = 1 ORDER BY sort_date DESC LIMIT 10";
                    dataList = jdbcTemplate.queryForList(recordSql);
                    devInfoObj.put("bloodSugar", dataList);          //血糖异常数据
                    content +="血糖监测";
                    break;
                case "4"://手表 围栏与轨迹
                    if (StringUtils.isBlank(day)) {
@ -1047,6 +1050,7 @@ public class PatientDeviceService extends BaseJpaService<DevicePatientDevice, Pa
                    //轨迹动态
                    JSONArray locations = getX1Locations(deviceSn, day.replace("-", ""));
                    devInfoObj.put("routes", locations);
                    content +="防走失监测";
                    break;
                case "7"://报警器 紧急工单
                    com.alibaba.fastjson.JSONObject response = getAqgDeviceInfo2(deviceSn);
@ -1060,6 +1064,7 @@ public class PatientDeviceService extends BaseJpaService<DevicePatientDevice, Pa
                    } else {
                        devInfoObj.put("contactStatus",1);
                    }
                    content +="SOS紧急呼叫器";
                    break;
                case "12"://监控 视频地址
                    com.alibaba.fastjson.JSONObject tmp = ysDeviceService.getDeviceLiveAddress(patient, deviceSn, 1, null);
@ -1069,9 +1074,11 @@ public class PatientDeviceService extends BaseJpaService<DevicePatientDevice, Pa
                    } else {
                        devInfoObj.put("monitorInfo", tmp.getJSONObject(ResponseContant.resultMsg));
                    }
                    content +="防跌倒视频监测";
                    break;
                case "13"://睡眠带 获取当天睡眠详情
                    securityMonitoringOrderService.preventOutOfBed(devInfoObj, patient, false, day);
                    content +="睡眠监测";
                    break;
                case "14"://气感报警器 当天监测记录以及最新浓度
                    if (StringUtils.isBlank(day)) {
@ -1081,10 +1088,12 @@ public class PatientDeviceService extends BaseJpaService<DevicePatientDevice, Pa
                    devInfoObj.put("monitorInfo", listTmp);
                    devInfoObj.put("day", day);
                    securityMonitoringOrderService.preventGasLeakage(devInfoObj, patient, false);
                    content +="燃气泄漏监测";
                    break;
                case "15"://烟感报警器 获取最新浓度
                    securityMonitoringOrderService.preventFire(devInfoObj, patient, deviceSn, false);
                    devInfoObj.put("day", DateUtil.getStringDateShort());
                    content +="火灾监测";
                    break;
                case "16":
                    if (StringUtils.isBlank(day)) {
@ -1143,18 +1152,41 @@ public class PatientDeviceService extends BaseJpaService<DevicePatientDevice, Pa
                            devInfoObj.put("isNotAlarm","未报警");
                        }
                    }
                    content +="防走失监测";
                    break;
                case "18"://日常用水监测
                    content +="日常用水监测";
                    break;
                case "19": //门禁 todo 出入记录
                    patientFaceService.findFaceRecord(patient,day,devInfoObj);
                    content +="人脸识别检测";
                    break;
                case "20": //电表 todo 日常用电情况
                    content +="日常用电监测";
                    break;
                case "21": //天然气 todo 天然气情况
                    naturalGasRecord(patientDO.getIdcard(),devInfoObj);
                    content +="天然气使用监测";
                    break;
            }
            //记录日志
            if(StringUtils.isNotBlank(doctor)&&StringUtils.isNotBlank(orderId)){
                BaseDoctorDO doctorDO = doctorDao.findById(doctor);
                if(doctorDO!=null){
                    content+="详情页";
                    BaseEmergencyWarnLogDO logDO = new BaseEmergencyWarnLogDO();
                    logDO.setUserCode(doctor);
                    logDO.setUserName(doctorDO.getName());
                    logDO.setOrderId(orderId);
                    logDO.setUserType(2);
                    logDO.setCreateTime(new Date());
                    logDO.setContent(content);
                    logDO.setType(10);
                    logDao.save(logDO);
                }
            }
//        }
                result.put(ResponseContant.resultFlag,ResponseContant.success);
                result.put(ResponseContant.resultMsg,JSON.toJSONString(devInfoObj,SerializerFeature.WriteMapNullValue));

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

@ -302,6 +302,7 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
            message.put("orgType", orgDO.getType());
        }
        String url = "/sos/info?id="+orderDO.getId()+"&OrderType=22";
        for (BaseDoctorDO doctorDO : doctorDOS) {
            try {
                if (StringUtils.isNotBlank(doctorDO.getMobile())) {
@ -311,7 +312,7 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
            }
            String body = "您好," + orderDO.getPatientName() + "居民" + orderDO.getServeDesc() + ",请关注并及时处理。";
            String dingDingBody = orderDO.getPatientName()+"居民存在异常情况,请及时处理,异常内容:"+orderDO.getServeDesc()+"。";
            messageUtil.sendDoctorGetuiMessage(doctorDO.getId(), "1", "/securityMonitoring/index", "安防紧急预警", body);
            messageUtil.sendDoctorGetuiMessage(doctorDO.getId(), "1", url, "安防紧急预警", body);
            messageUtil.sendDoctorDingdingMessage(doctorDO,null,"text","1",dingDingBody,null,null);
            imUtil.sendMDTSocketMessageToDoctor(doctorDO.getId(), message.toString());
        }