فهرست منبع

Merge branch 'dev' of http://192.168.1.220:10080/Amoy2/wlyy2.0 into dev

yeshijie 4 سال پیش
والد
کامیت
e554826661

+ 12 - 0
common/common-util/src/main/java/com/yihu/jw/util/http/HttpClientUtil.java

@ -501,6 +501,18 @@ public class HttpClientUtil {
        return ret;
        return ret;
    }
    }
    public String getBodyRawForm(String url, String params) throws IOException {
        CloseableHttpClient httpclient = HttpClients.createDefault();
        List<NameValuePair> pairs = new ArrayList<>(0);
        pairs.add(new BasicNameValuePair("object",params));
        String entityString = EntityUtils.toString(new UrlEncodedFormEntity(pairs,Consts.UTF_8));
        HttpGet httpGet = new HttpGet(url+"?"+entityString);
        CloseableHttpResponse response = httpclient.execute(httpGet);
        HttpEntity entity = response.getEntity();
        String ret = EntityUtils.toString(entity);
        return ret;
    }
    /**
    /**
     * 爱牵挂请求
     * 爱牵挂请求
     * @param url
     * @param url

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

@ -509,8 +509,8 @@ public class SignEndpoint extends EnvelopRestEndpoint {
    @GetMapping(value="getServerDoctorAll")
    @GetMapping(value="getServerDoctorAll")
    @ApiOperation(value = "获取所有服务医生")
    @ApiOperation(value = "获取所有服务医生")
    public ListEnvelop getServerDoctorAll(            @ApiParam(name = "patient", value = "患者id", required = true)
                                                          @RequestParam(value = "patient") String patient){
    public ListEnvelop getServerDoctorAll(@ApiParam(name = "patient", value = "患者id", required = true)
                                          @RequestParam(value = "patient") String patient){
        try {
        try {
            return ListEnvelop.getSuccess("查询成功",servicePackageService.getServerDoctorAll(patient));
            return ListEnvelop.getSuccess("查询成功",servicePackageService.getServerDoctorAll(patient));
        }catch (Exception e){
        }catch (Exception e){

+ 137 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/third/device/PDeviceController.java

@ -0,0 +1,137 @@
package com.yihu.jw.care.endpoint.third.device;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.jw.care.dao.device.PatientDeviceDao;
import com.yihu.jw.care.endpoint.BaseController;
import com.yihu.jw.care.service.device.DeviceDetailService;
import com.yihu.jw.care.service.device.PatientDeviceService;
import com.yihu.jw.care.service.device.PatientHealthIndexService;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.care.device.DevicePatientDevice;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.restmodel.web.ListEnvelop;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.apache.commons.lang3.StringUtils;
import org.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
 * 患者端:设备管理控制类
 *
 * @author George
 */
@RestController
@RequestMapping(value = "/cloudCare/noLogin/device")
@Api(value = "患者设备管理", description = "患者设备管理")
public class PDeviceController extends BaseController {
    private static Logger logger = LoggerFactory.getLogger(PDeviceController.class);
    @Autowired
    private PatientDeviceService patientDeviceService;
    @ApiOperation("获取居民的设备任务信息")
    @RequestMapping(value = "getPatientDeviceTaskInfo",method = RequestMethod.POST)
    public String getPatientDeviceTaskInfo(@ApiParam(name = "patientCode",value = "患者code")@RequestParam(value = "patientCode",required = true)String patientCode){
        try {
            return write(200,"执行成功","data",patientDeviceService.getPatientDeviceTaskInfo(patientCode));
        }catch (Exception e){
            return write(-1,"执行失败!");
        }
    }
    @ApiOperation("获取居民的爱牵挂设备亲情号码")
    @RequestMapping(value = "getAqgDeviceInfo",method = RequestMethod.GET)
    public String getAqgDeviceInfo(@ApiParam(name = "deviceSn",value = "设备sn码")
                                               @RequestParam(value = "deviceSn",required = true)String deviceSn){
        try {
            return write(200,"获取成功","data",patientDeviceService.getAqgDeviceInfo(deviceSn));
        }catch (Exception e){
            e.printStackTrace();
            return write(-1,"获取失败!");
        }
    }
    @ApiOperation("修改删除 爱牵挂亲情号码")
    @RequestMapping(value = "updAqgDeviceSosInfo",method = RequestMethod.POST)
    public String updAqgDeviceSosInfo(@ApiParam(name = "deviceSn",value = "设备id")
                                   @RequestParam(value = "deviceSn",required = true)String deviceSn,
                                   @ApiParam(name = "seqid",value = "亲情号码id")
                                   @RequestParam(value = "seqid",required = false)String seqid,
                                   @ApiParam(name = "name",value = "亲情号码昵称",required = false)
                                   @RequestParam(value = "name",required = false)String name,
                                   @ApiParam(name = "num",value = "号码",required = false)
                                   @RequestParam(value = "num",required = false)String num,
                                   @ApiParam(name = "dial_flag",value = "0不设置为紧急呼叫号码,1设置为紧急呼叫号码",required = false)
                                   @RequestParam(value = "dial_flag",required = false)String dial_flag,
                                   @ApiParam(name = "clear",value = "删除标志,删除传1",required = false)
                                   @RequestParam(value = "clear",required = false)String clear){
        try {
            com.alibaba.fastjson.JSONObject json = patientDeviceService.updAqgDeviceSosInfo(deviceSn, seqid, name, num, dial_flag, clear);
            if(json.getBoolean("success")){
                return success("操作成功");
            }
            return error(-1,json.getString("error_desc"));
        }catch (Exception e){
            e.printStackTrace();
            return write(-1,"操作失败!");
        }
    }
    @ApiOperation("获取设备最新位置数据")
    @RequestMapping(value = "getDeviceLastLocation",method = RequestMethod.GET)
    public String getDeviceLastLocation(@ApiParam(name = "deviceSn",value = "设备sn码")
                                        @RequestParam(value = "deviceSn",required = true)String deviceSn,
                                        @ApiParam(name = "type",value = "type 0:Gps定位; 1:基站定位 (非必填)")
                                        @RequestParam(value = "type",required = false)String type){
        try {
            return write(200,"获取成功","data",patientDeviceService.getDeviceLastLocation(deviceSn,type));
        }catch (Exception e){
            e.printStackTrace();
            return write(-1,"获取失败!");
        }
    }
    @ApiOperation("更新智能手环设备安全区域")
    @RequestMapping(value = "updateDeviceFenceArea",method = RequestMethod.GET)
    public String updateDeviceFenceArea(@ApiParam(name = "deviceSn",value = "设备sn码")
                                        @RequestParam(value = "deviceSn",required = true)String deviceSn,
                                        @ApiParam(name = "fenceNO",value = "安全区编号")
                                        @RequestParam(value = "fenceNO",required = false)Integer fenceNO,
                                        @ApiParam(name = "enable",value = "0,1 是否启用")
                                        @RequestParam(value = "enable",required = false)String enable,
                                        @ApiParam(name = "name",value = "安全区名称")
                                        @RequestParam(value = "name",required = false)String name,
                                        @ApiParam(name = "freq",value = "0,触发一天;1,每日触发 ")
                                        @RequestParam(value = "freq",required = false)String freq,
                                        @ApiParam(name = "time_begin",value = "目标时间与当日0点之间相差的秒数 ")
                                        @RequestParam(value = "time_begin",required = false)String time_begin,
                                        @ApiParam(name = "time_end",value = "同上 ")
                                        @RequestParam(value = "time_end",required = false)String time_end,
                                        @ApiParam(name = "safe_area",value = "lon1,lat1;lon2,lat2; 5个坐标 形成一个封闭区域  A;B;C;D;A ")
                                        @RequestParam(value = "safe_area",required = false)String safe_area,
                                        @ApiParam(name = "clear",value = "删除标志,删除传1")
                                        @RequestParam(value = "clear",required = false)String clear
                                        ){
        try {
            return write(200,"获取成功","data",patientDeviceService.updateDeviceFenceArea(deviceSn, fenceNO, enable, name, freq, time_begin, time_end, safe_area, clear));
        }catch (Exception e){
            e.printStackTrace();
            return write(-1,"获取失败!");
        }
    }
}

+ 44 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/third/securrity/SecuMonOrderEndpoint.java

@ -0,0 +1,44 @@
package com.yihu.jw.care.endpoint.third.securrity;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.care.aop.ObserverRequired;
import com.yihu.jw.care.service.security.SecurityMonitoringOrderService;
import com.yihu.jw.restmodel.web.ObjEnvelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
/**
 * Created by Bing on 2021/5/11.
 */
@RestController
@RequestMapping(value = "/cloudCare/noLogin/security")
@Api(description = "安防监护 服务工单相关")
public class SecuMonOrderEndpoint extends EnvelopRestEndpoint {
    @Autowired
    private SecurityMonitoringOrderService securityMonitoringOrderService;
    @PostMapping(value = "createOrder")
    @ApiOperation(value = "创建安防服务工单")
    @ObserverRequired
    public ObjEnvelop createOrder(@ApiParam(name="jsonData",value = "json数据",required = true)
                                  @RequestParam(value = "jsonData")String jsonData){
        try {
            JSONObject result = securityMonitoringOrderService.createOrder(jsonData);
            if (result.getIntValue("resultFlag") == 0) {
                return ObjEnvelop.getError(result.getString("resultMsg"));
            }
            return ObjEnvelop.getSuccess("创建成功",result.getJSONObject("resultMsg"));
        }catch (Exception e){
            e.printStackTrace();
            return ObjEnvelop.getError("创建失败"+e.getMessage());
        }
    }
}

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

@ -606,16 +606,16 @@ public class EmergencyAssistanceService extends BaseJpaService<EmergencyAssistan
//        imUtill.sendMDTSocketMessageToDoctor(doctor,message.toString());
//        imUtill.sendMDTSocketMessageToDoctor(doctor,message.toString());
        //结束救助咨询
        //结束救助咨询
//        String sql = "select id from base_emergency_assistance_order where status!=1";
//        List<String> ids = jdbcTemplate.queryForList(sql,String.class);
//        for (String id:ids){
//            EmergencyAssistanceDO assistanceDO = emergencyAssistanceDao.findOne(orderID);
//            if (!consultTeamService.finishEmergencyConsult(assistanceDO,doctor,2)){
//                String failMsg = "咨询结束失败 无法完成工单";
//
//                return failMsg;
//            }
//        }
        String sql = "select id from base_emergency_assistance_order where status!=1";
        List<String> ids = jdbcTemplate.queryForList(sql,String.class);
        for (String id:ids){
            EmergencyAssistanceDO assistanceDO = emergencyAssistanceDao.findOne(orderID);
            if (!consultTeamService.finishEmergencyConsult(assistanceDO,doctor,2)){
                String failMsg = "咨询结束失败 无法完成工单";
                return failMsg;
            }
        }
        return null;
        return null;
    }
    }

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

@ -142,7 +142,7 @@ public class DeviceService {
                }
                }
                if (json != null) {
                if (json != null) {
                    logDO.setSosLat(json.get("lat").toString());
                    logDO.setSosLat(json.get("lat").toString());
                    logDO.setSosLon(json.get("lon").toString());
                    logDO.setSosLon(json.get("lng").toString());
                }
                }
            }
            }
            //发送紧急救助
            //发送紧急救助
@ -208,7 +208,6 @@ public class DeviceService {
        try {
        try {
        } catch (Exception e) {
        } catch (Exception e) {
            e.printStackTrace();
            e.printStackTrace();
        }
        }
@ -233,7 +232,57 @@ public class DeviceService {
    public void pushdata(int type,String deviceid,String communityid,HttpServletRequest request) {
    public void pushdata(int type,String deviceid,String communityid,HttpServletRequest request) {
        try {
        try {
            if(StringUtils.isNotBlank(deviceid)){
            if(StringUtils.isNotBlank(deviceid)){
                if (type==4){
                    List<DevicePatientDevice> devicePatientDeviceDos = patientDeviceDao.findByDeviceSn(deviceid);
                    if (devicePatientDeviceDos.size()>0){
                        DevicePatientDevice deviceDO = devicePatientDeviceDos.get(0);
                        BasePatientDO patientDO = patientDao.findById(deviceDO.getUser());
                        if (deviceDO.getCategoryCode().equals("4")) {
                            //获取手环最新定位信息
                            String url = cloudCareUrl+"/cloudCare/noLogin/device/getDeviceLastLocation";
                            Map map = new HashMap<String, String>();
                            map.put("deviceSn",deviceDO.getDeviceSn());
                            String content = com.alibaba.fastjson.JSONObject.toJSONString(map);
                            String postParams = AesEncryptUtils.agEncrypt(content);
                            String response = httpClientUtil.getBodyRawForm(url,postParams);
                            JSONObject result = com.alibaba.fastjson.JSONObject.parseObject(response);
                            JSONObject jsonObjectData =JSONObject.parseObject(AesEncryptUtils.agDecrypt(result.getString("data")));
                            Double lat = jsonObjectData.getJSONObject("data").getJSONObject("obj").getJSONObject("locationdata").getJSONObject("point").getDouble("lat");
                            Double lon = jsonObjectData.getJSONObject("data").getJSONObject("obj").getJSONObject("locationdata").getJSONObject("point").getDouble("lon");
                            String address = jsonObjectData.getJSONObject("data").getJSONObject("obj").getJSONObject("locationdata").getString("address");
                            String sql ="select DISTINCT item.org_code,item.org_name\n" +
                                    " from base_service_package_sign_record sr,base_service_package_record pr,base_service_package_item item ,base_service_package pack\n" +
                                    "where pr.patient = '"+patientDO.getId()+"' and sr.id = pr.sign_id and pr.service_package_id = item.service_package_id \tand  item.`code`='preventLost'  and item.service_package_id = pack.id \n" +
                                    "  and pack.del=1";
                            List<Map<String,Object>> sqlResult = jdbcTemplate.queryForList(sql);
                            if (sqlResult.size()>0){
                                map = new HashMap();
                                url = cloudCareUrl+"/cloudCare/noLogin/security/createOrder";
                                JSONObject jsonObject = new JSONObject();
                                jsonObject.put("patient",patientDO.getId());
                                jsonObject.put("patientName",patientDO.getName());
                                jsonObject.put("patientPhone",patientDO.getMobile());
                                jsonObject.put("serveDesc","疑似离开安全区域");
                                jsonObject.put("hospital",sqlResult.get(0).get("org_code"));
                                jsonObject.put("serveAddress",address.replace(" ",""));
                                jsonObject.put("serveLat",lat);
                                jsonObject.put("serveLon",lon);
                                JSONObject jsonObjectParam = new JSONObject();
                                jsonObjectParam.put("order", jsonObject);
                                map.put("jsonData", jsonObjectParam.toJSONString());
                                content = com.alibaba.fastjson.JSONObject.toJSONString(map);
                                postParams = AesEncryptUtils.agEncrypt(content);
                                response = httpClientUtil.postBodyRawForm(url,postParams);
                                result = com.alibaba.fastjson.JSONObject.parseObject(response);
                                jsonObjectData =JSONObject.parseObject(AesEncryptUtils.agDecrypt(result.getString("data")));
                                System.out.println(jsonObjectData.toJSONString());
                            }
                        }
                    }
                }
            }
            }